@pelican-identity/vanilla 1.0.25 → 1.0.29

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.
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
- var ai=Object.create;var qr=Object.defineProperty;var ci=Object.getOwnPropertyDescriptor;var li=Object.getOwnPropertyNames;var ui=Object.getPrototypeOf,hi=Object.prototype.hasOwnProperty;var rr=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var rt=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var di=(n,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of li(e))!hi.call(n,l)&&l!==i&&qr(n,l,{get:()=>e[l],enumerable:!(a=ci(e,l))||a.enumerable});return n};var xi=(n,e,i)=>(i=n!=null?ai(ui(n)):{},di(!n||!n.__esModule?qr(i,"default",{value:n,enumerable:true}):i,n));var Yr=rt((bo,Ae)=>{(function(n){var e=function(r){var f,o=new Float64Array(16);if(r)for(f=0;f<r.length;f++)o[f]=r[f];return o},i=function(){throw new Error("no PRNG")},a=new Uint8Array(16),l=new Uint8Array(32);l[0]=9;var h=e(),g=e([1]),y=e([56129,1]),E=e([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),V=e([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),$=e([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),lt=e([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),it=e([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function mt(r,f,o,t){r[f]=o>>24&255,r[f+1]=o>>16&255,r[f+2]=o>>8&255,r[f+3]=o&255,r[f+4]=t>>24&255,r[f+5]=t>>16&255,r[f+6]=t>>8&255,r[f+7]=t&255;}function wt(r,f,o,t,s){var u,d=0;for(u=0;u<s;u++)d|=r[f+u]^o[t+u];return (1&d-1>>>8)-1}function vt(r,f,o,t){return wt(r,f,o,t,16)}function Lt(r,f,o,t){return wt(r,f,o,t,32)}function zt(r,f,o,t){for(var s=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,u=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,d=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,m=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,A=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,R=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,_=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,X=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,M=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,N=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,k=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,q=o[16]&255|(o[17]&255)<<8|(o[18]&255)<<16|(o[19]&255)<<24,O=o[20]&255|(o[21]&255)<<8|(o[22]&255)<<16|(o[23]&255)<<24,j=o[24]&255|(o[25]&255)<<8|(o[26]&255)<<16|(o[27]&255)<<24,D=o[28]&255|(o[29]&255)<<8|(o[30]&255)<<16|(o[31]&255)<<24,z=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,T=s,L=u,B=d,I=m,U=A,S=R,x=_,p=X,v=M,b=N,w=k,C=q,P=O,Y=j,K=D,F=z,c,W=0;W<20;W+=2)c=T+P|0,U^=c<<7|c>>>25,c=U+T|0,v^=c<<9|c>>>23,c=v+U|0,P^=c<<13|c>>>19,c=P+v|0,T^=c<<18|c>>>14,c=S+L|0,b^=c<<7|c>>>25,c=b+S|0,Y^=c<<9|c>>>23,c=Y+b|0,L^=c<<13|c>>>19,c=L+Y|0,S^=c<<18|c>>>14,c=w+x|0,K^=c<<7|c>>>25,c=K+w|0,B^=c<<9|c>>>23,c=B+K|0,x^=c<<13|c>>>19,c=x+B|0,w^=c<<18|c>>>14,c=F+C|0,I^=c<<7|c>>>25,c=I+F|0,p^=c<<9|c>>>23,c=p+I|0,C^=c<<13|c>>>19,c=C+p|0,F^=c<<18|c>>>14,c=T+I|0,L^=c<<7|c>>>25,c=L+T|0,B^=c<<9|c>>>23,c=B+L|0,I^=c<<13|c>>>19,c=I+B|0,T^=c<<18|c>>>14,c=S+U|0,x^=c<<7|c>>>25,c=x+S|0,p^=c<<9|c>>>23,c=p+x|0,U^=c<<13|c>>>19,c=U+p|0,S^=c<<18|c>>>14,c=w+b|0,C^=c<<7|c>>>25,c=C+w|0,v^=c<<9|c>>>23,c=v+C|0,b^=c<<13|c>>>19,c=b+v|0,w^=c<<18|c>>>14,c=F+K|0,P^=c<<7|c>>>25,c=P+F|0,Y^=c<<9|c>>>23,c=Y+P|0,K^=c<<13|c>>>19,c=K+Y|0,F^=c<<18|c>>>14;T=T+s|0,L=L+u|0,B=B+d|0,I=I+m|0,U=U+A|0,S=S+R|0,x=x+_|0,p=p+X|0,v=v+M|0,b=b+N|0,w=w+k|0,C=C+q|0,P=P+O|0,Y=Y+j|0,K=K+D|0,F=F+z|0,r[0]=T>>>0&255,r[1]=T>>>8&255,r[2]=T>>>16&255,r[3]=T>>>24&255,r[4]=L>>>0&255,r[5]=L>>>8&255,r[6]=L>>>16&255,r[7]=L>>>24&255,r[8]=B>>>0&255,r[9]=B>>>8&255,r[10]=B>>>16&255,r[11]=B>>>24&255,r[12]=I>>>0&255,r[13]=I>>>8&255,r[14]=I>>>16&255,r[15]=I>>>24&255,r[16]=U>>>0&255,r[17]=U>>>8&255,r[18]=U>>>16&255,r[19]=U>>>24&255,r[20]=S>>>0&255,r[21]=S>>>8&255,r[22]=S>>>16&255,r[23]=S>>>24&255,r[24]=x>>>0&255,r[25]=x>>>8&255,r[26]=x>>>16&255,r[27]=x>>>24&255,r[28]=p>>>0&255,r[29]=p>>>8&255,r[30]=p>>>16&255,r[31]=p>>>24&255,r[32]=v>>>0&255,r[33]=v>>>8&255,r[34]=v>>>16&255,r[35]=v>>>24&255,r[36]=b>>>0&255,r[37]=b>>>8&255,r[38]=b>>>16&255,r[39]=b>>>24&255,r[40]=w>>>0&255,r[41]=w>>>8&255,r[42]=w>>>16&255,r[43]=w>>>24&255,r[44]=C>>>0&255,r[45]=C>>>8&255,r[46]=C>>>16&255,r[47]=C>>>24&255,r[48]=P>>>0&255,r[49]=P>>>8&255,r[50]=P>>>16&255,r[51]=P>>>24&255,r[52]=Y>>>0&255,r[53]=Y>>>8&255,r[54]=Y>>>16&255,r[55]=Y>>>24&255,r[56]=K>>>0&255,r[57]=K>>>8&255,r[58]=K>>>16&255,r[59]=K>>>24&255,r[60]=F>>>0&255,r[61]=F>>>8&255,r[62]=F>>>16&255,r[63]=F>>>24&255;}function re(r,f,o,t){for(var s=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,u=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,d=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,m=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,A=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,R=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,_=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,X=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,M=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,N=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,k=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,q=o[16]&255|(o[17]&255)<<8|(o[18]&255)<<16|(o[19]&255)<<24,O=o[20]&255|(o[21]&255)<<8|(o[22]&255)<<16|(o[23]&255)<<24,j=o[24]&255|(o[25]&255)<<8|(o[26]&255)<<16|(o[27]&255)<<24,D=o[28]&255|(o[29]&255)<<8|(o[30]&255)<<16|(o[31]&255)<<24,z=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,T=s,L=u,B=d,I=m,U=A,S=R,x=_,p=X,v=M,b=N,w=k,C=q,P=O,Y=j,K=D,F=z,c,W=0;W<20;W+=2)c=T+P|0,U^=c<<7|c>>>25,c=U+T|0,v^=c<<9|c>>>23,c=v+U|0,P^=c<<13|c>>>19,c=P+v|0,T^=c<<18|c>>>14,c=S+L|0,b^=c<<7|c>>>25,c=b+S|0,Y^=c<<9|c>>>23,c=Y+b|0,L^=c<<13|c>>>19,c=L+Y|0,S^=c<<18|c>>>14,c=w+x|0,K^=c<<7|c>>>25,c=K+w|0,B^=c<<9|c>>>23,c=B+K|0,x^=c<<13|c>>>19,c=x+B|0,w^=c<<18|c>>>14,c=F+C|0,I^=c<<7|c>>>25,c=I+F|0,p^=c<<9|c>>>23,c=p+I|0,C^=c<<13|c>>>19,c=C+p|0,F^=c<<18|c>>>14,c=T+I|0,L^=c<<7|c>>>25,c=L+T|0,B^=c<<9|c>>>23,c=B+L|0,I^=c<<13|c>>>19,c=I+B|0,T^=c<<18|c>>>14,c=S+U|0,x^=c<<7|c>>>25,c=x+S|0,p^=c<<9|c>>>23,c=p+x|0,U^=c<<13|c>>>19,c=U+p|0,S^=c<<18|c>>>14,c=w+b|0,C^=c<<7|c>>>25,c=C+w|0,v^=c<<9|c>>>23,c=v+C|0,b^=c<<13|c>>>19,c=b+v|0,w^=c<<18|c>>>14,c=F+K|0,P^=c<<7|c>>>25,c=P+F|0,Y^=c<<9|c>>>23,c=Y+P|0,K^=c<<13|c>>>19,c=K+Y|0,F^=c<<18|c>>>14;r[0]=T>>>0&255,r[1]=T>>>8&255,r[2]=T>>>16&255,r[3]=T>>>24&255,r[4]=S>>>0&255,r[5]=S>>>8&255,r[6]=S>>>16&255,r[7]=S>>>24&255,r[8]=w>>>0&255,r[9]=w>>>8&255,r[10]=w>>>16&255,r[11]=w>>>24&255,r[12]=F>>>0&255,r[13]=F>>>8&255,r[14]=F>>>16&255,r[15]=F>>>24&255,r[16]=x>>>0&255,r[17]=x>>>8&255,r[18]=x>>>16&255,r[19]=x>>>24&255,r[20]=p>>>0&255,r[21]=p>>>8&255,r[22]=p>>>16&255,r[23]=p>>>24&255,r[24]=v>>>0&255,r[25]=v>>>8&255,r[26]=v>>>16&255,r[27]=v>>>24&255,r[28]=b>>>0&255,r[29]=b>>>8&255,r[30]=b>>>16&255,r[31]=b>>>24&255;}function Bt(r,f,o,t){zt(r,f,o,t);}function Tt(r,f,o,t){re(r,f,o,t);}var dt=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function J(r,f,o,t,s,u,d){var m=new Uint8Array(16),A=new Uint8Array(64),R,_;for(_=0;_<16;_++)m[_]=0;for(_=0;_<8;_++)m[_]=u[_];for(;s>=64;){for(Bt(A,m,d,dt),_=0;_<64;_++)r[f+_]=o[t+_]^A[_];for(R=1,_=8;_<16;_++)R=R+(m[_]&255)|0,m[_]=R&255,R>>>=8;s-=64,f+=64,t+=64;}if(s>0)for(Bt(A,m,d,dt),_=0;_<s;_++)r[f+_]=o[t+_]^A[_];return 0}function pt(r,f,o,t,s){var u=new Uint8Array(16),d=new Uint8Array(64),m,A;for(A=0;A<16;A++)u[A]=0;for(A=0;A<8;A++)u[A]=t[A];for(;o>=64;){for(Bt(d,u,s,dt),A=0;A<64;A++)r[f+A]=d[A];for(m=1,A=8;A<16;A++)m=m+(u[A]&255)|0,u[A]=m&255,m>>>=8;o-=64,f+=64;}if(o>0)for(Bt(d,u,s,dt),A=0;A<o;A++)r[f+A]=d[A];return 0}function Ht(r,f,o,t,s){var u=new Uint8Array(32);Tt(u,t,s,dt);for(var d=new Uint8Array(8),m=0;m<8;m++)d[m]=t[m+16];return pt(r,f,o,d,u)}function Oe(r,f,o,t,s,u,d){var m=new Uint8Array(32);Tt(m,u,d,dt);for(var A=new Uint8Array(8),R=0;R<8;R++)A[R]=u[R+16];return J(r,f,o,t,s,A,m)}var pe=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 f,o,t,s,u,d,m,A;f=r[0]&255|(r[1]&255)<<8,this.r[0]=f&8191,o=r[2]&255|(r[3]&255)<<8,this.r[1]=(f>>>13|o<<3)&8191,t=r[4]&255|(r[5]&255)<<8,this.r[2]=(o>>>10|t<<6)&7939,s=r[6]&255|(r[7]&255)<<8,this.r[3]=(t>>>7|s<<9)&8191,u=r[8]&255|(r[9]&255)<<8,this.r[4]=(s>>>4|u<<12)&255,this.r[5]=u>>>1&8190,d=r[10]&255|(r[11]&255)<<8,this.r[6]=(u>>>14|d<<2)&8191,m=r[12]&255|(r[13]&255)<<8,this.r[7]=(d>>>11|m<<5)&8065,A=r[14]&255|(r[15]&255)<<8,this.r[8]=(m>>>8|A<<8)&8191,this.r[9]=A>>>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;};pe.prototype.blocks=function(r,f,o){for(var t=this.fin?0:2048,s,u,d,m,A,R,_,X,M,N,k,q,O,j,D,z,T,L,B,I=this.h[0],U=this.h[1],S=this.h[2],x=this.h[3],p=this.h[4],v=this.h[5],b=this.h[6],w=this.h[7],C=this.h[8],P=this.h[9],Y=this.r[0],K=this.r[1],F=this.r[2],c=this.r[3],W=this.r[4],tt=this.r[5],et=this.r[6],H=this.r[7],Q=this.r[8],G=this.r[9];o>=16;)s=r[f+0]&255|(r[f+1]&255)<<8,I+=s&8191,u=r[f+2]&255|(r[f+3]&255)<<8,U+=(s>>>13|u<<3)&8191,d=r[f+4]&255|(r[f+5]&255)<<8,S+=(u>>>10|d<<6)&8191,m=r[f+6]&255|(r[f+7]&255)<<8,x+=(d>>>7|m<<9)&8191,A=r[f+8]&255|(r[f+9]&255)<<8,p+=(m>>>4|A<<12)&8191,v+=A>>>1&8191,R=r[f+10]&255|(r[f+11]&255)<<8,b+=(A>>>14|R<<2)&8191,_=r[f+12]&255|(r[f+13]&255)<<8,w+=(R>>>11|_<<5)&8191,X=r[f+14]&255|(r[f+15]&255)<<8,C+=(_>>>8|X<<8)&8191,P+=X>>>5|t,M=0,N=M,N+=I*Y,N+=U*(5*G),N+=S*(5*Q),N+=x*(5*H),N+=p*(5*et),M=N>>>13,N&=8191,N+=v*(5*tt),N+=b*(5*W),N+=w*(5*c),N+=C*(5*F),N+=P*(5*K),M+=N>>>13,N&=8191,k=M,k+=I*K,k+=U*Y,k+=S*(5*G),k+=x*(5*Q),k+=p*(5*H),M=k>>>13,k&=8191,k+=v*(5*et),k+=b*(5*tt),k+=w*(5*W),k+=C*(5*c),k+=P*(5*F),M+=k>>>13,k&=8191,q=M,q+=I*F,q+=U*K,q+=S*Y,q+=x*(5*G),q+=p*(5*Q),M=q>>>13,q&=8191,q+=v*(5*H),q+=b*(5*et),q+=w*(5*tt),q+=C*(5*W),q+=P*(5*c),M+=q>>>13,q&=8191,O=M,O+=I*c,O+=U*F,O+=S*K,O+=x*Y,O+=p*(5*G),M=O>>>13,O&=8191,O+=v*(5*Q),O+=b*(5*H),O+=w*(5*et),O+=C*(5*tt),O+=P*(5*W),M+=O>>>13,O&=8191,j=M,j+=I*W,j+=U*c,j+=S*F,j+=x*K,j+=p*Y,M=j>>>13,j&=8191,j+=v*(5*G),j+=b*(5*Q),j+=w*(5*H),j+=C*(5*et),j+=P*(5*tt),M+=j>>>13,j&=8191,D=M,D+=I*tt,D+=U*W,D+=S*c,D+=x*F,D+=p*K,M=D>>>13,D&=8191,D+=v*Y,D+=b*(5*G),D+=w*(5*Q),D+=C*(5*H),D+=P*(5*et),M+=D>>>13,D&=8191,z=M,z+=I*et,z+=U*tt,z+=S*W,z+=x*c,z+=p*F,M=z>>>13,z&=8191,z+=v*K,z+=b*Y,z+=w*(5*G),z+=C*(5*Q),z+=P*(5*H),M+=z>>>13,z&=8191,T=M,T+=I*H,T+=U*et,T+=S*tt,T+=x*W,T+=p*c,M=T>>>13,T&=8191,T+=v*F,T+=b*K,T+=w*Y,T+=C*(5*G),T+=P*(5*Q),M+=T>>>13,T&=8191,L=M,L+=I*Q,L+=U*H,L+=S*et,L+=x*tt,L+=p*W,M=L>>>13,L&=8191,L+=v*c,L+=b*F,L+=w*K,L+=C*Y,L+=P*(5*G),M+=L>>>13,L&=8191,B=M,B+=I*G,B+=U*Q,B+=S*H,B+=x*et,B+=p*tt,M=B>>>13,B&=8191,B+=v*W,B+=b*c,B+=w*F,B+=C*K,B+=P*Y,M+=B>>>13,B&=8191,M=(M<<2)+M|0,M=M+N|0,N=M&8191,M=M>>>13,k+=M,I=N,U=k,S=q,x=O,p=j,v=D,b=z,w=T,C=L,P=B,f+=16,o-=16;this.h[0]=I,this.h[1]=U,this.h[2]=S,this.h[3]=x,this.h[4]=p,this.h[5]=v,this.h[6]=b,this.h[7]=w,this.h[8]=C,this.h[9]=P;},pe.prototype.finish=function(r,f){var o=new Uint16Array(10),t,s,u,d;if(this.leftover){for(d=this.leftover,this.buffer[d++]=1;d<16;d++)this.buffer[d]=0;this.fin=1,this.blocks(this.buffer,0,16);}for(t=this.h[1]>>>13,this.h[1]&=8191,d=2;d<10;d++)this.h[d]+=t,t=this.h[d]>>>13,this.h[d]&=8191;for(this.h[0]+=t*5,t=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=t,t=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=t,o[0]=this.h[0]+5,t=o[0]>>>13,o[0]&=8191,d=1;d<10;d++)o[d]=this.h[d]+t,t=o[d]>>>13,o[d]&=8191;for(o[9]-=8192,s=(t^1)-1,d=0;d<10;d++)o[d]&=s;for(s=~s,d=0;d<10;d++)this.h[d]=this.h[d]&s|o[d];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,d=1;d<8;d++)u=(this.h[d]+this.pad[d]|0)+(u>>>16)|0,this.h[d]=u&65535;r[f+0]=this.h[0]>>>0&255,r[f+1]=this.h[0]>>>8&255,r[f+2]=this.h[1]>>>0&255,r[f+3]=this.h[1]>>>8&255,r[f+4]=this.h[2]>>>0&255,r[f+5]=this.h[2]>>>8&255,r[f+6]=this.h[3]>>>0&255,r[f+7]=this.h[3]>>>8&255,r[f+8]=this.h[4]>>>0&255,r[f+9]=this.h[4]>>>8&255,r[f+10]=this.h[5]>>>0&255,r[f+11]=this.h[5]>>>8&255,r[f+12]=this.h[6]>>>0&255,r[f+13]=this.h[6]>>>8&255,r[f+14]=this.h[7]>>>0&255,r[f+15]=this.h[7]>>>8&255;},pe.prototype.update=function(r,f,o){var t,s;if(this.leftover){for(s=16-this.leftover,s>o&&(s=o),t=0;t<s;t++)this.buffer[this.leftover+t]=r[f+t];if(o-=s,f+=s,this.leftover+=s,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0;}if(o>=16&&(s=o-o%16,this.blocks(r,f,s),f+=s,o-=s),o){for(t=0;t<o;t++)this.buffer[this.leftover+t]=r[f+t];this.leftover+=o;}};function qe(r,f,o,t,s,u){var d=new pe(u);return d.update(o,t,s),d.finish(r,f),0}function Br(r,f,o,t,s,u){var d=new Uint8Array(16);return qe(d,0,o,t,s,u),vt(r,f,d,0)}function Ye(r,f,o,t,s){var u;if(o<32)return -1;for(Oe(r,0,f,0,o,t,s),qe(r,16,r,32,o-32,r),u=0;u<16;u++)r[u]=0;return 0}function Fe(r,f,o,t,s){var u,d=new Uint8Array(32);if(o<32||(Ht(d,0,32,t,s),Br(f,16,f,32,o-32,d)!==0))return -1;for(Oe(r,0,f,0,o,t,s),u=0;u<32;u++)r[u]=0;return 0}function It(r,f){var o;for(o=0;o<16;o++)r[o]=f[o]|0;}function Ke(r){var f,o,t=1;for(f=0;f<16;f++)o=r[f]+t+65535,t=Math.floor(o/65536),r[f]=o-t*65536;r[0]+=t-1+37*(t-1);}function Vt(r,f,o){for(var t,s=~(o-1),u=0;u<16;u++)t=s&(r[u]^f[u]),r[u]^=t,f[u]^=t;}function Wt(r,f){var o,t,s,u=e(),d=e();for(o=0;o<16;o++)d[o]=f[o];for(Ke(d),Ke(d),Ke(d),t=0;t<2;t++){for(u[0]=d[0]-65517,o=1;o<15;o++)u[o]=d[o]-65535-(u[o-1]>>16&1),u[o-1]&=65535;u[15]=d[15]-32767-(u[14]>>16&1),s=u[15]>>16&1,u[14]&=65535,Vt(d,u,1-s);}for(o=0;o<16;o++)r[2*o]=d[o]&255,r[2*o+1]=d[o]>>8;}function Mr(r,f){var o=new Uint8Array(32),t=new Uint8Array(32);return Wt(o,r),Wt(t,f),Lt(o,0,t,0)}function Tr(r){var f=new Uint8Array(32);return Wt(f,r),f[0]&1}function $e(r,f){var o;for(o=0;o<16;o++)r[o]=f[2*o]+(f[2*o+1]<<8);r[15]&=32767;}function St(r,f,o){for(var t=0;t<16;t++)r[t]=f[t]+o[t];}function _t(r,f,o){for(var t=0;t<16;t++)r[t]=f[t]-o[t];}function Z(r,f,o){var t,s,u=0,d=0,m=0,A=0,R=0,_=0,X=0,M=0,N=0,k=0,q=0,O=0,j=0,D=0,z=0,T=0,L=0,B=0,I=0,U=0,S=0,x=0,p=0,v=0,b=0,w=0,C=0,P=0,Y=0,K=0,F=0,c=o[0],W=o[1],tt=o[2],et=o[3],H=o[4],Q=o[5],G=o[6],ut=o[7],ot=o[8],st=o[9],at=o[10],ct=o[11],xt=o[12],gt=o[13],yt=o[14],bt=o[15];t=f[0],u+=t*c,d+=t*W,m+=t*tt,A+=t*et,R+=t*H,_+=t*Q,X+=t*G,M+=t*ut,N+=t*ot,k+=t*st,q+=t*at,O+=t*ct,j+=t*xt,D+=t*gt,z+=t*yt,T+=t*bt,t=f[1],d+=t*c,m+=t*W,A+=t*tt,R+=t*et,_+=t*H,X+=t*Q,M+=t*G,N+=t*ut,k+=t*ot,q+=t*st,O+=t*at,j+=t*ct,D+=t*xt,z+=t*gt,T+=t*yt,L+=t*bt,t=f[2],m+=t*c,A+=t*W,R+=t*tt,_+=t*et,X+=t*H,M+=t*Q,N+=t*G,k+=t*ut,q+=t*ot,O+=t*st,j+=t*at,D+=t*ct,z+=t*xt,T+=t*gt,L+=t*yt,B+=t*bt,t=f[3],A+=t*c,R+=t*W,_+=t*tt,X+=t*et,M+=t*H,N+=t*Q,k+=t*G,q+=t*ut,O+=t*ot,j+=t*st,D+=t*at,z+=t*ct,T+=t*xt,L+=t*gt,B+=t*yt,I+=t*bt,t=f[4],R+=t*c,_+=t*W,X+=t*tt,M+=t*et,N+=t*H,k+=t*Q,q+=t*G,O+=t*ut,j+=t*ot,D+=t*st,z+=t*at,T+=t*ct,L+=t*xt,B+=t*gt,I+=t*yt,U+=t*bt,t=f[5],_+=t*c,X+=t*W,M+=t*tt,N+=t*et,k+=t*H,q+=t*Q,O+=t*G,j+=t*ut,D+=t*ot,z+=t*st,T+=t*at,L+=t*ct,B+=t*xt,I+=t*gt,U+=t*yt,S+=t*bt,t=f[6],X+=t*c,M+=t*W,N+=t*tt,k+=t*et,q+=t*H,O+=t*Q,j+=t*G,D+=t*ut,z+=t*ot,T+=t*st,L+=t*at,B+=t*ct,I+=t*xt,U+=t*gt,S+=t*yt,x+=t*bt,t=f[7],M+=t*c,N+=t*W,k+=t*tt,q+=t*et,O+=t*H,j+=t*Q,D+=t*G,z+=t*ut,T+=t*ot,L+=t*st,B+=t*at,I+=t*ct,U+=t*xt,S+=t*gt,x+=t*yt,p+=t*bt,t=f[8],N+=t*c,k+=t*W,q+=t*tt,O+=t*et,j+=t*H,D+=t*Q,z+=t*G,T+=t*ut,L+=t*ot,B+=t*st,I+=t*at,U+=t*ct,S+=t*xt,x+=t*gt,p+=t*yt,v+=t*bt,t=f[9],k+=t*c,q+=t*W,O+=t*tt,j+=t*et,D+=t*H,z+=t*Q,T+=t*G,L+=t*ut,B+=t*ot,I+=t*st,U+=t*at,S+=t*ct,x+=t*xt,p+=t*gt,v+=t*yt,b+=t*bt,t=f[10],q+=t*c,O+=t*W,j+=t*tt,D+=t*et,z+=t*H,T+=t*Q,L+=t*G,B+=t*ut,I+=t*ot,U+=t*st,S+=t*at,x+=t*ct,p+=t*xt,v+=t*gt,b+=t*yt,w+=t*bt,t=f[11],O+=t*c,j+=t*W,D+=t*tt,z+=t*et,T+=t*H,L+=t*Q,B+=t*G,I+=t*ut,U+=t*ot,S+=t*st,x+=t*at,p+=t*ct,v+=t*xt,b+=t*gt,w+=t*yt,C+=t*bt,t=f[12],j+=t*c,D+=t*W,z+=t*tt,T+=t*et,L+=t*H,B+=t*Q,I+=t*G,U+=t*ut,S+=t*ot,x+=t*st,p+=t*at,v+=t*ct,b+=t*xt,w+=t*gt,C+=t*yt,P+=t*bt,t=f[13],D+=t*c,z+=t*W,T+=t*tt,L+=t*et,B+=t*H,I+=t*Q,U+=t*G,S+=t*ut,x+=t*ot,p+=t*st,v+=t*at,b+=t*ct,w+=t*xt,C+=t*gt,P+=t*yt,Y+=t*bt,t=f[14],z+=t*c,T+=t*W,L+=t*tt,B+=t*et,I+=t*H,U+=t*Q,S+=t*G,x+=t*ut,p+=t*ot,v+=t*st,b+=t*at,w+=t*ct,C+=t*xt,P+=t*gt,Y+=t*yt,K+=t*bt,t=f[15],T+=t*c,L+=t*W,B+=t*tt,I+=t*et,U+=t*H,S+=t*Q,x+=t*G,p+=t*ut,v+=t*ot,b+=t*st,w+=t*at,C+=t*ct,P+=t*xt,Y+=t*gt,K+=t*yt,F+=t*bt,u+=38*L,d+=38*B,m+=38*I,A+=38*U,R+=38*S,_+=38*x,X+=38*p,M+=38*v,N+=38*b,k+=38*w,q+=38*C,O+=38*P,j+=38*Y,D+=38*K,z+=38*F,s=1,t=u+s+65535,s=Math.floor(t/65536),u=t-s*65536,t=d+s+65535,s=Math.floor(t/65536),d=t-s*65536,t=m+s+65535,s=Math.floor(t/65536),m=t-s*65536,t=A+s+65535,s=Math.floor(t/65536),A=t-s*65536,t=R+s+65535,s=Math.floor(t/65536),R=t-s*65536,t=_+s+65535,s=Math.floor(t/65536),_=t-s*65536,t=X+s+65535,s=Math.floor(t/65536),X=t-s*65536,t=M+s+65535,s=Math.floor(t/65536),M=t-s*65536,t=N+s+65535,s=Math.floor(t/65536),N=t-s*65536,t=k+s+65535,s=Math.floor(t/65536),k=t-s*65536,t=q+s+65535,s=Math.floor(t/65536),q=t-s*65536,t=O+s+65535,s=Math.floor(t/65536),O=t-s*65536,t=j+s+65535,s=Math.floor(t/65536),j=t-s*65536,t=D+s+65535,s=Math.floor(t/65536),D=t-s*65536,t=z+s+65535,s=Math.floor(t/65536),z=t-s*65536,t=T+s+65535,s=Math.floor(t/65536),T=t-s*65536,u+=s-1+37*(s-1),s=1,t=u+s+65535,s=Math.floor(t/65536),u=t-s*65536,t=d+s+65535,s=Math.floor(t/65536),d=t-s*65536,t=m+s+65535,s=Math.floor(t/65536),m=t-s*65536,t=A+s+65535,s=Math.floor(t/65536),A=t-s*65536,t=R+s+65535,s=Math.floor(t/65536),R=t-s*65536,t=_+s+65535,s=Math.floor(t/65536),_=t-s*65536,t=X+s+65535,s=Math.floor(t/65536),X=t-s*65536,t=M+s+65535,s=Math.floor(t/65536),M=t-s*65536,t=N+s+65535,s=Math.floor(t/65536),N=t-s*65536,t=k+s+65535,s=Math.floor(t/65536),k=t-s*65536,t=q+s+65535,s=Math.floor(t/65536),q=t-s*65536,t=O+s+65535,s=Math.floor(t/65536),O=t-s*65536,t=j+s+65535,s=Math.floor(t/65536),j=t-s*65536,t=D+s+65535,s=Math.floor(t/65536),D=t-s*65536,t=z+s+65535,s=Math.floor(t/65536),z=t-s*65536,t=T+s+65535,s=Math.floor(t/65536),T=t-s*65536,u+=s-1+37*(s-1),r[0]=u,r[1]=d,r[2]=m,r[3]=A,r[4]=R,r[5]=_,r[6]=X,r[7]=M,r[8]=N,r[9]=k,r[10]=q,r[11]=O,r[12]=j,r[13]=D,r[14]=z,r[15]=T;}function Et(r,f){Z(r,f,f);}function Ir(r,f){var o=e(),t;for(t=0;t<16;t++)o[t]=f[t];for(t=253;t>=0;t--)Et(o,o),t!==2&&t!==4&&Z(o,o,f);for(t=0;t<16;t++)r[t]=o[t];}function Ur(r,f){var o=e(),t;for(t=0;t<16;t++)o[t]=f[t];for(t=250;t>=0;t--)Et(o,o),t!==1&&Z(o,o,f);for(t=0;t<16;t++)r[t]=o[t];}function ge(r,f,o){var t=new Uint8Array(32),s=new Float64Array(80),u,d,m=e(),A=e(),R=e(),_=e(),X=e(),M=e();for(d=0;d<31;d++)t[d]=f[d];for(t[31]=f[31]&127|64,t[0]&=248,$e(s,o),d=0;d<16;d++)A[d]=s[d],_[d]=m[d]=R[d]=0;for(m[0]=_[0]=1,d=254;d>=0;--d)u=t[d>>>3]>>>(d&7)&1,Vt(m,A,u),Vt(R,_,u),St(X,m,R),_t(m,m,R),St(R,A,_),_t(A,A,_),Et(_,X),Et(M,m),Z(m,R,m),Z(R,A,X),St(X,m,R),_t(m,m,R),Et(A,m),_t(R,_,M),Z(m,R,y),St(m,m,_),Z(R,R,m),Z(m,_,M),Z(_,A,s),Et(A,X),Vt(m,A,u),Vt(R,_,u);for(d=0;d<16;d++)s[d+16]=m[d],s[d+32]=R[d],s[d+48]=A[d],s[d+64]=_[d];var N=s.subarray(32),k=s.subarray(16);return Ir(N,N),Z(k,k,N),Wt(r,k),0}function ye(r,f){return ge(r,f,l)}function Rr(r,f){return i(f,32),ye(r,f)}function be(r,f,o){var t=new Uint8Array(32);return ge(t,o,f),Tt(r,a,t,dt)}var Lr=Ye,ei=Fe;function ri(r,f,o,t,s,u){var d=new Uint8Array(32);return be(d,s,u),Lr(r,f,o,t,d)}function ni(r,f,o,t,s,u){var d=new Uint8Array(32);return be(d,s,u),ei(r,f,o,t,d)}var Pr=[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 Nr(r,f,o,t){for(var s=new Int32Array(16),u=new Int32Array(16),d,m,A,R,_,X,M,N,k,q,O,j,D,z,T,L,B,I,U,S,x,p,v,b,w,C,P=r[0],Y=r[1],K=r[2],F=r[3],c=r[4],W=r[5],tt=r[6],et=r[7],H=f[0],Q=f[1],G=f[2],ut=f[3],ot=f[4],st=f[5],at=f[6],ct=f[7],xt=0;t>=128;){for(U=0;U<16;U++)S=8*U+xt,s[U]=o[S+0]<<24|o[S+1]<<16|o[S+2]<<8|o[S+3],u[U]=o[S+4]<<24|o[S+5]<<16|o[S+6]<<8|o[S+7];for(U=0;U<80;U++)if(d=P,m=Y,A=K,R=F,_=c,X=W,M=tt,N=et,k=H,q=Q,O=G,j=ut,D=ot,z=st,T=at,L=ct,x=et,p=ct,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=(c>>>14|ot<<18)^(c>>>18|ot<<14)^(ot>>>9|c<<23),p=(ot>>>14|c<<18)^(ot>>>18|c<<14)^(c>>>9|ot<<23),v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,x=c&W^~c&tt,p=ot&st^~ot&at,v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,x=Pr[U*2],p=Pr[U*2+1],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,x=s[U%16],p=u[U%16],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,B=w&65535|C<<16,I=v&65535|b<<16,x=B,p=I,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=(P>>>28|H<<4)^(H>>>2|P<<30)^(H>>>7|P<<25),p=(H>>>28|P<<4)^(P>>>2|H<<30)^(P>>>7|H<<25),v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,x=P&Y^P&K^Y&K,p=H&Q^H&G^Q&G,v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,N=w&65535|C<<16,L=v&65535|b<<16,x=R,p=j,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=B,p=I,v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,R=w&65535|C<<16,j=v&65535|b<<16,Y=d,K=m,F=A,c=R,W=_,tt=X,et=M,P=N,Q=k,G=q,ut=O,ot=j,st=D,at=z,ct=T,H=L,U%16===15)for(S=0;S<16;S++)x=s[S],p=u[S],v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=s[(S+9)%16],p=u[(S+9)%16],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,B=s[(S+1)%16],I=u[(S+1)%16],x=(B>>>1|I<<31)^(B>>>8|I<<24)^B>>>7,p=(I>>>1|B<<31)^(I>>>8|B<<24)^(I>>>7|B<<25),v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,B=s[(S+14)%16],I=u[(S+14)%16],x=(B>>>19|I<<13)^(I>>>29|B<<3)^B>>>6,p=(I>>>19|B<<13)^(B>>>29|I<<3)^(I>>>6|B<<26),v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,s[S]=w&65535|C<<16,u[S]=v&65535|b<<16;x=P,p=H,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=r[0],p=f[0],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[0]=P=w&65535|C<<16,f[0]=H=v&65535|b<<16,x=Y,p=Q,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=r[1],p=f[1],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[1]=Y=w&65535|C<<16,f[1]=Q=v&65535|b<<16,x=K,p=G,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=r[2],p=f[2],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[2]=K=w&65535|C<<16,f[2]=G=v&65535|b<<16,x=F,p=ut,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=r[3],p=f[3],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[3]=F=w&65535|C<<16,f[3]=ut=v&65535|b<<16,x=c,p=ot,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=r[4],p=f[4],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[4]=c=w&65535|C<<16,f[4]=ot=v&65535|b<<16,x=W,p=st,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=r[5],p=f[5],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[5]=W=w&65535|C<<16,f[5]=st=v&65535|b<<16,x=tt,p=at,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=r[6],p=f[6],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[6]=tt=w&65535|C<<16,f[6]=at=v&65535|b<<16,x=et,p=ct,v=p&65535,b=p>>>16,w=x&65535,C=x>>>16,x=r[7],p=f[7],v+=p&65535,b+=p>>>16,w+=x&65535,C+=x>>>16,b+=v>>>16,w+=b>>>16,C+=w>>>16,r[7]=et=w&65535|C<<16,f[7]=ct=v&65535|b<<16,xt+=128,t-=128;}return t}function Dt(r,f,o){var t=new Int32Array(8),s=new Int32Array(8),u=new Uint8Array(256),d,m=o;for(t[0]=1779033703,t[1]=3144134277,t[2]=1013904242,t[3]=2773480762,t[4]=1359893119,t[5]=2600822924,t[6]=528734635,t[7]=1541459225,s[0]=4089235720,s[1]=2227873595,s[2]=4271175723,s[3]=1595750129,s[4]=2917565137,s[5]=725511199,s[6]=4215389547,s[7]=327033209,Nr(t,s,f,o),o%=128,d=0;d<o;d++)u[d]=f[m-o+d];for(u[o]=128,o=256-128*(o<112?1:0),u[o-9]=0,mt(u,o-8,m/536870912|0,m<<3),Nr(t,s,u,o),d=0;d<8;d++)mt(r,8*d,t[d],s[d]);return 0}function me(r,f){var o=e(),t=e(),s=e(),u=e(),d=e(),m=e(),A=e(),R=e(),_=e();_t(o,r[1],r[0]),_t(_,f[1],f[0]),Z(o,o,_),St(t,r[0],r[1]),St(_,f[0],f[1]),Z(t,t,_),Z(s,r[3],f[3]),Z(s,s,V),Z(u,r[2],f[2]),St(u,u,u),_t(d,t,o),_t(m,u,s),St(A,u,s),St(R,t,o),Z(r[0],d,m),Z(r[1],R,A),Z(r[2],A,m),Z(r[3],d,R);}function kr(r,f,o){var t;for(t=0;t<4;t++)Vt(r[t],f[t],o);}function He(r,f){var o=e(),t=e(),s=e();Ir(s,f[2]),Z(o,f[0],s),Z(t,f[1],s),Wt(r,t),r[31]^=Tr(o)<<7;}function Ve(r,f,o){var t,s;for(It(r[0],h),It(r[1],g),It(r[2],g),It(r[3],h),s=255;s>=0;--s)t=o[s/8|0]>>(s&7)&1,kr(r,f,t),me(f,r),me(r,r),kr(r,f,t);}function we(r,f){var o=[e(),e(),e(),e()];It(o[0],$),It(o[1],lt),It(o[2],g),Z(o[3],$,lt),Ve(r,o,f);}function We(r,f,o){var t=new Uint8Array(64),s=[e(),e(),e(),e()],u;for(o||i(f,32),Dt(t,f,32),t[0]&=248,t[31]&=127,t[31]|=64,we(s,t),He(r,s),u=0;u<32;u++)f[u+32]=r[u];return 0}var ve=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 Je(r,f){var o,t,s,u;for(t=63;t>=32;--t){for(o=0,s=t-32,u=t-12;s<u;++s)f[s]+=o-16*f[t]*ve[s-(t-32)],o=Math.floor((f[s]+128)/256),f[s]-=o*256;f[s]+=o,f[t]=0;}for(o=0,s=0;s<32;s++)f[s]+=o-(f[31]>>4)*ve[s],o=f[s]>>8,f[s]&=255;for(s=0;s<32;s++)f[s]-=o*ve[s];for(t=0;t<32;t++)f[t+1]+=f[t]>>8,r[t]=f[t]&255;}function Ze(r){var f=new Float64Array(64),o;for(o=0;o<64;o++)f[o]=r[o];for(o=0;o<64;o++)r[o]=0;Je(r,f);}function jr(r,f,o,t){var s=new Uint8Array(64),u=new Uint8Array(64),d=new Uint8Array(64),m,A,R=new Float64Array(64),_=[e(),e(),e(),e()];Dt(s,t,32),s[0]&=248,s[31]&=127,s[31]|=64;var X=o+64;for(m=0;m<o;m++)r[64+m]=f[m];for(m=0;m<32;m++)r[32+m]=s[32+m];for(Dt(d,r.subarray(32),o+32),Ze(d),we(_,d),He(r,_),m=32;m<64;m++)r[m]=t[m];for(Dt(u,r,o+64),Ze(u),m=0;m<64;m++)R[m]=0;for(m=0;m<32;m++)R[m]=d[m];for(m=0;m<32;m++)for(A=0;A<32;A++)R[m+A]+=u[m]*s[A];return Je(r.subarray(32),R),X}function ii(r,f){var o=e(),t=e(),s=e(),u=e(),d=e(),m=e(),A=e();return It(r[2],g),$e(r[1],f),Et(s,r[1]),Z(u,s,E),_t(s,s,r[2]),St(u,r[2],u),Et(d,u),Et(m,d),Z(A,m,d),Z(o,A,s),Z(o,o,u),Ur(o,o),Z(o,o,s),Z(o,o,u),Z(o,o,u),Z(r[0],o,u),Et(t,r[0]),Z(t,t,u),Mr(t,s)&&Z(r[0],r[0],it),Et(t,r[0]),Z(t,t,u),Mr(t,s)?-1:(Tr(r[0])===f[31]>>7&&_t(r[0],h,r[0]),Z(r[3],r[0],r[1]),0)}function Qe(r,f,o,t){var s,u=new Uint8Array(32),d=new Uint8Array(64),m=[e(),e(),e(),e()],A=[e(),e(),e(),e()];if(o<64||ii(A,t))return -1;for(s=0;s<o;s++)r[s]=f[s];for(s=0;s<32;s++)r[s+32]=t[s];if(Dt(d,r,o),Ze(d),Ve(m,A,d),we(A,f.subarray(32)),me(m,A),He(u,m),o-=64,Lt(f,0,u,0)){for(s=0;s<o;s++)r[s]=0;return -1}for(s=0;s<o;s++)r[s]=f[s+64];return o}var Ge=32,Ce=24,ne=32,Jt=16,ie=32,Ee=32,oe=32,fe=32,Xe=32,zr=Ce,oi=ne,fi=Jt,Ut=64,Ot=32,Zt=64,tr=32,er=64;n.lowlevel={crypto_core_hsalsa20:Tt,crypto_stream_xor:Oe,crypto_stream:Ht,crypto_stream_salsa20_xor:J,crypto_stream_salsa20:pt,crypto_onetimeauth:qe,crypto_onetimeauth_verify:Br,crypto_verify_16:vt,crypto_verify_32:Lt,crypto_secretbox:Ye,crypto_secretbox_open:Fe,crypto_scalarmult:ge,crypto_scalarmult_base:ye,crypto_box_beforenm:be,crypto_box_afternm:Lr,crypto_box:ri,crypto_box_open:ni,crypto_box_keypair:Rr,crypto_hash:Dt,crypto_sign:jr,crypto_sign_keypair:We,crypto_sign_open:Qe,crypto_secretbox_KEYBYTES:Ge,crypto_secretbox_NONCEBYTES:Ce,crypto_secretbox_ZEROBYTES:ne,crypto_secretbox_BOXZEROBYTES:Jt,crypto_scalarmult_BYTES:ie,crypto_scalarmult_SCALARBYTES:Ee,crypto_box_PUBLICKEYBYTES:oe,crypto_box_SECRETKEYBYTES:fe,crypto_box_BEFORENMBYTES:Xe,crypto_box_NONCEBYTES:zr,crypto_box_ZEROBYTES:oi,crypto_box_BOXZEROBYTES:fi,crypto_sign_BYTES:Ut,crypto_sign_PUBLICKEYBYTES:Ot,crypto_sign_SECRETKEYBYTES:Zt,crypto_sign_SEEDBYTES:tr,crypto_hash_BYTES:er,gf:e,D:E,L:ve,pack25519:Wt,unpack25519:$e,M:Z,A:St,S:Et,Z:_t,pow2523:Ur,add:me,set25519:It,modL:Je,scalarmult:Ve,scalarbase:we};function Dr(r,f){if(r.length!==Ge)throw new Error("bad key size");if(f.length!==Ce)throw new Error("bad nonce size")}function si(r,f){if(r.length!==oe)throw new Error("bad public key size");if(f.length!==fe)throw new Error("bad secret key size")}function Ct(){for(var r=0;r<arguments.length;r++)if(!(arguments[r]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Or(r){for(var f=0;f<r.length;f++)r[f]=0;}n.randomBytes=function(r){var f=new Uint8Array(r);return i(f,r),f},n.secretbox=function(r,f,o){Ct(r,f,o),Dr(o,f);for(var t=new Uint8Array(ne+r.length),s=new Uint8Array(t.length),u=0;u<r.length;u++)t[u+ne]=r[u];return Ye(s,t,t.length,f,o),s.subarray(Jt)},n.secretbox.open=function(r,f,o){Ct(r,f,o),Dr(o,f);for(var t=new Uint8Array(Jt+r.length),s=new Uint8Array(t.length),u=0;u<r.length;u++)t[u+Jt]=r[u];return t.length<32||Fe(s,t,t.length,f,o)!==0?null:s.subarray(ne)},n.secretbox.keyLength=Ge,n.secretbox.nonceLength=Ce,n.secretbox.overheadLength=Jt,n.scalarMult=function(r,f){if(Ct(r,f),r.length!==Ee)throw new Error("bad n size");if(f.length!==ie)throw new Error("bad p size");var o=new Uint8Array(ie);return ge(o,r,f),o},n.scalarMult.base=function(r){if(Ct(r),r.length!==Ee)throw new Error("bad n size");var f=new Uint8Array(ie);return ye(f,r),f},n.scalarMult.scalarLength=Ee,n.scalarMult.groupElementLength=ie,n.box=function(r,f,o,t){var s=n.box.before(o,t);return n.secretbox(r,f,s)},n.box.before=function(r,f){Ct(r,f),si(r,f);var o=new Uint8Array(Xe);return be(o,r,f),o},n.box.after=n.secretbox,n.box.open=function(r,f,o,t){var s=n.box.before(o,t);return n.secretbox.open(r,f,s)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var r=new Uint8Array(oe),f=new Uint8Array(fe);return Rr(r,f),{publicKey:r,secretKey:f}},n.box.keyPair.fromSecretKey=function(r){if(Ct(r),r.length!==fe)throw new Error("bad secret key size");var f=new Uint8Array(oe);return ye(f,r),{publicKey:f,secretKey:new Uint8Array(r)}},n.box.publicKeyLength=oe,n.box.secretKeyLength=fe,n.box.sharedKeyLength=Xe,n.box.nonceLength=zr,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(r,f){if(Ct(r,f),f.length!==Zt)throw new Error("bad secret key size");var o=new Uint8Array(Ut+r.length);return jr(o,r,r.length,f),o},n.sign.open=function(r,f){if(Ct(r,f),f.length!==Ot)throw new Error("bad public key size");var o=new Uint8Array(r.length),t=Qe(o,r,r.length,f);if(t<0)return null;for(var s=new Uint8Array(t),u=0;u<s.length;u++)s[u]=o[u];return s},n.sign.detached=function(r,f){for(var o=n.sign(r,f),t=new Uint8Array(Ut),s=0;s<t.length;s++)t[s]=o[s];return t},n.sign.detached.verify=function(r,f,o){if(Ct(r,f,o),f.length!==Ut)throw new Error("bad signature size");if(o.length!==Ot)throw new Error("bad public key size");var t=new Uint8Array(Ut+r.length),s=new Uint8Array(Ut+r.length),u;for(u=0;u<Ut;u++)t[u]=f[u];for(u=0;u<r.length;u++)t[u+Ut]=r[u];return Qe(s,t,t.length,o)>=0},n.sign.keyPair=function(){var r=new Uint8Array(Ot),f=new Uint8Array(Zt);return We(r,f),{publicKey:r,secretKey:f}},n.sign.keyPair.fromSecretKey=function(r){if(Ct(r),r.length!==Zt)throw new Error("bad secret key size");for(var f=new Uint8Array(Ot),o=0;o<f.length;o++)f[o]=r[32+o];return {publicKey:f,secretKey:new Uint8Array(r)}},n.sign.keyPair.fromSeed=function(r){if(Ct(r),r.length!==tr)throw new Error("bad seed size");for(var f=new Uint8Array(Ot),o=new Uint8Array(Zt),t=0;t<32;t++)o[t]=r[t];return We(f,o,true),{publicKey:f,secretKey:o}},n.sign.publicKeyLength=Ot,n.sign.secretKeyLength=Zt,n.sign.seedLength=tr,n.sign.signatureLength=Ut,n.hash=function(r){Ct(r);var f=new Uint8Array(er);return Dt(f,r,r.length),f},n.hash.hashLength=er,n.verify=function(r,f){return Ct(r,f),r.length===0||f.length===0||r.length!==f.length?false:wt(r,0,f,0,r.length)===0},n.setPRNG=function(r){i=r;},(function(){var r=typeof self<"u"?self.crypto||self.msCrypto:null;if(r&&r.getRandomValues){var f=65536;n.setPRNG(function(o,t){var s,u=new Uint8Array(t);for(s=0;s<t;s+=f)r.getRandomValues(u.subarray(s,s+Math.min(t-s,f)));for(s=0;s<t;s++)o[s]=u[s];Or(u);});}else typeof rr<"u"&&(r=rr("crypto"),r&&r.randomBytes&&n.setPRNG(function(o,t){var s,u=r.randomBytes(t);for(s=0;s<t;s++)o[s]=u[s];Or(u);}));})();})(typeof Ae<"u"&&Ae.exports?Ae.exports:self.nacl=self.nacl||{});});var Kr=rt((Fr,Se)=>{(function(n,e){typeof Se<"u"&&Se.exports?Se.exports=e():(n.nacl||(n.nacl={}),n.nacl.util=e());})(Fr,function(){var n={};function e(i){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(i))throw new TypeError("invalid encoding")}return n.decodeUTF8=function(i){if(typeof i!="string")throw new TypeError("expected string");var a,l=unescape(encodeURIComponent(i)),h=new Uint8Array(l.length);for(a=0;a<l.length;a++)h[a]=l.charCodeAt(a);return h},n.encodeUTF8=function(i){var a,l=[];for(a=0;a<i.length;a++)l.push(String.fromCharCode(i[a]));return decodeURIComponent(escape(l.join("")))},typeof atob>"u"?typeof Buffer.from<"u"?(n.encodeBase64=function(i){return Buffer.from(i).toString("base64")},n.decodeBase64=function(i){return e(i),new Uint8Array(Array.prototype.slice.call(Buffer.from(i,"base64"),0))}):(n.encodeBase64=function(i){return new Buffer(i).toString("base64")},n.decodeBase64=function(i){return e(i),new Uint8Array(Array.prototype.slice.call(new Buffer(i,"base64"),0))}):(n.encodeBase64=function(i){var a,l=[],h=i.length;for(a=0;a<h;a++)l.push(String.fromCharCode(i[a]));return btoa(l.join(""))},n.decodeBase64=function(i){e(i);var a,l=atob(i),h=new Uint8Array(l.length);for(a=0;a<l.length;a++)h[a]=l.charCodeAt(a);return h}),n});});var Hr=rt((wo,$r)=>{$r.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then};});var Pt=rt(qt=>{var nr,pi=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];qt.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};qt.getSymbolTotalCodewords=function(e){return pi[e]};qt.getBCHDigit=function(n){let e=0;for(;n!==0;)e++,n>>>=1;return e};qt.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');nr=e;};qt.isKanjiModeEnabled=function(){return typeof nr<"u"};qt.toSJIS=function(e){return nr(e)};});var _e=rt(At=>{At.L={bit:1};At.M={bit:0};At.Q={bit:3};At.H={bit:2};function gi(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case "l":case "low":return At.L;case "m":case "medium":return At.M;case "q":case "quartile":return At.Q;case "h":case "high":return At.H;default:throw new Error("Unknown EC Level: "+n)}}At.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};At.from=function(e,i){if(At.isValid(e))return e;try{return gi(e)}catch{return i}};});var Jr=rt((Eo,Wr)=>{function Vr(){this.buffer=[],this.length=0;}Vr.prototype={get:function(n){let e=Math.floor(n/8);return (this.buffer[e]>>>7-n%8&1)===1},put:function(n,e){for(let i=0;i<e;i++)this.putBit((n>>>e-i-1&1)===1);},getLengthInBits:function(){return this.length},putBit:function(n){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),n&&(this.buffer[e]|=128>>>this.length%8),this.length++;}};Wr.exports=Vr;});var Qr=rt((Ao,Zr)=>{function se(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n);}se.prototype.set=function(n,e,i,a){let l=n*this.size+e;this.data[l]=i,a&&(this.reservedBit[l]=true);};se.prototype.get=function(n,e){return this.data[n*this.size+e]};se.prototype.xor=function(n,e,i){this.data[n*this.size+e]^=i;};se.prototype.isReserved=function(n,e){return this.reservedBit[n*this.size+e]};Zr.exports=se;});var Gr=rt(Be=>{var yi=Pt().getSymbolSize;Be.getRowColCoords=function(e){if(e===1)return [];let i=Math.floor(e/7)+2,a=yi(e),l=a===145?26:Math.ceil((a-13)/(2*i-2))*2,h=[a-7];for(let g=1;g<i-1;g++)h[g]=h[g-1]-l;return h.push(6),h.reverse()};Be.getPositions=function(e){let i=[],a=Be.getRowColCoords(e),l=a.length;for(let h=0;h<l;h++)for(let g=0;g<l;g++)h===0&&g===0||h===0&&g===l-1||h===l-1&&g===0||i.push([a[h],a[g]]);return i};});var en=rt(tn=>{var bi=Pt().getSymbolSize,Xr=7;tn.getPositions=function(e){let i=bi(e);return [[0,0],[i-Xr,0],[0,i-Xr]]};});var rn=rt(ft=>{ft.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Yt={N1:3,N2:3,N3:40,N4:10};ft.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};ft.from=function(e){return ft.isValid(e)?parseInt(e,10):void 0};ft.getPenaltyN1=function(e){let i=e.size,a=0,l=0,h=0,g=null,y=null;for(let E=0;E<i;E++){l=h=0,g=y=null;for(let V=0;V<i;V++){let $=e.get(E,V);$===g?l++:(l>=5&&(a+=Yt.N1+(l-5)),g=$,l=1),$=e.get(V,E),$===y?h++:(h>=5&&(a+=Yt.N1+(h-5)),y=$,h=1);}l>=5&&(a+=Yt.N1+(l-5)),h>=5&&(a+=Yt.N1+(h-5));}return a};ft.getPenaltyN2=function(e){let i=e.size,a=0;for(let l=0;l<i-1;l++)for(let h=0;h<i-1;h++){let g=e.get(l,h)+e.get(l,h+1)+e.get(l+1,h)+e.get(l+1,h+1);(g===4||g===0)&&a++;}return a*Yt.N2};ft.getPenaltyN3=function(e){let i=e.size,a=0,l=0,h=0;for(let g=0;g<i;g++){l=h=0;for(let y=0;y<i;y++)l=l<<1&2047|e.get(g,y),y>=10&&(l===1488||l===93)&&a++,h=h<<1&2047|e.get(y,g),y>=10&&(h===1488||h===93)&&a++;}return a*Yt.N3};ft.getPenaltyN4=function(e){let i=0,a=e.data.length;for(let h=0;h<a;h++)i+=e.data[h];return Math.abs(Math.ceil(i*100/a/5)-10)*Yt.N4};function mi(n,e,i){switch(n){case ft.Patterns.PATTERN000:return (e+i)%2===0;case ft.Patterns.PATTERN001:return e%2===0;case ft.Patterns.PATTERN010:return i%3===0;case ft.Patterns.PATTERN011:return (e+i)%3===0;case ft.Patterns.PATTERN100:return (Math.floor(e/2)+Math.floor(i/3))%2===0;case ft.Patterns.PATTERN101:return e*i%2+e*i%3===0;case ft.Patterns.PATTERN110:return (e*i%2+e*i%3)%2===0;case ft.Patterns.PATTERN111:return (e*i%3+(e+i)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}ft.applyMask=function(e,i){let a=i.size;for(let l=0;l<a;l++)for(let h=0;h<a;h++)i.isReserved(h,l)||i.xor(h,l,mi(e,h,l));};ft.getBestMask=function(e,i){let a=Object.keys(ft.Patterns).length,l=0,h=1/0;for(let g=0;g<a;g++){i(g),ft.applyMask(g,e);let y=ft.getPenaltyN1(e)+ft.getPenaltyN2(e)+ft.getPenaltyN3(e)+ft.getPenaltyN4(e);ft.applyMask(g,e),y<h&&(h=y,l=g);}return l};});var or=rt(ir=>{var Nt=_e(),Me=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Te=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];ir.getBlocksCount=function(e,i){switch(i){case Nt.L:return Me[(e-1)*4+0];case Nt.M:return Me[(e-1)*4+1];case Nt.Q:return Me[(e-1)*4+2];case Nt.H:return Me[(e-1)*4+3];default:return}};ir.getTotalCodewordsCount=function(e,i){switch(i){case Nt.L:return Te[(e-1)*4+0];case Nt.M:return Te[(e-1)*4+1];case Nt.Q:return Te[(e-1)*4+2];case Nt.H:return Te[(e-1)*4+3];default:return}};});var nn=rt(Ue=>{var ae=new Uint8Array(512),Ie=new Uint8Array(256);(function(){let e=1;for(let i=0;i<255;i++)ae[i]=e,Ie[e]=i,e<<=1,e&256&&(e^=285);for(let i=255;i<512;i++)ae[i]=ae[i-255];})();Ue.log=function(e){if(e<1)throw new Error("log("+e+")");return Ie[e]};Ue.exp=function(e){return ae[e]};Ue.mul=function(e,i){return e===0||i===0?0:ae[Ie[e]+Ie[i]]};});var on=rt(ce=>{var fr=nn();ce.mul=function(e,i){let a=new Uint8Array(e.length+i.length-1);for(let l=0;l<e.length;l++)for(let h=0;h<i.length;h++)a[l+h]^=fr.mul(e[l],i[h]);return a};ce.mod=function(e,i){let a=new Uint8Array(e);for(;a.length-i.length>=0;){let l=a[0];for(let g=0;g<i.length;g++)a[g]^=fr.mul(i[g],l);let h=0;for(;h<a.length&&a[h]===0;)h++;a=a.slice(h);}return a};ce.generateECPolynomial=function(e){let i=new Uint8Array([1]);for(let a=0;a<e;a++)i=ce.mul(i,new Uint8Array([1,fr.exp(a)]));return i};});var an=rt((Uo,sn)=>{var fn=on();function sr(n){this.genPoly=void 0,this.degree=n,this.degree&&this.initialize(this.degree);}sr.prototype.initialize=function(e){this.degree=e,this.genPoly=fn.generateECPolynomial(this.degree);};sr.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let i=new Uint8Array(e.length+this.degree);i.set(e);let a=fn.mod(i,this.genPoly),l=this.degree-a.length;if(l>0){let h=new Uint8Array(this.degree);return h.set(a,l),h}return a};sn.exports=sr;});var ar=rt(cn=>{cn.isValid=function(e){return !isNaN(e)&&e>=1&&e<=40};});var cr=rt(Rt=>{var ln="[0-9]+",wi="[A-Z $%*+\\-./:]+",le="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";le=le.replace(/u/g,"\\u");var vi="(?:(?![A-Z0-9 $%*+\\-./:]|"+le+`)(?:.|[\r
2
- ]))+`;Rt.KANJI=new RegExp(le,"g");Rt.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");Rt.BYTE=new RegExp(vi,"g");Rt.NUMERIC=new RegExp(ln,"g");Rt.ALPHANUMERIC=new RegExp(wi,"g");var Ci=new RegExp("^"+le+"$"),Ei=new RegExp("^"+ln+"$"),Ai=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Rt.testKanji=function(e){return Ci.test(e)};Rt.testNumeric=function(e){return Ei.test(e)};Rt.testAlphanumeric=function(e){return Ai.test(e)};});var kt=rt(ht=>{var Si=ar(),lr=cr();ht.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};ht.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};ht.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};ht.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};ht.MIXED={bit:-1};ht.getCharCountIndicator=function(e,i){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!Si.isValid(i))throw new Error("Invalid version: "+i);return i>=1&&i<10?e.ccBits[0]:i<27?e.ccBits[1]:e.ccBits[2]};ht.getBestModeForData=function(e){return lr.testNumeric(e)?ht.NUMERIC:lr.testAlphanumeric(e)?ht.ALPHANUMERIC:lr.testKanji(e)?ht.KANJI:ht.BYTE};ht.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};ht.isValid=function(e){return e&&e.bit&&e.ccBits};function _i(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case "numeric":return ht.NUMERIC;case "alphanumeric":return ht.ALPHANUMERIC;case "kanji":return ht.KANJI;case "byte":return ht.BYTE;default:throw new Error("Unknown mode: "+n)}}ht.from=function(e,i){if(ht.isValid(e))return e;try{return _i(e)}catch{return i}};});var pn=rt(Ft=>{var Re=Pt(),Bi=or(),un=_e(),jt=kt(),ur=ar(),dn=7973,hn=Re.getBCHDigit(dn);function Mi(n,e,i){for(let a=1;a<=40;a++)if(e<=Ft.getCapacity(a,i,n))return a}function xn(n,e){return jt.getCharCountIndicator(n,e)+4}function Ti(n,e){let i=0;return n.forEach(function(a){let l=xn(a.mode,e);i+=l+a.getBitsLength();}),i}function Ii(n,e){for(let i=1;i<=40;i++)if(Ti(n,i)<=Ft.getCapacity(i,e,jt.MIXED))return i}Ft.from=function(e,i){return ur.isValid(e)?parseInt(e,10):i};Ft.getCapacity=function(e,i,a){if(!ur.isValid(e))throw new Error("Invalid QR Code version");typeof a>"u"&&(a=jt.BYTE);let l=Re.getSymbolTotalCodewords(e),h=Bi.getTotalCodewordsCount(e,i),g=(l-h)*8;if(a===jt.MIXED)return g;let y=g-xn(a,e);switch(a){case jt.NUMERIC:return Math.floor(y/10*3);case jt.ALPHANUMERIC:return Math.floor(y/11*2);case jt.KANJI:return Math.floor(y/13);case jt.BYTE:default:return Math.floor(y/8)}};Ft.getBestVersionForData=function(e,i){let a,l=un.from(i,un.M);if(Array.isArray(e)){if(e.length>1)return Ii(e,l);if(e.length===0)return 1;a=e[0];}else a=e;return Mi(a.mode,a.getLength(),l)};Ft.getEncodedBits=function(e){if(!ur.isValid(e)||e<7)throw new Error("Invalid QR Code version");let i=e<<12;for(;Re.getBCHDigit(i)-hn>=0;)i^=dn<<Re.getBCHDigit(i)-hn;return e<<12|i};});var mn=rt(bn=>{var hr=Pt(),yn=1335,Ui=21522,gn=hr.getBCHDigit(yn);bn.getEncodedBits=function(e,i){let a=e.bit<<3|i,l=a<<10;for(;hr.getBCHDigit(l)-gn>=0;)l^=yn<<hr.getBCHDigit(l)-gn;return (a<<10|l)^Ui};});var vn=rt((jo,wn)=>{var Ri=kt();function Qt(n){this.mode=Ri.NUMERIC,this.data=n.toString();}Qt.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Qt.prototype.getLength=function(){return this.data.length};Qt.prototype.getBitsLength=function(){return Qt.getBitsLength(this.data.length)};Qt.prototype.write=function(e){let i,a,l;for(i=0;i+3<=this.data.length;i+=3)a=this.data.substr(i,3),l=parseInt(a,10),e.put(l,10);let h=this.data.length-i;h>0&&(a=this.data.substr(i),l=parseInt(a,10),e.put(l,h*3+1));};wn.exports=Qt;});var En=rt((zo,Cn)=>{var Li=kt(),dr=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function Gt(n){this.mode=Li.ALPHANUMERIC,this.data=n;}Gt.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Gt.prototype.getLength=function(){return this.data.length};Gt.prototype.getBitsLength=function(){return Gt.getBitsLength(this.data.length)};Gt.prototype.write=function(e){let i;for(i=0;i+2<=this.data.length;i+=2){let a=dr.indexOf(this.data[i])*45;a+=dr.indexOf(this.data[i+1]),e.put(a,11);}this.data.length%2&&e.put(dr.indexOf(this.data[i]),6);};Cn.exports=Gt;});var Sn=rt((Do,An)=>{var Pi=kt();function Xt(n){this.mode=Pi.BYTE,typeof n=="string"?this.data=new TextEncoder().encode(n):this.data=new Uint8Array(n);}Xt.getBitsLength=function(e){return e*8};Xt.prototype.getLength=function(){return this.data.length};Xt.prototype.getBitsLength=function(){return Xt.getBitsLength(this.data.length)};Xt.prototype.write=function(n){for(let e=0,i=this.data.length;e<i;e++)n.put(this.data[e],8);};An.exports=Xt;});var Bn=rt((Oo,_n)=>{var Ni=kt(),ki=Pt();function te(n){this.mode=Ni.KANJI,this.data=n;}te.getBitsLength=function(e){return e*13};te.prototype.getLength=function(){return this.data.length};te.prototype.getBitsLength=function(){return te.getBitsLength(this.data.length)};te.prototype.write=function(n){let e;for(e=0;e<this.data.length;e++){let i=ki.toSJIS(this.data[e]);if(i>=33088&&i<=40956)i-=33088;else if(i>=57408&&i<=60351)i-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
3
- Make sure your charset is UTF-8`);i=(i>>>8&255)*192+(i&255),n.put(i,13);}};_n.exports=te;});var Mn=rt((qo,xr)=>{var ue={single_source_shortest_paths:function(n,e,i){var a={},l={};l[e]=0;var h=ue.PriorityQueue.make();h.push(e,0);for(var g,y,E,V,$,lt,it,mt,wt;!h.empty();){g=h.pop(),y=g.value,V=g.cost,$=n[y]||{};for(E in $)$.hasOwnProperty(E)&&(lt=$[E],it=V+lt,mt=l[E],wt=typeof l[E]>"u",(wt||mt>it)&&(l[E]=it,h.push(E,it),a[E]=y));}if(typeof i<"u"&&typeof l[i]>"u"){var vt=["Could not find a path from ",e," to ",i,"."].join("");throw new Error(vt)}return a},extract_shortest_path_from_predecessor_list:function(n,e){for(var i=[],a=e,l;a;)i.push(a),l=n[a],a=n[a];return i.reverse(),i},find_path:function(n,e,i){var a=ue.single_source_shortest_paths(n,e,i);return ue.extract_shortest_path_from_predecessor_list(a,i)},PriorityQueue:{make:function(n){var e=ue.PriorityQueue,i={},a;n=n||{};for(a in e)e.hasOwnProperty(a)&&(i[a]=e[a]);return i.queue=[],i.sorter=n.sorter||e.default_sorter,i},default_sorter:function(n,e){return n.cost-e.cost},push:function(n,e){var i={value:n,cost:e};this.queue.push(i),this.queue.sort(this.sorter);},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof xr<"u"&&(xr.exports=ue);});var kn=rt(ee=>{var nt=kt(),Un=vn(),Rn=En(),Ln=Sn(),Pn=Bn(),he=cr(),Le=Pt(),ji=Mn();function Tn(n){return unescape(encodeURIComponent(n)).length}function de(n,e,i){let a=[],l;for(;(l=n.exec(i))!==null;)a.push({data:l[0],index:l.index,mode:e,length:l[0].length});return a}function Nn(n){let e=de(he.NUMERIC,nt.NUMERIC,n),i=de(he.ALPHANUMERIC,nt.ALPHANUMERIC,n),a,l;return Le.isKanjiModeEnabled()?(a=de(he.BYTE,nt.BYTE,n),l=de(he.KANJI,nt.KANJI,n)):(a=de(he.BYTE_KANJI,nt.BYTE,n),l=[]),e.concat(i,a,l).sort(function(g,y){return g.index-y.index}).map(function(g){return {data:g.data,mode:g.mode,length:g.length}})}function pr(n,e){switch(e){case nt.NUMERIC:return Un.getBitsLength(n);case nt.ALPHANUMERIC:return Rn.getBitsLength(n);case nt.KANJI:return Pn.getBitsLength(n);case nt.BYTE:return Ln.getBitsLength(n)}}function zi(n){return n.reduce(function(e,i){let a=e.length-1>=0?e[e.length-1]:null;return a&&a.mode===i.mode?(e[e.length-1].data+=i.data,e):(e.push(i),e)},[])}function Di(n){let e=[];for(let i=0;i<n.length;i++){let a=n[i];switch(a.mode){case nt.NUMERIC:e.push([a,{data:a.data,mode:nt.ALPHANUMERIC,length:a.length},{data:a.data,mode:nt.BYTE,length:a.length}]);break;case nt.ALPHANUMERIC:e.push([a,{data:a.data,mode:nt.BYTE,length:a.length}]);break;case nt.KANJI:e.push([a,{data:a.data,mode:nt.BYTE,length:Tn(a.data)}]);break;case nt.BYTE:e.push([{data:a.data,mode:nt.BYTE,length:Tn(a.data)}]);}}return e}function Oi(n,e){let i={},a={start:{}},l=["start"];for(let h=0;h<n.length;h++){let g=n[h],y=[];for(let E=0;E<g.length;E++){let V=g[E],$=""+h+E;y.push($),i[$]={node:V,lastCount:0},a[$]={};for(let lt=0;lt<l.length;lt++){let it=l[lt];i[it]&&i[it].node.mode===V.mode?(a[it][$]=pr(i[it].lastCount+V.length,V.mode)-pr(i[it].lastCount,V.mode),i[it].lastCount+=V.length):(i[it]&&(i[it].lastCount=V.length),a[it][$]=pr(V.length,V.mode)+4+nt.getCharCountIndicator(V.mode,e));}}l=y;}for(let h=0;h<l.length;h++)a[l[h]].end=0;return {map:a,table:i}}function In(n,e){let i,a=nt.getBestModeForData(n);if(i=nt.from(e,a),i!==nt.BYTE&&i.bit<a.bit)throw new Error('"'+n+'" cannot be encoded with mode '+nt.toString(i)+`.
4
- Suggested mode is: `+nt.toString(a));switch(i===nt.KANJI&&!Le.isKanjiModeEnabled()&&(i=nt.BYTE),i){case nt.NUMERIC:return new Un(n);case nt.ALPHANUMERIC:return new Rn(n);case nt.KANJI:return new Pn(n);case nt.BYTE:return new Ln(n)}}ee.fromArray=function(e){return e.reduce(function(i,a){return typeof a=="string"?i.push(In(a,null)):a.data&&i.push(In(a.data,a.mode)),i},[])};ee.fromString=function(e,i){let a=Nn(e,Le.isKanjiModeEnabled()),l=Di(a),h=Oi(l,i),g=ji.find_path(h.map,"start","end"),y=[];for(let E=1;E<g.length-1;E++)y.push(h.table[g[E]].node);return ee.fromArray(zi(y))};ee.rawSplit=function(e){return ee.fromArray(Nn(e,Le.isKanjiModeEnabled()))};});var zn=rt(jn=>{var Ne=Pt(),gr=_e(),qi=Jr(),Yi=Qr(),Fi=Gr(),Ki=en(),mr=rn(),wr=or(),$i=an(),Pe=pn(),Hi=mn(),Vi=kt(),yr=kn();function Wi(n,e){let i=n.size,a=Ki.getPositions(e);for(let l=0;l<a.length;l++){let h=a[l][0],g=a[l][1];for(let y=-1;y<=7;y++)if(!(h+y<=-1||i<=h+y))for(let E=-1;E<=7;E++)g+E<=-1||i<=g+E||(y>=0&&y<=6&&(E===0||E===6)||E>=0&&E<=6&&(y===0||y===6)||y>=2&&y<=4&&E>=2&&E<=4?n.set(h+y,g+E,true,true):n.set(h+y,g+E,false,true));}}function Ji(n){let e=n.size;for(let i=8;i<e-8;i++){let a=i%2===0;n.set(i,6,a,true),n.set(6,i,a,true);}}function Zi(n,e){let i=Fi.getPositions(e);for(let a=0;a<i.length;a++){let l=i[a][0],h=i[a][1];for(let g=-2;g<=2;g++)for(let y=-2;y<=2;y++)g===-2||g===2||y===-2||y===2||g===0&&y===0?n.set(l+g,h+y,true,true):n.set(l+g,h+y,false,true);}}function Qi(n,e){let i=n.size,a=Pe.getEncodedBits(e),l,h,g;for(let y=0;y<18;y++)l=Math.floor(y/3),h=y%3+i-8-3,g=(a>>y&1)===1,n.set(l,h,g,true),n.set(h,l,g,true);}function br(n,e,i){let a=n.size,l=Hi.getEncodedBits(e,i),h,g;for(h=0;h<15;h++)g=(l>>h&1)===1,h<6?n.set(h,8,g,true):h<8?n.set(h+1,8,g,true):n.set(a-15+h,8,g,true),h<8?n.set(8,a-h-1,g,true):h<9?n.set(8,15-h-1+1,g,true):n.set(8,15-h-1,g,true);n.set(a-8,8,1,true);}function Gi(n,e){let i=n.size,a=-1,l=i-1,h=7,g=0;for(let y=i-1;y>0;y-=2)for(y===6&&y--;;){for(let E=0;E<2;E++)if(!n.isReserved(l,y-E)){let V=false;g<e.length&&(V=(e[g]>>>h&1)===1),n.set(l,y-E,V),h--,h===-1&&(g++,h=7);}if(l+=a,l<0||i<=l){l-=a,a=-a;break}}}function Xi(n,e,i){let a=new qi;i.forEach(function(E){a.put(E.mode.bit,4),a.put(E.getLength(),Vi.getCharCountIndicator(E.mode,n)),E.write(a);});let l=Ne.getSymbolTotalCodewords(n),h=wr.getTotalCodewordsCount(n,e),g=(l-h)*8;for(a.getLengthInBits()+4<=g&&a.put(0,4);a.getLengthInBits()%8!==0;)a.putBit(0);let y=(g-a.getLengthInBits())/8;for(let E=0;E<y;E++)a.put(E%2?17:236,8);return to(a,n,e)}function to(n,e,i){let a=Ne.getSymbolTotalCodewords(e),l=wr.getTotalCodewordsCount(e,i),h=a-l,g=wr.getBlocksCount(e,i),y=a%g,E=g-y,V=Math.floor(a/g),$=Math.floor(h/g),lt=$+1,it=V-$,mt=new $i(it),wt=0,vt=new Array(g),Lt=new Array(g),zt=0,re=new Uint8Array(n.buffer);for(let pt=0;pt<g;pt++){let Ht=pt<E?$:lt;vt[pt]=re.slice(wt,wt+Ht),Lt[pt]=mt.encode(vt[pt]),wt+=Ht,zt=Math.max(zt,Ht);}let Bt=new Uint8Array(a),Tt=0,dt,J;for(dt=0;dt<zt;dt++)for(J=0;J<g;J++)dt<vt[J].length&&(Bt[Tt++]=vt[J][dt]);for(dt=0;dt<it;dt++)for(J=0;J<g;J++)Bt[Tt++]=Lt[J][dt];return Bt}function eo(n,e,i,a){let l;if(Array.isArray(n))l=yr.fromArray(n);else if(typeof n=="string"){let V=e;if(!V){let $=yr.rawSplit(n);V=Pe.getBestVersionForData($,i);}l=yr.fromString(n,V||40);}else throw new Error("Invalid data");let h=Pe.getBestVersionForData(l,i);if(!h)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=h;else if(e<h)throw new Error(`
1
+ var ai=Object.create;var qr=Object.defineProperty;var ci=Object.getOwnPropertyDescriptor;var li=Object.getOwnPropertyNames;var ui=Object.getPrototypeOf,hi=Object.prototype.hasOwnProperty;var rr=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var rt=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var di=(n,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of li(e))!hi.call(n,c)&&c!==i&&qr(n,c,{get:()=>e[c],enumerable:!(a=ci(e,c))||a.enumerable});return n};var xi=(n,e,i)=>(i=n!=null?ai(ui(n)):{},di(!n||!n.__esModule?qr(i,"default",{value:n,enumerable:true}):i,n));var Kr=rt((bo,Se)=>{(function(n){var e=function(r){var s,o=new Float64Array(16);if(r)for(s=0;s<r.length;s++)o[s]=r[s];return o},i=function(){throw new Error("no PRNG")},a=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var u=e(),g=e([1]),y=e([56129,1]),C=e([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),D=e([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),q=e([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),ft=e([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),it=e([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function bt(r,s,o,t){r[s]=o>>24&255,r[s+1]=o>>16&255,r[s+2]=o>>8&255,r[s+3]=o&255,r[s+4]=t>>24&255,r[s+5]=t>>16&255,r[s+6]=t>>8&255,r[s+7]=t&255;}function wt(r,s,o,t,f){var h,d=0;for(h=0;h<f;h++)d|=r[s+h]^o[t+h];return (1&d-1>>>8)-1}function vt(r,s,o,t){return wt(r,s,o,t,16)}function Pt(r,s,o,t){return wt(r,s,o,t,32)}function Dt(r,s,o,t){for(var f=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,h=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,d=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,w=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,A=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,R=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,_=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,X=s[4]&255|(s[5]&255)<<8|(s[6]&255)<<16|(s[7]&255)<<24,B=s[8]&255|(s[9]&255)<<8|(s[10]&255)<<16|(s[11]&255)<<24,N=s[12]&255|(s[13]&255)<<8|(s[14]&255)<<16|(s[15]&255)<<24,k=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,F=o[16]&255|(o[17]&255)<<8|(o[18]&255)<<16|(o[19]&255)<<24,K=o[20]&255|(o[21]&255)<<8|(o[22]&255)<<16|(o[23]&255)<<24,j=o[24]&255|(o[25]&255)<<8|(o[26]&255)<<16|(o[27]&255)<<24,O=o[28]&255|(o[29]&255)<<8|(o[30]&255)<<16|(o[31]&255)<<24,z=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,T=f,L=h,M=d,I=w,U=A,S=R,x=_,p=X,v=B,b=N,m=k,E=F,P=K,Y=j,H=O,$=z,l,W=0;W<20;W+=2)l=T+P|0,U^=l<<7|l>>>25,l=U+T|0,v^=l<<9|l>>>23,l=v+U|0,P^=l<<13|l>>>19,l=P+v|0,T^=l<<18|l>>>14,l=S+L|0,b^=l<<7|l>>>25,l=b+S|0,Y^=l<<9|l>>>23,l=Y+b|0,L^=l<<13|l>>>19,l=L+Y|0,S^=l<<18|l>>>14,l=m+x|0,H^=l<<7|l>>>25,l=H+m|0,M^=l<<9|l>>>23,l=M+H|0,x^=l<<13|l>>>19,l=x+M|0,m^=l<<18|l>>>14,l=$+E|0,I^=l<<7|l>>>25,l=I+$|0,p^=l<<9|l>>>23,l=p+I|0,E^=l<<13|l>>>19,l=E+p|0,$^=l<<18|l>>>14,l=T+I|0,L^=l<<7|l>>>25,l=L+T|0,M^=l<<9|l>>>23,l=M+L|0,I^=l<<13|l>>>19,l=I+M|0,T^=l<<18|l>>>14,l=S+U|0,x^=l<<7|l>>>25,l=x+S|0,p^=l<<9|l>>>23,l=p+x|0,U^=l<<13|l>>>19,l=U+p|0,S^=l<<18|l>>>14,l=m+b|0,E^=l<<7|l>>>25,l=E+m|0,v^=l<<9|l>>>23,l=v+E|0,b^=l<<13|l>>>19,l=b+v|0,m^=l<<18|l>>>14,l=$+H|0,P^=l<<7|l>>>25,l=P+$|0,Y^=l<<9|l>>>23,l=Y+P|0,H^=l<<13|l>>>19,l=H+Y|0,$^=l<<18|l>>>14;T=T+f|0,L=L+h|0,M=M+d|0,I=I+w|0,U=U+A|0,S=S+R|0,x=x+_|0,p=p+X|0,v=v+B|0,b=b+N|0,m=m+k|0,E=E+F|0,P=P+K|0,Y=Y+j|0,H=H+O|0,$=$+z|0,r[0]=T>>>0&255,r[1]=T>>>8&255,r[2]=T>>>16&255,r[3]=T>>>24&255,r[4]=L>>>0&255,r[5]=L>>>8&255,r[6]=L>>>16&255,r[7]=L>>>24&255,r[8]=M>>>0&255,r[9]=M>>>8&255,r[10]=M>>>16&255,r[11]=M>>>24&255,r[12]=I>>>0&255,r[13]=I>>>8&255,r[14]=I>>>16&255,r[15]=I>>>24&255,r[16]=U>>>0&255,r[17]=U>>>8&255,r[18]=U>>>16&255,r[19]=U>>>24&255,r[20]=S>>>0&255,r[21]=S>>>8&255,r[22]=S>>>16&255,r[23]=S>>>24&255,r[24]=x>>>0&255,r[25]=x>>>8&255,r[26]=x>>>16&255,r[27]=x>>>24&255,r[28]=p>>>0&255,r[29]=p>>>8&255,r[30]=p>>>16&255,r[31]=p>>>24&255,r[32]=v>>>0&255,r[33]=v>>>8&255,r[34]=v>>>16&255,r[35]=v>>>24&255,r[36]=b>>>0&255,r[37]=b>>>8&255,r[38]=b>>>16&255,r[39]=b>>>24&255,r[40]=m>>>0&255,r[41]=m>>>8&255,r[42]=m>>>16&255,r[43]=m>>>24&255,r[44]=E>>>0&255,r[45]=E>>>8&255,r[46]=E>>>16&255,r[47]=E>>>24&255,r[48]=P>>>0&255,r[49]=P>>>8&255,r[50]=P>>>16&255,r[51]=P>>>24&255,r[52]=Y>>>0&255,r[53]=Y>>>8&255,r[54]=Y>>>16&255,r[55]=Y>>>24&255,r[56]=H>>>0&255,r[57]=H>>>8&255,r[58]=H>>>16&255,r[59]=H>>>24&255,r[60]=$>>>0&255,r[61]=$>>>8&255,r[62]=$>>>16&255,r[63]=$>>>24&255;}function ne(r,s,o,t){for(var f=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,h=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,d=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,w=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,A=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,R=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,_=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,X=s[4]&255|(s[5]&255)<<8|(s[6]&255)<<16|(s[7]&255)<<24,B=s[8]&255|(s[9]&255)<<8|(s[10]&255)<<16|(s[11]&255)<<24,N=s[12]&255|(s[13]&255)<<8|(s[14]&255)<<16|(s[15]&255)<<24,k=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,F=o[16]&255|(o[17]&255)<<8|(o[18]&255)<<16|(o[19]&255)<<24,K=o[20]&255|(o[21]&255)<<8|(o[22]&255)<<16|(o[23]&255)<<24,j=o[24]&255|(o[25]&255)<<8|(o[26]&255)<<16|(o[27]&255)<<24,O=o[28]&255|(o[29]&255)<<8|(o[30]&255)<<16|(o[31]&255)<<24,z=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,T=f,L=h,M=d,I=w,U=A,S=R,x=_,p=X,v=B,b=N,m=k,E=F,P=K,Y=j,H=O,$=z,l,W=0;W<20;W+=2)l=T+P|0,U^=l<<7|l>>>25,l=U+T|0,v^=l<<9|l>>>23,l=v+U|0,P^=l<<13|l>>>19,l=P+v|0,T^=l<<18|l>>>14,l=S+L|0,b^=l<<7|l>>>25,l=b+S|0,Y^=l<<9|l>>>23,l=Y+b|0,L^=l<<13|l>>>19,l=L+Y|0,S^=l<<18|l>>>14,l=m+x|0,H^=l<<7|l>>>25,l=H+m|0,M^=l<<9|l>>>23,l=M+H|0,x^=l<<13|l>>>19,l=x+M|0,m^=l<<18|l>>>14,l=$+E|0,I^=l<<7|l>>>25,l=I+$|0,p^=l<<9|l>>>23,l=p+I|0,E^=l<<13|l>>>19,l=E+p|0,$^=l<<18|l>>>14,l=T+I|0,L^=l<<7|l>>>25,l=L+T|0,M^=l<<9|l>>>23,l=M+L|0,I^=l<<13|l>>>19,l=I+M|0,T^=l<<18|l>>>14,l=S+U|0,x^=l<<7|l>>>25,l=x+S|0,p^=l<<9|l>>>23,l=p+x|0,U^=l<<13|l>>>19,l=U+p|0,S^=l<<18|l>>>14,l=m+b|0,E^=l<<7|l>>>25,l=E+m|0,v^=l<<9|l>>>23,l=v+E|0,b^=l<<13|l>>>19,l=b+v|0,m^=l<<18|l>>>14,l=$+H|0,P^=l<<7|l>>>25,l=P+$|0,Y^=l<<9|l>>>23,l=Y+P|0,H^=l<<13|l>>>19,l=H+Y|0,$^=l<<18|l>>>14;r[0]=T>>>0&255,r[1]=T>>>8&255,r[2]=T>>>16&255,r[3]=T>>>24&255,r[4]=S>>>0&255,r[5]=S>>>8&255,r[6]=S>>>16&255,r[7]=S>>>24&255,r[8]=m>>>0&255,r[9]=m>>>8&255,r[10]=m>>>16&255,r[11]=m>>>24&255,r[12]=$>>>0&255,r[13]=$>>>8&255,r[14]=$>>>16&255,r[15]=$>>>24&255,r[16]=x>>>0&255,r[17]=x>>>8&255,r[18]=x>>>16&255,r[19]=x>>>24&255,r[20]=p>>>0&255,r[21]=p>>>8&255,r[22]=p>>>16&255,r[23]=p>>>24&255,r[24]=v>>>0&255,r[25]=v>>>8&255,r[26]=v>>>16&255,r[27]=v>>>24&255,r[28]=b>>>0&255,r[29]=b>>>8&255,r[30]=b>>>16&255,r[31]=b>>>24&255;}function Bt(r,s,o,t){Dt(r,s,o,t);}function It(r,s,o,t){ne(r,s,o,t);}var dt=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function mt(r,s,o,t,f,h,d){var w=new Uint8Array(16),A=new Uint8Array(64),R,_;for(_=0;_<16;_++)w[_]=0;for(_=0;_<8;_++)w[_]=h[_];for(;f>=64;){for(Bt(A,w,d,dt),_=0;_<64;_++)r[s+_]=o[t+_]^A[_];for(R=1,_=8;_<16;_++)R=R+(w[_]&255)|0,w[_]=R&255,R>>>=8;f-=64,s+=64,t+=64;}if(f>0)for(Bt(A,w,d,dt),_=0;_<f;_++)r[s+_]=o[t+_]^A[_];return 0}function J(r,s,o,t,f){var h=new Uint8Array(16),d=new Uint8Array(64),w,A;for(A=0;A<16;A++)h[A]=0;for(A=0;A<8;A++)h[A]=t[A];for(;o>=64;){for(Bt(d,h,f,dt),A=0;A<64;A++)r[s+A]=d[A];for(w=1,A=8;A<16;A++)w=w+(h[A]&255)|0,h[A]=w&255,w>>>=8;o-=64,s+=64;}if(o>0)for(Bt(d,h,f,dt),A=0;A<o;A++)r[s+A]=d[A];return 0}function Ct(r,s,o,t,f){var h=new Uint8Array(32);It(h,t,f,dt);for(var d=new Uint8Array(8),w=0;w<8;w++)d[w]=t[w+16];return J(r,s,o,d,h)}function Vt(r,s,o,t,f,h,d){var w=new Uint8Array(32);It(w,h,d,dt);for(var A=new Uint8Array(8),R=0;R<8;R++)A[R]=h[R+16];return mt(r,s,o,t,f,A,w)}var ge=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 s,o,t,f,h,d,w,A;s=r[0]&255|(r[1]&255)<<8,this.r[0]=s&8191,o=r[2]&255|(r[3]&255)<<8,this.r[1]=(s>>>13|o<<3)&8191,t=r[4]&255|(r[5]&255)<<8,this.r[2]=(o>>>10|t<<6)&7939,f=r[6]&255|(r[7]&255)<<8,this.r[3]=(t>>>7|f<<9)&8191,h=r[8]&255|(r[9]&255)<<8,this.r[4]=(f>>>4|h<<12)&255,this.r[5]=h>>>1&8190,d=r[10]&255|(r[11]&255)<<8,this.r[6]=(h>>>14|d<<2)&8191,w=r[12]&255|(r[13]&255)<<8,this.r[7]=(d>>>11|w<<5)&8065,A=r[14]&255|(r[15]&255)<<8,this.r[8]=(w>>>8|A<<8)&8191,this.r[9]=A>>>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;};ge.prototype.blocks=function(r,s,o){for(var t=this.fin?0:2048,f,h,d,w,A,R,_,X,B,N,k,F,K,j,O,z,T,L,M,I=this.h[0],U=this.h[1],S=this.h[2],x=this.h[3],p=this.h[4],v=this.h[5],b=this.h[6],m=this.h[7],E=this.h[8],P=this.h[9],Y=this.r[0],H=this.r[1],$=this.r[2],l=this.r[3],W=this.r[4],tt=this.r[5],et=this.r[6],V=this.r[7],Q=this.r[8],G=this.r[9];o>=16;)f=r[s+0]&255|(r[s+1]&255)<<8,I+=f&8191,h=r[s+2]&255|(r[s+3]&255)<<8,U+=(f>>>13|h<<3)&8191,d=r[s+4]&255|(r[s+5]&255)<<8,S+=(h>>>10|d<<6)&8191,w=r[s+6]&255|(r[s+7]&255)<<8,x+=(d>>>7|w<<9)&8191,A=r[s+8]&255|(r[s+9]&255)<<8,p+=(w>>>4|A<<12)&8191,v+=A>>>1&8191,R=r[s+10]&255|(r[s+11]&255)<<8,b+=(A>>>14|R<<2)&8191,_=r[s+12]&255|(r[s+13]&255)<<8,m+=(R>>>11|_<<5)&8191,X=r[s+14]&255|(r[s+15]&255)<<8,E+=(_>>>8|X<<8)&8191,P+=X>>>5|t,B=0,N=B,N+=I*Y,N+=U*(5*G),N+=S*(5*Q),N+=x*(5*V),N+=p*(5*et),B=N>>>13,N&=8191,N+=v*(5*tt),N+=b*(5*W),N+=m*(5*l),N+=E*(5*$),N+=P*(5*H),B+=N>>>13,N&=8191,k=B,k+=I*H,k+=U*Y,k+=S*(5*G),k+=x*(5*Q),k+=p*(5*V),B=k>>>13,k&=8191,k+=v*(5*et),k+=b*(5*tt),k+=m*(5*W),k+=E*(5*l),k+=P*(5*$),B+=k>>>13,k&=8191,F=B,F+=I*$,F+=U*H,F+=S*Y,F+=x*(5*G),F+=p*(5*Q),B=F>>>13,F&=8191,F+=v*(5*V),F+=b*(5*et),F+=m*(5*tt),F+=E*(5*W),F+=P*(5*l),B+=F>>>13,F&=8191,K=B,K+=I*l,K+=U*$,K+=S*H,K+=x*Y,K+=p*(5*G),B=K>>>13,K&=8191,K+=v*(5*Q),K+=b*(5*V),K+=m*(5*et),K+=E*(5*tt),K+=P*(5*W),B+=K>>>13,K&=8191,j=B,j+=I*W,j+=U*l,j+=S*$,j+=x*H,j+=p*Y,B=j>>>13,j&=8191,j+=v*(5*G),j+=b*(5*Q),j+=m*(5*V),j+=E*(5*et),j+=P*(5*tt),B+=j>>>13,j&=8191,O=B,O+=I*tt,O+=U*W,O+=S*l,O+=x*$,O+=p*H,B=O>>>13,O&=8191,O+=v*Y,O+=b*(5*G),O+=m*(5*Q),O+=E*(5*V),O+=P*(5*et),B+=O>>>13,O&=8191,z=B,z+=I*et,z+=U*tt,z+=S*W,z+=x*l,z+=p*$,B=z>>>13,z&=8191,z+=v*H,z+=b*Y,z+=m*(5*G),z+=E*(5*Q),z+=P*(5*V),B+=z>>>13,z&=8191,T=B,T+=I*V,T+=U*et,T+=S*tt,T+=x*W,T+=p*l,B=T>>>13,T&=8191,T+=v*$,T+=b*H,T+=m*Y,T+=E*(5*G),T+=P*(5*Q),B+=T>>>13,T&=8191,L=B,L+=I*Q,L+=U*V,L+=S*et,L+=x*tt,L+=p*W,B=L>>>13,L&=8191,L+=v*l,L+=b*$,L+=m*H,L+=E*Y,L+=P*(5*G),B+=L>>>13,L&=8191,M=B,M+=I*G,M+=U*Q,M+=S*V,M+=x*et,M+=p*tt,B=M>>>13,M&=8191,M+=v*W,M+=b*l,M+=m*$,M+=E*H,M+=P*Y,B+=M>>>13,M&=8191,B=(B<<2)+B|0,B=B+N|0,N=B&8191,B=B>>>13,k+=B,I=N,U=k,S=F,x=K,p=j,v=O,b=z,m=T,E=L,P=M,s+=16,o-=16;this.h[0]=I,this.h[1]=U,this.h[2]=S,this.h[3]=x,this.h[4]=p,this.h[5]=v,this.h[6]=b,this.h[7]=m,this.h[8]=E,this.h[9]=P;},ge.prototype.finish=function(r,s){var o=new Uint16Array(10),t,f,h,d;if(this.leftover){for(d=this.leftover,this.buffer[d++]=1;d<16;d++)this.buffer[d]=0;this.fin=1,this.blocks(this.buffer,0,16);}for(t=this.h[1]>>>13,this.h[1]&=8191,d=2;d<10;d++)this.h[d]+=t,t=this.h[d]>>>13,this.h[d]&=8191;for(this.h[0]+=t*5,t=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=t,t=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=t,o[0]=this.h[0]+5,t=o[0]>>>13,o[0]&=8191,d=1;d<10;d++)o[d]=this.h[d]+t,t=o[d]>>>13,o[d]&=8191;for(o[9]-=8192,f=(t^1)-1,d=0;d<10;d++)o[d]&=f;for(f=~f,d=0;d<10;d++)this.h[d]=this.h[d]&f|o[d];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,h=this.h[0]+this.pad[0],this.h[0]=h&65535,d=1;d<8;d++)h=(this.h[d]+this.pad[d]|0)+(h>>>16)|0,this.h[d]=h&65535;r[s+0]=this.h[0]>>>0&255,r[s+1]=this.h[0]>>>8&255,r[s+2]=this.h[1]>>>0&255,r[s+3]=this.h[1]>>>8&255,r[s+4]=this.h[2]>>>0&255,r[s+5]=this.h[2]>>>8&255,r[s+6]=this.h[3]>>>0&255,r[s+7]=this.h[3]>>>8&255,r[s+8]=this.h[4]>>>0&255,r[s+9]=this.h[4]>>>8&255,r[s+10]=this.h[5]>>>0&255,r[s+11]=this.h[5]>>>8&255,r[s+12]=this.h[6]>>>0&255,r[s+13]=this.h[6]>>>8&255,r[s+14]=this.h[7]>>>0&255,r[s+15]=this.h[7]>>>8&255;},ge.prototype.update=function(r,s,o){var t,f;if(this.leftover){for(f=16-this.leftover,f>o&&(f=o),t=0;t<f;t++)this.buffer[this.leftover+t]=r[s+t];if(o-=f,s+=f,this.leftover+=f,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0;}if(o>=16&&(f=o-o%16,this.blocks(r,s,f),s+=f,o-=f),o){for(t=0;t<o;t++)this.buffer[this.leftover+t]=r[s+t];this.leftover+=o;}};function qe(r,s,o,t,f,h){var d=new ge(h);return d.update(o,t,f),d.finish(r,s),0}function Mr(r,s,o,t,f,h){var d=new Uint8Array(16);return qe(d,0,o,t,f,h),vt(r,s,d,0)}function Ke(r,s,o,t,f){var h;if(o<32)return -1;for(Vt(r,0,s,0,o,t,f),qe(r,16,r,32,o-32,r),h=0;h<16;h++)r[h]=0;return 0}function Fe(r,s,o,t,f){var h,d=new Uint8Array(32);if(o<32||(Ct(d,0,32,t,f),Mr(s,16,s,32,o-32,d)!==0))return -1;for(Vt(r,0,s,0,o,t,f),h=0;h<32;h++)r[h]=0;return 0}function Ut(r,s){var o;for(o=0;o<16;o++)r[o]=s[o]|0;}function Ye(r){var s,o,t=1;for(s=0;s<16;s++)o=r[s]+t+65535,t=Math.floor(o/65536),r[s]=o-t*65536;r[0]+=t-1+37*(t-1);}function Wt(r,s,o){for(var t,f=~(o-1),h=0;h<16;h++)t=f&(r[h]^s[h]),r[h]^=t,s[h]^=t;}function Jt(r,s){var o,t,f,h=e(),d=e();for(o=0;o<16;o++)d[o]=s[o];for(Ye(d),Ye(d),Ye(d),t=0;t<2;t++){for(h[0]=d[0]-65517,o=1;o<15;o++)h[o]=d[o]-65535-(h[o-1]>>16&1),h[o-1]&=65535;h[15]=d[15]-32767-(h[14]>>16&1),f=h[15]>>16&1,h[14]&=65535,Wt(d,h,1-f);}for(o=0;o<16;o++)r[2*o]=d[o]&255,r[2*o+1]=d[o]>>8;}function Br(r,s){var o=new Uint8Array(32),t=new Uint8Array(32);return Jt(o,r),Jt(t,s),Pt(o,0,t,0)}function Tr(r){var s=new Uint8Array(32);return Jt(s,r),s[0]&1}function $e(r,s){var o;for(o=0;o<16;o++)r[o]=s[2*o]+(s[2*o+1]<<8);r[15]&=32767;}function _t(r,s,o){for(var t=0;t<16;t++)r[t]=s[t]+o[t];}function Mt(r,s,o){for(var t=0;t<16;t++)r[t]=s[t]-o[t];}function Z(r,s,o){var t,f,h=0,d=0,w=0,A=0,R=0,_=0,X=0,B=0,N=0,k=0,F=0,K=0,j=0,O=0,z=0,T=0,L=0,M=0,I=0,U=0,S=0,x=0,p=0,v=0,b=0,m=0,E=0,P=0,Y=0,H=0,$=0,l=o[0],W=o[1],tt=o[2],et=o[3],V=o[4],Q=o[5],G=o[6],ut=o[7],ot=o[8],at=o[9],ct=o[10],lt=o[11],xt=o[12],pt=o[13],gt=o[14],yt=o[15];t=s[0],h+=t*l,d+=t*W,w+=t*tt,A+=t*et,R+=t*V,_+=t*Q,X+=t*G,B+=t*ut,N+=t*ot,k+=t*at,F+=t*ct,K+=t*lt,j+=t*xt,O+=t*pt,z+=t*gt,T+=t*yt,t=s[1],d+=t*l,w+=t*W,A+=t*tt,R+=t*et,_+=t*V,X+=t*Q,B+=t*G,N+=t*ut,k+=t*ot,F+=t*at,K+=t*ct,j+=t*lt,O+=t*xt,z+=t*pt,T+=t*gt,L+=t*yt,t=s[2],w+=t*l,A+=t*W,R+=t*tt,_+=t*et,X+=t*V,B+=t*Q,N+=t*G,k+=t*ut,F+=t*ot,K+=t*at,j+=t*ct,O+=t*lt,z+=t*xt,T+=t*pt,L+=t*gt,M+=t*yt,t=s[3],A+=t*l,R+=t*W,_+=t*tt,X+=t*et,B+=t*V,N+=t*Q,k+=t*G,F+=t*ut,K+=t*ot,j+=t*at,O+=t*ct,z+=t*lt,T+=t*xt,L+=t*pt,M+=t*gt,I+=t*yt,t=s[4],R+=t*l,_+=t*W,X+=t*tt,B+=t*et,N+=t*V,k+=t*Q,F+=t*G,K+=t*ut,j+=t*ot,O+=t*at,z+=t*ct,T+=t*lt,L+=t*xt,M+=t*pt,I+=t*gt,U+=t*yt,t=s[5],_+=t*l,X+=t*W,B+=t*tt,N+=t*et,k+=t*V,F+=t*Q,K+=t*G,j+=t*ut,O+=t*ot,z+=t*at,T+=t*ct,L+=t*lt,M+=t*xt,I+=t*pt,U+=t*gt,S+=t*yt,t=s[6],X+=t*l,B+=t*W,N+=t*tt,k+=t*et,F+=t*V,K+=t*Q,j+=t*G,O+=t*ut,z+=t*ot,T+=t*at,L+=t*ct,M+=t*lt,I+=t*xt,U+=t*pt,S+=t*gt,x+=t*yt,t=s[7],B+=t*l,N+=t*W,k+=t*tt,F+=t*et,K+=t*V,j+=t*Q,O+=t*G,z+=t*ut,T+=t*ot,L+=t*at,M+=t*ct,I+=t*lt,U+=t*xt,S+=t*pt,x+=t*gt,p+=t*yt,t=s[8],N+=t*l,k+=t*W,F+=t*tt,K+=t*et,j+=t*V,O+=t*Q,z+=t*G,T+=t*ut,L+=t*ot,M+=t*at,I+=t*ct,U+=t*lt,S+=t*xt,x+=t*pt,p+=t*gt,v+=t*yt,t=s[9],k+=t*l,F+=t*W,K+=t*tt,j+=t*et,O+=t*V,z+=t*Q,T+=t*G,L+=t*ut,M+=t*ot,I+=t*at,U+=t*ct,S+=t*lt,x+=t*xt,p+=t*pt,v+=t*gt,b+=t*yt,t=s[10],F+=t*l,K+=t*W,j+=t*tt,O+=t*et,z+=t*V,T+=t*Q,L+=t*G,M+=t*ut,I+=t*ot,U+=t*at,S+=t*ct,x+=t*lt,p+=t*xt,v+=t*pt,b+=t*gt,m+=t*yt,t=s[11],K+=t*l,j+=t*W,O+=t*tt,z+=t*et,T+=t*V,L+=t*Q,M+=t*G,I+=t*ut,U+=t*ot,S+=t*at,x+=t*ct,p+=t*lt,v+=t*xt,b+=t*pt,m+=t*gt,E+=t*yt,t=s[12],j+=t*l,O+=t*W,z+=t*tt,T+=t*et,L+=t*V,M+=t*Q,I+=t*G,U+=t*ut,S+=t*ot,x+=t*at,p+=t*ct,v+=t*lt,b+=t*xt,m+=t*pt,E+=t*gt,P+=t*yt,t=s[13],O+=t*l,z+=t*W,T+=t*tt,L+=t*et,M+=t*V,I+=t*Q,U+=t*G,S+=t*ut,x+=t*ot,p+=t*at,v+=t*ct,b+=t*lt,m+=t*xt,E+=t*pt,P+=t*gt,Y+=t*yt,t=s[14],z+=t*l,T+=t*W,L+=t*tt,M+=t*et,I+=t*V,U+=t*Q,S+=t*G,x+=t*ut,p+=t*ot,v+=t*at,b+=t*ct,m+=t*lt,E+=t*xt,P+=t*pt,Y+=t*gt,H+=t*yt,t=s[15],T+=t*l,L+=t*W,M+=t*tt,I+=t*et,U+=t*V,S+=t*Q,x+=t*G,p+=t*ut,v+=t*ot,b+=t*at,m+=t*ct,E+=t*lt,P+=t*xt,Y+=t*pt,H+=t*gt,$+=t*yt,h+=38*L,d+=38*M,w+=38*I,A+=38*U,R+=38*S,_+=38*x,X+=38*p,B+=38*v,N+=38*b,k+=38*m,F+=38*E,K+=38*P,j+=38*Y,O+=38*H,z+=38*$,f=1,t=h+f+65535,f=Math.floor(t/65536),h=t-f*65536,t=d+f+65535,f=Math.floor(t/65536),d=t-f*65536,t=w+f+65535,f=Math.floor(t/65536),w=t-f*65536,t=A+f+65535,f=Math.floor(t/65536),A=t-f*65536,t=R+f+65535,f=Math.floor(t/65536),R=t-f*65536,t=_+f+65535,f=Math.floor(t/65536),_=t-f*65536,t=X+f+65535,f=Math.floor(t/65536),X=t-f*65536,t=B+f+65535,f=Math.floor(t/65536),B=t-f*65536,t=N+f+65535,f=Math.floor(t/65536),N=t-f*65536,t=k+f+65535,f=Math.floor(t/65536),k=t-f*65536,t=F+f+65535,f=Math.floor(t/65536),F=t-f*65536,t=K+f+65535,f=Math.floor(t/65536),K=t-f*65536,t=j+f+65535,f=Math.floor(t/65536),j=t-f*65536,t=O+f+65535,f=Math.floor(t/65536),O=t-f*65536,t=z+f+65535,f=Math.floor(t/65536),z=t-f*65536,t=T+f+65535,f=Math.floor(t/65536),T=t-f*65536,h+=f-1+37*(f-1),f=1,t=h+f+65535,f=Math.floor(t/65536),h=t-f*65536,t=d+f+65535,f=Math.floor(t/65536),d=t-f*65536,t=w+f+65535,f=Math.floor(t/65536),w=t-f*65536,t=A+f+65535,f=Math.floor(t/65536),A=t-f*65536,t=R+f+65535,f=Math.floor(t/65536),R=t-f*65536,t=_+f+65535,f=Math.floor(t/65536),_=t-f*65536,t=X+f+65535,f=Math.floor(t/65536),X=t-f*65536,t=B+f+65535,f=Math.floor(t/65536),B=t-f*65536,t=N+f+65535,f=Math.floor(t/65536),N=t-f*65536,t=k+f+65535,f=Math.floor(t/65536),k=t-f*65536,t=F+f+65535,f=Math.floor(t/65536),F=t-f*65536,t=K+f+65535,f=Math.floor(t/65536),K=t-f*65536,t=j+f+65535,f=Math.floor(t/65536),j=t-f*65536,t=O+f+65535,f=Math.floor(t/65536),O=t-f*65536,t=z+f+65535,f=Math.floor(t/65536),z=t-f*65536,t=T+f+65535,f=Math.floor(t/65536),T=t-f*65536,h+=f-1+37*(f-1),r[0]=h,r[1]=d,r[2]=w,r[3]=A,r[4]=R,r[5]=_,r[6]=X,r[7]=B,r[8]=N,r[9]=k,r[10]=F,r[11]=K,r[12]=j,r[13]=O,r[14]=z,r[15]=T;}function At(r,s){Z(r,s,s);}function Ir(r,s){var o=e(),t;for(t=0;t<16;t++)o[t]=s[t];for(t=253;t>=0;t--)At(o,o),t!==2&&t!==4&&Z(o,o,s);for(t=0;t<16;t++)r[t]=o[t];}function Ur(r,s){var o=e(),t;for(t=0;t<16;t++)o[t]=s[t];for(t=250;t>=0;t--)At(o,o),t!==1&&Z(o,o,s);for(t=0;t<16;t++)r[t]=o[t];}function ye(r,s,o){var t=new Uint8Array(32),f=new Float64Array(80),h,d,w=e(),A=e(),R=e(),_=e(),X=e(),B=e();for(d=0;d<31;d++)t[d]=s[d];for(t[31]=s[31]&127|64,t[0]&=248,$e(f,o),d=0;d<16;d++)A[d]=f[d],_[d]=w[d]=R[d]=0;for(w[0]=_[0]=1,d=254;d>=0;--d)h=t[d>>>3]>>>(d&7)&1,Wt(w,A,h),Wt(R,_,h),_t(X,w,R),Mt(w,w,R),_t(R,A,_),Mt(A,A,_),At(_,X),At(B,w),Z(w,R,w),Z(R,A,X),_t(X,w,R),Mt(w,w,R),At(A,w),Mt(R,_,B),Z(w,R,y),_t(w,w,_),Z(R,R,w),Z(w,_,B),Z(_,A,f),At(A,X),Wt(w,A,h),Wt(R,_,h);for(d=0;d<16;d++)f[d+16]=w[d],f[d+32]=R[d],f[d+48]=A[d],f[d+64]=_[d];var N=f.subarray(32),k=f.subarray(16);return Ir(N,N),Z(k,k,N),Jt(r,k),0}function be(r,s){return ye(r,s,c)}function Rr(r,s){return i(s,32),be(r,s)}function we(r,s,o){var t=new Uint8Array(32);return ye(t,o,s),It(r,a,t,dt)}var Lr=Ke,ei=Fe;function ri(r,s,o,t,f,h){var d=new Uint8Array(32);return we(d,f,h),Lr(r,s,o,t,d)}function ni(r,s,o,t,f,h){var d=new Uint8Array(32);return we(d,f,h),ei(r,s,o,t,d)}var Pr=[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 Nr(r,s,o,t){for(var f=new Int32Array(16),h=new Int32Array(16),d,w,A,R,_,X,B,N,k,F,K,j,O,z,T,L,M,I,U,S,x,p,v,b,m,E,P=r[0],Y=r[1],H=r[2],$=r[3],l=r[4],W=r[5],tt=r[6],et=r[7],V=s[0],Q=s[1],G=s[2],ut=s[3],ot=s[4],at=s[5],ct=s[6],lt=s[7],xt=0;t>=128;){for(U=0;U<16;U++)S=8*U+xt,f[U]=o[S+0]<<24|o[S+1]<<16|o[S+2]<<8|o[S+3],h[U]=o[S+4]<<24|o[S+5]<<16|o[S+6]<<8|o[S+7];for(U=0;U<80;U++)if(d=P,w=Y,A=H,R=$,_=l,X=W,B=tt,N=et,k=V,F=Q,K=G,j=ut,O=ot,z=at,T=ct,L=lt,x=et,p=lt,v=p&65535,b=p>>>16,m=x&65535,E=x>>>16,x=(l>>>14|ot<<18)^(l>>>18|ot<<14)^(ot>>>9|l<<23),p=(ot>>>14|l<<18)^(ot>>>18|l<<14)^(l>>>9|ot<<23),v+=p&65535,b+=p>>>16,m+=x&65535,E+=x>>>16,x=l&W^~l&tt,p=ot&at^~ot&ct,v+=p&65535,b+=p>>>16,m+=x&65535,E+=x>>>16,x=Pr[U*2],p=Pr[U*2+1],v+=p&65535,b+=p>>>16,m+=x&65535,E+=x>>>16,x=f[U%16],p=h[U%16],v+=p&65535,b+=p>>>16,m+=x&65535,E+=x>>>16,b+=v>>>16,m+=b>>>16,E+=m>>>16,M=m&65535|E<<16,I=v&65535|b<<16,x=M,p=I,v=p&65535,b=p>>>16,m=x&65535,E=x>>>16,x=(P>>>28|V<<4)^(V>>>2|P<<30)^(V>>>7|P<<25),p=(V>>>28|P<<4)^(P>>>2|V<<30)^(P>>>7|V<<25),v+=p&65535,b+=p>>>16,m+=x&65535,E+=x>>>16,x=P&Y^P&H^Y&H,p=V&Q^V&G^Q&G,v+=p&65535,b+=p>>>16,m+=x&65535,E+=x>>>16,b+=v>>>16,m+=b>>>16,E+=m>>>16,N=m&65535|E<<16,L=v&65535|b<<16,x=R,p=j,v=p&65535,b=p>>>16,m=x&65535,E=x>>>16,x=M,p=I,v+=p&65535,b+=p>>>16,m+=x&65535,E+=x>>>16,b+=v>>>16,m+=b>>>16,E+=m>>>16,R=m&65535|E<<16,j=v&65535|b<<16,Y=d,H=w,$=A,l=R,W=_,tt=X,et=B,P=N,Q=k,G=F,ut=K,ot=j,at=O,ct=z,lt=T,V=L,U%16===15)for(S=0;S<16;S++)x=f[S],p=h[S],v=p&65535,b=p>>>16,m=x&65535,E=x>>>16,x=f[(S+9)%16],p=h[(S+9)%16],v+=p&65535,b+=p>>>16,m+=x&65535,E+=x>>>16,M=f[(S+1)%16],I=h[(S+1)%16],x=(M>>>1|I<<31)^(M>>>8|I<<24)^M>>>7,p=(I>>>1|M<<31)^(I>>>8|M<<24)^(I>>>7|M<<25),v+=p&65535,b+=p>>>16,m+=x&65535,E+=x>>>16,M=f[(S+14)%16],I=h[(S+14)%16],x=(M>>>19|I<<13)^(I>>>29|M<<3)^M>>>6,p=(I>>>19|M<<13)^(M>>>29|I<<3)^(I>>>6|M<<26),v+=p&65535,b+=p>>>16,m+=x&65535,E+=x>>>16,b+=v>>>16,m+=b>>>16,E+=m>>>16,f[S]=m&65535|E<<16,h[S]=v&65535|b<<16;x=P,p=V,v=p&65535,b=p>>>16,m=x&65535,E=x>>>16,x=r[0],p=s[0],v+=p&65535,b+=p>>>16,m+=x&65535,E+=x>>>16,b+=v>>>16,m+=b>>>16,E+=m>>>16,r[0]=P=m&65535|E<<16,s[0]=V=v&65535|b<<16,x=Y,p=Q,v=p&65535,b=p>>>16,m=x&65535,E=x>>>16,x=r[1],p=s[1],v+=p&65535,b+=p>>>16,m+=x&65535,E+=x>>>16,b+=v>>>16,m+=b>>>16,E+=m>>>16,r[1]=Y=m&65535|E<<16,s[1]=Q=v&65535|b<<16,x=H,p=G,v=p&65535,b=p>>>16,m=x&65535,E=x>>>16,x=r[2],p=s[2],v+=p&65535,b+=p>>>16,m+=x&65535,E+=x>>>16,b+=v>>>16,m+=b>>>16,E+=m>>>16,r[2]=H=m&65535|E<<16,s[2]=G=v&65535|b<<16,x=$,p=ut,v=p&65535,b=p>>>16,m=x&65535,E=x>>>16,x=r[3],p=s[3],v+=p&65535,b+=p>>>16,m+=x&65535,E+=x>>>16,b+=v>>>16,m+=b>>>16,E+=m>>>16,r[3]=$=m&65535|E<<16,s[3]=ut=v&65535|b<<16,x=l,p=ot,v=p&65535,b=p>>>16,m=x&65535,E=x>>>16,x=r[4],p=s[4],v+=p&65535,b+=p>>>16,m+=x&65535,E+=x>>>16,b+=v>>>16,m+=b>>>16,E+=m>>>16,r[4]=l=m&65535|E<<16,s[4]=ot=v&65535|b<<16,x=W,p=at,v=p&65535,b=p>>>16,m=x&65535,E=x>>>16,x=r[5],p=s[5],v+=p&65535,b+=p>>>16,m+=x&65535,E+=x>>>16,b+=v>>>16,m+=b>>>16,E+=m>>>16,r[5]=W=m&65535|E<<16,s[5]=at=v&65535|b<<16,x=tt,p=ct,v=p&65535,b=p>>>16,m=x&65535,E=x>>>16,x=r[6],p=s[6],v+=p&65535,b+=p>>>16,m+=x&65535,E+=x>>>16,b+=v>>>16,m+=b>>>16,E+=m>>>16,r[6]=tt=m&65535|E<<16,s[6]=ct=v&65535|b<<16,x=et,p=lt,v=p&65535,b=p>>>16,m=x&65535,E=x>>>16,x=r[7],p=s[7],v+=p&65535,b+=p>>>16,m+=x&65535,E+=x>>>16,b+=v>>>16,m+=b>>>16,E+=m>>>16,r[7]=et=m&65535|E<<16,s[7]=lt=v&65535|b<<16,xt+=128,t-=128;}return t}function Ot(r,s,o){var t=new Int32Array(8),f=new Int32Array(8),h=new Uint8Array(256),d,w=o;for(t[0]=1779033703,t[1]=3144134277,t[2]=1013904242,t[3]=2773480762,t[4]=1359893119,t[5]=2600822924,t[6]=528734635,t[7]=1541459225,f[0]=4089235720,f[1]=2227873595,f[2]=4271175723,f[3]=1595750129,f[4]=2917565137,f[5]=725511199,f[6]=4215389547,f[7]=327033209,Nr(t,f,s,o),o%=128,d=0;d<o;d++)h[d]=s[w-o+d];for(h[o]=128,o=256-128*(o<112?1:0),h[o-9]=0,bt(h,o-8,w/536870912|0,w<<3),Nr(t,f,h,o),d=0;d<8;d++)bt(r,8*d,t[d],f[d]);return 0}function me(r,s){var o=e(),t=e(),f=e(),h=e(),d=e(),w=e(),A=e(),R=e(),_=e();Mt(o,r[1],r[0]),Mt(_,s[1],s[0]),Z(o,o,_),_t(t,r[0],r[1]),_t(_,s[0],s[1]),Z(t,t,_),Z(f,r[3],s[3]),Z(f,f,D),Z(h,r[2],s[2]),_t(h,h,h),Mt(d,t,o),Mt(w,h,f),_t(A,h,f),_t(R,t,o),Z(r[0],d,w),Z(r[1],R,A),Z(r[2],A,w),Z(r[3],d,R);}function kr(r,s,o){var t;for(t=0;t<4;t++)Wt(r[t],s[t],o);}function He(r,s){var o=e(),t=e(),f=e();Ir(f,s[2]),Z(o,s[0],f),Z(t,s[1],f),Jt(r,t),r[31]^=Tr(o)<<7;}function Ve(r,s,o){var t,f;for(Ut(r[0],u),Ut(r[1],g),Ut(r[2],g),Ut(r[3],u),f=255;f>=0;--f)t=o[f/8|0]>>(f&7)&1,kr(r,s,t),me(s,r),me(r,r),kr(r,s,t);}function ve(r,s){var o=[e(),e(),e(),e()];Ut(o[0],q),Ut(o[1],ft),Ut(o[2],g),Z(o[3],q,ft),Ve(r,o,s);}function We(r,s,o){var t=new Uint8Array(64),f=[e(),e(),e(),e()],h;for(o||i(s,32),Ot(t,s,32),t[0]&=248,t[31]&=127,t[31]|=64,ve(f,t),He(r,f),h=0;h<32;h++)s[h+32]=r[h];return 0}var Ce=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 Je(r,s){var o,t,f,h;for(t=63;t>=32;--t){for(o=0,f=t-32,h=t-12;f<h;++f)s[f]+=o-16*s[t]*Ce[f-(t-32)],o=Math.floor((s[f]+128)/256),s[f]-=o*256;s[f]+=o,s[t]=0;}for(o=0,f=0;f<32;f++)s[f]+=o-(s[31]>>4)*Ce[f],o=s[f]>>8,s[f]&=255;for(f=0;f<32;f++)s[f]-=o*Ce[f];for(t=0;t<32;t++)s[t+1]+=s[t]>>8,r[t]=s[t]&255;}function Ze(r){var s=new Float64Array(64),o;for(o=0;o<64;o++)s[o]=r[o];for(o=0;o<64;o++)r[o]=0;Je(r,s);}function jr(r,s,o,t){var f=new Uint8Array(64),h=new Uint8Array(64),d=new Uint8Array(64),w,A,R=new Float64Array(64),_=[e(),e(),e(),e()];Ot(f,t,32),f[0]&=248,f[31]&=127,f[31]|=64;var X=o+64;for(w=0;w<o;w++)r[64+w]=s[w];for(w=0;w<32;w++)r[32+w]=f[32+w];for(Ot(d,r.subarray(32),o+32),Ze(d),ve(_,d),He(r,_),w=32;w<64;w++)r[w]=t[w];for(Ot(h,r,o+64),Ze(h),w=0;w<64;w++)R[w]=0;for(w=0;w<32;w++)R[w]=d[w];for(w=0;w<32;w++)for(A=0;A<32;A++)R[w+A]+=h[w]*f[A];return Je(r.subarray(32),R),X}function ii(r,s){var o=e(),t=e(),f=e(),h=e(),d=e(),w=e(),A=e();return Ut(r[2],g),$e(r[1],s),At(f,r[1]),Z(h,f,C),Mt(f,f,r[2]),_t(h,r[2],h),At(d,h),At(w,d),Z(A,w,d),Z(o,A,f),Z(o,o,h),Ur(o,o),Z(o,o,f),Z(o,o,h),Z(o,o,h),Z(r[0],o,h),At(t,r[0]),Z(t,t,h),Br(t,f)&&Z(r[0],r[0],it),At(t,r[0]),Z(t,t,h),Br(t,f)?-1:(Tr(r[0])===s[31]>>7&&Mt(r[0],u,r[0]),Z(r[3],r[0],r[1]),0)}function Qe(r,s,o,t){var f,h=new Uint8Array(32),d=new Uint8Array(64),w=[e(),e(),e(),e()],A=[e(),e(),e(),e()];if(o<64||ii(A,t))return -1;for(f=0;f<o;f++)r[f]=s[f];for(f=0;f<32;f++)r[f+32]=t[f];if(Ot(d,r,o),Ze(d),Ve(w,A,d),ve(A,s.subarray(32)),me(w,A),He(h,w),o-=64,Pt(s,0,h,0)){for(f=0;f<o;f++)r[f]=0;return -1}for(f=0;f<o;f++)r[f]=s[f+64];return o}var Ge=32,Ee=24,ie=32,Zt=16,oe=32,Ae=32,se=32,fe=32,Xe=32,zr=Ee,oi=ie,si=Zt,Rt=64,qt=32,Qt=64,tr=32,er=64;n.lowlevel={crypto_core_hsalsa20:It,crypto_stream_xor:Vt,crypto_stream:Ct,crypto_stream_salsa20_xor:mt,crypto_stream_salsa20:J,crypto_onetimeauth:qe,crypto_onetimeauth_verify:Mr,crypto_verify_16:vt,crypto_verify_32:Pt,crypto_secretbox:Ke,crypto_secretbox_open:Fe,crypto_scalarmult:ye,crypto_scalarmult_base:be,crypto_box_beforenm:we,crypto_box_afternm:Lr,crypto_box:ri,crypto_box_open:ni,crypto_box_keypair:Rr,crypto_hash:Ot,crypto_sign:jr,crypto_sign_keypair:We,crypto_sign_open:Qe,crypto_secretbox_KEYBYTES:Ge,crypto_secretbox_NONCEBYTES:Ee,crypto_secretbox_ZEROBYTES:ie,crypto_secretbox_BOXZEROBYTES:Zt,crypto_scalarmult_BYTES:oe,crypto_scalarmult_SCALARBYTES:Ae,crypto_box_PUBLICKEYBYTES:se,crypto_box_SECRETKEYBYTES:fe,crypto_box_BEFORENMBYTES:Xe,crypto_box_NONCEBYTES:zr,crypto_box_ZEROBYTES:oi,crypto_box_BOXZEROBYTES:si,crypto_sign_BYTES:Rt,crypto_sign_PUBLICKEYBYTES:qt,crypto_sign_SECRETKEYBYTES:Qt,crypto_sign_SEEDBYTES:tr,crypto_hash_BYTES:er,gf:e,D:C,L:Ce,pack25519:Jt,unpack25519:$e,M:Z,A:_t,S:At,Z:Mt,pow2523:Ur,add:me,set25519:Ut,modL:Je,scalarmult:Ve,scalarbase:ve};function Dr(r,s){if(r.length!==Ge)throw new Error("bad key size");if(s.length!==Ee)throw new Error("bad nonce size")}function fi(r,s){if(r.length!==se)throw new Error("bad public key size");if(s.length!==fe)throw new Error("bad secret key size")}function Et(){for(var r=0;r<arguments.length;r++)if(!(arguments[r]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Or(r){for(var s=0;s<r.length;s++)r[s]=0;}n.randomBytes=function(r){var s=new Uint8Array(r);return i(s,r),s},n.secretbox=function(r,s,o){Et(r,s,o),Dr(o,s);for(var t=new Uint8Array(ie+r.length),f=new Uint8Array(t.length),h=0;h<r.length;h++)t[h+ie]=r[h];return Ke(f,t,t.length,s,o),f.subarray(Zt)},n.secretbox.open=function(r,s,o){Et(r,s,o),Dr(o,s);for(var t=new Uint8Array(Zt+r.length),f=new Uint8Array(t.length),h=0;h<r.length;h++)t[h+Zt]=r[h];return t.length<32||Fe(f,t,t.length,s,o)!==0?null:f.subarray(ie)},n.secretbox.keyLength=Ge,n.secretbox.nonceLength=Ee,n.secretbox.overheadLength=Zt,n.scalarMult=function(r,s){if(Et(r,s),r.length!==Ae)throw new Error("bad n size");if(s.length!==oe)throw new Error("bad p size");var o=new Uint8Array(oe);return ye(o,r,s),o},n.scalarMult.base=function(r){if(Et(r),r.length!==Ae)throw new Error("bad n size");var s=new Uint8Array(oe);return be(s,r),s},n.scalarMult.scalarLength=Ae,n.scalarMult.groupElementLength=oe,n.box=function(r,s,o,t){var f=n.box.before(o,t);return n.secretbox(r,s,f)},n.box.before=function(r,s){Et(r,s),fi(r,s);var o=new Uint8Array(Xe);return we(o,r,s),o},n.box.after=n.secretbox,n.box.open=function(r,s,o,t){var f=n.box.before(o,t);return n.secretbox.open(r,s,f)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var r=new Uint8Array(se),s=new Uint8Array(fe);return Rr(r,s),{publicKey:r,secretKey:s}},n.box.keyPair.fromSecretKey=function(r){if(Et(r),r.length!==fe)throw new Error("bad secret key size");var s=new Uint8Array(se);return be(s,r),{publicKey:s,secretKey:new Uint8Array(r)}},n.box.publicKeyLength=se,n.box.secretKeyLength=fe,n.box.sharedKeyLength=Xe,n.box.nonceLength=zr,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(r,s){if(Et(r,s),s.length!==Qt)throw new Error("bad secret key size");var o=new Uint8Array(Rt+r.length);return jr(o,r,r.length,s),o},n.sign.open=function(r,s){if(Et(r,s),s.length!==qt)throw new Error("bad public key size");var o=new Uint8Array(r.length),t=Qe(o,r,r.length,s);if(t<0)return null;for(var f=new Uint8Array(t),h=0;h<f.length;h++)f[h]=o[h];return f},n.sign.detached=function(r,s){for(var o=n.sign(r,s),t=new Uint8Array(Rt),f=0;f<t.length;f++)t[f]=o[f];return t},n.sign.detached.verify=function(r,s,o){if(Et(r,s,o),s.length!==Rt)throw new Error("bad signature size");if(o.length!==qt)throw new Error("bad public key size");var t=new Uint8Array(Rt+r.length),f=new Uint8Array(Rt+r.length),h;for(h=0;h<Rt;h++)t[h]=s[h];for(h=0;h<r.length;h++)t[h+Rt]=r[h];return Qe(f,t,t.length,o)>=0},n.sign.keyPair=function(){var r=new Uint8Array(qt),s=new Uint8Array(Qt);return We(r,s),{publicKey:r,secretKey:s}},n.sign.keyPair.fromSecretKey=function(r){if(Et(r),r.length!==Qt)throw new Error("bad secret key size");for(var s=new Uint8Array(qt),o=0;o<s.length;o++)s[o]=r[32+o];return {publicKey:s,secretKey:new Uint8Array(r)}},n.sign.keyPair.fromSeed=function(r){if(Et(r),r.length!==tr)throw new Error("bad seed size");for(var s=new Uint8Array(qt),o=new Uint8Array(Qt),t=0;t<32;t++)o[t]=r[t];return We(s,o,true),{publicKey:s,secretKey:o}},n.sign.publicKeyLength=qt,n.sign.secretKeyLength=Qt,n.sign.seedLength=tr,n.sign.signatureLength=Rt,n.hash=function(r){Et(r);var s=new Uint8Array(er);return Ot(s,r,r.length),s},n.hash.hashLength=er,n.verify=function(r,s){return Et(r,s),r.length===0||s.length===0||r.length!==s.length?false:wt(r,0,s,0,r.length)===0},n.setPRNG=function(r){i=r;},(function(){var r=typeof self<"u"?self.crypto||self.msCrypto:null;if(r&&r.getRandomValues){var s=65536;n.setPRNG(function(o,t){var f,h=new Uint8Array(t);for(f=0;f<t;f+=s)r.getRandomValues(h.subarray(f,f+Math.min(t-f,s)));for(f=0;f<t;f++)o[f]=h[f];Or(h);});}else typeof rr<"u"&&(r=rr("crypto"),r&&r.randomBytes&&n.setPRNG(function(o,t){var f,h=r.randomBytes(t);for(f=0;f<t;f++)o[f]=h[f];Or(h);}));})();})(typeof Se<"u"&&Se.exports?Se.exports:self.nacl=self.nacl||{});});var Yr=rt((Fr,_e)=>{(function(n,e){typeof _e<"u"&&_e.exports?_e.exports=e():(n.nacl||(n.nacl={}),n.nacl.util=e());})(Fr,function(){var n={};function e(i){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(i))throw new TypeError("invalid encoding")}return n.decodeUTF8=function(i){if(typeof i!="string")throw new TypeError("expected string");var a,c=unescape(encodeURIComponent(i)),u=new Uint8Array(c.length);for(a=0;a<c.length;a++)u[a]=c.charCodeAt(a);return u},n.encodeUTF8=function(i){var a,c=[];for(a=0;a<i.length;a++)c.push(String.fromCharCode(i[a]));return decodeURIComponent(escape(c.join("")))},typeof atob>"u"?typeof Buffer.from<"u"?(n.encodeBase64=function(i){return Buffer.from(i).toString("base64")},n.decodeBase64=function(i){return e(i),new Uint8Array(Array.prototype.slice.call(Buffer.from(i,"base64"),0))}):(n.encodeBase64=function(i){return new Buffer(i).toString("base64")},n.decodeBase64=function(i){return e(i),new Uint8Array(Array.prototype.slice.call(new Buffer(i,"base64"),0))}):(n.encodeBase64=function(i){var a,c=[],u=i.length;for(a=0;a<u;a++)c.push(String.fromCharCode(i[a]));return btoa(c.join(""))},n.decodeBase64=function(i){e(i);var a,c=atob(i),u=new Uint8Array(c.length);for(a=0;a<c.length;a++)u[a]=c.charCodeAt(a);return u}),n});});var Hr=rt((mo,$r)=>{$r.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then};});var Nt=rt(Kt=>{var nr,pi=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Kt.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};Kt.getSymbolTotalCodewords=function(e){return pi[e]};Kt.getBCHDigit=function(n){let e=0;for(;n!==0;)e++,n>>>=1;return e};Kt.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');nr=e;};Kt.isKanjiModeEnabled=function(){return typeof nr<"u"};Kt.toSJIS=function(e){return nr(e)};});var Me=rt(St=>{St.L={bit:1};St.M={bit:0};St.Q={bit:3};St.H={bit:2};function gi(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case "l":case "low":return St.L;case "m":case "medium":return St.M;case "q":case "quartile":return St.Q;case "h":case "high":return St.H;default:throw new Error("Unknown EC Level: "+n)}}St.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};St.from=function(e,i){if(St.isValid(e))return e;try{return gi(e)}catch{return i}};});var Jr=rt((Eo,Wr)=>{function Vr(){this.buffer=[],this.length=0;}Vr.prototype={get:function(n){let e=Math.floor(n/8);return (this.buffer[e]>>>7-n%8&1)===1},put:function(n,e){for(let i=0;i<e;i++)this.putBit((n>>>e-i-1&1)===1);},getLengthInBits:function(){return this.length},putBit:function(n){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),n&&(this.buffer[e]|=128>>>this.length%8),this.length++;}};Wr.exports=Vr;});var Qr=rt((Ao,Zr)=>{function ae(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n);}ae.prototype.set=function(n,e,i,a){let c=n*this.size+e;this.data[c]=i,a&&(this.reservedBit[c]=true);};ae.prototype.get=function(n,e){return this.data[n*this.size+e]};ae.prototype.xor=function(n,e,i){this.data[n*this.size+e]^=i;};ae.prototype.isReserved=function(n,e){return this.reservedBit[n*this.size+e]};Zr.exports=ae;});var Gr=rt(Be=>{var yi=Nt().getSymbolSize;Be.getRowColCoords=function(e){if(e===1)return [];let i=Math.floor(e/7)+2,a=yi(e),c=a===145?26:Math.ceil((a-13)/(2*i-2))*2,u=[a-7];for(let g=1;g<i-1;g++)u[g]=u[g-1]-c;return u.push(6),u.reverse()};Be.getPositions=function(e){let i=[],a=Be.getRowColCoords(e),c=a.length;for(let u=0;u<c;u++)for(let g=0;g<c;g++)u===0&&g===0||u===0&&g===c-1||u===c-1&&g===0||i.push([a[u],a[g]]);return i};});var en=rt(tn=>{var bi=Nt().getSymbolSize,Xr=7;tn.getPositions=function(e){let i=bi(e);return [[0,0],[i-Xr,0],[0,i-Xr]]};});var rn=rt(st=>{st.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Ft={N1:3,N2:3,N3:40,N4:10};st.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};st.from=function(e){return st.isValid(e)?parseInt(e,10):void 0};st.getPenaltyN1=function(e){let i=e.size,a=0,c=0,u=0,g=null,y=null;for(let C=0;C<i;C++){c=u=0,g=y=null;for(let D=0;D<i;D++){let q=e.get(C,D);q===g?c++:(c>=5&&(a+=Ft.N1+(c-5)),g=q,c=1),q=e.get(D,C),q===y?u++:(u>=5&&(a+=Ft.N1+(u-5)),y=q,u=1);}c>=5&&(a+=Ft.N1+(c-5)),u>=5&&(a+=Ft.N1+(u-5));}return a};st.getPenaltyN2=function(e){let i=e.size,a=0;for(let c=0;c<i-1;c++)for(let u=0;u<i-1;u++){let g=e.get(c,u)+e.get(c,u+1)+e.get(c+1,u)+e.get(c+1,u+1);(g===4||g===0)&&a++;}return a*Ft.N2};st.getPenaltyN3=function(e){let i=e.size,a=0,c=0,u=0;for(let g=0;g<i;g++){c=u=0;for(let y=0;y<i;y++)c=c<<1&2047|e.get(g,y),y>=10&&(c===1488||c===93)&&a++,u=u<<1&2047|e.get(y,g),y>=10&&(u===1488||u===93)&&a++;}return a*Ft.N3};st.getPenaltyN4=function(e){let i=0,a=e.data.length;for(let u=0;u<a;u++)i+=e.data[u];return Math.abs(Math.ceil(i*100/a/5)-10)*Ft.N4};function wi(n,e,i){switch(n){case st.Patterns.PATTERN000:return (e+i)%2===0;case st.Patterns.PATTERN001:return e%2===0;case st.Patterns.PATTERN010:return i%3===0;case st.Patterns.PATTERN011:return (e+i)%3===0;case st.Patterns.PATTERN100:return (Math.floor(e/2)+Math.floor(i/3))%2===0;case st.Patterns.PATTERN101:return e*i%2+e*i%3===0;case st.Patterns.PATTERN110:return (e*i%2+e*i%3)%2===0;case st.Patterns.PATTERN111:return (e*i%3+(e+i)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}st.applyMask=function(e,i){let a=i.size;for(let c=0;c<a;c++)for(let u=0;u<a;u++)i.isReserved(u,c)||i.xor(u,c,wi(e,u,c));};st.getBestMask=function(e,i){let a=Object.keys(st.Patterns).length,c=0,u=1/0;for(let g=0;g<a;g++){i(g),st.applyMask(g,e);let y=st.getPenaltyN1(e)+st.getPenaltyN2(e)+st.getPenaltyN3(e)+st.getPenaltyN4(e);st.applyMask(g,e),y<u&&(u=y,c=g);}return c};});var or=rt(ir=>{var kt=Me(),Te=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Ie=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];ir.getBlocksCount=function(e,i){switch(i){case kt.L:return Te[(e-1)*4+0];case kt.M:return Te[(e-1)*4+1];case kt.Q:return Te[(e-1)*4+2];case kt.H:return Te[(e-1)*4+3];default:return}};ir.getTotalCodewordsCount=function(e,i){switch(i){case kt.L:return Ie[(e-1)*4+0];case kt.M:return Ie[(e-1)*4+1];case kt.Q:return Ie[(e-1)*4+2];case kt.H:return Ie[(e-1)*4+3];default:return}};});var nn=rt(Re=>{var ce=new Uint8Array(512),Ue=new Uint8Array(256);(function(){let e=1;for(let i=0;i<255;i++)ce[i]=e,Ue[e]=i,e<<=1,e&256&&(e^=285);for(let i=255;i<512;i++)ce[i]=ce[i-255];})();Re.log=function(e){if(e<1)throw new Error("log("+e+")");return Ue[e]};Re.exp=function(e){return ce[e]};Re.mul=function(e,i){return e===0||i===0?0:ce[Ue[e]+Ue[i]]};});var on=rt(le=>{var sr=nn();le.mul=function(e,i){let a=new Uint8Array(e.length+i.length-1);for(let c=0;c<e.length;c++)for(let u=0;u<i.length;u++)a[c+u]^=sr.mul(e[c],i[u]);return a};le.mod=function(e,i){let a=new Uint8Array(e);for(;a.length-i.length>=0;){let c=a[0];for(let g=0;g<i.length;g++)a[g]^=sr.mul(i[g],c);let u=0;for(;u<a.length&&a[u]===0;)u++;a=a.slice(u);}return a};le.generateECPolynomial=function(e){let i=new Uint8Array([1]);for(let a=0;a<e;a++)i=le.mul(i,new Uint8Array([1,sr.exp(a)]));return i};});var an=rt((Uo,fn)=>{var sn=on();function fr(n){this.genPoly=void 0,this.degree=n,this.degree&&this.initialize(this.degree);}fr.prototype.initialize=function(e){this.degree=e,this.genPoly=sn.generateECPolynomial(this.degree);};fr.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let i=new Uint8Array(e.length+this.degree);i.set(e);let a=sn.mod(i,this.genPoly),c=this.degree-a.length;if(c>0){let u=new Uint8Array(this.degree);return u.set(a,c),u}return a};fn.exports=fr;});var ar=rt(cn=>{cn.isValid=function(e){return !isNaN(e)&&e>=1&&e<=40};});var cr=rt(Lt=>{var ln="[0-9]+",mi="[A-Z $%*+\\-./:]+",ue="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";ue=ue.replace(/u/g,"\\u");var vi="(?:(?![A-Z0-9 $%*+\\-./:]|"+ue+`)(?:.|[\r
2
+ ]))+`;Lt.KANJI=new RegExp(ue,"g");Lt.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");Lt.BYTE=new RegExp(vi,"g");Lt.NUMERIC=new RegExp(ln,"g");Lt.ALPHANUMERIC=new RegExp(mi,"g");var Ci=new RegExp("^"+ue+"$"),Ei=new RegExp("^"+ln+"$"),Ai=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Lt.testKanji=function(e){return Ci.test(e)};Lt.testNumeric=function(e){return Ei.test(e)};Lt.testAlphanumeric=function(e){return Ai.test(e)};});var jt=rt(ht=>{var Si=ar(),lr=cr();ht.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};ht.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};ht.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};ht.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};ht.MIXED={bit:-1};ht.getCharCountIndicator=function(e,i){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!Si.isValid(i))throw new Error("Invalid version: "+i);return i>=1&&i<10?e.ccBits[0]:i<27?e.ccBits[1]:e.ccBits[2]};ht.getBestModeForData=function(e){return lr.testNumeric(e)?ht.NUMERIC:lr.testAlphanumeric(e)?ht.ALPHANUMERIC:lr.testKanji(e)?ht.KANJI:ht.BYTE};ht.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};ht.isValid=function(e){return e&&e.bit&&e.ccBits};function _i(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case "numeric":return ht.NUMERIC;case "alphanumeric":return ht.ALPHANUMERIC;case "kanji":return ht.KANJI;case "byte":return ht.BYTE;default:throw new Error("Unknown mode: "+n)}}ht.from=function(e,i){if(ht.isValid(e))return e;try{return _i(e)}catch{return i}};});var pn=rt(Yt=>{var Le=Nt(),Mi=or(),un=Me(),zt=jt(),ur=ar(),dn=7973,hn=Le.getBCHDigit(dn);function Bi(n,e,i){for(let a=1;a<=40;a++)if(e<=Yt.getCapacity(a,i,n))return a}function xn(n,e){return zt.getCharCountIndicator(n,e)+4}function Ti(n,e){let i=0;return n.forEach(function(a){let c=xn(a.mode,e);i+=c+a.getBitsLength();}),i}function Ii(n,e){for(let i=1;i<=40;i++)if(Ti(n,i)<=Yt.getCapacity(i,e,zt.MIXED))return i}Yt.from=function(e,i){return ur.isValid(e)?parseInt(e,10):i};Yt.getCapacity=function(e,i,a){if(!ur.isValid(e))throw new Error("Invalid QR Code version");typeof a>"u"&&(a=zt.BYTE);let c=Le.getSymbolTotalCodewords(e),u=Mi.getTotalCodewordsCount(e,i),g=(c-u)*8;if(a===zt.MIXED)return g;let y=g-xn(a,e);switch(a){case zt.NUMERIC:return Math.floor(y/10*3);case zt.ALPHANUMERIC:return Math.floor(y/11*2);case zt.KANJI:return Math.floor(y/13);case zt.BYTE:default:return Math.floor(y/8)}};Yt.getBestVersionForData=function(e,i){let a,c=un.from(i,un.M);if(Array.isArray(e)){if(e.length>1)return Ii(e,c);if(e.length===0)return 1;a=e[0];}else a=e;return Bi(a.mode,a.getLength(),c)};Yt.getEncodedBits=function(e){if(!ur.isValid(e)||e<7)throw new Error("Invalid QR Code version");let i=e<<12;for(;Le.getBCHDigit(i)-hn>=0;)i^=dn<<Le.getBCHDigit(i)-hn;return e<<12|i};});var wn=rt(bn=>{var hr=Nt(),yn=1335,Ui=21522,gn=hr.getBCHDigit(yn);bn.getEncodedBits=function(e,i){let a=e.bit<<3|i,c=a<<10;for(;hr.getBCHDigit(c)-gn>=0;)c^=yn<<hr.getBCHDigit(c)-gn;return (a<<10|c)^Ui};});var vn=rt((jo,mn)=>{var Ri=jt();function Gt(n){this.mode=Ri.NUMERIC,this.data=n.toString();}Gt.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Gt.prototype.getLength=function(){return this.data.length};Gt.prototype.getBitsLength=function(){return Gt.getBitsLength(this.data.length)};Gt.prototype.write=function(e){let i,a,c;for(i=0;i+3<=this.data.length;i+=3)a=this.data.substr(i,3),c=parseInt(a,10),e.put(c,10);let u=this.data.length-i;u>0&&(a=this.data.substr(i),c=parseInt(a,10),e.put(c,u*3+1));};mn.exports=Gt;});var En=rt((zo,Cn)=>{var Li=jt(),dr=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function Xt(n){this.mode=Li.ALPHANUMERIC,this.data=n;}Xt.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Xt.prototype.getLength=function(){return this.data.length};Xt.prototype.getBitsLength=function(){return Xt.getBitsLength(this.data.length)};Xt.prototype.write=function(e){let i;for(i=0;i+2<=this.data.length;i+=2){let a=dr.indexOf(this.data[i])*45;a+=dr.indexOf(this.data[i+1]),e.put(a,11);}this.data.length%2&&e.put(dr.indexOf(this.data[i]),6);};Cn.exports=Xt;});var Sn=rt((Do,An)=>{var Pi=jt();function te(n){this.mode=Pi.BYTE,typeof n=="string"?this.data=new TextEncoder().encode(n):this.data=new Uint8Array(n);}te.getBitsLength=function(e){return e*8};te.prototype.getLength=function(){return this.data.length};te.prototype.getBitsLength=function(){return te.getBitsLength(this.data.length)};te.prototype.write=function(n){for(let e=0,i=this.data.length;e<i;e++)n.put(this.data[e],8);};An.exports=te;});var Mn=rt((Oo,_n)=>{var Ni=jt(),ki=Nt();function ee(n){this.mode=Ni.KANJI,this.data=n;}ee.getBitsLength=function(e){return e*13};ee.prototype.getLength=function(){return this.data.length};ee.prototype.getBitsLength=function(){return ee.getBitsLength(this.data.length)};ee.prototype.write=function(n){let e;for(e=0;e<this.data.length;e++){let i=ki.toSJIS(this.data[e]);if(i>=33088&&i<=40956)i-=33088;else if(i>=57408&&i<=60351)i-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
3
+ Make sure your charset is UTF-8`);i=(i>>>8&255)*192+(i&255),n.put(i,13);}};_n.exports=ee;});var Bn=rt((qo,xr)=>{var he={single_source_shortest_paths:function(n,e,i){var a={},c={};c[e]=0;var u=he.PriorityQueue.make();u.push(e,0);for(var g,y,C,D,q,ft,it,bt,wt;!u.empty();){g=u.pop(),y=g.value,D=g.cost,q=n[y]||{};for(C in q)q.hasOwnProperty(C)&&(ft=q[C],it=D+ft,bt=c[C],wt=typeof c[C]>"u",(wt||bt>it)&&(c[C]=it,u.push(C,it),a[C]=y));}if(typeof i<"u"&&typeof c[i]>"u"){var vt=["Could not find a path from ",e," to ",i,"."].join("");throw new Error(vt)}return a},extract_shortest_path_from_predecessor_list:function(n,e){for(var i=[],a=e,c;a;)i.push(a),c=n[a],a=n[a];return i.reverse(),i},find_path:function(n,e,i){var a=he.single_source_shortest_paths(n,e,i);return he.extract_shortest_path_from_predecessor_list(a,i)},PriorityQueue:{make:function(n){var e=he.PriorityQueue,i={},a;n=n||{};for(a in e)e.hasOwnProperty(a)&&(i[a]=e[a]);return i.queue=[],i.sorter=n.sorter||e.default_sorter,i},default_sorter:function(n,e){return n.cost-e.cost},push:function(n,e){var i={value:n,cost:e};this.queue.push(i),this.queue.sort(this.sorter);},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof xr<"u"&&(xr.exports=he);});var kn=rt(re=>{var nt=jt(),Un=vn(),Rn=En(),Ln=Sn(),Pn=Mn(),de=cr(),Pe=Nt(),ji=Bn();function Tn(n){return unescape(encodeURIComponent(n)).length}function xe(n,e,i){let a=[],c;for(;(c=n.exec(i))!==null;)a.push({data:c[0],index:c.index,mode:e,length:c[0].length});return a}function Nn(n){let e=xe(de.NUMERIC,nt.NUMERIC,n),i=xe(de.ALPHANUMERIC,nt.ALPHANUMERIC,n),a,c;return Pe.isKanjiModeEnabled()?(a=xe(de.BYTE,nt.BYTE,n),c=xe(de.KANJI,nt.KANJI,n)):(a=xe(de.BYTE_KANJI,nt.BYTE,n),c=[]),e.concat(i,a,c).sort(function(g,y){return g.index-y.index}).map(function(g){return {data:g.data,mode:g.mode,length:g.length}})}function pr(n,e){switch(e){case nt.NUMERIC:return Un.getBitsLength(n);case nt.ALPHANUMERIC:return Rn.getBitsLength(n);case nt.KANJI:return Pn.getBitsLength(n);case nt.BYTE:return Ln.getBitsLength(n)}}function zi(n){return n.reduce(function(e,i){let a=e.length-1>=0?e[e.length-1]:null;return a&&a.mode===i.mode?(e[e.length-1].data+=i.data,e):(e.push(i),e)},[])}function Di(n){let e=[];for(let i=0;i<n.length;i++){let a=n[i];switch(a.mode){case nt.NUMERIC:e.push([a,{data:a.data,mode:nt.ALPHANUMERIC,length:a.length},{data:a.data,mode:nt.BYTE,length:a.length}]);break;case nt.ALPHANUMERIC:e.push([a,{data:a.data,mode:nt.BYTE,length:a.length}]);break;case nt.KANJI:e.push([a,{data:a.data,mode:nt.BYTE,length:Tn(a.data)}]);break;case nt.BYTE:e.push([{data:a.data,mode:nt.BYTE,length:Tn(a.data)}]);}}return e}function Oi(n,e){let i={},a={start:{}},c=["start"];for(let u=0;u<n.length;u++){let g=n[u],y=[];for(let C=0;C<g.length;C++){let D=g[C],q=""+u+C;y.push(q),i[q]={node:D,lastCount:0},a[q]={};for(let ft=0;ft<c.length;ft++){let it=c[ft];i[it]&&i[it].node.mode===D.mode?(a[it][q]=pr(i[it].lastCount+D.length,D.mode)-pr(i[it].lastCount,D.mode),i[it].lastCount+=D.length):(i[it]&&(i[it].lastCount=D.length),a[it][q]=pr(D.length,D.mode)+4+nt.getCharCountIndicator(D.mode,e));}}c=y;}for(let u=0;u<c.length;u++)a[c[u]].end=0;return {map:a,table:i}}function In(n,e){let i,a=nt.getBestModeForData(n);if(i=nt.from(e,a),i!==nt.BYTE&&i.bit<a.bit)throw new Error('"'+n+'" cannot be encoded with mode '+nt.toString(i)+`.
4
+ Suggested mode is: `+nt.toString(a));switch(i===nt.KANJI&&!Pe.isKanjiModeEnabled()&&(i=nt.BYTE),i){case nt.NUMERIC:return new Un(n);case nt.ALPHANUMERIC:return new Rn(n);case nt.KANJI:return new Pn(n);case nt.BYTE:return new Ln(n)}}re.fromArray=function(e){return e.reduce(function(i,a){return typeof a=="string"?i.push(In(a,null)):a.data&&i.push(In(a.data,a.mode)),i},[])};re.fromString=function(e,i){let a=Nn(e,Pe.isKanjiModeEnabled()),c=Di(a),u=Oi(c,i),g=ji.find_path(u.map,"start","end"),y=[];for(let C=1;C<g.length-1;C++)y.push(u.table[g[C]].node);return re.fromArray(zi(y))};re.rawSplit=function(e){return re.fromArray(Nn(e,Pe.isKanjiModeEnabled()))};});var zn=rt(jn=>{var ke=Nt(),gr=Me(),qi=Jr(),Ki=Qr(),Fi=Gr(),Yi=en(),wr=rn(),mr=or(),$i=an(),Ne=pn(),Hi=wn(),Vi=jt(),yr=kn();function Wi(n,e){let i=n.size,a=Yi.getPositions(e);for(let c=0;c<a.length;c++){let u=a[c][0],g=a[c][1];for(let y=-1;y<=7;y++)if(!(u+y<=-1||i<=u+y))for(let C=-1;C<=7;C++)g+C<=-1||i<=g+C||(y>=0&&y<=6&&(C===0||C===6)||C>=0&&C<=6&&(y===0||y===6)||y>=2&&y<=4&&C>=2&&C<=4?n.set(u+y,g+C,true,true):n.set(u+y,g+C,false,true));}}function Ji(n){let e=n.size;for(let i=8;i<e-8;i++){let a=i%2===0;n.set(i,6,a,true),n.set(6,i,a,true);}}function Zi(n,e){let i=Fi.getPositions(e);for(let a=0;a<i.length;a++){let c=i[a][0],u=i[a][1];for(let g=-2;g<=2;g++)for(let y=-2;y<=2;y++)g===-2||g===2||y===-2||y===2||g===0&&y===0?n.set(c+g,u+y,true,true):n.set(c+g,u+y,false,true);}}function Qi(n,e){let i=n.size,a=Ne.getEncodedBits(e),c,u,g;for(let y=0;y<18;y++)c=Math.floor(y/3),u=y%3+i-8-3,g=(a>>y&1)===1,n.set(c,u,g,true),n.set(u,c,g,true);}function br(n,e,i){let a=n.size,c=Hi.getEncodedBits(e,i),u,g;for(u=0;u<15;u++)g=(c>>u&1)===1,u<6?n.set(u,8,g,true):u<8?n.set(u+1,8,g,true):n.set(a-15+u,8,g,true),u<8?n.set(8,a-u-1,g,true):u<9?n.set(8,15-u-1+1,g,true):n.set(8,15-u-1,g,true);n.set(a-8,8,1,true);}function Gi(n,e){let i=n.size,a=-1,c=i-1,u=7,g=0;for(let y=i-1;y>0;y-=2)for(y===6&&y--;;){for(let C=0;C<2;C++)if(!n.isReserved(c,y-C)){let D=false;g<e.length&&(D=(e[g]>>>u&1)===1),n.set(c,y-C,D),u--,u===-1&&(g++,u=7);}if(c+=a,c<0||i<=c){c-=a,a=-a;break}}}function Xi(n,e,i){let a=new qi;i.forEach(function(C){a.put(C.mode.bit,4),a.put(C.getLength(),Vi.getCharCountIndicator(C.mode,n)),C.write(a);});let c=ke.getSymbolTotalCodewords(n),u=mr.getTotalCodewordsCount(n,e),g=(c-u)*8;for(a.getLengthInBits()+4<=g&&a.put(0,4);a.getLengthInBits()%8!==0;)a.putBit(0);let y=(g-a.getLengthInBits())/8;for(let C=0;C<y;C++)a.put(C%2?17:236,8);return to(a,n,e)}function to(n,e,i){let a=ke.getSymbolTotalCodewords(e),c=mr.getTotalCodewordsCount(e,i),u=a-c,g=mr.getBlocksCount(e,i),y=a%g,C=g-y,D=Math.floor(a/g),q=Math.floor(u/g),ft=q+1,it=D-q,bt=new $i(it),wt=0,vt=new Array(g),Pt=new Array(g),Dt=0,ne=new Uint8Array(n.buffer);for(let J=0;J<g;J++){let Ct=J<C?q:ft;vt[J]=ne.slice(wt,wt+Ct),Pt[J]=bt.encode(vt[J]),wt+=Ct,Dt=Math.max(Dt,Ct);}let Bt=new Uint8Array(a),It=0,dt,mt;for(dt=0;dt<Dt;dt++)for(mt=0;mt<g;mt++)dt<vt[mt].length&&(Bt[It++]=vt[mt][dt]);for(dt=0;dt<it;dt++)for(mt=0;mt<g;mt++)Bt[It++]=Pt[mt][dt];return Bt}function eo(n,e,i,a){let c;if(Array.isArray(n))c=yr.fromArray(n);else if(typeof n=="string"){let D=e;if(!D){let q=yr.rawSplit(n);D=Ne.getBestVersionForData(q,i);}c=yr.fromString(n,D||40);}else throw new Error("Invalid data");let u=Ne.getBestVersionForData(c,i);if(!u)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=u;else if(e<u)throw new Error(`
5
5
  The chosen QR Code version cannot contain this amount of data.
6
- Minimum version required to store current data is: `+h+`.
7
- `);let g=Xi(e,i,l),y=Ne.getSymbolSize(e),E=new Yi(y);return Wi(E,e),Ji(E),Zi(E,e),br(E,i,0),e>=7&&Qi(E,e),Gi(E,g),isNaN(a)&&(a=mr.getBestMask(E,br.bind(null,E,i))),mr.applyMask(a,E),br(E,i,a),{modules:E,version:e,errorCorrectionLevel:i,maskPattern:a,segments:l}}jn.create=function(e,i){if(typeof e>"u"||e==="")throw new Error("No input text");let a=gr.M,l,h;return typeof i<"u"&&(a=gr.from(i.errorCorrectionLevel,gr.M),l=Pe.from(i.version),h=mr.from(i.maskPattern),i.toSJISFunc&&Ne.setToSJISFunction(i.toSJISFunc)),eo(e,l,a,h)};});var vr=rt(Kt=>{function Dn(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let e=n.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+n);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(a){return [a,a]}))),e.length===6&&e.push("F","F");let i=parseInt(e.join(""),16);return {r:i>>24&255,g:i>>16&255,b:i>>8&255,a:i&255,hex:"#"+e.slice(0,6).join("")}}Kt.getOptions=function(e){e||(e={}),e.color||(e.color={});let i=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,a=e.width&&e.width>=21?e.width:void 0,l=e.scale||4;return {width:a,scale:a?4:l,margin:i,color:{dark:Dn(e.color.dark||"#000000ff"),light:Dn(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Kt.getScale=function(e,i){return i.width&&i.width>=e+i.margin*2?i.width/(e+i.margin*2):i.scale};Kt.getImageWidth=function(e,i){let a=Kt.getScale(e,i);return Math.floor((e+i.margin*2)*a)};Kt.qrToImageData=function(e,i,a){let l=i.modules.size,h=i.modules.data,g=Kt.getScale(l,a),y=Math.floor((l+a.margin*2)*g),E=a.margin*g,V=[a.color.light,a.color.dark];for(let $=0;$<y;$++)for(let lt=0;lt<y;lt++){let it=($*y+lt)*4,mt=a.color.light;if($>=E&&lt>=E&&$<y-E&&lt<y-E){let wt=Math.floor(($-E)/g),vt=Math.floor((lt-E)/g);mt=V[h[wt*l+vt]?1:0];}e[it++]=mt.r,e[it++]=mt.g,e[it++]=mt.b,e[it]=mt.a;}};});var On=rt(ke=>{var Cr=vr();function ro(n,e,i){n.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=i,e.width=i,e.style.height=i+"px",e.style.width=i+"px";}function no(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}ke.render=function(e,i,a){let l=a,h=i;typeof l>"u"&&(!i||!i.getContext)&&(l=i,i=void 0),i||(h=no()),l=Cr.getOptions(l);let g=Cr.getImageWidth(e.modules.size,l),y=h.getContext("2d"),E=y.createImageData(g,g);return Cr.qrToImageData(E.data,e,l),ro(y,h,g),y.putImageData(E,0,0),h};ke.renderToDataURL=function(e,i,a){let l=a;typeof l>"u"&&(!i||!i.getContext)&&(l=i,i=void 0),l||(l={});let h=ke.render(e,i,l),g=l.type||"image/png",y=l.rendererOpts||{};return h.toDataURL(g,y.quality)};});var Fn=rt(Yn=>{var io=vr();function qn(n,e){let i=n.a/255,a=e+'="'+n.hex+'"';return i<1?a+" "+e+'-opacity="'+i.toFixed(2).slice(1)+'"':a}function Er(n,e,i){let a=n+e;return typeof i<"u"&&(a+=" "+i),a}function oo(n,e,i){let a="",l=0,h=false,g=0;for(let y=0;y<n.length;y++){let E=Math.floor(y%e),V=Math.floor(y/e);!E&&!h&&(h=true),n[y]?(g++,y>0&&E>0&&n[y-1]||(a+=h?Er("M",E+i,.5+V+i):Er("m",l,0),l=0,h=false),E+1<e&&n[y+1]||(a+=Er("h",g),g=0)):l++;}return a}Yn.render=function(e,i,a){let l=io.getOptions(i),h=e.modules.size,g=e.modules.data,y=h+l.margin*2,E=l.color.light.a?"<path "+qn(l.color.light,"fill")+' d="M0 0h'+y+"v"+y+'H0z"/>':"",V="<path "+qn(l.color.dark,"stroke")+' d="'+oo(g,h,l.margin)+'"/>',$='viewBox="0 0 '+y+" "+y+'"',it='<svg xmlns="http://www.w3.org/2000/svg" '+(l.width?'width="'+l.width+'" height="'+l.width+'" ':"")+$+' shape-rendering="crispEdges">'+E+V+`</svg>
8
- `;return typeof a=="function"&&a(null,it),it};});var $n=rt(xe=>{var fo=Hr(),Ar=zn(),Kn=On(),so=Fn();function Sr(n,e,i,a,l){let h=[].slice.call(arguments,1),g=h.length,y=typeof h[g-1]=="function";if(!y&&!fo())throw new Error("Callback required as last argument");if(y){if(g<2)throw new Error("Too few arguments provided");g===2?(l=i,i=e,e=a=void 0):g===3&&(e.getContext&&typeof l>"u"?(l=a,a=void 0):(l=a,a=i,i=e,e=void 0));}else {if(g<1)throw new Error("Too few arguments provided");return g===1?(i=e,e=a=void 0):g===2&&!e.getContext&&(a=i,i=e,e=void 0),new Promise(function(E,V){try{let $=Ar.create(i,a);E(n($,e,a));}catch($){V($);}})}try{let E=Ar.create(i,a);l(null,n(E,e,a));}catch(E){l(E);}}xe.create=Ar.create;xe.toCanvas=Sr.bind(null,Kn.render);xe.toDataURL=Sr.bind(null,Kn.renderToDataURL);xe.toString=Sr.bind(null,function(n,e,i){return so.render(n,i)});});var Gn=rt(Mt=>{var ao=Yr(),$t=Kr(),co=$n();function Hn(n){return n&&n.__esModule?n:{default:n}}var je=Hn(ao),lo=Hn(co),Vn=class{generateSymmetricKey(){let n=je.default.randomBytes(32);return $t.encodeBase64(n)}encryptSymmetric({plaintext:n,keyString:e}){let i=$t.decodeBase64(e),a=je.default.randomBytes(24),l=new TextEncoder().encode(n),h=je.default.secretbox(l,a,i);return {cipher:$t.encodeBase64(h),nonce:$t.encodeBase64(a)}}decryptSymmetric({encrypted:n,keyString:e}){try{let i=$t.decodeBase64(e),a=$t.decodeBase64(n.cipher),l=$t.decodeBase64(n.nonce),h=je.default.secretbox.open(a,l,i);if(!h)throw new Error("Decryption failed - invalid key or corrupted data");return new TextDecoder().decode(h)}catch(i){return console.error("Decryption failed",i),null}}},uo=Vn,ho=class{constructor(){this.prefix="pelican_auth_",this.defaultTTL=300*1e3,this.memoryCache=new Map;}set(n,e,i={}){let{ttlMs:a=this.defaultTTL,useSessionStorage:l=true}=i,h=Date.now()+a,g={value:e,expiresAt:h};if(l)try{sessionStorage.setItem(`${this.prefix}${n}`,JSON.stringify(g));}catch(y){console.warn("SessionStorage unavailable, using memory:",y),this.setMemory(n,g);}else this.setMemory(n,g);}get(n){try{let e=sessionStorage.getItem(`${this.prefix}${n}`);if(e){let i=JSON.parse(e);return Date.now()>i.expiresAt?(this.remove(n),null):i.value}}catch{}return this.getMemory(n)}remove(n){try{sessionStorage.removeItem(`${this.prefix}${n}`);}catch{}this.memoryCache.delete(n);}clear(){try{Object.keys(sessionStorage).forEach(n=>{n.startsWith(this.prefix)&&sessionStorage.removeItem(n);});}catch{}this.memoryCache.clear();}setMemory(n,e){this.memoryCache.set(n,e);let i=e.expiresAt-Date.now();setTimeout(()=>{this.memoryCache.delete(n);},i);}getMemory(n){let e=this.memoryCache.get(n);return e?Date.now()>e.expiresAt?(this.memoryCache.delete(n),null):e.value:null}},De=new ho,Wn=(n,e,i)=>{De.set("session",{sessionId:n,sessionKey:e},{ttlMs:i});},Jn=()=>De.get("session"),ze=()=>{De.remove("session");},xo=()=>{De.clear();},Zn=class{constructor(){this.state="idle",this.listeners=new Set;}get current(){return this.state}transition(n){this.state=n,this.listeners.forEach(e=>e(n));}subscribe(n){return this.listeners.add(n),()=>this.listeners.delete(n)}},Qn=class{constructor(n){this.reconnectAttempts=0,this.maxReconnectAttempts=3,this.isExplicitlyClosed=false,this.isReconnecting=false,this.handlers=n;}connect(n){this.url=n,this.isExplicitlyClosed=false,this.socket&&(this.socket.onclose=null,this.socket.onerror=null,this.socket.onmessage=null,this.socket.onopen=null,(this.socket.readyState===WebSocket.OPEN||this.socket.readyState===WebSocket.CONNECTING)&&this.socket.close()),this.socket=new WebSocket(n),this.socket.onopen=()=>{this.reconnectAttempts=0,this.isReconnecting=false,this.handlers.onOpen?.();},this.socket.onmessage=e=>{try{let i=JSON.parse(e.data);this.handlers.onMessage?.(i);}catch(i){console.error("Failed to parse WebSocket message",i);}},this.socket.onerror=e=>{!this.isReconnecting&&!this.isExplicitlyClosed&&this.handlers.onError?.(e);},this.socket.onclose=e=>{this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0),this.isReconnecting||this.handlers.onClose?.(e),!this.isExplicitlyClosed&&!this.isReconnecting&&this.reconnectAttempts<this.maxReconnectAttempts&&this.attemptReconnect();};}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts){console.warn("Max WebSocket reconnect attempts reached");return}this.isReconnecting=true,this.reconnectAttempts++;let n=Math.min(Math.pow(2,this.reconnectAttempts-1)*500,2e3);console.log(`Reconnecting WebSocket (attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts}) in ${n}ms...`),this.reconnectTimeout=window.setTimeout(()=>{this.url&&!this.isExplicitlyClosed&&this.connect(this.url);},n);}send(n){if(this.socket?.readyState===WebSocket.OPEN)try{this.socket.send(JSON.stringify(n));}catch(e){console.error("Failed to send WebSocket message:",e);}else console.warn("WebSocket not open, message not sent:",this.socket?.readyState);}close(){this.isExplicitlyClosed=true,this.isReconnecting=false,this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0),this.socket&&(this.socket.onclose=null,this.socket.onerror=null,this.socket.onmessage=null,this.socket.onopen=null,(this.socket.readyState===WebSocket.OPEN||this.socket.readyState===WebSocket.CONNECTING)&&this.socket.close(),this.socket=void 0);}get readyState(){return this.socket?.readyState}get isOpen(){return this.socket?.readyState===WebSocket.OPEN}},_r="https://identityapi.pelicanidentity.com",po=class{constructor(n){if(this.crypto=new uo,this.stateMachine=new Zn,this.sessionId="",this.sessionKey=null,this.useWebSocket=true,this.listeners={},!n.publicKey)throw new Error("Missing publicKey");if(!n.projectId)throw new Error("Missing projectId");if(!n.authType)throw new Error("Missing authType");this.config={continuousMode:false,forceQRCode:false,...n},this.stateMachine.subscribe(e=>this.emit("state",e));}on(n,e){var i;return (i=this.listeners)[n]??(i[n]=new Set),this.listeners[n].add(e),()=>this.listeners[n].delete(e)}async start(){if(this.stateMachine.current==="idle"){this.resetSession(),ze(),this.stateMachine.transition("initializing");try{this.sessionKey=this.crypto.generateSymmetricKey(),this.sessionId=crypto.randomUUID()+crypto.randomUUID(),this.useWebSocket=this.shouldUseWebSocket(),this.useWebSocket?await this.startWebSocketFlow():await this.startDeepLinkFlow();}catch(n){this.fail(n instanceof Error?n:new Error("Start failed"));}}}stop(){this.terminate(false);}destroy(){this.detachVisibilityRecovery(),this.clearBackupCheck(),this.transport?.close(),this.transport=void 0,this.listeners={};}useQrInstead(){this.useWebSocket=true,this.emit("deeplink",""),this.stateMachine.transition("initializing"),this.startWebSocketFlow();}useDeepLinkInstead(){this.useWebSocket=false,this.stateMachine.transition("initializing"),this.startDeepLinkFlow();}shouldUseWebSocket(){let n=navigator.userAgent,e=/(iPad|Android(?!.*Mobile))/i.test(n),a=/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(n)&&!e;return this.config.forceQRCode||!a}async startWebSocketFlow(){let{relayUrl:n,deeplinkUrl:e}=await this.fetchRelayUrl();this.transport=new Qn({onOpen:()=>{this.transport.send({type:"register",sessionID:this.sessionId,...this.config}),this.stateMachine.transition("awaiting-pair");},onMessage:i=>this.handleWebSocketMessage(i),onError:i=>{console.error("WebSocket error:",i),this.fail(new Error("WebSocket connection failed"));}}),this.transport.connect(n),await this.emitQRCode(e);}handleWebSocketMessage(n){switch(n.type){case "paired":this.stateMachine.transition("paired"),this.transport.send({type:"authenticate",sessionID:this.sessionId,...this.config,url:window.location.href});return;case "phone-auth-success":this.handleAuthSuccess(n);return;case "phone-terminated":this.fail(new Error("Authentication cancelled on device")),this.restartIfContinuous();return;case "confirmed":this.terminate(true),this.restartIfContinuous();return}}handleAuthSuccess(n){if(!this.sessionKey||!n.cipher||!n.nonce){this.fail(new Error("Invalid authentication payload")),this.restartIfContinuous();return}try{let e=this.crypto.decryptSymmetric({encrypted:{cipher:n.cipher,nonce:n.nonce},keyString:this.sessionKey});if(!e){this.fail(new Error("Invalid authentication data")),this.restartIfContinuous();return}let i=JSON.parse(e);this.emit("success",i),this.stateMachine.transition("authenticated"),this.transport?.send({type:"confirm",sessionID:this.sessionId});}catch{this.fail(new Error("Failed to decrypt authentication data")),this.restartIfContinuous();}}async startDeepLinkFlow(){let{deeplinkUrl:n}=await this.fetchRelayUrl();this.sessionKey&&Wn(this.sessionId,this.sessionKey,10*6e4),this.attachVisibilityRecovery(),await this.emitDeepLink(n),this.stateMachine.transition("awaiting-pair");}clearBackupCheck(){this.backupCheckTimeout&&(clearTimeout(this.backupCheckTimeout),this.backupCheckTimeout=void 0);}async checkSession(){let n=Jn();if(!n){this.fail(new Error("Authentication session not found")),setTimeout(()=>{this.stateMachine.transition("idle");},2e3);return}this.stateMachine.transition("awaiting-auth");try{let e=await fetch(`${_r}/session?session_id=${n.sessionId}`);if(!e.ok){this.fail(new Error("Session not found")),setTimeout(()=>{this.stateMachine.transition("idle");},2e3);return}let i=await e.json(),a=this.crypto.decryptSymmetric({encrypted:{cipher:i.cipher,nonce:i.nonce},keyString:n.sessionKey});if(!a){console.warn("Failed to decrypt session"),this.fail(new Error("Failed to decrypt session")),setTimeout(()=>{this.stateMachine.transition("idle");},2e3);return}let l=JSON.parse(a);this.clearBackupCheck(),ze(),this.emit("success",l),this.stateMachine.transition("authenticated"),this.config.continuousMode?setTimeout(()=>{this.stateMachine.transition("idle"),this.start();},1500):this.stateMachine.transition("idle");}catch(e){console.debug("Session check failed:",e),this.fail(new Error("Session check failed")),setTimeout(()=>{this.stateMachine.transition("idle");},2e3);return}}async emitQRCode(n){let e=`${n}?sessionID=${encodeURIComponent(this.sessionId)}&sessionKey=${encodeURIComponent(this.sessionKey)}&publicKey=${encodeURIComponent(this.config.publicKey)}&authType=${this.config.authType}&projectId=${encodeURIComponent(this.config.projectId)}`,i=await lo.default.toDataURL(e,{type:"image/png",scale:3,color:{light:"#ffffff",dark:"#424242ff"}});this.emit("qr",i);}async emitDeepLink(n){let e=`${n}?sessionID=${encodeURIComponent(this.sessionId)}&sessionKey=${encodeURIComponent(this.sessionKey)}&publicKey=${encodeURIComponent(this.config.publicKey)}&authType=${this.config.authType}&projectId=${encodeURIComponent(this.config.projectId)}`;this.emit("deeplink",e);}attachVisibilityRecovery(){this.visibilityHandler=async()=>{document.visibilityState==="visible"&&(this.useWebSocket||await this.checkSession());},document.addEventListener("visibilitychange",this.visibilityHandler);}detachVisibilityRecovery(){this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=void 0);}async fetchRelayUrl(){let{publicKey:n,projectId:e,authType:i}=this.config,a=await fetch(`${_r}/relay?public_key=${n}&auth_type=${i}&project_id=${e}`);if(!a.ok){let h=await a.text();throw new Error(h)}let l=await a.json();return {deeplinkUrl:l.deeplink_url,relayUrl:l.relay_url}}terminate(n){this.clearBackupCheck(),this.transport&&(n||this.transport.send({type:"client-terminated",sessionID:this.sessionId,projectId:this.config.projectId,publicKey:this.config.publicKey,authType:this.config.authType}),this.transport.close(),this.transport=void 0),ze(),this.resetSession(),this.config.continuousMode||this.detachVisibilityRecovery(),this.stateMachine.transition(n?"confirmed":"idle");}restartIfContinuous(){this.stateMachine.transition("idle"),this.clearBackupCheck(),this.transport?.close(),this.transport=void 0,this.config.continuousMode&&setTimeout(()=>{this.start();},150);}resetSession(){this.sessionId="",this.sessionKey=null;}emit(n,e){this.listeners[n]?.forEach(i=>i(e));}fail(n){this.emit("error",n),this.stateMachine.transition("error");}};Mt.BASEURL=_r;Mt.CryptoService=Vn;Mt.PelicanAuthentication=po;Mt.StateMachine=Zn;Mt.Transport=Qn;Mt.clearAllAuthData=xo;Mt.clearAuthSession=ze;Mt.getAuthSession=Jn;Mt.storeAuthSession=Wn;});var Xn=xi(Gn());function go(){if(document.getElementById("pelican-auth-styles"))return;let n=document.createElement("style");n.id="pelican-auth-styles",n.textContent=`@keyframes fadeUp {
6
+ Minimum version required to store current data is: `+u+`.
7
+ `);let g=Xi(e,i,c),y=ke.getSymbolSize(e),C=new Ki(y);return Wi(C,e),Ji(C),Zi(C,e),br(C,i,0),e>=7&&Qi(C,e),Gi(C,g),isNaN(a)&&(a=wr.getBestMask(C,br.bind(null,C,i))),wr.applyMask(a,C),br(C,i,a),{modules:C,version:e,errorCorrectionLevel:i,maskPattern:a,segments:c}}jn.create=function(e,i){if(typeof e>"u"||e==="")throw new Error("No input text");let a=gr.M,c,u;return typeof i<"u"&&(a=gr.from(i.errorCorrectionLevel,gr.M),c=Ne.from(i.version),u=wr.from(i.maskPattern),i.toSJISFunc&&ke.setToSJISFunction(i.toSJISFunc)),eo(e,c,a,u)};});var vr=rt($t=>{function Dn(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let e=n.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+n);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(a){return [a,a]}))),e.length===6&&e.push("F","F");let i=parseInt(e.join(""),16);return {r:i>>24&255,g:i>>16&255,b:i>>8&255,a:i&255,hex:"#"+e.slice(0,6).join("")}}$t.getOptions=function(e){e||(e={}),e.color||(e.color={});let i=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,a=e.width&&e.width>=21?e.width:void 0,c=e.scale||4;return {width:a,scale:a?4:c,margin:i,color:{dark:Dn(e.color.dark||"#000000ff"),light:Dn(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};$t.getScale=function(e,i){return i.width&&i.width>=e+i.margin*2?i.width/(e+i.margin*2):i.scale};$t.getImageWidth=function(e,i){let a=$t.getScale(e,i);return Math.floor((e+i.margin*2)*a)};$t.qrToImageData=function(e,i,a){let c=i.modules.size,u=i.modules.data,g=$t.getScale(c,a),y=Math.floor((c+a.margin*2)*g),C=a.margin*g,D=[a.color.light,a.color.dark];for(let q=0;q<y;q++)for(let ft=0;ft<y;ft++){let it=(q*y+ft)*4,bt=a.color.light;if(q>=C&&ft>=C&&q<y-C&&ft<y-C){let wt=Math.floor((q-C)/g),vt=Math.floor((ft-C)/g);bt=D[u[wt*c+vt]?1:0];}e[it++]=bt.r,e[it++]=bt.g,e[it++]=bt.b,e[it]=bt.a;}};});var On=rt(je=>{var Cr=vr();function ro(n,e,i){n.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=i,e.width=i,e.style.height=i+"px",e.style.width=i+"px";}function no(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}je.render=function(e,i,a){let c=a,u=i;typeof c>"u"&&(!i||!i.getContext)&&(c=i,i=void 0),i||(u=no()),c=Cr.getOptions(c);let g=Cr.getImageWidth(e.modules.size,c),y=u.getContext("2d"),C=y.createImageData(g,g);return Cr.qrToImageData(C.data,e,c),ro(y,u,g),y.putImageData(C,0,0),u};je.renderToDataURL=function(e,i,a){let c=a;typeof c>"u"&&(!i||!i.getContext)&&(c=i,i=void 0),c||(c={});let u=je.render(e,i,c),g=c.type||"image/png",y=c.rendererOpts||{};return u.toDataURL(g,y.quality)};});var Fn=rt(Kn=>{var io=vr();function qn(n,e){let i=n.a/255,a=e+'="'+n.hex+'"';return i<1?a+" "+e+'-opacity="'+i.toFixed(2).slice(1)+'"':a}function Er(n,e,i){let a=n+e;return typeof i<"u"&&(a+=" "+i),a}function oo(n,e,i){let a="",c=0,u=false,g=0;for(let y=0;y<n.length;y++){let C=Math.floor(y%e),D=Math.floor(y/e);!C&&!u&&(u=true),n[y]?(g++,y>0&&C>0&&n[y-1]||(a+=u?Er("M",C+i,.5+D+i):Er("m",c,0),c=0,u=false),C+1<e&&n[y+1]||(a+=Er("h",g),g=0)):c++;}return a}Kn.render=function(e,i,a){let c=io.getOptions(i),u=e.modules.size,g=e.modules.data,y=u+c.margin*2,C=c.color.light.a?"<path "+qn(c.color.light,"fill")+' d="M0 0h'+y+"v"+y+'H0z"/>':"",D="<path "+qn(c.color.dark,"stroke")+' d="'+oo(g,u,c.margin)+'"/>',q='viewBox="0 0 '+y+" "+y+'"',it='<svg xmlns="http://www.w3.org/2000/svg" '+(c.width?'width="'+c.width+'" height="'+c.width+'" ':"")+q+' shape-rendering="crispEdges">'+C+D+`</svg>
8
+ `;return typeof a=="function"&&a(null,it),it};});var $n=rt(pe=>{var so=Hr(),Ar=zn(),Yn=On(),fo=Fn();function Sr(n,e,i,a,c){let u=[].slice.call(arguments,1),g=u.length,y=typeof u[g-1]=="function";if(!y&&!so())throw new Error("Callback required as last argument");if(y){if(g<2)throw new Error("Too few arguments provided");g===2?(c=i,i=e,e=a=void 0):g===3&&(e.getContext&&typeof c>"u"?(c=a,a=void 0):(c=a,a=i,i=e,e=void 0));}else {if(g<1)throw new Error("Too few arguments provided");return g===1?(i=e,e=a=void 0):g===2&&!e.getContext&&(a=i,i=e,e=void 0),new Promise(function(C,D){try{let q=Ar.create(i,a);C(n(q,e,a));}catch(q){D(q);}})}try{let C=Ar.create(i,a);c(null,n(C,e,a));}catch(C){c(C);}}pe.create=Ar.create;pe.toCanvas=Sr.bind(null,Yn.render);pe.toDataURL=Sr.bind(null,Yn.renderToDataURL);pe.toString=Sr.bind(null,function(n,e,i){return fo.render(n,i)});});var Gn=rt(Tt=>{var ao=Kr(),Ht=Yr(),co=$n();function Hn(n){return n&&n.__esModule?n:{default:n}}var ze=Hn(ao),lo=Hn(co),Vn=class{generateSymmetricKey(){let n=ze.default.randomBytes(32);return Ht.encodeBase64(n)}encryptSymmetric({plaintext:n,keyString:e}){let i=Ht.decodeBase64(e),a=ze.default.randomBytes(24),c=new TextEncoder().encode(n),u=ze.default.secretbox(c,a,i);return {cipher:Ht.encodeBase64(u),nonce:Ht.encodeBase64(a)}}decryptSymmetric({encrypted:n,keyString:e}){try{let i=Ht.decodeBase64(e),a=Ht.decodeBase64(n.cipher),c=Ht.decodeBase64(n.nonce),u=ze.default.secretbox.open(a,c,i);if(!u)throw new Error("Decryption failed - invalid key or corrupted data");return new TextDecoder().decode(u)}catch(i){return console.error("Decryption failed",i),null}}},uo=Vn,ho=class{constructor(){this.prefix="pelican_auth_",this.defaultTTL=300*1e3,this.memoryCache=new Map;}set(n,e,i={}){let{ttlMs:a=this.defaultTTL,useSessionStorage:c=true}=i,u=Date.now()+a,g={value:e,expiresAt:u};if(c)try{sessionStorage.setItem(`${this.prefix}${n}`,JSON.stringify(g));}catch(y){console.warn("SessionStorage unavailable, using memory:",y),this.setMemory(n,g);}else this.setMemory(n,g);}get(n){try{let e=sessionStorage.getItem(`${this.prefix}${n}`);if(e){let i=JSON.parse(e);return Date.now()>i.expiresAt?(this.remove(n),null):i.value}}catch{}return this.getMemory(n)}remove(n){try{sessionStorage.removeItem(`${this.prefix}${n}`);}catch{}this.memoryCache.delete(n);}clear(){try{Object.keys(sessionStorage).forEach(n=>{n.startsWith(this.prefix)&&sessionStorage.removeItem(n);});}catch{}this.memoryCache.clear();}setMemory(n,e){this.memoryCache.set(n,e);let i=e.expiresAt-Date.now();setTimeout(()=>{this.memoryCache.delete(n);},i);}getMemory(n){let e=this.memoryCache.get(n);return e?Date.now()>e.expiresAt?(this.memoryCache.delete(n),null):e.value:null}},Oe=new ho,Wn=(n,e,i)=>{Oe.set("session",{sessionId:n,sessionKey:e},{ttlMs:i});},Jn=()=>Oe.get("session"),De=()=>{Oe.remove("session");},xo=()=>{Oe.clear();},Zn=class{constructor(){this.state="idle",this.listeners=new Set;}get current(){return this.state}transition(n){this.state=n,this.listeners.forEach(e=>e(n));}subscribe(n){return this.listeners.add(n),()=>this.listeners.delete(n)}},Qn=class{constructor(n){this.reconnectAttempts=0,this.maxReconnectAttempts=3,this.isExplicitlyClosed=false,this.isReconnecting=false,this.handlers=n;}connect(n){this.url=n,this.isExplicitlyClosed=false,this.socket&&(this.socket.onclose=null,this.socket.onerror=null,this.socket.onmessage=null,this.socket.onopen=null,(this.socket.readyState===WebSocket.OPEN||this.socket.readyState===WebSocket.CONNECTING)&&this.socket.close()),this.socket=new WebSocket(n),this.socket.onopen=()=>{this.reconnectAttempts=0,this.isReconnecting=false,this.handlers.onOpen?.();},this.socket.onmessage=e=>{try{let i=JSON.parse(e.data);this.handlers.onMessage?.(i);}catch(i){console.error("Failed to parse WebSocket message",i);}},this.socket.onerror=e=>{!this.isReconnecting&&!this.isExplicitlyClosed&&this.handlers.onError?.(e);},this.socket.onclose=e=>{this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0),this.isReconnecting||this.handlers.onClose?.(e),!this.isExplicitlyClosed&&!this.isReconnecting&&this.reconnectAttempts<this.maxReconnectAttempts&&this.attemptReconnect();};}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts){console.warn("Max WebSocket reconnect attempts reached");return}this.isReconnecting=true,this.reconnectAttempts++;let n=Math.min(Math.pow(2,this.reconnectAttempts-1)*500,2e3);console.log(`Reconnecting WebSocket (attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts}) in ${n}ms...`),this.reconnectTimeout=window.setTimeout(()=>{this.url&&!this.isExplicitlyClosed&&this.connect(this.url);},n);}send(n){if(this.socket?.readyState===WebSocket.OPEN)try{this.socket.send(JSON.stringify(n));}catch(e){console.error("Failed to send WebSocket message:",e);}else console.warn("WebSocket not open, message not sent:",this.socket?.readyState);}close(){this.isExplicitlyClosed=true,this.isReconnecting=false,this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0),this.socket&&(this.socket.onclose=null,this.socket.onerror=null,this.socket.onmessage=null,this.socket.onopen=null,(this.socket.readyState===WebSocket.OPEN||this.socket.readyState===WebSocket.CONNECTING)&&this.socket.close(),this.socket=void 0);}get readyState(){return this.socket?.readyState}get isOpen(){return this.socket?.readyState===WebSocket.OPEN}},_r="https://identityapi.pelicanidentity.com",po=class{constructor(n){if(this.crypto=new uo,this.stateMachine=new Zn,this.sessionId="",this.sessionKey=null,this.useWebSocket=true,this.listeners={},!n.publicKey)throw new Error("Missing publicKey");if(!n.projectId)throw new Error("Missing projectId");if(!n.authType)throw new Error("Missing authType");this.config={continuousMode:false,forceQRCode:false,...n},this.stateMachine.subscribe(e=>this.emit("state",e));}on(n,e){var i;return (i=this.listeners)[n]??(i[n]=new Set),this.listeners[n].add(e),()=>this.listeners[n].delete(e)}async start(){if(this.config.authType!=="id-verification"&&this.config.authType!=="signup"&&this.config.authType!=="login"){this.fail(new Error("Invalid authType"));return}if(!this.config.projectId){this.fail(new Error("Missing projectId"));return}if(!this.config.publicKey){this.fail(new Error("Missing publicKey"));return}if(this.stateMachine.current==="idle"){this.resetSession(),De(),this.stateMachine.transition("initializing");try{this.sessionKey=this.crypto.generateSymmetricKey(),this.sessionId=crypto.randomUUID()+crypto.randomUUID(),this.useWebSocket=this.shouldUseWebSocket(),this.useWebSocket?await this.startWebSocketFlow():await this.startDeepLinkFlow();}catch(n){this.fail(n instanceof Error?n:new Error("Start failed"));}}}stop(){this.terminate(false);}openWebAuth(){if(!this.sessionKey||!this.sessionId){this.fail(new Error("No active session. Call start() before openWebAuth()."));return}let n=window.location.origin,i=`https://vault.pelicanidentity.com/auth?${new URLSearchParams({projectId:this.config.projectId,publicKey:this.config.publicKey,authType:this.config.authType,sessionId:this.sessionId,sessionKey:this.sessionKey,origin:n}).toString()}`,a=window.open(i,"pelican-auth","width=480,height=640,left=400,top=100,resizable=no,scrollbars=no")??window.open(i,"_blank");if(!a){this.fail(new Error("Unable to open authentication window. Please allow popups for this site and try again."));return}a.focus(),this.stateMachine.transition("awaiting-pair");let c=()=>{window.removeEventListener("message",u),clearInterval(g);},u=y=>{if(y.origin!=="https://vault.pelicanidentity.com"||y.source!==a)return;let{type:C,payload:D}=y.data??{};if(C==="pelican-auth-success"){if(console.log("Web auth success"),c(),!D?.cipher||!D?.nonce){this.fail(new Error("Invalid web auth payload")),this.restartIfContinuous();return}try{let q=this.crypto.decryptSymmetric({encrypted:{cipher:D.cipher,nonce:D.nonce},keyString:this.sessionKey});if(!q){this.fail(new Error("Failed to decrypt web auth response")),this.restartIfContinuous();return}let ft=JSON.parse(q);this.emit("success",ft),this.stateMachine.transition("authenticated"),this.restartIfContinuous();}catch{this.fail(new Error("Failed to decrypt web auth response")),this.restartIfContinuous();}}C==="pelican-auth-cancelled"&&(c(),this.fail(new Error("Authentication cancelled")),this.restartIfContinuous()),C==="pelican-auth-error"&&(c(),this.fail(new Error(D?.message??"Web auth failed")),this.restartIfContinuous());};window.addEventListener("message",u);let g=setInterval(()=>{a.closed&&(c(),["authenticated","confirmed","error"].includes(this.stateMachine.current)||(this.fail(new Error("Authentication window closed")),this.restartIfContinuous()));},500);}destroy(){this.detachVisibilityRecovery(),this.clearBackupCheck(),this.transport?.close(),this.transport=void 0,this.listeners={};}useQrInstead(){this.useWebSocket=true,this.emit("deeplink",""),this.stateMachine.transition("initializing"),this.startWebSocketFlow();}useDeepLinkInstead(){this.useWebSocket=false,this.stateMachine.transition("initializing"),this.startDeepLinkFlow();}shouldUseWebSocket(){let n=navigator.userAgent,e=/(iPad|Android(?!.*Mobile))/i.test(n),a=/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(n)&&!e;return this.config.forceQRCode||!a}async startWebSocketFlow(){let{relayUrl:n,deeplinkUrl:e}=await this.fetchRelayUrl();this.transport=new Qn({onOpen:()=>{this.transport.send({type:"register",sessionID:this.sessionId,...this.config}),this.stateMachine.transition("awaiting-pair");},onMessage:i=>this.handleWebSocketMessage(i),onError:i=>{console.error("WebSocket error:",i),this.fail(new Error("WebSocket connection failed"));}}),this.transport.connect(n),await this.emitQRCode(e);}handleWebSocketMessage(n){switch(n.type){case "paired":this.stateMachine.transition("paired"),this.transport.send({type:"authenticate",sessionID:this.sessionId,...this.config,url:window.location.href});return;case "phone-auth-success":this.handleAuthSuccess(n);return;case "phone-terminated":this.fail(new Error("Authentication cancelled on device")),this.restartIfContinuous();return;case "confirmed":this.terminate(true),this.restartIfContinuous();return}}handleAuthSuccess(n){if(!this.sessionKey||!n.cipher||!n.nonce){this.fail(new Error("Invalid authentication payload")),this.restartIfContinuous();return}try{let e=this.crypto.decryptSymmetric({encrypted:{cipher:n.cipher,nonce:n.nonce},keyString:this.sessionKey});if(!e){this.fail(new Error("Invalid authentication data")),this.restartIfContinuous();return}let i=JSON.parse(e);this.emit("success",i),this.stateMachine.transition("authenticated"),this.transport?.send({type:"confirm",sessionID:this.sessionId});}catch{this.fail(new Error("Failed to decrypt authentication data")),this.restartIfContinuous();}}async startDeepLinkFlow(){let{deeplinkUrl:n}=await this.fetchRelayUrl();this.sessionKey&&Wn(this.sessionId,this.sessionKey,10*6e4),this.attachVisibilityRecovery(),await this.emitDeepLink(n),this.stateMachine.transition("awaiting-pair");}clearBackupCheck(){this.backupCheckTimeout&&(clearTimeout(this.backupCheckTimeout),this.backupCheckTimeout=void 0);}async checkSession(){let n=Jn();if(!n){this.fail(new Error("Authentication session not found")),setTimeout(()=>{this.stateMachine.transition("idle");},2e3);return}this.stateMachine.transition("awaiting-auth");try{let e=await fetch(`${_r}/session?session_id=${n.sessionId}`);if(!e.ok){this.fail(new Error("Session not found")),setTimeout(()=>{this.stateMachine.transition("idle");},2e3);return}let i=await e.json(),a=this.crypto.decryptSymmetric({encrypted:{cipher:i.cipher,nonce:i.nonce},keyString:n.sessionKey});if(!a){console.warn("Failed to decrypt session"),this.fail(new Error("Failed to decrypt session")),setTimeout(()=>{this.stateMachine.transition("idle");},2e3);return}let c=JSON.parse(a);this.clearBackupCheck(),De(),this.emit("success",c),this.stateMachine.transition("authenticated"),this.config.continuousMode?setTimeout(()=>{this.stateMachine.transition("idle"),this.start();},1500):this.stateMachine.transition("idle");}catch(e){console.debug("Session check failed:",e),this.fail(new Error("Session check failed")),setTimeout(()=>{this.stateMachine.transition("idle");},2e3);return}}async emitQRCode(n){let e=`${n}?sessionID=${encodeURIComponent(this.sessionId)}&sessionKey=${encodeURIComponent(this.sessionKey)}&publicKey=${encodeURIComponent(this.config.publicKey)}&authType=${this.config.authType}&projectId=${encodeURIComponent(this.config.projectId)}`,i=await lo.default.toDataURL(e,{type:"image/png",scale:3,color:{light:"#ffffff",dark:"#424242ff"}});this.emit("qr",i);}async emitDeepLink(n){let e=`${n}?sessionID=${encodeURIComponent(this.sessionId)}&sessionKey=${encodeURIComponent(this.sessionKey)}&publicKey=${encodeURIComponent(this.config.publicKey)}&authType=${this.config.authType}&projectId=${encodeURIComponent(this.config.projectId)}`;this.emit("deeplink",e);}attachVisibilityRecovery(){this.visibilityHandler=async()=>{document.visibilityState==="visible"&&(this.useWebSocket||await this.checkSession());},document.addEventListener("visibilitychange",this.visibilityHandler);}detachVisibilityRecovery(){this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=void 0);}async fetchRelayUrl(){let{publicKey:n,projectId:e,authType:i}=this.config,a=await fetch(`${_r}/relay?public_key=${n}&auth_type=${i}&project_id=${e}`);if(!a.ok){let u=await a.text();throw new Error(u)}let c=await a.json();return {deeplinkUrl:c.deeplink_url,relayUrl:c.relay_url}}terminate(n){this.clearBackupCheck(),this.transport&&(n||this.transport.send({type:"client-terminated",sessionID:this.sessionId,projectId:this.config.projectId,publicKey:this.config.publicKey,authType:this.config.authType}),this.transport.close(),this.transport=void 0),De(),this.resetSession(),this.config.continuousMode||this.detachVisibilityRecovery(),this.stateMachine.transition(n?"confirmed":"idle");}restartIfContinuous(){this.config.continuousMode?(this.stateMachine.transition("idle"),this.clearBackupCheck(),this.transport?.close(),this.transport=void 0,setTimeout(()=>{this.start();},150)):this.stateMachine.transition("idle");}resetSession(){this.sessionId="",this.sessionKey=null;}emit(n,e){this.listeners[n]?.forEach(i=>i(e));}fail(n){this.emit("error",n),this.stateMachine.transition("error");}};Tt.BASEURL=_r;Tt.CryptoService=Vn;Tt.PelicanAuthentication=po;Tt.StateMachine=Zn;Tt.Transport=Qn;Tt.clearAllAuthData=xo;Tt.clearAuthSession=De;Tt.getAuthSession=Jn;Tt.storeAuthSession=Wn;});var Xn=xi(Gn());function go(){if(document.getElementById("pelican-auth-styles"))return;let n=document.createElement("style");n.id="pelican-auth-styles",n.textContent=`@keyframes fadeUp {
9
9
  from {
10
10
  opacity: 0;
11
11
  transform: translateY(20px);
@@ -129,14 +129,14 @@ Minimum version required to store current data is: `+h+`.
129
129
 
130
130
  @media (min-width: 768px) {
131
131
  .main-heading {
132
- font-size: 1rem;
132
+ font-size: 0.8rem;
133
133
  font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
134
134
  }
135
135
  }
136
136
 
137
137
  @media (min-width: 1024px) {
138
138
  .main-heading {
139
- font-size: 1rem;
139
+ font-size: 0.8rem;
140
140
  font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
141
141
  }
142
142
  }
@@ -186,6 +186,28 @@ Minimum version required to store current data is: `+h+`.
186
186
  justify-content: center;
187
187
  }
188
188
 
189
+ .web-auth-btn {
190
+ all: unset; /* Reset all inherited styles */
191
+ cursor: pointer;
192
+ margin-top: 1rem;
193
+ display: inline-block;
194
+ padding: 0.7rem 1.25rem;
195
+ background-color: #101010ff;
196
+ width: fit-content;
197
+ align-self: center;
198
+
199
+ border-radius: 28px;
200
+ color: #fff;
201
+ font-weight: 500;
202
+ font-size: 0.8rem;
203
+ text-decoration: none;
204
+ transition: background-color 0.2s;
205
+ font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
206
+ }
207
+
208
+ .web-auth-btn:hover {
209
+ opacity: 0.9;
210
+ }
189
211
  .qr-wrapper {
190
212
  display: flex;
191
213
  justify-content: center;
@@ -340,20 +362,20 @@ Minimum version required to store current data is: `+h+`.
340
362
  opacity: 0;
341
363
  }
342
364
  }
343
- `,document.head.appendChild(n);}function ti(n,e){go();let i=document.getElementById(n);if(!i)throw new Error(`Container with id "${n}" not found`);let a=new Xn.PelicanAuthentication(e),l={isOpen:e.continuousMode||false,qr:null,deeplink:null,authState:"idle",successMessage:null,error:null},h={isProcessing:()=>["initializing","paired","awaiting-auth"].includes(l.authState),showMobileAuth:()=>!e.forceQRCode&&l.deeplink,showQRView:()=>e.forceQRCode&&l.qr&&l.authState==="awaiting-pair"||!e.forceQRCode&&l.qr&&l.authState==="awaiting-pair",successText:()=>`${e.authType==="login"?"login":e.authType==="signup"?"signup":e.authType==="id-verification"?"verification":"authentication"} complete!`},g=[a.on("qr",J=>{l.qr=J,y();}),a.on("deeplink",J=>{l.deeplink=J,y();}),a.on("state",J=>{l.authState=J,y();}),a.on("success",J=>{e.onSuccess(J),e.continuousMode?(l.successMessage=h.successText(),y(),setTimeout(()=>{l.successMessage=null,y();},2e3)):(l.isOpen=false,y());}),a.on("error",J=>{l.error=J,e.onError?.(J),y();})];function y(){if(!i)return;let J=E();i.innerHTML=J,Bt();}function E(){let J=V(),pt=l.isOpen?$():"";return `
365
+ `,document.head.appendChild(n);}function ti(n,e){go();let i=document.getElementById(n);if(!i)throw new Error(`Container with id "${n}" not found`);let a=new Xn.PelicanAuthentication(e),c={isOpen:e.continuousMode||false,qr:null,deeplink:null,authState:"idle",successMessage:null,error:null},u={isProcessing:()=>["initializing","paired","awaiting-auth"].includes(c.authState),showMobileAuth:()=>!e.forceQRCode&&c.deeplink,showQRView:()=>e.forceQRCode&&c.qr&&c.authState==="awaiting-pair"||!e.forceQRCode&&c.qr&&c.authState==="awaiting-pair",successText:()=>`${e.authType==="login"?"login":e.authType==="signup"?"signup":e.authType==="id-verification"?"verification":"authentication"} complete!`},g=[a.on("qr",J=>{c.qr=J,y();}),a.on("deeplink",J=>{c.deeplink=J,y();}),a.on("state",J=>{c.authState=J,y();}),a.on("success",J=>{e.onSuccess(J),e.continuousMode?(c.successMessage=u.successText(),y(),setTimeout(()=>{c.successMessage=null,y();},2e3)):(c.isOpen=false,y());}),a.on("error",J=>{c.error=J,e.onError?.(J),y();})];function y(){if(!i)return;let J=C();i.innerHTML=J,Bt();}function C(){let J=D(),Ct=c.isOpen?q():"";return `
344
366
  <section style="max-width: 520px; width: 100%;">
345
367
  ${J}
346
- ${pt}
368
+ ${Ct}
347
369
  </section>
348
- `}function V(){if(e.continuousMode)return "";let J=l.authState!=="idle";return `
370
+ `}function D(){if(e.continuousMode)return "";let J=c.authState!=="idle";return `
349
371
  <div style="width: 100%; display: flex; justify-content: space-between; align-items: center; margin-bottom: ${J?"0.4rem":"0"};">
350
372
  <button
351
373
  type="button"
352
374
  id="pelican-start-btn"
353
375
  style="border: none; background: transparent; cursor: pointer;"
354
- ${l.isOpen?"disabled":""}
376
+ ${c.isOpen?"disabled":""}
355
377
  >
356
- ${e.buttonComponent||zt()}
378
+ ${e.buttonComponent||Dt()}
357
379
  </button>
358
380
 
359
381
  ${J?`
@@ -381,41 +403,48 @@ Minimum version required to store current data is: `+h+`.
381
403
  </button>
382
404
  `:""}
383
405
  </div>
384
- `}function $(){return `
406
+ `}function q(){return `
385
407
  <div style="max-width: 520px; width: 100%; display: flex; justify-content: center; align-items: center;">
386
408
  <div class="js-auth-container">
387
- ${lt()}
409
+ ${ft()}
388
410
  ${it()}
389
- ${mt()}
390
- ${re()}
411
+ ${bt()}
412
+ ${ne()}
391
413
  </div>
392
414
  </div>
393
- `}function lt(){return l.successMessage?`
415
+ `}function ft(){return c.successMessage?`
394
416
  <div class="success-message" style="text-align: center;">
395
- ${l.successMessage}
417
+ ${c.successMessage}
396
418
  ${e.continuousMode?`
397
419
  <p style="font-size: 0.8rem; margin-top: 0.5rem; color: #f3f3f3; text-align: center;">
398
420
  Preparing next session...
399
421
  </p>
400
422
  `:""}
401
423
  </div>
402
- `:""}function it(){return !l.error||l.authState!=="error"?"":`
424
+ `:""}function it(){return !c.error||c.authState!=="error"?"":`
403
425
  <div class="error-wrapper">
404
- <p class="error-message">${l.error.message}</p>
426
+ <p class="error-message">${c.error.message}</p>
405
427
  </div>
406
- `}function mt(){return h.isProcessing()?`
428
+ `}function bt(){return u.isProcessing()?`
407
429
  <div class="content-wrapper">
408
430
  <h2 class="main-heading">one sec...</h2>
409
431
  <span class="loader" style="margin: 1rem auto; width: 252px;"></span>
410
432
  </div>
411
- `:l.authState==="awaiting-pair"&&!l.successMessage?`
433
+ `:c.authState==="awaiting-pair"&&!c.successMessage?`
412
434
  <div class="content-wrapper">
413
435
  <div class="unpaired-container">
414
- ${!l.deeplink&&!e.forceQRCode?'<h2 class="main-heading">Open Pelican Vault</h2>':""}
436
+ ${!c.deeplink&&!e.forceQRCode?'<h2 class="main-heading">Open Pelican Vault mobile app</h2>':""}
415
437
  ${wt()}
438
+ <button
439
+ type="button"
440
+ className="web-auth-btn"
441
+ id="pelican-web-auth-btn"
442
+ >
443
+ Use browser vault instead
444
+ </button>
416
445
  </div>
417
446
  </div>
418
- `:'<div class="content-wrapper"></div>'}function wt(){return h.showMobileAuth()?vt():h.showQRView()?Lt():`
447
+ `:'<div class="content-wrapper"></div>'}function wt(){return u.showMobileAuth()?vt():u.showQRView()?Pt():`
419
448
  <div class="loader-container">
420
449
  <span class="loader"></span>
421
450
  </div>
@@ -428,7 +457,7 @@ Minimum version required to store current data is: `+h+`.
428
457
  style="width: 80px; height: 80px;"
429
458
  />
430
459
  </div>
431
- <a href="${l.deeplink}" class="open-app-link">
460
+ <a href="${c.deeplink}" class="open-app-link">
432
461
  Open Pelican Vault
433
462
  </a>
434
463
  <p class="helper-text">
@@ -475,13 +504,13 @@ Minimum version required to store current data is: `+h+`.
475
504
  Use QR Code
476
505
  </button>
477
506
  </div>
478
- `}function Lt(){return `
507
+ `}function Pt(){return `
479
508
  <div class="qr-container">
480
509
  <div class="qr-wrapper">
481
- ${l.qr?`<img src="${l.qr}" alt="QR Code" class="qr-image" />`:'<span class="loader"></span>'}
510
+ ${c.qr?`<img src="${c.qr}" alt="QR Code" class="qr-image" />`:'<span class="loader"></span>'}
482
511
  </div>
483
512
  </div>
484
- `}function zt(){return `
513
+ `}function Dt(){return `
485
514
  <div class="pelican-btn-wrapper" style="display: flex; flex-direction: row; background-color:#2b2b2bff; align-items: center; justify-content: center; gap: 0.35rem; padding: 0.35rem 0.7rem; border-radius: 20px; cursor: pointer; border: 1px solid #353535ff;">
486
515
  <div>
487
516
  <svg width="28" height="28" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Pelican logo">
@@ -498,12 +527,12 @@ Minimum version required to store current data is: `+h+`.
498
527
  </p>
499
528
  </div>
500
529
  </div>
501
- `}function re(){return `
530
+ `}function ne(){return `
502
531
  <div style="display: flex; justify-content: center; align-items: center;">
503
532
  <div style="display: flex; justify-content: center; align-items: center; border-radius: 1.2rem; gap: 0.3rem; padding: 0.7rem 1rem; height: 1.4rem;">
504
533
  <div>
505
534
  <p style="font-size: 12px; font-weight: 500; color: #585858; font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif; margin: 0;">
506
- Get Pelican Vault
535
+ Get vault mobile app &rarr;
507
536
  </p>
508
537
  </div>
509
538
  <a href="https://apps.apple.com/us/app/pelican-vault/id6755097751" target="_blank" rel="noopener noreferrer" style="text-decoration: none;">
@@ -534,5 +563,5 @@ Minimum version required to store current data is: `+h+`.
534
563
  background-color: #f5f5f5 !important;
535
564
  }
536
565
  </style>
537
- `}function Bt(){let J=document.getElementById("pelican-start-btn");J&&J.addEventListener("click",Tt);let pt=document.getElementById("pelican-stop-btn");pt&&pt.addEventListener("click",dt);}function Tt(){a.start(),l.isOpen=true,y();}function dt(){a.stop(),e.onClose?.(),l.isOpen=false,y();}return y(),e.continuousMode&&a.start(),function(){g.forEach(pt=>pt()),a.destroy(),i.innerHTML="";}}typeof window<"u"&&(window.Pelican={createPelicanAuth:ti});export{ti as createPelicanAuth};//# sourceMappingURL=index.mjs.map
566
+ `}function Bt(){let J=document.getElementById("pelican-start-btn");J&&J.addEventListener("click",It);let Ct=document.getElementById("pelican-stop-btn");Ct&&Ct.addEventListener("click",dt);let Vt=document.getElementById("pelican-web-auth-btn");Vt&&Vt.addEventListener("click",mt);}function It(){a.start(),c.isOpen=true,y();}function dt(){a.stop(),e.onClose?.(),c.isOpen=false,y();}function mt(){a.openWebAuth(),c.isOpen=true,y();}return y(),e.continuousMode&&a.start(),function(){g.forEach(Ct=>Ct()),a.destroy(),i.innerHTML="";}}typeof window<"u"&&(window.Pelican={createPelicanAuth:ti});export{ti as createPelicanAuth};//# sourceMappingURL=index.mjs.map
538
567
  //# sourceMappingURL=index.mjs.map