@dcl/governance-site 2.0.0 → 2.0.1-20995780683.commit-d6baf5e

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.
Files changed (77) hide show
  1. package/assets/BlockOverrides-9837a6f9.js +5 -0
  2. package/assets/ConstantsUtil-298f7898.js +1 -0
  3. package/assets/ExchangeController-d2354ec6.js +1 -0
  4. package/assets/HelpersUtil-8cddb046.js +62 -0
  5. package/assets/MathUtil-b514a570.js +1 -0
  6. package/assets/NavigationUtil-a0d0ce87.js +1 -0
  7. package/assets/NetworkUtil-220ea128.js +1 -0
  8. package/assets/PhWallet-fd2006d2.js +14 -0
  9. package/assets/{features-b72c9430.js → ReownAuthentication-468828df.js} +4 -4
  10. package/assets/SwapController-7bfd6ce7.js +1 -0
  11. package/assets/{UserAvatar-78751cb5.js → UserAvatar-456716f1.js} +1 -1
  12. package/assets/ccip-ddcec720.js +1 -0
  13. package/assets/data-capture-3e424a2c.js +242 -0
  14. package/assets/email-ea617f9c.js +90 -0
  15. package/assets/embedded-wallet-814bf005.js +410 -0
  16. package/assets/features-fd521597.js +1 -0
  17. package/assets/fortmatic-f3cb4aa6.js +13 -0
  18. package/assets/if-defined-0a35f675.js +5 -0
  19. package/assets/index-034d22a0.js +138 -0
  20. package/assets/{index-a8255d1c.css → index-05771666.css} +4 -4
  21. package/assets/index-07a61b45.js +51 -0
  22. package/assets/index-1039ded0.js +132 -0
  23. package/assets/index-123c1362.js +224 -0
  24. package/assets/index-15bbaaa0.js +7 -0
  25. package/assets/{index-073512a1.js → index-206e3e77.js} +1 -1
  26. package/assets/index-27a991e4.js +53 -0
  27. package/assets/index-2d0efdd2.js +210 -0
  28. package/assets/index-32d53c87.js +189 -0
  29. package/assets/index-3b861a37.js +102 -0
  30. package/assets/index-4207595b.js +100 -0
  31. package/assets/index-4243d275.js +43 -0
  32. package/assets/index-42ce7246.js +63 -0
  33. package/assets/index-47e87339.js +152 -0
  34. package/assets/index-48bd3fca.js +277 -0
  35. package/assets/index-49cc5044.js +46 -0
  36. package/assets/index-5788a0d6.js +468 -0
  37. package/assets/index-5824c226.js +81 -0
  38. package/assets/index-5da565ce.js +78 -0
  39. package/assets/index-685e7949.js +425 -0
  40. package/assets/index-84e8ecf6.js +647 -0
  41. package/assets/index-965fdf98.js +3425 -0
  42. package/assets/index-9d970383.js +152 -0
  43. package/assets/index-a59b6662.js +68 -0
  44. package/assets/index-b457d047.js +1062 -0
  45. package/assets/index-b65e06cc.js +27 -0
  46. package/assets/{index-2ef9f1d1.js → index-d70e4ab8.js} +66 -66
  47. package/assets/index-d7a6ceea.js +30 -0
  48. package/assets/index-d9c55c27.js +77 -0
  49. package/assets/index-db5b7889.js +77 -0
  50. package/assets/index-e3222791.js +78 -0
  51. package/assets/index-eb060c20.js +1 -0
  52. package/assets/index-f3f03959.js +90 -0
  53. package/assets/index-fcda68c9.js +19 -0
  54. package/assets/index-ff4dea43.js +85 -0
  55. package/assets/networks-14f3c0d2.js +1 -0
  56. package/assets/onramp-dcdb1a34.js +422 -0
  57. package/assets/pay-with-exchange-a64f18a3.js +280 -0
  58. package/assets/receive-ca7bc867.js +131 -0
  59. package/assets/ref-88e1be05.js +13 -0
  60. package/assets/send-8739c9fb.js +554 -0
  61. package/assets/socials-ccc593f5.js +250 -0
  62. package/assets/swaps-0a90eb06.js +1050 -0
  63. package/assets/transactions-bb8cb277.js +16 -0
  64. package/assets/{tslib.es6-82b9ba96.js → tslib.es6-db2ec995.js} +2 -2
  65. package/assets/w3m-modal-869dafbc.js +891 -0
  66. package/assets/zoraTestnet-adc7b76b.js +36 -0
  67. package/index.html +4 -4
  68. package/package.json +3 -3
  69. package/assets/basic-ca749c4c.js +0 -1435
  70. package/assets/core-806d78ea.js +0 -249
  71. package/assets/fortmatic-12e0f2e5.js +0 -13
  72. package/assets/index-372705ba.js +0 -1321
  73. package/assets/index-4be588a0.js +0 -94
  74. package/assets/index-74e34dfb.js +0 -39
  75. package/assets/index-bbb36593.js +0 -7
  76. package/assets/index-c1c8440f.js +0 -47
  77. package/assets/w3m-modal-26eff9d9.js +0 -1209
@@ -0,0 +1,90 @@
1
+ var GA=Object.defineProperty;var zA=(e,t,r)=>t in e?GA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var fr=(e,t,r)=>(zA(e,typeof t!="symbol"?t+"":t,r),r),th=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var be=(e,t,r)=>(th(e,t,"read from private field"),r?r.call(e):t.get(e)),Bt=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},xt=(e,t,r,n)=>(th(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var pl=(e,t,r,n)=>({set _(s){xt(e,t,s,r)},get _(){return be(e,t,n)}}),mt=(e,t,r)=>(th(e,t,"access private method"),r);import{z as WA,A as YA,C as ZA,H as D7,M as JA,D as XA,E as QA,N as eS,O as tS,T as rS,W as nS,Z as iS,F as Gy,G as C0,I as yf,J as ga,K as B7,L as iy,U as O7,P as fm,Q as qt,R as $n,S as I0,V as Gr,X as $0,Y as Gs,$ as H0,a0 as zy,a1 as Wy,a2 as lo,a3 as M7,a4 as N7,a5 as Cs,a6 as U7,a7 as sy,a8 as fo,a9 as L7,aa as K7,ab as F7,ac as sS,ad as aS,ae as oS,af as cS,ag as uS,ah as q7,ai as j7,aj as cd,ak as lS,al as dS,am as fS,an as hS,ao as pS,ap as yS,aq as gS,ar as mS,as as vS,at as bS,au as _S,av as wS,aw as ES,ax as AS,ay as SS,az as PS,aA as xS,aB as TS,aC as CS,aD as IS,aE as kS,aF as RS,aG as DS,aH as BS,aI as OS,aJ as MS,aK as NS,aL as US,aM as LS,aN as KS,aO as FS,aP as qS,aQ as jS,aR as $S,aS as HS,aT as VS,aU as GS,aV as zS,aW as WS,aX as YS,aY as ZS,aZ as JS,a_ as XS,a$ as QS,b0 as eP,b1 as tP,b2 as rP,b3 as nP,b4 as iP,b5 as sP,b6 as aP,b7 as oP,b8 as cP,b9 as uP,ba as lP,bb as dP,bc as fP,bd as hP,be as pP,bf as yP,bg as gP,bh as mP,bi as vP,bj as bP,bk as _P,bl as wP,bm as EP,bn as AP,bo as SP,bp as PP,bq as xP,br as TP,bs as $7,bt as H7,bu as V7,bv as G7,bw as z7,bx as W7,by as Y7,bz as Z7,bA as J7,bB as X7,a as gf,c as rt,bC as ka,l as xa,B as ot,b as Mr,k as Q7,bD as CP,bE as IP,s as kP,bF as RP,bG as DP,w as BP,m as OP,bH as MP,g as NP}from"./index-d70e4ab8.js";import{d as He,e as e9,r as UP,a as LP,c as Hn,b as KP}from"./tslib.es6-db2ec995.js";import{y as FP,C as qP,D as jP,E as $P,F as HP,G as VP,J as GP,K as zP,L as WP,M as YP,N as ZP,O as JP,P as XP,Q as QP,R as ex,S as tx,T as rx,U as nx,V as ix,W as sx,X as ax,Y as ox,Z as cx,_ as ux,$ as lx,a0 as dx,a1 as fx,a2 as hx,a3 as px,a4 as yx,a5 as gx,a6 as mx,a7 as vx,a8 as bx,a9 as _x,aa as wx,ab as Ex,ac as Ax,ad as Sx,ae as Px,af as xx,ag as Tx,ah as Cx,ai as Ix,aj as kx,ak as Rx,an as Dx,al as Bx,ao as Ox,ap as Mx,am as Nx,aq as Ux,ar as Lx,as as Kx,at as Fx,au as qx,av as jx,aw as $x,ax as Hx,ay as Vx,az as Gx,aA as zx,aH as Wx,aI as Yx,aB as Zx,aC as Jx,aD as Xx,aE as Qx,aF as eT,aG as tT,aJ as rT,aK as nT,aL as iT,aO as sT,aM as aT,aN as oT,aP as cT,aQ as uT,aR as lT,aS as dT,aT as fT,aU as hT,aV as pT,aW as yT,aX as gT,aY as mT,aZ as vT,a_ as bT,a$ as _T,b0 as wT,b1 as ET,b2 as AT,b3 as ST,b4 as PT,b5 as xT,b6 as TT,b7 as CT,b8 as IT,b9 as kT,ba as RT,bb as DT,bc as BT,bd as OT,be as MT,bf as NT,bg as UT,bh as LT,bi as KT,bj as FT,bk as qT,bl as jT,bm as $T,bn as HT,bo as VT,bp as GT,bq as zT,br as WT,bs as YT,bt as ZT,bu as JT,bv as XT,bw as QT,bx as eC,by as tC,bz as rC,bA as nC,bB as iC,bC as sC,bD as aC,bE as oC,bF as cC,bG as uC,bH as lC,bI as dC,bJ as fC,bK as hC,bL as pC,bM as yC,bN as gC,bO as mC,bP as vC,bQ as bC,bR as _C,bS as wC,bT as EC,bU as AC,bV as SC,bW as PC,bX as xC,bY as TC,bZ as CC,b_ as IC,b$ as kC,c0 as RC,c1 as DC,c2 as BC,c3 as OC,c4 as MC,c5 as NC,c6 as UC,c7 as LC,c8 as KC,c9 as FC,ca as qC,cb as jC,cc as $C,cd as HC,ce as VC,cf as GC,cg as zC,ch as WC,ci as YC,cj as ZC,ck as JC,cl as XC,cm as QC,cn as eI,co as tI,cp as rI,cq as nI,cr as iI,cs as sI,ct as aI,cu as oI,cv as cI,cw as uI,cx as lI,cy as dI,cz as fI,x as hI,cA as pI,cB as yI,cC as gI,cD as mI,cE as vI,cF as bI,cG as _I,cH as wI,cI as EI,cJ as AI,cK as SI,cM as PI,cL as xI,fi as TI,cN as CI,cO as II,cP as kI,cQ as RI,cR as DI,cS as BI,cT as OI,cU as MI,cV as NI,cW as UI,cX as LI,cY as KI,cZ as FI,c_ as qI,c$ as jI,d0 as $I,d1 as HI,d2 as VI,d3 as GI,d4 as zI,d7 as WI,d5 as YI,d6 as ZI,d8 as JI,d9 as XI,da as QI,db as ek,dc as tk,dd as rk,de as nk,df as ik,dg as sk,dh as ak,di as ok,dj as ck,dk as uk,dl as lk,dm as dk,dn as fk,dp as hk,dq as pk,dr as yk,ds as gk,dt as mk,du as vk,dv as bk,dw as _k,dx as wk,dy as Ek,dz as Ak,dA as Sk,dB as Pk,dC as xk,dD as Tk,dE as Ck,dF as Ik,dG as kk,dH as Rk,dI as Dk,dJ as Bk,dK as Ok,dL as hm,dM as Mk,e0 as Nk,dN as Uk,dO as Lk,dP as Kk,dQ as Fk,dR as qk,dS as jk,dT as $k,dU as Hk,dV as Vk,dW as Gk,dX as zk,dY as Wk,dZ as Yk,d_ as Zk,d$ as Jk,e1 as Xk,e2 as Qk,e3 as eR,e4 as tR,e5 as rR,e6 as nR,e7 as iR,e8 as sR,e9 as aR,ea as oR,eb as cR,ec as uR,ed as lR,ee as dR,ef as fR,eg as hR,ei as pR,ej as yR,ek as gR,el as mR,eh as vR,em as bR,en as _R,eo as wR,ep as ER,eq as AR,er as SR,es as PR,et as xR,eu as TR,ev as CR,ew as IR,ex as kR,ey as RR,ez as DR,eA as BR,eB as OR,eC as MR,eD as NR,eE as UR,eF as LR,eG as KR,eH as FR,eI as qR,eJ as jR,eK as $R,eL as HR,eM as VR,eN as GR,eO as zR,eP as WR,eQ as YR,eR as ZR,eS as JR,eT as XR,eU as QR,eV as eD,eW as tD,eX as rD,eY as nD,eZ as iD,e_ as sD,e$ as aD,f0 as oD,f1 as cD,f2 as uD,f3 as lD,f4 as dD,f5 as fD,f6 as hD,f7 as pD,f8 as yD,f9 as gD,fa as mD,fb as vD,fc as bD,fd as _D,fe as wD,ff as ED,fg as AD,fh as SD,fj as PD,fk as xD,fl as TD,fm as CD,fn as ID,fo as kD,fp as RD,fq as DD,fr as BD,fs as OD,ft as MD,fu as ND,fv as UD,fw as LD,fx as KD,fy as FD,fz as qD,fA as jD,fB as $D,fC as HD,fD as VD,fE as GD,fF as zD,fG as WD,fH as YD,fI as ZD,fJ as JD,fK as XD,fL as QD,fM as eB,fN as tB,fO as rB,fP as nB,fQ as iB,fR as sB,fS as aB,fT as oB,fU as cB,fV as uB,fW as lB,fX as dB,fY as fB,fZ as hB,f_ as pB,f$ as yB,g0 as gB,g1 as mB,g2 as vB,g3 as bB,g4 as _B,g5 as wB,g6 as EB,g7 as AB,g8 as SB,g9 as PB,ga as xB,gb as TB,gc as CB,gd as IB,ge as kB,gf as RB,gg as DB,gh as BB,gi as OB,gj as MB,gk as NB,gl as UB,gm as LB,gn as KB,go as FB,gp as qB,gq as jB,gr as $B,gs as HB,gt as VB,gu as GB,gv as zB,gw as WB,gx as YB,gy as ZB,gz as JB,gA as XB,gB as QB,gC as eO,gD as tO,gE as rO,gF as nO,gG as iO,gH as sO,gI as aO,gJ as oO,gK as cO,gL as uO,gM as lO,gO as dO,gP as fO,gN as hO,gQ as pO,gR as yO,gS as gO,gT as mO,gU as vO,gV as bO,gW as _O,gX as wO,gY as EO,gZ as AO,g_ as SO,g$ as PO,h0 as xO,h1 as TO,h2 as CO,h3 as IO,h4 as kO,h5 as RO,h6 as DO,h7 as BO,h8 as OO,h9 as MO,ha as NO,hb as UO,hc as LO,hd as KO,he as FO,hf as qO,hg as jO,hh as $O,hi as HO,hj as VO,hk as GO,hl as zO,hn as WO,hm as YO,ho as ZO,hp as JO,hq as XO,hr as QO,hs as eM,ht as tM,hu as rM,hv as nM,hw as iM,hx as sM,hy as aM,hz as oM,hA as cM,hB as uM,hC as lM,hP as dM,hQ as fM,hD as hM,hE as pM,hF as yM,hG as gM,hH as mM,hI as vM,hJ as bM,hK as _M,hL as wM,hM as EM,hN as AM,hO as SM,hR as PM,hS as xM,hT as TM,hU as CM,hV as IM,hW as kM,hX as RM,hY as DM,hZ as BM,h_ as OM,h$ as MM,i0 as NM,i1 as UM,i2 as LM,i3 as KM,i4 as FM,i5 as qM,i6 as jM,i7 as $M,i8 as HM,i9 as pm,ia as VM,ib as GM,ic as zM,id as WM,ie as YM,ig as ZM,ih as JM,ii as XM,ij as QM,ik as eN,il as tN,im as rN,io as nN,ip as iN,iq as sN,ir as aN,is as oN,it as cN,iu as uN,iv as lN,iw as dN,ix as fN,iy as hN,iz as pN,iA as yN,iB as gN,iC as mN,iD as vN,iE as bN,iF as _N,iG as wN,iH as EN,iI as AN,iJ as SN,iK as PN,iL as xN,iM as TN,iN as CN,iO as IN,iP as kN,iQ as RN,iR as DN,iS as BN,iT as ON,iU as MN,iV as NN,iW as UN,iX as LN,iY as KN,iZ as FN,i_ as qN,i$ as jN,j0 as $N,j1 as HN,j2 as VN,j3 as GN,j4 as zN,j5 as WN,j6 as YN,j7 as ZN,j8 as JN,j9 as XN,ja as QN,jb as eU,jc as tU,jd as rU,je as nU,jf as iU,jg as sU,jh as aU,ji as oU,jj as cU,jk as uU,jl as lU,jm as dU,jn as fU,jo as hU,jp as pU,jq as yU,jr as gU,ju as mU,js as vU,jt as bU,jA as ym,jz as _U,jv as wU,jw as EU,jx as AU,jy as SU,jB as PU,jC as xU,jD as TU,jE as CU,jF as IU,jJ as kU,jG as RU,jH as DU,jI as BU,jK as OU,jL as MU,jM as NU,jN as UU,z as LU,u as KU,v as FU,w as qU,jO as jU,jP as $U,jQ as HU,jR as VU,jS as GU,jT as zU,jU as WU,jV as YU,jW as ZU,jX as JU,jY as XU,jZ as QU,j_ as eL,j$ as gm,k0 as mm,k4 as vm,k5 as bm,k1 as tL,k2 as rL,k3 as nL,k6 as iL,k7 as sL,k8 as aL}from"./zoraTestnet-adc7b76b.js";import{r as Ra}from"./index-4243d275.js";function oL(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const cL=Object.freeze(Object.defineProperty({__proto__:null,decode:WA,encode:YA},Symbol.toStringTag,{value:"Module"})),uL="Ξ",t9=Object.freeze(Object.defineProperty({__proto__:null,AddressZero:ZA,EtherSymbol:uL,HashZero:D7,MaxInt256:JA,MaxUint256:XA,MinInt256:QA,NegativeOne:eS,One:tS,Two:rS,WeiPerEther:nS,Zero:iS},Symbol.toStringTag,{value:"Module"}));function lL(e){const t=Gy(e);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return C0(yf([t,D7]).slice(0,32))}function dL(e){const t=ga(e);if(t.length!==32)throw new Error("invalid bytes32 - not 32 bytes long");if(t[31]!==0)throw new Error("invalid bytes32 string - no null terminator");let r=31;for(;t[r-1]===0;)r--;return B7(t.slice(0,r))}function fL(e){if(e.length%4!==0)throw new Error("bad data");let t=[];for(let r=0;r<e.length;r+=4)t.push(parseInt(e.substring(r,r+4),16));return t}function Yy(e,t){t||(t=function(s){return[parseInt(s,16)]});let r=0,n={};return e.split(",").forEach(s=>{let i=s.split(":");r+=parseInt(i[0],16),n[r]=t(i[1])}),n}function r9(e){let t=0;return e.split(",").map(r=>{let n=r.split("-");n.length===1?n[1]="0":n[1]===""&&(n[1]="1");let s=t+parseInt(n[0],16);return t=parseInt(n[1],16),{l:s,h:t}})}function Zy(e,t){let r=0;for(let n=0;n<t.length;n++){let s=t[n];if(r+=s.l,e>=r&&e<=r+s.h&&(e-r)%(s.d||1)===0){if(s.e&&s.e.indexOf(e-r)!==-1)continue;return s}}return null}const hL=r9("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),pL="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(e=>parseInt(e,16)),yL=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],gL=Yy("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),mL=Yy("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),vL=Yy("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",fL),bL=r9("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function _L(e){return e.reduce((t,r)=>(r.forEach(n=>{t.push(n)}),t),[])}function wL(e){return!!Zy(e,hL)}function EL(e){let t=Zy(e,yL);if(t)return[e+t.s];let r=gL[e];if(r)return r;let n=mL[e];if(n)return[e+n[0]];let s=vL[e];return s||null}function AL(e){return!!Zy(e,bL)}function SL(e){if(e.match(/^[a-z0-9-]*$/i)&&e.length<=59)return e.toLowerCase();let t=iy(e);t=_L(t.map(n=>{if(pL.indexOf(n)>=0)return[];if(n>=65024&&n<=65039)return[];let s=EL(n);return s||[n]})),t=iy(fm(t),O7.NFKC),t.forEach(n=>{if(AL(n))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")}),t.forEach(n=>{if(wL(n))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")});let r=fm(t);if(r.substring(0,1)==="-"||r.substring(2,4)==="--"||r.substring(r.length-1)==="-")throw new Error("invalid hyphen");return r}let p0=null;try{if(p0=WebSocket,p0==null)throw new Error("inject please")}catch{const t=new qt($n);p0=function(){t.throwError("WebSockets not supported in this environment",qt.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var rh=globalThis&&globalThis.__awaiter||function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(l){try{c(n.next(l))}catch(u){o(u)}}function f(l){try{c(n.throw(l))}catch(u){o(u)}}function c(l){l.done?i(l.value):s(l.value).then(a,f)}c((n=n.apply(e,t||[])).next())})};const yl=new qt($n);let PL=1;class mf extends I0{constructor(t,r){r==="any"&&yl.throwError("WebSocketProvider does not support 'any' network yet",qt.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof t=="string"?super(t,r):super("_websocket",r),this._pollingInterval=-1,this._wsReady=!1,typeof t=="string"?Gr(this,"_websocket",new p0(this.connection.url)):Gr(this,"_websocket",t),Gr(this,"_requests",{}),Gr(this,"_subs",{}),Gr(this,"_subIds",{}),Gr(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(s=>{this.websocket.send(this._requests[s].payload)})},this.websocket.onmessage=s=>{const i=s.data,o=JSON.parse(i);if(o.id!=null){const a=String(o.id),f=this._requests[a];if(delete this._requests[a],o.result!==void 0)f.callback(null,o.result),this.emit("debug",{action:"response",request:JSON.parse(f.payload),response:o.result,provider:this});else{let c=null;o.error?(c=new Error(o.error.message||"unknown error"),Gr(c,"code",o.error.code||null),Gr(c,"response",i)):c=new Error("unknown error"),f.callback(c,void 0),this.emit("debug",{action:"response",error:c,request:JSON.parse(f.payload),provider:this})}}else if(o.method==="eth_subscription"){const a=this._subs[o.params.subscription];a&&a.processFunc(o.params.result)}else console.warn("this should not happen")};const n=setInterval(()=>{this.emit("poll")},1e3);n.unref&&n.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(t){yl.throwError("cannot reset events block on WebSocketProvider",qt.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(t){yl.throwError("cannot set polling interval on WebSocketProvider",qt.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return rh(this,void 0,void 0,function*(){return null})}set polling(t){t&&yl.throwError("cannot set polling on WebSocketProvider",qt.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(t,r){const n=PL++;return new Promise((s,i)=>{function o(f,c){return f?i(f):s(c)}const a=JSON.stringify({method:t,params:r,id:n,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(a),provider:this}),this._requests[String(n)]={callback:o,payload:a},this._wsReady&&this.websocket.send(a)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(t,r,n){return rh(this,void 0,void 0,function*(){let s=this._subIds[t];s==null&&(s=Promise.all(r).then(o=>this.send("eth_subscribe",o)),this._subIds[t]=s);const i=yield s;this._subs[i]={tag:t,processFunc:n}})}_startEvent(t){switch(t.type){case"block":this._subscribe("block",["newHeads"],r=>{const n=$0.from(r.number).toNumber();this._emitted.block=n,this.emit("block",n)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],r=>{this.emit("pending",r)});break;case"filter":this._subscribe(t.tag,["logs",this._getFilter(t.filter)],r=>{r.removed==null&&(r.removed=!1),this.emit(t.filter,this.formatter.filterLog(r))});break;case"tx":{const r=n=>{const s=n.hash;this.getTransactionReceipt(s).then(i=>{i&&this.emit(s,i)})};r(t),this._subscribe("tx",["newHeads"],n=>{this._events.filter(s=>s.type==="tx").forEach(r)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",t);break}}_stopEvent(t){let r=t.tag;if(t.type==="tx"){if(this._events.filter(s=>s.type==="tx").length)return;r="tx"}else if(this.listenerCount(t.event))return;const n=this._subIds[r];n&&(delete this._subIds[r],n.then(s=>{this._subs[s]&&(delete this._subs[s],this.send("eth_unsubscribe",[s]))}))}destroy(){return rh(this,void 0,void 0,function*(){this.websocket.readyState===p0.CONNECTING&&(yield new Promise(t=>{this.websocket.onopen=function(){t(!0)},this.websocket.onerror=function(){t(!1)}})),this.websocket.close(1e3)})}}const _m=new qt($n),ud="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class n9 extends mf{constructor(t,r){const n=new Jy(t,r),s=n.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(s,n.network),Gr(this,"apiKey",n.apiKey)}isCommunityResource(){return this.apiKey===ud}}class Jy extends Gs{static getWebSocketProvider(t,r){return new n9(t,r)}static getApiKey(t){return t==null?ud:(t&&typeof t!="string"&&_m.throwArgumentError("invalid apiKey","apiKey",t),t)}static getUrl(t,r){let n=null;switch(t.name){case"homestead":n="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":n="eth-goerli.g.alchemy.com/v2/";break;case"sepolia":n="eth-sepolia.g.alchemy.com/v2/";break;case"matic":n="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":n="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":n="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":n="arb-goerli.g.alchemy.com/v2/";break;case"arbitrum-sepolia":n="arb-sepolia.g.alchemy.com/v2/";break;case"optimism":n="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":n="opt-goerli.g.alchemy.com/v2/";break;case"optimism-sepolia":n="opt-sepolia.g.alchemy.com/v2/";break;default:_m.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+n+r,throttleCallback:(s,i)=>(r===ud&&H0(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===ud}}const xL=new qt($n),gl="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function TL(e){switch(e){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"sepolia":return"rpc.ankr.com/eth_sepolia/";case"matic":return"rpc.ankr.com/polygon/";case"maticmum":return"rpc.ankr.com/polygon_mumbai/";case"optimism":return"rpc.ankr.com/optimism/";case"optimism-goerli":return"rpc.ankr.com/optimism_testnet/";case"optimism-sepolia":return"rpc.ankr.com/optimism_sepolia/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return xL.throwArgumentError("unsupported network","name",e)}class i9 extends Gs{isCommunityResource(){return this.apiKey===gl}static getApiKey(t){return t??gl}static getUrl(t,r){r==null&&(r=gl);const n={allowGzip:!0,url:"https://"+TL(t.name)+r,throttleCallback:(s,i)=>(r.apiKey===gl&&H0(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}}var CL=globalThis&&globalThis.__awaiter||function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(l){try{c(n.next(l))}catch(u){o(u)}}function f(l){try{c(n.throw(l))}catch(u){o(u)}}function c(l){l.done?i(l.value):s(l.value).then(a,f)}c((n=n.apply(e,t||[])).next())})};const wm=new qt($n);class s9 extends Gs{static getApiKey(t){return t!=null&&wm.throwArgumentError("apiKey not supported for cloudflare","apiKey",t),null}static getUrl(t,r){let n=null;switch(t.name){case"homestead":n="https://cloudflare-eth.com/";break;default:wm.throwArgumentError("unsupported network","network",arguments[0])}return n}perform(t,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return CL(this,void 0,void 0,function*(){return t==="getBlockNumber"?(yield n.perform.call(this,"getBlock",{blockTag:"latest"})).number:n.perform.call(this,t,r)})}}var ml=globalThis&&globalThis.__awaiter||function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(l){try{c(n.next(l))}catch(u){o(u)}}function f(l){try{c(n.throw(l))}catch(u){o(u)}}function c(l){l.done?i(l.value):s(l.value).then(a,f)}c((n=n.apply(e,t||[])).next())})};const ks=new qt($n);function Em(e){const t={};for(let r in e){if(e[r]==null)continue;let n=e[r];r==="type"&&n===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?n=M7(C0(n)):r==="accessList"?n="["+N7(n).map(s=>`{address:"${s.address}",storageKeys:["${s.storageKeys.join('","')}"]}`).join(",")+"]":n=C0(n),t[r]=n)}return t}function IL(e){if(e.status==0&&(e.message==="No records found"||e.message==="No transactions found"))return e.result;if(e.status!=1||typeof e.message!="string"||!e.message.match(/^OK/)){const t=new Error("invalid response");throw t.result=JSON.stringify(e),(e.result||"").toLowerCase().indexOf("rate limit")>=0&&(t.throttleRetry=!0),t}return e.result}function Am(e){if(e&&e.status==0&&e.message=="NOTOK"&&(e.result||"").toLowerCase().indexOf("rate limit")>=0){const t=new Error("throttled response");throw t.result=JSON.stringify(e),t.throttleRetry=!0,t}if(e.jsonrpc!="2.0"){const t=new Error("invalid response");throw t.result=JSON.stringify(e),t}if(e.error){const t=new Error(e.error.message||"unknown error");throw e.error.code&&(t.code=e.error.code),e.error.data&&(t.data=e.error.data),t}return e.result}function Sm(e){if(e==="pending")throw new Error("pending not supported");return e==="latest"?e:parseInt(e.substring(2),16)}function nh(e,t,r){if(e==="call"&&t.code===qt.errors.SERVER_ERROR){const s=t.error;if(s&&(s.message.match(/reverted/i)||s.message.match(/VM execution error/i))){let i=s.data;if(i&&(i="0x"+i.replace(/^.*0x/i,"")),Cs(i))return i;ks.throwError("missing revert data in call exception",qt.errors.CALL_EXCEPTION,{error:t,data:"0x"})}}let n=t.message;throw t.code===qt.errors.SERVER_ERROR&&(t.error&&typeof t.error.message=="string"?n=t.error.message:typeof t.body=="string"?n=t.body:typeof t.responseText=="string"&&(n=t.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&ks.throwError("insufficient funds for intrinsic transaction cost",qt.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ks.throwError("nonce has already been used",qt.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),n.match(/another transaction with same nonce/)&&ks.throwError("replacement fee too low",qt.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&ks.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",qt.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}class a9 extends zy{constructor(t,r){super(t),Gr(this,"baseUrl",this.getBaseUrl()),Gr(this,"apiKey",r||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return ks.throwArgumentError("unsupported network","network",this.network.name)}getUrl(t,r){const n=Object.keys(r).reduce((i,o)=>{const a=r[o];return a!=null&&(i+=`&${o}=${a}`),i},""),s=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${t}${n}${s}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(t,r){return r.module=t,r.apikey=this.apiKey,r}fetch(t,r,n){return ml(this,void 0,void 0,function*(){const s=n?this.getPostUrl():this.getUrl(t,r),i=n?this.getPostData(t,r):null,o=t==="proxy"?Am:IL;this.emit("debug",{action:"request",request:s,provider:this});const a={url:s,throttleSlotInterval:1e3,throttleCallback:(l,u)=>(this.isCommunityResource()&&H0(),Promise.resolve(!0))};let f=null;i&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},f=Object.keys(i).map(l=>`${l}=${i[l]}`).join("&"));const c=yield Wy(a,f,o||Am);return this.emit("debug",{action:"response",request:s,response:lo(c),provider:this}),c})}detectNetwork(){return ml(this,void 0,void 0,function*(){return this.network})}perform(t,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return ml(this,void 0,void 0,function*(){switch(t){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:r.address,tag:r.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:r.address,tag:r.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:r.address,tag:r.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:r.address,position:r.position,tag:r.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:r.signedTransaction},!0).catch(s=>nh("sendTransaction",s,r.signedTransaction));case"getBlock":if(r.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:r.blockTag,boolean:r.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:r.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:r.transactionHash});case"call":{if(r.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const s=Em(r.transaction);s.module="proxy",s.action="eth_call";try{return yield this.fetch("proxy",s,!0)}catch(i){return nh("call",i,r.transaction)}}case"estimateGas":{const s=Em(r.transaction);s.module="proxy",s.action="eth_estimateGas";try{return yield this.fetch("proxy",s,!0)}catch(i){return nh("estimateGas",i,r.transaction)}}case"getLogs":{const s={action:"getLogs"};if(r.filter.fromBlock&&(s.fromBlock=Sm(r.filter.fromBlock)),r.filter.toBlock&&(s.toBlock=Sm(r.filter.toBlock)),r.filter.address&&(s.address=r.filter.address),r.filter.topics&&r.filter.topics.length>0&&(r.filter.topics.length>1&&ks.throwError("unsupported topic count",qt.errors.UNSUPPORTED_OPERATION,{topics:r.filter.topics}),r.filter.topics.length===1)){const a=r.filter.topics[0];(typeof a!="string"||a.length!==66)&&ks.throwError("unsupported topic format",qt.errors.UNSUPPORTED_OPERATION,{topic0:a}),s.topic0=a}const i=yield this.fetch("logs",s);let o={};for(let a=0;a<i.length;a++){const f=i[a];if(f.blockHash==null){if(o[f.blockNumber]==null){const c=yield this.getBlock(f.blockNumber);c&&(o[f.blockNumber]=c.hash)}f.blockHash=o[f.blockNumber]}}return i}case"getEtherPrice":return this.network.name!=="homestead"?0:parseFloat((yield this.fetch("stats",{action:"ethprice"})).ethusd)}return n.perform.call(this,t,r)})}getHistory(t,r,n){return ml(this,void 0,void 0,function*(){const s={action:"txlist",address:yield this.resolveName(t),startblock:r??0,endblock:n??99999999,sort:"asc"};return(yield this.fetch("account",s)).map(o=>{["contractAddress","to"].forEach(function(f){o[f]==""&&delete o[f]}),o.creates==null&&o.contractAddress!=null&&(o.creates=o.contractAddress);const a=this.formatter.transactionResponse(o);return o.timeStamp&&(a.timestamp=parseInt(o.timeStamp)),a})})}isCommunityResource(){return this.apiKey==null}}function o9(e){e=e.slice();for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}var xd=globalThis&&globalThis.__awaiter||function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(l){try{c(n.next(l))}catch(u){o(u)}}function f(l){try{c(n.throw(l))}catch(u){o(u)}}function c(l){l.done?i(l.value):s(l.value).then(a,f)}c((n=n.apply(e,t||[])).next())})};const ma=new qt($n);function vl(){return new Date().getTime()}function Pm(e){let t=null;for(let r=0;r<e.length;r++){const n=e[r];if(n==null)return null;t?t.name===n.name&&t.chainId===n.chainId&&(t.ensAddress===n.ensAddress||t.ensAddress==null&&n.ensAddress==null)||ma.throwArgumentError("provider mismatch","networks",e):t=n}return t}function xm(e,t){e=e.slice().sort();const r=Math.floor(e.length/2);if(e.length%2)return e[r];const n=e[r-1],s=e[r];return t!=null&&Math.abs(n-s)>t?null:(n+s)/2}function no(e){if(e===null)return"null";if(typeof e=="number"||typeof e=="boolean")return JSON.stringify(e);if(typeof e=="string")return e;if($0.isBigNumber(e))return e.toString();if(Array.isArray(e))return JSON.stringify(e.map(t=>no(t)));if(typeof e=="object"){const t=Object.keys(e);return t.sort(),"{"+t.map(r=>{let n=e[r];return typeof n=="function"?n="[function]":n=no(n),JSON.stringify(r)+":"+n}).join(",")+"}"}throw new Error("unknown value type: "+typeof e)}let kL=1;function Tm(e){let t=null,r=null,n=new Promise(o=>{t=function(){r&&(clearTimeout(r),r=null),o()},r=setTimeout(t,e)});const s=o=>(n=n.then(o),n);function i(){return n}return{cancel:t,getPromise:i,wait:s}}const RL=[qt.errors.CALL_EXCEPTION,qt.errors.INSUFFICIENT_FUNDS,qt.errors.NONCE_EXPIRED,qt.errors.REPLACEMENT_UNDERPRICED,qt.errors.UNPREDICTABLE_GAS_LIMIT],DL=["address","args","errorArgs","errorSignature","method","transaction"];function bl(e,t){const r={weight:e.weight};return Object.defineProperty(r,"provider",{get:()=>e.provider}),e.start&&(r.start=e.start),t&&(r.duration=t-e.start),e.done&&(e.error?r.error=e.error:r.result=e.result||null),r}function BL(e,t){return function(r){const n={};r.forEach(i=>{const o=e(i.result);n[o]||(n[o]={count:0,result:i.result}),n[o].count++});const s=Object.keys(n);for(let i=0;i<s.length;i++){const o=n[s[i]];if(o.count>=t)return o.result}}}function OL(e,t,r){let n=no;switch(t){case"getBlockNumber":return function(s){const i=s.map(a=>a.result);let o=xm(s.map(a=>a.result),2);if(o!=null)return o=Math.ceil(o),i.indexOf(o+1)>=0&&o++,o>=e._highestBlockNumber&&(e._highestBlockNumber=o),e._highestBlockNumber};case"getGasPrice":return function(s){const i=s.map(o=>o.result);return i.sort(),i[Math.floor(i.length/2)]};case"getEtherPrice":return function(s){return xm(s.map(i=>i.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(s){return s==null?null:(s=fo(s),s.confirmations=-1,no(s))};break;case"getBlock":r.includeTransactions?n=function(s){return s==null?null:(s=fo(s),s.transactions=s.transactions.map(i=>(i=fo(i),i.confirmations=-1,i)),no(s))}:n=function(s){return s==null?null:no(s)};break;default:throw new Error("unknown method: "+t)}return BL(n,e.quorum)}function Ko(e,t){return xd(this,void 0,void 0,function*(){const r=e.provider;return r.blockNumber!=null&&r.blockNumber>=t||t===-1?r:L7(()=>new Promise((n,s)=>{setTimeout(function(){return r.blockNumber>=t?n(r):e.cancelled?n(null):n(void 0)},0)}),{oncePoll:r})})}function ML(e,t,r,n){return xd(this,void 0,void 0,function*(){let s=e.provider;switch(r){case"getBlockNumber":case"getGasPrice":return s[r]();case"getEtherPrice":if(s.getEtherPrice)return s.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&Cs(n.blockTag)&&(s=yield Ko(e,t)),s[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&Cs(n.blockTag)&&(s=yield Ko(e,t)),s.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&Cs(n.blockTag)&&(s=yield Ko(e,t)),s[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&Cs(n.blockTag)&&(s=yield Ko(e,t)),r==="call"&&n.blockTag?s[r](n.transaction,n.blockTag):s[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return s[r](n.transactionHash);case"getLogs":{let i=n.filter;return(i.fromBlock&&Cs(i.fromBlock)||i.toBlock&&Cs(i.toBlock))&&(s=yield Ko(e,t)),s.getLogs(i)}}return ma.throwError("unknown method error",qt.errors.UNKNOWN_ERROR,{method:r,params:n})})}class c9 extends zy{constructor(t,r){t.length===0&&ma.throwArgumentError("missing providers","providers",t);const n=t.map((o,a)=>{if(U7.isProvider(o)){const l=sy(o)?2e3:750;return Object.freeze({provider:o,weight:1,stallTimeout:l,priority:1})}const f=fo(o);f.priority==null&&(f.priority=1),f.stallTimeout==null&&(f.stallTimeout=sy(o)?2e3:750),f.weight==null&&(f.weight=1);const c=f.weight;return(c%1||c>512||c<1)&&ma.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${a}].weight`,c),Object.freeze(f)}),s=n.reduce((o,a)=>o+a.weight,0);r==null?r=s/2:r>s&&ma.throwArgumentError("quorum will always fail; larger than total weight","quorum",r);let i=Pm(n.map(o=>o.provider.network));i==null&&(i=new Promise((o,a)=>{setTimeout(()=>{this.detectNetwork().then(o,a)},0)})),super(i),Gr(this,"providerConfigs",Object.freeze(n)),Gr(this,"quorum",r),this._highestBlockNumber=-1}detectNetwork(){return xd(this,void 0,void 0,function*(){const t=yield Promise.all(this.providerConfigs.map(r=>r.provider.getNetwork()));return Pm(t)})}perform(t,r){return xd(this,void 0,void 0,function*(){if(t==="sendTransaction"){const f=yield Promise.all(this.providerConfigs.map(c=>c.provider.sendTransaction(r.signedTransaction).then(l=>l.hash,l=>l)));for(let c=0;c<f.length;c++){const l=f[c];if(typeof l=="string")return l}throw f[0]}this._highestBlockNumber===-1&&t!=="getBlockNumber"&&(yield this.getBlockNumber());const n=OL(this,t,r),s=o9(this.providerConfigs.map(fo));s.sort((f,c)=>f.priority-c.priority);const i=this._highestBlockNumber;let o=0,a=!0;for(;;){const f=vl();let c=s.filter(d=>d.runner&&f-d.start<d.stallTimeout).reduce((d,h)=>d+h.weight,0);for(;c<this.quorum&&o<s.length;){const d=s[o++],h=kL++;d.start=vl(),d.staller=Tm(d.stallTimeout),d.staller.wait(()=>{d.staller=null}),d.runner=ML(d,i,t,r).then(y=>{d.done=!0,d.result=y,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:h,backend:bl(d,vl()),request:{method:t,params:lo(r)},provider:this})},y=>{d.done=!0,d.error=y,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:h,backend:bl(d,vl()),request:{method:t,params:lo(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:h,backend:bl(d,null),request:{method:t,params:lo(r)},provider:this}),c+=d.weight}const l=[];s.forEach(d=>{d.done||!d.runner||(l.push(d.runner),d.staller&&l.push(d.staller.getPromise()))}),l.length&&(yield Promise.race(l));const u=s.filter(d=>d.done&&d.error==null);if(u.length>=this.quorum){const d=n(u);if(d!==void 0)return s.forEach(h=>{h.staller&&h.staller.cancel(),h.cancelled=!0}),d;a||(yield Tm(100).getPromise()),a=!1}const p=s.reduce((d,h)=>{if(!h.done||h.error==null)return d;const y=h.error.code;return RL.indexOf(y)>=0&&(d[y]||(d[y]={error:h.error,weight:0}),d[y].weight+=h.weight),d},{});if(Object.keys(p).forEach(d=>{const h=p[d];if(h.weight<this.quorum)return;s.forEach(v=>{v.staller&&v.staller.cancel(),v.cancelled=!0});const y=h.error,m={};DL.forEach(v=>{y[v]!=null&&(m[v]=y[v])}),ma.throwError(y.reason||y.message,d,m)}),s.filter(d=>!d.done).length===0)break}return s.forEach(f=>{f.staller&&f.staller.cancel(),f.cancelled=!0}),ma.throwError("failed to meet quorum",qt.errors.SERVER_ERROR,{method:t,params:r,results:s.map(f=>bl(f)),provider:this})})}}const u9=null,ld=new qt($n),Zu="84842078b09946638c03157f83405213";class l9 extends mf{constructor(t,r){const n=new Xy(t,r),s=n.connection;s.password&&ld.throwError("INFURA WebSocket project secrets unsupported",qt.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const i=s.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(i,t),Gr(this,"apiKey",n.projectId),Gr(this,"projectId",n.projectId),Gr(this,"projectSecret",n.projectSecret)}isCommunityResource(){return this.projectId===Zu}}class Xy extends Gs{static getWebSocketProvider(t,r){return new l9(t,r)}static getApiKey(t){const r={apiKey:Zu,projectId:Zu,projectSecret:null};return t==null||(typeof t=="string"?r.projectId=t:t.projectSecret!=null?(ld.assertArgument(typeof t.projectId=="string","projectSecret requires a projectId","projectId",t.projectId),ld.assertArgument(typeof t.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),r.projectId=t.projectId,r.projectSecret=t.projectSecret):t.projectId&&(r.projectId=t.projectId),r.apiKey=r.projectId),r}static getUrl(t,r){let n=null;switch(t?t.name:"unknown"){case"homestead":n="mainnet.infura.io";break;case"goerli":n="goerli.infura.io";break;case"sepolia":n="sepolia.infura.io";break;case"matic":n="polygon-mainnet.infura.io";break;case"maticmum":n="polygon-mumbai.infura.io";break;case"optimism":n="optimism-mainnet.infura.io";break;case"optimism-goerli":n="optimism-goerli.infura.io";break;case"optimism-sepolia":n="optimism-sepolia.infura.io";break;case"arbitrum":n="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":n="arbitrum-goerli.infura.io";break;case"arbitrum-sepolia":n="arbitrum-sepolia.infura.io";break;default:ld.throwError("unsupported network",qt.errors.INVALID_ARGUMENT,{argument:"network",value:t})}const s={allowGzip:!0,url:"https://"+n+"/v3/"+r.projectId,throttleCallback:(i,o)=>(r.projectId===Zu&&H0(),Promise.resolve(!0))};return r.projectSecret!=null&&(s.user="",s.password=r.projectSecret),s}isCommunityResource(){return this.projectId===Zu}}class NL extends I0{send(t,r){const n={method:t,params:r,id:this._nextId++,jsonrpc:"2.0"};this._pendingBatch==null&&(this._pendingBatch=[]);const s={request:n,resolve:null,reject:null},i=new Promise((o,a)=>{s.resolve=o,s.reject=a});return this._pendingBatch.push(s),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{const o=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const a=o.map(f=>f.request);return this.emit("debug",{action:"requestBatch",request:lo(a),provider:this}),Wy(this.connection,JSON.stringify(a)).then(f=>{this.emit("debug",{action:"response",request:a,response:f,provider:this}),o.forEach((c,l)=>{const u=f[l];if(u.error){const p=new Error(u.error.message);p.code=u.error.code,p.data=u.error.data,c.reject(p)}else c.resolve(u.result)})},f=>{this.emit("debug",{action:"response",error:f,request:a,provider:this}),o.forEach(c=>{c.reject(f)})})},10)),i}}const ih=new qt($n),UL="ETHERS_JS_SHARED";class d9 extends Gs{static getApiKey(t){return t&&typeof t!="string"&&ih.throwArgumentError("invalid apiKey","apiKey",t),t||UL}static getUrl(t,r){ih.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let n=null;switch(t.name){case"homestead":n="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":n="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":n="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":n="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":n="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:ih.throwArgumentError("unsupported network","network",arguments[0])}return n+"?apiKey="+r}}const Cm=new qt($n),Im="62e1ad51b37b8e00394bda3b";class f9 extends Gs{static getApiKey(t){const r={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return t==null?r.applicationId=Im:typeof t=="string"?r.applicationId=t:t.applicationSecretKey!=null?(r.applicationId=t.applicationId,r.applicationSecretKey=t.applicationSecretKey):t.applicationId?r.applicationId=t.applicationId:Cm.throwArgumentError("unsupported PocketProvider apiKey","apiKey",t),r}static getUrl(t,r){let n=null;switch(t?t.name:"unknown"){case"goerli":n="eth-goerli.gateway.pokt.network";break;case"homestead":n="eth-mainnet.gateway.pokt.network";break;case"kovan":n="poa-kovan.gateway.pokt.network";break;case"matic":n="poly-mainnet.gateway.pokt.network";break;case"maticmum":n="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":n="eth-rinkeby.gateway.pokt.network";break;case"ropsten":n="eth-ropsten.gateway.pokt.network";break;default:Cm.throwError("unsupported network",qt.errors.INVALID_ARGUMENT,{argument:"network",value:t})}const s=`https://${n}/v1/lb/${r.applicationId}`,i={headers:{},url:s};return r.applicationSecretKey!=null&&(i.user="",i.password=r.applicationSecretKey),i}isCommunityResource(){return this.applicationId===Im}}const km=new qt($n),LL="919b412a057b5e9c9b6dce193c5a60242d6efadb";class h9 extends Gs{static getApiKey(t){return t&&typeof t!="string"&&km.throwArgumentError("invalid apiKey","apiKey",t),t||LL}static getUrl(t,r){let n=null;switch(t.name){case"homestead":n="ethers.quiknode.pro";break;case"goerli":n="ethers.ethereum-goerli.quiknode.pro";break;case"sepolia":n="ethers.ethereum-sepolia.quiknode.pro";break;case"holesky":n="ethers.ethereum-holesky.quiknode.pro";break;case"arbitrum":n="ethers.arbitrum-mainnet.quiknode.pro";break;case"arbitrum-goerli":n="ethers.arbitrum-goerli.quiknode.pro";break;case"arbitrum-sepolia":n="ethers.arbitrum-sepolia.quiknode.pro";break;case"base":n="ethers.base-mainnet.quiknode.pro";break;case"base-goerli":n="ethers.base-goerli.quiknode.pro";break;case"base-spolia":n="ethers.base-sepolia.quiknode.pro";break;case"bnb":n="ethers.bsc.quiknode.pro";break;case"bnbt":n="ethers.bsc-testnet.quiknode.pro";break;case"matic":n="ethers.matic.quiknode.pro";break;case"maticmum":n="ethers.matic-testnet.quiknode.pro";break;case"optimism":n="ethers.optimism.quiknode.pro";break;case"optimism-goerli":n="ethers.optimism-goerli.quiknode.pro";break;case"optimism-sepolia":n="ethers.optimism-sepolia.quiknode.pro";break;case"xdai":n="ethers.xdai.quiknode.pro";break;default:km.throwArgumentError("unsupported network","network",arguments[0])}return"https://"+n+"/"+r}}const Rm=new qt($n);function Qy(e,t){if(e==null&&(e="homestead"),typeof e=="string"){const n=e.match(/^(ws|http)s?:/i);if(n)switch(n[1].toLowerCase()){case"http":case"https":return new I0(e);case"ws":case"wss":return new mf(e);default:Rm.throwArgumentError("unsupported URL scheme","network",e)}}const r=K7(e);return(!r||!r._defaultProvider)&&Rm.throwError("unsupported getDefaultProvider network",qt.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:e}),r._defaultProvider({FallbackProvider:c9,AlchemyProvider:Jy,AnkrProvider:i9,CloudflareProvider:s9,EtherscanProvider:a9,InfuraProvider:Xy,JsonRpcProvider:I0,NodesmithProvider:d9,PocketProvider:f9,QuickNodeProvider:h9,Web3Provider:F7,IpcProvider:u9},t)}const p9=Object.freeze(Object.defineProperty({__proto__:null,AlchemyProvider:Jy,AlchemyWebSocketProvider:n9,AnkrProvider:i9,BaseProvider:zy,CloudflareProvider:s9,EtherscanProvider:a9,FallbackProvider:c9,Formatter:sS,InfuraProvider:Xy,InfuraWebSocketProvider:l9,IpcProvider:u9,JsonRpcBatchProvider:NL,JsonRpcProvider:I0,JsonRpcSigner:aS,NodesmithProvider:d9,PocketProvider:f9,Provider:U7,QuickNodeProvider:h9,Resolver:oS,StaticJsonRpcProvider:cS,UrlJsonRpcProvider:Gs,Web3Provider:F7,WebSocketProvider:mf,getDefaultProvider:Qy,getNetwork:K7,isCommunityResourcable:uS,isCommunityResource:sy,showThrottleMessage:H0},Symbol.toStringTag,{value:"Module"})),KL="solidity/5.8.0",FL=new RegExp("^bytes([0-9]+)$"),qL=new RegExp("^(u?int)([0-9]*)$"),jL=new RegExp("^(.*)\\[([0-9]*)\\]$"),$L="0000000000000000000000000000000000000000000000000000000000000000",Qa=new qt(KL);function y9(e,t,r){switch(e){case"address":return r?cd(t,32):ga(t);case"string":return Gy(t);case"bytes":return ga(t);case"bool":return t=t?"0x01":"0x00",r?cd(t,32):ga(t)}let n=e.match(qL);if(n){let s=parseInt(n[2]||"256");return(n[2]&&String(s)!==n[2]||s%8!==0||s===0||s>256)&&Qa.throwArgumentError("invalid number type","type",e),r&&(s=256),t=$0.from(t).toTwos(s),cd(t,s/8)}if(n=e.match(FL),n){const s=parseInt(n[1]);return(String(s)!==n[1]||s===0||s>32)&&Qa.throwArgumentError("invalid bytes type","type",e),ga(t).byteLength!==s&&Qa.throwArgumentError(`invalid value for ${e}`,"value",t),r?ga((t+$L).substring(0,66)):t}if(n=e.match(jL),n&&Array.isArray(t)){const s=n[1];parseInt(n[2]||String(t.length))!=t.length&&Qa.throwArgumentError(`invalid array length for ${e}`,"value",t);const o=[];return t.forEach(function(a){o.push(y9(s,a,!0))}),yf(o)}return Qa.throwArgumentError("invalid type","type",e)}function eg(e,t){e.length!=t.length&&Qa.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);const r=[];return e.forEach(function(n,s){r.push(y9(n,t[s]))}),C0(yf(r))}function HL(e,t){return q7(eg(e,t))}function VL(e,t){return j7(eg(e,t))}const g9=Object.freeze(Object.defineProperty({__proto__:null,AbiCoder:lS,ConstructorFragment:dS,ErrorFragment:fS,EventFragment:hS,FormatTypes:pS,Fragment:yS,FunctionFragment:gS,HDNode:mS,Indexed:vS,Interface:bS,LogDescription:_S,Logger:qt,ParamType:wS,RLP:ES,SigningKey:AS,get SupportedAlgorithm(){return SS},TransactionDescription:PS,get TransactionTypes(){return xS},get UnicodeNormalizationForm(){return O7},Utf8ErrorFuncs:TS,get Utf8ErrorReason(){return CS},_TypedDataEncoder:IS,_fetchData:kS,_toEscapedUtf8String:RS,accessListify:N7,arrayify:ga,base58:DS,base64:cL,checkProperties:BS,checkResultErrors:OS,commify:MS,computeAddress:NS,computeHmac:US,computePublicKey:LS,concat:yf,deepCopy:lo,defaultAbiCoder:KS,defaultPath:FS,defineReadOnly:Gr,dnsEncode:qS,entropyToMnemonic:jS,fetchJson:Wy,formatBytes32String:lL,formatEther:$S,formatUnits:HS,getAccountPath:VS,getAddress:GS,getContractAddress:zS,getCreate2Address:WS,getIcapAddress:YS,getJsonWalletAddress:ZS,getStatic:JS,hashMessage:XS,hexConcat:QS,hexDataLength:eP,hexDataSlice:tP,hexStripZeros:rP,hexValue:M7,hexZeroPad:nP,hexlify:C0,id:iP,isAddress:sP,isBytes:aP,isBytesLike:oP,isHexString:Cs,isValidMnemonic:cP,isValidName:uP,joinSignature:lP,keccak256:q7,mnemonicToEntropy:dP,mnemonicToSeed:fP,namehash:hP,nameprep:SL,parseBytes32String:dL,parseEther:pP,parseTransaction:yP,parseUnits:gP,poll:L7,randomBytes:mP,recoverAddress:vP,recoverPublicKey:bP,resolveProperties:_P,ripemd160:wP,serializeTransaction:EP,sha256:j7,sha512:AP,shallowCopy:fo,shuffled:o9,solidityKeccak256:HL,solidityPack:eg,soliditySha256:VL,splitSignature:SP,stripZeros:PP,toUtf8Bytes:Gy,toUtf8CodePoints:iy,toUtf8String:B7,verifyMessage:xP,verifyTypedData:TP,zeroPad:cd},Symbol.toStringTag,{value:"Module"})),tg="ethers/5.8.0",m9=new qt(tg),v9=Object.freeze(Object.defineProperty({__proto__:null,BaseContract:$7,BigNumber:$0,Contract:H7,ContractFactory:V7,FixedNumber:G7,Signer:z7,VoidSigner:W7,Wallet:Y7,Wordlist:Z7,constants:t9,get errors(){return J7},getDefaultProvider:Qy,logger:m9,providers:p9,utils:g9,version:tg,wordlists:X7},Symbol.toStringTag,{value:"Module"}));try{const e=window;e._ethers==null&&(e._ethers=v9)}catch{}const GL=Object.freeze(Object.defineProperty({__proto__:null,BaseContract:$7,BigNumber:$0,Contract:H7,ContractFactory:V7,FixedNumber:G7,Signer:z7,VoidSigner:W7,Wallet:Y7,Wordlist:Z7,constants:t9,get errors(){return J7},ethers:v9,getDefaultProvider:Qy,logger:m9,providers:p9,utils:g9,version:tg,wordlists:X7},Symbol.toStringTag,{value:"Module"})),zL=Object.freeze(Object.defineProperty({__proto__:null,abey:FP,abstract:qP,abstractTestnet:jP,acala:$P,acria:HP,adf:VP,agungTestnet:GP,aioz:zP,alephZero:WP,alephZeroTestnet:YP,alienx:ZP,alienxHalTestnet:JP,ancient8:XP,ancient8Sepolia:QP,anvil:ex,apeChain:tx,apexTestnet:rx,apollo:nx,arbitrum:ix,arbitrumGoerli:sx,arbitrumNova:ax,arbitrumSepolia:ox,arcTestnet:cx,arenaz:ux,areonNetwork:lx,areonNetworkTestnet:dx,areum:fx,artelaTestnet:hx,arthera:px,artheraTestnet:yx,assetChain:gx,assetChainTestnet:mx,astar:vx,astarZkEVM:bx,astarZkyoto:_x,atletaOlympia:wx,aurora:Ex,auroraTestnet:Ax,auroria:Sx,autheoTestnet:Px,avalanche:xx,avalancheFuji:Tx,b3:Cx,b3Sepolia:Ix,bahamut:kx,base:Rx,baseGoerli:Dx,basePreconf:Bx,baseSepolia:Ox,baseSepoliaPreconf:Mx,basecampTestnet:Nx,beam:Ux,beamTestnet:Lx,bearNetworkChainMainnet:Kx,bearNetworkChainTestnet:Fx,berachain:qx,berachainBepolia:jx,berachainTestnet:$x,berachainTestnetbArtio:Hx,bevmMainnet:Vx,bifrost:Gx,birdlayer:zx,bitTorrent:Wx,bitTorrentTestnet:Yx,bitgert:Zx,bitkub:Jx,bitkubTestnet:Xx,bitlayer:Qx,bitlayerTestnet:eT,bitrock:tT,blast:rT,blastSepolia:nT,bob:iT,bobSepolia:sT,boba:aT,bobaSepolia:oT,boolBetaMainnet:cT,botanix:uT,botanixTestnet:lT,bounceBit:dT,bounceBitTestnet:fT,bronos:hT,bronosTestnet:pT,bsc:yT,bscGreenfield:gT,bscTestnet:mT,bsquared:vT,bsquaredTestnet:bT,btr:_T,btrTestnet:wT,bxn:ET,bxnTestnet:AT,cannon:ST,canto:PT,celo:xT,celoAlfajores:TT,celoSepolia:CT,chang:IT,chiliz:kT,chips:RT,citreaTestnet:DT,classic:BT,coinbit:OT,coinex:MT,confluxESpace:NT,confluxESpaceTestnet:UT,coreDao:LT,coreTestnet1:KT,coreTestnet2:FT,corn:qT,cornTestnet:jT,crab:$T,creatorTestnet:HT,creditCoin3Devnet:VT,creditCoin3Mainnet:GT,creditCoin3Testnet:zT,cronos:WT,cronosTestnet:YT,cronoszkEVM:ZT,cronoszkEVMTestnet:JT,crossbell:XT,crossfi:QT,curtis:eC,cyber:tC,cyberTestnet:rC,dailyNetwork:nC,dailyNetworkTestnet:iC,darwinia:sC,datahavenTestnet:aC,dbkchain:oC,dchain:cC,dchainTestnet:uC,defichainEvm:lC,defichainEvmTestnet:dC,degen:fC,dfk:hC,diode:pC,disChain:yC,dodochainTestnet:gC,dogechain:mC,domaTestnet:vC,donatuz:bC,dosChain:_C,dosChainTestnet:wC,dreyerxMainnet:EC,dreyerxTestnet:AC,dustboyIoT:SC,dymension:PC,edexa:xC,edexaTestnet:TC,edgeless:CC,edgelessTestnet:IC,edgeware:kC,edgewareTestnet:RC,eduChain:DC,eduChainTestnet:BC,ekta:OC,ektaTestnet:MC,elastos:NC,elastosTestnet:UC,electroneum:LC,electroneumTestnet:KC,elysiumTestnet:FC,energy:qC,eni:jC,eniTestnet:$C,enuls:HC,eon:VC,eos:GC,eosTestnet:zC,eteria:WC,etherlink:YC,etherlinkShadownetTestnet:ZC,etherlinkTestnet:JC,ethernity:XC,etp:QC,evmos:eI,evmosTestnet:tI,excelonMainnet:rI,expanse:nI,exsat:iI,exsatTestnet:sI,fantom:aI,fantomSonicTestnet:oI,fantomTestnet:cI,fibo:uI,filecoin:lI,filecoinCalibration:dI,filecoinHyperspace:fI,fireChain:hI,flame:pI,flare:yI,flareTestnet:gI,flowMainnet:mI,flowPreviewnet:vI,flowTestnet:bI,fluence:_I,fluenceStage:wI,fluenceTestnet:EI,fluentTestnet:AI,form:SI,formTestnet:PI,forma:xI,formicarium:TI,forta:CI,foundry:II,fraxtal:kI,fraxtalTestnet:RI,funkiMainnet:DI,funkiSepolia:BI,fuse:OI,fuseSparknet:MI,fusion:NI,fusionTestnet:UI,garnet:LI,gatechain:KI,geist:FI,genesys:qI,giwaSepolia:jI,giwaSepoliaPreconf:$I,glideL1Protocol:HI,glideL2Protocol:VI,gnosis:GI,gnosisChiado:zI,goChain:WI,goat:YI,gobi:ZI,godwoken:JI,goerli:XI,graphite:QI,graphiteTestnet:ek,gravity:tk,gunz:rk,guruNetwork:nk,guruTestnet:ik,ham:sk,happychainTestnet:ak,haqqMainnet:ok,haqqTestedge2:ck,hardhat:uk,harmonyOne:lk,hashkey:dk,hashkeyTestnet:fk,haustTestnet:hk,hedera:pk,hederaPreviewnet:yk,hederaTestnet:gk,hela:mk,heliosTestnet:vk,hemi:bk,hemiSepolia:_k,henesys:wk,holesky:Ek,hoodi:Ak,hpb:Sk,hpp:Pk,hppSepolia:xk,huddle01Mainnet:Tk,huddle01Testnet:Ck,humanity:Ik,humanityTestnet:kk,humanode:Rk,humanodeTestnet5:Dk,hychain:Bk,hychainTestnet:Ok,hyperEvm:hm,hyperliquid:hm,hyperliquidEvmTestnet:Mk,iSunCoin:Nk,icbNetwork:Uk,idchain:Lk,immutableZkEvm:Kk,immutableZkEvmTestnet:Fk,inEVM:qk,initVerse:jk,initVerseGenesis:$k,injective:Hk,injectiveTestnet:Vk,ink:Gk,inkSepolia:zk,iota:Wk,iotaTestnet:Yk,iotex:Zk,iotexTestnet:Jk,jasmyChain:Xk,jasmyChainTestnet:Qk,jbc:eR,jbcTestnet:tR,jocMainnet:rR,jocTestnet:nR,jovay:iR,jovaySepolia:sR,juneo:aR,juneoBCH1Chain:oR,juneoDAI1Chain:cR,juneoDOGE1Chain:uR,juneoEUR1Chain:lR,juneoGLD1Chain:dR,juneoLINK1Chain:fR,juneoLTC1Chain:hR,juneoSGD1Chain:pR,juneoSocotraTestnet:yR,juneoUSD1Chain:gR,juneoUSDT1Chain:mR,juneomBTC1Chain:vR,kaia:bR,kairos:_R,kakarotSepolia:wR,kakarotStarknetSepolia:ER,kardiaChain:AR,karura:SR,katana:PR,kava:xR,kavaTestnet:TR,kcc:CR,kiiTestnetOro:IR,kinto:kR,klaytn:RR,klaytnBaobab:DR,koi:BR,kroma:OR,kromaSepolia:MR,l3x:NR,l3xTestnet:UR,lavita:LR,lens:KR,lensTestnet:FR,lestnet:qR,lightlinkPegasus:jR,lightlinkPhoenix:$R,linea:HR,lineaGoerli:VR,lineaSepolia:GR,lineaTestnet:zR,lisk:WR,liskSepolia:YR,loadAlphanet:ZR,localhost:JR,loop:XR,lukso:QR,luksoTestnet:eD,lumiaMainnet:tD,lumiaTestnet:rD,lumoz:nD,lumozTestnet:iD,lycan:sD,lyra:aD,mainnet:oD,mandala:cD,manta:uD,mantaSepoliaTestnet:lD,mantaTestnet:dD,mantle:fD,mantleSepoliaTestnet:hD,mantleTestnet:pD,mantraDuKongEVMTestnet:yD,mantraEVM:gD,mapProtocol:mD,matchain:vD,matchainTestnet:bD,mchVerse:_D,megaethTestnet:wD,mekong:ED,meld:AD,memecore:SD,merlin:PD,merlinErigonTestnet:xD,metachain:TD,metachainIstanbul:CD,metadium:ID,metalL2:kD,meter:RD,meterTestnet:DD,metis:BD,metisGoerli:OD,metisSepolia:MD,mev:ND,mevTestnet:UD,mint:LD,mintSepoliaTestnet:KD,mitosisTestnet:FD,mode:qD,modeTestnet:jD,monad:$D,monadTestnet:HD,moonbaseAlpha:VD,moonbeam:GD,moonbeamDev:zD,moonriver:WD,morph:YD,morphHolesky:ZD,morphSepolia:JD,nahmii:XD,nautilus:QD,near:eB,nearTestnet:tB,neonDevnet:rB,neonMainnet:nB,neoxMainnet:iB,neoxT4:sB,newton:aB,nexi:oB,nexilix:cB,nibiru:uB,nitrographTestnet:lB,nomina:dB,oasisTestnet:fB,oasys:hB,odysseyTestnet:pB,okc:yB,omax:gB,omni:mB,omniOmega:vB,oneWorld:bB,oortMainnetDev:_B,opBNB:wB,opBNBTestnet:EB,openledger:AB,optimism:SB,optimismGoerli:PB,optimismSepolia:xB,optopia:TB,optopiaTestnet:CB,orderly:IB,orderlySepolia:kB,otimDevnet:RB,palm:DB,palmTestnet:BB,peaq:OB,pgn:MB,pgnTestnet:NB,phoenix:UB,planq:LB,plasma:KB,plasmaDevnet:FB,plasmaTestnet:qB,playfiAlbireo:jB,plinga:$B,plume:HB,plumeDevnet:VB,plumeMainnet:GB,plumeSepolia:zB,plumeTestnet:WB,polterTestnet:YB,polygon:ZB,polygonAmoy:JB,polygonMumbai:XB,polygonZkEvm:QB,polygonZkEvmCardona:eO,polygonZkEvmTestnet:tO,polynomial:rO,polynomialSepolia:nO,potos:iO,potosTestnet:sO,premiumBlockTestnet:aO,pulsechain:oO,pulsechainV4:cO,pumpfiTestnet:uO,pyrope:lO,qMainnet:dO,qTestnet:fO,ql1:hO,quai:pO,quaiTestnet:yO,reactiveTestnet:gO,real:mO,redbellyMainnet:vO,redbellyTestnet:bO,reddio:_O,reddioSepolia:wO,redstone:EO,rei:AO,reyaNetwork:SO,riseTestnet:PO,rivalz:xO,rollux:TO,rolluxTestnet:CO,ronin:IO,root:kO,rootPorcini:RO,rootstock:DO,rootstockTestnet:BO,rss3:OO,rss3Sepolia:MO,saakuru:NO,saga:UO,saigon:LO,sanko:KO,sapphire:FO,sapphireTestnet:qO,satoshiVM:jO,satoshiVMTestnet:$O,scroll:HO,scrollSepolia:VO,sei:GO,seiDevnet:zO,seiTestnet:WO,seismicDevnet:YO,sepolia:ZO,shape:JO,shapeSepolia:XO,shardeum:QO,shardeumSphinx:eM,shibarium:tM,shibariumTestnet:rM,shiden:nM,shimmer:iM,shimmerTestnet:sM,sidraChain:aM,silentData:oM,silicon:cM,siliconSepolia:uM,sixProtocol:lM,skaleBase:dM,skaleBaseSepoliaTestnet:fM,skaleBlockBrawlers:hM,skaleCalypso:pM,skaleCalypsoTestnet:yM,skaleCryptoBlades:gM,skaleCryptoColosseum:mM,skaleEuropa:vM,skaleEuropaTestnet:bM,skaleExorde:_M,skaleHumanProtocol:wM,skaleNebula:EM,skaleNebulaTestnet:AM,skaleRazor:SM,skaleTitan:PM,skaleTitanTestnet:xM,sketchpad:TM,snax:CM,snaxTestnet:IM,somnia:kM,somniaTestnet:RM,soneium:DM,soneiumMinato:BM,songbird:OM,songbirdTestnet:MM,sonic:NM,sonicBlazeTestnet:UM,sonicTestnet:LM,sophon:KM,sophonTestnet:FM,sova:qM,sovaSepolia:jM,spicy:$M,stableTestnet:HM,statusNetworkSepolia:pm,statusSepolia:pm,step:VM,story:GM,storyAeneid:zM,storyOdyssey:WM,storyTestnet:YM,stratis:ZM,superlumio:JM,superposition:XM,superseed:QM,superseedSepolia:eN,surgeTestnet:tN,swan:rN,swanProximaTestnet:nN,swanSaturnTestnet:iN,swellchain:sN,swellchainTestnet:aN,swissdlt:oN,syscoin:cN,syscoinTestnet:uN,tac:lN,tacSPB:dN,taiko:fN,taikoHekla:hN,taikoHoodi:pN,taikoJolnir:yN,taikoKatla:gN,taikoTestnetSepolia:mN,taraxa:vN,taraxaTestnet:bN,teaSepolia:_N,telcoinTestnet:wN,telos:EN,telosTestnet:AN,tempoDevnet:SN,tempoLocalnet:PN,tempoTestnet:xN,tenet:TN,ternoa:CN,thaiChain:IN,that:kN,theta:RN,thetaTestnet:DN,thunderCore:BN,thunderTestnet:ON,tiktrixTestnet:MN,tomb:NN,treasure:UN,treasureTopaz:LN,tron:KN,tronNile:FN,tronShasta:qN,ubiq:jN,ultra:$N,ultraTestnet:HN,ultron:VN,ultronTestnet:GN,unichain:zN,unichainSepolia:WN,unique:YN,uniqueOpal:ZN,uniqueQuartz:JN,unreal:XN,vana:QN,vanaMoksha:eU,vanar:tU,vechain:rU,velas:nU,viction:iU,victionTestnet:sU,vision:aU,visionTestnet:oU,wanchain:cU,wanchainTestnet:uU,weaveVMAlphanet:lU,wemix:dU,wemixTestnet:fU,westendAssetHub:hU,whitechain:pU,whitechainTestnet:yU,wmcTestnet:gU,worldLand:mU,worldchain:vU,worldchainSepolia:bU,x1Testnet:ym,xLayer:_U,xLayerTestnet:ym,xai:wU,xaiTestnet:EU,xdc:AU,xdcTestnet:SU,xoneMainnet:PU,xoneTestnet:xU,xphereMainnet:TU,xphereTestnet:CU,xrOne:IU,xrSepolia:kU,xrplevm:RU,xrplevmDevnet:DU,xrplevmTestnet:BU,yooldoVerse:OU,yooldoVerseTestnet:MU,zenchainTestnet:NU,zeniq:UU,zeroG:LU,zeroGGalileoTestnet:KU,zeroGMainnet:FU,zeroGTestnet:qU,zeroNetwork:jU,zetachain:$U,zetachainAthensTestnet:HU,zhejiang:VU,zilliqa:GU,zilliqaTestnet:zU,zircuit:WU,zircuitGarfieldTestnet:YU,zircuitTestnet:ZU,zkFair:JU,zkFairTestnet:XU,zkLinkNova:QU,zkLinkNovaSepoliaTestnet:eL,zkSync:gm,zkSyncInMemoryNode:mm,zkSyncLocalNode:vm,zkSyncSepoliaTestnet:bm,zksync:gm,zksyncInMemoryNode:mm,zksyncLocalCustomHyperchain:tL,zksyncLocalHyperchain:rL,zksyncLocalHyperchainL1:nL,zksyncLocalNode:vm,zksyncSepoliaTestnet:bm,zora:iL,zoraSepolia:sL,zoraTestnet:aL},Symbol.toStringTag,{value:"Module"}));var rg={},sh={},ah={},Fo={},oh={},Js={},ch={},uh={};const WL="@pushprotocol/restapi",YL="1.7.32",ZL="commonjs",JL={registry:"https://registry.npmjs.org/"},XL={ethers:"^5.0.0 || ^6.0.0"},QL={ethers:{optional:!0}},eK={"@metamask/eth-sig-util":"^5.0.2",buffer:"^6.0.3","crypto-js":"^4.1.1",immer:"^10.0.2",joi:"^17.9.2",livepeer:"^2.5.8","lru-cache":"^10.1.0",openpgp:"^5.5.0","simple-peer":"^9.11.1","socket.io-client":"^4.7.2","video-stream-merger":"^4.0.1",viem:"^2.28.0",axios:"^0.27.2",uuid:"^9.0.0","unique-names-generator":"^4.7.1",tslib:"^2.3.0"},tK={test:"TS_NODE_PROJECT='./tsconfig.mocha.json' NODE_OPTIONS='--loader ts-node/esm' DOTENV_CONFIG_PATH='./tests/.env' mocha -r ts-node/register -r dotenv/config 'tests/**/*.test.ts' --timeout 1200000 --require tests/root.ts --serial"},rK={"@types/chai":"^4.3.4","@types/chai-as-promised":"^7.1.5","@types/crypto-js":"^4.1.1","@types/mocha":"^10.0.1",chai:"^4.3.7","chai-as-promised":"^7.1.1",envfile:"^7.1.0",mocha:"^10.2.0","mocha-typescript":"^1.1.17","ts-node":"^10.9.1",typescript:"^5.0.2",undici:"^6.21.2","web-streams-polyfill":"^4.1.0","@ethersproject/providers":"^5.7.2","@lit-protocol/auth-browser":"^7.0.5","@lit-protocol/auth-helpers":"^7.0.5","@lit-protocol/constants":"^7.0.5","@lit-protocol/contracts-sdk":"^7.0.5","@lit-protocol/lit-auth-client":"^7.0.5","@lit-protocol/lit-node-client":"^7.0.5","@lit-protocol/pkp-ethers":"^7.0.5","@lit-protocol/types":"^7.0.5","@lit-protocol/wrapped-keys":"^7.0.3","@pushprotocol/restapi":"^1.7.32-exp.1","@zerodev/hooks":"^5.3.0","@zerodev/intent":"^0.0.7","@zerodev/multi-chain-ecdsa-validator":"^5.4.2","@zerodev/permissions":"^5.5.0","@zerodev/remote-signer":"^5.3.0","@zerodev/session-key":"^5.5.0","@zerodev/weighted-ecdsa-validator":"^5.4.0",dotenv:"^16.3.1",ethers:"^5.7.2","isomorphic-fetch":"^3.0.0","@zerodev/ecdsa-validator":"^5.4.7","@zerodev/sdk":"^5.4.29"},nK="./src/index.js",iK="./src/index.d.ts",b9={name:WL,version:YL,type:ZL,publishConfig:JL,peerDependencies:XL,peerDependenciesMeta:QL,dependencies:eK,scripts:tK,devDependencies:rK,main:nK,typings:iK};var Dm;function Ze(){return Dm||(Dm=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PACKAGE_BUILD=e.ALPHA_FEATURES=e.MessageType=e.ENCRYPTION_TYPE=e.ENV=void 0;const t=b9;var r;(function(i){i.PROD="prod",i.STAGING="staging",i.DEV="dev",i.LOCAL="local"})(r=e.ENV||(e.ENV={}));var n;(function(i){i.PGP_V1="x25519-xsalsa20-poly1305",i.PGP_V2="aes256GcmHkdfSha256",i.PGP_V3="eip191-aes256-gcm-hkdf-sha256",i.NFTPGP_V1="pgpv1:nft",i.SCWPGP_V1="pgpv1:scw"})(n=e.ENCRYPTION_TYPE||(e.ENCRYPTION_TYPE={})),function(i){i.TEXT="Text",i.IMAGE="Image",i.VIDEO="Video",i.AUDIO="Audio",i.FILE="File",i.GIF="GIF",i.MEDIA_EMBED="MediaEmbed",i.META="Meta",i.REACTION="Reaction",i.RECEIPT="Receipt",i.USER_ACTIVITY="UserActivity",i.INTENT="Intent",i.REPLY="Reply",i.COMPOSITE="Composite",i.PAYMENT="Payment"}(e.MessageType||(e.MessageType={})),e.ALPHA_FEATURES={SCALABILITY_V2:"SCALABILITY_V2"},e.PACKAGE_BUILD=t.version.includes("alpha")?"ALPHA":"STABLE";const s={ENV:r,ENCRYPTION_TYPE:n,PAGINATION:{INITIAL_PAGE:1,LIMIT:10,LIMIT_MIN:1,LIMIT_MAX:50},DEFAULT_CHAIN_ID:11155111,DEV_CHAIN_ID:99999,NON_ETH_CHAINS:[137,80002,56,97,10,11155420,2442,1101,421614,42161,122,123,80085,59141,59144,111557560,7560,84532,8453],ETH_CHAINS:[1,11155111],ENC_TYPE_V1:"x25519-xsalsa20-poly1305",ENC_TYPE_V2:"aes256GcmHkdfSha256",ENC_TYPE_V3:"eip191-aes256-gcm-hkdf-sha256",ENC_TYPE_V4:"pgpv1:nft",ENC_TYPE_V5:"pgpv1:scw",ALPHA_FEATURES:e.ALPHA_FEATURES};e.default=s}(uh)),uh}var qo={},Bm;function sK(){return Bm||(Bm=1,Object.defineProperty(qo,"__esModule",{value:!0}),qo.coreABI=void 0,qo.coreABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"enum EPNSCoreStorageV1_5.ChannelType",name:"channelType",type:"uint8"},{indexed:!1,internalType:"bytes",name:"identity",type:"bytes"}],name:"AddChannel",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!1,internalType:"bytes",name:"_subGraphData",type:"bytes"}],name:"AddSubGraph",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"}],name:"ChannelBlocked",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"_channel",type:"address"},{indexed:!1,internalType:"uint256",name:"totalNotifOptions",type:"uint256"},{indexed:!1,internalType:"string",name:"_notifSettings",type:"string"},{indexed:!1,internalType:"string",name:"_notifDescription",type:"string"}],name:"ChannelNotifcationSettingsAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"ChannelOwnershipTransfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"address",name:"revoker",type:"address"}],name:"ChannelVerificationRevoked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"address",name:"verifier",type:"address"}],name:"ChannelVerified",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"uint256",name:"amountClaimed",type:"uint256"}],name:"ChatIncentiveClaimed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"uint256",name:"amountRefunded",type:"uint256"}],name:"DeactivateChannel",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"requestSender",type:"address"},{indexed:!1,internalType:"address",name:"requestReceiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amountForReqReceiver",type:"uint256"},{indexed:!1,internalType:"uint256",name:"feePoolAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"timestamp",type:"uint256"}],name:"IncentivizeChatReqReceived",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"uint256",name:"amountDeposited",type:"uint256"}],name:"ReactivateChannel",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"rewardAmount",type:"uint256"}],name:"RewardsClaimed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"uint256",name:"rewardAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fromEpoch",type:"uint256"},{indexed:!1,internalType:"uint256",name:"tillEpoch",type:"uint256"}],name:"RewardsHarvested",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"uint256",name:"amountStaked",type:"uint256"}],name:"Staked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"uint256",name:"amountRefunded",type:"uint256"}],name:"TimeBoundChannelDestroyed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"uint256",name:"amountUnstaked",type:"uint256"}],name:"Unstaked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!1,internalType:"bytes",name:"identity",type:"bytes"},{indexed:!0,internalType:"uint256",name:"amountDeposited",type:"uint256"}],name:"UpdateChannel",type:"event"},{inputs:[],name:"ADD_CHANNEL_MIN_FEES",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"CHANNEL_POOL_FUNDS",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"CREATE_CHANNEL_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"DOMAIN_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"FEE_AMOUNT",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"MIN_POOL_CONTRIBUTION",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"PROTOCOL_POOL_FEES",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"PUSH_TOKEN_ADDRESS",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"REFERRAL_CODE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"UNISWAP_V2_ROUTER",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"WETH_ADDRESS",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"aDaiAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_rewardAmount",type:"uint256"}],name:"addPoolFees",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"_subGraphData",type:"bytes"}],name:"addSubGraph",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_startIndex",type:"uint256"},{internalType:"uint256",name:"_endIndex",type:"uint256"},{internalType:"address[]",name:"_channelList",type:"address[]"}],name:"batchVerification",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channelAddress",type:"address"}],name:"blockChannel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_user",type:"address"},{internalType:"uint256",name:"_epochId",type:"uint256"}],name:"calculateEpochRewards",outputs:[{internalType:"uint256",name:"rewards",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"celebUserFunds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"channelById",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"channelNotifSettings",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"channelUpdateCounter",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"channels",outputs:[{internalType:"enum EPNSCoreStorageV1_5.ChannelType",name:"channelType",type:"uint8"},{internalType:"uint8",name:"channelState",type:"uint8"},{internalType:"address",name:"verifiedBy",type:"address"},{internalType:"uint256",name:"poolContribution",type:"uint256"},{internalType:"uint256",name:"channelHistoricalZ",type:"uint256"},{internalType:"uint256",name:"channelFairShareCount",type:"uint256"},{internalType:"uint256",name:"channelLastUpdate",type:"uint256"},{internalType:"uint256",name:"channelStartBlock",type:"uint256"},{internalType:"uint256",name:"channelUpdateBlock",type:"uint256"},{internalType:"uint256",name:"channelWeight",type:"uint256"},{internalType:"uint256",name:"expiryTime",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"channelsCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_amount",type:"uint256"}],name:"claimChatIncentives",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_notifOptions",type:"uint256"},{internalType:"string",name:"_notifSettings",type:"string"},{internalType:"string",name:"_notifDescription",type:"string"},{internalType:"uint256",name:"_amountDeposited",type:"uint256"}],name:"createChannelSettings",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"enum EPNSCoreStorageV1_5.ChannelType",name:"_channelType",type:"uint8"},{internalType:"bytes",name:"_identity",type:"bytes"},{internalType:"uint256",name:"_amount",type:"uint256"},{internalType:"uint256",name:"_channelExpiryTime",type:"uint256"}],name:"createChannelWithPUSH",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"daiAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_tillEpoch",type:"uint256"}],name:"daoHarvestPaginated",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deactivateChannel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channelAddress",type:"address"}],name:"destroyTimeBoundChannel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"epnsCommunicator",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"epochDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"epochRewards",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"epochToTotalStakedWeight",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"genesisEpoch",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"}],name:"getChannelVerfication",outputs:[{internalType:"uint8",name:"verificationStatus",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"governance",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"groupFairShareCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"groupHistoricalZ",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"groupLastUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"groupNormalizedWeight",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"requestSender",type:"address"},{internalType:"address",name:"requestReceiver",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"handleChatRequestData",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"harvestAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_tillEpoch",type:"uint256"}],name:"harvestPaginated",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_pushChannelAdmin",type:"address"},{internalType:"address",name:"_pushTokenAddress",type:"address"},{internalType:"address",name:"_wethAddress",type:"address"},{internalType:"address",name:"_uniswapRouterAddress",type:"address"},{internalType:"address",name:"_lendingPoolProviderAddress",type:"address"},{internalType:"address",name:"_daiAddress",type:"address"},{internalType:"address",name:"_aDaiAddress",type:"address"},{internalType:"uint256",name:"_referralCode",type:"uint256"}],name:"initialize",outputs:[{internalType:"bool",name:"success",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"initializeStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"isMigrationComplete",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_from",type:"uint256"},{internalType:"uint256",name:"_to",type:"uint256"}],name:"lastEpochRelative",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"lendingPoolProviderAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"pauseContract",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"previouslySetEpochRewards",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"pushChannelAdmin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_amount",type:"uint256"}],name:"reactivateChannel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_commAddress",type:"address"}],name:"setEpnsCommunicatorAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_newFees",type:"uint256"}],name:"setFeeAmount",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_governanceAddress",type:"address"}],name:"setGovernanceAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_newFees",type:"uint256"}],name:"setMinChannelCreationFees",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_newAmount",type:"uint256"}],name:"setMinPoolContribution",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_amount",type:"uint256"}],name:"stake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalStakedAmount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_newAdmin",type:"address"}],name:"transferPushChannelAdminControl",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unPauseContract",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unstake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"}],name:"unverifyChannel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"},{internalType:"bytes",name:"_newIdentity",type:"bytes"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"updateChannelMeta",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"userFeesInfo",outputs:[{internalType:"uint256",name:"stakedAmount",type:"uint256"},{internalType:"uint256",name:"stakedWeight",type:"uint256"},{internalType:"uint256",name:"lastStakedBlock",type:"uint256"},{internalType:"uint256",name:"lastClaimedBlock",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"usersRewardsClaimed",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"}],name:"verifyChannel",outputs:[],stateMutability:"nonpayable",type:"function"}]),qo}var jo={},Om;function aK(){return Om||(Om=1,Object.defineProperty(jo,"__esModule",{value:!0}),jo.commABI=void 0,jo.commABI=[{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"channel",type:"address"},{indexed:!1,internalType:"address",name:"delegate",type:"address"}],name:"AddDelegate",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"_chainName",type:"string"},{indexed:!0,internalType:"uint256",name:"_chainID",type:"uint256"},{indexed:!0,internalType:"address",name:"_channelOwnerAddress",type:"address"},{indexed:!1,internalType:"string",name:"_ethereumChannelAddress",type:"string"}],name:"ChannelAlias",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"bytes",name:"publickey",type:"bytes"}],name:"PublicKeyRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"channel",type:"address"},{indexed:!1,internalType:"address",name:"delegate",type:"address"}],name:"RemoveDelegate",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"bytes",name:"identity",type:"bytes"}],name:"SendNotification",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"address",name:"user",type:"address"}],name:"Subscribe",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"address",name:"user",type:"address"}],name:"Unsubscribe",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"_channel",type:"address"},{indexed:!1,internalType:"address",name:"_user",type:"address"},{indexed:!1,internalType:"uint256",name:"_notifID",type:"uint256"},{indexed:!1,internalType:"string",name:"_notifSettings",type:"string"}],name:"UserNotifcationSettingsAdded",type:"event"},{inputs:[],name:"DOMAIN_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"EPNSCoreAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"NAME_HASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"SEND_NOTIFICATION_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"SUBSCRIBE_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"UNSUBSCRIBE_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_delegate",type:"address"}],name:"addDelegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address[]",name:"_channelList",type:"address[]"}],name:"batchSubscribe",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address[]",name:"_channelList",type:"address[]"}],name:"batchUnsubscribe",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"_publicKey",type:"bytes"}],name:"broadcastUserPublicKey",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"chainID",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"chainName",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"},{internalType:"uint256",name:"_notifID",type:"uint256"},{internalType:"string",name:"_notifSettings",type:"string"}],name:"changeUserChannelSettings",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"completeMigration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"delegatedNotificationSenders",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_publicKey",type:"bytes"}],name:"getWalletFromPublicKey",outputs:[{internalType:"address",name:"wallet",type:"address"}],stateMutability:"pure",type:"function"},{inputs:[],name:"governance",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_pushChannelAdmin",type:"address"},{internalType:"string",name:"_chainName",type:"string"}],name:"initialize",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"isMigrationComplete",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"},{internalType:"address",name:"_user",type:"address"}],name:"isUserSubscribed",outputs:[{internalType:"bool",name:"isSubscriber",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"mapAddressUsers",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_startIndex",type:"uint256"},{internalType:"uint256",name:"_endIndex",type:"uint256"},{internalType:"address[]",name:"_channelList",type:"address[]"},{internalType:"address[]",name:"_usersList",type:"address[]"}],name:"migrateSubscribeData",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"pushChannelAdmin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_delegate",type:"address"}],name:"removeDelegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"},{internalType:"address",name:"_recipient",type:"address"},{internalType:"bytes",name:"_identity",type:"bytes"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"sendNotifBySig",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"},{internalType:"address",name:"_recipient",type:"address"},{internalType:"bytes",name:"_identity",type:"bytes"}],name:"sendNotification",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_coreAddress",type:"address"}],name:"setEPNSCoreAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_governanceAddress",type:"address"}],name:"setGovernanceAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"}],name:"subscribe",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"channel",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"subscribeBySig",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"},{internalType:"address",name:"_user",type:"address"}],name:"subscribeViaCore",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_newAdmin",type:"address"}],name:"transferPushChannelAdminControl",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"}],name:"unsubscribe",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"channel",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"unsubscribeBySig",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"userToChannelNotifs",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"users",outputs:[{internalType:"bool",name:"userActivated",type:"bool"},{internalType:"bool",name:"publicKeyRegistered",type:"bool"},{internalType:"uint256",name:"userStartBlock",type:"uint256"},{internalType:"uint256",name:"subscribedCount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"usersCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"_channelAddress",type:"string"}],name:"verifyChannelAlias",outputs:[],stateMutability:"nonpayable",type:"function"}]),jo}var $o={},Mm;function oK(){return Mm||(Mm=1,Object.defineProperty($o,"__esModule",{value:!0}),$o.tokenABI=void 0,$o.tokenABI=[{inputs:[{internalType:"address",name:"account",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"delegator",type:"address"},{indexed:!0,internalType:"address",name:"fromDelegate",type:"address"},{indexed:!0,internalType:"address",name:"toDelegate",type:"address"}],name:"DelegateChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"delegate",type:"address"},{indexed:!1,internalType:"uint256",name:"previousBalance",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newBalance",type:"uint256"}],name:"DelegateVotesChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"holder",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"weight",type:"uint256"}],name:"HolderWeightChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DELEGATION_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"DOMAIN_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"PERMIT_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"rawAmount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"born",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"rawAmount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint32",name:"",type:"uint32"}],name:"checkpoints",outputs:[{internalType:"uint32",name:"fromBlock",type:"uint32"},{internalType:"uint96",name:"votes",type:"uint96"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"delegatee",type:"address"}],name:"delegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"delegatee",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"delegateBySig",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"delegates",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"getCurrentVotes",outputs:[{internalType:"uint96",name:"",type:"uint96"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"blockNumber",type:"uint256"}],name:"getPriorVotes",outputs:[{internalType:"uint96",name:"",type:"uint96"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"holderDelegation",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"holderWeight",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"numCheckpoints",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"rawAmount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"holder",type:"address"}],name:"resetHolderWeight",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"delegate",type:"address"}],name:"returnHolderDelegation",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"returnHolderRatio",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"delegate",type:"address"},{internalType:"bool",name:"value",type:"bool"}],name:"setHolderDelegation",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"dst",type:"address"},{internalType:"uint256",name:"rawAmount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"src",type:"address"},{internalType:"address",name:"dst",type:"address"},{internalType:"uint256",name:"rawAmount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}]),$o}const _9=gf(zL);var ln={},Nm;function cK(){if(Nm)return ln;Nm=1,Object.defineProperty(ln,"__esModule",{value:!0}),ln.lineaSepoliaTestnet=ln.cyberConnectMainnet=ln.cyberConnectTestnet=ln.berachainTestnet=ln.polygonAmoy=ln.polygonZkEvmCordona=void 0;const e=Ra();return ln.polygonZkEvmCordona=(0,e.defineChain)({id:2442,name:"Polygon zkEVM Cardona Testnet",network:"polygon-zkevm-testnet",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.cardona.zkevm-rpc.com/"]},public:{http:["https://rpc.cardona.zkevm-rpc.com/"]}},blockExplorers:{default:{name:"Polygon zkEVM Cardona",url:" https://cardona-zkevm.polygonscan.com/"}},testnet:!0}),ln.polygonAmoy=(0,e.defineChain)({id:80002,name:"Polygon Amoy Testnet",network:"polygon-amoy",nativeCurrency:{decimals:18,name:"MATIC",symbol:"MATIC"},rpcUrls:{default:{http:["https://rpc-amoy.polygon.technology/"]},public:{http:["https://rpc-amoy.polygon.technology/"]}},blockExplorers:{default:{name:"Polygon Amoy",url:"https://www.oklink.com/amoy"}},testnet:!0}),ln.berachainTestnet=(0,e.defineChain)({id:80085,name:"Berachain Artio",network:"berachain-testnet",nativeCurrency:{decimals:18,name:"BERA Token",symbol:"BERA"},rpcUrls:{default:{http:["https://artio.rpc.berachain.com"]},public:{http:["https://artio.rpc.berachain.com"]}},blockExplorers:{default:{name:"Berachain",url:"https://artio.beratrail.io"}},testnet:!0}),ln.cyberConnectTestnet=(0,e.defineChain)({id:111557560,name:"Cyber Testnet",network:"cyberconnect-testent",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cyber-testnet.alt.technology"]},public:{http:["https://cyber-testnet.alt.technology"]}},blockExplorers:{default:{name:"Blockscout",url:"https://testnet.cyberscan.co"}},contracts:{multicall3:{address:"0xffc391F0018269d4758AEA1a144772E8FB99545E",blockCreated:304545}},testnet:!0}),ln.cyberConnectMainnet=(0,e.defineChain)({id:7560,name:"Cyber",network:"cyberconnect-mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cyber.alt.technology"]},public:{http:["https://cyber.alt.technology"]}},blockExplorers:{default:{name:"Blockscout",url:"https://cyberscan.co",apiUrl:"https://cyberscan.co/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:0}}}),ln.lineaSepoliaTestnet=(0,e.defineChain)({id:59141,name:"Linea Sepolia Testnet",network:"linea-sepolia-testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.sepolia.linea.build"],webSocket:["wss://rpc.sepolia.linea.build"]},public:{http:["https://rpc.sepolia.linea.build"],webSocket:["wss://rpc.sepolia.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.lineascan.build",apiUrl:"https://api-sepolia.lineascan.build/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:227427}},testnet:!0}),ln}var Um;function un(){return Um||(Um=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ALPHA_FEATURE_CONFIG=e.VIEM_CONFIG=e.CHANNEL_TYPE=e.ABIS=e.MIN_TOKEN_BALANCE=e.TOKEN_VIEM_NETWORK_MAP=e.TOKEN=e.CORE_CONFIG=e.VIEM_CORE_CONFIG=e.CHAIN_NAME=e.CHAIN_ID=e.ALIAS_CHAIN_ID=e.ETH_CHAIN_ID=e.API_BASE_URL=void 0;const t=Ze(),r=sK(),n=aK(),s=oK(),i=_9,o=cK();e.API_BASE_URL={[t.ENV.PROD]:"https://backend.epns.io/apis",[t.ENV.STAGING]:"https://backend-staging.epns.io/apis",[t.ENV.DEV]:"https://backend-dev.epns.io/apis",[t.ENV.LOCAL]:"http://localhost:4000/apis"};const a={ETH_MAINNET:"eip155:1",ETH_SEPOLIA:"eip155:11155111",POLYGON_MAINNET:"eip155:137",POLYGON_AMOY:"eip155:80002",BSC_MAINNET:"eip155:56",BSC_TESTNET:"eip155:97",OPTIMISM_TESTNET:"eip155:11155420",OPTIMISM_MAINNET:"eip155:10",POLYGON_ZK_EVM_TESTNET:"eip155:2442",POLYGON_ZK_EVM_MAINNET:"eip155:1101",ARBITRUM_TESTNET:"eip155:421614",ARBITRUMONE_MAINNET:"eip155:42161",FUSE_TESTNET:"eip155:123",FUSE_MAINNET:"eip155:122",BERACHAIN_TESTNET:"eip155:80085",LINEA_MAINNET:"eip155:59144",LINEA_TESTNET:"eip155:59141",CYBER_CONNECT_TESTNET:"eip155:111557560",CYBER_CONNECT_MAINNET:"eip155:7560",BASE_TESTNET:"eip155:84532",BASE_MAINNET:"eip155:8453"};e.ETH_CHAIN_ID={[t.ENV.PROD]:1,[t.ENV.STAGING]:11155111,[t.ENV.DEV]:11155111,[t.ENV.LOCAL]:11155111},e.ALIAS_CHAIN_ID={POLYGON:{[t.ENV.PROD]:137,[t.ENV.STAGING]:80002,[t.ENV.DEV]:80002,[t.ENV.LOCAL]:80002},BSC:{[t.ENV.PROD]:56,[t.ENV.STAGING]:97,[t.ENV.DEV]:97,[t.ENV.LOCAL]:97},OPTIMISM:{[t.ENV.PROD]:10,[t.ENV.STAGING]:11155420,[t.ENV.DEV]:11155420,[t.ENV.LOCAL]:11155420},POLYGONZKEVM:{[t.ENV.PROD]:1101,[t.ENV.STAGING]:2442,[t.ENV.DEV]:2442,[t.ENV.LOCAL]:2442},ARBITRUMONE:{[t.ENV.PROD]:42161,[t.ENV.STAGING]:421614,[t.ENV.DEV]:421614,[t.ENV.LOCAL]:421614},FUSE:{[t.ENV.PROD]:122,[t.ENV.STAGING]:123,[t.ENV.DEV]:123,[t.ENV.LOCAL]:123},BERACHAIN:{[t.ENV.PROD]:0,[t.ENV.STAGING]:80085,[t.ENV.DEV]:80085,[t.ENV.LOCAL]:80085},LINEA:{[t.ENV.PROD]:59144,[t.ENV.STAGING]:59141,[t.ENV.DEV]:59141,[t.ENV.LOCAL]:59141},CYBERCONNECT:{[t.ENV.PROD]:7560,[t.ENV.STAGING]:111557560,[t.ENV.DEV]:111557560,[t.ENV.LOCAL]:111557560},BASE:{[t.ENV.PROD]:8453,[t.ENV.STAGING]:84532,[t.ENV.DEV]:84532,[t.ENV.LOCAL]:84532}},e.CHAIN_ID=Object.assign({ETHEREUM:e.ETH_CHAIN_ID},e.ALIAS_CHAIN_ID),e.CHAIN_NAME={1:"ETHEREUM",11155111:"ETHEREUM",137:"POLYGON",80002:"POLYGON",56:"BSC",97:"BSC",10:"OPTIMISM",11155420:"OPTIMISM",1101:"POLYGONZKEVM",2442:"POLYGONZKEVM",421614:"ARBITRUN",42161:"ARBITRUM",122:"FUSE",123:"FUSE",80085:"BERACHAIN",59144:"LINEA",59141:"LINEA",7560:"CYBER_CONNECT_MAINNET",111557560:"CYBER_CONNECT_TESTNET",8453:"BASE_MAINNET",84532:"BASE_TESTNET"},e.VIEM_CORE_CONFIG={[t.ENV.PROD]:{NETWORK:i.mainnet,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_CORE_CONTRACT:"0x66329Fdd4042928BfCAB60b179e1538D56eeeeeE"},[t.ENV.STAGING]:{NETWORK:i.sepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_CORE_CONTRACT:"0x9d65129223451fbd58fc299c635cd919baf2564c"},[t.ENV.DEV]:{NETWORK:i.sepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_CORE_CONTRACT:"0x5ab1520e2bd519bdab2e1347eee81c00a77f4946"},[t.ENV.LOCAL]:{NETWORK:i.sepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_CORE_CONTRACT:"0x5ab1520e2bd519bdab2e1347eee81c00a77f4946"}},e.CORE_CONFIG={[t.ENV.PROD]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_CORE_CONTRACT:"0x66329Fdd4042928BfCAB60b179e1538D56eeeeeE"},[t.ENV.STAGING]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_CORE_CONTRACT:"0x9d65129223451fbd58fc299c635cd919baf2564c"},[t.ENV.DEV]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_CORE_CONTRACT:"0x5ab1520e2bd519bdab2e1347eee81c00a77f4946"},[t.ENV.LOCAL]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_CORE_CONTRACT:"0x5ab1520e2bd519bdab2e1347eee81c00a77f4946"}};const f={[t.ENV.PROD]:{[a.ETH_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.POLYGON_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BSC_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.OPTIMISM_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.POLYGON_ZK_EVM_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.ARBITRUMONE_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.FUSE_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.CYBER_CONNECT_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.LINEA_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0x0d8e75CB5d8873c43c5d9Add71Fd71a09F7Ef890"},[a.BASE_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"}},[t.ENV.STAGING]:{[a.ETH_SEPOLIA]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x0c34d54a09cfe75bccd878a469206ae77e0fe6e7"},[a.POLYGON_AMOY]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BSC_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.OPTIMISM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x9Dc25996ba72A2FD7E64e7a674232a683f406F1A"},[a.POLYGON_ZK_EVM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x6e489b7af21ceb969f49a90e481274966ce9d74d"},[a.ARBITRUM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x9Dc25996ba72A2FD7E64e7a674232a683f406F1A"},[a.FUSE_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BERACHAIN_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x7b9C405e261ba671f008c20D0321f62d08C140EC"},[a.LINEA_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.CYBER_CONNECT_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x6e489B7af21cEb969f49A90E481274966ce9D74d"},[a.BASE_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x6e489B7af21cEb969f49A90E481274966ce9D74d"}},[t.ENV.DEV]:{[a.ETH_SEPOLIA]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9dDCD7ed7151afab43044E4D694FA064742C428c"},[a.POLYGON_AMOY]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.BSC_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x4132061E3349ff36cFfCadA460E10Bd4f31F7ea8"},[a.OPTIMISM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.POLYGON_ZK_EVM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.ARBITRUM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.FUSE_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x7eBb54D86CF928115965DB596a3E600404dD8039"},[a.BERACHAIN_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0xA1DF3E68D085aa6918bcc2506b24e499830Db0eB"},[a.LINEA_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.CYBER_CONNECT_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.BASE_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"}},[t.ENV.LOCAL]:{[a.ETH_SEPOLIA]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9dDCD7ed7151afab43044E4D694FA064742C428c"},[a.POLYGON_AMOY]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.BSC_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x4132061E3349ff36cFfCadA460E10Bd4f31F7ea8"},[a.OPTIMISM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.POLYGON_ZK_EVM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.ARBITRUM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.FUSE_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x7eBb54D86CF928115965DB596a3E600404dD8039"},[a.BERACHAIN_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0xA1DF3E68D085aa6918bcc2506b24e499830Db0eB"},[a.LINEA_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.CYBER_CONNECT_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.BASE_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"}}};e.default=f,e.TOKEN={[t.ENV.PROD]:"0xf418588522d5dd018b425E472991E52EBBeEEEEE",[t.ENV.STAGING]:"0x37c779a1564DCc0e3914aB130e0e787d93e21804",[t.ENV.DEV]:"0x37c779a1564DCc0e3914aB130e0e787d93e21804",[t.ENV.LOCAL]:"0x37c779a1564DCc0e3914aB130e0e787d93e21804"},e.TOKEN_VIEM_NETWORK_MAP={[t.ENV.PROD]:i.mainnet,[t.ENV.STAGING]:i.sepolia,[t.ENV.DEV]:i.sepolia,[t.ENV.LOCAL]:i.sepolia},e.MIN_TOKEN_BALANCE={[t.ENV.PROD]:50,[t.ENV.STAGING]:50,[t.ENV.DEV]:50,[t.ENV.LOCAL]:50},e.ABIS={CORE:r.coreABI,COMM:n.commABI,TOKEN:s.tokenABI},e.CHANNEL_TYPE={TIMEBOUND:4,GENERAL:2},e.VIEM_CONFIG={[t.ENV.PROD]:{[a.ETH_MAINNET]:{NETWORK:i.mainnet,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.POLYGON_MAINNET]:{NETWORK:i.polygon,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BSC_MAINNET]:{NETWORK:i.bsc,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.OPTIMISM_MAINNET]:{NETWORK:i.optimism,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.POLYGON_ZK_EVM_MAINNET]:{NETWORK:i.polygonZkEvm,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.ARBITRUMONE_MAINNET]:{NETWORK:i.arbitrum,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.FUSE_MAINNET]:{NETWORK:i.fuse,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.LINEA_MAINNET]:{NETWORK:i.linea,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0x0d8e75CB5d8873c43c5d9Add71Fd71a09F7Ef890"},[a.CYBER_CONNECT_MAINNET]:{NETWORK:o.cyberConnectMainnet,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BASE_MAINNET]:{NETWORK:i.base,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"}},[t.ENV.STAGING]:{[a.ETH_SEPOLIA]:{NETWORK:i.sepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x0c34d54a09cfe75bccd878a469206ae77e0fe6e7"},[a.POLYGON_AMOY]:{NETWORK:o.polygonAmoy,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BSC_TESTNET]:{NETWORK:i.bscTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.OPTIMISM_TESTNET]:{NETWORK:i.optimismSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x9Dc25996ba72A2FD7E64e7a674232a683f406F1A"},[a.POLYGON_ZK_EVM_TESTNET]:{NETWORK:o.polygonZkEvmCordona,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x6e489b7af21ceb969f49a90e481274966ce9d74d"},[a.ARBITRUM_TESTNET]:{NETWORK:i.arbitrumSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x9Dc25996ba72A2FD7E64e7a674232a683f406F1A"},[a.FUSE_TESTNET]:{NETWORK:i.fuseSparknet,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BERACHAIN_TESTNET]:{NETWORK:o.berachainTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x7b9C405e261ba671f008c20D0321f62d08C140EC"},[a.LINEA_TESTNET]:{NETWORK:o.lineaSepoliaTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.CYBER_CONNECT_TESTNET]:{NETWORK:o.cyberConnectTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x6e489B7af21cEb969f49A90E481274966ce9D74d"},[a.BASE_TESTNET]:{NETWORK:i.baseSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x6e489B7af21cEb969f49A90E481274966ce9D74d"}},[t.ENV.DEV]:{[a.ETH_SEPOLIA]:{NETWORK:i.sepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9dDCD7ed7151afab43044E4D694FA064742C428c"},[a.POLYGON_AMOY]:{NETWORK:o.polygonAmoy,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.BSC_TESTNET]:{NETWORK:i.bscTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x4132061E3349ff36cFfCadA460E10Bd4f31F7ea8"},[a.OPTIMISM_TESTNET]:{NETWORK:i.optimismSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.POLYGON_ZK_EVM_TESTNET]:{NETWORK:o.polygonZkEvmCordona,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.ARBITRUM_TESTNET]:{NETWORK:i.arbitrumSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.FUSE_TESTNET]:{NETWORK:i.fuseSparknet,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x7eBb54D86CF928115965DB596a3E600404dD8039"},[a.BERACHAIN_TESTNET]:{NETWORK:o.berachainTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0xA1DF3E68D085aa6918bcc2506b24e499830Db0eB"},[a.LINEA_TESTNET]:{NETWORK:o.lineaSepoliaTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.CYBER_CONNECT_TESTNET]:{NETWORK:o.cyberConnectTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.BASE_TESTNET]:{NETWORK:i.baseSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"}},[t.ENV.LOCAL]:{[a.ETH_SEPOLIA]:{NETWORK:i.sepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9dDCD7ed7151afab43044E4D694FA064742C428c"},[a.POLYGON_AMOY]:{NETWORK:o.polygonAmoy,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.BSC_TESTNET]:{NETWORK:i.bscTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x4132061E3349ff36cFfCadA460E10Bd4f31F7ea8"},[a.OPTIMISM_TESTNET]:{NETWORK:i.optimismSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.POLYGON_ZK_EVM_TESTNET]:{NETWORK:o.polygonZkEvmCordona,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.ARBITRUM_TESTNET]:{NETWORK:i.arbitrumSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.FUSE_TESTNET]:{NETWORK:i.fuseSparknet,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x7eBb54D86CF928115965DB596a3E600404dD8039"},[a.BERACHAIN_TESTNET]:{NETWORK:o.berachainTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0xA1DF3E68D085aa6918bcc2506b24e499830Db0eB"},[a.LINEA_TESTNET]:{NETWORK:o.lineaSepoliaTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.CYBER_CONNECT_TESTNET]:{NETWORK:o.cyberConnectTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.BASE_TESTNET]:{NETWORK:i.baseSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"}}},e.ALPHA_FEATURE_CONFIG={STABLE:{feature:[]},ALPHA:{feature:[t.default.ALPHA_FEATURES.SCALABILITY_V2]}}}(ch)),ch}var Lm;function uK(){if(Lm)return Js;Lm=1,Object.defineProperty(Js,"__esModule",{value:!0}),Js.getAPIBaseUrls=Js.getConfig=void 0;const e=un(),t=(n,{blockchain:s,networkId:i})=>{const o=`${s}:${i}`,a=e.default[n][o];if(!a)throw Error(`
2
+ [Push SDK] - cannot determine config for
3
+ env: ${n},
4
+ blockchain: ${s},
5
+ networkId: ${i}
6
+ `);return a};Js.getConfig=t;function r(n){if(!n)throw Error("ENV not provided!");return e.API_BASE_URL[n]}return Js.getAPIBaseUrls=r,Js}var lh={},dh={},fh={},hh={},Li={},ph={exports:{}},yh={exports:{}},Km;function zt(){return Km||(Km=1,function(e,t){(function(r,n){e.exports=n()})(rt,function(){var r=r||function(n,s){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof rt<"u"&&rt.crypto&&(i=rt.crypto),!i&&typeof ka=="function")try{i=xa}catch{}var o=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function b(){}return function(w){var _;return b.prototype=w,_=new b,b.prototype=null,_}}(),f={},c=f.lib={},l=c.Base=function(){return{extend:function(b){var w=a(this);return b&&w.mixIn(b),(!w.hasOwnProperty("init")||this.init===w.init)&&(w.init=function(){w.$super.init.apply(this,arguments)}),w.init.prototype=w,w.$super=this,w},create:function(){var b=this.extend();return b.init.apply(b,arguments),b},init:function(){},mixIn:function(b){for(var w in b)b.hasOwnProperty(w)&&(this[w]=b[w]);b.hasOwnProperty("toString")&&(this.toString=b.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),u=c.WordArray=l.extend({init:function(b,w){b=this.words=b||[],w!=s?this.sigBytes=w:this.sigBytes=b.length*4},toString:function(b){return(b||d).stringify(this)},concat:function(b){var w=this.words,_=b.words,C=this.sigBytes,I=b.sigBytes;if(this.clamp(),C%4)for(var k=0;k<I;k++){var E=_[k>>>2]>>>24-k%4*8&255;w[C+k>>>2]|=E<<24-(C+k)%4*8}else for(var S=0;S<I;S+=4)w[C+S>>>2]=_[S>>>2];return this.sigBytes+=I,this},clamp:function(){var b=this.words,w=this.sigBytes;b[w>>>2]&=4294967295<<32-w%4*8,b.length=n.ceil(w/4)},clone:function(){var b=l.clone.call(this);return b.words=this.words.slice(0),b},random:function(b){for(var w=[],_=0;_<b;_+=4)w.push(o());return new u.init(w,b)}}),p=f.enc={},d=p.Hex={stringify:function(b){for(var w=b.words,_=b.sigBytes,C=[],I=0;I<_;I++){var k=w[I>>>2]>>>24-I%4*8&255;C.push((k>>>4).toString(16)),C.push((k&15).toString(16))}return C.join("")},parse:function(b){for(var w=b.length,_=[],C=0;C<w;C+=2)_[C>>>3]|=parseInt(b.substr(C,2),16)<<24-C%8*4;return new u.init(_,w/2)}},h=p.Latin1={stringify:function(b){for(var w=b.words,_=b.sigBytes,C=[],I=0;I<_;I++){var k=w[I>>>2]>>>24-I%4*8&255;C.push(String.fromCharCode(k))}return C.join("")},parse:function(b){for(var w=b.length,_=[],C=0;C<w;C++)_[C>>>2]|=(b.charCodeAt(C)&255)<<24-C%4*8;return new u.init(_,w)}},y=p.Utf8={stringify:function(b){try{return decodeURIComponent(escape(h.stringify(b)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(b){return h.parse(unescape(encodeURIComponent(b)))}},m=c.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(b){typeof b=="string"&&(b=y.parse(b)),this._data.concat(b),this._nDataBytes+=b.sigBytes},_process:function(b){var w,_=this._data,C=_.words,I=_.sigBytes,k=this.blockSize,E=k*4,S=I/E;b?S=n.ceil(S):S=n.max((S|0)-this._minBufferSize,0);var T=S*k,P=n.min(T*4,I);if(T){for(var g=0;g<T;g+=k)this._doProcessBlock(C,g);w=C.splice(0,T),_.sigBytes-=P}return new u.init(w,P)},clone:function(){var b=l.clone.call(this);return b._data=this._data.clone(),b},_minBufferSize:0});c.Hasher=m.extend({cfg:l.extend(),init:function(b){this.cfg=this.cfg.extend(b),this.reset()},reset:function(){m.reset.call(this),this._doReset()},update:function(b){return this._append(b),this._process(),this},finalize:function(b){b&&this._append(b);var w=this._doFinalize();return w},blockSize:16,_createHelper:function(b){return function(w,_){return new b.init(_).finalize(w)}},_createHmacHelper:function(b){return function(w,_){return new v.HMAC.init(b,_).finalize(w)}}});var v=f.algo={};return f}(Math);return r})}(yh)),yh.exports}var gh={exports:{}},Fm;function vf(){return Fm||(Fm=1,function(e,t){(function(r,n){e.exports=n(zt())})(rt,function(r){return function(n){var s=r,i=s.lib,o=i.Base,a=i.WordArray,f=s.x64={};f.Word=o.extend({init:function(c,l){this.high=c,this.low=l}}),f.WordArray=o.extend({init:function(c,l){c=this.words=c||[],l!=n?this.sigBytes=l:this.sigBytes=c.length*8},toX32:function(){for(var c=this.words,l=c.length,u=[],p=0;p<l;p++){var d=c[p];u.push(d.high),u.push(d.low)}return a.create(u,this.sigBytes)},clone:function(){for(var c=o.clone.call(this),l=c.words=this.words.slice(0),u=l.length,p=0;p<u;p++)l[p]=l[p].clone();return c}})}(),r})}(gh)),gh.exports}var mh={exports:{}},qm;function lK(){return qm||(qm=1,function(e,t){(function(r,n){e.exports=n(zt())})(rt,function(r){return function(){if(typeof ArrayBuffer=="function"){var n=r,s=n.lib,i=s.WordArray,o=i.init,a=i.init=function(f){if(f instanceof ArrayBuffer&&(f=new Uint8Array(f)),(f instanceof Int8Array||typeof Uint8ClampedArray<"u"&&f instanceof Uint8ClampedArray||f instanceof Int16Array||f instanceof Uint16Array||f instanceof Int32Array||f instanceof Uint32Array||f instanceof Float32Array||f instanceof Float64Array)&&(f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength)),f instanceof Uint8Array){for(var c=f.byteLength,l=[],u=0;u<c;u++)l[u>>>2]|=f[u]<<24-u%4*8;o.call(this,l,c)}else o.apply(this,arguments)};a.prototype=i}}(),r.lib.WordArray})}(mh)),mh.exports}var vh={exports:{}},jm;function dK(){return jm||(jm=1,function(e,t){(function(r,n){e.exports=n(zt())})(rt,function(r){return function(){var n=r,s=n.lib,i=s.WordArray,o=n.enc;o.Utf16=o.Utf16BE={stringify:function(f){for(var c=f.words,l=f.sigBytes,u=[],p=0;p<l;p+=2){var d=c[p>>>2]>>>16-p%4*8&65535;u.push(String.fromCharCode(d))}return u.join("")},parse:function(f){for(var c=f.length,l=[],u=0;u<c;u++)l[u>>>1]|=f.charCodeAt(u)<<16-u%2*16;return i.create(l,c*2)}},o.Utf16LE={stringify:function(f){for(var c=f.words,l=f.sigBytes,u=[],p=0;p<l;p+=2){var d=a(c[p>>>2]>>>16-p%4*8&65535);u.push(String.fromCharCode(d))}return u.join("")},parse:function(f){for(var c=f.length,l=[],u=0;u<c;u++)l[u>>>1]|=a(f.charCodeAt(u)<<16-u%2*16);return i.create(l,c*2)}};function a(f){return f<<8&4278255360|f>>>8&16711935}}(),r.enc.Utf16})}(vh)),vh.exports}var bh={exports:{}},$m;function La(){return $m||($m=1,function(e,t){(function(r,n){e.exports=n(zt())})(rt,function(r){return function(){var n=r,s=n.lib,i=s.WordArray,o=n.enc;o.Base64={stringify:function(f){var c=f.words,l=f.sigBytes,u=this._map;f.clamp();for(var p=[],d=0;d<l;d+=3)for(var h=c[d>>>2]>>>24-d%4*8&255,y=c[d+1>>>2]>>>24-(d+1)%4*8&255,m=c[d+2>>>2]>>>24-(d+2)%4*8&255,v=h<<16|y<<8|m,b=0;b<4&&d+b*.75<l;b++)p.push(u.charAt(v>>>6*(3-b)&63));var w=u.charAt(64);if(w)for(;p.length%4;)p.push(w);return p.join("")},parse:function(f){var c=f.length,l=this._map,u=this._reverseMap;if(!u){u=this._reverseMap=[];for(var p=0;p<l.length;p++)u[l.charCodeAt(p)]=p}var d=l.charAt(64);if(d){var h=f.indexOf(d);h!==-1&&(c=h)}return a(f,c,u)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function a(f,c,l){for(var u=[],p=0,d=0;d<c;d++)if(d%4){var h=l[f.charCodeAt(d-1)]<<d%4*2,y=l[f.charCodeAt(d)]>>>6-d%4*2,m=h|y;u[p>>>2]|=m<<24-p%4*8,p++}return i.create(u,p)}}(),r.enc.Base64})}(bh)),bh.exports}var _h={exports:{}},Hm;function fK(){return Hm||(Hm=1,function(e,t){(function(r,n){e.exports=n(zt())})(rt,function(r){return function(){var n=r,s=n.lib,i=s.WordArray,o=n.enc;o.Base64url={stringify:function(f,c){c===void 0&&(c=!0);var l=f.words,u=f.sigBytes,p=c?this._safe_map:this._map;f.clamp();for(var d=[],h=0;h<u;h+=3)for(var y=l[h>>>2]>>>24-h%4*8&255,m=l[h+1>>>2]>>>24-(h+1)%4*8&255,v=l[h+2>>>2]>>>24-(h+2)%4*8&255,b=y<<16|m<<8|v,w=0;w<4&&h+w*.75<u;w++)d.push(p.charAt(b>>>6*(3-w)&63));var _=p.charAt(64);if(_)for(;d.length%4;)d.push(_);return d.join("")},parse:function(f,c){c===void 0&&(c=!0);var l=f.length,u=c?this._safe_map:this._map,p=this._reverseMap;if(!p){p=this._reverseMap=[];for(var d=0;d<u.length;d++)p[u.charCodeAt(d)]=d}var h=u.charAt(64);if(h){var y=f.indexOf(h);y!==-1&&(l=y)}return a(f,l,p)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function a(f,c,l){for(var u=[],p=0,d=0;d<c;d++)if(d%4){var h=l[f.charCodeAt(d-1)]<<d%4*2,y=l[f.charCodeAt(d)]>>>6-d%4*2,m=h|y;u[p>>>2]|=m<<24-p%4*8,p++}return i.create(u,p)}}(),r.enc.Base64url})}(_h)),_h.exports}var wh={exports:{}},Vm;function Ka(){return Vm||(Vm=1,function(e,t){(function(r,n){e.exports=n(zt())})(rt,function(r){return function(n){var s=r,i=s.lib,o=i.WordArray,a=i.Hasher,f=s.algo,c=[];(function(){for(var y=0;y<64;y++)c[y]=n.abs(n.sin(y+1))*4294967296|0})();var l=f.MD5=a.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(y,m){for(var v=0;v<16;v++){var b=m+v,w=y[b];y[b]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360}var _=this._hash.words,C=y[m+0],I=y[m+1],k=y[m+2],E=y[m+3],S=y[m+4],T=y[m+5],P=y[m+6],g=y[m+7],A=y[m+8],x=y[m+9],D=y[m+10],O=y[m+11],B=y[m+12],L=y[m+13],M=y[m+14],R=y[m+15],N=_[0],F=_[1],z=_[2],Y=_[3];N=u(N,F,z,Y,C,7,c[0]),Y=u(Y,N,F,z,I,12,c[1]),z=u(z,Y,N,F,k,17,c[2]),F=u(F,z,Y,N,E,22,c[3]),N=u(N,F,z,Y,S,7,c[4]),Y=u(Y,N,F,z,T,12,c[5]),z=u(z,Y,N,F,P,17,c[6]),F=u(F,z,Y,N,g,22,c[7]),N=u(N,F,z,Y,A,7,c[8]),Y=u(Y,N,F,z,x,12,c[9]),z=u(z,Y,N,F,D,17,c[10]),F=u(F,z,Y,N,O,22,c[11]),N=u(N,F,z,Y,B,7,c[12]),Y=u(Y,N,F,z,L,12,c[13]),z=u(z,Y,N,F,M,17,c[14]),F=u(F,z,Y,N,R,22,c[15]),N=p(N,F,z,Y,I,5,c[16]),Y=p(Y,N,F,z,P,9,c[17]),z=p(z,Y,N,F,O,14,c[18]),F=p(F,z,Y,N,C,20,c[19]),N=p(N,F,z,Y,T,5,c[20]),Y=p(Y,N,F,z,D,9,c[21]),z=p(z,Y,N,F,R,14,c[22]),F=p(F,z,Y,N,S,20,c[23]),N=p(N,F,z,Y,x,5,c[24]),Y=p(Y,N,F,z,M,9,c[25]),z=p(z,Y,N,F,E,14,c[26]),F=p(F,z,Y,N,A,20,c[27]),N=p(N,F,z,Y,L,5,c[28]),Y=p(Y,N,F,z,k,9,c[29]),z=p(z,Y,N,F,g,14,c[30]),F=p(F,z,Y,N,B,20,c[31]),N=d(N,F,z,Y,T,4,c[32]),Y=d(Y,N,F,z,A,11,c[33]),z=d(z,Y,N,F,O,16,c[34]),F=d(F,z,Y,N,M,23,c[35]),N=d(N,F,z,Y,I,4,c[36]),Y=d(Y,N,F,z,S,11,c[37]),z=d(z,Y,N,F,g,16,c[38]),F=d(F,z,Y,N,D,23,c[39]),N=d(N,F,z,Y,L,4,c[40]),Y=d(Y,N,F,z,C,11,c[41]),z=d(z,Y,N,F,E,16,c[42]),F=d(F,z,Y,N,P,23,c[43]),N=d(N,F,z,Y,x,4,c[44]),Y=d(Y,N,F,z,B,11,c[45]),z=d(z,Y,N,F,R,16,c[46]),F=d(F,z,Y,N,k,23,c[47]),N=h(N,F,z,Y,C,6,c[48]),Y=h(Y,N,F,z,g,10,c[49]),z=h(z,Y,N,F,M,15,c[50]),F=h(F,z,Y,N,T,21,c[51]),N=h(N,F,z,Y,B,6,c[52]),Y=h(Y,N,F,z,E,10,c[53]),z=h(z,Y,N,F,D,15,c[54]),F=h(F,z,Y,N,I,21,c[55]),N=h(N,F,z,Y,A,6,c[56]),Y=h(Y,N,F,z,R,10,c[57]),z=h(z,Y,N,F,P,15,c[58]),F=h(F,z,Y,N,L,21,c[59]),N=h(N,F,z,Y,S,6,c[60]),Y=h(Y,N,F,z,O,10,c[61]),z=h(z,Y,N,F,k,15,c[62]),F=h(F,z,Y,N,x,21,c[63]),_[0]=_[0]+N|0,_[1]=_[1]+F|0,_[2]=_[2]+z|0,_[3]=_[3]+Y|0},_doFinalize:function(){var y=this._data,m=y.words,v=this._nDataBytes*8,b=y.sigBytes*8;m[b>>>5]|=128<<24-b%32;var w=n.floor(v/4294967296),_=v;m[(b+64>>>9<<4)+15]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,m[(b+64>>>9<<4)+14]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,y.sigBytes=(m.length+1)*4,this._process();for(var C=this._hash,I=C.words,k=0;k<4;k++){var E=I[k];I[k]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360}return C},clone:function(){var y=a.clone.call(this);return y._hash=this._hash.clone(),y}});function u(y,m,v,b,w,_,C){var I=y+(m&v|~m&b)+w+C;return(I<<_|I>>>32-_)+m}function p(y,m,v,b,w,_,C){var I=y+(m&b|v&~b)+w+C;return(I<<_|I>>>32-_)+m}function d(y,m,v,b,w,_,C){var I=y+(m^v^b)+w+C;return(I<<_|I>>>32-_)+m}function h(y,m,v,b,w,_,C){var I=y+(v^(m|~b))+w+C;return(I<<_|I>>>32-_)+m}s.MD5=a._createHelper(l),s.HmacMD5=a._createHmacHelper(l)}(Math),r.MD5})}(wh)),wh.exports}var Eh={exports:{}},Gm;function w9(){return Gm||(Gm=1,function(e,t){(function(r,n){e.exports=n(zt())})(rt,function(r){return function(){var n=r,s=n.lib,i=s.WordArray,o=s.Hasher,a=n.algo,f=[],c=a.SHA1=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(l,u){for(var p=this._hash.words,d=p[0],h=p[1],y=p[2],m=p[3],v=p[4],b=0;b<80;b++){if(b<16)f[b]=l[u+b]|0;else{var w=f[b-3]^f[b-8]^f[b-14]^f[b-16];f[b]=w<<1|w>>>31}var _=(d<<5|d>>>27)+v+f[b];b<20?_+=(h&y|~h&m)+1518500249:b<40?_+=(h^y^m)+1859775393:b<60?_+=(h&y|h&m|y&m)-1894007588:_+=(h^y^m)-899497514,v=m,m=y,y=h<<30|h>>>2,h=d,d=_}p[0]=p[0]+d|0,p[1]=p[1]+h|0,p[2]=p[2]+y|0,p[3]=p[3]+m|0,p[4]=p[4]+v|0},_doFinalize:function(){var l=this._data,u=l.words,p=this._nDataBytes*8,d=l.sigBytes*8;return u[d>>>5]|=128<<24-d%32,u[(d+64>>>9<<4)+14]=Math.floor(p/4294967296),u[(d+64>>>9<<4)+15]=p,l.sigBytes=u.length*4,this._process(),this._hash},clone:function(){var l=o.clone.call(this);return l._hash=this._hash.clone(),l}});n.SHA1=o._createHelper(c),n.HmacSHA1=o._createHmacHelper(c)}(),r.SHA1})}(Eh)),Eh.exports}var Ah={exports:{}},zm;function ng(){return zm||(zm=1,function(e,t){(function(r,n){e.exports=n(zt())})(rt,function(r){return function(n){var s=r,i=s.lib,o=i.WordArray,a=i.Hasher,f=s.algo,c=[],l=[];(function(){function d(v){for(var b=n.sqrt(v),w=2;w<=b;w++)if(!(v%w))return!1;return!0}function h(v){return(v-(v|0))*4294967296|0}for(var y=2,m=0;m<64;)d(y)&&(m<8&&(c[m]=h(n.pow(y,1/2))),l[m]=h(n.pow(y,1/3)),m++),y++})();var u=[],p=f.SHA256=a.extend({_doReset:function(){this._hash=new o.init(c.slice(0))},_doProcessBlock:function(d,h){for(var y=this._hash.words,m=y[0],v=y[1],b=y[2],w=y[3],_=y[4],C=y[5],I=y[6],k=y[7],E=0;E<64;E++){if(E<16)u[E]=d[h+E]|0;else{var S=u[E-15],T=(S<<25|S>>>7)^(S<<14|S>>>18)^S>>>3,P=u[E-2],g=(P<<15|P>>>17)^(P<<13|P>>>19)^P>>>10;u[E]=T+u[E-7]+g+u[E-16]}var A=_&C^~_&I,x=m&v^m&b^v&b,D=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),O=(_<<26|_>>>6)^(_<<21|_>>>11)^(_<<7|_>>>25),B=k+O+A+l[E]+u[E],L=D+x;k=I,I=C,C=_,_=w+B|0,w=b,b=v,v=m,m=B+L|0}y[0]=y[0]+m|0,y[1]=y[1]+v|0,y[2]=y[2]+b|0,y[3]=y[3]+w|0,y[4]=y[4]+_|0,y[5]=y[5]+C|0,y[6]=y[6]+I|0,y[7]=y[7]+k|0},_doFinalize:function(){var d=this._data,h=d.words,y=this._nDataBytes*8,m=d.sigBytes*8;return h[m>>>5]|=128<<24-m%32,h[(m+64>>>9<<4)+14]=n.floor(y/4294967296),h[(m+64>>>9<<4)+15]=y,d.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var d=a.clone.call(this);return d._hash=this._hash.clone(),d}});s.SHA256=a._createHelper(p),s.HmacSHA256=a._createHmacHelper(p)}(Math),r.SHA256})}(Ah)),Ah.exports}var Sh={exports:{}},Wm;function hK(){return Wm||(Wm=1,function(e,t){(function(r,n,s){e.exports=n(zt(),ng())})(rt,function(r){return function(){var n=r,s=n.lib,i=s.WordArray,o=n.algo,a=o.SHA256,f=o.SHA224=a.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=a._doFinalize.call(this);return c.sigBytes-=4,c}});n.SHA224=a._createHelper(f),n.HmacSHA224=a._createHmacHelper(f)}(),r.SHA224})}(Sh)),Sh.exports}var Ph={exports:{}},Ym;function E9(){return Ym||(Ym=1,function(e,t){(function(r,n,s){e.exports=n(zt(),vf())})(rt,function(r){return function(){var n=r,s=n.lib,i=s.Hasher,o=n.x64,a=o.Word,f=o.WordArray,c=n.algo;function l(){return a.create.apply(a,arguments)}var u=[l(1116352408,3609767458),l(1899447441,602891725),l(3049323471,3964484399),l(3921009573,2173295548),l(961987163,4081628472),l(1508970993,3053834265),l(2453635748,2937671579),l(2870763221,3664609560),l(3624381080,2734883394),l(310598401,1164996542),l(607225278,1323610764),l(1426881987,3590304994),l(1925078388,4068182383),l(2162078206,991336113),l(2614888103,633803317),l(3248222580,3479774868),l(3835390401,2666613458),l(4022224774,944711139),l(264347078,2341262773),l(604807628,2007800933),l(770255983,1495990901),l(1249150122,1856431235),l(1555081692,3175218132),l(1996064986,2198950837),l(2554220882,3999719339),l(2821834349,766784016),l(2952996808,2566594879),l(3210313671,3203337956),l(3336571891,1034457026),l(3584528711,2466948901),l(113926993,3758326383),l(338241895,168717936),l(666307205,1188179964),l(773529912,1546045734),l(1294757372,1522805485),l(1396182291,2643833823),l(1695183700,2343527390),l(1986661051,1014477480),l(2177026350,1206759142),l(2456956037,344077627),l(2730485921,1290863460),l(2820302411,3158454273),l(3259730800,3505952657),l(3345764771,106217008),l(3516065817,3606008344),l(3600352804,1432725776),l(4094571909,1467031594),l(275423344,851169720),l(430227734,3100823752),l(506948616,1363258195),l(659060556,3750685593),l(883997877,3785050280),l(958139571,3318307427),l(1322822218,3812723403),l(1537002063,2003034995),l(1747873779,3602036899),l(1955562222,1575990012),l(2024104815,1125592928),l(2227730452,2716904306),l(2361852424,442776044),l(2428436474,593698344),l(2756734187,3733110249),l(3204031479,2999351573),l(3329325298,3815920427),l(3391569614,3928383900),l(3515267271,566280711),l(3940187606,3454069534),l(4118630271,4000239992),l(116418474,1914138554),l(174292421,2731055270),l(289380356,3203993006),l(460393269,320620315),l(685471733,587496836),l(852142971,1086792851),l(1017036298,365543100),l(1126000580,2618297676),l(1288033470,3409855158),l(1501505948,4234509866),l(1607167915,987167468),l(1816402316,1246189591)],p=[];(function(){for(var h=0;h<80;h++)p[h]=l()})();var d=c.SHA512=i.extend({_doReset:function(){this._hash=new f.init([new a.init(1779033703,4089235720),new a.init(3144134277,2227873595),new a.init(1013904242,4271175723),new a.init(2773480762,1595750129),new a.init(1359893119,2917565137),new a.init(2600822924,725511199),new a.init(528734635,4215389547),new a.init(1541459225,327033209)])},_doProcessBlock:function(h,y){for(var m=this._hash.words,v=m[0],b=m[1],w=m[2],_=m[3],C=m[4],I=m[5],k=m[6],E=m[7],S=v.high,T=v.low,P=b.high,g=b.low,A=w.high,x=w.low,D=_.high,O=_.low,B=C.high,L=C.low,M=I.high,R=I.low,N=k.high,F=k.low,z=E.high,Y=E.low,j=S,re=T,V=P,U=g,X=A,ye=x,_e=D,Ae=O,H=B,q=L,W=M,ee=R,le=N,ce=F,ie=z,Fe=Y,De=0;De<80;De++){var qe,he,ue=p[De];if(De<16)he=ue.high=h[y+De*2]|0,qe=ue.low=h[y+De*2+1]|0;else{var pe=p[De-15],de=pe.high,fe=pe.low,ge=(de>>>1|fe<<31)^(de>>>8|fe<<24)^de>>>7,se=(fe>>>1|de<<31)^(fe>>>8|de<<24)^(fe>>>7|de<<25),te=p[De-2],Ne=te.high,Ve=te.low,Je=(Ne>>>19|Ve<<13)^(Ne<<3|Ve>>>29)^Ne>>>6,lt=(Ve>>>19|Ne<<13)^(Ve<<3|Ne>>>29)^(Ve>>>6|Ne<<26),tt=p[De-7],ve=tt.high,Z=tt.low,oe=p[De-16],me=oe.high,xe=oe.low;qe=se+Z,he=ge+ve+(qe>>>0<se>>>0?1:0),qe=qe+lt,he=he+Je+(qe>>>0<lt>>>0?1:0),qe=qe+xe,he=he+me+(qe>>>0<xe>>>0?1:0),ue.high=he,ue.low=qe}var Pe=H&W^~H&le,ke=q&ee^~q&ce,Oe=j&V^j&X^V&X,Ue=re&U^re&ye^U&ye,Ie=(j>>>28|re<<4)^(j<<30|re>>>2)^(j<<25|re>>>7),Re=(re>>>28|j<<4)^(re<<30|j>>>2)^(re<<25|j>>>7),et=(H>>>14|q<<18)^(H>>>18|q<<14)^(H<<23|q>>>9),we=(q>>>14|H<<18)^(q>>>18|H<<14)^(q<<23|H>>>9),Ce=u[De],Be=Ce.high,Le=Ce.low,Me=Fe+we,$=ie+et+(Me>>>0<Fe>>>0?1:0),Me=Me+ke,$=$+Pe+(Me>>>0<ke>>>0?1:0),Me=Me+Le,$=$+Be+(Me>>>0<Le>>>0?1:0),Me=Me+qe,$=$+he+(Me>>>0<qe>>>0?1:0),J=Re+Ue,Q=Ie+Oe+(J>>>0<Re>>>0?1:0);ie=le,Fe=ce,le=W,ce=ee,W=H,ee=q,q=Ae+Me|0,H=_e+$+(q>>>0<Ae>>>0?1:0)|0,_e=X,Ae=ye,X=V,ye=U,V=j,U=re,re=Me+J|0,j=$+Q+(re>>>0<Me>>>0?1:0)|0}T=v.low=T+re,v.high=S+j+(T>>>0<re>>>0?1:0),g=b.low=g+U,b.high=P+V+(g>>>0<U>>>0?1:0),x=w.low=x+ye,w.high=A+X+(x>>>0<ye>>>0?1:0),O=_.low=O+Ae,_.high=D+_e+(O>>>0<Ae>>>0?1:0),L=C.low=L+q,C.high=B+H+(L>>>0<q>>>0?1:0),R=I.low=R+ee,I.high=M+W+(R>>>0<ee>>>0?1:0),F=k.low=F+ce,k.high=N+le+(F>>>0<ce>>>0?1:0),Y=E.low=Y+Fe,E.high=z+ie+(Y>>>0<Fe>>>0?1:0)},_doFinalize:function(){var h=this._data,y=h.words,m=this._nDataBytes*8,v=h.sigBytes*8;y[v>>>5]|=128<<24-v%32,y[(v+128>>>10<<5)+30]=Math.floor(m/4294967296),y[(v+128>>>10<<5)+31]=m,h.sigBytes=y.length*4,this._process();var b=this._hash.toX32();return b},clone:function(){var h=i.clone.call(this);return h._hash=this._hash.clone(),h},blockSize:1024/32});n.SHA512=i._createHelper(d),n.HmacSHA512=i._createHmacHelper(d)}(),r.SHA512})}(Ph)),Ph.exports}var xh={exports:{}},Zm;function pK(){return Zm||(Zm=1,function(e,t){(function(r,n,s){e.exports=n(zt(),vf(),E9())})(rt,function(r){return function(){var n=r,s=n.x64,i=s.Word,o=s.WordArray,a=n.algo,f=a.SHA512,c=a.SHA384=f.extend({_doReset:function(){this._hash=new o.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var l=f._doFinalize.call(this);return l.sigBytes-=16,l}});n.SHA384=f._createHelper(c),n.HmacSHA384=f._createHmacHelper(c)}(),r.SHA384})}(xh)),xh.exports}var Th={exports:{}},Jm;function yK(){return Jm||(Jm=1,function(e,t){(function(r,n,s){e.exports=n(zt(),vf())})(rt,function(r){return function(n){var s=r,i=s.lib,o=i.WordArray,a=i.Hasher,f=s.x64,c=f.Word,l=s.algo,u=[],p=[],d=[];(function(){for(var m=1,v=0,b=0;b<24;b++){u[m+5*v]=(b+1)*(b+2)/2%64;var w=v%5,_=(2*m+3*v)%5;m=w,v=_}for(var m=0;m<5;m++)for(var v=0;v<5;v++)p[m+5*v]=v+(2*m+3*v)%5*5;for(var C=1,I=0;I<24;I++){for(var k=0,E=0,S=0;S<7;S++){if(C&1){var T=(1<<S)-1;T<32?E^=1<<T:k^=1<<T-32}C&128?C=C<<1^113:C<<=1}d[I]=c.create(k,E)}})();var h=[];(function(){for(var m=0;m<25;m++)h[m]=c.create()})();var y=l.SHA3=a.extend({cfg:a.cfg.extend({outputLength:512}),_doReset:function(){for(var m=this._state=[],v=0;v<25;v++)m[v]=new c.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(m,v){for(var b=this._state,w=this.blockSize/2,_=0;_<w;_++){var C=m[v+2*_],I=m[v+2*_+1];C=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360,I=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360;var k=b[_];k.high^=I,k.low^=C}for(var E=0;E<24;E++){for(var S=0;S<5;S++){for(var T=0,P=0,g=0;g<5;g++){var k=b[S+5*g];T^=k.high,P^=k.low}var A=h[S];A.high=T,A.low=P}for(var S=0;S<5;S++)for(var x=h[(S+4)%5],D=h[(S+1)%5],O=D.high,B=D.low,T=x.high^(O<<1|B>>>31),P=x.low^(B<<1|O>>>31),g=0;g<5;g++){var k=b[S+5*g];k.high^=T,k.low^=P}for(var L=1;L<25;L++){var T,P,k=b[L],M=k.high,R=k.low,N=u[L];N<32?(T=M<<N|R>>>32-N,P=R<<N|M>>>32-N):(T=R<<N-32|M>>>64-N,P=M<<N-32|R>>>64-N);var F=h[p[L]];F.high=T,F.low=P}var z=h[0],Y=b[0];z.high=Y.high,z.low=Y.low;for(var S=0;S<5;S++)for(var g=0;g<5;g++){var L=S+5*g,k=b[L],j=h[L],re=h[(S+1)%5+5*g],V=h[(S+2)%5+5*g];k.high=j.high^~re.high&V.high,k.low=j.low^~re.low&V.low}var k=b[0],U=d[E];k.high^=U.high,k.low^=U.low}},_doFinalize:function(){var m=this._data,v=m.words;this._nDataBytes*8;var b=m.sigBytes*8,w=this.blockSize*32;v[b>>>5]|=1<<24-b%32,v[(n.ceil((b+1)/w)*w>>>5)-1]|=128,m.sigBytes=v.length*4,this._process();for(var _=this._state,C=this.cfg.outputLength/8,I=C/8,k=[],E=0;E<I;E++){var S=_[E],T=S.high,P=S.low;T=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,P=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360,k.push(P),k.push(T)}return new o.init(k,C)},clone:function(){for(var m=a.clone.call(this),v=m._state=this._state.slice(0),b=0;b<25;b++)v[b]=v[b].clone();return m}});s.SHA3=a._createHelper(y),s.HmacSHA3=a._createHmacHelper(y)}(Math),r.SHA3})}(Th)),Th.exports}var Ch={exports:{}},Xm;function gK(){return Xm||(Xm=1,function(e,t){(function(r,n){e.exports=n(zt())})(rt,function(r){/** @preserve
7
+ (c) 2012 by Cédric Mesnil. All rights reserved.
8
+
9
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
10
+
11
+ - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
12
+ - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
+ */return function(n){var s=r,i=s.lib,o=i.WordArray,a=i.Hasher,f=s.algo,c=o.create([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]),l=o.create([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]),u=o.create([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]),p=o.create([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]),d=o.create([0,1518500249,1859775393,2400959708,2840853838]),h=o.create([1352829926,1548603684,1836072691,2053994217,0]),y=f.RIPEMD160=a.extend({_doReset:function(){this._hash=o.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(I,k){for(var E=0;E<16;E++){var S=k+E,T=I[S];I[S]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360}var P=this._hash.words,g=d.words,A=h.words,x=c.words,D=l.words,O=u.words,B=p.words,L,M,R,N,F,z,Y,j,re,V;z=L=P[0],Y=M=P[1],j=R=P[2],re=N=P[3],V=F=P[4];for(var U,E=0;E<80;E+=1)U=L+I[k+x[E]]|0,E<16?U+=m(M,R,N)+g[0]:E<32?U+=v(M,R,N)+g[1]:E<48?U+=b(M,R,N)+g[2]:E<64?U+=w(M,R,N)+g[3]:U+=_(M,R,N)+g[4],U=U|0,U=C(U,O[E]),U=U+F|0,L=F,F=N,N=C(R,10),R=M,M=U,U=z+I[k+D[E]]|0,E<16?U+=_(Y,j,re)+A[0]:E<32?U+=w(Y,j,re)+A[1]:E<48?U+=b(Y,j,re)+A[2]:E<64?U+=v(Y,j,re)+A[3]:U+=m(Y,j,re)+A[4],U=U|0,U=C(U,B[E]),U=U+V|0,z=V,V=re,re=C(j,10),j=Y,Y=U;U=P[1]+R+re|0,P[1]=P[2]+N+V|0,P[2]=P[3]+F+z|0,P[3]=P[4]+L+Y|0,P[4]=P[0]+M+j|0,P[0]=U},_doFinalize:function(){var I=this._data,k=I.words,E=this._nDataBytes*8,S=I.sigBytes*8;k[S>>>5]|=128<<24-S%32,k[(S+64>>>9<<4)+14]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,I.sigBytes=(k.length+1)*4,this._process();for(var T=this._hash,P=T.words,g=0;g<5;g++){var A=P[g];P[g]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360}return T},clone:function(){var I=a.clone.call(this);return I._hash=this._hash.clone(),I}});function m(I,k,E){return I^k^E}function v(I,k,E){return I&k|~I&E}function b(I,k,E){return(I|~k)^E}function w(I,k,E){return I&E|k&~E}function _(I,k,E){return I^(k|~E)}function C(I,k){return I<<k|I>>>32-k}s.RIPEMD160=a._createHelper(y),s.HmacRIPEMD160=a._createHmacHelper(y)}(),r.RIPEMD160})}(Ch)),Ch.exports}var Ih={exports:{}},Qm;function ig(){return Qm||(Qm=1,function(e,t){(function(r,n){e.exports=n(zt())})(rt,function(r){(function(){var n=r,s=n.lib,i=s.Base,o=n.enc,a=o.Utf8,f=n.algo;f.HMAC=i.extend({init:function(c,l){c=this._hasher=new c.init,typeof l=="string"&&(l=a.parse(l));var u=c.blockSize,p=u*4;l.sigBytes>p&&(l=c.finalize(l)),l.clamp();for(var d=this._oKey=l.clone(),h=this._iKey=l.clone(),y=d.words,m=h.words,v=0;v<u;v++)y[v]^=1549556828,m[v]^=909522486;d.sigBytes=h.sigBytes=p,this.reset()},reset:function(){var c=this._hasher;c.reset(),c.update(this._iKey)},update:function(c){return this._hasher.update(c),this},finalize:function(c){var l=this._hasher,u=l.finalize(c);l.reset();var p=l.finalize(this._oKey.clone().concat(u));return p}})})()})}(Ih)),Ih.exports}var kh={exports:{}},e3;function mK(){return e3||(e3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),ng(),ig())})(rt,function(r){return function(){var n=r,s=n.lib,i=s.Base,o=s.WordArray,a=n.algo,f=a.SHA256,c=a.HMAC,l=a.PBKDF2=i.extend({cfg:i.extend({keySize:128/32,hasher:f,iterations:25e4}),init:function(u){this.cfg=this.cfg.extend(u)},compute:function(u,p){for(var d=this.cfg,h=c.create(d.hasher,u),y=o.create(),m=o.create([1]),v=y.words,b=m.words,w=d.keySize,_=d.iterations;v.length<w;){var C=h.update(p).finalize(m);h.reset();for(var I=C.words,k=I.length,E=C,S=1;S<_;S++){E=h.finalize(E),h.reset();for(var T=E.words,P=0;P<k;P++)I[P]^=T[P]}y.concat(C),b[0]++}return y.sigBytes=w*4,y}});n.PBKDF2=function(u,p,d){return l.create(d).compute(u,p)}}(),r.PBKDF2})}(kh)),kh.exports}var Rh={exports:{}},t3;function zs(){return t3||(t3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),w9(),ig())})(rt,function(r){return function(){var n=r,s=n.lib,i=s.Base,o=s.WordArray,a=n.algo,f=a.MD5,c=a.EvpKDF=i.extend({cfg:i.extend({keySize:128/32,hasher:f,iterations:1}),init:function(l){this.cfg=this.cfg.extend(l)},compute:function(l,u){for(var p,d=this.cfg,h=d.hasher.create(),y=o.create(),m=y.words,v=d.keySize,b=d.iterations;m.length<v;){p&&h.update(p),p=h.update(l).finalize(u),h.reset();for(var w=1;w<b;w++)p=h.finalize(p),h.reset();y.concat(p)}return y.sigBytes=v*4,y}});n.EvpKDF=function(l,u,p){return c.create(p).compute(l,u)}}(),r.EvpKDF})}(Rh)),Rh.exports}var Dh={exports:{}},r3;function Fr(){return r3||(r3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),zs())})(rt,function(r){r.lib.Cipher||function(n){var s=r,i=s.lib,o=i.Base,a=i.WordArray,f=i.BufferedBlockAlgorithm,c=s.enc;c.Utf8;var l=c.Base64,u=s.algo,p=u.EvpKDF,d=i.Cipher=f.extend({cfg:o.extend(),createEncryptor:function(T,P){return this.create(this._ENC_XFORM_MODE,T,P)},createDecryptor:function(T,P){return this.create(this._DEC_XFORM_MODE,T,P)},init:function(T,P,g){this.cfg=this.cfg.extend(g),this._xformMode=T,this._key=P,this.reset()},reset:function(){f.reset.call(this),this._doReset()},process:function(T){return this._append(T),this._process()},finalize:function(T){T&&this._append(T);var P=this._doFinalize();return P},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function T(P){return typeof P=="string"?S:I}return function(P){return{encrypt:function(g,A,x){return T(A).encrypt(P,g,A,x)},decrypt:function(g,A,x){return T(A).decrypt(P,g,A,x)}}}}()});i.StreamCipher=d.extend({_doFinalize:function(){var T=this._process(!0);return T},blockSize:1});var h=s.mode={},y=i.BlockCipherMode=o.extend({createEncryptor:function(T,P){return this.Encryptor.create(T,P)},createDecryptor:function(T,P){return this.Decryptor.create(T,P)},init:function(T,P){this._cipher=T,this._iv=P}}),m=h.CBC=function(){var T=y.extend();T.Encryptor=T.extend({processBlock:function(g,A){var x=this._cipher,D=x.blockSize;P.call(this,g,A,D),x.encryptBlock(g,A),this._prevBlock=g.slice(A,A+D)}}),T.Decryptor=T.extend({processBlock:function(g,A){var x=this._cipher,D=x.blockSize,O=g.slice(A,A+D);x.decryptBlock(g,A),P.call(this,g,A,D),this._prevBlock=O}});function P(g,A,x){var D,O=this._iv;O?(D=O,this._iv=n):D=this._prevBlock;for(var B=0;B<x;B++)g[A+B]^=D[B]}return T}(),v=s.pad={},b=v.Pkcs7={pad:function(T,P){for(var g=P*4,A=g-T.sigBytes%g,x=A<<24|A<<16|A<<8|A,D=[],O=0;O<A;O+=4)D.push(x);var B=a.create(D,A);T.concat(B)},unpad:function(T){var P=T.words[T.sigBytes-1>>>2]&255;T.sigBytes-=P}};i.BlockCipher=d.extend({cfg:d.cfg.extend({mode:m,padding:b}),reset:function(){var T;d.reset.call(this);var P=this.cfg,g=P.iv,A=P.mode;this._xformMode==this._ENC_XFORM_MODE?T=A.createEncryptor:(T=A.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==T?this._mode.init(this,g&&g.words):(this._mode=T.call(A,this,g&&g.words),this._mode.__creator=T)},_doProcessBlock:function(T,P){this._mode.processBlock(T,P)},_doFinalize:function(){var T,P=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(P.pad(this._data,this.blockSize),T=this._process(!0)):(T=this._process(!0),P.unpad(T)),T},blockSize:128/32});var w=i.CipherParams=o.extend({init:function(T){this.mixIn(T)},toString:function(T){return(T||this.formatter).stringify(this)}}),_=s.format={},C=_.OpenSSL={stringify:function(T){var P,g=T.ciphertext,A=T.salt;return A?P=a.create([1398893684,1701076831]).concat(A).concat(g):P=g,P.toString(l)},parse:function(T){var P,g=l.parse(T),A=g.words;return A[0]==1398893684&&A[1]==1701076831&&(P=a.create(A.slice(2,4)),A.splice(0,4),g.sigBytes-=16),w.create({ciphertext:g,salt:P})}},I=i.SerializableCipher=o.extend({cfg:o.extend({format:C}),encrypt:function(T,P,g,A){A=this.cfg.extend(A);var x=T.createEncryptor(g,A),D=x.finalize(P),O=x.cfg;return w.create({ciphertext:D,key:g,iv:O.iv,algorithm:T,mode:O.mode,padding:O.padding,blockSize:T.blockSize,formatter:A.format})},decrypt:function(T,P,g,A){A=this.cfg.extend(A),P=this._parse(P,A.format);var x=T.createDecryptor(g,A).finalize(P.ciphertext);return x},_parse:function(T,P){return typeof T=="string"?P.parse(T,this):T}}),k=s.kdf={},E=k.OpenSSL={execute:function(T,P,g,A,x){if(A||(A=a.random(64/8)),x)var D=p.create({keySize:P+g,hasher:x}).compute(T,A);else var D=p.create({keySize:P+g}).compute(T,A);var O=a.create(D.words.slice(P),g*4);return D.sigBytes=P*4,w.create({key:D,iv:O,salt:A})}},S=i.PasswordBasedCipher=I.extend({cfg:I.cfg.extend({kdf:E}),encrypt:function(T,P,g,A){A=this.cfg.extend(A);var x=A.kdf.execute(g,T.keySize,T.ivSize,A.salt,A.hasher);A.iv=x.iv;var D=I.encrypt.call(this,T,P,x.key,A);return D.mixIn(x),D},decrypt:function(T,P,g,A){A=this.cfg.extend(A),P=this._parse(P,A.format);var x=A.kdf.execute(g,T.keySize,T.ivSize,P.salt,A.hasher);A.iv=x.iv;var D=I.decrypt.call(this,T,P,x.key,A);return D}})}()})}(Dh)),Dh.exports}var Bh={exports:{}},n3;function vK(){return n3||(n3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),Fr())})(rt,function(r){return r.mode.CFB=function(){var n=r.lib.BlockCipherMode.extend();n.Encryptor=n.extend({processBlock:function(i,o){var a=this._cipher,f=a.blockSize;s.call(this,i,o,f,a),this._prevBlock=i.slice(o,o+f)}}),n.Decryptor=n.extend({processBlock:function(i,o){var a=this._cipher,f=a.blockSize,c=i.slice(o,o+f);s.call(this,i,o,f,a),this._prevBlock=c}});function s(i,o,a,f){var c,l=this._iv;l?(c=l.slice(0),this._iv=void 0):c=this._prevBlock,f.encryptBlock(c,0);for(var u=0;u<a;u++)i[o+u]^=c[u]}return n}(),r.mode.CFB})}(Bh)),Bh.exports}var Oh={exports:{}},i3;function bK(){return i3||(i3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),Fr())})(rt,function(r){return r.mode.CTR=function(){var n=r.lib.BlockCipherMode.extend(),s=n.Encryptor=n.extend({processBlock:function(i,o){var a=this._cipher,f=a.blockSize,c=this._iv,l=this._counter;c&&(l=this._counter=c.slice(0),this._iv=void 0);var u=l.slice(0);a.encryptBlock(u,0),l[f-1]=l[f-1]+1|0;for(var p=0;p<f;p++)i[o+p]^=u[p]}});return n.Decryptor=s,n}(),r.mode.CTR})}(Oh)),Oh.exports}var Mh={exports:{}},s3;function _K(){return s3||(s3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),Fr())})(rt,function(r){/** @preserve
16
+ * Counter block mode compatible with Dr Brian Gladman fileenc.c
17
+ * derived from CryptoJS.mode.CTR
18
+ * Jan Hruby jhruby.web@gmail.com
19
+ */return r.mode.CTRGladman=function(){var n=r.lib.BlockCipherMode.extend();function s(a){if((a>>24&255)===255){var f=a>>16&255,c=a>>8&255,l=a&255;f===255?(f=0,c===255?(c=0,l===255?l=0:++l):++c):++f,a=0,a+=f<<16,a+=c<<8,a+=l}else a+=1<<24;return a}function i(a){return(a[0]=s(a[0]))===0&&(a[1]=s(a[1])),a}var o=n.Encryptor=n.extend({processBlock:function(a,f){var c=this._cipher,l=c.blockSize,u=this._iv,p=this._counter;u&&(p=this._counter=u.slice(0),this._iv=void 0),i(p);var d=p.slice(0);c.encryptBlock(d,0);for(var h=0;h<l;h++)a[f+h]^=d[h]}});return n.Decryptor=o,n}(),r.mode.CTRGladman})}(Mh)),Mh.exports}var Nh={exports:{}},a3;function wK(){return a3||(a3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),Fr())})(rt,function(r){return r.mode.OFB=function(){var n=r.lib.BlockCipherMode.extend(),s=n.Encryptor=n.extend({processBlock:function(i,o){var a=this._cipher,f=a.blockSize,c=this._iv,l=this._keystream;c&&(l=this._keystream=c.slice(0),this._iv=void 0),a.encryptBlock(l,0);for(var u=0;u<f;u++)i[o+u]^=l[u]}});return n.Decryptor=s,n}(),r.mode.OFB})}(Nh)),Nh.exports}var Uh={exports:{}},o3;function EK(){return o3||(o3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),Fr())})(rt,function(r){return r.mode.ECB=function(){var n=r.lib.BlockCipherMode.extend();return n.Encryptor=n.extend({processBlock:function(s,i){this._cipher.encryptBlock(s,i)}}),n.Decryptor=n.extend({processBlock:function(s,i){this._cipher.decryptBlock(s,i)}}),n}(),r.mode.ECB})}(Uh)),Uh.exports}var Lh={exports:{}},c3;function AK(){return c3||(c3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),Fr())})(rt,function(r){return r.pad.AnsiX923={pad:function(n,s){var i=n.sigBytes,o=s*4,a=o-i%o,f=i+a-1;n.clamp(),n.words[f>>>2]|=a<<24-f%4*8,n.sigBytes+=a},unpad:function(n){var s=n.words[n.sigBytes-1>>>2]&255;n.sigBytes-=s}},r.pad.Ansix923})}(Lh)),Lh.exports}var Kh={exports:{}},u3;function SK(){return u3||(u3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),Fr())})(rt,function(r){return r.pad.Iso10126={pad:function(n,s){var i=s*4,o=i-n.sigBytes%i;n.concat(r.lib.WordArray.random(o-1)).concat(r.lib.WordArray.create([o<<24],1))},unpad:function(n){var s=n.words[n.sigBytes-1>>>2]&255;n.sigBytes-=s}},r.pad.Iso10126})}(Kh)),Kh.exports}var Fh={exports:{}},l3;function PK(){return l3||(l3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),Fr())})(rt,function(r){return r.pad.Iso97971={pad:function(n,s){n.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(n,s)},unpad:function(n){r.pad.ZeroPadding.unpad(n),n.sigBytes--}},r.pad.Iso97971})}(Fh)),Fh.exports}var qh={exports:{}},d3;function xK(){return d3||(d3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),Fr())})(rt,function(r){return r.pad.ZeroPadding={pad:function(n,s){var i=s*4;n.clamp(),n.sigBytes+=i-(n.sigBytes%i||i)},unpad:function(n){for(var s=n.words,i=n.sigBytes-1,i=n.sigBytes-1;i>=0;i--)if(s[i>>>2]>>>24-i%4*8&255){n.sigBytes=i+1;break}}},r.pad.ZeroPadding})}(qh)),qh.exports}var jh={exports:{}},f3;function TK(){return f3||(f3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),Fr())})(rt,function(r){return r.pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding})}(jh)),jh.exports}var $h={exports:{}},h3;function CK(){return h3||(h3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),Fr())})(rt,function(r){return function(n){var s=r,i=s.lib,o=i.CipherParams,a=s.enc,f=a.Hex,c=s.format;c.Hex={stringify:function(l){return l.ciphertext.toString(f)},parse:function(l){var u=f.parse(l);return o.create({ciphertext:u})}}}(),r.format.Hex})}($h)),$h.exports}var Hh={exports:{}},p3;function IK(){return p3||(p3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),La(),Ka(),zs(),Fr())})(rt,function(r){return function(){var n=r,s=n.lib,i=s.BlockCipher,o=n.algo,a=[],f=[],c=[],l=[],u=[],p=[],d=[],h=[],y=[],m=[];(function(){for(var w=[],_=0;_<256;_++)_<128?w[_]=_<<1:w[_]=_<<1^283;for(var C=0,I=0,_=0;_<256;_++){var k=I^I<<1^I<<2^I<<3^I<<4;k=k>>>8^k&255^99,a[C]=k,f[k]=C;var E=w[C],S=w[E],T=w[S],P=w[k]*257^k*16843008;c[C]=P<<24|P>>>8,l[C]=P<<16|P>>>16,u[C]=P<<8|P>>>24,p[C]=P;var P=T*16843009^S*65537^E*257^C*16843008;d[k]=P<<24|P>>>8,h[k]=P<<16|P>>>16,y[k]=P<<8|P>>>24,m[k]=P,C?(C=E^w[w[w[T^E]]],I^=w[w[I]]):C=I=1}})();var v=[0,1,2,4,8,16,32,64,128,27,54],b=o.AES=i.extend({_doReset:function(){var w;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var _=this._keyPriorReset=this._key,C=_.words,I=_.sigBytes/4,k=this._nRounds=I+6,E=(k+1)*4,S=this._keySchedule=[],T=0;T<E;T++)T<I?S[T]=C[T]:(w=S[T-1],T%I?I>6&&T%I==4&&(w=a[w>>>24]<<24|a[w>>>16&255]<<16|a[w>>>8&255]<<8|a[w&255]):(w=w<<8|w>>>24,w=a[w>>>24]<<24|a[w>>>16&255]<<16|a[w>>>8&255]<<8|a[w&255],w^=v[T/I|0]<<24),S[T]=S[T-I]^w);for(var P=this._invKeySchedule=[],g=0;g<E;g++){var T=E-g;if(g%4)var w=S[T];else var w=S[T-4];g<4||T<=4?P[g]=w:P[g]=d[a[w>>>24]]^h[a[w>>>16&255]]^y[a[w>>>8&255]]^m[a[w&255]]}}},encryptBlock:function(w,_){this._doCryptBlock(w,_,this._keySchedule,c,l,u,p,a)},decryptBlock:function(w,_){var C=w[_+1];w[_+1]=w[_+3],w[_+3]=C,this._doCryptBlock(w,_,this._invKeySchedule,d,h,y,m,f);var C=w[_+1];w[_+1]=w[_+3],w[_+3]=C},_doCryptBlock:function(w,_,C,I,k,E,S,T){for(var P=this._nRounds,g=w[_]^C[0],A=w[_+1]^C[1],x=w[_+2]^C[2],D=w[_+3]^C[3],O=4,B=1;B<P;B++){var L=I[g>>>24]^k[A>>>16&255]^E[x>>>8&255]^S[D&255]^C[O++],M=I[A>>>24]^k[x>>>16&255]^E[D>>>8&255]^S[g&255]^C[O++],R=I[x>>>24]^k[D>>>16&255]^E[g>>>8&255]^S[A&255]^C[O++],N=I[D>>>24]^k[g>>>16&255]^E[A>>>8&255]^S[x&255]^C[O++];g=L,A=M,x=R,D=N}var L=(T[g>>>24]<<24|T[A>>>16&255]<<16|T[x>>>8&255]<<8|T[D&255])^C[O++],M=(T[A>>>24]<<24|T[x>>>16&255]<<16|T[D>>>8&255]<<8|T[g&255])^C[O++],R=(T[x>>>24]<<24|T[D>>>16&255]<<16|T[g>>>8&255]<<8|T[A&255])^C[O++],N=(T[D>>>24]<<24|T[g>>>16&255]<<16|T[A>>>8&255]<<8|T[x&255])^C[O++];w[_]=L,w[_+1]=M,w[_+2]=R,w[_+3]=N},keySize:256/32});n.AES=i._createHelper(b)}(),r.AES})}(Hh)),Hh.exports}var Vh={exports:{}},y3;function kK(){return y3||(y3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),La(),Ka(),zs(),Fr())})(rt,function(r){return function(){var n=r,s=n.lib,i=s.WordArray,o=s.BlockCipher,a=n.algo,f=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],c=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],p=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=a.DES=o.extend({_doReset:function(){for(var v=this._key,b=v.words,w=[],_=0;_<56;_++){var C=f[_]-1;w[_]=b[C>>>5]>>>31-C%32&1}for(var I=this._subKeys=[],k=0;k<16;k++){for(var E=I[k]=[],S=l[k],_=0;_<24;_++)E[_/6|0]|=w[(c[_]-1+S)%28]<<31-_%6,E[4+(_/6|0)]|=w[28+(c[_+24]-1+S)%28]<<31-_%6;E[0]=E[0]<<1|E[0]>>>31;for(var _=1;_<7;_++)E[_]=E[_]>>>(_-1)*4+3;E[7]=E[7]<<5|E[7]>>>27}for(var T=this._invSubKeys=[],_=0;_<16;_++)T[_]=I[15-_]},encryptBlock:function(v,b){this._doCryptBlock(v,b,this._subKeys)},decryptBlock:function(v,b){this._doCryptBlock(v,b,this._invSubKeys)},_doCryptBlock:function(v,b,w){this._lBlock=v[b],this._rBlock=v[b+1],h.call(this,4,252645135),h.call(this,16,65535),y.call(this,2,858993459),y.call(this,8,16711935),h.call(this,1,1431655765);for(var _=0;_<16;_++){for(var C=w[_],I=this._lBlock,k=this._rBlock,E=0,S=0;S<8;S++)E|=u[S][((k^C[S])&p[S])>>>0];this._lBlock=k,this._rBlock=I^E}var T=this._lBlock;this._lBlock=this._rBlock,this._rBlock=T,h.call(this,1,1431655765),y.call(this,8,16711935),y.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),v[b]=this._lBlock,v[b+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function h(v,b){var w=(this._lBlock>>>v^this._rBlock)&b;this._rBlock^=w,this._lBlock^=w<<v}function y(v,b){var w=(this._rBlock>>>v^this._lBlock)&b;this._lBlock^=w,this._rBlock^=w<<v}n.DES=o._createHelper(d);var m=a.TripleDES=o.extend({_doReset:function(){var v=this._key,b=v.words;if(b.length!==2&&b.length!==4&&b.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var w=b.slice(0,2),_=b.length<4?b.slice(0,2):b.slice(2,4),C=b.length<6?b.slice(0,2):b.slice(4,6);this._des1=d.createEncryptor(i.create(w)),this._des2=d.createEncryptor(i.create(_)),this._des3=d.createEncryptor(i.create(C))},encryptBlock:function(v,b){this._des1.encryptBlock(v,b),this._des2.decryptBlock(v,b),this._des3.encryptBlock(v,b)},decryptBlock:function(v,b){this._des3.decryptBlock(v,b),this._des2.encryptBlock(v,b),this._des1.decryptBlock(v,b)},keySize:192/32,ivSize:64/32,blockSize:64/32});n.TripleDES=o._createHelper(m)}(),r.TripleDES})}(Vh)),Vh.exports}var Gh={exports:{}},g3;function RK(){return g3||(g3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),La(),Ka(),zs(),Fr())})(rt,function(r){return function(){var n=r,s=n.lib,i=s.StreamCipher,o=n.algo,a=o.RC4=i.extend({_doReset:function(){for(var l=this._key,u=l.words,p=l.sigBytes,d=this._S=[],h=0;h<256;h++)d[h]=h;for(var h=0,y=0;h<256;h++){var m=h%p,v=u[m>>>2]>>>24-m%4*8&255;y=(y+d[h]+v)%256;var b=d[h];d[h]=d[y],d[y]=b}this._i=this._j=0},_doProcessBlock:function(l,u){l[u]^=f.call(this)},keySize:256/32,ivSize:0});function f(){for(var l=this._S,u=this._i,p=this._j,d=0,h=0;h<4;h++){u=(u+1)%256,p=(p+l[u])%256;var y=l[u];l[u]=l[p],l[p]=y,d|=l[(l[u]+l[p])%256]<<24-h*8}return this._i=u,this._j=p,d}n.RC4=i._createHelper(a);var c=o.RC4Drop=a.extend({cfg:a.cfg.extend({drop:192}),_doReset:function(){a._doReset.call(this);for(var l=this.cfg.drop;l>0;l--)f.call(this)}});n.RC4Drop=i._createHelper(c)}(),r.RC4})}(Gh)),Gh.exports}var zh={exports:{}},m3;function DK(){return m3||(m3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),La(),Ka(),zs(),Fr())})(rt,function(r){return function(){var n=r,s=n.lib,i=s.StreamCipher,o=n.algo,a=[],f=[],c=[],l=o.Rabbit=i.extend({_doReset:function(){for(var p=this._key.words,d=this.cfg.iv,h=0;h<4;h++)p[h]=(p[h]<<8|p[h]>>>24)&16711935|(p[h]<<24|p[h]>>>8)&4278255360;var y=this._X=[p[0],p[3]<<16|p[2]>>>16,p[1],p[0]<<16|p[3]>>>16,p[2],p[1]<<16|p[0]>>>16,p[3],p[2]<<16|p[1]>>>16],m=this._C=[p[2]<<16|p[2]>>>16,p[0]&4294901760|p[1]&65535,p[3]<<16|p[3]>>>16,p[1]&4294901760|p[2]&65535,p[0]<<16|p[0]>>>16,p[2]&4294901760|p[3]&65535,p[1]<<16|p[1]>>>16,p[3]&4294901760|p[0]&65535];this._b=0;for(var h=0;h<4;h++)u.call(this);for(var h=0;h<8;h++)m[h]^=y[h+4&7];if(d){var v=d.words,b=v[0],w=v[1],_=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,C=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,I=_>>>16|C&4294901760,k=C<<16|_&65535;m[0]^=_,m[1]^=I,m[2]^=C,m[3]^=k,m[4]^=_,m[5]^=I,m[6]^=C,m[7]^=k;for(var h=0;h<4;h++)u.call(this)}},_doProcessBlock:function(p,d){var h=this._X;u.call(this),a[0]=h[0]^h[5]>>>16^h[3]<<16,a[1]=h[2]^h[7]>>>16^h[5]<<16,a[2]=h[4]^h[1]>>>16^h[7]<<16,a[3]=h[6]^h[3]>>>16^h[1]<<16;for(var y=0;y<4;y++)a[y]=(a[y]<<8|a[y]>>>24)&16711935|(a[y]<<24|a[y]>>>8)&4278255360,p[d+y]^=a[y]},blockSize:128/32,ivSize:64/32});function u(){for(var p=this._X,d=this._C,h=0;h<8;h++)f[h]=d[h];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<f[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<f[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<f[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<f[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<f[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<f[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<f[6]>>>0?1:0)|0,this._b=d[7]>>>0<f[7]>>>0?1:0;for(var h=0;h<8;h++){var y=p[h]+d[h],m=y&65535,v=y>>>16,b=((m*m>>>17)+m*v>>>15)+v*v,w=((y&4294901760)*y|0)+((y&65535)*y|0);c[h]=b^w}p[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,p[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,p[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,p[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,p[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,p[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,p[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,p[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}n.Rabbit=i._createHelper(l)}(),r.Rabbit})}(zh)),zh.exports}var Wh={exports:{}},v3;function BK(){return v3||(v3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),La(),Ka(),zs(),Fr())})(rt,function(r){return function(){var n=r,s=n.lib,i=s.StreamCipher,o=n.algo,a=[],f=[],c=[],l=o.RabbitLegacy=i.extend({_doReset:function(){var p=this._key.words,d=this.cfg.iv,h=this._X=[p[0],p[3]<<16|p[2]>>>16,p[1],p[0]<<16|p[3]>>>16,p[2],p[1]<<16|p[0]>>>16,p[3],p[2]<<16|p[1]>>>16],y=this._C=[p[2]<<16|p[2]>>>16,p[0]&4294901760|p[1]&65535,p[3]<<16|p[3]>>>16,p[1]&4294901760|p[2]&65535,p[0]<<16|p[0]>>>16,p[2]&4294901760|p[3]&65535,p[1]<<16|p[1]>>>16,p[3]&4294901760|p[0]&65535];this._b=0;for(var m=0;m<4;m++)u.call(this);for(var m=0;m<8;m++)y[m]^=h[m+4&7];if(d){var v=d.words,b=v[0],w=v[1],_=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,C=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,I=_>>>16|C&4294901760,k=C<<16|_&65535;y[0]^=_,y[1]^=I,y[2]^=C,y[3]^=k,y[4]^=_,y[5]^=I,y[6]^=C,y[7]^=k;for(var m=0;m<4;m++)u.call(this)}},_doProcessBlock:function(p,d){var h=this._X;u.call(this),a[0]=h[0]^h[5]>>>16^h[3]<<16,a[1]=h[2]^h[7]>>>16^h[5]<<16,a[2]=h[4]^h[1]>>>16^h[7]<<16,a[3]=h[6]^h[3]>>>16^h[1]<<16;for(var y=0;y<4;y++)a[y]=(a[y]<<8|a[y]>>>24)&16711935|(a[y]<<24|a[y]>>>8)&4278255360,p[d+y]^=a[y]},blockSize:128/32,ivSize:64/32});function u(){for(var p=this._X,d=this._C,h=0;h<8;h++)f[h]=d[h];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<f[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<f[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<f[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<f[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<f[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<f[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<f[6]>>>0?1:0)|0,this._b=d[7]>>>0<f[7]>>>0?1:0;for(var h=0;h<8;h++){var y=p[h]+d[h],m=y&65535,v=y>>>16,b=((m*m>>>17)+m*v>>>15)+v*v,w=((y&4294901760)*y|0)+((y&65535)*y|0);c[h]=b^w}p[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,p[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,p[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,p[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,p[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,p[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,p[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,p[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}n.RabbitLegacy=i._createHelper(l)}(),r.RabbitLegacy})}(Wh)),Wh.exports}var Yh={exports:{}},b3;function OK(){return b3||(b3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),La(),Ka(),zs(),Fr())})(rt,function(r){return function(){var n=r,s=n.lib,i=s.BlockCipher,o=n.algo;const a=16,f=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],c=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var l={pbox:[],sbox:[]};function u(m,v){let b=v>>24&255,w=v>>16&255,_=v>>8&255,C=v&255,I=m.sbox[0][b]+m.sbox[1][w];return I=I^m.sbox[2][_],I=I+m.sbox[3][C],I}function p(m,v,b){let w=v,_=b,C;for(let I=0;I<a;++I)w=w^m.pbox[I],_=u(m,w)^_,C=w,w=_,_=C;return C=w,w=_,_=C,_=_^m.pbox[a],w=w^m.pbox[a+1],{left:w,right:_}}function d(m,v,b){let w=v,_=b,C;for(let I=a+1;I>1;--I)w=w^m.pbox[I],_=u(m,w)^_,C=w,w=_,_=C;return C=w,w=_,_=C,_=_^m.pbox[1],w=w^m.pbox[0],{left:w,right:_}}function h(m,v,b){for(let k=0;k<4;k++){m.sbox[k]=[];for(let E=0;E<256;E++)m.sbox[k][E]=c[k][E]}let w=0;for(let k=0;k<a+2;k++)m.pbox[k]=f[k]^v[w],w++,w>=b&&(w=0);let _=0,C=0,I=0;for(let k=0;k<a+2;k+=2)I=p(m,_,C),_=I.left,C=I.right,m.pbox[k]=_,m.pbox[k+1]=C;for(let k=0;k<4;k++)for(let E=0;E<256;E+=2)I=p(m,_,C),_=I.left,C=I.right,m.sbox[k][E]=_,m.sbox[k][E+1]=C;return!0}var y=o.Blowfish=i.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var m=this._keyPriorReset=this._key,v=m.words,b=m.sigBytes/4;h(l,v,b)}},encryptBlock:function(m,v){var b=p(l,m[v],m[v+1]);m[v]=b.left,m[v+1]=b.right},decryptBlock:function(m,v){var b=d(l,m[v],m[v+1]);m[v]=b.left,m[v+1]=b.right},blockSize:64/32,keySize:128/32,ivSize:64/32});n.Blowfish=i._createHelper(y)}(),r.Blowfish})}(Yh)),Yh.exports}var _3;function Yr(){return _3||(_3=1,function(e,t){(function(r,n,s){e.exports=n(zt(),vf(),lK(),dK(),La(),fK(),Ka(),w9(),ng(),hK(),E9(),pK(),yK(),gK(),ig(),mK(),zs(),Fr(),vK(),bK(),_K(),wK(),EK(),AK(),SK(),PK(),xK(),TK(),CK(),IK(),kK(),RK(),DK(),BK(),OK())})(rt,function(r){return r})}(ph)),ph.exports}var w3;function Da(){if(w3)return Li;w3=1,Object.defineProperty(Li,"__esModule",{value:!0}),Li.generateRandomSecret=Li.aesDecrypt=Li.aesEncrypt=void 0;const e=Yr(),t=({plainText:s,secretKey:i})=>e.AES.encrypt(s,i).toString();Li.aesEncrypt=t;const r=({cipherText:s,secretKey:i})=>e.AES.decrypt(s,i).toString(e.enc.Utf8);Li.aesDecrypt=r;const n=s=>{let i="";const o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",a=o.length;for(let f=0;f<s;f++)i+=o.charAt(Math.floor(Math.random()*a));return i};return Li.generateRandomSecret=n,Li}var dn={};/*! OpenPGP.js v5.11.3 - 2025-05-19 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */const Dn=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},io=Symbol("doneWritingPromise"),A9=Symbol("doneWritingResolve"),S9=Symbol("doneWritingReject"),Ho=Symbol("readingIndex");class Ai extends Array{constructor(){super(),this[io]=new Promise((t,r)=>{this[A9]=t,this[S9]=r}),this[io].catch(()=>{})}}function Ar(e){return e&&e.getReader&&Array.isArray(e)}function Ju(e){if(!Ar(e)){const t=e.getWriter(),r=t.releaseLock;return t.releaseLock=()=>{t.closed.catch(function(){}),r.call(t)},t}this.stream=e}Ai.prototype.getReader=function(){return this[Ho]===void 0&&(this[Ho]=0),{read:async()=>(await this[io],this[Ho]===this.length?{value:void 0,done:!0}:{value:this[this[Ho]++],done:!1})}},Ai.prototype.readToEnd=async function(e){await this[io];const t=e(this.slice(this[Ho]));return this.length=0,t},Ai.prototype.clone=function(){const e=new Ai;return e[io]=this[io].then(()=>{e.push(...this)}),e},Ju.prototype.write=async function(e){this.stream.push(e)},Ju.prototype.close=async function(){this.stream[A9]()},Ju.prototype.abort=async function(e){return this.stream[S9](e),e},Ju.prototype.releaseLock=function(){};const bf=typeof Dn.process=="object"&&typeof Dn.process.versions=="object",E3=bf&&void 0;function An(e){return Ar(e)?"array":Dn.ReadableStream&&Dn.ReadableStream.prototype.isPrototypeOf(e)?"web":is&&is.prototype.isPrototypeOf(e)?"ponyfill":E3&&E3.prototype.isPrototypeOf(e)?"node":!(!e||!e.getReader)&&"web-like"}function _f(e){return Uint8Array.prototype.isPrototypeOf(e)}function P9(e){if(e.length===1)return e[0];let t=0;for(let s=0;s<e.length;s++){if(!_f(e[s]))throw Error("concatUint8Array: Data must be in the form of a Uint8Array");t+=e[s].length}const r=new Uint8Array(t);let n=0;return e.forEach(function(s){r.set(s,n),n+=s.length}),r}const MK=bf&&void 0,A3=bf&&void 0;let wf,sg;if(A3){wf=function(t){let r=!1;return new is({start(n){t.pause(),t.on("data",s=>{r||(MK.isBuffer(s)&&(s=new Uint8Array(s.buffer,s.byteOffset,s.byteLength)),n.enqueue(s),t.pause())}),t.on("end",()=>{r||n.close()}),t.on("error",s=>n.error(s))},pull(){t.resume()},cancel(n){r=!0,t.destroy(n)}})};class e extends A3{constructor(r,n){super(n),this._reader=Mi(r)}async _read(r){try{for(;;){const{done:n,value:s}=await this._reader.read();if(n){this.push(null);break}if(!this.push(s))break}}catch(n){this.destroy(n)}}async _destroy(r,n){this._reader.cancel(r).then(n,n)}}sg=function(t,r){return new e(t,r)}}const S3=new WeakSet,or=Symbol("externalBuffer");function pi(e){if(this.stream=e,e[or]&&(this[or]=e[or].slice()),Ar(e)){const n=e.getReader();return this._read=n.read.bind(n),this._releaseLock=()=>{},void(this._cancel=async()=>{})}let t=An(e);if(t==="node"&&(e=wf(e)),t){const n=e.getReader();return this._read=n.read.bind(n),this._releaseLock=()=>{n.closed.catch(function(){}),n.releaseLock()},void(this._cancel=n.cancel.bind(n))}let r=!1;this._read=async()=>r||S3.has(e)?{value:void 0,done:!0}:(r=!0,{value:e,done:!1}),this._releaseLock=()=>{if(r)try{S3.add(e)}catch{}}}pi.prototype.read=async function(){return this[or]&&this[or].length?{done:!1,value:this[or].shift()}:this._read()},pi.prototype.releaseLock=function(){this[or]&&(this.stream[or]=this[or]),this._releaseLock()},pi.prototype.cancel=function(e){return this._cancel(e)},pi.prototype.readLine=async function(){let e,t=[];for(;!e;){let{done:r,value:n}=await this.read();if(n+="",r)return t.length?yn(t):void 0;const s=n.indexOf(`
20
+ `)+1;s&&(e=yn(t.concat(n.substr(0,s))),t=[]),s!==n.length&&t.push(n.substr(s))}return this.unshift(...t),e},pi.prototype.readByte=async function(){const{done:e,value:t}=await this.read();if(e)return;const r=t[0];return this.unshift(Wr(t,1)),r},pi.prototype.readBytes=async function(e){const t=[];let r=0;for(;;){const{done:n,value:s}=await this.read();if(n)return t.length?yn(t):void 0;if(t.push(s),r+=s.length,r>=e){const i=yn(t);return this.unshift(Wr(i,e)),Wr(i,0,e)}}},pi.prototype.peekBytes=async function(e){const t=await this.readBytes(e);return this.unshift(t),t},pi.prototype.unshift=function(...e){this[or]||(this[or]=[]),e.length===1&&_f(e[0])&&this[or].length&&e[0].length&&this[or][0].byteOffset>=e[0].length?this[or][0]=new Uint8Array(this[or][0].buffer,this[or][0].byteOffset-e[0].length,this[or][0].byteLength+e[0].length):this[or].unshift(...e.filter(t=>t&&t.length))},pi.prototype.readToEnd=async function(e=yn){const t=[];for(;;){const{done:r,value:n}=await this.read();if(r)break;t.push(n)}return e(t)};let ay,x9,{ReadableStream:is,WritableStream:T9,TransformStream:bo}=Dn;async function C9(){if(bo)return;const[e,t]=await Promise.all([Promise.resolve().then(function(){return a$}),Promise.resolve().then(function(){return d$})]);({ReadableStream:is,WritableStream:T9,TransformStream:bo}=e);const{createReadableStreamWrapper:r}=t;Dn.ReadableStream&&is!==Dn.ReadableStream&&(ay=r(is),x9=r(Dn.ReadableStream))}const y0=bf&&void 0;function V0(e){let t=An(e);return t==="node"?wf(e):t==="web"&&ay?ay(e):t?e:new is({start(r){r.enqueue(e),r.close()}})}function I9(e){if(An(e))return e;const t=new Ai;return(async()=>{const r=Sn(t);await r.write(e),await r.close()})(),t}function yn(e){return e.some(t=>An(t)&&!Ar(t))?function(t){t=t.map(V0);const r=R9(async function(i){await Promise.all(s.map(o=>oy(o,i)))});let n=Promise.resolve();const s=t.map((i,o)=>Di(i,(a,f)=>(n=n.then(()=>ss(a,r.writable,{preventClose:o!==t.length-1})),n)));return r.readable}(e):e.some(t=>Ar(t))?function(t){const r=new Ai;let n=Promise.resolve();return t.forEach((s,i)=>(n=n.then(()=>ss(s,r,{preventClose:i!==t.length-1})),n)),r}(e):typeof e[0]=="string"?e.join(""):y0&&y0.isBuffer(e[0])?y0.concat(e):P9(e)}function Mi(e){return new pi(e)}function Sn(e){return new Ju(e)}async function ss(e,t,{preventClose:r=!1,preventAbort:n=!1,preventCancel:s=!1}={}){if(An(e)&&!Ar(e)){e=V0(e);try{if(e[or]){const a=Sn(t);for(let f=0;f<e[or].length;f++)await a.ready,await a.write(e[or][f]);a.releaseLock()}await e.pipeTo(t,{preventClose:r,preventAbort:n,preventCancel:s})}catch{}return}const i=Mi(e=I9(e)),o=Sn(t);try{for(;;){await o.ready;const{done:a,value:f}=await i.read();if(a){r||await o.close();break}await o.write(f)}}catch(a){n||await o.abort(a)}finally{i.releaseLock(),o.releaseLock()}}function k9(e,t){const r=new bo(t);return ss(e,r.writable),r.readable}function R9(e){let t,r,n,s=!1,i=!1;return{readable:new is({start(o){n=o},pull(){t?t():s=!0},async cancel(o){i=!0,e&&await e(o),r&&r(o)}},{highWaterMark:0}),writable:new T9({write:async function(o){if(i)throw Error("Stream is cancelled");n.enqueue(o),s?s=!1:(await new Promise((a,f)=>{t=a,r=f}),t=null,r=null)},close:n.close.bind(n),abort:n.error.bind(n)})}}function vr(e,t=()=>{},r=()=>{}){if(Ar(e)){const i=new Ai;return(async()=>{const o=Sn(i);try{const a=await Er(e),f=t(a),c=r();let l;l=f!==void 0&&c!==void 0?yn([f,c]):f!==void 0?f:c,await o.write(l),await o.close()}catch(a){await o.abort(a)}})(),i}if(An(e))return k9(e,{async transform(i,o){try{const a=await t(i);a!==void 0&&o.enqueue(a)}catch(a){o.error(a)}},async flush(i){try{const o=await r();o!==void 0&&i.enqueue(o)}catch(o){i.error(o)}}});const n=t(e),s=r();return n!==void 0&&s!==void 0?yn([n,s]):n!==void 0?n:s}function Di(e,t){if(An(e)&&!Ar(e)){let n;const s=new bo({start(a){n=a}}),i=ss(e,s.writable),o=R9(async function(a){n.error(a),await i,await new Promise(setTimeout)});return t(s.readable,o.writable),o.readable}e=I9(e);const r=new Ai;return t(e,r),r}function Ef(e,t){let r;const n=Di(e,(s,i)=>{const o=Mi(s);o.remainder=()=>(o.releaseLock(),ss(s,i),n),r=t(o)});return r}function Ba(e){if(Ar(e))return e.clone();if(An(e)){const t=function(r){if(Ar(r))throw Error("ArrayStream cannot be tee()d, use clone() instead");if(An(r)){const n=V0(r).tee();return n[0][or]=n[1][or]=r[or],n}return[Wr(r),Wr(r)]}(e);return D9(e,t[0]),t[1]}return Wr(e)}function ho(e){return Ar(e)?Ba(e):An(e)?new is({start(t){const r=Di(e,async(n,s)=>{const i=Mi(n),o=Sn(s);try{for(;;){await o.ready;const{done:a,value:f}=await i.read();if(a){try{t.close()}catch{}return void await o.close()}try{t.enqueue(f)}catch{}await o.write(f)}}catch(a){t.error(a),await o.abort(a)}});D9(e,r)}}):Wr(e)}function D9(e,t){Object.entries(Object.getOwnPropertyDescriptors(e.constructor.prototype)).forEach(([r,n])=>{r!=="constructor"&&(n.value?n.value=n.value.bind(t):n.get=n.get.bind(t),Object.defineProperty(e,r,n))})}function Wr(e,t=0,r=1/0){if(Ar(e))throw Error("Not implemented");if(An(e)){if(t>=0&&r>=0){let n=0;return k9(e,{transform(s,i){n<r?(n+s.length>=t&&i.enqueue(Wr(s,Math.max(t-n,0),r-n)),n+=s.length):i.terminate()}})}if(t<0&&(r<0||r===1/0)){let n=[];return vr(e,s=>{s.length>=-t?n=[s]:n.push(s)},()=>Wr(yn(n),t,r))}if(t===0&&r<0){let n;return vr(e,s=>{const i=n?yn([n,s]):s;if(i.length>=-r)return n=Wr(i,r),Wr(i,t,r);n=i})}return console.warn(`stream.slice(input, ${t}, ${r}) not implemented efficiently.`),fs(async()=>Wr(await Er(e),t,r))}return e[or]&&(e=yn(e[or].concat([e]))),!_f(e)||y0&&y0.isBuffer(e)?e.slice(t,r):(r===1/0&&(r=e.length),e.subarray(t,r))}async function Er(e,t=yn){return Ar(e)?e.readToEnd(t):An(e)?Mi(e).readToEnd(t):e}async function oy(e,t){if(An(e)){if(e.cancel)return e.cancel(t);if(e.destroy)return e.destroy(t),await new Promise(setTimeout),t}}function fs(e){const t=new Ai;return(async()=>{const r=Sn(t);try{await r.write(await e()),await r.close()}catch(n){await r.abort(n)}})(),t}class hn{constructor(t){if(t===void 0)throw Error("Invalid BigInteger input");if(t instanceof Uint8Array){const r=t,n=Array(r.length);for(let s=0;s<r.length;s++){const i=r[s].toString(16);n[s]=r[s]<=15?"0"+i:i}this.value=BigInt("0x0"+n.join(""))}else this.value=BigInt(t)}clone(){return new hn(this.value)}iinc(){return this.value++,this}inc(){return this.clone().iinc()}idec(){return this.value--,this}dec(){return this.clone().idec()}iadd(t){return this.value+=t.value,this}add(t){return this.clone().iadd(t)}isub(t){return this.value-=t.value,this}sub(t){return this.clone().isub(t)}imul(t){return this.value*=t.value,this}mul(t){return this.clone().imul(t)}imod(t){return this.value%=t.value,this.isNegative()&&this.iadd(t),this}mod(t){return this.clone().imod(t)}modExp(t,r){if(r.isZero())throw Error("Modulo cannot be zero");if(r.isOne())return new hn(0);if(t.isNegative())throw Error("Unsopported negative exponent");let n=t.value,s=this.value;s%=r.value;let i=BigInt(1);for(;n>BigInt(0);){const o=n&BigInt(1);n>>=BigInt(1);const a=i*s%r.value;i=o?a:i,s=s*s%r.value}return new hn(i)}modInv(t){const{gcd:r,x:n}=this._egcd(t);if(!r.isOne())throw Error("Inverse does not exist");return n.add(t).mod(t)}_egcd(t){let r=BigInt(0),n=BigInt(1),s=BigInt(1),i=BigInt(0),o=this.value;for(t=t.value;t!==BigInt(0);){const a=o/t;let f=r;r=s-a*r,s=f,f=n,n=i-a*n,i=f,f=t,t=o%t,o=f}return{x:new hn(s),y:new hn(i),gcd:new hn(o)}}gcd(t){let r=this.value;for(t=t.value;t!==BigInt(0);){const n=t;t=r%t,r=n}return new hn(r)}ileftShift(t){return this.value<<=t.value,this}leftShift(t){return this.clone().ileftShift(t)}irightShift(t){return this.value>>=t.value,this}rightShift(t){return this.clone().irightShift(t)}equal(t){return this.value===t.value}lt(t){return this.value<t.value}lte(t){return this.value<=t.value}gt(t){return this.value>t.value}gte(t){return this.value>=t.value}isZero(){return this.value===BigInt(0)}isOne(){return this.value===BigInt(1)}isNegative(){return this.value<BigInt(0)}isEven(){return!(this.value&BigInt(1))}abs(){const t=this.clone();return this.isNegative()&&(t.value=-t.value),t}toString(){return this.value.toString()}toNumber(){const t=Number(this.value);if(t>Number.MAX_SAFE_INTEGER)throw Error("Number can only safely store up to 53 bits");return t}getBit(t){return(this.value>>BigInt(t)&BigInt(1))===BigInt(0)?0:1}bitLength(){const t=new hn(0),r=new hn(1),n=new hn(-1),s=this.isNegative()?n:t;let i=1;const o=this.clone();for(;!o.irightShift(r).equal(s);)i++;return i}byteLength(){const t=new hn(0),r=new hn(-1),n=this.isNegative()?r:t,s=new hn(8);let i=1;const o=this.clone();for(;!o.irightShift(s).equal(n);)i++;return i}toUint8Array(t="be",r){let n=this.value.toString(16);n.length%2==1&&(n="0"+n);const s=n.length/2,i=new Uint8Array(r||s),o=r?r-s:0;let a=0;for(;a<s;)i[a+o]=parseInt(n.slice(2*a,2*a+2),16),a++;return t!=="be"&&i.reverse(),i}}const NK=()=>typeof BigInt<"u",Vo=Symbol("byValue");var G={curve:{p256:"p256","P-256":"p256",secp256r1:"p256",prime256v1:"p256","1.2.840.10045.3.1.7":"p256","2a8648ce3d030107":"p256","2A8648CE3D030107":"p256",p384:"p384","P-384":"p384",secp384r1:"p384","1.3.132.0.34":"p384","2b81040022":"p384","2B81040022":"p384",p521:"p521","P-521":"p521",secp521r1:"p521","1.3.132.0.35":"p521","2b81040023":"p521","2B81040023":"p521",secp256k1:"secp256k1","1.3.132.0.10":"secp256k1","2b8104000a":"secp256k1","2B8104000A":"secp256k1",ed25519Legacy:"ed25519",ED25519:"ed25519",ed25519:"ed25519",Ed25519:"ed25519","1.3.6.1.4.1.11591.15.1":"ed25519","2b06010401da470f01":"ed25519","2B06010401DA470F01":"ed25519",curve25519Legacy:"curve25519",X25519:"curve25519",cv25519:"curve25519",curve25519:"curve25519",Curve25519:"curve25519","1.3.6.1.4.1.3029.1.5.1":"curve25519","2b060104019755010501":"curve25519","2B060104019755010501":"curve25519",brainpoolP256r1:"brainpoolP256r1","1.3.36.3.3.2.8.1.1.7":"brainpoolP256r1","2b2403030208010107":"brainpoolP256r1","2B2403030208010107":"brainpoolP256r1",brainpoolP384r1:"brainpoolP384r1","1.3.36.3.3.2.8.1.1.11":"brainpoolP384r1","2b240303020801010b":"brainpoolP384r1","2B240303020801010B":"brainpoolP384r1",brainpoolP512r1:"brainpoolP512r1","1.3.36.3.3.2.8.1.1.13":"brainpoolP512r1","2b240303020801010d":"brainpoolP512r1","2B240303020801010D":"brainpoolP512r1"},s2k:{simple:0,salted:1,iterated:3,gnu:101},publicKey:{rsaEncryptSign:1,rsaEncrypt:2,rsaSign:3,elgamal:16,dsa:17,ecdh:18,ecdsa:19,eddsaLegacy:22,ed25519Legacy:22,eddsa:22,aedh:23,aedsa:24,x25519:25,x448:26,ed25519:27,ed448:28},symmetric:{plaintext:0,idea:1,tripledes:2,cast5:3,blowfish:4,aes128:7,aes192:8,aes256:9,twofish:10},compression:{uncompressed:0,zip:1,zlib:2,bzip2:3},hash:{md5:1,sha1:2,ripemd:3,sha256:8,sha384:9,sha512:10,sha224:11},webHash:{"SHA-1":2,"SHA-256":8,"SHA-384":9,"SHA-512":10},aead:{eax:1,ocb:2,experimentalGCM:100},packet:{publicKeyEncryptedSessionKey:1,signature:2,symEncryptedSessionKey:3,onePassSignature:4,secretKey:5,publicKey:6,secretSubkey:7,compressedData:8,symmetricallyEncryptedData:9,marker:10,literalData:11,trust:12,userID:13,publicSubkey:14,userAttribute:17,symEncryptedIntegrityProtectedData:18,modificationDetectionCode:19,aeadEncryptedData:20},literal:{binary:98,text:116,utf8:117,mime:109},signature:{binary:0,text:1,standalone:2,certGeneric:16,certPersona:17,certCasual:18,certPositive:19,certRevocation:48,subkeyBinding:24,keyBinding:25,key:31,keyRevocation:32,subkeyRevocation:40,timestamp:64,thirdParty:80},signatureSubpacket:{signatureCreationTime:2,signatureExpirationTime:3,exportableCertification:4,trustSignature:5,regularExpression:6,revocable:7,keyExpirationTime:9,placeholderBackwardsCompatibility:10,preferredSymmetricAlgorithms:11,revocationKey:12,issuer:16,notationData:20,preferredHashAlgorithms:21,preferredCompressionAlgorithms:22,keyServerPreferences:23,preferredKeyServer:24,primaryUserID:25,policyURI:26,keyFlags:27,signersUserID:28,reasonForRevocation:29,features:30,signatureTarget:31,embeddedSignature:32,issuerFingerprint:33,preferredAEADAlgorithms:34},keyFlags:{certifyKeys:1,signData:2,encryptCommunication:4,encryptStorage:8,splitPrivateKey:16,authentication:32,sharedPrivateKey:128},armor:{multipartSection:0,multipartLast:1,signed:2,message:3,publicKey:4,privateKey:5,signature:6},reasonForRevocation:{noReason:0,keySuperseded:1,keyCompromised:2,keyRetired:3,userIDInvalid:32},features:{modificationDetection:1,aead:2,v5Keys:4},write:function(e,t){if(typeof t=="number"&&(t=this.read(e,t)),e[t]!==void 0)return e[t];throw Error("Invalid enum value.")},read:function(e,t){if(e[Vo]||(e[Vo]=[],Object.entries(e).forEach(([r,n])=>{e[Vo][n]=r})),e[Vo][t]!==void 0)return e[Vo][t];throw Error("Invalid enum value.")}};const P3=(()=>{try{return!1}catch{}return!1})(),ne={isString:function(e){return typeof e=="string"||e instanceof String},isArray:function(e){return e instanceof Array},isUint8Array:_f,isStream:An,readNumber:function(e){let t=0;for(let r=0;r<e.length;r++)t+=256**r*e[e.length-1-r];return t},writeNumber:function(e,t){const r=new Uint8Array(t);for(let n=0;n<t;n++)r[n]=e>>8*(t-n-1)&255;return r},readDate:function(e){const t=ne.readNumber(e);return new Date(1e3*t)},writeDate:function(e){const t=Math.floor(e.getTime()/1e3);return ne.writeNumber(t,4)},normalizeDate:function(e=Date.now()){return e===null||e===1/0?e:new Date(1e3*Math.floor(+e/1e3))},readMPI:function(e){const t=(e[0]<<8|e[1])+7>>>3;return e.subarray(2,2+t)},leftPad(e,t){const r=new Uint8Array(t),n=t-e.length;return r.set(e,n),r},uint8ArrayToMPI:function(e){const t=ne.uint8ArrayBitLength(e);if(t===0)throw Error("Zero MPI");const r=e.subarray(e.length-Math.ceil(t/8)),n=new Uint8Array([(65280&t)>>8,255&t]);return ne.concatUint8Array([n,r])},uint8ArrayBitLength:function(e){let t;for(t=0;t<e.length&&e[t]===0;t++);if(t===e.length)return 0;const r=e.subarray(t);return 8*(r.length-1)+ne.nbits(r[0])},hexToUint8Array:function(e){const t=new Uint8Array(e.length>>1);for(let r=0;r<e.length>>1;r++)t[r]=parseInt(e.substr(r<<1,2),16);return t},uint8ArrayToHex:function(e){const t=[],r=e.length;let n,s=0;for(;s<r;){for(n=e[s++].toString(16);n.length<2;)n="0"+n;t.push(""+n)}return t.join("")},stringToUint8Array:function(e){return vr(e,t=>{if(!ne.isString(t))throw Error("stringToUint8Array: Data must be in the form of a string");const r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r})},uint8ArrayToString:function(e){const t=[],n=(e=new Uint8Array(e)).length;for(let s=0;s<n;s+=16384)t.push(String.fromCharCode.apply(String,e.subarray(s,s+16384<n?s+16384:n)));return t.join("")},encodeUTF8:function(e){const t=new TextEncoder("utf-8");function r(n,s=!1){return t.encode(n,{stream:!s})}return vr(e,r,()=>r("",!0))},decodeUTF8:function(e){const t=new TextDecoder("utf-8");function r(n,s=!1){return t.decode(n,{stream:!s})}return vr(e,r,()=>r(new Uint8Array,!0))},concat:yn,concatUint8Array:P9,equalsUint8Array:function(e,t){if(!ne.isUint8Array(e)||!ne.isUint8Array(t))throw Error("Data must be in the form of a Uint8Array");if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},writeChecksum:function(e){let t=0;for(let r=0;r<e.length;r++)t=t+e[r]&65535;return ne.writeNumber(t,2)},printDebug:function(e){P3&&console.log("[OpenPGP.js debug]",e)},printDebugError:function(e){P3&&console.error("[OpenPGP.js debug]",e)},nbits:function(e){let t=1,r=e>>>16;return r!==0&&(e=r,t+=16),r=e>>8,r!==0&&(e=r,t+=8),r=e>>4,r!==0&&(e=r,t+=4),r=e>>2,r!==0&&(e=r,t+=2),r=e>>1,r!==0&&(e=r,t+=1),t},double:function(e){const t=new Uint8Array(e.length),r=e.length-1;for(let n=0;n<r;n++)t[n]=e[n]<<1^e[n+1]>>7;return t[r]=e[r]<<1^135*(e[0]>>7),t},shiftRight:function(e,t){if(t)for(let r=e.length-1;r>=0;r--)e[r]>>=t,r>0&&(e[r]|=e[r-1]<<8-t);return e},getWebCrypto:function(){return Dn!==void 0&&Dn.crypto&&Dn.crypto.subtle},getBigInteger:async function(){if(NK())return hn;{const{default:e}=await Promise.resolve().then(function(){return f$});return e}},getNodeCrypto:function(){},getNodeZlib:function(){},getNodeBuffer:function(){return{}.Buffer},getHardwareConcurrency:function(){return typeof navigator<"u"?navigator.hardwareConcurrency||1:(void 0).cpus().length},isEmailAddress:function(e){return ne.isString(e)?/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+([a-zA-Z]{2,}[0-9]*|xn--[a-zA-Z\-0-9]+)))$/.test(e):!1},canonicalizeEOL:function(e){let t=!1;return vr(e,r=>{let n;t&&(r=ne.concatUint8Array([new Uint8Array([13]),r])),r[r.length-1]===13?(t=!0,r=r.subarray(0,-1)):t=!1;const s=[];for(let a=0;n=r.indexOf(10,a)+1,n;a=n)r[n-2]!==13&&s.push(n);if(!s.length)return r;const i=new Uint8Array(r.length+s.length);let o=0;for(let a=0;a<s.length;a++){const f=r.subarray(s[a-1]||0,s[a]);i.set(f,o),o+=f.length,i[o-1]=13,i[o]=10,o++}return i.set(r.subarray(s[s.length-1]||0),o),i},()=>t?new Uint8Array([13]):void 0)},nativeEOL:function(e){let t=!1;return vr(e,r=>{let n;(r=t&&r[0]!==10?ne.concatUint8Array([new Uint8Array([13]),r]):new Uint8Array(r))[r.length-1]===13?(t=!0,r=r.subarray(0,-1)):t=!1;let s=0;for(let i=0;i!==r.length;i=n){n=r.indexOf(13,i)+1,n||(n=r.length);const o=n-(r[n]===10?1:0);i&&r.copyWithin(s,i,o),s+=o-i}return r.subarray(0,s)},()=>t?new Uint8Array([13]):void 0)},removeTrailingSpaces:function(e){return e.split(`
21
+ `).map(t=>{let r=t.length-1;for(;r>=0&&(t[r]===" "||t[r]===" "||t[r]==="\r");r--);return t.substr(0,r+1)}).join(`
22
+ `)},wrapError:function(e,t){if(!t)return Error(e);try{t.message=e+": "+t.message}catch{}return t},constructAllowedPackets:function(e){const t={};return e.forEach(r=>{if(!r.tag)throw Error("Invalid input: expected a packet class");t[r.tag]=r}),t},anyPromise:function(e){return new Promise(async(t,r)=>{let n;await Promise.all(e.map(async s=>{try{t(await s)}catch(i){n=i}})),r(n)})},selectUint8Array:function(e,t,r){const n=Math.max(t.length,r.length),s=new Uint8Array(n);let i=0;for(let o=0;o<s.length;o++)s[o]=t[o]&256-e|r[o]&255+e,i+=e&o<t.length|1-e&o<r.length;return s.subarray(0,i)},selectUint8:function(e,t,r){return t&256-e|r&255+e},isAES:function(e){return e===G.symmetric.aes128||e===G.symmetric.aes192||e===G.symmetric.aes256}},Zh=ne.getNodeBuffer();let Td,Cd;function Wi(e){let t=new Uint8Array;return vr(e,r=>{t=ne.concatUint8Array([t,r]);const n=[],s=Math.floor(t.length/45),i=45*s,o=Td(t.subarray(0,i));for(let a=0;a<s;a++)n.push(o.substr(60*a,60)),n.push(`
23
+ `);return t=t.subarray(i),n.join("")},()=>t.length?Td(t)+`
24
+ `:"")}function B9(e){let t="";return vr(e,r=>{t+=r;let n=0;const s=[" "," ","\r",`
25
+ `];for(let a=0;a<s.length;a++){const f=s[a];for(let c=t.indexOf(f);c!==-1;c=t.indexOf(f,c+1))n++}let i=t.length;for(;i>0&&(i-n)%4!=0;i--)s.includes(t[i])&&n--;const o=Cd(t.substr(0,i));return t=t.substr(i),o},()=>Cd(t))}function Ji(e){return B9(e.replace(/-/g,"+").replace(/_/g,"/"))}function Rn(e,t){let r=Wi(e).replace(/[\r\n]/g,"");return t&&(r=r.replace(/[+]/g,"-").replace(/[/]/g,"_").replace(/[=]/g,"")),r}Zh?(Td=e=>Zh.from(e).toString("base64"),Cd=e=>{const t=Zh.from(e,"base64");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}):(Td=e=>btoa(ne.uint8ArrayToString(e)),Cd=e=>ne.stringToUint8Array(atob(e)));var Qe={preferredHashAlgorithm:G.hash.sha256,preferredSymmetricAlgorithm:G.symmetric.aes256,preferredCompressionAlgorithm:G.compression.uncompressed,deflateLevel:6,aeadProtect:!1,preferredAEADAlgorithm:G.aead.eax,aeadChunkSizeByte:12,v5Keys:!1,s2kIterationCountByte:224,allowUnauthenticatedMessages:!1,allowUnauthenticatedStream:!1,checksumRequired:!1,minRSABits:2047,passwordCollisionCheck:!1,revocationsExpire:!1,allowInsecureDecryptionWithSigningKeys:!1,allowInsecureVerificationWithReformattedKeys:!1,constantTimePKCS1Decryption:!1,constantTimePKCS1DecryptionSupportedSymmetricAlgorithms:new Set([G.symmetric.aes128,G.symmetric.aes192,G.symmetric.aes256]),minBytesForWebCrypto:1e3,ignoreUnsupportedPackets:!0,ignoreMalformedPackets:!1,additionalAllowedPackets:[],showVersion:!1,showComment:!1,versionString:"OpenPGP.js 5.11.3",commentString:"https://openpgpjs.org",maxUserIDLength:5120,knownNotations:[],useIndutnyElliptic:!0,rejectHashAlgorithms:new Set([G.hash.md5,G.hash.ripemd]),rejectMessageHashAlgorithms:new Set([G.hash.md5,G.hash.ripemd,G.hash.sha1]),rejectPublicKeyAlgorithms:new Set([G.publicKey.elgamal,G.publicKey.dsa]),rejectCurves:new Set([G.curve.secp256k1])};function UK(e){const t=e.match(/^-----BEGIN PGP (MESSAGE, PART \d+\/\d+|MESSAGE, PART \d+|SIGNED MESSAGE|MESSAGE|PUBLIC KEY BLOCK|PRIVATE KEY BLOCK|SIGNATURE)-----$/m);if(!t)throw Error("Unknown ASCII armor type");return/MESSAGE, PART \d+\/\d+/.test(t[1])?G.armor.multipartSection:/MESSAGE, PART \d+/.test(t[1])?G.armor.multipartLast:/SIGNED MESSAGE/.test(t[1])?G.armor.signed:/MESSAGE/.test(t[1])?G.armor.message:/PUBLIC KEY BLOCK/.test(t[1])?G.armor.publicKey:/PRIVATE KEY BLOCK/.test(t[1])?G.armor.privateKey:/SIGNATURE/.test(t[1])?G.armor.signature:void 0}function Xs(e,t){let r="";return t.showVersion&&(r+="Version: "+t.versionString+`
26
+ `),t.showComment&&(r+="Comment: "+t.commentString+`
27
+ `),e&&(r+="Comment: "+e+`
28
+ `),r+=`
29
+ `,r}function vs(e){return Wi(function(t){let r=13501623;return vr(t,n=>{const s=LK?Math.floor(n.length/4):0,i=new Uint32Array(n.buffer,n.byteOffset,s);for(let o=0;o<s;o++)r^=i[o],r=Ur[0][r>>24&255]^Ur[1][r>>16&255]^Ur[2][r>>8&255]^Ur[3][r>>0&255];for(let o=4*s;o<n.length;o++)r=r>>8^Ur[0][255&r^n[o]]},()=>new Uint8Array([r,r>>8,r>>16]))}(e))}const Ur=[Array(255),Array(255),Array(255),Array(255)];for(let e=0;e<=255;e++){let t=e<<16;for(let r=0;r<8;r++)t=t<<1^(8388608&t?8801531:0);Ur[0][e]=(16711680&t)>>16|65280&t|(255&t)<<16}for(let e=0;e<=255;e++)Ur[1][e]=Ur[0][e]>>8^Ur[0][255&Ur[0][e]];for(let e=0;e<=255;e++)Ur[2][e]=Ur[1][e]>>8^Ur[0][255&Ur[1][e]];for(let e=0;e<=255;e++)Ur[3][e]=Ur[2][e]>>8^Ur[0][255&Ur[2][e]];const LK=function(){const e=new ArrayBuffer(2);return new DataView(e).setInt16(0,255,!0),new Int16Array(e)[0]===255}();function x3(e){for(let t=0;t<e.length;t++)/^([^\s:]|[^\s:][^:]*[^\s:]): .+$/.test(e[t])||ne.printDebugError(Error("Improperly formatted armor header: "+e[t])),/^(Version|Comment|MessageID|Hash|Charset): .+$/.test(e[t])||ne.printDebugError(Error("Unknown header: "+e[t]))}function KK(e){let t=e,r="";const n=e.lastIndexOf("=");return n>=0&&n!==e.length-1&&(t=e.slice(0,n),r=e.slice(n+1).substr(0,4)),{body:t,checksum:r}}function Ni(e,t=Qe){return new Promise(async(r,n)=>{try{const s=/^-----[^-]+-----$/m,i=/^[ \f\r\t\u00a0\u2000-\u200a\u202f\u205f\u3000]*$/;let o;const a=[];let f,c,l,u=a,p=[],d=B9(Di(e,async(h,y)=>{const m=Mi(h);try{for(;;){let b=await m.readLine();if(b===void 0)throw Error("Misformed armored text");if(b=ne.removeTrailingSpaces(b.replace(/[\r\n]/g,"")),o)if(f)c||o!==2||(s.test(b)?(p=p.join(`\r
30
+ `),c=!0,x3(u),u=[],f=!1):p.push(b.replace(/^- /,"")));else if(s.test(b)&&n(Error("Mandatory blank line missing between armor headers and armor data")),i.test(b)){if(x3(u),f=!0,c||o!==2){r({text:p,data:d,headers:a,type:o});break}}else u.push(b);else s.test(b)&&(o=UK(b))}}catch(b){return void n(b)}const v=Sn(y);try{for(;;){await v.ready;const{done:b,value:w}=await m.read();if(b)throw Error("Misformed armored text");const _=w+"";if(_.indexOf("=")!==-1||_.indexOf("-")!==-1){let C=await m.readToEnd();C.length||(C=""),C=_+C,C=ne.removeTrailingSpaces(C.replace(/\r/g,""));const I=C.split(s);if(I.length===1)throw Error("Misformed armored text");const k=KK(I[0].slice(0,-1));l=k.checksum,await v.write(k.body);break}await v.write(_)}await v.ready,await v.close()}catch(b){await v.abort(b)}}));d=Di(d,async(h,y)=>{const m=Er(vs(ho(h)));m.catch(()=>{}),await ss(h,y,{preventClose:!0});const v=Sn(y);try{const b=(await m).replace(`
31
+ `,"");if(l!==b&&(l||t.checksumRequired))throw Error("Ascii armor integrity check failed");await v.ready,await v.close()}catch(b){await v.abort(b)}})}catch(s){n(s)}}).then(async r=>(Ar(r.data)&&(r.data=await Er(r.data)),r))}function Fa(e,t,r,n,s,i=Qe){let o,a;e===G.armor.signed&&(o=t.text,a=t.hash,t=t.data);const f=ho(t),c=[];switch(e){case G.armor.multipartSection:c.push("-----BEGIN PGP MESSAGE, PART "+r+"/"+n+`-----
32
+ `),c.push(Xs(s,i)),c.push(Wi(t)),c.push("=",vs(f)),c.push("-----END PGP MESSAGE, PART "+r+"/"+n+`-----
33
+ `);break;case G.armor.multipartLast:c.push("-----BEGIN PGP MESSAGE, PART "+r+`-----
34
+ `),c.push(Xs(s,i)),c.push(Wi(t)),c.push("=",vs(f)),c.push("-----END PGP MESSAGE, PART "+r+`-----
35
+ `);break;case G.armor.signed:c.push(`-----BEGIN PGP SIGNED MESSAGE-----
36
+ `),c.push("Hash: "+a+`
37
+
38
+ `),c.push(o.replace(/^-/gm,"- -")),c.push(`
39
+ -----BEGIN PGP SIGNATURE-----
40
+ `),c.push(Xs(s,i)),c.push(Wi(t)),c.push("=",vs(f)),c.push(`-----END PGP SIGNATURE-----
41
+ `);break;case G.armor.message:c.push(`-----BEGIN PGP MESSAGE-----
42
+ `),c.push(Xs(s,i)),c.push(Wi(t)),c.push("=",vs(f)),c.push(`-----END PGP MESSAGE-----
43
+ `);break;case G.armor.publicKey:c.push(`-----BEGIN PGP PUBLIC KEY BLOCK-----
44
+ `),c.push(Xs(s,i)),c.push(Wi(t)),c.push("=",vs(f)),c.push(`-----END PGP PUBLIC KEY BLOCK-----
45
+ `);break;case G.armor.privateKey:c.push(`-----BEGIN PGP PRIVATE KEY BLOCK-----
46
+ `),c.push(Xs(s,i)),c.push(Wi(t)),c.push("=",vs(f)),c.push(`-----END PGP PRIVATE KEY BLOCK-----
47
+ `);break;case G.armor.signature:c.push(`-----BEGIN PGP SIGNATURE-----
48
+ `),c.push(Xs(s,i)),c.push(Wi(t)),c.push("=",vs(f)),c.push(`-----END PGP SIGNATURE-----
49
+ `)}return ne.concat(c)}class js{constructor(){this.bytes=""}read(t){return this.bytes=ne.uint8ArrayToString(t.subarray(0,8)),this.bytes.length}write(){return ne.stringToUint8Array(this.bytes)}toHex(){return ne.uint8ArrayToHex(ne.stringToUint8Array(this.bytes))}equals(t,r=!1){return r&&(t.isWildcard()||this.isWildcard())||this.bytes===t.bytes}isNull(){return this.bytes===""}isWildcard(){return/^0+$/.test(this.toHex())}static mapToHex(t){return t.toHex()}static fromID(t){const r=new js;return r.read(ne.hexToUint8Array(t)),r}static wildcard(){const t=new js;return t.read(new Uint8Array(8)),t}}var Kt=function(){var e,t,r=!1;function n(u,p){var d=e[(t[u]+t[p])%255];return u!==0&&p!==0||(d=0),d}var s,i,o,a,f=!1;function c(){function u(y){var m,v,b;for(v=b=function(w){var _=e[255-t[w]];return w===0&&(_=0),_}(y),m=0;m<4;m++)b^=v=255&(v<<1|v>>>7);return b^=99}r||function(){e=[],t=[];var y,m,v=1;for(y=0;y<255;y++)e[y]=v,m=128&v,v<<=1,v&=255,m===128&&(v^=27),v^=e[y],t[e[y]]=y;e[255]=e[0],t[0]=0,r=!0}(),s=[],i=[],o=[[],[],[],[]],a=[[],[],[],[]];for(var p=0;p<256;p++){var d=u(p);s[p]=d,i[d]=p,o[0][p]=n(2,d)<<24|d<<16|d<<8|n(3,d),a[0][d]=n(14,p)<<24|n(9,p)<<16|n(13,p)<<8|n(11,p);for(var h=1;h<4;h++)o[h][p]=o[h-1][p]>>>8|o[h-1][p]<<24,a[h][d]=a[h-1][d]>>>8|a[h-1][d]<<24}f=!0}var l=function(u,p){f||c();var d=new Uint32Array(p);d.set(s,512),d.set(i,768);for(var h=0;h<4;h++)d.set(o[h],4096+1024*h>>2),d.set(a[h],8192+1024*h>>2);var y=function(m,v,b){var w=0,_=0,C=0,I=0,k=0,E=0,S=0,T=0,P=0,g=0,A=0,x=0,D=0,O=0,B=0,L=0,M=0,R=0,N=0,F=0,z=0,Y=new m.Uint32Array(b),j=new m.Uint8Array(b);function re(se,te,Ne,Ve,Je,lt,tt,ve){se=se|0,te=te|0,Ne=Ne|0,Ve=Ve|0,Je=Je|0,lt=lt|0,tt=tt|0,ve=ve|0;var Z=0,oe=0,me=0,xe=0,Pe=0,ke=0,Oe=0,Ue=0;for(Z=Ne|1024,oe=Ne|2048,me=Ne|3072,Je=Je^Y[(se|0)>>2],lt=lt^Y[(se|4)>>2],tt=tt^Y[(se|8)>>2],ve=ve^Y[(se|12)>>2],Ue=16;(Ue|0)<=Ve<<4;Ue=Ue+16|0)xe=Y[(Ne|Je>>22&1020)>>2]^Y[(Z|lt>>14&1020)>>2]^Y[(oe|tt>>6&1020)>>2]^Y[(me|ve<<2&1020)>>2]^Y[(se|Ue|0)>>2],Pe=Y[(Ne|lt>>22&1020)>>2]^Y[(Z|tt>>14&1020)>>2]^Y[(oe|ve>>6&1020)>>2]^Y[(me|Je<<2&1020)>>2]^Y[(se|Ue|4)>>2],ke=Y[(Ne|tt>>22&1020)>>2]^Y[(Z|ve>>14&1020)>>2]^Y[(oe|Je>>6&1020)>>2]^Y[(me|lt<<2&1020)>>2]^Y[(se|Ue|8)>>2],Oe=Y[(Ne|ve>>22&1020)>>2]^Y[(Z|Je>>14&1020)>>2]^Y[(oe|lt>>6&1020)>>2]^Y[(me|tt<<2&1020)>>2]^Y[(se|Ue|12)>>2],Je=xe,lt=Pe,tt=ke,ve=Oe;w=Y[(te|Je>>22&1020)>>2]<<24^Y[(te|lt>>14&1020)>>2]<<16^Y[(te|tt>>6&1020)>>2]<<8^Y[(te|ve<<2&1020)>>2]^Y[(se|Ue|0)>>2],_=Y[(te|lt>>22&1020)>>2]<<24^Y[(te|tt>>14&1020)>>2]<<16^Y[(te|ve>>6&1020)>>2]<<8^Y[(te|Je<<2&1020)>>2]^Y[(se|Ue|4)>>2],C=Y[(te|tt>>22&1020)>>2]<<24^Y[(te|ve>>14&1020)>>2]<<16^Y[(te|Je>>6&1020)>>2]<<8^Y[(te|lt<<2&1020)>>2]^Y[(se|Ue|8)>>2],I=Y[(te|ve>>22&1020)>>2]<<24^Y[(te|Je>>14&1020)>>2]<<16^Y[(te|lt>>6&1020)>>2]<<8^Y[(te|tt<<2&1020)>>2]^Y[(se|Ue|12)>>2]}function V(se,te,Ne,Ve){se=se|0,te=te|0,Ne=Ne|0,Ve=Ve|0,re(0,2048,4096,z,se,te,Ne,Ve)}function U(se,te,Ne,Ve){se=se|0,te=te|0,Ne=Ne|0,Ve=Ve|0;var Je=0;re(1024,3072,8192,z,se,Ve,Ne,te),Je=_,_=I,I=Je}function X(se,te,Ne,Ve){se=se|0,te=te|0,Ne=Ne|0,Ve=Ve|0,re(0,2048,4096,z,k^se,E^te,S^Ne,T^Ve),k=w,E=_,S=C,T=I}function ye(se,te,Ne,Ve){se=se|0,te=te|0,Ne=Ne|0,Ve=Ve|0;var Je=0;re(1024,3072,8192,z,se,Ve,Ne,te),Je=_,_=I,I=Je,w=w^k,_=_^E,C=C^S,I=I^T,k=se,E=te,S=Ne,T=Ve}function _e(se,te,Ne,Ve){se=se|0,te=te|0,Ne=Ne|0,Ve=Ve|0,re(0,2048,4096,z,k,E,S,T),k=w=w^se,E=_=_^te,S=C=C^Ne,T=I=I^Ve}function Ae(se,te,Ne,Ve){se=se|0,te=te|0,Ne=Ne|0,Ve=Ve|0,re(0,2048,4096,z,k,E,S,T),w=w^se,_=_^te,C=C^Ne,I=I^Ve,k=se,E=te,S=Ne,T=Ve}function H(se,te,Ne,Ve){se=se|0,te=te|0,Ne=Ne|0,Ve=Ve|0,re(0,2048,4096,z,k,E,S,T),k=w,E=_,S=C,T=I,w=w^se,_=_^te,C=C^Ne,I=I^Ve}function q(se,te,Ne,Ve){se=se|0,te=te|0,Ne=Ne|0,Ve=Ve|0,re(0,2048,4096,z,P,g,A,x),x=~L&x|L&x+1,A=~B&A|B&A+((x|0)==0),g=~O&g|O&g+((A|0)==0),P=~D&P|D&P+((g|0)==0),w=w^se,_=_^te,C=C^Ne,I=I^Ve}function W(se,te,Ne,Ve){se=se|0,te=te|0,Ne=Ne|0,Ve=Ve|0;var Je=0,lt=0,tt=0,ve=0,Z=0,oe=0,me=0,xe=0,Pe=0,ke=0;for(se=se^k,te=te^E,Ne=Ne^S,Ve=Ve^T,Je=M|0,lt=R|0,tt=N|0,ve=F|0;(Pe|0)<128;Pe=Pe+1|0)Je>>>31&&(Z=Z^se,oe=oe^te,me=me^Ne,xe=xe^Ve),Je=Je<<1|lt>>>31,lt=lt<<1|tt>>>31,tt=tt<<1|ve>>>31,ve=ve<<1,ke=Ve&1,Ve=Ve>>>1|Ne<<31,Ne=Ne>>>1|te<<31,te=te>>>1|se<<31,se=se>>>1,ke&&(se=se^3774873600);k=Z,E=oe,S=me,T=xe}function ee(se){se=se|0,z=se}function le(se,te,Ne,Ve){se=se|0,te=te|0,Ne=Ne|0,Ve=Ve|0,w=se,_=te,C=Ne,I=Ve}function ce(se,te,Ne,Ve){se=se|0,te=te|0,Ne=Ne|0,Ve=Ve|0,k=se,E=te,S=Ne,T=Ve}function ie(se,te,Ne,Ve){se=se|0,te=te|0,Ne=Ne|0,Ve=Ve|0,P=se,g=te,A=Ne,x=Ve}function Fe(se,te,Ne,Ve){se=se|0,te=te|0,Ne=Ne|0,Ve=Ve|0,D=se,O=te,B=Ne,L=Ve}function De(se,te,Ne,Ve){se=se|0,te=te|0,Ne=Ne|0,Ve=Ve|0,x=~L&x|L&Ve,A=~B&A|B&Ne,g=~O&g|O&te,P=~D&P|D&se}function qe(se){return se=se|0,se&15?-1:(j[se|0]=w>>>24,j[se|1]=w>>>16&255,j[se|2]=w>>>8&255,j[se|3]=w&255,j[se|4]=_>>>24,j[se|5]=_>>>16&255,j[se|6]=_>>>8&255,j[se|7]=_&255,j[se|8]=C>>>24,j[se|9]=C>>>16&255,j[se|10]=C>>>8&255,j[se|11]=C&255,j[se|12]=I>>>24,j[se|13]=I>>>16&255,j[se|14]=I>>>8&255,j[se|15]=I&255,16)}function he(se){return se=se|0,se&15?-1:(j[se|0]=k>>>24,j[se|1]=k>>>16&255,j[se|2]=k>>>8&255,j[se|3]=k&255,j[se|4]=E>>>24,j[se|5]=E>>>16&255,j[se|6]=E>>>8&255,j[se|7]=E&255,j[se|8]=S>>>24,j[se|9]=S>>>16&255,j[se|10]=S>>>8&255,j[se|11]=S&255,j[se|12]=T>>>24,j[se|13]=T>>>16&255,j[se|14]=T>>>8&255,j[se|15]=T&255,16)}function ue(){V(0,0,0,0),M=w,R=_,N=C,F=I}function pe(se,te,Ne){se=se|0,te=te|0,Ne=Ne|0;var Ve=0;if(te&15)return-1;for(;(Ne|0)>=16;)fe[se&7](j[te|0]<<24|j[te|1]<<16|j[te|2]<<8|j[te|3],j[te|4]<<24|j[te|5]<<16|j[te|6]<<8|j[te|7],j[te|8]<<24|j[te|9]<<16|j[te|10]<<8|j[te|11],j[te|12]<<24|j[te|13]<<16|j[te|14]<<8|j[te|15]),j[te|0]=w>>>24,j[te|1]=w>>>16&255,j[te|2]=w>>>8&255,j[te|3]=w&255,j[te|4]=_>>>24,j[te|5]=_>>>16&255,j[te|6]=_>>>8&255,j[te|7]=_&255,j[te|8]=C>>>24,j[te|9]=C>>>16&255,j[te|10]=C>>>8&255,j[te|11]=C&255,j[te|12]=I>>>24,j[te|13]=I>>>16&255,j[te|14]=I>>>8&255,j[te|15]=I&255,Ve=Ve+16|0,te=te+16|0,Ne=Ne-16|0;return Ve|0}function de(se,te,Ne){se=se|0,te=te|0,Ne=Ne|0;var Ve=0;if(te&15)return-1;for(;(Ne|0)>=16;)ge[se&1](j[te|0]<<24|j[te|1]<<16|j[te|2]<<8|j[te|3],j[te|4]<<24|j[te|5]<<16|j[te|6]<<8|j[te|7],j[te|8]<<24|j[te|9]<<16|j[te|10]<<8|j[te|11],j[te|12]<<24|j[te|13]<<16|j[te|14]<<8|j[te|15]),Ve=Ve+16|0,te=te+16|0,Ne=Ne-16|0;return Ve|0}var fe=[V,U,X,ye,_e,Ae,H,q],ge=[X,W];return{set_rounds:ee,set_state:le,set_iv:ce,set_nonce:ie,set_mask:Fe,set_counter:De,get_state:qe,get_iv:he,gcm_init:ue,cipher:pe,mac:de}}({Uint8Array,Uint32Array},u,p);return y.set_key=function(m,v,b,w,_,C,I,k,E){var S=d.subarray(0,60),T=d.subarray(256,316);S.set([v,b,w,_,C,I,k,E]);for(var P=m,g=1;P<4*m+28;P++){var A=S[P-1];(P%m==0||m===8&&P%m==4)&&(A=s[A>>>24]<<24^s[A>>>16&255]<<16^s[A>>>8&255]<<8^s[255&A]),P%m==0&&(A=A<<8^A>>>24^g<<24,g=g<<1^(128&g?27:0)),S[P]=S[P-m]^A}for(var x=0;x<P;x+=4)for(var D=0;D<4;D++)A=S[P-(4+x)+(4-D)%4],T[x+D]=x<4||x>=P-4?A:a[0][s[A>>>24]]^a[1][s[A>>>16&255]]^a[2][s[A>>>8&255]]^a[3][s[255&A]];y.set_rounds(m+5)},y};return l.ENC={ECB:0,CBC:2,CFB:4,OFB:6,CTR:7},l.DEC={ECB:1,CBC:3,CFB:5,OFB:6,CTR:7},l.MAC={CBC:0,GCM:1},l.HEAP_DATA=16384,l}();function T3(e){return e instanceof Uint8Array}function ag(e,t){const r=e?e.byteLength:t||65536;if(4095&r||r<=0)throw Error("heap size must be a positive integer and a multiple of 4096");return e=e||new Uint8Array(new ArrayBuffer(r))}function va(e,t,r,n,s){const i=e.length-t,o=i<s?i:s;return e.set(r.subarray(n,n+o),t),o}function $s(...e){const t=e.reduce((s,i)=>s+i.length,0),r=new Uint8Array(t);let n=0;for(let s=0;s<e.length;s++)r.set(e[s],n),n+=e[s].length;return r}class cy extends Error{constructor(...t){super(...t)}}class es extends Error{constructor(...t){super(...t)}}class uy extends Error{constructor(...t){super(...t)}}const C3=[],I3=[];class G0{constructor(t,r,n=!0,s,i,o){this.pos=0,this.len=0,this.mode=s,this.pos=0,this.len=0,this.key=t,this.iv=r,this.padding=n,this.acquire_asm(i,o)}acquire_asm(t,r){return this.heap!==void 0&&this.asm!==void 0||(this.heap=t||C3.pop()||ag().subarray(Kt.HEAP_DATA),this.asm=r||I3.pop()||new Kt(null,this.heap.buffer),this.reset(this.key,this.iv)),{heap:this.heap,asm:this.asm}}release_asm(){this.heap!==void 0&&this.asm!==void 0&&(C3.push(this.heap),I3.push(this.asm)),this.heap=void 0,this.asm=void 0}reset(t,r){const{asm:n}=this.acquire_asm(),s=t.length;if(s!==16&&s!==24&&s!==32)throw new es("illegal key size");const i=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.set_key(s>>2,i.getUint32(0),i.getUint32(4),i.getUint32(8),i.getUint32(12),s>16?i.getUint32(16):0,s>16?i.getUint32(20):0,s>24?i.getUint32(24):0,s>24?i.getUint32(28):0),r!==void 0){if(r.length!==16)throw new es("illegal iv size");let o=new DataView(r.buffer,r.byteOffset,r.byteLength);n.set_iv(o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12))}else n.set_iv(0,0,0,0)}AES_Encrypt_process(t){if(!T3(t))throw new TypeError("data isn't of expected type");let{heap:r,asm:n}=this.acquire_asm(),s=Kt.ENC[this.mode],i=Kt.HEAP_DATA,o=this.pos,a=this.len,f=0,c=t.length||0,l=0,u=0,p=new Uint8Array(a+c&-16);for(;c>0;)u=va(r,o+a,t,f,c),a+=u,f+=u,c-=u,u=n.cipher(s,i+o,a),u&&p.set(r.subarray(o,o+u),l),l+=u,u<a?(o+=u,a-=u):(o=0,a=0);return this.pos=o,this.len=a,p}AES_Encrypt_finish(){let{heap:t,asm:r}=this.acquire_asm(),n=Kt.ENC[this.mode],s=Kt.HEAP_DATA,i=this.pos,o=this.len,a=16-o%16,f=o;if(this.hasOwnProperty("padding")){if(this.padding){for(let l=0;l<a;++l)t[i+o+l]=a;o+=a,f=o}else if(o%16)throw new es("data length must be a multiple of the block size")}else o+=a;const c=new Uint8Array(f);return o&&r.cipher(n,s+i,o),f&&c.set(t.subarray(i,i+f)),this.pos=0,this.len=0,this.release_asm(),c}AES_Decrypt_process(t){if(!T3(t))throw new TypeError("data isn't of expected type");let{heap:r,asm:n}=this.acquire_asm(),s=Kt.DEC[this.mode],i=Kt.HEAP_DATA,o=this.pos,a=this.len,f=0,c=t.length||0,l=0,u=a+c&-16,p=0,d=0;this.padding&&(p=a+c-u||16,u-=p);const h=new Uint8Array(u);for(;c>0;)d=va(r,o+a,t,f,c),a+=d,f+=d,c-=d,d=n.cipher(s,i+o,a-(c?0:p)),d&&h.set(r.subarray(o,o+d),l),l+=d,d<a?(o+=d,a-=d):(o=0,a=0);return this.pos=o,this.len=a,h}AES_Decrypt_finish(){let{heap:t,asm:r}=this.acquire_asm(),n=Kt.DEC[this.mode],s=Kt.HEAP_DATA,i=this.pos,o=this.len,a=o;if(o>0){if(o%16){if(this.hasOwnProperty("padding"))throw new es("data length must be a multiple of the block size");o+=16-o%16}if(r.cipher(n,s+i,o),this.hasOwnProperty("padding")&&this.padding){let c=t[i+a-1];if(c<1||c>16||c>a)throw new uy("bad padding");let l=0;for(let u=c;u>1;u--)l|=c^t[i+a-u];if(l)throw new uy("bad padding");a-=c}}const f=new Uint8Array(a);return a>0&&f.set(t.subarray(i,i+a)),this.pos=0,this.len=0,this.release_asm(),f}}class Id{static encrypt(t,r,n=!1){return new Id(r,n).encrypt(t)}static decrypt(t,r,n=!1){return new Id(r,n).decrypt(t)}constructor(t,r=!1,n){this.aes=n||new G0(t,void 0,r,"ECB")}encrypt(t){return $s(this.aes.AES_Encrypt_process(t),this.aes.AES_Encrypt_finish())}decrypt(t){return $s(this.aes.AES_Decrypt_process(t),this.aes.AES_Decrypt_finish())}}function og(e){const t=function(r){const n=new Id(r);this.encrypt=function(s){return n.encrypt(s)},this.decrypt=function(s){return n.decrypt(s)}};return t.blockSize=t.prototype.blockSize=16,t.keySize=t.prototype.keySize=e/8,t}function g0(e,t,r,n,s,i){const o=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],a=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],l=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],u=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],d=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];let h,y,m,v,b,w,_,C,I,k,E,S,T,P,g=0,A=t.length;const x=e.length===32?3:9;C=x===3?r?[0,32,2]:[30,-2,-2]:r?[0,32,2,62,30,-2,64,96,2]:[94,62,-2,32,64,2,30,-2,-2],r&&(t=function(B,L){const M=8-B.length%8;let R;if(L===2&&M<8)R=32;else if(L===1)R=M;else{if(L||!(M<8)){if(M===8)return B;throw Error("des: invalid padding")}R=0}const N=new Uint8Array(B.length+M);for(let F=0;F<B.length;F++)N[F]=B[F];for(let F=0;F<M;F++)N[B.length+F]=R;return N}(t,i),A=t.length);let D=new Uint8Array(A),O=0;for(n===1&&(I=s[g++]<<24|s[g++]<<16|s[g++]<<8|s[g++],E=s[g++]<<24|s[g++]<<16|s[g++]<<8|s[g++],g=0);g<A;){for(w=t[g++]<<24|t[g++]<<16|t[g++]<<8|t[g++],_=t[g++]<<24|t[g++]<<16|t[g++]<<8|t[g++],n===1&&(r?(w^=I,_^=E):(k=I,S=E,I=w,E=_)),m=252645135&(w>>>4^_),_^=m,w^=m<<4,m=65535&(w>>>16^_),_^=m,w^=m<<16,m=858993459&(_>>>2^w),w^=m,_^=m<<2,m=16711935&(_>>>8^w),w^=m,_^=m<<8,m=1431655765&(w>>>1^_),_^=m,w^=m<<1,w=w<<1|w>>>31,_=_<<1|_>>>31,y=0;y<x;y+=3){for(T=C[y+1],P=C[y+2],h=C[y];h!==T;h+=P)v=_^e[h],b=(_>>>4|_<<28)^e[h+1],m=w,w=_,_=m^(a[v>>>24&63]|c[v>>>16&63]|u[v>>>8&63]|d[63&v]|o[b>>>24&63]|f[b>>>16&63]|l[b>>>8&63]|p[63&b]);m=w,w=_,_=m}w=w>>>1|w<<31,_=_>>>1|_<<31,m=1431655765&(w>>>1^_),_^=m,w^=m<<1,m=16711935&(_>>>8^w),w^=m,_^=m<<8,m=858993459&(_>>>2^w),w^=m,_^=m<<2,m=65535&(w>>>16^_),_^=m,w^=m<<16,m=252645135&(w>>>4^_),_^=m,w^=m<<4,n===1&&(r?(I=w,E=_):(w^=k,_^=S)),D[O++]=w>>>24,D[O++]=w>>>16&255,D[O++]=w>>>8&255,D[O++]=255&w,D[O++]=_>>>24,D[O++]=_>>>16&255,D[O++]=_>>>8&255,D[O++]=255&_}return r||(D=function(B,L){let M,R=null;if(L===2)M=32;else if(L===1)R=B[B.length-1];else{if(L)throw Error("des: invalid padding");M=0}if(!R){for(R=1;B[B.length-R]===M;)R++;R--}return B.subarray(0,B.length-R)}(D,i)),D}function m0(e){const t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],s=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],i=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],o=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],a=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],f=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],c=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],l=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],u=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],d=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],h=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=e.length>8?3:1,m=Array(32*y),v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0];let b,w,_,C=0,I=0;for(let k=0;k<y;k++){let E=e[C++]<<24|e[C++]<<16|e[C++]<<8|e[C++],S=e[C++]<<24|e[C++]<<16|e[C++]<<8|e[C++];_=252645135&(E>>>4^S),S^=_,E^=_<<4,_=65535&(S>>>-16^E),E^=_,S^=_<<-16,_=858993459&(E>>>2^S),S^=_,E^=_<<2,_=65535&(S>>>-16^E),E^=_,S^=_<<-16,_=1431655765&(E>>>1^S),S^=_,E^=_<<1,_=16711935&(S>>>8^E),E^=_,S^=_<<8,_=1431655765&(E>>>1^S),S^=_,E^=_<<1,_=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=_;for(let T=0;T<16;T++)v[T]?(E=E<<2|E>>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15,b=t[E>>>28]|r[E>>>24&15]|n[E>>>20&15]|s[E>>>16&15]|i[E>>>12&15]|o[E>>>8&15]|a[E>>>4&15],w=f[S>>>28]|c[S>>>24&15]|l[S>>>20&15]|u[S>>>16&15]|p[S>>>12&15]|d[S>>>8&15]|h[S>>>4&15],_=65535&(w>>>16^b),m[I++]=b^_,m[I++]=w^_<<16}return m}function Xu(e){this.key=[];for(let t=0;t<3;t++)this.key.push(new Uint8Array(e.subarray(8*t,8*t+8)));this.encrypt=function(t){return g0(m0(this.key[2]),g0(m0(this.key[1]),g0(m0(this.key[0]),t,!0,0,null,null),!1,0,null,null),!0,0,null,null)}}function FK(){this.BlockSize=8,this.KeySize=16,this.setKey=function(o){if(this.masking=Array(16),this.rotate=Array(16),this.reset(),o.length!==this.KeySize)throw Error("CAST-128: keys must be 16 bytes");return this.keySchedule(o),!0},this.reset=function(){for(let o=0;o<16;o++)this.masking[o]=0,this.rotate[o]=0},this.getBlockSize=function(){return this.BlockSize},this.encrypt=function(o){const a=Array(o.length);for(let f=0;f<o.length;f+=8){let c,l=o[f]<<24|o[f+1]<<16|o[f+2]<<8|o[f+3],u=o[f+4]<<24|o[f+5]<<16|o[f+6]<<8|o[f+7];c=u,u=l^r(u,this.masking[0],this.rotate[0]),l=c,c=u,u=l^n(u,this.masking[1],this.rotate[1]),l=c,c=u,u=l^s(u,this.masking[2],this.rotate[2]),l=c,c=u,u=l^r(u,this.masking[3],this.rotate[3]),l=c,c=u,u=l^n(u,this.masking[4],this.rotate[4]),l=c,c=u,u=l^s(u,this.masking[5],this.rotate[5]),l=c,c=u,u=l^r(u,this.masking[6],this.rotate[6]),l=c,c=u,u=l^n(u,this.masking[7],this.rotate[7]),l=c,c=u,u=l^s(u,this.masking[8],this.rotate[8]),l=c,c=u,u=l^r(u,this.masking[9],this.rotate[9]),l=c,c=u,u=l^n(u,this.masking[10],this.rotate[10]),l=c,c=u,u=l^s(u,this.masking[11],this.rotate[11]),l=c,c=u,u=l^r(u,this.masking[12],this.rotate[12]),l=c,c=u,u=l^n(u,this.masking[13],this.rotate[13]),l=c,c=u,u=l^s(u,this.masking[14],this.rotate[14]),l=c,c=u,u=l^r(u,this.masking[15],this.rotate[15]),l=c,a[f]=u>>>24&255,a[f+1]=u>>>16&255,a[f+2]=u>>>8&255,a[f+3]=255&u,a[f+4]=l>>>24&255,a[f+5]=l>>>16&255,a[f+6]=l>>>8&255,a[f+7]=255&l}return a},this.decrypt=function(o){const a=Array(o.length);for(let f=0;f<o.length;f+=8){let c,l=o[f]<<24|o[f+1]<<16|o[f+2]<<8|o[f+3],u=o[f+4]<<24|o[f+5]<<16|o[f+6]<<8|o[f+7];c=u,u=l^r(u,this.masking[15],this.rotate[15]),l=c,c=u,u=l^s(u,this.masking[14],this.rotate[14]),l=c,c=u,u=l^n(u,this.masking[13],this.rotate[13]),l=c,c=u,u=l^r(u,this.masking[12],this.rotate[12]),l=c,c=u,u=l^s(u,this.masking[11],this.rotate[11]),l=c,c=u,u=l^n(u,this.masking[10],this.rotate[10]),l=c,c=u,u=l^r(u,this.masking[9],this.rotate[9]),l=c,c=u,u=l^s(u,this.masking[8],this.rotate[8]),l=c,c=u,u=l^n(u,this.masking[7],this.rotate[7]),l=c,c=u,u=l^r(u,this.masking[6],this.rotate[6]),l=c,c=u,u=l^s(u,this.masking[5],this.rotate[5]),l=c,c=u,u=l^n(u,this.masking[4],this.rotate[4]),l=c,c=u,u=l^r(u,this.masking[3],this.rotate[3]),l=c,c=u,u=l^s(u,this.masking[2],this.rotate[2]),l=c,c=u,u=l^n(u,this.masking[1],this.rotate[1]),l=c,c=u,u=l^r(u,this.masking[0],this.rotate[0]),l=c,a[f]=u>>>24&255,a[f+1]=u>>>16&255,a[f+2]=u>>>8&255,a[f+3]=255&u,a[f+4]=l>>>24&255,a[f+5]=l>>16&255,a[f+6]=l>>8&255,a[f+7]=255&l}return a};const e=[,,,,];e[0]=[,,,,],e[0][0]=[4,0,13,15,12,14,8],e[0][1]=[5,2,16,18,17,19,10],e[0][2]=[6,3,23,22,21,20,9],e[0][3]=[7,1,26,25,27,24,11],e[1]=[,,,,],e[1][0]=[0,6,21,23,20,22,16],e[1][1]=[1,4,0,2,1,3,18],e[1][2]=[2,5,7,6,5,4,17],e[1][3]=[3,7,10,9,11,8,19],e[2]=[,,,,],e[2][0]=[4,0,13,15,12,14,8],e[2][1]=[5,2,16,18,17,19,10],e[2][2]=[6,3,23,22,21,20,9],e[2][3]=[7,1,26,25,27,24,11],e[3]=[,,,,],e[3][0]=[0,6,21,23,20,22,16],e[3][1]=[1,4,0,2,1,3,18],e[3][2]=[2,5,7,6,5,4,17],e[3][3]=[3,7,10,9,11,8,19];const t=[,,,,];function r(o,a,f){const c=a+o,l=c<<f|c>>>32-f;return(i[0][l>>>24]^i[1][l>>>16&255])-i[2][l>>>8&255]+i[3][255&l]}function n(o,a,f){const c=a^o,l=c<<f|c>>>32-f;return i[0][l>>>24]-i[1][l>>>16&255]+i[2][l>>>8&255]^i[3][255&l]}function s(o,a,f){const c=a-o,l=c<<f|c>>>32-f;return(i[0][l>>>24]+i[1][l>>>16&255]^i[2][l>>>8&255])-i[3][255&l]}t[0]=[,,,,],t[0][0]=[24,25,23,22,18],t[0][1]=[26,27,21,20,22],t[0][2]=[28,29,19,18,25],t[0][3]=[30,31,17,16,28],t[1]=[,,,,],t[1][0]=[3,2,12,13,8],t[1][1]=[1,0,14,15,13],t[1][2]=[7,6,8,9,3],t[1][3]=[5,4,10,11,7],t[2]=[,,,,],t[2][0]=[19,18,28,29,25],t[2][1]=[17,16,30,31,28],t[2][2]=[23,22,24,25,18],t[2][3]=[21,20,26,27,22],t[3]=[,,,,],t[3][0]=[8,9,7,6,3],t[3][1]=[10,11,5,4,7],t[3][2]=[12,13,3,2,8],t[3][3]=[14,15,1,0,13],this.keySchedule=function(o){const a=[,,,,,,,,],f=Array(32);let c;for(let d=0;d<4;d++)c=4*d,a[d]=o[c]<<24|o[c+1]<<16|o[c+2]<<8|o[c+3];const l=[6,7,4,5];let u,p=0;for(let d=0;d<2;d++)for(let h=0;h<4;h++){for(c=0;c<4;c++){const y=e[h][c];u=a[y[1]],u^=i[4][a[y[2]>>>2]>>>24-8*(3&y[2])&255],u^=i[5][a[y[3]>>>2]>>>24-8*(3&y[3])&255],u^=i[6][a[y[4]>>>2]>>>24-8*(3&y[4])&255],u^=i[7][a[y[5]>>>2]>>>24-8*(3&y[5])&255],u^=i[l[c]][a[y[6]>>>2]>>>24-8*(3&y[6])&255],a[y[0]]=u}for(c=0;c<4;c++){const y=t[h][c];u=i[4][a[y[0]>>>2]>>>24-8*(3&y[0])&255],u^=i[5][a[y[1]>>>2]>>>24-8*(3&y[1])&255],u^=i[6][a[y[2]>>>2]>>>24-8*(3&y[2])&255],u^=i[7][a[y[3]>>>2]>>>24-8*(3&y[3])&255],u^=i[4+c][a[y[4]>>>2]>>>24-8*(3&y[4])&255],f[p]=u,p++}}for(let d=0;d<16;d++)this.masking[d]=f[d],this.rotate[d]=31&f[16+d]};const i=[,,,,,,,,];i[0]=[821772500,2678128395,1810681135,1059425402,505495343,2617265619,1610868032,3483355465,3218386727,2294005173,3791863952,2563806837,1852023008,365126098,3269944861,584384398,677919599,3229601881,4280515016,2002735330,1136869587,3744433750,2289869850,2731719981,2714362070,879511577,1639411079,575934255,717107937,2857637483,576097850,2731753936,1725645e3,2810460463,5111599,767152862,2543075244,1251459544,1383482551,3052681127,3089939183,3612463449,1878520045,1510570527,2189125840,2431448366,582008916,3163445557,1265446783,1354458274,3529918736,3202711853,3073581712,3912963487,3029263377,1275016285,4249207360,2905708351,3304509486,1442611557,3585198765,2712415662,2731849581,3248163920,2283946226,208555832,2766454743,1331405426,1447828783,3315356441,3108627284,2957404670,2981538698,3339933917,1669711173,286233437,1465092821,1782121619,3862771680,710211251,980974943,1651941557,430374111,2051154026,704238805,4128970897,3144820574,2857402727,948965521,3333752299,2227686284,718756367,2269778983,2731643755,718440111,2857816721,3616097120,1113355533,2478022182,410092745,1811985197,1944238868,2696854588,1415722873,1682284203,1060277122,1998114690,1503841958,82706478,2315155686,1068173648,845149890,2167947013,1768146376,1993038550,3566826697,3390574031,940016341,3355073782,2328040721,904371731,1205506512,4094660742,2816623006,825647681,85914773,2857843460,1249926541,1417871568,3287612,3211054559,3126306446,1975924523,1353700161,2814456437,2438597621,1800716203,722146342,2873936343,1151126914,4160483941,2877670899,458611604,2866078500,3483680063,770352098,2652916994,3367839148,3940505011,3585973912,3809620402,718646636,2504206814,2914927912,3631288169,2857486607,2860018678,575749918,2857478043,718488780,2069512688,3548183469,453416197,1106044049,3032691430,52586708,3378514636,3459808877,3211506028,1785789304,218356169,3571399134,3759170522,1194783844,1523787992,3007827094,1975193539,2555452411,1341901877,3045838698,3776907964,3217423946,2802510864,2889438986,1057244207,1636348243,3761863214,1462225785,2632663439,481089165,718503062,24497053,3332243209,3344655856,3655024856,3960371065,1195698900,2971415156,3710176158,2115785917,4027663609,3525578417,2524296189,2745972565,3564906415,1372086093,1452307862,2780501478,1476592880,3389271281,18495466,2378148571,901398090,891748256,3279637769,3157290713,2560960102,1447622437,4284372637,216884176,2086908623,1879786977,3588903153,2242455666,2938092967,3559082096,2810645491,758861177,1121993112,215018983,642190776,4169236812,1196255959,2081185372,3508738393,941322904,4124243163,2877523539,1848581667,2205260958,3180453958,2589345134,3694731276,550028657,2519456284,3789985535,2973870856,2093648313,443148163,46942275,2734146937,1117713533,1115362972,1523183689,3717140224,1551984063],i[1]=[522195092,4010518363,1776537470,960447360,4267822970,4005896314,1435016340,1929119313,2913464185,1310552629,3579470798,3724818106,2579771631,1594623892,417127293,2715217907,2696228731,1508390405,3994398868,3925858569,3695444102,4019471449,3129199795,3770928635,3520741761,990456497,4187484609,2783367035,21106139,3840405339,631373633,3783325702,532942976,396095098,3548038825,4267192484,2564721535,2011709262,2039648873,620404603,3776170075,2898526339,3612357925,4159332703,1645490516,223693667,1567101217,3362177881,1029951347,3470931136,3570957959,1550265121,119497089,972513919,907948164,3840628539,1613718692,3594177948,465323573,2659255085,654439692,2575596212,2699288441,3127702412,277098644,624404830,4100943870,2717858591,546110314,2403699828,3655377447,1321679412,4236791657,1045293279,4010672264,895050893,2319792268,494945126,1914543101,2777056443,3894764339,2219737618,311263384,4275257268,3458730721,669096869,3584475730,3835122877,3319158237,3949359204,2005142349,2713102337,2228954793,3769984788,569394103,3855636576,1425027204,108000370,2736431443,3671869269,3043122623,1750473702,2211081108,762237499,3972989403,2798899386,3061857628,2943854345,867476300,964413654,1591880597,1594774276,2179821409,552026980,3026064248,3726140315,2283577634,3110545105,2152310760,582474363,1582640421,1383256631,2043843868,3322775884,1217180674,463797851,2763038571,480777679,2718707717,2289164131,3118346187,214354409,200212307,3810608407,3025414197,2674075964,3997296425,1847405948,1342460550,510035443,4080271814,815934613,833030224,1620250387,1945732119,2703661145,3966000196,1388869545,3456054182,2687178561,2092620194,562037615,1356438536,3409922145,3261847397,1688467115,2150901366,631725691,3840332284,549916902,3455104640,394546491,837744717,2114462948,751520235,2221554606,2415360136,3999097078,2063029875,803036379,2702586305,821456707,3019566164,360699898,4018502092,3511869016,3677355358,2402471449,812317050,49299192,2570164949,3259169295,2816732080,3331213574,3101303564,2156015656,3705598920,3546263921,143268808,3200304480,1638124008,3165189453,3341807610,578956953,2193977524,3638120073,2333881532,807278310,658237817,2969561766,1641658566,11683945,3086995007,148645947,1138423386,4158756760,1981396783,2401016740,3699783584,380097457,2680394679,2803068651,3334260286,441530178,4016580796,1375954390,761952171,891809099,2183123478,157052462,3683840763,1592404427,341349109,2438483839,1417898363,644327628,2233032776,2353769706,2201510100,220455161,1815641738,182899273,2995019788,3627381533,3702638151,2890684138,1052606899,588164016,1681439879,4038439418,2405343923,4229449282,167996282,1336969661,1688053129,2739224926,1543734051,1046297529,1138201970,2121126012,115334942,1819067631,1902159161,1941945968,2206692869,1159982321],i[2]=[2381300288,637164959,3952098751,3893414151,1197506559,916448331,2350892612,2932787856,3199334847,4009478890,3905886544,1373570990,2450425862,4037870920,3778841987,2456817877,286293407,124026297,3001279700,1028597854,3115296800,4208886496,2691114635,2188540206,1430237888,1218109995,3572471700,308166588,570424558,2187009021,2455094765,307733056,1310360322,3135275007,1384269543,2388071438,863238079,2359263624,2801553128,3380786597,2831162807,1470087780,1728663345,4072488799,1090516929,532123132,2389430977,1132193179,2578464191,3051079243,1670234342,1434557849,2711078940,1241591150,3314043432,3435360113,3091448339,1812415473,2198440252,267246943,796911696,3619716990,38830015,1526438404,2806502096,374413614,2943401790,1489179520,1603809326,1920779204,168801282,260042626,2358705581,1563175598,2397674057,1356499128,2217211040,514611088,2037363785,2186468373,4022173083,2792511869,2913485016,1173701892,4200428547,3896427269,1334932762,2455136706,602925377,2835607854,1613172210,41346230,2499634548,2457437618,2188827595,41386358,4172255629,1313404830,2405527007,3801973774,2217704835,873260488,2528884354,2478092616,4012915883,2555359016,2006953883,2463913485,575479328,2218240648,2099895446,660001756,2341502190,3038761536,3888151779,3848713377,3286851934,1022894237,1620365795,3449594689,1551255054,15374395,3570825345,4249311020,4151111129,3181912732,310226346,1133119310,530038928,136043402,2476768958,3107506709,2544909567,1036173560,2367337196,1681395281,1758231547,3641649032,306774401,1575354324,3716085866,1990386196,3114533736,2455606671,1262092282,3124342505,2768229131,4210529083,1833535011,423410938,660763973,2187129978,1639812e3,3508421329,3467445492,310289298,272797111,2188552562,2456863912,310240523,677093832,1013118031,901835429,3892695601,1116285435,3036471170,1337354835,243122523,520626091,277223598,4244441197,4194248841,1766575121,594173102,316590669,742362309,3536858622,4176435350,3838792410,2501204839,1229605004,3115755532,1552908988,2312334149,979407927,3959474601,1148277331,176638793,3614686272,2083809052,40992502,1340822838,2731552767,3535757508,3560899520,1354035053,122129617,7215240,2732932949,3118912700,2718203926,2539075635,3609230695,3725561661,1928887091,2882293555,1988674909,2063640240,2491088897,1459647954,4189817080,2302804382,1113892351,2237858528,1927010603,4002880361,1856122846,1594404395,2944033133,3855189863,3474975698,1643104450,4054590833,3431086530,1730235576,2984608721,3084664418,2131803598,4178205752,267404349,1617849798,1616132681,1462223176,736725533,2327058232,551665188,2945899023,1749386277,2575514597,1611482493,674206544,2201269090,3642560800,728599968,1680547377,2620414464,1388111496,453204106,4156223445,1094905244,2754698257,2201108165,3757000246,2704524545,3922940700,3996465027],i[3]=[2645754912,532081118,2814278639,3530793624,1246723035,1689095255,2236679235,4194438865,2116582143,3859789411,157234593,2045505824,4245003587,1687664561,4083425123,605965023,672431967,1336064205,3376611392,214114848,4258466608,3232053071,489488601,605322005,3998028058,264917351,1912574028,756637694,436560991,202637054,135989450,85393697,2152923392,3896401662,2895836408,2145855233,3535335007,115294817,3147733898,1922296357,3464822751,4117858305,1037454084,2725193275,2127856640,1417604070,1148013728,1827919605,642362335,2929772533,909348033,1346338451,3547799649,297154785,1917849091,4161712827,2883604526,3968694238,1469521537,3780077382,3375584256,1763717519,136166297,4290970789,1295325189,2134727907,2798151366,1566297257,3672928234,2677174161,2672173615,965822077,2780786062,289653839,1133871874,3491843819,35685304,1068898316,418943774,672553190,642281022,2346158704,1954014401,3037126780,4079815205,2030668546,3840588673,672283427,1776201016,359975446,3750173538,555499703,2769985273,1324923,69110472,152125443,3176785106,3822147285,1340634837,798073664,1434183902,15393959,216384236,1303690150,3881221631,3711134124,3960975413,106373927,2578434224,1455997841,1801814300,1578393881,1854262133,3188178946,3258078583,2302670060,1539295533,3505142565,3078625975,2372746020,549938159,3278284284,2620926080,181285381,2865321098,3970029511,68876850,488006234,1728155692,2608167508,836007927,2435231793,919367643,3339422534,3655756360,1457871481,40520939,1380155135,797931188,234455205,2255801827,3990488299,397000196,739833055,3077865373,2871719860,4022553888,772369276,390177364,3853951029,557662966,740064294,1640166671,1699928825,3535942136,622006121,3625353122,68743880,1742502,219489963,1664179233,1577743084,1236991741,410585305,2366487942,823226535,1050371084,3426619607,3586839478,212779912,4147118561,1819446015,1911218849,530248558,3486241071,3252585495,2886188651,3410272728,2342195030,20547779,2982490058,3032363469,3631753222,312714466,1870521650,1493008054,3491686656,615382978,4103671749,2534517445,1932181,2196105170,278426614,6369430,3274544417,2913018367,697336853,2143000447,2946413531,701099306,1558357093,2805003052,3500818408,2321334417,3567135975,216290473,3591032198,23009561,1996984579,3735042806,2024298078,3739440863,569400510,2339758983,3016033873,3097871343,3639523026,3844324983,3256173865,795471839,2951117563,4101031090,4091603803,3603732598,971261452,534414648,428311343,3389027175,2844869880,694888862,1227866773,2456207019,3043454569,2614353370,3749578031,3676663836,459166190,4132644070,1794958188,51825668,2252611902,3084671440,2036672799,3436641603,1099053433,2469121526,3059204941,1323291266,2061838604,1018778475,2233344254,2553501054,334295216,3556750194,1065731521,183467730],i[4]=[2127105028,745436345,2601412319,2788391185,3093987327,500390133,1155374404,389092991,150729210,3891597772,3523549952,1935325696,716645080,946045387,2901812282,1774124410,3869435775,4039581901,3293136918,3438657920,948246080,363898952,3867875531,1286266623,1598556673,68334250,630723836,1104211938,1312863373,613332731,2377784574,1101634306,441780740,3129959883,1917973735,2510624549,3238456535,2544211978,3308894634,1299840618,4076074851,1756332096,3977027158,297047435,3790297736,2265573040,3621810518,1311375015,1667687725,47300608,3299642885,2474112369,201668394,1468347890,576830978,3594690761,3742605952,1958042578,1747032512,3558991340,1408974056,3366841779,682131401,1033214337,1545599232,4265137049,206503691,103024618,2855227313,1337551222,2428998917,2963842932,4015366655,3852247746,2796956967,3865723491,3747938335,247794022,3755824572,702416469,2434691994,397379957,851939612,2314769512,218229120,1380406772,62274761,214451378,3170103466,2276210409,3845813286,28563499,446592073,1693330814,3453727194,29968656,3093872512,220656637,2470637031,77972100,1667708854,1358280214,4064765667,2395616961,325977563,4277240721,4220025399,3605526484,3355147721,811859167,3069544926,3962126810,652502677,3075892249,4132761541,3498924215,1217549313,3250244479,3858715919,3053989961,1538642152,2279026266,2875879137,574252750,3324769229,2651358713,1758150215,141295887,2719868960,3515574750,4093007735,4194485238,1082055363,3417560400,395511885,2966884026,179534037,3646028556,3738688086,1092926436,2496269142,257381841,3772900718,1636087230,1477059743,2499234752,3811018894,2675660129,3285975680,90732309,1684827095,1150307763,1723134115,3237045386,1769919919,1240018934,815675215,750138730,2239792499,1234303040,1995484674,138143821,675421338,1145607174,1936608440,3238603024,2345230278,2105974004,323969391,779555213,3004902369,2861610098,1017501463,2098600890,2628620304,2940611490,2682542546,1171473753,3656571411,3687208071,4091869518,393037935,159126506,1662887367,1147106178,391545844,3452332695,1891500680,3016609650,1851642611,546529401,1167818917,3194020571,2848076033,3953471836,575554290,475796850,4134673196,450035699,2351251534,844027695,1080539133,86184846,1554234488,3692025454,1972511363,2018339607,1491841390,1141460869,1061690759,4244549243,2008416118,2351104703,2868147542,1598468138,722020353,1027143159,212344630,1387219594,1725294528,3745187956,2500153616,458938280,4129215917,1828119673,544571780,3503225445,2297937496,1241802790,267843827,2694610800,1397140384,1558801448,3782667683,1806446719,929573330,2234912681,400817706,616011623,4121520928,3603768725,1761550015,1968522284,4053731006,4192232858,4005120285,872482584,3140537016,3894607381,2287405443,1963876937,3663887957,1584857e3,2975024454,1833426440,4025083860],i[5]=[4143615901,749497569,1285769319,3795025788,2514159847,23610292,3974978748,844452780,3214870880,3751928557,2213566365,1676510905,448177848,3730751033,4086298418,2307502392,871450977,3222878141,4110862042,3831651966,2735270553,1310974780,2043402188,1218528103,2736035353,4274605013,2702448458,3936360550,2693061421,162023535,2827510090,687910808,23484817,3784910947,3371371616,779677500,3503626546,3473927188,4157212626,3500679282,4248902014,2466621104,3899384794,1958663117,925738300,1283408968,3669349440,1840910019,137959847,2679828185,1239142320,1315376211,1547541505,1690155329,739140458,3128809933,3933172616,3876308834,905091803,1548541325,4040461708,3095483362,144808038,451078856,676114313,2861728291,2469707347,993665471,373509091,2599041286,4025009006,4170239449,2149739950,3275793571,3749616649,2794760199,1534877388,572371878,2590613551,1753320020,3467782511,1405125690,4270405205,633333386,3026356924,3475123903,632057672,2846462855,1404951397,3882875879,3915906424,195638627,2385783745,3902872553,1233155085,3355999740,2380578713,2702246304,2144565621,3663341248,3894384975,2502479241,4248018925,3094885567,1594115437,572884632,3385116731,767645374,1331858858,1475698373,3793881790,3532746431,1321687957,619889600,1121017241,3440213920,2070816767,2833025776,1933951238,4095615791,890643334,3874130214,859025556,360630002,925594799,1764062180,3920222280,4078305929,979562269,2810700344,4087740022,1949714515,546639971,1165388173,3069891591,1495988560,922170659,1291546247,2107952832,1813327274,3406010024,3306028637,4241950635,153207855,2313154747,1608695416,1150242611,1967526857,721801357,1220138373,3691287617,3356069787,2112743302,3281662835,1111556101,1778980689,250857638,2298507990,673216130,2846488510,3207751581,3562756981,3008625920,3417367384,2198807050,529510932,3547516680,3426503187,2364944742,102533054,2294910856,1617093527,1204784762,3066581635,1019391227,1069574518,1317995090,1691889997,3661132003,510022745,3238594800,1362108837,1817929911,2184153760,805817662,1953603311,3699844737,120799444,2118332377,207536705,2282301548,4120041617,145305846,2508124933,3086745533,3261524335,1877257368,2977164480,3160454186,2503252186,4221677074,759945014,254147243,2767453419,3801518371,629083197,2471014217,907280572,3900796746,940896768,2751021123,2625262786,3161476951,3661752313,3260732218,1425318020,2977912069,1496677566,3988592072,2140652971,3126511541,3069632175,977771578,1392695845,1698528874,1411812681,1369733098,1343739227,3620887944,1142123638,67414216,3102056737,3088749194,1626167401,2546293654,3941374235,697522451,33404913,143560186,2595682037,994885535,1247667115,3859094837,2699155541,3547024625,4114935275,2968073508,3199963069,2732024527,1237921620,951448369,1898488916,1211705605,2790989240,2233243581,3598044975],i[6]=[2246066201,858518887,1714274303,3485882003,713916271,2879113490,3730835617,539548191,36158695,1298409750,419087104,1358007170,749914897,2989680476,1261868530,2995193822,2690628854,3443622377,3780124940,3796824509,2976433025,4259637129,1551479e3,512490819,1296650241,951993153,2436689437,2460458047,144139966,3136204276,310820559,3068840729,643875328,1969602020,1680088954,2185813161,3283332454,672358534,198762408,896343282,276269502,3014846926,84060815,197145886,376173866,3943890818,3813173521,3545068822,1316698879,1598252827,2633424951,1233235075,859989710,2358460855,3503838400,3409603720,1203513385,1193654839,2792018475,2060853022,207403770,1144516871,3068631394,1121114134,177607304,3785736302,326409831,1929119770,2983279095,4183308101,3474579288,3200513878,3228482096,119610148,1170376745,3378393471,3163473169,951863017,3337026068,3135789130,2907618374,1183797387,2015970143,4045674555,2182986399,2952138740,3928772205,384012900,2454997643,10178499,2879818989,2596892536,111523738,2995089006,451689641,3196290696,235406569,1441906262,3890558523,3013735005,4158569349,1644036924,376726067,1006849064,3664579700,2041234796,1021632941,1374734338,2566452058,371631263,4007144233,490221539,206551450,3140638584,1053219195,1853335209,3412429660,3562156231,735133835,1623211703,3104214392,2738312436,4096837757,3366392578,3110964274,3956598718,3196820781,2038037254,3877786376,2339753847,300912036,3766732888,2372630639,1516443558,4200396704,1574567987,4069441456,4122592016,2699739776,146372218,2748961456,2043888151,35287437,2596680554,655490400,1132482787,110692520,1031794116,2188192751,1324057718,1217253157,919197030,686247489,3261139658,1028237775,3135486431,3059715558,2460921700,986174950,2661811465,4062904701,2752986992,3709736643,367056889,1353824391,731860949,1650113154,1778481506,784341916,357075625,3608602432,1074092588,2480052770,3811426202,92751289,877911070,3600361838,1231880047,480201094,3756190983,3094495953,434011822,87971354,363687820,1717726236,1901380172,3926403882,2481662265,400339184,1490350766,2661455099,1389319756,2558787174,784598401,1983468483,30828846,3550527752,2716276238,3841122214,1765724805,1955612312,1277890269,1333098070,1564029816,2704417615,1026694237,3287671188,1260819201,3349086767,1016692350,1582273796,1073413053,1995943182,694588404,1025494639,3323872702,3551898420,4146854327,453260480,1316140391,1435673405,3038941953,3486689407,1622062951,403978347,817677117,950059133,4246079218,3278066075,1486738320,1417279718,481875527,2549965225,3933690356,760697757,1452955855,3897451437,1177426808,1702951038,4085348628,2447005172,1084371187,3516436277,3068336338,1073369276,1027665953,3284188590,1230553676,1368340146,2226246512,267243139,2274220762,4070734279,2497715176,2423353163,2504755875],i[7]=[3793104909,3151888380,2817252029,895778965,2005530807,3871412763,237245952,86829237,296341424,3851759377,3974600970,2475086196,709006108,1994621201,2972577594,937287164,3734691505,168608556,3189338153,2225080640,3139713551,3033610191,3025041904,77524477,185966941,1208824168,2344345178,1721625922,3354191921,1066374631,1927223579,1971335949,2483503697,1551748602,2881383779,2856329572,3003241482,48746954,1398218158,2050065058,313056748,4255789917,393167848,1912293076,940740642,3465845460,3091687853,2522601570,2197016661,1727764327,364383054,492521376,1291706479,3264136376,1474851438,1685747964,2575719748,1619776915,1814040067,970743798,1561002147,2925768690,2123093554,1880132620,3151188041,697884420,2550985770,2607674513,2659114323,110200136,1489731079,997519150,1378877361,3527870668,478029773,2766872923,1022481122,431258168,1112503832,897933369,2635587303,669726182,3383752315,918222264,163866573,3246985393,3776823163,114105080,1903216136,761148244,3571337562,1690750982,3166750252,1037045171,1888456500,2010454850,642736655,616092351,365016990,1185228132,4174898510,1043824992,2023083429,2241598885,3863320456,3279669087,3674716684,108438443,2132974366,830746235,606445527,4173263986,2204105912,1844756978,2532684181,4245352700,2969441100,3796921661,1335562986,4061524517,2720232303,2679424040,634407289,885462008,3294724487,3933892248,2094100220,339117932,4048830727,3202280980,1458155303,2689246273,1022871705,2464987878,3714515309,353796843,2822958815,4256850100,4052777845,551748367,618185374,3778635579,4020649912,1904685140,3069366075,2670879810,3407193292,2954511620,4058283405,2219449317,3135758300,1120655984,3447565834,1474845562,3577699062,550456716,3466908712,2043752612,881257467,869518812,2005220179,938474677,3305539448,3850417126,1315485940,3318264702,226533026,965733244,321539988,1136104718,804158748,573969341,3708209826,937399083,3290727049,2901666755,1461057207,4013193437,4066861423,3242773476,2421326174,1581322155,3028952165,786071460,3900391652,3918438532,1485433313,4023619836,3708277595,3678951060,953673138,1467089153,1930354364,1533292819,2492563023,1346121658,1685000834,1965281866,3765933717,4190206607,2052792609,3515332758,690371149,3125873887,2180283551,2903598061,3933952357,436236910,289419410,14314871,1242357089,2904507907,1616633776,2666382180,585885352,3471299210,2699507360,1432659641,277164553,3354103607,770115018,2303809295,3741942315,3177781868,2853364978,2269453327,3774259834,987383833,1290892879,225909803,1741533526,890078084,1496906255,1111072499,916028167,243534141,1252605537,2204162171,531204876,290011180,3916834213,102027703,237315147,209093447,1486785922,220223953,2758195998,4175039106,82940208,3127791296,2569425252,518464269,1353887104,3941492737,2377294467,3935040926]}function Qu(e){this.cast5=new FK,this.cast5.setKey(e),this.encrypt=function(t){return this.cast5.encrypt(t)}}Xu.keySize=Xu.prototype.keySize=24,Xu.blockSize=Xu.prototype.blockSize=8,Qu.blockSize=Qu.prototype.blockSize=8,Qu.keySize=Qu.prototype.keySize=16;const Ln=4294967295;function li(e,t){return(e<<t|e>>>32-t)&Ln}function Ki(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function hs(e,t,r){e.splice(t,4,255&r,r>>>8&255,r>>>16&255,r>>>24&255)}function Ot(e,t){return e>>>8*t&255}function e0(e){this.tf=function(){let t=null,r=null,n=-1,s=[],i=[[],[],[],[]];function o(l){return i[0][Ot(l,0)]^i[1][Ot(l,1)]^i[2][Ot(l,2)]^i[3][Ot(l,3)]}function a(l){return i[0][Ot(l,3)]^i[1][Ot(l,0)]^i[2][Ot(l,1)]^i[3][Ot(l,2)]}function f(l,u){let p=o(u[0]),d=a(u[1]);u[2]=li(u[2]^p+d+s[4*l+8]&Ln,31),u[3]=li(u[3],1)^p+2*d+s[4*l+9]&Ln,p=o(u[2]),d=a(u[3]),u[0]=li(u[0]^p+d+s[4*l+10]&Ln,31),u[1]=li(u[1],1)^p+2*d+s[4*l+11]&Ln}function c(l,u){let p=o(u[0]),d=a(u[1]);u[2]=li(u[2],1)^p+d+s[4*l+10]&Ln,u[3]=li(u[3]^p+2*d+s[4*l+11]&Ln,31),p=o(u[2]),d=a(u[3]),u[0]=li(u[0],1)^p+d+s[4*l+8]&Ln,u[1]=li(u[1]^p+2*d+s[4*l+9]&Ln,31)}return{name:"twofish",blocksize:16,open:function(l){let u,p,d,h,y;t=l;const m=[],v=[],b=[];let w;const _=[];let C,I,k;const E=[[8,1,7,13,6,15,3,2,0,11,5,9,14,12,10,4],[2,8,11,13,15,7,6,14,3,1,9,4,0,10,12,5]],S=[[14,12,11,8,1,2,3,5,15,4,10,6,7,0,9,13],[1,14,2,11,4,12,3,7,6,13,10,5,15,9,0,8]],T=[[11,10,5,14,6,13,9,0,12,8,15,3,2,4,7,1],[4,12,7,5,1,6,9,10,0,14,13,8,2,11,3,15]],P=[[13,7,15,4,1,2,6,14,9,11,3,0,8,5,12,10],[11,9,5,1,12,3,13,14,6,4,7,15,2,0,8,10]],g=[0,8,1,9,2,10,3,11,4,12,5,13,6,14,7,15],A=[0,9,2,11,4,13,6,15,8,1,10,3,12,5,14,7],x=[[],[]],D=[[],[],[],[]];function O(N){return N^N>>2^[0,90,180,238][3&N]}function B(N){return N^N>>1^N>>2^[0,238,180,90][3&N]}function L(N,F){let z,Y,j;for(z=0;z<8;z++)Y=F>>>24,F=F<<8&Ln|N>>>24,N=N<<8&Ln,j=Y<<1,128&Y&&(j^=333),F^=Y^j<<16,j^=Y>>>1,1&Y&&(j^=166),F^=j<<24|j<<8;return F}function M(N,F){const z=F>>4,Y=15&F,j=E[N][z^Y],re=S[N][g[Y]^A[z]];return P[N][g[re]^A[j]]<<4|T[N][j^re]}function R(N,F){let z=Ot(N,0),Y=Ot(N,1),j=Ot(N,2),re=Ot(N,3);switch(w){case 4:z=x[1][z]^Ot(F[3],0),Y=x[0][Y]^Ot(F[3],1),j=x[0][j]^Ot(F[3],2),re=x[1][re]^Ot(F[3],3);case 3:z=x[1][z]^Ot(F[2],0),Y=x[1][Y]^Ot(F[2],1),j=x[0][j]^Ot(F[2],2),re=x[0][re]^Ot(F[2],3);case 2:z=x[0][x[0][z]^Ot(F[1],0)]^Ot(F[0],0),Y=x[0][x[1][Y]^Ot(F[1],1)]^Ot(F[0],1),j=x[1][x[0][j]^Ot(F[1],2)]^Ot(F[0],2),re=x[1][x[1][re]^Ot(F[1],3)]^Ot(F[0],3)}return D[0][z]^D[1][Y]^D[2][j]^D[3][re]}for(t=t.slice(0,32),u=t.length;u!==16&&u!==24&&u!==32;)t[u++]=0;for(u=0;u<t.length;u+=4)b[u>>2]=Ki(t,u);for(u=0;u<256;u++)x[0][u]=M(0,u),x[1][u]=M(1,u);for(u=0;u<256;u++)C=x[1][u],I=O(C),k=B(C),D[0][u]=C+(I<<8)+(k<<16)+(k<<24),D[2][u]=I+(k<<8)+(C<<16)+(k<<24),C=x[0][u],I=O(C),k=B(C),D[1][u]=k+(k<<8)+(I<<16)+(C<<24),D[3][u]=I+(C<<8)+(k<<16)+(I<<24);for(w=b.length/2,u=0;u<w;u++)p=b[u+u],m[u]=p,d=b[u+u+1],v[u]=d,_[w-u-1]=L(p,d);for(u=0;u<40;u+=2)p=16843009*u,d=p+16843009,p=R(p,m),d=li(R(d,v),8),s[u]=p+d&Ln,s[u+1]=li(p+2*d,9);for(u=0;u<256;u++)switch(p=d=h=y=u,w){case 4:p=x[1][p]^Ot(_[3],0),d=x[0][d]^Ot(_[3],1),h=x[0][h]^Ot(_[3],2),y=x[1][y]^Ot(_[3],3);case 3:p=x[1][p]^Ot(_[2],0),d=x[1][d]^Ot(_[2],1),h=x[0][h]^Ot(_[2],2),y=x[0][y]^Ot(_[2],3);case 2:i[0][u]=D[0][x[0][x[0][p]^Ot(_[1],0)]^Ot(_[0],0)],i[1][u]=D[1][x[0][x[1][d]^Ot(_[1],1)]^Ot(_[0],1)],i[2][u]=D[2][x[1][x[0][h]^Ot(_[1],2)]^Ot(_[0],2)],i[3][u]=D[3][x[1][x[1][y]^Ot(_[1],3)]^Ot(_[0],3)]}},close:function(){s=[],i=[[],[],[],[]]},encrypt:function(l,u){r=l,n=u;const p=[Ki(r,n)^s[0],Ki(r,n+4)^s[1],Ki(r,n+8)^s[2],Ki(r,n+12)^s[3]];for(let d=0;d<8;d++)f(d,p);return hs(r,n,p[2]^s[4]),hs(r,n+4,p[3]^s[5]),hs(r,n+8,p[0]^s[6]),hs(r,n+12,p[1]^s[7]),n+=16,r},decrypt:function(l,u){r=l,n=u;const p=[Ki(r,n)^s[4],Ki(r,n+4)^s[5],Ki(r,n+8)^s[6],Ki(r,n+12)^s[7]];for(let d=7;d>=0;d--)c(d,p);hs(r,n,p[2]^s[0]),hs(r,n+4,p[3]^s[1]),hs(r,n+8,p[0]^s[2]),hs(r,n+12,p[1]^s[3]),n+=16},finalize:function(){return r}}}(),this.tf.open(Array.from(e),0),this.encrypt=function(t){return this.tf.encrypt(Array.from(t),0)}}function ei(){}function t0(e){this.bf=new ei,this.bf.init(e),this.encrypt=function(t){return this.bf.encryptBlock(t)}}e0.keySize=e0.prototype.keySize=32,e0.blockSize=e0.prototype.blockSize=16,ei.prototype.BLOCKSIZE=8,ei.prototype.SBOXES=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]],ei.prototype.PARRAY=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],ei.prototype.NN=16,ei.prototype._clean=function(e){return e<0&&(e=(2147483647&e)+2147483648),e},ei.prototype._F=function(e){let t;const r=255&e,n=255&(e>>>=8),s=255&(e>>>=8),i=255&(e>>>=8);return t=this.sboxes[0][i]+this.sboxes[1][s],t^=this.sboxes[2][n],t+=this.sboxes[3][r],t},ei.prototype._encryptBlock=function(e){let t,r=e[0],n=e[1];for(t=0;t<this.NN;++t){r^=this.parray[t],n=this._F(r)^n;const s=r;r=n,n=s}r^=this.parray[this.NN+0],n^=this.parray[this.NN+1],e[0]=this._clean(n),e[1]=this._clean(r)},ei.prototype.encryptBlock=function(e){let t;const r=[0,0],n=this.BLOCKSIZE/2;for(t=0;t<this.BLOCKSIZE/2;++t)r[0]=r[0]<<8|255&e[t+0],r[1]=r[1]<<8|255&e[t+n];this._encryptBlock(r);const s=[];for(t=0;t<this.BLOCKSIZE/2;++t)s[t+0]=r[0]>>>24-8*t&255,s[t+n]=r[1]>>>24-8*t&255;return s},ei.prototype._decryptBlock=function(e){let t,r=e[0],n=e[1];for(t=this.NN+1;t>1;--t){r^=this.parray[t],n=this._F(r)^n;const s=r;r=n,n=s}r^=this.parray[1],n^=this.parray[0],e[0]=this._clean(n),e[1]=this._clean(r)},ei.prototype.init=function(e){let t,r=0;for(this.parray=[],t=0;t<this.NN+2;++t){let s=0;for(let i=0;i<4;++i)s=s<<8|255&e[r],++r>=e.length&&(r=0);this.parray[t]=this.PARRAY[t]^s}for(this.sboxes=[],t=0;t<4;++t)for(this.sboxes[t]=[],r=0;r<256;++r)this.sboxes[t][r]=this.SBOXES[t][r];const n=[0,0];for(t=0;t<this.NN+2;t+=2)this._encryptBlock(n),this.parray[t+0]=n[0],this.parray[t+1]=n[1];for(t=0;t<4;++t)for(r=0;r<256;r+=2)this._encryptBlock(n),this.sboxes[t][r+0]=n[0],this.sboxes[t][r+1]=n[1]},t0.keySize=t0.prototype.keySize=16,t0.blockSize=t0.prototype.blockSize=8;const qK=og(128),jK=og(192),$K=og(256),HK=function(e){this.key=e,this.encrypt=function(t,r){return g0(m0(this.key),t,!0,0,null,r)},this.decrypt=function(t,r){return g0(m0(this.key),t,!1,0,null,r)}};var z0=Object.freeze({__proto__:null,aes128:qK,aes192:jK,aes256:$K,des:HK,tripledes:Xu,cast5:Qu,twofish:e0,blowfish:t0,idea:function(){throw Error("IDEA symmetric-key algorithm not implemented")}}),O9=function(e,t,r){var n=0,s=0,i=0,o=0,a=0,f=0,c=0,l=0,u=0,p=0,d=0,h=0,y=0,m=0,v=0,b=0,w=0,_=new e.Uint8Array(r);function C(B,L,M,R,N,F,z,Y,j,re,V,U,X,ye,_e,Ae){B=B|0,L=L|0,M=M|0,R=R|0,N=N|0,F=F|0,z=z|0,Y=Y|0,j=j|0,re=re|0,V=V|0,U=U|0,X=X|0,ye=ye|0,_e=_e|0,Ae=Ae|0;var H=0,q=0,W=0,ee=0,le=0,ce=0,ie=0,Fe=0,De=0,qe=0,he=0,ue=0,pe=0,de=0,fe=0,ge=0,se=0,te=0,Ne=0,Ve=0,Je=0,lt=0,tt=0,ve=0,Z=0,oe=0,me=0,xe=0,Pe=0,ke=0,Oe=0,Ue=0,Ie=0,Re=0,et=0,we=0,Ce=0,Be=0,Le=0,Me=0,$=0,J=0,Q=0,K=0,ae=0,Se=0,Te=0,Ke=0,Ge=0,dt=0,it=0,Ct=0,at=0,vt=0,bt=0,St=0,At=0,_t=0,Et=0,wt=0,ut=0,ht=0,st=0,ft=0,pt=0,ct=0,je=0,$e=0,Ye=0,ze=0,We=0;H=n,q=s,W=i,ee=o,le=a,ie=B+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ie=L+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ie=M+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ie=R+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ie=N+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ie=F+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ie=z+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ie=Y+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ie=j+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ie=re+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ie=V+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ie=U+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ie=X+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ie=ye+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ie=_e+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ie=Ae+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=ye^j^M^B,Fe=ce<<1|ce>>>31,ie=Fe+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=_e^re^R^L,De=ce<<1|ce>>>31,ie=De+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Ae^V^N^M,qe=ce<<1|ce>>>31,ie=qe+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Fe^U^F^R,he=ce<<1|ce>>>31,ie=he+(H<<5|H>>>27)+le+(q&W|~q&ee)+1518500249|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=De^X^z^N,ue=ce<<1|ce>>>31,ie=ue+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=qe^ye^Y^F,pe=ce<<1|ce>>>31,ie=pe+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=he^_e^j^z,de=ce<<1|ce>>>31,ie=de+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=ue^Ae^re^Y,fe=ce<<1|ce>>>31,ie=fe+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=pe^Fe^V^j,ge=ce<<1|ce>>>31,ie=ge+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=de^De^U^re,se=ce<<1|ce>>>31,ie=se+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=fe^qe^X^V,te=ce<<1|ce>>>31,ie=te+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=ge^he^ye^U,Ne=ce<<1|ce>>>31,ie=Ne+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=se^ue^_e^X,Ve=ce<<1|ce>>>31,ie=Ve+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=te^pe^Ae^ye,Je=ce<<1|ce>>>31,ie=Je+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Ne^de^Fe^_e,lt=ce<<1|ce>>>31,ie=lt+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Ve^fe^De^Ae,tt=ce<<1|ce>>>31,ie=tt+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Je^ge^qe^Fe,ve=ce<<1|ce>>>31,ie=ve+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=lt^se^he^De,Z=ce<<1|ce>>>31,ie=Z+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=tt^te^ue^qe,oe=ce<<1|ce>>>31,ie=oe+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=ve^Ne^pe^he,me=ce<<1|ce>>>31,ie=me+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Z^Ve^de^ue,xe=ce<<1|ce>>>31,ie=xe+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=oe^Je^fe^pe,Pe=ce<<1|ce>>>31,ie=Pe+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=me^lt^ge^de,ke=ce<<1|ce>>>31,ie=ke+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=xe^tt^se^fe,Oe=ce<<1|ce>>>31,ie=Oe+(H<<5|H>>>27)+le+(q^W^ee)+1859775393|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Pe^ve^te^ge,Ue=ce<<1|ce>>>31,ie=Ue+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=ke^Z^Ne^se,Ie=ce<<1|ce>>>31,ie=Ie+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Oe^oe^Ve^te,Re=ce<<1|ce>>>31,ie=Re+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Ue^me^Je^Ne,et=ce<<1|ce>>>31,ie=et+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Ie^xe^lt^Ve,we=ce<<1|ce>>>31,ie=we+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Re^Pe^tt^Je,Ce=ce<<1|ce>>>31,ie=Ce+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=et^ke^ve^lt,Be=ce<<1|ce>>>31,ie=Be+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=we^Oe^Z^tt,Le=ce<<1|ce>>>31,ie=Le+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Ce^Ue^oe^ve,Me=ce<<1|ce>>>31,ie=Me+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Be^Ie^me^Z,$=ce<<1|ce>>>31,ie=$+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Le^Re^xe^oe,J=ce<<1|ce>>>31,ie=J+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Me^et^Pe^me,Q=ce<<1|ce>>>31,ie=Q+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=$^we^ke^xe,K=ce<<1|ce>>>31,ie=K+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=J^Ce^Oe^Pe,ae=ce<<1|ce>>>31,ie=ae+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Q^Be^Ue^ke,Se=ce<<1|ce>>>31,ie=Se+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=K^Le^Ie^Oe,Te=ce<<1|ce>>>31,ie=Te+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=ae^Me^Re^Ue,Ke=ce<<1|ce>>>31,ie=Ke+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Se^$^et^Ie,Ge=ce<<1|ce>>>31,ie=Ge+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Te^J^we^Re,dt=ce<<1|ce>>>31,ie=dt+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Ke^Q^Ce^et,it=ce<<1|ce>>>31,ie=it+(H<<5|H>>>27)+le+(q&W|q&ee|W&ee)-1894007588|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Ge^K^Be^we,Ct=ce<<1|ce>>>31,ie=Ct+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=dt^ae^Le^Ce,at=ce<<1|ce>>>31,ie=at+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=it^Se^Me^Be,vt=ce<<1|ce>>>31,ie=vt+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Ct^Te^$^Le,bt=ce<<1|ce>>>31,ie=bt+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=at^Ke^J^Me,St=ce<<1|ce>>>31,ie=St+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=vt^Ge^Q^$,At=ce<<1|ce>>>31,ie=At+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=bt^dt^K^J,_t=ce<<1|ce>>>31,ie=_t+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=St^it^ae^Q,Et=ce<<1|ce>>>31,ie=Et+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=At^Ct^Se^K,wt=ce<<1|ce>>>31,ie=wt+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=_t^at^Te^ae,ut=ce<<1|ce>>>31,ie=ut+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=Et^vt^Ke^Se,ht=ce<<1|ce>>>31,ie=ht+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=wt^bt^Ge^Te,st=ce<<1|ce>>>31,ie=st+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=ut^St^dt^Ke,ft=ce<<1|ce>>>31,ie=ft+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=ht^At^it^Ge,pt=ce<<1|ce>>>31,ie=pt+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=st^_t^Ct^dt,ct=ce<<1|ce>>>31,ie=ct+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=ft^Et^at^it,je=ce<<1|ce>>>31,ie=je+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=pt^wt^vt^Ct,$e=ce<<1|ce>>>31,ie=$e+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=ct^ut^bt^at,Ye=ce<<1|ce>>>31,ie=Ye+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=je^ht^St^vt,ze=ce<<1|ce>>>31,ie=ze+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,ce=$e^st^At^bt,We=ce<<1|ce>>>31,ie=We+(H<<5|H>>>27)+le+(q^W^ee)-899497514|0,le=ee,ee=W,W=q<<30|q>>>2,q=H,H=ie,n=n+H|0,s=s+q|0,i=i+W|0,o=o+ee|0,a=a+le|0}function I(B){B=B|0,C(_[B|0]<<24|_[B|1]<<16|_[B|2]<<8|_[B|3],_[B|4]<<24|_[B|5]<<16|_[B|6]<<8|_[B|7],_[B|8]<<24|_[B|9]<<16|_[B|10]<<8|_[B|11],_[B|12]<<24|_[B|13]<<16|_[B|14]<<8|_[B|15],_[B|16]<<24|_[B|17]<<16|_[B|18]<<8|_[B|19],_[B|20]<<24|_[B|21]<<16|_[B|22]<<8|_[B|23],_[B|24]<<24|_[B|25]<<16|_[B|26]<<8|_[B|27],_[B|28]<<24|_[B|29]<<16|_[B|30]<<8|_[B|31],_[B|32]<<24|_[B|33]<<16|_[B|34]<<8|_[B|35],_[B|36]<<24|_[B|37]<<16|_[B|38]<<8|_[B|39],_[B|40]<<24|_[B|41]<<16|_[B|42]<<8|_[B|43],_[B|44]<<24|_[B|45]<<16|_[B|46]<<8|_[B|47],_[B|48]<<24|_[B|49]<<16|_[B|50]<<8|_[B|51],_[B|52]<<24|_[B|53]<<16|_[B|54]<<8|_[B|55],_[B|56]<<24|_[B|57]<<16|_[B|58]<<8|_[B|59],_[B|60]<<24|_[B|61]<<16|_[B|62]<<8|_[B|63])}function k(B){B=B|0,_[B|0]=n>>>24,_[B|1]=n>>>16&255,_[B|2]=n>>>8&255,_[B|3]=n&255,_[B|4]=s>>>24,_[B|5]=s>>>16&255,_[B|6]=s>>>8&255,_[B|7]=s&255,_[B|8]=i>>>24,_[B|9]=i>>>16&255,_[B|10]=i>>>8&255,_[B|11]=i&255,_[B|12]=o>>>24,_[B|13]=o>>>16&255,_[B|14]=o>>>8&255,_[B|15]=o&255,_[B|16]=a>>>24,_[B|17]=a>>>16&255,_[B|18]=a>>>8&255,_[B|19]=a&255}function E(){n=1732584193,s=4023233417,i=2562383102,o=271733878,a=3285377520,f=c=0}function S(B,L,M,R,N,F,z){B=B|0,L=L|0,M=M|0,R=R|0,N=N|0,F=F|0,z=z|0,n=B,s=L,i=M,o=R,a=N,f=F,c=z}function T(B,L){B=B|0,L=L|0;var M=0;if(B&63)return-1;for(;(L|0)>=64;)I(B),B=B+64|0,L=L-64|0,M=M+64|0;return f=f+M|0,f>>>0<M>>>0&&(c=c+1|0),M|0}function P(B,L,M){B=B|0,L=L|0,M=M|0;var R=0,N=0;if(B&63||~M&&M&31)return-1;if((L|0)>=64){if(R=T(B,L)|0,(R|0)==-1)return-1;B=B+R|0,L=L-R|0}if(R=R+L|0,f=f+L|0,f>>>0<L>>>0&&(c=c+1|0),_[B|L]=128,(L|0)>=56){for(N=L+1|0;(N|0)<64;N=N+1|0)_[B|N]=0;I(B),L=0,_[B|0]=0}for(N=L+1|0;(N|0)<59;N=N+1|0)_[B|N]=0;return _[B|56]=c>>>21&255,_[B|57]=c>>>13&255,_[B|58]=c>>>5&255,_[B|59]=c<<3&255|f>>>29,_[B|60]=f>>>21&255,_[B|61]=f>>>13&255,_[B|62]=f>>>5&255,_[B|63]=f<<3&255,I(B),~M&&k(M),R|0}function g(){n=l,s=u,i=p,o=d,a=h,f=64,c=0}function A(){n=y,s=m,i=v,o=b,a=w,f=64,c=0}function x(B,L,M,R,N,F,z,Y,j,re,V,U,X,ye,_e,Ae){B=B|0,L=L|0,M=M|0,R=R|0,N=N|0,F=F|0,z=z|0,Y=Y|0,j=j|0,re=re|0,V=V|0,U=U|0,X=X|0,ye=ye|0,_e=_e|0,Ae=Ae|0,E(),C(B^1549556828,L^1549556828,M^1549556828,R^1549556828,N^1549556828,F^1549556828,z^1549556828,Y^1549556828,j^1549556828,re^1549556828,V^1549556828,U^1549556828,X^1549556828,ye^1549556828,_e^1549556828,Ae^1549556828),y=n,m=s,v=i,b=o,w=a,E(),C(B^909522486,L^909522486,M^909522486,R^909522486,N^909522486,F^909522486,z^909522486,Y^909522486,j^909522486,re^909522486,V^909522486,U^909522486,X^909522486,ye^909522486,_e^909522486,Ae^909522486),l=n,u=s,p=i,d=o,h=a,f=64,c=0}function D(B,L,M){B=B|0,L=L|0,M=M|0;var R=0,N=0,F=0,z=0,Y=0,j=0;return B&63||~M&&M&31?-1:(j=P(B,L,-1)|0,R=n,N=s,F=i,z=o,Y=a,A(),C(R,N,F,z,Y,2147483648,0,0,0,0,0,0,0,0,0,672),~M&&k(M),j|0)}function O(B,L,M,R,N){B=B|0,L=L|0,M=M|0,R=R|0,N=N|0;var F=0,z=0,Y=0,j=0,re=0,V=0,U=0,X=0,ye=0,_e=0;if(B&63||~N&&N&31)return-1;for(_[B+L|0]=M>>>24,_[B+L+1|0]=M>>>16&255,_[B+L+2|0]=M>>>8&255,_[B+L+3|0]=M&255,D(B,L+4|0,-1)|0,F=V=n,z=U=s,Y=X=i,j=ye=o,re=_e=a,R=R-1|0;(R|0)>0;)g(),C(V,U,X,ye,_e,2147483648,0,0,0,0,0,0,0,0,0,672),V=n,U=s,X=i,ye=o,_e=a,A(),C(V,U,X,ye,_e,2147483648,0,0,0,0,0,0,0,0,0,672),V=n,U=s,X=i,ye=o,_e=a,F=F^n,z=z^s,Y=Y^i,j=j^o,re=re^a,R=R-1|0;return n=F,s=z,i=Y,o=j,a=re,~N&&k(N),0}return{reset:E,init:S,process:T,finish:P,hmac_reset:g,hmac_init:x,hmac_finish:D,pbkdf2_generate_block:O}};class M9{constructor(){this.pos=0,this.len=0}reset(){const{asm:t}=this.acquire_asm();return this.result=null,this.pos=0,this.len=0,t.reset(),this}process(t){if(this.result!==null)throw new cy("state must be reset before processing new data");const{asm:r,heap:n}=this.acquire_asm();let s=this.pos,i=this.len,o=0,a=t.length,f=0;for(;a>0;)f=va(n,s+i,t,o,a),i+=f,o+=f,a-=f,f=r.process(s,i),s+=f,i-=f,i||(s=0);return this.pos=s,this.len=i,this}finish(){if(this.result!==null)throw new cy("state must be reset before processing new data");const{asm:t,heap:r}=this.acquire_asm();return t.finish(this.pos,this.len,0),this.result=new Uint8Array(this.HASH_SIZE),this.result.set(r.subarray(0,this.HASH_SIZE)),this.pos=0,this.len=0,this.release_asm(),this}}const k3=[],R3=[];class ba extends M9{constructor(){super(),this.NAME="sha1",this.BLOCK_SIZE=64,this.HASH_SIZE=20,this.acquire_asm()}acquire_asm(){return this.heap!==void 0&&this.asm!==void 0||(this.heap=k3.pop()||ag(),this.asm=R3.pop()||O9({Uint8Array},null,this.heap.buffer),this.reset()),{heap:this.heap,asm:this.asm}}release_asm(){this.heap!==void 0&&this.asm!==void 0&&(k3.push(this.heap),R3.push(this.asm)),this.heap=void 0,this.asm=void 0}static bytes(t){return new ba().process(t).finish().result}}ba.NAME="sha1",ba.heap_pool=[],ba.asm_pool=[],ba.asm_function=O9;const D3=[],B3=[];class Af extends M9{constructor(){super(),this.NAME="sha256",this.BLOCK_SIZE=64,this.HASH_SIZE=32,this.acquire_asm()}acquire_asm(){return this.heap!==void 0&&this.asm!==void 0||(this.heap=D3.pop()||ag(),this.asm=B3.pop()||function(t,r,n){var s=0,i=0,o=0,a=0,f=0,c=0,l=0,u=0,p=0,d=0,h=0,y=0,m=0,v=0,b=0,w=0,_=0,C=0,I=0,k=0,E=0,S=0,T=0,P=0,g=0,A=0,x=new t.Uint8Array(n);function D(V,U,X,ye,_e,Ae,H,q,W,ee,le,ce,ie,Fe,De,qe){V=V|0,U=U|0,X=X|0,ye=ye|0,_e=_e|0,Ae=Ae|0,H=H|0,q=q|0,W=W|0,ee=ee|0,le=le|0,ce=ce|0,ie=ie|0,Fe=Fe|0,De=De|0,qe=qe|0;var he=0,ue=0,pe=0,de=0,fe=0,ge=0,se=0,te=0;he=s,ue=i,pe=o,de=a,fe=f,ge=c,se=l,te=u,te=V+te+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(se^fe&(ge^se))+1116352408|0,de=de+te|0,te=te+(he&ue^pe&(he^ue))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,se=U+se+(de>>>6^de>>>11^de>>>25^de<<26^de<<21^de<<7)+(ge^de&(fe^ge))+1899447441|0,pe=pe+se|0,se=se+(te&he^ue&(te^he))+(te>>>2^te>>>13^te>>>22^te<<30^te<<19^te<<10)|0,ge=X+ge+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(de^fe))+3049323471|0,ue=ue+ge|0,ge=ge+(se&te^he&(se^te))+(se>>>2^se>>>13^se>>>22^se<<30^se<<19^se<<10)|0,fe=ye+fe+(ue>>>6^ue>>>11^ue>>>25^ue<<26^ue<<21^ue<<7)+(de^ue&(pe^de))+3921009573|0,he=he+fe|0,fe=fe+(ge&se^te&(ge^se))+(ge>>>2^ge>>>13^ge>>>22^ge<<30^ge<<19^ge<<10)|0,de=_e+de+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ue^pe))+961987163|0,te=te+de|0,de=de+(fe&ge^se&(fe^ge))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,pe=Ae+pe+(te>>>6^te>>>11^te>>>25^te<<26^te<<21^te<<7)+(ue^te&(he^ue))+1508970993|0,se=se+pe|0,pe=pe+(de&fe^ge&(de^fe))+(de>>>2^de>>>13^de>>>22^de<<30^de<<19^de<<10)|0,ue=H+ue+(se>>>6^se>>>11^se>>>25^se<<26^se<<21^se<<7)+(he^se&(te^he))+2453635748|0,ge=ge+ue|0,ue=ue+(pe&de^fe&(pe^de))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,he=q+he+(ge>>>6^ge>>>11^ge>>>25^ge<<26^ge<<21^ge<<7)+(te^ge&(se^te))+2870763221|0,fe=fe+he|0,he=he+(ue&pe^de&(ue^pe))+(ue>>>2^ue>>>13^ue>>>22^ue<<30^ue<<19^ue<<10)|0,te=W+te+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(se^fe&(ge^se))+3624381080|0,de=de+te|0,te=te+(he&ue^pe&(he^ue))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,se=ee+se+(de>>>6^de>>>11^de>>>25^de<<26^de<<21^de<<7)+(ge^de&(fe^ge))+310598401|0,pe=pe+se|0,se=se+(te&he^ue&(te^he))+(te>>>2^te>>>13^te>>>22^te<<30^te<<19^te<<10)|0,ge=le+ge+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(de^fe))+607225278|0,ue=ue+ge|0,ge=ge+(se&te^he&(se^te))+(se>>>2^se>>>13^se>>>22^se<<30^se<<19^se<<10)|0,fe=ce+fe+(ue>>>6^ue>>>11^ue>>>25^ue<<26^ue<<21^ue<<7)+(de^ue&(pe^de))+1426881987|0,he=he+fe|0,fe=fe+(ge&se^te&(ge^se))+(ge>>>2^ge>>>13^ge>>>22^ge<<30^ge<<19^ge<<10)|0,de=ie+de+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ue^pe))+1925078388|0,te=te+de|0,de=de+(fe&ge^se&(fe^ge))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,pe=Fe+pe+(te>>>6^te>>>11^te>>>25^te<<26^te<<21^te<<7)+(ue^te&(he^ue))+2162078206|0,se=se+pe|0,pe=pe+(de&fe^ge&(de^fe))+(de>>>2^de>>>13^de>>>22^de<<30^de<<19^de<<10)|0,ue=De+ue+(se>>>6^se>>>11^se>>>25^se<<26^se<<21^se<<7)+(he^se&(te^he))+2614888103|0,ge=ge+ue|0,ue=ue+(pe&de^fe&(pe^de))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,he=qe+he+(ge>>>6^ge>>>11^ge>>>25^ge<<26^ge<<21^ge<<7)+(te^ge&(se^te))+3248222580|0,fe=fe+he|0,he=he+(ue&pe^de&(ue^pe))+(ue>>>2^ue>>>13^ue>>>22^ue<<30^ue<<19^ue<<10)|0,V=(U>>>7^U>>>18^U>>>3^U<<25^U<<14)+(De>>>17^De>>>19^De>>>10^De<<15^De<<13)+V+ee|0,te=V+te+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(se^fe&(ge^se))+3835390401|0,de=de+te|0,te=te+(he&ue^pe&(he^ue))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,U=(X>>>7^X>>>18^X>>>3^X<<25^X<<14)+(qe>>>17^qe>>>19^qe>>>10^qe<<15^qe<<13)+U+le|0,se=U+se+(de>>>6^de>>>11^de>>>25^de<<26^de<<21^de<<7)+(ge^de&(fe^ge))+4022224774|0,pe=pe+se|0,se=se+(te&he^ue&(te^he))+(te>>>2^te>>>13^te>>>22^te<<30^te<<19^te<<10)|0,X=(ye>>>7^ye>>>18^ye>>>3^ye<<25^ye<<14)+(V>>>17^V>>>19^V>>>10^V<<15^V<<13)+X+ce|0,ge=X+ge+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(de^fe))+264347078|0,ue=ue+ge|0,ge=ge+(se&te^he&(se^te))+(se>>>2^se>>>13^se>>>22^se<<30^se<<19^se<<10)|0,ye=(_e>>>7^_e>>>18^_e>>>3^_e<<25^_e<<14)+(U>>>17^U>>>19^U>>>10^U<<15^U<<13)+ye+ie|0,fe=ye+fe+(ue>>>6^ue>>>11^ue>>>25^ue<<26^ue<<21^ue<<7)+(de^ue&(pe^de))+604807628|0,he=he+fe|0,fe=fe+(ge&se^te&(ge^se))+(ge>>>2^ge>>>13^ge>>>22^ge<<30^ge<<19^ge<<10)|0,_e=(Ae>>>7^Ae>>>18^Ae>>>3^Ae<<25^Ae<<14)+(X>>>17^X>>>19^X>>>10^X<<15^X<<13)+_e+Fe|0,de=_e+de+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ue^pe))+770255983|0,te=te+de|0,de=de+(fe&ge^se&(fe^ge))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,Ae=(H>>>7^H>>>18^H>>>3^H<<25^H<<14)+(ye>>>17^ye>>>19^ye>>>10^ye<<15^ye<<13)+Ae+De|0,pe=Ae+pe+(te>>>6^te>>>11^te>>>25^te<<26^te<<21^te<<7)+(ue^te&(he^ue))+1249150122|0,se=se+pe|0,pe=pe+(de&fe^ge&(de^fe))+(de>>>2^de>>>13^de>>>22^de<<30^de<<19^de<<10)|0,H=(q>>>7^q>>>18^q>>>3^q<<25^q<<14)+(_e>>>17^_e>>>19^_e>>>10^_e<<15^_e<<13)+H+qe|0,ue=H+ue+(se>>>6^se>>>11^se>>>25^se<<26^se<<21^se<<7)+(he^se&(te^he))+1555081692|0,ge=ge+ue|0,ue=ue+(pe&de^fe&(pe^de))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,q=(W>>>7^W>>>18^W>>>3^W<<25^W<<14)+(Ae>>>17^Ae>>>19^Ae>>>10^Ae<<15^Ae<<13)+q+V|0,he=q+he+(ge>>>6^ge>>>11^ge>>>25^ge<<26^ge<<21^ge<<7)+(te^ge&(se^te))+1996064986|0,fe=fe+he|0,he=he+(ue&pe^de&(ue^pe))+(ue>>>2^ue>>>13^ue>>>22^ue<<30^ue<<19^ue<<10)|0,W=(ee>>>7^ee>>>18^ee>>>3^ee<<25^ee<<14)+(H>>>17^H>>>19^H>>>10^H<<15^H<<13)+W+U|0,te=W+te+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(se^fe&(ge^se))+2554220882|0,de=de+te|0,te=te+(he&ue^pe&(he^ue))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,ee=(le>>>7^le>>>18^le>>>3^le<<25^le<<14)+(q>>>17^q>>>19^q>>>10^q<<15^q<<13)+ee+X|0,se=ee+se+(de>>>6^de>>>11^de>>>25^de<<26^de<<21^de<<7)+(ge^de&(fe^ge))+2821834349|0,pe=pe+se|0,se=se+(te&he^ue&(te^he))+(te>>>2^te>>>13^te>>>22^te<<30^te<<19^te<<10)|0,le=(ce>>>7^ce>>>18^ce>>>3^ce<<25^ce<<14)+(W>>>17^W>>>19^W>>>10^W<<15^W<<13)+le+ye|0,ge=le+ge+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(de^fe))+2952996808|0,ue=ue+ge|0,ge=ge+(se&te^he&(se^te))+(se>>>2^se>>>13^se>>>22^se<<30^se<<19^se<<10)|0,ce=(ie>>>7^ie>>>18^ie>>>3^ie<<25^ie<<14)+(ee>>>17^ee>>>19^ee>>>10^ee<<15^ee<<13)+ce+_e|0,fe=ce+fe+(ue>>>6^ue>>>11^ue>>>25^ue<<26^ue<<21^ue<<7)+(de^ue&(pe^de))+3210313671|0,he=he+fe|0,fe=fe+(ge&se^te&(ge^se))+(ge>>>2^ge>>>13^ge>>>22^ge<<30^ge<<19^ge<<10)|0,ie=(Fe>>>7^Fe>>>18^Fe>>>3^Fe<<25^Fe<<14)+(le>>>17^le>>>19^le>>>10^le<<15^le<<13)+ie+Ae|0,de=ie+de+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ue^pe))+3336571891|0,te=te+de|0,de=de+(fe&ge^se&(fe^ge))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,Fe=(De>>>7^De>>>18^De>>>3^De<<25^De<<14)+(ce>>>17^ce>>>19^ce>>>10^ce<<15^ce<<13)+Fe+H|0,pe=Fe+pe+(te>>>6^te>>>11^te>>>25^te<<26^te<<21^te<<7)+(ue^te&(he^ue))+3584528711|0,se=se+pe|0,pe=pe+(de&fe^ge&(de^fe))+(de>>>2^de>>>13^de>>>22^de<<30^de<<19^de<<10)|0,De=(qe>>>7^qe>>>18^qe>>>3^qe<<25^qe<<14)+(ie>>>17^ie>>>19^ie>>>10^ie<<15^ie<<13)+De+q|0,ue=De+ue+(se>>>6^se>>>11^se>>>25^se<<26^se<<21^se<<7)+(he^se&(te^he))+113926993|0,ge=ge+ue|0,ue=ue+(pe&de^fe&(pe^de))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,qe=(V>>>7^V>>>18^V>>>3^V<<25^V<<14)+(Fe>>>17^Fe>>>19^Fe>>>10^Fe<<15^Fe<<13)+qe+W|0,he=qe+he+(ge>>>6^ge>>>11^ge>>>25^ge<<26^ge<<21^ge<<7)+(te^ge&(se^te))+338241895|0,fe=fe+he|0,he=he+(ue&pe^de&(ue^pe))+(ue>>>2^ue>>>13^ue>>>22^ue<<30^ue<<19^ue<<10)|0,V=(U>>>7^U>>>18^U>>>3^U<<25^U<<14)+(De>>>17^De>>>19^De>>>10^De<<15^De<<13)+V+ee|0,te=V+te+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(se^fe&(ge^se))+666307205|0,de=de+te|0,te=te+(he&ue^pe&(he^ue))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,U=(X>>>7^X>>>18^X>>>3^X<<25^X<<14)+(qe>>>17^qe>>>19^qe>>>10^qe<<15^qe<<13)+U+le|0,se=U+se+(de>>>6^de>>>11^de>>>25^de<<26^de<<21^de<<7)+(ge^de&(fe^ge))+773529912|0,pe=pe+se|0,se=se+(te&he^ue&(te^he))+(te>>>2^te>>>13^te>>>22^te<<30^te<<19^te<<10)|0,X=(ye>>>7^ye>>>18^ye>>>3^ye<<25^ye<<14)+(V>>>17^V>>>19^V>>>10^V<<15^V<<13)+X+ce|0,ge=X+ge+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(de^fe))+1294757372|0,ue=ue+ge|0,ge=ge+(se&te^he&(se^te))+(se>>>2^se>>>13^se>>>22^se<<30^se<<19^se<<10)|0,ye=(_e>>>7^_e>>>18^_e>>>3^_e<<25^_e<<14)+(U>>>17^U>>>19^U>>>10^U<<15^U<<13)+ye+ie|0,fe=ye+fe+(ue>>>6^ue>>>11^ue>>>25^ue<<26^ue<<21^ue<<7)+(de^ue&(pe^de))+1396182291|0,he=he+fe|0,fe=fe+(ge&se^te&(ge^se))+(ge>>>2^ge>>>13^ge>>>22^ge<<30^ge<<19^ge<<10)|0,_e=(Ae>>>7^Ae>>>18^Ae>>>3^Ae<<25^Ae<<14)+(X>>>17^X>>>19^X>>>10^X<<15^X<<13)+_e+Fe|0,de=_e+de+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ue^pe))+1695183700|0,te=te+de|0,de=de+(fe&ge^se&(fe^ge))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,Ae=(H>>>7^H>>>18^H>>>3^H<<25^H<<14)+(ye>>>17^ye>>>19^ye>>>10^ye<<15^ye<<13)+Ae+De|0,pe=Ae+pe+(te>>>6^te>>>11^te>>>25^te<<26^te<<21^te<<7)+(ue^te&(he^ue))+1986661051|0,se=se+pe|0,pe=pe+(de&fe^ge&(de^fe))+(de>>>2^de>>>13^de>>>22^de<<30^de<<19^de<<10)|0,H=(q>>>7^q>>>18^q>>>3^q<<25^q<<14)+(_e>>>17^_e>>>19^_e>>>10^_e<<15^_e<<13)+H+qe|0,ue=H+ue+(se>>>6^se>>>11^se>>>25^se<<26^se<<21^se<<7)+(he^se&(te^he))+2177026350|0,ge=ge+ue|0,ue=ue+(pe&de^fe&(pe^de))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,q=(W>>>7^W>>>18^W>>>3^W<<25^W<<14)+(Ae>>>17^Ae>>>19^Ae>>>10^Ae<<15^Ae<<13)+q+V|0,he=q+he+(ge>>>6^ge>>>11^ge>>>25^ge<<26^ge<<21^ge<<7)+(te^ge&(se^te))+2456956037|0,fe=fe+he|0,he=he+(ue&pe^de&(ue^pe))+(ue>>>2^ue>>>13^ue>>>22^ue<<30^ue<<19^ue<<10)|0,W=(ee>>>7^ee>>>18^ee>>>3^ee<<25^ee<<14)+(H>>>17^H>>>19^H>>>10^H<<15^H<<13)+W+U|0,te=W+te+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(se^fe&(ge^se))+2730485921|0,de=de+te|0,te=te+(he&ue^pe&(he^ue))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,ee=(le>>>7^le>>>18^le>>>3^le<<25^le<<14)+(q>>>17^q>>>19^q>>>10^q<<15^q<<13)+ee+X|0,se=ee+se+(de>>>6^de>>>11^de>>>25^de<<26^de<<21^de<<7)+(ge^de&(fe^ge))+2820302411|0,pe=pe+se|0,se=se+(te&he^ue&(te^he))+(te>>>2^te>>>13^te>>>22^te<<30^te<<19^te<<10)|0,le=(ce>>>7^ce>>>18^ce>>>3^ce<<25^ce<<14)+(W>>>17^W>>>19^W>>>10^W<<15^W<<13)+le+ye|0,ge=le+ge+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(de^fe))+3259730800|0,ue=ue+ge|0,ge=ge+(se&te^he&(se^te))+(se>>>2^se>>>13^se>>>22^se<<30^se<<19^se<<10)|0,ce=(ie>>>7^ie>>>18^ie>>>3^ie<<25^ie<<14)+(ee>>>17^ee>>>19^ee>>>10^ee<<15^ee<<13)+ce+_e|0,fe=ce+fe+(ue>>>6^ue>>>11^ue>>>25^ue<<26^ue<<21^ue<<7)+(de^ue&(pe^de))+3345764771|0,he=he+fe|0,fe=fe+(ge&se^te&(ge^se))+(ge>>>2^ge>>>13^ge>>>22^ge<<30^ge<<19^ge<<10)|0,ie=(Fe>>>7^Fe>>>18^Fe>>>3^Fe<<25^Fe<<14)+(le>>>17^le>>>19^le>>>10^le<<15^le<<13)+ie+Ae|0,de=ie+de+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ue^pe))+3516065817|0,te=te+de|0,de=de+(fe&ge^se&(fe^ge))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,Fe=(De>>>7^De>>>18^De>>>3^De<<25^De<<14)+(ce>>>17^ce>>>19^ce>>>10^ce<<15^ce<<13)+Fe+H|0,pe=Fe+pe+(te>>>6^te>>>11^te>>>25^te<<26^te<<21^te<<7)+(ue^te&(he^ue))+3600352804|0,se=se+pe|0,pe=pe+(de&fe^ge&(de^fe))+(de>>>2^de>>>13^de>>>22^de<<30^de<<19^de<<10)|0,De=(qe>>>7^qe>>>18^qe>>>3^qe<<25^qe<<14)+(ie>>>17^ie>>>19^ie>>>10^ie<<15^ie<<13)+De+q|0,ue=De+ue+(se>>>6^se>>>11^se>>>25^se<<26^se<<21^se<<7)+(he^se&(te^he))+4094571909|0,ge=ge+ue|0,ue=ue+(pe&de^fe&(pe^de))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,qe=(V>>>7^V>>>18^V>>>3^V<<25^V<<14)+(Fe>>>17^Fe>>>19^Fe>>>10^Fe<<15^Fe<<13)+qe+W|0,he=qe+he+(ge>>>6^ge>>>11^ge>>>25^ge<<26^ge<<21^ge<<7)+(te^ge&(se^te))+275423344|0,fe=fe+he|0,he=he+(ue&pe^de&(ue^pe))+(ue>>>2^ue>>>13^ue>>>22^ue<<30^ue<<19^ue<<10)|0,V=(U>>>7^U>>>18^U>>>3^U<<25^U<<14)+(De>>>17^De>>>19^De>>>10^De<<15^De<<13)+V+ee|0,te=V+te+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(se^fe&(ge^se))+430227734|0,de=de+te|0,te=te+(he&ue^pe&(he^ue))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,U=(X>>>7^X>>>18^X>>>3^X<<25^X<<14)+(qe>>>17^qe>>>19^qe>>>10^qe<<15^qe<<13)+U+le|0,se=U+se+(de>>>6^de>>>11^de>>>25^de<<26^de<<21^de<<7)+(ge^de&(fe^ge))+506948616|0,pe=pe+se|0,se=se+(te&he^ue&(te^he))+(te>>>2^te>>>13^te>>>22^te<<30^te<<19^te<<10)|0,X=(ye>>>7^ye>>>18^ye>>>3^ye<<25^ye<<14)+(V>>>17^V>>>19^V>>>10^V<<15^V<<13)+X+ce|0,ge=X+ge+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(de^fe))+659060556|0,ue=ue+ge|0,ge=ge+(se&te^he&(se^te))+(se>>>2^se>>>13^se>>>22^se<<30^se<<19^se<<10)|0,ye=(_e>>>7^_e>>>18^_e>>>3^_e<<25^_e<<14)+(U>>>17^U>>>19^U>>>10^U<<15^U<<13)+ye+ie|0,fe=ye+fe+(ue>>>6^ue>>>11^ue>>>25^ue<<26^ue<<21^ue<<7)+(de^ue&(pe^de))+883997877|0,he=he+fe|0,fe=fe+(ge&se^te&(ge^se))+(ge>>>2^ge>>>13^ge>>>22^ge<<30^ge<<19^ge<<10)|0,_e=(Ae>>>7^Ae>>>18^Ae>>>3^Ae<<25^Ae<<14)+(X>>>17^X>>>19^X>>>10^X<<15^X<<13)+_e+Fe|0,de=_e+de+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ue^pe))+958139571|0,te=te+de|0,de=de+(fe&ge^se&(fe^ge))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,Ae=(H>>>7^H>>>18^H>>>3^H<<25^H<<14)+(ye>>>17^ye>>>19^ye>>>10^ye<<15^ye<<13)+Ae+De|0,pe=Ae+pe+(te>>>6^te>>>11^te>>>25^te<<26^te<<21^te<<7)+(ue^te&(he^ue))+1322822218|0,se=se+pe|0,pe=pe+(de&fe^ge&(de^fe))+(de>>>2^de>>>13^de>>>22^de<<30^de<<19^de<<10)|0,H=(q>>>7^q>>>18^q>>>3^q<<25^q<<14)+(_e>>>17^_e>>>19^_e>>>10^_e<<15^_e<<13)+H+qe|0,ue=H+ue+(se>>>6^se>>>11^se>>>25^se<<26^se<<21^se<<7)+(he^se&(te^he))+1537002063|0,ge=ge+ue|0,ue=ue+(pe&de^fe&(pe^de))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,q=(W>>>7^W>>>18^W>>>3^W<<25^W<<14)+(Ae>>>17^Ae>>>19^Ae>>>10^Ae<<15^Ae<<13)+q+V|0,he=q+he+(ge>>>6^ge>>>11^ge>>>25^ge<<26^ge<<21^ge<<7)+(te^ge&(se^te))+1747873779|0,fe=fe+he|0,he=he+(ue&pe^de&(ue^pe))+(ue>>>2^ue>>>13^ue>>>22^ue<<30^ue<<19^ue<<10)|0,W=(ee>>>7^ee>>>18^ee>>>3^ee<<25^ee<<14)+(H>>>17^H>>>19^H>>>10^H<<15^H<<13)+W+U|0,te=W+te+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(se^fe&(ge^se))+1955562222|0,de=de+te|0,te=te+(he&ue^pe&(he^ue))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,ee=(le>>>7^le>>>18^le>>>3^le<<25^le<<14)+(q>>>17^q>>>19^q>>>10^q<<15^q<<13)+ee+X|0,se=ee+se+(de>>>6^de>>>11^de>>>25^de<<26^de<<21^de<<7)+(ge^de&(fe^ge))+2024104815|0,pe=pe+se|0,se=se+(te&he^ue&(te^he))+(te>>>2^te>>>13^te>>>22^te<<30^te<<19^te<<10)|0,le=(ce>>>7^ce>>>18^ce>>>3^ce<<25^ce<<14)+(W>>>17^W>>>19^W>>>10^W<<15^W<<13)+le+ye|0,ge=le+ge+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(de^fe))+2227730452|0,ue=ue+ge|0,ge=ge+(se&te^he&(se^te))+(se>>>2^se>>>13^se>>>22^se<<30^se<<19^se<<10)|0,ce=(ie>>>7^ie>>>18^ie>>>3^ie<<25^ie<<14)+(ee>>>17^ee>>>19^ee>>>10^ee<<15^ee<<13)+ce+_e|0,fe=ce+fe+(ue>>>6^ue>>>11^ue>>>25^ue<<26^ue<<21^ue<<7)+(de^ue&(pe^de))+2361852424|0,he=he+fe|0,fe=fe+(ge&se^te&(ge^se))+(ge>>>2^ge>>>13^ge>>>22^ge<<30^ge<<19^ge<<10)|0,ie=(Fe>>>7^Fe>>>18^Fe>>>3^Fe<<25^Fe<<14)+(le>>>17^le>>>19^le>>>10^le<<15^le<<13)+ie+Ae|0,de=ie+de+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ue^pe))+2428436474|0,te=te+de|0,de=de+(fe&ge^se&(fe^ge))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,Fe=(De>>>7^De>>>18^De>>>3^De<<25^De<<14)+(ce>>>17^ce>>>19^ce>>>10^ce<<15^ce<<13)+Fe+H|0,pe=Fe+pe+(te>>>6^te>>>11^te>>>25^te<<26^te<<21^te<<7)+(ue^te&(he^ue))+2756734187|0,se=se+pe|0,pe=pe+(de&fe^ge&(de^fe))+(de>>>2^de>>>13^de>>>22^de<<30^de<<19^de<<10)|0,De=(qe>>>7^qe>>>18^qe>>>3^qe<<25^qe<<14)+(ie>>>17^ie>>>19^ie>>>10^ie<<15^ie<<13)+De+q|0,ue=De+ue+(se>>>6^se>>>11^se>>>25^se<<26^se<<21^se<<7)+(he^se&(te^he))+3204031479|0,ge=ge+ue|0,ue=ue+(pe&de^fe&(pe^de))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,qe=(V>>>7^V>>>18^V>>>3^V<<25^V<<14)+(Fe>>>17^Fe>>>19^Fe>>>10^Fe<<15^Fe<<13)+qe+W|0,he=qe+he+(ge>>>6^ge>>>11^ge>>>25^ge<<26^ge<<21^ge<<7)+(te^ge&(se^te))+3329325298|0,fe=fe+he|0,he=he+(ue&pe^de&(ue^pe))+(ue>>>2^ue>>>13^ue>>>22^ue<<30^ue<<19^ue<<10)|0,s=s+he|0,i=i+ue|0,o=o+pe|0,a=a+de|0,f=f+fe|0,c=c+ge|0,l=l+se|0,u=u+te|0}function O(V){V=V|0,D(x[V|0]<<24|x[V|1]<<16|x[V|2]<<8|x[V|3],x[V|4]<<24|x[V|5]<<16|x[V|6]<<8|x[V|7],x[V|8]<<24|x[V|9]<<16|x[V|10]<<8|x[V|11],x[V|12]<<24|x[V|13]<<16|x[V|14]<<8|x[V|15],x[V|16]<<24|x[V|17]<<16|x[V|18]<<8|x[V|19],x[V|20]<<24|x[V|21]<<16|x[V|22]<<8|x[V|23],x[V|24]<<24|x[V|25]<<16|x[V|26]<<8|x[V|27],x[V|28]<<24|x[V|29]<<16|x[V|30]<<8|x[V|31],x[V|32]<<24|x[V|33]<<16|x[V|34]<<8|x[V|35],x[V|36]<<24|x[V|37]<<16|x[V|38]<<8|x[V|39],x[V|40]<<24|x[V|41]<<16|x[V|42]<<8|x[V|43],x[V|44]<<24|x[V|45]<<16|x[V|46]<<8|x[V|47],x[V|48]<<24|x[V|49]<<16|x[V|50]<<8|x[V|51],x[V|52]<<24|x[V|53]<<16|x[V|54]<<8|x[V|55],x[V|56]<<24|x[V|57]<<16|x[V|58]<<8|x[V|59],x[V|60]<<24|x[V|61]<<16|x[V|62]<<8|x[V|63])}function B(V){V=V|0,x[V|0]=s>>>24,x[V|1]=s>>>16&255,x[V|2]=s>>>8&255,x[V|3]=s&255,x[V|4]=i>>>24,x[V|5]=i>>>16&255,x[V|6]=i>>>8&255,x[V|7]=i&255,x[V|8]=o>>>24,x[V|9]=o>>>16&255,x[V|10]=o>>>8&255,x[V|11]=o&255,x[V|12]=a>>>24,x[V|13]=a>>>16&255,x[V|14]=a>>>8&255,x[V|15]=a&255,x[V|16]=f>>>24,x[V|17]=f>>>16&255,x[V|18]=f>>>8&255,x[V|19]=f&255,x[V|20]=c>>>24,x[V|21]=c>>>16&255,x[V|22]=c>>>8&255,x[V|23]=c&255,x[V|24]=l>>>24,x[V|25]=l>>>16&255,x[V|26]=l>>>8&255,x[V|27]=l&255,x[V|28]=u>>>24,x[V|29]=u>>>16&255,x[V|30]=u>>>8&255,x[V|31]=u&255}function L(){s=1779033703,i=3144134277,o=1013904242,a=2773480762,f=1359893119,c=2600822924,l=528734635,u=1541459225,p=d=0}function M(V,U,X,ye,_e,Ae,H,q,W,ee){V=V|0,U=U|0,X=X|0,ye=ye|0,_e=_e|0,Ae=Ae|0,H=H|0,q=q|0,W=W|0,ee=ee|0,s=V,i=U,o=X,a=ye,f=_e,c=Ae,l=H,u=q,p=W,d=ee}function R(V,U){V=V|0,U=U|0;var X=0;if(V&63)return-1;for(;(U|0)>=64;)O(V),V=V+64|0,U=U-64|0,X=X+64|0;return p=p+X|0,p>>>0<X>>>0&&(d=d+1|0),X|0}function N(V,U,X){V=V|0,U=U|0,X=X|0;var ye=0,_e=0;if(V&63||~X&&X&31)return-1;if((U|0)>=64){if(ye=R(V,U)|0,(ye|0)==-1)return-1;V=V+ye|0,U=U-ye|0}if(ye=ye+U|0,p=p+U|0,p>>>0<U>>>0&&(d=d+1|0),x[V|U]=128,(U|0)>=56){for(_e=U+1|0;(_e|0)<64;_e=_e+1|0)x[V|_e]=0;O(V),U=0,x[V|0]=0}for(_e=U+1|0;(_e|0)<59;_e=_e+1|0)x[V|_e]=0;return x[V|56]=d>>>21&255,x[V|57]=d>>>13&255,x[V|58]=d>>>5&255,x[V|59]=d<<3&255|p>>>29,x[V|60]=p>>>21&255,x[V|61]=p>>>13&255,x[V|62]=p>>>5&255,x[V|63]=p<<3&255,O(V),~X&&B(X),ye|0}function F(){s=h,i=y,o=m,a=v,f=b,c=w,l=_,u=C,p=64,d=0}function z(){s=I,i=k,o=E,a=S,f=T,c=P,l=g,u=A,p=64,d=0}function Y(V,U,X,ye,_e,Ae,H,q,W,ee,le,ce,ie,Fe,De,qe){V=V|0,U=U|0,X=X|0,ye=ye|0,_e=_e|0,Ae=Ae|0,H=H|0,q=q|0,W=W|0,ee=ee|0,le=le|0,ce=ce|0,ie=ie|0,Fe=Fe|0,De=De|0,qe=qe|0,L(),D(V^1549556828,U^1549556828,X^1549556828,ye^1549556828,_e^1549556828,Ae^1549556828,H^1549556828,q^1549556828,W^1549556828,ee^1549556828,le^1549556828,ce^1549556828,ie^1549556828,Fe^1549556828,De^1549556828,qe^1549556828),I=s,k=i,E=o,S=a,T=f,P=c,g=l,A=u,L(),D(V^909522486,U^909522486,X^909522486,ye^909522486,_e^909522486,Ae^909522486,H^909522486,q^909522486,W^909522486,ee^909522486,le^909522486,ce^909522486,ie^909522486,Fe^909522486,De^909522486,qe^909522486),h=s,y=i,m=o,v=a,b=f,w=c,_=l,C=u,p=64,d=0}function j(V,U,X){V=V|0,U=U|0,X=X|0;var ye=0,_e=0,Ae=0,H=0,q=0,W=0,ee=0,le=0,ce=0;return V&63||~X&&X&31?-1:(ce=N(V,U,-1)|0,ye=s,_e=i,Ae=o,H=a,q=f,W=c,ee=l,le=u,z(),D(ye,_e,Ae,H,q,W,ee,le,2147483648,0,0,0,0,0,0,768),~X&&B(X),ce|0)}function re(V,U,X,ye,_e){V=V|0,U=U|0,X=X|0,ye=ye|0,_e=_e|0;var Ae=0,H=0,q=0,W=0,ee=0,le=0,ce=0,ie=0,Fe=0,De=0,qe=0,he=0,ue=0,pe=0,de=0,fe=0;if(V&63||~_e&&_e&31)return-1;for(x[V+U|0]=X>>>24,x[V+U+1|0]=X>>>16&255,x[V+U+2|0]=X>>>8&255,x[V+U+3|0]=X&255,j(V,U+4|0,-1)|0,Ae=Fe=s,H=De=i,q=qe=o,W=he=a,ee=ue=f,le=pe=c,ce=de=l,ie=fe=u,ye=ye-1|0;(ye|0)>0;)F(),D(Fe,De,qe,he,ue,pe,de,fe,2147483648,0,0,0,0,0,0,768),Fe=s,De=i,qe=o,he=a,ue=f,pe=c,de=l,fe=u,z(),D(Fe,De,qe,he,ue,pe,de,fe,2147483648,0,0,0,0,0,0,768),Fe=s,De=i,qe=o,he=a,ue=f,pe=c,de=l,fe=u,Ae=Ae^s,H=H^i,q=q^o,W=W^a,ee=ee^f,le=le^c,ce=ce^l,ie=ie^u,ye=ye-1|0;return s=Ae,i=H,o=q,a=W,f=ee,c=le,l=ce,u=ie,~_e&&B(_e),0}return{reset:L,init:M,process:R,finish:N,hmac_reset:F,hmac_init:Y,hmac_finish:j,pbkdf2_generate_block:re}}({Uint8Array},null,this.heap.buffer),this.reset()),{heap:this.heap,asm:this.asm}}release_asm(){this.heap!==void 0&&this.asm!==void 0&&(D3.push(this.heap),B3.push(this.asm)),this.heap=void 0,this.asm=void 0}static bytes(t){return new Af().process(t).finish().result}}Af.NAME="sha256";var Ws=N9;function N9(e,t){if(!e)throw Error(t||"Assertion failed")}N9.equal=function(e,t,r){if(e!=t)throw Error(r||"Assertion failed: "+e+" != "+t)};var VK=Dn!==void 0?Dn:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ui(e,t){return e(t={exports:{}},t.exports),t.exports}function GK(){throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var Ls=Ui(function(e){e.exports=typeof Object.create=="function"?function(t,r){t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}}),zK=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(typeof e=="string")if(t){if(t==="hex")for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(var n=0;n<e.length;n++){var s=e.charCodeAt(n),i=s>>8,o=255&s;i?r.push(i,o):r.push(o)}else for(n=0;n<e.length;n++)r[n]=0|e[n];return r},WK=function(e){for(var t="",r=0;r<e.length;r++)t+=L9(e[r].toString(16));return t};function U9(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}var YK=function(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];t==="little"&&(s=U9(s)),r+=K9(s.toString(16))}return r};function L9(e){return e.length===1?"0"+e:e}function K9(e){return e.length===7?"0"+e:e.length===6?"00"+e:e.length===5?"000"+e:e.length===4?"0000"+e:e.length===3?"00000"+e:e.length===2?"000000"+e:e.length===1?"0000000"+e:e}var ZK=function(e,t,r,n){var s=r-t;Ws(s%4==0);for(var i=Array(s/4),o=0,a=t;o<i.length;o++,a+=4){var f;f=n==="big"?e[a]<<24|e[a+1]<<16|e[a+2]<<8|e[a+3]:e[a+3]<<24|e[a+2]<<16|e[a+1]<<8|e[a],i[o]=f>>>0}return i},JK=function(e,t){for(var r=Array(4*e.length),n=0,s=0;n<e.length;n++,s+=4){var i=e[n];t==="big"?(r[s]=i>>>24,r[s+1]=i>>>16&255,r[s+2]=i>>>8&255,r[s+3]=255&i):(r[s+3]=i>>>24,r[s+2]=i>>>16&255,r[s+1]=i>>>8&255,r[s]=255&i)}return r},Mt={inherits:Ls,toArray:zK,toHex:WK,htonl:U9,toHex32:YK,zero2:L9,zero8:K9,join32:ZK,split32:JK,rotr32:function(e,t){return e>>>t|e<<32-t},rotl32:function(e,t){return e<<t|e>>>32-t},sum32:function(e,t){return e+t>>>0},sum32_3:function(e,t,r){return e+t+r>>>0},sum32_4:function(e,t,r,n){return e+t+r+n>>>0},sum32_5:function(e,t,r,n,s){return e+t+r+n+s>>>0},sum64:function(e,t,r,n){var s=e[t],i=n+e[t+1]>>>0,o=(i<n?1:0)+r+s;e[t]=o>>>0,e[t+1]=i},sum64_hi:function(e,t,r,n){return(t+n>>>0<t?1:0)+e+r>>>0},sum64_lo:function(e,t,r,n){return t+n>>>0},sum64_4_hi:function(e,t,r,n,s,i,o,a){var f=0,c=t;return f+=(c=c+n>>>0)<t?1:0,f+=(c=c+i>>>0)<i?1:0,e+r+s+o+(f+=(c=c+a>>>0)<a?1:0)>>>0},sum64_4_lo:function(e,t,r,n,s,i,o,a){return t+n+i+a>>>0},sum64_5_hi:function(e,t,r,n,s,i,o,a,f,c){var l=0,u=t;return l+=(u=u+n>>>0)<t?1:0,l+=(u=u+i>>>0)<i?1:0,l+=(u=u+a>>>0)<a?1:0,e+r+s+o+f+(l+=(u=u+c>>>0)<c?1:0)>>>0},sum64_5_lo:function(e,t,r,n,s,i,o,a,f,c){return t+n+i+a+c>>>0},rotr64_hi:function(e,t,r){return(t<<32-r|e>>>r)>>>0},rotr64_lo:function(e,t,r){return(e<<32-r|t>>>r)>>>0},shr64_hi:function(e,t,r){return e>>>r},shr64_lo:function(e,t,r){return(e<<32-r|t>>>r)>>>0}};function dd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var XK=dd;dd.prototype.update=function(e,t){if(e=Mt.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),this.pending.length===0&&(this.pending=null),e=Mt.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},dd.prototype.digest=function(e){return this.update(this._pad()),Ws(this.pending===null),this._digest(e)},dd.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=Array(r+this.padLength);n[0]=128;for(var s=1;s<r;s++)n[s]=0;if(e<<=3,this.endian==="big"){for(var i=8;i<this.padLength;i++)n[s++]=0;n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=e>>>24&255,n[s++]=e>>>16&255,n[s++]=e>>>8&255,n[s++]=255&e}else for(n[s++]=255&e,n[s++]=e>>>8&255,n[s++]=e>>>16&255,n[s++]=e>>>24&255,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,i=8;i<this.padLength;i++)n[s++]=0;return n};var W0={BlockHash:XK},di=Mt.rotr32,QK=function(e,t,r,n){return e===0?F9(t,r,n):e===1||e===3?j9(t,r,n):e===2?q9(t,r,n):void 0};function F9(e,t,r){return e&t^~e&r}function q9(e,t,r){return e&t^e&r^t&r}function j9(e,t,r){return e^t^r}var qa={ft_1:QK,ch32:F9,maj32:q9,p32:j9,s0_256:function(e){return di(e,2)^di(e,13)^di(e,22)},s1_256:function(e){return di(e,6)^di(e,11)^di(e,25)},g0_256:function(e){return di(e,7)^di(e,18)^e>>>3},g1_256:function(e){return di(e,17)^di(e,19)^e>>>10}},Gn=Mt.sum32,eF=Mt.sum32_4,tF=Mt.sum32_5,rF=qa.ch32,nF=qa.maj32,iF=qa.s0_256,sF=qa.s1_256,aF=qa.g0_256,oF=qa.g1_256,$9=W0.BlockHash,cF=[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];function mi(){if(!(this instanceof mi))return new mi;$9.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=cF,this.W=Array(64)}Mt.inherits(mi,$9);var cg=mi;function Xi(){if(!(this instanceof Xi))return new Xi;cg.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}mi.blockSize=512,mi.outSize=256,mi.hmacStrength=192,mi.padLength=64,mi.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=eF(oF(r[n-2]),r[n-7],aF(r[n-15]),r[n-16]);var s=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],f=this.h[4],c=this.h[5],l=this.h[6],u=this.h[7];for(Ws(this.k.length===r.length),n=0;n<r.length;n++){var p=tF(u,sF(f),rF(f,c,l),this.k[n],r[n]),d=Gn(iF(s),nF(s,i,o));u=l,l=c,c=f,f=Gn(a,p),a=o,o=i,i=s,s=Gn(p,d)}this.h[0]=Gn(this.h[0],s),this.h[1]=Gn(this.h[1],i),this.h[2]=Gn(this.h[2],o),this.h[3]=Gn(this.h[3],a),this.h[4]=Gn(this.h[4],f),this.h[5]=Gn(this.h[5],c),this.h[6]=Gn(this.h[6],l),this.h[7]=Gn(this.h[7],u)},mi.prototype._digest=function(e){return e==="hex"?Mt.toHex32(this.h,"big"):Mt.split32(this.h,"big")},Mt.inherits(Xi,cg);var H9=Xi;Xi.blockSize=512,Xi.outSize=224,Xi.hmacStrength=192,Xi.padLength=64,Xi.prototype._digest=function(e){return e==="hex"?Mt.toHex32(this.h.slice(0,7),"big"):Mt.split32(this.h.slice(0,7),"big")};var xi=Mt.rotr64_hi,Ti=Mt.rotr64_lo,V9=Mt.shr64_hi,G9=Mt.shr64_lo,ps=Mt.sum64,Jh=Mt.sum64_hi,Xh=Mt.sum64_lo,uF=Mt.sum64_4_hi,lF=Mt.sum64_4_lo,dF=Mt.sum64_5_hi,fF=Mt.sum64_5_lo,z9=W0.BlockHash,hF=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function ti(){if(!(this instanceof ti))return new ti;z9.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=hF,this.W=Array(160)}Mt.inherits(ti,z9);var Po=ti;function pF(e,t,r,n,s){var i=e&r^~e&s;return i<0&&(i+=4294967296),i}function yF(e,t,r,n,s,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}function gF(e,t,r,n,s){var i=e&r^e&s^r&s;return i<0&&(i+=4294967296),i}function mF(e,t,r,n,s,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}function vF(e,t){var r=xi(e,t,28)^xi(t,e,2)^xi(t,e,7);return r<0&&(r+=4294967296),r}function bF(e,t){var r=Ti(e,t,28)^Ti(t,e,2)^Ti(t,e,7);return r<0&&(r+=4294967296),r}function _F(e,t){var r=xi(e,t,14)^xi(e,t,18)^xi(t,e,9);return r<0&&(r+=4294967296),r}function wF(e,t){var r=Ti(e,t,14)^Ti(e,t,18)^Ti(t,e,9);return r<0&&(r+=4294967296),r}function EF(e,t){var r=xi(e,t,1)^xi(e,t,8)^V9(e,t,7);return r<0&&(r+=4294967296),r}function AF(e,t){var r=Ti(e,t,1)^Ti(e,t,8)^G9(e,t,7);return r<0&&(r+=4294967296),r}function SF(e,t){var r=xi(e,t,19)^xi(t,e,29)^V9(e,t,6);return r<0&&(r+=4294967296),r}function PF(e,t){var r=Ti(e,t,19)^Ti(t,e,29)^G9(e,t,6);return r<0&&(r+=4294967296),r}function Qi(){if(!(this instanceof Qi))return new Qi;Po.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}ti.blockSize=1024,ti.outSize=512,ti.hmacStrength=192,ti.padLength=128,ti.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var s=SF(r[n-4],r[n-3]),i=PF(r[n-4],r[n-3]),o=r[n-14],a=r[n-13],f=EF(r[n-30],r[n-29]),c=AF(r[n-30],r[n-29]),l=r[n-32],u=r[n-31];r[n]=uF(s,i,o,a,f,c,l,u),r[n+1]=lF(s,i,o,a,f,c,l,u)}},ti.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],s=this.h[1],i=this.h[2],o=this.h[3],a=this.h[4],f=this.h[5],c=this.h[6],l=this.h[7],u=this.h[8],p=this.h[9],d=this.h[10],h=this.h[11],y=this.h[12],m=this.h[13],v=this.h[14],b=this.h[15];Ws(this.k.length===r.length);for(var w=0;w<r.length;w+=2){var _=v,C=b,I=_F(u,p),k=wF(u,p),E=pF(u,p,d,h,y),S=yF(u,p,d,h,y,m),T=this.k[w],P=this.k[w+1],g=r[w],A=r[w+1],x=dF(_,C,I,k,E,S,T,P,g,A),D=fF(_,C,I,k,E,S,T,P,g,A);_=vF(n,s),C=bF(n,s),I=gF(n,s,i,o,a),k=mF(n,s,i,o,a,f);var O=Jh(_,C,I,k),B=Xh(_,C,I,k);v=y,b=m,y=d,m=h,d=u,h=p,u=Jh(c,l,x,D),p=Xh(l,l,x,D),c=a,l=f,a=i,f=o,i=n,o=s,n=Jh(x,D,O,B),s=Xh(x,D,O,B)}ps(this.h,0,n,s),ps(this.h,2,i,o),ps(this.h,4,a,f),ps(this.h,6,c,l),ps(this.h,8,u,p),ps(this.h,10,d,h),ps(this.h,12,y,m),ps(this.h,14,v,b)},ti.prototype._digest=function(e){return e==="hex"?Mt.toHex32(this.h,"big"):Mt.split32(this.h,"big")},Mt.inherits(Qi,Po);var W9=Qi;Qi.blockSize=1024,Qi.outSize=384,Qi.hmacStrength=192,Qi.padLength=128,Qi.prototype._digest=function(e){return e==="hex"?Mt.toHex32(this.h.slice(0,12),"big"):Mt.split32(this.h.slice(0,12),"big")};var _l=Mt.rotl32,O3=Mt.sum32,Go=Mt.sum32_3,M3=Mt.sum32_4,Y9=W0.BlockHash;function vi(){if(!(this instanceof vi))return new vi;Y9.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Mt.inherits(vi,Y9);var Z9=vi;function N3(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function xF(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function TF(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}vi.blockSize=512,vi.outSize=160,vi.hmacStrength=192,vi.padLength=64,vi.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],s=this.h[2],i=this.h[3],o=this.h[4],a=r,f=n,c=s,l=i,u=o,p=0;p<80;p++){var d=O3(_l(M3(r,N3(p,n,s,i),e[CF[p]+t],xF(p)),kF[p]),o);r=o,o=i,i=_l(s,10),s=n,n=d,d=O3(_l(M3(a,N3(79-p,f,c,l),e[IF[p]+t],TF(p)),RF[p]),u),a=u,u=l,l=_l(c,10),c=f,f=d}d=Go(this.h[1],s,l),this.h[1]=Go(this.h[2],i,u),this.h[2]=Go(this.h[3],o,a),this.h[3]=Go(this.h[4],r,f),this.h[4]=Go(this.h[0],n,c),this.h[0]=d},vi.prototype._digest=function(e){return e==="hex"?Mt.toHex32(this.h,"little"):Mt.split32(this.h,"little")};var CF=[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],IF=[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],kF=[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],RF=[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],DF={ripemd160:Z9};function Qh(e,t){let r=e[0],n=e[1],s=e[2],i=e[3];r=en(r,n,s,i,t[0],7,-680876936),i=en(i,r,n,s,t[1],12,-389564586),s=en(s,i,r,n,t[2],17,606105819),n=en(n,s,i,r,t[3],22,-1044525330),r=en(r,n,s,i,t[4],7,-176418897),i=en(i,r,n,s,t[5],12,1200080426),s=en(s,i,r,n,t[6],17,-1473231341),n=en(n,s,i,r,t[7],22,-45705983),r=en(r,n,s,i,t[8],7,1770035416),i=en(i,r,n,s,t[9],12,-1958414417),s=en(s,i,r,n,t[10],17,-42063),n=en(n,s,i,r,t[11],22,-1990404162),r=en(r,n,s,i,t[12],7,1804603682),i=en(i,r,n,s,t[13],12,-40341101),s=en(s,i,r,n,t[14],17,-1502002290),n=en(n,s,i,r,t[15],22,1236535329),r=tn(r,n,s,i,t[1],5,-165796510),i=tn(i,r,n,s,t[6],9,-1069501632),s=tn(s,i,r,n,t[11],14,643717713),n=tn(n,s,i,r,t[0],20,-373897302),r=tn(r,n,s,i,t[5],5,-701558691),i=tn(i,r,n,s,t[10],9,38016083),s=tn(s,i,r,n,t[15],14,-660478335),n=tn(n,s,i,r,t[4],20,-405537848),r=tn(r,n,s,i,t[9],5,568446438),i=tn(i,r,n,s,t[14],9,-1019803690),s=tn(s,i,r,n,t[3],14,-187363961),n=tn(n,s,i,r,t[8],20,1163531501),r=tn(r,n,s,i,t[13],5,-1444681467),i=tn(i,r,n,s,t[2],9,-51403784),s=tn(s,i,r,n,t[7],14,1735328473),n=tn(n,s,i,r,t[12],20,-1926607734),r=rn(r,n,s,i,t[5],4,-378558),i=rn(i,r,n,s,t[8],11,-2022574463),s=rn(s,i,r,n,t[11],16,1839030562),n=rn(n,s,i,r,t[14],23,-35309556),r=rn(r,n,s,i,t[1],4,-1530992060),i=rn(i,r,n,s,t[4],11,1272893353),s=rn(s,i,r,n,t[7],16,-155497632),n=rn(n,s,i,r,t[10],23,-1094730640),r=rn(r,n,s,i,t[13],4,681279174),i=rn(i,r,n,s,t[0],11,-358537222),s=rn(s,i,r,n,t[3],16,-722521979),n=rn(n,s,i,r,t[6],23,76029189),r=rn(r,n,s,i,t[9],4,-640364487),i=rn(i,r,n,s,t[12],11,-421815835),s=rn(s,i,r,n,t[15],16,530742520),n=rn(n,s,i,r,t[2],23,-995338651),r=nn(r,n,s,i,t[0],6,-198630844),i=nn(i,r,n,s,t[7],10,1126891415),s=nn(s,i,r,n,t[14],15,-1416354905),n=nn(n,s,i,r,t[5],21,-57434055),r=nn(r,n,s,i,t[12],6,1700485571),i=nn(i,r,n,s,t[3],10,-1894986606),s=nn(s,i,r,n,t[10],15,-1051523),n=nn(n,s,i,r,t[1],21,-2054922799),r=nn(r,n,s,i,t[8],6,1873313359),i=nn(i,r,n,s,t[15],10,-30611744),s=nn(s,i,r,n,t[6],15,-1560198380),n=nn(n,s,i,r,t[13],21,1309151649),r=nn(r,n,s,i,t[4],6,-145523070),i=nn(i,r,n,s,t[11],10,-1120210379),s=nn(s,i,r,n,t[2],15,718787259),n=nn(n,s,i,r,t[9],21,-343485551),e[0]=Bs(r,e[0]),e[1]=Bs(n,e[1]),e[2]=Bs(s,e[2]),e[3]=Bs(i,e[3])}function Sf(e,t,r,n,s,i){return t=Bs(Bs(t,e),Bs(n,i)),Bs(t<<s|t>>>32-s,r)}function en(e,t,r,n,s,i,o){return Sf(t&r|~t&n,e,t,s,i,o)}function tn(e,t,r,n,s,i,o){return Sf(t&n|r&~n,e,t,s,i,o)}function rn(e,t,r,n,s,i,o){return Sf(t^r^n,e,t,s,i,o)}function nn(e,t,r,n,s,i,o){return Sf(r^(t|~n),e,t,s,i,o)}function BF(e){const t=[];let r;for(r=0;r<64;r+=4)t[r>>2]=e.charCodeAt(r)+(e.charCodeAt(r+1)<<8)+(e.charCodeAt(r+2)<<16)+(e.charCodeAt(r+3)<<24);return t}const U3="0123456789abcdef".split("");function OF(e){let t="",r=0;for(;r<4;r++)t+=U3[e>>8*r+4&15]+U3[e>>8*r&15];return t}function Bs(e,t){return e+t&4294967295}const kd=ne.getWebCrypto(),Rd=ne.getNodeCrypto(),MF=Rd&&Rd.getHashes();function Qs(e){if(Rd&&MF.includes(e))return async function(t){const r=Rd.createHash(e);return vr(t,n=>{r.update(n)},()=>new Uint8Array(r.digest()))}}function wl(e,t){return async function(r,n=Qe){if(Ar(r)&&(r=await Er(r)),!ne.isStream(r)&&kd&&t&&r.length>=n.minBytesForWebCrypto)return new Uint8Array(await kd.digest(t,r));const s=e();return vr(r,i=>{s.update(i)},()=>new Uint8Array(s.digest()))}}function L3(e,t){return async function(r,n=Qe){if(Ar(r)&&(r=await Er(r)),ne.isStream(r)){const s=new e;return vr(r,i=>{s.process(i)},()=>s.finish().result)}return kd&&t&&r.length>=n.minBytesForWebCrypto?new Uint8Array(await kd.digest(t,r)):e.bytes(r)}}const ea={md5:Qs("md5")||async function(e){const t=function(r){const n=r.length,s=[1732584193,-271733879,-1732584194,271733878];let i;for(i=64;i<=r.length;i+=64)Qh(s,BF(r.substring(i-64,i)));r=r.substring(i-64);const o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<r.length;i++)o[i>>2]|=r.charCodeAt(i)<<(i%4<<3);if(o[i>>2]|=128<<(i%4<<3),i>55)for(Qh(s,o),i=0;i<16;i++)o[i]=0;return o[14]=8*n,Qh(s,o),s}(ne.uint8ArrayToString(e));return ne.hexToUint8Array(function(r){for(let n=0;n<r.length;n++)r[n]=OF(r[n]);return r.join("")}(t))},sha1:Qs("sha1")||L3(ba,"SHA-1"),sha224:Qs("sha224")||wl(H9),sha256:Qs("sha256")||L3(Af,"SHA-256"),sha384:Qs("sha384")||wl(W9,"SHA-384"),sha512:Qs("sha512")||wl(Po,"SHA-512"),ripemd:Qs("ripemd160")||wl(Z9)};var qn={md5:ea.md5,sha1:ea.sha1,sha224:ea.sha224,sha256:ea.sha256,sha384:ea.sha384,sha512:ea.sha512,ripemd:ea.ripemd,digest:function(e,t){switch(e){case G.hash.md5:return this.md5(t);case G.hash.sha1:return this.sha1(t);case G.hash.ripemd:return this.ripemd(t);case G.hash.sha256:return this.sha256(t);case G.hash.sha384:return this.sha384(t);case G.hash.sha512:return this.sha512(t);case G.hash.sha224:return this.sha224(t);default:throw Error("Invalid hash function.")}},getHashByteLength:function(e){switch(e){case G.hash.md5:return 16;case G.hash.sha1:case G.hash.ripemd:return 20;case G.hash.sha256:return 32;case G.hash.sha384:return 48;case G.hash.sha512:return 64;case G.hash.sha224:return 28;default:throw Error("Invalid hash algorithm.")}}};class po{static encrypt(t,r,n){return new po(r,n).encrypt(t)}static decrypt(t,r,n){return new po(r,n).decrypt(t)}constructor(t,r,n){this.aes=n||new G0(t,r,!0,"CFB"),delete this.aes.padding}encrypt(t){return $s(this.aes.AES_Encrypt_process(t),this.aes.AES_Encrypt_finish())}decrypt(t){return $s(this.aes.AES_Decrypt_process(t),this.aes.AES_Decrypt_finish())}}function Ci(e){const t=G.read(G.symmetric,e);return z0[t]}const K3=ne.getWebCrypto(),Dd=ne.getNodeCrypto(),ta=Dd?Dd.getCiphers():[],El={idea:ta.includes("idea-cfb")?"idea-cfb":void 0,tripledes:ta.includes("des-ede3-cfb")?"des-ede3-cfb":void 0,cast5:ta.includes("cast5-cfb")?"cast5-cfb":void 0,blowfish:ta.includes("bf-cfb")?"bf-cfb":void 0,aes128:ta.includes("aes-128-cfb")?"aes-128-cfb":void 0,aes192:ta.includes("aes-192-cfb")?"aes-192-cfb":void 0,aes256:ta.includes("aes-256-cfb")?"aes-256-cfb":void 0};var NF=Object.freeze({__proto__:null,encrypt:async function(e,t,r,n,s){const i=G.read(G.symmetric,e);if(ne.getNodeCrypto()&&El[i])return function(u,p,d,h){const y=G.read(G.symmetric,u),m=new Dd.createCipheriv(El[y],p,h);return vr(d,v=>new Uint8Array(m.update(v)))}(e,t,r,n);if(ne.isAES(e))return function(u,p,d,h,y){if(ne.getWebCrypto()&&p.length!==24&&!ne.isStream(d)&&d.length>=3e3*y.minBytesForWebCrypto)return async function(v,b,w,_){const C="AES-CBC",I=await K3.importKey("raw",b,{name:C},!1,["encrypt"]),{blockSize:k}=Ci(v),E=ne.concatUint8Array([new Uint8Array(k),w]),S=new Uint8Array(await K3.encrypt({name:C,iv:_},I,E)).subarray(0,w.length);return function(T,P){for(let g=0;g<T.length;g++)T[g]=T[g]^P[g]}(S,w),S}(u,p,d,h);const m=new po(p,h);return vr(d,v=>m.aes.AES_Encrypt_process(v),()=>m.aes.AES_Encrypt_finish())}(e,t,r,n,s);const o=new(Ci(e))(t),a=o.blockSize,f=n.slice();let c=new Uint8Array;const l=u=>{u&&(c=ne.concatUint8Array([c,u]));const p=new Uint8Array(c.length);let d,h=0;for(;u?c.length>=a:c.length;){const y=o.encrypt(f);for(d=0;d<a;d++)f[d]=c[d]^y[d],p[h++]=f[d];c=c.subarray(a)}return p.subarray(0,h)};return vr(r,l,l)},decrypt:async function(e,t,r,n){const s=G.read(G.symmetric,e);if(ne.getNodeCrypto()&&El[s])return function(l,u,p,d){const h=G.read(G.symmetric,l),y=new Dd.createDecipheriv(El[h],u,d);return vr(p,m=>new Uint8Array(y.update(m)))}(e,t,r,n);if(ne.isAES(e))return function(l,u,p,d){if(ne.isStream(p)){const h=new po(u,d);return vr(p,y=>h.aes.AES_Decrypt_process(y),()=>h.aes.AES_Decrypt_finish())}return po.decrypt(p,u,d)}(0,t,r,n);const i=new(Ci(e))(t),o=i.blockSize;let a=n,f=new Uint8Array;const c=l=>{l&&(f=ne.concatUint8Array([f,l]));const u=new Uint8Array(f.length);let p,d=0;for(;l?f.length>=o:f.length;){const h=i.encrypt(a);for(a=f.subarray(0,o),p=0;p<o;p++)u[d++]=a[p]^h[p];f=f.subarray(o)}return u.subarray(0,d)};return vr(r,c,c)}});class Bd{static encrypt(t,r,n){return new Bd(r,n).encrypt(t)}static decrypt(t,r,n){return new Bd(r,n).encrypt(t)}constructor(t,r,n){this.aes=n||new G0(t,void 0,!1,"CTR"),delete this.aes.padding,this.AES_CTR_set_options(r)}encrypt(t){return $s(this.aes.AES_Encrypt_process(t),this.aes.AES_Encrypt_finish())}decrypt(t){return $s(this.aes.AES_Encrypt_process(t),this.aes.AES_Encrypt_finish())}AES_CTR_set_options(t,r,n){let{asm:s}=this.aes.acquire_asm();if(n!==void 0){if(n<8||n>48)throw new es("illegal counter size");let i=Math.pow(2,n)-1;s.set_mask(0,0,i/4294967296|0,0|i)}else n=48,s.set_mask(0,0,65535,4294967295);if(t===void 0)throw Error("nonce is required");{let i=t.length;if(!i||i>16)throw new es("illegal nonce size");let o=new DataView(new ArrayBuffer(16));new Uint8Array(o.buffer).set(t),s.set_nonce(o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12))}if(r!==void 0){if(r<0||r>=Math.pow(2,n))throw new es("illegal counter value");s.set_counter(0,0,r/4294967296|0,0|r)}}}class Od{static encrypt(t,r,n=!0,s){return new Od(r,s,n).encrypt(t)}static decrypt(t,r,n=!0,s){return new Od(r,s,n).decrypt(t)}constructor(t,r,n=!0,s){this.aes=s||new G0(t,r,n,"CBC")}encrypt(t){return $s(this.aes.AES_Encrypt_process(t),this.aes.AES_Encrypt_finish())}decrypt(t){return $s(this.aes.AES_Decrypt_process(t),this.aes.AES_Decrypt_finish())}}const F3=ne.getWebCrypto(),UF=ne.getNodeCrypto(),Yi=16;function q3(e,t){const r=e.length-Yi;for(let n=0;n<Yi;n++)e[n+r]^=t[n];return e}const Al=new Uint8Array(Yi);async function LF(e){const t=await async function(s){return ne.getWebCrypto()&&s.length!==24?(s=await F3.importKey("raw",s,{name:"AES-CBC",length:8*s.length},!1,["encrypt"]),async function(i){const o=await F3.encrypt({name:"AES-CBC",iv:Al,length:8*Yi},s,i);return new Uint8Array(o).subarray(0,o.byteLength-Yi)}):ne.getNodeCrypto()?async function(i){const o=new UF.createCipheriv("aes-"+8*s.length+"-cbc",s,Al).update(i);return new Uint8Array(o)}:async function(i){return Od.encrypt(i,s,!1,Al)}}(e),r=ne.double(await t(Al)),n=ne.double(r);return async function(s){return(await t(function(i,o,a){if(i.length&&i.length%Yi==0)return q3(i,o);const f=new Uint8Array(i.length+(Yi-i.length%Yi));return f.set(i),f[i.length]=128,q3(f,a)}(s,r,n))).subarray(-Yi)}}const j3=ne.getWebCrypto(),KF=ne.getNodeCrypto(),FF=ne.getNodeBuffer(),as=16,qF=as,eo=as,$3=new Uint8Array(as),ly=new Uint8Array(as);ly[as-1]=1;const dy=new Uint8Array(as);async function jF(e){const t=await LF(e);return function(r,n){return t(ne.concatUint8Array([r,n]))}}async function $F(e){return ne.getWebCrypto()&&e.length!==24?(e=await j3.importKey("raw",e,{name:"AES-CTR",length:8*e.length},!1,["encrypt"]),async function(t,r){const n=await j3.encrypt({name:"AES-CTR",counter:r,length:8*as},e,t);return new Uint8Array(n)}):ne.getNodeCrypto()?async function(t,r){const n=new KF.createCipheriv("aes-"+8*e.length+"-ctr",e,r),s=FF.concat([n.update(t),n.final()]);return new Uint8Array(s)}:async function(t,r){return Bd.encrypt(t,e,r)}}async function r0(e,t){if(e!==G.symmetric.aes128&&e!==G.symmetric.aes192&&e!==G.symmetric.aes256)throw Error("EAX mode supports only AES cipher");const[r,n]=await Promise.all([jF(t),$F(t)]);return{encrypt:async function(s,i,o){const[a,f]=await Promise.all([r($3,i),r(ly,o)]),c=await n(s,a),l=await r(dy,c);for(let u=0;u<eo;u++)l[u]^=f[u]^a[u];return ne.concatUint8Array([c,l])},decrypt:async function(s,i,o){if(s.length<eo)throw Error("Invalid EAX ciphertext");const a=s.subarray(0,-eo),f=s.subarray(-eo),[c,l,u]=await Promise.all([r($3,i),r(ly,o),r(dy,a)]),p=u;for(let d=0;d<eo;d++)p[d]^=l[d]^c[d];if(!ne.equalsUint8Array(f,p))throw Error("Authentication tag mismatch");return await n(a,c)}}}dy[as-1]=2,r0.getNonce=function(e,t){const r=e.slice();for(let n=0;n<t.length;n++)r[8+n]^=t[n];return r},r0.blockLength=as,r0.ivLength=qF,r0.tagLength=eo;const pn=16,J9=15,bs=16;function H3(e){let t=0;for(let r=1;!(e&r);r<<=1)t++;return t}function _n(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r];return e}function Sl(e,t){return _n(e.slice(),t)}const e1=new Uint8Array(pn),HF=new Uint8Array([1]);async function n0(e,t){let r,n,s,i=0;function o(a,f,c,l){const u=f.length/pn|0;(function(I,k){const E=ne.nbits(Math.max(I.length,k.length)/pn|0)-1;for(let S=i+1;S<=E;S++)s[S]=ne.double(s[S-1]);i=E})(f,l);const p=ne.concatUint8Array([e1.subarray(0,J9-c.length),HF,c]),d=63&p[pn-1];p[pn-1]&=192;const h=r(p),y=ne.concatUint8Array([h,Sl(h.subarray(0,8),h.subarray(1,9))]),m=ne.shiftRight(y.subarray(0+(d>>3),17+(d>>3)),8-(7&d)).subarray(1),v=new Uint8Array(pn),b=new Uint8Array(f.length+bs);let w,_=0;for(w=0;w<u;w++)_n(m,s[H3(w+1)]),b.set(_n(a(Sl(m,f)),m),_),_n(v,a===r?f:b.subarray(_)),f=f.subarray(pn),_+=pn;if(f.length){_n(m,s.x);const I=r(m);b.set(Sl(f,I),_);const k=new Uint8Array(pn);k.set(a===r?f:b.subarray(_,-bs),0),k[f.length]=128,_n(v,k),_+=f.length}const C=_n(r(_n(_n(v,m),s.$)),function(I){if(!I.length)return e1;const k=I.length/pn|0,E=new Uint8Array(pn),S=new Uint8Array(pn);for(let T=0;T<k;T++)_n(E,s[H3(T+1)]),_n(S,r(Sl(E,I))),I=I.subarray(pn);if(I.length){_n(E,s.x);const T=new Uint8Array(pn);T.set(I,0),T[I.length]=128,_n(T,E),_n(S,r(T))}return S}(l));return b.set(C,_),b}return function(a,f){const c=G.read(G.symmetric,a),l=new z0[c](f);r=l.encrypt.bind(l),n=l.decrypt.bind(l);const u=r(e1),p=ne.double(u);s=[],s[0]=ne.double(p),s.x=u,s.$=p}(e,t),{encrypt:async function(a,f,c){return o(r,a,f,c)},decrypt:async function(a,f,c){if(a.length<bs)throw Error("Invalid OCB ciphertext");const l=a.subarray(-bs);a=a.subarray(0,-bs);const u=o(n,a,f,c);if(ne.equalsUint8Array(l,u.subarray(-bs)))return u.subarray(0,-bs);throw Error("Authentication tag mismatch")}}}n0.getNonce=function(e,t){const r=e.slice();for(let n=0;n<t.length;n++)r[7+n]^=t[n];return r},n0.blockLength=pn,n0.ivLength=J9,n0.tagLength=bs;const t1=68719476704;class _a{constructor(t,r,n,s=16,i){this.tagSize=s,this.gamma0=0,this.counter=1,this.aes=i||new G0(t,void 0,!1,"CTR");let{asm:o,heap:a}=this.aes.acquire_asm();if(o.gcm_init(),this.tagSize<4||this.tagSize>16)throw new es("illegal tagSize value");const f=r.length||0,c=new Uint8Array(16);f!==12?(this._gcm_mac_process(r),a[0]=0,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=0,a[11]=f>>>29,a[12]=f>>>21&255,a[13]=f>>>13&255,a[14]=f>>>5&255,a[15]=f<<3&255,o.mac(Kt.MAC.GCM,Kt.HEAP_DATA,16),o.get_iv(Kt.HEAP_DATA),o.set_iv(0,0,0,0),c.set(a.subarray(0,16))):(c.set(r),c[15]=1);const l=new DataView(c.buffer);if(this.gamma0=l.getUint32(12),o.set_nonce(l.getUint32(0),l.getUint32(4),l.getUint32(8),0),o.set_mask(0,0,0,4294967295),n!==void 0){if(n.length>t1)throw new es("illegal adata length");n.length?(this.adata=n,this._gcm_mac_process(n)):this.adata=void 0}else this.adata=void 0;if(this.counter<1||this.counter>4294967295)throw new RangeError("counter must be a positive 32-bit integer");o.set_counter(0,0,0,this.gamma0+this.counter|0)}static encrypt(t,r,n,s,i){return new _a(r,n,s,i).encrypt(t)}static decrypt(t,r,n,s,i){return new _a(r,n,s,i).decrypt(t)}encrypt(t){return this.AES_GCM_encrypt(t)}decrypt(t){return this.AES_GCM_decrypt(t)}AES_GCM_Encrypt_process(t){let r=0,n=t.length||0,{asm:s,heap:i}=this.aes.acquire_asm(),o=this.counter,a=this.aes.pos,f=this.aes.len,c=0,l=f+n&-16,u=0;if((o-1<<4)+f+n>t1)throw new RangeError("counter overflow");const p=new Uint8Array(l);for(;n>0;)u=va(i,a+f,t,r,n),f+=u,r+=u,n-=u,u=s.cipher(Kt.ENC.CTR,Kt.HEAP_DATA+a,f),u=s.mac(Kt.MAC.GCM,Kt.HEAP_DATA+a,u),u&&p.set(i.subarray(a,a+u),c),o+=u>>>4,c+=u,u<f?(a+=u,f-=u):(a=0,f=0);return this.counter=o,this.aes.pos=a,this.aes.len=f,p}AES_GCM_Encrypt_finish(){let{asm:t,heap:r}=this.aes.acquire_asm(),n=this.counter,s=this.tagSize,i=this.adata,o=this.aes.pos,a=this.aes.len;const f=new Uint8Array(a+s);t.cipher(Kt.ENC.CTR,Kt.HEAP_DATA+o,a+15&-16),a&&f.set(r.subarray(o,o+a));let c=a;for(;15&c;c++)r[o+c]=0;t.mac(Kt.MAC.GCM,Kt.HEAP_DATA+o,c);const l=i!==void 0?i.length:0,u=(n-1<<4)+a;return r[0]=0,r[1]=0,r[2]=0,r[3]=l>>>29,r[4]=l>>>21,r[5]=l>>>13&255,r[6]=l>>>5&255,r[7]=l<<3&255,r[8]=r[9]=r[10]=0,r[11]=u>>>29,r[12]=u>>>21&255,r[13]=u>>>13&255,r[14]=u>>>5&255,r[15]=u<<3&255,t.mac(Kt.MAC.GCM,Kt.HEAP_DATA,16),t.get_iv(Kt.HEAP_DATA),t.set_counter(0,0,0,this.gamma0),t.cipher(Kt.ENC.CTR,Kt.HEAP_DATA,16),f.set(r.subarray(0,s),a),this.counter=1,this.aes.pos=0,this.aes.len=0,f}AES_GCM_Decrypt_process(t){let r=0,n=t.length||0,{asm:s,heap:i}=this.aes.acquire_asm(),o=this.counter,a=this.tagSize,f=this.aes.pos,c=this.aes.len,l=0,u=c+n>a?c+n-a&-16:0,p=c+n-u,d=0;if((o-1<<4)+c+n>t1)throw new RangeError("counter overflow");const h=new Uint8Array(u);for(;n>p;)d=va(i,f+c,t,r,n-p),c+=d,r+=d,n-=d,d=s.mac(Kt.MAC.GCM,Kt.HEAP_DATA+f,d),d=s.cipher(Kt.DEC.CTR,Kt.HEAP_DATA+f,d),d&&h.set(i.subarray(f,f+d),l),o+=d>>>4,l+=d,f=0,c=0;return n>0&&(c+=va(i,0,t,r,n)),this.counter=o,this.aes.pos=f,this.aes.len=c,h}AES_GCM_Decrypt_finish(){let{asm:t,heap:r}=this.aes.acquire_asm(),n=this.tagSize,s=this.adata,i=this.counter,o=this.aes.pos,a=this.aes.len,f=a-n;if(a<n)throw new cy("authentication tag not found");const c=new Uint8Array(f),l=new Uint8Array(r.subarray(o+f,o+a));let u=f;for(;15&u;u++)r[o+u]=0;t.mac(Kt.MAC.GCM,Kt.HEAP_DATA+o,u),t.cipher(Kt.DEC.CTR,Kt.HEAP_DATA+o,u),f&&c.set(r.subarray(o,o+f));const p=s!==void 0?s.length:0,d=(i-1<<4)+a-n;r[0]=0,r[1]=0,r[2]=0,r[3]=p>>>29,r[4]=p>>>21,r[5]=p>>>13&255,r[6]=p>>>5&255,r[7]=p<<3&255,r[8]=r[9]=r[10]=0,r[11]=d>>>29,r[12]=d>>>21&255,r[13]=d>>>13&255,r[14]=d>>>5&255,r[15]=d<<3&255,t.mac(Kt.MAC.GCM,Kt.HEAP_DATA,16),t.get_iv(Kt.HEAP_DATA),t.set_counter(0,0,0,this.gamma0),t.cipher(Kt.ENC.CTR,Kt.HEAP_DATA,16);let h=0;for(let y=0;y<n;++y)h|=l[y]^r[y];if(h)throw new uy("data integrity check failed");return this.counter=1,this.aes.pos=0,this.aes.len=0,c}AES_GCM_decrypt(t){const r=this.AES_GCM_Decrypt_process(t),n=this.AES_GCM_Decrypt_finish(),s=new Uint8Array(r.length+n.length);return r.length&&s.set(r),n.length&&s.set(n,r.length),s}AES_GCM_encrypt(t){const r=this.AES_GCM_Encrypt_process(t),n=this.AES_GCM_Encrypt_finish(),s=new Uint8Array(r.length+n.length);return r.length&&s.set(r),n.length&&s.set(n,r.length),s}_gcm_mac_process(t){let{asm:r,heap:n}=this.aes.acquire_asm(),s=0,i=t.length||0,o=0;for(;i>0;){for(o=va(n,0,t,s,i),s+=o,i-=o;15&o;)n[o++]=0;r.mac(Kt.MAC.GCM,Kt.HEAP_DATA,o)}}}const r1=ne.getWebCrypto(),V3=ne.getNodeCrypto(),G3=ne.getNodeBuffer(),to=16,n1="AES-GCM";async function so(e,t){if(e!==G.symmetric.aes128&&e!==G.symmetric.aes192&&e!==G.symmetric.aes256)throw Error("GCM mode supports only AES cipher");if(ne.getNodeCrypto())return{encrypt:async function(r,n,s=new Uint8Array){const i=new V3.createCipheriv("aes-"+8*t.length+"-gcm",t,n);i.setAAD(s);const o=G3.concat([i.update(r),i.final(),i.getAuthTag()]);return new Uint8Array(o)},decrypt:async function(r,n,s=new Uint8Array){const i=new V3.createDecipheriv("aes-"+8*t.length+"-gcm",t,n);i.setAAD(s),i.setAuthTag(r.slice(r.length-to,r.length));const o=G3.concat([i.update(r.slice(0,r.length-to)),i.final()]);return new Uint8Array(o)}};if(ne.getWebCrypto()&&t.length!==24){const r=await r1.importKey("raw",t,{name:n1},!1,["encrypt","decrypt"]);return{encrypt:async function(n,s,i=new Uint8Array){if(!n.length)return _a.encrypt(n,t,s,i);const o=await r1.encrypt({name:n1,iv:s,additionalData:i,tagLength:8*to},r,n);return new Uint8Array(o)},decrypt:async function(n,s,i=new Uint8Array){if(n.length===to)return _a.decrypt(n,t,s,i);const o=await r1.decrypt({name:n1,iv:s,additionalData:i,tagLength:8*to},r,n);return new Uint8Array(o)}}}return{encrypt:async function(r,n,s){return _a.encrypt(r,t,n,s)},decrypt:async function(r,n,s){return _a.decrypt(r,t,n,s)}}}so.getNonce=function(e,t){const r=e.slice();for(let n=0;n<t.length;n++)r[4+n]^=t[n];return r},so.blockLength=16,so.ivLength=12,so.tagLength=to;var X9={cfb:NF,gcm:so,experimentalGCM:so,eax:r0,ocb:n0},xr=Ui(function(e){(function(t){var r=function(j){var re,V=new Float64Array(16);if(j)for(re=0;re<j.length;re++)V[re]=j[re];return V},n=function(){throw Error("no PRNG")},s=new Uint8Array(32);s[0]=9;var i=r(),o=r([1]),a=r([56129,1]),f=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),c=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),l=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),u=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),p=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function d(j,re,V,U){return function(X,ye,_e,Ae,H){var q,W=0;for(q=0;q<H;q++)W|=X[ye+q]^_e[Ae+q];return(1&W-1>>>8)-1}(j,re,V,U,32)}function h(j,re){var V;for(V=0;V<16;V++)j[V]=0|re[V]}function y(j){var re,V,U=1;for(re=0;re<16;re++)V=j[re]+U+65535,U=Math.floor(V/65536),j[re]=V-65536*U;j[0]+=U-1+37*(U-1)}function m(j,re,V){for(var U,X=~(V-1),ye=0;ye<16;ye++)U=X&(j[ye]^re[ye]),j[ye]^=U,re[ye]^=U}function v(j,re){var V,U,X,ye=r(),_e=r();for(V=0;V<16;V++)_e[V]=re[V];for(y(_e),y(_e),y(_e),U=0;U<2;U++){for(ye[0]=_e[0]-65517,V=1;V<15;V++)ye[V]=_e[V]-65535-(ye[V-1]>>16&1),ye[V-1]&=65535;ye[15]=_e[15]-32767-(ye[14]>>16&1),X=ye[15]>>16&1,ye[14]&=65535,m(_e,ye,1-X)}for(V=0;V<16;V++)j[2*V]=255&_e[V],j[2*V+1]=_e[V]>>8}function b(j,re){var V=new Uint8Array(32),U=new Uint8Array(32);return v(V,j),v(U,re),d(V,0,U,0)}function w(j){var re=new Uint8Array(32);return v(re,j),1&re[0]}function _(j,re){var V;for(V=0;V<16;V++)j[V]=re[2*V]+(re[2*V+1]<<8);j[15]&=32767}function C(j,re,V){for(var U=0;U<16;U++)j[U]=re[U]+V[U]}function I(j,re,V){for(var U=0;U<16;U++)j[U]=re[U]-V[U]}function k(j,re,V){var U,X,ye=0,_e=0,Ae=0,H=0,q=0,W=0,ee=0,le=0,ce=0,ie=0,Fe=0,De=0,qe=0,he=0,ue=0,pe=0,de=0,fe=0,ge=0,se=0,te=0,Ne=0,Ve=0,Je=0,lt=0,tt=0,ve=0,Z=0,oe=0,me=0,xe=0,Pe=V[0],ke=V[1],Oe=V[2],Ue=V[3],Ie=V[4],Re=V[5],et=V[6],we=V[7],Ce=V[8],Be=V[9],Le=V[10],Me=V[11],$=V[12],J=V[13],Q=V[14],K=V[15];ye+=(U=re[0])*Pe,_e+=U*ke,Ae+=U*Oe,H+=U*Ue,q+=U*Ie,W+=U*Re,ee+=U*et,le+=U*we,ce+=U*Ce,ie+=U*Be,Fe+=U*Le,De+=U*Me,qe+=U*$,he+=U*J,ue+=U*Q,pe+=U*K,_e+=(U=re[1])*Pe,Ae+=U*ke,H+=U*Oe,q+=U*Ue,W+=U*Ie,ee+=U*Re,le+=U*et,ce+=U*we,ie+=U*Ce,Fe+=U*Be,De+=U*Le,qe+=U*Me,he+=U*$,ue+=U*J,pe+=U*Q,de+=U*K,Ae+=(U=re[2])*Pe,H+=U*ke,q+=U*Oe,W+=U*Ue,ee+=U*Ie,le+=U*Re,ce+=U*et,ie+=U*we,Fe+=U*Ce,De+=U*Be,qe+=U*Le,he+=U*Me,ue+=U*$,pe+=U*J,de+=U*Q,fe+=U*K,H+=(U=re[3])*Pe,q+=U*ke,W+=U*Oe,ee+=U*Ue,le+=U*Ie,ce+=U*Re,ie+=U*et,Fe+=U*we,De+=U*Ce,qe+=U*Be,he+=U*Le,ue+=U*Me,pe+=U*$,de+=U*J,fe+=U*Q,ge+=U*K,q+=(U=re[4])*Pe,W+=U*ke,ee+=U*Oe,le+=U*Ue,ce+=U*Ie,ie+=U*Re,Fe+=U*et,De+=U*we,qe+=U*Ce,he+=U*Be,ue+=U*Le,pe+=U*Me,de+=U*$,fe+=U*J,ge+=U*Q,se+=U*K,W+=(U=re[5])*Pe,ee+=U*ke,le+=U*Oe,ce+=U*Ue,ie+=U*Ie,Fe+=U*Re,De+=U*et,qe+=U*we,he+=U*Ce,ue+=U*Be,pe+=U*Le,de+=U*Me,fe+=U*$,ge+=U*J,se+=U*Q,te+=U*K,ee+=(U=re[6])*Pe,le+=U*ke,ce+=U*Oe,ie+=U*Ue,Fe+=U*Ie,De+=U*Re,qe+=U*et,he+=U*we,ue+=U*Ce,pe+=U*Be,de+=U*Le,fe+=U*Me,ge+=U*$,se+=U*J,te+=U*Q,Ne+=U*K,le+=(U=re[7])*Pe,ce+=U*ke,ie+=U*Oe,Fe+=U*Ue,De+=U*Ie,qe+=U*Re,he+=U*et,ue+=U*we,pe+=U*Ce,de+=U*Be,fe+=U*Le,ge+=U*Me,se+=U*$,te+=U*J,Ne+=U*Q,Ve+=U*K,ce+=(U=re[8])*Pe,ie+=U*ke,Fe+=U*Oe,De+=U*Ue,qe+=U*Ie,he+=U*Re,ue+=U*et,pe+=U*we,de+=U*Ce,fe+=U*Be,ge+=U*Le,se+=U*Me,te+=U*$,Ne+=U*J,Ve+=U*Q,Je+=U*K,ie+=(U=re[9])*Pe,Fe+=U*ke,De+=U*Oe,qe+=U*Ue,he+=U*Ie,ue+=U*Re,pe+=U*et,de+=U*we,fe+=U*Ce,ge+=U*Be,se+=U*Le,te+=U*Me,Ne+=U*$,Ve+=U*J,Je+=U*Q,lt+=U*K,Fe+=(U=re[10])*Pe,De+=U*ke,qe+=U*Oe,he+=U*Ue,ue+=U*Ie,pe+=U*Re,de+=U*et,fe+=U*we,ge+=U*Ce,se+=U*Be,te+=U*Le,Ne+=U*Me,Ve+=U*$,Je+=U*J,lt+=U*Q,tt+=U*K,De+=(U=re[11])*Pe,qe+=U*ke,he+=U*Oe,ue+=U*Ue,pe+=U*Ie,de+=U*Re,fe+=U*et,ge+=U*we,se+=U*Ce,te+=U*Be,Ne+=U*Le,Ve+=U*Me,Je+=U*$,lt+=U*J,tt+=U*Q,ve+=U*K,qe+=(U=re[12])*Pe,he+=U*ke,ue+=U*Oe,pe+=U*Ue,de+=U*Ie,fe+=U*Re,ge+=U*et,se+=U*we,te+=U*Ce,Ne+=U*Be,Ve+=U*Le,Je+=U*Me,lt+=U*$,tt+=U*J,ve+=U*Q,Z+=U*K,he+=(U=re[13])*Pe,ue+=U*ke,pe+=U*Oe,de+=U*Ue,fe+=U*Ie,ge+=U*Re,se+=U*et,te+=U*we,Ne+=U*Ce,Ve+=U*Be,Je+=U*Le,lt+=U*Me,tt+=U*$,ve+=U*J,Z+=U*Q,oe+=U*K,ue+=(U=re[14])*Pe,pe+=U*ke,de+=U*Oe,fe+=U*Ue,ge+=U*Ie,se+=U*Re,te+=U*et,Ne+=U*we,Ve+=U*Ce,Je+=U*Be,lt+=U*Le,tt+=U*Me,ve+=U*$,Z+=U*J,oe+=U*Q,me+=U*K,pe+=(U=re[15])*Pe,_e+=38*(fe+=U*Oe),Ae+=38*(ge+=U*Ue),H+=38*(se+=U*Ie),q+=38*(te+=U*Re),W+=38*(Ne+=U*et),ee+=38*(Ve+=U*we),le+=38*(Je+=U*Ce),ce+=38*(lt+=U*Be),ie+=38*(tt+=U*Le),Fe+=38*(ve+=U*Me),De+=38*(Z+=U*$),qe+=38*(oe+=U*J),he+=38*(me+=U*Q),ue+=38*(xe+=U*K),ye=(U=(ye+=38*(de+=U*ke))+(X=1)+65535)-65536*(X=Math.floor(U/65536)),_e=(U=_e+X+65535)-65536*(X=Math.floor(U/65536)),Ae=(U=Ae+X+65535)-65536*(X=Math.floor(U/65536)),H=(U=H+X+65535)-65536*(X=Math.floor(U/65536)),q=(U=q+X+65535)-65536*(X=Math.floor(U/65536)),W=(U=W+X+65535)-65536*(X=Math.floor(U/65536)),ee=(U=ee+X+65535)-65536*(X=Math.floor(U/65536)),le=(U=le+X+65535)-65536*(X=Math.floor(U/65536)),ce=(U=ce+X+65535)-65536*(X=Math.floor(U/65536)),ie=(U=ie+X+65535)-65536*(X=Math.floor(U/65536)),Fe=(U=Fe+X+65535)-65536*(X=Math.floor(U/65536)),De=(U=De+X+65535)-65536*(X=Math.floor(U/65536)),qe=(U=qe+X+65535)-65536*(X=Math.floor(U/65536)),he=(U=he+X+65535)-65536*(X=Math.floor(U/65536)),ue=(U=ue+X+65535)-65536*(X=Math.floor(U/65536)),pe=(U=pe+X+65535)-65536*(X=Math.floor(U/65536)),ye=(U=(ye+=X-1+37*(X-1))+(X=1)+65535)-65536*(X=Math.floor(U/65536)),_e=(U=_e+X+65535)-65536*(X=Math.floor(U/65536)),Ae=(U=Ae+X+65535)-65536*(X=Math.floor(U/65536)),H=(U=H+X+65535)-65536*(X=Math.floor(U/65536)),q=(U=q+X+65535)-65536*(X=Math.floor(U/65536)),W=(U=W+X+65535)-65536*(X=Math.floor(U/65536)),ee=(U=ee+X+65535)-65536*(X=Math.floor(U/65536)),le=(U=le+X+65535)-65536*(X=Math.floor(U/65536)),ce=(U=ce+X+65535)-65536*(X=Math.floor(U/65536)),ie=(U=ie+X+65535)-65536*(X=Math.floor(U/65536)),Fe=(U=Fe+X+65535)-65536*(X=Math.floor(U/65536)),De=(U=De+X+65535)-65536*(X=Math.floor(U/65536)),qe=(U=qe+X+65535)-65536*(X=Math.floor(U/65536)),he=(U=he+X+65535)-65536*(X=Math.floor(U/65536)),ue=(U=ue+X+65535)-65536*(X=Math.floor(U/65536)),pe=(U=pe+X+65535)-65536*(X=Math.floor(U/65536)),ye+=X-1+37*(X-1),j[0]=ye,j[1]=_e,j[2]=Ae,j[3]=H,j[4]=q,j[5]=W,j[6]=ee,j[7]=le,j[8]=ce,j[9]=ie,j[10]=Fe,j[11]=De,j[12]=qe,j[13]=he,j[14]=ue,j[15]=pe}function E(j,re){k(j,re,re)}function S(j,re){var V,U=r();for(V=0;V<16;V++)U[V]=re[V];for(V=253;V>=0;V--)E(U,U),V!==2&&V!==4&&k(U,U,re);for(V=0;V<16;V++)j[V]=U[V]}function T(j,re,V){var U,X,ye=new Uint8Array(32),_e=new Float64Array(80),Ae=r(),H=r(),q=r(),W=r(),ee=r(),le=r();for(X=0;X<31;X++)ye[X]=re[X];for(ye[31]=127&re[31]|64,ye[0]&=248,_(_e,V),X=0;X<16;X++)H[X]=_e[X],W[X]=Ae[X]=q[X]=0;for(Ae[0]=W[0]=1,X=254;X>=0;--X)m(Ae,H,U=ye[X>>>3]>>>(7&X)&1),m(q,W,U),C(ee,Ae,q),I(Ae,Ae,q),C(q,H,W),I(H,H,W),E(W,ee),E(le,Ae),k(Ae,q,Ae),k(q,H,ee),C(ee,Ae,q),I(Ae,Ae,q),E(H,Ae),I(q,W,le),k(Ae,q,a),C(Ae,Ae,W),k(q,q,Ae),k(Ae,W,le),k(W,H,_e),E(H,ee),m(Ae,H,U),m(q,W,U);for(X=0;X<16;X++)_e[X+16]=Ae[X],_e[X+32]=q[X],_e[X+48]=H[X],_e[X+64]=W[X];var ce=_e.subarray(32),ie=_e.subarray(16);return S(ce,ce),k(ie,ie,ce),v(j,ie),0}function P(j,re){return T(j,re,s)}function g(j,re){var V=r(),U=r(),X=r(),ye=r(),_e=r(),Ae=r(),H=r(),q=r(),W=r();I(V,j[1],j[0]),I(W,re[1],re[0]),k(V,V,W),C(U,j[0],j[1]),C(W,re[0],re[1]),k(U,U,W),k(X,j[3],re[3]),k(X,X,c),k(ye,j[2],re[2]),C(ye,ye,ye),I(_e,U,V),I(Ae,ye,X),C(H,ye,X),C(q,U,V),k(j[0],_e,Ae),k(j[1],q,H),k(j[2],H,Ae),k(j[3],_e,q)}function A(j,re,V){var U;for(U=0;U<4;U++)m(j[U],re[U],V)}function x(j,re){var V=r(),U=r(),X=r();S(X,re[2]),k(V,re[0],X),k(U,re[1],X),v(j,U),j[31]^=w(V)<<7}function D(j,re,V){var U,X;for(h(j[0],i),h(j[1],o),h(j[2],o),h(j[3],i),X=255;X>=0;--X)A(j,re,U=V[X/8|0]>>(7&X)&1),g(re,j),g(j,j),A(j,re,U)}function O(j,re){var V=[r(),r(),r(),r()];h(V[0],l),h(V[1],u),h(V[2],o),k(V[3],l,u),D(j,V,re)}function B(j,re,V){var U,X,ye=[r(),r(),r(),r()];for(V||n(re,32),(U=t.hash(re.subarray(0,32)))[0]&=248,U[31]&=127,U[31]|=64,O(ye,U),x(j,ye),X=0;X<32;X++)re[X+32]=j[X];return 0}var L=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function M(j,re){var V,U,X,ye;for(U=63;U>=32;--U){for(V=0,X=U-32,ye=U-12;X<ye;++X)re[X]+=V-16*re[U]*L[X-(U-32)],V=Math.floor((re[X]+128)/256),re[X]-=256*V;re[X]+=V,re[U]=0}for(V=0,X=0;X<32;X++)re[X]+=V-(re[31]>>4)*L[X],V=re[X]>>8,re[X]&=255;for(X=0;X<32;X++)re[X]-=V*L[X];for(U=0;U<32;U++)re[U+1]+=re[U]>>8,j[U]=255&re[U]}function R(j){var re,V=new Float64Array(64);for(re=0;re<64;re++)V[re]=j[re];for(re=0;re<64;re++)j[re]=0;M(j,V)}function N(j,re){var V=r(),U=r(),X=r(),ye=r(),_e=r(),Ae=r(),H=r();return h(j[2],o),_(j[1],re),E(X,j[1]),k(ye,X,f),I(X,X,j[2]),C(ye,j[2],ye),E(_e,ye),E(Ae,_e),k(H,Ae,_e),k(V,H,X),k(V,V,ye),function(q,W){var ee,le=r();for(ee=0;ee<16;ee++)le[ee]=W[ee];for(ee=250;ee>=0;ee--)E(le,le),ee!==1&&k(le,le,W);for(ee=0;ee<16;ee++)q[ee]=le[ee]}(V,V),k(V,V,X),k(V,V,ye),k(V,V,ye),k(j[0],V,ye),E(U,j[0]),k(U,U,ye),b(U,X)&&k(j[0],j[0],p),E(U,j[0]),k(U,U,ye),b(U,X)?-1:(w(j[0])===re[31]>>7&&I(j[0],i,j[0]),k(j[3],j[0],j[1]),0)}var F=64;function z(){for(var j=0;j<arguments.length;j++)if(!(arguments[j]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Y(j){for(var re=0;re<j.length;re++)j[re]=0}t.scalarMult=function(j,re){if(z(j,re),j.length!==32)throw Error("bad n size");if(re.length!==32)throw Error("bad p size");var V=new Uint8Array(32);return T(V,j,re),V},t.box={},t.box.keyPair=function(){var j,re,V=new Uint8Array(32),U=new Uint8Array(32);return j=V,n(re=U,32),P(j,re),{publicKey:V,secretKey:U}},t.box.keyPair.fromSecretKey=function(j){if(z(j),j.length!==32)throw Error("bad secret key size");var re=new Uint8Array(32);return P(re,j),{publicKey:re,secretKey:new Uint8Array(j)}},t.sign=function(j,re){if(z(j,re),re.length!==64)throw Error("bad secret key size");var V=new Uint8Array(F+j.length);return function(U,X,ye,_e){var Ae,H,q,W,ee,le=new Float64Array(64),ce=[r(),r(),r(),r()];(Ae=t.hash(_e.subarray(0,32)))[0]&=248,Ae[31]&=127,Ae[31]|=64;var ie=ye+64;for(W=0;W<ye;W++)U[64+W]=X[W];for(W=0;W<32;W++)U[32+W]=Ae[32+W];for(R(q=t.hash(U.subarray(32,ie))),O(ce,q),x(U,ce),W=32;W<64;W++)U[W]=_e[W];for(R(H=t.hash(U.subarray(0,ie))),W=0;W<64;W++)le[W]=0;for(W=0;W<32;W++)le[W]=q[W];for(W=0;W<32;W++)for(ee=0;ee<32;ee++)le[W+ee]+=H[W]*Ae[ee];M(U.subarray(32),le)}(V,j,j.length,re),V},t.sign.detached=function(j,re){for(var V=t.sign(j,re),U=new Uint8Array(F),X=0;X<U.length;X++)U[X]=V[X];return U},t.sign.detached.verify=function(j,re,V){if(z(j,re,V),re.length!==F)throw Error("bad signature size");if(V.length!==32)throw Error("bad public key size");var U,X=new Uint8Array(F+j.length),ye=new Uint8Array(F+j.length);for(U=0;U<F;U++)X[U]=re[U];for(U=0;U<j.length;U++)X[U+F]=j[U];return function(_e,Ae,H,q){var W,ee,le=new Uint8Array(32),ce=[r(),r(),r(),r()],ie=[r(),r(),r(),r()];if(H<64||N(ie,q))return-1;for(W=0;W<H;W++)_e[W]=Ae[W];for(W=0;W<32;W++)_e[W+32]=q[W];if(R(ee=t.hash(_e.subarray(0,H))),D(ce,ie,ee),O(ie,Ae.subarray(32)),g(ce,ie),x(le,ce),H-=64,d(Ae,0,le,0)){for(W=0;W<H;W++)_e[W]=0;return-1}for(W=0;W<H;W++)_e[W]=Ae[W+64];return H}(ye,X,X.length,V)>=0},t.sign.keyPair=function(){var j=new Uint8Array(32),re=new Uint8Array(64);return B(j,re),{publicKey:j,secretKey:re}},t.sign.keyPair.fromSecretKey=function(j){if(z(j),j.length!==64)throw Error("bad secret key size");for(var re=new Uint8Array(32),V=0;V<re.length;V++)re[V]=j[32+V];return{publicKey:re,secretKey:new Uint8Array(j)}},t.sign.keyPair.fromSeed=function(j){if(z(j),j.length!==32)throw Error("bad seed size");for(var re=new Uint8Array(32),V=new Uint8Array(64),U=0;U<32;U++)V[U]=j[U];return B(re,V,!0),{publicKey:re,secretKey:V}},t.setPRNG=function(j){n=j},function(){var j=typeof self<"u"?self.crypto||self.msCrypto:null;j&&j.getRandomValues?t.setPRNG(function(re,V){var U,X=new Uint8Array(V);for(U=0;U<V;U+=65536)j.getRandomValues(X.subarray(U,U+Math.min(V-U,65536)));for(U=0;U<V;U++)re[U]=X[U];Y(X)}):GK!==void 0&&(j=void 0)&&j.randomBytes&&t.setPRNG(function(re,V){var U,X=j.randomBytes(V);for(U=0;U<V;U++)re[U]=X[U];Y(X)})}()})(e.exports?e.exports:self.nacl=self.nacl||{})});const z3=ne.getNodeCrypto();function Bn(e){const t=new Uint8Array(e);if(z3){const r=z3.randomBytes(t.length);t.set(r)}else{if(typeof crypto>"u"||!crypto.getRandomValues)throw Error("No secure random number generator available.");crypto.getRandomValues(t)}return t}async function os(e,t){const r=await ne.getBigInteger();if(t.lt(e))throw Error("Illegal parameter value: max <= min");const n=t.sub(e),s=n.byteLength();return new r(await Bn(s+8)).mod(n).add(e)}var VF=Object.freeze({__proto__:null,getRandomBytes:Bn,getRandomBigInteger:os});async function W3(e,t,r){const n=await ne.getBigInteger(),s=new n(1),i=s.leftShift(new n(e-1)),o=new n(30),a=[1,6,5,4,3,2,1,4,3,2,1,2,1,4,3,2,1,2,1,4,3,2,1,6,5,4,3,2,1,2],f=await os(i,i.leftShift(s));let c=f.mod(o).toNumber();do f.iadd(new n(a[c])),c=(c+a[c])%a.length,f.bitLength()>e&&(f.imod(i.leftShift(s)).iadd(i),c=f.mod(o).toNumber());while(!await Q9(f,t,r));return f}async function Q9(e,t,r){return!(t&&!e.dec().gcd(t).isOne())&&!!await async function(n){const s=await ne.getBigInteger();return GF.every(i=>n.mod(new s(i))!==0)}(e)&&!!await async function(n,s){const i=await ne.getBigInteger();return s=s||new i(2),s.modExp(n.dec(),n).isOne()}(e)&&!!await async function(n,s,i){const o=await ne.getBigInteger(),a=n.bitLength();s||(s=Math.max(1,a/48|0));const f=n.dec();let c=0;for(;!f.getBit(c);)c++;const l=n.rightShift(new o(c));for(;s>0;s--){let u,p=(i?i():await os(new o(2),f)).modExp(l,n);if(!p.isOne()&&!p.equal(f)){for(u=1;u<c;u++){if(p=p.mul(p).mod(n),p.isOne())return!1;if(p.equal(f))break}if(u===c)return!1}}return!0}(e,r)}const GF=[7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083,2087,2089,2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179,2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297,2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,2411,2417,2423,2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,2549,2551,2557,2579,2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671,2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753,2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,2887,2897,2903,2909,2917,2927,2939,2953,2957,2963,2969,2971,2999,3001,3011,3019,3023,3037,3041,3049,3061,3067,3079,3083,3089,3109,3119,3121,3137,3163,3167,3169,3181,3187,3191,3203,3209,3217,3221,3229,3251,3253,3257,3259,3271,3299,3301,3307,3313,3319,3323,3329,3331,3343,3347,3359,3361,3371,3373,3389,3391,3407,3413,3433,3449,3457,3461,3463,3467,3469,3491,3499,3511,3517,3527,3529,3533,3539,3541,3547,3557,3559,3571,3581,3583,3593,3607,3613,3617,3623,3631,3637,3643,3659,3671,3673,3677,3691,3697,3701,3709,3719,3727,3733,3739,3761,3767,3769,3779,3793,3797,3803,3821,3823,3833,3847,3851,3853,3863,3877,3881,3889,3907,3911,3917,3919,3923,3929,3931,3943,3947,3967,3989,4001,4003,4007,4013,4019,4021,4027,4049,4051,4057,4073,4079,4091,4093,4099,4111,4127,4129,4133,4139,4153,4157,4159,4177,4201,4211,4217,4219,4229,4231,4241,4243,4253,4259,4261,4271,4273,4283,4289,4297,4327,4337,4339,4349,4357,4363,4373,4391,4397,4409,4421,4423,4441,4447,4451,4457,4463,4481,4483,4493,4507,4513,4517,4519,4523,4547,4549,4561,4567,4583,4591,4597,4603,4621,4637,4639,4643,4649,4651,4657,4663,4673,4679,4691,4703,4721,4723,4729,4733,4751,4759,4783,4787,4789,4793,4799,4801,4813,4817,4831,4861,4871,4877,4889,4903,4909,4919,4931,4933,4937,4943,4951,4957,4967,4969,4973,4987,4993,4999],gi=[];function ug(e,t){const r=e.length;if(r>t-11)throw Error("Message too long");const n=function(i){const o=new Uint8Array(i);let a=0;for(;a<i;){const f=Bn(i-a);for(let c=0;c<f.length;c++)f[c]!==0&&(o[a++]=f[c])}return o}(t-r-3),s=new Uint8Array(t);return s[1]=2,s.set(n,2),s.set(e,t-r),s}function lg(e,t){let r=2,n=1;for(let a=r;a<e.length;a++)n&=e[a]!==0,r+=n;const s=r-2,i=e.subarray(r+1),o=e[0]===0&e[1]===2&s>=8&!n;if(t)return ne.selectUint8Array(o,i,t);if(o)return i;throw Error("Decryption error")}async function fy(e,t,r){let n;if(t.length!==qn.getHashByteLength(e))throw Error("Invalid hash length");const s=new Uint8Array(gi[e].length);for(n=0;n<gi[e].length;n++)s[n]=gi[e][n];const i=s.length+t.length;if(r<i+11)throw Error("Intended encoded message length too short");const o=new Uint8Array(r-i-3).fill(255),a=new Uint8Array(r);return a[1]=1,a.set(o,2),a.set(s,r-i),a.set(t,r-t.length),a}gi[1]=[48,32,48,12,6,8,42,134,72,134,247,13,2,5,5,0,4,16],gi[2]=[48,33,48,9,6,5,43,14,3,2,26,5,0,4,20],gi[3]=[48,33,48,9,6,5,43,36,3,2,1,5,0,4,20],gi[8]=[48,49,48,13,6,9,96,134,72,1,101,3,4,2,1,5,0,4,32],gi[9]=[48,65,48,13,6,9,96,134,72,1,101,3,4,2,2,5,0,4,48],gi[10]=[48,81,48,13,6,9,96,134,72,1,101,3,4,2,3,5,0,4,64],gi[11]=[48,45,48,13,6,9,96,134,72,1,101,3,4,2,4,5,0,4,28];var zF=Object.freeze({__proto__:null,emeEncode:ug,emeDecode:lg,emsaEncode:fy});const Ga=ne.getWebCrypto(),an=ne.getNodeCrypto(),ew=void 0,za=an?ew.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())}):void 0,Pl=an?ew.define("RSAPubliceKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}):void 0;var WF=Object.freeze({__proto__:null,sign:async function(e,t,r,n,s,i,o,a,f){if(t&&!ne.isStream(t)){if(ne.getWebCrypto())try{return await async function(c,l,u,p,d,h,y,m){const v=await async function(_,C,I,k,E,S){const T=await ne.getBigInteger(),P=new T(k),g=new T(E),A=new T(I);let x=A.mod(g.dec()),D=A.mod(P.dec());return D=D.toUint8Array(),x=x.toUint8Array(),{kty:"RSA",n:Rn(_,!0),e:Rn(C,!0),d:Rn(I,!0),p:Rn(E,!0),q:Rn(k,!0),dp:Rn(x,!0),dq:Rn(D,!0),qi:Rn(S,!0),ext:!0}}(u,p,d,h,y,m),b={name:"RSASSA-PKCS1-v1_5",hash:{name:c}},w=await Ga.importKey("jwk",v,b,!1,["sign"]);return new Uint8Array(await Ga.sign("RSASSA-PKCS1-v1_5",w,l))}(G.read(G.webHash,e),t,r,n,s,i,o,a)}catch(c){ne.printDebugError(c)}else if(ne.getNodeCrypto())return async function(c,l,u,p,d,h,y,m){const{default:v}=await Promise.resolve().then(function(){return l0}),b=new v(h),w=new v(y),_=new v(d),C=_.mod(w.subn(1)),I=_.mod(b.subn(1)),k=an.createSign(G.read(G.hash,c));k.write(l),k.end();const E={version:0,modulus:new v(u),publicExponent:new v(p),privateExponent:new v(d),prime1:new v(y),prime2:new v(h),exponent1:C,exponent2:I,coefficient:new v(m)};if(an.createPrivateKey!==void 0){const T=za.encode(E,"der");return new Uint8Array(k.sign({key:T,format:"der",type:"pkcs1"}))}const S=za.encode(E,"pem",{label:"RSA PRIVATE KEY"});return new Uint8Array(k.sign(S))}(e,t,r,n,s,i,o,a)}return async function(c,l,u,p){const d=await ne.getBigInteger();l=new d(l);const h=new d(await fy(c,p,l.byteLength()));if(u=new d(u),h.gte(l))throw Error("Message size cannot exceed modulus size");return h.modExp(u,l).toUint8Array("be",l.byteLength())}(e,r,s,f)},verify:async function(e,t,r,n,s,i){if(t&&!ne.isStream(t)){if(ne.getWebCrypto())try{return await async function(o,a,f,c,l){const u=function(d,h){return{kty:"RSA",n:Rn(d,!0),e:Rn(h,!0),ext:!0}}(c,l),p=await Ga.importKey("jwk",u,{name:"RSASSA-PKCS1-v1_5",hash:{name:o}},!1,["verify"]);return Ga.verify("RSASSA-PKCS1-v1_5",p,f,a)}(G.read(G.webHash,e),t,r,n,s)}catch(o){ne.printDebugError(o)}else if(ne.getNodeCrypto())return async function(o,a,f,c,l){const{default:u}=await Promise.resolve().then(function(){return l0}),p=an.createVerify(G.read(G.hash,o));p.write(a),p.end();const d={modulus:new u(c),publicExponent:new u(l)};let h;an.createPrivateKey!==void 0?h={key:Pl.encode(d,"der"),format:"der",type:"pkcs1"}:h=Pl.encode(d,"pem",{label:"RSA PUBLIC KEY"});try{return await p.verify(h,f)}catch{return!1}}(e,t,r,n,s)}return async function(o,a,f,c,l){const u=await ne.getBigInteger();if(f=new u(f),a=new u(a),c=new u(c),a.gte(f))throw Error("Signature size cannot exceed modulus size");const p=a.modExp(c,f).toUint8Array("be",f.byteLength()),d=await fy(o,l,f.byteLength());return ne.equalsUint8Array(p,d)}(e,r,n,s,i)},encrypt:async function(e,t,r){return ne.getNodeCrypto()?async function(n,s,i){const{default:o}=await Promise.resolve().then(function(){return l0}),a={modulus:new o(s),publicExponent:new o(i)};let f;return an.createPrivateKey!==void 0?f={key:Pl.encode(a,"der"),format:"der",type:"pkcs1",padding:an.constants.RSA_PKCS1_PADDING}:f={key:Pl.encode(a,"pem",{label:"RSA PUBLIC KEY"}),padding:an.constants.RSA_PKCS1_PADDING},new Uint8Array(an.publicEncrypt(f,n))}(e,t,r):async function(n,s,i){const o=await ne.getBigInteger();if(s=new o(s),n=new o(ug(n,s.byteLength())),i=new o(i),n.gte(s))throw Error("Message size cannot exceed modulus size");return n.modExp(i,s).toUint8Array("be",s.byteLength())}(e,t,r)},decrypt:async function(e,t,r,n,s,i,o,a){if(ne.getNodeCrypto()&&!a)try{return await async function(f,c,l,u,p,d,h){const{default:y}=await Promise.resolve().then(function(){return l0}),m=new y(p),v=new y(d),b=new y(u),w=b.mod(v.subn(1)),_=b.mod(m.subn(1)),C={version:0,modulus:new y(c),publicExponent:new y(l),privateExponent:new y(u),prime1:new y(d),prime2:new y(p),exponent1:w,exponent2:_,coefficient:new y(h)};let I;an.createPrivateKey!==void 0?I={key:za.encode(C,"der"),format:"der",type:"pkcs1",padding:an.constants.RSA_PKCS1_PADDING}:I={key:za.encode(C,"pem",{label:"RSA PRIVATE KEY"}),padding:an.constants.RSA_PKCS1_PADDING};try{return new Uint8Array(an.privateDecrypt(I,f))}catch{throw Error("Decryption error")}}(e,t,r,n,s,i,o)}catch(f){ne.printDebugError(f)}return async function(f,c,l,u,p,d,h,y){const m=await ne.getBigInteger();if(f=new m(f),c=new m(c),l=new m(l),u=new m(u),p=new m(p),d=new m(d),h=new m(h),f.gte(c))throw Error("Data too large.");const v=u.mod(d.dec()),b=u.mod(p.dec()),w=(await os(new m(2),c)).mod(c),_=w.modInv(c).modExp(l,c);f=f.mul(_).mod(c);const C=f.modExp(b,p),I=f.modExp(v,d);let E=h.mul(I.sub(C)).mod(d).mul(p).add(C);return E=E.mul(w).mod(c),lg(E.toUint8Array("be",c.byteLength()),y)}(e,t,r,n,s,i,o,a)},generate:async function(e,t){if(t=new(await ne.getBigInteger())(t),ne.getWebCrypto()){const o={name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:t.toUint8Array(),hash:{name:"SHA-1"}},a=await Ga.generateKey(o,!0,["sign","verify"]),f=await Ga.exportKey("jwk",a.privateKey);return{n:Ji(f.n),e:t.toUint8Array(),d:Ji(f.d),p:Ji(f.q),q:Ji(f.p),u:Ji(f.qi)}}if(ne.getNodeCrypto()&&an.generateKeyPair&&za){const o={modulusLength:e,publicExponent:t.toNumber(),publicKeyEncoding:{type:"pkcs1",format:"der"},privateKeyEncoding:{type:"pkcs1",format:"der"}},a=await new Promise((f,c)=>{an.generateKeyPair("rsa",o,(l,u,p)=>{l?c(l):f(za.decode(p,"der"))})});return{n:a.modulus.toArrayLike(Uint8Array),e:a.publicExponent.toArrayLike(Uint8Array),d:a.privateExponent.toArrayLike(Uint8Array),p:a.prime2.toArrayLike(Uint8Array),q:a.prime1.toArrayLike(Uint8Array),u:a.coefficient.toArrayLike(Uint8Array)}}let r,n,s;do n=await W3(e-(e>>1),t,40),r=await W3(e>>1,t,40),s=r.mul(n);while(s.bitLength()!==e);const i=r.dec().imul(n.dec());return n.lt(r)&&([r,n]=[n,r]),{n:s.toUint8Array(),e:t.toUint8Array(),d:t.modInv(i).toUint8Array(),p:r.toUint8Array(),q:n.toUint8Array(),u:r.modInv(n).toUint8Array()}},validateParams:async function(e,t,r,n,s,i){const o=await ne.getBigInteger();if(e=new o(e),n=new o(n),s=new o(s),!n.mul(s).equal(e))return!1;const a=new o(2);if(i=new o(i),!n.mul(i).mod(s).isOne())return!1;t=new o(t),r=new o(r);const f=new o(Math.floor(e.bitLength()/3)),c=await os(a,a.leftShift(f)),l=c.mul(r).mul(t);return!(!l.mod(n.dec()).equal(c)||!l.mod(s.dec()).equal(c))}}),YF=Object.freeze({__proto__:null,encrypt:async function(e,t,r,n){const s=await ne.getBigInteger();t=new s(t),r=new s(r),n=new s(n);const i=new s(ug(e,t.byteLength())),o=await os(new s(1),t.dec());return{c1:r.modExp(o,t).toUint8Array(),c2:n.modExp(o,t).imul(i).imod(t).toUint8Array()}},decrypt:async function(e,t,r,n,s){const i=await ne.getBigInteger();return e=new i(e),t=new i(t),r=new i(r),n=new i(n),lg(e.modExp(n,r).modInv(r).imul(t).imod(r).toUint8Array("be",r.byteLength()),s)},validateParams:async function(e,t,r,n){const s=await ne.getBigInteger();e=new s(e),t=new s(t),r=new s(r);const i=new s(1);if(t.lte(i)||t.gte(e))return!1;const o=new s(e.bitLength()),a=new s(1023);if(o.lt(a)||!t.modExp(e.dec(),e).isOne())return!1;let f=t;const c=new s(1),l=new s(2).leftShift(new s(17));for(;c.lt(l);){if(f=f.mul(t).imod(e),f.isOne())return!1;c.iinc()}n=new s(n);const u=new s(2),p=await os(u.leftShift(o.dec()),u.leftShift(o)),d=e.dec().imul(p).iadd(n);return!!r.equal(t.modExp(d,e))}});class bi{constructor(t){if(t instanceof bi)this.oid=t.oid;else if(ne.isArray(t)||ne.isUint8Array(t)){if((t=new Uint8Array(t))[0]===6){if(t[1]!==t.length-2)throw Error("Length mismatch in DER encoded oid");t=t.subarray(2)}this.oid=t}else this.oid=""}read(t){if(t.length>=1){const r=t[0];if(t.length>=1+r)return this.oid=t.subarray(1,1+r),1+this.oid.length}throw Error("Invalid oid")}write(){return ne.concatUint8Array([new Uint8Array([this.oid.length]),this.oid])}toHex(){return ne.uint8ArrayToHex(this.oid)}getName(){const t=this.toHex();if(G.curve[t])return G.write(G.curve,t);throw Error("Unknown curve object identifier.")}}function Pf(e,t){return e.keyPair({priv:t})}function xf(e,t){const r=e.keyPair({pub:t});if(r.validate().result!==!0)throw Error("Invalid elliptic public key");return r}async function xo(e){if(!Qe.useIndutnyElliptic)throw Error("This curve is only supported in the full build of OpenPGP.js");const{default:t}=await Promise.resolve().then(function(){return O$});return new t.ec(e)}function tw(e){let t,r=0;const n=e[0];return n<192?([r]=e,t=1):n<255?(r=(e[0]-192<<8)+e[1]+192,t=2):n===255&&(r=ne.readNumber(e.subarray(1,5)),t=5),{len:r,offset:t}}function Y0(e){return e<192?new Uint8Array([e]):e>191&&e<8384?new Uint8Array([192+(e-192>>8),e-192&255]):ne.concatUint8Array([new Uint8Array([255]),ne.writeNumber(e,4)])}function ZF(e){if(e<0||e>30)throw Error("Partial Length power must be between 1 and 30");return new Uint8Array([224+e])}function rw(e){return new Uint8Array([192|e])}function Y3(e,t){return ne.concatUint8Array([rw(e),Y0(t)])}function fd(e){return[G.packet.literalData,G.packet.compressedData,G.packet.symmetricallyEncryptedData,G.packet.symEncryptedIntegrityProtectedData,G.packet.aeadEncryptedData].includes(e)}async function JF(e,t){const r=Mi(e);let n,s;try{const i=await r.peekBytes(2);if(!i||i.length<2||!(128&i[0]))throw Error("Error during parsing. This message / key probably does not conform to a valid OpenPGP format.");const o=await r.readByte();let a,f,c=-1,l=-1;l=0,64&o&&(l=1),l?c=63&o:(c=(63&o)>>2,f=3&o);const u=fd(c);let p,d=null;if(u){if(ne.isStream(e)==="array"){const y=new Ai;n=Sn(y),d=y}else{const y=new bo;n=Sn(y.writable),d=y.readable}s=t({tag:c,packet:d})}else d=[];do{if(l){const y=await r.readByte();if(p=!1,y<192)a=y;else if(y>=192&&y<224)a=(y-192<<8)+await r.readByte()+192;else if(y>223&&y<255){if(a=1<<(31&y),p=!0,!u)throw new TypeError("This packet type does not support partial lengths.")}else a=await r.readByte()<<24|await r.readByte()<<16|await r.readByte()<<8|await r.readByte()}else switch(f){case 0:a=await r.readByte();break;case 1:a=await r.readByte()<<8|await r.readByte();break;case 2:a=await r.readByte()<<24|await r.readByte()<<16|await r.readByte()<<8|await r.readByte();break;default:a=1/0}if(a>0){let y=0;for(;;){n&&await n.ready;const{done:m,value:v}=await r.read();if(m){if(a===1/0)break;throw Error("Unexpected end of packet")}const b=a===1/0?v:v.subarray(0,a-y);if(n?await n.write(b):d.push(b),y+=v.length,y>=a){r.unshift(v.subarray(a-y+v.length));break}}}}while(p);const h=await r.peekBytes(u?1/0:2);return n?(await n.ready,await n.close()):(d=ne.concatUint8Array(d),await t({tag:c,packet:d})),!h||!h.length}catch(i){if(n)return await n.abort(i),!0;throw i}finally{n&&await s,r.releaseLock()}}let gr=class nw extends Error{constructor(...t){super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,nw),this.name="UnsupportedError"}};class Md{constructor(t,r){this.tag=t,this.rawContent=r}write(){return this.rawContent}}const i1=ne.getWebCrypto(),Nd=ne.getNodeCrypto(),Ii={p256:"P-256",p384:"P-384",p521:"P-521"},Fi=Nd?Nd.getCurves():[],_s=Nd?{secp256k1:Fi.includes("secp256k1")?"secp256k1":void 0,p256:Fi.includes("prime256v1")?"prime256v1":void 0,p384:Fi.includes("secp384r1")?"secp384r1":void 0,p521:Fi.includes("secp521r1")?"secp521r1":void 0,ed25519:Fi.includes("ED25519")?"ED25519":void 0,curve25519:Fi.includes("X25519")?"X25519":void 0,brainpoolP256r1:Fi.includes("brainpoolP256r1")?"brainpoolP256r1":void 0,brainpoolP384r1:Fi.includes("brainpoolP384r1")?"brainpoolP384r1":void 0,brainpoolP512r1:Fi.includes("brainpoolP512r1")?"brainpoolP512r1":void 0}:{},hd={p256:{oid:[6,8,42,134,72,206,61,3,1,7],keyType:G.publicKey.ecdsa,hash:G.hash.sha256,cipher:G.symmetric.aes128,node:_s.p256,web:Ii.p256,payloadSize:32,sharedSize:256},p384:{oid:[6,5,43,129,4,0,34],keyType:G.publicKey.ecdsa,hash:G.hash.sha384,cipher:G.symmetric.aes192,node:_s.p384,web:Ii.p384,payloadSize:48,sharedSize:384},p521:{oid:[6,5,43,129,4,0,35],keyType:G.publicKey.ecdsa,hash:G.hash.sha512,cipher:G.symmetric.aes256,node:_s.p521,web:Ii.p521,payloadSize:66,sharedSize:528},secp256k1:{oid:[6,5,43,129,4,0,10],keyType:G.publicKey.ecdsa,hash:G.hash.sha256,cipher:G.symmetric.aes128,node:_s.secp256k1,payloadSize:32},ed25519:{oid:[6,9,43,6,1,4,1,218,71,15,1],keyType:G.publicKey.eddsaLegacy,hash:G.hash.sha512,node:!1,payloadSize:32},curve25519:{oid:[6,10,43,6,1,4,1,151,85,1,5,1],keyType:G.publicKey.ecdh,hash:G.hash.sha256,cipher:G.symmetric.aes128,node:!1,payloadSize:32},brainpoolP256r1:{oid:[6,9,43,36,3,3,2,8,1,1,7],keyType:G.publicKey.ecdsa,hash:G.hash.sha256,cipher:G.symmetric.aes128,node:_s.brainpoolP256r1,payloadSize:32},brainpoolP384r1:{oid:[6,9,43,36,3,3,2,8,1,1,11],keyType:G.publicKey.ecdsa,hash:G.hash.sha384,cipher:G.symmetric.aes192,node:_s.brainpoolP384r1,payloadSize:48},brainpoolP512r1:{oid:[6,9,43,36,3,3,2,8,1,1,13],keyType:G.publicKey.ecdsa,hash:G.hash.sha512,cipher:G.symmetric.aes256,node:_s.brainpoolP512r1,payloadSize:64}};class cs{constructor(t,r){try{(ne.isArray(t)||ne.isUint8Array(t))&&(t=new bi(t)),t instanceof bi&&(t=t.getName()),this.name=G.write(G.curve,t)}catch{throw new gr("Unknown curve")}r=r||hd[this.name],this.keyType=r.keyType,this.oid=r.oid,this.hash=r.hash,this.cipher=r.cipher,this.node=r.node&&hd[this.name],this.web=r.web&&hd[this.name],this.payloadSize=r.payloadSize,this.web&&ne.getWebCrypto()?this.type="web":this.node&&ne.getNodeCrypto()?this.type="node":this.name==="curve25519"?this.type="curve25519":this.name==="ed25519"&&(this.type="ed25519")}async genKeyPair(){let t;switch(this.type){case"web":try{return await async function(n){const s=await i1.generateKey({name:"ECDSA",namedCurve:Ii[n]},!0,["sign","verify"]),i=await i1.exportKey("jwk",s.privateKey),o=await i1.exportKey("jwk",s.publicKey);return{publicKey:sw(o),privateKey:Ji(i.d)}}(this.name)}catch(n){ne.printDebugError("Browser did not support generating ec key "+n.message);break}case"node":return async function(n){const s=Nd.createECDH(_s[n]);return await s.generateKeys(),{publicKey:new Uint8Array(s.getPublicKey()),privateKey:new Uint8Array(s.getPrivateKey())}}(this.name);case"curve25519":{const n=Bn(32);n[0]=127&n[0]|64,n[31]&=248;const s=n.slice().reverse();return t=xr.box.keyPair.fromSecretKey(s),{publicKey:ne.concatUint8Array([new Uint8Array([64]),t.publicKey]),privateKey:n}}case"ed25519":{const n=Bn(32),s=xr.sign.keyPair.fromSeed(n);return{publicKey:ne.concatUint8Array([new Uint8Array([64]),s.publicKey]),privateKey:n}}}return t=await(await xo(this.name)).genKeyPair({entropy:ne.uint8ArrayToString(Bn(32))}),{publicKey:new Uint8Array(t.getPublic("array",!1)),privateKey:t.getPrivate().toArrayLike(Uint8Array)}}}async function iw(e,t,r,n){const s={p256:!0,p384:!0,p521:!0,secp256k1:!0,curve25519:e===G.publicKey.ecdh,brainpoolP256r1:!0,brainpoolP384r1:!0,brainpoolP512r1:!0},i=t.getName();if(!s[i])return!1;if(i==="curve25519"){n=n.slice().reverse();const{publicKey:a}=xr.box.keyPair.fromSecretKey(n);r=new Uint8Array(r);const f=new Uint8Array([64,...a]);return!!ne.equalsUint8Array(f,r)}const o=await xo(i);try{r=xf(o,r).getPublic()}catch{return!1}return!!Pf(o,n).getPublic().eq(r)}function sw(e){const t=Ji(e.x),r=Ji(e.y),n=new Uint8Array(t.length+r.length+1);return n[0]=4,n.set(t,1),n.set(r,t.length+1),n}function Tf(e,t,r){const n=e,s=r.slice(1,n+1),i=r.slice(n+1,2*n+1);return{kty:"EC",crv:t,x:Rn(s,!0),y:Rn(i,!0),ext:!0}}function aw(e,t,r,n){const s=Tf(e,t,r);return s.d=Rn(n,!0),s}const Ud=ne.getWebCrypto(),To=ne.getNodeCrypto();async function Z3(e,t,r,n,s,i){const o=new cs(e);if(r&&!ne.isStream(r)){const a={publicKey:n,privateKey:s};switch(o.type){case"web":try{return await async function(f,c,l,u){const p=f.payloadSize,d=aw(f.payloadSize,Ii[f.name],u.publicKey,u.privateKey),h=await Ud.importKey("jwk",d,{name:"ECDSA",namedCurve:Ii[f.name],hash:{name:G.read(G.webHash,f.hash)}},!1,["sign"]),y=new Uint8Array(await Ud.sign({name:"ECDSA",namedCurve:Ii[f.name],hash:{name:G.read(G.webHash,c)}},h,l));return{r:y.slice(0,p),s:y.slice(p,p<<1)}}(o,t,r,a)}catch(f){if(o.name!=="p521"&&(f.name==="DataError"||f.name==="OperationError"))throw f;ne.printDebugError("Browser did not support signing: "+f.message)}break;case"node":{const f=await async function(c,l,u,p){const d=To.createSign(G.read(G.hash,l));d.write(u),d.end();const h=XF.encode({version:1,parameters:c.oid,privateKey:Array.from(p.privateKey),publicKey:{unused:0,data:Array.from(p.publicKey)}},"pem",{label:"EC PRIVATE KEY"});return ow.decode(d.sign(h),"der")}(o,t,r,a);return{r:f.r.toArrayLike(Uint8Array),s:f.s.toArrayLike(Uint8Array)}}}}return async function(a,f,c){const l=await xo(a.name),u=Pf(l,c),p=u.sign(f);return{r:p.r.toArrayLike(Uint8Array),s:p.s.toArrayLike(Uint8Array)}}(o,i,s)}async function J3(e,t,r,n,s,i){const o=new cs(e);if(n&&!ne.isStream(n))switch(o.type){case"web":try{return await async function(a,f,{r:c,s:l},u,p){const d=Tf(a.payloadSize,Ii[a.name],p),h=await Ud.importKey("jwk",d,{name:"ECDSA",namedCurve:Ii[a.name],hash:{name:G.read(G.webHash,a.hash)}},!1,["verify"]),y=ne.concatUint8Array([c,l]).buffer;return Ud.verify({name:"ECDSA",namedCurve:Ii[a.name],hash:{name:G.read(G.webHash,f)}},h,y,u)}(o,t,r,n,s)}catch(a){if(o.name!=="p521"&&(a.name==="DataError"||a.name==="OperationError"))throw a;ne.printDebugError("Browser did not support verifying: "+a.message)}break;case"node":return async function(a,f,{r:c,s:l},u,p){const{default:d}=await Promise.resolve().then(function(){return l0}),h=To.createVerify(G.read(G.hash,f));h.write(u),h.end();const y=eq.encode({algorithm:{algorithm:[1,2,840,10045,2,1],parameters:a.oid},subjectPublicKey:{unused:0,data:Array.from(p)}},"pem",{label:"PUBLIC KEY"}),m=ow.encode({r:new d(c),s:new d(l)},"der");try{return h.verify(y,m)}catch{return!1}}(o,t,r,n,s)}return async function(a,f,c,l){const u=await xo(a.name);return xf(u,l).verify(c,f)}(o,r,t===void 0?n:i,s)}const Cf=void 0,ow=To?Cf.define("ECDSASignature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())}):void 0,XF=To?Cf.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").explicit(0).optional().any(),this.key("publicKey").explicit(1).optional().bitstr())}):void 0,QF=To?Cf.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional().any())}):void 0,eq=To?Cf.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(QF),this.key("subjectPublicKey").bitstr())}):void 0;var tq=Object.freeze({__proto__:null,sign:Z3,verify:J3,validateParams:async function(e,t,r){const n=new cs(e);if(n.keyType!==G.publicKey.ecdsa)return!1;switch(n.type){case"web":case"node":{const s=Bn(8),i=G.hash.sha256,o=await qn.digest(i,s);try{const a=await Z3(e,i,s,t,r,o);return await J3(e,i,a,s,t,o)}catch{return!1}}default:return iw(G.publicKey.ecdsa,e,t,r)}}});xr.hash=e=>new Uint8Array(Po().update(e).digest());var rq=Object.freeze({__proto__:null,sign:async function(e,t,r,n,s,i){if(qn.getHashByteLength(t)<qn.getHashByteLength(G.hash.sha256))throw Error("Hash algorithm too weak for EdDSA.");const o=ne.concatUint8Array([s,n.subarray(1)]),a=xr.sign.detached(i,o);return{r:a.subarray(0,32),s:a.subarray(32)}},verify:async function(e,t,{r,s:n},s,i,o){if(qn.getHashByteLength(t)<qn.getHashByteLength(G.hash.sha256))throw Error("Hash algorithm too weak for EdDSA.");const a=ne.concatUint8Array([r,n]);return xr.sign.detached.verify(o,a,i.subarray(1))},validateParams:async function(e,t,r){if(e.getName()!=="ed25519")return!1;const{publicKey:n}=xr.sign.keyPair.fromSeed(r),s=new Uint8Array([64,...n]);return ne.equalsUint8Array(t,s)}});function s1(e){if(e===G.publicKey.ed25519)return G.hash.sha256;throw Error("Unknown EdDSA algo")}xr.hash=e=>new Uint8Array(Po().update(e).digest());var nq=Object.freeze({__proto__:null,generate:async function(e){if(e===G.publicKey.ed25519){const t=Bn(32),{publicKey:r}=xr.sign.keyPair.fromSeed(t);return{A:r,seed:t}}throw Error("Unsupported EdDSA algorithm")},sign:async function(e,t,r,n,s,i){if(qn.getHashByteLength(t)<qn.getHashByteLength(s1(e)))throw Error("Hash algorithm too weak for EdDSA.");switch(e){case G.publicKey.ed25519:{const o=ne.concatUint8Array([s,n]);return{RS:xr.sign.detached(i,o)}}case G.publicKey.ed448:default:throw Error("Unsupported EdDSA algorithm")}},verify:async function(e,t,{RS:r},n,s,i){if(qn.getHashByteLength(t)<qn.getHashByteLength(s1(e)))throw Error("Hash algorithm too weak for EdDSA.");switch(e){case G.publicKey.ed25519:return xr.sign.detached.verify(i,r,s);case G.publicKey.ed448:default:throw Error("Unsupported EdDSA algorithm")}},validateParams:async function(e,t,r){switch(e){case G.publicKey.ed25519:{const{publicKey:n}=xr.sign.keyPair.fromSeed(r);return ne.equalsUint8Array(t,n)}case G.publicKey.ed448:default:return!1}},getPreferredHashAlgo:s1});function dg(e,t){const r=new z0["aes"+8*e.length](e),n=new Uint32Array([2795939494,2795939494]),s=Ld(t);let i=n;const o=s,a=s.length/2,f=new Uint32Array([0,0]);let c=new Uint32Array(4);for(let l=0;l<=5;++l)for(let u=0;u<a;++u)f[1]=a*l+(1+u),c[0]=i[0],c[1]=i[1],c[2]=o[2*u],c[3]=o[2*u+1],c=Ld(r.encrypt(Kd(c))),i=c.subarray(0,2),i[0]^=f[0],i[1]^=f[1],o[2*u]=c[2],o[2*u+1]=c[3];return Kd(i,o)}function fg(e,t){const r=new z0["aes"+8*e.length](e),n=new Uint32Array([2795939494,2795939494]),s=Ld(t);let i=s.subarray(0,2);const o=s.subarray(2),a=s.length/2-1,f=new Uint32Array([0,0]);let c=new Uint32Array(4);for(let l=5;l>=0;--l)for(let u=a-1;u>=0;--u)f[1]=a*l+(u+1),c[0]=i[0]^f[0],c[1]=i[1]^f[1],c[2]=o[2*u],c[3]=o[2*u+1],c=Ld(r.decrypt(Kd(c))),i=c.subarray(0,2),o[2*u]=c[2],o[2*u+1]=c[3];if(i[0]===n[0]&&i[1]===n[1])return Kd(o);throw Error("Key Data Integrity failed")}function Ld(e){const{length:t}=e,r=function(i){if(ne.isString(i)){const{length:o}=i,a=new ArrayBuffer(o),f=new Uint8Array(a);for(let c=0;c<o;++c)f[c]=i.charCodeAt(c);return a}return new Uint8Array(i).buffer}(e),n=new DataView(r),s=new Uint32Array(t/4);for(let i=0;i<t/4;++i)s[i]=n.getUint32(4*i);return s}function Kd(){let e=0;for(let s=0;s<arguments.length;++s)e+=4*arguments[s].length;const t=new ArrayBuffer(e),r=new DataView(t);let n=0;for(let s=0;s<arguments.length;++s){for(let i=0;i<arguments[s].length;++i)r.setUint32(n+4*i,arguments[s][i]);n+=4*arguments[s].length}return new Uint8Array(t)}var iq=Object.freeze({__proto__:null,wrap:dg,unwrap:fg});function cw(e){const t=8-e.length%8,r=new Uint8Array(e.length+t).fill(t);return r.set(e),r}function uw(e){const t=e.length;if(t>0){const r=e[t-1];if(r>=1){const n=e.subarray(t-r),s=new Uint8Array(r).fill(r);if(ne.equalsUint8Array(n,s))return e.subarray(0,t-r)}}throw Error("Invalid padding")}var sq=Object.freeze({__proto__:null,encode:cw,decode:uw});const Os=ne.getWebCrypto(),lw=ne.getNodeCrypto();function X3(e,t,r,n){return ne.concatUint8Array([t.write(),new Uint8Array([e]),r.write(),ne.stringToUint8Array("Anonymous Sender "),n.subarray(0,20)])}async function Q3(e,t,r,n,s=!1,i=!1){let o;if(s){for(o=0;o<t.length&&t[o]===0;o++);t=t.subarray(o)}if(i){for(o=t.length-1;o>=0&&t[o]===0;o--);t=t.subarray(0,o+1)}return(await qn.digest(e,ne.concatUint8Array([new Uint8Array([0,0,0,1]),t,n]))).subarray(0,r)}async function aq(e,t){switch(e.type){case"curve25519":{const r=Bn(32),{secretKey:n,sharedKey:s}=await dw(e,t,null,r);let{publicKey:i}=xr.box.keyPair.fromSecretKey(n);return i=ne.concatUint8Array([new Uint8Array([64]),i]),{publicKey:i,sharedKey:s}}case"web":if(e.web&&ne.getWebCrypto())try{return await async function(r,n){const s=Tf(r.payloadSize,r.web.web,n);let i=Os.generateKey({name:"ECDH",namedCurve:r.web.web},!0,["deriveKey","deriveBits"]),o=Os.importKey("jwk",s,{name:"ECDH",namedCurve:r.web.web},!1,[]);[i,o]=await Promise.all([i,o]);let a=Os.deriveBits({name:"ECDH",namedCurve:r.web.web,public:o},i.privateKey,r.web.sharedSize),f=Os.exportKey("jwk",i.publicKey);[a,f]=await Promise.all([a,f]);const c=new Uint8Array(a);return{publicKey:new Uint8Array(sw(f)),sharedKey:c}}(e,t)}catch(r){ne.printDebugError(r)}break;case"node":return async function(r,n){const s=lw.createECDH(r.node.node);s.generateKeys();const i=new Uint8Array(s.computeSecret(n));return{publicKey:new Uint8Array(s.getPublicKey()),sharedKey:i}}(e,t)}return async function(r,n){const s=await xo(r.name),i=await r.genKeyPair();n=xf(s,n);const o=Pf(s,i.privateKey),a=i.publicKey,f=o.derive(n.getPublic()),c=s.curve.p.byteLength(),l=f.toArrayLike(Uint8Array,"be",c);return{publicKey:a,sharedKey:l}}(e,t)}async function dw(e,t,r,n){if(n.length!==e.payloadSize){const s=new Uint8Array(e.payloadSize);s.set(n,e.payloadSize-n.length),n=s}switch(e.type){case"curve25519":{const s=n.slice().reverse();return{secretKey:s,sharedKey:xr.scalarMult(s,t.subarray(1))}}case"web":if(e.web&&ne.getWebCrypto())try{return await async function(s,i,o,a){const f=aw(s.payloadSize,s.web.web,o,a);let c=Os.importKey("jwk",f,{name:"ECDH",namedCurve:s.web.web},!0,["deriveKey","deriveBits"]);const l=Tf(s.payloadSize,s.web.web,i);let u=Os.importKey("jwk",l,{name:"ECDH",namedCurve:s.web.web},!0,[]);[c,u]=await Promise.all([c,u]);let p=Os.deriveBits({name:"ECDH",namedCurve:s.web.web,public:u},c,s.web.sharedSize),d=Os.exportKey("jwk",c);[p,d]=await Promise.all([p,d]);const h=new Uint8Array(p);return{secretKey:Ji(d.d),sharedKey:h}}(e,t,r,n)}catch(s){ne.printDebugError(s)}break;case"node":return async function(s,i,o){const a=lw.createECDH(s.node.node);a.setPrivateKey(o);const f=new Uint8Array(a.computeSecret(i));return{secretKey:new Uint8Array(a.getPrivateKey()),sharedKey:f}}(e,t,n)}return async function(s,i,o){const a=await xo(s.name);i=xf(a,i),o=Pf(a,o);const f=new Uint8Array(o.getPrivate()),c=o.derive(i.getPublic()),l=a.curve.p.byteLength(),u=c.toArrayLike(Uint8Array,"be",l);return{secretKey:f,sharedKey:u}}(e,t,n)}var oq=Object.freeze({__proto__:null,validateParams:async function(e,t,r){return iw(G.publicKey.ecdh,e,t,r)},encrypt:async function(e,t,r,n,s){const i=cw(r),o=new cs(e),{publicKey:a,sharedKey:f}=await aq(o,n),c=X3(G.publicKey.ecdh,e,t,s),{keySize:l}=Ci(t.cipher);return{publicKey:a,wrappedKey:dg(await Q3(t.hash,f,l,c),i)}},decrypt:async function(e,t,r,n,s,i,o){const a=new cs(e),{sharedKey:f}=await dw(a,r,s,i),c=X3(G.publicKey.ecdh,e,t,o),{keySize:l}=Ci(t.cipher);let u;for(let p=0;p<3;p++)try{return uw(fg(await Q3(t.hash,f,l,c,p===1,p===2),n))}catch(d){u=d}throw u}});const ev=ne.getWebCrypto(),v0=ne.getNodeCrypto(),tv=v0&&v0.webcrypto&&v0.webcrypto.subtle;async function rv(e,t,r,n,s){const i=G.read(G.webHash,e);if(!i)throw Error("Hash algo not supported with HKDF");if(ev||tv){const o=ev||tv,a=await o.importKey("raw",t,"HKDF",!1,["deriveBits"]),f=await o.deriveBits({name:"HKDF",hash:i,salt:r,info:n},a,8*s);return new Uint8Array(f)}if(v0){const o=G.read(G.hash,e),a=(d,h)=>v0.createHmac(o,d).update(h).digest(),f=a(r,t),c=f.length,l=Math.ceil(s/c),u=new Uint8Array(l*c),p=new Uint8Array(c+n.length+1);p.set(n,c);for(let d=0;d<l;d++){p[p.length-1]=d+1;const h=a(f,d>0?p:p.subarray(c));p.set(h,0),u.set(h,d*c)}return u.subarray(0,s)}throw Error("No HKDF implementation available")}const nv={x25519:ne.encodeUTF8("OpenPGP X25519")};var cq=Object.freeze({__proto__:null,generate:async function(e){if(e===G.publicKey.x25519){const t=Bn(32),{publicKey:r}=xr.box.keyPair.fromSecretKey(t);return{A:r,k:t}}throw Error("Unsupported ECDH algorithm")},validateParams:async function(e,t,r){if(e===G.publicKey.x25519){const{publicKey:n}=xr.box.keyPair.fromSecretKey(r);return ne.equalsUint8Array(t,n)}return!1},encrypt:async function(e,t,r){if(e===G.publicKey.x25519){const n=Bn(32),s=xr.scalarMult(n,r),{publicKey:i}=xr.box.keyPair.fromSecretKey(n),o=ne.concatUint8Array([i,r,s]),{keySize:a}=Ci(G.symmetric.aes128);return{ephemeralPublicKey:i,wrappedKey:dg(await rv(G.hash.sha256,o,new Uint8Array,nv.x25519,a),t)}}throw Error("Unsupported ECDH algorithm")},decrypt:async function(e,t,r,n,s){if(e===G.publicKey.x25519){const i=xr.scalarMult(s,t),o=ne.concatUint8Array([t,n,i]),{keySize:a}=Ci(G.symmetric.aes128);return fg(await rv(G.hash.sha256,o,new Uint8Array,nv.x25519,a),r)}throw Error("Unsupported ECDH algorithm")}}),uq=Object.freeze({__proto__:null,CurveWithOID:cs,ecdh:oq,ecdhX:cq,ecdsa:tq,eddsaLegacy:rq,eddsa:nq,generate:async function(e){const t=await ne.getBigInteger();e=new cs(e);const r=await e.genKeyPair(),n=new t(r.publicKey).toUint8Array(),s=new t(r.privateKey).toUint8Array("be",e.payloadSize);return{oid:e.oid,Q:n,secret:s,hash:e.hash,cipher:e.cipher}},getPreferredHashAlgo:function(e){return hd[G.write(G.curve,e.toHex())].hash}}),lq=Object.freeze({__proto__:null,sign:async function(e,t,r,n,s,i){const o=await ne.getBigInteger(),a=new o(1);let f,c,l,u;n=new o(n),s=new o(s),r=new o(r),i=new o(i),r=r.mod(n),i=i.mod(s);const p=new o(t.subarray(0,s.byteLength())).mod(s);for(;;){if(f=await os(a,s),c=r.modExp(f,n).imod(s),c.isZero())continue;const d=i.mul(c).imod(s);if(u=p.add(d).imod(s),l=f.modInv(s).imul(u).imod(s),!l.isZero())break}return{r:c.toUint8Array("be",s.byteLength()),s:l.toUint8Array("be",s.byteLength())}},verify:async function(e,t,r,n,s,i,o,a){const f=await ne.getBigInteger(),c=new f(0);if(t=new f(t),r=new f(r),i=new f(i),o=new f(o),s=new f(s),a=new f(a),t.lte(c)||t.gte(o)||r.lte(c)||r.gte(o))return ne.printDebug("invalid DSA Signature"),!1;const l=new f(n.subarray(0,o.byteLength())).imod(o),u=r.modInv(o);if(u.isZero())return ne.printDebug("invalid DSA Signature"),!1;s=s.mod(i),a=a.mod(i);const p=l.mul(u).imod(o),d=t.mul(u).imod(o),h=s.modExp(p,i),y=a.modExp(d,i);return h.mul(y).imod(i).imod(o).equal(t)},validateParams:async function(e,t,r,n,s){const i=await ne.getBigInteger();e=new i(e),t=new i(t),r=new i(r),n=new i(n);const o=new i(1);if(r.lte(o)||r.gte(e)||!e.dec().mod(t).isZero()||!r.modExp(t,e).isOne())return!1;const a=new i(t.bitLength()),f=new i(150);if(a.lt(f)||!await Q9(t,null,32))return!1;s=new i(s);const c=new i(2),l=await os(c.leftShift(a.dec()),c.leftShift(a)),u=t.mul(l).add(s);return!!n.equal(r.modExp(u,e))}}),$t={rsa:WF,elgamal:YF,elliptic:uq,dsa:lq,nacl:xr},dq=Object.freeze({__proto__:null,parseSignatureParams:function(e,t){let r=0;switch(e){case G.publicKey.rsaEncryptSign:case G.publicKey.rsaEncrypt:case G.publicKey.rsaSign:return{s:ne.readMPI(t.subarray(r))};case G.publicKey.dsa:case G.publicKey.ecdsa:{const n=ne.readMPI(t.subarray(r));return r+=n.length+2,{r:n,s:ne.readMPI(t.subarray(r))}}case G.publicKey.eddsaLegacy:{let n=ne.readMPI(t.subarray(r));r+=n.length+2,n=ne.leftPad(n,32);let s=ne.readMPI(t.subarray(r));return s=ne.leftPad(s,32),{r:n,s}}case G.publicKey.ed25519:{const n=t.subarray(r,r+64);return r+=n.length,{RS:n}}default:throw new gr("Unknown signature algorithm.")}},verify:async function(e,t,r,n,s,i){switch(e){case G.publicKey.rsaEncryptSign:case G.publicKey.rsaEncrypt:case G.publicKey.rsaSign:{const{n:o,e:a}=n,f=ne.leftPad(r.s,o.length);return $t.rsa.verify(t,s,f,o,a,i)}case G.publicKey.dsa:{const{g:o,p:a,q:f,y:c}=n,{r:l,s:u}=r;return $t.dsa.verify(t,l,u,i,o,a,f,c)}case G.publicKey.ecdsa:{const{oid:o,Q:a}=n,f=new $t.elliptic.CurveWithOID(o).payloadSize,c=ne.leftPad(r.r,f),l=ne.leftPad(r.s,f);return $t.elliptic.ecdsa.verify(o,t,{r:c,s:l},s,a,i)}case G.publicKey.eddsaLegacy:{const{oid:o,Q:a}=n;return $t.elliptic.eddsaLegacy.verify(o,t,r,s,a,i)}case G.publicKey.ed25519:{const{A:o}=n;return $t.elliptic.eddsa.verify(e,t,r,s,o,i)}default:throw Error("Unknown signature algorithm.")}},sign:async function(e,t,r,n,s,i){if(!r||!n)throw Error("Missing key parameters");switch(e){case G.publicKey.rsaEncryptSign:case G.publicKey.rsaEncrypt:case G.publicKey.rsaSign:{const{n:o,e:a}=r,{d:f,p:c,q:l,u}=n;return{s:await $t.rsa.sign(t,s,o,a,f,c,l,u,i)}}case G.publicKey.dsa:{const{g:o,p:a,q:f}=r,{x:c}=n;return $t.dsa.sign(t,i,o,a,f,c)}case G.publicKey.elgamal:throw Error("Signing with Elgamal is not defined in the OpenPGP standard.");case G.publicKey.ecdsa:{const{oid:o,Q:a}=r,{d:f}=n;return $t.elliptic.ecdsa.sign(o,t,s,a,f,i)}case G.publicKey.eddsaLegacy:{const{oid:o,Q:a}=r,{seed:f}=n;return $t.elliptic.eddsaLegacy.sign(o,t,s,a,f,i)}case G.publicKey.ed25519:{const{A:o}=r,{seed:a}=n;return $t.elliptic.eddsa.sign(e,t,s,o,a,i)}default:throw Error("Unknown signature algorithm.")}}});class iv{constructor(t){t&&(this.data=t)}read(t){if(t.length>=1){const r=t[0];if(t.length>=1+r)return this.data=t.subarray(1,1+r),1+this.data.length}throw Error("Invalid symmetric key")}write(){return ne.concatUint8Array([new Uint8Array([this.data.length]),this.data])}}class sv{constructor(t){if(t){const{hash:r,cipher:n}=t;this.hash=r,this.cipher=n}else this.hash=null,this.cipher=null}read(t){if(t.length<4||t[0]!==3||t[1]!==1)throw new gr("Cannot read KDFParams");return this.hash=t[2],this.cipher=t[3],4}write(){return new Uint8Array([3,1,this.hash,this.cipher])}}class Fd{static fromObject({wrappedKey:t,algorithm:r}){const n=new Fd;return n.wrappedKey=t,n.algorithm=r,n}read(t){let r=0,n=t[r++];this.algorithm=n%2?t[r++]:null,n-=n%2,this.wrappedKey=t.subarray(r,r+n),r+=n}write(){return ne.concatUint8Array([this.algorithm?new Uint8Array([this.wrappedKey.length+1,this.algorithm]):new Uint8Array([this.wrappedKey.length]),this.wrappedKey])}}function a1(e){try{e.getName()}catch{throw new gr("Unknown curve OID")}}var fq=Object.freeze({__proto__:null,publicKeyEncrypt:async function(e,t,r,n,s){switch(e){case G.publicKey.rsaEncrypt:case G.publicKey.rsaEncryptSign:{const{n:i,e:o}=r;return{c:await $t.rsa.encrypt(n,i,o)}}case G.publicKey.elgamal:{const{p:i,g:o,y:a}=r;return $t.elgamal.encrypt(n,i,o,a)}case G.publicKey.ecdh:{const{oid:i,Q:o,kdfParams:a}=r,{publicKey:f,wrappedKey:c}=await $t.elliptic.ecdh.encrypt(i,a,n,o,s);return{V:f,C:new iv(c)}}case G.publicKey.x25519:{if(!ne.isAES(t))throw Error("X25519 keys can only encrypt AES session keys");const{A:i}=r,{ephemeralPublicKey:o,wrappedKey:a}=await $t.elliptic.ecdhX.encrypt(e,n,i);return{ephemeralPublicKey:o,C:Fd.fromObject({algorithm:t,wrappedKey:a})}}default:return[]}},publicKeyDecrypt:async function(e,t,r,n,s,i){switch(e){case G.publicKey.rsaEncryptSign:case G.publicKey.rsaEncrypt:{const{c:o}=n,{n:a,e:f}=t,{d:c,p:l,q:u,u:p}=r;return $t.rsa.decrypt(o,a,f,c,l,u,p,i)}case G.publicKey.elgamal:{const{c1:o,c2:a}=n,f=t.p,c=r.x;return $t.elgamal.decrypt(o,a,f,c,i)}case G.publicKey.ecdh:{const{oid:o,Q:a,kdfParams:f}=t,{d:c}=r,{V:l,C:u}=n;return $t.elliptic.ecdh.decrypt(o,f,l,u.data,a,c,s)}case G.publicKey.x25519:{const{A:o}=t,{k:a}=r,{ephemeralPublicKey:f,C:c}=n;if(!ne.isAES(c.algorithm))throw Error("AES session key expected");return $t.elliptic.ecdhX.decrypt(e,f,c.wrappedKey,o,a)}default:throw Error("Unknown public key encryption algorithm.")}},parsePublicKeyParams:function(e,t){let r=0;switch(e){case G.publicKey.rsaEncrypt:case G.publicKey.rsaEncryptSign:case G.publicKey.rsaSign:{const n=ne.readMPI(t.subarray(r));r+=n.length+2;const s=ne.readMPI(t.subarray(r));return r+=s.length+2,{read:r,publicParams:{n,e:s}}}case G.publicKey.dsa:{const n=ne.readMPI(t.subarray(r));r+=n.length+2;const s=ne.readMPI(t.subarray(r));r+=s.length+2;const i=ne.readMPI(t.subarray(r));r+=i.length+2;const o=ne.readMPI(t.subarray(r));return r+=o.length+2,{read:r,publicParams:{p:n,q:s,g:i,y:o}}}case G.publicKey.elgamal:{const n=ne.readMPI(t.subarray(r));r+=n.length+2;const s=ne.readMPI(t.subarray(r));r+=s.length+2;const i=ne.readMPI(t.subarray(r));return r+=i.length+2,{read:r,publicParams:{p:n,g:s,y:i}}}case G.publicKey.ecdsa:{const n=new bi;r+=n.read(t),a1(n);const s=ne.readMPI(t.subarray(r));return r+=s.length+2,{read:r,publicParams:{oid:n,Q:s}}}case G.publicKey.eddsaLegacy:{const n=new bi;r+=n.read(t),a1(n);let s=ne.readMPI(t.subarray(r));return r+=s.length+2,s=ne.leftPad(s,33),{read:r,publicParams:{oid:n,Q:s}}}case G.publicKey.ecdh:{const n=new bi;r+=n.read(t),a1(n);const s=ne.readMPI(t.subarray(r));r+=s.length+2;const i=new sv;return r+=i.read(t.subarray(r)),{read:r,publicParams:{oid:n,Q:s,kdfParams:i}}}case G.publicKey.ed25519:case G.publicKey.x25519:{const n=t.subarray(r,r+32);return r+=n.length,{read:r,publicParams:{A:n}}}default:throw new gr("Unknown public key encryption algorithm.")}},parsePrivateKeyParams:function(e,t,r){let n=0;switch(e){case G.publicKey.rsaEncrypt:case G.publicKey.rsaEncryptSign:case G.publicKey.rsaSign:{const s=ne.readMPI(t.subarray(n));n+=s.length+2;const i=ne.readMPI(t.subarray(n));n+=i.length+2;const o=ne.readMPI(t.subarray(n));n+=o.length+2;const a=ne.readMPI(t.subarray(n));return n+=a.length+2,{read:n,privateParams:{d:s,p:i,q:o,u:a}}}case G.publicKey.dsa:case G.publicKey.elgamal:{const s=ne.readMPI(t.subarray(n));return n+=s.length+2,{read:n,privateParams:{x:s}}}case G.publicKey.ecdsa:case G.publicKey.ecdh:{const s=new cs(r.oid);let i=ne.readMPI(t.subarray(n));return n+=i.length+2,i=ne.leftPad(i,s.payloadSize),{read:n,privateParams:{d:i}}}case G.publicKey.eddsaLegacy:{const s=new cs(r.oid);let i=ne.readMPI(t.subarray(n));return n+=i.length+2,i=ne.leftPad(i,s.payloadSize),{read:n,privateParams:{seed:i}}}case G.publicKey.ed25519:{const s=t.subarray(n,n+32);return n+=s.length,{read:n,privateParams:{seed:s}}}case G.publicKey.x25519:{const s=t.subarray(n,n+32);return n+=s.length,{read:n,privateParams:{k:s}}}default:throw new gr("Unknown public key encryption algorithm.")}},parseEncSessionKeyParams:function(e,t){let r=0;switch(e){case G.publicKey.rsaEncrypt:case G.publicKey.rsaEncryptSign:return{c:ne.readMPI(t.subarray(r))};case G.publicKey.elgamal:{const n=ne.readMPI(t.subarray(r));return r+=n.length+2,{c1:n,c2:ne.readMPI(t.subarray(r))}}case G.publicKey.ecdh:{const n=ne.readMPI(t.subarray(r));r+=n.length+2;const s=new iv;return s.read(t.subarray(r)),{V:n,C:s}}case G.publicKey.x25519:{const n=t.subarray(r,r+32);r+=n.length;const s=new Fd;return s.read(t.subarray(r)),{ephemeralPublicKey:n,C:s}}default:throw new gr("Unknown public key encryption algorithm.")}},serializeParams:function(e,t){const r=new Set([G.publicKey.ed25519,G.publicKey.x25519]),n=Object.keys(t).map(s=>{const i=t[s];return ne.isUint8Array(i)?r.has(e)?i:ne.uint8ArrayToMPI(i):i.write()});return ne.concatUint8Array(n)},generateParams:function(e,t,r){switch(e){case G.publicKey.rsaEncrypt:case G.publicKey.rsaEncryptSign:case G.publicKey.rsaSign:return $t.rsa.generate(t,65537).then(({n,e:s,d:i,p:o,q:a,u:f})=>({privateParams:{d:i,p:o,q:a,u:f},publicParams:{n,e:s}}));case G.publicKey.ecdsa:return $t.elliptic.generate(r).then(({oid:n,Q:s,secret:i})=>({privateParams:{d:i},publicParams:{oid:new bi(n),Q:s}}));case G.publicKey.eddsaLegacy:return $t.elliptic.generate(r).then(({oid:n,Q:s,secret:i})=>({privateParams:{seed:i},publicParams:{oid:new bi(n),Q:s}}));case G.publicKey.ecdh:return $t.elliptic.generate(r).then(({oid:n,Q:s,secret:i,hash:o,cipher:a})=>({privateParams:{d:i},publicParams:{oid:new bi(n),Q:s,kdfParams:new sv({hash:o,cipher:a})}}));case G.publicKey.ed25519:return $t.elliptic.eddsa.generate(e).then(({A:n,seed:s})=>({privateParams:{seed:s},publicParams:{A:n}}));case G.publicKey.x25519:return $t.elliptic.ecdhX.generate(e).then(({A:n,k:s})=>({privateParams:{k:s},publicParams:{A:n}}));case G.publicKey.dsa:case G.publicKey.elgamal:throw Error("Unsupported algorithm for key generation.");default:throw Error("Unknown public key algorithm.")}},validateParams:async function(e,t,r){if(!t||!r)throw Error("Missing key parameters");switch(e){case G.publicKey.rsaEncrypt:case G.publicKey.rsaEncryptSign:case G.publicKey.rsaSign:{const{n,e:s}=t,{d:i,p:o,q:a,u:f}=r;return $t.rsa.validateParams(n,s,i,o,a,f)}case G.publicKey.dsa:{const{p:n,q:s,g:i,y:o}=t,{x:a}=r;return $t.dsa.validateParams(n,s,i,o,a)}case G.publicKey.elgamal:{const{p:n,g:s,y:i}=t,{x:o}=r;return $t.elgamal.validateParams(n,s,i,o)}case G.publicKey.ecdsa:case G.publicKey.ecdh:{const n=$t.elliptic[G.read(G.publicKey,e)],{oid:s,Q:i}=t,{d:o}=r;return n.validateParams(s,i,o)}case G.publicKey.eddsaLegacy:{const{Q:n,oid:s}=t,{seed:i}=r;return $t.elliptic.eddsaLegacy.validateParams(s,n,i)}case G.publicKey.ed25519:{const{A:n}=t,{seed:s}=r;return $t.elliptic.eddsa.validateParams(e,n,s)}case G.publicKey.x25519:{const{A:n}=t,{k:s}=r;return $t.elliptic.ecdhX.validateParams(e,n,s)}default:throw Error("Unknown public key algorithm.")}},getPrefixRandom:async function(e){const{blockSize:t}=Ci(e),r=await Bn(t),n=new Uint8Array([r[r.length-2],r[r.length-1]]);return ne.concat([r,n])},generateSessionKey:function(e){const{keySize:t}=Ci(e);return Bn(t)},getAEADMode:function(e){const t=G.read(G.aead,e);return X9[t]},getCipher:Ci,getPreferredCurveHashAlgo:function(e,t){switch(e){case G.publicKey.ecdsa:case G.publicKey.eddsaLegacy:return $t.elliptic.getPreferredHashAlgo(t);case G.publicKey.ed25519:return $t.elliptic.eddsa.getPreferredHashAlgo(e);default:throw Error("Unknown elliptic signing algo")}}});const gt={cipher:z0,hash:qn,mode:X9,publicKey:$t,signature:dq,random:VF,pkcs1:zF,pkcs5:sq,aesKW:iq};Object.assign(gt,fq);var Z0=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function fw(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)}const hw={arraySet:function(e,t,r,n,s){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),s);else for(let i=0;i<n;i++)e[s+i]=t[r+i]},flattenChunks:function(e){let t,r,n,s,i;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;const o=new Uint8Array(n);for(s=0,t=0,r=e.length;t<r;t++)i=e[t],o.set(i,s),s+=i.length;return o}},pw={arraySet:function(e,t,r,n,s){for(let i=0;i<n;i++)e[s+i]=t[r+i]},flattenChunks:function(e){return[].concat.apply([],e)}};let Si=Z0?Uint8Array:Array,Fn=Z0?Uint16Array:Array,qd=Z0?Int32Array:Array,yw=Z0?hw.flattenChunks:pw.flattenChunks,ki=Z0?hw.arraySet:pw.arraySet;const Ri=0,hq=1,k0=2,pq=3,Lr=4,hy=5,xl=6,rr=0,ts=1,gw=2,Pr=-2,hg=-3,b0=-5,av=-1,yq=1,Tl=2,gq=3,mw=4,ov=0,cv=1,vw=2,_o=8;function Co(e){let t=e.length;for(;--t>=0;)e[t]=0}const mq=0,bw=1,vq=2,pg=29,J0=256,R0=J0+1+pg,yo=30,yg=19,uv=2*R0+1,wa=15,o1=16,bq=7,gg=256,_w=16,ww=17,Ew=18,py=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],pd=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],_q=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],lv=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Zi=Array(2*(R0+2));Co(Zi);const _0=Array(2*yo);Co(_0);const D0=Array(512);Co(D0);const B0=Array(256);Co(B0);const mg=Array(pg);Co(mg);const jd=Array(yo);function c1(e,t,r,n,s){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=s,this.has_stree=e&&e.length}let dv,fv,hv;function u1(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Aw(e){return e<256?D0[e]:D0[256+(e>>>7)]}function O0(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function En(e,t,r){e.bi_valid>o1-r?(e.bi_buf|=t<<e.bi_valid&65535,O0(e,e.bi_buf),e.bi_buf=t>>o1-e.bi_valid,e.bi_valid+=r-o1):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function wi(e,t,r){En(e,r[2*t],r[2*t+1])}function Sw(e,t){let r=0;do r|=1&e,e>>>=1,r<<=1;while(--t>0);return r>>>1}function Pw(e,t,r){const n=Array(wa+1);let s,i,o=0;for(s=1;s<=wa;s++)n[s]=o=o+r[s-1]<<1;for(i=0;i<=t;i++){const a=e[2*i+1];a!==0&&(e[2*i]=Sw(n[a]++,a))}}function xw(e){let t;for(t=0;t<R0;t++)e.dyn_ltree[2*t]=0;for(t=0;t<yo;t++)e.dyn_dtree[2*t]=0;for(t=0;t<yg;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*gg]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function Tw(e){e.bi_valid>8?O0(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function pv(e,t,r,n){const s=2*t,i=2*r;return e[s]<e[i]||e[s]===e[i]&&n[t]<=n[r]}function l1(e,t,r){const n=e.heap[r];let s=r<<1;for(;s<=e.heap_len&&(s<e.heap_len&&pv(t,e.heap[s+1],e.heap[s],e.depth)&&s++,!pv(t,n,e.heap[s],e.depth));)e.heap[r]=e.heap[s],r=s,s<<=1;e.heap[r]=n}function yv(e,t,r){let n,s,i,o,a=0;if(e.last_lit!==0)do n=e.pending_buf[e.d_buf+2*a]<<8|e.pending_buf[e.d_buf+2*a+1],s=e.pending_buf[e.l_buf+a],a++,n===0?wi(e,s,t):(i=B0[s],wi(e,i+J0+1,t),o=py[i],o!==0&&(s-=mg[i],En(e,s,o)),n--,i=Aw(n),wi(e,i,r),o=pd[i],o!==0&&(n-=jd[i],En(e,n,o)));while(a<e.last_lit);wi(e,gg,t)}function d1(e,t){const r=t.dyn_tree,n=t.stat_desc.static_tree,s=t.stat_desc.has_stree,i=t.stat_desc.elems;let o,a,f,c=-1;for(e.heap_len=0,e.heap_max=uv,o=0;o<i;o++)r[2*o]!==0?(e.heap[++e.heap_len]=c=o,e.depth[o]=0):r[2*o+1]=0;for(;e.heap_len<2;)f=e.heap[++e.heap_len]=c<2?++c:0,r[2*f]=1,e.depth[f]=0,e.opt_len--,s&&(e.static_len-=n[2*f+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)l1(e,r,o);f=i;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],l1(e,r,1),a=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=a,r[2*f]=r[2*o]+r[2*a],e.depth[f]=(e.depth[o]>=e.depth[a]?e.depth[o]:e.depth[a])+1,r[2*o+1]=r[2*a+1]=f,e.heap[1]=f++,l1(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(l,u){const p=u.dyn_tree,d=u.max_code,h=u.stat_desc.static_tree,y=u.stat_desc.has_stree,m=u.stat_desc.extra_bits,v=u.stat_desc.extra_base,b=u.stat_desc.max_length;let w,_,C,I,k,E,S=0;for(I=0;I<=wa;I++)l.bl_count[I]=0;for(p[2*l.heap[l.heap_max]+1]=0,w=l.heap_max+1;w<uv;w++)_=l.heap[w],I=p[2*p[2*_+1]+1]+1,I>b&&(I=b,S++),p[2*_+1]=I,_>d||(l.bl_count[I]++,k=0,_>=v&&(k=m[_-v]),E=p[2*_],l.opt_len+=E*(I+k),y&&(l.static_len+=E*(h[2*_+1]+k)));if(S!==0){do{for(I=b-1;l.bl_count[I]===0;)I--;l.bl_count[I]--,l.bl_count[I+1]+=2,l.bl_count[b]--,S-=2}while(S>0);for(I=b;I!==0;I--)for(_=l.bl_count[I];_!==0;)C=l.heap[--w],C>d||(p[2*C+1]!==I&&(l.opt_len+=(I-p[2*C+1])*p[2*C],p[2*C+1]=I),_--)}}(e,t),Pw(r,c,e.bl_count)}function gv(e,t,r){let n,s,i=-1,o=t[1],a=0,f=7,c=4;for(o===0&&(f=138,c=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)s=o,o=t[2*(n+1)+1],++a<f&&s===o||(a<c?e.bl_tree[2*s]+=a:s!==0?(s!==i&&e.bl_tree[2*s]++,e.bl_tree[2*_w]++):a<=10?e.bl_tree[2*ww]++:e.bl_tree[2*Ew]++,a=0,i=s,o===0?(f=138,c=3):s===o?(f=6,c=3):(f=7,c=4))}function mv(e,t,r){let n,s,i=-1,o=t[1],a=0,f=7,c=4;for(o===0&&(f=138,c=3),n=0;n<=r;n++)if(s=o,o=t[2*(n+1)+1],!(++a<f&&s===o)){if(a<c)do wi(e,s,e.bl_tree);while(--a!=0);else s!==0?(s!==i&&(wi(e,s,e.bl_tree),a--),wi(e,_w,e.bl_tree),En(e,a-3,2)):a<=10?(wi(e,ww,e.bl_tree),En(e,a-3,3)):(wi(e,Ew,e.bl_tree),En(e,a-11,7));a=0,i=s,o===0?(f=138,c=3):s===o?(f=6,c=3):(f=7,c=4)}}Co(jd);let vv=!1;function wq(e){vv||(function(){let t,r,n,s,i;const o=Array(wa+1);for(n=0,s=0;s<pg-1;s++)for(mg[s]=n,t=0;t<1<<py[s];t++)B0[n++]=s;for(B0[n-1]=s,i=0,s=0;s<16;s++)for(jd[s]=i,t=0;t<1<<pd[s];t++)D0[i++]=s;for(i>>=7;s<yo;s++)for(jd[s]=i<<7,t=0;t<1<<pd[s]-7;t++)D0[256+i++]=s;for(r=0;r<=wa;r++)o[r]=0;for(t=0;t<=143;)Zi[2*t+1]=8,t++,o[8]++;for(;t<=255;)Zi[2*t+1]=9,t++,o[9]++;for(;t<=279;)Zi[2*t+1]=7,t++,o[7]++;for(;t<=287;)Zi[2*t+1]=8,t++,o[8]++;for(Pw(Zi,R0+1,o),t=0;t<yo;t++)_0[2*t+1]=5,_0[2*t]=Sw(t,5);dv=new c1(Zi,py,J0+1,R0,wa),fv=new c1(_0,pd,0,yo,wa),hv=new c1([],_q,0,yg,bq)}(),vv=!0),e.l_desc=new u1(e.dyn_ltree,dv),e.d_desc=new u1(e.dyn_dtree,fv),e.bl_desc=new u1(e.bl_tree,hv),e.bi_buf=0,e.bi_valid=0,xw(e)}function Cw(e,t,r,n){En(e,(mq<<1)+(n?1:0),3),function(s,i,o,a){Tw(s),a&&(O0(s,o),O0(s,~o)),ki(s.pending_buf,s.window,i,o,s.pending),s.pending+=o}(e,t,r,!0)}function Eq(e){En(e,bw<<1,3),wi(e,gg,Zi),function(t){t.bi_valid===16?(O0(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(e)}function Aq(e,t,r,n){let s,i,o=0;e.level>0?(e.strm.data_type===vw&&(e.strm.data_type=function(a){let f,c=4093624447;for(f=0;f<=31;f++,c>>>=1)if(1&c&&a.dyn_ltree[2*f]!==0)return ov;if(a.dyn_ltree[18]!==0||a.dyn_ltree[20]!==0||a.dyn_ltree[26]!==0)return cv;for(f=32;f<J0;f++)if(a.dyn_ltree[2*f]!==0)return cv;return ov}(e)),d1(e,e.l_desc),d1(e,e.d_desc),o=function(a){let f;for(gv(a,a.dyn_ltree,a.l_desc.max_code),gv(a,a.dyn_dtree,a.d_desc.max_code),d1(a,a.bl_desc),f=yg-1;f>=3&&a.bl_tree[2*lv[f]+1]===0;f--);return a.opt_len+=3*(f+1)+5+5+4,f}(e),s=e.opt_len+3+7>>>3,i=e.static_len+3+7>>>3,i<=s&&(s=i)):s=i=r+5,r+4<=s&&t!==-1?Cw(e,t,r,n):e.strategy===mw||i===s?(En(e,(bw<<1)+(n?1:0),3),yv(e,Zi,_0)):(En(e,(vq<<1)+(n?1:0),3),function(a,f,c,l){let u;for(En(a,f-257,5),En(a,c-1,5),En(a,l-4,4),u=0;u<l;u++)En(a,a.bl_tree[2*lv[u]+1],3);mv(a,a.dyn_ltree,f-1),mv(a,a.dyn_dtree,c-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),yv(e,e.dyn_ltree,e.dyn_dtree)),xw(e),n&&Tw(e)}function Ks(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,t===0?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(B0[r]+J0+1)]++,e.dyn_dtree[2*Aw(t)]++),e.last_lit===e.lit_bufsize-1}function M0(e,t,r,n){let s=65535&e|0,i=e>>>16&65535|0,o=0;for(;r!==0;){o=r>2e3?2e3:r,r-=o;do s=s+t[n++]|0,i=i+s|0;while(--o);s%=65521,i%=65521}return s|i<<16|0}const Sq=function(){let e;const t=[];for(let r=0;r<256;r++){e=r;for(let n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();function Or(e,t,r,n){const s=Sq,i=n+r;e^=-1;for(let o=n;o<i;o++)e=e>>>8^s[255&(e^t[o])];return-1^e}var N0={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};const Pq=9,Ht=3,Ms=258,si=Ms+Ht+1,xq=32,$d=42,yy=69,yd=73,gd=91,md=103,Ea=113,i0=666,Nr=1,w0=2,Aa=3,go=4,Tq=3;function Ns(e,t){return e.msg=N0[t],t}function bv(e){return(e<<1)-(e>4?9:0)}function Rs(e){let t=e.length;for(;--t>=0;)e[t]=0}function ws(e){const t=e.state;let r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(ki(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))}function zr(e,t){Aq(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ws(e.strm)}function Xt(e,t){e.pending_buf[e.pending++]=t}function zo(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function Cq(e,t,r,n){let s=e.avail_in;return s>n&&(s=n),s===0?0:(e.avail_in-=s,ki(t,e.input,e.next_in,s,r),e.state.wrap===1?e.adler=M0(e.adler,t,s,r):e.state.wrap===2&&(e.adler=Or(e.adler,t,s,r)),e.next_in+=s,e.total_in+=s,s)}function Iw(e,t){let r,n,s=e.max_chain_length,i=e.strstart,o=e.prev_length,a=e.nice_match;const f=e.strstart>e.w_size-si?e.strstart-(e.w_size-si):0,c=e.window,l=e.w_mask,u=e.prev,p=e.strstart+Ms;let d=c[i+o-1],h=c[i+o];e.prev_length>=e.good_match&&(s>>=2),a>e.lookahead&&(a=e.lookahead);do if(r=t,c[r+o]===h&&c[r+o-1]===d&&c[r]===c[i]&&c[++r]===c[i+1]){i+=2,r++;do;while(c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&i<p);if(n=Ms-(p-i),i=p-Ms,n>o){if(e.match_start=t,o=n,n>=a)break;d=c[i+o-1],h=c[i+o]}}while((t=u[t&l])>f&&--s!=0);return o<=e.lookahead?o:e.lookahead}function Oa(e){const t=e.w_size;let r,n,s,i,o;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-si)){ki(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,n=e.hash_size,r=n;do s=e.head[--r],e.head[r]=s>=t?s-t:0;while(--n);n=t,r=n;do s=e.prev[--r],e.prev[r]=s>=t?s-t:0;while(--n);i+=t}if(e.strm.avail_in===0)break;if(n=Cq(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=n,e.lookahead+e.insert>=Ht)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+Ht-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<Ht)););}while(e.lookahead<si&&e.strm.avail_in!==0)}function f1(e,t){let r,n;for(;;){if(e.lookahead<si){if(Oa(e),e.lookahead<si&&t===Ri)return Nr;if(e.lookahead===0)break}if(r=0,e.lookahead>=Ht&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Ht-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),r!==0&&e.strstart-r<=e.w_size-si&&(e.match_length=Iw(e,r)),e.match_length>=Ht)if(n=Ks(e,e.strstart-e.match_start,e.match_length-Ht),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Ht){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Ht-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!=0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=Ks(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(zr(e,!1),e.strm.avail_out===0))return Nr}return e.insert=e.strstart<Ht-1?e.strstart:Ht-1,t===Lr?(zr(e,!0),e.strm.avail_out===0?Aa:go):e.last_lit&&(zr(e,!1),e.strm.avail_out===0)?Nr:w0}function Wa(e,t){let r,n,s;for(;;){if(e.lookahead<si){if(Oa(e),e.lookahead<si&&t===Ri)return Nr;if(e.lookahead===0)break}if(r=0,e.lookahead>=Ht&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Ht-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=Ht-1,r!==0&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-si&&(e.match_length=Iw(e,r),e.match_length<=5&&(e.strategy===yq||e.match_length===Ht&&e.strstart-e.match_start>4096)&&(e.match_length=Ht-1)),e.prev_length>=Ht&&e.match_length<=e.prev_length){s=e.strstart+e.lookahead-Ht,n=Ks(e,e.strstart-1-e.prev_match,e.prev_length-Ht),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=s&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Ht-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!=0);if(e.match_available=0,e.match_length=Ht-1,e.strstart++,n&&(zr(e,!1),e.strm.avail_out===0))return Nr}else if(e.match_available){if(n=Ks(e,0,e.window[e.strstart-1]),n&&zr(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return Nr}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=Ks(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<Ht-1?e.strstart:Ht-1,t===Lr?(zr(e,!0),e.strm.avail_out===0?Aa:go):e.last_lit&&(zr(e,!1),e.strm.avail_out===0)?Nr:w0}class fi{constructor(t,r,n,s,i){this.good_length=t,this.max_lazy=r,this.nice_length=n,this.max_chain=s,this.func=i}}const s0=[new fi(0,0,0,0,function(e,t){let r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Oa(e),e.lookahead===0&&t===Ri)return Nr;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;const n=e.block_start+r;if((e.strstart===0||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,zr(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-si&&(zr(e,!1),e.strm.avail_out===0))return Nr}return e.insert=0,t===Lr?(zr(e,!0),e.strm.avail_out===0?Aa:go):(e.strstart>e.block_start&&(zr(e,!1),e.strm.avail_out),Nr)}),new fi(4,4,8,4,f1),new fi(4,5,16,8,f1),new fi(4,6,32,32,f1),new fi(4,4,16,16,Wa),new fi(8,16,32,32,Wa),new fi(8,16,128,128,Wa),new fi(8,32,128,256,Wa),new fi(32,128,258,1024,Wa),new fi(32,258,258,4096,Wa)];class Iq{constructor(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=_o,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Fn(1146),this.dyn_dtree=new Fn(122),this.bl_tree=new Fn(78),Rs(this.dyn_ltree),Rs(this.dyn_dtree),Rs(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Fn(16),this.heap=new Fn(573),Rs(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Fn(573),Rs(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}}function kq(e){const t=function(r){let n;return r&&r.state?(r.total_in=r.total_out=0,r.data_type=vw,n=r.state,n.pending=0,n.pending_out=0,n.wrap<0&&(n.wrap=-n.wrap),n.status=n.wrap?$d:Ea,r.adler=n.wrap===2?0:1,n.last_flush=Ri,wq(n),rr):Ns(r,Pr)}(e);return t===rr&&function(r){r.window_size=2*r.w_size,Rs(r.head),r.max_lazy_match=s0[r.level].max_lazy,r.good_match=s0[r.level].good_length,r.nice_match=s0[r.level].nice_length,r.max_chain_length=s0[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=Ht-1,r.match_available=0,r.ins_h=0}(e.state),t}function Rq(e,t){let r,n,s,i;if(!e||!e.state||t>hy||t<0)return e?Ns(e,Pr):Pr;if(n=e.state,!e.output||!e.input&&e.avail_in!==0||n.status===i0&&t!==Lr)return Ns(e,e.avail_out===0?b0:Pr);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===$d)if(n.wrap===2)e.adler=0,Xt(n,31),Xt(n,139),Xt(n,8),n.gzhead?(Xt(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Xt(n,255&n.gzhead.time),Xt(n,n.gzhead.time>>8&255),Xt(n,n.gzhead.time>>16&255),Xt(n,n.gzhead.time>>24&255),Xt(n,n.level===9?2:n.strategy>=Tl||n.level<2?4:0),Xt(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Xt(n,255&n.gzhead.extra.length),Xt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Or(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=yy):(Xt(n,0),Xt(n,0),Xt(n,0),Xt(n,0),Xt(n,0),Xt(n,n.level===9?2:n.strategy>=Tl||n.level<2?4:0),Xt(n,Tq),n.status=Ea);else{let a=_o+(n.w_bits-8<<4)<<8,f=-1;f=n.strategy>=Tl||n.level<2?0:n.level<6?1:n.level===6?2:3,a|=f<<6,n.strstart!==0&&(a|=xq),a+=31-a%31,n.status=Ea,zo(n,a),n.strstart!==0&&(zo(n,e.adler>>>16),zo(n,65535&e.adler)),e.adler=1}if(n.status===yy)if(n.gzhead.extra){for(s=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>s&&(e.adler=Or(e.adler,n.pending_buf,n.pending-s,s)),ws(e),s=n.pending,n.pending!==n.pending_buf_size));)Xt(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>s&&(e.adler=Or(e.adler,n.pending_buf,n.pending-s,s)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=yd)}else n.status=yd;if(n.status===yd)if(n.gzhead.name){s=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>s&&(e.adler=Or(e.adler,n.pending_buf,n.pending-s,s)),ws(e),s=n.pending,n.pending===n.pending_buf_size)){i=1;break}i=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,Xt(n,i)}while(i!==0);n.gzhead.hcrc&&n.pending>s&&(e.adler=Or(e.adler,n.pending_buf,n.pending-s,s)),i===0&&(n.gzindex=0,n.status=gd)}else n.status=gd;if(n.status===gd)if(n.gzhead.comment){s=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>s&&(e.adler=Or(e.adler,n.pending_buf,n.pending-s,s)),ws(e),s=n.pending,n.pending===n.pending_buf_size)){i=1;break}i=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,Xt(n,i)}while(i!==0);n.gzhead.hcrc&&n.pending>s&&(e.adler=Or(e.adler,n.pending_buf,n.pending-s,s)),i===0&&(n.status=md)}else n.status=md;if(n.status===md&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&ws(e),n.pending+2<=n.pending_buf_size&&(Xt(n,255&e.adler),Xt(n,e.adler>>8&255),e.adler=0,n.status=Ea)):n.status=Ea),n.pending!==0){if(ws(e),e.avail_out===0)return n.last_flush=-1,rr}else if(e.avail_in===0&&bv(t)<=bv(r)&&t!==Lr)return Ns(e,b0);if(n.status===i0&&e.avail_in!==0)return Ns(e,b0);if(e.avail_in!==0||n.lookahead!==0||t!==Ri&&n.status!==i0){var o=n.strategy===Tl?function(a,f){let c;for(;;){if(a.lookahead===0&&(Oa(a),a.lookahead===0)){if(f===Ri)return Nr;break}if(a.match_length=0,c=Ks(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++,c&&(zr(a,!1),a.strm.avail_out===0))return Nr}return a.insert=0,f===Lr?(zr(a,!0),a.strm.avail_out===0?Aa:go):a.last_lit&&(zr(a,!1),a.strm.avail_out===0)?Nr:w0}(n,t):n.strategy===gq?function(a,f){let c,l,u,p;const d=a.window;for(;;){if(a.lookahead<=Ms){if(Oa(a),a.lookahead<=Ms&&f===Ri)return Nr;if(a.lookahead===0)break}if(a.match_length=0,a.lookahead>=Ht&&a.strstart>0&&(u=a.strstart-1,l=d[u],l===d[++u]&&l===d[++u]&&l===d[++u])){p=a.strstart+Ms;do;while(l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&u<p);a.match_length=Ms-(p-u),a.match_length>a.lookahead&&(a.match_length=a.lookahead)}if(a.match_length>=Ht?(c=Ks(a,1,a.match_length-Ht),a.lookahead-=a.match_length,a.strstart+=a.match_length,a.match_length=0):(c=Ks(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++),c&&(zr(a,!1),a.strm.avail_out===0))return Nr}return a.insert=0,f===Lr?(zr(a,!0),a.strm.avail_out===0?Aa:go):a.last_lit&&(zr(a,!1),a.strm.avail_out===0)?Nr:w0}(n,t):s0[n.level].func(n,t);if(o!==Aa&&o!==go||(n.status=i0),o===Nr||o===Aa)return e.avail_out===0&&(n.last_flush=-1),rr;if(o===w0&&(t===hq?Eq(n):t!==hy&&(Cw(n,0,0,!1),t===pq&&(Rs(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),ws(e),e.avail_out===0))return n.last_flush=-1,rr}return t!==Lr?rr:n.wrap<=0?ts:(n.wrap===2?(Xt(n,255&e.adler),Xt(n,e.adler>>8&255),Xt(n,e.adler>>16&255),Xt(n,e.adler>>24&255),Xt(n,255&e.total_in),Xt(n,e.total_in>>8&255),Xt(n,e.total_in>>16&255),Xt(n,e.total_in>>24&255)):(zo(n,e.adler>>>16),zo(n,65535&e.adler)),ws(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?rr:ts)}try{String.fromCharCode.call(null,0)}catch{}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{}const gy=new Si(256);for(let e=0;e<256;e++)gy[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;function my(e){let t,r,n,s,i=0;const o=e.length;for(n=0;n<o;n++)t=e.charCodeAt(n),(64512&t)==55296&&n+1<o&&(r=e.charCodeAt(n+1),(64512&r)==56320&&(t=65536+(t-55296<<10)+(r-56320),n++)),i+=t<128?1:t<2048?2:t<65536?3:4;const a=new Si(i);for(s=0,n=0;s<i;n++)t=e.charCodeAt(n),(64512&t)==55296&&n+1<o&&(r=e.charCodeAt(n+1),(64512&r)==56320&&(t=65536+(t-55296<<10)+(r-56320),n++)),t<128?a[s++]=t:t<2048?(a[s++]=192|t>>>6,a[s++]=128|63&t):t<65536?(a[s++]=224|t>>>12,a[s++]=128|t>>>6&63,a[s++]=128|63&t):(a[s++]=240|t>>>18,a[s++]=128|t>>>12&63,a[s++]=128|t>>>6&63,a[s++]=128|63&t);return a}gy[254]=gy[254]=1;class kw{constructor(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}}class vy{constructor(t){this.options={level:av,method:_o,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,...t||{}};const r=this.options;r.raw&&r.windowBits>0?r.windowBits=-r.windowBits:r.gzip&&r.windowBits>0&&r.windowBits<16&&(r.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new kw,this.strm.avail_out=0;var n,s,i=function(o,a,f,c,l,u){if(!o)return Pr;let p=1;if(a===av&&(a=6),c<0?(p=0,c=-c):c>15&&(p=2,c-=16),l<1||l>Pq||f!==_o||c<8||c>15||a<0||a>9||u<0||u>mw)return Ns(o,Pr);c===8&&(c=9);const d=new Iq;return o.state=d,d.strm=o,d.wrap=p,d.gzhead=null,d.w_bits=c,d.w_size=1<<d.w_bits,d.w_mask=d.w_size-1,d.hash_bits=l+7,d.hash_size=1<<d.hash_bits,d.hash_mask=d.hash_size-1,d.hash_shift=~~((d.hash_bits+Ht-1)/Ht),d.window=new Si(2*d.w_size),d.head=new Fn(d.hash_size),d.prev=new Fn(d.w_size),d.lit_bufsize=1<<l+6,d.pending_buf_size=4*d.lit_bufsize,d.pending_buf=new Si(d.pending_buf_size),d.d_buf=1*d.lit_bufsize,d.l_buf=3*d.lit_bufsize,d.level=a,d.strategy=u,d.method=f,kq(o)}(this.strm,r.level,r.method,r.windowBits,r.memLevel,r.strategy);if(i!==rr)throw Error(N0[i]);if(r.header&&(n=this.strm,s=r.header,n&&n.state&&(n.state.wrap!==2||(n.state.gzhead=s))),r.dictionary){let o;if(o=typeof r.dictionary=="string"?my(r.dictionary):r.dictionary instanceof ArrayBuffer?new Uint8Array(r.dictionary):r.dictionary,i=function(a,f){let c,l,u,p,d,h,y,m,v=f.length;if(!a||!a.state||(c=a.state,p=c.wrap,p===2||p===1&&c.status!==$d||c.lookahead))return Pr;for(p===1&&(a.adler=M0(a.adler,f,v,0)),c.wrap=0,v>=c.w_size&&(p===0&&(Rs(c.head),c.strstart=0,c.block_start=0,c.insert=0),m=new Si(c.w_size),ki(m,f,v-c.w_size,c.w_size,0),f=m,v=c.w_size),d=a.avail_in,h=a.next_in,y=a.input,a.avail_in=v,a.next_in=0,a.input=f,Oa(c);c.lookahead>=Ht;){l=c.strstart,u=c.lookahead-(Ht-1);do c.ins_h=(c.ins_h<<c.hash_shift^c.window[l+Ht-1])&c.hash_mask,c.prev[l&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=l,l++;while(--u);c.strstart=l,c.lookahead=Ht-1,Oa(c)}return c.strstart+=c.lookahead,c.block_start=c.strstart,c.insert=c.lookahead,c.lookahead=0,c.match_length=c.prev_length=Ht-1,c.match_available=0,a.next_in=h,a.input=y,a.avail_in=d,c.wrap=p,rr}(this.strm,o),i!==rr)throw Error(N0[i]);this._dict_set=!0}}push(t,r){const{strm:n,options:{chunkSize:s}}=this;var i,o;if(this.ended)return!1;o=r===~~r?r:r===!0?Lr:Ri,typeof t=="string"?n.input=my(t):t instanceof ArrayBuffer?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new Si(s),n.next_out=0,n.avail_out=s),(i=Rq(n,o))!==ts&&i!==rr)return this.onEnd(i),this.ended=!0,!1;n.avail_out!==0&&(n.avail_in!==0||o!==Lr&&o!==k0)||this.onData(fw(n.output,n.next_out))}while((n.avail_in>0||n.avail_out===0)&&i!==ts);return o===Lr?(i=function(a){let f;return a&&a.state?(f=a.state.status,f!==$d&&f!==yy&&f!==yd&&f!==gd&&f!==md&&f!==Ea&&f!==i0?Ns(a,Pr):(a.state=null,f===Ea?Ns(a,hg):rr)):Pr}(this.strm),this.onEnd(i),this.ended=!0,i===rr):o!==k0||(this.onEnd(rr),n.avail_out=0,!0)}onData(t){this.chunks.push(t)}onEnd(t){t===rr&&(this.result=yw(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg}}const Cl=30,Dq=12;function Bq(e,t){let r,n,s,i,o,a,f,c,l,u;const p=e.state;r=e.next_in;const d=e.input,h=r+(e.avail_in-5);n=e.next_out;const y=e.output,m=n-(t-e.avail_out),v=n+(e.avail_out-257),b=p.dmax,w=p.wsize,_=p.whave,C=p.wnext,I=p.window;s=p.hold,i=p.bits;const k=p.lencode,E=p.distcode,S=(1<<p.lenbits)-1,T=(1<<p.distbits)-1;e:do{i<15&&(s+=d[r++]<<i,i+=8,s+=d[r++]<<i,i+=8),o=k[s&S];t:for(;;){if(a=o>>>24,s>>>=a,i-=a,a=o>>>16&255,a===0)y[n++]=65535&o;else{if(!(16&a)){if(!(64&a)){o=k[(65535&o)+(s&(1<<a)-1)];continue t}if(32&a){p.mode=Dq;break e}e.msg="invalid literal/length code",p.mode=Cl;break e}f=65535&o,a&=15,a&&(i<a&&(s+=d[r++]<<i,i+=8),f+=s&(1<<a)-1,s>>>=a,i-=a),i<15&&(s+=d[r++]<<i,i+=8,s+=d[r++]<<i,i+=8),o=E[s&T];r:for(;;){if(a=o>>>24,s>>>=a,i-=a,a=o>>>16&255,!(16&a)){if(!(64&a)){o=E[(65535&o)+(s&(1<<a)-1)];continue r}e.msg="invalid distance code",p.mode=Cl;break e}if(c=65535&o,a&=15,i<a&&(s+=d[r++]<<i,i+=8,i<a&&(s+=d[r++]<<i,i+=8)),c+=s&(1<<a)-1,c>b){e.msg="invalid distance too far back",p.mode=Cl;break e}if(s>>>=a,i-=a,a=n-m,c>a){if(a=c-a,a>_&&p.sane){e.msg="invalid distance too far back",p.mode=Cl;break e}if(l=0,u=I,C===0){if(l+=w-a,a<f){f-=a;do y[n++]=I[l++];while(--a);l=n-c,u=y}}else if(C<a){if(l+=w+C-a,a-=C,a<f){f-=a;do y[n++]=I[l++];while(--a);if(l=0,C<f){a=C,f-=a;do y[n++]=I[l++];while(--a);l=n-c,u=y}}}else if(l+=C-a,a<f){f-=a;do y[n++]=I[l++];while(--a);l=n-c,u=y}for(;f>2;)y[n++]=u[l++],y[n++]=u[l++],y[n++]=u[l++],f-=3;f&&(y[n++]=u[l++],f>1&&(y[n++]=u[l++]))}else{l=n-c;do y[n++]=y[l++],y[n++]=y[l++],y[n++]=y[l++],f-=3;while(f>2);f&&(y[n++]=y[l++],f>1&&(y[n++]=y[l++]))}break}}break}}while(r<h&&n<v);f=i>>3,r-=f,i-=f<<3,s&=(1<<i)-1,e.next_in=r,e.next_out=n,e.avail_in=r<h?h-r+5:5-(r-h),e.avail_out=n<v?v-n+257:257-(n-v),p.hold=s,p.bits=i}const Ya=15,_v=852,wv=592,Ev=0,h1=1,Av=2,Oq=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],Mq=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],Nq=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],Uq=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function E0(e,t,r,n,s,i,o,a){const f=a.bits;let c,l,u,p,d,h=0,y=0,m=0,v=0,b=0,w=0,_=0,C=0,I=0,k=0,E=null,S=0;const T=new Fn(Ya+1),P=new Fn(Ya+1);let g,A,x,D=null,O=0;for(h=0;h<=Ya;h++)T[h]=0;for(y=0;y<n;y++)T[t[r+y]]++;for(b=f,v=Ya;v>=1&&T[v]===0;v--);if(b>v&&(b=v),v===0)return s[i++]=20971520,s[i++]=20971520,a.bits=1,0;for(m=1;m<v&&T[m]===0;m++);for(b<m&&(b=m),C=1,h=1;h<=Ya;h++)if(C<<=1,C-=T[h],C<0)return-1;if(C>0&&(e===Ev||v!==1))return-1;for(P[1]=0,h=1;h<Ya;h++)P[h+1]=P[h]+T[h];for(y=0;y<n;y++)t[r+y]!==0&&(o[P[t[r+y]]++]=y);e===Ev?(E=D=o,d=19):e===h1?(E=Oq,S-=257,D=Mq,O-=257,d=256):(E=Nq,D=Uq,d=-1),k=0,y=0,h=m,p=i,w=b,_=0,u=-1,I=1<<b;const B=I-1;if(e===h1&&I>_v||e===Av&&I>wv)return 1;for(;;){g=h-_,o[y]<d?(A=0,x=o[y]):o[y]>d?(A=D[O+o[y]],x=E[S+o[y]]):(A=96,x=0),c=1<<h-_,l=1<<w,m=l;do l-=c,s[p+(k>>_)+l]=g<<24|A<<16|x|0;while(l!==0);for(c=1<<h-1;k&c;)c>>=1;if(c!==0?(k&=c-1,k+=c):k=0,y++,--T[h]==0){if(h===v)break;h=t[r+o[y]]}if(h>b&&(k&B)!==u){for(_===0&&(_=b),p+=m,w=h-_,C=1<<w;w+_<v&&(C-=T[w+_],!(C<=0));)w++,C<<=1;if(I+=1<<w,e===h1&&I>_v||e===Av&&I>wv)return 1;u=k&B,s[u]=b<<24|w<<16|p-i|0}}return k!==0&&(s[p+k]=h-_<<24|64<<16|0),a.bits=b,0}const Lq=0,Rw=1,Dw=2,Bw=1,Sv=2,Pv=3,xv=4,Tv=5,Cv=6,Iv=7,kv=8,Rv=9,Dv=10,Hd=11,qi=12,p1=13,Bv=14,y1=15,Ov=16,Mv=17,Nv=18,Uv=19,Il=20,kl=21,Lv=22,Kv=23,Fv=24,qv=25,jv=26,g1=27,$v=28,Hv=29,hr=30,Kq=852,Fq=592;function Vv(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}class qq{constructor(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Fn(320),this.work=new Fn(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}}function jq(e){let t;return e&&e.state?(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,function(r){let n;return r&&r.state?(n=r.state,r.total_in=r.total_out=n.total=0,r.msg="",n.wrap&&(r.adler=1&n.wrap),n.mode=Bw,n.last=0,n.havedict=0,n.dmax=32768,n.head=null,n.hold=0,n.bits=0,n.lencode=n.lendyn=new qd(Kq),n.distcode=n.distdyn=new qd(Fq),n.sane=1,n.back=-1,rr):Pr}(e)):Pr}function $q(e,t){let r,n;return e?(n=new qq,e.state=n,n.window=null,r=function(s,i){let o,a;return s&&s.state?(a=s.state,i<0?(o=0,i=-i):(o=1+(i>>4),i<48&&(i&=15)),i&&(i<8||i>15)?Pr:(a.window!==null&&a.wbits!==i&&(a.window=null),a.wrap=o,a.wbits=i,jq(s))):Pr}(e,t),r!==rr&&(e.state=null),r):Pr}let m1,v1,Gv=!0;function Hq(e){if(Gv){let t;for(m1=new qd(512),v1=new qd(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(E0(Rw,e.lens,0,288,m1,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;E0(Dw,e.lens,0,32,v1,0,e.work,{bits:5}),Gv=!1}e.lencode=m1,e.lenbits=9,e.distcode=v1,e.distbits=5}function Ow(e,t,r,n){let s;const i=e.state;return i.window===null&&(i.wsize=1<<i.wbits,i.wnext=0,i.whave=0,i.window=new Si(i.wsize)),n>=i.wsize?(ki(i.window,t,r-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):(s=i.wsize-i.wnext,s>n&&(s=n),ki(i.window,t,r-n,s,i.wnext),(n-=s)?(ki(i.window,t,r-n,n,0),i.wnext=n,i.whave=i.wsize):(i.wnext+=s,i.wnext===i.wsize&&(i.wnext=0),i.whave<i.wsize&&(i.whave+=s))),0}function Vq(e,t){let r,n,s,i,o,a,f,c,l,u,p,d,h,y,m,v,b,w,_,C,I,k,E,S,T=0,P=new Si(4);const g=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return Pr;r=e.state,r.mode===qi&&(r.mode=p1),o=e.next_out,s=e.output,f=e.avail_out,i=e.next_in,n=e.input,a=e.avail_in,c=r.hold,l=r.bits,u=a,p=f,k=rr;e:for(;;)switch(r.mode){case Bw:if(r.wrap===0){r.mode=p1;break}for(;l<16;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(2&r.wrap&&c===35615){r.check=0,P[0]=255&c,P[1]=c>>>8&255,r.check=Or(r.check,P,2,0),c=0,l=0,r.mode=Sv;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",r.mode=hr;break}if((15&c)!==_o){e.msg="unknown compression method",r.mode=hr;break}if(c>>>=4,l-=4,I=8+(15&c),r.wbits===0)r.wbits=I;else if(I>r.wbits){e.msg="invalid window size",r.mode=hr;break}r.dmax=1<<I,e.adler=r.check=1,r.mode=512&c?Dv:qi,c=0,l=0;break;case Sv:for(;l<16;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(r.flags=c,(255&r.flags)!==_o){e.msg="unknown compression method",r.mode=hr;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=hr;break}r.head&&(r.head.text=c>>8&1),512&r.flags&&(P[0]=255&c,P[1]=c>>>8&255,r.check=Or(r.check,P,2,0)),c=0,l=0,r.mode=Pv;case Pv:for(;l<32;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}r.head&&(r.head.time=c),512&r.flags&&(P[0]=255&c,P[1]=c>>>8&255,P[2]=c>>>16&255,P[3]=c>>>24&255,r.check=Or(r.check,P,4,0)),c=0,l=0,r.mode=xv;case xv:for(;l<16;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}r.head&&(r.head.xflags=255&c,r.head.os=c>>8),512&r.flags&&(P[0]=255&c,P[1]=c>>>8&255,r.check=Or(r.check,P,2,0)),c=0,l=0,r.mode=Tv;case Tv:if(1024&r.flags){for(;l<16;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}r.length=c,r.head&&(r.head.extra_len=c),512&r.flags&&(P[0]=255&c,P[1]=c>>>8&255,r.check=Or(r.check,P,2,0)),c=0,l=0}else r.head&&(r.head.extra=null);r.mode=Cv;case Cv:if(1024&r.flags&&(d=r.length,d>a&&(d=a),d&&(r.head&&(I=r.head.extra_len-r.length,r.head.extra||(r.head.extra=Array(r.head.extra_len)),ki(r.head.extra,n,i,d,I)),512&r.flags&&(r.check=Or(r.check,n,d,i)),a-=d,i+=d,r.length-=d),r.length))break e;r.length=0,r.mode=Iv;case Iv:if(2048&r.flags){if(a===0)break e;d=0;do I=n[i+d++],r.head&&I&&r.length<65536&&(r.head.name+=String.fromCharCode(I));while(I&&d<a);if(512&r.flags&&(r.check=Or(r.check,n,d,i)),a-=d,i+=d,I)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=kv;case kv:if(4096&r.flags){if(a===0)break e;d=0;do I=n[i+d++],r.head&&I&&r.length<65536&&(r.head.comment+=String.fromCharCode(I));while(I&&d<a);if(512&r.flags&&(r.check=Or(r.check,n,d,i)),a-=d,i+=d,I)break e}else r.head&&(r.head.comment=null);r.mode=Rv;case Rv:if(512&r.flags){for(;l<16;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(c!==(65535&r.check)){e.msg="header crc mismatch",r.mode=hr;break}c=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=qi;break;case Dv:for(;l<32;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}e.adler=r.check=Vv(c),c=0,l=0,r.mode=Hd;case Hd:if(r.havedict===0)return e.next_out=o,e.avail_out=f,e.next_in=i,e.avail_in=a,r.hold=c,r.bits=l,gw;e.adler=r.check=1,r.mode=qi;case qi:if(t===hy||t===xl)break e;case p1:if(r.last){c>>>=7&l,l-=7&l,r.mode=g1;break}for(;l<3;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}switch(r.last=1&c,c>>>=1,l-=1,3&c){case 0:r.mode=Bv;break;case 1:if(Hq(r),r.mode=Il,t===xl){c>>>=2,l-=2;break e}break;case 2:r.mode=Mv;break;case 3:e.msg="invalid block type",r.mode=hr}c>>>=2,l-=2;break;case Bv:for(c>>>=7&l,l-=7&l;l<32;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",r.mode=hr;break}if(r.length=65535&c,c=0,l=0,r.mode=y1,t===xl)break e;case y1:r.mode=Ov;case Ov:if(d=r.length,d){if(d>a&&(d=a),d>f&&(d=f),d===0)break e;ki(s,n,i,d,o),a-=d,i+=d,f-=d,o+=d,r.length-=d;break}r.mode=qi;break;case Mv:for(;l<14;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(r.nlen=257+(31&c),c>>>=5,l-=5,r.ndist=1+(31&c),c>>>=5,l-=5,r.ncode=4+(15&c),c>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=hr;break}r.have=0,r.mode=Nv;case Nv:for(;r.have<r.ncode;){for(;l<3;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}r.lens[g[r.have++]]=7&c,c>>>=3,l-=3}for(;r.have<19;)r.lens[g[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,E={bits:r.lenbits},k=E0(Lq,r.lens,0,19,r.lencode,0,r.work,E),r.lenbits=E.bits,k){e.msg="invalid code lengths set",r.mode=hr;break}r.have=0,r.mode=Uv;case Uv:for(;r.have<r.nlen+r.ndist;){for(;T=r.lencode[c&(1<<r.lenbits)-1],m=T>>>24,v=T>>>16&255,b=65535&T,!(m<=l);){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(b<16)c>>>=m,l-=m,r.lens[r.have++]=b;else{if(b===16){for(S=m+2;l<S;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(c>>>=m,l-=m,r.have===0){e.msg="invalid bit length repeat",r.mode=hr;break}I=r.lens[r.have-1],d=3+(3&c),c>>>=2,l-=2}else if(b===17){for(S=m+3;l<S;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}c>>>=m,l-=m,I=0,d=3+(7&c),c>>>=3,l-=3}else{for(S=m+7;l<S;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}c>>>=m,l-=m,I=0,d=11+(127&c),c>>>=7,l-=7}if(r.have+d>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=hr;break}for(;d--;)r.lens[r.have++]=I}}if(r.mode===hr)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=hr;break}if(r.lenbits=9,E={bits:r.lenbits},k=E0(Rw,r.lens,0,r.nlen,r.lencode,0,r.work,E),r.lenbits=E.bits,k){e.msg="invalid literal/lengths set",r.mode=hr;break}if(r.distbits=6,r.distcode=r.distdyn,E={bits:r.distbits},k=E0(Dw,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,E),r.distbits=E.bits,k){e.msg="invalid distances set",r.mode=hr;break}if(r.mode=Il,t===xl)break e;case Il:r.mode=kl;case kl:if(a>=6&&f>=258){e.next_out=o,e.avail_out=f,e.next_in=i,e.avail_in=a,r.hold=c,r.bits=l,Bq(e,p),o=e.next_out,s=e.output,f=e.avail_out,i=e.next_in,n=e.input,a=e.avail_in,c=r.hold,l=r.bits,r.mode===qi&&(r.back=-1);break}for(r.back=0;T=r.lencode[c&(1<<r.lenbits)-1],m=T>>>24,v=T>>>16&255,b=65535&T,!(m<=l);){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(v&&!(240&v)){for(w=m,_=v,C=b;T=r.lencode[C+((c&(1<<w+_)-1)>>w)],m=T>>>24,v=T>>>16&255,b=65535&T,!(w+m<=l);){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}c>>>=w,l-=w,r.back+=w}if(c>>>=m,l-=m,r.back+=m,r.length=b,v===0){r.mode=jv;break}if(32&v){r.back=-1,r.mode=qi;break}if(64&v){e.msg="invalid literal/length code",r.mode=hr;break}r.extra=15&v,r.mode=Lv;case Lv:if(r.extra){for(S=r.extra;l<S;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}r.length+=c&(1<<r.extra)-1,c>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=Kv;case Kv:for(;T=r.distcode[c&(1<<r.distbits)-1],m=T>>>24,v=T>>>16&255,b=65535&T,!(m<=l);){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(!(240&v)){for(w=m,_=v,C=b;T=r.distcode[C+((c&(1<<w+_)-1)>>w)],m=T>>>24,v=T>>>16&255,b=65535&T,!(w+m<=l);){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}c>>>=w,l-=w,r.back+=w}if(c>>>=m,l-=m,r.back+=m,64&v){e.msg="invalid distance code",r.mode=hr;break}r.offset=b,r.extra=15&v,r.mode=Fv;case Fv:if(r.extra){for(S=r.extra;l<S;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}r.offset+=c&(1<<r.extra)-1,c>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=hr;break}r.mode=qv;case qv:if(f===0)break e;if(d=p-f,r.offset>d){if(d=r.offset-d,d>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=hr;break}d>r.wnext?(d-=r.wnext,h=r.wsize-d):h=r.wnext-d,d>r.length&&(d=r.length),y=r.window}else y=s,h=o-r.offset,d=r.length;d>f&&(d=f),f-=d,r.length-=d;do s[o++]=y[h++];while(--d);r.length===0&&(r.mode=kl);break;case jv:if(f===0)break e;s[o++]=r.length,f--,r.mode=kl;break;case g1:if(r.wrap){for(;l<32;){if(a===0)break e;a--,c|=n[i++]<<l,l+=8}if(p-=f,e.total_out+=p,r.total+=p,p&&(e.adler=r.check=r.flags?Or(r.check,s,p,o-p):M0(r.check,s,p,o-p)),p=f,(r.flags?c:Vv(c))!==r.check){e.msg="incorrect data check",r.mode=hr;break}c=0,l=0}r.mode=$v;case $v:if(r.wrap&&r.flags){for(;l<32;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(c!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=hr;break}c=0,l=0}r.mode=Hv;case Hv:k=ts;break e;case hr:k=hg;break e;default:return Pr}return e.next_out=o,e.avail_out=f,e.next_in=i,e.avail_in=a,r.hold=c,r.bits=l,(r.wsize||p!==e.avail_out&&r.mode<hr&&(r.mode<g1||t!==Lr))&&Ow(e,e.output,e.next_out,p-e.avail_out),u-=e.avail_in,p-=e.avail_out,e.total_in+=u,e.total_out+=p,r.total+=p,r.wrap&&p&&(e.adler=r.check=r.flags?Or(r.check,s,p,e.next_out-p):M0(r.check,s,p,e.next_out-p)),e.data_type=r.bits+(r.last?64:0)+(r.mode===qi?128:0)+(r.mode===Il||r.mode===y1?256:0),(u===0&&p===0||t===Lr)&&k===rr&&(k=b0),k}function zv(e,t){const r=t.length;let n,s;return e&&e.state?(n=e.state,n.wrap!==0&&n.mode!==Hd?Pr:n.mode===Hd&&(s=1,s=M0(s,t,r,0),s!==n.check)?hg:(Ow(e,t,r,r),n.havedict=1,rr)):Pr}class Gq{constructor(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}}class Wv{constructor(t){this.options={chunkSize:16384,windowBits:0,...t||{}};const r=this.options;r.raw&&r.windowBits>=0&&r.windowBits<16&&(r.windowBits=-r.windowBits,r.windowBits===0&&(r.windowBits=-15)),!(r.windowBits>=0&&r.windowBits<16)||t&&t.windowBits||(r.windowBits+=32),r.windowBits>15&&r.windowBits<48&&!(15&r.windowBits)&&(r.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new kw,this.strm.avail_out=0;let n=$q(this.strm,r.windowBits);if(n!==rr||(this.header=new Gq,function(s,i){let o;s&&s.state&&(o=s.state,!(2&o.wrap)||(o.head=i,i.done=!1))}(this.strm,this.header),r.dictionary&&(typeof r.dictionary=="string"?r.dictionary=my(r.dictionary):r.dictionary instanceof ArrayBuffer&&(r.dictionary=new Uint8Array(r.dictionary)),r.raw&&(n=zv(this.strm,r.dictionary),n!==rr))))throw Error(N0[n])}push(t,r){const{strm:n,options:{chunkSize:s,dictionary:i}}=this;let o,a,f=!1;if(this.ended)return!1;a=r===~~r?r:r===!0?Lr:Ri,typeof t=="string"?n.input=function(c){const l=new Si(c.length);for(let u=0,p=l.length;u<p;u++)l[u]=c.charCodeAt(u);return l}(t):t instanceof ArrayBuffer?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new Si(s),n.next_out=0,n.avail_out=s),o=Vq(n,Ri),o===gw&&i&&(o=zv(this.strm,i)),o===b0&&f===!0&&(o=rr,f=!1),o!==ts&&o!==rr)return this.onEnd(o),this.ended=!0,!1;n.next_out&&(n.avail_out!==0&&o!==ts&&(n.avail_in!==0||a!==Lr&&a!==k0)||this.onData(fw(n.output,n.next_out))),n.avail_in===0&&n.avail_out===0&&(f=!0)}while((n.avail_in>0||n.avail_out===0)&&o!==ts);return o===ts&&(a=Lr),a===Lr?(o=function(c){if(!c||!c.state)return Pr;const l=c.state;return l.window&&(l.window=null),c.state=null,rr}(this.strm),this.onEnd(o),this.ended=!0,o===rr):a!==k0||(this.onEnd(rr),n.avail_out=0,!0)}onData(t){this.chunks.push(t)}onEnd(t){t===rr&&(this.result=yw(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg}}var Yv=[0,1,3,7,15,31,63,127,255],a0=function(e){this.stream=e,this.bitOffset=0,this.curByte=0,this.hasByte=!1};a0.prototype._ensureByte=function(){this.hasByte||(this.curByte=this.stream.readByte(),this.hasByte=!0)},a0.prototype.read=function(e){for(var t=0;e>0;){this._ensureByte();var r=8-this.bitOffset;if(e>=r)t<<=r,t|=Yv[r]&this.curByte,this.hasByte=!1,this.bitOffset=0,e-=r;else{t<<=e;var n=r-e;t|=(this.curByte&Yv[e]<<n)>>n,this.bitOffset+=e,e=0}}return t},a0.prototype.seek=function(e){var t=e%8,r=(e-t)/8;this.bitOffset=t,this.stream.seek(r),this.hasByte=!1},a0.prototype.pi=function(){var e,t=new Uint8Array(6);for(e=0;e<t.length;e++)t[e]=this.read(8);return function(r){return Array.prototype.map.call(r,n=>("00"+n.toString(16)).slice(-2)).join("")}(t)};var zq=a0,pa=function(){};pa.prototype.readByte=function(){throw Error("abstract method readByte() not implemented")},pa.prototype.read=function(e,t,r){for(var n=0;n<r;){var s=this.readByte();if(s<0)return n===0?-1:n;e[t++]=s,n++}return n},pa.prototype.seek=function(e){throw Error("abstract method seek() not implemented")},pa.prototype.writeByte=function(e){throw Error("abstract method readByte() not implemented")},pa.prototype.write=function(e,t,r){var n;for(n=0;n<r;n++)this.writeByte(e[t++]);return r},pa.prototype.flush=function(){};var b1,Mw=pa,Wq=(b1=new Uint32Array([0,79764919,159529838,222504665,319059676,398814059,445009330,507990021,638119352,583659535,797628118,726387553,890018660,835552979,1015980042,944750013,1276238704,1221641927,1167319070,1095957929,1595256236,1540665371,1452775106,1381403509,1780037320,1859660671,1671105958,1733955601,2031960084,2111593891,1889500026,1952343757,2552477408,2632100695,2443283854,2506133561,2334638140,2414271883,2191915858,2254759653,3190512472,3135915759,3081330742,3009969537,2905550212,2850959411,2762807018,2691435357,3560074640,3505614887,3719321342,3648080713,3342211916,3287746299,3467911202,3396681109,4063920168,4143685023,4223187782,4286162673,3779000052,3858754371,3904687514,3967668269,881225847,809987520,1023691545,969234094,662832811,591600412,771767749,717299826,311336399,374308984,453813921,533576470,25881363,88864420,134795389,214552010,2023205639,2086057648,1897238633,1976864222,1804852699,1867694188,1645340341,1724971778,1587496639,1516133128,1461550545,1406951526,1302016099,1230646740,1142491917,1087903418,2896545431,2825181984,2770861561,2716262478,3215044683,3143675388,3055782693,3001194130,2326604591,2389456536,2200899649,2280525302,2578013683,2640855108,2418763421,2498394922,3769900519,3832873040,3912640137,3992402750,4088425275,4151408268,4197601365,4277358050,3334271071,3263032808,3476998961,3422541446,3585640067,3514407732,3694837229,3640369242,1762451694,1842216281,1619975040,1682949687,2047383090,2127137669,1938468188,2001449195,1325665622,1271206113,1183200824,1111960463,1543535498,1489069629,1434599652,1363369299,622672798,568075817,748617968,677256519,907627842,853037301,1067152940,995781531,51762726,131386257,177728840,240578815,269590778,349224269,429104020,491947555,4046411278,4126034873,4172115296,4234965207,3794477266,3874110821,3953728444,4016571915,3609705398,3555108353,3735388376,3664026991,3290680682,3236090077,3449943556,3378572211,3174993278,3120533705,3032266256,2961025959,2923101090,2868635157,2813903052,2742672763,2604032198,2683796849,2461293480,2524268063,2284983834,2364738477,2175806836,2238787779,1569362073,1498123566,1409854455,1355396672,1317987909,1246755826,1192025387,1137557660,2072149281,2135122070,1912620623,1992383480,1753615357,1816598090,1627664531,1707420964,295390185,358241886,404320391,483945776,43990325,106832002,186451547,266083308,932423249,861060070,1041341759,986742920,613929101,542559546,756411363,701822548,3316196985,3244833742,3425377559,3370778784,3601682597,3530312978,3744426955,3689838204,3819031489,3881883254,3928223919,4007849240,4037393693,4100235434,4180117107,4259748804,2310601993,2373574846,2151335527,2231098320,2596047829,2659030626,2470359227,2550115596,2947551409,2876312838,2788305887,2733848168,3165939309,3094707162,3040238851,2985771188]),function(){var e=4294967295;this.getCRC=function(){return~e>>>0},this.updateCRC=function(t){e=e<<8^b1[255&(e>>>24^t)]},this.updateCRCRun=function(t,r){for(;r-- >0;)e=e<<8^b1[255&(e>>>24^t)]}}),Zv=function(e,t){var r,n=e[t];for(r=t;r>0;r--)e[r]=e[r-1];return e[0]=n,n},yr={OK:0,LAST_BLOCK:-1,NOT_BZIP_DATA:-2,UNEXPECTED_INPUT_EOF:-3,UNEXPECTED_OUTPUT_EOF:-4,DATA_ERROR:-5,OUT_OF_MEMORY:-6,OBSOLETE_INPUT:-7,END_OF_BLOCK:-8},Es={};Es[yr.LAST_BLOCK]="Bad file checksum",Es[yr.NOT_BZIP_DATA]="Not bzip data",Es[yr.UNEXPECTED_INPUT_EOF]="Unexpected input EOF",Es[yr.UNEXPECTED_OUTPUT_EOF]="Unexpected output EOF",Es[yr.DATA_ERROR]="Data error",Es[yr.OUT_OF_MEMORY]="Out of memory",Es[yr.OBSOLETE_INPUT]="Obsolete (pre 0.9.5) bzip format not supported.";var Vr=function(e,t){var r=Es[e]||"unknown error";t&&(r+=": "+t);var n=new TypeError(r);throw n.errorCode=e,n},o0=function(e,t){this.writePos=this.writeCurrent=this.writeCount=0,this._start_bunzip(e,t)};o0.prototype._init_block=function(){return this._get_next_block()?(this.blockCRC=new Wq,!0):(this.writeCount=-1,!1)},o0.prototype._start_bunzip=function(e,t){var r=new Uint8Array(4);e.read(r,0,4)===4&&String.fromCharCode(r[0],r[1],r[2])==="BZh"||Vr(yr.NOT_BZIP_DATA,"bad magic");var n=r[3]-48;(n<1||n>9)&&Vr(yr.NOT_BZIP_DATA,"level out of range"),this.reader=new zq(e),this.dbufSize=1e5*n,this.nextoutput=0,this.outputStream=t,this.streamCRC=0},o0.prototype._get_next_block=function(){var e,t,r,n=this.reader,s=n.pi();if(s==="177245385090")return!1;s!=="314159265359"&&Vr(yr.NOT_BZIP_DATA),this.targetBlockCRC=n.read(32)>>>0,this.streamCRC=(this.targetBlockCRC^(this.streamCRC<<1|this.streamCRC>>>31))>>>0,n.read(1)&&Vr(yr.OBSOLETE_INPUT);var i=n.read(24);i>this.dbufSize&&Vr(yr.DATA_ERROR,"initial position out of bounds");var o=n.read(16),a=new Uint8Array(256),f=0;for(e=0;e<16;e++)if(o&1<<15-e){var c=16*e;for(r=n.read(16),t=0;t<16;t++)r&1<<15-t&&(a[f++]=c+t)}var l=n.read(3);(l<2||l>6)&&Vr(yr.DATA_ERROR);var u=n.read(15);u===0&&Vr(yr.DATA_ERROR);var p=new Uint8Array(256);for(e=0;e<l;e++)p[e]=e;var d=new Uint8Array(u);for(e=0;e<u;e++){for(t=0;n.read(1);t++)t>=l&&Vr(yr.DATA_ERROR);d[e]=Zv(p,t)}var h,y=f+2,m=[];for(t=0;t<l;t++){var v,b,w=new Uint8Array(y),_=new Uint16Array(21);for(o=n.read(5),e=0;e<y;e++){for(;(o<1||o>20)&&Vr(yr.DATA_ERROR),n.read(1);)n.read(1)?o--:o++;w[e]=o}for(v=b=w[0],e=1;e<y;e++)w[e]>b?b=w[e]:w[e]<v&&(v=w[e]);h={},m.push(h),h.permute=new Uint16Array(258),h.limit=new Uint32Array(22),h.base=new Uint32Array(21),h.minLen=v,h.maxLen=b;var C=0;for(e=v;e<=b;e++)for(_[e]=h.limit[e]=0,o=0;o<y;o++)w[o]===e&&(h.permute[C++]=o);for(e=0;e<y;e++)_[w[e]]++;for(C=o=0,e=v;e<b;e++)C+=_[e],h.limit[e]=C-1,C<<=1,o+=_[e],h.base[e+1]=C-o;h.limit[b+1]=Number.MAX_VALUE,h.limit[b]=C+_[b]-1,h.base[v]=0}var I=new Uint32Array(256);for(e=0;e<256;e++)p[e]=e;var k,E=0,S=0,T=0,P=this.dbuf=new Uint32Array(this.dbufSize);for(y=0;;){for(y--||(y=49,T>=u&&Vr(yr.DATA_ERROR),h=m[d[T++]]),e=h.minLen,t=n.read(e);e>h.maxLen&&Vr(yr.DATA_ERROR),!(t<=h.limit[e]);e++)t=t<<1|n.read(1);((t-=h.base[e])<0||t>=258)&&Vr(yr.DATA_ERROR);var g=h.permute[t];if(g!==0&&g!==1){if(E)for(E=0,S+o>this.dbufSize&&Vr(yr.DATA_ERROR),I[k=a[p[0]]]+=o;o--;)P[S++]=k;if(g>f)break;S>=this.dbufSize&&Vr(yr.DATA_ERROR),I[k=a[k=Zv(p,e=g-1)]]++,P[S++]=k}else E||(E=1,o=0),o+=g===0?E:2*E,E<<=1}for((i<0||i>=S)&&Vr(yr.DATA_ERROR),t=0,e=0;e<256;e++)r=t+I[e],I[e]=t,t=r;for(e=0;e<S;e++)P[I[k=255&P[e]]]|=e<<8,I[k]++;var A=0,x=0,D=0;return S&&(x=255&(A=P[i]),A>>=8,D=-1),this.writePos=A,this.writeCurrent=x,this.writeCount=S,this.writeRun=D,!0},o0.prototype._read_bunzip=function(e,t){var r,n,s;if(this.writeCount<0)return 0;var i=this.dbuf,o=this.writePos,a=this.writeCurrent,f=this.writeCount;this.outputsize;for(var c=this.writeRun;f;){for(f--,n=a,a=255&(o=i[o]),o>>=8,c++==3?(r=a,s=n,a=-1):(r=1,s=a),this.blockCRC.updateCRCRun(s,r);r--;)this.outputStream.writeByte(s),this.nextoutput++;a!=n&&(c=0)}return this.writeCount=f,this.blockCRC.getCRC()!==this.targetBlockCRC&&Vr(yr.DATA_ERROR,"Bad block CRC (got "+this.blockCRC.getCRC().toString(16)+" expected "+this.targetBlockCRC.toString(16)+")"),this.nextoutput};var Yq=function(e){if("readByte"in e)return e;var t=new Mw;return t.pos=0,t.readByte=function(){return e[this.pos++]},t.seek=function(r){this.pos=r},t.eof=function(){return this.pos>=e.length},t},Zq=function(e){var t=new Mw,r=!0;if(e)if(typeof e=="number")t.buffer=new Uint8Array(e),r=!1;else{if("writeByte"in e)return e;t.buffer=e,r=!1}else t.buffer=new Uint8Array(16384);return t.pos=0,t.writeByte=function(n){if(r&&this.pos>=this.buffer.length){var s=new Uint8Array(2*this.buffer.length);s.set(this.buffer),this.buffer=s}this.buffer[this.pos++]=n},t.getBuffer=function(){if(this.pos!==this.buffer.length){if(!r)throw new TypeError("outputsize does not match decoded input");var n=new Uint8Array(this.pos);n.set(this.buffer.subarray(0,this.pos)),this.buffer=n}return this.buffer},t._coerced=!0,t},Jv=function(e,t,r){for(var n=Yq(e),s=Zq(t),i=new o0(n,s);!("eof"in n)||!n.eof();)if(i._init_block())i._read_bunzip();else{var o=i.reader.read(32)>>>0;if(o!==i.streamCRC&&Vr(yr.DATA_ERROR,"Bad stream CRC (got "+i.streamCRC.toString(16)+" expected "+o.toString(16)+")"),!r||!("eof"in n)||n.eof())break;i._start_bunzip(n,s)}if("getBuffer"in s)return s.getBuffer()};class us{static get tag(){return G.packet.literalData}constructor(t=new Date){this.format=G.literal.utf8,this.date=ne.normalizeDate(t),this.text=null,this.data=null,this.filename=""}setText(t,r=G.literal.utf8){this.format=r,this.text=t,this.data=null}getText(t=!1){return(this.text===null||ne.isStream(this.text))&&(this.text=ne.decodeUTF8(ne.nativeEOL(this.getBytes(t)))),this.text}setBytes(t,r){this.format=r,this.data=t,this.text=null}getBytes(t=!1){return this.data===null&&(this.data=ne.canonicalizeEOL(ne.encodeUTF8(this.text))),t?ho(this.data):this.data}setFilename(t){this.filename=t}getFilename(){return this.filename}async read(t){await Ef(t,async r=>{const n=await r.readByte(),s=await r.readByte();this.filename=ne.decodeUTF8(await r.readBytes(s)),this.date=ne.readDate(await r.readBytes(4));let i=r.remainder();Ar(i)&&(i=await Er(i)),this.setBytes(i,n)})}writeHeader(){const t=ne.encodeUTF8(this.filename),r=new Uint8Array([t.length]),n=new Uint8Array([this.format]),s=ne.writeDate(this.date);return ne.concatUint8Array([n,r,t,s])}write(){const t=this.writeHeader(),r=this.getBytes();return ne.concat([t,r])}}const Wo=Symbol("verified"),Jq=new Set([G.signatureSubpacket.issuer,G.signatureSubpacket.issuerFingerprint,G.signatureSubpacket.embeddedSignature]);class Kr{static get tag(){return G.packet.signature}constructor(){this.version=null,this.signatureType=null,this.hashAlgorithm=null,this.publicKeyAlgorithm=null,this.signatureData=null,this.unhashedSubpackets=[],this.signedHashValue=null,this.created=null,this.signatureExpirationTime=null,this.signatureNeverExpires=!0,this.exportable=null,this.trustLevel=null,this.trustAmount=null,this.regularExpression=null,this.revocable=null,this.keyExpirationTime=null,this.keyNeverExpires=null,this.preferredSymmetricAlgorithms=null,this.revocationKeyClass=null,this.revocationKeyAlgorithm=null,this.revocationKeyFingerprint=null,this.issuerKeyID=new js,this.rawNotations=[],this.notations={},this.preferredHashAlgorithms=null,this.preferredCompressionAlgorithms=null,this.keyServerPreferences=null,this.preferredKeyServer=null,this.isPrimaryUserID=null,this.policyURI=null,this.keyFlags=null,this.signersUserID=null,this.reasonForRevocationFlag=null,this.reasonForRevocationString=null,this.features=null,this.signatureTargetPublicKeyAlgorithm=null,this.signatureTargetHashAlgorithm=null,this.signatureTargetHash=null,this.embeddedSignature=null,this.issuerKeyVersion=null,this.issuerFingerprint=null,this.preferredAEADAlgorithms=null,this.revoked=null,this[Wo]=null}read(t){let r=0;if(this.version=t[r++],this.version!==4&&this.version!==5)throw new gr(`Version ${this.version} of the signature packet is unsupported.`);if(this.signatureType=t[r++],this.publicKeyAlgorithm=t[r++],this.hashAlgorithm=t[r++],r+=this.readSubPackets(t.subarray(r,t.length),!0),!this.created)throw Error("Missing signature creation time subpacket.");this.signatureData=t.subarray(0,r),r+=this.readSubPackets(t.subarray(r,t.length),!1),this.signedHashValue=t.subarray(r,r+2),r+=2,this.params=gt.signature.parseSignatureParams(this.publicKeyAlgorithm,t.subarray(r,t.length))}writeParams(){return this.params instanceof Promise?fs(async()=>gt.serializeParams(this.publicKeyAlgorithm,await this.params)):gt.serializeParams(this.publicKeyAlgorithm,this.params)}write(){const t=[];return t.push(this.signatureData),t.push(this.writeUnhashedSubPackets()),t.push(this.signedHashValue),t.push(this.writeParams()),ne.concat(t)}async sign(t,r,n=new Date,s=!1){t.version===5?this.version=5:this.version=4;const i=[new Uint8Array([this.version,this.signatureType,this.publicKeyAlgorithm,this.hashAlgorithm])];this.created=ne.normalizeDate(n),this.issuerKeyVersion=t.version,this.issuerFingerprint=t.getFingerprintBytes(),this.issuerKeyID=t.getKeyID(),i.push(this.writeHashedSubPackets()),this.unhashedSubpackets=[],this.signatureData=ne.concat(i);const o=this.toHash(this.signatureType,r,s),a=await this.hash(this.signatureType,r,o,s);this.signedHashValue=Wr(Ba(a),0,2);const f=async()=>gt.signature.sign(this.publicKeyAlgorithm,this.hashAlgorithm,t.publicParams,t.privateParams,o,await Er(a));ne.isStream(a)?this.params=f():(this.params=await f(),this[Wo]=!0)}writeHashedSubPackets(){const t=G.signatureSubpacket,r=[];let n;if(this.created===null)throw Error("Missing signature creation time");r.push(cr(t.signatureCreationTime,!0,ne.writeDate(this.created))),this.signatureExpirationTime!==null&&r.push(cr(t.signatureExpirationTime,!0,ne.writeNumber(this.signatureExpirationTime,4))),this.exportable!==null&&r.push(cr(t.exportableCertification,!0,new Uint8Array([this.exportable?1:0]))),this.trustLevel!==null&&(n=new Uint8Array([this.trustLevel,this.trustAmount]),r.push(cr(t.trustSignature,!0,n))),this.regularExpression!==null&&r.push(cr(t.regularExpression,!0,this.regularExpression)),this.revocable!==null&&r.push(cr(t.revocable,!0,new Uint8Array([this.revocable?1:0]))),this.keyExpirationTime!==null&&r.push(cr(t.keyExpirationTime,!0,ne.writeNumber(this.keyExpirationTime,4))),this.preferredSymmetricAlgorithms!==null&&(n=ne.stringToUint8Array(ne.uint8ArrayToString(this.preferredSymmetricAlgorithms)),r.push(cr(t.preferredSymmetricAlgorithms,!1,n))),this.revocationKeyClass!==null&&(n=new Uint8Array([this.revocationKeyClass,this.revocationKeyAlgorithm]),n=ne.concat([n,this.revocationKeyFingerprint]),r.push(cr(t.revocationKey,!1,n))),this.issuerKeyID.isNull()||this.issuerKeyVersion===5||r.push(cr(t.issuer,!0,this.issuerKeyID.write())),this.rawNotations.forEach(({name:o,value:a,humanReadable:f,critical:c})=>{n=[new Uint8Array([f?128:0,0,0,0])];const l=ne.encodeUTF8(o);n.push(ne.writeNumber(l.length,2)),n.push(ne.writeNumber(a.length,2)),n.push(l),n.push(a),n=ne.concat(n),r.push(cr(t.notationData,c,n))}),this.preferredHashAlgorithms!==null&&(n=ne.stringToUint8Array(ne.uint8ArrayToString(this.preferredHashAlgorithms)),r.push(cr(t.preferredHashAlgorithms,!1,n))),this.preferredCompressionAlgorithms!==null&&(n=ne.stringToUint8Array(ne.uint8ArrayToString(this.preferredCompressionAlgorithms)),r.push(cr(t.preferredCompressionAlgorithms,!1,n))),this.keyServerPreferences!==null&&(n=ne.stringToUint8Array(ne.uint8ArrayToString(this.keyServerPreferences)),r.push(cr(t.keyServerPreferences,!1,n))),this.preferredKeyServer!==null&&r.push(cr(t.preferredKeyServer,!1,ne.encodeUTF8(this.preferredKeyServer))),this.isPrimaryUserID!==null&&r.push(cr(t.primaryUserID,!1,new Uint8Array([this.isPrimaryUserID?1:0]))),this.policyURI!==null&&r.push(cr(t.policyURI,!1,ne.encodeUTF8(this.policyURI))),this.keyFlags!==null&&(n=ne.stringToUint8Array(ne.uint8ArrayToString(this.keyFlags)),r.push(cr(t.keyFlags,!0,n))),this.signersUserID!==null&&r.push(cr(t.signersUserID,!1,ne.encodeUTF8(this.signersUserID))),this.reasonForRevocationFlag!==null&&(n=ne.stringToUint8Array(String.fromCharCode(this.reasonForRevocationFlag)+this.reasonForRevocationString),r.push(cr(t.reasonForRevocation,!0,n))),this.features!==null&&(n=ne.stringToUint8Array(ne.uint8ArrayToString(this.features)),r.push(cr(t.features,!1,n))),this.signatureTargetPublicKeyAlgorithm!==null&&(n=[new Uint8Array([this.signatureTargetPublicKeyAlgorithm,this.signatureTargetHashAlgorithm])],n.push(ne.stringToUint8Array(this.signatureTargetHash)),n=ne.concat(n),r.push(cr(t.signatureTarget,!0,n))),this.embeddedSignature!==null&&r.push(cr(t.embeddedSignature,!0,this.embeddedSignature.write())),this.issuerFingerprint!==null&&(n=[new Uint8Array([this.issuerKeyVersion]),this.issuerFingerprint],n=ne.concat(n),r.push(cr(t.issuerFingerprint,this.version===5,n))),this.preferredAEADAlgorithms!==null&&(n=ne.stringToUint8Array(ne.uint8ArrayToString(this.preferredAEADAlgorithms)),r.push(cr(t.preferredAEADAlgorithms,!1,n)));const s=ne.concat(r),i=ne.writeNumber(s.length,2);return ne.concat([i,s])}writeUnhashedSubPackets(){const t=[];this.unhashedSubpackets.forEach(s=>{t.push(Y0(s.length)),t.push(s)});const r=ne.concat(t),n=ne.writeNumber(r.length,2);return ne.concat([n,r])}readSubPacket(t,r=!0){let n=0;const s=!!(128&t[n]),i=127&t[n];if(r||(this.unhashedSubpackets.push(t.subarray(n,t.length)),Jq.has(i)))switch(n++,i){case G.signatureSubpacket.signatureCreationTime:this.created=ne.readDate(t.subarray(n,t.length));break;case G.signatureSubpacket.signatureExpirationTime:{const o=ne.readNumber(t.subarray(n,t.length));this.signatureNeverExpires=o===0,this.signatureExpirationTime=o;break}case G.signatureSubpacket.exportableCertification:this.exportable=t[n++]===1;break;case G.signatureSubpacket.trustSignature:this.trustLevel=t[n++],this.trustAmount=t[n++];break;case G.signatureSubpacket.regularExpression:this.regularExpression=t[n];break;case G.signatureSubpacket.revocable:this.revocable=t[n++]===1;break;case G.signatureSubpacket.keyExpirationTime:{const o=ne.readNumber(t.subarray(n,t.length));this.keyExpirationTime=o,this.keyNeverExpires=o===0;break}case G.signatureSubpacket.preferredSymmetricAlgorithms:this.preferredSymmetricAlgorithms=[...t.subarray(n,t.length)];break;case G.signatureSubpacket.revocationKey:this.revocationKeyClass=t[n++],this.revocationKeyAlgorithm=t[n++],this.revocationKeyFingerprint=t.subarray(n,n+20);break;case G.signatureSubpacket.issuer:this.issuerKeyID.read(t.subarray(n,t.length));break;case G.signatureSubpacket.notationData:{const o=!!(128&t[n]);n+=4;const a=ne.readNumber(t.subarray(n,n+2));n+=2;const f=ne.readNumber(t.subarray(n,n+2));n+=2;const c=ne.decodeUTF8(t.subarray(n,n+a)),l=t.subarray(n+a,n+a+f);this.rawNotations.push({name:c,humanReadable:o,value:l,critical:s}),o&&(this.notations[c]=ne.decodeUTF8(l));break}case G.signatureSubpacket.preferredHashAlgorithms:this.preferredHashAlgorithms=[...t.subarray(n,t.length)];break;case G.signatureSubpacket.preferredCompressionAlgorithms:this.preferredCompressionAlgorithms=[...t.subarray(n,t.length)];break;case G.signatureSubpacket.keyServerPreferences:this.keyServerPreferences=[...t.subarray(n,t.length)];break;case G.signatureSubpacket.preferredKeyServer:this.preferredKeyServer=ne.decodeUTF8(t.subarray(n,t.length));break;case G.signatureSubpacket.primaryUserID:this.isPrimaryUserID=t[n++]!==0;break;case G.signatureSubpacket.policyURI:this.policyURI=ne.decodeUTF8(t.subarray(n,t.length));break;case G.signatureSubpacket.keyFlags:this.keyFlags=[...t.subarray(n,t.length)];break;case G.signatureSubpacket.signersUserID:this.signersUserID=ne.decodeUTF8(t.subarray(n,t.length));break;case G.signatureSubpacket.reasonForRevocation:this.reasonForRevocationFlag=t[n++],this.reasonForRevocationString=ne.decodeUTF8(t.subarray(n,t.length));break;case G.signatureSubpacket.features:this.features=[...t.subarray(n,t.length)];break;case G.signatureSubpacket.signatureTarget:{this.signatureTargetPublicKeyAlgorithm=t[n++],this.signatureTargetHashAlgorithm=t[n++];const o=gt.getHashByteLength(this.signatureTargetHashAlgorithm);this.signatureTargetHash=ne.uint8ArrayToString(t.subarray(n,n+o));break}case G.signatureSubpacket.embeddedSignature:this.embeddedSignature=new Kr,this.embeddedSignature.read(t.subarray(n,t.length));break;case G.signatureSubpacket.issuerFingerprint:this.issuerKeyVersion=t[n++],this.issuerFingerprint=t.subarray(n,t.length),this.issuerKeyVersion===5?this.issuerKeyID.read(this.issuerFingerprint):this.issuerKeyID.read(this.issuerFingerprint.subarray(-8));break;case G.signatureSubpacket.preferredAEADAlgorithms:this.preferredAEADAlgorithms=[...t.subarray(n,t.length)];break;default:{const o=Error("Unknown signature subpacket type "+i);if(s)throw o;ne.printDebug(o)}}}readSubPackets(t,r=!0,n){const s=ne.readNumber(t.subarray(0,2));let i=2;for(;i<2+s;){const o=tw(t.subarray(i,t.length));i+=o.offset,this.readSubPacket(t.subarray(i,i+o.len),r,n),i+=o.len}return i}toSign(t,r){const n=G.signature;switch(t){case n.binary:return r.text!==null?ne.encodeUTF8(r.getText(!0)):r.getBytes(!0);case n.text:{const s=r.getBytes(!0);return ne.canonicalizeEOL(s)}case n.standalone:return new Uint8Array(0);case n.certGeneric:case n.certPersona:case n.certCasual:case n.certPositive:case n.certRevocation:{let s,i;if(r.userID)i=180,s=r.userID;else{if(!r.userAttribute)throw Error("Either a userID or userAttribute packet needs to be supplied for certification.");i=209,s=r.userAttribute}const o=s.write();return ne.concat([this.toSign(n.key,r),new Uint8Array([i]),ne.writeNumber(o.length,4),o])}case n.subkeyBinding:case n.subkeyRevocation:case n.keyBinding:return ne.concat([this.toSign(n.key,r),this.toSign(n.key,{key:r.bind})]);case n.key:if(r.key===void 0)throw Error("Key packet is required for this signature.");return r.key.writeForHash(this.version);case n.keyRevocation:return this.toSign(n.key,r);case n.timestamp:return new Uint8Array(0);case n.thirdParty:throw Error("Not implemented");default:throw Error("Unknown signature type.")}}calculateTrailer(t,r){let n=0;return vr(Ba(this.signatureData),s=>{n+=s.length},()=>{const s=[];return this.version!==5||this.signatureType!==G.signature.binary&&this.signatureType!==G.signature.text||(r?s.push(new Uint8Array(6)):s.push(t.writeHeader())),s.push(new Uint8Array([this.version,255])),this.version===5&&s.push(new Uint8Array(4)),s.push(ne.writeNumber(n,4)),ne.concat(s)})}toHash(t,r,n=!1){const s=this.toSign(t,r);return ne.concat([s,this.signatureData,this.calculateTrailer(r,n)])}async hash(t,r,n,s=!1){return n||(n=this.toHash(t,r,s)),gt.hash.digest(this.hashAlgorithm,n)}async verify(t,r,n,s=new Date,i=!1,o=Qe){if(!this.issuerKeyID.equals(t.getKeyID()))throw Error("Signature was not issued by the given public key");if(this.publicKeyAlgorithm!==t.algorithm)throw Error("Public key algorithm used to sign signature does not match issuer key algorithm.");const a=r===G.signature.binary||r===G.signature.text;if(!(this[Wo]&&!a)){let c,l;if(this.hashed?l=await this.hashed:(c=this.toHash(r,n,i),l=await this.hash(r,n,c)),l=await Er(l),this.signedHashValue[0]!==l[0]||this.signedHashValue[1]!==l[1])throw Error("Signed digest did not match");if(this.params=await this.params,this[Wo]=await gt.signature.verify(this.publicKeyAlgorithm,this.hashAlgorithm,this.params,t.publicParams,c,l),!this[Wo])throw Error("Signature verification failed")}const f=ne.normalizeDate(s);if(f&&this.created>f)throw Error("Signature creation time is in the future");if(f&&f>=this.getExpirationTime())throw Error("Signature is expired");if(o.rejectHashAlgorithms.has(this.hashAlgorithm))throw Error("Insecure hash algorithm: "+G.read(G.hash,this.hashAlgorithm).toUpperCase());if(o.rejectMessageHashAlgorithms.has(this.hashAlgorithm)&&[G.signature.binary,G.signature.text].includes(this.signatureType))throw Error("Insecure message hash algorithm: "+G.read(G.hash,this.hashAlgorithm).toUpperCase());if(this.rawNotations.forEach(({name:c,critical:l})=>{if(l&&o.knownNotations.indexOf(c)<0)throw Error("Unknown critical notation: "+c)}),this.revocationKeyClass!==null)throw Error("This key is intended to be revoked with an authorized key, which OpenPGP.js does not support.")}isExpired(t=new Date){const r=ne.normalizeDate(t);return r!==null&&!(this.created<=r&&r<this.getExpirationTime())}getExpirationTime(){return this.signatureNeverExpires?1/0:new Date(this.created.getTime()+1e3*this.signatureExpirationTime)}}function cr(e,t,r){const n=[];return n.push(Y0(r.length+1)),n.push(new Uint8Array([(t?128:0)|e])),n.push(r),ne.concat(n)}class jn{static get tag(){return G.packet.onePassSignature}constructor(){this.version=null,this.signatureType=null,this.hashAlgorithm=null,this.publicKeyAlgorithm=null,this.issuerKeyID=null,this.flags=null}read(t){let r=0;if(this.version=t[r++],this.version!==3)throw new gr(`Version ${this.version} of the one-pass signature packet is unsupported.`);return this.signatureType=t[r++],this.hashAlgorithm=t[r++],this.publicKeyAlgorithm=t[r++],this.issuerKeyID=new js,this.issuerKeyID.read(t.subarray(r,r+8)),r+=8,this.flags=t[r++],this}write(){const t=new Uint8Array([3,this.signatureType,this.hashAlgorithm,this.publicKeyAlgorithm]),r=new Uint8Array([this.flags]);return ne.concatUint8Array([t,this.issuerKeyID.write(),r])}calculateTrailer(...t){return fs(async()=>Kr.prototype.calculateTrailer.apply(await this.correspondingSig,t))}async verify(){const t=await this.correspondingSig;if(!t||t.constructor.tag!==G.packet.signature)throw Error("Corresponding signature packet missing");if(t.signatureType!==this.signatureType||t.hashAlgorithm!==this.hashAlgorithm||t.publicKeyAlgorithm!==this.publicKeyAlgorithm||!t.issuerKeyID.equals(this.issuerKeyID))throw Error("Corresponding signature packet does not match one-pass signature packet");return t.hashed=this.hashed,t.verify.apply(t,arguments)}}function Xq(e,t){if(!t[e]){let r;try{r=G.read(G.packet,e)}catch{throw new gr("Unknown packet type with tag: "+e)}throw Error("Packet not allowed in this context: "+r)}return new t[e]}jn.prototype.hash=Kr.prototype.hash,jn.prototype.toHash=Kr.prototype.toHash,jn.prototype.toSign=Kr.prototype.toSign;class Vt extends Array{static async fromBinary(t,r,n=Qe){const s=new Vt;return await s.read(t,r,n),s}async read(t,r,n=Qe){n.additionalAllowedPackets.length&&(r={...r,...ne.constructAllowedPackets(n.additionalAllowedPackets)}),this.stream=Di(t,async(i,o)=>{const a=Sn(o);try{for(;;)if(await a.ready,await JF(i,async f=>{try{if(f.tag===G.packet.marker||f.tag===G.packet.trust)return;const c=Xq(f.tag,r);c.packets=new Vt,c.fromStream=ne.isStream(f.packet),await c.read(f.packet,n),await a.write(c)}catch(c){const l=!n.ignoreUnsupportedPackets&&c instanceof gr,u=!(n.ignoreMalformedPackets||c instanceof gr);if(l||u||fd(f.tag))await a.abort(c);else{const p=new Md(f.tag,f.packet);await a.write(p)}ne.printDebugError(c)}}))return await a.ready,void await a.close()}catch(f){await a.abort(f)}});const s=Mi(this.stream);for(;;){const{done:i,value:o}=await s.read();if(i?this.stream=null:this.push(o),i||fd(o.constructor.tag))break}s.releaseLock()}write(){const t=[];for(let r=0;r<this.length;r++){const n=this[r]instanceof Md?this[r].tag:this[r].constructor.tag,s=this[r].write();if(ne.isStream(s)&&fd(this[r].constructor.tag)){let i=[],o=0;const a=512;t.push(rw(n)),t.push(vr(s,f=>{if(i.push(f),o+=f.length,o>=a){const c=Math.min(Math.log(o)/Math.LN2|0,30),l=2**c,u=ne.concat([ZF(c)].concat(i));return i=[u.subarray(1+l)],o=i[0].length,u.subarray(0,1+l)}},()=>ne.concat([Y0(o)].concat(i))))}else{if(ne.isStream(s)){let i=0;t.push(vr(Ba(s),o=>{i+=o.length},()=>Y3(n,i)))}else t.push(Y3(n,s.length));t.push(s)}}return ne.concat(t)}filterByTag(...t){const r=new Vt,n=s=>i=>s===i;for(let s=0;s<this.length;s++)t.some(n(this[s].constructor.tag))&&r.push(this[s]);return r}findPacket(t){return this.find(r=>r.constructor.tag===t)}indexOfTag(...t){const r=[],n=this,s=i=>o=>i===o;for(let i=0;i<this.length;i++)t.some(s(n[i].constructor.tag))&&r.push(i);return r}}const Qq=ne.constructAllowedPackets([us,jn,Kr]);class Io{static get tag(){return G.packet.compressedData}constructor(t=Qe){this.packets=null,this.algorithm=t.preferredCompressionAlgorithm,this.compressed=null,this.deflateLevel=t.deflateLevel}async read(t,r=Qe){await Ef(t,async n=>{this.algorithm=await n.readByte(),this.compressed=n.remainder(),await this.decompress(r)})}write(){return this.compressed===null&&this.compress(),ne.concat([new Uint8Array([this.algorithm]),this.compressed])}async decompress(t=Qe){const r=G.read(G.compression,this.algorithm),n=tj[r];if(!n)throw Error(r+" decompression not supported");this.packets=await Vt.fromBinary(n(this.compressed),Qq,t)}compress(){const t=G.read(G.compression,this.algorithm),r=ej[t];if(!r)throw Error(t+" compression not supported");this.compressed=r(this.packets.write(),this.deflateLevel)}}const Ei=ne.getNodeZlib();function Xv(e){return e}function Vd(e,t,r={}){return function(n){return!ne.isStream(n)||Ar(n)?fs(()=>Er(n).then(s=>new Promise((i,o)=>{e(s,r,(a,f)=>{if(a)return o(a);i(f)})}))):wf(sg(n).pipe(t(r)))}}function Gd(e,t={}){return function(r){const n=new e(t);return vr(r,s=>{if(s.length)return n.push(s,k0),n.result},()=>{if(e===vy)return n.push([],Lr),n.result})}}function Qv(e){return function(t){return fs(async()=>e(await Er(t)))}}const ej=Ei?{zip:(e,t)=>Vd(Ei.deflateRaw,Ei.createDeflateRaw,{level:t})(e),zlib:(e,t)=>Vd(Ei.deflate,Ei.createDeflate,{level:t})(e)}:{zip:(e,t)=>Gd(vy,{raw:!0,level:t})(e),zlib:(e,t)=>Gd(vy,{level:t})(e)},tj=Ei?{uncompressed:Xv,zip:Vd(Ei.inflateRaw,Ei.createInflateRaw),zlib:Vd(Ei.inflate,Ei.createInflate),bzip2:Qv(Jv)}:{uncompressed:Xv,zip:Gd(Wv,{raw:!0}),zlib:Gd(Wv),bzip2:Qv(Jv)},rj=ne.constructAllowedPackets([us,Io,jn,Kr]);class vg{static get tag(){return G.packet.symEncryptedIntegrityProtectedData}constructor(){this.version=1,this.encrypted=null,this.packets=null}async read(t){await Ef(t,async r=>{const n=await r.readByte();if(n!==1)throw new gr(`Version ${n} of the SEIP packet is unsupported.`);this.encrypted=r.remainder()})}write(){return ne.concat([new Uint8Array([1]),this.encrypted])}async encrypt(t,r,n=Qe){const{blockSize:s}=gt.getCipher(t);let i=this.packets.write();Ar(i)&&(i=await Er(i));const o=await gt.getPrefixRandom(t),a=new Uint8Array([211,20]),f=ne.concat([o,i,a]),c=await gt.hash.sha1(ho(f)),l=ne.concat([f,c]);return this.encrypted=await gt.mode.cfb.encrypt(t,r,l,new Uint8Array(s),n),!0}async decrypt(t,r,n=Qe){const{blockSize:s}=gt.getCipher(t);let i=Ba(this.encrypted);Ar(i)&&(i=await Er(i));const o=await gt.mode.cfb.decrypt(t,r,i,new Uint8Array(s)),a=Wr(ho(o),-20),f=Wr(o,0,-20),c=Promise.all([Er(await gt.hash.sha1(ho(f))),Er(a)]).then(([p,d])=>{if(!ne.equalsUint8Array(p,d))throw Error("Modification detected.");return new Uint8Array}),l=Wr(f,s+2);let u=Wr(l,0,-2);return u=yn([u,fs(()=>c)]),ne.isStream(i)&&n.allowUnauthenticatedStream||(u=await Er(u)),this.packets=await Vt.fromBinary(u,rj,n),!0}}const nj=ne.constructAllowedPackets([us,Io,jn,Kr]);class X0{static get tag(){return G.packet.aeadEncryptedData}constructor(){this.version=1,this.cipherAlgorithm=null,this.aeadAlgorithm=G.aead.eax,this.chunkSizeByte=null,this.iv=null,this.encrypted=null,this.packets=null}async read(t){await Ef(t,async r=>{const n=await r.readByte();if(n!==1)throw new gr(`Version ${n} of the AEAD-encrypted data packet is not supported.`);this.cipherAlgorithm=await r.readByte(),this.aeadAlgorithm=await r.readByte(),this.chunkSizeByte=await r.readByte();const s=gt.getAEADMode(this.aeadAlgorithm);this.iv=await r.readBytes(s.ivLength),this.encrypted=r.remainder()})}write(){return ne.concat([new Uint8Array([this.version,this.cipherAlgorithm,this.aeadAlgorithm,this.chunkSizeByte]),this.iv,this.encrypted])}async decrypt(t,r,n=Qe){this.packets=await Vt.fromBinary(await this.crypt("decrypt",r,Ba(this.encrypted)),nj,n)}async encrypt(t,r,n=Qe){this.cipherAlgorithm=t;const{ivLength:s}=gt.getAEADMode(this.aeadAlgorithm);this.iv=gt.random.getRandomBytes(s),this.chunkSizeByte=n.aeadChunkSizeByte;const i=this.packets.write();this.encrypted=await this.crypt("encrypt",r,i)}async crypt(t,r,n){const s=gt.getAEADMode(this.aeadAlgorithm),i=await s(this.cipherAlgorithm,r),o=t==="decrypt"?s.tagLength:0,a=t==="encrypt"?s.tagLength:0,f=2**(this.chunkSizeByte+6)+o,c=new ArrayBuffer(21),l=new Uint8Array(c,0,13),u=new Uint8Array(c),p=new DataView(c),d=new Uint8Array(c,5,8);l.set([192|X0.tag,this.version,this.cipherAlgorithm,this.aeadAlgorithm,this.chunkSizeByte],0);let h=0,y=Promise.resolve(),m=0,v=0;const b=this.iv;return Di(n,async(w,_)=>{if(ne.isStream(w)!=="array"){const k=new bo({},{highWaterMark:ne.getHardwareConcurrency()*2**(this.chunkSizeByte+6),size:E=>E.length});ss(k.readable,_),_=k.writable}const C=Mi(w),I=Sn(_);try{for(;;){let k=await C.readBytes(f+o)||new Uint8Array;const E=k.subarray(k.length-o);let S,T;if(k=k.subarray(0,k.length-o),!h||k.length?(C.unshift(E),S=i[t](k,s.getNonce(b,d),l),v+=k.length-o+a):(p.setInt32(17,m),S=i[t](E,s.getNonce(b,d),u),v+=a,T=!0),m+=k.length-o,y=y.then(()=>S).then(async P=>{await I.ready,await I.write(P),v-=P.length}).catch(P=>I.abort(P)),(T||v>I.desiredSize)&&await y,T){await I.close();break}p.setInt32(9,++h)}}catch(k){await I.abort(k)}})}}class zd{static get tag(){return G.packet.publicKeyEncryptedSessionKey}constructor(){this.version=3,this.publicKeyID=new js,this.publicKeyAlgorithm=null,this.sessionKey=null,this.sessionKeyAlgorithm=null,this.encrypted={}}read(t){let r=0;if(this.version=t[r++],this.version!==3)throw new gr(`Version ${this.version} of the PKESK packet is unsupported.`);r+=this.publicKeyID.read(t.subarray(r)),this.publicKeyAlgorithm=t[r++],this.encrypted=gt.parseEncSessionKeyParams(this.publicKeyAlgorithm,t.subarray(r),this.version),this.publicKeyAlgorithm===G.publicKey.x25519&&(this.sessionKeyAlgorithm=G.write(G.symmetric,this.encrypted.C.algorithm))}write(){const t=[new Uint8Array([this.version]),this.publicKeyID.write(),new Uint8Array([this.publicKeyAlgorithm]),gt.serializeParams(this.publicKeyAlgorithm,this.encrypted)];return ne.concatUint8Array(t)}async encrypt(t){const r=G.write(G.publicKey,this.publicKeyAlgorithm),n=eb(this.version,r,this.sessionKeyAlgorithm,this.sessionKey);this.encrypted=await gt.publicKeyEncrypt(r,this.sessionKeyAlgorithm,t.publicParams,n,t.getFingerprintBytes())}async decrypt(t,r){if(this.publicKeyAlgorithm!==t.algorithm)throw Error("Decryption error");const n=r?eb(this.version,this.publicKeyAlgorithm,r.sessionKeyAlgorithm,r.sessionKey):null,s=await gt.publicKeyDecrypt(this.publicKeyAlgorithm,t.publicParams,t.privateParams,this.encrypted,t.getFingerprintBytes(),n),{sessionKey:i,sessionKeyAlgorithm:o}=function(a,f,c,l){switch(f){case G.publicKey.rsaEncrypt:case G.publicKey.rsaEncryptSign:case G.publicKey.elgamal:case G.publicKey.ecdh:{const u=c.subarray(0,c.length-2),p=c.subarray(c.length-2),d=ne.writeChecksum(u.subarray(u.length%8)),h=d[0]===p[0]&d[1]===p[1],y={sessionKeyAlgorithm:u[0],sessionKey:u.subarray(1)};if(l){const m=h&y.sessionKeyAlgorithm===l.sessionKeyAlgorithm&y.sessionKey.length===l.sessionKey.length;return{sessionKey:ne.selectUint8Array(m,y.sessionKey,l.sessionKey),sessionKeyAlgorithm:ne.selectUint8(m,y.sessionKeyAlgorithm,l.sessionKeyAlgorithm)}}if(h&&G.read(G.symmetric,y.sessionKeyAlgorithm))return y;throw Error("Decryption error")}case G.publicKey.x25519:return{sessionKey:c};default:throw Error("Unsupported public key algorithm")}}(this.version,this.publicKeyAlgorithm,s,r);this.publicKeyAlgorithm!==G.publicKey.x25519&&(this.sessionKeyAlgorithm=o),this.sessionKey=i}}function eb(e,t,r,n){switch(t){case G.publicKey.rsaEncrypt:case G.publicKey.rsaEncryptSign:case G.publicKey.elgamal:case G.publicKey.ecdh:return ne.concatUint8Array([new Uint8Array([r]),n,ne.writeChecksum(n.subarray(n.length%8))]);case G.publicKey.x25519:return n;default:throw Error("Unsupported public key algorithm")}}class A0{constructor(t=Qe){this.algorithm=G.hash.sha256,this.type="iterated",this.c=t.s2kIterationCountByte,this.salt=null}getCount(){return 16+(15&this.c)<<6+(this.c>>4)}read(t){let r=0;try{this.type=G.read(G.s2k,t[r++])}catch{throw new gr("Unknown S2K type.")}switch(this.algorithm=t[r++],this.type){case"simple":break;case"salted":this.salt=t.subarray(r,r+8),r+=8;break;case"iterated":this.salt=t.subarray(r,r+8),r+=8,this.c=t[r++];break;case"gnu":if(ne.uint8ArrayToString(t.subarray(r,r+3))!=="GNU")throw new gr("Unknown s2k type.");if(r+=3,1e3+t[r++]!==1001)throw new gr("Unknown s2k gnu protection mode.");this.type="gnu-dummy";break;default:throw new gr("Unknown s2k type.")}return r}write(){if(this.type==="gnu-dummy")return new Uint8Array([101,0,...ne.stringToUint8Array("GNU"),1]);const t=[new Uint8Array([G.write(G.s2k,this.type),this.algorithm])];switch(this.type){case"simple":break;case"salted":t.push(this.salt);break;case"iterated":t.push(this.salt),t.push(new Uint8Array([this.c]));break;case"gnu":throw Error("GNU s2k type not supported.");default:throw Error("Unknown s2k type.")}return ne.concatUint8Array(t)}async produceKey(t,r){t=ne.encodeUTF8(t);const n=[];let s=0,i=0;for(;s<r;){let o;switch(this.type){case"simple":o=ne.concatUint8Array([new Uint8Array(i),t]);break;case"salted":o=ne.concatUint8Array([new Uint8Array(i),this.salt,t]);break;case"iterated":{const f=ne.concatUint8Array([this.salt,t]);let c=f.length;const l=Math.max(this.getCount(),c);o=new Uint8Array(i+l),o.set(f,i);for(let u=i+c;u<l;u+=c,c*=2)o.copyWithin(u,i,u);break}case"gnu":throw Error("GNU s2k type not supported.");default:throw Error("Unknown s2k type.")}const a=await gt.hash.digest(this.algorithm,o);n.push(a),s+=a.length,i++}return ne.concatUint8Array(n).subarray(0,r)}}class Ma{static get tag(){return G.packet.symEncryptedSessionKey}constructor(t=Qe){this.version=t.aeadProtect?5:4,this.sessionKey=null,this.sessionKeyEncryptionAlgorithm=null,this.sessionKeyAlgorithm=G.symmetric.aes256,this.aeadAlgorithm=G.write(G.aead,t.preferredAEADAlgorithm),this.encrypted=null,this.s2k=null,this.iv=null}read(t){let r=0;if(this.version=t[r++],this.version!==4&&this.version!==5)throw new gr(`Version ${this.version} of the SKESK packet is unsupported.`);const n=t[r++];if(this.version===5&&(this.aeadAlgorithm=t[r++]),this.s2k=new A0,r+=this.s2k.read(t.subarray(r,t.length)),this.version===5){const s=gt.getAEADMode(this.aeadAlgorithm);this.iv=t.subarray(r,r+=s.ivLength)}this.version===5||r<t.length?(this.encrypted=t.subarray(r,t.length),this.sessionKeyEncryptionAlgorithm=n):this.sessionKeyAlgorithm=n}write(){const t=this.encrypted===null?this.sessionKeyAlgorithm:this.sessionKeyEncryptionAlgorithm;let r;return this.version===5?r=ne.concatUint8Array([new Uint8Array([this.version,t,this.aeadAlgorithm]),this.s2k.write(),this.iv,this.encrypted]):(r=ne.concatUint8Array([new Uint8Array([this.version,t]),this.s2k.write()]),this.encrypted!==null&&(r=ne.concatUint8Array([r,this.encrypted]))),r}async decrypt(t){const r=this.sessionKeyEncryptionAlgorithm!==null?this.sessionKeyEncryptionAlgorithm:this.sessionKeyAlgorithm,{blockSize:n,keySize:s}=gt.getCipher(r),i=await this.s2k.produceKey(t,s);if(this.version===5){const o=gt.getAEADMode(this.aeadAlgorithm),a=new Uint8Array([192|Ma.tag,this.version,this.sessionKeyEncryptionAlgorithm,this.aeadAlgorithm]),f=await o(r,i);this.sessionKey=await f.decrypt(this.encrypted,this.iv,a)}else if(this.encrypted!==null){const o=await gt.mode.cfb.decrypt(r,i,this.encrypted,new Uint8Array(n));this.sessionKeyAlgorithm=G.write(G.symmetric,o[0]),this.sessionKey=o.subarray(1,o.length)}else this.sessionKey=i}async encrypt(t,r=Qe){const n=this.sessionKeyEncryptionAlgorithm!==null?this.sessionKeyEncryptionAlgorithm:this.sessionKeyAlgorithm;this.sessionKeyEncryptionAlgorithm=n,this.s2k=new A0(r),this.s2k.salt=gt.random.getRandomBytes(8);const{blockSize:s,keySize:i}=gt.getCipher(n),o=await this.s2k.produceKey(t,i);if(this.sessionKey===null&&(this.sessionKey=gt.generateSessionKey(this.sessionKeyAlgorithm)),this.version===5){const a=gt.getAEADMode(this.aeadAlgorithm);this.iv=gt.random.getRandomBytes(a.ivLength);const f=new Uint8Array([192|Ma.tag,this.version,this.sessionKeyEncryptionAlgorithm,this.aeadAlgorithm]),c=await a(n,o);this.encrypted=await c.encrypt(this.sessionKey,this.iv,f)}else{const a=ne.concatUint8Array([new Uint8Array([this.sessionKeyAlgorithm]),this.sessionKey]);this.encrypted=await gt.mode.cfb.encrypt(n,o,a,new Uint8Array(s),r)}}}class ni{static get tag(){return G.packet.publicKey}constructor(t=new Date,r=Qe){this.version=r.v5Keys?5:4,this.created=ne.normalizeDate(t),this.algorithm=null,this.publicParams=null,this.expirationTimeV3=0,this.fingerprint=null,this.keyID=null}static fromSecretKeyPacket(t){const r=new ni,{version:n,created:s,algorithm:i,publicParams:o,keyID:a,fingerprint:f}=t;return r.version=n,r.created=s,r.algorithm=i,r.publicParams=o,r.keyID=a,r.fingerprint=f,r}async read(t){let r=0;if(this.version=t[r++],this.version===4||this.version===5){this.created=ne.readDate(t.subarray(r,r+4)),r+=4,this.algorithm=t[r++],this.version===5&&(r+=4);const{read:n,publicParams:s}=gt.parsePublicKeyParams(this.algorithm,t.subarray(r));return this.publicParams=s,r+=n,await this.computeFingerprintAndKeyID(),r}throw new gr(`Version ${this.version} of the key packet is unsupported.`)}write(){const t=[];t.push(new Uint8Array([this.version])),t.push(ne.writeDate(this.created)),t.push(new Uint8Array([this.algorithm]));const r=gt.serializeParams(this.algorithm,this.publicParams);return this.version===5&&t.push(ne.writeNumber(r.length,4)),t.push(r),ne.concatUint8Array(t)}writeForHash(t){const r=this.writePublicKey();return t===5?ne.concatUint8Array([new Uint8Array([154]),ne.writeNumber(r.length,4),r]):ne.concatUint8Array([new Uint8Array([153]),ne.writeNumber(r.length,2),r])}isDecrypted(){return null}getCreationTime(){return this.created}getKeyID(){return this.keyID}async computeFingerprintAndKeyID(){if(await this.computeFingerprint(),this.keyID=new js,this.version===5)this.keyID.read(this.fingerprint.subarray(0,8));else{if(this.version!==4)throw Error("Unsupported key version");this.keyID.read(this.fingerprint.subarray(12,20))}}async computeFingerprint(){const t=this.writeForHash(this.version);if(this.version===5)this.fingerprint=await gt.hash.sha256(t);else{if(this.version!==4)throw Error("Unsupported key version");this.fingerprint=await gt.hash.sha1(t)}}getFingerprintBytes(){return this.fingerprint}getFingerprint(){return ne.uint8ArrayToHex(this.getFingerprintBytes())}hasSameFingerprintAs(t){return this.version===t.version&&ne.equalsUint8Array(this.writePublicKey(),t.writePublicKey())}getAlgorithmInfo(){const t={};t.algorithm=G.read(G.publicKey,this.algorithm);const r=this.publicParams.n||this.publicParams.p;return r?t.bits=ne.uint8ArrayBitLength(r):this.publicParams.oid&&(t.curve=this.publicParams.oid.getName()),t}}ni.prototype.readPublicKey=ni.prototype.read,ni.prototype.writePublicKey=ni.prototype.write;const ij=ne.constructAllowedPackets([us,Io,jn,Kr]);class Nw{static get tag(){return G.packet.symmetricallyEncryptedData}constructor(){this.encrypted=null,this.packets=null}read(t){this.encrypted=t}write(){return this.encrypted}async decrypt(t,r,n=Qe){if(!n.allowUnauthenticatedMessages)throw Error("Message is not authenticated.");const{blockSize:s}=gt.getCipher(t),i=await Er(Ba(this.encrypted)),o=await gt.mode.cfb.decrypt(t,r,i.subarray(s+2),i.subarray(2,s+2));this.packets=await Vt.fromBinary(o,ij,n)}async encrypt(t,r,n=Qe){const s=this.packets.write(),{blockSize:i}=gt.getCipher(t),o=await gt.getPrefixRandom(t),a=await gt.mode.cfb.encrypt(t,r,o,new Uint8Array(i),n),f=await gt.mode.cfb.encrypt(t,r,s,a.subarray(2),n);this.encrypted=ne.concat([a,f])}}class sj{static get tag(){return G.packet.marker}read(t){return t[0]===80&&t[1]===71&&t[2]===80}write(){return new Uint8Array([80,71,80])}}class Q0 extends ni{static get tag(){return G.packet.publicSubkey}constructor(t,r){super(t,r)}static fromSecretSubkeyPacket(t){const r=new Q0,{version:n,created:s,algorithm:i,publicParams:o,keyID:a,fingerprint:f}=t;return r.version=n,r.created=s,r.algorithm=i,r.publicParams=o,r.keyID=a,r.fingerprint=f,r}}class If{static get tag(){return G.packet.userAttribute}constructor(){this.attributes=[]}read(t){let r=0;for(;r<t.length;){const n=tw(t.subarray(r,t.length));r+=n.offset,this.attributes.push(ne.uint8ArrayToString(t.subarray(r,r+n.len))),r+=n.len}}write(){const t=[];for(let r=0;r<this.attributes.length;r++)t.push(Y0(this.attributes[r].length)),t.push(ne.stringToUint8Array(this.attributes[r]));return ne.concatUint8Array(t)}equals(t){return!!(t&&t instanceof If)&&this.attributes.every(function(r,n){return r===t.attributes[n]})}}class kf extends ni{static get tag(){return G.packet.secretKey}constructor(t=new Date,r=Qe){super(t,r),this.keyMaterial=null,this.isEncrypted=null,this.s2kUsage=0,this.s2k=null,this.symmetric=null,this.aead=null,this.privateParams=null}async read(t){let r=await this.readPublicKey(t);const n=r;this.s2kUsage=t[r++],this.version===5&&r++;try{if(this.s2kUsage===255||this.s2kUsage===254||this.s2kUsage===253){if(this.symmetric=t[r++],this.s2kUsage===253&&(this.aead=t[r++]),this.s2k=new A0,r+=this.s2k.read(t.subarray(r,t.length)),this.s2k.type==="gnu-dummy")return}else this.s2kUsage&&(this.symmetric=this.s2kUsage);this.s2kUsage&&(this.iv=t.subarray(r,r+gt.getCipher(this.symmetric).blockSize),r+=this.iv.length)}catch(s){if(!this.s2kUsage)throw s;this.unparseableKeyMaterial=t.subarray(n),this.isEncrypted=!0}if(this.version===5&&(r+=4),this.keyMaterial=t.subarray(r),this.isEncrypted=!!this.s2kUsage,!this.isEncrypted){const s=this.keyMaterial.subarray(0,-2);if(!ne.equalsUint8Array(ne.writeChecksum(s),this.keyMaterial.subarray(-2)))throw Error("Key checksum mismatch");try{const{privateParams:i}=gt.parsePrivateKeyParams(this.algorithm,s,this.publicParams);this.privateParams=i}catch(i){throw i instanceof gr?i:Error("Error reading MPIs")}}}write(){const t=this.writePublicKey();if(this.unparseableKeyMaterial)return ne.concatUint8Array([t,this.unparseableKeyMaterial]);const r=[t];r.push(new Uint8Array([this.s2kUsage]));const n=[];return this.s2kUsage!==255&&this.s2kUsage!==254&&this.s2kUsage!==253||(n.push(this.symmetric),this.s2kUsage===253&&n.push(this.aead),n.push(...this.s2k.write())),this.s2kUsage&&this.s2k.type!=="gnu-dummy"&&n.push(...this.iv),this.version===5&&r.push(new Uint8Array([n.length])),r.push(new Uint8Array(n)),this.isDummy()||(this.s2kUsage||(this.keyMaterial=gt.serializeParams(this.algorithm,this.privateParams)),this.version===5&&r.push(ne.writeNumber(this.keyMaterial.length,4)),r.push(this.keyMaterial),this.s2kUsage||r.push(ne.writeChecksum(this.keyMaterial))),ne.concatUint8Array(r)}isDecrypted(){return this.isEncrypted===!1}isMissingSecretKeyMaterial(){return this.unparseableKeyMaterial!==void 0||this.isDummy()}isDummy(){return!(!this.s2k||this.s2k.type!=="gnu-dummy")}makeDummy(t=Qe){this.isDummy()||(this.isDecrypted()&&this.clearPrivateParams(),delete this.unparseableKeyMaterial,this.isEncrypted=null,this.keyMaterial=null,this.s2k=new A0(t),this.s2k.algorithm=0,this.s2k.c=0,this.s2k.type="gnu-dummy",this.s2kUsage=254,this.symmetric=G.symmetric.aes256)}async encrypt(t,r=Qe){if(this.isDummy())return;if(!this.isDecrypted())throw Error("Key packet is already encrypted");if(!t)throw Error("A non-empty passphrase is required for key encryption.");this.s2k=new A0(r),this.s2k.salt=gt.random.getRandomBytes(8);const n=gt.serializeParams(this.algorithm,this.privateParams);this.symmetric=G.symmetric.aes256;const s=await tb(this.s2k,t,this.symmetric),{blockSize:i}=gt.getCipher(this.symmetric);if(this.iv=gt.random.getRandomBytes(i),r.aeadProtect){this.s2kUsage=253,this.aead=G.aead.eax;const o=gt.getAEADMode(this.aead),a=await o(this.symmetric,s);this.keyMaterial=await a.encrypt(n,this.iv.subarray(0,o.ivLength),new Uint8Array)}else this.s2kUsage=254,this.keyMaterial=await gt.mode.cfb.encrypt(this.symmetric,s,ne.concatUint8Array([n,await gt.hash.sha1(n,r)]),this.iv,r)}async decrypt(t){if(this.isDummy())return!1;if(this.unparseableKeyMaterial)throw Error("Key packet cannot be decrypted: unsupported S2K or cipher algo");if(this.isDecrypted())throw Error("Key packet is already decrypted.");let r,n;if(this.s2kUsage!==254&&this.s2kUsage!==253)throw this.s2kUsage===255?Error("Encrypted private key is authenticated using an insecure two-byte hash"):Error("Private key is encrypted using an insecure S2K function: unsalted MD5");if(r=await tb(this.s2k,t,this.symmetric),this.s2kUsage===253){const s=gt.getAEADMode(this.aead),i=await s(this.symmetric,r);try{n=await i.decrypt(this.keyMaterial,this.iv.subarray(0,s.ivLength),new Uint8Array)}catch(o){throw o.message==="Authentication tag mismatch"?Error("Incorrect key passphrase: "+o.message):o}}else{const s=await gt.mode.cfb.decrypt(this.symmetric,r,this.keyMaterial,this.iv);n=s.subarray(0,-20);const i=await gt.hash.sha1(n);if(!ne.equalsUint8Array(i,s.subarray(-20)))throw Error("Incorrect key passphrase")}try{const{privateParams:s}=gt.parsePrivateKeyParams(this.algorithm,n,this.publicParams);this.privateParams=s}catch{throw Error("Error reading MPIs")}this.isEncrypted=!1,this.keyMaterial=null,this.s2kUsage=0}async validate(){if(this.isDummy())return;if(!this.isDecrypted())throw Error("Key is not decrypted");let t;try{t=await gt.validateParams(this.algorithm,this.publicParams,this.privateParams)}catch{t=!1}if(!t)throw Error("Key is invalid")}async generate(t,r){const{privateParams:n,publicParams:s}=await gt.generateParams(this.algorithm,t,r);this.privateParams=n,this.publicParams=s,this.isEncrypted=!1}clearPrivateParams(){this.isMissingSecretKeyMaterial()||(Object.keys(this.privateParams).forEach(t=>{this.privateParams[t].fill(0),delete this.privateParams[t]}),this.privateParams=null,this.isEncrypted=!0)}}async function tb(e,t,r){const{keySize:n}=gt.getCipher(r);return e.produceKey(t,n)}var aj=Ui(function(e){(function(t){function r(s){function i(){return Ue<Ie}function o(){return Ue}function a(we){Ue=we}function f(){Ue=0,Ie=Oe.length}function c(we,Ce){return{name:we,tokens:Ce||"",semantic:Ce||"",children:[]}}function l(we,Ce){var Be;return Ce===null?null:((Be=c(we)).tokens=Ce.tokens,Be.semantic=Ce.semantic,Be.children.push(Ce),Be)}function u(we,Ce){return Ce!==null&&(we.tokens+=Ce.tokens,we.semantic+=Ce.semantic),we.children.push(Ce),we}function p(we){var Ce;return i()&&we(Ce=Oe[Ue])?(Ue+=1,c("token",Ce)):null}function d(we){return function(){return l("literal",p(function(Ce){return Ce===we}))}}function h(){var we=arguments;return function(){var Ce,Be,Le,Me;for(Me=o(),Be=c("and"),Ce=0;Ce<we.length;Ce+=1){if((Le=we[Ce]())===null)return a(Me),null;u(Be,Le)}return Be}}function y(){var we=arguments;return function(){var Ce,Be,Le;for(Le=o(),Ce=0;Ce<we.length;Ce+=1){if((Be=we[Ce]())!==null)return Be;a(Le)}return null}}function m(we){return function(){var Ce,Be;return Be=o(),(Ce=we())!==null?Ce:(a(Be),c("opt"))}}function v(we){return function(){var Ce=we();return Ce!==null&&(Ce.semantic=""),Ce}}function b(we){return function(){var Ce=we();return Ce!==null&&Ce.semantic.length>0&&(Ce.semantic=" "),Ce}}function w(we,Ce){return function(){var Be,Le,Me,$,J;for($=o(),Be=c("star"),Me=0,J=Ce===void 0?0:Ce;(Le=we())!==null;)Me+=1,u(Be,Le);return Me>=J?Be:(a($),null)}}function _(we){return we.charCodeAt(0)>=128}function C(){return l("cr",d("\r")())}function I(){return l("crlf",h(C,S)())}function k(){return l("dquote",d('"')())}function E(){return l("htab",d(" ")())}function S(){return l("lf",d(`
50
+ `)())}function T(){return l("sp",d(" ")())}function P(){return l("vchar",p(function(we){var Ce=we.charCodeAt(0),Be=33<=Ce&&Ce<=126;return s.rfc6532&&(Be=Be||_(we)),Be}))}function g(){return l("wsp",y(T,E)())}function A(){var we=l("quoted-pair",y(h(d("\\"),y(P,g)),ue)());return we===null?null:(we.semantic=we.semantic[1],we)}function x(){return l("fws",y(de,h(m(h(w(g),v(I))),w(g,1)))())}function D(){return l("ctext",y(function(){return p(function(we){var Ce=we.charCodeAt(0),Be=33<=Ce&&Ce<=39||42<=Ce&&Ce<=91||93<=Ce&&Ce<=126;return s.rfc6532&&(Be=Be||_(we)),Be})},qe)())}function O(){return l("ccontent",y(D,A,B)())}function B(){return l("comment",h(d("("),w(h(m(x),O)),m(x),d(")"))())}function L(){return l("cfws",y(h(w(h(m(x),B),1),m(x)),x)())}function M(){return l("atext",p(function(we){var Ce="a"<=we&&we<="z"||"A"<=we&&we<="Z"||"0"<=we&&we<="9"||["!","#","$","%","&","'","*","+","-","/","=","?","^","_","`","{","|","}","~"].indexOf(we)>=0;return s.rfc6532&&(Ce=Ce||_(we)),Ce}))}function R(){return l("atom",h(b(m(L)),w(M,1),b(m(L)))())}function N(){var we,Ce;return(we=l("dot-atom-text",w(M,1)()))===null||(Ce=w(h(d("."),w(M,1)))())!==null&&u(we,Ce),we}function F(){return l("dot-atom",h(v(m(L)),N,v(m(L)))())}function z(){return l("qtext",y(function(){return p(function(we){var Ce=we.charCodeAt(0),Be=Ce===33||35<=Ce&&Ce<=91||93<=Ce&&Ce<=126;return s.rfc6532&&(Be=Be||_(we)),Be})},he)())}function Y(){return l("qcontent",y(z,A)())}function j(){return l("quoted-string",h(v(m(L)),v(k),w(h(m(b(x)),Y)),m(v(x)),v(k),v(m(L)))())}function re(){return l("word",y(R,j)())}function V(){return l("address",y(U,_e)())}function U(){return l("mailbox",y(X,Fe)())}function X(){return l("name-addr",h(m(Ae),ye)())}function ye(){return l("angle-addr",y(h(v(m(L)),d("<"),Fe,d(">"),v(m(L))),fe)())}function _e(){return l("group",h(Ae,d(":"),m(W),d(";"),v(m(L)))())}function Ae(){return l("display-name",((we=l("phrase",y(pe,w(re,1))()))!==null&&(we.semantic=function(Ce){return Ce.replace(/([ \t]|\r\n)+/g," ").replace(/^\s*/,"").replace(/\s*$/,"")}(we.semantic)),we));var we}function H(){return l("mailbox-list",y(h(U,w(h(d(","),U))),te)())}function q(){return l("address-list",y(h(V,w(h(d(","),V))),Ne)())}function W(){return l("group-list",y(H,v(L),Ve)())}function ee(){return l("local-part",y(Je,F,j)())}function le(){return l("dtext",y(function(){return p(function(we){var Ce=we.charCodeAt(0),Be=33<=Ce&&Ce<=90||94<=Ce&&Ce<=126;return s.rfc6532&&(Be=Be||_(we)),Be})},tt)())}function ce(){return l("domain-literal",h(v(m(L)),d("["),w(h(m(x),le)),m(x),d("]"),v(m(L)))())}function ie(){return l("domain",(we=y(lt,F,ce)(),s.rejectTLD&&we&&we.semantic&&we.semantic.indexOf(".")<0?null:(we&&(we.semantic=we.semantic.replace(/\s+/g,"")),we)));var we}function Fe(){return l("addr-spec",h(ee,d("@"),ie)())}function De(){return s.strict?null:l("obs-NO-WS-CTL",p(function(we){var Ce=we.charCodeAt(0);return 1<=Ce&&Ce<=8||Ce===11||Ce===12||14<=Ce&&Ce<=31||Ce===127}))}function qe(){return s.strict?null:l("obs-ctext",De())}function he(){return s.strict?null:l("obs-qtext",De())}function ue(){return s.strict?null:l("obs-qp",h(d("\\"),y(d("\0"),De,S,C))())}function pe(){return s.strict?null:s.atInDisplayName?l("obs-phrase",h(re,w(y(re,d("."),d("@"),b(L))))()):l("obs-phrase",h(re,w(y(re,d("."),b(L))))())}function de(){return s.strict?null:l("obs-FWS",w(h(v(m(I)),g),1)())}function fe(){return s.strict?null:l("obs-angle-addr",h(v(m(L)),d("<"),ge,Fe,d(">"),v(m(L)))())}function ge(){return s.strict?null:l("obs-route",h(se,d(":"))())}function se(){return s.strict?null:l("obs-domain-list",h(w(y(v(L),d(","))),d("@"),ie,w(h(d(","),v(m(L)),m(h(d("@"),ie)))))())}function te(){return s.strict?null:l("obs-mbox-list",h(w(h(v(m(L)),d(","))),U,w(h(d(","),m(h(U,v(L))))))())}function Ne(){return s.strict?null:l("obs-addr-list",h(w(h(v(m(L)),d(","))),V,w(h(d(","),m(h(V,v(L))))))())}function Ve(){return s.strict?null:l("obs-group-list",h(w(h(v(m(L)),d(",")),1),v(m(L)))())}function Je(){return s.strict?null:l("obs-local-part",h(re,w(h(d("."),re)))())}function lt(){return s.strict?null:l("obs-domain",h(R,w(h(d("."),R)))())}function tt(){return s.strict?null:l("obs-dtext",y(De,A)())}function ve(we,Ce){var Be,Le,Me;if(Ce==null)return null;for(Le=[Ce];Le.length>0;){if((Me=Le.pop()).name===we)return Me;for(Be=Me.children.length-1;Be>=0;Be-=1)Le.push(Me.children[Be])}return null}function Z(we,Ce){var Be,Le,Me,$,J;if(Ce==null)return null;for(Le=[Ce],$=[],J={},Be=0;Be<we.length;Be+=1)J[we[Be]]=!0;for(;Le.length>0;)if((Me=Le.pop()).name in J)$.push(Me);else for(Be=Me.children.length-1;Be>=0;Be-=1)Le.push(Me.children[Be]);return $}function oe(we){var Ce,Be,Le,Me,$;if(we===null)return null;for(Ce=[],Be=Z(["group","mailbox"],we),Le=0;Le<Be.length;Le+=1)(Me=Be[Le]).name==="group"?Ce.push(me(Me)):Me.name==="mailbox"&&Ce.push(xe(Me));return $={ast:we,addresses:Ce},s.simple&&($=function(J){var Q;if(J&&J.addresses)for(Q=0;Q<J.addresses.length;Q+=1)delete J.addresses[Q].node;return J}($)),s.oneResult?function(J){return!J||!s.partial&&J.addresses.length>1?null:J.addresses&&J.addresses[0]}($):s.simple?$&&$.addresses:$}function me(we){var Ce,Be=ve("display-name",we),Le=[],Me=Z(["mailbox"],we);for(Ce=0;Ce<Me.length;Ce+=1)Le.push(xe(Me[Ce]));return{node:we,parts:{name:Be},type:we.name,name:Pe(Be),addresses:Le}}function xe(we){var Ce=ve("display-name",we),Be=ve("addr-spec",we),Le=function(Q,K){var ae,Se,Te,Ke;if(K==null)return null;for(Se=[K],Ke=[];Se.length>0;)for((Te=Se.pop()).name===Q&&Ke.push(Te),ae=Te.children.length-1;ae>=0;ae-=1)Se.push(Te.children[ae]);return Ke}("cfws",we),Me=Z(["comment"],we),$=ve("local-part",Be),J=ve("domain",Be);return{node:we,parts:{name:Ce,address:Be,local:$,domain:J,comments:Le},type:we.name,name:Pe(Ce),address:Pe(Be),local:Pe($),domain:Pe(J),comments:ke(Me),groupName:Pe(we.groupName)}}function Pe(we){return we!=null?we.semantic:null}function ke(we){var Ce="";if(we)for(var Be=0;Be<we.length;Be+=1)Ce+=Pe(we[Be]);return Ce}var Oe,Ue,Ie,Re,et;if((s=n(s,{}))===null)return null;if(Oe=s.input,et={address:V,"address-list":q,"angle-addr":ye,from:function(){return l("from",y(H,q)())},group:_e,mailbox:U,"mailbox-list":H,"reply-to":function(){return l("reply-to",q())},sender:function(){return l("sender",y(U,V)())}}[s.startAt]||q,!s.strict){if(f(),s.strict=!0,Re=et(Oe),s.partial||!i())return oe(Re);s.strict=!1}return f(),Re=et(Oe),!s.partial&&i()?null:oe(Re)}function n(s,i){function o(l){return Object.prototype.toString.call(l)==="[object String]"}function a(l){return l==null}var f,c;if(o(s))s={input:s};else if(!function(l){return l===Object(l)}(s))return null;if(!o(s.input)||!i)return null;for(c in f={oneResult:!1,partial:!1,rejectTLD:!1,rfc6532:!1,simple:!1,startAt:"address-list",strict:!1,atInDisplayName:!1})a(s[c])&&(s[c]=a(i[c])?f[c]:i[c]);return s}r.parseOneAddress=function(s){return r(n(s,{oneResult:!0,rfc6532:!0,simple:!0,startAt:"address-list"}))},r.parseAddressList=function(s){return r(n(s,{rfc6532:!0,simple:!0,startAt:"address-list"}))},r.parseFrom=function(s){return r(n(s,{rfc6532:!0,simple:!0,startAt:"from"}))},r.parseSender=function(s){return r(n(s,{oneResult:!0,rfc6532:!0,simple:!0,startAt:"sender"}))},r.parseReplyTo=function(s){return r(n(s,{rfc6532:!0,simple:!0,startAt:"reply-to"}))},e.exports=r})()});class el{static get tag(){return G.packet.userID}constructor(){this.userID="",this.name="",this.email="",this.comment=""}static fromObject(t){if(ne.isString(t)||t.name&&!ne.isString(t.name)||t.email&&!ne.isEmailAddress(t.email)||t.comment&&!ne.isString(t.comment))throw Error("Invalid user ID format");const r=new el;Object.assign(r,t);const n=[];return r.name&&n.push(r.name),r.comment&&n.push(`(${r.comment})`),r.email&&n.push(`<${r.email}>`),r.userID=n.join(" "),r}read(t,r=Qe){const n=ne.decodeUTF8(t);if(n.length>r.maxUserIDLength)throw Error("User ID string is too long");try{const{name:s,address:i,comments:o}=aj.parseOneAddress({input:n,atInDisplayName:!0});this.comment=o.replace(/^\(|\)$/g,""),this.name=s,this.email=i}catch{}this.userID=n}write(){return ne.encodeUTF8(this.userID)}equals(t){return t&&t.userID===this.userID}}class bg extends kf{static get tag(){return G.packet.secretSubkey}constructor(t=new Date,r=Qe){super(t,r)}}class oj{static get tag(){return G.packet.trust}read(){throw new gr("Trust packets are not supported")}write(){throw new gr("Trust packets are not supported")}}const cj=ne.constructAllowedPackets([Kr]);class Fs{constructor(t){this.packets=t||new Vt}write(){return this.packets.write()}armor(t=Qe){return Fa(G.armor.signature,this.write(),void 0,void 0,void 0,t)}getSigningKeyIDs(){return this.packets.map(t=>t.issuerKeyID)}}async function uj({armoredSignature:e,binarySignature:t,config:r,...n}){r={...Qe,...r};let s=e||t;if(!s)throw Error("readSignature: must pass options object containing `armoredSignature` or `binarySignature`");if(e&&!ne.isString(e))throw Error("readSignature: options.armoredSignature must be a string");if(t&&!ne.isUint8Array(t))throw Error("readSignature: options.binarySignature must be a Uint8Array");const i=Object.keys(n);if(i.length>0)throw Error("Unknown option: "+i.join(", "));if(e){const{type:a,data:f}=await Ni(s,r);if(a!==G.armor.signature)throw Error("Armored text not of type signature");s=f}const o=await Vt.fromBinary(s,cj,r);return new Fs(o)}async function Uw(e,t){const r=new bg(e.date,t);return r.packets=null,r.algorithm=G.write(G.publicKey,e.algorithm),await r.generate(e.rsaBits,e.curve),await r.computeFingerprintAndKeyID(),r}async function lj(e,t){const r=new kf(e.date,t);return r.packets=null,r.algorithm=G.write(G.publicKey,e.algorithm),await r.generate(e.rsaBits,e.curve,e.config),await r.computeFingerprintAndKeyID(),r}async function ri(e,t,r,n,s=new Date,i){let o,a;for(let f=e.length-1;f>=0;f--)try{(!o||e[f].created>=o.created)&&(await e[f].verify(t,r,n,s,void 0,i),o=e[f])}catch(c){a=c}if(!o)throw ne.wrapError(`Could not find valid ${G.read(G.signature,r)} signature in key ${t.getKeyID().toHex()}`.replace("certGeneric ","self-").replace(/([a-z])([A-Z])/g,(f,c,l)=>c+" "+l.toLowerCase()),a);return o}function by(e,t,r=new Date){const n=ne.normalizeDate(r);if(n!==null){const s=Wd(e,t);return!(e.created<=n&&n<s)}return!1}async function Lw(e,t,r,n){const s={};s.key=t,s.bind=e;const i={signatureType:G.signature.subkeyBinding};return r.sign?(i.keyFlags=[G.keyFlags.signData],i.embeddedSignature=await ls(s,null,e,{signatureType:G.signature.keyBinding},r.date,void 0,void 0,void 0,n)):i.keyFlags=[G.keyFlags.encryptCommunication|G.keyFlags.encryptStorage],r.keyExpirationTime>0&&(i.keyExpirationTime=r.keyExpirationTime,i.keyNeverExpires=!1),await ls(s,null,t,i,r.date,void 0,void 0,void 0,n)}async function Kw(e,t,r=new Date,n={},s){let i=s.preferredHashAlgorithm,o=i;if(e){const a=await e.getPrimaryUser(r,n,s);a.selfCertification.preferredHashAlgorithms&&([o]=a.selfCertification.preferredHashAlgorithms,i=gt.hash.getHashByteLength(i)<=gt.hash.getHashByteLength(o)?o:i)}switch(t.algorithm){case G.publicKey.ecdsa:case G.publicKey.eddsaLegacy:case G.publicKey.ed25519:o=gt.getPreferredCurveHashAlgo(t.algorithm,t.publicParams.oid)}return gt.hash.getHashByteLength(i)<=gt.hash.getHashByteLength(o)?o:i}async function _y(e,t=[],r=new Date,n=[],s=Qe){const i={symmetric:G.symmetric.aes128,aead:G.aead.eax,compression:G.compression.uncompressed}[e],o={symmetric:s.preferredSymmetricAlgorithm,aead:s.preferredAEADAlgorithm,compression:s.preferredCompressionAlgorithm}[e],a={symmetric:"preferredSymmetricAlgorithms",aead:"preferredAEADAlgorithms",compression:"preferredCompressionAlgorithms"}[e];return(await Promise.all(t.map(async function(c,l){const u=(await c.getPrimaryUser(r,n[l],s)).selfCertification[a];return!!u&&u.indexOf(o)>=0}))).every(Boolean)?o:i}async function ls(e,t,r,n,s,i,o=[],a=!1,f){if(r.isDummy())throw Error("Cannot sign with a gnu-dummy key.");if(!r.isDecrypted())throw Error("Signing key is not decrypted.");const c=new Kr;return Object.assign(c,n),c.publicKeyAlgorithm=r.algorithm,c.hashAlgorithm=await Kw(t,r,s,i,f),c.rawNotations=o,await c.sign(r,e,s,a),c}async function Ta(e,t,r,n=new Date,s){(e=e[r])&&(t[r].length?await Promise.all(e.map(async function(i){i.isExpired(n)||s&&!await s(i)||t[r].some(function(o){return ne.equalsUint8Array(o.writeParams(),i.writeParams())})||t[r].push(i)})):t[r]=e)}async function wo(e,t,r,n,s,i,o=new Date,a){i=i||e;const f=[];return await Promise.all(n.map(async function(c){try{s&&!c.issuerKeyID.equals(s.issuerKeyID)||(await c.verify(i,t,r,a.revocationsExpire?o:null,!1,a),f.push(c.issuerKeyID))}catch{}})),s?(s.revoked=!!f.some(c=>c.equals(s.issuerKeyID))||s.revoked||!1,s.revoked):f.length>0}function Wd(e,t){let r;return t.keyNeverExpires===!1&&(r=e.created.getTime()+1e3*t.keyExpirationTime),r?new Date(r):1/0}function wy(e,t={}){switch(e.type=e.type||t.type,e.curve=e.curve||t.curve,e.rsaBits=e.rsaBits||t.rsaBits,e.keyExpirationTime=e.keyExpirationTime!==void 0?e.keyExpirationTime:t.keyExpirationTime,e.passphrase=ne.isString(e.passphrase)?e.passphrase:t.passphrase,e.date=e.date||t.date,e.sign=e.sign||!1,e.type){case"ecc":try{e.curve=G.write(G.curve,e.curve)}catch{throw Error("Unknown curve")}e.curve!==G.curve.ed25519Legacy&&e.curve!==G.curve.curve25519Legacy||(e.curve=e.sign?G.curve.ed25519Legacy:G.curve.curve25519Legacy),e.sign?e.algorithm=e.curve===G.curve.ed25519Legacy?G.publicKey.eddsaLegacy:G.publicKey.ecdsa:e.algorithm=G.publicKey.ecdh;break;case"rsa":e.algorithm=G.publicKey.rsaEncryptSign;break;default:throw Error("Unsupported key type "+e.type)}return e}function rb(e,t){const r=e.algorithm;return r!==G.publicKey.rsaEncrypt&&r!==G.publicKey.elgamal&&r!==G.publicKey.ecdh&&r!==G.publicKey.x25519&&(!t.keyFlags||(t.keyFlags[0]&G.keyFlags.signData)!=0)}function nb(e,t){const r=e.algorithm;return r!==G.publicKey.dsa&&r!==G.publicKey.rsaSign&&r!==G.publicKey.ecdsa&&r!==G.publicKey.eddsaLegacy&&r!==G.publicKey.ed25519&&(!t.keyFlags||(t.keyFlags[0]&G.keyFlags.encryptCommunication)!=0||(t.keyFlags[0]&G.keyFlags.encryptStorage)!=0)}function ib(e,t){return!!t.allowInsecureDecryptionWithSigningKeys||!e.keyFlags||(e.keyFlags[0]&G.keyFlags.encryptCommunication)!=0||(e.keyFlags[0]&G.keyFlags.encryptStorage)!=0}function ao(e,t){const r=G.write(G.publicKey,e.algorithm),n=e.getAlgorithmInfo();if(t.rejectPublicKeyAlgorithms.has(r))throw Error(n.algorithm+" keys are considered too weak.");switch(r){case G.publicKey.rsaEncryptSign:case G.publicKey.rsaSign:case G.publicKey.rsaEncrypt:if(n.bits<t.minRSABits)throw Error(`RSA keys shorter than ${t.minRSABits} bits are considered too weak.`);break;case G.publicKey.ecdsa:case G.publicKey.eddsaLegacy:case G.publicKey.ecdh:if(t.rejectCurves.has(n.curve))throw Error(`Support for ${n.algorithm} keys using curve ${n.curve} is disabled.`)}}class S0{constructor(t,r){this.userID=t.constructor.tag===G.packet.userID?t:null,this.userAttribute=t.constructor.tag===G.packet.userAttribute?t:null,this.selfCertifications=[],this.otherCertifications=[],this.revocationSignatures=[],this.mainKey=r}toPacketList(){const t=new Vt;return t.push(this.userID||this.userAttribute),t.push(...this.revocationSignatures),t.push(...this.selfCertifications),t.push(...this.otherCertifications),t}clone(){const t=new S0(this.userID||this.userAttribute,this.mainKey);return t.selfCertifications=[...this.selfCertifications],t.otherCertifications=[...this.otherCertifications],t.revocationSignatures=[...this.revocationSignatures],t}async certify(t,r,n){const s=this.mainKey.keyPacket,i={userID:this.userID,userAttribute:this.userAttribute,key:s},o=new S0(i.userID||i.userAttribute,this.mainKey);return o.otherCertifications=await Promise.all(t.map(async function(a){if(!a.isPrivate())throw Error("Need private key for signing");if(a.hasSameFingerprintAs(s))throw Error("The user's own key can only be used for self-certifications");const f=await a.getSigningKey(void 0,r,void 0,n);return ls(i,a,f.keyPacket,{signatureType:G.signature.certGeneric,keyFlags:[G.keyFlags.certifyKeys|G.keyFlags.signData]},r,void 0,void 0,void 0,n)})),await o.update(this,r,n),o}async isRevoked(t,r,n=new Date,s=Qe){const i=this.mainKey.keyPacket;return wo(i,G.signature.certRevocation,{key:i,userID:this.userID,userAttribute:this.userAttribute},this.revocationSignatures,t,r,n,s)}async verifyCertificate(t,r,n=new Date,s){const i=this,o=this.mainKey.keyPacket,a={userID:this.userID,userAttribute:this.userAttribute,key:o},{issuerKeyID:f}=t,c=r.filter(l=>l.getKeys(f).length>0);return c.length===0?null:(await Promise.all(c.map(async l=>{const u=await l.getSigningKey(f,t.created,void 0,s);if(t.revoked||await i.isRevoked(t,u.keyPacket,n,s))throw Error("User certificate is revoked");try{await t.verify(u.keyPacket,G.signature.certGeneric,a,n,void 0,s)}catch(p){throw ne.wrapError("User certificate is invalid",p)}})),!0)}async verifyAllCertifications(t,r=new Date,n){const s=this,i=this.selfCertifications.concat(this.otherCertifications);return Promise.all(i.map(async o=>({keyID:o.issuerKeyID,valid:await s.verifyCertificate(o,t,r,n).catch(()=>!1)})))}async verify(t=new Date,r){if(!this.selfCertifications.length)throw Error("No self-certifications found");const n=this,s=this.mainKey.keyPacket,i={userID:this.userID,userAttribute:this.userAttribute,key:s};let o;for(let a=this.selfCertifications.length-1;a>=0;a--)try{const f=this.selfCertifications[a];if(f.revoked||await n.isRevoked(f,void 0,t,r))throw Error("Self-certification is revoked");try{await f.verify(s,G.signature.certGeneric,i,t,void 0,r)}catch(c){throw ne.wrapError("Self-certification is invalid",c)}return!0}catch(f){o=f}throw o}async update(t,r,n){const s=this.mainKey.keyPacket,i={userID:this.userID,userAttribute:this.userAttribute,key:s};await Ta(t,this,"selfCertifications",r,async function(o){try{return await o.verify(s,G.signature.certGeneric,i,r,!1,n),!0}catch{return!1}}),await Ta(t,this,"otherCertifications",r),await Ta(t,this,"revocationSignatures",r,function(o){return wo(s,G.signature.certRevocation,i,[o],void 0,void 0,r,n)})}async revoke(t,{flag:r=G.reasonForRevocation.noReason,string:n=""}={},s=new Date,i=Qe){const o={userID:this.userID,userAttribute:this.userAttribute,key:t},a=new S0(o.userID||o.userAttribute,this.mainKey);return a.revocationSignatures.push(await ls(o,null,t,{signatureType:G.signature.certRevocation,reasonForRevocationFlag:G.write(G.reasonForRevocation,r),reasonForRevocationString:n},s,void 0,void 0,!1,i)),await a.update(this),a}}class Na{constructor(t,r){this.keyPacket=t,this.bindingSignatures=[],this.revocationSignatures=[],this.mainKey=r}toPacketList(){const t=new Vt;return t.push(this.keyPacket),t.push(...this.revocationSignatures),t.push(...this.bindingSignatures),t}clone(){const t=new Na(this.keyPacket,this.mainKey);return t.bindingSignatures=[...this.bindingSignatures],t.revocationSignatures=[...this.revocationSignatures],t}async isRevoked(t,r,n=new Date,s=Qe){const i=this.mainKey.keyPacket;return wo(i,G.signature.subkeyRevocation,{key:i,bind:this.keyPacket},this.revocationSignatures,t,r,n,s)}async verify(t=new Date,r=Qe){const n=this.mainKey.keyPacket,s={key:n,bind:this.keyPacket},i=await ri(this.bindingSignatures,n,G.signature.subkeyBinding,s,t,r);if(i.revoked||await this.isRevoked(i,null,t,r))throw Error("Subkey is revoked");if(by(this.keyPacket,i,t))throw Error("Subkey is expired");return i}async getExpirationTime(t=new Date,r=Qe){const n=this.mainKey.keyPacket,s={key:n,bind:this.keyPacket};let i;try{i=await ri(this.bindingSignatures,n,G.signature.subkeyBinding,s,t,r)}catch{return null}const o=Wd(this.keyPacket,i),a=i.getExpirationTime();return o<a?o:a}async update(t,r=new Date,n=Qe){const s=this.mainKey.keyPacket;if(!this.hasSameFingerprintAs(t))throw Error("Subkey update method: fingerprints of subkeys not equal");this.keyPacket.constructor.tag===G.packet.publicSubkey&&t.keyPacket.constructor.tag===G.packet.secretSubkey&&(this.keyPacket=t.keyPacket);const i=this,o={key:s,bind:i.keyPacket};await Ta(t,this,"bindingSignatures",r,async function(a){for(let f=0;f<i.bindingSignatures.length;f++)if(i.bindingSignatures[f].issuerKeyID.equals(a.issuerKeyID))return a.created>i.bindingSignatures[f].created&&(i.bindingSignatures[f]=a),!1;try{return await a.verify(s,G.signature.subkeyBinding,o,r,void 0,n),!0}catch{return!1}}),await Ta(t,this,"revocationSignatures",r,function(a){return wo(s,G.signature.subkeyRevocation,o,[a],void 0,void 0,r,n)})}async revoke(t,{flag:r=G.reasonForRevocation.noReason,string:n=""}={},s=new Date,i=Qe){const o={key:t,bind:this.keyPacket},a=new Na(this.keyPacket,this.mainKey);return a.revocationSignatures.push(await ls(o,null,t,{signatureType:G.signature.subkeyRevocation,reasonForRevocationFlag:G.write(G.reasonForRevocation,r),reasonForRevocationString:n},s,void 0,void 0,!1,i)),await a.update(this),a}hasSameFingerprintAs(t){return this.keyPacket.hasSameFingerprintAs(t.keyPacket||t)}}["getKeyID","getFingerprint","getAlgorithmInfo","getCreationTime","isDecrypted"].forEach(e=>{Na.prototype[e]=function(){return this.keyPacket[e]()}});const dj=ne.constructAllowedPackets([Kr]),sb=new Set([G.packet.publicKey,G.packet.privateKey]),ab=new Set([G.packet.publicKey,G.packet.privateKey,G.packet.publicSubkey,G.packet.privateSubkey]);class Fw{packetListToStructure(t,r=new Set){let n,s,i,o;for(const a of t){if(a instanceof Md){ab.has(a.tag)&&!o&&(o=sb.has(a.tag)?sb:ab);continue}const f=a.constructor.tag;if(o){if(!o.has(f))continue;o=null}if(r.has(f))throw Error("Unexpected packet type: "+f);switch(f){case G.packet.publicKey:case G.packet.secretKey:if(this.keyPacket)throw Error("Key block contains multiple keys");if(this.keyPacket=a,s=this.getKeyID(),!s)throw Error("Missing Key ID");break;case G.packet.userID:case G.packet.userAttribute:n=new S0(a,this),this.users.push(n);break;case G.packet.publicSubkey:case G.packet.secretSubkey:n=null,i=new Na(a,this),this.subkeys.push(i);break;case G.packet.signature:switch(a.signatureType){case G.signature.certGeneric:case G.signature.certPersona:case G.signature.certCasual:case G.signature.certPositive:if(!n){ne.printDebug("Dropping certification signatures without preceding user packet");continue}a.issuerKeyID.equals(s)?n.selfCertifications.push(a):n.otherCertifications.push(a);break;case G.signature.certRevocation:n?n.revocationSignatures.push(a):this.directSignatures.push(a);break;case G.signature.key:this.directSignatures.push(a);break;case G.signature.subkeyBinding:if(!i){ne.printDebug("Dropping subkey binding signature without preceding subkey packet");continue}i.bindingSignatures.push(a);break;case G.signature.keyRevocation:this.revocationSignatures.push(a);break;case G.signature.subkeyRevocation:if(!i){ne.printDebug("Dropping subkey revocation signature without preceding subkey packet");continue}i.revocationSignatures.push(a)}}}}toPacketList(){const t=new Vt;return t.push(this.keyPacket),t.push(...this.revocationSignatures),t.push(...this.directSignatures),this.users.map(r=>t.push(...r.toPacketList())),this.subkeys.map(r=>t.push(...r.toPacketList())),t}clone(t=!1){const r=new this.constructor(this.toPacketList());return t&&r.getKeys().forEach(n=>{if(n.keyPacket=Object.create(Object.getPrototypeOf(n.keyPacket),Object.getOwnPropertyDescriptors(n.keyPacket)),!n.keyPacket.isDecrypted())return;const s={};Object.keys(n.keyPacket.privateParams).forEach(i=>{s[i]=new Uint8Array(n.keyPacket.privateParams[i])}),n.keyPacket.privateParams=s}),r}getSubkeys(t=null){return this.subkeys.filter(r=>!t||r.getKeyID().equals(t,!0))}getKeys(t=null){const r=[];return t&&!this.getKeyID().equals(t,!0)||r.push(this),r.concat(this.getSubkeys(t))}getKeyIDs(){return this.getKeys().map(t=>t.getKeyID())}getUserIDs(){return this.users.map(t=>t.userID?t.userID.userID:null).filter(t=>t!==null)}write(){return this.toPacketList().write()}async getSigningKey(t=null,r=new Date,n={},s=Qe){await this.verifyPrimaryKey(r,n,s);const i=this.keyPacket,o=this.subkeys.slice().sort((f,c)=>c.keyPacket.created-f.keyPacket.created);let a;for(const f of o)if(!t||f.getKeyID().equals(t))try{await f.verify(r,s);const c={key:i,bind:f.keyPacket},l=await ri(f.bindingSignatures,i,G.signature.subkeyBinding,c,r,s);if(!rb(f.keyPacket,l))continue;if(!l.embeddedSignature)throw Error("Missing embedded signature");return await ri([l.embeddedSignature],f.keyPacket,G.signature.keyBinding,c,r,s),ao(f.keyPacket,s),f}catch(c){a=c}try{const f=await this.getPrimaryUser(r,n,s);if((!t||i.getKeyID().equals(t))&&rb(i,f.selfCertification))return ao(i,s),this}catch(f){a=f}throw ne.wrapError("Could not find valid signing key packet in key "+this.getKeyID().toHex(),a)}async getEncryptionKey(t,r=new Date,n={},s=Qe){await this.verifyPrimaryKey(r,n,s);const i=this.keyPacket,o=this.subkeys.slice().sort((f,c)=>c.keyPacket.created-f.keyPacket.created);let a;for(const f of o)if(!t||f.getKeyID().equals(t))try{await f.verify(r,s);const c={key:i,bind:f.keyPacket},l=await ri(f.bindingSignatures,i,G.signature.subkeyBinding,c,r,s);if(nb(f.keyPacket,l))return ao(f.keyPacket,s),f}catch(c){a=c}try{const f=await this.getPrimaryUser(r,n,s);if((!t||i.getKeyID().equals(t))&&nb(i,f.selfCertification))return ao(i,s),this}catch(f){a=f}throw ne.wrapError("Could not find valid encryption key packet in key "+this.getKeyID().toHex(),a)}async isRevoked(t,r,n=new Date,s=Qe){return wo(this.keyPacket,G.signature.keyRevocation,{key:this.keyPacket},this.revocationSignatures,t,r,n,s)}async verifyPrimaryKey(t=new Date,r={},n=Qe){const s=this.keyPacket;if(await this.isRevoked(null,null,t,n))throw Error("Primary key is revoked");const{selfCertification:i}=await this.getPrimaryUser(t,r,n);if(by(s,i,t))throw Error("Primary key is expired");const o=await ri(this.directSignatures,s,G.signature.key,{key:s},t,n).catch(()=>{});if(o&&by(s,o,t))throw Error("Primary key is expired")}async getExpirationTime(t,r=Qe){let n;try{const{selfCertification:s}=await this.getPrimaryUser(null,t,r),i=Wd(this.keyPacket,s),o=s.getExpirationTime(),a=await ri(this.directSignatures,this.keyPacket,G.signature.key,{key:this.keyPacket},null,r).catch(()=>{});if(a){const f=Wd(this.keyPacket,a);n=Math.min(i,o,f)}else n=i<o?i:o}catch{n=null}return ne.normalizeDate(n)}async getPrimaryUser(t=new Date,r={},n=Qe){const s=this.keyPacket,i=[];let o;for(let l=0;l<this.users.length;l++)try{const u=this.users[l];if(!u.userID)continue;if(r.name!==void 0&&u.userID.name!==r.name||r.email!==void 0&&u.userID.email!==r.email||r.comment!==void 0&&u.userID.comment!==r.comment)throw Error("Could not find user that matches that user ID");const p={userID:u.userID,key:s},d=await ri(u.selfCertifications,s,G.signature.certGeneric,p,t,n);i.push({index:l,user:u,selfCertification:d})}catch(u){o=u}if(!i.length)throw o||Error("Could not find primary user");await Promise.all(i.map(async function(l){return l.selfCertification.revoked||l.user.isRevoked(l.selfCertification,null,t,n)}));const a=i.sort(function(l,u){const p=l.selfCertification,d=u.selfCertification;return d.revoked-p.revoked||p.isPrimaryUserID-d.isPrimaryUserID||p.created-d.created}).pop(),{user:f,selfCertification:c}=a;if(c.revoked||await f.isRevoked(c,null,t,n))throw Error("Primary user is revoked");return a}async update(t,r=new Date,n=Qe){if(!this.hasSameFingerprintAs(t))throw Error("Primary key fingerprints must be equal to update the key");if(!this.isPrivate()&&t.isPrivate()){if(!(this.subkeys.length===t.subkeys.length&&this.subkeys.every(i=>t.subkeys.some(o=>i.hasSameFingerprintAs(o)))))throw Error("Cannot update public key with private key if subkeys mismatch");return t.update(this,n)}const s=this.clone();return await Ta(t,s,"revocationSignatures",r,i=>wo(s.keyPacket,G.signature.keyRevocation,s,[i],null,t.keyPacket,r,n)),await Ta(t,s,"directSignatures",r),await Promise.all(t.users.map(async i=>{const o=s.users.filter(a=>i.userID&&i.userID.equals(a.userID)||i.userAttribute&&i.userAttribute.equals(a.userAttribute));if(o.length>0)await Promise.all(o.map(a=>a.update(i,r,n)));else{const a=i.clone();a.mainKey=s,s.users.push(a)}})),await Promise.all(t.subkeys.map(async i=>{const o=s.subkeys.filter(a=>a.hasSameFingerprintAs(i));if(o.length>0)await Promise.all(o.map(a=>a.update(i,r,n)));else{const a=i.clone();a.mainKey=s,s.subkeys.push(a)}})),s}async getRevocationCertificate(t=new Date,r=Qe){const n={key:this.keyPacket},s=await ri(this.revocationSignatures,this.keyPacket,G.signature.keyRevocation,n,t,r),i=new Vt;return i.push(s),Fa(G.armor.publicKey,i.write(),null,null,"This is a revocation certificate")}async applyRevocationCertificate(t,r=new Date,n=Qe){const s=await Ni(t,n),i=(await Vt.fromBinary(s.data,dj,n)).findPacket(G.packet.signature);if(!i||i.signatureType!==G.signature.keyRevocation)throw Error("Could not find revocation signature packet");if(!i.issuerKeyID.equals(this.getKeyID()))throw Error("Revocation signature does not match key");try{await i.verify(this.keyPacket,G.signature.keyRevocation,{key:this.keyPacket},r,void 0,n)}catch(a){throw ne.wrapError("Could not verify revocation signature",a)}const o=this.clone();return o.revocationSignatures.push(i),o}async signPrimaryUser(t,r,n,s=Qe){const{index:i,user:o}=await this.getPrimaryUser(r,n,s),a=await o.certify(t,r,s),f=this.clone();return f.users[i]=a,f}async signAllUsers(t,r=new Date,n=Qe){const s=this.clone();return s.users=await Promise.all(this.users.map(function(i){return i.certify(t,r,n)})),s}async verifyPrimaryUser(t,r=new Date,n,s=Qe){const i=this.keyPacket,{user:o}=await this.getPrimaryUser(r,n,s);return t?await o.verifyAllCertifications(t,r,s):[{keyID:i.getKeyID(),valid:await o.verify(r,s).catch(()=>!1)}]}async verifyAllUsers(t,r=new Date,n=Qe){const s=this.keyPacket,i=[];return await Promise.all(this.users.map(async o=>{const a=t?await o.verifyAllCertifications(t,r,n):[{keyID:s.getKeyID(),valid:await o.verify(r,n).catch(()=>!1)}];i.push(...a.map(f=>({userID:o.userID?o.userID.userID:null,userAttribute:o.userAttribute,keyID:f.keyID,valid:f.valid})))})),i}}["getKeyID","getFingerprint","getAlgorithmInfo","getCreationTime","hasSameFingerprintAs"].forEach(e=>{Fw.prototype[e]=Na.prototype[e]});class Yd extends Fw{constructor(t){if(super(),this.keyPacket=null,this.revocationSignatures=[],this.directSignatures=[],this.users=[],this.subkeys=[],t&&(this.packetListToStructure(t,new Set([G.packet.secretKey,G.packet.secretSubkey])),!this.keyPacket))throw Error("Invalid key: missing public-key packet")}isPrivate(){return!1}toPublic(){return this}armor(t=Qe){return Fa(G.armor.publicKey,this.toPacketList().write(),void 0,void 0,void 0,t)}}class ja extends Yd{constructor(t){if(super(),this.packetListToStructure(t,new Set([G.packet.publicKey,G.packet.publicSubkey])),!this.keyPacket)throw Error("Invalid key: missing private-key packet")}isPrivate(){return!0}toPublic(){const t=new Vt,r=this.toPacketList();for(const n of r)switch(n.constructor.tag){case G.packet.secretKey:{const s=ni.fromSecretKeyPacket(n);t.push(s);break}case G.packet.secretSubkey:{const s=Q0.fromSecretSubkeyPacket(n);t.push(s);break}default:t.push(n)}return new Yd(t)}armor(t=Qe){return Fa(G.armor.privateKey,this.toPacketList().write(),void 0,void 0,void 0,t)}async getDecryptionKeys(t,r=new Date,n={},s=Qe){const i=this.keyPacket,o=[];for(let f=0;f<this.subkeys.length;f++)if(!t||this.subkeys[f].getKeyID().equals(t,!0))try{const c={key:i,bind:this.subkeys[f].keyPacket};ib(await ri(this.subkeys[f].bindingSignatures,i,G.signature.subkeyBinding,c,r,s),s)&&o.push(this.subkeys[f])}catch{}const a=await this.getPrimaryUser(r,n,s);return t&&!i.getKeyID().equals(t,!0)||!ib(a.selfCertification,s)||o.push(this),o}isDecrypted(){return this.getKeys().some(({keyPacket:t})=>t.isDecrypted())}async validate(t=Qe){if(!this.isPrivate())throw Error("Cannot validate a public key");let r;if(this.keyPacket.isDummy()){const n=await this.getSigningKey(null,null,void 0,{...t,rejectPublicKeyAlgorithms:new Set,minRSABits:0});n&&!n.keyPacket.isDummy()&&(r=n.keyPacket)}else r=this.keyPacket;if(r)return r.validate();{const n=this.getKeys();if(n.map(i=>i.keyPacket.isDummy()).every(Boolean))throw Error("Cannot validate an all-gnu-dummy key");return Promise.all(n.map(async i=>i.keyPacket.validate()))}}clearPrivateParams(){this.getKeys().forEach(({keyPacket:t})=>{t.isDecrypted()&&t.clearPrivateParams()})}async revoke({flag:t=G.reasonForRevocation.noReason,string:r=""}={},n=new Date,s=Qe){if(!this.isPrivate())throw Error("Need private key for revoking");const i={key:this.keyPacket},o=this.clone();return o.revocationSignatures.push(await ls(i,null,this.keyPacket,{signatureType:G.signature.keyRevocation,reasonForRevocationFlag:G.write(G.reasonForRevocation,t),reasonForRevocationString:r},n,void 0,void 0,void 0,s)),o}async addSubkey(t={}){const r={...Qe,...t.config};if(t.passphrase)throw Error("Subkey could not be encrypted here, please encrypt whole key");if(t.rsaBits<r.minRSABits)throw Error(`rsaBits should be at least ${r.minRSABits}, got: ${t.rsaBits}`);const n=this.keyPacket;if(n.isDummy())throw Error("Cannot add subkey to gnu-dummy primary key");if(!n.isDecrypted())throw Error("Key is not decrypted");const s=n.getAlgorithmInfo();s.type=s.curve?"ecc":"rsa",s.rsaBits=s.bits||4096,s.curve=s.curve||"curve25519",t=wy(t,s);const i=await Uw(t);ao(i,r);const o=await Lw(i,n,t,r),a=this.toPacketList();return a.push(i,o),new ja(a)}}const Rf=ne.constructAllowedPackets([ni,Q0,kf,bg,el,If,Kr]);function qw(e){for(const t of e)switch(t.constructor.tag){case G.packet.secretKey:return new ja(e);case G.packet.publicKey:return new Yd(e)}throw Error("No key packet found")}async function jw(e,t,r,n){r.passphrase&&await e.encrypt(r.passphrase,n),await Promise.all(t.map(async function(o,a){const f=r.subkeys[a].passphrase;f&&await o.encrypt(f,n)}));const s=new Vt;s.push(e),await Promise.all(r.userIDs.map(async function(o,a){function f(p,d){return[d,...p.filter(h=>h!==d)]}const c=el.fromObject(o),l={};l.userID=c,l.key=e;const u={};return u.signatureType=G.signature.certGeneric,u.keyFlags=[G.keyFlags.certifyKeys|G.keyFlags.signData],u.preferredSymmetricAlgorithms=f([G.symmetric.aes256,G.symmetric.aes128,G.symmetric.aes192],n.preferredSymmetricAlgorithm),n.aeadProtect&&(u.preferredAEADAlgorithms=f([G.aead.eax,G.aead.ocb],n.preferredAEADAlgorithm)),u.preferredHashAlgorithms=f([G.hash.sha256,G.hash.sha512],n.preferredHashAlgorithm),u.preferredCompressionAlgorithms=f([G.compression.zlib,G.compression.zip,G.compression.uncompressed],n.preferredCompressionAlgorithm),a===0&&(u.isPrimaryUserID=!0),u.features=[0],u.features[0]|=G.features.modificationDetection,n.aeadProtect&&(u.features[0]|=G.features.aead),n.v5Keys&&(u.features[0]|=G.features.v5Keys),r.keyExpirationTime>0&&(u.keyExpirationTime=r.keyExpirationTime,u.keyNeverExpires=!1),{userIDPacket:c,signaturePacket:await ls(l,null,e,u,r.date,void 0,void 0,void 0,n)}})).then(o=>{o.forEach(({userIDPacket:a,signaturePacket:f})=>{s.push(a),s.push(f)})}),await Promise.all(t.map(async function(o,a){const f=r.subkeys[a];return{secretSubkeyPacket:o,subkeySignaturePacket:await Lw(o,e,f,n)}})).then(o=>{o.forEach(({secretSubkeyPacket:a,subkeySignaturePacket:f})=>{s.push(a),s.push(f)})});const i={key:e};return s.push(await ls(i,null,e,{signatureType:G.signature.keyRevocation,reasonForRevocationFlag:G.reasonForRevocation.noReason,reasonForRevocationString:""},r.date,void 0,void 0,void 0,n)),r.passphrase&&e.clearPrivateParams(),await Promise.all(t.map(async function(o,a){r.subkeys[a].passphrase&&o.clearPrivateParams()})),new ja(s)}async function fj({armoredKey:e,binaryKey:t,config:r,...n}){if(r={...Qe,...r},!e&&!t)throw Error("readKey: must pass options object containing `armoredKey` or `binaryKey`");if(e&&!ne.isString(e))throw Error("readKey: options.armoredKey must be a string");if(t&&!ne.isUint8Array(t))throw Error("readKey: options.binaryKey must be a Uint8Array");const s=Object.keys(n);if(s.length>0)throw Error("Unknown option: "+s.join(", "));let i;if(e){const{type:o,data:a}=await Ni(e,r);if(o!==G.armor.publicKey&&o!==G.armor.privateKey)throw Error("Armored text not of type key");i=a}else i=t;return qw(await Vt.fromBinary(i,Rf,r))}async function hj({armoredKey:e,binaryKey:t,config:r,...n}){if(r={...Qe,...r},!e&&!t)throw Error("readPrivateKey: must pass options object containing `armoredKey` or `binaryKey`");if(e&&!ne.isString(e))throw Error("readPrivateKey: options.armoredKey must be a string");if(t&&!ne.isUint8Array(t))throw Error("readPrivateKey: options.binaryKey must be a Uint8Array");const s=Object.keys(n);if(s.length>0)throw Error("Unknown option: "+s.join(", "));let i;if(e){const{type:a,data:f}=await Ni(e,r);if(a!==G.armor.privateKey)throw Error("Armored text not of type private key");i=f}else i=t;const o=await Vt.fromBinary(i,Rf,r);return new ja(o)}async function pj({armoredKeys:e,binaryKeys:t,config:r,...n}){r={...Qe,...r};let s=e||t;if(!s)throw Error("readKeys: must pass options object containing `armoredKeys` or `binaryKeys`");if(e&&!ne.isString(e))throw Error("readKeys: options.armoredKeys must be a string");if(t&&!ne.isUint8Array(t))throw Error("readKeys: options.binaryKeys must be a Uint8Array");const i=Object.keys(n);if(i.length>0)throw Error("Unknown option: "+i.join(", "));if(e){const{type:c,data:l}=await Ni(e,r);if(c!==G.armor.publicKey&&c!==G.armor.privateKey)throw Error("Armored text not of type key");s=l}const o=[],a=await Vt.fromBinary(s,Rf,r),f=a.indexOfTag(G.packet.publicKey,G.packet.secretKey);if(f.length===0)throw Error("No key packet found");for(let c=0;c<f.length;c++){const l=qw(a.slice(f[c],f[c+1]));o.push(l)}return o}async function yj({armoredKeys:e,binaryKeys:t,config:r}){r={...Qe,...r};let n=e||t;if(!n)throw Error("readPrivateKeys: must pass options object containing `armoredKeys` or `binaryKeys`");if(e&&!ne.isString(e))throw Error("readPrivateKeys: options.armoredKeys must be a string");if(t&&!ne.isUint8Array(t))throw Error("readPrivateKeys: options.binaryKeys must be a Uint8Array");if(e){const{type:a,data:f}=await Ni(e,r);if(a!==G.armor.privateKey)throw Error("Armored text not of type private key");n=f}const s=[],i=await Vt.fromBinary(n,Rf,r),o=i.indexOfTag(G.packet.secretKey);if(o.length===0)throw Error("No secret key packet found");for(let a=0;a<o.length;a++){const f=i.slice(o[a],o[a+1]),c=new ja(f);s.push(c)}return s}const gj=ne.constructAllowedPackets([us,Io,X0,vg,Nw,zd,Ma,jn,Kr]),mj=ne.constructAllowedPackets([Ma]),vj=ne.constructAllowedPackets([Kr]);class cn{constructor(t){this.packets=t||new Vt}getEncryptionKeyIDs(){const t=[];return this.packets.filterByTag(G.packet.publicKeyEncryptedSessionKey).forEach(function(r){t.push(r.publicKeyID)}),t}getSigningKeyIDs(){const t=this.unwrapCompressed(),r=t.packets.filterByTag(G.packet.onePassSignature);return r.length>0?r.map(n=>n.issuerKeyID):t.packets.filterByTag(G.packet.signature).map(n=>n.issuerKeyID)}async decrypt(t,r,n,s=new Date,i=Qe){const o=n||await this.decryptSessionKeys(t,r,s,i),a=this.packets.filterByTag(G.packet.symmetricallyEncryptedData,G.packet.symEncryptedIntegrityProtectedData,G.packet.aeadEncryptedData);if(a.length===0)throw Error("No encrypted data found");const f=a[0];let c=null;const l=Promise.all(o.map(async({algorithm:p,data:d})=>{if(!ne.isUint8Array(d)||!ne.isString(p))throw Error("Invalid session key for decryption.");try{const h=G.write(G.symmetric,p);await f.decrypt(h,d,i)}catch(h){ne.printDebugError(h),c=h}}));if(oy(f.encrypted),f.encrypted=null,await l,!f.packets||!f.packets.length)throw c||Error("Decryption failed.");const u=new cn(f.packets);return f.packets=new Vt,u}async decryptSessionKeys(t,r,n=new Date,s=Qe){let i,o=[];if(r){const a=this.packets.filterByTag(G.packet.symEncryptedSessionKey);if(a.length===0)throw Error("No symmetrically encrypted session key packet found.");await Promise.all(r.map(async function(f,c){let l;l=c?await Vt.fromBinary(a.write(),mj,s):a,await Promise.all(l.map(async function(u){try{await u.decrypt(f),o.push(u)}catch(p){ne.printDebugError(p)}}))}))}else{if(!t)throw Error("No key or password specified.");{const a=this.packets.filterByTag(G.packet.publicKeyEncryptedSessionKey);if(a.length===0)throw Error("No public key encrypted session key packet found.");await Promise.all(a.map(async function(f){await Promise.all(t.map(async function(c){let l=[G.symmetric.aes256,G.symmetric.aes128,G.symmetric.tripledes,G.symmetric.cast5];try{const p=await c.getPrimaryUser(n,void 0,s);p.selfCertification.preferredSymmetricAlgorithms&&(l=l.concat(p.selfCertification.preferredSymmetricAlgorithms))}catch{}const u=(await c.getDecryptionKeys(f.publicKeyID,null,void 0,s)).map(p=>p.keyPacket);await Promise.all(u.map(async function(p){if(!(!p||p.isDummy())){if(!p.isDecrypted())throw Error("Decryption key is not decrypted.");if(s.constantTimePKCS1Decryption&&(f.publicKeyAlgorithm===G.publicKey.rsaEncrypt||f.publicKeyAlgorithm===G.publicKey.rsaEncryptSign||f.publicKeyAlgorithm===G.publicKey.rsaSign||f.publicKeyAlgorithm===G.publicKey.elgamal)){const d=f.write();await Promise.all(Array.from(s.constantTimePKCS1DecryptionSupportedSymmetricAlgorithms).map(async h=>{const y=new zd;y.read(d);const m={sessionKeyAlgorithm:h,sessionKey:gt.generateSessionKey(h)};try{await y.decrypt(p,m),o.push(y)}catch(v){ne.printDebugError(v),i=v}}))}else try{if(await f.decrypt(p),!l.includes(G.write(G.symmetric,f.sessionKeyAlgorithm)))throw Error("A non-preferred symmetric algorithm was used.");o.push(f)}catch(d){ne.printDebugError(d),i=d}}}))})),oy(f.encrypted),f.encrypted=null}))}}if(o.length>0){if(o.length>1){const a=new Set;o=o.filter(f=>{const c=f.sessionKeyAlgorithm+ne.uint8ArrayToString(f.sessionKey);return!a.has(c)&&(a.add(c),!0)})}return o.map(a=>({data:a.sessionKey,algorithm:G.read(G.symmetric,a.sessionKeyAlgorithm)}))}throw i||Error("Session key decryption failed.")}getLiteralData(){const t=this.unwrapCompressed().packets.findPacket(G.packet.literalData);return t&&t.getBytes()||null}getFilename(){const t=this.unwrapCompressed().packets.findPacket(G.packet.literalData);return t&&t.getFilename()||null}getText(){const t=this.unwrapCompressed().packets.findPacket(G.packet.literalData);return t?t.getText():null}static async generateSessionKey(t=[],r=new Date,n=[],s=Qe){const i=await _y("symmetric",t,r,n,s),o=G.read(G.symmetric,i),a=s.aeadProtect&&await async function(f,c=new Date,l=[],u=Qe){let p=!0;return await Promise.all(f.map(async function(d,h){const y=await d.getPrimaryUser(c,l[h],u);y.selfCertification.features&&y.selfCertification.features[0]&G.features.aead||(p=!1)})),p}(t,r,n,s)?G.read(G.aead,await _y("aead",t,r,n,s)):void 0;return await Promise.all(t.map(f=>f.getEncryptionKey().catch(()=>null).then(c=>{if(c&&c.keyPacket.algorithm===G.publicKey.x25519&&!ne.isAES(i))throw Error("Could not generate a session key compatible with the given `encryptionKeys`: X22519 keys can only be used to encrypt AES session keys; change `config.preferredSymmetricAlgorithm` accordingly.")}))),{data:gt.generateSessionKey(i),algorithm:o,aeadAlgorithm:a}}async encrypt(t,r,n,s=!1,i=[],o=new Date,a=[],f=Qe){if(n){if(!ne.isUint8Array(n.data)||!ne.isString(n.algorithm))throw Error("Invalid session key for encryption.")}else if(t&&t.length)n=await cn.generateSessionKey(t,o,a,f);else{if(!r||!r.length)throw Error("No keys, passwords, or session key provided.");n=await cn.generateSessionKey(void 0,void 0,void 0,f)}const{data:c,algorithm:l,aeadAlgorithm:u}=n,p=await cn.encryptSessionKey(c,l,u,t,r,s,i,o,a,f);let d;u?(d=new X0,d.aeadAlgorithm=G.write(G.aead,u)):d=new vg,d.packets=this.packets;const h=G.write(G.symmetric,l);return await d.encrypt(h,c,f),p.packets.push(d),d.packets=new Vt,p}static async encryptSessionKey(t,r,n,s,i,o=!1,a=[],f=new Date,c=[],l=Qe){const u=new Vt,p=G.write(G.symmetric,r),d=n&&G.write(G.aead,n);if(s){const h=await Promise.all(s.map(async function(y,m){const v=await y.getEncryptionKey(a[m],f,c,l),b=new zd;return b.publicKeyID=o?js.wildcard():v.getKeyID(),b.publicKeyAlgorithm=v.keyPacket.algorithm,b.sessionKey=t,b.sessionKeyAlgorithm=p,await b.encrypt(v.keyPacket),delete b.sessionKey,b}));u.push(...h)}if(i){const h=async function(b,w){try{return await b.decrypt(w),1}catch{return 0}},y=(b,w)=>b+w,m=async function(b,w,_,C){const I=new Ma(l);return I.sessionKey=b,I.sessionKeyAlgorithm=w,_&&(I.aeadAlgorithm=_),await I.encrypt(C,l),l.passwordCollisionCheck&&(await Promise.all(i.map(k=>h(I,k)))).reduce(y)!==1?m(b,w,C):(delete I.sessionKey,I)},v=await Promise.all(i.map(b=>m(t,p,d,b)));u.push(...v)}return new cn(u)}async sign(t=[],r=null,n=[],s=new Date,i=[],o=[],a=Qe){const f=new Vt,c=this.packets.findPacket(G.packet.literalData);if(!c)throw Error("No literal data packet to sign.");let l,u;const p=c.text===null?G.signature.binary:G.signature.text;if(r)for(u=r.packets.filterByTag(G.packet.signature),l=u.length-1;l>=0;l--){const d=u[l],h=new jn;h.signatureType=d.signatureType,h.hashAlgorithm=d.hashAlgorithm,h.publicKeyAlgorithm=d.publicKeyAlgorithm,h.issuerKeyID=d.issuerKeyID,t.length||l!==0||(h.flags=1),f.push(h)}return await Promise.all(Array.from(t).reverse().map(async function(d,h){if(!d.isPrivate())throw Error("Need private key for signing");const y=n[t.length-1-h],m=await d.getSigningKey(y,s,i,a),v=new jn;return v.signatureType=p,v.hashAlgorithm=await Kw(d,m.keyPacket,s,i,a),v.publicKeyAlgorithm=m.keyPacket.algorithm,v.issuerKeyID=m.getKeyID(),h===t.length-1&&(v.flags=1),v})).then(d=>{d.forEach(h=>f.push(h))}),f.push(c),f.push(...await Ey(c,t,r,n,s,i,o,!1,a)),new cn(f)}compress(t,r=Qe){if(t===G.compression.uncompressed)return this;const n=new Io(r);n.algorithm=t,n.packets=this.packets;const s=new Vt;return s.push(n),new cn(s)}async signDetached(t=[],r=null,n=[],s=new Date,i=[],o=[],a=Qe){const f=this.packets.findPacket(G.packet.literalData);if(!f)throw Error("No literal data packet to sign.");return new Fs(await Ey(f,t,r,n,s,i,o,!0,a))}async verify(t,r=new Date,n=Qe){const s=this.unwrapCompressed(),i=s.packets.filterByTag(G.packet.literalData);if(i.length!==1)throw Error("Can only verify message with one literal data packet.");let o=s.packets;Ar(o.stream)&&(o=o.concat(await Er(o.stream,c=>c||[])));const a=o.filterByTag(G.packet.onePassSignature).reverse(),f=o.filterByTag(G.packet.signature);return a.length&&!f.length&&ne.isStream(o.stream)&&!Ar(o.stream)?(await Promise.all(a.map(async c=>{c.correspondingSig=new Promise((l,u)=>{c.correspondingSigResolve=l,c.correspondingSigReject=u}),c.signatureData=fs(async()=>(await c.correspondingSig).signatureData),c.hashed=Er(await c.hash(c.signatureType,i[0],void 0,!1)),c.hashed.catch(()=>{})})),o.stream=Di(o.stream,async(c,l)=>{const u=Mi(c),p=Sn(l);try{for(let d=0;d<a.length;d++){const{value:h}=await u.read();a[d].correspondingSigResolve(h)}await u.readToEnd(),await p.ready,await p.close()}catch(d){a.forEach(h=>{h.correspondingSigReject(d)}),await p.abort(d)}}),vd(a,i,t,r,!1,n)):vd(f,i,t,r,!1,n)}verifyDetached(t,r,n=new Date,s=Qe){const i=this.unwrapCompressed().packets.filterByTag(G.packet.literalData);if(i.length!==1)throw Error("Can only verify message with one literal data packet.");return vd(t.packets.filterByTag(G.packet.signature),i,r,n,!0,s)}unwrapCompressed(){const t=this.packets.filterByTag(G.packet.compressedData);return t.length?new cn(t[0].packets):this}async appendSignature(t,r=Qe){await this.packets.read(ne.isUint8Array(t)?t:(await Ni(t)).data,vj,r)}write(){return this.packets.write()}armor(t=Qe){return Fa(G.armor.message,this.write(),null,null,null,t)}}async function Ey(e,t,r=null,n=[],s=new Date,i=[],o=[],a=!1,f=Qe){const c=new Vt,l=e.text===null?G.signature.binary:G.signature.text;if(await Promise.all(t.map(async(u,p)=>{const d=i[p];if(!u.isPrivate())throw Error("Need private key for signing");const h=await u.getSigningKey(n[p],s,d,f);return ls(e,u,h.keyPacket,{signatureType:l},s,d,o,a,f)})).then(u=>{c.push(...u)}),r){const u=r.packets.filterByTag(G.packet.signature);c.push(...u)}return c}async function vd(e,t,r,n=new Date,s=!1,i=Qe){return Promise.all(e.filter(function(o){return["text","binary"].includes(G.read(G.signature,o.signatureType))}).map(async function(o){return async function(a,f,c,l=new Date,u=!1,p=Qe){let d,h;for(const v of c){const b=v.getKeys(a.issuerKeyID);if(b.length>0){d=v,h=b[0];break}}const y=a instanceof jn?a.correspondingSig:a,m={keyID:a.issuerKeyID,verified:(async()=>{if(!h)throw Error("Could not find signing key with key ID "+a.issuerKeyID.toHex());await a.verify(h.keyPacket,a.signatureType,f[0],l,u,p);const v=await y;if(h.getCreationTime()>v.created)throw Error("Key is newer than the signature");try{await d.getSigningKey(h.getKeyID(),v.created,void 0,p)}catch(b){if(!p.allowInsecureVerificationWithReformattedKeys||!b.message.match(/Signature creation time is in the future/))throw b;await d.getSigningKey(h.getKeyID(),l,void 0,p)}return!0})(),signature:(async()=>{const v=await y,b=new Vt;return v&&b.push(v),new Fs(b)})()};return m.signature.catch(()=>{}),m.verified.catch(()=>{}),m}(o,t,r,n,s,i)}))}async function bj({armoredMessage:e,binaryMessage:t,config:r,...n}){r={...Qe,...r};let s=e||t;if(!s)throw Error("readMessage: must pass options object containing `armoredMessage` or `binaryMessage`");if(e&&!ne.isString(e)&&!ne.isStream(e))throw Error("readMessage: options.armoredMessage must be a string or stream");if(t&&!ne.isUint8Array(t)&&!ne.isStream(t))throw Error("readMessage: options.binaryMessage must be a Uint8Array or stream");const i=Object.keys(n);if(i.length>0)throw Error("Unknown option: "+i.join(", "));const o=ne.isStream(s);if(o&&(await C9(),s=V0(s)),e){const{type:c,data:l}=await Ni(s,r);if(c!==G.armor.message)throw Error("Armored text not of type message");s=l}const a=await Vt.fromBinary(s,gj,r),f=new cn(a);return f.fromStream=o,f}async function _j({text:e,binary:t,filename:r,date:n=new Date,format:s=e!==void 0?"utf8":"binary",...i}){let o=e!==void 0?e:t;if(o===void 0)throw Error("createMessage: must pass options object containing `text` or `binary`");if(e&&!ne.isString(e)&&!ne.isStream(e))throw Error("createMessage: options.text must be a string or stream");if(t&&!ne.isUint8Array(t)&&!ne.isStream(t))throw Error("createMessage: options.binary must be a Uint8Array or stream");const a=Object.keys(i);if(a.length>0)throw Error("Unknown option: "+a.join(", "));const f=ne.isStream(o);f&&(await C9(),o=V0(o));const c=new us(n);e!==void 0?c.setText(o,G.write(G.literal,s)):c.setBytes(o,G.write(G.literal,s)),r!==void 0&&c.setFilename(r);const l=new Vt;l.push(c);const u=new cn(l);return u.fromStream=f,u}const wj=ne.constructAllowedPackets([Kr]);class Bi{constructor(t,r){if(this.text=ne.removeTrailingSpaces(t).replace(/\r?\n/g,`\r
51
+ `),r&&!(r instanceof Fs))throw Error("Invalid signature input");this.signature=r||new Fs(new Vt)}getSigningKeyIDs(){const t=[];return this.signature.packets.forEach(function(r){t.push(r.issuerKeyID)}),t}async sign(t,r=null,n=[],s=new Date,i=[],o=[],a=Qe){const f=new us;f.setText(this.text);const c=new Fs(await Ey(f,t,r,n,s,i,o,!0,a));return new Bi(this.text,c)}verify(t,r=new Date,n=Qe){const s=this.signature.packets.filterByTag(G.packet.signature),i=new us;return i.setText(this.text),vd(s,[i],t,r,!0,n)}getText(){return this.text.replace(/\r\n/g,`
52
+ `)}armor(t=Qe){let r=this.signature.packets.map(function(s){return G.read(G.hash,s.hashAlgorithm).toUpperCase()});r=r.filter(function(s,i,o){return o.indexOf(s)===i});const n={hash:r.join(),text:this.text,data:this.signature.packets.write()};return Fa(G.armor.signed,n,void 0,void 0,void 0,t)}}async function Ej({cleartextMessage:e,config:t,...r}){if(t={...Qe,...t},!e)throw Error("readCleartextMessage: must pass options object containing `cleartextMessage`");if(!ne.isString(e))throw Error("readCleartextMessage: options.cleartextMessage must be a string");const n=Object.keys(r);if(n.length>0)throw Error("Unknown option: "+n.join(", "));const s=await Ni(e);if(s.type!==G.armor.signed)throw Error("No cleartext signed message.");const i=await Vt.fromBinary(s.data,wj,t);(function(a,f){const c=function(p){const d=h=>y=>h.hashAlgorithm===y;for(let h=0;h<f.length;h++)if(f[h].constructor.tag===G.packet.signature&&!p.some(d(f[h])))return!1;return!0};let l=null,u=[];if(a.forEach(function(p){if(l=p.match(/^Hash: (.+)$/),!l)throw Error('Only "Hash" header allowed in cleartext signed message');l=l[1].replace(/\s/g,""),l=l.split(","),l=l.map(function(d){d=d.toLowerCase();try{return G.write(G.hash,d)}catch{throw Error("Unknown hash algorithm in armor header: "+d)}}),u=u.concat(l)}),!u.length&&!c([G.hash.md5]))throw Error('If no "Hash" header in cleartext signed message, then only MD5 signatures allowed');if(u.length&&!c(u))throw Error("Hash algorithm mismatch in armor header and signature")})(s.headers,i);const o=new Fs(i);return new Bi(s.text,o)}async function Aj({text:e,...t}){if(!e)throw Error("createCleartextMessage: must pass options object containing `text`");if(!ne.isString(e))throw Error("createCleartextMessage: options.text must be a string");const r=Object.keys(t);if(r.length>0)throw Error("Unknown option: "+r.join(", "));return new Bi(e)}async function Sj({userIDs:e=[],passphrase:t,type:r="ecc",rsaBits:n=4096,curve:s="curve25519",keyExpirationTime:i=0,date:o=new Date,subkeys:a=[{}],format:f="armored",config:c,...l}){Vn(c={...Qe,...c}),e=sr(e);const u=Object.keys(l);if(u.length>0)throw Error("Unknown option: "+u.join(", "));if(e.length===0)throw Error("UserIDs are required for key generation");if(r==="rsa"&&n<c.minRSABits)throw Error(`rsaBits should be at least ${c.minRSABits}, got: ${n}`);const p={userIDs:e,passphrase:t,type:r,rsaBits:n,curve:s,keyExpirationTime:i,date:o,subkeys:a};try{const{key:d,revocationCertificate:h}=await async function(y,m){y.sign=!0,(y=wy(y)).subkeys=y.subkeys.map((C,I)=>wy(y.subkeys[I],y));let v=[lj(y,m)];v=v.concat(y.subkeys.map(C=>Uw(C,m)));const b=await Promise.all(v),w=await jw(b[0],b.slice(1),y,m),_=await w.getRevocationCertificate(y.date,m);return w.revocationSignatures=[],{key:w,revocationCertificate:_}}(p,c);return d.getKeys().forEach(({keyPacket:y})=>ao(y,c)),{privateKey:qs(d,f,c),publicKey:qs(d.toPublic(),f,c),revocationCertificate:h}}catch(d){throw ne.wrapError("Error generating keypair",d)}}async function Pj({privateKey:e,userIDs:t=[],passphrase:r,keyExpirationTime:n=0,date:s,format:i="armored",config:o,...a}){Vn(o={...Qe,...o}),t=sr(t);const f=Object.keys(a);if(f.length>0)throw Error("Unknown option: "+f.join(", "));if(t.length===0)throw Error("UserIDs are required for key reformat");const c={privateKey:e,userIDs:t,passphrase:r,keyExpirationTime:n,date:s};try{const{key:l,revocationCertificate:u}=await async function(p,d){p=w(p);const{privateKey:h}=p;if(!h.isPrivate())throw Error("Cannot reformat a public key");if(h.keyPacket.isDummy())throw Error("Cannot reformat a gnu-dummy primary key");if(!h.getKeys().every(({keyPacket:_})=>_.isDecrypted()))throw Error("Key is not decrypted");const y=h.keyPacket;p.subkeys||(p.subkeys=await Promise.all(h.subkeys.map(async _=>{const C=_.keyPacket,I={key:y,bind:C},k=await ri(_.bindingSignatures,y,G.signature.subkeyBinding,I,null,d).catch(()=>({}));return{sign:k.keyFlags&&k.keyFlags[0]&G.keyFlags.signData}})));const m=h.subkeys.map(_=>_.keyPacket);if(p.subkeys.length!==m.length)throw Error("Number of subkey options does not match number of subkeys");p.subkeys=p.subkeys.map(_=>w(_,p));const v=await jw(y,m,p,d),b=await v.getRevocationCertificate(p.date,d);return v.revocationSignatures=[],{key:v,revocationCertificate:b};function w(_,C={}){return _.keyExpirationTime=_.keyExpirationTime||C.keyExpirationTime,_.passphrase=ne.isString(_.passphrase)?_.passphrase:C.passphrase,_.date=_.date||C.date,_}}(c,o);return{privateKey:qs(l,i,o),publicKey:qs(l.toPublic(),i,o),revocationCertificate:u}}catch(l){throw ne.wrapError("Error reformatting keypair",l)}}async function xj({key:e,revocationCertificate:t,reasonForRevocation:r,date:n=new Date,format:s="armored",config:i,...o}){Vn(i={...Qe,...i});const a=Object.keys(o);if(a.length>0)throw Error("Unknown option: "+a.join(", "));try{const f=t?await e.applyRevocationCertificate(t,n,i):await e.revoke(r,n,i);return f.isPrivate()?{privateKey:qs(f,s,i),publicKey:qs(f.toPublic(),s,i)}:{privateKey:null,publicKey:qs(f,s,i)}}catch(f){throw ne.wrapError("Error revoking key",f)}}async function Tj({privateKey:e,passphrase:t,config:r,...n}){Vn(r={...Qe,...r});const s=Object.keys(n);if(s.length>0)throw Error("Unknown option: "+s.join(", "));if(!e.isPrivate())throw Error("Cannot decrypt a public key");const i=e.clone(!0),o=ne.isArray(t)?t:[t];try{return await Promise.all(i.getKeys().map(a=>ne.anyPromise(o.map(f=>a.keyPacket.decrypt(f))))),await i.validate(r),i}catch(a){throw i.clearPrivateParams(),ne.wrapError("Error decrypting private key",a)}}async function Cj({privateKey:e,passphrase:t,config:r,...n}){Vn(r={...Qe,...r});const s=Object.keys(n);if(s.length>0)throw Error("Unknown option: "+s.join(", "));if(!e.isPrivate())throw Error("Cannot encrypt a public key");const i=e.clone(!0),o=i.getKeys(),a=ne.isArray(t)?t:Array(o.length).fill(t);if(a.length!==o.length)throw Error("Invalid number of passphrases given for key encryption");try{return await Promise.all(o.map(async(f,c)=>{const{keyPacket:l}=f;await l.encrypt(a[c],r),l.clearPrivateParams()})),i}catch(f){throw i.clearPrivateParams(),ne.wrapError("Error encrypting private key",f)}}async function Ij({message:e,encryptionKeys:t,signingKeys:r,passwords:n,sessionKey:s,format:i="armored",signature:o=null,wildcard:a=!1,signingKeyIDs:f=[],encryptionKeyIDs:c=[],date:l=new Date,signingUserIDs:u=[],encryptionUserIDs:p=[],signatureNotations:d=[],config:h,...y}){if(Vn(h={...Qe,...h}),_g(e),wg(i),t=sr(t),r=sr(r),n=sr(n),f=sr(f),c=sr(c),u=sr(u),p=sr(p),d=sr(d),y.detached)throw Error("The `detached` option has been removed from openpgp.encrypt, separately call openpgp.sign instead. Don't forget to remove the `privateKeys` option as well.");if(y.publicKeys)throw Error("The `publicKeys` option has been removed from openpgp.encrypt, pass `encryptionKeys` instead");if(y.privateKeys)throw Error("The `privateKeys` option has been removed from openpgp.encrypt, pass `signingKeys` instead");if(y.armor!==void 0)throw Error("The `armor` option has been removed from openpgp.encrypt, pass `format` instead.");const m=Object.keys(y);if(m.length>0)throw Error("Unknown option: "+m.join(", "));r||(r=[]);const v=e.fromStream;try{if((r.length||o)&&(e=await e.sign(r,o,f,l,u,d,h)),e=e.compress(await _y("compression",t,l,p,h),h),e=await e.encrypt(t,n,s,a,c,l,p,h),i==="object")return e;const b=i==="armored";return Df(b?e.armor(h):e.write(),v,b?"utf8":"binary")}catch(b){throw ne.wrapError("Error encrypting message",b)}}async function kj({message:e,decryptionKeys:t,passwords:r,sessionKeys:n,verificationKeys:s,expectSigned:i=!1,format:o="utf8",signature:a=null,date:f=new Date,config:c,...l}){if(Vn(c={...Qe,...c}),_g(e),s=sr(s),t=sr(t),r=sr(r),n=sr(n),l.privateKeys)throw Error("The `privateKeys` option has been removed from openpgp.decrypt, pass `decryptionKeys` instead");if(l.publicKeys)throw Error("The `publicKeys` option has been removed from openpgp.decrypt, pass `verificationKeys` instead");const u=Object.keys(l);if(u.length>0)throw Error("Unknown option: "+u.join(", "));try{const p=await e.decrypt(t,r,n,f,c);s||(s=[]);const d={};if(d.signatures=a?await p.verifyDetached(a,s,f,c):await p.verify(s,f,c),d.data=o==="binary"?p.getLiteralData():p.getText(),d.filename=p.getFilename(),Hw(d,e),i){if(s.length===0)throw Error("Verification keys are required to verify message signatures");if(d.signatures.length===0)throw Error("Message is not signed");d.data=yn([d.data,fs(async()=>{await ne.anyPromise(d.signatures.map(h=>h.verified))})])}return d.data=await Df(d.data,e.fromStream,o),d}catch(p){throw ne.wrapError("Error decrypting message",p)}}async function Rj({message:e,signingKeys:t,format:r="armored",detached:n=!1,signingKeyIDs:s=[],date:i=new Date,signingUserIDs:o=[],signatureNotations:a=[],config:f,...c}){if(Vn(f={...Qe,...f}),$w(e),wg(r),t=sr(t),s=sr(s),o=sr(o),a=sr(a),c.privateKeys)throw Error("The `privateKeys` option has been removed from openpgp.sign, pass `signingKeys` instead");if(c.armor!==void 0)throw Error("The `armor` option has been removed from openpgp.sign, pass `format` instead.");const l=Object.keys(c);if(l.length>0)throw Error("Unknown option: "+l.join(", "));if(e instanceof Bi&&r==="binary")throw Error("Cannot return signed cleartext message in binary format");if(e instanceof Bi&&n)throw Error("Cannot detach-sign a cleartext message");if(!t||t.length===0)throw Error("No signing keys provided");try{let u;if(u=n?await e.signDetached(t,void 0,s,i,o,a,f):await e.sign(t,void 0,s,i,o,a,f),r==="object")return u;const p=r==="armored";return u=p?u.armor(f):u.write(),n&&(u=Di(e.packets.write(),async(d,h)=>{await Promise.all([ss(u,h),Er(d).catch(()=>{})])})),Df(u,e.fromStream,p?"utf8":"binary")}catch(u){throw ne.wrapError("Error signing message",u)}}async function Dj({message:e,verificationKeys:t,expectSigned:r=!1,format:n="utf8",signature:s=null,date:i=new Date,config:o,...a}){if(Vn(o={...Qe,...o}),$w(e),t=sr(t),a.publicKeys)throw Error("The `publicKeys` option has been removed from openpgp.verify, pass `verificationKeys` instead");const f=Object.keys(a);if(f.length>0)throw Error("Unknown option: "+f.join(", "));if(e instanceof Bi&&n==="binary")throw Error("Can't return cleartext message data as binary");if(e instanceof Bi&&s)throw Error("Can't verify detached cleartext signature");try{const c={};if(c.signatures=s?await e.verifyDetached(s,t,i,o):await e.verify(t,i,o),c.data=n==="binary"?e.getLiteralData():e.getText(),e.fromStream&&!s&&Hw(c,e),r){if(c.signatures.length===0)throw Error("Message is not signed");c.data=yn([c.data,fs(async()=>{await ne.anyPromise(c.signatures.map(l=>l.verified))})])}return c.data=await Df(c.data,e.fromStream,n),c}catch(c){throw ne.wrapError("Error verifying signed message",c)}}async function Bj({encryptionKeys:e,date:t=new Date,encryptionUserIDs:r=[],config:n,...s}){if(Vn(n={...Qe,...n}),e=sr(e),r=sr(r),s.publicKeys)throw Error("The `publicKeys` option has been removed from openpgp.generateSessionKey, pass `encryptionKeys` instead");const i=Object.keys(s);if(i.length>0)throw Error("Unknown option: "+i.join(", "));try{return await cn.generateSessionKey(e,t,r,n)}catch(o){throw ne.wrapError("Error generating session key",o)}}async function Oj({data:e,algorithm:t,aeadAlgorithm:r,encryptionKeys:n,passwords:s,format:i="armored",wildcard:o=!1,encryptionKeyIDs:a=[],date:f=new Date,encryptionUserIDs:c=[],config:l,...u}){if(Vn(l={...Qe,...l}),function(d,h){if(!ne.isUint8Array(d))throw Error("Parameter ["+(h||"data")+"] must be of type Uint8Array")}(e),function(d,h){if(!ne.isString(d))throw Error("Parameter ["+(h||"data")+"] must be of type String")}(t,"algorithm"),wg(i),n=sr(n),s=sr(s),a=sr(a),c=sr(c),u.publicKeys)throw Error("The `publicKeys` option has been removed from openpgp.encryptSessionKey, pass `encryptionKeys` instead");const p=Object.keys(u);if(p.length>0)throw Error("Unknown option: "+p.join(", "));if(!(n&&n.length!==0||s&&s.length!==0))throw Error("No encryption keys or passwords provided.");try{return qs(await cn.encryptSessionKey(e,t,r,n,s,o,a,f,c,l),i,l)}catch(d){throw ne.wrapError("Error encrypting session key",d)}}async function Mj({message:e,decryptionKeys:t,passwords:r,date:n=new Date,config:s,...i}){if(Vn(s={...Qe,...s}),_g(e),t=sr(t),r=sr(r),i.privateKeys)throw Error("The `privateKeys` option has been removed from openpgp.decryptSessionKeys, pass `decryptionKeys` instead");const o=Object.keys(i);if(o.length>0)throw Error("Unknown option: "+o.join(", "));try{return await e.decryptSessionKeys(t,r,n,s)}catch(a){throw ne.wrapError("Error decrypting session keys",a)}}function _g(e){if(!(e instanceof cn))throw Error("Parameter [message] needs to be of type Message")}function $w(e){if(!(e instanceof Bi||e instanceof cn))throw Error("Parameter [message] needs to be of type Message or CleartextMessage")}function wg(e){if(e!=="armored"&&e!=="binary"&&e!=="object")throw Error("Unsupported format "+e)}const Nj=Object.keys(Qe).length;function Vn(e){const t=Object.keys(e);if(t.length!==Nj){for(const r of t)if(Qe[r]===void 0)throw Error("Unknown config property: "+r)}}function sr(e){return e&&!ne.isArray(e)&&(e=[e]),e}async function Df(e,t,r="utf8"){const n=ne.isStream(e);return n==="array"?Er(e):t==="node"?(e=sg(e),r!=="binary"&&e.setEncoding(r),e):t==="web"&&n==="ponyfill"?x9(e):e}function Hw(e,t){e.data=Di(t.packets.stream,async(r,n)=>{await ss(e.data,n,{preventClose:!0});const s=Sn(n);try{await Er(r,i=>i),await s.close()}catch(i){await s.abort(i)}})}function qs(e,t,r){switch(t){case"object":return e;case"armored":return e.armor(r);case"binary":return e.write();default:throw Error("Unsupported format "+t)}}const Gt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol:e=>`Symbol(${e})`;function Eg(){}const ob=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:void 0;function Pn(e){return typeof e=="object"&&e!==null||typeof e=="function"}const Vw=Eg,Ag=Promise,Uj=Promise.prototype.then,Lj=Promise.resolve.bind(Ag),Kj=Promise.reject.bind(Ag);function mn(e){return new Ag(e)}function dr(e){return Lj(e)}function Rt(e){return Kj(e)}function rs(e,t,r){return Uj.call(e,t,r)}function ai(e,t,r){rs(rs(e,t,r),void 0,Vw)}function _1(e,t){ai(e,t)}function Gw(e,t){ai(e,void 0,t)}function Ca(e,t,r){return rs(e,t,r)}function tl(e){rs(e,void 0,Vw)}const zw=(()=>{const e=ob&&ob.queueMicrotask;if(typeof e=="function")return e;const t=dr(void 0);return r=>rs(t,r)})();function Bf(e,t,r){if(typeof e!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function $a(e,t,r){try{return dr(Bf(e,t,r))}catch(n){return Rt(n)}}class Oi{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(t){const r=this._back;let n=r;r._elements.length===16383&&(n={_elements:[],_next:void 0}),r._elements.push(t),n!==r&&(this._back=n,r._next=n),++this._size}shift(){const t=this._front;let r=t;const n=this._cursor;let s=n+1;const i=t._elements,o=i[n];return s===16384&&(r=t._next,s=0),--this._size,this._cursor=s,t!==r&&(this._front=r),i[n]=void 0,o}forEach(t){let r=this._cursor,n=this._front,s=n._elements;for(;!(r===s.length&&n._next===void 0||r===s.length&&(n=n._next,s=n._elements,r=0,s.length===0));)t(s[r]),++r}peek(){const t=this._front,r=this._cursor;return t._elements[r]}}function Ww(e,t){e._ownerReadableStream=t,t._reader=e,t._state==="readable"?Ay(e):t._state==="closed"?function(r){Ay(r),Zw(r)}(e):Yw(e,t._storedError)}function Sg(e,t){return Ia(e._ownerReadableStream,t)}function Sa(e){e._ownerReadableStream._state==="readable"?Pg(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(t,r){Yw(t,r)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),e._ownerReadableStream._reader=void 0,e._ownerReadableStream=void 0}function Eo(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function Ay(e){e._closedPromise=mn((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r})}function Yw(e,t){Ay(e),Pg(e,t)}function Pg(e,t){e._closedPromise_reject!==void 0&&(tl(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function Zw(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const Jw=Gt("[[AbortSteps]]"),Xw=Gt("[[ErrorSteps]]"),xg=Gt("[[CancelSteps]]"),Tg=Gt("[[PullSteps]]"),cb=Number.isFinite||function(e){return typeof e=="number"&&isFinite(e)},Fj=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function ns(e,t){if(e!==void 0&&typeof(r=e)!="object"&&typeof r!="function")throw new TypeError(t+" is not an object.");var r}function ci(e,t){if(typeof e!="function")throw new TypeError(t+" is not a function.")}function Qw(e,t){if(!function(r){return typeof r=="object"&&r!==null||typeof r=="function"}(e))throw new TypeError(t+" is not an object.")}function ds(e,t,r){if(e===void 0)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function Sy(e,t,r){if(e===void 0)throw new TypeError(`${t} is required in '${r}'.`)}function Cg(e){return Number(e)}function ub(e){return e===0?0:e}function eE(e,t){const r=Number.MAX_SAFE_INTEGER;let n=Number(e);if(n=ub(n),!cb(n))throw new TypeError(t+" is not a finite number");if(n=function(s){return ub(Fj(s))}(n),n<0||n>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return cb(n)&&n!==0?n:0}function Ig(e,t){if(!As(e))throw new TypeError(t+" is not a ReadableStream.")}function bd(e){return new Zd(e)}function tE(e,t){e._reader._readRequests.push(t)}function kg(e,t,r){const n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function Of(e){return e._reader._readRequests.length}function rE(e){const t=e._reader;return t!==void 0&&!!Pa(t)}class Zd{constructor(t){if(ds(t,1,"ReadableStreamDefaultReader"),Ig(t,"First parameter"),Us(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");Ww(this,t),this._readRequests=new Oi}get closed(){return Pa(this)?this._closedPromise:Rt(Rl("closed"))}cancel(t=void 0){return Pa(this)?this._ownerReadableStream===void 0?Rt(Eo("cancel")):Sg(this,t):Rt(Rl("cancel"))}read(){if(!Pa(this))return Rt(Rl("read"));if(this._ownerReadableStream===void 0)return Rt(Eo("read from"));let t,r;const n=mn((s,i)=>{t=s,r=i});return Mf(this,{_chunkSteps:s=>t({value:s,done:!1}),_closeSteps:()=>t({value:void 0,done:!0}),_errorSteps:s=>r(s)}),n}releaseLock(){if(!Pa(this))throw Rl("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");Sa(this)}}}function Pa(e){return!!Pn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")}function Mf(e,t){const r=e._ownerReadableStream;r._disturbed=!0,r._state==="closed"?t._closeSteps():r._state==="errored"?t._errorSteps(r._storedError):r._readableStreamController[Tg](t)}function Rl(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}let Jd;Object.defineProperties(Zd.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof Gt.toStringTag=="symbol"&&Object.defineProperty(Zd.prototype,Gt.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0}),typeof Gt.asyncIterator=="symbol"&&(Jd={[Gt.asyncIterator](){return this}},Object.defineProperty(Jd,Gt.asyncIterator,{enumerable:!1}));class qj{constructor(t,r){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=t,this._preventCancel=r}next(){const t=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?Ca(this._ongoingPromise,t,t):t(),this._ongoingPromise}return(t){const r=()=>this._returnSteps(t);return this._ongoingPromise?Ca(this._ongoingPromise,r,r):r()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});const t=this._reader;if(t._ownerReadableStream===void 0)return Rt(Eo("iterate"));let r,n;const s=mn((i,o)=>{r=i,n=o});return Mf(t,{_chunkSteps:i=>{this._ongoingPromise=void 0,zw(()=>r({value:i,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,Sa(t),r({value:void 0,done:!0})},_errorSteps:i=>{this._ongoingPromise=void 0,this._isFinished=!0,Sa(t),n(i)}}),s}_returnSteps(t){if(this._isFinished)return Promise.resolve({value:t,done:!0});this._isFinished=!0;const r=this._reader;if(r._ownerReadableStream===void 0)return Rt(Eo("finish iterating"));if(!this._preventCancel){const n=Sg(r,t);return Sa(r),Ca(n,()=>({value:t,done:!0}))}return Sa(r),dr({value:t,done:!0})}}const nE={next(){return lb(this)?this._asyncIteratorImpl.next():Rt(db("next"))},return(e){return lb(this)?this._asyncIteratorImpl.return(e):Rt(db("return"))}};function lb(e){return!!Pn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl")}function db(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}Jd!==void 0&&Object.setPrototypeOf(nE,Jd);const iE=Number.isNaN||function(e){return e!=e};function sE(e){return!!function(t){return!(typeof t!="number"||iE(t)||t<0)}(e)&&e!==1/0}function Py(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function Rg(e,t,r){if(!sE(r=Number(r)))throw new RangeError("Size must be a finite, non-NaN, non-negative number.");e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function Ys(e){e._queue=new Oi,e._queueTotalSize=0}function w1(e){return e.slice()}class Xd{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!E1(this))throw A1("view");return this._view}respond(t){if(!E1(this))throw A1("respond");if(ds(t,1,"respond"),t=eE(t,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");this._view.buffer,function(r,n){if(n=Number(n),!sE(n))throw new RangeError("bytesWritten must be a finite");fb(r,n)}(this._associatedReadableByteStreamController,t)}respondWithNewView(t){if(!E1(this))throw A1("respondWithNewView");if(ds(t,1,"respondWithNewView"),!ArrayBuffer.isView(t))throw new TypeError("You can only respond with array buffer views");if(t.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(t.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");(function(r,n){const s=r._pendingPullIntos.peek();if(s.byteOffset+s.bytesFilled!==n.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(s.byteLength!==n.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");s.buffer=n.buffer,fb(r,n.byteLength)})(this._associatedReadableByteStreamController,t)}}Object.defineProperties(Xd.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),typeof Gt.toStringTag=="symbol"&&Object.defineProperty(Xd.prototype,Gt.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class Qd{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!ro(this))throw Yo("byobRequest");if(this._byobRequest===null&&this._pendingPullIntos.length>0){const t=this._pendingPullIntos.peek(),r=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),n=Object.create(Xd.prototype);(function(s,i,o){s._associatedReadableByteStreamController=i,s._view=o})(n,this,r),this._byobRequest=n}return this._byobRequest}get desiredSize(){if(!ro(this))throw Yo("desiredSize");return dE(this)}close(){if(!ro(this))throw Yo("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");const t=this._controlledReadableByteStream._state;if(t!=="readable")throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be closed`);(function(r){const n=r._controlledReadableByteStream;if(!(r._closeRequested||n._state!=="readable")){if(r._queueTotalSize>0)return void(r._closeRequested=!0);if(r._pendingPullIntos.length>0&&r._pendingPullIntos.peek().bytesFilled>0){const s=new TypeError("Insufficient bytes to fill elements in the given buffer");throw U0(r,s),s}ef(r),rl(n)}})(this)}enqueue(t){if(!ro(this))throw Yo("enqueue");if(ds(t,1,"enqueue"),!ArrayBuffer.isView(t))throw new TypeError("chunk must be an array buffer view");if(t.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(t.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");const r=this._controlledReadableByteStream._state;if(r!=="readable")throw new TypeError(`The stream (in ${r} state) is not in the readable state and cannot be enqueued to`);(function(n,s){const i=n._controlledReadableByteStream;if(n._closeRequested||i._state!=="readable")return;const o=s.buffer,a=s.byteOffset,f=s.byteLength,c=o;rE(i)?Of(i)===0?_d(n,c,a,f):kg(i,new Uint8Array(c,a,f),!1):Bg(i)?(_d(n,c,a,f),lE(n)):_d(n,c,a,f),Ua(n)})(this,t)}error(t=void 0){if(!ro(this))throw Yo("error");U0(this,t)}[xg](t){this._pendingPullIntos.length>0&&(this._pendingPullIntos.peek().bytesFilled=0),Ys(this);const r=this._cancelAlgorithm(t);return ef(this),r}[Tg](t){const r=this._controlledReadableByteStream;if(this._queueTotalSize>0){const s=this._queue.shift();this._queueTotalSize-=s.byteLength,uE(this);const i=new Uint8Array(s.buffer,s.byteOffset,s.byteLength);return void t._chunkSteps(i)}const n=this._autoAllocateChunkSize;if(n!==void 0){let s;try{s=new ArrayBuffer(n)}catch(o){return void t._errorSteps(o)}const i={buffer:s,byteOffset:0,byteLength:n,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(i)}tE(r,t),Ua(this)}}function ro(e){return!!Pn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")}function E1(e){return!!Pn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")}function Ua(e){if(function(r){const n=r._controlledReadableByteStream;return n._state!=="readable"||r._closeRequested||!r._started?!1:!!(rE(n)&&Of(n)>0||Bg(n)&&fE(n)>0||dE(r)>0)}(e)){if(e._pulling)return void(e._pullAgain=!0);e._pulling=!0,ai(e._pullAlgorithm(),()=>{e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Ua(e))},r=>{U0(e,r)})}}function xy(e,t){let r=!1;e._state==="closed"&&(r=!0);const n=aE(t);t.readerType==="default"?kg(e,n,r):function(s,i,o){const a=s._reader,f=a._readIntoRequests.shift();o?f._closeSteps(i):f._chunkSteps(i)}(e,n,r)}function aE(e){const t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function _d(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function oE(e,t){const r=t.elementSize,n=t.bytesFilled-t.bytesFilled%r,s=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),i=t.bytesFilled+s,o=i-i%r;let a=s,f=!1;o>n&&(a=o-t.bytesFilled,f=!0);const c=e._queue;for(;a>0;){const y=c.peek(),m=Math.min(a,y.byteLength),v=t.byteOffset+t.bytesFilled;l=t.buffer,u=v,p=y.buffer,d=y.byteOffset,h=m,new Uint8Array(l).set(new Uint8Array(p,d,h),u),y.byteLength===m?c.shift():(y.byteOffset+=m,y.byteLength-=m),e._queueTotalSize-=m,cE(e,m,t),a-=m}var l,u,p,d,h;return f}function cE(e,t,r){Dg(e),r.bytesFilled+=t}function uE(e){e._queueTotalSize===0&&e._closeRequested?(ef(e),rl(e._controlledReadableByteStream)):Ua(e)}function Dg(e){e._byobRequest!==null&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function lE(e){for(;e._pendingPullIntos.length>0;){if(e._queueTotalSize===0)return;const t=e._pendingPullIntos.peek();oE(e,t)&&(Ty(e),xy(e._controlledReadableByteStream,t))}}function fb(e,t){const r=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state==="closed"){if(t!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream");(function(n,s){s.buffer=s.buffer;const i=n._controlledReadableByteStream;if(Bg(i))for(;fE(i)>0;)xy(i,Ty(n))})(e,r)}else(function(n,s,i){if(i.bytesFilled+s>i.byteLength)throw new RangeError("bytesWritten out of range");if(cE(n,s,i),i.bytesFilled<i.elementSize)return;Ty(n);const o=i.bytesFilled%i.elementSize;if(o>0){const a=i.byteOffset+i.bytesFilled,f=i.buffer.slice(a-o,a);_d(n,f,0,f.byteLength)}i.buffer=i.buffer,i.bytesFilled-=o,xy(n._controlledReadableByteStream,i),lE(n)})(e,t,r);Ua(e)}function Ty(e){const t=e._pendingPullIntos.shift();return Dg(e),t}function ef(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function U0(e,t){const r=e._controlledReadableByteStream;r._state==="readable"&&(function(n){Dg(n),n._pendingPullIntos=new Oi}(e),Ys(e),ef(e),RE(r,t))}function dE(e){const t=e._controlledReadableByteStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function jj(e,t,r){const n=Object.create(Qd.prototype);let s=()=>{},i=()=>dr(void 0),o=()=>dr(void 0);t.start!==void 0&&(s=()=>t.start(n)),t.pull!==void 0&&(i=()=>t.pull(n)),t.cancel!==void 0&&(o=f=>t.cancel(f));const a=t.autoAllocateChunkSize;if(a===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");(function(f,c,l,u,p,d,h){c._controlledReadableByteStream=f,c._pullAgain=!1,c._pulling=!1,c._byobRequest=null,c._queue=c._queueTotalSize=void 0,Ys(c),c._closeRequested=!1,c._started=!1,c._strategyHWM=d,c._pullAlgorithm=u,c._cancelAlgorithm=p,c._autoAllocateChunkSize=h,c._pendingPullIntos=new Oi,f._readableStreamController=c,ai(dr(l()),()=>{c._started=!0,Ua(c)},y=>{U0(c,y)})})(e,n,s,i,o,r,a)}function A1(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function Yo(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function hb(e,t){e._reader._readIntoRequests.push(t)}function fE(e){return e._reader._readIntoRequests.length}function Bg(e){const t=e._reader;return t!==void 0&&!!c0(t)}Object.defineProperties(Qd.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof Gt.toStringTag=="symbol"&&Object.defineProperty(Qd.prototype,Gt.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class tf{constructor(t){if(ds(t,1,"ReadableStreamBYOBReader"),Ig(t,"First parameter"),Us(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!ro(t._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");Ww(this,t),this._readIntoRequests=new Oi}get closed(){return c0(this)?this._closedPromise:Rt(Dl("closed"))}cancel(t=void 0){return c0(this)?this._ownerReadableStream===void 0?Rt(Eo("cancel")):Sg(this,t):Rt(Dl("cancel"))}read(t){if(!c0(this))return Rt(Dl("read"));if(!ArrayBuffer.isView(t))return Rt(new TypeError("view must be an array buffer view"));if(t.byteLength===0)return Rt(new TypeError("view must have non-zero byteLength"));if(t.buffer.byteLength===0)return Rt(new TypeError("view's buffer must have non-zero byteLength"));if(this._ownerReadableStream===void 0)return Rt(Eo("read from"));let r,n;const s=mn((i,o)=>{r=i,n=o});return function(i,o,a){const f=i._ownerReadableStream;f._disturbed=!0,f._state==="errored"?a._errorSteps(f._storedError):function(c,l,u){const p=c._controlledReadableByteStream;let d=1;l.constructor!==DataView&&(d=l.constructor.BYTES_PER_ELEMENT);const h=l.constructor,y={buffer:l.buffer,byteOffset:l.byteOffset,byteLength:l.byteLength,bytesFilled:0,elementSize:d,viewConstructor:h,readerType:"byob"};if(c._pendingPullIntos.length>0)return c._pendingPullIntos.push(y),void hb(p,u);if(p._state!=="closed"){if(c._queueTotalSize>0){if(oE(c,y)){const m=aE(y);return uE(c),void u._chunkSteps(m)}if(c._closeRequested){const m=new TypeError("Insufficient bytes to fill elements in the given buffer");return U0(c,m),void u._errorSteps(m)}}c._pendingPullIntos.push(y),hb(p,u),Ua(c)}else{const m=new h(y.buffer,y.byteOffset,0);u._closeSteps(m)}}(f._readableStreamController,o,a)}(this,t,{_chunkSteps:i=>r({value:i,done:!1}),_closeSteps:i=>r({value:i,done:!0}),_errorSteps:i=>n(i)}),s}releaseLock(){if(!c0(this))throw Dl("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");Sa(this)}}}function c0(e){return!!Pn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")}function Dl(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function L0(e,t){const{highWaterMark:r}=e;if(r===void 0)return t;if(iE(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function rf(e){const{size:t}=e;return t||(()=>1)}function nf(e,t){ns(e,t);const r=e==null?void 0:e.highWaterMark,n=e==null?void 0:e.size;return{highWaterMark:r===void 0?void 0:Cg(r),size:n===void 0?void 0:$j(n,t+" has member 'size' that")}}function $j(e,t){return ci(e,t),r=>Cg(e(r))}function Hj(e,t,r){return ci(e,r),n=>$a(e,t,[n])}function Vj(e,t,r){return ci(e,r),()=>$a(e,t,[])}function Gj(e,t,r){return ci(e,r),n=>Bf(e,t,[n])}function zj(e,t,r){return ci(e,r),(n,s)=>$a(e,t,[n,s])}function hE(e,t){if(!oo(e))throw new TypeError(t+" is not a WritableStream.")}Object.defineProperties(tf.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof Gt.toStringTag=="symbol"&&Object.defineProperty(tf.prototype,Gt.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});class sf{constructor(t={},r={}){t===void 0?t=null:Qw(t,"First parameter");const n=nf(r,"Second parameter"),s=function(o,a){ns(o,a);const f=o==null?void 0:o.abort,c=o==null?void 0:o.close,l=o==null?void 0:o.start,u=o==null?void 0:o.type,p=o==null?void 0:o.write;return{abort:f===void 0?void 0:Hj(f,o,a+" has member 'abort' that"),close:c===void 0?void 0:Vj(c,o,a+" has member 'close' that"),start:l===void 0?void 0:Gj(l,o,a+" has member 'start' that"),write:p===void 0?void 0:zj(p,o,a+" has member 'write' that"),type:u}}(t,"First parameter");if(yE(this),s.type!==void 0)throw new RangeError("Invalid type is specified");const i=rf(n);(function(o,a,f,c){const l=Object.create(K0.prototype);let u=()=>{},p=()=>dr(void 0),d=()=>dr(void 0),h=()=>dr(void 0);a.start!==void 0&&(u=()=>a.start(l)),a.write!==void 0&&(p=y=>a.write(y,l)),a.close!==void 0&&(d=()=>a.close()),a.abort!==void 0&&(h=y=>a.abort(y)),EE(o,l,u,p,d,h,f,c)})(this,s,L0(n,1),i)}get locked(){if(!oo(this))throw Ol("locked");return mo(this)}abort(t=void 0){return oo(this)?mo(this)?Rt(new TypeError("Cannot abort a stream that already has a writer")):af(this,t):Rt(Ol("abort"))}close(){return oo(this)?mo(this)?Rt(new TypeError("Cannot close a stream that already has a writer")):Pi(this)?Rt(new TypeError("Cannot close an already-closing stream")):gE(this):Rt(Ol("close"))}getWriter(){if(!oo(this))throw Ol("getWriter");return pE(this)}}function pE(e){return new of(e)}function yE(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new Oi,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function oo(e){return!!Pn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")}function mo(e){return e._writer!==void 0}function af(e,t){const r=e._state;if(r==="closed"||r==="errored")return dr(void 0);if(e._pendingAbortRequest!==void 0)return e._pendingAbortRequest._promise;let n=!1;r==="erroring"&&(n=!0,t=void 0);const s=mn((i,o)=>{e._pendingAbortRequest={_promise:void 0,_resolve:i,_reject:o,_reason:t,_wasAlreadyErroring:n}});return e._pendingAbortRequest._promise=s,n||Og(e,t),s}function gE(e){const t=e._state;if(t==="closed"||t==="errored")return Rt(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));const r=mn((i,o)=>{const a={_resolve:i,_reject:o};e._closeRequest=a}),n=e._writer;var s;return n!==void 0&&e._backpressure&&t==="writable"&&Kg(n),Rg(s=e._writableStreamController,wE,0),Nf(s),r}function Cy(e,t){e._state!=="writable"?Mg(e):Og(e,t)}function Og(e,t){const r=e._writableStreamController;e._state="erroring",e._storedError=t;const n=e._writer;n!==void 0&&vE(n,t),!function(s){return!(s._inFlightWriteRequest===void 0&&s._inFlightCloseRequest===void 0)}(e)&&r._started&&Mg(e)}function Mg(e){e._state="errored",e._writableStreamController[Xw]();const t=e._storedError;if(e._writeRequests.forEach(n=>{n._reject(t)}),e._writeRequests=new Oi,e._pendingAbortRequest===void 0)return void Bl(e);const r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void Bl(e);ai(e._writableStreamController[Jw](r._reason),()=>{r._resolve(),Bl(e)},n=>{r._reject(n),Bl(e)})}function Pi(e){return e._closeRequest!==void 0||e._inFlightCloseRequest!==void 0}function Bl(e){e._closeRequest!==void 0&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;t!==void 0&&Lg(t,e._storedError)}function Ng(e,t){const r=e._writer;r!==void 0&&t!==e._backpressure&&(t?function(n){Uf(n)}(r):Kg(r)),e._backpressure=t}Object.defineProperties(sf.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),typeof Gt.toStringTag=="symbol"&&Object.defineProperty(sf.prototype,Gt.toStringTag,{value:"WritableStream",configurable:!0});class of{constructor(t){if(ds(t,1,"WritableStreamDefaultWriter"),hE(t,"First parameter"),mo(t))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=t,t._writer=this;const r=t._state;if(r==="writable")!Pi(t)&&t._backpressure?Uf(this):pb(this),wd(this);else if(r==="erroring")ky(this,t._storedError),wd(this);else if(r==="closed")pb(this),wd(n=this),xE(n);else{const s=t._storedError;ky(this,s),PE(this,s)}var n}get closed(){return ra(this)?this._closedPromise:Rt(na("closed"))}get desiredSize(){if(!ra(this))throw na("desiredSize");if(this._ownerWritableStream===void 0)throw u0("desiredSize");return function(t){const r=t._ownerWritableStream,n=r._state;return n==="errored"||n==="erroring"?null:n==="closed"?0:AE(r._writableStreamController)}(this)}get ready(){return ra(this)?this._readyPromise:Rt(na("ready"))}abort(t=void 0){return ra(this)?this._ownerWritableStream===void 0?Rt(u0("abort")):function(r,n){const s=r._ownerWritableStream;return af(s,n)}(this,t):Rt(na("abort"))}close(){if(!ra(this))return Rt(na("close"));const t=this._ownerWritableStream;return t===void 0?Rt(u0("close")):Pi(t)?Rt(new TypeError("Cannot close an already-closing stream")):mE(this)}releaseLock(){if(!ra(this))throw na("releaseLock");this._ownerWritableStream!==void 0&&bE(this)}write(t=void 0){return ra(this)?this._ownerWritableStream===void 0?Rt(u0("write to")):_E(this,t):Rt(na("write"))}}function ra(e){return!!Pn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")}function mE(e){return gE(e._ownerWritableStream)}function Wj(e,t){e._closedPromiseState==="pending"?Lg(e,t):function(r,n){PE(r,n)}(e,t)}function vE(e,t){e._readyPromiseState==="pending"?TE(e,t):function(r,n){ky(r,n)}(e,t)}function bE(e){const t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");vE(e,r),Wj(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function _E(e,t){const r=e._ownerWritableStream,n=r._writableStreamController,s=function(a,f){try{return a._strategySizeAlgorithm(f)}catch(c){return Iy(a,c),1}}(n,t);if(r!==e._ownerWritableStream)return Rt(u0("write to"));const i=r._state;if(i==="errored")return Rt(r._storedError);if(Pi(r)||i==="closed")return Rt(new TypeError("The stream is closing or closed and cannot be written to"));if(i==="erroring")return Rt(r._storedError);const o=function(a){return mn((f,c)=>{const l={_resolve:f,_reject:c};a._writeRequests.push(l)})}(r);return function(a,f,c){try{Rg(a,f,c)}catch(u){return void Iy(a,u)}const l=a._controlledWritableStream;!Pi(l)&&l._state==="writable"&&Ng(l,Ug(a)),Nf(a)}(n,t,s),o}Object.defineProperties(of.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),typeof Gt.toStringTag=="symbol"&&Object.defineProperty(of.prototype,Gt.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const wE={};class K0{constructor(){throw new TypeError("Illegal constructor")}error(t=void 0){if(!function(r){return!(!Pn(r)||!Object.prototype.hasOwnProperty.call(r,"_controlledWritableStream"))}(this))throw new TypeError("WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController");this._controlledWritableStream._state==="writable"&&SE(this,t)}[Jw](t){const r=this._abortAlgorithm(t);return cf(this),r}[Xw](){Ys(this)}}function EE(e,t,r,n,s,i,o,a){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,Ys(t),t._started=!1,t._strategySizeAlgorithm=a,t._strategyHWM=o,t._writeAlgorithm=n,t._closeAlgorithm=s,t._abortAlgorithm=i;const f=Ug(t);Ng(e,f),ai(dr(r()),()=>{t._started=!0,Nf(t)},c=>{t._started=!0,Cy(e,c)})}function cf(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function AE(e){return e._strategyHWM-e._queueTotalSize}function Nf(e){const t=e._controlledWritableStream;if(!e._started||t._inFlightWriteRequest!==void 0)return;if(t._state==="erroring")return void Mg(t);if(e._queue.length===0)return;const r=e._queue.peek().value;r===wE?function(n){const s=n._controlledWritableStream;(function(o){o._inFlightCloseRequest=o._closeRequest,o._closeRequest=void 0})(s),Py(n);const i=n._closeAlgorithm();cf(n),ai(i,()=>{(function(o){o._inFlightCloseRequest._resolve(void 0),o._inFlightCloseRequest=void 0,o._state==="erroring"&&(o._storedError=void 0,o._pendingAbortRequest!==void 0&&(o._pendingAbortRequest._resolve(),o._pendingAbortRequest=void 0)),o._state="closed";const a=o._writer;a!==void 0&&xE(a)})(s)},o=>{(function(a,f){a._inFlightCloseRequest._reject(f),a._inFlightCloseRequest=void 0,a._pendingAbortRequest!==void 0&&(a._pendingAbortRequest._reject(f),a._pendingAbortRequest=void 0),Cy(a,f)})(s,o)})}(e):function(n,s){const i=n._controlledWritableStream;(function(a){a._inFlightWriteRequest=a._writeRequests.shift()})(i);const o=n._writeAlgorithm(s);ai(o,()=>{(function(f){f._inFlightWriteRequest._resolve(void 0),f._inFlightWriteRequest=void 0})(i);const a=i._state;if(Py(n),!Pi(i)&&a==="writable"){const f=Ug(n);Ng(i,f)}Nf(n)},a=>{i._state==="writable"&&cf(n),function(f,c){f._inFlightWriteRequest._reject(c),f._inFlightWriteRequest=void 0,Cy(f,c)}(i,a)})}(e,r)}function Iy(e,t){e._controlledWritableStream._state==="writable"&&SE(e,t)}function Ug(e){return AE(e)<=0}function SE(e,t){const r=e._controlledWritableStream;cf(e),Og(r,t)}function Ol(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function na(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function u0(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function wd(e){e._closedPromise=mn((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"})}function PE(e,t){wd(e),Lg(e,t)}function Lg(e,t){e._closedPromise_reject!==void 0&&(tl(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function xE(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function Uf(e){e._readyPromise=mn((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r}),e._readyPromiseState="pending"}function ky(e,t){Uf(e),TE(e,t)}function pb(e){Uf(e),Kg(e)}function TE(e,t){e._readyPromise_reject!==void 0&&(tl(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function Kg(e){e._readyPromise_resolve!==void 0&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}Object.defineProperties(K0.prototype,{error:{enumerable:!0}}),typeof Gt.toStringTag=="symbol"&&Object.defineProperty(K0.prototype,Gt.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});const yb=typeof DOMException<"u"?DOMException:void 0,Yj=function(e){if(typeof e!="function"&&typeof e!="object")return!1;try{return new e,!0}catch{return!1}}(yb)?yb:function(){const e=function(t,r){this.message=t||"",this.name=r||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return Object.defineProperty(e.prototype=Object.create(Error.prototype),"constructor",{value:e,writable:!0,configurable:!0}),e}();function gb(e,t,r,n,s,i){const o=bd(e),a=pE(t);e._disturbed=!0;let f=!1,c=dr(void 0);return mn((l,u)=>{let p;if(i!==void 0){if(p=()=>{const b=new Yj("Aborted","AbortError"),w=[];n||w.push(()=>t._state==="writable"?af(t,b):dr(void 0)),s||w.push(()=>e._state==="readable"?Ia(e,b):dr(void 0)),y(()=>Promise.all(w.map(_=>_())),!0,b)},i.aborted)return void p();i.addEventListener("abort",p)}if(h(e,o._closedPromise,b=>{n?m(!0,b):y(()=>af(t,b),!0,b)}),h(t,a._closedPromise,b=>{s?m(!0,b):y(()=>Ia(e,b),!0,b)}),function(b,w,_){b._state==="closed"?_():_1(w,_)}(e,o._closedPromise,()=>{r?m():y(()=>function(b){const w=b._ownerWritableStream,_=w._state;return Pi(w)||_==="closed"?dr(void 0):_==="errored"?Rt(w._storedError):mE(b)}(a))}),Pi(t)||t._state==="closed"){const b=new TypeError("the destination writable stream closed before all data could be piped to it");s?m(!0,b):y(()=>Ia(e,b),!0,b)}function d(){const b=c;return rs(c,()=>b!==c?d():void 0)}function h(b,w,_){b._state==="errored"?_(b._storedError):Gw(w,_)}function y(b,w,_){function C(){ai(b(),()=>v(w,_),I=>v(!0,I))}f||(f=!0,t._state!=="writable"||Pi(t)?C():_1(d(),C))}function m(b,w){f||(f=!0,t._state!=="writable"||Pi(t)?v(b,w):_1(d(),()=>v(b,w)))}function v(b,w){bE(a),Sa(o),i!==void 0&&i.removeEventListener("abort",p),b?u(w):l(void 0)}tl(mn((b,w)=>{(function _(C){C?b():rs(f?dr(!0):rs(a._readyPromise,()=>mn((I,k)=>{Mf(o,{_chunkSteps:E=>{c=rs(_E(a,E),void 0,Eg),I(!1)},_closeSteps:()=>I(!0),_errorSteps:k})})),_,w)})(!1)}))})}class F0{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Ml(this))throw Nl("desiredSize");return Fg(this)}close(){if(!Ml(this))throw Nl("close");if(!Ao(this))throw new TypeError("The stream is not in a state that permits close");j0(this)}enqueue(t=void 0){if(!Ml(this))throw Nl("enqueue");if(!Ao(this))throw new TypeError("The stream is not in a state that permits enqueue");return lf(this,t)}error(t=void 0){if(!Ml(this))throw Nl("error");Hs(this,t)}[xg](t){Ys(this);const r=this._cancelAlgorithm(t);return uf(this),r}[Tg](t){const r=this._controlledReadableStream;if(this._queue.length>0){const n=Py(this);this._closeRequested&&this._queue.length===0?(uf(this),rl(r)):q0(this),t._chunkSteps(n)}else tE(r,t),q0(this)}}function Ml(e){return!!Pn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")}function q0(e){if(CE(e)){if(e._pulling)return void(e._pullAgain=!0);e._pulling=!0,ai(e._pullAlgorithm(),()=>{e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,q0(e))},t=>{Hs(e,t)})}}function CE(e){const t=e._controlledReadableStream;return!Ao(e)||!e._started?!1:Us(t)&&Of(t)>0?!0:Fg(e)>0}function uf(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function j0(e){if(!Ao(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,e._queue.length===0&&(uf(e),rl(t))}function lf(e,t){if(!Ao(e))return;const r=e._controlledReadableStream;if(Us(r)&&Of(r)>0)kg(r,t,!1);else{let n;try{n=e._strategySizeAlgorithm(t)}catch(s){throw Hs(e,s),s}try{Rg(e,t,n)}catch(s){throw Hs(e,s),s}}q0(e)}function Hs(e,t){const r=e._controlledReadableStream;r._state==="readable"&&(Ys(e),uf(e),RE(r,t))}function Fg(e){const t=e._controlledReadableStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function Ao(e){const t=e._controlledReadableStream._state;return!e._closeRequested&&t==="readable"}function IE(e,t,r,n,s,i,o){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,Ys(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=o,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=s,e._readableStreamController=t,ai(dr(r()),()=>{t._started=!0,q0(t)},a=>{Hs(t,a)})}function Nl(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function Zj(e,t,r){return ci(e,r),n=>$a(e,t,[n])}function Jj(e,t,r){return ci(e,r),n=>$a(e,t,[n])}function Xj(e,t,r){return ci(e,r),n=>Bf(e,t,[n])}function Qj(e,t){if((e=""+e)!="bytes")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function e$(e,t){if((e=""+e)!="byob")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function mb(e,t){ns(e,t);const r=e==null?void 0:e.preventAbort,n=e==null?void 0:e.preventCancel,s=e==null?void 0:e.preventClose,i=e==null?void 0:e.signal;return i!==void 0&&function(o,a){if(!function(f){if(typeof f!="object"||f===null)return!1;try{return typeof f.aborted=="boolean"}catch{return!1}}(o))throw new TypeError(a+" is not an AbortSignal.")}(i,t+" has member 'signal' that"),{preventAbort:!!r,preventCancel:!!n,preventClose:!!s,signal:i}}Object.defineProperties(F0.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof Gt.toStringTag=="symbol"&&Object.defineProperty(F0.prototype,Gt.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});class co{constructor(t={},r={}){t===void 0?t=null:Qw(t,"First parameter");const n=nf(r,"Second parameter"),s=function(i,o){ns(i,o);const a=i,f=a==null?void 0:a.autoAllocateChunkSize,c=a==null?void 0:a.cancel,l=a==null?void 0:a.pull,u=a==null?void 0:a.start,p=a==null?void 0:a.type;return{autoAllocateChunkSize:f===void 0?void 0:eE(f,o+" has member 'autoAllocateChunkSize' that"),cancel:c===void 0?void 0:Zj(c,a,o+" has member 'cancel' that"),pull:l===void 0?void 0:Jj(l,a,o+" has member 'pull' that"),start:u===void 0?void 0:Xj(u,a,o+" has member 'start' that"),type:p===void 0?void 0:Qj(p,o+" has member 'type' that")}}(t,"First parameter");if(kE(this),s.type==="bytes"){if(n.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");jj(this,s,L0(n,0))}else{const i=rf(n);(function(o,a,f,c){const l=Object.create(F0.prototype);let u=()=>{},p=()=>dr(void 0),d=()=>dr(void 0);a.start!==void 0&&(u=()=>a.start(l)),a.pull!==void 0&&(p=()=>a.pull(l)),a.cancel!==void 0&&(d=h=>a.cancel(h)),IE(o,l,u,p,d,f,c)})(this,s,L0(n,1),i)}}get locked(){if(!As(this))throw ia("locked");return Us(this)}cancel(t=void 0){return As(this)?Us(this)?Rt(new TypeError("Cannot cancel a stream that already has a reader")):Ia(this,t):Rt(ia("cancel"))}getReader(t=void 0){if(!As(this))throw ia("getReader");return function(n,s){ns(n,s);const i=n==null?void 0:n.mode;return{mode:i===void 0?void 0:e$(i,s+" has member 'mode' that")}}(t,"First parameter").mode===void 0?bd(this):function(n){return new tf(n)}(this)}pipeThrough(t,r={}){if(!As(this))throw ia("pipeThrough");ds(t,1,"pipeThrough");const n=function(i,o){ns(i,o);const a=i==null?void 0:i.readable;Sy(a,"readable","ReadableWritablePair"),Ig(a,o+" has member 'readable' that");const f=i==null?void 0:i.writable;return Sy(f,"writable","ReadableWritablePair"),hE(f,o+" has member 'writable' that"),{readable:a,writable:f}}(t,"First parameter"),s=mb(r,"Second parameter");if(Us(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(mo(n.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return tl(gb(this,n.writable,s.preventClose,s.preventAbort,s.preventCancel,s.signal)),n.readable}pipeTo(t,r={}){if(!As(this))return Rt(ia("pipeTo"));if(t===void 0)return Rt("Parameter 1 is required in 'pipeTo'.");if(!oo(t))return Rt(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let n;try{n=mb(r,"Second parameter")}catch(s){return Rt(s)}return Us(this)?Rt(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):mo(t)?Rt(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):gb(this,t,n.preventClose,n.preventAbort,n.preventCancel,n.signal)}tee(){if(!As(this))throw ia("tee");const t=function(r,n){const s=bd(r);let i,o,a,f,c,l=!1,u=!1,p=!1;const d=mn(m=>{c=m});function h(){return l||(l=!0,Mf(s,{_chunkSteps:m=>{zw(()=>{l=!1;const v=m,b=m;u||lf(a._readableStreamController,v),p||lf(f._readableStreamController,b)})},_closeSteps:()=>{l=!1,u||j0(a._readableStreamController),p||j0(f._readableStreamController),u&&p||c(void 0)},_errorSteps:()=>{l=!1}})),dr(void 0)}function y(){}return a=Ry(y,h,function(m){if(u=!0,i=m,p){const v=w1([i,o]),b=Ia(r,v);c(b)}return d}),f=Ry(y,h,function(m){if(p=!0,o=m,u){const v=w1([i,o]),b=Ia(r,v);c(b)}return d}),Gw(s._closedPromise,m=>{Hs(a._readableStreamController,m),Hs(f._readableStreamController,m),u&&p||c(void 0)}),[a,f]}(this);return w1(t)}values(t=void 0){if(!As(this))throw ia("values");return function(r,n){const s=bd(r),i=new qj(s,n),o=Object.create(nE);return o._asyncIteratorImpl=i,o}(this,function(r,n){return ns(r,n),{preventCancel:!!(r!=null&&r.preventCancel)}}(t,"First parameter").preventCancel)}}function Ry(e,t,r,n=1,s=()=>1){const i=Object.create(co.prototype);return kE(i),IE(i,Object.create(F0.prototype),e,t,r,n,s),i}function kE(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function As(e){return!!Pn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")}function Us(e){return e._reader!==void 0}function Ia(e,t){return e._disturbed=!0,e._state==="closed"?dr(void 0):e._state==="errored"?Rt(e._storedError):(rl(e),Ca(e._readableStreamController[xg](t),Eg))}function rl(e){e._state="closed";const t=e._reader;t!==void 0&&(Zw(t),Pa(t)&&(t._readRequests.forEach(r=>{r._closeSteps()}),t._readRequests=new Oi))}function RE(e,t){e._state="errored",e._storedError=t;const r=e._reader;r!==void 0&&(Pg(r,t),Pa(r)?(r._readRequests.forEach(n=>{n._errorSteps(t)}),r._readRequests=new Oi):(r._readIntoRequests.forEach(n=>{n._errorSteps(t)}),r._readIntoRequests=new Oi))}function ia(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function DE(e,t){ns(e,t);const r=e==null?void 0:e.highWaterMark;return Sy(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:Cg(r)}}Object.defineProperties(co.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),typeof Gt.toStringTag=="symbol"&&Object.defineProperty(co.prototype,Gt.toStringTag,{value:"ReadableStream",configurable:!0}),typeof Gt.asyncIterator=="symbol"&&Object.defineProperty(co.prototype,Gt.asyncIterator,{value:co.prototype.values,writable:!0,configurable:!0});const t$=function(e){return e.byteLength};class Dy{constructor(t){ds(t,1,"ByteLengthQueuingStrategy"),t=DE(t,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!bb(this))throw vb("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!bb(this))throw vb("size");return t$}}function vb(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function bb(e){return!!Pn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")}Object.defineProperties(Dy.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Gt.toStringTag=="symbol"&&Object.defineProperty(Dy.prototype,Gt.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});const r$=function(){return 1};class By{constructor(t){ds(t,1,"CountQueuingStrategy"),t=DE(t,"First parameter"),this._countQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!wb(this))throw _b("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!wb(this))throw _b("size");return r$}}function _b(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function wb(e){return!!Pn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")}function n$(e,t,r){return ci(e,r),n=>$a(e,t,[n])}function i$(e,t,r){return ci(e,r),n=>Bf(e,t,[n])}function s$(e,t,r){return ci(e,r),(n,s)=>$a(e,t,[n,s])}Object.defineProperties(By.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Gt.toStringTag=="symbol"&&Object.defineProperty(By.prototype,Gt.toStringTag,{value:"CountQueuingStrategy",configurable:!0});class Oy{constructor(t={},r={},n={}){t===void 0&&(t=null);const s=nf(r,"Second parameter"),i=nf(n,"Third parameter"),o=function(p,d){ns(p,d);const h=p==null?void 0:p.flush,y=p==null?void 0:p.readableType,m=p==null?void 0:p.start,v=p==null?void 0:p.transform,b=p==null?void 0:p.writableType;return{flush:h===void 0?void 0:n$(h,p,d+" has member 'flush' that"),readableType:y,start:m===void 0?void 0:i$(m,p,d+" has member 'start' that"),transform:v===void 0?void 0:s$(v,p,d+" has member 'transform' that"),writableType:b}}(t,"First parameter");if(o.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(o.writableType!==void 0)throw new RangeError("Invalid writableType specified");const a=L0(i,0),f=rf(i),c=L0(s,1),l=rf(s);let u;(function(p,d,h,y,m,v){function b(){return d}function w(E){return function(S,T){const P=S._transformStreamController;return S._backpressure?Ca(S._backpressureChangePromise,()=>{const g=S._writable;if(g._state==="erroring")throw g._storedError;return Ab(P,T)}):Ab(P,T)}(p,E)}function _(E){return function(S,T){return df(S,T),dr(void 0)}(p,E)}function C(){return function(E){const S=E._readable,T=E._transformStreamController,P=T._flushAlgorithm();return BE(T),Ca(P,()=>{if(S._state==="errored")throw S._storedError;j0(S._readableStreamController)},g=>{throw df(E,g),S._storedError})}(p)}function I(){return function(E){return ff(E,!1),E._backpressureChangePromise}(p)}function k(E){return Lf(p,E),dr(void 0)}p._writable=function(E,S,T,P,g=1,A=()=>1){const x=Object.create(sf.prototype);return yE(x),EE(x,Object.create(K0.prototype),E,S,T,P,g,A),x}(b,w,C,_,h,y),p._readable=Ry(b,I,k,m,v),p._backpressure=void 0,p._backpressureChangePromise=void 0,p._backpressureChangePromise_resolve=void 0,ff(p,!0),p._transformStreamController=void 0})(this,mn(p=>{u=p}),c,l,a,f),function(p,d){const h=Object.create(hf.prototype);let y=v=>{try{return OE(h,v),dr(void 0)}catch(b){return Rt(b)}},m=()=>dr(void 0);d.transform!==void 0&&(y=v=>d.transform(v,h)),d.flush!==void 0&&(m=()=>d.flush(h)),function(v,b,w,_){b._controlledTransformStream=v,v._transformStreamController=b,b._transformAlgorithm=w,b._flushAlgorithm=_}(p,h,y,m)}(this,o),o.start!==void 0?u(o.start(this._transformStreamController)):u(void 0)}get readable(){if(!Eb(this))throw Sb("readable");return this._readable}get writable(){if(!Eb(this))throw Sb("writable");return this._writable}}function Eb(e){return!!Pn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")}function df(e,t){Hs(e._readable._readableStreamController,t),Lf(e,t)}function Lf(e,t){BE(e._transformStreamController),Iy(e._writable._writableStreamController,t),e._backpressure&&ff(e,!1)}function ff(e,t){e._backpressureChangePromise!==void 0&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=mn(r=>{e._backpressureChangePromise_resolve=r}),e._backpressure=t}Object.defineProperties(Oy.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Gt.toStringTag=="symbol"&&Object.defineProperty(Oy.prototype,Gt.toStringTag,{value:"TransformStream",configurable:!0});class hf{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Ul(this))throw Ll("desiredSize");return Fg(this._controlledTransformStream._readable._readableStreamController)}enqueue(t=void 0){if(!Ul(this))throw Ll("enqueue");OE(this,t)}error(t=void 0){if(!Ul(this))throw Ll("error");var r;r=t,df(this._controlledTransformStream,r)}terminate(){if(!Ul(this))throw Ll("terminate");(function(t){const r=t._controlledTransformStream,n=r._readable._readableStreamController;j0(n),Lf(r,new TypeError("TransformStream terminated"))})(this)}}function Ul(e){return!!Pn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")}function BE(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0}function OE(e,t){const r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!Ao(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{lf(n,t)}catch(i){throw Lf(r,i),r._readable._storedError}(function(i){return!CE(i)})(n)!==r._backpressure&&ff(r,!0)}function Ab(e,t){return Ca(e._transformAlgorithm(t),void 0,r=>{throw df(e._controlledTransformStream,r),r})}function Ll(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function Sb(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}Object.defineProperties(hf.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof Gt.toStringTag=="symbol"&&Object.defineProperty(hf.prototype,Gt.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});var a$=Object.freeze({__proto__:null,ByteLengthQueuingStrategy:Dy,CountQueuingStrategy:By,ReadableByteStreamController:Qd,ReadableStream:co,ReadableStreamBYOBReader:tf,ReadableStreamBYOBRequest:Xd,ReadableStreamDefaultController:F0,ReadableStreamDefaultReader:Zd,TransformStream:Oy,TransformStreamDefaultController:hf,WritableStream:sf,WritableStreamDefaultController:K0,WritableStreamDefaultWriter:of}),My=function(e,t){return My=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},My(e,t)};/*! *****************************************************************************
53
+ Copyright (c) Microsoft Corporation.
54
+
55
+ Permission to use, copy, modify, and/or distribute this software for any
56
+ purpose with or without fee is hereby granted.
57
+
58
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
59
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
60
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
61
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
62
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
63
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
64
+ PERFORMANCE OF THIS SOFTWARE.
65
+ ***************************************************************************** */function ME(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+t+" is not a constructor or null");function r(){this.constructor=e}My(e,t),e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function On(e){if(!e)throw new TypeError("Assertion failed")}function P0(){}function qg(e){return typeof e=="object"&&e!==null||typeof e=="function"}function S1(e){if(typeof e!="function")return!1;var t=!1;try{new e({start:function(){t=!0}})}catch{}return t}function jg(e){return!!qg(e)&&typeof e.getReader=="function"}function $g(e){return!!qg(e)&&typeof e.getWriter=="function"}function NE(e){return!!qg(e)&&!!jg(e.readable)&&!!$g(e.writable)}function UE(e){try{return e.getReader({mode:"byob"}).releaseLock(),!0}catch{return!1}}function P1(e,t){var r=(t===void 0?{}:t).type;return On(jg(e)),On(e.locked===!1),(r=LE(r))==="bytes"?new c$(e):new o$(e)}function LE(e){var t=e+"";if(t==="bytes")return t;if(e===void 0)return e;throw new RangeError("Invalid type is specified")}var KE=function(){function e(t){this._underlyingReader=void 0,this._readerMode=void 0,this._readableStreamController=void 0,this._pendingRead=void 0,this._underlyingStream=t,this._attachDefaultReader()}return e.prototype.start=function(t){this._readableStreamController=t},e.prototype.cancel=function(t){return On(this._underlyingReader!==void 0),this._underlyingReader.cancel(t)},e.prototype._attachDefaultReader=function(){if(this._readerMode!=="default"){this._detachReader();var t=this._underlyingStream.getReader();this._readerMode="default",this._attachReader(t)}},e.prototype._attachReader=function(t){var r=this;On(this._underlyingReader===void 0),this._underlyingReader=t;var n=this._underlyingReader.closed;n&&n.then(function(){return r._finishPendingRead()}).then(function(){t===r._underlyingReader&&r._readableStreamController.close()},function(s){t===r._underlyingReader&&r._readableStreamController.error(s)}).catch(P0)},e.prototype._detachReader=function(){this._underlyingReader!==void 0&&(this._underlyingReader.releaseLock(),this._underlyingReader=void 0,this._readerMode=void 0)},e.prototype._pullWithDefaultReader=function(){var t=this;this._attachDefaultReader();var r=this._underlyingReader.read().then(function(n){var s=t._readableStreamController;n.done?t._tryClose():s.enqueue(n.value)});return this._setPendingRead(r),r},e.prototype._tryClose=function(){try{this._readableStreamController.close()}catch{}},e.prototype._setPendingRead=function(t){var r,n=this,s=function(){n._pendingRead===r&&(n._pendingRead=void 0)};this._pendingRead=r=t.then(s,s)},e.prototype._finishPendingRead=function(){var t=this;if(this._pendingRead){var r=function(){return t._finishPendingRead()};return this._pendingRead.then(r,r)}},e}(),o$=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return ME(t,e),t.prototype.pull=function(){return this._pullWithDefaultReader()},t}(KE);function Pb(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var c$=function(e){function t(r){var n=this,s=UE(r);return(n=e.call(this,r)||this)._supportsByob=s,n}return ME(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return"bytes"},enumerable:!1,configurable:!0}),t.prototype._attachByobReader=function(){if(this._readerMode!=="byob"){On(this._supportsByob),this._detachReader();var r=this._underlyingStream.getReader({mode:"byob"});this._readerMode="byob",this._attachReader(r)}},t.prototype.pull=function(){if(this._supportsByob){var r=this._readableStreamController.byobRequest;if(r)return this._pullWithByobRequest(r)}return this._pullWithDefaultReader()},t.prototype._pullWithByobRequest=function(r){var n=this;this._attachByobReader();var s=new Uint8Array(r.view.byteLength),i=this._underlyingReader.read(s).then(function(o){var a,f,c;n._readableStreamController,o.done?(n._tryClose(),r.respond(0)):(a=o.value,f=r.view,c=Pb(a),Pb(f).set(c,0),r.respond(o.value.byteLength))});return this._setPendingRead(i),i},t}(KE);function xb(e){On($g(e)),On(e.locked===!1);var t=e.getWriter();return new u$(t)}var u$=function(){function e(t){var r=this;this._writableStreamController=void 0,this._pendingWrite=void 0,this._state="writable",this._storedError=void 0,this._underlyingWriter=t,this._errorPromise=new Promise(function(n,s){r._errorPromiseReject=s}),this._errorPromise.catch(P0)}return e.prototype.start=function(t){var r=this;this._writableStreamController=t,this._underlyingWriter.closed.then(function(){r._state="closed"}).catch(function(n){return r._finishErroring(n)})},e.prototype.write=function(t){var r=this,n=this._underlyingWriter;if(n.desiredSize===null)return n.ready;var s=n.write(t);s.catch(function(o){return r._finishErroring(o)}),n.ready.catch(function(o){return r._startErroring(o)});var i=Promise.race([s,this._errorPromise]);return this._setPendingWrite(i),i},e.prototype.close=function(){var t=this;return this._pendingWrite===void 0?this._underlyingWriter.close():this._finishPendingWrite().then(function(){return t.close()})},e.prototype.abort=function(t){if(this._state!=="errored")return this._underlyingWriter.abort(t)},e.prototype._setPendingWrite=function(t){var r,n=this,s=function(){n._pendingWrite===r&&(n._pendingWrite=void 0)};this._pendingWrite=r=t.then(s,s)},e.prototype._finishPendingWrite=function(){var t=this;if(this._pendingWrite===void 0)return Promise.resolve();var r=function(){return t._finishPendingWrite()};return this._pendingWrite.then(r,r)},e.prototype._startErroring=function(t){var r=this;if(this._state==="writable"){this._state="erroring",this._storedError=t;var n=function(){return r._finishErroring(t)};this._pendingWrite===void 0?n():this._finishPendingWrite().then(n,n),this._writableStreamController.error(t)}},e.prototype._finishErroring=function(t){this._state==="writable"&&this._startErroring(t),this._state==="erroring"&&(this._state="errored",this._errorPromiseReject(this._storedError))},e}();function Tb(e){On(NE(e));var t=e.readable,r=e.writable;On(t.locked===!1),On(r.locked===!1);var n,s=t.getReader();try{n=r.getWriter()}catch(i){throw s.releaseLock(),i}return new l$(s,n)}var l$=function(){function e(t,r){var n=this;this._transformStreamController=void 0,this._onRead=function(s){if(!s.done)return n._transformStreamController.enqueue(s.value),n._reader.read().then(n._onRead)},this._onError=function(s){n._flushReject(s),n._transformStreamController.error(s),n._reader.cancel(s).catch(P0),n._writer.abort(s).catch(P0)},this._onTerminate=function(){n._flushResolve(),n._transformStreamController.terminate();var s=new TypeError("TransformStream terminated");n._writer.abort(s).catch(P0)},this._reader=t,this._writer=r,this._flushPromise=new Promise(function(s,i){n._flushResolve=s,n._flushReject=i})}return e.prototype.start=function(t){this._transformStreamController=t,this._reader.read().then(this._onRead).then(this._onTerminate,this._onError);var r=this._reader.closed;r&&r.then(this._onTerminate,this._onError)},e.prototype.transform=function(t){return this._writer.write(t)},e.prototype.flush=function(){var t=this;return this._writer.close().then(function(){return t._flushPromise})},e}(),d$=Object.freeze({__proto__:null,createReadableStreamWrapper:function(e){On(function(r){return!!S1(r)&&!!jg(new r)}(e));var t=function(r){try{return new r({type:"bytes"}),!0}catch{return!1}}(e);return function(r,n){var s=(n===void 0?{}:n).type;if((s=LE(s))!=="bytes"||t||(s=void 0),r.constructor===e&&(s!=="bytes"||UE(r)))return r;if(s==="bytes"){var i=P1(r,{type:s});return new e(i)}return i=P1(r),new e(i)}},createTransformStreamWrapper:function(e){return On(function(t){return!!S1(t)&&!!NE(new t)}(e)),function(t){if(t.constructor===e)return t;var r=Tb(t);return new e(r)}},createWrappingReadableSource:P1,createWrappingTransformer:Tb,createWrappingWritableSink:xb,createWritableStreamWrapper:function(e){return On(function(t){return!!S1(t)&&!!$g(new t)}(e)),function(t){if(t.constructor===e)return t;var r=xb(t);return new e(r)}}}),yt=Ui(function(e){(function(t,r){function n(E,S){if(!E)throw Error(S||"Assertion failed")}function s(E,S){E.super_=S;var T=function(){};T.prototype=S.prototype,E.prototype=new T,E.prototype.constructor=E}function i(E,S,T){if(i.isBN(E))return E;this.negative=0,this.words=null,this.length=0,this.red=null,E!==null&&(S!=="le"&&S!=="be"||(T=S,S=10),this._init(E||0,S||10,T||"be"))}var o;typeof t=="object"?t.exports=i:r.BN=i,i.BN=i,i.wordSize=26;try{o=void 0}catch{}function a(E,S,T){for(var P=0,g=Math.min(E.length,T),A=S;A<g;A++){var x=E.charCodeAt(A)-48;P<<=4,P|=x>=49&&x<=54?x-49+10:x>=17&&x<=22?x-17+10:15&x}return P}function f(E,S,T,P){for(var g=0,A=Math.min(E.length,T),x=S;x<A;x++){var D=E.charCodeAt(x)-48;g*=P,g+=D>=49?D-49+10:D>=17?D-17+10:D}return g}i.isBN=function(E){return E instanceof i||E!==null&&typeof E=="object"&&E.constructor.wordSize===i.wordSize&&Array.isArray(E.words)},i.max=function(E,S){return E.cmp(S)>0?E:S},i.min=function(E,S){return E.cmp(S)<0?E:S},i.prototype._init=function(E,S,T){if(typeof E=="number")return this._initNumber(E,S,T);if(typeof E=="object")return this._initArray(E,S,T);S==="hex"&&(S=16),n(S===(0|S)&&S>=2&&S<=36);var P=0;(E=E.toString().replace(/\s+/g,""))[0]==="-"&&P++,S===16?this._parseHex(E,P):this._parseBase(E,S,P),E[0]==="-"&&(this.negative=1),this.strip(),T==="le"&&this._initArray(this.toArray(),S,T)},i.prototype._initNumber=function(E,S,T){E<0&&(this.negative=1,E=-E),E<67108864?(this.words=[67108863&E],this.length=1):E<4503599627370496?(this.words=[67108863&E,E/67108864&67108863],this.length=2):(n(E<9007199254740992),this.words=[67108863&E,E/67108864&67108863,1],this.length=3),T==="le"&&this._initArray(this.toArray(),S,T)},i.prototype._initArray=function(E,S,T){if(n(typeof E.length=="number"),E.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(E.length/3),this.words=Array(this.length);for(var P=0;P<this.length;P++)this.words[P]=0;var g,A,x=0;if(T==="be")for(P=E.length-1,g=0;P>=0;P-=3)A=E[P]|E[P-1]<<8|E[P-2]<<16,this.words[g]|=A<<x&67108863,this.words[g+1]=A>>>26-x&67108863,(x+=24)>=26&&(x-=26,g++);else if(T==="le")for(P=0,g=0;P<E.length;P+=3)A=E[P]|E[P+1]<<8|E[P+2]<<16,this.words[g]|=A<<x&67108863,this.words[g+1]=A>>>26-x&67108863,(x+=24)>=26&&(x-=26,g++);return this.strip()},i.prototype._parseHex=function(E,S){this.length=Math.ceil((E.length-S)/6),this.words=Array(this.length);for(var T=0;T<this.length;T++)this.words[T]=0;var P,g,A=0;for(T=E.length-6,P=0;T>=S;T-=6)g=a(E,T,T+6),this.words[P]|=g<<A&67108863,this.words[P+1]|=g>>>26-A&4194303,(A+=24)>=26&&(A-=26,P++);T+6!==S&&(g=a(E,S,T+6),this.words[P]|=g<<A&67108863,this.words[P+1]|=g>>>26-A&4194303),this.strip()},i.prototype._parseBase=function(E,S,T){this.words=[0],this.length=1;for(var P=0,g=1;g<=67108863;g*=S)P++;P--,g=g/S|0;for(var A=E.length-T,x=A%P,D=Math.min(A,A-x)+T,O=0,B=T;B<D;B+=P)O=f(E,B,B+P,S),this.imuln(g),this.words[0]+O<67108864?this.words[0]+=O:this._iaddn(O);if(x!==0){var L=1;for(O=f(E,B,E.length,S),B=0;B<x;B++)L*=S;this.imuln(L),this.words[0]+O<67108864?this.words[0]+=O:this._iaddn(O)}},i.prototype.copy=function(E){E.words=Array(this.length);for(var S=0;S<this.length;S++)E.words[S]=this.words[S];E.length=this.length,E.negative=this.negative,E.red=this.red},i.prototype.clone=function(){var E=new i(null);return this.copy(E),E},i.prototype._expand=function(E){for(;this.length<E;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","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"],l=[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],u=[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 p(E,S,T){T.negative=S.negative^E.negative;var P=E.length+S.length|0;T.length=P,P=P-1|0;var g=0|E.words[0],A=0|S.words[0],x=g*A,D=67108863&x,O=x/67108864|0;T.words[0]=D;for(var B=1;B<P;B++){for(var L=O>>>26,M=67108863&O,R=Math.min(B,S.length-1),N=Math.max(0,B-E.length+1);N<=R;N++){var F=B-N|0;L+=(x=(g=0|E.words[F])*(A=0|S.words[N])+M)/67108864|0,M=67108863&x}T.words[B]=0|M,O=0|L}return O!==0?T.words[B]=0|O:T.length--,T.strip()}i.prototype.toString=function(E,S){var T;if(S=0|S||1,(E=E||10)===16||E==="hex"){T="";for(var P=0,g=0,A=0;A<this.length;A++){var x=this.words[A],D=(16777215&(x<<P|g)).toString(16);T=(g=x>>>24-P&16777215)!==0||A!==this.length-1?c[6-D.length]+D+T:D+T,(P+=2)>=26&&(P-=26,A--)}for(g!==0&&(T=g.toString(16)+T);T.length%S!=0;)T="0"+T;return this.negative!==0&&(T="-"+T),T}if(E===(0|E)&&E>=2&&E<=36){var O=l[E],B=u[E];T="";var L=this.clone();for(L.negative=0;!L.isZero();){var M=L.modn(B).toString(E);T=(L=L.idivn(B)).isZero()?M+T:c[O-M.length]+M+T}for(this.isZero()&&(T="0"+T);T.length%S!=0;)T="0"+T;return this.negative!==0&&(T="-"+T),T}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=67108864*this.words[1]:this.length===3&&this.words[2]===1?E+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(E,S){return n(o!==void 0),this.toArrayLike(o,E,S)},i.prototype.toArray=function(E,S){return this.toArrayLike(Array,E,S)},i.prototype.toArrayLike=function(E,S,T){var P=this.byteLength(),g=T||Math.max(1,P);n(P<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var A,x,D=S==="le",O=new E(g),B=this.clone();if(D){for(x=0;!B.isZero();x++)A=B.andln(255),B.iushrn(8),O[x]=A;for(;x<g;x++)O[x]=0}else{for(x=0;x<g-P;x++)O[x]=0;for(x=0;!B.isZero();x++)A=B.andln(255),B.iushrn(8),O[g-x-1]=A}return O},i.prototype._countBits=Math.clz32?function(E){return 32-Math.clz32(E)}:function(E){var S=E,T=0;return S>=4096&&(T+=13,S>>>=13),S>=64&&(T+=7,S>>>=7),S>=8&&(T+=4,S>>>=4),S>=2&&(T+=2,S>>>=2),T+S},i.prototype._zeroBits=function(E){if(E===0)return 26;var S=E,T=0;return!(8191&S)&&(T+=13,S>>>=13),!(127&S)&&(T+=7,S>>>=7),!(15&S)&&(T+=4,S>>>=4),!(3&S)&&(T+=2,S>>>=2),!(1&S)&&T++,T},i.prototype.bitLength=function(){var E=this.words[this.length-1],S=this._countBits(E);return 26*(this.length-1)+S},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,S=0;S<this.length;S++){var T=this._zeroBits(this.words[S]);if(E+=T,T!==26)break}return E},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(E){return this.negative!==0?this.abs().inotn(E).iaddn(1):this.clone()},i.prototype.fromTwos=function(E){return this.testn(E-1)?this.notn(E).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(E){for(;this.length<E.length;)this.words[this.length++]=0;for(var S=0;S<E.length;S++)this.words[S]=this.words[S]|E.words[S];return this.strip()},i.prototype.ior=function(E){return n((this.negative|E.negative)==0),this.iuor(E)},i.prototype.or=function(E){return this.length>E.length?this.clone().ior(E):E.clone().ior(this)},i.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},i.prototype.iuand=function(E){var S;S=this.length>E.length?E:this;for(var T=0;T<S.length;T++)this.words[T]=this.words[T]&E.words[T];return this.length=S.length,this.strip()},i.prototype.iand=function(E){return n((this.negative|E.negative)==0),this.iuand(E)},i.prototype.and=function(E){return this.length>E.length?this.clone().iand(E):E.clone().iand(this)},i.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},i.prototype.iuxor=function(E){var S,T;this.length>E.length?(S=this,T=E):(S=E,T=this);for(var P=0;P<T.length;P++)this.words[P]=S.words[P]^T.words[P];if(this!==S)for(;P<S.length;P++)this.words[P]=S.words[P];return this.length=S.length,this.strip()},i.prototype.ixor=function(E){return n((this.negative|E.negative)==0),this.iuxor(E)},i.prototype.xor=function(E){return this.length>E.length?this.clone().ixor(E):E.clone().ixor(this)},i.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},i.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var S=0|Math.ceil(E/26),T=E%26;this._expand(S),T>0&&S--;for(var P=0;P<S;P++)this.words[P]=67108863&~this.words[P];return T>0&&(this.words[P]=~this.words[P]&67108863>>26-T),this.strip()},i.prototype.notn=function(E){return this.clone().inotn(E)},i.prototype.setn=function(E,S){n(typeof E=="number"&&E>=0);var T=E/26|0,P=E%26;return this._expand(T+1),this.words[T]=S?this.words[T]|1<<P:this.words[T]&~(1<<P),this.strip()},i.prototype.iadd=function(E){var S,T,P;if(this.negative!==0&&E.negative===0)return this.negative=0,S=this.isub(E),this.negative^=1,this._normSign();if(this.negative===0&&E.negative!==0)return E.negative=0,S=this.isub(E),E.negative=1,S._normSign();this.length>E.length?(T=this,P=E):(T=E,P=this);for(var g=0,A=0;A<P.length;A++)S=(0|T.words[A])+(0|P.words[A])+g,this.words[A]=67108863&S,g=S>>>26;for(;g!==0&&A<T.length;A++)S=(0|T.words[A])+g,this.words[A]=67108863&S,g=S>>>26;if(this.length=T.length,g!==0)this.words[this.length]=g,this.length++;else if(T!==this)for(;A<T.length;A++)this.words[A]=T.words[A];return this},i.prototype.add=function(E){var S;return E.negative!==0&&this.negative===0?(E.negative=0,S=this.sub(E),E.negative^=1,S):E.negative===0&&this.negative!==0?(this.negative=0,S=E.sub(this),this.negative=1,S):this.length>E.length?this.clone().iadd(E):E.clone().iadd(this)},i.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var S=this.iadd(E);return E.negative=1,S._normSign()}if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var T,P,g=this.cmp(E);if(g===0)return this.negative=0,this.length=1,this.words[0]=0,this;g>0?(T=this,P=E):(T=E,P=this);for(var A=0,x=0;x<P.length;x++)A=(S=(0|T.words[x])-(0|P.words[x])+A)>>26,this.words[x]=67108863&S;for(;A!==0&&x<T.length;x++)A=(S=(0|T.words[x])+A)>>26,this.words[x]=67108863&S;if(A===0&&x<T.length&&T!==this)for(;x<T.length;x++)this.words[x]=T.words[x];return this.length=Math.max(this.length,x),T!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(E){return this.clone().isub(E)};var d=function(E,S,T){var P,g,A,x=E.words,D=S.words,O=T.words,B=0,L=0|x[0],M=8191&L,R=L>>>13,N=0|x[1],F=8191&N,z=N>>>13,Y=0|x[2],j=8191&Y,re=Y>>>13,V=0|x[3],U=8191&V,X=V>>>13,ye=0|x[4],_e=8191&ye,Ae=ye>>>13,H=0|x[5],q=8191&H,W=H>>>13,ee=0|x[6],le=8191&ee,ce=ee>>>13,ie=0|x[7],Fe=8191&ie,De=ie>>>13,qe=0|x[8],he=8191&qe,ue=qe>>>13,pe=0|x[9],de=8191&pe,fe=pe>>>13,ge=0|D[0],se=8191&ge,te=ge>>>13,Ne=0|D[1],Ve=8191&Ne,Je=Ne>>>13,lt=0|D[2],tt=8191&lt,ve=lt>>>13,Z=0|D[3],oe=8191&Z,me=Z>>>13,xe=0|D[4],Pe=8191&xe,ke=xe>>>13,Oe=0|D[5],Ue=8191&Oe,Ie=Oe>>>13,Re=0|D[6],et=8191&Re,we=Re>>>13,Ce=0|D[7],Be=8191&Ce,Le=Ce>>>13,Me=0|D[8],$=8191&Me,J=Me>>>13,Q=0|D[9],K=8191&Q,ae=Q>>>13;T.negative=E.negative^S.negative,T.length=19;var Se=(B+(P=Math.imul(M,se))|0)+((8191&(g=(g=Math.imul(M,te))+Math.imul(R,se)|0))<<13)|0;B=((A=Math.imul(R,te))+(g>>>13)|0)+(Se>>>26)|0,Se&=67108863,P=Math.imul(F,se),g=(g=Math.imul(F,te))+Math.imul(z,se)|0,A=Math.imul(z,te);var Te=(B+(P=P+Math.imul(M,Ve)|0)|0)+((8191&(g=(g=g+Math.imul(M,Je)|0)+Math.imul(R,Ve)|0))<<13)|0;B=((A=A+Math.imul(R,Je)|0)+(g>>>13)|0)+(Te>>>26)|0,Te&=67108863,P=Math.imul(j,se),g=(g=Math.imul(j,te))+Math.imul(re,se)|0,A=Math.imul(re,te),P=P+Math.imul(F,Ve)|0,g=(g=g+Math.imul(F,Je)|0)+Math.imul(z,Ve)|0,A=A+Math.imul(z,Je)|0;var Ke=(B+(P=P+Math.imul(M,tt)|0)|0)+((8191&(g=(g=g+Math.imul(M,ve)|0)+Math.imul(R,tt)|0))<<13)|0;B=((A=A+Math.imul(R,ve)|0)+(g>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,P=Math.imul(U,se),g=(g=Math.imul(U,te))+Math.imul(X,se)|0,A=Math.imul(X,te),P=P+Math.imul(j,Ve)|0,g=(g=g+Math.imul(j,Je)|0)+Math.imul(re,Ve)|0,A=A+Math.imul(re,Je)|0,P=P+Math.imul(F,tt)|0,g=(g=g+Math.imul(F,ve)|0)+Math.imul(z,tt)|0,A=A+Math.imul(z,ve)|0;var Ge=(B+(P=P+Math.imul(M,oe)|0)|0)+((8191&(g=(g=g+Math.imul(M,me)|0)+Math.imul(R,oe)|0))<<13)|0;B=((A=A+Math.imul(R,me)|0)+(g>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,P=Math.imul(_e,se),g=(g=Math.imul(_e,te))+Math.imul(Ae,se)|0,A=Math.imul(Ae,te),P=P+Math.imul(U,Ve)|0,g=(g=g+Math.imul(U,Je)|0)+Math.imul(X,Ve)|0,A=A+Math.imul(X,Je)|0,P=P+Math.imul(j,tt)|0,g=(g=g+Math.imul(j,ve)|0)+Math.imul(re,tt)|0,A=A+Math.imul(re,ve)|0,P=P+Math.imul(F,oe)|0,g=(g=g+Math.imul(F,me)|0)+Math.imul(z,oe)|0,A=A+Math.imul(z,me)|0;var dt=(B+(P=P+Math.imul(M,Pe)|0)|0)+((8191&(g=(g=g+Math.imul(M,ke)|0)+Math.imul(R,Pe)|0))<<13)|0;B=((A=A+Math.imul(R,ke)|0)+(g>>>13)|0)+(dt>>>26)|0,dt&=67108863,P=Math.imul(q,se),g=(g=Math.imul(q,te))+Math.imul(W,se)|0,A=Math.imul(W,te),P=P+Math.imul(_e,Ve)|0,g=(g=g+Math.imul(_e,Je)|0)+Math.imul(Ae,Ve)|0,A=A+Math.imul(Ae,Je)|0,P=P+Math.imul(U,tt)|0,g=(g=g+Math.imul(U,ve)|0)+Math.imul(X,tt)|0,A=A+Math.imul(X,ve)|0,P=P+Math.imul(j,oe)|0,g=(g=g+Math.imul(j,me)|0)+Math.imul(re,oe)|0,A=A+Math.imul(re,me)|0,P=P+Math.imul(F,Pe)|0,g=(g=g+Math.imul(F,ke)|0)+Math.imul(z,Pe)|0,A=A+Math.imul(z,ke)|0;var it=(B+(P=P+Math.imul(M,Ue)|0)|0)+((8191&(g=(g=g+Math.imul(M,Ie)|0)+Math.imul(R,Ue)|0))<<13)|0;B=((A=A+Math.imul(R,Ie)|0)+(g>>>13)|0)+(it>>>26)|0,it&=67108863,P=Math.imul(le,se),g=(g=Math.imul(le,te))+Math.imul(ce,se)|0,A=Math.imul(ce,te),P=P+Math.imul(q,Ve)|0,g=(g=g+Math.imul(q,Je)|0)+Math.imul(W,Ve)|0,A=A+Math.imul(W,Je)|0,P=P+Math.imul(_e,tt)|0,g=(g=g+Math.imul(_e,ve)|0)+Math.imul(Ae,tt)|0,A=A+Math.imul(Ae,ve)|0,P=P+Math.imul(U,oe)|0,g=(g=g+Math.imul(U,me)|0)+Math.imul(X,oe)|0,A=A+Math.imul(X,me)|0,P=P+Math.imul(j,Pe)|0,g=(g=g+Math.imul(j,ke)|0)+Math.imul(re,Pe)|0,A=A+Math.imul(re,ke)|0,P=P+Math.imul(F,Ue)|0,g=(g=g+Math.imul(F,Ie)|0)+Math.imul(z,Ue)|0,A=A+Math.imul(z,Ie)|0;var Ct=(B+(P=P+Math.imul(M,et)|0)|0)+((8191&(g=(g=g+Math.imul(M,we)|0)+Math.imul(R,et)|0))<<13)|0;B=((A=A+Math.imul(R,we)|0)+(g>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,P=Math.imul(Fe,se),g=(g=Math.imul(Fe,te))+Math.imul(De,se)|0,A=Math.imul(De,te),P=P+Math.imul(le,Ve)|0,g=(g=g+Math.imul(le,Je)|0)+Math.imul(ce,Ve)|0,A=A+Math.imul(ce,Je)|0,P=P+Math.imul(q,tt)|0,g=(g=g+Math.imul(q,ve)|0)+Math.imul(W,tt)|0,A=A+Math.imul(W,ve)|0,P=P+Math.imul(_e,oe)|0,g=(g=g+Math.imul(_e,me)|0)+Math.imul(Ae,oe)|0,A=A+Math.imul(Ae,me)|0,P=P+Math.imul(U,Pe)|0,g=(g=g+Math.imul(U,ke)|0)+Math.imul(X,Pe)|0,A=A+Math.imul(X,ke)|0,P=P+Math.imul(j,Ue)|0,g=(g=g+Math.imul(j,Ie)|0)+Math.imul(re,Ue)|0,A=A+Math.imul(re,Ie)|0,P=P+Math.imul(F,et)|0,g=(g=g+Math.imul(F,we)|0)+Math.imul(z,et)|0,A=A+Math.imul(z,we)|0;var at=(B+(P=P+Math.imul(M,Be)|0)|0)+((8191&(g=(g=g+Math.imul(M,Le)|0)+Math.imul(R,Be)|0))<<13)|0;B=((A=A+Math.imul(R,Le)|0)+(g>>>13)|0)+(at>>>26)|0,at&=67108863,P=Math.imul(he,se),g=(g=Math.imul(he,te))+Math.imul(ue,se)|0,A=Math.imul(ue,te),P=P+Math.imul(Fe,Ve)|0,g=(g=g+Math.imul(Fe,Je)|0)+Math.imul(De,Ve)|0,A=A+Math.imul(De,Je)|0,P=P+Math.imul(le,tt)|0,g=(g=g+Math.imul(le,ve)|0)+Math.imul(ce,tt)|0,A=A+Math.imul(ce,ve)|0,P=P+Math.imul(q,oe)|0,g=(g=g+Math.imul(q,me)|0)+Math.imul(W,oe)|0,A=A+Math.imul(W,me)|0,P=P+Math.imul(_e,Pe)|0,g=(g=g+Math.imul(_e,ke)|0)+Math.imul(Ae,Pe)|0,A=A+Math.imul(Ae,ke)|0,P=P+Math.imul(U,Ue)|0,g=(g=g+Math.imul(U,Ie)|0)+Math.imul(X,Ue)|0,A=A+Math.imul(X,Ie)|0,P=P+Math.imul(j,et)|0,g=(g=g+Math.imul(j,we)|0)+Math.imul(re,et)|0,A=A+Math.imul(re,we)|0,P=P+Math.imul(F,Be)|0,g=(g=g+Math.imul(F,Le)|0)+Math.imul(z,Be)|0,A=A+Math.imul(z,Le)|0;var vt=(B+(P=P+Math.imul(M,$)|0)|0)+((8191&(g=(g=g+Math.imul(M,J)|0)+Math.imul(R,$)|0))<<13)|0;B=((A=A+Math.imul(R,J)|0)+(g>>>13)|0)+(vt>>>26)|0,vt&=67108863,P=Math.imul(de,se),g=(g=Math.imul(de,te))+Math.imul(fe,se)|0,A=Math.imul(fe,te),P=P+Math.imul(he,Ve)|0,g=(g=g+Math.imul(he,Je)|0)+Math.imul(ue,Ve)|0,A=A+Math.imul(ue,Je)|0,P=P+Math.imul(Fe,tt)|0,g=(g=g+Math.imul(Fe,ve)|0)+Math.imul(De,tt)|0,A=A+Math.imul(De,ve)|0,P=P+Math.imul(le,oe)|0,g=(g=g+Math.imul(le,me)|0)+Math.imul(ce,oe)|0,A=A+Math.imul(ce,me)|0,P=P+Math.imul(q,Pe)|0,g=(g=g+Math.imul(q,ke)|0)+Math.imul(W,Pe)|0,A=A+Math.imul(W,ke)|0,P=P+Math.imul(_e,Ue)|0,g=(g=g+Math.imul(_e,Ie)|0)+Math.imul(Ae,Ue)|0,A=A+Math.imul(Ae,Ie)|0,P=P+Math.imul(U,et)|0,g=(g=g+Math.imul(U,we)|0)+Math.imul(X,et)|0,A=A+Math.imul(X,we)|0,P=P+Math.imul(j,Be)|0,g=(g=g+Math.imul(j,Le)|0)+Math.imul(re,Be)|0,A=A+Math.imul(re,Le)|0,P=P+Math.imul(F,$)|0,g=(g=g+Math.imul(F,J)|0)+Math.imul(z,$)|0,A=A+Math.imul(z,J)|0;var bt=(B+(P=P+Math.imul(M,K)|0)|0)+((8191&(g=(g=g+Math.imul(M,ae)|0)+Math.imul(R,K)|0))<<13)|0;B=((A=A+Math.imul(R,ae)|0)+(g>>>13)|0)+(bt>>>26)|0,bt&=67108863,P=Math.imul(de,Ve),g=(g=Math.imul(de,Je))+Math.imul(fe,Ve)|0,A=Math.imul(fe,Je),P=P+Math.imul(he,tt)|0,g=(g=g+Math.imul(he,ve)|0)+Math.imul(ue,tt)|0,A=A+Math.imul(ue,ve)|0,P=P+Math.imul(Fe,oe)|0,g=(g=g+Math.imul(Fe,me)|0)+Math.imul(De,oe)|0,A=A+Math.imul(De,me)|0,P=P+Math.imul(le,Pe)|0,g=(g=g+Math.imul(le,ke)|0)+Math.imul(ce,Pe)|0,A=A+Math.imul(ce,ke)|0,P=P+Math.imul(q,Ue)|0,g=(g=g+Math.imul(q,Ie)|0)+Math.imul(W,Ue)|0,A=A+Math.imul(W,Ie)|0,P=P+Math.imul(_e,et)|0,g=(g=g+Math.imul(_e,we)|0)+Math.imul(Ae,et)|0,A=A+Math.imul(Ae,we)|0,P=P+Math.imul(U,Be)|0,g=(g=g+Math.imul(U,Le)|0)+Math.imul(X,Be)|0,A=A+Math.imul(X,Le)|0,P=P+Math.imul(j,$)|0,g=(g=g+Math.imul(j,J)|0)+Math.imul(re,$)|0,A=A+Math.imul(re,J)|0;var St=(B+(P=P+Math.imul(F,K)|0)|0)+((8191&(g=(g=g+Math.imul(F,ae)|0)+Math.imul(z,K)|0))<<13)|0;B=((A=A+Math.imul(z,ae)|0)+(g>>>13)|0)+(St>>>26)|0,St&=67108863,P=Math.imul(de,tt),g=(g=Math.imul(de,ve))+Math.imul(fe,tt)|0,A=Math.imul(fe,ve),P=P+Math.imul(he,oe)|0,g=(g=g+Math.imul(he,me)|0)+Math.imul(ue,oe)|0,A=A+Math.imul(ue,me)|0,P=P+Math.imul(Fe,Pe)|0,g=(g=g+Math.imul(Fe,ke)|0)+Math.imul(De,Pe)|0,A=A+Math.imul(De,ke)|0,P=P+Math.imul(le,Ue)|0,g=(g=g+Math.imul(le,Ie)|0)+Math.imul(ce,Ue)|0,A=A+Math.imul(ce,Ie)|0,P=P+Math.imul(q,et)|0,g=(g=g+Math.imul(q,we)|0)+Math.imul(W,et)|0,A=A+Math.imul(W,we)|0,P=P+Math.imul(_e,Be)|0,g=(g=g+Math.imul(_e,Le)|0)+Math.imul(Ae,Be)|0,A=A+Math.imul(Ae,Le)|0,P=P+Math.imul(U,$)|0,g=(g=g+Math.imul(U,J)|0)+Math.imul(X,$)|0,A=A+Math.imul(X,J)|0;var At=(B+(P=P+Math.imul(j,K)|0)|0)+((8191&(g=(g=g+Math.imul(j,ae)|0)+Math.imul(re,K)|0))<<13)|0;B=((A=A+Math.imul(re,ae)|0)+(g>>>13)|0)+(At>>>26)|0,At&=67108863,P=Math.imul(de,oe),g=(g=Math.imul(de,me))+Math.imul(fe,oe)|0,A=Math.imul(fe,me),P=P+Math.imul(he,Pe)|0,g=(g=g+Math.imul(he,ke)|0)+Math.imul(ue,Pe)|0,A=A+Math.imul(ue,ke)|0,P=P+Math.imul(Fe,Ue)|0,g=(g=g+Math.imul(Fe,Ie)|0)+Math.imul(De,Ue)|0,A=A+Math.imul(De,Ie)|0,P=P+Math.imul(le,et)|0,g=(g=g+Math.imul(le,we)|0)+Math.imul(ce,et)|0,A=A+Math.imul(ce,we)|0,P=P+Math.imul(q,Be)|0,g=(g=g+Math.imul(q,Le)|0)+Math.imul(W,Be)|0,A=A+Math.imul(W,Le)|0,P=P+Math.imul(_e,$)|0,g=(g=g+Math.imul(_e,J)|0)+Math.imul(Ae,$)|0,A=A+Math.imul(Ae,J)|0;var _t=(B+(P=P+Math.imul(U,K)|0)|0)+((8191&(g=(g=g+Math.imul(U,ae)|0)+Math.imul(X,K)|0))<<13)|0;B=((A=A+Math.imul(X,ae)|0)+(g>>>13)|0)+(_t>>>26)|0,_t&=67108863,P=Math.imul(de,Pe),g=(g=Math.imul(de,ke))+Math.imul(fe,Pe)|0,A=Math.imul(fe,ke),P=P+Math.imul(he,Ue)|0,g=(g=g+Math.imul(he,Ie)|0)+Math.imul(ue,Ue)|0,A=A+Math.imul(ue,Ie)|0,P=P+Math.imul(Fe,et)|0,g=(g=g+Math.imul(Fe,we)|0)+Math.imul(De,et)|0,A=A+Math.imul(De,we)|0,P=P+Math.imul(le,Be)|0,g=(g=g+Math.imul(le,Le)|0)+Math.imul(ce,Be)|0,A=A+Math.imul(ce,Le)|0,P=P+Math.imul(q,$)|0,g=(g=g+Math.imul(q,J)|0)+Math.imul(W,$)|0,A=A+Math.imul(W,J)|0;var Et=(B+(P=P+Math.imul(_e,K)|0)|0)+((8191&(g=(g=g+Math.imul(_e,ae)|0)+Math.imul(Ae,K)|0))<<13)|0;B=((A=A+Math.imul(Ae,ae)|0)+(g>>>13)|0)+(Et>>>26)|0,Et&=67108863,P=Math.imul(de,Ue),g=(g=Math.imul(de,Ie))+Math.imul(fe,Ue)|0,A=Math.imul(fe,Ie),P=P+Math.imul(he,et)|0,g=(g=g+Math.imul(he,we)|0)+Math.imul(ue,et)|0,A=A+Math.imul(ue,we)|0,P=P+Math.imul(Fe,Be)|0,g=(g=g+Math.imul(Fe,Le)|0)+Math.imul(De,Be)|0,A=A+Math.imul(De,Le)|0,P=P+Math.imul(le,$)|0,g=(g=g+Math.imul(le,J)|0)+Math.imul(ce,$)|0,A=A+Math.imul(ce,J)|0;var wt=(B+(P=P+Math.imul(q,K)|0)|0)+((8191&(g=(g=g+Math.imul(q,ae)|0)+Math.imul(W,K)|0))<<13)|0;B=((A=A+Math.imul(W,ae)|0)+(g>>>13)|0)+(wt>>>26)|0,wt&=67108863,P=Math.imul(de,et),g=(g=Math.imul(de,we))+Math.imul(fe,et)|0,A=Math.imul(fe,we),P=P+Math.imul(he,Be)|0,g=(g=g+Math.imul(he,Le)|0)+Math.imul(ue,Be)|0,A=A+Math.imul(ue,Le)|0,P=P+Math.imul(Fe,$)|0,g=(g=g+Math.imul(Fe,J)|0)+Math.imul(De,$)|0,A=A+Math.imul(De,J)|0;var ut=(B+(P=P+Math.imul(le,K)|0)|0)+((8191&(g=(g=g+Math.imul(le,ae)|0)+Math.imul(ce,K)|0))<<13)|0;B=((A=A+Math.imul(ce,ae)|0)+(g>>>13)|0)+(ut>>>26)|0,ut&=67108863,P=Math.imul(de,Be),g=(g=Math.imul(de,Le))+Math.imul(fe,Be)|0,A=Math.imul(fe,Le),P=P+Math.imul(he,$)|0,g=(g=g+Math.imul(he,J)|0)+Math.imul(ue,$)|0,A=A+Math.imul(ue,J)|0;var ht=(B+(P=P+Math.imul(Fe,K)|0)|0)+((8191&(g=(g=g+Math.imul(Fe,ae)|0)+Math.imul(De,K)|0))<<13)|0;B=((A=A+Math.imul(De,ae)|0)+(g>>>13)|0)+(ht>>>26)|0,ht&=67108863,P=Math.imul(de,$),g=(g=Math.imul(de,J))+Math.imul(fe,$)|0,A=Math.imul(fe,J);var st=(B+(P=P+Math.imul(he,K)|0)|0)+((8191&(g=(g=g+Math.imul(he,ae)|0)+Math.imul(ue,K)|0))<<13)|0;B=((A=A+Math.imul(ue,ae)|0)+(g>>>13)|0)+(st>>>26)|0,st&=67108863;var ft=(B+(P=Math.imul(de,K))|0)+((8191&(g=(g=Math.imul(de,ae))+Math.imul(fe,K)|0))<<13)|0;return B=((A=Math.imul(fe,ae))+(g>>>13)|0)+(ft>>>26)|0,ft&=67108863,O[0]=Se,O[1]=Te,O[2]=Ke,O[3]=Ge,O[4]=dt,O[5]=it,O[6]=Ct,O[7]=at,O[8]=vt,O[9]=bt,O[10]=St,O[11]=At,O[12]=_t,O[13]=Et,O[14]=wt,O[15]=ut,O[16]=ht,O[17]=st,O[18]=ft,B!==0&&(O[19]=B,T.length++),T};function h(E,S,T){return new y().mulp(E,S,T)}function y(E,S){this.x=E,this.y=S}Math.imul||(d=p),i.prototype.mulTo=function(E,S){var T,P=this.length+E.length;return T=this.length===10&&E.length===10?d(this,E,S):P<63?p(this,E,S):P<1024?function(g,A,x){x.negative=A.negative^g.negative,x.length=g.length+A.length;for(var D=0,O=0,B=0;B<x.length-1;B++){var L=O;O=0;for(var M=67108863&D,R=Math.min(B,A.length-1),N=Math.max(0,B-g.length+1);N<=R;N++){var F=B-N,z=(0|g.words[F])*(0|A.words[N]),Y=67108863&z;M=67108863&(Y=Y+M|0),O+=(L=(L=L+(z/67108864|0)|0)+(Y>>>26)|0)>>>26,L&=67108863}x.words[B]=M,D=L,L=O}return D!==0?x.words[B]=D:x.length--,x.strip()}(this,E,S):h(this,E,S),T},y.prototype.makeRBT=function(E){for(var S=Array(E),T=i.prototype._countBits(E)-1,P=0;P<E;P++)S[P]=this.revBin(P,T,E);return S},y.prototype.revBin=function(E,S,T){if(E===0||E===T-1)return E;for(var P=0,g=0;g<S;g++)P|=(1&E)<<S-g-1,E>>=1;return P},y.prototype.permute=function(E,S,T,P,g,A){for(var x=0;x<A;x++)P[x]=S[E[x]],g[x]=T[E[x]]},y.prototype.transform=function(E,S,T,P,g,A){this.permute(A,E,S,T,P,g);for(var x=1;x<g;x<<=1)for(var D=x<<1,O=Math.cos(2*Math.PI/D),B=Math.sin(2*Math.PI/D),L=0;L<g;L+=D)for(var M=O,R=B,N=0;N<x;N++){var F=T[L+N],z=P[L+N],Y=T[L+N+x],j=P[L+N+x],re=M*Y-R*j;j=M*j+R*Y,Y=re,T[L+N]=F+Y,P[L+N]=z+j,T[L+N+x]=F-Y,P[L+N+x]=z-j,N!==D&&(re=O*M-B*R,R=O*R+B*M,M=re)}},y.prototype.guessLen13b=function(E,S){var T=1|Math.max(S,E),P=1&T,g=0;for(T=T/2|0;T;T>>>=1)g++;return 1<<g+1+P},y.prototype.conjugate=function(E,S,T){if(!(T<=1))for(var P=0;P<T/2;P++){var g=E[P];E[P]=E[T-P-1],E[T-P-1]=g,g=S[P],S[P]=-S[T-P-1],S[T-P-1]=-g}},y.prototype.normalize13b=function(E,S){for(var T=0,P=0;P<S/2;P++){var g=8192*Math.round(E[2*P+1]/S)+Math.round(E[2*P]/S)+T;E[P]=67108863&g,T=g<67108864?0:g/67108864|0}return E},y.prototype.convert13b=function(E,S,T,P){for(var g=0,A=0;A<S;A++)g+=0|E[A],T[2*A]=8191&g,g>>>=13,T[2*A+1]=8191&g,g>>>=13;for(A=2*S;A<P;++A)T[A]=0;n(g===0),n((-8192&g)==0)},y.prototype.stub=function(E){for(var S=Array(E),T=0;T<E;T++)S[T]=0;return S},y.prototype.mulp=function(E,S,T){var P=2*this.guessLen13b(E.length,S.length),g=this.makeRBT(P),A=this.stub(P),x=Array(P),D=Array(P),O=Array(P),B=Array(P),L=Array(P),M=Array(P),R=T.words;R.length=P,this.convert13b(E.words,E.length,x,P),this.convert13b(S.words,S.length,B,P),this.transform(x,A,D,O,P,g),this.transform(B,A,L,M,P,g);for(var N=0;N<P;N++){var F=D[N]*L[N]-O[N]*M[N];O[N]=D[N]*M[N]+O[N]*L[N],D[N]=F}return this.conjugate(D,O,P),this.transform(D,O,R,A,P,g),this.conjugate(R,A,P),this.normalize13b(R,P),T.negative=E.negative^S.negative,T.length=E.length+S.length,T.strip()},i.prototype.mul=function(E){var S=new i(null);return S.words=Array(this.length+E.length),this.mulTo(E,S)},i.prototype.mulf=function(E){var S=new i(null);return S.words=Array(this.length+E.length),h(this,E,S)},i.prototype.imul=function(E){return this.clone().mulTo(E,this)},i.prototype.imuln=function(E){n(typeof E=="number"),n(E<67108864);for(var S=0,T=0;T<this.length;T++){var P=(0|this.words[T])*E,g=(67108863&P)+(67108863&S);S>>=26,S+=P/67108864|0,S+=g>>>26,this.words[T]=67108863&g}return S!==0&&(this.words[T]=S,this.length++),this},i.prototype.muln=function(E){return this.clone().imuln(E)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(E){var S=function(A){for(var x=Array(A.bitLength()),D=0;D<x.length;D++){var O=D/26|0,B=D%26;x[D]=(A.words[O]&1<<B)>>>B}return x}(E);if(S.length===0)return new i(1);for(var T=this,P=0;P<S.length&&S[P]===0;P++,T=T.sqr());if(++P<S.length)for(var g=T.sqr();P<S.length;P++,g=g.sqr())S[P]!==0&&(T=T.mul(g));return T},i.prototype.iushln=function(E){n(typeof E=="number"&&E>=0);var S,T=E%26,P=(E-T)/26,g=67108863>>>26-T<<26-T;if(T!==0){var A=0;for(S=0;S<this.length;S++){var x=this.words[S]&g,D=(0|this.words[S])-x<<T;this.words[S]=D|A,A=x>>>26-T}A&&(this.words[S]=A,this.length++)}if(P!==0){for(S=this.length-1;S>=0;S--)this.words[S+P]=this.words[S];for(S=0;S<P;S++)this.words[S]=0;this.length+=P}return this.strip()},i.prototype.ishln=function(E){return n(this.negative===0),this.iushln(E)},i.prototype.iushrn=function(E,S,T){var P;n(typeof E=="number"&&E>=0),P=S?(S-S%26)/26:0;var g=E%26,A=Math.min((E-g)/26,this.length),x=67108863^67108863>>>g<<g,D=T;if(P=Math.max(0,P-=A),D){for(var O=0;O<A;O++)D.words[O]=this.words[O];D.length=A}if(A!==0)if(this.length>A)for(this.length-=A,O=0;O<this.length;O++)this.words[O]=this.words[O+A];else this.words[0]=0,this.length=1;var B=0;for(O=this.length-1;O>=0&&(B!==0||O>=P);O--){var L=0|this.words[O];this.words[O]=B<<26-g|L>>>g,B=L&x}return D&&B!==0&&(D.words[D.length++]=B),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(E,S,T){return n(this.negative===0),this.iushrn(E,S,T)},i.prototype.shln=function(E){return this.clone().ishln(E)},i.prototype.ushln=function(E){return this.clone().iushln(E)},i.prototype.shrn=function(E){return this.clone().ishrn(E)},i.prototype.ushrn=function(E){return this.clone().iushrn(E)},i.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var S=E%26,T=(E-S)/26,P=1<<S;return!(this.length<=T)&&!!(this.words[T]&P)},i.prototype.imaskn=function(E){n(typeof E=="number"&&E>=0);var S=E%26,T=(E-S)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=T)return this;if(S!==0&&T++,this.length=Math.min(T,this.length),S!==0){var P=67108863^67108863>>>S<<S;this.words[this.length-1]&=P}return this.strip()},i.prototype.maskn=function(E){return this.clone().imaskn(E)},i.prototype.iaddn=function(E){return n(typeof E=="number"),n(E<67108864),E<0?this.isubn(-E):this.negative!==0?this.length===1&&(0|this.words[0])<E?(this.words[0]=E-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(E),this.negative=1,this):this._iaddn(E)},i.prototype._iaddn=function(E){this.words[0]+=E;for(var S=0;S<this.length&&this.words[S]>=67108864;S++)this.words[S]-=67108864,S===this.length-1?this.words[S+1]=1:this.words[S+1]++;return this.length=Math.max(this.length,S+1),this},i.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var S=0;S<this.length&&this.words[S]<0;S++)this.words[S]+=67108864,this.words[S+1]-=1;return this.strip()},i.prototype.addn=function(E){return this.clone().iaddn(E)},i.prototype.subn=function(E){return this.clone().isubn(E)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(E,S,T){var P,g,A=E.length+T;this._expand(A);var x=0;for(P=0;P<E.length;P++){g=(0|this.words[P+T])+x;var D=(0|E.words[P])*S;x=((g-=67108863&D)>>26)-(D/67108864|0),this.words[P+T]=67108863&g}for(;P<this.length-T;P++)x=(g=(0|this.words[P+T])+x)>>26,this.words[P+T]=67108863&g;if(x===0)return this.strip();for(n(x===-1),x=0,P=0;P<this.length;P++)x=(g=-(0|this.words[P])+x)>>26,this.words[P]=67108863&g;return this.negative=1,this.strip()},i.prototype._wordDiv=function(E,S){var T=(this.length,E.length),P=this.clone(),g=E,A=0|g.words[g.length-1];(T=26-this._countBits(A))!==0&&(g=g.ushln(T),P.iushln(T),A=0|g.words[g.length-1]);var x,D=P.length-g.length;if(S!=="mod"){(x=new i(null)).length=D+1,x.words=Array(x.length);for(var O=0;O<x.length;O++)x.words[O]=0}var B=P.clone()._ishlnsubmul(g,1,D);B.negative===0&&(P=B,x&&(x.words[D]=1));for(var L=D-1;L>=0;L--){var M=67108864*(0|P.words[g.length+L])+(0|P.words[g.length+L-1]);for(M=Math.min(M/A|0,67108863),P._ishlnsubmul(g,M,L);P.negative!==0;)M--,P.negative=0,P._ishlnsubmul(g,1,L),P.isZero()||(P.negative^=1);x&&(x.words[L]=M)}return x&&x.strip(),P.strip(),S!=="div"&&T!==0&&P.iushrn(T),{div:x||null,mod:P}},i.prototype.divmod=function(E,S,T){return n(!E.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:this.negative!==0&&E.negative===0?(A=this.neg().divmod(E,S),S!=="mod"&&(P=A.div.neg()),S!=="div"&&(g=A.mod.neg(),T&&g.negative!==0&&g.iadd(E)),{div:P,mod:g}):this.negative===0&&E.negative!==0?(A=this.divmod(E.neg(),S),S!=="mod"&&(P=A.div.neg()),{div:P,mod:A.mod}):this.negative&E.negative?(A=this.neg().divmod(E.neg(),S),S!=="div"&&(g=A.mod.neg(),T&&g.negative!==0&&g.isub(E)),{div:A.div,mod:g}):E.length>this.length||this.cmp(E)<0?{div:new i(0),mod:this}:E.length===1?S==="div"?{div:this.divn(E.words[0]),mod:null}:S==="mod"?{div:null,mod:new i(this.modn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new i(this.modn(E.words[0]))}:this._wordDiv(E,S);var P,g,A},i.prototype.div=function(E){return this.divmod(E,"div",!1).div},i.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},i.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},i.prototype.divRound=function(E){var S=this.divmod(E);if(S.mod.isZero())return S.div;var T=S.div.negative!==0?S.mod.isub(E):S.mod,P=E.ushrn(1),g=E.andln(1),A=T.cmp(P);return A<0||g===1&&A===0?S.div:S.div.negative!==0?S.div.isubn(1):S.div.iaddn(1)},i.prototype.modn=function(E){n(E<=67108863);for(var S=(1<<26)%E,T=0,P=this.length-1;P>=0;P--)T=(S*T+(0|this.words[P]))%E;return T},i.prototype.idivn=function(E){n(E<=67108863);for(var S=0,T=this.length-1;T>=0;T--){var P=(0|this.words[T])+67108864*S;this.words[T]=P/E|0,S=P%E}return this.strip()},i.prototype.divn=function(E){return this.clone().idivn(E)},i.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var S=this,T=E.clone();S=S.negative!==0?S.umod(E):S.clone();for(var P=new i(1),g=new i(0),A=new i(0),x=new i(1),D=0;S.isEven()&&T.isEven();)S.iushrn(1),T.iushrn(1),++D;for(var O=T.clone(),B=S.clone();!S.isZero();){for(var L=0,M=1;!(S.words[0]&M)&&L<26;++L,M<<=1);if(L>0)for(S.iushrn(L);L-- >0;)(P.isOdd()||g.isOdd())&&(P.iadd(O),g.isub(B)),P.iushrn(1),g.iushrn(1);for(var R=0,N=1;!(T.words[0]&N)&&R<26;++R,N<<=1);if(R>0)for(T.iushrn(R);R-- >0;)(A.isOdd()||x.isOdd())&&(A.iadd(O),x.isub(B)),A.iushrn(1),x.iushrn(1);S.cmp(T)>=0?(S.isub(T),P.isub(A),g.isub(x)):(T.isub(S),A.isub(P),x.isub(g))}return{a:A,b:x,gcd:T.iushln(D)}},i.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var S=this,T=E.clone();S=S.negative!==0?S.umod(E):S.clone();for(var P,g=new i(1),A=new i(0),x=T.clone();S.cmpn(1)>0&&T.cmpn(1)>0;){for(var D=0,O=1;!(S.words[0]&O)&&D<26;++D,O<<=1);if(D>0)for(S.iushrn(D);D-- >0;)g.isOdd()&&g.iadd(x),g.iushrn(1);for(var B=0,L=1;!(T.words[0]&L)&&B<26;++B,L<<=1);if(B>0)for(T.iushrn(B);B-- >0;)A.isOdd()&&A.iadd(x),A.iushrn(1);S.cmp(T)>=0?(S.isub(T),g.isub(A)):(T.isub(S),A.isub(g))}return(P=S.cmpn(1)===0?g:A).cmpn(0)<0&&P.iadd(E),P},i.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var S=this.clone(),T=E.clone();S.negative=0,T.negative=0;for(var P=0;S.isEven()&&T.isEven();P++)S.iushrn(1),T.iushrn(1);for(;;){for(;S.isEven();)S.iushrn(1);for(;T.isEven();)T.iushrn(1);var g=S.cmp(T);if(g<0){var A=S;S=T,T=A}else if(g===0||T.cmpn(1)===0)break;S.isub(T)}return T.iushln(P)},i.prototype.invm=function(E){return this.egcd(E).a.umod(E)},i.prototype.isEven=function(){return(1&this.words[0])==0},i.prototype.isOdd=function(){return(1&this.words[0])==1},i.prototype.andln=function(E){return this.words[0]&E},i.prototype.bincn=function(E){n(typeof E=="number");var S=E%26,T=(E-S)/26,P=1<<S;if(this.length<=T)return this._expand(T+1),this.words[T]|=P,this;for(var g=P,A=T;g!==0&&A<this.length;A++){var x=0|this.words[A];g=(x+=g)>>>26,x&=67108863,this.words[A]=x}return g!==0&&(this.words[A]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(E){var S,T=E<0;if(this.negative!==0&&!T)return-1;if(this.negative===0&&T)return 1;if(this.strip(),this.length>1)S=1;else{T&&(E=-E),n(E<=67108863,"Number is too big");var P=0|this.words[0];S=P===E?0:P<E?-1:1}return this.negative!==0?0|-S:S},i.prototype.cmp=function(E){if(this.negative!==0&&E.negative===0)return-1;if(this.negative===0&&E.negative!==0)return 1;var S=this.ucmp(E);return this.negative!==0?0|-S:S},i.prototype.ucmp=function(E){if(this.length>E.length)return 1;if(this.length<E.length)return-1;for(var S=0,T=this.length-1;T>=0;T--){var P=0|this.words[T],g=0|E.words[T];if(P!==g){P<g?S=-1:P>g&&(S=1);break}}return S},i.prototype.gtn=function(E){return this.cmpn(E)===1},i.prototype.gt=function(E){return this.cmp(E)===1},i.prototype.gten=function(E){return this.cmpn(E)>=0},i.prototype.gte=function(E){return this.cmp(E)>=0},i.prototype.ltn=function(E){return this.cmpn(E)===-1},i.prototype.lt=function(E){return this.cmp(E)===-1},i.prototype.lten=function(E){return this.cmpn(E)<=0},i.prototype.lte=function(E){return this.cmp(E)<=0},i.prototype.eqn=function(E){return this.cmpn(E)===0},i.prototype.eq=function(E){return this.cmp(E)===0},i.red=function(E){return new I(E)},i.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(E){return this.red=E,this},i.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},i.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},i.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},i.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},i.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},i.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},i.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},i.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var m={k256:null,p224:null,p192:null,p25519:null};function v(E,S){this.name=E,this.p=new i(S,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function C(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(E){if(typeof E=="string"){var S=i._prime(E);this.m=S.p,this.prime=S}else n(E.gtn(1),"modulus must be greater than 1"),this.m=E,this.prime=null}function k(E){I.call(this,E),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var E=new i(null);return E.words=Array(Math.ceil(this.n/13)),E},v.prototype.ireduce=function(E){var S,T=E;do this.split(T,this.tmp),S=(T=(T=this.imulK(T)).iadd(this.tmp)).bitLength();while(S>this.n);var P=S<this.n?-1:T.ucmp(this.p);return P===0?(T.words[0]=0,T.length=1):P>0?T.isub(this.p):T.strip(),T},v.prototype.split=function(E,S){E.iushrn(this.n,0,S)},v.prototype.imulK=function(E){return E.imul(this.k)},s(b,v),b.prototype.split=function(E,S){for(var T=4194303,P=Math.min(E.length,9),g=0;g<P;g++)S.words[g]=E.words[g];if(S.length=P,E.length<=9)return E.words[0]=0,void(E.length=1);var A=E.words[9];for(S.words[S.length++]=A&T,g=10;g<E.length;g++){var x=0|E.words[g];E.words[g-10]=(x&T)<<4|A>>>22,A=x}A>>>=22,E.words[g-10]=A,A===0&&E.length>10?E.length-=10:E.length-=9},b.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var S=0,T=0;T<E.length;T++){var P=0|E.words[T];S+=977*P,E.words[T]=67108863&S,S=64*P+(S/67108864|0)}return E.words[E.length-1]===0&&(E.length--,E.words[E.length-1]===0&&E.length--),E},s(w,v),s(_,v),s(C,v),C.prototype.imulK=function(E){for(var S=0,T=0;T<E.length;T++){var P=19*(0|E.words[T])+S,g=67108863&P;P>>>=26,E.words[T]=g,S=P}return S!==0&&(E.words[E.length++]=S),E},i._prime=function(E){if(m[E])return m[E];var S;if(E==="k256")S=new b;else if(E==="p224")S=new w;else if(E==="p192")S=new _;else{if(E!=="p25519")throw Error("Unknown prime "+E);S=new C}return m[E]=S,S},I.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},I.prototype._verify2=function(E,S){n((E.negative|S.negative)==0,"red works only with positives"),n(E.red&&E.red===S.red,"red works only with red numbers")},I.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):E.umod(this.m)._forceRed(this)},I.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},I.prototype.add=function(E,S){this._verify2(E,S);var T=E.add(S);return T.cmp(this.m)>=0&&T.isub(this.m),T._forceRed(this)},I.prototype.iadd=function(E,S){this._verify2(E,S);var T=E.iadd(S);return T.cmp(this.m)>=0&&T.isub(this.m),T},I.prototype.sub=function(E,S){this._verify2(E,S);var T=E.sub(S);return T.cmpn(0)<0&&T.iadd(this.m),T._forceRed(this)},I.prototype.isub=function(E,S){this._verify2(E,S);var T=E.isub(S);return T.cmpn(0)<0&&T.iadd(this.m),T},I.prototype.shl=function(E,S){return this._verify1(E),this.imod(E.ushln(S))},I.prototype.imul=function(E,S){return this._verify2(E,S),this.imod(E.imul(S))},I.prototype.mul=function(E,S){return this._verify2(E,S),this.imod(E.mul(S))},I.prototype.isqr=function(E){return this.imul(E,E.clone())},I.prototype.sqr=function(E){return this.mul(E,E)},I.prototype.sqrt=function(E){if(E.isZero())return E.clone();var S=this.m.andln(3);if(n(S%2==1),S===3){var T=this.m.add(new i(1)).iushrn(2);return this.pow(E,T)}for(var P=this.m.subn(1),g=0;!P.isZero()&&P.andln(1)===0;)g++,P.iushrn(1);n(!P.isZero());var A=new i(1).toRed(this),x=A.redNeg(),D=this.m.subn(1).iushrn(1),O=this.m.bitLength();for(O=new i(2*O*O).toRed(this);this.pow(O,D).cmp(x)!==0;)O.redIAdd(x);for(var B=this.pow(O,P),L=this.pow(E,P.addn(1).iushrn(1)),M=this.pow(E,P),R=g;M.cmp(A)!==0;){for(var N=M,F=0;N.cmp(A)!==0;F++)N=N.redSqr();n(F<R);var z=this.pow(B,new i(1).iushln(R-F-1));L=L.redMul(z),B=z.redSqr(),M=M.redMul(B),R=F}return L},I.prototype.invm=function(E){var S=E._invmp(this.m);return S.negative!==0?(S.negative=0,this.imod(S).redNeg()):this.imod(S)},I.prototype.pow=function(E,S){if(S.isZero())return new i(1).toRed(this);if(S.cmpn(1)===0)return E.clone();var T=Array(16);T[0]=new i(1).toRed(this),T[1]=E;for(var P=2;P<T.length;P++)T[P]=this.mul(T[P-1],E);var g=T[0],A=0,x=0,D=S.bitLength()%26;for(D===0&&(D=26),P=S.length-1;P>=0;P--){for(var O=S.words[P],B=D-1;B>=0;B--){var L=O>>B&1;g!==T[0]&&(g=this.sqr(g)),L!==0||A!==0?(A<<=1,A|=L,(++x===4||P===0&&B===0)&&(g=this.mul(g,T[A]),x=0,A=0)):x=0}D=26}return g},I.prototype.convertTo=function(E){var S=E.umod(this.m);return S===E?S.clone():S},I.prototype.convertFrom=function(E){var S=E.clone();return S.red=null,S},i.mont=function(E){return new k(E)},s(k,I),k.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},k.prototype.convertFrom=function(E){var S=this.imod(E.mul(this.rinv));return S.red=null,S},k.prototype.imul=function(E,S){if(E.isZero()||S.isZero())return E.words[0]=0,E.length=1,E;var T=E.imul(S),P=T.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=T.isub(P).iushrn(this.shift),A=g;return g.cmp(this.m)>=0?A=g.isub(this.m):g.cmpn(0)<0&&(A=g.iadd(this.m)),A._forceRed(this)},k.prototype.mul=function(E,S){if(E.isZero()||S.isZero())return new i(0)._forceRed(this);var T=E.mul(S),P=T.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=T.isub(P).iushrn(this.shift),A=g;return g.cmp(this.m)>=0?A=g.isub(this.m):g.cmpn(0)<0&&(A=g.iadd(this.m)),A._forceRed(this)},k.prototype.invm=function(E){return this.imod(E._invmp(this.m).mul(this.r2))._forceRed(this)}})(e,VK)}),l0=Object.freeze({__proto__:null,default:yt,__moduleExports:yt});class x0{constructor(t){if(t===void 0)throw Error("Invalid BigInteger input");this.value=new yt(t)}clone(){const t=new x0(null);return this.value.copy(t.value),t}iinc(){return this.value.iadd(new yt(1)),this}inc(){return this.clone().iinc()}idec(){return this.value.isub(new yt(1)),this}dec(){return this.clone().idec()}iadd(t){return this.value.iadd(t.value),this}add(t){return this.clone().iadd(t)}isub(t){return this.value.isub(t.value),this}sub(t){return this.clone().isub(t)}imul(t){return this.value.imul(t.value),this}mul(t){return this.clone().imul(t)}imod(t){return this.value=this.value.umod(t.value),this}mod(t){return this.clone().imod(t)}modExp(t,r){const n=r.isEven()?yt.red(r.value):yt.mont(r.value),s=this.clone();return s.value=s.value.toRed(n).redPow(t.value).fromRed(),s}modInv(t){if(!this.gcd(t).isOne())throw Error("Inverse does not exist");return new x0(this.value.invm(t.value))}gcd(t){return new x0(this.value.gcd(t.value))}ileftShift(t){return this.value.ishln(t.value.toNumber()),this}leftShift(t){return this.clone().ileftShift(t)}irightShift(t){return this.value.ishrn(t.value.toNumber()),this}rightShift(t){return this.clone().irightShift(t)}equal(t){return this.value.eq(t.value)}lt(t){return this.value.lt(t.value)}lte(t){return this.value.lte(t.value)}gt(t){return this.value.gt(t.value)}gte(t){return this.value.gte(t.value)}isZero(){return this.value.isZero()}isOne(){return this.value.eq(new yt(1))}isNegative(){return this.value.isNeg()}isEven(){return this.value.isEven()}abs(){const t=this.clone();return t.value=t.value.abs(),t}toString(){return this.value.toString()}toNumber(){return this.value.toNumber()}getBit(t){return this.value.testn(t)?1:0}bitLength(){return this.value.bitLength()}byteLength(){return this.value.byteLength()}toUint8Array(t="be",r){return this.value.toArrayLike(Uint8Array,t,r)}}var x1,f$=Object.freeze({__proto__:null,default:x0}),ii=Ui(function(e,t){var r=t;function n(i){return i.length===1?"0"+i:i}function s(i){for(var o="",a=0;a<i.length;a++)o+=n(i[a].toString(16));return o}r.toArray=function(i,o){if(Array.isArray(i))return i.slice();if(!i)return[];var a=[];if(typeof i!="string"){for(var f=0;f<i.length;f++)a[f]=0|i[f];return a}if(o==="hex")for((i=i.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(i="0"+i),f=0;f<i.length;f+=2)a.push(parseInt(i[f]+i[f+1],16));else for(f=0;f<i.length;f++){var c=i.charCodeAt(f),l=c>>8,u=255&c;l?a.push(l,u):a.push(u)}return a},r.zero2=n,r.toHex=s,r.encode=function(i,o){return o==="hex"?s(i):i}}),Qt=Ui(function(e,t){var r=t;r.assert=Ws,r.toArray=ii.toArray,r.zero2=ii.zero2,r.toHex=ii.toHex,r.encode=ii.encode,r.getNAF=function(n,s){for(var i=[],o=1<<s+1,a=n.clone();a.cmpn(1)>=0;){var f;if(a.isOdd()){var c=a.andln(o-1);f=c>(o>>1)-1?(o>>1)-c:c,a.isubn(f)}else f=0;i.push(f);for(var l=a.cmpn(0)!==0&&a.andln(o-1)===0?s+1:1,u=1;u<l;u++)i.push(0);a.iushrn(l)}return i},r.getJSF=function(n,s){var i=[[],[]];n=n.clone(),s=s.clone();for(var o=0,a=0;n.cmpn(-o)>0||s.cmpn(-a)>0;){var f,c,l,u=n.andln(3)+o&3,p=s.andln(3)+a&3;u===3&&(u=-1),p===3&&(p=-1),(1&u)==0?f=0:f=(l=n.andln(7)+o&7)!==3&&l!==5||p!==2?u:-u,i[0].push(f),(1&p)==0?c=0:c=(l=s.andln(7)+a&7)!==3&&l!==5||u!==2?p:-p,i[1].push(c),2*o===f+1&&(o=1-o),2*a===c+1&&(a=1-a),n.iushrn(1),s.iushrn(1)}return i},r.cachedProperty=function(n,s,i){var o="_"+s;n.prototype[s]=function(){return this[o]!==void 0?this[o]:this[o]=i.call(this)}},r.parseBytes=function(n){return typeof n=="string"?r.toArray(n,"hex"):n},r.intFromLE=function(n){return new yt(n,"hex","le")}}),Kf=function(e){return x1||(x1=new Is(null)),x1.generate(e)};function Is(e){this.rand=e}var h$=Is;if(Is.prototype.generate=function(e){return this._rand(e)},Is.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},typeof self=="object")self.crypto&&self.crypto.getRandomValues?Is.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?Is.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:typeof window=="object"&&(Is.prototype._rand=function(){throw Error("Not implemented yet")});else try{var Cb=void 0;if(typeof Cb.randomBytes!="function")throw Error("Not supported");Is.prototype._rand=function(e){return Cb.randomBytes(e)}}catch{}Kf.Rand=h$;var Kl=Qt.getNAF,p$=Qt.getJSF,Fl=Qt.assert;function Ss(e,t){this.type=e,this.p=new yt(t.p,16),this.red=t.prime?yt.red(t.prime):yt.mont(this.p),this.zero=new yt(0).toRed(this.red),this.one=new yt(1).toRed(this.red),this.two=new yt(2).toRed(this.red),this.n=t.n&&new yt(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,];var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var vn=Ss;function Nn(e,t){this.curve=e,this.type=t,this.precomputed=null}Ss.prototype.point=function(){throw Error("Not implemented")},Ss.prototype.validate=function(){throw Error("Not implemented")},Ss.prototype._fixedNafMul=function(e,t){Fl(e.precomputed);var r=e._getDoubles(),n=Kl(t,1),s=(1<<r.step+1)-(r.step%2==0?2:1);s/=3;for(var i=[],o=0;o<n.length;o+=r.step){var a=0;for(t=o+r.step-1;t>=o;t--)a=(a<<1)+n[t];i.push(a)}for(var f=this.jpoint(null,null,null),c=this.jpoint(null,null,null),l=s;l>0;l--){for(o=0;o<i.length;o++)(a=i[o])===l?c=c.mixedAdd(r.points[o]):a===-l&&(c=c.mixedAdd(r.points[o].neg()));f=f.add(c)}return f.toP()},Ss.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var s=n.points,i=Kl(t,r),o=this.jpoint(null,null,null),a=i.length-1;a>=0;a--){for(t=0;a>=0&&i[a]===0;a--)t++;if(a>=0&&t++,o=o.dblp(t),a<0)break;var f=i[a];Fl(f!==0),o=e.type==="affine"?f>0?o.mixedAdd(s[f-1>>1]):o.mixedAdd(s[-f-1>>1].neg()):f>0?o.add(s[f-1>>1]):o.add(s[-f-1>>1].neg())}return e.type==="affine"?o.toP():o},Ss.prototype._wnafMulAdd=function(e,t,r,n,s){for(var i=this._wnafT1,o=this._wnafT2,a=this._wnafT3,f=0,c=0;c<n;c++){var l=(k=t[c])._getNAFPoints(e);i[c]=l.wnd,o[c]=l.points}for(c=n-1;c>=1;c-=2){var u=c-1,p=c;if(i[u]===1&&i[p]===1){var d=[t[u],null,null,t[p]];t[u].y.cmp(t[p].y)===0?(d[1]=t[u].add(t[p]),d[2]=t[u].toJ().mixedAdd(t[p].neg())):t[u].y.cmp(t[p].y.redNeg())===0?(d[1]=t[u].toJ().mixedAdd(t[p]),d[2]=t[u].add(t[p].neg())):(d[1]=t[u].toJ().mixedAdd(t[p]),d[2]=t[u].toJ().mixedAdd(t[p].neg()));var h=[-3,-1,-5,-7,0,7,5,1,3],y=p$(r[u],r[p]);f=Math.max(y[0].length,f),a[u]=Array(f),a[p]=Array(f);for(var m=0;m<f;m++){var v=0|y[0][m],b=0|y[1][m];a[u][m]=h[3*(v+1)+(b+1)],a[p][m]=0,o[u]=d}}else a[u]=Kl(r[u],i[u]),a[p]=Kl(r[p],i[p]),f=Math.max(a[u].length,f),f=Math.max(a[p].length,f)}var w=this.jpoint(null,null,null),_=this._wnafT4;for(c=f;c>=0;c--){for(var C=0;c>=0;){var I=!0;for(m=0;m<n;m++)_[m]=0|a[m][c],_[m]!==0&&(I=!1);if(!I)break;C++,c--}if(c>=0&&C++,w=w.dblp(C),c<0)break;for(m=0;m<n;m++){var k,E=_[m];E!==0&&(E>0?k=o[m][E-1>>1]:E<0&&(k=o[m][-E-1>>1].neg()),w=k.type==="affine"?w.mixedAdd(k):w.add(k))}}for(c=0;c<n;c++)o[c]=null;return s?w:w.toP()},Ss.BasePoint=Nn,Nn.prototype.eq=function(){throw Error("Not implemented")},Nn.prototype.validate=function(){return this.curve.validate(this)},Ss.prototype.decodePoint=function(e,t){e=Qt.toArray(e,t);var r=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1==2*r)return e[0]===6?Fl(e[e.length-1]%2==0):e[0]===7&&Fl(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((e[0]===2||e[0]===3)&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),e[0]===3);throw Error("Unknown point format")},Nn.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Nn.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},Nn.prototype.encode=function(e,t){return Qt.encode(this._encode(t),e)},Nn.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Nn.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},Nn.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,s=0;s<t;s+=e){for(var i=0;i<e;i++)n=n.dbl();r.push(n)}return{step:e,points:r}},Nn.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=r===1?null:this.dbl(),s=1;s<r;s++)t[s]=t[s-1].add(n);return{wnd:e,points:t}},Nn.prototype._getBeta=function(){return null},Nn.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var y$=Qt.assert;function Kn(e){vn.call(this,"short",e),this.a=new yt(e.a,16).toRed(this.red),this.b=new yt(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(e),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}Ls(Kn,vn);var g$=Kn;function Ir(e,t,r,n){vn.BasePoint.call(this,e,"affine"),t===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new yt(t,16),this.y=new yt(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function jr(e,t,r,n){vn.BasePoint.call(this,e,"jacobian"),t===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new yt(0)):(this.x=new yt(t,16),this.y=new yt(r,16),this.z=new yt(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}function uo(e){vn.call(this,"mont",e),this.a=new yt(e.a,16).toRed(this.red),this.b=new yt(e.b,16).toRed(this.red),this.i4=new yt(4).toRed(this.red).redInvm(),this.two=new yt(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}Kn.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&this.p.modn(3)===1){var t,r;if(e.beta)t=new yt(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new yt(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))===0?r=s[0]:(r=s[1],y$(this.g.mul(r).x.cmp(this.g.x.redMul(t))===0))}return{beta:t,lambda:r,basis:e.basis?e.basis.map(function(i){return{a:new yt(i.a,16),b:new yt(i.b,16)}}):this._getEndoBasis(r)}}},Kn.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:yt.mont(e),r=new yt(2).toRed(t).redInvm(),n=r.redNeg(),s=new yt(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(s).fromRed(),n.redSub(s).fromRed()]},Kn.prototype._getEndoBasis=function(e){for(var t,r,n,s,i,o,a,f,c,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),u=e,p=this.n.clone(),d=new yt(1),h=new yt(0),y=new yt(0),m=new yt(1),v=0;u.cmpn(0)!==0;){var b=p.div(u);f=p.sub(b.mul(u)),c=y.sub(b.mul(d));var w=m.sub(b.mul(h));if(!n&&f.cmp(l)<0)t=a.neg(),r=d,n=f.neg(),s=c;else if(n&&++v==2)break;a=f,p=u,u=f,y=d,d=c,m=h,h=w}i=f.neg(),o=c;var _=n.sqr().add(s.sqr());return i.sqr().add(o.sqr()).cmp(_)>=0&&(i=t,o=r),n.negative&&(n=n.neg(),s=s.neg()),i.negative&&(i=i.neg(),o=o.neg()),[{a:n,b:s},{a:i,b:o}]},Kn.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],s=n.b.mul(e).divRound(this.n),i=r.b.neg().mul(e).divRound(this.n),o=s.mul(r.a),a=i.mul(n.a),f=s.mul(r.b),c=i.mul(n.b);return{k1:e.sub(o).sub(a),k2:f.add(c).neg()}},Kn.prototype.pointFromX=function(e,t){(e=new yt(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(n.redSqr().redSub(r).cmp(this.zero)!==0)throw Error("invalid point");var s=n.fromRed().isOdd();return(t&&!s||!t&&s)&&(n=n.redNeg()),this.point(e,n)},Kn.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return r.redSqr().redISub(s).cmpn(0)===0},Kn.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,s=this._endoWnafT2,i=0;i<e.length;i++){var o=this._endoSplit(t[i]),a=e[i],f=a._getBeta();o.k1.negative&&(o.k1.ineg(),a=a.neg(!0)),o.k2.negative&&(o.k2.ineg(),f=f.neg(!0)),n[2*i]=a,n[2*i+1]=f,s[2*i]=o.k1,s[2*i+1]=o.k2}for(var c=this._wnafMulAdd(1,n,s,2*i,r),l=0;l<2*i;l++)n[l]=null,s[l]=null;return c},Ls(Ir,vn.BasePoint),Kn.prototype.point=function(e,t,r){return new Ir(this,e,t,r)},Kn.prototype.pointFromJSON=function(e,t){return Ir.fromJSON(this,e,t)},Ir.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(s){return r.point(s.x.redMul(r.endo.beta),s.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Ir.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]},Ir.fromJSON=function(e,t,r){typeof t=="string"&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function s(o){return e.point(o[0],o[1],r)}var i=t[2];return n.precomputed={beta:null,doubles:i.doubles&&{step:i.doubles.step,points:[n].concat(i.doubles.points.map(s))},naf:i.naf&&{wnd:i.naf.wnd,points:[n].concat(i.naf.points.map(s))}},n},Ir.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)+">"},Ir.prototype.isInfinity=function(){return this.inf},Ir.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Ir.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),s=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),i=s.redSqr().redISub(this.x.redAdd(this.x)),o=s.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,o)},Ir.prototype.getX=function(){return this.x.fromRed()},Ir.prototype.getY=function(){return this.y.fromRed()},Ir.prototype.mul=function(e){return e=new yt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Ir.prototype.mulAdd=function(e,t,r){var n=[this,t],s=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},Ir.prototype.jmulAdd=function(e,t,r){var n=[this,t],s=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},Ir.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Ir.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(s){return s.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},Ir.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Ls(jr,vn.BasePoint),Kn.prototype.jpoint=function(e,t,r){return new jr(this,e,t,r)},jr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},jr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},jr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),s=e.x.redMul(r),i=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),a=n.redSub(s),f=i.redSub(o);if(a.cmpn(0)===0)return f.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),l=c.redMul(a),u=n.redMul(c),p=f.redSqr().redIAdd(l).redISub(u).redISub(u),d=f.redMul(u.redISub(p)).redISub(i.redMul(l)),h=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(p,d,h)},jr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),s=this.y,i=e.y.redMul(t).redMul(this.z),o=r.redSub(n),a=s.redSub(i);if(o.cmpn(0)===0)return a.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=o.redSqr(),c=f.redMul(o),l=r.redMul(f),u=a.redSqr().redIAdd(c).redISub(l).redISub(l),p=a.redMul(l.redISub(u)).redISub(s.redMul(c)),d=this.z.redMul(o);return this.curve.jpoint(u,p,d)},jr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}var n=this.curve.a,s=this.curve.tinv,i=this.x,o=this.y,a=this.z,f=a.redSqr().redSqr(),c=o.redAdd(o);for(r=0;r<e;r++){var l=i.redSqr(),u=c.redSqr(),p=u.redSqr(),d=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(f)),h=i.redMul(u),y=d.redSqr().redISub(h.redAdd(h)),m=h.redISub(y),v=d.redMul(m);v=v.redIAdd(v).redISub(p);var b=c.redMul(a);r+1<e&&(f=f.redMul(p)),i=y,a=b,c=v}return this.curve.jpoint(i,c.redMul(s),a)},jr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},jr.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),i=s.redSqr(),o=this.x.redAdd(s).redSqr().redISub(n).redISub(i);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n),f=a.redSqr().redISub(o).redISub(o),c=i.redIAdd(i);c=(c=c.redIAdd(c)).redIAdd(c),e=f,t=a.redMul(o.redISub(f)).redISub(c),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),u=this.y.redSqr(),p=u.redSqr(),d=this.x.redAdd(u).redSqr().redISub(l).redISub(p);d=d.redIAdd(d);var h=l.redAdd(l).redIAdd(l),y=h.redSqr(),m=p.redIAdd(p);m=(m=m.redIAdd(m)).redIAdd(m),e=y.redISub(d).redISub(d),t=h.redMul(d.redISub(e)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},jr.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),i=s.redSqr(),o=this.x.redAdd(s).redSqr().redISub(n).redISub(i);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),f=a.redSqr().redISub(o).redISub(o);e=f;var c=i.redIAdd(i);c=(c=c.redIAdd(c)).redIAdd(c),t=a.redMul(o.redISub(f)).redISub(c),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),u=this.y.redSqr(),p=this.x.redMul(u),d=this.x.redSub(l).redMul(this.x.redAdd(l));d=d.redAdd(d).redIAdd(d);var h=p.redIAdd(p),y=(h=h.redIAdd(h)).redAdd(h);e=d.redSqr().redISub(y),r=this.y.redAdd(this.z).redSqr().redISub(u).redISub(l);var m=u.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),t=d.redMul(h.redISub(e)).redISub(m)}return this.curve.jpoint(e,t,r)},jr.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,s=n.redSqr().redSqr(),i=t.redSqr(),o=r.redSqr(),a=i.redAdd(i).redIAdd(i).redIAdd(e.redMul(s)),f=t.redAdd(t),c=(f=f.redIAdd(f)).redMul(o),l=a.redSqr().redISub(c.redAdd(c)),u=c.redISub(l),p=o.redSqr();p=(p=(p=p.redIAdd(p)).redIAdd(p)).redIAdd(p);var d=a.redMul(u).redISub(p),h=r.redAdd(r).redMul(n);return this.curve.jpoint(l,d,h)},jr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),s=e.redAdd(e).redIAdd(e),i=s.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(n),a=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(i)).redSqr(),f=n.redIAdd(n);f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var c=s.redIAdd(o).redSqr().redISub(i).redISub(a).redISub(f),l=t.redMul(c);l=(l=l.redIAdd(l)).redIAdd(l);var u=this.x.redMul(a).redISub(l);u=(u=u.redIAdd(u)).redIAdd(u);var p=this.y.redMul(c.redMul(f.redISub(c)).redISub(o.redMul(a)));p=(p=(p=p.redIAdd(p)).redIAdd(p)).redIAdd(p);var d=this.z.redAdd(o).redSqr().redISub(r).redISub(a);return this.curve.jpoint(u,p,d)},jr.prototype.mul=function(e,t){return e=new yt(e,t),this.curve._wnafMul(this,e)},jr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var n=t.redMul(this.z),s=r.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},jr.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(s),this.x.cmp(r)===0)return!0}},jr.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)+">"},jr.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Ls(uo,vn);var m$=uo;function kr(e,t,r){vn.BasePoint.call(this,e,"projective"),t===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new yt(t,16),this.z=new yt(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}uo.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return n.redSqrt().redSqr().cmp(n)===0},Ls(kr,vn.BasePoint),uo.prototype.decodePoint=function(e,t){if((e=Qt.toArray(e,t)).length===33&&e[0]===64&&(e=e.slice(1,33).reverse()),e.length!==32)throw Error("Unknown point compression format");return this.point(e,1)},uo.prototype.point=function(e,t){return new kr(this,e,t)},uo.prototype.pointFromJSON=function(e){return kr.fromJSON(this,e)},kr.prototype.precompute=function(){},kr.prototype._encode=function(e){var t=this.curve.p.byteLength();return e?[64].concat(this.getX().toArray("le",t)):this.getX().toArray("be",t)},kr.fromJSON=function(e,t){return new kr(e,t[0],t[1]||e.one)},kr.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)+">"},kr.prototype.isInfinity=function(){return this.z.cmpn(0)===0},kr.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),s=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,s)},kr.prototype.add=function(){throw Error("Not supported on Montgomery curve")},kr.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),s=e.x.redAdd(e.z),i=e.x.redSub(e.z).redMul(r),o=s.redMul(n),a=t.z.redMul(i.redAdd(o).redSqr()),f=t.x.redMul(i.redISub(o).redSqr());return this.curve.point(a,f)},kr.prototype.mul=function(e){for(var t=(e=new yt(e,16)).clone(),r=this,n=this.curve.point(null,null),s=[];t.cmpn(0)!==0;t.iushrn(1))s.push(t.andln(1));for(var i=s.length-1;i>=0;i--)s[i]===0?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},kr.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},kr.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},kr.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},kr.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},kr.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var v$=Qt.assert;function yi(e){this.twisted=(0|e.a)!=1,this.mOneA=this.twisted&&(0|e.a)==-1,this.extended=this.mOneA,vn.call(this,"edwards",e),this.a=new yt(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new yt(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new yt(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),v$(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(0|e.c)==1}Ls(yi,vn);var b$=yi;function ar(e,t,r,n,s){vn.BasePoint.call(this,e,"projective"),t===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new yt(t,16),this.y=new yt(r,16),this.z=n?new yt(n,16):this.curve.one,this.t=s&&new yt(s,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}yi.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},yi.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},yi.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},yi.prototype.pointFromX=function(e,t){(e=new yt(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),s=this.one.redSub(this.c2.redMul(this.d).redMul(r)),i=n.redMul(s.redInvm()),o=i.redSqrt();if(o.redSqr().redSub(i).cmp(this.zero)!==0)throw Error("invalid point");var a=o.fromRed().isOdd();return(t&&!a||!t&&a)&&(o=o.redNeg()),this.point(e,o)},yi.prototype.pointFromY=function(e,t){(e=new yt(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),s=r.redMul(this.d).redMul(this.c2).redSub(this.a),i=n.redMul(s.redInvm());if(i.cmp(this.zero)===0){if(t)throw Error("invalid point");return this.point(this.zero,e)}var o=i.redSqrt();if(o.redSqr().redSub(i).cmp(this.zero)!==0)throw Error("invalid point");return o.fromRed().isOdd()!==t&&(o=o.redNeg()),this.point(o,e)},yi.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),s=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return n.cmp(s)===0},Ls(ar,vn.BasePoint),yi.prototype.pointFromJSON=function(e){return ar.fromJSON(this,e)},yi.prototype.point=function(e,t,r,n){return new ar(this,e,t,r,n)},ar.fromJSON=function(e,t){return new ar(e,t[0],t[1],t[2])},ar.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)+">"},ar.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},ar.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),i=n.redAdd(t),o=i.redSub(r),a=n.redSub(t),f=s.redMul(o),c=i.redMul(a),l=s.redMul(a),u=o.redMul(i);return this.curve.point(f,c,u,l)},ar.prototype._projDbl=function(){var e,t,r,n=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),i=this.y.redSqr();if(this.curve.twisted){var o=(c=this.curve._mulA(s)).redAdd(i);if(this.zOne)e=n.redSub(s).redSub(i).redMul(o.redSub(this.curve.two)),t=o.redMul(c.redSub(i)),r=o.redSqr().redSub(o).redSub(o);else{var a=this.z.redSqr(),f=o.redSub(a).redISub(a);e=n.redSub(s).redISub(i).redMul(f),t=o.redMul(c.redSub(i)),r=o.redMul(f)}}else{var c=s.redAdd(i);a=this.curve._mulC(this.z).redSqr(),f=c.redSub(a).redSub(a),e=this.curve._mulC(n.redISub(c)).redMul(f),t=this.curve._mulC(c).redMul(s.redISub(i)),r=c.redMul(f)}return this.curve.point(e,t,r)},ar.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},ar.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),i=r.redSub(t),o=s.redSub(n),a=s.redAdd(n),f=r.redAdd(t),c=i.redMul(o),l=a.redMul(f),u=i.redMul(f),p=o.redMul(a);return this.curve.point(c,l,p,u)},ar.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),s=n.redSqr(),i=this.x.redMul(e.x),o=this.y.redMul(e.y),a=this.curve.d.redMul(i).redMul(o),f=s.redSub(a),c=s.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(o),u=n.redMul(f).redMul(l);return this.curve.twisted?(t=n.redMul(c).redMul(o.redSub(this.curve._mulA(i))),r=f.redMul(c)):(t=n.redMul(c).redMul(o.redSub(i)),r=this.curve._mulC(f).redMul(c)),this.curve.point(u,t,r)},ar.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},ar.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},ar.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},ar.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},ar.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},ar.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},ar.prototype.getX=function(){return this.normalize(),this.x.fromRed()},ar.prototype.getY=function(){return this.normalize(),this.y.fromRed()},ar.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},ar.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),this.x.cmp(t)===0)return!0}},ar.prototype.toP=ar.prototype.normalize,ar.prototype.mixedAdd=ar.prototype.add;var Ed=Ui(function(e,t){var r=t;r.base=vn,r.short=g$,r.mont=m$,r.edwards=b$}),T1=Mt.rotl32,Zo=Mt.sum32,_$=Mt.sum32_5,w$=qa.ft_1,FE=W0.BlockHash,E$=[1518500249,1859775393,2400959708,3395469782];function _i(){if(!(this instanceof _i))return new _i;FE.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}Mt.inherits(_i,FE);var A$=_i;_i.blockSize=512,_i.outSize=160,_i.hmacStrength=80,_i.padLength=64,_i.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=T1(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var s=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],f=this.h[4];for(n=0;n<r.length;n++){var c=~~(n/20),l=_$(T1(s,5),w$(c,i,o,a),f,r[n],E$[c]);f=a,a=o,o=T1(i,30),i=s,s=l}this.h[0]=Zo(this.h[0],s),this.h[1]=Zo(this.h[1],i),this.h[2]=Zo(this.h[2],o),this.h[3]=Zo(this.h[3],a),this.h[4]=Zo(this.h[4],f)},_i.prototype._digest=function(e){return e==="hex"?Mt.toHex32(this.h,"big"):Mt.split32(this.h,"big")};var S$={sha1:A$,sha224:H9,sha256:cg,sha384:W9,sha512:Po};function vo(e,t,r){if(!(this instanceof vo))return new vo(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(Mt.toArray(t,r))}var P$=vo;vo.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),Ws(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},vo.prototype.update=function(e,t){return this.inner.update(e,t),this},vo.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)};var kn=Ui(function(e,t){var r=t;r.utils=Mt,r.common=W0,r.sha=S$,r.ripemd=DF,r.hmac=P$,r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160}),x$={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"]]}},T0=Ui(function(e,t){var r,n=t,s=Qt.assert;function i(a){if(a.type==="short")this.curve=new Ed.short(a);else if(a.type==="edwards")this.curve=new Ed.edwards(a);else{if(a.type!=="mont")throw Error("Unknown curve type.");this.curve=new Ed.mont(a)}this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, n*G != O")}function o(a,f){Object.defineProperty(n,a,{configurable:!0,enumerable:!0,get:function(){var c=new i(f);return Object.defineProperty(n,a,{configurable:!0,enumerable:!0,value:c}),c}})}n.PresetCurve=i,o("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:kn.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("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:kn.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("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:kn.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("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:kn.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"]}),o("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:kn.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"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",cofactor:"8",hash:kn.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",cofactor:"8",hash:kn.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]}),o("brainpoolP256r1",{type:"short",prime:null,p:"A9FB57DB A1EEA9BC 3E660A90 9D838D72 6E3BF623 D5262028 2013481D 1F6E5377",a:"7D5A0975 FC2C3057 EEF67530 417AFFE7 FB8055C1 26DC5C6C E94A4B44 F330B5D9",b:"26DC5C6C E94A4B44 F330B5D9 BBD77CBF 95841629 5CF7E1CE 6BCCDC18 FF8C07B6",n:"A9FB57DB A1EEA9BC 3E660A90 9D838D71 8C397AA3 B561A6F7 901E0E82 974856A7",hash:kn.sha256,gRed:!1,g:["8BD2AEB9CB7E57CB2C4B482FFC81B7AFB9DE27E1E3BD23C23A4453BD9ACE3262","547EF835C3DAC4FD97F8461A14611DC9C27745132DED8E545C1D54C72F046997"]}),o("brainpoolP384r1",{type:"short",prime:null,p:"8CB91E82 A3386D28 0F5D6F7E 50E641DF 152F7109 ED5456B4 12B1DA19 7FB71123ACD3A729 901D1A71 87470013 3107EC53",a:"7BC382C6 3D8C150C 3C72080A CE05AFA0 C2BEA28E 4FB22787 139165EF BA91F90F8AA5814A 503AD4EB 04A8C7DD 22CE2826",b:"04A8C7DD 22CE2826 8B39B554 16F0447C 2FB77DE1 07DCD2A6 2E880EA5 3EEB62D57CB43902 95DBC994 3AB78696 FA504C11",n:"8CB91E82 A3386D28 0F5D6F7E 50E641DF 152F7109 ED5456B3 1F166E6C AC0425A7CF3AB6AF 6B7FC310 3B883202 E9046565",hash:kn.sha384,gRed:!1,g:["1D1C64F068CF45FFA2A63A81B7C13F6B8847A3E77EF14FE3DB7FCAFE0CBD10E8E826E03436D646AAEF87B2E247D4AF1E","8ABE1D7520F9C2A45CB1EB8E95CFD55262B70B29FEEC5864E19C054FF99129280E4646217791811142820341263C5315"]}),o("brainpoolP512r1",{type:"short",prime:null,p:"AADD9DB8 DBE9C48B 3FD4E6AE 33C9FC07 CB308DB3 B3C9D20E D6639CCA 703308717D4D9B00 9BC66842 AECDA12A E6A380E6 2881FF2F 2D82C685 28AA6056 583A48F3",a:"7830A331 8B603B89 E2327145 AC234CC5 94CBDD8D 3DF91610 A83441CA EA9863BC2DED5D5A A8253AA1 0A2EF1C9 8B9AC8B5 7F1117A7 2BF2C7B9 E7C1AC4D 77FC94CA",b:"3DF91610 A83441CA EA9863BC 2DED5D5A A8253AA1 0A2EF1C9 8B9AC8B5 7F1117A72BF2C7B9 E7C1AC4D 77FC94CA DC083E67 984050B7 5EBAE5DD 2809BD63 8016F723",n:"AADD9DB8 DBE9C48B 3FD4E6AE 33C9FC07 CB308DB3 B3C9D20E D6639CCA 70330870553E5C41 4CA92619 41866119 7FAC1047 1DB1D381 085DDADD B5879682 9CA90069",hash:kn.sha512,gRed:!1,g:["81AEE4BDD82ED9645A21322E9C4C6A9385ED9F70B5D916C1B43B62EEF4D0098EFF3B1F78E2D0D48D50D1687B93B97D5F7C6D5047406A5E688B352209BCB9F822","7DDE385D566332ECC0EABFA9CF7822FDF209F70024A57B1AA000C55B881F8111B2DCDE494A5F485E5BCA4BD88A2763AED1CA2B2FA8F0540678CD1E0F3AD80892"]});try{r=x$}catch{r=void 0}o("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:kn.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})});function Ds(e){if(!(this instanceof Ds))return new Ds(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=ii.toArray(e.entropy,e.entropyEnc||"hex"),r=ii.toArray(e.nonce,e.nonceEnc||"hex"),n=ii.toArray(e.pers,e.persEnc||"hex");Ws(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var Ny=Ds;Ds.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},Ds.prototype._hmac=function(){return new kn.hmac(this.hash,this.K)},Ds.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},Ds.prototype.reseed=function(e,t,r,n){typeof t!="string"&&(n=r,r=t,t=null),e=ii.toArray(e,t),r=ii.toArray(r,n),Ws(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},Ds.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");typeof t!="string"&&(n=r,r=t,t=null),r&&(r=ii.toArray(r,n||"hex"),this._update(r));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var i=s.slice(0,e);return this._update(r),this._reseed++,ii.encode(i,t)};var Ib=Qt.assert;function sn(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var C1=sn;sn.fromPublic=function(e,t,r){return t instanceof sn?t:new sn(e,{pub:t,pubEnc:r})},sn.fromPrivate=function(e,t,r){return t instanceof sn?t:new sn(e,{priv:t,privEnc:r})},sn.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.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"}},sn.prototype.getPublic=function(e,t){return this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},sn.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},sn.prototype._importPrivate=function(e,t){if(this.priv=new yt(e,t||16),this.ec.curve.type==="mont"){var r=this.ec.curve.one,n=r.ushln(252).sub(r).ushln(3);this.priv=this.priv.or(r.ushln(254)),this.priv=this.priv.and(n)}else this.priv=this.priv.umod(this.ec.curve.n)},sn.prototype._importPublic=function(e,t){if(e.x||e.y)return this.ec.curve.type==="mont"?Ib(e.x,"Need x coordinate"):this.ec.curve.type!=="short"&&this.ec.curve.type!=="edwards"||Ib(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},sn.prototype.derive=function(e){return e.mul(this.priv).getX()},sn.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},sn.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},sn.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var T$=Qt.assert;function pf(e,t){if(e instanceof pf)return e;this._importDER(e,t)||(T$(e.r&&e.s,"Signature without r or s"),this.r=new yt(e.r,16),this.s=new yt(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var ql=pf;function C$(){this.place=0}function I1(e,t){var r=e[t.place++];if(!(128&r))return r;for(var n=15&r,s=0,i=0,o=t.place;i<n;i++,o++)s<<=8,s|=e[o];return t.place=o,s}function kb(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return t===0?e:e.slice(t)}function k1(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}pf.prototype._importDER=function(e,t){e=Qt.toArray(e,t);var r=new C$;if(e[r.place++]!==48||I1(e,r)+r.place!==e.length||e[r.place++]!==2)return!1;var n=I1(e,r),s=e.slice(r.place,n+r.place);if(r.place+=n,e[r.place++]!==2)return!1;var i=I1(e,r);if(e.length!==i+r.place)return!1;var o=e.slice(r.place,i+r.place);return s[0]===0&&128&s[1]&&(s=s.slice(1)),o[0]===0&&128&o[1]&&(o=o.slice(1)),this.r=new yt(s),this.s=new yt(o),this.recoveryParam=null,!0},pf.prototype.toDER=function(e){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=kb(t),r=kb(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];k1(n,t.length),(n=n.concat(t)).push(2),k1(n,r.length);var s=n.concat(r),i=[48];return k1(i,s.length),i=i.concat(s),Qt.encode(i,e)};var qE=Qt.assert;function wn(e){if(!(this instanceof wn))return new wn(e);typeof e=="string"&&(qE(T0.hasOwnProperty(e),"Unknown curve "+e),e=T0[e]),e instanceof T0.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var I$=wn;wn.prototype.keyPair=function(e){return new C1(this,e)},wn.prototype.keyFromPrivate=function(e,t){return C1.fromPrivate(this,e,t)},wn.prototype.keyFromPublic=function(e,t){return C1.fromPublic(this,e,t)},wn.prototype.genKeyPair=function(e){e||(e={});var t=new Ny({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Kf(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()});if(this.curve.type==="mont"){var r=new yt(t.generate(32));return this.keyFromPrivate(r)}for(var n=this.n.byteLength(),s=this.n.sub(new yt(2));;)if(!((r=new yt(t.generate(n))).cmp(s)>0))return r.iaddn(1),this.keyFromPrivate(r)},wn.prototype._truncateToN=function(e,t,r){var n=(r=r||8*e.byteLength())-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},wn.prototype.truncateMsg=function(e){var t;return e instanceof Uint8Array?(t=8*e.byteLength,e=this._truncateToN(new yt(e,16),!1,t)):typeof e=="string"?(t=4*e.length,e=this._truncateToN(new yt(e,16),!1,t)):e=this._truncateToN(new yt(e,16)),e},wn.prototype.sign=function(e,t,r,n){typeof r=="object"&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this.truncateMsg(e);for(var s=this.n.byteLength(),i=t.getPrivate().toArray("be",s),o=e.toArray("be",s),a=new Ny({hash:this.hash,entropy:i,nonce:o,pers:n.pers,persEnc:n.persEnc||"utf8"}),f=this.n.sub(new yt(1)),c=0;;c++){var l=n.k?n.k(c):new yt(a.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(f)>=0)){var u=this.g.mul(l);if(!u.isInfinity()){var p=u.getX(),d=p.umod(this.n);if(d.cmpn(0)!==0){var h=l.invm(this.n).mul(d.mul(t.getPrivate()).iadd(e));if((h=h.umod(this.n)).cmpn(0)!==0){var y=(u.getY().isOdd()?1:0)|(p.cmp(d)!==0?2:0);return n.canonical&&h.cmp(this.nh)>0&&(h=this.n.sub(h),y^=1),new ql({r:d,s:h,recoveryParam:y})}}}}}},wn.prototype.verify=function(e,t,r,n){return r=this.keyFromPublic(r,n),t=new ql(t,"hex"),this._verify(this.truncateMsg(e),t,r)||this._verify(this._truncateToN(new yt(e,16)),t,r)},wn.prototype._verify=function(e,t,r){var n=t.r,s=t.s;if(n.cmpn(1)<0||n.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var i,o=s.invm(this.n),a=o.mul(e).umod(this.n),f=o.mul(n).umod(this.n);return this.curve._maxwellTrick?!(i=this.g.jmulAdd(a,r.getPublic(),f)).isInfinity()&&i.eqXToP(n):!(i=this.g.mulAdd(a,r.getPublic(),f)).isInfinity()&&i.getX().umod(this.n).cmp(n)===0},wn.prototype.recoverPubKey=function(e,t,r,n){qE((3&r)===r,"The recovery param is more than two bits"),t=new ql(t,n);var s=this.n,i=new yt(e),o=t.r,a=t.s,f=1&r,c=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw Error("Unable to find sencond key candinate");o=c?this.curve.pointFromX(o.add(this.curve.n),f):this.curve.pointFromX(o,f);var l=t.r.invm(s),u=s.sub(i).mul(l).umod(s),p=a.mul(l).umod(s);return this.g.mulAdd(u,o,p)},wn.prototype.getKeyRecoveryParam=function(e,t,r,n){if((t=new ql(t,n)).recoveryParam!==null)return t.recoveryParam;for(var s=0;s<4;s++){var i;try{i=this.recoverPubKey(e,t,s)}catch{continue}if(i.eq(r))return s}throw Error("Unable to find valid recovery factor")};var Rb=Qt.assert,Db=Qt.parseBytes,Za=Qt.cachedProperty;function Br(e,t){if(this.eddsa=e,t.hasOwnProperty("secret")&&(this._secret=Db(t.secret)),e.isPoint(t.pub))this._pub=t.pub;else if(this._pubBytes=Db(t.pub),this._pubBytes&&this._pubBytes.length===33&&this._pubBytes[0]===64&&(this._pubBytes=this._pubBytes.slice(1,33)),this._pubBytes&&this._pubBytes.length!==32)throw Error("Unknown point compression format")}Br.fromPublic=function(e,t){return t instanceof Br?t:new Br(e,{pub:t})},Br.fromSecret=function(e,t){return t instanceof Br?t:new Br(e,{secret:t})},Br.prototype.secret=function(){return this._secret},Za(Br,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),Za(Br,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),Za(Br,"privBytes",function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n}),Za(Br,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),Za(Br,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),Za(Br,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Br.prototype.sign=function(e){return Rb(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Br.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},Br.prototype.getSecret=function(e){return Rb(this._secret,"KeyPair is public only"),Qt.encode(this.secret(),e)},Br.prototype.getPublic=function(e,t){return Qt.encode((t?[64]:[]).concat(this.pubBytes()),e)};var R1=Br,k$=Qt.assert,jl=Qt.cachedProperty,R$=Qt.parseBytes;function ya(e,t){this.eddsa=e,typeof t!="object"&&(t=R$(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),k$(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof yt&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}jl(ya,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),jl(ya,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),jl(ya,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),jl(ya,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),ya.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},ya.prototype.toHex=function(){return Qt.encode(this.toBytes(),"hex").toUpperCase()};var Bb=ya,D$=Qt.assert,Ob=Qt.parseBytes;function on(e){if(D$(e==="ed25519","only tested with ed25519 so far"),!(this instanceof on))return new on(e);e=T0[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=kn.sha512}var B$=on;on.prototype.sign=function(e,t){e=Ob(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),s=this.g.mul(n),i=this.encodePoint(s),o=this.hashInt(i,r.pubBytes(),e).mul(r.priv()),a=n.add(o).umod(this.curve.n);return this.makeSignature({R:s,S:a,Rencoded:i})},on.prototype.verify=function(e,t,r){e=Ob(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),s=this.hashInt(t.Rencoded(),n.pubBytes(),e),i=this.g.mul(t.S());return t.R().add(n.pub().mul(s)).eq(i)},on.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return Qt.intFromLE(e.digest()).umod(this.curve.n)},on.prototype.keyPair=function(e){return new R1(this,e)},on.prototype.keyFromPublic=function(e){return R1.fromPublic(this,e)},on.prototype.keyFromSecret=function(e){return R1.fromSecret(this,e)},on.prototype.genKeyPair=function(e){e||(e={});var t=new Ny({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Kf(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.curve.n.toArray()});return this.keyFromSecret(t.generate(32))},on.prototype.makeSignature=function(e){return e instanceof Bb?e:new Bb(this,e)},on.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},on.prototype.decodePoint=function(e){var t=(e=Qt.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),n=(128&e[t])!=0,s=Qt.intFromLE(r);return this.curve.pointFromY(s,n)},on.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},on.prototype.decodeInt=function(e){return Qt.intFromLE(e)},on.prototype.isPoint=function(e){return e instanceof this.pointClass};var Mb=Ui(function(e,t){var r=t;r.utils=Qt,r.rand=Kf,r.curve=Ed,r.curves=T0,r.ec=I$,r.eddsa=B$}),O$=Object.freeze({__proto__:null,default:Mb,__moduleExports:Mb});const M$=Object.freeze(Object.defineProperty({__proto__:null,AEADEncryptedDataPacket:X0,CleartextMessage:Bi,CompressedDataPacket:Io,LiteralDataPacket:us,MarkerPacket:sj,Message:cn,OnePassSignaturePacket:jn,PacketList:Vt,PrivateKey:ja,PublicKey:Yd,PublicKeyEncryptedSessionKeyPacket:zd,PublicKeyPacket:ni,PublicSubkeyPacket:Q0,SecretKeyPacket:kf,SecretSubkeyPacket:bg,Signature:Fs,SignaturePacket:Kr,Subkey:Na,SymEncryptedIntegrityProtectedDataPacket:vg,SymEncryptedSessionKeyPacket:Ma,SymmetricallyEncryptedDataPacket:Nw,TrustPacket:oj,UnparseablePacket:Md,UserAttributePacket:If,UserIDPacket:el,armor:Fa,config:Qe,createCleartextMessage:Aj,createMessage:_j,decrypt:kj,decryptKey:Tj,decryptSessionKeys:Mj,encrypt:Ij,encryptKey:Cj,encryptSessionKey:Oj,enums:G,generateKey:Sj,generateSessionKey:Bj,readCleartextMessage:Ej,readKey:fj,readKeys:pj,readMessage:bj,readPrivateKey:hj,readPrivateKeys:yj,readSignature:uj,reformatKey:Pj,revokeKey:xj,sign:Rj,unarmor:Ni,verify:Dj},Symbol.toStringTag,{value:"Module"})),N$=gf(M$);var Nb;function Ff(){if(Nb)return dn;Nb=1,Object.defineProperty(dn,"__esModule",{value:!0}),dn.pgpDecrypt=dn.verifySignature=dn.sign=dn.pgpEncrypt=dn.generateKeyPair=dn.PGPHelper=void 0;const e=He,t=N$,r={generateKeyPair(){return e.__awaiter(this,void 0,void 0,function*(){const f=yield t.generateKey({type:"rsa",rsaBits:2048,userIDs:[{name:"",email:""}]});return{privateKeyArmored:f.privateKey,publicKeyArmored:f.publicKey}})},sign({message:f,signingKey:c}){return e.__awaiter(this,void 0,void 0,function*(){const l=yield t.createMessage({text:f}),u=yield t.readPrivateKey({armoredKey:c});return yield t.sign({message:l,signingKeys:u,detached:!0})})},pgpEncrypt({plainText:f,keys:c}){return e.__awaiter(this,void 0,void 0,function*(){const l=[];for(let d=0;d<c.length;d++)l.push(yield t.readKey({armoredKey:c[d]}));const u=yield t.createMessage({text:f});return yield t.encrypt({message:u,encryptionKeys:l})})},pgpDecrypt({cipherText:f,toPrivateKeyArmored:c}){return e.__awaiter(this,void 0,void 0,function*(){const l=yield t.readMessage({armoredMessage:f}),u=yield t.readPrivateKey({armoredKey:c}),{data:p}=yield t.decrypt({message:l,decryptionKeys:u});return p})},verifySignature({messageContent:f,signatureArmored:c,publicKeyArmored:l}){return e.__awaiter(this,void 0,void 0,function*(){const u=yield t.createMessage({text:f}),p=yield t.readSignature({armoredSignature:c}),d=yield t.readKey({armoredKey:l}),h=yield t.verify({date:new Date(Date.now()+1e3*60*60*24),message:u,signature:p,verificationKeys:d}),{verified:y}=h.signatures[0];try{yield y}catch(m){throw new Error("Signature could not be verified: "+m)}})}};dn.PGPHelper=r;const n=()=>e.__awaiter(void 0,void 0,void 0,function*(){const f=yield t.generateKey({type:"rsa",rsaBits:2048,userIDs:[{name:"",email:""}]});return{privateKeyArmored:f.privateKey,publicKeyArmored:f.publicKey}});dn.generateKeyPair=n;const s=({plainText:f,keys:c})=>e.__awaiter(void 0,void 0,void 0,function*(){const l=[];for(let d=0;d<c.length;d++)l.push(yield t.readKey({armoredKey:c[d]}));const u=yield t.createMessage({text:f});return yield t.encrypt({message:u,encryptionKeys:l})});dn.pgpEncrypt=s;const i=({message:f,signingKey:c})=>e.__awaiter(void 0,void 0,void 0,function*(){const l=yield t.createMessage({text:f}),u=yield t.readPrivateKey({armoredKey:c});return yield t.sign({message:l,signingKeys:u,detached:!0})});dn.sign=i;const o=({messageContent:f,signatureArmored:c,publicKeyArmored:l})=>e.__awaiter(void 0,void 0,void 0,function*(){const u=yield t.createMessage({text:f}),p=yield t.readSignature({armoredSignature:c}),d=yield t.readKey({armoredKey:l}),h=yield t.verify({message:u,signature:p,verificationKeys:d}),{verified:y}=h.signatures[0];try{yield y}catch(m){throw new Error("Signature could not be verified: "+m)}});dn.verifySignature=o;const a=({cipherText:f,toPrivateKeyArmored:c})=>e.__awaiter(void 0,void 0,void 0,function*(){const l=yield t.readMessage({armoredMessage:f}),u=yield t.readPrivateKey({armoredKey:c}),{data:p}=yield t.decrypt({message:l,decryptionKeys:u});return p});return dn.pgpDecrypt=a,dn}var D1={},sa={},Ub;function jE(){if(Ub)return sa;Ub=1,Object.defineProperty(sa,"__esModule",{value:!0}),sa.getAccountAddress=sa.getWallet=void 0;const e=He,t=nt(),r=s=>{const{account:i,signer:o}=s||{};return{account:i&&(0,t.pCAIP10ToWallet)(i),signer:o}};sa.getWallet=r;const n=s=>e.__awaiter(void 0,void 0,void 0,function*(){const{account:i,signer:o}=s||{},a=new t.Signer(o);return i||(yield a.getAddress())||""});return sa.getAccountAddress=n,sa}var Lb;function U$(){return Lb||(Lb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getConnectedUserV2Core=e.getConnectedUserV2=void 0;const t=He,r=Ze(),n=Mn(),s=jE(),i=Dt(),o=(f,c,l)=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.getConnectedUserV2Core)(f,c,l,i.PGPHelper)});e.getConnectedUserV2=o;const a=(f,c,l,u)=>t.__awaiter(void 0,void 0,void 0,function*(){const p=yield(0,s.getAccountAddress)(f),d=yield(0,n.get)({account:p,env:l||r.default.ENV.PROD});if(d!=null&&d.encryptedPrivateKey){if(c)return Object.assign(Object.assign({},d),{privateKey:c});{console.warn("Please note that if you don't pass the pgpPrivateKey parameter, a wallet popup will appear every time the approveRequest endpoint is called. We strongly recommend passing this parameter, and it will become mandatory in future versions of the API.");const h=yield(0,i.getDecryptedPrivateKey)(f,d,p,l);return Object.assign(Object.assign({},d),{privateKey:h})}}else{const h={};f.account&&(h.account=f.account),d&&d.did&&(h.account=d.did),f.signer&&(h.signer=f.signer),h.env=l;const y=yield(0,n.createUserCore)(h,u),m=yield(0,i.getDecryptedPrivateKey)(f,y,p,l);return Object.assign(Object.assign({},y),{privateKey:m})}});e.getConnectedUserV2Core=a}(D1)),D1}var B1={},zn={},Jo={},Kb;function qf(){if(Kb)return Jo;Kb=1,Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.populateDeprecatedUser=void 0;const e=t=>{if(!t)return t;t.name=t.profile.name,t.about=t.profile.desc,t.profilePicture=t.profile.picture,t.numMsg=t.msgSent,t.allowedNumMsg=t.maxMsgPersisted;let r="",n="",s="";try{const{version:i}=JSON.parse(t.encryptedPrivateKey);r=i}catch{}t.encryptionType=r;try{n=t.verificationProof.split(":")[0],s=t.verificationProof.split(":")[1]}catch{}return t.signature=s,t.sigType=n,t.encryptedPassword=null,t.nftOwner=null,t.linkedListHash=null,t.nfts=null,t};return Jo.populateDeprecatedUser=e,Jo}var Wn={},$l={exports:{}},O1,Fb;function $E(){return Fb||(Fb=1,O1=function(t,r){return function(){for(var s=new Array(arguments.length),i=0;i<s.length;i++)s[i]=arguments[i];return t.apply(r,s)}}),O1}var M1,qb;function Zr(){if(qb)return M1;qb=1;var e=$E(),t=Object.prototype.toString,r=function(O){return function(B){var L=t.call(B);return O[L]||(O[L]=L.slice(8,-1).toLowerCase())}}(Object.create(null));function n(O){return O=O.toLowerCase(),function(L){return r(L)===O}}function s(O){return Array.isArray(O)}function i(O){return typeof O>"u"}function o(O){return O!==null&&!i(O)&&O.constructor!==null&&!i(O.constructor)&&typeof O.constructor.isBuffer=="function"&&O.constructor.isBuffer(O)}var a=n("ArrayBuffer");function f(O){var B;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?B=ArrayBuffer.isView(O):B=O&&O.buffer&&a(O.buffer),B}function c(O){return typeof O=="string"}function l(O){return typeof O=="number"}function u(O){return O!==null&&typeof O=="object"}function p(O){if(r(O)!=="object")return!1;var B=Object.getPrototypeOf(O);return B===null||B===Object.prototype}var d=n("Date"),h=n("File"),y=n("Blob"),m=n("FileList");function v(O){return t.call(O)==="[object Function]"}function b(O){return u(O)&&v(O.pipe)}function w(O){var B="[object FormData]";return O&&(typeof FormData=="function"&&O instanceof FormData||t.call(O)===B||v(O.toString)&&O.toString()===B)}var _=n("URLSearchParams");function C(O){return O.trim?O.trim():O.replace(/^\s+|\s+$/g,"")}function I(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function k(O,B){if(!(O===null||typeof O>"u"))if(typeof O!="object"&&(O=[O]),s(O))for(var L=0,M=O.length;L<M;L++)B.call(null,O[L],L,O);else for(var R in O)Object.prototype.hasOwnProperty.call(O,R)&&B.call(null,O[R],R,O)}function E(){var O={};function B(R,N){p(O[N])&&p(R)?O[N]=E(O[N],R):p(R)?O[N]=E({},R):s(R)?O[N]=R.slice():O[N]=R}for(var L=0,M=arguments.length;L<M;L++)k(arguments[L],B);return O}function S(O,B,L){return k(B,function(R,N){L&&typeof R=="function"?O[N]=e(R,L):O[N]=R}),O}function T(O){return O.charCodeAt(0)===65279&&(O=O.slice(1)),O}function P(O,B,L,M){O.prototype=Object.create(B.prototype,M),O.prototype.constructor=O,L&&Object.assign(O.prototype,L)}function g(O,B,L){var M,R,N,F={};B=B||{};do{for(M=Object.getOwnPropertyNames(O),R=M.length;R-- >0;)N=M[R],F[N]||(B[N]=O[N],F[N]=!0);O=Object.getPrototypeOf(O)}while(O&&(!L||L(O,B))&&O!==Object.prototype);return B}function A(O,B,L){O=String(O),(L===void 0||L>O.length)&&(L=O.length),L-=B.length;var M=O.indexOf(B,L);return M!==-1&&M===L}function x(O){if(!O)return null;var B=O.length;if(i(B))return null;for(var L=new Array(B);B-- >0;)L[B]=O[B];return L}var D=function(O){return function(B){return O&&B instanceof O}}(typeof Uint8Array<"u"&&Object.getPrototypeOf(Uint8Array));return M1={isArray:s,isArrayBuffer:a,isBuffer:o,isFormData:w,isArrayBufferView:f,isString:c,isNumber:l,isObject:u,isPlainObject:p,isUndefined:i,isDate:d,isFile:h,isBlob:y,isFunction:v,isStream:b,isURLSearchParams:_,isStandardBrowserEnv:I,forEach:k,merge:E,extend:S,trim:C,stripBOM:T,inherits:P,toFlatObject:g,kindOf:r,kindOfTest:n,endsWith:A,toArray:x,isTypedArray:D,isFileList:m},M1}var N1,jb;function HE(){if(jb)return N1;jb=1;var e=Zr();function t(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}return N1=function(n,s,i){if(!s)return n;var o;if(i)o=i(s);else if(e.isURLSearchParams(s))o=s.toString();else{var a=[];e.forEach(s,function(l,u){l===null||typeof l>"u"||(e.isArray(l)?u=u+"[]":l=[l],e.forEach(l,function(d){e.isDate(d)?d=d.toISOString():e.isObject(d)&&(d=JSON.stringify(d)),a.push(t(u)+"="+t(d))}))}),o=a.join("&")}if(o){var f=n.indexOf("#");f!==-1&&(n=n.slice(0,f)),n+=(n.indexOf("?")===-1?"?":"&")+o}return n},N1}var U1,$b;function L$(){if($b)return U1;$b=1;var e=Zr();function t(){this.handlers=[]}return t.prototype.use=function(n,s,i){return this.handlers.push({fulfilled:n,rejected:s,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1},t.prototype.eject=function(n){this.handlers[n]&&(this.handlers[n]=null)},t.prototype.forEach=function(n){e.forEach(this.handlers,function(i){i!==null&&n(i)})},U1=t,U1}var L1,Hb;function K$(){if(Hb)return L1;Hb=1;var e=Zr();return L1=function(r,n){e.forEach(r,function(i,o){o!==n&&o.toUpperCase()===n.toUpperCase()&&(r[n]=i,delete r[o])})},L1}var K1,Vb;function ko(){if(Vb)return K1;Vb=1;var e=Zr();function t(s,i,o,a,f){Error.call(this),this.message=s,this.name="AxiosError",i&&(this.code=i),o&&(this.config=o),a&&(this.request=a),f&&(this.response=f)}e.inherits(t,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var r=t.prototype,n={};return["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach(function(s){n[s]={value:s}}),Object.defineProperties(t,n),Object.defineProperty(r,"isAxiosError",{value:!0}),t.from=function(s,i,o,a,f,c){var l=Object.create(r);return e.toFlatObject(s,l,function(p){return p!==Error.prototype}),t.call(l,s.message,i,o,a,f),l.name=s.name,c&&Object.assign(l,c),l},K1=t,K1}var F1,Gb;function VE(){return Gb||(Gb=1,F1={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}),F1}var q1,zb;function GE(){if(zb)return q1;zb=1;var e=Zr();function t(r,n){n=n||new FormData;var s=[];function i(a){return a===null?"":e.isDate(a)?a.toISOString():e.isArrayBuffer(a)||e.isTypedArray(a)?typeof Blob=="function"?new Blob([a]):ot.from(a):a}function o(a,f){if(e.isPlainObject(a)||e.isArray(a)){if(s.indexOf(a)!==-1)throw Error("Circular reference detected in "+f);s.push(a),e.forEach(a,function(l,u){if(!e.isUndefined(l)){var p=f?f+"."+u:u,d;if(l&&!f&&typeof l=="object"){if(e.endsWith(u,"{}"))l=JSON.stringify(l);else if(e.endsWith(u,"[]")&&(d=e.toArray(l))){d.forEach(function(h){!e.isUndefined(h)&&n.append(p,i(h))});return}}o(l,p)}}),s.pop()}else n.append(f,i(a))}return o(r),n}return q1=t,q1}var j1,Wb;function F$(){if(Wb)return j1;Wb=1;var e=ko();return j1=function(r,n,s){var i=s.config.validateStatus;!s.status||!i||i(s.status)?r(s):n(new e("Request failed with status code "+s.status,[e.ERR_BAD_REQUEST,e.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s))},j1}var $1,Yb;function q$(){if(Yb)return $1;Yb=1;var e=Zr();return $1=e.isStandardBrowserEnv()?function(){return{write:function(n,s,i,o,a,f){var c=[];c.push(n+"="+encodeURIComponent(s)),e.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),e.isString(o)&&c.push("path="+o),e.isString(a)&&c.push("domain="+a),f===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(n){var s=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return s?decodeURIComponent(s[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),$1}var H1,Zb;function j$(){return Zb||(Zb=1,H1=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}),H1}var V1,Jb;function $$(){return Jb||(Jb=1,V1=function(t,r){return r?t.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):t}),V1}var G1,Xb;function zE(){if(Xb)return G1;Xb=1;var e=j$(),t=$$();return G1=function(n,s){return n&&!e(s)?t(n,s):s},G1}var z1,Qb;function H$(){if(Qb)return z1;Qb=1;var e=Zr(),t=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return z1=function(n){var s={},i,o,a;return n&&e.forEach(n.split(`
66
+ `),function(c){if(a=c.indexOf(":"),i=e.trim(c.substr(0,a)).toLowerCase(),o=e.trim(c.substr(a+1)),i){if(s[i]&&t.indexOf(i)>=0)return;i==="set-cookie"?s[i]=(s[i]?s[i]:[]).concat([o]):s[i]=s[i]?s[i]+", "+o:o}}),s},z1}var W1,e5;function V$(){if(e5)return W1;e5=1;var e=Zr();return W1=e.isStandardBrowserEnv()?function(){var r=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a"),s;function i(o){var a=o;return r&&(n.setAttribute("href",a),a=n.href),n.setAttribute("href",a),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return s=i(window.location.href),function(a){var f=e.isString(a)?i(a):a;return f.protocol===s.protocol&&f.host===s.host}}():function(){return function(){return!0}}(),W1}var Y1,t5;function jf(){if(t5)return Y1;t5=1;var e=ko(),t=Zr();function r(n){e.call(this,n??"canceled",e.ERR_CANCELED),this.name="CanceledError"}return t.inherits(r,e,{__CANCEL__:!0}),Y1=r,Y1}var Z1,r5;function G$(){return r5||(r5=1,Z1=function(t){var r=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return r&&r[1]||""}),Z1}var J1,n5;function i5(){if(n5)return J1;n5=1;var e=Zr(),t=F$(),r=q$(),n=HE(),s=zE(),i=H$(),o=V$(),a=VE(),f=ko(),c=jf(),l=G$();return J1=function(p){return new Promise(function(h,y){var m=p.data,v=p.headers,b=p.responseType,w;function _(){p.cancelToken&&p.cancelToken.unsubscribe(w),p.signal&&p.signal.removeEventListener("abort",w)}e.isFormData(m)&&e.isStandardBrowserEnv()&&delete v["Content-Type"];var C=new XMLHttpRequest;if(p.auth){var I=p.auth.username||"",k=p.auth.password?unescape(encodeURIComponent(p.auth.password)):"";v.Authorization="Basic "+btoa(I+":"+k)}var E=s(p.baseURL,p.url);C.open(p.method.toUpperCase(),n(E,p.params,p.paramsSerializer),!0),C.timeout=p.timeout;function S(){if(C){var g="getAllResponseHeaders"in C?i(C.getAllResponseHeaders()):null,A=!b||b==="text"||b==="json"?C.responseText:C.response,x={data:A,status:C.status,statusText:C.statusText,headers:g,config:p,request:C};t(function(O){h(O),_()},function(O){y(O),_()},x),C=null}}if("onloadend"in C?C.onloadend=S:C.onreadystatechange=function(){!C||C.readyState!==4||C.status===0&&!(C.responseURL&&C.responseURL.indexOf("file:")===0)||setTimeout(S)},C.onabort=function(){C&&(y(new f("Request aborted",f.ECONNABORTED,p,C)),C=null)},C.onerror=function(){y(new f("Network Error",f.ERR_NETWORK,p,C,C)),C=null},C.ontimeout=function(){var A=p.timeout?"timeout of "+p.timeout+"ms exceeded":"timeout exceeded",x=p.transitional||a;p.timeoutErrorMessage&&(A=p.timeoutErrorMessage),y(new f(A,x.clarifyTimeoutError?f.ETIMEDOUT:f.ECONNABORTED,p,C)),C=null},e.isStandardBrowserEnv()){var T=(p.withCredentials||o(E))&&p.xsrfCookieName?r.read(p.xsrfCookieName):void 0;T&&(v[p.xsrfHeaderName]=T)}"setRequestHeader"in C&&e.forEach(v,function(A,x){typeof m>"u"&&x.toLowerCase()==="content-type"?delete v[x]:C.setRequestHeader(x,A)}),e.isUndefined(p.withCredentials)||(C.withCredentials=!!p.withCredentials),b&&b!=="json"&&(C.responseType=p.responseType),typeof p.onDownloadProgress=="function"&&C.addEventListener("progress",p.onDownloadProgress),typeof p.onUploadProgress=="function"&&C.upload&&C.upload.addEventListener("progress",p.onUploadProgress),(p.cancelToken||p.signal)&&(w=function(g){C&&(y(!g||g&&g.type?new c:g),C.abort(),C=null)},p.cancelToken&&p.cancelToken.subscribe(w),p.signal&&(p.signal.aborted?w():p.signal.addEventListener("abort",w))),m||(m=null);var P=l(E);if(P&&["http","https","file"].indexOf(P)===-1){y(new f("Unsupported protocol "+P+":",f.ERR_BAD_REQUEST,p));return}C.send(m)})},J1}var X1,s5;function z$(){return s5||(s5=1,X1=null),X1}var Q1,a5;function Hg(){if(a5)return Q1;a5=1;var e=Zr(),t=K$(),r=ko(),n=VE(),s=GE(),i={"Content-Type":"application/x-www-form-urlencoded"};function o(l,u){!e.isUndefined(l)&&e.isUndefined(l["Content-Type"])&&(l["Content-Type"]=u)}function a(){var l;return(typeof XMLHttpRequest<"u"||typeof Mr<"u"&&Object.prototype.toString.call(Mr)==="[object process]")&&(l=i5()),l}function f(l,u,p){if(e.isString(l))try{return(u||JSON.parse)(l),e.trim(l)}catch(d){if(d.name!=="SyntaxError")throw d}return(p||JSON.stringify)(l)}var c={transitional:n,adapter:a(),transformRequest:[function(u,p){if(t(p,"Accept"),t(p,"Content-Type"),e.isFormData(u)||e.isArrayBuffer(u)||e.isBuffer(u)||e.isStream(u)||e.isFile(u)||e.isBlob(u))return u;if(e.isArrayBufferView(u))return u.buffer;if(e.isURLSearchParams(u))return o(p,"application/x-www-form-urlencoded;charset=utf-8"),u.toString();var d=e.isObject(u),h=p&&p["Content-Type"],y;if((y=e.isFileList(u))||d&&h==="multipart/form-data"){var m=this.env&&this.env.FormData;return s(y?{"files[]":u}:u,m&&new m)}else if(d||h==="application/json")return o(p,"application/json"),f(u);return u}],transformResponse:[function(u){var p=this.transitional||c.transitional,d=p&&p.silentJSONParsing,h=p&&p.forcedJSONParsing,y=!d&&this.responseType==="json";if(y||h&&e.isString(u)&&u.length)try{return JSON.parse(u)}catch(m){if(y)throw m.name==="SyntaxError"?r.from(m,r.ERR_BAD_RESPONSE,this,null,this.response):m}return u}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:z$()},validateStatus:function(u){return u>=200&&u<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};return e.forEach(["delete","get","head"],function(u){c.headers[u]={}}),e.forEach(["post","put","patch"],function(u){c.headers[u]=e.merge(i)}),Q1=c,Q1}var ep,o5;function W$(){if(o5)return ep;o5=1;var e=Zr(),t=Hg();return ep=function(n,s,i){var o=this||t;return e.forEach(i,function(f){n=f.call(o,n,s)}),n},ep}var tp,c5;function WE(){return c5||(c5=1,tp=function(t){return!!(t&&t.__CANCEL__)}),tp}var rp,u5;function Y$(){if(u5)return rp;u5=1;var e=Zr(),t=W$(),r=WE(),n=Hg(),s=jf();function i(o){if(o.cancelToken&&o.cancelToken.throwIfRequested(),o.signal&&o.signal.aborted)throw new s}return rp=function(a){i(a),a.headers=a.headers||{},a.data=t.call(a,a.data,a.headers,a.transformRequest),a.headers=e.merge(a.headers.common||{},a.headers[a.method]||{},a.headers),e.forEach(["delete","get","head","post","put","patch","common"],function(l){delete a.headers[l]});var f=a.adapter||n.adapter;return f(a).then(function(l){return i(a),l.data=t.call(a,l.data,l.headers,a.transformResponse),l},function(l){return r(l)||(i(a),l&&l.response&&(l.response.data=t.call(a,l.response.data,l.response.headers,a.transformResponse))),Promise.reject(l)})},rp}var np,l5;function YE(){if(l5)return np;l5=1;var e=Zr();return np=function(r,n){n=n||{};var s={};function i(u,p){return e.isPlainObject(u)&&e.isPlainObject(p)?e.merge(u,p):e.isPlainObject(p)?e.merge({},p):e.isArray(p)?p.slice():p}function o(u){if(e.isUndefined(n[u])){if(!e.isUndefined(r[u]))return i(void 0,r[u])}else return i(r[u],n[u])}function a(u){if(!e.isUndefined(n[u]))return i(void 0,n[u])}function f(u){if(e.isUndefined(n[u])){if(!e.isUndefined(r[u]))return i(void 0,r[u])}else return i(void 0,n[u])}function c(u){if(u in n)return i(r[u],n[u]);if(u in r)return i(void 0,r[u])}var l={url:a,method:a,data:a,baseURL:f,transformRequest:f,transformResponse:f,paramsSerializer:f,timeout:f,timeoutMessage:f,withCredentials:f,adapter:f,responseType:f,xsrfCookieName:f,xsrfHeaderName:f,onUploadProgress:f,onDownloadProgress:f,decompress:f,maxContentLength:f,maxBodyLength:f,beforeRedirect:f,transport:f,httpAgent:f,httpsAgent:f,cancelToken:f,socketPath:f,responseEncoding:f,validateStatus:c};return e.forEach(Object.keys(r).concat(Object.keys(n)),function(p){var d=l[p]||o,h=d(p);e.isUndefined(h)&&d!==c||(s[p]=h)}),s},np}var ip,d5;function ZE(){return d5||(d5=1,ip={version:"0.27.2"}),ip}var sp,f5;function Z$(){if(f5)return sp;f5=1;var e=ZE().version,t=ko(),r={};["object","boolean","number","function","string","symbol"].forEach(function(i,o){r[i]=function(f){return typeof f===i||"a"+(o<1?"n ":" ")+i}});var n={};r.transitional=function(o,a,f){function c(l,u){return"[Axios v"+e+"] Transitional option '"+l+"'"+u+(f?". "+f:"")}return function(l,u,p){if(o===!1)throw new t(c(u," has been removed"+(a?" in "+a:"")),t.ERR_DEPRECATED);return a&&!n[u]&&(n[u]=!0,console.warn(c(u," has been deprecated since v"+a+" and will be removed in the near future"))),o?o(l,u,p):!0}};function s(i,o,a){if(typeof i!="object")throw new t("options must be an object",t.ERR_BAD_OPTION_VALUE);for(var f=Object.keys(i),c=f.length;c-- >0;){var l=f[c],u=o[l];if(u){var p=i[l],d=p===void 0||u(p,l,i);if(d!==!0)throw new t("option "+l+" must be "+d,t.ERR_BAD_OPTION_VALUE);continue}if(a!==!0)throw new t("Unknown option "+l,t.ERR_BAD_OPTION)}}return sp={assertOptions:s,validators:r},sp}var ap,h5;function J$(){if(h5)return ap;h5=1;var e=Zr(),t=HE(),r=L$(),n=Y$(),s=YE(),i=zE(),o=Z$(),a=o.validators;function f(c){this.defaults=c,this.interceptors={request:new r,response:new r}}return f.prototype.request=function(l,u){typeof l=="string"?(u=u||{},u.url=l):u=l||{},u=s(this.defaults,u),u.method?u.method=u.method.toLowerCase():this.defaults.method?u.method=this.defaults.method.toLowerCase():u.method="get";var p=u.transitional;p!==void 0&&o.assertOptions(p,{silentJSONParsing:a.transitional(a.boolean),forcedJSONParsing:a.transitional(a.boolean),clarifyTimeoutError:a.transitional(a.boolean)},!1);var d=[],h=!0;this.interceptors.request.forEach(function(I){typeof I.runWhen=="function"&&I.runWhen(u)===!1||(h=h&&I.synchronous,d.unshift(I.fulfilled,I.rejected))});var y=[];this.interceptors.response.forEach(function(I){y.push(I.fulfilled,I.rejected)});var m;if(!h){var v=[n,void 0];for(Array.prototype.unshift.apply(v,d),v=v.concat(y),m=Promise.resolve(u);v.length;)m=m.then(v.shift(),v.shift());return m}for(var b=u;d.length;){var w=d.shift(),_=d.shift();try{b=w(b)}catch(C){_(C);break}}try{m=n(b)}catch(C){return Promise.reject(C)}for(;y.length;)m=m.then(y.shift(),y.shift());return m},f.prototype.getUri=function(l){l=s(this.defaults,l);var u=i(l.baseURL,l.url);return t(u,l.params,l.paramsSerializer)},e.forEach(["delete","get","head","options"],function(l){f.prototype[l]=function(u,p){return this.request(s(p||{},{method:l,url:u,data:(p||{}).data}))}}),e.forEach(["post","put","patch"],function(l){function u(p){return function(h,y,m){return this.request(s(m||{},{method:l,headers:p?{"Content-Type":"multipart/form-data"}:{},url:h,data:y}))}}f.prototype[l]=u(),f.prototype[l+"Form"]=u(!0)}),ap=f,ap}var op,p5;function X$(){if(p5)return op;p5=1;var e=jf();function t(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var n;this.promise=new Promise(function(o){n=o});var s=this;this.promise.then(function(i){if(s._listeners){var o,a=s._listeners.length;for(o=0;o<a;o++)s._listeners[o](i);s._listeners=null}}),this.promise.then=function(i){var o,a=new Promise(function(f){s.subscribe(f),o=f}).then(i);return a.cancel=function(){s.unsubscribe(o)},a},r(function(o){s.reason||(s.reason=new e(o),n(s.reason))})}return t.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},t.prototype.subscribe=function(n){if(this.reason){n(this.reason);return}this._listeners?this._listeners.push(n):this._listeners=[n]},t.prototype.unsubscribe=function(n){if(this._listeners){var s=this._listeners.indexOf(n);s!==-1&&this._listeners.splice(s,1)}},t.source=function(){var n,s=new t(function(o){n=o});return{token:s,cancel:n}},op=t,op}var cp,y5;function Q$(){return y5||(y5=1,cp=function(t){return function(n){return t.apply(null,n)}}),cp}var up,g5;function eH(){if(g5)return up;g5=1;var e=Zr();return up=function(r){return e.isObject(r)&&r.isAxiosError===!0},up}var m5;function tH(){if(m5)return $l.exports;m5=1;var e=Zr(),t=$E(),r=J$(),n=YE(),s=Hg();function i(a){var f=new r(a),c=t(r.prototype.request,f);return e.extend(c,r.prototype,f),e.extend(c,f),c.create=function(u){return i(n(a,u))},c}var o=i(s);return o.Axios=r,o.CanceledError=jf(),o.CancelToken=X$(),o.isCancel=WE(),o.VERSION=ZE().version,o.toFormData=GE(),o.AxiosError=ko(),o.Cancel=o.CanceledError,o.all=function(f){return Promise.all(f)},o.spread=Q$(),o.isAxiosError=eH(),$l.exports=o,$l.exports.default=o,$l.exports}var lp,v5;function Ro(){return v5||(v5=1,lp=tH()),lp}var b5;function Tt(){if(b5)return Wn;b5=1,Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.axiosDelete=Wn.axiosPut=Wn.axiosPost=Wn.axiosGet=void 0;const e=He,t=Ro(),n=b9.version,s=l=>{const u=Object.assign(Object.assign({},l==null?void 0:l.headers),{"X-JS-SDK-VERSION":n});return Object.assign(Object.assign({},l),{headers:u})},i=l=>{var u;const p=l.headers["x-deprecation-notice"];if(p){const d=(u=l.config.method)===null||u===void 0?void 0:u.toUpperCase(),h=l.config.url;console.warn(`%cDeprecation Notice%c Method: ${d}, Path: ${h}, Notice: ${p}`,"color: white; background-color: red; font-weight: bold; padding: 2px 4px;","color: red; font-weight: bold;")}return l},o=(l,u)=>e.__awaiter(void 0,void 0,void 0,function*(){return t.default.get(l,s(u)).then(p=>i(p))});Wn.axiosGet=o;const a=(l,u,p)=>e.__awaiter(void 0,void 0,void 0,function*(){return t.default.post(l,u,s(p)).then(d=>i(d))});Wn.axiosPost=a;const f=(l,u,p)=>e.__awaiter(void 0,void 0,void 0,function*(){return t.default.put(l,u,s(p)).then(d=>i(d))});Wn.axiosPut=f;const c=(l,u)=>e.__awaiter(void 0,void 0,void 0,function*(){return t.default.delete(l,s(u)).then(p=>i(p))});return Wn.axiosDelete=c,Wn}var _5;function JE(){if(_5)return zn;_5=1,Object.defineProperty(zn,"__esModule",{value:!0}),zn.getMessagesService=zn.getConversationHashService=zn.authUpdateUserService=zn.createUserService=void 0;const e=He,t=Ze(),r=nt(),n=Vf(),s=qf(),i=Tt(),o=l=>e.__awaiter(void 0,void 0,void 0,function*(){const{wallet:u,publicKey:p="",encryptedPrivateKey:d="",env:h=t.default.ENV.PROD,origin:y}=l||{};let{user:m}=l||{};const b=`${(0,r.getAPIBaseUrls)(h)}/v2/users/`;if((0,r.isValidNFTCAIP)(m)){const k=Math.floor(Date.now()/1e3);m.split(":").length!==6&&(m=`${m}:${k}`)}const w={caip10:(0,r.walletToPCAIP10)(m),did:(0,r.walletToPCAIP10)(m),publicKey:p,encryptedPrivateKey:d},_=(0,r.generateHash)(w),C=yield(0,n.getEip191Signature)(u,_,"v2"),I=Object.assign(Object.assign(Object.assign({},w),{origin:y}),C);return(0,i.axiosPost)(b,I).then(k=>e.__awaiter(void 0,void 0,void 0,function*(){return k.data&&(k.data.publicKey=yield(0,r.verifyProfileKeys)(k.data.encryptedPrivateKey,k.data.publicKey,k.data.did,k.data.wallets,k.data.verificationProof)),(0,s.populateDeprecatedUser)(k.data)})).catch(k=>{throw Error(`[Push SDK] - API ${b}: ${k}`)})});zn.createUserService=o;const a=l=>e.__awaiter(void 0,void 0,void 0,function*(){const{user:u,wallet:p,publicKey:d="",encryptedPrivateKey:h="",env:y=t.default.ENV.PROD}=l||{},v=`${(0,r.getAPIBaseUrls)(y)}/v2/users/${(0,r.walletToPCAIP10)(u)}/auth`,b={caip10:(0,r.walletToPCAIP10)(u),did:(0,r.walletToPCAIP10)(u),publicKey:d,encryptedPrivateKey:h},w=(0,r.generateHash)(b),_=yield(0,n.getEip191Signature)(p,w,"v2"),C=Object.assign(Object.assign({},b),_),I=e.__rest(C,["did"]);return(0,i.axiosPut)(v,I).then(k=>e.__awaiter(void 0,void 0,void 0,function*(){return k.data&&(k.data.publicKey=yield(0,r.verifyProfileKeys)(k.data.encryptedPrivateKey,k.data.publicKey,k.data.did,k.data.wallets,k.data.verificationProof)),(0,s.populateDeprecatedUser)(k.data)})).catch(k=>{throw Error(`[Push SDK] - API ${v}: ${k}`)})});zn.authUpdateUserService=a;const f=l=>e.__awaiter(void 0,void 0,void 0,function*(){const{conversationId:u,account:p,env:d=t.default.ENV.PROD}=l||{},y=`${(0,r.getAPIBaseUrls)(d)}/v1/chat/users/${(0,r.walletToPCAIP10)(p)}/conversations/${u}/hash`;return(0,i.axiosGet)(y).then(m=>m.data).catch(m=>{throw new Error(m)})});zn.getConversationHashService=f;const c=l=>e.__awaiter(void 0,void 0,void 0,function*(){const{threadhash:u,limit:p,env:d=t.default.ENV.PROD}=l||{},y=`${(0,r.getAPIBaseUrls)(d)}/v1/chat/conversationhash/${u}`,m={fetchLimit:p},v=`${y}?${(0,r.getQueryParams)(m)}`;return(0,i.axiosGet)(v).then(b=>b.data).catch(b=>{throw new Error(b)})});return zn.getMessagesService=c,zn}var dp={},fp={},ji={},hp={},pp={},yp={},gp={},aa={},$i={},Rr={},w5;function nl(){if(w5)return Rr;w5=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.output=Rr.exists=Rr.hash=Rr.bytes=Rr.bool=Rr.number=Rr.isBytes=void 0;function e(f){if(!Number.isSafeInteger(f)||f<0)throw new Error(`positive integer expected, not ${f}`)}Rr.number=e;function t(f){if(typeof f!="boolean")throw new Error(`boolean expected, not ${f}`)}Rr.bool=t;function r(f){return f instanceof Uint8Array||f!=null&&typeof f=="object"&&f.constructor.name==="Uint8Array"}Rr.isBytes=r;function n(f,...c){if(!r(f))throw new Error("Uint8Array expected");if(c.length>0&&!c.includes(f.length))throw new Error(`Uint8Array expected of length ${c}, not of length=${f.length}`)}Rr.bytes=n;function s(f){if(typeof f!="function"||typeof f.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");e(f.outputLen),e(f.blockLen)}Rr.hash=s;function i(f,c=!0){if(f.destroyed)throw new Error("Hash instance has been destroyed");if(c&&f.finished)throw new Error("Hash#digest() has already been called")}Rr.exists=i;function o(f,c){n(f);const l=c.outputLen;if(f.length<l)throw new Error(`digestInto() expects output buffer of length at least ${l}`)}Rr.output=o;const a={number:e,bool:t,bytes:n,hash:s,exists:i,output:o};return Rr.default=a,Rr}var mp={},Xo={},E5;function rH(){return E5||(E5=1,Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.crypto=void 0,Xo.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),Xo}var A5;function Vs(){return A5||(A5=1,function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.byteSwap32=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=e.isBytes=void 0;const t=rH(),r=nl();function n(g){return g instanceof Uint8Array||g!=null&&typeof g=="object"&&g.constructor.name==="Uint8Array"}e.isBytes=n;const s=g=>new Uint8Array(g.buffer,g.byteOffset,g.byteLength);e.u8=s;const i=g=>new Uint32Array(g.buffer,g.byteOffset,Math.floor(g.byteLength/4));e.u32=i;const o=g=>new DataView(g.buffer,g.byteOffset,g.byteLength);e.createView=o;const a=(g,A)=>g<<32-A|g>>>A;e.rotr=a;const f=(g,A)=>g<<A|g>>>32-A>>>0;e.rotl=f,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const c=g=>g<<24&4278190080|g<<8&16711680|g>>>8&65280|g>>>24&255;e.byteSwap=c,e.byteSwapIfBE=e.isLE?g=>g:g=>(0,e.byteSwap)(g);function l(g){for(let A=0;A<g.length;A++)g[A]=(0,e.byteSwap)(g[A])}e.byteSwap32=l;const u=Array.from({length:256},(g,A)=>A.toString(16).padStart(2,"0"));function p(g){(0,r.bytes)(g);let A="";for(let x=0;x<g.length;x++)A+=u[g[x]];return A}e.bytesToHex=p;const d={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function h(g){if(g>=d._0&&g<=d._9)return g-d._0;if(g>=d._A&&g<=d._F)return g-(d._A-10);if(g>=d._a&&g<=d._f)return g-(d._a-10)}function y(g){if(typeof g!="string")throw new Error("hex string expected, got "+typeof g);const A=g.length,x=A/2;if(A%2)throw new Error("padded hex string expected, got unpadded hex of length "+A);const D=new Uint8Array(x);for(let O=0,B=0;O<x;O++,B+=2){const L=h(g.charCodeAt(B)),M=h(g.charCodeAt(B+1));if(L===void 0||M===void 0){const R=g[B]+g[B+1];throw new Error('hex string expected, got non-hex character "'+R+'" at index '+B)}D[O]=L*16+M}return D}e.hexToBytes=y;const m=async()=>{};e.nextTick=m;async function v(g,A,x){let D=Date.now();for(let O=0;O<g;O++){x(O);const B=Date.now()-D;B>=0&&B<A||(await(0,e.nextTick)(),D+=B)}}e.asyncLoop=v;function b(g){if(typeof g!="string")throw new Error(`utf8ToBytes expected string, got ${typeof g}`);return new Uint8Array(new TextEncoder().encode(g))}e.utf8ToBytes=b;function w(g){return typeof g=="string"&&(g=b(g)),(0,r.bytes)(g),g}e.toBytes=w;function _(...g){let A=0;for(let D=0;D<g.length;D++){const O=g[D];(0,r.bytes)(O),A+=O.length}const x=new Uint8Array(A);for(let D=0,O=0;D<g.length;D++){const B=g[D];x.set(B,O),O+=B.length}return x}e.concatBytes=_;class C{clone(){return this._cloneInto()}}e.Hash=C;const I={}.toString;function k(g,A){if(A!==void 0&&I.call(A)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(g,A)}e.checkOpts=k;function E(g){const A=D=>g().update(w(D)).digest(),x=g();return A.outputLen=x.outputLen,A.blockLen=x.blockLen,A.create=()=>g(),A}e.wrapConstructor=E;function S(g){const A=(D,O)=>g(O).update(w(D)).digest(),x=g({});return A.outputLen=x.outputLen,A.blockLen=x.blockLen,A.create=D=>g(D),A}e.wrapConstructorWithOpts=S;function T(g){const A=(D,O)=>g(O).update(w(D)).digest(),x=g({});return A.outputLen=x.outputLen,A.blockLen=x.blockLen,A.create=D=>g(D),A}e.wrapXOFConstructorWithOpts=T;function P(g=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(g));throw new Error("crypto.getRandomValues must be defined")}e.randomBytes=P}(mp)),mp}var S5;function nH(){if(S5)return $i;S5=1,Object.defineProperty($i,"__esModule",{value:!0}),$i.HashMD=$i.Maj=$i.Chi=void 0;const e=nl(),t=Vs();function r(o,a,f,c){if(typeof o.setBigUint64=="function")return o.setBigUint64(a,f,c);const l=BigInt(32),u=BigInt(4294967295),p=Number(f>>l&u),d=Number(f&u),h=c?4:0,y=c?0:4;o.setUint32(a+h,p,c),o.setUint32(a+y,d,c)}const n=(o,a,f)=>o&a^~o&f;$i.Chi=n;const s=(o,a,f)=>o&a^o&f^a&f;$i.Maj=s;class i extends t.Hash{constructor(a,f,c,l){super(),this.blockLen=a,this.outputLen=f,this.padOffset=c,this.isLE=l,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(a),this.view=(0,t.createView)(this.buffer)}update(a){(0,e.exists)(this);const{view:f,buffer:c,blockLen:l}=this;a=(0,t.toBytes)(a);const u=a.length;for(let p=0;p<u;){const d=Math.min(l-this.pos,u-p);if(d===l){const h=(0,t.createView)(a);for(;l<=u-p;p+=l)this.process(h,p);continue}c.set(a.subarray(p,p+d),this.pos),this.pos+=d,p+=d,this.pos===l&&(this.process(f,0),this.pos=0)}return this.length+=a.length,this.roundClean(),this}digestInto(a){(0,e.exists)(this),(0,e.output)(a,this),this.finished=!0;const{buffer:f,view:c,blockLen:l,isLE:u}=this;let{pos:p}=this;f[p++]=128,this.buffer.subarray(p).fill(0),this.padOffset>l-p&&(this.process(c,0),p=0);for(let v=p;v<l;v++)f[v]=0;r(c,l-8,BigInt(this.length*8),u),this.process(c,0);const d=(0,t.createView)(a),h=this.outputLen;if(h%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const y=h/4,m=this.get();if(y>m.length)throw new Error("_sha2: outputLen bigger than state");for(let v=0;v<y;v++)d.setUint32(4*v,m[v],u)}digest(){const{buffer:a,outputLen:f}=this;this.digestInto(a);const c=a.slice(0,f);return this.destroy(),c}_cloneInto(a){a||(a=new this.constructor),a.set(...this.get());const{blockLen:f,buffer:c,length:l,finished:u,destroyed:p,pos:d}=this;return a.length=l,a.pos=d,a.finished=u,a.destroyed=p,l%f&&a.buffer.set(c),a}}return $i.HashMD=i,$i}var P5;function iH(){if(P5)return aa;P5=1,Object.defineProperty(aa,"__esModule",{value:!0}),aa.sha224=aa.sha256=void 0;const e=nH(),t=Vs(),r=new Uint32Array([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]),n=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),s=new Uint32Array(64);class i extends e.HashMD{constructor(){super(64,32,8,!1),this.A=n[0]|0,this.B=n[1]|0,this.C=n[2]|0,this.D=n[3]|0,this.E=n[4]|0,this.F=n[5]|0,this.G=n[6]|0,this.H=n[7]|0}get(){const{A:f,B:c,C:l,D:u,E:p,F:d,G:h,H:y}=this;return[f,c,l,u,p,d,h,y]}set(f,c,l,u,p,d,h,y){this.A=f|0,this.B=c|0,this.C=l|0,this.D=u|0,this.E=p|0,this.F=d|0,this.G=h|0,this.H=y|0}process(f,c){for(let b=0;b<16;b++,c+=4)s[b]=f.getUint32(c,!1);for(let b=16;b<64;b++){const w=s[b-15],_=s[b-2],C=(0,t.rotr)(w,7)^(0,t.rotr)(w,18)^w>>>3,I=(0,t.rotr)(_,17)^(0,t.rotr)(_,19)^_>>>10;s[b]=I+s[b-7]+C+s[b-16]|0}let{A:l,B:u,C:p,D:d,E:h,F:y,G:m,H:v}=this;for(let b=0;b<64;b++){const w=(0,t.rotr)(h,6)^(0,t.rotr)(h,11)^(0,t.rotr)(h,25),_=v+w+(0,e.Chi)(h,y,m)+r[b]+s[b]|0,I=((0,t.rotr)(l,2)^(0,t.rotr)(l,13)^(0,t.rotr)(l,22))+(0,e.Maj)(l,u,p)|0;v=m,m=y,y=h,h=d+_|0,d=p,p=u,u=l,l=_+I|0}l=l+this.A|0,u=u+this.B|0,p=p+this.C|0,d=d+this.D|0,h=h+this.E|0,y=y+this.F|0,m=m+this.G|0,v=v+this.H|0,this.set(l,u,p,d,h,y,m,v)}roundClean(){s.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class o extends i{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}return aa.sha256=(0,t.wrapConstructor)(()=>new i),aa.sha224=(0,t.wrapConstructor)(()=>new o),aa}var Qo={},vp={},x5;function sH(){return x5||(x5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const t=nl(),r=Vs();class n extends r.Hash{constructor(o,a){super(),this.finished=!1,this.destroyed=!1,(0,t.hash)(o);const f=(0,r.toBytes)(a);if(this.iHash=o.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const c=this.blockLen,l=new Uint8Array(c);l.set(f.length>c?o.create().update(f).digest():f);for(let u=0;u<l.length;u++)l[u]^=54;this.iHash.update(l),this.oHash=o.create();for(let u=0;u<l.length;u++)l[u]^=106;this.oHash.update(l),l.fill(0)}update(o){return(0,t.exists)(this),this.iHash.update(o),this}digestInto(o){(0,t.exists)(this),(0,t.bytes)(o,this.outputLen),this.finished=!0,this.iHash.digestInto(o),this.oHash.update(o),this.oHash.digestInto(o),this.destroy()}digest(){const o=new Uint8Array(this.oHash.outputLen);return this.digestInto(o),o}_cloneInto(o){o||(o=Object.create(Object.getPrototypeOf(this),{}));const{oHash:a,iHash:f,finished:c,destroyed:l,blockLen:u,outputLen:p}=this;return o=o,o.finished=c,o.destroyed=l,o.blockLen=u,o.outputLen=p,o.oHash=a._cloneInto(o.oHash),o.iHash=f._cloneInto(o.iHash),o}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=n;const s=(i,o,a)=>new n(i,o).update(a).digest();e.hmac=s,e.hmac.create=(i,o)=>new n(i,o)}(vp)),vp}var bp={},ec={},pr={},ur={},T5;function So(){if(T5)return ur;T5=1,Object.defineProperty(ur,"__esModule",{value:!0}),ur.bitMask=void 0,ur.isBytes=n,ur.abytes=s,ur.bytesToHex=o,ur.numberToHexUnpadded=a,ur.hexToNumber=f,ur.hexToBytes=u,ur.bytesToNumberBE=p,ur.bytesToNumberLE=d,ur.numberToBytesBE=h,ur.numberToBytesLE=y,ur.numberToVarBytesBE=m,ur.ensureBytes=v,ur.concatBytes=b,ur.equalBytes=w,ur.utf8ToBytes=_,ur.bitLen=C,ur.bitGet=I,ur.bitSet=k,ur.createHmacDrbg=P,ur.validateObject=A;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=BigInt(0),t=BigInt(1),r=BigInt(2);function n(x){return x instanceof Uint8Array||x!=null&&typeof x=="object"&&x.constructor.name==="Uint8Array"}function s(x){if(!n(x))throw new Error("Uint8Array expected")}const i=Array.from({length:256},(x,D)=>D.toString(16).padStart(2,"0"));function o(x){s(x);let D="";for(let O=0;O<x.length;O++)D+=i[x[O]];return D}function a(x){const D=x.toString(16);return D.length&1?`0${D}`:D}function f(x){if(typeof x!="string")throw new Error("hex string expected, got "+typeof x);return BigInt(x===""?"0":`0x${x}`)}const c={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function l(x){if(x>=c._0&&x<=c._9)return x-c._0;if(x>=c._A&&x<=c._F)return x-(c._A-10);if(x>=c._a&&x<=c._f)return x-(c._a-10)}function u(x){if(typeof x!="string")throw new Error("hex string expected, got "+typeof x);const D=x.length,O=D/2;if(D%2)throw new Error("padded hex string expected, got unpadded hex of length "+D);const B=new Uint8Array(O);for(let L=0,M=0;L<O;L++,M+=2){const R=l(x.charCodeAt(M)),N=l(x.charCodeAt(M+1));if(R===void 0||N===void 0){const F=x[M]+x[M+1];throw new Error('hex string expected, got non-hex character "'+F+'" at index '+M)}B[L]=R*16+N}return B}function p(x){return f(o(x))}function d(x){return s(x),f(o(Uint8Array.from(x).reverse()))}function h(x,D){return u(x.toString(16).padStart(D*2,"0"))}function y(x,D){return h(x,D).reverse()}function m(x){return u(a(x))}function v(x,D,O){let B;if(typeof D=="string")try{B=u(D)}catch(M){throw new Error(`${x} must be valid hex string, got "${D}". Cause: ${M}`)}else if(n(D))B=Uint8Array.from(D);else throw new Error(`${x} must be hex string or Uint8Array`);const L=B.length;if(typeof O=="number"&&L!==O)throw new Error(`${x} expected ${O} bytes, got ${L}`);return B}function b(...x){let D=0;for(let B=0;B<x.length;B++){const L=x[B];s(L),D+=L.length}const O=new Uint8Array(D);for(let B=0,L=0;B<x.length;B++){const M=x[B];O.set(M,L),L+=M.length}return O}function w(x,D){if(x.length!==D.length)return!1;let O=0;for(let B=0;B<x.length;B++)O|=x[B]^D[B];return O===0}function _(x){if(typeof x!="string")throw new Error(`utf8ToBytes expected string, got ${typeof x}`);return new Uint8Array(new TextEncoder().encode(x))}function C(x){let D;for(D=0;x>e;x>>=t,D+=1);return D}function I(x,D){return x>>BigInt(D)&t}function k(x,D,O){return x|(O?t:e)<<BigInt(D)}const E=x=>(r<<BigInt(x-1))-t;ur.bitMask=E;const S=x=>new Uint8Array(x),T=x=>Uint8Array.from(x);function P(x,D,O){if(typeof x!="number"||x<2)throw new Error("hashLen must be a number");if(typeof D!="number"||D<2)throw new Error("qByteLen must be a number");if(typeof O!="function")throw new Error("hmacFn must be a function");let B=S(x),L=S(x),M=0;const R=()=>{B.fill(1),L.fill(0),M=0},N=(...j)=>O(L,B,...j),F=(j=S())=>{L=N(T([0]),j),B=N(),j.length!==0&&(L=N(T([1]),j),B=N())},z=()=>{if(M++>=1e3)throw new Error("drbg: tried 1000 values");let j=0;const re=[];for(;j<D;){B=N();const V=B.slice();re.push(V),j+=B.length}return b(...re)};return(j,re)=>{R(),F(j);let V;for(;!(V=re(z()));)F();return R(),V}}const g={bigint:x=>typeof x=="bigint",function:x=>typeof x=="function",boolean:x=>typeof x=="boolean",string:x=>typeof x=="string",stringOrUint8Array:x=>typeof x=="string"||n(x),isSafeInteger:x=>Number.isSafeInteger(x),array:x=>Array.isArray(x),field:(x,D)=>D.Fp.isValid(x),hash:x=>typeof x=="function"&&Number.isSafeInteger(x.outputLen)};function A(x,D,O={}){const B=(L,M,R)=>{const N=g[M];if(typeof N!="function")throw new Error(`Invalid validator "${M}", expected function`);const F=x[L];if(!(R&&F===void 0)&&!N(F,x))throw new Error(`Invalid param ${String(L)}=${F} (${typeof F}), expected ${M}`)};for(const[L,M]of Object.entries(D))B(L,M,!1);for(const[L,M]of Object.entries(O))B(L,M,!0);return x}return ur}var C5;function $f(){if(C5)return pr;C5=1,Object.defineProperty(pr,"__esModule",{value:!0}),pr.isNegativeLE=void 0,pr.mod=f,pr.pow=c,pr.pow2=l,pr.invert=u,pr.tonelliShanks=p,pr.FpSqrt=d,pr.validateField=m,pr.FpPow=v,pr.FpInvertBatch=b,pr.FpDiv=w,pr.FpIsSquare=_,pr.nLength=C,pr.Field=I,pr.FpSqrtOdd=k,pr.FpSqrtEven=E,pr.hashToPrivateScalar=S,pr.getFieldBytesLength=T,pr.getMinHashLength=P,pr.mapHashToField=g;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=So(),t=BigInt(0),r=BigInt(1),n=BigInt(2),s=BigInt(3),i=BigInt(4),o=BigInt(5),a=BigInt(8);BigInt(9),BigInt(16);function f(A,x){const D=A%x;return D>=t?D:x+D}function c(A,x,D){if(D<=t||x<t)throw new Error("Expected power/modulo > 0");if(D===r)return t;let O=r;for(;x>t;)x&r&&(O=O*A%D),A=A*A%D,x>>=r;return O}function l(A,x,D){let O=A;for(;x-- >t;)O*=O,O%=D;return O}function u(A,x){if(A===t||x<=t)throw new Error(`invert: expected positive integers, got n=${A} mod=${x}`);let D=f(A,x),O=x,B=t,L=r;for(;D!==t;){const R=O/D,N=O%D,F=B-L*R;O=D,D=N,B=L,L=F}if(O!==r)throw new Error("invert: does not exist");return f(B,x)}function p(A){const x=(A-r)/n;let D,O,B;for(D=A-r,O=0;D%n===t;D/=n,O++);for(B=n;B<A&&c(B,x,A)!==A-r;B++);if(O===1){const M=(A+r)/i;return function(N,F){const z=N.pow(F,M);if(!N.eql(N.sqr(z),F))throw new Error("Cannot find square root");return z}}const L=(D+r)/n;return function(R,N){if(R.pow(N,x)===R.neg(R.ONE))throw new Error("Cannot find square root");let F=O,z=R.pow(R.mul(R.ONE,B),D),Y=R.pow(N,L),j=R.pow(N,D);for(;!R.eql(j,R.ONE);){if(R.eql(j,R.ZERO))return R.ZERO;let re=1;for(let U=R.sqr(j);re<F&&!R.eql(U,R.ONE);re++)U=R.sqr(U);const V=R.pow(z,r<<BigInt(F-re-1));z=R.sqr(V),Y=R.mul(Y,V),j=R.mul(j,z),F=re}return Y}}function d(A){if(A%i===s){const x=(A+r)/i;return function(O,B){const L=O.pow(B,x);if(!O.eql(O.sqr(L),B))throw new Error("Cannot find square root");return L}}if(A%a===o){const x=(A-o)/a;return function(O,B){const L=O.mul(B,n),M=O.pow(L,x),R=O.mul(B,M),N=O.mul(O.mul(R,n),M),F=O.mul(R,O.sub(N,O.ONE));if(!O.eql(O.sqr(F),B))throw new Error("Cannot find square root");return F}}return p(A)}const h=(A,x)=>(f(A,x)&r)===r;pr.isNegativeLE=h;const y=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function m(A){const x={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},D=y.reduce((O,B)=>(O[B]="function",O),x);return(0,e.validateObject)(A,D)}function v(A,x,D){if(D<t)throw new Error("Expected power > 0");if(D===t)return A.ONE;if(D===r)return x;let O=A.ONE,B=x;for(;D>t;)D&r&&(O=A.mul(O,B)),B=A.sqr(B),D>>=r;return O}function b(A,x){const D=new Array(x.length),O=x.reduce((L,M,R)=>A.is0(M)?L:(D[R]=L,A.mul(L,M)),A.ONE),B=A.inv(O);return x.reduceRight((L,M,R)=>A.is0(M)?L:(D[R]=A.mul(L,D[R]),A.mul(L,M)),B),D}function w(A,x,D){return A.mul(x,typeof D=="bigint"?u(D,A.ORDER):A.inv(D))}function _(A){const x=(A.ORDER-r)/n;return D=>{const O=A.pow(D,x);return A.eql(O,A.ZERO)||A.eql(O,A.ONE)}}function C(A,x){const D=x!==void 0?x:A.toString(2).length,O=Math.ceil(D/8);return{nBitLength:D,nByteLength:O}}function I(A,x,D=!1,O={}){if(A<=t)throw new Error(`Expected Field ORDER > 0, got ${A}`);const{nBitLength:B,nByteLength:L}=C(A,x);if(L>2048)throw new Error("Field lengths over 2048 bytes are not supported");const M=d(A),R=Object.freeze({ORDER:A,BITS:B,BYTES:L,MASK:(0,e.bitMask)(B),ZERO:t,ONE:r,create:N=>f(N,A),isValid:N=>{if(typeof N!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof N}`);return t<=N&&N<A},is0:N=>N===t,isOdd:N=>(N&r)===r,neg:N=>f(-N,A),eql:(N,F)=>N===F,sqr:N=>f(N*N,A),add:(N,F)=>f(N+F,A),sub:(N,F)=>f(N-F,A),mul:(N,F)=>f(N*F,A),pow:(N,F)=>v(R,N,F),div:(N,F)=>f(N*u(F,A),A),sqrN:N=>N*N,addN:(N,F)=>N+F,subN:(N,F)=>N-F,mulN:(N,F)=>N*F,inv:N=>u(N,A),sqrt:O.sqrt||(N=>M(R,N)),invertBatch:N=>b(R,N),cmov:(N,F,z)=>z?F:N,toBytes:N=>D?(0,e.numberToBytesLE)(N,L):(0,e.numberToBytesBE)(N,L),fromBytes:N=>{if(N.length!==L)throw new Error(`Fp.fromBytes: expected ${L}, got ${N.length}`);return D?(0,e.bytesToNumberLE)(N):(0,e.bytesToNumberBE)(N)}});return Object.freeze(R)}function k(A,x){if(!A.isOdd)throw new Error("Field doesn't have isOdd");const D=A.sqrt(x);return A.isOdd(D)?D:A.neg(D)}function E(A,x){if(!A.isOdd)throw new Error("Field doesn't have isOdd");const D=A.sqrt(x);return A.isOdd(D)?A.neg(D):D}function S(A,x,D=!1){A=(0,e.ensureBytes)("privateHash",A);const O=A.length,B=C(x).nByteLength+8;if(B<24||O<B||O>1024)throw new Error(`hashToPrivateScalar: expected ${B}-1024 bytes of input, got ${O}`);const L=D?(0,e.bytesToNumberLE)(A):(0,e.bytesToNumberBE)(A);return f(L,x-r)+r}function T(A){if(typeof A!="bigint")throw new Error("field order must be bigint");const x=A.toString(2).length;return Math.ceil(x/8)}function P(A){const x=T(A);return x+Math.ceil(x/2)}function g(A,x,D=!1){const O=A.length,B=T(x),L=P(x);if(O<16||O<L||O>1024)throw new Error(`expected ${L}-1024 bytes of input, got ${O}`);const M=D?(0,e.bytesToNumberBE)(A):(0,e.bytesToNumberLE)(A),R=f(M,x-r)+r;return D?(0,e.numberToBytesLE)(R,B):(0,e.numberToBytesBE)(R,B)}return pr}var I5;function aH(){if(I5)return ec;I5=1,Object.defineProperty(ec,"__esModule",{value:!0}),ec.wNAF=s,ec.validateBasic=i;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=$f(),t=So(),r=BigInt(0),n=BigInt(1);function s(o,a){const f=(l,u)=>{const p=u.negate();return l?p:u},c=l=>{const u=Math.ceil(a/l)+1,p=2**(l-1);return{windows:u,windowSize:p}};return{constTimeNegate:f,unsafeLadder(l,u){let p=o.ZERO,d=l;for(;u>r;)u&n&&(p=p.add(d)),d=d.double(),u>>=n;return p},precomputeWindow(l,u){const{windows:p,windowSize:d}=c(u),h=[];let y=l,m=y;for(let v=0;v<p;v++){m=y,h.push(m);for(let b=1;b<d;b++)m=m.add(y),h.push(m);y=m.double()}return h},wNAF(l,u,p){const{windows:d,windowSize:h}=c(l);let y=o.ZERO,m=o.BASE;const v=BigInt(2**l-1),b=2**l,w=BigInt(l);for(let _=0;_<d;_++){const C=_*h;let I=Number(p&v);p>>=w,I>h&&(I-=b,p+=n);const k=C,E=C+Math.abs(I)-1,S=_%2!==0,T=I<0;I===0?m=m.add(f(S,u[k])):y=y.add(f(T,u[E]))}return{p:y,f:m}},wNAFCached(l,u,p,d){const h=l._WINDOW_SIZE||1;let y=u.get(l);return y||(y=this.precomputeWindow(l,h),h!==1&&u.set(l,d(y))),this.wNAF(h,y,p)}}}function i(o){return(0,e.validateField)(o.Fp),(0,t.validateObject)(o,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,e.nLength)(o.n,o.nBitLength),...o,p:o.Fp.ORDER})}return ec}var k5;function XE(){return k5||(k5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=void 0,e.weierstrassPoints=d,e.weierstrass=y,e.SWUFpSqrtRatio=m,e.mapToCurveSimpleSWU=v;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=aH(),r=$f(),n=So(),s=So();function i(b){const w=(0,t.validateBasic)(b);n.validateObject(w,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:_,Fp:C,a:I}=w;if(_){if(!C.eql(I,C.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof _!="object"||typeof _.beta!="bigint"||typeof _.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...w})}const{bytesToNumberBE:o,hexToBytes:a}=n;e.DER={Err:class extends Error{constructor(w=""){super(w)}},_parseInt(b){const{Err:w}=e.DER;if(b.length<2||b[0]!==2)throw new w("Invalid signature integer tag");const _=b[1],C=b.subarray(2,_+2);if(!_||C.length!==_)throw new w("Invalid signature integer: wrong length");if(C[0]&128)throw new w("Invalid signature integer: negative");if(C[0]===0&&!(C[1]&128))throw new w("Invalid signature integer: unnecessary leading zero");return{d:o(C),l:b.subarray(_+2)}},toSig(b){const{Err:w}=e.DER,_=typeof b=="string"?a(b):b;n.abytes(_);let C=_.length;if(C<2||_[0]!=48)throw new w("Invalid signature tag");if(_[1]!==C-2)throw new w("Invalid signature: incorrect length");const{d:I,l:k}=e.DER._parseInt(_.subarray(2)),{d:E,l:S}=e.DER._parseInt(k);if(S.length)throw new w("Invalid signature: left bytes after parsing");return{r:I,s:E}},hexFromSig(b){const w=P=>Number.parseInt(P[0],16)&8?"00"+P:P,_=P=>{const g=P.toString(16);return g.length&1?`0${g}`:g},C=w(_(b.s)),I=w(_(b.r)),k=C.length/2,E=I.length/2,S=_(k),T=_(E);return`30${_(E+k+4)}02${T}${I}02${S}${C}`}};const f=BigInt(0),c=BigInt(1),l=BigInt(2),u=BigInt(3),p=BigInt(4);function d(b){const w=i(b),{Fp:_}=w,C=w.toBytes||((O,B,L)=>{const M=B.toAffine();return n.concatBytes(Uint8Array.from([4]),_.toBytes(M.x),_.toBytes(M.y))}),I=w.fromBytes||(O=>{const B=O.subarray(1),L=_.fromBytes(B.subarray(0,_.BYTES)),M=_.fromBytes(B.subarray(_.BYTES,2*_.BYTES));return{x:L,y:M}});function k(O){const{a:B,b:L}=w,M=_.sqr(O),R=_.mul(M,O);return _.add(_.add(R,_.mul(O,B)),L)}if(!_.eql(_.sqr(w.Gy),k(w.Gx)))throw new Error("bad generator point: equation left != right");function E(O){return typeof O=="bigint"&&f<O&&O<w.n}function S(O){if(!E(O))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function T(O){const{allowedPrivateKeyLengths:B,nByteLength:L,wrapPrivateKey:M,n:R}=w;if(B&&typeof O!="bigint"){if(n.isBytes(O)&&(O=n.bytesToHex(O)),typeof O!="string"||!B.includes(O.length))throw new Error("Invalid key");O=O.padStart(L*2,"0")}let N;try{N=typeof O=="bigint"?O:n.bytesToNumberBE((0,s.ensureBytes)("private key",O,L))}catch{throw new Error(`private key must be ${L} bytes, hex or bigint, not ${typeof O}`)}return M&&(N=r.mod(N,R)),S(N),N}const P=new Map;function g(O){if(!(O instanceof A))throw new Error("ProjectivePoint expected")}class A{constructor(B,L,M){if(this.px=B,this.py=L,this.pz=M,B==null||!_.isValid(B))throw new Error("x required");if(L==null||!_.isValid(L))throw new Error("y required");if(M==null||!_.isValid(M))throw new Error("z required")}static fromAffine(B){const{x:L,y:M}=B||{};if(!B||!_.isValid(L)||!_.isValid(M))throw new Error("invalid affine point");if(B instanceof A)throw new Error("projective point not allowed");const R=N=>_.eql(N,_.ZERO);return R(L)&&R(M)?A.ZERO:new A(L,M,_.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(B){const L=_.invertBatch(B.map(M=>M.pz));return B.map((M,R)=>M.toAffine(L[R])).map(A.fromAffine)}static fromHex(B){const L=A.fromAffine(I((0,s.ensureBytes)("pointHex",B)));return L.assertValidity(),L}static fromPrivateKey(B){return A.BASE.multiply(T(B))}_setWindowSize(B){this._WINDOW_SIZE=B,P.delete(this)}assertValidity(){if(this.is0()){if(w.allowInfinityPoint&&!_.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:B,y:L}=this.toAffine();if(!_.isValid(B)||!_.isValid(L))throw new Error("bad point: x or y not FE");const M=_.sqr(L),R=k(B);if(!_.eql(M,R))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:B}=this.toAffine();if(_.isOdd)return!_.isOdd(B);throw new Error("Field doesn't support isOdd")}equals(B){g(B);const{px:L,py:M,pz:R}=this,{px:N,py:F,pz:z}=B,Y=_.eql(_.mul(L,z),_.mul(N,R)),j=_.eql(_.mul(M,z),_.mul(F,R));return Y&&j}negate(){return new A(this.px,_.neg(this.py),this.pz)}double(){const{a:B,b:L}=w,M=_.mul(L,u),{px:R,py:N,pz:F}=this;let z=_.ZERO,Y=_.ZERO,j=_.ZERO,re=_.mul(R,R),V=_.mul(N,N),U=_.mul(F,F),X=_.mul(R,N);return X=_.add(X,X),j=_.mul(R,F),j=_.add(j,j),z=_.mul(B,j),Y=_.mul(M,U),Y=_.add(z,Y),z=_.sub(V,Y),Y=_.add(V,Y),Y=_.mul(z,Y),z=_.mul(X,z),j=_.mul(M,j),U=_.mul(B,U),X=_.sub(re,U),X=_.mul(B,X),X=_.add(X,j),j=_.add(re,re),re=_.add(j,re),re=_.add(re,U),re=_.mul(re,X),Y=_.add(Y,re),U=_.mul(N,F),U=_.add(U,U),re=_.mul(U,X),z=_.sub(z,re),j=_.mul(U,V),j=_.add(j,j),j=_.add(j,j),new A(z,Y,j)}add(B){g(B);const{px:L,py:M,pz:R}=this,{px:N,py:F,pz:z}=B;let Y=_.ZERO,j=_.ZERO,re=_.ZERO;const V=w.a,U=_.mul(w.b,u);let X=_.mul(L,N),ye=_.mul(M,F),_e=_.mul(R,z),Ae=_.add(L,M),H=_.add(N,F);Ae=_.mul(Ae,H),H=_.add(X,ye),Ae=_.sub(Ae,H),H=_.add(L,R);let q=_.add(N,z);return H=_.mul(H,q),q=_.add(X,_e),H=_.sub(H,q),q=_.add(M,R),Y=_.add(F,z),q=_.mul(q,Y),Y=_.add(ye,_e),q=_.sub(q,Y),re=_.mul(V,H),Y=_.mul(U,_e),re=_.add(Y,re),Y=_.sub(ye,re),re=_.add(ye,re),j=_.mul(Y,re),ye=_.add(X,X),ye=_.add(ye,X),_e=_.mul(V,_e),H=_.mul(U,H),ye=_.add(ye,_e),_e=_.sub(X,_e),_e=_.mul(V,_e),H=_.add(H,_e),X=_.mul(ye,H),j=_.add(j,X),X=_.mul(q,H),Y=_.mul(Ae,Y),Y=_.sub(Y,X),X=_.mul(Ae,ye),re=_.mul(q,re),re=_.add(re,X),new A(Y,j,re)}subtract(B){return this.add(B.negate())}is0(){return this.equals(A.ZERO)}wNAF(B){return D.wNAFCached(this,P,B,L=>{const M=_.invertBatch(L.map(R=>R.pz));return L.map((R,N)=>R.toAffine(M[N])).map(A.fromAffine)})}multiplyUnsafe(B){const L=A.ZERO;if(B===f)return L;if(S(B),B===c)return this;const{endo:M}=w;if(!M)return D.unsafeLadder(this,B);let{k1neg:R,k1:N,k2neg:F,k2:z}=M.splitScalar(B),Y=L,j=L,re=this;for(;N>f||z>f;)N&c&&(Y=Y.add(re)),z&c&&(j=j.add(re)),re=re.double(),N>>=c,z>>=c;return R&&(Y=Y.negate()),F&&(j=j.negate()),j=new A(_.mul(j.px,M.beta),j.py,j.pz),Y.add(j)}multiply(B){S(B);let L=B,M,R;const{endo:N}=w;if(N){const{k1neg:F,k1:z,k2neg:Y,k2:j}=N.splitScalar(L);let{p:re,f:V}=this.wNAF(z),{p:U,f:X}=this.wNAF(j);re=D.constTimeNegate(F,re),U=D.constTimeNegate(Y,U),U=new A(_.mul(U.px,N.beta),U.py,U.pz),M=re.add(U),R=V.add(X)}else{const{p:F,f:z}=this.wNAF(L);M=F,R=z}return A.normalizeZ([M,R])[0]}multiplyAndAddUnsafe(B,L,M){const R=A.BASE,N=(z,Y)=>Y===f||Y===c||!z.equals(R)?z.multiplyUnsafe(Y):z.multiply(Y),F=N(this,L).add(N(B,M));return F.is0()?void 0:F}toAffine(B){const{px:L,py:M,pz:R}=this,N=this.is0();B==null&&(B=N?_.ONE:_.inv(R));const F=_.mul(L,B),z=_.mul(M,B),Y=_.mul(R,B);if(N)return{x:_.ZERO,y:_.ZERO};if(!_.eql(Y,_.ONE))throw new Error("invZ was invalid");return{x:F,y:z}}isTorsionFree(){const{h:B,isTorsionFree:L}=w;if(B===c)return!0;if(L)return L(A,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:B,clearCofactor:L}=w;return B===c?this:L?L(A,this):this.multiplyUnsafe(w.h)}toRawBytes(B=!0){return this.assertValidity(),C(A,this,B)}toHex(B=!0){return n.bytesToHex(this.toRawBytes(B))}}A.BASE=new A(w.Gx,w.Gy,_.ONE),A.ZERO=new A(_.ZERO,_.ONE,_.ZERO);const x=w.nBitLength,D=(0,t.wNAF)(A,w.endo?Math.ceil(x/2):x);return{CURVE:w,ProjectivePoint:A,normPrivateKeyToScalar:T,weierstrassEquation:k,isWithinCurveOrder:E}}function h(b){const w=(0,t.validateBasic)(b);return n.validateObject(w,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...w})}function y(b){const w=h(b),{Fp:_,n:C}=w,I=_.BYTES+1,k=2*_.BYTES+1;function E(H){return f<H&&H<_.ORDER}function S(H){return r.mod(H,C)}function T(H){return r.invert(H,C)}const{ProjectivePoint:P,normPrivateKeyToScalar:g,weierstrassEquation:A,isWithinCurveOrder:x}=d({...w,toBytes(H,q,W){const ee=q.toAffine(),le=_.toBytes(ee.x),ce=n.concatBytes;return W?ce(Uint8Array.from([q.hasEvenY()?2:3]),le):ce(Uint8Array.from([4]),le,_.toBytes(ee.y))},fromBytes(H){const q=H.length,W=H[0],ee=H.subarray(1);if(q===I&&(W===2||W===3)){const le=n.bytesToNumberBE(ee);if(!E(le))throw new Error("Point is not on curve");const ce=A(le);let ie;try{ie=_.sqrt(ce)}catch(qe){const he=qe instanceof Error?": "+qe.message:"";throw new Error("Point is not on curve"+he)}const Fe=(ie&c)===c;return(W&1)===1!==Fe&&(ie=_.neg(ie)),{x:le,y:ie}}else if(q===k&&W===4){const le=_.fromBytes(ee.subarray(0,_.BYTES)),ce=_.fromBytes(ee.subarray(_.BYTES,2*_.BYTES));return{x:le,y:ce}}else throw new Error(`Point of length ${q} was invalid. Expected ${I} compressed bytes or ${k} uncompressed bytes`)}}),D=H=>n.bytesToHex(n.numberToBytesBE(H,w.nByteLength));function O(H){const q=C>>c;return H>q}function B(H){return O(H)?S(-H):H}const L=(H,q,W)=>n.bytesToNumberBE(H.slice(q,W));class M{constructor(q,W,ee){this.r=q,this.s=W,this.recovery=ee,this.assertValidity()}static fromCompact(q){const W=w.nByteLength;return q=(0,s.ensureBytes)("compactSignature",q,W*2),new M(L(q,0,W),L(q,W,2*W))}static fromDER(q){const{r:W,s:ee}=e.DER.toSig((0,s.ensureBytes)("DER",q));return new M(W,ee)}assertValidity(){if(!x(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!x(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(q){return new M(this.r,this.s,q)}recoverPublicKey(q){const{r:W,s:ee,recovery:le}=this,ce=j((0,s.ensureBytes)("msgHash",q));if(le==null||![0,1,2,3].includes(le))throw new Error("recovery id invalid");const ie=le===2||le===3?W+w.n:W;if(ie>=_.ORDER)throw new Error("recovery id 2 or 3 invalid");const Fe=le&1?"03":"02",De=P.fromHex(Fe+D(ie)),qe=T(ie),he=S(-ce*qe),ue=S(ee*qe),pe=P.BASE.multiplyAndAddUnsafe(De,he,ue);if(!pe)throw new Error("point at infinify");return pe.assertValidity(),pe}hasHighS(){return O(this.s)}normalizeS(){return this.hasHighS()?new M(this.r,S(-this.s),this.recovery):this}toDERRawBytes(){return n.hexToBytes(this.toDERHex())}toDERHex(){return e.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return n.hexToBytes(this.toCompactHex())}toCompactHex(){return D(this.r)+D(this.s)}}const R={isValidPrivateKey(H){try{return g(H),!0}catch{return!1}},normPrivateKeyToScalar:g,randomPrivateKey:()=>{const H=r.getMinHashLength(w.n);return r.mapHashToField(w.randomBytes(H),w.n)},precompute(H=8,q=P.BASE){return q._setWindowSize(H),q.multiply(BigInt(3)),q}};function N(H,q=!0){return P.fromPrivateKey(H).toRawBytes(q)}function F(H){const q=n.isBytes(H),W=typeof H=="string",ee=(q||W)&&H.length;return q?ee===I||ee===k:W?ee===2*I||ee===2*k:H instanceof P}function z(H,q,W=!0){if(F(H))throw new Error("first arg must be private key");if(!F(q))throw new Error("second arg must be public key");return P.fromHex(q).multiply(g(H)).toRawBytes(W)}const Y=w.bits2int||function(H){const q=n.bytesToNumberBE(H),W=H.length*8-w.nBitLength;return W>0?q>>BigInt(W):q},j=w.bits2int_modN||function(H){return S(Y(H))},re=n.bitMask(w.nBitLength);function V(H){if(typeof H!="bigint")throw new Error("bigint expected");if(!(f<=H&&H<re))throw new Error(`bigint expected < 2^${w.nBitLength}`);return n.numberToBytesBE(H,w.nByteLength)}function U(H,q,W=X){if(["recovered","canonical"].some(fe=>fe in W))throw new Error("sign() legacy options not supported");const{hash:ee,randomBytes:le}=w;let{lowS:ce,prehash:ie,extraEntropy:Fe}=W;ce==null&&(ce=!0),H=(0,s.ensureBytes)("msgHash",H),ie&&(H=(0,s.ensureBytes)("prehashed msgHash",ee(H)));const De=j(H),qe=g(q),he=[V(qe),V(De)];if(Fe!=null&&Fe!==!1){const fe=Fe===!0?le(_.BYTES):Fe;he.push((0,s.ensureBytes)("extraEntropy",fe))}const ue=n.concatBytes(...he),pe=De;function de(fe){const ge=Y(fe);if(!x(ge))return;const se=T(ge),te=P.BASE.multiply(ge).toAffine(),Ne=S(te.x);if(Ne===f)return;const Ve=S(se*S(pe+Ne*qe));if(Ve===f)return;let Je=(te.x===Ne?0:2)|Number(te.y&c),lt=Ve;return ce&&O(Ve)&&(lt=B(Ve),Je^=1),new M(Ne,lt,Je)}return{seed:ue,k2sig:de}}const X={lowS:w.lowS,prehash:!1},ye={lowS:w.lowS,prehash:!1};function _e(H,q,W=X){const{seed:ee,k2sig:le}=U(H,q,W),ce=w;return n.createHmacDrbg(ce.hash.outputLen,ce.nByteLength,ce.hmac)(ee,le)}P.BASE._setWindowSize(8);function Ae(H,q,W,ee=ye){var te;const le=H;if(q=(0,s.ensureBytes)("msgHash",q),W=(0,s.ensureBytes)("publicKey",W),"strict"in ee)throw new Error("options.strict was renamed to lowS");const{lowS:ce,prehash:ie}=ee;let Fe,De;try{if(typeof le=="string"||n.isBytes(le))try{Fe=M.fromDER(le)}catch(Ne){if(!(Ne instanceof e.DER.Err))throw Ne;Fe=M.fromCompact(le)}else if(typeof le=="object"&&typeof le.r=="bigint"&&typeof le.s=="bigint"){const{r:Ne,s:Ve}=le;Fe=new M(Ne,Ve)}else throw new Error("PARSE");De=P.fromHex(W)}catch(Ne){if(Ne.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(ce&&Fe.hasHighS())return!1;ie&&(q=w.hash(q));const{r:qe,s:he}=Fe,ue=j(q),pe=T(he),de=S(ue*pe),fe=S(qe*pe),ge=(te=P.BASE.multiplyAndAddUnsafe(De,de,fe))==null?void 0:te.toAffine();return ge?S(ge.x)===qe:!1}return{CURVE:w,getPublicKey:N,getSharedSecret:z,sign:_e,verify:Ae,ProjectivePoint:P,Signature:M,utils:R}}function m(b,w){const _=b.ORDER;let C=f;for(let O=_-c;O%l===f;O/=l)C+=c;const I=C,k=l<<I-c-c,E=k*l,S=(_-c)/E,T=(S-c)/l,P=E-c,g=k,A=b.pow(w,S),x=b.pow(w,(S+c)/l);let D=(O,B)=>{let L=A,M=b.pow(B,P),R=b.sqr(M);R=b.mul(R,B);let N=b.mul(O,R);N=b.pow(N,T),N=b.mul(N,M),M=b.mul(N,B),R=b.mul(N,O);let F=b.mul(R,M);N=b.pow(F,g);let z=b.eql(N,b.ONE);M=b.mul(R,x),N=b.mul(F,L),R=b.cmov(M,R,z),F=b.cmov(N,F,z);for(let Y=I;Y>c;Y--){let j=Y-l;j=l<<j-c;let re=b.pow(F,j);const V=b.eql(re,b.ONE);M=b.mul(R,L),L=b.mul(L,L),re=b.mul(F,L),R=b.cmov(M,R,V),F=b.cmov(re,F,V)}return{isValid:z,value:R}};if(b.ORDER%p===u){const O=(b.ORDER-u)/p,B=b.sqrt(b.neg(w));D=(L,M)=>{let R=b.sqr(M);const N=b.mul(L,M);R=b.mul(R,N);let F=b.pow(R,O);F=b.mul(F,N);const z=b.mul(F,B),Y=b.mul(b.sqr(F),M),j=b.eql(Y,L);let re=b.cmov(z,F,j);return{isValid:j,value:re}}}return D}function v(b,w){if(r.validateField(b),!b.isValid(w.A)||!b.isValid(w.B)||!b.isValid(w.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const _=m(b,w.Z);if(!b.isOdd)throw new Error("Fp.isOdd is not implemented!");return C=>{let I,k,E,S,T,P,g,A;I=b.sqr(C),I=b.mul(I,w.Z),k=b.sqr(I),k=b.add(k,I),E=b.add(k,b.ONE),E=b.mul(E,w.B),S=b.cmov(w.Z,b.neg(k),!b.eql(k,b.ZERO)),S=b.mul(S,w.A),k=b.sqr(E),P=b.sqr(S),T=b.mul(P,w.A),k=b.add(k,T),k=b.mul(k,E),P=b.mul(P,S),T=b.mul(P,w.B),k=b.add(k,T),g=b.mul(I,E);const{isValid:x,value:D}=_(k,P);A=b.mul(I,C),A=b.mul(A,D),g=b.cmov(g,E,x),A=b.cmov(A,D,x);const O=b.isOdd(C)===b.isOdd(A);return A=b.cmov(b.neg(A),A,O),g=b.div(g,S),{x:g,y:A}}}}(bp)),bp}var R5;function oH(){if(R5)return Qo;R5=1,Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.getHash=n,Qo.createCurve=s;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=sH(),t=Vs(),r=XE();function n(i){return{hash:i,hmac:(o,...a)=>(0,e.hmac)(i,o,(0,t.concatBytes)(...a)),randomBytes:t.randomBytes}}function s(i,o){const a=f=>(0,r.weierstrass)({...i,...n(f)});return Object.freeze({...a(o),create:a})}return Qo}var ys={},D5;function cH(){if(D5)return ys;D5=1,Object.defineProperty(ys,"__esModule",{value:!0}),ys.expand_message_xmd=o,ys.expand_message_xof=a,ys.hash_to_field=f,ys.isogenyMap=c,ys.createHasher=l;const e=$f(),t=So(),r=t.bytesToNumberBE;function n(u,p){if(u<0||u>=1<<8*p)throw new Error(`bad I2OSP call: value=${u} length=${p}`);const d=Array.from({length:p}).fill(0);for(let h=p-1;h>=0;h--)d[h]=u&255,u>>>=8;return new Uint8Array(d)}function s(u,p){const d=new Uint8Array(u.length);for(let h=0;h<u.length;h++)d[h]=u[h]^p[h];return d}function i(u){if(!Number.isSafeInteger(u))throw new Error("number expected")}function o(u,p,d,h){(0,t.abytes)(u),(0,t.abytes)(p),i(d),p.length>255&&(p=h((0,t.concatBytes)((0,t.utf8ToBytes)("H2C-OVERSIZE-DST-"),p)));const{outputLen:y,blockLen:m}=h,v=Math.ceil(d/y);if(v>255)throw new Error("Invalid xmd length");const b=(0,t.concatBytes)(p,n(p.length,1)),w=n(0,m),_=n(d,2),C=new Array(v),I=h((0,t.concatBytes)(w,u,_,n(0,1),b));C[0]=h((0,t.concatBytes)(I,n(1,1),b));for(let E=1;E<=v;E++){const S=[s(I,C[E-1]),n(E+1,1),b];C[E]=h((0,t.concatBytes)(...S))}return(0,t.concatBytes)(...C).slice(0,d)}function a(u,p,d,h,y){if((0,t.abytes)(u),(0,t.abytes)(p),i(d),p.length>255){const m=Math.ceil(2*h/8);p=y.create({dkLen:m}).update((0,t.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(p).digest()}if(d>65535||p.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return y.create({dkLen:d}).update(u).update(n(d,2)).update(p).update(n(p.length,1)).digest()}function f(u,p,d){(0,t.validateObject)(d,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:h,k:y,m,hash:v,expand:b,DST:w}=d;(0,t.abytes)(u),i(p);const _=typeof w=="string"?(0,t.utf8ToBytes)(w):w,C=h.toString(2).length,I=Math.ceil((C+y)/8),k=p*m*I;let E;if(b==="xmd")E=o(u,_,k,v);else if(b==="xof")E=a(u,_,k,y,v);else if(b==="_internal_pass")E=u;else throw new Error('expand must be "xmd" or "xof"');const S=new Array(p);for(let T=0;T<p;T++){const P=new Array(m);for(let g=0;g<m;g++){const A=I*(g+T*m),x=E.subarray(A,A+I);P[g]=(0,e.mod)(r(x),h)}S[T]=P}return S}function c(u,p){const d=p.map(h=>Array.from(h).reverse());return(h,y)=>{const[m,v,b,w]=d.map(_=>_.reduce((C,I)=>u.add(u.mul(C,h),I)));return h=u.div(m,v),y=u.mul(y,u.div(b,w)),{x:h,y}}}function l(u,p,d){if(typeof p!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(h,y){const m=f(h,2,{...d,DST:d.DST,...y}),v=u.fromAffine(p(m[0])),b=u.fromAffine(p(m[1])),w=v.add(b).clearCofactor();return w.assertValidity(),w},encodeToCurve(h,y){const m=f(h,1,{...d,DST:d.encodeDST,...y}),v=u.fromAffine(p(m[0])).clearCofactor();return v.assertValidity(),v},mapToCurve(h){if(!Array.isArray(h))throw new Error("mapToCurve: expected array of bigints");for(const m of h)if(typeof m!="bigint")throw new Error(`mapToCurve: expected array of bigints, got ${m} in array`);const y=u.fromAffine(p(h)).clearCofactor();return y.assertValidity(),y}}}return ys}var B5;function uH(){return B5||(B5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.schnorr=e.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=iH(),r=Vs(),n=oH(),s=cH(),i=$f(),o=So(),a=XE(),f=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),c=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),l=BigInt(1),u=BigInt(2),p=(M,R)=>(M+R/u)/R;function d(M){const R=f,N=BigInt(3),F=BigInt(6),z=BigInt(11),Y=BigInt(22),j=BigInt(23),re=BigInt(44),V=BigInt(88),U=M*M*M%R,X=U*U*M%R,ye=(0,i.pow2)(X,N,R)*X%R,_e=(0,i.pow2)(ye,N,R)*X%R,Ae=(0,i.pow2)(_e,u,R)*U%R,H=(0,i.pow2)(Ae,z,R)*Ae%R,q=(0,i.pow2)(H,Y,R)*H%R,W=(0,i.pow2)(q,re,R)*q%R,ee=(0,i.pow2)(W,V,R)*W%R,le=(0,i.pow2)(ee,re,R)*q%R,ce=(0,i.pow2)(le,N,R)*X%R,ie=(0,i.pow2)(ce,j,R)*H%R,Fe=(0,i.pow2)(ie,F,R)*U%R,De=(0,i.pow2)(Fe,u,R);if(!h.eql(h.sqr(De),M))throw new Error("Cannot find square root");return De}const h=(0,i.Field)(f,void 0,void 0,{sqrt:d});e.secp256k1=(0,n.createCurve)({a:BigInt(0),b:BigInt(7),Fp:h,n:c,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:M=>{const R=c,N=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),F=-l*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),z=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),Y=N,j=BigInt("0x100000000000000000000000000000000"),re=p(Y*M,R),V=p(-F*M,R);let U=(0,i.mod)(M-re*N-V*z,R),X=(0,i.mod)(-re*F-V*Y,R);const ye=U>j,_e=X>j;if(ye&&(U=R-U),_e&&(X=R-X),U>j||X>j)throw new Error("splitScalar: Endomorphism failed, k="+M);return{k1neg:ye,k1:U,k2neg:_e,k2:X}}}},t.sha256);const y=BigInt(0),m=M=>typeof M=="bigint"&&y<M&&M<f,v=M=>typeof M=="bigint"&&y<M&&M<c,b={};function w(M,...R){let N=b[M];if(N===void 0){const F=(0,t.sha256)(Uint8Array.from(M,z=>z.charCodeAt(0)));N=(0,o.concatBytes)(F,F),b[M]=N}return(0,t.sha256)((0,o.concatBytes)(N,...R))}const _=M=>M.toRawBytes(!0).slice(1),C=M=>(0,o.numberToBytesBE)(M,32),I=M=>(0,i.mod)(M,f),k=M=>(0,i.mod)(M,c),E=e.secp256k1.ProjectivePoint,S=(M,R,N)=>E.BASE.multiplyAndAddUnsafe(M,R,N);function T(M){let R=e.secp256k1.utils.normPrivateKeyToScalar(M),N=E.fromPrivateKey(R);return{scalar:N.hasEvenY()?R:k(-R),bytes:_(N)}}function P(M){if(!m(M))throw new Error("bad x: need 0 < x < p");const R=I(M*M),N=I(R*M+BigInt(7));let F=d(N);F%u!==y&&(F=I(-F));const z=new E(M,F,l);return z.assertValidity(),z}function g(...M){return k((0,o.bytesToNumberBE)(w("BIP0340/challenge",...M)))}function A(M){return T(M).bytes}function x(M,R,N=(0,r.randomBytes)(32)){const F=(0,o.ensureBytes)("message",M),{bytes:z,scalar:Y}=T(R),j=(0,o.ensureBytes)("auxRand",N,32),re=C(Y^(0,o.bytesToNumberBE)(w("BIP0340/aux",j))),V=w("BIP0340/nonce",re,z,F),U=k((0,o.bytesToNumberBE)(V));if(U===y)throw new Error("sign failed: k is zero");const{bytes:X,scalar:ye}=T(U),_e=g(X,z,F),Ae=new Uint8Array(64);if(Ae.set(X,0),Ae.set(C(k(ye+_e*Y)),32),!D(Ae,F,z))throw new Error("sign: Invalid signature produced");return Ae}function D(M,R,N){const F=(0,o.ensureBytes)("signature",M,64),z=(0,o.ensureBytes)("message",R),Y=(0,o.ensureBytes)("publicKey",N,32);try{const j=P((0,o.bytesToNumberBE)(Y)),re=(0,o.bytesToNumberBE)(F.subarray(0,32));if(!m(re))return!1;const V=(0,o.bytesToNumberBE)(F.subarray(32,64));if(!v(V))return!1;const U=g(C(re),_(j),z),X=S(j,V,k(-U));return!(!X||!X.hasEvenY()||X.toAffine().x!==re)}catch{return!1}}e.schnorr=(()=>({getPublicKey:A,sign:x,verify:D,utils:{randomPrivateKey:e.secp256k1.utils.randomPrivateKey,lift_x:P,pointToBytes:_,numberToBytesBE:o.numberToBytesBE,bytesToNumberBE:o.bytesToNumberBE,taggedHash:w,mod:i.mod}}))();const O=(()=>(0,s.isogenyMap)(h,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(M=>M.map(R=>BigInt(R)))))(),B=(()=>(0,a.mapToCurveSimpleSWU)(h,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:h.create(BigInt("-11"))}))(),L=(()=>(0,s.createHasher)(e.secp256k1.ProjectivePoint,M=>{const{x:R,y:N}=B(h.create(M[0]));return O(R,N)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:h.ORDER,m:1,k:128,expand:"xmd",hash:t.sha256}))();e.hashToCurve=(()=>L.hashToCurve)(),e.encodeToCurve=(()=>L.encodeToCurve)()}(gp)),gp}var O5;function Vg(){return O5||(O5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.secp256k1=void 0;var t=uH();Object.defineProperty(e,"secp256k1",{enumerable:!0,get:function(){return t.secp256k1}})}(yp)),yp}var M5;function Gg(){return M5||(M5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MAX_WITHDRAWALS_PER_PAYLOAD=e.RLP_EMPTY_STRING=e.KECCAK256_RLP=e.KECCAK256_RLP_S=e.KECCAK256_RLP_ARRAY=e.KECCAK256_RLP_ARRAY_S=e.KECCAK256_NULL=e.KECCAK256_NULL_S=e.TWO_POW256=e.SECP256K1_ORDER_DIV_2=e.SECP256K1_ORDER=e.MAX_INTEGER_BIGINT=e.MAX_INTEGER=e.MAX_UINT64=void 0;const t=e9(),r=Vg();e.MAX_UINT64=BigInt("0xffffffffffffffff"),e.MAX_INTEGER=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),e.MAX_INTEGER_BIGINT=BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),e.SECP256K1_ORDER=r.secp256k1.CURVE.n,e.SECP256K1_ORDER_DIV_2=r.secp256k1.CURVE.n/BigInt(2),e.TWO_POW256=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),e.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",e.KECCAK256_NULL=t.Buffer.from(e.KECCAK256_NULL_S,"hex"),e.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",e.KECCAK256_RLP_ARRAY=t.Buffer.from(e.KECCAK256_RLP_ARRAY_S,"hex"),e.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",e.KECCAK256_RLP=t.Buffer.from(e.KECCAK256_RLP_S,"hex"),e.RLP_EMPTY_STRING=t.Buffer.from([128]),e.MAX_WITHDRAWALS_PER_PAYLOAD=16}(pp)),pp}var tc={},N5;function lH(){return N5||(N5=1,Object.defineProperty(tc,"__esModule",{value:!0}),tc.GWEI_TO_WEI=void 0,tc.GWEI_TO_WEI=BigInt(1e9)),tc}var _p={},Yn={},U5;function dH(){if(U5)return Yn;U5=1,Object.defineProperty(Yn,"__esModule",{value:!0}),Yn.RLP=Yn.utils=Yn.decode=Yn.encode=void 0;function e(v){if(Array.isArray(v)){const w=[];let _=0;for(let C=0;C<v.length;C++){const I=e(v[C]);w.push(I),_+=I.length}return l(n(_,192),...w)}const b=m(v);return b.length===1&&b[0]<128?b:l(n(b.length,128),b)}Yn.encode=e;function t(v,b,w){if(w>v.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return v.slice(b,w)}function r(v){if(v[0]===0)throw new Error("invalid RLP: extra zeros");return f(a(v))}function n(v,b){if(v<56)return Uint8Array.from([v+b]);const w=p(v),_=w.length/2,C=p(b+55+_);return Uint8Array.from(c(C+w))}function s(v,b=!1){if(typeof v>"u"||v===null||v.length===0)return Uint8Array.from([]);const w=m(v),_=i(w);if(b)return _;if(_.remainder.length!==0)throw new Error("invalid RLP: remainder must be zero");return _.data}Yn.decode=s;function i(v){let b,w,_,C,I;const k=[],E=v[0];if(E<=127)return{data:v.slice(0,1),remainder:v.slice(1)};if(E<=183){if(b=E-127,E===128?_=Uint8Array.from([]):_=t(v,1,b),b===2&&_[0]<128)throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed");return{data:_,remainder:v.slice(b)}}else if(E<=191){if(w=E-182,v.length-1<w)throw new Error("invalid RLP: not enough bytes for string length");if(b=r(t(v,1,w)),b<=55)throw new Error("invalid RLP: expected string length to be greater than 55");return _=t(v,w,b+w),{data:_,remainder:v.slice(b+w)}}else if(E<=247){for(b=E-191,C=t(v,1,b);C.length;)I=i(C),k.push(I.data),C=I.remainder;return{data:k,remainder:v.slice(b)}}else{if(w=E-246,b=r(t(v,1,w)),b<56)throw new Error("invalid RLP: encoded list too short");const S=w+b;if(S>v.length)throw new Error("invalid RLP: total length is larger than the data");for(C=t(v,w,S);C.length;)I=i(C),k.push(I.data),C=I.remainder;return{data:k,remainder:v.slice(S)}}}const o=Array.from({length:256},(v,b)=>b.toString(16).padStart(2,"0"));function a(v){let b="";for(let w=0;w<v.length;w++)b+=o[v[w]];return b}function f(v){const b=Number.parseInt(v,16);if(Number.isNaN(b))throw new Error("Invalid byte sequence");return b}function c(v){if(typeof v!="string")throw new TypeError("hexToBytes: expected string, got "+typeof v);if(v.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const b=new Uint8Array(v.length/2);for(let w=0;w<b.length;w++){const _=w*2;b[w]=f(v.slice(_,_+2))}return b}function l(...v){if(v.length===1)return v[0];const b=v.reduce((_,C)=>_+C.length,0),w=new Uint8Array(b);for(let _=0,C=0;_<v.length;_++){const I=v[_];w.set(I,C),C+=I.length}return w}function u(v){return new TextEncoder().encode(v)}function p(v){if(v<0)throw new Error("Invalid integer as argument, must be unsigned!");const b=v.toString(16);return b.length%2?`0${b}`:b}function d(v){return v.length%2?`0${v}`:v}function h(v){return v.length>=2&&v[0]==="0"&&v[1]==="x"}function y(v){return typeof v!="string"?v:h(v)?v.slice(2):v}function m(v){if(v instanceof Uint8Array)return v;if(typeof v=="string")return h(v)?c(d(y(v))):u(v);if(typeof v=="number"||typeof v=="bigint")return v?c(p(v)):Uint8Array.from([]);if(v==null)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof v)}return Yn.utils={bytesToHex:a,concatBytes:l,hexToBytes:c,utf8ToBytes:u},Yn.RLP={encode:e,decode:s},Yn}var Zn={},nr={},It={},L5;function fH(){if(L5)return It;L5=1,Object.defineProperty(It,"__esModule",{value:!0}),It.add5L=It.add5H=It.add4H=It.add4L=It.add3H=It.add3L=It.add=It.rotlBL=It.rotlBH=It.rotlSL=It.rotlSH=It.rotr32L=It.rotr32H=It.rotrBL=It.rotrBH=It.rotrSL=It.rotrSH=It.shrSL=It.shrSH=It.toBig=It.split=It.fromBig=void 0;const e=BigInt(2**32-1),t=BigInt(32);function r(S,T=!1){return T?{h:Number(S&e),l:Number(S>>t&e)}:{h:Number(S>>t&e)|0,l:Number(S&e)|0}}It.fromBig=r;function n(S,T=!1){let P=new Uint32Array(S.length),g=new Uint32Array(S.length);for(let A=0;A<S.length;A++){const{h:x,l:D}=r(S[A],T);[P[A],g[A]]=[x,D]}return[P,g]}It.split=n;const s=(S,T)=>BigInt(S>>>0)<<t|BigInt(T>>>0);It.toBig=s;const i=(S,T,P)=>S>>>P;It.shrSH=i;const o=(S,T,P)=>S<<32-P|T>>>P;It.shrSL=o;const a=(S,T,P)=>S>>>P|T<<32-P;It.rotrSH=a;const f=(S,T,P)=>S<<32-P|T>>>P;It.rotrSL=f;const c=(S,T,P)=>S<<64-P|T>>>P-32;It.rotrBH=c;const l=(S,T,P)=>S>>>P-32|T<<64-P;It.rotrBL=l;const u=(S,T)=>T;It.rotr32H=u;const p=(S,T)=>S;It.rotr32L=p;const d=(S,T,P)=>S<<P|T>>>32-P;It.rotlSH=d;const h=(S,T,P)=>T<<P|S>>>32-P;It.rotlSL=h;const y=(S,T,P)=>T<<P-32|S>>>64-P;It.rotlBH=y;const m=(S,T,P)=>S<<P-32|T>>>64-P;It.rotlBL=m;function v(S,T,P,g){const A=(T>>>0)+(g>>>0);return{h:S+P+(A/2**32|0)|0,l:A|0}}It.add=v;const b=(S,T,P)=>(S>>>0)+(T>>>0)+(P>>>0);It.add3L=b;const w=(S,T,P,g)=>T+P+g+(S/2**32|0)|0;It.add3H=w;const _=(S,T,P,g)=>(S>>>0)+(T>>>0)+(P>>>0)+(g>>>0);It.add4L=_;const C=(S,T,P,g,A)=>T+P+g+A+(S/2**32|0)|0;It.add4H=C;const I=(S,T,P,g,A)=>(S>>>0)+(T>>>0)+(P>>>0)+(g>>>0)+(A>>>0);It.add5L=I;const k=(S,T,P,g,A,x)=>T+P+g+A+x+(S/2**32|0)|0;It.add5H=k;const E={fromBig:r,split:n,toBig:s,shrSH:i,shrSL:o,rotrSH:a,rotrSL:f,rotrBH:c,rotrBL:l,rotr32H:u,rotr32L:p,rotlSH:d,rotlSL:h,rotlBH:y,rotlBL:m,add:v,add3L:b,add3H:w,add4L:_,add4H:C,add5H:k,add5L:I};return It.default=E,It}var K5;function hH(){if(K5)return nr;K5=1,Object.defineProperty(nr,"__esModule",{value:!0}),nr.shake256=nr.shake128=nr.keccak_512=nr.keccak_384=nr.keccak_256=nr.keccak_224=nr.sha3_512=nr.sha3_384=nr.sha3_256=nr.sha3_224=nr.Keccak=nr.keccakP=void 0;const e=nl(),t=fH(),r=Vs(),n=[],s=[],i=[],o=BigInt(0),a=BigInt(1),f=BigInt(2),c=BigInt(7),l=BigInt(256),u=BigInt(113);for(let _=0,C=a,I=1,k=0;_<24;_++){[I,k]=[k,(2*I+3*k)%5],n.push(2*(5*k+I)),s.push((_+1)*(_+2)/2%64);let E=o;for(let S=0;S<7;S++)C=(C<<a^(C>>c)*u)%l,C&f&&(E^=a<<(a<<BigInt(S))-a);i.push(E)}const[p,d]=(0,t.split)(i,!0),h=(_,C,I)=>I>32?(0,t.rotlBH)(_,C,I):(0,t.rotlSH)(_,C,I),y=(_,C,I)=>I>32?(0,t.rotlBL)(_,C,I):(0,t.rotlSL)(_,C,I);function m(_,C=24){const I=new Uint32Array(10);for(let k=24-C;k<24;k++){for(let T=0;T<10;T++)I[T]=_[T]^_[T+10]^_[T+20]^_[T+30]^_[T+40];for(let T=0;T<10;T+=2){const P=(T+8)%10,g=(T+2)%10,A=I[g],x=I[g+1],D=h(A,x,1)^I[P],O=y(A,x,1)^I[P+1];for(let B=0;B<50;B+=10)_[T+B]^=D,_[T+B+1]^=O}let E=_[2],S=_[3];for(let T=0;T<24;T++){const P=s[T],g=h(E,S,P),A=y(E,S,P),x=n[T];E=_[x],S=_[x+1],_[x]=g,_[x+1]=A}for(let T=0;T<50;T+=10){for(let P=0;P<10;P++)I[P]=_[T+P];for(let P=0;P<10;P++)_[T+P]^=~I[(P+2)%10]&I[(P+4)%10]}_[0]^=p[k],_[1]^=d[k]}I.fill(0)}nr.keccakP=m;class v extends r.Hash{constructor(C,I,k,E=!1,S=24){if(super(),this.blockLen=C,this.suffix=I,this.outputLen=k,this.enableXOF=E,this.rounds=S,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,e.number)(k),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,r.u32)(this.state)}keccak(){r.isLE||(0,r.byteSwap32)(this.state32),m(this.state32,this.rounds),r.isLE||(0,r.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(C){(0,e.exists)(this);const{blockLen:I,state:k}=this;C=(0,r.toBytes)(C);const E=C.length;for(let S=0;S<E;){const T=Math.min(I-this.pos,E-S);for(let P=0;P<T;P++)k[this.pos++]^=C[S++];this.pos===I&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:C,suffix:I,pos:k,blockLen:E}=this;C[k]^=I,I&128&&k===E-1&&this.keccak(),C[E-1]^=128,this.keccak()}writeInto(C){(0,e.exists)(this,!1),(0,e.bytes)(C),this.finish();const I=this.state,{blockLen:k}=this;for(let E=0,S=C.length;E<S;){this.posOut>=k&&this.keccak();const T=Math.min(k-this.posOut,S-E);C.set(I.subarray(this.posOut,this.posOut+T),E),this.posOut+=T,E+=T}return C}xofInto(C){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(C)}xof(C){return(0,e.number)(C),this.xofInto(new Uint8Array(C))}digestInto(C){if((0,e.output)(C,this),this.finished)throw new Error("digest() was already called");return this.writeInto(C),this.destroy(),C}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(C){const{blockLen:I,suffix:k,outputLen:E,rounds:S,enableXOF:T}=this;return C||(C=new v(I,k,E,T,S)),C.state32.set(this.state32),C.pos=this.pos,C.posOut=this.posOut,C.finished=this.finished,C.rounds=S,C.suffix=k,C.outputLen=E,C.enableXOF=T,C.destroyed=this.destroyed,C}}nr.Keccak=v;const b=(_,C,I)=>(0,r.wrapConstructor)(()=>new v(C,_,I));nr.sha3_224=b(6,144,224/8),nr.sha3_256=b(6,136,256/8),nr.sha3_384=b(6,104,384/8),nr.sha3_512=b(6,72,512/8),nr.keccak_224=b(1,144,224/8),nr.keccak_256=b(1,136,256/8),nr.keccak_384=b(1,104,384/8),nr.keccak_512=b(1,72,512/8);const w=(_,C,I)=>(0,r.wrapXOFConstructorWithOpts)((k={})=>new v(C,_,k.dkLen===void 0?I:k.dkLen,!0));return nr.shake128=w(31,168,128/8),nr.shake256=w(31,136,256/8),nr}var d0={exports:{}};d0.exports;var F5;function QE(){return F5||(F5=1,function(e,t){var r=rt&&rt.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=t.utf8ToBytes=t.createView=t.concatBytes=t.toHex=t.bytesToHex=t.assertBytes=t.assertBool=void 0,t.bytesToUtf8=f,t.hexToBytes=c,t.equalsBytes=l,t.wrapHash=u;const n=r(nl()),s=Vs(),i=n.default.bool;t.assertBool=i;const o=n.default.bytes;t.assertBytes=o;var a=Vs();Object.defineProperty(t,"bytesToHex",{enumerable:!0,get:function(){return a.bytesToHex}}),Object.defineProperty(t,"toHex",{enumerable:!0,get:function(){return a.bytesToHex}}),Object.defineProperty(t,"concatBytes",{enumerable:!0,get:function(){return a.concatBytes}}),Object.defineProperty(t,"createView",{enumerable:!0,get:function(){return a.createView}}),Object.defineProperty(t,"utf8ToBytes",{enumerable:!0,get:function(){return a.utf8ToBytes}});function f(p){if(!(p instanceof Uint8Array))throw new TypeError(`bytesToUtf8 expected Uint8Array, got ${typeof p}`);return new TextDecoder().decode(p)}function c(p){const d=p.startsWith("0x")?p.substring(2):p;return(0,s.hexToBytes)(d)}function l(p,d){if(p.length!==d.length)return!1;for(let h=0;h<p.length;h++)if(p[h]!==d[h])return!1;return!0}function u(p){return d=>(n.default.bytes(d),p(d))}t.crypto=(()=>{const p=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,d=typeof ka=="function"&&ka.bind(e);return{node:d&&!p?d("crypto"):void 0,web:p}})()}(d0,d0.exports)),d0.exports}var q5;function eA(){if(q5)return Zn;q5=1,Object.defineProperty(Zn,"__esModule",{value:!0}),Zn.keccak512=Zn.keccak384=Zn.keccak256=Zn.keccak224=void 0;const e=hH(),t=QE();return Zn.keccak224=(0,t.wrapHash)(e.keccak_224),Zn.keccak256=(()=>{const r=(0,t.wrapHash)(e.keccak_256);return r.create=e.keccak_256.create,r})(),Zn.keccak384=(0,t.wrapHash)(e.keccak_384),Zn.keccak512=(0,t.wrapHash)(e.keccak_512),Zn}var wp={},Jn={},mr={},j5;function il(){if(j5)return mr;j5=1,Object.defineProperty(mr,"__esModule",{value:!0}),mr.isHexString=mr.getKeys=mr.fromAscii=mr.fromUtf8=mr.toAscii=mr.arrayContainsArray=mr.getBinarySize=mr.padToEven=mr.stripHexPrefix=mr.isHexPrefixed=void 0;function e(l){if(typeof l!="string")throw new Error(`[isHexPrefixed] input must be type 'string', received type ${typeof l}`);return l[0]==="0"&&l[1]==="x"}mr.isHexPrefixed=e;const t=l=>{if(typeof l!="string")throw new Error(`[stripHexPrefix] input must be type 'string', received ${typeof l}`);return e(l)?l.slice(2):l};mr.stripHexPrefix=t;function r(l){let u=l;if(typeof u!="string")throw new Error(`[padToEven] value must be type 'string', received ${typeof u}`);return u.length%2&&(u=`0${u}`),u}mr.padToEven=r;function n(l){if(typeof l!="string")throw new Error(`[getBinarySize] method requires input type 'string', received ${typeof l}`);return ot.byteLength(l,"utf8")}mr.getBinarySize=n;function s(l,u,p){if(Array.isArray(l)!==!0)throw new Error(`[arrayContainsArray] method requires input 'superset' to be an array, got type '${typeof l}'`);if(Array.isArray(u)!==!0)throw new Error(`[arrayContainsArray] method requires input 'subset' to be an array, got type '${typeof u}'`);return u[p===!0?"some":"every"](d=>l.indexOf(d)>=0)}mr.arrayContainsArray=s;function i(l){let u="",p=0;const d=l.length;for(l.substring(0,2)==="0x"&&(p=2);p<d;p+=2){const h=parseInt(l.substr(p,2),16);u+=String.fromCharCode(h)}return u}mr.toAscii=i;function o(l){const u=ot.from(l,"utf8");return`0x${r(u.toString("hex")).replace(/^0+|0+$/g,"")}`}mr.fromUtf8=o;function a(l){let u="";for(let p=0;p<l.length;p++){const h=l.charCodeAt(p).toString(16);u+=h.length<2?`0${h}`:h}return`0x${u}`}mr.fromAscii=a;function f(l,u,p){if(!Array.isArray(l))throw new Error(`[getKeys] method expects input 'params' to be an array, got ${typeof l}`);if(typeof u!="string")throw new Error(`[getKeys] method expects input 'key' to be type 'string', got ${typeof l}`);const d=[];for(let h=0;h<l.length;h++){let y=l[h][u];if(p===!0&&!y)y="";else if(typeof y!="string")throw new Error(`invalid abi - expected type 'string', received ${typeof y}`);d.push(y)}return d}mr.getKeys=f;function c(l,u){return!(typeof l!="string"||!l.match(/^0x[0-9A-Fa-f]*$/)||typeof u<"u"&&u>0&&l.length!==2+2*u)}return mr.isHexString=c,mr}var $5;function zg(){if($5)return Jn;$5=1,Object.defineProperty(Jn,"__esModule",{value:!0}),Jn.assertIsString=Jn.assertIsArray=Jn.assertIsBuffer=Jn.assertIsHexString=void 0;const e=il(),t=function(i){if(!(0,e.isHexString)(i)){const o=`This method only supports 0x-prefixed hex strings but input was: ${i}`;throw new Error(o)}};Jn.assertIsHexString=t;const r=function(i){if(!ot.isBuffer(i)){const o=`This method only supports Buffer but input was: ${i}`;throw new Error(o)}};Jn.assertIsBuffer=r;const n=function(i){if(!Array.isArray(i)){const o=`This method only supports number arrays but input was: ${i}`;throw new Error(o)}};Jn.assertIsArray=n;const s=function(i){if(typeof i!="string"){const o=`This method only supports strings but input was: ${i}`;throw new Error(o)}};return Jn.assertIsString=s,Jn}var H5;function Do(){return H5||(H5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.intToUnpaddedBuffer=e.bigIntToUnpaddedBuffer=e.bigIntToHex=e.bufArrToArr=e.arrToBufArr=e.validateNoLeadingZeroes=e.baToJSON=e.toUtf8=e.short=e.addHexPrefix=e.toUnsigned=e.fromSigned=e.bufferToInt=e.bigIntToBuffer=e.bufferToBigInt=e.bufferToHex=e.toBuffer=e.unpadHexString=e.unpadArray=e.unpadBuffer=e.setLengthRight=e.setLengthLeft=e.zeros=e.intToBuffer=e.intToHex=void 0;const t=zg(),r=il(),n=function(x){if(!Number.isSafeInteger(x)||x<0)throw new Error(`Received an invalid integer type: ${x}`);return`0x${x.toString(16)}`};e.intToHex=n;const s=function(x){const D=(0,e.intToHex)(x);return ot.from((0,r.padToEven)(D.slice(2)),"hex")};e.intToBuffer=s;const i=function(x){return ot.allocUnsafe(x).fill(0)};e.zeros=i;const o=function(x,D,O){const B=(0,e.zeros)(D);return O?x.length<D?(x.copy(B),B):x.slice(0,D):x.length<D?(x.copy(B,D-x.length),B):x.slice(-D)},a=function(x,D){return(0,t.assertIsBuffer)(x),o(x,D,!1)};e.setLengthLeft=a;const f=function(x,D){return(0,t.assertIsBuffer)(x),o(x,D,!0)};e.setLengthRight=f;const c=function(x){let D=x[0];for(;x.length>0&&D.toString()==="0";)x=x.slice(1),D=x[0];return x},l=function(x){return(0,t.assertIsBuffer)(x),c(x)};e.unpadBuffer=l;const u=function(x){return(0,t.assertIsArray)(x),c(x)};e.unpadArray=u;const p=function(x){return(0,t.assertIsHexString)(x),x=(0,r.stripHexPrefix)(x),"0x"+c(x)};e.unpadHexString=p;const d=function(x){if(x==null)return ot.allocUnsafe(0);if(ot.isBuffer(x))return ot.from(x);if(Array.isArray(x)||x instanceof Uint8Array)return ot.from(x);if(typeof x=="string"){if(!(0,r.isHexString)(x))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${x}`);return ot.from((0,r.padToEven)((0,r.stripHexPrefix)(x)),"hex")}if(typeof x=="number")return(0,e.intToBuffer)(x);if(typeof x=="bigint"){if(x<BigInt(0))throw new Error(`Cannot convert negative bigint to buffer. Given: ${x}`);let D=x.toString(16);return D.length%2&&(D="0"+D),ot.from(D,"hex")}if(x.toArray)return ot.from(x.toArray());if(x.toBuffer)return ot.from(x.toBuffer());throw new Error("invalid type")};e.toBuffer=d;const h=function(x){return x=(0,e.toBuffer)(x),"0x"+x.toString("hex")};e.bufferToHex=h;function y(x){const D=(0,e.bufferToHex)(x);return BigInt(D==="0x"?0:D)}e.bufferToBigInt=y;function m(x){return(0,e.toBuffer)("0x"+x.toString(16))}e.bigIntToBuffer=m;const v=function(x){const D=Number(y(x));if(!Number.isSafeInteger(D))throw new Error("Number exceeds 53 bits");return D};e.bufferToInt=v;const b=function(x){return BigInt.asIntN(256,y(x))};e.fromSigned=b;const w=function(x){return m(BigInt.asUintN(256,x))};e.toUnsigned=w;const _=function(x){return typeof x!="string"||(0,r.isHexPrefixed)(x)?x:"0x"+x};e.addHexPrefix=_;function C(x,D=50){const O=ot.isBuffer(x)?x.toString("hex"):x;return O.length<=D?O:O.slice(0,D)+"…"}e.short=C;const I=function(x){const D=/^(00)+|(00)+$/g;if(x=(0,r.stripHexPrefix)(x),x.length%2!==0)throw new Error("Invalid non-even hex string input for toUtf8() provided");return ot.from(x.replace(D,""),"hex").toString("utf8")};e.toUtf8=I;const k=function(x){if(ot.isBuffer(x))return`0x${x.toString("hex")}`;if(x instanceof Array){const D=[];for(let O=0;O<x.length;O++)D.push((0,e.baToJSON)(x[O]));return D}};e.baToJSON=k;const E=function(x){for(const[D,O]of Object.entries(x))if(O!==void 0&&O.length>0&&O[0]===0)throw new Error(`${D} cannot have leading zeroes, received: ${O.toString("hex")}`)};e.validateNoLeadingZeroes=E;function S(x){return Array.isArray(x)?x.map(D=>S(D)):ot.from(x)}e.arrToBufArr=S;function T(x){return Array.isArray(x)?x.map(D=>T(D)):Uint8Array.from(x??[])}e.bufArrToArr=T;const P=x=>"0x"+x.toString(16);e.bigIntToHex=P;function g(x){return(0,e.unpadBuffer)(m(x))}e.bigIntToUnpaddedBuffer=g;function A(x){return(0,e.unpadBuffer)((0,e.intToBuffer)(x))}e.intToUnpaddedBuffer=A}(wp)),wp}var V5;function tA(){return V5||(V5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.accountBodyToRLP=e.accountBodyToSlim=e.accountBodyFromSlim=e.isZeroAddress=e.zeroAddress=e.importPublic=e.privateToAddress=e.privateToPublic=e.publicToAddress=e.pubToAddress=e.isValidPublic=e.isValidPrivate=e.generateAddress2=e.generateAddress=e.isValidChecksumAddress=e.toChecksumAddress=e.isValidAddress=e.Account=void 0;const t=dH(),r=eA(),n=Vg(),s=QE(),i=Do(),o=Gg(),a=zg(),f=il(),c=BigInt(0);class l{constructor(A=c,x=c,D=o.KECCAK256_RLP,O=o.KECCAK256_NULL){this.nonce=A,this.balance=x,this.storageRoot=D,this.codeHash=O,this._validate()}static fromAccountData(A){const{nonce:x,balance:D,storageRoot:O,codeHash:B}=A;return new l(x!==void 0?(0,i.bufferToBigInt)((0,i.toBuffer)(x)):void 0,D!==void 0?(0,i.bufferToBigInt)((0,i.toBuffer)(D)):void 0,O!==void 0?(0,i.toBuffer)(O):void 0,B!==void 0?(0,i.toBuffer)(B):void 0)}static fromRlpSerializedAccount(A){const x=(0,i.arrToBufArr)(t.RLP.decode(Uint8Array.from(A)));if(!Array.isArray(x))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(x)}static fromValuesArray(A){const[x,D,O,B]=A;return new l((0,i.bufferToBigInt)(x),(0,i.bufferToBigInt)(D),O,B)}_validate(){if(this.nonce<c)throw new Error("nonce must be greater than zero");if(this.balance<c)throw new Error("balance must be greater than zero");if(this.storageRoot.length!==32)throw new Error("storageRoot must have a length of 32");if(this.codeHash.length!==32)throw new Error("codeHash must have a length of 32")}raw(){return[(0,i.bigIntToUnpaddedBuffer)(this.nonce),(0,i.bigIntToUnpaddedBuffer)(this.balance),this.storageRoot,this.codeHash]}serialize(){return ot.from(t.RLP.encode((0,i.bufArrToArr)(this.raw())))}isContract(){return!this.codeHash.equals(o.KECCAK256_NULL)}isEmpty(){return this.balance===c&&this.nonce===c&&this.codeHash.equals(o.KECCAK256_NULL)}}e.Account=l;const u=function(g){try{(0,a.assertIsString)(g)}catch{return!1}return/^0x[0-9a-fA-F]{40}$/.test(g)};e.isValidAddress=u;const p=function(g,A){(0,a.assertIsHexString)(g);const x=(0,f.stripHexPrefix)(g).toLowerCase();let D="";A!==void 0&&(D=(0,i.bufferToBigInt)((0,i.toBuffer)(A)).toString()+"0x");const O=ot.from(D+x,"utf8"),B=(0,s.bytesToHex)((0,r.keccak256)(O));let L="0x";for(let M=0;M<x.length;M++)parseInt(B[M],16)>=8?L+=x[M].toUpperCase():L+=x[M];return L};e.toChecksumAddress=p;const d=function(g,A){return(0,e.isValidAddress)(g)&&(0,e.toChecksumAddress)(g,A)===g};e.isValidChecksumAddress=d;const h=function(g,A){return(0,a.assertIsBuffer)(g),(0,a.assertIsBuffer)(A),(0,i.bufferToBigInt)(A)===BigInt(0)?ot.from((0,r.keccak256)(t.RLP.encode((0,i.bufArrToArr)([g,null])))).slice(-20):ot.from((0,r.keccak256)(t.RLP.encode((0,i.bufArrToArr)([g,A])))).slice(-20)};e.generateAddress=h;const y=function(g,A,x){if((0,a.assertIsBuffer)(g),(0,a.assertIsBuffer)(A),(0,a.assertIsBuffer)(x),g.length!==20)throw new Error("Expected from to be of length 20");if(A.length!==32)throw new Error("Expected salt to be of length 32");const D=(0,r.keccak256)(ot.concat([ot.from("ff","hex"),g,A,(0,r.keccak256)(x)]));return(0,i.toBuffer)(D).slice(-20)};e.generateAddress2=y;const m=function(g){return n.secp256k1.utils.isValidPrivateKey(g)};e.isValidPrivate=m;const v=function(g,A=!1){if((0,a.assertIsBuffer)(g),g.length===64)try{return n.secp256k1.ProjectivePoint.fromHex(ot.concat([ot.from([4]),g])),!0}catch{return!1}if(!A)return!1;try{return n.secp256k1.ProjectivePoint.fromHex(g),!0}catch{return!1}};e.isValidPublic=v;const b=function(g,A=!1){if((0,a.assertIsBuffer)(g),A&&g.length!==64&&(g=ot.from(n.secp256k1.ProjectivePoint.fromHex(g).toRawBytes(!1).slice(1))),g.length!==64)throw new Error("Expected pubKey to be of length 64");return ot.from((0,r.keccak256)(g)).slice(-20)};e.pubToAddress=b,e.publicToAddress=e.pubToAddress;const w=function(g){return(0,a.assertIsBuffer)(g),ot.from(n.secp256k1.ProjectivePoint.fromPrivateKey(g).toRawBytes(!1).slice(1))};e.privateToPublic=w;const _=function(g){return(0,e.publicToAddress)((0,e.privateToPublic)(g))};e.privateToAddress=_;const C=function(g){return(0,a.assertIsBuffer)(g),g.length!==64&&(g=ot.from(n.secp256k1.ProjectivePoint.fromHex(g).toRawBytes(!1).slice(1))),g};e.importPublic=C;const I=function(){const A=(0,i.zeros)(20);return(0,i.bufferToHex)(A)};e.zeroAddress=I;const k=function(g){try{(0,a.assertIsString)(g)}catch{return!1}return(0,e.zeroAddress)()===g};e.isZeroAddress=k;function E(g){const[A,x,D,O]=g;return[A,x,(0,i.arrToBufArr)(D).length===0?o.KECCAK256_RLP:D,(0,i.arrToBufArr)(O).length===0?o.KECCAK256_NULL:O]}e.accountBodyFromSlim=E;const S=new Uint8Array(0);function T(g){const[A,x,D,O]=g;return[A,x,(0,i.arrToBufArr)(D).equals(o.KECCAK256_RLP)?S:D,(0,i.arrToBufArr)(O).equals(o.KECCAK256_NULL)?S:O]}e.accountBodyToSlim=T;function P(g,A=!0){const x=A?E(g):g;return(0,i.arrToBufArr)(t.RLP.encode(x))}e.accountBodyToRLP=P}(_p)),_p}var rc={},G5;function rA(){if(G5)return rc;G5=1,Object.defineProperty(rc,"__esModule",{value:!0}),rc.Address=void 0;const e=tA(),t=Do();class r{constructor(s){if(s.length!==20)throw new Error("Invalid address length");this.buf=s}static zero(){return new r((0,t.zeros)(20))}static fromString(s){if(!(0,e.isValidAddress)(s))throw new Error("Invalid address");return new r((0,t.toBuffer)(s))}static fromPublicKey(s){if(!ot.isBuffer(s))throw new Error("Public key should be Buffer");const i=(0,e.pubToAddress)(s);return new r(i)}static fromPrivateKey(s){if(!ot.isBuffer(s))throw new Error("Private key should be Buffer");const i=(0,e.privateToAddress)(s);return new r(i)}static generate(s,i){if(typeof i!="bigint")throw new Error("Expected nonce to be a bigint");return new r((0,e.generateAddress)(s.buf,(0,t.bigIntToBuffer)(i)))}static generate2(s,i,o){if(!ot.isBuffer(i))throw new Error("Expected salt to be a Buffer");if(!ot.isBuffer(o))throw new Error("Expected initCode to be a Buffer");return new r((0,e.generateAddress2)(s.buf,i,o))}equals(s){return this.buf.equals(s.buf)}isZero(){return this.equals(r.zero())}isPrecompileOrSystemAddress(){const s=(0,t.bufferToBigInt)(this.buf),i=BigInt(0),o=BigInt("0xffff");return s>=i&&s<=o}toString(){return"0x"+this.buf.toString("hex")}toBuffer(){return ot.from(this.buf)}}return rc.Address=r,rc}var nc={},Ep={},z5;function nA(){return z5||(z5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.toType=e.TypeOutput=void 0;const t=Do(),r=il();var n;(function(i){i[i.Number=0]="Number",i[i.BigInt=1]="BigInt",i[i.Buffer=2]="Buffer",i[i.PrefixedHexString=3]="PrefixedHexString"})(n=e.TypeOutput||(e.TypeOutput={}));function s(i,o){if(i===null)return null;if(i===void 0)return;if(typeof i=="string"&&!(0,r.isHexString)(i))throw new Error(`A string must be provided with a 0x-prefix, given: ${i}`);if(typeof i=="number"&&!Number.isSafeInteger(i))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");const a=(0,t.toBuffer)(i);switch(o){case n.Buffer:return a;case n.BigInt:return(0,t.bufferToBigInt)(a);case n.Number:{const f=(0,t.bufferToBigInt)(a);if(f>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(f)}case n.PrefixedHexString:return(0,t.bufferToHex)(a);default:throw new Error("unknown outputType")}}e.toType=s}(Ep)),Ep}var W5;function pH(){if(W5)return nc;W5=1,Object.defineProperty(nc,"__esModule",{value:!0}),nc.Withdrawal=void 0;const e=rA(),t=Do(),r=nA();class n{constructor(i,o,a,f){this.index=i,this.validatorIndex=o,this.address=a,this.amount=f}static fromWithdrawalData(i){const{index:o,validatorIndex:a,address:f,amount:c}=i,l=(0,r.toType)(o,r.TypeOutput.BigInt),u=(0,r.toType)(a,r.TypeOutput.BigInt),p=new e.Address((0,r.toType)(f,r.TypeOutput.Buffer)),d=(0,r.toType)(c,r.TypeOutput.BigInt);return new n(l,u,p,d)}static fromValuesArray(i){if(i.length!==4)throw Error(`Invalid withdrawalArray length expected=4 actual=${i.length}`);const[o,a,f,c]=i;return n.fromWithdrawalData({index:o,validatorIndex:a,address:f,amount:c})}static toBufferArray(i){const{index:o,validatorIndex:a,address:f,amount:c}=i,l=(0,r.toType)(o,r.TypeOutput.BigInt)===BigInt(0)?ot.alloc(0):(0,r.toType)(o,r.TypeOutput.Buffer),u=(0,r.toType)(a,r.TypeOutput.BigInt)===BigInt(0)?ot.alloc(0):(0,r.toType)(a,r.TypeOutput.Buffer);let p;f instanceof e.Address?p=f.buf:p=(0,r.toType)(f,r.TypeOutput.Buffer);const d=(0,r.toType)(c,r.TypeOutput.BigInt)===BigInt(0)?ot.alloc(0):(0,r.toType)(c,r.TypeOutput.Buffer);return[l,u,p,d]}raw(){return n.toBufferArray(this)}toValue(){return{index:this.index,validatorIndex:this.validatorIndex,address:this.address.buf,amount:this.amount}}toJSON(){return{index:(0,t.bigIntToHex)(this.index),validatorIndex:(0,t.bigIntToHex)(this.validatorIndex),address:"0x"+this.address.buf.toString("hex"),amount:(0,t.bigIntToHex)(this.amount)}}}return nc.Withdrawal=n,nc}var $r={},Y5;function yH(){if(Y5)return $r;Y5=1,Object.defineProperty($r,"__esModule",{value:!0}),$r.hashPersonalMessage=$r.isValidSignature=$r.fromRpcSig=$r.toCompactSig=$r.toRpcSig=$r.ecrecover=$r.ecsign=void 0;const e=eA(),t=Vg(),r=Do(),n=Gg(),s=zg();function i(h,y,m){const v=t.secp256k1.sign(h,y),b=v.toCompactRawBytes(),w=ot.from(b.slice(0,32)),_=ot.from(b.slice(32,64)),C=m===void 0?BigInt(v.recovery+27):BigInt(v.recovery+35)+BigInt(m)*BigInt(2);return{r:w,s:_,v:C}}$r.ecsign=i;function o(h,y){return h===BigInt(0)||h===BigInt(1)?h:y===void 0?h-BigInt(27):h-(y*BigInt(2)+BigInt(35))}function a(h){return h===BigInt(0)||h===BigInt(1)}const f=function(h,y,m,v,b){const w=ot.concat([(0,r.setLengthLeft)(m,32),(0,r.setLengthLeft)(v,32)],64),_=o(y,b);if(!a(_))throw new Error("Invalid signature v value");const I=t.secp256k1.Signature.fromCompact(w).addRecoveryBit(Number(_)).recoverPublicKey(h);return ot.from(I.toRawBytes(!1).slice(1))};$r.ecrecover=f;const c=function(h,y,m,v){const b=o(h,v);if(!a(b))throw new Error("Invalid signature v value");return(0,r.bufferToHex)(ot.concat([(0,r.setLengthLeft)(y,32),(0,r.setLengthLeft)(m,32),(0,r.toBuffer)(h)]))};$r.toRpcSig=c;const l=function(h,y,m,v){const b=o(h,v);if(!a(b))throw new Error("Invalid signature v value");let w=m;return(h>BigInt(28)&&h%BigInt(2)===BigInt(1)||h===BigInt(1)||h===BigInt(28))&&(w=ot.from(m),w[0]|=128),(0,r.bufferToHex)(ot.concat([(0,r.setLengthLeft)(y,32),(0,r.setLengthLeft)(w,32)]))};$r.toCompactSig=l;const u=function(h){const y=(0,r.toBuffer)(h);let m,v,b;if(y.length>=65)m=y.slice(0,32),v=y.slice(32,64),b=(0,r.bufferToBigInt)(y.slice(64));else if(y.length===64)m=y.slice(0,32),v=y.slice(32,64),b=BigInt((0,r.bufferToInt)(y.slice(32,33))>>7),v[0]&=127;else throw new Error("Invalid signature length");return b<27&&(b=b+BigInt(27)),{v:b,r:m,s:v}};$r.fromRpcSig=u;const p=function(h,y,m,v=!0,b){if(y.length!==32||m.length!==32||!a(o(h,b)))return!1;const w=(0,r.bufferToBigInt)(y),_=(0,r.bufferToBigInt)(m);return!(w===BigInt(0)||w>=n.SECP256K1_ORDER||_===BigInt(0)||_>=n.SECP256K1_ORDER||v&&_>=n.SECP256K1_ORDER_DIV_2)};$r.isValidSignature=p;const d=function(h){(0,s.assertIsBuffer)(h);const y=ot.from(`Ethereum Signed Message:
67
+ ${h.length}`,"utf-8");return ot.from((0,e.keccak256)(ot.concat([y,h])))};return $r.hashPersonalMessage=d,$r}var Ap={},Z5;function gH(){return Z5||(Z5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.compactBytesToNibbles=e.bytesToNibbles=e.nibblesToCompactBytes=e.nibblesToBytes=e.hasTerminator=void 0;const t=o=>o.length>0&&o[o.length-1]===16;e.hasTerminator=t;const r=(o,a)=>{for(let f=0,c=0;c<o.length;f+=1,c+=2)a[f]=o[c]<<4|o[c+1]};e.nibblesToBytes=r;const n=o=>{let a=0;(0,e.hasTerminator)(o)&&(a=1,o=o.subarray(0,o.length-1));const f=new Uint8Array(o.length/2+1);return f[0]=a<<5,(o.length&1)===1&&(f[0]|=16,f[0]|=o[0],o=o.subarray(1)),(0,e.nibblesToBytes)(o,f.subarray(1)),f};e.nibblesToCompactBytes=n;const s=o=>{const a=o.length*2+1,f=new Uint8Array(a);for(let c=0;c<o.length;c++){const l=o[c];f[c*2]=l/16,f[c*2+1]=l%16}return f[a-1]=16,f};e.bytesToNibbles=s;const i=o=>{if(o.length===0)return o;let a=(0,e.bytesToNibbles)(o);a[0]<2&&(a=a.subarray(0,a.length-1));const f=2-(a[0]&1);return a.subarray(f)};e.compactBytesToNibbles=i}(Ap)),Ap}var ic={},J5;function mH(){if(J5)return ic;J5=1,Object.defineProperty(ic,"__esModule",{value:!0}),ic.AsyncEventEmitter=void 0;const e=Q7;async function t(n,s,i){let o;for await(const a of s)try{a.length<2?a.call(n,i):await new Promise((f,c)=>{a.call(n,i,l=>{l?c(l):f()})})}catch(f){o=f}if(o)throw o}class r extends e.EventEmitter{emit(s,...i){let[o,a]=i;const f=this;let c=f._events[s]??[];return a===void 0&&typeof o=="function"&&(a=o,o=void 0),(s==="newListener"||s==="removeListener")&&(o={event:o,fn:a},a=void 0),c=Array.isArray(c)?c:[c],t(f,c.slice(),o).then(a).catch(a),f.listenerCount(s)>0}once(s,i){const o=this;let a;if(typeof i!="function")throw new TypeError("listener must be a function");return i.length>=2?a=function(f,c){o.removeListener(s,a),i(f,c)}:a=function(f){o.removeListener(s,a),i(f,a)},o.on(s,a),o}first(s,i){let o=this._events[s]??[];if(typeof i!="function")throw new TypeError("listener must be a function");return Array.isArray(o)||(this._events[s]=o=[o]),o.unshift(i),this}before(s,i,o){return this.beforeOrAfter(s,i,o)}after(s,i,o){return this.beforeOrAfter(s,i,o,"after")}beforeOrAfter(s,i,o,a){let f=this._events[s]??[],c,l;const u=a==="after"?1:0;if(typeof o!="function")throw new TypeError("listener must be a function");if(typeof i!="function")throw new TypeError("target must be a function");for(Array.isArray(f)||(this._events[s]=f=[f]),l=f.length,c=f.length;c--;)if(f[c]===i){l=c+u;break}return f.splice(l,0,o),this}on(s,i){return super.on(s,i)}addListener(s,i){return super.addListener(s,i)}prependListener(s,i){return super.prependListener(s,i)}prependOnceListener(s,i){return super.prependOnceListener(s,i)}removeAllListeners(s){return super.removeAllListeners(s)}removeListener(s,i){return super.removeListener(s,i)}eventNames(){return super.eventNames()}listeners(s){return super.listeners(s)}listenerCount(s){return super.listenerCount(s)}getMaxListeners(){return super.getMaxListeners()}setMaxListeners(s){return super.setMaxListeners(s)}}return ic.AsyncEventEmitter=r,ic}var sc={},X5;function vH(){if(X5)return sc;X5=1,Object.defineProperty(sc,"__esModule",{value:!0}),sc.Lock=void 0;class e{constructor(){this.permits=1,this.promiseResolverQueue=[]}async acquire(){return this.permits>0?(this.permits-=1,Promise.resolve(!0)):new Promise(r=>this.promiseResolverQueue.push(r))}release(){if(this.permits+=1,this.permits>1&&this.promiseResolverQueue.length>0)console.warn("Lock.permits should never be > 0 when there is someone waiting.");else if(this.permits===1&&this.promiseResolverQueue.length>0){this.permits-=1;const r=this.promiseResolverQueue.shift();r&&r(!0)}}}return sc.Lock=e,sc}var oa={},gs={},Sp={},Pp={},xp,Q5;function bH(){if(Q5)return xp;Q5=1;const e=(function*(){}).constructor;return xp=()=>e,xp}var Tp,e6;function _H(){if(e6)return Tp;e6=1;var e=kP,t=CP(),r=t(/^\s*(?:function)?\*/),n=IP(),s=RP,i=e("Object.prototype.toString"),o=e("Function.prototype.toString"),a=bH();return Tp=function(c){if(typeof c!="function")return!1;if(r(o(c)))return!0;if(!n){var l=i(c);return l==="[object GeneratorFunction]"}if(!s)return!1;var u=a();return u&&s(c)===u.prototype},Tp}var t6;function wH(){return t6||(t6=1,function(e){var t=DP,r=_H(),n=BP,s=UP();function i(ie){return ie.call.bind(ie)}var o=typeof BigInt<"u",a=typeof Symbol<"u",f=i(Object.prototype.toString),c=i(Number.prototype.valueOf),l=i(String.prototype.valueOf),u=i(Boolean.prototype.valueOf);if(o)var p=i(BigInt.prototype.valueOf);if(a)var d=i(Symbol.prototype.valueOf);function h(ie,Fe){if(typeof ie!="object")return!1;try{return Fe(ie),!0}catch{return!1}}e.isArgumentsObject=t,e.isGeneratorFunction=r,e.isTypedArray=s;function y(ie){return typeof Promise<"u"&&ie instanceof Promise||ie!==null&&typeof ie=="object"&&typeof ie.then=="function"&&typeof ie.catch=="function"}e.isPromise=y;function m(ie){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(ie):s(ie)||z(ie)}e.isArrayBufferView=m;function v(ie){return n(ie)==="Uint8Array"}e.isUint8Array=v;function b(ie){return n(ie)==="Uint8ClampedArray"}e.isUint8ClampedArray=b;function w(ie){return n(ie)==="Uint16Array"}e.isUint16Array=w;function _(ie){return n(ie)==="Uint32Array"}e.isUint32Array=_;function C(ie){return n(ie)==="Int8Array"}e.isInt8Array=C;function I(ie){return n(ie)==="Int16Array"}e.isInt16Array=I;function k(ie){return n(ie)==="Int32Array"}e.isInt32Array=k;function E(ie){return n(ie)==="Float32Array"}e.isFloat32Array=E;function S(ie){return n(ie)==="Float64Array"}e.isFloat64Array=S;function T(ie){return n(ie)==="BigInt64Array"}e.isBigInt64Array=T;function P(ie){return n(ie)==="BigUint64Array"}e.isBigUint64Array=P;function g(ie){return f(ie)==="[object Map]"}g.working=typeof Map<"u"&&g(new Map);function A(ie){return typeof Map>"u"?!1:g.working?g(ie):ie instanceof Map}e.isMap=A;function x(ie){return f(ie)==="[object Set]"}x.working=typeof Set<"u"&&x(new Set);function D(ie){return typeof Set>"u"?!1:x.working?x(ie):ie instanceof Set}e.isSet=D;function O(ie){return f(ie)==="[object WeakMap]"}O.working=typeof WeakMap<"u"&&O(new WeakMap);function B(ie){return typeof WeakMap>"u"?!1:O.working?O(ie):ie instanceof WeakMap}e.isWeakMap=B;function L(ie){return f(ie)==="[object WeakSet]"}L.working=typeof WeakSet<"u"&&L(new WeakSet);function M(ie){return L(ie)}e.isWeakSet=M;function R(ie){return f(ie)==="[object ArrayBuffer]"}R.working=typeof ArrayBuffer<"u"&&R(new ArrayBuffer);function N(ie){return typeof ArrayBuffer>"u"?!1:R.working?R(ie):ie instanceof ArrayBuffer}e.isArrayBuffer=N;function F(ie){return f(ie)==="[object DataView]"}F.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&F(new DataView(new ArrayBuffer(1),0,1));function z(ie){return typeof DataView>"u"?!1:F.working?F(ie):ie instanceof DataView}e.isDataView=z;var Y=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function j(ie){return f(ie)==="[object SharedArrayBuffer]"}function re(ie){return typeof Y>"u"?!1:(typeof j.working>"u"&&(j.working=j(new Y)),j.working?j(ie):ie instanceof Y)}e.isSharedArrayBuffer=re;function V(ie){return f(ie)==="[object AsyncFunction]"}e.isAsyncFunction=V;function U(ie){return f(ie)==="[object Map Iterator]"}e.isMapIterator=U;function X(ie){return f(ie)==="[object Set Iterator]"}e.isSetIterator=X;function ye(ie){return f(ie)==="[object Generator]"}e.isGeneratorObject=ye;function _e(ie){return f(ie)==="[object WebAssembly.Module]"}e.isWebAssemblyCompiledModule=_e;function Ae(ie){return h(ie,c)}e.isNumberObject=Ae;function H(ie){return h(ie,l)}e.isStringObject=H;function q(ie){return h(ie,u)}e.isBooleanObject=q;function W(ie){return o&&h(ie,p)}e.isBigIntObject=W;function ee(ie){return a&&h(ie,d)}e.isSymbolObject=ee;function le(ie){return Ae(ie)||H(ie)||q(ie)||W(ie)||ee(ie)}e.isBoxedPrimitive=le;function ce(ie){return typeof Uint8Array<"u"&&(N(ie)||re(ie))}e.isAnyArrayBuffer=ce,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(ie){Object.defineProperty(e,ie,{enumerable:!1,value:function(){throw new Error(ie+" is not supported in userland")}})})}(Pp)),Pp}var Cp,r6;function EH(){return r6||(r6=1,Cp=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"}),Cp}var n6;function AH(){return n6||(n6=1,function(e){var t=Object.getOwnPropertyDescriptors||function(z){for(var Y=Object.keys(z),j={},re=0;re<Y.length;re++)j[Y[re]]=Object.getOwnPropertyDescriptor(z,Y[re]);return j},r=/%[sdj%]/g;e.format=function(F){if(!C(F)){for(var z=[],Y=0;Y<arguments.length;Y++)z.push(o(arguments[Y]));return z.join(" ")}for(var Y=1,j=arguments,re=j.length,V=String(F).replace(r,function(X){if(X==="%%")return"%";if(Y>=re)return X;switch(X){case"%s":return String(j[Y++]);case"%d":return Number(j[Y++]);case"%j":try{return JSON.stringify(j[Y++])}catch{return"[Circular]"}default:return X}}),U=j[Y];Y<re;U=j[++Y])b(U)||!S(U)?V+=" "+U:V+=" "+o(U);return V},e.deprecate=function(F,z){if(typeof Mr<"u"&&Mr.noDeprecation===!0)return F;if(typeof Mr>"u")return function(){return e.deprecate(F,z).apply(this,arguments)};var Y=!1;function j(){if(!Y){if(Mr.throwDeprecation)throw new Error(z);Mr.traceDeprecation?console.trace(z):console.error(z),Y=!0}return F.apply(this,arguments)}return j};var n={},s=/^$/;if({}.NODE_DEBUG){var i={}.NODE_DEBUG;i=i.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),s=new RegExp("^"+i+"$","i")}e.debuglog=function(F){if(F=F.toUpperCase(),!n[F])if(s.test(F)){var z=Mr.pid;n[F]=function(){var Y=e.format.apply(e,arguments);console.error("%s %d: %s",F,z,Y)}}else n[F]=function(){};return n[F]};function o(F,z){var Y={seen:[],stylize:f};return arguments.length>=3&&(Y.depth=arguments[2]),arguments.length>=4&&(Y.colors=arguments[3]),v(z)?Y.showHidden=z:z&&e._extend(Y,z),k(Y.showHidden)&&(Y.showHidden=!1),k(Y.depth)&&(Y.depth=2),k(Y.colors)&&(Y.colors=!1),k(Y.customInspect)&&(Y.customInspect=!0),Y.colors&&(Y.stylize=a),l(Y,F,Y.depth)}e.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function a(F,z){var Y=o.styles[z];return Y?"\x1B["+o.colors[Y][0]+"m"+F+"\x1B["+o.colors[Y][1]+"m":F}function f(F,z){return F}function c(F){var z={};return F.forEach(function(Y,j){z[Y]=!0}),z}function l(F,z,Y){if(F.customInspect&&z&&g(z.inspect)&&z.inspect!==e.inspect&&!(z.constructor&&z.constructor.prototype===z)){var j=z.inspect(Y,F);return C(j)||(j=l(F,j,Y)),j}var re=u(F,z);if(re)return re;var V=Object.keys(z),U=c(V);if(F.showHidden&&(V=Object.getOwnPropertyNames(z)),P(z)&&(V.indexOf("message")>=0||V.indexOf("description")>=0))return p(z);if(V.length===0){if(g(z)){var X=z.name?": "+z.name:"";return F.stylize("[Function"+X+"]","special")}if(E(z))return F.stylize(RegExp.prototype.toString.call(z),"regexp");if(T(z))return F.stylize(Date.prototype.toString.call(z),"date");if(P(z))return p(z)}var ye="",_e=!1,Ae=["{","}"];if(m(z)&&(_e=!0,Ae=["[","]"]),g(z)){var H=z.name?": "+z.name:"";ye=" [Function"+H+"]"}if(E(z)&&(ye=" "+RegExp.prototype.toString.call(z)),T(z)&&(ye=" "+Date.prototype.toUTCString.call(z)),P(z)&&(ye=" "+p(z)),V.length===0&&(!_e||z.length==0))return Ae[0]+ye+Ae[1];if(Y<0)return E(z)?F.stylize(RegExp.prototype.toString.call(z),"regexp"):F.stylize("[Object]","special");F.seen.push(z);var q;return _e?q=d(F,z,Y,U,V):q=V.map(function(W){return h(F,z,Y,U,W,_e)}),F.seen.pop(),y(q,ye,Ae)}function u(F,z){if(k(z))return F.stylize("undefined","undefined");if(C(z)){var Y="'"+JSON.stringify(z).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return F.stylize(Y,"string")}if(_(z))return F.stylize(""+z,"number");if(v(z))return F.stylize(""+z,"boolean");if(b(z))return F.stylize("null","null")}function p(F){return"["+Error.prototype.toString.call(F)+"]"}function d(F,z,Y,j,re){for(var V=[],U=0,X=z.length;U<X;++U)L(z,String(U))?V.push(h(F,z,Y,j,String(U),!0)):V.push("");return re.forEach(function(ye){ye.match(/^\d+$/)||V.push(h(F,z,Y,j,ye,!0))}),V}function h(F,z,Y,j,re,V){var U,X,ye;if(ye=Object.getOwnPropertyDescriptor(z,re)||{value:z[re]},ye.get?ye.set?X=F.stylize("[Getter/Setter]","special"):X=F.stylize("[Getter]","special"):ye.set&&(X=F.stylize("[Setter]","special")),L(j,re)||(U="["+re+"]"),X||(F.seen.indexOf(ye.value)<0?(b(Y)?X=l(F,ye.value,null):X=l(F,ye.value,Y-1),X.indexOf(`
68
+ `)>-1&&(V?X=X.split(`
69
+ `).map(function(_e){return" "+_e}).join(`
70
+ `).slice(2):X=`
71
+ `+X.split(`
72
+ `).map(function(_e){return" "+_e}).join(`
73
+ `))):X=F.stylize("[Circular]","special")),k(U)){if(V&&re.match(/^\d+$/))return X;U=JSON.stringify(""+re),U.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(U=U.slice(1,-1),U=F.stylize(U,"name")):(U=U.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),U=F.stylize(U,"string"))}return U+": "+X}function y(F,z,Y){var j=F.reduce(function(re,V){return V.indexOf(`
74
+ `)>=0,re+V.replace(/\u001b\[\d\d?m/g,"").length+1},0);return j>60?Y[0]+(z===""?"":z+`
75
+ `)+" "+F.join(`,
76
+ `)+" "+Y[1]:Y[0]+z+" "+F.join(", ")+" "+Y[1]}e.types=wH();function m(F){return Array.isArray(F)}e.isArray=m;function v(F){return typeof F=="boolean"}e.isBoolean=v;function b(F){return F===null}e.isNull=b;function w(F){return F==null}e.isNullOrUndefined=w;function _(F){return typeof F=="number"}e.isNumber=_;function C(F){return typeof F=="string"}e.isString=C;function I(F){return typeof F=="symbol"}e.isSymbol=I;function k(F){return F===void 0}e.isUndefined=k;function E(F){return S(F)&&x(F)==="[object RegExp]"}e.isRegExp=E,e.types.isRegExp=E;function S(F){return typeof F=="object"&&F!==null}e.isObject=S;function T(F){return S(F)&&x(F)==="[object Date]"}e.isDate=T,e.types.isDate=T;function P(F){return S(F)&&(x(F)==="[object Error]"||F instanceof Error)}e.isError=P,e.types.isNativeError=P;function g(F){return typeof F=="function"}e.isFunction=g;function A(F){return F===null||typeof F=="boolean"||typeof F=="number"||typeof F=="string"||typeof F=="symbol"||typeof F>"u"}e.isPrimitive=A,e.isBuffer=EH();function x(F){return Object.prototype.toString.call(F)}function D(F){return F<10?"0"+F.toString(10):F.toString(10)}var O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function B(){var F=new Date,z=[D(F.getHours()),D(F.getMinutes()),D(F.getSeconds())].join(":");return[F.getDate(),O[F.getMonth()],z].join(" ")}e.log=function(){console.log("%s - %s",B(),e.format.apply(e,arguments))},e.inherits=OP,e._extend=function(F,z){if(!z||!S(z))return F;for(var Y=Object.keys(z),j=Y.length;j--;)F[Y[j]]=z[Y[j]];return F};function L(F,z){return Object.prototype.hasOwnProperty.call(F,z)}var M=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;e.promisify=function(z){if(typeof z!="function")throw new TypeError('The "original" argument must be of type Function');if(M&&z[M]){var Y=z[M];if(typeof Y!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(Y,M,{value:Y,enumerable:!1,writable:!1,configurable:!0}),Y}function Y(){for(var j,re,V=new Promise(function(ye,_e){j=ye,re=_e}),U=[],X=0;X<arguments.length;X++)U.push(arguments[X]);U.push(function(ye,_e){ye?re(ye):j(_e)});try{z.apply(this,U)}catch(ye){re(ye)}return V}return Object.setPrototypeOf(Y,Object.getPrototypeOf(z)),M&&Object.defineProperty(Y,M,{value:Y,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(Y,t(z))},e.promisify.custom=M;function R(F,z){if(!F){var Y=new Error("Promise was rejected with a falsy value");Y.reason=F,F=Y}return z(F)}function N(F){if(typeof F!="function")throw new TypeError('The "original" argument must be of type Function');function z(){for(var Y=[],j=0;j<arguments.length;j++)Y.push(arguments[j]);var re=Y.pop();if(typeof re!="function")throw new TypeError("The last argument must be of type Function");var V=this,U=function(){return re.apply(V,arguments)};F.apply(this,Y).then(function(X){Mr.nextTick(U.bind(null,null,X))},function(X){Mr.nextTick(R.bind(null,X,U))})}return Object.setPrototypeOf(z,Object.getPrototypeOf(F)),Object.defineProperties(z,t(F)),z}e.callbackify=N}(Sp)),Sp}var i6;function SH(){if(i6)return gs;i6=1,Object.defineProperty(gs,"__esModule",{value:!0}),gs.InvalidStatusCodeError=gs.InvalidCertError=void 0;const e=Object.freeze({redirect:!0,expectStatusCode:200,headers:{},full:!1,keepAlive:!0,cors:!1,referrer:!1,sslAllowSelfSigned:!1,_redirectCount:0});class t extends Error{constructor(p,d){super(p),this.fingerprint256=d}}gs.InvalidCertError=t;class r extends Error{constructor(p){super(`Request Failed. Status Code: ${p}`),this.statusCode=p}}gs.InvalidStatusCodeError=r;function n(u,p){if(!p||p==="text"||p==="json")try{let d=new TextDecoder("utf8",{fatal:!0}).decode(u);if(p==="text")return d;try{return JSON.parse(d)}catch(h){if(p==="json")throw h;return d}}catch(d){if(p==="text"||p==="json")throw d}return u}let s={};function i(u,p){var k;let d={...e,...p};const h=xa,y=xa,m=xa,{promisify:v}=AH(),{resolve:b}=MP,w=!!/^https/.test(u);let _={method:d.method||"GET",headers:{"Accept-Encoding":"gzip, deflate, br"}};const C=E=>E.replace(/:| /g,"").toLowerCase();if(d.keepAlive){const E={keepAlive:!0,keepAliveMsecs:3e4,maxFreeSockets:1024,maxCachedSessions:1024},S=[w,w&&((k=d.sslPinnedCertificates)==null?void 0:k.map(T=>C(T)).sort())].join();_.agent=s[S]||(s[S]=new(w?y:h).Agent(E))}d.type==="json"&&(_.headers["Content-Type"]="application/json"),d.data&&(d.method||(_.method="POST"),_.body=d.type==="json"?JSON.stringify(d.data):d.data),_.headers={..._.headers,...d.headers},d.sslAllowSelfSigned&&(_.rejectUnauthorized=!1);const I=async E=>{const S=E.statusCode;if(d.redirect&&300<=S&&S<400&&E.headers.location){if(d._redirectCount==10)throw new Error("Request failed. Too much redirects.");return d._redirectCount+=1,await i(b(u,E.headers.location),d)}if(d.expectStatusCode&&S!==d.expectStatusCode)throw E.resume(),new r(S);let T=[];for await(const x of E)T.push(x);let P=ot.concat(T);const g=E.headers["content-encoding"];g==="br"&&(P=await v(m.brotliDecompress)(P)),(g==="gzip"||g==="deflate")&&(P=await v(m.unzip)(P));const A=n(P,d.type);return d.full?{headers:E.headers,status:S,body:A}:A};return new Promise((E,S)=>{var x;const T=async D=>{if(D&&D.code==="DEPTH_ZERO_SELF_SIGNED_CERT")try{await i(u,{...d,sslAllowSelfSigned:!0,sslPinnedCertificates:[]})}catch(O){O&&O.fingerprint256&&(D=new t(`Self-signed SSL certificate: ${O.fingerprint256}`,O.fingerprint256))}S(D)},P=(w?y:h).request(u,_,D=>{D.on("error",T),(async()=>{try{E(await I(D))}catch(O){S(O)}})()});P.on("error",T);const g=(x=d.sslPinnedCertificates)==null?void 0:x.map(D=>C(D)),A=D=>{var B;const O=C(((B=D.getPeerCertificate())==null?void 0:B.fingerprint256)||"");if(!(!O&&D.isSessionReused())&&!g.includes(O))return P.emit("error",new t(`Invalid SSL certificate: ${O} Expected: ${g}`,O)),P.abort()};d.sslPinnedCertificates&&P.on("socket",D=>{D.listeners("secureConnect").map(B=>(B.name||"").replace("bound ","")).includes("mfetchSecureConnect")||D.on("secureConnect",A.bind(null,D))}),d.keepAlive&&P.setNoDelay(!0),_.body&&P.write(_.body),P.end()})}const o=new Set(["Accept","Accept-Language","Content-Language","Content-Type"].map(u=>u.toLowerCase())),a=new Set(["Accept-Charset","Accept-Encoding","Access-Control-Request-Headers","Access-Control-Request-Method","Connection","Content-Length","Cookie","Cookie2","Date","DNT","Expect","Host","Keep-Alive","Origin","Referer","TE","Trailer","Transfer-Encoding","Upgrade","Via"].map(u=>u.toLowerCase()));async function f(u,p){let d={...e,...p};const h=new Headers;d.type==="json"&&h.set("Content-Type","application/json");let y=new URL(u);if(y.username){const w=btoa(`${y.username}:${y.password}`);h.set("Authorization",`Basic ${w}`),y.username="",y.password=""}u=""+y;for(let w in d.headers){const _=w.toLowerCase();(o.has(_)||d.cors&&!a.has(_))&&h.set(w,d.headers[w])}let m={headers:h,redirect:d.redirect?"follow":"manual"};d.referrer||(m.referrerPolicy="no-referrer"),d.cors&&(m.mode="cors"),d.data&&(d.method||(m.method="POST"),m.body=d.type==="json"?JSON.stringify(d.data):d.data);const v=await fetch(u,m);if(d.expectStatusCode&&v.status!==d.expectStatusCode)throw new r(v.status);const b=n(new Uint8Array(await v.arrayBuffer()),d.type);return d.full?{headers:Object.fromEntries(v.headers.entries()),status:v.status,body:b}:b}const c=!!(typeof Mr=="object"&&Mr.versions&&Mr.versions.node&&Mr.versions.v8);function l(u,p){return(c?i:f)(u,p)}return gs.default=l,gs}var s6;function PH(){if(s6)return oa;s6=1,Object.defineProperty(oa,"__esModule",{value:!0}),oa.getProvider=oa.fetchFromProvider=void 0;const e=SH(),t=async(n,s)=>(await(0,e.default)(n,{headers:{"content-type":"application/json"},type:"json",data:{method:s.method,params:s.params,jsonrpc:"2.0",id:1}})).result;oa.fetchFromProvider=t;const r=n=>{var s;if(typeof n=="string")return n;if(((s=n==null?void 0:n.connection)==null?void 0:s.url)!==void 0)return n.connection.url;throw new Error("Must provide valid provider URL or Web3Provider")};return oa.getProvider=r,oa}var a6;function Hf(){return a6||(a6=1,function(e){var t=rt&&rt.__createBinding||(Object.create?function(s,i,o,a){a===void 0&&(a=o);var f=Object.getOwnPropertyDescriptor(i,o);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(s,a,f)}:function(s,i,o,a){a===void 0&&(a=o),s[a]=i[o]}),r=rt&&rt.__exportStar||function(s,i){for(var o in s)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,s,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.toAscii=e.stripHexPrefix=e.padToEven=e.isHexString=e.isHexPrefixed=e.getKeys=e.getBinarySize=e.fromUtf8=e.fromAscii=e.arrayContainsArray=void 0,r(Gg(),e),r(lH(),e),r(tA(),e),r(rA(),e),r(pH(),e),r(yH(),e),r(Do(),e),r(nA(),e),r(gH(),e),r(mH(),e);var n=il();Object.defineProperty(e,"arrayContainsArray",{enumerable:!0,get:function(){return n.arrayContainsArray}}),Object.defineProperty(e,"fromAscii",{enumerable:!0,get:function(){return n.fromAscii}}),Object.defineProperty(e,"fromUtf8",{enumerable:!0,get:function(){return n.fromUtf8}}),Object.defineProperty(e,"getBinarySize",{enumerable:!0,get:function(){return n.getBinarySize}}),Object.defineProperty(e,"getKeys",{enumerable:!0,get:function(){return n.getKeys}}),Object.defineProperty(e,"isHexPrefixed",{enumerable:!0,get:function(){return n.isHexPrefixed}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return n.isHexString}}),Object.defineProperty(e,"padToEven",{enumerable:!0,get:function(){return n.padToEven}}),Object.defineProperty(e,"stripHexPrefix",{enumerable:!0,get:function(){return n.stripHexPrefix}}),Object.defineProperty(e,"toAscii",{enumerable:!0,get:function(){return n.toAscii}}),r(vH(),e),r(PH(),e)}(hp)),hp}var Hr={},Ip,o6;function iA(){return o6||(o6=1,Ip=function(t){if(typeof t!="string")throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof t+", while checking isHexPrefixed.");return t.slice(0,2)==="0x"}),Ip}var kp,c6;function xH(){if(c6)return kp;c6=1;var e=iA();return kp=function(r){return typeof r!="string"?r:e(r)?r.slice(2):r},kp}var Rp,u6;function Wg(){if(u6)return Rp;u6=1;var e=iA(),t=xH();function r(d){var h=d;if(typeof h!="string")throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof h+", while padToEven.");return h.length%2&&(h="0"+h),h}function n(d){var h=d.toString(16);return"0x"+h}function s(d){var h=n(d);return new ot(r(h.slice(2)),"hex")}function i(d){if(typeof d!="string")throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof d+"'.");return ot.byteLength(d,"utf8")}function o(d,h,y){if(Array.isArray(d)!==!0)throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof d+"'");if(Array.isArray(h)!==!0)throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof h+"'");return h[!!y&&"some"||"every"](function(m){return d.indexOf(m)>=0})}function a(d){var h=new ot(r(t(d).replace(/^0+|0+$/g,"")),"hex");return h.toString("utf8")}function f(d){var h="",y=0,m=d.length;for(d.substring(0,2)==="0x"&&(y=2);y<m;y+=2){var v=parseInt(d.substr(y,2),16);h+=String.fromCharCode(v)}return h}function c(d){var h=new ot(d,"utf8");return"0x"+r(h.toString("hex")).replace(/^0+|0+$/g,"")}function l(d){for(var h="",y=0;y<d.length;y++){var m=d.charCodeAt(y),v=m.toString(16);h+=v.length<2?"0"+v:v}return"0x"+h}function u(d,h,y){if(!Array.isArray(d))throw new Error("[ethjs-util] method getKeys expecting type Array as 'params' input, got '"+typeof d+"'");if(typeof h!="string")throw new Error("[ethjs-util] method getKeys expecting type String for input 'key' got '"+typeof h+"'.");for(var m=[],v=0;v<d.length;v++){var b=d[v][h];if(y&&!b)b="";else if(typeof b!="string")throw new Error("invalid abi");m.push(b)}return m}function p(d,h){return!(typeof d!="string"||!d.match(/^0x[0-9A-Fa-f]*$/)||h&&d.length!==2+2*h)}return Rp={arrayContainsArray:o,intToBuffer:s,getBinarySize:i,isHexPrefixed:e,stripHexPrefix:t,padToEven:r,intToHex:n,fromAscii:l,fromUtf8:c,toAscii:f,toUtf8:a,getKeys:u,isHexString:p},Rp}var l6;function sl(){if(l6)return Hr;l6=1,Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.numberToBuffer=Hr.normalize=Hr.recoverPublicKey=Hr.concatSig=Hr.legacyToBuffer=Hr.isNullish=Hr.padWithZeroes=void 0;const e=Hf(),t=Wg();function r(c,l){if(c!==""&&!/^[a-f0-9]+$/iu.test(c))throw new Error(`Expected an unprefixed hex string. Received: ${c}`);if(l<0)throw new Error(`Expected a non-negative integer target length. Received: ${l}`);return String.prototype.padStart.call(c,l,"0")}Hr.padWithZeroes=r;function n(c){return c==null}Hr.isNullish=n;function s(c){return typeof c=="string"&&!(0,t.isHexString)(c)?ot.from(c):(0,e.toBuffer)(c)}Hr.legacyToBuffer=s;function i(c,l,u){const p=(0,e.fromSigned)(l),d=(0,e.fromSigned)(u),h=(0,e.bufferToInt)(c),y=r((0,e.toUnsigned)(p).toString("hex"),64),m=r((0,e.toUnsigned)(d).toString("hex"),64),v=(0,t.stripHexPrefix)((0,t.intToHex)(h));return(0,e.addHexPrefix)(y.concat(m,v))}Hr.concatSig=i;function o(c,l){const u=(0,e.fromRpcSig)(l);return(0,e.ecrecover)(c,u.v,u.r,u.s)}Hr.recoverPublicKey=o;function a(c){if(c){if(typeof c=="number"){if(c<0)return"0x";const l=(0,e.toBuffer)(c);c=(0,e.bufferToHex)(l)}if(typeof c!="string"){let l="eth-sig-util.normalize() requires hex string or integer input.";throw l+=` received ${typeof c}: ${c}`,new Error(l)}return(0,e.addHexPrefix)(c.toLowerCase())}}Hr.normalize=a;function f(c){const l=c.toString(16),u=l.length%2?"0":"";return ot.from(u+l,"hex")}return Hr.numberToBuffer=f,Hr}var d6;function TH(){if(d6)return ji;d6=1,Object.defineProperty(ji,"__esModule",{value:!0}),ji.extractPublicKey=ji.recoverPersonalSignature=ji.personalSign=void 0;const e=Hf(),t=sl();function r({privateKey:o,data:a}){if((0,t.isNullish)(a))throw new Error("Missing data parameter");if((0,t.isNullish)(o))throw new Error("Missing privateKey parameter");const f=(0,t.legacyToBuffer)(a),c=(0,e.hashPersonalMessage)(f),l=(0,e.ecsign)(c,o);return(0,t.concatSig)((0,e.toBuffer)(l.v),l.r,l.s)}ji.personalSign=r;function n({data:o,signature:a}){if((0,t.isNullish)(o))throw new Error("Missing data parameter");if((0,t.isNullish)(a))throw new Error("Missing signature parameter");const f=i(o,a),c=(0,e.publicToAddress)(f);return(0,e.bufferToHex)(c)}ji.recoverPersonalSignature=n;function s({data:o,signature:a}){if((0,t.isNullish)(o))throw new Error("Missing data parameter");if((0,t.isNullish)(a))throw new Error("Missing signature parameter");return`0x${i(o,a).toString("hex")}`}ji.extractPublicKey=s;function i(o,a){const f=(0,e.hashPersonalMessage)((0,t.legacyToBuffer)(o));return(0,t.recoverPublicKey)(f,a)}return ji}var Dp={},Xn={},ir={},Dr={},f6;function Yg(){if(f6)return Dr;f6=1,Object.defineProperty(Dr,"__esModule",{value:!0}),Dr.output=Dr.exists=Dr.hash=Dr.bytes=Dr.bool=Dr.number=Dr.isBytes=void 0;function e(f){if(!Number.isSafeInteger(f)||f<0)throw new Error(`positive integer expected, not ${f}`)}Dr.number=e;function t(f){if(typeof f!="boolean")throw new Error(`boolean expected, not ${f}`)}Dr.bool=t;function r(f){return f instanceof Uint8Array||f!=null&&typeof f=="object"&&f.constructor.name==="Uint8Array"}Dr.isBytes=r;function n(f,...c){if(!r(f))throw new Error("Uint8Array expected");if(c.length>0&&!c.includes(f.length))throw new Error(`Uint8Array expected of length ${c}, not of length=${f.length}`)}Dr.bytes=n;function s(f){if(typeof f!="function"||typeof f.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");e(f.outputLen),e(f.blockLen)}Dr.hash=s;function i(f,c=!0){if(f.destroyed)throw new Error("Hash instance has been destroyed");if(c&&f.finished)throw new Error("Hash#digest() has already been called")}Dr.exists=i;function o(f,c){n(f);const l=c.outputLen;if(f.length<l)throw new Error(`digestInto() expects output buffer of length at least ${l}`)}Dr.output=o;const a={number:e,bool:t,bytes:n,hash:s,exists:i,output:o};return Dr.default=a,Dr}var kt={},h6;function CH(){if(h6)return kt;h6=1,Object.defineProperty(kt,"__esModule",{value:!0}),kt.add5L=kt.add5H=kt.add4H=kt.add4L=kt.add3H=kt.add3L=kt.add=kt.rotlBL=kt.rotlBH=kt.rotlSL=kt.rotlSH=kt.rotr32L=kt.rotr32H=kt.rotrBL=kt.rotrBH=kt.rotrSL=kt.rotrSH=kt.shrSL=kt.shrSH=kt.toBig=kt.split=kt.fromBig=void 0;const e=BigInt(2**32-1),t=BigInt(32);function r(S,T=!1){return T?{h:Number(S&e),l:Number(S>>t&e)}:{h:Number(S>>t&e)|0,l:Number(S&e)|0}}kt.fromBig=r;function n(S,T=!1){let P=new Uint32Array(S.length),g=new Uint32Array(S.length);for(let A=0;A<S.length;A++){const{h:x,l:D}=r(S[A],T);[P[A],g[A]]=[x,D]}return[P,g]}kt.split=n;const s=(S,T)=>BigInt(S>>>0)<<t|BigInt(T>>>0);kt.toBig=s;const i=(S,T,P)=>S>>>P;kt.shrSH=i;const o=(S,T,P)=>S<<32-P|T>>>P;kt.shrSL=o;const a=(S,T,P)=>S>>>P|T<<32-P;kt.rotrSH=a;const f=(S,T,P)=>S<<32-P|T>>>P;kt.rotrSL=f;const c=(S,T,P)=>S<<64-P|T>>>P-32;kt.rotrBH=c;const l=(S,T,P)=>S>>>P-32|T<<64-P;kt.rotrBL=l;const u=(S,T)=>T;kt.rotr32H=u;const p=(S,T)=>S;kt.rotr32L=p;const d=(S,T,P)=>S<<P|T>>>32-P;kt.rotlSH=d;const h=(S,T,P)=>T<<P|S>>>32-P;kt.rotlSL=h;const y=(S,T,P)=>T<<P-32|S>>>64-P;kt.rotlBH=y;const m=(S,T,P)=>S<<P-32|T>>>64-P;kt.rotlBL=m;function v(S,T,P,g){const A=(T>>>0)+(g>>>0);return{h:S+P+(A/2**32|0)|0,l:A|0}}kt.add=v;const b=(S,T,P)=>(S>>>0)+(T>>>0)+(P>>>0);kt.add3L=b;const w=(S,T,P,g)=>T+P+g+(S/2**32|0)|0;kt.add3H=w;const _=(S,T,P,g)=>(S>>>0)+(T>>>0)+(P>>>0)+(g>>>0);kt.add4L=_;const C=(S,T,P,g,A)=>T+P+g+A+(S/2**32|0)|0;kt.add4H=C;const I=(S,T,P,g,A)=>(S>>>0)+(T>>>0)+(P>>>0)+(g>>>0)+(A>>>0);kt.add5L=I;const k=(S,T,P,g,A,x)=>T+P+g+A+x+(S/2**32|0)|0;kt.add5H=k;const E={fromBig:r,split:n,toBig:s,shrSH:i,shrSL:o,rotrSH:a,rotrSL:f,rotrBH:c,rotrBL:l,rotr32H:u,rotr32L:p,rotlSH:d,rotlSL:h,rotlBH:y,rotlBL:m,add:v,add3L:b,add3H:w,add4L:_,add4H:C,add5H:k,add5L:I};return kt.default=E,kt}var Bp={},ac={},p6;function IH(){return p6||(p6=1,Object.defineProperty(ac,"__esModule",{value:!0}),ac.crypto=void 0,ac.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),ac}var y6;function Uy(){return y6||(y6=1,function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.byteSwap32=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=e.isBytes=void 0;const t=IH(),r=Yg();function n(g){return g instanceof Uint8Array||g!=null&&typeof g=="object"&&g.constructor.name==="Uint8Array"}e.isBytes=n;const s=g=>new Uint8Array(g.buffer,g.byteOffset,g.byteLength);e.u8=s;const i=g=>new Uint32Array(g.buffer,g.byteOffset,Math.floor(g.byteLength/4));e.u32=i;const o=g=>new DataView(g.buffer,g.byteOffset,g.byteLength);e.createView=o;const a=(g,A)=>g<<32-A|g>>>A;e.rotr=a;const f=(g,A)=>g<<A|g>>>32-A>>>0;e.rotl=f,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const c=g=>g<<24&4278190080|g<<8&16711680|g>>>8&65280|g>>>24&255;e.byteSwap=c,e.byteSwapIfBE=e.isLE?g=>g:g=>(0,e.byteSwap)(g);function l(g){for(let A=0;A<g.length;A++)g[A]=(0,e.byteSwap)(g[A])}e.byteSwap32=l;const u=Array.from({length:256},(g,A)=>A.toString(16).padStart(2,"0"));function p(g){(0,r.bytes)(g);let A="";for(let x=0;x<g.length;x++)A+=u[g[x]];return A}e.bytesToHex=p;const d={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function h(g){if(g>=d._0&&g<=d._9)return g-d._0;if(g>=d._A&&g<=d._F)return g-(d._A-10);if(g>=d._a&&g<=d._f)return g-(d._a-10)}function y(g){if(typeof g!="string")throw new Error("hex string expected, got "+typeof g);const A=g.length,x=A/2;if(A%2)throw new Error("padded hex string expected, got unpadded hex of length "+A);const D=new Uint8Array(x);for(let O=0,B=0;O<x;O++,B+=2){const L=h(g.charCodeAt(B)),M=h(g.charCodeAt(B+1));if(L===void 0||M===void 0){const R=g[B]+g[B+1];throw new Error('hex string expected, got non-hex character "'+R+'" at index '+B)}D[O]=L*16+M}return D}e.hexToBytes=y;const m=async()=>{};e.nextTick=m;async function v(g,A,x){let D=Date.now();for(let O=0;O<g;O++){x(O);const B=Date.now()-D;B>=0&&B<A||(await(0,e.nextTick)(),D+=B)}}e.asyncLoop=v;function b(g){if(typeof g!="string")throw new Error(`utf8ToBytes expected string, got ${typeof g}`);return new Uint8Array(new TextEncoder().encode(g))}e.utf8ToBytes=b;function w(g){return typeof g=="string"&&(g=b(g)),(0,r.bytes)(g),g}e.toBytes=w;function _(...g){let A=0;for(let D=0;D<g.length;D++){const O=g[D];(0,r.bytes)(O),A+=O.length}const x=new Uint8Array(A);for(let D=0,O=0;D<g.length;D++){const B=g[D];x.set(B,O),O+=B.length}return x}e.concatBytes=_;class C{clone(){return this._cloneInto()}}e.Hash=C;const I={}.toString;function k(g,A){if(A!==void 0&&I.call(A)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(g,A)}e.checkOpts=k;function E(g){const A=D=>g().update(w(D)).digest(),x=g();return A.outputLen=x.outputLen,A.blockLen=x.blockLen,A.create=()=>g(),A}e.wrapConstructor=E;function S(g){const A=(D,O)=>g(O).update(w(D)).digest(),x=g({});return A.outputLen=x.outputLen,A.blockLen=x.blockLen,A.create=D=>g(D),A}e.wrapConstructorWithOpts=S;function T(g){const A=(D,O)=>g(O).update(w(D)).digest(),x=g({});return A.outputLen=x.outputLen,A.blockLen=x.blockLen,A.create=D=>g(D),A}e.wrapXOFConstructorWithOpts=T;function P(g=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(g));throw new Error("crypto.getRandomValues must be defined")}e.randomBytes=P}(Bp)),Bp}var g6;function kH(){if(g6)return ir;g6=1,Object.defineProperty(ir,"__esModule",{value:!0}),ir.shake256=ir.shake128=ir.keccak_512=ir.keccak_384=ir.keccak_256=ir.keccak_224=ir.sha3_512=ir.sha3_384=ir.sha3_256=ir.sha3_224=ir.Keccak=ir.keccakP=void 0;const e=Yg(),t=CH(),r=Uy(),n=[],s=[],i=[],o=BigInt(0),a=BigInt(1),f=BigInt(2),c=BigInt(7),l=BigInt(256),u=BigInt(113);for(let _=0,C=a,I=1,k=0;_<24;_++){[I,k]=[k,(2*I+3*k)%5],n.push(2*(5*k+I)),s.push((_+1)*(_+2)/2%64);let E=o;for(let S=0;S<7;S++)C=(C<<a^(C>>c)*u)%l,C&f&&(E^=a<<(a<<BigInt(S))-a);i.push(E)}const[p,d]=(0,t.split)(i,!0),h=(_,C,I)=>I>32?(0,t.rotlBH)(_,C,I):(0,t.rotlSH)(_,C,I),y=(_,C,I)=>I>32?(0,t.rotlBL)(_,C,I):(0,t.rotlSL)(_,C,I);function m(_,C=24){const I=new Uint32Array(10);for(let k=24-C;k<24;k++){for(let T=0;T<10;T++)I[T]=_[T]^_[T+10]^_[T+20]^_[T+30]^_[T+40];for(let T=0;T<10;T+=2){const P=(T+8)%10,g=(T+2)%10,A=I[g],x=I[g+1],D=h(A,x,1)^I[P],O=y(A,x,1)^I[P+1];for(let B=0;B<50;B+=10)_[T+B]^=D,_[T+B+1]^=O}let E=_[2],S=_[3];for(let T=0;T<24;T++){const P=s[T],g=h(E,S,P),A=y(E,S,P),x=n[T];E=_[x],S=_[x+1],_[x]=g,_[x+1]=A}for(let T=0;T<50;T+=10){for(let P=0;P<10;P++)I[P]=_[T+P];for(let P=0;P<10;P++)_[T+P]^=~I[(P+2)%10]&I[(P+4)%10]}_[0]^=p[k],_[1]^=d[k]}I.fill(0)}ir.keccakP=m;class v extends r.Hash{constructor(C,I,k,E=!1,S=24){if(super(),this.blockLen=C,this.suffix=I,this.outputLen=k,this.enableXOF=E,this.rounds=S,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,e.number)(k),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,r.u32)(this.state)}keccak(){r.isLE||(0,r.byteSwap32)(this.state32),m(this.state32,this.rounds),r.isLE||(0,r.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(C){(0,e.exists)(this);const{blockLen:I,state:k}=this;C=(0,r.toBytes)(C);const E=C.length;for(let S=0;S<E;){const T=Math.min(I-this.pos,E-S);for(let P=0;P<T;P++)k[this.pos++]^=C[S++];this.pos===I&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:C,suffix:I,pos:k,blockLen:E}=this;C[k]^=I,I&128&&k===E-1&&this.keccak(),C[E-1]^=128,this.keccak()}writeInto(C){(0,e.exists)(this,!1),(0,e.bytes)(C),this.finish();const I=this.state,{blockLen:k}=this;for(let E=0,S=C.length;E<S;){this.posOut>=k&&this.keccak();const T=Math.min(k-this.posOut,S-E);C.set(I.subarray(this.posOut,this.posOut+T),E),this.posOut+=T,E+=T}return C}xofInto(C){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(C)}xof(C){return(0,e.number)(C),this.xofInto(new Uint8Array(C))}digestInto(C){if((0,e.output)(C,this),this.finished)throw new Error("digest() was already called");return this.writeInto(C),this.destroy(),C}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(C){const{blockLen:I,suffix:k,outputLen:E,rounds:S,enableXOF:T}=this;return C||(C=new v(I,k,E,T,S)),C.state32.set(this.state32),C.pos=this.pos,C.posOut=this.posOut,C.finished=this.finished,C.rounds=S,C.suffix=k,C.outputLen=E,C.enableXOF=T,C.destroyed=this.destroyed,C}}ir.Keccak=v;const b=(_,C,I)=>(0,r.wrapConstructor)(()=>new v(C,_,I));ir.sha3_224=b(6,144,224/8),ir.sha3_256=b(6,136,256/8),ir.sha3_384=b(6,104,384/8),ir.sha3_512=b(6,72,512/8),ir.keccak_224=b(1,144,224/8),ir.keccak_256=b(1,136,256/8),ir.keccak_384=b(1,104,384/8),ir.keccak_512=b(1,72,512/8);const w=(_,C,I)=>(0,r.wrapXOFConstructorWithOpts)((k={})=>new v(C,_,k.dkLen===void 0?I:k.dkLen,!0));return ir.shake128=w(31,168,128/8),ir.shake256=w(31,136,256/8),ir}var f0={exports:{}};f0.exports;var m6;function RH(){return m6||(m6=1,function(e,t){var r=rt&&rt.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=t.utf8ToBytes=t.createView=t.concatBytes=t.toHex=t.bytesToHex=t.assertBytes=t.assertBool=void 0,t.bytesToUtf8=f,t.hexToBytes=c,t.equalsBytes=l,t.wrapHash=u;const n=r(Yg()),s=Uy(),i=n.default.bool;t.assertBool=i;const o=n.default.bytes;t.assertBytes=o;var a=Uy();Object.defineProperty(t,"bytesToHex",{enumerable:!0,get:function(){return a.bytesToHex}}),Object.defineProperty(t,"toHex",{enumerable:!0,get:function(){return a.bytesToHex}}),Object.defineProperty(t,"concatBytes",{enumerable:!0,get:function(){return a.concatBytes}}),Object.defineProperty(t,"createView",{enumerable:!0,get:function(){return a.createView}}),Object.defineProperty(t,"utf8ToBytes",{enumerable:!0,get:function(){return a.utf8ToBytes}});function f(p){if(!(p instanceof Uint8Array))throw new TypeError(`bytesToUtf8 expected Uint8Array, got ${typeof p}`);return new TextDecoder().decode(p)}function c(p){const d=p.startsWith("0x")?p.substring(2):p;return(0,s.hexToBytes)(d)}function l(p,d){if(p.length!==d.length)return!1;for(let h=0;h<p.length;h++)if(p[h]!==d[h])return!1;return!0}function u(p){return d=>(n.default.bytes(d),p(d))}t.crypto=(()=>{const p=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,d=typeof ka=="function"&&ka.bind(e);return{node:d&&!p?d("crypto"):void 0,web:p}})()}(f0,f0.exports)),f0.exports}var v6;function DH(){if(v6)return Xn;v6=1,Object.defineProperty(Xn,"__esModule",{value:!0}),Xn.keccak512=Xn.keccak384=Xn.keccak256=Xn.keccak224=void 0;const e=kH(),t=RH();return Xn.keccak224=(0,t.wrapHash)(e.keccak_224),Xn.keccak256=(()=>{const r=(0,t.wrapHash)(e.keccak_256);return r.create=e.keccak_256.create,r})(),Xn.keccak384=(0,t.wrapHash)(e.keccak_384),Xn.keccak512=(0,t.wrapHash)(e.keccak_512),Xn}var Hi={},Ad={exports:{}};Ad.exports;var b6;function BH(){return b6||(b6=1,function(e){(function(t,r){function n(P,g){if(!P)throw new Error(g||"Assertion failed")}function s(P,g){P.super_=g;var A=function(){};A.prototype=g.prototype,P.prototype=new A,P.prototype.constructor=P}function i(P,g,A){if(i.isBN(P))return P;this.negative=0,this.words=null,this.length=0,this.red=null,P!==null&&((g==="le"||g==="be")&&(A=g,g=10),this._init(P||0,g||10,A||"be"))}typeof t=="object"?t.exports=i:r.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=xa.Buffer}catch{}i.isBN=function(g){return g instanceof i?!0:g!==null&&typeof g=="object"&&g.constructor.wordSize===i.wordSize&&Array.isArray(g.words)},i.max=function(g,A){return g.cmp(A)>0?g:A},i.min=function(g,A){return g.cmp(A)<0?g:A},i.prototype._init=function(g,A,x){if(typeof g=="number")return this._initNumber(g,A,x);if(typeof g=="object")return this._initArray(g,A,x);A==="hex"&&(A=16),n(A===(A|0)&&A>=2&&A<=36),g=g.toString().replace(/\s+/g,"");var D=0;g[0]==="-"&&(D++,this.negative=1),D<g.length&&(A===16?this._parseHex(g,D,x):(this._parseBase(g,A,D),x==="le"&&this._initArray(this.toArray(),A,x)))},i.prototype._initNumber=function(g,A,x){g<0&&(this.negative=1,g=-g),g<67108864?(this.words=[g&67108863],this.length=1):g<4503599627370496?(this.words=[g&67108863,g/67108864&67108863],this.length=2):(n(g<9007199254740992),this.words=[g&67108863,g/67108864&67108863,1],this.length=3),x==="le"&&this._initArray(this.toArray(),A,x)},i.prototype._initArray=function(g,A,x){if(n(typeof g.length=="number"),g.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(g.length/3),this.words=new Array(this.length);for(var D=0;D<this.length;D++)this.words[D]=0;var O,B,L=0;if(x==="be")for(D=g.length-1,O=0;D>=0;D-=3)B=g[D]|g[D-1]<<8|g[D-2]<<16,this.words[O]|=B<<L&67108863,this.words[O+1]=B>>>26-L&67108863,L+=24,L>=26&&(L-=26,O++);else if(x==="le")for(D=0,O=0;D<g.length;D+=3)B=g[D]|g[D+1]<<8|g[D+2]<<16,this.words[O]|=B<<L&67108863,this.words[O+1]=B>>>26-L&67108863,L+=24,L>=26&&(L-=26,O++);return this.strip()};function a(P,g){var A=P.charCodeAt(g);return A>=65&&A<=70?A-55:A>=97&&A<=102?A-87:A-48&15}function f(P,g,A){var x=a(P,A);return A-1>=g&&(x|=a(P,A-1)<<4),x}i.prototype._parseHex=function(g,A,x){this.length=Math.ceil((g.length-A)/6),this.words=new Array(this.length);for(var D=0;D<this.length;D++)this.words[D]=0;var O=0,B=0,L;if(x==="be")for(D=g.length-1;D>=A;D-=2)L=f(g,A,D)<<O,this.words[B]|=L&67108863,O>=18?(O-=18,B+=1,this.words[B]|=L>>>26):O+=8;else{var M=g.length-A;for(D=M%2===0?A+1:A;D<g.length;D+=2)L=f(g,A,D)<<O,this.words[B]|=L&67108863,O>=18?(O-=18,B+=1,this.words[B]|=L>>>26):O+=8}this.strip()};function c(P,g,A,x){for(var D=0,O=Math.min(P.length,A),B=g;B<O;B++){var L=P.charCodeAt(B)-48;D*=x,L>=49?D+=L-49+10:L>=17?D+=L-17+10:D+=L}return D}i.prototype._parseBase=function(g,A,x){this.words=[0],this.length=1;for(var D=0,O=1;O<=67108863;O*=A)D++;D--,O=O/A|0;for(var B=g.length-x,L=B%D,M=Math.min(B,B-L)+x,R=0,N=x;N<M;N+=D)R=c(g,N,N+D,A),this.imuln(O),this.words[0]+R<67108864?this.words[0]+=R:this._iaddn(R);if(L!==0){var F=1;for(R=c(g,N,g.length,A),N=0;N<L;N++)F*=A;this.imuln(F),this.words[0]+R<67108864?this.words[0]+=R:this._iaddn(R)}this.strip()},i.prototype.copy=function(g){g.words=new Array(this.length);for(var A=0;A<this.length;A++)g.words[A]=this.words[A];g.length=this.length,g.negative=this.negative,g.red=this.red},i.prototype.clone=function(){var g=new i(null);return this.copy(g),g},i.prototype._expand=function(g){for(;this.length<g;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l=["","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"],u=[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],p=[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];i.prototype.toString=function(g,A){g=g||10,A=A|0||1;var x;if(g===16||g==="hex"){x="";for(var D=0,O=0,B=0;B<this.length;B++){var L=this.words[B],M=((L<<D|O)&16777215).toString(16);O=L>>>24-D&16777215,D+=2,D>=26&&(D-=26,B--),O!==0||B!==this.length-1?x=l[6-M.length]+M+x:x=M+x}for(O!==0&&(x=O.toString(16)+x);x.length%A!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}if(g===(g|0)&&g>=2&&g<=36){var R=u[g],N=p[g];x="";var F=this.clone();for(F.negative=0;!F.isZero();){var z=F.modn(N).toString(g);F=F.idivn(N),F.isZero()?x=z+x:x=l[R-z.length]+z+x}for(this.isZero()&&(x="0"+x);x.length%A!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var g=this.words[0];return this.length===2?g+=this.words[1]*67108864:this.length===3&&this.words[2]===1?g+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-g:g},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(g,A){return n(typeof o<"u"),this.toArrayLike(o,g,A)},i.prototype.toArray=function(g,A){return this.toArrayLike(Array,g,A)},i.prototype.toArrayLike=function(g,A,x){var D=this.byteLength(),O=x||Math.max(1,D);n(D<=O,"byte array longer than desired length"),n(O>0,"Requested array length <= 0"),this.strip();var B=A==="le",L=new g(O),M,R,N=this.clone();if(B){for(R=0;!N.isZero();R++)M=N.andln(255),N.iushrn(8),L[R]=M;for(;R<O;R++)L[R]=0}else{for(R=0;R<O-D;R++)L[R]=0;for(R=0;!N.isZero();R++)M=N.andln(255),N.iushrn(8),L[O-R-1]=M}return L},Math.clz32?i.prototype._countBits=function(g){return 32-Math.clz32(g)}:i.prototype._countBits=function(g){var A=g,x=0;return A>=4096&&(x+=13,A>>>=13),A>=64&&(x+=7,A>>>=7),A>=8&&(x+=4,A>>>=4),A>=2&&(x+=2,A>>>=2),x+A},i.prototype._zeroBits=function(g){if(g===0)return 26;var A=g,x=0;return A&8191||(x+=13,A>>>=13),A&127||(x+=7,A>>>=7),A&15||(x+=4,A>>>=4),A&3||(x+=2,A>>>=2),A&1||x++,x},i.prototype.bitLength=function(){var g=this.words[this.length-1],A=this._countBits(g);return(this.length-1)*26+A};function d(P){for(var g=new Array(P.bitLength()),A=0;A<g.length;A++){var x=A/26|0,D=A%26;g[A]=(P.words[x]&1<<D)>>>D}return g}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var g=0,A=0;A<this.length;A++){var x=this._zeroBits(this.words[A]);if(g+=x,x!==26)break}return g},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(g){return this.negative!==0?this.abs().inotn(g).iaddn(1):this.clone()},i.prototype.fromTwos=function(g){return this.testn(g-1)?this.notn(g).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(g){for(;this.length<g.length;)this.words[this.length++]=0;for(var A=0;A<g.length;A++)this.words[A]=this.words[A]|g.words[A];return this.strip()},i.prototype.ior=function(g){return n((this.negative|g.negative)===0),this.iuor(g)},i.prototype.or=function(g){return this.length>g.length?this.clone().ior(g):g.clone().ior(this)},i.prototype.uor=function(g){return this.length>g.length?this.clone().iuor(g):g.clone().iuor(this)},i.prototype.iuand=function(g){var A;this.length>g.length?A=g:A=this;for(var x=0;x<A.length;x++)this.words[x]=this.words[x]&g.words[x];return this.length=A.length,this.strip()},i.prototype.iand=function(g){return n((this.negative|g.negative)===0),this.iuand(g)},i.prototype.and=function(g){return this.length>g.length?this.clone().iand(g):g.clone().iand(this)},i.prototype.uand=function(g){return this.length>g.length?this.clone().iuand(g):g.clone().iuand(this)},i.prototype.iuxor=function(g){var A,x;this.length>g.length?(A=this,x=g):(A=g,x=this);for(var D=0;D<x.length;D++)this.words[D]=A.words[D]^x.words[D];if(this!==A)for(;D<A.length;D++)this.words[D]=A.words[D];return this.length=A.length,this.strip()},i.prototype.ixor=function(g){return n((this.negative|g.negative)===0),this.iuxor(g)},i.prototype.xor=function(g){return this.length>g.length?this.clone().ixor(g):g.clone().ixor(this)},i.prototype.uxor=function(g){return this.length>g.length?this.clone().iuxor(g):g.clone().iuxor(this)},i.prototype.inotn=function(g){n(typeof g=="number"&&g>=0);var A=Math.ceil(g/26)|0,x=g%26;this._expand(A),x>0&&A--;for(var D=0;D<A;D++)this.words[D]=~this.words[D]&67108863;return x>0&&(this.words[D]=~this.words[D]&67108863>>26-x),this.strip()},i.prototype.notn=function(g){return this.clone().inotn(g)},i.prototype.setn=function(g,A){n(typeof g=="number"&&g>=0);var x=g/26|0,D=g%26;return this._expand(x+1),A?this.words[x]=this.words[x]|1<<D:this.words[x]=this.words[x]&~(1<<D),this.strip()},i.prototype.iadd=function(g){var A;if(this.negative!==0&&g.negative===0)return this.negative=0,A=this.isub(g),this.negative^=1,this._normSign();if(this.negative===0&&g.negative!==0)return g.negative=0,A=this.isub(g),g.negative=1,A._normSign();var x,D;this.length>g.length?(x=this,D=g):(x=g,D=this);for(var O=0,B=0;B<D.length;B++)A=(x.words[B]|0)+(D.words[B]|0)+O,this.words[B]=A&67108863,O=A>>>26;for(;O!==0&&B<x.length;B++)A=(x.words[B]|0)+O,this.words[B]=A&67108863,O=A>>>26;if(this.length=x.length,O!==0)this.words[this.length]=O,this.length++;else if(x!==this)for(;B<x.length;B++)this.words[B]=x.words[B];return this},i.prototype.add=function(g){var A;return g.negative!==0&&this.negative===0?(g.negative=0,A=this.sub(g),g.negative^=1,A):g.negative===0&&this.negative!==0?(this.negative=0,A=g.sub(this),this.negative=1,A):this.length>g.length?this.clone().iadd(g):g.clone().iadd(this)},i.prototype.isub=function(g){if(g.negative!==0){g.negative=0;var A=this.iadd(g);return g.negative=1,A._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(g),this.negative=1,this._normSign();var x=this.cmp(g);if(x===0)return this.negative=0,this.length=1,this.words[0]=0,this;var D,O;x>0?(D=this,O=g):(D=g,O=this);for(var B=0,L=0;L<O.length;L++)A=(D.words[L]|0)-(O.words[L]|0)+B,B=A>>26,this.words[L]=A&67108863;for(;B!==0&&L<D.length;L++)A=(D.words[L]|0)+B,B=A>>26,this.words[L]=A&67108863;if(B===0&&L<D.length&&D!==this)for(;L<D.length;L++)this.words[L]=D.words[L];return this.length=Math.max(this.length,L),D!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(g){return this.clone().isub(g)};function h(P,g,A){A.negative=g.negative^P.negative;var x=P.length+g.length|0;A.length=x,x=x-1|0;var D=P.words[0]|0,O=g.words[0]|0,B=D*O,L=B&67108863,M=B/67108864|0;A.words[0]=L;for(var R=1;R<x;R++){for(var N=M>>>26,F=M&67108863,z=Math.min(R,g.length-1),Y=Math.max(0,R-P.length+1);Y<=z;Y++){var j=R-Y|0;D=P.words[j]|0,O=g.words[Y]|0,B=D*O+F,N+=B/67108864|0,F=B&67108863}A.words[R]=F|0,M=N|0}return M!==0?A.words[R]=M|0:A.length--,A.strip()}var y=function(g,A,x){var D=g.words,O=A.words,B=x.words,L=0,M,R,N,F=D[0]|0,z=F&8191,Y=F>>>13,j=D[1]|0,re=j&8191,V=j>>>13,U=D[2]|0,X=U&8191,ye=U>>>13,_e=D[3]|0,Ae=_e&8191,H=_e>>>13,q=D[4]|0,W=q&8191,ee=q>>>13,le=D[5]|0,ce=le&8191,ie=le>>>13,Fe=D[6]|0,De=Fe&8191,qe=Fe>>>13,he=D[7]|0,ue=he&8191,pe=he>>>13,de=D[8]|0,fe=de&8191,ge=de>>>13,se=D[9]|0,te=se&8191,Ne=se>>>13,Ve=O[0]|0,Je=Ve&8191,lt=Ve>>>13,tt=O[1]|0,ve=tt&8191,Z=tt>>>13,oe=O[2]|0,me=oe&8191,xe=oe>>>13,Pe=O[3]|0,ke=Pe&8191,Oe=Pe>>>13,Ue=O[4]|0,Ie=Ue&8191,Re=Ue>>>13,et=O[5]|0,we=et&8191,Ce=et>>>13,Be=O[6]|0,Le=Be&8191,Me=Be>>>13,$=O[7]|0,J=$&8191,Q=$>>>13,K=O[8]|0,ae=K&8191,Se=K>>>13,Te=O[9]|0,Ke=Te&8191,Ge=Te>>>13;x.negative=g.negative^A.negative,x.length=19,M=Math.imul(z,Je),R=Math.imul(z,lt),R=R+Math.imul(Y,Je)|0,N=Math.imul(Y,lt);var dt=(L+M|0)+((R&8191)<<13)|0;L=(N+(R>>>13)|0)+(dt>>>26)|0,dt&=67108863,M=Math.imul(re,Je),R=Math.imul(re,lt),R=R+Math.imul(V,Je)|0,N=Math.imul(V,lt),M=M+Math.imul(z,ve)|0,R=R+Math.imul(z,Z)|0,R=R+Math.imul(Y,ve)|0,N=N+Math.imul(Y,Z)|0;var it=(L+M|0)+((R&8191)<<13)|0;L=(N+(R>>>13)|0)+(it>>>26)|0,it&=67108863,M=Math.imul(X,Je),R=Math.imul(X,lt),R=R+Math.imul(ye,Je)|0,N=Math.imul(ye,lt),M=M+Math.imul(re,ve)|0,R=R+Math.imul(re,Z)|0,R=R+Math.imul(V,ve)|0,N=N+Math.imul(V,Z)|0,M=M+Math.imul(z,me)|0,R=R+Math.imul(z,xe)|0,R=R+Math.imul(Y,me)|0,N=N+Math.imul(Y,xe)|0;var Ct=(L+M|0)+((R&8191)<<13)|0;L=(N+(R>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,M=Math.imul(Ae,Je),R=Math.imul(Ae,lt),R=R+Math.imul(H,Je)|0,N=Math.imul(H,lt),M=M+Math.imul(X,ve)|0,R=R+Math.imul(X,Z)|0,R=R+Math.imul(ye,ve)|0,N=N+Math.imul(ye,Z)|0,M=M+Math.imul(re,me)|0,R=R+Math.imul(re,xe)|0,R=R+Math.imul(V,me)|0,N=N+Math.imul(V,xe)|0,M=M+Math.imul(z,ke)|0,R=R+Math.imul(z,Oe)|0,R=R+Math.imul(Y,ke)|0,N=N+Math.imul(Y,Oe)|0;var at=(L+M|0)+((R&8191)<<13)|0;L=(N+(R>>>13)|0)+(at>>>26)|0,at&=67108863,M=Math.imul(W,Je),R=Math.imul(W,lt),R=R+Math.imul(ee,Je)|0,N=Math.imul(ee,lt),M=M+Math.imul(Ae,ve)|0,R=R+Math.imul(Ae,Z)|0,R=R+Math.imul(H,ve)|0,N=N+Math.imul(H,Z)|0,M=M+Math.imul(X,me)|0,R=R+Math.imul(X,xe)|0,R=R+Math.imul(ye,me)|0,N=N+Math.imul(ye,xe)|0,M=M+Math.imul(re,ke)|0,R=R+Math.imul(re,Oe)|0,R=R+Math.imul(V,ke)|0,N=N+Math.imul(V,Oe)|0,M=M+Math.imul(z,Ie)|0,R=R+Math.imul(z,Re)|0,R=R+Math.imul(Y,Ie)|0,N=N+Math.imul(Y,Re)|0;var vt=(L+M|0)+((R&8191)<<13)|0;L=(N+(R>>>13)|0)+(vt>>>26)|0,vt&=67108863,M=Math.imul(ce,Je),R=Math.imul(ce,lt),R=R+Math.imul(ie,Je)|0,N=Math.imul(ie,lt),M=M+Math.imul(W,ve)|0,R=R+Math.imul(W,Z)|0,R=R+Math.imul(ee,ve)|0,N=N+Math.imul(ee,Z)|0,M=M+Math.imul(Ae,me)|0,R=R+Math.imul(Ae,xe)|0,R=R+Math.imul(H,me)|0,N=N+Math.imul(H,xe)|0,M=M+Math.imul(X,ke)|0,R=R+Math.imul(X,Oe)|0,R=R+Math.imul(ye,ke)|0,N=N+Math.imul(ye,Oe)|0,M=M+Math.imul(re,Ie)|0,R=R+Math.imul(re,Re)|0,R=R+Math.imul(V,Ie)|0,N=N+Math.imul(V,Re)|0,M=M+Math.imul(z,we)|0,R=R+Math.imul(z,Ce)|0,R=R+Math.imul(Y,we)|0,N=N+Math.imul(Y,Ce)|0;var bt=(L+M|0)+((R&8191)<<13)|0;L=(N+(R>>>13)|0)+(bt>>>26)|0,bt&=67108863,M=Math.imul(De,Je),R=Math.imul(De,lt),R=R+Math.imul(qe,Je)|0,N=Math.imul(qe,lt),M=M+Math.imul(ce,ve)|0,R=R+Math.imul(ce,Z)|0,R=R+Math.imul(ie,ve)|0,N=N+Math.imul(ie,Z)|0,M=M+Math.imul(W,me)|0,R=R+Math.imul(W,xe)|0,R=R+Math.imul(ee,me)|0,N=N+Math.imul(ee,xe)|0,M=M+Math.imul(Ae,ke)|0,R=R+Math.imul(Ae,Oe)|0,R=R+Math.imul(H,ke)|0,N=N+Math.imul(H,Oe)|0,M=M+Math.imul(X,Ie)|0,R=R+Math.imul(X,Re)|0,R=R+Math.imul(ye,Ie)|0,N=N+Math.imul(ye,Re)|0,M=M+Math.imul(re,we)|0,R=R+Math.imul(re,Ce)|0,R=R+Math.imul(V,we)|0,N=N+Math.imul(V,Ce)|0,M=M+Math.imul(z,Le)|0,R=R+Math.imul(z,Me)|0,R=R+Math.imul(Y,Le)|0,N=N+Math.imul(Y,Me)|0;var St=(L+M|0)+((R&8191)<<13)|0;L=(N+(R>>>13)|0)+(St>>>26)|0,St&=67108863,M=Math.imul(ue,Je),R=Math.imul(ue,lt),R=R+Math.imul(pe,Je)|0,N=Math.imul(pe,lt),M=M+Math.imul(De,ve)|0,R=R+Math.imul(De,Z)|0,R=R+Math.imul(qe,ve)|0,N=N+Math.imul(qe,Z)|0,M=M+Math.imul(ce,me)|0,R=R+Math.imul(ce,xe)|0,R=R+Math.imul(ie,me)|0,N=N+Math.imul(ie,xe)|0,M=M+Math.imul(W,ke)|0,R=R+Math.imul(W,Oe)|0,R=R+Math.imul(ee,ke)|0,N=N+Math.imul(ee,Oe)|0,M=M+Math.imul(Ae,Ie)|0,R=R+Math.imul(Ae,Re)|0,R=R+Math.imul(H,Ie)|0,N=N+Math.imul(H,Re)|0,M=M+Math.imul(X,we)|0,R=R+Math.imul(X,Ce)|0,R=R+Math.imul(ye,we)|0,N=N+Math.imul(ye,Ce)|0,M=M+Math.imul(re,Le)|0,R=R+Math.imul(re,Me)|0,R=R+Math.imul(V,Le)|0,N=N+Math.imul(V,Me)|0,M=M+Math.imul(z,J)|0,R=R+Math.imul(z,Q)|0,R=R+Math.imul(Y,J)|0,N=N+Math.imul(Y,Q)|0;var At=(L+M|0)+((R&8191)<<13)|0;L=(N+(R>>>13)|0)+(At>>>26)|0,At&=67108863,M=Math.imul(fe,Je),R=Math.imul(fe,lt),R=R+Math.imul(ge,Je)|0,N=Math.imul(ge,lt),M=M+Math.imul(ue,ve)|0,R=R+Math.imul(ue,Z)|0,R=R+Math.imul(pe,ve)|0,N=N+Math.imul(pe,Z)|0,M=M+Math.imul(De,me)|0,R=R+Math.imul(De,xe)|0,R=R+Math.imul(qe,me)|0,N=N+Math.imul(qe,xe)|0,M=M+Math.imul(ce,ke)|0,R=R+Math.imul(ce,Oe)|0,R=R+Math.imul(ie,ke)|0,N=N+Math.imul(ie,Oe)|0,M=M+Math.imul(W,Ie)|0,R=R+Math.imul(W,Re)|0,R=R+Math.imul(ee,Ie)|0,N=N+Math.imul(ee,Re)|0,M=M+Math.imul(Ae,we)|0,R=R+Math.imul(Ae,Ce)|0,R=R+Math.imul(H,we)|0,N=N+Math.imul(H,Ce)|0,M=M+Math.imul(X,Le)|0,R=R+Math.imul(X,Me)|0,R=R+Math.imul(ye,Le)|0,N=N+Math.imul(ye,Me)|0,M=M+Math.imul(re,J)|0,R=R+Math.imul(re,Q)|0,R=R+Math.imul(V,J)|0,N=N+Math.imul(V,Q)|0,M=M+Math.imul(z,ae)|0,R=R+Math.imul(z,Se)|0,R=R+Math.imul(Y,ae)|0,N=N+Math.imul(Y,Se)|0;var _t=(L+M|0)+((R&8191)<<13)|0;L=(N+(R>>>13)|0)+(_t>>>26)|0,_t&=67108863,M=Math.imul(te,Je),R=Math.imul(te,lt),R=R+Math.imul(Ne,Je)|0,N=Math.imul(Ne,lt),M=M+Math.imul(fe,ve)|0,R=R+Math.imul(fe,Z)|0,R=R+Math.imul(ge,ve)|0,N=N+Math.imul(ge,Z)|0,M=M+Math.imul(ue,me)|0,R=R+Math.imul(ue,xe)|0,R=R+Math.imul(pe,me)|0,N=N+Math.imul(pe,xe)|0,M=M+Math.imul(De,ke)|0,R=R+Math.imul(De,Oe)|0,R=R+Math.imul(qe,ke)|0,N=N+Math.imul(qe,Oe)|0,M=M+Math.imul(ce,Ie)|0,R=R+Math.imul(ce,Re)|0,R=R+Math.imul(ie,Ie)|0,N=N+Math.imul(ie,Re)|0,M=M+Math.imul(W,we)|0,R=R+Math.imul(W,Ce)|0,R=R+Math.imul(ee,we)|0,N=N+Math.imul(ee,Ce)|0,M=M+Math.imul(Ae,Le)|0,R=R+Math.imul(Ae,Me)|0,R=R+Math.imul(H,Le)|0,N=N+Math.imul(H,Me)|0,M=M+Math.imul(X,J)|0,R=R+Math.imul(X,Q)|0,R=R+Math.imul(ye,J)|0,N=N+Math.imul(ye,Q)|0,M=M+Math.imul(re,ae)|0,R=R+Math.imul(re,Se)|0,R=R+Math.imul(V,ae)|0,N=N+Math.imul(V,Se)|0,M=M+Math.imul(z,Ke)|0,R=R+Math.imul(z,Ge)|0,R=R+Math.imul(Y,Ke)|0,N=N+Math.imul(Y,Ge)|0;var Et=(L+M|0)+((R&8191)<<13)|0;L=(N+(R>>>13)|0)+(Et>>>26)|0,Et&=67108863,M=Math.imul(te,ve),R=Math.imul(te,Z),R=R+Math.imul(Ne,ve)|0,N=Math.imul(Ne,Z),M=M+Math.imul(fe,me)|0,R=R+Math.imul(fe,xe)|0,R=R+Math.imul(ge,me)|0,N=N+Math.imul(ge,xe)|0,M=M+Math.imul(ue,ke)|0,R=R+Math.imul(ue,Oe)|0,R=R+Math.imul(pe,ke)|0,N=N+Math.imul(pe,Oe)|0,M=M+Math.imul(De,Ie)|0,R=R+Math.imul(De,Re)|0,R=R+Math.imul(qe,Ie)|0,N=N+Math.imul(qe,Re)|0,M=M+Math.imul(ce,we)|0,R=R+Math.imul(ce,Ce)|0,R=R+Math.imul(ie,we)|0,N=N+Math.imul(ie,Ce)|0,M=M+Math.imul(W,Le)|0,R=R+Math.imul(W,Me)|0,R=R+Math.imul(ee,Le)|0,N=N+Math.imul(ee,Me)|0,M=M+Math.imul(Ae,J)|0,R=R+Math.imul(Ae,Q)|0,R=R+Math.imul(H,J)|0,N=N+Math.imul(H,Q)|0,M=M+Math.imul(X,ae)|0,R=R+Math.imul(X,Se)|0,R=R+Math.imul(ye,ae)|0,N=N+Math.imul(ye,Se)|0,M=M+Math.imul(re,Ke)|0,R=R+Math.imul(re,Ge)|0,R=R+Math.imul(V,Ke)|0,N=N+Math.imul(V,Ge)|0;var wt=(L+M|0)+((R&8191)<<13)|0;L=(N+(R>>>13)|0)+(wt>>>26)|0,wt&=67108863,M=Math.imul(te,me),R=Math.imul(te,xe),R=R+Math.imul(Ne,me)|0,N=Math.imul(Ne,xe),M=M+Math.imul(fe,ke)|0,R=R+Math.imul(fe,Oe)|0,R=R+Math.imul(ge,ke)|0,N=N+Math.imul(ge,Oe)|0,M=M+Math.imul(ue,Ie)|0,R=R+Math.imul(ue,Re)|0,R=R+Math.imul(pe,Ie)|0,N=N+Math.imul(pe,Re)|0,M=M+Math.imul(De,we)|0,R=R+Math.imul(De,Ce)|0,R=R+Math.imul(qe,we)|0,N=N+Math.imul(qe,Ce)|0,M=M+Math.imul(ce,Le)|0,R=R+Math.imul(ce,Me)|0,R=R+Math.imul(ie,Le)|0,N=N+Math.imul(ie,Me)|0,M=M+Math.imul(W,J)|0,R=R+Math.imul(W,Q)|0,R=R+Math.imul(ee,J)|0,N=N+Math.imul(ee,Q)|0,M=M+Math.imul(Ae,ae)|0,R=R+Math.imul(Ae,Se)|0,R=R+Math.imul(H,ae)|0,N=N+Math.imul(H,Se)|0,M=M+Math.imul(X,Ke)|0,R=R+Math.imul(X,Ge)|0,R=R+Math.imul(ye,Ke)|0,N=N+Math.imul(ye,Ge)|0;var ut=(L+M|0)+((R&8191)<<13)|0;L=(N+(R>>>13)|0)+(ut>>>26)|0,ut&=67108863,M=Math.imul(te,ke),R=Math.imul(te,Oe),R=R+Math.imul(Ne,ke)|0,N=Math.imul(Ne,Oe),M=M+Math.imul(fe,Ie)|0,R=R+Math.imul(fe,Re)|0,R=R+Math.imul(ge,Ie)|0,N=N+Math.imul(ge,Re)|0,M=M+Math.imul(ue,we)|0,R=R+Math.imul(ue,Ce)|0,R=R+Math.imul(pe,we)|0,N=N+Math.imul(pe,Ce)|0,M=M+Math.imul(De,Le)|0,R=R+Math.imul(De,Me)|0,R=R+Math.imul(qe,Le)|0,N=N+Math.imul(qe,Me)|0,M=M+Math.imul(ce,J)|0,R=R+Math.imul(ce,Q)|0,R=R+Math.imul(ie,J)|0,N=N+Math.imul(ie,Q)|0,M=M+Math.imul(W,ae)|0,R=R+Math.imul(W,Se)|0,R=R+Math.imul(ee,ae)|0,N=N+Math.imul(ee,Se)|0,M=M+Math.imul(Ae,Ke)|0,R=R+Math.imul(Ae,Ge)|0,R=R+Math.imul(H,Ke)|0,N=N+Math.imul(H,Ge)|0;var ht=(L+M|0)+((R&8191)<<13)|0;L=(N+(R>>>13)|0)+(ht>>>26)|0,ht&=67108863,M=Math.imul(te,Ie),R=Math.imul(te,Re),R=R+Math.imul(Ne,Ie)|0,N=Math.imul(Ne,Re),M=M+Math.imul(fe,we)|0,R=R+Math.imul(fe,Ce)|0,R=R+Math.imul(ge,we)|0,N=N+Math.imul(ge,Ce)|0,M=M+Math.imul(ue,Le)|0,R=R+Math.imul(ue,Me)|0,R=R+Math.imul(pe,Le)|0,N=N+Math.imul(pe,Me)|0,M=M+Math.imul(De,J)|0,R=R+Math.imul(De,Q)|0,R=R+Math.imul(qe,J)|0,N=N+Math.imul(qe,Q)|0,M=M+Math.imul(ce,ae)|0,R=R+Math.imul(ce,Se)|0,R=R+Math.imul(ie,ae)|0,N=N+Math.imul(ie,Se)|0,M=M+Math.imul(W,Ke)|0,R=R+Math.imul(W,Ge)|0,R=R+Math.imul(ee,Ke)|0,N=N+Math.imul(ee,Ge)|0;var st=(L+M|0)+((R&8191)<<13)|0;L=(N+(R>>>13)|0)+(st>>>26)|0,st&=67108863,M=Math.imul(te,we),R=Math.imul(te,Ce),R=R+Math.imul(Ne,we)|0,N=Math.imul(Ne,Ce),M=M+Math.imul(fe,Le)|0,R=R+Math.imul(fe,Me)|0,R=R+Math.imul(ge,Le)|0,N=N+Math.imul(ge,Me)|0,M=M+Math.imul(ue,J)|0,R=R+Math.imul(ue,Q)|0,R=R+Math.imul(pe,J)|0,N=N+Math.imul(pe,Q)|0,M=M+Math.imul(De,ae)|0,R=R+Math.imul(De,Se)|0,R=R+Math.imul(qe,ae)|0,N=N+Math.imul(qe,Se)|0,M=M+Math.imul(ce,Ke)|0,R=R+Math.imul(ce,Ge)|0,R=R+Math.imul(ie,Ke)|0,N=N+Math.imul(ie,Ge)|0;var ft=(L+M|0)+((R&8191)<<13)|0;L=(N+(R>>>13)|0)+(ft>>>26)|0,ft&=67108863,M=Math.imul(te,Le),R=Math.imul(te,Me),R=R+Math.imul(Ne,Le)|0,N=Math.imul(Ne,Me),M=M+Math.imul(fe,J)|0,R=R+Math.imul(fe,Q)|0,R=R+Math.imul(ge,J)|0,N=N+Math.imul(ge,Q)|0,M=M+Math.imul(ue,ae)|0,R=R+Math.imul(ue,Se)|0,R=R+Math.imul(pe,ae)|0,N=N+Math.imul(pe,Se)|0,M=M+Math.imul(De,Ke)|0,R=R+Math.imul(De,Ge)|0,R=R+Math.imul(qe,Ke)|0,N=N+Math.imul(qe,Ge)|0;var pt=(L+M|0)+((R&8191)<<13)|0;L=(N+(R>>>13)|0)+(pt>>>26)|0,pt&=67108863,M=Math.imul(te,J),R=Math.imul(te,Q),R=R+Math.imul(Ne,J)|0,N=Math.imul(Ne,Q),M=M+Math.imul(fe,ae)|0,R=R+Math.imul(fe,Se)|0,R=R+Math.imul(ge,ae)|0,N=N+Math.imul(ge,Se)|0,M=M+Math.imul(ue,Ke)|0,R=R+Math.imul(ue,Ge)|0,R=R+Math.imul(pe,Ke)|0,N=N+Math.imul(pe,Ge)|0;var ct=(L+M|0)+((R&8191)<<13)|0;L=(N+(R>>>13)|0)+(ct>>>26)|0,ct&=67108863,M=Math.imul(te,ae),R=Math.imul(te,Se),R=R+Math.imul(Ne,ae)|0,N=Math.imul(Ne,Se),M=M+Math.imul(fe,Ke)|0,R=R+Math.imul(fe,Ge)|0,R=R+Math.imul(ge,Ke)|0,N=N+Math.imul(ge,Ge)|0;var je=(L+M|0)+((R&8191)<<13)|0;L=(N+(R>>>13)|0)+(je>>>26)|0,je&=67108863,M=Math.imul(te,Ke),R=Math.imul(te,Ge),R=R+Math.imul(Ne,Ke)|0,N=Math.imul(Ne,Ge);var $e=(L+M|0)+((R&8191)<<13)|0;return L=(N+(R>>>13)|0)+($e>>>26)|0,$e&=67108863,B[0]=dt,B[1]=it,B[2]=Ct,B[3]=at,B[4]=vt,B[5]=bt,B[6]=St,B[7]=At,B[8]=_t,B[9]=Et,B[10]=wt,B[11]=ut,B[12]=ht,B[13]=st,B[14]=ft,B[15]=pt,B[16]=ct,B[17]=je,B[18]=$e,L!==0&&(B[19]=L,x.length++),x};Math.imul||(y=h);function m(P,g,A){A.negative=g.negative^P.negative,A.length=P.length+g.length;for(var x=0,D=0,O=0;O<A.length-1;O++){var B=D;D=0;for(var L=x&67108863,M=Math.min(O,g.length-1),R=Math.max(0,O-P.length+1);R<=M;R++){var N=O-R,F=P.words[N]|0,z=g.words[R]|0,Y=F*z,j=Y&67108863;B=B+(Y/67108864|0)|0,j=j+L|0,L=j&67108863,B=B+(j>>>26)|0,D+=B>>>26,B&=67108863}A.words[O]=L,x=B,B=D}return x!==0?A.words[O]=x:A.length--,A.strip()}function v(P,g,A){var x=new b;return x.mulp(P,g,A)}i.prototype.mulTo=function(g,A){var x,D=this.length+g.length;return this.length===10&&g.length===10?x=y(this,g,A):D<63?x=h(this,g,A):D<1024?x=m(this,g,A):x=v(this,g,A),x};function b(P,g){this.x=P,this.y=g}b.prototype.makeRBT=function(g){for(var A=new Array(g),x=i.prototype._countBits(g)-1,D=0;D<g;D++)A[D]=this.revBin(D,x,g);return A},b.prototype.revBin=function(g,A,x){if(g===0||g===x-1)return g;for(var D=0,O=0;O<A;O++)D|=(g&1)<<A-O-1,g>>=1;return D},b.prototype.permute=function(g,A,x,D,O,B){for(var L=0;L<B;L++)D[L]=A[g[L]],O[L]=x[g[L]]},b.prototype.transform=function(g,A,x,D,O,B){this.permute(B,g,A,x,D,O);for(var L=1;L<O;L<<=1)for(var M=L<<1,R=Math.cos(2*Math.PI/M),N=Math.sin(2*Math.PI/M),F=0;F<O;F+=M)for(var z=R,Y=N,j=0;j<L;j++){var re=x[F+j],V=D[F+j],U=x[F+j+L],X=D[F+j+L],ye=z*U-Y*X;X=z*X+Y*U,U=ye,x[F+j]=re+U,D[F+j]=V+X,x[F+j+L]=re-U,D[F+j+L]=V-X,j!==M&&(ye=R*z-N*Y,Y=R*Y+N*z,z=ye)}},b.prototype.guessLen13b=function(g,A){var x=Math.max(A,g)|1,D=x&1,O=0;for(x=x/2|0;x;x=x>>>1)O++;return 1<<O+1+D},b.prototype.conjugate=function(g,A,x){if(!(x<=1))for(var D=0;D<x/2;D++){var O=g[D];g[D]=g[x-D-1],g[x-D-1]=O,O=A[D],A[D]=-A[x-D-1],A[x-D-1]=-O}},b.prototype.normalize13b=function(g,A){for(var x=0,D=0;D<A/2;D++){var O=Math.round(g[2*D+1]/A)*8192+Math.round(g[2*D]/A)+x;g[D]=O&67108863,O<67108864?x=0:x=O/67108864|0}return g},b.prototype.convert13b=function(g,A,x,D){for(var O=0,B=0;B<A;B++)O=O+(g[B]|0),x[2*B]=O&8191,O=O>>>13,x[2*B+1]=O&8191,O=O>>>13;for(B=2*A;B<D;++B)x[B]=0;n(O===0),n((O&-8192)===0)},b.prototype.stub=function(g){for(var A=new Array(g),x=0;x<g;x++)A[x]=0;return A},b.prototype.mulp=function(g,A,x){var D=2*this.guessLen13b(g.length,A.length),O=this.makeRBT(D),B=this.stub(D),L=new Array(D),M=new Array(D),R=new Array(D),N=new Array(D),F=new Array(D),z=new Array(D),Y=x.words;Y.length=D,this.convert13b(g.words,g.length,L,D),this.convert13b(A.words,A.length,N,D),this.transform(L,B,M,R,D,O),this.transform(N,B,F,z,D,O);for(var j=0;j<D;j++){var re=M[j]*F[j]-R[j]*z[j];R[j]=M[j]*z[j]+R[j]*F[j],M[j]=re}return this.conjugate(M,R,D),this.transform(M,R,Y,B,D,O),this.conjugate(Y,B,D),this.normalize13b(Y,D),x.negative=g.negative^A.negative,x.length=g.length+A.length,x.strip()},i.prototype.mul=function(g){var A=new i(null);return A.words=new Array(this.length+g.length),this.mulTo(g,A)},i.prototype.mulf=function(g){var A=new i(null);return A.words=new Array(this.length+g.length),v(this,g,A)},i.prototype.imul=function(g){return this.clone().mulTo(g,this)},i.prototype.imuln=function(g){n(typeof g=="number"),n(g<67108864);for(var A=0,x=0;x<this.length;x++){var D=(this.words[x]|0)*g,O=(D&67108863)+(A&67108863);A>>=26,A+=D/67108864|0,A+=O>>>26,this.words[x]=O&67108863}return A!==0&&(this.words[x]=A,this.length++),this.length=g===0?1:this.length,this},i.prototype.muln=function(g){return this.clone().imuln(g)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(g){var A=d(g);if(A.length===0)return new i(1);for(var x=this,D=0;D<A.length&&A[D]===0;D++,x=x.sqr());if(++D<A.length)for(var O=x.sqr();D<A.length;D++,O=O.sqr())A[D]!==0&&(x=x.mul(O));return x},i.prototype.iushln=function(g){n(typeof g=="number"&&g>=0);var A=g%26,x=(g-A)/26,D=67108863>>>26-A<<26-A,O;if(A!==0){var B=0;for(O=0;O<this.length;O++){var L=this.words[O]&D,M=(this.words[O]|0)-L<<A;this.words[O]=M|B,B=L>>>26-A}B&&(this.words[O]=B,this.length++)}if(x!==0){for(O=this.length-1;O>=0;O--)this.words[O+x]=this.words[O];for(O=0;O<x;O++)this.words[O]=0;this.length+=x}return this.strip()},i.prototype.ishln=function(g){return n(this.negative===0),this.iushln(g)},i.prototype.iushrn=function(g,A,x){n(typeof g=="number"&&g>=0);var D;A?D=(A-A%26)/26:D=0;var O=g%26,B=Math.min((g-O)/26,this.length),L=67108863^67108863>>>O<<O,M=x;if(D-=B,D=Math.max(0,D),M){for(var R=0;R<B;R++)M.words[R]=this.words[R];M.length=B}if(B!==0)if(this.length>B)for(this.length-=B,R=0;R<this.length;R++)this.words[R]=this.words[R+B];else this.words[0]=0,this.length=1;var N=0;for(R=this.length-1;R>=0&&(N!==0||R>=D);R--){var F=this.words[R]|0;this.words[R]=N<<26-O|F>>>O,N=F&L}return M&&N!==0&&(M.words[M.length++]=N),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(g,A,x){return n(this.negative===0),this.iushrn(g,A,x)},i.prototype.shln=function(g){return this.clone().ishln(g)},i.prototype.ushln=function(g){return this.clone().iushln(g)},i.prototype.shrn=function(g){return this.clone().ishrn(g)},i.prototype.ushrn=function(g){return this.clone().iushrn(g)},i.prototype.testn=function(g){n(typeof g=="number"&&g>=0);var A=g%26,x=(g-A)/26,D=1<<A;if(this.length<=x)return!1;var O=this.words[x];return!!(O&D)},i.prototype.imaskn=function(g){n(typeof g=="number"&&g>=0);var A=g%26,x=(g-A)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=x)return this;if(A!==0&&x++,this.length=Math.min(x,this.length),A!==0){var D=67108863^67108863>>>A<<A;this.words[this.length-1]&=D}return this.strip()},i.prototype.maskn=function(g){return this.clone().imaskn(g)},i.prototype.iaddn=function(g){return n(typeof g=="number"),n(g<67108864),g<0?this.isubn(-g):this.negative!==0?this.length===1&&(this.words[0]|0)<g?(this.words[0]=g-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(g),this.negative=1,this):this._iaddn(g)},i.prototype._iaddn=function(g){this.words[0]+=g;for(var A=0;A<this.length&&this.words[A]>=67108864;A++)this.words[A]-=67108864,A===this.length-1?this.words[A+1]=1:this.words[A+1]++;return this.length=Math.max(this.length,A+1),this},i.prototype.isubn=function(g){if(n(typeof g=="number"),n(g<67108864),g<0)return this.iaddn(-g);if(this.negative!==0)return this.negative=0,this.iaddn(g),this.negative=1,this;if(this.words[0]-=g,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var A=0;A<this.length&&this.words[A]<0;A++)this.words[A]+=67108864,this.words[A+1]-=1;return this.strip()},i.prototype.addn=function(g){return this.clone().iaddn(g)},i.prototype.subn=function(g){return this.clone().isubn(g)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(g,A,x){var D=g.length+x,O;this._expand(D);var B,L=0;for(O=0;O<g.length;O++){B=(this.words[O+x]|0)+L;var M=(g.words[O]|0)*A;B-=M&67108863,L=(B>>26)-(M/67108864|0),this.words[O+x]=B&67108863}for(;O<this.length-x;O++)B=(this.words[O+x]|0)+L,L=B>>26,this.words[O+x]=B&67108863;if(L===0)return this.strip();for(n(L===-1),L=0,O=0;O<this.length;O++)B=-(this.words[O]|0)+L,L=B>>26,this.words[O]=B&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(g,A){var x=this.length-g.length,D=this.clone(),O=g,B=O.words[O.length-1]|0,L=this._countBits(B);x=26-L,x!==0&&(O=O.ushln(x),D.iushln(x),B=O.words[O.length-1]|0);var M=D.length-O.length,R;if(A!=="mod"){R=new i(null),R.length=M+1,R.words=new Array(R.length);for(var N=0;N<R.length;N++)R.words[N]=0}var F=D.clone()._ishlnsubmul(O,1,M);F.negative===0&&(D=F,R&&(R.words[M]=1));for(var z=M-1;z>=0;z--){var Y=(D.words[O.length+z]|0)*67108864+(D.words[O.length+z-1]|0);for(Y=Math.min(Y/B|0,67108863),D._ishlnsubmul(O,Y,z);D.negative!==0;)Y--,D.negative=0,D._ishlnsubmul(O,1,z),D.isZero()||(D.negative^=1);R&&(R.words[z]=Y)}return R&&R.strip(),D.strip(),A!=="div"&&x!==0&&D.iushrn(x),{div:R||null,mod:D}},i.prototype.divmod=function(g,A,x){if(n(!g.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var D,O,B;return this.negative!==0&&g.negative===0?(B=this.neg().divmod(g,A),A!=="mod"&&(D=B.div.neg()),A!=="div"&&(O=B.mod.neg(),x&&O.negative!==0&&O.iadd(g)),{div:D,mod:O}):this.negative===0&&g.negative!==0?(B=this.divmod(g.neg(),A),A!=="mod"&&(D=B.div.neg()),{div:D,mod:B.mod}):this.negative&g.negative?(B=this.neg().divmod(g.neg(),A),A!=="div"&&(O=B.mod.neg(),x&&O.negative!==0&&O.isub(g)),{div:B.div,mod:O}):g.length>this.length||this.cmp(g)<0?{div:new i(0),mod:this}:g.length===1?A==="div"?{div:this.divn(g.words[0]),mod:null}:A==="mod"?{div:null,mod:new i(this.modn(g.words[0]))}:{div:this.divn(g.words[0]),mod:new i(this.modn(g.words[0]))}:this._wordDiv(g,A)},i.prototype.div=function(g){return this.divmod(g,"div",!1).div},i.prototype.mod=function(g){return this.divmod(g,"mod",!1).mod},i.prototype.umod=function(g){return this.divmod(g,"mod",!0).mod},i.prototype.divRound=function(g){var A=this.divmod(g);if(A.mod.isZero())return A.div;var x=A.div.negative!==0?A.mod.isub(g):A.mod,D=g.ushrn(1),O=g.andln(1),B=x.cmp(D);return B<0||O===1&&B===0?A.div:A.div.negative!==0?A.div.isubn(1):A.div.iaddn(1)},i.prototype.modn=function(g){n(g<=67108863);for(var A=(1<<26)%g,x=0,D=this.length-1;D>=0;D--)x=(A*x+(this.words[D]|0))%g;return x},i.prototype.idivn=function(g){n(g<=67108863);for(var A=0,x=this.length-1;x>=0;x--){var D=(this.words[x]|0)+A*67108864;this.words[x]=D/g|0,A=D%g}return this.strip()},i.prototype.divn=function(g){return this.clone().idivn(g)},i.prototype.egcd=function(g){n(g.negative===0),n(!g.isZero());var A=this,x=g.clone();A.negative!==0?A=A.umod(g):A=A.clone();for(var D=new i(1),O=new i(0),B=new i(0),L=new i(1),M=0;A.isEven()&&x.isEven();)A.iushrn(1),x.iushrn(1),++M;for(var R=x.clone(),N=A.clone();!A.isZero();){for(var F=0,z=1;!(A.words[0]&z)&&F<26;++F,z<<=1);if(F>0)for(A.iushrn(F);F-- >0;)(D.isOdd()||O.isOdd())&&(D.iadd(R),O.isub(N)),D.iushrn(1),O.iushrn(1);for(var Y=0,j=1;!(x.words[0]&j)&&Y<26;++Y,j<<=1);if(Y>0)for(x.iushrn(Y);Y-- >0;)(B.isOdd()||L.isOdd())&&(B.iadd(R),L.isub(N)),B.iushrn(1),L.iushrn(1);A.cmp(x)>=0?(A.isub(x),D.isub(B),O.isub(L)):(x.isub(A),B.isub(D),L.isub(O))}return{a:B,b:L,gcd:x.iushln(M)}},i.prototype._invmp=function(g){n(g.negative===0),n(!g.isZero());var A=this,x=g.clone();A.negative!==0?A=A.umod(g):A=A.clone();for(var D=new i(1),O=new i(0),B=x.clone();A.cmpn(1)>0&&x.cmpn(1)>0;){for(var L=0,M=1;!(A.words[0]&M)&&L<26;++L,M<<=1);if(L>0)for(A.iushrn(L);L-- >0;)D.isOdd()&&D.iadd(B),D.iushrn(1);for(var R=0,N=1;!(x.words[0]&N)&&R<26;++R,N<<=1);if(R>0)for(x.iushrn(R);R-- >0;)O.isOdd()&&O.iadd(B),O.iushrn(1);A.cmp(x)>=0?(A.isub(x),D.isub(O)):(x.isub(A),O.isub(D))}var F;return A.cmpn(1)===0?F=D:F=O,F.cmpn(0)<0&&F.iadd(g),F},i.prototype.gcd=function(g){if(this.isZero())return g.abs();if(g.isZero())return this.abs();var A=this.clone(),x=g.clone();A.negative=0,x.negative=0;for(var D=0;A.isEven()&&x.isEven();D++)A.iushrn(1),x.iushrn(1);do{for(;A.isEven();)A.iushrn(1);for(;x.isEven();)x.iushrn(1);var O=A.cmp(x);if(O<0){var B=A;A=x,x=B}else if(O===0||x.cmpn(1)===0)break;A.isub(x)}while(!0);return x.iushln(D)},i.prototype.invm=function(g){return this.egcd(g).a.umod(g)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(g){return this.words[0]&g},i.prototype.bincn=function(g){n(typeof g=="number");var A=g%26,x=(g-A)/26,D=1<<A;if(this.length<=x)return this._expand(x+1),this.words[x]|=D,this;for(var O=D,B=x;O!==0&&B<this.length;B++){var L=this.words[B]|0;L+=O,O=L>>>26,L&=67108863,this.words[B]=L}return O!==0&&(this.words[B]=O,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(g){var A=g<0;if(this.negative!==0&&!A)return-1;if(this.negative===0&&A)return 1;this.strip();var x;if(this.length>1)x=1;else{A&&(g=-g),n(g<=67108863,"Number is too big");var D=this.words[0]|0;x=D===g?0:D<g?-1:1}return this.negative!==0?-x|0:x},i.prototype.cmp=function(g){if(this.negative!==0&&g.negative===0)return-1;if(this.negative===0&&g.negative!==0)return 1;var A=this.ucmp(g);return this.negative!==0?-A|0:A},i.prototype.ucmp=function(g){if(this.length>g.length)return 1;if(this.length<g.length)return-1;for(var A=0,x=this.length-1;x>=0;x--){var D=this.words[x]|0,O=g.words[x]|0;if(D!==O){D<O?A=-1:D>O&&(A=1);break}}return A},i.prototype.gtn=function(g){return this.cmpn(g)===1},i.prototype.gt=function(g){return this.cmp(g)===1},i.prototype.gten=function(g){return this.cmpn(g)>=0},i.prototype.gte=function(g){return this.cmp(g)>=0},i.prototype.ltn=function(g){return this.cmpn(g)===-1},i.prototype.lt=function(g){return this.cmp(g)===-1},i.prototype.lten=function(g){return this.cmpn(g)<=0},i.prototype.lte=function(g){return this.cmp(g)<=0},i.prototype.eqn=function(g){return this.cmpn(g)===0},i.prototype.eq=function(g){return this.cmp(g)===0},i.red=function(g){return new S(g)},i.prototype.toRed=function(g){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),g.convertTo(this)._forceRed(g)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(g){return this.red=g,this},i.prototype.forceRed=function(g){return n(!this.red,"Already a number in reduction context"),this._forceRed(g)},i.prototype.redAdd=function(g){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,g)},i.prototype.redIAdd=function(g){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,g)},i.prototype.redSub=function(g){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,g)},i.prototype.redISub=function(g){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,g)},i.prototype.redShl=function(g){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,g)},i.prototype.redMul=function(g){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.mul(this,g)},i.prototype.redIMul=function(g){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.imul(this,g)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(g){return n(this.red&&!g.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,g)};var w={k256:null,p224:null,p192:null,p25519:null};function _(P,g){this.name=P,this.p=new i(g,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}_.prototype._tmp=function(){var g=new i(null);return g.words=new Array(Math.ceil(this.n/13)),g},_.prototype.ireduce=function(g){var A=g,x;do this.split(A,this.tmp),A=this.imulK(A),A=A.iadd(this.tmp),x=A.bitLength();while(x>this.n);var D=x<this.n?-1:A.ucmp(this.p);return D===0?(A.words[0]=0,A.length=1):D>0?A.isub(this.p):A.strip!==void 0?A.strip():A._strip(),A},_.prototype.split=function(g,A){g.iushrn(this.n,0,A)},_.prototype.imulK=function(g){return g.imul(this.k)};function C(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(C,_),C.prototype.split=function(g,A){for(var x=4194303,D=Math.min(g.length,9),O=0;O<D;O++)A.words[O]=g.words[O];if(A.length=D,g.length<=9){g.words[0]=0,g.length=1;return}var B=g.words[9];for(A.words[A.length++]=B&x,O=10;O<g.length;O++){var L=g.words[O]|0;g.words[O-10]=(L&x)<<4|B>>>22,B=L}B>>>=22,g.words[O-10]=B,B===0&&g.length>10?g.length-=10:g.length-=9},C.prototype.imulK=function(g){g.words[g.length]=0,g.words[g.length+1]=0,g.length+=2;for(var A=0,x=0;x<g.length;x++){var D=g.words[x]|0;A+=D*977,g.words[x]=A&67108863,A=D*64+(A/67108864|0)}return g.words[g.length-1]===0&&(g.length--,g.words[g.length-1]===0&&g.length--),g};function I(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(I,_);function k(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(k,_);function E(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(E,_),E.prototype.imulK=function(g){for(var A=0,x=0;x<g.length;x++){var D=(g.words[x]|0)*19+A,O=D&67108863;D>>>=26,g.words[x]=O,A=D}return A!==0&&(g.words[g.length++]=A),g},i._prime=function(g){if(w[g])return w[g];var A;if(g==="k256")A=new C;else if(g==="p224")A=new I;else if(g==="p192")A=new k;else if(g==="p25519")A=new E;else throw new Error("Unknown prime "+g);return w[g]=A,A};function S(P){if(typeof P=="string"){var g=i._prime(P);this.m=g.p,this.prime=g}else n(P.gtn(1),"modulus must be greater than 1"),this.m=P,this.prime=null}S.prototype._verify1=function(g){n(g.negative===0,"red works only with positives"),n(g.red,"red works only with red numbers")},S.prototype._verify2=function(g,A){n((g.negative|A.negative)===0,"red works only with positives"),n(g.red&&g.red===A.red,"red works only with red numbers")},S.prototype.imod=function(g){return this.prime?this.prime.ireduce(g)._forceRed(this):g.umod(this.m)._forceRed(this)},S.prototype.neg=function(g){return g.isZero()?g.clone():this.m.sub(g)._forceRed(this)},S.prototype.add=function(g,A){this._verify2(g,A);var x=g.add(A);return x.cmp(this.m)>=0&&x.isub(this.m),x._forceRed(this)},S.prototype.iadd=function(g,A){this._verify2(g,A);var x=g.iadd(A);return x.cmp(this.m)>=0&&x.isub(this.m),x},S.prototype.sub=function(g,A){this._verify2(g,A);var x=g.sub(A);return x.cmpn(0)<0&&x.iadd(this.m),x._forceRed(this)},S.prototype.isub=function(g,A){this._verify2(g,A);var x=g.isub(A);return x.cmpn(0)<0&&x.iadd(this.m),x},S.prototype.shl=function(g,A){return this._verify1(g),this.imod(g.ushln(A))},S.prototype.imul=function(g,A){return this._verify2(g,A),this.imod(g.imul(A))},S.prototype.mul=function(g,A){return this._verify2(g,A),this.imod(g.mul(A))},S.prototype.isqr=function(g){return this.imul(g,g.clone())},S.prototype.sqr=function(g){return this.mul(g,g)},S.prototype.sqrt=function(g){if(g.isZero())return g.clone();var A=this.m.andln(3);if(n(A%2===1),A===3){var x=this.m.add(new i(1)).iushrn(2);return this.pow(g,x)}for(var D=this.m.subn(1),O=0;!D.isZero()&&D.andln(1)===0;)O++,D.iushrn(1);n(!D.isZero());var B=new i(1).toRed(this),L=B.redNeg(),M=this.m.subn(1).iushrn(1),R=this.m.bitLength();for(R=new i(2*R*R).toRed(this);this.pow(R,M).cmp(L)!==0;)R.redIAdd(L);for(var N=this.pow(R,D),F=this.pow(g,D.addn(1).iushrn(1)),z=this.pow(g,D),Y=O;z.cmp(B)!==0;){for(var j=z,re=0;j.cmp(B)!==0;re++)j=j.redSqr();n(re<Y);var V=this.pow(N,new i(1).iushln(Y-re-1));F=F.redMul(V),N=V.redSqr(),z=z.redMul(N),Y=re}return F},S.prototype.invm=function(g){var A=g._invmp(this.m);return A.negative!==0?(A.negative=0,this.imod(A).redNeg()):this.imod(A)},S.prototype.pow=function(g,A){if(A.isZero())return new i(1).toRed(this);if(A.cmpn(1)===0)return g.clone();var x=4,D=new Array(1<<x);D[0]=new i(1).toRed(this),D[1]=g;for(var O=2;O<D.length;O++)D[O]=this.mul(D[O-1],g);var B=D[0],L=0,M=0,R=A.bitLength()%26;for(R===0&&(R=26),O=A.length-1;O>=0;O--){for(var N=A.words[O],F=R-1;F>=0;F--){var z=N>>F&1;if(B!==D[0]&&(B=this.sqr(B)),z===0&&L===0){M=0;continue}L<<=1,L|=z,M++,!(M!==x&&(O!==0||F!==0))&&(B=this.mul(B,D[L]),M=0,L=0)}R=26}return B},S.prototype.convertTo=function(g){var A=g.umod(this.m);return A===g?A.clone():A},S.prototype.convertFrom=function(g){var A=g.clone();return A.red=null,A},i.mont=function(g){return new T(g)};function T(P){S.call(this,P),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}s(T,S),T.prototype.convertTo=function(g){return this.imod(g.ushln(this.shift))},T.prototype.convertFrom=function(g){var A=this.imod(g.mul(this.rinv));return A.red=null,A},T.prototype.imul=function(g,A){if(g.isZero()||A.isZero())return g.words[0]=0,g.length=1,g;var x=g.imul(A),D=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=x.isub(D).iushrn(this.shift),B=O;return O.cmp(this.m)>=0?B=O.isub(this.m):O.cmpn(0)<0&&(B=O.iadd(this.m)),B._forceRed(this)},T.prototype.mul=function(g,A){if(g.isZero()||A.isZero())return new i(0)._forceRed(this);var x=g.mul(A),D=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=x.isub(D).iushrn(this.shift),B=O;return O.cmp(this.m)>=0?B=O.isub(this.m):O.cmpn(0)<0&&(B=O.iadd(this.m)),B._forceRed(this)},T.prototype.invm=function(g){var A=this.imod(g._invmp(this.m).mul(this.r2));return A._forceRed(this)}})(e,rt)}(Ad)),Ad.exports}var _6;function OH(){if(_6)return Hi;_6=1;var e=rt&&rt.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(Hi,"__esModule",{value:!0}),Hi.rawEncode=Hi.parseNumber=Hi.solidityPack=void 0;const t=Hf(),r=e(BH()),n=Wg(),s=sl();function i(m,v){if(m.length!==v.length)throw new Error("Number of types are not matching the values");const b=[];for(let w=0;w<m.length;w++){const _=u(m[w]),C=v[w];b.push(l(_,C,null))}return ot.concat(b)}Hi.solidityPack=i;function o(m){return m.endsWith("]")}function a(m){const v=m.match(/(.*)\[(.*?)\]$/u);return v?v[2]===""?"dynamic":parseInt(v[2],10):null}function f(m){const v=/^\D+(\d+)$/u.exec(m);if(v===null)throw new Error(`Invalid parseTypeN input "${m}".`);return parseInt(v[1],10)}function c(m){const v=typeof m;if(v==="string")return(0,t.isHexPrefixed)(m)?new r.default((0,n.stripHexPrefix)(m),16):new r.default(m,10);if(v==="number")return new r.default(m);if(m&&Object.prototype.hasOwnProperty.call(m,"toArray")||r.default.isBN(m))return m;throw new Error("Argument is not a number")}Hi.parseNumber=c;function l(m,v,b){if(o(m)){const w=m.replace(/\[.*?\]/u,"");if(!o(w)){const C=a(m);if(C!=="dynamic"&&C!==0&&C!==null&&v.length>C)throw new Error(`Elements exceed array size: ${C}`)}const _=v.map(C=>l(w,C,256));return ot.concat(_)}else{if(m==="bytes")return v;if(m==="string")return ot.from(v,"utf8");if(m==="bool"){b=b||8;const w=Array(b/4).join("0");return ot.from(v?`${w}1`:`${w}0`,"hex")}else if(m==="address"){let w=20;return b&&(w=b/8),(0,t.setLengthLeft)((0,t.toBuffer)(v),w)}else if(m.startsWith("bytes")){const w=f(m);if(w<1||w>32)throw new Error(`Invalid bytes<N> width: ${w}`);return typeof v=="number"&&(v=(0,s.normalize)(v)),(0,t.setLengthRight)((0,t.toBuffer)(v),w)}else if(m.startsWith("uint")){const w=f(m);if(w%8||w<8||w>256)throw new Error(`Invalid uint<N> width: ${w}`);const _=c(v);if(_.bitLength()>w)throw new Error(`Supplied uint exceeds width: ${w} vs ${_.bitLength()}`);return b=b||w,_.toArrayLike(ot,"be",b/8)}else if(m.startsWith("int")){const w=f(m);if(w%8||w<8||w>256)throw new Error(`Invalid int<N> width: ${w}`);const _=c(v);if(_.bitLength()>w)throw new Error(`Supplied int exceeds width: ${w} vs ${_.bitLength()}`);return b=b||w,_.toTwos(w).toArrayLike(ot,"be",b/8)}}throw new Error(`Unsupported or invalid type: ${JSON.stringify(m)}`)}function u(m){return m.startsWith("int[")?`int256${m.slice(3)}`:m==="int"?"int256":m.startsWith("uint[")?`uint256${m.slice(4)}`:m==="uint"?"uint256":m.startsWith("fixed[")?`fixed128x128${m.slice(5)}`:m==="fixed"?"fixed128x128":m.startsWith("ufixed[")?`ufixed128x128${m.slice(6)}`:m==="ufixed"?"ufixed128x128":m}function p(m,v){const b=[],w=[];let _=0;m.forEach(C=>{if(o(C)){const I=a(C);I!=="dynamic"&&I!==null?_+=32*I:_+=32}else _+=32});for(let C=0;C<m.length;C++){const I=u(m[C]),k=v[C],E=d(I,k);h(I)?(b.push(d("uint256",_)),w.push(E),_+=E.length):b.push(E)}return ot.concat(b.concat(w))}Hi.rawEncode=p;function d(m,v){if(m==="address")return d("uint160",c(v));if(m==="bool")return d("uint8",v?1:0);if(m==="string")return d("bytes",ot.from(v,"utf8"));if(o(m)){if(typeof v.length>"u")throw new Error("Not an array?");const b=a(m);if(b!=="dynamic"&&b!==0&&b!==null&&v.length>b)throw new Error(`Elements exceed array size: ${b}`);const w=[];m=m.slice(0,m.lastIndexOf("[")),typeof v=="string"&&(v=JSON.parse(v));for(const _ in v)Object.prototype.hasOwnProperty.call(v,_)&&w.push(d(m,v[_]));if(b==="dynamic"){const _=d("uint256",v.length);w.unshift(_)}return ot.concat(w)}else if(m==="bytes"){v=ot.from(v);let b=ot.concat([d("uint256",v.length),v]);return v.length%32!==0&&(b=ot.concat([b,(0,t.zeros)(32-v.length%32)])),b}else if(m.startsWith("bytes")){const b=f(m);if(b<1||b>32)throw new Error(`Invalid bytes<N> width: ${b}`);const w=typeof v=="number"?(0,s.normalize)(v):v;return(0,t.setLengthRight)((0,t.toBuffer)(w),32)}else if(m.startsWith("uint")){const b=f(m);if(b%8||b<8||b>256)throw new Error(`Invalid uint<N> width: ${b}`);const w=c(v);if(w.bitLength()>b)throw new Error(`Supplied uint exceeds width: ${b} vs ${w.bitLength()}`);if(w.isNeg())throw new Error("Supplied uint is negative");return w.toArrayLike(ot,"be",32)}else if(m.startsWith("int")){const b=f(m);if(b%8||b<8||b>256)throw new Error(`Invalid int<N> width: ${b}`);const w=c(v);if(w.bitLength()>b)throw new Error(`Supplied int exceeds width: ${b} vs ${w.bitLength()}`);return w.toTwos(256).toArrayLike(ot,"be",32)}else if(m.startsWith("ufixed")){const b=y(m),w=c(v);if(w.isNeg())throw new Error("Supplied ufixed is negative");return d("uint256",w.mul(new r.default(2).pow(new r.default(b[1]))))}else if(m.startsWith("fixed")){const b=y(m);return d("int256",c(v).mul(new r.default(2).pow(new r.default(b[1]))))}throw new Error(`Unsupported or invalid type: ${JSON.stringify(m)}`)}function h(m){return m==="string"||m==="bytes"||a(m)==="dynamic"}function y(m){const v=/^\D+(\d+)x(\d+)$/u.exec(m);if(v===null||v.length<1)throw new Error(`Invalid parseTypeNxM input "${m}".`);return[parseInt(v[1],10),parseInt(v[2],10)]}return Hi}var w6;function MH(){return w6||(w6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.recoverTypedSignature=e.signTypedData=e.typedSignatureHash=e.TypedDataUtils=e.TYPED_MESSAGE_SCHEMA=e.SignTypedDataVersion=void 0;const t=Hf(),r=DH(),n=Wg(),s=OH(),i=sl();var o;(function(C){C.V1="V1",C.V3="V3",C.V4="V4"})(o=e.SignTypedDataVersion||(e.SignTypedDataVersion={})),e.TYPED_MESSAGE_SCHEMA={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]};function a(C,I){if(Object.keys(o).includes(C)){if(I&&!I.includes(C))throw new Error(`SignTypedDataVersion not allowed: '${C}'. Allowed versions are: ${I.join(", ")}`)}else throw new Error(`Invalid version: '${C}'`)}function f(C,I,k,E,S){if(a(S,[o.V3,o.V4]),C[k]!==void 0)return["bytes32",S===o.V4&&E==null?"0x0000000000000000000000000000000000000000000000000000000000000000":(0,t.arrToBufArr)((0,r.keccak256)(c(k,E,C,S)))];if(E===void 0)throw new Error(`missing value for field ${I} of type ${k}`);if(k==="bytes"){if(typeof E=="number")E=(0,i.numberToBuffer)(E);else if((0,n.isHexString)(E)){const T=E.length%2?"0":"";E=ot.from(T+E.slice(2),"hex")}else E=ot.from(E,"utf8");return["bytes32",(0,t.arrToBufArr)((0,r.keccak256)(E))]}if(k==="string")return typeof E=="number"?E=(0,i.numberToBuffer)(E):E=ot.from(E??"","utf8"),["bytes32",(0,t.arrToBufArr)((0,r.keccak256)(E))];if(k.endsWith("]")){if(S===o.V3)throw new Error("Arrays are unimplemented in encodeData; use V4 extension");const T=k.slice(0,k.lastIndexOf("[")),P=E.map(g=>f(C,I,T,g,S));return["bytes32",(0,t.arrToBufArr)((0,r.keccak256)((0,s.rawEncode)(P.map(([g])=>g),P.map(([,g])=>g))))]}return[k,E]}function c(C,I,k,E){a(E,[o.V3,o.V4]);const S=["bytes32"],T=[d(C,k)];for(const P of k[C]){if(E===o.V3&&I[P.name]===void 0)continue;const[g,A]=f(k,P.name,P.type,I[P.name],E);S.push(g),T.push(A)}return(0,s.rawEncode)(S,T)}function l(C,I){let k="";const E=u(C,I);E.delete(C);const S=[C,...Array.from(E).sort()];for(const T of S){if(!I[T])throw new Error(`No type definition specified: ${T}`);k+=`${T}(${I[T].map(({name:g,type:A})=>`${A} ${g}`).join(",")})`}return k}function u(C,I,k=new Set){if(typeof C!="string")throw new Error(`Invalid findTypeDependencies input ${JSON.stringify(C)}`);if([C]=C.match(/^\w*/u),k.has(C)||I[C]===void 0)return k;k.add(C);for(const S of I[C])u(S.type,I,k);return k}function p(C,I,k,E){a(E,[o.V3,o.V4]);const S=c(C,I,k,E),T=(0,r.keccak256)(S);return(0,t.arrToBufArr)(T)}function d(C,I){const k=ot.from(l(C,I),"utf-8");return(0,t.arrToBufArr)((0,r.keccak256)(k))}function h(C){const I={};for(const k in e.TYPED_MESSAGE_SCHEMA.properties)C[k]&&(I[k]=C[k]);return"types"in I&&(I.types=Object.assign({EIP712Domain:[]},I.types)),I}function y(C,I){a(I,[o.V3,o.V4]);const k=h(C),{domain:E}=k,S={EIP712Domain:k.types.EIP712Domain};return p("EIP712Domain",E,S,I)}function m(C,I){a(I,[o.V3,o.V4]);const k=h(C),E=[ot.from("1901","hex")];return E.push(y(C,I)),k.primaryType!=="EIP712Domain"&&E.push(p(k.primaryType,k.message,k.types,I)),(0,t.arrToBufArr)((0,r.keccak256)(ot.concat(E)))}e.TypedDataUtils={encodeData:c,encodeType:l,findTypeDependencies:u,hashStruct:p,hashType:d,sanitizeData:h,eip712Hash:m,eip712DomainHash:y};function v(C){const I=b(C);return(0,t.bufferToHex)(I)}e.typedSignatureHash=v;function b(C){const I=new Error("Expect argument to be non-empty array");if(typeof C!="object"||!("length"in C)||!C.length)throw I;const k=C.map(function(T){return T.type!=="bytes"?T.value:(0,i.legacyToBuffer)(T.value)}),E=C.map(function(T){return T.type}),S=C.map(function(T){if(!T.name)throw I;return`${T.type} ${T.name}`});return(0,t.arrToBufArr)((0,r.keccak256)((0,s.solidityPack)(["bytes32","bytes32"],[(0,r.keccak256)((0,s.solidityPack)(new Array(C.length).fill("string"),S)),(0,r.keccak256)((0,s.solidityPack)(E,k))])))}function w({privateKey:C,data:I,version:k}){if(a(k),(0,i.isNullish)(I))throw new Error("Missing data parameter");if((0,i.isNullish)(C))throw new Error("Missing private key parameter");const E=k===o.V1?b(I):e.TypedDataUtils.eip712Hash(I,k),S=(0,t.ecsign)(E,C);return(0,i.concatSig)((0,t.toBuffer)(S.v),S.r,S.s)}e.signTypedData=w;function _({data:C,signature:I,version:k}){if(a(k),(0,i.isNullish)(C))throw new Error("Missing data parameter");if((0,i.isNullish)(I))throw new Error("Missing signature parameter");const E=k===o.V1?b(C):e.TypedDataUtils.eip712Hash(C,k),S=(0,i.recoverPublicKey)(E,I),T=(0,t.publicToAddress)(S);return(0,t.bufferToHex)(T)}e.recoverTypedSignature=_}(Dp)),Dp}var xn={},Op={exports:{}},E6;function NH(){return E6||(E6=1,function(e){(function(t){var r=function($){var J,Q=new Float64Array(16);if($)for(J=0;J<$.length;J++)Q[J]=$[J];return Q},n=function(){throw new Error("no PRNG")},s=new Uint8Array(16),i=new Uint8Array(32);i[0]=9;var o=r(),a=r([1]),f=r([56129,1]),c=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),l=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),p=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),d=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function h($,J,Q,K){$[J]=Q>>24&255,$[J+1]=Q>>16&255,$[J+2]=Q>>8&255,$[J+3]=Q&255,$[J+4]=K>>24&255,$[J+5]=K>>16&255,$[J+6]=K>>8&255,$[J+7]=K&255}function y($,J,Q,K,ae){var Se,Te=0;for(Se=0;Se<ae;Se++)Te|=$[J+Se]^Q[K+Se];return(1&Te-1>>>8)-1}function m($,J,Q,K){return y($,J,Q,K,16)}function v($,J,Q,K){return y($,J,Q,K,32)}function b($,J,Q,K){for(var ae=K[0]&255|(K[1]&255)<<8|(K[2]&255)<<16|(K[3]&255)<<24,Se=Q[0]&255|(Q[1]&255)<<8|(Q[2]&255)<<16|(Q[3]&255)<<24,Te=Q[4]&255|(Q[5]&255)<<8|(Q[6]&255)<<16|(Q[7]&255)<<24,Ke=Q[8]&255|(Q[9]&255)<<8|(Q[10]&255)<<16|(Q[11]&255)<<24,Ge=Q[12]&255|(Q[13]&255)<<8|(Q[14]&255)<<16|(Q[15]&255)<<24,dt=K[4]&255|(K[5]&255)<<8|(K[6]&255)<<16|(K[7]&255)<<24,it=J[0]&255|(J[1]&255)<<8|(J[2]&255)<<16|(J[3]&255)<<24,Ct=J[4]&255|(J[5]&255)<<8|(J[6]&255)<<16|(J[7]&255)<<24,at=J[8]&255|(J[9]&255)<<8|(J[10]&255)<<16|(J[11]&255)<<24,vt=J[12]&255|(J[13]&255)<<8|(J[14]&255)<<16|(J[15]&255)<<24,bt=K[8]&255|(K[9]&255)<<8|(K[10]&255)<<16|(K[11]&255)<<24,St=Q[16]&255|(Q[17]&255)<<8|(Q[18]&255)<<16|(Q[19]&255)<<24,At=Q[20]&255|(Q[21]&255)<<8|(Q[22]&255)<<16|(Q[23]&255)<<24,_t=Q[24]&255|(Q[25]&255)<<8|(Q[26]&255)<<16|(Q[27]&255)<<24,Et=Q[28]&255|(Q[29]&255)<<8|(Q[30]&255)<<16|(Q[31]&255)<<24,wt=K[12]&255|(K[13]&255)<<8|(K[14]&255)<<16|(K[15]&255)<<24,ut=ae,ht=Se,st=Te,ft=Ke,pt=Ge,ct=dt,je=it,$e=Ct,Ye=at,ze=vt,We=bt,Xe=St,Pt=At,Nt=_t,Lt=Et,Ut=wt,Ee,jt=0;jt<20;jt+=2)Ee=ut+Pt|0,pt^=Ee<<7|Ee>>>32-7,Ee=pt+ut|0,Ye^=Ee<<9|Ee>>>32-9,Ee=Ye+pt|0,Pt^=Ee<<13|Ee>>>32-13,Ee=Pt+Ye|0,ut^=Ee<<18|Ee>>>32-18,Ee=ct+ht|0,ze^=Ee<<7|Ee>>>32-7,Ee=ze+ct|0,Nt^=Ee<<9|Ee>>>32-9,Ee=Nt+ze|0,ht^=Ee<<13|Ee>>>32-13,Ee=ht+Nt|0,ct^=Ee<<18|Ee>>>32-18,Ee=We+je|0,Lt^=Ee<<7|Ee>>>32-7,Ee=Lt+We|0,st^=Ee<<9|Ee>>>32-9,Ee=st+Lt|0,je^=Ee<<13|Ee>>>32-13,Ee=je+st|0,We^=Ee<<18|Ee>>>32-18,Ee=Ut+Xe|0,ft^=Ee<<7|Ee>>>32-7,Ee=ft+Ut|0,$e^=Ee<<9|Ee>>>32-9,Ee=$e+ft|0,Xe^=Ee<<13|Ee>>>32-13,Ee=Xe+$e|0,Ut^=Ee<<18|Ee>>>32-18,Ee=ut+ft|0,ht^=Ee<<7|Ee>>>32-7,Ee=ht+ut|0,st^=Ee<<9|Ee>>>32-9,Ee=st+ht|0,ft^=Ee<<13|Ee>>>32-13,Ee=ft+st|0,ut^=Ee<<18|Ee>>>32-18,Ee=ct+pt|0,je^=Ee<<7|Ee>>>32-7,Ee=je+ct|0,$e^=Ee<<9|Ee>>>32-9,Ee=$e+je|0,pt^=Ee<<13|Ee>>>32-13,Ee=pt+$e|0,ct^=Ee<<18|Ee>>>32-18,Ee=We+ze|0,Xe^=Ee<<7|Ee>>>32-7,Ee=Xe+We|0,Ye^=Ee<<9|Ee>>>32-9,Ee=Ye+Xe|0,ze^=Ee<<13|Ee>>>32-13,Ee=ze+Ye|0,We^=Ee<<18|Ee>>>32-18,Ee=Ut+Lt|0,Pt^=Ee<<7|Ee>>>32-7,Ee=Pt+Ut|0,Nt^=Ee<<9|Ee>>>32-9,Ee=Nt+Pt|0,Lt^=Ee<<13|Ee>>>32-13,Ee=Lt+Nt|0,Ut^=Ee<<18|Ee>>>32-18;ut=ut+ae|0,ht=ht+Se|0,st=st+Te|0,ft=ft+Ke|0,pt=pt+Ge|0,ct=ct+dt|0,je=je+it|0,$e=$e+Ct|0,Ye=Ye+at|0,ze=ze+vt|0,We=We+bt|0,Xe=Xe+St|0,Pt=Pt+At|0,Nt=Nt+_t|0,Lt=Lt+Et|0,Ut=Ut+wt|0,$[0]=ut>>>0&255,$[1]=ut>>>8&255,$[2]=ut>>>16&255,$[3]=ut>>>24&255,$[4]=ht>>>0&255,$[5]=ht>>>8&255,$[6]=ht>>>16&255,$[7]=ht>>>24&255,$[8]=st>>>0&255,$[9]=st>>>8&255,$[10]=st>>>16&255,$[11]=st>>>24&255,$[12]=ft>>>0&255,$[13]=ft>>>8&255,$[14]=ft>>>16&255,$[15]=ft>>>24&255,$[16]=pt>>>0&255,$[17]=pt>>>8&255,$[18]=pt>>>16&255,$[19]=pt>>>24&255,$[20]=ct>>>0&255,$[21]=ct>>>8&255,$[22]=ct>>>16&255,$[23]=ct>>>24&255,$[24]=je>>>0&255,$[25]=je>>>8&255,$[26]=je>>>16&255,$[27]=je>>>24&255,$[28]=$e>>>0&255,$[29]=$e>>>8&255,$[30]=$e>>>16&255,$[31]=$e>>>24&255,$[32]=Ye>>>0&255,$[33]=Ye>>>8&255,$[34]=Ye>>>16&255,$[35]=Ye>>>24&255,$[36]=ze>>>0&255,$[37]=ze>>>8&255,$[38]=ze>>>16&255,$[39]=ze>>>24&255,$[40]=We>>>0&255,$[41]=We>>>8&255,$[42]=We>>>16&255,$[43]=We>>>24&255,$[44]=Xe>>>0&255,$[45]=Xe>>>8&255,$[46]=Xe>>>16&255,$[47]=Xe>>>24&255,$[48]=Pt>>>0&255,$[49]=Pt>>>8&255,$[50]=Pt>>>16&255,$[51]=Pt>>>24&255,$[52]=Nt>>>0&255,$[53]=Nt>>>8&255,$[54]=Nt>>>16&255,$[55]=Nt>>>24&255,$[56]=Lt>>>0&255,$[57]=Lt>>>8&255,$[58]=Lt>>>16&255,$[59]=Lt>>>24&255,$[60]=Ut>>>0&255,$[61]=Ut>>>8&255,$[62]=Ut>>>16&255,$[63]=Ut>>>24&255}function w($,J,Q,K){for(var ae=K[0]&255|(K[1]&255)<<8|(K[2]&255)<<16|(K[3]&255)<<24,Se=Q[0]&255|(Q[1]&255)<<8|(Q[2]&255)<<16|(Q[3]&255)<<24,Te=Q[4]&255|(Q[5]&255)<<8|(Q[6]&255)<<16|(Q[7]&255)<<24,Ke=Q[8]&255|(Q[9]&255)<<8|(Q[10]&255)<<16|(Q[11]&255)<<24,Ge=Q[12]&255|(Q[13]&255)<<8|(Q[14]&255)<<16|(Q[15]&255)<<24,dt=K[4]&255|(K[5]&255)<<8|(K[6]&255)<<16|(K[7]&255)<<24,it=J[0]&255|(J[1]&255)<<8|(J[2]&255)<<16|(J[3]&255)<<24,Ct=J[4]&255|(J[5]&255)<<8|(J[6]&255)<<16|(J[7]&255)<<24,at=J[8]&255|(J[9]&255)<<8|(J[10]&255)<<16|(J[11]&255)<<24,vt=J[12]&255|(J[13]&255)<<8|(J[14]&255)<<16|(J[15]&255)<<24,bt=K[8]&255|(K[9]&255)<<8|(K[10]&255)<<16|(K[11]&255)<<24,St=Q[16]&255|(Q[17]&255)<<8|(Q[18]&255)<<16|(Q[19]&255)<<24,At=Q[20]&255|(Q[21]&255)<<8|(Q[22]&255)<<16|(Q[23]&255)<<24,_t=Q[24]&255|(Q[25]&255)<<8|(Q[26]&255)<<16|(Q[27]&255)<<24,Et=Q[28]&255|(Q[29]&255)<<8|(Q[30]&255)<<16|(Q[31]&255)<<24,wt=K[12]&255|(K[13]&255)<<8|(K[14]&255)<<16|(K[15]&255)<<24,ut=ae,ht=Se,st=Te,ft=Ke,pt=Ge,ct=dt,je=it,$e=Ct,Ye=at,ze=vt,We=bt,Xe=St,Pt=At,Nt=_t,Lt=Et,Ut=wt,Ee,jt=0;jt<20;jt+=2)Ee=ut+Pt|0,pt^=Ee<<7|Ee>>>32-7,Ee=pt+ut|0,Ye^=Ee<<9|Ee>>>32-9,Ee=Ye+pt|0,Pt^=Ee<<13|Ee>>>32-13,Ee=Pt+Ye|0,ut^=Ee<<18|Ee>>>32-18,Ee=ct+ht|0,ze^=Ee<<7|Ee>>>32-7,Ee=ze+ct|0,Nt^=Ee<<9|Ee>>>32-9,Ee=Nt+ze|0,ht^=Ee<<13|Ee>>>32-13,Ee=ht+Nt|0,ct^=Ee<<18|Ee>>>32-18,Ee=We+je|0,Lt^=Ee<<7|Ee>>>32-7,Ee=Lt+We|0,st^=Ee<<9|Ee>>>32-9,Ee=st+Lt|0,je^=Ee<<13|Ee>>>32-13,Ee=je+st|0,We^=Ee<<18|Ee>>>32-18,Ee=Ut+Xe|0,ft^=Ee<<7|Ee>>>32-7,Ee=ft+Ut|0,$e^=Ee<<9|Ee>>>32-9,Ee=$e+ft|0,Xe^=Ee<<13|Ee>>>32-13,Ee=Xe+$e|0,Ut^=Ee<<18|Ee>>>32-18,Ee=ut+ft|0,ht^=Ee<<7|Ee>>>32-7,Ee=ht+ut|0,st^=Ee<<9|Ee>>>32-9,Ee=st+ht|0,ft^=Ee<<13|Ee>>>32-13,Ee=ft+st|0,ut^=Ee<<18|Ee>>>32-18,Ee=ct+pt|0,je^=Ee<<7|Ee>>>32-7,Ee=je+ct|0,$e^=Ee<<9|Ee>>>32-9,Ee=$e+je|0,pt^=Ee<<13|Ee>>>32-13,Ee=pt+$e|0,ct^=Ee<<18|Ee>>>32-18,Ee=We+ze|0,Xe^=Ee<<7|Ee>>>32-7,Ee=Xe+We|0,Ye^=Ee<<9|Ee>>>32-9,Ee=Ye+Xe|0,ze^=Ee<<13|Ee>>>32-13,Ee=ze+Ye|0,We^=Ee<<18|Ee>>>32-18,Ee=Ut+Lt|0,Pt^=Ee<<7|Ee>>>32-7,Ee=Pt+Ut|0,Nt^=Ee<<9|Ee>>>32-9,Ee=Nt+Pt|0,Lt^=Ee<<13|Ee>>>32-13,Ee=Lt+Nt|0,Ut^=Ee<<18|Ee>>>32-18;$[0]=ut>>>0&255,$[1]=ut>>>8&255,$[2]=ut>>>16&255,$[3]=ut>>>24&255,$[4]=ct>>>0&255,$[5]=ct>>>8&255,$[6]=ct>>>16&255,$[7]=ct>>>24&255,$[8]=We>>>0&255,$[9]=We>>>8&255,$[10]=We>>>16&255,$[11]=We>>>24&255,$[12]=Ut>>>0&255,$[13]=Ut>>>8&255,$[14]=Ut>>>16&255,$[15]=Ut>>>24&255,$[16]=je>>>0&255,$[17]=je>>>8&255,$[18]=je>>>16&255,$[19]=je>>>24&255,$[20]=$e>>>0&255,$[21]=$e>>>8&255,$[22]=$e>>>16&255,$[23]=$e>>>24&255,$[24]=Ye>>>0&255,$[25]=Ye>>>8&255,$[26]=Ye>>>16&255,$[27]=Ye>>>24&255,$[28]=ze>>>0&255,$[29]=ze>>>8&255,$[30]=ze>>>16&255,$[31]=ze>>>24&255}function _($,J,Q,K){b($,J,Q,K)}function C($,J,Q,K){w($,J,Q,K)}var I=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function k($,J,Q,K,ae,Se,Te){var Ke=new Uint8Array(16),Ge=new Uint8Array(64),dt,it;for(it=0;it<16;it++)Ke[it]=0;for(it=0;it<8;it++)Ke[it]=Se[it];for(;ae>=64;){for(_(Ge,Ke,Te,I),it=0;it<64;it++)$[J+it]=Q[K+it]^Ge[it];for(dt=1,it=8;it<16;it++)dt=dt+(Ke[it]&255)|0,Ke[it]=dt&255,dt>>>=8;ae-=64,J+=64,K+=64}if(ae>0)for(_(Ge,Ke,Te,I),it=0;it<ae;it++)$[J+it]=Q[K+it]^Ge[it];return 0}function E($,J,Q,K,ae){var Se=new Uint8Array(16),Te=new Uint8Array(64),Ke,Ge;for(Ge=0;Ge<16;Ge++)Se[Ge]=0;for(Ge=0;Ge<8;Ge++)Se[Ge]=K[Ge];for(;Q>=64;){for(_(Te,Se,ae,I),Ge=0;Ge<64;Ge++)$[J+Ge]=Te[Ge];for(Ke=1,Ge=8;Ge<16;Ge++)Ke=Ke+(Se[Ge]&255)|0,Se[Ge]=Ke&255,Ke>>>=8;Q-=64,J+=64}if(Q>0)for(_(Te,Se,ae,I),Ge=0;Ge<Q;Ge++)$[J+Ge]=Te[Ge];return 0}function S($,J,Q,K,ae){var Se=new Uint8Array(32);C(Se,K,ae,I);for(var Te=new Uint8Array(8),Ke=0;Ke<8;Ke++)Te[Ke]=K[Ke+16];return E($,J,Q,Te,Se)}function T($,J,Q,K,ae,Se,Te){var Ke=new Uint8Array(32);C(Ke,Se,Te,I);for(var Ge=new Uint8Array(8),dt=0;dt<8;dt++)Ge[dt]=Se[dt+16];return k($,J,Q,K,ae,Ge,Ke)}var P=function($){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var J,Q,K,ae,Se,Te,Ke,Ge;J=$[0]&255|($[1]&255)<<8,this.r[0]=J&8191,Q=$[2]&255|($[3]&255)<<8,this.r[1]=(J>>>13|Q<<3)&8191,K=$[4]&255|($[5]&255)<<8,this.r[2]=(Q>>>10|K<<6)&7939,ae=$[6]&255|($[7]&255)<<8,this.r[3]=(K>>>7|ae<<9)&8191,Se=$[8]&255|($[9]&255)<<8,this.r[4]=(ae>>>4|Se<<12)&255,this.r[5]=Se>>>1&8190,Te=$[10]&255|($[11]&255)<<8,this.r[6]=(Se>>>14|Te<<2)&8191,Ke=$[12]&255|($[13]&255)<<8,this.r[7]=(Te>>>11|Ke<<5)&8065,Ge=$[14]&255|($[15]&255)<<8,this.r[8]=(Ke>>>8|Ge<<8)&8191,this.r[9]=Ge>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};P.prototype.blocks=function($,J,Q){for(var K=this.fin?0:2048,ae,Se,Te,Ke,Ge,dt,it,Ct,at,vt,bt,St,At,_t,Et,wt,ut,ht,st,ft=this.h[0],pt=this.h[1],ct=this.h[2],je=this.h[3],$e=this.h[4],Ye=this.h[5],ze=this.h[6],We=this.h[7],Xe=this.h[8],Pt=this.h[9],Nt=this.r[0],Lt=this.r[1],Ut=this.r[2],Ee=this.r[3],jt=this.r[4],Zt=this.r[5],Jt=this.r[6],Ft=this.r[7],Wt=this.r[8],Yt=this.r[9];Q>=16;)ae=$[J+0]&255|($[J+1]&255)<<8,ft+=ae&8191,Se=$[J+2]&255|($[J+3]&255)<<8,pt+=(ae>>>13|Se<<3)&8191,Te=$[J+4]&255|($[J+5]&255)<<8,ct+=(Se>>>10|Te<<6)&8191,Ke=$[J+6]&255|($[J+7]&255)<<8,je+=(Te>>>7|Ke<<9)&8191,Ge=$[J+8]&255|($[J+9]&255)<<8,$e+=(Ke>>>4|Ge<<12)&8191,Ye+=Ge>>>1&8191,dt=$[J+10]&255|($[J+11]&255)<<8,ze+=(Ge>>>14|dt<<2)&8191,it=$[J+12]&255|($[J+13]&255)<<8,We+=(dt>>>11|it<<5)&8191,Ct=$[J+14]&255|($[J+15]&255)<<8,Xe+=(it>>>8|Ct<<8)&8191,Pt+=Ct>>>5|K,at=0,vt=at,vt+=ft*Nt,vt+=pt*(5*Yt),vt+=ct*(5*Wt),vt+=je*(5*Ft),vt+=$e*(5*Jt),at=vt>>>13,vt&=8191,vt+=Ye*(5*Zt),vt+=ze*(5*jt),vt+=We*(5*Ee),vt+=Xe*(5*Ut),vt+=Pt*(5*Lt),at+=vt>>>13,vt&=8191,bt=at,bt+=ft*Lt,bt+=pt*Nt,bt+=ct*(5*Yt),bt+=je*(5*Wt),bt+=$e*(5*Ft),at=bt>>>13,bt&=8191,bt+=Ye*(5*Jt),bt+=ze*(5*Zt),bt+=We*(5*jt),bt+=Xe*(5*Ee),bt+=Pt*(5*Ut),at+=bt>>>13,bt&=8191,St=at,St+=ft*Ut,St+=pt*Lt,St+=ct*Nt,St+=je*(5*Yt),St+=$e*(5*Wt),at=St>>>13,St&=8191,St+=Ye*(5*Ft),St+=ze*(5*Jt),St+=We*(5*Zt),St+=Xe*(5*jt),St+=Pt*(5*Ee),at+=St>>>13,St&=8191,At=at,At+=ft*Ee,At+=pt*Ut,At+=ct*Lt,At+=je*Nt,At+=$e*(5*Yt),at=At>>>13,At&=8191,At+=Ye*(5*Wt),At+=ze*(5*Ft),At+=We*(5*Jt),At+=Xe*(5*Zt),At+=Pt*(5*jt),at+=At>>>13,At&=8191,_t=at,_t+=ft*jt,_t+=pt*Ee,_t+=ct*Ut,_t+=je*Lt,_t+=$e*Nt,at=_t>>>13,_t&=8191,_t+=Ye*(5*Yt),_t+=ze*(5*Wt),_t+=We*(5*Ft),_t+=Xe*(5*Jt),_t+=Pt*(5*Zt),at+=_t>>>13,_t&=8191,Et=at,Et+=ft*Zt,Et+=pt*jt,Et+=ct*Ee,Et+=je*Ut,Et+=$e*Lt,at=Et>>>13,Et&=8191,Et+=Ye*Nt,Et+=ze*(5*Yt),Et+=We*(5*Wt),Et+=Xe*(5*Ft),Et+=Pt*(5*Jt),at+=Et>>>13,Et&=8191,wt=at,wt+=ft*Jt,wt+=pt*Zt,wt+=ct*jt,wt+=je*Ee,wt+=$e*Ut,at=wt>>>13,wt&=8191,wt+=Ye*Lt,wt+=ze*Nt,wt+=We*(5*Yt),wt+=Xe*(5*Wt),wt+=Pt*(5*Ft),at+=wt>>>13,wt&=8191,ut=at,ut+=ft*Ft,ut+=pt*Jt,ut+=ct*Zt,ut+=je*jt,ut+=$e*Ee,at=ut>>>13,ut&=8191,ut+=Ye*Ut,ut+=ze*Lt,ut+=We*Nt,ut+=Xe*(5*Yt),ut+=Pt*(5*Wt),at+=ut>>>13,ut&=8191,ht=at,ht+=ft*Wt,ht+=pt*Ft,ht+=ct*Jt,ht+=je*Zt,ht+=$e*jt,at=ht>>>13,ht&=8191,ht+=Ye*Ee,ht+=ze*Ut,ht+=We*Lt,ht+=Xe*Nt,ht+=Pt*(5*Yt),at+=ht>>>13,ht&=8191,st=at,st+=ft*Yt,st+=pt*Wt,st+=ct*Ft,st+=je*Jt,st+=$e*Zt,at=st>>>13,st&=8191,st+=Ye*jt,st+=ze*Ee,st+=We*Ut,st+=Xe*Lt,st+=Pt*Nt,at+=st>>>13,st&=8191,at=(at<<2)+at|0,at=at+vt|0,vt=at&8191,at=at>>>13,bt+=at,ft=vt,pt=bt,ct=St,je=At,$e=_t,Ye=Et,ze=wt,We=ut,Xe=ht,Pt=st,J+=16,Q-=16;this.h[0]=ft,this.h[1]=pt,this.h[2]=ct,this.h[3]=je,this.h[4]=$e,this.h[5]=Ye,this.h[6]=ze,this.h[7]=We,this.h[8]=Xe,this.h[9]=Pt},P.prototype.finish=function($,J){var Q=new Uint16Array(10),K,ae,Se,Te;if(this.leftover){for(Te=this.leftover,this.buffer[Te++]=1;Te<16;Te++)this.buffer[Te]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(K=this.h[1]>>>13,this.h[1]&=8191,Te=2;Te<10;Te++)this.h[Te]+=K,K=this.h[Te]>>>13,this.h[Te]&=8191;for(this.h[0]+=K*5,K=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=K,K=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=K,Q[0]=this.h[0]+5,K=Q[0]>>>13,Q[0]&=8191,Te=1;Te<10;Te++)Q[Te]=this.h[Te]+K,K=Q[Te]>>>13,Q[Te]&=8191;for(Q[9]-=8192,ae=(K^1)-1,Te=0;Te<10;Te++)Q[Te]&=ae;for(ae=~ae,Te=0;Te<10;Te++)this.h[Te]=this.h[Te]&ae|Q[Te];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,Se=this.h[0]+this.pad[0],this.h[0]=Se&65535,Te=1;Te<8;Te++)Se=(this.h[Te]+this.pad[Te]|0)+(Se>>>16)|0,this.h[Te]=Se&65535;$[J+0]=this.h[0]>>>0&255,$[J+1]=this.h[0]>>>8&255,$[J+2]=this.h[1]>>>0&255,$[J+3]=this.h[1]>>>8&255,$[J+4]=this.h[2]>>>0&255,$[J+5]=this.h[2]>>>8&255,$[J+6]=this.h[3]>>>0&255,$[J+7]=this.h[3]>>>8&255,$[J+8]=this.h[4]>>>0&255,$[J+9]=this.h[4]>>>8&255,$[J+10]=this.h[5]>>>0&255,$[J+11]=this.h[5]>>>8&255,$[J+12]=this.h[6]>>>0&255,$[J+13]=this.h[6]>>>8&255,$[J+14]=this.h[7]>>>0&255,$[J+15]=this.h[7]>>>8&255},P.prototype.update=function($,J,Q){var K,ae;if(this.leftover){for(ae=16-this.leftover,ae>Q&&(ae=Q),K=0;K<ae;K++)this.buffer[this.leftover+K]=$[J+K];if(Q-=ae,J+=ae,this.leftover+=ae,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(Q>=16&&(ae=Q-Q%16,this.blocks($,J,ae),J+=ae,Q-=ae),Q){for(K=0;K<Q;K++)this.buffer[this.leftover+K]=$[J+K];this.leftover+=Q}};function g($,J,Q,K,ae,Se){var Te=new P(Se);return Te.update(Q,K,ae),Te.finish($,J),0}function A($,J,Q,K,ae,Se){var Te=new Uint8Array(16);return g(Te,0,Q,K,ae,Se),m($,J,Te,0)}function x($,J,Q,K,ae){var Se;if(Q<32)return-1;for(T($,0,J,0,Q,K,ae),g($,16,$,32,Q-32,$),Se=0;Se<16;Se++)$[Se]=0;return 0}function D($,J,Q,K,ae){var Se,Te=new Uint8Array(32);if(Q<32||(S(Te,0,32,K,ae),A(J,16,J,32,Q-32,Te)!==0))return-1;for(T($,0,J,0,Q,K,ae),Se=0;Se<32;Se++)$[Se]=0;return 0}function O($,J){var Q;for(Q=0;Q<16;Q++)$[Q]=J[Q]|0}function B($){var J,Q,K=1;for(J=0;J<16;J++)Q=$[J]+K+65535,K=Math.floor(Q/65536),$[J]=Q-K*65536;$[0]+=K-1+37*(K-1)}function L($,J,Q){for(var K,ae=~(Q-1),Se=0;Se<16;Se++)K=ae&($[Se]^J[Se]),$[Se]^=K,J[Se]^=K}function M($,J){var Q,K,ae,Se=r(),Te=r();for(Q=0;Q<16;Q++)Te[Q]=J[Q];for(B(Te),B(Te),B(Te),K=0;K<2;K++){for(Se[0]=Te[0]-65517,Q=1;Q<15;Q++)Se[Q]=Te[Q]-65535-(Se[Q-1]>>16&1),Se[Q-1]&=65535;Se[15]=Te[15]-32767-(Se[14]>>16&1),ae=Se[15]>>16&1,Se[14]&=65535,L(Te,Se,1-ae)}for(Q=0;Q<16;Q++)$[2*Q]=Te[Q]&255,$[2*Q+1]=Te[Q]>>8}function R($,J){var Q=new Uint8Array(32),K=new Uint8Array(32);return M(Q,$),M(K,J),v(Q,0,K,0)}function N($){var J=new Uint8Array(32);return M(J,$),J[0]&1}function F($,J){var Q;for(Q=0;Q<16;Q++)$[Q]=J[2*Q]+(J[2*Q+1]<<8);$[15]&=32767}function z($,J,Q){for(var K=0;K<16;K++)$[K]=J[K]+Q[K]}function Y($,J,Q){for(var K=0;K<16;K++)$[K]=J[K]-Q[K]}function j($,J,Q){var K,ae,Se=0,Te=0,Ke=0,Ge=0,dt=0,it=0,Ct=0,at=0,vt=0,bt=0,St=0,At=0,_t=0,Et=0,wt=0,ut=0,ht=0,st=0,ft=0,pt=0,ct=0,je=0,$e=0,Ye=0,ze=0,We=0,Xe=0,Pt=0,Nt=0,Lt=0,Ut=0,Ee=Q[0],jt=Q[1],Zt=Q[2],Jt=Q[3],Ft=Q[4],Wt=Q[5],Yt=Q[6],Sr=Q[7],tr=Q[8],br=Q[9],_r=Q[10],wr=Q[11],Tr=Q[12],Jr=Q[13],Xr=Q[14],Qr=Q[15];K=J[0],Se+=K*Ee,Te+=K*jt,Ke+=K*Zt,Ge+=K*Jt,dt+=K*Ft,it+=K*Wt,Ct+=K*Yt,at+=K*Sr,vt+=K*tr,bt+=K*br,St+=K*_r,At+=K*wr,_t+=K*Tr,Et+=K*Jr,wt+=K*Xr,ut+=K*Qr,K=J[1],Te+=K*Ee,Ke+=K*jt,Ge+=K*Zt,dt+=K*Jt,it+=K*Ft,Ct+=K*Wt,at+=K*Yt,vt+=K*Sr,bt+=K*tr,St+=K*br,At+=K*_r,_t+=K*wr,Et+=K*Tr,wt+=K*Jr,ut+=K*Xr,ht+=K*Qr,K=J[2],Ke+=K*Ee,Ge+=K*jt,dt+=K*Zt,it+=K*Jt,Ct+=K*Ft,at+=K*Wt,vt+=K*Yt,bt+=K*Sr,St+=K*tr,At+=K*br,_t+=K*_r,Et+=K*wr,wt+=K*Tr,ut+=K*Jr,ht+=K*Xr,st+=K*Qr,K=J[3],Ge+=K*Ee,dt+=K*jt,it+=K*Zt,Ct+=K*Jt,at+=K*Ft,vt+=K*Wt,bt+=K*Yt,St+=K*Sr,At+=K*tr,_t+=K*br,Et+=K*_r,wt+=K*wr,ut+=K*Tr,ht+=K*Jr,st+=K*Xr,ft+=K*Qr,K=J[4],dt+=K*Ee,it+=K*jt,Ct+=K*Zt,at+=K*Jt,vt+=K*Ft,bt+=K*Wt,St+=K*Yt,At+=K*Sr,_t+=K*tr,Et+=K*br,wt+=K*_r,ut+=K*wr,ht+=K*Tr,st+=K*Jr,ft+=K*Xr,pt+=K*Qr,K=J[5],it+=K*Ee,Ct+=K*jt,at+=K*Zt,vt+=K*Jt,bt+=K*Ft,St+=K*Wt,At+=K*Yt,_t+=K*Sr,Et+=K*tr,wt+=K*br,ut+=K*_r,ht+=K*wr,st+=K*Tr,ft+=K*Jr,pt+=K*Xr,ct+=K*Qr,K=J[6],Ct+=K*Ee,at+=K*jt,vt+=K*Zt,bt+=K*Jt,St+=K*Ft,At+=K*Wt,_t+=K*Yt,Et+=K*Sr,wt+=K*tr,ut+=K*br,ht+=K*_r,st+=K*wr,ft+=K*Tr,pt+=K*Jr,ct+=K*Xr,je+=K*Qr,K=J[7],at+=K*Ee,vt+=K*jt,bt+=K*Zt,St+=K*Jt,At+=K*Ft,_t+=K*Wt,Et+=K*Yt,wt+=K*Sr,ut+=K*tr,ht+=K*br,st+=K*_r,ft+=K*wr,pt+=K*Tr,ct+=K*Jr,je+=K*Xr,$e+=K*Qr,K=J[8],vt+=K*Ee,bt+=K*jt,St+=K*Zt,At+=K*Jt,_t+=K*Ft,Et+=K*Wt,wt+=K*Yt,ut+=K*Sr,ht+=K*tr,st+=K*br,ft+=K*_r,pt+=K*wr,ct+=K*Tr,je+=K*Jr,$e+=K*Xr,Ye+=K*Qr,K=J[9],bt+=K*Ee,St+=K*jt,At+=K*Zt,_t+=K*Jt,Et+=K*Ft,wt+=K*Wt,ut+=K*Yt,ht+=K*Sr,st+=K*tr,ft+=K*br,pt+=K*_r,ct+=K*wr,je+=K*Tr,$e+=K*Jr,Ye+=K*Xr,ze+=K*Qr,K=J[10],St+=K*Ee,At+=K*jt,_t+=K*Zt,Et+=K*Jt,wt+=K*Ft,ut+=K*Wt,ht+=K*Yt,st+=K*Sr,ft+=K*tr,pt+=K*br,ct+=K*_r,je+=K*wr,$e+=K*Tr,Ye+=K*Jr,ze+=K*Xr,We+=K*Qr,K=J[11],At+=K*Ee,_t+=K*jt,Et+=K*Zt,wt+=K*Jt,ut+=K*Ft,ht+=K*Wt,st+=K*Yt,ft+=K*Sr,pt+=K*tr,ct+=K*br,je+=K*_r,$e+=K*wr,Ye+=K*Tr,ze+=K*Jr,We+=K*Xr,Xe+=K*Qr,K=J[12],_t+=K*Ee,Et+=K*jt,wt+=K*Zt,ut+=K*Jt,ht+=K*Ft,st+=K*Wt,ft+=K*Yt,pt+=K*Sr,ct+=K*tr,je+=K*br,$e+=K*_r,Ye+=K*wr,ze+=K*Tr,We+=K*Jr,Xe+=K*Xr,Pt+=K*Qr,K=J[13],Et+=K*Ee,wt+=K*jt,ut+=K*Zt,ht+=K*Jt,st+=K*Ft,ft+=K*Wt,pt+=K*Yt,ct+=K*Sr,je+=K*tr,$e+=K*br,Ye+=K*_r,ze+=K*wr,We+=K*Tr,Xe+=K*Jr,Pt+=K*Xr,Nt+=K*Qr,K=J[14],wt+=K*Ee,ut+=K*jt,ht+=K*Zt,st+=K*Jt,ft+=K*Ft,pt+=K*Wt,ct+=K*Yt,je+=K*Sr,$e+=K*tr,Ye+=K*br,ze+=K*_r,We+=K*wr,Xe+=K*Tr,Pt+=K*Jr,Nt+=K*Xr,Lt+=K*Qr,K=J[15],ut+=K*Ee,ht+=K*jt,st+=K*Zt,ft+=K*Jt,pt+=K*Ft,ct+=K*Wt,je+=K*Yt,$e+=K*Sr,Ye+=K*tr,ze+=K*br,We+=K*_r,Xe+=K*wr,Pt+=K*Tr,Nt+=K*Jr,Lt+=K*Xr,Ut+=K*Qr,Se+=38*ht,Te+=38*st,Ke+=38*ft,Ge+=38*pt,dt+=38*ct,it+=38*je,Ct+=38*$e,at+=38*Ye,vt+=38*ze,bt+=38*We,St+=38*Xe,At+=38*Pt,_t+=38*Nt,Et+=38*Lt,wt+=38*Ut,ae=1,K=Se+ae+65535,ae=Math.floor(K/65536),Se=K-ae*65536,K=Te+ae+65535,ae=Math.floor(K/65536),Te=K-ae*65536,K=Ke+ae+65535,ae=Math.floor(K/65536),Ke=K-ae*65536,K=Ge+ae+65535,ae=Math.floor(K/65536),Ge=K-ae*65536,K=dt+ae+65535,ae=Math.floor(K/65536),dt=K-ae*65536,K=it+ae+65535,ae=Math.floor(K/65536),it=K-ae*65536,K=Ct+ae+65535,ae=Math.floor(K/65536),Ct=K-ae*65536,K=at+ae+65535,ae=Math.floor(K/65536),at=K-ae*65536,K=vt+ae+65535,ae=Math.floor(K/65536),vt=K-ae*65536,K=bt+ae+65535,ae=Math.floor(K/65536),bt=K-ae*65536,K=St+ae+65535,ae=Math.floor(K/65536),St=K-ae*65536,K=At+ae+65535,ae=Math.floor(K/65536),At=K-ae*65536,K=_t+ae+65535,ae=Math.floor(K/65536),_t=K-ae*65536,K=Et+ae+65535,ae=Math.floor(K/65536),Et=K-ae*65536,K=wt+ae+65535,ae=Math.floor(K/65536),wt=K-ae*65536,K=ut+ae+65535,ae=Math.floor(K/65536),ut=K-ae*65536,Se+=ae-1+37*(ae-1),ae=1,K=Se+ae+65535,ae=Math.floor(K/65536),Se=K-ae*65536,K=Te+ae+65535,ae=Math.floor(K/65536),Te=K-ae*65536,K=Ke+ae+65535,ae=Math.floor(K/65536),Ke=K-ae*65536,K=Ge+ae+65535,ae=Math.floor(K/65536),Ge=K-ae*65536,K=dt+ae+65535,ae=Math.floor(K/65536),dt=K-ae*65536,K=it+ae+65535,ae=Math.floor(K/65536),it=K-ae*65536,K=Ct+ae+65535,ae=Math.floor(K/65536),Ct=K-ae*65536,K=at+ae+65535,ae=Math.floor(K/65536),at=K-ae*65536,K=vt+ae+65535,ae=Math.floor(K/65536),vt=K-ae*65536,K=bt+ae+65535,ae=Math.floor(K/65536),bt=K-ae*65536,K=St+ae+65535,ae=Math.floor(K/65536),St=K-ae*65536,K=At+ae+65535,ae=Math.floor(K/65536),At=K-ae*65536,K=_t+ae+65535,ae=Math.floor(K/65536),_t=K-ae*65536,K=Et+ae+65535,ae=Math.floor(K/65536),Et=K-ae*65536,K=wt+ae+65535,ae=Math.floor(K/65536),wt=K-ae*65536,K=ut+ae+65535,ae=Math.floor(K/65536),ut=K-ae*65536,Se+=ae-1+37*(ae-1),$[0]=Se,$[1]=Te,$[2]=Ke,$[3]=Ge,$[4]=dt,$[5]=it,$[6]=Ct,$[7]=at,$[8]=vt,$[9]=bt,$[10]=St,$[11]=At,$[12]=_t,$[13]=Et,$[14]=wt,$[15]=ut}function re($,J){j($,J,J)}function V($,J){var Q=r(),K;for(K=0;K<16;K++)Q[K]=J[K];for(K=253;K>=0;K--)re(Q,Q),K!==2&&K!==4&&j(Q,Q,J);for(K=0;K<16;K++)$[K]=Q[K]}function U($,J){var Q=r(),K;for(K=0;K<16;K++)Q[K]=J[K];for(K=250;K>=0;K--)re(Q,Q),K!==1&&j(Q,Q,J);for(K=0;K<16;K++)$[K]=Q[K]}function X($,J,Q){var K=new Uint8Array(32),ae=new Float64Array(80),Se,Te,Ke=r(),Ge=r(),dt=r(),it=r(),Ct=r(),at=r();for(Te=0;Te<31;Te++)K[Te]=J[Te];for(K[31]=J[31]&127|64,K[0]&=248,F(ae,Q),Te=0;Te<16;Te++)Ge[Te]=ae[Te],it[Te]=Ke[Te]=dt[Te]=0;for(Ke[0]=it[0]=1,Te=254;Te>=0;--Te)Se=K[Te>>>3]>>>(Te&7)&1,L(Ke,Ge,Se),L(dt,it,Se),z(Ct,Ke,dt),Y(Ke,Ke,dt),z(dt,Ge,it),Y(Ge,Ge,it),re(it,Ct),re(at,Ke),j(Ke,dt,Ke),j(dt,Ge,Ct),z(Ct,Ke,dt),Y(Ke,Ke,dt),re(Ge,Ke),Y(dt,it,at),j(Ke,dt,f),z(Ke,Ke,it),j(dt,dt,Ke),j(Ke,it,at),j(it,Ge,ae),re(Ge,Ct),L(Ke,Ge,Se),L(dt,it,Se);for(Te=0;Te<16;Te++)ae[Te+16]=Ke[Te],ae[Te+32]=dt[Te],ae[Te+48]=Ge[Te],ae[Te+64]=it[Te];var vt=ae.subarray(32),bt=ae.subarray(16);return V(vt,vt),j(bt,bt,vt),M($,bt),0}function ye($,J){return X($,J,i)}function _e($,J){return n(J,32),ye($,J)}function Ae($,J,Q){var K=new Uint8Array(32);return X(K,Q,J),C($,s,K,I)}var H=x,q=D;function W($,J,Q,K,ae,Se){var Te=new Uint8Array(32);return Ae(Te,ae,Se),H($,J,Q,K,Te)}function ee($,J,Q,K,ae,Se){var Te=new Uint8Array(32);return Ae(Te,ae,Se),q($,J,Q,K,Te)}var le=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function ce($,J,Q,K){for(var ae=new Int32Array(16),Se=new Int32Array(16),Te,Ke,Ge,dt,it,Ct,at,vt,bt,St,At,_t,Et,wt,ut,ht,st,ft,pt,ct,je,$e,Ye,ze,We,Xe,Pt=$[0],Nt=$[1],Lt=$[2],Ut=$[3],Ee=$[4],jt=$[5],Zt=$[6],Jt=$[7],Ft=J[0],Wt=J[1],Yt=J[2],Sr=J[3],tr=J[4],br=J[5],_r=J[6],wr=J[7],Tr=0;K>=128;){for(pt=0;pt<16;pt++)ct=8*pt+Tr,ae[pt]=Q[ct+0]<<24|Q[ct+1]<<16|Q[ct+2]<<8|Q[ct+3],Se[pt]=Q[ct+4]<<24|Q[ct+5]<<16|Q[ct+6]<<8|Q[ct+7];for(pt=0;pt<80;pt++)if(Te=Pt,Ke=Nt,Ge=Lt,dt=Ut,it=Ee,Ct=jt,at=Zt,vt=Jt,bt=Ft,St=Wt,At=Yt,_t=Sr,Et=tr,wt=br,ut=_r,ht=wr,je=Jt,$e=wr,Ye=$e&65535,ze=$e>>>16,We=je&65535,Xe=je>>>16,je=(Ee>>>14|tr<<32-14)^(Ee>>>18|tr<<32-18)^(tr>>>41-32|Ee<<32-(41-32)),$e=(tr>>>14|Ee<<32-14)^(tr>>>18|Ee<<32-18)^(Ee>>>41-32|tr<<32-(41-32)),Ye+=$e&65535,ze+=$e>>>16,We+=je&65535,Xe+=je>>>16,je=Ee&jt^~Ee&Zt,$e=tr&br^~tr&_r,Ye+=$e&65535,ze+=$e>>>16,We+=je&65535,Xe+=je>>>16,je=le[pt*2],$e=le[pt*2+1],Ye+=$e&65535,ze+=$e>>>16,We+=je&65535,Xe+=je>>>16,je=ae[pt%16],$e=Se[pt%16],Ye+=$e&65535,ze+=$e>>>16,We+=je&65535,Xe+=je>>>16,ze+=Ye>>>16,We+=ze>>>16,Xe+=We>>>16,st=We&65535|Xe<<16,ft=Ye&65535|ze<<16,je=st,$e=ft,Ye=$e&65535,ze=$e>>>16,We=je&65535,Xe=je>>>16,je=(Pt>>>28|Ft<<32-28)^(Ft>>>34-32|Pt<<32-(34-32))^(Ft>>>39-32|Pt<<32-(39-32)),$e=(Ft>>>28|Pt<<32-28)^(Pt>>>34-32|Ft<<32-(34-32))^(Pt>>>39-32|Ft<<32-(39-32)),Ye+=$e&65535,ze+=$e>>>16,We+=je&65535,Xe+=je>>>16,je=Pt&Nt^Pt&Lt^Nt&Lt,$e=Ft&Wt^Ft&Yt^Wt&Yt,Ye+=$e&65535,ze+=$e>>>16,We+=je&65535,Xe+=je>>>16,ze+=Ye>>>16,We+=ze>>>16,Xe+=We>>>16,vt=We&65535|Xe<<16,ht=Ye&65535|ze<<16,je=dt,$e=_t,Ye=$e&65535,ze=$e>>>16,We=je&65535,Xe=je>>>16,je=st,$e=ft,Ye+=$e&65535,ze+=$e>>>16,We+=je&65535,Xe+=je>>>16,ze+=Ye>>>16,We+=ze>>>16,Xe+=We>>>16,dt=We&65535|Xe<<16,_t=Ye&65535|ze<<16,Nt=Te,Lt=Ke,Ut=Ge,Ee=dt,jt=it,Zt=Ct,Jt=at,Pt=vt,Wt=bt,Yt=St,Sr=At,tr=_t,br=Et,_r=wt,wr=ut,Ft=ht,pt%16===15)for(ct=0;ct<16;ct++)je=ae[ct],$e=Se[ct],Ye=$e&65535,ze=$e>>>16,We=je&65535,Xe=je>>>16,je=ae[(ct+9)%16],$e=Se[(ct+9)%16],Ye+=$e&65535,ze+=$e>>>16,We+=je&65535,Xe+=je>>>16,st=ae[(ct+1)%16],ft=Se[(ct+1)%16],je=(st>>>1|ft<<32-1)^(st>>>8|ft<<32-8)^st>>>7,$e=(ft>>>1|st<<32-1)^(ft>>>8|st<<32-8)^(ft>>>7|st<<32-7),Ye+=$e&65535,ze+=$e>>>16,We+=je&65535,Xe+=je>>>16,st=ae[(ct+14)%16],ft=Se[(ct+14)%16],je=(st>>>19|ft<<32-19)^(ft>>>61-32|st<<32-(61-32))^st>>>6,$e=(ft>>>19|st<<32-19)^(st>>>61-32|ft<<32-(61-32))^(ft>>>6|st<<32-6),Ye+=$e&65535,ze+=$e>>>16,We+=je&65535,Xe+=je>>>16,ze+=Ye>>>16,We+=ze>>>16,Xe+=We>>>16,ae[ct]=We&65535|Xe<<16,Se[ct]=Ye&65535|ze<<16;je=Pt,$e=Ft,Ye=$e&65535,ze=$e>>>16,We=je&65535,Xe=je>>>16,je=$[0],$e=J[0],Ye+=$e&65535,ze+=$e>>>16,We+=je&65535,Xe+=je>>>16,ze+=Ye>>>16,We+=ze>>>16,Xe+=We>>>16,$[0]=Pt=We&65535|Xe<<16,J[0]=Ft=Ye&65535|ze<<16,je=Nt,$e=Wt,Ye=$e&65535,ze=$e>>>16,We=je&65535,Xe=je>>>16,je=$[1],$e=J[1],Ye+=$e&65535,ze+=$e>>>16,We+=je&65535,Xe+=je>>>16,ze+=Ye>>>16,We+=ze>>>16,Xe+=We>>>16,$[1]=Nt=We&65535|Xe<<16,J[1]=Wt=Ye&65535|ze<<16,je=Lt,$e=Yt,Ye=$e&65535,ze=$e>>>16,We=je&65535,Xe=je>>>16,je=$[2],$e=J[2],Ye+=$e&65535,ze+=$e>>>16,We+=je&65535,Xe+=je>>>16,ze+=Ye>>>16,We+=ze>>>16,Xe+=We>>>16,$[2]=Lt=We&65535|Xe<<16,J[2]=Yt=Ye&65535|ze<<16,je=Ut,$e=Sr,Ye=$e&65535,ze=$e>>>16,We=je&65535,Xe=je>>>16,je=$[3],$e=J[3],Ye+=$e&65535,ze+=$e>>>16,We+=je&65535,Xe+=je>>>16,ze+=Ye>>>16,We+=ze>>>16,Xe+=We>>>16,$[3]=Ut=We&65535|Xe<<16,J[3]=Sr=Ye&65535|ze<<16,je=Ee,$e=tr,Ye=$e&65535,ze=$e>>>16,We=je&65535,Xe=je>>>16,je=$[4],$e=J[4],Ye+=$e&65535,ze+=$e>>>16,We+=je&65535,Xe+=je>>>16,ze+=Ye>>>16,We+=ze>>>16,Xe+=We>>>16,$[4]=Ee=We&65535|Xe<<16,J[4]=tr=Ye&65535|ze<<16,je=jt,$e=br,Ye=$e&65535,ze=$e>>>16,We=je&65535,Xe=je>>>16,je=$[5],$e=J[5],Ye+=$e&65535,ze+=$e>>>16,We+=je&65535,Xe+=je>>>16,ze+=Ye>>>16,We+=ze>>>16,Xe+=We>>>16,$[5]=jt=We&65535|Xe<<16,J[5]=br=Ye&65535|ze<<16,je=Zt,$e=_r,Ye=$e&65535,ze=$e>>>16,We=je&65535,Xe=je>>>16,je=$[6],$e=J[6],Ye+=$e&65535,ze+=$e>>>16,We+=je&65535,Xe+=je>>>16,ze+=Ye>>>16,We+=ze>>>16,Xe+=We>>>16,$[6]=Zt=We&65535|Xe<<16,J[6]=_r=Ye&65535|ze<<16,je=Jt,$e=wr,Ye=$e&65535,ze=$e>>>16,We=je&65535,Xe=je>>>16,je=$[7],$e=J[7],Ye+=$e&65535,ze+=$e>>>16,We+=je&65535,Xe+=je>>>16,ze+=Ye>>>16,We+=ze>>>16,Xe+=We>>>16,$[7]=Jt=We&65535|Xe<<16,J[7]=wr=Ye&65535|ze<<16,Tr+=128,K-=128}return K}function ie($,J,Q){var K=new Int32Array(8),ae=new Int32Array(8),Se=new Uint8Array(256),Te,Ke=Q;for(K[0]=1779033703,K[1]=3144134277,K[2]=1013904242,K[3]=2773480762,K[4]=1359893119,K[5]=2600822924,K[6]=528734635,K[7]=1541459225,ae[0]=4089235720,ae[1]=2227873595,ae[2]=4271175723,ae[3]=1595750129,ae[4]=2917565137,ae[5]=725511199,ae[6]=4215389547,ae[7]=327033209,ce(K,ae,J,Q),Q%=128,Te=0;Te<Q;Te++)Se[Te]=J[Ke-Q+Te];for(Se[Q]=128,Q=256-128*(Q<112?1:0),Se[Q-9]=0,h(Se,Q-8,Ke/536870912|0,Ke<<3),ce(K,ae,Se,Q),Te=0;Te<8;Te++)h($,8*Te,K[Te],ae[Te]);return 0}function Fe($,J){var Q=r(),K=r(),ae=r(),Se=r(),Te=r(),Ke=r(),Ge=r(),dt=r(),it=r();Y(Q,$[1],$[0]),Y(it,J[1],J[0]),j(Q,Q,it),z(K,$[0],$[1]),z(it,J[0],J[1]),j(K,K,it),j(ae,$[3],J[3]),j(ae,ae,l),j(Se,$[2],J[2]),z(Se,Se,Se),Y(Te,K,Q),Y(Ke,Se,ae),z(Ge,Se,ae),z(dt,K,Q),j($[0],Te,Ke),j($[1],dt,Ge),j($[2],Ge,Ke),j($[3],Te,dt)}function De($,J,Q){var K;for(K=0;K<4;K++)L($[K],J[K],Q)}function qe($,J){var Q=r(),K=r(),ae=r();V(ae,J[2]),j(Q,J[0],ae),j(K,J[1],ae),M($,K),$[31]^=N(Q)<<7}function he($,J,Q){var K,ae;for(O($[0],o),O($[1],a),O($[2],a),O($[3],o),ae=255;ae>=0;--ae)K=Q[ae/8|0]>>(ae&7)&1,De($,J,K),Fe(J,$),Fe($,$),De($,J,K)}function ue($,J){var Q=[r(),r(),r(),r()];O(Q[0],u),O(Q[1],p),O(Q[2],a),j(Q[3],u,p),he($,Q,J)}function pe($,J,Q){var K=new Uint8Array(64),ae=[r(),r(),r(),r()],Se;for(Q||n(J,32),ie(K,J,32),K[0]&=248,K[31]&=127,K[31]|=64,ue(ae,K),qe($,ae),Se=0;Se<32;Se++)J[Se+32]=$[Se];return 0}var de=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function fe($,J){var Q,K,ae,Se;for(K=63;K>=32;--K){for(Q=0,ae=K-32,Se=K-12;ae<Se;++ae)J[ae]+=Q-16*J[K]*de[ae-(K-32)],Q=Math.floor((J[ae]+128)/256),J[ae]-=Q*256;J[ae]+=Q,J[K]=0}for(Q=0,ae=0;ae<32;ae++)J[ae]+=Q-(J[31]>>4)*de[ae],Q=J[ae]>>8,J[ae]&=255;for(ae=0;ae<32;ae++)J[ae]-=Q*de[ae];for(K=0;K<32;K++)J[K+1]+=J[K]>>8,$[K]=J[K]&255}function ge($){var J=new Float64Array(64),Q;for(Q=0;Q<64;Q++)J[Q]=$[Q];for(Q=0;Q<64;Q++)$[Q]=0;fe($,J)}function se($,J,Q,K){var ae=new Uint8Array(64),Se=new Uint8Array(64),Te=new Uint8Array(64),Ke,Ge,dt=new Float64Array(64),it=[r(),r(),r(),r()];ie(ae,K,32),ae[0]&=248,ae[31]&=127,ae[31]|=64;var Ct=Q+64;for(Ke=0;Ke<Q;Ke++)$[64+Ke]=J[Ke];for(Ke=0;Ke<32;Ke++)$[32+Ke]=ae[32+Ke];for(ie(Te,$.subarray(32),Q+32),ge(Te),ue(it,Te),qe($,it),Ke=32;Ke<64;Ke++)$[Ke]=K[Ke];for(ie(Se,$,Q+64),ge(Se),Ke=0;Ke<64;Ke++)dt[Ke]=0;for(Ke=0;Ke<32;Ke++)dt[Ke]=Te[Ke];for(Ke=0;Ke<32;Ke++)for(Ge=0;Ge<32;Ge++)dt[Ke+Ge]+=Se[Ke]*ae[Ge];return fe($.subarray(32),dt),Ct}function te($,J){var Q=r(),K=r(),ae=r(),Se=r(),Te=r(),Ke=r(),Ge=r();return O($[2],a),F($[1],J),re(ae,$[1]),j(Se,ae,c),Y(ae,ae,$[2]),z(Se,$[2],Se),re(Te,Se),re(Ke,Te),j(Ge,Ke,Te),j(Q,Ge,ae),j(Q,Q,Se),U(Q,Q),j(Q,Q,ae),j(Q,Q,Se),j(Q,Q,Se),j($[0],Q,Se),re(K,$[0]),j(K,K,Se),R(K,ae)&&j($[0],$[0],d),re(K,$[0]),j(K,K,Se),R(K,ae)?-1:(N($[0])===J[31]>>7&&Y($[0],o,$[0]),j($[3],$[0],$[1]),0)}function Ne($,J,Q,K){var ae,Se=new Uint8Array(32),Te=new Uint8Array(64),Ke=[r(),r(),r(),r()],Ge=[r(),r(),r(),r()];if(Q<64||te(Ge,K))return-1;for(ae=0;ae<Q;ae++)$[ae]=J[ae];for(ae=0;ae<32;ae++)$[ae+32]=K[ae];if(ie(Te,$,Q),ge(Te),he(Ke,Ge,Te),ue(Ge,J.subarray(32)),Fe(Ke,Ge),qe(Se,Ke),Q-=64,v(J,0,Se,0)){for(ae=0;ae<Q;ae++)$[ae]=0;return-1}for(ae=0;ae<Q;ae++)$[ae]=J[ae+64];return Q}var Ve=32,Je=24,lt=32,tt=16,ve=32,Z=32,oe=32,me=32,xe=32,Pe=Je,ke=lt,Oe=tt,Ue=64,Ie=32,Re=64,et=32,we=64;t.lowlevel={crypto_core_hsalsa20:C,crypto_stream_xor:T,crypto_stream:S,crypto_stream_salsa20_xor:k,crypto_stream_salsa20:E,crypto_onetimeauth:g,crypto_onetimeauth_verify:A,crypto_verify_16:m,crypto_verify_32:v,crypto_secretbox:x,crypto_secretbox_open:D,crypto_scalarmult:X,crypto_scalarmult_base:ye,crypto_box_beforenm:Ae,crypto_box_afternm:H,crypto_box:W,crypto_box_open:ee,crypto_box_keypair:_e,crypto_hash:ie,crypto_sign:se,crypto_sign_keypair:pe,crypto_sign_open:Ne,crypto_secretbox_KEYBYTES:Ve,crypto_secretbox_NONCEBYTES:Je,crypto_secretbox_ZEROBYTES:lt,crypto_secretbox_BOXZEROBYTES:tt,crypto_scalarmult_BYTES:ve,crypto_scalarmult_SCALARBYTES:Z,crypto_box_PUBLICKEYBYTES:oe,crypto_box_SECRETKEYBYTES:me,crypto_box_BEFORENMBYTES:xe,crypto_box_NONCEBYTES:Pe,crypto_box_ZEROBYTES:ke,crypto_box_BOXZEROBYTES:Oe,crypto_sign_BYTES:Ue,crypto_sign_PUBLICKEYBYTES:Ie,crypto_sign_SECRETKEYBYTES:Re,crypto_sign_SEEDBYTES:et,crypto_hash_BYTES:we,gf:r,D:c,L:de,pack25519:M,unpack25519:F,M:j,A:z,S:re,Z:Y,pow2523:U,add:Fe,set25519:O,modL:fe,scalarmult:he,scalarbase:ue};function Ce($,J){if($.length!==Ve)throw new Error("bad key size");if(J.length!==Je)throw new Error("bad nonce size")}function Be($,J){if($.length!==oe)throw new Error("bad public key size");if(J.length!==me)throw new Error("bad secret key size")}function Le(){for(var $=0;$<arguments.length;$++)if(!(arguments[$]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Me($){for(var J=0;J<$.length;J++)$[J]=0}t.randomBytes=function($){var J=new Uint8Array($);return n(J,$),J},t.secretbox=function($,J,Q){Le($,J,Q),Ce(Q,J);for(var K=new Uint8Array(lt+$.length),ae=new Uint8Array(K.length),Se=0;Se<$.length;Se++)K[Se+lt]=$[Se];return x(ae,K,K.length,J,Q),ae.subarray(tt)},t.secretbox.open=function($,J,Q){Le($,J,Q),Ce(Q,J);for(var K=new Uint8Array(tt+$.length),ae=new Uint8Array(K.length),Se=0;Se<$.length;Se++)K[Se+tt]=$[Se];return K.length<32||D(ae,K,K.length,J,Q)!==0?null:ae.subarray(lt)},t.secretbox.keyLength=Ve,t.secretbox.nonceLength=Je,t.secretbox.overheadLength=tt,t.scalarMult=function($,J){if(Le($,J),$.length!==Z)throw new Error("bad n size");if(J.length!==ve)throw new Error("bad p size");var Q=new Uint8Array(ve);return X(Q,$,J),Q},t.scalarMult.base=function($){if(Le($),$.length!==Z)throw new Error("bad n size");var J=new Uint8Array(ve);return ye(J,$),J},t.scalarMult.scalarLength=Z,t.scalarMult.groupElementLength=ve,t.box=function($,J,Q,K){var ae=t.box.before(Q,K);return t.secretbox($,J,ae)},t.box.before=function($,J){Le($,J),Be($,J);var Q=new Uint8Array(xe);return Ae(Q,$,J),Q},t.box.after=t.secretbox,t.box.open=function($,J,Q,K){var ae=t.box.before(Q,K);return t.secretbox.open($,J,ae)},t.box.open.after=t.secretbox.open,t.box.keyPair=function(){var $=new Uint8Array(oe),J=new Uint8Array(me);return _e($,J),{publicKey:$,secretKey:J}},t.box.keyPair.fromSecretKey=function($){if(Le($),$.length!==me)throw new Error("bad secret key size");var J=new Uint8Array(oe);return ye(J,$),{publicKey:J,secretKey:new Uint8Array($)}},t.box.publicKeyLength=oe,t.box.secretKeyLength=me,t.box.sharedKeyLength=xe,t.box.nonceLength=Pe,t.box.overheadLength=t.secretbox.overheadLength,t.sign=function($,J){if(Le($,J),J.length!==Re)throw new Error("bad secret key size");var Q=new Uint8Array(Ue+$.length);return se(Q,$,$.length,J),Q},t.sign.open=function($,J){if(Le($,J),J.length!==Ie)throw new Error("bad public key size");var Q=new Uint8Array($.length),K=Ne(Q,$,$.length,J);if(K<0)return null;for(var ae=new Uint8Array(K),Se=0;Se<ae.length;Se++)ae[Se]=Q[Se];return ae},t.sign.detached=function($,J){for(var Q=t.sign($,J),K=new Uint8Array(Ue),ae=0;ae<K.length;ae++)K[ae]=Q[ae];return K},t.sign.detached.verify=function($,J,Q){if(Le($,J,Q),J.length!==Ue)throw new Error("bad signature size");if(Q.length!==Ie)throw new Error("bad public key size");var K=new Uint8Array(Ue+$.length),ae=new Uint8Array(Ue+$.length),Se;for(Se=0;Se<Ue;Se++)K[Se]=J[Se];for(Se=0;Se<$.length;Se++)K[Se+Ue]=$[Se];return Ne(ae,K,K.length,Q)>=0},t.sign.keyPair=function(){var $=new Uint8Array(Ie),J=new Uint8Array(Re);return pe($,J),{publicKey:$,secretKey:J}},t.sign.keyPair.fromSecretKey=function($){if(Le($),$.length!==Re)throw new Error("bad secret key size");for(var J=new Uint8Array(Ie),Q=0;Q<J.length;Q++)J[Q]=$[32+Q];return{publicKey:J,secretKey:new Uint8Array($)}},t.sign.keyPair.fromSeed=function($){if(Le($),$.length!==et)throw new Error("bad seed size");for(var J=new Uint8Array(Ie),Q=new Uint8Array(Re),K=0;K<32;K++)Q[K]=$[K];return pe(J,Q,!0),{publicKey:J,secretKey:Q}},t.sign.publicKeyLength=Ie,t.sign.secretKeyLength=Re,t.sign.seedLength=et,t.sign.signatureLength=Ue,t.hash=function($){Le($);var J=new Uint8Array(we);return ie(J,$,$.length),J},t.hash.hashLength=we,t.verify=function($,J){return Le($,J),$.length===0||J.length===0||$.length!==J.length?!1:y($,0,J,0,$.length)===0},t.setPRNG=function($){n=$},function(){var $=typeof self<"u"?self.crypto||self.msCrypto:null;if($&&$.getRandomValues){var J=65536;t.setPRNG(function(Q,K){var ae,Se=new Uint8Array(K);for(ae=0;ae<K;ae+=J)$.getRandomValues(Se.subarray(ae,ae+Math.min(K-ae,J)));for(ae=0;ae<K;ae++)Q[ae]=Se[ae];Me(Se)})}else typeof ka<"u"&&($=xa,$&&$.randomBytes&&t.setPRNG(function(Q,K){var ae,Se=$.randomBytes(K);for(ae=0;ae<K;ae++)Q[ae]=Se[ae];Me(Se)}))}()})(e.exports?e.exports:self.nacl=self.nacl||{})}(Op)),Op.exports}var Mp={exports:{}},A6;function UH(){return A6||(A6=1,function(e){(function(t,r){e.exports?e.exports=r():(t.nacl||(t.nacl={}),t.nacl.util=r())})(rt,function(){var t={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return t.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var s,i=unescape(encodeURIComponent(n)),o=new Uint8Array(i.length);for(s=0;s<i.length;s++)o[s]=i.charCodeAt(s);return o},t.encodeUTF8=function(n){var s,i=[];for(s=0;s<n.length;s++)i.push(String.fromCharCode(n[s]));return decodeURIComponent(escape(i.join("")))},typeof atob>"u"?typeof ot.from<"u"?(t.encodeBase64=function(n){return ot.from(n).toString("base64")},t.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(ot.from(n,"base64"),0))}):(t.encodeBase64=function(n){return new ot(n).toString("base64")},t.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new ot(n,"base64"),0))}):(t.encodeBase64=function(n){var s,i=[],o=n.length;for(s=0;s<o;s++)i.push(String.fromCharCode(n[s]));return btoa(i.join(""))},t.decodeBase64=function(n){r(n);var s,i=atob(n),o=new Uint8Array(i.length);for(s=0;s<i.length;s++)o[s]=i.charCodeAt(s);return o}),t})}(Mp)),Mp.exports}var S6;function LH(){if(S6)return xn;S6=1;var e=rt&&rt.__createBinding||(Object.create?function(p,d,h,y){y===void 0&&(y=h);var m=Object.getOwnPropertyDescriptor(d,h);(!m||("get"in m?!d.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return d[h]}}),Object.defineProperty(p,y,m)}:function(p,d,h,y){y===void 0&&(y=h),p[y]=d[h]}),t=rt&&rt.__setModuleDefault||(Object.create?function(p,d){Object.defineProperty(p,"default",{enumerable:!0,value:d})}:function(p,d){p.default=d}),r=rt&&rt.__importStar||function(p){if(p&&p.__esModule)return p;var d={};if(p!=null)for(var h in p)h!=="default"&&Object.prototype.hasOwnProperty.call(p,h)&&e(d,p,h);return t(d,p),d};Object.defineProperty(xn,"__esModule",{value:!0}),xn.getEncryptionPublicKey=xn.decryptSafely=xn.decrypt=xn.encryptSafely=xn.encrypt=void 0;const n=r(NH()),s=r(UH()),i=sl();function o({publicKey:p,data:d,version:h}){if((0,i.isNullish)(p))throw new Error("Missing publicKey parameter");if((0,i.isNullish)(d))throw new Error("Missing data parameter");if((0,i.isNullish)(h))throw new Error("Missing version parameter");switch(h){case"x25519-xsalsa20-poly1305":{if(typeof d!="string")throw new Error("Message data must be given as a string");const y=n.box.keyPair();let m;try{m=s.decodeBase64(p)}catch{throw new Error("Bad public key")}const v=s.decodeUTF8(d),b=n.randomBytes(n.box.nonceLength),w=n.box(v,b,m,y.secretKey);return{version:"x25519-xsalsa20-poly1305",nonce:s.encodeBase64(b),ephemPublicKey:s.encodeBase64(y.publicKey),ciphertext:s.encodeBase64(w)}}default:throw new Error("Encryption type/version not supported")}}xn.encrypt=o;function a({publicKey:p,data:d,version:h}){if((0,i.isNullish)(p))throw new Error("Missing publicKey parameter");if((0,i.isNullish)(d))throw new Error("Missing data parameter");if((0,i.isNullish)(h))throw new Error("Missing version parameter");const y=2**11,m=16;if(typeof d=="object"&&d&&"toJSON"in d)throw new Error("Cannot encrypt with toJSON property. Please remove toJSON property");const v={data:d,padding:""},w=ot.byteLength(JSON.stringify(v),"utf-8")%y;let _=0;w>0&&(_=y-w-m),v.padding="0".repeat(_);const C=JSON.stringify(v);return o({publicKey:p,data:C,version:h})}xn.encryptSafely=a;function f({encryptedData:p,privateKey:d}){if((0,i.isNullish)(p))throw new Error("Missing encryptedData parameter");if((0,i.isNullish)(d))throw new Error("Missing privateKey parameter");switch(p.version){case"x25519-xsalsa20-poly1305":{const h=u(d),y=n.box.keyPair.fromSecretKey(h).secretKey,m=s.decodeBase64(p.nonce),v=s.decodeBase64(p.ciphertext),b=s.decodeBase64(p.ephemPublicKey),w=n.box.open(v,m,b,y);try{if(!w)throw new Error;const _=s.encodeUTF8(w);if(!_)throw new Error;return _}catch(_){throw _&&typeof _.message=="string"&&_.message.length?new Error(`Decryption failed: ${_.message}`):new Error("Decryption failed.")}}default:throw new Error("Encryption type/version not supported.")}}xn.decrypt=f;function c({encryptedData:p,privateKey:d}){if((0,i.isNullish)(p))throw new Error("Missing encryptedData parameter");if((0,i.isNullish)(d))throw new Error("Missing privateKey parameter");return JSON.parse(f({encryptedData:p,privateKey:d})).data}xn.decryptSafely=c;function l(p){const d=u(p),h=n.box.keyPair.fromSecretKey(d).publicKey;return s.encodeBase64(h)}xn.getEncryptionPublicKey=l;function u(p){const d=ot.from(p,"hex").toString("base64");return s.decodeBase64(d)}return xn}var P6;function Ly(){return P6||(P6=1,function(e){var t=rt&&rt.__createBinding||(Object.create?function(s,i,o,a){a===void 0&&(a=o);var f=Object.getOwnPropertyDescriptor(i,o);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(s,a,f)}:function(s,i,o,a){a===void 0&&(a=o),s[a]=i[o]}),r=rt&&rt.__exportStar||function(s,i){for(var o in s)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,s,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.normalize=e.concatSig=void 0,r(TH(),e),r(MH(),e),r(LH(),e);var n=sl();Object.defineProperty(e,"concatSig",{enumerable:!0,get:function(){return n.concatSig}}),Object.defineProperty(e,"normalize",{enumerable:!0,get:function(){return n.normalize}})}(fp)),fp}var x6;function sA(){return x6||(x6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.verifyProfileSignature=e.getTypedData=e.getTypeInformation=e.getDomainInformation=void 0;const t=He,r=Ly(),n=Ra(),s=f=>({name:"PUSH CHAT ID",chainId:f,verifyingContract:"0x0000000000000000000000000000000000000000"});e.getDomainInformation=s;const i=()=>({Data:[{name:"data",type:"string"}]});e.getTypeInformation=i;const o=(f,c,l)=>{const u={data:f},p=(0,e.getTypeInformation)(),d=(0,e.getDomainInformation)(c),h="Data";let y,m={};return l==="V1"?y={EIP712Domain:[],Data:p.Data}:(y={EIP712Domain:[{name:"name",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],Data:p.Data},m=d),{types:y,primaryType:h,domain:m,message:u}};e.getTypedData=o;const a=(f,c,l)=>t.__awaiter(void 0,void 0,void 0,function*(){const u="eip712v2",p="eip191",d="eip191v2";let h=null,y;const m=f.split(":")[0];if(m!==u&&m!==p&&m!==d||f.split(":").length>3)return!1;if(f.split(":").length===2?y=f.split(":")[1]:(h=parseInt(f.split(":")[1]),y=f.split(":")[2]),m===u)try{const v=(0,e.getTypedData)(c,h,"V2");return(0,r.recoverTypedSignature)({data:v,signature:y,version:r.SignTypedDataVersion.V4}).toLowerCase()===l.toLowerCase()}catch{const b=(0,e.getTypedData)(c,h,"V1");return(0,r.recoverTypedSignature)({data:b,signature:y,version:r.SignTypedDataVersion.V4}).toLowerCase()===l.toLowerCase()}else try{return(yield n.recoverAddress({hash:n.hashMessage(c),signature:y})).toLowerCase()===l.toLowerCase()}catch{return!1}});e.verifyProfileSignature=a}(dp)),dp}var Np={},T6;function KH(){return T6||(T6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getEncryptedSecret=void 0;const t=He,r=Ro(),n=Ze(),s=nt(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{sessionKey:a,env:f=n.default.ENV.PROD}=o||{};try{if(a==null)throw new Error("sessionKey is required");const l=`${(0,s.getAPIBaseUrls)(f)}/v1/chat/encryptedsecret/sessionKey/${a}`;return r.default.get(l).then(u=>u.data.encryptedSecret).catch(u=>{var p,d;throw!((p=u==null?void 0:u.response)===null||p===void 0)&&p.data?new Error((d=u==null?void 0:u.response)===null||d===void 0?void 0:d.data):new Error(u)})}catch(c){throw console.error(`[Push SDK] - API - Error - API ${e.getEncryptedSecret.name} -: `,c),Error(`[Push SDK] - API - Error - API ${e.getEncryptedSecret.name} -: ${c}`)}});e.getEncryptedSecret=i}(Np)),Np}var Up={},Qn={},Lp={},C6;function FH(){return C6||(C6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.HttpStatus=void 0,function(t){t[t.BadRequest=400]="BadRequest",t[t.NotFound=404]="NotFound",t[t.Forbidden=403]="Forbidden",t[t.InternalError=500]="InternalError"}(e.HttpStatus||(e.HttpStatus={}))}(Lp)),Lp}var I6;function er(){if(I6)return Qn;I6=1,Object.defineProperty(Qn,"__esModule",{value:!0}),Qn.handleError=Qn.isErrorWithResponseV2=Qn.isErrorWithResponse=Qn.ValidationError=void 0;const e=FH();class t extends Error{constructor(o,a,f,c){super(f),this.name="ValidationError",this.status=o,this.errorCode=a,this.details=c}format(){return{status:this.status,errorCode:this.errorCode,message:this.message,details:this.details,timestamp:new Date().toISOString()}}}Qn.ValidationError=t;function r(i){return typeof i=="object"&&i!==null&&"response"in i&&typeof i.response=="object"&&i.response!==null&&"status"in i.response&&"data"in i.response&&typeof i.response.data=="object"&&"status"in i.response.data&&"errorCode"in i.response.data&&"message"in i.response.data&&"details"in i.response.data&&"timestamp"in i.response.data}Qn.isErrorWithResponse=r;function n(i){return typeof i=="object"&&i!==null&&"response"in i&&typeof i.response=="object"&&i.response!==null&&"status"in i.response&&"data"in i.response&&typeof i.response.data=="object"&&"error"in i.response.data&&"message"in i.response.data&&"validation"in i.response.data}Qn.isErrorWithResponseV2=n;function s(i,o){var a,f,c;let l=e.HttpStatus.InternalError,u="00000000000",p="An unexpected error occurred. Please contact support or try again later.",d="";if(r(i)){if(l=((a=i.response)===null||a===void 0?void 0:a.status)||e.HttpStatus.InternalError,!((f=i.response)===null||f===void 0)&&f.data){const m=i.response.data;u=m.errorCode||u,p=m.message||p,d=m.details||JSON.stringify(m)}}else if(n(i)){l=((c=i.response)===null||c===void 0?void 0:c.status)||e.HttpStatus.InternalError;const m=i.response.data;p=m.message||p,d=m.validation||JSON.stringify(m)}else i instanceof Error&&(p=i.message,d=i.stack||"");const h=new t(l,u,p,d),y=`[Error - API ${o}]`;return console.error(`${y} ${JSON.stringify(h.format(),null,2)}`),h}return Qn.handleError=s,Qn}var k6;function al(){return k6||(k6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroup=void 0;const t=He,r=nt(),n=Ze(),s=Tt(),i=er(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,env:c=n.default.ENV.PROD}=a||{};try{if(f==null||f.length==0)throw new Error("chatId cannot be null or empty");const u=`${(0,r.getAPIBaseUrls)(c)}/v1/chat/groups/${f}`;return(yield(0,s.axiosGet)(u)).data}catch(l){throw(0,i.handleError)(l,e.getGroup.name)}});e.getGroup=o}(Up)),Up}var oc={},cc={},R6;function qH(){var p,d,y,m,v,b,w,_,C,I,k,E,S,T,P,g,A,x,D,O,B,L,M,R,N,F,Ky,Y,j,re,V,U,aA,ye,_e,Ae,H,Ps,W,xs,le,Fy,ie,Fe,Sd,qe,Pd,ue,lr,de,qy,ge,h0,te,Ts,Ve,jy;if(R6)return cc;R6=1,Object.defineProperty(cc,"__esModule",{value:!0}),cc.LRUCache=void 0;const e=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,t=new Set,r=typeof Mr=="object"&&Mr?Mr:{},n=(tt,ve,Z,oe)=>{typeof r.emitWarning=="function"?r.emitWarning(tt,ve,Z,oe):console.error(`[${Z}] ${ve}: ${tt}`)};let s=globalThis.AbortController,i=globalThis.AbortSignal;if(typeof s>"u"){i=class{constructor(){fr(this,"onabort");fr(this,"_onabort",[]);fr(this,"reason");fr(this,"aborted",!1)}addEventListener(oe,me){this._onabort.push(me)}},s=class{constructor(){fr(this,"signal",new i);ve()}abort(oe){var me,xe;if(!this.signal.aborted){this.signal.reason=oe,this.signal.aborted=!0;for(const Pe of this.signal._onabort)Pe(oe);(xe=(me=this.signal).onabort)==null||xe.call(me,oe)}}};let tt=((p=r.env)==null?void 0:p.LRU_CACHE_IGNORE_AC_WARNING)!=="1";const ve=()=>{tt&&(tt=!1,n("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",ve))}}const o=tt=>!t.has(tt),a=tt=>tt&&tt===Math.floor(tt)&&tt>0&&isFinite(tt),f=tt=>a(tt)?tt<=Math.pow(2,8)?Uint8Array:tt<=Math.pow(2,16)?Uint16Array:tt<=Math.pow(2,32)?Uint32Array:tt<=Number.MAX_SAFE_INTEGER?c:null:null;class c extends Array{constructor(ve){super(ve),this.fill(0)}}const h=class h{constructor(ve,Z){fr(this,"heap");fr(this,"length");if(!be(h,d))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new Z(ve),this.length=0}static create(ve){const Z=f(ve);if(!Z)return[];xt(h,d,!0);const oe=new h(ve,Z);return xt(h,d,!1),oe}push(ve){this.heap[this.length++]=ve}pop(){return this.heap[--this.length]}};d=new WeakMap,Bt(h,d,!1);let l=h;const lt=class lt{constructor(ve){Bt(this,F);Bt(this,U);Bt(this,H);Bt(this,W);Bt(this,le);Bt(this,Fe);Bt(this,qe);Bt(this,ue);Bt(this,de);Bt(this,ge);Bt(this,te);Bt(this,Ve);Bt(this,y,void 0);Bt(this,m,void 0);Bt(this,v,void 0);Bt(this,b,void 0);Bt(this,w,void 0);Bt(this,_,void 0);fr(this,"ttl");fr(this,"ttlResolution");fr(this,"ttlAutopurge");fr(this,"updateAgeOnGet");fr(this,"updateAgeOnHas");fr(this,"allowStale");fr(this,"noDisposeOnSet");fr(this,"noUpdateTTL");fr(this,"maxEntrySize");fr(this,"sizeCalculation");fr(this,"noDeleteOnFetchRejection");fr(this,"noDeleteOnStaleGet");fr(this,"allowStaleOnFetchAbort");fr(this,"allowStaleOnFetchRejection");fr(this,"ignoreFetchAbort");Bt(this,C,void 0);Bt(this,I,void 0);Bt(this,k,void 0);Bt(this,E,void 0);Bt(this,S,void 0);Bt(this,T,void 0);Bt(this,P,void 0);Bt(this,g,void 0);Bt(this,A,void 0);Bt(this,x,void 0);Bt(this,D,void 0);Bt(this,O,void 0);Bt(this,B,void 0);Bt(this,L,void 0);Bt(this,M,void 0);Bt(this,R,void 0);Bt(this,N,void 0);Bt(this,Y,()=>{});Bt(this,j,()=>{});Bt(this,re,()=>{});Bt(this,V,()=>!1);Bt(this,ye,ve=>{});Bt(this,_e,(ve,Z,oe)=>{});Bt(this,Ae,(ve,Z,oe,me)=>{if(oe||me)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});fr(this,ie,"LRUCache");const{max:Z=0,ttl:oe,ttlResolution:me=1,ttlAutopurge:xe,updateAgeOnGet:Pe,updateAgeOnHas:ke,allowStale:Oe,dispose:Ue,disposeAfter:Ie,noDisposeOnSet:Re,noUpdateTTL:et,maxSize:we=0,maxEntrySize:Ce=0,sizeCalculation:Be,fetchMethod:Le,memoMethod:Me,noDeleteOnFetchRejection:$,noDeleteOnStaleGet:J,allowStaleOnFetchRejection:Q,allowStaleOnFetchAbort:K,ignoreFetchAbort:ae}=ve;if(Z!==0&&!a(Z))throw new TypeError("max option must be a nonnegative integer");const Se=Z?f(Z):Array;if(!Se)throw new Error("invalid max value: "+Z);if(xt(this,y,Z),xt(this,m,we),this.maxEntrySize=Ce||be(this,m),this.sizeCalculation=Be,this.sizeCalculation){if(!be(this,m)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(Me!==void 0&&typeof Me!="function")throw new TypeError("memoMethod must be a function if defined");if(xt(this,_,Me),Le!==void 0&&typeof Le!="function")throw new TypeError("fetchMethod must be a function if specified");if(xt(this,w,Le),xt(this,R,!!Le),xt(this,k,new Map),xt(this,E,new Array(Z).fill(void 0)),xt(this,S,new Array(Z).fill(void 0)),xt(this,T,new Se(Z)),xt(this,P,new Se(Z)),xt(this,g,0),xt(this,A,0),xt(this,x,l.create(Z)),xt(this,C,0),xt(this,I,0),typeof Ue=="function"&&xt(this,v,Ue),typeof Ie=="function"?(xt(this,b,Ie),xt(this,D,[])):(xt(this,b,void 0),xt(this,D,void 0)),xt(this,M,!!be(this,v)),xt(this,N,!!be(this,b)),this.noDisposeOnSet=!!Re,this.noUpdateTTL=!!et,this.noDeleteOnFetchRejection=!!$,this.allowStaleOnFetchRejection=!!Q,this.allowStaleOnFetchAbort=!!K,this.ignoreFetchAbort=!!ae,this.maxEntrySize!==0){if(be(this,m)!==0&&!a(be(this,m)))throw new TypeError("maxSize must be a positive integer if specified");if(!a(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");mt(this,U,aA).call(this)}if(this.allowStale=!!Oe,this.noDeleteOnStaleGet=!!J,this.updateAgeOnGet=!!Pe,this.updateAgeOnHas=!!ke,this.ttlResolution=a(me)||me===0?me:1,this.ttlAutopurge=!!xe,this.ttl=oe||0,this.ttl){if(!a(this.ttl))throw new TypeError("ttl must be a positive integer if specified");mt(this,F,Ky).call(this)}if(be(this,y)===0&&this.ttl===0&&be(this,m)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!be(this,y)&&!be(this,m)){const Te="LRU_CACHE_UNBOUNDED";o(Te)&&(t.add(Te),n("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Te,lt))}}static unsafeExposeInternals(ve){return{starts:be(ve,B),ttls:be(ve,L),sizes:be(ve,O),keyMap:be(ve,k),keyList:be(ve,E),valList:be(ve,S),next:be(ve,T),prev:be(ve,P),get head(){return be(ve,g)},get tail(){return be(ve,A)},free:be(ve,x),isBackgroundFetch:Z=>{var oe;return mt(oe=ve,ue,lr).call(oe,Z)},backgroundFetch:(Z,oe,me,xe)=>{var Pe;return mt(Pe=ve,qe,Pd).call(Pe,Z,oe,me,xe)},moveToTail:Z=>{var oe;return mt(oe=ve,ge,h0).call(oe,Z)},indexes:Z=>{var oe;return mt(oe=ve,H,Ps).call(oe,Z)},rindexes:Z=>{var oe;return mt(oe=ve,W,xs).call(oe,Z)},isStale:Z=>{var oe;return be(oe=ve,V).call(oe,Z)}}}get max(){return be(this,y)}get maxSize(){return be(this,m)}get calculatedSize(){return be(this,I)}get size(){return be(this,C)}get fetchMethod(){return be(this,w)}get memoMethod(){return be(this,_)}get dispose(){return be(this,v)}get disposeAfter(){return be(this,b)}getRemainingTTL(ve){return be(this,k).has(ve)?1/0:0}*entries(){for(const ve of mt(this,H,Ps).call(this))be(this,S)[ve]!==void 0&&be(this,E)[ve]!==void 0&&!mt(this,ue,lr).call(this,be(this,S)[ve])&&(yield[be(this,E)[ve],be(this,S)[ve]])}*rentries(){for(const ve of mt(this,W,xs).call(this))be(this,S)[ve]!==void 0&&be(this,E)[ve]!==void 0&&!mt(this,ue,lr).call(this,be(this,S)[ve])&&(yield[be(this,E)[ve],be(this,S)[ve]])}*keys(){for(const ve of mt(this,H,Ps).call(this)){const Z=be(this,E)[ve];Z!==void 0&&!mt(this,ue,lr).call(this,be(this,S)[ve])&&(yield Z)}}*rkeys(){for(const ve of mt(this,W,xs).call(this)){const Z=be(this,E)[ve];Z!==void 0&&!mt(this,ue,lr).call(this,be(this,S)[ve])&&(yield Z)}}*values(){for(const ve of mt(this,H,Ps).call(this))be(this,S)[ve]!==void 0&&!mt(this,ue,lr).call(this,be(this,S)[ve])&&(yield be(this,S)[ve])}*rvalues(){for(const ve of mt(this,W,xs).call(this))be(this,S)[ve]!==void 0&&!mt(this,ue,lr).call(this,be(this,S)[ve])&&(yield be(this,S)[ve])}[Symbol.iterator](){return this.entries()}find(ve,Z={}){for(const oe of mt(this,H,Ps).call(this)){const me=be(this,S)[oe],xe=mt(this,ue,lr).call(this,me)?me.__staleWhileFetching:me;if(xe!==void 0&&ve(xe,be(this,E)[oe],this))return this.get(be(this,E)[oe],Z)}}forEach(ve,Z=this){for(const oe of mt(this,H,Ps).call(this)){const me=be(this,S)[oe],xe=mt(this,ue,lr).call(this,me)?me.__staleWhileFetching:me;xe!==void 0&&ve.call(Z,xe,be(this,E)[oe],this)}}rforEach(ve,Z=this){for(const oe of mt(this,W,xs).call(this)){const me=be(this,S)[oe],xe=mt(this,ue,lr).call(this,me)?me.__staleWhileFetching:me;xe!==void 0&&ve.call(Z,xe,be(this,E)[oe],this)}}purgeStale(){let ve=!1;for(const Z of mt(this,W,xs).call(this,{allowStale:!0}))be(this,V).call(this,Z)&&(mt(this,te,Ts).call(this,be(this,E)[Z],"expire"),ve=!0);return ve}info(ve){const Z=be(this,k).get(ve);if(Z===void 0)return;const oe=be(this,S)[Z],me=mt(this,ue,lr).call(this,oe)?oe.__staleWhileFetching:oe;if(me===void 0)return;const xe={value:me};if(be(this,L)&&be(this,B)){const Pe=be(this,L)[Z],ke=be(this,B)[Z];if(Pe&&ke){const Oe=Pe-(e.now()-ke);xe.ttl=Oe,xe.start=Date.now()}}return be(this,O)&&(xe.size=be(this,O)[Z]),xe}dump(){const ve=[];for(const Z of mt(this,H,Ps).call(this,{allowStale:!0})){const oe=be(this,E)[Z],me=be(this,S)[Z],xe=mt(this,ue,lr).call(this,me)?me.__staleWhileFetching:me;if(xe===void 0||oe===void 0)continue;const Pe={value:xe};if(be(this,L)&&be(this,B)){Pe.ttl=be(this,L)[Z];const ke=e.now()-be(this,B)[Z];Pe.start=Math.floor(Date.now()-ke)}be(this,O)&&(Pe.size=be(this,O)[Z]),ve.unshift([oe,Pe])}return ve}load(ve){this.clear();for(const[Z,oe]of ve){if(oe.start){const me=Date.now()-oe.start;oe.start=e.now()-me}this.set(Z,oe.value,oe)}}set(ve,Z,oe={}){var et,we,Ce,Be,Le;if(Z===void 0)return this.delete(ve),this;const{ttl:me=this.ttl,start:xe,noDisposeOnSet:Pe=this.noDisposeOnSet,sizeCalculation:ke=this.sizeCalculation,status:Oe}=oe;let{noUpdateTTL:Ue=this.noUpdateTTL}=oe;const Ie=be(this,Ae).call(this,ve,Z,oe.size||0,ke);if(this.maxEntrySize&&Ie>this.maxEntrySize)return Oe&&(Oe.set="miss",Oe.maxEntrySizeExceeded=!0),mt(this,te,Ts).call(this,ve,"set"),this;let Re=be(this,C)===0?void 0:be(this,k).get(ve);if(Re===void 0)Re=be(this,C)===0?be(this,A):be(this,x).length!==0?be(this,x).pop():be(this,C)===be(this,y)?mt(this,Fe,Sd).call(this,!1):be(this,C),be(this,E)[Re]=ve,be(this,S)[Re]=Z,be(this,k).set(ve,Re),be(this,T)[be(this,A)]=Re,be(this,P)[Re]=be(this,A),xt(this,A,Re),pl(this,C)._++,be(this,_e).call(this,Re,Ie,Oe),Oe&&(Oe.set="add"),Ue=!1;else{mt(this,ge,h0).call(this,Re);const Me=be(this,S)[Re];if(Z!==Me){if(be(this,R)&&mt(this,ue,lr).call(this,Me)){Me.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:$}=Me;$!==void 0&&!Pe&&(be(this,M)&&((et=be(this,v))==null||et.call(this,$,ve,"set")),be(this,N)&&((we=be(this,D))==null||we.push([$,ve,"set"])))}else Pe||(be(this,M)&&((Ce=be(this,v))==null||Ce.call(this,Me,ve,"set")),be(this,N)&&((Be=be(this,D))==null||Be.push([Me,ve,"set"])));if(be(this,ye).call(this,Re),be(this,_e).call(this,Re,Ie,Oe),be(this,S)[Re]=Z,Oe){Oe.set="replace";const $=Me&&mt(this,ue,lr).call(this,Me)?Me.__staleWhileFetching:Me;$!==void 0&&(Oe.oldValue=$)}}else Oe&&(Oe.set="update")}if(me!==0&&!be(this,L)&&mt(this,F,Ky).call(this),be(this,L)&&(Ue||be(this,re).call(this,Re,me,xe),Oe&&be(this,j).call(this,Oe,Re)),!Pe&&be(this,N)&&be(this,D)){const Me=be(this,D);let $;for(;$=Me==null?void 0:Me.shift();)(Le=be(this,b))==null||Le.call(this,...$)}return this}pop(){var ve;try{for(;be(this,C);){const Z=be(this,S)[be(this,g)];if(mt(this,Fe,Sd).call(this,!0),mt(this,ue,lr).call(this,Z)){if(Z.__staleWhileFetching)return Z.__staleWhileFetching}else if(Z!==void 0)return Z}}finally{if(be(this,N)&&be(this,D)){const Z=be(this,D);let oe;for(;oe=Z==null?void 0:Z.shift();)(ve=be(this,b))==null||ve.call(this,...oe)}}}has(ve,Z={}){const{updateAgeOnHas:oe=this.updateAgeOnHas,status:me}=Z,xe=be(this,k).get(ve);if(xe!==void 0){const Pe=be(this,S)[xe];if(mt(this,ue,lr).call(this,Pe)&&Pe.__staleWhileFetching===void 0)return!1;if(be(this,V).call(this,xe))me&&(me.has="stale",be(this,j).call(this,me,xe));else return oe&&be(this,Y).call(this,xe),me&&(me.has="hit",be(this,j).call(this,me,xe)),!0}else me&&(me.has="miss");return!1}peek(ve,Z={}){const{allowStale:oe=this.allowStale}=Z,me=be(this,k).get(ve);if(me===void 0||!oe&&be(this,V).call(this,me))return;const xe=be(this,S)[me];return mt(this,ue,lr).call(this,xe)?xe.__staleWhileFetching:xe}async fetch(ve,Z={}){const{allowStale:oe=this.allowStale,updateAgeOnGet:me=this.updateAgeOnGet,noDeleteOnStaleGet:xe=this.noDeleteOnStaleGet,ttl:Pe=this.ttl,noDisposeOnSet:ke=this.noDisposeOnSet,size:Oe=0,sizeCalculation:Ue=this.sizeCalculation,noUpdateTTL:Ie=this.noUpdateTTL,noDeleteOnFetchRejection:Re=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:et=this.allowStaleOnFetchRejection,ignoreFetchAbort:we=this.ignoreFetchAbort,allowStaleOnFetchAbort:Ce=this.allowStaleOnFetchAbort,context:Be,forceRefresh:Le=!1,status:Me,signal:$}=Z;if(!be(this,R))return Me&&(Me.fetch="get"),this.get(ve,{allowStale:oe,updateAgeOnGet:me,noDeleteOnStaleGet:xe,status:Me});const J={allowStale:oe,updateAgeOnGet:me,noDeleteOnStaleGet:xe,ttl:Pe,noDisposeOnSet:ke,size:Oe,sizeCalculation:Ue,noUpdateTTL:Ie,noDeleteOnFetchRejection:Re,allowStaleOnFetchRejection:et,allowStaleOnFetchAbort:Ce,ignoreFetchAbort:we,status:Me,signal:$};let Q=be(this,k).get(ve);if(Q===void 0){Me&&(Me.fetch="miss");const K=mt(this,qe,Pd).call(this,ve,Q,J,Be);return K.__returned=K}else{const K=be(this,S)[Q];if(mt(this,ue,lr).call(this,K)){const Ge=oe&&K.__staleWhileFetching!==void 0;return Me&&(Me.fetch="inflight",Ge&&(Me.returnedStale=!0)),Ge?K.__staleWhileFetching:K.__returned=K}const ae=be(this,V).call(this,Q);if(!Le&&!ae)return Me&&(Me.fetch="hit"),mt(this,ge,h0).call(this,Q),me&&be(this,Y).call(this,Q),Me&&be(this,j).call(this,Me,Q),K;const Se=mt(this,qe,Pd).call(this,ve,Q,J,Be),Ke=Se.__staleWhileFetching!==void 0&&oe;return Me&&(Me.fetch=ae?"stale":"refresh",Ke&&ae&&(Me.returnedStale=!0)),Ke?Se.__staleWhileFetching:Se.__returned=Se}}async forceFetch(ve,Z={}){const oe=await this.fetch(ve,Z);if(oe===void 0)throw new Error("fetch() returned undefined");return oe}memo(ve,Z={}){const oe=be(this,_);if(!oe)throw new Error("no memoMethod provided to constructor");const{context:me,forceRefresh:xe,...Pe}=Z,ke=this.get(ve,Pe);if(!xe&&ke!==void 0)return ke;const Oe=oe(ve,ke,{options:Pe,context:me});return this.set(ve,Oe,Pe),Oe}get(ve,Z={}){const{allowStale:oe=this.allowStale,updateAgeOnGet:me=this.updateAgeOnGet,noDeleteOnStaleGet:xe=this.noDeleteOnStaleGet,status:Pe}=Z,ke=be(this,k).get(ve);if(ke!==void 0){const Oe=be(this,S)[ke],Ue=mt(this,ue,lr).call(this,Oe);return Pe&&be(this,j).call(this,Pe,ke),be(this,V).call(this,ke)?(Pe&&(Pe.get="stale"),Ue?(Pe&&oe&&Oe.__staleWhileFetching!==void 0&&(Pe.returnedStale=!0),oe?Oe.__staleWhileFetching:void 0):(xe||mt(this,te,Ts).call(this,ve,"expire"),Pe&&oe&&(Pe.returnedStale=!0),oe?Oe:void 0)):(Pe&&(Pe.get="hit"),Ue?Oe.__staleWhileFetching:(mt(this,ge,h0).call(this,ke),me&&be(this,Y).call(this,ke),Oe))}else Pe&&(Pe.get="miss")}delete(ve){return mt(this,te,Ts).call(this,ve,"delete")}clear(){return mt(this,Ve,jy).call(this,"delete")}};ie=Symbol.toStringTag,y=new WeakMap,m=new WeakMap,v=new WeakMap,b=new WeakMap,w=new WeakMap,_=new WeakMap,C=new WeakMap,I=new WeakMap,k=new WeakMap,E=new WeakMap,S=new WeakMap,T=new WeakMap,P=new WeakMap,g=new WeakMap,A=new WeakMap,x=new WeakMap,D=new WeakMap,O=new WeakMap,B=new WeakMap,L=new WeakMap,M=new WeakMap,R=new WeakMap,N=new WeakMap,F=new WeakSet,Ky=function(){const ve=new c(be(this,y)),Z=new c(be(this,y));xt(this,L,ve),xt(this,B,Z),xt(this,re,(xe,Pe,ke=e.now())=>{if(Z[xe]=Pe!==0?ke:0,ve[xe]=Pe,Pe!==0&&this.ttlAutopurge){const Oe=setTimeout(()=>{be(this,V).call(this,xe)&&mt(this,te,Ts).call(this,be(this,E)[xe],"expire")},Pe+1);Oe.unref&&Oe.unref()}}),xt(this,Y,xe=>{Z[xe]=ve[xe]!==0?e.now():0}),xt(this,j,(xe,Pe)=>{if(ve[Pe]){const ke=ve[Pe],Oe=Z[Pe];if(!ke||!Oe)return;xe.ttl=ke,xe.start=Oe,xe.now=oe||me();const Ue=xe.now-Oe;xe.remainingTTL=ke-Ue}});let oe=0;const me=()=>{const xe=e.now();if(this.ttlResolution>0){oe=xe;const Pe=setTimeout(()=>oe=0,this.ttlResolution);Pe.unref&&Pe.unref()}return xe};this.getRemainingTTL=xe=>{const Pe=be(this,k).get(xe);if(Pe===void 0)return 0;const ke=ve[Pe],Oe=Z[Pe];if(!ke||!Oe)return 1/0;const Ue=(oe||me())-Oe;return ke-Ue},xt(this,V,xe=>{const Pe=Z[xe],ke=ve[xe];return!!ke&&!!Pe&&(oe||me())-Pe>ke})},Y=new WeakMap,j=new WeakMap,re=new WeakMap,V=new WeakMap,U=new WeakSet,aA=function(){const ve=new c(be(this,y));xt(this,I,0),xt(this,O,ve),xt(this,ye,Z=>{xt(this,I,be(this,I)-ve[Z]),ve[Z]=0}),xt(this,Ae,(Z,oe,me,xe)=>{if(mt(this,ue,lr).call(this,oe))return 0;if(!a(me))if(xe){if(typeof xe!="function")throw new TypeError("sizeCalculation must be a function");if(me=xe(oe,Z),!a(me))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return me}),xt(this,_e,(Z,oe,me)=>{if(ve[Z]=oe,be(this,m)){const xe=be(this,m)-ve[Z];for(;be(this,I)>xe;)mt(this,Fe,Sd).call(this,!0)}xt(this,I,be(this,I)+ve[Z]),me&&(me.entrySize=oe,me.totalCalculatedSize=be(this,I))})},ye=new WeakMap,_e=new WeakMap,Ae=new WeakMap,H=new WeakSet,Ps=function*({allowStale:ve=this.allowStale}={}){if(be(this,C))for(let Z=be(this,A);!(!mt(this,le,Fy).call(this,Z)||((ve||!be(this,V).call(this,Z))&&(yield Z),Z===be(this,g)));)Z=be(this,P)[Z]},W=new WeakSet,xs=function*({allowStale:ve=this.allowStale}={}){if(be(this,C))for(let Z=be(this,g);!(!mt(this,le,Fy).call(this,Z)||((ve||!be(this,V).call(this,Z))&&(yield Z),Z===be(this,A)));)Z=be(this,T)[Z]},le=new WeakSet,Fy=function(ve){return ve!==void 0&&be(this,k).get(be(this,E)[ve])===ve},Fe=new WeakSet,Sd=function(ve){var xe,Pe;const Z=be(this,g),oe=be(this,E)[Z],me=be(this,S)[Z];return be(this,R)&&mt(this,ue,lr).call(this,me)?me.__abortController.abort(new Error("evicted")):(be(this,M)||be(this,N))&&(be(this,M)&&((xe=be(this,v))==null||xe.call(this,me,oe,"evict")),be(this,N)&&((Pe=be(this,D))==null||Pe.push([me,oe,"evict"]))),be(this,ye).call(this,Z),ve&&(be(this,E)[Z]=void 0,be(this,S)[Z]=void 0,be(this,x).push(Z)),be(this,C)===1?(xt(this,g,xt(this,A,0)),be(this,x).length=0):xt(this,g,be(this,T)[Z]),be(this,k).delete(oe),pl(this,C)._--,Z},qe=new WeakSet,Pd=function(ve,Z,oe,me){const xe=Z===void 0?void 0:be(this,S)[Z];if(mt(this,ue,lr).call(this,xe))return xe;const Pe=new s,{signal:ke}=oe;ke==null||ke.addEventListener("abort",()=>Pe.abort(ke.reason),{signal:Pe.signal});const Oe={signal:Pe.signal,options:oe,context:me},Ue=(Be,Le=!1)=>{const{aborted:Me}=Pe.signal,$=oe.ignoreFetchAbort&&Be!==void 0;if(oe.status&&(Me&&!Le?(oe.status.fetchAborted=!0,oe.status.fetchError=Pe.signal.reason,$&&(oe.status.fetchAbortIgnored=!0)):oe.status.fetchResolved=!0),Me&&!$&&!Le)return Re(Pe.signal.reason);const J=we;return be(this,S)[Z]===we&&(Be===void 0?J.__staleWhileFetching?be(this,S)[Z]=J.__staleWhileFetching:mt(this,te,Ts).call(this,ve,"fetch"):(oe.status&&(oe.status.fetchUpdated=!0),this.set(ve,Be,Oe.options))),Be},Ie=Be=>(oe.status&&(oe.status.fetchRejected=!0,oe.status.fetchError=Be),Re(Be)),Re=Be=>{const{aborted:Le}=Pe.signal,Me=Le&&oe.allowStaleOnFetchAbort,$=Me||oe.allowStaleOnFetchRejection,J=$||oe.noDeleteOnFetchRejection,Q=we;if(be(this,S)[Z]===we&&(!J||Q.__staleWhileFetching===void 0?mt(this,te,Ts).call(this,ve,"fetch"):Me||(be(this,S)[Z]=Q.__staleWhileFetching)),$)return oe.status&&Q.__staleWhileFetching!==void 0&&(oe.status.returnedStale=!0),Q.__staleWhileFetching;if(Q.__returned===Q)throw Be},et=(Be,Le)=>{var $;const Me=($=be(this,w))==null?void 0:$.call(this,ve,xe,Oe);Me&&Me instanceof Promise&&Me.then(J=>Be(J===void 0?void 0:J),Le),Pe.signal.addEventListener("abort",()=>{(!oe.ignoreFetchAbort||oe.allowStaleOnFetchAbort)&&(Be(void 0),oe.allowStaleOnFetchAbort&&(Be=J=>Ue(J,!0)))})};oe.status&&(oe.status.fetchDispatched=!0);const we=new Promise(et).then(Ue,Ie),Ce=Object.assign(we,{__abortController:Pe,__staleWhileFetching:xe,__returned:void 0});return Z===void 0?(this.set(ve,Ce,{...Oe.options,status:void 0}),Z=be(this,k).get(ve)):be(this,S)[Z]=Ce,Ce},ue=new WeakSet,lr=function(ve){if(!be(this,R))return!1;const Z=ve;return!!Z&&Z instanceof Promise&&Z.hasOwnProperty("__staleWhileFetching")&&Z.__abortController instanceof s},de=new WeakSet,qy=function(ve,Z){be(this,P)[Z]=ve,be(this,T)[ve]=Z},ge=new WeakSet,h0=function(ve){ve!==be(this,A)&&(ve===be(this,g)?xt(this,g,be(this,T)[ve]):mt(this,de,qy).call(this,be(this,P)[ve],be(this,T)[ve]),mt(this,de,qy).call(this,be(this,A),ve),xt(this,A,ve))},te=new WeakSet,Ts=function(ve,Z){var me,xe,Pe,ke;let oe=!1;if(be(this,C)!==0){const Oe=be(this,k).get(ve);if(Oe!==void 0)if(oe=!0,be(this,C)===1)mt(this,Ve,jy).call(this,Z);else{be(this,ye).call(this,Oe);const Ue=be(this,S)[Oe];if(mt(this,ue,lr).call(this,Ue)?Ue.__abortController.abort(new Error("deleted")):(be(this,M)||be(this,N))&&(be(this,M)&&((me=be(this,v))==null||me.call(this,Ue,ve,Z)),be(this,N)&&((xe=be(this,D))==null||xe.push([Ue,ve,Z]))),be(this,k).delete(ve),be(this,E)[Oe]=void 0,be(this,S)[Oe]=void 0,Oe===be(this,A))xt(this,A,be(this,P)[Oe]);else if(Oe===be(this,g))xt(this,g,be(this,T)[Oe]);else{const Ie=be(this,P)[Oe];be(this,T)[Ie]=be(this,T)[Oe];const Re=be(this,T)[Oe];be(this,P)[Re]=be(this,P)[Oe]}pl(this,C)._--,be(this,x).push(Oe)}}if(be(this,N)&&((Pe=be(this,D))!=null&&Pe.length)){const Oe=be(this,D);let Ue;for(;Ue=Oe==null?void 0:Oe.shift();)(ke=be(this,b))==null||ke.call(this,...Ue)}return oe},Ve=new WeakSet,jy=function(ve){var Z,oe,me;for(const xe of mt(this,W,xs).call(this,{allowStale:!0})){const Pe=be(this,S)[xe];if(mt(this,ue,lr).call(this,Pe))Pe.__abortController.abort(new Error("deleted"));else{const ke=be(this,E)[xe];be(this,M)&&((Z=be(this,v))==null||Z.call(this,Pe,ke,ve)),be(this,N)&&((oe=be(this,D))==null||oe.push([Pe,ke,ve]))}}if(be(this,k).clear(),be(this,S).fill(void 0),be(this,E).fill(void 0),be(this,L)&&be(this,B)&&(be(this,L).fill(0),be(this,B).fill(0)),be(this,O)&&be(this,O).fill(0),xt(this,g,0),xt(this,A,0),be(this,x).length=0,xt(this,I,0),xt(this,C,0),be(this,N)&&be(this,D)){const xe=be(this,D);let Pe;for(;Pe=xe==null?void 0:xe.shift();)(me=be(this,b))==null||me.call(this,...Pe)}};let u=lt;return cc.LRUCache=u,cc}var D6;function Zg(){if(D6)return oc;D6=1,Object.defineProperty(oc,"__esModule",{value:!0}),oc.cache=void 0;const e=qH();return oc.cache=new e.LRUCache({max:200,maxSize:500*1024,sizeCalculation:(t,r)=>typeof t=="string"?t.length:new TextEncoder().encode(JSON.stringify(t)).length,ttl:1e3*60*5,allowStale:!1}),oc}var uc={},B6;function oA(){if(B6)return uc;B6=1,Object.defineProperty(uc,"__esModule",{value:!0}),uc.getCID=void 0;const e=He,t=Ze(),r=er(),n=nt(),s=Tt();function i(o,a){return e.__awaiter(this,void 0,void 0,function*(){const{env:f=t.default.ENV.PROD}=a||{},l=`${(0,n.getAPIBaseUrls)(f)}/v1/ipfs/${o}`;try{return(yield(0,s.axiosGet)(l)).data}catch(u){throw(0,r.handleError)(u,i.name)}})}return uc.getCID=i,uc}var O6;function Vf(){return O6||(O6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decryptAndVerifyMessage=e.getDecryptedPrivateKey=e.getEip712Signature=e.getEip191Signature=e.getEncryptedRequestCore=e.getEncryptedRequest=e.decryptFeeds=e.signMessageWithPGPCore=e.signMessageWithPGP=e.encryptAndSignCore=e.encryptAndSign=void 0;const t=He,r=Ff(),n=Da(),s=Yr(),i=Mn(),o=nt(),a=Mn(),f=JE(),c=Ze(),l=sA(),u=Da(),p=KH(),d=al(),h=Zg(),y=oA(),m="eip712v2",v=({plainText:g,keys:A,privateKeyArmored:x,secretKey:D})=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.encryptAndSignCore)({plainText:g,keys:A,privateKeyArmored:x,secretKey:D,pgpHelper:r.PGPHelper})});e.encryptAndSign=v;const b=({plainText:g,keys:A,privateKeyArmored:x,secretKey:D,pgpHelper:O})=>t.__awaiter(void 0,void 0,void 0,function*(){const B=n.aesEncrypt({plainText:g,secretKey:D}),L=yield O.pgpEncrypt({plainText:D,keys:A}),M=yield O.sign({message:B,signingKey:x});return{cipherText:B,encryptedSecret:L,signature:M,sigType:"pgp",encType:"pgp"}});e.encryptAndSignCore=b;const w=({message:g,privateKeyArmored:A})=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.signMessageWithPGPCore)({message:g,privateKeyArmored:A,pgpHelper:r.PGPHelper})});e.signMessageWithPGP=w;const _=({message:g,privateKeyArmored:A,pgpHelper:x})=>t.__awaiter(void 0,void 0,void 0,function*(){return{signature:yield x.sign({message:g,signingKey:A}),sigType:"pgp"}});e.signMessageWithPGPCore=_;const C=({feeds:g,connectedUser:A,pgpPrivateKey:x,env:D=c.default.ENV.PROD,pgpHelper:O})=>t.__awaiter(void 0,void 0,void 0,function*(){const B=L=>t.__awaiter(void 0,void 0,void 0,function*(){if(!x)throw new Error("Decrypted private key is necessary");if(L.msg.encType!=="PlainText"){const M=L.msg.fromCAIP10,R=M===A.wallets.split(",")[0];let N;if(R)N=A.publicKey;else{const F=`pgpPubKey-${M}`;if(h.cache.has(F))N=h.cache.get(F);else{const z=yield(0,a.get)({account:M,env:D});h.cache.set(F,z.publicKey),N=z.publicKey}}L.msg=yield(0,e.decryptAndVerifyMessage)(L.msg,N,x,D,O)}});for(const L of g)yield B(L);return g});e.decryptFeeds=C;const I=(g,A,x,D,O,B,L)=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.getEncryptedRequestCore)(g,A,x,D,O,B,L,r.PGPHelper)});e.getEncryptedRequest=I;const k=(g,A,x,D,O,B,L,M)=>t.__awaiter(void 0,void 0,void 0,function*(){if(D)if(B)if(B.isPublic){const{signature:R}=yield(0,e.signMessageWithPGPCore)({message:x,privateKeyArmored:A.privateKey,pgpHelper:M});return{message:x,encryptionType:"PlainText",aesEncryptedSecret:"",signature:R}}else if(B.sessionKey&&B.encryptedSecret){const R=n.aesEncrypt({plainText:x,secretKey:L}),N=yield M.sign({message:R,signingKey:A.privateKey});return{message:R,encryptionType:"pgpv1:group",aesEncryptedSecret:null,signature:N}}else{const N=(yield(0,d.getGroup)({chatId:B.chatId,env:O})).members.map(j=>j.publicKey),{cipherText:F,encryptedSecret:z,signature:Y}=yield(0,e.encryptAndSignCore)({plainText:x,keys:N,privateKeyArmored:A.privateKey,secretKey:L,pgpHelper:M});return{message:F,encryptionType:"pgp",aesEncryptedSecret:z,signature:Y}}else throw new Error("Unable to find Group Data");else{const R=yield(0,i.get)({account:g,env:O});if(R!=null&&R.publicKey)if(R.publicKey.includes("-----BEGIN PGP PUBLIC KEY BLOCK-----")){const{cipherText:N,encryptedSecret:F,signature:z}=yield(0,e.encryptAndSignCore)({plainText:x,keys:[R.publicKey,A.publicKey],privateKeyArmored:A.privateKey,secretKey:L,pgpHelper:M});return{message:N,encryptionType:"pgp",aesEncryptedSecret:F,signature:z}}else{const{signature:N}=yield(0,e.signMessageWithPGPCore)({message:x,privateKeyArmored:A.privateKey,pgpHelper:M});return{message:x,encryptionType:"PlainText",aesEncryptedSecret:"",signature:N}}else{if(!(0,o.isValidPushCAIP)(g))throw new Error("Invalid receiver address!");yield(0,f.createUserService)({user:g,publicKey:"",encryptedPrivateKey:"",env:O});const{signature:N}=yield(0,e.signMessageWithPGPCore)({message:x,privateKeyArmored:A.privateKey,pgpHelper:M});return{message:x,encryptionType:"PlainText",aesEncryptedSecret:"",signature:N}}}});e.getEncryptedRequestCore=k;const E=(g,A,x="v1")=>t.__awaiter(void 0,void 0,void 0,function*(){if(!(g!=null&&g.signer))return console.warn("This method is deprecated. Provide signer in the function"),{signature:"xyz",sigType:"a"};const D=g==null?void 0:g.signer,B=yield new o.Signer(D).signMessage(A);return{verificationProof:`${x==="v1"?"eip191":"eip191v2"}:${B}`}});e.getEip191Signature=E;const S=(g,A,x)=>t.__awaiter(void 0,void 0,void 0,function*(){if(!(g!=null&&g.signer))return console.warn("This method is deprecated. Provide signer in the function"),{signature:"xyz",sigType:"a"};const D=(0,l.getTypeInformation)(),O=g==null?void 0:g.signer,B=new o.Signer(O);let L;try{L=yield B.getChainId()}catch{L=1}const M=(0,l.getDomainInformation)(L),R=yield B.signTypedData(x?{}:M,D,{data:A},"Data");return{verificationProof:x?`${m}:${R}`:`${m}:${L}:${R}`}});e.getEip712Signature=S;function T(g,A,x,D){return t.__awaiter(this,void 0,void 0,function*(){let O;return g.signer?O=yield(0,o.decryptPGPKey)({signer:g.signer,encryptedPGPPrivateKey:A.encryptedPrivateKey,env:D}):O=yield(0,o.decryptWithWalletRPCMethod)(A.encryptedPrivateKey,x),O})}e.getDecryptedPrivateKey=T;const P=(g,A,x,D,O=r.PGPHelper)=>t.__awaiter(void 0,void 0,void 0,function*(){if(g.verificationProof&&g.verificationProof.split(":")[0]==="pgpv2"){const L={fromDID:g.fromDID,toDID:g.fromDID,fromCAIP10:g.fromCAIP10,toCAIP10:g.toCAIP10,messageObj:g.messageObj,messageType:g.messageType,encType:g.encType,encryptedSecret:g.encryptedSecret},M=s.SHA256(JSON.stringify(L)).toString(),R=g.verificationProof.split(":")[1];yield O.verifySignature({messageContent:M,signatureArmored:R,publicKeyArmored:A})}else if(g.verificationProof&&g.verificationProof.split(":")[0]==="pgpv3"){const L={fromDID:g.fromDID,toDID:g.fromDID,fromCAIP10:g.fromCAIP10,toCAIP10:g.toCAIP10,messageObj:g.messageObj,messageType:g.messageType,encType:g.encType,sessionKey:g.sessionKey,encryptedSecret:g.encryptedSecret},M=s.SHA256(JSON.stringify(L)).toString(),R=g.verificationProof.split(":")[1];yield O.verifySignature({messageContent:M,signatureArmored:R,publicKeyArmored:A})}else if(g.link==null){const L={fromDID:g.fromDID,toDID:g.toDID,messageContent:g.messageContent,messageType:g.messageType},M=s.SHA256(JSON.stringify(L)).toString();try{yield O.verifySignature({messageContent:M,signatureArmored:g.signature,publicKeyArmored:A})}catch{yield O.verifySignature({messageContent:g.messageContent,signatureArmored:g.signature,publicKeyArmored:A})}}else yield O.verifySignature({messageContent:g.messageContent,signatureArmored:g.signature,publicKeyArmored:A});const B=Object.assign({},g);try{let L;if(g.encType==="pgpv1:group"){const M=`sessionKey-${g.sessionKey}`;if(h.cache.has(M))L=h.cache.get(M);else{const R=yield(0,p.getEncryptedSecret)({sessionKey:g.sessionKey,env:D});L=yield O.pgpDecrypt({cipherText:R,toPrivateKeyArmored:x}),h.cache.set(M,L)}}else L=yield O.pgpDecrypt({cipherText:g.encryptedSecret,toPrivateKeyArmored:x});if(B.messageContent=(0,u.aesDecrypt)({cipherText:g.messageContent,secretKey:L}),g.messageObj){const M=(0,u.aesDecrypt)({cipherText:g.messageObj,secretKey:L});try{B.messageObj=JSON.parse(M)}catch{B.messageObj=M}try{if(B.messageObj.reference){const R=B.messageObj.reference;if(R&&R.split(":").length===1){const N=yield(0,y.getCID)(R,{env:D});B.messageObj.reference=N.cid}}}catch{}}}catch{B.messageContent=B.messageObj="Unable to Decrypt Message"}return B});e.decryptAndVerifyMessage=P}(B1)),B1}var fn={},M6;function jH(){if(M6)return fn;M6=1,Object.defineProperty(fn,"__esModule",{value:!0}),fn.addDeprecatedInfoToMessages=fn.addDeprecatedInfo=fn.decryptConversation=fn.getTrendingSpaceInboxLists=fn.getSpaceInboxLists=fn.getInboxLists=void 0;const e=He,t=Ff(),r=Ze(),n=nt(),s=Mn(),i=oA(),o=Vf(),a=Zg(),f=(p,d=t.PGPHelper)=>e.__awaiter(void 0,void 0,void 0,function*(){const{lists:h,user:y,toDecrypt:m,pgpPrivateKey:v,env:b=r.default.ENV.PROD}=p||{};if(m){const w=yield(0,s.get)({account:(0,n.pCAIP10ToWallet)(y),env:b});return(0,o.decryptFeeds)({feeds:h,connectedUser:w,pgpPrivateKey:v,pgpHelper:d,env:b})}return h});fn.getInboxLists=f;const c=p=>e.__awaiter(void 0,void 0,void 0,function*(){const{lists:d,user:h,toDecrypt:y,pgpPrivateKey:m,env:v=r.default.ENV.PROD}=p||{},b=yield(0,s.get)({account:(0,n.pCAIP10ToWallet)(h),env:v}),w=[];for(const _ of d){let C;_.threadhash!==null?C=yield(0,i.getCID)(_.threadhash,{env:v}):C={encType:"PlainText",encryptedSecret:"",fromCAIP10:"",fromDID:"",link:"",messageContent:"",messageType:"",sigType:"",signature:"",toCAIP10:"",toDID:""},w.push(Object.assign(Object.assign({},_),{msg:C,spaceInformation:_.spaceInformation}))}return y?(0,o.decryptFeeds)({feeds:w,connectedUser:b,pgpPrivateKey:m,pgpHelper:t.PGPHelper,env:v}):w});fn.getSpaceInboxLists=c;const l=p=>e.__awaiter(void 0,void 0,void 0,function*(){const{lists:d,env:h=r.default.ENV.PROD}=p||{},y=[];for(const m of d){let v;m.threadhash!==null?v=yield(0,i.getCID)(m.threadhash,{env:h}):v={encType:"PlainText",encryptedSecret:"",fromCAIP10:"",fromDID:"",link:"",messageContent:"",messageType:"",sigType:"",signature:"",toCAIP10:"",toDID:""},y.push(Object.assign(Object.assign({},m),{msg:v,spaceInformation:m.spaceInformation}))}return y});fn.getTrendingSpaceInboxLists=l;const u=p=>e.__awaiter(void 0,void 0,void 0,function*(){const{messages:d,connectedUser:h,pgpPrivateKey:y,pgpHelper:m=t.PGPHelper,env:v=r.default.ENV.PROD}=p||{};let b;for(let w=0;w<d.length;w++){const _=d[w];if(_.encType!=="PlainText"&&(_.messageObj===void 0||typeof _.messageObj=="string")){if(!y)throw Error("Decrypted private key is necessary");if(_.fromCAIP10!==h.wallets.split(",")[0]){const C=`pgpPubKey-${_.fromCAIP10}`;if(a.cache.has(C))b=a.cache.get(C);else{const I=yield(0,s.get)({account:_.fromCAIP10,env:v});a.cache.set(C,I.publicKey),b=I.publicKey}}else b=h.publicKey;d[w]=yield(0,o.decryptAndVerifyMessage)(_,b,y,v,m)}}return d});return fn.decryptConversation=u,fn.addDeprecatedInfo=(()=>{const p={};return d=>(d.forEach(h=>{if((0,n.isValidNFTCAIP)(h.did)){const y=h.did.split(":").slice(0,5).join(":"),m=h.did.split(":")[5];(!p[y]||m>p[y].split(":")[5])&&(p[y]=h.did)}}),d.forEach(h=>{if((0,n.isValidNFTCAIP)(h.did)){const y=h.did.split(":").slice(0,5).join(":");p[y]!==h.did&&(h.deprecated=!0,h.deprecatedCode="NFT Owner Changed")}}),d)})(),fn.addDeprecatedInfoToMessages=(()=>{const p={};return d=>(d.forEach(h=>{if((0,n.isValidNFTCAIP)(h.fromDID)){const y=h.fromDID.split(":").slice(0,5).join(":"),m=h.fromDID.split(":")[5];(!p[y]||m>p[y].split(":")[5])&&(p[y]=h.fromDID)}}),d.forEach(h=>{if((0,n.isValidNFTCAIP)(h.fromDID)){const y=h.fromDID.split(":").slice(0,5).join(":");p[y]!==h.fromDID&&(h.deprecated=!0,h.deprecatedCode="NFT Owner Changed")}}),d)})(),fn}var Kp={},lc={},Fp={},N6;function cA(){return N6||(N6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupMembers=void 0;const t=He,r=Ro(),n=nt(),s=Ze(),i=er(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,page:c=1,limit:l=20,env:u=s.default.ENV.PROD,pending:p,role:d}=a;try{if(!f)throw new Error("Chat ID is required.");let y=`${(0,n.getAPIBaseUrls)(u)}/v1/chat/groups/${f}/members?pageNumber=${c}&pageSize=${l}`;return p!==void 0&&(y+=`&pending=${p}`),d&&(y+=`&role=${encodeURIComponent(d)}`),(yield r.default.get(y)).data.members}catch(h){throw(0,i.handleError)(h,e.getGroupMembers.name)}});e.getGroupMembers=o}(Fp)),Fp}var qp={},U6;function Jg(){return U6||(U6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupMemberCount=void 0;const t=He,r=Ro(),n=nt(),s=Ze(),i=er(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,env:c=s.default.ENV.PROD}=a;try{if(!f)throw new Error("Chat ID is required.");const u=`${(0,n.getAPIBaseUrls)(c)}/v1/chat/groups/${f}/members/count`,p=yield r.default.get(u),{totalMembersCount:d}=p.data;return d}catch(l){throw(0,i.handleError)(l,e.getGroupMemberCount.name)}});e.getGroupMemberCount=o}(qp)),qp}var L6;function $H(){if(L6)return lc;L6=1,Object.defineProperty(lc,"__esModule",{value:!0}),lc.getAllGroupMembers=void 0;const e=He,t=cA(),r=Jg(),n=s=>e.__awaiter(void 0,void 0,void 0,function*(){const{chatId:i,env:o}=s,f=(yield(0,r.getGroupMemberCount)({chatId:i,env:o})).overallCount,c=5e3,l=Math.ceil(f/c),u=Array.from({length:l},(y,m)=>m+1),p=[],d=u.map(y=>(0,t.getGroupMembers)({chatId:i,env:o,page:y,limit:c}));return(yield Promise.all(d)).forEach(y=>{y.length>0&&p.push(...y)}),p});return lc.getAllGroupMembers=n,lc}var jp={},K6;function ol(){return K6||(K6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SpaceListType=e.ChatListType=void 0,function(t){t.CHATS="CHATS",t.REQUESTS="REQUESTS"}(e.ChatListType||(e.ChatListType={})),function(t){t.SPACES="SPACES",t.REQUESTS="REQUESTS"}(e.SpaceListType||(e.SpaceListType={}))}(jp)),jp}var F6;function uA(){return F6||(F6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSpacesMembersList=e.getMembersList=e.convertToWalletAddressList=e.getSpaceAdminsList=e.getAdminsList=e.updateGroupPayload=e.groupAccessToSpaceAccess=e.convertRulesToSpaceRules=e.convertSpaceRulesToRules=e.mapSpaceListTypeToChatListType=e.spaceDtoToSpaceInfoDto=e.groupInfoDtoToSpaceInfoDto=e.groupDtoToSpaceDtoV2=e.groupDtoToSpaceDto=e.createGroupPayload=e.rejectRequestPayload=e.sendMessagePayloadCore=e.sendMessagePayload=void 0;const t=He,r=nt(),n=Vf(),s=Ze(),i=Ff(),o=Da(),a=Yr(),f=$H(),c=ol(),l=(g,A,x,D,O,B,L)=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.sendMessagePayloadCore)(g,A,x,D,O,B,L,i.PGPHelper)});e.sendMessagePayload=l;const u=(g,A,x,D,O,B,L,M)=>t.__awaiter(void 0,void 0,void 0,function*(){const R=B!==null;let N;R&&(B!=null&&B.encryptedSecret)&&B.sessionKey?N=yield(0,i.pgpDecrypt)({cipherText:B.encryptedSecret,toPrivateKeyArmored:A.privateKey}):N=o.generateRandomSecret(15);const{message:F,signature:z}=yield(0,n.getEncryptedRequestCore)(g,A,D,R,L,B,N,M),{message:Y,encryptionType:j,aesEncryptedSecret:re}=yield(0,n.getEncryptedRequestCore)(g,A,JSON.stringify(x),R,L,B,N,M),V={fromDID:(0,r.walletToPCAIP10)(A.wallets.split(",")[0]),toDID:R?g:(0,r.walletToPCAIP10)(g),fromCAIP10:(0,r.walletToPCAIP10)(A.wallets.split(",")[0]),toCAIP10:R?g:(0,r.walletToPCAIP10)(g),messageType:O,messageObj:j==="PlainText"?x:Y,encType:j,sessionKey:B&&!B.isPublic&&j==="pgpv1:group"?B.sessionKey:null,encryptedSecret:re,messageContent:F,signature:z,sigType:"pgpv3"},U={fromDID:V.fromDID,toDID:V.fromDID,fromCAIP10:V.fromCAIP10,toCAIP10:V.toCAIP10,messageObj:V.messageObj,messageType:V.messageType,encType:V.encType,sessionKey:V.sessionKey,encryptedSecret:V.encryptedSecret},X=a.SHA256(JSON.stringify(U)).toString(),ye=yield M.sign({message:X,signingKey:A.privateKey});return V.verificationProof=`pgpv3:${ye}`,V});e.sendMessagePayloadCore=u;const p=(g,A,x,D)=>({fromDID:g,toDID:A,verificationProof:x+":"+D});e.rejectRequestPayload=p;const d=(g,A,x,D,O,B,L,M,R,N,F,z,Y,j,re,V,U)=>({groupName:g,groupDescription:L,members:A,groupImage:M,admins:x,isPublic:D,contractAddressNFT:R,numberOfNFTs:N,contractAddressERC20:F,numberOfERC20:z,groupCreator:O,verificationProof:B,meta:Y,groupType:j,scheduleAt:re,scheduleEnd:V,rules:U});e.createGroupPayload=d;const h=g=>{var A;const x={members:g.members.map(D=>({wallet:D.wallet,publicKey:D.publicKey,isSpeaker:D.isAdmin,image:D.image})),pendingMembers:g.pendingMembers.map(D=>({wallet:D.wallet,publicKey:D.publicKey,isSpeaker:D.isAdmin,image:D.image})),contractAddressERC20:g.contractAddressERC20,numberOfERC20:g.numberOfERC20,contractAddressNFT:g.contractAddressNFT,numberOfNFTTokens:g.numberOfNFTTokens,verificationProof:g.verificationProof,spaceImage:g.groupImage,spaceName:g.groupName,isPublic:g.isPublic,spaceDescription:g.groupDescription,spaceCreator:g.groupCreator,spaceId:g.chatId,scheduleAt:g.scheduleAt,scheduleEnd:g.scheduleEnd,status:(A=g.status)!==null&&A!==void 0?A:null,meta:g.meta};return g.rules&&(x.rules={entry:g.rules.entry}),x};e.groupDtoToSpaceDto=h;const y=(g,A=s.ENV.PROD)=>t.__awaiter(void 0,void 0,void 0,function*(){var x;const D=yield(0,f.getAllGroupMembers)({chatId:g.chatId,env:A}),O={members:D.filter(B=>B.intent).map(B=>{var L,M;return{wallet:B.address,publicKey:(L=B.userInfo.publicKey)!==null&&L!==void 0?L:"",isSpeaker:B.role==="admin",image:(M=B.userInfo.profile.picture)!==null&&M!==void 0?M:""}}),pendingMembers:D.filter(B=>!B.intent).map(B=>{var L,M;return{wallet:B.address,publicKey:(L=B.userInfo.publicKey)!==null&&L!==void 0?L:"",isSpeaker:B.role==="admin",image:(M=B.userInfo.profile.picture)!==null&&M!==void 0?M:""}}),contractAddressERC20:null,numberOfERC20:0,contractAddressNFT:null,numberOfNFTTokens:0,verificationProof:"a",spaceImage:g.groupImage,spaceName:g.groupName,isPublic:g.isPublic,spaceDescription:g.groupDescription,spaceCreator:g.groupCreator,spaceId:g.chatId,scheduleAt:g.scheduleAt,scheduleEnd:g.scheduleEnd,status:(x=g.status)!==null&&x!==void 0?x:null,meta:g.meta};return g.rules&&(O.rules={entry:g.rules.entry}),O});e.groupDtoToSpaceDtoV2=y;const m=g=>{var A,x,D,O,B;return{spaceName:g.groupName,spaceImage:g.groupImage,spaceDescription:g.groupDescription,isPublic:g.isPublic,spaceCreator:g.groupCreator,spaceId:g.chatId,scheduleAt:g.scheduleAt,scheduleEnd:g.scheduleEnd,status:(A=g.status)!==null&&A!==void 0?A:null,rules:(x=g.rules)!==null&&x!==void 0?x:null,meta:(D=g.meta)!==null&&D!==void 0?D:null,sessionKey:(O=g.sessionKey)!==null&&O!==void 0?O:null,encryptedSecret:(B=g.encryptedSecret)!==null&&B!==void 0?B:null}};e.groupInfoDtoToSpaceInfoDto=m;const v=g=>({spaceName:g.spaceName,spaceImage:g.spaceImage,spaceDescription:g.spaceDescription,isPublic:g.isPublic,spaceCreator:g.spaceCreator,spaceId:g.spaceId,scheduleAt:g.scheduleAt,scheduleEnd:g.scheduleEnd,status:g.status,rules:g.rules,meta:g.meta,sessionKey:null,encryptedSecret:null,inviteeDetails:g.inviteeDetails});e.spaceDtoToSpaceInfoDto=v;const b=g=>{switch(g){case c.SpaceListType.SPACES:return c.ChatListType.CHATS;case c.SpaceListType.REQUESTS:return c.ChatListType.REQUESTS;default:throw new Error(`Unsupported SpaceListType: ${g}`)}};e.mapSpaceListTypeToChatListType=b;const w=g=>({entry:g.entry,chat:void 0});e.convertSpaceRulesToRules=w;const _=g=>({entry:g.entry});e.convertRulesToSpaceRules=_;const C=g=>{const A={entry:g.entry};return g.rules&&(A.rules=(0,e.convertRulesToSpaceRules)(g.rules)),A};e.groupAccessToSpaceAccess=C;const I=(g,A,x,D,O,B,L,M,R,N,F,z,Y)=>Object.assign(Object.assign({groupName:g,groupImage:M,groupDescription:L,members:A,admins:x,address:D,verificationProof:O,encryptedSecret:B,scheduleAt:R,scheduleEnd:N,status:F},z!==void 0&&{meta:z}),Y!==void 0&&{rules:Y});e.updateGroupPayload=I;const k=(g,A)=>{const x=g?(0,e.convertToWalletAddressList)(g.filter(B=>B.isAdmin)):[],D=A?(0,e.convertToWalletAddressList)(A.filter(B=>B.isAdmin)):[];return[...x,...D]};e.getAdminsList=k;const E=(g,A)=>{const x=g?(0,e.convertToWalletAddressList)(g.filter(B=>B.isSpeaker)):[],D=A?(0,e.convertToWalletAddressList)(A.filter(B=>B.isSpeaker)):[];return[...x,...D]};e.getSpaceAdminsList=E;const S=g=>g?g.map(A=>A.wallet):[];e.convertToWalletAddressList=S;const T=(g,A)=>{const x=[...g||[],...A||[]];return(0,e.convertToWalletAddressList)(x)};e.getMembersList=T;const P=(g,A)=>{const x=[...g||[],...A||[]];return(0,e.convertToWalletAddressList)(x)};e.getSpacesMembersList=P}(Kp)),Kp}var Tn={},q6;function HH(){if(q6)return Tn;q6=1,Object.defineProperty(Tn,"__esModule",{value:!0}),Tn.validateGroupMemberUpdateOptions=Tn.updateGroupRequestValidator=Tn.validateScheduleDates=Tn.createSpaceRequestValidator=Tn.createGroupRequestValidator=void 0;const e=nt(),t=(o,a,f,c,l,u,p,d)=>{if(o==null||o.length==0)throw new Error("groupName cannot be null or empty");if(o.length>50)throw new Error("groupName cannot be more than 50 characters");if(c&&c.length>150)throw new Error("groupDescription cannot be more than 150 characters");if(a==null)throw new Error("members cannot be null");for(let h=0;h<a.length;h++)if(a[h]&&!(0,e.isValidPushCAIP)(a[h]))throw new Error("Invalid member address!");if(f==null)throw new Error("admins cannot be null");for(let h=0;h<f.length;h++)if(!(0,e.isValidPushCAIP)(f[h]))throw new Error("Invalid admin address!");if(l!=null&&(l==null?void 0:l.length)>0&&!(0,e.isValidFullCAIP10)(l))throw new Error("Invalid contractAddressNFT address!");if(u!=null&&u<0)throw new Error("numberOfNFTs cannot be negative number");if(p!=null&&(p==null?void 0:p.length)>0&&!(0,e.isValidFullCAIP10)(p))throw new Error("Invalid contractAddressERC20 address!");if(d!=null&&d<0)throw new Error("numberOfERC20 cannot be negative number")};Tn.createGroupRequestValidator=t;const r=(o,a,f,c,l,u,p,d)=>{if(o==null||o.length==0)throw new Error("spaceName cannot be null or empty");if(o.length>50)throw new Error("groupName cannot be more than 50 characters");if(a&&a.length>150)throw new Error("spaceDescription cannot be more than 150 characters");if(f==null)throw new Error("members cannot be null");for(let h=0;h<f.length;h++)if(f[h]&&!(0,e.isValidPushCAIP)(f[h]))throw new Error("Invalid member address!");if(c==null)throw new Error("admins cannot be null");for(let h=0;h<c.length;h++)if(!(0,e.isValidPushCAIP)(c[h]))throw new Error("Invalid admin address!");if(l!=null&&(l==null?void 0:l.length)>0&&!(0,e.isValidFullCAIP10)(l))throw new Error("Invalid contractAddressNFT address!");if(u!=null&&u<0)throw new Error("numberOfNFTs cannot be negative number");if(p!=null&&(p==null?void 0:p.length)>0&&!(0,e.isValidFullCAIP10)(p))throw new Error("Invalid contractAddressERC20 address!");if(d!=null&&d<0)throw new Error("numberOfERC20 cannot be negative number")};Tn.createSpaceRequestValidator=r;const n=(o,a)=>{if(o){const f=new Date(o),c=new Date;if(f<c)throw new Error("Schedule start time must be in the future.");if(a){const l=new Date(a);if(l<c)throw new Error("Schedule end time must be in the future.");if(f>=l)throw new Error("Schedule start time must be earlier than end time.")}}};Tn.validateScheduleDates=n;const s=(o,a,f,c,l,u)=>{if(o==null||o.length==0)throw new Error("chatId cannot be null or empty");if(a==null||a.length==0)throw new Error("groupName cannot be null or empty");if(a!=null&&a.length>50)throw new Error("groupName cannot be more than 50 characters");if(u&&u!=null&&u.length>150)throw new Error("groupDescription cannot be more than 150 characters");if(f!=null&&f.length>0){for(let p=0;p<f.length;p++)if(!(0,e.isValidPushCAIP)(f[p]))throw new Error("Invalid member address in members list!")}if(c!=null&&c.length>0){for(let p=0;p<c.length;p++)if(!(0,e.isValidPushCAIP)(c[p]))throw new Error("Invalid member address in admins list!")}if(l!=null&&!(0,e.isValidPushCAIP)(l))throw new Error("Invalid address field!")};Tn.updateGroupRequestValidator=s;const i=o=>{const{chatId:a,upsert:f,remove:c}=o;if(!a||a.trim().length===0)throw new Error("Chat ID cannot be null or empty.");const l=["members","admins"];if(Object.keys(f).forEach(u=>{if(!l.includes(u))throw new Error(`Invalid role: ${u}. Allowed roles are ${l.join(", ")}.`);if(f[u]&&f[u].length>1e3)throw new Error(`${u} array cannot have more than 1000 addresses.`);f[u].forEach(p=>{if(!(0,e.isValidPushCAIP)(p))throw new Error(`Invalid address found in ${u} list.`)})}),c&&c.length>1e3)throw new Error("Remove array cannot have more than 1000 addresses.");c.forEach(u=>{if(!(0,e.isValidPushCAIP)(u))throw new Error("Invalid address found in remove list.")})};return Tn.validateGroupMemberUpdateOptions=i,Tn}var dc={},j6;function VH(){if(j6)return dc;j6=1,Object.defineProperty(dc,"__esModule",{value:!0}),dc.getGroup=void 0;const e=He,t=nt(),r=Ze(),n=Tt(),s=(i,o)=>e.__awaiter(void 0,void 0,void 0,function*(){const{env:a=r.default.ENV.PROD}=i||{},c=`${(0,t.getAPIBaseUrls)(a)}/v1/chat/groups/${o}`;return(0,n.axiosGet)(c).then(l=>l.data).catch(l=>{throw console.error(`[Push SDK] - API ${c}: `,l),Error(`[Push SDK] - API ${c}: ${l}`)})});return dc.getGroup=s,dc}var $6;function Dt(){return $6||($6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=He;t.__exportStar(Da(),e),t.__exportStar(Ff(),e),t.__exportStar(U$(),e),t.__exportStar(Vf(),e),t.__exportStar(JE(),e),t.__exportStar(jH(),e),t.__exportStar(uA(),e),t.__exportStar(HH(),e),t.__exportStar(VH(),e),t.__exportStar(jE(),e)}(hh)),hh}var Hl={},H6;function Ha(){if(H6)return Hl;H6=1,Object.defineProperty(Hl,"__esModule",{value:!0});const e={"PUSH-CREATE-01":{progressId:"PUSH-CREATE-01",progressTitle:"Generating Secure Profile Signature",progressInfo:"This step is only done for first time users and might take a few seconds. PGP keys are getting generated to provide you with secure yet seamless web3 communication",level:"INFO"},"PUSH-CREATE-02":{progressId:"PUSH-CREATE-02",progressTitle:"Signing Generated Profile",progressInfo:"This step is only done for first time users. Please sign the message to continue.",level:"INFO"},"PUSH-CREATE-03":{progressId:"PUSH-CREATE-03",progressTitle:"Encrypting Generated Profile",progressInfo:"Encrypting your keys. Please sign the message to continue.",level:"INFO"},"PUSH-CREATE-04":{progressId:"PUSH-CREATE-04",progressTitle:"Syncing Generated Profile",progressInfo:"Please sign the message to continue. Great job! You are almost fully onboarded to Push Protocol!",level:"INFO"},"PUSH-CREATE-05":{progressId:"PUSH-CREATE-05",progressTitle:"Setup Complete",progressInfo:"",level:"SUCCESS"},"PUSH-UPGRADE-01":{progressId:"PUSH-UPGRADE-01",progressTitle:"Generating New Profile Signature",progressInfo:"Trying to Upgrade Push Keys to latest version. Please sign the message to continue.",level:"INFO"},"PUSH-UPGRADE-02":{progressId:"PUSH-UPGRADE-02",progressTitle:"Decrypting Old Profile",progressInfo:"Trying to Upgrade Push Keys to latest version. Please sign the message to continue.",level:"INFO"},"PUSH-UPGRADE-03":{progressId:"PUSH-UPGRADE-03",progressTitle:"Generating Encrypted New Profile",progressInfo:"Trying to Upgrade Push Keys to latest version. Encrypting Push Keys with latest version. Please sign the message to continue.",level:"INFO"},"PUSH-UPGRADE-04":{progressId:"PUSH-UPGRADE-04",progressTitle:"Syncing New Profile",progressInfo:"Please sign the message to continue. Upgraded keys are almost ready!",level:"INFO"},"PUSH-UPGRADE-05":{progressId:"PUSH-UPGRADE-05",progressTitle:"Upgrade Completed, Welcome to Push Protocol",progressInfo:"",level:"SUCCESS"},"PUSH-DECRYPT-01":{progressId:"PUSH-DECRYPT-01",progressTitle:"Decrypting Profile",progressInfo:"Please sign the transaction to decrypt profile",level:"INFO"},"PUSH-DECRYPT-02":{progressId:"PUSH-DECRYPT-02",progressTitle:"Push Profile Unlocked",progressInfo:"Unlocking push profile",level:"SUCCESS"},"PUSH-AUTH-UPDATE-01":t=>({progressId:"PUSH-AUTH-UPDATE-01",progressTitle:"Generating New Profile Signature",progressInfo:`Trying to Update Push Keys to ${t} version. Please sign the message to continue.`,level:"INFO"}),"PUSH-AUTH-UPDATE-02":t=>({progressId:"PUSH-AUTH-UPDATE-02",progressTitle:"Generating New Encrypted Profile",progressInfo:`Encrypting Push Keys with ${t} version. Please sign the message to continue.`,level:"INFO"}),"PUSH-AUTH-UPDATE-03":{progressId:"PUSH-AUTH-UPDATE-03",progressTitle:"Syncing Updated Profile",progressInfo:"Please sign the message to continue. Updated keys are almost ready!",level:"INFO"},"PUSH-AUTH-UPDATE-04":{progressId:"PUSH-AUTH-UPDATE-04",progressTitle:"Update Completed, Welcome to Push Protocol",progressInfo:"",level:"SUCCESS"},"PUSH-AUTH-UPDATE-05":{progressId:"PUSH-AUTH-UPDATE-05",progressTitle:"Generating New Profile Signature",progressInfo:"Trying to Update Push Profile creds. Please sign the message to continue.",level:"INFO"},"PUSH-AUTH-UPDATE-06":{progressId:"PUSH-AUTH-UPDATE-06",progressTitle:"Generating New Profile Signature",progressInfo:"Encrypting Push Keys with new creds. Please sign the message to continue.",level:"INFO"},"PUSH-DECRYPT-AUTH-01":{progressId:"PUSH-DECRYPT-AUTH-01",progressTitle:"Decrypting Profile Creds",progressInfo:"Please sign the transaction to decrypt profile creds.",level:"INFO"},"PUSH-DECRYPT-AUTH-02":{progressId:"PUSH-DECRYPT-AUTH-02",progressTitle:"Push Profile Creds Unlocked",progressInfo:"Unlocking push profile creds.",level:"SUCCESS"},"PUSH-PROFILE-UPDATE-01":{progressId:"PUSH-PROFILE-UPDATE-01",progressTitle:"Syncing Updated Profile",progressInfo:"Steady lads, your profile is getting a new look!",level:"INFO"},"PUSH-PROFILE-UPDATE-02":{progressId:"PUSH-PROFILE-UPDATE-02",progressTitle:"Profile Update Completed, Welcome to Push Protocol",progressInfo:"",level:"SUCCESS"},"PUSH-CHANNEL-CREATE-01":{progressId:"PUSH-CHANNEL-CREATE-01",progressTitle:"Uploading data to IPFS",progressInfo:"The channel’s data is getting uploaded to IPFS",level:"INFO"},"PUSH-CHANNEL-CREATE-02":{progressId:"PUSH-CHANNEL-CREATE-02",progressTitle:"Approving PUSH tokens",progressInfo:"Gives approval to Push Core contract to spend 50 PUSH",level:"INFO"},"PUSH-CHANNEL-CREATE-03":{progressId:"PUSH-CHANNEL-CREATE-03",progressTitle:"Channel is getting created",progressInfo:"Calls Push Core contract to create your channel",level:"INFO"},"PUSH-CHANNEL-CREATE-04":{progressId:"PUSH-CHANNEL-CREATE-04",progressTitle:"Channel creation is done, Welcome to Push Ecosystem",progressInfo:"Channel creation is completed",level:"SUCCESS"},"PUSH-CHANNEL-UPDATE-01":{progressId:"PUSH-CHANNEL-UPDATE-01",progressTitle:"Uploading new data to IPFS",progressInfo:"The channel’s new data is getting uploaded to IPFS",level:"INFO"},"PUSH-CHANNEL-UPDATE-02":{progressId:"PUSH-CHANNEL-UPDATE-02",progressTitle:"Approving PUSH tokens",progressInfo:"Gives approval to Push Core contract to spend 50 PUSH",level:"INFO"},"PUSH-CHANNEL-UPDATE-03":{progressId:"PUSH-CHANNEL-UPDATE-03",progressTitle:"Channel is getting updated",progressInfo:"Calls Push Core contract to update your channel details",level:"INFO"},"PUSH-CHANNEL-UPDATE-04":{progressId:"PUSH-CHANNEL-UPDATE-04",progressTitle:"Channel is updated with new data",progressInfo:"Channel is successfully updated",level:"SUCCESS"},"PUSH-ERROR-00":(t,r)=>({progressId:"PUSH-ERROR-00",progressTitle:"Non Specific Error",progressInfo:`[Push SDK] - API - Error - API ${t}() -: ${r}`,level:"ERROR"}),"PUSH-ERROR-01":t=>({progressId:"PUSH-ERROR-01",progressTitle:"Upgrade Profile Failed",progressInfo:`[Push SDK] - API - Error - API decryptPgpKey() -: ${t}`,level:"WARN"}),"PUSH-ERROR-02":(t,r)=>({progressId:"PUSH-ERROR-02",progressTitle:"Transaction failed",progressInfo:`[Push SDK] - Contract - Error - ${t} -: ${r}`,level:"ERROR"})};return Hl.default=e,Hl}var fc={},V6;function Gf(){if(V6)return fc;V6=1,Object.defineProperty(fc,"__esModule",{value:!0}),fc.get=void 0;const e=He,t=zf(),r=nt(),n=Ze(),s=qf(),i=Tt(),o=a=>e.__awaiter(void 0,void 0,void 0,function*(){const{account:f,env:c=n.default.ENV.PROD}=a||{};if(!(0,t.isValidPushCAIP)(f))throw new Error("Invalid address!");const l=(0,t.walletToPCAIP10)(f),p=`${(0,r.getAPIBaseUrls)(c)}/v2/users/?caip10=${l}`;return(0,i.axiosGet)(p).then(d=>e.__awaiter(void 0,void 0,void 0,function*(){return d.data&&(d.data.publicKey=yield(0,r.verifyProfileKeys)(d.data.encryptedPrivateKey,d.data.publicKey,d.data.did,d.data.wallets,d.data.verificationProof)),(0,s.populateDeprecatedUser)(d.data)})).catch(d=>{throw console.error(`[Push SDK] - API ${p}: `,d),Error(`[Push SDK] - API ${p}: ${d}`)})});return fc.get=o,fc}var G6;function lA(){return G6||(G6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.authUpdate=void 0;const t=He,r=Dt(),n=Ze(),s=nt(),i=Ha(),o=Gf();var a;(function(c){c["x25519-xsalsa20-poly1305"]="PGP_V1",c.aes256GcmHkdfSha256="PGP_V2",c["eip191-aes256-gcm-hkdf-sha256"]="PGP_V3",c["pgpv1:nft"]="NFTPGP_V1",c["pgpv1:scw"]="SCWPGP_V1"})(a||(a={}));const f=c=>t.__awaiter(void 0,void 0,void 0,function*(){var l,u;const{pgpPrivateKey:p,pgpEncryptionVersion:d,signer:h,pgpPublicKey:y,account:m=null,env:v=n.default.ENV.PROD,additionalMeta:b,progressHook:w}=c||{};try{const _=(0,r.getWallet)({account:m,signer:h}),C=yield(0,r.getAccountAddress)(_),I=d===n.default.ENCRYPTION_TYPE.NFTPGP_V1||d===n.default.ENCRYPTION_TYPE.SCWPGP_V1;if(!(0,s.isValidPushCAIP)(C))throw new Error("Invalid address!");const k=(0,s.walletToPCAIP10)(C),E=yield(0,o.get)({account:k,env:v});if(!E||!E.encryptedPrivateKey)throw new Error("User not Found!");I?w==null||w(i.default["PUSH-AUTH-UPDATE-05"]):w==null||w(i.default["PUSH-AUTH-UPDATE-01"](a[d]));const S=yield(0,s.preparePGPPublicKey)(d,y,_);I?w==null||w(i.default["PUSH-AUTH-UPDATE-06"]):w==null||w(i.default["PUSH-AUTH-UPDATE-02"](a[d]));const T=yield(0,s.encryptPGPKey)(d,p,_,b);if(d===n.ENCRYPTION_TYPE.NFTPGP_V1){const A=yield(0,s.encryptPGPKey)(n.ENCRYPTION_TYPE.PGP_V3,(l=b==null?void 0:b.NFTPGP_V1)===null||l===void 0?void 0:l.password,_,b);T.encryptedPassword=A}else if(d===n.ENCRYPTION_TYPE.SCWPGP_V1){const A=yield(0,s.encryptPGPKey)(n.ENCRYPTION_TYPE.PGP_V3,(u=b==null?void 0:b.SCWPGP_V1)===null||u===void 0?void 0:u.password,_,b);T.encryptedPassword=A}w==null||w(i.default["PUSH-AUTH-UPDATE-03"]);const P={user:E.did,wallet:_,publicKey:S,encryptedPrivateKey:JSON.stringify(T),env:v},g=yield(0,r.authUpdateUserService)(P);return w==null||w(i.default["PUSH-AUTH-UPDATE-04"]),g}catch(_){const C=i.default["PUSH-ERROR-00"];throw w==null||w(C(e.authUpdate.name,_)),Error(`[Push SDK] - API - Error - API ${e.authUpdate.name} -: ${_}`)}});e.authUpdate=f}(fh)),fh}var $p={},z6;function dA(){return z6||(z6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.profileUpdateCore=e.profileUpdate=void 0;const t=He,r=Yr(),n=Dt(),s=Ze(),i=nt(),o=Gf(),a=qf(),f=Ha(),c=Tt(),l=p=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,e.profileUpdateCore)(p,n.PGPHelper)});e.profileUpdate=l;const u=(p,d)=>t.__awaiter(void 0,void 0,void 0,function*(){const{pgpPrivateKey:h,account:y,profile:m,env:v=s.default.ENV.PROD,progressHook:b}=p||{};try{if(!(0,i.isValidPushCAIP)(y))throw new Error("Invalid account!");const w=yield(0,o.get)({account:y,env:v});if(!w||!w.did)throw new Error("User not Found!");let _=null;if(m.blockedUsersList){for(const D of m.blockedUsersList)if(!(0,i.isValidPushCAIP)(D))throw new Error("Invalid address in the blockedUsersList: "+D);const x=m.blockedUsersList.map(D=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,i.convertToValidDID)(D,v)}));_=yield Promise.all(x),_=Array.from(new Set(_))}const C={name:m.name?m.name:w.profile.name,desc:m.desc?m.desc:w.profile.desc,picture:m.picture?m.picture:w.profile.picture,blockedUsersList:m.blockedUsersList?_:[]},I=r.SHA256(JSON.stringify(C)).toString(),S=`pgpv2:${yield d.sign({message:I,signingKey:h})}`,T=Object.assign(Object.assign({},C),{verificationProof:S}),g=`${(0,i.getAPIBaseUrls)(v)}/v2/users/${w.did}/profile`;b==null||b(f.default["PUSH-PROFILE-UPDATE-01"]);const A=yield(0,c.axiosPut)(g,T);return A.data&&(A.data.publicKey=yield(0,i.verifyProfileKeys)(A.data.encryptedPrivateKey,A.data.publicKey,A.data.did,A.data.wallets,A.data.verificationProof)),b==null||b(f.default["PUSH-PROFILE-UPDATE-02"]),(0,a.populateDeprecatedUser)(A.data)}catch(w){const _=f.default["PUSH-ERROR-00"];throw b==null||b(_(e.profileUpdate.name,w)),Error(`[Push SDK] - API - Error - API ${e.profileUpdate.name} -: ${w}`)}});e.profileUpdateCore=u}($p)),$p}var Hp={},W6;function fA(){return W6||(W6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createUserCore=e.create=void 0;const t=He,r=Dt(),n=Ze(),s=nt(),i=Ha(),o=f=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.createUserCore)(f,r.PGPHelper)});e.create=o;const a=(f,c)=>t.__awaiter(void 0,void 0,void 0,function*(){var l,u,p,d;const h="$0Pc",{env:y=n.default.ENV.PROD,account:m=null,signer:v=null,version:b=n.default.ENC_TYPE_V3,additionalMeta:w={NFTPGP_V1:{password:h+(0,r.generateRandomSecret)(10)},SCWPGP_V1:{password:h+(0,r.generateRandomSecret)(10)}},progressHook:_,origin:C}=f||{};try{if(m==null&&v==null)throw new Error("At least one from account or signer is necessary!");const I=(0,r.getWallet)({account:m,signer:v}),k=yield(0,r.getAccountAddress)(I);if(!(0,s.isValidPushCAIP)(k))throw new Error("Invalid address!");!((l=w==null?void 0:w.NFTPGP_V1)===null||l===void 0)&&l.password&&(0,s.validatePssword)(w.NFTPGP_V1.password),!((u=w==null?void 0:w.SCWPGP_V1)===null||u===void 0)&&u.password&&(0,s.validatePssword)(w.SCWPGP_V1.password);const E=(0,s.walletToPCAIP10)(k);let S=b;(0,s.isValidNFTCAIP)(E)?S=n.default.ENC_TYPE_V4:(0,s.isValidSCWCAIP)(E)?S=n.default.ENC_TYPE_V5:v||(S=n.default.ENC_TYPE_V1),_==null||_(i.default["PUSH-CREATE-01"]);const T=yield c.generateKeyPair();_==null||_(i.default["PUSH-CREATE-02"]);const P=yield(0,s.preparePGPPublicKey)(S,T.publicKeyArmored,I);_==null||_(i.default["PUSH-CREATE-03"]);const g=yield(0,s.encryptPGPKey)(S,T.privateKeyArmored,I,w);if(S===n.default.ENC_TYPE_V4||S===n.default.ENC_TYPE_V5){const D=((p=w.NFTPGP_V1)===null||p===void 0?void 0:p.password)||((d=w.SCWPGP_V1)===null||d===void 0?void 0:d.password),O=yield(0,s.encryptPGPKey)(n.default.ENC_TYPE_V3,D,I,w);g.encryptedPassword=O}_==null||_(i.default["PUSH-CREATE-04"]);const A={user:E,wallet:I,publicKey:P,encryptedPrivateKey:JSON.stringify(g),env:y,origin:C},x=yield(0,r.createUserService)(A);return _==null||_(i.default["PUSH-CREATE-05"]),x.decryptedPrivateKey=T.privateKeyArmored,x}catch(I){const k=i.default["PUSH-ERROR-00"];throw _==null||_(k(e.create.name,I)),Error(`[Push SDK] - API - Error - API ${e.create.name} -: ${I}`)}});e.createUserCore=a}(Hp)),Hp}var hc={},Vp={},pc={},Y6;function GH(){if(Y6)return pc;Y6=1,Object.defineProperty(pc,"__esModule",{value:!0}),pc.parseApiResponse=void 0;function e(t){return t.map(r=>{const{payload:{data:{acta:n="",amsg:s="",asub:i="",icon:o="",url:a="",sid:f="",app:c="",aimg:l="",secret:u=""},notification:p},source:d}=r;return{cta:n,title:i||"",message:s||p.body||"",icon:o,url:a,sid:f,app:c,image:l,blockchain:d,notification:p,secret:u}})}return pc.parseApiResponse=e,pc}var Z6;function Xg(){return Z6||(Z6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),He.__exportStar(GH(),e)}(Vp)),Vp}var J6;function zH(){if(J6)return hc;J6=1,Object.defineProperty(hc,"__esModule",{value:!0}),hc.getFeeds=void 0;const e=He,t=nt(),r=Ze(),n=Xg(),s=Tt(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{user:a,env:f=r.default.ENV.PROD,page:c=r.default.PAGINATION.INITIAL_PAGE,limit:l=r.default.PAGINATION.LIMIT,spam:u=!1,raw:p=!1}=o||{},d=yield(0,t.getCAIPAddress)(f,a,"User"),y=`${(0,t.getAPIBaseUrls)(f)}/v1/users/${d}/feeds`,m={page:c,limit:(0,t.getLimit)(l),spam:u},v=`${y}?${(0,t.getQueryParams)(m)}`;return(0,s.axiosGet)(v).then(b=>{var w,_;return p?((w=b==null?void 0:b.data)===null||w===void 0?void 0:w.feeds)||[]:(0,n.parseApiResponse)((_=b==null?void 0:b.data)===null||_===void 0?void 0:_.feeds)||[]}).catch(b=>{console.error(`[Push SDK] - API ${v}: `,b)})});return hc.getFeeds=i,hc}var yc={},gc={},mc={},X6;function Qg(){if(X6)return mc;X6=1,Object.defineProperty(mc,"__esModule",{value:!0}),mc.parseSettings=void 0;const e=t=>{var r,n;let s;try{s=JSON.parse(t)}catch{s=t}const i=[];for(let o=0;o<s.length;o++){const a=s[o];a.type==1?i.push(Object.assign({type:a.type,description:a.description},a.user?{userPreferance:{value:a.user,enabled:a.user}}:{default:a.default})):a.type==2?i.push(Object.assign({type:a.type,description:a.description,data:{upper:a.upperLimit,lower:a.lowerLimit,ticker:(r=a.ticker)!==null&&r!==void 0?r:1}},a.user?{userPreferance:{value:a.user,enabled:a.enabled}}:{default:a.default})):a.type==3&&i.push(Object.assign({type:a.type,description:a.description,data:{upper:a.upperLimit,lower:a.lowerLimit,ticker:(n=a.ticker)!==null&&n!==void 0?n:1}},a.user?{userPreferance:{value:a.user,enabled:a.enabled}}:{default:a.default}))}return i};return mc.parseSettings=e,mc}var Q6;function WH(){if(Q6)return gc;Q6=1,Object.defineProperty(gc,"__esModule",{value:!0}),gc.parseSubscriptionsApiResponse=void 0;const e=Qg();function t(r){return r.map(n=>({channel:n.channel,user_settings:n.user_settings?(0,e.parseSettings)(n.user_settings):null}))}return gc.parseSubscriptionsApiResponse=t,gc}var e4;function YH(){if(e4)return yc;e4=1,Object.defineProperty(yc,"__esModule",{value:!0}),yc.getSubscriptions=void 0;const e=He,t=nt(),r=Ze(),n=Tt(),s=WH(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{user:a,env:f=r.default.ENV.PROD,channel:c=null,raw:l=!0}=o||{},u=yield(0,t.getCAIPAddress)(f,a,"User"),d=`${(0,t.getAPIBaseUrls)(f)}/v1/users/${u}/subscriptions`,h=c?(0,t.getQueryParams)({channel:c}):"",y=`${d}?${h}`;return(0,n.axiosGet)(y).then(m=>{var v,b;return l?((v=m.data)===null||v===void 0?void 0:v.subscriptions)||[]:(0,s.parseSubscriptionsApiResponse)(((b=m.data)===null||b===void 0?void 0:b.subscriptions)||[])}).catch(m=>{console.error(`[Push SDK] - API ${y}: `,m)})});return yc.getSubscriptions=i,yc}var vc={},t4;function ZH(){if(t4)return vc;t4=1,Object.defineProperty(vc,"__esModule",{value:!0}),vc.getDelegations=void 0;const e=He,t=nt(),r=Ze(),n=Tt(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{user:o,env:a=r.default.ENV.PROD}=i||{},f=yield(0,t.getCAIPAddress)(a,o,"User"),u=`${`${(0,t.getAPIBaseUrls)(a)}/v1/users/${f}/delegations`}`;return(0,n.axiosGet)(u).then(p=>{var d;return((d=p.data)===null||d===void 0?void 0:d.delegations)||[]}).catch(p=>{console.error(`[EPNS-SDK] - API ${u}: `,p)})});return vc.getDelegations=s,vc}var bc={},r4;function JH(){if(r4)return bc;r4=1,Object.defineProperty(bc,"__esModule",{value:!0}),bc.getBatch=void 0;const e=He,t=zf(),r=nt(),n=Ze(),s=qf(),i=Tt(),o=a=>e.__awaiter(void 0,void 0,void 0,function*(){const{env:f=n.default.ENV.PROD,userIds:c}=a||{},u=`${(0,r.getAPIBaseUrls)(f)}/v2/users/batch`,p=100;if(c.length>p)throw new Error(`Too many user IDs. Maximum allowed: ${p}`);for(let y=0;y<c.length;y++)if(!(0,t.isValidPushCAIP)(c[y]))throw new Error("Invalid user address!");const h={userIds:c.map(t.walletToPCAIP10)};return(0,i.axiosPost)(u,h).then(y=>(y.data.users.forEach((m,v)=>e.__awaiter(void 0,void 0,void 0,function*(){y.data.users[v].publicKey=yield(0,r.verifyProfileKeys)(m.encryptedPrivateKey,m.publicKey,m.did,m.caip10,m.verificationProof),y.data.users[v]=(0,s.populateDeprecatedUser)(y.data.users[v])})),y.data)).catch(y=>{throw console.error(`[Push SDK] - API ${u}: `,y),Error(`[Push SDK] - API ${u}: ${y}`)})});return bc.getBatch=o,bc}var Gp={},n4;function hA(){return n4||(n4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.upgrade=void 0;const t=He,r=Dt(),n=Ze(),s=nt(),i=lA(),o=Gf(),a=Ha(),f=c=>t.__awaiter(void 0,void 0,void 0,function*(){const{env:l=n.default.ENV.PROD,account:u=null,signer:p,additionalMeta:d,progressHook:h}=c||{};try{const y=(0,r.getWallet)({account:u,signer:p}),m=yield(0,r.getAccountAddress)(y);if(!(0,s.isValidPushCAIP)(m))throw new Error("Invalid address!");const v=yield(0,o.get)({account:m,env:l});if(!v||!v.encryptedPrivateKey)throw new Error("User Not Found!");const b=n.default.ENCRYPTION_TYPE.PGP_V3,{version:w}=JSON.parse(v.encryptedPrivateKey);if(w===b||w===n.default.ENCRYPTION_TYPE.NFTPGP_V1||w===n.default.ENCRYPTION_TYPE.SCWPGP_V1)return v;h==null||h(a.default["PUSH-UPGRADE-02"]);const _=yield(0,s.decryptPGPKey)({encryptedPGPPrivateKey:v.encryptedPrivateKey,signer:p,env:l,toUpgrade:!1,additionalMeta:d}),C=yield(0,i.authUpdate)({pgpPrivateKey:_,pgpEncryptionVersion:b,signer:p,pgpPublicKey:v.publicKey,account:v.did,env:l,additionalMeta:d,progressHook:h});return h==null||h(a.default["PUSH-UPGRADE-05"]),C}catch(y){const m=a.default["PUSH-ERROR-00"];throw h==null||h(m(e.upgrade.name,y)),Error(`[Push SDK] - API - Error - API ${e.upgrade.name} -: ${y}`)}});e.upgrade=f}(Gp)),Gp}var zp={},i4;function XH(){return i4||(i4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decryptAuth=void 0;const t=He,r=Ze(),n=nt(),s=Ha(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){var a,f;const{account:c,signer:l,env:u=r.default.ENV.PROD,additionalMeta:p,progressHook:d}=o||{};try{if(!(0,n.isValidNFTCAIP)(c)&&!(0,n.isValidSCWCAIP)(c))return null;d==null||d(s.default["PUSH-DECRYPT-AUTH-01"]);const h=((a=p==null?void 0:p.NFTPGP_V1)===null||a===void 0?void 0:a.encryptedPassword)||((f=p==null?void 0:p.SCWPGP_V1)===null||f===void 0?void 0:f.encryptedPassword);if(!h)throw new Error("encryptedPassword is required!");const y=yield(0,n.decryptPGPKey)({encryptedPGPPrivateKey:h,signer:l,account:c,env:u});return d==null||d(s.default["PUSH-DECRYPT-AUTH-02"]),y}catch(h){throw d==null||d(s.default["PUSH-ERROR-00"](e.decryptAuth.name,h)),Error(`[Push SDK] - API - Error - API ${e.decryptAuth.name} -: ${h}`)}});e.decryptAuth=i}(zp)),zp}var _c={},s4;function QH(){if(s4)return _c;s4=1,Object.defineProperty(_c,"__esModule",{value:!0}),_c.createUserWithProfile=void 0;const e=He,t=fA(),r=dA(),n=nt(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){try{let o=yield(0,t.create)(i);if(i.profile){const a=yield(0,n.decryptPGPKey)({account:o.did,encryptedPGPPrivateKey:o.encryptedPrivateKey,env:i.env,signer:i.signer});o=yield(0,r.profileUpdate)({account:o.did,env:i.env,pgpPrivateKey:a,profile:i.profile})}return o}catch(o){throw new Error(`[Push SDK] - Error in createUserWithProfile -: ${o}`)}});return _c.createUserWithProfile=s,_c}var wc={},a4;function eV(){if(a4)return wc;a4=1,Object.defineProperty(wc,"__esModule",{value:!0}),wc.getFeedsPerChannel=void 0;const e=He,t=nt(),r=Ze(),n=Xg(),s=Tt(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{user:a,env:f=r.default.ENV.PROD,page:c=r.default.PAGINATION.INITIAL_PAGE,limit:l=r.default.PAGINATION.LIMIT,spam:u=!1,raw:p=!1,channels:d=[]}=o||{},h=yield(0,t.getCAIPAddress)(f,a,"User"),y=(0,t.getAPIBaseUrls)(f);if(d.length==0)throw new Error("channels cannot be empty");const m=yield(0,t.getCAIPAddress)(f,d[0],"Channel"),v=`${y}/v1/users/${h}/channels/${m}/feeds`,b={page:c,limit:(0,t.getLimit)(l),spam:u},w=`${v}?${(0,t.getQueryParams)(b)}`;return(0,s.axiosGet)(w).then(_=>{var C,I;return p?((C=_==null?void 0:_.data)===null||C===void 0?void 0:C.feeds)||[]:(0,n.parseApiResponse)((I=_==null?void 0:_.data)===null||I===void 0?void 0:I.feeds)||[]}).catch(_=>{console.error(`[Push SDK] - API ${w}: `,_)})});return wc.getFeedsPerChannel=i,wc}var o4;function Mn(){return o4||(o4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.profile=e.auth=void 0;const t=He,r=lA(),n=dA();t.__exportStar(fA(),e),t.__exportStar(zH(),e),t.__exportStar(YH(),e),t.__exportStar(Gf(),e),t.__exportStar(ZH(),e),t.__exportStar(JH(),e),t.__exportStar(hA(),e),t.__exportStar(XH(),e),t.__exportStar(QH(),e),t.__exportStar(eV(),e),e.auth={update:r.authUpdate},e.profile={update:n.profileUpdate,updateCore:n.profileUpdateCore}}(dh)),dh}var c4;function zf(){return c4||(c4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.pCAIP10ToWallet=e.walletToPCAIP10=e.getCAIPWithChainId=e.getCAIPAddress=e.getFallbackETHCAIPAddress=e.getCAIPDetails=e.validateCAIP=e.isValidFullCAIP10=e.convertToValidDID=e.isValidPushCAIP=e.isValidEOACAIP=e.isValidNFTCAIP=e.isValidSCWCAIP=void 0;const t=He,r=Ra(),n=Ze(),s=Mn(),i=w=>{try{const _=w.split(":");return _.length===4&&_[0]==="scw"&&_[1]==="eip155"&&!isNaN(Number(_[2]))&&Number(_[2])>0&&r.isAddress(_[3])}catch{return!1}};e.isValidSCWCAIP=i;const o=w=>{try{const _=w.split(":");return(_.length===5||_.length===6)&&_[0].toLowerCase()==="nft"&&!isNaN(Number(_[4]))&&Number(_[4])>0&&!isNaN(Number(_[2]))&&Number(_[2])>0&&r.isAddress(_[3])&&_[1]==="eip155"}catch{return!1}};e.isValidNFTCAIP=o;const a=w=>{try{const _=w.split(":");return _.length===3?_[0]==="eip155"&&!isNaN(Number(_[1]))&&Number(_[1])>0&&r.isAddress(_[2]):_.length===2?_[0]==="eip155"&&r.isAddress(_[1]):!1}catch{return!1}};e.isValidEOACAIP=a;const f=w=>(0,e.isValidEOACAIP)(w)||(0,e.isValidSCWCAIP)(w)||(0,e.isValidNFTCAIP)(w)||r.isAddress(w);e.isValidPushCAIP=f;const c=(w,_=n.ENV.STAGING,C,I)=>t.__awaiter(void 0,void 0,void 0,function*(){if(!(0,e.isValidPushCAIP)(w)||(0,e.isValidEOACAIP)(w)||(0,e.isValidSCWCAIP)(w)||(0,e.isValidNFTCAIP)(w)&&w.split(":").length===6)return w;if((0,e.isValidNFTCAIP)(w)){const k=yield(0,s.get)({account:w,env:_});if(k&&k.did)return k.did;const E=Math.floor(Date.now()/1e3);return`${w}:${E}`}return C?`eip155:${C}:${w}`:`eip155:${w}`});e.convertToValidDID=c;const l=w=>{const _=w.split(":");return isNaN(Number(_[1]))?!1:_[0]==="eip155"&&!isNaN(Number(_[1]))&&Number(_[1])>0&&r.isAddress(_[2])};e.isValidFullCAIP10=l;const u={eip155:({address:w})=>(0,e.isValidPushCAIP)(w)};function p(w){const[_,C,I]=w.split(":");if(!_||!C||!I)return!1;if((0,e.isValidNFTCAIP)(w))return!0;const k=u[_];return k({address:I})}e.validateCAIP=p;function d(w){if(p(w)){const[_,C,I]=w.split(":");return{blockchain:_,networkId:C,address:I}}return null}e.getCAIPDetails=d;function h(w,_){let C=1;return(w===n.default.ENV.DEV||w===n.default.ENV.STAGING||w===n.default.ENV.LOCAL)&&(C=11155111),`eip155:${C}:${_}`}e.getFallbackETHCAIPAddress=h;function y(w,_,C){return t.__awaiter(this,void 0,void 0,function*(){if((0,e.isValidNFTCAIP)(_)||(0,e.isValidSCWCAIP)(_))return yield(0,e.convertToValidDID)(_,w);if(p(_))return _;if((0,e.isValidPushCAIP)(_))return h(w,_);throw Error(`Invalid Address! ${C}
77
+ Address: ${_}`)})}e.getCAIPAddress=y;const m=(w,_,C)=>{if((0,e.isValidPushCAIP)(w))return w.includes("eip155:")?w:`eip155:${_}:${w}`;throw Error(`Invalid Address! ${C}
78
+ Address: ${w}`)};e.getCAIPWithChainId=m;const v=w=>(0,e.isValidNFTCAIP)(w)||(0,e.isValidSCWCAIP)(w)||w.includes("eip155:")?w:"eip155:"+w;e.walletToPCAIP10=v;const b=w=>((0,e.isValidNFTCAIP)(w)||(0,e.isValidSCWCAIP)(w)||(w=w.replace("eip155:","")),w);e.pCAIP10ToWallet=b}(lh)),lh}var ca={},u4;function tV(){if(u4)return ca;u4=1,Object.defineProperty(ca,"__esModule",{value:!0}),ca.getLimit=ca.getQueryParams=void 0;const e=Ze();function t(n){return Object.keys(n).map(s=>`${s}=${encodeURIComponent(n[s])}`).join("&")}ca.getQueryParams=t;function r(n){return n||e.default.PAGINATION.LIMIT}return ca.getLimit=r,ca}var Wp={},Ec={},l4;function pA(){if(l4)return Ec;l4=1,Object.defineProperty(Ec,"__esModule",{value:!0}),Ec.Signer=void 0;const e=He;class t{constructor(n){this.signer=n}isViemSigner(n){return typeof n.signTypedData=="function"&&typeof n.getChainId=="function"&&n.signMessage.length===1&&n.signTypedData.length===1}signMessage(n){return e.__awaiter(this,void 0,void 0,function*(){if("signMessage"in this.signer&&typeof this.signer.signMessage=="function")return this.isViemSigner(this.signer)?this.signer.signMessage({message:n,account:this.signer.account}):this.signer.signMessage(n);throw new Error("Signer does not support signMessage")})}signTypedData(n,s,i,o){return e.__awaiter(this,void 0,void 0,function*(){if(this.isViemSigner(this.signer))return this.signer.signTypedData({domain:n,types:s,primaryType:o,message:i,account:this.signer.account});if("_signTypedData"in this.signer)return this.signer._signTypedData(n,s,i);if("signTypedData"in this.signer)return this.signer.signTypedData(n,s,i);throw new Error("Signer does not support signTypedData")})}getAddress(){var n;return e.__awaiter(this,void 0,void 0,function*(){return this.isViemSigner(this.signer)?(n=this.signer.account.address)!==null&&n!==void 0?n:"":yield this.signer.getAddress()})}getChainId(){return e.__awaiter(this,void 0,void 0,function*(){if(this.isViemSigner(this.signer))return this.signer.getChainId();if("provider"in this.signer&&this.signer.provider){const n=yield this.signer.provider.getNetwork();return Number(n.chainId)}else return 1})}}return Ec.Signer=t,Ec}var d4;function $y(){return d4||(d4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validatePssword=e.verifyProfileKeys=e.preparePGPPublicKey=e.encryptPGPKey=e.decryptV2=e.encryptV2=e.stringToHex=e.hexToBytes=e.generateHash=e.decryptPGPKey=e.decryptWithWalletRPCMethod=e.encryptV1=e.getPublicKey=void 0;const t=He,r=Ly(),n=Ly(),s=Yr(),i=Dt(),o=Ze(),a=zf(),f=sA(),c=hA(),l=Ha(),u=pA(),p=Ra(),d=_9,h=32,y=12;let m;if(typeof window<"u"&&window.crypto)m=window.crypto;else if(typeof ka<"u")try{m=xa.webcrypto}catch{throw new Error("Unable To load crypto")}const v=B=>t.__awaiter(void 0,void 0,void 0,function*(){var L;const{account:M,signer:R}=B||{},N=R?new u.Signer(R):void 0,F=M||(yield N==null?void 0:N.getAddress())||"",z=p.createWalletClient({chain:d.mainnet,transport:p.custom(window.ethereum)});return yield(((L=R==null?void 0:R.provider)===null||L===void 0?void 0:L.provider)||z).request({method:"eth_getEncryptionPublicKey",params:[F]})});e.getPublicKey=v;const b=(B,L,M)=>r.encrypt({publicKey:L,data:B,version:M});e.encryptV1=b;const w=(B,L)=>t.__awaiter(void 0,void 0,void 0,function*(){return console.warn("decryptWithWalletRPCMethod method is DEPRECATED. Use decryptPGPKey method with signer!"),yield(0,e.decryptPGPKey)({encryptedPGPPrivateKey:B,account:L})});e.decryptWithWalletRPCMethod=w;const _=B=>t.__awaiter(void 0,void 0,void 0,function*(){var L,M,R,N,F;const{encryptedPGPPrivateKey:z,account:Y=null,signer:j=null,env:re=o.default.ENV.PROD,toUpgrade:V=!0,additionalMeta:U=null,progressHook:X}=B||{};try{if(Y==null&&j==null)throw new Error("At least one from account or signer is necessary!");const ye=(0,i.getWallet)({account:Y,signer:j}),_e=yield(0,i.getAccountAddress)(ye);if(!(0,a.isValidPushCAIP)(_e))throw new Error("Invalid address!");const{version:Ae}=JSON.parse(z);let H;switch(X==null||X(l.default["PUSH-DECRYPT-01"]),Ae){case o.default.ENC_TYPE_V1:{if(!((L=ye==null?void 0:ye.signer)===null||L===void 0)&&L.privateKey)H=(0,n.decrypt)({encryptedData:JSON.parse(z),privateKey:(M=ye==null?void 0:ye.signer)===null||M===void 0?void 0:M.privateKey.substring(2)});else{const q=p.createWalletClient({chain:d.mainnet,transport:p.custom(window.ethereum)});H=yield(((R=j==null?void 0:j.provider)===null||R===void 0?void 0:R.provider)||q).request({method:"eth_decrypt",params:[z,_e]})}break}case o.default.ENC_TYPE_V2:{if(!(ye!=null&&ye.signer))throw new Error("Cannot Decrypt this encryption version without signer!");const{preKey:q}=JSON.parse(z),W=`Enable Push Chat Profile
79
+ `+q;let ee;try{const{verificationProof:ce}=yield(0,i.getEip712Signature)(ye,W,!0);ee=yield(0,e.decryptV2)(JSON.parse(z),(0,e.hexToBytes)(ce||""))}catch{const{verificationProof:ie}=yield(0,i.getEip712Signature)(ye,W,!1);ee=yield(0,e.decryptV2)(JSON.parse(z),(0,e.hexToBytes)(ie||""))}H=new TextDecoder().decode(ee);break}case o.default.ENC_TYPE_V3:{if(!(ye!=null&&ye.signer))throw new Error("Cannot Decrypt this encryption version without signer!");const{preKey:q}=JSON.parse(z),W=`Enable Push Profile
80
+ `+q,{verificationProof:ee}=yield(0,i.getEip191Signature)(ye,W),le=yield(0,e.decryptV2)(JSON.parse(z),(0,e.hexToBytes)(ee||""));H=new TextDecoder().decode(le);break}case o.default.ENC_TYPE_V4:case o.default.ENC_TYPE_V5:{let q=null;if(!((N=U==null?void 0:U.NFTPGP_V1)===null||N===void 0)&&N.password)q=U.NFTPGP_V1.password;else if(!((F=U==null?void 0:U.SCWPGP_V1)===null||F===void 0)&&F.password)q=U.SCWPGP_V1.password;else{if(!(ye!=null&&ye.signer))throw new Error("Cannot Decrypt this encryption version without signer!");const{encryptedPassword:le}=JSON.parse(z);q=yield(0,e.decryptPGPKey)({encryptedPGPPrivateKey:JSON.stringify(le),signer:j,env:re})}const W=yield(0,e.decryptV2)(JSON.parse(z),(0,e.hexToBytes)((0,e.stringToHex)(q)));H=new TextDecoder().decode(W);break}default:throw new Error("Invalid Encryption Type")}if(j&&V&&Ae!==o.default.ENC_TYPE_V4&&Ae!==o.default.ENC_TYPE_V5)try{yield(0,c.upgrade)({env:re,account:_e,signer:j,progressHook:X})}catch(q){const W=l.default["PUSH-ERROR-01"];X==null||X(W(q))}return X==null||X(l.default["PUSH-DECRYPT-02"]),H}catch(ye){const _e=l.default["PUSH-ERROR-00"];throw X==null||X(_e(e.decryptPGPKey.name,ye)),Error(`[Push SDK] - API - Error - API ${e.decryptPGPKey.name} -: ${ye}`)}});e.decryptPGPKey=_;const C=B=>s.SHA256(JSON.stringify(B)).toString(s.enc.Hex);e.generateHash=C;const I=B=>t.__awaiter(void 0,void 0,void 0,function*(){return m.getRandomValues(B)}),k=B=>B.reduce((L,M)=>L+M.toString(16).padStart(2,"0"),""),E=B=>{const L=new Uint8Array(B.length/2);for(let M=0;M<B.length;M+=2)L[M/2]=parseInt(B.slice(M,M+2),16);return L};e.hexToBytes=E;const S=B=>{let L="";for(let M=0;M<B.length;M++)L+=B.charCodeAt(M).toString(16).padStart(2,"0");return L};e.stringToHex=S;const T=(B,L)=>t.__awaiter(void 0,void 0,void 0,function*(){const M=yield m.subtle.importKey("raw",B,"HKDF",!1,["deriveKey"]);return m.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:L,info:new ArrayBuffer(0)},M,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"])}),P=(B,L,M)=>t.__awaiter(void 0,void 0,void 0,function*(){const R=m.getRandomValues(new Uint8Array(h)),N=m.getRandomValues(new Uint8Array(y)),F=yield T(L,R),z={name:"AES-GCM",iv:N};M&&(z.additionalData=M);const Y=yield m.subtle.encrypt(z,F,B);return{ciphertext:k(new Uint8Array(Y)),salt:k(R),nonce:k(N)}});e.encryptV2=P;const g=(B,L,M)=>t.__awaiter(void 0,void 0,void 0,function*(){const R=yield T(L,(0,e.hexToBytes)(B.salt)),N={name:"AES-GCM",iv:(0,e.hexToBytes)(B.nonce)};M&&(N.additionalData=M);const F=yield m.subtle.decrypt(N,R,(0,e.hexToBytes)(B.ciphertext));return new Uint8Array(F)});e.decryptV2=g;const A=(B,L,M,R)=>t.__awaiter(void 0,void 0,void 0,function*(){var N,F,z,Y,j,re;let V;switch(B){case o.default.ENC_TYPE_V1:{let U;!((N=M==null?void 0:M.signer)===null||N===void 0)&&N.privateKey?U=(0,n.getEncryptionPublicKey)((F=M==null?void 0:M.signer)===null||F===void 0?void 0:F.privateKey.substring(2)):U=yield(0,e.getPublicKey)(M),V=(0,e.encryptV1)(L,U,B);break}case o.default.ENC_TYPE_V2:{const U=k(yield I(new Uint8Array(32))),X=`Enable Push Chat Profile
81
+ `+U,{verificationProof:ye}=yield(0,i.getEip712Signature)(M,X,!0),Ae=new TextEncoder().encode(L);V=yield(0,e.encryptV2)(Ae,(0,e.hexToBytes)(ye||"")),V.version=o.default.ENC_TYPE_V2,V.preKey=U;break}case o.default.ENC_TYPE_V3:{const U=k(yield I(new Uint8Array(32))),X=`Enable Push Profile
82
+ `+U,{verificationProof:ye}=yield(0,i.getEip191Signature)(M,X),Ae=new TextEncoder().encode(L);V=yield(0,e.encryptV2)(Ae,(0,e.hexToBytes)(ye||"")),V.version=o.default.ENC_TYPE_V3,V.preKey=U;break}case o.default.ENC_TYPE_V4:case o.default.ENC_TYPE_V5:{if(!(!((z=R==null?void 0:R.NFTPGP_V1)===null||z===void 0)&&z.password)&&!(!((Y=R==null?void 0:R.SCWPGP_V1)===null||Y===void 0)&&Y.password))throw new Error("Password is required!");const X=new TextEncoder().encode(L),ye=((j=R==null?void 0:R.NFTPGP_V1)===null||j===void 0?void 0:j.password)||((re=R==null?void 0:R.SCWPGP_V1)===null||re===void 0?void 0:re.password);V=yield(0,e.encryptV2)(X,(0,e.hexToBytes)((0,e.stringToHex)(ye))),V.version=B,V.preKey="";break}default:throw new Error("Invalid Encryption Type")}return V});e.encryptPGPKey=A;const x=(B,L,M)=>t.__awaiter(void 0,void 0,void 0,function*(){let R;switch(B){case o.default.ENC_TYPE_V1:{R=L;break}case o.default.ENC_TYPE_V2:case o.default.ENC_TYPE_V3:case o.default.ENC_TYPE_V4:case o.default.ENC_TYPE_V5:{R=JSON.stringify({key:L,signature:"DEPRECATED"});break}default:throw new Error("Invalid Encryption Type")}return R});e.preparePGPPublicKey=x;const D=(B,L,M,R,N)=>t.__awaiter(void 0,void 0,void 0,function*(){let F;try{if(F=JSON.parse(L).key,F===void 0)throw new Error("Invalid Public Key")}catch{F=L}try{if(L&&L.length>0&&N&&N.split(":")[0]==="eip191v2"){const z={caip10:R,did:M,publicKey:L,encryptedPrivateKey:B};if((0,a.isValidNFTCAIP)(M)){const re="owner",V=JSON.parse(B);re in V&&delete V[re],z.encryptedPrivateKey=JSON.stringify(V)}const Y=(0,e.generateHash)(z);if(yield(0,f.verifyProfileSignature)(N,Y,(0,a.isValidNFTCAIP)(M)?(0,a.pCAIP10ToWallet)(JSON.parse(B).owner):(0,a.pCAIP10ToWallet)(M)))return F;throw new Error("Invalid Signature")}return F}catch{return console.warn(`Cannot Verify keys for DID : ${M} !!!`),F}});e.verifyProfileKeys=D;const O=B=>{if(B.length<8)throw new Error("Password must be at least 8 characters long!");if(!/[A-Z]/.test(B))throw new Error("Password must contain at least one uppercase letter!");if(!/[a-z]/.test(B))throw new Error("Password must contain at least one lowercase letter!");if(!/\d/.test(B))throw new Error("Password must contain at least one digit!");if(!/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(B))throw new Error("Password must contain at least one special character!")};e.validatePssword=O}(Wp)),Wp}var f4;function nt(){return f4||(f4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=He;t.__exportStar(uK(),e),t.__exportStar(zf(),e),t.__exportStar(tV(),e),t.__exportStar($y(),e),t.__exportStar(pA(),e)}(oh)),oh}var h4;function rV(){if(h4)return Fo;h4=1,Object.defineProperty(Fo,"__esModule",{value:!0}),Fo.getAliasInfo=void 0;const e=He,t=nt(),r=Ze(),n=un(),s=Tt(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{alias:a,aliasChain:f,env:c=r.default.ENV.PROD}=o||{},l=n.ALIAS_CHAIN_ID[f][c],u=(0,t.getCAIPWithChainId)(a,l,"Alias"),h=`${`${(0,t.getAPIBaseUrls)(c)}/v1/alias`}/${u}/channel`;return yield(0,s.axiosGet)(h).then(y=>y.data).catch(y=>{console.error(`[EPNS-SDK] - API ${h}: `,y)})});return Fo.getAliasInfo=i,Fo}var p4;function yA(){return p4||(p4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),He.__exportStar(rV(),e)}(ah)),ah}var Yp={},Ac={},y4;function nV(){if(y4)return Ac;y4=1,Object.defineProperty(Ac,"__esModule",{value:!0}),Ac._getSubscribers=void 0;const e=He,t=nt(),r=Ze(),n=Tt(),s=`
83
+ [Push SDK]: _getSubscribers() Deprecation Warning!
84
+ This method has been deprecated, please use the below alternatives
85
+ if you need to,
86
+ * to check if user is subscribed or not: user.getSubscriptions()
87
+ * get channels count: channels.getChannels()
88
+ `,i=o=>e.__awaiter(void 0,void 0,void 0,function*(){console.warn(s);const{channel:a,env:f=r.default.ENV.PROD}=o||{},c=yield(0,t.getCAIPAddress)(f,a,"Channel"),l=(0,t.getCAIPDetails)(c);if(!l)throw Error("Invalid Channel CAIP!");const u=l.networkId,h=`${`${(0,t.getAPIBaseUrls)(f)}/channels/_get_subscribers`}`,y={channel:l.address,blockchain:u,op:"read"};return(yield(0,n.axiosPost)(h,y)).data.subscribers});return Ac._getSubscribers=i,Ac}var Sc={},g4;function iV(){if(g4)return Sc;g4=1,Object.defineProperty(Sc,"__esModule",{value:!0}),Sc.getChannel=void 0;const e=He,t=nt(),r=Ze(),n=Tt(),s=Qg(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{channel:a,env:f=r.default.ENV.PROD,raw:c=!0}=o||{},l=yield(0,t.getCAIPAddress)(f,a,"Channel"),d=`${`${(0,t.getAPIBaseUrls)(f)}/v1/channels`}/${l}`;return yield(0,n.axiosGet)(d).then(h=>(c||(h.data.channel_settings=h.data.channel_settings?(0,s.parseSettings)(h.data.channel_settings):null),h.data))});return Sc.getChannel=i,Sc}var Pc={},m4;function sV(){if(m4)return Pc;m4=1,Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.getChannelNotifications=void 0;const e=He,t=nt(),r=Ze(),n=Tt(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{channel:o,env:a=r.default.ENV.PROD,page:f=r.default.PAGINATION.INITIAL_PAGE,limit:c=r.default.PAGINATION.LIMIT,filter:l=null,raw:u=!0}=i||{},p=yield(0,t.getCAIPAddress)(a,o,"Channel"),h=`${(0,t.getAPIBaseUrls)(a)}/v2/channels`,y=(0,t.getQueryParams)(l?{page:f,limit:c,notificationType:l,raw:u}:{page:f,limit:c,raw:u}),m=`${h}/${p}/notifications?${y}`;return yield(0,n.axiosGet)(m).then(v=>v.data)});return Pc.getChannelNotifications=s,Pc}var xc={},Vl={},Zp={},v4;function Wf(){return v4||(v4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ChannelListOrderType=e.ChannelListSortType=e.ChannelListType=e.FeedType=void 0,function(t){t.INBOX="INBOX",t.SPAM="SPAM"}(e.FeedType||(e.FeedType={})),function(t){t.ALL="all",t.VERIFIED="verified",t.UNVERIFIED="unverified"}(e.ChannelListType||(e.ChannelListType={})),function(t){t.SUBSCRIBER="subscribers"}(e.ChannelListSortType||(e.ChannelListSortType={})),function(t){t.ASCENDING="asc",t.DESCENDING="desc"}(e.ChannelListOrderType||(e.ChannelListOrderType={}))}(Zp)),Zp}var Jp={},b4;function Yf(){return b4||(b4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EVENTS=e.NOTIFICATION=e.ProposedEventNames=e.VideoEventType=e.SpaceEventType=e.GroupEventType=e.MessageEventType=e.MessageOrigin=e.NotificationEventType=e.STREAM=void 0,function(t){t.PROFILE="STREAM.PROFILE",t.ENCRYPTION="STREAM.ENCRYPTION",t.NOTIF="STREAM.NOTIF",t.NOTIF_OPS="STREAM.NOTIF_OPS",t.CHAT="STREAM.CHAT",t.CHAT_OPS="STREAM.CHAT_OPS",t.SPACE="STREAM.SPACE",t.SPACE_OPS="STREAM.SPACE_OPS",t.VIDEO="STREAM.VIDEO",t.CONNECT="STREAM.CONNECT",t.DISCONNECT="STREAM.DISCONNECT"}(e.STREAM||(e.STREAM={})),function(t){t.INBOX="notification.inbox",t.SPAM="notification.spam"}(e.NotificationEventType||(e.NotificationEventType={})),function(t){t.Other="other",t.Self="self"}(e.MessageOrigin||(e.MessageOrigin={})),function(t){t.Message="message",t.Request="request",t.Accept="accept",t.Reject="reject"}(e.MessageEventType||(e.MessageEventType={})),function(t){t.CreateGroup="createGroup",t.UpdateGroup="updateGroup",t.JoinGroup="joinGroup",t.LeaveGroup="leaveGroup",t.Remove="remove",t.RoleChange="roleChange"}(e.GroupEventType||(e.GroupEventType={})),function(t){t.CreateSpace="createSpace",t.UpdateSpace="updateSpace",t.Join="joinSpace",t.Leave="leaveSpace",t.Remove="remove",t.Stop="stop",t.Start="start"}(e.SpaceEventType||(e.SpaceEventType={})),function(t){t.REQUEST="video.request",t.APPROVE="video.approve",t.DENY="video.deny",t.CONNECT="video.connect",t.DISCONNECT="video.disconnect",t.RETRY_REQUEST="video.retry.request",t.RETRY_APPROVE="video.retry.approve"}(e.VideoEventType||(e.VideoEventType={})),function(t){t.Message="chat.message",t.Request="chat.request",t.Accept="chat.accept",t.Reject="chat.reject",t.LeaveGroup="chat.group.participant.leave",t.JoinGroup="chat.group.participant.join",t.CreateGroup="chat.group.create",t.UpdateGroup="chat.group.update",t.Remove="chat.group.participant.remove",t.RoleChange="chat.group.participant.role",t.CreateSpace="space.create",t.UpdateSpace="space.update",t.SpaceRequest="space.request",t.SpaceAccept="space.accept",t.SpaceReject="space.reject",t.LeaveSpace="space.participant.leave",t.JoinSpace="space.participant.join",t.SpaceRemove="space.participant.remove",t.StartSpace="space.start",t.StopSpace="space.stop"}(e.ProposedEventNames||(e.ProposedEventNames={})),e.NOTIFICATION={TYPE:{BROADCAST:1,TARGETTED:3,SUBSET:4}},function(t){t.CONNECT="connect",t.DISCONNECT="disconnect",t.USER_FEEDS="userFeeds",t.USER_SPAM_FEEDS="userSpamFeeds",t.CHAT_RECEIVED_MESSAGE="CHATS",t.CHAT_GROUPS="CHAT_GROUPS"}(e.EVENTS||(e.EVENTS={}))}(Jp)),Jp}var Xp={},Gl={},_4;function em(){if(_4)return Gl;_4=1,Object.defineProperty(Gl,"__esModule",{value:!0});const e=t=>t.replace("eip155:","");return Gl.default=e,Gl}var Qp={},w4;function aV(){return w4||(w4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.spaces=void 0;const t=He,r=nt(),n=Ze(),s=Dt(),i=Tt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:f,pgpPrivateKey:c,env:l=n.default.ENV.PROD,page:u=1,limit:p=10}=a||{};if(!(0,r.isValidPushCAIP)(f))throw new Error("Invalid address!");const d=yield(0,r.convertToValidDID)(f,l),m=`${`${(0,r.getAPIBaseUrls)(l)}/v1/spaces/users/${d}/spaces?page=${u}&limit=${p}`}`;try{const w=(yield(0,i.axiosGet)(m)).data.spaces;return yield(0,s.getSpaceInboxLists)({lists:w,user:d,toDecrypt:!1,pgpPrivateKey:c,env:l})}catch(v){throw console.error(`[Push SDK] - API ${e.spaces.name}: `,v),Error(`[Push SDK] - API ${e.spaces.name}: ${v}`)}});e.spaces=o}(Qp)),Qp}var e2={},E4;function oV(){return E4||(E4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.trending=void 0;const t=He,r=nt(),n=Ze(),s=Dt(),i=Tt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{env:f=n.default.ENV.PROD,page:c=1,limit:l=10}=a||{},p=`${(0,r.getAPIBaseUrls)(f)}/v1/spaces/trending?page=${c}&limit=${l}`;try{const h=(yield(0,i.axiosGet)(p)).data.spaces;return yield(0,s.getTrendingSpaceInboxLists)({lists:h,env:f})}catch(d){throw console.error(`[Push SDK] - API ${e.trending.name}: `,d),Error(`[Push SDK] - API ${e.trending.name}: ${d}`)}});e.trending=o}(e2)),e2}var t2={},A4;function Zs(){return A4||(A4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.get=void 0;const t=He,r=Ze(),n=Dt(),s=al(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:a,env:f=r.default.ENV.PROD}=o||{};try{if(a==null||a.length==0)throw new Error("spaceId cannot be null or empty");const c=yield(0,s.getGroup)({chatId:a,env:f});return(0,n.groupDtoToSpaceDto)(c)}catch(c){throw console.error(`[Push SDK] - API - Error - API ${e.get.name} -: `,c),Error(`[Push SDK] - API - Error - API ${e.get.name} -: ${c}`)}});e.get=i}(t2)),t2}var r2={},S4;function cV(){return S4||(S4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.info=void 0;const t=He,r=Dt(),n=al(),s=Ze(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:a,env:f=s.default.ENV.PROD}=o||{};try{if(a==null||a.length==0)throw new Error("spaceId cannot be null or empty");const c=yield(0,n.getGroup)({chatId:a,env:f});return(0,r.groupDtoToSpaceDto)(c)}catch(c){throw console.error(`[Push SDK] - API - Error - API ${e.info.name} -: `,c),Error(`[Push SDK] - API - Error - API ${e.info.name} -: ${c}`)}});e.info=i}(r2)),r2}var Tc={},n2={},P4;function gA(){return P4||(P4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createGroupCore=e.createGroup=void 0;const t=He,r=nt(),n=Ze(),s=Dt(),i=Yr(),o=Tt(),a=er(),f=l=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.createGroupCore)(l,s.PGPHelper)});e.createGroup=f;const c=(l,u)=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:p=null,signer:d=null,groupName:h,groupDescription:y,members:m,groupImage:v,admins:b,isPublic:w,contractAddressNFT:_,numberOfNFTs:C,contractAddressERC20:I,numberOfERC20:k,env:E=n.default.ENV.PROD,pgpPrivateKey:S=null,meta:T,groupType:P,scheduleAt:g,scheduleEnd:A,rules:x}=l||{};try{if(p==null&&d==null)throw new Error("At least one from account or signer is necessary!");(0,s.validateScheduleDates)(g,A);const D=(0,s.getWallet)({account:p,signer:d});(0,s.createGroupRequestValidator)(h,m,b,y,_,C,I,k);const O=m.map(ye=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,r.convertToValidDID)(ye,E)})),B=b.map(ye=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,r.convertToValidDID)(ye,E)})),L=yield Promise.all(O),M=yield Promise.all(B),R=yield(0,s.getConnectedUserV2Core)(D,S,E,u),N={groupName:h,groupDescription:y??null,members:L,groupImage:v??null,admins:M,isPublic:w,contractAddressNFT:_??null,numberOfNFTs:C??0,contractAddressERC20:I??null,numberOfERC20:k??0,groupCreator:R.did},F=i.SHA256(JSON.stringify(N)).toString(),z=yield u.sign({message:F,signingKey:R.privateKey}),j="pgp"+":"+z,V=`${(0,r.getAPIBaseUrls)(E)}/v1/chat/groups`,U=(0,s.createGroupPayload)(h,L,M,w,R.did,j,y,v,_,C,I,k,T,P,g,A,x);return(yield(0,o.axiosPost)(V,U)).data}catch(D){throw(0,a.handleError)(D,e.createGroup.name)}});e.createGroupCore=c}(n2)),n2}var x4;function uV(){if(x4)return Tc;x4=1,Object.defineProperty(Tc,"__esModule",{value:!0}),Tc.create=void 0;const e=He,t=Ze(),r=Dt(),n=gA();function s(i){return e.__awaiter(this,void 0,void 0,function*(){const{signer:o,spaceName:a,spaceDescription:f,listeners:c,spaceImage:l,speakers:u,isPublic:p,contractAddressNFT:d,numberOfNFTs:h,contractAddressERC20:y,numberOfERC20:m,env:v=t.default.ENV.PROD,pgpPrivateKey:b=null,scheduleAt:w,scheduleEnd:_,rules:C}=i||{},I=C?(0,r.convertSpaceRulesToRules)(C):null;try{const k=yield(0,n.createGroup)({signer:o,groupName:a,groupDescription:f,members:c,groupImage:l,admins:u,isPublic:p,contractAddressNFT:d,numberOfNFTs:h,contractAddressERC20:y,numberOfERC20:m,env:v,pgpPrivateKey:b,groupType:"spaces",scheduleAt:w,scheduleEnd:_,rules:I});return(0,r.groupDtoToSpaceDto)(k)}catch(k){throw console.error(`[Push SDK] - API - Error - API ${s.name} -: `,k),Error(`[Push SDK] - API - Error - API ${s.name} -: ${k}`)}})}return Tc.create=s,Tc}var i2={},s2={},Cc={},T4;function Va(){return T4||(T4=1,Object.defineProperty(Cc,"__esModule",{value:!0}),Cc.CHAT=void 0,Cc.CHAT={META:{GROUP:{CREATE:"CREATE_GROUP",MEMBER:{ADD:"ADD_MEMBER",REMOVE:"REMOVE_MEMBER",PRIVILEGE:"ASSIGN_MEMBER_PRIVILEGE"},ADMIN:{PRVILEGE:"ASSIGN_ADMIN_PRIVILEGE"},UPDATE:"UPDATE_GROUP",PROFILE:{UPDATE:"UPDATE_GROUP_PROFILE"},META:{UPDATE:"UPDATE_GROUP_META"},USER:{INTERACTION:"USER_INTERACTION"}},SPACE:{CREATE:"CREATE_SPACE",LISTENER:{ADD:"ADD_LISTENER",REMOVE:"REMOVE_LISTENER",PRVILEGE:"ASSIGN_LISTENER_PRIVILEGE"},SPEAKER:{PRVILEGE:"ASSIGN_SPEAKER_PRIVILEGE"},COHOST:{PRVILEGE:"ASSIGN_COHOST_PRIVILEGE"}}},REACTION:{THUMBSUP:"👍",THUMBSDOWN:"👎",HEART:"❤️",CLAP:"👏",LAUGH:"😂",SAD:"😢",ANGRY:"😡",SUPRISE:"😲",FIRE:"🔥"},RECEIPT:{READ:"READ_RECEIPT"},UA:{LISTENER:{JOIN:"LISTENER_JOIN",LEAVE:"LISTENER_LEAVE",MICREQUEST:"LISTENER_REQUEST_MIC"},SPEAKER:{MIC_ON:"SPEAKER_MIC_ON",MIC_OFF:"SPEAKER_MIC_OFF"}},INTENT:{ACCEPT:"ACCEPT_INTENT",REJECT:"REJECT_INTENT",JOIN:"JOIN_GROUP",LEAVE:"LEAVE_GROUP"}}),Cc}var a2={},C4;function lV(){return C4||(C4=1,Object.defineProperty(a2,"__esModule",{value:!0})),a2}var I4;function bn(){return I4||(I4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.NotifictaionType=e.VideoCallStatus=e.GROUP_INVITER_ROLE=e.GROUP_RULES_PERMISSION=e.GROUP_RULES_SUB_CATEGORY=e.GROUP_RULES_CATEGORY=e.ConditionType=e.ChatStatus=void 0;const t=He;t.__exportStar(Va(),e),t.__exportStar(lV(),e),function(r){r.ACTIVE="ACTIVE",r.PENDING="PENDING",r.ENDED="ENDED"}(e.ChatStatus||(e.ChatStatus={})),function(r){r.PUSH="PUSH",r.GUILD="GUILD"}(e.ConditionType||(e.ConditionType={})),function(r){r.PUSH="PUSH",r.GUILD="GUILD",r.ERC721="ERC721",r.ERC20="ERC20",r.CUSTOM_ENDPOINT="CustomEndpoint",r.INVITE="INVITE"}(e.GROUP_RULES_CATEGORY||(e.GROUP_RULES_CATEGORY={})),function(r){r.DEFAULT="DEFAULT",r.HOLDER="holder",r.GET="GET"}(e.GROUP_RULES_SUB_CATEGORY||(e.GROUP_RULES_SUB_CATEGORY={})),function(r){r.ENTRY="Entry",r.CHAT="Chat"}(e.GROUP_RULES_PERMISSION||(e.GROUP_RULES_PERMISSION={})),function(r){r.ADMIN="ADMIN",r.OWNER="OWNER"}(e.GROUP_INVITER_ROLE||(e.GROUP_INVITER_ROLE={})),function(r){r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.INITIALIZED=1]="INITIALIZED",r[r.RECEIVED=2]="RECEIVED",r[r.CONNECTED=3]="CONNECTED",r[r.DISCONNECTED=4]="DISCONNECTED",r[r.ENDED=5]="ENDED",r[r.RETRY_INITIALIZED=6]="RETRY_INITIALIZED",r[r.RETRY_RECEIVED=7]="RETRY_RECEIVED"}(e.VideoCallStatus||(e.VideoCallStatus={})),function(r){r[r.BROADCAT=1]="BROADCAT",r[r.TARGETTED=3]="TARGETTED",r[r.SUBSET=4]="SUBSET"}(e.NotifictaionType||(e.NotifictaionType={}))}(s2)),s2}var o2={},c2={},k4;function tm(){return k4||(k4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupMemberStatus=void 0;const t=He,r=nt(),n=Ze(),s=Tt(),i=er(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,did:c,env:l=n.default.ENV.PROD}=a||{};try{if(f==null||f.length===0)throw new Error("chatId cannot be null or empty");if(c==null||c.length===0)throw new Error("did cannot be null or empty");const u=yield(0,r.convertToValidDID)(c,l),d=`${(0,r.getAPIBaseUrls)(l)}/v1/chat/groups/${f}/members/${u}/status`;return(yield(0,s.axiosGet)(d)).data}catch(u){throw(0,i.handleError)(u,e.getGroupMemberStatus.name)}});e.getGroupMemberStatus=o}(c2)),c2}var R4;function cl(){return R4||(R4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.updateGroupCore=e.updateGroup=void 0;const t=He,r=nt(),n=Ze(),s=Dt(),i=Yr(),o=Tt(),a=al(),f=Da(),c=tm(),l=er(),u=d=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.updateGroupCore)(d,s.PGPHelper)});e.updateGroup=u;const p=(d,h)=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:y,groupName:m,groupImage:v,groupDescription:b,members:w,admins:_,account:C=null,signer:I=null,env:k=n.default.ENV.PROD,pgpPrivateKey:E=null,scheduleAt:S,scheduleEnd:T,status:P,meta:g,rules:A}=d||{};try{if(C==null&&I==null)throw new Error("At least one from account or signer is necessary!");const x=(0,s.getWallet)({account:C,signer:I}),D=yield(0,s.getAccountAddress)(x);(0,s.updateGroupRequestValidator)(y,m,w,_,D,b);const O=yield(0,s.getConnectedUserV2Core)(x,E,k,h),B=w.map(W=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,r.convertToValidDID)(W,k)})),L=_.map(W=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,r.convertToValidDID)(W,k)})),M=yield Promise.all(B),R=yield Promise.all(L),N=yield(0,a.getGroup)({chatId:y,env:k}),F=new Set(M.map(W=>W.toLowerCase())),z=yield(0,c.getGroupMemberStatus)({chatId:y,did:O.did,env:k});let Y=!0;N.members.map(W=>{F.has(W.wallet.toLowerCase())||(Y=!1)});let j=null;if((!Y||!z.isMember)&&!N.isPublic){const W=f.generateRandomSecret(15),ee=[];N.members.map(le=>{F.has(le.wallet.toLowerCase())&&ee.push(le.publicKey)}),z.isMember||ee.push(O.publicKey),j=yield h.pgpEncrypt({plainText:W,keys:ee})}const re={groupName:m,groupDescription:b??null,groupImage:v??null,members:M,admins:R,chatId:y},V=i.SHA256(JSON.stringify(re)).toString(),U=yield h.sign({message:V,signingKey:O.privateKey}),ye="pgp"+":"+U+":"+C,Ae=`${(0,r.getAPIBaseUrls)(k)}/v1/chat/groups/${y}`,H=(0,s.updateGroupPayload)(m,M,R,O.did,ye,j,b,v,S,T,P,g,A);return(yield(0,o.axiosPut)(Ae,H)).data}catch(x){throw(0,l.handleError)(x,e.updateGroup.name)}});e.updateGroupCore=p}(o2)),o2}var D4;function dV(){return D4||(D4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.update=void 0;const t=He,r=Ze(),n=bn(),s=Dt(),i=cl(),o=Zs(),a=f=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:c,spaceName:l,spaceImage:u,spaceDescription:p,listeners:d,speakers:h,signer:y,env:m=r.default.ENV.PROD,pgpPrivateKey:v=null,scheduleAt:b,scheduleEnd:w,status:_}=f||{};try{const C=yield(0,o.get)({spaceId:c,env:m});if(C.status===n.ChatStatus.ACTIVE&&b)throw new Error("Unable change the start date/time of an active space");if(C.status===n.ChatStatus.ENDED&&w)throw new Error("Unable change the end date/time of an ended space");const I=yield(0,i.updateGroup)({chatId:c,groupName:l,groupImage:u,groupDescription:p,members:d,admins:h,signer:y,env:m,pgpPrivateKey:v,scheduleAt:b,scheduleEnd:w,status:_});return(0,s.groupDtoToSpaceDto)(I)}catch(C){throw console.error(`[Push SDK] - API - Error - API ${e.update.name} -: `,C),Error(`[Push SDK] - API - Error - API ${e.update.name} -: ${C}`)}});e.update=a}(i2)),i2}var Ic={},u2={},l2={},d2={},B4;function ul(){return B4||(B4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupInfo=void 0;const t=He,r=Ro(),n=nt(),s=Ze(),i=er(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,env:c=s.default.ENV.PROD}=a||{};try{if(f==null||f.length==0)throw new Error("chatId cannot be null or empty");const u=`${(0,n.getAPIBaseUrls)(c)}/v2/chat/groups/${f}`;return r.default.get(u).then(p=>p.data).catch(p=>{var d,h;throw!((d=p==null?void 0:p.response)===null||d===void 0)&&d.data?new Error((h=p==null?void 0:p.response)===null||h===void 0?void 0:h.data):new Error(p)})}catch(l){throw(0,i.handleError)(l,e.getGroupInfo.name)}});e.getGroupInfo=o}(d2)),d2}var kc={},f2={},O4;function mA(){return O4||(O4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupMembersPublicKeys=void 0;const t=He,r=Ro(),n=nt(),s=Ze(),i=er(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,page:c=1,limit:l=20,env:u=s.default.ENV.PROD}=a;try{if(!f)throw new Error("Chat ID is required.");const d=`${(0,n.getAPIBaseUrls)(u)}/v1/chat/groups/${f}/members/publicKeys?pageNumber=${c}&pageSize=${l}`;return(yield r.default.get(d)).data}catch(p){throw(0,i.handleError)(p,e.getGroupMembersPublicKeys.name)}});e.getGroupMembersPublicKeys=o}(f2)),f2}var M4;function vA(){if(M4)return kc;M4=1,Object.defineProperty(kc,"__esModule",{value:!0}),kc.getAllGroupMembersPublicKeys=void 0;const e=He,t=Jg(),r=mA(),n=s=>e.__awaiter(void 0,void 0,void 0,function*(){const{chatId:i,env:o}=s,f=(yield(0,t.getGroupMemberCount)({chatId:i,env:o})).approvedCount,c=5e3,l=Math.ceil(f/c),u=Array.from({length:l},(y,m)=>m+1),p=[],d=u.map(y=>(0,r.getGroupMembersPublicKeys)({chatId:i,env:o,page:y,limit:c}));return(yield Promise.all(d)).forEach(y=>{y.members.length>0&&p.push(...y.members)}),p});return kc.getAllGroupMembersPublicKeys=n,kc}var N4;function ll(){return N4||(N4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.updateGroupMembers=void 0;const t=He,r=nt(),n=Ze(),s=Dt(),i=Yr(),o=ul(),a=tm(),f=Da(),c=vA(),l=un(),u=Tt(),p=er(),d=h=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:y,upsert:m,remove:v,account:b=null,signer:w=null,env:_=n.default.ENV.PROD,pgpPrivateKey:C=null,overrideSecretKeyGeneration:I=!l.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=h;try{(0,s.validateGroupMemberUpdateOptions)(h);const k=(0,s.getWallet)({account:b,signer:w}),E=yield(0,s.getConnectedUserV2Core)(k,C,_,s.PGPHelper),S=Object.entries(m).map(([z,Y])=>t.__awaiter(void 0,void 0,void 0,function*(){const j=yield Promise.all(Y.map(re=>(0,r.convertToValidDID)(re,_)));return[z,j]})),T=Object.fromEntries(yield Promise.all(S)),P=yield Promise.all(v.map(z=>(0,r.convertToValidDID)(z,_)));let g=null;const A=yield(0,o.getGroupInfo)({chatId:y,env:_});if(!A)throw new Error("Group not found");if(!A.isPublic&&(A.encryptedSecret||!I)){const{isMember:z}=yield(0,a.getGroupMemberStatus)({chatId:y,did:E.did,env:_}),Y=yield(0,c.getAllGroupMembersPublicKeys)({chatId:y,env:_}),j=new Set(P.map(V=>V.toLowerCase()));let re=!0;if(Y.map(V=>{j.has(V.did.toLowerCase())&&(re=!1)}),!re||!z){const V=f.generateRandomSecret(15),U=[];Y.map(X=>{j.has(X.did.toLowerCase())||U.push(X.publicKey)}),z||U.push(E.publicKey),g=yield(0,s.pgpEncrypt)({plainText:V,keys:U})}}const x={upsert:T,remove:P,encryptedSecret:g},D=i.SHA256(JSON.stringify(x)).toString(),L=`pgpv2:${yield s.PGPHelper.sign({message:D,signingKey:E.privateKey})}:${E.did}`,R=`${(0,r.getAPIBaseUrls)(_)}/v1/chat/groups/${y}/members`,N={upsert:T,remove:P,encryptedSecret:g,deltaVerificationProof:L};return(yield(0,u.axiosPut)(R,N)).data}catch(k){throw(0,p.handleError)(k,e.updateGroupMembers.name)}});e.updateGroupMembers=d}(l2)),l2}var U4;function bA(){return U4||(U4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addAdmins=void 0;const t=He,r=un(),n=Ze(),s=er(),i=ll(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,admins:c,account:l=null,signer:u=null,env:p=n.default.ENV.PROD,pgpPrivateKey:d=null,overrideSecretKeyGeneration:h=!r.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=a||{};try{if(l==null&&u==null)throw new Error("At least one from account or signer is necessary!");if(!c||c.length===0)throw new Error("Admin address array cannot be empty!");const m={chatId:f,upsert:{members:[],admins:c},remove:[],account:l,signer:u,pgpPrivateKey:d,env:p,overrideSecretKeyGeneration:h};return yield(0,i.updateGroupMembers)(m)}catch(y){throw(0,s.handleError)(y,e.addAdmins.name)}});e.addAdmins=o}(u2)),u2}var L4;function rm(){if(L4)return Ic;L4=1,Object.defineProperty(Ic,"__esModule",{value:!0}),Ic.addSpeakers=void 0;const e=He,t=Ze(),r=Dt(),n=bA(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){var o,a;const{spaceId:f,speakers:c,signer:l=null,env:u=(o=i==null?void 0:i.env)!==null&&o!==void 0?o:t.default.ENV.PROD,pgpPrivateKey:p=(a=i==null?void 0:i.pgpPrivateKey)!==null&&a!==void 0?a:null}=i,d=yield(0,n.addAdmins)({chatId:f,admins:c,signer:l,env:u,pgpPrivateKey:p});return(0,r.groupDtoToSpaceDtoV2)(d,u)});return Ic.addSpeakers=s,Ic}var h2={},p2={},K4;function _A(){return K4||(K4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.removeAdmins=void 0;const t=He,r=un(),n=Ze(),s=er(),i=ll(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,admins:c,account:l=null,signer:u=null,env:p=n.default.ENV.PROD,pgpPrivateKey:d=null,overrideSecretKeyGeneration:h=!r.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=a||{};try{if(l==null&&u==null)throw new Error("At least one from account or signer is necessary!");if(!c||c.length===0)throw new Error("Admin address array cannot be empty!");const y={chatId:f,upsert:{members:[],admins:[]},remove:c,account:l,signer:u,pgpPrivateKey:d,env:p,overrideSecretKeyGeneration:h};return yield(0,i.updateGroupMembers)(y)}catch(y){throw(0,s.handleError)(y,e.removeAdmins.name)}});e.removeAdmins=o}(p2)),p2}var F4;function fV(){return F4||(F4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.removeSpeakers=void 0;const t=He,r=Ze(),n=Dt(),s=_A(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:a,speakers:f,signer:c=null,env:l=r.default.ENV.PROD,pgpPrivateKey:u=null}=o||{};try{const p=yield(0,s.removeAdmins)({chatId:a,admins:f,signer:c,env:l,pgpPrivateKey:u});return(0,n.groupDtoToSpaceDtoV2)(p,l)}catch(p){throw console.error(`[Push SDK] - API - Error - API ${e.removeSpeakers.name} -: `,p),Error(`[Push SDK] - API - Error - API ${e.removeSpeakers.name} -: ${p}`)}});e.removeSpeakers=i}(h2)),h2}var y2={},g2={},q4;function wA(){return q4||(q4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addMembers=void 0;const t=He,r=un(),n=Ze(),s=er(),i=ll(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,members:c,account:l=null,signer:u=null,env:p=n.default.ENV.PROD,pgpPrivateKey:d=null,overrideSecretKeyGeneration:h=!r.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=a||{};try{if(l==null&&u==null)throw new Error("At least one from account or signer is necessary!");if(!c||c.length===0)throw new Error("Member address array cannot be empty!");const m={chatId:f,upsert:{members:c,admins:[]},remove:[],account:l,signer:u,pgpPrivateKey:d,env:p,overrideSecretKeyGeneration:h};return yield(0,i.updateGroupMembers)(m)}catch(y){throw(0,s.handleError)(y,e.addMembers.name)}});e.addMembers=o}(g2)),g2}var j4;function hV(){return j4||(j4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addListeners=void 0;const t=He,r=Ze(),n=Dt(),s=wA(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:a,listeners:f,account:c=null,signer:l=null,env:u=r.default.ENV.PROD,pgpPrivateKey:p=null}=o||{};try{const d=yield(0,s.addMembers)({chatId:a,members:f,account:c,signer:l,env:u,pgpPrivateKey:p});return(0,n.groupDtoToSpaceDtoV2)(d,u)}catch(d){throw console.error(`[Push SDK] - API - Error - API ${e.addListeners.name} -: `,d),Error(`[Push SDK] - API - Error - API ${e.addListeners.name} -: ${d}`)}});e.addListeners=i}(y2)),y2}var m2={},v2={},$4;function EA(){return $4||($4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.removeMembers=void 0;const t=He,r=un(),n=Ze(),s=er(),i=ll(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,members:c,account:l=null,signer:u=null,env:p=n.default.ENV.PROD,pgpPrivateKey:d=null,overrideSecretKeyGeneration:h=!r.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=a||{};try{if(l==null&&u==null)throw new Error("At least one from account or signer is necessary!");if(!c||c.length===0)throw new Error("Member address array cannot be empty!");const y={chatId:f,upsert:{members:[],admins:[]},remove:c,account:l,signer:u,pgpPrivateKey:d,env:p,overrideSecretKeyGeneration:h};return yield(0,i.updateGroupMembers)(y)}catch(y){throw(0,s.handleError)(y,e.removeMembers.name)}});e.removeMembers=o}(v2)),v2}var H4;function pV(){return H4||(H4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.removeListeners=void 0;const t=He,r=Ze(),n=Dt(),s=EA(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:a,listeners:f,account:c=null,signer:l=null,env:u=r.default.ENV.PROD,pgpPrivateKey:p=null}=o||{};try{const d=yield(0,s.removeMembers)({chatId:a,members:f,account:c,signer:l,env:u,pgpPrivateKey:p});return(0,n.groupDtoToSpaceDtoV2)(d,u)}catch(d){throw console.error(`[Push SDK] - API - Error - API ${e.removeListeners.name} -: `,d),Error(`[Push SDK] - API - Error - API ${e.removeListeners.name} -: ${d}`)}});e.removeListeners=i}(m2)),m2}var b2={},_2={},V4;function AA(){return V4||(V4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.approveCore=e.approve=void 0;const t=He,r=nt(),n=Ze(),s=Dt(),i=Yr(),o=Tt(),a=Da(),f=ul(),c=vA(),l=un(),u=er(),p=h=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.approveCore)(h,s.PGPHelper)});e.approve=p;const d=(h,y)=>t.__awaiter(void 0,void 0,void 0,function*(){const{status:m="Approved",account:v=null,signer:b=null,senderAddress:w,env:_=n.default.ENV.PROD,pgpPrivateKey:C=null,overrideSecretKeyGeneration:I=!l.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=h||{};if(v==null&&b==null)throw new Error("At least one from account or signer is necessary!");const k=(0,s.getWallet)({account:v,signer:b}),E=yield(0,s.getAccountAddress)(k),S=!(0,r.isValidPushCAIP)(w),T=yield(0,s.getConnectedUserV2Core)(k,C,_,y),P=S?yield(0,r.convertToValidDID)(E,_):yield(0,r.convertToValidDID)(w,_),g=S?yield(0,r.convertToValidDID)(w,_):yield(0,r.convertToValidDID)(E,_);let A=null,x="pgp";if(S){const F=yield(0,f.getGroupInfo)({chatId:w,env:_});if(F&&!F.isPublic&&(F.encryptedSecret||!I)){x="pgpv2";const z=a.generateRandomSecret(15),j=(yield(0,c.getAllGroupMembersPublicKeys)({chatId:F.chatId,env:_})).map(re=>re.publicKey);j.push(T.publicKey),A=yield y.pgpEncrypt({plainText:z,keys:j})}}let D;switch(x){case"pgp":{D={fromDID:P,toDID:g,status:m};break}case"pgpv2":{D={fromDID:P,toDID:g,status:m,encryptedSecret:A};break}}const O=i.SHA256(JSON.stringify(D)).toString(),B=yield y.sign({message:O,signingKey:T.privateKey}),L=`${x}:${B}`,M={fromDID:P,toDID:g,signature:B,status:m,sigType:x,verificationProof:L,encryptedSecret:A},N=`${(0,r.getAPIBaseUrls)(_)}/v1/chat/request/accept`;return(0,o.axiosPut)(N,M).then(F=>F.data).catch(F=>{throw(0,u.handleError)(F,e.approve.name)})});e.approveCore=d}(_2)),_2}var G4;function SA(){return G4||(G4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.approve=void 0;const t=He,r=nt(),n=Ze(),s=AA(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{status:a="Approved",account:f=null,signer:c=null,senderAddress:l,env:u=n.default.ENV.PROD,pgpPrivateKey:p=null}=o||{};try{if(f==null&&c==null)throw new Error("At least one from account or signer is necessary!");if(!(0,r.isValidPushCAIP)(l)&&!l.startsWith("spaces:"))throw new Error("Not a valid spaceId or ETH address");return yield(0,s.approve)({status:a,account:f,signer:c,senderAddress:l,env:u,pgpPrivateKey:p})}catch(d){throw console.error(`[Push SDK] - API - Error - API ${e.approve.name} -: `,d),Error(`[Push SDK] - API - Error - API ${e.approve.name} -: ${d}`)}});e.approve=i}(b2)),b2}var w2={},z4;function yV(){return z4||(z4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.requests=void 0;const t=He,r=nt(),n=Ze(),s=Dt(),i=Tt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:f,pgpPrivateKey:c,env:l=n.default.ENV.PROD,toDecrypt:u=!1,page:p=1,limit:d=10}=a||{},h=yield(0,r.convertToValidDID)(f,l),m=`${(0,r.getAPIBaseUrls)(l)}/v1/spaces/users/${h}/requests?page=${p}&limit=${d}`;try{if(!(0,r.isValidPushCAIP)(h))throw new Error("Invalid address!");const b=(yield(0,i.axiosGet)(m)).data.requests;return yield(0,s.getSpaceInboxLists)({lists:b,user:h,toDecrypt:u,pgpPrivateKey:c,env:l})}catch(v){throw console.error(`[Push SDK] - API ${e.requests.name}: `,v),Error(`[Push SDK] - API ${e.requests.name}: ${v}`)}});e.requests=o}(w2)),w2}var E2={},A2={},S2={},W4;function gV(){return W4||(W4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.chatsCore=e.chats=void 0;const t=He,r=nt(),n=Ze(),s=Dt(),i=Tt(),o=er(),a=c=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.chatsCore)(c,s.PGPHelper)});e.chats=a;const f=(c,l)=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:u,pgpPrivateKey:p,env:d=n.default.ENV.PROD,toDecrypt:h=!1,page:y=1,limit:m=10}=c||{};if(!(0,r.isValidPushCAIP)(u))throw new Error("Invalid address!");const v=yield(0,r.convertToValidDID)(u,d),_=`${`${(0,r.getAPIBaseUrls)(d)}/v1/chat/users/${v}/chats?page=${y}&limit=${m}`}`;try{const I=(yield(0,i.axiosGet)(_)).data.chats,k=(0,s.addDeprecatedInfo)(I);return yield(0,s.getInboxLists)({lists:k,user:v,toDecrypt:h,pgpPrivateKey:p,env:d},l)}catch(C){throw(0,o.handleError)(C,e.chats.name)}});e.chatsCore=f}(S2)),S2}var P2={},Y4;function mV(){return Y4||(Y4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.chat=void 0;const t=He,r=nt(),n=Ze(),s=Tt(),i=Dt(),o=er(),a=f=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:c,pgpPrivateKey:l,env:u=n.default.ENV.PROD,toDecrypt:p=!1,recipient:d}=f||{},h=yield(0,r.convertToValidDID)(c,u),y=yield(0,r.convertToValidDID)(d,u);if(!(0,r.isValidPushCAIP)(h))throw new Error(`Invalid address ${h}`);const v=`${(0,r.getAPIBaseUrls)(u)}/v1/chat/users/${h}/chat/${y}`;try{const w=(yield(0,s.axiosGet)(v)).data;if(Object.keys(w).length!==0){const _=(0,i.addDeprecatedInfo)([w]),[C]=yield(0,i.getInboxLists)({lists:_,user:h,toDecrypt:p,pgpPrivateKey:l,env:u},i.PGPHelper);return C}else return w}catch(b){throw(0,o.handleError)(b,e.chat.name)}});e.chat=a}(P2)),P2}var x2={},Z4;function vV(){return Z4||(Z4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.requestsCore=e.requests=void 0;const t=He,r=nt(),n=Ze(),s=Tt(),i=Dt(),o=er(),a=c=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.requestsCore)(c,i.PGPHelper)});e.requests=a;const f=(c,l)=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:u,pgpPrivateKey:p,env:d=n.default.ENV.PROD,toDecrypt:h=!1,page:y=1,limit:m=10}=c||{},v=yield(0,r.convertToValidDID)(u,d),w=`${(0,r.getAPIBaseUrls)(d)}/v1/chat/users/${v}/requests?page=${y}&limit=${m}`;try{if(!(0,r.isValidPushCAIP)(v))throw new Error("Invalid address!");const C=(yield(0,s.axiosGet)(w)).data.requests,I=(0,i.addDeprecatedInfo)(C);return yield(0,i.getInboxLists)({lists:I,user:v,toDecrypt:h,pgpPrivateKey:p,env:d},l)}catch(_){throw(0,o.handleError)(_,e.requests.name)}});e.requestsCore=f}(x2)),x2}var T2={},C2={},J4;function PA(){return J4||(J4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.conversationHash=void 0;const t=He,r=Ze(),n=er(),s=nt(),i=Dt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{conversationId:f,account:c,env:l=r.default.ENV.PROD}=a||{};try{if(!(0,s.isValidPushCAIP)(c))throw new Error("Invalid address!");const u=yield(0,s.convertToValidDID)(f,l),p=yield(0,s.convertToValidDID)(c,l);return yield(0,i.getConversationHashService)({conversationId:u,account:p,env:l})}catch(u){throw(0,n.handleError)(u,e.conversationHash.name)}});e.conversationHash=o}(C2)),C2}var Rc={},I2={exports:{}},X4;function bV(){return X4||(X4=1,function(e,t){(function(r,n){e.exports=n()})(self,()=>{return r={7629:(s,i,o)=>{const a=o(375),f=o(8571),c=o(9474),l=o(1687),u=o(8652),p=o(8160),d=o(3292),h=o(6354),y=o(8901),m=o(9708),v=o(6914),b=o(2294),w=o(6133),_=o(1152),C=o(8863),I=o(2036),k={Base:class{constructor(E){this.type=E,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new b.Ids,this._preferences=null,this._refs=new w.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return a(typeof m.describe=="function","Manifest functionality disabled"),m.describe(this)}allow(...E){return p.verifyFlat(E,"allow"),this._values(E,"_valids")}alter(E){a(E&&typeof E=="object"&&!Array.isArray(E),"Invalid targets argument"),a(!this._inRuleset(),"Cannot set alterations inside a ruleset");const S=this.clone();S.$_terms.alterations=S.$_terms.alterations||[];for(const T in E){const P=E[T];a(typeof P=="function","Alteration adjuster for",T,"must be a function"),S.$_terms.alterations.push({target:T,adjuster:P})}return S.$_temp.ruleset=!1,S}artifact(E){return a(E!==void 0,"Artifact cannot be undefined"),a(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",E)}cast(E){return a(E===!1||typeof E=="string","Invalid to value"),a(E===!1||this._definition.cast[E],"Type",this.type,"does not support casting to",E),this.$_setFlag("cast",E===!1?void 0:E)}default(E,S){return this._default("default",E,S)}description(E){return a(E&&typeof E=="string","Description must be a non-empty string"),this.$_setFlag("description",E)}empty(E){const S=this.clone();return E!==void 0&&(E=S.$_compile(E,{override:!1})),S.$_setFlag("empty",E,{clone:!1})}error(E){return a(E,"Missing error"),a(E instanceof Error||typeof E=="function","Must provide a valid Error object or a function"),this.$_setFlag("error",E)}example(E,S={}){return a(E!==void 0,"Missing example"),p.assertOptions(S,["override"]),this._inner("examples",E,{single:!0,override:S.override})}external(E,S){return typeof E=="object"&&(a(!S,"Cannot combine options with description"),S=E.description,E=E.method),a(typeof E=="function","Method must be a function"),a(S===void 0||S&&typeof S=="string","Description must be a non-empty string"),this._inner("externals",{method:E,description:S},{single:!0})}failover(E,S){return this._default("failover",E,S)}forbidden(){return this.presence("forbidden")}id(E){return E?(a(typeof E=="string","id must be a non-empty string"),a(/^[^\.]+$/.test(E),"id cannot contain period character"),this.$_setFlag("id",E)):this.$_setFlag("id",void 0)}invalid(...E){return this._values(E,"_invalids")}label(E){return a(E&&typeof E=="string","Label name must be a non-empty string"),this.$_setFlag("label",E)}meta(E){return a(E!==void 0,"Meta cannot be undefined"),this._inner("metas",E,{single:!0})}note(...E){a(E.length,"Missing notes");for(const S of E)a(S&&typeof S=="string","Notes must be non-empty strings");return this._inner("notes",E)}only(E=!0){return a(typeof E=="boolean","Invalid mode:",E),this.$_setFlag("only",E)}optional(){return this.presence("optional")}prefs(E){a(E,"Missing preferences"),a(E.context===void 0,"Cannot override context"),a(E.externals===void 0,"Cannot override externals"),a(E.warnings===void 0,"Cannot override warnings"),a(E.debug===void 0,"Cannot override debug"),p.checkPreferences(E);const S=this.clone();return S._preferences=p.preferences(S._preferences,E),S}presence(E){return a(["optional","required","forbidden"].includes(E),"Unknown presence mode",E),this.$_setFlag("presence",E)}raw(E=!0){return this.$_setFlag("result",E?"raw":void 0)}result(E){return a(["raw","strip"].includes(E),"Unknown result mode",E),this.$_setFlag("result",E)}required(){return this.presence("required")}strict(E){const S=this.clone(),T=E!==void 0&&!E;return S._preferences=p.preferences(S._preferences,{convert:T}),S}strip(E=!0){return this.$_setFlag("result",E?"strip":void 0)}tag(...E){a(E.length,"Missing tags");for(const S of E)a(S&&typeof S=="string","Tags must be non-empty strings");return this._inner("tags",E)}unit(E){return a(E&&typeof E=="string","Unit name must be a non-empty string"),this.$_setFlag("unit",E)}valid(...E){p.verifyFlat(E,"valid");const S=this.allow(...E);return S.$_setFlag("only",!!S._valids,{clone:!1}),S}when(E,S){const T=this.clone();T.$_terms.whens||(T.$_terms.whens=[]);const P=d.when(T,E,S);if(!["any","link"].includes(T.type)){const g=P.is?[P]:P.switch;for(const A of g)a(!A.then||A.then.type==="any"||A.then.type===T.type,"Cannot combine",T.type,"with",A.then&&A.then.type),a(!A.otherwise||A.otherwise.type==="any"||A.otherwise.type===T.type,"Cannot combine",T.type,"with",A.otherwise&&A.otherwise.type)}return T.$_terms.whens.push(P),T.$_mutateRebuild()}cache(E){a(!this._inRuleset(),"Cannot set caching inside a ruleset"),a(!this._cache,"Cannot override schema cache"),a(this._flags.artifact===void 0,"Cannot cache a rule with an artifact");const S=this.clone();return S._cache=E||u.provider.provision(),S.$_temp.ruleset=!1,S}clone(){const E=Object.create(Object.getPrototypeOf(this));return this._assign(E)}concat(E){a(p.isSchema(E),"Invalid schema object"),a(this.type==="any"||E.type==="any"||E.type===this.type,"Cannot merge type",this.type,"with another type:",E.type),a(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),a(!E._inRuleset(),"Cannot concatenate a schema with open ruleset");let S=this.clone();if(this.type==="any"&&E.type!=="any"){const T=E.clone();for(const P of Object.keys(S))P!=="type"&&(T[P]=S[P]);S=T}S._ids.concat(E._ids),S._refs.register(E,w.toSibling),S._preferences=S._preferences?p.preferences(S._preferences,E._preferences):E._preferences,S._valids=I.merge(S._valids,E._valids,E._invalids),S._invalids=I.merge(S._invalids,E._invalids,E._valids);for(const T of E._singleRules.keys())S._singleRules.has(T)&&(S._rules=S._rules.filter(P=>P.keep||P.name!==T),S._singleRules.delete(T));for(const T of E._rules)E._definition.rules[T.method].multi||S._singleRules.set(T.name,T),S._rules.push(T);if(S._flags.empty&&E._flags.empty){S._flags.empty=S._flags.empty.concat(E._flags.empty);const T=Object.assign({},E._flags);delete T.empty,l(S._flags,T)}else if(E._flags.empty){S._flags.empty=E._flags.empty;const T=Object.assign({},E._flags);delete T.empty,l(S._flags,T)}else l(S._flags,E._flags);for(const T in E.$_terms){const P=E.$_terms[T];P?S.$_terms[T]?S.$_terms[T]=S.$_terms[T].concat(P):S.$_terms[T]=P.slice():S.$_terms[T]||(S.$_terms[T]=P)}return this.$_root._tracer&&this.$_root._tracer._combine(S,[this,E]),S.$_mutateRebuild()}extend(E){return a(!E.base,"Cannot extend type with another base"),y.type(this,E)}extract(E){return E=Array.isArray(E)?E:E.split("."),this._ids.reach(E)}fork(E,S){a(!this._inRuleset(),"Cannot fork inside a ruleset");let T=this;for(let P of[].concat(E))P=Array.isArray(P)?P:P.split("."),T=T._ids.fork(P,S,T);return T.$_temp.ruleset=!1,T}rule(E){const S=this._definition;p.assertOptions(E,Object.keys(S.modifiers)),a(this.$_temp.ruleset!==!1,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const T=this.$_temp.ruleset===null?this._rules.length-1:this.$_temp.ruleset;a(T>=0&&T<this._rules.length,"Cannot apply rules to empty ruleset");const P=this.clone();for(let g=T;g<P._rules.length;++g){const A=P._rules[g],x=f(A);for(const D in E)S.modifiers[D](x,E[D]),a(x.name===A.name,"Cannot change rule name");P._rules[g]=x,P._singleRules.get(x.name)===A&&P._singleRules.set(x.name,x)}return P.$_temp.ruleset=!1,P.$_mutateRebuild()}get ruleset(){a(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const E=this.clone();return E.$_temp.ruleset=E._rules.length,E}get $(){return this.ruleset}tailor(E){E=[].concat(E),a(!this._inRuleset(),"Cannot tailor inside a ruleset");let S=this;if(this.$_terms.alterations)for(const{target:T,adjuster:P}of this.$_terms.alterations)E.includes(T)&&(S=P(S),a(p.isSchema(S),"Alteration adjuster for",T,"failed to return a schema object"));return S=S.$_modify({each:T=>T.tailor(E),ref:!1}),S.$_temp.ruleset=!1,S.$_mutateRebuild()}tracer(){return _.location?_.location(this):this}validate(E,S){return C.entry(E,this,S)}validateAsync(E,S){return C.entryAsync(E,this,S)}$_addRule(E){typeof E=="string"&&(E={name:E}),a(E&&typeof E=="object","Invalid options"),a(E.name&&typeof E.name=="string","Invalid rule name");for(const A in E)a(A[0]!=="_","Cannot set private rule properties");const S=Object.assign({},E);S._resolve=[],S.method=S.method||S.name;const T=this._definition.rules[S.method],P=S.args;a(T,"Unknown rule",S.method);const g=this.clone();if(P){a(Object.keys(P).length===1||Object.keys(P).length===this._definition.rules[S.name].args.length,"Invalid rule definition for",this.type,S.name);for(const A in P){let x=P[A];if(T.argsByName){const D=T.argsByName.get(A);if(D.ref&&p.isResolvable(x))S._resolve.push(A),g.$_mutateRegister(x);else if(D.normalize&&(x=D.normalize(x),P[A]=x),D.assert){const O=p.validateArg(x,A,D);a(!O,O,"or reference")}}x!==void 0?P[A]=x:delete P[A]}}return T.multi||(g._ruleRemove(S.name,{clone:!1}),g._singleRules.set(S.name,S)),g.$_temp.ruleset===!1&&(g.$_temp.ruleset=null),T.priority?g._rules.unshift(S):g._rules.push(S),g}$_compile(E,S){return d.schema(this.$_root,E,S)}$_createError(E,S,T,P,g,A={}){const x=A.flags!==!1?this._flags:{},D=A.messages?v.merge(this._definition.messages,A.messages):this._definition.messages;return new h.Report(E,S,T,x,D,P,g)}$_getFlag(E){return this._flags[E]}$_getRule(E){return this._singleRules.get(E)}$_mapLabels(E){return E=Array.isArray(E)?E:E.split("."),this._ids.labels(E)}$_match(E,S,T,P){(T=Object.assign({},T)).abortEarly=!0,T._externals=!1,S.snapshot();const g=!C.validate(E,this,S,T,P).errors;return S.restore(),g}$_modify(E){return p.assertOptions(E,["each","once","ref","schema"]),b.schema(this,E)||this}$_mutateRebuild(){return a(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(E,{source:S,name:T,path:P,key:g})=>{const A=this._definition[S][T]&&this._definition[S][T].register;A!==!1&&this.$_mutateRegister(E,{family:A,key:g})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(E,{family:S,key:T}={}){this._refs.register(E,S),this._ids.register(E,{key:T})}$_property(E){return this._definition.properties[E]}$_reach(E){return this._ids.reach(E)}$_rootReferences(){return this._refs.roots()}$_setFlag(E,S,T={}){a(E[0]==="_"||!this._inRuleset(),"Cannot set flag inside a ruleset");const P=this._definition.flags[E]||{};if(c(S,P.default)&&(S=void 0),c(S,this._flags[E]))return this;const g=T.clone!==!1?this.clone():this;return S!==void 0?(g._flags[E]=S,g.$_mutateRegister(S)):delete g._flags[E],E[0]!=="_"&&(g.$_temp.ruleset=!1),g}$_parent(E,...S){return this[E][p.symbols.parent].call(this,...S)}$_validate(E,S,T){return C.validate(E,this,S,T)}_assign(E){E.type=this.type,E.$_root=this.$_root,E.$_temp=Object.assign({},this.$_temp),E.$_temp.whens={},E._ids=this._ids.clone(),E._preferences=this._preferences,E._valids=this._valids&&this._valids.clone(),E._invalids=this._invalids&&this._invalids.clone(),E._rules=this._rules.slice(),E._singleRules=f(this._singleRules,{shallow:!0}),E._refs=this._refs.clone(),E._flags=Object.assign({},this._flags),E._cache=null,E.$_terms={};for(const S in this.$_terms)E.$_terms[S]=this.$_terms[S]?this.$_terms[S].slice():null;E.$_super={};for(const S in this.$_super)E.$_super[S]=this._super[S].bind(E);return E}_bare(){const E=this.clone();E._reset();const S=E._definition.terms;for(const T in S){const P=S[T];E.$_terms[T]=P.init}return E.$_mutateRebuild()}_default(E,S,T={}){return p.assertOptions(T,"literal"),a(S!==void 0,"Missing",E,"value"),a(typeof S=="function"||!T.literal,"Only function value supports literal option"),typeof S=="function"&&T.literal&&(S={[p.symbols.literal]:!0,literal:S}),this.$_setFlag(E,S)}_generate(E,S,T){if(!this.$_terms.whens)return{schema:this};const P=[],g=[];for(let D=0;D<this.$_terms.whens.length;++D){const O=this.$_terms.whens[D];if(O.concat){P.push(O.concat),g.push(`${D}.concat`);continue}const B=O.ref?O.ref.resolve(E,S,T):E,L=O.is?[O]:O.switch,M=g.length;for(let R=0;R<L.length;++R){const{is:N,then:F,otherwise:z}=L[R],Y=`${D}${O.switch?"."+R:""}`;if(N.$_match(B,S.nest(N,`${Y}.is`),T)){if(F){const j=S.localize([...S.path,`${Y}.then`],S.ancestors,S.schemas),{schema:re,id:V}=F._generate(E,j,T);P.push(re),g.push(`${Y}.then${V?`(${V})`:""}`);break}}else if(z){const j=S.localize([...S.path,`${Y}.otherwise`],S.ancestors,S.schemas),{schema:re,id:V}=z._generate(E,j,T);P.push(re),g.push(`${Y}.otherwise${V?`(${V})`:""}`);break}}if(O.break&&g.length>M)break}const A=g.join(", ");if(S.mainstay.tracer.debug(S,"rule","when",A),!A)return{schema:this};if(!S.mainstay.tracer.active&&this.$_temp.whens[A])return{schema:this.$_temp.whens[A],id:A};let x=this;this._definition.generate&&(x=this._definition.generate(this,E,S,T));for(const D of P)x=x.concat(D);return this.$_root._tracer&&this.$_root._tracer._combine(x,[this,...P]),this.$_temp.whens[A]=x,{schema:x,id:A}}_inner(E,S,T={}){a(!this._inRuleset(),`Cannot set ${E} inside a ruleset`);const P=this.clone();return P.$_terms[E]&&!T.override||(P.$_terms[E]=[]),T.single?P.$_terms[E].push(S):P.$_terms[E].push(...S),P.$_temp.ruleset=!1,P}_inRuleset(){return this.$_temp.ruleset!==null&&this.$_temp.ruleset!==!1}_ruleRemove(E,S={}){if(!this._singleRules.has(E))return this;const T=S.clone!==!1?this.clone():this;T._singleRules.delete(E);const P=[];for(let g=0;g<T._rules.length;++g){const A=T._rules[g];A.name!==E||A.keep?P.push(A):T._inRuleset()&&g<T.$_temp.ruleset&&--T.$_temp.ruleset}return T._rules=P,T}_values(E,S){p.verifyFlat(E,S.slice(1,-1));const T=this.clone(),P=E[0]===p.symbols.override;if(P&&(E=E.slice(1)),!T[S]&&E.length?T[S]=new I:P&&(T[S]=E.length?new I:null,T.$_mutateRebuild()),!T[S])return T;P&&T[S].override();for(const g of E){a(g!==void 0,"Cannot call allow/valid/invalid with undefined"),a(g!==p.symbols.override,"Override must be the first value");const A=S==="_invalids"?"_valids":"_invalids";T[A]&&(T[A].remove(g),T[A].length||(a(S==="_valids"||!T._flags.only,"Setting invalid value",g,"leaves schema rejecting all values due to previous valid rule"),T[A]=null)),T[S].add(g,T._refs)}return T}}};k.Base.prototype[p.symbols.any]={version:p.version,compile:d.compile,root:"$_root"},k.Base.prototype.isImmutable=!0,k.Base.prototype.deny=k.Base.prototype.invalid,k.Base.prototype.disallow=k.Base.prototype.invalid,k.Base.prototype.equal=k.Base.prototype.valid,k.Base.prototype.exist=k.Base.prototype.required,k.Base.prototype.not=k.Base.prototype.invalid,k.Base.prototype.options=k.Base.prototype.prefs,k.Base.prototype.preferences=k.Base.prototype.prefs,s.exports=new k.Base},8652:(s,i,o)=>{const a=o(375),f=o(8571),c=o(8160),l={max:1e3,supported:new Set(["undefined","boolean","number","string"])};i.provider={provision:u=>new l.Cache(u)},l.Cache=class{constructor(u={}){c.assertOptions(u,["max"]),a(u.max===void 0||u.max&&u.max>0&&isFinite(u.max),"Invalid max cache size"),this._max=u.max||l.max,this._map=new Map,this._list=new l.List}get length(){return this._map.size}set(u,p){if(u!==null&&!l.supported.has(typeof u))return;let d=this._map.get(u);if(d)return d.value=p,void this._list.first(d);d=this._list.unshift({key:u,value:p}),this._map.set(u,d),this._compact()}get(u){const p=this._map.get(u);if(p)return this._list.first(p),f(p.value)}_compact(){if(this._map.size>this._max){const u=this._list.pop();this._map.delete(u.key)}}},l.List=class{constructor(){this.tail=null,this.head=null}unshift(u){return u.next=null,u.prev=this.head,this.head&&(this.head.next=u),this.head=u,this.tail||(this.tail=u),u}first(u){u!==this.head&&(this._remove(u),this.unshift(u))}pop(){return this._remove(this.tail)}_remove(u){const{next:p,prev:d}=u;return p.prev=d,d&&(d.next=p),u===this.tail&&(this.tail=p),u.prev=null,u.next=null,u}}},8160:(s,i,o)=>{const a=o(375),f=o(7916),c=o(5934);let l,u;const p={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};i.version=c.version,i.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},i.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},i.assertOptions=function(d,h,y="Options"){a(d&&typeof d=="object"&&!Array.isArray(d),"Options must be of type object");const m=Object.keys(d).filter(v=>!h.includes(v));a(m.length===0,`${y} contain unknown keys: ${m}`)},i.checkPreferences=function(d){u=u||o(3378);const h=u.preferences.validate(d);if(h.error)throw new f([h.error.details[0].message])},i.compare=function(d,h,y){switch(y){case"=":return d===h;case">":return d>h;case"<":return d<h;case">=":return d>=h;case"<=":return d<=h}},i.default=function(d,h){return d===void 0?h:d},i.isIsoDate=function(d){return p.isoDate.test(d)},i.isNumber=function(d){return typeof d=="number"&&!isNaN(d)},i.isResolvable=function(d){return!!d&&(d[i.symbols.ref]||d[i.symbols.template])},i.isSchema=function(d,h={}){const y=d&&d[i.symbols.any];return!!y&&(a(h.legacy||y.version===i.version,"Cannot mix different versions of joi schemas"),!0)},i.isValues=function(d){return d[i.symbols.values]},i.limit=function(d){return Number.isSafeInteger(d)&&d>=0},i.preferences=function(d,h){l=l||o(6914),d=d||{},h=h||{};const y=Object.assign({},d,h);return h.errors&&d.errors&&(y.errors=Object.assign({},d.errors,h.errors),y.errors.wrap=Object.assign({},d.errors.wrap,h.errors.wrap)),h.messages&&(y.messages=l.compile(h.messages,d.messages)),delete y[i.symbols.prefs],y},i.tryWithPath=function(d,h,y={}){try{return d()}catch(m){throw m.path!==void 0?m.path=h+"."+m.path:m.path=h,y.append&&(m.message=`${m.message} (${m.path})`),m}},i.validateArg=function(d,h,{assert:y,message:m}){if(i.isSchema(y)){const v=y.validate(d);return v.error?v.error.message:void 0}if(!y(d))return h?`${h} ${m}`:m},i.verifyFlat=function(d,h){for(const y of d)a(!Array.isArray(y),"Method no longer accepts array arguments:",h)}},3292:(s,i,o)=>{const a=o(375),f=o(8160),c=o(6133),l={};i.schema=function(u,p,d={}){f.assertOptions(d,["appendPath","override"]);try{return l.schema(u,p,d)}catch(h){throw d.appendPath&&h.path!==void 0&&(h.message=`${h.message} (${h.path})`),h}},l.schema=function(u,p,d){a(p!==void 0,"Invalid undefined schema"),Array.isArray(p)&&(a(p.length,"Invalid empty array schema"),p.length===1&&(p=p[0]));const h=(y,...m)=>d.override!==!1?y.valid(u.override,...m):y.valid(...m);if(l.simple(p))return h(u,p);if(typeof p=="function")return u.custom(p);if(a(typeof p=="object","Invalid schema content:",typeof p),f.isResolvable(p))return h(u,p);if(f.isSchema(p))return p;if(Array.isArray(p)){for(const y of p)if(!l.simple(y))return u.alternatives().try(...p);return h(u,...p)}return p instanceof RegExp?u.string().regex(p):p instanceof Date?h(u.date(),p):(a(Object.getPrototypeOf(p)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),u.object().keys(p))},i.ref=function(u,p){return c.isRef(u)?u:c.create(u,p)},i.compile=function(u,p,d={}){f.assertOptions(d,["legacy"]);const h=p&&p[f.symbols.any];if(h)return a(d.legacy||h.version===f.version,"Cannot mix different versions of joi schemas:",h.version,f.version),p;if(typeof p!="object"||!d.legacy)return i.schema(u,p,{appendPath:!0});const y=l.walk(p);return y?y.compile(y.root,p):i.schema(u,p,{appendPath:!0})},l.walk=function(u){if(typeof u!="object")return null;if(Array.isArray(u)){for(const d of u){const h=l.walk(d);if(h)return h}return null}const p=u[f.symbols.any];if(p)return{root:u[p.root],compile:p.compile};a(Object.getPrototypeOf(u)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const d in u){const h=l.walk(u[d]);if(h)return h}return null},l.simple=function(u){return u===null||["boolean","string","number"].includes(typeof u)},i.when=function(u,p,d){if(d===void 0&&(a(p&&typeof p=="object","Missing options"),d=p,p=c.create(".")),Array.isArray(d)&&(d={switch:d}),f.assertOptions(d,["is","not","then","otherwise","switch","break"]),f.isSchema(p))return a(d.is===void 0,'"is" can not be used with a schema condition'),a(d.not===void 0,'"not" can not be used with a schema condition'),a(d.switch===void 0,'"switch" can not be used with a schema condition'),l.condition(u,{is:p,then:d.then,otherwise:d.otherwise,break:d.break});if(a(c.isRef(p)||typeof p=="string","Invalid condition:",p),a(d.not===void 0||d.is===void 0,'Cannot combine "is" with "not"'),d.switch===void 0){let y=d;d.not!==void 0&&(y={is:d.not,then:d.otherwise,otherwise:d.then,break:d.break});let m=y.is!==void 0?u.$_compile(y.is):u.$_root.invalid(null,!1,0,"").required();return a(y.then!==void 0||y.otherwise!==void 0,'options must have at least one of "then", "otherwise", or "switch"'),a(y.break===void 0||y.then===void 0||y.otherwise===void 0,"Cannot specify then, otherwise, and break all together"),d.is===void 0||c.isRef(d.is)||f.isSchema(d.is)||(m=m.required()),l.condition(u,{ref:i.ref(p),is:m,then:y.then,otherwise:y.otherwise,break:y.break})}a(Array.isArray(d.switch),'"switch" must be an array'),a(d.is===void 0,'Cannot combine "switch" with "is"'),a(d.not===void 0,'Cannot combine "switch" with "not"'),a(d.then===void 0,'Cannot combine "switch" with "then"');const h={ref:i.ref(p),switch:[],break:d.break};for(let y=0;y<d.switch.length;++y){const m=d.switch[y],v=y===d.switch.length-1;f.assertOptions(m,v?["is","then","otherwise"]:["is","then"]),a(m.is!==void 0,'Switch statement missing "is"'),a(m.then!==void 0,'Switch statement missing "then"');const b={is:u.$_compile(m.is),then:u.$_compile(m.then)};if(c.isRef(m.is)||f.isSchema(m.is)||(b.is=b.is.required()),v){a(d.otherwise===void 0||m.otherwise===void 0,'Cannot specify "otherwise" inside and outside a "switch"');const w=d.otherwise!==void 0?d.otherwise:m.otherwise;w!==void 0&&(a(h.break===void 0,"Cannot specify both otherwise and break"),b.otherwise=u.$_compile(w))}h.switch.push(b)}return h},l.condition=function(u,p){for(const d of["then","otherwise"])p[d]===void 0?delete p[d]:p[d]=u.$_compile(p[d]);return p}},6354:(s,i,o)=>{const a=o(5688),f=o(8160),c=o(3328);i.Report=class{constructor(l,u,p,d,h,y,m){if(this.code=l,this.flags=d,this.messages=h,this.path=y.path,this.prefs=m,this.state=y,this.value=u,this.message=null,this.template=null,this.local=p||{},this.local.label=i.label(this.flags,this.state,this.prefs,this.messages),this.value===void 0||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const v=this.path[this.path.length-1];typeof v!="object"&&(this.local.key=v)}}_setTemplate(l){if(this.template=l,!this.flags.label&&this.path.length===0){const u=this._template(this.template,"root");u&&(this.local.label=u)}}toString(){if(this.message)return this.message;const l=this.code;if(!this.prefs.errors.render)return this.code;const u=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return u===void 0?`Error code "${l}" is not defined, your custom type is missing the correct messages definition`:(this.message=u.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(l,u){return i.template(this.value,l,u||this.code,this.state,this.prefs)}},i.path=function(l){let u="";for(const p of l)typeof p!="object"&&(typeof p=="string"?(u&&(u+="."),u+=p):u+=`[${p}]`);return u},i.template=function(l,u,p,d,h){if(!u)return;if(c.isTemplate(u))return p!=="root"?u:null;let y=h.errors.language;if(f.isResolvable(y)&&(y=y.resolve(l,d,h)),y&&u[y]){if(u[y][p]!==void 0)return u[y][p];if(u[y]["*"]!==void 0)return u[y]["*"]}return u[p]?u[p]:u["*"]},i.label=function(l,u,p,d){if(!p.errors.label)return"";if(l.label)return l.label;let h=u.path;return p.errors.label==="key"&&u.path.length>1&&(h=u.path.slice(-1)),i.path(h)||i.template(null,p.messages,"root",u,p)||d&&i.template(null,d,"root",u,p)||"value"},i.process=function(l,u,p){if(!l)return null;const{override:d,message:h,details:y}=i.details(l);if(d)return d;if(p.errors.stack)return new i.ValidationError(h,y,u);const m=Error.stackTraceLimit;Error.stackTraceLimit=0;const v=new i.ValidationError(h,y,u);return Error.stackTraceLimit=m,v},i.details=function(l,u={}){let p=[];const d=[];for(const h of l){if(h instanceof Error){if(u.override!==!1)return{override:h};const m=h.toString();p.push(m),d.push({message:m,type:"override",context:{error:h}});continue}const y=h.toString();p.push(y),d.push({message:y,path:h.path.filter(m=>typeof m!="object"),type:h.code,context:h.local})}return p.length>1&&(p=[...new Set(p)]),{message:p.join(". "),details:d}},i.ValidationError=class extends Error{constructor(l,u,p){super(l),this._original=p,this.details=u}static isError(l){return l instanceof i.ValidationError}},i.ValidationError.prototype.isJoi=!0,i.ValidationError.prototype.name="ValidationError",i.ValidationError.prototype.annotate=a.error},8901:(s,i,o)=>{const a=o(375),f=o(8571),c=o(8160),l=o(6914),u={};i.type=function(p,d){const h=Object.getPrototypeOf(p),y=f(h),m=p._assign(Object.create(y)),v=Object.assign({},d);delete v.base,y._definition=v;const b=h._definition||{};v.messages=l.merge(b.messages,v.messages),v.properties=Object.assign({},b.properties,v.properties),m.type=v.type,v.flags=Object.assign({},b.flags,v.flags);const w=Object.assign({},b.terms);if(v.terms)for(const k in v.terms){const E=v.terms[k];a(m.$_terms[k]===void 0,"Invalid term override for",v.type,k),m.$_terms[k]=E.init,w[k]=E}v.terms=w,v.args||(v.args=b.args),v.prepare=u.prepare(v.prepare,b.prepare),v.coerce&&(typeof v.coerce=="function"&&(v.coerce={method:v.coerce}),v.coerce.from&&!Array.isArray(v.coerce.from)&&(v.coerce={method:v.coerce.method,from:[].concat(v.coerce.from)})),v.coerce=u.coerce(v.coerce,b.coerce),v.validate=u.validate(v.validate,b.validate);const _=Object.assign({},b.rules);if(v.rules)for(const k in v.rules){const E=v.rules[k];a(typeof E=="object","Invalid rule definition for",v.type,k);let S=E.method;if(S===void 0&&(S=function(){return this.$_addRule(k)}),S&&(a(!y[k],"Rule conflict in",v.type,k),y[k]=S),a(!_[k],"Rule conflict in",v.type,k),_[k]=E,E.alias){const T=[].concat(E.alias);for(const P of T)y[P]=E.method}E.args&&(E.argsByName=new Map,E.args=E.args.map(T=>(typeof T=="string"&&(T={name:T}),a(!E.argsByName.has(T.name),"Duplicated argument name",T.name),c.isSchema(T.assert)&&(T.assert=T.assert.strict().label(T.name)),E.argsByName.set(T.name,T),T)))}v.rules=_;const C=Object.assign({},b.modifiers);if(v.modifiers)for(const k in v.modifiers){a(!y[k],"Rule conflict in",v.type,k);const E=v.modifiers[k];a(typeof E=="function","Invalid modifier definition for",v.type,k);const S=function(T){return this.rule({[k]:T})};y[k]=S,C[k]=E}if(v.modifiers=C,v.overrides){y._super=h,m.$_super={};for(const k in v.overrides)a(h[k],"Cannot override missing",k),v.overrides[k][c.symbols.parent]=h[k],m.$_super[k]=h[k].bind(m);Object.assign(y,v.overrides)}v.cast=Object.assign({},b.cast,v.cast);const I=Object.assign({},b.manifest,v.manifest);return I.build=u.build(v.manifest&&v.manifest.build,b.manifest&&b.manifest.build),v.manifest=I,v.rebuild=u.rebuild(v.rebuild,b.rebuild),m},u.build=function(p,d){return p&&d?function(h,y){return d(p(h,y),y)}:p||d},u.coerce=function(p,d){return p&&d?{from:p.from&&d.from?[...new Set([...p.from,...d.from])]:null,method(h,y){let m;if((!d.from||d.from.includes(typeof h))&&(m=d.method(h,y),m)){if(m.errors||m.value===void 0)return m;h=m.value}if(!p.from||p.from.includes(typeof h)){const v=p.method(h,y);if(v)return v}return m}}:p||d},u.prepare=function(p,d){return p&&d?function(h,y){const m=p(h,y);if(m){if(m.errors||m.value===void 0)return m;h=m.value}return d(h,y)||m}:p||d},u.rebuild=function(p,d){return p&&d?function(h){d(h),p(h)}:p||d},u.validate=function(p,d){return p&&d?function(h,y){const m=d(h,y);if(m){if(m.errors&&(!Array.isArray(m.errors)||m.errors.length))return m;h=m.value}return p(h,y)||m}:p||d}},5107:(s,i,o)=>{const a=o(375),f=o(8571),c=o(8652),l=o(8160),u=o(3292),p=o(6354),d=o(8901),h=o(9708),y=o(6133),m=o(3328),v=o(1152);let b;const w={types:{alternatives:o(4946),any:o(8068),array:o(546),boolean:o(4937),date:o(7500),function:o(390),link:o(8785),number:o(3832),object:o(8966),string:o(7417),symbol:o(8826)},aliases:{alt:"alternatives",bool:"boolean",func:"function"},root:function(){const _={_types:new Set(Object.keys(w.types))};for(const C of _._types)_[C]=function(...I){return a(!I.length||["alternatives","link","object"].includes(C),"The",C,"type does not allow arguments"),w.generate(this,w.types[C],I)};for(const C of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])_[C]=function(...I){return this.any()[C](...I)};Object.assign(_,w.methods);for(const C in w.aliases){const I=w.aliases[C];_[C]=_[I]}return _.x=_.expression,v.setup&&v.setup(_),_}};w.methods={ValidationError:p.ValidationError,version:l.version,cache:c.provider,assert(_,C,...I){w.assert(_,C,!0,I)},attempt:(_,C,...I)=>w.assert(_,C,!1,I),build(_){return a(typeof h.build=="function","Manifest functionality disabled"),h.build(this,_)},checkPreferences(_){l.checkPreferences(_)},compile(_,C){return u.compile(this,_,C)},defaults(_){a(typeof _=="function","modifier must be a function");const C=Object.assign({},this);for(const I of C._types){const k=_(C[I]());a(l.isSchema(k),"modifier must return a valid schema object"),C[I]=function(...E){return w.generate(this,k,E)}}return C},expression:(..._)=>new m(..._),extend(..._){l.verifyFlat(_,"extend"),b=b||o(3378),a(_.length,"You need to provide at least one extension"),this.assert(_,b.extensions);const C=Object.assign({},this);C._types=new Set(C._types);for(let I of _){typeof I=="function"&&(I=I(C)),this.assert(I,b.extension);const k=w.expandExtension(I,C);for(const E of k){a(C[E.type]===void 0||C._types.has(E.type),"Cannot override name",E.type);const S=E.base||this.any(),T=d.type(S,E);C._types.add(E.type),C[E.type]=function(...P){return w.generate(this,T,P)}}}return C},isError:p.ValidationError.isError,isExpression:m.isTemplate,isRef:y.isRef,isSchema:l.isSchema,in:(..._)=>y.in(..._),override:l.symbols.override,ref:(..._)=>y.create(..._),types(){const _={};for(const C of this._types)_[C]=this[C]();for(const C in w.aliases)_[C]=this[C]();return _}},w.assert=function(_,C,I,k){const E=k[0]instanceof Error||typeof k[0]=="string"?k[0]:null,S=E!==null?k[1]:k[0],T=C.validate(_,l.preferences({errors:{stack:!0}},S||{}));let P=T.error;if(!P)return T.value;if(E instanceof Error)throw E;const g=I&&typeof P.annotate=="function"?P.annotate():P.message;throw P instanceof p.ValidationError==0&&(P=f(P)),P.message=E?`${E} ${g}`:g,P},w.generate=function(_,C,I){return a(_,"Must be invoked on a Joi instance."),C.$_root=_,C._definition.args&&I.length?C._definition.args(C,...I):C},w.expandExtension=function(_,C){if(typeof _.type=="string")return[_];const I=[];for(const k of C._types)if(_.type.test(k)){const E=Object.assign({},_);E.type=k,E.base=C[k](),I.push(E)}return I},s.exports=w.root()},6914:(s,i,o)=>{const a=o(375),f=o(8571),c=o(3328);i.compile=function(l,u){if(typeof l=="string")return a(!u,"Cannot set single message string"),new c(l);if(c.isTemplate(l))return a(!u,"Cannot set single message template"),l;a(typeof l=="object"&&!Array.isArray(l),"Invalid message options"),u=u?f(u):{};for(let p in l){const d=l[p];if(p==="root"||c.isTemplate(d)){u[p]=d;continue}if(typeof d=="string"){u[p]=new c(d);continue}a(typeof d=="object"&&!Array.isArray(d),"Invalid message for",p);const h=p;for(p in u[h]=u[h]||{},d){const y=d[p];p==="root"||c.isTemplate(y)?u[h][p]=y:(a(typeof y=="string","Invalid message for",p,"in",h),u[h][p]=new c(y))}}return u},i.decompile=function(l){const u={};for(let p in l){const d=l[p];if(p==="root"){u.root=d;continue}if(c.isTemplate(d)){u[p]=d.describe({compact:!0});continue}const h=p;for(p in u[h]={},d){const y=d[p];p!=="root"?u[h][p]=y.describe({compact:!0}):u[h].root=y}}return u},i.merge=function(l,u){if(!l)return i.compile(u);if(!u)return l;if(typeof u=="string")return new c(u);if(c.isTemplate(u))return u;const p=f(l);for(let d in u){const h=u[d];if(d==="root"||c.isTemplate(h)){p[d]=h;continue}if(typeof h=="string"){p[d]=new c(h);continue}a(typeof h=="object"&&!Array.isArray(h),"Invalid message for",d);const y=d;for(d in p[y]=p[y]||{},h){const m=h[d];d==="root"||c.isTemplate(m)?p[y][d]=m:(a(typeof m=="string","Invalid message for",d,"in",y),p[y][d]=new c(m))}}return p}},2294:(s,i,o)=>{const a=o(375),f=o(8160),c=o(6133),l={};i.Ids=l.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const u=new l.Ids;return u._byId=new Map(this._byId),u._byKey=new Map(this._byKey),u._schemaChain=this._schemaChain,u}concat(u){u._schemaChain&&(this._schemaChain=!0);for(const[p,d]of u._byId.entries())a(!this._byKey.has(p),"Schema id conflicts with existing key:",p),this._byId.set(p,d);for(const[p,d]of u._byKey.entries())a(!this._byId.has(p),"Schema key conflicts with existing id:",p),this._byKey.set(p,d)}fork(u,p,d){const h=this._collect(u);h.push({schema:d});const y=h.shift();let m={id:y.id,schema:p(y.schema)};a(f.isSchema(m.schema),"adjuster function failed to return a joi schema type");for(const v of h)m={id:v.id,schema:l.fork(v.schema,m.id,m.schema)};return m.schema}labels(u,p=[]){const d=u[0],h=this._get(d);if(!h)return[...p,...u].join(".");const y=u.slice(1);return p=[...p,h.schema._flags.label||d],y.length?h.schema._ids.labels(y,p):p.join(".")}reach(u,p=[]){const d=u[0],h=this._get(d);a(h,"Schema does not contain path",[...p,...u].join("."));const y=u.slice(1);return y.length?h.schema._ids.reach(y,[...p,d]):h.schema}register(u,{key:p}={}){if(!u||!f.isSchema(u))return;(u.$_property("schemaChain")||u._ids._schemaChain)&&(this._schemaChain=!0);const d=u._flags.id;if(d){const h=this._byId.get(d);a(!h||h.schema===u,"Cannot add different schemas with the same id:",d),a(!this._byKey.has(d),"Schema id conflicts with existing key:",d),this._byId.set(d,{schema:u,id:d})}p&&(a(!this._byKey.has(p),"Schema already contains key:",p),a(!this._byId.has(p),"Schema key conflicts with existing id:",p),this._byKey.set(p,{schema:u,id:p}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(u,p=[],d=[]){const h=u[0],y=this._get(h);a(y,"Schema does not contain path",[...p,...u].join(".")),d=[y,...d];const m=u.slice(1);return m.length?y.schema._ids._collect(m,[...p,h],d):d}_get(u){return this._byId.get(u)||this._byKey.get(u)}},l.fork=function(u,p,d){const h=i.schema(u,{each:(y,{key:m})=>{if(p===(y._flags.id||m))return d},ref:!1});return h?h.$_mutateRebuild():u},i.schema=function(u,p){let d;for(const h in u._flags){if(h[0]==="_")continue;const y=l.scan(u._flags[h],{source:"flags",name:h},p);y!==void 0&&(d=d||u.clone(),d._flags[h]=y)}for(let h=0;h<u._rules.length;++h){const y=u._rules[h],m=l.scan(y.args,{source:"rules",name:y.name},p);if(m!==void 0){d=d||u.clone();const v=Object.assign({},y);v.args=m,d._rules[h]=v,d._singleRules.get(y.name)===y&&d._singleRules.set(y.name,v)}}for(const h in u.$_terms){if(h[0]==="_")continue;const y=l.scan(u.$_terms[h],{source:"terms",name:h},p);y!==void 0&&(d=d||u.clone(),d.$_terms[h]=y)}return d},l.scan=function(u,p,d,h,y){const m=h||[];if(u===null||typeof u!="object")return;let v;if(Array.isArray(u)){for(let b=0;b<u.length;++b){const w=p.source==="terms"&&p.name==="keys"&&u[b].key,_=l.scan(u[b],p,d,[b,...m],w);_!==void 0&&(v=v||u.slice(),v[b]=_)}return v}if(d.schema!==!1&&f.isSchema(u)||d.ref!==!1&&c.isRef(u)){const b=d.each(u,{...p,path:m,key:y});return b===u?void 0:b}for(const b in u){if(b[0]==="_")continue;const w=l.scan(u[b],p,d,[b,...m],y);w!==void 0&&(v=v||Object.assign({},u),v[b]=w)}return v}},6133:(s,i,o)=>{const a=o(375),f=o(8571),c=o(9621),l=o(8160);let u;const p={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};i.create=function(d,h={}){a(typeof d=="string","Invalid reference key:",d),l.assertOptions(h,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),a(!h.prefix||typeof h.prefix=="object","options.prefix must be of type object");const y=Object.assign({},p.defaults,h);delete y.prefix;const m=y.separator,v=p.context(d,m,h.prefix);if(y.type=v.type,d=v.key,y.type==="value")if(v.root&&(a(!m||d[0]!==m,"Cannot specify relative path with root prefix"),y.ancestor="root",d||(d=null)),m&&m===d)d=null,y.ancestor=0;else if(y.ancestor!==void 0)a(!m||!d||d[0]!==m,"Cannot combine prefix with ancestor option");else{const[b,w]=p.ancestor(d,m);w&&(d=d.slice(w))===""&&(d=null),y.ancestor=b}return y.path=m?d===null?[]:d.split(m):[d],new p.Ref(y)},i.in=function(d,h={}){return i.create(d,{...h,in:!0})},i.isRef=function(d){return!!d&&!!d[l.symbols.ref]},p.Ref=class{constructor(d){a(typeof d=="object","Invalid reference construction"),l.assertOptions(d,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),a([!1,void 0].includes(d.separator)||typeof d.separator=="string"&&d.separator.length===1,"Invalid separator"),a(!d.adjust||typeof d.adjust=="function","options.adjust must be a function"),a(!d.map||Array.isArray(d.map),"options.map must be an array"),a(!d.map||!d.adjust,"Cannot set both map and adjust options"),Object.assign(this,p.defaults,d),a(this.type==="value"||this.ancestor===void 0,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(d,h,y,m,v={}){return a(!this.in||v.in,"Invalid in() reference usage"),this.type==="global"?this._resolve(y.context,h,v):this.type==="local"?this._resolve(m,h,v):this.ancestor?this.ancestor==="root"?this._resolve(h.ancestors[h.ancestors.length-1],h,v):(a(this.ancestor<=h.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(h.ancestors[this.ancestor-1],h,v)):this._resolve(d,h,v)}_resolve(d,h,y){let m;if(this.type==="value"&&h.mainstay.shadow&&y.shadow!==!1&&(m=h.mainstay.shadow.get(this.absolute(h))),m===void 0&&(m=c(d,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(m=this.adjust(m)),this.map){const v=this.map.get(m);v!==void 0&&(m=v)}return h.mainstay&&h.mainstay.tracer.resolve(h,this,m),m}toString(){return this.display}absolute(d){return[...d.path.slice(0,-this.ancestor),...this.path]}clone(){return new p.Ref(this)}describe(){const d={path:this.path};this.type!=="value"&&(d.type=this.type),this.separator!=="."&&(d.separator=this.separator),this.type==="value"&&this.ancestor!==1&&(d.ancestor=this.ancestor),this.map&&(d.map=[...this.map]);for(const h of["adjust","iterables","render"])this[h]!==null&&this[h]!==void 0&&(d[h]=this[h]);return this.in!==!1&&(d.in=!0),{ref:d}}updateDisplay(){const d=this.key!==null?this.key:"";if(this.type!=="value")return void(this.display=`ref:${this.type}:${d}`);if(!this.separator)return void(this.display=`ref:${d}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${d}`);if(this.ancestor==="root")return void(this.display=`ref:root:${d}`);if(this.ancestor===1)return void(this.display=`ref:${d||".."}`);const h=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${h}${d||""}`}},p.Ref.prototype[l.symbols.ref]=!0,i.build=function(d){return(d=Object.assign({},p.defaults,d)).type==="value"&&d.ancestor===void 0&&(d.ancestor=1),new p.Ref(d)},p.context=function(d,h,y={}){if(d=d.trim(),y){const m=y.global===void 0?"$":y.global;if(m!==h&&d.startsWith(m))return{key:d.slice(m.length),type:"global"};const v=y.local===void 0?"#":y.local;if(v!==h&&d.startsWith(v))return{key:d.slice(v.length),type:"local"};const b=y.root===void 0?"/":y.root;if(b!==h&&d.startsWith(b))return{key:d.slice(b.length),type:"value",root:!0}}return{key:d,type:"value"}},p.ancestor=function(d,h){if(!h)return[1,0];if(d[0]!==h)return[1,0];if(d[1]!==h)return[0,1];let y=2;for(;d[y]===h;)++y;return[y-1,y]},i.toSibling=0,i.toParent=1,i.Manager=class{constructor(){this.refs=[]}register(d,h){if(d)if(h=h===void 0?i.toParent:h,Array.isArray(d))for(const y of d)this.register(y,h);else if(l.isSchema(d))for(const y of d._refs.refs)y.ancestor-h>=0&&this.refs.push({ancestor:y.ancestor-h,root:y.root});else i.isRef(d)&&d.type==="value"&&d.ancestor-h>=0&&this.refs.push({ancestor:d.ancestor-h,root:d.root}),u=u||o(3328),u.isTemplate(d)&&this.register(d.refs(),h)}get length(){return this.refs.length}clone(){const d=new i.Manager;return d.refs=f(this.refs),d}reset(){this.refs=[]}roots(){return this.refs.filter(d=>!d.ancestor).map(d=>d.root)}}},3378:(s,i,o)=>{const a=o(5107),f={};f.wrap=a.string().min(1).max(2).allow(!1),i.preferences=a.object({allowUnknown:a.boolean(),abortEarly:a.boolean(),artifacts:a.boolean(),cache:a.boolean(),context:a.object(),convert:a.boolean(),dateFormat:a.valid("date","iso","string","time","utc"),debug:a.boolean(),errors:{escapeHtml:a.boolean(),label:a.valid("path","key",!1),language:[a.string(),a.object().ref()],render:a.boolean(),stack:a.boolean(),wrap:{label:f.wrap,array:f.wrap,string:f.wrap}},externals:a.boolean(),messages:a.object(),noDefaults:a.boolean(),nonEnumerables:a.boolean(),presence:a.valid("required","optional","forbidden"),skipFunctions:a.boolean(),stripUnknown:a.object({arrays:a.boolean(),objects:a.boolean()}).or("arrays","objects").allow(!0,!1),warnings:a.boolean()}).strict(),f.nameRx=/^[a-zA-Z0-9]\w*$/,f.rule=a.object({alias:a.array().items(a.string().pattern(f.nameRx)).single(),args:a.array().items(a.string(),a.object({name:a.string().pattern(f.nameRx).required(),ref:a.boolean(),assert:a.alternatives([a.function(),a.object().schema()]).conditional("ref",{is:!0,then:a.required()}),normalize:a.function(),message:a.string().when("assert",{is:a.function(),then:a.required()})})),convert:a.boolean(),manifest:a.boolean(),method:a.function().allow(!1),multi:a.boolean(),validate:a.function()}),i.extension=a.object({type:a.alternatives([a.string(),a.object().regex()]).required(),args:a.function(),cast:a.object().pattern(f.nameRx,a.object({from:a.function().maxArity(1).required(),to:a.function().minArity(1).maxArity(2).required()})),base:a.object().schema().when("type",{is:a.object().regex(),then:a.forbidden()}),coerce:[a.function().maxArity(3),a.object({method:a.function().maxArity(3).required(),from:a.array().items(a.string()).single()})],flags:a.object().pattern(f.nameRx,a.object({setter:a.string(),default:a.any()})),manifest:{build:a.function().arity(2)},messages:[a.object(),a.string()],modifiers:a.object().pattern(f.nameRx,a.function().minArity(1).maxArity(2)),overrides:a.object().pattern(f.nameRx,a.function()),prepare:a.function().maxArity(3),rebuild:a.function().arity(1),rules:a.object().pattern(f.nameRx,f.rule),terms:a.object().pattern(f.nameRx,a.object({init:a.array().allow(null).required(),manifest:a.object().pattern(/.+/,[a.valid("schema","single"),a.object({mapped:a.object({from:a.string().required(),to:a.string().required()}).required()})])})),validate:a.function().maxArity(3)}).strict(),i.extensions=a.array().items(a.object(),a.function().arity(1)).strict(),f.desc={buffer:a.object({buffer:a.string()}),func:a.object({function:a.function().required(),options:{literal:!0}}),override:a.object({override:!0}),ref:a.object({ref:a.object({type:a.valid("value","global","local"),path:a.array().required(),separator:a.string().length(1).allow(!1),ancestor:a.number().min(0).integer().allow("root"),map:a.array().items(a.array().length(2)).min(1),adjust:a.function(),iterables:a.boolean(),in:a.boolean(),render:a.boolean()}).required()}),regex:a.object({regex:a.string().min(3)}),special:a.object({special:a.valid("deep").required()}),template:a.object({template:a.string().required(),options:a.object()}),value:a.object({value:a.alternatives([a.object(),a.array()]).required()})},f.desc.entity=a.alternatives([a.array().items(a.link("...")),a.boolean(),a.function(),a.number(),a.string(),f.desc.buffer,f.desc.func,f.desc.ref,f.desc.regex,f.desc.special,f.desc.template,f.desc.value,a.link("/")]),f.desc.values=a.array().items(null,a.boolean(),a.function(),a.number().allow(1/0,-1/0),a.string().allow(""),a.symbol(),f.desc.buffer,f.desc.func,f.desc.override,f.desc.ref,f.desc.regex,f.desc.template,f.desc.value),f.desc.messages=a.object().pattern(/.+/,[a.string(),f.desc.template,a.object().pattern(/.+/,[a.string(),f.desc.template])]),i.description=a.object({type:a.string().required(),flags:a.object({cast:a.string(),default:a.any(),description:a.string(),empty:a.link("/"),failover:f.desc.entity,id:a.string(),label:a.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:a.boolean(),unit:a.string()}).unknown(),preferences:{allowUnknown:a.boolean(),abortEarly:a.boolean(),artifacts:a.boolean(),cache:a.boolean(),convert:a.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:a.boolean(),label:["path","key"],language:[a.string(),f.desc.ref],wrap:{label:f.wrap,array:f.wrap}},externals:a.boolean(),messages:f.desc.messages,noDefaults:a.boolean(),nonEnumerables:a.boolean(),presence:["required","optional","forbidden"],skipFunctions:a.boolean(),stripUnknown:a.object({arrays:a.boolean(),objects:a.boolean()}).or("arrays","objects").allow(!0,!1),warnings:a.boolean()},allow:f.desc.values,invalid:f.desc.values,rules:a.array().min(1).items({name:a.string().required(),args:a.object().min(1),keep:a.boolean(),message:[a.string(),f.desc.messages],warn:a.boolean()}),keys:a.object().pattern(/.*/,a.link("/")),link:f.desc.ref}).pattern(/^[a-z]\w*$/,a.any())},493:(s,i,o)=>{const a=o(8571),f=o(9621),c=o(8160),l={value:Symbol("value")};s.exports=l.State=class{constructor(u,p,d){this.path=u,this.ancestors=p,this.mainstay=d.mainstay,this.schemas=d.schemas,this.debug=null}localize(u,p=null,d=null){const h=new l.State(u,p,this);return d&&h.schemas&&(h.schemas=[l.schemas(d),...h.schemas]),h}nest(u,p){const d=new l.State(this.path,this.ancestors,this);return d.schemas=d.schemas&&[l.schemas(u),...d.schemas],d.debug=p,d}shadow(u,p){this.mainstay.shadow=this.mainstay.shadow||new l.Shadow,this.mainstay.shadow.set(this.path,u,p)}snapshot(){this.mainstay.shadow&&(this._snapshot=a(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},l.schemas=function(u){return c.isSchema(u)?{schema:u}:u},l.Shadow=class{constructor(){this._values=null}set(u,p,d){if(!u.length||d==="strip"&&typeof u[u.length-1]=="number")return;this._values=this._values||new Map;let h=this._values;for(let y=0;y<u.length;++y){const m=u[y];let v=h.get(m);v||(v=new Map,h.set(m,v)),h=v}h[l.value]=p}get(u){const p=this.node(u);if(p)return p[l.value]}node(u){if(this._values)return f(this._values,u,{iterables:!0})}override(u,p){if(!this._values)return;const d=u.slice(0,-1),h=u[u.length-1],y=f(this._values,d,{iterables:!0});p?y.set(h,p):y&&y.delete(h)}}},3328:(s,i,o)=>{const a=o(375),f=o(8571),c=o(5277),l=o(1447),u=o(8160),p=o(6354),d=o(6133),h={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};s.exports=h.Template=class{constructor(y,m){if(a(typeof y=="string","Template source must be a string"),a(!y.includes("\0")&&!y.includes(""),"Template source cannot contain reserved control characters"),this.source=y,this.rendered=y,this._template=null,m){const{functions:v,...b}=m;this._settings=Object.keys(b).length?f(b):void 0,this._functions=v,this._functions&&(a(Object.keys(this._functions).every(w=>typeof w=="string"),"Functions keys must be strings"),a(Object.values(this._functions).every(w=>typeof w=="function"),"Functions values must be functions"))}else this._settings=void 0,this._functions=void 0;this._parse()}_parse(){if(!this.source.includes("{"))return;const y=h.encode(this.source),m=h.split(y);let v=!1;const b=[],w=m.shift();w&&b.push(w);for(const _ of m){const C=_[0]!=="{",I=C?"}":"}}",k=_.indexOf(I);if(k===-1||_[1]==="{"){b.push(`{${h.decode(_)}`);continue}let E=_.slice(C?0:1,k);const S=E[0]===":";S&&(E=E.slice(1));const T=this._ref(h.decode(E),{raw:C,wrapped:S});b.push(T),typeof T!="string"&&(v=!0);const P=_.slice(k+I.length);P&&b.push(h.decode(P))}v?this._template=b:this.rendered=b.join("")}static date(y,m){return h.dateFormat[m.dateFormat].call(y)}describe(y={}){if(!this._settings&&y.compact)return this.source;const m={template:this.source};return this._settings&&(m.options=this._settings),this._functions&&(m.functions=this._functions),m}static build(y){return new h.Template(y.template,y.options||y.functions?{...y.options,functions:y.functions}:void 0)}isDynamic(){return!!this._template}static isTemplate(y){return!!y&&!!y[u.symbols.template]}refs(){if(!this._template)return;const y=[];for(const m of this._template)typeof m!="string"&&y.push(...m.refs);return y}resolve(y,m,v,b){return this._template&&this._template.length===1?this._part(this._template[0],y,m,v,b,{}):this.render(y,m,v,b)}_part(y,...m){return y.ref?y.ref.resolve(...m):y.formula.evaluate(m)}render(y,m,v,b,w={}){if(!this.isDynamic())return this.rendered;const _=[];for(const C of this._template)if(typeof C=="string")_.push(C);else{const I=this._part(C,y,m,v,b,w),k=h.stringify(I,y,m,v,b,w);if(k!==void 0){const E=C.raw||(w.errors&&w.errors.escapeHtml)===!1?k:c(k);_.push(h.wrap(E,C.wrapped&&v.errors.wrap.label))}}return _.join("")}_ref(y,{raw:m,wrapped:v}){const b=[],w=C=>{const I=d.create(C,this._settings);return b.push(I),k=>{const E=I.resolve(...k);return E!==void 0?E:null}};try{const C=this._functions?{...h.functions,...this._functions}:h.functions;var _=new l.Parser(y,{reference:w,functions:C,constants:h.constants})}catch(C){throw C.message=`Invalid template variable "${y}" fails due to: ${C.message}`,C}if(_.single){if(_.single.type==="reference"){const C=b[0];return{ref:C,raw:m,refs:b,wrapped:v||C.type==="local"&&C.key==="label"}}return h.stringify(_.single.value)}return{formula:_,raw:m,refs:b}}toString(){return this.source}},h.Template.prototype[u.symbols.template]=!0,h.Template.prototype.isImmutable=!0,h.encode=function(y){return y.replace(/\\(\{+)/g,(m,v)=>h.opens.slice(0,v.length)).replace(/\\(\}+)/g,(m,v)=>h.closes.slice(0,v.length))},h.decode=function(y){return y.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},h.split=function(y){const m=[];let v="";for(let b=0;b<y.length;++b){const w=y[b];if(w==="{"){let _="";for(;b+1<y.length&&y[b+1]==="{";)_+="{",++b;m.push(v),v=_}else v+=w}return m.push(v),m},h.wrap=function(y,m){return m?m.length===1?`${m}${y}${m}`:`${m[0]}${y}${m[1]}`:y},h.stringify=function(y,m,v,b,w,_={}){const C=typeof y,I=b&&b.errors&&b.errors.wrap||{};let k=!1;if(d.isRef(y)&&y.render&&(k=y.in,y=y.resolve(m,v,b,w,{in:y.in,..._})),y===null)return"null";if(C==="string")return h.wrap(y,_.arrayItems&&I.string);if(C==="number"||C==="function"||C==="symbol")return y.toString();if(C!=="object")return JSON.stringify(y);if(y instanceof Date)return h.Template.date(y,b);if(y instanceof Map){const S=[];for(const[T,P]of y.entries())S.push(`${T.toString()} -> ${P.toString()}`);y=S}if(!Array.isArray(y))return y.toString();const E=[];for(const S of y)E.push(h.stringify(S,m,v,b,w,{arrayItems:!0,..._}));return h.wrap(E.join(", "),!k&&I.array)},h.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},h.functions={if:(y,m,v)=>y?m:v,length:y=>typeof y=="string"?y.length:y&&typeof y=="object"?Array.isArray(y)?y.length:Object.keys(y).length:null,msg(y){const[m,v,b,w,_]=this,C=_.messages;if(!C)return"";const I=p.template(m,C[0],y,v,b)||p.template(m,C[1],y,v,b);return I?I.render(m,v,b,w,_):""},number:y=>typeof y=="number"?y:typeof y=="string"?parseFloat(y):typeof y=="boolean"?y?1:0:y instanceof Date?y.getTime():null}},4946:(s,i,o)=>{const a=o(375),f=o(1687),c=o(8068),l=o(8160),u=o(3292),p=o(6354),d=o(6133),h={};s.exports=c.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:d.toSibling}},args:(y,...m)=>m.length===1&&Array.isArray(m[0])?y.try(...m[0]):y.try(...m),validate(y,m){const{schema:v,error:b,state:w,prefs:_}=m;if(v._flags.match){const I=[],k=[];for(let S=0;S<v.$_terms.matches.length;++S){const T=v.$_terms.matches[S],P=w.nest(T.schema,`match.${S}`);P.snapshot();const g=T.schema.$_validate(y,P,_);g.errors?(k.push(g.errors),P.restore()):(I.push(g.value),P.commit())}if(I.length===0)return{errors:b("alternatives.any",{details:k.map(S=>p.details(S,{override:!1}))})};if(v._flags.match==="one")return I.length===1?{value:I[0]}:{errors:b("alternatives.one")};if(I.length!==v.$_terms.matches.length)return{errors:b("alternatives.all",{details:k.map(S=>p.details(S,{override:!1}))})};const E=S=>S.$_terms.matches.some(T=>T.schema.type==="object"||T.schema.type==="alternatives"&&E(T.schema));return E(v)?{value:I.reduce((S,T)=>f(S,T,{mergeArrays:!1}))}:{value:I[I.length-1]}}const C=[];for(let I=0;I<v.$_terms.matches.length;++I){const k=v.$_terms.matches[I];if(k.schema){const T=w.nest(k.schema,`match.${I}`);T.snapshot();const P=k.schema.$_validate(y,T,_);if(!P.errors)return T.commit(),P;T.restore(),C.push({schema:k.schema,reports:P.errors});continue}const E=k.ref?k.ref.resolve(y,w,_):y,S=k.is?[k]:k.switch;for(let T=0;T<S.length;++T){const P=S[T],{is:g,then:A,otherwise:x}=P,D=`match.${I}${k.switch?"."+T:""}`;if(g.$_match(E,w.nest(g,`${D}.is`),_)){if(A)return A.$_validate(y,w.nest(A,`${D}.then`),_)}else if(x)return x.$_validate(y,w.nest(x,`${D}.otherwise`),_)}}return h.errors(C,m)},rules:{conditional:{method(y,m){a(!this._flags._endedSwitch,"Unreachable condition"),a(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),a(m.break===void 0,"Cannot use break option with alternatives conditional");const v=this.clone(),b=u.when(v,y,m),w=b.is?[b]:b.switch;for(const _ of w)if(_.then&&_.otherwise){v.$_setFlag("_endedSwitch",!0,{clone:!1});break}return v.$_terms.matches.push(b),v.$_mutateRebuild()}},match:{method(y){if(a(["any","one","all"].includes(y),"Invalid alternatives match mode",y),y!=="any")for(const m of this.$_terms.matches)a(m.schema,"Cannot combine match mode",y,"with conditional rules");return this.$_setFlag("match",y)}},try:{method(...y){a(y.length,"Missing alternative schemas"),l.verifyFlat(y,"try"),a(!this._flags._endedSwitch,"Unreachable condition");const m=this.clone();for(const v of y)m.$_terms.matches.push({schema:m.$_compile(v)});return m.$_mutateRebuild()}}},overrides:{label(y){return this.$_parent("label",y).$_modify({each:(m,v)=>v.path[0]!=="is"&&typeof m._flags.label!="string"?m.label(y):void 0,ref:!1})}},rebuild(y){y.$_modify({each:m=>{l.isSchema(m)&&m.type==="array"&&y.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(y,m){if(m.matches)for(const v of m.matches){const{schema:b,ref:w,is:_,not:C,then:I,otherwise:k}=v;y=b?y.try(b):w?y.conditional(w,{is:_,then:I,not:C,otherwise:k,switch:v.switch}):y.conditional(_,{then:I,otherwise:k})}return y}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),h.errors=function(y,{error:m,state:v}){if(!y.length)return{errors:m("alternatives.any")};if(y.length===1)return{errors:y[0].reports};const b=new Set,w=[];for(const{reports:_,schema:C}of y){if(_.length>1)return h.unmatched(y,m);const I=_[0];if(I instanceof p.Report==0)return h.unmatched(y,m);if(I.state.path.length!==v.path.length){w.push({type:C.type,report:I});continue}if(I.code==="any.only"){for(const S of I.local.valids)b.add(S);continue}const[k,E]=I.code.split(".");E!=="base"?w.push({type:C.type,report:I}):I.code==="object.base"?b.add(I.local.type):b.add(k)}return w.length?w.length===1?{errors:w[0].report}:h.unmatched(y,m):{errors:m("alternatives.types",{types:[...b]})}},h.unmatched=function(y,m){const v=[];for(const b of y)v.push(...b.reports);return{errors:m("alternatives.match",p.details(v,{override:!1}))}}},8068:(s,i,o)=>{const a=o(375),f=o(7629),c=o(8160),l=o(6914);s.exports=f.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(u,p){return a(typeof u=="function","Method must be a function"),a(p===void 0||p&&typeof p=="string","Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:u,description:p}})},validate(u,p,{method:d}){try{return d(u,p)}catch(h){return p.error("any.custom",{error:h})}},args:["method","description"],multi:!0},messages:{method(u){return this.prefs({messages:u})}},shared:{method(u){a(c.isSchema(u)&&u._flags.id,"Schema must be a schema with an id");const p=this.clone();return p.$_terms.shared=p.$_terms.shared||[],p.$_terms.shared.push(u),p.$_mutateRegister(u),p}},warning:{method(u,p){return a(u&&typeof u=="string","Invalid warning code"),this.$_addRule({name:"warning",args:{code:u,local:p},warn:!0})},validate:(u,p,{code:d,local:h})=>p.error(d,h),args:["code","local"],multi:!0}},modifiers:{keep(u,p=!0){u.keep=p},message(u,p){u.message=l.compile(p)},warn(u,p=!0){u.warn=p}},manifest:{build(u,p){for(const d in p){const h=p[d];if(["examples","externals","metas","notes","tags"].includes(d))for(const y of h)u=u[d.slice(0,-1)](y);else if(d!=="alterations")if(d!=="whens"){if(d==="shared")for(const y of h)u=u.shared(y)}else for(const y of h){const{ref:m,is:v,not:b,then:w,otherwise:_,concat:C}=y;u=C?u.concat(C):m?u.when(m,{is:v,not:b,then:w,otherwise:_,switch:y.switch,break:y.break}):u.when(v,{then:w,otherwise:_,break:y.break})}else{const y={};for(const{target:m,adjuster:v}of h)y[m]=v;u=u.alter(y)}}return u}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},546:(s,i,o)=>{const a=o(375),f=o(9474),c=o(9621),l=o(8068),u=o(8160),p=o(3292),d={};s.exports=l.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(h,{schema:y,state:m,prefs:v}){if(!Array.isArray(h))return;const b=y.$_getRule("sort");return b?d.sort(y,h,b.args.options,m,v):void 0}},validate(h,{schema:y,error:m}){if(!Array.isArray(h)){if(y._flags.single){const v=[h];return v[u.symbols.arraySingle]=!0,{value:v}}return{errors:m("array.base")}}if(y.$_getRule("items")||y.$_terms.externals)return{value:h.slice()}},rules:{has:{method(h){h=this.$_compile(h,{appendPath:!0});const y=this.$_addRule({name:"has",args:{schema:h}});return y.$_mutateRegister(h),y},validate(h,{state:y,prefs:m,error:v},{schema:b}){const w=[h,...y.ancestors];for(let C=0;C<h.length;++C){const I=y.localize([...y.path,C],w,b);if(b.$_match(h[C],I,m))return h}const _=b._flags.label;return _?v("array.hasKnown",{patternLabel:_}):v("array.hasUnknown",null)},multi:!0},items:{method(...h){u.verifyFlat(h,"items");const y=this.$_addRule("items");for(let m=0;m<h.length;++m){const v=u.tryWithPath(()=>this.$_compile(h[m]),m,{append:!0});y.$_terms.items.push(v)}return y.$_mutateRebuild()},validate(h,{schema:y,error:m,state:v,prefs:b,errorsArray:w}){const _=y.$_terms._requireds.slice(),C=y.$_terms.ordered.slice(),I=[...y.$_terms._inclusions,..._],k=!h[u.symbols.arraySingle];delete h[u.symbols.arraySingle];const E=w();let S=h.length;for(let T=0;T<S;++T){const P=h[T];let g=!1,A=!1;const x=k?T:new Number(T),D=[...v.path,x];if(!y._flags.sparse&&P===void 0){if(E.push(m("array.sparse",{key:x,path:D,pos:T,value:void 0},v.localize(D))),b.abortEarly)return E;C.shift();continue}const O=[h,...v.ancestors];for(const R of y.$_terms._exclusions)if(R.$_match(P,v.localize(D,O,R),b,{presence:"ignore"})){if(E.push(m("array.excludes",{pos:T,value:P},v.localize(D))),b.abortEarly)return E;g=!0,C.shift();break}if(g)continue;if(y.$_terms.ordered.length){if(C.length){const R=C.shift(),N=R.$_validate(P,v.localize(D,O,R),b);if(N.errors){if(E.push(...N.errors),b.abortEarly)return E}else if(R._flags.result==="strip")d.fastSplice(h,T),--T,--S;else{if(!y._flags.sparse&&N.value===void 0){if(E.push(m("array.sparse",{key:x,path:D,pos:T,value:void 0},v.localize(D))),b.abortEarly)return E;continue}h[T]=N.value}continue}if(!y.$_terms.items.length){if(E.push(m("array.orderedLength",{pos:T,limit:y.$_terms.ordered.length})),b.abortEarly)return E;break}}const B=[];let L=_.length;for(let R=0;R<L;++R){const N=v.localize(D,O,_[R]);N.snapshot();const F=_[R].$_validate(P,N,b);if(B[R]=F,!F.errors){if(N.commit(),h[T]=F.value,A=!0,d.fastSplice(_,R),--R,--L,!y._flags.sparse&&F.value===void 0&&(E.push(m("array.sparse",{key:x,path:D,pos:T,value:void 0},v.localize(D))),b.abortEarly))return E;break}N.restore()}if(A)continue;const M=b.stripUnknown&&!!b.stripUnknown.arrays||!1;L=I.length;for(const R of I){let N;const F=_.indexOf(R);if(F!==-1)N=B[F];else{const z=v.localize(D,O,R);if(z.snapshot(),N=R.$_validate(P,z,b),!N.errors){z.commit(),R._flags.result==="strip"?(d.fastSplice(h,T),--T,--S):y._flags.sparse||N.value!==void 0?h[T]=N.value:(E.push(m("array.sparse",{key:x,path:D,pos:T,value:void 0},v.localize(D))),g=!0),A=!0;break}z.restore()}if(L===1){if(M){d.fastSplice(h,T),--T,--S,A=!0;break}if(E.push(...N.errors),b.abortEarly)return E;g=!0;break}}if(!g&&(y.$_terms._inclusions.length||y.$_terms._requireds.length)&&!A){if(M){d.fastSplice(h,T),--T,--S;continue}if(E.push(m("array.includes",{pos:T,value:P},v.localize(D))),b.abortEarly)return E}}return _.length&&d.fillMissedErrors(y,E,_,h,v,b),C.length&&(d.fillOrderedErrors(y,E,C,h,v,b),E.length||d.fillDefault(C,h,v,b)),E.length?E:h},priority:!0,manifest:!1},length:{method(h){return this.$_addRule({name:"length",args:{limit:h},operator:"="})},validate:(h,y,{limit:m},{name:v,operator:b,args:w})=>u.compare(h.length,m,b)?h:y.error("array."+v,{limit:w.limit,value:h}),args:[{name:"limit",ref:!0,assert:u.limit,message:"must be a positive integer"}]},max:{method(h){return this.$_addRule({name:"max",method:"length",args:{limit:h},operator:"<="})}},min:{method(h){return this.$_addRule({name:"min",method:"length",args:{limit:h},operator:">="})}},ordered:{method(...h){u.verifyFlat(h,"ordered");const y=this.$_addRule("items");for(let m=0;m<h.length;++m){const v=u.tryWithPath(()=>this.$_compile(h[m]),m,{append:!0});d.validateSingle(v,y),y.$_mutateRegister(v),y.$_terms.ordered.push(v)}return y.$_mutateRebuild()}},single:{method(h){const y=h===void 0||!!h;return a(!y||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",y)}},sort:{method(h={}){u.assertOptions(h,["by","order"]);const y={order:h.order||"ascending"};return h.by&&(y.by=p.ref(h.by,{ancestor:0}),a(!y.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:y}})},validate(h,{error:y,state:m,prefs:v,schema:b},{options:w}){const{value:_,errors:C}=d.sort(b,h,w,m,v);if(C)return C;for(let I=0;I<h.length;++I)if(h[I]!==_[I])return y("array.sort",{order:w.order,by:w.by?w.by.key:"value"});return h},convert:!0},sparse:{method(h){const y=h===void 0||!!h;return this._flags.sparse===y?this:(y?this.clone():this.$_addRule("items")).$_setFlag("sparse",y,{clone:!1})}},unique:{method(h,y={}){a(!h||typeof h=="function"||typeof h=="string","comparator must be a function or a string"),u.assertOptions(y,["ignoreUndefined","separator"]);const m={name:"unique",args:{options:y,comparator:h}};if(h)if(typeof h=="string"){const v=u.default(y.separator,".");m.path=v?h.split(v):[h]}else m.comparator=h;return this.$_addRule(m)},validate(h,{state:y,error:m,schema:v},{comparator:b,options:w},{comparator:_,path:C}){const I={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),bigint:Object.create(null),object:new Map,function:new Map,custom:new Map},k=_||f,E=w.ignoreUndefined;for(let S=0;S<h.length;++S){const T=C?c(h[S],C):h[S],P=_?I.custom:I[typeof T];if(a(P,"Failed to find unique map container for type",typeof T),P instanceof Map){const g=P.entries();let A;for(;!(A=g.next()).done;)if(k(A.value[0],T)){const x=y.localize([...y.path,S],[h,...y.ancestors]),D={pos:S,value:h[S],dupePos:A.value[1],dupeValue:h[A.value[1]]};return C&&(D.path=b),m("array.unique",D,x)}P.set(T,S)}else{if((!E||T!==void 0)&&P[T]!==void 0){const g={pos:S,value:h[S],dupePos:P[T],dupeValue:h[P[T]]};return C&&(g.path=b),m("array.unique",g,y.localize([...y.path,S],[h,...y.ancestors]))}P[T]=S}}return h},args:["comparator","options"],multi:!0}},cast:{set:{from:Array.isArray,to:(h,y)=>new Set(h)}},rebuild(h){h.$_terms._inclusions=[],h.$_terms._exclusions=[],h.$_terms._requireds=[];for(const y of h.$_terms.items)d.validateSingle(y,h),y._flags.presence==="required"?h.$_terms._requireds.push(y):y._flags.presence==="forbidden"?h.$_terms._exclusions.push(y):h.$_terms._inclusions.push(y);for(const y of h.$_terms.ordered)d.validateSingle(y,h)},manifest:{build:(h,y)=>(y.items&&(h=h.items(...y.items)),y.ordered&&(h=h.ordered(...y.ordered)),h)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),d.fillMissedErrors=function(h,y,m,v,b,w){const _=[];let C=0;for(const I of m){const k=I._flags.label;k?_.push(k):++C}_.length?C?y.push(h.$_createError("array.includesRequiredBoth",v,{knownMisses:_,unknownMisses:C},b,w)):y.push(h.$_createError("array.includesRequiredKnowns",v,{knownMisses:_},b,w)):y.push(h.$_createError("array.includesRequiredUnknowns",v,{unknownMisses:C},b,w))},d.fillOrderedErrors=function(h,y,m,v,b,w){const _=[];for(const C of m)C._flags.presence==="required"&&_.push(C);_.length&&d.fillMissedErrors(h,y,_,v,b,w)},d.fillDefault=function(h,y,m,v){const b=[];let w=!0;for(let _=h.length-1;_>=0;--_){const C=h[_],I=[y,...m.ancestors],k=C.$_validate(void 0,m.localize(m.path,I,C),v).value;if(w){if(k===void 0)continue;w=!1}b.unshift(k)}b.length&&y.push(...b)},d.fastSplice=function(h,y){let m=y;for(;m<h.length;)h[m++]=h[m];--h.length},d.validateSingle=function(h,y){(h.type==="array"||h._flags._arrayItems)&&(a(!y._flags.single,"Cannot specify array item with single rule enabled"),y.$_setFlag("_arrayItems",!0,{clone:!1}))},d.sort=function(h,y,m,v,b){const w=m.order==="ascending"?1:-1,_=-1*w,C=w,I=(k,E)=>{let S=d.compare(k,E,_,C);if(S!==null||(m.by&&(k=m.by.resolve(k,v,b),E=m.by.resolve(E,v,b)),S=d.compare(k,E,_,C),S!==null))return S;const T=typeof k;if(T!==typeof E)throw h.$_createError("array.sort.mismatching",y,null,v,b);if(T!=="number"&&T!=="string")throw h.$_createError("array.sort.unsupported",y,{type:T},v,b);return T==="number"?(k-E)*w:k<E?_:C};try{return{value:y.slice().sort(I)}}catch(k){return{errors:k}}},d.compare=function(h,y,m,v){return h===y?0:h===void 0?1:y===void 0?-1:h===null?v:y===null?m:null}},4937:(s,i,o)=>{const a=o(375),f=o(8068),c=o(8160),l=o(2036),u={isBool:function(p){return typeof p=="boolean"}};s.exports=f.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(p,{schema:d}){if(typeof p!="boolean"){if(typeof p=="string"){const h=d._flags.sensitive?p:p.toLowerCase();p=h==="true"||h!=="false"&&p}return typeof p!="boolean"&&(p=d.$_terms.truthy&&d.$_terms.truthy.has(p,null,null,!d._flags.sensitive)||(!d.$_terms.falsy||!d.$_terms.falsy.has(p,null,null,!d._flags.sensitive))&&p),{value:p}}},validate(p,{error:d}){if(typeof p!="boolean")return{value:p,errors:d("boolean.base")}},rules:{truthy:{method(...p){c.verifyFlat(p,"truthy");const d=this.clone();d.$_terms.truthy=d.$_terms.truthy||new l;for(let h=0;h<p.length;++h){const y=p[h];a(y!==void 0,"Cannot call truthy with undefined"),d.$_terms.truthy.add(y)}return d}},falsy:{method(...p){c.verifyFlat(p,"falsy");const d=this.clone();d.$_terms.falsy=d.$_terms.falsy||new l;for(let h=0;h<p.length;++h){const y=p[h];a(y!==void 0,"Cannot call falsy with undefined"),d.$_terms.falsy.add(y)}return d}},sensitive:{method(p=!0){return this.$_setFlag("sensitive",p)}}},cast:{number:{from:u.isBool,to:(p,d)=>p?1:0},string:{from:u.isBool,to:(p,d)=>p?"true":"false"}},manifest:{build:(p,d)=>(d.truthy&&(p=p.truthy(...d.truthy)),d.falsy&&(p=p.falsy(...d.falsy)),p)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},7500:(s,i,o)=>{const a=o(375),f=o(8068),c=o(8160),l=o(3328),u={isDate:function(p){return p instanceof Date}};s.exports=f.extend({type:"date",coerce:{from:["number","string"],method:(p,{schema:d})=>({value:u.parse(p,d._flags.format)||p})},validate(p,{schema:d,error:h,prefs:y}){if(p instanceof Date&&!isNaN(p.getTime()))return;const m=d._flags.format;return y.convert&&m&&typeof p=="string"?{value:p,errors:h("date.format",{format:m})}:{value:p,errors:h("date.base")}},rules:{compare:{method:!1,validate(p,d,{date:h},{name:y,operator:m,args:v}){const b=h==="now"?Date.now():h.getTime();return c.compare(p.getTime(),b,m)?p:d.error("date."+y,{limit:v.date,value:p})},args:[{name:"date",ref:!0,normalize:p=>p==="now"?p:u.parse(p),assert:p=>p!==null,message:"must have a valid date format"}]},format:{method(p){return a(["iso","javascript","unix"].includes(p),"Unknown date format",p),this.$_setFlag("format",p)}},greater:{method(p){return this.$_addRule({name:"greater",method:"compare",args:{date:p},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(p){return this.$_addRule({name:"less",method:"compare",args:{date:p},operator:"<"})}},max:{method(p){return this.$_addRule({name:"max",method:"compare",args:{date:p},operator:"<="})}},min:{method(p){return this.$_addRule({name:"min",method:"compare",args:{date:p},operator:">="})}},timestamp:{method(p="javascript"){return a(["javascript","unix"].includes(p),'"type" must be one of "javascript, unix"'),this.format(p)}}},cast:{number:{from:u.isDate,to:(p,d)=>p.getTime()},string:{from:u.isDate,to:(p,{prefs:d})=>l.date(p,d)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),u.parse=function(p,d){if(p instanceof Date)return p;if(typeof p!="string"&&(isNaN(p)||!isFinite(p))||/^\s*$/.test(p))return null;if(d==="iso")return c.isIsoDate(p)?u.date(p.toString()):null;const h=p;if(typeof p=="string"&&/^[+-]?\d+(\.\d+)?$/.test(p)&&(p=parseFloat(p)),d){if(d==="javascript")return u.date(1*p);if(d==="unix")return u.date(1e3*p);if(typeof h=="string")return null}return u.date(p)},u.date=function(p){const d=new Date(p);return isNaN(d.getTime())?null:d}},390:(s,i,o)=>{const a=o(375),f=o(7824);s.exports=f.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(c){return a(Number.isSafeInteger(c)&&c>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:c}})},validate:(c,l,{n:u})=>c.length===u?c:l.error("function.arity",{n:u})},class:{method(){return this.$_addRule("class")},validate:(c,l)=>/^\s*class\s/.test(c.toString())?c:l.error("function.class",{value:c})},minArity:{method(c){return a(Number.isSafeInteger(c)&&c>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:c}})},validate:(c,l,{n:u})=>c.length>=u?c:l.error("function.minArity",{n:u})},maxArity:{method(c){return a(Number.isSafeInteger(c)&&c>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:c}})},validate:(c,l,{n:u})=>c.length<=u?c:l.error("function.maxArity",{n:u})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},7824:(s,i,o)=>{const a=o(978),f=o(375),c=o(8571),l=o(3652),u=o(8068),p=o(8160),d=o(3292),h=o(6354),y=o(6133),m=o(3328),v={renameDefaults:{alias:!1,multiple:!1,override:!1}};s.exports=u.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:void 0}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(b,w)=>b.keys(w),validate(b,{schema:w,error:_,state:C,prefs:I}){if(!b||typeof b!==w.$_property("typeof")||Array.isArray(b))return{value:b,errors:_("object.base",{type:w.$_property("typeof")})};if(!(w.$_terms.renames||w.$_terms.dependencies||w.$_terms.keys||w.$_terms.patterns||w.$_terms.externals))return;b=v.clone(b,I);const k=[];if(w.$_terms.renames&&!v.rename(w,b,C,I,k))return{value:b,errors:k};if(!w.$_terms.keys&&!w.$_terms.patterns&&!w.$_terms.dependencies)return{value:b,errors:k};const E=new Set(Object.keys(b));if(w.$_terms.keys){const S=[b,...C.ancestors];for(const T of w.$_terms.keys){const P=T.key,g=b[P];E.delete(P);const A=C.localize([...C.path,P],S,T),x=T.schema.$_validate(g,A,I);if(x.errors){if(I.abortEarly)return{value:b,errors:x.errors};x.value!==void 0&&(b[P]=x.value),k.push(...x.errors)}else T.schema._flags.result==="strip"||x.value===void 0&&g!==void 0?delete b[P]:x.value!==void 0&&(b[P]=x.value)}}if(E.size||w._flags._hasPatternMatch){const S=v.unknown(w,b,E,k,C,I);if(S)return S}if(w.$_terms.dependencies)for(const S of w.$_terms.dependencies){if(S.key!==null&&v.isPresent(S.options)(S.key.resolve(b,C,I,null,{shadow:!1}))===!1)continue;const T=v.dependencies[S.rel](w,S,b,C,I);if(T){const P=w.$_createError(T.code,b,T.context,C,I);if(I.abortEarly)return{value:b,errors:P};k.push(P)}}return{value:b,errors:k}},rules:{and:{method(...b){return p.verifyFlat(b,"and"),v.dependency(this,"and",null,b)}},append:{method(b){return b==null||Object.keys(b).length===0?this:this.keys(b)}},assert:{method(b,w,_){m.isTemplate(b)||(b=d.ref(b)),f(_===void 0||typeof _=="string","Message must be a string"),w=this.$_compile(w,{appendPath:!0});const C=this.$_addRule({name:"assert",args:{subject:b,schema:w,message:_}});return C.$_mutateRegister(b),C.$_mutateRegister(w),C},validate(b,{error:w,prefs:_,state:C},{subject:I,schema:k,message:E}){const S=I.resolve(b,C,_),T=y.isRef(I)?I.absolute(C):[];return k.$_match(S,C.localize(T,[b,...C.ancestors],k),_)?b:w("object.assert",{subject:I,message:E})},args:["subject","schema","message"],multi:!0},instance:{method(b,w){return f(typeof b=="function","constructor must be a function"),w=w||b.name,this.$_addRule({name:"instance",args:{constructor:b,name:w}})},validate:(b,w,{constructor:_,name:C})=>b instanceof _?b:w.error("object.instance",{type:C,value:b}),args:["constructor","name"]},keys:{method(b){f(b===void 0||typeof b=="object","Object schema must be a valid object"),f(!p.isSchema(b),"Object schema cannot be a joi schema");const w=this.clone();if(b)if(Object.keys(b).length){w.$_terms.keys=w.$_terms.keys?w.$_terms.keys.filter(_=>!b.hasOwnProperty(_.key)):new v.Keys;for(const _ in b)p.tryWithPath(()=>w.$_terms.keys.push({key:_,schema:this.$_compile(b[_])}),_)}else w.$_terms.keys=new v.Keys;else w.$_terms.keys=null;return w.$_mutateRebuild()}},length:{method(b){return this.$_addRule({name:"length",args:{limit:b},operator:"="})},validate:(b,w,{limit:_},{name:C,operator:I,args:k})=>p.compare(Object.keys(b).length,_,I)?b:w.error("object."+C,{limit:k.limit,value:b}),args:[{name:"limit",ref:!0,assert:p.limit,message:"must be a positive integer"}]},max:{method(b){return this.$_addRule({name:"max",method:"length",args:{limit:b},operator:"<="})}},min:{method(b){return this.$_addRule({name:"min",method:"length",args:{limit:b},operator:">="})}},nand:{method(...b){return p.verifyFlat(b,"nand"),v.dependency(this,"nand",null,b)}},or:{method(...b){return p.verifyFlat(b,"or"),v.dependency(this,"or",null,b)}},oxor:{method(...b){return v.dependency(this,"oxor",null,b)}},pattern:{method(b,w,_={}){const C=b instanceof RegExp;C||(b=this.$_compile(b,{appendPath:!0})),f(w!==void 0,"Invalid rule"),p.assertOptions(_,["fallthrough","matches"]),C&&f(!b.flags.includes("g")&&!b.flags.includes("y"),"pattern should not use global or sticky mode"),w=this.$_compile(w,{appendPath:!0});const I=this.clone();I.$_terms.patterns=I.$_terms.patterns||[];const k={[C?"regex":"schema"]:b,rule:w};return _.matches&&(k.matches=this.$_compile(_.matches),k.matches.type!=="array"&&(k.matches=k.matches.$_root.array().items(k.matches)),I.$_mutateRegister(k.matches),I.$_setFlag("_hasPatternMatch",!0,{clone:!1})),_.fallthrough&&(k.fallthrough=!0),I.$_terms.patterns.push(k),I.$_mutateRegister(w),I}},ref:{method(){return this.$_addRule("ref")},validate:(b,w)=>y.isRef(b)?b:w.error("object.refType",{value:b})},regex:{method(){return this.$_addRule("regex")},validate:(b,w)=>b instanceof RegExp?b:w.error("object.regex",{value:b})},rename:{method(b,w,_={}){f(typeof b=="string"||b instanceof RegExp,"Rename missing the from argument"),f(typeof w=="string"||w instanceof m,"Invalid rename to argument"),f(w!==b,"Cannot rename key to same name:",b),p.assertOptions(_,["alias","ignoreUndefined","override","multiple"]);const C=this.clone();C.$_terms.renames=C.$_terms.renames||[];for(const I of C.$_terms.renames)f(I.from!==b,"Cannot rename the same key multiple times");return w instanceof m&&C.$_mutateRegister(w),C.$_terms.renames.push({from:b,to:w,options:a(v.renameDefaults,_)}),C}},schema:{method(b="any"){return this.$_addRule({name:"schema",args:{type:b}})},validate:(b,w,{type:_})=>!p.isSchema(b)||_!=="any"&&b.type!==_?w.error("object.schema",{type:_}):b},unknown:{method(b){return this.$_setFlag("unknown",b!==!1)}},with:{method(b,w,_={}){return v.dependency(this,"with",b,w,_)}},without:{method(b,w,_={}){return v.dependency(this,"without",b,w,_)}},xor:{method(...b){return p.verifyFlat(b,"xor"),v.dependency(this,"xor",null,b)}}},overrides:{default(b,w){return b===void 0&&(b=p.symbols.deepDefault),this.$_parent("default",b,w)}},rebuild(b){if(b.$_terms.keys){const w=new l.Sorter;for(const _ of b.$_terms.keys)p.tryWithPath(()=>w.add(_,{after:_.schema.$_rootReferences(),group:_.key}),_.key);b.$_terms.keys=new v.Keys(...w.nodes)}},manifest:{build(b,w){if(w.keys&&(b=b.keys(w.keys)),w.dependencies)for(const{rel:_,key:C=null,peers:I,options:k}of w.dependencies)b=v.dependency(b,_,C,I,k);if(w.patterns)for(const{regex:_,schema:C,rule:I,fallthrough:k,matches:E}of w.patterns)b=b.pattern(_||C,I,{fallthrough:k,matches:E});if(w.renames)for(const{from:_,to:C,options:I}of w.renames)b=b.rename(_,C,I);return b}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),v.clone=function(b,w){if(typeof b=="object"){if(w.nonEnumerables)return c(b,{shallow:!0});const C=Object.create(Object.getPrototypeOf(b));return Object.assign(C,b),C}const _=function(...C){return b.apply(this,C)};return _.prototype=c(b.prototype),Object.defineProperty(_,"name",{value:b.name,writable:!1}),Object.defineProperty(_,"length",{value:b.length,writable:!1}),Object.assign(_,b),_},v.dependency=function(b,w,_,C,I){f(_===null||typeof _=="string",w,"key must be a strings"),I||(I=C.length>1&&typeof C[C.length-1]=="object"?C.pop():{}),p.assertOptions(I,["separator","isPresent"]),C=[].concat(C);const k=p.default(I.separator,"."),E=[];for(const T of C)f(typeof T=="string",w,"peers must be strings"),E.push(d.ref(T,{separator:k,ancestor:0,prefix:!1}));_!==null&&(_=d.ref(_,{separator:k,ancestor:0,prefix:!1}));const S=b.clone();return S.$_terms.dependencies=S.$_terms.dependencies||[],S.$_terms.dependencies.push(new v.Dependency(w,_,E,C,I)),S},v.dependencies={and(b,w,_,C,I){const k=[],E=[],S=w.peers.length,T=v.isPresent(w.options);for(const P of w.peers)T(P.resolve(_,C,I,null,{shadow:!1}))===!1?k.push(P.key):E.push(P.key);if(k.length!==S&&E.length!==S)return{code:"object.and",context:{present:E,presentWithLabels:v.keysToLabels(b,E),missing:k,missingWithLabels:v.keysToLabels(b,k)}}},nand(b,w,_,C,I){const k=[],E=v.isPresent(w.options);for(const P of w.peers)E(P.resolve(_,C,I,null,{shadow:!1}))&&k.push(P.key);if(k.length!==w.peers.length)return;const S=w.paths[0],T=w.paths.slice(1);return{code:"object.nand",context:{main:S,mainWithLabel:v.keysToLabels(b,S),peers:T,peersWithLabels:v.keysToLabels(b,T)}}},or(b,w,_,C,I){const k=v.isPresent(w.options);for(const E of w.peers)if(k(E.resolve(_,C,I,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:w.paths,peersWithLabels:v.keysToLabels(b,w.paths)}}},oxor(b,w,_,C,I){const k=[],E=v.isPresent(w.options);for(const T of w.peers)E(T.resolve(_,C,I,null,{shadow:!1}))&&k.push(T.key);if(!k.length||k.length===1)return;const S={peers:w.paths,peersWithLabels:v.keysToLabels(b,w.paths)};return S.present=k,S.presentWithLabels=v.keysToLabels(b,k),{code:"object.oxor",context:S}},with(b,w,_,C,I){const k=v.isPresent(w.options);for(const E of w.peers)if(k(E.resolve(_,C,I,null,{shadow:!1}))===!1)return{code:"object.with",context:{main:w.key.key,mainWithLabel:v.keysToLabels(b,w.key.key),peer:E.key,peerWithLabel:v.keysToLabels(b,E.key)}}},without(b,w,_,C,I){const k=v.isPresent(w.options);for(const E of w.peers)if(k(E.resolve(_,C,I,null,{shadow:!1})))return{code:"object.without",context:{main:w.key.key,mainWithLabel:v.keysToLabels(b,w.key.key),peer:E.key,peerWithLabel:v.keysToLabels(b,E.key)}}},xor(b,w,_,C,I){const k=[],E=v.isPresent(w.options);for(const T of w.peers)E(T.resolve(_,C,I,null,{shadow:!1}))&&k.push(T.key);if(k.length===1)return;const S={peers:w.paths,peersWithLabels:v.keysToLabels(b,w.paths)};return k.length===0?{code:"object.missing",context:S}:(S.present=k,S.presentWithLabels=v.keysToLabels(b,k),{code:"object.xor",context:S})}},v.keysToLabels=function(b,w){return Array.isArray(w)?w.map(_=>b.$_mapLabels(_)):b.$_mapLabels(w)},v.isPresent=function(b){return typeof b.isPresent=="function"?b.isPresent:w=>w!==void 0},v.rename=function(b,w,_,C,I){const k={};for(const E of b.$_terms.renames){const S=[],T=typeof E.from!="string";if(T)for(const P in w){if(w[P]===void 0&&E.options.ignoreUndefined||P===E.to)continue;const g=E.from.exec(P);g&&S.push({from:P,to:E.to,match:g})}else!Object.prototype.hasOwnProperty.call(w,E.from)||w[E.from]===void 0&&E.options.ignoreUndefined||S.push(E);for(const P of S){const g=P.from;let A=P.to;if(A instanceof m&&(A=A.render(w,_,C,P.match)),g!==A){if(!E.options.multiple&&k[A]&&(I.push(b.$_createError("object.rename.multiple",w,{from:g,to:A,pattern:T},_,C)),C.abortEarly)||Object.prototype.hasOwnProperty.call(w,A)&&!E.options.override&&!k[A]&&(I.push(b.$_createError("object.rename.override",w,{from:g,to:A,pattern:T},_,C)),C.abortEarly))return!1;w[g]===void 0?delete w[A]:w[A]=w[g],k[A]=!0,E.options.alias||delete w[g]}}}return!0},v.unknown=function(b,w,_,C,I,k){if(b.$_terms.patterns){let E=!1;const S=b.$_terms.patterns.map(P=>{if(P.matches)return E=!0,[]}),T=[w,...I.ancestors];for(const P of _){const g=w[P],A=[...I.path,P];for(let x=0;x<b.$_terms.patterns.length;++x){const D=b.$_terms.patterns[x];if(D.regex){const L=D.regex.test(P);if(I.mainstay.tracer.debug(I,"rule",`pattern.${x}`,L?"pass":"error"),!L)continue}else if(!D.schema.$_match(P,I.nest(D.schema,`pattern.${x}`),k))continue;_.delete(P);const O=I.localize(A,T,{schema:D.rule,key:P}),B=D.rule.$_validate(g,O,k);if(B.errors){if(k.abortEarly)return{value:w,errors:B.errors};C.push(...B.errors)}if(D.matches&&S[x].push(P),w[P]=B.value,!D.fallthrough)break}}if(E)for(let P=0;P<S.length;++P){const g=S[P];if(!g)continue;const A=b.$_terms.patterns[P].matches,x=I.localize(I.path,T,A),D=A.$_validate(g,x,k);if(D.errors){const O=h.details(D.errors,{override:!1});O.matches=g;const B=b.$_createError("object.pattern.match",w,O,I,k);if(k.abortEarly)return{value:w,errors:B};C.push(B)}}}if(_.size&&(b.$_terms.keys||b.$_terms.patterns)){if(k.stripUnknown&&b._flags.unknown===void 0||k.skipFunctions){const E=!(!k.stripUnknown||k.stripUnknown!==!0&&!k.stripUnknown.objects);for(const S of _)E?(delete w[S],_.delete(S)):typeof w[S]=="function"&&_.delete(S)}if(!p.default(b._flags.unknown,k.allowUnknown))for(const E of _){const S=I.localize([...I.path,E],[]),T=b.$_createError("object.unknown",w[E],{child:E},S,k,{flags:!1});if(k.abortEarly)return{value:w,errors:T};C.push(T)}}},v.Dependency=class{constructor(b,w,_,C,I){this.rel=b,this.key=w,this.peers=_,this.paths=C,this.options=I}describe(){const b={rel:this.rel,peers:this.paths};return this.key!==null&&(b.key=this.key.key),this.peers[0].separator!=="."&&(b.options={...b.options,separator:this.peers[0].separator}),this.options.isPresent&&(b.options={...b.options,isPresent:this.options.isPresent}),b}},v.Keys=class extends Array{concat(b){const w=this.slice(),_=new Map;for(let C=0;C<w.length;++C)_.set(w[C].key,C);for(const C of b){const I=C.key,k=_.get(I);k!==void 0?w[k]={key:I,schema:w[k].schema.concat(C.schema)}:w.push(C)}return w}}},8785:(s,i,o)=>{const a=o(375),f=o(8068),c=o(8160),l=o(3292),u=o(6354),p={};s.exports=f.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(d,h)=>d.ref(h),validate(d,{schema:h,state:y,prefs:m}){a(h.$_terms.link,"Uninitialized link schema");const v=p.generate(h,d,y,m),b=h.$_terms.link[0].ref;return v.$_validate(d,y.nest(v,`link:${b.display}:${v.type}`),m)},generate:(d,h,y,m)=>p.generate(d,h,y,m),rules:{ref:{method(d){a(!this.$_terms.link,"Cannot reinitialize schema"),d=l.ref(d),a(d.type==="value"||d.type==="local","Invalid reference type:",d.type),a(d.type==="local"||d.ancestor==="root"||d.ancestor>0,"Link cannot reference itself");const h=this.clone();return h.$_terms.link=[{ref:d}],h}},relative:{method(d=!0){return this.$_setFlag("relative",d)}}},overrides:{concat(d){a(this.$_terms.link,"Uninitialized link schema"),a(c.isSchema(d),"Invalid schema object"),a(d.type!=="link","Cannot merge type link with another link");const h=this.clone();return h.$_terms.whens||(h.$_terms.whens=[]),h.$_terms.whens.push({concat:d}),h.$_mutateRebuild()}},manifest:{build:(d,h)=>(a(h.link,"Invalid link description missing link"),d.ref(h.link))}}),p.generate=function(d,h,y,m){let v=y.mainstay.links.get(d);if(v)return v._generate(h,y,m).schema;const b=d.$_terms.link[0].ref,{perspective:w,path:_}=p.perspective(b,y);p.assert(w,"which is outside of schema boundaries",b,d,y,m);try{v=_.length?w.$_reach(_):w}catch{p.assert(!1,"to non-existing schema",b,d,y,m)}return p.assert(v.type!=="link","which is another link",b,d,y,m),d._flags.relative||y.mainstay.links.set(d,v),v._generate(h,y,m).schema},p.perspective=function(d,h){if(d.type==="local"){for(const{schema:y,key:m}of h.schemas){if((y._flags.id||m)===d.path[0])return{perspective:y,path:d.path.slice(1)};if(y.$_terms.shared){for(const v of y.$_terms.shared)if(v._flags.id===d.path[0])return{perspective:v,path:d.path.slice(1)}}}return{perspective:null,path:null}}return d.ancestor==="root"?{perspective:h.schemas[h.schemas.length-1].schema,path:d.path}:{perspective:h.schemas[d.ancestor]&&h.schemas[d.ancestor].schema,path:d.path}},p.assert=function(d,h,y,m,v,b){d||a(!1,`"${u.label(m._flags,v,b)}" contains link reference "${y.display}" ${h}`)}},3832:(s,i,o)=>{const a=o(375),f=o(8068),c=o(8160),l={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/,decimalPlaces(u){const p=u.toString(),d=p.indexOf("."),h=p.indexOf("e");return(d<0?0:(h<0?p.length:h)-d-1)+(h<0?0:Math.max(0,-parseInt(p.slice(h+1))))}};s.exports=f.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(u,{schema:p,error:d}){if(!u.match(l.numberRx))return;u=u.trim();const h={value:parseFloat(u)};if(h.value===0&&(h.value=0),!p._flags.unsafe)if(u.match(/e/i)){if(l.extractSignificantDigits(u)!==l.extractSignificantDigits(String(h.value)))return h.errors=d("number.unsafe"),h}else{const y=h.value.toString();if(y.match(/e/i))return h;if(y!==l.normalizeDecimal(u))return h.errors=d("number.unsafe"),h}return h}},validate(u,{schema:p,error:d,prefs:h}){if(u===1/0||u===-1/0)return{value:u,errors:d("number.infinity")};if(!c.isNumber(u))return{value:u,errors:d("number.base")};const y={value:u};if(h.convert){const m=p.$_getRule("precision");if(m){const v=Math.pow(10,m.args.limit);y.value=Math.round(y.value*v)/v}}return y.value===0&&(y.value=0),!p._flags.unsafe&&(u>Number.MAX_SAFE_INTEGER||u<Number.MIN_SAFE_INTEGER)&&(y.errors=d("number.unsafe")),y},rules:{compare:{method:!1,validate:(u,p,{limit:d},{name:h,operator:y,args:m})=>c.compare(u,d,y)?u:p.error("number."+h,{limit:m.limit,value:u}),args:[{name:"limit",ref:!0,assert:c.isNumber,message:"must be a number"}]},greater:{method(u){return this.$_addRule({name:"greater",method:"compare",args:{limit:u},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(u,p)=>Math.trunc(u)-u==0?u:p.error("number.integer")},less:{method(u){return this.$_addRule({name:"less",method:"compare",args:{limit:u},operator:"<"})}},max:{method(u){return this.$_addRule({name:"max",method:"compare",args:{limit:u},operator:"<="})}},min:{method(u){return this.$_addRule({name:"min",method:"compare",args:{limit:u},operator:">="})}},multiple:{method(u){const p=typeof u=="number"?l.decimalPlaces(u):null,d=Math.pow(10,p);return this.$_addRule({name:"multiple",args:{base:u,baseDecimalPlace:p,pfactor:d}})},validate:(u,p,{base:d,baseDecimalPlace:h,pfactor:y},m)=>l.decimalPlaces(u)>h?p.error("number.multiple",{multiple:m.args.base,value:u}):Math.round(y*u)%Math.round(y*d)==0?u:p.error("number.multiple",{multiple:m.args.base,value:u}),args:[{name:"base",ref:!0,assert:u=>typeof u=="number"&&isFinite(u)&&u>0,message:"must be a positive number"},"baseDecimalPlace","pfactor"],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(u,p)=>Number.isSafeInteger(u)&&u>=0&&u<=65535?u:p.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(u){return a(Number.isSafeInteger(u),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:u}})},validate(u,p,{limit:d}){const h=u.toString().match(l.precisionRx);return Math.max((h[1]?h[1].length:0)-(h[2]?parseInt(h[2],10):0),0)<=d?u:p.error("number.precision",{limit:d,value:u})},convert:!0},sign:{method(u){return a(["negative","positive"].includes(u),"Invalid sign",u),this.$_addRule({name:"sign",args:{sign:u}})},validate:(u,p,{sign:d})=>d==="negative"&&u<0||d==="positive"&&u>0?u:p.error(`number.${d}`)},unsafe:{method(u=!0){return a(typeof u=="boolean","enabled must be a boolean"),this.$_setFlag("unsafe",u)}}},cast:{string:{from:u=>typeof u=="number",to:(u,p)=>u.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),l.extractSignificantDigits=function(u){return u.replace(l.exponentialPartRegex,"").replace(l.dotRegex,"").replace(l.trailingZerosRegex,"").replace(l.leadingSignAndZerosRegex,"")},l.normalizeDecimal=function(u){return(u=u.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&u.endsWith("0")&&(u=u.replace(/0+$/,"")),u==="-0"?"0":u}},8966:(s,i,o)=>{const a=o(7824);s.exports=a.extend({type:"object",cast:{map:{from:f=>f&&typeof f=="object",to:(f,c)=>new Map(Object.entries(f))}}})},7417:(s,i,o)=>{const a=o(375),f=o(5380),c=o(1745),l=o(9959),u=o(6064),p=o(9926),d=o(5752),h=o(8068),y=o(8160),m={tlds:p instanceof Set&&{tlds:{allow:p,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:{withPrefix:/^0x[0-9a-f]+$/i,withOptionalPrefix:/^(?:0x)?[0-9a-f]+$/i,withoutPrefix:/^[0-9a-f]+$/i},ipRegex:l.regex({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5",uuidv6:"6",uuidv7:"7",uuidv8:"8"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};s.exports=h.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(v,{schema:b,state:w,prefs:_}){const C=b.$_getRule("normalize");C&&(v=v.normalize(C.args.form));const I=b.$_getRule("case");I&&(v=I.args.direction==="upper"?v.toLocaleUpperCase():v.toLocaleLowerCase());const k=b.$_getRule("trim");if(k&&k.args.enabled&&(v=v.trim()),b.$_terms.replacements)for(const S of b.$_terms.replacements)v=v.replace(S.pattern,S.replacement);const E=b.$_getRule("hex");if(E&&E.args.options.byteAligned&&v.length%2!=0&&(v=`0${v}`),b.$_getRule("isoDate")){const S=m.isoDate(v);S&&(v=S)}if(b._flags.truncate){const S=b.$_getRule("max");if(S){let T=S.args.limit;if(y.isResolvable(T)&&(T=T.resolve(v,w,_),!y.limit(T)))return{value:v,errors:b.$_createError("any.ref",T,{ref:S.args.limit,arg:"limit",reason:"must be a positive integer"},w,_)};v=v.slice(0,T)}}return{value:v}}},validate(v,{schema:b,error:w}){if(typeof v!="string")return{value:v,errors:w("string.base")};if(v===""){const _=b.$_getRule("min");return _&&_.args.limit===0?void 0:{value:v,errors:w("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(v,b)=>/^[a-zA-Z0-9]+$/.test(v)?v:b.error("string.alphanum")},base64:{method(v={}){return y.assertOptions(v,["paddingRequired","urlSafe"]),v={urlSafe:!1,paddingRequired:!0,...v},a(typeof v.paddingRequired=="boolean","paddingRequired must be boolean"),a(typeof v.urlSafe=="boolean","urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:v}})},validate:(v,b,{options:w})=>m.base64Regex[w.paddingRequired][w.urlSafe].test(v)?v:b.error("string.base64")},case:{method(v){return a(["lower","upper"].includes(v),"Invalid case:",v),this.$_addRule({name:"case",args:{direction:v}})},validate:(v,b,{direction:w})=>w==="lower"&&v===v.toLocaleLowerCase()||w==="upper"&&v===v.toLocaleUpperCase()?v:b.error(`string.${w}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(v,b){let w=v.length,_=0,C=1;for(;w--;){const I=v.charAt(w)*C;_+=I-9*(I>9),C^=3}return _>0&&_%10==0?v:b.error("string.creditCard")}},dataUri:{method(v={}){return y.assertOptions(v,["paddingRequired"]),v={paddingRequired:!0,...v},a(typeof v.paddingRequired=="boolean","paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:v}})},validate(v,b,{options:w}){const _=v.match(m.dataUriRegex);return _&&(!_[2]||_[2]!=="base64"||m.base64Regex[w.paddingRequired].false.test(_[3]))?v:b.error("string.dataUri")}},domain:{method(v){v&&y.assertOptions(v,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const b=m.addressOptions(v);return this.$_addRule({name:"domain",args:{options:v},address:b})},validate:(v,b,w,{address:_})=>f.isValid(v,_)?v:b.error("string.domain")},email:{method(v={}){y.assertOptions(v,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),a(v.multiple===void 0||typeof v.multiple=="boolean","multiple option must be an boolean");const b=m.addressOptions(v),w=new RegExp(`\\s*[${v.separator?u(v.separator):","}]\\s*`);return this.$_addRule({name:"email",args:{options:v},regex:w,address:b})},validate(v,b,{options:w},{regex:_,address:C}){const I=w.multiple?v.split(_):[v],k=[];for(const E of I)c.isValid(E,C)||k.push(E);return k.length?b.error("string.email",{value:v,invalids:k}):v}},guid:{alias:"uuid",method(v={}){y.assertOptions(v,["version","separator"]);let b="";if(v.version){const C=[].concat(v.version);a(C.length>=1,"version must have at least 1 valid version specified");const I=new Set;for(let k=0;k<C.length;++k){const E=C[k];a(typeof E=="string","version at position "+k+" must be a string");const S=m.guidVersions[E.toLowerCase()];a(S,"version at position "+k+" must be one of "+Object.keys(m.guidVersions).join(", ")),a(!I.has(S),"version at position "+k+" must not be a duplicate"),b+=S,I.add(S)}}a(m.guidSeparators.has(v.separator),'separator must be one of true, false, "-", or ":"');const w=v.separator===void 0?"[:-]?":v.separator===!0?"[:-]":v.separator===!1?"[]?":`\\${v.separator}`,_=new RegExp(`^([\\[{\\(]?)[0-9A-F]{8}(${w})[0-9A-F]{4}\\2?[${b||"0-9A-F"}][0-9A-F]{3}\\2?[${b?"89AB":"0-9A-F"}][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$`,"i");return this.$_addRule({name:"guid",args:{options:v},regex:_})},validate(v,b,w,{regex:_}){const C=_.exec(v);return C?m.guidBrackets[C[1]]!==C[C.length-1]?b.error("string.guid"):v:b.error("string.guid")}},hex:{method(v={}){return y.assertOptions(v,["byteAligned","prefix"]),v={byteAligned:!1,prefix:!1,...v},a(typeof v.byteAligned=="boolean","byteAligned must be boolean"),a(typeof v.prefix=="boolean"||v.prefix==="optional",'prefix must be boolean or "optional"'),this.$_addRule({name:"hex",args:{options:v}})},validate:(v,b,{options:w})=>(w.prefix==="optional"?m.hexRegex.withOptionalPrefix:w.prefix===!0?m.hexRegex.withPrefix:m.hexRegex.withoutPrefix).test(v)?w.byteAligned&&v.length%2!=0?b.error("string.hexAlign"):v:b.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(v,b)=>f.isValid(v,{minDomainSegments:1})||m.ipRegex.test(v)?v:b.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(v={}){y.assertOptions(v,["cidr","version"]);const{cidr:b,versions:w,regex:_}=l.regex(v),C=v.version?w:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:b,version:C}},regex:_})},validate:(v,b,{options:w},{regex:_})=>_.test(v)?v:w.version?b.error("string.ipVersion",{value:v,cidr:w.cidr,version:w.version}):b.error("string.ip",{value:v,cidr:w.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(v,{error:b})=>m.isoDate(v)?v:b("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(v,b)=>m.isoDurationRegex.test(v)?v:b.error("string.isoDuration")},length:{method(v,b){return m.length(this,"length",v,"=",b)},validate(v,b,{limit:w,encoding:_},{name:C,operator:I,args:k}){const E=!_&&v.length;return y.compare(E,w,I)?v:b.error("string."+C,{limit:k.limit,value:v,encoding:_})},args:[{name:"limit",ref:!0,assert:y.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(v,b){return m.length(this,"max",v,"<=",b)},args:["limit","encoding"]},min:{method(v,b){return m.length(this,"min",v,">=",b)},args:["limit","encoding"]},normalize:{method(v="NFC"){return a(m.normalizationForms.includes(v),"normalization form must be one of "+m.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:v}})},validate:(v,{error:b},{form:w})=>v===v.normalize(w)?v:b("string.normalize",{value:v,form:w}),convert:!0},pattern:{alias:"regex",method(v,b={}){a(v instanceof RegExp,"regex must be a RegExp"),a(!v.flags.includes("g")&&!v.flags.includes("y"),"regex should not use global or sticky mode"),typeof b=="string"&&(b={name:b}),y.assertOptions(b,["invert","name"]);const w=["string.pattern",b.invert?".invert":"",b.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:v,options:b},errorCode:w})},validate:(v,b,{regex:w,options:_},{errorCode:C})=>w.test(v)^_.invert?v:b.error(C,{name:_.name,regex:w,value:v}),args:["regex","options"],multi:!0},replace:{method(v,b){typeof v=="string"&&(v=new RegExp(u(v),"g")),a(v instanceof RegExp,"pattern must be a RegExp"),a(typeof b=="string","replacement must be a String");const w=this.clone();return w.$_terms.replacements||(w.$_terms.replacements=[]),w.$_terms.replacements.push({pattern:v,replacement:b}),w}},token:{method(){return this.$_addRule("token")},validate:(v,b)=>/^\w+$/.test(v)?v:b.error("string.token")},trim:{method(v=!0){return a(typeof v=="boolean","enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:v}})},validate:(v,b,{enabled:w})=>w&&v!==v.trim()?b.error("string.trim"):v,convert:!0},truncate:{method(v=!0){return a(typeof v=="boolean","enabled must be a boolean"),this.$_setFlag("truncate",v)}},uppercase:{method(){return this.case("upper")}},uri:{method(v={}){y.assertOptions(v,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme","encodeUri"]),v.domain&&y.assertOptions(v.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:b,scheme:w}=d.regex(v),_=v.domain?m.addressOptions(v.domain):null;return this.$_addRule({name:"uri",args:{options:v},regex:b,domain:_,scheme:w})},validate(v,b,{options:w},{regex:_,domain:C,scheme:I}){if(["http:/","https:/"].includes(v))return b.error("string.uri");let k=_.exec(v);if(!k&&b.prefs.convert&&w.encodeUri){const E=encodeURI(v);k=_.exec(E),k&&(v=E)}if(k){const E=k[1]||k[2];return!C||w.allowRelative&&!E||f.isValid(E,C)?v:b.error("string.domain",{value:E})}return w.relativeOnly?b.error("string.uriRelativeOnly"):w.scheme?b.error("string.uriCustomScheme",{scheme:I,value:v}):b.error("string.uri")}}},manifest:{build(v,b){if(b.replacements)for(const{pattern:w,replacement:_}of b.replacements)v=v.replace(w,_);return v}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),m.addressOptions=function(v){if(!v)return m.tlds||v;if(a(v.minDomainSegments===void 0||Number.isSafeInteger(v.minDomainSegments)&&v.minDomainSegments>0,"minDomainSegments must be a positive integer"),a(v.maxDomainSegments===void 0||Number.isSafeInteger(v.maxDomainSegments)&&v.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),v.tlds===!1)return v;if(v.tlds===!0||v.tlds===void 0)return a(m.tlds,"Built-in TLD list disabled"),Object.assign({},v,m.tlds);a(typeof v.tlds=="object","tlds must be true, false, or an object");const b=v.tlds.deny;if(b)return Array.isArray(b)&&(v=Object.assign({},v,{tlds:{deny:new Set(b)}})),a(v.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),a(!v.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),m.validateTlds(v.tlds.deny,"tlds.deny"),v;const w=v.tlds.allow;return w?w===!0?(a(m.tlds,"Built-in TLD list disabled"),Object.assign({},v,m.tlds)):(Array.isArray(w)&&(v=Object.assign({},v,{tlds:{allow:new Set(w)}})),a(v.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),m.validateTlds(v.tlds.allow,"tlds.allow"),v):v},m.validateTlds=function(v,b){for(const w of v)a(f.isValid(w,{minDomainSegments:1,maxDomainSegments:1}),`${b} must contain valid top level domain names`)},m.isoDate=function(v){if(!y.isIsoDate(v))return null;/.*T.*[+-]\d\d$/.test(v)&&(v+="00");const b=new Date(v);return isNaN(b.getTime())?null:b.toISOString()},m.length=function(v,b,w,_,C){return a(!C||!1,"Invalid encoding:",C),v.$_addRule({name:b,method:"length",args:{limit:w,encoding:C},operator:_})}},8826:(s,i,o)=>{const a=o(375),f=o(8068),c={};c.Map=class extends Map{slice(){return new c.Map(this)}},s.exports=f.extend({type:"symbol",terms:{map:{init:new c.Map}},coerce:{method(l,{schema:u,error:p}){const d=u.$_terms.map.get(l);return d&&(l=d),u._flags.only&&typeof l!="symbol"?{value:l,errors:p("symbol.map",{map:u.$_terms.map})}:{value:l}}},validate(l,{error:u}){if(typeof l!="symbol")return{value:l,errors:u("symbol.base")}},rules:{map:{method(l){l&&!l[Symbol.iterator]&&typeof l=="object"&&(l=Object.entries(l)),a(l&&l[Symbol.iterator],"Iterable must be an iterable or object");const u=this.clone(),p=[];for(const d of l){a(d&&d[Symbol.iterator],"Entry must be an iterable");const[h,y]=d;a(typeof h!="object"&&typeof h!="function"&&typeof h!="symbol","Key must not be of type object, function, or Symbol"),a(typeof y=="symbol","Value must be a Symbol"),u.$_terms.map.set(h,y),p.push(y)}return u.valid(...p)}}},manifest:{build:(l,u)=>(u.map&&(l=l.map(u.map)),l)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},8863:(s,i,o)=>{const a=o(375),f=o(8571),c=o(738),l=o(9621),u=o(8160),p=o(6354),d=o(493),h={result:Symbol("result")};i.entry=function(y,m,v){let b=u.defaults;v&&(a(v.warnings===void 0,"Cannot override warnings preference in synchronous validation"),a(v.artifacts===void 0,"Cannot override artifacts preference in synchronous validation"),b=u.preferences(u.defaults,v));const w=h.entry(y,m,b);a(!w.mainstay.externals.length,"Schema with external rules must use validateAsync()");const _={value:w.value};return w.error&&(_.error=w.error),w.mainstay.warnings.length&&(_.warning=p.details(w.mainstay.warnings)),w.mainstay.debug&&(_.debug=w.mainstay.debug),w.mainstay.artifacts&&(_.artifacts=w.mainstay.artifacts),_},i.entryAsync=async function(y,m,v){let b=u.defaults;v&&(b=u.preferences(u.defaults,v));const w=h.entry(y,m,b),_=w.mainstay;if(w.error)throw _.debug&&(w.error.debug=_.debug),w.error;if(_.externals.length){let I=w.value;const k=[];for(const E of _.externals){const S=E.state.path,T=E.schema.type==="link"?_.links.get(E.schema):null;let P,g,A=I;const x=S.length?[I]:[],D=S.length?l(y,S):y;if(S.length){P=S[S.length-1];let O=I;for(const B of S.slice(0,-1))O=O[B],x.unshift(O);g=x[0],A=g[P]}try{const O=(L,M)=>(T||E.schema).$_createError(L,A,M,E.state,b),B=await E.method(A,{schema:E.schema,linked:T,state:E.state,prefs:v,original:D,error:O,errorsArray:h.errorsArray,warn:(L,M)=>_.warnings.push((T||E.schema).$_createError(L,A,M,E.state,b)),message:(L,M)=>(T||E.schema).$_createError("external",A,M,E.state,b,{messages:L})});if(B===void 0||B===A)continue;if(B instanceof p.Report){if(_.tracer.log(E.schema,E.state,"rule","external","error"),k.push(B),b.abortEarly)break;continue}if(Array.isArray(B)&&B[u.symbols.errors]){if(_.tracer.log(E.schema,E.state,"rule","external","error"),k.push(...B),b.abortEarly)break;continue}g?(_.tracer.value(E.state,"rule",A,B,"external"),g[P]=B):(_.tracer.value(E.state,"rule",I,B,"external"),I=B)}catch(O){throw b.errors.label&&(O.message+=` (${E.label})`),O}}if(w.value=I,k.length)throw w.error=p.process(k,y,b),_.debug&&(w.error.debug=_.debug),w.error}if(!b.warnings&&!b.debug&&!b.artifacts)return w.value;const C={value:w.value};return _.warnings.length&&(C.warning=p.details(_.warnings)),_.debug&&(C.debug=_.debug),_.artifacts&&(C.artifacts=_.artifacts),C},h.Mainstay=class{constructor(y,m,v){this.externals=[],this.warnings=[],this.tracer=y,this.debug=m,this.links=v,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const y=this._snapshots.pop();this.externals=y.externals,this.warnings=y.warnings}commit(){this._snapshots.pop()}},h.entry=function(y,m,v){const{tracer:b,cleanup:w}=h.tracer(m,v),_=v.debug?[]:null,C=m._ids._schemaChain?new Map:null,I=new h.Mainstay(b,_,C),k=m._ids._schemaChain?[{schema:m}]:null,E=new d([],[],{mainstay:I,schemas:k}),S=i.validate(y,m,E,v);w&&m.$_root.untrace();const T=p.process(S.errors,y,v);return{value:S.value,error:T,mainstay:I}},h.tracer=function(y,m){return y.$_root._tracer?{tracer:y.$_root._tracer._register(y)}:m.debug?(a(y.$_root.trace,"Debug mode not supported"),{tracer:y.$_root.trace()._register(y),cleanup:!0}):{tracer:h.ignore}},i.validate=function(y,m,v,b,w={}){if(m.$_terms.whens&&(m=m._generate(y,v,b).schema),m._preferences&&(b=h.prefs(m,b)),m._cache&&b.cache){const T=m._cache.get(y);if(v.mainstay.tracer.debug(v,"validate","cached",!!T),T)return T}const _=(T,P,g)=>m.$_createError(T,y,P,g||v,b),C={original:y,prefs:b,schema:m,state:v,error:_,errorsArray:h.errorsArray,warn:(T,P,g)=>v.mainstay.warnings.push(_(T,P,g)),message:(T,P)=>m.$_createError("custom",y,P,v,b,{messages:T})};v.mainstay.tracer.entry(m,v);const I=m._definition;if(I.prepare&&y!==void 0&&b.convert){const T=I.prepare(y,C);if(T){if(v.mainstay.tracer.value(v,"prepare",y,T.value),T.errors)return h.finalize(T.value,[].concat(T.errors),C);y=T.value}}if(I.coerce&&y!==void 0&&b.convert&&(!I.coerce.from||I.coerce.from.includes(typeof y))){const T=I.coerce.method(y,C);if(T){if(v.mainstay.tracer.value(v,"coerced",y,T.value),T.errors)return h.finalize(T.value,[].concat(T.errors),C);y=T.value}}const k=m._flags.empty;k&&k.$_match(h.trim(y,m),v.nest(k),u.defaults)&&(v.mainstay.tracer.value(v,"empty",y,void 0),y=void 0);const E=w.presence||m._flags.presence||(m._flags._endedSwitch?null:b.presence);if(y===void 0){if(E==="forbidden")return h.finalize(y,null,C);if(E==="required")return h.finalize(y,[m.$_createError("any.required",y,null,v,b)],C);if(E==="optional"){if(m._flags.default!==u.symbols.deepDefault)return h.finalize(y,null,C);v.mainstay.tracer.value(v,"default",y,{}),y={}}}else if(E==="forbidden")return h.finalize(y,[m.$_createError("any.unknown",y,null,v,b)],C);const S=[];if(m._valids){const T=m._valids.get(y,v,b,m._flags.insensitive);if(T)return b.convert&&(v.mainstay.tracer.value(v,"valids",y,T.value),y=T.value),v.mainstay.tracer.filter(m,v,"valid",T),h.finalize(y,null,C);if(m._flags.only){const P=m.$_createError("any.only",y,{valids:m._valids.values({display:!0})},v,b);if(b.abortEarly)return h.finalize(y,[P],C);S.push(P)}}if(m._invalids){const T=m._invalids.get(y,v,b,m._flags.insensitive);if(T){v.mainstay.tracer.filter(m,v,"invalid",T);const P=m.$_createError("any.invalid",y,{invalids:m._invalids.values({display:!0})},v,b);if(b.abortEarly)return h.finalize(y,[P],C);S.push(P)}}if(I.validate){const T=I.validate(y,C);if(T&&(v.mainstay.tracer.value(v,"base",y,T.value),y=T.value,T.errors)){if(!Array.isArray(T.errors))return S.push(T.errors),h.finalize(y,S,C);if(T.errors.length)return S.push(...T.errors),h.finalize(y,S,C)}}return m._rules.length?h.rules(y,S,C):h.finalize(y,S,C)},h.rules=function(y,m,v){const{schema:b,state:w,prefs:_}=v;for(const C of b._rules){const I=b._definition.rules[C.method];if(I.convert&&_.convert){w.mainstay.tracer.log(b,w,"rule",C.name,"full");continue}let k,E=C.args;if(C._resolve.length){E=Object.assign({},E);for(const T of C._resolve){const P=I.argsByName.get(T),g=E[T].resolve(y,w,_),A=P.normalize?P.normalize(g):g,x=u.validateArg(A,null,P);if(x){k=b.$_createError("any.ref",g,{arg:T,ref:E[T],reason:x},w,_);break}E[T]=A}}k=k||I.validate(y,v,E,C);const S=h.rule(k,C);if(S.errors){if(w.mainstay.tracer.log(b,w,"rule",C.name,"error"),C.warn){w.mainstay.warnings.push(...S.errors);continue}if(_.abortEarly)return h.finalize(y,S.errors,v);m.push(...S.errors)}else w.mainstay.tracer.log(b,w,"rule",C.name,"pass"),w.mainstay.tracer.value(w,"rule",y,S.value,C.name),y=S.value}return h.finalize(y,m,v)},h.rule=function(y,m){return y instanceof p.Report?(h.error(y,m),{errors:[y],value:null}):Array.isArray(y)&&y[u.symbols.errors]?(y.forEach(v=>h.error(v,m)),{errors:y,value:null}):{errors:null,value:y}},h.error=function(y,m){return m.message&&y._setTemplate(m.message),y},h.finalize=function(y,m,v){m=m||[];const{schema:b,state:w,prefs:_}=v;if(m.length){const I=h.default("failover",void 0,m,v);I!==void 0&&(w.mainstay.tracer.value(w,"failover",y,I),y=I,m=[])}if(m.length&&b._flags.error)if(typeof b._flags.error=="function"){m=b._flags.error(m),Array.isArray(m)||(m=[m]);for(const I of m)a(I instanceof Error||I instanceof p.Report,"error() must return an Error object")}else m=[b._flags.error];if(y===void 0){const I=h.default("default",y,m,v);w.mainstay.tracer.value(w,"default",y,I),y=I}if(b._flags.cast&&y!==void 0){const I=b._definition.cast[b._flags.cast];if(I.from(y)){const k=I.to(y,v);w.mainstay.tracer.value(w,"cast",y,k,b._flags.cast),y=k}}if(b.$_terms.externals&&_.externals&&_._externals!==!1)for(const{method:I}of b.$_terms.externals)w.mainstay.externals.push({method:I,schema:b,state:w,label:p.label(b._flags,w,_)});const C={value:y,errors:m.length?m:null};return b._flags.result&&(C.value=b._flags.result==="strip"?void 0:v.original,w.mainstay.tracer.value(w,b._flags.result,y,C.value),w.shadow(y,b._flags.result)),b._cache&&_.cache!==!1&&!b._refs.length&&b._cache.set(v.original,C),y===void 0||C.errors||b._flags.artifact===void 0||(w.mainstay.artifacts=w.mainstay.artifacts||new Map,w.mainstay.artifacts.has(b._flags.artifact)||w.mainstay.artifacts.set(b._flags.artifact,[]),w.mainstay.artifacts.get(b._flags.artifact).push(w.path)),C},h.prefs=function(y,m){const v=m===u.defaults;return v&&y._preferences[u.symbols.prefs]?y._preferences[u.symbols.prefs]:(m=u.preferences(m,y._preferences),v&&(y._preferences[u.symbols.prefs]=m),m)},h.default=function(y,m,v,b){const{schema:w,state:_,prefs:C}=b,I=w._flags[y];if(C.noDefaults||I===void 0)return m;if(_.mainstay.tracer.log(w,_,"rule",y,"full"),!I)return I;if(typeof I=="function"){const k=I.length?[f(_.ancestors[0]),b]:[];try{return I(...k)}catch(E){return void v.push(w.$_createError(`any.${y}`,null,{error:E},_,C))}}return typeof I!="object"?I:I[u.symbols.literal]?I.literal:u.isResolvable(I)?I.resolve(m,_,C):f(I)},h.trim=function(y,m){if(typeof y!="string")return y;const v=m.$_getRule("trim");return v&&v.args.enabled?y.trim():y},h.ignore={active:!1,debug:c,entry:c,filter:c,log:c,resolve:c,value:c},h.errorsArray=function(){const y=[];return y[u.symbols.errors]=!0,y}},2036:(s,i,o)=>{const a=o(375),f=o(9474),c=o(8160),l={};s.exports=l.Values=class{constructor(u,p){this._values=new Set(u),this._refs=new Set(p),this._lowercase=l.lowercases(u),this._override=!1}get length(){return this._values.size+this._refs.size}add(u,p){c.isResolvable(u)?this._refs.has(u)||(this._refs.add(u),p&&p.register(u)):this.has(u,null,null,!1)||(this._values.add(u),typeof u=="string"&&this._lowercase.set(u.toLowerCase(),u))}static merge(u,p,d){if(u=u||new l.Values,p){if(p._override)return p.clone();for(const h of[...p._values,...p._refs])u.add(h)}if(d)for(const h of[...d._values,...d._refs])u.remove(h);return u.length?u:null}remove(u){c.isResolvable(u)?this._refs.delete(u):(this._values.delete(u),typeof u=="string"&&this._lowercase.delete(u.toLowerCase()))}has(u,p,d,h){return!!this.get(u,p,d,h)}get(u,p,d,h){if(!this.length)return!1;if(this._values.has(u))return{value:u};if(typeof u=="string"&&u&&h){const y=this._lowercase.get(u.toLowerCase());if(y)return{value:y}}if(!this._refs.size&&typeof u!="object")return!1;if(typeof u=="object"){for(const y of this._values)if(f(y,u))return{value:y}}if(p)for(const y of this._refs){const m=y.resolve(u,p,d,null,{in:!0});if(m===void 0)continue;const v=y.in&&typeof m=="object"?Array.isArray(m)?m:Object.keys(m):[m];for(const b of v)if(typeof b==typeof u){if(h&&u&&typeof u=="string"){if(b.toLowerCase()===u.toLowerCase())return{value:b,ref:y}}else if(f(b,u))return{value:b,ref:y}}}return!1}override(){this._override=!0}values(u){if(u&&u.display){const p=[];for(const d of[...this._values,...this._refs])d!==void 0&&p.push(d);return p}return Array.from([...this._values,...this._refs])}clone(){const u=new l.Values(this._values,this._refs);return u._override=this._override,u}concat(u){a(!u._override,"Cannot concat override set of values");const p=new l.Values([...this._values,...u._values],[...this._refs,...u._refs]);return p._override=this._override,p}describe(){const u=[];this._override&&u.push({override:!0});for(const p of this._values.values())u.push(p&&typeof p=="object"?{value:p}:p);for(const p of this._refs.values())u.push(p.describe());return u}},l.Values.prototype[c.symbols.values]=!0,l.Values.prototype.slice=l.Values.prototype.clone,l.lowercases=function(u){const p=new Map;if(u)for(const d of u)typeof d=="string"&&p.set(d.toLowerCase(),d);return p}},978:(s,i,o)=>{const a=o(375),f=o(8571),c=o(1687),l=o(9621),u={};s.exports=function(p,d,h={}){if(a(p&&typeof p=="object","Invalid defaults value: must be an object"),a(!d||d===!0||typeof d=="object","Invalid source value: must be true, falsy or an object"),a(typeof h=="object","Invalid options: must be an object"),!d)return null;if(h.shallow)return u.applyToDefaultsWithShallow(p,d,h);const y=f(p);if(d===!0)return y;const m=h.nullOverride!==void 0&&h.nullOverride;return c(y,d,{nullOverride:m,mergeArrays:!1})},u.applyToDefaultsWithShallow=function(p,d,h){const y=h.shallow;a(Array.isArray(y),"Invalid keys");const m=new Map,v=d===!0?null:new Set;for(let _ of y){_=Array.isArray(_)?_:_.split(".");const C=l(p,_);C&&typeof C=="object"?m.set(C,v&&l(d,_)||C):v&&v.add(_)}const b=f(p,{},m);if(!v)return b;for(const _ of v)u.reachCopy(b,d,_);const w=h.nullOverride!==void 0&&h.nullOverride;return c(b,d,{nullOverride:w,mergeArrays:!1})},u.reachCopy=function(p,d,h){for(const v of h){if(!(v in d))return;const b=d[v];if(typeof b!="object"||b===null)return;d=b}const y=d;let m=p;for(let v=0;v<h.length-1;++v){const b=h[v];typeof m[b]!="object"&&(m[b]={}),m=m[b]}m[h[h.length-1]]=y}},375:(s,i,o)=>{const a=o(7916);s.exports=function(f,...c){if(!f)throw c.length===1&&c[0]instanceof Error?c[0]:new a(c)}},8571:(s,i,o)=>{const a=o(9621),f=o(4277),c=o(7043),l={needsProtoHack:new Set([f.set,f.map,f.weakSet,f.weakMap])};s.exports=l.clone=function(u,p={},d=null){if(typeof u!="object"||u===null)return u;let h=l.clone,y=d;if(p.shallow){if(p.shallow!==!0)return l.cloneWithShallow(u,p);h=w=>w}else if(y){const w=y.get(u);if(w)return w}else y=new Map;const m=f.getInternalProto(u);if(m===f.buffer)return!1;if(m===f.date)return new Date(u.getTime());if(m===f.regex)return new RegExp(u);const v=l.base(u,m,p);if(v===u)return u;if(y&&y.set(u,v),m===f.set)for(const w of u)v.add(h(w,p,y));else if(m===f.map)for(const[w,_]of u)v.set(w,h(_,p,y));const b=c.keys(u,p);for(const w of b){if(w==="__proto__")continue;if(m===f.array&&w==="length"){v.length=u.length;continue}const _=Object.getOwnPropertyDescriptor(u,w);_?_.get||_.set?Object.defineProperty(v,w,_):_.enumerable?v[w]=h(u[w],p,y):Object.defineProperty(v,w,{enumerable:!1,writable:!0,configurable:!0,value:h(u[w],p,y)}):Object.defineProperty(v,w,{enumerable:!0,writable:!0,configurable:!0,value:h(u[w],p,y)})}return v},l.cloneWithShallow=function(u,p){const d=p.shallow;(p=Object.assign({},p)).shallow=!1;const h=new Map;for(const y of d){const m=a(u,y);typeof m!="object"&&typeof m!="function"||h.set(m,m)}return l.clone(u,p,h)},l.base=function(u,p,d){if(d.prototype===!1)return l.needsProtoHack.has(p)?new p.constructor:p===f.array?[]:{};const h=Object.getPrototypeOf(u);if(h&&h.isImmutable)return u;if(p===f.array){const y=[];return h!==p&&Object.setPrototypeOf(y,h),y}if(l.needsProtoHack.has(p)){const y=new h.constructor;return h!==p&&Object.setPrototypeOf(y,h),y}return Object.create(h)}},9474:(s,i,o)=>{const a=o(4277),f={mismatched:null};s.exports=function(c,l,u){return u=Object.assign({prototype:!0},u),!!f.isDeepEqual(c,l,u,[])},f.isDeepEqual=function(c,l,u,p){if(c===l)return c!==0||1/c==1/l;const d=typeof c;if(d!==typeof l||c===null||l===null)return!1;if(d==="function"){if(!u.deepFunction||c.toString()!==l.toString())return!1}else if(d!=="object")return c!=c&&l!=l;const h=f.getSharedType(c,l,!!u.prototype);switch(h){case a.buffer:return!1;case a.promise:return c===l;case a.regex:return c.toString()===l.toString();case f.mismatched:return!1}for(let y=p.length-1;y>=0;--y)if(p[y].isSame(c,l))return!0;p.push(new f.SeenEntry(c,l));try{return!!f.isDeepEqualObj(h,c,l,u,p)}finally{p.pop()}},f.getSharedType=function(c,l,u){if(u)return Object.getPrototypeOf(c)!==Object.getPrototypeOf(l)?f.mismatched:a.getInternalProto(c);const p=a.getInternalProto(c);return p!==a.getInternalProto(l)?f.mismatched:p},f.valueOf=function(c){const l=c.valueOf;if(l===void 0)return c;try{return l.call(c)}catch(u){return u}},f.hasOwnEnumerableProperty=function(c,l){return Object.prototype.propertyIsEnumerable.call(c,l)},f.isSetSimpleEqual=function(c,l){for(const u of Set.prototype.values.call(c))if(!Set.prototype.has.call(l,u))return!1;return!0},f.isDeepEqualObj=function(c,l,u,p,d){const{isDeepEqual:h,valueOf:y,hasOwnEnumerableProperty:m}=f,{keys:v,getOwnPropertySymbols:b}=Object;if(c===a.array){if(!p.part){if(l.length!==u.length)return!1;for(let k=0;k<l.length;++k)if(!h(l[k],u[k],p,d))return!1;return!0}for(const k of l)for(const E of u)if(h(k,E,p,d))return!0}else if(c===a.set){if(l.size!==u.size)return!1;if(!f.isSetSimpleEqual(l,u)){const k=new Set(Set.prototype.values.call(u));for(const E of Set.prototype.values.call(l)){if(k.delete(E))continue;let S=!1;for(const T of k)if(h(E,T,p,d)){k.delete(T),S=!0;break}if(!S)return!1}}}else if(c===a.map){if(l.size!==u.size)return!1;for(const[k,E]of Map.prototype.entries.call(l))if(E===void 0&&!Map.prototype.has.call(u,k)||!h(E,Map.prototype.get.call(u,k),p,d))return!1}else if(c===a.error&&(l.name!==u.name||l.message!==u.message))return!1;const w=y(l),_=y(u);if((l!==w||u!==_)&&!h(w,_,p,d))return!1;const C=v(l);if(!p.part&&C.length!==v(u).length&&!p.skip)return!1;let I=0;for(const k of C)if(p.skip&&p.skip.includes(k))u[k]===void 0&&++I;else if(!m(u,k)||!h(l[k],u[k],p,d))return!1;if(!p.part&&C.length-I!==v(u).length)return!1;if(p.symbols!==!1){const k=b(l),E=new Set(b(u));for(const S of k){if(!p.skip||!p.skip.includes(S)){if(m(l,S)){if(!m(u,S)||!h(l[S],u[S],p,d))return!1}else if(m(u,S))return!1}E.delete(S)}for(const S of E)if(m(u,S))return!1}return!0},f.SeenEntry=class{constructor(c,l){this.obj=c,this.ref=l}isSame(c,l){return this.obj===c&&this.ref===l}}},7916:(s,i,o)=>{const a=o(8761);s.exports=class extends Error{constructor(f){super(f.filter(c=>c!=="").map(c=>typeof c=="string"?c:c instanceof Error?c.message:a(c)).join(" ")||"Unknown error"),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,i.assert)}}},5277:s=>{const i={};s.exports=function(o){if(!o)return"";let a="";for(let f=0;f<o.length;++f){const c=o.charCodeAt(f);i.isSafe(c)?a+=o[f]:a+=i.escapeHtmlChar(c)}return a},i.escapeHtmlChar=function(o){return i.namedHtml.get(o)||(o>=256?"&#"+o+";":`&#x${o.toString(16).padStart(2,"0")};`)},i.isSafe=function(o){return i.safeCharCodes.has(o)},i.namedHtml=new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]),i.safeCharCodes=function(){const o=new Set;for(let a=32;a<123;++a)(a>=97||a>=65&&a<=90||a>=48&&a<=57||a===32||a===46||a===44||a===45||a===58||a===95)&&o.add(a);return o}()},6064:s=>{s.exports=function(i){return i.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},738:s=>{s.exports=function(){}},1687:(s,i,o)=>{const a=o(375),f=o(8571),c=o(7043),l={};s.exports=l.merge=function(u,p,d){if(a(u&&typeof u=="object","Invalid target value: must be an object"),a(p==null||typeof p=="object","Invalid source value: must be null, undefined, or an object"),!p)return u;if(d=Object.assign({nullOverride:!0,mergeArrays:!0},d),Array.isArray(p)){a(Array.isArray(u),"Cannot merge array onto an object"),d.mergeArrays||(u.length=0);for(let y=0;y<p.length;++y)u.push(f(p[y],{symbols:d.symbols}));return u}const h=c.keys(p,d);for(let y=0;y<h.length;++y){const m=h[y];if(m==="__proto__"||!Object.prototype.propertyIsEnumerable.call(p,m))continue;const v=p[m];if(v&&typeof v=="object"){if(u[m]===v)continue;!u[m]||typeof u[m]!="object"||Array.isArray(u[m])!==Array.isArray(v)||v instanceof Date||v instanceof RegExp?u[m]=f(v,{symbols:d.symbols}):l.merge(u[m],v,d)}else(v!=null||d.nullOverride)&&(u[m]=v)}return u}},9621:(s,i,o)=>{const a=o(375),f={};s.exports=function(c,l,u){if(l===!1||l==null)return c;typeof(u=u||{})=="string"&&(u={separator:u});const p=Array.isArray(l);a(!p||!u.separator,"Separator option is not valid for array-based chain");const d=p?l:l.split(u.separator||".");let h=c;for(let y=0;y<d.length;++y){let m=d[y];const v=u.iterables&&f.iterables(h);if(Array.isArray(h)||v==="set"){const b=Number(m);Number.isInteger(b)&&(m=b<0?h.length+b:b)}if(!h||typeof h=="function"&&u.functions===!1||!v&&h[m]===void 0){a(!u.strict||y+1===d.length,"Missing segment",m,"in reach path ",l),a(typeof h=="object"||u.functions===!0||typeof h!="function","Invalid segment",m,"in reach path ",l),h=u.default;break}h=v?v==="set"?[...h][m]:h.get(m):h[m]}return h},f.iterables=function(c){return c instanceof Set?"set":c instanceof Map?"map":void 0}},8761:s=>{s.exports=function(...i){try{return JSON.stringify(...i)}catch(o){return"[Cannot display object: "+o.message+"]"}}},4277:(s,i)=>{const o={};i=s.exports={array:Array.prototype,buffer:!1,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},o.typeMap=new Map([["[object Error]",i.error],["[object Map]",i.map],["[object Promise]",i.promise],["[object Set]",i.set],["[object WeakMap]",i.weakMap],["[object WeakSet]",i.weakSet]]),i.getInternalProto=function(a){if(Array.isArray(a))return i.array;if(a instanceof Date)return i.date;if(a instanceof RegExp)return i.regex;if(a instanceof Error)return i.error;const f=Object.prototype.toString.call(a);return o.typeMap.get(f)||i.generic}},7043:(s,i)=>{i.keys=function(o,a={}){return a.symbols!==!1?Reflect.ownKeys(o):Object.getOwnPropertyNames(o)}},3652:(s,i,o)=>{const a=o(375),f={};i.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(c,l){const u=[].concat((l=l||{}).before||[]),p=[].concat(l.after||[]),d=l.group||"?",h=l.sort||0;a(!u.includes(d),`Item cannot come before itself: ${d}`),a(!u.includes("?"),"Item cannot come before unassociated items"),a(!p.includes(d),`Item cannot come after itself: ${d}`),a(!p.includes("?"),"Item cannot come after unassociated items"),Array.isArray(c)||(c=[c]);for(const y of c){const m={seq:this._items.length,sort:h,before:u,after:p,group:d,node:y};this._items.push(m)}if(!l.manual){const y=this._sort();a(y,"item",d!=="?"?`added into group ${d}`:"","created a dependencies error")}return this.nodes}merge(c){Array.isArray(c)||(c=[c]);for(const u of c)if(u)for(const p of u._items)this._items.push(Object.assign({},p));this._items.sort(f.mergeSort);for(let u=0;u<this._items.length;++u)this._items[u].seq=u;const l=this._sort();return a(l,"merge created a dependencies error"),this.nodes}sort(){const c=this._sort();return a(c,"sort created a dependencies error"),this.nodes}_sort(){const c={},l=Object.create(null),u=Object.create(null);for(const m of this._items){const v=m.seq,b=m.group;u[b]=u[b]||[],u[b].push(v),c[v]=m.before;for(const w of m.after)l[w]=l[w]||[],l[w].push(v)}for(const m in c){const v=[];for(const b in c[m]){const w=c[m][b];u[w]=u[w]||[],v.push(...u[w])}c[m]=v}for(const m in l)if(u[m])for(const v of u[m])c[v].push(...l[m]);const p={};for(const m in c){const v=c[m];for(const b of v)p[b]=p[b]||[],p[b].push(m)}const d={},h=[];for(let m=0;m<this._items.length;++m){let v=m;if(p[m]){v=null;for(let b=0;b<this._items.length;++b){if(d[b]===!0)continue;p[b]||(p[b]=[]);const w=p[b].length;let _=0;for(let C=0;C<w;++C)d[p[b][C]]&&++_;if(_===w){v=b;break}}}v!==null&&(d[v]=!0,h.push(v))}if(h.length!==this._items.length)return!1;const y={};for(const m of this._items)y[m.seq]=m;this._items=[],this.nodes=[];for(const m of h){const v=y[m];this.nodes.push(v.node),this._items.push(v)}return!0}},f.mergeSort=(c,l)=>c.sort===l.sort?0:c.sort<l.sort?-1:1},5380:(s,i,o)=>{const a=o(443),f=o(2178),c={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:a.URL||URL};i.analyze=function(l,u={}){if(!l)return f.code("DOMAIN_NON_EMPTY_STRING");if(typeof l!="string")throw new Error("Invalid input: domain must be a string");if(l.length>256)return f.code("DOMAIN_TOO_LONG");if(c.nonAsciiRx.test(l)){if(u.allowUnicode===!1)return f.code("DOMAIN_INVALID_UNICODE_CHARS");l=l.normalize("NFC")}if(c.domainControlRx.test(l))return f.code("DOMAIN_INVALID_CHARS");l=c.punycode(l),u.allowFullyQualified&&l[l.length-1]==="."&&(l=l.slice(0,-1));const p=u.minDomainSegments||c.minDomainSegments,d=l.split(".");if(d.length<p)return f.code("DOMAIN_SEGMENTS_COUNT");if(u.maxDomainSegments&&d.length>u.maxDomainSegments)return f.code("DOMAIN_SEGMENTS_COUNT_MAX");const h=u.tlds;if(h){const y=d[d.length-1].toLowerCase();if(h.deny&&h.deny.has(y)||h.allow&&!h.allow.has(y))return f.code("DOMAIN_FORBIDDEN_TLDS")}for(let y=0;y<d.length;++y){const m=d[y];if(!m.length)return f.code("DOMAIN_EMPTY_SEGMENT");if(m.length>63)return f.code("DOMAIN_LONG_SEGMENT");if(y<d.length-1){if(!c.domainSegmentRx.test(m))return f.code("DOMAIN_INVALID_CHARS")}else if(!c.tldSegmentRx.test(m))return f.code("DOMAIN_INVALID_TLDS_CHARS")}return null},i.isValid=function(l,u){return!i.analyze(l,u)},c.punycode=function(l){l.includes("%")&&(l=l.replace(/%/g,"%25"));try{return new c.URL(`http://${l}`).host}catch{return l}}},1745:(s,i,o)=>{const a=o(9848),f=o(5380),c=o(2178),l={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(a.TextEncoder||TextEncoder)};i.analyze=function(u,p){return l.email(u,p)},i.isValid=function(u,p){return!l.email(u,p)},l.email=function(u,p={}){if(typeof u!="string")throw new Error("Invalid input: email must be a string");if(!u)return c.code("EMPTY_STRING");const d=!l.nonAsciiRx.test(u);if(!d){if(p.allowUnicode===!1)return c.code("FORBIDDEN_UNICODE");u=u.normalize("NFC")}const h=u.split("@");if(h.length!==2)return h.length>2?c.code("MULTIPLE_AT_CHAR"):c.code("MISSING_AT_CHAR");const[y,m]=h;if(!y)return c.code("EMPTY_LOCAL");if(!p.ignoreLength){if(u.length>254)return c.code("ADDRESS_TOO_LONG");if(l.encoder.encode(y).length>64)return c.code("LOCAL_TOO_LONG")}return l.local(y,d)||f.analyze(m,p)},l.local=function(u,p){const d=u.split(".");for(const h of d){if(!h.length)return c.code("EMPTY_LOCAL_SEGMENT");if(p){if(!l.atextRx.test(h))return c.code("INVALID_LOCAL_CHARS")}else for(const y of h){if(l.atextRx.test(y))continue;const m=l.binary(y);if(!l.atomRx.test(m))return c.code("INVALID_LOCAL_CHARS")}}},l.binary=function(u){return Array.from(l.encoder.encode(u)).map(p=>String.fromCharCode(p)).join("")},l.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,l.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"))},2178:(s,i)=>{i.codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"},i.code=function(o){return{code:o,error:i.codes[o]}}},9959:(s,i,o)=>{const a=o(375),f=o(5752);i.regex=function(c={}){a(c.cidr===void 0||typeof c.cidr=="string","options.cidr must be a string");const l=c.cidr?c.cidr.toLowerCase():"optional";a(["required","optional","forbidden"].includes(l),"options.cidr must be one of required, optional, forbidden"),a(c.version===void 0||typeof c.version=="string"||Array.isArray(c.version),"options.version must be a string or an array of string");let u=c.version||["ipv4","ipv6","ipvfuture"];Array.isArray(u)||(u=[u]),a(u.length>=1,"options.version must have at least 1 version specified");for(let h=0;h<u.length;++h)a(typeof u[h]=="string","options.version must only contain strings"),u[h]=u[h].toLowerCase(),a(["ipv4","ipv6","ipvfuture"].includes(u[h]),"options.version contains unknown version "+u[h]+" - must be one of ipv4, ipv6, ipvfuture");u=Array.from(new Set(u));const p=`(?:${u.map(h=>{if(l==="forbidden")return f.ip[h];const y=`\\/${h==="ipv4"?f.ip.v4Cidr:f.ip.v6Cidr}`;return l==="required"?`${f.ip[h]}${y}`:`${f.ip[h]}(?:${y})?`}).join("|")})`,d=new RegExp(`^${p}$`);return{cidr:l,versions:u,regex:d,raw:p}}},5752:(s,i,o)=>{const a=o(375),f=o(6064),c={generate:function(){const l={},u="\\dA-Fa-f",p="["+u+"]",d="\\w-\\.~",h="!\\$&'\\(\\)\\*\\+,;=",y="%"+u,m=d+y+h+":@",v="["+m+"]",b="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";l.ipv4address="(?:"+b+"\\.){3}"+b;const w=p+"{1,4}",_="(?:"+w+":"+w+"|"+l.ipv4address+")",C="(?:"+w+":){6}"+_,I="::(?:"+w+":){5}"+_,k="(?:"+w+")?::(?:"+w+":){4}"+_,E="(?:(?:"+w+":){0,1}"+w+")?::(?:"+w+":){3}"+_,S="(?:(?:"+w+":){0,2}"+w+")?::(?:"+w+":){2}"+_,T="(?:(?:"+w+":){0,3}"+w+")?::"+w+":"+_,P="(?:(?:"+w+":){0,4}"+w+")?::"+_,g="(?:(?:"+w+":){0,5}"+w+")?::"+w,A="(?:(?:"+w+":){0,6}"+w+")?::";l.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",l.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",l.ipv6address="(?:"+C+"|"+I+"|"+k+"|"+E+"|"+S+"|"+T+"|"+P+"|"+g+"|"+A+")",l.ipvFuture="v"+p+"+\\.["+d+h+":]+",l.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",l.schemeRegex=new RegExp(l.scheme);const x="["+d+y+h+":]*",D="["+d+y+h+"]{1,255}",O="(?:\\[(?:"+l.ipv6address+"|"+l.ipvFuture+")\\]|"+l.ipv4address+"|"+D+")",B="(?:"+x+"@)?"+O+"(?::\\d*)?",L="(?:"+x+"@)?("+O+")(?::\\d*)?",M=v+"*",R=v+"+",N="(?:\\/"+M+")*",F="\\/(?:"+R+N+")?",z=R+N,Y="["+d+y+h+"@]+"+N,j="(?:\\/\\/\\/"+M+N+")";return l.hierPart="(?:(?:\\/\\/"+B+N+")|"+F+"|"+z+"|"+j+")",l.hierPartCapture="(?:(?:\\/\\/"+L+N+")|"+F+"|"+z+")",l.relativeRef="(?:(?:\\/\\/"+B+N+")|"+F+"|"+Y+"|)",l.relativeRefCapture="(?:(?:\\/\\/"+L+N+")|"+F+"|"+Y+"|)",l.query="["+m+"\\/\\?]*(?=#|$)",l.queryWithSquareBrackets="["+m+"\\[\\]\\/\\?]*(?=#|$)",l.fragment="["+m+"\\/\\?]*",l}};c.rfc3986=c.generate(),i.ip={v4Cidr:c.rfc3986.ipv4Cidr,v6Cidr:c.rfc3986.ipv6Cidr,ipv4:c.rfc3986.ipv4address,ipv6:c.rfc3986.ipv6address,ipvfuture:c.rfc3986.ipvFuture},c.createRegex=function(l){const u=c.rfc3986,p="(?:\\?"+(l.allowQuerySquareBrackets?u.queryWithSquareBrackets:u.query)+")?(?:#"+u.fragment+")?",d=l.domain?u.relativeRefCapture:u.relativeRef;if(l.relativeOnly)return c.wrap(d+p);let h="";if(l.scheme){a(l.scheme instanceof RegExp||typeof l.scheme=="string"||Array.isArray(l.scheme),"scheme must be a RegExp, String, or Array");const v=[].concat(l.scheme);a(v.length>=1,"scheme must have at least 1 scheme specified");const b=[];for(let w=0;w<v.length;++w){const _=v[w];a(_ instanceof RegExp||typeof _=="string","scheme at position "+w+" must be a RegExp or String"),_ instanceof RegExp?b.push(_.source.toString()):(a(u.schemeRegex.test(_),"scheme at position "+w+" must be a valid scheme"),b.push(f(_)))}h=b.join("|")}const y="(?:"+(h?"(?:"+h+")":u.scheme)+":"+(l.domain?u.hierPartCapture:u.hierPart)+")",m=l.allowRelative?"(?:"+y+"|"+d+")":y;return c.wrap(m+p,h)},c.wrap=function(l,u){return{raw:l=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${l}`,regex:new RegExp(`^${l}$`),scheme:u}},c.uriRegex=c.createRegex({}),i.regex=function(l={}){return l.scheme||l.allowRelative||l.relativeOnly||l.allowQuerySquareBrackets||l.domain?c.createRegex(l):c.uriRegex}},1447:(s,i)=>{const o={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};i.Parser=class{constructor(a,f={}){if(!f[o.settings]&&f.constants)for(const c in f.constants){const l=f.constants[c];if(l!==null&&!["boolean","number","string"].includes(typeof l))throw new Error(`Formula constant ${c} contains invalid ${typeof l} value type`)}this.settings=f[o.settings]?f:Object.assign({[o.settings]:!0,constants:{},functions:{}},f),this.single=null,this._parts=null,this._parse(a)}_parse(a){let f=[],c="",l=0,u=!1;const p=h=>{if(l)throw new Error("Formula missing closing parenthesis");const y=f.length?f[f.length-1]:null;if(u||c||h){if(y&&y.type==="reference"&&h===")")return y.type="function",y.value=this._subFormula(c,y.value),void(c="");if(h===")"){const m=new i.Parser(c,this.settings);f.push({type:"segment",value:m})}else if(u){if(u==="]")return f.push({type:"reference",value:c}),void(c="");f.push({type:"literal",value:c})}else if(o.operatorCharacters.includes(c))y&&y.type==="operator"&&o.operators.includes(y.value+c)?y.value+=c:f.push({type:"operator",value:c});else if(c.match(o.numberRx))f.push({type:"constant",value:parseFloat(c)});else if(this.settings.constants[c]!==void 0)f.push({type:"constant",value:this.settings.constants[c]});else{if(!c.match(o.tokenRx))throw new Error(`Formula contains invalid token: ${c}`);f.push({type:"reference",value:c})}c=""}};for(const h of a)u?h===u?(p(),u=!1):c+=h:l?h==="("?(c+=h,++l):h===")"?(--l,l?c+=h:p(h)):c+=h:h in o.literals?u=o.literals[h]:h==="("?(p(),++l):o.operatorCharacters.includes(h)?(p(),c=h,p()):h!==" "?c+=h:p();p(),f=f.map((h,y)=>h.type!=="operator"||h.value!=="-"||y&&f[y-1].type!=="operator"?h:{type:"operator",value:"n"});let d=!1;for(const h of f){if(h.type==="operator"){if(o.operatorsPrefix.includes(h.value))continue;if(!d)throw new Error("Formula contains an operator in invalid position");if(!o.operators.includes(h.value))throw new Error(`Formula contains an unknown operator ${h.value}`)}else if(d)throw new Error("Formula missing expected operator");d=!d}if(!d)throw new Error("Formula contains invalid trailing operator");f.length===1&&["reference","literal","constant"].includes(f[0].type)&&(this.single={type:f[0].type==="reference"?"reference":"value",value:f[0].value}),this._parts=f.map(h=>{if(h.type==="operator")return o.operatorsPrefix.includes(h.value)?h:h.value;if(h.type!=="reference")return h.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(h.value))throw new Error(`Formula contains invalid reference ${h.value}`);return this.settings.reference?this.settings.reference(h.value):o.reference(h.value)})}_subFormula(a,f){const c=this.settings.functions[f];if(typeof c!="function")throw new Error(`Formula contains unknown function ${f}`);let l=[];if(a){let u="",p=0,d=!1;const h=()=>{if(!u)throw new Error(`Formula contains function ${f} with invalid arguments ${a}`);l.push(u),u=""};for(let y=0;y<a.length;++y){const m=a[y];d?(u+=m,m===d&&(d=!1)):m in o.literals&&!p?(u+=m,d=o.literals[m]):m!==","||p?(u+=m,m==="("?++p:m===")"&&--p):h()}h()}return l=l.map(u=>new i.Parser(u,this.settings)),function(u){const p=[];for(const d of l)p.push(d.evaluate(u));return c.call(u,...p)}}evaluate(a){const f=this._parts.slice();for(let c=f.length-2;c>=0;--c){const l=f[c];if(l&&l.type==="operator"){const u=f[c+1];f.splice(c+1,1);const p=o.evaluate(u,a);f[c]=o.single(l.value,p)}}return o.operatorsOrder.forEach(c=>{for(let l=1;l<f.length-1;)if(c.includes(f[l])){const u=f[l],p=o.evaluate(f[l-1],a),d=o.evaluate(f[l+1],a);f.splice(l,2);const h=o.calculate(u,p,d);f[l-1]=h===0?0:h}else l+=2}),o.evaluate(f[0],a)}},i.Parser.prototype[o.symbol]=!0,o.reference=function(a){return function(f){return f&&f[a]!==void 0?f[a]:null}},o.evaluate=function(a,f){return a===null?null:typeof a=="function"?a(f):a[o.symbol]?a.evaluate(f):a},o.single=function(a,f){if(a==="!")return!f;const c=-f;return c===0?0:c},o.calculate=function(a,f,c){if(a==="??")return o.exists(f)?f:c;if(typeof f=="string"||typeof c=="string"){if(a==="+")return(f=o.exists(f)?f:"")+(o.exists(c)?c:"")}else switch(a){case"^":return Math.pow(f,c);case"*":return f*c;case"/":return f/c;case"%":return f%c;case"+":return f+c;case"-":return f-c}switch(a){case"<":return f<c;case"<=":return f<=c;case">":return f>c;case">=":return f>=c;case"==":return f===c;case"!=":return f!==c;case"&&":return f&&c;case"||":return f||c}return null},o.exists=function(a){return a!=null}},9926:()=>{},5688:()=>{},9708:()=>{},1152:()=>{},443:()=>{},9848:()=>{},5934:s=>{s.exports=JSON.parse('{"version":"17.13.3"}')}},n={},function s(i){var o=n[i];if(o!==void 0)return o.exports;var a=n[i]={exports:{}};return r[i](a,a.exports,s),a.exports}(5107);var r,n})}(I2)),I2.exports}var Q4;function _V(){if(Q4)return Rc;Q4=1,Object.defineProperty(Rc,"__esModule",{value:!0}),Rc.validateMessageObj=void 0;const e=bV(),t=Va(),r=Ze(),n=d=>{const h=[];for(const y in d)typeof d[y]=="string"?h.push(d[y]):typeof d[y]=="object"&&h.push(...n(d[y]));return h},s=e.object({content:e.string().required().allow("")}),i=e.object({content:e.string().valid(...Object.values(n(t.CHAT.META))).required(),info:e.object({affected:e.array().items(e.string()).required(),arbitrary:e.object().pattern(e.string(),e.any())}).required()}),o=e.object({content:e.string().valid(...Object.values(n(t.CHAT.REACTION))).required(),reference:e.string().required()}),a=e.object({content:e.string().valid(...Object.values(n(t.CHAT.RECEIPT))).required(),reference:e.string().required()}),f=e.object({content:e.string().valid(...Object.values(n(t.CHAT.UA))).required(),info:e.object({affected:e.array().items(e.string()).required(),arbitrary:e.object().pattern(e.string(),e.any())}).required()}),c=e.object({content:e.string().valid(...Object.values(n(t.CHAT.INTENT)))}),l=e.object({content:e.object({messageType:e.string().valid(...Object.values([r.MessageType.TEXT,r.MessageType.IMAGE,r.MessageType.AUDIO,r.MessageType.VIDEO,r.MessageType.FILE,r.MessageType.MEDIA_EMBED])).required(),messageObj:e.object({content:e.string().required()}).required()}).required(),reference:e.string().required()}),u=e.object({content:e.array().items(e.object({messageType:e.string().valid(...Object.values([r.MessageType.TEXT,r.MessageType.IMAGE,r.MessageType.AUDIO,r.MessageType.VIDEO,r.MessageType.FILE,r.MessageType.MEDIA_EMBED])).required(),messageObj:e.object({content:e.string().required()}).required()})).required()}),p=(d,h)=>{let y;switch(h){case r.MessageType.TEXT:case r.MessageType.IMAGE:case r.MessageType.VIDEO:case r.MessageType.AUDIO:case r.MessageType.FILE:case r.MessageType.MEDIA_EMBED:case r.MessageType.GIF:{y=s.validate(d).error;break}case r.MessageType.META:{y=i.validate(d).error;break}case r.MessageType.REACTION:{y=o.validate(d).error;break}case r.MessageType.RECEIPT:{y=a.validate(d).error;break}case r.MessageType.USER_ACTIVITY:{y=f.validate(d).error;break}case r.MessageType.INTENT:{y=c.validate(d).error;break}case r.MessageType.REPLY:{y=l.validate(d).error;break}case r.MessageType.COMPOSITE:{y=u.validate(d).error;break}default:throw new Error("Invalid MessageType")}if(y)throw new Error("Unable to parse this messageType. Please ensure 'messageObj' is properly defined.")};return Rc.validateMessageObj=p,Rc}var e8;function wV(){return e8||(e8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sendCore=e.send=void 0;const t=He,r=nt(),n=Ze(),s=Dt(),i=PA(),o=Dt(),a=_V(),f=Tt(),c=ul(),l=er(),u=oi(),p=m=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.sendCore)(m,s.PGPHelper)});e.send=p;const d=(m,v)=>t.__awaiter(void 0,void 0,void 0,function*(){var b,w,_;try{const C=y(m),{messageType:I,messageObj:k,account:E,signer:S,pgpPrivateKey:T,env:P}=C;let{to:g}=C;yield h(C);const A=(0,s.getWallet)({account:E,signer:S}),x=yield(0,s.getConnectedUserV2Core)(A,T,P,v);let D=yield(0,r.convertToValidDID)(g,P);const O=(0,r.getAPIBaseUrls)(P),B=!(0,r.isValidPushCAIP)(g);let L=!1,M=null;if(B){const j={recipient:g,account:E,env:P},re=yield u.getChatInfo(j);L=(w=(b=re==null?void 0:re.meta)===null||b===void 0?void 0:b.group)!==null&&w!==void 0?w:!1,M=L?yield(0,c.getGroupInfo)({chatId:g,env:P}):null,L||(g=((_=re.participants)!==null&&_!==void 0?_:[]).find(X=>X!==(0,r.walletToPCAIP10)(E)),D=g)}let R;I===n.MessageType.REPLY||I===n.MessageType.COMPOSITE?R="MessageType Not Supported by this sdk version. Plz upgrade !!!":R=k.content;const N=yield(0,i.conversationHash)({conversationId:D,account:x.did,env:P});let F;!L&&N&&!(N!=null&&N.threadHash)?F=`${O}/v1/chat/request`:F=`${O}/v1/chat/message`;const z=yield(0,o.sendMessagePayloadCore)(D,x,k,R,I,M,P,v);return(yield(0,f.axiosPost)(F,z)).data}catch(C){throw(0,l.handleError)(C,e.send.name)}});e.sendCore=d;const h=m=>t.__awaiter(void 0,void 0,void 0,function*(){const{messageType:v,messageObj:b,account:w,to:_,signer:C,pgpPrivateKey:I,env:k}=m;if(!w&&!C)throw new Error("Unable to detect sender. Please ensure that either 'account' or 'signer' is properly defined.");if(!C&&!I)throw new Error("Unable to decrypt keys. Please ensure that either 'signer' or 'pgpPrivateKey' is properly defined.");const E=(0,s.getWallet)({account:w,signer:C}),S=yield(0,s.getAccountAddress)(E);if(!(0,r.isValidPushCAIP)(S))throw new Error("Invalid sender. Please ensure that either 'account' or 'signer' is properly defined.");(0,a.validateMessageObj)(b,v)}),y=m=>{var v,b,w;const _=((v=m.message)===null||v===void 0?void 0:v.type)!==void 0?m.message.type:(b=m.messageType)!==null&&b!==void 0?b:"Text";let C=m.message;if(C===void 0){if(m.messageObj===void 0&&![n.MessageType.TEXT,n.MessageType.IMAGE,n.MessageType.FILE,n.MessageType.MEDIA_EMBED,n.MessageType.GIF].includes(_))throw new Error("Options.message is required");C=m.messageObj!==void 0?m.messageObj:{content:(w=m.messageContent)!==null&&w!==void 0?w:""}}else C=t.__rest(C,["type"]);if(_===n.MessageType.REPLY)if(typeof C.content=="object"){const P=C.content,{type:g}=P,A=t.__rest(P,["type"]);C.content={messageType:g,messageObj:A}}else throw new Error("Options.message is not properly defined for Reply");if(_===n.MessageType.COMPOSITE)if(C.content instanceof Array)C.content=C.content.map(P=>{const{type:g}=P,A=t.__rest(P,["type"]);return{messageType:g,messageObj:A}});else throw new Error("Options.message is not properly defined for Composite");const I=m.account!==void 0?m.account:null,k=m.to!==void 0?m.to:m.receiverAddress;if(k===void 0)throw new Error("Options.to is required");const E=m.signer!==void 0?m.signer:null,S=m.pgpPrivateKey!==void 0?m.pgpPrivateKey:null,T=m.env!==void 0?m.env:n.default.ENV.PROD;return{messageType:_,messageObj:C,account:I,to:k,signer:E,pgpPrivateKey:S,env:T}}}(T2)),T2}var k2={},t8;function xA(){return t8||(t8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.historyCore=e.history=void 0;const t=He,r=Ze(),n=er(),s=nt(),i=Mn(),o=Dt();var a;(function(l){l[l.MIN=1]="MIN",l[l.DEFAULT=10]="DEFAULT",l[l.MAX=30]="MAX"})(a||(a={}));const f=l=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.historyCore)(l,o.PGPHelper)});e.history=f;const c=(l,u)=>t.__awaiter(void 0,void 0,void 0,function*(){const{threadhash:p,limit:d=a.DEFAULT,pgpPrivateKey:h="",account:y,toDecrypt:m=!1,env:v=r.default.ENV.PROD}=l||{};try{if(d<a.MIN||d>a.MAX)throw d<a.MIN?new Error(`Limit must be more than equal to ${a.MIN}`):new Error(`Limit must be less than equal to ${a.MAX}`);const b=yield(0,o.getMessagesService)({threadhash:p,limit:d,env:v}),w=(0,o.addDeprecatedInfoToMessages)(b),_=yield(0,i.get)({account:(0,s.pCAIP10ToWallet)(y),env:v});return m?yield(0,o.decryptConversation)({messages:w,connectedUser:_,pgpPrivateKey:h,pgpHelper:u,env:v}):b}catch(b){throw(0,n.handleError)(b,e.history.name)}});e.historyCore=c}(k2)),k2}var R2={},r8;function EV(){return r8||(r8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.latestCore=e.latest=void 0;const t=He,r=Ze(),n=Dt(),s=xA(),i=a=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.latestCore)(a,n.PGPHelper)});e.latest=i;const o=(a,f)=>t.__awaiter(void 0,void 0,void 0,function*(){const{threadhash:c,pgpPrivateKey:l="",account:u,toDecrypt:p=!1,env:d=r.default.ENV.PROD}=a||{};return(0,s.history)({threadhash:c,toDecrypt:p,limit:1,pgpPrivateKey:l,account:u,env:d})});e.latestCore=o}(R2)),R2}var D2={},n8;function AV(){return n8||(n8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createGroupCoreV2=e.createGroupV2=void 0;const t=He,r=nt(),n=Ze(),s=Dt(),i=Yr(),o=er(),a=Tt(),f=u=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.createGroupCoreV2)(u,s.PGPHelper)});e.createGroupV2=f;const c=(u,p)=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:d=null,signer:h=null,pgpPrivateKey:y=null,env:m=n.default.ENV.PROD,groupName:v,groupDescription:b,groupImage:w,rules:_,isPublic:C,groupType:I,config:{meta:k,scheduleAt:E,scheduleEnd:S,status:T},members:P,admins:g}=u;try{const A=(0,s.getWallet)({account:d,signer:h}),x=yield(0,s.getConnectedUserV2Core)(A,y,m,p),D=P.map(W=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,r.convertToValidDID)(W,m)})),O=g.map(W=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,r.convertToValidDID)(W,m)})),B=yield Promise.all(D),L=yield Promise.all(O);l(u);const M={groupName:v,groupDescription:b,groupImage:w,rules:_,isPublic:C,groupType:I},R=i.SHA256(JSON.stringify(M)).toString(),F=`pgpv2:${yield p.sign({message:R,signingKey:x.privateKey})}:${x.did}`,z={meta:k,scheduleAt:E,scheduleEnd:S,status:T},Y=i.SHA256(JSON.stringify(z)).toString(),re=`pgpv2:${yield p.sign({message:Y,signingKey:x.privateKey})}:${x.did}`,V={members:B,admins:L},U=i.SHA256(JSON.stringify(V)).toString(),ye=`pgpv2:${yield p.sign({message:U,signingKey:x.privateKey})}:${x.did}`,Ae=`${(0,r.getAPIBaseUrls)(m)}/v2/chat/groups`,H={groupName:v,groupDescription:b,groupImage:w,rules:_,isPublic:C,groupType:I,profileVerificationProof:F,config:{meta:k,scheduleAt:E,scheduleEnd:S,status:T,configVerificationProof:re},members:B,admins:L,idempotentVerificationProof:ye};return(yield(0,a.axiosPost)(Ae,H)).data}catch(A){throw(0,o.handleError)(A,e.createGroupV2.name)}});e.createGroupCoreV2=c;const l=u=>{const{account:p=null,signer:d=null,pgpPrivateKey:h=null,groupName:y,groupDescription:m,groupImage:v,rules:b,isPublic:w,groupType:_,config:{meta:C,scheduleAt:I,scheduleEnd:k,status:E},members:S,admins:T}=u;if(!h&&!d)throw new Error("At least one from pgpPrivateKey or signer is necessary!");if(y==null||y.length==0)throw new Error("groupName cannot be null or empty");if(y.length>50)throw new Error("groupName cannot be more than 50 characters");if(m&&m.length>150)throw new Error("groupDescription cannot be more than 150 characters");for(let P=0;P<S.length;P++)if(S[P]&&!(0,r.isValidPushCAIP)(S[P]))throw new Error("Invalid member address!");for(let P=0;P<T.length;P++)if(!(0,r.isValidPushCAIP)(T[P]))throw new Error("Invalid admin address!");(0,s.validateScheduleDates)(I,k)}}(D2)),D2}var B2={},i8;function SV(){return i8||(i8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupByName=void 0;const t=He,r=nt(),n=Ze(),s=Tt(),i=er(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{groupName:f,env:c=n.default.ENV.PROD}=a||{};try{if(console.log("============================================="),console.log("NOTICE: The method 'getGroupByName' will be deprecated on January 1st, 2024. Please update your code to remove this."),console.log("============================================="),f==null||f.length==0)throw new Error("Group Name cannot be null or empty");const u=`${(0,r.getAPIBaseUrls)(c)}/v1/chat/groups?groupName=${f}`;return(yield(0,s.axiosGet)(u)).data}catch(l){throw(0,i.handleError)(l,e.getGroupByName.name)}});e.getGroupByName=o}(B2)),B2}var O2={},s8;function PV(){return s8||(s8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupAccess=void 0;const t=He,r=nt(),n=Ze(),s=Tt(),i=er(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,did:c,env:l=n.default.ENV.PROD}=a||{};try{if(f==null||f.length===0)throw new Error("chatId cannot be null or empty");if(c==null||c.length===0)throw new Error("did cannot be null or empty");const u=yield(0,r.convertToValidDID)(c,l),d=`${(0,r.getAPIBaseUrls)(l)}/v1/chat/groups/${f}/access/${u}`;return(yield(0,s.axiosGet)(d)).data}catch(u){throw(0,i.handleError)(u,e.getGroupAccess.name)}});e.getGroupAccess=o}(O2)),O2}var M2={},a8;function xV(){return a8||(a8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.search=void 0;const t=He,r=nt(),n=Ze(),s=Tt(),i=er(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{searchTerm:f,pageNumber:c,pageSize:l,env:u=n.default.ENV.PROD}=a||{};try{const d=`${(0,r.getAPIBaseUrls)(u)}/v1/chat/groups/search`;return(yield(0,s.axiosPost)(d,{searchTerm:f,pageNumber:c,pageSize:l})).data}catch(p){throw(0,i.handleError)(p,e.search.name)}});e.search=o}(M2)),M2}var N2={},o8;function TV(){return o8||(o8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reject=void 0;const t=He,r=nt(),n=Ze(),s=Dt(),i=Yr(),o=Tt(),a=er(),f=c=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:l=null,signer:u=null,senderAddress:p,env:d=n.default.ENV.PROD,pgpPrivateKey:h=null}=c||{};if(l==null&&u==null)throw new Error("At least one from account or signer is necessary!");const y=(0,s.getWallet)({account:l,signer:u}),m=yield(0,s.getAccountAddress)(y),b=`${(0,r.getAPIBaseUrls)(d)}/v1/chat/request/reject`;let w=!0;(0,r.isValidPushCAIP)(p)&&(w=!1);const _=yield(0,s.getConnectedUserV2)(y,h,d);let C=yield(0,r.convertToValidDID)(p,d),I=yield(0,r.convertToValidDID)(m,d);w&&(C=yield(0,r.convertToValidDID)(m,d),I=yield(0,r.convertToValidDID)(p,d));const k={fromDID:C,toDID:I},E=i.SHA256(JSON.stringify(k)).toString(),S=yield(0,s.sign)({message:E,signingKey:_.privateKey}),T=(0,s.rejectRequestPayload)(C,I,"pgp",S);return(0,o.axiosPut)(b,T).then(P=>P.data).catch(P=>{throw(0,a.handleError)(P,e.reject.name)})});e.reject=f}(N2)),N2}var U2={},c8;function CV(){return c8||(c8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.modifyRoles=void 0;const t=He,r=un(),n=Ze(),s=er(),i=ll(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,newRole:c,members:l,account:u=null,signer:p=null,env:d=n.default.ENV.PROD,pgpPrivateKey:h=null,overrideSecretKeyGeneration:y=!r.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=a||{};try{if(u==null&&p==null)throw new Error("At least one from account or signer is necessary!");if(!l||l.length===0)throw new Error("Members array cannot be empty!");const v={chatId:f,upsert:{admins:c==="ADMIN"?l:[],members:c==="MEMBER"?l:[]},remove:[],account:u,signer:p,pgpPrivateKey:h,env:d,overrideSecretKeyGeneration:y};return yield(0,i.updateGroupMembers)(v)}catch(m){throw(0,s.handleError)(m,e.modifyRoles.name)}});e.modifyRoles=o}(U2)),U2}var L2={},u8;function IV(){return u8||(u8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getChatInfo=void 0;const t=He,r=Ze(),n=er(),s=nt(),i=Tt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{recipient:f,account:c,env:l=r.default.ENV.PROD}=a;try{if(!f||!c)throw new Error("receipient and account cannot be null or empty");const p=`${(0,s.getAPIBaseUrls)(l)}/v1/chat/${yield(0,s.convertToValidDID)(f,l)}/address/${yield(0,s.convertToValidDID)(c,l)}`;return(yield(0,i.axiosGet)(p)).data}catch(u){throw(0,n.handleError)(u,e.getChatInfo.name)}});e.getChatInfo=o}(L2)),L2}var l8;function oi(){return l8||(l8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decryptConversation=e.decryptPGPKey=e.decryptWithWalletRPCMethod=void 0;const t=He;t.__exportStar(gV(),e),t.__exportStar(mV(),e),t.__exportStar(vV(),e),t.__exportStar(wV(),e),t.__exportStar(PA(),e),t.__exportStar(AA(),e),t.__exportStar(xA(),e),t.__exportStar(EV(),e);var r=$y();Object.defineProperty(e,"decryptWithWalletRPCMethod",{enumerable:!0,get:function(){return r.decryptWithWalletRPCMethod}});var n=$y();Object.defineProperty(e,"decryptPGPKey",{enumerable:!0,get:function(){return n.decryptPGPKey}});var s=Dt();Object.defineProperty(e,"decryptConversation",{enumerable:!0,get:function(){return s.decryptConversation}}),t.__exportStar(uA(),e),t.__exportStar(gA(),e),t.__exportStar(AV(),e),t.__exportStar(cl(),e),t.__exportStar(al(),e),t.__exportStar(SV(),e),t.__exportStar(wA(),e),t.__exportStar(bA(),e),t.__exportStar(EA(),e),t.__exportStar(_A(),e),t.__exportStar(PV(),e),t.__exportStar(xV(),e),t.__exportStar(TV(),e),t.__exportStar(tm(),e),t.__exportStar(cA(),e),t.__exportStar(ul(),e),t.__exportStar(Jg(),e),t.__exportStar(mA(),e),t.__exportStar(CV(),e),t.__exportStar(IV(),e)}(A2)),A2}var d8;function kV(){return d8||(d8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getAccess=void 0;const t=He,r=Ze(),n=oi(),s=i=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:o,did:a,env:f=r.default.ENV.PROD}=i||{};try{if(o==null||o.length===0)throw new Error("spaceId cannot be null or empty");if(a==null||a.length===0)throw new Error("did cannot be null or empty");const c=yield(0,n.getGroupAccess)({chatId:o,did:a,env:f});return(0,n.groupAccessToSpaceAccess)(c)}catch(c){throw console.error(`[Push SDK] - API - Error - API ${e.getAccess.name} -: `,c),Error(`[Push SDK] - API - Error - API ${e.getAccess.name} -: ${c}`)}});e.getAccess=s}(E2)),E2}var K2={},f8;function RV(){return f8||(f8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.search=void 0;const t=He,r=nt(),n=Ze(),s=Tt(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{searchTerm:a,pageNumber:f,pageSize:c,env:l=n.default.ENV.PROD}=o||{};try{const p=`${(0,r.getAPIBaseUrls)(l)}/v1/spaces/search`;return(0,s.axiosPost)(p,{searchTerm:a,pageNumber:f,pageSize:c}).then(d=>d.data).catch(d=>{var h,y;throw!((h=d==null?void 0:d.response)===null||h===void 0)&&h.data?new Error((y=d==null?void 0:d.response)===null||y===void 0?void 0:y.data):new Error(d)})}catch(u){throw console.error(`[Push SDK] - API - Error - API ${e.search.name} -: `,u),Error(`[Push SDK] - API - Error - API ${e.search.name} -: ${u}`)}});e.search=i}(K2)),K2}var Dc={},h8;function DV(){if(h8)return Dc;h8=1,Object.defineProperty(Dc,"__esModule",{value:!0}),Dc.createV2=void 0;const e=He,t=Ze(),r=Dt(),n=oi();function s(i){var o;return e.__awaiter(this,void 0,void 0,function*(){const{signer:a,spaceName:f,spaceDescription:c,listeners:l,spaceImage:u,speakers:p,isPublic:d,env:h=t.default.ENV.PROD,pgpPrivateKey:y=null,rules:m,config:v}=i||{},b=m?(0,r.convertSpaceRulesToRules)(m):null;try{const w=yield(0,n.createGroupV2)({signer:a,groupName:f,groupDescription:c,members:l,groupImage:u,admins:p,isPublic:d,env:h,pgpPrivateKey:y,groupType:"spaces",config:{meta:null,scheduleAt:v.scheduleAt,scheduleEnd:(o=v.scheduleEnd)!==null&&o!==void 0?o:null,status:"PENDING"},rules:b});return(0,r.groupInfoDtoToSpaceInfoDto)(w)}catch(w){throw console.error(`[Push SDK] - API - Error - API ${s.name} -: `,w),new Error(`[Push SDK] - API - Error - API ${s.name} -: ${w}`)}})}return Dc.createV2=s,Dc}var F2={},p8;function BV(){return p8||(p8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.spaceFeed=void 0;const t=He,r=nt(),n=Ze(),s=Dt(),i=Tt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:f,pgpPrivateKey:c,env:l=n.default.ENV.PROD,toDecrypt:u=!1,recipient:p}=a||{},d=yield(0,r.convertToValidDID)(f,l),h=yield(0,r.convertToValidDID)(p,l);if(!(0,r.isValidPushCAIP)(d))throw new Error(`Invalid address ${d}`);const m=`${(0,r.getAPIBaseUrls)(l)}/v1/spaces/users/${d}/space/${h}`;try{const b=(yield(0,i.axiosGet)(m)).data;if(Object.keys(b).length!==0){const[w]=yield(0,s.getSpaceInboxLists)({lists:[b],user:d,toDecrypt:u,pgpPrivateKey:c,env:l});return w}else return b}catch(v){throw console.error(`[Push SDK] - API ${e.spaceFeed.name}: `,v),Error(`[Push SDK] - API ${e.spaceFeed.name}: ${v}`)}});e.spaceFeed=o}(F2)),F2}var q2={},j2={exports:{}},$2,y8;function OV(){if(y8)return $2;y8=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,s=(Z,oe)=>{for(var me in oe)e(Z,me,{get:oe[me],enumerable:!0})},i=(Z,oe,me,xe)=>{if(oe&&typeof oe=="object"||typeof oe=="function")for(let Pe of r(oe))!n.call(Z,Pe)&&Pe!==me&&e(Z,Pe,{get:()=>oe[Pe],enumerable:!(xe=t(oe,Pe))||xe.enumerable});return Z},o=Z=>i(e({},"__esModule",{value:!0}),Z),a={};s(a,{Immer:()=>Fe,applyPatches:()=>Ve,castDraft:()=>tt,castImmutable:()=>ve,createDraft:()=>Je,current:()=>qe,enableMapSet:()=>pe,enablePatches:()=>ue,finishDraft:()=>lt,freeze:()=>A,immerable:()=>c,isDraft:()=>d,isDraftable:()=>h,nothing:()=>f,original:()=>b,produce:()=>fe,produceWithPatches:()=>ge,setAutoFreeze:()=>se,setUseStrictIteration:()=>Ne,setUseStrictShallowCopy:()=>te}),$2=o(a);var f=Symbol.for("immer-nothing"),c=Symbol.for("immer-draftable"),l=Symbol.for("immer-state");function u(Z,...oe){throw new Error(`[Immer] minified error nr: ${Z}. Full error at: https://bit.ly/3cXEKWf`)}var p=Object.getPrototypeOf;function d(Z){return!!Z&&!!Z[l]}function h(Z){var oe;return Z?v(Z)||Array.isArray(Z)||!!Z[c]||!!((oe=Z.constructor)!=null&&oe[c])||S(Z)||T(Z):!1}var y=Object.prototype.constructor.toString(),m=new WeakMap;function v(Z){if(!Z||typeof Z!="object")return!1;let oe=Object.getPrototypeOf(Z);if(oe===null||oe===Object.prototype)return!0;let me=Object.hasOwnProperty.call(oe,"constructor")&&oe.constructor;if(me===Object)return!0;if(typeof me!="function")return!1;let xe=m.get(me);return xe===void 0&&(xe=Function.toString.call(me),m.set(me,xe)),xe===y}function b(Z){return d(Z)||u(15,Z),Z[l].t}function w(Z,oe,me=!0){_(Z)===0?(me?Reflect.ownKeys(Z):Object.keys(Z)).forEach(xe=>{oe(xe,Z[xe],Z)}):Z.forEach((xe,Pe)=>oe(Pe,xe,Z))}function _(Z){let oe=Z[l];return oe?oe.o:Array.isArray(Z)?1:S(Z)?2:T(Z)?3:0}function C(Z,oe){return _(Z)===2?Z.has(oe):Object.prototype.hasOwnProperty.call(Z,oe)}function I(Z,oe){return _(Z)===2?Z.get(oe):Z[oe]}function k(Z,oe,me){let xe=_(Z);xe===2?Z.set(oe,me):xe===3?Z.add(me):Z[oe]=me}function E(Z,oe){return Z===oe?Z!==0||1/Z===1/oe:Z!==Z&&oe!==oe}function S(Z){return Z instanceof Map}function T(Z){return Z instanceof Set}function P(Z){return Z.e||Z.t}function g(Z,oe){if(S(Z))return new Map(Z);if(T(Z))return new Set(Z);if(Array.isArray(Z))return Array.prototype.slice.call(Z);let me=v(Z);if(oe===!0||oe==="class_only"&&!me){let xe=Object.getOwnPropertyDescriptors(Z);delete xe[l];let Pe=Reflect.ownKeys(xe);for(let ke=0;ke<Pe.length;ke++){let Oe=Pe[ke],Ue=xe[Oe];Ue.writable===!1&&(Ue.writable=!0,Ue.configurable=!0),(Ue.get||Ue.set)&&(xe[Oe]={configurable:!0,writable:!0,enumerable:Ue.enumerable,value:Z[Oe]})}return Object.create(p(Z),xe)}else{let xe=p(Z);if(xe!==null&&me)return{...Z};let Pe=Object.create(xe);return Object.assign(Pe,Z)}}function A(Z,oe=!1){return O(Z)||d(Z)||!h(Z)||(_(Z)>1&&Object.defineProperties(Z,{set:D,add:D,clear:D,delete:D}),Object.freeze(Z),oe&&Object.values(Z).forEach(me=>A(me,!0))),Z}function x(){u(2)}var D={value:x};function O(Z){return Z===null||typeof Z!="object"?!0:Object.isFrozen(Z)}var B={};function L(Z){let oe=B[Z];return oe||u(0,Z),oe}function M(Z,oe){B[Z]||(B[Z]=oe)}var R;function N(){return R}function F(Z,oe){return{a:[],i:Z,f:oe,P:!0,d:0}}function z(Z,oe){oe&&(L("Patches"),Z.u=[],Z.h=[],Z.I=oe)}function Y(Z){j(Z),Z.a.forEach(V),Z.a=null}function j(Z){Z===R&&(R=Z.i)}function re(Z){return R=F(R,Z)}function V(Z){let oe=Z[l];oe.o===0||oe.o===1?oe.x():oe.m=!0}function U(Z,oe){oe.d=oe.a.length;let me=oe.a[0];return Z!==void 0&&Z!==me?(me[l].s&&(Y(oe),u(4)),h(Z)&&(Z=X(oe,Z),oe.i||_e(oe,Z)),oe.u&&L("Patches").T(me[l].t,Z,oe.u,oe.h)):Z=X(oe,me,[]),Y(oe),oe.u&&oe.I(oe.u,oe.h),Z!==f?Z:void 0}function X(Z,oe,me){if(O(oe))return oe;let xe=Z.f.shouldUseStrictIteration(),Pe=oe[l];if(!Pe)return w(oe,(ke,Oe)=>ye(Z,Pe,oe,ke,Oe,me),xe),oe;if(Pe.n!==Z)return oe;if(!Pe.s)return _e(Z,Pe.t,!0),Pe.t;if(!Pe.c){Pe.c=!0,Pe.n.d--;let ke=Pe.e,Oe=ke,Ue=!1;Pe.o===3&&(Oe=new Set(ke),ke.clear(),Ue=!0),w(Oe,(Ie,Re)=>ye(Z,Pe,ke,Ie,Re,me,Ue),xe),_e(Z,ke,!1),me&&Z.u&&L("Patches").g(Pe,me,Z.u,Z.h)}return Pe.e}function ye(Z,oe,me,xe,Pe,ke,Oe){if(Pe==null||typeof Pe!="object"&&!Oe)return;let Ue=O(Pe);if(!(Ue&&!Oe)){if(d(Pe)){let Ie=ke&&oe&&oe.o!==3&&!C(oe.r,xe)?ke.concat(xe):void 0,Re=X(Z,Pe,Ie);if(k(me,xe,Re),d(Re))Z.P=!1;else return}else Oe&&me.add(Pe);if(h(Pe)&&!Ue){if(!Z.f.y&&Z.d<1||oe&&oe.t&&oe.t[xe]===Pe&&Ue)return;X(Z,Pe),(!oe||!oe.n.i)&&typeof xe!="symbol"&&(S(me)?me.has(xe):Object.prototype.propertyIsEnumerable.call(me,xe))&&_e(Z,Pe)}}}function _e(Z,oe,me=!1){!Z.i&&Z.f.y&&Z.P&&A(oe,me)}function Ae(Z,oe){let me=Array.isArray(Z),xe={o:me?1:0,n:oe?oe.n:N(),s:!1,c:!1,r:{},i:oe,t:Z,p:null,e:null,x:null,l:!1},Pe=xe,ke=H;me&&(Pe=[xe],ke=q);let{revoke:Oe,proxy:Ue}=Proxy.revocable(Pe,ke);return xe.p=Ue,xe.x=Oe,Ue}var H={get(Z,oe){if(oe===l)return Z;let me=P(Z);if(!C(me,oe))return ee(Z,me,oe);let xe=me[oe];return Z.c||!h(xe)?xe:xe===W(Z.t,oe)?(ie(Z),Z.e[oe]=De(xe,Z)):xe},has(Z,oe){return oe in P(Z)},ownKeys(Z){return Reflect.ownKeys(P(Z))},set(Z,oe,me){let xe=le(P(Z),oe);if(xe!=null&&xe.set)return xe.set.call(Z.p,me),!0;if(!Z.s){let Pe=W(P(Z),oe),ke=Pe==null?void 0:Pe[l];if(ke&&ke.t===me)return Z.e[oe]=me,Z.r[oe]=!1,!0;if(E(me,Pe)&&(me!==void 0||C(Z.t,oe)))return!0;ie(Z),ce(Z)}return Z.e[oe]===me&&(me!==void 0||oe in Z.e)||Number.isNaN(me)&&Number.isNaN(Z.e[oe])||(Z.e[oe]=me,Z.r[oe]=!0),!0},deleteProperty(Z,oe){return W(Z.t,oe)!==void 0||oe in Z.t?(Z.r[oe]=!1,ie(Z),ce(Z)):delete Z.r[oe],Z.e&&delete Z.e[oe],!0},getOwnPropertyDescriptor(Z,oe){let me=P(Z),xe=Reflect.getOwnPropertyDescriptor(me,oe);return xe&&{writable:!0,configurable:Z.o!==1||oe!=="length",enumerable:xe.enumerable,value:me[oe]}},defineProperty(){u(11)},getPrototypeOf(Z){return p(Z.t)},setPrototypeOf(){u(12)}},q={};w(H,(Z,oe)=>{q[Z]=function(){return arguments[0]=arguments[0][0],oe.apply(this,arguments)}}),q.deleteProperty=function(Z,oe){return q.set.call(this,Z,oe,void 0)},q.set=function(Z,oe,me){return H.set.call(this,Z[0],oe,me,Z[0])};function W(Z,oe){let me=Z[l];return(me?P(me):Z)[oe]}function ee(Z,oe,me){var Pe;let xe=le(oe,me);return xe?"value"in xe?xe.value:(Pe=xe.get)==null?void 0:Pe.call(Z.p):void 0}function le(Z,oe){if(!(oe in Z))return;let me=p(Z);for(;me;){let xe=Object.getOwnPropertyDescriptor(me,oe);if(xe)return xe;me=p(me)}}function ce(Z){Z.s||(Z.s=!0,Z.i&&ce(Z.i))}function ie(Z){Z.e||(Z.e=g(Z.t,Z.n.f.S))}var Fe=class{constructor(Z){this.y=!0,this.S=!1,this.b=!0,this.produce=(oe,me,xe)=>{if(typeof oe=="function"&&typeof me!="function"){let ke=me;me=oe;let Oe=this;return function(Ue=ke,...Ie){return Oe.produce(Ue,Re=>me.call(this,Re,...Ie))}}typeof me!="function"&&u(6),xe!==void 0&&typeof xe!="function"&&u(7);let Pe;if(h(oe)){let ke=re(this),Oe=De(oe,void 0),Ue=!0;try{Pe=me(Oe),Ue=!1}finally{Ue?Y(ke):j(ke)}return z(ke,xe),U(Pe,ke)}else if(!oe||typeof oe!="object"){if(Pe=me(oe),Pe===void 0&&(Pe=oe),Pe===f&&(Pe=void 0),this.y&&A(Pe,!0),xe){let ke=[],Oe=[];L("Patches").T(oe,Pe,ke,Oe),xe(ke,Oe)}return Pe}else u(1,oe)},this.produceWithPatches=(oe,me)=>{if(typeof oe=="function")return(ke,...Oe)=>this.produceWithPatches(ke,Ue=>oe(Ue,...Oe));let xe,Pe;return[this.produce(oe,me,(ke,Oe)=>{xe=ke,Pe=Oe}),xe,Pe]},typeof(Z==null?void 0:Z.autoFreeze)=="boolean"&&this.setAutoFreeze(Z.autoFreeze),typeof(Z==null?void 0:Z.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(Z.useStrictShallowCopy),typeof(Z==null?void 0:Z.useStrictIteration)=="boolean"&&this.setUseStrictIteration(Z.useStrictIteration)}createDraft(Z){h(Z)||u(8),d(Z)&&(Z=qe(Z));let oe=re(this),me=De(Z,void 0);return me[l].l=!0,j(oe),me}finishDraft(Z,oe){let me=Z&&Z[l];(!me||!me.l)&&u(9);let{n:xe}=me;return z(xe,oe),U(void 0,xe)}setAutoFreeze(Z){this.y=Z}setUseStrictShallowCopy(Z){this.S=Z}setUseStrictIteration(Z){this.b=Z}shouldUseStrictIteration(){return this.b}applyPatches(Z,oe){let me;for(me=oe.length-1;me>=0;me--){let Pe=oe[me];if(Pe.path.length===0&&Pe.op==="replace"){Z=Pe.value;break}}me>-1&&(oe=oe.slice(me+1));let xe=L("Patches").A;return d(Z)?xe(Z,oe):this.produce(Z,Pe=>xe(Pe,oe))}};function De(Z,oe){let me=S(Z)?L("MapSet").D(Z,oe):T(Z)?L("MapSet").R(Z,oe):Ae(Z,oe);return(oe?oe.n:N()).a.push(me),me}function qe(Z){return d(Z)||u(10,Z),he(Z)}function he(Z){if(!h(Z)||O(Z))return Z;let oe=Z[l],me,xe=!0;if(oe){if(!oe.s)return oe.t;oe.c=!0,me=g(Z,oe.n.f.S),xe=oe.n.f.shouldUseStrictIteration()}else me=g(Z,!0);return w(me,(Pe,ke)=>{k(me,Pe,he(ke))},xe),oe&&(oe.c=!1),me}function ue(){let Z="replace",oe="add",me="remove";function xe(we,Ce,Be,Le){switch(we.o){case 0:case 2:return ke(we,Ce,Be,Le);case 1:return Pe(we,Ce,Be,Le);case 3:return Oe(we,Ce,Be,Le)}}function Pe(we,Ce,Be,Le){let{t:Me,r:$}=we,J=we.e;J.length<Me.length&&([Me,J]=[J,Me],[Be,Le]=[Le,Be]);for(let Q=0;Q<Me.length;Q++)if($[Q]&&J[Q]!==Me[Q]){let K=Ce.concat([Q]);Be.push({op:Z,path:K,value:et(J[Q])}),Le.push({op:Z,path:K,value:et(Me[Q])})}for(let Q=Me.length;Q<J.length;Q++){let K=Ce.concat([Q]);Be.push({op:oe,path:K,value:et(J[Q])})}for(let Q=J.length-1;Me.length<=Q;--Q){let K=Ce.concat([Q]);Le.push({op:me,path:K})}}function ke(we,Ce,Be,Le){let{t:Me,e:$}=we;w(we.r,(J,Q)=>{let K=I(Me,J),ae=I($,J),Se=Q?C(Me,J)?Z:oe:me;if(K===ae&&Se===Z)return;let Te=Ce.concat(J);Be.push(Se===me?{op:Se,path:Te}:{op:Se,path:Te,value:ae}),Le.push(Se===oe?{op:me,path:Te}:Se===me?{op:oe,path:Te,value:et(K)}:{op:Z,path:Te,value:et(K)})})}function Oe(we,Ce,Be,Le){let{t:Me,e:$}=we,J=0;Me.forEach(Q=>{if(!$.has(Q)){let K=Ce.concat([J]);Be.push({op:me,path:K,value:Q}),Le.unshift({op:oe,path:K,value:Q})}J++}),J=0,$.forEach(Q=>{if(!Me.has(Q)){let K=Ce.concat([J]);Be.push({op:oe,path:K,value:Q}),Le.unshift({op:me,path:K,value:Q})}J++})}function Ue(we,Ce,Be,Le){Be.push({op:Z,path:[],value:Ce===f?void 0:Ce}),Le.push({op:Z,path:[],value:we})}function Ie(we,Ce){return Ce.forEach(Be=>{let{path:Le,op:Me}=Be,$=we;for(let ae=0;ae<Le.length-1;ae++){let Se=_($),Te=Le[ae];typeof Te!="string"&&typeof Te!="number"&&(Te=""+Te),(Se===0||Se===1)&&(Te==="__proto__"||Te==="constructor")&&u(16+3),typeof $=="function"&&Te==="prototype"&&u(16+3),$=I($,Te),typeof $!="object"&&u(16+2,Le.join("/"))}let J=_($),Q=Re(Be.value),K=Le[Le.length-1];switch(Me){case Z:switch(J){case 2:return $.set(K,Q);case 3:u(16);default:return $[K]=Q}case oe:switch(J){case 1:return K==="-"?$.push(Q):$.splice(K,0,Q);case 2:return $.set(K,Q);case 3:return $.add(Q);default:return $[K]=Q}case me:switch(J){case 1:return $.splice(K,1);case 2:return $.delete(K);case 3:return $.delete(Be.value);default:return delete $[K]}default:u(16+1,Me)}}),we}function Re(we){if(!h(we))return we;if(Array.isArray(we))return we.map(Re);if(S(we))return new Map(Array.from(we.entries()).map(([Be,Le])=>[Be,Re(Le)]));if(T(we))return new Set(Array.from(we).map(Re));let Ce=Object.create(p(we));for(let Be in we)Ce[Be]=Re(we[Be]);return C(we,c)&&(Ce[c]=we[c]),Ce}function et(we){return d(we)?Re(we):we}M("Patches",{A:Ie,g:xe,T:Ue})}function pe(){class Z extends Map{constructor(Ie,Re){super(),this[l]={o:2,i:Re,n:Re?Re.n:N(),s:!1,c:!1,e:void 0,r:void 0,t:Ie,p:this,l:!1,m:!1}}get size(){return P(this[l]).size}has(Ie){return P(this[l]).has(Ie)}set(Ie,Re){let et=this[l];return Oe(et),(!P(et).has(Ie)||P(et).get(Ie)!==Re)&&(me(et),ce(et),et.r.set(Ie,!0),et.e.set(Ie,Re),et.r.set(Ie,!0)),this}delete(Ie){if(!this.has(Ie))return!1;let Re=this[l];return Oe(Re),me(Re),ce(Re),Re.t.has(Ie)?Re.r.set(Ie,!1):Re.r.delete(Ie),Re.e.delete(Ie),!0}clear(){let Ie=this[l];Oe(Ie),P(Ie).size&&(me(Ie),ce(Ie),Ie.r=new Map,w(Ie.t,Re=>{Ie.r.set(Re,!1)}),Ie.e.clear())}forEach(Ie,Re){let et=this[l];P(et).forEach((we,Ce,Be)=>{Ie.call(Re,this.get(Ce),Ce,this)})}get(Ie){let Re=this[l];Oe(Re);let et=P(Re).get(Ie);if(Re.c||!h(et)||et!==Re.t.get(Ie))return et;let we=De(et,Re);return me(Re),Re.e.set(Ie,we),we}keys(){return P(this[l]).keys()}values(){let Ie=this.keys();return{[Symbol.iterator]:()=>this.values(),next:()=>{let Re=Ie.next();return Re.done?Re:{done:!1,value:this.get(Re.value)}}}}entries(){let Ie=this.keys();return{[Symbol.iterator]:()=>this.entries(),next:()=>{let Re=Ie.next();if(Re.done)return Re;let et=this.get(Re.value);return{done:!1,value:[Re.value,et]}}}}[Symbol.iterator](){return this.entries()}}function oe(Ue,Ie){return new Z(Ue,Ie)}function me(Ue){Ue.e||(Ue.r=new Map,Ue.e=new Map(Ue.t))}class xe extends Set{constructor(Ie,Re){super(),this[l]={o:3,i:Re,n:Re?Re.n:N(),s:!1,c:!1,e:void 0,t:Ie,p:this,a:new Map,m:!1,l:!1}}get size(){return P(this[l]).size}has(Ie){let Re=this[l];return Oe(Re),Re.e?!!(Re.e.has(Ie)||Re.a.has(Ie)&&Re.e.has(Re.a.get(Ie))):Re.t.has(Ie)}add(Ie){let Re=this[l];return Oe(Re),this.has(Ie)||(ke(Re),ce(Re),Re.e.add(Ie)),this}delete(Ie){if(!this.has(Ie))return!1;let Re=this[l];return Oe(Re),ke(Re),ce(Re),Re.e.delete(Ie)||(Re.a.has(Ie)?Re.e.delete(Re.a.get(Ie)):!1)}clear(){let Ie=this[l];Oe(Ie),P(Ie).size&&(ke(Ie),ce(Ie),Ie.e.clear())}values(){let Ie=this[l];return Oe(Ie),ke(Ie),Ie.e.values()}entries(){let Ie=this[l];return Oe(Ie),ke(Ie),Ie.e.entries()}keys(){return this.values()}[Symbol.iterator](){return this.values()}forEach(Ie,Re){let et=this.values(),we=et.next();for(;!we.done;)Ie.call(Re,we.value,we.value,this),we=et.next()}}function Pe(Ue,Ie){return new xe(Ue,Ie)}function ke(Ue){Ue.e||(Ue.e=new Set,Ue.t.forEach(Ie=>{if(h(Ie)){let Re=De(Ie,Ue);Ue.a.set(Ie,Re),Ue.e.add(Re)}else Ue.e.add(Ie)}))}function Oe(Ue){Ue.m&&u(3,JSON.stringify(P(Ue)))}M("MapSet",{D:oe,R:Pe})}var de=new Fe,fe=de.produce,ge=de.produceWithPatches.bind(de),se=de.setAutoFreeze.bind(de),te=de.setUseStrictShallowCopy.bind(de),Ne=de.setUseStrictIteration.bind(de),Ve=de.applyPatches.bind(de),Je=de.createDraft.bind(de),lt=de.finishDraft.bind(de);function tt(Z){return Z}function ve(Z){return Z}return $2}var g8;function ui(){return g8||(g8=1,j2.exports=OV()),j2.exports}var H2={},V2={},G2,m8;function MV(){return m8||(m8=1,G2=function(){if(typeof globalThis>"u")return null;var t={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return t.RTCPeerConnection?t:null}),G2}var zl={exports:{}},v8;function NV(){if(v8)return zl.exports;v8=1;var e=65536,t=4294967295;function r(){throw new Error(`Secure random number generation is not supported by this browser.
89
+ Use Chrome, Firefox or Internet Explorer 11`)}var n=LP().Buffer,s=rt.crypto||rt.msCrypto;s&&s.getRandomValues?zl.exports=i:zl.exports=r;function i(o,a){if(o>t)throw new RangeError("requested too many random bytes");var f=n.allocUnsafe(o);if(o>0)if(o>e)for(var c=0;c<o;c+=e)s.getRandomValues(f.slice(c,c+e));else s.getRandomValues(f);return typeof a=="function"?Mr.nextTick(function(){a(null,f)}):f}return zl.exports}/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var z2,b8;function UV(){if(b8)return z2;b8=1;let e;return z2=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:rt):t=>(e||(e=Promise.resolve())).then(t).catch(r=>setTimeout(()=>{throw r},0)),z2}var W2,_8;function LV(){if(_8)return W2;_8=1;function e(r,n){for(const s in n)Object.defineProperty(r,s,{value:n[s],enumerable:!0,configurable:!0});return r}function t(r,n,s){if(!r||typeof r=="string")throw new TypeError("Please pass an Error to err-code");s||(s={}),typeof n=="object"&&(s=n,n=""),n&&(s.code=n);try{return e(r,s)}catch{s.message=r.message,s.stack=r.stack;const o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(r)),e(new o,s)}}return W2=t,W2}/*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Y2,w8;function KV(){if(w8)return Y2;w8=1;const e=Hn()("simple-peer"),t=MV(),r=NV(),n=KP(),s=UV(),i=LV(),{Buffer:o}=e9(),a=64*1024,f=5*1e3,c=5*1e3;function l(d){return d.replace(/a=ice-options:trickle\s\n/g,"")}function u(d){console.warn(d)}class p extends n.Duplex{constructor(h){if(h=Object.assign({allowHalfOpen:!1},h),super(h),this._id=r(4).toString("hex").slice(0,7),this._debug("new peer %o",h),this.channelName=h.initiator?h.channelName||r(20).toString("hex"):null,this.initiator=h.initiator||!1,this.channelConfig=h.channelConfig||p.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},p.config,h.config),this.offerOptions=h.offerOptions||{},this.answerOptions=h.answerOptions||{},this.sdpTransform=h.sdpTransform||(y=>y),this.streams=h.streams||(h.stream?[h.stream]:[]),this.trickle=h.trickle!==void 0?h.trickle:!0,this.allowHalfTrickle=h.allowHalfTrickle!==void 0?h.allowHalfTrickle:!1,this.iceCompleteTimeout=h.iceCompleteTimeout||f,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=h.wrtc&&typeof h.wrtc=="object"?h.wrtc:t(),!this._wrtc)throw i(typeof window>"u"?new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"):new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(y){this.destroy(i(y,"ERR_PC_CONSTRUCTOR"));return}this._isReactNativeWebrtc=typeof this._pc._peerConnectionId=="number",this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=y=>{this._onIceCandidate(y)},typeof this._pc.peerIdentity=="object"&&this._pc.peerIdentity.catch(y=>{this.destroy(i(y,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=y=>{this._setupData(y)},this.streams&&this.streams.forEach(y=>{this.addStream(y)}),this._pc.ontrack=y=>{this._onTrack(y)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&this._channel.readyState==="open"}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(h){if(!this.destroying){if(this.destroyed)throw i(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if(typeof h=="string")try{h=JSON.parse(h)}catch{h={}}this._debug("signal()"),h.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),h.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(h.transceiverRequest.kind,h.transceiverRequest.init)),h.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(h.candidate):this._pendingCandidates.push(h.candidate)),h.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(h)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(y=>{this._addIceCandidate(y)}),this._pendingCandidates=[],this._pc.remoteDescription.type==="offer"&&this._createAnswer())}).catch(y=>{this.destroy(i(y,"ERR_SET_REMOTE_DESCRIPTION"))}),!h.sdp&&!h.candidate&&!h.renegotiate&&!h.transceiverRequest&&this.destroy(i(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(h){const y=new this._wrtc.RTCIceCandidate(h);this._pc.addIceCandidate(y).catch(m=>{!y.address||y.address.endsWith(".local")?u("Ignoring unsupported ICE candidate."):this.destroy(i(m,"ERR_ADD_ICE_CANDIDATE"))})}send(h){if(!this.destroying){if(this.destroyed)throw i(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(h)}}addTransceiver(h,y){if(!this.destroying){if(this.destroyed)throw i(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(h,y),this._needsNegotiation()}catch(m){this.destroy(i(m,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:h,init:y}})}}addStream(h){if(!this.destroying){if(this.destroyed)throw i(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),h.getTracks().forEach(y=>{this.addTrack(y,h)})}}addTrack(h,y){if(this.destroying)return;if(this.destroyed)throw i(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");const m=this._senderMap.get(h)||new Map;let v=m.get(y);if(!v)v=this._pc.addTrack(h,y),m.set(y,v),this._senderMap.set(h,m),this._needsNegotiation();else throw v.removed?i(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):i(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED")}replaceTrack(h,y,m){if(this.destroying)return;if(this.destroyed)throw i(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");const v=this._senderMap.get(h),b=v?v.get(m):null;if(!b)throw i(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");y&&this._senderMap.set(y,v),b.replaceTrack!=null?b.replaceTrack(y):this.destroy(i(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK"))}removeTrack(h,y){if(this.destroying)return;if(this.destroyed)throw i(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");const m=this._senderMap.get(h),v=m?m.get(y):null;if(!v)throw i(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{v.removed=!0,this._pc.removeTrack(v)}catch(b){b.name==="NS_ERROR_UNEXPECTED"?this._sendersAwaitingStable.push(v):this.destroy(i(b,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(h){if(!this.destroying){if(this.destroyed)throw i(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),h.getTracks().forEach(y=>{this.removeTrack(y,h)})}}_needsNegotiation(){this._debug("_needsNegotiation"),!this._batchedNegotiation&&(this._batchedNegotiation=!0,s(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw i(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(h){this._destroy(h,()=>{})}_destroy(h,y){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",h&&(h.message||h)),s(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",h&&(h.message||h)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch{}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch{}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,h&&this.emit("error",h),this.emit("close"),y()}))}_setupData(h){if(!h.channel)return this.destroy(i(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=h.channel,this._channel.binaryType="arraybuffer",typeof this._channel.bufferedAmountLowThreshold=="number"&&(this._channel.bufferedAmountLowThreshold=a),this.channelName=this._channel.label,this._channel.onmessage=m=>{this._onChannelMessage(m)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=m=>{const v=m.error instanceof Error?m.error:new Error(`Datachannel error: ${m.message} ${m.filename}:${m.lineno}:${m.colno}`);this.destroy(i(v,"ERR_DATA_CHANNEL"))};let y=!1;this._closingInterval=setInterval(()=>{this._channel&&this._channel.readyState==="closing"?(y&&this._onChannelClose(),y=!0):y=!1},c)}_read(){}_write(h,y,m){if(this.destroyed)return m(i(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(h)}catch(v){return this.destroy(i(v,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>a?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=m):m(null)}else this._debug("write before connect"),this._chunk=h,this._cb=m}_onFinish(){if(this.destroyed)return;const h=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?h():this.once("connect",h)}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(h=>{if(this.destroyed)return;!this.trickle&&!this.allowHalfTrickle&&(h.sdp=l(h.sdp)),h.sdp=this.sdpTransform(h.sdp);const y=()=>{if(this.destroyed)return;const b=this._pc.localDescription||h;this._debug("signal"),this.emit("signal",{type:b.type,sdp:b.sdp})},m=()=>{this._debug("createOffer success"),!this.destroyed&&(this.trickle||this._iceComplete?y():this.once("_iceComplete",y))},v=b=>{this.destroy(i(b,"ERR_SET_LOCAL_DESCRIPTION"))};this._pc.setLocalDescription(h).then(m).catch(v)}).catch(h=>{this.destroy(i(h,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(h=>{!h.mid&&h.sender.track&&!h.requested&&(h.requested=!0,this.addTransceiver(h.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(h=>{if(this.destroyed)return;!this.trickle&&!this.allowHalfTrickle&&(h.sdp=l(h.sdp)),h.sdp=this.sdpTransform(h.sdp);const y=()=>{if(this.destroyed)return;const b=this._pc.localDescription||h;this._debug("signal"),this.emit("signal",{type:b.type,sdp:b.sdp}),this.initiator||this._requestMissingTransceivers()},m=()=>{this.destroyed||(this.trickle||this._iceComplete?y():this.once("_iceComplete",y))},v=b=>{this.destroy(i(b,"ERR_SET_LOCAL_DESCRIPTION"))};this._pc.setLocalDescription(h).then(m).catch(v)}).catch(h=>{this.destroy(i(h,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||this._pc.connectionState==="failed"&&this.destroy(i(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const h=this._pc.iceConnectionState,y=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",h,y),this.emit("iceStateChange",h,y),(h==="connected"||h==="completed")&&(this._pcReady=!0,this._maybeReady()),h==="failed"&&this.destroy(i(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),h==="closed"&&this.destroy(i(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(h){const y=m=>(Object.prototype.toString.call(m.values)==="[object Array]"&&m.values.forEach(v=>{Object.assign(m,v)}),m);this._pc.getStats.length===0||this._isReactNativeWebrtc?this._pc.getStats().then(m=>{const v=[];m.forEach(b=>{v.push(y(b))}),h(null,v)},m=>h(m)):this._pc.getStats.length>0?this._pc.getStats(m=>{if(this.destroyed)return;const v=[];m.result().forEach(b=>{const w={};b.names().forEach(_=>{w[_]=b.stat(_)}),w.id=b.id,w.type=b.type,w.timestamp=b.timestamp,v.push(y(w))}),h(null,v)},m=>h(m)):h(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const h=()=>{this.destroyed||this.getStats((y,m)=>{if(this.destroyed)return;y&&(m=[]);const v={},b={},w={};let _=!1;m.forEach(I=>{(I.type==="remotecandidate"||I.type==="remote-candidate")&&(v[I.id]=I),(I.type==="localcandidate"||I.type==="local-candidate")&&(b[I.id]=I),(I.type==="candidatepair"||I.type==="candidate-pair")&&(w[I.id]=I)});const C=I=>{_=!0;let k=b[I.localCandidateId];k&&(k.ip||k.address)?(this.localAddress=k.ip||k.address,this.localPort=Number(k.port)):k&&k.ipAddress?(this.localAddress=k.ipAddress,this.localPort=Number(k.portNumber)):typeof I.googLocalAddress=="string"&&(k=I.googLocalAddress.split(":"),this.localAddress=k[0],this.localPort=Number(k[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let E=v[I.remoteCandidateId];E&&(E.ip||E.address)?(this.remoteAddress=E.ip||E.address,this.remotePort=Number(E.port)):E&&E.ipAddress?(this.remoteAddress=E.ipAddress,this.remotePort=Number(E.portNumber)):typeof I.googRemoteAddress=="string"&&(E=I.googRemoteAddress.split(":"),this.remoteAddress=E[0],this.remotePort=Number(E[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(m.forEach(I=>{I.type==="transport"&&I.selectedCandidatePairId&&C(w[I.selectedCandidatePairId]),(I.type==="googCandidatePair"&&I.googActiveConnection==="true"||(I.type==="candidatepair"||I.type==="candidate-pair")&&I.selected)&&C(I)}),!_&&(!Object.keys(w).length||Object.keys(b).length)){setTimeout(h,100);return}else this._connecting=!1,this._connected=!0;if(this._chunk){try{this.send(this._chunk)}catch(k){return this.destroy(i(k,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const I=this._cb;this._cb=null,I(null)}typeof this._channel.bufferedAmountLowThreshold!="number"&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")})};h()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>a||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||(this._pc.signalingState==="stable"&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(h=>{this._pc.removeTrack(h),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(h){this.destroyed||(h.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:h.candidate.candidate,sdpMLineIndex:h.candidate.sdpMLineIndex,sdpMid:h.candidate.sdpMid}}):!h.candidate&&!this._iceComplete&&(this._iceComplete=!0,this.emit("_iceComplete")),h.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(h){if(this.destroyed)return;let y=h.data;y instanceof ArrayBuffer&&(y=o.from(y)),this.push(y)}_onChannelBufferedAmountLow(){if(this.destroyed||!this._cb)return;this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const h=this._cb;this._cb=null,h(null)}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(h){this.destroyed||h.streams.forEach(y=>{this._debug("on track"),this.emit("track",h.track,y),this._remoteTracks.push({track:h.track,stream:y}),!this._remoteStreams.some(m=>m.id===y.id)&&(this._remoteStreams.push(y),s(()=>{this._debug("on stream"),this.emit("stream",y)}))})}_debug(){const h=[].slice.call(arguments);h[0]="["+this._id+"] "+h[0],e.apply(null,h)}}return p.WEBRTC_SUPPORT=!!t(),p.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},p.channelConfig={},Y2=p,Y2}var Wl={},Z2={},Bc={},Cr={},J2={},Oc={},Yl={},E8;function TA(){if(E8)return Yl;E8=1,Object.defineProperty(Yl,"__esModule",{value:!0}),Yl.default=r;let e;const t=new Uint8Array(16);function r(){if(!e&&(e=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!e))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(t)}return Yl}var Ja={},Mc={},Nc={},A8;function FV(){if(A8)return Nc;A8=1,Object.defineProperty(Nc,"__esModule",{value:!0}),Nc.default=void 0;var e=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;return Nc.default=e,Nc}var S8;function Zf(){if(S8)return Mc;S8=1,Object.defineProperty(Mc,"__esModule",{value:!0}),Mc.default=void 0;var e=t(FV());function t(s){return s&&s.__esModule?s:{default:s}}function r(s){return typeof s=="string"&&e.default.test(s)}var n=r;return Mc.default=n,Mc}var P8;function Jf(){if(P8)return Ja;P8=1,Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.default=void 0,Ja.unsafeStringify=n;var e=t(Zf());function t(o){return o&&o.__esModule?o:{default:o}}const r=[];for(let o=0;o<256;++o)r.push((o+256).toString(16).slice(1));function n(o,a=0){return r[o[a+0]]+r[o[a+1]]+r[o[a+2]]+r[o[a+3]]+"-"+r[o[a+4]]+r[o[a+5]]+"-"+r[o[a+6]]+r[o[a+7]]+"-"+r[o[a+8]]+r[o[a+9]]+"-"+r[o[a+10]]+r[o[a+11]]+r[o[a+12]]+r[o[a+13]]+r[o[a+14]]+r[o[a+15]]}function s(o,a=0){const f=n(o,a);if(!(0,e.default)(f))throw TypeError("Stringified UUID is invalid");return f}var i=s;return Ja.default=i,Ja}var x8;function qV(){if(x8)return Oc;x8=1,Object.defineProperty(Oc,"__esModule",{value:!0}),Oc.default=void 0;var e=r(TA()),t=Jf();function r(c){return c&&c.__esModule?c:{default:c}}let n,s,i=0,o=0;function a(c,l,u){let p=l&&u||0;const d=l||new Array(16);c=c||{};let h=c.node||n,y=c.clockseq!==void 0?c.clockseq:s;if(h==null||y==null){const C=c.random||(c.rng||e.default)();h==null&&(h=n=[C[0]|1,C[1],C[2],C[3],C[4],C[5]]),y==null&&(y=s=(C[6]<<8|C[7])&16383)}let m=c.msecs!==void 0?c.msecs:Date.now(),v=c.nsecs!==void 0?c.nsecs:o+1;const b=m-i+(v-o)/1e4;if(b<0&&c.clockseq===void 0&&(y=y+1&16383),(b<0||m>i)&&c.nsecs===void 0&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");i=m,o=v,s=y,m+=122192928e5;const w=((m&268435455)*1e4+v)%4294967296;d[p++]=w>>>24&255,d[p++]=w>>>16&255,d[p++]=w>>>8&255,d[p++]=w&255;const _=m/4294967296*1e4&268435455;d[p++]=_>>>8&255,d[p++]=_&255,d[p++]=_>>>24&15|16,d[p++]=_>>>16&255,d[p++]=y>>>8|128,d[p++]=y&255;for(let C=0;C<6;++C)d[p+C]=h[C];return l||(0,t.unsafeStringify)(d)}var f=a;return Oc.default=f,Oc}var Uc={},ms={},Lc={},T8;function CA(){if(T8)return Lc;T8=1,Object.defineProperty(Lc,"__esModule",{value:!0}),Lc.default=void 0;var e=t(Zf());function t(s){return s&&s.__esModule?s:{default:s}}function r(s){if(!(0,e.default)(s))throw TypeError("Invalid UUID");let i;const o=new Uint8Array(16);return o[0]=(i=parseInt(s.slice(0,8),16))>>>24,o[1]=i>>>16&255,o[2]=i>>>8&255,o[3]=i&255,o[4]=(i=parseInt(s.slice(9,13),16))>>>8,o[5]=i&255,o[6]=(i=parseInt(s.slice(14,18),16))>>>8,o[7]=i&255,o[8]=(i=parseInt(s.slice(19,23),16))>>>8,o[9]=i&255,o[10]=(i=parseInt(s.slice(24,36),16))/1099511627776&255,o[11]=i/4294967296&255,o[12]=i>>>24&255,o[13]=i>>>16&255,o[14]=i>>>8&255,o[15]=i&255,o}var n=r;return Lc.default=n,Lc}var C8;function IA(){if(C8)return ms;C8=1,Object.defineProperty(ms,"__esModule",{value:!0}),ms.URL=ms.DNS=void 0,ms.default=o;var e=Jf(),t=r(CA());function r(a){return a&&a.__esModule?a:{default:a}}function n(a){a=unescape(encodeURIComponent(a));const f=[];for(let c=0;c<a.length;++c)f.push(a.charCodeAt(c));return f}const s="6ba7b810-9dad-11d1-80b4-00c04fd430c8";ms.DNS=s;const i="6ba7b811-9dad-11d1-80b4-00c04fd430c8";ms.URL=i;function o(a,f,c){function l(u,p,d,h){var y;if(typeof u=="string"&&(u=n(u)),typeof p=="string"&&(p=(0,t.default)(p)),((y=p)===null||y===void 0?void 0:y.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let m=new Uint8Array(16+u.length);if(m.set(p),m.set(u,p.length),m=c(m),m[6]=m[6]&15|f,m[8]=m[8]&63|128,d){h=h||0;for(let v=0;v<16;++v)d[h+v]=m[v];return d}return(0,e.unsafeStringify)(m)}try{l.name=a}catch{}return l.DNS=s,l.URL=i,l}return ms}var Kc={},I8;function jV(){if(I8)return Kc;I8=1,Object.defineProperty(Kc,"__esModule",{value:!0}),Kc.default=void 0;function e(d){if(typeof d=="string"){const h=unescape(encodeURIComponent(d));d=new Uint8Array(h.length);for(let y=0;y<h.length;++y)d[y]=h.charCodeAt(y)}return t(n(s(d),d.length*8))}function t(d){const h=[],y=d.length*32,m="0123456789abcdef";for(let v=0;v<y;v+=8){const b=d[v>>5]>>>v%32&255,w=parseInt(m.charAt(b>>>4&15)+m.charAt(b&15),16);h.push(w)}return h}function r(d){return(d+64>>>9<<4)+14+1}function n(d,h){d[h>>5]|=128<<h%32,d[r(h)-1]=h;let y=1732584193,m=-271733879,v=-1732584194,b=271733878;for(let w=0;w<d.length;w+=16){const _=y,C=m,I=v,k=b;y=f(y,m,v,b,d[w],7,-680876936),b=f(b,y,m,v,d[w+1],12,-389564586),v=f(v,b,y,m,d[w+2],17,606105819),m=f(m,v,b,y,d[w+3],22,-1044525330),y=f(y,m,v,b,d[w+4],7,-176418897),b=f(b,y,m,v,d[w+5],12,1200080426),v=f(v,b,y,m,d[w+6],17,-1473231341),m=f(m,v,b,y,d[w+7],22,-45705983),y=f(y,m,v,b,d[w+8],7,1770035416),b=f(b,y,m,v,d[w+9],12,-1958414417),v=f(v,b,y,m,d[w+10],17,-42063),m=f(m,v,b,y,d[w+11],22,-1990404162),y=f(y,m,v,b,d[w+12],7,1804603682),b=f(b,y,m,v,d[w+13],12,-40341101),v=f(v,b,y,m,d[w+14],17,-1502002290),m=f(m,v,b,y,d[w+15],22,1236535329),y=c(y,m,v,b,d[w+1],5,-165796510),b=c(b,y,m,v,d[w+6],9,-1069501632),v=c(v,b,y,m,d[w+11],14,643717713),m=c(m,v,b,y,d[w],20,-373897302),y=c(y,m,v,b,d[w+5],5,-701558691),b=c(b,y,m,v,d[w+10],9,38016083),v=c(v,b,y,m,d[w+15],14,-660478335),m=c(m,v,b,y,d[w+4],20,-405537848),y=c(y,m,v,b,d[w+9],5,568446438),b=c(b,y,m,v,d[w+14],9,-1019803690),v=c(v,b,y,m,d[w+3],14,-187363961),m=c(m,v,b,y,d[w+8],20,1163531501),y=c(y,m,v,b,d[w+13],5,-1444681467),b=c(b,y,m,v,d[w+2],9,-51403784),v=c(v,b,y,m,d[w+7],14,1735328473),m=c(m,v,b,y,d[w+12],20,-1926607734),y=l(y,m,v,b,d[w+5],4,-378558),b=l(b,y,m,v,d[w+8],11,-2022574463),v=l(v,b,y,m,d[w+11],16,1839030562),m=l(m,v,b,y,d[w+14],23,-35309556),y=l(y,m,v,b,d[w+1],4,-1530992060),b=l(b,y,m,v,d[w+4],11,1272893353),v=l(v,b,y,m,d[w+7],16,-155497632),m=l(m,v,b,y,d[w+10],23,-1094730640),y=l(y,m,v,b,d[w+13],4,681279174),b=l(b,y,m,v,d[w],11,-358537222),v=l(v,b,y,m,d[w+3],16,-722521979),m=l(m,v,b,y,d[w+6],23,76029189),y=l(y,m,v,b,d[w+9],4,-640364487),b=l(b,y,m,v,d[w+12],11,-421815835),v=l(v,b,y,m,d[w+15],16,530742520),m=l(m,v,b,y,d[w+2],23,-995338651),y=u(y,m,v,b,d[w],6,-198630844),b=u(b,y,m,v,d[w+7],10,1126891415),v=u(v,b,y,m,d[w+14],15,-1416354905),m=u(m,v,b,y,d[w+5],21,-57434055),y=u(y,m,v,b,d[w+12],6,1700485571),b=u(b,y,m,v,d[w+3],10,-1894986606),v=u(v,b,y,m,d[w+10],15,-1051523),m=u(m,v,b,y,d[w+1],21,-2054922799),y=u(y,m,v,b,d[w+8],6,1873313359),b=u(b,y,m,v,d[w+15],10,-30611744),v=u(v,b,y,m,d[w+6],15,-1560198380),m=u(m,v,b,y,d[w+13],21,1309151649),y=u(y,m,v,b,d[w+4],6,-145523070),b=u(b,y,m,v,d[w+11],10,-1120210379),v=u(v,b,y,m,d[w+2],15,718787259),m=u(m,v,b,y,d[w+9],21,-343485551),y=i(y,_),m=i(m,C),v=i(v,I),b=i(b,k)}return[y,m,v,b]}function s(d){if(d.length===0)return[];const h=d.length*8,y=new Uint32Array(r(h));for(let m=0;m<h;m+=8)y[m>>5]|=(d[m/8]&255)<<m%32;return y}function i(d,h){const y=(d&65535)+(h&65535);return(d>>16)+(h>>16)+(y>>16)<<16|y&65535}function o(d,h){return d<<h|d>>>32-h}function a(d,h,y,m,v,b){return i(o(i(i(h,d),i(m,b)),v),y)}function f(d,h,y,m,v,b,w){return a(h&y|~h&m,d,h,v,b,w)}function c(d,h,y,m,v,b,w){return a(h&m|y&~m,d,h,v,b,w)}function l(d,h,y,m,v,b,w){return a(h^y^m,d,h,v,b,w)}function u(d,h,y,m,v,b,w){return a(y^(h|~m),d,h,v,b,w)}var p=e;return Kc.default=p,Kc}var k8;function $V(){if(k8)return Uc;k8=1,Object.defineProperty(Uc,"__esModule",{value:!0}),Uc.default=void 0;var e=r(IA()),t=r(jV());function r(i){return i&&i.__esModule?i:{default:i}}var s=(0,e.default)("v3",48,t.default);return Uc.default=s,Uc}var Fc={},qc={},R8;function HV(){if(R8)return qc;R8=1,Object.defineProperty(qc,"__esModule",{value:!0}),qc.default=void 0;var t={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};return qc.default=t,qc}var D8;function VV(){if(D8)return Fc;D8=1,Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.default=void 0;var e=n(HV()),t=n(TA()),r=Jf();function n(o){return o&&o.__esModule?o:{default:o}}function s(o,a,f){if(e.default.randomUUID&&!a&&!o)return e.default.randomUUID();o=o||{};const c=o.random||(o.rng||t.default)();if(c[6]=c[6]&15|64,c[8]=c[8]&63|128,a){f=f||0;for(let l=0;l<16;++l)a[f+l]=c[l];return a}return(0,r.unsafeStringify)(c)}var i=s;return Fc.default=i,Fc}var jc={},$c={},B8;function GV(){if(B8)return $c;B8=1,Object.defineProperty($c,"__esModule",{value:!0}),$c.default=void 0;function e(s,i,o,a){switch(s){case 0:return i&o^~i&a;case 1:return i^o^a;case 2:return i&o^i&a^o&a;case 3:return i^o^a}}function t(s,i){return s<<i|s>>>32-i}function r(s){const i=[1518500249,1859775393,2400959708,3395469782],o=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof s=="string"){const l=unescape(encodeURIComponent(s));s=[];for(let u=0;u<l.length;++u)s.push(l.charCodeAt(u))}else Array.isArray(s)||(s=Array.prototype.slice.call(s));s.push(128);const a=s.length/4+2,f=Math.ceil(a/16),c=new Array(f);for(let l=0;l<f;++l){const u=new Uint32Array(16);for(let p=0;p<16;++p)u[p]=s[l*64+p*4]<<24|s[l*64+p*4+1]<<16|s[l*64+p*4+2]<<8|s[l*64+p*4+3];c[l]=u}c[f-1][14]=(s.length-1)*8/Math.pow(2,32),c[f-1][14]=Math.floor(c[f-1][14]),c[f-1][15]=(s.length-1)*8&4294967295;for(let l=0;l<f;++l){const u=new Uint32Array(80);for(let v=0;v<16;++v)u[v]=c[l][v];for(let v=16;v<80;++v)u[v]=t(u[v-3]^u[v-8]^u[v-14]^u[v-16],1);let p=o[0],d=o[1],h=o[2],y=o[3],m=o[4];for(let v=0;v<80;++v){const b=Math.floor(v/20),w=t(p,5)+e(b,d,h,y)+m+i[b]+u[v]>>>0;m=y,y=h,h=t(d,30)>>>0,d=p,p=w}o[0]=o[0]+p>>>0,o[1]=o[1]+d>>>0,o[2]=o[2]+h>>>0,o[3]=o[3]+y>>>0,o[4]=o[4]+m>>>0}return[o[0]>>24&255,o[0]>>16&255,o[0]>>8&255,o[0]&255,o[1]>>24&255,o[1]>>16&255,o[1]>>8&255,o[1]&255,o[2]>>24&255,o[2]>>16&255,o[2]>>8&255,o[2]&255,o[3]>>24&255,o[3]>>16&255,o[3]>>8&255,o[3]&255,o[4]>>24&255,o[4]>>16&255,o[4]>>8&255,o[4]&255]}var n=r;return $c.default=n,$c}var O8;function zV(){if(O8)return jc;O8=1,Object.defineProperty(jc,"__esModule",{value:!0}),jc.default=void 0;var e=r(IA()),t=r(GV());function r(i){return i&&i.__esModule?i:{default:i}}var s=(0,e.default)("v5",80,t.default);return jc.default=s,jc}var Hc={},M8;function WV(){if(M8)return Hc;M8=1,Object.defineProperty(Hc,"__esModule",{value:!0}),Hc.default=void 0;var e="00000000-0000-0000-0000-000000000000";return Hc.default=e,Hc}var Vc={},N8;function YV(){if(N8)return Vc;N8=1,Object.defineProperty(Vc,"__esModule",{value:!0}),Vc.default=void 0;var e=t(Zf());function t(s){return s&&s.__esModule?s:{default:s}}function r(s){if(!(0,e.default)(s))throw TypeError("Invalid UUID");return parseInt(s.slice(14,15),16)}var n=r;return Vc.default=n,Vc}var U8;function nm(){return U8||(U8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NIL",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(e,"v1",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(e,"v3",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(e,"v4",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"v5",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(e,"validate",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return o.default}});var t=l(qV()),r=l($V()),n=l(VV()),s=l(zV()),i=l(WV()),o=l(YV()),a=l(Zf()),f=l(Jf()),c=l(CA());function l(u){return u&&u.__esModule?u:{default:u}}}(J2)),J2}var X2={},L8;function qr(){return L8||(L8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.VIDEO_NOTIFICATION_ACCESS_TYPE=e.DEFAULT_DOMAIN=e.SPACE_ROLES=e.SPACE_INVITE_ROLES=e.SPACE_DISCONNECT_TYPE=e.SPACE_ACCEPT_REQUEST_TYPE=e.SPACE_REQUEST_TYPE=e.VIDEO_CALL_TYPE=e.ADDITIONAL_META_TYPE=e.NOTIFICATION_TYPE=e.IDENTITY_TYPE=e.SUPPORTED_CHAINS=e.SOURCE_TYPES=e.CHAIN_ID_TO_SOURCE=void 0,e.CHAIN_ID_TO_SOURCE={1:"ETH_MAINNET",11155111:"ETH_TEST_SEPOLIA",137:"POLYGON_MAINNET",80002:"POLYGON_TEST_AMOY",56:"BSC_MAINNET",97:"BSC_TESTNET",10:"OPTIMISM_MAINNET",11155420:"OPTIMISM_TESTNET",2442:"POLYGON_ZK_EVM_TESTNET",1101:"POLYGON_ZK_EVM_MAINNET",421614:"ARBITRUM_TESTNET",42161:"ARBITRUMONE_MAINNET",122:"FUSE_MAINNET",123:"FUSE_TESTNET",80085:"BERACHAIN_TESTNET",59141:"LINEA_TESTNET",59144:"LINEA_MAINNET",7560:"CYBER_CONNECT_MAINNET",111557560:"CYBER_CONNECT_TESTNET",84532:"BASE_TESTNET",8453:"BASE_MAINNET"},e.SOURCE_TYPES={ETH_MAINNET:"ETH_MAINNET",ETH_TEST_SEPOLIA:"ETH_TEST_SEPOLIA",POLYGON_MAINNET:"POLYGON_MAINNET",POLYGON_TEST_AMOY:"POLYGON_TEST_AMOY",BSC_MAINNET:"BSC_MAINNET",BSC_TESTNET:"BSC_TESTNET",OPTIMISM_MAINNET:"OPTIMISM_MAINNET",OPTIMISM_TESTNET:"OPTIMISM_TESTNET",POLYGON_ZK_EVM_TESTNET:"POLYGON_ZK_EVM_TESTNET",POLYGON_ZK_EVM_MAINNET:"POLYGON_ZK_EVM_MAINNET",ARBITRUM_TESTNET:"ARBITRUM_TESTNET",ARBITRUMONE_MAINNET:"ARBITRUMONE_MAINNET",FUSE_TESTNET:"FUSE_TESTNET",FUSE_MAINNET:"FUSE_MAINNET",BERACHAIN_TESTNET:"BERACHAIN_TESTNET",LINEA_TESTNET:"LINEA_TESTNET",LINEA_MAINNET:"LINEA_MAINNET",THE_GRAPH:"THE_GRAPH",PUSH_VIDEO:"PUSH_VIDEO",SIMULATE:"SIMULATE",CYBER_CONNECT_TESTNET:"CYBER_CONNECT_TESTNET",CYBER_CONNECT_MAINNET:"CYBER_CONNECT_MAINNET",BASE_TESTNET:"BASE_TESTNET",BASE_MAINNET:"BASE_MAINNET"},e.SUPPORTED_CHAINS=[1,11155111,42,137,80002,56,97,10,11155420,2442,1101,421614,42161,122,123,80085,111557560,7560,59141,59144,84532,8453],function(t){t[t.MINIMAL=0]="MINIMAL",t[t.IPFS=1]="IPFS",t[t.DIRECT_PAYLOAD=2]="DIRECT_PAYLOAD",t[t.SUBGRAPH=3]="SUBGRAPH"}(e.IDENTITY_TYPE||(e.IDENTITY_TYPE={})),function(t){t[t.BROADCAST=1]="BROADCAST",t[t.TARGETTED=3]="TARGETTED",t[t.SUBSET=4]="SUBSET"}(e.NOTIFICATION_TYPE||(e.NOTIFICATION_TYPE={})),function(t){t[t.CUSTOM=0]="CUSTOM",t[t.PUSH_VIDEO=1]="PUSH_VIDEO",t[t.PUSH_SPACE=2]="PUSH_SPACE"}(e.ADDITIONAL_META_TYPE||(e.ADDITIONAL_META_TYPE={})),function(t){t[t.PUSH_VIDEO=1]="PUSH_VIDEO",t[t.PUSH_SPACE=2]="PUSH_SPACE"}(e.VIDEO_CALL_TYPE||(e.VIDEO_CALL_TYPE={})),function(t){t[t.JOIN_SPEAKER=0]="JOIN_SPEAKER",t[t.ESTABLISH_MESH=1]="ESTABLISH_MESH",t[t.INVITE_TO_PROMOTE=2]="INVITE_TO_PROMOTE",t[t.REQUEST_TO_PROMOTE=3]="REQUEST_TO_PROMOTE"}(e.SPACE_REQUEST_TYPE||(e.SPACE_REQUEST_TYPE={})),function(t){t[t.ACCEPT_JOIN_SPEAKER=0]="ACCEPT_JOIN_SPEAKER",t[t.ACCEPT_INVITE=1]="ACCEPT_INVITE",t[t.ACCEPT_PROMOTION=2]="ACCEPT_PROMOTION"}(e.SPACE_ACCEPT_REQUEST_TYPE||(e.SPACE_ACCEPT_REQUEST_TYPE={})),function(t){t[t.STOP=0]="STOP",t[t.LEAVE=1]="LEAVE"}(e.SPACE_DISCONNECT_TYPE||(e.SPACE_DISCONNECT_TYPE={})),function(t){t[t.CO_HOST=0]="CO_HOST",t[t.SPEAKER=1]="SPEAKER"}(e.SPACE_INVITE_ROLES||(e.SPACE_INVITE_ROLES={})),function(t){t[t.HOST=0]="HOST",t[t.CO_HOST=1]="CO_HOST",t[t.SPEAKER=2]="SPEAKER",t[t.LISTENER=3]="LISTENER"}(e.SPACE_ROLES||(e.SPACE_ROLES={})),e.DEFAULT_DOMAIN="push.org",function(t){t.PUSH_CHAT="PUSH_CHAT"}(e.VIDEO_NOTIFICATION_ACCESS_TYPE||(e.VIDEO_NOTIFICATION_ACCESS_TYPE={}))}(X2)),X2}var K8;function ZV(){if(K8)return Cr;K8=1,Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.getCAIPFormat=Cr.getSource=Cr.getPayloadIdentity=Cr.getVerificationProof=Cr.getRecipientFieldForAPIPayload=Cr.getRecipients=Cr.getPayloadForAPIInput=Cr.getUUID=void 0;const e=He,t=nm(),r=nt(),n=Yr(),s=qr(),i=Dt();function o(){return(0,t.v4)()}Cr.getUUID=o;function a(h,y){var m,v,b,w,_,C,I,k,E,S,T,P,g,A,x,D,O,B,L,M,R;return h!=null&&h.notification&&(h!=null&&h.payload)?{notification:{title:(m=h==null?void 0:h.notification)===null||m===void 0?void 0:m.title,body:(v=h==null?void 0:h.notification)===null||v===void 0?void 0:v.body},data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({acta:((b=h==null?void 0:h.payload)===null||b===void 0?void 0:b.cta)||"",aimg:((w=h==null?void 0:h.payload)===null||w===void 0?void 0:w.img)||"",amsg:((_=h==null?void 0:h.payload)===null||_===void 0?void 0:_.body)||"",asub:((C=h==null?void 0:h.payload)===null||C===void 0?void 0:C.title)||"",type:((I=h==null?void 0:h.type)===null||I===void 0?void 0:I.toString())||""},(h==null?void 0:h.expiry)&&{etime:h==null?void 0:h.expiry}),((k=h==null?void 0:h.payload)===null||k===void 0?void 0:k.etime)&&{etime:(E=h==null?void 0:h.payload)===null||E===void 0?void 0:E.etime}),(h==null?void 0:h.hidden)&&{hidden:h==null?void 0:h.hidden}),((S=h==null?void 0:h.payload)===null||S===void 0?void 0:S.hidden)&&{hidden:(T=h==null?void 0:h.payload)===null||T===void 0?void 0:T.hidden}),((P=h==null?void 0:h.payload)===null||P===void 0?void 0:P.silent)&&{silent:(g=h==null?void 0:h.payload)===null||g===void 0?void 0:g.silent}),((A=h==null?void 0:h.payload)===null||A===void 0?void 0:A.sectype)&&{sectype:(x=h==null?void 0:h.payload)===null||x===void 0?void 0:x.sectype}),((D=h==null?void 0:h.payload)===null||D===void 0?void 0:D.metadata)&&{metadata:(O=h==null?void 0:h.payload)===null||O===void 0?void 0:O.metadata}),((B=h==null?void 0:h.payload)===null||B===void 0?void 0:B.additionalMeta)&&{additionalMeta:(L=h==null?void 0:h.payload)===null||L===void 0?void 0:L.additionalMeta}),((M=h==null?void 0:h.payload)===null||M===void 0?void 0:M.index)&&{index:(R=h==null?void 0:h.payload)===null||R===void 0?void 0:R.index}),recipients:y}:null}Cr.getPayloadForAPIInput=a;function f({env:h,notificationType:y,channel:m,recipients:v,secretType:b}){return e.__awaiter(this,void 0,void 0,function*(){let w="";if(b){let _="";if(y===s.NOTIFICATION_TYPE.TARGETTED){if(typeof v=="string")return w=yield(0,r.getCAIPAddress)(h,v,"Recipient"),_="",{[w]:_}}else if(y===s.NOTIFICATION_TYPE.SUBSET&&Array.isArray(v))return v.reduce((I,k)=>e.__awaiter(this,void 0,void 0,function*(){return w=yield(0,r.getCAIPAddress)(h,k,"Recipient"),_="",Object.assign(Object.assign({},I),{[w]:_})}),{})}else{if(y===s.NOTIFICATION_TYPE.BROADCAST)return yield(0,r.getCAIPAddress)(h,m,"Recipient");if(y===s.NOTIFICATION_TYPE.TARGETTED){if(typeof v=="string")return yield(0,r.getCAIPAddress)(h,v,"Recipient")}else if(y===s.NOTIFICATION_TYPE.SUBSET&&Array.isArray(v)&&Array.isArray(v)){const _={};return v.map(C=>e.__awaiter(this,void 0,void 0,function*(){w=yield(0,r.getCAIPAddress)(h,C,"Recipient"),_[w]=null})),_}}return v})}Cr.getRecipients=f;function c({env:h,notificationType:y,recipients:m,channel:v}){return e.__awaiter(this,void 0,void 0,function*(){return y===s.NOTIFICATION_TYPE.TARGETTED&&typeof m=="string"?yield(0,r.getCAIPAddress)(h,m,"Recipient"):yield(0,r.getCAIPAddress)(h,v,"Recipient")})}Cr.getRecipientFieldForAPIPayload=c;function l({senderType:h,signer:y,chainId:m,notificationType:v,identityType:b,verifyingContract:w,payload:_,ipfsHash:C,graph:I={},uuid:k,chatId:E,wallet:S,pgpPrivateKey:T,env:P,rules:g}){return e.__awaiter(this,void 0,void 0,function*(){let A=null,x=null;switch(b){case s.IDENTITY_TYPE.MINIMAL:{A={data:`${b}+${v}+${_.notification.title}+${_.notification.body}`};break}case s.IDENTITY_TYPE.IPFS:{A={data:`1+${C}`};break}case s.IDENTITY_TYPE.DIRECT_PAYLOAD:{A={data:`2+${JSON.stringify(_)}`};break}case s.IDENTITY_TYPE.SUBGRAPH:{A={data:`3+graph:${I==null?void 0:I.id}+${I==null?void 0:I.counter}`};break}default:throw new Error("Invalid IdentityType")}switch(h){case 0:{if(T){const D=n.SHA256(JSON.stringify(A)).toString();x=`pgpv4:${yield(0,i.sign)({message:D,signingKey:T})}`}else{const D={Data:[{name:"data",type:"string"}]},O={name:"EPNS COMM V1",chainId:m,verifyingContract:w};x=`eip712v2:${yield new r.Signer(y).signTypedData(O,D,A,"Data")}::uid::${k}`}break}case 1:{const D=n.SHA256(JSON.stringify(A)).toString();x=`pgpv2:${yield(0,i.sign)({message:D,signingKey:T})}:meta:${E}::uid::${k}`;break}default:throw new Error("Invalid SenderType")}return x})}Cr.getVerificationProof=l;function u({identityType:h,payload:y,notificationType:m,ipfsHash:v,graph:b={}}){return h===s.IDENTITY_TYPE.MINIMAL?`0+${m}+${y.notification.title}+${y.notification.body}`:h===s.IDENTITY_TYPE.IPFS?`1+${v}`:h===s.IDENTITY_TYPE.DIRECT_PAYLOAD?`2+${JSON.stringify(y)}`:h===s.IDENTITY_TYPE.SUBGRAPH?`3+graph:${b==null?void 0:b.id}+${b==null?void 0:b.counter}`:null}Cr.getPayloadIdentity=u;function p(h,y,m){return m===1?s.SOURCE_TYPES.PUSH_VIDEO:y===s.IDENTITY_TYPE.SUBGRAPH?s.SOURCE_TYPES.THE_GRAPH:s.CHAIN_ID_TO_SOURCE[h]}Cr.getSource=p;function d(h,y){return s.SUPPORTED_CHAINS.includes(h)?`eip155:${h}:${y}`:y}return Cr.getCAIPFormat=d,Cr}var F8;function JV(){if(F8)return Bc;F8=1,Object.defineProperty(Bc,"__esModule",{value:!0}),Bc.sendNotification=void 0;const e=He,t=ZV(),r=nt(),n=qr(),s=Ze(),i=Tt();function o(c){var l,u;if(!(c!=null&&c.channel))throw'[Push SDK] - Error - sendNotification() - "channel" is mandatory!';if(!(0,r.isValidPushCAIP)(c.channel))throw'[Push SDK] - Error - sendNotification() - "channel" is invalid!';if(c.senderType===0&&c.signer===void 0)throw'[Push SDK] - Error - sendNotification() - "signer" is mandatory!';if(c.senderType===1&&c.pgpPrivateKey===void 0)throw'[Push SDK] - Error - sendNotification() - "pgpPrivateKey" is mandatory!';if((c==null?void 0:c.identityType)===n.IDENTITY_TYPE.DIRECT_PAYLOAD||(c==null?void 0:c.identityType)===n.IDENTITY_TYPE.MINIMAL){if(!c.notification)throw'[Push SDK] - Error - sendNotification() - "notification" mandatory for Identity Type: Direct Payload, Minimal!';if(!c.payload)throw'[Push SDK] - Error - sendNotification() - "payload" mandatory for Identity Type: Direct Payload, Minimal!'}const p=(l=c.payload)===null||l===void 0?void 0:l.additionalMeta,d=typeof((u=c.payload)===null||u===void 0?void 0:u.additionalMeta)=="object"&&(c.payload.additionalMeta.type===`${n.VIDEO_CALL_TYPE.PUSH_VIDEO}+1`||c.payload.additionalMeta.type===`${n.VIDEO_CALL_TYPE.PUSH_SPACE}+1`);if(p&&d&&!c.chatId&&!c.rules)throw new Error("[Push SDK] - Error - sendNotification() - Either chatId or rules object is required to send a additional meta notification for video or spaces")}function a(c){return e.__awaiter(this,void 0,void 0,function*(){try{const{channelFound:l,channelorAlias:u,recipient:p,type:d,env:h,senderType:y}=c||{};if(y===1||l)return!1;const m=typeof p=="string"&&(p==null?void 0:p.split(":").length)==3?p.split(":")[2]:p;return u==m&&d==n.NOTIFICATION_TYPE.TARGETTED}catch{return!0}})}function f(c){var l;return e.__awaiter(this,void 0,void 0,function*(){try{const{senderType:u=0,signer:p,type:d,identityType:h,payload:y,recipients:m,channel:v,graph:b,ipfsHash:w,env:_=s.ENV.PROD,chatId:C,rules:I,pgpPrivateKey:k,channelFound:E=!0}=c||{};o(c),y&&y.additionalMeta&&typeof y.additionalMeta=="object"&&!y.additionalMeta.domain&&(y.additionalMeta.domain=n.DEFAULT_DOMAIN);const S=yield(0,r.getCAIPAddress)(_,v,"Channel"),T=(0,r.getCAIPDetails)(S);if(!T)throw Error("Invalid Channel CAIP!");const P=(0,t.getUUID)(),g=parseInt(T.networkId,10),A=(0,r.getAPIBaseUrls)(_);let x="";if(u===0){const{EPNS_COMMUNICATOR_CONTRACT:F}=(0,r.getConfig)(_,T);x=F}const D=yield(0,t.getRecipients)({env:_,notificationType:d,channel:S,recipients:m,secretType:y==null?void 0:y.sectype}),O=(0,t.getPayloadForAPIInput)(c,D),B=yield(0,t.getVerificationProof)({senderType:u,signer:p,chainId:g,identityType:h,notificationType:d,verifyingContract:x,payload:O,graph:b,ipfsHash:w,uuid:P,chatId:(l=I==null?void 0:I.access.data.chatId)!==null&&l!==void 0?l:C,pgpPrivateKey:k}),L=(0,t.getPayloadIdentity)({identityType:h,payload:O,notificationType:d,graph:b,ipfsHash:w}),M=(yield a({channelFound:E,channelorAlias:c.channel,recipient:c.recipients,type:c.type,env:c.env,senderType:c.senderType}))?n.SOURCE_TYPES.SIMULATE:(0,t.getSource)(g,h,u),R=Object.assign({verificationProof:B,identity:L,sender:u===1&&!(0,r.isValidNFTCAIP)(S)?`${T==null?void 0:T.blockchain}:${T==null?void 0:T.address}`:S,source:M,recipient:yield(0,t.getRecipientFieldForAPIPayload)({env:_,notificationType:d,recipients:m||"",channel:S})},I||C?{rules:I??{access:{data:{chatId:C},type:n.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT}}}:{}),N=`${A}/v1/payloads/`;return yield(0,i.axiosPost)(N,R,{headers:{"Content-Type":"application/json"}})}catch(u){throw console.error("[Push SDK] - Error - sendNotification() - ",JSON.stringify(u)),u}})}return Bc.sendNotification=f,Bc}var q8;function Xf(){return q8||(q8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SPACE_DISCONNECT_TYPE=e.SPACE_ACCEPT_REQUEST_TYPE=e.SPACE_REQUEST_TYPE=e.ADDITIONAL_META_TYPE=e.IDENTITY_TYPE=e.NOTIFICATION_TYPE=void 0,He.__exportStar(JV(),e);var r=qr();Object.defineProperty(e,"NOTIFICATION_TYPE",{enumerable:!0,get:function(){return r.NOTIFICATION_TYPE}}),Object.defineProperty(e,"IDENTITY_TYPE",{enumerable:!0,get:function(){return r.IDENTITY_TYPE}}),Object.defineProperty(e,"ADDITIONAL_META_TYPE",{enumerable:!0,get:function(){return r.ADDITIONAL_META_TYPE}}),Object.defineProperty(e,"SPACE_REQUEST_TYPE",{enumerable:!0,get:function(){return r.SPACE_REQUEST_TYPE}}),Object.defineProperty(e,"SPACE_ACCEPT_REQUEST_TYPE",{enumerable:!0,get:function(){return r.SPACE_ACCEPT_REQUEST_TYPE}}),Object.defineProperty(e,"SPACE_DISCONNECT_TYPE",{enumerable:!0,get:function(){return r.SPACE_DISCONNECT_TYPE}})}(Z2)),Z2}var j8;function XV(){if(j8)return Wl;j8=1,Object.defineProperty(Wl,"__esModule",{value:!0});const e=He,t=nt(),r=Xf(),n=Ze(),s=qr(),i=({signer:o,chainId:a,pgpPrivateKey:f},{recipientAddress:c,senderAddress:l,chatId:u,rules:p,status:d,signalData:h=null,env:y=n.default.ENV.PROD,callType:m=s.VIDEO_CALL_TYPE.PUSH_VIDEO,callDetails:v})=>e.__awaiter(void 0,void 0,void 0,function*(){var b;try{const w={recipientAddress:c,senderAddress:l,chatId:(b=p==null?void 0:p.access.data.chatId)!==null&&b!==void 0?b:u,signalData:h,status:d,callDetails:v},_=(0,t.getCAIPWithChainId)(l,a),C=(0,t.getCAIPWithChainId)(c,a),I=`Video Call from ${l}`,k=s.NOTIFICATION_TYPE.TARGETTED;yield(0,r.sendNotification)({senderType:1,signer:o,pgpPrivateKey:f,chatId:u,rules:p,type:k,identityType:2,notification:{title:I,body:I},payload:{title:"VideoCall",body:"VideoCall",cta:"",img:"",additionalMeta:{type:`${m}+1`,data:JSON.stringify(w)}},recipients:C,channel:_,env:y})}catch(w){console.error("Error occured while sending notification for video call",w)}});return Wl.default=i,Wl}var Cn={},$8;function kA(){if($8)return Cn;$8=1,Object.defineProperty(Cn,"__esModule",{value:!0}),Cn.endStream=Cn.stopAudioStream=Cn.restartAudioStream=Cn.stopVideoStream=Cn.restartVideoStream=void 0;const e=i=>{i.getVideoTracks().forEach(a=>a.enabled=!0)};Cn.restartVideoStream=e;const t=i=>{i.getVideoTracks().forEach(a=>a.enabled=!1)};Cn.stopVideoStream=t;const r=i=>{i.getAudioTracks().forEach(a=>a.enabled=!0)};Cn.restartAudioStream=r;const n=i=>{i.getAudioTracks().forEach(a=>a.enabled=!1)};Cn.stopAudioStream=n;const s=i=>{i.getTracks().forEach(o=>o.stop())};return Cn.endStream=s,Cn}var Zl={},H8;function QV(){if(H8)return Zl;H8=1,Object.defineProperty(Zl,"__esModule",{value:!0});const e=t=>{try{return JSON.parse(t)&&!!t}catch{return!1}};return Zl.default=e,Zl}var Gc={},V8;function eG(){if(V8)return Gc;V8=1,Object.defineProperty(Gc,"__esModule",{value:!0}),Gc.getIceServerConfig=void 0;const e=He,t=nt(),r=Ze(),n=Yr(),s=Tt(),i="turnserversecret",o=(a=r.default.ENV.PROD)=>e.__awaiter(void 0,void 0,void 0,function*(){const c=`${(0,t.getAPIBaseUrls)(a)}/v1/turnserver/iceconfig`,{data:l}=yield(0,s.axiosGet)(c),{config:u}=JSON.parse(n.AES.decrypt(l,i).toString(n.enc.Utf8));return u});return Gc.getIceServerConfig=o,Gc}var Jl={},G8;function RA(){if(G8)return Jl;G8=1,Object.defineProperty(Jl,"__esModule",{value:!0});const e=(t,r)=>t.findIndex(n=>n.address===r);return Jl.default=e,Jl}var Xl={},z8;function tG(){if(z8)return Xl;z8=1,Object.defineProperty(Xl,"__esModule",{value:!0});const e=em(),t=bn(),r=({incomingPeers:n})=>{const s=[];return n.forEach(i=>{i.status===t.VideoCallStatus.CONNECTED&&s.push((0,e.default)(i.address))}),s};return Xl.default=r,Xl}var Ql={},W8;function rG(){if(W8)return Ql;W8=1,Object.defineProperty(Ql,"__esModule",{value:!0});const e=({localAddress:t,localConnectedAddresses:r,receivedConnectedAddresses:n})=>n.filter(s=>!r.includes(s)&&s!==t);return Ql.default=e,Ql}var zc={},Y8;function nG(){if(Y8)return zc;Y8=1,Object.defineProperty(zc,"__esModule",{value:!0}),zc.validateVideoRules=void 0;const e=qr(),t=r=>{if(r.access.type===e.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT&&(!r.access.data.chatId||r.access.data.chatId===""))throw new Error("Invalid rules object recieved. For access as Push Chat, chatId is required!")};return zc.validateVideoRules=t,zc}var Z8;function DA(){return Z8||(Z8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Video=e.initVideoCallData=void 0;const t=He,r=KV(),n=ui(),s=Ze(),i=XV(),o=kA(),a=QV(),f=eG(),c=bn(),l=RA(),u=tG(),p=rG(),d=qr(),h=nG();e.initVideoCallData={meta:{chatId:"",initiator:{address:"",signal:null},broadcast:{livepeerInfo:null,hostAddress:"",coHostAddress:""}},local:{stream:null,audio:null,video:null,address:""},incoming:[{stream:null,audio:null,video:null,address:"",status:c.VideoCallStatus.UNINITIALIZED,retryCount:0}]};class y{constructor({signer:v,chainId:b,pgpPrivateKey:w,env:_=s.default.ENV.PROD,setData:C,callType:I=d.VIDEO_CALL_TYPE.PUSH_VIDEO,onReceiveStream:k=()=>t.__awaiter(this,void 0,void 0,function*(){return Promise.resolve()})}){this.peerInstances={},this.signer=v,this.chainId=b,this.pgpPrivateKey=w,this.env=_,this.callType=I,this.onReceiveStream=k,C(()=>e.initVideoCallData),this.data=e.initVideoCallData,this.setData=function(E){C(E),this.data=E(this.data)}}create(v){return t.__awaiter(this,void 0,void 0,function*(){const{audio:b=!0,video:w=!0,stream:_=null}=v||{};try{const C=_!==null?_:yield navigator.mediaDevices.getUserMedia({video:w,audio:b});this.setData(I=>(0,n.produce)(I,k=>{k.local.stream=C,k.local.video=w,k.local.audio=b}))}catch(C){console.error("error in create",C)}})}request(v){return t.__awaiter(this,void 0,void 0,function*(){const{senderAddress:b,recipientAddress:w,chatId:_,rules:C,onReceiveMessage:I,retry:k=!1,details:E}=v||{};C&&(0,h.validateVideoRules)(C);const S=Array.isArray(w)?w:[w];for(const T of S)try{this.setData(g=>(0,n.produce)(g,A=>{A.local.address=b,A.meta.chatId=_??C.access.data.chatId,A.meta.initiator.address=b;const x=(0,l.default)(g.incoming,T);x===-1?A.incoming.push({stream:null,audio:null,video:null,address:T,status:k?c.VideoCallStatus.RETRY_INITIALIZED:c.VideoCallStatus.INITIALIZED,retryCount:k?1:0}):(A.incoming[x].address=T,A.incoming[x].status=k?c.VideoCallStatus.RETRY_INITIALIZED:c.VideoCallStatus.INITIALIZED,A.incoming[x].retryCount+=k?1:0)}));const P=yield(0,f.getIceServerConfig)(this.env);this.peerInstances[T]=new r({initiator:!0,trickle:!1,stream:this.data.local.stream,config:{iceServers:P}}),this.peerInstances[T].on("signal",g=>{this.setData(A=>(0,n.produce)(A,x=>{x.meta.initiator.signal=g})),(0,i.default)({signer:this.signer,chainId:this.chainId,pgpPrivateKey:this.pgpPrivateKey},{senderAddress:b,recipientAddress:T,status:k?c.VideoCallStatus.RETRY_INITIALIZED:c.VideoCallStatus.INITIALIZED,chatId:_,rules:C,signalData:g,env:this.env,callType:this.callType,callDetails:E})}),this.peerInstances[T].on("connect",()=>{this.peerInstances[T].send(`initial message from ${b}`),this.peerInstances[T].send(JSON.stringify({type:"isVideoOn",value:this.data.local.video})),this.peerInstances[T].send(JSON.stringify({type:"isAudioOn",value:this.data.local.audio}));const g=(0,u.default)({incomingPeers:this.data.incoming});this.peerInstances[T].send(JSON.stringify({type:"connectedAddresses",value:g}))}),this.peerInstances[T].on("data",g=>{var A,x,D,O,B;if((0,a.default)(g)){const L=JSON.parse(g);if(L.type==="connectedAddresses"){const M=L.value,R=(0,u.default)({incomingPeers:this.data.incoming}),N=(0,p.default)({localAddress:b,localConnectedAddresses:R,receivedConnectedAddresses:M});this.request({senderAddress:b,recipientAddress:N,chatId:_,rules:C,details:{type:d.SPACE_REQUEST_TYPE.ESTABLISH_MESH,data:{}}})}if(L.type==="isVideoOn"&&this.setData(M=>(0,n.produce)(M,R=>{const N=(0,l.default)(M.incoming,T);R.incoming[N].video=L.value})),L.type==="isAudioOn"&&this.setData(M=>(0,n.produce)(M,R=>{const N=(0,l.default)(M.incoming,T);R.incoming[N].audio=L.value})),L.type==="endCall"){if(this.callType===d.VIDEO_CALL_TYPE.PUSH_SPACE&&((A=L==null?void 0:L.details)===null||A===void 0?void 0:A.type)===d.SPACE_DISCONNECT_TYPE.LEAVE&&((x=this.peerInstances[T])===null||x===void 0||x.destroy(),this.peerInstances[T]=null,this.setData(M=>(0,n.produce)(M,R=>{const N=(0,l.default)(M.incoming,T);R.incoming.splice(N,1)}))),this.callType===d.VIDEO_CALL_TYPE.PUSH_SPACE&&((D=L==null?void 0:L.details)===null||D===void 0?void 0:D.type)===d.SPACE_DISCONNECT_TYPE.STOP){for(const M in this.peerInstances)(O=this.peerInstances[M])===null||O===void 0||O.destroy(),this.peerInstances[M]=null;this.data.local.stream&&(0,o.endStream)(this.data.local.stream),this.setData(()=>e.initVideoCallData)}this.callType===d.VIDEO_CALL_TYPE.PUSH_VIDEO&&((B=this.peerInstances[T])===null||B===void 0||B.destroy(),this.peerInstances[T]=null,this.data.local.stream&&(0,o.endStream)(this.data.local.stream),this.setData(()=>e.initVideoCallData))}}else I&&I(g)}),this.peerInstances[T].on("stream",g=>{const A=(0,l.default)(this.data.incoming,T);this.onReceiveStream(g,T,this.data.incoming[A].audio),this.setData(x=>(0,n.produce)(x,D=>{D.incoming[A].stream=g}))})}catch(P){console.error("error in request",P)}})}acceptRequest(v){return t.__awaiter(this,void 0,void 0,function*(){const{signalData:b,senderAddress:w,recipientAddress:_,chatId:C,rules:I,onReceiveMessage:k,retry:E=!1,details:S}=v||{};I&&(0,h.validateVideoRules)(I);try{if(this.peerInstances[_])return Promise.resolve();const T=yield(0,f.getIceServerConfig)(this.env);this.peerInstances[_]=new r({initiator:!1,trickle:!1,stream:this.data.local.stream,config:{iceServers:T}}),this.setData(P=>(0,n.produce)(P,g=>{g.local.address=w,g.meta.chatId=C??I.access.data.chatId,g.meta.initiator.address=w;const A=(0,l.default)(P.incoming,_);A===-1?g.incoming.push({stream:null,audio:null,video:null,address:_,status:E?c.VideoCallStatus.RETRY_INITIALIZED:c.VideoCallStatus.INITIALIZED,retryCount:E?1:0}):(g.incoming[A].address=_,g.incoming[A].status=E?c.VideoCallStatus.RETRY_RECEIVED:c.VideoCallStatus.RECEIVED,g.incoming[A].retryCount+=E?1:0)})),this.peerInstances[_].on("error",P=>{this.data.incoming[0].retryCount>=5&&this.disconnect({peerAddress:_}),(0,i.default)({signer:this.signer,chainId:this.chainId,pgpPrivateKey:this.pgpPrivateKey},{senderAddress:w,recipientAddress:_,status:c.VideoCallStatus.RETRY_INITIALIZED,chatId:C,rules:I,signalData:null,callType:this.callType,env:this.env})}),this.peerInstances[_].signal(b),this.peerInstances[_].on("signal",P=>{this.setData(g=>(0,n.produce)(g,A=>{A.meta.initiator.signal=P})),(0,i.default)({signer:this.signer,chainId:this.chainId,pgpPrivateKey:this.pgpPrivateKey},{senderAddress:w,recipientAddress:_,status:E?c.VideoCallStatus.RETRY_RECEIVED:c.VideoCallStatus.RECEIVED,chatId:C,rules:I,signalData:P,env:this.env,callType:this.callType,callDetails:S})}),this.peerInstances[_].on("connect",()=>{this.peerInstances[_].send(JSON.stringify({type:"isVideoOn",value:this.data.local.video})),this.peerInstances[_].send(JSON.stringify({type:"isAudioOn",value:this.data.local.audio}));const P=(0,u.default)({incomingPeers:this.data.incoming});this.peerInstances[_].send(JSON.stringify({type:"connectedAddresses",value:P})),this.setData(g=>(0,n.produce)(g,A=>{const x=(0,l.default)(g.incoming,_);A.incoming[x].status=c.VideoCallStatus.CONNECTED}))}),this.peerInstances[_].on("data",P=>{var g,A,x,D,O;if((0,a.default)(P)){const B=JSON.parse(P);if(B.type==="connectedAddresses"){const L=B.value,M=(0,u.default)({incomingPeers:this.data.incoming}),R=(0,p.default)({localAddress:w,localConnectedAddresses:M,receivedConnectedAddresses:L});this.request({senderAddress:w,recipientAddress:R,chatId:C,rules:I,details:{type:d.SPACE_REQUEST_TYPE.ESTABLISH_MESH,data:{}}})}if(B.type==="isVideoOn"&&this.setData(L=>(0,n.produce)(L,M=>{const R=(0,l.default)(L.incoming,_);M.incoming[R].video=B.value})),B.type==="isAudioOn"&&this.setData(L=>(0,n.produce)(L,M=>{const R=(0,l.default)(L.incoming,_);M.incoming[R].audio=B.value})),B.type==="endCall"){if(this.callType===d.VIDEO_CALL_TYPE.PUSH_SPACE&&((g=B==null?void 0:B.details)===null||g===void 0?void 0:g.type)===d.SPACE_DISCONNECT_TYPE.LEAVE&&((A=this.peerInstances[_])===null||A===void 0||A.destroy(),this.peerInstances[_]=null,this.setData(L=>(0,n.produce)(L,M=>{const R=(0,l.default)(L.incoming,_);M.incoming.splice(R,1)}))),this.callType===d.VIDEO_CALL_TYPE.PUSH_SPACE&&((x=B==null?void 0:B.details)===null||x===void 0?void 0:x.type)===d.SPACE_DISCONNECT_TYPE.STOP){for(const L in this.peerInstances)(D=this.peerInstances[L])===null||D===void 0||D.destroy(),this.peerInstances[L]=null;this.data.local.stream&&(0,o.endStream)(this.data.local.stream),this.setData(()=>e.initVideoCallData)}this.callType===d.VIDEO_CALL_TYPE.PUSH_VIDEO&&((O=this.peerInstances[_])===null||O===void 0||O.destroy(),this.peerInstances[_]=null,this.data.local.stream&&(0,o.endStream)(this.data.local.stream),this.setData(()=>e.initVideoCallData))}}else k&&k(P)}),this.peerInstances[_].on("stream",P=>{const g=(0,l.default)(this.data.incoming,_);this.onReceiveStream(P,_,this.data.incoming[g].audio),this.setData(A=>(0,n.produce)(A,x=>{x.incoming[g].stream=P}))})}catch(T){console.error("error in accept request",T)}})}connect(v){var b;const{peerAddress:w,signalData:_}=v||{};try{w||console.warn("disconnect requires a peer address"),this.peerInstances[w||this.data.incoming[0].address].on("error",C=>{const I=w?(0,l.default)(this.data.incoming,w):0;this.data.incoming[I].retryCount>=5&&this.disconnect({peerAddress:w||this.data.incoming[0].address}),this.request({senderAddress:this.data.local.address,recipientAddress:this.data.incoming[I].address,chatId:this.data.meta.chatId,retry:!0})}),(b=this.peerInstances[w||this.data.incoming[0].address])===null||b===void 0||b.signal(_),this.setData(C=>(0,n.produce)(C,I=>{const k=w?(0,l.default)(C.incoming,w):0;I.incoming[k].status=c.VideoCallStatus.CONNECTED})),(0,i.default)({signer:this.signer,chainId:this.chainId,pgpPrivateKey:this.pgpPrivateKey},{senderAddress:this.data.local.address,recipientAddress:w||this.data.incoming[0].address,status:c.VideoCallStatus.CONNECTED,rules:{access:{type:d.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT,data:{chatId:this.data.meta.chatId}}},signalData:_,env:this.env})}catch(C){console.error("error in connect",C)}}disconnect(v){var b,w,_;const{peerAddress:C,details:I}=v||{};try{v!=null&&v.peerAddress||console.warn("disconnect requires a peer address");const k=C?(0,l.default)(this.data.incoming,C):0,E=this.data.incoming[k].status===c.VideoCallStatus.CONNECTED;E&&((b=this.peerInstances[C||this.data.incoming[0].address])===null||b===void 0||b.send(JSON.stringify({type:"endCall",value:!0,details:I})),(w=this.peerInstances[C||this.data.incoming[0].address])===null||w===void 0||w.destroy()),(0,i.default)({signer:this.signer,chainId:this.chainId,pgpPrivateKey:this.pgpPrivateKey},{senderAddress:this.data.local.address,recipientAddress:this.data.incoming[k].address,status:E?c.VideoCallStatus.ENDED:c.VideoCallStatus.DISCONNECTED,chatId:this.data.meta.chatId,signalData:null,env:this.env,callType:this.callType,callDetails:I}),(_=this.peerInstances[C||this.data.incoming[0].address])===null||_===void 0||_.destroy(),this.peerInstances[C||this.data.incoming[0].address]=null,this.data.local.stream&&(0,o.endStream)(this.data.local.stream),this.setData(()=>e.initVideoCallData)}catch(k){console.error("error in disconnect",k)}}enableVideo(v){var b;const{state:w}=v||{};if(this.data.local.video!==w){for(const _ of this.data.incoming)_.status===c.VideoCallStatus.CONNECTED&&((b=this.peerInstances[_.address])===null||b===void 0||b.send(JSON.stringify({type:"isVideoOn",value:w})));this.data.local.stream&&(w?(0,o.restartVideoStream)(this.data.local.stream):(0,o.stopVideoStream)(this.data.local.stream),this.setData(_=>(0,n.produce)(_,C=>{C.local.video=w})))}}enableAudio(v){const{state:b}=v||{};if(this.data.local.audio!==b){for(const w of this.data.incoming)if(w.status===c.VideoCallStatus.CONNECTED&&this.peerInstances[w.address])try{this.peerInstances[w.address].send(JSON.stringify({type:"isAudioOn",value:b}))}catch(_){console.error("Error sending data:",_)}this.data.local.stream&&(b?(0,o.restartAudioStream)(this.data.local.stream):(0,o.stopAudioStream)(this.data.local.stream),this.setData(w=>(0,n.produce)(w,_=>{_.local.audio=b})))}}isInitiator(){return this.data.meta.initiator.address===""||this.data.local.address===""?!1:this.data.meta.initiator.address===this.data.local.address}}e.Video=y}(V2)),V2}var J8;function im(){return J8||(J8=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),He.__exportStar(DA(),e)}(H2)),H2}var Wc={},X8;function iG(){if(X8)return Wc;X8=1,Object.defineProperty(Wc,"__esModule",{value:!0}),Wc.update=void 0;const e=He,t=bn(),r=Dt(),n=cl(),s=Zs();function i(o){return e.__awaiter(this,void 0,void 0,function*(){const{spaceName:a,spaceImage:f,spaceDescription:c,scheduleAt:l,scheduleEnd:u,meta:p}=o||{};try{const d=yield(0,s.get)({spaceId:this.spaceSpecificData.spaceId,env:this.env}),h=(0,r.getSpacesMembersList)(d.members,d.pendingMembers),y=(0,r.getSpaceAdminsList)(d.members,d.pendingMembers);if(d.status===t.ChatStatus.ACTIVE&&l)throw new Error("Unable change the start date/time of an active space");if(d.status===t.ChatStatus.ENDED&&u)throw new Error("Unable change the end date/time of an ended space");const m=yield(0,n.updateGroup)({chatId:this.spaceSpecificData.spaceId,groupName:a||d.spaceName,groupImage:f||d.spaceImage,groupDescription:c||d.spaceDescription,members:h,admins:y,signer:this.signer,env:this.env,pgpPrivateKey:this.pgpPrivateKey,scheduleAt:l||d.scheduleAt,scheduleEnd:u||d.scheduleEnd,meta:p||d.meta});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},(0,r.groupDtoToSpaceDto)(m)),{liveSpaceData:this.spaceSpecificData.liveSpaceData}))}catch(d){throw console.error(`[Push SDK] - API - Error - API ${i.name} -: `,d),Error(`[Push SDK] - API - Error - API ${i.name} -: ${d}`)}})}return Wc.update=i,Wc}var Yc={},ed={},Q8;function Bo(){if(Q8)return ed;Q8=1,Object.defineProperty(ed,"__esModule",{value:!0});const e=He,t=oi(),r=Ze(),n=({liveSpaceData:s,action:i,spaceId:o,pgpPrivateKey:a,signer:f,env:c})=>e.__awaiter(void 0,void 0,void 0,function*(){yield(0,t.send)({receiverAddress:o,pgpPrivateKey:a,env:c,signer:f,messageType:r.MessageType.META,messageObj:{content:i,info:{affected:[],arbitrary:s}}})});return ed.default=n,ed}var e_;function sG(){if(e_)return Yc;e_=1,Object.defineProperty(Yc,"__esModule",{value:!0}),Yc.start=void 0;const e=He,t=bn(),r=Dt(),n=Zs(),s=cl(),i=ui(),o=nt(),a=Va(),f=Bo();function c(){return e.__awaiter(this,void 0,void 0,function*(){try{!this.data.local.stream&&(yield this.create({audio:!0,video:!1}));const l=yield(0,n.get)({spaceId:this.spaceSpecificData.spaceId,env:this.env});if(l.status!==t.ChatStatus.PENDING)throw new Error("Unable to start the space as it is not in the pending state");if(this.data.local.address!==(0,o.pCAIP10ToWallet)(l.spaceCreator))throw new Error("Only host is allowed to start a space");const u=(0,r.getSpacesMembersList)(l.members,l.pendingMembers),p=(0,r.getSpaceAdminsList)(l.members,l.pendingMembers),d=yield(0,s.updateGroup)({chatId:this.spaceSpecificData.spaceId,groupName:l.spaceName,groupImage:l.spaceImage,groupDescription:l.spaceDescription,members:u,admins:p,signer:this.signer,env:this.env,pgpPrivateKey:this.pgpPrivateKey,scheduleAt:l.scheduleAt,scheduleEnd:l.scheduleEnd,status:t.ChatStatus.ACTIVE}),h={host:{address:this.data.local.address,audio:this.data.local.audio,emojiReactions:null},coHosts:[],speakers:[],listeners:[]};yield(0,f.default)({liveSpaceData:h,action:a.CHAT.META.SPACE.CREATE,spaceId:this.spaceSpecificData.spaceId,signer:this.signer,pgpPrivateKey:this.pgpPrivateKey,env:this.env}),this.setSpaceData(y=>(0,i.produce)(y,m=>{m=Object.assign(Object.assign({},(0,r.groupDtoToSpaceDto)(d)),{liveSpaceData:h,connectionData:m.connectionData}),m.connectionData.meta.broadcast={livepeerInfo:null,hostAddress:this.data.local.address}}))}catch(l){throw console.error(`[Push SDK] - API - Error - API ${c.name} -: `,l),Error(`[Push SDK] - API - Error - API ${c.name} -: ${l}`)}})}return Yc.start=c,Yc}var Zc={},t_;function aG(){if(t_)return Zc;t_=1,Object.defineProperty(Zc,"__esModule",{value:!0}),Zc.inviteToPromote=void 0;const e=He,t=ui(),r=qr();function n(s){return e.__awaiter(this,void 0,void 0,function*(){const{inviteeAddress:i,role:o}=s||{};this.setSpaceSpecificData(a=>(0,t.produce)(a,f=>{f.inviteeDetails&&(f.inviteeDetails[i]=o)})),this.request({senderAddress:this.data.local.address,recipientAddress:i,chatId:this.spaceSpecificData.spaceId,details:{type:r.SPACE_REQUEST_TYPE.INVITE_TO_PROMOTE,data:{role:o}}})})}return Zc.inviteToPromote=n,Zc}var Jc={},r_;function oG(){if(r_)return Jc;r_=1,Object.defineProperty(Jc,"__esModule",{value:!0}),Jc.acceptPromotionInvite=void 0;const e=He,t=qr();function r(n){return e.__awaiter(this,void 0,void 0,function*(){const{signalData:s,invitorAddress:i,spaceId:o}=n||{};this.acceptRequest({signalData:s,senderAddress:this.data.local.address,recipientAddress:i,chatId:o,details:{type:t.SPACE_ACCEPT_REQUEST_TYPE.ACCEPT_INVITE,data:{}}})})}return Jc.acceptPromotionInvite=r,Jc}var Xc={},n_;function cG(){if(n_)return Xc;n_=1,Object.defineProperty(Xc,"__esModule",{value:!0}),Xc.connectInvitee=void 0;const e=He,t=ui(),r=rm();function n(s){var i;return e.__awaiter(this,void 0,void 0,function*(){const{signalData:o,inviteeAddress:a}=s||{};if(!(!((i=this.spaceSpecificData)===null||i===void 0)&&i.inviteeDetails)||!Object.keys(this.spaceSpecificData.inviteeDetails).includes(a))return Promise.resolve();this.spaceSpecificData.inviteeDetails[a],this.setSpaceSpecificData(f=>(0,t.produce)(f,c=>{c.inviteeDetails&&delete c.inviteeDetails[a]})),yield(0,r.addSpeakers)({spaceId:this.spaceSpecificData.spaceId,signer:this.signer,pgpPrivateKey:this.pgpPrivateKey,speakers:[a]}),this.connect({signalData:o,peerAddress:a})})}return Xc.connectInvitee=n,Xc}var Qc={},i_;function uG(){if(i_)return Qc;i_=1,Object.defineProperty(Qc,"__esModule",{value:!0}),Qc.rejectPromotionInvite=void 0;const e=He;function t(r){return e.__awaiter(this,void 0,void 0,function*(){const{invitorAddress:n}=r||{};this.disconnect({peerAddress:n})})}return Qc.rejectPromotionInvite=t,Qc}var eu={},s_;function lG(){if(s_)return eu;s_=1,Object.defineProperty(eu,"__esModule",{value:!0}),eu.requestToBePromoted=void 0;const e=He,t=nt(),r=qr();function n(s){return e.__awaiter(this,void 0,void 0,function*(){const{role:i,promotorAddress:o}=s||{};this.request({senderAddress:this.data.local.address,recipientAddress:(0,t.pCAIP10ToWallet)(o),chatId:this.spaceSpecificData.spaceId,details:{type:r.SPACE_REQUEST_TYPE.REQUEST_TO_PROMOTE,data:{role:i}}})})}return eu.requestToBePromoted=n,eu}var tu={},a_;function dG(){if(a_)return tu;a_=1,Object.defineProperty(tu,"__esModule",{value:!0}),tu.acceptPromotionRequest=void 0;const e=He,t=ui(),r=rm(),n=Bo(),s=nt(),i=bn();function o(a){return e.__awaiter(this,void 0,void 0,function*(){const{signalData:f,promoteeAddress:c,spaceId:l,role:u}=a||{};yield(0,r.addSpeakers)({spaceId:this.spaceSpecificData.spaceId,signer:this.signer,pgpPrivateKey:this.pgpPrivateKey,speakers:[(0,s.pCAIP10ToWallet)(c)],env:this.env});const p=(0,t.produce)(this.spaceSpecificData.liveSpaceData,d=>{const h=this.spaceSpecificData.liveSpaceData.listeners.findIndex(y=>(0,s.pCAIP10ToWallet)(y.address)===(0,s.pCAIP10ToWallet)(c));d.listeners.splice(h,1),d.speakers.push({address:(0,s.pCAIP10ToWallet)(c),emojiReactions:null,audio:null})});yield(0,n.default)({spaceId:this.spaceSpecificData.spaceId,pgpPrivateKey:this.pgpPrivateKey,env:this.env,signer:this.signer,liveSpaceData:p,action:i.CHAT.META.SPACE.SPEAKER.PRVILEGE})})}return tu.acceptPromotionRequest=o,tu}var ru={},o_;function fG(){if(o_)return ru;o_=1,Object.defineProperty(ru,"__esModule",{value:!0}),ru.rejectPromotionRequest=void 0;const e=He,t=ui(),r=Bo(),n=Va(),s=nt();function i(o){return e.__awaiter(this,void 0,void 0,function*(){const{promoteeAddress:a}=o||{};this.disconnect({peerAddress:(0,s.pCAIP10ToWallet)(a)});const f=(0,t.produce)(this.spaceSpecificData.liveSpaceData,c=>{const l=this.spaceSpecificData.liveSpaceData.listeners.findIndex(u=>u.address===(0,s.pCAIP10ToWallet)(a));l>-1&&(c.listeners[l].handRaised=!1)});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},this.spaceSpecificData),{liveSpaceData:f})),yield(0,r.default)({liveSpaceData:f,pgpPrivateKey:this.pgpPrivateKey,env:this.env,spaceId:this.spaceSpecificData.spaceId,signer:this.signer,action:n.CHAT.META.GROUP.USER.INTERACTION})})}return ru.rejectPromotionRequest=i,ru}var nu={},c_;function hG(){if(c_)return nu;c_=1,Object.defineProperty(nu,"__esModule",{value:!0}),nu.connectPromotor=void 0;const e=He;function t(r){return e.__awaiter(this,void 0,void 0,function*(){const{signalData:n,promotorAddress:s}=r||{};this.connect({signalData:n,peerAddress:s})})}return nu.connectPromotor=t,nu}var iu={},u_;function pG(){if(u_)return iu;u_=1,Object.defineProperty(iu,"__esModule",{value:!0}),iu.join=void 0;const e=He,t=qr(),r=bn(),n=SA(),s=Zs(),i=RA(),o=em();function a(){return e.__awaiter(this,void 0,void 0,function*(){try{const f=yield(0,s.get)({spaceId:this.spaceSpecificData.spaceId,env:this.env});if(f.status!==r.ChatStatus.ACTIVE)throw new Error("Space not active yet");let c=!1,l=!1;const u=(0,o.default)(this.data.local.address);f.members.forEach(m=>{(0,o.default)(m.wallet)===u&&(m.isSpeaker?c=!0:l=!0)});let p=!1;f.pendingMembers.forEach(m=>{(0,o.default)(m.wallet)===u&&m.isSpeaker&&(p=!0)});const d=(0,o.default)(f.spaceCreator),h=(0,i.default)(this.data.incoming,d);if((c||p)&&h>-1)return Promise.resolve();!c&&!l&&(yield(0,n.approve)({signer:this.signer,pgpPrivateKey:this.pgpPrivateKey,senderAddress:this.spaceSpecificData.spaceId,env:this.env})),(c||p)&&(!this.data.local.stream&&(yield this.create({audio:!0,video:!1})),yield this.request({senderAddress:this.data.local.address,recipientAddress:d,chatId:this.spaceSpecificData.spaceId,details:{type:t.SPACE_REQUEST_TYPE.JOIN_SPEAKER,data:{}}}));const y=yield(0,s.get)({spaceId:this.spaceSpecificData.spaceId,env:this.env});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},y),{liveSpaceData:this.spaceSpecificData.liveSpaceData}))}catch(f){throw console.error(`[Push SDK] - API - Error - API ${a.name} -: `,f),Error(`[Push SDK] - API - Error - API ${a.name} -: ${f}`)}})}return iu.join=a,iu}var su={},l_;function yG(){if(l_)return su;l_=1,Object.defineProperty(su,"__esModule",{value:!0}),su.leave=void 0;const e=He,t=qr();function r(){return e.__awaiter(this,void 0,void 0,function*(){try{this.data.incoming.slice(1).forEach(({address:n})=>{this.disconnect({peerAddress:n,details:{type:t.SPACE_DISCONNECT_TYPE.LEAVE,data:{}}})})}catch(n){throw console.error(`[Push SDK] - API - Error - API ${stop.name} -: `,n),Error(`[Push SDK] - API - Error - API ${stop.name} -: ${n}`)}})}return su.leave=r,su}var au={},d_;function gG(){if(d_)return au;d_=1,Object.defineProperty(au,"__esModule",{value:!0}),au.stop=void 0;const e=He,t=Dt(),r=cl(),n=Zs(),s=bn(),i=qr();function o(){return e.__awaiter(this,void 0,void 0,function*(){try{const a=yield(0,n.get)({spaceId:this.spaceSpecificData.spaceId,env:this.env});if(a.status===s.ChatStatus.ENDED)throw new Error("Space already ended");const f=(0,t.getSpacesMembersList)(a.members,a.pendingMembers),c=(0,t.getSpaceAdminsList)(a.members,a.pendingMembers),l=yield(0,r.updateGroup)({chatId:this.spaceSpecificData.spaceId,groupName:a.spaceName,groupImage:a.spaceImage,groupDescription:a.spaceDescription,members:f,admins:c,signer:this.signer,env:this.env,pgpPrivateKey:this.pgpPrivateKey,scheduleAt:a.scheduleAt,scheduleEnd:a.scheduleEnd,status:s.ChatStatus.ENDED});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},(0,t.groupDtoToSpaceDto)(l)),{liveSpaceData:this.spaceSpecificData.liveSpaceData})),this.data.incoming.slice(1).forEach(({address:u})=>{this.disconnect({peerAddress:u,details:{type:i.SPACE_DISCONNECT_TYPE.STOP,data:{}}})})}catch(a){throw console.error(`[Push SDK] - API - Error - API ${o.name} -: `,a),Error(`[Push SDK] - API - Error - API ${o.name} -: ${a}`)}})}return au.stop=o,au}var ou={},td={},f_;function mG(){if(f_)return td;f_=1,Object.defineProperty(td,"__esModule",{value:!0});const e=He,t=oi(),r=Ze(),n=sm(),s=({localAddress:i,spaceId:o,pgpPrivateKey:a,env:f})=>e.__awaiter(void 0,void 0,void 0,function*(){var c,l;const u=(yield(0,t.conversationHash)({account:i,conversationId:o,env:f})).threadHash;let p=n.initLiveSpaceData;const d=yield(0,t.history)({threadhash:u,account:i,pgpPrivateKey:a,toDecrypt:!0,env:f});let h=null;for(const y of d)if(y.messageType===r.MessageType.META&&typeof y.messageObj=="object"&&y.messageObj!==null){h=y;break}return h!==null&&typeof h.messageObj=="object"&&h.messageObj!==null&&(p=(l=(c=h.messageObj)===null||c===void 0?void 0:c.info)===null||l===void 0?void 0:l.arbitrary),p});return td.default=s,td}var h_;function vG(){if(h_)return ou;h_=1,Object.defineProperty(ou,"__esModule",{value:!0}),ou.initialize=void 0;const e=He,t=bn(),r=Zs(),n=mG();function s(i){return e.__awaiter(this,void 0,void 0,function*(){const{spaceId:o}=i||{},a=yield(0,r.get)({spaceId:o,env:this.env});let f=this.spaceSpecificData.liveSpaceData;a.status===t.ChatStatus.ACTIVE&&(f=yield(0,n.default)({localAddress:this.data.local.address,spaceId:o,pgpPrivateKey:this.pgpPrivateKey,env:this.env})),this.setSpaceSpecificData(()=>Object.assign(Object.assign({},a),{liveSpaceData:f}))})}return ou.initialize=s,ou}var rd={},p_;function bG(){if(p_)return rd;p_=1,Object.defineProperty(rd,"__esModule",{value:!0});const e=(t,r)=>{t.addStream(r,void 0)};return rd.default=e,rd}var cu={},y_;function _G(){if(y_)return cu;y_=1,Object.defineProperty(cu,"__esModule",{value:!0}),cu.broadcastRaisedHand=void 0;const e=He,t=ui(),r=Bo(),n=Va(),s=nt();function i(o){return e.__awaiter(this,void 0,void 0,function*(){const{promoteeAddress:a}=o||{},f=(0,t.produce)(this.spaceSpecificData.liveSpaceData,c=>{const l=this.spaceSpecificData.liveSpaceData.listeners.findIndex(u=>(0,s.pCAIP10ToWallet)(u.address)===(0,s.pCAIP10ToWallet)(a));l!==-1&&(c.listeners[l].handRaised=!0)});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},this.spaceSpecificData),{liveSpaceData:f})),yield(0,r.default)({liveSpaceData:f,pgpPrivateKey:this.pgpPrivateKey,env:this.env,spaceId:this.spaceSpecificData.spaceId,signer:this.signer,action:n.CHAT.META.GROUP.USER.INTERACTION})})}return cu.broadcastRaisedHand=i,cu}var uu={},g_;function wG(){if(g_)return uu;g_=1,Object.defineProperty(uu,"__esModule",{value:!0}),uu.onReceiveMetaMessage=void 0;const e=Ze();function t(r){var n,s;const{receivedMetaMessage:i}=r||{};if(i.messageType!==e.MessageType.META||typeof i.messageObj!="object"||!(!((s=(n=i==null?void 0:i.messageObj)===null||n===void 0?void 0:n.info)===null||s===void 0)&&s.arbitrary))return;const o=i.messageObj.info.arbitrary;this.setSpaceSpecificData(()=>Object.assign(Object.assign({},this.spaceSpecificData),{liveSpaceData:o}))}return uu.onReceiveMetaMessage=t,uu}var lu={},m_;function EG(){if(m_)return lu;m_=1,Object.defineProperty(lu,"__esModule",{value:!0}),lu.onJoinListener=void 0;const e=He,t=Bo(),r=Zs(),n=nt(),s=ui(),i=Va();function o(a){return e.__awaiter(this,void 0,void 0,function*(){const{receivedAddress:f}=a||{};if((0,n.pCAIP10ToWallet)(this.spaceSpecificData.spaceCreator)!==this.data.local.address||!(yield(0,r.get)({spaceId:this.spaceSpecificData.spaceId,env:this.env})).members.find(p=>(0,n.pCAIP10ToWallet)(p.wallet)===(0,n.pCAIP10ToWallet)(f)&&!p.isSpeaker))return;const u=(0,s.produce)(this.spaceSpecificData.liveSpaceData,p=>{this.spaceSpecificData.liveSpaceData.listeners.find(h=>(0,n.pCAIP10ToWallet)(h.address)===(0,n.pCAIP10ToWallet)(f))||p.listeners.push({address:(0,n.pCAIP10ToWallet)(f),handRaised:!1,emojiReactions:null})});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},this.spaceSpecificData),{liveSpaceData:u})),yield(0,t.default)({spaceId:this.spaceSpecificData.spaceId,pgpPrivateKey:this.pgpPrivateKey,env:this.env,signer:this.signer,liveSpaceData:u,action:i.CHAT.META.SPACE.LISTENER.ADD})})}return lu.onJoinListener=o,lu}var v_;function sm(){return v_||(v_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Space=e.initSpaceData=e.initSpaceSpecificData=e.initLiveSpaceData=void 0;const t=He,r=ui(),n=Ze(),s=im(),i=iG(),o=sG(),a=aG(),f=oG(),c=cG(),l=uG(),u=lG(),p=dG(),d=fG(),h=hG(),y=pG(),m=yG(),v=gG(),b=vG(),w=bG(),_=bn(),C=qr(),I=Bo(),k=Va(),E=_G(),S=wG(),T=EG(),P=nt();e.initLiveSpaceData={host:{address:"",audio:null,emojiReactions:null},coHosts:[],speakers:[],listeners:[]},e.initSpaceSpecificData={members:[],pendingMembers:[],contractAddressERC20:null,numberOfERC20:-1,contractAddressNFT:null,numberOfNFTTokens:-1,verificationProof:"",spaceImage:null,spaceName:"",isPublic:!1,spaceDescription:"",spaceCreator:"",spaceId:"",scheduleAt:null,scheduleEnd:null,status:null,inviteeDetails:{},liveSpaceData:e.initLiveSpaceData},e.initSpaceData=Object.assign(Object.assign({},e.initSpaceSpecificData),{connectionData:s.initVideoCallData});class g extends s.Video{constructor(x){const{signer:D,pgpPrivateKey:O,address:B,chainId:L,env:M=n.default.ENV.PROD,setSpaceData:R}=x||{};super({signer:D,chainId:L,pgpPrivateKey:O,env:M,callType:C.VIDEO_CALL_TYPE.PUSH_SPACE,onReceiveStream:(N,F,z)=>t.__awaiter(this,void 0,void 0,function*(){var Y;if(this.spaceSpecificData.status===_.ChatStatus.ACTIVE&&(!((Y=this.data.meta.broadcast)===null||Y===void 0)&&Y.hostAddress)&&this.data.meta.broadcast.hostAddress===this.data.local.address){(0,w.default)(this.mergedStream,N);const j=(0,r.produce)(this.spaceSpecificData.liveSpaceData,re=>{const V=this.spaceSpecificData.liveSpaceData.listeners.findIndex(U=>U.address===F);re.speakers.push({address:F,audio:z,emojiReactions:V>-1?this.spaceSpecificData.liveSpaceData.listeners[V].emojiReactions:null}),V>-1&&re.listeners.splice(V,1)});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},this.spaceSpecificData),{liveSpaceData:j})),yield(0,I.default)({liveSpaceData:j,pgpPrivateKey:this.pgpPrivateKey,env:this.env,spaceId:this.spaceSpecificData.spaceId,signer:this.signer,action:k.CHAT.META.GROUP.ADMIN.PRVILEGE})}}),setData:function(){}}),this.mergedStream=null,this.initialize=b.initialize,this.update=i.update,this.createAudioStream=()=>t.__awaiter(this,void 0,void 0,function*(){yield this.create({audio:!0,video:!1})}),this.start=o.start,this.onReceiveMetaMessage=S.onReceiveMetaMessage,this.onJoinListener=T.onJoinListener,this.inviteToPromote=a.inviteToPromote,this.acceptPromotionInvite=f.acceptPromotionInvite,this.connectInvitee=c.connectInvitee,this.rejectPromotionInvite=l.rejectPromotionInvite,this.requestToBePromoted=u.requestToBePromoted,this.broadcastRaisedHand=E.broadcastRaisedHand,this.acceptPromotionRequest=p.acceptPromotionRequest,this.connectPromotor=h.connectPromotor,this.rejectPromotionRequest=d.rejectPromotionRequest,this.join=y.join,this.leave=m.leave,this.stop=v.stop,this.setData=function(N){const F=N(this.data);R(()=>Object.assign(Object.assign({},this.spaceSpecificData),{connectionData:F})),this.data=F},this.setSpaceSpecificData=function(N){const F=N(this.spaceSpecificData);R(()=>Object.assign(Object.assign({},F),{connectionData:this.data})),this.spaceSpecificData=F},this.setSpaceData=function(N){const F=N(Object.assign(Object.assign({},this.spaceSpecificData),{connectionData:this.data})),{connectionData:z}=F,Y=t.__rest(F,["connectionData"]);this.spaceSpecificData=Y,this.setData(()=>z)},this.setData(N=>(0,r.produce)(N,F=>{F.local.address=(0,P.pCAIP10ToWallet)(B)})),R(()=>e.initSpaceData),this.spaceSpecificData=e.initSpaceSpecificData}}e.Space=g,e.default=g}(q2)),q2}var b_;function am(){return b_||(b_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.space=void 0;const t=He;t.__exportStar(em(),e),t.__exportStar(aV(),e),t.__exportStar(oV(),e),t.__exportStar(Zs(),e),t.__exportStar(cV(),e),t.__exportStar(uV(),e),t.__exportStar(dV(),e),t.__exportStar(rm(),e),t.__exportStar(fV(),e),t.__exportStar(hV(),e),t.__exportStar(pV(),e),t.__exportStar(SA(),e),t.__exportStar(yV(),e),t.__exportStar(kV(),e),t.__exportStar(RV(),e),t.__exportStar(DV(),e);var r=BV();Object.defineProperty(e,"space",{enumerable:!0,get:function(){return r.spaceFeed}}),t.__exportStar(sm(),e)}(Xp)),Xp}var __;function dl(){if(__)return Vl;__=1,Object.defineProperty(Vl,"__esModule",{value:!0});const e=Ze(),t=Wf(),r=ol(),n=Yf(),s=am(),i=bn(),o=im(),a={ENV:e.ENV,STREAM:n.STREAM,CHAT:{LIST_TYPE:r.ChatListType,MESSAGE_TYPE:e.MessageType,GROUP:{RULES:{CONDITION_TYPE:i.ConditionType,CATEGORY:i.GROUP_RULES_CATEGORY,SUBCATEGORY:i.GROUP_RULES_SUB_CATEGORY,PERMISSION:i.GROUP_RULES_PERMISSION,INVITER_ROLE:i.GROUP_INVITER_ROLE}}},VIDEO:{EVENT:n.VideoEventType,STATUS:i.VideoCallStatus,INITIAL_DATA:o.initVideoCallData},SPACE:{EVENT:n.SpaceEventType,INITIAL_DATA:s.initSpaceData},ALPHA_FEATURES:e.ALPHA_FEATURES,USER:{ENCRYPTION_TYPE:e.ENCRYPTION_TYPE},NOTIFICATION:{TYPE:i.NotifictaionType,CHANNEL:{LIST_TYPE:t.ChannelListType}},FILTER:{CHANNEL_LIST:{SORT:t.ChannelListSortType,ORDER:t.ChannelListOrderType},NOTIFICATION_TYPE:i.NotifictaionType,TAGS:{USER:"USER",PUSH:"PUSH",ALL:"*"}}};return Vl.default=a,Vl}var w_;function AG(){if(w_)return xc;w_=1,Object.defineProperty(xc,"__esModule",{value:!0}),xc.getChannels=void 0;const e=He,t=dl(),r=nt(),n=Tt(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{env:o=t.default.ENV.PROD,page:a=1,limit:f=10,sort:c=t.default.FILTER.CHANNEL_LIST.SORT.SUBSCRIBER,order:l=t.default.FILTER.CHANNEL_LIST.ORDER.DESCENDING,filter:u,tag:p,user_subscribed:d}=i||{},m=`${`${(0,r.getAPIBaseUrls)(o)}/v1/channels`}?page=${a}&limit=${f}&sort=${c}&order=${l}${u?`&filter=${u}`:""}${p?`&tag=${p}`:""}${d?`&user_subscribed=${d}`:""}`;return yield(0,n.axiosGet)(m).then(v=>v.data).catch(v=>{throw console.error(`[Push SDK] - API ${m}: `,v),Error(`[Push SDK] - API - Error - API ${m} -: ${v}`)})});return xc.getChannels=s,xc}var du={},E_;function SG(){if(E_)return du;E_=1,Object.defineProperty(du,"__esModule",{value:!0}),du.getDelegates=void 0;const e=He,t=nt(),r=Ze(),n=Tt(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{channel:o,env:a=r.default.ENV.PROD}=i||{},f=yield(0,t.getCAIPAddress)(a,o,"Channel"),u=`${`${(0,t.getAPIBaseUrls)(a)}/v1/channels`}/${f}/delegates`;return yield(0,n.axiosGet)(u).then(p=>{var d;return(d=p.data)===null||d===void 0?void 0:d.delegates}).catch(p=>{console.error(`[EPNS-SDK] - API ${u}: `,p)})});return du.getDelegates=s,du}var fu={},hu={},A_;function PG(){if(A_)return hu;A_=1,Object.defineProperty(hu,"__esModule",{value:!0}),hu.parseSubscrbersApiResponse=void 0;const e=Qg();function t(r){const n=r.subscribers.map(s=>({subscriber:s.subscriber,settings:s.settings?(0,e.parseSettings)(s.settings):null}));return{itemcount:r.itemcount,subscribers:[...n]}}return hu.parseSubscrbersApiResponse=t,hu}var S_;function xG(){if(S_)return fu;S_=1,Object.defineProperty(fu,"__esModule",{value:!0}),fu.getSubscribers=void 0;const e=He,t=nt(),r=Ze(),n=Tt(),s=PG(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){try{const{channel:a,page:f=1,limit:c=10,category:l=null,setting:u=!1,env:p=r.default.ENV.PROD,raw:d=!0}=o||{};try{if(a==null||a.length==0)throw new Error("channel cannot be null or empty");if(f<=0)throw new Error("page must be greater than 0");if(c<=0)throw new Error("limit must be greater than 0");if(c>30)throw new Error("limit must be lesser than or equal to 30");const h=yield(0,t.getCAIPAddress)(p,a,"Channel");let m=`${(0,t.getAPIBaseUrls)(p)}/v1/channels/${h}/subscribers?page=${f}&limit=${c}&setting=${u}`;return l&&(m=m+`&category=${l}`),yield(0,n.axiosGet)(m).then(v=>d?v.data:(0,s.parseSubscrbersApiResponse)(v.data)).catch(v=>{console.error(`[Push SDK] - API ${m}: `,v)})}catch(h){throw console.error("[Push SDK] - API - Error - API send() -: ",h),Error(`[Push SDK] - API - Error - API send() -: ${h}`)}}catch(a){throw console.error("[Push SDK] - API - Error - API send() -: ",a),Error(`[Push SDK] - API - Error - API send() -: ${a}`)}});return fu.getSubscribers=i,fu}var pu={},P_;function TG(){if(P_)return pu;P_=1,Object.defineProperty(pu,"__esModule",{value:!0}),pu.search=void 0;const e=He,t=nt(),r=Ze(),n=Tt(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{query:o,env:a=r.default.ENV.PROD,page:f=r.default.PAGINATION.INITIAL_PAGE,limit:c=r.default.PAGINATION.LIMIT,filter:l,tag:u,user_subscribed:p,oldFormat:d=!0}=i||{};if(!o)throw Error('"query" not provided!');const y=`${(0,t.getAPIBaseUrls)(a)}/v1/channels/search/`,m=Object.assign(Object.assign(Object.assign({page:f,limit:(0,t.getLimit)(c),query:o},u&&{tag:u}),l&&{filter:l}),p&&{user_subscribed:p}),v=`${y}?${(0,t.getQueryParams)(m)}`;return(0,n.axiosGet)(v).then(b=>{const w=b.data.channels,C={itemCount:b.data.itemCount||w.length,result:w};return typeof d<"u"&&d?w:C}).catch(b=>{console.error(`[Push SDK] - API ${v}: `,b)})});return pu.search=s,pu}var yu={},x_;function CG(){if(x_)return yu;x_=1,Object.defineProperty(yu,"__esModule",{value:!0}),yu.getTags=void 0;const e=He,t=nt(),r=Ze(),n=Tt(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{channel:o,env:a=r.default.ENV.PROD}=i||{},f=yield(0,t.getCAIPAddress)(a,o,"Channel"),u=`${`${(0,t.getAPIBaseUrls)(a)}/v1/channels`}/${f}/tags`;return yield(0,n.axiosGet)(u).then(p=>{var d;return(d=p.data)===null||d===void 0?void 0:d.tags}).catch(p=>{console.error(`[EPNS-SDK] - API ${u}: `,p)})});return yu.getTags=s,yu}var gu={},T_;function IG(){if(T_)return gu;T_=1,Object.defineProperty(gu,"__esModule",{value:!0}),gu.searchTags=void 0;const e=He,t=nt(),r=Ze(),n=Tt(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{query:o,env:a=r.default.ENV.LOCAL,page:f=r.default.PAGINATION.INITIAL_PAGE,limit:c=r.default.PAGINATION.LIMIT}=i||{};if(!o)throw Error('"query" not provided!');const u=`${(0,t.getAPIBaseUrls)(a)}/v1/channels/search/tags`,p={page:f,limit:(0,t.getLimit)(c),query:o},d=`${u}?${(0,t.getQueryParams)(p)}`;return(0,n.axiosGet)(d).then(h=>h.data.channels).catch(h=>{console.error(`[Push SDK] - API ${d}: `,h)})});return gu.searchTags=s,gu}var mu={},In={},C_;function Qf(){if(C_)return In;C_=1,Object.defineProperty(In,"__esModule",{value:!0}),In.getTypeInformationV2=In.getTypeInformation=In.getSubscriptionMessageV2=In.getSubscriptionMessage=In.getDomainInformation=void 0;const e=(i,o)=>({name:"EPNS COMM V1",chainId:i,verifyingContract:o});In.getDomainInformation=e;const t=(i,o,a)=>({channel:i,[a==="Unsubscribe"?"unsubscriber":"subscriber"]:o,action:a});In.getSubscriptionMessage=t;const r=(i,o,a,f)=>{const c=a==="Unsubscribe"?"unsubscriber":"subscriber";return a=="Subscribe"?JSON.stringify({channel:i,[c]:o,action:a,userSetting:f??""},null,4):JSON.stringify({channel:i,[c]:o,action:a},null,4)};In.getSubscriptionMessageV2=r;const n=i=>i==="Subscribe"?{Subscribe:[{name:"channel",type:"address"},{name:"subscriber",type:"address"},{name:"action",type:"string"}]}:{Unsubscribe:[{name:"channel",type:"address"},{name:"unsubscriber",type:"address"},{name:"action",type:"string"}]};In.getTypeInformation=n;const s=()=>({Data:[{name:"data",type:"string"}]});return In.getTypeInformationV2=s,In}var I_;function kG(){if(I_)return mu;I_=1,Object.defineProperty(mu,"__esModule",{value:!0}),mu.subscribe=void 0;const e=He,t=nt(),r=Qf(),n=Ze(),s=Tt(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{signer:a,channelAddress:f,userAddress:c,verifyingContractAddress:l,origin:u,env:p=n.default.ENV.PROD,onSuccess:d,onError:h}=o||{};try{const y=yield(0,t.getCAIPAddress)(p,f,"Channel"),m=(0,t.getCAIPDetails)(y);if(!m)throw Error("Invalid Channel CAIP!");const v=parseInt(m.networkId,10),b=yield(0,t.getCAIPAddress)(p,c,"User"),w=(0,t.getCAIPDetails)(b);if(!w)throw Error("Invalid User CAIP!");const{API_BASE_URL:_,EPNS_COMMUNICATOR_CONTRACT:C}=(0,t.getConfig)(p,m),I=`${_}/v1/channels/${y}/subscribe`,k=(0,r.getDomainInformation)(v,l||C),E=(0,r.getTypeInformation)("Subscribe"),S=(0,r.getSubscriptionMessage)(m.address,w.address,"Subscribe"),A={verificationProof:yield new t.Signer(a).signTypedData(k,E,S,"Subscribe"),message:Object.assign(Object.assign({},S),{channel:y,subscriber:b}),origin:u};return yield(0,s.axiosPost)(I,A),typeof d=="function"&&d(),{status:"success",message:"successfully opted into channel"}}catch(y){return typeof h=="function"&&h(y),{status:"error",message:y instanceof Error?y.message:JSON.stringify(y)}}});return mu.subscribe=i,mu}var vu={},k_;function RG(){if(k_)return vu;k_=1,Object.defineProperty(vu,"__esModule",{value:!0}),vu.subscribeV2=void 0;const e=He,t=nt(),r=Qf(),n=Ze(),s=Tt(),i=Dt(),o=Yr(),a=f=>e.__awaiter(void 0,void 0,void 0,function*(){var c,l;const{signer:u,channelAddress:p,userAddress:d,settings:h=void 0,verifyingContractAddress:y,env:m=n.default.ENV.PROD,origin:v,onSuccess:b,onError:w,pgpPrivateKey:_}=f||{};try{const C=yield(0,t.getCAIPAddress)(m,p,"Channel"),I=(0,t.getCAIPDetails)(C);if(!I)throw Error("Invalid Channel CAIP!");const k=parseInt(I.networkId,10),E=yield(0,t.getCAIPAddress)(m,d,"User"),S=(0,t.getCAIPDetails)(E);if(!S)throw Error("Invalid User CAIP!");const{API_BASE_URL:T,EPNS_COMMUNICATOR_CONTRACT:P}=(0,t.getConfig)(m,I),g=`${T}/v1/channels/${C}/subscribe`;let A,x={data:{}};if(_){x={data:(0,r.getSubscriptionMessageV2)(I.address,E,"Subscribe",h)};const L=o.SHA256(JSON.stringify(x)).toString();console.log(" hash ",L),A=`pgpv4:${yield(0,i.sign)({message:L,signingKey:_})}`}else{const B=(0,r.getDomainInformation)(k,y||P),L=(0,r.getTypeInformationV2)();x={data:(0,r.getSubscriptionMessageV2)(I.address,S.address,"Subscribe",h)},A=`eip712v2:${yield new t.Signer(u).signTypedData(B,L,x,"Data")}`}const D={verificationProof:A,message:x.data,origin:v},O=yield(0,s.axiosPost)(g,D);return typeof b=="function"&&b(),{status:O.status,message:"successfully opted into channel"}}catch(C){return typeof w=="function"&&w(C),{status:(l=(c=C==null?void 0:C.response)===null||c===void 0?void 0:c.status)!==null&&l!==void 0?l:"",message:C instanceof Error?C.message:JSON.stringify(C)}}});return vu.subscribeV2=a,vu}var bu={},R_;function DG(){if(R_)return bu;R_=1,Object.defineProperty(bu,"__esModule",{value:!0}),bu.unsubscribe=void 0;const e=He,t=nt(),r=Qf(),n=Ze(),s=Tt(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{signer:a,channelAddress:f,userAddress:c,verifyingContractAddress:l,env:u=n.default.ENV.PROD,onSuccess:p,onError:d}=o||{};try{const h=yield(0,t.getCAIPAddress)(u,f,"Channel"),y=(0,t.getCAIPDetails)(h);if(!y)throw Error("Invalid Channel CAIP!");const m=parseInt(y.networkId,10),v=yield(0,t.getCAIPAddress)(u,c,"User"),b=(0,t.getCAIPDetails)(v);if(!b)throw Error("Invalid User CAIP!");const{API_BASE_URL:w,EPNS_COMMUNICATOR_CONTRACT:_}=(0,t.getConfig)(u,y),C=`${w}/v1/channels/${h}/unsubscribe`,I=(0,r.getDomainInformation)(m,l||_),k=(0,r.getTypeInformation)("Unsubscribe"),E=(0,r.getSubscriptionMessage)(y.address,b.address,"Unsubscribe"),g={verificationProof:yield new t.Signer(a).signTypedData(I,k,E,"Unsubscribe"),message:Object.assign(Object.assign({},E),{channel:h,unsubscriber:v})};return yield(0,s.axiosPost)(C,g),typeof p=="function"&&p(),{status:"success",message:"successfully opted out channel"}}catch(h){return typeof d=="function"&&d(h),{status:"error",message:h instanceof Error?h.message:JSON.stringify(h)}}});return bu.unsubscribe=i,bu}var _u={},D_;function BG(){if(D_)return _u;D_=1,Object.defineProperty(_u,"__esModule",{value:!0}),_u.unsubscribeV2=void 0;const e=He,t=nt(),r=Qf(),n=Ze(),s=Tt(),i=Dt(),o=Yr(),a=f=>e.__awaiter(void 0,void 0,void 0,function*(){var c,l;const{signer:u,channelAddress:p,userAddress:d,verifyingContractAddress:h,env:y=n.default.ENV.PROD,onSuccess:m,onError:v,pgpPrivateKey:b}=f||{};try{const w=yield(0,t.getCAIPAddress)(y,p,"Channel"),_=(0,t.getCAIPDetails)(w);if(!_)throw Error("Invalid Channel CAIP!");const C=parseInt(_.networkId,10),I=yield(0,t.getCAIPAddress)(y,d,"User"),k=(0,t.getCAIPDetails)(I);if(!k)throw Error("Invalid User CAIP!");const{API_BASE_URL:E,EPNS_COMMUNICATOR_CONTRACT:S}=(0,t.getConfig)(y,_),T=`${E}/v1/channels/${w}/unsubscribe`,P=(0,r.getDomainInformation)(C,h||S),g=(0,r.getTypeInformationV2)();let A={data:{}},x;if(b){A={data:(0,r.getSubscriptionMessageV2)(_.address,I,"Unsubscribe")};const L=o.SHA256(JSON.stringify(A)).toString();x=`pgpv4:${yield(0,i.sign)({message:L,signingKey:b})}`}else A={data:(0,r.getSubscriptionMessageV2)(_.address,k.address,"Unsubscribe")},x=`eip712v2:${yield new t.Signer(u).signTypedData(P,g,A,"Data")}`;const D={verificationProof:x,message:A.data},O=yield(0,s.axiosPost)(T,D);return typeof m=="function"&&m(),{status:O.status,message:"successfully opted out channel"}}catch(w){return typeof v=="function"&&v(w),{status:(l=(c=w==null?void 0:w.response)===null||c===void 0?void 0:c.status)!==null&&l!==void 0?l:"",message:w instanceof Error?w.message:JSON.stringify(w)}}});return _u.unsubscribeV2=a,_u}var wu={},B_;function OG(){if(B_)return wu;B_=1,Object.defineProperty(wu,"__esModule",{value:!0}),wu.getAllTags=void 0;const e=He,t=nt(),r=Ze(),n=Tt(),s=dl(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{page:a=1,limit:f=10,order:c=s.default.FILTER.CHANNEL_LIST.ORDER.DESCENDING,filter:l=s.default.FILTER.TAGS.PUSH,env:u=r.default.ENV.PROD}=o||{},d=`${(0,t.getAPIBaseUrls)(u)}/v1/channels`,h={page:a,limit:f,order:c,filter:l},y=`${d}/tags/all?${(0,t.getQueryParams)(h)}`;return yield(0,n.axiosGet)(y).then(m=>{var v;return(v=m.data)===null||v===void 0?void 0:v.tags}).catch(m=>{console.error(`[EPNS-SDK] - API ${y}: `,m)})});return wu.getAllTags=i,wu}var O_;function Oo(){return O_||(O_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=He;t.__exportStar(nV(),e),t.__exportStar(iV(),e),t.__exportStar(sV(),e),t.__exportStar(AG(),e),t.__exportStar(SG(),e),t.__exportStar(xG(),e),t.__exportStar(TG(),e),t.__exportStar(CG(),e),t.__exportStar(IG(),e),t.__exportStar(kG(),e),t.__exportStar(RG(),e),t.__exportStar(DG(),e),t.__exportStar(BG(),e),t.__exportStar(OG(),e)}(Yp)),Yp}var Eu={},Au={},Q2={},M_;function BA(){return M_||(M_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.updateGroupProfile=void 0;const t=He,r=nt(),n=Ze(),s=Dt(),i=Yr(),o=Tt(),a=ul(),f=er(),c=l=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:u,groupName:p,groupImage:d,groupDescription:h,rules:y,account:m=null,signer:v=null,env:b=n.default.ENV.PROD,pgpPrivateKey:w=null}=l||{};try{if(m==null&&v==null)throw new Error("At least one from account or signer is necessary!");const _=(0,s.getWallet)({account:m,signer:v}),C=yield(0,s.getAccountAddress)(_);(0,s.updateGroupRequestValidator)(u,p,[],[],C,h);const I=yield(0,a.getGroupInfo)({chatId:u,env:b}),k={groupName:p,groupDescription:h,groupImage:d,rules:y??{},isPublic:I.isPublic,groupType:I.groupType},E=i.SHA256(JSON.stringify(k)).toString(),S=yield(0,s.getConnectedUserV2)(_,w,b),T=yield(0,s.sign)({message:E,signingKey:S.privateKey}),g="pgpv2"+":"+T+":"+S.did,x=`${(0,r.getAPIBaseUrls)(b)}/v1/chat/groups/${u}/profile`,{isPublic:D,groupType:O}=k,B=t.__rest(k,["isPublic","groupType"]);return B.profileVerificationProof=g,(yield(0,o.axiosPut)(x,B)).data}catch(_){throw(0,f.handleError)(_,e.updateGroupProfile.name)}});e.updateGroupProfile=c}(Q2)),Q2}var Su={},N_;function om(){if(N_)return Su;N_=1,Object.defineProperty(Su,"__esModule",{value:!0}),Su.User=void 0;const e=He,t=Mn();class r{constructor(s,i){this.account=s,this.env=i}info(s){return e.__awaiter(this,void 0,void 0,function*(){const i=(s==null?void 0:s.overrideAccount)||this.account;return yield t.get({account:i,env:this.env})})}}return Su.User=r,Su}var ey={},U_;function OA(){return U_||(U_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.updateGroupConfig=void 0;const t=He,r=nt(),n=Ze(),s=Dt(),i=Yr(),o=Tt(),a=er(),f=c=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:l,meta:u,scheduleAt:p,scheduleEnd:d,status:h,account:y=null,signer:m=null,env:v=n.default.ENV.PROD,pgpPrivateKey:b=null}=c||{};try{if(y==null&&m==null)throw new Error("At least one from account or signer is necessary!");const w=(0,s.getWallet)({account:y,signer:m}),_={meta:u,scheduleAt:p,scheduleEnd:d,status:h},C=i.SHA256(JSON.stringify(_)).toString(),I=yield(0,s.getConnectedUserV2)(w,b,v),k=yield(0,s.sign)({message:C,signingKey:I.privateKey}),S="pgpv2"+":"+k+":"+I.did,P=`${(0,r.getAPIBaseUrls)(v)}/v1/chat/groups/${l}/config`,g=_;return g.configVerificationProof=S,(yield(0,o.axiosPut)(P,g)).data}catch(w){throw(0,a.handleError)(w,e.updateGroupConfig.name)}});e.updateGroupConfig=f}(ey)),ey}var L_;function cm(){if(L_)return Au;L_=1,Object.defineProperty(Au,"__esModule",{value:!0}),Au.Chat=void 0;const e=He,t=Ze(),r=ol(),n=Mn(),s=oi(),i=Dt(),o=nt(),a=BA(),f=om(),c=OA(),l=Lo();class u{constructor(d,h,y,m,v,b){this.account=d,this.env=h,this.alpha=y,this.decryptedPgpPvtKey=m,this.signer=v,this.progressHook=b,this.group={create:(w,_)=>e.__awaiter(this,void 0,void 0,function*(){var C,I,k;if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const E={account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env,groupName:w,groupDescription:(C=_==null?void 0:_.description)!==null&&C!==void 0?C:null,groupImage:(I=_==null?void 0:_.image)!==null&&I!==void 0?I:null,rules:(k=_==null?void 0:_.rules)!==null&&k!==void 0?k:{},isPublic:!(_!=null&&_.private),groupType:"default",config:{meta:null,scheduleAt:null,scheduleEnd:null,status:null},members:_!=null&&_.members?_.members:[],admins:_!=null&&_.admins?_.admins:[]},S=yield s.createGroupV2(E);return this.scalabilityV2Feature?S:yield s.getGroup({chatId:S.chatId,env:this.env})}),participants:{list:(w,_)=>e.__awaiter(this,void 0,void 0,function*(){const{page:C=1,limit:I=20,filter:k={pending:void 0,role:void 0}}=_??{},E={chatId:w,page:C,limit:I,pending:k.pending,role:k.role,env:this.env};return{members:yield s.getGroupMembers(E)}}),count:w=>e.__awaiter(this,void 0,void 0,function*(){const _=yield s.getGroupMemberCount({chatId:w,env:this.env});return{participants:_.overallCount-_.pendingCount,pending:_.pendingCount}}),status:(w,_)=>e.__awaiter(this,void 0,void 0,function*(){const C=(_==null?void 0:_.overrideAccount)||this.account,I=yield s.getGroupMemberStatus({chatId:w,did:C,env:this.env});return{pending:I.isPending,role:I.isAdmin?"admin":"member",participant:I.isMember}})},permissions:w=>e.__awaiter(this,void 0,void 0,function*(){const _={chatId:w,did:this.account,env:this.env};return yield s.getGroupAccess(_)}),info:w=>e.__awaiter(this,void 0,void 0,function*(){return this.scalabilityV2Feature?yield s.getGroupInfo({chatId:w,env:this.env}):yield s.getGroup({chatId:w,env:this.env})}),update:(w,_)=>e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const C=yield s.getGroupInfo({chatId:w,env:this.env});if(!C)throw new Error("Group not found");const I={chatId:w,groupName:_.name?_.name:C.groupName,groupDescription:_.description!==void 0?_.description:C.groupDescription,groupImage:_.image!==void 0?_.image:C.groupImage,rules:_.rules?_.rules:C.rules,account:this.account,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env},k={chatId:w,meta:_.meta?_.meta:C.meta,scheduleAt:_.scheduleAt?_.scheduleAt:C.scheduleAt,scheduleEnd:_.scheduleEnd?_.scheduleEnd:C.scheduleEnd,status:_.status?_.status:C.status,account:this.account,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env};yield(0,a.updateGroupProfile)(I);const E=yield(0,c.updateGroupConfig)(k);return this.scalabilityV2Feature?E:yield s.getGroup({chatId:E.chatId,env:this.env})}),add:(w,_)=>e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const{role:C,accounts:I}=_;if(!["ADMIN","MEMBER"].includes(C))throw new Error("Invalid role provided.");if(!I||I.length===0)throw new Error("accounts array cannot be empty!");I.forEach(S=>{if(!(0,o.isValidPushCAIP)(S))throw new Error(`Invalid account address: ${S}`)});let E;return C==="ADMIN"?E=yield s.addAdmins({chatId:w,admins:I,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature}):E=yield s.addMembers({chatId:w,members:I,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature}),this.scalabilityV2Feature?E:yield s.getGroup({chatId:E.chatId,env:this.env})}),remove:(w,_)=>e.__awaiter(this,void 0,void 0,function*(){const{accounts:C}=_;if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());if(!C||C.length===0)throw new Error("Accounts array cannot be empty!");C.forEach(E=>{if(!(0,o.isValidPushCAIP)(E))throw new Error(`Invalid account address: ${E}`)});const I=[],k=[];for(const E of C){const S=yield s.getGroupMemberStatus({chatId:w,did:E,env:this.env});S.isAdmin?I.push(E):S.isMember&&k.push(E)}return I.length>0&&(yield s.removeAdmins({chatId:w,admins:I,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature})),k.length>0&&(yield s.removeMembers({chatId:w,members:k,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature})),yield this.group.info(w)}),modify:(w,_)=>e.__awaiter(this,void 0,void 0,function*(){const{role:C,accounts:I}=_;if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());if(!["ADMIN","MEMBER"].includes(C))throw new Error("Invalid role provided.");if(!I||I.length===0)throw new Error("accounts array cannot be empty!");return I.forEach(E=>{if(!(0,o.isValidPushCAIP)(E))throw new Error(`Invalid account address: ${E}`)}),yield s.modifyRoles({chatId:w,newRole:C,members:I,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature})}),join:w=>e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const _=yield s.getGroupMemberStatus({chatId:w,did:this.account,env:this.env});return _.isPending?yield s.approve({senderAddress:w,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature}):_.isMember||(yield s.addMembers({chatId:w,members:[this.account],env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature})),yield this.group.info(w)}),leave:w=>e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const _=yield s.getGroupMemberStatus({chatId:w,did:this.account,env:this.env});let C;return _.isAdmin?C=yield s.removeAdmins({chatId:w,admins:[this.account],env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature}):C=yield s.removeMembers({chatId:w,members:[this.account],env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature}),this.scalabilityV2Feature?C:yield s.getGroup({chatId:C.chatId,env:this.env})}),reject:w=>e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());yield s.reject({senderAddress:w,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey})})},this.userInstance=new f.User(this.account,this.env),this.scalabilityV2Feature=this.alpha.feature.includes(t.ALPHA_FEATURES.SCALABILITY_V2)}list(d,h){return e.__awaiter(this,void 0,void 0,function*(){const m={account:(h==null?void 0:h.overrideAccount)||this.account,pgpPrivateKey:this.decryptedPgpPvtKey,page:h==null?void 0:h.page,limit:h==null?void 0:h.limit,env:this.env,toDecrypt:!!this.decryptedPgpPvtKey};switch(d){case r.ChatListType.CHATS:return yield s.chats(m);case r.ChatListType.REQUESTS:return yield s.requests(m);default:throw new Error("Invalid Chat List Type")}})}latest(d){return e.__awaiter(this,void 0,void 0,function*(){const{threadHash:h,intent:y}=yield s.conversationHash({conversationId:d,account:this.account,env:this.env});if(!h)return{};const m=yield s.latest({threadhash:h,toDecrypt:!!this.decryptedPgpPvtKey,pgpPrivateKey:this.decryptedPgpPvtKey,account:this.account,env:this.env}),v=y?"CHATS":"REQUESTS";return m.map(b=>Object.assign(Object.assign({},b),{listType:v}))})}history(d,h){return e.__awaiter(this,void 0,void 0,function*(){let y;const{threadHash:m,intent:v}=yield s.conversationHash({conversationId:d,account:this.account,env:this.env});if(h!=null&&h.reference?y=h.reference:y=m,!y)return[];const b=yield s.history({account:this.account,env:this.env,threadhash:y,pgpPrivateKey:this.decryptedPgpPvtKey,toDecrypt:!!this.decryptedPgpPvtKey,limit:h==null?void 0:h.limit}),w=v?"CHATS":"REQUESTS";return b.map(_=>Object.assign(Object.assign({},_),{listType:w}))})}message(d,h){return e.__awaiter(this,void 0,void 0,function*(){let y=null;const{threadHash:m,intent:v}=yield s.conversationHash({conversationId:d,account:this.account,env:this.env});if(y=(h==null?void 0:h.reference)||m,!y)return{};const b=yield this.history(d,{reference:y,limit:1}),w=v?"CHATS":"REQUESTS";return b.length>0?Object.assign(Object.assign({},b[0]),{listType:w}):null})}send(d,h){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());h.type||(h.type=t.MessageType.TEXT);const y={message:h,to:d,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env};return yield s.send(y)})}decrypt(d){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());return yield s.decryptConversation({pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env,messages:d,pgpHelper:i.PGPHelper,connectedUser:yield this.userInstance.info()})})}accept(d){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());return yield s.approve({senderAddress:d,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature})})}reject(d){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());yield s.reject({senderAddress:d,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey})})}block(d){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const h=yield n.get({account:this.account,env:this.env});for(const y of d)if(!(0,o.isValidPushCAIP)(y))throw new Error("Invalid address in the users: "+y);if(h.profile.blockedUsersList||(h.profile.blockedUsersList=[]),h.profile.blockedUsersList=[...new Set([...h.profile.blockedUsersList,...d])],!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());return yield n.profile.update({pgpPrivateKey:this.decryptedPgpPvtKey,account:this.account,profile:{name:h.profile.name,desc:h.profile.desc,picture:h.profile.picture,blockedUsersList:h.profile.blockedUsersList},env:this.env,progressHook:this.progressHook})})}unblock(d){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const h=yield n.get({account:this.account,env:this.env});for(const v of d)if(!(0,o.isValidPushCAIP)(v))throw new Error("Invalid address in the users: "+v);if(!h.profile.blockedUsersList)return h;const y=d.map(v=>e.__awaiter(this,void 0,void 0,function*(){return(yield(0,o.convertToValidDID)(v,this.env)).toLowerCase()})),m=yield Promise.all(y);return h.profile.blockedUsersList=h.profile.blockedUsersList.filter(v=>{m.includes(v.toLowerCase())}),yield n.profile.update({pgpPrivateKey:this.decryptedPgpPvtKey,account:this.account,profile:{name:h.profile.name,desc:h.profile.desc,picture:h.profile.picture,blockedUsersList:h.profile.blockedUsersList},env:this.env,progressHook:this.progressHook})})}info(d,h){var y,m,v;return e.__awaiter(this,void 0,void 0,function*(){const b=(h==null?void 0:h.overrideAccount)||this.account,w={recipient:d,account:b,env:this.env};try{const _=yield s.getChatInfo(w),C=(m=(y=_.meta)===null||y===void 0?void 0:y.group)!==null&&m!==void 0?m:!1;let I=d;if(C)I=_.chatId;else{const S=((v=_.participants)!==null&&v!==void 0?v:[]).find(T=>T!==(0,o.walletToPCAIP10)(b));S&&(I=S)}return{meta:_.meta,list:_.list,participants:_.participants,chatId:_.chatId,recipient:I}}catch(_){throw console.error("Error in Chat.info: ",_),new Error(`Error fetching chat info: ${_}`)}})}}return Au.Chat=u,Au}var Pu={},K_;function MG(){if(K_)return Pu;K_=1,Object.defineProperty(Pu,"__esModule",{value:!0}),Pu.Profile=void 0;const e=He,t=Mn(),r=Lo();class n{constructor(i,o,a,f,c){this.account=i,this.env=o,this.cache=a,this.decryptedPgpPvtKey=f,this.progressHook=c}info(i){return e.__awaiter(this,void 0,void 0,function*(){const o=(i==null?void 0:i.overrideAccount)||this.account,a=`profile-${o}`;if(this.cache.has(a))return this.cache.get(a);const f=yield t.get({account:o,env:this.env});return this.cache.set(a,f.profile),f.profile})}update(i){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(r.PushAPI.ensureSignerMessage());const{name:o,desc:a,picture:f}=i,c=yield t.profile.update({pgpPrivateKey:this.decryptedPgpPvtKey,account:this.account,profile:{name:o,desc:a,picture:f},env:this.env,progressHook:this.progressHook}),l=`profile-${this.account}`;return this.cache.delete(l),c.profile})}}return Pu.Profile=n,Pu}var xu={},F_;function NG(){if(F_)return xu;F_=1,Object.defineProperty(xu,"__esModule",{value:!0}),xu.Encryption=void 0;const e=He,t=Mn(),r=Lo(),n=om();class s{constructor(o,a,f,c,l,u){this.account=o,this.env=a,this.decryptedPgpPvtKey=f,this.pgpPublicKey=c,this.signer=l,this.progressHook=u,this.userInstance=new n.User(this.account,this.env)}info(){return e.__awaiter(this,void 0,void 0,function*(){const o=yield this.userInstance.info();let a;if(this.signer){const f=JSON.stringify(JSON.parse(o.encryptedPrivateKey).encryptedPassword),c=this.account.toLowerCase().startsWith("scw")?{SCWPGP_V1:{encryptedPassword:f}}:{NFTPGP_V1:{encryptedPassword:f}};a=yield t.decryptAuth({account:this.account,env:this.env,signer:this.signer,progressHook:this.progressHook,additionalMeta:c})}return Object.assign({decryptedPgpPrivateKey:this.decryptedPgpPvtKey,pgpPublicKey:this.pgpPublicKey},a!=null?{decryptedPassword:a}:{})})}update(o,a){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(r.PushAPI.ensureSignerMessage());if(!this.decryptedPgpPvtKey||!this.pgpPublicKey)throw new Error(r.PushAPI.ensureSignerMessage());return yield t.auth.update({account:this.account,pgpEncryptionVersion:o,additionalMeta:a==null?void 0:a.versionMeta,progressHook:this.progressHook,signer:this.signer,env:this.env,pgpPrivateKey:this.decryptedPgpPvtKey,pgpPublicKey:this.pgpPublicKey})})}}return xu.Encryption=s,xu}var Tu={},Cu={},nd={exports:{}},id={},ty={},Vi={},Iu={},Gi={},ku={},ua={},ry={},Xa={},zi={},q_;function um(){if(q_)return zi;q_=1,Object.defineProperty(zi,"__esModule",{value:!0}),zi.ERROR_PACKET=zi.PACKET_TYPES_REVERSE=zi.PACKET_TYPES=void 0;const e=Object.create(null);zi.PACKET_TYPES=e,e.open="0",e.close="1",e.ping="2",e.pong="3",e.message="4",e.upgrade="5",e.noop="6";const t=Object.create(null);zi.PACKET_TYPES_REVERSE=t,Object.keys(e).forEach(n=>{t[e[n]]=n});const r={type:"error",data:"parser error"};return zi.ERROR_PACKET=r,zi}var j_;function UG(){if(j_)return Xa;j_=1,Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.encodePacket=void 0,Xa.encodePacketToBinary=f;const e=um(),t=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",r=typeof ArrayBuffer=="function",n=c=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(c):c&&c.buffer instanceof ArrayBuffer,s=({type:c,data:l},u,p)=>t&&l instanceof Blob?u?p(l):i(l,p):r&&(l instanceof ArrayBuffer||n(l))?u?p(l):i(new Blob([l]),p):p(e.PACKET_TYPES[c]+(l||""));Xa.encodePacket=s;const i=(c,l)=>{const u=new FileReader;return u.onload=function(){const p=u.result.split(",")[1];l("b"+(p||""))},u.readAsDataURL(c)};function o(c){return c instanceof Uint8Array?c:c instanceof ArrayBuffer?new Uint8Array(c):new Uint8Array(c.buffer,c.byteOffset,c.byteLength)}let a;function f(c,l){if(t&&c.data instanceof Blob)return c.data.arrayBuffer().then(o).then(l);if(r&&(c.data instanceof ArrayBuffer||n(c.data)))return l(o(c.data));s(c,!1,u=>{a||(a=new TextEncoder),l(a.encode(u))})}return Xa}var Ru={},la={},$_;function LG(){if($_)return la;$_=1,Object.defineProperty(la,"__esModule",{value:!0}),la.decode=la.encode=void 0;const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let s=0;s<e.length;s++)t[e.charCodeAt(s)]=s;const r=s=>{let i=new Uint8Array(s),o,a=i.length,f="";for(o=0;o<a;o+=3)f+=e[i[o]>>2],f+=e[(i[o]&3)<<4|i[o+1]>>4],f+=e[(i[o+1]&15)<<2|i[o+2]>>6],f+=e[i[o+2]&63];return a%3===2?f=f.substring(0,f.length-1)+"=":a%3===1&&(f=f.substring(0,f.length-2)+"=="),f};la.encode=r;const n=s=>{let i=s.length*.75,o=s.length,a,f=0,c,l,u,p;s[s.length-1]==="="&&(i--,s[s.length-2]==="="&&i--);const d=new ArrayBuffer(i),h=new Uint8Array(d);for(a=0;a<o;a+=4)c=t[s.charCodeAt(a)],l=t[s.charCodeAt(a+1)],u=t[s.charCodeAt(a+2)],p=t[s.charCodeAt(a+3)],h[f++]=c<<2|l>>4,h[f++]=(l&15)<<4|u>>2,h[f++]=(u&3)<<6|p&63;return d};return la.decode=n,la}var H_;function KG(){if(H_)return Ru;H_=1,Object.defineProperty(Ru,"__esModule",{value:!0}),Ru.decodePacket=void 0;const e=um(),t=LG(),r=typeof ArrayBuffer=="function",n=(o,a)=>{if(typeof o!="string")return{type:"message",data:i(o,a)};const f=o.charAt(0);return f==="b"?{type:"message",data:s(o.substring(1),a)}:e.PACKET_TYPES_REVERSE[f]?o.length>1?{type:e.PACKET_TYPES_REVERSE[f],data:o.substring(1)}:{type:e.PACKET_TYPES_REVERSE[f]}:e.ERROR_PACKET};Ru.decodePacket=n;const s=(o,a)=>{if(r){const f=(0,t.decode)(o);return i(f,a)}else return{base64:!0,data:o}},i=(o,a)=>{switch(a){case"blob":return o instanceof Blob?o:new Blob([o]);case"arraybuffer":default:return o instanceof ArrayBuffer?o:o.buffer}};return Ru}var V_;function fl(){return V_||(V_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodePayload=e.decodePacket=e.encodePayload=e.encodePacket=e.protocol=void 0,e.createPacketEncoderStream=a,e.createPacketDecoderStream=u;const t=UG();Object.defineProperty(e,"encodePacket",{enumerable:!0,get:function(){return t.encodePacket}});const r=KG();Object.defineProperty(e,"decodePacket",{enumerable:!0,get:function(){return r.decodePacket}});const n=um(),s=String.fromCharCode(30),i=(p,d)=>{const h=p.length,y=new Array(h);let m=0;p.forEach((v,b)=>{(0,t.encodePacket)(v,!1,w=>{y[b]=w,++m===h&&d(y.join(s))})})};e.encodePayload=i;const o=(p,d)=>{const h=p.split(s),y=[];for(let m=0;m<h.length;m++){const v=(0,r.decodePacket)(h[m],d);if(y.push(v),v.type==="error")break}return y};e.decodePayload=o;function a(){return new TransformStream({transform(p,d){(0,t.encodePacketToBinary)(p,h=>{const y=h.length;let m;if(y<126)m=new Uint8Array(1),new DataView(m.buffer).setUint8(0,y);else if(y<65536){m=new Uint8Array(3);const v=new DataView(m.buffer);v.setUint8(0,126),v.setUint16(1,y)}else{m=new Uint8Array(9);const v=new DataView(m.buffer);v.setUint8(0,127),v.setBigUint64(1,BigInt(y))}p.data&&typeof p.data!="string"&&(m[0]|=128),d.enqueue(m),d.enqueue(h)})}})}let f;function c(p){return p.reduce((d,h)=>d+h.length,0)}function l(p,d){if(p[0].length===d)return p.shift();const h=new Uint8Array(d);let y=0;for(let m=0;m<d;m++)h[m]=p[0][y++],y===p[0].length&&(p.shift(),y=0);return p.length&&y<p[0].length&&(p[0]=p[0].slice(y)),h}function u(p,d){f||(f=new TextDecoder);const h=[];let y=0,m=-1,v=!1;return new TransformStream({transform(b,w){for(h.push(b);;){if(y===0){if(c(h)<1)break;const _=l(h,1);v=(_[0]&128)===128,m=_[0]&127,m<126?y=3:m===126?y=1:y=2}else if(y===1){if(c(h)<2)break;const _=l(h,2);m=new DataView(_.buffer,_.byteOffset,_.length).getUint16(0),y=3}else if(y===2){if(c(h)<8)break;const _=l(h,8),C=new DataView(_.buffer,_.byteOffset,_.length),I=C.getUint32(0);if(I>Math.pow(2,53-32)-1){w.enqueue(n.ERROR_PACKET);break}m=I*Math.pow(2,32)+C.getUint32(4),y=3}else{if(c(h)<m)break;const _=l(h,m);w.enqueue((0,r.decodePacket)(v?_:f.decode(_),d)),y=0}if(m===0||m>p){w.enqueue(n.ERROR_PACKET);break}}}})}e.protocol=4}(ry)),ry}function gn(e){if(e)return FG(e)}function FG(e){for(var t in gn.prototype)e[t]=gn.prototype[t];return e}gn.prototype.on=gn.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};gn.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this};gn.prototype.off=gn.prototype.removeListener=gn.prototype.removeAllListeners=gn.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+e];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var n,s=0;s<r.length;s++)if(n=r[s],n===t||n.fn===t){r.splice(s,1);break}return r.length===0&&delete this._callbacks["$"+e],this};gn.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(r){r=r.slice(0);for(var n=0,s=r.length;n<s;++n)r[n].apply(this,t)}return this};gn.prototype.emitReserved=gn.prototype.emit;gn.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};gn.prototype.hasListeners=function(e){return!!this.listeners(e).length};const qG=Object.freeze(Object.defineProperty({__proto__:null,Emitter:gn},Symbol.toStringTag,{value:"Module"})),Mo=gf(qG);var da={},hi={},G_;function No(){if(G_)return hi;G_=1,Object.defineProperty(hi,"__esModule",{value:!0}),hi.defaultBinaryType=hi.globalThisShim=hi.nextTick=void 0,hi.createCookieJar=e,hi.nextTick=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?r=>Promise.resolve().then(r):(r,n)=>n(r,0))(),hi.globalThisShim=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())(),hi.defaultBinaryType="arraybuffer";function e(){}return hi}var z_;function Uo(){if(z_)return da;z_=1,Object.defineProperty(da,"__esModule",{value:!0}),da.pick=t,da.installTimerFunctions=s,da.byteLength=o,da.randomString=f;const e=No();function t(c,...l){return l.reduce((u,p)=>(c.hasOwnProperty(p)&&(u[p]=c[p]),u),{})}const r=e.globalThisShim.setTimeout,n=e.globalThisShim.clearTimeout;function s(c,l){l.useNativeTimers?(c.setTimeoutFn=r.bind(e.globalThisShim),c.clearTimeoutFn=n.bind(e.globalThisShim)):(c.setTimeoutFn=e.globalThisShim.setTimeout.bind(e.globalThisShim),c.clearTimeoutFn=e.globalThisShim.clearTimeout.bind(e.globalThisShim))}const i=1.33;function o(c){return typeof c=="string"?a(c):Math.ceil((c.byteLength||c.size)*i)}function a(c){let l=0,u=0;for(let p=0,d=c.length;p<d;p++)l=c.charCodeAt(p),l<128?u+=1:l<2048?u+=2:l<55296||l>=57344?u+=3:(p++,u+=4);return u}function f(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}return da}var Du={},W_;function MA(){if(W_)return Du;W_=1,Object.defineProperty(Du,"__esModule",{value:!0}),Du.encode=e,Du.decode=t;function e(r){let n="";for(let s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return n}function t(r){let n={},s=r.split("&");for(let i=0,o=s.length;i<o;i++){let a=s[i].split("=");n[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return n}return Du}var Y_;function eh(){if(Y_)return ua;Y_=1;var e=rt&&rt.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(ua,"__esModule",{value:!0}),ua.Transport=ua.TransportError=void 0;const t=fl(),r=Mo,n=Uo(),s=MA(),o=(0,e(Hn()).default)("engine.io-client:transport");class a extends Error{constructor(l,u,p){super(l),this.description=u,this.context=p,this.type="TransportError"}}ua.TransportError=a;class f extends r.Emitter{constructor(l){super(),this.writable=!1,(0,n.installTimerFunctions)(this,l),this.opts=l,this.query=l.query,this.socket=l.socket,this.supportsBinary=!l.forceBase64}onError(l,u,p){return super.emitReserved("error",new a(l,u,p)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(l){this.readyState==="open"?this.write(l):o("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(l){const u=(0,t.decodePacket)(l,this.socket.binaryType);this.onPacket(u)}onPacket(l){super.emitReserved("packet",l)}onClose(l){this.readyState="closed",super.emitReserved("close",l)}pause(l){}createUri(l,u={}){return l+"://"+this._hostname()+this._port()+this.opts.path+this._query(u)}_hostname(){const l=this.opts.hostname;return l.indexOf(":")===-1?l:"["+l+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(l){const u=(0,s.encode)(l);return u.length?"?"+u:""}}return ua.Transport=f,ua}var Z_;function NA(){if(Z_)return ku;Z_=1;var e=rt&&rt.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(ku,"__esModule",{value:!0}),ku.Polling=void 0;const t=eh(),r=Uo(),n=fl(),i=(0,e(Hn()).default)("engine.io-client:polling");class o extends t.Transport{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(f){this.readyState="pausing";const c=()=>{i("paused"),this.readyState="paused",f()};if(this._polling||!this.writable){let l=0;this._polling&&(i("we are currently polling - waiting to pause"),l++,this.once("pollComplete",function(){i("pre-pause polling complete"),--l||c()})),this.writable||(i("we are currently writing - waiting to pause"),l++,this.once("drain",function(){i("pre-pause writing complete"),--l||c()}))}else c()}_poll(){i("polling"),this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(f){i("polling got data %s",f);const c=l=>{if(this.readyState==="opening"&&l.type==="open"&&this.onOpen(),l.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(l)};(0,n.decodePayload)(f,this.socket.binaryType).forEach(c),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"?this._poll():i('ignoring poll - transport state "%s"',this.readyState))}doClose(){const f=()=>{i("writing close packet"),this.write([{type:"close"}])};this.readyState==="open"?(i("transport open - closing"),f()):(i("transport not open - deferring close"),this.once("open",f))}write(f){this.writable=!1,(0,n.encodePayload)(f,c=>{this.doWrite(c,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const f=this.opts.secure?"https":"http",c=this.query||{};return this.opts.timestampRequests!==!1&&(c[this.opts.timestampParam]=(0,r.randomString)()),!this.supportsBinary&&!c.sid&&(c.b64=1),this.createUri(f,c)}}return ku.Polling=o,ku}var Bu={},J_;function jG(){if(J_)return Bu;J_=1,Object.defineProperty(Bu,"__esModule",{value:!0}),Bu.hasCORS=void 0;let e=!1;try{e=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}return Bu.hasCORS=e,Bu}var X_;function Hy(){if(X_)return Gi;X_=1;var e=rt&&rt.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(Gi,"__esModule",{value:!0}),Gi.XHR=Gi.Request=Gi.BaseXHR=void 0;const t=NA(),r=Mo,n=Uo(),s=No(),i=jG(),a=(0,e(Hn()).default)("engine.io-client:polling");function f(){}class c extends t.Polling{constructor(m){if(super(m),typeof location<"u"){const v=location.protocol==="https:";let b=location.port;b||(b=v?"443":"80"),this.xd=typeof location<"u"&&m.hostname!==location.hostname||b!==m.port}}doWrite(m,v){const b=this.request({method:"POST",data:m});b.on("success",v),b.on("error",(w,_)=>{this.onError("xhr post error",w,_)})}doPoll(){a("xhr poll");const m=this.request();m.on("data",this.onData.bind(this)),m.on("error",(v,b)=>{this.onError("xhr poll error",v,b)}),this.pollXhr=m}}Gi.BaseXHR=c;class l extends r.Emitter{constructor(m,v,b){super(),this.createRequest=m,(0,n.installTimerFunctions)(this,b),this._opts=b,this._method=b.method||"GET",this._uri=v,this._data=b.data!==void 0?b.data:null,this._create()}_create(){var m;const v=(0,n.pick)(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");v.xdomain=!!this._opts.xd;const b=this._xhr=this.createRequest(v);try{a("xhr open %s: %s",this._method,this._uri),b.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){b.setDisableHeaderCheck&&b.setDisableHeaderCheck(!0);for(let w in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(w)&&b.setRequestHeader(w,this._opts.extraHeaders[w])}}catch{}if(this._method==="POST")try{b.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{b.setRequestHeader("Accept","*/*")}catch{}(m=this._opts.cookieJar)===null||m===void 0||m.addCookies(b),"withCredentials"in b&&(b.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(b.timeout=this._opts.requestTimeout),b.onreadystatechange=()=>{var w;b.readyState===3&&((w=this._opts.cookieJar)===null||w===void 0||w.parseCookies(b.getResponseHeader("set-cookie"))),b.readyState===4&&(b.status===200||b.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof b.status=="number"?b.status:0)},0))},a("xhr data %s",this._data),b.send(this._data)}catch(w){this.setTimeoutFn(()=>{this._onError(w)},0);return}typeof document<"u"&&(this._index=l.requestsCount++,l.requests[this._index]=this)}_onError(m){this.emitReserved("error",m,this._xhr),this._cleanup(!0)}_cleanup(m){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=f,m)try{this._xhr.abort()}catch{}typeof document<"u"&&delete l.requests[this._index],this._xhr=null}}_onLoad(){const m=this._xhr.responseText;m!==null&&(this.emitReserved("data",m),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(Gi.Request=l,l.requestsCount=0,l.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",u);else if(typeof addEventListener=="function"){const y="onpagehide"in s.globalThisShim?"pagehide":"unload";addEventListener(y,u,!1)}}function u(){for(let y in l.requests)l.requests.hasOwnProperty(y)&&l.requests[y].abort()}const p=function(){const y=h({xdomain:!1});return y&&y.responseType!==null}();class d extends c{constructor(m){super(m);const v=m&&m.forceBase64;this.supportsBinary=p&&!v}request(m={}){return Object.assign(m,{xd:this.xd},this.opts),new l(h,this.uri(),m)}}Gi.XHR=d;function h(y){const m=y.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!m||i.hasCORS))return new XMLHttpRequest}catch{}if(!m)try{return new s.globalThisShim[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}return Gi}var fa={},Q_;function Vy(){if(Q_)return fa;Q_=1;var e=rt&&rt.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(fa,"__esModule",{value:!0}),fa.WS=fa.BaseWS=void 0;const t=eh(),r=Uo(),n=fl(),s=No(),o=(0,e(Hn()).default)("engine.io-client:websocket"),a=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class f extends t.Transport{get name(){return"websocket"}doOpen(){const p=this.uri(),d=this.opts.protocols,h=a?{}:(0,r.pick)(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(h.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(p,d,h)}catch(y){return this.emitReserved("error",y)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=p=>this.onClose({description:"websocket connection closed",context:p}),this.ws.onmessage=p=>this.onData(p.data),this.ws.onerror=p=>this.onError("websocket error",p)}write(p){this.writable=!1;for(let d=0;d<p.length;d++){const h=p[d],y=d===p.length-1;(0,n.encodePacket)(h,this.supportsBinary,m=>{try{this.doWrite(h,m)}catch{o("websocket closed before onclose event")}y&&(0,s.nextTick)(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const p=this.opts.secure?"wss":"ws",d=this.query||{};return this.opts.timestampRequests&&(d[this.opts.timestampParam]=(0,r.randomString)()),this.supportsBinary||(d.b64=1),this.createUri(p,d)}}fa.BaseWS=f;const c=s.globalThisShim.WebSocket||s.globalThisShim.MozWebSocket;class l extends f{createSocket(p,d,h){return a?new c(p,d,h):d?new c(p,d):new c(p)}doWrite(p,d){this.ws.send(d)}}return fa.WS=l,fa}var Ou={},e7;function UA(){if(e7)return Ou;e7=1;var e=rt&&rt.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Ou,"__esModule",{value:!0}),Ou.WT=void 0;const t=eh(),r=No(),n=fl(),i=(0,e(Hn()).default)("engine.io-client:webtransport");class o extends t.Transport{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(f){return this.emitReserved("error",f)}this._transport.closed.then(()=>{i("transport closed gracefully"),this.onClose()}).catch(f=>{i("transport closed due to %s",f),this.onError("webtransport error",f)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(f=>{const c=(0,n.createPacketDecoderStream)(Number.MAX_SAFE_INTEGER,this.socket.binaryType),l=f.readable.pipeThrough(c).getReader(),u=(0,n.createPacketEncoderStream)();u.readable.pipeTo(f.writable),this._writer=u.writable.getWriter();const p=()=>{l.read().then(({done:h,value:y})=>{if(h){i("session is closed");return}i("received chunk: %o",y),this.onPacket(y),p()}).catch(h=>{i("an error occurred while reading: %s",h)})};p();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(f){this.writable=!1;for(let c=0;c<f.length;c++){const l=f[c],u=c===f.length-1;this._writer.write(l).then(()=>{u&&(0,r.nextTick)(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var f;(f=this._transport)===null||f===void 0||f.close()}}return Ou.WT=o,Ou}var t7;function LA(){if(t7)return Iu;t7=1,Object.defineProperty(Iu,"__esModule",{value:!0}),Iu.transports=void 0;const e=Hy(),t=Vy(),r=UA();return Iu.transports={websocket:t.WS,webtransport:r.WT,polling:e.XHR},Iu}var sd={},r7;function KA(){if(r7)return sd;r7=1,Object.defineProperty(sd,"__esModule",{value:!0}),sd.parse=r;const e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,t=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function r(i){if(i.length>8e3)throw"URI too long";const o=i,a=i.indexOf("["),f=i.indexOf("]");a!=-1&&f!=-1&&(i=i.substring(0,a)+i.substring(a,f).replace(/:/g,";")+i.substring(f,i.length));let c=e.exec(i||""),l={},u=14;for(;u--;)l[t[u]]=c[u]||"";return a!=-1&&f!=-1&&(l.source=o,l.host=l.host.substring(1,l.host.length-1).replace(/;/g,":"),l.authority=l.authority.replace("[","").replace("]","").replace(/;/g,":"),l.ipv6uri=!0),l.pathNames=n(l,l.path),l.queryKey=s(l,l.query),l}function n(i,o){const a=/\/{2,9}/g,f=o.replace(a,"/").split("/");return(o.slice(0,1)=="/"||o.length===0)&&f.splice(0,1),o.slice(-1)=="/"&&f.splice(f.length-1,1),f}function s(i,o){const a={};return o.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(f,c,l){c&&(a[c]=l)}),a}return sd}var n7;function i7(){if(n7)return Vi;n7=1;var e=rt&&rt.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.Socket=Vi.SocketWithUpgrade=Vi.SocketWithoutUpgrade=void 0;const t=LA(),r=Uo(),n=MA(),s=KA(),i=Mo,o=fl(),a=No(),c=(0,e(Hn()).default)("engine.io-client:socket"),l=typeof addEventListener=="function"&&typeof removeEventListener=="function",u=[];l&&addEventListener("offline",()=>{c("closing %d connection(s) because the network was lost",u.length),u.forEach(y=>y())},!1);class p extends i.Emitter{constructor(m,v){if(super(),this.binaryType=a.defaultBinaryType,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,m&&typeof m=="object"&&(v=m,m=null),m){const b=(0,s.parse)(m);v.hostname=b.host,v.secure=b.protocol==="https"||b.protocol==="wss",v.port=b.port,b.query&&(v.query=b.query)}else v.host&&(v.hostname=(0,s.parse)(v.host).host);(0,r.installTimerFunctions)(this,v),this.secure=v.secure!=null?v.secure:typeof location<"u"&&location.protocol==="https:",v.hostname&&!v.port&&(v.port=this.secure?"443":"80"),this.hostname=v.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=v.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},v.transports.forEach(b=>{const w=b.prototype.name;this.transports.push(w),this._transportsByName[w]=b}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},v),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=(0,n.decode)(this.opts.query)),l&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(c("adding listener for the 'offline' event"),this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},u.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=(0,a.createCookieJar)()),this._open()}createTransport(m){c('creating transport "%s"',m);const v=Object.assign({},this.opts.query);v.EIO=o.protocol,v.transport=m,this.id&&(v.sid=this.id);const b=Object.assign({},this.opts,{query:v,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[m]);return c("options: %j",b),new this._transportsByName[m](b)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const m=this.opts.rememberUpgrade&&p.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const v=this.createTransport(m);v.open(),this.setTransport(v)}setTransport(m){c("setting transport %s",m.name),this.transport&&(c("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=m,m.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",v=>this._onClose("transport close",v))}onOpen(){c("socket open"),this.readyState="open",p.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(m){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(c('socket receive: type "%s", data "%s"',m.type,m.data),this.emitReserved("packet",m),this.emitReserved("heartbeat"),m.type){case"open":this.onHandshake(JSON.parse(m.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const v=new Error("server error");v.code=m.data,this._onError(v);break;case"message":this.emitReserved("data",m.data),this.emitReserved("message",m.data);break}else c('packet received with socket readyState "%s"',this.readyState)}onHandshake(m){this.emitReserved("handshake",m),this.id=m.sid,this.transport.query.sid=m.sid,this._pingInterval=m.pingInterval,this._pingTimeout=m.pingTimeout,this._maxPayload=m.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const m=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+m,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},m),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const m=this._getWritablePackets();c("flushing %d packets in socket",m.length),this.transport.send(m),this._prevBufferLen=m.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let v=1;for(let b=0;b<this.writeBuffer.length;b++){const w=this.writeBuffer[b].data;if(w&&(v+=(0,r.byteLength)(w)),b>0&&v>this._maxPayload)return c("only send %d out of %d packets",b,this.writeBuffer.length),this.writeBuffer.slice(0,b);v+=2}return c("payload size is %d (max: %d)",v,this._maxPayload),this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const m=Date.now()>this._pingTimeoutTime;return m&&(c("throttled timer detected, scheduling connection close"),this._pingTimeoutTime=0,(0,a.nextTick)(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),m}write(m,v,b){return this._sendPacket("message",m,v,b),this}send(m,v,b){return this._sendPacket("message",m,v,b),this}_sendPacket(m,v,b,w){if(typeof v=="function"&&(w=v,v=void 0),typeof b=="function"&&(w=b,b=null),this.readyState==="closing"||this.readyState==="closed")return;b=b||{},b.compress=b.compress!==!1;const _={type:m,data:v,options:b};this.emitReserved("packetCreate",_),this.writeBuffer.push(_),w&&this.once("flush",w),this.flush()}close(){const m=()=>{this._onClose("forced close"),c("socket closing - telling transport to close"),this.transport.close()},v=()=>{this.off("upgrade",v),this.off("upgradeError",v),m()},b=()=>{this.once("upgrade",v),this.once("upgradeError",v)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?b():m()}):this.upgrading?b():m()),this}_onError(m){if(c("socket error %j",m),p.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return c("trying next transport"),this.transports.shift(),this._open();this.emitReserved("error",m),this._onClose("transport error",m)}_onClose(m,v){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(c('socket close with reason: "%s"',m),this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),l&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const b=u.indexOf(this._offlineEventListener);b!==-1&&(c("removing listener for the 'offline' event"),u.splice(b,1))}this.readyState="closed",this.id=null,this.emitReserved("close",m,v),this.writeBuffer=[],this._prevBufferLen=0}}}Vi.SocketWithoutUpgrade=p,p.protocol=o.protocol;class d extends p{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade){c("starting upgrade probes");for(let m=0;m<this._upgrades.length;m++)this._probe(this._upgrades[m])}}_probe(m){c('probing transport "%s"',m);let v=this.createTransport(m),b=!1;p.priorWebsocketSuccess=!1;const w=()=>{b||(c('probe transport "%s" opened',m),v.send([{type:"ping",data:"probe"}]),v.once("packet",T=>{if(!b)if(T.type==="pong"&&T.data==="probe"){if(c('probe transport "%s" pong',m),this.upgrading=!0,this.emitReserved("upgrading",v),!v)return;p.priorWebsocketSuccess=v.name==="websocket",c('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{b||this.readyState!=="closed"&&(c("changing transport and sending upgrade packet"),S(),this.setTransport(v),v.send([{type:"upgrade"}]),this.emitReserved("upgrade",v),v=null,this.upgrading=!1,this.flush())})}else{c('probe transport "%s" failed',m);const P=new Error("probe error");P.transport=v.name,this.emitReserved("upgradeError",P)}}))};function _(){b||(b=!0,S(),v.close(),v=null)}const C=T=>{const P=new Error("probe error: "+T);P.transport=v.name,_(),c('probe transport "%s" failed because of error: %s',m,T),this.emitReserved("upgradeError",P)};function I(){C("transport closed")}function k(){C("socket closed")}function E(T){v&&T.name!==v.name&&(c('"%s" works - aborting "%s"',T.name,v.name),_())}const S=()=>{v.removeListener("open",w),v.removeListener("error",C),v.removeListener("close",I),this.off("close",k),this.off("upgrading",E)};v.once("open",w),v.once("error",C),v.once("close",I),this.once("close",k),this.once("upgrading",E),this._upgrades.indexOf("webtransport")!==-1&&m!=="webtransport"?this.setTimeoutFn(()=>{b||v.open()},200):v.open()}onHandshake(m){this._upgrades=this._filterUpgrades(m.upgrades),super.onHandshake(m)}_filterUpgrades(m){const v=[];for(let b=0;b<m.length;b++)~this.transports.indexOf(m[b])&&v.push(m[b]);return v}}Vi.SocketWithUpgrade=d;class h extends d{constructor(m,v={}){const b=typeof m=="object"?m:v;(!b.transports||b.transports&&typeof b.transports[0]=="string")&&(b.transports=(b.transports||["polling","websocket","webtransport"]).map(w=>t.transports[w]).filter(w=>!!w)),super(m,b)}}return Vi.Socket=h,Vi}var Mu={},s7;function $G(){if(s7)return Mu;s7=1,Object.defineProperty(Mu,"__esModule",{value:!0}),Mu.Fetch=void 0;const e=NA();class t extends e.Polling{doPoll(){this._fetch().then(n=>{if(!n.ok)return this.onError("fetch read error",n.status,n);n.text().then(s=>this.onData(s))}).catch(n=>{this.onError("fetch read error",n)})}doWrite(n,s){this._fetch(n).then(i=>{if(!i.ok)return this.onError("fetch write error",i.status,i);s()}).catch(i=>{this.onError("fetch write error",i)})}_fetch(n){var s;const i=n!==void 0,o=new Headers(this.opts.extraHeaders);return i&&o.set("content-type","text/plain;charset=UTF-8"),(s=this.socket._cookieJar)===null||s===void 0||s.appendCookies(o),fetch(this.uri(),{method:i?"POST":"GET",body:i?n:null,headers:o,credentials:this.opts.withCredentials?"include":"omit"}).then(a=>{var f;return(f=this.socket._cookieJar)===null||f===void 0||f.parseCookies(a.headers.getSetCookie()),a})}}return Mu.Fetch=t,Mu}var a7;function lm(){return a7||(a7=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WebTransport=e.WebSocket=e.NodeWebSocket=e.XHR=e.NodeXHR=e.Fetch=e.nextTick=e.parse=e.installTimerFunctions=e.transports=e.TransportError=e.Transport=e.protocol=e.SocketWithUpgrade=e.SocketWithoutUpgrade=e.Socket=void 0;const t=i7();Object.defineProperty(e,"Socket",{enumerable:!0,get:function(){return t.Socket}});var r=i7();Object.defineProperty(e,"SocketWithoutUpgrade",{enumerable:!0,get:function(){return r.SocketWithoutUpgrade}}),Object.defineProperty(e,"SocketWithUpgrade",{enumerable:!0,get:function(){return r.SocketWithUpgrade}}),e.protocol=t.Socket.protocol;var n=eh();Object.defineProperty(e,"Transport",{enumerable:!0,get:function(){return n.Transport}}),Object.defineProperty(e,"TransportError",{enumerable:!0,get:function(){return n.TransportError}});var s=LA();Object.defineProperty(e,"transports",{enumerable:!0,get:function(){return s.transports}});var i=Uo();Object.defineProperty(e,"installTimerFunctions",{enumerable:!0,get:function(){return i.installTimerFunctions}});var o=KA();Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return o.parse}});var a=No();Object.defineProperty(e,"nextTick",{enumerable:!0,get:function(){return a.nextTick}});var f=$G();Object.defineProperty(e,"Fetch",{enumerable:!0,get:function(){return f.Fetch}});var c=Hy();Object.defineProperty(e,"NodeXHR",{enumerable:!0,get:function(){return c.XHR}});var l=Hy();Object.defineProperty(e,"XHR",{enumerable:!0,get:function(){return l.XHR}});var u=Vy();Object.defineProperty(e,"NodeWebSocket",{enumerable:!0,get:function(){return u.WS}});var p=Vy();Object.defineProperty(e,"WebSocket",{enumerable:!0,get:function(){return p.WS}});var d=UA();Object.defineProperty(e,"WebTransport",{enumerable:!0,get:function(){return d.WT}})}(ty)),ty}var o7;function HG(){if(o7)return id;o7=1;var e=rt&&rt.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(id,"__esModule",{value:!0}),id.url=s;const t=lm(),n=(0,e(Hn()).default)("socket.io-client:url");function s(i,o="",a){let f=i;a=a||typeof location<"u"&&location,i==null&&(i=a.protocol+"//"+a.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=a.protocol+i:i=a.host+i),/^(https?|wss?):\/\//.test(i)||(n("protocol-less url %s",i),typeof a<"u"?i=a.protocol+"//"+i:i="https://"+i),n("parse %s",i),f=(0,t.parse)(i)),f.port||(/^(http|ws)$/.test(f.protocol)?f.port="80":/^(http|ws)s$/.test(f.protocol)&&(f.port="443")),f.path=f.path||"/";const l=f.host.indexOf(":")!==-1?"["+f.host+"]":f.host;return f.id=f.protocol+"://"+l+":"+f.port+o,f.href=f.protocol+"://"+l+(a&&a.port===f.port?"":":"+f.port),f}return id}var Nu={},Uu={},Un={},Lu={},Ku={},c7;function FA(){if(c7)return Ku;c7=1,Object.defineProperty(Ku,"__esModule",{value:!0}),Ku.isBinary=i,Ku.hasBinary=o;const e=typeof ArrayBuffer=="function",t=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a.buffer instanceof ArrayBuffer,r=Object.prototype.toString,n=typeof Blob=="function"||typeof Blob<"u"&&r.call(Blob)==="[object BlobConstructor]",s=typeof File=="function"||typeof File<"u"&&r.call(File)==="[object FileConstructor]";function i(a){return e&&(a instanceof ArrayBuffer||t(a))||n&&a instanceof Blob||s&&a instanceof File}function o(a,f){if(!a||typeof a!="object")return!1;if(Array.isArray(a)){for(let c=0,l=a.length;c<l;c++)if(o(a[c]))return!0;return!1}if(i(a))return!0;if(a.toJSON&&typeof a.toJSON=="function"&&arguments.length===1)return o(a.toJSON(),!0);for(const c in a)if(Object.prototype.hasOwnProperty.call(a,c)&&o(a[c]))return!0;return!1}return Ku}var u7;function VG(){if(u7)return Lu;u7=1,Object.defineProperty(Lu,"__esModule",{value:!0}),Lu.deconstructPacket=t,Lu.reconstructPacket=n;const e=FA();function t(i){const o=[],a=i.data,f=i;return f.data=r(a,o),f.attachments=o.length,{packet:f,buffers:o}}function r(i,o){if(!i)return i;if((0,e.isBinary)(i)){const a={_placeholder:!0,num:o.length};return o.push(i),a}else if(Array.isArray(i)){const a=new Array(i.length);for(let f=0;f<i.length;f++)a[f]=r(i[f],o);return a}else if(typeof i=="object"&&!(i instanceof Date)){const a={};for(const f in i)Object.prototype.hasOwnProperty.call(i,f)&&(a[f]=r(i[f],o));return a}return i}function n(i,o){return i.data=s(i.data,o),delete i.attachments,i}function s(i,o){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<o.length)return o[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let a=0;a<i.length;a++)i[a]=s(i[a],o);else if(typeof i=="object")for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&(i[a]=s(i[a],o));return i}return Lu}var l7;function dm(){if(l7)return Un;l7=1,Object.defineProperty(Un,"__esModule",{value:!0}),Un.Decoder=Un.Encoder=Un.PacketType=Un.protocol=void 0,Un.isPacketValid=y;const e=Mo,t=VG(),r=FA(),s=(0,Hn().default)("socket.io-parser"),i=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];Un.protocol=5;var o;(function(m){m[m.CONNECT=0]="CONNECT",m[m.DISCONNECT=1]="DISCONNECT",m[m.EVENT=2]="EVENT",m[m.ACK=3]="ACK",m[m.CONNECT_ERROR=4]="CONNECT_ERROR",m[m.BINARY_EVENT=5]="BINARY_EVENT",m[m.BINARY_ACK=6]="BINARY_ACK"})(o||(Un.PacketType=o={}));class a{constructor(v){this.replacer=v}encode(v){return s("encoding packet %j",v),(v.type===o.EVENT||v.type===o.ACK)&&(0,r.hasBinary)(v)?this.encodeAsBinary({type:v.type===o.EVENT?o.BINARY_EVENT:o.BINARY_ACK,nsp:v.nsp,data:v.data,id:v.id}):[this.encodeAsString(v)]}encodeAsString(v){let b=""+v.type;return(v.type===o.BINARY_EVENT||v.type===o.BINARY_ACK)&&(b+=v.attachments+"-"),v.nsp&&v.nsp!=="/"&&(b+=v.nsp+","),v.id!=null&&(b+=v.id),v.data!=null&&(b+=JSON.stringify(v.data,this.replacer)),s("encoded %j as %s",v,b),b}encodeAsBinary(v){const b=(0,t.deconstructPacket)(v),w=this.encodeAsString(b.packet),_=b.buffers;return _.unshift(w),_}}Un.Encoder=a;class f extends e.Emitter{constructor(v){super(),this.reviver=v}add(v){let b;if(typeof v=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");b=this.decodeString(v);const w=b.type===o.BINARY_EVENT;w||b.type===o.BINARY_ACK?(b.type=w?o.EVENT:o.ACK,this.reconstructor=new c(b),b.attachments===0&&super.emitReserved("decoded",b)):super.emitReserved("decoded",b)}else if((0,r.isBinary)(v)||v.base64)if(this.reconstructor)b=this.reconstructor.takeBinaryData(v),b&&(this.reconstructor=null,super.emitReserved("decoded",b));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+v)}decodeString(v){let b=0;const w={type:Number(v.charAt(0))};if(o[w.type]===void 0)throw new Error("unknown packet type "+w.type);if(w.type===o.BINARY_EVENT||w.type===o.BINARY_ACK){const C=b+1;for(;v.charAt(++b)!=="-"&&b!=v.length;);const I=v.substring(C,b);if(I!=Number(I)||v.charAt(b)!=="-")throw new Error("Illegal attachments");w.attachments=Number(I)}if(v.charAt(b+1)==="/"){const C=b+1;for(;++b&&!(v.charAt(b)===","||b===v.length););w.nsp=v.substring(C,b)}else w.nsp="/";const _=v.charAt(b+1);if(_!==""&&Number(_)==_){const C=b+1;for(;++b;){const I=v.charAt(b);if(I==null||Number(I)!=I){--b;break}if(b===v.length)break}w.id=Number(v.substring(C,b+1))}if(v.charAt(++b)){const C=this.tryParse(v.substr(b));if(f.isPayloadValid(w.type,C))w.data=C;else throw new Error("invalid payload")}return s("decoded %s as %j",v,w),w}tryParse(v){try{return JSON.parse(v,this.reviver)}catch{return!1}}static isPayloadValid(v,b){switch(v){case o.CONNECT:return d(b);case o.DISCONNECT:return b===void 0;case o.CONNECT_ERROR:return typeof b=="string"||d(b);case o.EVENT:case o.BINARY_EVENT:return Array.isArray(b)&&(typeof b[0]=="number"||typeof b[0]=="string"&&i.indexOf(b[0])===-1);case o.ACK:case o.BINARY_ACK:return Array.isArray(b)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}Un.Decoder=f;class c{constructor(v){this.packet=v,this.buffers=[],this.reconPack=v}takeBinaryData(v){if(this.buffers.push(v),this.buffers.length===this.reconPack.attachments){const b=(0,t.reconstructPacket)(this.reconPack,this.buffers);return this.finishedReconstruction(),b}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function l(m){return typeof m=="string"}const u=Number.isInteger||function(m){return typeof m=="number"&&isFinite(m)&&Math.floor(m)===m};function p(m){return m===void 0||u(m)}function d(m){return Object.prototype.toString.call(m)==="[object Object]"}function h(m,v){switch(m){case o.CONNECT:return v===void 0||d(v);case o.DISCONNECT:return v===void 0;case o.EVENT:return Array.isArray(v)&&(typeof v[0]=="number"||typeof v[0]=="string"&&i.indexOf(v[0])===-1);case o.ACK:return Array.isArray(v);case o.CONNECT_ERROR:return typeof v=="string"||d(v);default:return!1}}function y(m){return l(m.nsp)&&p(m.id)&&h(m.type,m.data)}return Un}var ad={},d7;function qA(){if(d7)return ad;d7=1,Object.defineProperty(ad,"__esModule",{value:!0}),ad.on=e;function e(t,r,n){return t.on(r,n),function(){t.off(r,n)}}return ad}var f7;function jA(){if(f7)return Uu;f7=1;var e=rt&&rt.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(Uu,"__esModule",{value:!0}),Uu.Socket=void 0;const t=dm(),r=qA(),n=Mo,i=(0,e(Hn()).default)("socket.io-client:socket"),o=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class a extends n.Emitter{constructor(c,l,u){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=c,this.nsp=l,u&&u.auth&&(this.auth=u.auth),this._opts=Object.assign({},u),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const c=this.io;this.subs=[(0,r.on)(c,"open",this.onopen.bind(this)),(0,r.on)(c,"packet",this.onpacket.bind(this)),(0,r.on)(c,"error",this.onerror.bind(this)),(0,r.on)(c,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...c){return c.unshift("message"),this.emit.apply(this,c),this}emit(c,...l){var u,p,d;if(o.hasOwnProperty(c))throw new Error('"'+c.toString()+'" is a reserved event name');if(l.unshift(c),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(l),this;const h={type:t.PacketType.EVENT,data:l};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof l[l.length-1]=="function"){const b=this.ids++;i("emitting packet with ack id %d",b);const w=l.pop();this._registerAckCallback(b,w),h.id=b}const y=(p=(u=this.io.engine)===null||u===void 0?void 0:u.transport)===null||p===void 0?void 0:p.writable,m=this.connected&&!(!((d=this.io.engine)===null||d===void 0)&&d._hasPingExpired());return this.flags.volatile&&!y?i("discard packet as the transport is not currently writable"):m?(this.notifyOutgoingListeners(h),this.packet(h)):this.sendBuffer.push(h),this.flags={},this}_registerAckCallback(c,l){var u;const p=(u=this.flags.timeout)!==null&&u!==void 0?u:this._opts.ackTimeout;if(p===void 0){this.acks[c]=l;return}const d=this.io.setTimeoutFn(()=>{delete this.acks[c];for(let y=0;y<this.sendBuffer.length;y++)this.sendBuffer[y].id===c&&(i("removing packet with ack id %d from the buffer",c),this.sendBuffer.splice(y,1));i("event with ack id %d has timed out after %d ms",c,p),l.call(this,new Error("operation has timed out"))},p),h=(...y)=>{this.io.clearTimeoutFn(d),l.apply(this,y)};h.withError=!0,this.acks[c]=h}emitWithAck(c,...l){return new Promise((u,p)=>{const d=(h,y)=>h?p(h):u(y);d.withError=!0,l.push(d),this.emit(c,...l)})}_addToQueue(c){let l;typeof c[c.length-1]=="function"&&(l=c.pop());const u={id:this._queueSeq++,tryCount:0,pending:!1,args:c,flags:Object.assign({fromQueue:!0},this.flags)};c.push((p,...d)=>u!==this._queue[0]?i("packet [%d] already acknowledged",u.id):(p!==null?u.tryCount>this._opts.retries&&(i("packet [%d] is discarded after %d tries",u.id,u.tryCount),this._queue.shift(),l&&l(p)):(i("packet [%d] was successfully sent",u.id),this._queue.shift(),l&&l(null,...d)),u.pending=!1,this._drainQueue())),this._queue.push(u),this._drainQueue()}_drainQueue(c=!1){if(i("draining queue"),!this.connected||this._queue.length===0)return;const l=this._queue[0];if(l.pending&&!c){i("packet [%d] has already been sent and is waiting for an ack",l.id);return}l.pending=!0,l.tryCount++,i("sending packet [%d] (try n°%d)",l.id,l.tryCount),this.flags=l.flags,this.emit.apply(this,l.args)}packet(c){c.nsp=this.nsp,this.io._packet(c)}onopen(){i("transport is open - connecting"),typeof this.auth=="function"?this.auth(c=>{this._sendConnectPacket(c)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(c){this.packet({type:t.PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},c):c})}onerror(c){this.connected||this.emitReserved("connect_error",c)}onclose(c,l){i("close (%s)",c),this.connected=!1,delete this.id,this.emitReserved("disconnect",c,l),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(c=>{if(!this.sendBuffer.some(u=>String(u.id)===c)){const u=this.acks[c];delete this.acks[c],u.withError&&u.call(this,new Error("socket has been disconnected"))}})}onpacket(c){if(c.nsp===this.nsp)switch(c.type){case t.PacketType.CONNECT:c.data&&c.data.sid?this.onconnect(c.data.sid,c.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case t.PacketType.EVENT:case t.PacketType.BINARY_EVENT:this.onevent(c);break;case t.PacketType.ACK:case t.PacketType.BINARY_ACK:this.onack(c);break;case t.PacketType.DISCONNECT:this.ondisconnect();break;case t.PacketType.CONNECT_ERROR:this.destroy();const u=new Error(c.data.message);u.data=c.data.data,this.emitReserved("connect_error",u);break}}onevent(c){const l=c.data||[];i("emitting event %j",l),c.id!=null&&(i("attaching ack callback to event"),l.push(this.ack(c.id))),this.connected?this.emitEvent(l):this.receiveBuffer.push(Object.freeze(l))}emitEvent(c){if(this._anyListeners&&this._anyListeners.length){const l=this._anyListeners.slice();for(const u of l)u.apply(this,c)}super.emit.apply(this,c),this._pid&&c.length&&typeof c[c.length-1]=="string"&&(this._lastOffset=c[c.length-1])}ack(c){const l=this;let u=!1;return function(...p){u||(u=!0,i("sending ack %j",p),l.packet({type:t.PacketType.ACK,id:c,data:p}))}}onack(c){const l=this.acks[c.id];if(typeof l!="function"){i("bad ack %s",c.id);return}delete this.acks[c.id],i("calling ack %s with %j",c.id,c.data),l.withError&&c.data.unshift(null),l.apply(this,c.data)}onconnect(c,l){i("socket connected with id %s",c),this.id=c,this.recovered=l&&this._pid===l,this._pid=l,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(c=>this.emitEvent(c)),this.receiveBuffer=[],this.sendBuffer.forEach(c=>{this.notifyOutgoingListeners(c),this.packet(c)}),this.sendBuffer=[]}ondisconnect(){i("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(c=>c()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(i("performing disconnect (%s)",this.nsp),this.packet({type:t.PacketType.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(c){return this.flags.compress=c,this}get volatile(){return this.flags.volatile=!0,this}timeout(c){return this.flags.timeout=c,this}onAny(c){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(c),this}prependAny(c){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(c),this}offAny(c){if(!this._anyListeners)return this;if(c){const l=this._anyListeners;for(let u=0;u<l.length;u++)if(c===l[u])return l.splice(u,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(c){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(c),this}prependAnyOutgoing(c){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(c),this}offAnyOutgoing(c){if(!this._anyOutgoingListeners)return this;if(c){const l=this._anyOutgoingListeners;for(let u=0;u<l.length;u++)if(c===l[u])return l.splice(u,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(c){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const l=this._anyOutgoingListeners.slice();for(const u of l)u.apply(this,c.data)}}}return Uu.Socket=a,Uu}var od={},h7;function GG(){if(h7)return od;h7=1,Object.defineProperty(od,"__esModule",{value:!0}),od.Backoff=e;function e(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}return e.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var r=Math.random(),n=Math.floor(r*this.jitter*t);t=Math.floor(r*10)&1?t+n:t-n}return Math.min(t,this.max)|0},e.prototype.reset=function(){this.attempts=0},e.prototype.setMin=function(t){this.ms=t},e.prototype.setMax=function(t){this.max=t},e.prototype.setJitter=function(t){this.jitter=t},od}var p7;function zG(){if(p7)return Nu;p7=1;var e=rt&&rt.__createBinding||(Object.create?function(d,h,y,m){m===void 0&&(m=y);var v=Object.getOwnPropertyDescriptor(h,y);(!v||("get"in v?!h.__esModule:v.writable||v.configurable))&&(v={enumerable:!0,get:function(){return h[y]}}),Object.defineProperty(d,m,v)}:function(d,h,y,m){m===void 0&&(m=y),d[m]=h[y]}),t=rt&&rt.__setModuleDefault||(Object.create?function(d,h){Object.defineProperty(d,"default",{enumerable:!0,value:h})}:function(d,h){d.default=h}),r=rt&&rt.__importStar||function(d){if(d&&d.__esModule)return d;var h={};if(d!=null)for(var y in d)y!=="default"&&Object.prototype.hasOwnProperty.call(d,y)&&e(h,d,y);return t(h,d),h},n=rt&&rt.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(Nu,"__esModule",{value:!0}),Nu.Manager=void 0;const s=lm(),i=jA(),o=r(dm()),a=qA(),f=GG(),c=Mo,u=(0,n(Hn()).default)("socket.io-client:manager");class p extends c.Emitter{constructor(h,y){var m;super(),this.nsps={},this.subs=[],h&&typeof h=="object"&&(y=h,h=void 0),y=y||{},y.path=y.path||"/socket.io",this.opts=y,(0,s.installTimerFunctions)(this,y),this.reconnection(y.reconnection!==!1),this.reconnectionAttempts(y.reconnectionAttempts||1/0),this.reconnectionDelay(y.reconnectionDelay||1e3),this.reconnectionDelayMax(y.reconnectionDelayMax||5e3),this.randomizationFactor((m=y.randomizationFactor)!==null&&m!==void 0?m:.5),this.backoff=new f.Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(y.timeout==null?2e4:y.timeout),this._readyState="closed",this.uri=h;const v=y.parser||o;this.encoder=new v.Encoder,this.decoder=new v.Decoder,this._autoConnect=y.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(h){return arguments.length?(this._reconnection=!!h,h||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(h){return h===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=h,this)}reconnectionDelay(h){var y;return h===void 0?this._reconnectionDelay:(this._reconnectionDelay=h,(y=this.backoff)===null||y===void 0||y.setMin(h),this)}randomizationFactor(h){var y;return h===void 0?this._randomizationFactor:(this._randomizationFactor=h,(y=this.backoff)===null||y===void 0||y.setJitter(h),this)}reconnectionDelayMax(h){var y;return h===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=h,(y=this.backoff)===null||y===void 0||y.setMax(h),this)}timeout(h){return arguments.length?(this._timeout=h,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(h){if(u("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;u("opening %s",this.uri),this.engine=new s.Socket(this.uri,this.opts);const y=this.engine,m=this;this._readyState="opening",this.skipReconnect=!1;const v=(0,a.on)(y,"open",function(){m.onopen(),h&&h()}),b=_=>{u("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",_),h?h(_):this.maybeReconnectOnOpen()},w=(0,a.on)(y,"error",b);if(this._timeout!==!1){const _=this._timeout;u("connect attempt will timeout after %d",_);const C=this.setTimeoutFn(()=>{u("connect attempt timed out after %d",_),v(),b(new Error("timeout")),y.close()},_);this.opts.autoUnref&&C.unref(),this.subs.push(()=>{this.clearTimeoutFn(C)})}return this.subs.push(v),this.subs.push(w),this}connect(h){return this.open(h)}onopen(){u("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");const h=this.engine;this.subs.push((0,a.on)(h,"ping",this.onping.bind(this)),(0,a.on)(h,"data",this.ondata.bind(this)),(0,a.on)(h,"error",this.onerror.bind(this)),(0,a.on)(h,"close",this.onclose.bind(this)),(0,a.on)(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(h){try{this.decoder.add(h)}catch(y){this.onclose("parse error",y)}}ondecoded(h){(0,s.nextTick)(()=>{this.emitReserved("packet",h)},this.setTimeoutFn)}onerror(h){u("error",h),this.emitReserved("error",h)}socket(h,y){let m=this.nsps[h];return m?this._autoConnect&&!m.active&&m.connect():(m=new i.Socket(this,h,y),this.nsps[h]=m),m}_destroy(h){const y=Object.keys(this.nsps);for(const m of y)if(this.nsps[m].active){u("socket %s is still active, skipping close",m);return}this._close()}_packet(h){u("writing packet %j",h);const y=this.encoder.encode(h);for(let m=0;m<y.length;m++)this.engine.write(y[m],h.options)}cleanup(){u("cleanup"),this.subs.forEach(h=>h()),this.subs.length=0,this.decoder.destroy()}_close(){u("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(h,y){var m;u("closed due to %s",h),this.cleanup(),(m=this.engine)===null||m===void 0||m.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",h,y),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const h=this;if(this.backoff.attempts>=this._reconnectionAttempts)u("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const y=this.backoff.duration();u("will wait %dms before reconnect attempt",y),this._reconnecting=!0;const m=this.setTimeoutFn(()=>{h.skipReconnect||(u("attempting reconnect"),this.emitReserved("reconnect_attempt",h.backoff.attempts),!h.skipReconnect&&h.open(v=>{v?(u("reconnect attempt error"),h._reconnecting=!1,h.reconnect(),this.emitReserved("reconnect_error",v)):(u("reconnect success"),h.onreconnect())}))},y);this.opts.autoUnref&&m.unref(),this.subs.push(()=>{this.clearTimeoutFn(m)})}}onreconnect(){const h=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",h)}}return Nu.Manager=p,Nu}var y7;function WG(){return y7||(y7=1,function(e,t){var r=rt&&rt.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebTransport=t.WebSocket=t.NodeWebSocket=t.XHR=t.NodeXHR=t.Fetch=t.Socket=t.Manager=t.protocol=void 0,t.io=c,t.connect=c,t.default=c;const n=HG(),s=zG();Object.defineProperty(t,"Manager",{enumerable:!0,get:function(){return s.Manager}});const i=jA();Object.defineProperty(t,"Socket",{enumerable:!0,get:function(){return i.Socket}});const a=(0,r(Hn()).default)("socket.io-client"),f={};function c(p,d){typeof p=="object"&&(d=p,p=void 0),d=d||{};const h=(0,n.url)(p,d.path||"/socket.io"),y=h.source,m=h.id,v=h.path,b=f[m]&&v in f[m].nsps,w=d.forceNew||d["force new connection"]||d.multiplex===!1||b;let _;return w?(a("ignoring socket cache for %s",y),_=new s.Manager(y,d)):(f[m]||(a("new io instance for %s",y),f[m]=new s.Manager(y,d)),_=f[m]),h.query&&!d.query&&(d.query=h.queryKey),_.socket(h.path,d)}Object.assign(c,{Manager:s.Manager,Socket:i.Socket,io:c,connect:c});var l=dm();Object.defineProperty(t,"protocol",{enumerable:!0,get:function(){return l.protocol}});var u=lm();Object.defineProperty(t,"Fetch",{enumerable:!0,get:function(){return u.Fetch}}),Object.defineProperty(t,"NodeXHR",{enumerable:!0,get:function(){return u.NodeXHR}}),Object.defineProperty(t,"XHR",{enumerable:!0,get:function(){return u.XHR}}),Object.defineProperty(t,"NodeWebSocket",{enumerable:!0,get:function(){return u.NodeWebSocket}}),Object.defineProperty(t,"WebSocket",{enumerable:!0,get:function(){return u.WebSocket}}),Object.defineProperty(t,"WebTransport",{enumerable:!0,get:function(){return u.WebTransport}}),e.exports=c}(nd,nd.exports)),nd.exports}var g7;function YG(){if(g7)return Cu;g7=1,Object.defineProperty(Cu,"__esModule",{value:!0}),Cu.createSocketConnection=void 0;const e=He,t=WG(),r=un(),n=nt();function s({user:i,env:o,socketType:a="notification",socketOptions:f}){return e.__awaiter(this,void 0,void 0,function*(){const{autoConnect:c=!0,reconnectionAttempts:l=5,reconnectionDelay:u,reconnectionDelayMax:p}=f||{};let d=r.API_BASE_URL[o];d.endsWith("/apis")&&(d=d.substring(0,d.length-5));const h=["websocket"];let y=null;try{const m=a==="chat"?(0,n.walletToPCAIP10)(i):yield(0,n.getCAIPAddress)(o,i,"User"),v=a==="notification"?{address:m}:{mode:"chat",did:m};y=(0,t.io)(d,Object.assign(Object.assign({transports:h,query:v,autoConnect:c,reconnectionAttempts:l},u!==void 0&&{reconnectionDelay:u}),p!==void 0&&{reconnectionDelayMax:p}))}catch(m){console.error("[PUSH-SDK] - Socket connection error: ",m)}return y})}return Cu.createSocketConnection=s,Cu}var Fu={},m7;function ZG(){if(m7)return Fu;m7=1,Object.defineProperty(Fu,"__esModule",{value:!0}),Fu.DataModifier=void 0;const e=Yf(),t=bn(),r=qr();let n=class $A{static handleChatGroupEvent(i,o=!1){switch(i.eventType){case"create":return this.mapToCreateGroupEvent(i,o);case"update":return this.mapToUpdateGroupEvent(i,o);case e.GroupEventType.JoinGroup:return this.mapToJoinGroupEvent(i,o);case e.GroupEventType.LeaveGroup:return this.mapToLeaveGroupEvent(i,o);case e.MessageEventType.Request:return this.mapToRequestEvent(i,o);case e.GroupEventType.Remove:return this.mapToRemoveEvent(i,o);case e.GroupEventType.RoleChange:return this.mapToRoleChangeEvent(i,o);default:return console.warn("Unknown eventType:",i.eventType),i}}static mapToJoinGroupEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,chatId:i.chatId,from:i.from,to:i.to,event:e.GroupEventType.JoinGroup};return o?Object.assign(Object.assign({},a),{raw:{verificationProof:i.verificationProof}}):a}static mapToLeaveGroupEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,chatId:i.chatId,from:i.from,to:i.to,event:e.GroupEventType.LeaveGroup};return o?Object.assign(Object.assign({},a),{raw:{verificationProof:i.verificationProof}}):a}static mapToRequestEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,chatId:i.chatId,from:i.from,to:i.to,event:e.MessageEventType.Request,meta:{group:i.isGroup||!1}};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToRemoveEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,chatId:i.chatId,from:i.from,to:i.to,event:e.GroupEventType.Remove};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToRoleChangeEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,chatId:i.chatId,from:i.from,to:i.to,newRole:i.newRole,event:e.GroupEventType.RoleChange};return o&&(a.raw={verificationProof:i.verificationProof}),a}static buildChatGroupEventMetaAndRaw(i,o){const a={name:i.groupName,description:i.groupDescription,image:i.groupImage,owner:i.groupCreator,private:!i.isPublic,rules:i.rules||{}};if(o){const f={verificationProof:i.verificationProof};return{meta:a,raw:f}}return{meta:a}}static mapToGroupEvent(i,o,a){const{meta:f,raw:c}=this.buildChatGroupEventMetaAndRaw(o,a),l={event:i,origin:o.messageOrigin,timestamp:o.timestamp,chatId:o.chatId,from:o.from,meta:f};return a&&(l.raw=c),l}static mapToCreateGroupEvent(i,o){return this.mapToGroupEvent(e.GroupEventType.CreateGroup,i,o)}static mapToUpdateGroupEvent(i,o){return this.mapToGroupEvent(e.GroupEventType.UpdateGroup,i,o)}static mapToMessageEvent(i,o=!1,a){i.hasIntent===!1&&a==="message"&&(a=e.MessageEventType.Request);const f={event:a,origin:i.messageOrigin,timestamp:i.timestamp.toString(),chatId:i.chatId,from:i.fromCAIP10,to:[i.toCAIP10],message:Object.assign({type:i.messageType},i.messageObj),meta:{group:i.isGroup||!1},reference:i.cid};if(o){const c={fromCAIP10:i.fromCAIP10,toCAIP10:i.toCAIP10,fromDID:i.fromDID,toDID:i.toDID,encType:i.encType,encryptedSecret:i.encryptedSecret,signature:i.signature,sigType:i.sigType,verificationProof:i.verificationProof,previousReference:i.link};f.raw=c}return f}static handleChatEvent(i,o=!1){if(!i)throw console.error("Error in handleChatEvent: data is undefined or null"),new Error("data is undefined or null");const a={Chat:e.MessageEventType.Message,Request:e.MessageEventType.Request,Approve:e.MessageEventType.Accept,Reject:e.MessageEventType.Reject},f=i.eventType||i.messageCategory;if(!a[f])throw console.error("Error in handleChatEvent: Invalid eventType or messageCategory",JSON.stringify(i)),new Error("Invalid eventType or messageCategory in data");const c=a[f];return c?this.mapToMessageEvent(i,o,c):(console.warn("Unknown eventType:",i.eventType||i.messageCategory),i)}static mapToNotificationEvent(i,o,a,f=!1){var c,l,u;const p=Object.keys(e.NOTIFICATION.TYPE).find(y=>e.NOTIFICATION.TYPE[y]===i.payload.data.type)||"BROADCAST";let d;Array.isArray(i.payload.recipients)?d=i.payload.recipients:typeof i.payload.recipients=="string"?d=[i.payload.recipients]:d=Object.keys(i.payload.recipients);const h={event:o,origin:a,timestamp:i.epoch,from:i.sender,to:d,notifID:i.payload_id.toString(),channel:{name:i.payload.data.app,icon:i.payload.data.icon,url:i.payload.data.url},meta:{type:"NOTIFICATION."+p},message:{notification:{title:i.payload.notification.title,body:i.payload.notification.body},payload:{title:i.payload.data.asub,body:i.payload.data.amsg,cta:i.payload.data.acta,embed:i.payload.data.aimg,meta:{domain:((c=i.payload.data.additionalMeta)===null||c===void 0?void 0:c.domain)||"push.org",type:(l=i.payload.data.additionalMeta)===null||l===void 0?void 0:l.type,data:(u=i.payload.data.additionalMeta)===null||u===void 0?void 0:u.data}}},config:{expiry:i.payload.data.etime,silent:i.payload.data.silent==="1",hidden:i.payload.data.hidden==="1"},source:i.source};return f&&(h.raw={verificationProof:i.payload.verificationProof}),h}static convertToProposedName(i){switch(i){case"message":return e.ProposedEventNames.Message;case"request":return e.ProposedEventNames.Request;case"accept":return e.ProposedEventNames.Accept;case"reject":return e.ProposedEventNames.Reject;case"leaveGroup":return e.ProposedEventNames.LeaveGroup;case"joinGroup":return e.ProposedEventNames.JoinGroup;case"createGroup":return e.ProposedEventNames.CreateGroup;case"updateGroup":return e.ProposedEventNames.UpdateGroup;case"remove":return e.ProposedEventNames.Remove;case"roleChange":return e.ProposedEventNames.RoleChange;default:throw new Error(`Unknown current event name: ${i}`)}}static convertToProposedNameForSpace(i){switch(i){case"create":return e.ProposedEventNames.CreateSpace;case"update":return e.ProposedEventNames.UpdateSpace;case"request":return e.ProposedEventNames.SpaceRequest;case"accept":return e.ProposedEventNames.SpaceAccept;case"reject":return e.ProposedEventNames.SpaceReject;case"leaveSpace":return e.ProposedEventNames.LeaveSpace;case"joinSpace":return e.ProposedEventNames.JoinSpace;case"remove":return e.ProposedEventNames.SpaceRemove;case"start":return e.ProposedEventNames.StartSpace;case"stop":return e.ProposedEventNames.StopSpace;default:throw new Error(`Unknown current event name: ${i}`)}}static handleToField(i){var o;switch(i.event){case e.ProposedEventNames.LeaveGroup:case e.ProposedEventNames.JoinGroup:i.to=null;break;case e.ProposedEventNames.Accept:case e.ProposedEventNames.Reject:!((o=i.meta)===null||o===void 0)&&o.group&&(i.to=null);break}}static handleSpaceEvent(i,o=!1){switch(i.eventType){case"create":return this.mapToCreateSpaceEvent(i,o);case"update":return this.mapToUpdateSpaceEvent(i,o);case"request":return this.mapToRequestSpaceEvent(i,o);case"remove":return this.mapToRemoveSpaceEvent(i,o);case"joinSpace":return this.mapToJoinSpaceEvent(i,o);case"leaveSpace":return this.mapToLeaveSpaceEvent(i,o);case"start":return this.mapToStartSpaceEvent(i,o);case"stop":return this.mapToStopSpaceEvent(i,o);default:switch(i.messageCategory){case"Approve":return this.mapToSpaceApproveEvent(i,o);case"Reject":return this.mapToSpaceRejectEvent(i,o);default:return console.warn("Unknown eventType or messageCategory for space:",i.eventType,i.messageCategory),i}}}static mapToCreateSpaceEvent(i,o){const a={event:i.eventType,origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.spaceCreator,meta:{name:i.spaceName,description:i.spaceDescription,image:i.spaceImage,owner:i.spaceCreator,private:!i.isPublic,rules:i.rules||{}}};return o&&(a.raw={verificationProof:i.verificationProof||""}),a}static mapToUpdateSpaceEvent(i,o){const a={event:i.eventType,origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.spaceCreator,meta:{name:i.spaceName,description:i.spaceDescription,image:i.spaceImage,owner:i.spaceCreator,private:!i.isPublic,rules:i.rules||{}}};return o&&(a.raw={verificationProof:i.verificationProof||""}),a}static mapToRequestSpaceEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.from,to:i.to,event:e.MessageEventType.Request};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToSpaceApproveEvent(i,o){const a={event:"request",origin:i.messageOrigin==="other"?"self":"other",timestamp:i.timestamp,spaceId:i.chatId,from:i.fromCAIP10,to:[i.toCAIP10]};return o&&(a.raw={verificationProof:i.verificationProof||""}),a}static mapToSpaceRejectEvent(i,o){const a={event:"reject",origin:i.messageOrigin==="other"?"other":"self",timestamp:i.timestamp.toString(),spaceId:i.chatId,from:i.fromCAIP10,to:null};return o&&(a.raw={verificationProof:i.verificationProof||""}),a}static mapToRemoveSpaceEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.from,to:i.to,event:"remove"};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToJoinSpaceEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.from,to:i.to,event:i.eventType};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToLeaveSpaceEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.from,to:i.to,event:i.eventType};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToStartSpaceEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.from,to:null,event:i.eventType};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToStopSpaceEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.from,to:null,event:i.eventType};return o&&(a.raw={verificationProof:i.verificationProof}),a}static convertToProposedNameForVideo(i){switch(i){case t.VideoCallStatus.INITIALIZED:return e.VideoEventType.REQUEST;case t.VideoCallStatus.RECEIVED:return e.VideoEventType.APPROVE;case t.VideoCallStatus.CONNECTED:return e.VideoEventType.CONNECT;case t.VideoCallStatus.ENDED:return e.VideoEventType.DISCONNECT;case t.VideoCallStatus.DISCONNECTED:return e.VideoEventType.DENY;case t.VideoCallStatus.RETRY_INITIALIZED:return e.VideoEventType.RETRY_REQUEST;case t.VideoCallStatus.RETRY_RECEIVED:return e.VideoEventType.RETRY_APPROVE;default:throw new Error(`Unknown video call status: ${i}`)}}static mapToVideoEvent(i,o,a=!1){var f,c;const{senderAddress:l,signalData:u,status:p,chatId:d}=JSON.parse((f=i.payload.data.additionalMeta)===null||f===void 0?void 0:f.data),h=(c=i.payload.rules)!==null&&c!==void 0?c:{access:{type:r.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT,data:{chatId:d}}},y={address:l,signal:u,meta:{rules:h}},v={event:$A.convertToProposedNameForVideo(p),origin:o,timestamp:i.epoch,peerInfo:y};return a&&(v.raw={verificationProof:i.payload.verificationProof}),v}};return Fu.DataModifier=n,Fu}var v7;function JG(){if(v7)return Tu;v7=1,Object.defineProperty(Tu,"__esModule",{value:!0}),Tu.PushStream=void 0;const e=He,t=Q7,r=YG(),n=Ze(),s=Yf(),i=ZG(),o=nt(),a=cm(),f=un(),c=Xf(),l=nm();let u=class HA extends t.EventEmitter{constructor(d,h,y,m,v,b){var w;super(),this._listen=h,this.decryptedPgpPvtKey=m,this.progressHook=v,this.signer=b,this.account=d,this.raw=(w=y.raw)!==null&&w!==void 0?w:!1,this.options=y,this.listen=h,this.disconnected=!1,this.uid=(0,l.v4)(),this.chatSocketCount=0,this.notifSocketCount=0,this.chatSocketConnected=!1,this.notifSocketConnected=!1,this.chatInstance=new a.Chat(this.account,this.options.env,f.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD],this.decryptedPgpPvtKey,this.signer,this.progressHook)}static initialize(d,h,y,m,v,b,w){return e.__awaiter(this,void 0,void 0,function*(){const _={raw:!1,connection:{auto:!0,retries:3},env:y};if(!h||h.length===0)throw new Error("The listen property must have at least one STREAM type.");const C=Object.assign(Object.assign({},_),w),I=C.overrideAccount||d;return h.includes("*")&&(h=Object.values(s.STREAM)),new HA(I,h,C,m,v,b)})}reinit(d,h){return e.__awaiter(this,void 0,void 0,function*(){this.listen=d,this.options=Object.assign(Object.assign({},this.options),h),yield this.connect(!0)})}connect(d=!1){return e.__awaiter(this,void 0,void 0,function*(){return new Promise((h,y)=>{e.__awaiter(this,void 0,void 0,function*(){var m,v,b,w,_,C,I,k,E,S,T,P,g,A;const x=!this.listen||this.listen.length===0||this.listen.includes(s.STREAM.CHAT)||this.listen.includes(s.STREAM.CHAT_OPS)||this.listen.includes(s.STREAM.SPACE)||this.listen.includes(s.STREAM.SPACE_OPS),D=!this.listen||this.listen.length===0||this.listen.includes(s.STREAM.NOTIF)||this.listen.includes(s.STREAM.NOTIF_OPS)||this.listen.includes(s.STREAM.VIDEO);console.log("RestAPI::PushStream::connect - Initialization flags:",{shouldInitializeChatSocket:x,shouldInitializeNotifSocket:D});let O=d?this.chatSocketConnected:!1,B=d?this.notifSocketConnected:!1;const L=()=>{console.log("RestAPI::PushStream::connect - Checking conditions for STREAM.CONNECT event.",{shouldInitializeChatSocket:x,isChatSocketConnected:O,shouldInitializeNotifSocket:D,isNotifSocketConnected:B}),(x&&O||!x)&&(D&&B||!D)?(this.emit(s.STREAM.CONNECT),console.log("RestAPI::PushStream::connect - Emitted STREAM.CONNECT"),h()):console.log("RestAPI::PushStream:: not emitting")};setTimeout(()=>{this.notifSocketConnected||this.chatSocketConnected||y(new Error("Connection timeout"))},5e3);const R=F=>e.__awaiter(this,void 0,void 0,function*(){F==="chat"?(O=!1,this.chatSocketConnected=!1,console.log("RestAPI::PushStream::handleSocketDisconnection - Chat socket disconnected. Decrementing chatSocketCount.","Previous chatSocketCount:",this.chatSocketCount),this.chatSocketCount--,console.log("RestAPI::PushStream::handleSocketDisconnection - New chatSocketCount:",this.chatSocketCount),B?this.pushNotificationSocket&&this.pushNotificationSocket.connected&&(console.log("RestAPI::PushStream::handleSocketDisconnection - Disconnecting Notification Socket..."),this.pushNotificationSocket.disconnect()):(this.emit(s.STREAM.DISCONNECT),console.log("RestAPI::PushStream::handleSocketDisconnection - Emitted STREAM.DISCONNECT for chat."))):F==="notif"&&(B=!1,this.notifSocketConnected=!1,console.log("RestAPI::PushStream::handleSocketDisconnection - Notification socket disconnected. Decrementing notifSocketCount.","Previous notifSocketCount:",this.notifSocketCount),this.notifSocketCount--,console.log("RestAPI::PushStream::handleSocketDisconnection - New notifSocketCount:",this.notifSocketCount),O?this.pushChatSocket&&this.pushChatSocket.connected&&(console.log("RestAPI::PushStream::handleSocketDisconnection - Disconnecting Chat Socket..."),this.pushChatSocket.disconnect()):(this.emit(s.STREAM.DISCONNECT),console.log("RestAPI::PushStream::handleSocketDisconnection - Emitted STREAM.DISCONNECT for notification.")))});x&&(this.pushChatSocket?this.pushChatSocket&&!this.chatSocketConnected?(console.log("RestAPI::PushStream::ChatSocket::Reconnect - Attempting to reconnect push chat socket..."),this.pushChatSocket.connect()):console.log("RestAPI::PushStream::ChatSocket::Status - Push chat socket already connected"):(console.log("RestAPI::PushStream::ChatSocket::Create - pushChatSocket does not exist, creating new socket connection..."),this.pushChatSocket=yield(0,r.createSocketConnection)({user:(0,o.walletToPCAIP10)(this.account),socketType:"chat",socketOptions:{autoConnect:(b=(v=(m=this.options)===null||m===void 0?void 0:m.connection)===null||v===void 0?void 0:v.auto)!==null&&b!==void 0?b:!0,reconnectionAttempts:(C=(_=(w=this.options)===null||w===void 0?void 0:w.connection)===null||_===void 0?void 0:_.retries)!==null&&C!==void 0?C:3},env:(I=this.options)===null||I===void 0?void 0:I.env}),this.pushChatSocket||y(new Error("RestAPI::PushStream::ChatSocket::Error - Push chat socket not connected")))),D&&(this.pushNotificationSocket?this.pushNotificationSocket&&!this.notifSocketConnected?(console.log("RestAPI::PushStream::NotifSocket::Reconnect - Attempting to reconnect push notification socket..."),this.pushNotificationSocket.connect()):console.log("RestAPI::PushStream::NotifSocket::Status - Push notification socket already connected"):(console.log("RestAPI::PushStream::NotifSocket::Create - pushNotificationSocket does not exist, creating new socket connection..."),this.pushNotificationSocket=yield(0,r.createSocketConnection)({user:(0,o.pCAIP10ToWallet)(this.account),env:(k=this.options)===null||k===void 0?void 0:k.env,socketOptions:{autoConnect:(T=(S=(E=this.options)===null||E===void 0?void 0:E.connection)===null||S===void 0?void 0:S.auto)!==null&&T!==void 0?T:!0,reconnectionAttempts:(A=(g=(P=this.options)===null||P===void 0?void 0:P.connection)===null||g===void 0?void 0:g.retries)!==null&&A!==void 0?A:3}}),this.pushNotificationSocket||y(new Error("RestAPI::PushStream::NotifSocket::Error - Push notification socket not connected"))));const N=F=>!this.listen||this.listen.length===0?!0:this.listen.includes(F);this.pushChatSocket&&(L(),this.pushChatSocket.off(s.EVENTS.CONNECT),this.pushChatSocket.on(s.EVENTS.CONNECT,()=>e.__awaiter(this,void 0,void 0,function*(){O=!0,this.chatSocketCount++,this.chatSocketConnected=!0,L(),console.log(`RestAPI::PushStream::EVENTS.CONNECT:: Chat Socket Connected (ID: ${this.pushChatSocket.id})`)})),this.pushChatSocket.off(s.EVENTS.DISCONNECT),this.pushChatSocket.on(s.EVENTS.DISCONNECT,()=>e.__awaiter(this,void 0,void 0,function*(){console.log("RestAPI::PushStream::ChatSocket::Disconnect - Chat socket disconnected."),yield R("chat")})),this.pushChatSocket.off(s.EVENTS.CHAT_GROUPS),this.pushChatSocket.on(s.EVENTS.CHAT_GROUPS,F=>{try{const z=i.DataModifier.handleChatGroupEvent(F,this.raw);z.event=i.DataModifier.convertToProposedName(z.event),z.streamUid=this.uid,i.DataModifier.handleToField(z),this.shouldEmitChat(F.chatId)&&(F.eventType===s.GroupEventType.JoinGroup||F.eventType===s.GroupEventType.LeaveGroup||F.eventType===s.MessageEventType.Request||F.eventType===s.GroupEventType.Remove||F.eventType===s.GroupEventType.RoleChange?N(s.STREAM.CHAT)&&this.emit(s.STREAM.CHAT,z):N(s.STREAM.CHAT_OPS)&&this.emit(s.STREAM.CHAT_OPS,z))}catch(z){console.error("Error handling CHAT_GROUPS event:",z,"Data:",F)}}),this.pushChatSocket.off(s.EVENTS.CHAT_RECEIVED_MESSAGE),this.pushChatSocket.on(s.EVENTS.CHAT_RECEIVED_MESSAGE,F=>e.__awaiter(this,void 0,void 0,function*(){try{(F.messageCategory=="Chat"||F.messageCategory=="Request")&&this.decryptedPgpPvtKey&&(F=yield this.chatInstance.decrypt([F]),F=F[0]);const z=i.DataModifier.handleChatEvent(F,this.raw);z.event=i.DataModifier.convertToProposedName(z.event),i.DataModifier.handleToField(z),this.shouldEmitChat(F.chatId)&&N(s.STREAM.CHAT)&&this.emit(s.STREAM.CHAT,z)}catch(z){console.error("Error handling CHAT_RECEIVED_MESSAGE event:",z,"Data:",F)}})),this.pushChatSocket.off("SPACES"),this.pushChatSocket.on("SPACES",F=>{try{const z=i.DataModifier.handleSpaceEvent(F,this.raw);z.event=i.DataModifier.convertToProposedNameForSpace(z.event),i.DataModifier.handleToField(z),this.shouldEmitSpace(F.spaceId)&&(F.eventType===s.SpaceEventType.Join||F.eventType===s.SpaceEventType.Leave||F.eventType===s.MessageEventType.Request||F.eventType===s.SpaceEventType.Remove||F.eventType===s.SpaceEventType.Start||F.eventType===s.SpaceEventType.Stop?N(s.STREAM.SPACE)&&this.emit(s.STREAM.SPACE,z):N(s.STREAM.SPACE_OPS)&&this.emit(s.STREAM.SPACE_OPS,z))}catch(z){console.error("Error handling SPACES event:",z,"Data:",F)}}),this.pushChatSocket.off("SPACES_MESSAGES"),this.pushChatSocket.on("SPACES_MESSAGES",F=>{try{const z=i.DataModifier.handleSpaceEvent(F,this.raw);z.event=i.DataModifier.convertToProposedNameForSpace(z.event),i.DataModifier.handleToField(z),this.shouldEmitSpace(F.spaceId)&&N(s.STREAM.SPACE)&&this.emit(s.STREAM.SPACE,z)}catch(z){console.error("Error handling SPACES event:",z,"Data:",F)}})),this.pushNotificationSocket&&(L(),this.pushNotificationSocket.off(s.EVENTS.CONNECT),this.pushNotificationSocket.on(s.EVENTS.CONNECT,()=>e.__awaiter(this,void 0,void 0,function*(){console.log(`RestAPI::PushStream::NotifSocket::Connect - Notification Socket Connected (ID: ${this.pushNotificationSocket.id})`),B=!0,this.notifSocketCount++,this.notifSocketConnected=!0,L()})),this.pushNotificationSocket.off(s.EVENTS.DISCONNECT),this.pushNotificationSocket.on(s.EVENTS.DISCONNECT,()=>e.__awaiter(this,void 0,void 0,function*(){console.log("RestAPI::PushStream::NotifSocket::Disconnect - Notification socket disconnected."),yield R("notif")})),this.pushNotificationSocket.off(s.EVENTS.USER_FEEDS),this.pushNotificationSocket.on(s.EVENTS.USER_FEEDS,F=>{var z;try{if(((z=F.payload.data.additionalMeta)===null||z===void 0?void 0:z.type)===`${c.ADDITIONAL_META_TYPE.PUSH_VIDEO}+1`&&N(s.STREAM.VIDEO)&&this.shouldEmitVideo(F.sender)){const Y=i.DataModifier.mapToVideoEvent(F,this.account===F.sender?s.MessageOrigin.Self:s.MessageOrigin.Other,this.raw);this.emit(s.STREAM.VIDEO,Y)}else{const Y=i.DataModifier.mapToNotificationEvent(F,s.NotificationEventType.INBOX,this.account===F.sender?"self":"other",this.raw);this.shouldEmitChannel(Y.from)&&N(s.STREAM.NOTIF)&&this.emit(s.STREAM.NOTIF,Y)}}catch(Y){console.error(`RestAPI::PushStream::NotifSocket::UserFeeds::Error - Error handling event: ${Y}, Data: ${JSON.stringify(F)}`)}}),this.pushNotificationSocket.off(s.EVENTS.USER_SPAM_FEEDS),this.pushNotificationSocket.on(s.EVENTS.USER_SPAM_FEEDS,F=>{try{const z=i.DataModifier.mapToNotificationEvent(F,s.NotificationEventType.SPAM,this.account===F.sender?"self":"other",this.raw);z.origin=this.account===z.from?"self":"other",this.shouldEmitChannel(z.from)&&N(s.STREAM.NOTIF)&&this.emit(s.STREAM.NOTIF,z)}catch(z){console.error("Error handling USER_SPAM_FEEDS event:",z,"Data:",F)}})),this.disconnected=!1})})})}connected(){return console.log(`RestAPI::PushStream::connected::Notification Socket Connected: ${this.notifSocketConnected}`),console.log(`RestAPI::PushStream::connected::Chat Socket Connected: ${this.chatSocketConnected}`),this.notifSocketConnected||this.chatSocketConnected}disconnect(){return e.__awaiter(this,void 0,void 0,function*(){this.pushChatSocket&&this.chatSocketConnected&&(this.pushChatSocket.disconnect(),console.log("RestAPI::PushStream::disconnect::Push chat socket disconnected.")),this.pushNotificationSocket&&this.notifSocketConnected&&(this.pushNotificationSocket.disconnect(),console.log("RestAPI::PushStream::disconnect::Push notification socket disconnected."))})}info(){return{options:this.options,listen:this.listen}}shouldEmitChat(d){var h;return!(!((h=this.options.filter)===null||h===void 0)&&h.chats)||this.options.filter.chats.length===0||this.options.filter.chats.includes("*")?!0:this.options.filter.chats.includes(d)}shouldEmitSpace(d){var h;return!(!((h=this.options.filter)===null||h===void 0)&&h.spaces)||this.options.filter.spaces.length===0||this.options.filter.spaces.includes("*")?!0:this.options.filter.spaces.includes(d)}shouldEmitChannel(d){var h;return!(!((h=this.options.filter)===null||h===void 0)&&h.channels)||this.options.filter.channels.length===0||this.options.filter.channels.includes("*")?!0:this.options.filter.channels.includes(d)}shouldEmitVideo(d){var h;return!(!((h=this.options.filter)===null||h===void 0)&&h.video)||this.options.filter.video.length===0||this.options.filter.video.includes("*")?!0:this.options.filter.video.includes(d)}};return Tu.PushStream=u,Tu}var qu={},ju={},ha={};const XG=gf(GL);var b7;function hl(){if(b7)return ha;b7=1,Object.defineProperty(ha,"__esModule",{value:!0}),ha.PushNotificationBaseClass=ha.FEED_MAP=void 0;const e=He,t=Ze(),r=un(),n=Dt(),s=qr(),i=XG,o=Ra(),a=Oo(),f=nt(),c=Tt(),l=Lo(),u=Ra(),p="Account is required",d="*",h=125,y=1,m="-",v="+",b=3,w=2,_=1,C="1",I="1";ha.FEED_MAP={INBOX:!1,SPAM:!0};class k{constructor(S,T,P,g){this.signer=S,this.env=T,this.guestMode=!!(P&&S),this.account=P,this.pgpPrivateKey=g,this.initializeCoreContract({signer:this.signer,env:this.env})}initializeCoreContract(S){return e.__awaiter(this,void 0,void 0,function*(){const{env:T=t.ENV.STAGING,signer:P=null}=S||{};let g;if(P)if(yield(0,n.getAccountAddress)({account:null,signer:P}),new f.Signer(P).isViemSigner(P)){const x=(0,o.createPublicClient)({chain:r.TOKEN_VIEM_NETWORK_MAP[T],transport:(0,o.http)()});g=(0,o.getContract)({abi:r.ABIS.CORE,address:r.CORE_CONFIG[T].EPNS_CORE_CONTRACT,client:{public:x}})}else g=new i.ethers.Contract(r.CORE_CONFIG[T].EPNS_CORE_CONTRACT,r.ABIS.CORE,P);this.coreContract=g})}checkUserAddressExists(S){if(!S&&!this.account&&!this.guestMode)throw new Error(p);return!0}checkSignerObjectExists(){if(!this.signer)throw new Error(l.PushAPI.ensureSignerMessage());return!0}getNotificationType(S,T){return S.length==1?S[0]==d?{recipient:T,type:s.NOTIFICATION_TYPE.BROADCAST}:{recipient:S[0],type:s.NOTIFICATION_TYPE.TARGETTED}:{recipient:S,type:s.NOTIFICATION_TYPE.SUBSET}}generateNotificationLowLevelPayload({signer:S,env:T,recipients:P,options:g,channel:A,channelInfo:x}){var D,O,B,L,M,R,N,F,z,Y,j,re,V,U,X,ye,_e,Ae;A||(A=`${this.account}`);const H=this.getNotificationType(P,A),q=s.IDENTITY_TYPE.DIRECT_PAYLOAD;let W="";const ee=x&&x.channel_settings?JSON.parse(x.channel_settings):null,le=!!x;return!((D=g.payload)===null||D===void 0)&&D.category&&ee&&(ee[g.payload.category-1].type==w&&(W=g.payload.category+m+w+m+ee[g.payload.category-1].default),ee[g.payload.category-1].type==_&&(W=g.payload.category+m+_),ee[g.payload.category-1].type==b&&(W=g.payload.category+m+b+m+ee[g.payload.category-1].default.lower)),{signer:S,channel:A,type:H.type,identityType:q,notification:g.notification,payload:{title:(B=(O=g.payload)===null||O===void 0?void 0:O.title)!==null&&B!==void 0?B:g.notification.title,body:(M=(L=g.payload)===null||L===void 0?void 0:L.body)!==null&&M!==void 0?M:g.notification.body,cta:(N=(R=g.payload)===null||R===void 0?void 0:R.cta)!==null&&N!==void 0?N:"",img:(z=(F=g.payload)===null||F===void 0?void 0:F.embed)!==null&&z!==void 0?z:"",hidden:(Y=g.config)===null||Y===void 0?void 0:Y.hidden,etime:(j=g.config)===null||j===void 0?void 0:j.expiry,silent:(re=g.config)===null||re===void 0?void 0:re.silent,additionalMeta:(V=g.payload)===null||V===void 0?void 0:V.meta,index:!((U=g.payload)===null||U===void 0)&&U.category?W:""},recipients:H.recipient,graph:(X=g.advanced)===null||X===void 0?void 0:X.graph,ipfsHash:(ye=g.advanced)===null||ye===void 0?void 0:ye.ipfs,env:T,chatId:(_e=g.advanced)===null||_e===void 0?void 0:_e.chatid,pgpPrivateKey:(Ae=g.advanced)===null||Ae===void 0?void 0:Ae.pgpPrivateKey,channelFound:le}}isEmpty(S){return S.trim().length==0}isValidLength(S,T=h,P=y){return S.length>=P&&S.length<=T}isValidUrl(S){return!!new RegExp("^((?:https|http):\\/\\/)((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(S)}verifyEmptyChannelParameters(S){if(this.isEmpty(S.name))throw new Error("Channel name cannot be empty");if(this.isEmpty(S.description))throw new Error("Channel description cannot be empty");if(this.isEmpty(S.icon))throw new Error("Channel icon cannot be empty");if(this.isEmpty(S.url))throw new Error("Channel url cannot ne empty");return!0}validateParameterLength(S){if(this.isValidLength(S.name))if(this.isValidLength(S.description)){if(!this.isValidLength(S.url)||!this.isValidUrl(S.url))throw new Error(`Channel url either excees ${h} characters or is not a valid url`);return!0}else throw new Error(`Channel description should not exceed ${h} characters`);else throw new Error(`Channel name should not exceed ${h} characters`)}validateChannelParameters(S){return this.verifyEmptyChannelParameters(S)&&this.validateParameterLength(S)}createContractInstance(S,T,P){if(!this.signer)throw new Error("Signer is not provided");let g;const A=this.signer?new f.Signer(this.signer):null;if(A!=null&&A.isViemSigner(this.signer)){const x=(0,o.createPublicClient)({chain:P,transport:(0,o.http)()});g=(0,o.getContract)({abi:T,address:S,client:{public:x}})}else g=new i.ethers.Contract(S,T,this.signer);return g}fetchBalance(S,T){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error("Signer is not provided");let P;const g=new f.Signer(this.signer);try{return g.isViemSigner(this.signer)?P=BigInt(yield S.read.balanceOf({args:[T]})):P=BigInt(yield S.balanceOf(T)),P}catch(A){throw new Error(JSON.stringify(A))}})}fetchAllownace(S,T,P){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error("Signer is not provided");const g=new f.Signer(this.signer);let A;try{return g.isViemSigner(this.signer)?A=BigInt(yield S.read.allowance({args:[T,P]})):A=BigInt(yield S.allowance(T,P)),A}catch(x){throw new Error(JSON.stringify(x))}})}fetchUpdateCounter(S,T){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error("Signer is not provided");let P;const g=new f.Signer(this.signer);try{return g.isViemSigner(this.signer)?P=BigInt(yield S.read.channelUpdateCounter({args:[T]})):P=BigInt(yield S.channelUpdateCounter(T)),P+BigInt(1)}catch(A){throw new Error(JSON.stringify(A))}})}approveToken(S,T,P){var g,A;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");if(new f.Signer(this.signer).isViemSigner(this.signer)){if(!S.write)throw new Error("viem signer is not provided");const O=yield S.write.approve({args:[T,P]})}else{if(!this.signer||!this.signer.provider)throw new Error("ethers provider/signer is not provided");const O=yield S.approve(T,P);yield(A=(g=this.signer)===null||g===void 0?void 0:g.provider)===null||A===void 0?void 0:A.waitForTransaction(O.hash)}return!0}catch(x){return console.error(x),!1}})}createChannel(S,T,P,g){var A,x;return e.__awaiter(this,void 0,void 0,function*(){let D;try{if(!this.signer)throw new Error("Signer is not provided");if(new f.Signer(this.signer).isViemSigner(this.signer)){if(!S.write)throw new Error("viem signer is not provided");D=yield S.write.createChannelWithPUSH({args:[T,(0,o.toHex)(new Uint8Array(P)),g,this.getTimeBound()]})}else{const L=yield S.createChannelWithPUSH(T,P,g,this.getTimeBound(),{gasLimit:1e6}),M=yield(x=(A=this.signer)===null||A===void 0?void 0:A.provider)===null||x===void 0?void 0:x.waitForTransaction(L.hash);if((M==null?void 0:M.status)==0)throw new Error("Something Went wrong while creating your channel");D=L.hash}return D}catch(O){throw new Error(O==null?void 0:O.message)}})}updateChannel(S,T,P,g){var A,x;return e.__awaiter(this,void 0,void 0,function*(){let D;try{if(!this.signer)throw new Error("Signer is not provided");if(new f.Signer(this.signer).isViemSigner(this.signer)){if(!S.write)throw new Error("viem signer is not provided");D=yield S.write.updateChannelMeta({args:[T,(0,o.toHex)(new Uint8Array(P)),g]})}else{const L=yield S.updateChannelMeta(T,P,g,{gasLimit:1e6}),M=yield(x=(A=this.signer)===null||A===void 0?void 0:A.provider)===null||x===void 0?void 0:x.waitForTransaction(L.hash);if((M==null?void 0:M.status)==0)throw new Error("Something Went wrong while updating your channel");D=L.hash}return D}catch(O){throw new Error(O==null?void 0:O.message)}})}verifyChannel(S,T){var P,g;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");const A=new f.Signer(this.signer);let x;if(A.isViemSigner(this.signer)){if(!S.write)throw new Error("viem signer is not provided");x=yield S.write.verify({args:[T]})}else{if(!this.signer.provider)throw new Error("ethers provider is not provided");const O=yield S.verify(T);yield(g=(P=this.signer)===null||P===void 0?void 0:P.provider)===null||g===void 0?void 0:g.waitForTransaction(O.hash),x=O.hash}return x}catch(A){throw new Error(A.message)}})}createChanelSettings(S,T,P,g,A){var x,D;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");const O=new f.Signer(this.signer);let B;if(O.isViemSigner(this.signer)){if(!S.write)throw new Error("viem signer is not provided");B=yield S.write.createChannelSettings({args:[T,P,g,A]})}else{if(!this.signer.provider)throw new Error("ethers provider is not provided");const M=yield S.createChannelSettings(T,P,g,A);yield(D=(x=this.signer)===null||x===void 0?void 0:x.provider)===null||D===void 0?void 0:D.waitForTransaction(M.hash),B=M.hash}return B}catch(O){throw new Error(O.message)}})}addDelegator(S,T){var P,g;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");const A=new f.Signer(this.signer);let x;if(A.isViemSigner(this.signer)){if(!S.write)throw new Error("viem signer is not provided");x=yield S.write.addDelegate({args:[T]})}else{if(!this.signer.provider)throw new Error("ethers provider is not provided");const O=yield S.addDelegate(T);yield(g=(P=this.signer)===null||P===void 0?void 0:P.provider)===null||g===void 0?void 0:g.waitForTransaction(O.hash),x=O.hash}return x}catch(A){throw new Error(A.message)}})}removeDelegator(S,T){var P,g;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");const A=new f.Signer(this.signer);let x;if(A.isViemSigner(this.signer)){if(!S.write)throw new Error("viem signer is not provided");x=yield S.write.removeDelegate({args:[T]})}else{if(!this.signer.provider)throw new Error("ethers provider is not provided");const O=yield S.removeDelegate(T);yield(g=(P=this.signer)===null||P===void 0?void 0:P.provider)===null||g===void 0?void 0:g.waitForTransaction(O.hash),x=O.hash}return x}catch(A){throw new Error(A.message)}})}getChainId(S){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error("Signer is not provided");return new f.Signer(this.signer).getChainId()})}uploadToIPFSViaPushNode(S){return e.__awaiter(this,void 0,void 0,function*(){try{return(yield(0,c.axiosPost)(`${r.CORE_CONFIG[this.env].API_BASE_URL}/v1/ipfs/upload`,{data:S})).data.cid}catch{throw new Error("Something went wrong while uploading data to IPFS")}})}getTimeBound(S){return 0}getMinimalSetting(S){var T,P;let g="",A="";for(let x=0;x<S.length;x++){const D=S[x];if(D.type==_&&(g=g+v+_+m+D.default),D.type==w&&D.data){const O=D.data&&D.data.enabled!=null?Number(D.data.enabled).toString():C,B=(T=D.data.ticker)!==null&&T!==void 0?T:I;g=g+v+w+m+O+m+D.default+m+D.data.lower+m+D.data.upper+m+B}if(D.type==b&&D.default&&typeof D.default=="object"&&D.data){const O=D.data&&D.data.enabled!=null?Number(D.data.enabled).toString():C,B=(P=D.data.ticker)!==null&&P!==void 0?P:I;g=g+v+b+m+O+m+D.default.lower+m+D.default.upper+m+D.data.lower+m+D.data.upper+m+B}A=A+v+D.description}return{setting:g.replace(/^\+/,""),description:A.replace(/^\+/,"")}}getMinimalUserSetting(S){var T,P;if(!S)return null;let g="",A=0;for(let x=0;x<S.length;x++){const D=S[x],O=D.enabled?1:0;D.enabled&&A++,Object.keys(D).includes("value")?typeof D.value=="number"?g=g+w+m+O+m+D.value:g=g+b+m+O+m+((T=D.value)===null||T===void 0?void 0:T.lower)+m+((P=D.value)===null||P===void 0?void 0:P.upper):g=g+_+m+O,x!=S.length-1&&(g=g+v)}return A+v+g}getChannelOrAliasInfo(S){return e.__awaiter(this,void 0,void 0,function*(){try{const T=(0,f.validateCAIP)(S)?S:(0,f.getFallbackETHCAIPAddress)(this.env,this.account),{networkId:P}=(0,f.getCAIPDetails)(T);let g=T;if(P!=="1"&&P!=="11155111"){const x=yield this.getAliasInfo(S);g=(x==null?void 0:x.channel)||g}return(yield a.getChannel({channel:g,env:this.env}))||null}catch{return null}})}initiateAddAlias(S,T){var P,g;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");const A=new f.Signer(this.signer);let x;if(A.isViemSigner(this.signer)){if(!S.write)throw new Error("viem signer is not provided");x=yield S.write.verifyChannelAlias({args:[T]})}else{if(!this.signer.provider)throw new Error("ethers provider is not provided");const O=yield S.verifyChannelAlias(T);yield(g=(P=this.signer)===null||P===void 0?void 0:P.provider)===null||g===void 0?void 0:g.waitForTransaction(O.hash),x=O.hash}return x}catch(A){throw new Error(A.message)}})}verifyAlias(S,T){var P,g;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");const A=new f.Signer(this.signer);let x;if(A.isViemSigner(this.signer)){if(!S.write)throw new Error("viem signer is not provided");x=yield S.write.verifyChannelAlias({args:[T]})}else{if(!this.signer.provider)throw new Error("ethers provider is not provided");const R=yield S.verifyChannelAlias(T);yield(g=(P=this.signer)===null||P===void 0?void 0:P.provider)===null||g===void 0?void 0:g.waitForTransaction(R.hash),x=R.hash}const D=yield A.getChainId(),O=yield A.getAddress(),B=`eip155:${D}:${O}`,L=yield this.getChannelOrAliasInfo(B);return{verifyAliasRes:x,channelInfo:L}}catch(A){throw new Error(A.message)}})}getAliasInfo(S){return e.__awaiter(this,void 0,void 0,function*(){const g=`${`${(0,f.getAPIBaseUrls)(this.env)}/v1/alias`}/${S}/channel`;try{return(yield(0,c.axiosGet)(g)).data}catch{return null}})}getAddressFromCaip(S){return S==null?void 0:S.split(":")[(S==null?void 0:S.split(":").length)-1]}isValidPCaip(S){const T=S.split(":");return T.length==2&&T[0]=="eip155"&&u.isAddress(T[1])}}return ha.PushNotificationBaseClass=k,ha}var _7;function QG(){if(_7)return ju;_7=1,Object.defineProperty(ju,"__esModule",{value:!0}),ju.Alias=void 0;const e=He,t=un(),r=t,n=yA(),s=hl();class i extends s.PushNotificationBaseClass{constructor(a,f,c){super(a,f,c),this.info=l=>e.__awaiter(this,void 0,void 0,function*(){try{return yield n.getAliasInfo(Object.assign(Object.assign({},l),{env:this.env}))}catch(u){throw new Error(`Push SDK Error: API : alias::info : ${u}`)}}),this.initiate=(l,u)=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const d=`eip155:${yield this.getChainId(this.signer)}`;if(!t.default[this.env][d]||!r.VIEM_CONFIG[this.env][d])throw new Error("Unsupported Chainid");const h=t.default[this.env][d].EPNS_COMMUNICATOR_CONTRACT,y=this.createContractInstance(h,r.ABIS.COMM,r.VIEM_CONFIG[this.env][d].NETWORK),m=yield this.initiateAddAlias(y,l);let v={tx:m};return u!=null&&u.raw&&(v=Object.assign(Object.assign({},v),{raw:{initiateVerificationProof:m}})),v}catch(p){throw new Error(`Push SDK Error: Contract : alias::add : ${p}`)}}),this.verify=(l,u)=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const d=`eip155:${yield this.getChainId(this.signer)}`;if(!t.default[this.env][d]||!r.VIEM_CONFIG[this.env][d])throw new Error("Unsupported Chainid");const h=t.default[this.env][d].EPNS_COMMUNICATOR_CONTRACT,y=this.createContractInstance(h,r.ABIS.COMM,r.VIEM_CONFIG[this.env][d].NETWORK),{verifyAliasRes:m,channelInfo:v}=yield this.verifyAlias(y,l);let b={tx:m};return u!=null&&u.raw&&(b=Object.assign(Object.assign({},b),{raw:{initiateVerificationProof:v.initiate_verification_proof,verifyVerificationProof:m}})),b}catch(p){throw new Error(`Push SDK Error: Contract : alias::verify : ${p}`)}})}}return ju.Alias=i,ju}var $u={},w7;function ez(){if(w7)return $u;w7=1,Object.defineProperty($u,"__esModule",{value:!0}),$u.Delegate=void 0;const e=He,t=un(),r=t,n=Oo(),s=nt(),i=hl();class o extends i.PushNotificationBaseClass{constructor(f,c,l){super(f,c,l),this.get=u=>e.__awaiter(this,void 0,void 0,function*(){try{let p=u!=null&&u.channel?u.channel:this.account?(0,s.getFallbackETHCAIPAddress)(this.env,this.account):null;return this.checkUserAddressExists(p),p=(0,s.validateCAIP)(p)?p:(0,s.getFallbackETHCAIPAddress)(this.env,p),this.checkUserAddressExists(p),yield n.getDelegates({channel:p,env:this.env})}catch(p){throw new Error(`Push SDK Error: API : delegate::get : ${p}`)}}),this.add=u=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists(),(0,s.validateCAIP)(u)&&(u=this.getAddressFromCaip(u));const d=`eip155:${yield this.getChainId(this.signer)}`;if(!t.default[this.env][d]||!r.VIEM_CONFIG[this.env][d])throw new Error("Unsupported Chainid");const h=t.default[this.env][d].EPNS_COMMUNICATOR_CONTRACT,y=this.createContractInstance(h,r.ABIS.COMM,r.VIEM_CONFIG[this.env][d].NETWORK);return{transactionHash:yield this.addDelegator(y,u)}}catch(p){throw new Error(`Push SDK Error: Contract : delegate::add : ${p}`)}}),this.remove=u=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists(),(0,s.validateCAIP)(u)&&(u=this.getAddressFromCaip(u));const d=`eip155:${yield this.getChainId(this.signer)}`;if(!t.default[this.env][d]||!r.VIEM_CONFIG[this.env][d])throw new Error("Unsupported Chainid");const h=t.default[this.env][d].EPNS_COMMUNICATOR_CONTRACT,y=this.createContractInstance(h,r.ABIS.COMM,r.VIEM_CONFIG[this.env][d].NETWORK);return{transactionHash:yield this.removeDelegator(y,u)}}catch(p){throw new Error(`Push SDK Error: Contract : delegate::remove : ${p}`)}})}}return $u.Delegate=o,$u}var Hu={},E7;function tz(){if(E7)return Hu;E7=1,Object.defineProperty(Hu,"__esModule",{value:!0}),Hu.Tags=void 0;const e=He,t=Ze(),r=Oo(),n=hl(),s=dl();class i extends n.PushNotificationBaseClass{constructor(a,f,c,l){super(f,c,l),this.get=u=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const p=yield this.channel.info();return yield r.getTags({channel:p,env:this.env})}catch(p){throw new Error(`Push SDK Error: API : tags::get : ${p}`)}}),this.add=u=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const p=yield this.channel.info(),d=yield this.channel.update({name:p.name,description:p.info,url:p.url,icon:p.icon,tags:u});return{tags:u}}catch(p){throw new Error(`Push SDK Error: Contract : tags::add : ${p}`)}}),this.update=u=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const p=yield this.channel.info();return yield this.channel.update({name:p.name,description:p.info,url:p.url,icon:p.icon,tags:u}),{tags:u}}catch(p){throw new Error(`Push SDK Error: Contract : tags::update : ${p}`)}}),this.remove=()=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const u=yield this.channel.info();return yield this.channel.update({name:u.name,description:u.info,url:u.url,icon:u.icon,tags:[]}),{status:"success"}}catch(u){throw new Error(`Push SDK Error: Contract : tags::remove : ${u}`)}}),this.search=(u,p)=>e.__awaiter(this,void 0,void 0,function*(){try{const{page:d=t.default.PAGINATION.INITIAL_PAGE,limit:h=t.default.PAGINATION.LIMIT}=p||{};return yield r.searchTags({query:u,page:d,limit:h,env:this.env})}catch(d){throw new Error(`Push SDK Error: API : channel::tags::search : ${d}`)}}),this.list=u=>e.__awaiter(this,void 0,void 0,function*(){try{const{page:p=t.default.PAGINATION.INITIAL_PAGE,limit:d=t.default.PAGINATION.LIMIT,order:h=s.default.FILTER.CHANNEL_LIST.ORDER.DESCENDING,filter:y=s.default.FILTER.TAGS.PUSH}=u||{};return yield r.getAllTags({page:p,limit:d,order:h,filter:y,env:this.env})}catch(p){throw new Error(`Push SDK Error: API : channel::tags::list : ${p}`)}}),this.channel=a}}return Hu.Tags=i,Hu}var A7;function rz(){if(A7)return qu;A7=1,Object.defineProperty(qu,"__esModule",{value:!0}),qu.Channel=void 0;const e=He,t=Ze(),r=Ra(),n=Oo(),s=un(),i=nt(),o=Xf(),a=Ha(),f=Wf(),c=QG(),l=ez(),u=tz(),p=hl();class d extends p.PushNotificationBaseClass{constructor(y,m,v,b){super(y,m,v,b),this.info=(w,_)=>e.__awaiter(this,void 0,void 0,function*(){try{const{raw:C=!0}=_||{};return this.checkUserAddressExists(w),w=w??(0,i.getFallbackETHCAIPAddress)(this.env,this.account),yield n.getChannel({channel:w,env:this.env,raw:C})}catch(C){throw new Error(`Push SDK Error: API : channel::info : ${C}`)}}),this.search=(w,_)=>e.__awaiter(this,void 0,void 0,function*(){try{const{page:C=t.default.PAGINATION.INITIAL_PAGE,limit:I=t.default.PAGINATION.LIMIT,filter:k,tag:E,user_subscribed:S,oldFormat:T=!0}=_||{};return yield n.search({query:w,page:C,limit:I,filter:k,tag:E,user_subscribed:S,env:this.env,oldFormat:T})}catch(C){throw new Error(`Push SDK Error: API : channel::search : ${C}`)}}),this.subscribers=w=>e.__awaiter(this,void 0,void 0,function*(){var _,C;try{let I=w!=null&&w.channel?w.channel:this.account?(0,i.getFallbackETHCAIPAddress)(this.env,this.account):null;return this.checkUserAddressExists(I),I=(0,i.validateCAIP)(I)?I:(0,i.getFallbackETHCAIPAddress)(this.env,I),w&&w.page?yield n.getSubscribers({channel:I,env:this.env,page:w.page,limit:(_=w.limit)!==null&&_!==void 0?_:10,setting:(C=w.setting)!==null&&C!==void 0?C:!1,category:w.category,raw:w.raw}):yield n._getSubscribers({channel:I,env:this.env})}catch(I){throw new Error(`Push SDK Error: API : channel::subscribers : ${I}`)}}),this.send=(w,_)=>e.__awaiter(this,void 0,void 0,function*(){var C,I,k;try{this.checkSignerObjectExists();const E=yield this.getChannelOrAliasInfo((C=_.channel)!==null&&C!==void 0?C:this.account);_.advanced=_.advanced||{},_.advanced.pgpPrivateKey=(I=_.advanced.pgpPrivateKey)!==null&&I!==void 0?I:this.pgpPrivateKey;const S=this.generateNotificationLowLevelPayload({signer:this.signer,env:this.env,recipients:w,options:_,channel:(k=_.channel)!==null&&k!==void 0?k:this.account,channelInfo:E});return yield o.sendNotification(S)}catch(E){throw new Error(`Push SDK Error: API : channel::send : ${E}`)}}),this.create=w=>e.__awaiter(this,void 0,void 0,function*(){const{name:_,description:C,url:I,icon:k,alias:E=null,progressHook:S}=w||{};let T=w.tags;try{let P;this.validateChannelParameters(w);const g=yield this.createContractInstance(s.TOKEN[this.env],s.ABIS.TOKEN,s.TOKEN_VIEM_NETWORK_MAP[this.env]),A=yield this.fetchBalance(g,this.account),x=r.parseUnits(s.MIN_TOKEN_BALANCE[this.env].toString(),18);if(x>A)throw new Error("Insufficient PUSH balance");if(E){if(!(0,i.validateCAIP)(E))throw new Error("Invalid alias CAIP");const z=(0,i.getCAIPDetails)(E);P={[`${z==null?void 0:z.blockchain}:${z==null?void 0:z.networkId}`]:z==null?void 0:z.address}}if(T&&T.length>5&&(T=T.slice(0,5)),(T&&T.length>0?T.join(""):"").length>512)throw new Error("Tags length should not exceed 512 characters");S==null||S(a.default["PUSH-CREATE-01"]);const O={name:_,info:C,url:I,icon:k,aliasDetails:P??{},tags:T},B=yield this.uploadToIPFSViaPushNode(JSON.stringify(O));if(!((yield this.fetchAllownace(g,this.account,s.CORE_CONFIG[this.env].EPNS_CORE_CONTRACT))>=x)&&(S==null||S(a.default["PUSH-CREATE-02"]),!(yield this.approveToken(g,s.CORE_CONFIG[this.env].EPNS_CORE_CONTRACT,x))))throw new Error("Something went wrong while approving the token");const M=s.CHANNEL_TYPE.GENERAL,R="1+"+B,N=r.stringToBytes(R);S==null||S(a.default["PUSH-CREATE-03"]);const F=yield this.createChannel(this.coreContract,M,N,x);return S==null||S(a.default["PUSH-CREATE-04"]),{transactionHash:F}}catch(P){const g=a.default["PUSH-ERROR-02"];throw S==null||S(g("Create Channel",P)),new Error(`Push SDK Error: Contract : createChannelWithPUSH : ${P}`)}}),this.update=w=>e.__awaiter(this,void 0,void 0,function*(){const{name:_,description:C,url:I,icon:k,alias:E=null,progressHook:S}=w||{};let T=w.tags;try{let P;this.validateChannelParameters(w);const g=yield this.createContractInstance(s.TOKEN[this.env],s.ABIS.TOKEN,s.TOKEN_VIEM_NETWORK_MAP[this.env]),A=yield this.fetchBalance(g,this.account),x=yield this.fetchUpdateCounter(this.coreContract,this.account),O=r.parseUnits(s.MIN_TOKEN_BALANCE[this.env].toString(),18)*x;if(O>A)throw new Error("Insufficient PUSH balance");if(E){if(!(0,i.validateCAIP)(E))throw new Error("Invalid alias CAIP");const Y=(0,i.getCAIPDetails)(E);P={[`${Y==null?void 0:Y.blockchain}:${Y==null?void 0:Y.networkId}`]:Y==null?void 0:Y.address}}T&&T.length>5&&(T=T.slice(0,5));const B=T&&T.length>0?T.join(""):"";S==null||S(a.default["PUSH-UPDATE-01"]);const L={name:_,info:C,url:I,icon:k,aliasDetails:P??{},tags:T},M=yield this.uploadToIPFSViaPushNode(JSON.stringify(L));if(!((yield this.fetchAllownace(g,this.account,s.CORE_CONFIG[this.env].EPNS_CORE_CONTRACT))>=O)&&(S==null||S(a.default["PUSH-UPDATE-02"]),!(yield this.approveToken(g,s.CORE_CONFIG[this.env].EPNS_CORE_CONTRACT,O))))throw new Error("Something went wrong while approving the token");const N="1+"+M,F=r.stringToBytes(N);S==null||S(a.default["PUSH-UPDATE-03"]);const z=yield this.updateChannel(this.coreContract,this.account,F,O);return S==null||S(a.default["PUSH-UPDATE-04"]),{transactionHash:z}}catch(P){const g=a.default["PUSH-ERROR-02"];throw S==null||S(g("Update Channel",P)),new Error(`Push SDK Error: Contract channel::update : ${P}`)}}),this.verify=w=>e.__awaiter(this,void 0,void 0,function*(){try{if(this.checkSignerObjectExists(),(0,i.validateCAIP)(w)&&(w=w.split(":")[2]),!r.isAddress(w))throw new Error("Invalid channel address");const _=yield this.info(this.account);if((_==null?void 0:_.verified_status)==0)throw new Error("Only verified channel can verify other channel");const C=yield this.verifyChannel(this.coreContract,w);if(!C)throw new Error("Something went wrong while verifying the channel");return{transactionHash:C}}catch(_){throw new Error(`Push SDK Error: Contract channel::verify : ${_}`)}}),this.setting=w=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const _=yield this.createContractInstance(s.TOKEN[this.env],s.ABIS.TOKEN,s.TOKEN_VIEM_NETWORK_MAP[this.env]),C=yield this.fetchBalance(_,this.account),I=r.parseUnits(s.MIN_TOKEN_BALANCE[this.env].toString(),18),k=yield this.fetchUpdateCounter(this.coreContract,this.account),E=I*k;if(E>C)throw new Error("Insufficient PUSH balance");if(!((yield this.fetchAllownace(_,this.account,s.CORE_CONFIG[this.env].EPNS_CORE_CONTRACT))>=E)&&!(yield this.approveToken(_,s.CORE_CONFIG[this.env].EPNS_CORE_CONTRACT,E)))throw new Error("Something went wrong while approving your token");const{setting:T,description:P}=this.getMinimalSetting(w);return{transactionHash:yield this.createChanelSettings(this.coreContract,w.length,T,P,I)}}catch(_){throw new Error(`Push SDK Error: Contract : channel::setting : ${_}`)}}),this.notifications=(w,_)=>e.__awaiter(this,void 0,void 0,function*(){try{const{page:C,limit:I,filter:k=null,raw:E=!0}=_||{};return yield n.getChannelNotifications({channel:w,env:this.env,filter:k,raw:E,page:C,limit:I})}catch(C){throw new Error(`Push SDK Error: Contract : channel::notifications : ${C}`)}}),this.list=w=>e.__awaiter(this,void 0,void 0,function*(){try{const{page:_,limit:C,sort:I=f.ChannelListSortType.SUBSCRIBER,order:k=f.ChannelListOrderType.DESCENDING,filter:E,tag:S,user_subscribed:T}=w||{};return yield n.getChannels({env:this.env,page:_,limit:C,sort:I,order:k,filter:E,tag:S,user_subscribed:T})}catch(_){throw new Error(`Push SDK Error: Contract : channel::list : ${_}`)}}),this.delegate=new l.Delegate(y,m,v),this.alias=new c.Alias(y,m,v),this.tags=new u.Tags(this,y,m,v)}}return qu.Channel=d,qu}var ny={},S7;function nz(){return S7||(S7=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Notification=e.FEED_MAP=void 0;const t=He,r=Ze(),n=Wf(),s=Mn(),i=Oo(),o=nt(),a=hl(),f="Channel is needed";e.FEED_MAP={INBOX:!1,SPAM:!0};class c extends a.PushNotificationBaseClass{constructor(u,p,d,h){super(u,p,d,h),this.list=(y=n.FeedType.INBOX,m)=>t.__awaiter(this,void 0,void 0,function*(){const{page:v=r.default.PAGINATION.INITIAL_PAGE,limit:b=r.default.PAGINATION.LIMIT,channels:w=[],raw:_=!1}=m||{};try{let C;m!=null&&m.account?this.isValidPCaip(m.account)?C=(0,o.pCAIP10ToWallet)(m.account):C=m.account:this.account&&(C=(0,o.getFallbackETHCAIPAddress)(this.env,this.account)),this.checkUserAddressExists(C);const I=this.getAddressFromCaip(C);if(w.length==0)return yield s.getFeeds({user:I,page:v,limit:b,spam:e.FEED_MAP[y],raw:_,env:this.env});{const k=w.map(T=>t.__awaiter(this,void 0,void 0,function*(){return yield s.getFeedsPerChannel({user:I,page:v,limit:b,spam:e.FEED_MAP[y],raw:_,env:this.env,channels:[T]})}));return(yield Promise.all(k)).flat()}}catch(C){throw new Error(`Push SDK Error: API : notifcaiton::list : ${C}`)}}),this.subscriptions=y=>t.__awaiter(this,void 0,void 0,function*(){try{const{page:m=r.default.PAGINATION.INITIAL_PAGE,limit:v=r.default.PAGINATION.LIMIT,channel:b=null,raw:w}=y||{};let _;return y!=null&&y.account?this.isValidPCaip(y.account)?_=(0,o.pCAIP10ToWallet)(y.account):_=y.account:this.account&&(_=(0,o.getFallbackETHCAIPAddress)(this.env,this.account)),this.checkUserAddressExists(_),yield s.getSubscriptions({user:_,env:this.env,channel:b,raw:w})}catch(m){throw new Error(`Push SDK Error: API : notifcaiton::subscriptions : ${m}`)}}),this.subscribe=(y,m)=>t.__awaiter(this,void 0,void 0,function*(){try{const{onSuccess:v,onError:b,settings:w}=m||{};if(this.checkSignerObjectExists(),this.checkUserAddressExists(),!y&&y!="")throw new Error(f);this.isValidPCaip(y)&&(y=(0,o.pCAIP10ToWallet)(y)),(0,o.validateCAIP)(y)||(y=(0,o.getFallbackETHCAIPAddress)(this.env,y));const _=(0,o.getCAIPDetails)(y),C=(0,o.getCAIPWithChainId)(this.account,parseInt(_==null?void 0:_.networkId)),I=this.getMinimalUserSetting(w);return yield i.subscribeV2({signer:this.signer,channelAddress:y,userAddress:C,env:this.env,settings:I??"",onSuccess:v,onError:b,pgpPrivateKey:this.pgpPrivateKey})}catch(v){throw new Error(`Push SDK Error: API : notifcaiton::subscribe : ${v}`)}}),this.unsubscribe=(y,m)=>t.__awaiter(this,void 0,void 0,function*(){try{const{onSuccess:v,onError:b}=m||{};if(this.checkUserAddressExists(),this.checkSignerObjectExists(),!y&&y!="")return new Error(f);this.isValidPCaip(y)&&(y=(0,o.pCAIP10ToWallet)(y)),(0,o.validateCAIP)(y)||(y=(0,o.getFallbackETHCAIPAddress)(this.env,y));const w=(0,o.getCAIPDetails)(y),_=(0,o.getCAIPWithChainId)(this.account,parseInt(w==null?void 0:w.networkId));return yield i.unsubscribeV2({signer:this.signer,channelAddress:y,userAddress:_,env:this.env,onSuccess:v,onError:b,pgpPrivateKey:this.pgpPrivateKey})}catch(v){throw new Error(`Push SDK Error: API : notifcaiton::unsubscribe : ${v}`)}})}}e.Notification=c}(ny)),ny}var Vu={},Gu={},P7;function iz(){if(P7)return Gu;P7=1,Object.defineProperty(Gu,"__esModule",{value:!0}),Gu.SpaceV2=void 0;const e=He,t=qr();let r=class{constructor({spaceV1Instance:s,spaceInfo:i}){this.spaceV1Instance=s,this.spaceInfo=i}start(){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.start()})}join(){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.join()})}update(s){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.update(s)})}leave(){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.leave()})}stop(){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.stop()})}requestForMic(){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.requestToBePromoted({role:t.SPACE_INVITE_ROLES.SPEAKER,promotorAddress:this.spaceInfo.spaceCreator})})}acceptMicRequest({address:s,signal:i}){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.acceptPromotionRequest({promoteeAddress:s,spaceId:this.spaceInfo.spaceId,role:t.SPACE_INVITE_ROLES.SPEAKER,signalData:i})})}rejectMicRequest({address:s}){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.rejectPromotionRequest({promoteeAddress:s})})}inviteToPromote({address:s}){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.inviteToPromote({inviteeAddress:s,role:t.SPACE_INVITE_ROLES.SPEAKER})})}acceptPromotionInvite({signal:s}){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.acceptPromotionInvite({invitorAddress:this.spaceInfo.spaceCreator,spaceId:this.spaceInfo.spaceId,signalData:s})})}rejectPromotionInvite(){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.rejectPromotionInvite({invitorAddress:this.spaceInfo.spaceCreator})})}config({audio:s}){typeof s=="boolean"&&this.spaceV1Instance.enableAudio({state:s})}};return Gu.SpaceV2=r,Gu}var x7;function sz(){if(x7)return Vu;x7=1,Object.defineProperty(Vu,"__esModule",{value:!0}),Vu.Space=void 0;const e=He,t=ol(),r=am(),n=oi(),s=Lo(),i=BA(),o=OA(),a=oi(),f=nt(),c=cm(),l=nt(),u=iz(),p=sm();class d{constructor(y,m,v,b,w){this.account=y,this.env=m,this.decryptedPgpPvtKey=v,this.signer=b,this.progressHook=w,this.participants={list:(_,C)=>e.__awaiter(this,void 0,void 0,function*(){const{page:I=1,limit:k=20}=C??{},E={chatId:_,page:I,limit:k,env:this.env};return{members:(yield n.getGroupMembers(E)).map(P=>({address:P.address,intent:P.intent,role:P.role.toUpperCase()==="ADMIN"?"SPEAKER":"LISTENER",userInfo:P.userInfo}))}}),count:_=>e.__awaiter(this,void 0,void 0,function*(){const C=yield n.getGroupMemberCount({chatId:_,env:this.env});return{participants:C.overallCount-C.pendingCount,pending:C.pendingCount}}),status:(_,C)=>e.__awaiter(this,void 0,void 0,function*(){const I=yield n.getGroupMemberStatus({chatId:_,did:C,env:this.env});return{pending:I.isPending,role:I.isAdmin?"SPEAKER":"LISTENER",participant:I.isMember}})},this.chatInstance=new c.Chat(this.account,this.env,{feature:[]},this.decryptedPgpPvtKey,this.signer)}create(y,m){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error("Signer is required to create a space.");const v={signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,spaceName:y,spaceDescription:m.description||null,listeners:m.participants.listeners,speakers:m.participants.speakers,spaceImage:m.image||null,isPublic:typeof m.private=="boolean"?!m.private:!0,rules:m.rules||{},config:{scheduleAt:m.schedule.start,scheduleEnd:m.schedule.end||null},env:this.env};return yield r.createV2(v)})}update(y,m){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());let v=null;try{if(v=yield n.getGroupInfo({chatId:y,env:this.env}),!v)throw new Error("Space not found")}catch{throw new Error("Space not found")}const b={chatId:y,groupName:m.name?m.name:v.groupName,groupDescription:m.description?m.description:v.groupDescription,groupImage:m.image?m.image:v.groupImage,rules:m.rules?m.rules:v.rules,account:this.account,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env},w={chatId:y,meta:m.meta?m.meta:v.meta,scheduleAt:m.scheduleAt?m.scheduleAt:v.scheduleAt,scheduleEnd:m.scheduleEnd?m.scheduleEnd:v.scheduleEnd,status:m.status?m.status:v.status,account:this.account,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env};yield(0,i.updateGroupProfile)(b);const _=yield(0,o.updateGroupConfig)(w);return(0,a.groupInfoDtoToSpaceInfoDto)(_)})}info(y){return e.__awaiter(this,void 0,void 0,function*(){const m=yield n.getGroupInfo({chatId:y,env:this.env});return(0,a.groupInfoDtoToSpaceInfoDto)(m)})}permissions(y){return e.__awaiter(this,void 0,void 0,function*(){const m={chatId:y,did:this.account,env:this.env};return yield n.getGroupAccess(m)})}add(y,m){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());const{role:v,accounts:b}=m;if(!["SPEAKER","LISTENER"].includes(v))throw new Error("Invalid role provided.");if(!b||b.length===0)throw new Error("accounts array cannot be empty!");b.forEach(C=>{if(!(0,f.isValidPushCAIP)(C))throw new Error(`Invalid account address: ${C}`)});let _;return v==="SPEAKER"?_=yield n.addAdmins({chatId:y,admins:b,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1}):_=yield n.addMembers({chatId:y,members:b,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1}),(0,a.groupInfoDtoToSpaceInfoDto)(_)})}remove(y,m){return e.__awaiter(this,void 0,void 0,function*(){const{accounts:v}=m;if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());if(!v||v.length===0)throw new Error("Accounts array cannot be empty!");v.forEach(_=>{if(!(0,f.isValidPushCAIP)(_))throw new Error(`Invalid account address: ${_}`)});const b=[],w=[];for(const _ of v){const C=yield n.getGroupMemberStatus({chatId:y,did:_,env:this.env});C.isAdmin?b.push(_):C.isMember&&w.push(_)}return b.length>0&&(yield n.removeAdmins({chatId:y,admins:b,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1})),w.length>0&&(yield n.removeMembers({chatId:y,members:w,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1})),yield this.info(y)})}modify(y,m){return e.__awaiter(this,void 0,void 0,function*(){const{role:v,accounts:b}=m;if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());if(!["SPEAKER","LISTENER"].includes(v))throw new Error("Invalid role provided.");if(!b||b.length===0)throw new Error("accounts array cannot be empty!");b.forEach(I=>{if(!(0,f.isValidPushCAIP)(I))throw new Error(`Invalid account address: ${I}`)});let _=null;v==="SPEAKER"?_="ADMIN":_="MEMBER";const C=yield n.modifyRoles({chatId:y,newRole:_,members:b,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1});return(0,a.groupInfoDtoToSpaceInfoDto)(C)})}join(y){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());const m=yield n.getGroupMemberStatus({chatId:y,did:this.account,env:this.env});return m.isPending?yield n.approve({senderAddress:y,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1}):m.isMember||(yield n.addMembers({chatId:y,members:[this.account],env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1})),yield this.info(y)})}leave(y){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());const m=yield n.getGroupMemberStatus({chatId:y,did:this.account,env:this.env});let v;return m.isAdmin?v=yield n.removeAdmins({chatId:y,admins:[this.account],env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1}):v=yield n.removeMembers({chatId:y,members:[this.account],env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1}),(0,a.groupInfoDtoToSpaceInfoDto)(v)})}search(y,m){return e.__awaiter(this,void 0,void 0,function*(){const{page:v=1,limit:b=20}=m??{};return(yield r.search({searchTerm:y,pageNumber:v,pageSize:b,env:this.env})).map(_=>n.spaceDtoToSpaceInfoDto(_))})}trending(y){return e.__awaiter(this,void 0,void 0,function*(){const{page:m=1,limit:v=20}=y??{};return yield r.trending({page:m,limit:v,env:this.env})})}list(y,m){return e.__awaiter(this,void 0,void 0,function*(){const b={account:(m==null?void 0:m.overrideAccount)||this.account,pgpPrivateKey:this.decryptedPgpPvtKey,page:m==null?void 0:m.page,limit:m==null?void 0:m.limit,env:this.env,toDecrypt:!!this.decryptedPgpPvtKey};switch(y){case t.SpaceListType.SPACES:return yield r.spaces(b);case t.SpaceListType.REQUESTS:return yield r.requests(b);default:throw new Error("Invalid Space List Type")}})}accept(y){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());return this.chatInstance.accept(y)})}reject(y){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());return this.chatInstance.reject(y)})}get chat(){return{send:(y,m)=>e.__awaiter(this,void 0,void 0,function*(){return this.chatInstance.send(y,m)}),decrypt:y=>e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());return yield this.chatInstance.decrypt(y)}),latest:y=>e.__awaiter(this,void 0,void 0,function*(){return yield this.chatInstance.latest(y)}),history:(y,m)=>e.__awaiter(this,void 0,void 0,function*(){return yield this.chatInstance.history(y,m)})}}initialize(y){return e.__awaiter(this,void 0,void 0,function*(){const{onChange:m,spaceId:v}=y;if(!this.signer)throw new Error("Signer is required for push space");if(!this.decryptedPgpPvtKey)throw new Error("PushSDK was initialized in readonly mode. Space functionality is not available.");const b=yield new l.Signer(this.signer).getChainId();if(!b)throw new Error("Chain Id not retrievable from signer");const w=new p.Space({signer:this.signer,chainId:b,pgpPrivateKey:this.decryptedPgpPvtKey,setSpaceData:m,address:this.account,env:this.env});yield w.initialize({spaceId:v});const _=yield this.info(v);return new u.SpaceV2({spaceV1Instance:w,spaceInfo:_})})}}return Vu.Space=d,Vu}var zu={},Wu={},Yu={},T7;function az(){if(T7)return Yu;T7=1,Object.defineProperty(Yu,"__esModule",{value:!0}),Yu.validatePeerInfo=void 0;const e=nt(),t=qr(),r=n=>{const{signal:s,address:i,meta:o}=n;if(!s)throw new Error("Invalid signal data received");if(!(0,e.isValidPushCAIP)(i))throw new Error("Invalid address received");if(o.rules.access.type===t.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT&&!o.rules.access.data.chatId)throw new Error("ChatId not found in meta.rules")};return Yu.validatePeerInfo=r,Yu}var C7;function oz(){if(C7)return Wu;C7=1,Object.defineProperty(Wu,"__esModule",{value:!0}),Wu.VideoV2=void 0;const e=He,t=ui(),r=oi(),n=nt(),s=qr(),i=bn(),o=az();let a=class{constructor({videoV1Instance:c,account:l,decryptedPgpPvtKey:u,env:p,peerInfos:d}){this.videoInstance=c,this.account=l,this.decryptedPgpPvtKey=u,this.env=p,this.peerInfos=d}request(c,l){return e.__awaiter(this,void 0,void 0,function*(){const{rules:u}=l||{};for(const d of c)if(!(0,n.isValidPushCAIP)(d))throw new Error("Invalid recipient address found");if(c.length===0)throw new Error("Alteast one recipient address is required for a video call");if(c.length>1&&(u==null?void 0:u.access.type)===s.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT&&!u.access.data.chatId)throw new Error("For multiple recipient addresses, chatId is required for a video call");let p="";if(!(u!=null&&u.access.data.chatId)){let d=1;const h=30;for(;!p;){const y=yield(0,r.chats)({account:this.account,toDecrypt:!0,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env,page:d,limit:h});if(y.length===0)break;y.forEach(m=>{m.did===(0,n.walletToPCAIP10)(c[0])&&m.chatId&&(p=m.chatId)}),d++}if(!p)throw new Error(`ChatId not found between local user (${this.account}) and recipient (${c[0]}).`)}this.videoInstance.setData(d=>(0,t.produce)(d,h=>{var y;h.local.address=this.account,h.incoming=c.map(m=>({address:(0,n.pCAIP10ToWallet)(m),status:i.VideoCallStatus.INITIALIZED})),h.meta.chatId=(y=u==null?void 0:u.access.data.chatId)!==null&&y!==void 0?y:p})),yield this.videoInstance.request({senderAddress:(0,n.pCAIP10ToWallet)(this.account),recipientAddress:c.map(d=>(0,n.pCAIP10ToWallet)(d)),rules:u??{access:{type:s.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT,data:{chatId:p}}}})})}approve(c){return e.__awaiter(this,void 0,void 0,function*(){if(!c){const u=Object.keys(this.peerInfos);if(u.length!==1)throw new Error("Either no request exists or more than one request found. Please pass an address.");c=u[0]}const l=this.peerInfos[(0,n.walletToPCAIP10)(c)];(0,o.validatePeerInfo)(l),yield this.videoInstance.acceptRequest({senderAddress:(0,n.pCAIP10ToWallet)(this.account),recipientAddress:(0,n.pCAIP10ToWallet)(c),signalData:l.signal,rules:l.meta.rules})})}deny(c){return e.__awaiter(this,void 0,void 0,function*(){if(!c){const u=Object.keys(this.peerInfos);if(u.length!==1)throw new Error("Either no request exists or more than one request found. Please pass an address.");c=u[0]}const l=this.peerInfos[(0,n.walletToPCAIP10)(c)];(0,o.validatePeerInfo)(l),yield this.videoInstance.disconnect({peerAddress:(0,n.pCAIP10ToWallet)(c)})})}disconnect(){return e.__awaiter(this,void 0,void 0,function*(){yield this.videoInstance.disconnect()})}config({video:c,audio:l}){typeof c=="boolean"&&this.videoInstance.enableVideo({state:c}),typeof l=="boolean"&&this.videoInstance.enableAudio({state:l})}};return Wu.VideoV2=a,Wu}var I7;function cz(){if(I7)return zu;I7=1,Object.defineProperty(zu,"__esModule",{value:!0}),zu.Video=void 0;const e=He,t=dl(),r=bn(),n=nt(),s=DA(),i=oz(),o=ui(),a=kA();class f{constructor(l,u,p,d){this.account=l,this.env=u,this.decryptedPgpPvtKey=p,this.signer=d,this.peerInfos={}}initialize(l,u){return e.__awaiter(this,void 0,void 0,function*(){const{stream:p,config:d,media:h}=u;if(!this.signer)throw new Error("Signer is required for push video");if(!this.decryptedPgpPvtKey)throw new Error("PushSDK was initialized in readonly mode. Video functionality is not available.");const y=yield new n.Signer(this.signer).getChainId();if(!y)throw new Error("Chain Id not retrievable from signer");const m=new s.Video({signer:this.signer,chainId:y,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env,setData:l});return yield m.create(Object.assign(Object.assign(Object.assign({},h&&{stream:h}),(d==null?void 0:d.audio)&&{audio:d.audio}),(d==null?void 0:d.video)&&{video:d.video})),p.on(t.default.STREAM.VIDEO,v=>{const{address:b,signal:w,meta:{rules:_}}=v.peerInfo,C=_.access.data.chatId;v.event===t.default.VIDEO.EVENT.REQUEST&&(this.peerInfos[(0,n.walletToPCAIP10)(v.peerInfo.address)]=v.peerInfo,m.setData(I=>(0,o.produce)(I,k=>{k.local.address=this.account,k.incoming[0].address=b,k.incoming[0].status=r.VideoCallStatus.RECEIVED,k.meta.chatId=C,k.meta.initiator.address=b,k.meta.initiator.signal=w}))),C&&C===m.data.meta.chatId&&(v.event===t.default.VIDEO.EVENT.DENY&&(m.data.local.stream&&(0,a.endStream)(m.data.local.stream),m.setData(()=>s.initVideoCallData)),(v.event===t.default.VIDEO.EVENT.APPROVE||v.event===t.default.VIDEO.EVENT.RETRY_APPROVE)&&m.connect({peerAddress:b,signalData:w}),v.event===t.default.VIDEO.EVENT.RETRY_REQUEST&&m.isInitiator()&&m.request({senderAddress:this.account,recipientAddress:b,rules:_,retry:!0}),v.event===t.default.VIDEO.EVENT.RETRY_REQUEST&&!m.isInitiator()&&m.acceptRequest({signalData:w,senderAddress:this.account,recipientAddress:b,rules:_,retry:!0}))}),new i.VideoV2({videoV1Instance:m,account:this.account,decryptedPgpPvtKey:this.decryptedPgpPvtKey,env:this.env,peerInfos:this.peerInfos})})}}return zu.Video=f,zu}var k7;function Lo(){if(k7)return Eu;k7=1,Object.defineProperty(Eu,"__esModule",{value:!0}),Eu.PushAPI=void 0;const e=He,t=Ze(),r=Mn(),n=oi(),s=Dt(),i=cm(),o=MG(),a=NG(),f=om(),c=JG(),l=rz(),u=nz(),p=un(),d=sz(),h=cz(),y=nt(),m=Zg(),v=nm();let b=class VA{constructor(_,C,I,k,E,S,T,P,g){this.signer=T,this.readMode=I,this.alpha=k,this.env=_,this.account=C,this.chainWiseAccount=(0,y.walletToPCAIP10)(C),this.decryptedPgpPvtKey=E,this.pgpPublicKey=S,this.progressHook=P,this.channel=new l.Channel(this.signer,this.env,this.account,this.decryptedPgpPvtKey),this.notification=new u.Notification(this.signer,this.env,this.account,this.decryptedPgpPvtKey),this.uid=(0,v.v4)(),this.cache=m.cache,this.chat=new i.Chat(this.account,this.env,this.alpha,this.decryptedPgpPvtKey,this.signer,this.progressHook),this.space=new d.Space(this.account,this.env,this.decryptedPgpPvtKey,this.signer,this.progressHook),this.profile=new o.Profile(this.account,this.env,this.cache,this.decryptedPgpPvtKey,this.progressHook),this.encryption=new a.Encryption(this.account,this.env,this.decryptedPgpPvtKey,this.pgpPublicKey,this.signer,this.progressHook),this.user=new f.User(this.account,this.env),this.video=new h.Video(this.account,this.env,this.decryptedPgpPvtKey,this.signer),this.errors=g||[]}static initialize(..._){return e.__awaiter(this,void 0,void 0,function*(){try{let C,I,k;if(_.length===1&&typeof _[0]=="object")"account"in _[0]&&typeof _[0].account=="string"?I=_[0]:[C]=_;else if(_.length===2)[C,I]=_;else throw new Error("Invalid arguments provided to initialize method.");if(I&&"decryptedPGPPrivateKey"in I&&typeof I.decryptedPGPPrivateKey=="string"&&(k=I.decryptedPGPPrivateKey),!C&&!(I!=null&&I.account))throw new Error("Either 'signer' or 'account' must be provided.");let E=!C&&!k;const S={env:t.ENV.STAGING,version:t.default.ENC_TYPE_V3,autoUpgrade:!0,account:null},T=Object.assign(Object.assign(Object.assign({},S),I),{version:(I==null?void 0:I.version)||S.version,versionMeta:(I==null?void 0:I.versionMeta)||S.versionMeta,autoUpgrade:(I==null?void 0:I.autoUpgrade)!==void 0?I==null?void 0:I.autoUpgrade:S.autoUpgrade,alpha:I!=null&&I.alpha&&I.alpha.feature?I.alpha:p.ALPHA_FEATURE_CONFIG[t.PACKAGE_BUILD]}),P=[];let g;if(C?g=yield(0,s.getAccountAddress)((0,s.getWallet)({account:T.account,signer:C})):g=I==null?void 0:I.account,!g)throw new Error("Account could not be derived.");let A;const x=yield r.get({account:g,env:T.env});if(x&&x.publicKey&&(A=x.publicKey),!E)try{if(x&&x.encryptedPrivateKey)k||(k=yield n.decryptPGPKey({encryptedPGPPrivateKey:x.encryptedPrivateKey,signer:C,toUpgrade:T.autoUpgrade,additionalMeta:T.versionMeta,progressHook:T.progressHook,env:T.env}));else{const O=yield r.create({env:T.env,account:g,signer:C,version:T.version,additionalMeta:T.versionMeta,origin:T.origin,progressHook:T.progressHook});k=O.decryptedPrivateKey,A=O.publicKey}}catch(O){const B="Error decrypting PGP private key ...swiching to Guest mode "+(`
90
+ `+O);if(P.push({type:"ERROR",message:B}),console.error(B),(0,y.isValidNFTCAIP)(g)){const L="NFT Account Detected. If this NFT was recently transferred to you, please ensure you have received the correct password from the previous owner. Alternatively, you can reinitialize for a fresh start. Please be aware that reinitialization will result in the loss of all previous account data.";P.push({type:"WARN",message:L}),console.warn(L)}else if((0,y.isValidSCWCAIP)(g)){const L="Smart Contract Wallet Account Detected. If this SCW was recently transferred to you, please ensure you have received the correct password from the previous owner. Alternatively, you can reinitialize for a fresh start. Please be aware that reinitialization will result in the loss of all previous account data.";P.push({type:"WARN",message:L}),console.warn(L)}E=!0}return new VA(T.env,g,E,T.alpha,k,A,C,T.progressHook,P)}catch(C){throw console.error("Error initializing PushAPI:",C),C}})}reinitialize(_){return e.__awaiter(this,void 0,void 0,function*(){const C=yield r.create({env:this.env,account:this.account,signer:this.signer,additionalMeta:_.versionMeta,progressHook:this.progressHook});this.decryptedPgpPvtKey=C.decryptedPrivateKey,this.pgpPublicKey=C.publicKey,this.readMode=!1,this.errors=[],this.uid=(0,v.v4)(),this.chat=new i.Chat(this.account,this.env,this.alpha,this.decryptedPgpPvtKey,this.signer,this.progressHook),this.profile=new o.Profile(this.account,this.env,this.cache,this.decryptedPgpPvtKey,this.progressHook),this.encryption=new a.Encryption(this.account,this.env,this.decryptedPgpPvtKey,this.pgpPublicKey,this.signer,this.progressHook),this.channel=new l.Channel(this.signer,this.env,this.account,this.decryptedPgpPvtKey),this.notification=new u.Notification(this.signer,this.env,this.account,this.decryptedPgpPvtKey)})}initStream(_,C){return e.__awaiter(this,void 0,void 0,function*(){if(this.stream)throw new Error("Stream is already initialized.");return this.stream=yield c.PushStream.initialize(this.account,_,this.env,this.decryptedPgpPvtKey,this.progressHook,this.signer,C),this.stream})}info(_){return e.__awaiter(this,void 0,void 0,function*(){const C=(_==null?void 0:_.overrideAccount)||this.account;return yield r.get({account:C,env:this.env})})}readmode(){return this.readMode}static ensureSignerMessage(){return"Operation not allowed in read-only mode. Signer is required."}};return Eu.PushAPI=b,Eu}var R7;function uz(){return R7||(R7=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.video=e.space=e.chat=e.payloads=e.utils=e.user=e.channels=e.alias=e.PushAPI=e.CONSTANTS=void 0;const t=He,r=yA();e.alias=r;const n=Oo();e.channels=n;const s=Mn();e.user=s;const i=Xg();e.utils=i;const o=Xf();e.payloads=o;const a=oi();e.chat=a;const f=am();e.space=f;const c=im();e.video=c;const l=dl();e.CONSTANTS=l.default,t.__exportStar(bn(),e),t.__exportStar(Wf(),e),t.__exportStar(Yf(),e),t.__exportStar(ol(),e);var u=Lo();Object.defineProperty(e,"PushAPI",{enumerable:!0,get:function(){return u.PushAPI}})}(sh)),sh}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),He.__exportStar(uz(),e)})(rg);const lz=NP(rg),wz=oL({__proto__:null,default:lz},[rg]);export{wz as i};