@substrate-system/keys 0.2.4 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var df=Object.create;var gr=Object.defineProperty;var lf=Object.getOwnPropertyDescriptor;var gf=Object.getOwnPropertyNames;var bf=Object.getPrototypeOf,mf=Object.prototype.hasOwnProperty;var Af=(n,t,f)=>t in n?gr(n,t,{enumerable:!0,configurable:!0,writable:!0,value:f}):n[t]=f;var y=(n,t)=>gr(n,"name",{value:t,configurable:!0}),En=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(t,f)=>(typeof require<"u"?require:t)[f]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var Kn=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),Be=(n,t)=>{for(var f in t)gr(n,f,{get:t[f],enumerable:!0})},wf=(n,t,f,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let x of gf(t))!mf.call(n,x)&&x!==f&&gr(n,x,{get:()=>t[x],enumerable:!(c=lf(t,x))||c.enumerable});return n};var Ef=(n,t,f)=>(f=n!=null?df(bf(n)):{},wf(t||!n||!n.__esModule?gr(f,"default",{value:n,enumerable:!0}):f,n));var O=(n,t,f)=>Af(n,typeof t!="symbol"?t+"":t,f);var $n=Kn(()=>{"use strict"});var Zn=Kn(($a,Vr)=>{"use strict";(function(n){"use strict";var t=y(function(r){var o,i=new Float64Array(16);if(r)for(o=0;o<r.length;o++)i[o]=r[o];return i},"gf"),f=y(function(){throw new Error("no PRNG")},"randombytes"),c=new Uint8Array(16),x=new Uint8Array(32);x[0]=9;var m=t(),U=t([1]),X=t([56129,1]),ne=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),ue=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),Ae=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),Pe=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Re=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function er(r,o,i,e){r[o]=i>>24&255,r[o+1]=i>>16&255,r[o+2]=i>>8&255,r[o+3]=i&255,r[o+4]=e>>24&255,r[o+5]=e>>16&255,r[o+6]=e>>8&255,r[o+7]=e&255}y(er,"ts64");function $(r,o,i,e,a){var u,p=0;for(u=0;u<a;u++)p|=r[o+u]^i[e+u];return(1&p-1>>>8)-1}y($,"vn");function se(r,o,i,e){return $(r,o,i,e,16)}y(se,"crypto_verify_16");function Ke(r,o,i,e){return $(r,o,i,e,32)}y(Ke,"crypto_verify_32");function we(r,o,i,e){for(var a=e[0]&255|(e[1]&255)<<8|(e[2]&255)<<16|(e[3]&255)<<24,u=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,p=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,g=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,E=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,T=e[4]&255|(e[5]&255)<<8|(e[6]&255)<<16|(e[7]&255)<<24,v=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,J=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,_=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,I=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,L=e[8]&255|(e[9]&255)<<8|(e[10]&255)<<16|(e[11]&255)<<24,j=i[16]&255|(i[17]&255)<<8|(i[18]&255)<<16|(i[19]&255)<<24,Y=i[20]&255|(i[21]&255)<<8|(i[22]&255)<<16|(i[23]&255)<<24,N=i[24]&255|(i[25]&255)<<8|(i[26]&255)<<16|(i[27]&255)<<24,z=i[28]&255|(i[29]&255)<<8|(i[30]&255)<<16|(i[31]&255)<<24,R=e[12]&255|(e[13]&255)<<8|(e[14]&255)<<16|(e[15]&255)<<24,C=a,D=u,S=p,B=g,P=E,K=T,h=v,d=J,A=_,l=I,b=L,w=j,M=Y,H=N,G=z,F=R,s,W=0;W<20;W+=2)s=C+M|0,P^=s<<7|s>>>25,s=P+C|0,A^=s<<9|s>>>23,s=A+P|0,M^=s<<13|s>>>19,s=M+A|0,C^=s<<18|s>>>14,s=K+D|0,l^=s<<7|s>>>25,s=l+K|0,H^=s<<9|s>>>23,s=H+l|0,D^=s<<13|s>>>19,s=D+H|0,K^=s<<18|s>>>14,s=b+h|0,G^=s<<7|s>>>25,s=G+b|0,S^=s<<9|s>>>23,s=S+G|0,h^=s<<13|s>>>19,s=h+S|0,b^=s<<18|s>>>14,s=F+w|0,B^=s<<7|s>>>25,s=B+F|0,d^=s<<9|s>>>23,s=d+B|0,w^=s<<13|s>>>19,s=w+d|0,F^=s<<18|s>>>14,s=C+B|0,D^=s<<7|s>>>25,s=D+C|0,S^=s<<9|s>>>23,s=S+D|0,B^=s<<13|s>>>19,s=B+S|0,C^=s<<18|s>>>14,s=K+P|0,h^=s<<7|s>>>25,s=h+K|0,d^=s<<9|s>>>23,s=d+h|0,P^=s<<13|s>>>19,s=P+d|0,K^=s<<18|s>>>14,s=b+l|0,w^=s<<7|s>>>25,s=w+b|0,A^=s<<9|s>>>23,s=A+w|0,l^=s<<13|s>>>19,s=l+A|0,b^=s<<18|s>>>14,s=F+G|0,M^=s<<7|s>>>25,s=M+F|0,H^=s<<9|s>>>23,s=H+M|0,G^=s<<13|s>>>19,s=G+H|0,F^=s<<18|s>>>14;C=C+a|0,D=D+u|0,S=S+p|0,B=B+g|0,P=P+E|0,K=K+T|0,h=h+v|0,d=d+J|0,A=A+_|0,l=l+I|0,b=b+L|0,w=w+j|0,M=M+Y|0,H=H+N|0,G=G+z|0,F=F+R|0,r[0]=C>>>0&255,r[1]=C>>>8&255,r[2]=C>>>16&255,r[3]=C>>>24&255,r[4]=D>>>0&255,r[5]=D>>>8&255,r[6]=D>>>16&255,r[7]=D>>>24&255,r[8]=S>>>0&255,r[9]=S>>>8&255,r[10]=S>>>16&255,r[11]=S>>>24&255,r[12]=B>>>0&255,r[13]=B>>>8&255,r[14]=B>>>16&255,r[15]=B>>>24&255,r[16]=P>>>0&255,r[17]=P>>>8&255,r[18]=P>>>16&255,r[19]=P>>>24&255,r[20]=K>>>0&255,r[21]=K>>>8&255,r[22]=K>>>16&255,r[23]=K>>>24&255,r[24]=h>>>0&255,r[25]=h>>>8&255,r[26]=h>>>16&255,r[27]=h>>>24&255,r[28]=d>>>0&255,r[29]=d>>>8&255,r[30]=d>>>16&255,r[31]=d>>>24&255,r[32]=A>>>0&255,r[33]=A>>>8&255,r[34]=A>>>16&255,r[35]=A>>>24&255,r[36]=l>>>0&255,r[37]=l>>>8&255,r[38]=l>>>16&255,r[39]=l>>>24&255,r[40]=b>>>0&255,r[41]=b>>>8&255,r[42]=b>>>16&255,r[43]=b>>>24&255,r[44]=w>>>0&255,r[45]=w>>>8&255,r[46]=w>>>16&255,r[47]=w>>>24&255,r[48]=M>>>0&255,r[49]=M>>>8&255,r[50]=M>>>16&255,r[51]=M>>>24&255,r[52]=H>>>0&255,r[53]=H>>>8&255,r[54]=H>>>16&255,r[55]=H>>>24&255,r[56]=G>>>0&255,r[57]=G>>>8&255,r[58]=G>>>16&255,r[59]=G>>>24&255,r[60]=F>>>0&255,r[61]=F>>>8&255,r[62]=F>>>16&255,r[63]=F>>>24&255}y(we,"core_salsa20");function de(r,o,i,e){for(var a=e[0]&255|(e[1]&255)<<8|(e[2]&255)<<16|(e[3]&255)<<24,u=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,p=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,g=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,E=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,T=e[4]&255|(e[5]&255)<<8|(e[6]&255)<<16|(e[7]&255)<<24,v=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,J=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,_=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,I=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,L=e[8]&255|(e[9]&255)<<8|(e[10]&255)<<16|(e[11]&255)<<24,j=i[16]&255|(i[17]&255)<<8|(i[18]&255)<<16|(i[19]&255)<<24,Y=i[20]&255|(i[21]&255)<<8|(i[22]&255)<<16|(i[23]&255)<<24,N=i[24]&255|(i[25]&255)<<8|(i[26]&255)<<16|(i[27]&255)<<24,z=i[28]&255|(i[29]&255)<<8|(i[30]&255)<<16|(i[31]&255)<<24,R=e[12]&255|(e[13]&255)<<8|(e[14]&255)<<16|(e[15]&255)<<24,C=a,D=u,S=p,B=g,P=E,K=T,h=v,d=J,A=_,l=I,b=L,w=j,M=Y,H=N,G=z,F=R,s,W=0;W<20;W+=2)s=C+M|0,P^=s<<7|s>>>25,s=P+C|0,A^=s<<9|s>>>23,s=A+P|0,M^=s<<13|s>>>19,s=M+A|0,C^=s<<18|s>>>14,s=K+D|0,l^=s<<7|s>>>25,s=l+K|0,H^=s<<9|s>>>23,s=H+l|0,D^=s<<13|s>>>19,s=D+H|0,K^=s<<18|s>>>14,s=b+h|0,G^=s<<7|s>>>25,s=G+b|0,S^=s<<9|s>>>23,s=S+G|0,h^=s<<13|s>>>19,s=h+S|0,b^=s<<18|s>>>14,s=F+w|0,B^=s<<7|s>>>25,s=B+F|0,d^=s<<9|s>>>23,s=d+B|0,w^=s<<13|s>>>19,s=w+d|0,F^=s<<18|s>>>14,s=C+B|0,D^=s<<7|s>>>25,s=D+C|0,S^=s<<9|s>>>23,s=S+D|0,B^=s<<13|s>>>19,s=B+S|0,C^=s<<18|s>>>14,s=K+P|0,h^=s<<7|s>>>25,s=h+K|0,d^=s<<9|s>>>23,s=d+h|0,P^=s<<13|s>>>19,s=P+d|0,K^=s<<18|s>>>14,s=b+l|0,w^=s<<7|s>>>25,s=w+b|0,A^=s<<9|s>>>23,s=A+w|0,l^=s<<13|s>>>19,s=l+A|0,b^=s<<18|s>>>14,s=F+G|0,M^=s<<7|s>>>25,s=M+F|0,H^=s<<9|s>>>23,s=H+M|0,G^=s<<13|s>>>19,s=G+H|0,F^=s<<18|s>>>14;r[0]=C>>>0&255,r[1]=C>>>8&255,r[2]=C>>>16&255,r[3]=C>>>24&255,r[4]=K>>>0&255,r[5]=K>>>8&255,r[6]=K>>>16&255,r[7]=K>>>24&255,r[8]=b>>>0&255,r[9]=b>>>8&255,r[10]=b>>>16&255,r[11]=b>>>24&255,r[12]=F>>>0&255,r[13]=F>>>8&255,r[14]=F>>>16&255,r[15]=F>>>24&255,r[16]=h>>>0&255,r[17]=h>>>8&255,r[18]=h>>>16&255,r[19]=h>>>24&255,r[20]=d>>>0&255,r[21]=d>>>8&255,r[22]=d>>>16&255,r[23]=d>>>24&255,r[24]=A>>>0&255,r[25]=A>>>8&255,r[26]=A>>>16&255,r[27]=A>>>24&255,r[28]=l>>>0&255,r[29]=l>>>8&255,r[30]=l>>>16&255,r[31]=l>>>24&255}y(de,"core_hsalsa20");function Ee(r,o,i,e){we(r,o,i,e)}y(Ee,"crypto_core_salsa20");function le(r,o,i,e){de(r,o,i,e)}y(le,"crypto_core_hsalsa20");var pe=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Te(r,o,i,e,a,u,p){var g=new Uint8Array(16),E=new Uint8Array(64),T,v;for(v=0;v<16;v++)g[v]=0;for(v=0;v<8;v++)g[v]=u[v];for(;a>=64;){for(Ee(E,g,p,pe),v=0;v<64;v++)r[o+v]=i[e+v]^E[v];for(T=1,v=8;v<16;v++)T=T+(g[v]&255)|0,g[v]=T&255,T>>>=8;a-=64,o+=64,e+=64}if(a>0)for(Ee(E,g,p,pe),v=0;v<a;v++)r[o+v]=i[e+v]^E[v];return 0}y(Te,"crypto_stream_salsa20_xor");function ve(r,o,i,e,a){var u=new Uint8Array(16),p=new Uint8Array(64),g,E;for(E=0;E<16;E++)u[E]=0;for(E=0;E<8;E++)u[E]=e[E];for(;i>=64;){for(Ee(p,u,a,pe),E=0;E<64;E++)r[o+E]=p[E];for(g=1,E=8;E<16;E++)g=g+(u[E]&255)|0,u[E]=g&255,g>>>=8;i-=64,o+=64}if(i>0)for(Ee(p,u,a,pe),E=0;E<i;E++)r[o+E]=p[E];return 0}y(ve,"crypto_stream_salsa20");function _e(r,o,i,e,a){var u=new Uint8Array(32);le(u,e,a,pe);for(var p=new Uint8Array(8),g=0;g<8;g++)p[g]=e[g+16];return ve(r,o,i,p,u)}y(_e,"crypto_stream");function Ge(r,o,i,e,a,u,p){var g=new Uint8Array(32);le(g,u,p,pe);for(var E=new Uint8Array(8),T=0;T<8;T++)E[T]=u[T+16];return Te(r,o,i,e,a,E,g)}y(Ge,"crypto_stream_xor");var Br=y(function(r){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var o,i,e,a,u,p,g,E;o=r[0]&255|(r[1]&255)<<8,this.r[0]=o&8191,i=r[2]&255|(r[3]&255)<<8,this.r[1]=(o>>>13|i<<3)&8191,e=r[4]&255|(r[5]&255)<<8,this.r[2]=(i>>>10|e<<6)&7939,a=r[6]&255|(r[7]&255)<<8,this.r[3]=(e>>>7|a<<9)&8191,u=r[8]&255|(r[9]&255)<<8,this.r[4]=(a>>>4|u<<12)&255,this.r[5]=u>>>1&8190,p=r[10]&255|(r[11]&255)<<8,this.r[6]=(u>>>14|p<<2)&8191,g=r[12]&255|(r[13]&255)<<8,this.r[7]=(p>>>11|g<<5)&8065,E=r[14]&255|(r[15]&255)<<8,this.r[8]=(g>>>8|E<<8)&8191,this.r[9]=E>>>5&127,this.pad[0]=r[16]&255|(r[17]&255)<<8,this.pad[1]=r[18]&255|(r[19]&255)<<8,this.pad[2]=r[20]&255|(r[21]&255)<<8,this.pad[3]=r[22]&255|(r[23]&255)<<8,this.pad[4]=r[24]&255|(r[25]&255)<<8,this.pad[5]=r[26]&255|(r[27]&255)<<8,this.pad[6]=r[28]&255|(r[29]&255)<<8,this.pad[7]=r[30]&255|(r[31]&255)<<8},"poly1305");Br.prototype.blocks=function(r,o,i){for(var e=this.fin?0:2048,a,u,p,g,E,T,v,J,_,I,L,j,Y,N,z,R,C,D,S,B=this.h[0],P=this.h[1],K=this.h[2],h=this.h[3],d=this.h[4],A=this.h[5],l=this.h[6],b=this.h[7],w=this.h[8],M=this.h[9],H=this.r[0],G=this.r[1],F=this.r[2],s=this.r[3],W=this.r[4],Q=this.r[5],ee=this.r[6],V=this.r[7],Z=this.r[8],q=this.r[9];i>=16;)a=r[o+0]&255|(r[o+1]&255)<<8,B+=a&8191,u=r[o+2]&255|(r[o+3]&255)<<8,P+=(a>>>13|u<<3)&8191,p=r[o+4]&255|(r[o+5]&255)<<8,K+=(u>>>10|p<<6)&8191,g=r[o+6]&255|(r[o+7]&255)<<8,h+=(p>>>7|g<<9)&8191,E=r[o+8]&255|(r[o+9]&255)<<8,d+=(g>>>4|E<<12)&8191,A+=E>>>1&8191,T=r[o+10]&255|(r[o+11]&255)<<8,l+=(E>>>14|T<<2)&8191,v=r[o+12]&255|(r[o+13]&255)<<8,b+=(T>>>11|v<<5)&8191,J=r[o+14]&255|(r[o+15]&255)<<8,w+=(v>>>8|J<<8)&8191,M+=J>>>5|e,_=0,I=_,I+=B*H,I+=P*(5*q),I+=K*(5*Z),I+=h*(5*V),I+=d*(5*ee),_=I>>>13,I&=8191,I+=A*(5*Q),I+=l*(5*W),I+=b*(5*s),I+=w*(5*F),I+=M*(5*G),_+=I>>>13,I&=8191,L=_,L+=B*G,L+=P*H,L+=K*(5*q),L+=h*(5*Z),L+=d*(5*V),_=L>>>13,L&=8191,L+=A*(5*ee),L+=l*(5*Q),L+=b*(5*W),L+=w*(5*s),L+=M*(5*F),_+=L>>>13,L&=8191,j=_,j+=B*F,j+=P*G,j+=K*H,j+=h*(5*q),j+=d*(5*Z),_=j>>>13,j&=8191,j+=A*(5*V),j+=l*(5*ee),j+=b*(5*Q),j+=w*(5*W),j+=M*(5*s),_+=j>>>13,j&=8191,Y=_,Y+=B*s,Y+=P*F,Y+=K*G,Y+=h*H,Y+=d*(5*q),_=Y>>>13,Y&=8191,Y+=A*(5*Z),Y+=l*(5*V),Y+=b*(5*ee),Y+=w*(5*Q),Y+=M*(5*W),_+=Y>>>13,Y&=8191,N=_,N+=B*W,N+=P*s,N+=K*F,N+=h*G,N+=d*H,_=N>>>13,N&=8191,N+=A*(5*q),N+=l*(5*Z),N+=b*(5*V),N+=w*(5*ee),N+=M*(5*Q),_+=N>>>13,N&=8191,z=_,z+=B*Q,z+=P*W,z+=K*s,z+=h*F,z+=d*G,_=z>>>13,z&=8191,z+=A*H,z+=l*(5*q),z+=b*(5*Z),z+=w*(5*V),z+=M*(5*ee),_+=z>>>13,z&=8191,R=_,R+=B*ee,R+=P*Q,R+=K*W,R+=h*s,R+=d*F,_=R>>>13,R&=8191,R+=A*G,R+=l*H,R+=b*(5*q),R+=w*(5*Z),R+=M*(5*V),_+=R>>>13,R&=8191,C=_,C+=B*V,C+=P*ee,C+=K*Q,C+=h*W,C+=d*s,_=C>>>13,C&=8191,C+=A*F,C+=l*G,C+=b*H,C+=w*(5*q),C+=M*(5*Z),_+=C>>>13,C&=8191,D=_,D+=B*Z,D+=P*V,D+=K*ee,D+=h*Q,D+=d*W,_=D>>>13,D&=8191,D+=A*s,D+=l*F,D+=b*G,D+=w*H,D+=M*(5*q),_+=D>>>13,D&=8191,S=_,S+=B*q,S+=P*Z,S+=K*V,S+=h*ee,S+=d*Q,_=S>>>13,S&=8191,S+=A*W,S+=l*s,S+=b*F,S+=w*G,S+=M*H,_+=S>>>13,S&=8191,_=(_<<2)+_|0,_=_+I|0,I=_&8191,_=_>>>13,L+=_,B=I,P=L,K=j,h=Y,d=N,A=z,l=R,b=C,w=D,M=S,o+=16,i-=16;this.h[0]=B,this.h[1]=P,this.h[2]=K,this.h[3]=h,this.h[4]=d,this.h[5]=A,this.h[6]=l,this.h[7]=b,this.h[8]=w,this.h[9]=M},Br.prototype.finish=function(r,o){var i=new Uint16Array(10),e,a,u,p;if(this.leftover){for(p=this.leftover,this.buffer[p++]=1;p<16;p++)this.buffer[p]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(e=this.h[1]>>>13,this.h[1]&=8191,p=2;p<10;p++)this.h[p]+=e,e=this.h[p]>>>13,this.h[p]&=8191;for(this.h[0]+=e*5,e=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=e,e=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=e,i[0]=this.h[0]+5,e=i[0]>>>13,i[0]&=8191,p=1;p<10;p++)i[p]=this.h[p]+e,e=i[p]>>>13,i[p]&=8191;for(i[9]-=8192,a=(e^1)-1,p=0;p<10;p++)i[p]&=a;for(a=~a,p=0;p<10;p++)this.h[p]=this.h[p]&a|i[p];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,u=this.h[0]+this.pad[0],this.h[0]=u&65535,p=1;p<8;p++)u=(this.h[p]+this.pad[p]|0)+(u>>>16)|0,this.h[p]=u&65535;r[o+0]=this.h[0]>>>0&255,r[o+1]=this.h[0]>>>8&255,r[o+2]=this.h[1]>>>0&255,r[o+3]=this.h[1]>>>8&255,r[o+4]=this.h[2]>>>0&255,r[o+5]=this.h[2]>>>8&255,r[o+6]=this.h[3]>>>0&255,r[o+7]=this.h[3]>>>8&255,r[o+8]=this.h[4]>>>0&255,r[o+9]=this.h[4]>>>8&255,r[o+10]=this.h[5]>>>0&255,r[o+11]=this.h[5]>>>8&255,r[o+12]=this.h[6]>>>0&255,r[o+13]=this.h[6]>>>8&255,r[o+14]=this.h[7]>>>0&255,r[o+15]=this.h[7]>>>8&255},Br.prototype.update=function(r,o,i){var e,a;if(this.leftover){for(a=16-this.leftover,a>i&&(a=i),e=0;e<a;e++)this.buffer[this.leftover+e]=r[o+e];if(i-=a,o+=a,this.leftover+=a,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(i>=16&&(a=i-i%16,this.blocks(r,o,a),o+=a,i-=a),i){for(e=0;e<i;e++)this.buffer[this.leftover+e]=r[o+e];this.leftover+=i}};function Jr(r,o,i,e,a,u){var p=new Br(u);return p.update(i,e,a),p.finish(r,o),0}y(Jr,"crypto_onetimeauth");function sn(r,o,i,e,a,u){var p=new Uint8Array(16);return Jr(p,0,i,e,a,u),se(r,o,p,0)}y(sn,"crypto_onetimeauth_verify");function Qr(r,o,i,e,a){var u;if(i<32)return-1;for(Ge(r,0,o,0,i,e,a),Jr(r,16,r,32,i-32,r),u=0;u<16;u++)r[u]=0;return 0}y(Qr,"crypto_secretbox");function et(r,o,i,e,a){var u,p=new Uint8Array(32);if(i<32||(_e(p,0,32,e,a),sn(o,16,o,32,i-32,p)!==0))return-1;for(Ge(r,0,o,0,i,e,a),u=0;u<32;u++)r[u]=0;return 0}y(et,"crypto_secretbox_open");function ze(r,o){var i;for(i=0;i<16;i++)r[i]=o[i]|0}y(ze,"set25519");function rt(r){var o,i,e=1;for(o=0;o<16;o++)i=r[o]+e+65535,e=Math.floor(i/65536),r[o]=i-e*65536;r[0]+=e-1+37*(e-1)}y(rt,"car25519");function rr(r,o,i){for(var e,a=~(i-1),u=0;u<16;u++)e=a&(r[u]^o[u]),r[u]^=e,o[u]^=e}y(rr,"sel25519");function tr(r,o){var i,e,a,u=t(),p=t();for(i=0;i<16;i++)p[i]=o[i];for(rt(p),rt(p),rt(p),e=0;e<2;e++){for(u[0]=p[0]-65517,i=1;i<15;i++)u[i]=p[i]-65535-(u[i-1]>>16&1),u[i-1]&=65535;u[15]=p[15]-32767-(u[14]>>16&1),a=u[15]>>16&1,u[14]&=65535,rr(p,u,1-a)}for(i=0;i<16;i++)r[2*i]=p[i]&255,r[2*i+1]=p[i]>>8}y(tr,"pack25519");function cn(r,o){var i=new Uint8Array(32),e=new Uint8Array(32);return tr(i,r),tr(e,o),Ke(i,0,e,0)}y(cn,"neq25519");function yn(r){var o=new Uint8Array(32);return tr(o,r),o[0]&1}y(yn,"par25519");function tt(r,o){var i;for(i=0;i<16;i++)r[i]=o[2*i]+(o[2*i+1]<<8);r[15]&=32767}y(tt,"unpack25519");function De(r,o,i){for(var e=0;e<16;e++)r[e]=o[e]+i[e]}y(De,"A");function Me(r,o,i){for(var e=0;e<16;e++)r[e]=o[e]-i[e]}y(Me,"Z");function k(r,o,i){var e,a,u=0,p=0,g=0,E=0,T=0,v=0,J=0,_=0,I=0,L=0,j=0,Y=0,N=0,z=0,R=0,C=0,D=0,S=0,B=0,P=0,K=0,h=0,d=0,A=0,l=0,b=0,w=0,M=0,H=0,G=0,F=0,s=i[0],W=i[1],Q=i[2],ee=i[3],V=i[4],Z=i[5],q=i[6],ce=i[7],te=i[8],fe=i[9],ie=i[10],oe=i[11],xe=i[12],ge=i[13],be=i[14],me=i[15];e=o[0],u+=e*s,p+=e*W,g+=e*Q,E+=e*ee,T+=e*V,v+=e*Z,J+=e*q,_+=e*ce,I+=e*te,L+=e*fe,j+=e*ie,Y+=e*oe,N+=e*xe,z+=e*ge,R+=e*be,C+=e*me,e=o[1],p+=e*s,g+=e*W,E+=e*Q,T+=e*ee,v+=e*V,J+=e*Z,_+=e*q,I+=e*ce,L+=e*te,j+=e*fe,Y+=e*ie,N+=e*oe,z+=e*xe,R+=e*ge,C+=e*be,D+=e*me,e=o[2],g+=e*s,E+=e*W,T+=e*Q,v+=e*ee,J+=e*V,_+=e*Z,I+=e*q,L+=e*ce,j+=e*te,Y+=e*fe,N+=e*ie,z+=e*oe,R+=e*xe,C+=e*ge,D+=e*be,S+=e*me,e=o[3],E+=e*s,T+=e*W,v+=e*Q,J+=e*ee,_+=e*V,I+=e*Z,L+=e*q,j+=e*ce,Y+=e*te,N+=e*fe,z+=e*ie,R+=e*oe,C+=e*xe,D+=e*ge,S+=e*be,B+=e*me,e=o[4],T+=e*s,v+=e*W,J+=e*Q,_+=e*ee,I+=e*V,L+=e*Z,j+=e*q,Y+=e*ce,N+=e*te,z+=e*fe,R+=e*ie,C+=e*oe,D+=e*xe,S+=e*ge,B+=e*be,P+=e*me,e=o[5],v+=e*s,J+=e*W,_+=e*Q,I+=e*ee,L+=e*V,j+=e*Z,Y+=e*q,N+=e*ce,z+=e*te,R+=e*fe,C+=e*ie,D+=e*oe,S+=e*xe,B+=e*ge,P+=e*be,K+=e*me,e=o[6],J+=e*s,_+=e*W,I+=e*Q,L+=e*ee,j+=e*V,Y+=e*Z,N+=e*q,z+=e*ce,R+=e*te,C+=e*fe,D+=e*ie,S+=e*oe,B+=e*xe,P+=e*ge,K+=e*be,h+=e*me,e=o[7],_+=e*s,I+=e*W,L+=e*Q,j+=e*ee,Y+=e*V,N+=e*Z,z+=e*q,R+=e*ce,C+=e*te,D+=e*fe,S+=e*ie,B+=e*oe,P+=e*xe,K+=e*ge,h+=e*be,d+=e*me,e=o[8],I+=e*s,L+=e*W,j+=e*Q,Y+=e*ee,N+=e*V,z+=e*Z,R+=e*q,C+=e*ce,D+=e*te,S+=e*fe,B+=e*ie,P+=e*oe,K+=e*xe,h+=e*ge,d+=e*be,A+=e*me,e=o[9],L+=e*s,j+=e*W,Y+=e*Q,N+=e*ee,z+=e*V,R+=e*Z,C+=e*q,D+=e*ce,S+=e*te,B+=e*fe,P+=e*ie,K+=e*oe,h+=e*xe,d+=e*ge,A+=e*be,l+=e*me,e=o[10],j+=e*s,Y+=e*W,N+=e*Q,z+=e*ee,R+=e*V,C+=e*Z,D+=e*q,S+=e*ce,B+=e*te,P+=e*fe,K+=e*ie,h+=e*oe,d+=e*xe,A+=e*ge,l+=e*be,b+=e*me,e=o[11],Y+=e*s,N+=e*W,z+=e*Q,R+=e*ee,C+=e*V,D+=e*Z,S+=e*q,B+=e*ce,P+=e*te,K+=e*fe,h+=e*ie,d+=e*oe,A+=e*xe,l+=e*ge,b+=e*be,w+=e*me,e=o[12],N+=e*s,z+=e*W,R+=e*Q,C+=e*ee,D+=e*V,S+=e*Z,B+=e*q,P+=e*ce,K+=e*te,h+=e*fe,d+=e*ie,A+=e*oe,l+=e*xe,b+=e*ge,w+=e*be,M+=e*me,e=o[13],z+=e*s,R+=e*W,C+=e*Q,D+=e*ee,S+=e*V,B+=e*Z,P+=e*q,K+=e*ce,h+=e*te,d+=e*fe,A+=e*ie,l+=e*oe,b+=e*xe,w+=e*ge,M+=e*be,H+=e*me,e=o[14],R+=e*s,C+=e*W,D+=e*Q,S+=e*ee,B+=e*V,P+=e*Z,K+=e*q,h+=e*ce,d+=e*te,A+=e*fe,l+=e*ie,b+=e*oe,w+=e*xe,M+=e*ge,H+=e*be,G+=e*me,e=o[15],C+=e*s,D+=e*W,S+=e*Q,B+=e*ee,P+=e*V,K+=e*Z,h+=e*q,d+=e*ce,A+=e*te,l+=e*fe,b+=e*ie,w+=e*oe,M+=e*xe,H+=e*ge,G+=e*be,F+=e*me,u+=38*D,p+=38*S,g+=38*B,E+=38*P,T+=38*K,v+=38*h,J+=38*d,_+=38*A,I+=38*l,L+=38*b,j+=38*w,Y+=38*M,N+=38*H,z+=38*G,R+=38*F,a=1,e=u+a+65535,a=Math.floor(e/65536),u=e-a*65536,e=p+a+65535,a=Math.floor(e/65536),p=e-a*65536,e=g+a+65535,a=Math.floor(e/65536),g=e-a*65536,e=E+a+65535,a=Math.floor(e/65536),E=e-a*65536,e=T+a+65535,a=Math.floor(e/65536),T=e-a*65536,e=v+a+65535,a=Math.floor(e/65536),v=e-a*65536,e=J+a+65535,a=Math.floor(e/65536),J=e-a*65536,e=_+a+65535,a=Math.floor(e/65536),_=e-a*65536,e=I+a+65535,a=Math.floor(e/65536),I=e-a*65536,e=L+a+65535,a=Math.floor(e/65536),L=e-a*65536,e=j+a+65535,a=Math.floor(e/65536),j=e-a*65536,e=Y+a+65535,a=Math.floor(e/65536),Y=e-a*65536,e=N+a+65535,a=Math.floor(e/65536),N=e-a*65536,e=z+a+65535,a=Math.floor(e/65536),z=e-a*65536,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,e=C+a+65535,a=Math.floor(e/65536),C=e-a*65536,u+=a-1+37*(a-1),a=1,e=u+a+65535,a=Math.floor(e/65536),u=e-a*65536,e=p+a+65535,a=Math.floor(e/65536),p=e-a*65536,e=g+a+65535,a=Math.floor(e/65536),g=e-a*65536,e=E+a+65535,a=Math.floor(e/65536),E=e-a*65536,e=T+a+65535,a=Math.floor(e/65536),T=e-a*65536,e=v+a+65535,a=Math.floor(e/65536),v=e-a*65536,e=J+a+65535,a=Math.floor(e/65536),J=e-a*65536,e=_+a+65535,a=Math.floor(e/65536),_=e-a*65536,e=I+a+65535,a=Math.floor(e/65536),I=e-a*65536,e=L+a+65535,a=Math.floor(e/65536),L=e-a*65536,e=j+a+65535,a=Math.floor(e/65536),j=e-a*65536,e=Y+a+65535,a=Math.floor(e/65536),Y=e-a*65536,e=N+a+65535,a=Math.floor(e/65536),N=e-a*65536,e=z+a+65535,a=Math.floor(e/65536),z=e-a*65536,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,e=C+a+65535,a=Math.floor(e/65536),C=e-a*65536,u+=a-1+37*(a-1),r[0]=u,r[1]=p,r[2]=g,r[3]=E,r[4]=T,r[5]=v,r[6]=J,r[7]=_,r[8]=I,r[9]=L,r[10]=j,r[11]=Y,r[12]=N,r[13]=z,r[14]=R,r[15]=C}y(k,"M");function Ce(r,o){k(r,o,o)}y(Ce,"S");function xn(r,o){var i=t(),e;for(e=0;e<16;e++)i[e]=o[e];for(e=253;e>=0;e--)Ce(i,i),e!==2&&e!==4&&k(i,i,o);for(e=0;e<16;e++)r[e]=i[e]}y(xn,"inv25519");function un(r,o){var i=t(),e;for(e=0;e<16;e++)i[e]=o[e];for(e=250;e>=0;e--)Ce(i,i),e!==1&&k(i,i,o);for(e=0;e<16;e++)r[e]=i[e]}y(un,"pow2523");function Pr(r,o,i){var e=new Uint8Array(32),a=new Float64Array(80),u,p,g=t(),E=t(),T=t(),v=t(),J=t(),_=t();for(p=0;p<31;p++)e[p]=o[p];for(e[31]=o[31]&127|64,e[0]&=248,tt(a,i),p=0;p<16;p++)E[p]=a[p],v[p]=g[p]=T[p]=0;for(g[0]=v[0]=1,p=254;p>=0;--p)u=e[p>>>3]>>>(p&7)&1,rr(g,E,u),rr(T,v,u),De(J,g,T),Me(g,g,T),De(T,E,v),Me(E,E,v),Ce(v,J),Ce(_,g),k(g,T,g),k(T,E,J),De(J,g,T),Me(g,g,T),Ce(E,g),Me(T,v,_),k(g,T,X),De(g,g,v),k(T,T,g),k(g,v,_),k(v,E,a),Ce(E,J),rr(g,E,u),rr(T,v,u);for(p=0;p<16;p++)a[p+16]=g[p],a[p+32]=T[p],a[p+48]=E[p],a[p+64]=v[p];var I=a.subarray(32),L=a.subarray(16);return xn(I,I),k(L,L,I),tr(r,L),0}y(Pr,"crypto_scalarmult");function Tr(r,o){return Pr(r,o,x)}y(Tr,"crypto_scalarmult_base");function pn(r,o){return f(o,32),Tr(r,o)}y(pn,"crypto_box_keypair");function Dr(r,o,i){var e=new Uint8Array(32);return Pr(e,i,o),le(r,c,e,pe)}y(Dr,"crypto_box_beforenm");var hn=Qr,sf=et;function cf(r,o,i,e,a,u){var p=new Uint8Array(32);return Dr(p,a,u),hn(r,o,i,e,p)}y(cf,"crypto_box");function yf(r,o,i,e,a,u){var p=new Uint8Array(32);return Dr(p,a,u),sf(r,o,i,e,p)}y(yf,"crypto_box_open");var dn=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function ln(r,o,i,e){for(var a=new Int32Array(16),u=new Int32Array(16),p,g,E,T,v,J,_,I,L,j,Y,N,z,R,C,D,S,B,P,K,h,d,A,l,b,w,M=r[0],H=r[1],G=r[2],F=r[3],s=r[4],W=r[5],Q=r[6],ee=r[7],V=o[0],Z=o[1],q=o[2],ce=o[3],te=o[4],fe=o[5],ie=o[6],oe=o[7],xe=0;e>=128;){for(P=0;P<16;P++)K=8*P+xe,a[P]=i[K+0]<<24|i[K+1]<<16|i[K+2]<<8|i[K+3],u[P]=i[K+4]<<24|i[K+5]<<16|i[K+6]<<8|i[K+7];for(P=0;P<80;P++)if(p=M,g=H,E=G,T=F,v=s,J=W,_=Q,I=ee,L=V,j=Z,Y=q,N=ce,z=te,R=fe,C=ie,D=oe,h=ee,d=oe,A=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=(s>>>14|te<<18)^(s>>>18|te<<14)^(te>>>9|s<<23),d=(te>>>14|s<<18)^(te>>>18|s<<14)^(s>>>9|te<<23),A+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,h=s&W^~s&Q,d=te&fe^~te&ie,A+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,h=dn[P*2],d=dn[P*2+1],A+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,h=a[P%16],d=u[P%16],A+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=A>>>16,b+=l>>>16,w+=b>>>16,S=b&65535|w<<16,B=A&65535|l<<16,h=S,d=B,A=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=(M>>>28|V<<4)^(V>>>2|M<<30)^(V>>>7|M<<25),d=(V>>>28|M<<4)^(M>>>2|V<<30)^(M>>>7|V<<25),A+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,h=M&H^M&G^H&G,d=V&Z^V&q^Z&q,A+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=A>>>16,b+=l>>>16,w+=b>>>16,I=b&65535|w<<16,D=A&65535|l<<16,h=T,d=N,A=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=S,d=B,A+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=A>>>16,b+=l>>>16,w+=b>>>16,T=b&65535|w<<16,N=A&65535|l<<16,H=p,G=g,F=E,s=T,W=v,Q=J,ee=_,M=I,Z=L,q=j,ce=Y,te=N,fe=z,ie=R,oe=C,V=D,P%16===15)for(K=0;K<16;K++)h=a[K],d=u[K],A=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=a[(K+9)%16],d=u[(K+9)%16],A+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,S=a[(K+1)%16],B=u[(K+1)%16],h=(S>>>1|B<<31)^(S>>>8|B<<24)^S>>>7,d=(B>>>1|S<<31)^(B>>>8|S<<24)^(B>>>7|S<<25),A+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,S=a[(K+14)%16],B=u[(K+14)%16],h=(S>>>19|B<<13)^(B>>>29|S<<3)^S>>>6,d=(B>>>19|S<<13)^(S>>>29|B<<3)^(B>>>6|S<<26),A+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=A>>>16,b+=l>>>16,w+=b>>>16,a[K]=b&65535|w<<16,u[K]=A&65535|l<<16;h=M,d=V,A=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=r[0],d=o[0],A+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=A>>>16,b+=l>>>16,w+=b>>>16,r[0]=M=b&65535|w<<16,o[0]=V=A&65535|l<<16,h=H,d=Z,A=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=r[1],d=o[1],A+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=A>>>16,b+=l>>>16,w+=b>>>16,r[1]=H=b&65535|w<<16,o[1]=Z=A&65535|l<<16,h=G,d=q,A=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=r[2],d=o[2],A+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=A>>>16,b+=l>>>16,w+=b>>>16,r[2]=G=b&65535|w<<16,o[2]=q=A&65535|l<<16,h=F,d=ce,A=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=r[3],d=o[3],A+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=A>>>16,b+=l>>>16,w+=b>>>16,r[3]=F=b&65535|w<<16,o[3]=ce=A&65535|l<<16,h=s,d=te,A=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=r[4],d=o[4],A+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=A>>>16,b+=l>>>16,w+=b>>>16,r[4]=s=b&65535|w<<16,o[4]=te=A&65535|l<<16,h=W,d=fe,A=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=r[5],d=o[5],A+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=A>>>16,b+=l>>>16,w+=b>>>16,r[5]=W=b&65535|w<<16,o[5]=fe=A&65535|l<<16,h=Q,d=ie,A=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=r[6],d=o[6],A+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=A>>>16,b+=l>>>16,w+=b>>>16,r[6]=Q=b&65535|w<<16,o[6]=ie=A&65535|l<<16,h=ee,d=oe,A=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=r[7],d=o[7],A+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=A>>>16,b+=l>>>16,w+=b>>>16,r[7]=ee=b&65535|w<<16,o[7]=oe=A&65535|l<<16,xe+=128,e-=128}return e}y(ln,"crypto_hashblocks_hl");function ke(r,o,i){var e=new Int32Array(8),a=new Int32Array(8),u=new Uint8Array(256),p,g=i;for(e[0]=1779033703,e[1]=3144134277,e[2]=1013904242,e[3]=2773480762,e[4]=1359893119,e[5]=2600822924,e[6]=528734635,e[7]=1541459225,a[0]=4089235720,a[1]=2227873595,a[2]=4271175723,a[3]=1595750129,a[4]=2917565137,a[5]=725511199,a[6]=4215389547,a[7]=327033209,ln(e,a,o,i),i%=128,p=0;p<i;p++)u[p]=o[g-i+p];for(u[i]=128,i=256-128*(i<112?1:0),u[i-9]=0,er(u,i-8,g/536870912|0,g<<3),ln(e,a,u,i),p=0;p<8;p++)er(r,8*p,e[p],a[p]);return 0}y(ke,"crypto_hash");function Mr(r,o){var i=t(),e=t(),a=t(),u=t(),p=t(),g=t(),E=t(),T=t(),v=t();Me(i,r[1],r[0]),Me(v,o[1],o[0]),k(i,i,v),De(e,r[0],r[1]),De(v,o[0],o[1]),k(e,e,v),k(a,r[3],o[3]),k(a,a,ue),k(u,r[2],o[2]),De(u,u,u),Me(p,e,i),Me(g,u,a),De(E,u,a),De(T,e,i),k(r[0],p,g),k(r[1],T,E),k(r[2],E,g),k(r[3],p,T)}y(Mr,"add");function gn(r,o,i){var e;for(e=0;e<4;e++)rr(r[e],o[e],i)}y(gn,"cswap");function nt(r,o){var i=t(),e=t(),a=t();xn(a,o[2]),k(i,o[0],a),k(e,o[1],a),tr(r,e),r[31]^=yn(i)<<7}y(nt,"pack");function ft(r,o,i){var e,a;for(ze(r[0],m),ze(r[1],U),ze(r[2],U),ze(r[3],m),a=255;a>=0;--a)e=i[a/8|0]>>(a&7)&1,gn(r,o,e),Mr(o,r),Mr(r,r),gn(r,o,e)}y(ft,"scalarmult");function Ir(r,o){var i=[t(),t(),t(),t()];ze(i[0],Ae),ze(i[1],Pe),ze(i[2],U),k(i[3],Ae,Pe),ft(r,i,o)}y(Ir,"scalarbase");function it(r,o,i){var e=new Uint8Array(64),a=[t(),t(),t(),t()],u;for(i||f(o,32),ke(e,o,32),e[0]&=248,e[31]&=127,e[31]|=64,Ir(a,e),nt(r,a),u=0;u<32;u++)o[u+32]=r[u];return 0}y(it,"crypto_sign_keypair");var Lr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ot(r,o){var i,e,a,u;for(e=63;e>=32;--e){for(i=0,a=e-32,u=e-12;a<u;++a)o[a]+=i-16*o[e]*Lr[a-(e-32)],i=Math.floor((o[a]+128)/256),o[a]-=i*256;o[a]+=i,o[e]=0}for(i=0,a=0;a<32;a++)o[a]+=i-(o[31]>>4)*Lr[a],i=o[a]>>8,o[a]&=255;for(a=0;a<32;a++)o[a]-=i*Lr[a];for(e=0;e<32;e++)o[e+1]+=o[e]>>8,r[e]=o[e]&255}y(ot,"modL");function at(r){var o=new Float64Array(64),i;for(i=0;i<64;i++)o[i]=r[i];for(i=0;i<64;i++)r[i]=0;ot(r,o)}y(at,"reduce");function bn(r,o,i,e){var a=new Uint8Array(64),u=new Uint8Array(64),p=new Uint8Array(64),g,E,T=new Float64Array(64),v=[t(),t(),t(),t()];ke(a,e,32),a[0]&=248,a[31]&=127,a[31]|=64;var J=i+64;for(g=0;g<i;g++)r[64+g]=o[g];for(g=0;g<32;g++)r[32+g]=a[32+g];for(ke(p,r.subarray(32),i+32),at(p),Ir(v,p),nt(r,v),g=32;g<64;g++)r[g]=e[g];for(ke(u,r,i+64),at(u),g=0;g<64;g++)T[g]=0;for(g=0;g<32;g++)T[g]=p[g];for(g=0;g<32;g++)for(E=0;E<32;E++)T[g+E]+=u[g]*a[E];return ot(r.subarray(32),T),J}y(bn,"crypto_sign");function xf(r,o){var i=t(),e=t(),a=t(),u=t(),p=t(),g=t(),E=t();return ze(r[2],U),tt(r[1],o),Ce(a,r[1]),k(u,a,ne),Me(a,a,r[2]),De(u,r[2],u),Ce(p,u),Ce(g,p),k(E,g,p),k(i,E,a),k(i,i,u),un(i,i),k(i,i,a),k(i,i,u),k(i,i,u),k(r[0],i,u),Ce(e,r[0]),k(e,e,u),cn(e,a)&&k(r[0],r[0],Re),Ce(e,r[0]),k(e,e,u),cn(e,a)?-1:(yn(r[0])===o[31]>>7&&Me(r[0],m,r[0]),k(r[3],r[0],r[1]),0)}y(xf,"unpackneg");function st(r,o,i,e){var a,u=new Uint8Array(32),p=new Uint8Array(64),g=[t(),t(),t(),t()],E=[t(),t(),t(),t()];if(i<64||xf(E,e))return-1;for(a=0;a<i;a++)r[a]=o[a];for(a=0;a<32;a++)r[a+32]=e[a];if(ke(p,r,i),at(p),ft(g,E,p),Ir(E,o.subarray(32)),Mr(g,E),nt(u,g),i-=64,Ke(o,0,u,0)){for(a=0;a<i;a++)r[a]=0;return-1}for(a=0;a<i;a++)r[a]=o[a+64];return i}y(st,"crypto_sign_open");var ct=32,Nr=24,pr=32,nr=16,hr=32,Rr=32,dr=32,lr=32,yt=32,mn=Nr,uf=pr,pf=nr,Oe=64,$e=32,fr=64,xt=32,ut=64;n.lowlevel={crypto_core_hsalsa20:le,crypto_stream_xor:Ge,crypto_stream:_e,crypto_stream_salsa20_xor:Te,crypto_stream_salsa20:ve,crypto_onetimeauth:Jr,crypto_onetimeauth_verify:sn,crypto_verify_16:se,crypto_verify_32:Ke,crypto_secretbox:Qr,crypto_secretbox_open:et,crypto_scalarmult:Pr,crypto_scalarmult_base:Tr,crypto_box_beforenm:Dr,crypto_box_afternm:hn,crypto_box:cf,crypto_box_open:yf,crypto_box_keypair:pn,crypto_hash:ke,crypto_sign:bn,crypto_sign_keypair:it,crypto_sign_open:st,crypto_secretbox_KEYBYTES:ct,crypto_secretbox_NONCEBYTES:Nr,crypto_secretbox_ZEROBYTES:pr,crypto_secretbox_BOXZEROBYTES:nr,crypto_scalarmult_BYTES:hr,crypto_scalarmult_SCALARBYTES:Rr,crypto_box_PUBLICKEYBYTES:dr,crypto_box_SECRETKEYBYTES:lr,crypto_box_BEFORENMBYTES:yt,crypto_box_NONCEBYTES:mn,crypto_box_ZEROBYTES:uf,crypto_box_BOXZEROBYTES:pf,crypto_sign_BYTES:Oe,crypto_sign_PUBLICKEYBYTES:$e,crypto_sign_SECRETKEYBYTES:fr,crypto_sign_SEEDBYTES:xt,crypto_hash_BYTES:ut,gf:t,D:ne,L:Lr,pack25519:tr,unpack25519:tt,M:k,A:De,S:Ce,Z:Me,pow2523:un,add:Mr,set25519:ze,modL:ot,scalarmult:ft,scalarbase:Ir};function An(r,o){if(r.length!==ct)throw new Error("bad key size");if(o.length!==Nr)throw new Error("bad nonce size")}y(An,"checkLengths");function hf(r,o){if(r.length!==dr)throw new Error("bad public key size");if(o.length!==lr)throw new Error("bad secret key size")}y(hf,"checkBoxLengths");function Se(){for(var r=0;r<arguments.length;r++)if(!(arguments[r]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}y(Se,"checkArrayTypes");function wn(r){for(var o=0;o<r.length;o++)r[o]=0}y(wn,"cleanup"),n.randomBytes=function(r){var o=new Uint8Array(r);return f(o,r),o},n.secretbox=function(r,o,i){Se(r,o,i),An(i,o);for(var e=new Uint8Array(pr+r.length),a=new Uint8Array(e.length),u=0;u<r.length;u++)e[u+pr]=r[u];return Qr(a,e,e.length,o,i),a.subarray(nr)},n.secretbox.open=function(r,o,i){Se(r,o,i),An(i,o);for(var e=new Uint8Array(nr+r.length),a=new Uint8Array(e.length),u=0;u<r.length;u++)e[u+nr]=r[u];return e.length<32||et(a,e,e.length,o,i)!==0?null:a.subarray(pr)},n.secretbox.keyLength=ct,n.secretbox.nonceLength=Nr,n.secretbox.overheadLength=nr,n.scalarMult=function(r,o){if(Se(r,o),r.length!==Rr)throw new Error("bad n size");if(o.length!==hr)throw new Error("bad p size");var i=new Uint8Array(hr);return Pr(i,r,o),i},n.scalarMult.base=function(r){if(Se(r),r.length!==Rr)throw new Error("bad n size");var o=new Uint8Array(hr);return Tr(o,r),o},n.scalarMult.scalarLength=Rr,n.scalarMult.groupElementLength=hr,n.box=function(r,o,i,e){var a=n.box.before(i,e);return n.secretbox(r,o,a)},n.box.before=function(r,o){Se(r,o),hf(r,o);var i=new Uint8Array(yt);return Dr(i,r,o),i},n.box.after=n.secretbox,n.box.open=function(r,o,i,e){var a=n.box.before(i,e);return n.secretbox.open(r,o,a)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var r=new Uint8Array(dr),o=new Uint8Array(lr);return pn(r,o),{publicKey:r,secretKey:o}},n.box.keyPair.fromSecretKey=function(r){if(Se(r),r.length!==lr)throw new Error("bad secret key size");var o=new Uint8Array(dr);return Tr(o,r),{publicKey:o,secretKey:new Uint8Array(r)}},n.box.publicKeyLength=dr,n.box.secretKeyLength=lr,n.box.sharedKeyLength=yt,n.box.nonceLength=mn,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(r,o){if(Se(r,o),o.length!==fr)throw new Error("bad secret key size");var i=new Uint8Array(Oe+r.length);return bn(i,r,r.length,o),i},n.sign.open=function(r,o){if(Se(r,o),o.length!==$e)throw new Error("bad public key size");var i=new Uint8Array(r.length),e=st(i,r,r.length,o);if(e<0)return null;for(var a=new Uint8Array(e),u=0;u<a.length;u++)a[u]=i[u];return a},n.sign.detached=function(r,o){for(var i=n.sign(r,o),e=new Uint8Array(Oe),a=0;a<e.length;a++)e[a]=i[a];return e},n.sign.detached.verify=function(r,o,i){if(Se(r,o,i),o.length!==Oe)throw new Error("bad signature size");if(i.length!==$e)throw new Error("bad public key size");var e=new Uint8Array(Oe+r.length),a=new Uint8Array(Oe+r.length),u;for(u=0;u<Oe;u++)e[u]=o[u];for(u=0;u<r.length;u++)e[u+Oe]=r[u];return st(a,e,e.length,i)>=0},n.sign.keyPair=function(){var r=new Uint8Array($e),o=new Uint8Array(fr);return it(r,o),{publicKey:r,secretKey:o}},n.sign.keyPair.fromSecretKey=function(r){if(Se(r),r.length!==fr)throw new Error("bad secret key size");for(var o=new Uint8Array($e),i=0;i<o.length;i++)o[i]=r[32+i];return{publicKey:o,secretKey:new Uint8Array(r)}},n.sign.keyPair.fromSeed=function(r){if(Se(r),r.length!==xt)throw new Error("bad seed size");for(var o=new Uint8Array($e),i=new Uint8Array(fr),e=0;e<32;e++)i[e]=r[e];return it(o,i,!0),{publicKey:o,secretKey:i}},n.sign.publicKeyLength=$e,n.sign.secretKeyLength=fr,n.sign.seedLength=xt,n.sign.signatureLength=Oe,n.hash=function(r){Se(r);var o=new Uint8Array(ut);return ke(o,r,r.length),o},n.hash.hashLength=ut,n.verify=function(r,o){return Se(r,o),r.length===0||o.length===0||r.length!==o.length?!1:$(r,0,o,0,r.length)===0},n.setPRNG=function(r){f=r},function(){var r=typeof self<"u"?self.crypto||self.msCrypto:null;if(r&&r.getRandomValues){var o=65536;n.setPRNG(function(i,e){var a,u=new Uint8Array(e);for(a=0;a<e;a+=o)r.getRandomValues(u.subarray(a,a+Math.min(e-a,o)));for(a=0;a<e;a++)i[a]=u[a];wn(u)})}else typeof En<"u"&&(r=$n(),r&&r.randomBytes&&n.setPRNG(function(i,e){var a,u=r.randomBytes(e);for(a=0;a<e;a++)i[a]=u[a];wn(u)}))}()})(typeof Vr<"u"&&Vr.exports?Vr.exports:self.nacl=self.nacl||{})});var Kf=globalThis||window||self,re=Kf.crypto;function br(n=0){return new Uint8Array(n)}y(br,"allocUnsafe");function pt(n,t){t==null&&(t=n.reduce((x,m)=>x+m.length,0));let f=br(t),c=0;for(let x of n)f.set(x,c),c+=x.length;return f}y(pt,"concat");var Et={};Be(Et,{base10:()=>Tf});var mo=new Uint8Array(0);function vn(n,t){if(n===t)return!0;if(n.byteLength!==t.byteLength)return!1;for(let f=0;f<n.byteLength;f++)if(n[f]!==t[f])return!1;return!0}y(vn,"equals");function Ye(n){if(n instanceof Uint8Array&&n.constructor.name==="Uint8Array")return n;if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);throw new Error("Unknown type, must be binary type")}y(Ye,"coerce");function Un(n){return new TextEncoder().encode(n)}y(Un,"fromString");function Sn(n){return new TextDecoder().decode(n)}y(Sn,"toString");function Uf(n,t){if(n.length>=255)throw new TypeError("Alphabet too long");for(var f=new Uint8Array(256),c=0;c<f.length;c++)f[c]=255;for(var x=0;x<n.length;x++){var m=n.charAt(x),U=m.charCodeAt(0);if(f[U]!==255)throw new TypeError(m+" is ambiguous");f[U]=x}var X=n.length,ne=n.charAt(0),ue=Math.log(X)/Math.log(256),Ae=Math.log(256)/Math.log(X);function Pe($){if($ instanceof Uint8Array||(ArrayBuffer.isView($)?$=new Uint8Array($.buffer,$.byteOffset,$.byteLength):Array.isArray($)&&($=Uint8Array.from($))),!($ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if($.length===0)return"";for(var se=0,Ke=0,we=0,de=$.length;we!==de&&$[we]===0;)we++,se++;for(var Ee=(de-we)*Ae+1>>>0,le=new Uint8Array(Ee);we!==de;){for(var pe=$[we],Te=0,ve=Ee-1;(pe!==0||Te<Ke)&&ve!==-1;ve--,Te++)pe+=256*le[ve]>>>0,le[ve]=pe%X>>>0,pe=pe/X>>>0;if(pe!==0)throw new Error("Non-zero carry");Ke=Te,we++}for(var _e=Ee-Ke;_e!==Ee&&le[_e]===0;)_e++;for(var Ge=ne.repeat(se);_e<Ee;++_e)Ge+=n.charAt(le[_e]);return Ge}y(Pe,"encode");function Re($){if(typeof $!="string")throw new TypeError("Expected String");if($.length===0)return new Uint8Array;var se=0;if($[se]!==" "){for(var Ke=0,we=0;$[se]===ne;)Ke++,se++;for(var de=($.length-se)*ue+1>>>0,Ee=new Uint8Array(de);$[se];){var le=f[$.charCodeAt(se)];if(le===255)return;for(var pe=0,Te=de-1;(le!==0||pe<we)&&Te!==-1;Te--,pe++)le+=X*Ee[Te]>>>0,Ee[Te]=le%256>>>0,le=le/256>>>0;if(le!==0)throw new Error("Non-zero carry");we=pe,se++}if($[se]!==" "){for(var ve=de-we;ve!==de&&Ee[ve]===0;)ve++;for(var _e=new Uint8Array(Ke+(de-ve)),Ge=Ke;ve!==de;)_e[Ge++]=Ee[ve++];return _e}}}y(Re,"decodeUnsafe");function er($){var se=Re($);if(se)return se;throw new Error(`Non-${t} character`)}return y(er,"decode"),{encode:Pe,decodeUnsafe:Re,decode:er}}y(Uf,"base");var Sf=Uf,_f=Sf,Cn=_f;var bt=class bt{constructor(t,f,c){O(this,"name");O(this,"prefix");O(this,"baseEncode");this.name=t,this.prefix=f,this.baseEncode=c}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}};y(bt,"Encoder");var ht=bt,mt=class mt{constructor(t,f,c){O(this,"name");O(this,"prefix");O(this,"baseDecode");O(this,"prefixCodePoint");this.name=t,this.prefix=f;let x=f.codePointAt(0);if(x===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=x,this.baseDecode=c}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Bn(this,t)}};y(mt,"Decoder");var dt=mt,At=class At{constructor(t){O(this,"decoders");this.decoders=t}or(t){return Bn(this,t)}decode(t){let f=t[0],c=this.decoders[f];if(c!=null)return c.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};y(At,"ComposedDecoder");var lt=At;function Bn(n,t){return new lt({...n.decoders??{[n.prefix]:n},...t.decoders??{[t.prefix]:t}})}y(Bn,"or");var wt=class wt{constructor(t,f,c,x){O(this,"name");O(this,"prefix");O(this,"baseEncode");O(this,"baseDecode");O(this,"encoder");O(this,"decoder");this.name=t,this.prefix=f,this.baseEncode=c,this.baseDecode=x,this.encoder=new ht(t,f,c),this.decoder=new dt(t,f,x)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};y(wt,"Codec");var gt=wt;function ir({name:n,prefix:t,encode:f,decode:c}){return new gt(n,t,f,c)}y(ir,"from");function Ve({name:n,prefix:t,alphabet:f}){let{encode:c,decode:x}=Cn(f,n);return ir({prefix:t,name:n,encode:c,decode:y(m=>Ye(x(m)),"decode")})}y(Ve,"baseX");function Cf(n,t,f,c){let x=n.length;for(;n[x-1]==="=";)--x;let m=new Uint8Array(x*f/8|0),U=0,X=0,ne=0;for(let ue=0;ue<x;++ue){let Ae=t[n[ue]];if(Ae===void 0)throw new SyntaxError(`Non-${c} character`);X=X<<f|Ae,U+=f,U>=8&&(U-=8,m[ne++]=255&X>>U)}if(U>=f||(255&X<<8-U)!==0)throw new SyntaxError("Unexpected end of data");return m}y(Cf,"decode");function Bf(n,t,f){let c=t[t.length-1]==="=",x=(1<<f)-1,m="",U=0,X=0;for(let ne=0;ne<n.length;++ne)for(X=X<<8|n[ne],U+=8;U>f;)U-=f,m+=t[x&X>>U];if(U!==0&&(m+=t[x&X<<f-U]),c)for(;(m.length*f&7)!==0;)m+="=";return m}y(Bf,"encode");function Pf(n){let t={};for(let f=0;f<n.length;++f)t[n[f]]=f;return t}y(Pf,"createAlphabetIdx");function ae({name:n,prefix:t,bitsPerChar:f,alphabet:c}){let x=Pf(c);return ir({prefix:t,name:n,encode(m){return Bf(m,c,f)},decode(m){return Cf(m,x,f,n)}})}y(ae,"rfc4648");var Tf=Ve({prefix:"9",name:"base10",alphabet:"0123456789"});var Kt={};Be(Kt,{base16:()=>Df,base16upper:()=>Mf});var Df=ae({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Mf=ae({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var vt={};Be(vt,{base2:()=>If});var If=ae({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ut={};Be(Ut,{base256emoji:()=>Of});var Pn=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Lf=Pn.reduce((n,t,f)=>(n[f]=t,n),[]),Nf=Pn.reduce((n,t,f)=>{let c=t.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${t}`);return n[c]=f,n},[]);function Rf(n){return n.reduce((t,f)=>(t+=Lf[f],t),"")}y(Rf,"encode");function zf(n){let t=[];for(let f of n){let c=f.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${f}`);let x=Nf[c];if(x==null)throw new Error(`Non-base256emoji character: ${f}`);t.push(x)}return new Uint8Array(t)}y(zf,"decode");var Of=ir({prefix:"\u{1F680}",name:"base256emoji",encode:Rf,decode:zf});var St={};Be(St,{base32:()=>or,base32hex:()=>Ff,base32hexpad:()=>Vf,base32hexpadupper:()=>Xf,base32hexupper:()=>Gf,base32pad:()=>jf,base32padupper:()=>Hf,base32upper:()=>Yf,base32z:()=>Wf});var or=ae({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Yf=ae({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),jf=ae({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Hf=ae({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ff=ae({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Gf=ae({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Vf=ae({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Xf=ae({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Wf=ae({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var _t={};Be(_t,{base36:()=>mr,base36upper:()=>kf});var mr=Ve({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),kf=Ve({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ct={};Be(Ct,{base58btc:()=>Le,base58flickr:()=>$f});var Le=Ve({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),$f=Ve({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Bt={};Be(Bt,{base64:()=>Zf,base64pad:()=>qf,base64url:()=>Jf,base64urlpad:()=>Qf});var Zf=ae({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),qf=ae({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Jf=ae({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Qf=ae({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Pt={};Be(Pt,{base8:()=>ei});var ei=ae({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Tt={};Be(Tt,{identity:()=>ri});var ri=ir({prefix:"\0",name:"identity",encode:y(n=>Sn(n),"encode"),decode:y(n=>Un(n),"decode")});var Yo=new TextEncoder,jo=new TextDecoder;var It={};Be(It,{identity:()=>vi});var fi=Mn,Tn=128,ii=127,oi=~ii,ai=Math.pow(2,31);function Mn(n,t,f){t=t||[],f=f||0;for(var c=f;n>=ai;)t[f++]=n&255|Tn,n/=128;for(;n&oi;)t[f++]=n&255|Tn,n>>>=7;return t[f]=n|0,Mn.bytes=f-c+1,t}y(Mn,"encode");var si=Dt,ci=128,Dn=127;function Dt(n,c){var f=0,c=c||0,x=0,m=c,U,X=n.length;do{if(m>=X)throw Dt.bytes=0,new RangeError("Could not decode varint");U=n[m++],f+=x<28?(U&Dn)<<x:(U&Dn)*Math.pow(2,x),x+=7}while(U>=ci);return Dt.bytes=m-c,f}y(Dt,"read");var yi=Math.pow(2,7),xi=Math.pow(2,14),ui=Math.pow(2,21),pi=Math.pow(2,28),hi=Math.pow(2,35),di=Math.pow(2,42),li=Math.pow(2,49),gi=Math.pow(2,56),bi=Math.pow(2,63),mi=y(function(n){return n<yi?1:n<xi?2:n<ui?3:n<pi?4:n<hi?5:n<di?6:n<li?7:n<gi?8:n<bi?9:10},"length"),Ai={encode:fi,decode:si,encodingLength:mi},wi=Ai,Ar=wi;function wr(n,t=0){return[Ar.decode(n,t),Ar.decode.bytes]}y(wr,"decode");function ar(n,t,f=0){return Ar.encode(n,t,f),t}y(ar,"encodeTo");function sr(n){return Ar.encodingLength(n)}y(sr,"encodingLength");function Ze(n,t){let f=t.byteLength,c=sr(n),x=c+sr(f),m=new Uint8Array(x+f);return ar(n,m,0),ar(f,m,c),m.set(t,x),new cr(n,f,t,m)}y(Ze,"create");function In(n){let t=Ye(n),[f,c]=wr(t),[x,m]=wr(t.subarray(c)),U=t.subarray(c+m);if(U.byteLength!==x)throw new Error("Incorrect length");return new cr(f,x,U,t)}y(In,"decode");function Ln(n,t){if(n===t)return!0;{let f=t;return n.code===f.code&&n.size===f.size&&f.bytes instanceof Uint8Array&&vn(n.bytes,f.bytes)}}y(Ln,"equals");var Mt=class Mt{constructor(t,f,c,x){O(this,"code");O(this,"size");O(this,"digest");O(this,"bytes");this.code=t,this.size=f,this.digest=c,this.bytes=x}};y(Mt,"Digest");var cr=Mt;var Nn=0,Ei="identity",Rn=Ye;function Ki(n){return Ze(Nn,Rn(n))}y(Ki,"digest");var vi={code:Nn,name:Ei,encode:Rn,digest:Ki};var zt={};Be(zt,{sha256:()=>Ui,sha512:()=>Si});function Nt({name:n,code:t,encode:f}){return new Lt(n,t,f)}y(Nt,"from");var Rt=class Rt{constructor(t,f,c){O(this,"name");O(this,"code");O(this,"encode");this.name=t,this.code=f,this.encode=c}digest(t){if(t instanceof Uint8Array){let f=this.encode(t);return f instanceof Uint8Array?Ze(this.code,f):f.then(c=>Ze(this.code,c))}else throw Error("Unknown type, must be binary type")}};y(Rt,"Hasher");var Lt=Rt;function On(n){return async t=>new Uint8Array(await crypto.subtle.digest(n,t))}y(On,"sha");var Ui=Nt({name:"sha2-256",code:18,encode:On("SHA-256")}),Si=Nt({name:"sha2-512",code:19,encode:On("SHA-512")});function Yn(n,t){let{bytes:f,version:c}=n;switch(c){case 0:return Ci(f,Ot(n),t??Le.encoder);default:return Bi(f,Ot(n),t??or.encoder)}}y(Yn,"format");var jn=new WeakMap;function Ot(n){let t=jn.get(n);if(t==null){let f=new Map;return jn.set(n,f),f}return t}y(Ot,"baseCache");var Fn,he=class he{constructor(t,f,c,x){O(this,"code");O(this,"version");O(this,"multihash");O(this,"bytes");O(this,"/");O(this,Fn,"CID");this.code=f,this.version=t,this.multihash=c,this.bytes=x,this["/"]=x}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:f}=this;if(t!==Kr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(f.code!==Pi)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return he.createV0(f)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:f}=this.multihash,c=Ze(t,f);return he.createV1(this.code,c)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return he.equals(this,t)}static equals(t,f){let c=f;return c!=null&&t.code===c.code&&t.version===c.version&&Ln(t.multihash,c.multihash)}toString(t){return Yn(this,t)}toJSON(){return{"/":Yn(this)}}link(){return this}[(Fn=Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"))](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let f=t;if(f instanceof he)return f;if(f["/"]!=null&&f["/"]===f.bytes||f.asCID===f){let{version:c,code:x,multihash:m,bytes:U}=f;return new he(c,x,m,U??Hn(c,x,m.bytes))}else if(f[Ti]===!0){let{version:c,multihash:x,code:m}=f,U=In(x);return he.create(c,m,U)}else return null}static create(t,f,c){if(typeof f!="number")throw new Error("String codecs are no longer supported");if(!(c.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(f!==Kr)throw new Error(`Version 0 CID must use dag-pb (code: ${Kr}) block encoding`);return new he(t,f,c,c.bytes)}case 1:{let x=Hn(t,f,c.bytes);return new he(t,f,c,x)}default:throw new Error("Invalid version")}}static createV0(t){return he.create(0,Kr,t)}static createV1(t,f){return he.create(1,t,f)}static decode(t){let[f,c]=he.decodeFirst(t);if(c.length!==0)throw new Error("Incorrect length");return f}static decodeFirst(t){let f=he.inspectBytes(t),c=f.size-f.multihashSize,x=Ye(t.subarray(c,c+f.multihashSize));if(x.byteLength!==f.multihashSize)throw new Error("Incorrect length");let m=x.subarray(f.multihashSize-f.digestSize),U=new cr(f.multihashCode,f.digestSize,m,x);return[f.version===0?he.createV0(U):he.createV1(f.codec,U),t.subarray(f.size)]}static inspectBytes(t){let f=0,c=y(()=>{let[Pe,Re]=wr(t.subarray(f));return f+=Re,Pe},"next"),x=c(),m=Kr;if(x===18?(x=0,f=0):m=c(),x!==0&&x!==1)throw new RangeError(`Invalid CID version ${x}`);let U=f,X=c(),ne=c(),ue=f+ne,Ae=ue-U;return{version:x,codec:m,multihashCode:X,digestSize:ne,multihashSize:Ae,size:ue}}static parse(t,f){let[c,x]=_i(t,f),m=he.decode(x);if(m.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ot(m).set(c,t),m}};y(he,"CID");var Or=he;function _i(n,t){switch(n[0]){case"Q":{let f=t??Le;return[Le.prefix,f.decode(`${Le.prefix}${n}`)]}case Le.prefix:{let f=t??Le;return[Le.prefix,f.decode(n)]}case or.prefix:{let f=t??or;return[or.prefix,f.decode(n)]}case mr.prefix:{let f=t??mr;return[mr.prefix,f.decode(n)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[n[0],t.decode(n)]}}}y(_i,"parseCIDtoBytes");function Ci(n,t,f){let{prefix:c}=f;if(c!==Le.prefix)throw Error(`Cannot string encode V0 in ${f.name} encoding`);let x=t.get(c);if(x==null){let m=f.encode(n).slice(1);return t.set(c,m),m}else return x}y(Ci,"toStringV0");function Bi(n,t,f){let{prefix:c}=f,x=t.get(c);if(x==null){let m=f.encode(n);return t.set(c,m),m}else return x}y(Bi,"toStringV1");var Kr=112,Pi=18;function Hn(n,t,f){let c=sr(n),x=c+sr(t),m=new Uint8Array(x+f.byteLength);return ar(n,m,0),ar(t,m,c),m.set(f,x),m}y(Hn,"encodeCID");var Ti=Symbol.for("@ipld/js-cid/CID");var Yt={...Tt,...vt,...Pt,...Et,...Kt,...St,..._t,...Ct,...Bt,...Ut},ba={...zt,...It};function Vn(n,t,f,c){return{name:n,prefix:t,encoder:{name:n,prefix:t,encode:f},decoder:{decode:c}}}y(Vn,"createCodec");var Gn=Vn("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),jt=Vn("ascii","a",n=>{let t="a";for(let f=0;f<n.length;f++)t+=String.fromCharCode(n[f]);return t},n=>{n=n.substring(1);let t=br(n.length);for(let f=0;f<n.length;f++)t[f]=n.charCodeAt(f);return t}),Di={utf8:Gn,"utf-8":Gn,hex:Yt.base16,latin1:jt,ascii:jt,binary:jt,...Yt},Yr=Di;function je(n,t="utf8"){let f=Yr[t];if(f==null)throw new Error(`Unsupported encoding "${t}"`);return f.decoder.decode(`${f.prefix}${n}`)}y(je,"fromString");function ye(n,t="utf8"){let f=Yr[t];if(f==null)throw new Error(`Unsupported encoding "${t}"`);return f.encoder.encode(n).substring(1)}y(ye,"toString");var jr="did:key:z",vr="Ed25519",Xn="X25519",Ga="X25519",Wn="Ed25519",kn="X25519";var Ur="RSA-OAEP",Sr="RSASSA-PKCS1-v1_5",Ht="SHA-256",Ft=new Uint8Array([0,245,2]),Va=2048,Gt="SHA-256",yr=8,xr="AES-GCM",He=xr,qe=256,Xe=12,Vt=new Uint8Array([234,1]),Xt=new Uint8Array([237,1]),Hr={RSA:"rsa",Edwards:"ed25519",BLS:"bls12-381"};var Fr="ecc-exchange",Gr="ecc-write",Ne=16;var Qn=Ef(Zn(),1);var qn={keyTypes:{"bls12-381":{magicBytes:new Uint8Array([234,1]),verify:y(()=>{throw new Error("Not implemented")},"verify")},rsa:{magicBytes:new Uint8Array([0,245,2]),verify:Ni},ed25519:{magicBytes:new Uint8Array([237,1]),verify:Li}}};async function Li({message:n,publicKey:t,signature:f}){return Qn.default.sign.detached.verify(n,f,t)}y(Li,"ed25519Verify");async function ef(n){return new Uint8Array(await re.subtle.digest("sha-256",n))}y(ef,"sha256");async function Zt(n,t="rsa"){let f=n instanceof CryptoKey?new Uint8Array(await ur(n)):n,c=qn.keyTypes[t]?.magicBytes;if(!c)throw new Error(`Key type '${t}' not supported, available types: ${Object.keys(qn.keyTypes).join(", ")}`);let x=pt([c,f]);return jr+ye(x,"base58btc")}y(Zt,"publicKeyToDid");var qt={verify:y(async function(t,f,c,x=yr,m=Gt){return re.subtle.verify({name:Sr,saltLength:Ne},typeof c=="string"?await Wt(c,m,"signing"):c,Jt(f),_r(t,x))},"rsaVerify"),sign:y(async function(t,f,c=yr){return re.subtle.sign({name:Sr,saltLength:Ne},f,_r(t,c))},"sign"),encrypt:y(async function(t,f,c=yr,x=Gt){let m;return typeof f=="string"?m=await Wt(f,x,"exchange"):m=f instanceof Uint8Array?await Wt(f,x,"exchange"):f,re.subtle.encrypt({name:Ur},m,_r(t,c))},"rsaEncrypt"),decrypt:y(async function(t,f){let c=Xr(f)?f:await Gi(f,["decrypt"]),x;typeof t=="string"?x=je(t,"base64pad"):x=t;let m=await re.subtle.decrypt({name:Ur},c,x);return new Uint8Array(m)},"rsaDecrypt")};async function Ni({message:n,publicKey:t,signature:f}){return qt.verify(n,f,await re.subtle.importKey("spki",t,{name:Sr,hash:Ht},!1,["verify"]),8)}y(Ni,"rsaVerify");async function Wt(n,t,f){Oi(f);let c=f==="exchange"?Ur:Sr,x=f==="exchange"?["encrypt"]:["verify"],m=typeof n=="string"?Fe(ji(n)):n;return re.subtle.importKey("spki",m,{name:c,hash:{name:t}},!0,x)}y(Wt,"importPublicKey");var Ri=new Error("Invalid key use. Please use 'encryption' or 'signing"),zi=new Error("Max must be less than 256 and greater than 0");function Oi(n){Yi(n,["signing","exchange"],Ri)}y(Oi,"checkValidKeyUse");function Yi(n,t,f){if(!t.some(x=>x===n))throw f}y(Yi,"checkValid");function ji(n){return n.replace(`-----BEGIN PUBLIC KEY-----
1
+ var bf=Object.create;var Ae=Object.defineProperty;var Af=Object.getOwnPropertyDescriptor;var mf=Object.getOwnPropertyNames;var wf=Object.getPrototypeOf,Ef=Object.prototype.hasOwnProperty;var Kf=(n,t,f)=>t in n?Ae(n,t,{enumerable:!0,configurable:!0,writable:!0,value:f}):n[t]=f;var y=(n,t)=>Ae(n,"name",{value:t,configurable:!0}),Un=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(t,f)=>(typeof require<"u"?require:t)[f]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var Sn=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),Pr=(n,t)=>{for(var f in t)Ae(n,f,{get:t[f],enumerable:!0})},vf=(n,t,f,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let x of mf(t))!Ef.call(n,x)&&x!==f&&Ae(n,x,{get:()=>t[x],enumerable:!(c=Af(t,x))||c.enumerable});return n};var Uf=(n,t,f)=>(f=n!=null?bf(wf(n)):{},vf(t||!n||!n.__esModule?Ae(f,"default",{value:n,enumerable:!0}):f,n));var O=(n,t,f)=>Kf(n,typeof t!="symbol"?t+"":t,f);var Jn=Sn(()=>{"use strict"});var Qn=Sn((qa,$e)=>{"use strict";(function(n){"use strict";var t=y(function(e){var o,i=new Float64Array(16);if(e)for(o=0;o<e.length;o++)i[o]=e[o];return i},"gf"),f=y(function(){throw new Error("no PRNG")},"randombytes"),c=new Uint8Array(16),x=new Uint8Array(32);x[0]=9;var A=t(),_=t([1]),G=t([56129,1]),nr=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),gr=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),sr=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),Kr=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),zr=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function ee(e,o,i,r){e[o]=i>>24&255,e[o+1]=i>>16&255,e[o+2]=i>>8&255,e[o+3]=i&255,e[o+4]=r>>24&255,e[o+5]=r>>16&255,e[o+6]=r>>8&255,e[o+7]=r&255}y(ee,"ts64");function k(e,o,i,r,a){var u,p=0;for(u=0;u<a;u++)p|=e[o+u]^i[r+u];return(1&p-1>>>8)-1}y(k,"vn");function cr(e,o,i,r){return k(e,o,i,r,16)}y(cr,"crypto_verify_16");function vr(e,o,i,r){return k(e,o,i,r,32)}y(vr,"crypto_verify_32");function wr(e,o,i,r){for(var a=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,u=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,p=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,g=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,E=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,T=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,v=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,J=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,S=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,I=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,L=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,j=i[16]&255|(i[17]&255)<<8|(i[18]&255)<<16|(i[19]&255)<<24,Y=i[20]&255|(i[21]&255)<<8|(i[22]&255)<<16|(i[23]&255)<<24,N=i[24]&255|(i[25]&255)<<8|(i[26]&255)<<16|(i[27]&255)<<24,z=i[28]&255|(i[29]&255)<<8|(i[30]&255)<<16|(i[31]&255)<<24,R=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,C=a,D=u,U=p,B=g,P=E,K=T,h=v,d=J,m=S,l=I,b=L,w=j,M=Y,H=N,V=z,F=R,s,W=0;W<20;W+=2)s=C+M|0,P^=s<<7|s>>>25,s=P+C|0,m^=s<<9|s>>>23,s=m+P|0,M^=s<<13|s>>>19,s=M+m|0,C^=s<<18|s>>>14,s=K+D|0,l^=s<<7|s>>>25,s=l+K|0,H^=s<<9|s>>>23,s=H+l|0,D^=s<<13|s>>>19,s=D+H|0,K^=s<<18|s>>>14,s=b+h|0,V^=s<<7|s>>>25,s=V+b|0,U^=s<<9|s>>>23,s=U+V|0,h^=s<<13|s>>>19,s=h+U|0,b^=s<<18|s>>>14,s=F+w|0,B^=s<<7|s>>>25,s=B+F|0,d^=s<<9|s>>>23,s=d+B|0,w^=s<<13|s>>>19,s=w+d|0,F^=s<<18|s>>>14,s=C+B|0,D^=s<<7|s>>>25,s=D+C|0,U^=s<<9|s>>>23,s=U+D|0,B^=s<<13|s>>>19,s=B+U|0,C^=s<<18|s>>>14,s=K+P|0,h^=s<<7|s>>>25,s=h+K|0,d^=s<<9|s>>>23,s=d+h|0,P^=s<<13|s>>>19,s=P+d|0,K^=s<<18|s>>>14,s=b+l|0,w^=s<<7|s>>>25,s=w+b|0,m^=s<<9|s>>>23,s=m+w|0,l^=s<<13|s>>>19,s=l+m|0,b^=s<<18|s>>>14,s=F+V|0,M^=s<<7|s>>>25,s=M+F|0,H^=s<<9|s>>>23,s=H+M|0,V^=s<<13|s>>>19,s=V+H|0,F^=s<<18|s>>>14;C=C+a|0,D=D+u|0,U=U+p|0,B=B+g|0,P=P+E|0,K=K+T|0,h=h+v|0,d=d+J|0,m=m+S|0,l=l+I|0,b=b+L|0,w=w+j|0,M=M+Y|0,H=H+N|0,V=V+z|0,F=F+R|0,e[0]=C>>>0&255,e[1]=C>>>8&255,e[2]=C>>>16&255,e[3]=C>>>24&255,e[4]=D>>>0&255,e[5]=D>>>8&255,e[6]=D>>>16&255,e[7]=D>>>24&255,e[8]=U>>>0&255,e[9]=U>>>8&255,e[10]=U>>>16&255,e[11]=U>>>24&255,e[12]=B>>>0&255,e[13]=B>>>8&255,e[14]=B>>>16&255,e[15]=B>>>24&255,e[16]=P>>>0&255,e[17]=P>>>8&255,e[18]=P>>>16&255,e[19]=P>>>24&255,e[20]=K>>>0&255,e[21]=K>>>8&255,e[22]=K>>>16&255,e[23]=K>>>24&255,e[24]=h>>>0&255,e[25]=h>>>8&255,e[26]=h>>>16&255,e[27]=h>>>24&255,e[28]=d>>>0&255,e[29]=d>>>8&255,e[30]=d>>>16&255,e[31]=d>>>24&255,e[32]=m>>>0&255,e[33]=m>>>8&255,e[34]=m>>>16&255,e[35]=m>>>24&255,e[36]=l>>>0&255,e[37]=l>>>8&255,e[38]=l>>>16&255,e[39]=l>>>24&255,e[40]=b>>>0&255,e[41]=b>>>8&255,e[42]=b>>>16&255,e[43]=b>>>24&255,e[44]=w>>>0&255,e[45]=w>>>8&255,e[46]=w>>>16&255,e[47]=w>>>24&255,e[48]=M>>>0&255,e[49]=M>>>8&255,e[50]=M>>>16&255,e[51]=M>>>24&255,e[52]=H>>>0&255,e[53]=H>>>8&255,e[54]=H>>>16&255,e[55]=H>>>24&255,e[56]=V>>>0&255,e[57]=V>>>8&255,e[58]=V>>>16&255,e[59]=V>>>24&255,e[60]=F>>>0&255,e[61]=F>>>8&255,e[62]=F>>>16&255,e[63]=F>>>24&255}y(wr,"core_salsa20");function dr(e,o,i,r){for(var a=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,u=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,p=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,g=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,E=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,T=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,v=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,J=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,S=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,I=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,L=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,j=i[16]&255|(i[17]&255)<<8|(i[18]&255)<<16|(i[19]&255)<<24,Y=i[20]&255|(i[21]&255)<<8|(i[22]&255)<<16|(i[23]&255)<<24,N=i[24]&255|(i[25]&255)<<8|(i[26]&255)<<16|(i[27]&255)<<24,z=i[28]&255|(i[29]&255)<<8|(i[30]&255)<<16|(i[31]&255)<<24,R=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,C=a,D=u,U=p,B=g,P=E,K=T,h=v,d=J,m=S,l=I,b=L,w=j,M=Y,H=N,V=z,F=R,s,W=0;W<20;W+=2)s=C+M|0,P^=s<<7|s>>>25,s=P+C|0,m^=s<<9|s>>>23,s=m+P|0,M^=s<<13|s>>>19,s=M+m|0,C^=s<<18|s>>>14,s=K+D|0,l^=s<<7|s>>>25,s=l+K|0,H^=s<<9|s>>>23,s=H+l|0,D^=s<<13|s>>>19,s=D+H|0,K^=s<<18|s>>>14,s=b+h|0,V^=s<<7|s>>>25,s=V+b|0,U^=s<<9|s>>>23,s=U+V|0,h^=s<<13|s>>>19,s=h+U|0,b^=s<<18|s>>>14,s=F+w|0,B^=s<<7|s>>>25,s=B+F|0,d^=s<<9|s>>>23,s=d+B|0,w^=s<<13|s>>>19,s=w+d|0,F^=s<<18|s>>>14,s=C+B|0,D^=s<<7|s>>>25,s=D+C|0,U^=s<<9|s>>>23,s=U+D|0,B^=s<<13|s>>>19,s=B+U|0,C^=s<<18|s>>>14,s=K+P|0,h^=s<<7|s>>>25,s=h+K|0,d^=s<<9|s>>>23,s=d+h|0,P^=s<<13|s>>>19,s=P+d|0,K^=s<<18|s>>>14,s=b+l|0,w^=s<<7|s>>>25,s=w+b|0,m^=s<<9|s>>>23,s=m+w|0,l^=s<<13|s>>>19,s=l+m|0,b^=s<<18|s>>>14,s=F+V|0,M^=s<<7|s>>>25,s=M+F|0,H^=s<<9|s>>>23,s=H+M|0,V^=s<<13|s>>>19,s=V+H|0,F^=s<<18|s>>>14;e[0]=C>>>0&255,e[1]=C>>>8&255,e[2]=C>>>16&255,e[3]=C>>>24&255,e[4]=K>>>0&255,e[5]=K>>>8&255,e[6]=K>>>16&255,e[7]=K>>>24&255,e[8]=b>>>0&255,e[9]=b>>>8&255,e[10]=b>>>16&255,e[11]=b>>>24&255,e[12]=F>>>0&255,e[13]=F>>>8&255,e[14]=F>>>16&255,e[15]=F>>>24&255,e[16]=h>>>0&255,e[17]=h>>>8&255,e[18]=h>>>16&255,e[19]=h>>>24&255,e[20]=d>>>0&255,e[21]=d>>>8&255,e[22]=d>>>16&255,e[23]=d>>>24&255,e[24]=m>>>0&255,e[25]=m>>>8&255,e[26]=m>>>16&255,e[27]=m>>>24&255,e[28]=l>>>0&255,e[29]=l>>>8&255,e[30]=l>>>16&255,e[31]=l>>>24&255}y(dr,"core_hsalsa20");function Er(e,o,i,r){wr(e,o,i,r)}y(Er,"crypto_core_salsa20");function lr(e,o,i,r){dr(e,o,i,r)}y(lr,"crypto_core_hsalsa20");var pr=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Dr(e,o,i,r,a,u,p){var g=new Uint8Array(16),E=new Uint8Array(64),T,v;for(v=0;v<16;v++)g[v]=0;for(v=0;v<8;v++)g[v]=u[v];for(;a>=64;){for(Er(E,g,p,pr),v=0;v<64;v++)e[o+v]=i[r+v]^E[v];for(T=1,v=8;v<16;v++)T=T+(g[v]&255)|0,g[v]=T&255,T>>>=8;a-=64,o+=64,r+=64}if(a>0)for(Er(E,g,p,pr),v=0;v<a;v++)e[o+v]=i[r+v]^E[v];return 0}y(Dr,"crypto_stream_salsa20_xor");function Ur(e,o,i,r,a){var u=new Uint8Array(16),p=new Uint8Array(64),g,E;for(E=0;E<16;E++)u[E]=0;for(E=0;E<8;E++)u[E]=r[E];for(;i>=64;){for(Er(p,u,a,pr),E=0;E<64;E++)e[o+E]=p[E];for(g=1,E=8;E<16;E++)g=g+(u[E]&255)|0,u[E]=g&255,g>>>=8;i-=64,o+=64}if(i>0)for(Er(p,u,a,pr),E=0;E<i;E++)e[o+E]=p[E];return 0}y(Ur,"crypto_stream_salsa20");function Cr(e,o,i,r,a){var u=new Uint8Array(32);lr(u,r,a,pr);for(var p=new Uint8Array(8),g=0;g<8;g++)p[g]=r[g+16];return Ur(e,o,i,p,u)}y(Cr,"crypto_stream");function Vr(e,o,i,r,a,u,p){var g=new Uint8Array(32);lr(g,u,p,pr);for(var E=new Uint8Array(8),T=0;T<8;T++)E[T]=u[T+16];return Dr(e,o,i,r,a,E,g)}y(Vr,"crypto_stream_xor");var De=y(function(e){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var o,i,r,a,u,p,g,E;o=e[0]&255|(e[1]&255)<<8,this.r[0]=o&8191,i=e[2]&255|(e[3]&255)<<8,this.r[1]=(o>>>13|i<<3)&8191,r=e[4]&255|(e[5]&255)<<8,this.r[2]=(i>>>10|r<<6)&7939,a=e[6]&255|(e[7]&255)<<8,this.r[3]=(r>>>7|a<<9)&8191,u=e[8]&255|(e[9]&255)<<8,this.r[4]=(a>>>4|u<<12)&255,this.r[5]=u>>>1&8190,p=e[10]&255|(e[11]&255)<<8,this.r[6]=(u>>>14|p<<2)&8191,g=e[12]&255|(e[13]&255)<<8,this.r[7]=(p>>>11|g<<5)&8065,E=e[14]&255|(e[15]&255)<<8,this.r[8]=(g>>>8|E<<8)&8191,this.r[9]=E>>>5&127,this.pad[0]=e[16]&255|(e[17]&255)<<8,this.pad[1]=e[18]&255|(e[19]&255)<<8,this.pad[2]=e[20]&255|(e[21]&255)<<8,this.pad[3]=e[22]&255|(e[23]&255)<<8,this.pad[4]=e[24]&255|(e[25]&255)<<8,this.pad[5]=e[26]&255|(e[27]&255)<<8,this.pad[6]=e[28]&255|(e[29]&255)<<8,this.pad[7]=e[30]&255|(e[31]&255)<<8},"poly1305");De.prototype.blocks=function(e,o,i){for(var r=this.fin?0:2048,a,u,p,g,E,T,v,J,S,I,L,j,Y,N,z,R,C,D,U,B=this.h[0],P=this.h[1],K=this.h[2],h=this.h[3],d=this.h[4],m=this.h[5],l=this.h[6],b=this.h[7],w=this.h[8],M=this.h[9],H=this.r[0],V=this.r[1],F=this.r[2],s=this.r[3],W=this.r[4],Q=this.r[5],rr=this.r[6],X=this.r[7],Z=this.r[8],q=this.r[9];i>=16;)a=e[o+0]&255|(e[o+1]&255)<<8,B+=a&8191,u=e[o+2]&255|(e[o+3]&255)<<8,P+=(a>>>13|u<<3)&8191,p=e[o+4]&255|(e[o+5]&255)<<8,K+=(u>>>10|p<<6)&8191,g=e[o+6]&255|(e[o+7]&255)<<8,h+=(p>>>7|g<<9)&8191,E=e[o+8]&255|(e[o+9]&255)<<8,d+=(g>>>4|E<<12)&8191,m+=E>>>1&8191,T=e[o+10]&255|(e[o+11]&255)<<8,l+=(E>>>14|T<<2)&8191,v=e[o+12]&255|(e[o+13]&255)<<8,b+=(T>>>11|v<<5)&8191,J=e[o+14]&255|(e[o+15]&255)<<8,w+=(v>>>8|J<<8)&8191,M+=J>>>5|r,S=0,I=S,I+=B*H,I+=P*(5*q),I+=K*(5*Z),I+=h*(5*X),I+=d*(5*rr),S=I>>>13,I&=8191,I+=m*(5*Q),I+=l*(5*W),I+=b*(5*s),I+=w*(5*F),I+=M*(5*V),S+=I>>>13,I&=8191,L=S,L+=B*V,L+=P*H,L+=K*(5*q),L+=h*(5*Z),L+=d*(5*X),S=L>>>13,L&=8191,L+=m*(5*rr),L+=l*(5*Q),L+=b*(5*W),L+=w*(5*s),L+=M*(5*F),S+=L>>>13,L&=8191,j=S,j+=B*F,j+=P*V,j+=K*H,j+=h*(5*q),j+=d*(5*Z),S=j>>>13,j&=8191,j+=m*(5*X),j+=l*(5*rr),j+=b*(5*Q),j+=w*(5*W),j+=M*(5*s),S+=j>>>13,j&=8191,Y=S,Y+=B*s,Y+=P*F,Y+=K*V,Y+=h*H,Y+=d*(5*q),S=Y>>>13,Y&=8191,Y+=m*(5*Z),Y+=l*(5*X),Y+=b*(5*rr),Y+=w*(5*Q),Y+=M*(5*W),S+=Y>>>13,Y&=8191,N=S,N+=B*W,N+=P*s,N+=K*F,N+=h*V,N+=d*H,S=N>>>13,N&=8191,N+=m*(5*q),N+=l*(5*Z),N+=b*(5*X),N+=w*(5*rr),N+=M*(5*Q),S+=N>>>13,N&=8191,z=S,z+=B*Q,z+=P*W,z+=K*s,z+=h*F,z+=d*V,S=z>>>13,z&=8191,z+=m*H,z+=l*(5*q),z+=b*(5*Z),z+=w*(5*X),z+=M*(5*rr),S+=z>>>13,z&=8191,R=S,R+=B*rr,R+=P*Q,R+=K*W,R+=h*s,R+=d*F,S=R>>>13,R&=8191,R+=m*V,R+=l*H,R+=b*(5*q),R+=w*(5*Z),R+=M*(5*X),S+=R>>>13,R&=8191,C=S,C+=B*X,C+=P*rr,C+=K*Q,C+=h*W,C+=d*s,S=C>>>13,C&=8191,C+=m*F,C+=l*V,C+=b*H,C+=w*(5*q),C+=M*(5*Z),S+=C>>>13,C&=8191,D=S,D+=B*Z,D+=P*X,D+=K*rr,D+=h*Q,D+=d*W,S=D>>>13,D&=8191,D+=m*s,D+=l*F,D+=b*V,D+=w*H,D+=M*(5*q),S+=D>>>13,D&=8191,U=S,U+=B*q,U+=P*Z,U+=K*X,U+=h*rr,U+=d*Q,S=U>>>13,U&=8191,U+=m*W,U+=l*s,U+=b*F,U+=w*V,U+=M*H,S+=U>>>13,U&=8191,S=(S<<2)+S|0,S=S+I|0,I=S&8191,S=S>>>13,L+=S,B=I,P=L,K=j,h=Y,d=N,m=z,l=R,b=C,w=D,M=U,o+=16,i-=16;this.h[0]=B,this.h[1]=P,this.h[2]=K,this.h[3]=h,this.h[4]=d,this.h[5]=m,this.h[6]=l,this.h[7]=b,this.h[8]=w,this.h[9]=M},De.prototype.finish=function(e,o){var i=new Uint16Array(10),r,a,u,p;if(this.leftover){for(p=this.leftover,this.buffer[p++]=1;p<16;p++)this.buffer[p]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,p=2;p<10;p++)this.h[p]+=r,r=this.h[p]>>>13,this.h[p]&=8191;for(this.h[0]+=r*5,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,i[0]=this.h[0]+5,r=i[0]>>>13,i[0]&=8191,p=1;p<10;p++)i[p]=this.h[p]+r,r=i[p]>>>13,i[p]&=8191;for(i[9]-=8192,a=(r^1)-1,p=0;p<10;p++)i[p]&=a;for(a=~a,p=0;p<10;p++)this.h[p]=this.h[p]&a|i[p];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,u=this.h[0]+this.pad[0],this.h[0]=u&65535,p=1;p<8;p++)u=(this.h[p]+this.pad[p]|0)+(u>>>16)|0,this.h[p]=u&65535;e[o+0]=this.h[0]>>>0&255,e[o+1]=this.h[0]>>>8&255,e[o+2]=this.h[1]>>>0&255,e[o+3]=this.h[1]>>>8&255,e[o+4]=this.h[2]>>>0&255,e[o+5]=this.h[2]>>>8&255,e[o+6]=this.h[3]>>>0&255,e[o+7]=this.h[3]>>>8&255,e[o+8]=this.h[4]>>>0&255,e[o+9]=this.h[4]>>>8&255,e[o+10]=this.h[5]>>>0&255,e[o+11]=this.h[5]>>>8&255,e[o+12]=this.h[6]>>>0&255,e[o+13]=this.h[6]>>>8&255,e[o+14]=this.h[7]>>>0&255,e[o+15]=this.h[7]>>>8&255},De.prototype.update=function(e,o,i){var r,a;if(this.leftover){for(a=16-this.leftover,a>i&&(a=i),r=0;r<a;r++)this.buffer[this.leftover+r]=e[o+r];if(i-=a,o+=a,this.leftover+=a,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(i>=16&&(a=i-i%16,this.blocks(e,o,a),o+=a,i-=a),i){for(r=0;r<i;r++)this.buffer[this.leftover+r]=e[o+r];this.leftover+=i}};function et(e,o,i,r,a,u){var p=new De(u);return p.update(i,r,a),p.finish(e,o),0}y(et,"crypto_onetimeauth");function xn(e,o,i,r,a,u){var p=new Uint8Array(16);return et(p,0,i,r,a,u),cr(e,o,p,0)}y(xn,"crypto_onetimeauth_verify");function tt(e,o,i,r,a){var u;if(i<32)return-1;for(Vr(e,0,o,0,i,r,a),et(e,16,e,32,i-32,e),u=0;u<16;u++)e[u]=0;return 0}y(tt,"crypto_secretbox");function nt(e,o,i,r,a){var u,p=new Uint8Array(32);if(i<32||(Cr(p,0,32,r,a),xn(o,16,o,32,i-32,p)!==0))return-1;for(Vr(e,0,o,0,i,r,a),u=0;u<32;u++)e[u]=0;return 0}y(nt,"crypto_secretbox_open");function Or(e,o){var i;for(i=0;i<16;i++)e[i]=o[i]|0}y(Or,"set25519");function ft(e){var o,i,r=1;for(o=0;o<16;o++)i=e[o]+r+65535,r=Math.floor(i/65536),e[o]=i-r*65536;e[0]+=r-1+37*(r-1)}y(ft,"car25519");function te(e,o,i){for(var r,a=~(i-1),u=0;u<16;u++)r=a&(e[u]^o[u]),e[u]^=r,o[u]^=r}y(te,"sel25519");function ne(e,o){var i,r,a,u=t(),p=t();for(i=0;i<16;i++)p[i]=o[i];for(ft(p),ft(p),ft(p),r=0;r<2;r++){for(u[0]=p[0]-65517,i=1;i<15;i++)u[i]=p[i]-65535-(u[i-1]>>16&1),u[i-1]&=65535;u[15]=p[15]-32767-(u[14]>>16&1),a=u[15]>>16&1,u[14]&=65535,te(p,u,1-a)}for(i=0;i<16;i++)e[2*i]=p[i]&255,e[2*i+1]=p[i]>>8}y(ne,"pack25519");function un(e,o){var i=new Uint8Array(32),r=new Uint8Array(32);return ne(i,e),ne(r,o),vr(i,0,r,0)}y(un,"neq25519");function pn(e){var o=new Uint8Array(32);return ne(o,e),o[0]&1}y(pn,"par25519");function it(e,o){var i;for(i=0;i<16;i++)e[i]=o[2*i]+(o[2*i+1]<<8);e[15]&=32767}y(it,"unpack25519");function Mr(e,o,i){for(var r=0;r<16;r++)e[r]=o[r]+i[r]}y(Mr,"A");function Ir(e,o,i){for(var r=0;r<16;r++)e[r]=o[r]-i[r]}y(Ir,"Z");function $(e,o,i){var r,a,u=0,p=0,g=0,E=0,T=0,v=0,J=0,S=0,I=0,L=0,j=0,Y=0,N=0,z=0,R=0,C=0,D=0,U=0,B=0,P=0,K=0,h=0,d=0,m=0,l=0,b=0,w=0,M=0,H=0,V=0,F=0,s=i[0],W=i[1],Q=i[2],rr=i[3],X=i[4],Z=i[5],q=i[6],yr=i[7],tr=i[8],fr=i[9],ir=i[10],or=i[11],ur=i[12],br=i[13],Ar=i[14],mr=i[15];r=o[0],u+=r*s,p+=r*W,g+=r*Q,E+=r*rr,T+=r*X,v+=r*Z,J+=r*q,S+=r*yr,I+=r*tr,L+=r*fr,j+=r*ir,Y+=r*or,N+=r*ur,z+=r*br,R+=r*Ar,C+=r*mr,r=o[1],p+=r*s,g+=r*W,E+=r*Q,T+=r*rr,v+=r*X,J+=r*Z,S+=r*q,I+=r*yr,L+=r*tr,j+=r*fr,Y+=r*ir,N+=r*or,z+=r*ur,R+=r*br,C+=r*Ar,D+=r*mr,r=o[2],g+=r*s,E+=r*W,T+=r*Q,v+=r*rr,J+=r*X,S+=r*Z,I+=r*q,L+=r*yr,j+=r*tr,Y+=r*fr,N+=r*ir,z+=r*or,R+=r*ur,C+=r*br,D+=r*Ar,U+=r*mr,r=o[3],E+=r*s,T+=r*W,v+=r*Q,J+=r*rr,S+=r*X,I+=r*Z,L+=r*q,j+=r*yr,Y+=r*tr,N+=r*fr,z+=r*ir,R+=r*or,C+=r*ur,D+=r*br,U+=r*Ar,B+=r*mr,r=o[4],T+=r*s,v+=r*W,J+=r*Q,S+=r*rr,I+=r*X,L+=r*Z,j+=r*q,Y+=r*yr,N+=r*tr,z+=r*fr,R+=r*ir,C+=r*or,D+=r*ur,U+=r*br,B+=r*Ar,P+=r*mr,r=o[5],v+=r*s,J+=r*W,S+=r*Q,I+=r*rr,L+=r*X,j+=r*Z,Y+=r*q,N+=r*yr,z+=r*tr,R+=r*fr,C+=r*ir,D+=r*or,U+=r*ur,B+=r*br,P+=r*Ar,K+=r*mr,r=o[6],J+=r*s,S+=r*W,I+=r*Q,L+=r*rr,j+=r*X,Y+=r*Z,N+=r*q,z+=r*yr,R+=r*tr,C+=r*fr,D+=r*ir,U+=r*or,B+=r*ur,P+=r*br,K+=r*Ar,h+=r*mr,r=o[7],S+=r*s,I+=r*W,L+=r*Q,j+=r*rr,Y+=r*X,N+=r*Z,z+=r*q,R+=r*yr,C+=r*tr,D+=r*fr,U+=r*ir,B+=r*or,P+=r*ur,K+=r*br,h+=r*Ar,d+=r*mr,r=o[8],I+=r*s,L+=r*W,j+=r*Q,Y+=r*rr,N+=r*X,z+=r*Z,R+=r*q,C+=r*yr,D+=r*tr,U+=r*fr,B+=r*ir,P+=r*or,K+=r*ur,h+=r*br,d+=r*Ar,m+=r*mr,r=o[9],L+=r*s,j+=r*W,Y+=r*Q,N+=r*rr,z+=r*X,R+=r*Z,C+=r*q,D+=r*yr,U+=r*tr,B+=r*fr,P+=r*ir,K+=r*or,h+=r*ur,d+=r*br,m+=r*Ar,l+=r*mr,r=o[10],j+=r*s,Y+=r*W,N+=r*Q,z+=r*rr,R+=r*X,C+=r*Z,D+=r*q,U+=r*yr,B+=r*tr,P+=r*fr,K+=r*ir,h+=r*or,d+=r*ur,m+=r*br,l+=r*Ar,b+=r*mr,r=o[11],Y+=r*s,N+=r*W,z+=r*Q,R+=r*rr,C+=r*X,D+=r*Z,U+=r*q,B+=r*yr,P+=r*tr,K+=r*fr,h+=r*ir,d+=r*or,m+=r*ur,l+=r*br,b+=r*Ar,w+=r*mr,r=o[12],N+=r*s,z+=r*W,R+=r*Q,C+=r*rr,D+=r*X,U+=r*Z,B+=r*q,P+=r*yr,K+=r*tr,h+=r*fr,d+=r*ir,m+=r*or,l+=r*ur,b+=r*br,w+=r*Ar,M+=r*mr,r=o[13],z+=r*s,R+=r*W,C+=r*Q,D+=r*rr,U+=r*X,B+=r*Z,P+=r*q,K+=r*yr,h+=r*tr,d+=r*fr,m+=r*ir,l+=r*or,b+=r*ur,w+=r*br,M+=r*Ar,H+=r*mr,r=o[14],R+=r*s,C+=r*W,D+=r*Q,U+=r*rr,B+=r*X,P+=r*Z,K+=r*q,h+=r*yr,d+=r*tr,m+=r*fr,l+=r*ir,b+=r*or,w+=r*ur,M+=r*br,H+=r*Ar,V+=r*mr,r=o[15],C+=r*s,D+=r*W,U+=r*Q,B+=r*rr,P+=r*X,K+=r*Z,h+=r*q,d+=r*yr,m+=r*tr,l+=r*fr,b+=r*ir,w+=r*or,M+=r*ur,H+=r*br,V+=r*Ar,F+=r*mr,u+=38*D,p+=38*U,g+=38*B,E+=38*P,T+=38*K,v+=38*h,J+=38*d,S+=38*m,I+=38*l,L+=38*b,j+=38*w,Y+=38*M,N+=38*H,z+=38*V,R+=38*F,a=1,r=u+a+65535,a=Math.floor(r/65536),u=r-a*65536,r=p+a+65535,a=Math.floor(r/65536),p=r-a*65536,r=g+a+65535,a=Math.floor(r/65536),g=r-a*65536,r=E+a+65535,a=Math.floor(r/65536),E=r-a*65536,r=T+a+65535,a=Math.floor(r/65536),T=r-a*65536,r=v+a+65535,a=Math.floor(r/65536),v=r-a*65536,r=J+a+65535,a=Math.floor(r/65536),J=r-a*65536,r=S+a+65535,a=Math.floor(r/65536),S=r-a*65536,r=I+a+65535,a=Math.floor(r/65536),I=r-a*65536,r=L+a+65535,a=Math.floor(r/65536),L=r-a*65536,r=j+a+65535,a=Math.floor(r/65536),j=r-a*65536,r=Y+a+65535,a=Math.floor(r/65536),Y=r-a*65536,r=N+a+65535,a=Math.floor(r/65536),N=r-a*65536,r=z+a+65535,a=Math.floor(r/65536),z=r-a*65536,r=R+a+65535,a=Math.floor(r/65536),R=r-a*65536,r=C+a+65535,a=Math.floor(r/65536),C=r-a*65536,u+=a-1+37*(a-1),a=1,r=u+a+65535,a=Math.floor(r/65536),u=r-a*65536,r=p+a+65535,a=Math.floor(r/65536),p=r-a*65536,r=g+a+65535,a=Math.floor(r/65536),g=r-a*65536,r=E+a+65535,a=Math.floor(r/65536),E=r-a*65536,r=T+a+65535,a=Math.floor(r/65536),T=r-a*65536,r=v+a+65535,a=Math.floor(r/65536),v=r-a*65536,r=J+a+65535,a=Math.floor(r/65536),J=r-a*65536,r=S+a+65535,a=Math.floor(r/65536),S=r-a*65536,r=I+a+65535,a=Math.floor(r/65536),I=r-a*65536,r=L+a+65535,a=Math.floor(r/65536),L=r-a*65536,r=j+a+65535,a=Math.floor(r/65536),j=r-a*65536,r=Y+a+65535,a=Math.floor(r/65536),Y=r-a*65536,r=N+a+65535,a=Math.floor(r/65536),N=r-a*65536,r=z+a+65535,a=Math.floor(r/65536),z=r-a*65536,r=R+a+65535,a=Math.floor(r/65536),R=r-a*65536,r=C+a+65535,a=Math.floor(r/65536),C=r-a*65536,u+=a-1+37*(a-1),e[0]=u,e[1]=p,e[2]=g,e[3]=E,e[4]=T,e[5]=v,e[6]=J,e[7]=S,e[8]=I,e[9]=L,e[10]=j,e[11]=Y,e[12]=N,e[13]=z,e[14]=R,e[15]=C}y($,"M");function Br(e,o){$(e,o,o)}y(Br,"S");function hn(e,o){var i=t(),r;for(r=0;r<16;r++)i[r]=o[r];for(r=253;r>=0;r--)Br(i,i),r!==2&&r!==4&&$(i,i,o);for(r=0;r<16;r++)e[r]=i[r]}y(hn,"inv25519");function dn(e,o){var i=t(),r;for(r=0;r<16;r++)i[r]=o[r];for(r=250;r>=0;r--)Br(i,i),r!==1&&$(i,i,o);for(r=0;r<16;r++)e[r]=i[r]}y(dn,"pow2523");function Me(e,o,i){var r=new Uint8Array(32),a=new Float64Array(80),u,p,g=t(),E=t(),T=t(),v=t(),J=t(),S=t();for(p=0;p<31;p++)r[p]=o[p];for(r[31]=o[31]&127|64,r[0]&=248,it(a,i),p=0;p<16;p++)E[p]=a[p],v[p]=g[p]=T[p]=0;for(g[0]=v[0]=1,p=254;p>=0;--p)u=r[p>>>3]>>>(p&7)&1,te(g,E,u),te(T,v,u),Mr(J,g,T),Ir(g,g,T),Mr(T,E,v),Ir(E,E,v),Br(v,J),Br(S,g),$(g,T,g),$(T,E,J),Mr(J,g,T),Ir(g,g,T),Br(E,g),Ir(T,v,S),$(g,T,G),Mr(g,g,v),$(T,T,g),$(g,v,S),$(v,E,a),Br(E,J),te(g,E,u),te(T,v,u);for(p=0;p<16;p++)a[p+16]=g[p],a[p+32]=T[p],a[p+48]=E[p],a[p+64]=v[p];var I=a.subarray(32),L=a.subarray(16);return hn(I,I),$(L,L,I),ne(e,L),0}y(Me,"crypto_scalarmult");function Ie(e,o){return Me(e,o,x)}y(Ie,"crypto_scalarmult_base");function ln(e,o){return f(o,32),Ie(e,o)}y(ln,"crypto_box_keypair");function Le(e,o,i){var r=new Uint8Array(32);return Me(r,i,o),lr(e,c,r,pr)}y(Le,"crypto_box_beforenm");var gn=tt,xf=nt;function uf(e,o,i,r,a,u){var p=new Uint8Array(32);return Le(p,a,u),gn(e,o,i,r,p)}y(uf,"crypto_box");function pf(e,o,i,r,a,u){var p=new Uint8Array(32);return Le(p,a,u),xf(e,o,i,r,p)}y(pf,"crypto_box_open");var bn=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function An(e,o,i,r){for(var a=new Int32Array(16),u=new Int32Array(16),p,g,E,T,v,J,S,I,L,j,Y,N,z,R,C,D,U,B,P,K,h,d,m,l,b,w,M=e[0],H=e[1],V=e[2],F=e[3],s=e[4],W=e[5],Q=e[6],rr=e[7],X=o[0],Z=o[1],q=o[2],yr=o[3],tr=o[4],fr=o[5],ir=o[6],or=o[7],ur=0;r>=128;){for(P=0;P<16;P++)K=8*P+ur,a[P]=i[K+0]<<24|i[K+1]<<16|i[K+2]<<8|i[K+3],u[P]=i[K+4]<<24|i[K+5]<<16|i[K+6]<<8|i[K+7];for(P=0;P<80;P++)if(p=M,g=H,E=V,T=F,v=s,J=W,S=Q,I=rr,L=X,j=Z,Y=q,N=yr,z=tr,R=fr,C=ir,D=or,h=rr,d=or,m=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=(s>>>14|tr<<18)^(s>>>18|tr<<14)^(tr>>>9|s<<23),d=(tr>>>14|s<<18)^(tr>>>18|s<<14)^(s>>>9|tr<<23),m+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,h=s&W^~s&Q,d=tr&fr^~tr&ir,m+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,h=bn[P*2],d=bn[P*2+1],m+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,h=a[P%16],d=u[P%16],m+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=m>>>16,b+=l>>>16,w+=b>>>16,U=b&65535|w<<16,B=m&65535|l<<16,h=U,d=B,m=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=(M>>>28|X<<4)^(X>>>2|M<<30)^(X>>>7|M<<25),d=(X>>>28|M<<4)^(M>>>2|X<<30)^(M>>>7|X<<25),m+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,h=M&H^M&V^H&V,d=X&Z^X&q^Z&q,m+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=m>>>16,b+=l>>>16,w+=b>>>16,I=b&65535|w<<16,D=m&65535|l<<16,h=T,d=N,m=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=U,d=B,m+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=m>>>16,b+=l>>>16,w+=b>>>16,T=b&65535|w<<16,N=m&65535|l<<16,H=p,V=g,F=E,s=T,W=v,Q=J,rr=S,M=I,Z=L,q=j,yr=Y,tr=N,fr=z,ir=R,or=C,X=D,P%16===15)for(K=0;K<16;K++)h=a[K],d=u[K],m=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=a[(K+9)%16],d=u[(K+9)%16],m+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,U=a[(K+1)%16],B=u[(K+1)%16],h=(U>>>1|B<<31)^(U>>>8|B<<24)^U>>>7,d=(B>>>1|U<<31)^(B>>>8|U<<24)^(B>>>7|U<<25),m+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,U=a[(K+14)%16],B=u[(K+14)%16],h=(U>>>19|B<<13)^(B>>>29|U<<3)^U>>>6,d=(B>>>19|U<<13)^(U>>>29|B<<3)^(B>>>6|U<<26),m+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=m>>>16,b+=l>>>16,w+=b>>>16,a[K]=b&65535|w<<16,u[K]=m&65535|l<<16;h=M,d=X,m=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=e[0],d=o[0],m+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=m>>>16,b+=l>>>16,w+=b>>>16,e[0]=M=b&65535|w<<16,o[0]=X=m&65535|l<<16,h=H,d=Z,m=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=e[1],d=o[1],m+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=m>>>16,b+=l>>>16,w+=b>>>16,e[1]=H=b&65535|w<<16,o[1]=Z=m&65535|l<<16,h=V,d=q,m=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=e[2],d=o[2],m+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=m>>>16,b+=l>>>16,w+=b>>>16,e[2]=V=b&65535|w<<16,o[2]=q=m&65535|l<<16,h=F,d=yr,m=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=e[3],d=o[3],m+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=m>>>16,b+=l>>>16,w+=b>>>16,e[3]=F=b&65535|w<<16,o[3]=yr=m&65535|l<<16,h=s,d=tr,m=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=e[4],d=o[4],m+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=m>>>16,b+=l>>>16,w+=b>>>16,e[4]=s=b&65535|w<<16,o[4]=tr=m&65535|l<<16,h=W,d=fr,m=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=e[5],d=o[5],m+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=m>>>16,b+=l>>>16,w+=b>>>16,e[5]=W=b&65535|w<<16,o[5]=fr=m&65535|l<<16,h=Q,d=ir,m=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=e[6],d=o[6],m+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=m>>>16,b+=l>>>16,w+=b>>>16,e[6]=Q=b&65535|w<<16,o[6]=ir=m&65535|l<<16,h=rr,d=or,m=d&65535,l=d>>>16,b=h&65535,w=h>>>16,h=e[7],d=o[7],m+=d&65535,l+=d>>>16,b+=h&65535,w+=h>>>16,l+=m>>>16,b+=l>>>16,w+=b>>>16,e[7]=rr=b&65535|w<<16,o[7]=or=m&65535|l<<16,ur+=128,r-=128}return r}y(An,"crypto_hashblocks_hl");function kr(e,o,i){var r=new Int32Array(8),a=new Int32Array(8),u=new Uint8Array(256),p,g=i;for(r[0]=1779033703,r[1]=3144134277,r[2]=1013904242,r[3]=2773480762,r[4]=1359893119,r[5]=2600822924,r[6]=528734635,r[7]=1541459225,a[0]=4089235720,a[1]=2227873595,a[2]=4271175723,a[3]=1595750129,a[4]=2917565137,a[5]=725511199,a[6]=4215389547,a[7]=327033209,An(r,a,o,i),i%=128,p=0;p<i;p++)u[p]=o[g-i+p];for(u[i]=128,i=256-128*(i<112?1:0),u[i-9]=0,ee(u,i-8,g/536870912|0,g<<3),An(r,a,u,i),p=0;p<8;p++)ee(e,8*p,r[p],a[p]);return 0}y(kr,"crypto_hash");function Ne(e,o){var i=t(),r=t(),a=t(),u=t(),p=t(),g=t(),E=t(),T=t(),v=t();Ir(i,e[1],e[0]),Ir(v,o[1],o[0]),$(i,i,v),Mr(r,e[0],e[1]),Mr(v,o[0],o[1]),$(r,r,v),$(a,e[3],o[3]),$(a,a,gr),$(u,e[2],o[2]),Mr(u,u,u),Ir(p,r,i),Ir(g,u,a),Mr(E,u,a),Mr(T,r,i),$(e[0],p,g),$(e[1],T,E),$(e[2],E,g),$(e[3],p,T)}y(Ne,"add");function mn(e,o,i){var r;for(r=0;r<4;r++)te(e[r],o[r],i)}y(mn,"cswap");function ot(e,o){var i=t(),r=t(),a=t();hn(a,o[2]),$(i,o[0],a),$(r,o[1],a),ne(e,r),e[31]^=pn(i)<<7}y(ot,"pack");function at(e,o,i){var r,a;for(Or(e[0],A),Or(e[1],_),Or(e[2],_),Or(e[3],A),a=255;a>=0;--a)r=i[a/8|0]>>(a&7)&1,mn(e,o,r),Ne(o,e),Ne(e,e),mn(e,o,r)}y(at,"scalarmult");function Re(e,o){var i=[t(),t(),t(),t()];Or(i[0],sr),Or(i[1],Kr),Or(i[2],_),$(i[3],sr,Kr),at(e,i,o)}y(Re,"scalarbase");function st(e,o,i){var r=new Uint8Array(64),a=[t(),t(),t(),t()],u;for(i||f(o,32),kr(r,o,32),r[0]&=248,r[31]&=127,r[31]|=64,Re(a,r),ot(e,a),u=0;u<32;u++)o[u+32]=e[u];return 0}y(st,"crypto_sign_keypair");var ze=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ct(e,o){var i,r,a,u;for(r=63;r>=32;--r){for(i=0,a=r-32,u=r-12;a<u;++a)o[a]+=i-16*o[r]*ze[a-(r-32)],i=Math.floor((o[a]+128)/256),o[a]-=i*256;o[a]+=i,o[r]=0}for(i=0,a=0;a<32;a++)o[a]+=i-(o[31]>>4)*ze[a],i=o[a]>>8,o[a]&=255;for(a=0;a<32;a++)o[a]-=i*ze[a];for(r=0;r<32;r++)o[r+1]+=o[r]>>8,e[r]=o[r]&255}y(ct,"modL");function yt(e){var o=new Float64Array(64),i;for(i=0;i<64;i++)o[i]=e[i];for(i=0;i<64;i++)e[i]=0;ct(e,o)}y(yt,"reduce");function wn(e,o,i,r){var a=new Uint8Array(64),u=new Uint8Array(64),p=new Uint8Array(64),g,E,T=new Float64Array(64),v=[t(),t(),t(),t()];kr(a,r,32),a[0]&=248,a[31]&=127,a[31]|=64;var J=i+64;for(g=0;g<i;g++)e[64+g]=o[g];for(g=0;g<32;g++)e[32+g]=a[32+g];for(kr(p,e.subarray(32),i+32),yt(p),Re(v,p),ot(e,v),g=32;g<64;g++)e[g]=r[g];for(kr(u,e,i+64),yt(u),g=0;g<64;g++)T[g]=0;for(g=0;g<32;g++)T[g]=p[g];for(g=0;g<32;g++)for(E=0;E<32;E++)T[g+E]+=u[g]*a[E];return ct(e.subarray(32),T),J}y(wn,"crypto_sign");function hf(e,o){var i=t(),r=t(),a=t(),u=t(),p=t(),g=t(),E=t();return Or(e[2],_),it(e[1],o),Br(a,e[1]),$(u,a,nr),Ir(a,a,e[2]),Mr(u,e[2],u),Br(p,u),Br(g,p),$(E,g,p),$(i,E,a),$(i,i,u),dn(i,i),$(i,i,a),$(i,i,u),$(i,i,u),$(e[0],i,u),Br(r,e[0]),$(r,r,u),un(r,a)&&$(e[0],e[0],zr),Br(r,e[0]),$(r,r,u),un(r,a)?-1:(pn(e[0])===o[31]>>7&&Ir(e[0],A,e[0]),$(e[3],e[0],e[1]),0)}y(hf,"unpackneg");function xt(e,o,i,r){var a,u=new Uint8Array(32),p=new Uint8Array(64),g=[t(),t(),t(),t()],E=[t(),t(),t(),t()];if(i<64||hf(E,r))return-1;for(a=0;a<i;a++)e[a]=o[a];for(a=0;a<32;a++)e[a+32]=r[a];if(kr(p,e,i),yt(p),at(g,E,p),Re(E,o.subarray(32)),Ne(g,E),ot(u,g),i-=64,vr(o,0,u,0)){for(a=0;a<i;a++)e[a]=0;return-1}for(a=0;a<i;a++)e[a]=o[a+64];return i}y(xt,"crypto_sign_open");var ut=32,Oe=24,de=32,fe=16,le=32,Ye=32,ge=32,be=32,pt=32,En=Oe,df=de,lf=fe,Yr=64,Zr=32,ie=64,ht=32,dt=64;n.lowlevel={crypto_core_hsalsa20:lr,crypto_stream_xor:Vr,crypto_stream:Cr,crypto_stream_salsa20_xor:Dr,crypto_stream_salsa20:Ur,crypto_onetimeauth:et,crypto_onetimeauth_verify:xn,crypto_verify_16:cr,crypto_verify_32:vr,crypto_secretbox:tt,crypto_secretbox_open:nt,crypto_scalarmult:Me,crypto_scalarmult_base:Ie,crypto_box_beforenm:Le,crypto_box_afternm:gn,crypto_box:uf,crypto_box_open:pf,crypto_box_keypair:ln,crypto_hash:kr,crypto_sign:wn,crypto_sign_keypair:st,crypto_sign_open:xt,crypto_secretbox_KEYBYTES:ut,crypto_secretbox_NONCEBYTES:Oe,crypto_secretbox_ZEROBYTES:de,crypto_secretbox_BOXZEROBYTES:fe,crypto_scalarmult_BYTES:le,crypto_scalarmult_SCALARBYTES:Ye,crypto_box_PUBLICKEYBYTES:ge,crypto_box_SECRETKEYBYTES:be,crypto_box_BEFORENMBYTES:pt,crypto_box_NONCEBYTES:En,crypto_box_ZEROBYTES:df,crypto_box_BOXZEROBYTES:lf,crypto_sign_BYTES:Yr,crypto_sign_PUBLICKEYBYTES:Zr,crypto_sign_SECRETKEYBYTES:ie,crypto_sign_SEEDBYTES:ht,crypto_hash_BYTES:dt,gf:t,D:nr,L:ze,pack25519:ne,unpack25519:it,M:$,A:Mr,S:Br,Z:Ir,pow2523:dn,add:Ne,set25519:Or,modL:ct,scalarmult:at,scalarbase:Re};function Kn(e,o){if(e.length!==ut)throw new Error("bad key size");if(o.length!==Oe)throw new Error("bad nonce size")}y(Kn,"checkLengths");function gf(e,o){if(e.length!==ge)throw new Error("bad public key size");if(o.length!==be)throw new Error("bad secret key size")}y(gf,"checkBoxLengths");function _r(){for(var e=0;e<arguments.length;e++)if(!(arguments[e]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}y(_r,"checkArrayTypes");function vn(e){for(var o=0;o<e.length;o++)e[o]=0}y(vn,"cleanup"),n.randomBytes=function(e){var o=new Uint8Array(e);return f(o,e),o},n.secretbox=function(e,o,i){_r(e,o,i),Kn(i,o);for(var r=new Uint8Array(de+e.length),a=new Uint8Array(r.length),u=0;u<e.length;u++)r[u+de]=e[u];return tt(a,r,r.length,o,i),a.subarray(fe)},n.secretbox.open=function(e,o,i){_r(e,o,i),Kn(i,o);for(var r=new Uint8Array(fe+e.length),a=new Uint8Array(r.length),u=0;u<e.length;u++)r[u+fe]=e[u];return r.length<32||nt(a,r,r.length,o,i)!==0?null:a.subarray(de)},n.secretbox.keyLength=ut,n.secretbox.nonceLength=Oe,n.secretbox.overheadLength=fe,n.scalarMult=function(e,o){if(_r(e,o),e.length!==Ye)throw new Error("bad n size");if(o.length!==le)throw new Error("bad p size");var i=new Uint8Array(le);return Me(i,e,o),i},n.scalarMult.base=function(e){if(_r(e),e.length!==Ye)throw new Error("bad n size");var o=new Uint8Array(le);return Ie(o,e),o},n.scalarMult.scalarLength=Ye,n.scalarMult.groupElementLength=le,n.box=function(e,o,i,r){var a=n.box.before(i,r);return n.secretbox(e,o,a)},n.box.before=function(e,o){_r(e,o),gf(e,o);var i=new Uint8Array(pt);return Le(i,e,o),i},n.box.after=n.secretbox,n.box.open=function(e,o,i,r){var a=n.box.before(i,r);return n.secretbox.open(e,o,a)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var e=new Uint8Array(ge),o=new Uint8Array(be);return ln(e,o),{publicKey:e,secretKey:o}},n.box.keyPair.fromSecretKey=function(e){if(_r(e),e.length!==be)throw new Error("bad secret key size");var o=new Uint8Array(ge);return Ie(o,e),{publicKey:o,secretKey:new Uint8Array(e)}},n.box.publicKeyLength=ge,n.box.secretKeyLength=be,n.box.sharedKeyLength=pt,n.box.nonceLength=En,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(e,o){if(_r(e,o),o.length!==ie)throw new Error("bad secret key size");var i=new Uint8Array(Yr+e.length);return wn(i,e,e.length,o),i},n.sign.open=function(e,o){if(_r(e,o),o.length!==Zr)throw new Error("bad public key size");var i=new Uint8Array(e.length),r=xt(i,e,e.length,o);if(r<0)return null;for(var a=new Uint8Array(r),u=0;u<a.length;u++)a[u]=i[u];return a},n.sign.detached=function(e,o){for(var i=n.sign(e,o),r=new Uint8Array(Yr),a=0;a<r.length;a++)r[a]=i[a];return r},n.sign.detached.verify=function(e,o,i){if(_r(e,o,i),o.length!==Yr)throw new Error("bad signature size");if(i.length!==Zr)throw new Error("bad public key size");var r=new Uint8Array(Yr+e.length),a=new Uint8Array(Yr+e.length),u;for(u=0;u<Yr;u++)r[u]=o[u];for(u=0;u<e.length;u++)r[u+Yr]=e[u];return xt(a,r,r.length,i)>=0},n.sign.keyPair=function(){var e=new Uint8Array(Zr),o=new Uint8Array(ie);return st(e,o),{publicKey:e,secretKey:o}},n.sign.keyPair.fromSecretKey=function(e){if(_r(e),e.length!==ie)throw new Error("bad secret key size");for(var o=new Uint8Array(Zr),i=0;i<o.length;i++)o[i]=e[32+i];return{publicKey:o,secretKey:new Uint8Array(e)}},n.sign.keyPair.fromSeed=function(e){if(_r(e),e.length!==ht)throw new Error("bad seed size");for(var o=new Uint8Array(Zr),i=new Uint8Array(ie),r=0;r<32;r++)i[r]=e[r];return st(o,i,!0),{publicKey:o,secretKey:i}},n.sign.publicKeyLength=Zr,n.sign.secretKeyLength=ie,n.sign.seedLength=ht,n.sign.signatureLength=Yr,n.hash=function(e){_r(e);var o=new Uint8Array(dt);return kr(o,e,e.length),o},n.hash.hashLength=dt,n.verify=function(e,o){return _r(e,o),e.length===0||o.length===0||e.length!==o.length?!1:k(e,0,o,0,e.length)===0},n.setPRNG=function(e){f=e},function(){var e=typeof self<"u"?self.crypto||self.msCrypto:null;if(e&&e.getRandomValues){var o=65536;n.setPRNG(function(i,r){var a,u=new Uint8Array(r);for(a=0;a<r;a+=o)e.getRandomValues(u.subarray(a,a+Math.min(r-a,o)));for(a=0;a<r;a++)i[a]=u[a];vn(u)})}else typeof Un<"u"&&(e=Jn(),e&&e.randomBytes&&n.setPRNG(function(i,r){var a,u=e.randomBytes(r);for(a=0;a<r;a++)i[a]=u[a];vn(u)}))}()})(typeof $e<"u"&&$e.exports?$e.exports:self.nacl=self.nacl||{})});var Sf=globalThis||window||self,er=Sf.crypto;function me(n=0){return new Uint8Array(n)}y(me,"allocUnsafe");function lt(n,t){t==null&&(t=n.reduce((x,A)=>x+A.length,0));let f=me(t),c=0;for(let x of n)f.set(x,c),c+=x.length;return f}y(lt,"concat");var Ut={};Pr(Ut,{base10:()=>Mf});var wo=new Uint8Array(0);function _n(n,t){if(n===t)return!0;if(n.byteLength!==t.byteLength)return!1;for(let f=0;f<n.byteLength;f++)if(n[f]!==t[f])return!1;return!0}y(_n,"equals");function jr(n){if(n instanceof Uint8Array&&n.constructor.name==="Uint8Array")return n;if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);throw new Error("Unknown type, must be binary type")}y(jr,"coerce");function Cn(n){return new TextEncoder().encode(n)}y(Cn,"fromString");function Bn(n){return new TextDecoder().decode(n)}y(Bn,"toString");function Cf(n,t){if(n.length>=255)throw new TypeError("Alphabet too long");for(var f=new Uint8Array(256),c=0;c<f.length;c++)f[c]=255;for(var x=0;x<n.length;x++){var A=n.charAt(x),_=A.charCodeAt(0);if(f[_]!==255)throw new TypeError(A+" is ambiguous");f[_]=x}var G=n.length,nr=n.charAt(0),gr=Math.log(G)/Math.log(256),sr=Math.log(256)/Math.log(G);function Kr(k){if(k instanceof Uint8Array||(ArrayBuffer.isView(k)?k=new Uint8Array(k.buffer,k.byteOffset,k.byteLength):Array.isArray(k)&&(k=Uint8Array.from(k))),!(k instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(k.length===0)return"";for(var cr=0,vr=0,wr=0,dr=k.length;wr!==dr&&k[wr]===0;)wr++,cr++;for(var Er=(dr-wr)*sr+1>>>0,lr=new Uint8Array(Er);wr!==dr;){for(var pr=k[wr],Dr=0,Ur=Er-1;(pr!==0||Dr<vr)&&Ur!==-1;Ur--,Dr++)pr+=256*lr[Ur]>>>0,lr[Ur]=pr%G>>>0,pr=pr/G>>>0;if(pr!==0)throw new Error("Non-zero carry");vr=Dr,wr++}for(var Cr=Er-vr;Cr!==Er&&lr[Cr]===0;)Cr++;for(var Vr=nr.repeat(cr);Cr<Er;++Cr)Vr+=n.charAt(lr[Cr]);return Vr}y(Kr,"encode");function zr(k){if(typeof k!="string")throw new TypeError("Expected String");if(k.length===0)return new Uint8Array;var cr=0;if(k[cr]!==" "){for(var vr=0,wr=0;k[cr]===nr;)vr++,cr++;for(var dr=(k.length-cr)*gr+1>>>0,Er=new Uint8Array(dr);k[cr];){var lr=f[k.charCodeAt(cr)];if(lr===255)return;for(var pr=0,Dr=dr-1;(lr!==0||pr<wr)&&Dr!==-1;Dr--,pr++)lr+=G*Er[Dr]>>>0,Er[Dr]=lr%256>>>0,lr=lr/256>>>0;if(lr!==0)throw new Error("Non-zero carry");wr=pr,cr++}if(k[cr]!==" "){for(var Ur=dr-wr;Ur!==dr&&Er[Ur]===0;)Ur++;for(var Cr=new Uint8Array(vr+(dr-Ur)),Vr=vr;Ur!==dr;)Cr[Vr++]=Er[Ur++];return Cr}}}y(zr,"decodeUnsafe");function ee(k){var cr=zr(k);if(cr)return cr;throw new Error(`Non-${t} character`)}return y(ee,"decode"),{encode:Kr,decodeUnsafe:zr,decode:ee}}y(Cf,"base");var Bf=Cf,Pf=Bf,Tn=Pf;var wt=class wt{constructor(t,f,c){O(this,"name");O(this,"prefix");O(this,"baseEncode");this.name=t,this.prefix=f,this.baseEncode=c}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}};y(wt,"Encoder");var gt=wt,Et=class Et{constructor(t,f,c){O(this,"name");O(this,"prefix");O(this,"baseDecode");O(this,"prefixCodePoint");this.name=t,this.prefix=f;let x=f.codePointAt(0);if(x===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=x,this.baseDecode=c}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Dn(this,t)}};y(Et,"Decoder");var bt=Et,Kt=class Kt{constructor(t){O(this,"decoders");this.decoders=t}or(t){return Dn(this,t)}decode(t){let f=t[0],c=this.decoders[f];if(c!=null)return c.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};y(Kt,"ComposedDecoder");var At=Kt;function Dn(n,t){return new At({...n.decoders??{[n.prefix]:n},...t.decoders??{[t.prefix]:t}})}y(Dn,"or");var vt=class vt{constructor(t,f,c,x){O(this,"name");O(this,"prefix");O(this,"baseEncode");O(this,"baseDecode");O(this,"encoder");O(this,"decoder");this.name=t,this.prefix=f,this.baseEncode=c,this.baseDecode=x,this.encoder=new gt(t,f,c),this.decoder=new bt(t,f,x)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};y(vt,"Codec");var mt=vt;function oe({name:n,prefix:t,encode:f,decode:c}){return new mt(n,t,f,c)}y(oe,"from");function Xr({name:n,prefix:t,alphabet:f}){let{encode:c,decode:x}=Tn(f,n);return oe({prefix:t,name:n,encode:c,decode:y(A=>jr(x(A)),"decode")})}y(Xr,"baseX");function Tf(n,t,f,c){let x={};for(let sr=0;sr<t.length;++sr)x[t[sr]]=sr;let A=n.length;for(;n[A-1]==="=";)--A;let _=new Uint8Array(A*f/8|0),G=0,nr=0,gr=0;for(let sr=0;sr<A;++sr){let Kr=x[n[sr]];if(Kr===void 0)throw new SyntaxError(`Non-${c} character`);nr=nr<<f|Kr,G+=f,G>=8&&(G-=8,_[gr++]=255&nr>>G)}if(G>=f||(255&nr<<8-G)!==0)throw new SyntaxError("Unexpected end of data");return _}y(Tf,"decode");function Df(n,t,f){let c=t[t.length-1]==="=",x=(1<<f)-1,A="",_=0,G=0;for(let nr=0;nr<n.length;++nr)for(G=G<<8|n[nr],_+=8;_>f;)_-=f,A+=t[x&G>>_];if(_!==0&&(A+=t[x&G<<f-_]),c)for(;(A.length*f&7)!==0;)A+="=";return A}y(Df,"encode");function ar({name:n,prefix:t,bitsPerChar:f,alphabet:c}){return oe({prefix:t,name:n,encode(x){return Df(x,c,f)},decode(x){return Tf(x,c,f,n)}})}y(ar,"rfc4648");var Mf=Xr({prefix:"9",name:"base10",alphabet:"0123456789"});var St={};Pr(St,{base16:()=>If,base16upper:()=>Lf});var If=ar({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Lf=ar({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var _t={};Pr(_t,{base2:()=>Nf});var Nf=ar({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ct={};Pr(Ct,{base256emoji:()=>jf});var Mn=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Rf=Mn.reduce((n,t,f)=>(n[f]=t,n),[]),zf=Mn.reduce((n,t,f)=>{let c=t.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${t}`);return n[c]=f,n},[]);function Of(n){return n.reduce((t,f)=>(t+=Rf[f],t),"")}y(Of,"encode");function Yf(n){let t=[];for(let f of n){let c=f.codePointAt(0);if(c==null)throw new Error(`Invalid character: ${f}`);let x=zf[c];if(x==null)throw new Error(`Non-base256emoji character: ${f}`);t.push(x)}return new Uint8Array(t)}y(Yf,"decode");var jf=oe({prefix:"\u{1F680}",name:"base256emoji",encode:Of,decode:Yf});var Bt={};Pr(Bt,{base32:()=>ae,base32hex:()=>Vf,base32hexpad:()=>Wf,base32hexpadupper:()=>$f,base32hexupper:()=>Xf,base32pad:()=>Ff,base32padupper:()=>Gf,base32upper:()=>Hf,base32z:()=>kf});var ae=ar({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Hf=ar({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ff=ar({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Gf=ar({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Vf=ar({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Xf=ar({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Wf=ar({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),$f=ar({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),kf=ar({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Pt={};Pr(Pt,{base36:()=>we,base36upper:()=>Zf});var we=Xr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Zf=Xr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Tt={};Pr(Tt,{base58btc:()=>Nr,base58flickr:()=>qf});var Nr=Xr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),qf=Xr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Dt={};Pr(Dt,{base64:()=>Jf,base64pad:()=>Qf,base64url:()=>ri,base64urlpad:()=>ei});var Jf=ar({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Qf=ar({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ri=ar({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ei=ar({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Mt={};Pr(Mt,{base8:()=>ti});var ti=ar({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var It={};Pr(It,{identity:()=>ni});var ni=oe({prefix:"\0",name:"identity",encode:y(n=>Bn(n),"encode"),decode:y(n=>Cn(n),"decode")});var Ho=new TextEncoder,Fo=new TextDecoder;var Rt={};Pr(Rt,{identity:()=>Si});var oi=Nn,In=128,ai=127,si=~ai,ci=Math.pow(2,31);function Nn(n,t,f){t=t||[],f=f||0;for(var c=f;n>=ci;)t[f++]=n&255|In,n/=128;for(;n&si;)t[f++]=n&255|In,n>>>=7;return t[f]=n|0,Nn.bytes=f-c+1,t}y(Nn,"encode");var yi=Lt,xi=128,Ln=127;function Lt(n,c){var f=0,c=c||0,x=0,A=c,_,G=n.length;do{if(A>=G)throw Lt.bytes=0,new RangeError("Could not decode varint");_=n[A++],f+=x<28?(_&Ln)<<x:(_&Ln)*Math.pow(2,x),x+=7}while(_>=xi);return Lt.bytes=A-c,f}y(Lt,"read");var ui=Math.pow(2,7),pi=Math.pow(2,14),hi=Math.pow(2,21),di=Math.pow(2,28),li=Math.pow(2,35),gi=Math.pow(2,42),bi=Math.pow(2,49),Ai=Math.pow(2,56),mi=Math.pow(2,63),wi=y(function(n){return n<ui?1:n<pi?2:n<hi?3:n<di?4:n<li?5:n<gi?6:n<bi?7:n<Ai?8:n<mi?9:10},"length"),Ei={encode:oi,decode:yi,encodingLength:wi},Ki=Ei,Ee=Ki;function Ke(n,t=0){return[Ee.decode(n,t),Ee.decode.bytes]}y(Ke,"decode");function se(n,t,f=0){return Ee.encode(n,t,f),t}y(se,"encodeTo");function ce(n){return Ee.encodingLength(n)}y(ce,"encodingLength");function qr(n,t){let f=t.byteLength,c=ce(n),x=c+ce(f),A=new Uint8Array(x+f);return se(n,A,0),se(f,A,c),A.set(t,x),new ye(n,f,t,A)}y(qr,"create");function Rn(n){let t=jr(n),[f,c]=Ke(t),[x,A]=Ke(t.subarray(c)),_=t.subarray(c+A);if(_.byteLength!==x)throw new Error("Incorrect length");return new ye(f,x,_,t)}y(Rn,"decode");function zn(n,t){if(n===t)return!0;{let f=t;return n.code===f.code&&n.size===f.size&&f.bytes instanceof Uint8Array&&_n(n.bytes,f.bytes)}}y(zn,"equals");var Nt=class Nt{constructor(t,f,c,x){O(this,"code");O(this,"size");O(this,"digest");O(this,"bytes");this.code=t,this.size=f,this.digest=c,this.bytes=x}};y(Nt,"Digest");var ye=Nt;var On=0,vi="identity",Yn=jr;function Ui(n){return qr(On,Yn(n))}y(Ui,"digest");var Si={code:On,name:vi,encode:Yn,digest:Ui};var jt={};Pr(jt,{sha256:()=>_i,sha512:()=>Ci});function Ot({name:n,code:t,encode:f}){return new zt(n,t,f)}y(Ot,"from");var Yt=class Yt{constructor(t,f,c){O(this,"name");O(this,"code");O(this,"encode");this.name=t,this.code=f,this.encode=c}digest(t){if(t instanceof Uint8Array){let f=this.encode(t);return f instanceof Uint8Array?qr(this.code,f):f.then(c=>qr(this.code,c))}else throw Error("Unknown type, must be binary type")}};y(Yt,"Hasher");var zt=Yt;function Hn(n){return async t=>new Uint8Array(await crypto.subtle.digest(n,t))}y(Hn,"sha");var _i=Ot({name:"sha2-256",code:18,encode:Hn("SHA-256")}),Ci=Ot({name:"sha2-512",code:19,encode:Hn("SHA-512")});function Fn(n,t){let{bytes:f,version:c}=n;switch(c){case 0:return Pi(f,Ht(n),t??Nr.encoder);default:return Ti(f,Ht(n),t??ae.encoder)}}y(Fn,"format");var Gn=new WeakMap;function Ht(n){let t=Gn.get(n);if(t==null){let f=new Map;return Gn.set(n,f),f}return t}y(Ht,"baseCache");var Xn,hr=class hr{constructor(t,f,c,x){O(this,"code");O(this,"version");O(this,"multihash");O(this,"bytes");O(this,"/");O(this,Xn,"CID");this.code=f,this.version=t,this.multihash=c,this.bytes=x,this["/"]=x}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:f}=this;if(t!==Ue)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(f.code!==Di)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return hr.createV0(f)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:f}=this.multihash,c=qr(t,f);return hr.createV1(this.code,c)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return hr.equals(this,t)}static equals(t,f){let c=f;return c!=null&&t.code===c.code&&t.version===c.version&&zn(t.multihash,c.multihash)}toString(t){return Fn(this,t)}toJSON(){return{"/":Fn(this)}}link(){return this}[(Xn=Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"))](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let f=t;if(f instanceof hr)return f;if(f["/"]!=null&&f["/"]===f.bytes||f.asCID===f){let{version:c,code:x,multihash:A,bytes:_}=f;return new hr(c,x,A,_??Vn(c,x,A.bytes))}else if(f[Mi]===!0){let{version:c,multihash:x,code:A}=f,_=Rn(x);return hr.create(c,A,_)}else return null}static create(t,f,c){if(typeof f!="number")throw new Error("String codecs are no longer supported");if(!(c.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(f!==Ue)throw new Error(`Version 0 CID must use dag-pb (code: ${Ue}) block encoding`);return new hr(t,f,c,c.bytes)}case 1:{let x=Vn(t,f,c.bytes);return new hr(t,f,c,x)}default:throw new Error("Invalid version")}}static createV0(t){return hr.create(0,Ue,t)}static createV1(t,f){return hr.create(1,t,f)}static decode(t){let[f,c]=hr.decodeFirst(t);if(c.length!==0)throw new Error("Incorrect length");return f}static decodeFirst(t){let f=hr.inspectBytes(t),c=f.size-f.multihashSize,x=jr(t.subarray(c,c+f.multihashSize));if(x.byteLength!==f.multihashSize)throw new Error("Incorrect length");let A=x.subarray(f.multihashSize-f.digestSize),_=new ye(f.multihashCode,f.digestSize,A,x);return[f.version===0?hr.createV0(_):hr.createV1(f.codec,_),t.subarray(f.size)]}static inspectBytes(t){let f=0,c=y(()=>{let[Kr,zr]=Ke(t.subarray(f));return f+=zr,Kr},"next"),x=c(),A=Ue;if(x===18?(x=0,f=0):A=c(),x!==0&&x!==1)throw new RangeError(`Invalid CID version ${x}`);let _=f,G=c(),nr=c(),gr=f+nr,sr=gr-_;return{version:x,codec:A,multihashCode:G,digestSize:nr,multihashSize:sr,size:gr}}static parse(t,f){let[c,x]=Bi(t,f),A=hr.decode(x);if(A.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ht(A).set(c,t),A}};y(hr,"CID");var He=hr;function Bi(n,t){switch(n[0]){case"Q":{let f=t??Nr;return[Nr.prefix,f.decode(`${Nr.prefix}${n}`)]}case Nr.prefix:{let f=t??Nr;return[Nr.prefix,f.decode(n)]}case ae.prefix:{let f=t??ae;return[ae.prefix,f.decode(n)]}case we.prefix:{let f=t??we;return[we.prefix,f.decode(n)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[n[0],t.decode(n)]}}}y(Bi,"parseCIDtoBytes");function Pi(n,t,f){let{prefix:c}=f;if(c!==Nr.prefix)throw Error(`Cannot string encode V0 in ${f.name} encoding`);let x=t.get(c);if(x==null){let A=f.encode(n).slice(1);return t.set(c,A),A}else return x}y(Pi,"toStringV0");function Ti(n,t,f){let{prefix:c}=f,x=t.get(c);if(x==null){let A=f.encode(n);return t.set(c,A),A}else return x}y(Ti,"toStringV1");var Ue=112,Di=18;function Vn(n,t,f){let c=ce(n),x=c+ce(t),A=new Uint8Array(x+f.byteLength);return se(n,A,0),se(t,A,c),A.set(f,x),A}y(Vn,"encodeCID");var Mi=Symbol.for("@ipld/js-cid/CID");var Ft={...It,..._t,...Mt,...Ut,...St,...Bt,...Pt,...Tt,...Dt,...Ct},ma={...jt,...Rt};function $n(n,t,f,c){return{name:n,prefix:t,encoder:{name:n,prefix:t,encode:f},decoder:{decode:c}}}y($n,"createCodec");var Wn=$n("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),Gt=$n("ascii","a",n=>{let t="a";for(let f=0;f<n.length;f++)t+=String.fromCharCode(n[f]);return t},n=>{n=n.substring(1);let t=me(n.length);for(let f=0;f<n.length;f++)t[f]=n.charCodeAt(f);return t}),Ii={utf8:Wn,"utf-8":Wn,hex:Ft.base16,latin1:Gt,ascii:Gt,binary:Gt,...Ft},Fe=Ii;function Hr(n,t="utf8"){let f=Fe[t];if(f==null)throw new Error(`Unsupported encoding "${t}"`);return f.decoder.decode(`${f.prefix}${n}`)}y(Hr,"fromString");function xr(n,t="utf8"){let f=Fe[t];if(f==null)throw new Error(`Unsupported encoding "${t}"`);return f.encoder.encode(n).substring(1)}y(xr,"toString");var Ge="did:key:z",Se="Ed25519",kn="X25519",Xa="X25519",Zn="Ed25519",qn="X25519";var _e="RSA-OAEP",Ce="RSASSA-PKCS1-v1_5",Vt="SHA-256",Xt=new Uint8Array([0,245,2]),Wa=2048,Wt="SHA-256",xe=8,ue="AES-GCM",Fr=ue,Jr=256,Wr=12,$t=new Uint8Array([234,1]),kt=new Uint8Array([237,1]),Ve={RSA:"rsa",Edwards:"ed25519",BLS:"bls12-381"};var Xe="ecc-exchange",We="ecc-write",Rr=16;var tf=Uf(Qn(),1);function Tr(n){return new Uint8Array(n).buffer}y(Tr,"toArrayBuffer");var rf={keyTypes:{"bls12-381":{magicBytes:new Uint8Array([234,1]),verify:y(()=>{throw new Error("Not implemented")},"verify")},rsa:{magicBytes:new Uint8Array([0,245,2]),verify:zi},ed25519:{magicBytes:new Uint8Array([237,1]),verify:Ri}}};async function Ri({message:n,publicKey:t,signature:f}){return tf.default.sign.detached.verify(n,f,t)}y(Ri,"ed25519Verify");async function nf(n){return new Uint8Array(await er.subtle.digest("sha-256",n.buffer))}y(nf,"sha256");async function Qt(n,t="rsa"){let f=n instanceof CryptoKey?new Uint8Array(await pe(n)):n,c=rf.keyTypes[t]?.magicBytes;if(!c)throw new Error(`Key type '${t}' not supported, available types: ${Object.keys(rf.keyTypes).join(", ")}`);let x=lt([c,f]);return Ge+xr(x,"base58btc")}y(Qt,"publicKeyToDid");var rn={verify:y(async function(t,f,c,x=xe,A=Wt){return er.subtle.verify({name:Ce,saltLength:Rr},typeof c=="string"?await Zt(c,A,"signing"):c,en(f),Be(t,x))},"rsaVerify"),sign:y(async function(t,f,c=xe){return er.subtle.sign({name:Ce,saltLength:Rr},f,Be(t,c))},"sign"),encrypt:y(async function(t,f,c=xe,x=Wt){let A;return typeof f=="string"?A=await Zt(f,x,"exchange"):A=f instanceof Uint8Array?await Zt(Tr(f),x,"exchange"):f,er.subtle.encrypt({name:_e},A,Be(t,c))},"rsaEncrypt"),decrypt:y(async function(t,f){let c=ke(f)?f:await Xi(f,["decrypt"]),x;typeof t=="string"?x=Hr(t,"base64pad"):x=t;let A=await er.subtle.decrypt({name:_e},c,x instanceof Uint8Array?Tr(x):x);return new Uint8Array(A)},"rsaDecrypt")};async function zi({message:n,publicKey:t,signature:f}){return rn.verify(n,f,await er.subtle.importKey("spki",Tr(t),{name:Ce,hash:Vt},!1,["verify"]),8)}y(zi,"rsaVerify");async function Zt(n,t,f){ji(f);let c=f==="exchange"?_e:Ce,x=f==="exchange"?["encrypt"]:["verify"],A=typeof n=="string"?Gr(Fi(n)):n;return er.subtle.importKey("spki",A,{name:c,hash:{name:t}},!0,x)}y(Zt,"importPublicKey");var Oi=new Error("Invalid key use. Please use 'encryption' or 'signing"),Yi=new Error("Max must be less than 256 and greater than 0");function ji(n){Hi(n,["signing","exchange"],Oi)}y(ji,"checkValidKeyUse");function Hi(n,t,f){if(!t.some(x=>x===n))throw f}y(Hi,"checkValid");function Fi(n){return n.replace(`-----BEGIN PUBLIC KEY-----
2
2
  `,"").replace(`
3
- -----END PUBLIC KEY-----`,"")}y(ji,"stripKeyHeader");function Fe(n){return je(n,"base64pad").buffer}y(Fe,"base64ToArrBuf");var Cr=y((n,t)=>{if(typeof n=="string")return t(n);if(typeof n=="object"&&n.byteLength!==void 0)return new Uint8Array(n).buffer;throw new Error("Improper value. Must be a string, ArrayBuffer, Uint8Array")},"normalizeToBuf");function Jt(n){return Cr(n,Fe)}y(Jt,"normalizeBase64ToBuf");var Hi=y(n=>Cr(n,t=>rf(t,8)),"normalizeUtf8ToBuf");function rf(n,t){let f=t===8?new Uint8Array(n.length):new Uint16Array(n.length);for(let c=0,x=n.length;c<x;c++)f[c]=n.charCodeAt(c);return f.buffer}y(rf,"strToArrBuf");var Fi=y(n=>Cr(n,t=>rf(t,16)),"normalizeUtf16ToBuf");function _r(n,t){switch(t){case 8:return Hi(n);default:return Fi(n)}}y(_r,"normalizeUnicodeToBuf");function Gi(n,t){return re.subtle.importKey("spki",n,{name:Ur,hash:Ht},!1,t)}y(Gi,"importRsaKey");function Xr(n){return kt(n,"algorithm")&&kt(n,"extractable")&&kt(n,"type")}y(Xr,"isCryptoKey");function kt(n,t){return typeof n=="object"&&n!=null&&t in n}y(kt,"hasProp");async function ur(n){return n instanceof CryptoKey?await re.subtle.exportKey("spki",n):await re.subtle.exportKey("spki",n.publicKey)}y(ur,"getPublicKeyAsArrayBuffer");function tf(n){if(!n.startsWith(jr))throw new Error("Please use a base58-encoded DID formatted `did:key:z...`");let t=""+n.substring(jr.length),f=je(t,"base58btc"),{keyBuffer:c,type:x}=Vi(f);return{publicKey:new Uint8Array(c),type:x}}y(tf,"didToPublicKey");function Vi(n){if($t(n,Ft))return{keyBuffer:n.slice(Ft.byteLength),type:Hr.RSA};if($t(n,Xt))return{keyBuffer:n.slice(Xt.byteLength),type:Hr.Edwards};if($t(n,Vt))return{keyBuffer:n.slice(Vt.byteLength),type:Hr.BLS};throw new Error("Unsupported key algorithm. Try using RSA.")}y(Vi,"parseMagicBytes");var Xi={equal:y((n,t)=>{let f=new Uint8Array(n),c=new Uint8Array(t);if(f.length!==c.length)return!1;for(let x=0;x<f.length;x++)if(f[x]!==c[x])return!1;return!0},"equal")};function $t(n,t){return Xi.equal(t,n.slice(0,t.byteLength))}y($t,"hasPrefix");function Ie(n){return ye(n instanceof ArrayBuffer?new Uint8Array(n):n,"base64pad")}y(Ie,"toBase64");async function Qt(n,t){let f=typeof n=="string"?Fe(n):n;return re.subtle.importKey("raw",f,{name:t?.alg||He,length:t?.length||qe},!0,["encrypt","decrypt"])}y(Qt,"importKey");function nf(n,{max:t}={max:255}){if(t<1||t>255)throw zi;let f=new Uint8Array(n);if(t===255)return re.getRandomValues(f),f.buffer;let c=0,x=t+1,m=Math.floor(256/x)*x,U=new Uint8Array(1);for(;c<f.length;)re.getRandomValues(U),U[0]<m&&(f[c]=U[0]%x,c++);return f.buffer}y(nf,"randomBuf");function Wr(n,t){let f=new Uint8Array(n),c=new Uint8Array(t),x=new Uint8Array(f.length+c.length);return x.set(f),x.set(c,f.length),x.buffer}y(Wr,"joinBufs");var os=new Error("Key does not exist. Make sure you properly instantiated the keystore."),as=new Error("Retrieved a symmetric key when an asymmetric keypair was expected. Please use a different key name."),ss=new Error("Retrieved an asymmetric keypair when an symmetric key was expected. Please use a different key name."),cs=new Error("ECC is not enabled for this browser. Please use RSA instead."),ys=new Error("Cryptosystem not supported. Please use ECC or RSA"),Wi=new Error("Invalid key use. Please use 'exchange' or 'write'"),xs=new Error("Max must be less than 256 and greater than 0");function ff(n){ki(n,["exchange","write","signing"],Wi)}y(ff,"checkValidKeyUse");function ki(n,t,f){if(!t.some(x=>x===n))throw f}y(ki,"checkValid");function kr(n){return new Promise((t,f)=>{n.oncomplete=n.onsuccess=()=>t(n.result),n.onabort=n.onerror=()=>f(n.error)})}y(kr,"promisifyRequest");function $i(n,t){let f,c=y(()=>{if(f)return f;let x=indexedDB.open(n);return x.onupgradeneeded=()=>x.result.createObjectStore(t),f=kr(x),f.then(m=>{m.onclose=()=>f=void 0},()=>{}),f},"getDB");return(x,m)=>c().then(U=>m(U.transaction(t,x).objectStore(t)))}y($i,"createStore");var en;function rn(){return en||(en=$i("keyval-store","keyval")),en}y(rn,"defaultGetStore");function tn(n,t=rn()){return t("readonly",f=>kr(f.get(n)))}y(tn,"get");function nn(n,t,f=rn()){return f("readwrite",c=>(c.put(t,n),kr(c.transaction)))}y(nn,"set");function of(n,t=rn()){return t("readwrite",f=>(n.forEach(c=>f.delete(c)),kr(f.transaction)))}y(of,"delMany");var Je={create(n={alg:He,length:qe}){let t=n.length||qe,f=n.alg||He;return re.subtle.generateKey({name:f,length:t},!0,["encrypt","decrypt"])},export:Object.assign(async n=>{let t=await re.subtle.exportKey("raw",n);return new Uint8Array(t)},{asString:y(async(n,t)=>{let f=await Je.export(n);return t?ye(f,t):Ie(f)},"asString")}),import(n){return fn(typeof n=="string"?Fe(n):n)},async exportAsString(n){let t=await Je.export(n);return Ie(t)},encrypt:Zi,async decrypt(n,t,f){let c=Xr(t)?t:await fn(t),x=f?await re.subtle.decrypt({name:xr,iv:f},c,typeof n=="string"?je(n):n):await Ji(n,c);return new Uint8Array(x)}};function fn(n,t){return re.subtle.importKey("raw",n,{name:xr,length:t||256},!0,["encrypt","decrypt"])}y(fn,"importAesKey");async function Zi(n,t,f,c){let x=Xr(t)?t:await fn(t),m=c?await re.subtle.encrypt({name:xr,iv:c},x,n):await qi(n,x);return f&&f==="arraybuffer"?m:new Uint8Array(m)}y(Zi,"encrypt");async function qi(n,t,f){let c=_r(n,f?.charsize??yr),x=typeof t=="string"?await Qt(t,f):t,m=f?.iv||nf(Xe),U=await re.subtle.encrypt({name:xr,iv:m},x,c);return Wr(m,U)}y(qi,"encryptBytes");async function Ji(n,t,f){let c=Jt(n),x=typeof t=="string"?await Qt(t,f):t,m=c.slice(0,Xe),U=c.slice(Xe);return await re.subtle.decrypt({name:He,iv:m},x,U)}y(Ji,"decryptBytes");var We=class We{constructor(t){O(this,"DID");O(this,"exchangeKey");O(this,"writeKey");O(this,"hasPersisted");O(this,"isSessionOnly");let{keys:f}=t;this.DID=t.did,this.exchangeKey=f.exchange,this.writeKey=f.write,this.hasPersisted=t.hasPersisted,this.isSessionOnly=!!t.isSessionOnly}publicExchangeKeyAsString(t){return this.publicExchangeKey.asString(t)}publicWriteKeyAsString(t){return this.publicWriteKey.asString(t)}get publicWriteKey(){let t=this.writeKey.publicKey;return Object.assign(t,{asString:y(async f=>{let c=await ur(this.writeKey),x=new Uint8Array(c);return f?ye(x,f):Ie(x)},"asString")})}get publicExchangeKey(){let t=this.exchangeKey.publicKey;return Object.assign(t,{asString:y(async f=>{let c=await ur(this.exchangeKey),x=new Uint8Array(c);return f?ye(x,f):Ie(x)},"asString")})}get privateWriteKey(){return this.writeKey.privateKey}get privateExchangeKey(){return this.exchangeKey.privateKey}get deviceName(){return We.deviceName(this.DID)}static deviceName(t){return Qi(t)}async persist(){if(this.isSessionOnly)return;let t=this.constructor.EXCHANGE_KEY_NAME,f=this.constructor.WRITE_KEY_NAME;await Promise.all([nn(t,this.exchangeKey),nn(f,this.writeKey)]),this.hasPersisted=!0}async delete(){await of([this.constructor.EXCHANGE_KEY_NAME,this.constructor.WRITE_KEY_NAME]),this.hasPersisted=!1}async getDeviceName(){return We.deviceName(this.DID)}static _createExchangeKeys(){throw new Error("The child should implement this")}static _createWriteKeys(){throw new Error("The child should implement this")}static async create(t){let f=await this._createExchangeKeys(),c=await this._createWriteKeys(),x=await ur(c),m=await Zt(new Uint8Array(x),this.TYPE==="ecc"?"ed25519":"rsa"),U=new this({keys:{exchange:f,write:c},did:m,hasPersisted:!1,isSessionOnly:!!t});return this._instance=U,U}static async load(t={session:!1}){if(this._instance)return this._instance;let f=!0,c=await tn(t.encryptionKeyName||this.EXCHANGE_KEY_NAME),x=await tn(t.signingKeyName||this.WRITE_KEY_NAME);c||(f=!1,c=await this._createExchangeKeys()),x||(f=!1,x=await this._createWriteKeys());let m=await ur(x),U=await Zt(new Uint8Array(m),this.TYPE==="ecc"?"ed25519":"rsa"),X=new this({keys:{exchange:c,write:x},did:U,hasPersisted:f,isSessionOnly:!!t.session});return this._instance=X,X}};y(We,"AbstractKeys"),O(We,"EXCHANGE_KEY_NAME"),O(We,"WRITE_KEY_NAME"),O(We,"_instance");var $r=We;async function af(n,t){let{content:f,publicKey:c}=n,x=t||await Je.create(),m=await Je.encrypt(typeof f=="string"?je(f):f,typeof x=="string"?await Je.import(x):x),U=await on({key:x,publicKey:c});return Wr(U,m)}y(af,"encryptTo");af.asString=async function(n,t){let f=await af(n,t);return ye(new Uint8Array(f),"base64pad")};async function on({key:n,publicKey:t},f){let c;n instanceof CryptoKey?c=await Je.export(n):c=n;let x=await qt.encrypt(c,t);return f&&f==="arraybuffer"?x:new Uint8Array(x)}y(on,"encryptKeyTo");on.asString=async function({key:n,publicKey:t},f){let c=await on({key:n,publicKey:t});return f?ye(c,f):Ie(c)};async function Qi(n){let t=await ef(new TextEncoder().encode(n.normalize("NFD")));return ye(t,"base32").slice(0,32)}y(Qi,"getDeviceName");var Ue=class Ue extends $r{constructor(t){super(t),Ue.EXCHANGE_KEY_NAME=t.exchangeKeyName||Fr,Ue.WRITE_KEY_NAME=t.writeKeyName||Gr}get publicExchangeKey(){let t=this.exchangeKey.publicKey;return Object.assign(t,{asString:y(async f=>{let c=await an(this.exchangeKey),x=new Uint8Array(c);return f?ye(x,f):Ie(c)},"asString")})}get publicWriteKey(){let t=this.writeKey.publicKey;return Object.assign(t,{asString:y(async f=>{let c=await an(this.writeKey),x=new Uint8Array(c);return f?ye(x,f):Ie(c)},"asString")})}static async _createExchangeKeys(){return await re.subtle.generateKey({name:kn},!1,["deriveKey","deriveBits"])}static async _createWriteKeys(){return await re.subtle.generateKey({name:Wn},!1,["sign","verify"])}static async load(t={session:!1}){if(this._instance)return this._instance;let f=t.encryptionKeyName||Fr,c=t.signingKeyName||Gr;return super.load({...t,encryptionKeyName:f,signingKeyName:c})}async toJson(t){let f=this.DID,c=await an(this.exchangeKey);return{publicExchangeKey:t?ye(new Uint8Array(c),t):Ie(c),DID:f}}async encrypt(t,f,c,x,m){let U=new TextEncoder,X=crypto.getRandomValues(new Uint8Array(Ne)),ne=f||this.exchangeKey.publicKey,ue;typeof ne=="string"?ue=await qr(ne,"X25519","exchange"):ue=ne;let Ae=x||await Zr(this.exchangeKey.privateKey,ue,X,c||Ue.INFO,m);Ae instanceof CryptoKey||(Ae=await Zr(this.exchangeKey.privateKey,ue,X,c||Ue.INFO));let Pe=crypto.getRandomValues(new Uint8Array(Xe)),Re=typeof t=="string"?U.encode(t):t,er=await crypto.subtle.encrypt({name:He,iv:Pe},Ae,Re),$=new Uint8Array(X),se=new Uint8Array(Pe),Ke=new Uint8Array(er),we=$.length+se.length+Ke.length,de=new Uint8Array(we);return de.set($,0),de.set(se,$.length),de.set(Ke,$.length+se.length),de}async encryptAsString(t,f,c,x,m){let U=await this.encrypt(t,f,c||Ue.INFO,x,m);return ye(new Uint8Array(U),"base64pad")}async decrypt(t,f,c,x){let m=typeof f=="string"?await qr(f,"X25519","write"):f;m||(m=this.publicExchangeKey);let U=Cr(t,Fe),X=U.slice(0,Ne),ne=U.slice(Ne,Ne+Xe),ue=U.slice(Ne+Xe),{privateKey:Ae}=this.exchangeKey,Pe=await Zr(Ae,m,X,x||Ue.INFO);return await crypto.subtle.decrypt({name:c||He,iv:ne},Pe,ue)}async decryptAsString(t,f,c,x){let m=await this.decrypt(t,f,c,x);return ye(new Uint8Array(m))}async getAesKey(t,f){t||(t=this.publicExchangeKey);let c;typeof t=="string"?c=await qr(t,"X25519","exchange"):c=t;let x=crypto.getRandomValues(new Uint8Array(Ne));return await Zr(this.exchangeKey.privateKey,c,x,f||Ue.INFO)}async sign(t,f){let c=new TextEncoder,x;typeof t=="string"?x=c.encode(t):t instanceof ArrayBuffer?x=new Uint8Array(t):x=t;let m=await re.subtle.sign({name:vr},this.writeKey.privateKey,x);return new Uint8Array(m)}async signAsString(t,f){let c=await this.sign(t,f);return ye(c,"base64pad")}};y(Ue,"EccKeys"),O(Ue,"TYPE","ecc"),O(Ue,"EXCHANGE_KEY_NAME",Fr),O(Ue,"WRITE_KEY_NAME",Gr),O(Ue,"INFO","keys");var Qe=Ue;Object.assign(Qe.prototype.sign,{asString:y(async function(n,t){let f=await this.sign(n,t);return ye(f,"base64pad")},"asString")});async function an(n){return await re.subtle.exportKey("raw",n.publicKey)}y(an,"exportPublicKey");async function qr(n,t,f){ff(f);let c=f==="exchange"?Xn:vr,x=f==="exchange"?[]:["verify"],m=Fe(n),U=t==="X25519"?{name:c}:{name:c,namedCurve:t};return re.subtle.importKey("raw",m,U,!0,x)}y(qr,"importPublicKey");var Ys={EccKeys:Qe,importPublicKey:qr};Object.assign(Qe.prototype.encrypt,{asString:y(async function(n,t,f,c,x){return this.encryptAsString(n,t,f,c,x)},"asString")});Object.assign(Qe.prototype.decrypt,{asString:y(async function(n,t,f){return this.decryptAsString(n,t,f)},"asString")});Object.assign(Qe.prototype.sign,{asString:y(async function(n,t){return this.signAsString(n,t)},"asString")});async function js(n,t,f){try{let c=tf(f);if(c.type!=="ed25519")throw new Error(`Expected Ed25519 key for ECC verification, got ${c.type}`);let x=c.publicKey.slice(-32),m=await re.subtle.importKey("raw",x,{name:vr},!0,["verify"]),U=new TextEncoder,X;typeof n=="string"?X=U.encode(n):n instanceof ArrayBuffer?X=new Uint8Array(n):X=n;let ne;return typeof t=="string"?ne=new Uint8Array(Fe(t)):ne=t,await re.subtle.verify({name:vr},m,ne,X)}catch{return!1}}y(js,"verify");async function Zr(n,t,f,c,x){let m=new TextEncoder,U=await crypto.subtle.deriveBits({name:"X25519",public:t},n,256),X=await crypto.subtle.importKey("raw",U,"HKDF",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:f,info:m.encode(c)},X,{name:"AES-GCM",length:x||qe},!1,["encrypt","decrypt"])}y(Zr,"deriveKey");export{Qe as EccKeys,Ys as default,an as exportPublicKey,qr as importPublicKey,js as verify};
3
+ -----END PUBLIC KEY-----`,"")}y(Fi,"stripKeyHeader");function Gr(n){let t=Hr(n,"base64pad");return Tr(t)}y(Gr,"base64ToArrBuf");var Pe=y((n,t)=>{if(typeof n=="string")return t(n);if(typeof n=="object"&&n.byteLength!==void 0)return new Uint8Array(n).buffer;throw new Error("Improper value. Must be a string, ArrayBuffer, Uint8Array")},"normalizeToBuf");function en(n){return Pe(n,Gr)}y(en,"normalizeBase64ToBuf");var Gi=y(n=>Pe(n,t=>ff(t,8)),"normalizeUtf8ToBuf");function ff(n,t){let f=t===8?new Uint8Array(n.length):new Uint16Array(n.length);for(let c=0,x=n.length;c<x;c++)f[c]=n.charCodeAt(c);return f.buffer}y(ff,"strToArrBuf");var Vi=y(n=>Pe(n,t=>ff(t,16)),"normalizeUtf16ToBuf");function Be(n,t){switch(t){case 8:return Gi(n);default:return Vi(n)}}y(Be,"normalizeUnicodeToBuf");function Xi(n,t){return er.subtle.importKey("spki",n instanceof Uint8Array?Tr(n):n,{name:_e,hash:Vt},!1,t)}y(Xi,"importRsaKey");function ke(n){return qt(n,"algorithm")&&qt(n,"extractable")&&qt(n,"type")}y(ke,"isCryptoKey");function qt(n,t){return typeof n=="object"&&n!=null&&t in n}y(qt,"hasProp");async function pe(n){return n instanceof CryptoKey?await er.subtle.exportKey("spki",n):await er.subtle.exportKey("spki",n.publicKey)}y(pe,"getPublicKeyAsArrayBuffer");function of(n){if(!n.startsWith(Ge))throw new Error("Please use a base58-encoded DID formatted `did:key:z...`");let t=""+n.substring(Ge.length),f=Hr(t,"base58btc"),{keyBuffer:c,type:x}=Wi(Tr(f));return{publicKey:new Uint8Array(c),type:x}}y(of,"didToPublicKey");function Wi(n){if(Jt(n,Tr(Xt)))return{keyBuffer:n.slice(Xt.byteLength),type:Ve.RSA};if(Jt(n,Tr(kt)))return{keyBuffer:n.slice(kt.byteLength),type:Ve.Edwards};if(Jt(n,Tr($t)))return{keyBuffer:n.slice($t.byteLength),type:Ve.BLS};throw new Error("Unsupported key algorithm. Try using RSA.")}y(Wi,"parseMagicBytes");var $i={equal:y((n,t)=>{let f=new Uint8Array(n),c=new Uint8Array(t);if(f.length!==c.length)return!1;for(let x=0;x<f.length;x++)if(f[x]!==c[x])return!1;return!0},"equal")};function Jt(n,t){return $i.equal(t,n.slice(0,t.byteLength))}y(Jt,"hasPrefix");function Lr(n){return xr(n instanceof ArrayBuffer?new Uint8Array(n):n,"base64pad")}y(Lr,"toBase64");async function tn(n,t){let f=typeof n=="string"?Gr(n):Tr(n);return er.subtle.importKey("raw",f,{name:t?.alg||Fr,length:t?.length||Jr},!0,["encrypt","decrypt"])}y(tn,"importKey");function af(n,{max:t}={max:255}){if(t<1||t>255)throw Yi;let f=new Uint8Array(n);if(t===255)return er.getRandomValues(f),f.buffer;let c=0,x=t+1,A=Math.floor(256/x)*x,_=new Uint8Array(1);for(;c<f.length;)er.getRandomValues(_),_[0]<A&&(f[c]=_[0]%x,c++);return f.buffer}y(af,"randomBuf");function Ze(n,t){let f=n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(Tr(n)),c=t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(Tr(t)),x=new Uint8Array(f.length+c.length);return x.set(f),x.set(c,f.length),x.buffer}y(Ze,"joinBufs");var ss=new Error("Key does not exist. Make sure you properly instantiated the keystore."),cs=new Error("Retrieved a symmetric key when an asymmetric keypair was expected. Please use a different key name."),ys=new Error("Retrieved an asymmetric keypair when an symmetric key was expected. Please use a different key name."),xs=new Error("ECC is not enabled for this browser. Please use RSA instead."),us=new Error("Cryptosystem not supported. Please use ECC or RSA"),ki=new Error("Invalid key use. Please use 'exchange' or 'write'"),ps=new Error("Max must be less than 256 and greater than 0");function sf(n){Zi(n,["exchange","write","signing"],ki)}y(sf,"checkValidKeyUse");function Zi(n,t,f){if(!t.some(x=>x===n))throw f}y(Zi,"checkValid");function qe(n){return new Promise((t,f)=>{n.oncomplete=n.onsuccess=()=>t(n.result),n.onabort=n.onerror=()=>f(n.error)})}y(qe,"promisifyRequest");function qi(n,t){let f,c=y(()=>{if(f)return f;let x=indexedDB.open(n);return x.onupgradeneeded=()=>x.result.createObjectStore(t),f=qe(x),f.then(A=>{A.onclose=()=>f=void 0},()=>{}),f},"getDB");return(x,A)=>c().then(_=>A(_.transaction(t,x).objectStore(t)))}y(qi,"createStore");var nn;function fn(){return nn||(nn=qi("keyval-store","keyval")),nn}y(fn,"defaultGetStore");function on(n,t=fn()){return t("readonly",f=>qe(f.get(n)))}y(on,"get");function an(n,t,f=fn()){return f("readwrite",c=>(c.put(t,n),qe(c.transaction)))}y(an,"set");function cf(n,t=fn()){return t("readwrite",f=>(n.forEach(c=>f.delete(c)),qe(f.transaction)))}y(cf,"delMany");function he(n){return new Uint8Array(n).buffer}y(he,"toArrayBuffer");var Qr={create(n={alg:Fr,length:Jr}){let t=n.length||Jr,f=n.alg||Fr;return er.subtle.generateKey({name:f,length:t},!0,["encrypt","decrypt"])},export:Object.assign(async n=>{let t=await er.subtle.exportKey("raw",n);return new Uint8Array(t)},{asString:y(async(n,t)=>{let f=await Qr.export(n);return t?xr(f,t):Lr(f)},"asString")}),import(n){return sn(typeof n=="string"?Gr(n):n)},async exportAsString(n){let t=await Qr.export(n);return Lr(t)},encrypt:Ji,async decrypt(n,t,f){let c=ke(t)?t:await sn(t),x=f?await er.subtle.decrypt({name:ue,iv:he(f)},c,typeof n=="string"?he(Hr(n)):n instanceof Uint8Array?he(n):n):await ro(n,c);return new Uint8Array(x)}};function sn(n,t){return er.subtle.importKey("raw",n instanceof Uint8Array?he(n):n,{name:ue,length:t||256},!0,["encrypt","decrypt"])}y(sn,"importAesKey");async function Ji(n,t,f,c){let x=ke(t)?t:await sn(t),A=c?await er.subtle.encrypt({name:ue,iv:he(c)},x,he(n)):await Qi(n,x);return f&&f==="arraybuffer"?A:new Uint8Array(A)}y(Ji,"encrypt");async function Qi(n,t,f){let c=Be(n,f?.charsize??xe),x=typeof t=="string"?await tn(t,f):t,A=f?.iv||af(Wr),_=await er.subtle.encrypt({name:ue,iv:A},x,c);return Ze(A,_)}y(Qi,"encryptBytes");async function ro(n,t,f){let c=en(n),x=typeof t=="string"?await tn(t,f):t,A=c.slice(0,Wr),_=c.slice(Wr);return await er.subtle.decrypt({name:Fr,iv:A},x,_)}y(ro,"decryptBytes");var $r=class $r{constructor(t){O(this,"DID");O(this,"exchangeKey");O(this,"writeKey");O(this,"hasPersisted");O(this,"isSessionOnly");let{keys:f}=t;this.DID=t.did,this.exchangeKey=f.exchange,this.writeKey=f.write,this.hasPersisted=t.hasPersisted,this.isSessionOnly=!!t.isSessionOnly}publicExchangeKeyAsString(t){return this.publicExchangeKey.asString(t)}publicWriteKeyAsString(t){return this.publicWriteKey.asString(t)}get publicWriteKey(){let t=this.writeKey.publicKey;return Object.assign(t,{asString:y(async f=>{let c=await pe(this.writeKey),x=new Uint8Array(c);return f?xr(x,f):Lr(x)},"asString")})}get publicExchangeKey(){let t=this.exchangeKey.publicKey;return Object.assign(t,{asString:y(async f=>{let c=await pe(this.exchangeKey),x=new Uint8Array(c);return f?xr(x,f):Lr(x)},"asString")})}get privateWriteKey(){return this.writeKey.privateKey}get privateExchangeKey(){return this.exchangeKey.privateKey}get deviceName(){return $r.deviceName(this.DID)}static deviceName(t){return eo(t)}async persist(){if(this.isSessionOnly)return;let t=this.constructor.EXCHANGE_KEY_NAME,f=this.constructor.WRITE_KEY_NAME;await Promise.all([an(t,this.exchangeKey),an(f,this.writeKey)]),this.hasPersisted=!0}async delete(){await cf([this.constructor.EXCHANGE_KEY_NAME,this.constructor.WRITE_KEY_NAME]),this.hasPersisted=!1}async getDeviceName(){return $r.deviceName(this.DID)}static _createExchangeKeys(){throw new Error("The child should implement this")}static _createWriteKeys(){throw new Error("The child should implement this")}static async create(t){let f=await this._createExchangeKeys(),c=await this._createWriteKeys(),x=await pe(c),A=await Qt(new Uint8Array(x),this.TYPE==="ecc"?"ed25519":"rsa"),_=new this({keys:{exchange:f,write:c},did:A,hasPersisted:!1,isSessionOnly:!!t});return this._instance=_,_}static async load(t={session:!1}){if(this._instance)return this._instance;let f=!0,c=await on(t.encryptionKeyName||this.EXCHANGE_KEY_NAME),x=await on(t.signingKeyName||this.WRITE_KEY_NAME);c||(f=!1,c=await this._createExchangeKeys()),x||(f=!1,x=await this._createWriteKeys());let A=await pe(x),_=await Qt(new Uint8Array(A),this.TYPE==="ecc"?"ed25519":"rsa"),G=new this({keys:{exchange:c,write:x},did:_,hasPersisted:f,isSessionOnly:!!t.session});return this._instance=G,G}};y($r,"AbstractKeys"),O($r,"EXCHANGE_KEY_NAME"),O($r,"WRITE_KEY_NAME"),O($r,"_instance");var Je=$r;async function yf(n,t){let{content:f,publicKey:c}=n,x=t||await Qr.create(),A=await Qr.encrypt(typeof f=="string"?Hr(f):f,typeof x=="string"?await Qr.import(x):x),_=await cn({key:x,publicKey:c});return Ze(_,A)}y(yf,"encryptTo");yf.asString=async function(n,t){let f=await yf(n,t);return xr(new Uint8Array(f),"base64pad")};async function cn({key:n,publicKey:t},f){let c;n instanceof CryptoKey?c=await Qr.export(n):c=n;let x=await rn.encrypt(c,t);return f&&f==="arraybuffer"?x:new Uint8Array(x)}y(cn,"encryptKeyTo");cn.asString=async function({key:n,publicKey:t},f){let c=await cn({key:n,publicKey:t});return f?xr(c,f):Lr(c)};async function eo(n){let t=await nf(new TextEncoder().encode(n.normalize("NFD")));return xr(t,"base32").slice(0,32)}y(eo,"getDeviceName");function Te(n){return new Uint8Array(n).buffer}y(Te,"toArrayBuffer");var Sr=class Sr extends Je{constructor(t){super(t),Sr.EXCHANGE_KEY_NAME=t.exchangeKeyName||Xe,Sr.WRITE_KEY_NAME=t.writeKeyName||We}get publicExchangeKey(){let t=this.exchangeKey.publicKey;return Object.assign(t,{asString:y(async f=>{let c=await yn(this.exchangeKey),x=new Uint8Array(c);return f?xr(x,f):Lr(c)},"asString")})}get publicWriteKey(){let t=this.writeKey.publicKey;return Object.assign(t,{asString:y(async f=>{let c=await yn(this.writeKey),x=new Uint8Array(c);return f?xr(x,f):Lr(c)},"asString")})}static async _createExchangeKeys(){return await er.subtle.generateKey({name:qn},!1,["deriveKey","deriveBits"])}static async _createWriteKeys(){return await er.subtle.generateKey({name:Zn},!1,["sign","verify"])}static async load(t={session:!1}){if(this._instance)return this._instance;let f=t.encryptionKeyName||Xe,c=t.signingKeyName||We;return super.load({...t,encryptionKeyName:f,signingKeyName:c})}async toJson(t){let f=this.DID,c=await yn(this.exchangeKey);return{publicExchangeKey:t?xr(new Uint8Array(c),t):Lr(c),DID:f}}async encrypt(t,f,c,x,A){let _=new TextEncoder,G=crypto.getRandomValues(new Uint8Array(Rr)),nr=f||this.exchangeKey.publicKey,gr;typeof nr=="string"?gr=await rt(nr,"X25519","exchange"):gr=nr;let sr=x||await Qe(this.exchangeKey.privateKey,gr,G,c||Sr.INFO,A);sr instanceof CryptoKey||(sr=await Qe(this.exchangeKey.privateKey,gr,G,c||Sr.INFO));let Kr=crypto.getRandomValues(new Uint8Array(Wr)),zr=typeof t=="string"?_.encode(t):t,ee=await crypto.subtle.encrypt({name:Fr,iv:Kr},sr,Te(zr)),k=new Uint8Array(G),cr=new Uint8Array(Kr),vr=new Uint8Array(ee),wr=k.length+cr.length+vr.length,dr=new Uint8Array(wr);return dr.set(k,0),dr.set(cr,k.length),dr.set(vr,k.length+cr.length),dr}async encryptAsString(t,f,c,x,A){let _=await this.encrypt(t,f,c||Sr.INFO,x,A);return xr(new Uint8Array(_),"base64pad")}async decrypt(t,f,c,x){let A=typeof f=="string"?await rt(f,"X25519","write"):f;A||(A=this.publicExchangeKey);let _=Pe(t,Gr),G=_.slice(0,Rr),nr=_.slice(Rr,Rr+Wr),gr=_.slice(Rr+Wr),{privateKey:sr}=this.exchangeKey,Kr=await Qe(sr,A,G,x||Sr.INFO);return await crypto.subtle.decrypt({name:c||Fr,iv:nr},Kr,gr)}async decryptAsString(t,f,c,x){let A=await this.decrypt(t,f,c,x);return xr(new Uint8Array(A))}async getAesKey(t,f){t||(t=this.publicExchangeKey);let c;typeof t=="string"?c=await rt(t,"X25519","exchange"):c=t;let x=crypto.getRandomValues(new Uint8Array(Rr));return await Qe(this.exchangeKey.privateKey,c,x,f||Sr.INFO)}async sign(t,f){let c=new TextEncoder,x;typeof t=="string"?x=c.encode(t):t instanceof ArrayBuffer?x=new Uint8Array(t):x=t;let A=await er.subtle.sign({name:Se},this.writeKey.privateKey,Te(x));return new Uint8Array(A)}async signAsString(t,f){let c=await this.sign(t,f);return xr(c,"base64pad")}};y(Sr,"EccKeys"),O(Sr,"TYPE","ecc"),O(Sr,"EXCHANGE_KEY_NAME",Xe),O(Sr,"WRITE_KEY_NAME",We),O(Sr,"INFO","keys");var re=Sr;Object.assign(re.prototype.sign,{asString:y(async function(n,t){let f=await this.sign(n,t);return xr(f,"base64pad")},"asString")});async function yn(n){return await er.subtle.exportKey("raw",n.publicKey)}y(yn,"exportPublicKey");async function rt(n,t,f){sf(f);let c=f==="exchange"?kn:Se,x=f==="exchange"?[]:["verify"],A=Gr(n),_=t==="X25519"?{name:c}:{name:c,namedCurve:t};return er.subtle.importKey("raw",A,_,!0,x)}y(rt,"importPublicKey");var Hs={EccKeys:re,importPublicKey:rt};Object.assign(re.prototype.encrypt,{asString:y(async function(n,t,f,c,x){return this.encryptAsString(n,t,f,c,x)},"asString")});Object.assign(re.prototype.decrypt,{asString:y(async function(n,t,f){return this.decryptAsString(n,t,f)},"asString")});Object.assign(re.prototype.sign,{asString:y(async function(n,t){return this.signAsString(n,t)},"asString")});async function Fs(n,t,f){try{let c=of(f);if(c.type!=="ed25519")throw new Error(`Expected Ed25519 key for ECC verification, got ${c.type}`);let x=c.publicKey.slice(-32),A=await er.subtle.importKey("raw",x,{name:Se},!0,["verify"]),_=new TextEncoder,G;typeof n=="string"?G=_.encode(n):n instanceof ArrayBuffer?G=new Uint8Array(n):G=n;let nr;return typeof t=="string"?nr=new Uint8Array(Gr(t)):nr=t,await er.subtle.verify({name:Se},A,Te(nr),Te(G))}catch{return!1}}y(Fs,"verify");async function Qe(n,t,f,c,x){let A=new TextEncoder,_=await crypto.subtle.deriveBits({name:"X25519",public:t},n,256),G=await crypto.subtle.importKey("raw",_,"HKDF",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:f instanceof Uint8Array?Te(f):f,info:A.encode(c)},G,{name:"AES-GCM",length:x||Jr},!1,["encrypt","decrypt"])}y(Qe,"deriveKey");export{re as EccKeys,Hs as default,yn as exportPublicKey,rt as importPublicKey,Fs as verify};
4
4
  //# sourceMappingURL=index.min.js.map