@ar.io/sdk 1.2.0-alpha.19 → 1.2.0-alpha.20
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/bundles/web.bundle.min.js +3 -3
- package/lib/cjs/common/io.js +20 -20
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/io.js +20 -20
- package/lib/esm/version.js +1 -1
- package/lib/types/common/io.d.ts +2 -1
- package/lib/types/io.d.ts +9 -2
- package/lib/types/version.d.ts +1 -1
- package/package.json +5 -1
|
@@ -105,7 +105,7 @@ use chrome, FireFox or Internet Explorer 11`)}var r=Ei(),h=N1(),o=r.Buffer,l=r.k
|
|
|
105
105
|
`))},ei.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},ei}var W2,oj,K6,aj,sj,K2,hj,__,fj,M_,uj,S_,cj,E_,lj,mn,A_,dj,Ui,T_,pj,qi,x_,gj,jr,R_,mj,lo,k_,vj,pr,I_,yj,Ii,_pt,bj,B_,H6,wj,O_,_j,C_,Mj,P_,Sj,N_,Ej,L_,Aj,D_,Tj,$_,U_,xj,Ept,q_,Rj,F_,kj,j_,Ij,z_,Bj,W_,Oj,xpt,K_,Cj,H_,Pj,G_,Nj,V_,Lj,Z_,Nh,J_,Dj,Tn,X_,$j,Y_,Uj,Q_,qj,tM,Fj,TZ,eM,jj,rM,zj,iM,Wj,G6,nM,Kj,oM,Hj,Mh,aM,Gj,Na,V6,Vj,La,Zj,sM,Jj,hM,Xj,fM,Yj,uM,Qj,cM,tz,Zl,ez,lM,rz,Z6,J6,iz,dM,nz,X6,oz,pM,az,gM,sz,mM,hz,vM,fz,yM,uz,bM,cz,NZ,wM,dz,_M,pz,Ms,MM,gz,Do,SM,mz,zr,EM,vz,Sh,AM,yz,Y6,bz,an,Q6,wz,Bi,Ss,_z,pf,Mz,Es,Sz,$Z,Ez,TM,Nt,qZ,Az,xM,Lt,va,Tz,H2,xz,tb,Rz,kz,RM,Iz,kM,Bz,IM,Oz,BM,Cz,vn,OM,Pz,Fi,CM,Nz,ji,PM,Lz,Wr,NM,Dz,po,LM,$z,gr,DM,Uz,Oi,Ypt,qz,$M,w3,Dh,KZ,HZ,pT,GZ,eb,gT,e2t,r2t,Jl,VZ,i2t,ZZ,Wz,qM,o2t,JZ,a2t,$c,f0,bg,n3,v0,vT,y0,f2t,u2t,c2t,FM,Kz,l2t,jM,Hz,d2t,zM,Gz,g2t,Vz,tx,rb,yT,b2t,w2t,Xl,YZ,_2t,WM,QZ,tJ,M2t,qc,u0,wg,o3,b0,wT,w0,A2t,T2t,x2t,KM,Xz,R2t,HM,Yz,I2t,GM,Qz,B2t,rJ,iJ,_3,O2t,C2t,P2t,N2t,qb,nJ,oJ,aJ,$2t,VM,sJ,U2t,q2t,W2t,hJ,_T,MT,qs,ZM,iW,xn,JM,nW,XM,oW,YM,aW,QM,sW,cJ,tS,hW,eS,fW,rS,uW,ib,iS,cW,nS,lW,Eh,oS,dW,Da,nb,pW,$a,gW,aS,mW,sS,vW,hS,yW,fS,bW,uS,wW,Yl,_W,cS,MW,ob,ab,SW,lS,EW,sb,AW,dS,TW,pS,xW,gS,RW,mS,kW,vS,IW,yS,BW,wJ,bS,CW,wS,PW,Ts,_S,NW,$o,MS,LW,Kr,SS,DW,Ah,ES,$W,hb,UW,sn,fb,qW,Ci,xs,FW,gf,jW,Rs,zW,SJ,WW,AS,Dt,AJ,KW,TS,$t,s3,_a,ugt,v1,Ql,cgt,HW,bf,GW,lgt,dgt,ub,q1,jb,TJ,xJ,pgt,RJ,ggt,mgt,nx,xS,vgt,kJ,ygt,G2,V2,Z2,J2,X2,Y2,ox,yn,IJ,F1,Hr,bgt,BJ,wgt,_gt,Mgt,OJ,zi,Rgt,CJ,kgt,Igt,Bgt,Pgt,Wi,Ngt,PJ,Lgt,Dgt,$gt,jgt,bo,zgt,Wgt,Kgt,Hgt,Ggt,Vgt,mr,Zgt,NJ,Jgt,QW,Xgt,LJ,Pi,rmt,imt,nmt,omt,amt,Cc,smt,DJ,ax,Bn,nK,$J,hmt,Zc,fmt,umt,cmt,UJ,Lg,lmt,qJ,dmt,_0,FJ,pmt,gmt,mmt,jJ,cg,vmt,ST,ET,ymt,zJ,WJ,bmt,wmt,AT,KJ,aK,HJ,Oh,_mt,Mmt,Smt,Emt,sK,Ph,Amt,Jb,RS,VJ,Mg,kS,Tmt,hK,fK,S1,Sg,xmt,IS,Rmt,h3,ZJ,Fs,x0,cb,lK,dK,JJ,kmt,XJ,sx,pK,Yn,YJ,Bmt,QJ,tX,Omt,Cmt,lb,eX,Nmt,rX,Fc,Dmt,E1,iX,f3,nX,mu,$mt,g0,lg,Umt,qmt,Dg,oX,Fmt,TT,gK,aX,dg,jmt,sX,xT,hX,Xb,fX,Hmt,Gmt,RT,Zmt,vK,Jmt,uX,Ymt,Yb,BS,hx,Ds,$g,u3,Qmt,Kn,Wo,C1,tvt,evt,Gr,rvt,ba,cX,wK,ivt,nvt,lX,Ch,ovt,CS,dX,pX,e0,avt,A3,Ni,IT,svt,P1,gX,hvt,mX,fvt,uvt,hn,BT,vX,cvt,Eu,lvt,yX,dvt,pvt,gvt,Fa,SK,EK,mvt,Pc,Ih,bX,fx,jc,yu,AK,vvt,Gt,wX,_X,Hn,MX,PS,yvt,r3,NS,ux,SX,EX,r0,bvt,AX,TX,wvt,Ho,_vt,RK,Mvt,OT,Svt,Evt,Avt,Tvt,kK,LS,xX,RX,Mi,Af,Us,IK,Rvt,kvt,Ivt,Bvt,Ovt,BK,Cvt,pb,Lvt,A1,Sc,Dvt,OK,$S,$vt,kX,Uvt,zc,CK,cx,lx,mb,ja,Th,qvt,Fvt,vb,OX,c3,NT,jvt,Wvt,yi,Kvt,Hvt,j1,qK,Vvt,CX,Ma,Zvt,Jvt,Tf,xf,PX,NX,Ec,FS,jS,Xvt,Yvt,Qvt,tyt,LX,eyt,DX,wf,mf,$X,I1,pyt,z1,gyt,xh,myt,vyt,yyt,byt,wyt,_yt,Myt,Syt,UX,Eyt,qX,FX,B1,Ayt,Tyt,zS,Q2,xyt,Ryt,jX,kyt,zX,Iyt,WS,WX,KX,Byt,KS,HX,Oyt,T1,GX,E0,Cyt,bb,WK,tg,KK,VX,ZX,Lyt,Dyt,$yt,Uyt,qyt,Fyt,jyt,T3,To,JX,zyt,M0,XX,Wyt,YX,n0,Rg,wb,Kyt,_b,QX,x3,In,HS,O1,Hyt,tY,Gyt,R1,GK,l3,Vyt,eY,Zyt,Su,VK,d3,Jyt,Xyt,dx,Mb,LT,Yyt,R3,DT,Nc,GS,ZK,iY,Qyt,JK,nY,t6t,o0,XK,VS,e6t,oY,ZS,Sb,r6t,kg,YK,QK,b1,i6t,n6t,k3,o6t,Eb,a6t,aY,s6t,h6t,f6t,k1,u6t,tH,eH,rH,c6t,I3,a0,JS,iH,Ua,ro,sY,l6t,Ab,nH,Lr,XS,aH,Rr,YS,sH,Tc,hH,QS,fH,tE,uH,xc,eE,lH,rE,iE,dH,nE,pH,Qn,oE,mH,aE,sE,vH,hE,yH,fY,$h,bH,g6t,px,m6t,v6t,y6t,wH,b6t,w6t,_6t,M6t,Lh,Uh,S6t,E6t,A6t,uY,T6t,x6t,R6t,k6t,I6t,cY,B6t,O6t,C6t,P6t,N6t,Tb,ya,L6t,D6t,$6t,U6t,fE,O3,lY,$T,Ko,S0,q6t,F6t,p3,j6t,z6t,K6t,uE,eg,H6t,EH,G6t,V6t,On,xb,dY,g3,TH,Z6t,J6t,m0,X6t,pY,io,Mu,Y6t,Q6t,qa,tbt,ebt,UT,gY,mY,kH,ibt,vY,nbt,lE,obt,IH,BH,dE,abt,sbt,Rh,hbt,fbt,OH,CH,PH,ubt,cbt,lbt,rg,dbt,p0,m3,yg,qT,yY,LH,DH,bY,FT,wY,ni,pbt,gbt,mbt,FH,yf,ig,Rb,kb,jH,Ib,zH,Bb,pE,WH,KH,gE,HH,vbt,mE,GH,wi,s0,VH,SY,ZH,vE,Ot,yE,JH,wbt,EY,XH,bE,Ut,wE,YH,_E,QH,ME,tG,SE,eG,EE,rG,AE,iG,TE,nG,Yi,oG,xE,aG,sG,hG,RE,fG,kE,uG,IE,cG,BE,lG,OE,dG,CE,pG,PE,gG,NE,mG,LE,vG,DE,yG,$E,bG,UE,wG,qE,_G,RY,MG,FE,qt,jE,SG,zE,EG,Ob,AG,WE,TG,Rc,xG,KE,RG,HE,kG,GE,IG,VE,BG,ZE,OG,JE,CG,XE,PG,YE,NG,QE,LG,tA,DG,eA,$G,Ps,UG,jbt,rA,qG,iA,FG,NY,ng,jG,nA,zG,oA,WG,Rn,LY,KG,aA,Ft,sA,HG,to,hA,GG,fA,VG,UY,ZG,uA,jt,cA,JG,lA,XG,dA,YG,kc,QG,_1,tV,Cb,ti,eV,oi,Pb,rV,Nb,pA,iV,nV,gA,oV,t3t,mA,aV,_i,h0,sV,og,hV,zY,fV,vA,Ct,yA,uV,i3t,WY,cV,bA,zt,wA,lV,_A,dV,MA,pV,SA,gV,EA,mV,AA,vV,TA,yV,Qi,bV,xA,wV,_V,MV,RA,SV,kA,EV,IA,AV,BA,TV,OA,xV,CA,RV,PA,kV,NA,IV,LA,BV,DA,OV,$A,CV,UA,PV,qA,NV,VY,LV,FA,Wt,jA,DV,zA,$V,Lb,UV,WA,qV,Ic,FV,KA,jV,HA,zV,GA,WV,VA,KV,ZA,HV,JA,GV,XA,VV,YA,ZV,QA,JV,tT,XV,eT,YV,Ns,QV,A3t,rT,tZ,iT,eZ,eQ,ag,rZ,nT,iZ,oT,nZ,kn,rQ,oZ,aT,Kt,sT,aZ,eo,hT,sZ,fT,hZ,oQ,fZ,uT,Ht,cT,uZ,lT,cZ,dT,lZ,Bc,dZ,M1,pZ,Db,ei,gZ,br,D3t,$3t,U3t,q3t,F3t,j3t,z3t,W3t,K3t,H3t,G3t,V3t,Z3t,J3t,X3t,Y3t,Q3t,t8t,e8t,Ux,r8t,i8t,n8t,o8t,a8t,s8t,h8t,f8t,u8t,c8t,l8t,d8t,p8t,g8t,m8t,v8t,y8t,b8t,w8t,_8t,qx=Vi(()=>{"use strict";Tt();Rt();xt();Vd();mc();nj();pc();y2();zd();ou();nu();W2={},oj=!1;K6={},aj=!1,sj=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;K2={},hj=!1;__={},fj=!1;M_={},uj=!1;S_={},cj=!1;E_={},lj=!1,mn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;A_={},dj=!1,Ui=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;T_={},pj=!1,qi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;x_={},gj=!1,jr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;R_={},mj=!1,lo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;k_={},vj=!1,pr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;I_={},yj=!1,Ii=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;_pt={},bj=!1,B_={exports:_pt};H6={},wj=!1;O_={},_j=!1;C_={},Mj=!1;P_={},Sj=!1;N_={},Ej=!1;L_={},Aj=!1;D_={},Tj=!1,$_=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;U_={},xj=!1,Ept=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;q_={},Rj=!1;F_={},kj=!1;j_={},Ij=!1;z_={},Bj=!1;W_={},Oj=!1,xpt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;K_={},Cj=!1;H_={},Pj=!1;G_={},Nj=!1;V_={},Lj=!1,Z_=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Nh=Rpt();Nh.Readable;Nh.Writable;Nh.Duplex;Nh.Transform;Nh.PassThrough;Nh.finished;Nh.pipeline;Nh.Stream;I7(Nh.finished),I7(Nh.pipeline);J_={},Dj=!1,Tn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;X_={},$j=!1;Y_={},Uj=!1;Q_={},qj=!1;tM={},Fj=!1;TZ={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}},eM={},jj=!1;rM={},zj=!1;iM={},Wj=!1,G6=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;nM={},Kj=!1;oM={},Hj=!1,Mh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;aM={},Gj=!1,Na=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;V6={},Vj=!1;La={},Zj=!1;sM={},Jj=!1;hM={},Xj=!1;fM={},Yj=!1;uM={},Qj=!1;cM={},tz=!1;Zl={},ez=!1;lM={},rz=!1,Z6=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;J6={},iz=!1;dM={},nz=!1;X6={},oz=!1;pM={},az=!1;gM={},sz=!1;mM={},hz=!1;vM={},fz=!1;yM={},uz=!1;bM={},cz=!1;NZ={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}},wM={},dz=!1;_M={},pz=!1,Ms=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;MM={},gz=!1,Do=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;SM={},mz=!1,zr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;EM={},vz=!1,Sh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;AM={},yz=!1;Y6={},bz=!1,an=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Q6={},wz=!1,Bi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ss={},_z=!1;pf={},Mz=!1;Es={},Sz=!1;$Z={},Ez=!1,TM={exports:$Z},Nt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;qZ={},Az=!1,xM={exports:qZ},Lt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;va={},Tz=!1;H2={},xz=!1;tb={},Rz=!1,kz=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;RM={},Iz=!1;kM={},Bz=!1;IM={},Oz=!1;BM={},Cz=!1,vn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;OM={},Pz=!1,Fi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;CM={},Nz=!1,ji=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;PM={},Lz=!1,Wr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;NM={},Dz=!1,po=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;LM={},$z=!1,gr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;DM={},Uz=!1,Oi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ypt={},qz=!1,$M={exports:Ypt};w3=$i.EventEmitter,Dh={},KZ={};As("ERR_INVALID_OPT_VALUE",function(i,t){return'The value "'+t+'" is invalid for option "'+i+'"'},TypeError),As("ERR_INVALID_ARG_TYPE",function(i,t,r){let h;var o;let l;return typeof t=="string"&&(o="not ",t.substr(0,o.length)===o)?(h="must not be",t=t.replace(/^not /,"")):h="must be",function(c,p,w){return(w===void 0||w>c.length)&&(w=c.length),c.substring(w-p.length,w)===p}(i," argument")?l=`The ${i} ${h} ${Fz(t,"type")}`:l=`The "${i}" ${function(c,p,w){return typeof w!="number"&&(w=0),!(w+p.length>c.length)&&c.indexOf(p,w)!==-1}(i,".")?"property":"argument"} ${h} ${Fz(t,"type")}`,l+=`. Received type ${typeof r}`,l},TypeError),As("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),As("ERR_METHOD_NOT_IMPLEMENTED",function(i){return"The "+i+" method is not implemented"}),As("ERR_STREAM_PREMATURE_CLOSE","Premature close"),As("ERR_STREAM_DESTROYED",function(i){return"Cannot call "+i+" after a stream was destroyed"}),As("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),As("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),As("ERR_STREAM_WRITE_AFTER_END","write after end"),As("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),As("ERR_UNKNOWN_ENCODING",function(i){return"Unknown encoding: "+i},TypeError),As("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Dh.codes=KZ;HZ=function(){throw new Error("Readable.from is not available in the browser")},pT=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;GZ=function(i,t){if(UM("noDeprecation"))return i;var r=!1;return function(){if(!r){if(UM("throwDeprecation"))throw new Error(t);UM("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return i.apply(this||pT,arguments)}};eb=Cr.Buffer,gT=Je.inspect,e2t=gT&&gT.custom||"inspect",r2t=function(){function i(){(function(h,o){if(!(h instanceof o))throw new TypeError("Cannot call a class as a function")})(this,i),this.head=null,this.tail=null,this.length=0}var t,r;return t=i,(r=[{key:"push",value:function(h){var o={data:h,next:null};this.length>0?this.tail.next=o:this.head=o,this.tail=o,++this.length}},{key:"unshift",value:function(h){var o={data:h,next:this.head};this.length===0&&(this.tail=o),this.head=o,++this.length}},{key:"shift",value:function(){if(this.length!==0){var h=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,h}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(h){if(this.length===0)return"";for(var o=this.head,l=""+o.data;o=o.next;)l+=h+o.data;return l}},{key:"concat",value:function(h){if(this.length===0)return eb.alloc(0);for(var o,l,c,p=eb.allocUnsafe(h>>>0),w=this.head,m=0;w;)o=w.data,l=p,c=m,eb.prototype.copy.call(o,l,c),m+=w.data.length,w=w.next;return p}},{key:"consume",value:function(h,o){var l;return h<this.head.data.length?(l=this.head.data.slice(0,h),this.head.data=this.head.data.slice(h)):l=h===this.head.data.length?this.shift():o?this._getString(h):this._getBuffer(h),l}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(h){var o=this.head,l=1,c=o.data;for(h-=c.length;o=o.next;){var p=o.data,w=h>p.length?p.length:h;if(w===p.length?c+=p:c+=p.slice(0,h),(h-=w)==0){w===p.length?(++l,o.next?this.head=o.next:this.head=this.tail=null):(this.head=o,o.data=p.slice(w));break}++l}return this.length-=l,c}},{key:"_getBuffer",value:function(h){var o=eb.allocUnsafe(h),l=this.head,c=1;for(l.data.copy(o),h-=l.data.length;l=l.next;){var p=l.data,w=h>p.length?p.length:h;if(p.copy(o,o.length-h,0,w),(h-=w)==0){w===p.length?(++c,l.next?this.head=l.next:this.head=this.tail=null):(this.head=l,l.data=p.slice(w));break}++c}return this.length-=c,o}},{key:e2t,value:function(h,o){return gT(this,function(l){for(var c=1;c<arguments.length;c++){var p=arguments[c]!=null?arguments[c]:{};c%2?jz(Object(p),!0).forEach(function(w){Qpt(l,w,p[w])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(p)):jz(Object(p)).forEach(function(w){Object.defineProperty(l,w,Object.getOwnPropertyDescriptor(p,w))})}return l}({},o,{depth:0,customInspect:!1}))}}])&&t2t(t.prototype,r),i}(),Jl=Br;VZ={destroy:function(i,t){var r=this,h=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return h||o?(t?t(i):i&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Jl.nextTick(mT,this,i)):Jl.nextTick(mT,this,i)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(i||null,function(l){!t&&l?r._writableState?r._writableState.errorEmitted?Jl.nextTick($b,r):(r._writableState.errorEmitted=!0,Jl.nextTick(zz,r,l)):Jl.nextTick(zz,r,l):t?(Jl.nextTick($b,r),t(l)):Jl.nextTick($b,r)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(i,t){var r=i._readableState,h=i._writableState;r&&r.autoDestroy||h&&h.autoDestroy?i.destroy(t):i.emit("error",t)}},i2t=Dh.codes.ERR_INVALID_OPT_VALUE,ZZ={getHighWaterMark:function(i,t,r,h){var o=function(l,c,p){return l.highWaterMark!=null?l.highWaterMark:c?l[p]:null}(t,h,r);if(o!=null){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new i2t(h?r:"highWaterMark",o);return Math.floor(o)}return i.objectMode?16:16384}},Wz=Dh.codes.ERR_STREAM_PREMATURE_CLOSE;o2t=function i(t,r,h){if(typeof r=="function")return i(t,null,r);r||(r={}),h=function(A){var R=!1;return function(){if(!R){R=!0;for(var B=arguments.length,C=new Array(B),P=0;P<B;P++)C[P]=arguments[P];A.apply(this,C)}}}(h||n2t);var o=r.readable||r.readable!==!1&&t.readable,l=r.writable||r.writable!==!1&&t.writable,c=function(){t.writable||w()},p=t._writableState&&t._writableState.finished,w=function(){l=!1,p=!0,o||h.call(t)},m=t._readableState&&t._readableState.endEmitted,y=function(){o=!1,m=!0,l||h.call(t)},v=function(A){h.call(t,A)},M=function(){var A;return o&&!m?(t._readableState&&t._readableState.ended||(A=new Wz),h.call(t,A)):l&&!p?(t._writableState&&t._writableState.ended||(A=new Wz),h.call(t,A)):void 0},T=function(){t.req.on("finish",w)};return function(A){return A.setHeader&&typeof A.abort=="function"}(t)?(t.on("complete",w),t.on("abort",M),t.req?T():t.on("request",T)):l&&!t._writableState&&(t.on("end",c),t.on("close",c)),t.on("end",y),t.on("finish",w),r.error!==!1&&t.on("error",v),t.on("close",M),function(){t.removeListener("complete",w),t.removeListener("abort",M),t.removeListener("request",T),t.req&&t.req.removeListener("finish",w),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",w),t.removeListener("end",y),t.removeListener("error",v),t.removeListener("close",M)}},JZ=Br;a2t=o2t,$c=Symbol("lastResolve"),f0=Symbol("lastReject"),bg=Symbol("error"),n3=Symbol("ended"),v0=Symbol("lastPromise"),vT=Symbol("handlePromise"),y0=Symbol("stream");f2t=Object.getPrototypeOf(function(){}),u2t=Object.setPrototypeOf((Dc(qM={get stream(){return this[y0]},next:function(){var i=this,t=this[bg];if(t!==null)return Promise.reject(t);if(this[n3])return Promise.resolve(Kc(void 0,!0));if(this[y0].destroyed)return new Promise(function(l,c){JZ.nextTick(function(){i[bg]?c(i[bg]):l(Kc(void 0,!0))})});var r,h=this[v0];if(h)r=new Promise(function(l,c){return function(p,w){l.then(function(){if(c[n3])return p(Kc(void 0,!0)),void 0;c[vT](p,w)},w)}}(h,this));else{var o=this[y0].read();if(o!==null)return Promise.resolve(Kc(o,!1));r=new Promise(this[vT])}return this[v0]=r,r}},Symbol.asyncIterator,function(){return this}),Dc(qM,"return",function(){var i=this;return new Promise(function(t,r){i[y0].destroy(null,function(h){if(h)return r(h),void 0;t(Kc(void 0,!0))})})}),qM),f2t),c2t=function(i){var t,r=Object.create(u2t,(Dc(t={},y0,{value:i,writable:!0}),Dc(t,$c,{value:null,writable:!0}),Dc(t,f0,{value:null,writable:!0}),Dc(t,bg,{value:null,writable:!0}),Dc(t,n3,{value:i._readableState.endEmitted,writable:!0}),Dc(t,vT,{value:function(h,o){var l=r[y0].read();l?(r[v0]=null,r[$c]=null,r[f0]=null,h(Kc(l,!1))):(r[$c]=h,r[f0]=o)},writable:!0}),t));return r[v0]=null,a2t(i,function(h){if(h&&h.code!=="ERR_STREAM_PREMATURE_CLOSE"){var o=r[f0];return o!==null&&(r[v0]=null,r[$c]=null,r[f0]=null,o(h)),r[bg]=h,void 0}var l=r[$c];l!==null&&(r[v0]=null,r[$c]=null,r[f0]=null,l(Kc(void 0,!0))),r[n3]=!0}),i.on("readable",h2t.bind(null,r)),r},FM={},Kz=!1,l2t=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;jM={},Hz=!1,d2t=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;zM={},Gz=!1;g2t=XZ(),Vz=Dh.codes.ERR_STREAM_PREMATURE_CLOSE;tx=function i(t,r,h){if(typeof r=="function")return i(t,null,r);r||(r={}),h=function(A){var R=!1;return function(){if(!R){R=!0;for(var B=arguments.length,C=new Array(B),P=0;P<B;P++)C[P]=arguments[P];A.apply(this,C)}}}(h||m2t);var o=r.readable||r.readable!==!1&&t.readable,l=r.writable||r.writable!==!1&&t.writable,c=function(){t.writable||w()},p=t._writableState&&t._writableState.finished,w=function(){l=!1,p=!0,o||h.call(t)},m=t._readableState&&t._readableState.endEmitted,y=function(){o=!1,m=!0,l||h.call(t)},v=function(A){h.call(t,A)},M=function(){var A;return o&&!m?(t._readableState&&t._readableState.ended||(A=new Vz),h.call(t,A)):l&&!p?(t._writableState&&t._writableState.ended||(A=new Vz),h.call(t,A)):void 0},T=function(){t.req.on("finish",w)};return function(A){return A.setHeader&&typeof A.abort=="function"}(t)?(t.on("complete",w),t.on("abort",M),t.req?T():t.on("request",T)):l&&!t._writableState&&(t.on("end",c),t.on("close",c)),t.on("end",y),t.on("finish",w),r.error!==!1&&t.on("error",v),t.on("close",M),function(){t.removeListener("complete",w),t.removeListener("abort",M),t.removeListener("request",T),t.req&&t.req.removeListener("finish",w),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",w),t.removeListener("end",y),t.removeListener("error",v),t.removeListener("close",M)}};rb=Cr.Buffer,yT=Je.inspect,b2t=yT&&yT.custom||"inspect",w2t=function(){function i(){(function(h,o){if(!(h instanceof o))throw new TypeError("Cannot call a class as a function")})(this,i),this.head=null,this.tail=null,this.length=0}var t,r;return t=i,(r=[{key:"push",value:function(h){var o={data:h,next:null};this.length>0?this.tail.next=o:this.head=o,this.tail=o,++this.length}},{key:"unshift",value:function(h){var o={data:h,next:this.head};this.length===0&&(this.tail=o),this.head=o,++this.length}},{key:"shift",value:function(){if(this.length!==0){var h=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,h}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(h){if(this.length===0)return"";for(var o=this.head,l=""+o.data;o=o.next;)l+=h+o.data;return l}},{key:"concat",value:function(h){if(this.length===0)return rb.alloc(0);for(var o,l,c,p=rb.allocUnsafe(h>>>0),w=this.head,m=0;w;)o=w.data,l=p,c=m,rb.prototype.copy.call(o,l,c),m+=w.data.length,w=w.next;return p}},{key:"consume",value:function(h,o){var l;return h<this.head.data.length?(l=this.head.data.slice(0,h),this.head.data=this.head.data.slice(h)):l=h===this.head.data.length?this.shift():o?this._getString(h):this._getBuffer(h),l}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(h){var o=this.head,l=1,c=o.data;for(h-=c.length;o=o.next;){var p=o.data,w=h>p.length?p.length:h;if(w===p.length?c+=p:c+=p.slice(0,h),(h-=w)==0){w===p.length?(++l,o.next?this.head=o.next:this.head=this.tail=null):(this.head=o,o.data=p.slice(w));break}++l}return this.length-=l,c}},{key:"_getBuffer",value:function(h){var o=rb.allocUnsafe(h),l=this.head,c=1;for(l.data.copy(o),h-=l.data.length;l=l.next;){var p=l.data,w=h>p.length?p.length:h;if(p.copy(o,o.length-h,0,w),(h-=w)==0){w===p.length?(++c,l.next?this.head=l.next:this.head=this.tail=null):(this.head=l,l.data=p.slice(w));break}++c}return this.length-=c,o}},{key:b2t,value:function(h,o){return yT(this,function(l){for(var c=1;c<arguments.length;c++){var p=arguments[c]!=null?arguments[c]:{};c%2?Zz(Object(p),!0).forEach(function(w){v2t(l,w,p[w])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(p)):Zz(Object(p)).forEach(function(w){Object.defineProperty(l,w,Object.getOwnPropertyDescriptor(p,w))})}return l}({},o,{depth:0,customInspect:!1}))}}])&&y2t(t.prototype,r),i}(),Xl=Br;YZ={destroy:function(i,t){var r=this,h=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return h||o?(t?t(i):i&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Xl.nextTick(bT,this,i)):Xl.nextTick(bT,this,i)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(i||null,function(l){!t&&l?r._writableState?r._writableState.errorEmitted?Xl.nextTick(Ub,r):(r._writableState.errorEmitted=!0,Xl.nextTick(Jz,r,l)):Xl.nextTick(Jz,r,l):t?(Xl.nextTick(Ub,r),t(l)):Xl.nextTick(Ub,r)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(i,t){var r=i._readableState,h=i._writableState;r&&r.autoDestroy||h&&h.autoDestroy?i.destroy(t):i.emit("error",t)}},_2t=Dh.codes.ERR_INVALID_OPT_VALUE,QZ={getHighWaterMark:function(i,t,r,h){var o=function(l,c,p){return l.highWaterMark!=null?l.highWaterMark:c?l[p]:null}(t,h,r);if(o!=null){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new _2t(h?r:"highWaterMark",o);return Math.floor(o)}return i.objectMode?16:16384}},tJ=Br;M2t=tx,qc=Symbol("lastResolve"),u0=Symbol("lastReject"),wg=Symbol("error"),o3=Symbol("ended"),b0=Symbol("lastPromise"),wT=Symbol("handlePromise"),w0=Symbol("stream");A2t=Object.getPrototypeOf(function(){}),T2t=Object.setPrototypeOf((Uc(WM={get stream(){return this[w0]},next:function(){var i=this,t=this[wg];if(t!==null)return Promise.reject(t);if(this[o3])return Promise.resolve(Hc(void 0,!0));if(this[w0].destroyed)return new Promise(function(l,c){tJ.nextTick(function(){i[wg]?c(i[wg]):l(Hc(void 0,!0))})});var r,h=this[b0];if(h)r=new Promise(function(l,c){return function(p,w){l.then(function(){if(c[o3])return p(Hc(void 0,!0)),void 0;c[wT](p,w)},w)}}(h,this));else{var o=this[w0].read();if(o!==null)return Promise.resolve(Hc(o,!1));r=new Promise(this[wT])}return this[b0]=r,r}},Symbol.asyncIterator,function(){return this}),Uc(WM,"return",function(){var i=this;return new Promise(function(t,r){i[w0].destroy(null,function(h){if(h)return r(h),void 0;t(Hc(void 0,!0))})})}),WM),A2t),x2t=function(i){var t,r=Object.create(T2t,(Uc(t={},w0,{value:i,writable:!0}),Uc(t,qc,{value:null,writable:!0}),Uc(t,u0,{value:null,writable:!0}),Uc(t,wg,{value:null,writable:!0}),Uc(t,o3,{value:i._readableState.endEmitted,writable:!0}),Uc(t,wT,{value:function(h,o){var l=r[w0].read();l?(r[b0]=null,r[qc]=null,r[u0]=null,h(Hc(l,!1))):(r[qc]=h,r[u0]=o)},writable:!0}),t));return r[b0]=null,M2t(i,function(h){if(h&&h.code!=="ERR_STREAM_PREMATURE_CLOSE"){var o=r[u0];return o!==null&&(r[b0]=null,r[qc]=null,r[u0]=null,o(h)),r[wg]=h,void 0}var l=r[qc];l!==null&&(r[b0]=null,r[qc]=null,r[u0]=null,l(Hc(void 0,!0))),r[o3]=!0}),i.on("readable",E2t.bind(null,r)),r},KM={},Xz=!1,R2t=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;HM={},Yz=!1,I2t=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;GM={},Qz=!1;B2t=eJ(),rJ=Ag();iJ=_u;_3=Dh.codes,O2t=_3.ERR_METHOD_NOT_IMPLEMENTED,C2t=_3.ERR_MULTIPLE_CALLBACK,P2t=_3.ERR_TRANSFORM_ALREADY_TRANSFORMING,N2t=_3.ERR_TRANSFORM_WITH_LENGTH_0,qb=rJ;Fr(_u,qb),_u.prototype.push=function(i,t){return this._transformState.needTransform=!1,qb.prototype.push.call(this,i,t)},_u.prototype._transform=function(i,t,r){r(new O2t("_transform()"))},_u.prototype._write=function(i,t,r){var h=this._transformState;if(h.writecb=r,h.writechunk=i,h.writeencoding=t,!h.transforming){var o=this._readableState;(h.needTransform||o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}},_u.prototype._read=function(i){var t=this._transformState;t.writechunk===null||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},_u.prototype._destroy=function(i,t){qb.prototype._destroy.call(this,i,function(r){t(r)})};nJ=iJ;oJ=Tg;aJ=nJ;Fr(Tg,aJ),Tg.prototype._transform=function(i,t,r){r(null,i)};$2t=oJ,sJ=Dh.codes,U2t=sJ.ERR_MISSING_ARGS,q2t=sJ.ERR_STREAM_DESTROYED;W2t=function(){for(var i=arguments.length,t=new Array(i),r=0;r<i;r++)t[r]=arguments[r];var h,o=z2t(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new U2t("streams");var l=t.map(function(c,p){var w=p<t.length-1;return F2t(c,w,p>0,function(m){h||(h=m),m&&l.forEach(rW),w||(l.forEach(rW),o(h))})});return t.reduce(j2t)},_T=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;hJ=Ls;MT=$i.EventEmitter;Fr(Ls,MT),Ls.Readable=g2t,Ls.Writable=B2t,Ls.Duplex=rJ,Ls.Transform=nJ,Ls.PassThrough=$2t,Ls.finished=tx,Ls.pipeline=W2t,Ls.Stream=Ls,Ls.prototype.pipe=function(i,t){var r=this||_T;function h(y){i.writable&&i.write(y)===!1&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",h),i.on("drain",o),i._isStdio||t&&t.end===!1||(r.on("end",c),r.on("close",p));var l=!1;function c(){l||(l=!0,i.end())}function p(){l||(l=!0,typeof i.destroy=="function"&&i.destroy())}function w(y){if(m(),MT.listenerCount(this||_T,"error")===0)throw y}function m(){r.removeListener("data",h),i.removeListener("drain",o),r.removeListener("end",c),r.removeListener("close",p),r.removeListener("error",w),i.removeListener("error",w),r.removeListener("end",m),r.removeListener("close",m),i.removeListener("close",m)}return r.on("error",w),i.on("error",w),r.on("end",m),r.on("close",m),i.on("close",m),i.emit("pipe",r),i};qs=hJ;qs.Readable;qs.Writable;qs.Duplex;qs.Transform;qs.PassThrough;qs.finished;qs.pipeline;qs.Stream;ZM={},iW=!1,xn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;JM={},nW=!1;XM={},oW=!1;YM={},aW=!1;QM={},sW=!1;cJ={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}},tS={},hW=!1;eS={},fW=!1;rS={},uW=!1,ib=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;iS={},cW=!1;nS={},lW=!1,Eh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;oS={},dW=!1,Da=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;nb={},pW=!1;$a={},gW=!1;aS={},mW=!1;sS={},vW=!1;hS={},yW=!1;fS={},bW=!1;uS={},wW=!1;Yl={},_W=!1;cS={},MW=!1,ob=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;ab={},SW=!1;lS={},EW=!1;sb={},AW=!1;dS={},TW=!1;pS={},xW=!1;gS={},RW=!1;mS={},kW=!1;vS={},IW=!1;yS={},BW=!1;wJ={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}},bS={},CW=!1;wS={},PW=!1,Ts=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;_S={},NW=!1,$o=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;MS={},LW=!1,Kr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;SS={},DW=!1,Ah=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;ES={},$W=!1;hb={},UW=!1,sn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;fb={},qW=!1,Ci=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;xs={},FW=!1;gf={},jW=!1;Rs={},zW=!1;SJ={},WW=!1,AS={exports:SJ},Dt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;AJ={},KW=!1,TS={exports:AJ},$t=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;s3=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,_a={},ugt=function(i,t){if(i.indexOf)return i.indexOf(t);for(var r=0;r<i.length;r++)if(i[r]===t)return r;return-1},v1=function(i){if(Object.keys)return Object.keys(i);var t=[];for(var r in i)t.push(r);return t},Ql=function(i,t){if(i.forEach)return i.forEach(t);for(var r=0;r<i.length;r++)t(i[r],r,i)},cgt=function(){try{return Object.defineProperty({},"_",{}),function(i,t,r){Object.defineProperty(i,t,{writable:!0,enumerable:!1,configurable:!0,value:r})}}catch{return function(t,r,h){t[r]=h}}}(),HW=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];Fb.prototype={};bf=_a.Script=function(i){if(!((this||s3)instanceof bf))return new bf(i);(this||s3).code=i};bf.prototype.runInContext=function(i){if(!(i instanceof Fb))throw new TypeError("needs a 'context' argument.");var t=document.createElement("iframe");t.style||(t.style={}),t.style.display="none",document.body.appendChild(t);var r=t.contentWindow,h=r.eval,o=r.execScript;!h&&o&&(o.call(r,"null"),h=r.eval),Ql(v1(i),function(p){r[p]=i[p]}),Ql(HW,function(p){i[p]&&(r[p]=i[p])});var l=v1(r),c=h.call(r,(this||s3).code);return Ql(v1(r),function(p){(p in i||ugt(l,p)===-1)&&(i[p]=r[p])}),Ql(HW,function(p){p in i||cgt(i,p,r[p])}),document.body.removeChild(t),c},bf.prototype.runInThisContext=function(){return eval((this||s3).code)},bf.prototype.runInNewContext=function(i){var t=bf.createContext(i),r=this.runInContext(t);return i&&Ql(v1(t),function(h){i[h]=t[h]}),r},Ql(v1(bf.prototype),function(i){_a[i]=bf[i]=function(t){var r=bf(t);return r[i].apply(r,[].slice.call(arguments,1))}}),_a.isContext=function(i){return i instanceof Fb},_a.createScript=function(i){return _a.Script(i)},_a.createContext=bf.createContext=function(i){var t=new Fb;return typeof i=="object"&&Ql(v1(i),function(r){t[r]=i[r]}),t};_a.Script;_a.createContext;_a.createScript;_a.isContext;_a.runInContext;_a.runInNewContext;_a.runInThisContext;GW=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,lgt=Br,dgt=vi.Buffer,ub=GW.crypto||GW.msCrypto,q1=ub&&ub.getRandomValues?function(i,t){if(i>4294967295)throw new RangeError("requested too many random bytes");var r=dgt.allocUnsafe(i);if(i>0)if(i>65536)for(var h=0;h<i;h+=65536)ub.getRandomValues(r.slice(h,h+65536));else ub.getRandomValues(r);return typeof t=="function"?lgt.nextTick(function(){t(null,r)}):r}:function(){throw new Error(`Secure random number generation is not supported by this browser.
|
|
106
106
|
Use Chrome, Firefox or Internet Explorer 11`)},jb=vi.Buffer,TJ=qs.Transform;Fr(Oc,TJ),Oc.prototype._transform=function(i,t,r){var h=null;try{this.update(i,t)}catch(o){h=o}r(h)},Oc.prototype._flush=function(i){var t=null;try{this.push(this.digest())}catch(r){t=r}i(t)},Oc.prototype.update=function(i,t){if(function(p,w){if(!jb.isBuffer(p)&&typeof p!="string")throw new TypeError(w+" must be a string or a buffer")}(i,"Data"),this._finalized)throw new Error("Digest already called");jb.isBuffer(i)||(i=jb.from(i,t));for(var r=this._block,h=0;this._blockOffset+i.length-h>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)r[o++]=i[h++];this._update(),this._blockOffset=0}for(;h<i.length;)r[this._blockOffset++]=i[h++];for(var l=0,c=8*i.length;c>0;++l)this._length[l]+=c,(c=this._length[l]/4294967296|0)>0&&(this._length[l]-=4294967296*c);return this},Oc.prototype._update=function(){throw new Error("_update is not implemented")},Oc.prototype.digest=function(i){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();i!==void 0&&(t=t.toString(i)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},Oc.prototype._digest=function(){throw new Error("_digest is not implemented")};xJ=Oc,pgt=Fr,RJ=xJ,ggt=vi.Buffer,mgt=new Array(16);pgt(zb,RJ),zb.prototype._update=function(){for(var i=mgt,t=0;t<16;++t)i[t]=this._block.readInt32LE(4*t);var r=this._a,h=this._b,o=this._c,l=this._d;r=Uo(r,h,o,l,i[0],3614090360,7),l=Uo(l,r,h,o,i[1],3905402710,12),o=Uo(o,l,r,h,i[2],606105819,17),h=Uo(h,o,l,r,i[3],3250441966,22),r=Uo(r,h,o,l,i[4],4118548399,7),l=Uo(l,r,h,o,i[5],1200080426,12),o=Uo(o,l,r,h,i[6],2821735955,17),h=Uo(h,o,l,r,i[7],4249261313,22),r=Uo(r,h,o,l,i[8],1770035416,7),l=Uo(l,r,h,o,i[9],2336552879,12),o=Uo(o,l,r,h,i[10],4294925233,17),h=Uo(h,o,l,r,i[11],2304563134,22),r=Uo(r,h,o,l,i[12],1804603682,7),l=Uo(l,r,h,o,i[13],4254626195,12),o=Uo(o,l,r,h,i[14],2792965006,17),r=qo(r,h=Uo(h,o,l,r,i[15],1236535329,22),o,l,i[1],4129170786,5),l=qo(l,r,h,o,i[6],3225465664,9),o=qo(o,l,r,h,i[11],643717713,14),h=qo(h,o,l,r,i[0],3921069994,20),r=qo(r,h,o,l,i[5],3593408605,5),l=qo(l,r,h,o,i[10],38016083,9),o=qo(o,l,r,h,i[15],3634488961,14),h=qo(h,o,l,r,i[4],3889429448,20),r=qo(r,h,o,l,i[9],568446438,5),l=qo(l,r,h,o,i[14],3275163606,9),o=qo(o,l,r,h,i[3],4107603335,14),h=qo(h,o,l,r,i[8],1163531501,20),r=qo(r,h,o,l,i[13],2850285829,5),l=qo(l,r,h,o,i[2],4243563512,9),o=qo(o,l,r,h,i[7],1735328473,14),r=Fo(r,h=qo(h,o,l,r,i[12],2368359562,20),o,l,i[5],4294588738,4),l=Fo(l,r,h,o,i[8],2272392833,11),o=Fo(o,l,r,h,i[11],1839030562,16),h=Fo(h,o,l,r,i[14],4259657740,23),r=Fo(r,h,o,l,i[1],2763975236,4),l=Fo(l,r,h,o,i[4],1272893353,11),o=Fo(o,l,r,h,i[7],4139469664,16),h=Fo(h,o,l,r,i[10],3200236656,23),r=Fo(r,h,o,l,i[13],681279174,4),l=Fo(l,r,h,o,i[0],3936430074,11),o=Fo(o,l,r,h,i[3],3572445317,16),h=Fo(h,o,l,r,i[6],76029189,23),r=Fo(r,h,o,l,i[9],3654602809,4),l=Fo(l,r,h,o,i[12],3873151461,11),o=Fo(o,l,r,h,i[15],530742520,16),r=jo(r,h=Fo(h,o,l,r,i[2],3299628645,23),o,l,i[0],4096336452,6),l=jo(l,r,h,o,i[7],1126891415,10),o=jo(o,l,r,h,i[14],2878612391,15),h=jo(h,o,l,r,i[5],4237533241,21),r=jo(r,h,o,l,i[12],1700485571,6),l=jo(l,r,h,o,i[3],2399980690,10),o=jo(o,l,r,h,i[10],4293915773,15),h=jo(h,o,l,r,i[1],2240044497,21),r=jo(r,h,o,l,i[8],1873313359,6),l=jo(l,r,h,o,i[15],4264355552,10),o=jo(o,l,r,h,i[6],2734768916,15),h=jo(h,o,l,r,i[13],1309151649,21),r=jo(r,h,o,l,i[4],4149444226,6),l=jo(l,r,h,o,i[11],3174756917,10),o=jo(o,l,r,h,i[2],718787259,15),h=jo(h,o,l,r,i[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+h|0,this._c=this._c+o|0,this._d=this._d+l|0},zb.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var i=ggt.allocUnsafe(16);return i.writeInt32LE(this._a,0),i.writeInt32LE(this._b,4),i.writeInt32LE(this._c,8),i.writeInt32LE(this._d,12),i};nx=zb,xS=Cr.Buffer,vgt=Fr,kJ=xJ,ygt=new Array(16),G2=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],V2=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Z2=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],J2=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],X2=[0,1518500249,1859775393,2400959708,2840853838],Y2=[1352829926,1548603684,1836072691,2053994217,0];vgt(Wb,kJ),Wb.prototype._update=function(){for(var i=ygt,t=0;t<16;++t)i[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,h=0|this._b,o=0|this._c,l=0|this._d,c=0|this._e,p=0|this._a,w=0|this._b,m=0|this._c,y=0|this._d,v=0|this._e,M=0;M<80;M+=1){var T,A;M<16?(T=VW(r,h,o,l,c,i[G2[M]],X2[0],Z2[M]),A=YW(p,w,m,y,v,i[V2[M]],Y2[0],J2[M])):M<32?(T=ZW(r,h,o,l,c,i[G2[M]],X2[1],Z2[M]),A=XW(p,w,m,y,v,i[V2[M]],Y2[1],J2[M])):M<48?(T=JW(r,h,o,l,c,i[G2[M]],X2[2],Z2[M]),A=JW(p,w,m,y,v,i[V2[M]],Y2[2],J2[M])):M<64?(T=XW(r,h,o,l,c,i[G2[M]],X2[3],Z2[M]),A=ZW(p,w,m,y,v,i[V2[M]],Y2[3],J2[M])):(T=YW(r,h,o,l,c,i[G2[M]],X2[4],Z2[M]),A=VW(p,w,m,y,v,i[V2[M]],Y2[4],J2[M])),r=c,c=l,l=T0(o,10),o=h,h=T,p=v,v=y,y=T0(m,10),m=w,w=A}var R=this._b+o+y|0;this._b=this._c+l+v|0,this._c=this._d+c+p|0,this._d=this._e+r+w|0,this._e=this._a+h+m|0,this._a=R},Wb.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var i=xS.alloc?xS.alloc(20):new xS(20);return i.writeInt32LE(this._a,0),i.writeInt32LE(this._b,4),i.writeInt32LE(this._c,8),i.writeInt32LE(this._d,12),i.writeInt32LE(this._e,16),i};ox=Wb,yn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,IJ=vi.Buffer;Kb.prototype.update=function(i,t){typeof i=="string"&&(t=t||"utf8",i=IJ.from(i,t));for(var r=(this||yn)._block,h=(this||yn)._blockSize,o=i.length,l=(this||yn)._len,c=0;c<o;){for(var p=l%h,w=Math.min(o-c,h-p),m=0;m<w;m++)r[p+m]=i[c+m];c+=w,(l+=w)%h==0&&this._update(r)}return(this||yn)._len+=o,this||yn},Kb.prototype.digest=function(i){var t=(this||yn)._len%(this||yn)._blockSize;(this||yn)._block[t]=128,(this||yn)._block.fill(0,t+1),t>=(this||yn)._finalSize&&(this._update((this||yn)._block),(this||yn)._block.fill(0));var r=8*(this||yn)._len;if(r<=4294967295)(this||yn)._block.writeUInt32BE(r,(this||yn)._blockSize-4);else{var h=(4294967295&r)>>>0,o=(r-h)/4294967296;(this||yn)._block.writeUInt32BE(o,(this||yn)._blockSize-8),(this||yn)._block.writeUInt32BE(h,(this||yn)._blockSize-4)}this._update((this||yn)._block);var l=this._hash();return i?l.toString(i):l},Kb.prototype._update=function(){throw new Error("_update must be implemented by subclass")};F1=Kb,Hr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,bgt=Fr,BJ=F1,wgt=vi.Buffer,_gt=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Mgt=new Array(64);bgt(sg,BJ),sg.prototype.init=function(){return(this||Hr)._a=1779033703,(this||Hr)._b=3144134277,(this||Hr)._c=1013904242,(this||Hr)._d=2773480762,(this||Hr)._e=1359893119,(this||Hr)._f=2600822924,(this||Hr)._g=528734635,(this||Hr)._h=1541459225,this||Hr},sg.prototype._update=function(i){for(var t,r=(this||Hr)._w,h=0|(this||Hr)._a,o=0|(this||Hr)._b,l=0|(this||Hr)._c,c=0|(this||Hr)._d,p=0|(this||Hr)._e,w=0|(this||Hr)._f,m=0|(this||Hr)._g,y=0|(this||Hr)._h,v=0;v<16;++v)r[v]=i.readInt32BE(4*v);for(;v<64;++v)r[v]=0|(((t=r[v-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[v-7]+xgt(r[v-15])+r[v-16];for(var M=0;M<64;++M){var T=y+Tgt(p)+Sgt(p,w,m)+_gt[M]+r[M]|0,A=Agt(h)+Egt(h,o,l)|0;y=m,m=w,w=p,p=c+T|0,c=l,l=o,o=h,h=T+A|0}(this||Hr)._a=h+(this||Hr)._a|0,(this||Hr)._b=o+(this||Hr)._b|0,(this||Hr)._c=l+(this||Hr)._c|0,(this||Hr)._d=c+(this||Hr)._d|0,(this||Hr)._e=p+(this||Hr)._e|0,(this||Hr)._f=w+(this||Hr)._f|0,(this||Hr)._g=m+(this||Hr)._g|0,(this||Hr)._h=y+(this||Hr)._h|0},sg.prototype._hash=function(){var i=wgt.allocUnsafe(32);return i.writeInt32BE((this||Hr)._a,0),i.writeInt32BE((this||Hr)._b,4),i.writeInt32BE((this||Hr)._c,8),i.writeInt32BE((this||Hr)._d,12),i.writeInt32BE((this||Hr)._e,16),i.writeInt32BE((this||Hr)._f,20),i.writeInt32BE((this||Hr)._g,24),i.writeInt32BE((this||Hr)._h,28),i};OJ=sg,zi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Rgt=Fr,CJ=F1,kgt=vi.Buffer,Igt=[1518500249,1859775393,-1894007588,-899497514],Bgt=new Array(80);Rgt(hg,CJ),hg.prototype.init=function(){return(this||zi)._a=1732584193,(this||zi)._b=4023233417,(this||zi)._c=2562383102,(this||zi)._d=271733878,(this||zi)._e=3285377520,this||zi},hg.prototype._update=function(i){for(var t,r=(this||zi)._w,h=0|(this||zi)._a,o=0|(this||zi)._b,l=0|(this||zi)._c,c=0|(this||zi)._d,p=0|(this||zi)._e,w=0;w<16;++w)r[w]=i.readInt32BE(4*w);for(;w<80;++w)r[w]=r[w-3]^r[w-8]^r[w-14]^r[w-16];for(var m=0;m<80;++m){var y=~~(m/20),v=0|((t=h)<<5|t>>>27)+Cgt(y,o,l,c)+p+r[m]+Igt[y];p=c,c=l,l=Ogt(o),o=h,h=v}(this||zi)._a=h+(this||zi)._a|0,(this||zi)._b=o+(this||zi)._b|0,(this||zi)._c=l+(this||zi)._c|0,(this||zi)._d=c+(this||zi)._d|0,(this||zi)._e=p+(this||zi)._e|0},hg.prototype._hash=function(){var i=kgt.allocUnsafe(20);return i.writeInt32BE(0|(this||zi)._a,0),i.writeInt32BE(0|(this||zi)._b,4),i.writeInt32BE(0|(this||zi)._c,8),i.writeInt32BE(0|(this||zi)._d,12),i.writeInt32BE(0|(this||zi)._e,16),i};Pgt=hg,Wi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Ngt=Fr,PJ=F1,Lgt=vi.Buffer,Dgt=[1518500249,1859775393,-1894007588,-899497514],$gt=new Array(80);Ngt(fg,PJ),fg.prototype.init=function(){return(this||Wi)._a=1732584193,(this||Wi)._b=4023233417,(this||Wi)._c=2562383102,(this||Wi)._d=271733878,(this||Wi)._e=3285377520,this||Wi},fg.prototype._update=function(i){for(var t,r=(this||Wi)._w,h=0|(this||Wi)._a,o=0|(this||Wi)._b,l=0|(this||Wi)._c,c=0|(this||Wi)._d,p=0|(this||Wi)._e,w=0;w<16;++w)r[w]=i.readInt32BE(4*w);for(;w<80;++w)r[w]=(t=r[w-3]^r[w-8]^r[w-14]^r[w-16])<<1|t>>>31;for(var m=0;m<80;++m){var y=~~(m/20),v=Ugt(h)+Fgt(y,o,l,c)+p+r[m]+Dgt[y]|0;p=c,c=l,l=qgt(o),o=h,h=v}(this||Wi)._a=h+(this||Wi)._a|0,(this||Wi)._b=o+(this||Wi)._b|0,(this||Wi)._c=l+(this||Wi)._c|0,(this||Wi)._d=c+(this||Wi)._d|0,(this||Wi)._e=p+(this||Wi)._e|0},fg.prototype._hash=function(){var i=Lgt.allocUnsafe(20);return i.writeInt32BE(0|(this||Wi)._a,0),i.writeInt32BE(0|(this||Wi)._b,4),i.writeInt32BE(0|(this||Wi)._c,8),i.writeInt32BE(0|(this||Wi)._d,12),i.writeInt32BE(0|(this||Wi)._e,16),i};jgt=fg,bo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,zgt=Fr,Wgt=OJ,Kgt=F1,Hgt=vi.Buffer,Ggt=new Array(64);zgt(Hb,Wgt),Hb.prototype.init=function(){return(this||bo)._a=3238371032,(this||bo)._b=914150663,(this||bo)._c=812702999,(this||bo)._d=4144912697,(this||bo)._e=4290775857,(this||bo)._f=1750603025,(this||bo)._g=1694076839,(this||bo)._h=3204075428,this||bo},Hb.prototype._hash=function(){var i=Hgt.allocUnsafe(28);return i.writeInt32BE((this||bo)._a,0),i.writeInt32BE((this||bo)._b,4),i.writeInt32BE((this||bo)._c,8),i.writeInt32BE((this||bo)._d,12),i.writeInt32BE((this||bo)._e,16),i.writeInt32BE((this||bo)._f,20),i.writeInt32BE((this||bo)._g,24),i};Vgt=Hb,mr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Zgt=Fr,NJ=F1,Jgt=vi.Buffer,QW=[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],Xgt=new Array(160);Zgt(ug,NJ),ug.prototype.init=function(){return(this||mr)._ah=1779033703,(this||mr)._bh=3144134277,(this||mr)._ch=1013904242,(this||mr)._dh=2773480762,(this||mr)._eh=1359893119,(this||mr)._fh=2600822924,(this||mr)._gh=528734635,(this||mr)._hh=1541459225,(this||mr)._al=4089235720,(this||mr)._bl=2227873595,(this||mr)._cl=4271175723,(this||mr)._dl=1595750129,(this||mr)._el=2917565137,(this||mr)._fl=725511199,(this||mr)._gl=4215389547,(this||mr)._hl=327033209,this||mr},ug.prototype._update=function(i){for(var t=(this||mr)._w,r=0|(this||mr)._ah,h=0|(this||mr)._bh,o=0|(this||mr)._ch,l=0|(this||mr)._dh,c=0|(this||mr)._eh,p=0|(this||mr)._fh,w=0|(this||mr)._gh,m=0|(this||mr)._hh,y=0|(this||mr)._al,v=0|(this||mr)._bl,M=0|(this||mr)._cl,T=0|(this||mr)._dl,A=0|(this||mr)._el,R=0|(this||mr)._fl,B=0|(this||mr)._gl,C=0|(this||mr)._hl,P=0;P<32;P+=2)t[P]=i.readInt32BE(4*P),t[P+1]=i.readInt32BE(4*P+4);for(;P<160;P+=2){var N=t[P-30],q=t[P-30+1],W=Ygt(N,q),J=Qgt(q,N),F=tmt(N=t[P-4],q=t[P-4+1]),H=emt(q,N),Y=t[P-14],E=t[P-14+1],n=t[P-32],s=t[P-32+1],f=J+E|0,d=W+Y+go(f,J)|0;d=(d=d+F+go(f=f+H|0,H)|0)+n+go(f=f+s|0,s)|0,t[P]=d,t[P+1]=f}for(var g=0;g<160;g+=2){d=t[g],f=t[g+1];var S=eK(r,h,o),x=eK(y,v,M),a=rK(r,y),e=rK(y,r),u=iK(c,A),b=iK(A,c),_=QW[g],k=QW[g+1],$=tK(c,p,w),it=tK(A,R,B),Z=C+b|0,et=m+u+go(Z,C)|0;et=(et=(et=et+$+go(Z=Z+it|0,it)|0)+_+go(Z=Z+k|0,k)|0)+d+go(Z=Z+f|0,f)|0;var Q=e+x|0,z=a+S+go(Q,e)|0;m=w,C=B,w=p,B=R,p=c,R=A,c=l+et+go(A=T+Z|0,T)|0,l=o,T=M,o=h,M=v,h=r,v=y,r=et+z+go(y=Z+Q|0,Z)|0}(this||mr)._al=(this||mr)._al+y|0,(this||mr)._bl=(this||mr)._bl+v|0,(this||mr)._cl=(this||mr)._cl+M|0,(this||mr)._dl=(this||mr)._dl+T|0,(this||mr)._el=(this||mr)._el+A|0,(this||mr)._fl=(this||mr)._fl+R|0,(this||mr)._gl=(this||mr)._gl+B|0,(this||mr)._hl=(this||mr)._hl+C|0,(this||mr)._ah=(this||mr)._ah+r+go((this||mr)._al,y)|0,(this||mr)._bh=(this||mr)._bh+h+go((this||mr)._bl,v)|0,(this||mr)._ch=(this||mr)._ch+o+go((this||mr)._cl,M)|0,(this||mr)._dh=(this||mr)._dh+l+go((this||mr)._dl,T)|0,(this||mr)._eh=(this||mr)._eh+c+go((this||mr)._el,A)|0,(this||mr)._fh=(this||mr)._fh+p+go((this||mr)._fl,R)|0,(this||mr)._gh=(this||mr)._gh+w+go((this||mr)._gl,B)|0,(this||mr)._hh=(this||mr)._hh+m+go((this||mr)._hl,C)|0},ug.prototype._hash=function(){var i=Jgt.allocUnsafe(64);function t(r,h,o){i.writeInt32BE(r,o),i.writeInt32BE(h,o+4)}return t((this||mr)._ah,(this||mr)._al,0),t((this||mr)._bh,(this||mr)._bl,8),t((this||mr)._ch,(this||mr)._cl,16),t((this||mr)._dh,(this||mr)._dl,24),t((this||mr)._eh,(this||mr)._el,32),t((this||mr)._fh,(this||mr)._fl,40),t((this||mr)._gh,(this||mr)._gl,48),t((this||mr)._hh,(this||mr)._hl,56),i};LJ=ug,Pi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,rmt=Fr,imt=LJ,nmt=F1,omt=vi.Buffer,amt=new Array(160);rmt(Gb,imt),Gb.prototype.init=function(){return(this||Pi)._ah=3418070365,(this||Pi)._bh=1654270250,(this||Pi)._ch=2438529370,(this||Pi)._dh=355462360,(this||Pi)._eh=1731405415,(this||Pi)._fh=2394180231,(this||Pi)._gh=3675008525,(this||Pi)._hh=1203062813,(this||Pi)._al=3238371032,(this||Pi)._bl=914150663,(this||Pi)._cl=812702999,(this||Pi)._dl=4144912697,(this||Pi)._el=4290775857,(this||Pi)._fl=1750603025,(this||Pi)._gl=1694076839,(this||Pi)._hl=3204075428,this||Pi},Gb.prototype._hash=function(){var i=omt.allocUnsafe(48);function t(r,h,o){i.writeInt32BE(r,o),i.writeInt32BE(h,o+4)}return t((this||Pi)._ah,(this||Pi)._al,0),t((this||Pi)._bh,(this||Pi)._bl,8),t((this||Pi)._ch,(this||Pi)._cl,16),t((this||Pi)._dh,(this||Pi)._dl,24),t((this||Pi)._eh,(this||Pi)._el,32),t((this||Pi)._fh,(this||Pi)._fl,40),i};smt=Gb,DJ={exports:Cc={}};(Cc=DJ.exports=function(i){i=i.toLowerCase();var t=Cc[i];if(!t)throw new Error(i+" is not supported (we accept pull requests)");return new t}).sha=Pgt,Cc.sha1=jgt,Cc.sha224=Vgt,Cc.sha256=OJ,Cc.sha384=smt,Cc.sha512=LJ;ax=DJ.exports,Bn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,nK=vi.Buffer,$J=qs.Transform,hmt=Po.StringDecoder;Fr(kh,$J),kh.prototype.update=function(i,t,r){typeof i=="string"&&(i=nK.from(i,t));var h=this._update(i);return(this||Bn).hashMode?this||Bn:(r&&(h=this._toString(h,r)),h)},kh.prototype.setAutoPadding=function(){},kh.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},kh.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},kh.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},kh.prototype._transform=function(i,t,r){var h;try{(this||Bn).hashMode?this._update(i):this.push(this._update(i))}catch(o){h=o}finally{r(h)}},kh.prototype._flush=function(i){var t;try{this.push(this.__final())}catch(r){t=r}i(t)},kh.prototype._finalOrDigest=function(i){var t=this.__final()||nK.alloc(0);return i&&(t=this._toString(t,i,!0)),t},kh.prototype._toString=function(i,t,r){if((this||Bn)._decoder||((this||Bn)._decoder=new hmt(t),(this||Bn)._encoding=t),(this||Bn)._encoding!==t)throw new Error("can't switch encodings");var h=(this||Bn)._decoder.write(i);return r&&(h+=(this||Bn)._decoder.end()),h};Zc=kh,fmt=nx,umt=ox,cmt=ax,UJ=Zc;Fr(Vb,UJ),Vb.prototype._update=function(i){this._hash.update(i)},Vb.prototype._final=function(){return this._hash.digest()};Lg=function(i){return(i=i.toLowerCase())==="md5"?new fmt:i==="rmd160"||i==="ripemd160"?new umt:new Vb(cmt(i))},lmt=nx,qJ=function(i){return new lmt().update(i).digest()},dmt=Fr,_0=vi.Buffer,FJ=Zc,pmt=_0.alloc(128);dmt(Zb,FJ),Zb.prototype._update=function(i){this._hash.push(i)},Zb.prototype._final=function(){var i=this._alg(_0.concat(this._hash));return this._alg(_0.concat([this._opad,i]))};gmt=Fr,mmt=Zb,jJ=Zc,cg=vi.Buffer,vmt=qJ,ST=ox,ET=ax,ymt=cg.alloc(128);gmt(_g,jJ),_g.prototype._update=function(i){this._hash.update(i)},_g.prototype._final=function(){var i=this._hash.digest();return(this._alg==="rmd160"?new ST:ET(this._alg)).update(this._opad).update(i).digest()};zJ=function(i,t){return(i=i.toLowerCase())==="rmd160"||i==="ripemd160"?new _g("rmd160",t):i==="md5"?new mmt(vmt,t):new _g(i,t)},WJ={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}},bmt=Cr.Buffer,wmt=Math.pow(2,30)-1;KJ=function(i,t,r,h){if(oK(i,"Password"),oK(t,"Salt"),typeof r!="number")throw new TypeError("Iterations not a number");if(r<0)throw new TypeError("Bad iterations");if(typeof h!="number")throw new TypeError("Key length not a number");if(h<0||h>wmt||h!=h)throw new TypeError("Bad key length")},aK=Br;aK.browser?AT="utf-8":AT=parseInt(aK.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary";HJ=AT,Oh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,_mt=qJ,Mmt=ox,Smt=ax,Emt=KJ,sK=HJ,Ph=vi.Buffer,Amt=Ph.alloc(128),Jb={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};GJ.prototype.run=function(i,t){return i.copy(t,(this||Oh).blocksize),this.hash(t).copy((this||Oh).opad,(this||Oh).blocksize),this.hash((this||Oh).opad)};VJ=function(i,t,r,h,o){Emt(i,t,r,h),Ph.isBuffer(i)||(i=Ph.from(i,sK)),Ph.isBuffer(t)||(t=Ph.from(t,sK));var l=new GJ(o=o||"sha1",i,t.length),c=Ph.allocUnsafe(h),p=Ph.allocUnsafe(t.length+4);t.copy(p,0,0,t.length);for(var w=0,m=Jb[o],y=Math.ceil(h/m),v=1;v<=y;v++){p.writeUInt32BE(v,t.length);for(var M=l.run(p,l.ipad1),T=M,A=1;A<r;A++){T=l.run(T,l.ipad2);for(var R=0;R<m;R++)M[R]^=T[R]}M.copy(c,w),w+=m}return c},Mg=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,kS=Br,Tmt=KJ,hK=HJ,fK=VJ,S1=vi.Buffer,Sg=Mg.crypto&&Mg.crypto.subtle,xmt={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},IS=[];Rmt=function(i,t,r,h,o,l){typeof o=="function"&&(l=o,o=void 0);var c=xmt[(o=o||"sha1").toLowerCase()];if(!c||typeof Mg.Promise!="function")return kS.nextTick(function(){var p;try{p=fK(i,t,r,h,o)}catch(w){return l(w)}l(null,p)});if(Tmt(i,t,r,h),typeof l!="function")throw new Error("No callback provided to pbkdf2");S1.isBuffer(i)||(i=S1.from(i,hK)),S1.isBuffer(t)||(t=S1.from(t,hK)),function(p,w){p.then(function(m){kS.nextTick(function(){w(null,m)})},function(m){kS.nextTick(function(){w(m)})})}(function(p){if(Mg.process&&!Mg.process.browser||!Sg||!Sg.importKey||!Sg.deriveBits)return Promise.resolve(!1);if(IS[p]!==void 0)return IS[p];var w=uK(RS=RS||S1.alloc(8),RS,10,128,p).then(function(){return!0}).catch(function(){return!1});return IS[p]=w,w}(c).then(function(p){return p?uK(i,t,r,h,c):fK(i,t,r,h,o)}),l)},h3={};h3.pbkdf2=Rmt,h3.pbkdf2Sync=VJ;ZJ=cK,cK.equal=function(i,t,r){if(i!=t)throw new Error(r||"Assertion failed: "+i+" != "+t)};Fs=ZJ,x0={readUInt32BE:function(i,t){return(i[0+t]<<24|i[1+t]<<16|i[2+t]<<8|i[3+t])>>>0},writeUInt32BE:function(i,t,r){i[0+r]=t>>>24,i[1+r]=t>>>16&255,i[2+r]=t>>>8&255,i[3+r]=255&t},ip:function(i,t,r,h){for(var o=0,l=0,c=6;c>=0;c-=2){for(var p=0;p<=24;p+=8)o<<=1,o|=t>>>p+c&1;for(p=0;p<=24;p+=8)o<<=1,o|=i>>>p+c&1}for(c=6;c>=0;c-=2){for(p=1;p<=25;p+=8)l<<=1,l|=t>>>p+c&1;for(p=1;p<=25;p+=8)l<<=1,l|=i>>>p+c&1}r[h+0]=o>>>0,r[h+1]=l>>>0},rip:function(i,t,r,h){for(var o=0,l=0,c=0;c<4;c++)for(var p=24;p>=0;p-=8)o<<=1,o|=t>>>p+c&1,o<<=1,o|=i>>>p+c&1;for(c=4;c<8;c++)for(p=24;p>=0;p-=8)l<<=1,l|=t>>>p+c&1,l<<=1,l|=i>>>p+c&1;r[h+0]=o>>>0,r[h+1]=l>>>0},pc1:function(i,t,r,h){for(var o=0,l=0,c=7;c>=5;c--){for(var p=0;p<=24;p+=8)o<<=1,o|=t>>p+c&1;for(p=0;p<=24;p+=8)o<<=1,o|=i>>p+c&1}for(p=0;p<=24;p+=8)o<<=1,o|=t>>p+c&1;for(c=1;c<=3;c++){for(p=0;p<=24;p+=8)l<<=1,l|=t>>p+c&1;for(p=0;p<=24;p+=8)l<<=1,l|=i>>p+c&1}for(p=0;p<=24;p+=8)l<<=1,l|=i>>p+c&1;r[h+0]=o>>>0,r[h+1]=l>>>0},r28shl:function(i,t){return i<<t&268435455|i>>>28-t}},cb=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];x0.pc2=function(i,t,r,h){for(var o=0,l=0,c=cb.length>>>1,p=0;p<c;p++)o<<=1,o|=i>>>cb[p]&1;for(p=c;p<cb.length;p++)l<<=1,l|=t>>>cb[p]&1;r[h+0]=o>>>0,r[h+1]=l>>>0},x0.expand=function(i,t,r){var h=0,o=0;h=(1&i)<<5|i>>>27;for(var l=23;l>=15;l-=4)h<<=6,h|=i>>>l&63;for(l=11;l>=3;l-=4)o|=i>>>l&63,o<<=6;o|=(31&i)<<1|i>>>31,t[r+0]=h>>>0,t[r+1]=o>>>0};lK=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];x0.substitute=function(i,t){for(var r=0,h=0;h<4;h++)r<<=4,r|=lK[64*h+(i>>>18-6*h&63)];for(h=0;h<4;h++)r<<=4,r|=lK[256+64*h+(t>>>18-6*h&63)];return r>>>0};dK=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];x0.permute=function(i){for(var t=0,r=0;r<dK.length;r++)t<<=1,t|=i>>>dK[r]&1;return t>>>0},x0.padSplit=function(i,t,r){for(var h=i.toString(2);h.length<t;)h="0"+h;for(var o=[],l=0;l<t;l+=r)o.push(h.slice(l,l+r));return o.join(" ")};kmt=Fs;JJ=ks,ks.prototype._init=function(){},ks.prototype.update=function(i){return i.length===0?[]:this.type==="decrypt"?this._updateDecrypt(i):this._updateEncrypt(i)},ks.prototype._buffer=function(i,t){for(var r=Math.min(this.buffer.length-this.bufferOff,i.length-t),h=0;h<r;h++)this.buffer[this.bufferOff+h]=i[t+h];return this.bufferOff+=r,r},ks.prototype._flushBuffer=function(i,t){return this._update(this.buffer,0,i,t),this.bufferOff=0,this.blockSize},ks.prototype._updateEncrypt=function(i){var t=0,r=0,h=(this.bufferOff+i.length)/this.blockSize|0,o=new Array(h*this.blockSize);this.bufferOff!==0&&(t+=this._buffer(i,t),this.bufferOff===this.buffer.length&&(r+=this._flushBuffer(o,r)));for(var l=i.length-(i.length-t)%this.blockSize;t<l;t+=this.blockSize)this._update(i,t,o,r),r+=this.blockSize;for(;t<i.length;t++,this.bufferOff++)this.buffer[this.bufferOff]=i[t];return o},ks.prototype._updateDecrypt=function(i){for(var t=0,r=0,h=Math.ceil((this.bufferOff+i.length)/this.blockSize)-1,o=new Array(h*this.blockSize);h>0;h--)t+=this._buffer(i,t),r+=this._flushBuffer(o,r);return t+=this._buffer(i,t),o},ks.prototype.final=function(i){var t,r;return i&&(t=this.update(i)),r=this.type==="encrypt"?this._finalEncrypt():this._finalDecrypt(),t?t.concat(r):r},ks.prototype._pad=function(i,t){if(t===0)return!1;for(;t<i.length;)i[t++]=0;return!0},ks.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var i=new Array(this.blockSize);return this._update(this.buffer,0,i,0),i},ks.prototype._unpad=function(i){return i},ks.prototype._finalDecrypt=function(){kmt.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var i=new Array(this.blockSize);return this._flushBuffer(i,0),this._unpad(i)};sx=JJ,pK=Fs,Yn=x0,YJ=sx;Fr(Ef,YJ),XJ=Ef,Ef.create=function(i){return new Ef(i)};Bmt=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];Ef.prototype.deriveKeys=function(i,t){i.keys=new Array(32),pK.equal(t.length,this.blockSize,"Invalid key length");var r=Yn.readUInt32BE(t,0),h=Yn.readUInt32BE(t,4);Yn.pc1(r,h,i.tmp,0),r=i.tmp[0],h=i.tmp[1];for(var o=0;o<i.keys.length;o+=2){var l=Bmt[o>>>1];r=Yn.r28shl(r,l),h=Yn.r28shl(h,l),Yn.pc2(r,h,i.keys,o)}},Ef.prototype._update=function(i,t,r,h){var o=this._desState,l=Yn.readUInt32BE(i,t),c=Yn.readUInt32BE(i,t+4);Yn.ip(l,c,o.tmp,0),l=o.tmp[0],c=o.tmp[1],this.type==="encrypt"?this._encrypt(o,l,c,o.tmp,0):this._decrypt(o,l,c,o.tmp,0),l=o.tmp[0],c=o.tmp[1],Yn.writeUInt32BE(r,l,h),Yn.writeUInt32BE(r,c,h+4)},Ef.prototype._pad=function(i,t){for(var r=i.length-t,h=t;h<i.length;h++)i[h]=r;return!0},Ef.prototype._unpad=function(i){for(var t=i[i.length-1],r=i.length-t;r<i.length;r++)pK.equal(i[r],t);return i.slice(0,i.length-t)},Ef.prototype._encrypt=function(i,t,r,h,o){for(var l=t,c=r,p=0;p<i.keys.length;p+=2){var w=i.keys[p],m=i.keys[p+1];Yn.expand(c,i.tmp,0),w^=i.tmp[0],m^=i.tmp[1];var y=Yn.substitute(w,m),v=c;c=(l^Yn.permute(y))>>>0,l=v}Yn.rip(c,l,h,o)},Ef.prototype._decrypt=function(i,t,r,h,o){for(var l=r,c=t,p=i.keys.length-2;p>=0;p-=2){var w=i.keys[p],m=i.keys[p+1];Yn.expand(l,i.tmp,0),w^=i.tmp[0],m^=i.tmp[1];var y=Yn.substitute(w,m),v=l;l=(c^Yn.permute(y))>>>0,c=v}Yn.rip(l,c,h,o)};QJ=XJ,tX={},Omt=Fs,Cmt=Fr,lb={};tX.instantiate=function(i){function t(l){i.call(this,l),this._cbcInit()}Cmt(t,i);for(var r=Object.keys(lb),h=0;h<r.length;h++){var o=r[h];t.prototype[o]=lb[o]}return t.create=function(l){return new t(l)},t},lb._cbcInit=function(){var i=new Pmt(this.options.iv);this._cbcState=i},lb._update=function(i,t,r,h){var o=this._cbcState,l=this.constructor.super_.prototype,c=o.iv;if(this.type==="encrypt"){for(var p=0;p<this.blockSize;p++)c[p]^=i[t+p];for(l._update.call(this,c,0,r,h),p=0;p<this.blockSize;p++)c[p]=r[h+p]}else{for(l._update.call(this,i,t,r,h),p=0;p<this.blockSize;p++)r[h+p]^=c[p];for(p=0;p<this.blockSize;p++)c[p]=i[t+p]}};Nmt=Fs,rX=sx,Fc=QJ;Fr(t0,rX),eX=t0,t0.create=function(i){return new t0(i)},t0.prototype._update=function(i,t,r,h){var o=this._edeState;o.ciphers[0]._update(i,t,r,h),o.ciphers[1]._update(r,h,r,h),o.ciphers[2]._update(r,h,r,h)},t0.prototype._pad=Fc.prototype._pad,t0.prototype._unpad=Fc.prototype._unpad;Dmt=eX,E1={};E1.utils=x0,E1.Cipher=sx,E1.DES=QJ,E1.CBC=tX,E1.EDE=Dmt;f3=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,nX=Zc,mu=E1,$mt=Fr,g0=vi.Buffer,lg={"des-ede3-cbc":mu.CBC.instantiate(mu.EDE),"des-ede3":mu.EDE,"des-ede-cbc":mu.CBC.instantiate(mu.EDE),"des-ede":mu.EDE,"des-cbc":mu.CBC.instantiate(mu.DES),"des-ecb":mu.DES};lg.des=lg["des-cbc"],lg.des3=lg["des-ede3-cbc"],iX=db,$mt(db,nX),db.prototype._update=function(i){return g0.from((this||f3)._des.update(i))},db.prototype._final=function(){return g0.from((this||f3)._des.final())};Umt=iX,qmt=Cr.Buffer,Dg=function(i,t){for(var r=Math.min(i.length,t.length),h=new qmt(r),o=0;o<r;++o)h[o]=i[o]^t[o];return h},oX=function(i){for(var t,r=i.length;r--;){if((t=i.readUInt8(r))!==255){t++,i.writeUInt8(t,r);break}i.writeUInt8(0,r)}},Fmt={encrypt:function(i,t){return i._cipher.encryptBlock(t)},decrypt:function(i,t){return i._cipher.decryptBlock(t)}},TT={},gK=Dg;TT.encrypt=function(i,t){var r=gK(t,i._prev);return i._prev=i._cipher.encryptBlock(r),i._prev},TT.decrypt=function(i,t){var r=i._prev;i._prev=t;var h=i._cipher.decryptBlock(t);return gK(h,r)};aX={},dg=vi.Buffer,jmt=Dg;aX.encrypt=function(i,t,r){for(var h,o=dg.allocUnsafe(0);t.length;){if(i._cache.length===0&&(i._cache=i._cipher.encryptBlock(i._prev),i._prev=dg.allocUnsafe(0)),!(i._cache.length<=t.length)){o=dg.concat([o,mK(i,t,r)]);break}h=i._cache.length,o=dg.concat([o,mK(i,t.slice(0,h),r)]),t=t.slice(h)}return o};sX={},xT=vi.Buffer;sX.encrypt=function(i,t,r){for(var h=t.length,o=xT.allocUnsafe(h),l=-1;++l<h;)o[l]=zmt(i,t[l],r);return o};hX={},Xb=vi.Buffer;hX.encrypt=function(i,t,r){for(var h=t.length,o=Xb.allocUnsafe(h),l=-1;++l<h;)o[l]=Wmt(i,t[l],r);return o};fX={},Hmt=Cr.Buffer,Gmt=Dg;fX.encrypt=function(i,t){for(;i._cache.length<t.length;)i._cache=Hmt.concat([i._cache,Vmt(i)]);var r=i._cache.slice(0,t.length);return i._cache=i._cache.slice(t.length),Gmt(t,r)};RT={},Zmt=Dg,vK=vi.Buffer,Jmt=oX;RT.encrypt=function(i,t){var r=Math.ceil(t.length/16),h=i._cache.length;i._cache=vK.concat([i._cache,vK.allocUnsafe(16*r)]);for(var o=0;o<r;o++){var l=Xmt(i),c=h+16*o;i._cache.writeUInt32BE(l[0],c+0),i._cache.writeUInt32BE(l[1],c+4),i._cache.writeUInt32BE(l[2],c+8),i._cache.writeUInt32BE(l[3],c+12)}var p=i._cache.slice(0,t.length);return i._cache=i._cache.slice(t.length),Zmt(t,p)};uX={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}},Ymt={ECB:Fmt,CBC:TT,CFB:aX,CFB8:sX,CFB1:hX,OFB:fX,CTR:RT,GCM:RT},Yb=uX;for(BS in Yb)Yb[BS].module=Ymt[Yb[BS].mode];hx=Yb,Ds=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,$g={},u3=vi.Buffer;Qmt=[0,1,2,4,8,16,32,64,128,27,54],Kn=function(){for(var i=new Array(256),t=0;t<256;t++)i[t]=t<128?t<<1:t<<1^283;for(var r=[],h=[],o=[[],[],[],[]],l=[[],[],[],[]],c=0,p=0,w=0;w<256;++w){var m=p^p<<1^p<<2^p<<3^p<<4;m=m>>>8^255&m^99,r[c]=m,h[m]=c;var y=i[c],v=i[y],M=i[v],T=257*i[m]^16843008*m;o[0][c]=T<<24|T>>>8,o[1][c]=T<<16|T>>>16,o[2][c]=T<<8|T>>>24,o[3][c]=T,T=16843009*M^65537*v^257*y^16843008*c,l[0][m]=T<<24|T>>>8,l[1][m]=T<<16|T>>>16,l[2][m]=T<<8|T>>>24,l[3][m]=T,c===0?c=p=1:(c=y^i[i[i[M^y]]],p^=i[i[p]])}return{SBOX:r,INV_SBOX:h,SUB_MIX:o,INV_SUB_MIX:l}}();Is.blockSize=16,Is.keySize=32,Is.prototype.blockSize=Is.blockSize,Is.prototype.keySize=Is.keySize,Is.prototype._reset=function(){for(var i=(this||Ds)._key,t=i.length,r=t+6,h=4*(r+1),o=[],l=0;l<t;l++)o[l]=i[l];for(l=t;l<h;l++){var c=o[l-1];l%t==0?(c=c<<8|c>>>24,c=Kn.SBOX[c>>>24]<<24|Kn.SBOX[c>>>16&255]<<16|Kn.SBOX[c>>>8&255]<<8|Kn.SBOX[255&c],c^=Qmt[l/t|0]<<24):t>6&&l%t==4&&(c=Kn.SBOX[c>>>24]<<24|Kn.SBOX[c>>>16&255]<<16|Kn.SBOX[c>>>8&255]<<8|Kn.SBOX[255&c]),o[l]=o[l-t]^c}for(var p=[],w=0;w<h;w++){var m=h-w,y=o[m-(w%4?0:4)];p[w]=w<4||m<=4?y:Kn.INV_SUB_MIX[0][Kn.SBOX[y>>>24]]^Kn.INV_SUB_MIX[1][Kn.SBOX[y>>>16&255]]^Kn.INV_SUB_MIX[2][Kn.SBOX[y>>>8&255]]^Kn.INV_SUB_MIX[3][Kn.SBOX[255&y]]}(this||Ds)._nRounds=r,(this||Ds)._keySchedule=o,(this||Ds)._invKeySchedule=p},Is.prototype.encryptBlockRaw=function(i){return yK(i=kT(i),(this||Ds)._keySchedule,Kn.SUB_MIX,Kn.SBOX,(this||Ds)._nRounds)},Is.prototype.encryptBlock=function(i){var t=this.encryptBlockRaw(i),r=u3.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},Is.prototype.decryptBlock=function(i){var t=(i=kT(i))[1];i[1]=i[3],i[3]=t;var r=yK(i,(this||Ds)._invKeySchedule,Kn.INV_SUB_MIX,Kn.INV_SBOX,(this||Ds)._nRounds),h=u3.allocUnsafe(16);return h.writeUInt32BE(r[0],0),h.writeUInt32BE(r[3],4),h.writeUInt32BE(r[2],8),h.writeUInt32BE(r[1],12),h},Is.prototype.scrub=function(){OS((this||Ds)._keySchedule),OS((this||Ds)._invKeySchedule),OS((this||Ds)._key)},$g.AES=Is;Wo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,C1=vi.Buffer,tvt=C1.alloc(16,0);pg.prototype.ghash=function(i){for(var t=-1;++t<i.length;)(this||Wo).state[t]^=i[t];this._multiply()},pg.prototype._multiply=function(){for(var i,t,r,h=[(i=(this||Wo).h).readUInt32BE(0),i.readUInt32BE(4),i.readUInt32BE(8),i.readUInt32BE(12)],o=[0,0,0,0],l=-1;++l<128;){for((this||Wo).state[~~(l/8)]&1<<7-l%8&&(o[0]^=h[0],o[1]^=h[1],o[2]^=h[2],o[3]^=h[3]),r=(1&h[3])!=0,t=3;t>0;t--)h[t]=h[t]>>>1|(1&h[t-1])<<31;h[0]=h[0]>>>1,r&&(h[0]=h[0]^225<<24)}(this||Wo).state=bK(o)},pg.prototype.update=function(i){var t;for((this||Wo).cache=C1.concat([(this||Wo).cache,i]);(this||Wo).cache.length>=16;)t=(this||Wo).cache.slice(0,16),(this||Wo).cache=(this||Wo).cache.slice(16),this.ghash(t)},pg.prototype.final=function(i,t){return(this||Wo).cache.length&&this.ghash(C1.concat([(this||Wo).cache,tvt],16)),this.ghash(bK([0,i,0,t])),(this||Wo).state};evt=pg,Gr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,rvt=$g,ba=vi.Buffer,cX=Zc,wK=evt,ivt=Dg,nvt=oX;Fr(c0,cX),c0.prototype._update=function(i){if(!(this||Gr)._called&&(this||Gr)._alen){var t=16-(this||Gr)._alen%16;t<16&&(t=ba.alloc(t,0),(this||Gr)._ghash.update(t))}(this||Gr)._called=!0;var r=(this||Gr)._mode.encrypt(this||Gr,i);return(this||Gr)._decrypt?(this||Gr)._ghash.update(i):(this||Gr)._ghash.update(r),(this||Gr)._len+=i.length,r},c0.prototype._final=function(){if((this||Gr)._decrypt&&!(this||Gr)._authTag)throw new Error("Unsupported state or unable to authenticate data");var i=ivt((this||Gr)._ghash.final(8*(this||Gr)._alen,8*(this||Gr)._len),(this||Gr)._cipher.encryptBlock((this||Gr)._finID));if((this||Gr)._decrypt&&function(t,r){var h=0;t.length!==r.length&&h++;for(var o=Math.min(t.length,r.length),l=0;l<o;++l)h+=t[l]^r[l];return h}(i,(this||Gr)._authTag))throw new Error("Unsupported state or unable to authenticate data");(this||Gr)._authTag=i,(this||Gr)._cipher.scrub()},c0.prototype.getAuthTag=function(){if((this||Gr)._decrypt||!ba.isBuffer((this||Gr)._authTag))throw new Error("Attempting to get auth tag in unsupported state");return(this||Gr)._authTag},c0.prototype.setAuthTag=function(i){if(!(this||Gr)._decrypt)throw new Error("Attempting to set auth tag in unsupported state");(this||Gr)._authTag=i},c0.prototype.setAAD=function(i){if((this||Gr)._called)throw new Error("Attempting to set AAD in unsupported state");(this||Gr)._ghash.update(i),(this||Gr)._alen+=i.length};lX=c0,Ch=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,ovt=$g,CS=vi.Buffer,dX=Zc;Fr(Qb,dX),Qb.prototype._update=function(i){return(this||Ch)._mode.encrypt(this||Ch,i,(this||Ch)._decrypt)},Qb.prototype._final=function(){(this||Ch)._cipher.scrub()};pX=Qb,e0=vi.Buffer,avt=nx,A3=function(i,t,r,h){if(e0.isBuffer(i)||(i=e0.from(i,"binary")),t&&(e0.isBuffer(t)||(t=e0.from(t,"binary")),t.length!==8))throw new RangeError("salt should be Buffer with 8 byte length");for(var o=r/8,l=e0.alloc(o),c=e0.alloc(h||0),p=e0.alloc(0);o>0||h>0;){var w=new avt;w.update(p),w.update(i),t&&w.update(t),p=w.digest();var m=0;if(o>0){var y=l.length-o;m=Math.min(o,p.length),p.copy(l,y,0,m),o-=m}if(m<p.length&&h>0){var v=c.length-h,M=Math.min(h,p.length-m);p.copy(c,v,m,m+M),h-=M}}return p.fill(0),{key:l,iv:c}},Ni=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,IT={},svt=lX,P1=vi.Buffer,gX=hx,hvt=pX,mX=Zc,fvt=$g,uvt=A3;Fr(gg,mX),gg.prototype._update=function(i){var t,r;(this||Ni)._cache.add(i);for(var h=[];t=(this||Ni)._cache.get((this||Ni)._autopadding);)r=(this||Ni)._mode.decrypt(this||Ni,t),h.push(r);return P1.concat(h)},gg.prototype._final=function(){var i=(this||Ni)._cache.flush();if((this||Ni)._autopadding)return function(t){var r=t[15];if(r<1||r>16)throw new Error("unable to decrypt data");for(var h=-1;++h<r;)if(t[h+(16-r)]!==r)throw new Error("unable to decrypt data");if(r!==16)return t.slice(0,16-r)}((this||Ni)._mode.decrypt(this||Ni,i));if(i)throw new Error("data not multiple of block length")},gg.prototype.setAutoPadding=function(i){return(this||Ni)._autopadding=!!i,this||Ni},t3.prototype.add=function(i){(this||Ni).cache=P1.concat([(this||Ni).cache,i])},t3.prototype.get=function(i){var t;if(i){if((this||Ni).cache.length>16)return t=(this||Ni).cache.slice(0,16),(this||Ni).cache=(this||Ni).cache.slice(16),t}else if((this||Ni).cache.length>=16)return t=(this||Ni).cache.slice(0,16),(this||Ni).cache=(this||Ni).cache.slice(16),t;return null},t3.prototype.flush=function(){if((this||Ni).cache.length)return(this||Ni).cache},IT.createDecipher=function(i,t){var r=gX[i.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var h=uvt(t,!1,r.key,r.iv);return _K(i,h.key,h.iv)},IT.createDecipheriv=_K;hn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,BT={},vX=hx,cvt=lX,Eu=vi.Buffer,lvt=pX,yX=Zc,dvt=$g,pvt=A3;Fr(xg,yX),xg.prototype._update=function(i){var t,r;(this||hn)._cache.add(i);for(var h=[];t=(this||hn)._cache.get();)r=(this||hn)._mode.encrypt(this||hn,t),h.push(r);return Eu.concat(h)};gvt=Eu.alloc(16,16);xg.prototype._final=function(){var i=(this||hn)._cache.flush();if((this||hn)._autopadding)return i=(this||hn)._mode.encrypt(this||hn,i),(this||hn)._cipher.scrub(),i;if(!i.equals(gvt))throw(this||hn)._cipher.scrub(),new Error("data not multiple of block length")},xg.prototype.setAutoPadding=function(i){return(this||hn)._autopadding=!!i,this||hn},e3.prototype.add=function(i){(this||hn).cache=Eu.concat([(this||hn).cache,i])},e3.prototype.get=function(){if((this||hn).cache.length>15){var i=(this||hn).cache.slice(0,16);return(this||hn).cache=(this||hn).cache.slice(16),i}return null},e3.prototype.flush=function(){for(var i=16-(this||hn).cache.length,t=Eu.allocUnsafe(i),r=-1;++r<i;)t.writeUInt8(i,r);return Eu.concat([(this||hn).cache,t])},BT.createCipheriv=MK,BT.createCipher=function(i,t){var r=vX[i.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var h=pvt(t,!1,r.key,r.iv);return MK(i,h.key,h.iv)};Fa={},SK=BT,EK=IT,mvt=uX;Fa.createCipher=Fa.Cipher=SK.createCipher,Fa.createCipheriv=Fa.Cipheriv=SK.createCipheriv,Fa.createDecipher=Fa.Decipher=EK.createDecipher,Fa.createDecipheriv=Fa.Decipheriv=EK.createDecipheriv,Fa.listCiphers=Fa.getCiphers=function(){return Object.keys(mvt)};Pc={"des-ecb":{key:8,iv:0}};Pc["des-cbc"]=Pc.des={key:8,iv:8},Pc["des-ede3-cbc"]=Pc.des3={key:24,iv:8},Pc["des-ede3"]={key:24,iv:0},Pc["des-ede-cbc"]={key:16,iv:8},Pc["des-ede"]={key:16,iv:0};Ih={},bX=Umt,fx=Fa,jc=hx,yu=Pc,AK=A3;Ih.createCipher=Ih.Cipher=function(i,t){var r,h;if(i=i.toLowerCase(),jc[i])r=jc[i].key,h=jc[i].iv;else{if(!yu[i])throw new TypeError("invalid suite type");r=8*yu[i].key,h=yu[i].iv}var o=AK(t,!1,r,h);return TK(i,o.key,o.iv)},Ih.createCipheriv=Ih.Cipheriv=TK,Ih.createDecipher=Ih.Decipher=function(i,t){var r,h;if(i=i.toLowerCase(),jc[i])r=jc[i].key,h=jc[i].iv;else{if(!yu[i])throw new TypeError("invalid suite type");r=8*yu[i].key,h=yu[i].iv}var o=AK(t,!1,r,h);return xK(i,o.key,o.iv)},Ih.createDecipheriv=Ih.Decipheriv=xK,Ih.listCiphers=Ih.getCiphers=function(){return Object.keys(yu).concat(fx.getCiphers())};vvt=Object.freeze({}),Gt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,wX={},_X={exports:wX};(function(i,t){function r(F,H){if(!F)throw new Error(H||"Assertion failed")}function h(F,H){F.super_=H;var Y=function(){};Y.prototype=H.prototype,F.prototype=new Y,F.prototype.constructor=F}function o(F,H,Y){if(o.isBN(F))return F;(this||Gt).negative=0,(this||Gt).words=null,(this||Gt).length=0,(this||Gt).red=null,F!==null&&(H!=="le"&&H!=="be"||(Y=H,H=10),this._init(F||0,H||10,Y||"be"))}var l;typeof i=="object"?i.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{l=vvt.Buffer}catch{}function c(F,H,Y){for(var E=0,n=Math.min(F.length,Y),s=H;s<n;s++){var f=F.charCodeAt(s)-48;E<<=4,E|=f>=49&&f<=54?f-49+10:f>=17&&f<=22?f-17+10:15&f}return E}function p(F,H,Y,E){for(var n=0,s=Math.min(F.length,Y),f=H;f<s;f++){var d=F.charCodeAt(f)-48;n*=E,n+=d>=49?d-49+10:d>=17?d-17+10:d}return n}o.isBN=function(F){return F instanceof o||F!==null&&typeof F=="object"&&F.constructor.wordSize===o.wordSize&&Array.isArray(F.words)},o.max=function(F,H){return F.cmp(H)>0?F:H},o.min=function(F,H){return F.cmp(H)<0?F:H},o.prototype._init=function(F,H,Y){if(typeof F=="number")return this._initNumber(F,H,Y);if(typeof F=="object")return this._initArray(F,H,Y);H==="hex"&&(H=16),r(H===(0|H)&&H>=2&&H<=36);var E=0;(F=F.toString().replace(/\s+/g,""))[0]==="-"&&E++,H===16?this._parseHex(F,E):this._parseBase(F,H,E),F[0]==="-"&&((this||Gt).negative=1),this.strip(),Y==="le"&&this._initArray(this.toArray(),H,Y)},o.prototype._initNumber=function(F,H,Y){F<0&&((this||Gt).negative=1,F=-F),F<67108864?((this||Gt).words=[67108863&F],(this||Gt).length=1):F<4503599627370496?((this||Gt).words=[67108863&F,F/67108864&67108863],(this||Gt).length=2):(r(F<9007199254740992),(this||Gt).words=[67108863&F,F/67108864&67108863,1],(this||Gt).length=3),Y==="le"&&this._initArray(this.toArray(),H,Y)},o.prototype._initArray=function(F,H,Y){if(r(typeof F.length=="number"),F.length<=0)return(this||Gt).words=[0],(this||Gt).length=1,this||Gt;(this||Gt).length=Math.ceil(F.length/3),(this||Gt).words=new Array((this||Gt).length);for(var E=0;E<(this||Gt).length;E++)(this||Gt).words[E]=0;var n,s,f=0;if(Y==="be")for(E=F.length-1,n=0;E>=0;E-=3)s=F[E]|F[E-1]<<8|F[E-2]<<16,(this||Gt).words[n]|=s<<f&67108863,(this||Gt).words[n+1]=s>>>26-f&67108863,(f+=24)>=26&&(f-=26,n++);else if(Y==="le")for(E=0,n=0;E<F.length;E+=3)s=F[E]|F[E+1]<<8|F[E+2]<<16,(this||Gt).words[n]|=s<<f&67108863,(this||Gt).words[n+1]=s>>>26-f&67108863,(f+=24)>=26&&(f-=26,n++);return this.strip()},o.prototype._parseHex=function(F,H){(this||Gt).length=Math.ceil((F.length-H)/6),(this||Gt).words=new Array((this||Gt).length);for(var Y=0;Y<(this||Gt).length;Y++)(this||Gt).words[Y]=0;var E,n,s=0;for(Y=F.length-6,E=0;Y>=H;Y-=6)n=c(F,Y,Y+6),(this||Gt).words[E]|=n<<s&67108863,(this||Gt).words[E+1]|=n>>>26-s&4194303,(s+=24)>=26&&(s-=26,E++);Y+6!==H&&(n=c(F,H,Y+6),(this||Gt).words[E]|=n<<s&67108863,(this||Gt).words[E+1]|=n>>>26-s&4194303),this.strip()},o.prototype._parseBase=function(F,H,Y){(this||Gt).words=[0],(this||Gt).length=1;for(var E=0,n=1;n<=67108863;n*=H)E++;E--,n=n/H|0;for(var s=F.length-Y,f=s%E,d=Math.min(s,s-f)+Y,g=0,S=Y;S<d;S+=E)g=p(F,S,S+E,H),this.imuln(n),(this||Gt).words[0]+g<67108864?(this||Gt).words[0]+=g:this._iaddn(g);if(f!==0){var x=1;for(g=p(F,S,F.length,H),S=0;S<f;S++)x*=H;this.imuln(x),(this||Gt).words[0]+g<67108864?(this||Gt).words[0]+=g:this._iaddn(g)}},o.prototype.copy=function(F){F.words=new Array((this||Gt).length);for(var H=0;H<(this||Gt).length;H++)F.words[H]=(this||Gt).words[H];F.length=(this||Gt).length,F.negative=(this||Gt).negative,F.red=(this||Gt).red},o.prototype.clone=function(){var F=new o(null);return this.copy(F),F},o.prototype._expand=function(F){for(;(this||Gt).length<F;)(this||Gt).words[(this||Gt).length++]=0;return this||Gt},o.prototype.strip=function(){for(;(this||Gt).length>1&&(this||Gt).words[(this||Gt).length-1]===0;)(this||Gt).length--;return this._normSign()},o.prototype._normSign=function(){return(this||Gt).length===1&&(this||Gt).words[0]===0&&((this||Gt).negative=0),this||Gt},o.prototype.inspect=function(){return((this||Gt).red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var w=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],m=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function v(F,H,Y){Y.negative=H.negative^F.negative;var E=F.length+H.length|0;Y.length=E,E=E-1|0;var n=0|F.words[0],s=0|H.words[0],f=n*s,d=67108863&f,g=f/67108864|0;Y.words[0]=d;for(var S=1;S<E;S++){for(var x=g>>>26,a=67108863&g,e=Math.min(S,H.length-1),u=Math.max(0,S-F.length+1);u<=e;u++){var b=S-u|0;x+=(f=(n=0|F.words[b])*(s=0|H.words[u])+a)/67108864|0,a=67108863&f}Y.words[S]=0|a,g=0|x}return g!==0?Y.words[S]=0|g:Y.length--,Y.strip()}o.prototype.toString=function(F,H){var Y;if(H=0|H||1,(F=F||10)===16||F==="hex"){Y="";for(var E=0,n=0,s=0;s<(this||Gt).length;s++){var f=(this||Gt).words[s],d=(16777215&(f<<E|n)).toString(16);Y=(n=f>>>24-E&16777215)!==0||s!==(this||Gt).length-1?w[6-d.length]+d+Y:d+Y,(E+=2)>=26&&(E-=26,s--)}for(n!==0&&(Y=n.toString(16)+Y);Y.length%H!=0;)Y="0"+Y;return(this||Gt).negative!==0&&(Y="-"+Y),Y}if(F===(0|F)&&F>=2&&F<=36){var g=m[F],S=y[F];Y="";var x=this.clone();for(x.negative=0;!x.isZero();){var a=x.modn(S).toString(F);Y=(x=x.idivn(S)).isZero()?a+Y:w[g-a.length]+a+Y}for(this.isZero()&&(Y="0"+Y);Y.length%H!=0;)Y="0"+Y;return(this||Gt).negative!==0&&(Y="-"+Y),Y}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var F=(this||Gt).words[0];return(this||Gt).length===2?F+=67108864*(this||Gt).words[1]:(this||Gt).length===3&&(this||Gt).words[2]===1?F+=4503599627370496+67108864*(this||Gt).words[1]:(this||Gt).length>2&&r(!1,"Number can only safely store up to 53 bits"),(this||Gt).negative!==0?-F:F},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(F,H){return r(l!==void 0),this.toArrayLike(l,F,H)},o.prototype.toArray=function(F,H){return this.toArrayLike(Array,F,H)},o.prototype.toArrayLike=function(F,H,Y){var E=this.byteLength(),n=Y||Math.max(1,E);r(E<=n,"byte array longer than desired length"),r(n>0,"Requested array length <= 0"),this.strip();var s,f,d=H==="le",g=new F(n),S=this.clone();if(d){for(f=0;!S.isZero();f++)s=S.andln(255),S.iushrn(8),g[f]=s;for(;f<n;f++)g[f]=0}else{for(f=0;f<n-E;f++)g[f]=0;for(f=0;!S.isZero();f++)s=S.andln(255),S.iushrn(8),g[n-f-1]=s}return g},Math.clz32?o.prototype._countBits=function(F){return 32-Math.clz32(F)}:o.prototype._countBits=function(F){var H=F,Y=0;return H>=4096&&(Y+=13,H>>>=13),H>=64&&(Y+=7,H>>>=7),H>=8&&(Y+=4,H>>>=4),H>=2&&(Y+=2,H>>>=2),Y+H},o.prototype._zeroBits=function(F){if(F===0)return 26;var H=F,Y=0;return!(8191&H)&&(Y+=13,H>>>=13),!(127&H)&&(Y+=7,H>>>=7),!(15&H)&&(Y+=4,H>>>=4),!(3&H)&&(Y+=2,H>>>=2),!(1&H)&&Y++,Y},o.prototype.bitLength=function(){var F=(this||Gt).words[(this||Gt).length-1],H=this._countBits(F);return 26*((this||Gt).length-1)+H},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var F=0,H=0;H<(this||Gt).length;H++){var Y=this._zeroBits((this||Gt).words[H]);if(F+=Y,Y!==26)break}return F},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(F){return(this||Gt).negative!==0?this.abs().inotn(F).iaddn(1):this.clone()},o.prototype.fromTwos=function(F){return this.testn(F-1)?this.notn(F).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return(this||Gt).negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||((this||Gt).negative^=1),this||Gt},o.prototype.iuor=function(F){for(;(this||Gt).length<F.length;)(this||Gt).words[(this||Gt).length++]=0;for(var H=0;H<F.length;H++)(this||Gt).words[H]=(this||Gt).words[H]|F.words[H];return this.strip()},o.prototype.ior=function(F){return r(((this||Gt).negative|F.negative)==0),this.iuor(F)},o.prototype.or=function(F){return(this||Gt).length>F.length?this.clone().ior(F):F.clone().ior(this||Gt)},o.prototype.uor=function(F){return(this||Gt).length>F.length?this.clone().iuor(F):F.clone().iuor(this||Gt)},o.prototype.iuand=function(F){var H;H=(this||Gt).length>F.length?F:this||Gt;for(var Y=0;Y<H.length;Y++)(this||Gt).words[Y]=(this||Gt).words[Y]&F.words[Y];return(this||Gt).length=H.length,this.strip()},o.prototype.iand=function(F){return r(((this||Gt).negative|F.negative)==0),this.iuand(F)},o.prototype.and=function(F){return(this||Gt).length>F.length?this.clone().iand(F):F.clone().iand(this||Gt)},o.prototype.uand=function(F){return(this||Gt).length>F.length?this.clone().iuand(F):F.clone().iuand(this||Gt)},o.prototype.iuxor=function(F){var H,Y;(this||Gt).length>F.length?(H=this||Gt,Y=F):(H=F,Y=this||Gt);for(var E=0;E<Y.length;E++)(this||Gt).words[E]=H.words[E]^Y.words[E];if((this||Gt)!==H)for(;E<H.length;E++)(this||Gt).words[E]=H.words[E];return(this||Gt).length=H.length,this.strip()},o.prototype.ixor=function(F){return r(((this||Gt).negative|F.negative)==0),this.iuxor(F)},o.prototype.xor=function(F){return(this||Gt).length>F.length?this.clone().ixor(F):F.clone().ixor(this||Gt)},o.prototype.uxor=function(F){return(this||Gt).length>F.length?this.clone().iuxor(F):F.clone().iuxor(this||Gt)},o.prototype.inotn=function(F){r(typeof F=="number"&&F>=0);var H=0|Math.ceil(F/26),Y=F%26;this._expand(H),Y>0&&H--;for(var E=0;E<H;E++)(this||Gt).words[E]=67108863&~(this||Gt).words[E];return Y>0&&((this||Gt).words[E]=~(this||Gt).words[E]&67108863>>26-Y),this.strip()},o.prototype.notn=function(F){return this.clone().inotn(F)},o.prototype.setn=function(F,H){r(typeof F=="number"&&F>=0);var Y=F/26|0,E=F%26;return this._expand(Y+1),(this||Gt).words[Y]=H?(this||Gt).words[Y]|1<<E:(this||Gt).words[Y]&~(1<<E),this.strip()},o.prototype.iadd=function(F){var H,Y,E;if((this||Gt).negative!==0&&F.negative===0)return(this||Gt).negative=0,H=this.isub(F),(this||Gt).negative^=1,this._normSign();if((this||Gt).negative===0&&F.negative!==0)return F.negative=0,H=this.isub(F),F.negative=1,H._normSign();(this||Gt).length>F.length?(Y=this||Gt,E=F):(Y=F,E=this||Gt);for(var n=0,s=0;s<E.length;s++)H=(0|Y.words[s])+(0|E.words[s])+n,(this||Gt).words[s]=67108863&H,n=H>>>26;for(;n!==0&&s<Y.length;s++)H=(0|Y.words[s])+n,(this||Gt).words[s]=67108863&H,n=H>>>26;if((this||Gt).length=Y.length,n!==0)(this||Gt).words[(this||Gt).length]=n,(this||Gt).length++;else if(Y!==(this||Gt))for(;s<Y.length;s++)(this||Gt).words[s]=Y.words[s];return this||Gt},o.prototype.add=function(F){var H;return F.negative!==0&&(this||Gt).negative===0?(F.negative=0,H=this.sub(F),F.negative^=1,H):F.negative===0&&(this||Gt).negative!==0?((this||Gt).negative=0,H=F.sub(this||Gt),(this||Gt).negative=1,H):(this||Gt).length>F.length?this.clone().iadd(F):F.clone().iadd(this||Gt)},o.prototype.isub=function(F){if(F.negative!==0){F.negative=0;var H=this.iadd(F);return F.negative=1,H._normSign()}if((this||Gt).negative!==0)return(this||Gt).negative=0,this.iadd(F),(this||Gt).negative=1,this._normSign();var Y,E,n=this.cmp(F);if(n===0)return(this||Gt).negative=0,(this||Gt).length=1,(this||Gt).words[0]=0,this||Gt;n>0?(Y=this||Gt,E=F):(Y=F,E=this||Gt);for(var s=0,f=0;f<E.length;f++)s=(H=(0|Y.words[f])-(0|E.words[f])+s)>>26,(this||Gt).words[f]=67108863&H;for(;s!==0&&f<Y.length;f++)s=(H=(0|Y.words[f])+s)>>26,(this||Gt).words[f]=67108863&H;if(s===0&&f<Y.length&&Y!==(this||Gt))for(;f<Y.length;f++)(this||Gt).words[f]=Y.words[f];return(this||Gt).length=Math.max((this||Gt).length,f),Y!==(this||Gt)&&((this||Gt).negative=1),this.strip()},o.prototype.sub=function(F){return this.clone().isub(F)};var M=function(F,H,Y){var E,n,s,f=F.words,d=H.words,g=Y.words,S=0,x=0|f[0],a=8191&x,e=x>>>13,u=0|f[1],b=8191&u,_=u>>>13,k=0|f[2],$=8191&k,it=k>>>13,Z=0|f[3],et=8191&Z,Q=Z>>>13,z=0|f[4],tt=8191&z,X=z>>>13,U=0|f[5],j=8191&U,rt=U>>>13,ot=0|f[6],ct=8191&ot,ut=ot>>>13,pt=0|f[7],St=8191&pt,bt=pt>>>13,lt=0|f[8],mt=8191<,wt=lt>>>13,Mt=0|f[9],ne=8191&Mt,nt=Mt>>>13,I=0|d[0],O=8191&I,L=I>>>13,V=0|d[1],st=8191&V,ft=V>>>13,ht=0|d[2],Et=8191&ht,_t=ht>>>13,vt=0|d[3],Qt=8191&vt,It=vt>>>13,Pt=0|d[4],Se=8191&Pt,he=Pt>>>13,Vt=0|d[5],Te=8191&Vt,ae=Vt>>>13,ie=0|d[6],_e=8191&ie,Yt=ie>>>13,re=0|d[7],Ae=8191&re,le=re>>>13,te=0|d[8],Re=8191&te,ue=te>>>13,ee=0|d[9],ke=8191&ee,de=ee>>>13;Y.negative=F.negative^H.negative,Y.length=19;var se=(S+(E=Math.imul(a,O))|0)+((8191&(n=(n=Math.imul(a,L))+Math.imul(e,O)|0))<<13)|0;S=((s=Math.imul(e,L))+(n>>>13)|0)+(se>>>26)|0,se&=67108863,E=Math.imul(b,O),n=(n=Math.imul(b,L))+Math.imul(_,O)|0,s=Math.imul(_,L);var Be=(S+(E=E+Math.imul(a,st)|0)|0)+((8191&(n=(n=n+Math.imul(a,ft)|0)+Math.imul(e,st)|0))<<13)|0;S=((s=s+Math.imul(e,ft)|0)+(n>>>13)|0)+(Be>>>26)|0,Be&=67108863,E=Math.imul($,O),n=(n=Math.imul($,L))+Math.imul(it,O)|0,s=Math.imul(it,L),E=E+Math.imul(b,st)|0,n=(n=n+Math.imul(b,ft)|0)+Math.imul(_,st)|0,s=s+Math.imul(_,ft)|0;var pe=(S+(E=E+Math.imul(a,Et)|0)|0)+((8191&(n=(n=n+Math.imul(a,_t)|0)+Math.imul(e,Et)|0))<<13)|0;S=((s=s+Math.imul(e,_t)|0)+(n>>>13)|0)+(pe>>>26)|0,pe&=67108863,E=Math.imul(et,O),n=(n=Math.imul(et,L))+Math.imul(Q,O)|0,s=Math.imul(Q,L),E=E+Math.imul($,st)|0,n=(n=n+Math.imul($,ft)|0)+Math.imul(it,st)|0,s=s+Math.imul(it,ft)|0,E=E+Math.imul(b,Et)|0,n=(n=n+Math.imul(b,_t)|0)+Math.imul(_,Et)|0,s=s+Math.imul(_,_t)|0;var oe=(S+(E=E+Math.imul(a,Qt)|0)|0)+((8191&(n=(n=n+Math.imul(a,It)|0)+Math.imul(e,Qt)|0))<<13)|0;S=((s=s+Math.imul(e,It)|0)+(n>>>13)|0)+(oe>>>26)|0,oe&=67108863,E=Math.imul(tt,O),n=(n=Math.imul(tt,L))+Math.imul(X,O)|0,s=Math.imul(X,L),E=E+Math.imul(et,st)|0,n=(n=n+Math.imul(et,ft)|0)+Math.imul(Q,st)|0,s=s+Math.imul(Q,ft)|0,E=E+Math.imul($,Et)|0,n=(n=n+Math.imul($,_t)|0)+Math.imul(it,Et)|0,s=s+Math.imul(it,_t)|0,E=E+Math.imul(b,Qt)|0,n=(n=n+Math.imul(b,It)|0)+Math.imul(_,Qt)|0,s=s+Math.imul(_,It)|0;var Ie=(S+(E=E+Math.imul(a,Se)|0)|0)+((8191&(n=(n=n+Math.imul(a,he)|0)+Math.imul(e,Se)|0))<<13)|0;S=((s=s+Math.imul(e,he)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,E=Math.imul(j,O),n=(n=Math.imul(j,L))+Math.imul(rt,O)|0,s=Math.imul(rt,L),E=E+Math.imul(tt,st)|0,n=(n=n+Math.imul(tt,ft)|0)+Math.imul(X,st)|0,s=s+Math.imul(X,ft)|0,E=E+Math.imul(et,Et)|0,n=(n=n+Math.imul(et,_t)|0)+Math.imul(Q,Et)|0,s=s+Math.imul(Q,_t)|0,E=E+Math.imul($,Qt)|0,n=(n=n+Math.imul($,It)|0)+Math.imul(it,Qt)|0,s=s+Math.imul(it,It)|0,E=E+Math.imul(b,Se)|0,n=(n=n+Math.imul(b,he)|0)+Math.imul(_,Se)|0,s=s+Math.imul(_,he)|0;var Ze=(S+(E=E+Math.imul(a,Te)|0)|0)+((8191&(n=(n=n+Math.imul(a,ae)|0)+Math.imul(e,Te)|0))<<13)|0;S=((s=s+Math.imul(e,ae)|0)+(n>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,E=Math.imul(ct,O),n=(n=Math.imul(ct,L))+Math.imul(ut,O)|0,s=Math.imul(ut,L),E=E+Math.imul(j,st)|0,n=(n=n+Math.imul(j,ft)|0)+Math.imul(rt,st)|0,s=s+Math.imul(rt,ft)|0,E=E+Math.imul(tt,Et)|0,n=(n=n+Math.imul(tt,_t)|0)+Math.imul(X,Et)|0,s=s+Math.imul(X,_t)|0,E=E+Math.imul(et,Qt)|0,n=(n=n+Math.imul(et,It)|0)+Math.imul(Q,Qt)|0,s=s+Math.imul(Q,It)|0,E=E+Math.imul($,Se)|0,n=(n=n+Math.imul($,he)|0)+Math.imul(it,Se)|0,s=s+Math.imul(it,he)|0,E=E+Math.imul(b,Te)|0,n=(n=n+Math.imul(b,ae)|0)+Math.imul(_,Te)|0,s=s+Math.imul(_,ae)|0;var Ce=(S+(E=E+Math.imul(a,_e)|0)|0)+((8191&(n=(n=n+Math.imul(a,Yt)|0)+Math.imul(e,_e)|0))<<13)|0;S=((s=s+Math.imul(e,Yt)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,E=Math.imul(St,O),n=(n=Math.imul(St,L))+Math.imul(bt,O)|0,s=Math.imul(bt,L),E=E+Math.imul(ct,st)|0,n=(n=n+Math.imul(ct,ft)|0)+Math.imul(ut,st)|0,s=s+Math.imul(ut,ft)|0,E=E+Math.imul(j,Et)|0,n=(n=n+Math.imul(j,_t)|0)+Math.imul(rt,Et)|0,s=s+Math.imul(rt,_t)|0,E=E+Math.imul(tt,Qt)|0,n=(n=n+Math.imul(tt,It)|0)+Math.imul(X,Qt)|0,s=s+Math.imul(X,It)|0,E=E+Math.imul(et,Se)|0,n=(n=n+Math.imul(et,he)|0)+Math.imul(Q,Se)|0,s=s+Math.imul(Q,he)|0,E=E+Math.imul($,Te)|0,n=(n=n+Math.imul($,ae)|0)+Math.imul(it,Te)|0,s=s+Math.imul(it,ae)|0,E=E+Math.imul(b,_e)|0,n=(n=n+Math.imul(b,Yt)|0)+Math.imul(_,_e)|0,s=s+Math.imul(_,Yt)|0;var Pe=(S+(E=E+Math.imul(a,Ae)|0)|0)+((8191&(n=(n=n+Math.imul(a,le)|0)+Math.imul(e,Ae)|0))<<13)|0;S=((s=s+Math.imul(e,le)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,E=Math.imul(mt,O),n=(n=Math.imul(mt,L))+Math.imul(wt,O)|0,s=Math.imul(wt,L),E=E+Math.imul(St,st)|0,n=(n=n+Math.imul(St,ft)|0)+Math.imul(bt,st)|0,s=s+Math.imul(bt,ft)|0,E=E+Math.imul(ct,Et)|0,n=(n=n+Math.imul(ct,_t)|0)+Math.imul(ut,Et)|0,s=s+Math.imul(ut,_t)|0,E=E+Math.imul(j,Qt)|0,n=(n=n+Math.imul(j,It)|0)+Math.imul(rt,Qt)|0,s=s+Math.imul(rt,It)|0,E=E+Math.imul(tt,Se)|0,n=(n=n+Math.imul(tt,he)|0)+Math.imul(X,Se)|0,s=s+Math.imul(X,he)|0,E=E+Math.imul(et,Te)|0,n=(n=n+Math.imul(et,ae)|0)+Math.imul(Q,Te)|0,s=s+Math.imul(Q,ae)|0,E=E+Math.imul($,_e)|0,n=(n=n+Math.imul($,Yt)|0)+Math.imul(it,_e)|0,s=s+Math.imul(it,Yt)|0,E=E+Math.imul(b,Ae)|0,n=(n=n+Math.imul(b,le)|0)+Math.imul(_,Ae)|0,s=s+Math.imul(_,le)|0;var fr=(S+(E=E+Math.imul(a,Re)|0)|0)+((8191&(n=(n=n+Math.imul(a,ue)|0)+Math.imul(e,Re)|0))<<13)|0;S=((s=s+Math.imul(e,ue)|0)+(n>>>13)|0)+(fr>>>26)|0,fr&=67108863,E=Math.imul(ne,O),n=(n=Math.imul(ne,L))+Math.imul(nt,O)|0,s=Math.imul(nt,L),E=E+Math.imul(mt,st)|0,n=(n=n+Math.imul(mt,ft)|0)+Math.imul(wt,st)|0,s=s+Math.imul(wt,ft)|0,E=E+Math.imul(St,Et)|0,n=(n=n+Math.imul(St,_t)|0)+Math.imul(bt,Et)|0,s=s+Math.imul(bt,_t)|0,E=E+Math.imul(ct,Qt)|0,n=(n=n+Math.imul(ct,It)|0)+Math.imul(ut,Qt)|0,s=s+Math.imul(ut,It)|0,E=E+Math.imul(j,Se)|0,n=(n=n+Math.imul(j,he)|0)+Math.imul(rt,Se)|0,s=s+Math.imul(rt,he)|0,E=E+Math.imul(tt,Te)|0,n=(n=n+Math.imul(tt,ae)|0)+Math.imul(X,Te)|0,s=s+Math.imul(X,ae)|0,E=E+Math.imul(et,_e)|0,n=(n=n+Math.imul(et,Yt)|0)+Math.imul(Q,_e)|0,s=s+Math.imul(Q,Yt)|0,E=E+Math.imul($,Ae)|0,n=(n=n+Math.imul($,le)|0)+Math.imul(it,Ae)|0,s=s+Math.imul(it,le)|0,E=E+Math.imul(b,Re)|0,n=(n=n+Math.imul(b,ue)|0)+Math.imul(_,Re)|0,s=s+Math.imul(_,ue)|0;var $e=(S+(E=E+Math.imul(a,ke)|0)|0)+((8191&(n=(n=n+Math.imul(a,de)|0)+Math.imul(e,ke)|0))<<13)|0;S=((s=s+Math.imul(e,de)|0)+(n>>>13)|0)+($e>>>26)|0,$e&=67108863,E=Math.imul(ne,st),n=(n=Math.imul(ne,ft))+Math.imul(nt,st)|0,s=Math.imul(nt,ft),E=E+Math.imul(mt,Et)|0,n=(n=n+Math.imul(mt,_t)|0)+Math.imul(wt,Et)|0,s=s+Math.imul(wt,_t)|0,E=E+Math.imul(St,Qt)|0,n=(n=n+Math.imul(St,It)|0)+Math.imul(bt,Qt)|0,s=s+Math.imul(bt,It)|0,E=E+Math.imul(ct,Se)|0,n=(n=n+Math.imul(ct,he)|0)+Math.imul(ut,Se)|0,s=s+Math.imul(ut,he)|0,E=E+Math.imul(j,Te)|0,n=(n=n+Math.imul(j,ae)|0)+Math.imul(rt,Te)|0,s=s+Math.imul(rt,ae)|0,E=E+Math.imul(tt,_e)|0,n=(n=n+Math.imul(tt,Yt)|0)+Math.imul(X,_e)|0,s=s+Math.imul(X,Yt)|0,E=E+Math.imul(et,Ae)|0,n=(n=n+Math.imul(et,le)|0)+Math.imul(Q,Ae)|0,s=s+Math.imul(Q,le)|0,E=E+Math.imul($,Re)|0,n=(n=n+Math.imul($,ue)|0)+Math.imul(it,Re)|0,s=s+Math.imul(it,ue)|0;var Ue=(S+(E=E+Math.imul(b,ke)|0)|0)+((8191&(n=(n=n+Math.imul(b,de)|0)+Math.imul(_,ke)|0))<<13)|0;S=((s=s+Math.imul(_,de)|0)+(n>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,E=Math.imul(ne,Et),n=(n=Math.imul(ne,_t))+Math.imul(nt,Et)|0,s=Math.imul(nt,_t),E=E+Math.imul(mt,Qt)|0,n=(n=n+Math.imul(mt,It)|0)+Math.imul(wt,Qt)|0,s=s+Math.imul(wt,It)|0,E=E+Math.imul(St,Se)|0,n=(n=n+Math.imul(St,he)|0)+Math.imul(bt,Se)|0,s=s+Math.imul(bt,he)|0,E=E+Math.imul(ct,Te)|0,n=(n=n+Math.imul(ct,ae)|0)+Math.imul(ut,Te)|0,s=s+Math.imul(ut,ae)|0,E=E+Math.imul(j,_e)|0,n=(n=n+Math.imul(j,Yt)|0)+Math.imul(rt,_e)|0,s=s+Math.imul(rt,Yt)|0,E=E+Math.imul(tt,Ae)|0,n=(n=n+Math.imul(tt,le)|0)+Math.imul(X,Ae)|0,s=s+Math.imul(X,le)|0,E=E+Math.imul(et,Re)|0,n=(n=n+Math.imul(et,ue)|0)+Math.imul(Q,Re)|0,s=s+Math.imul(Q,ue)|0;var rr=(S+(E=E+Math.imul($,ke)|0)|0)+((8191&(n=(n=n+Math.imul($,de)|0)+Math.imul(it,ke)|0))<<13)|0;S=((s=s+Math.imul(it,de)|0)+(n>>>13)|0)+(rr>>>26)|0,rr&=67108863,E=Math.imul(ne,Qt),n=(n=Math.imul(ne,It))+Math.imul(nt,Qt)|0,s=Math.imul(nt,It),E=E+Math.imul(mt,Se)|0,n=(n=n+Math.imul(mt,he)|0)+Math.imul(wt,Se)|0,s=s+Math.imul(wt,he)|0,E=E+Math.imul(St,Te)|0,n=(n=n+Math.imul(St,ae)|0)+Math.imul(bt,Te)|0,s=s+Math.imul(bt,ae)|0,E=E+Math.imul(ct,_e)|0,n=(n=n+Math.imul(ct,Yt)|0)+Math.imul(ut,_e)|0,s=s+Math.imul(ut,Yt)|0,E=E+Math.imul(j,Ae)|0,n=(n=n+Math.imul(j,le)|0)+Math.imul(rt,Ae)|0,s=s+Math.imul(rt,le)|0,E=E+Math.imul(tt,Re)|0,n=(n=n+Math.imul(tt,ue)|0)+Math.imul(X,Re)|0,s=s+Math.imul(X,ue)|0;var sr=(S+(E=E+Math.imul(et,ke)|0)|0)+((8191&(n=(n=n+Math.imul(et,de)|0)+Math.imul(Q,ke)|0))<<13)|0;S=((s=s+Math.imul(Q,de)|0)+(n>>>13)|0)+(sr>>>26)|0,sr&=67108863,E=Math.imul(ne,Se),n=(n=Math.imul(ne,he))+Math.imul(nt,Se)|0,s=Math.imul(nt,he),E=E+Math.imul(mt,Te)|0,n=(n=n+Math.imul(mt,ae)|0)+Math.imul(wt,Te)|0,s=s+Math.imul(wt,ae)|0,E=E+Math.imul(St,_e)|0,n=(n=n+Math.imul(St,Yt)|0)+Math.imul(bt,_e)|0,s=s+Math.imul(bt,Yt)|0,E=E+Math.imul(ct,Ae)|0,n=(n=n+Math.imul(ct,le)|0)+Math.imul(ut,Ae)|0,s=s+Math.imul(ut,le)|0,E=E+Math.imul(j,Re)|0,n=(n=n+Math.imul(j,ue)|0)+Math.imul(rt,Re)|0,s=s+Math.imul(rt,ue)|0;var ir=(S+(E=E+Math.imul(tt,ke)|0)|0)+((8191&(n=(n=n+Math.imul(tt,de)|0)+Math.imul(X,ke)|0))<<13)|0;S=((s=s+Math.imul(X,de)|0)+(n>>>13)|0)+(ir>>>26)|0,ir&=67108863,E=Math.imul(ne,Te),n=(n=Math.imul(ne,ae))+Math.imul(nt,Te)|0,s=Math.imul(nt,ae),E=E+Math.imul(mt,_e)|0,n=(n=n+Math.imul(mt,Yt)|0)+Math.imul(wt,_e)|0,s=s+Math.imul(wt,Yt)|0,E=E+Math.imul(St,Ae)|0,n=(n=n+Math.imul(St,le)|0)+Math.imul(bt,Ae)|0,s=s+Math.imul(bt,le)|0,E=E+Math.imul(ct,Re)|0,n=(n=n+Math.imul(ct,ue)|0)+Math.imul(ut,Re)|0,s=s+Math.imul(ut,ue)|0;var cr=(S+(E=E+Math.imul(j,ke)|0)|0)+((8191&(n=(n=n+Math.imul(j,de)|0)+Math.imul(rt,ke)|0))<<13)|0;S=((s=s+Math.imul(rt,de)|0)+(n>>>13)|0)+(cr>>>26)|0,cr&=67108863,E=Math.imul(ne,_e),n=(n=Math.imul(ne,Yt))+Math.imul(nt,_e)|0,s=Math.imul(nt,Yt),E=E+Math.imul(mt,Ae)|0,n=(n=n+Math.imul(mt,le)|0)+Math.imul(wt,Ae)|0,s=s+Math.imul(wt,le)|0,E=E+Math.imul(St,Re)|0,n=(n=n+Math.imul(St,ue)|0)+Math.imul(bt,Re)|0,s=s+Math.imul(bt,ue)|0;var nr=(S+(E=E+Math.imul(ct,ke)|0)|0)+((8191&(n=(n=n+Math.imul(ct,de)|0)+Math.imul(ut,ke)|0))<<13)|0;S=((s=s+Math.imul(ut,de)|0)+(n>>>13)|0)+(nr>>>26)|0,nr&=67108863,E=Math.imul(ne,Ae),n=(n=Math.imul(ne,le))+Math.imul(nt,Ae)|0,s=Math.imul(nt,le),E=E+Math.imul(mt,Re)|0,n=(n=n+Math.imul(mt,ue)|0)+Math.imul(wt,Re)|0,s=s+Math.imul(wt,ue)|0;var ur=(S+(E=E+Math.imul(St,ke)|0)|0)+((8191&(n=(n=n+Math.imul(St,de)|0)+Math.imul(bt,ke)|0))<<13)|0;S=((s=s+Math.imul(bt,de)|0)+(n>>>13)|0)+(ur>>>26)|0,ur&=67108863,E=Math.imul(ne,Re),n=(n=Math.imul(ne,ue))+Math.imul(nt,Re)|0,s=Math.imul(nt,ue);var Jt=(S+(E=E+Math.imul(mt,ke)|0)|0)+((8191&(n=(n=n+Math.imul(mt,de)|0)+Math.imul(wt,ke)|0))<<13)|0;S=((s=s+Math.imul(wt,de)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863;var At=(S+(E=Math.imul(ne,ke))|0)+((8191&(n=(n=Math.imul(ne,de))+Math.imul(nt,ke)|0))<<13)|0;return S=((s=Math.imul(nt,de))+(n>>>13)|0)+(At>>>26)|0,At&=67108863,g[0]=se,g[1]=Be,g[2]=pe,g[3]=oe,g[4]=Ie,g[5]=Ze,g[6]=Ce,g[7]=Pe,g[8]=fr,g[9]=$e,g[10]=Ue,g[11]=rr,g[12]=sr,g[13]=ir,g[14]=cr,g[15]=nr,g[16]=ur,g[17]=Jt,g[18]=At,S!==0&&(g[19]=S,Y.length++),Y};function T(F,H,Y){return new A().mulp(F,H,Y)}function A(F,H){(this||Gt).x=F,(this||Gt).y=H}Math.imul||(M=v),o.prototype.mulTo=function(F,H){var Y=(this||Gt).length+F.length;return(this||Gt).length===10&&F.length===10?M(this||Gt,F,H):Y<63?v(this||Gt,F,H):Y<1024?function(E,n,s){s.negative=n.negative^E.negative,s.length=E.length+n.length;for(var f=0,d=0,g=0;g<s.length-1;g++){var S=d;d=0;for(var x=67108863&f,a=Math.min(g,n.length-1),e=Math.max(0,g-E.length+1);e<=a;e++){var u=g-e,b=(0|E.words[u])*(0|n.words[e]),_=67108863&b;x=67108863&(_=_+x|0),d+=(S=(S=S+(b/67108864|0)|0)+(_>>>26)|0)>>>26,S&=67108863}s.words[g]=x,f=S,S=d}return f!==0?s.words[g]=f:s.length--,s.strip()}(this||Gt,F,H):T(this||Gt,F,H)},A.prototype.makeRBT=function(F){for(var H=new Array(F),Y=o.prototype._countBits(F)-1,E=0;E<F;E++)H[E]=this.revBin(E,Y,F);return H},A.prototype.revBin=function(F,H,Y){if(F===0||F===Y-1)return F;for(var E=0,n=0;n<H;n++)E|=(1&F)<<H-n-1,F>>=1;return E},A.prototype.permute=function(F,H,Y,E,n,s){for(var f=0;f<s;f++)E[f]=H[F[f]],n[f]=Y[F[f]]},A.prototype.transform=function(F,H,Y,E,n,s){this.permute(s,F,H,Y,E,n);for(var f=1;f<n;f<<=1)for(var d=f<<1,g=Math.cos(2*Math.PI/d),S=Math.sin(2*Math.PI/d),x=0;x<n;x+=d)for(var a=g,e=S,u=0;u<f;u++){var b=Y[x+u],_=E[x+u],k=Y[x+u+f],$=E[x+u+f],it=a*k-e*$;$=a*$+e*k,k=it,Y[x+u]=b+k,E[x+u]=_+$,Y[x+u+f]=b-k,E[x+u+f]=_-$,u!==d&&(it=g*a-S*e,e=g*e+S*a,a=it)}},A.prototype.guessLen13b=function(F,H){var Y=1|Math.max(H,F),E=1&Y,n=0;for(Y=Y/2|0;Y;Y>>>=1)n++;return 1<<n+1+E},A.prototype.conjugate=function(F,H,Y){if(!(Y<=1))for(var E=0;E<Y/2;E++){var n=F[E];F[E]=F[Y-E-1],F[Y-E-1]=n,n=H[E],H[E]=-H[Y-E-1],H[Y-E-1]=-n}},A.prototype.normalize13b=function(F,H){for(var Y=0,E=0;E<H/2;E++){var n=8192*Math.round(F[2*E+1]/H)+Math.round(F[2*E]/H)+Y;F[E]=67108863&n,Y=n<67108864?0:n/67108864|0}return F},A.prototype.convert13b=function(F,H,Y,E){for(var n=0,s=0;s<H;s++)n+=0|F[s],Y[2*s]=8191&n,n>>>=13,Y[2*s+1]=8191&n,n>>>=13;for(s=2*H;s<E;++s)Y[s]=0;r(n===0),r((-8192&n)==0)},A.prototype.stub=function(F){for(var H=new Array(F),Y=0;Y<F;Y++)H[Y]=0;return H},A.prototype.mulp=function(F,H,Y){var E=2*this.guessLen13b(F.length,H.length),n=this.makeRBT(E),s=this.stub(E),f=new Array(E),d=new Array(E),g=new Array(E),S=new Array(E),x=new Array(E),a=new Array(E),e=Y.words;e.length=E,this.convert13b(F.words,F.length,f,E),this.convert13b(H.words,H.length,S,E),this.transform(f,s,d,g,E,n),this.transform(S,s,x,a,E,n);for(var u=0;u<E;u++){var b=d[u]*x[u]-g[u]*a[u];g[u]=d[u]*a[u]+g[u]*x[u],d[u]=b}return this.conjugate(d,g,E),this.transform(d,g,e,s,E,n),this.conjugate(e,s,E),this.normalize13b(e,E),Y.negative=F.negative^H.negative,Y.length=F.length+H.length,Y.strip()},o.prototype.mul=function(F){var H=new o(null);return H.words=new Array((this||Gt).length+F.length),this.mulTo(F,H)},o.prototype.mulf=function(F){var H=new o(null);return H.words=new Array((this||Gt).length+F.length),T(this||Gt,F,H)},o.prototype.imul=function(F){return this.clone().mulTo(F,this||Gt)},o.prototype.imuln=function(F){r(typeof F=="number"),r(F<67108864);for(var H=0,Y=0;Y<(this||Gt).length;Y++){var E=(0|(this||Gt).words[Y])*F,n=(67108863&E)+(67108863&H);H>>=26,H+=E/67108864|0,H+=n>>>26,(this||Gt).words[Y]=67108863&n}return H!==0&&((this||Gt).words[Y]=H,(this||Gt).length++),this||Gt},o.prototype.muln=function(F){return this.clone().imuln(F)},o.prototype.sqr=function(){return this.mul(this||Gt)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(F){var H=function(s){for(var f=new Array(s.bitLength()),d=0;d<f.length;d++){var g=d/26|0,S=d%26;f[d]=(s.words[g]&1<<S)>>>S}return f}(F);if(H.length===0)return new o(1);for(var Y=this||Gt,E=0;E<H.length&&H[E]===0;E++,Y=Y.sqr());if(++E<H.length)for(var n=Y.sqr();E<H.length;E++,n=n.sqr())H[E]!==0&&(Y=Y.mul(n));return Y},o.prototype.iushln=function(F){r(typeof F=="number"&&F>=0);var H,Y=F%26,E=(F-Y)/26,n=67108863>>>26-Y<<26-Y;if(Y!==0){var s=0;for(H=0;H<(this||Gt).length;H++){var f=(this||Gt).words[H]&n,d=(0|(this||Gt).words[H])-f<<Y;(this||Gt).words[H]=d|s,s=f>>>26-Y}s&&((this||Gt).words[H]=s,(this||Gt).length++)}if(E!==0){for(H=(this||Gt).length-1;H>=0;H--)(this||Gt).words[H+E]=(this||Gt).words[H];for(H=0;H<E;H++)(this||Gt).words[H]=0;(this||Gt).length+=E}return this.strip()},o.prototype.ishln=function(F){return r((this||Gt).negative===0),this.iushln(F)},o.prototype.iushrn=function(F,H,Y){var E;r(typeof F=="number"&&F>=0),E=H?(H-H%26)/26:0;var n=F%26,s=Math.min((F-n)/26,(this||Gt).length),f=67108863^67108863>>>n<<n,d=Y;if(E-=s,E=Math.max(0,E),d){for(var g=0;g<s;g++)d.words[g]=(this||Gt).words[g];d.length=s}if(s!==0)if((this||Gt).length>s)for((this||Gt).length-=s,g=0;g<(this||Gt).length;g++)(this||Gt).words[g]=(this||Gt).words[g+s];else(this||Gt).words[0]=0,(this||Gt).length=1;var S=0;for(g=(this||Gt).length-1;g>=0&&(S!==0||g>=E);g--){var x=0|(this||Gt).words[g];(this||Gt).words[g]=S<<26-n|x>>>n,S=x&f}return d&&S!==0&&(d.words[d.length++]=S),(this||Gt).length===0&&((this||Gt).words[0]=0,(this||Gt).length=1),this.strip()},o.prototype.ishrn=function(F,H,Y){return r((this||Gt).negative===0),this.iushrn(F,H,Y)},o.prototype.shln=function(F){return this.clone().ishln(F)},o.prototype.ushln=function(F){return this.clone().iushln(F)},o.prototype.shrn=function(F){return this.clone().ishrn(F)},o.prototype.ushrn=function(F){return this.clone().iushrn(F)},o.prototype.testn=function(F){r(typeof F=="number"&&F>=0);var H=F%26,Y=(F-H)/26,E=1<<H;return!((this||Gt).length<=Y)&&!!((this||Gt).words[Y]&E)},o.prototype.imaskn=function(F){r(typeof F=="number"&&F>=0);var H=F%26,Y=(F-H)/26;if(r((this||Gt).negative===0,"imaskn works only with positive numbers"),(this||Gt).length<=Y)return this||Gt;if(H!==0&&Y++,(this||Gt).length=Math.min(Y,(this||Gt).length),H!==0){var E=67108863^67108863>>>H<<H;(this||Gt).words[(this||Gt).length-1]&=E}return this.strip()},o.prototype.maskn=function(F){return this.clone().imaskn(F)},o.prototype.iaddn=function(F){return r(typeof F=="number"),r(F<67108864),F<0?this.isubn(-F):(this||Gt).negative!==0?(this||Gt).length===1&&(0|(this||Gt).words[0])<F?((this||Gt).words[0]=F-(0|(this||Gt).words[0]),(this||Gt).negative=0,this||Gt):((this||Gt).negative=0,this.isubn(F),(this||Gt).negative=1,this||Gt):this._iaddn(F)},o.prototype._iaddn=function(F){(this||Gt).words[0]+=F;for(var H=0;H<(this||Gt).length&&(this||Gt).words[H]>=67108864;H++)(this||Gt).words[H]-=67108864,H===(this||Gt).length-1?(this||Gt).words[H+1]=1:(this||Gt).words[H+1]++;return(this||Gt).length=Math.max((this||Gt).length,H+1),this||Gt},o.prototype.isubn=function(F){if(r(typeof F=="number"),r(F<67108864),F<0)return this.iaddn(-F);if((this||Gt).negative!==0)return(this||Gt).negative=0,this.iaddn(F),(this||Gt).negative=1,this||Gt;if((this||Gt).words[0]-=F,(this||Gt).length===1&&(this||Gt).words[0]<0)(this||Gt).words[0]=-(this||Gt).words[0],(this||Gt).negative=1;else for(var H=0;H<(this||Gt).length&&(this||Gt).words[H]<0;H++)(this||Gt).words[H]+=67108864,(this||Gt).words[H+1]-=1;return this.strip()},o.prototype.addn=function(F){return this.clone().iaddn(F)},o.prototype.subn=function(F){return this.clone().isubn(F)},o.prototype.iabs=function(){return(this||Gt).negative=0,this||Gt},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(F,H,Y){var E,n,s=F.length+Y;this._expand(s);var f=0;for(E=0;E<F.length;E++){n=(0|(this||Gt).words[E+Y])+f;var d=(0|F.words[E])*H;f=((n-=67108863&d)>>26)-(d/67108864|0),(this||Gt).words[E+Y]=67108863&n}for(;E<(this||Gt).length-Y;E++)f=(n=(0|(this||Gt).words[E+Y])+f)>>26,(this||Gt).words[E+Y]=67108863&n;if(f===0)return this.strip();for(r(f===-1),f=0,E=0;E<(this||Gt).length;E++)f=(n=-(0|(this||Gt).words[E])+f)>>26,(this||Gt).words[E]=67108863&n;return(this||Gt).negative=1,this.strip()},o.prototype._wordDiv=function(F,H){var Y=((this||Gt).length,F.length),E=this.clone(),n=F,s=0|n.words[n.length-1];(Y=26-this._countBits(s))!==0&&(n=n.ushln(Y),E.iushln(Y),s=0|n.words[n.length-1]);var f,d=E.length-n.length;if(H!=="mod"){(f=new o(null)).length=d+1,f.words=new Array(f.length);for(var g=0;g<f.length;g++)f.words[g]=0}var S=E.clone()._ishlnsubmul(n,1,d);S.negative===0&&(E=S,f&&(f.words[d]=1));for(var x=d-1;x>=0;x--){var a=67108864*(0|E.words[n.length+x])+(0|E.words[n.length+x-1]);for(a=Math.min(a/s|0,67108863),E._ishlnsubmul(n,a,x);E.negative!==0;)a--,E.negative=0,E._ishlnsubmul(n,1,x),E.isZero()||(E.negative^=1);f&&(f.words[x]=a)}return f&&f.strip(),E.strip(),H!=="div"&&Y!==0&&E.iushrn(Y),{div:f||null,mod:E}},o.prototype.divmod=function(F,H,Y){return r(!F.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:(this||Gt).negative!==0&&F.negative===0?(s=this.neg().divmod(F,H),H!=="mod"&&(E=s.div.neg()),H!=="div"&&(n=s.mod.neg(),Y&&n.negative!==0&&n.iadd(F)),{div:E,mod:n}):(this||Gt).negative===0&&F.negative!==0?(s=this.divmod(F.neg(),H),H!=="mod"&&(E=s.div.neg()),{div:E,mod:s.mod}):(this||Gt).negative&F.negative?(s=this.neg().divmod(F.neg(),H),H!=="div"&&(n=s.mod.neg(),Y&&n.negative!==0&&n.isub(F)),{div:s.div,mod:n}):F.length>(this||Gt).length||this.cmp(F)<0?{div:new o(0),mod:this||Gt}:F.length===1?H==="div"?{div:this.divn(F.words[0]),mod:null}:H==="mod"?{div:null,mod:new o(this.modn(F.words[0]))}:{div:this.divn(F.words[0]),mod:new o(this.modn(F.words[0]))}:this._wordDiv(F,H);var E,n,s},o.prototype.div=function(F){return this.divmod(F,"div",!1).div},o.prototype.mod=function(F){return this.divmod(F,"mod",!1).mod},o.prototype.umod=function(F){return this.divmod(F,"mod",!0).mod},o.prototype.divRound=function(F){var H=this.divmod(F);if(H.mod.isZero())return H.div;var Y=H.div.negative!==0?H.mod.isub(F):H.mod,E=F.ushrn(1),n=F.andln(1),s=Y.cmp(E);return s<0||n===1&&s===0?H.div:H.div.negative!==0?H.div.isubn(1):H.div.iaddn(1)},o.prototype.modn=function(F){r(F<=67108863);for(var H=(1<<26)%F,Y=0,E=(this||Gt).length-1;E>=0;E--)Y=(H*Y+(0|(this||Gt).words[E]))%F;return Y},o.prototype.idivn=function(F){r(F<=67108863);for(var H=0,Y=(this||Gt).length-1;Y>=0;Y--){var E=(0|(this||Gt).words[Y])+67108864*H;(this||Gt).words[Y]=E/F|0,H=E%F}return this.strip()},o.prototype.divn=function(F){return this.clone().idivn(F)},o.prototype.egcd=function(F){r(F.negative===0),r(!F.isZero());var H=this||Gt,Y=F.clone();H=H.negative!==0?H.umod(F):H.clone();for(var E=new o(1),n=new o(0),s=new o(0),f=new o(1),d=0;H.isEven()&&Y.isEven();)H.iushrn(1),Y.iushrn(1),++d;for(var g=Y.clone(),S=H.clone();!H.isZero();){for(var x=0,a=1;!(H.words[0]&a)&&x<26;++x,a<<=1);if(x>0)for(H.iushrn(x);x-- >0;)(E.isOdd()||n.isOdd())&&(E.iadd(g),n.isub(S)),E.iushrn(1),n.iushrn(1);for(var e=0,u=1;!(Y.words[0]&u)&&e<26;++e,u<<=1);if(e>0)for(Y.iushrn(e);e-- >0;)(s.isOdd()||f.isOdd())&&(s.iadd(g),f.isub(S)),s.iushrn(1),f.iushrn(1);H.cmp(Y)>=0?(H.isub(Y),E.isub(s),n.isub(f)):(Y.isub(H),s.isub(E),f.isub(n))}return{a:s,b:f,gcd:Y.iushln(d)}},o.prototype._invmp=function(F){r(F.negative===0),r(!F.isZero());var H=this||Gt,Y=F.clone();H=H.negative!==0?H.umod(F):H.clone();for(var E,n=new o(1),s=new o(0),f=Y.clone();H.cmpn(1)>0&&Y.cmpn(1)>0;){for(var d=0,g=1;!(H.words[0]&g)&&d<26;++d,g<<=1);if(d>0)for(H.iushrn(d);d-- >0;)n.isOdd()&&n.iadd(f),n.iushrn(1);for(var S=0,x=1;!(Y.words[0]&x)&&S<26;++S,x<<=1);if(S>0)for(Y.iushrn(S);S-- >0;)s.isOdd()&&s.iadd(f),s.iushrn(1);H.cmp(Y)>=0?(H.isub(Y),n.isub(s)):(Y.isub(H),s.isub(n))}return(E=H.cmpn(1)===0?n:s).cmpn(0)<0&&E.iadd(F),E},o.prototype.gcd=function(F){if(this.isZero())return F.abs();if(F.isZero())return this.abs();var H=this.clone(),Y=F.clone();H.negative=0,Y.negative=0;for(var E=0;H.isEven()&&Y.isEven();E++)H.iushrn(1),Y.iushrn(1);for(;;){for(;H.isEven();)H.iushrn(1);for(;Y.isEven();)Y.iushrn(1);var n=H.cmp(Y);if(n<0){var s=H;H=Y,Y=s}else if(n===0||Y.cmpn(1)===0)break;H.isub(Y)}return Y.iushln(E)},o.prototype.invm=function(F){return this.egcd(F).a.umod(F)},o.prototype.isEven=function(){return(1&(this||Gt).words[0])==0},o.prototype.isOdd=function(){return(1&(this||Gt).words[0])==1},o.prototype.andln=function(F){return(this||Gt).words[0]&F},o.prototype.bincn=function(F){r(typeof F=="number");var H=F%26,Y=(F-H)/26,E=1<<H;if((this||Gt).length<=Y)return this._expand(Y+1),(this||Gt).words[Y]|=E,this||Gt;for(var n=E,s=Y;n!==0&&s<(this||Gt).length;s++){var f=0|(this||Gt).words[s];n=(f+=n)>>>26,f&=67108863,(this||Gt).words[s]=f}return n!==0&&((this||Gt).words[s]=n,(this||Gt).length++),this||Gt},o.prototype.isZero=function(){return(this||Gt).length===1&&(this||Gt).words[0]===0},o.prototype.cmpn=function(F){var H,Y=F<0;if((this||Gt).negative!==0&&!Y)return-1;if((this||Gt).negative===0&&Y)return 1;if(this.strip(),(this||Gt).length>1)H=1;else{Y&&(F=-F),r(F<=67108863,"Number is too big");var E=0|(this||Gt).words[0];H=E===F?0:E<F?-1:1}return(this||Gt).negative!==0?0|-H:H},o.prototype.cmp=function(F){if((this||Gt).negative!==0&&F.negative===0)return-1;if((this||Gt).negative===0&&F.negative!==0)return 1;var H=this.ucmp(F);return(this||Gt).negative!==0?0|-H:H},o.prototype.ucmp=function(F){if((this||Gt).length>F.length)return 1;if((this||Gt).length<F.length)return-1;for(var H=0,Y=(this||Gt).length-1;Y>=0;Y--){var E=0|(this||Gt).words[Y],n=0|F.words[Y];if(E!==n){E<n?H=-1:E>n&&(H=1);break}}return H},o.prototype.gtn=function(F){return this.cmpn(F)===1},o.prototype.gt=function(F){return this.cmp(F)===1},o.prototype.gten=function(F){return this.cmpn(F)>=0},o.prototype.gte=function(F){return this.cmp(F)>=0},o.prototype.ltn=function(F){return this.cmpn(F)===-1},o.prototype.lt=function(F){return this.cmp(F)===-1},o.prototype.lten=function(F){return this.cmpn(F)<=0},o.prototype.lte=function(F){return this.cmp(F)<=0},o.prototype.eqn=function(F){return this.cmpn(F)===0},o.prototype.eq=function(F){return this.cmp(F)===0},o.red=function(F){return new W(F)},o.prototype.toRed=function(F){return r(!(this||Gt).red,"Already a number in reduction context"),r((this||Gt).negative===0,"red works only with positives"),F.convertTo(this||Gt)._forceRed(F)},o.prototype.fromRed=function(){return r((this||Gt).red,"fromRed works only with numbers in reduction context"),(this||Gt).red.convertFrom(this||Gt)},o.prototype._forceRed=function(F){return(this||Gt).red=F,this||Gt},o.prototype.forceRed=function(F){return r(!(this||Gt).red,"Already a number in reduction context"),this._forceRed(F)},o.prototype.redAdd=function(F){return r((this||Gt).red,"redAdd works only with red numbers"),(this||Gt).red.add(this||Gt,F)},o.prototype.redIAdd=function(F){return r((this||Gt).red,"redIAdd works only with red numbers"),(this||Gt).red.iadd(this||Gt,F)},o.prototype.redSub=function(F){return r((this||Gt).red,"redSub works only with red numbers"),(this||Gt).red.sub(this||Gt,F)},o.prototype.redISub=function(F){return r((this||Gt).red,"redISub works only with red numbers"),(this||Gt).red.isub(this||Gt,F)},o.prototype.redShl=function(F){return r((this||Gt).red,"redShl works only with red numbers"),(this||Gt).red.shl(this||Gt,F)},o.prototype.redMul=function(F){return r((this||Gt).red,"redMul works only with red numbers"),(this||Gt).red._verify2(this||Gt,F),(this||Gt).red.mul(this||Gt,F)},o.prototype.redIMul=function(F){return r((this||Gt).red,"redMul works only with red numbers"),(this||Gt).red._verify2(this||Gt,F),(this||Gt).red.imul(this||Gt,F)},o.prototype.redSqr=function(){return r((this||Gt).red,"redSqr works only with red numbers"),(this||Gt).red._verify1(this||Gt),(this||Gt).red.sqr(this||Gt)},o.prototype.redISqr=function(){return r((this||Gt).red,"redISqr works only with red numbers"),(this||Gt).red._verify1(this||Gt),(this||Gt).red.isqr(this||Gt)},o.prototype.redSqrt=function(){return r((this||Gt).red,"redSqrt works only with red numbers"),(this||Gt).red._verify1(this||Gt),(this||Gt).red.sqrt(this||Gt)},o.prototype.redInvm=function(){return r((this||Gt).red,"redInvm works only with red numbers"),(this||Gt).red._verify1(this||Gt),(this||Gt).red.invm(this||Gt)},o.prototype.redNeg=function(){return r((this||Gt).red,"redNeg works only with red numbers"),(this||Gt).red._verify1(this||Gt),(this||Gt).red.neg(this||Gt)},o.prototype.redPow=function(F){return r((this||Gt).red&&!F.red,"redPow(normalNum)"),(this||Gt).red._verify1(this||Gt),(this||Gt).red.pow(this||Gt,F)};var R={k256:null,p224:null,p192:null,p25519:null};function B(F,H){(this||Gt).name=F,(this||Gt).p=new o(H,16),(this||Gt).n=(this||Gt).p.bitLength(),(this||Gt).k=new o(1).iushln((this||Gt).n).isub((this||Gt).p),(this||Gt).tmp=this._tmp()}function C(){B.call(this||Gt,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P(){B.call(this||Gt,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function N(){B.call(this||Gt,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function q(){B.call(this||Gt,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function W(F){if(typeof F=="string"){var H=o._prime(F);(this||Gt).m=H.p,(this||Gt).prime=H}else r(F.gtn(1),"modulus must be greater than 1"),(this||Gt).m=F,(this||Gt).prime=null}function J(F){W.call(this||Gt,F),(this||Gt).shift=(this||Gt).m.bitLength(),(this||Gt).shift%26!=0&&((this||Gt).shift+=26-(this||Gt).shift%26),(this||Gt).r=new o(1).iushln((this||Gt).shift),(this||Gt).r2=this.imod((this||Gt).r.sqr()),(this||Gt).rinv=(this||Gt).r._invmp((this||Gt).m),(this||Gt).minv=(this||Gt).rinv.mul((this||Gt).r).isubn(1).div((this||Gt).m),(this||Gt).minv=(this||Gt).minv.umod((this||Gt).r),(this||Gt).minv=(this||Gt).r.sub((this||Gt).minv)}B.prototype._tmp=function(){var F=new o(null);return F.words=new Array(Math.ceil((this||Gt).n/13)),F},B.prototype.ireduce=function(F){var H,Y=F;do this.split(Y,(this||Gt).tmp),H=(Y=(Y=this.imulK(Y)).iadd((this||Gt).tmp)).bitLength();while(H>(this||Gt).n);var E=H<(this||Gt).n?-1:Y.ucmp((this||Gt).p);return E===0?(Y.words[0]=0,Y.length=1):E>0?Y.isub((this||Gt).p):Y.strip(),Y},B.prototype.split=function(F,H){F.iushrn((this||Gt).n,0,H)},B.prototype.imulK=function(F){return F.imul((this||Gt).k)},h(C,B),C.prototype.split=function(F,H){for(var Y=Math.min(F.length,9),E=0;E<Y;E++)H.words[E]=F.words[E];if(H.length=Y,F.length<=9)return F.words[0]=0,F.length=1,void 0;var n=F.words[9];for(H.words[H.length++]=4194303&n,E=10;E<F.length;E++){var s=0|F.words[E];F.words[E-10]=(4194303&s)<<4|n>>>22,n=s}n>>>=22,F.words[E-10]=n,n===0&&F.length>10?F.length-=10:F.length-=9},C.prototype.imulK=function(F){F.words[F.length]=0,F.words[F.length+1]=0,F.length+=2;for(var H=0,Y=0;Y<F.length;Y++){var E=0|F.words[Y];H+=977*E,F.words[Y]=67108863&H,H=64*E+(H/67108864|0)}return F.words[F.length-1]===0&&(F.length--,F.words[F.length-1]===0&&F.length--),F},h(P,B),h(N,B),h(q,B),q.prototype.imulK=function(F){for(var H=0,Y=0;Y<F.length;Y++){var E=19*(0|F.words[Y])+H,n=67108863&E;E>>>=26,F.words[Y]=n,H=E}return H!==0&&(F.words[F.length++]=H),F},o._prime=function(F){if(R[F])return R[F];var H;if(F==="k256")H=new C;else if(F==="p224")H=new P;else if(F==="p192")H=new N;else{if(F!=="p25519")throw new Error("Unknown prime "+F);H=new q}return R[F]=H,H},W.prototype._verify1=function(F){r(F.negative===0,"red works only with positives"),r(F.red,"red works only with red numbers")},W.prototype._verify2=function(F,H){r((F.negative|H.negative)==0,"red works only with positives"),r(F.red&&F.red===H.red,"red works only with red numbers")},W.prototype.imod=function(F){return(this||Gt).prime?(this||Gt).prime.ireduce(F)._forceRed(this||Gt):F.umod((this||Gt).m)._forceRed(this||Gt)},W.prototype.neg=function(F){return F.isZero()?F.clone():(this||Gt).m.sub(F)._forceRed(this||Gt)},W.prototype.add=function(F,H){this._verify2(F,H);var Y=F.add(H);return Y.cmp((this||Gt).m)>=0&&Y.isub((this||Gt).m),Y._forceRed(this||Gt)},W.prototype.iadd=function(F,H){this._verify2(F,H);var Y=F.iadd(H);return Y.cmp((this||Gt).m)>=0&&Y.isub((this||Gt).m),Y},W.prototype.sub=function(F,H){this._verify2(F,H);var Y=F.sub(H);return Y.cmpn(0)<0&&Y.iadd((this||Gt).m),Y._forceRed(this||Gt)},W.prototype.isub=function(F,H){this._verify2(F,H);var Y=F.isub(H);return Y.cmpn(0)<0&&Y.iadd((this||Gt).m),Y},W.prototype.shl=function(F,H){return this._verify1(F),this.imod(F.ushln(H))},W.prototype.imul=function(F,H){return this._verify2(F,H),this.imod(F.imul(H))},W.prototype.mul=function(F,H){return this._verify2(F,H),this.imod(F.mul(H))},W.prototype.isqr=function(F){return this.imul(F,F.clone())},W.prototype.sqr=function(F){return this.mul(F,F)},W.prototype.sqrt=function(F){if(F.isZero())return F.clone();var H=(this||Gt).m.andln(3);if(r(H%2==1),H===3){var Y=(this||Gt).m.add(new o(1)).iushrn(2);return this.pow(F,Y)}for(var E=(this||Gt).m.subn(1),n=0;!E.isZero()&&E.andln(1)===0;)n++,E.iushrn(1);r(!E.isZero());var s=new o(1).toRed(this||Gt),f=s.redNeg(),d=(this||Gt).m.subn(1).iushrn(1),g=(this||Gt).m.bitLength();for(g=new o(2*g*g).toRed(this||Gt);this.pow(g,d).cmp(f)!==0;)g.redIAdd(f);for(var S=this.pow(g,E),x=this.pow(F,E.addn(1).iushrn(1)),a=this.pow(F,E),e=n;a.cmp(s)!==0;){for(var u=a,b=0;u.cmp(s)!==0;b++)u=u.redSqr();r(b<e);var _=this.pow(S,new o(1).iushln(e-b-1));x=x.redMul(_),S=_.redSqr(),a=a.redMul(S),e=b}return x},W.prototype.invm=function(F){var H=F._invmp((this||Gt).m);return H.negative!==0?(H.negative=0,this.imod(H).redNeg()):this.imod(H)},W.prototype.pow=function(F,H){if(H.isZero())return new o(1).toRed(this||Gt);if(H.cmpn(1)===0)return F.clone();var Y=new Array(16);Y[0]=new o(1).toRed(this||Gt),Y[1]=F;for(var E=2;E<Y.length;E++)Y[E]=this.mul(Y[E-1],F);var n=Y[0],s=0,f=0,d=H.bitLength()%26;for(d===0&&(d=26),E=H.length-1;E>=0;E--){for(var g=H.words[E],S=d-1;S>=0;S--){var x=g>>S&1;n!==Y[0]&&(n=this.sqr(n)),x!==0||s!==0?(s<<=1,s|=x,(++f===4||E===0&&S===0)&&(n=this.mul(n,Y[s]),f=0,s=0)):f=0}d=26}return n},W.prototype.convertTo=function(F){var H=F.umod((this||Gt).m);return H===F?H.clone():H},W.prototype.convertFrom=function(F){var H=F.clone();return H.red=null,H},o.mont=function(F){return new J(F)},h(J,W),J.prototype.convertTo=function(F){return this.imod(F.ushln((this||Gt).shift))},J.prototype.convertFrom=function(F){var H=this.imod(F.mul((this||Gt).rinv));return H.red=null,H},J.prototype.imul=function(F,H){if(F.isZero()||H.isZero())return F.words[0]=0,F.length=1,F;var Y=F.imul(H),E=Y.maskn((this||Gt).shift).mul((this||Gt).minv).imaskn((this||Gt).shift).mul((this||Gt).m),n=Y.isub(E).iushrn((this||Gt).shift),s=n;return n.cmp((this||Gt).m)>=0?s=n.isub((this||Gt).m):n.cmpn(0)<0&&(s=n.iadd((this||Gt).m)),s._forceRed(this||Gt)},J.prototype.mul=function(F,H){if(F.isZero()||H.isZero())return new o(0)._forceRed(this||Gt);var Y=F.mul(H),E=Y.maskn((this||Gt).shift).mul((this||Gt).minv).imaskn((this||Gt).shift).mul((this||Gt).m),n=Y.isub(E).iushrn((this||Gt).shift),s=n;return n.cmp((this||Gt).m)>=0?s=n.isub((this||Gt).m):n.cmpn(0)<0&&(s=n.iadd((this||Gt).m)),s._forceRed(this||Gt)},J.prototype.invm=function(F){return this.imod(F._invmp((this||Gt).m).mul((this||Gt).r2))._forceRed(this||Gt)}})(_X,wX);Hn=_X.exports,yvt=Object.freeze({}),r3=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;if((MX=function(i){return PS||(PS=new Mc(null)),PS.generate(i)}).Rand=Mc,Mc.prototype.generate=function(i){return this._rand(i)},Mc.prototype._rand=function(i){if((this||r3).rand.getBytes)return(this||r3).rand.getBytes(i);for(var t=new Uint8Array(i),r=0;r<t.length;r++)t[r]=(this||r3).rand.getByte();return t},typeof self=="object")self.crypto&&self.crypto.getRandomValues?Mc.prototype._rand=function(i){var t=new Uint8Array(i);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?Mc.prototype._rand=function(i){var t=new Uint8Array(i);return self.msCrypto.getRandomValues(t),t}:typeof window=="object"&&(Mc.prototype._rand=function(){throw new Error("Not implemented yet")});else try{if(NS=yvt,typeof NS.randomBytes!="function")throw new Error("Not supported");Mc.prototype._rand=function(i){return NS.randomBytes(i)}}catch(i){}ux=MX,EX=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,r0=Hn,bvt=ux;SX=i0,i0.create=function(i){return new i0(i)},i0.prototype._randbelow=function(i){var t=i.bitLength(),r=Math.ceil(t/8);do var h=new r0((this||EX).rand.generate(r));while(h.cmp(i)>=0);return h},i0.prototype._randrange=function(i,t){var r=t.sub(i);return i.add(this._randbelow(r))},i0.prototype.test=function(i,t,r){var h=i.bitLength(),o=r0.mont(i),l=new r0(1).toRed(o);t||(t=Math.max(1,h/48|0));for(var c=i.subn(1),p=0;!c.testn(p);p++);for(var w=i.shrn(p),m=c.toRed(o);t>0;t--){var y=this._randrange(new r0(2),c);r&&r(y);var v=y.toRed(o).redPow(w);if(v.cmp(l)!==0&&v.cmp(m)!==0){for(var M=1;M<p;M++){if((v=v.redSqr()).cmp(l)===0)return!1;if(v.cmp(m)===0)break}if(M===p)return!1}}return!0},i0.prototype.getDivisor=function(i,t){var r=i.bitLength(),h=r0.mont(i),o=new r0(1).toRed(h);t||(t=Math.max(1,r/48|0));for(var l=i.subn(1),c=0;!l.testn(c);c++);for(var p=i.shrn(c),w=l.toRed(h);t>0;t--){var m=this._randrange(new r0(2),l),y=i.gcd(m);if(y.cmpn(1)!==0)return y;var v=m.toRed(h).redPow(p);if(v.cmp(o)!==0&&v.cmp(w)!==0){for(var M=1;M<c;M++){if((v=v.redSqr()).cmp(o)===0)return v.fromRed().subn(1).gcd(i);if(v.cmp(w)===0)break}if(M===c)return(v=v.redSqr()).fromRed().subn(1).gcd(i)}}return!1};AX=SX,wvt=q1;TX=DS,DS.simpleSieve=CT,DS.fermatTest=PT;Ho=Hn,_vt=new Ho(24),RK=new AX,Mvt=new Ho(1),OT=new Ho(2),Svt=new Ho(5),Evt=(new Ho(16),new Ho(8),new Ho(10)),Avt=new Ho(3),Tvt=(new Ho(7),new Ho(11)),kK=new Ho(4),LS=(new Ho(12),null);RX=TX,Mi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Af=Cr.Buffer,Us=Hn,IK=new AX,Rvt=new Us(24),kvt=new Us(11),Ivt=new Us(10),Bvt=new Us(3),Ovt=new Us(7),BK=RX,Cvt=q1;xX=vu;pb={};Object.defineProperty(vu.prototype,"verifyError",{enumerable:!0,get:function(){return typeof(this||Mi)._primeCode!="number"&&((this||Mi)._primeCode=function(i,t){var r=t.toString("hex"),h=[r,i.toString(16)].join("_");if(h in pb)return pb[h];var o,l=0;if(i.isEven()||!BK.simpleSieve||!BK.fermatTest(i)||!IK.test(i))return l+=1,l+=r==="02"||r==="05"?8:4,pb[h]=l,l;switch(IK.test(i.shrn(1))||(l+=2),r){case"02":i.mod(Rvt).cmp(kvt)&&(l+=8);break;case"05":(o=i.mod(Ivt)).cmp(Bvt)&&o.cmp(Ovt)&&(l+=8);break;default:l+=4}return pb[h]=l,l}((this||Mi).__prime,(this||Mi).__gen)),(this||Mi)._primeCode}}),vu.prototype.generateKeys=function(){return(this||Mi)._priv||((this||Mi)._priv=new Us(Cvt((this||Mi)._primeLen))),(this||Mi)._pub=(this||Mi)._gen.toRed((this||Mi)._prime).redPow((this||Mi)._priv).fromRed(),this.getPublicKey()},vu.prototype.computeSecret=function(i){var t=(i=(i=new Us(i)).toRed((this||Mi)._prime)).redPow((this||Mi)._priv).fromRed(),r=new Af(t.toArray()),h=this.getPrime();if(r.length<h.length){var o=new Af(h.length-r.length);o.fill(0),r=Af.concat([o,r])}return r},vu.prototype.getPublicKey=function(i){return gb((this||Mi)._pub,i)},vu.prototype.getPrivateKey=function(i){return gb((this||Mi)._priv,i)},vu.prototype.getPrime=function(i){return gb((this||Mi).__prime,i)},vu.prototype.getGenerator=function(i){return gb((this||Mi)._gen,i)},vu.prototype.setGenerator=function(i,t){return t=t||"utf8",Af.isBuffer(i)||(i=new Af(i,t)),(this||Mi).__gen=i,(this||Mi)._gen=new Us(i),this||Mi};Lvt=xX,A1={},Sc=Cr.Buffer,Dvt=RX,OK={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}},$S=Lvt,$vt={binary:!0,hex:!0,base64:!0};A1.DiffieHellmanGroup=A1.createDiffieHellmanGroup=A1.getDiffieHellman=function(i){var t=new Sc(OK[i].prime,"hex"),r=new Sc(OK[i].gen,"hex");return new $S(t,r)},A1.createDiffieHellman=A1.DiffieHellman=function i(t,r,h,o){return Sc.isBuffer(r)||$vt[r]===void 0?i(t,"binary",r,h):(r=r||"binary",o=o||"binary",h=h||new Sc([2]),Sc.isBuffer(h)||(h=new Sc(h,o)),typeof t=="number"?new $S(Dvt(t,h),h,!0):(Sc.isBuffer(t)||(t=new Sc(t,r)),new $S(t,h,!0)))};Uvt=Cr.Buffer,zc=Hn,CK=q1;kX=PK,PK.getr=IX;cx=kX,lx={},mb=lx;mb.toArray=function(i,t){if(Array.isArray(i))return i.slice();if(!i)return[];var r=[];if(typeof i!="string"){for(var h=0;h<i.length;h++)r[h]=0|i[h];return r}if(t==="hex")for((i=i.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(i="0"+i),h=0;h<i.length;h+=2)r.push(parseInt(i[h]+i[h+1],16));else for(h=0;h<i.length;h++){var o=i.charCodeAt(h),l=o>>8,c=255&o;l?r.push(l,c):r.push(c)}return r},mb.zero2=BX,mb.toHex=NK,mb.encode=function(i,t){return t==="hex"?NK(i):i};ja={},Th=ja,qvt=Hn,Fvt=Fs,vb=lx;Th.assert=Fvt,Th.toArray=vb.toArray,Th.zero2=vb.zero2,Th.toHex=vb.toHex,Th.encode=vb.encode,Th.getNAF=function(i,t,r){var h=new Array(Math.max(i.bitLength(),r)+1);h.fill(0);for(var o=1<<t+1,l=i.clone(),c=0;c<h.length;c++){var p,w=l.andln(o-1);l.isOdd()?(p=w>(o>>1)-1?(o>>1)-w:w,l.isubn(p)):p=0,h[c]=p,l.iushrn(1)}return h},Th.getJSF=function(i,t){var r=[[],[]];i=i.clone(),t=t.clone();for(var h=0,o=0;i.cmpn(-h)>0||t.cmpn(-o)>0;){var l,c,p,w=i.andln(3)+h&3,m=t.andln(3)+o&3;w===3&&(w=-1),m===3&&(m=-1),(1&w)==0?l=0:l=(p=i.andln(7)+h&7)!==3&&p!==5||m!==2?w:-w,r[0].push(l),(1&m)==0?c=0:c=(p=t.andln(7)+o&7)!==3&&p!==5||w!==2?m:-m,r[1].push(c),2*h===l+1&&(h=1-h),2*o===c+1&&(o=1-o),i.iushrn(1),t.iushrn(1)}return r},Th.cachedProperty=function(i,t,r){var h="_"+t;i.prototype[t]=function(){return this[h]!==void 0?this[h]:this[h]=r.call(this)}},Th.parseBytes=function(i){return typeof i=="string"?Th.toArray(i,"hex"):i},Th.intFromLE=function(i){return new qvt(i,"hex","le")};c3=Hn,NT=ja,jvt=NT.assert;OX=i3,i3.prototype._importDER=function(i,t){i=NT.toArray(i,t);var r=new zvt;if(i[r.place++]!==48||US(i,r)+r.place!==i.length||i[r.place++]!==2)return!1;var h=US(i,r),o=i.slice(r.place,h+r.place);if(r.place+=h,i[r.place++]!==2)return!1;var l=US(i,r);if(i.length!==l+r.place)return!1;var c=i.slice(r.place,l+r.place);return o[0]===0&&128&o[1]&&(o=o.slice(1)),c[0]===0&&128&c[1]&&(c=c.slice(1)),this.r=new c3(o),this.s=new c3(c),this.recoveryParam=null,!0},i3.prototype.toDER=function(i){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=LK(t),r=LK(r);!(r[0]||128&r[1]);)r=r.slice(1);var h=[2];qS(h,t.length),(h=h.concat(t)).push(2),qS(h,r.length);var o=h.concat(r),l=[48];return qS(l,o.length),l=l.concat(o),NT.encode(l,i)};Wvt=OX,yi={},Kvt=Fs,Hvt=Fr;yi.inherits=Hvt,yi.toArray=function(i,t){if(Array.isArray(i))return i.slice();if(!i)return[];var r=[];if(typeof i=="string")if(t){if(t==="hex")for((i=i.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(i="0"+i),o=0;o<i.length;o+=2)r.push(parseInt(i[o]+i[o+1],16))}else for(var h=0,o=0;o<i.length;o++){var l=i.charCodeAt(o);l<128?r[h++]=l:l<2048?(r[h++]=l>>6|192,r[h++]=63&l|128):Gvt(i,o)?(l=65536+((1023&l)<<10)+(1023&i.charCodeAt(++o)),r[h++]=l>>18|240,r[h++]=l>>12&63|128,r[h++]=l>>6&63|128,r[h++]=63&l|128):(r[h++]=l>>12|224,r[h++]=l>>6&63|128,r[h++]=63&l|128)}else for(o=0;o<i.length;o++)r[o]=0|i[o];return r},yi.toHex=function(i){for(var t="",r=0;r<i.length;r++)t+=$K(i[r].toString(16));return t},yi.htonl=DK,yi.toHex32=function(i,t){for(var r="",h=0;h<i.length;h++){var o=i[h];t==="little"&&(o=DK(o)),r+=UK(o.toString(16))}return r},yi.zero2=$K,yi.zero8=UK,yi.join32=function(i,t,r,h){var o=r-t;Kvt(o%4==0);for(var l=new Array(o/4),c=0,p=t;c<l.length;c++,p+=4){var w;w=h==="big"?i[p]<<24|i[p+1]<<16|i[p+2]<<8|i[p+3]:i[p+3]<<24|i[p+2]<<16|i[p+1]<<8|i[p],l[c]=w>>>0}return l},yi.split32=function(i,t){for(var r=new Array(4*i.length),h=0,o=0;h<i.length;h++,o+=4){var l=i[h];t==="big"?(r[o]=l>>>24,r[o+1]=l>>>16&255,r[o+2]=l>>>8&255,r[o+3]=255&l):(r[o+3]=l>>>24,r[o+2]=l>>>16&255,r[o+1]=l>>>8&255,r[o]=255&l)}return r},yi.rotr32=function(i,t){return i>>>t|i<<32-t},yi.rotl32=function(i,t){return i<<t|i>>>32-t},yi.sum32=function(i,t){return i+t>>>0},yi.sum32_3=function(i,t,r){return i+t+r>>>0},yi.sum32_4=function(i,t,r,h){return i+t+r+h>>>0},yi.sum32_5=function(i,t,r,h,o){return i+t+r+h+o>>>0},yi.sum64=function(i,t,r,h){var o=i[t],l=h+i[t+1]>>>0,c=(l<h?1:0)+r+o;i[t]=c>>>0,i[t+1]=l},yi.sum64_hi=function(i,t,r,h){return(t+h>>>0<t?1:0)+i+r>>>0},yi.sum64_lo=function(i,t,r,h){return t+h>>>0},yi.sum64_4_hi=function(i,t,r,h,o,l,c,p){var w=0,m=t;return w+=(m=m+h>>>0)<t?1:0,w+=(m=m+l>>>0)<l?1:0,i+r+o+c+(w+=(m=m+p>>>0)<p?1:0)>>>0},yi.sum64_4_lo=function(i,t,r,h,o,l,c,p){return t+h+l+p>>>0},yi.sum64_5_hi=function(i,t,r,h,o,l,c,p,w,m){var y=0,v=t;return y+=(v=v+h>>>0)<t?1:0,y+=(v=v+l>>>0)<l?1:0,y+=(v=v+p>>>0)<p?1:0,i+r+o+c+w+(y+=(v=v+m>>>0)<m?1:0)>>>0},yi.sum64_5_lo=function(i,t,r,h,o,l,c,p,w,m){return t+h+l+p+m>>>0},yi.rotr64_hi=function(i,t,r){return(t<<32-r|i>>>r)>>>0},yi.rotr64_lo=function(i,t,r){return(i<<32-r|t>>>r)>>>0},yi.shr64_hi=function(i,t,r){return i>>>r},yi.shr64_lo=function(i,t,r){return(i<<32-r|t>>>r)>>>0};j1={},qK=yi,Vvt=Fs;j1.BlockHash=yb,yb.prototype.update=function(i,t){if(i=qK.toArray(i,t),this.pending?this.pending=this.pending.concat(i):this.pending=i,this.pendingTotal+=i.length,this.pending.length>=this._delta8){var r=(i=this.pending).length%this._delta8;this.pending=i.slice(i.length-r,i.length),this.pending.length===0&&(this.pending=null),i=qK.join32(i,0,i.length-r,this.endian);for(var h=0;h<i.length;h+=this._delta32)this._update(i,h,h+this._delta32)}return this},yb.prototype.digest=function(i){return this.update(this._pad()),Vvt(this.pending===null),this._digest(i)},yb.prototype._pad=function(){var i=this.pendingTotal,t=this._delta8,r=t-(i+this.padLength)%t,h=new Array(r+this.padLength);h[0]=128;for(var o=1;o<r;o++)h[o]=0;if(i<<=3,this.endian==="big"){for(var l=8;l<this.padLength;l++)h[o++]=0;h[o++]=0,h[o++]=0,h[o++]=0,h[o++]=0,h[o++]=i>>>24&255,h[o++]=i>>>16&255,h[o++]=i>>>8&255,h[o++]=255&i}else for(h[o++]=255&i,h[o++]=i>>>8&255,h[o++]=i>>>16&255,h[o++]=i>>>24&255,h[o++]=0,h[o++]=0,h[o++]=0,h[o++]=0,l=8;l<this.padLength;l++)h[o++]=0;return h};Ma=yi,Zvt=j1,Jvt=Fs,Tf=Ma.rotr64_hi,xf=Ma.rotr64_lo,PX=Ma.shr64_hi,NX=Ma.shr64_lo,Ec=Ma.sum64,FS=Ma.sum64_hi,jS=Ma.sum64_lo,Xvt=Ma.sum64_4_hi,Yvt=Ma.sum64_4_lo,Qvt=Ma.sum64_5_hi,tyt=Ma.sum64_5_lo,LX=Zvt.BlockHash,eyt=[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];Ma.inherits(Bh,LX),CX=Bh,Bh.blockSize=1024,Bh.outSize=512,Bh.hmacStrength=192,Bh.padLength=128,Bh.prototype._prepareBlock=function(i,t){for(var r=this.W,h=0;h<32;h++)r[h]=i[t+h];for(;h<r.length;h+=2){var o=lyt(r[h-4],r[h-3]),l=dyt(r[h-4],r[h-3]),c=r[h-14],p=r[h-13],w=uyt(r[h-30],r[h-29]),m=cyt(r[h-30],r[h-29]),y=r[h-32],v=r[h-31];r[h]=Xvt(o,l,c,p,w,m,y,v),r[h+1]=Yvt(o,l,c,p,w,m,y,v)}},Bh.prototype._update=function(i,t){this._prepareBlock(i,t);var r=this.W,h=this.h[0],o=this.h[1],l=this.h[2],c=this.h[3],p=this.h[4],w=this.h[5],m=this.h[6],y=this.h[7],v=this.h[8],M=this.h[9],T=this.h[10],A=this.h[11],R=this.h[12],B=this.h[13],C=this.h[14],P=this.h[15];Jvt(this.k.length===r.length);for(var N=0;N<r.length;N+=2){var q=C,W=P,J=hyt(v,M),F=fyt(v,M),H=ryt(v,M,T,A,R),Y=iyt(v,M,T,A,R,B),E=this.k[N],n=this.k[N+1],s=r[N],f=r[N+1],d=Qvt(q,W,J,F,H,Y,E,n,s,f),g=tyt(q,W,J,F,H,Y,E,n,s,f);q=ayt(h,o),W=syt(h,o),J=nyt(h,o,l,c,p),F=oyt(h,o,l,c,p,w);var S=FS(q,W,J,F),x=jS(q,W,J,F);C=R,P=B,R=T,B=A,T=v,A=M,v=FS(m,y,d,g),M=jS(y,y,d,g),m=p,y=w,p=l,w=c,l=h,c=o,h=FS(d,g,S,x),o=jS(d,g,S,x)}Ec(this.h,0,h,o),Ec(this.h,2,l,c),Ec(this.h,4,p,w),Ec(this.h,6,m,y),Ec(this.h,8,v,M),Ec(this.h,10,T,A),Ec(this.h,12,R,B),Ec(this.h,14,C,P)},Bh.prototype._digest=function(i){return i==="hex"?Ma.toHex32(this.h,"big"):Ma.split32(this.h,"big")};DX=CX,wf={},mf=yi.rotr32;wf.ft_1=function(i,t,r,h){return i===0?FK(t,r,h):i===1||i===3?zK(t,r,h):i===2?jK(t,r,h):void 0},wf.ch32=FK,wf.maj32=jK,wf.p32=zK,wf.s0_256=function(i){return mf(i,2)^mf(i,13)^mf(i,22)},wf.s1_256=function(i){return mf(i,6)^mf(i,11)^mf(i,25)},wf.g0_256=function(i){return mf(i,7)^mf(i,18)^i>>>3},wf.g1_256=function(i){return mf(i,17)^mf(i,19)^i>>>10};I1=yi,pyt=j1,z1=wf,gyt=Fs,xh=I1.sum32,myt=I1.sum32_4,vyt=I1.sum32_5,yyt=z1.ch32,byt=z1.maj32,wyt=z1.s0_256,_yt=z1.s1_256,Myt=z1.g0_256,Syt=z1.g1_256,UX=pyt.BlockHash,Eyt=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];I1.inherits(_f,UX),$X=_f,_f.blockSize=512,_f.outSize=256,_f.hmacStrength=192,_f.padLength=64,_f.prototype._update=function(i,t){for(var r=this.W,h=0;h<16;h++)r[h]=i[t+h];for(;h<r.length;h++)r[h]=myt(Syt(r[h-2]),r[h-7],Myt(r[h-15]),r[h-16]);var o=this.h[0],l=this.h[1],c=this.h[2],p=this.h[3],w=this.h[4],m=this.h[5],y=this.h[6],v=this.h[7];for(gyt(this.k.length===r.length),h=0;h<r.length;h++){var M=vyt(v,_yt(w),yyt(w,m,y),this.k[h],r[h]),T=xh(wyt(o),byt(o,l,c));v=y,y=m,m=w,w=xh(p,M),p=c,c=l,l=o,o=xh(M,T)}this.h[0]=xh(this.h[0],o),this.h[1]=xh(this.h[1],l),this.h[2]=xh(this.h[2],c),this.h[3]=xh(this.h[3],p),this.h[4]=xh(this.h[4],w),this.h[5]=xh(this.h[5],m),this.h[6]=xh(this.h[6],y),this.h[7]=xh(this.h[7],v)},_f.prototype._digest=function(i){return i==="hex"?I1.toHex32(this.h,"big"):I1.split32(this.h,"big")};qX=$X,B1=yi,Ayt=j1,Tyt=wf,zS=B1.rotl32,Q2=B1.sum32,xyt=B1.sum32_5,Ryt=Tyt.ft_1,jX=Ayt.BlockHash,kyt=[1518500249,1859775393,2400959708,3395469782];B1.inherits(Mf,jX),FX=Mf,Mf.blockSize=512,Mf.outSize=160,Mf.hmacStrength=80,Mf.padLength=64,Mf.prototype._update=function(i,t){for(var r=this.W,h=0;h<16;h++)r[h]=i[t+h];for(;h<r.length;h++)r[h]=zS(r[h-3]^r[h-8]^r[h-14]^r[h-16],1);var o=this.h[0],l=this.h[1],c=this.h[2],p=this.h[3],w=this.h[4];for(h=0;h<r.length;h++){var m=~~(h/20),y=xyt(zS(o,5),Ryt(m,l,c,p),w,r[h],kyt[m]);w=p,p=c,c=zS(l,30),l=o,o=y}this.h[0]=Q2(this.h[0],o),this.h[1]=Q2(this.h[1],l),this.h[2]=Q2(this.h[2],c),this.h[3]=Q2(this.h[3],p),this.h[4]=Q2(this.h[4],w)},Mf.prototype._digest=function(i){return i==="hex"?B1.toHex32(this.h,"big"):B1.split32(this.h,"big")};Iyt=FX,WS=yi,WX=qX;WS.inherits(bu,WX),zX=bu,bu.blockSize=512,bu.outSize=224,bu.hmacStrength=192,bu.padLength=64,bu.prototype._digest=function(i){return i==="hex"?WS.toHex32(this.h.slice(0,7),"big"):WS.split32(this.h.slice(0,7),"big")};Byt=zX,KS=yi,HX=DX;KS.inherits(wu,HX),KX=wu,wu.blockSize=1024,wu.outSize=384,wu.hmacStrength=192,wu.padLength=128,wu.prototype._digest=function(i){return i==="hex"?KS.toHex32(this.h.slice(0,12),"big"):KS.split32(this.h.slice(0,12),"big")};Oyt=KX,T1={};T1.sha1=Iyt,T1.sha224=Byt,T1.sha256=qX,T1.sha384=Oyt,T1.sha512=DX;GX={},E0=yi,Cyt=j1,bb=E0.rotl32,WK=E0.sum32,tg=E0.sum32_3,KK=E0.sum32_4,VX=Cyt.BlockHash;E0.inherits(Sf,VX),GX.ripemd160=Sf,Sf.blockSize=512,Sf.outSize=160,Sf.hmacStrength=192,Sf.padLength=64,Sf.prototype._update=function(i,t){for(var r=this.h[0],h=this.h[1],o=this.h[2],l=this.h[3],c=this.h[4],p=r,w=h,m=o,y=l,v=c,M=0;M<80;M++){var T=WK(bb(KK(r,HK(M,h,o,l),i[Lyt[M]+t],Pyt(M)),$yt[M]),c);r=c,c=l,l=bb(o,10),o=h,h=T,T=WK(bb(KK(p,HK(79-M,w,m,y),i[Dyt[M]+t],Nyt(M)),Uyt[M]),v),p=v,v=y,y=bb(m,10),m=w,w=T}T=tg(this.h[1],o,y),this.h[1]=tg(this.h[2],l,v),this.h[2]=tg(this.h[3],c,p),this.h[3]=tg(this.h[4],r,w),this.h[4]=tg(this.h[0],h,m),this.h[0]=T},Sf.prototype._digest=function(i){return i==="hex"?E0.toHex32(this.h,"little"):E0.split32(this.h,"little")};Lyt=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Dyt=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],$yt=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Uyt=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],qyt=yi,Fyt=Fs;ZX=x1,x1.prototype._init=function(i){i.length>this.blockSize&&(i=new this.Hash().update(i).digest()),Fyt(i.length<=this.blockSize);for(var t=i.length;t<this.blockSize;t++)i.push(0);for(t=0;t<i.length;t++)i[t]^=54;for(this.inner=new this.Hash().update(i),t=0;t<i.length;t++)i[t]^=106;this.outer=new this.Hash().update(i)},x1.prototype.update=function(i,t){return this.inner.update(i,t),this},x1.prototype.digest=function(i){return this.outer.update(this.inner.digest()),this.outer.digest(i)};jyt=ZX,T3={},To=T3;To.utils=yi,To.common=j1,To.sha=T1,To.ripemd=GX,To.hmac=jyt,To.sha1=To.sha.sha1,To.sha256=To.sha.sha256,To.sha224=To.sha.sha224,To.sha384=To.sha.sha384,To.sha512=To.sha.sha512,To.ripemd160=To.ripemd.ripemd160;zyt=T3,M0=lx,XX=Fs;JX=Wc,Wc.prototype._init=function(i,t,r){var h=i.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o<this.V.length;o++)this.K[o]=0,this.V[o]=1;this._update(h),this._reseed=1,this.reseedInterval=281474976710656},Wc.prototype._hmac=function(){return new zyt.hmac(this.hash,this.K)},Wc.prototype._update=function(i){var t=this._hmac().update(this.V).update([0]);i&&(t=t.update(i)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),i&&(this.K=this._hmac().update(this.V).update([1]).update(i).digest(),this.V=this._hmac().update(this.V).digest())},Wc.prototype.reseed=function(i,t,r,h){typeof t!="string"&&(h=r,r=t,t=null),i=M0.toArray(i,t),r=M0.toArray(r,h),XX(i.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(i.concat(r||[])),this._reseed=1},Wc.prototype.generate=function(i,t,r,h){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(h=r,r=t,t=null),r&&(r=M0.toArray(r,h||"hex"),this._update(r));for(var o=[];o.length<i;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var l=o.slice(0,i);return this._update(r),this._reseed++,M0.encode(l,t)};Wyt=JX,n0=Hn,Rg=ja,wb=Rg.getNAF,Kyt=Rg.getJSF,_b=Rg.assert;YX=Ac,Ac.prototype.point=function(){throw new Error("Not implemented")},Ac.prototype.validate=function(){throw new Error("Not implemented")},Ac.prototype._fixedNafMul=function(i,t){_b(i.precomputed);var r=i._getDoubles(),h=wb(t,1,this._bitLength),o=(1<<r.step+1)-(r.step%2==0?2:1);o/=3;for(var l=[],c=0;c<h.length;c+=r.step){var p=0;for(t=c+r.step-1;t>=c;t--)p=(p<<1)+h[t];l.push(p)}for(var w=this.jpoint(null,null,null),m=this.jpoint(null,null,null),y=o;y>0;y--){for(c=0;c<l.length;c++)(p=l[c])===y?m=m.mixedAdd(r.points[c]):p===-y&&(m=m.mixedAdd(r.points[c].neg()));w=w.add(m)}return w.toP()},Ac.prototype._wnafMul=function(i,t){var r=4,h=i._getNAFPoints(r);r=h.wnd;for(var o=h.points,l=wb(t,r,this._bitLength),c=this.jpoint(null,null,null),p=l.length-1;p>=0;p--){for(t=0;p>=0&&l[p]===0;p--)t++;if(p>=0&&t++,c=c.dblp(t),p<0)break;var w=l[p];_b(w!==0),c=i.type==="affine"?w>0?c.mixedAdd(o[w-1>>1]):c.mixedAdd(o[-w-1>>1].neg()):w>0?c.add(o[w-1>>1]):c.add(o[-w-1>>1].neg())}return i.type==="affine"?c.toP():c},Ac.prototype._wnafMulAdd=function(i,t,r,h,o){for(var l=this._wnafT1,c=this._wnafT2,p=this._wnafT3,w=0,m=0;m<h;m++){var y=(F=t[m])._getNAFPoints(i);l[m]=y.wnd,c[m]=y.points}for(m=h-1;m>=1;m-=2){var v=m-1,M=m;if(l[v]===1&&l[M]===1){var T=[t[v],null,null,t[M]];t[v].y.cmp(t[M].y)===0?(T[1]=t[v].add(t[M]),T[2]=t[v].toJ().mixedAdd(t[M].neg())):t[v].y.cmp(t[M].y.redNeg())===0?(T[1]=t[v].toJ().mixedAdd(t[M]),T[2]=t[v].add(t[M].neg())):(T[1]=t[v].toJ().mixedAdd(t[M]),T[2]=t[v].toJ().mixedAdd(t[M].neg()));var A=[-3,-1,-5,-7,0,7,5,1,3],R=Kyt(r[v],r[M]);w=Math.max(R[0].length,w),p[v]=new Array(w),p[M]=new Array(w);for(var B=0;B<w;B++){var C=0|R[0][B],P=0|R[1][B];p[v][B]=A[3*(C+1)+(P+1)],p[M][B]=0,c[v]=T}}else p[v]=wb(r[v],l[v],this._bitLength),p[M]=wb(r[M],l[M],this._bitLength),w=Math.max(p[v].length,w),w=Math.max(p[M].length,w)}var N=this.jpoint(null,null,null),q=this._wnafT4;for(m=w;m>=0;m--){for(var W=0;m>=0;){var J=!0;for(B=0;B<h;B++)q[B]=0|p[B][m],q[B]!==0&&(J=!1);if(!J)break;W++,m--}if(m>=0&&W++,N=N.dblp(W),m<0)break;for(B=0;B<h;B++){var F,H=q[B];H!==0&&(H>0?F=c[B][H-1>>1]:H<0&&(F=c[B][-H-1>>1].neg()),N=F.type==="affine"?N.mixedAdd(F):N.add(F))}}for(m=0;m<h;m++)c[m]=null;return o?N:N.toP()},Ac.BasePoint=Bs,Bs.prototype.eq=function(){throw new Error("Not implemented")},Bs.prototype.validate=function(){return this.curve.validate(this)},Ac.prototype.decodePoint=function(i,t){i=Rg.toArray(i,t);var r=this.p.byteLength();if((i[0]===4||i[0]===6||i[0]===7)&&i.length-1==2*r)return i[0]===6?_b(i[i.length-1]%2==0):i[0]===7&&_b(i[i.length-1]%2==1),this.point(i.slice(1,1+r),i.slice(1+r,1+2*r));if((i[0]===2||i[0]===3)&&i.length-1===r)return this.pointFromX(i.slice(1,1+r),i[0]===3);throw new Error("Unknown point format")},Bs.prototype.encodeCompressed=function(i){return this.encode(i,!0)},Bs.prototype._encode=function(i){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return i?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},Bs.prototype.encode=function(i,t){return Rg.encode(this._encode(t),i)},Bs.prototype.precompute=function(i){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,i),t.beta=this._getBeta(),this.precomputed=t,this},Bs.prototype._hasDoubles=function(i){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((i.bitLength()+1)/t.step)},Bs.prototype._getDoubles=function(i,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],h=this,o=0;o<t;o+=i){for(var l=0;l<i;l++)h=h.dbl();r.push(h)}return{step:i,points:r}},Bs.prototype._getNAFPoints=function(i){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<i)-1,h=r===1?null:this.dbl(),o=1;o<r;o++)t[o]=t[o-1].add(h);return{wnd:i,points:t}},Bs.prototype._getBeta=function(){return null},Bs.prototype.dblp=function(i){for(var t=this,r=0;r<i;r++)t=t.dbl();return t};x3=YX,In=Hn,HS=Fr,O1=x3,Hyt=ja.assert;HS(Os,O1),QX=Os,Os.prototype._getEndomorphism=function(i){if(this.zeroA&&this.g&&this.n&&this.p.modn(3)===1){var t,r;if(i.beta)t=new In(i.beta,16).toRed(this.red);else{var h=this._getEndoRoots(this.p);t=(t=h[0].cmp(h[1])<0?h[0]:h[1]).toRed(this.red)}if(i.lambda)r=new In(i.lambda,16);else{var o=this._getEndoRoots(this.n);this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))===0?r=o[0]:(r=o[1],Hyt(this.g.mul(r).x.cmp(this.g.x.redMul(t))===0))}return{beta:t,lambda:r,basis:i.basis?i.basis.map(function(l){return{a:new In(l.a,16),b:new In(l.b,16)}}):this._getEndoBasis(r)}}},Os.prototype._getEndoRoots=function(i){var t=i===this.p?this.red:In.mont(i),r=new In(2).toRed(t).redInvm(),h=r.redNeg(),o=new In(3).toRed(t).redNeg().redSqrt().redMul(r);return[h.redAdd(o).fromRed(),h.redSub(o).fromRed()]},Os.prototype._getEndoBasis=function(i){for(var t,r,h,o,l,c,p,w,m,y=this.n.ushrn(Math.floor(this.n.bitLength()/2)),v=i,M=this.n.clone(),T=new In(1),A=new In(0),R=new In(0),B=new In(1),C=0;v.cmpn(0)!==0;){var P=M.div(v);w=M.sub(P.mul(v)),m=R.sub(P.mul(T));var N=B.sub(P.mul(A));if(!h&&w.cmp(y)<0)t=p.neg(),r=T,h=w.neg(),o=m;else if(h&&++C==2)break;p=w,M=v,v=w,R=T,T=m,B=A,A=N}l=w.neg(),c=m;var q=h.sqr().add(o.sqr());return l.sqr().add(c.sqr()).cmp(q)>=0&&(l=t,c=r),h.negative&&(h=h.neg(),o=o.neg()),l.negative&&(l=l.neg(),c=c.neg()),[{a:h,b:o},{a:l,b:c}]},Os.prototype._endoSplit=function(i){var t=this.endo.basis,r=t[0],h=t[1],o=h.b.mul(i).divRound(this.n),l=r.b.neg().mul(i).divRound(this.n),c=o.mul(r.a),p=l.mul(h.a),w=o.mul(r.b),m=l.mul(h.b);return{k1:i.sub(c).sub(p),k2:w.add(m).neg()}},Os.prototype.pointFromX=function(i,t){(i=new In(i,16)).red||(i=i.toRed(this.red));var r=i.redSqr().redMul(i).redIAdd(i.redMul(this.a)).redIAdd(this.b),h=r.redSqrt();if(h.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var o=h.fromRed().isOdd();return(t&&!o||!t&&o)&&(h=h.redNeg()),this.point(i,h)},Os.prototype.validate=function(i){if(i.inf)return!0;var t=i.x,r=i.y,h=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(h).redIAdd(this.b);return r.redSqr().redISub(o).cmpn(0)===0},Os.prototype._endoWnafMulAdd=function(i,t,r){for(var h=this._endoWnafT1,o=this._endoWnafT2,l=0;l<i.length;l++){var c=this._endoSplit(t[l]),p=i[l],w=p._getBeta();c.k1.negative&&(c.k1.ineg(),p=p.neg(!0)),c.k2.negative&&(c.k2.ineg(),w=w.neg(!0)),h[2*l]=p,h[2*l+1]=w,o[2*l]=c.k1,o[2*l+1]=c.k2}for(var m=this._wnafMulAdd(1,h,o,2*l,r),y=0;y<2*l;y++)h[y]=null,o[y]=null;return m},HS(mo,O1.BasePoint),Os.prototype.point=function(i,t,r){return new mo(this,i,t,r)},Os.prototype.pointFromJSON=function(i,t){return mo.fromJSON(this,i,t)},mo.prototype._getBeta=function(){if(this.curve.endo){var i=this.precomputed;if(i&&i.beta)return i.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(i){var r=this.curve,h=function(o){return r.point(o.x.redMul(r.endo.beta),o.y)};i.beta=t,t.precomputed={beta:null,naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(h)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(h)}}}return t}},mo.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},mo.fromJSON=function(i,t,r){typeof t=="string"&&(t=JSON.parse(t));var h=i.point(t[0],t[1],r);if(!t[2])return h;function o(c){return i.point(c[0],c[1],r)}var l=t[2];return h.precomputed={beta:null,doubles:l.doubles&&{step:l.doubles.step,points:[h].concat(l.doubles.points.map(o))},naf:l.naf&&{wnd:l.naf.wnd,points:[h].concat(l.naf.points.map(o))}},h},mo.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},mo.prototype.isInfinity=function(){return this.inf},mo.prototype.add=function(i){if(this.inf)return i;if(i.inf)return this;if(this.eq(i))return this.dbl();if(this.neg().eq(i))return this.curve.point(null,null);if(this.x.cmp(i.x)===0)return this.curve.point(null,null);var t=this.y.redSub(i.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(i.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(i.x),h=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,h)},mo.prototype.dbl=function(){if(this.inf)return this;var i=this.y.redAdd(this.y);if(i.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),h=i.redInvm(),o=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(h),l=o.redSqr().redISub(this.x.redAdd(this.x)),c=o.redMul(this.x.redSub(l)).redISub(this.y);return this.curve.point(l,c)},mo.prototype.getX=function(){return this.x.fromRed()},mo.prototype.getY=function(){return this.y.fromRed()},mo.prototype.mul=function(i){return i=new In(i,16),this.isInfinity()?this:this._hasDoubles(i)?this.curve._fixedNafMul(this,i):this.curve.endo?this.curve._endoWnafMulAdd([this],[i]):this.curve._wnafMul(this,i)},mo.prototype.mulAdd=function(i,t,r){var h=[this,t],o=[i,r];return this.curve.endo?this.curve._endoWnafMulAdd(h,o):this.curve._wnafMulAdd(1,h,o,2)},mo.prototype.jmulAdd=function(i,t,r){var h=[this,t],o=[i,r];return this.curve.endo?this.curve._endoWnafMulAdd(h,o,!0):this.curve._wnafMulAdd(1,h,o,2,!0)},mo.prototype.eq=function(i){return this===i||this.inf===i.inf&&(this.inf||this.x.cmp(i.x)===0&&this.y.cmp(i.y)===0)},mo.prototype.neg=function(i){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(i&&this.precomputed){var r=this.precomputed,h=function(o){return o.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(h)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(h)}}}return t},mo.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},HS(xo,O1.BasePoint),Os.prototype.jpoint=function(i,t,r){return new xo(this,i,t,r)},xo.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var i=this.z.redInvm(),t=i.redSqr(),r=this.x.redMul(t),h=this.y.redMul(t).redMul(i);return this.curve.point(r,h)},xo.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},xo.prototype.add=function(i){if(this.isInfinity())return i;if(i.isInfinity())return this;var t=i.z.redSqr(),r=this.z.redSqr(),h=this.x.redMul(t),o=i.x.redMul(r),l=this.y.redMul(t.redMul(i.z)),c=i.y.redMul(r.redMul(this.z)),p=h.redSub(o),w=l.redSub(c);if(p.cmpn(0)===0)return w.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var m=p.redSqr(),y=m.redMul(p),v=h.redMul(m),M=w.redSqr().redIAdd(y).redISub(v).redISub(v),T=w.redMul(v.redISub(M)).redISub(l.redMul(y)),A=this.z.redMul(i.z).redMul(p);return this.curve.jpoint(M,T,A)},xo.prototype.mixedAdd=function(i){if(this.isInfinity())return i.toJ();if(i.isInfinity())return this;var t=this.z.redSqr(),r=this.x,h=i.x.redMul(t),o=this.y,l=i.y.redMul(t).redMul(this.z),c=r.redSub(h),p=o.redSub(l);if(c.cmpn(0)===0)return p.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var w=c.redSqr(),m=w.redMul(c),y=r.redMul(w),v=p.redSqr().redIAdd(m).redISub(y).redISub(y),M=p.redMul(y.redISub(v)).redISub(o.redMul(m)),T=this.z.redMul(c);return this.curve.jpoint(v,M,T)},xo.prototype.dblp=function(i){if(i===0)return this;if(this.isInfinity())return this;if(!i)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r<i;r++)t=t.dbl();return t}var h=this.curve.a,o=this.curve.tinv,l=this.x,c=this.y,p=this.z,w=p.redSqr().redSqr(),m=c.redAdd(c);for(r=0;r<i;r++){var y=l.redSqr(),v=m.redSqr(),M=v.redSqr(),T=y.redAdd(y).redIAdd(y).redIAdd(h.redMul(w)),A=l.redMul(v),R=T.redSqr().redISub(A.redAdd(A)),B=A.redISub(R),C=T.redMul(B);C=C.redIAdd(C).redISub(M);var P=m.redMul(p);r+1<i&&(w=w.redMul(M)),l=R,p=P,m=C}return this.curve.jpoint(l,m.redMul(o),p)},xo.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},xo.prototype._zeroDbl=function(){var i,t,r;if(this.zOne){var h=this.x.redSqr(),o=this.y.redSqr(),l=o.redSqr(),c=this.x.redAdd(o).redSqr().redISub(h).redISub(l);c=c.redIAdd(c);var p=h.redAdd(h).redIAdd(h),w=p.redSqr().redISub(c).redISub(c),m=l.redIAdd(l);m=(m=m.redIAdd(m)).redIAdd(m),i=w,t=p.redMul(c.redISub(w)).redISub(m),r=this.y.redAdd(this.y)}else{var y=this.x.redSqr(),v=this.y.redSqr(),M=v.redSqr(),T=this.x.redAdd(v).redSqr().redISub(y).redISub(M);T=T.redIAdd(T);var A=y.redAdd(y).redIAdd(y),R=A.redSqr(),B=M.redIAdd(M);B=(B=B.redIAdd(B)).redIAdd(B),i=R.redISub(T).redISub(T),t=A.redMul(T.redISub(i)).redISub(B),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(i,t,r)},xo.prototype._threeDbl=function(){var i,t,r;if(this.zOne){var h=this.x.redSqr(),o=this.y.redSqr(),l=o.redSqr(),c=this.x.redAdd(o).redSqr().redISub(h).redISub(l);c=c.redIAdd(c);var p=h.redAdd(h).redIAdd(h).redIAdd(this.curve.a),w=p.redSqr().redISub(c).redISub(c);i=w;var m=l.redIAdd(l);m=(m=m.redIAdd(m)).redIAdd(m),t=p.redMul(c.redISub(w)).redISub(m),r=this.y.redAdd(this.y)}else{var y=this.z.redSqr(),v=this.y.redSqr(),M=this.x.redMul(v),T=this.x.redSub(y).redMul(this.x.redAdd(y));T=T.redAdd(T).redIAdd(T);var A=M.redIAdd(M),R=(A=A.redIAdd(A)).redAdd(A);i=T.redSqr().redISub(R),r=this.y.redAdd(this.z).redSqr().redISub(v).redISub(y);var B=v.redSqr();B=(B=(B=B.redIAdd(B)).redIAdd(B)).redIAdd(B),t=T.redMul(A.redISub(i)).redISub(B)}return this.curve.jpoint(i,t,r)},xo.prototype._dbl=function(){var i=this.curve.a,t=this.x,r=this.y,h=this.z,o=h.redSqr().redSqr(),l=t.redSqr(),c=r.redSqr(),p=l.redAdd(l).redIAdd(l).redIAdd(i.redMul(o)),w=t.redAdd(t),m=(w=w.redIAdd(w)).redMul(c),y=p.redSqr().redISub(m.redAdd(m)),v=m.redISub(y),M=c.redSqr();M=(M=(M=M.redIAdd(M)).redIAdd(M)).redIAdd(M);var T=p.redMul(v).redISub(M),A=r.redAdd(r).redMul(h);return this.curve.jpoint(y,T,A)},xo.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var i=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),h=t.redSqr(),o=i.redAdd(i).redIAdd(i),l=o.redSqr(),c=this.x.redAdd(t).redSqr().redISub(i).redISub(h),p=(c=(c=(c=c.redIAdd(c)).redAdd(c).redIAdd(c)).redISub(l)).redSqr(),w=h.redIAdd(h);w=(w=(w=w.redIAdd(w)).redIAdd(w)).redIAdd(w);var m=o.redIAdd(c).redSqr().redISub(l).redISub(p).redISub(w),y=t.redMul(m);y=(y=y.redIAdd(y)).redIAdd(y);var v=this.x.redMul(p).redISub(y);v=(v=v.redIAdd(v)).redIAdd(v);var M=this.y.redMul(m.redMul(w.redISub(m)).redISub(c.redMul(p)));M=(M=(M=M.redIAdd(M)).redIAdd(M)).redIAdd(M);var T=this.z.redAdd(c).redSqr().redISub(r).redISub(p);return this.curve.jpoint(v,M,T)},xo.prototype.mul=function(i,t){return i=new In(i,t),this.curve._wnafMul(this,i)},xo.prototype.eq=function(i){if(i.type==="affine")return this.eq(i.toJ());if(this===i)return!0;var t=this.z.redSqr(),r=i.z.redSqr();if(this.x.redMul(r).redISub(i.x.redMul(t)).cmpn(0)!==0)return!1;var h=t.redMul(this.z),o=r.redMul(i.z);return this.y.redMul(o).redISub(i.y.redMul(h)).cmpn(0)===0},xo.prototype.eqXToP=function(i){var t=this.z.redSqr(),r=i.toRed(this.curve.red).redMul(t);if(this.x.cmp(r)===0)return!0;for(var h=i.clone(),o=this.curve.redN.redMul(t);;){if(h.iadd(this.curve.n),h.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(o),this.x.cmp(r)===0)return!0}},xo.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},xo.prototype.isInfinity=function(){return this.z.cmpn(0)===0};Gyt=QX,R1=Hn,GK=Fr,l3=x3,Vyt=ja;GK(y1,l3),tY=y1,y1.prototype.validate=function(i){var t=i.normalize().x,r=t.redSqr(),h=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return h.redSqrt().redSqr().cmp(h)===0},GK(vo,l3.BasePoint),y1.prototype.decodePoint=function(i,t){return this.point(Vyt.toArray(i,t),1)},y1.prototype.point=function(i,t){return new vo(this,i,t)},y1.prototype.pointFromJSON=function(i){return vo.fromJSON(this,i)},vo.prototype.precompute=function(){},vo.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},vo.fromJSON=function(i,t){return new vo(i,t[0],t[1]||i.one)},vo.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},vo.prototype.isInfinity=function(){return this.z.cmpn(0)===0},vo.prototype.dbl=function(){var i=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=i.redSub(t),h=i.redMul(t),o=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(h,o)},vo.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},vo.prototype.diffAdd=function(i,t){var r=this.x.redAdd(this.z),h=this.x.redSub(this.z),o=i.x.redAdd(i.z),l=i.x.redSub(i.z).redMul(r),c=o.redMul(h),p=t.z.redMul(l.redAdd(c).redSqr()),w=t.x.redMul(l.redISub(c).redSqr());return this.curve.point(p,w)},vo.prototype.mul=function(i){for(var t=i.clone(),r=this,h=this.curve.point(null,null),o=[];t.cmpn(0)!==0;t.iushrn(1))o.push(t.andln(1));for(var l=o.length-1;l>=0;l--)o[l]===0?(r=r.diffAdd(h,this),h=h.dbl()):(h=r.diffAdd(h,this),r=r.dbl());return h},vo.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},vo.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},vo.prototype.eq=function(i){return this.getX().cmp(i.getX())===0},vo.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},vo.prototype.getX=function(){return this.normalize(),this.x.fromRed()};Zyt=tY,Su=Hn,VK=Fr,d3=x3,Jyt=ja.assert;VK(vf,d3),eY=vf,vf.prototype._mulA=function(i){return this.mOneA?i.redNeg():this.a.redMul(i)},vf.prototype._mulC=function(i){return this.oneC?i:this.c.redMul(i)},vf.prototype.jpoint=function(i,t,r,h){return this.point(i,t,r,h)},vf.prototype.pointFromX=function(i,t){(i=new Su(i,16)).red||(i=i.toRed(this.red));var r=i.redSqr(),h=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),l=h.redMul(o.redInvm()),c=l.redSqrt();if(c.redSqr().redSub(l).cmp(this.zero)!==0)throw new Error("invalid point");var p=c.fromRed().isOdd();return(t&&!p||!t&&p)&&(c=c.redNeg()),this.point(i,c)},vf.prototype.pointFromY=function(i,t){(i=new Su(i,16)).red||(i=i.toRed(this.red));var r=i.redSqr(),h=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),l=h.redMul(o.redInvm());if(l.cmp(this.zero)===0){if(t)throw new Error("invalid point");return this.point(this.zero,i)}var c=l.redSqrt();if(c.redSqr().redSub(l).cmp(this.zero)!==0)throw new Error("invalid point");return c.fromRed().isOdd()!==t&&(c=c.redNeg()),this.point(c,i)},vf.prototype.validate=function(i){if(i.isInfinity())return!0;i.normalize();var t=i.x.redSqr(),r=i.y.redSqr(),h=t.redMul(this.a).redAdd(r),o=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return h.cmp(o)===0},VK(un,d3.BasePoint),vf.prototype.pointFromJSON=function(i){return un.fromJSON(this,i)},vf.prototype.point=function(i,t,r,h){return new un(this,i,t,r,h)},un.fromJSON=function(i,t){return new un(i,t[0],t[1],t[2])},un.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},un.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},un.prototype._extDbl=function(){var i=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var h=this.curve._mulA(i),o=this.x.redAdd(this.y).redSqr().redISub(i).redISub(t),l=h.redAdd(t),c=l.redSub(r),p=h.redSub(t),w=o.redMul(c),m=l.redMul(p),y=o.redMul(p),v=c.redMul(l);return this.curve.point(w,m,v,y)},un.prototype._projDbl=function(){var i,t,r,h=this.x.redAdd(this.y).redSqr(),o=this.x.redSqr(),l=this.y.redSqr();if(this.curve.twisted){var c=(m=this.curve._mulA(o)).redAdd(l);if(this.zOne)i=h.redSub(o).redSub(l).redMul(c.redSub(this.curve.two)),t=c.redMul(m.redSub(l)),r=c.redSqr().redSub(c).redSub(c);else{var p=this.z.redSqr(),w=c.redSub(p).redISub(p);i=h.redSub(o).redISub(l).redMul(w),t=c.redMul(m.redSub(l)),r=c.redMul(w)}}else{var m=o.redAdd(l);p=this.curve._mulC(this.z).redSqr(),w=m.redSub(p).redSub(p),i=this.curve._mulC(h.redISub(m)).redMul(w),t=this.curve._mulC(m).redMul(o.redISub(l)),r=m.redMul(w)}return this.curve.point(i,t,r)},un.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},un.prototype._extAdd=function(i){var t=this.y.redSub(this.x).redMul(i.y.redSub(i.x)),r=this.y.redAdd(this.x).redMul(i.y.redAdd(i.x)),h=this.t.redMul(this.curve.dd).redMul(i.t),o=this.z.redMul(i.z.redAdd(i.z)),l=r.redSub(t),c=o.redSub(h),p=o.redAdd(h),w=r.redAdd(t),m=l.redMul(c),y=p.redMul(w),v=l.redMul(w),M=c.redMul(p);return this.curve.point(m,y,M,v)},un.prototype._projAdd=function(i){var t,r,h=this.z.redMul(i.z),o=h.redSqr(),l=this.x.redMul(i.x),c=this.y.redMul(i.y),p=this.curve.d.redMul(l).redMul(c),w=o.redSub(p),m=o.redAdd(p),y=this.x.redAdd(this.y).redMul(i.x.redAdd(i.y)).redISub(l).redISub(c),v=h.redMul(w).redMul(y);return this.curve.twisted?(t=h.redMul(m).redMul(c.redSub(this.curve._mulA(l))),r=w.redMul(m)):(t=h.redMul(m).redMul(c.redSub(l)),r=this.curve._mulC(w).redMul(m)),this.curve.point(v,t,r)},un.prototype.add=function(i){return this.isInfinity()?i:i.isInfinity()?this:this.curve.extended?this._extAdd(i):this._projAdd(i)},un.prototype.mul=function(i){return this._hasDoubles(i)?this.curve._fixedNafMul(this,i):this.curve._wnafMul(this,i)},un.prototype.mulAdd=function(i,t,r){return this.curve._wnafMulAdd(1,[this,t],[i,r],2,!1)},un.prototype.jmulAdd=function(i,t,r){return this.curve._wnafMulAdd(1,[this,t],[i,r],2,!0)},un.prototype.normalize=function(){if(this.zOne)return this;var i=this.z.redInvm();return this.x=this.x.redMul(i),this.y=this.y.redMul(i),this.t&&(this.t=this.t.redMul(i)),this.z=this.curve.one,this.zOne=!0,this},un.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},un.prototype.getX=function(){return this.normalize(),this.x.fromRed()},un.prototype.getY=function(){return this.normalize(),this.y.fromRed()},un.prototype.eq=function(i){return this===i||this.getX().cmp(i.getX())===0&&this.getY().cmp(i.getY())===0},un.prototype.eqXToP=function(i){var t=i.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var r=i.clone(),h=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(h),this.x.cmp(t)===0)return!0}},un.prototype.toP=un.prototype.normalize,un.prototype.mixedAdd=un.prototype.add;Xyt=eY,dx={},Mb=dx;Mb.base=x3,Mb.short=Gyt,Mb.mont=Zyt,Mb.edwards=Xyt;Yyt={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}},R3={},DT=R3,Nc=T3,GS=dx,ZK=ja.assert;DT.PresetCurve=rY,Lc("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Nc.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),Lc("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Nc.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),Lc("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Nc.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),Lc("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Nc.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),Lc("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Nc.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),Lc("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Nc.sha256,gRed:!1,g:["9"]}),Lc("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Nc.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{LT=Yyt}catch(i){LT=void 0}Lc("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Nc.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",LT]});Qyt=Hn,JK=ja.assert;iY=zo,zo.fromPublic=function(i,t,r){return t instanceof zo?t:new zo(i,{pub:t,pubEnc:r})},zo.fromPrivate=function(i,t,r){return t instanceof zo?t:new zo(i,{priv:t,privEnc:r})},zo.prototype.validate=function(){var i=this.getPublic();return i.isInfinity()?{result:!1,reason:"Invalid public key"}:i.validate()?i.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},zo.prototype.getPublic=function(i,t){return typeof i=="string"&&(t=i,i=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,i):this.pub},zo.prototype.getPrivate=function(i){return i==="hex"?this.priv.toString(16,2):this.priv},zo.prototype._importPrivate=function(i,t){this.priv=new Qyt(i,t||16),this.priv=this.priv.umod(this.ec.curve.n)},zo.prototype._importPublic=function(i,t){if(i.x||i.y)return this.ec.curve.type==="mont"?JK(i.x,"Need x coordinate"):this.ec.curve.type!=="short"&&this.ec.curve.type!=="edwards"||JK(i.x&&i.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(i.x,i.y),void 0;this.pub=this.ec.curve.decodePoint(i,t)},zo.prototype.derive=function(i){return i.mul(this.priv).getX()},zo.prototype.sign=function(i,t,r){return this.ec.sign(i,this,t,r)},zo.prototype.verify=function(i,t){return this.ec.verify(i,t,this)},zo.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};t6t=iY,o0=Hn,XK=Wyt,VS=R3,e6t=ux,oY=ja.assert,ZS=t6t,Sb=Wvt;nY=$s,$s.prototype.keyPair=function(i){return new ZS(this,i)},$s.prototype.keyFromPrivate=function(i,t){return ZS.fromPrivate(this,i,t)},$s.prototype.keyFromPublic=function(i,t){return ZS.fromPublic(this,i,t)},$s.prototype.genKeyPair=function(i){i||(i={});for(var t=new XK({hash:this.hash,pers:i.pers,persEnc:i.persEnc||"utf8",entropy:i.entropy||e6t(this.hash.hmacStrength),entropyEnc:i.entropy&&i.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),h=this.n.sub(new o0(2));;){var o=new o0(t.generate(r));if(!(o.cmp(h)>0))return o.iaddn(1),this.keyFromPrivate(o)}},$s.prototype._truncateToN=function(i,t){var r=8*i.byteLength()-this.n.bitLength();return r>0&&(i=i.ushrn(r)),!t&&i.cmp(this.n)>=0?i.sub(this.n):i},$s.prototype.sign=function(i,t,r,h){typeof r=="object"&&(h=r,r=null),h||(h={}),t=this.keyFromPrivate(t,r),i=this._truncateToN(new o0(i,16));for(var o=this.n.byteLength(),l=t.getPrivate().toArray("be",o),c=i.toArray("be",o),p=new XK({hash:this.hash,entropy:l,nonce:c,pers:h.pers,persEnc:h.persEnc||"utf8"}),w=this.n.sub(new o0(1)),m=0;;m++){var y=h.k?h.k(m):new o0(p.generate(this.n.byteLength()));if(!((y=this._truncateToN(y,!0)).cmpn(1)<=0||y.cmp(w)>=0)){var v=this.g.mul(y);if(!v.isInfinity()){var M=v.getX(),T=M.umod(this.n);if(T.cmpn(0)!==0){var A=y.invm(this.n).mul(T.mul(t.getPrivate()).iadd(i));if((A=A.umod(this.n)).cmpn(0)!==0){var R=(v.getY().isOdd()?1:0)|(M.cmp(T)!==0?2:0);return h.canonical&&A.cmp(this.nh)>0&&(A=this.n.sub(A),R^=1),new Sb({r:T,s:A,recoveryParam:R})}}}}}},$s.prototype.verify=function(i,t,r,h){i=this._truncateToN(new o0(i,16)),r=this.keyFromPublic(r,h);var o=(t=new Sb(t,"hex")).r,l=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||l.cmpn(1)<0||l.cmp(this.n)>=0)return!1;var c,p=l.invm(this.n),w=p.mul(i).umod(this.n),m=p.mul(o).umod(this.n);return this.curve._maxwellTrick?!(c=this.g.jmulAdd(w,r.getPublic(),m)).isInfinity()&&c.eqXToP(o):!(c=this.g.mulAdd(w,r.getPublic(),m)).isInfinity()&&c.getX().umod(this.n).cmp(o)===0},$s.prototype.recoverPubKey=function(i,t,r,h){oY((3&r)===r,"The recovery param is more than two bits"),t=new Sb(t,h);var o=this.n,l=new o0(i),c=t.r,p=t.s,w=1&r,m=r>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&m)throw new Error("Unable to find sencond key candinate");c=m?this.curve.pointFromX(c.add(this.curve.n),w):this.curve.pointFromX(c,w);var y=t.r.invm(o),v=o.sub(l).mul(y).umod(o),M=p.mul(y).umod(o);return this.g.mulAdd(v,c,M)},$s.prototype.getKeyRecoveryParam=function(i,t,r,h){if((t=new Sb(t,h)).recoveryParam!==null)return t.recoveryParam;for(var o=0;o<4;o++){var l;try{l=this.recoverPubKey(i,t,o)}catch{continue}if(l.eq(r))return o}throw new Error("Unable to find valid recovery factor")};r6t=nY,kg=ja,YK=kg.assert,QK=kg.parseBytes,b1=kg.cachedProperty;yo.fromPublic=function(i,t){return t instanceof yo?t:new yo(i,{pub:t})},yo.fromSecret=function(i,t){return t instanceof yo?t:new yo(i,{secret:t})},yo.prototype.secret=function(){return this._secret},b1(yo,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),b1(yo,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),b1(yo,"privBytes",function(){var i=this.eddsa,t=this.hash(),r=i.encodingLength-1,h=t.slice(0,i.encodingLength);return h[0]&=248,h[r]&=127,h[r]|=64,h}),b1(yo,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),b1(yo,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),b1(yo,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),yo.prototype.sign=function(i){return YK(this._secret,"KeyPair can only verify"),this.eddsa.sign(i,this)},yo.prototype.verify=function(i,t){return this.eddsa.verify(i,t,this)},yo.prototype.getSecret=function(i){return YK(this._secret,"KeyPair is public only"),kg.encode(this.secret(),i)},yo.prototype.getPublic=function(i){return kg.encode(this.pubBytes(),i)};i6t=yo,n6t=Hn,k3=ja,o6t=k3.assert,Eb=k3.cachedProperty,a6t=k3.parseBytes;Eb(l0,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Eb(l0,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Eb(l0,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Eb(l0,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),l0.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},l0.prototype.toHex=function(){return k3.encode(this.toBytes(),"hex").toUpperCase()};s6t=l0,h6t=T3,f6t=R3,k1=ja,u6t=k1.assert,tH=k1.parseBytes,eH=i6t,rH=s6t;aY=wa,wa.prototype.sign=function(i,t){i=tH(i);var r=this.keyFromSecret(t),h=this.hashInt(r.messagePrefix(),i),o=this.g.mul(h),l=this.encodePoint(o),c=this.hashInt(l,r.pubBytes(),i).mul(r.priv()),p=h.add(c).umod(this.curve.n);return this.makeSignature({R:o,S:p,Rencoded:l})},wa.prototype.verify=function(i,t,r){i=tH(i),t=this.makeSignature(t);var h=this.keyFromPublic(r),o=this.hashInt(t.Rencoded(),h.pubBytes(),i),l=this.g.mul(t.S());return t.R().add(h.pub().mul(o)).eq(l)},wa.prototype.hashInt=function(){for(var i=this.hash(),t=0;t<arguments.length;t++)i.update(arguments[t]);return k1.intFromLE(i.digest()).umod(this.curve.n)},wa.prototype.keyFromPublic=function(i){return eH.fromPublic(this,i)},wa.prototype.keyFromSecret=function(i){return eH.fromSecret(this,i)},wa.prototype.makeSignature=function(i){return i instanceof rH?i:new rH(this,i)},wa.prototype.encodePoint=function(i){var t=i.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=i.getX().isOdd()?128:0,t},wa.prototype.decodePoint=function(i){var t=(i=k1.parseBytes(i)).length-1,r=i.slice(0,t).concat(-129&i[t]),h=(128&i[t])!=0,o=k1.intFromLE(r);return this.curve.pointFromY(o,h)},wa.prototype.encodeInt=function(i){return i.toArray("le",this.encodingLength)},wa.prototype.decodeInt=function(i){return k1.intFromLE(i)},wa.prototype.isPoint=function(i){return i instanceof this.pointClass};c6t=aY,I3={},a0=I3;a0.version=["elliptic","6.5.2","EC cryptography","lib/elliptic.js",["lib"],{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},{type:"git",url:"git@github.com:indutny/elliptic"},["EC","Elliptic","curve","Cryptography"],"Fedor Indutny <fedor@indutny.com>","MIT",{url:"https://github.com/indutny/elliptic/issues"},"https://github.com/indutny/elliptic",{brfs:"^1.4.3",coveralls:"^3.0.8",grunt:"^1.0.4","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.2",jscs:"^3.0.7",jshint:"^2.10.3",mocha:"^6.2.2"},{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"}][1],a0.utils=ja,a0.rand=ux,a0.curve=dx,a0.curves=R3,a0.ec=r6t,a0.eddsa=c6t;JS={},iH=!1,Ua=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,ro=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,sY={},l6t=Fr;sY.Reporter=Cs,Cs.prototype.isError=function(i){return i instanceof w1},Cs.prototype.save=function(){var i=(this||ro)._reporterState;return{obj:i.obj,pathLen:i.path.length}},Cs.prototype.restore=function(i){var t=(this||ro)._reporterState;t.obj=i.obj,t.path=t.path.slice(0,i.pathLen)},Cs.prototype.enterKey=function(i){return(this||ro)._reporterState.path.push(i)},Cs.prototype.exitKey=function(i){var t=(this||ro)._reporterState;t.path=t.path.slice(0,i-1)},Cs.prototype.leaveKey=function(i,t,r){var h=(this||ro)._reporterState;this.exitKey(i),h.obj!==null&&(h.obj[t]=r)},Cs.prototype.path=function(){return(this||ro)._reporterState.path.join("/")},Cs.prototype.enterObject=function(){var i=(this||ro)._reporterState,t=i.obj;return i.obj={},t},Cs.prototype.leaveObject=function(i){var t=(this||ro)._reporterState,r=t.obj;return t.obj=i,r},Cs.prototype.error=function(i){var t,r=(this||ro)._reporterState,h=i instanceof w1;if(t=h?i:new w1(r.path.map(function(o){return"["+JSON.stringify(o)+"]"}).join(""),i.message||i,i.stack),!r.options.partial)throw t;return h||r.errors.push(t),t},Cs.prototype.wrapResult=function(i){var t=(this||ro)._reporterState;return t.options.partial?{result:this.isError(i)?null:i,errors:t.errors}:i},l6t(w1,Error),w1.prototype.rethrow=function(i){if((this||ro).message=i+" at: "+((this||ro).path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this||ro,w1),!(this||ro).stack)try{throw new Error((this||ro).message)}catch(t){(this||ro).stack=t.stack}return this||ro};Ab={},nH=!1,Lr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;XS={},aH=!1,Rr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,YS={},sH=!1;Tc={},hH=!1,QS={},fH=!1;tE={},uH=!1,xc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;eE={},lH=!1,rE=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,iE={},dH=!1;nE={},pH=!1,Qn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;oE={},mH=!1,aE=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,sE={},vH=!1;hE={},yH=!1;fY=B3(),$h=fY,bH=$h.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),g6t=$h.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),px=$h.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),m6t=$h.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(px),this.key("subjectPublicKey").bitstr())}),v6t=$h.define("RelativeDistinguishedName",function(){this.setof(g6t)}),y6t=$h.define("RDNSequence",function(){this.seqof(v6t)}),wH=$h.define("Name",function(){this.choice({rdnSequence:this.use(y6t)})}),b6t=$h.define("Validity",function(){this.seq().obj(this.key("notBefore").use(bH),this.key("notAfter").use(bH))}),w6t=$h.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),_6t=$h.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(px),this.key("issuer").use(wH),this.key("validity").use(b6t),this.key("subject").use(wH),this.key("subjectPublicKeyInfo").use(m6t),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(w6t).optional())}),M6t=$h.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(_6t),this.key("signatureAlgorithm").use(px),this.key("signatureValue").bitstr())}),Lh={},Uh=fY;Lh.certificate=M6t;S6t=Uh.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});Lh.RSAPrivateKey=S6t;E6t=Uh.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});Lh.RSAPublicKey=E6t;A6t=Uh.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(uY),this.key("subjectPublicKey").bitstr())});Lh.PublicKey=A6t;uY=Uh.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),T6t=Uh.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(uY),this.key("subjectPrivateKey").octstr())});Lh.PrivateKey=T6t;x6t=Uh.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});Lh.EncryptedPrivateKey=x6t;R6t=Uh.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});Lh.DSAPrivateKey=R6t,Lh.DSAparam=Uh.define("DSAparam",function(){this.int()});k6t=Uh.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(I6t),this.key("publicKey").optional().explicit(1).bitstr())});Lh.ECPrivateKey=k6t;I6t=Uh.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});Lh.signature=Uh.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())});B6t=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m,O6t=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,C6t=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m,P6t=A3,N6t=Fa,Tb=vi.Buffer,ya=Lh,L6t={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"},D6t=function(i,t){var r,h=i.toString(),o=h.match(B6t);if(o){var l="aes"+o[1],c=Tb.from(o[2],"hex"),p=Tb.from(o[3].replace(/[\r\n]/g,""),"base64"),w=P6t(t,c.slice(0,8),parseInt(o[1],10)).key,m=[],y=N6t.createDecipheriv(l,w,c);m.push(y.update(p)),m.push(y.final()),r=Tb.concat(m)}else{var v=h.match(C6t);r=new Tb(v[2].replace(/[\r\n]/g,""),"base64")}return{tag:h.match(O6t)[1],data:r}},$6t=Fa,U6t=h3,fE=vi.Buffer;cY=_H,_H.signature=ya.signature;O3=cY,lY={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"},$T={},Ko=Cr.Buffer,S0=zJ,q6t=cx,F6t=I3.ec,p3=Hn,j6t=O3,z6t=lY;($T=function(i,t,r,h,o){var l=j6t(t);if(l.curve){if(h!=="ecdsa"&&h!=="ecdsa/rsa")throw new Error("wrong private key type");return function(m,y){var v=z6t[y.curve.join(".")];if(!v)throw new Error("unknown curve "+y.curve.join("."));var M=new F6t(v).keyFromPrivate(y.privateKey).sign(m);return new Ko(M.toDER())}(i,l)}if(l.type==="dsa"){if(h!=="dsa")throw new Error("wrong private key type");return function(m,y,v){for(var M,T=y.params.priv_key,A=y.params.p,R=y.params.q,B=y.params.g,C=new p3(0),P=gx(m,R).mod(R),N=!1,q=MH(T,R,m,v);N===!1;)M=SH(R,q,v),C=W6t(B,M,A,R),(N=M.invm(R).imul(P.add(T.mul(C))).mod(R)).cmpn(0)===0&&(N=!1,C=new p3(0));return function(W,J){W=W.toArray(),J=J.toArray(),128&W[0]&&(W=[0].concat(W)),128&J[0]&&(J=[0].concat(J));var F=[48,W.length+J.length+4,2,W.length];return F=F.concat(W,[2,J.length],J),new Ko(F)}(C,N)}(i,l,r)}if(h!=="rsa"&&h!=="ecdsa/rsa")throw new Error("wrong private key type");i=Ko.concat([o,i]);for(var c=l.modulus.byteLength(),p=[0,1];i.length+p.length+1<c;)p.push(255);p.push(0);for(var w=-1;++w<i.length;)p.push(i[w]);return q6t(p,l)}).getKey=MH,$T.makeKey=SH;K6t=$T,uE=Cr.Buffer,eg=Hn,H6t=I3.ec,EH=O3,G6t=lY;V6t=function(i,t,r,h,o){var l=EH(r);if(l.type==="ec"){if(h!=="ecdsa"&&h!=="ecdsa/rsa")throw new Error("wrong public key type");return function(M,T,A){var R=G6t[A.data.algorithm.curve.join(".")];if(!R)throw new Error("unknown curve "+A.data.algorithm.curve.join("."));var B=new H6t(R),C=A.data.subjectPrivateKey.data;return B.verify(T,M,C)}(i,t,l)}if(l.type==="dsa"){if(h!=="dsa")throw new Error("wrong public key type");return function(M,T,A){var R=A.data.p,B=A.data.q,C=A.data.g,P=A.data.pub_key,N=EH.signature.decode(M,"der"),q=N.s,W=N.r;AH(q,B),AH(W,B);var J=eg.mont(R),F=q.invm(B);return C.toRed(J).redPow(new eg(T).mul(F).mod(B)).fromRed().mul(P.toRed(J).redPow(W.mul(F).mod(B)).fromRed()).mod(R).mod(B).cmp(W)===0}(i,t,l)}if(h!=="rsa"&&h!=="ecdsa/rsa")throw new Error("wrong public key type");t=uE.concat([o,t]);for(var c=l.modulus.byteLength(),p=[1],w=0;t.length+p.length+2<c;)p.push(255),w++;p.push(0);for(var m=-1;++m<t.length;)p.push(t[m]);p=new uE(p);var y=eg.mont(l.modulus);i=(i=new eg(i).toRed(y)).redPow(new eg(l.publicExponent)),i=new uE(i.fromRed().toArray());var v=w<8?1:0;for(c=Math.min(i.length,p.length),i.length!==p.length&&(v=1),m=-1;++m<c;)v|=i[m]^p[m];return v===0},On=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,xb=Cr.Buffer,dY=Lg,g3=qs,TH=Fr,Z6t=K6t,J6t=V6t,m0=WJ;Object.keys(m0).forEach(function(i){m0[i].id=new xb(m0[i].id,"hex"),m0[i.toLowerCase()]=m0[i]}),TH(mg,g3.Writable),mg.prototype._write=function(i,t,r){(this||On)._hash.update(i),r()},mg.prototype.update=function(i,t){return typeof i=="string"&&(i=new xb(i,t)),(this||On)._hash.update(i),this||On},mg.prototype.sign=function(i,t){this.end();var r=(this||On)._hash.digest(),h=Z6t(r,i,(this||On)._hashType,(this||On)._signType,(this||On)._tag);return t?h.toString(t):h},TH(vg,g3.Writable),vg.prototype._write=function(i,t,r){(this||On)._hash.update(i),r()},vg.prototype.update=function(i,t){return typeof i=="string"&&(i=new xb(i,t)),(this||On)._hash.update(i),this||On},vg.prototype.verify=function(i,t,r){typeof t=="string"&&(t=new xb(t,r)),this.end();var h=(this||On)._hash.digest();return J6t(t,h,i,(this||On)._signType,(this||On)._tag)};X6t={Sign:xH,Verify:RH,createSign:xH,createVerify:RH},io=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Mu=Cr.Buffer,Y6t=I3,Q6t=Hn;pY=function(i){return new d0(i)};qa={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};qa.p224=qa.secp224r1,qa.p256=qa.secp256r1=qa.prime256v1,qa.p192=qa.secp192r1=qa.prime192v1,qa.p384=qa.secp384r1,qa.p521=qa.secp521r1,d0.prototype.generateKeys=function(i,t){return(this||io).keys=(this||io).curve.genKeyPair(),this.getPublicKey(i,t)},d0.prototype.computeSecret=function(i,t,r){return t=t||"utf8",Mu.isBuffer(i)||(i=new Mu(i,t)),cE((this||io).curve.keyFromPublic(i).getPublic().mul((this||io).keys.getPrivate()).getX(),r,(this||io).curveType.byteLength)},d0.prototype.getPublicKey=function(i,t){var r=(this||io).keys.getPublic(t==="compressed",!0);return t==="hybrid"&&(r[r.length-1]%2?r[0]=7:r[0]=6),cE(r,i)},d0.prototype.getPrivateKey=function(i){return cE((this||io).keys.getPrivate(),i)},d0.prototype.setPublicKey=function(i,t){return t=t||"utf8",Mu.isBuffer(i)||(i=new Mu(i,t)),(this||io).keys._importPublic(i),this||io},d0.prototype.setPrivateKey=function(i,t){t=t||"utf8",Mu.isBuffer(i)||(i=new Mu(i,t));var r=new Q6t(i);return r=r.toString(16),(this||io).keys=(this||io).curve.genKeyPair(),(this||io).keys._importPrivate(r),this||io};tbt=pY,ebt=Lg,UT=vi.Buffer;gY=function(i,t){for(var r,h=UT.alloc(0),o=0;h.length<t;)r=rbt(o++),h=UT.concat([h,ebt("sha1").update(i).update(r).digest()]);return h.slice(0,t)},mY=function(i,t){for(var r=i.length,h=-1;++h<r;)i[h]^=t[h];return i},kH=Hn,ibt=vi.Buffer,vY=function(i,t){return ibt.from(i.toRed(kH.mont(t.modulus)).redPow(new kH(t.publicExponent)).fromRed().toArray())},nbt=O3,lE=q1,obt=Lg,IH=gY,BH=mY,dE=Hn,abt=vY,sbt=cx,Rh=vi.Buffer,hbt=function(i,t,r){var h;h=i.padding?i.padding:r?1:4;var o,l=nbt(i);if(h===4)o=function(c,p){var w=c.modulus.byteLength(),m=p.length,y=obt("sha1").update(Rh.alloc(0)).digest(),v=y.length,M=2*v;if(m>w-M-2)throw new Error("message too long");var T=Rh.alloc(w-m-M-2),A=w-v-1,R=lE(v),B=BH(Rh.concat([y,T,Rh.alloc(1,1),p],A),IH(R,A)),C=BH(R,IH(B,v));return new dE(Rh.concat([Rh.alloc(1),C,B],w))}(l,t);else if(h===1)o=function(c,p,w){var m,y=p.length,v=c.modulus.byteLength();if(y>v-11)throw new Error("message too long");return m=w?Rh.alloc(v-y-3,255):function(M){for(var T,A=Rh.allocUnsafe(M),R=0,B=lE(2*M),C=0;R<M;)C===B.length&&(B=lE(2*M),C=0),(T=B[C++])&&(A[R++]=T);return A}(v-y-3),new dE(Rh.concat([Rh.from([0,w?1:2]),m,Rh.alloc(1),p],v))}(l,t,r);else{if(h!==3)throw new Error("unknown padding");if((o=new dE(t)).cmp(l.modulus)>=0)throw new Error("data too long for modulus")}return r?sbt(o,l):abt(o,l)},fbt=O3,OH=gY,CH=mY,PH=Hn,ubt=cx,cbt=Lg,lbt=vY,rg=vi.Buffer,dbt=function(i,t,r){var h;h=i.padding?i.padding:r?1:4;var o,l=fbt(i),c=l.modulus.byteLength();if(t.length>c||new PH(t).cmp(l.modulus)>=0)throw new Error("decryption error");o=r?lbt(new PH(t),l):ubt(t,l);var p=rg.alloc(c-o.length);if(o=rg.concat([p,o],c),h===4)return function(w,m){var y=w.modulus.byteLength(),v=cbt("sha1").update(rg.alloc(0)).digest(),M=v.length;if(m[0]!==0)throw new Error("decryption error");var T=m.slice(1,M+1),A=m.slice(M+1),R=CH(T,OH(A,M)),B=CH(A,OH(R,y-M-1));if(function(P,N){P=rg.from(P),N=rg.from(N);var q=0,W=P.length;P.length!==N.length&&(q++,W=Math.min(P.length,N.length));for(var J=-1;++J<W;)q+=P[J]^N[J];return q}(v,B.slice(0,M)))throw new Error("decryption error");for(var C=M;B[C]===0;)C++;if(B[C++]!==1)throw new Error("decryption error");return B.slice(C)}(l,o);if(h===1)return function(w,m,y){for(var v=m.slice(0,2),M=2,T=0;m[M++]!==0;)if(M>=m.length){T++;break}var A=m.slice(2,M-1);if((v.toString("hex")!=="0002"&&!y||v.toString("hex")!=="0001"&&y)&&T++,A.length<8&&T++,T)throw new Error("decryption error");return m.slice(M)}(0,o,r);if(h===3)return o;throw new Error("unknown padding")},p0={};p0.publicEncrypt=hbt,p0.privateDecrypt=dbt,p0.privateEncrypt=function(i,t){return p0.publicEncrypt(i,t,!0)},p0.publicDecrypt=function(i,t){return p0.privateDecrypt(i,t,!0)};m3=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,yg={},qT=Br;yY=vi,LH=q1,DH=yY.Buffer,bY=yY.kMaxLength,FT=m3.crypto||m3.msCrypto,wY=Math.pow(2,32)-1;FT&&FT.getRandomValues||!qT.browser?(yg.randomFill=function(i,t,r,h){if(!(DH.isBuffer(i)||i instanceof m3.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof t=="function")h=t,t=0,r=i.length;else if(typeof r=="function")h=r,r=i.length-t;else if(typeof h!="function")throw new TypeError('"cb" argument must be a function');return $H(t,i.length),UH(r,t,i.length),qH(i,t,r,h)},yg.randomFillSync=function(i,t,r){if(t===void 0&&(t=0),!(DH.isBuffer(i)||i instanceof m3.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return $H(t,i.length),r===void 0&&(r=i.length-t),UH(r,t,i.length),qH(i,t,r)}):(yg.randomFill=NH,yg.randomFillSync=NH);ni={};ni.randomBytes=ni.rng=ni.pseudoRandomBytes=ni.prng=q1,ni.createHash=ni.Hash=Lg,ni.createHmac=ni.Hmac=zJ;pbt=WJ,gbt=Object.keys(pbt),mbt=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(gbt);ni.getHashes=function(){return mbt};FH=h3;ni.pbkdf2=FH.pbkdf2,ni.pbkdf2Sync=FH.pbkdf2Sync;yf=Ih;ni.Cipher=yf.Cipher,ni.createCipher=yf.createCipher,ni.Cipheriv=yf.Cipheriv,ni.createCipheriv=yf.createCipheriv,ni.Decipher=yf.Decipher,ni.createDecipher=yf.createDecipher,ni.Decipheriv=yf.Decipheriv,ni.createDecipheriv=yf.createDecipheriv,ni.getCiphers=yf.getCiphers,ni.listCiphers=yf.listCiphers;ig=A1;ni.DiffieHellmanGroup=ig.DiffieHellmanGroup,ni.createDiffieHellmanGroup=ig.createDiffieHellmanGroup,ni.getDiffieHellman=ig.getDiffieHellman,ni.createDiffieHellman=ig.createDiffieHellman,ni.DiffieHellman=ig.DiffieHellman;Rb=X6t;ni.createSign=Rb.createSign,ni.Sign=Rb.Sign,ni.createVerify=Rb.createVerify,ni.Verify=Rb.Verify,ni.createECDH=tbt;kb=p0;ni.publicEncrypt=kb.publicEncrypt,ni.privateEncrypt=kb.privateEncrypt,ni.publicDecrypt=kb.publicDecrypt,ni.privateDecrypt=kb.privateDecrypt;jH=yg;ni.randomFill=jH.randomFill,ni.randomFillSync=jH.randomFillSync,ni.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join(`
|
|
107
107
|
`))},ni.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6};Ib={},zH=!1,Bb=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;pE={},WH=!1,KH=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;gE={},HH=!1;vbt={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}},mE={},GH=!1,wi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;s0={},VH=!1;SY={},ZH=!1,vE={exports:SY},Ot=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;yE={},JH=!1;wbt={_args:[["elliptic@6.5.4","C:\\Users\\guybe\\Projects\\rollup-plugin-jspm"]],_from:"elliptic@6.5.4",_id:"elliptic@6.5.4",_inBundle:!1,_integrity:"sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==",_location:"/@jspm/core/elliptic",_phantomChildren:{},_requested:{type:"version",registry:!0,raw:"elliptic@6.5.4",name:"elliptic",escapedName:"elliptic",rawSpec:"6.5.4",saveSpec:null,fetchSpec:"6.5.4"},_requiredBy:["/@jspm/core/browserify-sign","/@jspm/core/create-ecdh"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",_spec:"6.5.4",_where:"C:\\Users\\guybe\\Projects\\rollup-plugin-jspm",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},description:"EC cryptography",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.5.4"},EY={},XH=!1,bE={exports:EY},Ut=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;wE={},YH=!1;_E={},QH=!1;ME={},tG=!1;SE={},eG=!1;EE={},rG=!1;AE={},iG=!1;TE={},nG=!1;Yi={},oG=!1;xE={},aG=!1;sG={},hG=!1;RE={},fG=!1;kE={},uG=!1;IE={},cG=!1;BE={},lG=!1;OE={},dG=!1;CE={},pG=!1;PE={},gG=!1;NE={},mG=!1;LE={},vG=!1;DE={},yG=!1;$E={},bG=!1;UE={},wG=!1;qE={},_G=!1;RY={},MG=!1,FE={exports:RY},qt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;jE={},SG=!1;zE={},EG=!1;Ob={},AG=!1;WE={},TG=!1;Rc={},xG=!1;KE={},RG=!1;HE={},kG=!1;GE={},IG=!1;VE={},BG=!1;ZE={},OG=!1;JE={},CG=!1;XE={},PG=!1;YE={},NG=!1;QE={},LG=!1;tA={},DG=!1;eA={},$G=!1;Ps={},UG=!1;jbt={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"},rA={},qG=!1;iA={},FG=!1;NY={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"},ng={},jG=!1;nA={},zG=!1;oA={},WG=!1,Rn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;LY={},KG=!1,aA={exports:LY},Ft=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;sA={},HG=!1,to=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;hA={},GG=!1;fA={},VG=!1;UY={},ZG=!1,uA={exports:UY},jt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;cA={},JG=!1;lA={},XG=!1;dA={},YG=!1;kc={},QG=!1;_1={},tV=!1,Cb=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;ti={},eV=!1;oi=Qbt();oi.Cipher;oi.Cipheriv;oi.Decipher;oi.Decipheriv;oi.DiffieHellman;oi.DiffieHellmanGroup;oi.Hash;oi.Hmac;oi.Sign;oi.Verify;oi.constants;oi.createCipher;oi.createCipheriv;oi.createCredentials;oi.createDecipher;oi.createDecipheriv;oi.createDiffieHellman;oi.createDiffieHellmanGroup;oi.createECDH;oi.createHash;oi.createHmac;oi.createSign;oi.createVerify;oi.getCiphers;oi.getDiffieHellman;oi.getHashes;oi.listCiphers;oi.pbkdf2;oi.pbkdf2Sync;oi.privateDecrypt;oi.privateEncrypt;oi.prng;oi.pseudoRandomBytes;oi.publicDecrypt;oi.publicEncrypt;oi.randomBytes;oi.randomFill;oi.randomFillSync;oi.rng;Pb={},rV=!1,Nb=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;pA={},iV=!1,nV=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;gA={},oV=!1;t3t={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}},mA={},aV=!1,_i=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;h0={},sV=!1;og={},hV=!1;zY={},fV=!1,vA={exports:zY},Ct=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;yA={},uV=!1;i3t={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}},WY={},cV=!1,bA={exports:WY},zt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;wA={},lV=!1;_A={},dV=!1;MA={},pV=!1;SA={},gV=!1;EA={},mV=!1;AA={},vV=!1;TA={},yV=!1;Qi={},bV=!1;xA={},wV=!1;_V={},MV=!1;RA={},SV=!1;kA={},EV=!1;IA={},AV=!1;BA={},TV=!1;OA={},xV=!1;CA={},RV=!1;PA={},kV=!1;NA={},IV=!1;LA={},BV=!1;DA={},OV=!1;$A={},CV=!1;UA={},PV=!1;qA={},NV=!1;VY={},LV=!1,FA={exports:VY},Wt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;jA={},DV=!1;zA={},$V=!1;Lb={},UV=!1;WA={},qV=!1;Ic={},FV=!1;KA={},jV=!1;HA={},zV=!1;GA={},WV=!1;VA={},KV=!1;ZA={},HV=!1;JA={},GV=!1;XA={},VV=!1;YA={},ZV=!1;QA={},JV=!1;tT={},XV=!1;eT={},YV=!1;Ns={},QV=!1;A3t={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"},rT={},tZ=!1;iT={},eZ=!1;eQ={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"},ag={},rZ=!1;nT={},iZ=!1;oT={},nZ=!1,kn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;rQ={},oZ=!1,aT={exports:rQ},Kt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;sT={},aZ=!1,eo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;hT={},sZ=!1;fT={},hZ=!1;oQ={},fZ=!1,uT={exports:oQ},Ht=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;cT={},uZ=!1;lT={},cZ=!1;dT={},lZ=!1;Bc={},dZ=!1;M1={},pZ=!1,Db=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;ei={},gZ=!1;br=L3t();br.randomBytes;br.rng;br.pseudoRandomBytes;br.prng;br.createHash;br.Hash;br.createHmac;br.Hmac;br.getHashes;br.pbkdf2;br.pbkdf2Sync;br.Cipher;br.createCipher;br.Cipheriv;br.createCipheriv;br.Decipher;br.createDecipher;br.Decipheriv;br.createDecipheriv;br.getCiphers;br.listCiphers;br.DiffieHellmanGroup;br.createDiffieHellmanGroup;br.getDiffieHellman;br.createDiffieHellman;br.DiffieHellman;br.createSign;br.Sign;br.createVerify;br.Verify;br.createECDH;br.publicEncrypt;br.privateEncrypt;br.publicDecrypt;br.privateDecrypt;br.randomFill;br.randomFillSync;br.createCredentials;br.constants;br.webcrypto=globalThis.crypto;D3t=br.Cipher,$3t=br.Cipheriv,U3t=br.Decipher,q3t=br.Decipheriv,F3t=br.DiffieHellman,j3t=br.DiffieHellmanGroup,z3t=br.Hash,W3t=br.Hmac,K3t=br.Sign,H3t=br.Verify,G3t=br.constants,V3t=br.createCipher,Z3t=br.createCipheriv,J3t=br.createCredentials,X3t=br.createDecipher,Y3t=br.createDecipheriv,Q3t=br.createDiffieHellman,t8t=br.createDiffieHellmanGroup,e8t=br.createECDH,Ux=br.createHash,r8t=br.createHmac,i8t=br.createSign,n8t=br.createVerify,o8t=br.getCiphers,a8t=br.getDiffieHellman,s8t=br.getHashes,h8t=br.listCiphers,f8t=br.pbkdf2,u8t=br.pbkdf2Sync,c8t=br.privateDecrypt,l8t=br.privateEncrypt,d8t=br.prng,p8t=br.pseudoRandomBytes,g8t=br.publicDecrypt,m8t=br.publicEncrypt,v8t=br.randomBytes,y8t=br.randomFill,b8t=br.randomFillSync,w8t=br.rng,_8t=br.webcrypto});var fQ=De(xu=>{"use strict";Tt();Rt();xt();var M8t=xu&&xu.__createBinding||(Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]}),S8t=xu&&xu.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),E8t=xu&&xu.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var r in i)r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)&&M8t(t,i,r);return S8t(t,i),t};Object.defineProperty(xu,"__esModule",{value:!0});var hQ=rj(),Ws=E8t((qx(),Dn(sQ))),Fx=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";encryptionAlgorithm="aes-256-cbc";generateJWK(){if(typeof Ws.generateKeyPair!="function")throw new Error("Keypair generation not supported in this version of Node, only supported in versions 10+");return new Promise((t,r)=>{Ws.generateKeyPair("rsa",{modulusLength:this.keyLength,publicExponent:this.publicExponent,privateKeyEncoding:{type:"pkcs1",format:"pem"},publicKeyEncoding:{type:"pkcs1",format:"pem"}},(h,o,l)=>{h&&r(h),t(this.pemToJWK(l))})})}sign(t,r,{saltLength:h}={}){return new Promise((o,l)=>{o(Ws.createSign(this.hashAlgorithm).update(r).sign({key:this.jwkToPem(t),padding:Ws.constants.RSA_PKCS1_PSS_PADDING,saltLength:h}))})}verify(t,r,h){return new Promise((o,l)=>{let c={kty:"RSA",e:"AQAB",n:t},p=this.jwkToPem(c);o(Ws.createVerify(this.hashAlgorithm).update(r).verify({key:p,padding:Ws.constants.RSA_PKCS1_PSS_PADDING},h))})}hash(t,r="SHA-256"){if(typeof t=="string")throw new TypeError("Data must be a Uint8Array");return new Promise((h,o)=>{h(Ws.createHash(this.parseHashAlgorithm(r)).update(t).digest())})}async encrypt(t,r,h){let o=Ws.pbkdf2Sync(r,h=h||"salt",1e5,32,this.hashAlgorithm),l=Ws.randomBytes(16),c=Ws.createCipheriv(this.encryptionAlgorithm,o,l);return ge.concat([l,c.update(t),c.final()])}async decrypt(t,r,h){try{let o=Ws.pbkdf2Sync(r,h=h||"salt",1e5,32,this.hashAlgorithm),l=t.slice(0,16),c=t.slice(16),p=Ws.createDecipheriv(this.encryptionAlgorithm,o,l);return ge.concat([p.update(c),p.final()])}catch{throw new Error("Failed to decrypt")}}jwkToPem(t){return(0,hQ.jwkTopem)(t)}pemToJWK(t){return(0,hQ.pemTojwk)(t)}parseHashAlgorithm(t){switch(t){case"SHA-256":return"sha256";case"SHA-384":return"sha384";default:throw new Error(`Algorithm not supported: ${t}`)}}};xu.default=Fx});var uQ=De(zx=>{"use strict";Tt();Rt();xt();Object.defineProperty(zx,"__esModule",{value:!0});var jx=class{api;constructor(t){this.api=t}getInfo(){return this.api.get("info").then(t=>t.data)}getPeers(){return this.api.get("peers").then(t=>t.data)}};zx.default=jx});var qg=De(Ug=>{"use strict";Tt();Rt();xt();Object.defineProperty(Ug,"__esModule",{value:!0});Ug.getError=void 0;var Wx=class extends Error{type;response;constructor(t,r={}){r.message?super(r.message):super(),this.type=t,this.response=r.response}getType(){return this.type}};Ug.default=Wx;function A8t(i){let t=i.data;if(typeof i.data=="string")try{t=JSON.parse(i.data)}catch{}if(i.data instanceof ArrayBuffer||i.data instanceof Uint8Array)try{t=JSON.parse(t.toString())}catch{}return t?t.error||t:i.statusText||"unknown"}Ug.getError=A8t});var Hx=De(U3=>{"use strict";Tt();Rt();xt();U3.byteLength=x8t;U3.toByteArray=k8t;U3.fromByteArray=O8t;var If=[],Ks=[],T8t=typeof Uint8Array<"u"?Uint8Array:Array,Kx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(R0=0,cQ=Kx.length;R0<cQ;++R0)If[R0]=Kx[R0],Ks[Kx.charCodeAt(R0)]=R0;var R0,cQ;Ks[45]=62;Ks[95]=63;function lQ(i){var t=i.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=i.indexOf("=");r===-1&&(r=t);var h=r===t?0:4-r%4;return[r,h]}function x8t(i){var t=lQ(i),r=t[0],h=t[1];return(r+h)*3/4-h}function R8t(i,t,r){return(t+r)*3/4-r}function k8t(i){var t,r=lQ(i),h=r[0],o=r[1],l=new T8t(R8t(i,h,o)),c=0,p=o>0?h-4:h,w;for(w=0;w<p;w+=4)t=Ks[i.charCodeAt(w)]<<18|Ks[i.charCodeAt(w+1)]<<12|Ks[i.charCodeAt(w+2)]<<6|Ks[i.charCodeAt(w+3)],l[c++]=t>>16&255,l[c++]=t>>8&255,l[c++]=t&255;return o===2&&(t=Ks[i.charCodeAt(w)]<<2|Ks[i.charCodeAt(w+1)]>>4,l[c++]=t&255),o===1&&(t=Ks[i.charCodeAt(w)]<<10|Ks[i.charCodeAt(w+1)]<<4|Ks[i.charCodeAt(w+2)]>>2,l[c++]=t>>8&255,l[c++]=t&255),l}function I8t(i){return If[i>>18&63]+If[i>>12&63]+If[i>>6&63]+If[i&63]}function B8t(i,t,r){for(var h,o=[],l=t;l<r;l+=3)h=(i[l]<<16&16711680)+(i[l+1]<<8&65280)+(i[l+2]&255),o.push(I8t(h));return o.join("")}function O8t(i){for(var t,r=i.length,h=r%3,o=[],l=16383,c=0,p=r-h;c<p;c+=l)o.push(B8t(i,c,c+l>p?p:c+l));return h===1?(t=i[r-1],o.push(If[t>>2]+If[t<<4&63]+"==")):h===2&&(t=(i[r-2]<<8)+i[r-1],o.push(If[t>>10]+If[t>>4&63]+If[t<<2&63]+"=")),o.join("")}});var Ru=De(tn=>{"use strict";Tt();Rt();xt();var C8t=tn&&tn.__createBinding||(Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]}),P8t=tn&&tn.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),N8t=tn&&tn.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var r in i)r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)&&C8t(t,i,r);return P8t(t,i),t};Object.defineProperty(tn,"__esModule",{value:!0});tn.b64UrlDecode=tn.b64UrlEncode=tn.bufferTob64Url=tn.bufferTob64=tn.b64UrlToBuffer=tn.stringToB64Url=tn.stringToBuffer=tn.bufferToString=tn.b64UrlToString=tn.concatBuffers=void 0;var dQ=N8t(Hx());function L8t(i){let t=0;for(let o=0;o<i.length;o++)t+=i[o].byteLength;let r=new Uint8Array(t),h=0;r.set(new Uint8Array(i[0]),h),h+=i[0].byteLength;for(let o=1;o<i.length;o++)r.set(new Uint8Array(i[o]),h),h+=i[o].byteLength;return r}tn.concatBuffers=L8t;function D8t(i){let t=mQ(i);return pQ(t)}tn.b64UrlToString=D8t;function pQ(i){return new TextDecoder("utf-8",{fatal:!0}).decode(i)}tn.bufferToString=pQ;function gQ(i){return new TextEncoder().encode(i)}tn.stringToBuffer=gQ;function $8t(i){return yQ(gQ(i))}tn.stringToB64Url=$8t;function mQ(i){return new Uint8Array(dQ.toByteArray(wQ(i)))}tn.b64UrlToBuffer=mQ;function vQ(i){return dQ.fromByteArray(new Uint8Array(i))}tn.bufferTob64=vQ;function yQ(i){return bQ(vQ(i))}tn.bufferTob64Url=yQ;function bQ(i){return i.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}tn.b64UrlEncode=bQ;function wQ(i){i=i.replace(/\-/g,"+").replace(/\_/g,"/");let t;return i.length%4==0?t=0:t=4-i.length%4,i.concat("=".repeat(t))}tn.b64UrlDecode=wQ});var SQ=De(Fg=>{"use strict";Tt();Rt();xt();var U8t=Fg&&Fg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Fg,"__esModule",{value:!0});var za=U8t(q3());async function _Q(i){if(Array.isArray(i)){let h=za.default.utils.concatBuffers([za.default.utils.stringToBuffer("list"),za.default.utils.stringToBuffer(i.length.toString())]);return await MQ(i,await za.default.crypto.hash(h,"SHA-384"))}let t=za.default.utils.concatBuffers([za.default.utils.stringToBuffer("blob"),za.default.utils.stringToBuffer(i.byteLength.toString())]),r=za.default.utils.concatBuffers([await za.default.crypto.hash(t,"SHA-384"),await za.default.crypto.hash(i,"SHA-384")]);return await za.default.crypto.hash(r,"SHA-384")}Fg.default=_Q;async function MQ(i,t){if(i.length<1)return t;let r=za.default.utils.concatBuffers([t,await _Q(i[0])]),h=await za.default.crypto.hash(r,"SHA-384");return await MQ(i.slice(1),h)}});var Yx=De(ai=>{"use strict";Tt();Rt();xt();var q8t=ai&&ai.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(ai,"__esModule",{value:!0});ai.debug=ai.validatePath=ai.arrayCompare=ai.bufferToInt=ai.intToBuffer=ai.arrayFlatten=ai.generateProofs=ai.buildLayers=ai.generateTransactionChunks=ai.generateTree=ai.computeRootHash=ai.generateLeaves=ai.chunkData=ai.MIN_CHUNK_SIZE=ai.MAX_CHUNK_SIZE=void 0;var F3=q8t(q3()),EQ=Ru();ai.MAX_CHUNK_SIZE=256*1024;ai.MIN_CHUNK_SIZE=32*1024;var zg=32,W1=32;async function Vx(i){let t=[],r=i,h=0;for(;r.byteLength>=ai.MAX_CHUNK_SIZE;){let o=ai.MAX_CHUNK_SIZE,l=r.byteLength-ai.MAX_CHUNK_SIZE;l>0&&l<ai.MIN_CHUNK_SIZE&&(o=Math.ceil(r.byteLength/2));let c=r.slice(0,o),p=await F3.default.crypto.hash(c);h+=c.byteLength,t.push({dataHash:p,minByteRange:h-c.byteLength,maxByteRange:h}),r=r.slice(o)}return t.push({dataHash:await F3.default.crypto.hash(r),minByteRange:h,maxByteRange:h+r.byteLength}),t}ai.chunkData=Vx;async function Zx(i){return Promise.all(i.map(async({dataHash:t,minByteRange:r,maxByteRange:h})=>({type:"leaf",id:await wo(await Promise.all([wo(t),wo(Wg(h))])),dataHash:t,minByteRange:r,maxByteRange:h})))}ai.generateLeaves=Zx;async function F8t(i){return(await AQ(i)).id}ai.computeRootHash=F8t;async function AQ(i){return await j3(await Zx(await Vx(i)))}ai.generateTree=AQ;async function j8t(i){let t=await Vx(i),r=await Zx(t),h=await j3(r),o=await TQ(h),l=t.slice(-1)[0];return l.maxByteRange-l.minByteRange===0&&(t.splice(t.length-1,1),o.splice(o.length-1,1)),{data_root:h.id,chunks:t,proofs:o}}ai.generateTransactionChunks=j8t;async function j3(i,t=0){if(i.length<2)return i[0];let r=[];for(let h=0;h<i.length;h+=2)r.push(await z8t(i[h],i[h+1]));return j3(r,t+1)}ai.buildLayers=j3;function TQ(i){let t=Gx(i);return Array.isArray(t)?Jx(t):[t]}ai.generateProofs=TQ;function Gx(i,t=new Uint8Array,r=0){if(i.type=="leaf")return{offset:i.maxByteRange-1,proof:(0,EQ.concatBuffers)([t,i.dataHash,Wg(i.maxByteRange)])};if(i.type=="branch"){let h=(0,EQ.concatBuffers)([t,i.leftChild.id,i.rightChild.id,Wg(i.byteRange)]);return[Gx(i.leftChild,h,r+1),Gx(i.rightChild,h,r+1)]}throw new Error("Unexpected node type")}function Jx(i){let t=[];return i.forEach(r=>{Array.isArray(r)?t.push(...Jx(r)):t.push(r)}),t}ai.arrayFlatten=Jx;async function z8t(i,t){return t?{type:"branch",id:await wo([await wo(i.id),await wo(t.id),await wo(Wg(i.maxByteRange))]),byteRange:i.maxByteRange,maxByteRange:t.maxByteRange,leftChild:i,rightChild:t}:i}async function wo(i){return Array.isArray(i)&&(i=F3.default.utils.concatBuffers(i)),new Uint8Array(await F3.default.crypto.hash(i))}function Wg(i){let t=new Uint8Array(zg);for(var r=t.length-1;r>=0;r--){var h=i%256;t[r]=h,i=(i-h)/256}return t}ai.intToBuffer=Wg;function Xx(i){let t=0;for(var r=0;r<i.length;r++)t*=256,t+=i[r];return t}ai.bufferToInt=Xx;var W8t=(i,t)=>i.every((r,h)=>t[h]===r);ai.arrayCompare=W8t;async function jg(i,t,r,h,o){if(h<=0)return!1;if(t>=h)return jg(i,0,h-1,h,o);if(t<0)return jg(i,0,0,h,o);if(o.length==W1+zg){let v=o.slice(0,W1),M=o.slice(v.length,v.length+zg),T=await wo([await wo(v),await wo(M)]);return(0,ai.arrayCompare)(i,T)?{offset:h-1,leftBound:r,rightBound:h,chunkSize:h-r}:!1}let l=o.slice(0,W1),c=o.slice(l.length,l.length+W1),p=o.slice(l.length+c.length,l.length+c.length+zg),w=Xx(p),m=o.slice(l.length+c.length+p.length),y=await wo([await wo(l),await wo(c),await wo(p)]);return(0,ai.arrayCompare)(i,y)?t<w?await jg(l,t,r,Math.min(h,w),m):await jg(c,t,Math.max(r,w),h,m):!1}ai.validatePath=jg;async function xQ(i,t=""){if(i.byteLength<1)return t;let r=i.slice(0,W1),h=i.slice(r.length,r.length+W1),o=i.slice(r.length+h.length,r.length+h.length+zg),l=Xx(o),c=i.slice(r.length+h.length+o.length),p=await wo([await wo(r),await wo(h),await wo(o)]),w=`${t}
|
|
108
|
-
${JSON.stringify(ge.from(r))},${JSON.stringify(ge.from(h))},${l} => ${JSON.stringify(p)}`;return xQ(c,w)}ai.debug=xQ});var W3=De(Wa=>{"use strict";Tt();Rt();xt();var K8t=Wa&&Wa.__createBinding||(Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]}),H8t=Wa&&Wa.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),G8t=Wa&&Wa.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var r in i)r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)&&K8t(t,i,r);return H8t(t,i),t},V8t=Wa&&Wa.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Wa,"__esModule",{value:!0});Wa.Tag=void 0;var no=G8t(Ru()),Z8t=V8t(SQ()),J8t=Yx(),z3=class{get(t,r){if(!Object.getOwnPropertyNames(this).includes(t))throw new Error(`Field "${t}" is not a property of the Arweave Transaction class.`);if(this[t]instanceof Uint8Array)return r&&r.decode&&r.string?no.bufferToString(this[t]):r&&r.decode&&!r.string?this[t]:no.bufferTob64Url(this[t]);if(this[t]instanceof Array){if(r?.decode!==void 0||r?.string!==void 0)throw t==="tags"&&console.warn(`Did you mean to use 'transaction["tags"]' ?`),new Error("Cannot decode or stringify an array.");return this[t]}return r&&r.decode==!0?r&&r.string?no.b64UrlToString(this[t]):no.b64UrlToBuffer(this[t]):this[t]}},Kg=class extends z3{name;value;constructor(t,r,h=!1){super(),this.name=t,this.value=r}};Wa.Tag=Kg;var Qx=class extends z3{format=2;id="";last_tx="";owner="";tags=[];target="";quantity="0";data_size="0";data=new Uint8Array;data_root="";reward="0";signature="";chunks;constructor(t={}){super(),Object.assign(this,t),typeof this.data=="string"&&(this.data=no.b64UrlToBuffer(this.data)),t.tags&&(this.tags=t.tags.map(r=>new Kg(r.name,r.value)))}addTag(t,r){this.tags.push(new Kg(no.stringToB64Url(t),no.stringToB64Url(r)))}toJSON(){return{format:this.format,id:this.id,last_tx:this.last_tx,owner:this.owner,tags:this.tags,target:this.target,quantity:this.quantity,data:no.bufferTob64Url(this.data),data_size:this.data_size,data_root:this.data_root,data_tree:this.data_tree,reward:this.reward,signature:this.signature}}setOwner(t){this.owner=t}setSignature({id:t,owner:r,reward:h,tags:o,signature:l}){this.id=t,this.owner=r,h&&(this.reward=h),o&&(this.tags=o),this.signature=l}async prepareChunks(t){!this.chunks&&t.byteLength>0&&(this.chunks=await(0,J8t.generateTransactionChunks)(t),this.data_root=no.bufferTob64Url(this.chunks.data_root)),!this.chunks&&t.byteLength===0&&(this.chunks={chunks:[],data_root:new Uint8Array,proofs:[]},this.data_root="")}getChunk(t,r){if(!this.chunks)throw new Error("Chunks have not been prepared");let h=this.chunks.proofs[t],o=this.chunks.chunks[t];return{data_root:this.data_root,data_size:this.data_size,data_path:no.bufferTob64Url(h.proof),offset:h.offset.toString(),chunk:no.bufferTob64Url(r.slice(o.minByteRange,o.maxByteRange))}}async getSignatureData(){switch(this.format){case 1:let t=this.tags.reduce((h,o)=>no.concatBuffers([h,o.get("name",{decode:!0,string:!1}),o.get("value",{decode:!0,string:!1})]),new Uint8Array);return no.concatBuffers([this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),this.get("data",{decode:!0,string:!1}),no.stringToBuffer(this.quantity),no.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),t]);case 2:this.data_root||await this.prepareChunks(this.data);let r=this.tags.map(h=>[h.get("name",{decode:!0,string:!1}),h.get("value",{decode:!0,string:!1})]);return await(0,Z8t.default)([no.stringToBuffer(this.format.toString()),this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),no.stringToBuffer(this.quantity),no.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),r,no.stringToBuffer(this.data_size),this.get("data_root",{decode:!0,string:!1})]);default:throw new Error(`Unexpected transaction format: ${this.format}`)}}};Wa.default=Qx});var BQ=De(Hs=>{"use strict";Tt();Rt();xt();var X8t=Hs&&Hs.__createBinding||(Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]}),Y8t=Hs&&Hs.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),Q8t=Hs&&Hs.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var r in i)r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)&&X8t(t,i,r);return Y8t(t,i),t},t4t=Hs&&Hs.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Hs,"__esModule",{value:!0});Hs.TransactionUploader=void 0;var RQ=t4t(W3()),e4t=Q8t(Ru()),tR=qg(),r4t=Yx(),kQ=1,i4t=["invalid_json","chunk_too_big","data_path_too_big","offset_too_big","data_size_too_big","chunk_proof_ratio_not_attractive","invalid_proof"],IQ=1e3*40,eR=class i{api;chunkIndex=0;txPosted=!1;transaction;lastRequestTimeEnd=0;totalErrors=0;data;lastResponseStatus=0;lastResponseError="";get isComplete(){return this.txPosted&&this.chunkIndex===this.transaction.chunks.chunks.length}get totalChunks(){return this.transaction.chunks.chunks.length}get uploadedChunks(){return this.chunkIndex}get pctComplete(){return Math.trunc(this.uploadedChunks/this.totalChunks*100)}constructor(t,r){if(this.api=t,!r.id)throw new Error("Transaction is not signed");if(!r.chunks)throw new Error("Transaction chunks not prepared");this.data=r.data,this.transaction=new RQ.default(Object.assign({},r,{data:new Uint8Array(0)}))}async uploadChunk(t){if(this.isComplete)throw new Error("Upload is already complete");if(this.lastResponseError!==""?this.totalErrors++:this.totalErrors=0,this.totalErrors===100)throw new Error(`Unable to complete upload: ${this.lastResponseStatus}: ${this.lastResponseError}`);let r=this.lastResponseError===""?0:Math.max(this.lastRequestTimeEnd+IQ-Date.now(),IQ);if(r>0&&(r=r-r*Math.random()*.3,await new Promise(c=>setTimeout(c,r))),this.lastResponseError="",!this.txPosted){await this.postTransaction();return}t&&(this.chunkIndex=t);let h=this.transaction.getChunk(t||this.chunkIndex,this.data);if(!await(0,r4t.validatePath)(this.transaction.chunks.data_root,parseInt(h.offset),0,parseInt(h.data_size),e4t.b64UrlToBuffer(h.data_path)))throw new Error(`Unable to validate chunk ${this.chunkIndex}`);let l=await this.api.post("chunk",this.transaction.getChunk(this.chunkIndex,this.data)).catch(c=>(console.error(c.message),{status:-1,data:{error:c.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=l.status,this.lastResponseStatus==200)this.chunkIndex++;else if(this.lastResponseError=(0,tR.getError)(l),i4t.includes(this.lastResponseError))throw new Error(`Fatal error uploading chunk ${this.chunkIndex}: ${this.lastResponseError}`)}static async fromSerialized(t,r,h){if(!r||typeof r.chunkIndex!="number"||typeof r.transaction!="object")throw new Error("Serialized object does not match expected format.");var o=new RQ.default(r.transaction);o.chunks||await o.prepareChunks(h);let l=new i(t,o);if(l.chunkIndex=r.chunkIndex,l.lastRequestTimeEnd=r.lastRequestTimeEnd,l.lastResponseError=r.lastResponseError,l.lastResponseStatus=r.lastResponseStatus,l.txPosted=r.txPosted,l.data=h,l.transaction.data_root!==r.transaction.data_root)throw new Error("Data mismatch: Uploader doesn't match provided data.");return l}static async fromTransactionId(t,r){let h=await t.get(`tx/${r}`);if(h.status!==200)throw new Error(`Tx ${r} not found: ${h.status}`);let o=h.data;return o.data=new Uint8Array(0),{txPosted:!0,chunkIndex:0,lastResponseError:"",lastRequestTimeEnd:0,lastResponseStatus:0,transaction:o}}toJSON(){return{chunkIndex:this.chunkIndex,transaction:this.transaction,lastRequestTimeEnd:this.lastRequestTimeEnd,lastResponseStatus:this.lastResponseStatus,lastResponseError:this.lastResponseError,txPosted:this.txPosted}}async postTransaction(){if(this.totalChunks<=kQ){this.transaction.data=this.data;let h=await this.api.post("tx",this.transaction).catch(o=>(console.error(o),{status:-1,data:{error:o.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=h.status,this.transaction.data=new Uint8Array(0),h.status>=200&&h.status<300){this.txPosted=!0,this.chunkIndex=kQ;return}throw this.lastResponseError=(0,tR.getError)(h),new Error(`Unable to upload transaction: ${h.status}, ${this.lastResponseError}`)}let r=await this.api.post("tx",this.transaction);if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=r.status,!(r.status>=200&&r.status<300))throw this.lastResponseError=(0,tR.getError)(r),new Error(`Unable to upload transaction: ${r.status}, ${this.lastResponseError}`);this.txPosted=!0}};Hs.TransactionUploader=eR});var k0=De((tWt,OQ)=>{"use strict";Tt();Rt();xt();OQ.exports={}});var PQ=De(qh=>{"use strict";Tt();Rt();xt();var n4t=qh&&qh.__createBinding||(Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]}),o4t=qh&&qh.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),a4t=qh&&qh.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var r in i)r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)&&n4t(t,i,r);return o4t(t,i),t},CQ=qh&&qh.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(qh,"__esModule",{value:!0});var rR=CQ(qg()),ku=CQ(W3()),Hg=a4t(Ru()),iR=BQ();k0();var nR=class{api;crypto;chunks;constructor(t,r,h){this.api=t,this.crypto=r,this.chunks=h}async getTransactionAnchor(){let t=await this.api.get("tx_anchor");if(!t.data.match(/^[a-z0-9_-]{43,}/i)||!t.ok)throw new Error(`Could not getTransactionAnchor. Received: ${t.data}. Status: ${t.status}, ${t.statusText}`);return t.data}async getPrice(t,r){let h=r?`price/${t}/${r}`:`price/${t}`,o=await this.api.get(h);if(!/^\d+$/.test(o.data)||!o.ok)throw new Error(`Could not getPrice. Received: ${o.data}. Status: ${o.status}, ${o.statusText}`);return o.data}async get(t){let r=await this.api.get(`tx/${t}`);if(r.status==200){let h=parseInt(r.data.data_size);if(r.data.format>=2&&h>0&&h<=1024*1024*12){let o=await this.getData(t);return new ku.default({...r.data,data:o})}return new ku.default({...r.data,format:r.data.format||1})}throw r.status==404?new rR.default("TX_NOT_FOUND"):r.status==410?new rR.default("TX_FAILED"):new rR.default("TX_INVALID")}fromRaw(t){return new ku.default(t)}async search(t,r){return this.api.post("arql",{op:"equals",expr1:t,expr2:r}).then(h=>h.data?h.data:[])}getStatus(t){return this.api.get(`tx/${t}/status`).then(r=>r.status==200?{status:200,confirmed:r.data}:{status:r.status,confirmed:null})}async getData(t,r){let h;try{h=await this.chunks.downloadChunkedData(t)}catch(o){console.error(`Error while trying to download chunked data for ${t}`),console.error(o)}if(!h){console.warn(`Falling back to gateway cache for ${t}`);try{let{data:o,ok:l,status:c,statusText:p}=await this.api.get(`/${t}`,{responseType:"arraybuffer"});if(!l)throw new Error("Bad http status code",{cause:{status:c,statusText:p}});h=o}catch(o){console.error(`Error while trying to download contiguous data from gateway cache for ${t}`),console.error(o)}}if(!h)throw new Error(`${t} data was not found!`);return r&&r.decode&&!r.string?h:r&&r.decode&&r.string?Hg.bufferToString(h):Hg.bufferTob64Url(h)}async sign(t,r,h){let l=typeof r=="object"&&(p=>{let w=!0;return["n","e","d","p","q","dp","dq","qi"].map(m=>!(m in p)&&(w=!1)),w})(r),c=typeof arweaveWallet=="object";if(!l&&!c)throw new Error("No valid JWK or external wallet found to sign transaction.");if(l){t.setOwner(r.n);let p=await t.getSignatureData(),w=await this.crypto.sign(r,p,h),m=await this.crypto.hash(w);t.setSignature({id:Hg.bufferTob64Url(m),owner:r.n,signature:Hg.bufferTob64Url(w)})}else if(c){try{(await arweaveWallet.getPermissions()).includes("SIGN_TRANSACTION")||await arweaveWallet.connect(["SIGN_TRANSACTION"])}catch{}let p=await arweaveWallet.sign(t,h);t.setSignature({id:p.id,owner:p.owner,reward:p.reward,tags:p.tags,signature:p.signature})}else throw new Error("An error occurred while signing. Check wallet is valid")}async verify(t){let r=await t.getSignatureData(),h=t.get("signature",{decode:!0,string:!1}),o=Hg.bufferTob64Url(await this.crypto.hash(h));if(t.id!==o)throw new Error("Invalid transaction signature or ID! The transaction ID doesn't match the expected SHA-256 hash of the signature.");return this.crypto.verify(t.owner,r,h)}async post(t){if(typeof t=="string"?t=new ku.default(JSON.parse(t)):typeof t.readInt32BE=="function"?t=new ku.default(JSON.parse(t.toString())):typeof t=="object"&&!(t instanceof ku.default)&&(t=new ku.default(t)),!(t instanceof ku.default))throw new Error("Must be Transaction object");t.chunks||await t.prepareChunks(t.data);let r=await this.getUploader(t,t.data);try{for(;!r.isComplete;)await r.uploadChunk()}catch(h){if(r.lastResponseStatus>0)return{status:r.lastResponseStatus,statusText:r.lastResponseError,data:{error:r.lastResponseError}};throw h}return{status:200,statusText:"OK",data:{}}}async getUploader(t,r){let h;if(r instanceof ArrayBuffer&&(r=new Uint8Array(r)),t instanceof ku.default){if(r||(r=t.data),!(r instanceof Uint8Array))throw new Error("Data format is invalid");t.chunks||await t.prepareChunks(r),h=new iR.TransactionUploader(this.api,t),(!h.data||h.data.length===0)&&(h.data=r)}else{if(typeof t=="string"&&(t=await iR.TransactionUploader.fromTransactionId(this.api,t)),!r||!(r instanceof Uint8Array))throw new Error("Must provide data when resuming upload");h=await iR.TransactionUploader.fromSerialized(this.api,t,r)}return h}async*upload(t,r){let h=await this.getUploader(t,r);for(;!h.isComplete;)await h.uploadChunk(),yield h;return h}};qh.default=nR});var LQ=De(Iu=>{"use strict";Tt();Rt();xt();var s4t=Iu&&Iu.__createBinding||(Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]}),h4t=Iu&&Iu.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),f4t=Iu&&Iu.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var r in i)r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)&&s4t(t,i,r);return h4t(t,i),t};Object.defineProperty(Iu,"__esModule",{value:!0});var NQ=f4t(Ru());k0();var oR=class{api;crypto;constructor(t,r){this.api=t,this.crypto=r}getBalance(t){return this.api.get(`wallet/${t}/balance`).then(r=>r.data)}getLastTransactionID(t){return this.api.get(`wallet/${t}/last_tx`).then(r=>r.data)}generate(){return this.crypto.generateJWK()}async jwkToAddress(t){return!t||t==="use_wallet"?this.getAddress():this.getAddress(t)}async getAddress(t){if(!t||t==="use_wallet"){try{await arweaveWallet.connect(["ACCESS_ADDRESS"])}catch{}return arweaveWallet.getActiveAddress()}else return this.ownerToAddress(t.n)}async ownerToAddress(t){return NQ.bufferTob64Url(await this.crypto.hash(NQ.b64UrlToBuffer(t)))}};Iu.default=oR});var $Q=De(Fh=>{"use strict";Tt();Rt();xt();var u4t=Fh&&Fh.__createBinding||(Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]}),c4t=Fh&&Fh.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),l4t=Fh&&Fh.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var r in i)r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)&&u4t(t,i,r);return c4t(t,i),t};Object.defineProperty(Fh,"__esModule",{value:!0});Fh.SiloResource=void 0;var DQ=l4t(Ru()),aR=class{api;crypto;transactions;constructor(t,r,h){this.api=t,this.crypto=r,this.transactions=h}async get(t){if(!t)throw new Error("No Silo URI specified");let r=await this.parseUri(t),h=await this.transactions.search("Silo-Name",r.getAccessKey());if(h.length==0)throw new Error(`No data could be found for the Silo URI: ${t}`);let o=await this.transactions.get(h[0]);if(!o)throw new Error(`No data could be found for the Silo URI: ${t}`);let l=o.get("data",{decode:!0,string:!1});return this.crypto.decrypt(l,r.getEncryptionKey())}async readTransactionData(t,r){if(!r)throw new Error("No Silo URI specified");let h=await this.parseUri(r),o=t.get("data",{decode:!0,string:!1});return this.crypto.decrypt(o,h.getEncryptionKey())}async parseUri(t){let r=t.match(/^([a-z0-9-_]+)\.([0-9]+)/i);if(!r)throw new Error("Invalid Silo name, must be a name in the format of [a-z0-9]+.[0-9]+, e.g. 'bubble.7'");let h=r[1],o=Math.pow(2,parseInt(r[2])),l=await this.hash(DQ.stringToBuffer(h),o),c=DQ.bufferTob64(l.slice(0,15)),p=await this.hash(l.slice(16,31),1);return new K3(t,c,p)}async hash(t,r){let h=await this.crypto.hash(t);for(let o=0;o<r-1;o++)h=await this.crypto.hash(h);return h}};Fh.default=aR;var K3=class{uri;accessKey;encryptionKey;constructor(t,r,h){this.uri=t,this.accessKey=r,this.encryptionKey=h}getUri(){return this.uri}getAccessKey(){return this.accessKey}getEncryptionKey(){return this.encryptionKey}};Fh.SiloResource=K3});var qQ=De(Bu=>{"use strict";Tt();Rt();xt();var d4t=Bu&&Bu.__createBinding||(Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]}),p4t=Bu&&Bu.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),g4t=Bu&&Bu.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var r in i)r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)&&d4t(t,i,r);return p4t(t,i),t};Object.defineProperty(Bu,"__esModule",{value:!0});var UQ=qg(),m4t=g4t(Ru()),sR=class{api;constructor(t){this.api=t}async getTransactionOffset(t){let r=await this.api.get(`tx/${t}/offset`);if(r.status===200)return r.data;throw new Error(`Unable to get transaction offset: ${(0,UQ.getError)(r)}`)}async getChunk(t){let r=await this.api.get(`chunk/${t}`);if(r.status===200)return r.data;throw new Error(`Unable to get chunk: ${(0,UQ.getError)(r)}`)}async getChunkData(t){let r=await this.getChunk(t);return m4t.b64UrlToBuffer(r.chunk)}firstChunkOffset(t){return parseInt(t.offset)-parseInt(t.size)+1}async downloadChunkedData(t){let r=await this.getTransactionOffset(t),h=parseInt(r.size),l=parseInt(r.offset)-h+1,c=new Uint8Array(h),p=0;for(;p<h;){this.api.config.logging&&console.log(`[chunk] ${p}/${h}`);let w;try{w=await this.getChunkData(l+p)}catch{console.error(`[chunk] Failed to fetch chunk at offset ${l+p}`),console.error("[chunk] This could indicate that the chunk wasn't uploaded or hasn't yet seeded properly to a particular gateway/node")}if(w)c.set(w,p),p+=w.length;else throw new Error(`Couldn't complete data download at ${p}/${h}`)}return c}};Bu.default=sR});var jQ=De(Gg=>{"use strict";Tt();Rt();xt();var v4t=Gg&&Gg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Gg,"__esModule",{value:!0});var FQ=v4t(qg());k0();var hR=class i{api;network;static HASH_ENDPOINT="block/hash/";static HEIGHT_ENDPOINT="block/height/";constructor(t,r){this.api=t,this.network=r}async get(t){let r=await this.api.get(`${i.HASH_ENDPOINT}${t}`);if(r.status===200)return r.data;throw r.status===404?new FQ.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${r}`)}async getByHeight(t){let r=await this.api.get(`${i.HEIGHT_ENDPOINT}${t}`);if(r.status===200)return r.data;throw r.status===404?new FQ.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${r}`)}async getCurrent(){let{current:t}=await this.network.getInfo();return await this.get(t)}};Gg.default=hR});var q3=De(jh=>{"use strict";Tt();Rt();xt();var y4t=jh&&jh.__createBinding||(Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]}),b4t=jh&&jh.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),w4t=jh&&jh.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var r in i)r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)&&y4t(t,i,r);return b4t(t,i),t},Bf=jh&&jh.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(jh,"__esModule",{value:!0});var _4t=Bf(lF()),M4t=Bf(dF()),S4t=Bf(fQ()),E4t=Bf(uQ()),A4t=Bf(PQ()),T4t=Bf(LQ()),zQ=Bf(W3()),Vg=w4t(Ru()),x4t=Bf($Q()),R4t=Bf(qQ()),k4t=Bf(jQ()),fR=class i{api;wallets;transactions;network;blocks;ar;silo;chunks;static init;static crypto=new S4t.default;static utils=Vg;constructor(t){this.api=new M4t.default(t),this.wallets=new T4t.default(this.api,i.crypto),this.chunks=new R4t.default(this.api),this.transactions=new A4t.default(this.api,i.crypto,this.chunks),this.silo=new x4t.default(this.api,this.crypto,this.transactions),this.network=new E4t.default(this.api),this.blocks=new k4t.default(this.api,this.network),this.ar=new _4t.default}get crypto(){return i.crypto}get utils(){return i.utils}getConfig(){return{api:this.api.getConfig(),crypto:null}}async createTransaction(t,r){let h={};if(Object.assign(h,t),!t.data&&!(t.target&&t.quantity))throw new Error("A new Arweave transaction must have a 'data' value, or 'target' and 'quantity' values.");if(t.owner==null&&r&&r!=="use_wallet"&&(h.owner=r.n),t.last_tx==null&&(h.last_tx=await this.transactions.getTransactionAnchor()),typeof t.data=="string"&&(t.data=Vg.stringToBuffer(t.data)),t.data instanceof ArrayBuffer&&(t.data=new Uint8Array(t.data)),t.data&&!(t.data instanceof Uint8Array))throw new Error("Expected data to be a string, Uint8Array or ArrayBuffer");if(t.reward==null){let l=t.data?t.data.byteLength:0;h.reward=await this.transactions.getPrice(l,h.target)}h.data_root="",h.data_size=t.data?t.data.byteLength.toString():"0",h.data=t.data||new Uint8Array(0);let o=new zQ.default(h);return await o.getSignatureData(),o}async createSiloTransaction(t,r,h){let o={};if(Object.assign(o,t),!t.data)throw new Error("Silo transactions must have a 'data' value");if(!h)throw new Error("No Silo URI specified.");if(t.target||t.quantity)throw new Error("Silo transactions can only be used for storing data, sending AR to other wallets isn't supported.");if(t.owner==null){if(!r||!r.n)throw new Error("A new Arweave transaction must either have an 'owner' attribute, or you must provide the jwk parameter.");o.owner=r.n}t.last_tx==null&&(o.last_tx=await this.transactions.getTransactionAnchor());let l=await this.silo.parseUri(h);if(typeof t.data=="string"){let p=await this.crypto.encrypt(Vg.stringToBuffer(t.data),l.getEncryptionKey());o.reward=await this.transactions.getPrice(p.byteLength),o.data=Vg.bufferTob64Url(p)}if(t.data instanceof Uint8Array){let p=await this.crypto.encrypt(t.data,l.getEncryptionKey());o.reward=await this.transactions.getPrice(p.byteLength),o.data=Vg.bufferTob64Url(p)}let c=new zQ.default(o);return c.addTag("Silo-Name",l.getAccessKey()),c.addTag("Silo-Version","0.1.0"),c}arql(t){return this.api.post("/arql",t).then(r=>r.data||[])}};jh.default=fR});var lR=De((cR,WQ)=>{"use strict";Tt();Rt();xt();var I4t=cR&&cR.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},uR=I4t(q3());uR.default.init=function(i={}){return new uR.default(i)};WQ.exports=uR.default});var fk=De(q0=>{"use strict";Tt();Rt();xt();Object.defineProperty(q0,"__esModule",{value:!0});q0.lvlToOrder=q0.LogLevelOrder=void 0;q0.LogLevelOrder={silly:0,trace:1,debug:2,info:3,warn:4,error:5,fatal:6,none:7};function VMt(i){return q0.LogLevelOrder[i]}q0.lvlToOrder=VMt});var ck=De(T8=>{"use strict";Tt();Rt();xt();Object.defineProperty(T8,"__esModule",{value:!0});T8.ConsoleLogger=void 0;var Det=fk(),uk=class{constructor(t,r){this.moduleName=t,this.settings=r}trace(t,...r){this.shouldLog("trace")&&console.debug(this.message("trace",t),r)}error(t,...r){this.shouldLog("error")&&console.error(this.message("error",t),r)}info(t,...r){this.shouldLog("info")&&console.info(this.message("info",t),r)}silly(t,...r){this.shouldLog("silly")&&console.debug(this.message("silly",t),r)}debug(t,...r){this.shouldLog("debug")&&console.debug(this.message("debug",t),r)}warn(t,...r){this.shouldLog("warn")&&console.warn(this.message("warn",t),r)}log(t,...r){this.shouldLog("info")&&console.info(this.message("info",t),r)}fatal(t,...r){this.shouldLog("fatal")&&console.error(this.message("fatal",t),r)}shouldLog(t){return(0,Det.lvlToOrder)(t)>=(0,Det.lvlToOrder)(this.settings.minLevel)}setSettings(t){this.settings=t}message(t,r){return`${new Date().toISOString()} ${t.toUpperCase()} [${this.moduleName}] ${r}`}};T8.ConsoleLogger=uk});var dk=De(x8=>{"use strict";Tt();Rt();xt();Object.defineProperty(x8,"__esModule",{value:!0});x8.ConsoleLoggerFactory=void 0;var ZMt=ck(),lk=class{constructor(){this.registeredLoggers={},this.registeredOptions={},this.defOptions={minLevel:"info"},this.setOptions=this.setOptions.bind(this),this.getOptions=this.getOptions.bind(this),this.create=this.create.bind(this),this.logLevel=this.logLevel.bind(this)}setOptions(t,r){r?this.registeredLoggers[r]?this.registeredLoggers[r].setSettings({...this.registeredLoggers[r].settings,...t}):this.registeredOptions[r]={...this.defOptions,...t}:(this.defOptions=t,Object.keys(this.registeredLoggers).forEach(h=>{this.registeredLoggers[h].setSettings({...this.registeredLoggers[h].settings,...t})}))}getOptions(t){return t?this.registeredLoggers[t]?this.registeredLoggers[t].settings:this.registeredOptions[t]?this.registeredOptions[t]:this.defOptions:this.defOptions}logLevel(t,r){this.setOptions({minLevel:t},r)}create(t="SWC"){return Object.prototype.hasOwnProperty.call(this.registeredLoggers,t)||(this.registeredLoggers[t]=new ZMt.ConsoleLogger(t,this.getOptions(t))),this.registeredLoggers[t]}};x8.ConsoleLoggerFactory=lk});var Uet=De($et=>{"use strict";Tt();Rt();xt();Object.defineProperty($et,"__esModule",{value:!0})});var bn=De(k8=>{"use strict";Tt();Rt();xt();Object.defineProperty(k8,"__esModule",{value:!0});k8.LoggerFactory=void 0;var JMt=dk(),R8=class i{constructor(){}setOptions(t,r){i.INST.setOptions(t,r)}getOptions(t){return i.INST.getOptions(t)}logLevel(t,r){i.INST.logLevel(t,r)}create(t){return i.INST.create(t)}static use(t){i.INST=t}};k8.LoggerFactory=R8;R8.INST=new JMt.ConsoleLoggerFactory});var Qs=De(I8=>{"use strict";Tt();Rt();xt();Object.defineProperty(I8,"__esModule",{value:!0});I8.Benchmark=void 0;var pk=class i{static measure(){return new i}constructor(){this.start=Date.now(),this.end=null}reset(){this.start=Date.now(),this.end=null}stop(){this.end=Date.now()}elapsed(t=!1){this.end===null&&(this.end=Date.now());let r=this.end-this.start;return t?r:`${(this.end-this.start).toFixed(0)}ms`}};I8.Benchmark=pk});var Fet=De(qet=>{"use strict";Tt();Rt();xt();Object.defineProperty(qet,"__esModule",{value:!0})});var $u=De(ap=>{"use strict";Tt();Rt();xt();Object.defineProperty(ap,"__esModule",{value:!0});ap.SortKeyCacheResult=ap.CacheKey=void 0;var gk=class{constructor(t,r){this.key=t,this.sortKey=r}};ap.CacheKey=gk;var mk=class{constructor(t,r){this.sortKey=t,this.cachedValue=r}};ap.SortKeyCacheResult=mk});var zet=De(jet=>{"use strict";Tt();Rt();xt();Object.defineProperty(jet,"__esModule",{value:!0})});var Ket=De(Wet=>{"use strict";Tt();Rt();xt();Wet.supports=function(...t){let r=t.reduce((h,o)=>Object.assign(h,o),{});return Object.assign(r,{snapshots:r.snapshots||!1,permanence:r.permanence||!1,seek:r.seek||!1,clear:r.clear||!1,getMany:r.getMany||!1,keyIterator:r.keyIterator||!1,valueIterator:r.valueIterator||!1,iteratorNextv:r.iteratorNextv||!1,iteratorAll:r.iteratorAll||!1,status:r.status||!1,createIfMissing:r.createIfMissing||!1,errorIfExists:r.errorIfExists||!1,deferredOpen:r.deferredOpen||!1,promises:r.promises||!1,streams:r.streams||!1,encodings:Object.assign({},r.encodings),events:Object.assign({},r.events),additionalMethods:Object.assign({},r.additionalMethods)})}});var th=De((xVt,Het)=>{"use strict";Tt();Rt();xt();Het.exports=class extends Error{constructor(t,r){super(t||""),typeof r=="object"&&r!==null&&(r.code&&(this.code=String(r.code)),r.expected&&(this.expected=!0),r.transient&&(this.transient=!0),r.cause&&(this.cause=r.cause)),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}});var yk=De((BVt,Get)=>{"use strict";Tt();Rt();xt();var vk=null;Get.exports=function(){return vk===null&&(vk={textEncoder:new TextEncoder,textDecoder:new TextDecoder}),vk}});var _k=De(Vet=>{"use strict";Tt();Rt();xt();var bk=th(),XMt=new Set(["buffer","view","utf8"]),wk=class{constructor(t){if(this.encode=t.encode||this.encode,this.decode=t.decode||this.decode,this.name=t.name||this.name,this.format=t.format||this.format,typeof this.encode!="function")throw new TypeError("The 'encode' property must be a function");if(typeof this.decode!="function")throw new TypeError("The 'decode' property must be a function");if(this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),typeof this.name!="string"||this.name==="")throw new TypeError("The 'name' property must be a string");if(typeof this.format!="string"||!XMt.has(this.format))throw new TypeError("The 'format' property must be one of 'buffer', 'view', 'utf8'");t.createViewTranscoder&&(this.createViewTranscoder=t.createViewTranscoder),t.createBufferTranscoder&&(this.createBufferTranscoder=t.createBufferTranscoder),t.createUTF8Transcoder&&(this.createUTF8Transcoder=t.createUTF8Transcoder)}get commonName(){return this.name.split("+")[0]}createBufferTranscoder(){throw new bk(`Encoding '${this.name}' cannot be transcoded to 'buffer'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createViewTranscoder(){throw new bk(`Encoding '${this.name}' cannot be transcoded to 'view'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createUTF8Transcoder(){throw new bk(`Encoding '${this.name}' cannot be transcoded to 'utf8'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}};Vet.Encoding=wk});var Ak=De(B8=>{"use strict";Tt();Rt();xt();var{Buffer:Sk}=(af(),Dn(uc))||{},{Encoding:Ek}=_k(),YMt=yk(),Tm=class extends Ek{constructor(t){super({...t,format:"buffer"})}createViewTranscoder(){return new xm({encode:this.encode,decode:t=>this.decode(Sk.from(t.buffer,t.byteOffset,t.byteLength)),name:`${this.name}+view`})}createBufferTranscoder(){return this}},xm=class extends Ek{constructor(t){super({...t,format:"view"})}createBufferTranscoder(){return new Tm({encode:t=>{let r=this.encode(t);return Sk.from(r.buffer,r.byteOffset,r.byteLength)},decode:this.decode,name:`${this.name}+buffer`})}createViewTranscoder(){return this}},Mk=class extends Ek{constructor(t){super({...t,format:"utf8"})}createBufferTranscoder(){return new Tm({encode:t=>Sk.from(this.encode(t),"utf8"),decode:t=>this.decode(t.toString("utf8")),name:`${this.name}+buffer`})}createViewTranscoder(){let{textEncoder:t,textDecoder:r}=YMt();return new xm({encode:h=>t.encode(this.encode(h)),decode:h=>this.decode(r.decode(h)),name:`${this.name}+view`})}createUTF8Transcoder(){return this}};B8.BufferFormat=Tm;B8.ViewFormat=xm;B8.UTF8Format=Mk});var Yet=De(F0=>{"use strict";Tt();Rt();xt();var{Buffer:Go}=(af(),Dn(uc))||{Buffer:{isBuffer:()=>!1}},{textEncoder:Jet,textDecoder:Zet}=yk()(),{BufferFormat:Rm,ViewFormat:Tk,UTF8Format:Xet}=Ak(),O8=i=>i;F0.utf8=new Xet({encode:function(i){return Go.isBuffer(i)?i.toString("utf8"):ArrayBuffer.isView(i)?Zet.decode(i):String(i)},decode:O8,name:"utf8",createViewTranscoder(){return new Tk({encode:function(i){return ArrayBuffer.isView(i)?i:Jet.encode(i)},decode:function(i){return Zet.decode(i)},name:`${this.name}+view`})},createBufferTranscoder(){return new Rm({encode:function(i){return Go.isBuffer(i)?i:ArrayBuffer.isView(i)?Go.from(i.buffer,i.byteOffset,i.byteLength):Go.from(String(i),"utf8")},decode:function(i){return i.toString("utf8")},name:`${this.name}+buffer`})}});F0.json=new Xet({encode:JSON.stringify,decode:JSON.parse,name:"json"});F0.buffer=new Rm({encode:function(i){return Go.isBuffer(i)?i:ArrayBuffer.isView(i)?Go.from(i.buffer,i.byteOffset,i.byteLength):Go.from(String(i),"utf8")},decode:O8,name:"buffer",createViewTranscoder(){return new Tk({encode:function(i){return ArrayBuffer.isView(i)?i:Go.from(String(i),"utf8")},decode:function(i){return Go.from(i.buffer,i.byteOffset,i.byteLength)},name:`${this.name}+view`})}});F0.view=new Tk({encode:function(i){return ArrayBuffer.isView(i)?i:Jet.encode(i)},decode:O8,name:"view",createBufferTranscoder(){return new Rm({encode:function(i){return Go.isBuffer(i)?i:ArrayBuffer.isView(i)?Go.from(i.buffer,i.byteOffset,i.byteLength):Go.from(String(i),"utf8")},decode:O8,name:`${this.name}+buffer`})}});F0.hex=new Rm({encode:function(i){return Go.isBuffer(i)?i:Go.from(String(i),"hex")},decode:function(i){return i.toString("hex")},name:"hex"});F0.base64=new Rm({encode:function(i){return Go.isBuffer(i)?i:Go.from(String(i),"base64")},decode:function(i){return i.toString("base64")},name:"base64"})});var ert=De(trt=>{"use strict";Tt();Rt();xt();var Qet=th(),P8=Yet(),{Encoding:QMt}=_k(),{BufferFormat:tSt,ViewFormat:eSt,UTF8Format:rSt}=Ak(),km=Symbol("formats"),C8=Symbol("encodings"),iSt=new Set(["buffer","view","utf8"]),xk=class{constructor(t){if(Array.isArray(t)){if(!t.every(r=>iSt.has(r)))throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}else throw new TypeError("The first argument 'formats' must be an array");this[C8]=new Map,this[km]=new Set(t);for(let r in P8)try{this.encoding(r)}catch(h){if(h.code!=="LEVEL_ENCODING_NOT_SUPPORTED")throw h}}encodings(){return Array.from(new Set(this[C8].values()))}encoding(t){let r=this[C8].get(t);if(r===void 0){if(typeof t=="string"&&t!==""){if(r=sSt[t],!r)throw new Qet(`Encoding '${t}' is not found`,{code:"LEVEL_ENCODING_NOT_FOUND"})}else{if(typeof t!="object"||t===null)throw new TypeError("First argument 'encoding' must be a string or object");r=nSt(t)}let{name:h,format:o}=r;if(!this[km].has(o))if(this[km].has("view"))r=r.createViewTranscoder();else if(this[km].has("buffer"))r=r.createBufferTranscoder();else if(this[km].has("utf8"))r=r.createUTF8Transcoder();else throw new Qet(`Encoding '${h}' cannot be transcoded`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"});for(let l of[t,h,r.name,r.commonName])this[C8].set(l,r)}return r}};trt.Transcoder=xk;function nSt(i){if(i instanceof QMt)return i;let t="type"in i&&typeof i.type=="string"?i.type:void 0,r=i.name||t||`anonymous-${hSt++}`;switch(oSt(i)){case"view":return new eSt({...i,name:r});case"utf8":return new rSt({...i,name:r});case"buffer":return new tSt({...i,name:r});default:throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}}function oSt(i){return"format"in i&&i.format!==void 0?i.format:"buffer"in i&&typeof i.buffer=="boolean"?i.buffer?"buffer":"utf8":"code"in i&&Number.isInteger(i.code)?"view":"buffer"}var aSt={binary:P8.buffer,"utf-8":P8.utf8},sSt={...P8,...aSt},hSt=0});var irt=De((XVt,rrt)=>{"use strict";Tt();Rt();xt();rrt.exports=typeof queueMicrotask=="function"?queueMicrotask:i=>Promise.resolve().then(i)});var Im=De(Rk=>{"use strict";Tt();Rt();xt();var nrt=irt();Rk.fromCallback=function(i,t){if(i===void 0){var r=new Promise(function(h,o){i=function(l,c){l?o(l):h(c)}});i[t!==void 0?t:"promise"]=r}else if(typeof i!="function")throw new TypeError("Callback must be a function");return i};Rk.fromPromise=function(i,t){if(t===void 0)return i;i.then(function(r){nrt(()=>t(null,r))}).catch(function(r){nrt(()=>t(r))})}});var N8=De(kk=>{"use strict";Tt();Rt();xt();kk.getCallback=function(i,t){return typeof i=="function"?i:t};kk.getOptions=function(i,t){return typeof i=="object"&&i!==null?i:t!==void 0?t:{}}});var al=De(U8=>{"use strict";Tt();Rt();xt();var{fromCallback:Ik}=Im(),Ha=th(),{getOptions:Bk,getCallback:ort}=N8(),j0=Symbol("promise"),sp=Symbol("callback"),Nf=Symbol("working"),z0=Symbol("handleOne"),Uu=Symbol("handleMany"),Ok=Symbol("autoClose"),nl=Symbol("finishWork"),Lf=Symbol("returnMany"),el=Symbol("closing"),Bm=Symbol("handleClose"),L8=Symbol("closed"),Om=Symbol("closeCallbacks"),il=Symbol("keyEncoding"),W0=Symbol("valueEncoding"),Ck=Symbol("abortOnClose"),D8=Symbol("legacy"),Pk=Symbol("keys"),Nk=Symbol("values"),rl=Symbol("limit"),eh=Symbol("count"),$8=Object.freeze({}),fSt=()=>{},art=!1,Cm=class{constructor(t,r,h){if(typeof t!="object"||t===null){let o=t===null?"null":typeof t;throw new TypeError(`The first argument must be an abstract-level database, received ${o}`)}if(typeof r!="object"||r===null)throw new TypeError("The second argument must be an options object");this[L8]=!1,this[Om]=[],this[Nf]=!1,this[el]=!1,this[Ok]=!1,this[sp]=null,this[z0]=this[z0].bind(this),this[Uu]=this[Uu].bind(this),this[Bm]=this[Bm].bind(this),this[il]=r[il],this[W0]=r[W0],this[D8]=h,this[rl]=Number.isInteger(r.limit)&&r.limit>=0?r.limit:1/0,this[eh]=0,this[Ck]=!!r.abortOnClose,this.db=t,this.db.attachResource(this),this.nextTick=t.nextTick}get count(){return this[eh]}get limit(){return this[rl]}next(t){let r;if(t===void 0)r=new Promise((h,o)=>{t=(l,c,p)=>{l?o(l):this[D8]?c===void 0&&p===void 0?h():h([c,p]):h(c)}});else if(typeof t!="function")throw new TypeError("Callback must be a function");return this[el]?this.nextTick(t,new Ha("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Nf]?this.nextTick(t,new Ha("Iterator is busy: cannot call next() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[Nf]=!0,this[sp]=t,this[eh]>=this[rl]?this.nextTick(this[z0],null):this._next(this[z0])),r}_next(t){this.nextTick(t)}nextv(t,r,h){return h=ort(r,h),h=Ik(h,j0),r=Bk(r,$8),Number.isInteger(t)?(this[el]?this.nextTick(h,new Ha("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Nf]?this.nextTick(h,new Ha("Iterator is busy: cannot call nextv() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(t<1&&(t=1),this[rl]<1/0&&(t=Math.min(t,this[rl]-this[eh])),this[Nf]=!0,this[sp]=h,t<=0?this.nextTick(this[Uu],null,[]):this._nextv(t,r,this[Uu])),h[j0]):(this.nextTick(h,new TypeError("The first argument 'size' must be an integer")),h[j0])}_nextv(t,r,h){let o=[],l=(c,p,w)=>{if(c)return h(c);if(this[D8]?p===void 0&&w===void 0:p===void 0)return h(null,o);o.push(this[D8]?[p,w]:p),o.length===t?h(null,o):this._next(l)};this._next(l)}all(t,r){return r=ort(t,r),r=Ik(r,j0),t=Bk(t,$8),this[el]?this.nextTick(r,new Ha("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Nf]?this.nextTick(r,new Ha("Iterator is busy: cannot call all() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[Nf]=!0,this[sp]=r,this[Ok]=!0,this[eh]>=this[rl]?this.nextTick(this[Uu],null,[]):this._all(t,this[Uu])),r[j0]}_all(t,r){let h=this[eh],o=[],l=()=>{let p=this[rl]<1/0?Math.min(1e3,this[rl]-h):1e3;p<=0?this.nextTick(r,null,o):this._nextv(p,$8,c)},c=(p,w)=>{p?r(p):w.length===0?r(null,o):(o.push.apply(o,w),h+=w.length,l())};l()}[nl](){let t=this[sp];return this[Ck]&&t===null?fSt:(this[Nf]=!1,this[sp]=null,this[el]&&this._close(this[Bm]),t)}[Lf](t,r,h){this[Ok]?this.close(t.bind(null,r,h)):t(r,h)}seek(t,r){if(r=Bk(r,$8),!this[el]){if(this[Nf])throw new Ha("Iterator is busy: cannot call seek() until next() has completed",{code:"LEVEL_ITERATOR_BUSY"});{let h=this.db.keyEncoding(r.keyEncoding||this[il]),o=h.format;r.keyEncoding!==o&&(r={...r,keyEncoding:o});let l=this.db.prefixKey(h.encode(t),o);this._seek(l,r)}}}_seek(t,r){throw new Ha("Iterator does not support seek()",{code:"LEVEL_NOT_SUPPORTED"})}close(t){return t=Ik(t,j0),this[L8]?this.nextTick(t):this[el]?this[Om].push(t):(this[el]=!0,this[Om].push(t),this[Nf]?this[Ck]&&this[nl]()(new Ha("Aborted on iterator close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this._close(this[Bm])),t[j0]}_close(t){this.nextTick(t)}[Bm](){this[L8]=!0,this.db.detachResource(this);let t=this[Om];this[Om]=[];for(let r of t)r()}async*[Symbol.asyncIterator](){try{let t;for(;(t=await this.next())!==void 0;)yield t}finally{this[L8]||await this.close()}}},hp=class extends Cm{constructor(t,r){super(t,r,!0),this[Pk]=r.keys!==!1,this[Nk]=r.values!==!1}[z0](t,r,h){let o=this[nl]();if(t)return o(t);try{r=this[Pk]&&r!==void 0?this[il].decode(r):void 0,h=this[Nk]&&h!==void 0?this[W0].decode(h):void 0}catch(l){return o(new ol("entry",l))}r===void 0&&h===void 0||this[eh]++,o(null,r,h)}[Uu](t,r){let h=this[nl]();if(t)return this[Lf](h,t);try{for(let o of r){let l=o[0],c=o[1];o[0]=this[Pk]&&l!==void 0?this[il].decode(l):void 0,o[1]=this[Nk]&&c!==void 0?this[W0].decode(c):void 0}}catch(o){return this[Lf](h,new ol("entries",o))}this[eh]+=r.length,this[Lf](h,null,r)}end(t){return!art&&typeof console<"u"&&(art=!0,console.warn(new Ha("The iterator.end() method was renamed to close() and end() is an alias that will be removed in a future version",{code:"LEVEL_LEGACY"}))),this.close(t)}},Lk=class extends Cm{constructor(t,r){super(t,r,!1)}[z0](t,r){let h=this[nl]();if(t)return h(t);try{r=r!==void 0?this[il].decode(r):void 0}catch(o){return h(new ol("key",o))}r!==void 0&&this[eh]++,h(null,r)}[Uu](t,r){let h=this[nl]();if(t)return this[Lf](h,t);try{for(let o=0;o<r.length;o++){let l=r[o];r[o]=l!==void 0?this[il].decode(l):void 0}}catch(o){return this[Lf](h,new ol("keys",o))}this[eh]+=r.length,this[Lf](h,null,r)}},Dk=class extends Cm{constructor(t,r){super(t,r,!1)}[z0](t,r){let h=this[nl]();if(t)return h(t);try{r=r!==void 0?this[W0].decode(r):void 0}catch(o){return h(new ol("value",o))}r!==void 0&&this[eh]++,h(null,r)}[Uu](t,r){let h=this[nl]();if(t)return this[Lf](h,t);try{for(let o=0;o<r.length;o++){let l=r[o];r[o]=l!==void 0?this[W0].decode(l):void 0}}catch(o){return this[Lf](h,new ol("values",o))}this[eh]+=r.length,this[Lf](h,null,r)}},ol=class extends Ha{constructor(t,r){super(`Iterator could not decode ${t}`,{code:"LEVEL_DECODE_ERROR",cause:r})}};for(let i of["_ended property","_nexting property","_end method"])Object.defineProperty(hp.prototype,i.split(" ")[0],{get(){throw new Ha(`The ${i} has been removed`,{code:"LEVEL_LEGACY"})},set(){throw new Ha(`The ${i} has been removed`,{code:"LEVEL_LEGACY"})}});hp.keyEncoding=il;hp.valueEncoding=W0;U8.AbstractIterator=hp;U8.AbstractKeyIterator=Lk;U8.AbstractValueIterator=Dk});var srt=De($k=>{"use strict";Tt();Rt();xt();var{AbstractKeyIterator:uSt,AbstractValueIterator:cSt}=al(),K0=Symbol("iterator"),Pm=Symbol("callback"),fp=Symbol("handleOne"),H0=Symbol("handleMany"),Nm=class extends uSt{constructor(t,r){super(t,r),this[K0]=t.iterator({...r,keys:!0,values:!1}),this[fp]=this[fp].bind(this),this[H0]=this[H0].bind(this)}},q8=class extends cSt{constructor(t,r){super(t,r),this[K0]=t.iterator({...r,keys:!1,values:!0}),this[fp]=this[fp].bind(this),this[H0]=this[H0].bind(this)}};for(let i of[Nm,q8]){let t=i===Nm,r=t?h=>h[0]:h=>h[1];i.prototype._next=function(h){this[Pm]=h,this[K0].next(this[fp])},i.prototype[fp]=function(h,o,l){let c=this[Pm];h?c(h):c(null,t?o:l)},i.prototype._nextv=function(h,o,l){this[Pm]=l,this[K0].nextv(h,o,this[H0])},i.prototype._all=function(h,o){this[Pm]=o,this[K0].all(h,this[H0])},i.prototype[H0]=function(h,o){let l=this[Pm];h?l(h):l(null,o.map(r))},i.prototype._seek=function(h,o){this[K0].seek(h,o)},i.prototype._close=function(h){this[K0].close(h)}}$k.DefaultKeyIterator=Nm;$k.DefaultValueIterator=q8});var hrt=De(H8=>{"use strict";Tt();Rt();xt();var{AbstractIterator:lSt,AbstractKeyIterator:dSt,AbstractValueIterator:pSt}=al(),Uk=th(),Ea=Symbol("nut"),W8=Symbol("undefer"),K8=Symbol("factory"),F8=class extends lSt{constructor(t,r){super(t,r),this[Ea]=null,this[K8]=()=>t.iterator(r),this.db.defer(()=>this[W8]())}},j8=class extends dSt{constructor(t,r){super(t,r),this[Ea]=null,this[K8]=()=>t.keys(r),this.db.defer(()=>this[W8]())}},z8=class extends pSt{constructor(t,r){super(t,r),this[Ea]=null,this[K8]=()=>t.values(r),this.db.defer(()=>this[W8]())}};for(let i of[F8,j8,z8])i.prototype[W8]=function(){this.db.status==="open"&&(this[Ea]=this[K8]())},i.prototype._next=function(t){this[Ea]!==null?this[Ea].next(t):this.db.status==="opening"?this.db.defer(()=>this._next(t)):this.nextTick(t,new Uk("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},i.prototype._nextv=function(t,r,h){this[Ea]!==null?this[Ea].nextv(t,r,h):this.db.status==="opening"?this.db.defer(()=>this._nextv(t,r,h)):this.nextTick(h,new Uk("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},i.prototype._all=function(t,r){this[Ea]!==null?this[Ea].all(r):this.db.status==="opening"?this.db.defer(()=>this._all(t,r)):this.nextTick(r,new Uk("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},i.prototype._seek=function(t,r){this[Ea]!==null?this[Ea]._seek(t,r):this.db.status==="opening"&&this.db.defer(()=>this._seek(t,r))},i.prototype._close=function(t){this[Ea]!==null?this[Ea].close(t):this.db.status==="opening"?this.db.defer(()=>this._close(t)):this.nextTick(t)};H8.DeferredIterator=F8;H8.DeferredKeyIterator=j8;H8.DeferredValueIterator=z8});var Fk=De(urt=>{"use strict";Tt();Rt();xt();var{fromCallback:frt}=Im(),G8=th(),{getCallback:gSt,getOptions:mSt}=N8(),V8=Symbol("promise"),rh=Symbol("status"),up=Symbol("operations"),Lm=Symbol("finishClose"),cp=Symbol("closeCallbacks"),qk=class{constructor(t){if(typeof t!="object"||t===null){let r=t===null?"null":typeof t;throw new TypeError(`The first argument must be an abstract-level database, received ${r}`)}this[up]=[],this[cp]=[],this[rh]="open",this[Lm]=this[Lm].bind(this),this.db=t,this.db.attachResource(this),this.nextTick=t.nextTick}get length(){return this[up].length}put(t,r,h){if(this[rh]!=="open")throw new G8("Batch is not open: cannot call put() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let o=this.db._checkKey(t)||this.db._checkValue(r);if(o)throw o;let l=h&&h.sublevel!=null?h.sublevel:this.db,c=h,p=l.keyEncoding(h&&h.keyEncoding),w=l.valueEncoding(h&&h.valueEncoding),m=p.format;h={...h,keyEncoding:m,valueEncoding:w.format},l!==this.db&&(h.sublevel=null);let y=l.prefixKey(p.encode(t),m),v=w.encode(r);return this._put(y,v,h),this[up].push({...c,type:"put",key:t,value:r}),this}_put(t,r,h){}del(t,r){if(this[rh]!=="open")throw new G8("Batch is not open: cannot call del() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let h=this.db._checkKey(t);if(h)throw h;let o=r&&r.sublevel!=null?r.sublevel:this.db,l=r,c=o.keyEncoding(r&&r.keyEncoding),p=c.format;return r={...r,keyEncoding:p},o!==this.db&&(r.sublevel=null),this._del(o.prefixKey(c.encode(t),p),r),this[up].push({...l,type:"del",key:t}),this}_del(t,r){}clear(){if(this[rh]!=="open")throw new G8("Batch is not open: cannot call clear() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});return this._clear(),this[up]=[],this}_clear(){}write(t,r){return r=gSt(t,r),r=frt(r,V8),t=mSt(t),this[rh]!=="open"?this.nextTick(r,new G8("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"})):this.length===0?this.close(r):(this[rh]="writing",this._write(t,h=>{this[rh]="closing",this[cp].push(()=>r(h)),h||this.db.emit("batch",this[up]),this._close(this[Lm])})),r[V8]}_write(t,r){}close(t){return t=frt(t,V8),this[rh]==="closing"?this[cp].push(t):this[rh]==="closed"?this.nextTick(t):(this[cp].push(t),this[rh]!=="writing"&&(this[rh]="closing",this._close(this[Lm]))),t[V8]}_close(t){this.nextTick(t)}[Lm](){this[rh]="closed",this.db.detachResource(this);let t=this[cp];this[cp]=[];for(let r of t)r()}};urt.AbstractChainedBatch=qk});var lrt=De(crt=>{"use strict";Tt();Rt();xt();var{AbstractChainedBatch:vSt}=Fk(),ySt=th(),lp=Symbol("encoded"),jk=class extends vSt{constructor(t){super(t),this[lp]=[]}_put(t,r,h){this[lp].push({...h,type:"put",key:t,value:r})}_del(t,r){this[lp].push({...r,type:"del",key:t})}_clear(){this[lp]=[]}_write(t,r){this.db.status==="opening"?this.db.defer(()=>this._write(t,r)):this.db.status==="open"?this[lp].length===0?this.nextTick(r):this.db._batch(this[lp],t,r):this.nextTick(r,new ySt("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"}))}};crt.DefaultChainedBatch=jk});var grt=De((kZt,prt)=>{"use strict";Tt();Rt();xt();var drt=th(),bSt=Object.prototype.hasOwnProperty,wSt=new Set(["lt","lte","gt","gte"]);prt.exports=function(i,t){let r={};for(let h in i)if(bSt.call(i,h)&&!(h==="keyEncoding"||h==="valueEncoding")){if(h==="start"||h==="end")throw new drt(`The legacy range option '${h}' has been removed`,{code:"LEVEL_LEGACY"});if(h==="encoding")throw new drt("The levelup-style 'encoding' alias has been removed, use 'valueEncoding' instead",{code:"LEVEL_LEGACY"});wSt.has(h)?r[h]=t.encode(i[h]):r[h]=i[h]}return r.reverse=!!r.reverse,r.limit=Number.isInteger(r.limit)&&r.limit>=0?r.limit:-1,r}});var zk=De((CZt,vrt)=>{"use strict";Tt();Rt();xt();var mrt;vrt.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:global):i=>(mrt||(mrt=Promise.resolve())).then(i).catch(t=>setTimeout(()=>{throw t},0))});var wrt=De((DZt,brt)=>{"use strict";Tt();Rt();xt();var yrt=zk();brt.exports=function(i,...t){t.length===0?yrt(i):yrt(()=>i(...t))}});var _rt=De(Z8=>{"use strict";Tt();Rt();xt();var{AbstractIterator:_St,AbstractKeyIterator:MSt,AbstractValueIterator:SSt}=al(),dp=Symbol("unfix"),Hh=Symbol("iterator"),G0=Symbol("handleOne"),sl=Symbol("handleMany"),qu=Symbol("callback"),Dm=class extends _St{constructor(t,r,h,o){super(t,r),this[Hh]=h,this[dp]=o,this[G0]=this[G0].bind(this),this[sl]=this[sl].bind(this),this[qu]=null}[G0](t,r,h){let o=this[qu];if(t)return o(t);r!==void 0&&(r=this[dp](r)),o(t,r,h)}[sl](t,r){let h=this[qu];if(t)return h(t);for(let o of r){let l=o[0];l!==void 0&&(o[0]=this[dp](l))}h(t,r)}},$m=class extends MSt{constructor(t,r,h,o){super(t,r),this[Hh]=h,this[dp]=o,this[G0]=this[G0].bind(this),this[sl]=this[sl].bind(this),this[qu]=null}[G0](t,r){let h=this[qu];if(t)return h(t);r!==void 0&&(r=this[dp](r)),h(t,r)}[sl](t,r){let h=this[qu];if(t)return h(t);for(let o=0;o<r.length;o++){let l=r[o];l!==void 0&&(r[o]=this[dp](l))}h(t,r)}},Um=class extends SSt{constructor(t,r,h){super(t,r),this[Hh]=h}};for(let i of[Dm,$m])i.prototype._next=function(t){this[qu]=t,this[Hh].next(this[G0])},i.prototype._nextv=function(t,r,h){this[qu]=h,this[Hh].nextv(t,r,this[sl])},i.prototype._all=function(t,r){this[qu]=r,this[Hh].all(t,this[sl])};for(let i of[Um])i.prototype._next=function(t){this[Hh].next(t)},i.prototype._nextv=function(t,r,h){this[Hh].nextv(t,r,h)},i.prototype._all=function(t,r){this[Hh].all(t,r)};for(let i of[Dm,$m,Um])i.prototype._seek=function(t,r){this[Hh].seek(t,r)},i.prototype._close=function(t){this[Hh].close(t)};Z8.AbstractSublevelIterator=Dm;Z8.AbstractSublevelKeyIterator=$m;Z8.AbstractSublevelValueIterator=Um});var Art=De((KZt,Ert)=>{"use strict";Tt();Rt();xt();var Wk=th(),{Buffer:Gk}=(af(),Dn(uc))||{},{AbstractSublevelIterator:ESt,AbstractSublevelKeyIterator:ASt,AbstractSublevelValueIterator:TSt}=_rt(),Fu=Symbol("prefix"),Mrt=Symbol("upperBound"),qm=Symbol("prefixRange"),Ga=Symbol("parent"),Kk=Symbol("unfix"),Srt=new TextEncoder,xSt={separator:"!"};Ert.exports=function({AbstractLevel:i}){class t extends i{static defaults(h){if(typeof h=="string")throw new Wk("The subleveldown string shorthand for { separator } has been removed",{code:"LEVEL_LEGACY"});if(h&&h.open)throw new Wk("The subleveldown open option has been removed",{code:"LEVEL_LEGACY"});return h==null?xSt:h.separator?h:{...h,separator:"!"}}constructor(h,o,l){let{separator:c,manifest:p,...w}=t.defaults(l);o=kSt(o,c);let m=c.charCodeAt(0)+1,y=h[Ga]||h;if(!Srt.encode(o).every(T=>T>m&&T<127))throw new Wk(`Prefix must use bytes > ${m} < 127`,{code:"LEVEL_INVALID_PREFIX"});super(RSt(y,p),w);let v=(h.prefix||"")+c+o+c,M=v.slice(0,-1)+String.fromCharCode(m);this[Ga]=y,this[Fu]=new J8(v),this[Mrt]=new J8(M),this[Kk]=new Vk,this.nextTick=y.nextTick}prefixKey(h,o){if(o==="utf8")return this[Fu].utf8+h;if(h.byteLength===0)return this[Fu][o];if(o==="view"){let l=this[Fu].view,c=new Uint8Array(l.byteLength+h.byteLength);return c.set(l,0),c.set(h,l.byteLength),c}else{let l=this[Fu].buffer;return Gk.concat([l,h],l.byteLength+h.byteLength)}}[qm](h,o){h.gte!==void 0?h.gte=this.prefixKey(h.gte,o):h.gt!==void 0?h.gt=this.prefixKey(h.gt,o):h.gte=this[Fu][o],h.lte!==void 0?h.lte=this.prefixKey(h.lte,o):h.lt!==void 0?h.lt=this.prefixKey(h.lt,o):h.lte=this[Mrt][o]}get prefix(){return this[Fu].utf8}get db(){return this[Ga]}_open(h,o){this[Ga].open({passive:!0},o)}_put(h,o,l,c){this[Ga].put(h,o,l,c)}_get(h,o,l){this[Ga].get(h,o,l)}_getMany(h,o,l){this[Ga].getMany(h,o,l)}_del(h,o,l){this[Ga].del(h,o,l)}_batch(h,o,l){this[Ga].batch(h,o,l)}_clear(h,o){this[qm](h,h.keyEncoding),this[Ga].clear(h,o)}_iterator(h){this[qm](h,h.keyEncoding);let o=this[Ga].iterator(h),l=this[Kk].get(this[Fu].utf8.length,h.keyEncoding);return new ESt(this,h,o,l)}_keys(h){this[qm](h,h.keyEncoding);let o=this[Ga].keys(h),l=this[Kk].get(this[Fu].utf8.length,h.keyEncoding);return new ASt(this,h,o,l)}_values(h){this[qm](h,h.keyEncoding);let o=this[Ga].values(h);return new TSt(this,h,o)}}return{AbstractSublevel:t}};var RSt=function(i,t){return{...i.supports,createIfMissing:!1,errorIfExists:!1,events:{},additionalMethods:{},...t,encodings:{utf8:Hk(i,"utf8"),buffer:Hk(i,"buffer"),view:Hk(i,"view")}}},Hk=function(i,t){return i.supports.encodings[t]?i.keyEncoding(t).name===t:!1},J8=class{constructor(t){this.utf8=t,this.view=Srt.encode(t),this.buffer=Gk?Gk.from(this.view.buffer,0,this.view.byteLength):{}}},Vk=class{constructor(){this.cache=new Map}get(t,r){let h=this.cache.get(r);return h===void 0&&(r==="view"?h=function(o,l){return l.subarray(o)}.bind(null,t):h=function(o,l){return l.slice(o)}.bind(null,t),this.cache.set(r,h)),h}},kSt=function(i,t){let r=0,h=i.length;for(;r<h&&i[r]===t;)r++;for(;h>r&&i[h-1]===t;)h--;return i.slice(r,h)}});var Qk=De(Yk=>{"use strict";Tt();Rt();xt();var{supports:ISt}=Ket(),{Transcoder:BSt}=ert(),{EventEmitter:OSt}=(Zd(),Dn(w9)),{fromCallback:hl}=Im(),Gh=th(),{AbstractIterator:V0}=al(),{DefaultKeyIterator:CSt,DefaultValueIterator:PSt}=srt(),{DeferredIterator:NSt,DeferredKeyIterator:LSt,DeferredValueIterator:DSt}=hrt(),{DefaultChainedBatch:Trt}=lrt(),{getCallback:Z0,getOptions:fl}=N8(),X8=grt(),hi=Symbol("promise"),ju=Symbol("landed"),J0=Symbol("resources"),Zk=Symbol("closeResources"),Fm=Symbol("operations"),jm=Symbol("undefer"),Y8=Symbol("deferOpen"),xrt=Symbol("options"),gi=Symbol("status"),X0=Symbol("defaultOptions"),pp=Symbol("transcoder"),Q8=Symbol("keyEncoding"),Jk=Symbol("valueEncoding"),$St=()=>{},zm=class extends OSt{constructor(t,r){if(super(),typeof t!="object"||t===null)throw new TypeError("The first argument 'manifest' must be an object");r=fl(r);let{keyEncoding:h,valueEncoding:o,passive:l,...c}=r;this[J0]=new Set,this[Fm]=[],this[Y8]=!0,this[xrt]=c,this[gi]="opening",this.supports=ISt(t,{status:!0,promises:!0,clear:!0,getMany:!0,deferredOpen:!0,snapshots:t.snapshots!==!1,permanence:t.permanence!==!1,keyIterator:!0,valueIterator:!0,iteratorNextv:!0,iteratorAll:!0,encodings:t.encodings||{},events:Object.assign({},t.events,{opening:!0,open:!0,closing:!0,closed:!0,put:!0,del:!0,batch:!0,clear:!0})}),this[pp]=new BSt(USt(this)),this[Q8]=this[pp].encoding(h||"utf8"),this[Jk]=this[pp].encoding(o||"utf8");for(let p of this[pp].encodings())this.supports.encodings[p.commonName]||(this.supports.encodings[p.commonName]=!0);this[X0]={empty:Object.freeze({}),entry:Object.freeze({keyEncoding:this[Q8].commonName,valueEncoding:this[Jk].commonName}),key:Object.freeze({keyEncoding:this[Q8].commonName})},this.nextTick(()=>{this[Y8]&&this.open({passive:!1},$St)})}get status(){return this[gi]}keyEncoding(t){return this[pp].encoding(t??this[Q8])}valueEncoding(t){return this[pp].encoding(t??this[Jk])}open(t,r){r=Z0(t,r),r=hl(r,hi),t={...this[xrt],...fl(t)},t.createIfMissing=t.createIfMissing!==!1,t.errorIfExists=!!t.errorIfExists;let h=o=>{this[gi]==="closing"||this[gi]==="opening"?this.once(ju,o?()=>h(o):h):this[gi]!=="open"?r(new Gh("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN",cause:o})):r()};return t.passive?this[gi]==="opening"?this.once(ju,h):this.nextTick(h):this[gi]==="closed"||this[Y8]?(this[Y8]=!1,this[gi]="opening",this.emit("opening"),this._open(t,o=>{if(o){this[gi]="closed",this[Zk](()=>{this.emit(ju),h(o)}),this[jm]();return}this[gi]="open",this[jm](),this.emit(ju),this[gi]==="open"&&this.emit("open"),this[gi]==="open"&&this.emit("ready"),h()})):this[gi]==="open"?this.nextTick(h):this.once(ju,()=>this.open(t,r)),r[hi]}_open(t,r){this.nextTick(r)}close(t){t=hl(t,hi);let r=h=>{this[gi]==="opening"||this[gi]==="closing"?this.once(ju,h?r(h):r):this[gi]!=="closed"?t(new Gh("Database is not closed",{code:"LEVEL_DATABASE_NOT_CLOSED",cause:h})):t()};if(this[gi]==="open"){this[gi]="closing",this.emit("closing");let h=o=>{this[gi]="open",this[jm](),this.emit(ju),r(o)};this[Zk](()=>{this._close(o=>{if(o)return h(o);this[gi]="closed",this[jm](),this.emit(ju),this[gi]==="closed"&&this.emit("closed"),r()})})}else this[gi]==="closed"?this.nextTick(r):this.once(ju,()=>this.close(t));return t[hi]}[Zk](t){if(this[J0].size===0)return this.nextTick(t);let r=this[J0].size,h=!0,o=()=>{--r===0&&(h?this.nextTick(t):t())};for(let l of this[J0])l.close(o);h=!1,this[J0].clear()}_close(t){this.nextTick(t)}get(t,r,h){if(h=Z0(r,h),h=hl(h,hi),r=fl(r,this[X0].entry),this[gi]==="opening")return this.defer(()=>this.get(t,r,h)),h[hi];if(gp(this,h))return h[hi];let o=this._checkKey(t);if(o)return this.nextTick(h,o),h[hi];let l=this.keyEncoding(r.keyEncoding),c=this.valueEncoding(r.valueEncoding),p=l.format,w=c.format;return(r.keyEncoding!==p||r.valueEncoding!==w)&&(r=Object.assign({},r,{keyEncoding:p,valueEncoding:w})),this._get(this.prefixKey(l.encode(t),p),r,(m,y)=>{if(m)return(m.code==="LEVEL_NOT_FOUND"||m.notFound||/NotFound/i.test(m))&&(m.code||(m.code="LEVEL_NOT_FOUND"),m.notFound||(m.notFound=!0),m.status||(m.status=404)),h(m);try{y=c.decode(y)}catch(v){return h(new Gh("Could not decode value",{code:"LEVEL_DECODE_ERROR",cause:v}))}h(null,y)}),h[hi]}_get(t,r,h){this.nextTick(h,new Error("NotFound"))}getMany(t,r,h){if(h=Z0(r,h),h=hl(h,hi),r=fl(r,this[X0].entry),this[gi]==="opening")return this.defer(()=>this.getMany(t,r,h)),h[hi];if(gp(this,h))return h[hi];if(!Array.isArray(t))return this.nextTick(h,new TypeError("The first argument 'keys' must be an array")),h[hi];if(t.length===0)return this.nextTick(h,null,[]),h[hi];let o=this.keyEncoding(r.keyEncoding),l=this.valueEncoding(r.valueEncoding),c=o.format,p=l.format;(r.keyEncoding!==c||r.valueEncoding!==p)&&(r=Object.assign({},r,{keyEncoding:c,valueEncoding:p}));let w=new Array(t.length);for(let m=0;m<t.length;m++){let y=t[m],v=this._checkKey(y);if(v)return this.nextTick(h,v),h[hi];w[m]=this.prefixKey(o.encode(y),c)}return this._getMany(w,r,(m,y)=>{if(m)return h(m);try{for(let v=0;v<y.length;v++)y[v]!==void 0&&(y[v]=l.decode(y[v]))}catch(v){return h(new Gh(`Could not decode one or more of ${y.length} value(s)`,{code:"LEVEL_DECODE_ERROR",cause:v}))}h(null,y)}),h[hi]}_getMany(t,r,h){this.nextTick(h,null,new Array(t.length).fill(void 0))}put(t,r,h,o){if(o=Z0(h,o),o=hl(o,hi),h=fl(h,this[X0].entry),this[gi]==="opening")return this.defer(()=>this.put(t,r,h,o)),o[hi];if(gp(this,o))return o[hi];let l=this._checkKey(t)||this._checkValue(r);if(l)return this.nextTick(o,l),o[hi];let c=this.keyEncoding(h.keyEncoding),p=this.valueEncoding(h.valueEncoding),w=c.format,m=p.format;(h.keyEncoding!==w||h.valueEncoding!==m)&&(h=Object.assign({},h,{keyEncoding:w,valueEncoding:m}));let y=this.prefixKey(c.encode(t),w),v=p.encode(r);return this._put(y,v,h,M=>{if(M)return o(M);this.emit("put",t,r),o()}),o[hi]}_put(t,r,h,o){this.nextTick(o)}del(t,r,h){if(h=Z0(r,h),h=hl(h,hi),r=fl(r,this[X0].key),this[gi]==="opening")return this.defer(()=>this.del(t,r,h)),h[hi];if(gp(this,h))return h[hi];let o=this._checkKey(t);if(o)return this.nextTick(h,o),h[hi];let l=this.keyEncoding(r.keyEncoding),c=l.format;return r.keyEncoding!==c&&(r=Object.assign({},r,{keyEncoding:c})),this._del(this.prefixKey(l.encode(t),c),r,p=>{if(p)return h(p);this.emit("del",t),h()}),h[hi]}_del(t,r,h){this.nextTick(h)}batch(t,r,h){if(!arguments.length){if(this[gi]==="opening")return new Trt(this);if(this[gi]!=="open")throw new Gh("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._chainedBatch()}if(typeof t=="function"?h=t:h=Z0(r,h),h=hl(h,hi),r=fl(r,this[X0].empty),this[gi]==="opening")return this.defer(()=>this.batch(t,r,h)),h[hi];if(gp(this,h))return h[hi];if(!Array.isArray(t))return this.nextTick(h,new TypeError("The first argument 'operations' must be an array")),h[hi];if(t.length===0)return this.nextTick(h),h[hi];let o=new Array(t.length),{keyEncoding:l,valueEncoding:c,...p}=r;for(let w=0;w<t.length;w++){if(typeof t[w]!="object"||t[w]===null)return this.nextTick(h,new TypeError("A batch operation must be an object")),h[hi];let m=Object.assign({},t[w]);if(m.type!=="put"&&m.type!=="del")return this.nextTick(h,new TypeError("A batch operation must have a type property that is 'put' or 'del'")),h[hi];let y=this._checkKey(m.key);if(y)return this.nextTick(h,y),h[hi];let v=m.sublevel!=null?m.sublevel:this,M=v.keyEncoding(m.keyEncoding||l),T=M.format;if(m.key=v.prefixKey(M.encode(m.key),T),m.keyEncoding=T,m.type==="put"){let A=this._checkValue(m.value);if(A)return this.nextTick(h,A),h[hi];let R=v.valueEncoding(m.valueEncoding||c);m.value=R.encode(m.value),m.valueEncoding=R.format}v!==this&&(m.sublevel=null),o[w]=m}return this._batch(o,p,w=>{if(w)return h(w);this.emit("batch",t),h()}),h[hi]}_batch(t,r,h){this.nextTick(h)}sublevel(t,r){return this._sublevel(t,Xk.defaults(r))}_sublevel(t,r){return new Xk(this,t,r)}prefixKey(t,r){return t}clear(t,r){if(r=Z0(t,r),r=hl(r,hi),t=fl(t,this[X0].empty),this[gi]==="opening")return this.defer(()=>this.clear(t,r)),r[hi];if(gp(this,r))return r[hi];let h=t,o=this.keyEncoding(t.keyEncoding);return t=X8(t,o),t.keyEncoding=o.format,t.limit===0?this.nextTick(r):this._clear(t,l=>{if(l)return r(l);this.emit("clear",h),r()}),r[hi]}_clear(t,r){this.nextTick(r)}iterator(t){let r=this.keyEncoding(t&&t.keyEncoding),h=this.valueEncoding(t&&t.valueEncoding);if(t=X8(t,r),t.keys=t.keys!==!1,t.values=t.values!==!1,t[V0.keyEncoding]=r,t[V0.valueEncoding]=h,t.keyEncoding=r.format,t.valueEncoding=h.format,this[gi]==="opening")return new NSt(this,t);if(this[gi]!=="open")throw new Gh("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._iterator(t)}_iterator(t){return new V0(this,t)}keys(t){let r=this.keyEncoding(t&&t.keyEncoding),h=this.valueEncoding(t&&t.valueEncoding);if(t=X8(t,r),t[V0.keyEncoding]=r,t[V0.valueEncoding]=h,t.keyEncoding=r.format,t.valueEncoding=h.format,this[gi]==="opening")return new LSt(this,t);if(this[gi]!=="open")throw new Gh("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._keys(t)}_keys(t){return new CSt(this,t)}values(t){let r=this.keyEncoding(t&&t.keyEncoding),h=this.valueEncoding(t&&t.valueEncoding);if(t=X8(t,r),t[V0.keyEncoding]=r,t[V0.valueEncoding]=h,t.keyEncoding=r.format,t.valueEncoding=h.format,this[gi]==="opening")return new DSt(this,t);if(this[gi]!=="open")throw new Gh("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._values(t)}_values(t){return new PSt(this,t)}defer(t){if(typeof t!="function")throw new TypeError("The first argument must be a function");this[Fm].push(t)}[jm](){if(this[Fm].length===0)return;let t=this[Fm];this[Fm]=[];for(let r of t)r()}attachResource(t){if(typeof t!="object"||t===null||typeof t.close!="function")throw new TypeError("The first argument must be a resource object");this[J0].add(t)}detachResource(t){this[J0].delete(t)}_chainedBatch(){return new Trt(this)}_checkKey(t){if(t==null)return new Gh("Key cannot be null or undefined",{code:"LEVEL_INVALID_KEY"})}_checkValue(t){if(t==null)return new Gh("Value cannot be null or undefined",{code:"LEVEL_INVALID_VALUE"})}};zm.prototype.nextTick=wrt();var{AbstractSublevel:Xk}=Art()({AbstractLevel:zm});Yk.AbstractLevel=zm;Yk.AbstractSublevel=Xk;var gp=function(i,t){return i[gi]!=="open"?(i.nextTick(t,new Gh("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"})),!0):!1},USt=function(i){return Object.keys(i.supports.encodings).filter(t=>!!i.supports.encodings[t])}});var t4=De(Y0=>{"use strict";Tt();Rt();xt();Y0.AbstractLevel=Qk().AbstractLevel;Y0.AbstractSublevel=Qk().AbstractSublevel;Y0.AbstractIterator=al().AbstractIterator;Y0.AbstractKeyIterator=al().AbstractKeyIterator;Y0.AbstractValueIterator=al().AbstractValueIterator;Y0.AbstractChainedBatch=Fk().AbstractChainedBatch});var krt=De((iJt,Rrt)=>{"use strict";Tt();Rt();xt();Rrt.exports=FSt;var qSt=zk();function FSt(i,t,r){if(typeof t!="number")throw new Error("second argument must be a Number");let h,o,l,c,p,w=!0,m;Array.isArray(i)?(h=[],l=o=i.length):(c=Object.keys(i),h={},l=o=c.length);function y(M){function T(){r&&r(M,h),r=null}w?qSt(T):T()}function v(M,T,A){if(h[M]=A,T&&(p=!0),--l===0||T)y(T);else if(!p&&m<o){let R;c?(R=c[m],m+=1,i[R](function(B,C){v(R,B,C)})):(R=m,m+=1,i[R](function(B,C){v(R,B,C)}))}}m=t,l?c?c.some(function(M,T){return i[M](function(A,R){v(M,A,R)}),T===t-1}):i.some(function(M,T){return M(function(A,R){v(T,A,R)}),T===t-1}):y(null),w=!1}});var tI=De((sJt,Irt)=>{"use strict";Tt();Rt();xt();Irt.exports=function(t){let r=t.gte!==void 0?t.gte:t.gt!==void 0?t.gt:void 0,h=t.lte!==void 0?t.lte:t.lt!==void 0?t.lt:void 0,o=t.gte===void 0,l=t.lte===void 0;return r!==void 0&&h!==void 0?IDBKeyRange.bound(r,h,o,l):r!==void 0?IDBKeyRange.lowerBound(r,o):h!==void 0?IDBKeyRange.upperBound(h,l):null}});var eI=De((cJt,Brt)=>{"use strict";Tt();Rt();xt();var jSt=new TextEncoder;Brt.exports=function(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):jSt.encode(i)}});var Lrt=De(Nrt=>{"use strict";Tt();Rt();xt();var{AbstractIterator:zSt}=t4(),Ort=tI(),e4=eI(),Df=Symbol("cache"),zu=Symbol("finished"),Va=Symbol("options"),Wu=Symbol("currentOptions"),Q0=Symbol("position"),rI=Symbol("location"),mp=Symbol("first"),Crt={},iI=class extends zSt{constructor(t,r,h){super(t,h),this[Df]=[],this[zu]=this.limit===0,this[Va]=h,this[Wu]={...h},this[Q0]=void 0,this[rI]=r,this[mp]=!0}_nextv(t,r,h){if(this[mp]=!1,this[zu])return this.nextTick(h,null,[]);if(this[Df].length>0)return t=Math.min(t,this[Df].length),this.nextTick(h,null,this[Df].splice(0,t));this[Q0]!==void 0&&(this[Va].reverse?(this[Wu].lt=this[Q0],this[Wu].lte=void 0):(this[Wu].gt=this[Q0],this[Wu].gte=void 0));let o;try{o=Ort(this[Wu])}catch{return this[zu]=!0,this.nextTick(h,null,[])}let l=this.db.db.transaction([this[rI]],"readonly"),c=l.objectStore(this[rI]),p=[];if(this[Va].reverse){let w=!this[Va].values&&c.openKeyCursor?"openKeyCursor":"openCursor";c[w](o,"prev").onsuccess=m=>{let y=m.target.result;if(y){let{key:v,value:M}=y;this[Q0]=v,p.push([this[Va].keys&&v!==void 0?e4(v):void 0,this[Va].values&&M!==void 0?e4(M):void 0]),p.length<t?y.continue():Prt(l)}else this[zu]=!0}}else{let w,m,y=()=>{if(w===void 0||m===void 0)return;let v=Math.max(w.length,m.length);v===0||t===1/0?this[zu]=!0:this[Q0]=w[v-1],p.length=v;for(let M=0;M<v;M++){let T=w[M],A=m[M];p[M]=[this[Va].keys&&T!==void 0?e4(T):void 0,this[Va].values&&A!==void 0?e4(A):void 0]}Prt(l)};this[Va].keys||t<1/0?c.getAllKeys(o,t<1/0?t:void 0).onsuccess=v=>{w=v.target.result,y()}:(w=[],this.nextTick(y)),this[Va].values?c.getAll(o,t<1/0?t:void 0).onsuccess=v=>{m=v.target.result,y()}:(m=[],this.nextTick(y))}l.onabort=()=>{h(l.error||new Error("aborted by user")),h=null},l.oncomplete=()=>{h(null,p),h=null}}_next(t){if(this[Df].length>0){let[r,h]=this[Df].shift();this.nextTick(t,null,r,h)}else if(this[zu])this.nextTick(t);else{let r=Math.min(100,this.limit-this.count);this[mp]&&(this[mp]=!1,r=1),this._nextv(r,Crt,(h,o)=>{if(h)return t(h);this[Df]=o,this._next(t)})}}_all(t,r){this[mp]=!1;let h=this[Df].splice(0,this[Df].length),o=this.limit-this.count-h.length;if(o<=0)return this.nextTick(r,null,h);this._nextv(o,Crt,(l,c)=>{if(l)return r(l);h.length>0&&(c=h.concat(c)),r(null,c)})}_seek(t,r){this[mp]=!0,this[Df]=[],this[zu]=!1,this[Q0]=void 0,this[Wu]={...this[Va]};let h;try{h=Ort(this[Va])}catch{this[zu]=!0;return}h!==null&&!h.includes(t)?this[zu]=!0:this[Va].reverse?this[Wu].lte=t:this[Wu].gte=t}};Nrt.Iterator=iI;function Prt(i){typeof i.commit=="function"&&i.commit()}});var $rt=De((bJt,Drt)=>{"use strict";Tt();Rt();xt();Drt.exports=function(t,r,h,o,l){if(o.limit===0)return t.nextTick(l);let c=t.db.transaction([r],"readwrite"),p=c.objectStore(r),w=0;c.oncomplete=function(){l()},c.onabort=function(){l(c.error||new Error("aborted by user"))};let m=p.openKeyCursor?"openKeyCursor":"openCursor",y=o.reverse?"prev":"next";p[m](h,y).onsuccess=function(v){let M=v.target.result;M&&(p.delete(M.key).onsuccess=function(){(o.limit<=0||++w<o.limit)&&M.continue()})}}});var Wrt=De(zrt=>{"use strict";Tt();Rt();xt();var{AbstractLevel:WSt}=t4(),Urt=th(),KSt=krt(),{fromCallback:HSt}=Im(),{Iterator:GSt}=Lrt(),qrt=eI(),VSt=$rt(),ZSt=tI(),jrt="level-js-",Wm=Symbol("idb"),nI=Symbol("namePrefix"),Ku=Symbol("location"),oI=Symbol("version"),td=Symbol("store"),Km=Symbol("onComplete"),Frt=Symbol("promise"),r4=class extends WSt{constructor(t,r,h){if(typeof r=="function"||typeof h=="function")throw new Urt("The levelup-style callback argument has been removed",{code:"LEVEL_LEGACY"});let{prefix:o,version:l,...c}=r||{};if(super({encodings:{view:!0},snapshots:!1,createIfMissing:!1,errorIfExists:!1,seek:!0},c),typeof t!="string")throw new Error("constructor requires a location string argument");this[Ku]=t,this[nI]=o??jrt,this[oI]=parseInt(l||1,10),this[Wm]=null}get location(){return this[Ku]}get namePrefix(){return this[nI]}get version(){return this[oI]}get db(){return this[Wm]}get type(){return"browser-level"}_open(t,r){let h=indexedDB.open(this[nI]+this[Ku],this[oI]);h.onerror=function(){r(h.error||new Error("unknown error"))},h.onsuccess=()=>{this[Wm]=h.result,r()},h.onupgradeneeded=o=>{let l=o.target.result;l.objectStoreNames.contains(this[Ku])||l.createObjectStore(this[Ku])}}[td](t){return this[Wm].transaction([this[Ku]],t).objectStore(this[Ku])}[Km](t,r){let h=t.transaction;h.onabort=function(){r(h.error||new Error("aborted by user"))},h.oncomplete=function(){r(null,t.result)}}_get(t,r,h){let o=this[td]("readonly"),l;try{l=o.get(t)}catch(c){return this.nextTick(h,c)}this[Km](l,function(c,p){if(c)return h(c);if(p===void 0)return h(new Urt("Entry not found",{code:"LEVEL_NOT_FOUND"}));h(null,qrt(p))})}_getMany(t,r,h){let o=this[td]("readonly"),l=t.map(c=>p=>{let w;try{w=o.get(c)}catch(m){return p(m)}w.onsuccess=()=>{let m=w.result;p(null,m===void 0?m:qrt(m))},w.onerror=m=>{m.stopPropagation(),p(w.error)}});KSt(l,16,h)}_del(t,r,h){let o=this[td]("readwrite"),l;try{l=o.delete(t)}catch(c){return this.nextTick(h,c)}this[Km](l,h)}_put(t,r,h,o){let l=this[td]("readwrite"),c;try{c=l.put(r,t)}catch(p){return this.nextTick(o,p)}this[Km](c,o)}_iterator(t){return new GSt(this,this[Ku],t)}_batch(t,r,h){let o=this[td]("readwrite"),l=o.transaction,c=0,p;l.onabort=function(){h(p||l.error||new Error("aborted by user"))},l.oncomplete=function(){h()};function w(){let m=t[c++],y=m.key,v;try{v=m.type==="del"?o.delete(y):o.put(m.value,y)}catch(M){p=M,l.abort();return}c<t.length?v.onsuccess=w:typeof l.commit=="function"&&l.commit()}w()}_clear(t,r){let h,o;try{h=ZSt(t)}catch{return this.nextTick(r)}if(t.limit>=0)return VSt(this,this[Ku],h,t,r);try{let l=this[td]("readwrite");o=h?l.delete(h):l.clear()}catch(l){return this.nextTick(r,l)}this[Km](o,r)}_close(t){this[Wm].close(),this.nextTick(t)}};r4.destroy=function(i,t,r){typeof t=="function"&&(r=t,t=jrt),r=HSt(r,Frt);let h=indexedDB.deleteDatabase(t+i);return h.onsuccess=function(){r()},h.onerror=function(o){r(o)},r[Frt]};zrt.BrowserLevel=r4});var Hrt=De(Krt=>{"use strict";Tt();Rt();xt();Krt.Level=Wrt().BrowserLevel});var Zrt=De((BJt,Vrt)=>{"use strict";Tt();Rt();xt();Vrt.exports=YSt;var cn=0,Ti=1;function Za(i,t,r,h,o,l){this._color=i,this.key=t,this.value=r,this.left=h,this.right=o,this._count=l}function $f(i){return new Za(i._color,i.key,i.value,i.left,i.right,i._count)}function ul(i,t){return new Za(i,t.key,t.value,t.left,t.right,t._count)}function wn(i){i._count=1+(i.left?i.left._count:0)+(i.right?i.right._count:0)}function cl(i,t){this._compare=i,this.root=t}var aa=cl.prototype;Object.defineProperty(aa,"keys",{get:function(){var i=[];return this.forEach(function(t,r){i.push(t)}),i}});Object.defineProperty(aa,"values",{get:function(){var i=[];return this.forEach(function(t,r){i.push(r)}),i}});Object.defineProperty(aa,"length",{get:function(){return this.root?this.root._count:0}});aa.insert=function(i,t){for(var r=this._compare,h=this.root,o=[],l=[];h;){var c=r(i,h.key);o.push(h),l.push(c),c<=0?h=h.left:h=h.right}o.push(new Za(cn,i,t,null,null,1));for(var p=o.length-2;p>=0;--p){var h=o[p];l[p]<=0?o[p]=new Za(h._color,h.key,h.value,o[p+1],h.right,h._count+1):o[p]=new Za(h._color,h.key,h.value,h.left,o[p+1],h._count+1)}for(var p=o.length-1;p>1;--p){var w=o[p-1],h=o[p];if(w._color===Ti||h._color===Ti)break;var m=o[p-2];if(m.left===w)if(w.left===h){var y=m.right;if(y&&y._color===cn)w._color=Ti,m.right=ul(Ti,y),m._color=cn,p-=1;else{if(m._color=cn,m.left=w.right,w._color=Ti,w.right=m,o[p-2]=w,o[p-1]=h,wn(m),wn(w),p>=3){var v=o[p-3];v.left===m?v.left=w:v.right=w}break}}else{var y=m.right;if(y&&y._color===cn)w._color=Ti,m.right=ul(Ti,y),m._color=cn,p-=1;else{if(w.right=h.left,m._color=cn,m.left=h.right,h._color=Ti,h.left=w,h.right=m,o[p-2]=h,o[p-1]=w,wn(m),wn(w),wn(h),p>=3){var v=o[p-3];v.left===m?v.left=h:v.right=h}break}}else if(w.right===h){var y=m.left;if(y&&y._color===cn)w._color=Ti,m.left=ul(Ti,y),m._color=cn,p-=1;else{if(m._color=cn,m.right=w.left,w._color=Ti,w.left=m,o[p-2]=w,o[p-1]=h,wn(m),wn(w),p>=3){var v=o[p-3];v.right===m?v.right=w:v.left=w}break}}else{var y=m.left;if(y&&y._color===cn)w._color=Ti,m.left=ul(Ti,y),m._color=cn,p-=1;else{if(w.left=h.right,m._color=cn,m.right=h.left,h._color=Ti,h.right=w,h.left=m,o[p-2]=h,o[p-1]=w,wn(m),wn(w),wn(h),p>=3){var v=o[p-3];v.right===m?v.right=h:v.left=h}break}}}return o[0]._color=Ti,new cl(r,o[0])};function aI(i,t){if(t.left){var r=aI(i,t.left);if(r)return r}var r=i(t.key,t.value);if(r)return r;if(t.right)return aI(i,t.right)}function sI(i,t,r,h){var o=t(i,h.key);if(o<=0){if(h.left){var l=sI(i,t,r,h.left);if(l)return l}var l=r(h.key,h.value);if(l)return l}if(h.right)return sI(i,t,r,h.right)}function hI(i,t,r,h,o){var l=r(i,o.key),c=r(t,o.key),p;if(l<=0&&(o.left&&(p=hI(i,t,r,h,o.left),p)||c>0&&(p=h(o.key,o.value),p)))return p;if(c>0&&o.right)return hI(i,t,r,h,o.right)}aa.forEach=function(t,r,h){if(this.root)switch(arguments.length){case 1:return aI(t,this.root);case 2:return sI(r,this._compare,t,this.root);case 3:return this._compare(r,h)>=0?void 0:hI(r,h,this._compare,t,this.root)}};Object.defineProperty(aa,"begin",{get:function(){for(var i=[],t=this.root;t;)i.push(t),t=t.left;return new Ja(this,i)}});Object.defineProperty(aa,"end",{get:function(){for(var i=[],t=this.root;t;)i.push(t),t=t.right;return new Ja(this,i)}});aa.at=function(i){if(i<0)return new Ja(this,[]);for(var t=this.root,r=[];;){if(r.push(t),t.left){if(i<t.left._count){t=t.left;continue}i-=t.left._count}if(!i)return new Ja(this,r);if(i-=1,t.right){if(i>=t.right._count)break;t=t.right}else break}return new Ja(this,[])};aa.ge=function(i){for(var t=this._compare,r=this.root,h=[],o=0;r;){var l=t(i,r.key);h.push(r),l<=0&&(o=h.length),l<=0?r=r.left:r=r.right}return h.length=o,new Ja(this,h)};aa.gt=function(i){for(var t=this._compare,r=this.root,h=[],o=0;r;){var l=t(i,r.key);h.push(r),l<0&&(o=h.length),l<0?r=r.left:r=r.right}return h.length=o,new Ja(this,h)};aa.lt=function(i){for(var t=this._compare,r=this.root,h=[],o=0;r;){var l=t(i,r.key);h.push(r),l>0&&(o=h.length),l<=0?r=r.left:r=r.right}return h.length=o,new Ja(this,h)};aa.le=function(i){for(var t=this._compare,r=this.root,h=[],o=0;r;){var l=t(i,r.key);h.push(r),l>=0&&(o=h.length),l<0?r=r.left:r=r.right}return h.length=o,new Ja(this,h)};aa.find=function(i){for(var t=this._compare,r=this.root,h=[];r;){var o=t(i,r.key);if(h.push(r),o===0)return new Ja(this,h);o<=0?r=r.left:r=r.right}return new Ja(this,[])};aa.remove=function(i){var t=this.find(i);return t?t.remove():this};aa.get=function(i){for(var t=this._compare,r=this.root;r;){var h=t(i,r.key);if(h===0)return r.value;h<=0?r=r.left:r=r.right}};function Ja(i,t){this.tree=i,this._stack=t}var ih=Ja.prototype;Object.defineProperty(ih,"valid",{get:function(){return this._stack.length>0}});Object.defineProperty(ih,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0});ih.clone=function(){return new Ja(this.tree,this._stack.slice())};function Grt(i,t){i.key=t.key,i.value=t.value,i.left=t.left,i.right=t.right,i._color=t._color,i._count=t._count}function JSt(i){for(var t,r,h,o,l=i.length-1;l>=0;--l){if(t=i[l],l===0){t._color=Ti;return}if(r=i[l-1],r.left===t){if(h=r.right,h.right&&h.right._color===cn){if(h=r.right=$f(h),o=h.right=$f(h.right),r.right=h.left,h.left=r,h.right=o,h._color=r._color,t._color=Ti,r._color=Ti,o._color=Ti,wn(r),wn(h),l>1){var c=i[l-2];c.left===r?c.left=h:c.right=h}i[l-1]=h;return}else if(h.left&&h.left._color===cn){if(h=r.right=$f(h),o=h.left=$f(h.left),r.right=o.left,h.left=o.right,o.left=r,o.right=h,o._color=r._color,r._color=Ti,h._color=Ti,t._color=Ti,wn(r),wn(h),wn(o),l>1){var c=i[l-2];c.left===r?c.left=o:c.right=o}i[l-1]=o;return}if(h._color===Ti)if(r._color===cn){r._color=Ti,r.right=ul(cn,h);return}else{r.right=ul(cn,h);continue}else{if(h=$f(h),r.right=h.left,h.left=r,h._color=r._color,r._color=cn,wn(r),wn(h),l>1){var c=i[l-2];c.left===r?c.left=h:c.right=h}i[l-1]=h,i[l]=r,l+1<i.length?i[l+1]=t:i.push(t),l=l+2}}else{if(h=r.left,h.left&&h.left._color===cn){if(h=r.left=$f(h),o=h.left=$f(h.left),r.left=h.right,h.right=r,h.left=o,h._color=r._color,t._color=Ti,r._color=Ti,o._color=Ti,wn(r),wn(h),l>1){var c=i[l-2];c.right===r?c.right=h:c.left=h}i[l-1]=h;return}else if(h.right&&h.right._color===cn){if(h=r.left=$f(h),o=h.right=$f(h.right),r.left=o.right,h.right=o.left,o.right=r,o.left=h,o._color=r._color,r._color=Ti,h._color=Ti,t._color=Ti,wn(r),wn(h),wn(o),l>1){var c=i[l-2];c.right===r?c.right=o:c.left=o}i[l-1]=o;return}if(h._color===Ti)if(r._color===cn){r._color=Ti,r.left=ul(cn,h);return}else{r.left=ul(cn,h);continue}else{if(h=$f(h),r.left=h.right,h.right=r,h._color=r._color,r._color=cn,wn(r),wn(h),l>1){var c=i[l-2];c.right===r?c.right=h:c.left=h}i[l-1]=h,i[l]=r,l+1<i.length?i[l+1]=t:i.push(t),l=l+2}}}}ih.remove=function(){var i=this._stack;if(i.length===0)return this.tree;var t=new Array(i.length),r=i[i.length-1];t[t.length-1]=new Za(r._color,r.key,r.value,r.left,r.right,r._count);for(var h=i.length-2;h>=0;--h){var r=i[h];r.left===i[h+1]?t[h]=new Za(r._color,r.key,r.value,t[h+1],r.right,r._count):t[h]=new Za(r._color,r.key,r.value,r.left,t[h+1],r._count)}if(r=t[t.length-1],r.left&&r.right){var o=t.length;for(r=r.left;r.right;)t.push(r),r=r.right;var l=t[o-1];t.push(new Za(r._color,l.key,l.value,r.left,r.right,r._count)),t[o-1].key=r.key,t[o-1].value=r.value;for(var h=t.length-2;h>=o;--h)r=t[h],t[h]=new Za(r._color,r.key,r.value,r.left,t[h+1],r._count);t[o-1].left=t[o]}if(r=t[t.length-1],r._color===cn){var c=t[t.length-2];c.left===r?c.left=null:c.right===r&&(c.right=null),t.pop();for(var h=0;h<t.length;++h)t[h]._count--;return new cl(this.tree._compare,t[0])}else if(r.left||r.right){r.left?Grt(r,r.left):r.right&&Grt(r,r.right),r._color=Ti;for(var h=0;h<t.length-1;++h)t[h]._count--;return new cl(this.tree._compare,t[0])}else{if(t.length===1)return new cl(this.tree._compare,null);for(var h=0;h<t.length;++h)t[h]._count--;var p=t[t.length-2];JSt(t),p.left===r?p.left=null:p.right=null}return new cl(this.tree._compare,t[0])};Object.defineProperty(ih,"key",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].key},enumerable:!0});Object.defineProperty(ih,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0});Object.defineProperty(ih,"index",{get:function(){var i=0,t=this._stack;if(t.length===0){var r=this.tree.root;return r?r._count:0}else t[t.length-1].left&&(i=t[t.length-1].left._count);for(var h=t.length-2;h>=0;--h)t[h+1]===t[h].right&&(++i,t[h].left&&(i+=t[h].left._count));return i},enumerable:!0});ih.next=function(){var i=this._stack;if(i.length!==0){var t=i[i.length-1];if(t.right)for(t=t.right;t;)i.push(t),t=t.left;else for(i.pop();i.length>0&&i[i.length-1].right===t;)t=i[i.length-1],i.pop()}};Object.defineProperty(ih,"hasNext",{get:function(){var i=this._stack;if(i.length===0)return!1;if(i[i.length-1].right)return!0;for(var t=i.length-1;t>0;--t)if(i[t-1].left===i[t])return!0;return!1}});ih.update=function(i){var t=this._stack;if(t.length===0)throw new Error("Can't update empty node!");var r=new Array(t.length),h=t[t.length-1];r[r.length-1]=new Za(h._color,h.key,i,h.left,h.right,h._count);for(var o=t.length-2;o>=0;--o)h=t[o],h.left===t[o+1]?r[o]=new Za(h._color,h.key,h.value,r[o+1],h.right,h._count):r[o]=new Za(h._color,h.key,h.value,h.left,r[o+1],h._count);return new cl(this.tree._compare,r[0])};ih.prev=function(){var i=this._stack;if(i.length!==0){var t=i[i.length-1];if(t.left)for(t=t.left;t;)i.push(t),t=t.right;else for(i.pop();i.length>0&&i[i.length-1].left===t;)t=i[i.length-1],i.pop()}};Object.defineProperty(ih,"hasPrev",{get:function(){var i=this._stack;if(i.length===0)return!1;if(i[i.length-1].left)return!0;for(var t=i.length-1;t>0;--t)if(i[t-1].right===i[t])return!0;return!1}});function XSt(i,t){return i<t?-1:i>t?1:0}function YSt(i){return new cl(i||XSt,null)}});var tit=De(Qrt=>{"use strict";Tt();Rt();xt();var{AbstractLevel:QSt,AbstractIterator:tEt,AbstractKeyIterator:eEt,AbstractValueIterator:rEt}=t4(),Jrt=th(),Xrt=Zrt(),iEt=new Set(["gt","gte","lt","lte"]),Hu=Symbol("none"),Ro=Symbol("tree"),Ai=Symbol("iterator"),Xa=Symbol("lowerBound"),ll=Symbol("upperBound"),Yrt=Symbol("outOfRange"),i4=Symbol("reverse"),fI=Symbol("options"),Aa=Symbol("test"),nh=Symbol("advance"),h4=Symbol("init");function Uf(i,t){if(typeof i=="string")return i<t?-1:i>t?1:0;let r=Math.min(i.byteLength,t.byteLength);for(let h=0;h<r;h++){let o=i[h]-t[h];if(o!==0)return o}return i.byteLength-t.byteLength}function nEt(i){return Uf(i,this[ll])>0}function oEt(i){return Uf(i,this[ll])>=0}function aEt(i){return Uf(i,this[ll])<0}function sEt(i){return Uf(i,this[ll])<=0}var n4=class extends tEt{constructor(t,r){super(t,r),this[h4](t[Ro],r)}_next(t){if(!this[Ai].valid)return this.nextTick(t);let r=this[Ai].key,h=this[Ai].value;if(!this[Aa](r))return this.nextTick(t);this[Ai][this[nh]](),this.nextTick(t,null,r,h)}_nextv(t,r,h){let o=this[Ai],l=[];for(;o.valid&&l.length<t&&this[Aa](o.key);)l.push([o.key,o.value]),o[this[nh]]();this.nextTick(h,null,l)}_all(t,r){let h=this.limit-this.count,o=this[Ai],l=[];for(;o.valid&&l.length<h&&this[Aa](o.key);)l.push([o.key,o.value]),o[this[nh]]();this.nextTick(r,null,l)}},o4=class extends eEt{constructor(t,r){super(t,r),this[h4](t[Ro],r)}_next(t){if(!this[Ai].valid)return this.nextTick(t);let r=this[Ai].key;if(!this[Aa](r))return this.nextTick(t);this[Ai][this[nh]](),this.nextTick(t,null,r)}_nextv(t,r,h){let o=this[Ai],l=[];for(;o.valid&&l.length<t&&this[Aa](o.key);)l.push(o.key),o[this[nh]]();this.nextTick(h,null,l)}_all(t,r){let h=this.limit-this.count,o=this[Ai],l=[];for(;o.valid&&l.length<h&&this[Aa](o.key);)l.push(o.key),o[this[nh]]();this.nextTick(r,null,l)}},a4=class extends rEt{constructor(t,r){super(t,r),this[h4](t[Ro],r)}_next(t){if(!this[Ai].valid)return this.nextTick(t);let r=this[Ai].key,h=this[Ai].value;if(!this[Aa](r))return this.nextTick(t);this[Ai][this[nh]](),this.nextTick(t,null,h)}_nextv(t,r,h){let o=this[Ai],l=[];for(;o.valid&&l.length<t&&this[Aa](o.key);)l.push(o.value),o[this[nh]]();this.nextTick(h,null,l)}_all(t,r){let h=this.limit-this.count,o=this[Ai],l=[];for(;o.valid&&l.length<h&&this[Aa](o.key);)l.push(o.value),o[this[nh]]();this.nextTick(r,null,l)}};for(let i of[n4,o4,a4])i.prototype[h4]=function(t,r){this[i4]=r.reverse,this[fI]=r,this[i4]?(this[nh]="prev",this[Xa]="lte"in r?r.lte:"lt"in r?r.lt:Hu,this[ll]="gte"in r?r.gte:"gt"in r?r.gt:Hu,this[Xa]===Hu?this[Ai]=t.end:"lte"in r?this[Ai]=t.le(this[Xa]):this[Ai]=t.lt(this[Xa]),this[ll]!==Hu&&(this[Aa]="gte"in r?oEt:nEt)):(this[nh]="next",this[Xa]="gte"in r?r.gte:"gt"in r?r.gt:Hu,this[ll]="lte"in r?r.lte:"lt"in r?r.lt:Hu,this[Xa]===Hu?this[Ai]=t.begin:"gte"in r?this[Ai]=t.ge(this[Xa]):this[Ai]=t.gt(this[Xa]),this[ll]!==Hu&&(this[Aa]="lte"in r?sEt:aEt))},i.prototype[Aa]=function(){return!0},i.prototype[Yrt]=function(t){return this[Aa](t)?this[Xa]===Hu?!1:this[i4]?"lte"in this[fI]?Uf(t,this[Xa])>0:Uf(t,this[Xa])>=0:"gte"in this[fI]?Uf(t,this[Xa])<0:Uf(t,this[Xa])<=0:!0},i.prototype._seek=function(t,r){this[Yrt](t)?(this[Ai]=this[Ai].tree.end,this[Ai].next()):this[i4]?this[Ai]=this[Ai].tree.le(t):this[Ai]=this[Ai].tree.ge(t)};var s4=class extends QSt{constructor(t,r,h){if(typeof t=="object"&&t!==null&&(r=t),typeof t=="function"||typeof r=="function"||typeof h=="function")throw new Jrt("The levelup-style callback argument has been removed",{code:"LEVEL_LEGACY"});let{storeEncoding:o,...l}=r||{};if(o=o||"buffer",!["buffer","view","utf8"].includes(o))throw new Jrt("The storeEncoding option must be 'buffer', 'view' or 'utf8'",{code:"LEVEL_ENCODING_NOT_SUPPORTED"});super({seek:!0,permanence:!1,createIfMissing:!1,errorIfExists:!1,encodings:{[o]:!0}},l),this[Ro]=Xrt(Uf)}_put(t,r,h,o){let l=this[Ro].find(t);l.valid?this[Ro]=l.update(r):this[Ro]=this[Ro].insert(t,r),this.nextTick(o)}_get(t,r,h){let o=this[Ro].get(t);if(typeof o>"u")return this.nextTick(h,new Error("NotFound"));this.nextTick(h,null,o)}_getMany(t,r,h){this.nextTick(h,null,t.map(o=>this[Ro].get(o)))}_del(t,r,h){this[Ro]=this[Ro].remove(t),this.nextTick(h)}_batch(t,r,h){let o=this[Ro];for(let l of t){let c=l.key,p=o.find(c);l.type==="put"?o=p.valid?p.update(l.value):o.insert(c,l.value):o=p.remove()}this[Ro]=o,this.nextTick(h)}_clear(t,r){if(t.limit===-1&&!Object.keys(t).some(hEt))return this[Ro]=Xrt(Uf),this.nextTick(r);let h=this._keys({...t}),o=h.limit,l=0,c=()=>{for(let p=0;p<500;p++){if(++l>o||!h[Ai].valid||!h[Aa](h[Ai].key))return r();this[Ro]=this[Ro].remove(h[Ai].key),h[Ai][h[nh]]()}this.nextTick(c)};this.nextTick(c)}_iterator(t){return new n4(this,t)}_keys(t){return new o4(this,t)}_values(t){return new a4(this,t)}};Qrt.MemoryLevel=s4;if(typeof me<"u"&&!me.browser&&typeof global<"u"&&typeof global.setImmediate=="function"){let i=global.setImmediate;s4.prototype.nextTick=function(t,...r){r.length===0?i(t):i(()=>t(...r))}}function hEt(i){return iEt.has(i)}});var Hm=De(u4=>{"use strict";Tt();Rt();xt();Object.defineProperty(u4,"__esModule",{value:!0});u4.LevelDbCache=void 0;var uI=$u(),fEt=Hrt(),uEt=tit(),cEt=bn(),f4=class{constructor(t,r=!1){this.value=t,this.tomb=r}},cI=class{get db(){if(!this._db)if(this.cacheOptions.inMemory)this._db=new uEt.MemoryLevel(this.subLevelOptions);else{if(!this.cacheOptions.dbLocation)throw new Error("LevelDb cache configuration error - no db location specified");let t=this.cacheOptions.dbLocation;this.logger.info(`Using location ${t}`),this._db=new fEt.Level(t,this.subLevelOptions)}return this._db}constructor(t){this.cacheOptions=t,this.ongoingTransactionMark="$$warp-internal-transaction$$",this.logger=cEt.LoggerFactory.INST.create("LevelDbCache"),this.subLevelSeparator=t.subLevelSeparator||"!",this.subLevelOptions={valueEncoding:"json",separator:this.subLevelSeparator}}async get(t,r){this.validateKey(t.key);let h=this.db.sublevel(t.key,this.subLevelOptions);await h.open();let o=await this.getValueFromLevel(t.sortKey,h);return o?new uI.SortKeyCacheResult(t.sortKey,o):null}async getLast(t){let r=this.db.sublevel(t,this.subLevelOptions);await r.open();let h=await r.keys({reverse:!0,limit:1}).all();if(h.length){let o=await this.getValueFromLevel(h[0],r);if(o)return new uI.SortKeyCacheResult(h[0],o)}return null}async getLessOrEqual(t,r){let h=this.db.sublevel(t,this.subLevelOptions);await h.open();let o=await h.keys({reverse:!0,lte:r,limit:1}).all();if(o.length){let l=await this.getValueFromLevel(o[0],h);if(l!=null)return new uI.SortKeyCacheResult(o[0],l)}return null}async getValueFromLevel(t,r){try{let h=await r.get(t);if(h&&h.tomb===void 0&&h.value===void 0)return h;if(h&&h.tomb===!1&&h.value!=null)return h.value}catch(h){if(h.code!="LEVEL_NOT_FOUND")throw h}return null}async put(t,r){await this.setClientValue(t,new f4(r))}async del(t){await this.setClientValue(t,new f4(null,!0))}async setClientValue(t,r){this.validateKey(t.key);let h=this.db.sublevel(t.key,this.subLevelOptions);await h.open(),await h.put(t.sortKey,r),this._rollbackBatch&&this._rollbackBatch.del(t.sortKey,{sublevel:h})}async delete(t){let r=this.db.sublevel(t,this.subLevelOptions);await r.open(),await r.clear()}async batch(t){for(let r of t)r.type==="put"?await this.put(r.key,r.value):r.type==="del"&&await this.delete(r.key)}async open(){await this.db.open()}async close(){this._db&&await this._db.close()}async begin(){await this.initRollbackBatch()}async rollback(){this._rollbackBatch&&(this._rollbackBatch.del(this.ongoingTransactionMark),await this._rollbackBatch.write(),await this._rollbackBatch.close()),this._rollbackBatch=null}async initRollbackBatch(){return this._rollbackBatch==null&&(await this.checkPreviousTransactionFinished(),await this.db.put(this.ongoingTransactionMark,"ongoing"),this._rollbackBatch=this.db.batch()),this._rollbackBatch}async checkPreviousTransactionFinished(){let t;try{t=await this.db.get(this.ongoingTransactionMark)}catch(r){if(r.code!="LEVEL_NOT_FOUND")throw r}if(t=="ongoing")throw new Error("Database seems to be in inconsistent state. The previous transaction has not finished.")}async commit(){this._rollbackBatch&&(await this._rollbackBatch.clear(),await this.db.del(this.ongoingTransactionMark),await this._rollbackBatch.close()),this._rollbackBatch=null}async dump(){return await this.db.iterator().all()}async getLastSortKey(){let t="";await this.db.open();let r=await this.db.keys().all();for(let h of r){let o=h.split(this.subLevelSeparator)[1];o.localeCompare(t)>0&&(t=o)}return t==""?null:t}async keys(t,r){return Array.from((await this.kvMap(t,r)).keys())}validateKey(t){if(t.includes(this.ongoingTransactionMark))throw new Error(`Validation error: Key ${t} for internal use only`);if(t.includes(this.subLevelSeparator))throw new Error(`Validation error: key ${t} contains db separator ${this.subLevelSeparator}`)}extractOriginalKey(t){return t.split(this.subLevelSeparator)[1]}extractSortKey(t){return t.split(this.subLevelSeparator)[2]}async kvMap(t,r){let h=new Map,o=(await this.db.keys(this.levelRangeOptions(r)).all()).filter(l=>l!=this.ongoingTransactionMark).filter(l=>!t||this.extractSortKey(l).localeCompare(t)<=0).map(l=>this.extractOriginalKey(l));for(let l of o){let c=await this.getLessOrEqual(l,t);c&&h.set(l,c.cachedValue)}if(r?.limit){let l=new Map;for(let c of Array.from(h.entries()).slice(0,r.limit))l.set(c[0],c[1]);return l}return h}levelRangeOptions(t){let r={reverse:t?.reverse};return t?.gte&&(r.gte=this.subLevelSeparator+t.gte),t?.lt&&(r.lt=this.subLevelSeparator+t.lt),r}storage(){return this.db}async getNumEntries(){return(await this.db.keys().all()).length}async prune(t=5){(!t||t<=0)&&(t=1);let r=await this.allKeys();for(let h=0;h<r.length;h++){let o=this.db.sublevel(r[h],this.subLevelOptions);await o.open();let l=await o.keys({reverse:!0,limit:t}).all();!l||l.length<t||(await o.clear({lt:l[l.length-1]}),await o.close())}return null}async allKeys(){return(await this.db.keys().all()).filter(t=>t!=this.ongoingTransactionMark).map(t=>this.extractOriginalKey(t))}};u4.LevelDbCache=cI});var eit=De(c4=>{"use strict";Tt();Rt();xt();Object.defineProperty(c4,"__esModule",{value:!0});c4.MemCache=void 0;var lI=class{constructor(){this.storage={}}clearAll(){Object.keys(this.storage).forEach(t=>{delete this.storage[t]})}contains(t){return Object.prototype.hasOwnProperty.call(this.storage,t)}get(t){return this.storage[t]}put(t,r){this.storage[t]=r}remove(t){delete this.storage[t]}};c4.MemCache=lI});var iit=De(rit=>{"use strict";Tt();Rt();xt();Object.defineProperty(rit,"__esModule",{value:!0})});var oit=De(nit=>{"use strict";Tt();Rt();xt();Object.defineProperty(nit,"__esModule",{value:!0})});var sit=De(ait=>{"use strict";Tt();Rt();xt();Object.defineProperty(ait,"__esModule",{value:!0})});var fit=De(hit=>{"use strict";Tt();Rt();xt();Object.defineProperty(hit,"__esModule",{value:!0})});var Gu=De((fXt,dI)=>{"use strict";Tt();Rt();xt();typeof window<"u"?(window.global=window,global.fetch=window.fetch,dI.exports={Buffer:(af(),Dn(uc)).Buffer,Crypto:window.crypto}):dI.exports={Buffer:(af(),Dn(uc)).Buffer,Crypto:crypto}});var wit=De(vp=>{"use strict";Tt();Rt();xt();Object.defineProperty(vp,"__esModule",{value:!0});var lEt=Function.prototype.toString,pI=Object.create,dEt=Object.prototype.toString,pEt=function(){function i(){this._keys=[],this._values=[]}return i.prototype.has=function(t){return!!~this._keys.indexOf(t)},i.prototype.get=function(t){return this._values[this._keys.indexOf(t)]},i.prototype.set=function(t,r){this._keys.push(t),this._values.push(r)},i}();function gEt(){return new pEt}function mEt(){return new WeakMap}var vEt=typeof WeakMap<"u"?mEt:gEt;function mI(i){if(!i)return pI(null);var t=i.constructor;if(t===Object)return i===Object.prototype?{}:pI(i);if(t&&~lEt.call(t).indexOf("[native code]"))try{return new t}catch{}return pI(i)}function yEt(i){var t="";return i.global&&(t+="g"),i.ignoreCase&&(t+="i"),i.multiline&&(t+="m"),i.unicode&&(t+="u"),i.sticky&&(t+="y"),t}function bEt(i){return i.flags}var wEt=/test/g.flags==="g"?bEt:yEt;function uit(i){var t=dEt.call(i);return t.substring(8,t.length-1)}function _Et(i){return i[Symbol.toStringTag]||uit(i)}var MEt=typeof Symbol<"u"?_Et:uit,SEt=Object.defineProperty,EEt=Object.getOwnPropertyDescriptor,cit=Object.getOwnPropertyNames,vI=Object.getOwnPropertySymbols,lit=Object.prototype,dit=lit.hasOwnProperty,AEt=lit.propertyIsEnumerable,pit=typeof vI=="function";function TEt(i){return cit(i).concat(vI(i))}var xEt=pit?TEt:cit;function d4(i,t,r){for(var h=xEt(i),o=0,l=h.length,c=void 0,p=void 0;o<l;++o)if(c=h[o],!(c==="callee"||c==="caller")){if(p=EEt(i,c),!p){t[c]=r.copier(i[c],r);continue}!p.get&&!p.set&&(p.value=r.copier(p.value,r));try{SEt(t,c,p)}catch{t[c]=p.value}}return t}function REt(i,t){var r=new t.Constructor;t.cache.set(i,r);for(var h=0,o=i.length;h<o;++h)r[h]=t.copier(i[h],t);return r}function kEt(i,t){var r=new t.Constructor;return t.cache.set(i,r),d4(i,r,t)}function git(i,t){return i.slice(0)}function IEt(i,t){return i.slice(0,i.size,i.type)}function BEt(i,t){return new t.Constructor(git(i.buffer))}function OEt(i,t){return new t.Constructor(i.getTime())}function mit(i,t){var r=new t.Constructor;return t.cache.set(i,r),i.forEach(function(h,o){r.set(o,t.copier(h,t))}),r}function CEt(i,t){return d4(i,mit(i,t),t)}function PEt(i,t){var r=mI(t.prototype);t.cache.set(i,r);for(var h in i)dit.call(i,h)&&(r[h]=t.copier(i[h],t));return r}function NEt(i,t){var r=mI(t.prototype);t.cache.set(i,r);for(var h in i)dit.call(i,h)&&(r[h]=t.copier(i[h],t));for(var o=vI(i),l=0,c=o.length,p=void 0;l<c;++l)p=o[l],AEt.call(i,p)&&(r[p]=t.copier(i[p],t));return r}var LEt=pit?NEt:PEt;function DEt(i,t){var r=mI(t.prototype);return t.cache.set(i,r),d4(i,r,t)}function gI(i,t){return new t.Constructor(i.valueOf())}function $Et(i,t){var r=new t.Constructor(i.source,wEt(i));return r.lastIndex=i.lastIndex,r}function l4(i,t){return i}function vit(i,t){var r=new t.Constructor;return t.cache.set(i,r),i.forEach(function(h){r.add(t.copier(h,t))}),r}function UEt(i,t){return d4(i,vit(i,t),t)}var qEt=Array.isArray,yI=Object.assign,FEt=Object.getPrototypeOf||function(i){return i.__proto__},yit={array:REt,arrayBuffer:git,blob:IEt,dataView:BEt,date:OEt,error:l4,map:mit,object:LEt,regExp:$Et,set:vit},jEt=yI({},yit,{array:kEt,map:CEt,object:DEt,set:UEt});function zEt(i){return{Arguments:i.object,Array:i.array,ArrayBuffer:i.arrayBuffer,Blob:i.blob,Boolean:gI,DataView:i.dataView,Date:i.date,Error:i.error,Float32Array:i.arrayBuffer,Float64Array:i.arrayBuffer,Int8Array:i.arrayBuffer,Int16Array:i.arrayBuffer,Int32Array:i.arrayBuffer,Map:i.map,Number:gI,Object:i.object,Promise:l4,RegExp:i.regExp,Set:i.set,String:gI,WeakMap:l4,WeakSet:l4,Uint8Array:i.arrayBuffer,Uint8ClampedArray:i.arrayBuffer,Uint16Array:i.arrayBuffer,Uint32Array:i.arrayBuffer,Uint64Array:i.arrayBuffer}}function bI(i){var t=yI({},yit,i),r=zEt(t),h=r.Array,o=r.Object;function l(c,p){if(p.prototype=p.Constructor=void 0,!c||typeof c!="object")return c;if(p.cache.has(c))return p.cache.get(c);if(p.prototype=FEt(c),p.Constructor=p.prototype&&p.prototype.constructor,!p.Constructor||p.Constructor===Object)return o(c,p);if(qEt(c))return h(c,p);var w=r[MEt(c)];return w?w(c,p):typeof c.then=="function"?c:o(c,p)}return function(p){return l(p,{Constructor:void 0,cache:vEt(),copier:l,prototype:void 0})}}function bit(i){return bI(yI({},jEt,i))}var WEt=bit({}),KEt=bI({});vp.copyStrict=WEt;vp.createCopier=bI;vp.createStrictCopier=bit;vp.default=KEt});var b4=De(oh=>{"use strict";Tt();Rt();xt();Object.defineProperty(oh,"__esModule",{value:!0});oh.KV=oh.SWVrf=oh.SWBlock=oh.SWTransaction=oh.SmartWeaveGlobal=void 0;var p4=$u(),HEt=ko(),wI=class{constructor(t,r,h,o,l){this.gasUsed=0,this.gasLimit=Number.MAX_SAFE_INTEGER,this.unsafeClient=t,this.arweave={ar:t.ar,utils:t.utils,wallets:t.wallets,crypto:t.crypto},this.baseArweaveUrl=`${t.api.config.protocol}://${t.api.config.host}:${t.api.config.port}`,this.safeArweaveGet=async function(c){return(0,HEt.safeGet)(`${this.baseArweaveUrl}${c}`)},this.evaluationOptions=h,this.contract=r,this.transaction=new g4(this),this.block=new m4(this),this.contracts={readContractState:(c,p,w)=>{throw new Error("Not implemented - should be set by HandlerApi implementor")},viewContractState:(c,p)=>{throw new Error("Not implemented - should be set by HandlerApi implementor")},write:(c,p,w)=>{throw new Error("Not implemented - should be set by HandlerApi implementor")},refreshState:()=>{throw new Error("Not implemented - should be set by HandlerApi implementor")}},this.vrf=new v4(this),this.useGas=this.useGas.bind(this),this.getBalance=this.getBalance.bind(this),this.extensions={},this.kv=new y4(l,o,this.transaction,this.contract.id)}useGas(t){if(t<0)throw new Error("[RE:GNE] Gas number exception - gas < 0.");if(this.gasUsed+=t,this.gasUsed>this.gasLimit)throw new Error(`[RE:OOG] Out of gas! Used: ${this.gasUsed}, limit: ${this.gasLimit}`)}async getBalance(t,r){if(!this._activeTx)throw new Error("Cannot read balance - active tx is not set.");if(!this.block.height)throw new Error("Cannot read balance - block height not set.");let h=r||this.block.height;return await fetch(`${this.evaluationOptions.walletBalanceUrl}block/height/${h}/wallet/${t}/balance`).then(o=>o.ok?o.text():Promise.reject(o)).catch(o=>{var l;throw new Error(`Unable to read wallet balance. ${o.status}. ${(l=o.body)===null||l===void 0?void 0:l.message}`)})}};oh.SmartWeaveGlobal=wI;var g4=class{constructor(t){this.smartWeaveGlobal=t}get id(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.id}get owner(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.owner.address}get target(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.recipient}get tags(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.tags}get sortKey(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.sortKey}get dryRun(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.dry===!0}get quantity(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.quantity.winston}get reward(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.fee.winston}get origin(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.source==="redstone-sequencer"?"L2":"L1"}};oh.SWTransaction=g4;var m4=class{constructor(t){this.smartWeaveGlobal=t}get height(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.block.height}get indep_hash(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.block.id}get timestamp(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current tx");return this.smartWeaveGlobal._activeTx.block.timestamp}};oh.SWBlock=m4;var v4=class{constructor(t){this.smartWeaveGlobal=t}get data(){return this.smartWeaveGlobal._activeTx.vrf}get value(){return this.smartWeaveGlobal._activeTx.vrf.bigint}randomInt(t){if(!Number.isInteger(t))throw new Error("Integer max value required for random integer generation");let r=BigInt(this.smartWeaveGlobal._activeTx.vrf.bigint)%BigInt(t)+BigInt(1);if(r>Number.MAX_SAFE_INTEGER||r<Number.MIN_SAFE_INTEGER)throw new Error("Random int cannot be cast to number");return Number(r)}};oh.SWVrf=v4;var y4=class{constructor(t,r,h,o){this._storage=t,this._interactionState=r,this._transaction=h,this._contractTxId=o}async put(t,r){this.checkStorageAvailable(),await this._storage.put(new p4.CacheKey(t,this._transaction.sortKey),r)}async get(t){var r;this.checkStorageAvailable();let h=this._transaction.sortKey,o=await this._interactionState.getKV(this._contractTxId,new p4.CacheKey(t,this._transaction.sortKey));if(o!=null)return o;let l=await this._storage.getLessOrEqual(t,this._transaction.sortKey);return(r=l?.cachedValue)!==null&&r!==void 0?r:null}async del(t){this.checkStorageAvailable();let r=this._transaction.sortKey,h=await this._interactionState.delKV(this._contractTxId,new p4.CacheKey(t,this._transaction.sortKey));if(h!=null)return h;await this._storage.del(new p4.CacheKey(t,this._transaction.sortKey))}async keys(t){let r=this._transaction.sortKey;return await this._storage.keys(r,t)}async kvMap(t){let r=this._transaction.sortKey;return this._storage.kvMap(r,t)}async begin(){if(this._storage)return this._storage.begin()}async commit(){this._storage&&(this._transaction.dryRun?await this._storage.rollback():await this._storage.commit())}async rollback(){this._storage&&await this._storage.rollback()}open(){if(this._storage)return this._storage.open()}close(){if(this._storage)return this._storage.close()}checkStorageAvailable(){if(!this._storage)throw new Error("KV Storage not available")}};oh.KV=y4});var _I=De(w4=>{"use strict";Tt();Rt();xt();Object.defineProperty(w4,"__esModule",{value:!0});w4.rustWasmImports=void 0;var GEt=bn(),VEt=(i,t,r,h,o)=>{let l=GEt.LoggerFactory.INST.create("WASM:Rust"),c={metering:{usegas:i.useGas},console:{log:function(lt){l.debug(`${i.contract.id}: ${lt}`)}},Block:{height:function(){return i.block.height},indep_hash:function(){return i.block.indep_hash},timestamp:function(){return i.block.timestamp}},Transaction:{id:function(){return i.transaction.id},owner:function(){return i.transaction.owner},target:function(){return i.transaction.target}},Contract:{id:function(){return i.contract.id},owner:function(){return i.contract.owner}},KV:{get:async function(lt){return await i.kv.get(lt)},put:async function(lt,mt){await i.kv.put(lt,mt)}},SmartWeave:{caller:function(){return i.caller},readContractState:async function(lt){return await i.contracts.readContractState(lt)},viewContractState:async function(lt,mt){return await i.contracts.viewContractState(lt,mt)},write:async function(lt,mt){return await i.contracts.write(lt,mt,!1)}},Vrf:{value:function(){return i.vrf.value},randomInt:function(lt){return i.vrf.randomInt(lt)}}},p=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});p.decode();let w=null;function m(){return(w===null||w.byteLength===0)&&(w=new Uint8Array(r.exports.memory.buffer)),w}function y(lt,mt){return p.decode(m().subarray(lt,lt+mt))}let v=new Array(128).fill(void 0);v.push(void 0,null,!0,!1);let M=v.length;function T(lt){M===v.length&&v.push(v.length+1);let mt=M;if(M=v[mt],typeof M!="number")throw new Error("corrupt heap");return v[mt]=lt,mt}function A(lt){return v[lt]}function R(lt){if(typeof lt!="boolean")throw new Error("expected a boolean argument")}function B(lt){return lt==null}function C(lt){if(typeof lt!="number")throw new Error("expected a number argument")}let P=null;function N(){return(P===null||P.byteLength===0)&&(P=new Float64Array(r.exports.memory.buffer)),P}let q=null;function W(){return(q===null||q.byteLength===0)&&(q=new Int32Array(r.exports.memory.buffer)),q}let J=0,F=new TextEncoder("utf-8"),H=typeof F.encodeInto=="function"?function(lt,mt){return F.encodeInto(lt,mt)}:function(lt,mt){let wt=F.encode(lt);return mt.set(wt),{read:lt.length,written:wt.length}};function Y(lt,mt,wt){if(typeof lt!="string")throw new Error("expected a string argument");if(wt===void 0){let O=F.encode(lt),L=mt(O.length);return m().subarray(L,L+O.length).set(O),J=O.length,L}let Mt=lt.length,ne=mt(Mt),nt=m(),I=0;for(;I<Mt;I++){let O=lt.charCodeAt(I);if(O>127)break;nt[ne+I]=O}if(I!==Mt){I!==0&&(lt=lt.slice(I)),ne=wt(ne,Mt,Mt=I+lt.length*3);let O=m().subarray(ne+I,ne+Mt),L=H(lt,O);if(L.read!==lt.length)throw new Error("failed to pass whole string");I+=L.written}return J=I,ne}function E(lt){lt<132||(v[lt]=M,M=lt)}function n(lt){let mt=A(lt);return E(lt),mt}function s(lt){let mt=typeof lt;if(mt=="number"||mt=="boolean"||lt==null)return`${lt}`;if(mt=="string")return`"${lt}"`;if(mt=="symbol"){let ne=lt.description;return ne==null?"Symbol":`Symbol(${ne})`}if(mt=="function"){let ne=lt.name;return typeof ne=="string"&&ne.length>0?`Function(${ne})`:"Function"}if(Array.isArray(lt)){let ne=lt.length,nt="[";ne>0&&(nt+=s(lt[0]));for(let I=1;I<ne;I++)nt+=", "+s(lt[I]);return nt+="]",nt}let wt=/\[object ([^\]]+)\]/.exec(toString.call(lt)),Mt;if(wt.length>1)Mt=wt[1];else return toString.call(lt);if(Mt=="Object")try{return"Object("+JSON.stringify(lt)+")"}catch{return"Object"}return lt instanceof Error?`${lt.name}: ${lt.message}
|
|
108
|
+
${JSON.stringify(ge.from(r))},${JSON.stringify(ge.from(h))},${l} => ${JSON.stringify(p)}`;return xQ(c,w)}ai.debug=xQ});var W3=De(Wa=>{"use strict";Tt();Rt();xt();var K8t=Wa&&Wa.__createBinding||(Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]}),H8t=Wa&&Wa.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),G8t=Wa&&Wa.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var r in i)r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)&&K8t(t,i,r);return H8t(t,i),t},V8t=Wa&&Wa.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Wa,"__esModule",{value:!0});Wa.Tag=void 0;var no=G8t(Ru()),Z8t=V8t(SQ()),J8t=Yx(),z3=class{get(t,r){if(!Object.getOwnPropertyNames(this).includes(t))throw new Error(`Field "${t}" is not a property of the Arweave Transaction class.`);if(this[t]instanceof Uint8Array)return r&&r.decode&&r.string?no.bufferToString(this[t]):r&&r.decode&&!r.string?this[t]:no.bufferTob64Url(this[t]);if(this[t]instanceof Array){if(r?.decode!==void 0||r?.string!==void 0)throw t==="tags"&&console.warn(`Did you mean to use 'transaction["tags"]' ?`),new Error("Cannot decode or stringify an array.");return this[t]}return r&&r.decode==!0?r&&r.string?no.b64UrlToString(this[t]):no.b64UrlToBuffer(this[t]):this[t]}},Kg=class extends z3{name;value;constructor(t,r,h=!1){super(),this.name=t,this.value=r}};Wa.Tag=Kg;var Qx=class extends z3{format=2;id="";last_tx="";owner="";tags=[];target="";quantity="0";data_size="0";data=new Uint8Array;data_root="";reward="0";signature="";chunks;constructor(t={}){super(),Object.assign(this,t),typeof this.data=="string"&&(this.data=no.b64UrlToBuffer(this.data)),t.tags&&(this.tags=t.tags.map(r=>new Kg(r.name,r.value)))}addTag(t,r){this.tags.push(new Kg(no.stringToB64Url(t),no.stringToB64Url(r)))}toJSON(){return{format:this.format,id:this.id,last_tx:this.last_tx,owner:this.owner,tags:this.tags,target:this.target,quantity:this.quantity,data:no.bufferTob64Url(this.data),data_size:this.data_size,data_root:this.data_root,data_tree:this.data_tree,reward:this.reward,signature:this.signature}}setOwner(t){this.owner=t}setSignature({id:t,owner:r,reward:h,tags:o,signature:l}){this.id=t,this.owner=r,h&&(this.reward=h),o&&(this.tags=o),this.signature=l}async prepareChunks(t){!this.chunks&&t.byteLength>0&&(this.chunks=await(0,J8t.generateTransactionChunks)(t),this.data_root=no.bufferTob64Url(this.chunks.data_root)),!this.chunks&&t.byteLength===0&&(this.chunks={chunks:[],data_root:new Uint8Array,proofs:[]},this.data_root="")}getChunk(t,r){if(!this.chunks)throw new Error("Chunks have not been prepared");let h=this.chunks.proofs[t],o=this.chunks.chunks[t];return{data_root:this.data_root,data_size:this.data_size,data_path:no.bufferTob64Url(h.proof),offset:h.offset.toString(),chunk:no.bufferTob64Url(r.slice(o.minByteRange,o.maxByteRange))}}async getSignatureData(){switch(this.format){case 1:let t=this.tags.reduce((h,o)=>no.concatBuffers([h,o.get("name",{decode:!0,string:!1}),o.get("value",{decode:!0,string:!1})]),new Uint8Array);return no.concatBuffers([this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),this.get("data",{decode:!0,string:!1}),no.stringToBuffer(this.quantity),no.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),t]);case 2:this.data_root||await this.prepareChunks(this.data);let r=this.tags.map(h=>[h.get("name",{decode:!0,string:!1}),h.get("value",{decode:!0,string:!1})]);return await(0,Z8t.default)([no.stringToBuffer(this.format.toString()),this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),no.stringToBuffer(this.quantity),no.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),r,no.stringToBuffer(this.data_size),this.get("data_root",{decode:!0,string:!1})]);default:throw new Error(`Unexpected transaction format: ${this.format}`)}}};Wa.default=Qx});var BQ=De(Hs=>{"use strict";Tt();Rt();xt();var X8t=Hs&&Hs.__createBinding||(Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]}),Y8t=Hs&&Hs.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),Q8t=Hs&&Hs.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var r in i)r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)&&X8t(t,i,r);return Y8t(t,i),t},t4t=Hs&&Hs.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Hs,"__esModule",{value:!0});Hs.TransactionUploader=void 0;var RQ=t4t(W3()),e4t=Q8t(Ru()),tR=qg(),r4t=Yx(),kQ=1,i4t=["invalid_json","chunk_too_big","data_path_too_big","offset_too_big","data_size_too_big","chunk_proof_ratio_not_attractive","invalid_proof"],IQ=1e3*40,eR=class i{api;chunkIndex=0;txPosted=!1;transaction;lastRequestTimeEnd=0;totalErrors=0;data;lastResponseStatus=0;lastResponseError="";get isComplete(){return this.txPosted&&this.chunkIndex===this.transaction.chunks.chunks.length}get totalChunks(){return this.transaction.chunks.chunks.length}get uploadedChunks(){return this.chunkIndex}get pctComplete(){return Math.trunc(this.uploadedChunks/this.totalChunks*100)}constructor(t,r){if(this.api=t,!r.id)throw new Error("Transaction is not signed");if(!r.chunks)throw new Error("Transaction chunks not prepared");this.data=r.data,this.transaction=new RQ.default(Object.assign({},r,{data:new Uint8Array(0)}))}async uploadChunk(t){if(this.isComplete)throw new Error("Upload is already complete");if(this.lastResponseError!==""?this.totalErrors++:this.totalErrors=0,this.totalErrors===100)throw new Error(`Unable to complete upload: ${this.lastResponseStatus}: ${this.lastResponseError}`);let r=this.lastResponseError===""?0:Math.max(this.lastRequestTimeEnd+IQ-Date.now(),IQ);if(r>0&&(r=r-r*Math.random()*.3,await new Promise(c=>setTimeout(c,r))),this.lastResponseError="",!this.txPosted){await this.postTransaction();return}t&&(this.chunkIndex=t);let h=this.transaction.getChunk(t||this.chunkIndex,this.data);if(!await(0,r4t.validatePath)(this.transaction.chunks.data_root,parseInt(h.offset),0,parseInt(h.data_size),e4t.b64UrlToBuffer(h.data_path)))throw new Error(`Unable to validate chunk ${this.chunkIndex}`);let l=await this.api.post("chunk",this.transaction.getChunk(this.chunkIndex,this.data)).catch(c=>(console.error(c.message),{status:-1,data:{error:c.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=l.status,this.lastResponseStatus==200)this.chunkIndex++;else if(this.lastResponseError=(0,tR.getError)(l),i4t.includes(this.lastResponseError))throw new Error(`Fatal error uploading chunk ${this.chunkIndex}: ${this.lastResponseError}`)}static async fromSerialized(t,r,h){if(!r||typeof r.chunkIndex!="number"||typeof r.transaction!="object")throw new Error("Serialized object does not match expected format.");var o=new RQ.default(r.transaction);o.chunks||await o.prepareChunks(h);let l=new i(t,o);if(l.chunkIndex=r.chunkIndex,l.lastRequestTimeEnd=r.lastRequestTimeEnd,l.lastResponseError=r.lastResponseError,l.lastResponseStatus=r.lastResponseStatus,l.txPosted=r.txPosted,l.data=h,l.transaction.data_root!==r.transaction.data_root)throw new Error("Data mismatch: Uploader doesn't match provided data.");return l}static async fromTransactionId(t,r){let h=await t.get(`tx/${r}`);if(h.status!==200)throw new Error(`Tx ${r} not found: ${h.status}`);let o=h.data;return o.data=new Uint8Array(0),{txPosted:!0,chunkIndex:0,lastResponseError:"",lastRequestTimeEnd:0,lastResponseStatus:0,transaction:o}}toJSON(){return{chunkIndex:this.chunkIndex,transaction:this.transaction,lastRequestTimeEnd:this.lastRequestTimeEnd,lastResponseStatus:this.lastResponseStatus,lastResponseError:this.lastResponseError,txPosted:this.txPosted}}async postTransaction(){if(this.totalChunks<=kQ){this.transaction.data=this.data;let h=await this.api.post("tx",this.transaction).catch(o=>(console.error(o),{status:-1,data:{error:o.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=h.status,this.transaction.data=new Uint8Array(0),h.status>=200&&h.status<300){this.txPosted=!0,this.chunkIndex=kQ;return}throw this.lastResponseError=(0,tR.getError)(h),new Error(`Unable to upload transaction: ${h.status}, ${this.lastResponseError}`)}let r=await this.api.post("tx",this.transaction);if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=r.status,!(r.status>=200&&r.status<300))throw this.lastResponseError=(0,tR.getError)(r),new Error(`Unable to upload transaction: ${r.status}, ${this.lastResponseError}`);this.txPosted=!0}};Hs.TransactionUploader=eR});var k0=De((tWt,OQ)=>{"use strict";Tt();Rt();xt();OQ.exports={}});var PQ=De(qh=>{"use strict";Tt();Rt();xt();var n4t=qh&&qh.__createBinding||(Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]}),o4t=qh&&qh.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),a4t=qh&&qh.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var r in i)r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)&&n4t(t,i,r);return o4t(t,i),t},CQ=qh&&qh.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(qh,"__esModule",{value:!0});var rR=CQ(qg()),ku=CQ(W3()),Hg=a4t(Ru()),iR=BQ();k0();var nR=class{api;crypto;chunks;constructor(t,r,h){this.api=t,this.crypto=r,this.chunks=h}async getTransactionAnchor(){let t=await this.api.get("tx_anchor");if(!t.data.match(/^[a-z0-9_-]{43,}/i)||!t.ok)throw new Error(`Could not getTransactionAnchor. Received: ${t.data}. Status: ${t.status}, ${t.statusText}`);return t.data}async getPrice(t,r){let h=r?`price/${t}/${r}`:`price/${t}`,o=await this.api.get(h);if(!/^\d+$/.test(o.data)||!o.ok)throw new Error(`Could not getPrice. Received: ${o.data}. Status: ${o.status}, ${o.statusText}`);return o.data}async get(t){let r=await this.api.get(`tx/${t}`);if(r.status==200){let h=parseInt(r.data.data_size);if(r.data.format>=2&&h>0&&h<=1024*1024*12){let o=await this.getData(t);return new ku.default({...r.data,data:o})}return new ku.default({...r.data,format:r.data.format||1})}throw r.status==404?new rR.default("TX_NOT_FOUND"):r.status==410?new rR.default("TX_FAILED"):new rR.default("TX_INVALID")}fromRaw(t){return new ku.default(t)}async search(t,r){return this.api.post("arql",{op:"equals",expr1:t,expr2:r}).then(h=>h.data?h.data:[])}getStatus(t){return this.api.get(`tx/${t}/status`).then(r=>r.status==200?{status:200,confirmed:r.data}:{status:r.status,confirmed:null})}async getData(t,r){let h;try{h=await this.chunks.downloadChunkedData(t)}catch(o){console.error(`Error while trying to download chunked data for ${t}`),console.error(o)}if(!h){console.warn(`Falling back to gateway cache for ${t}`);try{let{data:o,ok:l,status:c,statusText:p}=await this.api.get(`/${t}`,{responseType:"arraybuffer"});if(!l)throw new Error("Bad http status code",{cause:{status:c,statusText:p}});h=o}catch(o){console.error(`Error while trying to download contiguous data from gateway cache for ${t}`),console.error(o)}}if(!h)throw new Error(`${t} data was not found!`);return r&&r.decode&&!r.string?h:r&&r.decode&&r.string?Hg.bufferToString(h):Hg.bufferTob64Url(h)}async sign(t,r,h){let l=typeof r=="object"&&(p=>{let w=!0;return["n","e","d","p","q","dp","dq","qi"].map(m=>!(m in p)&&(w=!1)),w})(r),c=typeof arweaveWallet=="object";if(!l&&!c)throw new Error("No valid JWK or external wallet found to sign transaction.");if(l){t.setOwner(r.n);let p=await t.getSignatureData(),w=await this.crypto.sign(r,p,h),m=await this.crypto.hash(w);t.setSignature({id:Hg.bufferTob64Url(m),owner:r.n,signature:Hg.bufferTob64Url(w)})}else if(c){try{(await arweaveWallet.getPermissions()).includes("SIGN_TRANSACTION")||await arweaveWallet.connect(["SIGN_TRANSACTION"])}catch{}let p=await arweaveWallet.sign(t,h);t.setSignature({id:p.id,owner:p.owner,reward:p.reward,tags:p.tags,signature:p.signature})}else throw new Error("An error occurred while signing. Check wallet is valid")}async verify(t){let r=await t.getSignatureData(),h=t.get("signature",{decode:!0,string:!1}),o=Hg.bufferTob64Url(await this.crypto.hash(h));if(t.id!==o)throw new Error("Invalid transaction signature or ID! The transaction ID doesn't match the expected SHA-256 hash of the signature.");return this.crypto.verify(t.owner,r,h)}async post(t){if(typeof t=="string"?t=new ku.default(JSON.parse(t)):typeof t.readInt32BE=="function"?t=new ku.default(JSON.parse(t.toString())):typeof t=="object"&&!(t instanceof ku.default)&&(t=new ku.default(t)),!(t instanceof ku.default))throw new Error("Must be Transaction object");t.chunks||await t.prepareChunks(t.data);let r=await this.getUploader(t,t.data);try{for(;!r.isComplete;)await r.uploadChunk()}catch(h){if(r.lastResponseStatus>0)return{status:r.lastResponseStatus,statusText:r.lastResponseError,data:{error:r.lastResponseError}};throw h}return{status:200,statusText:"OK",data:{}}}async getUploader(t,r){let h;if(r instanceof ArrayBuffer&&(r=new Uint8Array(r)),t instanceof ku.default){if(r||(r=t.data),!(r instanceof Uint8Array))throw new Error("Data format is invalid");t.chunks||await t.prepareChunks(r),h=new iR.TransactionUploader(this.api,t),(!h.data||h.data.length===0)&&(h.data=r)}else{if(typeof t=="string"&&(t=await iR.TransactionUploader.fromTransactionId(this.api,t)),!r||!(r instanceof Uint8Array))throw new Error("Must provide data when resuming upload");h=await iR.TransactionUploader.fromSerialized(this.api,t,r)}return h}async*upload(t,r){let h=await this.getUploader(t,r);for(;!h.isComplete;)await h.uploadChunk(),yield h;return h}};qh.default=nR});var LQ=De(Iu=>{"use strict";Tt();Rt();xt();var s4t=Iu&&Iu.__createBinding||(Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]}),h4t=Iu&&Iu.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),f4t=Iu&&Iu.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var r in i)r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)&&s4t(t,i,r);return h4t(t,i),t};Object.defineProperty(Iu,"__esModule",{value:!0});var NQ=f4t(Ru());k0();var oR=class{api;crypto;constructor(t,r){this.api=t,this.crypto=r}getBalance(t){return this.api.get(`wallet/${t}/balance`).then(r=>r.data)}getLastTransactionID(t){return this.api.get(`wallet/${t}/last_tx`).then(r=>r.data)}generate(){return this.crypto.generateJWK()}async jwkToAddress(t){return!t||t==="use_wallet"?this.getAddress():this.getAddress(t)}async getAddress(t){if(!t||t==="use_wallet"){try{await arweaveWallet.connect(["ACCESS_ADDRESS"])}catch{}return arweaveWallet.getActiveAddress()}else return this.ownerToAddress(t.n)}async ownerToAddress(t){return NQ.bufferTob64Url(await this.crypto.hash(NQ.b64UrlToBuffer(t)))}};Iu.default=oR});var $Q=De(Fh=>{"use strict";Tt();Rt();xt();var u4t=Fh&&Fh.__createBinding||(Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]}),c4t=Fh&&Fh.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),l4t=Fh&&Fh.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var r in i)r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)&&u4t(t,i,r);return c4t(t,i),t};Object.defineProperty(Fh,"__esModule",{value:!0});Fh.SiloResource=void 0;var DQ=l4t(Ru()),aR=class{api;crypto;transactions;constructor(t,r,h){this.api=t,this.crypto=r,this.transactions=h}async get(t){if(!t)throw new Error("No Silo URI specified");let r=await this.parseUri(t),h=await this.transactions.search("Silo-Name",r.getAccessKey());if(h.length==0)throw new Error(`No data could be found for the Silo URI: ${t}`);let o=await this.transactions.get(h[0]);if(!o)throw new Error(`No data could be found for the Silo URI: ${t}`);let l=o.get("data",{decode:!0,string:!1});return this.crypto.decrypt(l,r.getEncryptionKey())}async readTransactionData(t,r){if(!r)throw new Error("No Silo URI specified");let h=await this.parseUri(r),o=t.get("data",{decode:!0,string:!1});return this.crypto.decrypt(o,h.getEncryptionKey())}async parseUri(t){let r=t.match(/^([a-z0-9-_]+)\.([0-9]+)/i);if(!r)throw new Error("Invalid Silo name, must be a name in the format of [a-z0-9]+.[0-9]+, e.g. 'bubble.7'");let h=r[1],o=Math.pow(2,parseInt(r[2])),l=await this.hash(DQ.stringToBuffer(h),o),c=DQ.bufferTob64(l.slice(0,15)),p=await this.hash(l.slice(16,31),1);return new K3(t,c,p)}async hash(t,r){let h=await this.crypto.hash(t);for(let o=0;o<r-1;o++)h=await this.crypto.hash(h);return h}};Fh.default=aR;var K3=class{uri;accessKey;encryptionKey;constructor(t,r,h){this.uri=t,this.accessKey=r,this.encryptionKey=h}getUri(){return this.uri}getAccessKey(){return this.accessKey}getEncryptionKey(){return this.encryptionKey}};Fh.SiloResource=K3});var qQ=De(Bu=>{"use strict";Tt();Rt();xt();var d4t=Bu&&Bu.__createBinding||(Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]}),p4t=Bu&&Bu.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),g4t=Bu&&Bu.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var r in i)r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)&&d4t(t,i,r);return p4t(t,i),t};Object.defineProperty(Bu,"__esModule",{value:!0});var UQ=qg(),m4t=g4t(Ru()),sR=class{api;constructor(t){this.api=t}async getTransactionOffset(t){let r=await this.api.get(`tx/${t}/offset`);if(r.status===200)return r.data;throw new Error(`Unable to get transaction offset: ${(0,UQ.getError)(r)}`)}async getChunk(t){let r=await this.api.get(`chunk/${t}`);if(r.status===200)return r.data;throw new Error(`Unable to get chunk: ${(0,UQ.getError)(r)}`)}async getChunkData(t){let r=await this.getChunk(t);return m4t.b64UrlToBuffer(r.chunk)}firstChunkOffset(t){return parseInt(t.offset)-parseInt(t.size)+1}async downloadChunkedData(t){let r=await this.getTransactionOffset(t),h=parseInt(r.size),l=parseInt(r.offset)-h+1,c=new Uint8Array(h),p=0;for(;p<h;){this.api.config.logging&&console.log(`[chunk] ${p}/${h}`);let w;try{w=await this.getChunkData(l+p)}catch{console.error(`[chunk] Failed to fetch chunk at offset ${l+p}`),console.error("[chunk] This could indicate that the chunk wasn't uploaded or hasn't yet seeded properly to a particular gateway/node")}if(w)c.set(w,p),p+=w.length;else throw new Error(`Couldn't complete data download at ${p}/${h}`)}return c}};Bu.default=sR});var jQ=De(Gg=>{"use strict";Tt();Rt();xt();var v4t=Gg&&Gg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Gg,"__esModule",{value:!0});var FQ=v4t(qg());k0();var hR=class i{api;network;static HASH_ENDPOINT="block/hash/";static HEIGHT_ENDPOINT="block/height/";constructor(t,r){this.api=t,this.network=r}async get(t){let r=await this.api.get(`${i.HASH_ENDPOINT}${t}`);if(r.status===200)return r.data;throw r.status===404?new FQ.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${r}`)}async getByHeight(t){let r=await this.api.get(`${i.HEIGHT_ENDPOINT}${t}`);if(r.status===200)return r.data;throw r.status===404?new FQ.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${r}`)}async getCurrent(){let{current:t}=await this.network.getInfo();return await this.get(t)}};Gg.default=hR});var q3=De(jh=>{"use strict";Tt();Rt();xt();var y4t=jh&&jh.__createBinding||(Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]}),b4t=jh&&jh.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),w4t=jh&&jh.__importStar||function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var r in i)r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)&&y4t(t,i,r);return b4t(t,i),t},Bf=jh&&jh.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(jh,"__esModule",{value:!0});var _4t=Bf(lF()),M4t=Bf(dF()),S4t=Bf(fQ()),E4t=Bf(uQ()),A4t=Bf(PQ()),T4t=Bf(LQ()),zQ=Bf(W3()),Vg=w4t(Ru()),x4t=Bf($Q()),R4t=Bf(qQ()),k4t=Bf(jQ()),fR=class i{api;wallets;transactions;network;blocks;ar;silo;chunks;static init;static crypto=new S4t.default;static utils=Vg;constructor(t){this.api=new M4t.default(t),this.wallets=new T4t.default(this.api,i.crypto),this.chunks=new R4t.default(this.api),this.transactions=new A4t.default(this.api,i.crypto,this.chunks),this.silo=new x4t.default(this.api,this.crypto,this.transactions),this.network=new E4t.default(this.api),this.blocks=new k4t.default(this.api,this.network),this.ar=new _4t.default}get crypto(){return i.crypto}get utils(){return i.utils}getConfig(){return{api:this.api.getConfig(),crypto:null}}async createTransaction(t,r){let h={};if(Object.assign(h,t),!t.data&&!(t.target&&t.quantity))throw new Error("A new Arweave transaction must have a 'data' value, or 'target' and 'quantity' values.");if(t.owner==null&&r&&r!=="use_wallet"&&(h.owner=r.n),t.last_tx==null&&(h.last_tx=await this.transactions.getTransactionAnchor()),typeof t.data=="string"&&(t.data=Vg.stringToBuffer(t.data)),t.data instanceof ArrayBuffer&&(t.data=new Uint8Array(t.data)),t.data&&!(t.data instanceof Uint8Array))throw new Error("Expected data to be a string, Uint8Array or ArrayBuffer");if(t.reward==null){let l=t.data?t.data.byteLength:0;h.reward=await this.transactions.getPrice(l,h.target)}h.data_root="",h.data_size=t.data?t.data.byteLength.toString():"0",h.data=t.data||new Uint8Array(0);let o=new zQ.default(h);return await o.getSignatureData(),o}async createSiloTransaction(t,r,h){let o={};if(Object.assign(o,t),!t.data)throw new Error("Silo transactions must have a 'data' value");if(!h)throw new Error("No Silo URI specified.");if(t.target||t.quantity)throw new Error("Silo transactions can only be used for storing data, sending AR to other wallets isn't supported.");if(t.owner==null){if(!r||!r.n)throw new Error("A new Arweave transaction must either have an 'owner' attribute, or you must provide the jwk parameter.");o.owner=r.n}t.last_tx==null&&(o.last_tx=await this.transactions.getTransactionAnchor());let l=await this.silo.parseUri(h);if(typeof t.data=="string"){let p=await this.crypto.encrypt(Vg.stringToBuffer(t.data),l.getEncryptionKey());o.reward=await this.transactions.getPrice(p.byteLength),o.data=Vg.bufferTob64Url(p)}if(t.data instanceof Uint8Array){let p=await this.crypto.encrypt(t.data,l.getEncryptionKey());o.reward=await this.transactions.getPrice(p.byteLength),o.data=Vg.bufferTob64Url(p)}let c=new zQ.default(o);return c.addTag("Silo-Name",l.getAccessKey()),c.addTag("Silo-Version","0.1.0"),c}arql(t){return this.api.post("/arql",t).then(r=>r.data||[])}};jh.default=fR});var lR=De((cR,WQ)=>{"use strict";Tt();Rt();xt();var I4t=cR&&cR.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},uR=I4t(q3());uR.default.init=function(i={}){return new uR.default(i)};WQ.exports=uR.default});var fk=De(q0=>{"use strict";Tt();Rt();xt();Object.defineProperty(q0,"__esModule",{value:!0});q0.lvlToOrder=q0.LogLevelOrder=void 0;q0.LogLevelOrder={silly:0,trace:1,debug:2,info:3,warn:4,error:5,fatal:6,none:7};function VMt(i){return q0.LogLevelOrder[i]}q0.lvlToOrder=VMt});var ck=De(T8=>{"use strict";Tt();Rt();xt();Object.defineProperty(T8,"__esModule",{value:!0});T8.ConsoleLogger=void 0;var Det=fk(),uk=class{constructor(t,r){this.moduleName=t,this.settings=r}trace(t,...r){this.shouldLog("trace")&&console.debug(this.message("trace",t),r)}error(t,...r){this.shouldLog("error")&&console.error(this.message("error",t),r)}info(t,...r){this.shouldLog("info")&&console.info(this.message("info",t),r)}silly(t,...r){this.shouldLog("silly")&&console.debug(this.message("silly",t),r)}debug(t,...r){this.shouldLog("debug")&&console.debug(this.message("debug",t),r)}warn(t,...r){this.shouldLog("warn")&&console.warn(this.message("warn",t),r)}log(t,...r){this.shouldLog("info")&&console.info(this.message("info",t),r)}fatal(t,...r){this.shouldLog("fatal")&&console.error(this.message("fatal",t),r)}shouldLog(t){return(0,Det.lvlToOrder)(t)>=(0,Det.lvlToOrder)(this.settings.minLevel)}setSettings(t){this.settings=t}message(t,r){return`${new Date().toISOString()} ${t.toUpperCase()} [${this.moduleName}] ${r}`}};T8.ConsoleLogger=uk});var dk=De(x8=>{"use strict";Tt();Rt();xt();Object.defineProperty(x8,"__esModule",{value:!0});x8.ConsoleLoggerFactory=void 0;var ZMt=ck(),lk=class{constructor(){this.registeredLoggers={},this.registeredOptions={},this.defOptions={minLevel:"info"},this.setOptions=this.setOptions.bind(this),this.getOptions=this.getOptions.bind(this),this.create=this.create.bind(this),this.logLevel=this.logLevel.bind(this)}setOptions(t,r){r?this.registeredLoggers[r]?this.registeredLoggers[r].setSettings({...this.registeredLoggers[r].settings,...t}):this.registeredOptions[r]={...this.defOptions,...t}:(this.defOptions=t,Object.keys(this.registeredLoggers).forEach(h=>{this.registeredLoggers[h].setSettings({...this.registeredLoggers[h].settings,...t})}))}getOptions(t){return t?this.registeredLoggers[t]?this.registeredLoggers[t].settings:this.registeredOptions[t]?this.registeredOptions[t]:this.defOptions:this.defOptions}logLevel(t,r){this.setOptions({minLevel:t},r)}create(t="SWC"){return Object.prototype.hasOwnProperty.call(this.registeredLoggers,t)||(this.registeredLoggers[t]=new ZMt.ConsoleLogger(t,this.getOptions(t))),this.registeredLoggers[t]}};x8.ConsoleLoggerFactory=lk});var Uet=De($et=>{"use strict";Tt();Rt();xt();Object.defineProperty($et,"__esModule",{value:!0})});var bn=De(k8=>{"use strict";Tt();Rt();xt();Object.defineProperty(k8,"__esModule",{value:!0});k8.LoggerFactory=void 0;var JMt=dk(),R8=class i{constructor(){}setOptions(t,r){i.INST.setOptions(t,r)}getOptions(t){return i.INST.getOptions(t)}logLevel(t,r){i.INST.logLevel(t,r)}create(t){return i.INST.create(t)}static use(t){i.INST=t}};k8.LoggerFactory=R8;R8.INST=new JMt.ConsoleLoggerFactory});var Qs=De(I8=>{"use strict";Tt();Rt();xt();Object.defineProperty(I8,"__esModule",{value:!0});I8.Benchmark=void 0;var pk=class i{static measure(){return new i}constructor(){this.start=Date.now(),this.end=null}reset(){this.start=Date.now(),this.end=null}stop(){this.end=Date.now()}elapsed(t=!1){this.end===null&&(this.end=Date.now());let r=this.end-this.start;return t?r:`${(this.end-this.start).toFixed(0)}ms`}};I8.Benchmark=pk});var Fet=De(qet=>{"use strict";Tt();Rt();xt();Object.defineProperty(qet,"__esModule",{value:!0})});var $u=De(ap=>{"use strict";Tt();Rt();xt();Object.defineProperty(ap,"__esModule",{value:!0});ap.SortKeyCacheResult=ap.CacheKey=void 0;var gk=class{constructor(t,r){this.key=t,this.sortKey=r}};ap.CacheKey=gk;var mk=class{constructor(t,r){this.sortKey=t,this.cachedValue=r}};ap.SortKeyCacheResult=mk});var zet=De(jet=>{"use strict";Tt();Rt();xt();Object.defineProperty(jet,"__esModule",{value:!0})});var Ket=De(Wet=>{"use strict";Tt();Rt();xt();Wet.supports=function(...t){let r=t.reduce((h,o)=>Object.assign(h,o),{});return Object.assign(r,{snapshots:r.snapshots||!1,permanence:r.permanence||!1,seek:r.seek||!1,clear:r.clear||!1,getMany:r.getMany||!1,keyIterator:r.keyIterator||!1,valueIterator:r.valueIterator||!1,iteratorNextv:r.iteratorNextv||!1,iteratorAll:r.iteratorAll||!1,status:r.status||!1,createIfMissing:r.createIfMissing||!1,errorIfExists:r.errorIfExists||!1,deferredOpen:r.deferredOpen||!1,promises:r.promises||!1,streams:r.streams||!1,encodings:Object.assign({},r.encodings),events:Object.assign({},r.events),additionalMethods:Object.assign({},r.additionalMethods)})}});var th=De((RVt,Het)=>{"use strict";Tt();Rt();xt();Het.exports=class extends Error{constructor(t,r){super(t||""),typeof r=="object"&&r!==null&&(r.code&&(this.code=String(r.code)),r.expected&&(this.expected=!0),r.transient&&(this.transient=!0),r.cause&&(this.cause=r.cause)),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}});var yk=De((OVt,Get)=>{"use strict";Tt();Rt();xt();var vk=null;Get.exports=function(){return vk===null&&(vk={textEncoder:new TextEncoder,textDecoder:new TextDecoder}),vk}});var _k=De(Vet=>{"use strict";Tt();Rt();xt();var bk=th(),XMt=new Set(["buffer","view","utf8"]),wk=class{constructor(t){if(this.encode=t.encode||this.encode,this.decode=t.decode||this.decode,this.name=t.name||this.name,this.format=t.format||this.format,typeof this.encode!="function")throw new TypeError("The 'encode' property must be a function");if(typeof this.decode!="function")throw new TypeError("The 'decode' property must be a function");if(this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),typeof this.name!="string"||this.name==="")throw new TypeError("The 'name' property must be a string");if(typeof this.format!="string"||!XMt.has(this.format))throw new TypeError("The 'format' property must be one of 'buffer', 'view', 'utf8'");t.createViewTranscoder&&(this.createViewTranscoder=t.createViewTranscoder),t.createBufferTranscoder&&(this.createBufferTranscoder=t.createBufferTranscoder),t.createUTF8Transcoder&&(this.createUTF8Transcoder=t.createUTF8Transcoder)}get commonName(){return this.name.split("+")[0]}createBufferTranscoder(){throw new bk(`Encoding '${this.name}' cannot be transcoded to 'buffer'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createViewTranscoder(){throw new bk(`Encoding '${this.name}' cannot be transcoded to 'view'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createUTF8Transcoder(){throw new bk(`Encoding '${this.name}' cannot be transcoded to 'utf8'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}};Vet.Encoding=wk});var Ak=De(B8=>{"use strict";Tt();Rt();xt();var{Buffer:Sk}=(af(),Dn(uc))||{},{Encoding:Ek}=_k(),YMt=yk(),Tm=class extends Ek{constructor(t){super({...t,format:"buffer"})}createViewTranscoder(){return new xm({encode:this.encode,decode:t=>this.decode(Sk.from(t.buffer,t.byteOffset,t.byteLength)),name:`${this.name}+view`})}createBufferTranscoder(){return this}},xm=class extends Ek{constructor(t){super({...t,format:"view"})}createBufferTranscoder(){return new Tm({encode:t=>{let r=this.encode(t);return Sk.from(r.buffer,r.byteOffset,r.byteLength)},decode:this.decode,name:`${this.name}+buffer`})}createViewTranscoder(){return this}},Mk=class extends Ek{constructor(t){super({...t,format:"utf8"})}createBufferTranscoder(){return new Tm({encode:t=>Sk.from(this.encode(t),"utf8"),decode:t=>this.decode(t.toString("utf8")),name:`${this.name}+buffer`})}createViewTranscoder(){let{textEncoder:t,textDecoder:r}=YMt();return new xm({encode:h=>t.encode(this.encode(h)),decode:h=>this.decode(r.decode(h)),name:`${this.name}+view`})}createUTF8Transcoder(){return this}};B8.BufferFormat=Tm;B8.ViewFormat=xm;B8.UTF8Format=Mk});var Yet=De(F0=>{"use strict";Tt();Rt();xt();var{Buffer:Go}=(af(),Dn(uc))||{Buffer:{isBuffer:()=>!1}},{textEncoder:Jet,textDecoder:Zet}=yk()(),{BufferFormat:Rm,ViewFormat:Tk,UTF8Format:Xet}=Ak(),O8=i=>i;F0.utf8=new Xet({encode:function(i){return Go.isBuffer(i)?i.toString("utf8"):ArrayBuffer.isView(i)?Zet.decode(i):String(i)},decode:O8,name:"utf8",createViewTranscoder(){return new Tk({encode:function(i){return ArrayBuffer.isView(i)?i:Jet.encode(i)},decode:function(i){return Zet.decode(i)},name:`${this.name}+view`})},createBufferTranscoder(){return new Rm({encode:function(i){return Go.isBuffer(i)?i:ArrayBuffer.isView(i)?Go.from(i.buffer,i.byteOffset,i.byteLength):Go.from(String(i),"utf8")},decode:function(i){return i.toString("utf8")},name:`${this.name}+buffer`})}});F0.json=new Xet({encode:JSON.stringify,decode:JSON.parse,name:"json"});F0.buffer=new Rm({encode:function(i){return Go.isBuffer(i)?i:ArrayBuffer.isView(i)?Go.from(i.buffer,i.byteOffset,i.byteLength):Go.from(String(i),"utf8")},decode:O8,name:"buffer",createViewTranscoder(){return new Tk({encode:function(i){return ArrayBuffer.isView(i)?i:Go.from(String(i),"utf8")},decode:function(i){return Go.from(i.buffer,i.byteOffset,i.byteLength)},name:`${this.name}+view`})}});F0.view=new Tk({encode:function(i){return ArrayBuffer.isView(i)?i:Jet.encode(i)},decode:O8,name:"view",createBufferTranscoder(){return new Rm({encode:function(i){return Go.isBuffer(i)?i:ArrayBuffer.isView(i)?Go.from(i.buffer,i.byteOffset,i.byteLength):Go.from(String(i),"utf8")},decode:O8,name:`${this.name}+buffer`})}});F0.hex=new Rm({encode:function(i){return Go.isBuffer(i)?i:Go.from(String(i),"hex")},decode:function(i){return i.toString("hex")},name:"hex"});F0.base64=new Rm({encode:function(i){return Go.isBuffer(i)?i:Go.from(String(i),"base64")},decode:function(i){return i.toString("base64")},name:"base64"})});var ert=De(trt=>{"use strict";Tt();Rt();xt();var Qet=th(),P8=Yet(),{Encoding:QMt}=_k(),{BufferFormat:tSt,ViewFormat:eSt,UTF8Format:rSt}=Ak(),km=Symbol("formats"),C8=Symbol("encodings"),iSt=new Set(["buffer","view","utf8"]),xk=class{constructor(t){if(Array.isArray(t)){if(!t.every(r=>iSt.has(r)))throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}else throw new TypeError("The first argument 'formats' must be an array");this[C8]=new Map,this[km]=new Set(t);for(let r in P8)try{this.encoding(r)}catch(h){if(h.code!=="LEVEL_ENCODING_NOT_SUPPORTED")throw h}}encodings(){return Array.from(new Set(this[C8].values()))}encoding(t){let r=this[C8].get(t);if(r===void 0){if(typeof t=="string"&&t!==""){if(r=sSt[t],!r)throw new Qet(`Encoding '${t}' is not found`,{code:"LEVEL_ENCODING_NOT_FOUND"})}else{if(typeof t!="object"||t===null)throw new TypeError("First argument 'encoding' must be a string or object");r=nSt(t)}let{name:h,format:o}=r;if(!this[km].has(o))if(this[km].has("view"))r=r.createViewTranscoder();else if(this[km].has("buffer"))r=r.createBufferTranscoder();else if(this[km].has("utf8"))r=r.createUTF8Transcoder();else throw new Qet(`Encoding '${h}' cannot be transcoded`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"});for(let l of[t,h,r.name,r.commonName])this[C8].set(l,r)}return r}};trt.Transcoder=xk;function nSt(i){if(i instanceof QMt)return i;let t="type"in i&&typeof i.type=="string"?i.type:void 0,r=i.name||t||`anonymous-${hSt++}`;switch(oSt(i)){case"view":return new eSt({...i,name:r});case"utf8":return new rSt({...i,name:r});case"buffer":return new tSt({...i,name:r});default:throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}}function oSt(i){return"format"in i&&i.format!==void 0?i.format:"buffer"in i&&typeof i.buffer=="boolean"?i.buffer?"buffer":"utf8":"code"in i&&Number.isInteger(i.code)?"view":"buffer"}var aSt={binary:P8.buffer,"utf-8":P8.utf8},sSt={...P8,...aSt},hSt=0});var irt=De((YVt,rrt)=>{"use strict";Tt();Rt();xt();rrt.exports=typeof queueMicrotask=="function"?queueMicrotask:i=>Promise.resolve().then(i)});var Im=De(Rk=>{"use strict";Tt();Rt();xt();var nrt=irt();Rk.fromCallback=function(i,t){if(i===void 0){var r=new Promise(function(h,o){i=function(l,c){l?o(l):h(c)}});i[t!==void 0?t:"promise"]=r}else if(typeof i!="function")throw new TypeError("Callback must be a function");return i};Rk.fromPromise=function(i,t){if(t===void 0)return i;i.then(function(r){nrt(()=>t(null,r))}).catch(function(r){nrt(()=>t(r))})}});var N8=De(kk=>{"use strict";Tt();Rt();xt();kk.getCallback=function(i,t){return typeof i=="function"?i:t};kk.getOptions=function(i,t){return typeof i=="object"&&i!==null?i:t!==void 0?t:{}}});var al=De(U8=>{"use strict";Tt();Rt();xt();var{fromCallback:Ik}=Im(),Ha=th(),{getOptions:Bk,getCallback:ort}=N8(),j0=Symbol("promise"),sp=Symbol("callback"),Nf=Symbol("working"),z0=Symbol("handleOne"),Uu=Symbol("handleMany"),Ok=Symbol("autoClose"),nl=Symbol("finishWork"),Lf=Symbol("returnMany"),el=Symbol("closing"),Bm=Symbol("handleClose"),L8=Symbol("closed"),Om=Symbol("closeCallbacks"),il=Symbol("keyEncoding"),W0=Symbol("valueEncoding"),Ck=Symbol("abortOnClose"),D8=Symbol("legacy"),Pk=Symbol("keys"),Nk=Symbol("values"),rl=Symbol("limit"),eh=Symbol("count"),$8=Object.freeze({}),fSt=()=>{},art=!1,Cm=class{constructor(t,r,h){if(typeof t!="object"||t===null){let o=t===null?"null":typeof t;throw new TypeError(`The first argument must be an abstract-level database, received ${o}`)}if(typeof r!="object"||r===null)throw new TypeError("The second argument must be an options object");this[L8]=!1,this[Om]=[],this[Nf]=!1,this[el]=!1,this[Ok]=!1,this[sp]=null,this[z0]=this[z0].bind(this),this[Uu]=this[Uu].bind(this),this[Bm]=this[Bm].bind(this),this[il]=r[il],this[W0]=r[W0],this[D8]=h,this[rl]=Number.isInteger(r.limit)&&r.limit>=0?r.limit:1/0,this[eh]=0,this[Ck]=!!r.abortOnClose,this.db=t,this.db.attachResource(this),this.nextTick=t.nextTick}get count(){return this[eh]}get limit(){return this[rl]}next(t){let r;if(t===void 0)r=new Promise((h,o)=>{t=(l,c,p)=>{l?o(l):this[D8]?c===void 0&&p===void 0?h():h([c,p]):h(c)}});else if(typeof t!="function")throw new TypeError("Callback must be a function");return this[el]?this.nextTick(t,new Ha("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Nf]?this.nextTick(t,new Ha("Iterator is busy: cannot call next() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[Nf]=!0,this[sp]=t,this[eh]>=this[rl]?this.nextTick(this[z0],null):this._next(this[z0])),r}_next(t){this.nextTick(t)}nextv(t,r,h){return h=ort(r,h),h=Ik(h,j0),r=Bk(r,$8),Number.isInteger(t)?(this[el]?this.nextTick(h,new Ha("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Nf]?this.nextTick(h,new Ha("Iterator is busy: cannot call nextv() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(t<1&&(t=1),this[rl]<1/0&&(t=Math.min(t,this[rl]-this[eh])),this[Nf]=!0,this[sp]=h,t<=0?this.nextTick(this[Uu],null,[]):this._nextv(t,r,this[Uu])),h[j0]):(this.nextTick(h,new TypeError("The first argument 'size' must be an integer")),h[j0])}_nextv(t,r,h){let o=[],l=(c,p,w)=>{if(c)return h(c);if(this[D8]?p===void 0&&w===void 0:p===void 0)return h(null,o);o.push(this[D8]?[p,w]:p),o.length===t?h(null,o):this._next(l)};this._next(l)}all(t,r){return r=ort(t,r),r=Ik(r,j0),t=Bk(t,$8),this[el]?this.nextTick(r,new Ha("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Nf]?this.nextTick(r,new Ha("Iterator is busy: cannot call all() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[Nf]=!0,this[sp]=r,this[Ok]=!0,this[eh]>=this[rl]?this.nextTick(this[Uu],null,[]):this._all(t,this[Uu])),r[j0]}_all(t,r){let h=this[eh],o=[],l=()=>{let p=this[rl]<1/0?Math.min(1e3,this[rl]-h):1e3;p<=0?this.nextTick(r,null,o):this._nextv(p,$8,c)},c=(p,w)=>{p?r(p):w.length===0?r(null,o):(o.push.apply(o,w),h+=w.length,l())};l()}[nl](){let t=this[sp];return this[Ck]&&t===null?fSt:(this[Nf]=!1,this[sp]=null,this[el]&&this._close(this[Bm]),t)}[Lf](t,r,h){this[Ok]?this.close(t.bind(null,r,h)):t(r,h)}seek(t,r){if(r=Bk(r,$8),!this[el]){if(this[Nf])throw new Ha("Iterator is busy: cannot call seek() until next() has completed",{code:"LEVEL_ITERATOR_BUSY"});{let h=this.db.keyEncoding(r.keyEncoding||this[il]),o=h.format;r.keyEncoding!==o&&(r={...r,keyEncoding:o});let l=this.db.prefixKey(h.encode(t),o);this._seek(l,r)}}}_seek(t,r){throw new Ha("Iterator does not support seek()",{code:"LEVEL_NOT_SUPPORTED"})}close(t){return t=Ik(t,j0),this[L8]?this.nextTick(t):this[el]?this[Om].push(t):(this[el]=!0,this[Om].push(t),this[Nf]?this[Ck]&&this[nl]()(new Ha("Aborted on iterator close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this._close(this[Bm])),t[j0]}_close(t){this.nextTick(t)}[Bm](){this[L8]=!0,this.db.detachResource(this);let t=this[Om];this[Om]=[];for(let r of t)r()}async*[Symbol.asyncIterator](){try{let t;for(;(t=await this.next())!==void 0;)yield t}finally{this[L8]||await this.close()}}},hp=class extends Cm{constructor(t,r){super(t,r,!0),this[Pk]=r.keys!==!1,this[Nk]=r.values!==!1}[z0](t,r,h){let o=this[nl]();if(t)return o(t);try{r=this[Pk]&&r!==void 0?this[il].decode(r):void 0,h=this[Nk]&&h!==void 0?this[W0].decode(h):void 0}catch(l){return o(new ol("entry",l))}r===void 0&&h===void 0||this[eh]++,o(null,r,h)}[Uu](t,r){let h=this[nl]();if(t)return this[Lf](h,t);try{for(let o of r){let l=o[0],c=o[1];o[0]=this[Pk]&&l!==void 0?this[il].decode(l):void 0,o[1]=this[Nk]&&c!==void 0?this[W0].decode(c):void 0}}catch(o){return this[Lf](h,new ol("entries",o))}this[eh]+=r.length,this[Lf](h,null,r)}end(t){return!art&&typeof console<"u"&&(art=!0,console.warn(new Ha("The iterator.end() method was renamed to close() and end() is an alias that will be removed in a future version",{code:"LEVEL_LEGACY"}))),this.close(t)}},Lk=class extends Cm{constructor(t,r){super(t,r,!1)}[z0](t,r){let h=this[nl]();if(t)return h(t);try{r=r!==void 0?this[il].decode(r):void 0}catch(o){return h(new ol("key",o))}r!==void 0&&this[eh]++,h(null,r)}[Uu](t,r){let h=this[nl]();if(t)return this[Lf](h,t);try{for(let o=0;o<r.length;o++){let l=r[o];r[o]=l!==void 0?this[il].decode(l):void 0}}catch(o){return this[Lf](h,new ol("keys",o))}this[eh]+=r.length,this[Lf](h,null,r)}},Dk=class extends Cm{constructor(t,r){super(t,r,!1)}[z0](t,r){let h=this[nl]();if(t)return h(t);try{r=r!==void 0?this[W0].decode(r):void 0}catch(o){return h(new ol("value",o))}r!==void 0&&this[eh]++,h(null,r)}[Uu](t,r){let h=this[nl]();if(t)return this[Lf](h,t);try{for(let o=0;o<r.length;o++){let l=r[o];r[o]=l!==void 0?this[W0].decode(l):void 0}}catch(o){return this[Lf](h,new ol("values",o))}this[eh]+=r.length,this[Lf](h,null,r)}},ol=class extends Ha{constructor(t,r){super(`Iterator could not decode ${t}`,{code:"LEVEL_DECODE_ERROR",cause:r})}};for(let i of["_ended property","_nexting property","_end method"])Object.defineProperty(hp.prototype,i.split(" ")[0],{get(){throw new Ha(`The ${i} has been removed`,{code:"LEVEL_LEGACY"})},set(){throw new Ha(`The ${i} has been removed`,{code:"LEVEL_LEGACY"})}});hp.keyEncoding=il;hp.valueEncoding=W0;U8.AbstractIterator=hp;U8.AbstractKeyIterator=Lk;U8.AbstractValueIterator=Dk});var srt=De($k=>{"use strict";Tt();Rt();xt();var{AbstractKeyIterator:uSt,AbstractValueIterator:cSt}=al(),K0=Symbol("iterator"),Pm=Symbol("callback"),fp=Symbol("handleOne"),H0=Symbol("handleMany"),Nm=class extends uSt{constructor(t,r){super(t,r),this[K0]=t.iterator({...r,keys:!0,values:!1}),this[fp]=this[fp].bind(this),this[H0]=this[H0].bind(this)}},q8=class extends cSt{constructor(t,r){super(t,r),this[K0]=t.iterator({...r,keys:!1,values:!0}),this[fp]=this[fp].bind(this),this[H0]=this[H0].bind(this)}};for(let i of[Nm,q8]){let t=i===Nm,r=t?h=>h[0]:h=>h[1];i.prototype._next=function(h){this[Pm]=h,this[K0].next(this[fp])},i.prototype[fp]=function(h,o,l){let c=this[Pm];h?c(h):c(null,t?o:l)},i.prototype._nextv=function(h,o,l){this[Pm]=l,this[K0].nextv(h,o,this[H0])},i.prototype._all=function(h,o){this[Pm]=o,this[K0].all(h,this[H0])},i.prototype[H0]=function(h,o){let l=this[Pm];h?l(h):l(null,o.map(r))},i.prototype._seek=function(h,o){this[K0].seek(h,o)},i.prototype._close=function(h){this[K0].close(h)}}$k.DefaultKeyIterator=Nm;$k.DefaultValueIterator=q8});var hrt=De(H8=>{"use strict";Tt();Rt();xt();var{AbstractIterator:lSt,AbstractKeyIterator:dSt,AbstractValueIterator:pSt}=al(),Uk=th(),Ea=Symbol("nut"),W8=Symbol("undefer"),K8=Symbol("factory"),F8=class extends lSt{constructor(t,r){super(t,r),this[Ea]=null,this[K8]=()=>t.iterator(r),this.db.defer(()=>this[W8]())}},j8=class extends dSt{constructor(t,r){super(t,r),this[Ea]=null,this[K8]=()=>t.keys(r),this.db.defer(()=>this[W8]())}},z8=class extends pSt{constructor(t,r){super(t,r),this[Ea]=null,this[K8]=()=>t.values(r),this.db.defer(()=>this[W8]())}};for(let i of[F8,j8,z8])i.prototype[W8]=function(){this.db.status==="open"&&(this[Ea]=this[K8]())},i.prototype._next=function(t){this[Ea]!==null?this[Ea].next(t):this.db.status==="opening"?this.db.defer(()=>this._next(t)):this.nextTick(t,new Uk("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},i.prototype._nextv=function(t,r,h){this[Ea]!==null?this[Ea].nextv(t,r,h):this.db.status==="opening"?this.db.defer(()=>this._nextv(t,r,h)):this.nextTick(h,new Uk("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},i.prototype._all=function(t,r){this[Ea]!==null?this[Ea].all(r):this.db.status==="opening"?this.db.defer(()=>this._all(t,r)):this.nextTick(r,new Uk("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},i.prototype._seek=function(t,r){this[Ea]!==null?this[Ea]._seek(t,r):this.db.status==="opening"&&this.db.defer(()=>this._seek(t,r))},i.prototype._close=function(t){this[Ea]!==null?this[Ea].close(t):this.db.status==="opening"?this.db.defer(()=>this._close(t)):this.nextTick(t)};H8.DeferredIterator=F8;H8.DeferredKeyIterator=j8;H8.DeferredValueIterator=z8});var Fk=De(urt=>{"use strict";Tt();Rt();xt();var{fromCallback:frt}=Im(),G8=th(),{getCallback:gSt,getOptions:mSt}=N8(),V8=Symbol("promise"),rh=Symbol("status"),up=Symbol("operations"),Lm=Symbol("finishClose"),cp=Symbol("closeCallbacks"),qk=class{constructor(t){if(typeof t!="object"||t===null){let r=t===null?"null":typeof t;throw new TypeError(`The first argument must be an abstract-level database, received ${r}`)}this[up]=[],this[cp]=[],this[rh]="open",this[Lm]=this[Lm].bind(this),this.db=t,this.db.attachResource(this),this.nextTick=t.nextTick}get length(){return this[up].length}put(t,r,h){if(this[rh]!=="open")throw new G8("Batch is not open: cannot call put() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let o=this.db._checkKey(t)||this.db._checkValue(r);if(o)throw o;let l=h&&h.sublevel!=null?h.sublevel:this.db,c=h,p=l.keyEncoding(h&&h.keyEncoding),w=l.valueEncoding(h&&h.valueEncoding),m=p.format;h={...h,keyEncoding:m,valueEncoding:w.format},l!==this.db&&(h.sublevel=null);let y=l.prefixKey(p.encode(t),m),v=w.encode(r);return this._put(y,v,h),this[up].push({...c,type:"put",key:t,value:r}),this}_put(t,r,h){}del(t,r){if(this[rh]!=="open")throw new G8("Batch is not open: cannot call del() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let h=this.db._checkKey(t);if(h)throw h;let o=r&&r.sublevel!=null?r.sublevel:this.db,l=r,c=o.keyEncoding(r&&r.keyEncoding),p=c.format;return r={...r,keyEncoding:p},o!==this.db&&(r.sublevel=null),this._del(o.prefixKey(c.encode(t),p),r),this[up].push({...l,type:"del",key:t}),this}_del(t,r){}clear(){if(this[rh]!=="open")throw new G8("Batch is not open: cannot call clear() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});return this._clear(),this[up]=[],this}_clear(){}write(t,r){return r=gSt(t,r),r=frt(r,V8),t=mSt(t),this[rh]!=="open"?this.nextTick(r,new G8("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"})):this.length===0?this.close(r):(this[rh]="writing",this._write(t,h=>{this[rh]="closing",this[cp].push(()=>r(h)),h||this.db.emit("batch",this[up]),this._close(this[Lm])})),r[V8]}_write(t,r){}close(t){return t=frt(t,V8),this[rh]==="closing"?this[cp].push(t):this[rh]==="closed"?this.nextTick(t):(this[cp].push(t),this[rh]!=="writing"&&(this[rh]="closing",this._close(this[Lm]))),t[V8]}_close(t){this.nextTick(t)}[Lm](){this[rh]="closed",this.db.detachResource(this);let t=this[cp];this[cp]=[];for(let r of t)r()}};urt.AbstractChainedBatch=qk});var lrt=De(crt=>{"use strict";Tt();Rt();xt();var{AbstractChainedBatch:vSt}=Fk(),ySt=th(),lp=Symbol("encoded"),jk=class extends vSt{constructor(t){super(t),this[lp]=[]}_put(t,r,h){this[lp].push({...h,type:"put",key:t,value:r})}_del(t,r){this[lp].push({...r,type:"del",key:t})}_clear(){this[lp]=[]}_write(t,r){this.db.status==="opening"?this.db.defer(()=>this._write(t,r)):this.db.status==="open"?this[lp].length===0?this.nextTick(r):this.db._batch(this[lp],t,r):this.nextTick(r,new ySt("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"}))}};crt.DefaultChainedBatch=jk});var grt=De((IZt,prt)=>{"use strict";Tt();Rt();xt();var drt=th(),bSt=Object.prototype.hasOwnProperty,wSt=new Set(["lt","lte","gt","gte"]);prt.exports=function(i,t){let r={};for(let h in i)if(bSt.call(i,h)&&!(h==="keyEncoding"||h==="valueEncoding")){if(h==="start"||h==="end")throw new drt(`The legacy range option '${h}' has been removed`,{code:"LEVEL_LEGACY"});if(h==="encoding")throw new drt("The levelup-style 'encoding' alias has been removed, use 'valueEncoding' instead",{code:"LEVEL_LEGACY"});wSt.has(h)?r[h]=t.encode(i[h]):r[h]=i[h]}return r.reverse=!!r.reverse,r.limit=Number.isInteger(r.limit)&&r.limit>=0?r.limit:-1,r}});var zk=De((PZt,vrt)=>{"use strict";Tt();Rt();xt();var mrt;vrt.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:global):i=>(mrt||(mrt=Promise.resolve())).then(i).catch(t=>setTimeout(()=>{throw t},0))});var wrt=De(($Zt,brt)=>{"use strict";Tt();Rt();xt();var yrt=zk();brt.exports=function(i,...t){t.length===0?yrt(i):yrt(()=>i(...t))}});var _rt=De(Z8=>{"use strict";Tt();Rt();xt();var{AbstractIterator:_St,AbstractKeyIterator:MSt,AbstractValueIterator:SSt}=al(),dp=Symbol("unfix"),Hh=Symbol("iterator"),G0=Symbol("handleOne"),sl=Symbol("handleMany"),qu=Symbol("callback"),Dm=class extends _St{constructor(t,r,h,o){super(t,r),this[Hh]=h,this[dp]=o,this[G0]=this[G0].bind(this),this[sl]=this[sl].bind(this),this[qu]=null}[G0](t,r,h){let o=this[qu];if(t)return o(t);r!==void 0&&(r=this[dp](r)),o(t,r,h)}[sl](t,r){let h=this[qu];if(t)return h(t);for(let o of r){let l=o[0];l!==void 0&&(o[0]=this[dp](l))}h(t,r)}},$m=class extends MSt{constructor(t,r,h,o){super(t,r),this[Hh]=h,this[dp]=o,this[G0]=this[G0].bind(this),this[sl]=this[sl].bind(this),this[qu]=null}[G0](t,r){let h=this[qu];if(t)return h(t);r!==void 0&&(r=this[dp](r)),h(t,r)}[sl](t,r){let h=this[qu];if(t)return h(t);for(let o=0;o<r.length;o++){let l=r[o];l!==void 0&&(r[o]=this[dp](l))}h(t,r)}},Um=class extends SSt{constructor(t,r,h){super(t,r),this[Hh]=h}};for(let i of[Dm,$m])i.prototype._next=function(t){this[qu]=t,this[Hh].next(this[G0])},i.prototype._nextv=function(t,r,h){this[qu]=h,this[Hh].nextv(t,r,this[sl])},i.prototype._all=function(t,r){this[qu]=r,this[Hh].all(t,this[sl])};for(let i of[Um])i.prototype._next=function(t){this[Hh].next(t)},i.prototype._nextv=function(t,r,h){this[Hh].nextv(t,r,h)},i.prototype._all=function(t,r){this[Hh].all(t,r)};for(let i of[Dm,$m,Um])i.prototype._seek=function(t,r){this[Hh].seek(t,r)},i.prototype._close=function(t){this[Hh].close(t)};Z8.AbstractSublevelIterator=Dm;Z8.AbstractSublevelKeyIterator=$m;Z8.AbstractSublevelValueIterator=Um});var Art=De((HZt,Ert)=>{"use strict";Tt();Rt();xt();var Wk=th(),{Buffer:Gk}=(af(),Dn(uc))||{},{AbstractSublevelIterator:ESt,AbstractSublevelKeyIterator:ASt,AbstractSublevelValueIterator:TSt}=_rt(),Fu=Symbol("prefix"),Mrt=Symbol("upperBound"),qm=Symbol("prefixRange"),Ga=Symbol("parent"),Kk=Symbol("unfix"),Srt=new TextEncoder,xSt={separator:"!"};Ert.exports=function({AbstractLevel:i}){class t extends i{static defaults(h){if(typeof h=="string")throw new Wk("The subleveldown string shorthand for { separator } has been removed",{code:"LEVEL_LEGACY"});if(h&&h.open)throw new Wk("The subleveldown open option has been removed",{code:"LEVEL_LEGACY"});return h==null?xSt:h.separator?h:{...h,separator:"!"}}constructor(h,o,l){let{separator:c,manifest:p,...w}=t.defaults(l);o=kSt(o,c);let m=c.charCodeAt(0)+1,y=h[Ga]||h;if(!Srt.encode(o).every(T=>T>m&&T<127))throw new Wk(`Prefix must use bytes > ${m} < 127`,{code:"LEVEL_INVALID_PREFIX"});super(RSt(y,p),w);let v=(h.prefix||"")+c+o+c,M=v.slice(0,-1)+String.fromCharCode(m);this[Ga]=y,this[Fu]=new J8(v),this[Mrt]=new J8(M),this[Kk]=new Vk,this.nextTick=y.nextTick}prefixKey(h,o){if(o==="utf8")return this[Fu].utf8+h;if(h.byteLength===0)return this[Fu][o];if(o==="view"){let l=this[Fu].view,c=new Uint8Array(l.byteLength+h.byteLength);return c.set(l,0),c.set(h,l.byteLength),c}else{let l=this[Fu].buffer;return Gk.concat([l,h],l.byteLength+h.byteLength)}}[qm](h,o){h.gte!==void 0?h.gte=this.prefixKey(h.gte,o):h.gt!==void 0?h.gt=this.prefixKey(h.gt,o):h.gte=this[Fu][o],h.lte!==void 0?h.lte=this.prefixKey(h.lte,o):h.lt!==void 0?h.lt=this.prefixKey(h.lt,o):h.lte=this[Mrt][o]}get prefix(){return this[Fu].utf8}get db(){return this[Ga]}_open(h,o){this[Ga].open({passive:!0},o)}_put(h,o,l,c){this[Ga].put(h,o,l,c)}_get(h,o,l){this[Ga].get(h,o,l)}_getMany(h,o,l){this[Ga].getMany(h,o,l)}_del(h,o,l){this[Ga].del(h,o,l)}_batch(h,o,l){this[Ga].batch(h,o,l)}_clear(h,o){this[qm](h,h.keyEncoding),this[Ga].clear(h,o)}_iterator(h){this[qm](h,h.keyEncoding);let o=this[Ga].iterator(h),l=this[Kk].get(this[Fu].utf8.length,h.keyEncoding);return new ESt(this,h,o,l)}_keys(h){this[qm](h,h.keyEncoding);let o=this[Ga].keys(h),l=this[Kk].get(this[Fu].utf8.length,h.keyEncoding);return new ASt(this,h,o,l)}_values(h){this[qm](h,h.keyEncoding);let o=this[Ga].values(h);return new TSt(this,h,o)}}return{AbstractSublevel:t}};var RSt=function(i,t){return{...i.supports,createIfMissing:!1,errorIfExists:!1,events:{},additionalMethods:{},...t,encodings:{utf8:Hk(i,"utf8"),buffer:Hk(i,"buffer"),view:Hk(i,"view")}}},Hk=function(i,t){return i.supports.encodings[t]?i.keyEncoding(t).name===t:!1},J8=class{constructor(t){this.utf8=t,this.view=Srt.encode(t),this.buffer=Gk?Gk.from(this.view.buffer,0,this.view.byteLength):{}}},Vk=class{constructor(){this.cache=new Map}get(t,r){let h=this.cache.get(r);return h===void 0&&(r==="view"?h=function(o,l){return l.subarray(o)}.bind(null,t):h=function(o,l){return l.slice(o)}.bind(null,t),this.cache.set(r,h)),h}},kSt=function(i,t){let r=0,h=i.length;for(;r<h&&i[r]===t;)r++;for(;h>r&&i[h-1]===t;)h--;return i.slice(r,h)}});var Qk=De(Yk=>{"use strict";Tt();Rt();xt();var{supports:ISt}=Ket(),{Transcoder:BSt}=ert(),{EventEmitter:OSt}=(Zd(),Dn(w9)),{fromCallback:hl}=Im(),Gh=th(),{AbstractIterator:V0}=al(),{DefaultKeyIterator:CSt,DefaultValueIterator:PSt}=srt(),{DeferredIterator:NSt,DeferredKeyIterator:LSt,DeferredValueIterator:DSt}=hrt(),{DefaultChainedBatch:Trt}=lrt(),{getCallback:Z0,getOptions:fl}=N8(),X8=grt(),hi=Symbol("promise"),ju=Symbol("landed"),J0=Symbol("resources"),Zk=Symbol("closeResources"),Fm=Symbol("operations"),jm=Symbol("undefer"),Y8=Symbol("deferOpen"),xrt=Symbol("options"),gi=Symbol("status"),X0=Symbol("defaultOptions"),pp=Symbol("transcoder"),Q8=Symbol("keyEncoding"),Jk=Symbol("valueEncoding"),$St=()=>{},zm=class extends OSt{constructor(t,r){if(super(),typeof t!="object"||t===null)throw new TypeError("The first argument 'manifest' must be an object");r=fl(r);let{keyEncoding:h,valueEncoding:o,passive:l,...c}=r;this[J0]=new Set,this[Fm]=[],this[Y8]=!0,this[xrt]=c,this[gi]="opening",this.supports=ISt(t,{status:!0,promises:!0,clear:!0,getMany:!0,deferredOpen:!0,snapshots:t.snapshots!==!1,permanence:t.permanence!==!1,keyIterator:!0,valueIterator:!0,iteratorNextv:!0,iteratorAll:!0,encodings:t.encodings||{},events:Object.assign({},t.events,{opening:!0,open:!0,closing:!0,closed:!0,put:!0,del:!0,batch:!0,clear:!0})}),this[pp]=new BSt(USt(this)),this[Q8]=this[pp].encoding(h||"utf8"),this[Jk]=this[pp].encoding(o||"utf8");for(let p of this[pp].encodings())this.supports.encodings[p.commonName]||(this.supports.encodings[p.commonName]=!0);this[X0]={empty:Object.freeze({}),entry:Object.freeze({keyEncoding:this[Q8].commonName,valueEncoding:this[Jk].commonName}),key:Object.freeze({keyEncoding:this[Q8].commonName})},this.nextTick(()=>{this[Y8]&&this.open({passive:!1},$St)})}get status(){return this[gi]}keyEncoding(t){return this[pp].encoding(t??this[Q8])}valueEncoding(t){return this[pp].encoding(t??this[Jk])}open(t,r){r=Z0(t,r),r=hl(r,hi),t={...this[xrt],...fl(t)},t.createIfMissing=t.createIfMissing!==!1,t.errorIfExists=!!t.errorIfExists;let h=o=>{this[gi]==="closing"||this[gi]==="opening"?this.once(ju,o?()=>h(o):h):this[gi]!=="open"?r(new Gh("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN",cause:o})):r()};return t.passive?this[gi]==="opening"?this.once(ju,h):this.nextTick(h):this[gi]==="closed"||this[Y8]?(this[Y8]=!1,this[gi]="opening",this.emit("opening"),this._open(t,o=>{if(o){this[gi]="closed",this[Zk](()=>{this.emit(ju),h(o)}),this[jm]();return}this[gi]="open",this[jm](),this.emit(ju),this[gi]==="open"&&this.emit("open"),this[gi]==="open"&&this.emit("ready"),h()})):this[gi]==="open"?this.nextTick(h):this.once(ju,()=>this.open(t,r)),r[hi]}_open(t,r){this.nextTick(r)}close(t){t=hl(t,hi);let r=h=>{this[gi]==="opening"||this[gi]==="closing"?this.once(ju,h?r(h):r):this[gi]!=="closed"?t(new Gh("Database is not closed",{code:"LEVEL_DATABASE_NOT_CLOSED",cause:h})):t()};if(this[gi]==="open"){this[gi]="closing",this.emit("closing");let h=o=>{this[gi]="open",this[jm](),this.emit(ju),r(o)};this[Zk](()=>{this._close(o=>{if(o)return h(o);this[gi]="closed",this[jm](),this.emit(ju),this[gi]==="closed"&&this.emit("closed"),r()})})}else this[gi]==="closed"?this.nextTick(r):this.once(ju,()=>this.close(t));return t[hi]}[Zk](t){if(this[J0].size===0)return this.nextTick(t);let r=this[J0].size,h=!0,o=()=>{--r===0&&(h?this.nextTick(t):t())};for(let l of this[J0])l.close(o);h=!1,this[J0].clear()}_close(t){this.nextTick(t)}get(t,r,h){if(h=Z0(r,h),h=hl(h,hi),r=fl(r,this[X0].entry),this[gi]==="opening")return this.defer(()=>this.get(t,r,h)),h[hi];if(gp(this,h))return h[hi];let o=this._checkKey(t);if(o)return this.nextTick(h,o),h[hi];let l=this.keyEncoding(r.keyEncoding),c=this.valueEncoding(r.valueEncoding),p=l.format,w=c.format;return(r.keyEncoding!==p||r.valueEncoding!==w)&&(r=Object.assign({},r,{keyEncoding:p,valueEncoding:w})),this._get(this.prefixKey(l.encode(t),p),r,(m,y)=>{if(m)return(m.code==="LEVEL_NOT_FOUND"||m.notFound||/NotFound/i.test(m))&&(m.code||(m.code="LEVEL_NOT_FOUND"),m.notFound||(m.notFound=!0),m.status||(m.status=404)),h(m);try{y=c.decode(y)}catch(v){return h(new Gh("Could not decode value",{code:"LEVEL_DECODE_ERROR",cause:v}))}h(null,y)}),h[hi]}_get(t,r,h){this.nextTick(h,new Error("NotFound"))}getMany(t,r,h){if(h=Z0(r,h),h=hl(h,hi),r=fl(r,this[X0].entry),this[gi]==="opening")return this.defer(()=>this.getMany(t,r,h)),h[hi];if(gp(this,h))return h[hi];if(!Array.isArray(t))return this.nextTick(h,new TypeError("The first argument 'keys' must be an array")),h[hi];if(t.length===0)return this.nextTick(h,null,[]),h[hi];let o=this.keyEncoding(r.keyEncoding),l=this.valueEncoding(r.valueEncoding),c=o.format,p=l.format;(r.keyEncoding!==c||r.valueEncoding!==p)&&(r=Object.assign({},r,{keyEncoding:c,valueEncoding:p}));let w=new Array(t.length);for(let m=0;m<t.length;m++){let y=t[m],v=this._checkKey(y);if(v)return this.nextTick(h,v),h[hi];w[m]=this.prefixKey(o.encode(y),c)}return this._getMany(w,r,(m,y)=>{if(m)return h(m);try{for(let v=0;v<y.length;v++)y[v]!==void 0&&(y[v]=l.decode(y[v]))}catch(v){return h(new Gh(`Could not decode one or more of ${y.length} value(s)`,{code:"LEVEL_DECODE_ERROR",cause:v}))}h(null,y)}),h[hi]}_getMany(t,r,h){this.nextTick(h,null,new Array(t.length).fill(void 0))}put(t,r,h,o){if(o=Z0(h,o),o=hl(o,hi),h=fl(h,this[X0].entry),this[gi]==="opening")return this.defer(()=>this.put(t,r,h,o)),o[hi];if(gp(this,o))return o[hi];let l=this._checkKey(t)||this._checkValue(r);if(l)return this.nextTick(o,l),o[hi];let c=this.keyEncoding(h.keyEncoding),p=this.valueEncoding(h.valueEncoding),w=c.format,m=p.format;(h.keyEncoding!==w||h.valueEncoding!==m)&&(h=Object.assign({},h,{keyEncoding:w,valueEncoding:m}));let y=this.prefixKey(c.encode(t),w),v=p.encode(r);return this._put(y,v,h,M=>{if(M)return o(M);this.emit("put",t,r),o()}),o[hi]}_put(t,r,h,o){this.nextTick(o)}del(t,r,h){if(h=Z0(r,h),h=hl(h,hi),r=fl(r,this[X0].key),this[gi]==="opening")return this.defer(()=>this.del(t,r,h)),h[hi];if(gp(this,h))return h[hi];let o=this._checkKey(t);if(o)return this.nextTick(h,o),h[hi];let l=this.keyEncoding(r.keyEncoding),c=l.format;return r.keyEncoding!==c&&(r=Object.assign({},r,{keyEncoding:c})),this._del(this.prefixKey(l.encode(t),c),r,p=>{if(p)return h(p);this.emit("del",t),h()}),h[hi]}_del(t,r,h){this.nextTick(h)}batch(t,r,h){if(!arguments.length){if(this[gi]==="opening")return new Trt(this);if(this[gi]!=="open")throw new Gh("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._chainedBatch()}if(typeof t=="function"?h=t:h=Z0(r,h),h=hl(h,hi),r=fl(r,this[X0].empty),this[gi]==="opening")return this.defer(()=>this.batch(t,r,h)),h[hi];if(gp(this,h))return h[hi];if(!Array.isArray(t))return this.nextTick(h,new TypeError("The first argument 'operations' must be an array")),h[hi];if(t.length===0)return this.nextTick(h),h[hi];let o=new Array(t.length),{keyEncoding:l,valueEncoding:c,...p}=r;for(let w=0;w<t.length;w++){if(typeof t[w]!="object"||t[w]===null)return this.nextTick(h,new TypeError("A batch operation must be an object")),h[hi];let m=Object.assign({},t[w]);if(m.type!=="put"&&m.type!=="del")return this.nextTick(h,new TypeError("A batch operation must have a type property that is 'put' or 'del'")),h[hi];let y=this._checkKey(m.key);if(y)return this.nextTick(h,y),h[hi];let v=m.sublevel!=null?m.sublevel:this,M=v.keyEncoding(m.keyEncoding||l),T=M.format;if(m.key=v.prefixKey(M.encode(m.key),T),m.keyEncoding=T,m.type==="put"){let A=this._checkValue(m.value);if(A)return this.nextTick(h,A),h[hi];let R=v.valueEncoding(m.valueEncoding||c);m.value=R.encode(m.value),m.valueEncoding=R.format}v!==this&&(m.sublevel=null),o[w]=m}return this._batch(o,p,w=>{if(w)return h(w);this.emit("batch",t),h()}),h[hi]}_batch(t,r,h){this.nextTick(h)}sublevel(t,r){return this._sublevel(t,Xk.defaults(r))}_sublevel(t,r){return new Xk(this,t,r)}prefixKey(t,r){return t}clear(t,r){if(r=Z0(t,r),r=hl(r,hi),t=fl(t,this[X0].empty),this[gi]==="opening")return this.defer(()=>this.clear(t,r)),r[hi];if(gp(this,r))return r[hi];let h=t,o=this.keyEncoding(t.keyEncoding);return t=X8(t,o),t.keyEncoding=o.format,t.limit===0?this.nextTick(r):this._clear(t,l=>{if(l)return r(l);this.emit("clear",h),r()}),r[hi]}_clear(t,r){this.nextTick(r)}iterator(t){let r=this.keyEncoding(t&&t.keyEncoding),h=this.valueEncoding(t&&t.valueEncoding);if(t=X8(t,r),t.keys=t.keys!==!1,t.values=t.values!==!1,t[V0.keyEncoding]=r,t[V0.valueEncoding]=h,t.keyEncoding=r.format,t.valueEncoding=h.format,this[gi]==="opening")return new NSt(this,t);if(this[gi]!=="open")throw new Gh("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._iterator(t)}_iterator(t){return new V0(this,t)}keys(t){let r=this.keyEncoding(t&&t.keyEncoding),h=this.valueEncoding(t&&t.valueEncoding);if(t=X8(t,r),t[V0.keyEncoding]=r,t[V0.valueEncoding]=h,t.keyEncoding=r.format,t.valueEncoding=h.format,this[gi]==="opening")return new LSt(this,t);if(this[gi]!=="open")throw new Gh("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._keys(t)}_keys(t){return new CSt(this,t)}values(t){let r=this.keyEncoding(t&&t.keyEncoding),h=this.valueEncoding(t&&t.valueEncoding);if(t=X8(t,r),t[V0.keyEncoding]=r,t[V0.valueEncoding]=h,t.keyEncoding=r.format,t.valueEncoding=h.format,this[gi]==="opening")return new DSt(this,t);if(this[gi]!=="open")throw new Gh("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._values(t)}_values(t){return new PSt(this,t)}defer(t){if(typeof t!="function")throw new TypeError("The first argument must be a function");this[Fm].push(t)}[jm](){if(this[Fm].length===0)return;let t=this[Fm];this[Fm]=[];for(let r of t)r()}attachResource(t){if(typeof t!="object"||t===null||typeof t.close!="function")throw new TypeError("The first argument must be a resource object");this[J0].add(t)}detachResource(t){this[J0].delete(t)}_chainedBatch(){return new Trt(this)}_checkKey(t){if(t==null)return new Gh("Key cannot be null or undefined",{code:"LEVEL_INVALID_KEY"})}_checkValue(t){if(t==null)return new Gh("Value cannot be null or undefined",{code:"LEVEL_INVALID_VALUE"})}};zm.prototype.nextTick=wrt();var{AbstractSublevel:Xk}=Art()({AbstractLevel:zm});Yk.AbstractLevel=zm;Yk.AbstractSublevel=Xk;var gp=function(i,t){return i[gi]!=="open"?(i.nextTick(t,new Gh("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"})),!0):!1},USt=function(i){return Object.keys(i.supports.encodings).filter(t=>!!i.supports.encodings[t])}});var t4=De(Y0=>{"use strict";Tt();Rt();xt();Y0.AbstractLevel=Qk().AbstractLevel;Y0.AbstractSublevel=Qk().AbstractSublevel;Y0.AbstractIterator=al().AbstractIterator;Y0.AbstractKeyIterator=al().AbstractKeyIterator;Y0.AbstractValueIterator=al().AbstractValueIterator;Y0.AbstractChainedBatch=Fk().AbstractChainedBatch});var krt=De((nJt,Rrt)=>{"use strict";Tt();Rt();xt();Rrt.exports=FSt;var qSt=zk();function FSt(i,t,r){if(typeof t!="number")throw new Error("second argument must be a Number");let h,o,l,c,p,w=!0,m;Array.isArray(i)?(h=[],l=o=i.length):(c=Object.keys(i),h={},l=o=c.length);function y(M){function T(){r&&r(M,h),r=null}w?qSt(T):T()}function v(M,T,A){if(h[M]=A,T&&(p=!0),--l===0||T)y(T);else if(!p&&m<o){let R;c?(R=c[m],m+=1,i[R](function(B,C){v(R,B,C)})):(R=m,m+=1,i[R](function(B,C){v(R,B,C)}))}}m=t,l?c?c.some(function(M,T){return i[M](function(A,R){v(M,A,R)}),T===t-1}):i.some(function(M,T){return M(function(A,R){v(T,A,R)}),T===t-1}):y(null),w=!1}});var tI=De((hJt,Irt)=>{"use strict";Tt();Rt();xt();Irt.exports=function(t){let r=t.gte!==void 0?t.gte:t.gt!==void 0?t.gt:void 0,h=t.lte!==void 0?t.lte:t.lt!==void 0?t.lt:void 0,o=t.gte===void 0,l=t.lte===void 0;return r!==void 0&&h!==void 0?IDBKeyRange.bound(r,h,o,l):r!==void 0?IDBKeyRange.lowerBound(r,o):h!==void 0?IDBKeyRange.upperBound(h,l):null}});var eI=De((lJt,Brt)=>{"use strict";Tt();Rt();xt();var jSt=new TextEncoder;Brt.exports=function(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):jSt.encode(i)}});var Lrt=De(Nrt=>{"use strict";Tt();Rt();xt();var{AbstractIterator:zSt}=t4(),Ort=tI(),e4=eI(),Df=Symbol("cache"),zu=Symbol("finished"),Va=Symbol("options"),Wu=Symbol("currentOptions"),Q0=Symbol("position"),rI=Symbol("location"),mp=Symbol("first"),Crt={},iI=class extends zSt{constructor(t,r,h){super(t,h),this[Df]=[],this[zu]=this.limit===0,this[Va]=h,this[Wu]={...h},this[Q0]=void 0,this[rI]=r,this[mp]=!0}_nextv(t,r,h){if(this[mp]=!1,this[zu])return this.nextTick(h,null,[]);if(this[Df].length>0)return t=Math.min(t,this[Df].length),this.nextTick(h,null,this[Df].splice(0,t));this[Q0]!==void 0&&(this[Va].reverse?(this[Wu].lt=this[Q0],this[Wu].lte=void 0):(this[Wu].gt=this[Q0],this[Wu].gte=void 0));let o;try{o=Ort(this[Wu])}catch{return this[zu]=!0,this.nextTick(h,null,[])}let l=this.db.db.transaction([this[rI]],"readonly"),c=l.objectStore(this[rI]),p=[];if(this[Va].reverse){let w=!this[Va].values&&c.openKeyCursor?"openKeyCursor":"openCursor";c[w](o,"prev").onsuccess=m=>{let y=m.target.result;if(y){let{key:v,value:M}=y;this[Q0]=v,p.push([this[Va].keys&&v!==void 0?e4(v):void 0,this[Va].values&&M!==void 0?e4(M):void 0]),p.length<t?y.continue():Prt(l)}else this[zu]=!0}}else{let w,m,y=()=>{if(w===void 0||m===void 0)return;let v=Math.max(w.length,m.length);v===0||t===1/0?this[zu]=!0:this[Q0]=w[v-1],p.length=v;for(let M=0;M<v;M++){let T=w[M],A=m[M];p[M]=[this[Va].keys&&T!==void 0?e4(T):void 0,this[Va].values&&A!==void 0?e4(A):void 0]}Prt(l)};this[Va].keys||t<1/0?c.getAllKeys(o,t<1/0?t:void 0).onsuccess=v=>{w=v.target.result,y()}:(w=[],this.nextTick(y)),this[Va].values?c.getAll(o,t<1/0?t:void 0).onsuccess=v=>{m=v.target.result,y()}:(m=[],this.nextTick(y))}l.onabort=()=>{h(l.error||new Error("aborted by user")),h=null},l.oncomplete=()=>{h(null,p),h=null}}_next(t){if(this[Df].length>0){let[r,h]=this[Df].shift();this.nextTick(t,null,r,h)}else if(this[zu])this.nextTick(t);else{let r=Math.min(100,this.limit-this.count);this[mp]&&(this[mp]=!1,r=1),this._nextv(r,Crt,(h,o)=>{if(h)return t(h);this[Df]=o,this._next(t)})}}_all(t,r){this[mp]=!1;let h=this[Df].splice(0,this[Df].length),o=this.limit-this.count-h.length;if(o<=0)return this.nextTick(r,null,h);this._nextv(o,Crt,(l,c)=>{if(l)return r(l);h.length>0&&(c=h.concat(c)),r(null,c)})}_seek(t,r){this[mp]=!0,this[Df]=[],this[zu]=!1,this[Q0]=void 0,this[Wu]={...this[Va]};let h;try{h=Ort(this[Va])}catch{this[zu]=!0;return}h!==null&&!h.includes(t)?this[zu]=!0:this[Va].reverse?this[Wu].lte=t:this[Wu].gte=t}};Nrt.Iterator=iI;function Prt(i){typeof i.commit=="function"&&i.commit()}});var $rt=De((wJt,Drt)=>{"use strict";Tt();Rt();xt();Drt.exports=function(t,r,h,o,l){if(o.limit===0)return t.nextTick(l);let c=t.db.transaction([r],"readwrite"),p=c.objectStore(r),w=0;c.oncomplete=function(){l()},c.onabort=function(){l(c.error||new Error("aborted by user"))};let m=p.openKeyCursor?"openKeyCursor":"openCursor",y=o.reverse?"prev":"next";p[m](h,y).onsuccess=function(v){let M=v.target.result;M&&(p.delete(M.key).onsuccess=function(){(o.limit<=0||++w<o.limit)&&M.continue()})}}});var Wrt=De(zrt=>{"use strict";Tt();Rt();xt();var{AbstractLevel:WSt}=t4(),Urt=th(),KSt=krt(),{fromCallback:HSt}=Im(),{Iterator:GSt}=Lrt(),qrt=eI(),VSt=$rt(),ZSt=tI(),jrt="level-js-",Wm=Symbol("idb"),nI=Symbol("namePrefix"),Ku=Symbol("location"),oI=Symbol("version"),td=Symbol("store"),Km=Symbol("onComplete"),Frt=Symbol("promise"),r4=class extends WSt{constructor(t,r,h){if(typeof r=="function"||typeof h=="function")throw new Urt("The levelup-style callback argument has been removed",{code:"LEVEL_LEGACY"});let{prefix:o,version:l,...c}=r||{};if(super({encodings:{view:!0},snapshots:!1,createIfMissing:!1,errorIfExists:!1,seek:!0},c),typeof t!="string")throw new Error("constructor requires a location string argument");this[Ku]=t,this[nI]=o??jrt,this[oI]=parseInt(l||1,10),this[Wm]=null}get location(){return this[Ku]}get namePrefix(){return this[nI]}get version(){return this[oI]}get db(){return this[Wm]}get type(){return"browser-level"}_open(t,r){let h=indexedDB.open(this[nI]+this[Ku],this[oI]);h.onerror=function(){r(h.error||new Error("unknown error"))},h.onsuccess=()=>{this[Wm]=h.result,r()},h.onupgradeneeded=o=>{let l=o.target.result;l.objectStoreNames.contains(this[Ku])||l.createObjectStore(this[Ku])}}[td](t){return this[Wm].transaction([this[Ku]],t).objectStore(this[Ku])}[Km](t,r){let h=t.transaction;h.onabort=function(){r(h.error||new Error("aborted by user"))},h.oncomplete=function(){r(null,t.result)}}_get(t,r,h){let o=this[td]("readonly"),l;try{l=o.get(t)}catch(c){return this.nextTick(h,c)}this[Km](l,function(c,p){if(c)return h(c);if(p===void 0)return h(new Urt("Entry not found",{code:"LEVEL_NOT_FOUND"}));h(null,qrt(p))})}_getMany(t,r,h){let o=this[td]("readonly"),l=t.map(c=>p=>{let w;try{w=o.get(c)}catch(m){return p(m)}w.onsuccess=()=>{let m=w.result;p(null,m===void 0?m:qrt(m))},w.onerror=m=>{m.stopPropagation(),p(w.error)}});KSt(l,16,h)}_del(t,r,h){let o=this[td]("readwrite"),l;try{l=o.delete(t)}catch(c){return this.nextTick(h,c)}this[Km](l,h)}_put(t,r,h,o){let l=this[td]("readwrite"),c;try{c=l.put(r,t)}catch(p){return this.nextTick(o,p)}this[Km](c,o)}_iterator(t){return new GSt(this,this[Ku],t)}_batch(t,r,h){let o=this[td]("readwrite"),l=o.transaction,c=0,p;l.onabort=function(){h(p||l.error||new Error("aborted by user"))},l.oncomplete=function(){h()};function w(){let m=t[c++],y=m.key,v;try{v=m.type==="del"?o.delete(y):o.put(m.value,y)}catch(M){p=M,l.abort();return}c<t.length?v.onsuccess=w:typeof l.commit=="function"&&l.commit()}w()}_clear(t,r){let h,o;try{h=ZSt(t)}catch{return this.nextTick(r)}if(t.limit>=0)return VSt(this,this[Ku],h,t,r);try{let l=this[td]("readwrite");o=h?l.delete(h):l.clear()}catch(l){return this.nextTick(r,l)}this[Km](o,r)}_close(t){this[Wm].close(),this.nextTick(t)}};r4.destroy=function(i,t,r){typeof t=="function"&&(r=t,t=jrt),r=HSt(r,Frt);let h=indexedDB.deleteDatabase(t+i);return h.onsuccess=function(){r()},h.onerror=function(o){r(o)},r[Frt]};zrt.BrowserLevel=r4});var Hrt=De(Krt=>{"use strict";Tt();Rt();xt();Krt.Level=Wrt().BrowserLevel});var Zrt=De((OJt,Vrt)=>{"use strict";Tt();Rt();xt();Vrt.exports=YSt;var cn=0,Ti=1;function Za(i,t,r,h,o,l){this._color=i,this.key=t,this.value=r,this.left=h,this.right=o,this._count=l}function $f(i){return new Za(i._color,i.key,i.value,i.left,i.right,i._count)}function ul(i,t){return new Za(i,t.key,t.value,t.left,t.right,t._count)}function wn(i){i._count=1+(i.left?i.left._count:0)+(i.right?i.right._count:0)}function cl(i,t){this._compare=i,this.root=t}var aa=cl.prototype;Object.defineProperty(aa,"keys",{get:function(){var i=[];return this.forEach(function(t,r){i.push(t)}),i}});Object.defineProperty(aa,"values",{get:function(){var i=[];return this.forEach(function(t,r){i.push(r)}),i}});Object.defineProperty(aa,"length",{get:function(){return this.root?this.root._count:0}});aa.insert=function(i,t){for(var r=this._compare,h=this.root,o=[],l=[];h;){var c=r(i,h.key);o.push(h),l.push(c),c<=0?h=h.left:h=h.right}o.push(new Za(cn,i,t,null,null,1));for(var p=o.length-2;p>=0;--p){var h=o[p];l[p]<=0?o[p]=new Za(h._color,h.key,h.value,o[p+1],h.right,h._count+1):o[p]=new Za(h._color,h.key,h.value,h.left,o[p+1],h._count+1)}for(var p=o.length-1;p>1;--p){var w=o[p-1],h=o[p];if(w._color===Ti||h._color===Ti)break;var m=o[p-2];if(m.left===w)if(w.left===h){var y=m.right;if(y&&y._color===cn)w._color=Ti,m.right=ul(Ti,y),m._color=cn,p-=1;else{if(m._color=cn,m.left=w.right,w._color=Ti,w.right=m,o[p-2]=w,o[p-1]=h,wn(m),wn(w),p>=3){var v=o[p-3];v.left===m?v.left=w:v.right=w}break}}else{var y=m.right;if(y&&y._color===cn)w._color=Ti,m.right=ul(Ti,y),m._color=cn,p-=1;else{if(w.right=h.left,m._color=cn,m.left=h.right,h._color=Ti,h.left=w,h.right=m,o[p-2]=h,o[p-1]=w,wn(m),wn(w),wn(h),p>=3){var v=o[p-3];v.left===m?v.left=h:v.right=h}break}}else if(w.right===h){var y=m.left;if(y&&y._color===cn)w._color=Ti,m.left=ul(Ti,y),m._color=cn,p-=1;else{if(m._color=cn,m.right=w.left,w._color=Ti,w.left=m,o[p-2]=w,o[p-1]=h,wn(m),wn(w),p>=3){var v=o[p-3];v.right===m?v.right=w:v.left=w}break}}else{var y=m.left;if(y&&y._color===cn)w._color=Ti,m.left=ul(Ti,y),m._color=cn,p-=1;else{if(w.left=h.right,m._color=cn,m.right=h.left,h._color=Ti,h.right=w,h.left=m,o[p-2]=h,o[p-1]=w,wn(m),wn(w),wn(h),p>=3){var v=o[p-3];v.right===m?v.right=h:v.left=h}break}}}return o[0]._color=Ti,new cl(r,o[0])};function aI(i,t){if(t.left){var r=aI(i,t.left);if(r)return r}var r=i(t.key,t.value);if(r)return r;if(t.right)return aI(i,t.right)}function sI(i,t,r,h){var o=t(i,h.key);if(o<=0){if(h.left){var l=sI(i,t,r,h.left);if(l)return l}var l=r(h.key,h.value);if(l)return l}if(h.right)return sI(i,t,r,h.right)}function hI(i,t,r,h,o){var l=r(i,o.key),c=r(t,o.key),p;if(l<=0&&(o.left&&(p=hI(i,t,r,h,o.left),p)||c>0&&(p=h(o.key,o.value),p)))return p;if(c>0&&o.right)return hI(i,t,r,h,o.right)}aa.forEach=function(t,r,h){if(this.root)switch(arguments.length){case 1:return aI(t,this.root);case 2:return sI(r,this._compare,t,this.root);case 3:return this._compare(r,h)>=0?void 0:hI(r,h,this._compare,t,this.root)}};Object.defineProperty(aa,"begin",{get:function(){for(var i=[],t=this.root;t;)i.push(t),t=t.left;return new Ja(this,i)}});Object.defineProperty(aa,"end",{get:function(){for(var i=[],t=this.root;t;)i.push(t),t=t.right;return new Ja(this,i)}});aa.at=function(i){if(i<0)return new Ja(this,[]);for(var t=this.root,r=[];;){if(r.push(t),t.left){if(i<t.left._count){t=t.left;continue}i-=t.left._count}if(!i)return new Ja(this,r);if(i-=1,t.right){if(i>=t.right._count)break;t=t.right}else break}return new Ja(this,[])};aa.ge=function(i){for(var t=this._compare,r=this.root,h=[],o=0;r;){var l=t(i,r.key);h.push(r),l<=0&&(o=h.length),l<=0?r=r.left:r=r.right}return h.length=o,new Ja(this,h)};aa.gt=function(i){for(var t=this._compare,r=this.root,h=[],o=0;r;){var l=t(i,r.key);h.push(r),l<0&&(o=h.length),l<0?r=r.left:r=r.right}return h.length=o,new Ja(this,h)};aa.lt=function(i){for(var t=this._compare,r=this.root,h=[],o=0;r;){var l=t(i,r.key);h.push(r),l>0&&(o=h.length),l<=0?r=r.left:r=r.right}return h.length=o,new Ja(this,h)};aa.le=function(i){for(var t=this._compare,r=this.root,h=[],o=0;r;){var l=t(i,r.key);h.push(r),l>=0&&(o=h.length),l<0?r=r.left:r=r.right}return h.length=o,new Ja(this,h)};aa.find=function(i){for(var t=this._compare,r=this.root,h=[];r;){var o=t(i,r.key);if(h.push(r),o===0)return new Ja(this,h);o<=0?r=r.left:r=r.right}return new Ja(this,[])};aa.remove=function(i){var t=this.find(i);return t?t.remove():this};aa.get=function(i){for(var t=this._compare,r=this.root;r;){var h=t(i,r.key);if(h===0)return r.value;h<=0?r=r.left:r=r.right}};function Ja(i,t){this.tree=i,this._stack=t}var ih=Ja.prototype;Object.defineProperty(ih,"valid",{get:function(){return this._stack.length>0}});Object.defineProperty(ih,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0});ih.clone=function(){return new Ja(this.tree,this._stack.slice())};function Grt(i,t){i.key=t.key,i.value=t.value,i.left=t.left,i.right=t.right,i._color=t._color,i._count=t._count}function JSt(i){for(var t,r,h,o,l=i.length-1;l>=0;--l){if(t=i[l],l===0){t._color=Ti;return}if(r=i[l-1],r.left===t){if(h=r.right,h.right&&h.right._color===cn){if(h=r.right=$f(h),o=h.right=$f(h.right),r.right=h.left,h.left=r,h.right=o,h._color=r._color,t._color=Ti,r._color=Ti,o._color=Ti,wn(r),wn(h),l>1){var c=i[l-2];c.left===r?c.left=h:c.right=h}i[l-1]=h;return}else if(h.left&&h.left._color===cn){if(h=r.right=$f(h),o=h.left=$f(h.left),r.right=o.left,h.left=o.right,o.left=r,o.right=h,o._color=r._color,r._color=Ti,h._color=Ti,t._color=Ti,wn(r),wn(h),wn(o),l>1){var c=i[l-2];c.left===r?c.left=o:c.right=o}i[l-1]=o;return}if(h._color===Ti)if(r._color===cn){r._color=Ti,r.right=ul(cn,h);return}else{r.right=ul(cn,h);continue}else{if(h=$f(h),r.right=h.left,h.left=r,h._color=r._color,r._color=cn,wn(r),wn(h),l>1){var c=i[l-2];c.left===r?c.left=h:c.right=h}i[l-1]=h,i[l]=r,l+1<i.length?i[l+1]=t:i.push(t),l=l+2}}else{if(h=r.left,h.left&&h.left._color===cn){if(h=r.left=$f(h),o=h.left=$f(h.left),r.left=h.right,h.right=r,h.left=o,h._color=r._color,t._color=Ti,r._color=Ti,o._color=Ti,wn(r),wn(h),l>1){var c=i[l-2];c.right===r?c.right=h:c.left=h}i[l-1]=h;return}else if(h.right&&h.right._color===cn){if(h=r.left=$f(h),o=h.right=$f(h.right),r.left=o.right,h.right=o.left,o.right=r,o.left=h,o._color=r._color,r._color=Ti,h._color=Ti,t._color=Ti,wn(r),wn(h),wn(o),l>1){var c=i[l-2];c.right===r?c.right=o:c.left=o}i[l-1]=o;return}if(h._color===Ti)if(r._color===cn){r._color=Ti,r.left=ul(cn,h);return}else{r.left=ul(cn,h);continue}else{if(h=$f(h),r.left=h.right,h.right=r,h._color=r._color,r._color=cn,wn(r),wn(h),l>1){var c=i[l-2];c.right===r?c.right=h:c.left=h}i[l-1]=h,i[l]=r,l+1<i.length?i[l+1]=t:i.push(t),l=l+2}}}}ih.remove=function(){var i=this._stack;if(i.length===0)return this.tree;var t=new Array(i.length),r=i[i.length-1];t[t.length-1]=new Za(r._color,r.key,r.value,r.left,r.right,r._count);for(var h=i.length-2;h>=0;--h){var r=i[h];r.left===i[h+1]?t[h]=new Za(r._color,r.key,r.value,t[h+1],r.right,r._count):t[h]=new Za(r._color,r.key,r.value,r.left,t[h+1],r._count)}if(r=t[t.length-1],r.left&&r.right){var o=t.length;for(r=r.left;r.right;)t.push(r),r=r.right;var l=t[o-1];t.push(new Za(r._color,l.key,l.value,r.left,r.right,r._count)),t[o-1].key=r.key,t[o-1].value=r.value;for(var h=t.length-2;h>=o;--h)r=t[h],t[h]=new Za(r._color,r.key,r.value,r.left,t[h+1],r._count);t[o-1].left=t[o]}if(r=t[t.length-1],r._color===cn){var c=t[t.length-2];c.left===r?c.left=null:c.right===r&&(c.right=null),t.pop();for(var h=0;h<t.length;++h)t[h]._count--;return new cl(this.tree._compare,t[0])}else if(r.left||r.right){r.left?Grt(r,r.left):r.right&&Grt(r,r.right),r._color=Ti;for(var h=0;h<t.length-1;++h)t[h]._count--;return new cl(this.tree._compare,t[0])}else{if(t.length===1)return new cl(this.tree._compare,null);for(var h=0;h<t.length;++h)t[h]._count--;var p=t[t.length-2];JSt(t),p.left===r?p.left=null:p.right=null}return new cl(this.tree._compare,t[0])};Object.defineProperty(ih,"key",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].key},enumerable:!0});Object.defineProperty(ih,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0});Object.defineProperty(ih,"index",{get:function(){var i=0,t=this._stack;if(t.length===0){var r=this.tree.root;return r?r._count:0}else t[t.length-1].left&&(i=t[t.length-1].left._count);for(var h=t.length-2;h>=0;--h)t[h+1]===t[h].right&&(++i,t[h].left&&(i+=t[h].left._count));return i},enumerable:!0});ih.next=function(){var i=this._stack;if(i.length!==0){var t=i[i.length-1];if(t.right)for(t=t.right;t;)i.push(t),t=t.left;else for(i.pop();i.length>0&&i[i.length-1].right===t;)t=i[i.length-1],i.pop()}};Object.defineProperty(ih,"hasNext",{get:function(){var i=this._stack;if(i.length===0)return!1;if(i[i.length-1].right)return!0;for(var t=i.length-1;t>0;--t)if(i[t-1].left===i[t])return!0;return!1}});ih.update=function(i){var t=this._stack;if(t.length===0)throw new Error("Can't update empty node!");var r=new Array(t.length),h=t[t.length-1];r[r.length-1]=new Za(h._color,h.key,i,h.left,h.right,h._count);for(var o=t.length-2;o>=0;--o)h=t[o],h.left===t[o+1]?r[o]=new Za(h._color,h.key,h.value,r[o+1],h.right,h._count):r[o]=new Za(h._color,h.key,h.value,h.left,r[o+1],h._count);return new cl(this.tree._compare,r[0])};ih.prev=function(){var i=this._stack;if(i.length!==0){var t=i[i.length-1];if(t.left)for(t=t.left;t;)i.push(t),t=t.right;else for(i.pop();i.length>0&&i[i.length-1].left===t;)t=i[i.length-1],i.pop()}};Object.defineProperty(ih,"hasPrev",{get:function(){var i=this._stack;if(i.length===0)return!1;if(i[i.length-1].left)return!0;for(var t=i.length-1;t>0;--t)if(i[t-1].right===i[t])return!0;return!1}});function XSt(i,t){return i<t?-1:i>t?1:0}function YSt(i){return new cl(i||XSt,null)}});var tit=De(Qrt=>{"use strict";Tt();Rt();xt();var{AbstractLevel:QSt,AbstractIterator:tEt,AbstractKeyIterator:eEt,AbstractValueIterator:rEt}=t4(),Jrt=th(),Xrt=Zrt(),iEt=new Set(["gt","gte","lt","lte"]),Hu=Symbol("none"),Ro=Symbol("tree"),Ai=Symbol("iterator"),Xa=Symbol("lowerBound"),ll=Symbol("upperBound"),Yrt=Symbol("outOfRange"),i4=Symbol("reverse"),fI=Symbol("options"),Aa=Symbol("test"),nh=Symbol("advance"),h4=Symbol("init");function Uf(i,t){if(typeof i=="string")return i<t?-1:i>t?1:0;let r=Math.min(i.byteLength,t.byteLength);for(let h=0;h<r;h++){let o=i[h]-t[h];if(o!==0)return o}return i.byteLength-t.byteLength}function nEt(i){return Uf(i,this[ll])>0}function oEt(i){return Uf(i,this[ll])>=0}function aEt(i){return Uf(i,this[ll])<0}function sEt(i){return Uf(i,this[ll])<=0}var n4=class extends tEt{constructor(t,r){super(t,r),this[h4](t[Ro],r)}_next(t){if(!this[Ai].valid)return this.nextTick(t);let r=this[Ai].key,h=this[Ai].value;if(!this[Aa](r))return this.nextTick(t);this[Ai][this[nh]](),this.nextTick(t,null,r,h)}_nextv(t,r,h){let o=this[Ai],l=[];for(;o.valid&&l.length<t&&this[Aa](o.key);)l.push([o.key,o.value]),o[this[nh]]();this.nextTick(h,null,l)}_all(t,r){let h=this.limit-this.count,o=this[Ai],l=[];for(;o.valid&&l.length<h&&this[Aa](o.key);)l.push([o.key,o.value]),o[this[nh]]();this.nextTick(r,null,l)}},o4=class extends eEt{constructor(t,r){super(t,r),this[h4](t[Ro],r)}_next(t){if(!this[Ai].valid)return this.nextTick(t);let r=this[Ai].key;if(!this[Aa](r))return this.nextTick(t);this[Ai][this[nh]](),this.nextTick(t,null,r)}_nextv(t,r,h){let o=this[Ai],l=[];for(;o.valid&&l.length<t&&this[Aa](o.key);)l.push(o.key),o[this[nh]]();this.nextTick(h,null,l)}_all(t,r){let h=this.limit-this.count,o=this[Ai],l=[];for(;o.valid&&l.length<h&&this[Aa](o.key);)l.push(o.key),o[this[nh]]();this.nextTick(r,null,l)}},a4=class extends rEt{constructor(t,r){super(t,r),this[h4](t[Ro],r)}_next(t){if(!this[Ai].valid)return this.nextTick(t);let r=this[Ai].key,h=this[Ai].value;if(!this[Aa](r))return this.nextTick(t);this[Ai][this[nh]](),this.nextTick(t,null,h)}_nextv(t,r,h){let o=this[Ai],l=[];for(;o.valid&&l.length<t&&this[Aa](o.key);)l.push(o.value),o[this[nh]]();this.nextTick(h,null,l)}_all(t,r){let h=this.limit-this.count,o=this[Ai],l=[];for(;o.valid&&l.length<h&&this[Aa](o.key);)l.push(o.value),o[this[nh]]();this.nextTick(r,null,l)}};for(let i of[n4,o4,a4])i.prototype[h4]=function(t,r){this[i4]=r.reverse,this[fI]=r,this[i4]?(this[nh]="prev",this[Xa]="lte"in r?r.lte:"lt"in r?r.lt:Hu,this[ll]="gte"in r?r.gte:"gt"in r?r.gt:Hu,this[Xa]===Hu?this[Ai]=t.end:"lte"in r?this[Ai]=t.le(this[Xa]):this[Ai]=t.lt(this[Xa]),this[ll]!==Hu&&(this[Aa]="gte"in r?oEt:nEt)):(this[nh]="next",this[Xa]="gte"in r?r.gte:"gt"in r?r.gt:Hu,this[ll]="lte"in r?r.lte:"lt"in r?r.lt:Hu,this[Xa]===Hu?this[Ai]=t.begin:"gte"in r?this[Ai]=t.ge(this[Xa]):this[Ai]=t.gt(this[Xa]),this[ll]!==Hu&&(this[Aa]="lte"in r?sEt:aEt))},i.prototype[Aa]=function(){return!0},i.prototype[Yrt]=function(t){return this[Aa](t)?this[Xa]===Hu?!1:this[i4]?"lte"in this[fI]?Uf(t,this[Xa])>0:Uf(t,this[Xa])>=0:"gte"in this[fI]?Uf(t,this[Xa])<0:Uf(t,this[Xa])<=0:!0},i.prototype._seek=function(t,r){this[Yrt](t)?(this[Ai]=this[Ai].tree.end,this[Ai].next()):this[i4]?this[Ai]=this[Ai].tree.le(t):this[Ai]=this[Ai].tree.ge(t)};var s4=class extends QSt{constructor(t,r,h){if(typeof t=="object"&&t!==null&&(r=t),typeof t=="function"||typeof r=="function"||typeof h=="function")throw new Jrt("The levelup-style callback argument has been removed",{code:"LEVEL_LEGACY"});let{storeEncoding:o,...l}=r||{};if(o=o||"buffer",!["buffer","view","utf8"].includes(o))throw new Jrt("The storeEncoding option must be 'buffer', 'view' or 'utf8'",{code:"LEVEL_ENCODING_NOT_SUPPORTED"});super({seek:!0,permanence:!1,createIfMissing:!1,errorIfExists:!1,encodings:{[o]:!0}},l),this[Ro]=Xrt(Uf)}_put(t,r,h,o){let l=this[Ro].find(t);l.valid?this[Ro]=l.update(r):this[Ro]=this[Ro].insert(t,r),this.nextTick(o)}_get(t,r,h){let o=this[Ro].get(t);if(typeof o>"u")return this.nextTick(h,new Error("NotFound"));this.nextTick(h,null,o)}_getMany(t,r,h){this.nextTick(h,null,t.map(o=>this[Ro].get(o)))}_del(t,r,h){this[Ro]=this[Ro].remove(t),this.nextTick(h)}_batch(t,r,h){let o=this[Ro];for(let l of t){let c=l.key,p=o.find(c);l.type==="put"?o=p.valid?p.update(l.value):o.insert(c,l.value):o=p.remove()}this[Ro]=o,this.nextTick(h)}_clear(t,r){if(t.limit===-1&&!Object.keys(t).some(hEt))return this[Ro]=Xrt(Uf),this.nextTick(r);let h=this._keys({...t}),o=h.limit,l=0,c=()=>{for(let p=0;p<500;p++){if(++l>o||!h[Ai].valid||!h[Aa](h[Ai].key))return r();this[Ro]=this[Ro].remove(h[Ai].key),h[Ai][h[nh]]()}this.nextTick(c)};this.nextTick(c)}_iterator(t){return new n4(this,t)}_keys(t){return new o4(this,t)}_values(t){return new a4(this,t)}};Qrt.MemoryLevel=s4;if(typeof me<"u"&&!me.browser&&typeof global<"u"&&typeof global.setImmediate=="function"){let i=global.setImmediate;s4.prototype.nextTick=function(t,...r){r.length===0?i(t):i(()=>t(...r))}}function hEt(i){return iEt.has(i)}});var Hm=De(u4=>{"use strict";Tt();Rt();xt();Object.defineProperty(u4,"__esModule",{value:!0});u4.LevelDbCache=void 0;var uI=$u(),fEt=Hrt(),uEt=tit(),cEt=bn(),f4=class{constructor(t,r=!1){this.value=t,this.tomb=r}},cI=class{get db(){if(!this._db)if(this.cacheOptions.inMemory)this._db=new uEt.MemoryLevel(this.subLevelOptions);else{if(!this.cacheOptions.dbLocation)throw new Error("LevelDb cache configuration error - no db location specified");let t=this.cacheOptions.dbLocation;this.logger.info(`Using location ${t}`),this._db=new fEt.Level(t,this.subLevelOptions)}return this._db}constructor(t){this.cacheOptions=t,this.ongoingTransactionMark="$$warp-internal-transaction$$",this.logger=cEt.LoggerFactory.INST.create("LevelDbCache"),this.subLevelSeparator=t.subLevelSeparator||"!",this.subLevelOptions={valueEncoding:"json",separator:this.subLevelSeparator}}async get(t,r){this.validateKey(t.key);let h=this.db.sublevel(t.key,this.subLevelOptions);await h.open();let o=await this.getValueFromLevel(t.sortKey,h);return o?new uI.SortKeyCacheResult(t.sortKey,o):null}async getLast(t){let r=this.db.sublevel(t,this.subLevelOptions);await r.open();let h=await r.keys({reverse:!0,limit:1}).all();if(h.length){let o=await this.getValueFromLevel(h[0],r);if(o)return new uI.SortKeyCacheResult(h[0],o)}return null}async getLessOrEqual(t,r){let h=this.db.sublevel(t,this.subLevelOptions);await h.open();let o=await h.keys({reverse:!0,lte:r,limit:1}).all();if(o.length){let l=await this.getValueFromLevel(o[0],h);if(l!=null)return new uI.SortKeyCacheResult(o[0],l)}return null}async getValueFromLevel(t,r){try{let h=await r.get(t);if(h&&h.tomb===void 0&&h.value===void 0)return h;if(h&&h.tomb===!1&&h.value!=null)return h.value}catch(h){if(h.code!="LEVEL_NOT_FOUND")throw h}return null}async put(t,r){await this.setClientValue(t,new f4(r))}async del(t){await this.setClientValue(t,new f4(null,!0))}async setClientValue(t,r){this.validateKey(t.key);let h=this.db.sublevel(t.key,this.subLevelOptions);await h.open(),await h.put(t.sortKey,r),this._rollbackBatch&&this._rollbackBatch.del(t.sortKey,{sublevel:h})}async delete(t){let r=this.db.sublevel(t,this.subLevelOptions);await r.open(),await r.clear()}async batch(t){for(let r of t)r.type==="put"?await this.put(r.key,r.value):r.type==="del"&&await this.delete(r.key)}async open(){await this.db.open()}async close(){this._db&&await this._db.close()}async begin(){await this.initRollbackBatch()}async rollback(){this._rollbackBatch&&(this._rollbackBatch.del(this.ongoingTransactionMark),await this._rollbackBatch.write(),await this._rollbackBatch.close()),this._rollbackBatch=null}async initRollbackBatch(){return this._rollbackBatch==null&&(await this.checkPreviousTransactionFinished(),await this.db.put(this.ongoingTransactionMark,"ongoing"),this._rollbackBatch=this.db.batch()),this._rollbackBatch}async checkPreviousTransactionFinished(){let t;try{t=await this.db.get(this.ongoingTransactionMark)}catch(r){if(r.code!="LEVEL_NOT_FOUND")throw r}if(t=="ongoing")throw new Error("Database seems to be in inconsistent state. The previous transaction has not finished.")}async commit(){this._rollbackBatch&&(await this._rollbackBatch.clear(),await this.db.del(this.ongoingTransactionMark),await this._rollbackBatch.close()),this._rollbackBatch=null}async dump(){return await this.db.iterator().all()}async getLastSortKey(){let t="";await this.db.open();let r=await this.db.keys().all();for(let h of r){let o=h.split(this.subLevelSeparator)[1];o.localeCompare(t)>0&&(t=o)}return t==""?null:t}async keys(t,r){return Array.from((await this.kvMap(t,r)).keys())}validateKey(t){if(t.includes(this.ongoingTransactionMark))throw new Error(`Validation error: Key ${t} for internal use only`);if(t.includes(this.subLevelSeparator))throw new Error(`Validation error: key ${t} contains db separator ${this.subLevelSeparator}`)}extractOriginalKey(t){return t.split(this.subLevelSeparator)[1]}extractSortKey(t){return t.split(this.subLevelSeparator)[2]}async kvMap(t,r){let h=new Map,o=(await this.db.keys(this.levelRangeOptions(r)).all()).filter(l=>l!=this.ongoingTransactionMark).filter(l=>!t||this.extractSortKey(l).localeCompare(t)<=0).map(l=>this.extractOriginalKey(l));for(let l of o){let c=await this.getLessOrEqual(l,t);c&&h.set(l,c.cachedValue)}if(r?.limit){let l=new Map;for(let c of Array.from(h.entries()).slice(0,r.limit))l.set(c[0],c[1]);return l}return h}levelRangeOptions(t){let r={reverse:t?.reverse};return t?.gte&&(r.gte=this.subLevelSeparator+t.gte),t?.lt&&(r.lt=this.subLevelSeparator+t.lt),r}storage(){return this.db}async getNumEntries(){return(await this.db.keys().all()).length}async prune(t=5){(!t||t<=0)&&(t=1);let r=await this.allKeys();for(let h=0;h<r.length;h++){let o=this.db.sublevel(r[h],this.subLevelOptions);await o.open();let l=await o.keys({reverse:!0,limit:t}).all();!l||l.length<t||(await o.clear({lt:l[l.length-1]}),await o.close())}return null}async allKeys(){return(await this.db.keys().all()).filter(t=>t!=this.ongoingTransactionMark).map(t=>this.extractOriginalKey(t))}};u4.LevelDbCache=cI});var eit=De(c4=>{"use strict";Tt();Rt();xt();Object.defineProperty(c4,"__esModule",{value:!0});c4.MemCache=void 0;var lI=class{constructor(){this.storage={}}clearAll(){Object.keys(this.storage).forEach(t=>{delete this.storage[t]})}contains(t){return Object.prototype.hasOwnProperty.call(this.storage,t)}get(t){return this.storage[t]}put(t,r){this.storage[t]=r}remove(t){delete this.storage[t]}};c4.MemCache=lI});var iit=De(rit=>{"use strict";Tt();Rt();xt();Object.defineProperty(rit,"__esModule",{value:!0})});var oit=De(nit=>{"use strict";Tt();Rt();xt();Object.defineProperty(nit,"__esModule",{value:!0})});var sit=De(ait=>{"use strict";Tt();Rt();xt();Object.defineProperty(ait,"__esModule",{value:!0})});var fit=De(hit=>{"use strict";Tt();Rt();xt();Object.defineProperty(hit,"__esModule",{value:!0})});var Gu=De((uXt,dI)=>{"use strict";Tt();Rt();xt();typeof window<"u"?(window.global=window,global.fetch=window.fetch,dI.exports={Buffer:(af(),Dn(uc)).Buffer,Crypto:window.crypto}):dI.exports={Buffer:(af(),Dn(uc)).Buffer,Crypto:crypto}});var wit=De(vp=>{"use strict";Tt();Rt();xt();Object.defineProperty(vp,"__esModule",{value:!0});var lEt=Function.prototype.toString,pI=Object.create,dEt=Object.prototype.toString,pEt=function(){function i(){this._keys=[],this._values=[]}return i.prototype.has=function(t){return!!~this._keys.indexOf(t)},i.prototype.get=function(t){return this._values[this._keys.indexOf(t)]},i.prototype.set=function(t,r){this._keys.push(t),this._values.push(r)},i}();function gEt(){return new pEt}function mEt(){return new WeakMap}var vEt=typeof WeakMap<"u"?mEt:gEt;function mI(i){if(!i)return pI(null);var t=i.constructor;if(t===Object)return i===Object.prototype?{}:pI(i);if(t&&~lEt.call(t).indexOf("[native code]"))try{return new t}catch{}return pI(i)}function yEt(i){var t="";return i.global&&(t+="g"),i.ignoreCase&&(t+="i"),i.multiline&&(t+="m"),i.unicode&&(t+="u"),i.sticky&&(t+="y"),t}function bEt(i){return i.flags}var wEt=/test/g.flags==="g"?bEt:yEt;function uit(i){var t=dEt.call(i);return t.substring(8,t.length-1)}function _Et(i){return i[Symbol.toStringTag]||uit(i)}var MEt=typeof Symbol<"u"?_Et:uit,SEt=Object.defineProperty,EEt=Object.getOwnPropertyDescriptor,cit=Object.getOwnPropertyNames,vI=Object.getOwnPropertySymbols,lit=Object.prototype,dit=lit.hasOwnProperty,AEt=lit.propertyIsEnumerable,pit=typeof vI=="function";function TEt(i){return cit(i).concat(vI(i))}var xEt=pit?TEt:cit;function d4(i,t,r){for(var h=xEt(i),o=0,l=h.length,c=void 0,p=void 0;o<l;++o)if(c=h[o],!(c==="callee"||c==="caller")){if(p=EEt(i,c),!p){t[c]=r.copier(i[c],r);continue}!p.get&&!p.set&&(p.value=r.copier(p.value,r));try{SEt(t,c,p)}catch{t[c]=p.value}}return t}function REt(i,t){var r=new t.Constructor;t.cache.set(i,r);for(var h=0,o=i.length;h<o;++h)r[h]=t.copier(i[h],t);return r}function kEt(i,t){var r=new t.Constructor;return t.cache.set(i,r),d4(i,r,t)}function git(i,t){return i.slice(0)}function IEt(i,t){return i.slice(0,i.size,i.type)}function BEt(i,t){return new t.Constructor(git(i.buffer))}function OEt(i,t){return new t.Constructor(i.getTime())}function mit(i,t){var r=new t.Constructor;return t.cache.set(i,r),i.forEach(function(h,o){r.set(o,t.copier(h,t))}),r}function CEt(i,t){return d4(i,mit(i,t),t)}function PEt(i,t){var r=mI(t.prototype);t.cache.set(i,r);for(var h in i)dit.call(i,h)&&(r[h]=t.copier(i[h],t));return r}function NEt(i,t){var r=mI(t.prototype);t.cache.set(i,r);for(var h in i)dit.call(i,h)&&(r[h]=t.copier(i[h],t));for(var o=vI(i),l=0,c=o.length,p=void 0;l<c;++l)p=o[l],AEt.call(i,p)&&(r[p]=t.copier(i[p],t));return r}var LEt=pit?NEt:PEt;function DEt(i,t){var r=mI(t.prototype);return t.cache.set(i,r),d4(i,r,t)}function gI(i,t){return new t.Constructor(i.valueOf())}function $Et(i,t){var r=new t.Constructor(i.source,wEt(i));return r.lastIndex=i.lastIndex,r}function l4(i,t){return i}function vit(i,t){var r=new t.Constructor;return t.cache.set(i,r),i.forEach(function(h){r.add(t.copier(h,t))}),r}function UEt(i,t){return d4(i,vit(i,t),t)}var qEt=Array.isArray,yI=Object.assign,FEt=Object.getPrototypeOf||function(i){return i.__proto__},yit={array:REt,arrayBuffer:git,blob:IEt,dataView:BEt,date:OEt,error:l4,map:mit,object:LEt,regExp:$Et,set:vit},jEt=yI({},yit,{array:kEt,map:CEt,object:DEt,set:UEt});function zEt(i){return{Arguments:i.object,Array:i.array,ArrayBuffer:i.arrayBuffer,Blob:i.blob,Boolean:gI,DataView:i.dataView,Date:i.date,Error:i.error,Float32Array:i.arrayBuffer,Float64Array:i.arrayBuffer,Int8Array:i.arrayBuffer,Int16Array:i.arrayBuffer,Int32Array:i.arrayBuffer,Map:i.map,Number:gI,Object:i.object,Promise:l4,RegExp:i.regExp,Set:i.set,String:gI,WeakMap:l4,WeakSet:l4,Uint8Array:i.arrayBuffer,Uint8ClampedArray:i.arrayBuffer,Uint16Array:i.arrayBuffer,Uint32Array:i.arrayBuffer,Uint64Array:i.arrayBuffer}}function bI(i){var t=yI({},yit,i),r=zEt(t),h=r.Array,o=r.Object;function l(c,p){if(p.prototype=p.Constructor=void 0,!c||typeof c!="object")return c;if(p.cache.has(c))return p.cache.get(c);if(p.prototype=FEt(c),p.Constructor=p.prototype&&p.prototype.constructor,!p.Constructor||p.Constructor===Object)return o(c,p);if(qEt(c))return h(c,p);var w=r[MEt(c)];return w?w(c,p):typeof c.then=="function"?c:o(c,p)}return function(p){return l(p,{Constructor:void 0,cache:vEt(),copier:l,prototype:void 0})}}function bit(i){return bI(yI({},jEt,i))}var WEt=bit({}),KEt=bI({});vp.copyStrict=WEt;vp.createCopier=bI;vp.createStrictCopier=bit;vp.default=KEt});var b4=De(oh=>{"use strict";Tt();Rt();xt();Object.defineProperty(oh,"__esModule",{value:!0});oh.KV=oh.SWVrf=oh.SWBlock=oh.SWTransaction=oh.SmartWeaveGlobal=void 0;var p4=$u(),HEt=ko(),wI=class{constructor(t,r,h,o,l){this.gasUsed=0,this.gasLimit=Number.MAX_SAFE_INTEGER,this.unsafeClient=t,this.arweave={ar:t.ar,utils:t.utils,wallets:t.wallets,crypto:t.crypto},this.baseArweaveUrl=`${t.api.config.protocol}://${t.api.config.host}:${t.api.config.port}`,this.safeArweaveGet=async function(c){return(0,HEt.safeGet)(`${this.baseArweaveUrl}${c}`)},this.evaluationOptions=h,this.contract=r,this.transaction=new g4(this),this.block=new m4(this),this.contracts={readContractState:(c,p,w)=>{throw new Error("Not implemented - should be set by HandlerApi implementor")},viewContractState:(c,p)=>{throw new Error("Not implemented - should be set by HandlerApi implementor")},write:(c,p,w)=>{throw new Error("Not implemented - should be set by HandlerApi implementor")},refreshState:()=>{throw new Error("Not implemented - should be set by HandlerApi implementor")}},this.vrf=new v4(this),this.useGas=this.useGas.bind(this),this.getBalance=this.getBalance.bind(this),this.extensions={},this.kv=new y4(l,o,this.transaction,this.contract.id)}useGas(t){if(t<0)throw new Error("[RE:GNE] Gas number exception - gas < 0.");if(this.gasUsed+=t,this.gasUsed>this.gasLimit)throw new Error(`[RE:OOG] Out of gas! Used: ${this.gasUsed}, limit: ${this.gasLimit}`)}async getBalance(t,r){if(!this._activeTx)throw new Error("Cannot read balance - active tx is not set.");if(!this.block.height)throw new Error("Cannot read balance - block height not set.");let h=r||this.block.height;return await fetch(`${this.evaluationOptions.walletBalanceUrl}block/height/${h}/wallet/${t}/balance`).then(o=>o.ok?o.text():Promise.reject(o)).catch(o=>{var l;throw new Error(`Unable to read wallet balance. ${o.status}. ${(l=o.body)===null||l===void 0?void 0:l.message}`)})}};oh.SmartWeaveGlobal=wI;var g4=class{constructor(t){this.smartWeaveGlobal=t}get id(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.id}get owner(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.owner.address}get target(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.recipient}get tags(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.tags}get sortKey(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.sortKey}get dryRun(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.dry===!0}get quantity(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.quantity.winston}get reward(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.fee.winston}get origin(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.source==="redstone-sequencer"?"L2":"L1"}};oh.SWTransaction=g4;var m4=class{constructor(t){this.smartWeaveGlobal=t}get height(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.block.height}get indep_hash(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current Tx");return this.smartWeaveGlobal._activeTx.block.id}get timestamp(){if(!this.smartWeaveGlobal._activeTx)throw new Error("No current tx");return this.smartWeaveGlobal._activeTx.block.timestamp}};oh.SWBlock=m4;var v4=class{constructor(t){this.smartWeaveGlobal=t}get data(){return this.smartWeaveGlobal._activeTx.vrf}get value(){return this.smartWeaveGlobal._activeTx.vrf.bigint}randomInt(t){if(!Number.isInteger(t))throw new Error("Integer max value required for random integer generation");let r=BigInt(this.smartWeaveGlobal._activeTx.vrf.bigint)%BigInt(t)+BigInt(1);if(r>Number.MAX_SAFE_INTEGER||r<Number.MIN_SAFE_INTEGER)throw new Error("Random int cannot be cast to number");return Number(r)}};oh.SWVrf=v4;var y4=class{constructor(t,r,h,o){this._storage=t,this._interactionState=r,this._transaction=h,this._contractTxId=o}async put(t,r){this.checkStorageAvailable(),await this._storage.put(new p4.CacheKey(t,this._transaction.sortKey),r)}async get(t){var r;this.checkStorageAvailable();let h=this._transaction.sortKey,o=await this._interactionState.getKV(this._contractTxId,new p4.CacheKey(t,this._transaction.sortKey));if(o!=null)return o;let l=await this._storage.getLessOrEqual(t,this._transaction.sortKey);return(r=l?.cachedValue)!==null&&r!==void 0?r:null}async del(t){this.checkStorageAvailable();let r=this._transaction.sortKey,h=await this._interactionState.delKV(this._contractTxId,new p4.CacheKey(t,this._transaction.sortKey));if(h!=null)return h;await this._storage.del(new p4.CacheKey(t,this._transaction.sortKey))}async keys(t){let r=this._transaction.sortKey;return await this._storage.keys(r,t)}async kvMap(t){let r=this._transaction.sortKey;return this._storage.kvMap(r,t)}async begin(){if(this._storage)return this._storage.begin()}async commit(){this._storage&&(this._transaction.dryRun?await this._storage.rollback():await this._storage.commit())}async rollback(){this._storage&&await this._storage.rollback()}open(){if(this._storage)return this._storage.open()}close(){if(this._storage)return this._storage.close()}checkStorageAvailable(){if(!this._storage)throw new Error("KV Storage not available")}};oh.KV=y4});var _I=De(w4=>{"use strict";Tt();Rt();xt();Object.defineProperty(w4,"__esModule",{value:!0});w4.rustWasmImports=void 0;var GEt=bn(),VEt=(i,t,r,h,o)=>{let l=GEt.LoggerFactory.INST.create("WASM:Rust"),c={metering:{usegas:i.useGas},console:{log:function(lt){l.debug(`${i.contract.id}: ${lt}`)}},Block:{height:function(){return i.block.height},indep_hash:function(){return i.block.indep_hash},timestamp:function(){return i.block.timestamp}},Transaction:{id:function(){return i.transaction.id},owner:function(){return i.transaction.owner},target:function(){return i.transaction.target}},Contract:{id:function(){return i.contract.id},owner:function(){return i.contract.owner}},KV:{get:async function(lt){return await i.kv.get(lt)},put:async function(lt,mt){await i.kv.put(lt,mt)}},SmartWeave:{caller:function(){return i.caller},readContractState:async function(lt){return await i.contracts.readContractState(lt)},viewContractState:async function(lt,mt){return await i.contracts.viewContractState(lt,mt)},write:async function(lt,mt){return await i.contracts.write(lt,mt,!1)}},Vrf:{value:function(){return i.vrf.value},randomInt:function(lt){return i.vrf.randomInt(lt)}}},p=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});p.decode();let w=null;function m(){return(w===null||w.byteLength===0)&&(w=new Uint8Array(r.exports.memory.buffer)),w}function y(lt,mt){return p.decode(m().subarray(lt,lt+mt))}let v=new Array(128).fill(void 0);v.push(void 0,null,!0,!1);let M=v.length;function T(lt){M===v.length&&v.push(v.length+1);let mt=M;if(M=v[mt],typeof M!="number")throw new Error("corrupt heap");return v[mt]=lt,mt}function A(lt){return v[lt]}function R(lt){if(typeof lt!="boolean")throw new Error("expected a boolean argument")}function B(lt){return lt==null}function C(lt){if(typeof lt!="number")throw new Error("expected a number argument")}let P=null;function N(){return(P===null||P.byteLength===0)&&(P=new Float64Array(r.exports.memory.buffer)),P}let q=null;function W(){return(q===null||q.byteLength===0)&&(q=new Int32Array(r.exports.memory.buffer)),q}let J=0,F=new TextEncoder("utf-8"),H=typeof F.encodeInto=="function"?function(lt,mt){return F.encodeInto(lt,mt)}:function(lt,mt){let wt=F.encode(lt);return mt.set(wt),{read:lt.length,written:wt.length}};function Y(lt,mt,wt){if(typeof lt!="string")throw new Error("expected a string argument");if(wt===void 0){let O=F.encode(lt),L=mt(O.length);return m().subarray(L,L+O.length).set(O),J=O.length,L}let Mt=lt.length,ne=mt(Mt),nt=m(),I=0;for(;I<Mt;I++){let O=lt.charCodeAt(I);if(O>127)break;nt[ne+I]=O}if(I!==Mt){I!==0&&(lt=lt.slice(I)),ne=wt(ne,Mt,Mt=I+lt.length*3);let O=m().subarray(ne+I,ne+Mt),L=H(lt,O);if(L.read!==lt.length)throw new Error("failed to pass whole string");I+=L.written}return J=I,ne}function E(lt){lt<132||(v[lt]=M,M=lt)}function n(lt){let mt=A(lt);return E(lt),mt}function s(lt){let mt=typeof lt;if(mt=="number"||mt=="boolean"||lt==null)return`${lt}`;if(mt=="string")return`"${lt}"`;if(mt=="symbol"){let ne=lt.description;return ne==null?"Symbol":`Symbol(${ne})`}if(mt=="function"){let ne=lt.name;return typeof ne=="string"&&ne.length>0?`Function(${ne})`:"Function"}if(Array.isArray(lt)){let ne=lt.length,nt="[";ne>0&&(nt+=s(lt[0]));for(let I=1;I<ne;I++)nt+=", "+s(lt[I]);return nt+="]",nt}let wt=/\[object ([^\]]+)\]/.exec(toString.call(lt)),Mt;if(wt.length>1)Mt=wt[1];else return toString.call(lt);if(Mt=="Object")try{return"Object("+JSON.stringify(lt)+")"}catch{return"Object"}return lt instanceof Error?`${lt.name}: ${lt.message}
|
|
109
109
|
${lt.stack}`:Mt}function f(lt){if(typeof lt!="bigint")throw new Error("expected a bigint argument")}let d=null;function g(){return(d===null||d.byteLength===0)&&(d=new BigInt64Array(r.exports.memory.buffer)),d}function S(lt,mt,wt,Mt){let ne={a:lt,b:mt,cnt:1,dtor:wt},nt=(...I)=>{ne.cnt++;let O=ne.a;ne.a=0;try{return Mt(O,ne.b,...I)}finally{--ne.cnt===0?r.exports.__wbindgen_export_2.get(ne.dtor)(O,ne.b):ne.a=O}};return nt.original=ne,nt}function x(lt,mt){try{return lt.apply(this,mt)}catch(wt){let Mt=function(){try{return wt instanceof Error?`${wt.message}
|
|
110
110
|
|
|
111
111
|
Stack:
|
|
@@ -218,7 +218,7 @@ ${C}`),A.pop(),`{${W}}`}case"number":return isFinite(T)?String(T):t?t(T):"null";
|
|
|
218
218
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let h=new this(t);return r.forEach(o=>h.set(o)),h}static accessor(t){let h=(this[QL]=this[QL]={accessors:{}}).accessors,o=this.prototype;function l(c){let p=s2(c);h[p]||(Oht(o,c),h[p]=!0)}return Ke.isArray(t)?t.forEach(l):l(t),this}};Ld.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ke.reduceDescriptors(Ld.prototype,({value:i},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>i,set(h){this[r]=h}}});Ke.freezeMethods(Ld);var Zn=Ld;function h2(i,t){let r=this||Nd,h=t||r,o=Zn.from(h.headers),l=h.data;return Ke.forEach(i,function(p){l=p.call(r,l,o.normalize(),t?t.status:void 0)}),o.normalize(),l}Tt();Rt();xt();function f2(i){return!!(i&&i.__CANCEL__)}Tt();Rt();xt();function tD(i,t,r){Nr.call(this,i??"canceled",Nr.ERR_CANCELED,t,r),this.name="CanceledError"}Ke.inherits(tD,Nr,{__CANCEL__:!0});var sf=tD;Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();function u2(i,t,r){let h=r.config.validateStatus;!r.status||!h||h(r.status)?i(r):t(new Nr("Request failed with status code "+r.status,[Nr.ERR_BAD_REQUEST,Nr.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}Tt();Rt();xt();function o7(i){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return t&&t[1]||""}Tt();Rt();xt();Tt();Rt();xt();function Cht(i,t){i=i||10;let r=new Array(i),h=new Array(i),o=0,l=0,c;return t=t!==void 0?t:1e3,function(w){let m=Date.now(),y=h[l];c||(c=m),r[o]=w,h[o]=m;let v=l,M=0;for(;v!==o;)M+=r[v++],v=v%i;if(o=(o+1)%i,o===l&&(l=(l+1)%i),m-c<t)return;let T=y&&m-y;return T?Math.round(M*1e3/T):void 0}}var eD=Cht;Tt();Rt();xt();function Pht(i,t){let r=0,h=1e3/t,o=null;return function(){let c=this===!0,p=Date.now();if(c||p-r>h)return o&&(clearTimeout(o),o=null),r=p,i.apply(null,arguments);o||(o=setTimeout(()=>(o=null,r=Date.now(),i.apply(null,arguments)),h-(p-r)))}}var rD=Pht;var Dd=(i,t,r=3)=>{let h=0,o=eD(50,250);return rD(l=>{let c=l.loaded,p=l.lengthComputable?l.total:void 0,w=c-h,m=o(w),y=c<=p;h=c;let v={loaded:c,total:p,progress:p?c/p:void 0,bytes:w,rate:m||void 0,estimated:m&&p&&y?(p-c)/m:void 0,event:l,lengthComputable:p!=null};v[t?"download":"upload"]=!0,i(v)},r)};Tt();Rt();xt();Tt();Rt();xt();var iD=fo.hasStandardBrowserEnv?function(){let t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),h;function o(l){let c=l;return t&&(r.setAttribute("href",c),c=r.href),r.setAttribute("href",c),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return h=o(window.location.href),function(c){let p=Ke.isString(c)?o(c):c;return p.protocol===h.protocol&&p.host===h.host}}():function(){return function(){return!0}}();Tt();Rt();xt();var nD=fo.hasStandardBrowserEnv?{write(i,t,r,h,o,l){let c=[i+"="+encodeURIComponent(t)];Ke.isNumber(r)&&c.push("expires="+new Date(r).toGMTString()),Ke.isString(h)&&c.push("path="+h),Ke.isString(o)&&c.push("domain="+o),l===!0&&c.push("secure"),document.cookie=c.join("; ")},read(i){let t=document.cookie.match(new RegExp("(^|;\\s*)("+i+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(i){this.write(i,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};Tt();Rt();xt();Tt();Rt();xt();function a7(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}Tt();Rt();xt();function s7(i,t){return t?i.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):i}function c2(i,t){return i&&!a7(t)?s7(i,t):t}Tt();Rt();xt();var oD=i=>i instanceof Zn?{...i}:i;function mh(i,t){t=t||{};let r={};function h(m,y,v){return Ke.isPlainObject(m)&&Ke.isPlainObject(y)?Ke.merge.call({caseless:v},m,y):Ke.isPlainObject(y)?Ke.merge({},y):Ke.isArray(y)?y.slice():y}function o(m,y,v){if(Ke.isUndefined(y)){if(!Ke.isUndefined(m))return h(void 0,m,v)}else return h(m,y,v)}function l(m,y){if(!Ke.isUndefined(y))return h(void 0,y)}function c(m,y){if(Ke.isUndefined(y)){if(!Ke.isUndefined(m))return h(void 0,m)}else return h(void 0,y)}function p(m,y,v){if(v in t)return h(m,y);if(v in i)return h(void 0,m)}let w={url:l,method:l,data:l,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:p,headers:(m,y)=>o(oD(m),oD(y),!0)};return Ke.forEach(Object.keys(Object.assign({},i,t)),function(y){let v=w[y]||o,M=v(i[y],t[y],y);Ke.isUndefined(M)&&v!==p||(r[y]=M)}),r}var Py=i=>{let t=mh({},i),{data:r,withXSRFToken:h,xsrfHeaderName:o,xsrfCookieName:l,headers:c,auth:p}=t;t.headers=c=Zn.from(c),t.url=a2(c2(t.baseURL,t.url),i.params,i.paramsSerializer),p&&c.set("Authorization","Basic "+btoa((p.username||"")+":"+(p.password?unescape(encodeURIComponent(p.password)):"")));let w;if(Ke.isFormData(r)){if(fo.hasStandardBrowserEnv||fo.hasStandardBrowserWebWorkerEnv)c.setContentType(void 0);else if((w=c.getContentType())!==!1){let[m,...y]=w?w.split(";").map(v=>v.trim()).filter(Boolean):[];c.setContentType([m||"multipart/form-data",...y].join("; "))}}if(fo.hasStandardBrowserEnv&&(h&&Ke.isFunction(h)&&(h=h(t)),h||h!==!1&&iD(t.url))){let m=o&&l&&nD.read(l);m&&c.set(o,m)}return t};var Nht=typeof XMLHttpRequest<"u",aD=Nht&&function(i){return new Promise(function(r,h){let o=Py(i),l=o.data,c=Zn.from(o.headers).normalize(),{responseType:p}=o,w;function m(){o.cancelToken&&o.cancelToken.unsubscribe(w),o.signal&&o.signal.removeEventListener("abort",w)}let y=new XMLHttpRequest;y.open(o.method.toUpperCase(),o.url,!0),y.timeout=o.timeout;function v(){if(!y)return;let T=Zn.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),R={data:!p||p==="text"||p==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:T,config:i,request:y};u2(function(C){r(C),m()},function(C){h(C),m()},R),y=null}"onloadend"in y?y.onloadend=v:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(v)},y.onabort=function(){y&&(h(new Nr("Request aborted",Nr.ECONNABORTED,o,y)),y=null)},y.onerror=function(){h(new Nr("Network Error",Nr.ERR_NETWORK,o,y)),y=null},y.ontimeout=function(){let A=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",R=o.transitional||By;o.timeoutErrorMessage&&(A=o.timeoutErrorMessage),h(new Nr(A,R.clarifyTimeoutError?Nr.ETIMEDOUT:Nr.ECONNABORTED,o,y)),y=null},l===void 0&&c.setContentType(null),"setRequestHeader"in y&&Ke.forEach(c.toJSON(),function(A,R){y.setRequestHeader(R,A)}),Ke.isUndefined(o.withCredentials)||(y.withCredentials=!!o.withCredentials),p&&p!=="json"&&(y.responseType=o.responseType),typeof o.onDownloadProgress=="function"&&y.addEventListener("progress",Dd(o.onDownloadProgress,!0)),typeof o.onUploadProgress=="function"&&y.upload&&y.upload.addEventListener("progress",Dd(o.onUploadProgress)),(o.cancelToken||o.signal)&&(w=T=>{y&&(h(!T||T.type?new sf(null,i,y):T),y.abort(),y=null)},o.cancelToken&&o.cancelToken.subscribe(w),o.signal&&(o.signal.aborted?w():o.signal.addEventListener("abort",w)));let M=o7(o.url);if(M&&fo.protocols.indexOf(M)===-1){h(new Nr("Unsupported protocol "+M+":",Nr.ERR_BAD_REQUEST,i));return}y.send(l||null)})};Tt();Rt();xt();Tt();Rt();xt();var Lht=(i,t)=>{let r=new AbortController,h,o=function(w){if(!h){h=!0,c();let m=w instanceof Error?w:this.reason;r.abort(m instanceof Nr?m:new sf(m instanceof Error?m.message:m))}},l=t&&setTimeout(()=>{o(new Nr(`timeout ${t} of ms exceeded`,Nr.ETIMEDOUT))},t),c=()=>{i&&(l&&clearTimeout(l),l=null,i.forEach(w=>{w&&(w.removeEventListener?w.removeEventListener("abort",o):w.unsubscribe(o))}),i=null)};i.forEach(w=>w&&w.addEventListener&&w.addEventListener("abort",o));let{signal:p}=r;return p.unsubscribe=c,[p,()=>{l&&clearTimeout(l),l=null}]},sD=Lht;Tt();Rt();xt();var Dht=function*(i,t){let r=i.byteLength;if(!t||r<t){yield i;return}let h=0,o;for(;h<r;)o=h+t,yield i.slice(h,o),h=o},$ht=async function*(i,t,r){for await(let h of i)yield*Dht(ArrayBuffer.isView(h)?h:await r(String(h)),t)},h7=(i,t,r,h,o)=>{let l=$ht(i,t,o),c=0;return new ReadableStream({type:"bytes",async pull(p){let{done:w,value:m}=await l.next();if(w){p.close(),h();return}let y=m.byteLength;r&&r(c+=y),p.enqueue(new Uint8Array(m))},cancel(p){return h(p),l.return()}},{highWaterMark:2})};var hD=(i,t)=>{let r=i!=null;return h=>setTimeout(()=>t({lengthComputable:r,total:i,loaded:h}))},Ly=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",uD=Ly&&typeof ReadableStream=="function",f7=Ly&&(typeof TextEncoder=="function"?(i=>t=>i.encode(t))(new TextEncoder):async i=>new Uint8Array(await new Response(i).arrayBuffer())),Uht=uD&&(()=>{let i=!1,t=new Request(fo.origin,{body:new ReadableStream,method:"POST",get duplex(){return i=!0,"half"}}).headers.has("Content-Type");return i&&!t})(),fD=64*1024,u7=uD&&!!(()=>{try{return Ke.isReadableStream(new Response("").body)}catch{}})(),Ny={stream:u7&&(i=>i.body)};Ly&&(i=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Ny[t]&&(Ny[t]=Ke.isFunction(i[t])?r=>r[t]():(r,h)=>{throw new Nr(`Response type '${t}' is not supported`,Nr.ERR_NOT_SUPPORT,h)})})})(new Response);var qht=async i=>{if(i==null)return 0;if(Ke.isBlob(i))return i.size;if(Ke.isSpecCompliantForm(i))return(await new Request(i).arrayBuffer()).byteLength;if(Ke.isArrayBufferView(i))return i.byteLength;if(Ke.isURLSearchParams(i)&&(i=i+""),Ke.isString(i))return(await f7(i)).byteLength},Fht=async(i,t)=>{let r=Ke.toFiniteNumber(i.getContentLength());return r??qht(t)},cD=Ly&&(async i=>{let{url:t,method:r,data:h,signal:o,cancelToken:l,timeout:c,onDownloadProgress:p,onUploadProgress:w,responseType:m,headers:y,withCredentials:v="same-origin",fetchOptions:M}=Py(i);m=m?(m+"").toLowerCase():"text";let[T,A]=o||l||c?sD([o,l],c):[],R,B,C=()=>{!R&&setTimeout(()=>{T&&T.unsubscribe()}),R=!0},P;try{if(w&&Uht&&r!=="get"&&r!=="head"&&(P=await Fht(y,h))!==0){let J=new Request(t,{method:"POST",body:h,duplex:"half"}),F;Ke.isFormData(h)&&(F=J.headers.get("content-type"))&&y.setContentType(F),J.body&&(h=h7(J.body,fD,hD(P,Dd(w)),null,f7))}Ke.isString(v)||(v=v?"cors":"omit"),B=new Request(t,{...M,signal:T,method:r.toUpperCase(),headers:y.normalize().toJSON(),body:h,duplex:"half",withCredentials:v});let N=await fetch(B),q=u7&&(m==="stream"||m==="response");if(u7&&(p||q)){let J={};["status","statusText","headers"].forEach(H=>{J[H]=N[H]});let F=Ke.toFiniteNumber(N.headers.get("content-length"));N=new Response(h7(N.body,fD,p&&hD(F,Dd(p,!0)),q&&C,f7),J)}m=m||"text";let W=await Ny[Ke.findKey(Ny,m)||"text"](N,i);return!q&&C(),A&&A(),await new Promise((J,F)=>{u2(J,F,{data:W,headers:Zn.from(N.headers),status:N.status,statusText:N.statusText,config:i,request:B})})}catch(N){throw C(),N&&N.name==="TypeError"&&/fetch/i.test(N.message)?Object.assign(new Nr("Network Error",Nr.ERR_NETWORK,i,B),{cause:N.cause||N}):Nr.from(N,N&&N.code,i,B)}});var c7={http:ky,xhr:aD,fetch:cD};Ke.forEach(c7,(i,t)=>{if(i){try{Object.defineProperty(i,"name",{value:t})}catch{}Object.defineProperty(i,"adapterName",{value:t})}});var lD=i=>`- ${i}`,jht=i=>Ke.isFunction(i)||i===null||i===!1,Dy={getAdapter:i=>{i=Ke.isArray(i)?i:[i];let{length:t}=i,r,h,o={};for(let l=0;l<t;l++){r=i[l];let c;if(h=r,!jht(r)&&(h=c7[(c=String(r)).toLowerCase()],h===void 0))throw new Nr(`Unknown adapter '${c}'`);if(h)break;o[c||"#"+l]=h}if(!h){let l=Object.entries(o).map(([p,w])=>`adapter ${p} `+(w===!1?"is not supported by the environment":"is not available in the build")),c=t?l.length>1?`since :
|
|
219
219
|
`+l.map(lD).join(`
|
|
220
220
|
`):" "+lD(l[0]):"as no adapter specified";throw new Nr("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return h},adapters:c7};function l7(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new sf(null,i)}function $y(i){return l7(i),i.headers=Zn.from(i.headers),i.data=h2.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),Dy.getAdapter(i.adapter||Nd.adapter)(i).then(function(h){return l7(i),h.data=h2.call(i,i.transformResponse,h),h.headers=Zn.from(h.headers),h},function(h){return f2(h)||(l7(i),h&&h.response&&(h.response.data=h2.call(i,i.transformResponse,h.response),h.response.headers=Zn.from(h.response.headers))),Promise.reject(h)})}Tt();Rt();xt();Tt();Rt();xt();var Uy="1.7.2";var d7={};["object","boolean","number","function","string","symbol"].forEach((i,t)=>{d7[i]=function(h){return typeof h===i||"a"+(t<1?"n ":" ")+i}});var dD={};d7.transitional=function(t,r,h){function o(l,c){return"[Axios v"+Uy+"] Transitional option '"+l+"'"+c+(h?". "+h:"")}return(l,c,p)=>{if(t===!1)throw new Nr(o(c," has been removed"+(r?" in "+r:"")),Nr.ERR_DEPRECATED);return r&&!dD[c]&&(dD[c]=!0,console.warn(o(c," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(l,c,p):!0}};function zht(i,t,r){if(typeof i!="object")throw new Nr("options must be an object",Nr.ERR_BAD_OPTION_VALUE);let h=Object.keys(i),o=h.length;for(;o-- >0;){let l=h[o],c=t[l];if(c){let p=i[l],w=p===void 0||c(p,l,i);if(w!==!0)throw new Nr("option "+l+" must be "+w,Nr.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Nr("Unknown option "+l,Nr.ERR_BAD_OPTION)}}var qy={assertOptions:zht,validators:d7};var dc=qy.validators,$d=class{constructor(t){this.defaults=t,this.interceptors={request:new Q5,response:new Q5}}async request(t,r){try{return await this._request(t,r)}catch(h){if(h instanceof Error){let o;Error.captureStackTrace?Error.captureStackTrace(o={}):o=new Error;let l=o.stack?o.stack.replace(/^.+\n/,""):"";try{h.stack?l&&!String(h.stack).endsWith(l.replace(/^.+\n.+\n/,""))&&(h.stack+=`
|
|
221
|
-
`+l):h.stack=l}catch{}}throw h}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=mh(this.defaults,r);let{transitional:h,paramsSerializer:o,headers:l}=r;h!==void 0&&qy.assertOptions(h,{silentJSONParsing:dc.transitional(dc.boolean),forcedJSONParsing:dc.transitional(dc.boolean),clarifyTimeoutError:dc.transitional(dc.boolean)},!1),o!=null&&(Ke.isFunction(o)?r.paramsSerializer={serialize:o}:qy.assertOptions(o,{encode:dc.function,serialize:dc.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let c=l&&Ke.merge(l.common,l[r.method]);l&&Ke.forEach(["delete","get","head","post","put","patch","common"],A=>{delete l[A]}),r.headers=Zn.concat(c,l);let p=[],w=!0;this.interceptors.request.forEach(function(R){typeof R.runWhen=="function"&&R.runWhen(r)===!1||(w=w&&R.synchronous,p.unshift(R.fulfilled,R.rejected))});let m=[];this.interceptors.response.forEach(function(R){m.push(R.fulfilled,R.rejected)});let y,v=0,M;if(!w){let A=[$y.bind(this),void 0];for(A.unshift.apply(A,p),A.push.apply(A,m),M=A.length,y=Promise.resolve(r);v<M;)y=y.then(A[v++],A[v++]);return y}M=p.length;let T=r;for(v=0;v<M;){let A=p[v++],R=p[v++];try{T=A(T)}catch(B){R.call(this,B);break}}try{y=$y.call(this,T)}catch(A){return Promise.reject(A)}for(v=0,M=m.length;v<M;)y=y.then(m[v++],m[v++]);return y}getUri(t){t=mh(this.defaults,t);let r=c2(t.baseURL,t.url);return a2(r,t.params,t.paramsSerializer)}};Ke.forEach(["delete","get","head","options"],function(t){$d.prototype[t]=function(r,h){return this.request(mh(h||{},{method:t,url:r,data:(h||{}).data}))}});Ke.forEach(["post","put","patch"],function(t){function r(h){return function(l,c,p){return this.request(mh(p||{},{method:t,headers:h?{"Content-Type":"multipart/form-data"}:{},url:l,data:c}))}}$d.prototype[t]=r(),$d.prototype[t+"Form"]=r(!0)});var l2=$d;Tt();Rt();xt();var p7=class i{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(l){r=l});let h=this;this.promise.then(o=>{if(!h._listeners)return;let l=h._listeners.length;for(;l-- >0;)h._listeners[l](o);h._listeners=null}),this.promise.then=o=>{let l,c=new Promise(p=>{h.subscribe(p),l=p}).then(o);return c.cancel=function(){h.unsubscribe(l)},c},t(function(l,c,p){h.reason||(h.reason=new sf(l,c,p),r(h.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}static source(){let t;return{token:new i(function(o){t=o}),cancel:t}}},pD=p7;Tt();Rt();xt();function g7(i){return function(r){return i.apply(null,r)}}Tt();Rt();xt();function m7(i){return Ke.isObject(i)&&i.isAxiosError===!0}Tt();Rt();xt();var v7={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(v7).forEach(([i,t])=>{v7[t]=i});var gD=v7;function mD(i){let t=new l2(i),r=i2(l2.prototype.request,t);return Ke.extend(r,l2.prototype,t,{allOwnKeys:!0}),Ke.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return mD(mh(i,o))},r}var Wn=mD(Nd);Wn.Axios=l2;Wn.CanceledError=sf;Wn.CancelToken=pD;Wn.isCancel=f2;Wn.VERSION=Uy;Wn.toFormData=lc;Wn.AxiosError=Nr;Wn.Cancel=Wn.CanceledError;Wn.all=function(t){return Promise.all(t)};Wn.spread=g7;Wn.isAxiosError=m7;Wn.mergeConfig=mh;Wn.AxiosHeaders=Zn;Wn.formToJSON=i=>Oy(Ke.isHTMLForm(i)?new FormData(i):i);Wn.getAdapter=Dy.getAdapter;Wn.HttpStatusCode=gD;Wn.default=Wn;var Fy=Wn;var{Axios:yLt,AxiosError:bLt,CanceledError:wLt,isCancel:_Lt,CancelToken:MLt,VERSION:SLt,all:ELt,Cancel:ALt,isAxiosError:TLt,spread:xLt,toFormData:RLt,AxiosHeaders:kLt,HttpStatusCode:ILt,formToJSON:BLt,getAdapter:OLt,mergeConfig:CLt}=Fy;Tt();Rt();xt();var wD=sc(yD(),1),y7="axios-retry";function _D(i){let t=["ERR_CANCELED","ECONNABORTED"];return i.response||!i.code||t.includes(i.code)?!1:(0,wD.default)(i)}var MD=["get","head","options"],Kht=MD.concat(["put","delete"]);function b7(i){return i.code!=="ECONNABORTED"&&(!i.response||i.response.status===429||i.response.status>=500&&i.response.status<=599)}function Hht(i){return i.config?.method?b7(i)&&MD.indexOf(i.config.method)!==-1:!1}function SD(i){return i.config?.method?b7(i)&&Kht.indexOf(i.config.method)!==-1:!1}function ED(i){return _D(i)||SD(i)}function AD(i=void 0){let t=i?.response?.headers["retry-after"];if(!t)return 0;let r=(Number(t)||0)*1e3;return r===0&&(r=(new Date(t).valueOf()||0)-Date.now()),Math.max(0,r)}function Ght(i=0,t=void 0){return Math.max(0,AD(t))}function Vht(i=0,t=void 0,r=100){let h=2**i*r,o=Math.max(h,AD(t)),l=o*.2*Math.random();return o+l}var Zht={retries:3,retryCondition:ED,retryDelay:Ght,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function Jht(i,t){return{...Zht,...t,...i[y7]}}function bD(i,t){let r=Jht(i,t||{});return r.retryCount=r.retryCount||0,r.lastRequestTime=r.lastRequestTime||Date.now(),i[y7]=r,r}function Xht(i,t){i.defaults.agent===t.agent&&delete t.agent,i.defaults.httpAgent===t.httpAgent&&delete t.httpAgent,i.defaults.httpsAgent===t.httpsAgent&&delete t.httpsAgent}async function Yht(i,t){let{retries:r,retryCondition:h}=i,o=(i.retryCount||0)<r&&h(t);if(typeof o=="object")try{return await o!==!1}catch{return!1}return o}async function Qht(i,t,r,h){t.retryCount+=1;let{retryDelay:o,shouldResetTimeout:l,onRetry:c}=t,p=o(t.retryCount,r);if(Xht(i,h),!l&&h.timeout&&t.lastRequestTime){let w=Date.now()-t.lastRequestTime,m=h.timeout-w-p;if(m<=0)return Promise.reject(r);h.timeout=m}return h.transformRequest=[w=>w],await c(t.retryCount,r,h),new Promise(w=>{setTimeout(()=>w(i(h)),p)})}async function tft(i,t){i.retryCount>=i.retries&&await i.onMaxRetryTimesExceeded(t,i.retryCount)}var Il=(i,t)=>{let r=i.interceptors.request.use(o=>(bD(o,t),o[y7]?.validateResponse&&(o.validateStatus=()=>!1),o)),h=i.interceptors.response.use(null,async o=>{let{config:l}=o;if(!l)return Promise.reject(o);let c=bD(l,t);return o.response&&c.validateResponse?.(o.response)?o.response:await Yht(c,o)?Qht(i,c,o,l):(await tft(c,o),Promise.reject(o))});return{requestInterceptorId:r,responseInterceptorId:h}};Il.isNetworkError=_D;Il.isSafeRequestError=Hht;Il.isIdempotentRequestError=SD;Il.isNetworkOrIdempotentRequestError=ED;Il.exponentialDelay=Vht;Il.isRetryableError=b7;var jy=Il;Tt();Rt();xt();var G9=sc(nF(),1);Tt();Rt();xt();var o1="1.2.0-alpha.
|
|
221
|
+
`+l):h.stack=l}catch{}}throw h}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=mh(this.defaults,r);let{transitional:h,paramsSerializer:o,headers:l}=r;h!==void 0&&qy.assertOptions(h,{silentJSONParsing:dc.transitional(dc.boolean),forcedJSONParsing:dc.transitional(dc.boolean),clarifyTimeoutError:dc.transitional(dc.boolean)},!1),o!=null&&(Ke.isFunction(o)?r.paramsSerializer={serialize:o}:qy.assertOptions(o,{encode:dc.function,serialize:dc.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let c=l&&Ke.merge(l.common,l[r.method]);l&&Ke.forEach(["delete","get","head","post","put","patch","common"],A=>{delete l[A]}),r.headers=Zn.concat(c,l);let p=[],w=!0;this.interceptors.request.forEach(function(R){typeof R.runWhen=="function"&&R.runWhen(r)===!1||(w=w&&R.synchronous,p.unshift(R.fulfilled,R.rejected))});let m=[];this.interceptors.response.forEach(function(R){m.push(R.fulfilled,R.rejected)});let y,v=0,M;if(!w){let A=[$y.bind(this),void 0];for(A.unshift.apply(A,p),A.push.apply(A,m),M=A.length,y=Promise.resolve(r);v<M;)y=y.then(A[v++],A[v++]);return y}M=p.length;let T=r;for(v=0;v<M;){let A=p[v++],R=p[v++];try{T=A(T)}catch(B){R.call(this,B);break}}try{y=$y.call(this,T)}catch(A){return Promise.reject(A)}for(v=0,M=m.length;v<M;)y=y.then(m[v++],m[v++]);return y}getUri(t){t=mh(this.defaults,t);let r=c2(t.baseURL,t.url);return a2(r,t.params,t.paramsSerializer)}};Ke.forEach(["delete","get","head","options"],function(t){$d.prototype[t]=function(r,h){return this.request(mh(h||{},{method:t,url:r,data:(h||{}).data}))}});Ke.forEach(["post","put","patch"],function(t){function r(h){return function(l,c,p){return this.request(mh(p||{},{method:t,headers:h?{"Content-Type":"multipart/form-data"}:{},url:l,data:c}))}}$d.prototype[t]=r(),$d.prototype[t+"Form"]=r(!0)});var l2=$d;Tt();Rt();xt();var p7=class i{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(l){r=l});let h=this;this.promise.then(o=>{if(!h._listeners)return;let l=h._listeners.length;for(;l-- >0;)h._listeners[l](o);h._listeners=null}),this.promise.then=o=>{let l,c=new Promise(p=>{h.subscribe(p),l=p}).then(o);return c.cancel=function(){h.unsubscribe(l)},c},t(function(l,c,p){h.reason||(h.reason=new sf(l,c,p),r(h.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}static source(){let t;return{token:new i(function(o){t=o}),cancel:t}}},pD=p7;Tt();Rt();xt();function g7(i){return function(r){return i.apply(null,r)}}Tt();Rt();xt();function m7(i){return Ke.isObject(i)&&i.isAxiosError===!0}Tt();Rt();xt();var v7={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(v7).forEach(([i,t])=>{v7[t]=i});var gD=v7;function mD(i){let t=new l2(i),r=i2(l2.prototype.request,t);return Ke.extend(r,l2.prototype,t,{allOwnKeys:!0}),Ke.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return mD(mh(i,o))},r}var Wn=mD(Nd);Wn.Axios=l2;Wn.CanceledError=sf;Wn.CancelToken=pD;Wn.isCancel=f2;Wn.VERSION=Uy;Wn.toFormData=lc;Wn.AxiosError=Nr;Wn.Cancel=Wn.CanceledError;Wn.all=function(t){return Promise.all(t)};Wn.spread=g7;Wn.isAxiosError=m7;Wn.mergeConfig=mh;Wn.AxiosHeaders=Zn;Wn.formToJSON=i=>Oy(Ke.isHTMLForm(i)?new FormData(i):i);Wn.getAdapter=Dy.getAdapter;Wn.HttpStatusCode=gD;Wn.default=Wn;var Fy=Wn;var{Axios:yLt,AxiosError:bLt,CanceledError:wLt,isCancel:_Lt,CancelToken:MLt,VERSION:SLt,all:ELt,Cancel:ALt,isAxiosError:TLt,spread:xLt,toFormData:RLt,AxiosHeaders:kLt,HttpStatusCode:ILt,formToJSON:BLt,getAdapter:OLt,mergeConfig:CLt}=Fy;Tt();Rt();xt();var wD=sc(yD(),1),y7="axios-retry";function _D(i){let t=["ERR_CANCELED","ECONNABORTED"];return i.response||!i.code||t.includes(i.code)?!1:(0,wD.default)(i)}var MD=["get","head","options"],Kht=MD.concat(["put","delete"]);function b7(i){return i.code!=="ECONNABORTED"&&(!i.response||i.response.status===429||i.response.status>=500&&i.response.status<=599)}function Hht(i){return i.config?.method?b7(i)&&MD.indexOf(i.config.method)!==-1:!1}function SD(i){return i.config?.method?b7(i)&&Kht.indexOf(i.config.method)!==-1:!1}function ED(i){return _D(i)||SD(i)}function AD(i=void 0){let t=i?.response?.headers["retry-after"];if(!t)return 0;let r=(Number(t)||0)*1e3;return r===0&&(r=(new Date(t).valueOf()||0)-Date.now()),Math.max(0,r)}function Ght(i=0,t=void 0){return Math.max(0,AD(t))}function Vht(i=0,t=void 0,r=100){let h=2**i*r,o=Math.max(h,AD(t)),l=o*.2*Math.random();return o+l}var Zht={retries:3,retryCondition:ED,retryDelay:Ght,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function Jht(i,t){return{...Zht,...t,...i[y7]}}function bD(i,t){let r=Jht(i,t||{});return r.retryCount=r.retryCount||0,r.lastRequestTime=r.lastRequestTime||Date.now(),i[y7]=r,r}function Xht(i,t){i.defaults.agent===t.agent&&delete t.agent,i.defaults.httpAgent===t.httpAgent&&delete t.httpAgent,i.defaults.httpsAgent===t.httpsAgent&&delete t.httpsAgent}async function Yht(i,t){let{retries:r,retryCondition:h}=i,o=(i.retryCount||0)<r&&h(t);if(typeof o=="object")try{return await o!==!1}catch{return!1}return o}async function Qht(i,t,r,h){t.retryCount+=1;let{retryDelay:o,shouldResetTimeout:l,onRetry:c}=t,p=o(t.retryCount,r);if(Xht(i,h),!l&&h.timeout&&t.lastRequestTime){let w=Date.now()-t.lastRequestTime,m=h.timeout-w-p;if(m<=0)return Promise.reject(r);h.timeout=m}return h.transformRequest=[w=>w],await c(t.retryCount,r,h),new Promise(w=>{setTimeout(()=>w(i(h)),p)})}async function tft(i,t){i.retryCount>=i.retries&&await i.onMaxRetryTimesExceeded(t,i.retryCount)}var Il=(i,t)=>{let r=i.interceptors.request.use(o=>(bD(o,t),o[y7]?.validateResponse&&(o.validateStatus=()=>!1),o)),h=i.interceptors.response.use(null,async o=>{let{config:l}=o;if(!l)return Promise.reject(o);let c=bD(l,t);return o.response&&c.validateResponse?.(o.response)?o.response:await Yht(c,o)?Qht(i,c,o,l):(await tft(c,o),Promise.reject(o))});return{requestInterceptorId:r,responseInterceptorId:h}};Il.isNetworkError=_D;Il.isSafeRequestError=Hht;Il.isIdempotentRequestError=SD;Il.isNetworkOrIdempotentRequestError=ED;Il.exponentialDelay=Vht;Il.isRetryableError=b7;var jy=Il;Tt();Rt();xt();var G9=sc(nF(),1);Tt();Rt();xt();var o1="1.2.0-alpha.19";var pa=class{logger;silent=!1;constructor({level:t="info"}={}){if(t==="none"){this.silent=!0;return}this.logger=G9.default.createLogger({level:t,name:"ar-io-sdk",version:o1,serializers:G9.default.stdSerializers})}info(t,...r){this.silent||this.logger.info(...r,t)}warn(t,...r){this.silent||this.logger.warn(...r,t)}error(t,...r){this.silent||this.logger.error(...r,t)}debug(t,...r){this.silent||this.logger.debug(...r,t)}setLogLevel(t){if(t==="none"){this.silent=!0;return}this.logger.level(t)}};var oF=({axiosConfig:i={},logger:t=new pa,retryConfig:r={retries:5,retryDelay:jy.exponentialDelay,retryCondition:h=>jy.isRetryableError(h),onRetry(h,o,l){t.error(`Retrying request ${l.url} attempt ${h}`,o)}}}={})=>{let h=Fy.create({...i,maxRedirects:0,headers:{...i.headers,"x-source-version":`${o1}`,"x-source-identifier":"ar-io-sdk"},validateStatus:()=>!0});return jy(h,r),h};Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();var wh=class extends Error{constructor(t){super(t),this.name=this.constructor.name}},O6=class extends wh{},aF=class extends wh{},Hl=class extends wh{constructor(t,r){super(`Failed request: ${t}: ${r}`)}},C6=class extends wh{},a1=class extends wh{},sF=class extends wh{constructor(){super("Invalid signer. Please provide a valid signer to interact with the contract.")}},No=class extends wh{constructor(){super("Invalid contract configuration")}},hF=class extends wh{constructor(){super("Invalid process configuration")}},s1=class extends wh{};var h1=100;async function Fqt({address:i,arweave:t,signal:r=AbortSignal.timeout(1e4)}){let h=!1,o,l=new Set;do{let c={query:`
|
|
222
222
|
{
|
|
223
223
|
transactions (
|
|
224
224
|
owners:["${i}"]
|
|
@@ -376,7 +376,7 @@ ${C}`),A.pop(),`{${W}}`}case"number":return isFinite(T)?String(T):t?t(T):"null";
|
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
}`,o=Xe.object({data:Xe.object({transactions:Xe.object({edges:Xe.array(Xe.object({node:Xe.record(Xe.any())}))})})});return l=>ci(l).chain(rn(c=>i(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:h,variables:{transactionIds:[c]}})}).then(async p=>{if(p.ok)return p.json();throw r('Error Encountered when querying gateway for transaction "%s"',c),new Error(`${p.status}: ${await p.text()}`)}).then(o.parse).then(w9t(["data","transactions","edges","0","node"])))).toPromise()}var x_t=$R(j4t(),1),pet=(i="@permaweb/aoconnect")=>{let t=(0,x_t.default)(i);return t.child=r=>pet(`${t.namespace}:${r}`),t.tap=(r,...h)=>x9t((...o)=>t(r,...h,...o)),t},get=({url:i,path:t})=>t?t.startsWith("/")?get({url:i,path:t.slice(1)}):(i=new URL(i),i.pathname+=t,i.toString()):i;function R_t(i){return ep(b8([]),tp((t,r)=>ep(S9t([],r.name),ZR(r.value),Js(r.name,Nu,t))(t),{}),v8(t=>t.length>1?t:t[0]))(i)}function Vs(i,t){return r=>qtt(B7t([ftt(i,"name"),XR(VR(t),ftt(t,"value"),KR)]),r)}function ltt(i){return Jtt([[rm(String),V1(i)],[rm(Array),u9t(i)],[KR,q5t]])}function $0(i){let t;return rm(Zs,i)?(t=new Error(k_t(i)),t.stack+=i.stack):rm(Error,i)?t=i:s9t("message",i)?t=new Error(i.message):rm(String,i)?t=new Error(i):t=new Error("An error occurred"),t}function k_t(i){return ep(t=>function r(h,o,l){return tp((c,p)=>ep(Jtt([[V1(vr.invalid_arguments),()=>r(p.argumentsError,422,"Invalid Arguments")],[V1(vr.invalid_return_type),()=>r(p.returnTypeError,500,"Invalid Return")],[V1(vr.invalid_union),()=>G7t(w=>r(w,400,"Invalid Union"),p.unionErrors)],[KR,()=>[{...p,status:o,contextCode:l}]]]),JR(c))(p.code),[],h.issues)}(t,400,""),t=>tp((r,h)=>{let{message:o,path:l,contextCode:c}=h,p=l[1]||l[0],w=c?`${c} `:"";return r.push(`${w}'${p}': ${o}.`),r},[],t),m9t(" | "))(i)}var I_t=Xe.object({id:Xe.string().min(1,{message:"message is required to be a message id"}),processId:Xe.string().min(1,{message:"process is required to be a process id"})});function B_t(){return i=>ci(i).map(I_t.parse).map(()=>i)}var Mm=Xe.object({name:Xe.string(),value:Xe.string()}),O_t=Xe.function().args(Xe.object({Id:Xe.string(),Target:Xe.string(),Owner:Xe.string(),Anchor:Xe.string().optional(),Data:Xe.any().default("1234"),Tags:Xe.array(Xe.object({name:Xe.string(),value:Xe.string()}))})).returns(Xe.promise(Xe.any())),C_t=Xe.function().args(Xe.object({id:Xe.string().min(1,{message:"message id is required"}),processId:Xe.string().min(1,{message:"process id is required"})})).returns(Xe.promise(Xe.any())),P_t=Xe.function().args(Xe.object({process:Xe.string().min(1,{message:"process id is required"}),from:Xe.string().optional(),to:Xe.string().optional(),sort:Xe.enum(["ASC","DESC"]).default("ASC"),limit:Xe.number().optional()})).returns(Xe.promise(Xe.object({edges:Xe.array(Xe.object({cursor:Xe.string(),node:Xe.object({Output:Xe.any().optional(),Messages:Xe.array(Xe.any()).optional(),Spawns:Xe.array(Xe.any()).optional(),Error:Xe.any().optional()})}))}))),met=Xe.function().args(Xe.object({processId:Xe.string(),data:Xe.any(),tags:Xe.array(Mm),anchor:Xe.string().optional(),signer:Xe.any()})).returns(Xe.promise(Xe.object({messageId:Xe.string()}).passthrough())),N_t=Xe.function().args(Xe.object({data:Xe.any(),tags:Xe.array(Mm),signer:Xe.any()})).returns(Xe.promise(Xe.object({processId:Xe.string()}).passthrough())),L_t=Xe.function().args(Xe.object({process:Xe.string(),message:Xe.string(),baseLayer:Xe.boolean().optional(),exclude:Xe.array(Xe.string()).optional()})).returns(Xe.promise(Xe.object({assignmentId:Xe.string()}).passthrough())),vet=met,LWt=Xe.function().args(Xe.object({suUrl:Xe.string().url(),processId:Xe.string()})).returns(Xe.promise(Xe.object({tags:Xe.array(Mm)}).passthrough())),DWt=Xe.function().args(Xe.string()).returns(Xe.promise(Xe.object({url:Xe.string()}))),D_t=Xe.function().args(Xe.string()).returns(Xe.promise(Xe.boolean())),$_t=Xe.function().args(Xe.string()).returns(Xe.promise(Xe.object({tags:Xe.array(Mm)}).passthrough())),w8=Xe.function().args(Xe.object({data:Xe.any(),tags:Xe.array(Mm),target:Xe.string().optional(),anchor:Xe.string().optional()})).returns(Xe.promise(Xe.object({id:Xe.string(),raw:Xe.any()})));function U_t({loadResult:i}){return i=rn(C_t.implement(i)),t=>ci({id:t.id,processId:t.processId}).chain(i)}function q_t(i){let t=B_t(i),r=U_t(i);return({message:h,process:o})=>ci({id:h,processId:o}).chain(t).chain(r).map(i.logger.tap('readResult result for message "%s": %O',h)).map(l=>l).bimap($0,D0).toPromise()}var F_t=Xe.array(Xe.object({name:Xe.string(),value:Xe.string()}));function j_t(){return i=>ci(i.tags).map(b8([])).map(Vs("Data-Protocol","ao")).map(Vs("Variant")).map(Vs("Type")).map(Vs("SDK")).map(JR(Nu,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Message"},{name:"SDK",value:"aoconnect"}])).map(F_t.parse).map(Js("tags",Nu,i))}function z_t({logger:i}){return t=>ci(t).chain(XR(VR(t.data),()=>O0(t),()=>O0(Math.random().toString().slice(-4)).map(Js("data",Nu,t)).map(r=>ep(L0("tags"),Vs("Content-Type"),ZR({name:"Content-Type",value:"text/plain"}),Js("tags",Nu,r))(r)).map(i.tap('added pseudo-random string as message "data"'))))}function W_t(i){let t=j_t(i),r=z_t(i),h=met.implement(i.deployMessage);return o=>ci(o).chain(t).chain(r).chain(rn(({id:l,data:c,tags:p,anchor:w,signer:m})=>h({processId:l,data:c,tags:p,anchor:w,signer:w8.implement(m)}))).map(l=>Js("messageId",l.messageId,o))}function K_t(i){let t=W_t(i);return({process:r,data:h,tags:o,anchor:l,signer:c})=>ci({id:r,data:h,tags:o,anchor:l,signer:c}).chain(t).map(p=>p.messageId).bimap($0,D0).toPromise()}var Xg=(i,t,r)=>h=>t(h[i])?O0(h):tl(`Tag '${i}': ${r}`);function H_t({loadTransactionMeta:i,logger:t}){return i=rn($_t.implement(i)),r=>ci(r).chain(i).map(L0("tags")).map(R_t).chain(Xg("Data-Protocol",ltt("ao"),"value 'ao' was not found on module")).chain(Xg("Type",ltt("Module"),"value 'Module' was not found on module")).chain(Xg("Module-Format",yR,"was not found on module")).chain(Xg("Input-Encoding",yR,"was not found on module")).chain(Xg("Output-Encoding",yR,"was not found on module")).bimap(t.tap("Verifying module source failed: %s"),t.tap("Verified module source"))}function G_t({logger:i,validateScheduler:t}){return t=rn(D_t.implement(t)),r=>ci(r).chain(h=>t(h).chain(o=>o?O0(h):tl(`Valid Scheduler-Location owned by ${h} not found`))).bimap(i.tap("Verifying scheduler failed: %s"),i.tap("Verified scheduler"))}function V_t({logger:i}){return t=>ci(t).map(i.tap("Checking for signer")).chain(r=>r?O0(r):tl("signer not found"))}function Z_t(i){let t=i.logger.child("verifyInput");i={...i,logger:t};let r=H_t(i),h=G_t(i),o=V_t(i);return l=>ci(l).chain(c=>r(c.module).map(()=>c)).chain(c=>h(c.scheduler)).map(()=>l).chain(c=>o(c.signer).map(()=>c)).bimap(t.tap("Error when verify input: %s"),t.tap("Successfully verified inputs"))}var J_t=Xe.array(Xe.object({name:Xe.string(),value:Xe.string()}));function X_t(){return i=>ci(i).map(L0("tags")).map(b8([])).map(Vs("Data-Protocol","ao")).map(Vs("Variant")).map(Vs("Type")).map(Vs("Module")).map(Vs("Scheduler")).map(Vs("SDK")).map(JR(Nu,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Process"},{name:"Module",value:i.module},{name:"Scheduler",value:i.scheduler},{name:"SDK",value:"aoconnect"}])).map(J_t.parse).map(Js("tags",Nu,i))}function Y_t({logger:i}){return t=>ci(t).chain(XR(VR(t.data),()=>O0(t),()=>O0(Math.random().toString().slice(-4)).map(Js("data",Nu,t)).map(r=>ep(L0("tags"),Vs("Content-Type"),ZR({name:"Content-Type",value:"text/plain"}),Js("tags",Nu,r))(r)).map(i.tap('added pseudo-random string as process "data"'))))}function Q_t(i){let t=i.logger.child("uploadProcess");i={...i,logger:t};let r=X_t(i),h=Y_t(i),o=N_t.implement(i.deployProcess);return l=>ci(l).chain(r).chain(h).chain(rn(({data:c,tags:p,signer:w})=>o({data:c,tags:p,signer:w8.implement(w)}))).map(c=>Js("processId",c.processId,l))}function tMt(i){let t=Z_t(i),r=Q_t(i);return({module:h,scheduler:o,signer:l,tags:c,data:p})=>ci({module:h,scheduler:o,signer:l,tags:c,data:p}).chain(t).chain(r).map(w=>w.processId).bimap($0,D0).toPromise()}function eMt(i){let t=vet.implement(i.deployMonitor);return r=>ci(r).chain(rn(({id:h,signer:o})=>t({processId:h,signer:w8.implement(o),data:Math.random().toString().slice(-4),tags:[]}))).map(h=>Js("monitorId",h.messageId,r))}function rMt(i){let t=eMt(i);return({process:r,signer:h})=>ci({id:r,signer:h}).chain(t).map(o=>o.monitorId).bimap($0,D0).toPromise()}function iMt(i){let t=vet.implement(i.deployUnmonitor);return r=>ci(r).chain(rn(({id:h,signer:o})=>t({processId:h,signer:w8.implement(o),data:Math.random().toString().slice(-4),tags:[]}))).map(h=>Js("monitorId",h.messageId,r))}function nMt(i){let t=iMt(i);return({process:r,signer:h})=>ci({id:r,signer:h}).chain(t).map(o=>o.monitorId).bimap($0,D0).toPromise()}var oMt=Xe.object({process:Xe.string().min(1,{message:"process identifier is required"}),from:Xe.string().optional(),to:Xe.string().optional(),sort:Xe.enum(["ASC","DESC"]).default("ASC"),limit:Xe.number().optional()});function aMt(){return i=>ci(i).map(oMt.parse).map(()=>i)}function sMt({queryResults:i}){return i=rn(P_t.implement(i)),t=>ci({process:t.process,from:t.from,to:t.to,sort:t.sort,limit:t.limit}).chain(i)}function hMt(i){let t=aMt(i),r=sMt(i);return({process:h,from:o,to:l,sort:c,limit:p})=>ci({process:h,from:o,to:l,sort:c,limit:p}).chain(t).chain(r).map(i.logger.tap('readResults result for message "%s": %O',h)).map(w=>w).bimap($0,D0).toPromise()}var fMt=Xe.object({Id:Xe.string(),Target:Xe.string(),Owner:Xe.string(),Anchor:Xe.string().optional(),Data:Xe.any().default("1234"),Tags:Xe.array(Xe.object({name:Xe.string(),value:Xe.string()}))});function uMt(){return i=>ci(i).map(fMt.parse).map(t=>(t.Tags=t.Tags.concat([{name:"Data-Protocol",value:"ao"},{name:"Type",value:"Message"},{name:"Variant",value:"ao.TN.1"}]),t))}function cMt({dryrunFetch:i}){return rn(O_t.implement(i))}function lMt(i){let t=uMt(i),r=cMt(i);return h=>ci(h).map(dMt).chain(t).chain(r).toPromise()}function dMt({process:i,data:t,tags:r,anchor:h,...o}){return{Id:"1234",Owner:"1234",...o,Target:i,Data:t||"1234",Tags:r||[],Anchor:h||"0"}}function pMt(i){let t=L_t.implement(i.deployAssign);return r=>ci(r).chain(rn(({process:h,message:o,baseLayer:l,exclude:c})=>t({process:h,message:o,baseLayer:l,exclude:c}))).map(h=>Js("assignmentId",h.assignmentId,r))}function gMt(i){let t=pMt(i);return({process:r,message:h,baseLayer:o,exclude:l})=>ci({process:r,message:h,baseLayer:o,exclude:l}).chain(t).map(c=>c.assignmentId).bimap($0,D0).toPromise()}var mMt="https://arweave.net",vMt="https://mu.ao-testnet.xyz",yMt="https://cu.ao-testnet.xyz";function Sm({GRAPHQL_URL:i,GATEWAY_URL:t=mMt,MU_URL:r=vMt,CU_URL:h=yMt}={}){let o=pet();i||(i=get({url:t,path:"/graphql"}));let{validate:l}=Ltt({cacheSize:100,GRAPHQL_URL:i}),c=$5t({MAX_SIZE:25}),p=o.child("result"),w=q_t({loadResult:N5t({fetch,CU_URL:h,logger:p}),logger:p}),m=o.child("message"),y=K_t({loadProcessMeta:gR({fetch,cache:c,logger:m}),deployMessage:k5t({fetch,MU_URL:r,logger:m}),logger:m}),v=o.child("spawn"),M=tMt({loadTransactionMeta:T_t({fetch,GRAPHQL_URL:i,logger:v}),validateScheduler:l,deployProcess:I5t({fetch,MU_URL:r,logger:v}),logger:v}),T=o.child("monitor"),A=rMt({loadProcessMeta:gR({fetch,cache:c,logger:T}),deployMonitor:B5t({fetch,MU_URL:r,logger:T}),logger:T}),R=o.child("unmonitor"),B=nMt({loadProcessMeta:gR({fetch,cache:c,logger:R}),deployUnmonitor:O5t({fetch,MU_URL:r,logger:R}),logger:T}),C=o.child("results"),P=hMt({queryResults:L5t({fetch,CU_URL:h,logger:C}),logger:C}),N=o.child("dryrun"),q=lMt({dryrunFetch:P5t({fetch,CU_URL:h,logger:N}),logger:N}),W=o.child("assign"),J=gMt({deployAssign:C5t({fetch,MU_URL:r,logger:W}),logger:m});return{result:w,results:P,message:y,spawn:M,monitor:A,unmonitor:B,dryrun:q,assign:J}}var yet={};gtt(yet,{createDataItemSigner:()=>zMt});var bet=$R(K4t(),1),wet={};gtt(wet,{AVSCTap:()=>Em,ArweaveSigner:()=>ek,DataItem:()=>ym,MAX_TAG_BYTES:()=>_8,MIN_BINARY_SIZE:()=>nk,SIG_CONFIG:()=>op,SignatureConfig:()=>Gs,Signer:()=>Aet,createData:()=>ket,default:()=>qMt,deserializeTags:()=>l8,indexToType:()=>rk,serializeTags:()=>ik,tagsExceedLimit:()=>Ret,warparbundles:()=>FMt});var bMt=Object.create,QR=Object.defineProperty,wMt=Object.getOwnPropertyDescriptor,_Mt=Object.getOwnPropertyNames,MMt=Object.getPrototypeOf,SMt=Object.prototype.hasOwnProperty,Du=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),EMt=(i,t)=>{for(var r in t)QR(i,r,{get:t[r],enumerable:!0})},AMt=(i,t,r,h)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _Mt(t))!SMt.call(i,o)&&o!==r&&QR(i,o,{get:()=>t[o],enumerable:!(h=wMt(t,o))||h.enumerable});return i},U0=(i,t,r)=>(r=i!=null?bMt(MMt(i)):{},AMt(t||!i||!i.__esModule?QR(r,"default",{value:i,enumerable:!0}):r,i)),TMt=Du(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});function t(r){var h=4,o=r.length,l=o%h;if(!l)return r;var c=o,p=h-l,w=o+p,m=ge.alloc(w);for(m.write(r);p--;)m.write("=",c++);return m.toString()}i.default=t}),xMt=Du(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});var t=TMt();function r(w,m){return m===void 0&&(m="utf8"),ge.isBuffer(w)?l(w.toString("base64")):l(ge.from(w,m).toString("base64"))}function h(w,m){return m===void 0&&(m="utf8"),ge.from(o(w),"base64").toString(m)}function o(w){return w=w.toString(),t.default(w).replace(/\-/g,"+").replace(/_/g,"/")}function l(w){return w.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function c(w){return ge.from(o(w),"base64")}var p=r;p.encode=r,p.decode=h,p.toBase64=o,p.fromBase64=l,p.toBuffer=c,i.default=p}),tk=Du((i,t)=>{t.exports=xMt().default,t.exports.default=t.exports}),_et=Du(i=>{"use strict";i.byteLength=w,i.toByteArray=y,i.fromByteArray=T;var t=[],r=[],h=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(l=0,c=o.length;l<c;++l)t[l]=o[l],r[o.charCodeAt(l)]=l;var l,c;r[45]=62,r[95]=63;function p(A){var R=A.length;if(R%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var B=A.indexOf("=");B===-1&&(B=R);var C=B===R?0:4-B%4;return[B,C]}function w(A){var R=p(A),B=R[0],C=R[1];return(B+C)*3/4-C}function m(A,R,B){return(R+B)*3/4-B}function y(A){var R,B=p(A),C=B[0],P=B[1],N=new h(m(A,C,P)),q=0,W=P>0?C-4:C,J;for(J=0;J<W;J+=4)R=r[A.charCodeAt(J)]<<18|r[A.charCodeAt(J+1)]<<12|r[A.charCodeAt(J+2)]<<6|r[A.charCodeAt(J+3)],N[q++]=R>>16&255,N[q++]=R>>8&255,N[q++]=R&255;return P===2&&(R=r[A.charCodeAt(J)]<<2|r[A.charCodeAt(J+1)]>>4,N[q++]=R&255),P===1&&(R=r[A.charCodeAt(J)]<<10|r[A.charCodeAt(J+1)]<<4|r[A.charCodeAt(J+2)]>>2,N[q++]=R>>8&255,N[q++]=R&255),N}function v(A){return t[A>>18&63]+t[A>>12&63]+t[A>>6&63]+t[A&63]}function M(A,R,B){for(var C,P=[],N=R;N<B;N+=3)C=(A[N]<<16&16711680)+(A[N+1]<<8&65280)+(A[N+2]&255),P.push(v(C));return P.join("")}function T(A){for(var R,B=A.length,C=B%3,P=[],N=16383,q=0,W=B-C;q<W;q+=N)P.push(M(A,q,q+N>W?W:q+N));return C===1?(R=A[B-1],P.push(t[R>>2]+t[R<<4&63]+"==")):C===2&&(R=(A[B-2]<<8)+A[B-1],P.push(t[R>>10]+t[R>>4&63]+t[R<<2&63]+"=")),P.join("")}}),Met=Du(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.b64UrlDecode=i.b64UrlEncode=i.bufferTob64Url=i.bufferTob64=i.b64UrlToBuffer=i.stringToB64Url=i.stringToBuffer=i.bufferToString=i.b64UrlToString=i.concatBuffers=void 0;var t=_et();function r(M){let T=0;for(let B=0;B<M.length;B++)T+=M[B].byteLength;let A=new Uint8Array(T),R=0;A.set(new Uint8Array(M[0]),R),R+=M[0].byteLength;for(let B=1;B<M.length;B++)A.set(new Uint8Array(M[B]),R),R+=M[B].byteLength;return A}i.concatBuffers=r;function h(M){let T=p(M);return o(T)}i.b64UrlToString=h;function o(M){return new TextDecoder("utf-8",{fatal:!0}).decode(M)}i.bufferToString=o;function l(M){return new TextEncoder().encode(M)}i.stringToBuffer=l;function c(M){return m(l(M))}i.stringToB64Url=c;function p(M){return new Uint8Array(t.toByteArray(v(M)))}i.b64UrlToBuffer=p;function w(M){return t.fromByteArray(new Uint8Array(M))}i.bufferTob64=w;function m(M){return y(w(M))}i.bufferTob64Url=m;function y(M){return M.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}i.b64UrlEncode=y;function v(M){M=M.replace(/\-/g,"+").replace(/\_/g,"/");let T;return M.length%4==0?T=0:T=4-M.length%4,M.concat("=".repeat(T))}i.b64UrlDecode=v}),RMt=Du(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});var t=Met(),r=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let h=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),o=await this.driver.exportKey("jwk",h.privateKey);return{kty:o.kty,e:o.e,n:o.n,d:o.d,p:o.p,q:o.q,dp:o.dp,dq:o.dq,qi:o.qi}}async sign(h,o,{saltLength:l}={}){let c=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(h),o);return new Uint8Array(c)}async hash(h,o="SHA-256"){let l=await this.driver.digest(o,h);return new Uint8Array(l)}async verify(h,o,l){let c={kty:"RSA",e:"AQAB",n:h},p=await this.jwkToPublicCryptoKey(c),w=await this.driver.digest("SHA-256",o),m=await this.driver.verify({name:"RSA-PSS",saltLength:0},p,l,o),y=await this.driver.verify({name:"RSA-PSS",saltLength:32},p,l,o),v=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((p.algorithm.modulusLength-1)/8)-w.byteLength-2},p,l,o);return m||y||v}async jwkToCryptoKey(h){return this.driver.importKey("jwk",h,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(h){return this.driver.importKey("jwk",h,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let h=crypto?.subtle;return h===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(o=>typeof h[o]=="function")}async encrypt(h,o,l){let c=await this.driver.importKey("raw",typeof o=="string"?t.stringToBuffer(o):o,{name:"PBKDF2",length:32},!1,["deriveKey"]),p=await this.driver.deriveKey({name:"PBKDF2",salt:l?t.stringToBuffer(l):t.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},c,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),w=new Uint8Array(16);crypto.getRandomValues(w);let m=await this.driver.encrypt({name:"AES-CBC",iv:w},p,h);return t.concatBuffers([w,m])}async decrypt(h,o,l){let c=await this.driver.importKey("raw",typeof o=="string"?t.stringToBuffer(o):o,{name:"PBKDF2",length:32},!1,["deriveKey"]),p=await this.driver.deriveKey({name:"PBKDF2",salt:l?t.stringToBuffer(l):t.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},c,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),w=h.slice(0,16),m=await this.driver.decrypt({name:"AES-CBC",iv:w},p,h.slice(16));return t.concatBuffers([m])}};i.default=r}),kMt=Du(i=>{i.read=function(t,r,h,o,l){var c,p,w=l*8-o-1,m=(1<<w)-1,y=m>>1,v=-7,M=h?l-1:0,T=h?-1:1,A=t[r+M];for(M+=T,c=A&(1<<-v)-1,A>>=-v,v+=w;v>0;c=c*256+t[r+M],M+=T,v-=8);for(p=c&(1<<-v)-1,c>>=-v,v+=o;v>0;p=p*256+t[r+M],M+=T,v-=8);if(c===0)c=1-y;else{if(c===m)return p?NaN:(A?-1:1)*(1/0);p=p+Math.pow(2,o),c=c-y}return(A?-1:1)*p*Math.pow(2,c-o)},i.write=function(t,r,h,o,l,c){var p,w,m,y=c*8-l-1,v=(1<<y)-1,M=v>>1,T=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=o?0:c-1,R=o?1:-1,B=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(w=isNaN(r)?1:0,p=v):(p=Math.floor(Math.log(r)/Math.LN2),r*(m=Math.pow(2,-p))<1&&(p--,m*=2),p+M>=1?r+=T/m:r+=T*Math.pow(2,1-M),r*m>=2&&(p++,m/=2),p+M>=v?(w=0,p=v):p+M>=1?(w=(r*m-1)*Math.pow(2,l),p=p+M):(w=r*Math.pow(2,M-1)*Math.pow(2,l),p=0));l>=8;t[h+A]=w&255,A+=R,w/=256,l-=8);for(p=p<<l|w,y+=l;y>0;t[h+A]=p&255,A+=R,p/=256,y-=8);t[h+A-R]|=B*128}}),NR=Du(i=>{"use strict";var t=_et(),r=kMt(),h=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;i.Buffer=p,i.SlowBuffer=P,i.INSPECT_MAX_BYTES=50;var o=2147483647;i.kMaxLength=o,p.TYPED_ARRAY_SUPPORT=l(),!p.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function l(){try{let I=new Uint8Array(1),O={foo:function(){return 42}};return Object.setPrototypeOf(O,Uint8Array.prototype),Object.setPrototypeOf(I,O),I.foo()===42}catch{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}}),Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function c(I){if(I>o)throw new RangeError('The value "'+I+'" is invalid for option "size"');let O=new Uint8Array(I);return Object.setPrototypeOf(O,p.prototype),O}function p(I,O,L){if(typeof I=="number"){if(typeof O=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(I)}return w(I,O,L)}p.poolSize=8192;function w(I,O,L){if(typeof I=="string")return M(I,O);if(ArrayBuffer.isView(I))return A(I);if(I==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I);if(mt(I,ArrayBuffer)||I&&mt(I.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(mt(I,SharedArrayBuffer)||I&&mt(I.buffer,SharedArrayBuffer)))return R(I,O,L);if(typeof I=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let V=I.valueOf&&I.valueOf();if(V!=null&&V!==I)return p.from(V,O,L);let st=B(I);if(st)return st;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof I[Symbol.toPrimitive]=="function")return p.from(I[Symbol.toPrimitive]("string"),O,L);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I)}p.from=function(I,O,L){return w(I,O,L)},Object.setPrototypeOf(p.prototype,Uint8Array.prototype),Object.setPrototypeOf(p,Uint8Array);function m(I){if(typeof I!="number")throw new TypeError('"size" argument must be of type number');if(I<0)throw new RangeError('The value "'+I+'" is invalid for option "size"')}function y(I,O,L){return m(I),I<=0?c(I):O!==void 0?typeof L=="string"?c(I).fill(O,L):c(I).fill(O):c(I)}p.alloc=function(I,O,L){return y(I,O,L)};function v(I){return m(I),c(I<0?0:C(I)|0)}p.allocUnsafe=function(I){return v(I)},p.allocUnsafeSlow=function(I){return v(I)};function M(I,O){if((typeof O!="string"||O==="")&&(O="utf8"),!p.isEncoding(O))throw new TypeError("Unknown encoding: "+O);let L=N(I,O)|0,V=c(L),st=V.write(I,O);return st!==L&&(V=V.slice(0,st)),V}function T(I){let O=I.length<0?0:C(I.length)|0,L=c(O);for(let V=0;V<O;V+=1)L[V]=I[V]&255;return L}function A(I){if(mt(I,Uint8Array)){let O=new Uint8Array(I);return R(O.buffer,O.byteOffset,O.byteLength)}return T(I)}function R(I,O,L){if(O<0||I.byteLength<O)throw new RangeError('"offset" is outside of buffer bounds');if(I.byteLength<O+(L||0))throw new RangeError('"length" is outside of buffer bounds');let V;return O===void 0&&L===void 0?V=new Uint8Array(I):L===void 0?V=new Uint8Array(I,O):V=new Uint8Array(I,O,L),Object.setPrototypeOf(V,p.prototype),V}function B(I){if(p.isBuffer(I)){let O=C(I.length)|0,L=c(O);return L.length===0||I.copy(L,0,0,O),L}if(I.length!==void 0)return typeof I.length!="number"||wt(I.length)?c(0):T(I);if(I.type==="Buffer"&&Array.isArray(I.data))return T(I.data)}function C(I){if(I>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return I|0}function P(I){return+I!=I&&(I=0),p.alloc(+I)}p.isBuffer=function(I){return I!=null&&I._isBuffer===!0&&I!==p.prototype},p.compare=function(I,O){if(mt(I,Uint8Array)&&(I=p.from(I,I.offset,I.byteLength)),mt(O,Uint8Array)&&(O=p.from(O,O.offset,O.byteLength)),!p.isBuffer(I)||!p.isBuffer(O))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(I===O)return 0;let L=I.length,V=O.length;for(let st=0,ft=Math.min(L,V);st<ft;++st)if(I[st]!==O[st]){L=I[st],V=O[st];break}return L<V?-1:V<L?1:0},p.isEncoding=function(I){switch(String(I).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},p.concat=function(I,O){if(!Array.isArray(I))throw new TypeError('"list" argument must be an Array of Buffers');if(I.length===0)return p.alloc(0);let L;if(O===void 0)for(O=0,L=0;L<I.length;++L)O+=I[L].length;let V=p.allocUnsafe(O),st=0;for(L=0;L<I.length;++L){let ft=I[L];if(mt(ft,Uint8Array))st+ft.length>V.length?(p.isBuffer(ft)||(ft=p.from(ft)),ft.copy(V,st)):Uint8Array.prototype.set.call(V,ft,st);else if(p.isBuffer(ft))ft.copy(V,st);else throw new TypeError('"list" argument must be an Array of Buffers');st+=ft.length}return V};function N(I,O){if(p.isBuffer(I))return I.length;if(ArrayBuffer.isView(I)||mt(I,ArrayBuffer))return I.byteLength;if(typeof I!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof I);let L=I.length,V=arguments.length>2&&arguments[2]===!0;if(!V&&L===0)return 0;let st=!1;for(;;)switch(O){case"ascii":case"latin1":case"binary":return L;case"utf8":case"utf-8":return ut(I).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L*2;case"hex":return L>>>1;case"base64":return bt(I).length;default:if(st)return V?-1:ut(I).length;O=(""+O).toLowerCase(),st=!0}}p.byteLength=N;function q(I,O,L){let V=!1;if((O===void 0||O<0)&&(O=0),O>this.length||((L===void 0||L>this.length)&&(L=this.length),L<=0)||(L>>>=0,O>>>=0,L<=O))return"";for(I||(I="utf8");;)switch(I){case"hex":return e(this,O,L);case"utf8":case"utf-8":return d(this,O,L);case"ascii":return x(this,O,L);case"latin1":case"binary":return a(this,O,L);case"base64":return f(this,O,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u(this,O,L);default:if(V)throw new TypeError("Unknown encoding: "+I);I=(I+"").toLowerCase(),V=!0}}p.prototype._isBuffer=!0;function W(I,O,L){let V=I[O];I[O]=I[L],I[L]=V}p.prototype.swap16=function(){let I=this.length;if(I%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let O=0;O<I;O+=2)W(this,O,O+1);return this},p.prototype.swap32=function(){let I=this.length;if(I%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let O=0;O<I;O+=4)W(this,O,O+3),W(this,O+1,O+2);return this},p.prototype.swap64=function(){let I=this.length;if(I%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let O=0;O<I;O+=8)W(this,O,O+7),W(this,O+1,O+6),W(this,O+2,O+5),W(this,O+3,O+4);return this},p.prototype.toString=function(){let I=this.length;return I===0?"":arguments.length===0?d(this,0,I):q.apply(this,arguments)},p.prototype.toLocaleString=p.prototype.toString,p.prototype.equals=function(I){if(!p.isBuffer(I))throw new TypeError("Argument must be a Buffer");return this===I?!0:p.compare(this,I)===0},p.prototype.inspect=function(){let I="",O=i.INSPECT_MAX_BYTES;return I=this.toString("hex",0,O).replace(/(.{2})/g,"$1 ").trim(),this.length>O&&(I+=" ... "),"<Buffer "+I+">"},h&&(p.prototype[h]=p.prototype.inspect),p.prototype.compare=function(I,O,L,V,st){if(mt(I,Uint8Array)&&(I=p.from(I,I.offset,I.byteLength)),!p.isBuffer(I))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof I);if(O===void 0&&(O=0),L===void 0&&(L=I?I.length:0),V===void 0&&(V=0),st===void 0&&(st=this.length),O<0||L>I.length||V<0||st>this.length)throw new RangeError("out of range index");if(V>=st&&O>=L)return 0;if(V>=st)return-1;if(O>=L)return 1;if(O>>>=0,L>>>=0,V>>>=0,st>>>=0,this===I)return 0;let ft=st-V,ht=L-O,Et=Math.min(ft,ht),_t=this.slice(V,st),vt=I.slice(O,L);for(let Qt=0;Qt<Et;++Qt)if(_t[Qt]!==vt[Qt]){ft=_t[Qt],ht=vt[Qt];break}return ft<ht?-1:ht<ft?1:0};function J(I,O,L,V,st){if(I.length===0)return-1;if(typeof L=="string"?(V=L,L=0):L>2147483647?L=2147483647:L<-2147483648&&(L=-2147483648),L=+L,wt(L)&&(L=st?0:I.length-1),L<0&&(L=I.length+L),L>=I.length){if(st)return-1;L=I.length-1}else if(L<0)if(st)L=0;else return-1;if(typeof O=="string"&&(O=p.from(O,V)),p.isBuffer(O))return O.length===0?-1:F(I,O,L,V,st);if(typeof O=="number")return O=O&255,typeof Uint8Array.prototype.indexOf=="function"?st?Uint8Array.prototype.indexOf.call(I,O,L):Uint8Array.prototype.lastIndexOf.call(I,O,L):F(I,[O],L,V,st);throw new TypeError("val must be string, number or Buffer")}function F(I,O,L,V,st){let ft=1,ht=I.length,Et=O.length;if(V!==void 0&&(V=String(V).toLowerCase(),V==="ucs2"||V==="ucs-2"||V==="utf16le"||V==="utf-16le")){if(I.length<2||O.length<2)return-1;ft=2,ht/=2,Et/=2,L/=2}function _t(Qt,It){return ft===1?Qt[It]:Qt.readUInt16BE(It*ft)}let vt;if(st){let Qt=-1;for(vt=L;vt<ht;vt++)if(_t(I,vt)===_t(O,Qt===-1?0:vt-Qt)){if(Qt===-1&&(Qt=vt),vt-Qt+1===Et)return Qt*ft}else Qt!==-1&&(vt-=vt-Qt),Qt=-1}else for(L+Et>ht&&(L=ht-Et),vt=L;vt>=0;vt--){let Qt=!0;for(let It=0;It<Et;It++)if(_t(I,vt+It)!==_t(O,It)){Qt=!1;break}if(Qt)return vt}return-1}p.prototype.includes=function(I,O,L){return this.indexOf(I,O,L)!==-1},p.prototype.indexOf=function(I,O,L){return J(this,I,O,L,!0)},p.prototype.lastIndexOf=function(I,O,L){return J(this,I,O,L,!1)};function H(I,O,L,V){L=Number(L)||0;let st=I.length-L;V?(V=Number(V),V>st&&(V=st)):V=st;let ft=O.length;V>ft/2&&(V=ft/2);let ht;for(ht=0;ht<V;++ht){let Et=parseInt(O.substr(ht*2,2),16);if(wt(Et))return ht;I[L+ht]=Et}return ht}function Y(I,O,L,V){return lt(ut(O,I.length-L),I,L,V)}function E(I,O,L,V){return lt(pt(O),I,L,V)}function n(I,O,L,V){return lt(bt(O),I,L,V)}function s(I,O,L,V){return lt(St(O,I.length-L),I,L,V)}p.prototype.write=function(I,O,L,V){if(O===void 0)V="utf8",L=this.length,O=0;else if(L===void 0&&typeof O=="string")V=O,L=this.length,O=0;else if(isFinite(O))O=O>>>0,isFinite(L)?(L=L>>>0,V===void 0&&(V="utf8")):(V=L,L=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let st=this.length-O;if((L===void 0||L>st)&&(L=st),I.length>0&&(L<0||O<0)||O>this.length)throw new RangeError("Attempt to write outside buffer bounds");V||(V="utf8");let ft=!1;for(;;)switch(V){case"hex":return H(this,I,O,L);case"utf8":case"utf-8":return Y(this,I,O,L);case"ascii":case"latin1":case"binary":return E(this,I,O,L);case"base64":return n(this,I,O,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s(this,I,O,L);default:if(ft)throw new TypeError("Unknown encoding: "+V);V=(""+V).toLowerCase(),ft=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function f(I,O,L){return O===0&&L===I.length?t.fromByteArray(I):t.fromByteArray(I.slice(O,L))}function d(I,O,L){L=Math.min(I.length,L);let V=[],st=O;for(;st<L;){let ft=I[st],ht=null,Et=ft>239?4:ft>223?3:ft>191?2:1;if(st+Et<=L){let _t,vt,Qt,It;switch(Et){case 1:ft<128&&(ht=ft);break;case 2:_t=I[st+1],(_t&192)===128&&(It=(ft&31)<<6|_t&63,It>127&&(ht=It));break;case 3:_t=I[st+1],vt=I[st+2],(_t&192)===128&&(vt&192)===128&&(It=(ft&15)<<12|(_t&63)<<6|vt&63,It>2047&&(It<55296||It>57343)&&(ht=It));break;case 4:_t=I[st+1],vt=I[st+2],Qt=I[st+3],(_t&192)===128&&(vt&192)===128&&(Qt&192)===128&&(It=(ft&15)<<18|(_t&63)<<12|(vt&63)<<6|Qt&63,It>65535&&It<1114112&&(ht=It))}}ht===null?(ht=65533,Et=1):ht>65535&&(ht-=65536,V.push(ht>>>10&1023|55296),ht=56320|ht&1023),V.push(ht),st+=Et}return S(V)}var g=4096;function S(I){let O=I.length;if(O<=g)return String.fromCharCode.apply(String,I);let L="",V=0;for(;V<O;)L+=String.fromCharCode.apply(String,I.slice(V,V+=g));return L}function x(I,O,L){let V="";L=Math.min(I.length,L);for(let st=O;st<L;++st)V+=String.fromCharCode(I[st]&127);return V}function a(I,O,L){let V="";L=Math.min(I.length,L);for(let st=O;st<L;++st)V+=String.fromCharCode(I[st]);return V}function e(I,O,L){let V=I.length;(!O||O<0)&&(O=0),(!L||L<0||L>V)&&(L=V);let st="";for(let ft=O;ft<L;++ft)st+=Mt[I[ft]];return st}function u(I,O,L){let V=I.slice(O,L),st="";for(let ft=0;ft<V.length-1;ft+=2)st+=String.fromCharCode(V[ft]+V[ft+1]*256);return st}p.prototype.slice=function(I,O){let L=this.length;I=~~I,O=O===void 0?L:~~O,I<0?(I+=L,I<0&&(I=0)):I>L&&(I=L),O<0?(O+=L,O<0&&(O=0)):O>L&&(O=L),O<I&&(O=I);let V=this.subarray(I,O);return Object.setPrototypeOf(V,p.prototype),V};function b(I,O,L){if(I%1!==0||I<0)throw new RangeError("offset is not uint");if(I+O>L)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUintLE=p.prototype.readUIntLE=function(I,O,L){I=I>>>0,O=O>>>0,L||b(I,O,this.length);let V=this[I],st=1,ft=0;for(;++ft<O&&(st*=256);)V+=this[I+ft]*st;return V},p.prototype.readUintBE=p.prototype.readUIntBE=function(I,O,L){I=I>>>0,O=O>>>0,L||b(I,O,this.length);let V=this[I+--O],st=1;for(;O>0&&(st*=256);)V+=this[I+--O]*st;return V},p.prototype.readUint8=p.prototype.readUInt8=function(I,O){return I=I>>>0,O||b(I,1,this.length),this[I]},p.prototype.readUint16LE=p.prototype.readUInt16LE=function(I,O){return I=I>>>0,O||b(I,2,this.length),this[I]|this[I+1]<<8},p.prototype.readUint16BE=p.prototype.readUInt16BE=function(I,O){return I=I>>>0,O||b(I,2,this.length),this[I]<<8|this[I+1]},p.prototype.readUint32LE=p.prototype.readUInt32LE=function(I,O){return I=I>>>0,O||b(I,4,this.length),(this[I]|this[I+1]<<8|this[I+2]<<16)+this[I+3]*16777216},p.prototype.readUint32BE=p.prototype.readUInt32BE=function(I,O){return I=I>>>0,O||b(I,4,this.length),this[I]*16777216+(this[I+1]<<16|this[I+2]<<8|this[I+3])},p.prototype.readBigUInt64LE=ne(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&rt(I,this.length-8);let V=O+this[++I]*2**8+this[++I]*2**16+this[++I]*2**24,st=this[++I]+this[++I]*2**8+this[++I]*2**16+L*2**24;return BigInt(V)+(BigInt(st)<<BigInt(32))}),p.prototype.readBigUInt64BE=ne(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&rt(I,this.length-8);let V=O*2**24+this[++I]*2**16+this[++I]*2**8+this[++I],st=this[++I]*2**24+this[++I]*2**16+this[++I]*2**8+L;return(BigInt(V)<<BigInt(32))+BigInt(st)}),p.prototype.readIntLE=function(I,O,L){I=I>>>0,O=O>>>0,L||b(I,O,this.length);let V=this[I],st=1,ft=0;for(;++ft<O&&(st*=256);)V+=this[I+ft]*st;return st*=128,V>=st&&(V-=Math.pow(2,8*O)),V},p.prototype.readIntBE=function(I,O,L){I=I>>>0,O=O>>>0,L||b(I,O,this.length);let V=O,st=1,ft=this[I+--V];for(;V>0&&(st*=256);)ft+=this[I+--V]*st;return st*=128,ft>=st&&(ft-=Math.pow(2,8*O)),ft},p.prototype.readInt8=function(I,O){return I=I>>>0,O||b(I,1,this.length),this[I]&128?(255-this[I]+1)*-1:this[I]},p.prototype.readInt16LE=function(I,O){I=I>>>0,O||b(I,2,this.length);let L=this[I]|this[I+1]<<8;return L&32768?L|4294901760:L},p.prototype.readInt16BE=function(I,O){I=I>>>0,O||b(I,2,this.length);let L=this[I+1]|this[I]<<8;return L&32768?L|4294901760:L},p.prototype.readInt32LE=function(I,O){return I=I>>>0,O||b(I,4,this.length),this[I]|this[I+1]<<8|this[I+2]<<16|this[I+3]<<24},p.prototype.readInt32BE=function(I,O){return I=I>>>0,O||b(I,4,this.length),this[I]<<24|this[I+1]<<16|this[I+2]<<8|this[I+3]},p.prototype.readBigInt64LE=ne(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&rt(I,this.length-8);let V=this[I+4]+this[I+5]*2**8+this[I+6]*2**16+(L<<24);return(BigInt(V)<<BigInt(32))+BigInt(O+this[++I]*2**8+this[++I]*2**16+this[++I]*2**24)}),p.prototype.readBigInt64BE=ne(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&rt(I,this.length-8);let V=(O<<24)+this[++I]*2**16+this[++I]*2**8+this[++I];return(BigInt(V)<<BigInt(32))+BigInt(this[++I]*2**24+this[++I]*2**16+this[++I]*2**8+L)}),p.prototype.readFloatLE=function(I,O){return I=I>>>0,O||b(I,4,this.length),r.read(this,I,!0,23,4)},p.prototype.readFloatBE=function(I,O){return I=I>>>0,O||b(I,4,this.length),r.read(this,I,!1,23,4)},p.prototype.readDoubleLE=function(I,O){return I=I>>>0,O||b(I,8,this.length),r.read(this,I,!0,52,8)},p.prototype.readDoubleBE=function(I,O){return I=I>>>0,O||b(I,8,this.length),r.read(this,I,!1,52,8)};function _(I,O,L,V,st,ft){if(!p.isBuffer(I))throw new TypeError('"buffer" argument must be a Buffer instance');if(O>st||O<ft)throw new RangeError('"value" argument is out of bounds');if(L+V>I.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(I,O,L,V){if(I=+I,O=O>>>0,L=L>>>0,!V){let ht=Math.pow(2,8*L)-1;_(this,I,O,L,ht,0)}let st=1,ft=0;for(this[O]=I&255;++ft<L&&(st*=256);)this[O+ft]=I/st&255;return O+L},p.prototype.writeUintBE=p.prototype.writeUIntBE=function(I,O,L,V){if(I=+I,O=O>>>0,L=L>>>0,!V){let ht=Math.pow(2,8*L)-1;_(this,I,O,L,ht,0)}let st=L-1,ft=1;for(this[O+st]=I&255;--st>=0&&(ft*=256);)this[O+st]=I/ft&255;return O+L},p.prototype.writeUint8=p.prototype.writeUInt8=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,1,255,0),this[O]=I&255,O+1},p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,2,65535,0),this[O]=I&255,this[O+1]=I>>>8,O+2},p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,2,65535,0),this[O]=I>>>8,this[O+1]=I&255,O+2},p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,4,4294967295,0),this[O+3]=I>>>24,this[O+2]=I>>>16,this[O+1]=I>>>8,this[O]=I&255,O+4},p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,4,4294967295,0),this[O]=I>>>24,this[O+1]=I>>>16,this[O+2]=I>>>8,this[O+3]=I&255,O+4};function k(I,O,L,V,st){U(O,V,st,I,L,7);let ft=Number(O&BigInt(4294967295));I[L++]=ft,ft=ft>>8,I[L++]=ft,ft=ft>>8,I[L++]=ft,ft=ft>>8,I[L++]=ft;let ht=Number(O>>BigInt(32)&BigInt(4294967295));return I[L++]=ht,ht=ht>>8,I[L++]=ht,ht=ht>>8,I[L++]=ht,ht=ht>>8,I[L++]=ht,L}function $(I,O,L,V,st){U(O,V,st,I,L,7);let ft=Number(O&BigInt(4294967295));I[L+7]=ft,ft=ft>>8,I[L+6]=ft,ft=ft>>8,I[L+5]=ft,ft=ft>>8,I[L+4]=ft;let ht=Number(O>>BigInt(32)&BigInt(4294967295));return I[L+3]=ht,ht=ht>>8,I[L+2]=ht,ht=ht>>8,I[L+1]=ht,ht=ht>>8,I[L]=ht,L+8}p.prototype.writeBigUInt64LE=ne(function(I,O=0){return k(this,I,O,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeBigUInt64BE=ne(function(I,O=0){return $(this,I,O,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeIntLE=function(I,O,L,V){if(I=+I,O=O>>>0,!V){let Et=Math.pow(2,8*L-1);_(this,I,O,L,Et-1,-Et)}let st=0,ft=1,ht=0;for(this[O]=I&255;++st<L&&(ft*=256);)I<0&&ht===0&&this[O+st-1]!==0&&(ht=1),this[O+st]=(I/ft>>0)-ht&255;return O+L},p.prototype.writeIntBE=function(I,O,L,V){if(I=+I,O=O>>>0,!V){let Et=Math.pow(2,8*L-1);_(this,I,O,L,Et-1,-Et)}let st=L-1,ft=1,ht=0;for(this[O+st]=I&255;--st>=0&&(ft*=256);)I<0&&ht===0&&this[O+st+1]!==0&&(ht=1),this[O+st]=(I/ft>>0)-ht&255;return O+L},p.prototype.writeInt8=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,1,127,-128),I<0&&(I=255+I+1),this[O]=I&255,O+1},p.prototype.writeInt16LE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,2,32767,-32768),this[O]=I&255,this[O+1]=I>>>8,O+2},p.prototype.writeInt16BE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,2,32767,-32768),this[O]=I>>>8,this[O+1]=I&255,O+2},p.prototype.writeInt32LE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,4,2147483647,-2147483648),this[O]=I&255,this[O+1]=I>>>8,this[O+2]=I>>>16,this[O+3]=I>>>24,O+4},p.prototype.writeInt32BE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,4,2147483647,-2147483648),I<0&&(I=4294967295+I+1),this[O]=I>>>24,this[O+1]=I>>>16,this[O+2]=I>>>8,this[O+3]=I&255,O+4},p.prototype.writeBigInt64LE=ne(function(I,O=0){return k(this,I,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),p.prototype.writeBigInt64BE=ne(function(I,O=0){return $(this,I,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function it(I,O,L,V,st,ft){if(L+V>I.length)throw new RangeError("Index out of range");if(L<0)throw new RangeError("Index out of range")}function Z(I,O,L,V,st){return O=+O,L=L>>>0,st||it(I,O,L,4,34028234663852886e22,-34028234663852886e22),r.write(I,O,L,V,23,4),L+4}p.prototype.writeFloatLE=function(I,O,L){return Z(this,I,O,!0,L)},p.prototype.writeFloatBE=function(I,O,L){return Z(this,I,O,!1,L)};function et(I,O,L,V,st){return O=+O,L=L>>>0,st||it(I,O,L,8,17976931348623157e292,-17976931348623157e292),r.write(I,O,L,V,52,8),L+8}p.prototype.writeDoubleLE=function(I,O,L){return et(this,I,O,!0,L)},p.prototype.writeDoubleBE=function(I,O,L){return et(this,I,O,!1,L)},p.prototype.copy=function(I,O,L,V){if(!p.isBuffer(I))throw new TypeError("argument should be a Buffer");if(L||(L=0),!V&&V!==0&&(V=this.length),O>=I.length&&(O=I.length),O||(O=0),V>0&&V<L&&(V=L),V===L||I.length===0||this.length===0)return 0;if(O<0)throw new RangeError("targetStart out of bounds");if(L<0||L>=this.length)throw new RangeError("Index out of range");if(V<0)throw new RangeError("sourceEnd out of bounds");V>this.length&&(V=this.length),I.length-O<V-L&&(V=I.length-O+L);let st=V-L;return this===I&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(O,L,V):Uint8Array.prototype.set.call(I,this.subarray(L,V),O),st},p.prototype.fill=function(I,O,L,V){if(typeof I=="string"){if(typeof O=="string"?(V=O,O=0,L=this.length):typeof L=="string"&&(V=L,L=this.length),V!==void 0&&typeof V!="string")throw new TypeError("encoding must be a string");if(typeof V=="string"&&!p.isEncoding(V))throw new TypeError("Unknown encoding: "+V);if(I.length===1){let ft=I.charCodeAt(0);(V==="utf8"&&ft<128||V==="latin1")&&(I=ft)}}else typeof I=="number"?I=I&255:typeof I=="boolean"&&(I=Number(I));if(O<0||this.length<O||this.length<L)throw new RangeError("Out of range index");if(L<=O)return this;O=O>>>0,L=L===void 0?this.length:L>>>0,I||(I=0);let st;if(typeof I=="number")for(st=O;st<L;++st)this[st]=I;else{let ft=p.isBuffer(I)?I:p.from(I,V),ht=ft.length;if(ht===0)throw new TypeError('The value "'+I+'" is invalid for argument "value"');for(st=0;st<L-O;++st)this[st+O]=ft[st%ht]}return this};var Q={};function z(I,O,L){Q[I]=class extends L{constructor(){super(),Object.defineProperty(this,"message",{value:O.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${I}]`,this.stack,delete this.name}get code(){return I}set code(V){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:V,writable:!0})}toString(){return`${this.name} [${I}]: ${this.message}`}}}z("ERR_BUFFER_OUT_OF_BOUNDS",function(I){return I?`${I} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),z("ERR_INVALID_ARG_TYPE",function(I,O){return`The "${I}" argument must be of type number. Received type ${typeof O}`},TypeError),z("ERR_OUT_OF_RANGE",function(I,O,L){let V=`The value of "${I}" is out of range.`,st=L;return Number.isInteger(L)&&Math.abs(L)>2**32?st=tt(String(L)):typeof L=="bigint"&&(st=String(L),(L>BigInt(2)**BigInt(32)||L<-(BigInt(2)**BigInt(32)))&&(st=tt(st)),st+="n"),V+=` It must be ${O}. Received ${st}`,V},RangeError);function tt(I){let O="",L=I.length,V=I[0]==="-"?1:0;for(;L>=V+4;L-=3)O=`_${I.slice(L-3,L)}${O}`;return`${I.slice(0,L)}${O}`}function X(I,O,L){j(O,"offset"),(I[O]===void 0||I[O+L]===void 0)&&rt(O,I.length-(L+1))}function U(I,O,L,V,st,ft){if(I>L||I<O){let ht=typeof O=="bigint"?"n":"",Et;throw ft>3?O===0||O===BigInt(0)?Et=`>= 0${ht} and < 2${ht} ** ${(ft+1)*8}${ht}`:Et=`>= -(2${ht} ** ${(ft+1)*8-1}${ht}) and < 2 ** ${(ft+1)*8-1}${ht}`:Et=`>= ${O}${ht} and <= ${L}${ht}`,new Q.ERR_OUT_OF_RANGE("value",Et,I)}X(V,st,ft)}function j(I,O){if(typeof I!="number")throw new Q.ERR_INVALID_ARG_TYPE(O,"number",I)}function rt(I,O,L){throw Math.floor(I)!==I?(j(I,L),new Q.ERR_OUT_OF_RANGE(L||"offset","an integer",I)):O<0?new Q.ERR_BUFFER_OUT_OF_BOUNDS:new Q.ERR_OUT_OF_RANGE(L||"offset",`>= ${L?1:0} and <= ${O}`,I)}var ot=/[^+/0-9A-Za-z-_]/g;function ct(I){if(I=I.split("=")[0],I=I.trim().replace(ot,""),I.length<2)return"";for(;I.length%4!==0;)I=I+"=";return I}function ut(I,O){O=O||1/0;let L,V=I.length,st=null,ft=[];for(let ht=0;ht<V;++ht){if(L=I.charCodeAt(ht),L>55295&&L<57344){if(!st){if(L>56319){(O-=3)>-1&&ft.push(239,191,189);continue}else if(ht+1===V){(O-=3)>-1&&ft.push(239,191,189);continue}st=L;continue}if(L<56320){(O-=3)>-1&&ft.push(239,191,189),st=L;continue}L=(st-55296<<10|L-56320)+65536}else st&&(O-=3)>-1&&ft.push(239,191,189);if(st=null,L<128){if((O-=1)<0)break;ft.push(L)}else if(L<2048){if((O-=2)<0)break;ft.push(L>>6|192,L&63|128)}else if(L<65536){if((O-=3)<0)break;ft.push(L>>12|224,L>>6&63|128,L&63|128)}else if(L<1114112){if((O-=4)<0)break;ft.push(L>>18|240,L>>12&63|128,L>>6&63|128,L&63|128)}else throw new Error("Invalid code point")}return ft}function pt(I){let O=[];for(let L=0;L<I.length;++L)O.push(I.charCodeAt(L)&255);return O}function St(I,O){let L,V,st,ft=[];for(let ht=0;ht<I.length&&!((O-=2)<0);++ht)L=I.charCodeAt(ht),V=L>>8,st=L%256,ft.push(st),ft.push(V);return ft}function bt(I){return t.toByteArray(ct(I))}function lt(I,O,L,V){let st;for(st=0;st<V&&!(st+L>=O.length||st>=I.length);++st)O[st+L]=I[st];return st}function mt(I,O){return I instanceof O||I!=null&&I.constructor!=null&&I.constructor.name!=null&&I.constructor.name===O.name}function wt(I){return I!==I}var Mt=function(){let I="0123456789abcdef",O=new Array(256);for(let L=0;L<16;++L){let V=L*16;for(let st=0;st<16;++st)O[V+st]=I[L]+I[st]}return O}();function ne(I){return typeof BigInt>"u"?nt:I}function nt(){throw new Error("BigInt not supported")}}),IMt=Du((i,t)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,t.exports={Buffer:NR().Buffer,Crypto:window.crypto}):t.exports={Buffer:NR().Buffer,Crypto:crypto}}),Eet={};EMt(Eet,{AVSCTap:()=>Em,ArweaveSigner:()=>ek,DataItem:()=>ym,MAX_TAG_BYTES:()=>_8,MIN_BINARY_SIZE:()=>nk,SIG_CONFIG:()=>op,SignatureConfig:()=>Gs,Signer:()=>Aet,createData:()=>ket,deserializeTags:()=>l8,indexToType:()=>rk,serializeTags:()=>ik,tagsExceedLimit:()=>Ret});var Aet=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(i,t,r,h){throw new Error("You must implement verify method on child")}},BMt=U0(tk(),1),Wh=U0(Met(),1);async function Tet(i){if(Array.isArray(i)){let o=(0,Wh.concatBuffers)([(0,Wh.stringToBuffer)("list"),(0,Wh.stringToBuffer)(i.length.toString())]);return await xet(i,await Cu().hash(o,"SHA-384"))}let t=i,r=(0,Wh.concatBuffers)([(0,Wh.stringToBuffer)("blob"),(0,Wh.stringToBuffer)(t.byteLength.toString())]),h=(0,Wh.concatBuffers)([await Cu().hash(r,"SHA-384"),await Cu().hash(t,"SHA-384")]);return await Cu().hash(h,"SHA-384")}async function xet(i,t){if(i.length<1)return t;let r=(0,Wh.concatBuffers)([t,await Tet(i[0])]),h=await Cu().hash(r,"SHA-384");return await xet(i.slice(1),h)}var wR=U0(RMt(),1),OMt=wR.default.default?wR.default.default:wR.default,CMt=class extends OMt{getPublicKey(i){throw new Error("Unimplemented")}},PMt;function Cu(){return PMt??=new CMt}var Gs;(function(i){i[i.ARWEAVE=1]="ARWEAVE",i[i.ED25519=2]="ED25519",i[i.ETHEREUM=3]="ETHEREUM",i[i.SOLANA=4]="SOLANA",i[i.INJECTEDAPTOS=5]="INJECTEDAPTOS",i[i.MULTIAPTOS=6]="MULTIAPTOS",i[i.TYPEDETHEREUM=7]="TYPEDETHEREUM"})(Gs||(Gs={}));var op={[Gs.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[Gs.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[Gs.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[Gs.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[Gs.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[Gs.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[Gs.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},ek=class{signatureType=1;ownerLength=op[1].pubLength;signatureLength=op[1].sigLength;jwk;pk;constructor(i){this.pk=i.n,this.jwk=i}get publicKey(){return BMt.default.toBuffer(this.pk)}sign(i){return Cu().sign(this.jwk,i)}static async verify(i,t,r){return await Cu().verify(i,t,r)}},rk={1:ek},Of=U0(tk(),1);async function LR(i){return Tet([(0,Wh.stringToBuffer)("dataitem"),(0,Wh.stringToBuffer)("1"),(0,Wh.stringToBuffer)(i.signatureType.toString()),i.rawOwner,i.rawTarget,i.rawAnchor,i.rawTags,i.rawData])}async function NMt(i,t){let r=await LR(i),h=await t.sign(r),o=await Cu().hash(h);return{signature:ge.from(h),id:ge.from(o)}}async function LMt(i,t){let{signature:r,id:h}=await NMt(i,t);return i.getRaw().set(r,2),h}var Em=class{buf;pos;constructor(i=ge.alloc(_8),t=0){this.buf=i,this.pos=t}writeTags(i){if(!Array.isArray(i))throw new Error("input must be array");let t=i.length,r;if(t)for(this.writeLong(t),r=0;r<t;r++){let h=i[r];if(h?.name===void 0||h?.value===void 0)throw new Error(`Invalid tag format for ${h}, expected {name:string, value: string}`);this.writeString(h.name),this.writeString(h.value)}this.writeLong(0)}toBuffer(){let i=ge.alloc(this.pos);if(this.pos>this.buf.length)throw new Error(`Too many tag bytes (${this.pos} > ${this.buf.length})`);return this.buf.copy(i,0,0,this.pos),i}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(i){let t=this.buf,r,h;if(i>=-1073741824&&i<1073741824){h=i>=0?i<<1:~i<<1|1;do t[this.pos]=h&127,h>>=7;while(h&&(t[this.pos++]|=128))}else{r=i>=0?i*2:-i*2-1;do t[this.pos]=r&127,r/=128;while(r>=1&&(t[this.pos++]|=128))}this.pos++,this.buf=t}writeString(i){let t=ge.byteLength(i),r=this.buf;this.writeLong(t);let h=this.pos;if(this.pos+=t,!(this.pos>r.length)){if(t>64)this.buf.write(i,this.pos-t,t,"utf8");else{let o,l,c,p;for(o=0,l=t;o<l;o++)c=i.charCodeAt(o),c<128?r[h++]=c:c<2048?(r[h++]=c>>6|192,r[h++]=c&63|128):(c&64512)===55296&&((p=i.charCodeAt(o+1))&64512)===56320?(c=65536+((c&1023)<<10)+(p&1023),o++,r[h++]=c>>18|240,r[h++]=c>>12&63|128,r[h++]=c>>6&63|128,r[h++]=c&63|128):(r[h++]=c>>12|224,r[h++]=c>>6&63|128,r[h++]=c&63|128)}this.buf=r}}readLong(){let i=0,t=0,r=this.buf,h,o,l,c;do h=r[this.pos++],o=h&128,i|=(h&127)<<t,t+=7;while(o&&t<28);if(o){l=i,c=268435456;do h=r[this.pos++],l+=(h&127)*c,c*=128;while(h&128);return(l%2?-(l+1):l)/2}return i>>1^-(i&1)}skipLong(){let i=this.buf;for(;i[this.pos++]&128;);}readTags(){let i=[],t;for(;t=this.readLong();)for(t<0&&(t=-t,this.skipLong());t--;){let r=this.readString(),h=this.readString();i.push({name:r,value:h})}return i}readString(){let i=this.readLong(),t=this.pos,r=this.buf;if(this.pos+=i,!(this.pos>r.length))return this.buf.slice(t,t+i).toString()}};function ik(i){let t=new Em;return t.writeTags(i),t.toBuffer()}function Ret(i){let t=new Em;return t.writeTags(i),t.tagsExceedLimit()}function l8(i){return new Em(i).readTags()}function Jc(i){let t=0;for(let r=i.length-1;r>=0;r--)t=t*256+i[r];return t}function DMt(i){if(i>29)throw new Error("Short too long");let t=[0,0];for(let r=0;r<t.length;r++){let h=i&255;t[r]=h,i=(i-h)/256}return Uint8Array.from(t)}function dtt(i){let t=[0,0,0,0,0,0,0,0];for(let r=0;r<t.length;r++){let h=i&255;t[r]=h,i=(i-h)/256}return Uint8Array.from(t)}var $Mt=U0(IMt(),1),H1=U0(NR(),1),_8=4096,nk=80,ym=class{binary;_id;constructor(i){this.binary=i}static isDataItem(i){return i.binary!==void 0}get signatureType(){let i=Jc(this.binary.subarray(0,2));if(Gs?.[i]!==void 0)return i;throw new Error("Unknown signature type: "+i)}async isValid(){return ym.verify(this.binary)}get id(){return(async()=>Of.default.encode(await this.rawId))()}set id(i){this._id=Of.default.toBuffer(i)}get rawId(){return(async()=>H1.Buffer.from(await $Mt.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(i){this._id=i}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return Of.default.encode(this.rawSignature)}set rawOwner(i){if(i.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${i.byteLength} bytes.`);this.binary.set(i,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return op[this.signatureType].sigLength}get owner(){return Of.default.encode(this.rawOwner)}get ownerLength(){return op[this.signatureType].pubLength}get rawTarget(){let i=this.getTargetStart();return this.binary[i]==1?this.binary.subarray(i+1,i+33):H1.Buffer.alloc(0)}get target(){return Of.default.encode(this.rawTarget)}get rawAnchor(){let i=this.getAnchorStart();return this.binary[i]==1?this.binary.subarray(i+1,i+33):H1.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let i=this.getTagsStart(),t=Jc(this.binary.subarray(i+8,i+16));return this.binary.subarray(i+16,i+16+t)}get tags(){let i=this.getTagsStart();if(Jc(this.binary.subarray(i,i+8))==0)return[];let t=Jc(this.binary.subarray(i+8,i+16));return l8(H1.Buffer.from(this.binary.subarray(i+16,i+16+t)))}get tagsB64Url(){return this.tags.map(i=>({name:Of.default.encode(i.name),value:Of.default.encode(i.value)}))}getStartOfData(){let i=this.getTagsStart(),t=this.binary.subarray(i+8,i+16),r=Jc(t);return i+16+r}get rawData(){let i=this.getTagsStart(),t=this.binary.subarray(i+8,i+16),r=Jc(t),h=i+16+r;return this.binary.subarray(h,this.binary.length)}get data(){return Of.default.encode(this.rawData)}getRaw(){return this.binary}async sign(i){return this._id=await LMt(this,i),this.rawId}async setSignature(i){this.binary.set(i,2),this._id=H1.Buffer.from(await Cu().hash(i))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(i=>({name:Of.default.encode(i.name),value:Of.default.encode(i.value)})),data:this.data}}static async verify(i){if(i.byteLength<nk)return!1;let t=new ym(i),r=t.signatureType,h=t.getTagsStart(),o=Jc(i.subarray(h,h+8)),l=i.subarray(h+8,h+16),c=Jc(l);if(c>_8)return!1;if(o>0)try{if(l8(H1.Buffer.from(i.subarray(h+16,h+16+c))).length!==o)return!1}catch{return!1}let p=rk[r],w=await LR(t);return await p.verify(t.rawOwner,w,t.rawSignature)}async getSignatureData(){return LR(this)}getTagsStart(){let i=this.getTargetStart(),t=this.binary[i]==1,r=i+(t?33:1),h=this.binary[r]==1;return r+=h?33:1,r}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let i=this.getTargetStart()+1,t=this.binary[this.getTargetStart()]==1;return i+=t?32:0,i}},UMt=U0(tk(),1);function ket(i,t,r){let h=t.publicKey,o=r?.target?UMt.default.toBuffer(r.target):null,l=1+(o?.byteLength??0),c=r?.anchor?ge.from(r.anchor):null,p=1+(c?.byteLength??0),w=(r?.tags?.length??0)>0?ik(r.tags):null,m=16+(w?w.byteLength:0),y=ge.from(i),v=y.byteLength,M=2+t.signatureLength+t.ownerLength+l+p+m+v,T=ge.alloc(M);if(T.set(DMt(t.signatureType),0),T.set(new Uint8Array(t.signatureLength).fill(0),2),h.byteLength!==t.ownerLength)throw new Error(`Owner must be ${t.ownerLength} bytes, but was incorrectly ${h.byteLength}`);T.set(h,2+t.signatureLength);let A=2+t.signatureLength+t.ownerLength;if(T[A]=o?1:0,o){if(o.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${o.byteLength}`);T.set(o,A+1)}let R=A+l,B=R+1;if(T[R]=c?1:0,c){if(B+=c.byteLength,c.byteLength!==32)throw new Error("Anchor must be 32 bytes");T.set(c,R+1)}T.set(dtt(r?.tags?.length??0),B);let C=dtt(w?.byteLength??0);T.set(C,B+8),w&&T.set(w,B+16);let P=B+m;return T.set(y,P),new ym(T)}var ok={...Eet};globalThis.arbundles??=ok;var qMt=ok,FMt=ok;globalThis.Buffer||(globalThis.Buffer=bet.Buffer);var{DataItem:jMt}=wet;function zMt(i){return async({data:r,tags:h,target:o,anchor:l,createDataItem:c=p=>new jMt(p)})=>{let p=await i.signDataItem({data:r,tags:h,target:o,anchor:l}),w=c(bet.Buffer.from(p));return{id:await w.id,raw:await w.getRaw()}}}var WMt=globalThis.GATEWAY_URL||void 0,KMt=globalThis.MU_URL||void 0,HMt=globalThis.CU_URL||void 0,GMt=globalThis.GRAPHQL_URL||void 0,{result:$Wt,results:UWt,message:qWt,spawn:FWt,monitor:jWt,unmonitor:zWt,dryrun:WWt,assign:KWt}=Sm({GATEWAY_URL:WMt,MU_URL:KMt,CU_URL:HMt,GRAPHQL_URL:GMt}),HWt=yet.createDataItemSigner;var Iet=sc(z5(),1);Tt();Rt();xt();function ak(i){try{return JSON.parse(i)}catch{return i}}var Ys=class i{logger;processId;ao;constructor({processId:t,ao:r=Sm(),logger:h=new pa({level:"info"})}){this.processId=t,this.logger=h,this.ao=r}static async createAoSigner(t){return t.publicKey===void 0&&"setPublicKey"in t&&await t.setPublicKey(),async({data:h,tags:o,target:l,anchor:c})=>{let p=(0,Iet.createData)(h,t,{tags:o,target:l,anchor:c});return p.sign(t).then(async()=>({id:await p.id,raw:await p.getRaw()}))}}async read({tags:t,retries:r=3}){let h=0,o;for(;h<r;)try{this.logger.debug("Evaluating read interaction on contract",{tags:t});let l=await this.ao.dryrun({process:this.processId,tags:t});if(l.Messages.length===0)throw new Error(`Process ${this.processId} does not support provided action.`);let p=l.Messages[0].Tags.find(m=>m.name==="Error");if(p)throw new Error(`${p.Value}: ${l.Messages[0].Data}`);return this.logger.debug("Read interaction result",{result:l.Messages[0].Data}),l.Messages[0].Data===void 0?{}:ak(l.Messages[0].Data)}catch(l){h++,this.logger.debug(`Read attempt ${h} failed`,{error:l,tags:t}),o=l,await new Promise(c=>setTimeout(c,2**h*1e3))}throw o}async send({tags:t,data:r,signer:h,retries:o=3}){let l=0,c;for(;l<o;)try{this.logger.debug("Evaluating send interaction on contract",{tags:t,data:r,processId:this.processId});let p=await this.ao.message({process:this.processId,tags:[...t,{name:"AR-IO-SDK",value:o1}],data:typeof r!="string"?JSON.stringify(r):r,signer:await i.createAoSigner(h)});this.logger.debug("Sent message to process",{messageId:p,processId:this.processId});let w=await this.ao.result({message:p,process:this.processId});if(this.logger.debug("Message result",{output:w,messageId:p,processId:this.processId}),w.Messages?.length===0||w.Messages===void 0)return{id:p};let y=w.Messages[0].Tags.find(M=>M.name==="Error");if(y){let M=w.Messages[0].Data;throw new a1(`${y.Value}: ${M}`)}if(w.Messages.length===0)throw new Error(`Process ${this.processId} does not support provided action.`);if(w.Messages[0].Data===void 0)return{id:p};let v=ak(w.Messages[0].Data);return this.logger.debug("Message result data",{resultData:v,messageId:p,processId:this.processId}),{id:p,result:v}}catch(p){if(this.logger.error("Error sending message to process",{error:p.message,processId:this.processId,tags:t}),p.message.includes("500"))this.logger.debug("Retrying send interaction",{attempts:l,retries:o,error:p.message,processId:this.processId}),await new Promise(w=>setTimeout(w,2**l*2e3)),l++,c=p;else throw p}throw c}};var Am=class{static init(t){if(t&&t.signer){let{signer:r,...h}=t;return new sk({...h,signer:r})}return new M8(t)}},M8=class{process;arweave;constructor(t,r=Bet.default.init({})){if(!t)this.process=new Ys({processId:Od});else if(Rl(t))this.process=t.process;else if(kl(t))this.process=new Ys({processId:t.processId,logger:new pa({level:"info"})});else throw new No;this.arweave=r}async getInfo(){return this.process.read({tags:[{name:"Action",value:"Info"}]})}async getEpoch(t){let h=[{name:"Action",value:"Epoch"},{name:"Timestamp",value:t?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Block-Height",value:t?.blockHeight?.toString()},{name:"Epoch-Index",value:t?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return this.process.read({tags:h})}async getArNSRecord({name:t}){return this.process.read({tags:[{name:"Action",value:"Record"},{name:"Name",value:t}]})}async getArNSRecords(){return this.process.read({tags:[{name:"Action",value:"Records"}]})}async getArNSReservedNames(){return this.process.read({tags:[{name:"Action",value:"Reserved-Names"}]})}async getArNSReservedName({name:t}){return this.process.read({tags:[{name:"Action",value:"Reserved-Name"},{name:"Name",value:t}]})}async getBalance({address:t}){return this.process.read({tags:[{name:"Action",value:"Balance"},{name:"Address",value:t}]})}async getBalances(){return this.process.read({tags:[{name:"Action",value:"Balances"}]})}async getGateway({address:t}){return this.process.read({tags:[{name:"Action",value:"Gateway"},{name:"Address",value:t}]})}async getGateways(){return this.process.read({tags:[{name:"Action",value:"Gateways"}]})}async getCurrentEpoch(){return this.process.read({tags:[{name:"Action",value:"Epoch"},{name:"Timestamp",value:(await this.arweave.blocks.getCurrent().catch(()=>({timestamp:Date.now()}))).timestamp.toString()}]})}async getPrescribedObservers(t){let h=[{name:"Action",value:"Epoch-Prescribed-Observers"},{name:"Timestamp",value:t?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Block-Height",value:t?.blockHeight?.toString()},{name:"Epoch-Index",value:t?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return this.process.read({tags:h})}async getPrescribedNames(t){let h=[{name:"Action",value:"Epoch-Prescribed-Names"},{name:"Timestamp",value:t?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Block-Height",value:t?.blockHeight?.toString()},{name:"Epoch-Index",value:t?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return this.process.read({tags:h})}async getObservations(t){let h=[{name:"Action",value:"Epoch-Observations"},{name:"Timestamp",value:t?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().catch(()=>({timestamp:`${Date.now()}`}))).timestamp.toString()},{name:"Block-Height",value:t?.blockHeight?.toString()},{name:"Epoch-Index",value:t?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return this.process.read({tags:h})}async getDistributions(t){let h=[{name:"Action",value:"Epoch-Distributions"},{name:"Timestamp",value:t?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Block-Height",value:t?.blockHeight?.toString()},{name:"Epoch-Index",value:t?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return this.process.read({tags:h})}async getTokenCost({intent:t,purchaseType:r,years:h,name:o,quantity:l}){let p=[{name:"Action",value:"Token-Cost"},{name:"Intent",value:t},{name:"Name",value:o},{name:"Years",value:h?.toString()},{name:"Quantity",value:l?.toString()},{name:"Purchase-Type",value:r},{name:"Timestamp",value:(await this.arweave.blocks.getCurrent().catch(()=>({timestamp:Date.now()}))).timestamp.toString()}].filter(w=>w.value!==void 0);return this.process.read({tags:p})}},sk=class extends M8{signer;constructor({signer:t,...r}){if(Object.keys(r).length===0)super({process:new Ys({processId:Od})}),this.signer=t;else if(Rl(r))super({process:r.process}),this.signer=t;else if(kl(r))super({process:new Ys({processId:r.processId})}),this.signer=t;else throw new No}async transfer({target:t,qty:r},h){let{tags:o=[]}=h||{};return this.process.send({tags:[...o,{name:"Action",value:"Transfer"},{name:"Recipient",value:t},{name:"Quantity",value:r.valueOf().toString()}],signer:this.signer})}async joinNetwork({operatorStake:t,allowDelegatedStaking:r,delegateRewardShareRatio:h,fqdn:o,label:l,minDelegatedStake:c,note:p,port:w,properties:m,protocol:y,autoStake:v,observerAddress:M},T){let{tags:A=[]}=T||{},B=[...A,{name:"Action",value:"Join-Network"},{name:"Operator-Stake",value:t.valueOf().toString()},{name:"Allow-Delegated-Staking",value:r.toString()},{name:"Delegate-Reward-Share-Ratio",value:h.toString()},{name:"FQDN",value:o},{name:"Label",value:l},{name:"Min-Delegated-Stake",value:c.valueOf().toString()},{name:"Note",value:p},{name:"Port",value:w.toString()},{name:"Properties",value:m},{name:"Protocol",value:y},{name:"Auto-Stake",value:v.toString()},{name:"Observer-Address",value:M}].filter(C=>C.value!==void 0);return this.process.send({signer:this.signer,tags:B})}async updateGatewaySettings({allowDelegatedStaking:t,delegateRewardShareRatio:r,fqdn:h,label:o,minDelegatedStake:l,note:c,port:p,properties:w,protocol:m,autoStake:y,observerAddress:v},M){let{tags:T=[]}=M||{},R=[...T,{name:"Action",value:"Update-Gateway-Settings"},{name:"Label",value:o},{name:"Note",value:c},{name:"FQDN",value:h},{name:"Port",value:p?.toString()},{name:"Properties",value:w},{name:"Protocol",value:m},{name:"Observer-Address",value:v},{name:"Allow-Delegated-Staking",value:t?.toString()},{name:"Delegate-Reward-Share-Ratio",value:r?.toString()},{name:"Min-Delegated-Stake",value:l?.valueOf().toString()},{name:"Auto-Stake",value:y?.toString()}].filter(B=>B.value!==void 0);return this.process.send({signer:this.signer,tags:R})}async delegateStake(t,r){let{tags:h=[]}=r||{};return this.process.send({signer:this.signer,tags:[...h,{name:"Action",value:"Delegate-Stake"},{name:"Target",value:t.target},{name:"Quantity",value:t.stakeQty.valueOf().toString()}]})}async decreaseDelegateStake(t,r){let{tags:h=[]}=r||{};return this.process.send({signer:this.signer,tags:[...h,{name:"Action",value:"Decrease-Delegate-Stake"},{name:"Target",value:t.target},{name:"Quantity",value:t.decreaseQty.valueOf().toString()}]})}async increaseOperatorStake(t,r){let{tags:h=[]}=r||{};return this.process.send({signer:this.signer,tags:[...h,{name:"Action",value:"Increase-Operator-Stake"},{name:"Quantity",value:t.increaseQty.valueOf().toString()}]})}async decreaseOperatorStake(t,r){let{tags:h=[]}=r||{};return this.process.send({signer:this.signer,tags:[...h,{name:"Action",value:"Decrease-Operator-Stake"},{name:"Quantity",value:t.decreaseQty.valueOf().toString()}]})}async saveObservations(t,r){let{tags:h=[]}=r||{};return this.process.send({signer:this.signer,tags:[...h,{name:"Action",value:"Save-Observations"},{name:"Report-Tx-Id",value:t.reportTxId},{name:"Failed-Gateways",value:t.failedGateways.join(",")}],data:{reportTxId:t.reportTxId,failedGateways:t.failedGateways}})}async buyRecord(t,r){let{tags:h=[]}=r||{},l=[...h,{name:"Action",value:"Buy-Record"},{name:"Name",value:t.name},{name:"Years",value:t.years?.toString()??"1"},{name:"Process-Id",value:t.processId},{name:"Purchase-Type",value:t.type||"lease"}].filter(c=>c.value!==void 0);return this.process.send({signer:this.signer,tags:l})}async extendLease(t,r){let{tags:h=[]}=r||{};return this.process.send({signer:this.signer,tags:[...h,{name:"Action",value:"Extend-Lease"},{name:"Name",value:t.name},{name:"Years",value:t.years.toString()}]})}async increaseUndernameLimit(t,r){let{tags:h=[]}=r||{};return this.process.send({signer:this.signer,tags:[...h,{name:"Action",value:"Increase-Undername-Limit"},{name:"Name",value:t.name},{name:"Quantity",value:t.increaseCount.toString()}]})}};var pHt=async({address:i,contract:t=Am.init({processId:Od})})=>{let r=X9(50),h=await t.getArNSRecords().then(l=>Object.values(l).filter(c=>c.processId!==void 0).map(c=>c.processId)),o=await Promise.all(h.map(async l=>r(async()=>{let c=j2.init({processId:l}),{Owner:p,Controllers:w}=await c.getState();if(p===i||w.includes(i))return l})));return o.length===0?[]:[...new Set(o)]};function Oet(i,t){return new Promise((r,h)=>{let o=setTimeout(()=>{h(new Error("Timeout"))},i);t.then(l=>{clearTimeout(o),r(l)}).catch(l=>{clearTimeout(o),h(l)})})}var Cet=class extends Pet.default{contract;timeoutMs;throttle;constructor({contract:t=Am.init({processId:Od}),timeoutMs:r=6e4,concurrency:h=30}){super(),this.contract=t,this.timeoutMs=r,this.throttle=X9(h)}async fetchProcessesOwnedByWallet({address:t}){let r={};await Oet(this.timeoutMs,this.contract.getArNSRecords().catch(o=>(this.emit("error",`Error getting ArNS records: ${o}`),{}))).then(o=>{o&&Object.entries(o).forEach(([l,c])=>{c.processId!==void 0&&(r[c.processId]===void 0&&(r[c.processId]={state:void 0,names:{}}),r[c.processId].names[l]=c)})});let h=Object.keys(r).length;this.emit("progress",0,h),await Promise.all(Object.keys(r).map(async(o,l)=>this.throttle(async()=>{if(r[o].state!==void 0){this.emit("progress",l+1,h);return}let c=j2.init({processId:o}),p=await Oet(this.timeoutMs,c.getState()).catch(w=>{this.emit("error",`Error getting state for process ${o}: ${w}`)});(p?.Owner===t||p?.Controllers.includes(t))&&(r[o].state=p,this.emit("process",o,r[o])),this.emit("progress",l+1,h)}))),this.emit("end",r)}};Tt();Rt();xt();Tt();Rt();xt();var Net=sc(lR(),1),S8=Net.default.init({host:"arweave.net",port:443,protocol:"https"});async function CHt({signer:i,module:t=xL,luaCodeTxId:r=RL,ao:h=Sm(),scheduler:o=kL,state:l,stateContractTxId:c}){let p=await S8.transactions.getData(r,{decode:!0,string:!0}),w=await h.spawn({module:t,scheduler:o,signer:await Ys.createAoSigner(i)}),m=new Ys({processId:w,ao:h});return await m.send({tags:[{name:"Action",value:"Eval"},{name:"App-Name",value:"ArNS-ANT"},{name:"Source-Code-TX-ID",value:r}],data:p,signer:i}),l&&await m.send({tags:[{name:"Action",value:"Initialize-State"},...c!==void 0?[{name:"State-Contract-TX-ID",value:c}]:[]],data:JSON.stringify(l),signer:i}),w}var E8=class{axios;logger;constructor({url:t,logger:r=new pa}){this.logger=r,this.axios=oF({axiosConfig:{baseURL:t},logger:this.logger})}async get({endpoint:t,signal:r,allowedStatuses:h=[200,202],headers:o,params:l}){this.logger.debug(`Get request to endpoint: ${t} with params ${JSON.stringify(l,void 0,2)}`);let{status:c,statusText:p,data:w}=await this.axios.get(t,{headers:o,signal:r,params:l});if(this.logger.debug(`Response status: ${c} ${p}`),!h.includes(c))switch(c){case 404:throw new O6(p);case 400:throw new Hl(c,p);default:throw new C6(p)}return w}};var Gl=class{logger;http;contractTxId;cacheUrl;constructor({cacheUrl:t="https://api.arns.app",contractTxId:r,logger:h=new pa}){this.cacheUrl=t,this.contractTxId=r,this.logger=h,this.http=new E8({url:`${t}/v1/contract/${r}`})}configuration(){return{contractTxId:this.contractTxId,cacheUrl:this.cacheUrl}}async getState({evaluationOptions:t}={}){this.logger.debug("Fetching contract state",{contractTxId:this.contractTxId,evaluationOptions:t});let{state:r}=await this.http.get({endpoint:"",params:{...t?.evalTo}});return r}async readInteraction({functionName:t,inputs:r,evaluationOptions:h}){this.logger.debug("Evaluating read interaction on contract",{functionName:t,inputs:r,evaluationOptions:h});let{result:o}=await this.http.get({endpoint:`/read/${t}`,params:{...h?.evalTo,...r}});return o}};var Let=class{static createWriteableContract(t){if(!t||Object.keys(t).length===0)return new ga({contractTxId:Sy});if(Yf(t))return t.contract instanceof ga?t.contract:new ga(t.contract.configuration());if(Qf(t))return new ga({contractTxId:t.contractTxId});throw new No}static init(t){if(t&&t.signer!==void 0){let{signer:r,...h}=t,o=this.createWriteableContract(h);return new hk({signer:r,contract:o})}else return new A8(t)}},A8=class{contract;constructor(t){if(!t||t===void 0)this.contract=new Gl({contractTxId:Sy});else if(Yf(t))this.contract=t.contract;else if(Qf(t))this.contract=new Gl({contractTxId:t.contractTxId});else throw new No}async getState(t={}){return await this.contract.getState(t)}async getArNSRecord({domain:t,evaluationOptions:r}){return(await this.getArNSRecords({evaluationOptions:r}))[t]}async getArNSRecords({evaluationOptions:t}={}){return(await this.contract.getState({evaluationOptions:t})).records}async getArNSReservedNames({evaluationOptions:t}={}){return(await this.contract.getState({evaluationOptions:t})).reserved}async getArNSReservedName({domain:t,evaluationOptions:r}){return(await this.getArNSReservedNames({evaluationOptions:r}))[t]}async getBalance({address:t,evaluationOptions:r}){return(await this.getBalances({evaluationOptions:r}))[t]||0}async getBalances({evaluationOptions:t}={}){return(await this.contract.getState({evaluationOptions:t})).balances}async getGateway({address:t,evaluationOptions:r}){return this.contract.readInteraction({functionName:ho.GATEWAY,inputs:{target:t},evaluationOptions:r}).catch(()=>{})}async getGateways({evaluationOptions:t}={}){return this.contract.readInteraction({functionName:ho.GATEWAYS,evaluationOptions:t})}async getCurrentEpoch({evaluationOptions:t}={}){return this.contract.readInteraction({functionName:ho.EPOCH,evaluationOptions:t})}async getEpoch({blockHeight:t,evaluationOptions:r}){return this.contract.readInteraction({functionName:ho.EPOCH,inputs:{height:t},evaluationOptions:r})}async getPrescribedObservers({evaluationOptions:t}={}){return this.contract.readInteraction({functionName:ho.PRESCRIBED_OBSERVERS,evaluationOptions:t})}async getObservations({evaluationOptions:t}={}){let{observations:r}=await this.contract.getState({evaluationOptions:t});return r}async getDistributions({evaluationOptions:t}={}){let{distributions:r}=await this.contract.getState({evaluationOptions:t});return r}async getAuction({domain:t,type:r,evaluationOptions:h}){return this.contract.readInteraction({functionName:ho.AUCTION,inputs:{name:t,type:r},evaluationOptions:h})}async getAuctions({evaluationOptions:t}={}){let{auctions:r}=await this.contract.getState({evaluationOptions:t});return r}async getPriceForInteraction({interactionName:t,payload:r,evaluationOptions:h}){let{price:o}=await this.contract.readInteraction({functionName:ho.PRICE_FOR_INTERACTION,inputs:{interactionName:t,...r},evaluationOptions:h});return o}},hk=class extends A8{signer;constructor({signer:t,...r}){if(Object.keys(r).length===0)super({contract:new ga({contractTxId:Sy})}),this.signer=t;else if(Yf(r))super({contract:r.contract}),this.signer=t;else if(Qf(r))super({contract:new ga({contractTxId:r.contractTxId})}),this.signer=t;else throw new No}async transfer({target:t,qty:r,denomination:h="IO"},o){let l=r;return h==="IO"&&typeof r=="number"&&(l=new r2(r).toMIO()),this.contract.writeInteraction({functionName:ho.TRANSFER,inputs:{target:t,qty:l.valueOf()},signer:this.signer},o)}async joinNetwork({qty:t,allowDelegatedStaking:r,delegateRewardShareRatio:h,fqdn:o,label:l,minDelegatedStake:c,note:p,port:w,properties:m,protocol:y,autoStake:v,observerWallet:M},T){return this.contract.writeInteraction({functionName:ho.JOIN_NETWORK,inputs:{qty:t.valueOf(),allowDelegatedStaking:r,delegateRewardShareRatio:h,fqdn:o,label:l,minDelegatedStake:c.valueOf(),note:p,port:w,properties:m,protocol:y,autoStake:v,observerWallet:M},signer:this.signer},T)}async updateGatewaySettings({allowDelegatedStaking:t,delegateRewardShareRatio:r,fqdn:h,label:o,minDelegatedStake:l,note:c,port:p,properties:w,protocol:m,autoStake:y,observerWallet:v},M){return this.contract.writeInteraction({functionName:ho.UPDATE_GATEWAY_SETTINGS,inputs:{allowDelegatedStaking:t,delegateRewardShareRatio:r,fqdn:h,label:o,minDelegatedStake:l?.valueOf(),note:c,port:p,properties:w,protocol:m,autoStake:y,observerWallet:v},signer:this.signer},M)}async increaseDelegateStake(t,r){return this.contract.writeInteraction({functionName:ho.DELEGATE_STAKE,inputs:{target:t.target,qty:t.qty.valueOf()},signer:this.signer},r)}async decreaseDelegateStake(t,r){return this.contract.writeInteraction({functionName:ho.DECREASE_DELEGATE_STAKE,inputs:{target:t.target,qty:t.qty.valueOf()},signer:this.signer},r)}async increaseOperatorStake(t,r){return this.contract.writeInteraction({functionName:ho.INCREASE_OPERATOR_STAKE,inputs:{qty:t.qty.valueOf()},signer:this.signer},r)}async decreaseOperatorStake(t,r){return this.contract.writeInteraction({functionName:ho.DECREASE_OPERATOR_STAKE,inputs:{qty:t.qty.valueOf()},signer:this.signer},r)}async saveObservations(t,r){return this.contract.writeInteraction({functionName:ho.SAVE_OBSERVATIONS,inputs:{observerReportTxId:t.reportTxId,failedGateways:t.failedGateways},signer:this.signer},r)}async extendLease(t,r){return this.contract.writeInteraction({functionName:ho.EXTEND_RECORD,inputs:{name:t.domain,years:t.years},signer:this.signer},r)}async increaseUndernameLimit(t,r){return this.contract.writeInteraction({functionName:ho.INCREASE_UNDERNAME_COUNT,inputs:{name:t.domain,qty:t.qty},signer:this.signer},r)}};Tt();Rt();xt();Tt();Rt();xt();var or=sc(Zot(),1);var Nie=or.default.AbortError,Lie=or.default.AbstractContractHandler,Die=or.default.ArweaveContractDefinitionLoader,$ie=or.default.ArweaveGatewayBundledContractDefinitionLoader,Uie=or.default.ArweaveGatewayBundledInteractionLoader,qie=or.default.ArweaveGatewayInteractionsLoader,Fie=or.default.ArweaveWrapper,jie=or.default.Benchmark,zie=or.default.CacheKey,Wie=or.default.CacheableInteractionsLoader,Kie=or.default.CacheableStateEvaluator,Hie=or.default.ConsoleLogger,Gie=or.default.ConsoleLoggerFactory,Vie=or.default.ContractCache,Zie=or.default.ContractCallRecord,Jie=or.default.ContractError,Xie=or.default.ContractInteractionState,Yie=or.default.ContractMetadata,Qie=or.default.CustomEvent,tne=or.default.DEFAULT_LEVEL_DB_LOCATION,ene=or.default.DefaultEvaluationOptions,rne=or.default.DefaultStateEvaluator,ine=or.default.EvalStateResult,nne=or.default.EvaluationOptionsEvaluator,one=or.default.HandlerBasedContract,ane=or.default.HandlerExecutorFactory,sne=or.default.InnerWritesEvaluator,hne=or.default.InteractionCall,fne=or.default.InteractionCompleteEvent,une=or.default.InteractionInput,cne=or.default.InteractionOutput,lne=or.default.JsHandlerApi,dne=or.default.KV,pne=or.default.KnownErrors,gne=or.default.LevelDbCache,mne=or.default.LexicographicalInteractionsSorter,vne=or.default.LogLevelOrder,Jot=or.default.LoggerFactory,yne=or.default.MemCache,bne=or.default.NetworkCommunicationError,wne=or.default.NonWhitelistedSourceError,_ne=or.default.PstContractImpl,Mne=or.default.REGISTER_PROVIDER,Sne=or.default.SMART_WEAVE_TAGS,Ene=or.default.SUPPORTED_SRC_CONTENT_TYPES,Ane=or.default.SWBlock,Tne=or.default.SWTransaction,xne=or.default.SWVrf,Xot=or.default.Signature,Rne=or.default.SmartWeaveError,kne=or.default.SmartWeaveErrorType,Ine=or.default.SmartWeaveGlobal,Bne=or.default.SortKeyCacheResult,One=or.default.SourceType,Cne=or.default.SrcCache,Yot=or.default.Tag,Pne=or.default.TagsParser,Nne=or.default.Transaction,Lne=or.default.WARP_GW_URL,Dne=or.default.WARP_TAGS,$ne=or.default.Warp,Une=or.default.WarpBuilder,Qot=or.default.WarpFactory,qne=or.default.WarpFetchWrapper,Fne=or.default.WarpGatewayContractDefinitionLoader,jne=or.default.WarpGatewayInteractionsLoader,zne=or.default.WasmHandlerApi,Wne=or.default.WasmSrc,Kne=or.default.arrayToHex,Hne=or.default.asc,Gne=or.default.ascS,Vne=or.default.bufToBn,Zne=or.default.bundledTxsFilter,Jne=or.default.checkJsSrc,Xne=or.default.createDummyTx,Yne=or.default.createInteractionTagsList,Qne=or.default.createInteractionTx,toe=or.default.deepCopy,eoe=or.default.defaultArweaveMs,tat=or.default.defaultCacheOptions,roe=or.default.defaultWarpGwOptions,ioe=or.default.desc,noe=or.default.descS,ooe=or.default.emptyTransfer,aoe=or.default.genesisSortKey,soe=or.default.getJsonResponse,hoe=or.default.indent,foe=or.default.isBrowser,uoe=or.default.isTxIdValid,coe=or.default.knownWarpPlugins,loe=or.default.knownWarpPluginsPartial,doe=or.default.lastPossibleSortKey,poe=or.default.lvlToOrder,goe=or.default.mapReplacer,moe=or.default.mapReviver,voe=or.default.matchMutClosureDtor,yoe=or.default.normalizeContractSource,boe=or.default.rustWasmImports,woe=or.default.safeGet,_oe=or.default.safeParseInt,Moe=or.default.sleep,Soe=or.default.sortingFirst,Eoe=or.default.sortingLast,Aoe=or.default.stripTrailingSlash,Toe=or.default.timeout;Tt();Rt();xt();qx();var fkt="+",ukt="/",ckt="-",lkt="_",dkt="=";function pkt(i){return i.replaceAll(fkt,ckt).replaceAll(ukt,lkt).replaceAll(dkt,"")}function wv(i){let t=i.toString("base64");return pkt(t)}function eat(i){return wv(Ux("sha256").update(i).digest())}Tt();Rt();xt();var rat=Qot.forMainnet({...tat,inMemory:!0},!0,S8);Jot.INST.logLevel("error");var ga=class{contract;contractTxId;cacheUrl;logger;warp;constructor({contractTxId:t,cacheUrl:r="https://api.arns.app",warp:h=rat,logger:o=new pa({level:"info"})}){this.contractTxId=t,this.contract=h.contract(t),this.cacheUrl=r,this.warp=h,this.logger=o}configuration(){return{contractTxId:this.contractTxId,cacheUrl:this.cacheUrl}}async createWarpSigner(t){return t.publicKey===void 0&&"setPublicKey"in t&&await t.setPublicKey(),new Xot(this.warp,{signer:async h=>{h.setOwner(wv(t.publicKey));let o=await h.getSignatureData(),l=await t.sign(o),c=ge.from(l),p=eat(c);h.setSignature({id:p,owner:wv(t.publicKey),signature:wv(c)})},type:"arweave"})}async getState({evaluationOptions:t={}}){await this.ensureContractInit();let r=t?.evalTo,h;r&&"sortKey"in r?h=r.sortKey:r&&"blockHeight"in r&&(h=r.blockHeight);let o=await this.contract.readState(h);if(!o.cachedValue.state)throw new Hl(502,"Failed to evaluate contract state");return o.cachedValue.state}async ensureContractInit({signer:t}={}){this.logger.debug("Checking contract initialized",{contractTxId:this.contractTxId}),this.logger.debug("Fetching contract manifest",{contractTxId:this.contractTxId});let{evaluationOptions:r={}}=await BL({arweave:this.warp.arweave,contractTxId:this.contractTxId});this.contract.setEvaluationOptions(r),t&&this.contract.connect(await this.createWarpSigner(t)),this.cacheUrl!==void 0&&(this.logger.debug("Syncing contract state",{contractTxId:this.contractTxId,remoteCacheUrl:this.cacheUrl}),await this.contract.syncState(`${this.cacheUrl}/v1/contract/${this.contractTxId}`,{validity:!0}))}async readInteraction({functionName:t,inputs:r}){await this.ensureContractInit(),this.logger.debug(`Read interaction: ${t}`,{contractTxId:this.contractTxId,inputs:r});let h=await this.contract.viewState({function:t,...r});if(h.result===void 0)throw new Hl(502,"Failed to evaluate contract read interaction: "+JSON.stringify({error:h.errorMessage,functionName:t,inputs:r},null,2));return this.logger.debug("Successfully evaluated contract read interaction",{contractTxId:this.contractTxId,result:h.result}),h.result}async writeInteraction({functionName:t,inputs:r,signer:h},o){try{this.logger.debug(`Write interaction: ${t}`,{contractTxId:this.contractTxId}),await this.ensureContractInit({signer:h});let l=await this.contract.dryWrite({function:t,...r});if(l.type!=="ok")throw new Error(`Failed to dry write contract interaction ${t}: ${l.errorMessage}`);let c=await this.contract.writeInteraction({function:t,...r},{disableBundling:!0,tags:o?.tags?.map(p=>new Yot(p.name,p.value))});if(!c?.interactionTx)throw new Error(`Failed to write contract interaction: ${t}`);return this.logger.debug("Successfully wrote contract interaction",{contractTxId:this.contractTxId,interactionTxId:c.originalTxId}),c.interactionTx}catch(l){throw this.logger.error(`Failed to write contract interaction: ${l.message}`,{contractTxId:this.contractTxId}),new a1(l)}}};Tt();Rt();xt();var z2=class{process;constructor(t){if(Rl(t))this.process=t.process;else if(kl(t))this.process=new Ys({processId:t.processId});else throw new No}async getState(){let t=[{name:"Action",value:"State"}];return await this.process.read({tags:t})}async getInfo(){let t=[{name:"Action",value:"Info"}];return await this.process.read({tags:t})}async getRecord({undername:t}){let r=[{name:"Sub-Domain",value:t},{name:"Action",value:"Record"}];return await this.process.read({tags:r})}async getRecords(){let t=[{name:"Action",value:"Records"}];return await this.process.read({tags:t})}async getOwner(){return(await this.getInfo()).Owner}async getControllers(){let t=[{name:"Action",value:"Controllers"}];return await this.process.read({tags:t})}async getName(){return(await this.getInfo()).Name}async getTicker(){return(await this.getInfo()).Ticker}async getBalances(){let t=[{name:"Action",value:"Balances"}];return await this.process.read({tags:t})}async getBalance({address:t}){let r=[{name:"Action",value:"Balance"},{name:"Recipient",value:t}];return await this.process.read({tags:r})}},L6=class extends z2{signer;constructor({signer:t,...r}){super(r),this.signer=t}async transfer({target:t}){let r=[{name:"Action",value:"Transfer"},{name:"Recipient",value:t}];return this.process.send({tags:r,data:{},signer:this.signer})}async addController({controller:t}){let r=[{name:"Action",value:"Add-Controller"},{name:"Controller",value:t}];return this.process.send({tags:r,data:{},signer:this.signer})}async removeController({controller:t}){let r=[{name:"Action",value:"Remove-Controller"},{name:"Controller",value:t}];return this.process.send({tags:r,data:{},signer:this.signer})}async setRecord({undername:t,transactionId:r,ttlSeconds:h}){return this.process.send({tags:[{name:"Action",value:"Set-Record"},{name:"Sub-Domain",value:t},{name:"Transaction-Id",value:r},{name:"TTL-Seconds",value:h.toString()}],data:{transactionId:r,ttlSeconds:h},signer:this.signer})}async removeRecord({undername:t}){return this.process.send({tags:[{name:"Action",value:"Remove-Record"},{name:"Sub-Domain",value:t}],data:{undername:t},signer:this.signer})}async setTicker({ticker:t}){return this.process.send({tags:[{name:"Action",value:"Set-Ticker"},{name:"Ticker",value:t}],data:{ticker:t},signer:this.signer})}async setName({name:t}){return this.process.send({tags:[{name:"Action",value:"Set-Name"},{name:"Name",value:t}],data:{name:t},signer:this.signer})}};var export_ArconnectSigner=iat.ArconnectSigner;var export_ArweaveSigner=iat.ArweaveSigner;export{j2 as ANT,N6 as ANTReadable,Y9 as ANTWritable,cc as ANT_CONTRACT_FUNCTIONS,RL as ANT_LUA_ID,Ys as AOProcess,xL as AOS_MODULE_ID,Gkt as ARNS_DEVNET_REGISTRY_TX,Sy as ARNS_TESTNET_REGISTRY_TX,AL as ARWEAVE_TX_REGEX,ho as AR_IO_CONTRACT_FUNCTIONS,s1 as AbortError,z2 as AoANTReadable,L6 as AoANTWriteable,Let as ArIO,A8 as ArIOReadable,hk as ArIOWritable,Cet as ArNSEventEmitter,export_ArconnectSigner as ArconnectSigner,export_ArweaveSigner as ArweaveSigner,aF as BadRequest,wh as BaseError,kL as DEFAULT_SCHEDULER_ID,EL as DENOMINATIONS,pa as DefaultLogger,Hkt as FQDN_REGEX,Hl as FailedRequestError,Am as IO,M8 as IOReadable,r2 as IOToken,sk as IOWriteable,Ost as IO_DEVNET_PROCESS_ID,Vkt as IO_TESTNET_PROCESS_ID,No as InvalidContractConfigurationError,hF as InvalidProcessConfigurationError,sF as InvalidSignerError,h1 as MAX_REQUEST_SIZE,W5 as MIO_PER_IO,O6 as NotFound,Gl as RemoteContract,TL as SORT_KEY_REGEX,G5 as SmartWeaveSortKey,C6 as UnknownError,ga as WarpContract,a1 as WriteInteractionError,oF as createAxiosInstance,pHt as getANTProcessesOwnedByWallet,BL as getContractManifest,zqt as getContractsTransferredToOrControlledByWallet,Fqt as getSmartweaveContractsFromGQL,jqt as getSmartweaveTransactionsFromGQL,$kt as ioContractInteractions,Ist as ioContractReadInteractions,Bst as ioContractWriteInteractions,Od as ioDevnetProcessId,oIt as isBlockHeight,Yf as isContractConfiguration,Qf as isContractTxIdConfiguration,lIt as isLeasedArNSRecord,Rl as isProcessConfiguration,kl as isProcessIdConfiguration,RIt as isSortKey,aIt as isTransaction,H5 as mIOToken,ak as safeDecode,CHt as spawnANT,IL as tagsToObject,Ey as validateArweaveId};
|
|
379
|
+
}`,o=Xe.object({data:Xe.object({transactions:Xe.object({edges:Xe.array(Xe.object({node:Xe.record(Xe.any())}))})})});return l=>ci(l).chain(rn(c=>i(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:h,variables:{transactionIds:[c]}})}).then(async p=>{if(p.ok)return p.json();throw r('Error Encountered when querying gateway for transaction "%s"',c),new Error(`${p.status}: ${await p.text()}`)}).then(o.parse).then(w9t(["data","transactions","edges","0","node"])))).toPromise()}var x_t=$R(j4t(),1),pet=(i="@permaweb/aoconnect")=>{let t=(0,x_t.default)(i);return t.child=r=>pet(`${t.namespace}:${r}`),t.tap=(r,...h)=>x9t((...o)=>t(r,...h,...o)),t},get=({url:i,path:t})=>t?t.startsWith("/")?get({url:i,path:t.slice(1)}):(i=new URL(i),i.pathname+=t,i.toString()):i;function R_t(i){return ep(b8([]),tp((t,r)=>ep(S9t([],r.name),ZR(r.value),Js(r.name,Nu,t))(t),{}),v8(t=>t.length>1?t:t[0]))(i)}function Vs(i,t){return r=>qtt(B7t([ftt(i,"name"),XR(VR(t),ftt(t,"value"),KR)]),r)}function ltt(i){return Jtt([[rm(String),V1(i)],[rm(Array),u9t(i)],[KR,q5t]])}function $0(i){let t;return rm(Zs,i)?(t=new Error(k_t(i)),t.stack+=i.stack):rm(Error,i)?t=i:s9t("message",i)?t=new Error(i.message):rm(String,i)?t=new Error(i):t=new Error("An error occurred"),t}function k_t(i){return ep(t=>function r(h,o,l){return tp((c,p)=>ep(Jtt([[V1(vr.invalid_arguments),()=>r(p.argumentsError,422,"Invalid Arguments")],[V1(vr.invalid_return_type),()=>r(p.returnTypeError,500,"Invalid Return")],[V1(vr.invalid_union),()=>G7t(w=>r(w,400,"Invalid Union"),p.unionErrors)],[KR,()=>[{...p,status:o,contextCode:l}]]]),JR(c))(p.code),[],h.issues)}(t,400,""),t=>tp((r,h)=>{let{message:o,path:l,contextCode:c}=h,p=l[1]||l[0],w=c?`${c} `:"";return r.push(`${w}'${p}': ${o}.`),r},[],t),m9t(" | "))(i)}var I_t=Xe.object({id:Xe.string().min(1,{message:"message is required to be a message id"}),processId:Xe.string().min(1,{message:"process is required to be a process id"})});function B_t(){return i=>ci(i).map(I_t.parse).map(()=>i)}var Mm=Xe.object({name:Xe.string(),value:Xe.string()}),O_t=Xe.function().args(Xe.object({Id:Xe.string(),Target:Xe.string(),Owner:Xe.string(),Anchor:Xe.string().optional(),Data:Xe.any().default("1234"),Tags:Xe.array(Xe.object({name:Xe.string(),value:Xe.string()}))})).returns(Xe.promise(Xe.any())),C_t=Xe.function().args(Xe.object({id:Xe.string().min(1,{message:"message id is required"}),processId:Xe.string().min(1,{message:"process id is required"})})).returns(Xe.promise(Xe.any())),P_t=Xe.function().args(Xe.object({process:Xe.string().min(1,{message:"process id is required"}),from:Xe.string().optional(),to:Xe.string().optional(),sort:Xe.enum(["ASC","DESC"]).default("ASC"),limit:Xe.number().optional()})).returns(Xe.promise(Xe.object({edges:Xe.array(Xe.object({cursor:Xe.string(),node:Xe.object({Output:Xe.any().optional(),Messages:Xe.array(Xe.any()).optional(),Spawns:Xe.array(Xe.any()).optional(),Error:Xe.any().optional()})}))}))),met=Xe.function().args(Xe.object({processId:Xe.string(),data:Xe.any(),tags:Xe.array(Mm),anchor:Xe.string().optional(),signer:Xe.any()})).returns(Xe.promise(Xe.object({messageId:Xe.string()}).passthrough())),N_t=Xe.function().args(Xe.object({data:Xe.any(),tags:Xe.array(Mm),signer:Xe.any()})).returns(Xe.promise(Xe.object({processId:Xe.string()}).passthrough())),L_t=Xe.function().args(Xe.object({process:Xe.string(),message:Xe.string(),baseLayer:Xe.boolean().optional(),exclude:Xe.array(Xe.string()).optional()})).returns(Xe.promise(Xe.object({assignmentId:Xe.string()}).passthrough())),vet=met,LWt=Xe.function().args(Xe.object({suUrl:Xe.string().url(),processId:Xe.string()})).returns(Xe.promise(Xe.object({tags:Xe.array(Mm)}).passthrough())),DWt=Xe.function().args(Xe.string()).returns(Xe.promise(Xe.object({url:Xe.string()}))),D_t=Xe.function().args(Xe.string()).returns(Xe.promise(Xe.boolean())),$_t=Xe.function().args(Xe.string()).returns(Xe.promise(Xe.object({tags:Xe.array(Mm)}).passthrough())),w8=Xe.function().args(Xe.object({data:Xe.any(),tags:Xe.array(Mm),target:Xe.string().optional(),anchor:Xe.string().optional()})).returns(Xe.promise(Xe.object({id:Xe.string(),raw:Xe.any()})));function U_t({loadResult:i}){return i=rn(C_t.implement(i)),t=>ci({id:t.id,processId:t.processId}).chain(i)}function q_t(i){let t=B_t(i),r=U_t(i);return({message:h,process:o})=>ci({id:h,processId:o}).chain(t).chain(r).map(i.logger.tap('readResult result for message "%s": %O',h)).map(l=>l).bimap($0,D0).toPromise()}var F_t=Xe.array(Xe.object({name:Xe.string(),value:Xe.string()}));function j_t(){return i=>ci(i.tags).map(b8([])).map(Vs("Data-Protocol","ao")).map(Vs("Variant")).map(Vs("Type")).map(Vs("SDK")).map(JR(Nu,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Message"},{name:"SDK",value:"aoconnect"}])).map(F_t.parse).map(Js("tags",Nu,i))}function z_t({logger:i}){return t=>ci(t).chain(XR(VR(t.data),()=>O0(t),()=>O0(Math.random().toString().slice(-4)).map(Js("data",Nu,t)).map(r=>ep(L0("tags"),Vs("Content-Type"),ZR({name:"Content-Type",value:"text/plain"}),Js("tags",Nu,r))(r)).map(i.tap('added pseudo-random string as message "data"'))))}function W_t(i){let t=j_t(i),r=z_t(i),h=met.implement(i.deployMessage);return o=>ci(o).chain(t).chain(r).chain(rn(({id:l,data:c,tags:p,anchor:w,signer:m})=>h({processId:l,data:c,tags:p,anchor:w,signer:w8.implement(m)}))).map(l=>Js("messageId",l.messageId,o))}function K_t(i){let t=W_t(i);return({process:r,data:h,tags:o,anchor:l,signer:c})=>ci({id:r,data:h,tags:o,anchor:l,signer:c}).chain(t).map(p=>p.messageId).bimap($0,D0).toPromise()}var Xg=(i,t,r)=>h=>t(h[i])?O0(h):tl(`Tag '${i}': ${r}`);function H_t({loadTransactionMeta:i,logger:t}){return i=rn($_t.implement(i)),r=>ci(r).chain(i).map(L0("tags")).map(R_t).chain(Xg("Data-Protocol",ltt("ao"),"value 'ao' was not found on module")).chain(Xg("Type",ltt("Module"),"value 'Module' was not found on module")).chain(Xg("Module-Format",yR,"was not found on module")).chain(Xg("Input-Encoding",yR,"was not found on module")).chain(Xg("Output-Encoding",yR,"was not found on module")).bimap(t.tap("Verifying module source failed: %s"),t.tap("Verified module source"))}function G_t({logger:i,validateScheduler:t}){return t=rn(D_t.implement(t)),r=>ci(r).chain(h=>t(h).chain(o=>o?O0(h):tl(`Valid Scheduler-Location owned by ${h} not found`))).bimap(i.tap("Verifying scheduler failed: %s"),i.tap("Verified scheduler"))}function V_t({logger:i}){return t=>ci(t).map(i.tap("Checking for signer")).chain(r=>r?O0(r):tl("signer not found"))}function Z_t(i){let t=i.logger.child("verifyInput");i={...i,logger:t};let r=H_t(i),h=G_t(i),o=V_t(i);return l=>ci(l).chain(c=>r(c.module).map(()=>c)).chain(c=>h(c.scheduler)).map(()=>l).chain(c=>o(c.signer).map(()=>c)).bimap(t.tap("Error when verify input: %s"),t.tap("Successfully verified inputs"))}var J_t=Xe.array(Xe.object({name:Xe.string(),value:Xe.string()}));function X_t(){return i=>ci(i).map(L0("tags")).map(b8([])).map(Vs("Data-Protocol","ao")).map(Vs("Variant")).map(Vs("Type")).map(Vs("Module")).map(Vs("Scheduler")).map(Vs("SDK")).map(JR(Nu,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Process"},{name:"Module",value:i.module},{name:"Scheduler",value:i.scheduler},{name:"SDK",value:"aoconnect"}])).map(J_t.parse).map(Js("tags",Nu,i))}function Y_t({logger:i}){return t=>ci(t).chain(XR(VR(t.data),()=>O0(t),()=>O0(Math.random().toString().slice(-4)).map(Js("data",Nu,t)).map(r=>ep(L0("tags"),Vs("Content-Type"),ZR({name:"Content-Type",value:"text/plain"}),Js("tags",Nu,r))(r)).map(i.tap('added pseudo-random string as process "data"'))))}function Q_t(i){let t=i.logger.child("uploadProcess");i={...i,logger:t};let r=X_t(i),h=Y_t(i),o=N_t.implement(i.deployProcess);return l=>ci(l).chain(r).chain(h).chain(rn(({data:c,tags:p,signer:w})=>o({data:c,tags:p,signer:w8.implement(w)}))).map(c=>Js("processId",c.processId,l))}function tMt(i){let t=Z_t(i),r=Q_t(i);return({module:h,scheduler:o,signer:l,tags:c,data:p})=>ci({module:h,scheduler:o,signer:l,tags:c,data:p}).chain(t).chain(r).map(w=>w.processId).bimap($0,D0).toPromise()}function eMt(i){let t=vet.implement(i.deployMonitor);return r=>ci(r).chain(rn(({id:h,signer:o})=>t({processId:h,signer:w8.implement(o),data:Math.random().toString().slice(-4),tags:[]}))).map(h=>Js("monitorId",h.messageId,r))}function rMt(i){let t=eMt(i);return({process:r,signer:h})=>ci({id:r,signer:h}).chain(t).map(o=>o.monitorId).bimap($0,D0).toPromise()}function iMt(i){let t=vet.implement(i.deployUnmonitor);return r=>ci(r).chain(rn(({id:h,signer:o})=>t({processId:h,signer:w8.implement(o),data:Math.random().toString().slice(-4),tags:[]}))).map(h=>Js("monitorId",h.messageId,r))}function nMt(i){let t=iMt(i);return({process:r,signer:h})=>ci({id:r,signer:h}).chain(t).map(o=>o.monitorId).bimap($0,D0).toPromise()}var oMt=Xe.object({process:Xe.string().min(1,{message:"process identifier is required"}),from:Xe.string().optional(),to:Xe.string().optional(),sort:Xe.enum(["ASC","DESC"]).default("ASC"),limit:Xe.number().optional()});function aMt(){return i=>ci(i).map(oMt.parse).map(()=>i)}function sMt({queryResults:i}){return i=rn(P_t.implement(i)),t=>ci({process:t.process,from:t.from,to:t.to,sort:t.sort,limit:t.limit}).chain(i)}function hMt(i){let t=aMt(i),r=sMt(i);return({process:h,from:o,to:l,sort:c,limit:p})=>ci({process:h,from:o,to:l,sort:c,limit:p}).chain(t).chain(r).map(i.logger.tap('readResults result for message "%s": %O',h)).map(w=>w).bimap($0,D0).toPromise()}var fMt=Xe.object({Id:Xe.string(),Target:Xe.string(),Owner:Xe.string(),Anchor:Xe.string().optional(),Data:Xe.any().default("1234"),Tags:Xe.array(Xe.object({name:Xe.string(),value:Xe.string()}))});function uMt(){return i=>ci(i).map(fMt.parse).map(t=>(t.Tags=t.Tags.concat([{name:"Data-Protocol",value:"ao"},{name:"Type",value:"Message"},{name:"Variant",value:"ao.TN.1"}]),t))}function cMt({dryrunFetch:i}){return rn(O_t.implement(i))}function lMt(i){let t=uMt(i),r=cMt(i);return h=>ci(h).map(dMt).chain(t).chain(r).toPromise()}function dMt({process:i,data:t,tags:r,anchor:h,...o}){return{Id:"1234",Owner:"1234",...o,Target:i,Data:t||"1234",Tags:r||[],Anchor:h||"0"}}function pMt(i){let t=L_t.implement(i.deployAssign);return r=>ci(r).chain(rn(({process:h,message:o,baseLayer:l,exclude:c})=>t({process:h,message:o,baseLayer:l,exclude:c}))).map(h=>Js("assignmentId",h.assignmentId,r))}function gMt(i){let t=pMt(i);return({process:r,message:h,baseLayer:o,exclude:l})=>ci({process:r,message:h,baseLayer:o,exclude:l}).chain(t).map(c=>c.assignmentId).bimap($0,D0).toPromise()}var mMt="https://arweave.net",vMt="https://mu.ao-testnet.xyz",yMt="https://cu.ao-testnet.xyz";function Sm({GRAPHQL_URL:i,GATEWAY_URL:t=mMt,MU_URL:r=vMt,CU_URL:h=yMt}={}){let o=pet();i||(i=get({url:t,path:"/graphql"}));let{validate:l}=Ltt({cacheSize:100,GRAPHQL_URL:i}),c=$5t({MAX_SIZE:25}),p=o.child("result"),w=q_t({loadResult:N5t({fetch,CU_URL:h,logger:p}),logger:p}),m=o.child("message"),y=K_t({loadProcessMeta:gR({fetch,cache:c,logger:m}),deployMessage:k5t({fetch,MU_URL:r,logger:m}),logger:m}),v=o.child("spawn"),M=tMt({loadTransactionMeta:T_t({fetch,GRAPHQL_URL:i,logger:v}),validateScheduler:l,deployProcess:I5t({fetch,MU_URL:r,logger:v}),logger:v}),T=o.child("monitor"),A=rMt({loadProcessMeta:gR({fetch,cache:c,logger:T}),deployMonitor:B5t({fetch,MU_URL:r,logger:T}),logger:T}),R=o.child("unmonitor"),B=nMt({loadProcessMeta:gR({fetch,cache:c,logger:R}),deployUnmonitor:O5t({fetch,MU_URL:r,logger:R}),logger:T}),C=o.child("results"),P=hMt({queryResults:L5t({fetch,CU_URL:h,logger:C}),logger:C}),N=o.child("dryrun"),q=lMt({dryrunFetch:P5t({fetch,CU_URL:h,logger:N}),logger:N}),W=o.child("assign"),J=gMt({deployAssign:C5t({fetch,MU_URL:r,logger:W}),logger:m});return{result:w,results:P,message:y,spawn:M,monitor:A,unmonitor:B,dryrun:q,assign:J}}var yet={};gtt(yet,{createDataItemSigner:()=>zMt});var bet=$R(K4t(),1),wet={};gtt(wet,{AVSCTap:()=>Em,ArweaveSigner:()=>ek,DataItem:()=>ym,MAX_TAG_BYTES:()=>_8,MIN_BINARY_SIZE:()=>nk,SIG_CONFIG:()=>op,SignatureConfig:()=>Gs,Signer:()=>Aet,createData:()=>ket,default:()=>qMt,deserializeTags:()=>l8,indexToType:()=>rk,serializeTags:()=>ik,tagsExceedLimit:()=>Ret,warparbundles:()=>FMt});var bMt=Object.create,QR=Object.defineProperty,wMt=Object.getOwnPropertyDescriptor,_Mt=Object.getOwnPropertyNames,MMt=Object.getPrototypeOf,SMt=Object.prototype.hasOwnProperty,Du=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),EMt=(i,t)=>{for(var r in t)QR(i,r,{get:t[r],enumerable:!0})},AMt=(i,t,r,h)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _Mt(t))!SMt.call(i,o)&&o!==r&&QR(i,o,{get:()=>t[o],enumerable:!(h=wMt(t,o))||h.enumerable});return i},U0=(i,t,r)=>(r=i!=null?bMt(MMt(i)):{},AMt(t||!i||!i.__esModule?QR(r,"default",{value:i,enumerable:!0}):r,i)),TMt=Du(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});function t(r){var h=4,o=r.length,l=o%h;if(!l)return r;var c=o,p=h-l,w=o+p,m=ge.alloc(w);for(m.write(r);p--;)m.write("=",c++);return m.toString()}i.default=t}),xMt=Du(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});var t=TMt();function r(w,m){return m===void 0&&(m="utf8"),ge.isBuffer(w)?l(w.toString("base64")):l(ge.from(w,m).toString("base64"))}function h(w,m){return m===void 0&&(m="utf8"),ge.from(o(w),"base64").toString(m)}function o(w){return w=w.toString(),t.default(w).replace(/\-/g,"+").replace(/_/g,"/")}function l(w){return w.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function c(w){return ge.from(o(w),"base64")}var p=r;p.encode=r,p.decode=h,p.toBase64=o,p.fromBase64=l,p.toBuffer=c,i.default=p}),tk=Du((i,t)=>{t.exports=xMt().default,t.exports.default=t.exports}),_et=Du(i=>{"use strict";i.byteLength=w,i.toByteArray=y,i.fromByteArray=T;var t=[],r=[],h=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(l=0,c=o.length;l<c;++l)t[l]=o[l],r[o.charCodeAt(l)]=l;var l,c;r[45]=62,r[95]=63;function p(A){var R=A.length;if(R%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var B=A.indexOf("=");B===-1&&(B=R);var C=B===R?0:4-B%4;return[B,C]}function w(A){var R=p(A),B=R[0],C=R[1];return(B+C)*3/4-C}function m(A,R,B){return(R+B)*3/4-B}function y(A){var R,B=p(A),C=B[0],P=B[1],N=new h(m(A,C,P)),q=0,W=P>0?C-4:C,J;for(J=0;J<W;J+=4)R=r[A.charCodeAt(J)]<<18|r[A.charCodeAt(J+1)]<<12|r[A.charCodeAt(J+2)]<<6|r[A.charCodeAt(J+3)],N[q++]=R>>16&255,N[q++]=R>>8&255,N[q++]=R&255;return P===2&&(R=r[A.charCodeAt(J)]<<2|r[A.charCodeAt(J+1)]>>4,N[q++]=R&255),P===1&&(R=r[A.charCodeAt(J)]<<10|r[A.charCodeAt(J+1)]<<4|r[A.charCodeAt(J+2)]>>2,N[q++]=R>>8&255,N[q++]=R&255),N}function v(A){return t[A>>18&63]+t[A>>12&63]+t[A>>6&63]+t[A&63]}function M(A,R,B){for(var C,P=[],N=R;N<B;N+=3)C=(A[N]<<16&16711680)+(A[N+1]<<8&65280)+(A[N+2]&255),P.push(v(C));return P.join("")}function T(A){for(var R,B=A.length,C=B%3,P=[],N=16383,q=0,W=B-C;q<W;q+=N)P.push(M(A,q,q+N>W?W:q+N));return C===1?(R=A[B-1],P.push(t[R>>2]+t[R<<4&63]+"==")):C===2&&(R=(A[B-2]<<8)+A[B-1],P.push(t[R>>10]+t[R>>4&63]+t[R<<2&63]+"=")),P.join("")}}),Met=Du(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.b64UrlDecode=i.b64UrlEncode=i.bufferTob64Url=i.bufferTob64=i.b64UrlToBuffer=i.stringToB64Url=i.stringToBuffer=i.bufferToString=i.b64UrlToString=i.concatBuffers=void 0;var t=_et();function r(M){let T=0;for(let B=0;B<M.length;B++)T+=M[B].byteLength;let A=new Uint8Array(T),R=0;A.set(new Uint8Array(M[0]),R),R+=M[0].byteLength;for(let B=1;B<M.length;B++)A.set(new Uint8Array(M[B]),R),R+=M[B].byteLength;return A}i.concatBuffers=r;function h(M){let T=p(M);return o(T)}i.b64UrlToString=h;function o(M){return new TextDecoder("utf-8",{fatal:!0}).decode(M)}i.bufferToString=o;function l(M){return new TextEncoder().encode(M)}i.stringToBuffer=l;function c(M){return m(l(M))}i.stringToB64Url=c;function p(M){return new Uint8Array(t.toByteArray(v(M)))}i.b64UrlToBuffer=p;function w(M){return t.fromByteArray(new Uint8Array(M))}i.bufferTob64=w;function m(M){return y(w(M))}i.bufferTob64Url=m;function y(M){return M.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}i.b64UrlEncode=y;function v(M){M=M.replace(/\-/g,"+").replace(/\_/g,"/");let T;return M.length%4==0?T=0:T=4-M.length%4,M.concat("=".repeat(T))}i.b64UrlDecode=v}),RMt=Du(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});var t=Met(),r=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let h=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),o=await this.driver.exportKey("jwk",h.privateKey);return{kty:o.kty,e:o.e,n:o.n,d:o.d,p:o.p,q:o.q,dp:o.dp,dq:o.dq,qi:o.qi}}async sign(h,o,{saltLength:l}={}){let c=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(h),o);return new Uint8Array(c)}async hash(h,o="SHA-256"){let l=await this.driver.digest(o,h);return new Uint8Array(l)}async verify(h,o,l){let c={kty:"RSA",e:"AQAB",n:h},p=await this.jwkToPublicCryptoKey(c),w=await this.driver.digest("SHA-256",o),m=await this.driver.verify({name:"RSA-PSS",saltLength:0},p,l,o),y=await this.driver.verify({name:"RSA-PSS",saltLength:32},p,l,o),v=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((p.algorithm.modulusLength-1)/8)-w.byteLength-2},p,l,o);return m||y||v}async jwkToCryptoKey(h){return this.driver.importKey("jwk",h,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(h){return this.driver.importKey("jwk",h,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let h=crypto?.subtle;return h===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(o=>typeof h[o]=="function")}async encrypt(h,o,l){let c=await this.driver.importKey("raw",typeof o=="string"?t.stringToBuffer(o):o,{name:"PBKDF2",length:32},!1,["deriveKey"]),p=await this.driver.deriveKey({name:"PBKDF2",salt:l?t.stringToBuffer(l):t.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},c,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),w=new Uint8Array(16);crypto.getRandomValues(w);let m=await this.driver.encrypt({name:"AES-CBC",iv:w},p,h);return t.concatBuffers([w,m])}async decrypt(h,o,l){let c=await this.driver.importKey("raw",typeof o=="string"?t.stringToBuffer(o):o,{name:"PBKDF2",length:32},!1,["deriveKey"]),p=await this.driver.deriveKey({name:"PBKDF2",salt:l?t.stringToBuffer(l):t.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},c,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),w=h.slice(0,16),m=await this.driver.decrypt({name:"AES-CBC",iv:w},p,h.slice(16));return t.concatBuffers([m])}};i.default=r}),kMt=Du(i=>{i.read=function(t,r,h,o,l){var c,p,w=l*8-o-1,m=(1<<w)-1,y=m>>1,v=-7,M=h?l-1:0,T=h?-1:1,A=t[r+M];for(M+=T,c=A&(1<<-v)-1,A>>=-v,v+=w;v>0;c=c*256+t[r+M],M+=T,v-=8);for(p=c&(1<<-v)-1,c>>=-v,v+=o;v>0;p=p*256+t[r+M],M+=T,v-=8);if(c===0)c=1-y;else{if(c===m)return p?NaN:(A?-1:1)*(1/0);p=p+Math.pow(2,o),c=c-y}return(A?-1:1)*p*Math.pow(2,c-o)},i.write=function(t,r,h,o,l,c){var p,w,m,y=c*8-l-1,v=(1<<y)-1,M=v>>1,T=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=o?0:c-1,R=o?1:-1,B=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(w=isNaN(r)?1:0,p=v):(p=Math.floor(Math.log(r)/Math.LN2),r*(m=Math.pow(2,-p))<1&&(p--,m*=2),p+M>=1?r+=T/m:r+=T*Math.pow(2,1-M),r*m>=2&&(p++,m/=2),p+M>=v?(w=0,p=v):p+M>=1?(w=(r*m-1)*Math.pow(2,l),p=p+M):(w=r*Math.pow(2,M-1)*Math.pow(2,l),p=0));l>=8;t[h+A]=w&255,A+=R,w/=256,l-=8);for(p=p<<l|w,y+=l;y>0;t[h+A]=p&255,A+=R,p/=256,y-=8);t[h+A-R]|=B*128}}),NR=Du(i=>{"use strict";var t=_et(),r=kMt(),h=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;i.Buffer=p,i.SlowBuffer=P,i.INSPECT_MAX_BYTES=50;var o=2147483647;i.kMaxLength=o,p.TYPED_ARRAY_SUPPORT=l(),!p.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function l(){try{let I=new Uint8Array(1),O={foo:function(){return 42}};return Object.setPrototypeOf(O,Uint8Array.prototype),Object.setPrototypeOf(I,O),I.foo()===42}catch{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}}),Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function c(I){if(I>o)throw new RangeError('The value "'+I+'" is invalid for option "size"');let O=new Uint8Array(I);return Object.setPrototypeOf(O,p.prototype),O}function p(I,O,L){if(typeof I=="number"){if(typeof O=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(I)}return w(I,O,L)}p.poolSize=8192;function w(I,O,L){if(typeof I=="string")return M(I,O);if(ArrayBuffer.isView(I))return A(I);if(I==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I);if(mt(I,ArrayBuffer)||I&&mt(I.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(mt(I,SharedArrayBuffer)||I&&mt(I.buffer,SharedArrayBuffer)))return R(I,O,L);if(typeof I=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let V=I.valueOf&&I.valueOf();if(V!=null&&V!==I)return p.from(V,O,L);let st=B(I);if(st)return st;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof I[Symbol.toPrimitive]=="function")return p.from(I[Symbol.toPrimitive]("string"),O,L);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I)}p.from=function(I,O,L){return w(I,O,L)},Object.setPrototypeOf(p.prototype,Uint8Array.prototype),Object.setPrototypeOf(p,Uint8Array);function m(I){if(typeof I!="number")throw new TypeError('"size" argument must be of type number');if(I<0)throw new RangeError('The value "'+I+'" is invalid for option "size"')}function y(I,O,L){return m(I),I<=0?c(I):O!==void 0?typeof L=="string"?c(I).fill(O,L):c(I).fill(O):c(I)}p.alloc=function(I,O,L){return y(I,O,L)};function v(I){return m(I),c(I<0?0:C(I)|0)}p.allocUnsafe=function(I){return v(I)},p.allocUnsafeSlow=function(I){return v(I)};function M(I,O){if((typeof O!="string"||O==="")&&(O="utf8"),!p.isEncoding(O))throw new TypeError("Unknown encoding: "+O);let L=N(I,O)|0,V=c(L),st=V.write(I,O);return st!==L&&(V=V.slice(0,st)),V}function T(I){let O=I.length<0?0:C(I.length)|0,L=c(O);for(let V=0;V<O;V+=1)L[V]=I[V]&255;return L}function A(I){if(mt(I,Uint8Array)){let O=new Uint8Array(I);return R(O.buffer,O.byteOffset,O.byteLength)}return T(I)}function R(I,O,L){if(O<0||I.byteLength<O)throw new RangeError('"offset" is outside of buffer bounds');if(I.byteLength<O+(L||0))throw new RangeError('"length" is outside of buffer bounds');let V;return O===void 0&&L===void 0?V=new Uint8Array(I):L===void 0?V=new Uint8Array(I,O):V=new Uint8Array(I,O,L),Object.setPrototypeOf(V,p.prototype),V}function B(I){if(p.isBuffer(I)){let O=C(I.length)|0,L=c(O);return L.length===0||I.copy(L,0,0,O),L}if(I.length!==void 0)return typeof I.length!="number"||wt(I.length)?c(0):T(I);if(I.type==="Buffer"&&Array.isArray(I.data))return T(I.data)}function C(I){if(I>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return I|0}function P(I){return+I!=I&&(I=0),p.alloc(+I)}p.isBuffer=function(I){return I!=null&&I._isBuffer===!0&&I!==p.prototype},p.compare=function(I,O){if(mt(I,Uint8Array)&&(I=p.from(I,I.offset,I.byteLength)),mt(O,Uint8Array)&&(O=p.from(O,O.offset,O.byteLength)),!p.isBuffer(I)||!p.isBuffer(O))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(I===O)return 0;let L=I.length,V=O.length;for(let st=0,ft=Math.min(L,V);st<ft;++st)if(I[st]!==O[st]){L=I[st],V=O[st];break}return L<V?-1:V<L?1:0},p.isEncoding=function(I){switch(String(I).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},p.concat=function(I,O){if(!Array.isArray(I))throw new TypeError('"list" argument must be an Array of Buffers');if(I.length===0)return p.alloc(0);let L;if(O===void 0)for(O=0,L=0;L<I.length;++L)O+=I[L].length;let V=p.allocUnsafe(O),st=0;for(L=0;L<I.length;++L){let ft=I[L];if(mt(ft,Uint8Array))st+ft.length>V.length?(p.isBuffer(ft)||(ft=p.from(ft)),ft.copy(V,st)):Uint8Array.prototype.set.call(V,ft,st);else if(p.isBuffer(ft))ft.copy(V,st);else throw new TypeError('"list" argument must be an Array of Buffers');st+=ft.length}return V};function N(I,O){if(p.isBuffer(I))return I.length;if(ArrayBuffer.isView(I)||mt(I,ArrayBuffer))return I.byteLength;if(typeof I!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof I);let L=I.length,V=arguments.length>2&&arguments[2]===!0;if(!V&&L===0)return 0;let st=!1;for(;;)switch(O){case"ascii":case"latin1":case"binary":return L;case"utf8":case"utf-8":return ut(I).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L*2;case"hex":return L>>>1;case"base64":return bt(I).length;default:if(st)return V?-1:ut(I).length;O=(""+O).toLowerCase(),st=!0}}p.byteLength=N;function q(I,O,L){let V=!1;if((O===void 0||O<0)&&(O=0),O>this.length||((L===void 0||L>this.length)&&(L=this.length),L<=0)||(L>>>=0,O>>>=0,L<=O))return"";for(I||(I="utf8");;)switch(I){case"hex":return e(this,O,L);case"utf8":case"utf-8":return d(this,O,L);case"ascii":return x(this,O,L);case"latin1":case"binary":return a(this,O,L);case"base64":return f(this,O,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u(this,O,L);default:if(V)throw new TypeError("Unknown encoding: "+I);I=(I+"").toLowerCase(),V=!0}}p.prototype._isBuffer=!0;function W(I,O,L){let V=I[O];I[O]=I[L],I[L]=V}p.prototype.swap16=function(){let I=this.length;if(I%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let O=0;O<I;O+=2)W(this,O,O+1);return this},p.prototype.swap32=function(){let I=this.length;if(I%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let O=0;O<I;O+=4)W(this,O,O+3),W(this,O+1,O+2);return this},p.prototype.swap64=function(){let I=this.length;if(I%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let O=0;O<I;O+=8)W(this,O,O+7),W(this,O+1,O+6),W(this,O+2,O+5),W(this,O+3,O+4);return this},p.prototype.toString=function(){let I=this.length;return I===0?"":arguments.length===0?d(this,0,I):q.apply(this,arguments)},p.prototype.toLocaleString=p.prototype.toString,p.prototype.equals=function(I){if(!p.isBuffer(I))throw new TypeError("Argument must be a Buffer");return this===I?!0:p.compare(this,I)===0},p.prototype.inspect=function(){let I="",O=i.INSPECT_MAX_BYTES;return I=this.toString("hex",0,O).replace(/(.{2})/g,"$1 ").trim(),this.length>O&&(I+=" ... "),"<Buffer "+I+">"},h&&(p.prototype[h]=p.prototype.inspect),p.prototype.compare=function(I,O,L,V,st){if(mt(I,Uint8Array)&&(I=p.from(I,I.offset,I.byteLength)),!p.isBuffer(I))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof I);if(O===void 0&&(O=0),L===void 0&&(L=I?I.length:0),V===void 0&&(V=0),st===void 0&&(st=this.length),O<0||L>I.length||V<0||st>this.length)throw new RangeError("out of range index");if(V>=st&&O>=L)return 0;if(V>=st)return-1;if(O>=L)return 1;if(O>>>=0,L>>>=0,V>>>=0,st>>>=0,this===I)return 0;let ft=st-V,ht=L-O,Et=Math.min(ft,ht),_t=this.slice(V,st),vt=I.slice(O,L);for(let Qt=0;Qt<Et;++Qt)if(_t[Qt]!==vt[Qt]){ft=_t[Qt],ht=vt[Qt];break}return ft<ht?-1:ht<ft?1:0};function J(I,O,L,V,st){if(I.length===0)return-1;if(typeof L=="string"?(V=L,L=0):L>2147483647?L=2147483647:L<-2147483648&&(L=-2147483648),L=+L,wt(L)&&(L=st?0:I.length-1),L<0&&(L=I.length+L),L>=I.length){if(st)return-1;L=I.length-1}else if(L<0)if(st)L=0;else return-1;if(typeof O=="string"&&(O=p.from(O,V)),p.isBuffer(O))return O.length===0?-1:F(I,O,L,V,st);if(typeof O=="number")return O=O&255,typeof Uint8Array.prototype.indexOf=="function"?st?Uint8Array.prototype.indexOf.call(I,O,L):Uint8Array.prototype.lastIndexOf.call(I,O,L):F(I,[O],L,V,st);throw new TypeError("val must be string, number or Buffer")}function F(I,O,L,V,st){let ft=1,ht=I.length,Et=O.length;if(V!==void 0&&(V=String(V).toLowerCase(),V==="ucs2"||V==="ucs-2"||V==="utf16le"||V==="utf-16le")){if(I.length<2||O.length<2)return-1;ft=2,ht/=2,Et/=2,L/=2}function _t(Qt,It){return ft===1?Qt[It]:Qt.readUInt16BE(It*ft)}let vt;if(st){let Qt=-1;for(vt=L;vt<ht;vt++)if(_t(I,vt)===_t(O,Qt===-1?0:vt-Qt)){if(Qt===-1&&(Qt=vt),vt-Qt+1===Et)return Qt*ft}else Qt!==-1&&(vt-=vt-Qt),Qt=-1}else for(L+Et>ht&&(L=ht-Et),vt=L;vt>=0;vt--){let Qt=!0;for(let It=0;It<Et;It++)if(_t(I,vt+It)!==_t(O,It)){Qt=!1;break}if(Qt)return vt}return-1}p.prototype.includes=function(I,O,L){return this.indexOf(I,O,L)!==-1},p.prototype.indexOf=function(I,O,L){return J(this,I,O,L,!0)},p.prototype.lastIndexOf=function(I,O,L){return J(this,I,O,L,!1)};function H(I,O,L,V){L=Number(L)||0;let st=I.length-L;V?(V=Number(V),V>st&&(V=st)):V=st;let ft=O.length;V>ft/2&&(V=ft/2);let ht;for(ht=0;ht<V;++ht){let Et=parseInt(O.substr(ht*2,2),16);if(wt(Et))return ht;I[L+ht]=Et}return ht}function Y(I,O,L,V){return lt(ut(O,I.length-L),I,L,V)}function E(I,O,L,V){return lt(pt(O),I,L,V)}function n(I,O,L,V){return lt(bt(O),I,L,V)}function s(I,O,L,V){return lt(St(O,I.length-L),I,L,V)}p.prototype.write=function(I,O,L,V){if(O===void 0)V="utf8",L=this.length,O=0;else if(L===void 0&&typeof O=="string")V=O,L=this.length,O=0;else if(isFinite(O))O=O>>>0,isFinite(L)?(L=L>>>0,V===void 0&&(V="utf8")):(V=L,L=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let st=this.length-O;if((L===void 0||L>st)&&(L=st),I.length>0&&(L<0||O<0)||O>this.length)throw new RangeError("Attempt to write outside buffer bounds");V||(V="utf8");let ft=!1;for(;;)switch(V){case"hex":return H(this,I,O,L);case"utf8":case"utf-8":return Y(this,I,O,L);case"ascii":case"latin1":case"binary":return E(this,I,O,L);case"base64":return n(this,I,O,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s(this,I,O,L);default:if(ft)throw new TypeError("Unknown encoding: "+V);V=(""+V).toLowerCase(),ft=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function f(I,O,L){return O===0&&L===I.length?t.fromByteArray(I):t.fromByteArray(I.slice(O,L))}function d(I,O,L){L=Math.min(I.length,L);let V=[],st=O;for(;st<L;){let ft=I[st],ht=null,Et=ft>239?4:ft>223?3:ft>191?2:1;if(st+Et<=L){let _t,vt,Qt,It;switch(Et){case 1:ft<128&&(ht=ft);break;case 2:_t=I[st+1],(_t&192)===128&&(It=(ft&31)<<6|_t&63,It>127&&(ht=It));break;case 3:_t=I[st+1],vt=I[st+2],(_t&192)===128&&(vt&192)===128&&(It=(ft&15)<<12|(_t&63)<<6|vt&63,It>2047&&(It<55296||It>57343)&&(ht=It));break;case 4:_t=I[st+1],vt=I[st+2],Qt=I[st+3],(_t&192)===128&&(vt&192)===128&&(Qt&192)===128&&(It=(ft&15)<<18|(_t&63)<<12|(vt&63)<<6|Qt&63,It>65535&&It<1114112&&(ht=It))}}ht===null?(ht=65533,Et=1):ht>65535&&(ht-=65536,V.push(ht>>>10&1023|55296),ht=56320|ht&1023),V.push(ht),st+=Et}return S(V)}var g=4096;function S(I){let O=I.length;if(O<=g)return String.fromCharCode.apply(String,I);let L="",V=0;for(;V<O;)L+=String.fromCharCode.apply(String,I.slice(V,V+=g));return L}function x(I,O,L){let V="";L=Math.min(I.length,L);for(let st=O;st<L;++st)V+=String.fromCharCode(I[st]&127);return V}function a(I,O,L){let V="";L=Math.min(I.length,L);for(let st=O;st<L;++st)V+=String.fromCharCode(I[st]);return V}function e(I,O,L){let V=I.length;(!O||O<0)&&(O=0),(!L||L<0||L>V)&&(L=V);let st="";for(let ft=O;ft<L;++ft)st+=Mt[I[ft]];return st}function u(I,O,L){let V=I.slice(O,L),st="";for(let ft=0;ft<V.length-1;ft+=2)st+=String.fromCharCode(V[ft]+V[ft+1]*256);return st}p.prototype.slice=function(I,O){let L=this.length;I=~~I,O=O===void 0?L:~~O,I<0?(I+=L,I<0&&(I=0)):I>L&&(I=L),O<0?(O+=L,O<0&&(O=0)):O>L&&(O=L),O<I&&(O=I);let V=this.subarray(I,O);return Object.setPrototypeOf(V,p.prototype),V};function b(I,O,L){if(I%1!==0||I<0)throw new RangeError("offset is not uint");if(I+O>L)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUintLE=p.prototype.readUIntLE=function(I,O,L){I=I>>>0,O=O>>>0,L||b(I,O,this.length);let V=this[I],st=1,ft=0;for(;++ft<O&&(st*=256);)V+=this[I+ft]*st;return V},p.prototype.readUintBE=p.prototype.readUIntBE=function(I,O,L){I=I>>>0,O=O>>>0,L||b(I,O,this.length);let V=this[I+--O],st=1;for(;O>0&&(st*=256);)V+=this[I+--O]*st;return V},p.prototype.readUint8=p.prototype.readUInt8=function(I,O){return I=I>>>0,O||b(I,1,this.length),this[I]},p.prototype.readUint16LE=p.prototype.readUInt16LE=function(I,O){return I=I>>>0,O||b(I,2,this.length),this[I]|this[I+1]<<8},p.prototype.readUint16BE=p.prototype.readUInt16BE=function(I,O){return I=I>>>0,O||b(I,2,this.length),this[I]<<8|this[I+1]},p.prototype.readUint32LE=p.prototype.readUInt32LE=function(I,O){return I=I>>>0,O||b(I,4,this.length),(this[I]|this[I+1]<<8|this[I+2]<<16)+this[I+3]*16777216},p.prototype.readUint32BE=p.prototype.readUInt32BE=function(I,O){return I=I>>>0,O||b(I,4,this.length),this[I]*16777216+(this[I+1]<<16|this[I+2]<<8|this[I+3])},p.prototype.readBigUInt64LE=ne(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&rt(I,this.length-8);let V=O+this[++I]*2**8+this[++I]*2**16+this[++I]*2**24,st=this[++I]+this[++I]*2**8+this[++I]*2**16+L*2**24;return BigInt(V)+(BigInt(st)<<BigInt(32))}),p.prototype.readBigUInt64BE=ne(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&rt(I,this.length-8);let V=O*2**24+this[++I]*2**16+this[++I]*2**8+this[++I],st=this[++I]*2**24+this[++I]*2**16+this[++I]*2**8+L;return(BigInt(V)<<BigInt(32))+BigInt(st)}),p.prototype.readIntLE=function(I,O,L){I=I>>>0,O=O>>>0,L||b(I,O,this.length);let V=this[I],st=1,ft=0;for(;++ft<O&&(st*=256);)V+=this[I+ft]*st;return st*=128,V>=st&&(V-=Math.pow(2,8*O)),V},p.prototype.readIntBE=function(I,O,L){I=I>>>0,O=O>>>0,L||b(I,O,this.length);let V=O,st=1,ft=this[I+--V];for(;V>0&&(st*=256);)ft+=this[I+--V]*st;return st*=128,ft>=st&&(ft-=Math.pow(2,8*O)),ft},p.prototype.readInt8=function(I,O){return I=I>>>0,O||b(I,1,this.length),this[I]&128?(255-this[I]+1)*-1:this[I]},p.prototype.readInt16LE=function(I,O){I=I>>>0,O||b(I,2,this.length);let L=this[I]|this[I+1]<<8;return L&32768?L|4294901760:L},p.prototype.readInt16BE=function(I,O){I=I>>>0,O||b(I,2,this.length);let L=this[I+1]|this[I]<<8;return L&32768?L|4294901760:L},p.prototype.readInt32LE=function(I,O){return I=I>>>0,O||b(I,4,this.length),this[I]|this[I+1]<<8|this[I+2]<<16|this[I+3]<<24},p.prototype.readInt32BE=function(I,O){return I=I>>>0,O||b(I,4,this.length),this[I]<<24|this[I+1]<<16|this[I+2]<<8|this[I+3]},p.prototype.readBigInt64LE=ne(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&rt(I,this.length-8);let V=this[I+4]+this[I+5]*2**8+this[I+6]*2**16+(L<<24);return(BigInt(V)<<BigInt(32))+BigInt(O+this[++I]*2**8+this[++I]*2**16+this[++I]*2**24)}),p.prototype.readBigInt64BE=ne(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&rt(I,this.length-8);let V=(O<<24)+this[++I]*2**16+this[++I]*2**8+this[++I];return(BigInt(V)<<BigInt(32))+BigInt(this[++I]*2**24+this[++I]*2**16+this[++I]*2**8+L)}),p.prototype.readFloatLE=function(I,O){return I=I>>>0,O||b(I,4,this.length),r.read(this,I,!0,23,4)},p.prototype.readFloatBE=function(I,O){return I=I>>>0,O||b(I,4,this.length),r.read(this,I,!1,23,4)},p.prototype.readDoubleLE=function(I,O){return I=I>>>0,O||b(I,8,this.length),r.read(this,I,!0,52,8)},p.prototype.readDoubleBE=function(I,O){return I=I>>>0,O||b(I,8,this.length),r.read(this,I,!1,52,8)};function _(I,O,L,V,st,ft){if(!p.isBuffer(I))throw new TypeError('"buffer" argument must be a Buffer instance');if(O>st||O<ft)throw new RangeError('"value" argument is out of bounds');if(L+V>I.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(I,O,L,V){if(I=+I,O=O>>>0,L=L>>>0,!V){let ht=Math.pow(2,8*L)-1;_(this,I,O,L,ht,0)}let st=1,ft=0;for(this[O]=I&255;++ft<L&&(st*=256);)this[O+ft]=I/st&255;return O+L},p.prototype.writeUintBE=p.prototype.writeUIntBE=function(I,O,L,V){if(I=+I,O=O>>>0,L=L>>>0,!V){let ht=Math.pow(2,8*L)-1;_(this,I,O,L,ht,0)}let st=L-1,ft=1;for(this[O+st]=I&255;--st>=0&&(ft*=256);)this[O+st]=I/ft&255;return O+L},p.prototype.writeUint8=p.prototype.writeUInt8=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,1,255,0),this[O]=I&255,O+1},p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,2,65535,0),this[O]=I&255,this[O+1]=I>>>8,O+2},p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,2,65535,0),this[O]=I>>>8,this[O+1]=I&255,O+2},p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,4,4294967295,0),this[O+3]=I>>>24,this[O+2]=I>>>16,this[O+1]=I>>>8,this[O]=I&255,O+4},p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,4,4294967295,0),this[O]=I>>>24,this[O+1]=I>>>16,this[O+2]=I>>>8,this[O+3]=I&255,O+4};function k(I,O,L,V,st){U(O,V,st,I,L,7);let ft=Number(O&BigInt(4294967295));I[L++]=ft,ft=ft>>8,I[L++]=ft,ft=ft>>8,I[L++]=ft,ft=ft>>8,I[L++]=ft;let ht=Number(O>>BigInt(32)&BigInt(4294967295));return I[L++]=ht,ht=ht>>8,I[L++]=ht,ht=ht>>8,I[L++]=ht,ht=ht>>8,I[L++]=ht,L}function $(I,O,L,V,st){U(O,V,st,I,L,7);let ft=Number(O&BigInt(4294967295));I[L+7]=ft,ft=ft>>8,I[L+6]=ft,ft=ft>>8,I[L+5]=ft,ft=ft>>8,I[L+4]=ft;let ht=Number(O>>BigInt(32)&BigInt(4294967295));return I[L+3]=ht,ht=ht>>8,I[L+2]=ht,ht=ht>>8,I[L+1]=ht,ht=ht>>8,I[L]=ht,L+8}p.prototype.writeBigUInt64LE=ne(function(I,O=0){return k(this,I,O,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeBigUInt64BE=ne(function(I,O=0){return $(this,I,O,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeIntLE=function(I,O,L,V){if(I=+I,O=O>>>0,!V){let Et=Math.pow(2,8*L-1);_(this,I,O,L,Et-1,-Et)}let st=0,ft=1,ht=0;for(this[O]=I&255;++st<L&&(ft*=256);)I<0&&ht===0&&this[O+st-1]!==0&&(ht=1),this[O+st]=(I/ft>>0)-ht&255;return O+L},p.prototype.writeIntBE=function(I,O,L,V){if(I=+I,O=O>>>0,!V){let Et=Math.pow(2,8*L-1);_(this,I,O,L,Et-1,-Et)}let st=L-1,ft=1,ht=0;for(this[O+st]=I&255;--st>=0&&(ft*=256);)I<0&&ht===0&&this[O+st+1]!==0&&(ht=1),this[O+st]=(I/ft>>0)-ht&255;return O+L},p.prototype.writeInt8=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,1,127,-128),I<0&&(I=255+I+1),this[O]=I&255,O+1},p.prototype.writeInt16LE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,2,32767,-32768),this[O]=I&255,this[O+1]=I>>>8,O+2},p.prototype.writeInt16BE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,2,32767,-32768),this[O]=I>>>8,this[O+1]=I&255,O+2},p.prototype.writeInt32LE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,4,2147483647,-2147483648),this[O]=I&255,this[O+1]=I>>>8,this[O+2]=I>>>16,this[O+3]=I>>>24,O+4},p.prototype.writeInt32BE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,4,2147483647,-2147483648),I<0&&(I=4294967295+I+1),this[O]=I>>>24,this[O+1]=I>>>16,this[O+2]=I>>>8,this[O+3]=I&255,O+4},p.prototype.writeBigInt64LE=ne(function(I,O=0){return k(this,I,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),p.prototype.writeBigInt64BE=ne(function(I,O=0){return $(this,I,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function it(I,O,L,V,st,ft){if(L+V>I.length)throw new RangeError("Index out of range");if(L<0)throw new RangeError("Index out of range")}function Z(I,O,L,V,st){return O=+O,L=L>>>0,st||it(I,O,L,4,34028234663852886e22,-34028234663852886e22),r.write(I,O,L,V,23,4),L+4}p.prototype.writeFloatLE=function(I,O,L){return Z(this,I,O,!0,L)},p.prototype.writeFloatBE=function(I,O,L){return Z(this,I,O,!1,L)};function et(I,O,L,V,st){return O=+O,L=L>>>0,st||it(I,O,L,8,17976931348623157e292,-17976931348623157e292),r.write(I,O,L,V,52,8),L+8}p.prototype.writeDoubleLE=function(I,O,L){return et(this,I,O,!0,L)},p.prototype.writeDoubleBE=function(I,O,L){return et(this,I,O,!1,L)},p.prototype.copy=function(I,O,L,V){if(!p.isBuffer(I))throw new TypeError("argument should be a Buffer");if(L||(L=0),!V&&V!==0&&(V=this.length),O>=I.length&&(O=I.length),O||(O=0),V>0&&V<L&&(V=L),V===L||I.length===0||this.length===0)return 0;if(O<0)throw new RangeError("targetStart out of bounds");if(L<0||L>=this.length)throw new RangeError("Index out of range");if(V<0)throw new RangeError("sourceEnd out of bounds");V>this.length&&(V=this.length),I.length-O<V-L&&(V=I.length-O+L);let st=V-L;return this===I&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(O,L,V):Uint8Array.prototype.set.call(I,this.subarray(L,V),O),st},p.prototype.fill=function(I,O,L,V){if(typeof I=="string"){if(typeof O=="string"?(V=O,O=0,L=this.length):typeof L=="string"&&(V=L,L=this.length),V!==void 0&&typeof V!="string")throw new TypeError("encoding must be a string");if(typeof V=="string"&&!p.isEncoding(V))throw new TypeError("Unknown encoding: "+V);if(I.length===1){let ft=I.charCodeAt(0);(V==="utf8"&&ft<128||V==="latin1")&&(I=ft)}}else typeof I=="number"?I=I&255:typeof I=="boolean"&&(I=Number(I));if(O<0||this.length<O||this.length<L)throw new RangeError("Out of range index");if(L<=O)return this;O=O>>>0,L=L===void 0?this.length:L>>>0,I||(I=0);let st;if(typeof I=="number")for(st=O;st<L;++st)this[st]=I;else{let ft=p.isBuffer(I)?I:p.from(I,V),ht=ft.length;if(ht===0)throw new TypeError('The value "'+I+'" is invalid for argument "value"');for(st=0;st<L-O;++st)this[st+O]=ft[st%ht]}return this};var Q={};function z(I,O,L){Q[I]=class extends L{constructor(){super(),Object.defineProperty(this,"message",{value:O.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${I}]`,this.stack,delete this.name}get code(){return I}set code(V){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:V,writable:!0})}toString(){return`${this.name} [${I}]: ${this.message}`}}}z("ERR_BUFFER_OUT_OF_BOUNDS",function(I){return I?`${I} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),z("ERR_INVALID_ARG_TYPE",function(I,O){return`The "${I}" argument must be of type number. Received type ${typeof O}`},TypeError),z("ERR_OUT_OF_RANGE",function(I,O,L){let V=`The value of "${I}" is out of range.`,st=L;return Number.isInteger(L)&&Math.abs(L)>2**32?st=tt(String(L)):typeof L=="bigint"&&(st=String(L),(L>BigInt(2)**BigInt(32)||L<-(BigInt(2)**BigInt(32)))&&(st=tt(st)),st+="n"),V+=` It must be ${O}. Received ${st}`,V},RangeError);function tt(I){let O="",L=I.length,V=I[0]==="-"?1:0;for(;L>=V+4;L-=3)O=`_${I.slice(L-3,L)}${O}`;return`${I.slice(0,L)}${O}`}function X(I,O,L){j(O,"offset"),(I[O]===void 0||I[O+L]===void 0)&&rt(O,I.length-(L+1))}function U(I,O,L,V,st,ft){if(I>L||I<O){let ht=typeof O=="bigint"?"n":"",Et;throw ft>3?O===0||O===BigInt(0)?Et=`>= 0${ht} and < 2${ht} ** ${(ft+1)*8}${ht}`:Et=`>= -(2${ht} ** ${(ft+1)*8-1}${ht}) and < 2 ** ${(ft+1)*8-1}${ht}`:Et=`>= ${O}${ht} and <= ${L}${ht}`,new Q.ERR_OUT_OF_RANGE("value",Et,I)}X(V,st,ft)}function j(I,O){if(typeof I!="number")throw new Q.ERR_INVALID_ARG_TYPE(O,"number",I)}function rt(I,O,L){throw Math.floor(I)!==I?(j(I,L),new Q.ERR_OUT_OF_RANGE(L||"offset","an integer",I)):O<0?new Q.ERR_BUFFER_OUT_OF_BOUNDS:new Q.ERR_OUT_OF_RANGE(L||"offset",`>= ${L?1:0} and <= ${O}`,I)}var ot=/[^+/0-9A-Za-z-_]/g;function ct(I){if(I=I.split("=")[0],I=I.trim().replace(ot,""),I.length<2)return"";for(;I.length%4!==0;)I=I+"=";return I}function ut(I,O){O=O||1/0;let L,V=I.length,st=null,ft=[];for(let ht=0;ht<V;++ht){if(L=I.charCodeAt(ht),L>55295&&L<57344){if(!st){if(L>56319){(O-=3)>-1&&ft.push(239,191,189);continue}else if(ht+1===V){(O-=3)>-1&&ft.push(239,191,189);continue}st=L;continue}if(L<56320){(O-=3)>-1&&ft.push(239,191,189),st=L;continue}L=(st-55296<<10|L-56320)+65536}else st&&(O-=3)>-1&&ft.push(239,191,189);if(st=null,L<128){if((O-=1)<0)break;ft.push(L)}else if(L<2048){if((O-=2)<0)break;ft.push(L>>6|192,L&63|128)}else if(L<65536){if((O-=3)<0)break;ft.push(L>>12|224,L>>6&63|128,L&63|128)}else if(L<1114112){if((O-=4)<0)break;ft.push(L>>18|240,L>>12&63|128,L>>6&63|128,L&63|128)}else throw new Error("Invalid code point")}return ft}function pt(I){let O=[];for(let L=0;L<I.length;++L)O.push(I.charCodeAt(L)&255);return O}function St(I,O){let L,V,st,ft=[];for(let ht=0;ht<I.length&&!((O-=2)<0);++ht)L=I.charCodeAt(ht),V=L>>8,st=L%256,ft.push(st),ft.push(V);return ft}function bt(I){return t.toByteArray(ct(I))}function lt(I,O,L,V){let st;for(st=0;st<V&&!(st+L>=O.length||st>=I.length);++st)O[st+L]=I[st];return st}function mt(I,O){return I instanceof O||I!=null&&I.constructor!=null&&I.constructor.name!=null&&I.constructor.name===O.name}function wt(I){return I!==I}var Mt=function(){let I="0123456789abcdef",O=new Array(256);for(let L=0;L<16;++L){let V=L*16;for(let st=0;st<16;++st)O[V+st]=I[L]+I[st]}return O}();function ne(I){return typeof BigInt>"u"?nt:I}function nt(){throw new Error("BigInt not supported")}}),IMt=Du((i,t)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,t.exports={Buffer:NR().Buffer,Crypto:window.crypto}):t.exports={Buffer:NR().Buffer,Crypto:crypto}}),Eet={};EMt(Eet,{AVSCTap:()=>Em,ArweaveSigner:()=>ek,DataItem:()=>ym,MAX_TAG_BYTES:()=>_8,MIN_BINARY_SIZE:()=>nk,SIG_CONFIG:()=>op,SignatureConfig:()=>Gs,Signer:()=>Aet,createData:()=>ket,deserializeTags:()=>l8,indexToType:()=>rk,serializeTags:()=>ik,tagsExceedLimit:()=>Ret});var Aet=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(i,t,r,h){throw new Error("You must implement verify method on child")}},BMt=U0(tk(),1),Wh=U0(Met(),1);async function Tet(i){if(Array.isArray(i)){let o=(0,Wh.concatBuffers)([(0,Wh.stringToBuffer)("list"),(0,Wh.stringToBuffer)(i.length.toString())]);return await xet(i,await Cu().hash(o,"SHA-384"))}let t=i,r=(0,Wh.concatBuffers)([(0,Wh.stringToBuffer)("blob"),(0,Wh.stringToBuffer)(t.byteLength.toString())]),h=(0,Wh.concatBuffers)([await Cu().hash(r,"SHA-384"),await Cu().hash(t,"SHA-384")]);return await Cu().hash(h,"SHA-384")}async function xet(i,t){if(i.length<1)return t;let r=(0,Wh.concatBuffers)([t,await Tet(i[0])]),h=await Cu().hash(r,"SHA-384");return await xet(i.slice(1),h)}var wR=U0(RMt(),1),OMt=wR.default.default?wR.default.default:wR.default,CMt=class extends OMt{getPublicKey(i){throw new Error("Unimplemented")}},PMt;function Cu(){return PMt??=new CMt}var Gs;(function(i){i[i.ARWEAVE=1]="ARWEAVE",i[i.ED25519=2]="ED25519",i[i.ETHEREUM=3]="ETHEREUM",i[i.SOLANA=4]="SOLANA",i[i.INJECTEDAPTOS=5]="INJECTEDAPTOS",i[i.MULTIAPTOS=6]="MULTIAPTOS",i[i.TYPEDETHEREUM=7]="TYPEDETHEREUM"})(Gs||(Gs={}));var op={[Gs.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[Gs.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[Gs.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[Gs.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[Gs.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[Gs.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[Gs.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},ek=class{signatureType=1;ownerLength=op[1].pubLength;signatureLength=op[1].sigLength;jwk;pk;constructor(i){this.pk=i.n,this.jwk=i}get publicKey(){return BMt.default.toBuffer(this.pk)}sign(i){return Cu().sign(this.jwk,i)}static async verify(i,t,r){return await Cu().verify(i,t,r)}},rk={1:ek},Of=U0(tk(),1);async function LR(i){return Tet([(0,Wh.stringToBuffer)("dataitem"),(0,Wh.stringToBuffer)("1"),(0,Wh.stringToBuffer)(i.signatureType.toString()),i.rawOwner,i.rawTarget,i.rawAnchor,i.rawTags,i.rawData])}async function NMt(i,t){let r=await LR(i),h=await t.sign(r),o=await Cu().hash(h);return{signature:ge.from(h),id:ge.from(o)}}async function LMt(i,t){let{signature:r,id:h}=await NMt(i,t);return i.getRaw().set(r,2),h}var Em=class{buf;pos;constructor(i=ge.alloc(_8),t=0){this.buf=i,this.pos=t}writeTags(i){if(!Array.isArray(i))throw new Error("input must be array");let t=i.length,r;if(t)for(this.writeLong(t),r=0;r<t;r++){let h=i[r];if(h?.name===void 0||h?.value===void 0)throw new Error(`Invalid tag format for ${h}, expected {name:string, value: string}`);this.writeString(h.name),this.writeString(h.value)}this.writeLong(0)}toBuffer(){let i=ge.alloc(this.pos);if(this.pos>this.buf.length)throw new Error(`Too many tag bytes (${this.pos} > ${this.buf.length})`);return this.buf.copy(i,0,0,this.pos),i}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(i){let t=this.buf,r,h;if(i>=-1073741824&&i<1073741824){h=i>=0?i<<1:~i<<1|1;do t[this.pos]=h&127,h>>=7;while(h&&(t[this.pos++]|=128))}else{r=i>=0?i*2:-i*2-1;do t[this.pos]=r&127,r/=128;while(r>=1&&(t[this.pos++]|=128))}this.pos++,this.buf=t}writeString(i){let t=ge.byteLength(i),r=this.buf;this.writeLong(t);let h=this.pos;if(this.pos+=t,!(this.pos>r.length)){if(t>64)this.buf.write(i,this.pos-t,t,"utf8");else{let o,l,c,p;for(o=0,l=t;o<l;o++)c=i.charCodeAt(o),c<128?r[h++]=c:c<2048?(r[h++]=c>>6|192,r[h++]=c&63|128):(c&64512)===55296&&((p=i.charCodeAt(o+1))&64512)===56320?(c=65536+((c&1023)<<10)+(p&1023),o++,r[h++]=c>>18|240,r[h++]=c>>12&63|128,r[h++]=c>>6&63|128,r[h++]=c&63|128):(r[h++]=c>>12|224,r[h++]=c>>6&63|128,r[h++]=c&63|128)}this.buf=r}}readLong(){let i=0,t=0,r=this.buf,h,o,l,c;do h=r[this.pos++],o=h&128,i|=(h&127)<<t,t+=7;while(o&&t<28);if(o){l=i,c=268435456;do h=r[this.pos++],l+=(h&127)*c,c*=128;while(h&128);return(l%2?-(l+1):l)/2}return i>>1^-(i&1)}skipLong(){let i=this.buf;for(;i[this.pos++]&128;);}readTags(){let i=[],t;for(;t=this.readLong();)for(t<0&&(t=-t,this.skipLong());t--;){let r=this.readString(),h=this.readString();i.push({name:r,value:h})}return i}readString(){let i=this.readLong(),t=this.pos,r=this.buf;if(this.pos+=i,!(this.pos>r.length))return this.buf.slice(t,t+i).toString()}};function ik(i){let t=new Em;return t.writeTags(i),t.toBuffer()}function Ret(i){let t=new Em;return t.writeTags(i),t.tagsExceedLimit()}function l8(i){return new Em(i).readTags()}function Jc(i){let t=0;for(let r=i.length-1;r>=0;r--)t=t*256+i[r];return t}function DMt(i){if(i>29)throw new Error("Short too long");let t=[0,0];for(let r=0;r<t.length;r++){let h=i&255;t[r]=h,i=(i-h)/256}return Uint8Array.from(t)}function dtt(i){let t=[0,0,0,0,0,0,0,0];for(let r=0;r<t.length;r++){let h=i&255;t[r]=h,i=(i-h)/256}return Uint8Array.from(t)}var $Mt=U0(IMt(),1),H1=U0(NR(),1),_8=4096,nk=80,ym=class{binary;_id;constructor(i){this.binary=i}static isDataItem(i){return i.binary!==void 0}get signatureType(){let i=Jc(this.binary.subarray(0,2));if(Gs?.[i]!==void 0)return i;throw new Error("Unknown signature type: "+i)}async isValid(){return ym.verify(this.binary)}get id(){return(async()=>Of.default.encode(await this.rawId))()}set id(i){this._id=Of.default.toBuffer(i)}get rawId(){return(async()=>H1.Buffer.from(await $Mt.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(i){this._id=i}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return Of.default.encode(this.rawSignature)}set rawOwner(i){if(i.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${i.byteLength} bytes.`);this.binary.set(i,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return op[this.signatureType].sigLength}get owner(){return Of.default.encode(this.rawOwner)}get ownerLength(){return op[this.signatureType].pubLength}get rawTarget(){let i=this.getTargetStart();return this.binary[i]==1?this.binary.subarray(i+1,i+33):H1.Buffer.alloc(0)}get target(){return Of.default.encode(this.rawTarget)}get rawAnchor(){let i=this.getAnchorStart();return this.binary[i]==1?this.binary.subarray(i+1,i+33):H1.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let i=this.getTagsStart(),t=Jc(this.binary.subarray(i+8,i+16));return this.binary.subarray(i+16,i+16+t)}get tags(){let i=this.getTagsStart();if(Jc(this.binary.subarray(i,i+8))==0)return[];let t=Jc(this.binary.subarray(i+8,i+16));return l8(H1.Buffer.from(this.binary.subarray(i+16,i+16+t)))}get tagsB64Url(){return this.tags.map(i=>({name:Of.default.encode(i.name),value:Of.default.encode(i.value)}))}getStartOfData(){let i=this.getTagsStart(),t=this.binary.subarray(i+8,i+16),r=Jc(t);return i+16+r}get rawData(){let i=this.getTagsStart(),t=this.binary.subarray(i+8,i+16),r=Jc(t),h=i+16+r;return this.binary.subarray(h,this.binary.length)}get data(){return Of.default.encode(this.rawData)}getRaw(){return this.binary}async sign(i){return this._id=await LMt(this,i),this.rawId}async setSignature(i){this.binary.set(i,2),this._id=H1.Buffer.from(await Cu().hash(i))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(i=>({name:Of.default.encode(i.name),value:Of.default.encode(i.value)})),data:this.data}}static async verify(i){if(i.byteLength<nk)return!1;let t=new ym(i),r=t.signatureType,h=t.getTagsStart(),o=Jc(i.subarray(h,h+8)),l=i.subarray(h+8,h+16),c=Jc(l);if(c>_8)return!1;if(o>0)try{if(l8(H1.Buffer.from(i.subarray(h+16,h+16+c))).length!==o)return!1}catch{return!1}let p=rk[r],w=await LR(t);return await p.verify(t.rawOwner,w,t.rawSignature)}async getSignatureData(){return LR(this)}getTagsStart(){let i=this.getTargetStart(),t=this.binary[i]==1,r=i+(t?33:1),h=this.binary[r]==1;return r+=h?33:1,r}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let i=this.getTargetStart()+1,t=this.binary[this.getTargetStart()]==1;return i+=t?32:0,i}},UMt=U0(tk(),1);function ket(i,t,r){let h=t.publicKey,o=r?.target?UMt.default.toBuffer(r.target):null,l=1+(o?.byteLength??0),c=r?.anchor?ge.from(r.anchor):null,p=1+(c?.byteLength??0),w=(r?.tags?.length??0)>0?ik(r.tags):null,m=16+(w?w.byteLength:0),y=ge.from(i),v=y.byteLength,M=2+t.signatureLength+t.ownerLength+l+p+m+v,T=ge.alloc(M);if(T.set(DMt(t.signatureType),0),T.set(new Uint8Array(t.signatureLength).fill(0),2),h.byteLength!==t.ownerLength)throw new Error(`Owner must be ${t.ownerLength} bytes, but was incorrectly ${h.byteLength}`);T.set(h,2+t.signatureLength);let A=2+t.signatureLength+t.ownerLength;if(T[A]=o?1:0,o){if(o.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${o.byteLength}`);T.set(o,A+1)}let R=A+l,B=R+1;if(T[R]=c?1:0,c){if(B+=c.byteLength,c.byteLength!==32)throw new Error("Anchor must be 32 bytes");T.set(c,R+1)}T.set(dtt(r?.tags?.length??0),B);let C=dtt(w?.byteLength??0);T.set(C,B+8),w&&T.set(w,B+16);let P=B+m;return T.set(y,P),new ym(T)}var ok={...Eet};globalThis.arbundles??=ok;var qMt=ok,FMt=ok;globalThis.Buffer||(globalThis.Buffer=bet.Buffer);var{DataItem:jMt}=wet;function zMt(i){return async({data:r,tags:h,target:o,anchor:l,createDataItem:c=p=>new jMt(p)})=>{let p=await i.signDataItem({data:r,tags:h,target:o,anchor:l}),w=c(bet.Buffer.from(p));return{id:await w.id,raw:await w.getRaw()}}}var WMt=globalThis.GATEWAY_URL||void 0,KMt=globalThis.MU_URL||void 0,HMt=globalThis.CU_URL||void 0,GMt=globalThis.GRAPHQL_URL||void 0,{result:$Wt,results:UWt,message:qWt,spawn:FWt,monitor:jWt,unmonitor:zWt,dryrun:WWt,assign:KWt}=Sm({GATEWAY_URL:WMt,MU_URL:KMt,CU_URL:HMt,GRAPHQL_URL:GMt}),HWt=yet.createDataItemSigner;var Iet=sc(z5(),1);Tt();Rt();xt();function ak(i){try{return JSON.parse(i)}catch{return i}}var Ys=class i{logger;processId;ao;constructor({processId:t,ao:r=Sm(),logger:h=new pa({level:"info"})}){this.processId=t,this.logger=h,this.ao=r}static async createAoSigner(t){return t.publicKey===void 0&&"setPublicKey"in t&&await t.setPublicKey(),async({data:h,tags:o,target:l,anchor:c})=>{let p=(0,Iet.createData)(h,t,{tags:o,target:l,anchor:c});return p.sign(t).then(async()=>({id:await p.id,raw:await p.getRaw()}))}}async read({tags:t,retries:r=3}){let h=0,o;for(;h<r;)try{this.logger.debug("Evaluating read interaction on contract",{tags:t});let l=await this.ao.dryrun({process:this.processId,tags:t});if(l.Messages.length===0)throw new Error(`Process ${this.processId} does not support provided action.`);let p=l.Messages[0].Tags.find(m=>m.name==="Error");if(p)throw new Error(`${p.Value}: ${l.Messages[0].Data}`);return this.logger.debug("Read interaction result",{result:l.Messages[0].Data}),l.Messages[0].Data===void 0?{}:ak(l.Messages[0].Data)}catch(l){h++,this.logger.debug(`Read attempt ${h} failed`,{error:l,tags:t}),o=l,await new Promise(c=>setTimeout(c,2**h*1e3))}throw o}async send({tags:t,data:r,signer:h,retries:o=3}){let l=0,c;for(;l<o;)try{this.logger.debug("Evaluating send interaction on contract",{tags:t,data:r,processId:this.processId});let p=await this.ao.message({process:this.processId,tags:[...t,{name:"AR-IO-SDK",value:o1}],data:typeof r!="string"?JSON.stringify(r):r,signer:await i.createAoSigner(h)});this.logger.debug("Sent message to process",{messageId:p,processId:this.processId});let w=await this.ao.result({message:p,process:this.processId});if(this.logger.debug("Message result",{output:w,messageId:p,processId:this.processId}),w.Messages?.length===0||w.Messages===void 0)return{id:p};let y=w.Messages[0].Tags.find(M=>M.name==="Error");if(y){let M=w.Messages[0].Data;throw new a1(`${y.Value}: ${M}`)}if(w.Messages.length===0)throw new Error(`Process ${this.processId} does not support provided action.`);if(w.Messages[0].Data===void 0)return{id:p};let v=ak(w.Messages[0].Data);return this.logger.debug("Message result data",{resultData:v,messageId:p,processId:this.processId}),{id:p,result:v}}catch(p){if(this.logger.error("Error sending message to process",{error:p.message,processId:this.processId,tags:t}),p.message.includes("500"))this.logger.debug("Retrying send interaction",{attempts:l,retries:o,error:p.message,processId:this.processId}),await new Promise(w=>setTimeout(w,2**l*2e3)),l++,c=p;else throw p}throw c}};var Am=class{static init(t){if(t&&t.signer){let{signer:r,...h}=t;return new sk({...h,signer:r})}return new M8(t)}},M8=class{process;arweave;constructor(t,r=Bet.default.init({})){if(!t)this.process=new Ys({processId:Od});else if(Rl(t))this.process=t.process;else if(kl(t))this.process=new Ys({processId:t.processId,logger:new pa({level:"info"})});else throw new No;this.arweave=r}async getInfo(){return this.process.read({tags:[{name:"Action",value:"Info"}]})}async getEpochSettings(t){let h=[{name:"Action",value:"Epoch-Settings"},{name:"Timestamp",value:t?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Epoch-Index",value:t?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return this.process.read({tags:h})}async getEpoch(t){let h=[{name:"Action",value:"Epoch"},{name:"Timestamp",value:t?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Epoch-Index",value:t?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return this.process.read({tags:h})}async getArNSRecord({name:t}){return this.process.read({tags:[{name:"Action",value:"Record"},{name:"Name",value:t}]})}async getArNSRecords(){return this.process.read({tags:[{name:"Action",value:"Records"}]})}async getArNSReservedNames(){return this.process.read({tags:[{name:"Action",value:"Reserved-Names"}]})}async getArNSReservedName({name:t}){return this.process.read({tags:[{name:"Action",value:"Reserved-Name"},{name:"Name",value:t}]})}async getBalance({address:t}){return this.process.read({tags:[{name:"Action",value:"Balance"},{name:"Address",value:t}]})}async getBalances(){return this.process.read({tags:[{name:"Action",value:"Balances"}]})}async getGateway({address:t}){return this.process.read({tags:[{name:"Action",value:"Gateway"},{name:"Address",value:t}]})}async getGateways(){return this.process.read({tags:[{name:"Action",value:"Gateways"}]})}async getCurrentEpoch(){return this.process.read({tags:[{name:"Action",value:"Epoch"},{name:"Timestamp",value:(await this.arweave.blocks.getCurrent().catch(()=>({timestamp:Date.now()}))).timestamp.toString()}]})}async getPrescribedObservers(t){let h=[{name:"Action",value:"Epoch-Prescribed-Observers"},{name:"Timestamp",value:t?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Epoch-Index",value:t?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return this.process.read({tags:h})}async getPrescribedNames(t){let h=[{name:"Action",value:"Epoch-Prescribed-Names"},{name:"Timestamp",value:t?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Epoch-Index",value:t?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return this.process.read({tags:h})}async getObservations(t){let h=[{name:"Action",value:"Epoch-Observations"},{name:"Timestamp",value:t?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().catch(()=>({timestamp:`${Date.now()}`}))).timestamp.toString()},{name:"Epoch-Index",value:t?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return this.process.read({tags:h})}async getDistributions(t){let h=[{name:"Action",value:"Epoch-Distributions"},{name:"Timestamp",value:t?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Epoch-Index",value:t?.epochIndex?.toString()}].filter(o=>o.value!==void 0);return this.process.read({tags:h})}async getTokenCost({intent:t,purchaseType:r,years:h,name:o,quantity:l}){let p=[{name:"Action",value:"Token-Cost"},{name:"Intent",value:t},{name:"Name",value:o},{name:"Years",value:h?.toString()},{name:"Quantity",value:l?.toString()},{name:"Purchase-Type",value:r},{name:"Timestamp",value:(await this.arweave.blocks.getCurrent().catch(()=>({timestamp:Date.now()}))).timestamp.toString()}].filter(w=>w.value!==void 0);return this.process.read({tags:p})}},sk=class extends M8{signer;constructor({signer:t,...r}){if(Object.keys(r).length===0)super({process:new Ys({processId:Od})}),this.signer=t;else if(Rl(r))super({process:r.process}),this.signer=t;else if(kl(r))super({process:new Ys({processId:r.processId})}),this.signer=t;else throw new No}async transfer({target:t,qty:r},h){let{tags:o=[]}=h||{};return this.process.send({tags:[...o,{name:"Action",value:"Transfer"},{name:"Recipient",value:t},{name:"Quantity",value:r.valueOf().toString()}],signer:this.signer})}async joinNetwork({operatorStake:t,allowDelegatedStaking:r,delegateRewardShareRatio:h,fqdn:o,label:l,minDelegatedStake:c,note:p,port:w,properties:m,protocol:y,autoStake:v,observerAddress:M},T){let{tags:A=[]}=T||{},B=[...A,{name:"Action",value:"Join-Network"},{name:"Operator-Stake",value:t.valueOf().toString()},{name:"Allow-Delegated-Staking",value:r.toString()},{name:"Delegate-Reward-Share-Ratio",value:h.toString()},{name:"FQDN",value:o},{name:"Label",value:l},{name:"Min-Delegated-Stake",value:c.valueOf().toString()},{name:"Note",value:p},{name:"Port",value:w.toString()},{name:"Properties",value:m},{name:"Protocol",value:y},{name:"Auto-Stake",value:v.toString()},{name:"Observer-Address",value:M}].filter(C=>C.value!==void 0);return this.process.send({signer:this.signer,tags:B})}async updateGatewaySettings({allowDelegatedStaking:t,delegateRewardShareRatio:r,fqdn:h,label:o,minDelegatedStake:l,note:c,port:p,properties:w,protocol:m,autoStake:y,observerAddress:v},M){let{tags:T=[]}=M||{},R=[...T,{name:"Action",value:"Update-Gateway-Settings"},{name:"Label",value:o},{name:"Note",value:c},{name:"FQDN",value:h},{name:"Port",value:p?.toString()},{name:"Properties",value:w},{name:"Protocol",value:m},{name:"Observer-Address",value:v},{name:"Allow-Delegated-Staking",value:t?.toString()},{name:"Delegate-Reward-Share-Ratio",value:r?.toString()},{name:"Min-Delegated-Stake",value:l?.valueOf().toString()},{name:"Auto-Stake",value:y?.toString()}].filter(B=>B.value!==void 0);return this.process.send({signer:this.signer,tags:R})}async delegateStake(t,r){let{tags:h=[]}=r||{};return this.process.send({signer:this.signer,tags:[...h,{name:"Action",value:"Delegate-Stake"},{name:"Target",value:t.target},{name:"Quantity",value:t.stakeQty.valueOf().toString()}]})}async decreaseDelegateStake(t,r){let{tags:h=[]}=r||{};return this.process.send({signer:this.signer,tags:[...h,{name:"Action",value:"Decrease-Delegate-Stake"},{name:"Target",value:t.target},{name:"Quantity",value:t.decreaseQty.valueOf().toString()}]})}async increaseOperatorStake(t,r){let{tags:h=[]}=r||{};return this.process.send({signer:this.signer,tags:[...h,{name:"Action",value:"Increase-Operator-Stake"},{name:"Quantity",value:t.increaseQty.valueOf().toString()}]})}async decreaseOperatorStake(t,r){let{tags:h=[]}=r||{};return this.process.send({signer:this.signer,tags:[...h,{name:"Action",value:"Decrease-Operator-Stake"},{name:"Quantity",value:t.decreaseQty.valueOf().toString()}]})}async saveObservations(t,r){let{tags:h=[]}=r||{};return this.process.send({signer:this.signer,tags:[...h,{name:"Action",value:"Save-Observations"},{name:"Report-Tx-Id",value:t.reportTxId},{name:"Failed-Gateways",value:t.failedGateways.join(",")}],data:{reportTxId:t.reportTxId,failedGateways:t.failedGateways}})}async buyRecord(t,r){let{tags:h=[]}=r||{},l=[...h,{name:"Action",value:"Buy-Record"},{name:"Name",value:t.name},{name:"Years",value:t.years?.toString()??"1"},{name:"Process-Id",value:t.processId},{name:"Purchase-Type",value:t.type||"lease"}].filter(c=>c.value!==void 0);return this.process.send({signer:this.signer,tags:l})}async extendLease(t,r){let{tags:h=[]}=r||{};return this.process.send({signer:this.signer,tags:[...h,{name:"Action",value:"Extend-Lease"},{name:"Name",value:t.name},{name:"Years",value:t.years.toString()}]})}async increaseUndernameLimit(t,r){let{tags:h=[]}=r||{};return this.process.send({signer:this.signer,tags:[...h,{name:"Action",value:"Increase-Undername-Limit"},{name:"Name",value:t.name},{name:"Quantity",value:t.increaseCount.toString()}]})}};var gHt=async({address:i,contract:t=Am.init({processId:Od})})=>{let r=X9(50),h=await t.getArNSRecords().then(l=>Object.values(l).filter(c=>c.processId!==void 0).map(c=>c.processId)),o=await Promise.all(h.map(async l=>r(async()=>{let c=j2.init({processId:l}),{Owner:p,Controllers:w}=await c.getState();if(p===i||w.includes(i))return l})));return o.length===0?[]:[...new Set(o)]};function Oet(i,t){return new Promise((r,h)=>{let o=setTimeout(()=>{h(new Error("Timeout"))},i);t.then(l=>{clearTimeout(o),r(l)}).catch(l=>{clearTimeout(o),h(l)})})}var Cet=class extends Pet.default{contract;timeoutMs;throttle;constructor({contract:t=Am.init({processId:Od}),timeoutMs:r=6e4,concurrency:h=30}){super(),this.contract=t,this.timeoutMs=r,this.throttle=X9(h)}async fetchProcessesOwnedByWallet({address:t}){let r={};await Oet(this.timeoutMs,this.contract.getArNSRecords().catch(o=>(this.emit("error",`Error getting ArNS records: ${o}`),{}))).then(o=>{o&&Object.entries(o).forEach(([l,c])=>{c.processId!==void 0&&(r[c.processId]===void 0&&(r[c.processId]={state:void 0,names:{}}),r[c.processId].names[l]=c)})});let h=Object.keys(r).length;this.emit("progress",0,h),await Promise.all(Object.keys(r).map(async(o,l)=>this.throttle(async()=>{if(r[o].state!==void 0){this.emit("progress",l+1,h);return}let c=j2.init({processId:o}),p=await Oet(this.timeoutMs,c.getState()).catch(w=>{this.emit("error",`Error getting state for process ${o}: ${w}`)});(p?.Owner===t||p?.Controllers.includes(t))&&(r[o].state=p,this.emit("process",o,r[o])),this.emit("progress",l+1,h)}))),this.emit("end",r)}};Tt();Rt();xt();Tt();Rt();xt();var Net=sc(lR(),1),S8=Net.default.init({host:"arweave.net",port:443,protocol:"https"});async function PHt({signer:i,module:t=xL,luaCodeTxId:r=RL,ao:h=Sm(),scheduler:o=kL,state:l,stateContractTxId:c}){let p=await S8.transactions.getData(r,{decode:!0,string:!0}),w=await h.spawn({module:t,scheduler:o,signer:await Ys.createAoSigner(i)}),m=new Ys({processId:w,ao:h});return await m.send({tags:[{name:"Action",value:"Eval"},{name:"App-Name",value:"ArNS-ANT"},{name:"Source-Code-TX-ID",value:r}],data:p,signer:i}),l&&await m.send({tags:[{name:"Action",value:"Initialize-State"},...c!==void 0?[{name:"State-Contract-TX-ID",value:c}]:[]],data:JSON.stringify(l),signer:i}),w}var E8=class{axios;logger;constructor({url:t,logger:r=new pa}){this.logger=r,this.axios=oF({axiosConfig:{baseURL:t},logger:this.logger})}async get({endpoint:t,signal:r,allowedStatuses:h=[200,202],headers:o,params:l}){this.logger.debug(`Get request to endpoint: ${t} with params ${JSON.stringify(l,void 0,2)}`);let{status:c,statusText:p,data:w}=await this.axios.get(t,{headers:o,signal:r,params:l});if(this.logger.debug(`Response status: ${c} ${p}`),!h.includes(c))switch(c){case 404:throw new O6(p);case 400:throw new Hl(c,p);default:throw new C6(p)}return w}};var Gl=class{logger;http;contractTxId;cacheUrl;constructor({cacheUrl:t="https://api.arns.app",contractTxId:r,logger:h=new pa}){this.cacheUrl=t,this.contractTxId=r,this.logger=h,this.http=new E8({url:`${t}/v1/contract/${r}`})}configuration(){return{contractTxId:this.contractTxId,cacheUrl:this.cacheUrl}}async getState({evaluationOptions:t}={}){this.logger.debug("Fetching contract state",{contractTxId:this.contractTxId,evaluationOptions:t});let{state:r}=await this.http.get({endpoint:"",params:{...t?.evalTo}});return r}async readInteraction({functionName:t,inputs:r,evaluationOptions:h}){this.logger.debug("Evaluating read interaction on contract",{functionName:t,inputs:r,evaluationOptions:h});let{result:o}=await this.http.get({endpoint:`/read/${t}`,params:{...h?.evalTo,...r}});return o}};var Let=class{static createWriteableContract(t){if(!t||Object.keys(t).length===0)return new ga({contractTxId:Sy});if(Yf(t))return t.contract instanceof ga?t.contract:new ga(t.contract.configuration());if(Qf(t))return new ga({contractTxId:t.contractTxId});throw new No}static init(t){if(t&&t.signer!==void 0){let{signer:r,...h}=t,o=this.createWriteableContract(h);return new hk({signer:r,contract:o})}else return new A8(t)}},A8=class{contract;constructor(t){if(!t||t===void 0)this.contract=new Gl({contractTxId:Sy});else if(Yf(t))this.contract=t.contract;else if(Qf(t))this.contract=new Gl({contractTxId:t.contractTxId});else throw new No}async getState(t={}){return await this.contract.getState(t)}async getArNSRecord({domain:t,evaluationOptions:r}){return(await this.getArNSRecords({evaluationOptions:r}))[t]}async getArNSRecords({evaluationOptions:t}={}){return(await this.contract.getState({evaluationOptions:t})).records}async getArNSReservedNames({evaluationOptions:t}={}){return(await this.contract.getState({evaluationOptions:t})).reserved}async getArNSReservedName({domain:t,evaluationOptions:r}){return(await this.getArNSReservedNames({evaluationOptions:r}))[t]}async getBalance({address:t,evaluationOptions:r}){return(await this.getBalances({evaluationOptions:r}))[t]||0}async getBalances({evaluationOptions:t}={}){return(await this.contract.getState({evaluationOptions:t})).balances}async getGateway({address:t,evaluationOptions:r}){return this.contract.readInteraction({functionName:ho.GATEWAY,inputs:{target:t},evaluationOptions:r}).catch(()=>{})}async getGateways({evaluationOptions:t}={}){return this.contract.readInteraction({functionName:ho.GATEWAYS,evaluationOptions:t})}async getCurrentEpoch({evaluationOptions:t}={}){return this.contract.readInteraction({functionName:ho.EPOCH,evaluationOptions:t})}async getEpoch({blockHeight:t,evaluationOptions:r}){return this.contract.readInteraction({functionName:ho.EPOCH,inputs:{height:t},evaluationOptions:r})}async getPrescribedObservers({evaluationOptions:t}={}){return this.contract.readInteraction({functionName:ho.PRESCRIBED_OBSERVERS,evaluationOptions:t})}async getObservations({evaluationOptions:t}={}){let{observations:r}=await this.contract.getState({evaluationOptions:t});return r}async getDistributions({evaluationOptions:t}={}){let{distributions:r}=await this.contract.getState({evaluationOptions:t});return r}async getAuction({domain:t,type:r,evaluationOptions:h}){return this.contract.readInteraction({functionName:ho.AUCTION,inputs:{name:t,type:r},evaluationOptions:h})}async getAuctions({evaluationOptions:t}={}){let{auctions:r}=await this.contract.getState({evaluationOptions:t});return r}async getPriceForInteraction({interactionName:t,payload:r,evaluationOptions:h}){let{price:o}=await this.contract.readInteraction({functionName:ho.PRICE_FOR_INTERACTION,inputs:{interactionName:t,...r},evaluationOptions:h});return o}},hk=class extends A8{signer;constructor({signer:t,...r}){if(Object.keys(r).length===0)super({contract:new ga({contractTxId:Sy})}),this.signer=t;else if(Yf(r))super({contract:r.contract}),this.signer=t;else if(Qf(r))super({contract:new ga({contractTxId:r.contractTxId})}),this.signer=t;else throw new No}async transfer({target:t,qty:r,denomination:h="IO"},o){let l=r;return h==="IO"&&typeof r=="number"&&(l=new r2(r).toMIO()),this.contract.writeInteraction({functionName:ho.TRANSFER,inputs:{target:t,qty:l.valueOf()},signer:this.signer},o)}async joinNetwork({qty:t,allowDelegatedStaking:r,delegateRewardShareRatio:h,fqdn:o,label:l,minDelegatedStake:c,note:p,port:w,properties:m,protocol:y,autoStake:v,observerWallet:M},T){return this.contract.writeInteraction({functionName:ho.JOIN_NETWORK,inputs:{qty:t.valueOf(),allowDelegatedStaking:r,delegateRewardShareRatio:h,fqdn:o,label:l,minDelegatedStake:c.valueOf(),note:p,port:w,properties:m,protocol:y,autoStake:v,observerWallet:M},signer:this.signer},T)}async updateGatewaySettings({allowDelegatedStaking:t,delegateRewardShareRatio:r,fqdn:h,label:o,minDelegatedStake:l,note:c,port:p,properties:w,protocol:m,autoStake:y,observerWallet:v},M){return this.contract.writeInteraction({functionName:ho.UPDATE_GATEWAY_SETTINGS,inputs:{allowDelegatedStaking:t,delegateRewardShareRatio:r,fqdn:h,label:o,minDelegatedStake:l?.valueOf(),note:c,port:p,properties:w,protocol:m,autoStake:y,observerWallet:v},signer:this.signer},M)}async increaseDelegateStake(t,r){return this.contract.writeInteraction({functionName:ho.DELEGATE_STAKE,inputs:{target:t.target,qty:t.qty.valueOf()},signer:this.signer},r)}async decreaseDelegateStake(t,r){return this.contract.writeInteraction({functionName:ho.DECREASE_DELEGATE_STAKE,inputs:{target:t.target,qty:t.qty.valueOf()},signer:this.signer},r)}async increaseOperatorStake(t,r){return this.contract.writeInteraction({functionName:ho.INCREASE_OPERATOR_STAKE,inputs:{qty:t.qty.valueOf()},signer:this.signer},r)}async decreaseOperatorStake(t,r){return this.contract.writeInteraction({functionName:ho.DECREASE_OPERATOR_STAKE,inputs:{qty:t.qty.valueOf()},signer:this.signer},r)}async saveObservations(t,r){return this.contract.writeInteraction({functionName:ho.SAVE_OBSERVATIONS,inputs:{observerReportTxId:t.reportTxId,failedGateways:t.failedGateways},signer:this.signer},r)}async extendLease(t,r){return this.contract.writeInteraction({functionName:ho.EXTEND_RECORD,inputs:{name:t.domain,years:t.years},signer:this.signer},r)}async increaseUndernameLimit(t,r){return this.contract.writeInteraction({functionName:ho.INCREASE_UNDERNAME_COUNT,inputs:{name:t.domain,qty:t.qty},signer:this.signer},r)}};Tt();Rt();xt();Tt();Rt();xt();var or=sc(Zot(),1);var Lie=or.default.AbortError,Die=or.default.AbstractContractHandler,$ie=or.default.ArweaveContractDefinitionLoader,Uie=or.default.ArweaveGatewayBundledContractDefinitionLoader,qie=or.default.ArweaveGatewayBundledInteractionLoader,Fie=or.default.ArweaveGatewayInteractionsLoader,jie=or.default.ArweaveWrapper,zie=or.default.Benchmark,Wie=or.default.CacheKey,Kie=or.default.CacheableInteractionsLoader,Hie=or.default.CacheableStateEvaluator,Gie=or.default.ConsoleLogger,Vie=or.default.ConsoleLoggerFactory,Zie=or.default.ContractCache,Jie=or.default.ContractCallRecord,Xie=or.default.ContractError,Yie=or.default.ContractInteractionState,Qie=or.default.ContractMetadata,tne=or.default.CustomEvent,ene=or.default.DEFAULT_LEVEL_DB_LOCATION,rne=or.default.DefaultEvaluationOptions,ine=or.default.DefaultStateEvaluator,nne=or.default.EvalStateResult,one=or.default.EvaluationOptionsEvaluator,ane=or.default.HandlerBasedContract,sne=or.default.HandlerExecutorFactory,hne=or.default.InnerWritesEvaluator,fne=or.default.InteractionCall,une=or.default.InteractionCompleteEvent,cne=or.default.InteractionInput,lne=or.default.InteractionOutput,dne=or.default.JsHandlerApi,pne=or.default.KV,gne=or.default.KnownErrors,mne=or.default.LevelDbCache,vne=or.default.LexicographicalInteractionsSorter,yne=or.default.LogLevelOrder,Jot=or.default.LoggerFactory,bne=or.default.MemCache,wne=or.default.NetworkCommunicationError,_ne=or.default.NonWhitelistedSourceError,Mne=or.default.PstContractImpl,Sne=or.default.REGISTER_PROVIDER,Ene=or.default.SMART_WEAVE_TAGS,Ane=or.default.SUPPORTED_SRC_CONTENT_TYPES,Tne=or.default.SWBlock,xne=or.default.SWTransaction,Rne=or.default.SWVrf,Xot=or.default.Signature,kne=or.default.SmartWeaveError,Ine=or.default.SmartWeaveErrorType,Bne=or.default.SmartWeaveGlobal,One=or.default.SortKeyCacheResult,Cne=or.default.SourceType,Pne=or.default.SrcCache,Yot=or.default.Tag,Nne=or.default.TagsParser,Lne=or.default.Transaction,Dne=or.default.WARP_GW_URL,$ne=or.default.WARP_TAGS,Une=or.default.Warp,qne=or.default.WarpBuilder,Qot=or.default.WarpFactory,Fne=or.default.WarpFetchWrapper,jne=or.default.WarpGatewayContractDefinitionLoader,zne=or.default.WarpGatewayInteractionsLoader,Wne=or.default.WasmHandlerApi,Kne=or.default.WasmSrc,Hne=or.default.arrayToHex,Gne=or.default.asc,Vne=or.default.ascS,Zne=or.default.bufToBn,Jne=or.default.bundledTxsFilter,Xne=or.default.checkJsSrc,Yne=or.default.createDummyTx,Qne=or.default.createInteractionTagsList,toe=or.default.createInteractionTx,eoe=or.default.deepCopy,roe=or.default.defaultArweaveMs,tat=or.default.defaultCacheOptions,ioe=or.default.defaultWarpGwOptions,noe=or.default.desc,ooe=or.default.descS,aoe=or.default.emptyTransfer,soe=or.default.genesisSortKey,hoe=or.default.getJsonResponse,foe=or.default.indent,uoe=or.default.isBrowser,coe=or.default.isTxIdValid,loe=or.default.knownWarpPlugins,doe=or.default.knownWarpPluginsPartial,poe=or.default.lastPossibleSortKey,goe=or.default.lvlToOrder,moe=or.default.mapReplacer,voe=or.default.mapReviver,yoe=or.default.matchMutClosureDtor,boe=or.default.normalizeContractSource,woe=or.default.rustWasmImports,_oe=or.default.safeGet,Moe=or.default.safeParseInt,Soe=or.default.sleep,Eoe=or.default.sortingFirst,Aoe=or.default.sortingLast,Toe=or.default.stripTrailingSlash,xoe=or.default.timeout;Tt();Rt();xt();qx();var fkt="+",ukt="/",ckt="-",lkt="_",dkt="=";function pkt(i){return i.replaceAll(fkt,ckt).replaceAll(ukt,lkt).replaceAll(dkt,"")}function wv(i){let t=i.toString("base64");return pkt(t)}function eat(i){return wv(Ux("sha256").update(i).digest())}Tt();Rt();xt();var rat=Qot.forMainnet({...tat,inMemory:!0},!0,S8);Jot.INST.logLevel("error");var ga=class{contract;contractTxId;cacheUrl;logger;warp;constructor({contractTxId:t,cacheUrl:r="https://api.arns.app",warp:h=rat,logger:o=new pa({level:"info"})}){this.contractTxId=t,this.contract=h.contract(t),this.cacheUrl=r,this.warp=h,this.logger=o}configuration(){return{contractTxId:this.contractTxId,cacheUrl:this.cacheUrl}}async createWarpSigner(t){return t.publicKey===void 0&&"setPublicKey"in t&&await t.setPublicKey(),new Xot(this.warp,{signer:async h=>{h.setOwner(wv(t.publicKey));let o=await h.getSignatureData(),l=await t.sign(o),c=ge.from(l),p=eat(c);h.setSignature({id:p,owner:wv(t.publicKey),signature:wv(c)})},type:"arweave"})}async getState({evaluationOptions:t={}}){await this.ensureContractInit();let r=t?.evalTo,h;r&&"sortKey"in r?h=r.sortKey:r&&"blockHeight"in r&&(h=r.blockHeight);let o=await this.contract.readState(h);if(!o.cachedValue.state)throw new Hl(502,"Failed to evaluate contract state");return o.cachedValue.state}async ensureContractInit({signer:t}={}){this.logger.debug("Checking contract initialized",{contractTxId:this.contractTxId}),this.logger.debug("Fetching contract manifest",{contractTxId:this.contractTxId});let{evaluationOptions:r={}}=await BL({arweave:this.warp.arweave,contractTxId:this.contractTxId});this.contract.setEvaluationOptions(r),t&&this.contract.connect(await this.createWarpSigner(t)),this.cacheUrl!==void 0&&(this.logger.debug("Syncing contract state",{contractTxId:this.contractTxId,remoteCacheUrl:this.cacheUrl}),await this.contract.syncState(`${this.cacheUrl}/v1/contract/${this.contractTxId}`,{validity:!0}))}async readInteraction({functionName:t,inputs:r}){await this.ensureContractInit(),this.logger.debug(`Read interaction: ${t}`,{contractTxId:this.contractTxId,inputs:r});let h=await this.contract.viewState({function:t,...r});if(h.result===void 0)throw new Hl(502,"Failed to evaluate contract read interaction: "+JSON.stringify({error:h.errorMessage,functionName:t,inputs:r},null,2));return this.logger.debug("Successfully evaluated contract read interaction",{contractTxId:this.contractTxId,result:h.result}),h.result}async writeInteraction({functionName:t,inputs:r,signer:h},o){try{this.logger.debug(`Write interaction: ${t}`,{contractTxId:this.contractTxId}),await this.ensureContractInit({signer:h});let l=await this.contract.dryWrite({function:t,...r});if(l.type!=="ok")throw new Error(`Failed to dry write contract interaction ${t}: ${l.errorMessage}`);let c=await this.contract.writeInteraction({function:t,...r},{disableBundling:!0,tags:o?.tags?.map(p=>new Yot(p.name,p.value))});if(!c?.interactionTx)throw new Error(`Failed to write contract interaction: ${t}`);return this.logger.debug("Successfully wrote contract interaction",{contractTxId:this.contractTxId,interactionTxId:c.originalTxId}),c.interactionTx}catch(l){throw this.logger.error(`Failed to write contract interaction: ${l.message}`,{contractTxId:this.contractTxId}),new a1(l)}}};Tt();Rt();xt();var z2=class{process;constructor(t){if(Rl(t))this.process=t.process;else if(kl(t))this.process=new Ys({processId:t.processId});else throw new No}async getState(){let t=[{name:"Action",value:"State"}];return await this.process.read({tags:t})}async getInfo(){let t=[{name:"Action",value:"Info"}];return await this.process.read({tags:t})}async getRecord({undername:t}){let r=[{name:"Sub-Domain",value:t},{name:"Action",value:"Record"}];return await this.process.read({tags:r})}async getRecords(){let t=[{name:"Action",value:"Records"}];return await this.process.read({tags:t})}async getOwner(){return(await this.getInfo()).Owner}async getControllers(){let t=[{name:"Action",value:"Controllers"}];return await this.process.read({tags:t})}async getName(){return(await this.getInfo()).Name}async getTicker(){return(await this.getInfo()).Ticker}async getBalances(){let t=[{name:"Action",value:"Balances"}];return await this.process.read({tags:t})}async getBalance({address:t}){let r=[{name:"Action",value:"Balance"},{name:"Recipient",value:t}];return await this.process.read({tags:r})}},L6=class extends z2{signer;constructor({signer:t,...r}){super(r),this.signer=t}async transfer({target:t}){let r=[{name:"Action",value:"Transfer"},{name:"Recipient",value:t}];return this.process.send({tags:r,data:{},signer:this.signer})}async addController({controller:t}){let r=[{name:"Action",value:"Add-Controller"},{name:"Controller",value:t}];return this.process.send({tags:r,data:{},signer:this.signer})}async removeController({controller:t}){let r=[{name:"Action",value:"Remove-Controller"},{name:"Controller",value:t}];return this.process.send({tags:r,data:{},signer:this.signer})}async setRecord({undername:t,transactionId:r,ttlSeconds:h}){return this.process.send({tags:[{name:"Action",value:"Set-Record"},{name:"Sub-Domain",value:t},{name:"Transaction-Id",value:r},{name:"TTL-Seconds",value:h.toString()}],data:{transactionId:r,ttlSeconds:h},signer:this.signer})}async removeRecord({undername:t}){return this.process.send({tags:[{name:"Action",value:"Remove-Record"},{name:"Sub-Domain",value:t}],data:{undername:t},signer:this.signer})}async setTicker({ticker:t}){return this.process.send({tags:[{name:"Action",value:"Set-Ticker"},{name:"Ticker",value:t}],data:{ticker:t},signer:this.signer})}async setName({name:t}){return this.process.send({tags:[{name:"Action",value:"Set-Name"},{name:"Name",value:t}],data:{name:t},signer:this.signer})}};var export_ArconnectSigner=iat.ArconnectSigner;var export_ArweaveSigner=iat.ArweaveSigner;export{j2 as ANT,N6 as ANTReadable,Y9 as ANTWritable,cc as ANT_CONTRACT_FUNCTIONS,RL as ANT_LUA_ID,Ys as AOProcess,xL as AOS_MODULE_ID,Gkt as ARNS_DEVNET_REGISTRY_TX,Sy as ARNS_TESTNET_REGISTRY_TX,AL as ARWEAVE_TX_REGEX,ho as AR_IO_CONTRACT_FUNCTIONS,s1 as AbortError,z2 as AoANTReadable,L6 as AoANTWriteable,Let as ArIO,A8 as ArIOReadable,hk as ArIOWritable,Cet as ArNSEventEmitter,export_ArconnectSigner as ArconnectSigner,export_ArweaveSigner as ArweaveSigner,aF as BadRequest,wh as BaseError,kL as DEFAULT_SCHEDULER_ID,EL as DENOMINATIONS,pa as DefaultLogger,Hkt as FQDN_REGEX,Hl as FailedRequestError,Am as IO,M8 as IOReadable,r2 as IOToken,sk as IOWriteable,Ost as IO_DEVNET_PROCESS_ID,Vkt as IO_TESTNET_PROCESS_ID,No as InvalidContractConfigurationError,hF as InvalidProcessConfigurationError,sF as InvalidSignerError,h1 as MAX_REQUEST_SIZE,W5 as MIO_PER_IO,O6 as NotFound,Gl as RemoteContract,TL as SORT_KEY_REGEX,G5 as SmartWeaveSortKey,C6 as UnknownError,ga as WarpContract,a1 as WriteInteractionError,oF as createAxiosInstance,gHt as getANTProcessesOwnedByWallet,BL as getContractManifest,zqt as getContractsTransferredToOrControlledByWallet,Fqt as getSmartweaveContractsFromGQL,jqt as getSmartweaveTransactionsFromGQL,$kt as ioContractInteractions,Ist as ioContractReadInteractions,Bst as ioContractWriteInteractions,Od as ioDevnetProcessId,oIt as isBlockHeight,Yf as isContractConfiguration,Qf as isContractTxIdConfiguration,lIt as isLeasedArNSRecord,Rl as isProcessConfiguration,kl as isProcessIdConfiguration,RIt as isSortKey,aIt as isTransaction,H5 as mIOToken,ak as safeDecode,PHt as spawnANT,IL as tagsToObject,Ey as validateArweaveId};
|
|
380
380
|
/*! Bundled license information:
|
|
381
381
|
|
|
382
382
|
@jspm/core/nodelibs/browser/buffer.js:
|