@wormhole-foundation/wormhole-connect 1.2.0-beta.0-development → 1.3.0-beta.0-development

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 (127) hide show
  1. package/dist/assets/aptos-DZ2rfUfg.js +3 -0
  2. package/dist/assets/{aptos-fvUGRJ4h.js → aptos-g3DaQf0b.js} +61 -61
  3. package/dist/assets/{ccip-DLVsVRZh.js → ccip-CTWg50DB.js} +1 -1
  4. package/dist/assets/{chunk-U2PRGW4O-BklU2g_V.js → chunk-U2PRGW4O-_uqZ791P.js} +1 -1
  5. package/dist/assets/evm-CUAh52pb.js +2 -0
  6. package/dist/assets/{evm-D7r3Ne49.js → evm-Dpe6bb4m.js} +4 -4
  7. package/dist/assets/index-B169l5cS.js +1 -0
  8. package/dist/assets/{index-BINzPDaS.js → index-B2zKde8M.js} +1 -1
  9. package/dist/assets/{index-BmcqXpQd.js → index-B85n1wgg.js} +1 -1
  10. package/dist/assets/{index-BOsp0gGs.js → index-BGPIDyz6.js} +1 -1
  11. package/dist/assets/index-BT5QH3hv.js +1 -0
  12. package/dist/assets/{index-5UpuI6jk.js → index-BbXYZkyr.js} +1 -1
  13. package/dist/assets/{index-C_VIzW7c.js → index-Bwgv1Ind.js} +1 -1
  14. package/dist/assets/{index-P4tasYP-.js → index-CFWDbus8.js} +1 -1
  15. package/dist/assets/{index-BKYhAEpg.js → index-CJV78alS.js} +1 -1
  16. package/dist/assets/{index-DAS-UCcB.js → index-Ck17eoCG.js} +1 -1
  17. package/dist/assets/{index-C0ho2skw.js → index-CpdwiPRU.js} +2 -2
  18. package/dist/assets/{index-C02sy3fv.js → index-DVtwRIfn.js} +1 -1
  19. package/dist/assets/{index-D3TIHxII.js → index-jE0RsYBN.js} +1 -1
  20. package/dist/assets/{index.es-wOiA40sy.js → index.es-CEXOl433.js} +2 -2
  21. package/dist/assets/{signer-BzqNQC8X.js → signer-D8BxqoWW.js} +1 -1
  22. package/dist/assets/{solana--aMZfCgL.js → solana-Cu2aa7vE.js} +1 -1
  23. package/dist/assets/solana-Ddk7It-E.js +2 -0
  24. package/dist/assets/{sui-C76oYlao.js → sui-BXAKH3nv.js} +3 -3
  25. package/dist/assets/unsignedTransaction-DsxtoHjl.js +1 -0
  26. package/dist/main.js +28 -28
  27. package/dist/src/config/mainnet/tokens.d.ts.map +1 -1
  28. package/dist/src/config/testnet/tokens.d.ts.map +1 -1
  29. package/dist/src/hooks/useWalletCompatibility.d.ts +14 -0
  30. package/dist/src/hooks/useWalletCompatibility.d.ts.map +1 -0
  31. package/dist/src/utils/index.d.ts +1 -1
  32. package/dist/src/utils/index.d.ts.map +1 -1
  33. package/dist/src/utils/wallet/aptos.d.ts.map +1 -1
  34. package/dist/src/views/v2/Bridge/index.d.ts.map +1 -1
  35. package/lib/{aptos-BZuWMk3D.mjs → aptos-BADK10fB.mjs} +871 -870
  36. package/lib/{aptos-2J8A-FZO.mjs → aptos-CNLtQdwF.mjs} +59 -57
  37. package/lib/{aptos-DL1Hgg15.js → aptos-DeODB5kZ.js} +4 -4
  38. package/lib/aptos-DhXgHrnl.js +2 -0
  39. package/lib/{base64-Bit1A1if.js → base64-CEPDNsRw.js} +1 -1
  40. package/lib/{base64-BdSgqiJl.mjs → base64-w49IrkvT.mjs} +1 -1
  41. package/lib/{ccip-CMkUITDS.js → ccip-PRIyWWAN.js} +1 -1
  42. package/lib/{ccip-Cw8-T0j-.mjs → ccip-VK5volw3.mjs} +1 -1
  43. package/lib/{chunk-U2PRGW4O-CMIP41vB.mjs → chunk-U2PRGW4O-Ch5UM-YX.mjs} +6 -3
  44. package/lib/{chunk-U2PRGW4O-CuEEOygo.js → chunk-U2PRGW4O-D9odrfIU.js} +5 -5
  45. package/lib/{events-Bs7CEKn9.js → events-Bu0pqh5u.js} +1 -1
  46. package/lib/{events-CpDIhB3C.mjs → events-jOp8E97m.mjs} +1 -1
  47. package/lib/{evm-CK7UNFtq.js → evm-3jPN9QHX.js} +1 -1
  48. package/lib/{evm-DfX7cWQI.mjs → evm-B13HZSOG.mjs} +6 -6
  49. package/lib/{evm-1S_EvV1A.mjs → evm-CZgBqG6_.mjs} +7 -7
  50. package/lib/{evm-D5NO24dh.js → evm-Y4sMK_A1.js} +4 -4
  51. package/lib/index-1qQOAFE2.mjs +102 -0
  52. package/lib/{index-C6iaLaJq.mjs → index-BAhBSTHO.mjs} +18418 -18338
  53. package/lib/{index-wW7H3ciQ.mjs → index-BDForJp0.mjs} +2 -2
  54. package/lib/{index-CqSLXgKG.js → index-BFbkaHZM.js} +1 -1
  55. package/lib/{index-CqfWDHV0.mjs → index-BHdCskLu.mjs} +2 -2
  56. package/lib/{index-DKZeU-Xf.js → index-BRf1dmcD.js} +1 -1
  57. package/lib/{index-BPtbGGHy.mjs → index-BVuV_rfV.mjs} +3 -3
  58. package/lib/{index-CXWWVJUC.js → index-BX2v7vz2.js} +1 -1
  59. package/lib/{index-Q-iWWETw.mjs → index-BZknHaxy.mjs} +70 -70
  60. package/lib/{index-CwNerYWM.js → index-Brzu_xNS.js} +1 -1
  61. package/lib/{index-D_BTWvYp.mjs → index-BuWkXqNE.mjs} +2 -2
  62. package/lib/{index-BXPqhxjc.js → index-C2Rk8dJm.js} +1 -1
  63. package/lib/{index-C8__BuqK.mjs → index-CKnJa2J4.mjs} +1 -1
  64. package/lib/{index-DhxGcoTC.mjs → index-CdUjuPf9.mjs} +5 -5
  65. package/lib/{index-D5xkWCZ3.mjs → index-CkQ2SX_N.mjs} +48 -57
  66. package/lib/{index-o0AEhklr.mjs → index-CpOpT2eM.mjs} +2 -2
  67. package/lib/{index-hk3iRhUd.mjs → index-CtVdS94F.mjs} +4 -4
  68. package/lib/{index-8nlb2LGX.js → index-CzRLTmkg.js} +1 -1
  69. package/lib/{index-DbiW1-3L.mjs → index-D4DQMA-o.mjs} +1 -1
  70. package/lib/{index-hIJ0h_GZ.js → index-D5ta6SAe.js} +91 -91
  71. package/lib/{index-v3UQ6KEC.js → index-D9KxVP2I.js} +1 -1
  72. package/lib/index-DBmgmviv.js +1 -0
  73. package/lib/{index-S1YybQMR.js → index-DFS9XfYE.js} +1 -1
  74. package/lib/{index-7_XTrYay.js → index-DL5itoYd.js} +1 -1
  75. package/lib/index-DOqilxLu.js +1 -0
  76. package/lib/{index-C42d1PS9.js → index-DT5QhFiG.js} +1 -1
  77. package/lib/{index-CbJWXG7l.mjs → index-DcL6du1P.mjs} +2 -2
  78. package/lib/{index-7Jgokx3S.js → index-DfRhe8kL.js} +1 -1
  79. package/lib/{index-B96enquk.js → index-DjDJigyM.js} +1 -1
  80. package/lib/{index-BNn38QYa.mjs → index-DkNDirHr.mjs} +2 -2
  81. package/lib/{index-BfBNSTY8.js → index-Dr6Wkn1g.js} +1 -1
  82. package/lib/{index-D2Bw_LRJ.js → index-Dw4_1FXq.js} +1 -1
  83. package/lib/{index-Cqiy61ub.mjs → index-DzeE34W2.mjs} +1 -1
  84. package/lib/{index-TVlE0v9D.js → index-EVkJCI6W.js} +1 -1
  85. package/lib/{index-vWXFBAHR.js → index-OdUgDqqR.js} +1 -1
  86. package/lib/{index-B-ZKCWaX.js → index-dYeh9TN5.js} +1 -1
  87. package/lib/{index-BDbrAqgW.mjs → index-hnhyQbEN.mjs} +5 -5
  88. package/lib/{index-Bm1zXhFz.mjs → index-ieIOqnbv.mjs} +1 -1
  89. package/lib/{index-B-UHVwW1.mjs → index-v8vynoP2.mjs} +2 -2
  90. package/lib/{index-BzHjroj_.mjs → index-yIiSwVLU.mjs} +2 -2
  91. package/lib/{index.es-DN28d137.js → index.es-D9Co2OZW.js} +2 -2
  92. package/lib/{index.es-BnuWmVuS.mjs → index.es-jvUS3_-Z.mjs} +5 -5
  93. package/lib/index.js +1 -1
  94. package/lib/index.mjs +1 -1
  95. package/lib/{signer-YETmMcF8.js → signer-BvZ7J3Rl.js} +1 -1
  96. package/lib/{signer-D5i4Nnyi.mjs → signer-CsfCFMWy.mjs} +1 -1
  97. package/lib/solana-BD_xWaS3.js +1 -0
  98. package/lib/{solana-C7qBFXj3.js → solana-BfiZpxkP.js} +1 -1
  99. package/lib/solana-ChpC_WNg.mjs +16 -0
  100. package/lib/{solana-DtBRFbad.mjs → solana-Dh_0HpA8.mjs} +4 -4
  101. package/lib/{solanaEmbed.esm-BER_HE9G.js → solanaEmbed.esm-B3b-A7RS.js} +1 -1
  102. package/lib/{solanaEmbed.esm-Bb5iLp3o.mjs → solanaEmbed.esm-BCE4UL9u.mjs} +2 -2
  103. package/lib/src/config/mainnet/tokens.d.ts.map +1 -1
  104. package/lib/src/config/testnet/tokens.d.ts.map +1 -1
  105. package/lib/src/hooks/useWalletCompatibility.d.ts +14 -0
  106. package/lib/src/hooks/useWalletCompatibility.d.ts.map +1 -0
  107. package/lib/src/utils/index.d.ts +1 -1
  108. package/lib/src/utils/index.d.ts.map +1 -1
  109. package/lib/src/utils/wallet/aptos.d.ts.map +1 -1
  110. package/lib/src/views/v2/Bridge/index.d.ts.map +1 -1
  111. package/lib/{sui-De3Fl_fo.js → sui-BhOuuPtT.js} +1 -1
  112. package/lib/{sui-1QFb30Ta.mjs → sui-Cc0SlN9d.mjs} +1 -1
  113. package/lib/{sui-DAyysPh2.mjs → sui-DmasAl1E.mjs} +5 -5
  114. package/lib/{sui-c1d9xieM.js → sui-RIp5yjOC.js} +2 -2
  115. package/lib/unsignedTransaction-BDOQhqcZ.mjs +16 -0
  116. package/lib/unsignedTransaction-C1YeEl4G.js +1 -0
  117. package/lib/{utf8-BxTDE5Vo.mjs → utf8-V9eCtEDc.mjs} +1 -1
  118. package/lib/{utf8-B-nUZvyF.js → utf8-lSE3VJ2A.js} +1 -1
  119. package/package.json +17 -17
  120. package/dist/assets/aptos-De-iCK2S.js +0 -3
  121. package/dist/assets/evm-BBq1KqPa.js +0 -2
  122. package/dist/assets/index-LPMvkG3A.js +0 -1
  123. package/dist/assets/solana-DTptRMWs.js +0 -2
  124. package/lib/aptos-DcCwQMe7.js +0 -2
  125. package/lib/index-Bq2G38s-.js +0 -1
  126. package/lib/solana-B9GQ_Umb.js +0 -1
  127. package/lib/solana-tevnHUxv.mjs +0 -16
@@ -1,4 +1,4 @@
1
- "use strict";const Oe=require("./index-hIJ0h_GZ.js");function Pt(e,r){for(var n=0;n<r.length;n++){const i=r[n];if(typeof i!="string"&&!Array.isArray(i)){for(const D in i)if(D!=="default"&&!(D in e)){const l=Object.getOwnPropertyDescriptor(i,D);l&&Object.defineProperty(e,D,l.get?l:{enumerable:!0,get:()=>i[D]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var ke=Oe.requireHash();const bt=Oe.getDefaultExportFromCjs(ke),Ht=Pt({__proto__:null,default:bt},[ke]);var vt={},xe={},x={},wt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});function r(f,c){var d=f>>>16&65535,E=f&65535,y=c>>>16&65535,v=c&65535;return E*v+(d*v+E*y<<16>>>0)|0}e.mul=Math.imul||r;function n(f,c){return f+c|0}e.add=n;function i(f,c){return f-c|0}e.sub=i;function D(f,c){return f<<c|f>>>32-c}e.rotl=D;function l(f,c){return f<<32-c|f>>>c}e.rotr=l;function w(f){return typeof f=="number"&&isFinite(f)&&Math.floor(f)===f}e.isInteger=Number.isInteger||w,e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(f){return e.isInteger(f)&&f>=-e.MAX_SAFE_INTEGER&&f<=e.MAX_SAFE_INTEGER}})(wt);Object.defineProperty(x,"__esModule",{value:!0});var yt=wt;function Kt(e,r){return r===void 0&&(r=0),(e[r+0]<<8|e[r+1])<<16>>16}x.readInt16BE=Kt;function zt(e,r){return r===void 0&&(r=0),(e[r+0]<<8|e[r+1])>>>0}x.readUint16BE=zt;function qt(e,r){return r===void 0&&(r=0),(e[r+1]<<8|e[r])<<16>>16}x.readInt16LE=qt;function Yt(e,r){return r===void 0&&(r=0),(e[r+1]<<8|e[r])>>>0}x.readUint16LE=Yt;function gt(e,r,n){return r===void 0&&(r=new Uint8Array(2)),n===void 0&&(n=0),r[n+0]=e>>>8,r[n+1]=e>>>0,r}x.writeUint16BE=gt;x.writeInt16BE=gt;function St(e,r,n){return r===void 0&&(r=new Uint8Array(2)),n===void 0&&(n=0),r[n+0]=e>>>0,r[n+1]=e>>>8,r}x.writeUint16LE=St;x.writeInt16LE=St;function Ye(e,r){return r===void 0&&(r=0),e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]}x.readInt32BE=Ye;function $e(e,r){return r===void 0&&(r=0),(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])>>>0}x.readUint32BE=$e;function Ge(e,r){return r===void 0&&(r=0),e[r+3]<<24|e[r+2]<<16|e[r+1]<<8|e[r]}x.readInt32LE=Ge;function Ve(e,r){return r===void 0&&(r=0),(e[r+3]<<24|e[r+2]<<16|e[r+1]<<8|e[r])>>>0}x.readUint32LE=Ve;function Te(e,r,n){return r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0),r[n+0]=e>>>24,r[n+1]=e>>>16,r[n+2]=e>>>8,r[n+3]=e>>>0,r}x.writeUint32BE=Te;x.writeInt32BE=Te;function Me(e,r,n){return r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0),r[n+0]=e>>>0,r[n+1]=e>>>8,r[n+2]=e>>>16,r[n+3]=e>>>24,r}x.writeUint32LE=Me;x.writeInt32LE=Me;function $t(e,r){r===void 0&&(r=0);var n=Ye(e,r),i=Ye(e,r+4);return n*4294967296+i-(i>>31)*4294967296}x.readInt64BE=$t;function Gt(e,r){r===void 0&&(r=0);var n=$e(e,r),i=$e(e,r+4);return n*4294967296+i}x.readUint64BE=Gt;function Vt(e,r){r===void 0&&(r=0);var n=Ge(e,r),i=Ge(e,r+4);return i*4294967296+n-(n>>31)*4294967296}x.readInt64LE=Vt;function Wt(e,r){r===void 0&&(r=0);var n=Ve(e,r),i=Ve(e,r+4);return i*4294967296+n}x.readUint64LE=Wt;function mt(e,r,n){return r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0),Te(e/4294967296>>>0,r,n),Te(e>>>0,r,n+4),r}x.writeUint64BE=mt;x.writeInt64BE=mt;function Ct(e,r,n){return r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0),Me(e>>>0,r,n),Me(e/4294967296>>>0,r,n+4),r}x.writeUint64LE=Ct;x.writeInt64LE=Ct;function Xt(e,r,n){if(n===void 0&&(n=0),e%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>r.length-n)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,D=1,l=e/8+n-1;l>=n;l--)i+=r[l]*D,D*=256;return i}x.readUintBE=Xt;function Jt(e,r,n){if(n===void 0&&(n=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>r.length-n)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,D=1,l=n;l<n+e/8;l++)i+=r[l]*D,D*=256;return i}x.readUintLE=Jt;function Qt(e,r,n,i){if(n===void 0&&(n=new Uint8Array(e/8)),i===void 0&&(i=0),e%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!yt.isSafeInteger(r))throw new Error("writeUintBE value must be an integer");for(var D=1,l=e/8+i-1;l>=i;l--)n[l]=r/D&255,D*=256;return n}x.writeUintBE=Qt;function Zt(e,r,n,i){if(n===void 0&&(n=new Uint8Array(e/8)),i===void 0&&(i=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!yt.isSafeInteger(r))throw new Error("writeUintLE value must be an integer");for(var D=1,l=i;l<i+e/8;l++)n[l]=r/D&255,D*=256;return n}x.writeUintLE=Zt;function kt(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat32(r)}x.readFloat32BE=kt;function er(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat32(r,!0)}x.readFloat32LE=er;function tr(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat64(r)}x.readFloat64BE=tr;function rr(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat64(r,!0)}x.readFloat64LE=rr;function nr(e,r,n){r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0);var i=new DataView(r.buffer,r.byteOffset,r.byteLength);return i.setFloat32(n,e),r}x.writeFloat32BE=nr;function ir(e,r,n){r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0);var i=new DataView(r.buffer,r.byteOffset,r.byteLength);return i.setFloat32(n,e,!0),r}x.writeFloat32LE=ir;function ar(e,r,n){r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0);var i=new DataView(r.buffer,r.byteOffset,r.byteLength);return i.setFloat64(n,e),r}x.writeFloat64BE=ar;function ur(e,r,n){r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0);var i=new DataView(r.buffer,r.byteOffset,r.byteLength);return i.setFloat64(n,e,!0),r}x.writeFloat64LE=ur;var de={};Object.defineProperty(de,"__esModule",{value:!0});function fr(e){for(var r=0;r<e.length;r++)e[r]=0;return e}de.wipe=fr;Object.defineProperty(xe,"__esModule",{value:!0});var _e=x,We=de,hr=20;function or(e,r,n){for(var i=1634760805,D=857760878,l=2036477234,w=1797285236,f=n[3]<<24|n[2]<<16|n[1]<<8|n[0],c=n[7]<<24|n[6]<<16|n[5]<<8|n[4],d=n[11]<<24|n[10]<<16|n[9]<<8|n[8],E=n[15]<<24|n[14]<<16|n[13]<<8|n[12],y=n[19]<<24|n[18]<<16|n[17]<<8|n[16],v=n[23]<<24|n[22]<<16|n[21]<<8|n[20],b=n[27]<<24|n[26]<<16|n[25]<<8|n[24],g=n[31]<<24|n[30]<<16|n[29]<<8|n[28],O=r[3]<<24|r[2]<<16|r[1]<<8|r[0],p=r[7]<<24|r[6]<<16|r[5]<<8|r[4],U=r[11]<<24|r[10]<<16|r[9]<<8|r[8],s=r[15]<<24|r[14]<<16|r[13]<<8|r[12],_=i,u=D,o=l,h=w,t=f,a=c,S=d,C=E,F=y,L=v,j=b,B=g,T=O,M=p,m=U,N=s,G=0;G<hr;G+=2)_=_+t|0,T^=_,T=T>>>16|T<<16,F=F+T|0,t^=F,t=t>>>20|t<<12,u=u+a|0,M^=u,M=M>>>16|M<<16,L=L+M|0,a^=L,a=a>>>20|a<<12,o=o+S|0,m^=o,m=m>>>16|m<<16,j=j+m|0,S^=j,S=S>>>20|S<<12,h=h+C|0,N^=h,N=N>>>16|N<<16,B=B+N|0,C^=B,C=C>>>20|C<<12,o=o+S|0,m^=o,m=m>>>24|m<<8,j=j+m|0,S^=j,S=S>>>25|S<<7,h=h+C|0,N^=h,N=N>>>24|N<<8,B=B+N|0,C^=B,C=C>>>25|C<<7,u=u+a|0,M^=u,M=M>>>24|M<<8,L=L+M|0,a^=L,a=a>>>25|a<<7,_=_+t|0,T^=_,T=T>>>24|T<<8,F=F+T|0,t^=F,t=t>>>25|t<<7,_=_+a|0,N^=_,N=N>>>16|N<<16,j=j+N|0,a^=j,a=a>>>20|a<<12,u=u+S|0,T^=u,T=T>>>16|T<<16,B=B+T|0,S^=B,S=S>>>20|S<<12,o=o+C|0,M^=o,M=M>>>16|M<<16,F=F+M|0,C^=F,C=C>>>20|C<<12,h=h+t|0,m^=h,m=m>>>16|m<<16,L=L+m|0,t^=L,t=t>>>20|t<<12,o=o+C|0,M^=o,M=M>>>24|M<<8,F=F+M|0,C^=F,C=C>>>25|C<<7,h=h+t|0,m^=h,m=m>>>24|m<<8,L=L+m|0,t^=L,t=t>>>25|t<<7,u=u+S|0,T^=u,T=T>>>24|T<<8,B=B+T|0,S^=B,S=S>>>25|S<<7,_=_+a|0,N^=_,N=N>>>24|N<<8,j=j+N|0,a^=j,a=a>>>25|a<<7;_e.writeUint32LE(_+i|0,e,0),_e.writeUint32LE(u+D|0,e,4),_e.writeUint32LE(o+l|0,e,8),_e.writeUint32LE(h+w|0,e,12),_e.writeUint32LE(t+f|0,e,16),_e.writeUint32LE(a+c|0,e,20),_e.writeUint32LE(S+d|0,e,24),_e.writeUint32LE(C+E|0,e,28),_e.writeUint32LE(F+y|0,e,32),_e.writeUint32LE(L+v|0,e,36),_e.writeUint32LE(j+b|0,e,40),_e.writeUint32LE(B+g|0,e,44),_e.writeUint32LE(T+O|0,e,48),_e.writeUint32LE(M+p|0,e,52),_e.writeUint32LE(m+U|0,e,56),_e.writeUint32LE(N+s|0,e,60)}function pt(e,r,n,i,D){if(D===void 0&&(D=0),e.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<n.length)throw new Error("ChaCha: destination is shorter than source");var l,w;if(D===0){if(r.length!==8&&r.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");l=new Uint8Array(16),w=l.length-r.length,l.set(r,w)}else{if(r.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");l=r,w=D}for(var f=new Uint8Array(64),c=0;c<n.length;c+=64){or(f,l,e);for(var d=c;d<c+64&&d<n.length;d++)i[d]=n[d]^f[d-c];cr(l,0,w)}return We.wipe(f),D===0&&We.wipe(l),i}xe.streamXOR=pt;function sr(e,r,n,i){return i===void 0&&(i=0),We.wipe(n),pt(e,r,n,n,i)}xe.stream=sr;function cr(e,r,n){for(var i=1;n--;)i=i+(e[r]&255)|0,e[r]=i&255,i>>>=8,r++;if(i>0)throw new Error("ChaCha: counter overflow")}var Ot={},be={};Object.defineProperty(be,"__esModule",{value:!0});function lr(e,r,n){return~(e-1)&r|e-1&n}be.select=lr;function Dr(e,r){return(e|0)-(r|0)-1>>>31&1}be.lessOrEqual=Dr;function At(e,r){if(e.length!==r.length)return 0;for(var n=0,i=0;i<e.length;i++)n|=e[i]^r[i];return 1&n-1>>>8}be.compare=At;function _r(e,r){return e.length===0||r.length===0?!1:At(e,r)!==0}be.equal=_r;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var r=be,n=de;e.DIGEST_LENGTH=16;var i=function(){function w(f){this.digestLength=e.DIGEST_LENGTH,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,this._finished=!1;var c=f[0]|f[1]<<8;this._r[0]=c&8191;var d=f[2]|f[3]<<8;this._r[1]=(c>>>13|d<<3)&8191;var E=f[4]|f[5]<<8;this._r[2]=(d>>>10|E<<6)&7939;var y=f[6]|f[7]<<8;this._r[3]=(E>>>7|y<<9)&8191;var v=f[8]|f[9]<<8;this._r[4]=(y>>>4|v<<12)&255,this._r[5]=v>>>1&8190;var b=f[10]|f[11]<<8;this._r[6]=(v>>>14|b<<2)&8191;var g=f[12]|f[13]<<8;this._r[7]=(b>>>11|g<<5)&8065;var O=f[14]|f[15]<<8;this._r[8]=(g>>>8|O<<8)&8191,this._r[9]=O>>>5&127,this._pad[0]=f[16]|f[17]<<8,this._pad[1]=f[18]|f[19]<<8,this._pad[2]=f[20]|f[21]<<8,this._pad[3]=f[22]|f[23]<<8,this._pad[4]=f[24]|f[25]<<8,this._pad[5]=f[26]|f[27]<<8,this._pad[6]=f[28]|f[29]<<8,this._pad[7]=f[30]|f[31]<<8}return w.prototype._blocks=function(f,c,d){for(var E=this._fin?0:2048,y=this._h[0],v=this._h[1],b=this._h[2],g=this._h[3],O=this._h[4],p=this._h[5],U=this._h[6],s=this._h[7],_=this._h[8],u=this._h[9],o=this._r[0],h=this._r[1],t=this._r[2],a=this._r[3],S=this._r[4],C=this._r[5],F=this._r[6],L=this._r[7],j=this._r[8],B=this._r[9];d>=16;){var T=f[c+0]|f[c+1]<<8;y+=T&8191;var M=f[c+2]|f[c+3]<<8;v+=(T>>>13|M<<3)&8191;var m=f[c+4]|f[c+5]<<8;b+=(M>>>10|m<<6)&8191;var N=f[c+6]|f[c+7]<<8;g+=(m>>>7|N<<9)&8191;var G=f[c+8]|f[c+9]<<8;O+=(N>>>4|G<<12)&8191,p+=G>>>1&8191;var J=f[c+10]|f[c+11]<<8;U+=(G>>>14|J<<2)&8191;var X=f[c+12]|f[c+13]<<8;s+=(J>>>11|X<<5)&8191;var W=f[c+14]|f[c+15]<<8;_+=(X>>>8|W<<8)&8191,u+=W>>>5|E;var A=0,I=A;I+=y*o,I+=v*(5*B),I+=b*(5*j),I+=g*(5*L),I+=O*(5*F),A=I>>>13,I&=8191,I+=p*(5*C),I+=U*(5*S),I+=s*(5*a),I+=_*(5*t),I+=u*(5*h),A+=I>>>13,I&=8191;var R=A;R+=y*h,R+=v*o,R+=b*(5*B),R+=g*(5*j),R+=O*(5*L),A=R>>>13,R&=8191,R+=p*(5*F),R+=U*(5*C),R+=s*(5*S),R+=_*(5*a),R+=u*(5*t),A+=R>>>13,R&=8191;var P=A;P+=y*t,P+=v*h,P+=b*o,P+=g*(5*B),P+=O*(5*j),A=P>>>13,P&=8191,P+=p*(5*L),P+=U*(5*F),P+=s*(5*C),P+=_*(5*S),P+=u*(5*a),A+=P>>>13,P&=8191;var H=A;H+=y*a,H+=v*t,H+=b*h,H+=g*o,H+=O*(5*B),A=H>>>13,H&=8191,H+=p*(5*j),H+=U*(5*L),H+=s*(5*F),H+=_*(5*C),H+=u*(5*S),A+=H>>>13,H&=8191;var K=A;K+=y*S,K+=v*a,K+=b*t,K+=g*h,K+=O*o,A=K>>>13,K&=8191,K+=p*(5*B),K+=U*(5*j),K+=s*(5*L),K+=_*(5*F),K+=u*(5*C),A+=K>>>13,K&=8191;var z=A;z+=y*C,z+=v*S,z+=b*a,z+=g*t,z+=O*h,A=z>>>13,z&=8191,z+=p*o,z+=U*(5*B),z+=s*(5*j),z+=_*(5*L),z+=u*(5*F),A+=z>>>13,z&=8191;var q=A;q+=y*F,q+=v*C,q+=b*S,q+=g*a,q+=O*t,A=q>>>13,q&=8191,q+=p*h,q+=U*o,q+=s*(5*B),q+=_*(5*j),q+=u*(5*L),A+=q>>>13,q&=8191;var Y=A;Y+=y*L,Y+=v*F,Y+=b*C,Y+=g*S,Y+=O*a,A=Y>>>13,Y&=8191,Y+=p*t,Y+=U*h,Y+=s*o,Y+=_*(5*B),Y+=u*(5*j),A+=Y>>>13,Y&=8191;var $=A;$+=y*j,$+=v*L,$+=b*F,$+=g*C,$+=O*S,A=$>>>13,$&=8191,$+=p*a,$+=U*t,$+=s*h,$+=_*o,$+=u*(5*B),A+=$>>>13,$&=8191;var V=A;V+=y*B,V+=v*j,V+=b*L,V+=g*F,V+=O*C,A=V>>>13,V&=8191,V+=p*S,V+=U*a,V+=s*t,V+=_*h,V+=u*o,A+=V>>>13,V&=8191,A=(A<<2)+A|0,A=A+I|0,I=A&8191,A=A>>>13,R+=A,y=I,v=R,b=P,g=H,O=K,p=z,U=q,s=Y,_=$,u=V,c+=16,d-=16}this._h[0]=y,this._h[1]=v,this._h[2]=b,this._h[3]=g,this._h[4]=O,this._h[5]=p,this._h[6]=U,this._h[7]=s,this._h[8]=_,this._h[9]=u},w.prototype.finish=function(f,c){c===void 0&&(c=0);var d=new Uint16Array(10),E,y,v,b;if(this._leftover){for(b=this._leftover,this._buffer[b++]=1;b<16;b++)this._buffer[b]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(E=this._h[1]>>>13,this._h[1]&=8191,b=2;b<10;b++)this._h[b]+=E,E=this._h[b]>>>13,this._h[b]&=8191;for(this._h[0]+=E*5,E=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=E,E=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=E,d[0]=this._h[0]+5,E=d[0]>>>13,d[0]&=8191,b=1;b<10;b++)d[b]=this._h[b]+E,E=d[b]>>>13,d[b]&=8191;for(d[9]-=8192,y=(E^1)-1,b=0;b<10;b++)d[b]&=y;for(y=~y,b=0;b<10;b++)this._h[b]=this._h[b]&y|d[b];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,v=this._h[0]+this._pad[0],this._h[0]=v&65535,b=1;b<8;b++)v=(this._h[b]+this._pad[b]|0)+(v>>>16)|0,this._h[b]=v&65535;return f[c+0]=this._h[0]>>>0,f[c+1]=this._h[0]>>>8,f[c+2]=this._h[1]>>>0,f[c+3]=this._h[1]>>>8,f[c+4]=this._h[2]>>>0,f[c+5]=this._h[2]>>>8,f[c+6]=this._h[3]>>>0,f[c+7]=this._h[3]>>>8,f[c+8]=this._h[4]>>>0,f[c+9]=this._h[4]>>>8,f[c+10]=this._h[5]>>>0,f[c+11]=this._h[5]>>>8,f[c+12]=this._h[6]>>>0,f[c+13]=this._h[6]>>>8,f[c+14]=this._h[7]>>>0,f[c+15]=this._h[7]>>>8,this._finished=!0,this},w.prototype.update=function(f){var c=0,d=f.length,E;if(this._leftover){E=16-this._leftover,E>d&&(E=d);for(var y=0;y<E;y++)this._buffer[this._leftover+y]=f[c+y];if(d-=E,c+=E,this._leftover+=E,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(d>=16&&(E=d-d%16,this._blocks(f,c,E),c+=E,d-=E),d){for(var y=0;y<d;y++)this._buffer[this._leftover+y]=f[c+y];this._leftover+=d}return this},w.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var f=new Uint8Array(16);return this.finish(f),f},w.prototype.clean=function(){return n.wipe(this._buffer),n.wipe(this._r),n.wipe(this._h),n.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},w}();e.Poly1305=i;function D(w,f){var c=new i(w);c.update(f);var d=c.digest();return c.clean(),d}e.oneTimeAuth=D;function l(w,f){return w.length!==e.DIGEST_LENGTH||f.length!==e.DIGEST_LENGTH?!1:r.equal(w,f)}e.equal=l})(Ot);(function(e){Object.defineProperty(e,"__esModule",{value:!0});var r=xe,n=Ot,i=de,D=x,l=be;e.KEY_LENGTH=32,e.NONCE_LENGTH=12,e.TAG_LENGTH=16;var w=new Uint8Array(16),f=function(){function c(d){if(this.nonceLength=e.NONCE_LENGTH,this.tagLength=e.TAG_LENGTH,d.length!==e.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(d)}return c.prototype.seal=function(d,E,y,v){if(d.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var b=new Uint8Array(16);b.set(d,b.length-d.length);var g=new Uint8Array(32);r.stream(this._key,b,g,4);var O=E.length+this.tagLength,p;if(v){if(v.length!==O)throw new Error("ChaCha20Poly1305: incorrect destination length");p=v}else p=new Uint8Array(O);return r.streamXOR(this._key,b,E,p,4),this._authenticate(p.subarray(p.length-this.tagLength,p.length),g,p.subarray(0,p.length-this.tagLength),y),i.wipe(b),p},c.prototype.open=function(d,E,y,v){if(d.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(E.length<this.tagLength)return null;var b=new Uint8Array(16);b.set(d,b.length-d.length);var g=new Uint8Array(32);r.stream(this._key,b,g,4);var O=new Uint8Array(this.tagLength);if(this._authenticate(O,g,E.subarray(0,E.length-this.tagLength),y),!l.equal(O,E.subarray(E.length-this.tagLength,E.length)))return null;var p=E.length-this.tagLength,U;if(v){if(v.length!==p)throw new Error("ChaCha20Poly1305: incorrect destination length");U=v}else U=new Uint8Array(p);return r.streamXOR(this._key,b,E.subarray(0,E.length-this.tagLength),U,4),i.wipe(b),U},c.prototype.clean=function(){return i.wipe(this._key),this},c.prototype._authenticate=function(d,E,y,v){var b=new n.Poly1305(E);v&&(b.update(v),v.length%16>0&&b.update(w.subarray(v.length%16))),b.update(y),y.length%16>0&&b.update(w.subarray(y.length%16));var g=new Uint8Array(8);v&&D.writeUint64LE(v.length,g),b.update(g),D.writeUint64LE(y.length,g),b.update(g);for(var O=b.digest(),p=0;p<O.length;p++)d[p]=O[p];b.clean(),i.wipe(O),i.wipe(g)},c}();e.ChaCha20Poly1305=f})(vt);var Ut={},Ue={},et={};Object.defineProperty(et,"__esModule",{value:!0});function dr(e){return typeof e.saveState<"u"&&typeof e.restoreState<"u"&&typeof e.cleanSavedState<"u"}et.isSerializableHash=dr;Object.defineProperty(Ue,"__esModule",{value:!0});var Ee=et,Er=be,br=de,Ft=function(){function e(r,n){this._finished=!1,this._inner=new r,this._outer=new r,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);n.length>this.blockSize?this._inner.update(n).finish(i).clean():i.set(n);for(var D=0;D<i.length;D++)i[D]^=54;this._inner.update(i);for(var D=0;D<i.length;D++)i[D]^=106;this._outer.update(i),Ee.isSerializableHash(this._inner)&&Ee.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),br.wipe(i)}return e.prototype.reset=function(){if(!Ee.isSerializableHash(this._inner)||!Ee.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.clean=function(){Ee.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Ee.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},e.prototype.update=function(r){return this._inner.update(r),this},e.prototype.finish=function(r){return this._finished?(this._outer.finish(r),this):(this._inner.finish(r),this._outer.update(r.subarray(0,this.digestLength)).finish(r),this._finished=!0,this)},e.prototype.digest=function(){var r=new Uint8Array(this.digestLength);return this.finish(r),r},e.prototype.saveState=function(){if(!Ee.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},e.prototype.restoreState=function(r){if(!Ee.isSerializableHash(this._inner)||!Ee.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(r),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.cleanSavedState=function(r){if(!Ee.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(r)},e}();Ue.HMAC=Ft;function vr(e,r,n){var i=new Ft(e,r);i.update(n);var D=i.digest();return i.clean(),D}Ue.hmac=vr;Ue.equal=Er.equal;Object.defineProperty(Ut,"__esModule",{value:!0});var nt=Ue,it=de,wr=function(){function e(r,n,i,D){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=r,this._info=D;var l=nt.hmac(this._hash,i,n);this._hmac=new nt.HMAC(r,l),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var r=this._counter[0];if(r===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),r>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(r){for(var n=new Uint8Array(r),i=0;i<n.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),n[i]=this._buffer[this._bufpos++];return n},e.prototype.clean=function(){this._hmac.clean(),it.wipe(this._buffer),it.wipe(this._counter),this._bufpos=0},e}(),yr=Ut.HKDF=wr,tt={},Le={},Be={};Object.defineProperty(Be,"__esModule",{value:!0});Be.BrowserRandomSource=void 0;const at=65536;class gr{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const r=typeof self<"u"?self.crypto||self.msCrypto:null;r&&r.getRandomValues!==void 0&&(this._crypto=r,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(r){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const n=new Uint8Array(r);for(let i=0;i<n.length;i+=at)this._crypto.getRandomValues(n.subarray(i,i+Math.min(n.length-i,at)));return n}}Be.BrowserRandomSource=gr;var je={};Object.defineProperty(je,"__esModule",{value:!0});je.NodeRandomSource=void 0;const Sr=de;class mr{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Oe.commonjsRequire<"u"){const r=Oe.requireCryptoBrowserify();r&&r.randomBytes&&(this._crypto=r,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(r){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let n=this._crypto.randomBytes(r);if(n.length!==r)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(r);for(let D=0;D<i.length;D++)i[D]=n[D];return(0,Sr.wipe)(n),i}}je.NodeRandomSource=mr;Object.defineProperty(Le,"__esModule",{value:!0});Le.SystemRandomSource=void 0;const Cr=Be,pr=je;class Or{constructor(){if(this.isAvailable=!1,this.name="",this._source=new Cr.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new pr.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(r){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(r)}}Le.SystemRandomSource=Or;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.randomStringForEntropy=e.randomString=e.randomUint32=e.randomBytes=e.defaultRandomSource=void 0;const r=Le,n=x,i=de;e.defaultRandomSource=new r.SystemRandomSource;function D(d,E=e.defaultRandomSource){return E.randomBytes(d)}e.randomBytes=D;function l(d=e.defaultRandomSource){const E=D(4,d),y=(0,n.readUint32LE)(E);return(0,i.wipe)(E),y}e.randomUint32=l;const w="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function f(d,E=w,y=e.defaultRandomSource){if(E.length<2)throw new Error("randomString charset is too short");if(E.length>256)throw new Error("randomString charset is too long");let v="";const b=E.length,g=256-256%b;for(;d>0;){const O=D(Math.ceil(d*256/g),y);for(let p=0;p<O.length&&d>0;p++){const U=O[p];U<g&&(v+=E.charAt(U%b),d--)}(0,i.wipe)(O)}return v}e.randomString=f;function c(d,E=w,y=e.defaultRandomSource){const v=Math.ceil(d/(Math.log(E.length)/Math.LN2));return f(v,E,y)}e.randomStringForEntropy=c})(tt);var Nt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var r=x,n=de;e.DIGEST_LENGTH=32,e.BLOCK_SIZE=64;var i=function(){function f(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return f.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._temp),this.reset()},f.prototype.update=function(c,d){if(d===void 0&&(d=c.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var E=0;if(this._bytesHashed+=d,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&d>0;)this._buffer[this._bufferLength++]=c[E++],d--;this._bufferLength===this.blockSize&&(l(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(d>=this.blockSize&&(E=l(this._temp,this._state,c,E,d),d%=this.blockSize);d>0;)this._buffer[this._bufferLength++]=c[E++],d--;return this},f.prototype.finish=function(c){if(!this._finished){var d=this._bytesHashed,E=this._bufferLength,y=d/536870912|0,v=d<<3,b=d%64<56?64:128;this._buffer[E]=128;for(var g=E+1;g<b-8;g++)this._buffer[g]=0;r.writeUint32BE(y,this._buffer,b-8),r.writeUint32BE(v,this._buffer,b-4),l(this._temp,this._state,this._buffer,0,b),this._finished=!0}for(var g=0;g<this.digestLength/4;g++)r.writeUint32BE(this._state[g],c,g*4);return this},f.prototype.digest=function(){var c=new Uint8Array(this.digestLength);return this.finish(c),c},f.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(c){return this._state.set(c.state),this._bufferLength=c.bufferLength,c.buffer&&this._buffer.set(c.buffer),this._bytesHashed=c.bytesHashed,this._finished=!1,this},f.prototype.cleanSavedState=function(c){n.wipe(c.state),c.buffer&&n.wipe(c.buffer),c.bufferLength=0,c.bytesHashed=0},f}();e.SHA256=i;var D=new Int32Array([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 l(f,c,d,E,y){for(;y>=64;){for(var v=c[0],b=c[1],g=c[2],O=c[3],p=c[4],U=c[5],s=c[6],_=c[7],u=0;u<16;u++){var o=E+u*4;f[u]=r.readUint32BE(d,o)}for(var u=16;u<64;u++){var h=f[u-2],t=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10;h=f[u-15];var a=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;f[u]=(t+f[u-7]|0)+(a+f[u-16]|0)}for(var u=0;u<64;u++){var t=(((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(p&U^~p&s)|0)+(_+(D[u]+f[u]|0)|0)|0,a=((v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10))+(v&b^v&g^b&g)|0;_=s,s=U,U=p,p=O+t|0,O=g,g=b,b=v,v=t+a|0}c[0]+=v,c[1]+=b,c[2]+=g,c[3]+=O,c[4]+=p,c[5]+=U,c[6]+=s,c[7]+=_,E+=64,y-=64}return E}function w(f){var c=new i;c.update(f);var d=c.digest();return c.clean(),d}e.hash=w})(Nt);var Tt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sharedKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.scalarMultBase=e.scalarMult=e.SHARED_KEY_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=void 0;const r=tt,n=de;e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=32,e.SHARED_KEY_LENGTH=32;function i(u){const o=new Float64Array(16);if(u)for(let h=0;h<u.length;h++)o[h]=u[h];return o}const D=new Uint8Array(32);D[0]=9;const l=i([56129,1]);function w(u){let o=1;for(let h=0;h<16;h++){let t=u[h]+o+65535;o=Math.floor(t/65536),u[h]=t-o*65536}u[0]+=o-1+37*(o-1)}function f(u,o,h){const t=~(h-1);for(let a=0;a<16;a++){const S=t&(u[a]^o[a]);u[a]^=S,o[a]^=S}}function c(u,o){const h=i(),t=i();for(let a=0;a<16;a++)t[a]=o[a];w(t),w(t),w(t);for(let a=0;a<2;a++){h[0]=t[0]-65517;for(let C=1;C<15;C++)h[C]=t[C]-65535-(h[C-1]>>16&1),h[C-1]&=65535;h[15]=t[15]-32767-(h[14]>>16&1);const S=h[15]>>16&1;h[14]&=65535,f(t,h,1-S)}for(let a=0;a<16;a++)u[2*a]=t[a]&255,u[2*a+1]=t[a]>>8}function d(u,o){for(let h=0;h<16;h++)u[h]=o[2*h]+(o[2*h+1]<<8);u[15]&=32767}function E(u,o,h){for(let t=0;t<16;t++)u[t]=o[t]+h[t]}function y(u,o,h){for(let t=0;t<16;t++)u[t]=o[t]-h[t]}function v(u,o,h){let t,a,S=0,C=0,F=0,L=0,j=0,B=0,T=0,M=0,m=0,N=0,G=0,J=0,X=0,W=0,A=0,I=0,R=0,P=0,H=0,K=0,z=0,q=0,Y=0,$=0,V=0,ve=0,ge=0,me=0,Ne=0,Pe=0,rt=0,Z=h[0],k=h[1],ee=h[2],te=h[3],re=h[4],ne=h[5],ie=h[6],ae=h[7],ue=h[8],fe=h[9],he=h[10],oe=h[11],se=h[12],ce=h[13],le=h[14],De=h[15];t=o[0],S+=t*Z,C+=t*k,F+=t*ee,L+=t*te,j+=t*re,B+=t*ne,T+=t*ie,M+=t*ae,m+=t*ue,N+=t*fe,G+=t*he,J+=t*oe,X+=t*se,W+=t*ce,A+=t*le,I+=t*De,t=o[1],C+=t*Z,F+=t*k,L+=t*ee,j+=t*te,B+=t*re,T+=t*ne,M+=t*ie,m+=t*ae,N+=t*ue,G+=t*fe,J+=t*he,X+=t*oe,W+=t*se,A+=t*ce,I+=t*le,R+=t*De,t=o[2],F+=t*Z,L+=t*k,j+=t*ee,B+=t*te,T+=t*re,M+=t*ne,m+=t*ie,N+=t*ae,G+=t*ue,J+=t*fe,X+=t*he,W+=t*oe,A+=t*se,I+=t*ce,R+=t*le,P+=t*De,t=o[3],L+=t*Z,j+=t*k,B+=t*ee,T+=t*te,M+=t*re,m+=t*ne,N+=t*ie,G+=t*ae,J+=t*ue,X+=t*fe,W+=t*he,A+=t*oe,I+=t*se,R+=t*ce,P+=t*le,H+=t*De,t=o[4],j+=t*Z,B+=t*k,T+=t*ee,M+=t*te,m+=t*re,N+=t*ne,G+=t*ie,J+=t*ae,X+=t*ue,W+=t*fe,A+=t*he,I+=t*oe,R+=t*se,P+=t*ce,H+=t*le,K+=t*De,t=o[5],B+=t*Z,T+=t*k,M+=t*ee,m+=t*te,N+=t*re,G+=t*ne,J+=t*ie,X+=t*ae,W+=t*ue,A+=t*fe,I+=t*he,R+=t*oe,P+=t*se,H+=t*ce,K+=t*le,z+=t*De,t=o[6],T+=t*Z,M+=t*k,m+=t*ee,N+=t*te,G+=t*re,J+=t*ne,X+=t*ie,W+=t*ae,A+=t*ue,I+=t*fe,R+=t*he,P+=t*oe,H+=t*se,K+=t*ce,z+=t*le,q+=t*De,t=o[7],M+=t*Z,m+=t*k,N+=t*ee,G+=t*te,J+=t*re,X+=t*ne,W+=t*ie,A+=t*ae,I+=t*ue,R+=t*fe,P+=t*he,H+=t*oe,K+=t*se,z+=t*ce,q+=t*le,Y+=t*De,t=o[8],m+=t*Z,N+=t*k,G+=t*ee,J+=t*te,X+=t*re,W+=t*ne,A+=t*ie,I+=t*ae,R+=t*ue,P+=t*fe,H+=t*he,K+=t*oe,z+=t*se,q+=t*ce,Y+=t*le,$+=t*De,t=o[9],N+=t*Z,G+=t*k,J+=t*ee,X+=t*te,W+=t*re,A+=t*ne,I+=t*ie,R+=t*ae,P+=t*ue,H+=t*fe,K+=t*he,z+=t*oe,q+=t*se,Y+=t*ce,$+=t*le,V+=t*De,t=o[10],G+=t*Z,J+=t*k,X+=t*ee,W+=t*te,A+=t*re,I+=t*ne,R+=t*ie,P+=t*ae,H+=t*ue,K+=t*fe,z+=t*he,q+=t*oe,Y+=t*se,$+=t*ce,V+=t*le,ve+=t*De,t=o[11],J+=t*Z,X+=t*k,W+=t*ee,A+=t*te,I+=t*re,R+=t*ne,P+=t*ie,H+=t*ae,K+=t*ue,z+=t*fe,q+=t*he,Y+=t*oe,$+=t*se,V+=t*ce,ve+=t*le,ge+=t*De,t=o[12],X+=t*Z,W+=t*k,A+=t*ee,I+=t*te,R+=t*re,P+=t*ne,H+=t*ie,K+=t*ae,z+=t*ue,q+=t*fe,Y+=t*he,$+=t*oe,V+=t*se,ve+=t*ce,ge+=t*le,me+=t*De,t=o[13],W+=t*Z,A+=t*k,I+=t*ee,R+=t*te,P+=t*re,H+=t*ne,K+=t*ie,z+=t*ae,q+=t*ue,Y+=t*fe,$+=t*he,V+=t*oe,ve+=t*se,ge+=t*ce,me+=t*le,Ne+=t*De,t=o[14],A+=t*Z,I+=t*k,R+=t*ee,P+=t*te,H+=t*re,K+=t*ne,z+=t*ie,q+=t*ae,Y+=t*ue,$+=t*fe,V+=t*he,ve+=t*oe,ge+=t*se,me+=t*ce,Ne+=t*le,Pe+=t*De,t=o[15],I+=t*Z,R+=t*k,P+=t*ee,H+=t*te,K+=t*re,z+=t*ne,q+=t*ie,Y+=t*ae,$+=t*ue,V+=t*fe,ve+=t*he,ge+=t*oe,me+=t*se,Ne+=t*ce,Pe+=t*le,rt+=t*De,S+=38*R,C+=38*P,F+=38*H,L+=38*K,j+=38*z,B+=38*q,T+=38*Y,M+=38*$,m+=38*V,N+=38*ve,G+=38*ge,J+=38*me,X+=38*Ne,W+=38*Pe,A+=38*rt,a=1,t=S+a+65535,a=Math.floor(t/65536),S=t-a*65536,t=C+a+65535,a=Math.floor(t/65536),C=t-a*65536,t=F+a+65535,a=Math.floor(t/65536),F=t-a*65536,t=L+a+65535,a=Math.floor(t/65536),L=t-a*65536,t=j+a+65535,a=Math.floor(t/65536),j=t-a*65536,t=B+a+65535,a=Math.floor(t/65536),B=t-a*65536,t=T+a+65535,a=Math.floor(t/65536),T=t-a*65536,t=M+a+65535,a=Math.floor(t/65536),M=t-a*65536,t=m+a+65535,a=Math.floor(t/65536),m=t-a*65536,t=N+a+65535,a=Math.floor(t/65536),N=t-a*65536,t=G+a+65535,a=Math.floor(t/65536),G=t-a*65536,t=J+a+65535,a=Math.floor(t/65536),J=t-a*65536,t=X+a+65535,a=Math.floor(t/65536),X=t-a*65536,t=W+a+65535,a=Math.floor(t/65536),W=t-a*65536,t=A+a+65535,a=Math.floor(t/65536),A=t-a*65536,t=I+a+65535,a=Math.floor(t/65536),I=t-a*65536,S+=a-1+37*(a-1),a=1,t=S+a+65535,a=Math.floor(t/65536),S=t-a*65536,t=C+a+65535,a=Math.floor(t/65536),C=t-a*65536,t=F+a+65535,a=Math.floor(t/65536),F=t-a*65536,t=L+a+65535,a=Math.floor(t/65536),L=t-a*65536,t=j+a+65535,a=Math.floor(t/65536),j=t-a*65536,t=B+a+65535,a=Math.floor(t/65536),B=t-a*65536,t=T+a+65535,a=Math.floor(t/65536),T=t-a*65536,t=M+a+65535,a=Math.floor(t/65536),M=t-a*65536,t=m+a+65535,a=Math.floor(t/65536),m=t-a*65536,t=N+a+65535,a=Math.floor(t/65536),N=t-a*65536,t=G+a+65535,a=Math.floor(t/65536),G=t-a*65536,t=J+a+65535,a=Math.floor(t/65536),J=t-a*65536,t=X+a+65535,a=Math.floor(t/65536),X=t-a*65536,t=W+a+65535,a=Math.floor(t/65536),W=t-a*65536,t=A+a+65535,a=Math.floor(t/65536),A=t-a*65536,t=I+a+65535,a=Math.floor(t/65536),I=t-a*65536,S+=a-1+37*(a-1),u[0]=S,u[1]=C,u[2]=F,u[3]=L,u[4]=j,u[5]=B,u[6]=T,u[7]=M,u[8]=m,u[9]=N,u[10]=G,u[11]=J,u[12]=X,u[13]=W,u[14]=A,u[15]=I}function b(u,o){v(u,o,o)}function g(u,o){const h=i();for(let t=0;t<16;t++)h[t]=o[t];for(let t=253;t>=0;t--)b(h,h),t!==2&&t!==4&&v(h,h,o);for(let t=0;t<16;t++)u[t]=h[t]}function O(u,o){const h=new Uint8Array(32),t=new Float64Array(80),a=i(),S=i(),C=i(),F=i(),L=i(),j=i();for(let m=0;m<31;m++)h[m]=u[m];h[31]=u[31]&127|64,h[0]&=248,d(t,o);for(let m=0;m<16;m++)S[m]=t[m];a[0]=F[0]=1;for(let m=254;m>=0;--m){const N=h[m>>>3]>>>(m&7)&1;f(a,S,N),f(C,F,N),E(L,a,C),y(a,a,C),E(C,S,F),y(S,S,F),b(F,L),b(j,a),v(a,C,a),v(C,S,L),E(L,a,C),y(a,a,C),b(S,a),y(C,F,j),v(a,C,l),E(a,a,F),v(C,C,a),v(a,F,j),v(F,S,t),b(S,L),f(a,S,N),f(C,F,N)}for(let m=0;m<16;m++)t[m+16]=a[m],t[m+32]=C[m],t[m+48]=S[m],t[m+64]=F[m];const B=t.subarray(32),T=t.subarray(16);g(B,B),v(T,T,B);const M=new Uint8Array(32);return c(M,T),M}e.scalarMult=O;function p(u){return O(u,D)}e.scalarMultBase=p;function U(u){if(u.length!==e.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${e.SECRET_KEY_LENGTH} bytes`);const o=new Uint8Array(u);return{publicKey:p(o),secretKey:o}}e.generateKeyPairFromSeed=U;function s(u){const o=(0,r.randomBytes)(32,u),h=U(o);return(0,n.wipe)(o),h}e.generateKeyPair=s;function _(u,o,h=!1){if(u.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(o.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const t=O(u,o);if(h){let a=0;for(let S=0;S<t.length;S++)a|=t[S];if(a===0)throw new Error("X25519: invalid shared key")}return t}e.sharedKey=_})(Tt);function Ar(e,r){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),i=0;i<n.length;i++)n[i]=255;for(var D=0;D<e.length;D++){var l=e.charAt(D),w=l.charCodeAt(0);if(n[w]!==255)throw new TypeError(l+" is ambiguous");n[w]=D}var f=e.length,c=e.charAt(0),d=Math.log(f)/Math.log(256),E=Math.log(256)/Math.log(f);function y(g){if(g instanceof Uint8Array||(ArrayBuffer.isView(g)?g=new Uint8Array(g.buffer,g.byteOffset,g.byteLength):Array.isArray(g)&&(g=Uint8Array.from(g))),!(g instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(g.length===0)return"";for(var O=0,p=0,U=0,s=g.length;U!==s&&g[U]===0;)U++,O++;for(var _=(s-U)*E+1>>>0,u=new Uint8Array(_);U!==s;){for(var o=g[U],h=0,t=_-1;(o!==0||h<p)&&t!==-1;t--,h++)o+=256*u[t]>>>0,u[t]=o%f>>>0,o=o/f>>>0;if(o!==0)throw new Error("Non-zero carry");p=h,U++}for(var a=_-p;a!==_&&u[a]===0;)a++;for(var S=c.repeat(O);a<_;++a)S+=e.charAt(u[a]);return S}function v(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return new Uint8Array;var O=0;if(g[O]!==" "){for(var p=0,U=0;g[O]===c;)p++,O++;for(var s=(g.length-O)*d+1>>>0,_=new Uint8Array(s);g[O];){var u=n[g.charCodeAt(O)];if(u===255)return;for(var o=0,h=s-1;(u!==0||o<U)&&h!==-1;h--,o++)u+=f*_[h]>>>0,_[h]=u%256>>>0,u=u/256>>>0;if(u!==0)throw new Error("Non-zero carry");U=o,O++}if(g[O]!==" "){for(var t=s-U;t!==s&&_[t]===0;)t++;for(var a=new Uint8Array(p+(s-t)),S=p;t!==s;)a[S++]=_[t++];return a}}}function b(g){var O=v(g);if(O)return O;throw new Error(`Non-${r} character`)}return{encode:y,decodeUnsafe:v,decode:b}}var Ur=Ar,Fr=Ur;const Nr=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},Tr=e=>new TextEncoder().encode(e),Mr=e=>new TextDecoder().decode(e);class xr{constructor(r,n,i){this.name=r,this.prefix=n,this.baseEncode=i}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}}class Lr{constructor(r,n,i){if(this.name=r,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=i}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return Mt(this,r)}}class Br{constructor(r){this.decoders=r}or(r){return Mt(this,r)}decode(r){const n=r[0],i=this.decoders[n];if(i)return i.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Mt=(e,r)=>new Br({...e.decoders||{[e.prefix]:e},...r.decoders||{[r.prefix]:r}});class jr{constructor(r,n,i,D){this.name=r,this.prefix=n,this.baseEncode=i,this.baseDecode=D,this.encoder=new xr(r,n,i),this.decoder=new Lr(r,n,D)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}}const Ie=({name:e,prefix:r,encode:n,decode:i})=>new jr(e,r,n,i),Fe=({prefix:e,name:r,alphabet:n})=>{const{encode:i,decode:D}=Fr(n,r);return Ie({prefix:e,name:r,encode:i,decode:l=>Nr(D(l))})},Ir=(e,r,n,i)=>{const D={};for(let E=0;E<r.length;++E)D[r[E]]=E;let l=e.length;for(;e[l-1]==="=";)--l;const w=new Uint8Array(l*n/8|0);let f=0,c=0,d=0;for(let E=0;E<l;++E){const y=D[e[E]];if(y===void 0)throw new SyntaxError(`Non-${i} character`);c=c<<n|y,f+=n,f>=8&&(f-=8,w[d++]=255&c>>f)}if(f>=n||255&c<<8-f)throw new SyntaxError("Unexpected end of data");return w},Rr=(e,r,n)=>{const i=r[r.length-1]==="=",D=(1<<n)-1;let l="",w=0,f=0;for(let c=0;c<e.length;++c)for(f=f<<8|e[c],w+=8;w>n;)w-=n,l+=r[D&f>>w];if(w&&(l+=r[D&f<<n-w]),i)for(;l.length*n&7;)l+="=";return l},Q=({name:e,prefix:r,bitsPerChar:n,alphabet:i})=>Ie({prefix:r,name:e,encode(D){return Rr(D,i,n)},decode(D){return Ir(D,i,n,e)}}),Pr=Ie({prefix:"\0",name:"identity",encode:e=>Mr(e),decode:e=>Tr(e)}),Hr=Object.freeze(Object.defineProperty({__proto__:null,identity:Pr},Symbol.toStringTag,{value:"Module"})),Kr=Q({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),zr=Object.freeze(Object.defineProperty({__proto__:null,base2:Kr},Symbol.toStringTag,{value:"Module"})),qr=Q({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Yr=Object.freeze(Object.defineProperty({__proto__:null,base8:qr},Symbol.toStringTag,{value:"Module"})),$r=Fe({prefix:"9",name:"base10",alphabet:"0123456789"}),Gr=Object.freeze(Object.defineProperty({__proto__:null,base10:$r},Symbol.toStringTag,{value:"Module"})),Vr=Q({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Wr=Q({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Xr=Object.freeze(Object.defineProperty({__proto__:null,base16:Vr,base16upper:Wr},Symbol.toStringTag,{value:"Module"})),Jr=Q({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Qr=Q({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Zr=Q({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),kr=Q({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),en=Q({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),tn=Q({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),rn=Q({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),nn=Q({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),an=Q({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),un=Object.freeze(Object.defineProperty({__proto__:null,base32:Jr,base32hex:en,base32hexpad:rn,base32hexpadupper:nn,base32hexupper:tn,base32pad:Zr,base32padupper:kr,base32upper:Qr,base32z:an},Symbol.toStringTag,{value:"Module"})),fn=Fe({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),hn=Fe({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),on=Object.freeze(Object.defineProperty({__proto__:null,base36:fn,base36upper:hn},Symbol.toStringTag,{value:"Module"})),sn=Fe({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),cn=Fe({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),ln=Object.freeze(Object.defineProperty({__proto__:null,base58btc:sn,base58flickr:cn},Symbol.toStringTag,{value:"Module"})),Dn=Q({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),_n=Q({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),dn=Q({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),En=Q({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),bn=Object.freeze(Object.defineProperty({__proto__:null,base64:Dn,base64pad:_n,base64url:dn,base64urlpad:En},Symbol.toStringTag,{value:"Module"})),xt=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),vn=xt.reduce((e,r,n)=>(e[n]=r,e),[]),wn=xt.reduce((e,r,n)=>(e[r.codePointAt(0)]=n,e),[]);function yn(e){return e.reduce((r,n)=>(r+=vn[n],r),"")}function gn(e){const r=[];for(const n of e){const i=wn[n.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${n}`);r.push(i)}return new Uint8Array(r)}const Sn=Ie({prefix:"🚀",name:"base256emoji",encode:yn,decode:gn}),mn=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:Sn},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;var Lt={};/*! *****************************************************************************
1
+ "use strict";const Oe=require("./index-D5ta6SAe.js");function Pt(e,r){for(var n=0;n<r.length;n++){const i=r[n];if(typeof i!="string"&&!Array.isArray(i)){for(const D in i)if(D!=="default"&&!(D in e)){const l=Object.getOwnPropertyDescriptor(i,D);l&&Object.defineProperty(e,D,l.get?l:{enumerable:!0,get:()=>i[D]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var ke=Oe.requireHash();const bt=Oe.getDefaultExportFromCjs(ke),Ht=Pt({__proto__:null,default:bt},[ke]);var vt={},xe={},x={},wt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});function r(f,c){var d=f>>>16&65535,E=f&65535,y=c>>>16&65535,v=c&65535;return E*v+(d*v+E*y<<16>>>0)|0}e.mul=Math.imul||r;function n(f,c){return f+c|0}e.add=n;function i(f,c){return f-c|0}e.sub=i;function D(f,c){return f<<c|f>>>32-c}e.rotl=D;function l(f,c){return f<<32-c|f>>>c}e.rotr=l;function w(f){return typeof f=="number"&&isFinite(f)&&Math.floor(f)===f}e.isInteger=Number.isInteger||w,e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(f){return e.isInteger(f)&&f>=-e.MAX_SAFE_INTEGER&&f<=e.MAX_SAFE_INTEGER}})(wt);Object.defineProperty(x,"__esModule",{value:!0});var yt=wt;function Kt(e,r){return r===void 0&&(r=0),(e[r+0]<<8|e[r+1])<<16>>16}x.readInt16BE=Kt;function zt(e,r){return r===void 0&&(r=0),(e[r+0]<<8|e[r+1])>>>0}x.readUint16BE=zt;function qt(e,r){return r===void 0&&(r=0),(e[r+1]<<8|e[r])<<16>>16}x.readInt16LE=qt;function Yt(e,r){return r===void 0&&(r=0),(e[r+1]<<8|e[r])>>>0}x.readUint16LE=Yt;function gt(e,r,n){return r===void 0&&(r=new Uint8Array(2)),n===void 0&&(n=0),r[n+0]=e>>>8,r[n+1]=e>>>0,r}x.writeUint16BE=gt;x.writeInt16BE=gt;function St(e,r,n){return r===void 0&&(r=new Uint8Array(2)),n===void 0&&(n=0),r[n+0]=e>>>0,r[n+1]=e>>>8,r}x.writeUint16LE=St;x.writeInt16LE=St;function Ye(e,r){return r===void 0&&(r=0),e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]}x.readInt32BE=Ye;function $e(e,r){return r===void 0&&(r=0),(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])>>>0}x.readUint32BE=$e;function Ge(e,r){return r===void 0&&(r=0),e[r+3]<<24|e[r+2]<<16|e[r+1]<<8|e[r]}x.readInt32LE=Ge;function Ve(e,r){return r===void 0&&(r=0),(e[r+3]<<24|e[r+2]<<16|e[r+1]<<8|e[r])>>>0}x.readUint32LE=Ve;function Te(e,r,n){return r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0),r[n+0]=e>>>24,r[n+1]=e>>>16,r[n+2]=e>>>8,r[n+3]=e>>>0,r}x.writeUint32BE=Te;x.writeInt32BE=Te;function Me(e,r,n){return r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0),r[n+0]=e>>>0,r[n+1]=e>>>8,r[n+2]=e>>>16,r[n+3]=e>>>24,r}x.writeUint32LE=Me;x.writeInt32LE=Me;function $t(e,r){r===void 0&&(r=0);var n=Ye(e,r),i=Ye(e,r+4);return n*4294967296+i-(i>>31)*4294967296}x.readInt64BE=$t;function Gt(e,r){r===void 0&&(r=0);var n=$e(e,r),i=$e(e,r+4);return n*4294967296+i}x.readUint64BE=Gt;function Vt(e,r){r===void 0&&(r=0);var n=Ge(e,r),i=Ge(e,r+4);return i*4294967296+n-(n>>31)*4294967296}x.readInt64LE=Vt;function Wt(e,r){r===void 0&&(r=0);var n=Ve(e,r),i=Ve(e,r+4);return i*4294967296+n}x.readUint64LE=Wt;function mt(e,r,n){return r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0),Te(e/4294967296>>>0,r,n),Te(e>>>0,r,n+4),r}x.writeUint64BE=mt;x.writeInt64BE=mt;function Ct(e,r,n){return r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0),Me(e>>>0,r,n),Me(e/4294967296>>>0,r,n+4),r}x.writeUint64LE=Ct;x.writeInt64LE=Ct;function Xt(e,r,n){if(n===void 0&&(n=0),e%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>r.length-n)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,D=1,l=e/8+n-1;l>=n;l--)i+=r[l]*D,D*=256;return i}x.readUintBE=Xt;function Jt(e,r,n){if(n===void 0&&(n=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>r.length-n)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,D=1,l=n;l<n+e/8;l++)i+=r[l]*D,D*=256;return i}x.readUintLE=Jt;function Qt(e,r,n,i){if(n===void 0&&(n=new Uint8Array(e/8)),i===void 0&&(i=0),e%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!yt.isSafeInteger(r))throw new Error("writeUintBE value must be an integer");for(var D=1,l=e/8+i-1;l>=i;l--)n[l]=r/D&255,D*=256;return n}x.writeUintBE=Qt;function Zt(e,r,n,i){if(n===void 0&&(n=new Uint8Array(e/8)),i===void 0&&(i=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!yt.isSafeInteger(r))throw new Error("writeUintLE value must be an integer");for(var D=1,l=i;l<i+e/8;l++)n[l]=r/D&255,D*=256;return n}x.writeUintLE=Zt;function kt(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat32(r)}x.readFloat32BE=kt;function er(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat32(r,!0)}x.readFloat32LE=er;function tr(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat64(r)}x.readFloat64BE=tr;function rr(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat64(r,!0)}x.readFloat64LE=rr;function nr(e,r,n){r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0);var i=new DataView(r.buffer,r.byteOffset,r.byteLength);return i.setFloat32(n,e),r}x.writeFloat32BE=nr;function ir(e,r,n){r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0);var i=new DataView(r.buffer,r.byteOffset,r.byteLength);return i.setFloat32(n,e,!0),r}x.writeFloat32LE=ir;function ar(e,r,n){r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0);var i=new DataView(r.buffer,r.byteOffset,r.byteLength);return i.setFloat64(n,e),r}x.writeFloat64BE=ar;function ur(e,r,n){r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0);var i=new DataView(r.buffer,r.byteOffset,r.byteLength);return i.setFloat64(n,e,!0),r}x.writeFloat64LE=ur;var de={};Object.defineProperty(de,"__esModule",{value:!0});function fr(e){for(var r=0;r<e.length;r++)e[r]=0;return e}de.wipe=fr;Object.defineProperty(xe,"__esModule",{value:!0});var _e=x,We=de,hr=20;function or(e,r,n){for(var i=1634760805,D=857760878,l=2036477234,w=1797285236,f=n[3]<<24|n[2]<<16|n[1]<<8|n[0],c=n[7]<<24|n[6]<<16|n[5]<<8|n[4],d=n[11]<<24|n[10]<<16|n[9]<<8|n[8],E=n[15]<<24|n[14]<<16|n[13]<<8|n[12],y=n[19]<<24|n[18]<<16|n[17]<<8|n[16],v=n[23]<<24|n[22]<<16|n[21]<<8|n[20],b=n[27]<<24|n[26]<<16|n[25]<<8|n[24],g=n[31]<<24|n[30]<<16|n[29]<<8|n[28],O=r[3]<<24|r[2]<<16|r[1]<<8|r[0],p=r[7]<<24|r[6]<<16|r[5]<<8|r[4],U=r[11]<<24|r[10]<<16|r[9]<<8|r[8],s=r[15]<<24|r[14]<<16|r[13]<<8|r[12],_=i,u=D,o=l,h=w,t=f,a=c,S=d,C=E,F=y,L=v,j=b,B=g,T=O,M=p,m=U,N=s,G=0;G<hr;G+=2)_=_+t|0,T^=_,T=T>>>16|T<<16,F=F+T|0,t^=F,t=t>>>20|t<<12,u=u+a|0,M^=u,M=M>>>16|M<<16,L=L+M|0,a^=L,a=a>>>20|a<<12,o=o+S|0,m^=o,m=m>>>16|m<<16,j=j+m|0,S^=j,S=S>>>20|S<<12,h=h+C|0,N^=h,N=N>>>16|N<<16,B=B+N|0,C^=B,C=C>>>20|C<<12,o=o+S|0,m^=o,m=m>>>24|m<<8,j=j+m|0,S^=j,S=S>>>25|S<<7,h=h+C|0,N^=h,N=N>>>24|N<<8,B=B+N|0,C^=B,C=C>>>25|C<<7,u=u+a|0,M^=u,M=M>>>24|M<<8,L=L+M|0,a^=L,a=a>>>25|a<<7,_=_+t|0,T^=_,T=T>>>24|T<<8,F=F+T|0,t^=F,t=t>>>25|t<<7,_=_+a|0,N^=_,N=N>>>16|N<<16,j=j+N|0,a^=j,a=a>>>20|a<<12,u=u+S|0,T^=u,T=T>>>16|T<<16,B=B+T|0,S^=B,S=S>>>20|S<<12,o=o+C|0,M^=o,M=M>>>16|M<<16,F=F+M|0,C^=F,C=C>>>20|C<<12,h=h+t|0,m^=h,m=m>>>16|m<<16,L=L+m|0,t^=L,t=t>>>20|t<<12,o=o+C|0,M^=o,M=M>>>24|M<<8,F=F+M|0,C^=F,C=C>>>25|C<<7,h=h+t|0,m^=h,m=m>>>24|m<<8,L=L+m|0,t^=L,t=t>>>25|t<<7,u=u+S|0,T^=u,T=T>>>24|T<<8,B=B+T|0,S^=B,S=S>>>25|S<<7,_=_+a|0,N^=_,N=N>>>24|N<<8,j=j+N|0,a^=j,a=a>>>25|a<<7;_e.writeUint32LE(_+i|0,e,0),_e.writeUint32LE(u+D|0,e,4),_e.writeUint32LE(o+l|0,e,8),_e.writeUint32LE(h+w|0,e,12),_e.writeUint32LE(t+f|0,e,16),_e.writeUint32LE(a+c|0,e,20),_e.writeUint32LE(S+d|0,e,24),_e.writeUint32LE(C+E|0,e,28),_e.writeUint32LE(F+y|0,e,32),_e.writeUint32LE(L+v|0,e,36),_e.writeUint32LE(j+b|0,e,40),_e.writeUint32LE(B+g|0,e,44),_e.writeUint32LE(T+O|0,e,48),_e.writeUint32LE(M+p|0,e,52),_e.writeUint32LE(m+U|0,e,56),_e.writeUint32LE(N+s|0,e,60)}function pt(e,r,n,i,D){if(D===void 0&&(D=0),e.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<n.length)throw new Error("ChaCha: destination is shorter than source");var l,w;if(D===0){if(r.length!==8&&r.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");l=new Uint8Array(16),w=l.length-r.length,l.set(r,w)}else{if(r.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");l=r,w=D}for(var f=new Uint8Array(64),c=0;c<n.length;c+=64){or(f,l,e);for(var d=c;d<c+64&&d<n.length;d++)i[d]=n[d]^f[d-c];cr(l,0,w)}return We.wipe(f),D===0&&We.wipe(l),i}xe.streamXOR=pt;function sr(e,r,n,i){return i===void 0&&(i=0),We.wipe(n),pt(e,r,n,n,i)}xe.stream=sr;function cr(e,r,n){for(var i=1;n--;)i=i+(e[r]&255)|0,e[r]=i&255,i>>>=8,r++;if(i>0)throw new Error("ChaCha: counter overflow")}var Ot={},be={};Object.defineProperty(be,"__esModule",{value:!0});function lr(e,r,n){return~(e-1)&r|e-1&n}be.select=lr;function Dr(e,r){return(e|0)-(r|0)-1>>>31&1}be.lessOrEqual=Dr;function At(e,r){if(e.length!==r.length)return 0;for(var n=0,i=0;i<e.length;i++)n|=e[i]^r[i];return 1&n-1>>>8}be.compare=At;function _r(e,r){return e.length===0||r.length===0?!1:At(e,r)!==0}be.equal=_r;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var r=be,n=de;e.DIGEST_LENGTH=16;var i=function(){function w(f){this.digestLength=e.DIGEST_LENGTH,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,this._finished=!1;var c=f[0]|f[1]<<8;this._r[0]=c&8191;var d=f[2]|f[3]<<8;this._r[1]=(c>>>13|d<<3)&8191;var E=f[4]|f[5]<<8;this._r[2]=(d>>>10|E<<6)&7939;var y=f[6]|f[7]<<8;this._r[3]=(E>>>7|y<<9)&8191;var v=f[8]|f[9]<<8;this._r[4]=(y>>>4|v<<12)&255,this._r[5]=v>>>1&8190;var b=f[10]|f[11]<<8;this._r[6]=(v>>>14|b<<2)&8191;var g=f[12]|f[13]<<8;this._r[7]=(b>>>11|g<<5)&8065;var O=f[14]|f[15]<<8;this._r[8]=(g>>>8|O<<8)&8191,this._r[9]=O>>>5&127,this._pad[0]=f[16]|f[17]<<8,this._pad[1]=f[18]|f[19]<<8,this._pad[2]=f[20]|f[21]<<8,this._pad[3]=f[22]|f[23]<<8,this._pad[4]=f[24]|f[25]<<8,this._pad[5]=f[26]|f[27]<<8,this._pad[6]=f[28]|f[29]<<8,this._pad[7]=f[30]|f[31]<<8}return w.prototype._blocks=function(f,c,d){for(var E=this._fin?0:2048,y=this._h[0],v=this._h[1],b=this._h[2],g=this._h[3],O=this._h[4],p=this._h[5],U=this._h[6],s=this._h[7],_=this._h[8],u=this._h[9],o=this._r[0],h=this._r[1],t=this._r[2],a=this._r[3],S=this._r[4],C=this._r[5],F=this._r[6],L=this._r[7],j=this._r[8],B=this._r[9];d>=16;){var T=f[c+0]|f[c+1]<<8;y+=T&8191;var M=f[c+2]|f[c+3]<<8;v+=(T>>>13|M<<3)&8191;var m=f[c+4]|f[c+5]<<8;b+=(M>>>10|m<<6)&8191;var N=f[c+6]|f[c+7]<<8;g+=(m>>>7|N<<9)&8191;var G=f[c+8]|f[c+9]<<8;O+=(N>>>4|G<<12)&8191,p+=G>>>1&8191;var J=f[c+10]|f[c+11]<<8;U+=(G>>>14|J<<2)&8191;var X=f[c+12]|f[c+13]<<8;s+=(J>>>11|X<<5)&8191;var W=f[c+14]|f[c+15]<<8;_+=(X>>>8|W<<8)&8191,u+=W>>>5|E;var A=0,I=A;I+=y*o,I+=v*(5*B),I+=b*(5*j),I+=g*(5*L),I+=O*(5*F),A=I>>>13,I&=8191,I+=p*(5*C),I+=U*(5*S),I+=s*(5*a),I+=_*(5*t),I+=u*(5*h),A+=I>>>13,I&=8191;var R=A;R+=y*h,R+=v*o,R+=b*(5*B),R+=g*(5*j),R+=O*(5*L),A=R>>>13,R&=8191,R+=p*(5*F),R+=U*(5*C),R+=s*(5*S),R+=_*(5*a),R+=u*(5*t),A+=R>>>13,R&=8191;var P=A;P+=y*t,P+=v*h,P+=b*o,P+=g*(5*B),P+=O*(5*j),A=P>>>13,P&=8191,P+=p*(5*L),P+=U*(5*F),P+=s*(5*C),P+=_*(5*S),P+=u*(5*a),A+=P>>>13,P&=8191;var H=A;H+=y*a,H+=v*t,H+=b*h,H+=g*o,H+=O*(5*B),A=H>>>13,H&=8191,H+=p*(5*j),H+=U*(5*L),H+=s*(5*F),H+=_*(5*C),H+=u*(5*S),A+=H>>>13,H&=8191;var K=A;K+=y*S,K+=v*a,K+=b*t,K+=g*h,K+=O*o,A=K>>>13,K&=8191,K+=p*(5*B),K+=U*(5*j),K+=s*(5*L),K+=_*(5*F),K+=u*(5*C),A+=K>>>13,K&=8191;var z=A;z+=y*C,z+=v*S,z+=b*a,z+=g*t,z+=O*h,A=z>>>13,z&=8191,z+=p*o,z+=U*(5*B),z+=s*(5*j),z+=_*(5*L),z+=u*(5*F),A+=z>>>13,z&=8191;var q=A;q+=y*F,q+=v*C,q+=b*S,q+=g*a,q+=O*t,A=q>>>13,q&=8191,q+=p*h,q+=U*o,q+=s*(5*B),q+=_*(5*j),q+=u*(5*L),A+=q>>>13,q&=8191;var Y=A;Y+=y*L,Y+=v*F,Y+=b*C,Y+=g*S,Y+=O*a,A=Y>>>13,Y&=8191,Y+=p*t,Y+=U*h,Y+=s*o,Y+=_*(5*B),Y+=u*(5*j),A+=Y>>>13,Y&=8191;var $=A;$+=y*j,$+=v*L,$+=b*F,$+=g*C,$+=O*S,A=$>>>13,$&=8191,$+=p*a,$+=U*t,$+=s*h,$+=_*o,$+=u*(5*B),A+=$>>>13,$&=8191;var V=A;V+=y*B,V+=v*j,V+=b*L,V+=g*F,V+=O*C,A=V>>>13,V&=8191,V+=p*S,V+=U*a,V+=s*t,V+=_*h,V+=u*o,A+=V>>>13,V&=8191,A=(A<<2)+A|0,A=A+I|0,I=A&8191,A=A>>>13,R+=A,y=I,v=R,b=P,g=H,O=K,p=z,U=q,s=Y,_=$,u=V,c+=16,d-=16}this._h[0]=y,this._h[1]=v,this._h[2]=b,this._h[3]=g,this._h[4]=O,this._h[5]=p,this._h[6]=U,this._h[7]=s,this._h[8]=_,this._h[9]=u},w.prototype.finish=function(f,c){c===void 0&&(c=0);var d=new Uint16Array(10),E,y,v,b;if(this._leftover){for(b=this._leftover,this._buffer[b++]=1;b<16;b++)this._buffer[b]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(E=this._h[1]>>>13,this._h[1]&=8191,b=2;b<10;b++)this._h[b]+=E,E=this._h[b]>>>13,this._h[b]&=8191;for(this._h[0]+=E*5,E=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=E,E=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=E,d[0]=this._h[0]+5,E=d[0]>>>13,d[0]&=8191,b=1;b<10;b++)d[b]=this._h[b]+E,E=d[b]>>>13,d[b]&=8191;for(d[9]-=8192,y=(E^1)-1,b=0;b<10;b++)d[b]&=y;for(y=~y,b=0;b<10;b++)this._h[b]=this._h[b]&y|d[b];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,v=this._h[0]+this._pad[0],this._h[0]=v&65535,b=1;b<8;b++)v=(this._h[b]+this._pad[b]|0)+(v>>>16)|0,this._h[b]=v&65535;return f[c+0]=this._h[0]>>>0,f[c+1]=this._h[0]>>>8,f[c+2]=this._h[1]>>>0,f[c+3]=this._h[1]>>>8,f[c+4]=this._h[2]>>>0,f[c+5]=this._h[2]>>>8,f[c+6]=this._h[3]>>>0,f[c+7]=this._h[3]>>>8,f[c+8]=this._h[4]>>>0,f[c+9]=this._h[4]>>>8,f[c+10]=this._h[5]>>>0,f[c+11]=this._h[5]>>>8,f[c+12]=this._h[6]>>>0,f[c+13]=this._h[6]>>>8,f[c+14]=this._h[7]>>>0,f[c+15]=this._h[7]>>>8,this._finished=!0,this},w.prototype.update=function(f){var c=0,d=f.length,E;if(this._leftover){E=16-this._leftover,E>d&&(E=d);for(var y=0;y<E;y++)this._buffer[this._leftover+y]=f[c+y];if(d-=E,c+=E,this._leftover+=E,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(d>=16&&(E=d-d%16,this._blocks(f,c,E),c+=E,d-=E),d){for(var y=0;y<d;y++)this._buffer[this._leftover+y]=f[c+y];this._leftover+=d}return this},w.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var f=new Uint8Array(16);return this.finish(f),f},w.prototype.clean=function(){return n.wipe(this._buffer),n.wipe(this._r),n.wipe(this._h),n.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},w}();e.Poly1305=i;function D(w,f){var c=new i(w);c.update(f);var d=c.digest();return c.clean(),d}e.oneTimeAuth=D;function l(w,f){return w.length!==e.DIGEST_LENGTH||f.length!==e.DIGEST_LENGTH?!1:r.equal(w,f)}e.equal=l})(Ot);(function(e){Object.defineProperty(e,"__esModule",{value:!0});var r=xe,n=Ot,i=de,D=x,l=be;e.KEY_LENGTH=32,e.NONCE_LENGTH=12,e.TAG_LENGTH=16;var w=new Uint8Array(16),f=function(){function c(d){if(this.nonceLength=e.NONCE_LENGTH,this.tagLength=e.TAG_LENGTH,d.length!==e.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(d)}return c.prototype.seal=function(d,E,y,v){if(d.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var b=new Uint8Array(16);b.set(d,b.length-d.length);var g=new Uint8Array(32);r.stream(this._key,b,g,4);var O=E.length+this.tagLength,p;if(v){if(v.length!==O)throw new Error("ChaCha20Poly1305: incorrect destination length");p=v}else p=new Uint8Array(O);return r.streamXOR(this._key,b,E,p,4),this._authenticate(p.subarray(p.length-this.tagLength,p.length),g,p.subarray(0,p.length-this.tagLength),y),i.wipe(b),p},c.prototype.open=function(d,E,y,v){if(d.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(E.length<this.tagLength)return null;var b=new Uint8Array(16);b.set(d,b.length-d.length);var g=new Uint8Array(32);r.stream(this._key,b,g,4);var O=new Uint8Array(this.tagLength);if(this._authenticate(O,g,E.subarray(0,E.length-this.tagLength),y),!l.equal(O,E.subarray(E.length-this.tagLength,E.length)))return null;var p=E.length-this.tagLength,U;if(v){if(v.length!==p)throw new Error("ChaCha20Poly1305: incorrect destination length");U=v}else U=new Uint8Array(p);return r.streamXOR(this._key,b,E.subarray(0,E.length-this.tagLength),U,4),i.wipe(b),U},c.prototype.clean=function(){return i.wipe(this._key),this},c.prototype._authenticate=function(d,E,y,v){var b=new n.Poly1305(E);v&&(b.update(v),v.length%16>0&&b.update(w.subarray(v.length%16))),b.update(y),y.length%16>0&&b.update(w.subarray(y.length%16));var g=new Uint8Array(8);v&&D.writeUint64LE(v.length,g),b.update(g),D.writeUint64LE(y.length,g),b.update(g);for(var O=b.digest(),p=0;p<O.length;p++)d[p]=O[p];b.clean(),i.wipe(O),i.wipe(g)},c}();e.ChaCha20Poly1305=f})(vt);var Ut={},Ue={},et={};Object.defineProperty(et,"__esModule",{value:!0});function dr(e){return typeof e.saveState<"u"&&typeof e.restoreState<"u"&&typeof e.cleanSavedState<"u"}et.isSerializableHash=dr;Object.defineProperty(Ue,"__esModule",{value:!0});var Ee=et,Er=be,br=de,Ft=function(){function e(r,n){this._finished=!1,this._inner=new r,this._outer=new r,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);n.length>this.blockSize?this._inner.update(n).finish(i).clean():i.set(n);for(var D=0;D<i.length;D++)i[D]^=54;this._inner.update(i);for(var D=0;D<i.length;D++)i[D]^=106;this._outer.update(i),Ee.isSerializableHash(this._inner)&&Ee.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),br.wipe(i)}return e.prototype.reset=function(){if(!Ee.isSerializableHash(this._inner)||!Ee.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.clean=function(){Ee.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Ee.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},e.prototype.update=function(r){return this._inner.update(r),this},e.prototype.finish=function(r){return this._finished?(this._outer.finish(r),this):(this._inner.finish(r),this._outer.update(r.subarray(0,this.digestLength)).finish(r),this._finished=!0,this)},e.prototype.digest=function(){var r=new Uint8Array(this.digestLength);return this.finish(r),r},e.prototype.saveState=function(){if(!Ee.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},e.prototype.restoreState=function(r){if(!Ee.isSerializableHash(this._inner)||!Ee.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(r),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.cleanSavedState=function(r){if(!Ee.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(r)},e}();Ue.HMAC=Ft;function vr(e,r,n){var i=new Ft(e,r);i.update(n);var D=i.digest();return i.clean(),D}Ue.hmac=vr;Ue.equal=Er.equal;Object.defineProperty(Ut,"__esModule",{value:!0});var nt=Ue,it=de,wr=function(){function e(r,n,i,D){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=r,this._info=D;var l=nt.hmac(this._hash,i,n);this._hmac=new nt.HMAC(r,l),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var r=this._counter[0];if(r===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),r>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(r){for(var n=new Uint8Array(r),i=0;i<n.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),n[i]=this._buffer[this._bufpos++];return n},e.prototype.clean=function(){this._hmac.clean(),it.wipe(this._buffer),it.wipe(this._counter),this._bufpos=0},e}(),yr=Ut.HKDF=wr,tt={},Le={},Be={};Object.defineProperty(Be,"__esModule",{value:!0});Be.BrowserRandomSource=void 0;const at=65536;class gr{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const r=typeof self<"u"?self.crypto||self.msCrypto:null;r&&r.getRandomValues!==void 0&&(this._crypto=r,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(r){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const n=new Uint8Array(r);for(let i=0;i<n.length;i+=at)this._crypto.getRandomValues(n.subarray(i,i+Math.min(n.length-i,at)));return n}}Be.BrowserRandomSource=gr;var je={};Object.defineProperty(je,"__esModule",{value:!0});je.NodeRandomSource=void 0;const Sr=de;class mr{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Oe.commonjsRequire<"u"){const r=Oe.requireCryptoBrowserify();r&&r.randomBytes&&(this._crypto=r,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(r){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let n=this._crypto.randomBytes(r);if(n.length!==r)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(r);for(let D=0;D<i.length;D++)i[D]=n[D];return(0,Sr.wipe)(n),i}}je.NodeRandomSource=mr;Object.defineProperty(Le,"__esModule",{value:!0});Le.SystemRandomSource=void 0;const Cr=Be,pr=je;class Or{constructor(){if(this.isAvailable=!1,this.name="",this._source=new Cr.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new pr.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(r){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(r)}}Le.SystemRandomSource=Or;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.randomStringForEntropy=e.randomString=e.randomUint32=e.randomBytes=e.defaultRandomSource=void 0;const r=Le,n=x,i=de;e.defaultRandomSource=new r.SystemRandomSource;function D(d,E=e.defaultRandomSource){return E.randomBytes(d)}e.randomBytes=D;function l(d=e.defaultRandomSource){const E=D(4,d),y=(0,n.readUint32LE)(E);return(0,i.wipe)(E),y}e.randomUint32=l;const w="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function f(d,E=w,y=e.defaultRandomSource){if(E.length<2)throw new Error("randomString charset is too short");if(E.length>256)throw new Error("randomString charset is too long");let v="";const b=E.length,g=256-256%b;for(;d>0;){const O=D(Math.ceil(d*256/g),y);for(let p=0;p<O.length&&d>0;p++){const U=O[p];U<g&&(v+=E.charAt(U%b),d--)}(0,i.wipe)(O)}return v}e.randomString=f;function c(d,E=w,y=e.defaultRandomSource){const v=Math.ceil(d/(Math.log(E.length)/Math.LN2));return f(v,E,y)}e.randomStringForEntropy=c})(tt);var Nt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var r=x,n=de;e.DIGEST_LENGTH=32,e.BLOCK_SIZE=64;var i=function(){function f(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return f.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._temp),this.reset()},f.prototype.update=function(c,d){if(d===void 0&&(d=c.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var E=0;if(this._bytesHashed+=d,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&d>0;)this._buffer[this._bufferLength++]=c[E++],d--;this._bufferLength===this.blockSize&&(l(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(d>=this.blockSize&&(E=l(this._temp,this._state,c,E,d),d%=this.blockSize);d>0;)this._buffer[this._bufferLength++]=c[E++],d--;return this},f.prototype.finish=function(c){if(!this._finished){var d=this._bytesHashed,E=this._bufferLength,y=d/536870912|0,v=d<<3,b=d%64<56?64:128;this._buffer[E]=128;for(var g=E+1;g<b-8;g++)this._buffer[g]=0;r.writeUint32BE(y,this._buffer,b-8),r.writeUint32BE(v,this._buffer,b-4),l(this._temp,this._state,this._buffer,0,b),this._finished=!0}for(var g=0;g<this.digestLength/4;g++)r.writeUint32BE(this._state[g],c,g*4);return this},f.prototype.digest=function(){var c=new Uint8Array(this.digestLength);return this.finish(c),c},f.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(c){return this._state.set(c.state),this._bufferLength=c.bufferLength,c.buffer&&this._buffer.set(c.buffer),this._bytesHashed=c.bytesHashed,this._finished=!1,this},f.prototype.cleanSavedState=function(c){n.wipe(c.state),c.buffer&&n.wipe(c.buffer),c.bufferLength=0,c.bytesHashed=0},f}();e.SHA256=i;var D=new Int32Array([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 l(f,c,d,E,y){for(;y>=64;){for(var v=c[0],b=c[1],g=c[2],O=c[3],p=c[4],U=c[5],s=c[6],_=c[7],u=0;u<16;u++){var o=E+u*4;f[u]=r.readUint32BE(d,o)}for(var u=16;u<64;u++){var h=f[u-2],t=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10;h=f[u-15];var a=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;f[u]=(t+f[u-7]|0)+(a+f[u-16]|0)}for(var u=0;u<64;u++){var t=(((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(p&U^~p&s)|0)+(_+(D[u]+f[u]|0)|0)|0,a=((v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10))+(v&b^v&g^b&g)|0;_=s,s=U,U=p,p=O+t|0,O=g,g=b,b=v,v=t+a|0}c[0]+=v,c[1]+=b,c[2]+=g,c[3]+=O,c[4]+=p,c[5]+=U,c[6]+=s,c[7]+=_,E+=64,y-=64}return E}function w(f){var c=new i;c.update(f);var d=c.digest();return c.clean(),d}e.hash=w})(Nt);var Tt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sharedKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.scalarMultBase=e.scalarMult=e.SHARED_KEY_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=void 0;const r=tt,n=de;e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=32,e.SHARED_KEY_LENGTH=32;function i(u){const o=new Float64Array(16);if(u)for(let h=0;h<u.length;h++)o[h]=u[h];return o}const D=new Uint8Array(32);D[0]=9;const l=i([56129,1]);function w(u){let o=1;for(let h=0;h<16;h++){let t=u[h]+o+65535;o=Math.floor(t/65536),u[h]=t-o*65536}u[0]+=o-1+37*(o-1)}function f(u,o,h){const t=~(h-1);for(let a=0;a<16;a++){const S=t&(u[a]^o[a]);u[a]^=S,o[a]^=S}}function c(u,o){const h=i(),t=i();for(let a=0;a<16;a++)t[a]=o[a];w(t),w(t),w(t);for(let a=0;a<2;a++){h[0]=t[0]-65517;for(let C=1;C<15;C++)h[C]=t[C]-65535-(h[C-1]>>16&1),h[C-1]&=65535;h[15]=t[15]-32767-(h[14]>>16&1);const S=h[15]>>16&1;h[14]&=65535,f(t,h,1-S)}for(let a=0;a<16;a++)u[2*a]=t[a]&255,u[2*a+1]=t[a]>>8}function d(u,o){for(let h=0;h<16;h++)u[h]=o[2*h]+(o[2*h+1]<<8);u[15]&=32767}function E(u,o,h){for(let t=0;t<16;t++)u[t]=o[t]+h[t]}function y(u,o,h){for(let t=0;t<16;t++)u[t]=o[t]-h[t]}function v(u,o,h){let t,a,S=0,C=0,F=0,L=0,j=0,B=0,T=0,M=0,m=0,N=0,G=0,J=0,X=0,W=0,A=0,I=0,R=0,P=0,H=0,K=0,z=0,q=0,Y=0,$=0,V=0,ve=0,ge=0,me=0,Ne=0,Pe=0,rt=0,Z=h[0],k=h[1],ee=h[2],te=h[3],re=h[4],ne=h[5],ie=h[6],ae=h[7],ue=h[8],fe=h[9],he=h[10],oe=h[11],se=h[12],ce=h[13],le=h[14],De=h[15];t=o[0],S+=t*Z,C+=t*k,F+=t*ee,L+=t*te,j+=t*re,B+=t*ne,T+=t*ie,M+=t*ae,m+=t*ue,N+=t*fe,G+=t*he,J+=t*oe,X+=t*se,W+=t*ce,A+=t*le,I+=t*De,t=o[1],C+=t*Z,F+=t*k,L+=t*ee,j+=t*te,B+=t*re,T+=t*ne,M+=t*ie,m+=t*ae,N+=t*ue,G+=t*fe,J+=t*he,X+=t*oe,W+=t*se,A+=t*ce,I+=t*le,R+=t*De,t=o[2],F+=t*Z,L+=t*k,j+=t*ee,B+=t*te,T+=t*re,M+=t*ne,m+=t*ie,N+=t*ae,G+=t*ue,J+=t*fe,X+=t*he,W+=t*oe,A+=t*se,I+=t*ce,R+=t*le,P+=t*De,t=o[3],L+=t*Z,j+=t*k,B+=t*ee,T+=t*te,M+=t*re,m+=t*ne,N+=t*ie,G+=t*ae,J+=t*ue,X+=t*fe,W+=t*he,A+=t*oe,I+=t*se,R+=t*ce,P+=t*le,H+=t*De,t=o[4],j+=t*Z,B+=t*k,T+=t*ee,M+=t*te,m+=t*re,N+=t*ne,G+=t*ie,J+=t*ae,X+=t*ue,W+=t*fe,A+=t*he,I+=t*oe,R+=t*se,P+=t*ce,H+=t*le,K+=t*De,t=o[5],B+=t*Z,T+=t*k,M+=t*ee,m+=t*te,N+=t*re,G+=t*ne,J+=t*ie,X+=t*ae,W+=t*ue,A+=t*fe,I+=t*he,R+=t*oe,P+=t*se,H+=t*ce,K+=t*le,z+=t*De,t=o[6],T+=t*Z,M+=t*k,m+=t*ee,N+=t*te,G+=t*re,J+=t*ne,X+=t*ie,W+=t*ae,A+=t*ue,I+=t*fe,R+=t*he,P+=t*oe,H+=t*se,K+=t*ce,z+=t*le,q+=t*De,t=o[7],M+=t*Z,m+=t*k,N+=t*ee,G+=t*te,J+=t*re,X+=t*ne,W+=t*ie,A+=t*ae,I+=t*ue,R+=t*fe,P+=t*he,H+=t*oe,K+=t*se,z+=t*ce,q+=t*le,Y+=t*De,t=o[8],m+=t*Z,N+=t*k,G+=t*ee,J+=t*te,X+=t*re,W+=t*ne,A+=t*ie,I+=t*ae,R+=t*ue,P+=t*fe,H+=t*he,K+=t*oe,z+=t*se,q+=t*ce,Y+=t*le,$+=t*De,t=o[9],N+=t*Z,G+=t*k,J+=t*ee,X+=t*te,W+=t*re,A+=t*ne,I+=t*ie,R+=t*ae,P+=t*ue,H+=t*fe,K+=t*he,z+=t*oe,q+=t*se,Y+=t*ce,$+=t*le,V+=t*De,t=o[10],G+=t*Z,J+=t*k,X+=t*ee,W+=t*te,A+=t*re,I+=t*ne,R+=t*ie,P+=t*ae,H+=t*ue,K+=t*fe,z+=t*he,q+=t*oe,Y+=t*se,$+=t*ce,V+=t*le,ve+=t*De,t=o[11],J+=t*Z,X+=t*k,W+=t*ee,A+=t*te,I+=t*re,R+=t*ne,P+=t*ie,H+=t*ae,K+=t*ue,z+=t*fe,q+=t*he,Y+=t*oe,$+=t*se,V+=t*ce,ve+=t*le,ge+=t*De,t=o[12],X+=t*Z,W+=t*k,A+=t*ee,I+=t*te,R+=t*re,P+=t*ne,H+=t*ie,K+=t*ae,z+=t*ue,q+=t*fe,Y+=t*he,$+=t*oe,V+=t*se,ve+=t*ce,ge+=t*le,me+=t*De,t=o[13],W+=t*Z,A+=t*k,I+=t*ee,R+=t*te,P+=t*re,H+=t*ne,K+=t*ie,z+=t*ae,q+=t*ue,Y+=t*fe,$+=t*he,V+=t*oe,ve+=t*se,ge+=t*ce,me+=t*le,Ne+=t*De,t=o[14],A+=t*Z,I+=t*k,R+=t*ee,P+=t*te,H+=t*re,K+=t*ne,z+=t*ie,q+=t*ae,Y+=t*ue,$+=t*fe,V+=t*he,ve+=t*oe,ge+=t*se,me+=t*ce,Ne+=t*le,Pe+=t*De,t=o[15],I+=t*Z,R+=t*k,P+=t*ee,H+=t*te,K+=t*re,z+=t*ne,q+=t*ie,Y+=t*ae,$+=t*ue,V+=t*fe,ve+=t*he,ge+=t*oe,me+=t*se,Ne+=t*ce,Pe+=t*le,rt+=t*De,S+=38*R,C+=38*P,F+=38*H,L+=38*K,j+=38*z,B+=38*q,T+=38*Y,M+=38*$,m+=38*V,N+=38*ve,G+=38*ge,J+=38*me,X+=38*Ne,W+=38*Pe,A+=38*rt,a=1,t=S+a+65535,a=Math.floor(t/65536),S=t-a*65536,t=C+a+65535,a=Math.floor(t/65536),C=t-a*65536,t=F+a+65535,a=Math.floor(t/65536),F=t-a*65536,t=L+a+65535,a=Math.floor(t/65536),L=t-a*65536,t=j+a+65535,a=Math.floor(t/65536),j=t-a*65536,t=B+a+65535,a=Math.floor(t/65536),B=t-a*65536,t=T+a+65535,a=Math.floor(t/65536),T=t-a*65536,t=M+a+65535,a=Math.floor(t/65536),M=t-a*65536,t=m+a+65535,a=Math.floor(t/65536),m=t-a*65536,t=N+a+65535,a=Math.floor(t/65536),N=t-a*65536,t=G+a+65535,a=Math.floor(t/65536),G=t-a*65536,t=J+a+65535,a=Math.floor(t/65536),J=t-a*65536,t=X+a+65535,a=Math.floor(t/65536),X=t-a*65536,t=W+a+65535,a=Math.floor(t/65536),W=t-a*65536,t=A+a+65535,a=Math.floor(t/65536),A=t-a*65536,t=I+a+65535,a=Math.floor(t/65536),I=t-a*65536,S+=a-1+37*(a-1),a=1,t=S+a+65535,a=Math.floor(t/65536),S=t-a*65536,t=C+a+65535,a=Math.floor(t/65536),C=t-a*65536,t=F+a+65535,a=Math.floor(t/65536),F=t-a*65536,t=L+a+65535,a=Math.floor(t/65536),L=t-a*65536,t=j+a+65535,a=Math.floor(t/65536),j=t-a*65536,t=B+a+65535,a=Math.floor(t/65536),B=t-a*65536,t=T+a+65535,a=Math.floor(t/65536),T=t-a*65536,t=M+a+65535,a=Math.floor(t/65536),M=t-a*65536,t=m+a+65535,a=Math.floor(t/65536),m=t-a*65536,t=N+a+65535,a=Math.floor(t/65536),N=t-a*65536,t=G+a+65535,a=Math.floor(t/65536),G=t-a*65536,t=J+a+65535,a=Math.floor(t/65536),J=t-a*65536,t=X+a+65535,a=Math.floor(t/65536),X=t-a*65536,t=W+a+65535,a=Math.floor(t/65536),W=t-a*65536,t=A+a+65535,a=Math.floor(t/65536),A=t-a*65536,t=I+a+65535,a=Math.floor(t/65536),I=t-a*65536,S+=a-1+37*(a-1),u[0]=S,u[1]=C,u[2]=F,u[3]=L,u[4]=j,u[5]=B,u[6]=T,u[7]=M,u[8]=m,u[9]=N,u[10]=G,u[11]=J,u[12]=X,u[13]=W,u[14]=A,u[15]=I}function b(u,o){v(u,o,o)}function g(u,o){const h=i();for(let t=0;t<16;t++)h[t]=o[t];for(let t=253;t>=0;t--)b(h,h),t!==2&&t!==4&&v(h,h,o);for(let t=0;t<16;t++)u[t]=h[t]}function O(u,o){const h=new Uint8Array(32),t=new Float64Array(80),a=i(),S=i(),C=i(),F=i(),L=i(),j=i();for(let m=0;m<31;m++)h[m]=u[m];h[31]=u[31]&127|64,h[0]&=248,d(t,o);for(let m=0;m<16;m++)S[m]=t[m];a[0]=F[0]=1;for(let m=254;m>=0;--m){const N=h[m>>>3]>>>(m&7)&1;f(a,S,N),f(C,F,N),E(L,a,C),y(a,a,C),E(C,S,F),y(S,S,F),b(F,L),b(j,a),v(a,C,a),v(C,S,L),E(L,a,C),y(a,a,C),b(S,a),y(C,F,j),v(a,C,l),E(a,a,F),v(C,C,a),v(a,F,j),v(F,S,t),b(S,L),f(a,S,N),f(C,F,N)}for(let m=0;m<16;m++)t[m+16]=a[m],t[m+32]=C[m],t[m+48]=S[m],t[m+64]=F[m];const B=t.subarray(32),T=t.subarray(16);g(B,B),v(T,T,B);const M=new Uint8Array(32);return c(M,T),M}e.scalarMult=O;function p(u){return O(u,D)}e.scalarMultBase=p;function U(u){if(u.length!==e.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${e.SECRET_KEY_LENGTH} bytes`);const o=new Uint8Array(u);return{publicKey:p(o),secretKey:o}}e.generateKeyPairFromSeed=U;function s(u){const o=(0,r.randomBytes)(32,u),h=U(o);return(0,n.wipe)(o),h}e.generateKeyPair=s;function _(u,o,h=!1){if(u.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(o.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const t=O(u,o);if(h){let a=0;for(let S=0;S<t.length;S++)a|=t[S];if(a===0)throw new Error("X25519: invalid shared key")}return t}e.sharedKey=_})(Tt);function Ar(e,r){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),i=0;i<n.length;i++)n[i]=255;for(var D=0;D<e.length;D++){var l=e.charAt(D),w=l.charCodeAt(0);if(n[w]!==255)throw new TypeError(l+" is ambiguous");n[w]=D}var f=e.length,c=e.charAt(0),d=Math.log(f)/Math.log(256),E=Math.log(256)/Math.log(f);function y(g){if(g instanceof Uint8Array||(ArrayBuffer.isView(g)?g=new Uint8Array(g.buffer,g.byteOffset,g.byteLength):Array.isArray(g)&&(g=Uint8Array.from(g))),!(g instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(g.length===0)return"";for(var O=0,p=0,U=0,s=g.length;U!==s&&g[U]===0;)U++,O++;for(var _=(s-U)*E+1>>>0,u=new Uint8Array(_);U!==s;){for(var o=g[U],h=0,t=_-1;(o!==0||h<p)&&t!==-1;t--,h++)o+=256*u[t]>>>0,u[t]=o%f>>>0,o=o/f>>>0;if(o!==0)throw new Error("Non-zero carry");p=h,U++}for(var a=_-p;a!==_&&u[a]===0;)a++;for(var S=c.repeat(O);a<_;++a)S+=e.charAt(u[a]);return S}function v(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return new Uint8Array;var O=0;if(g[O]!==" "){for(var p=0,U=0;g[O]===c;)p++,O++;for(var s=(g.length-O)*d+1>>>0,_=new Uint8Array(s);g[O];){var u=n[g.charCodeAt(O)];if(u===255)return;for(var o=0,h=s-1;(u!==0||o<U)&&h!==-1;h--,o++)u+=f*_[h]>>>0,_[h]=u%256>>>0,u=u/256>>>0;if(u!==0)throw new Error("Non-zero carry");U=o,O++}if(g[O]!==" "){for(var t=s-U;t!==s&&_[t]===0;)t++;for(var a=new Uint8Array(p+(s-t)),S=p;t!==s;)a[S++]=_[t++];return a}}}function b(g){var O=v(g);if(O)return O;throw new Error(`Non-${r} character`)}return{encode:y,decodeUnsafe:v,decode:b}}var Ur=Ar,Fr=Ur;const Nr=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},Tr=e=>new TextEncoder().encode(e),Mr=e=>new TextDecoder().decode(e);class xr{constructor(r,n,i){this.name=r,this.prefix=n,this.baseEncode=i}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}}class Lr{constructor(r,n,i){if(this.name=r,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=i}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return Mt(this,r)}}class Br{constructor(r){this.decoders=r}or(r){return Mt(this,r)}decode(r){const n=r[0],i=this.decoders[n];if(i)return i.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Mt=(e,r)=>new Br({...e.decoders||{[e.prefix]:e},...r.decoders||{[r.prefix]:r}});class jr{constructor(r,n,i,D){this.name=r,this.prefix=n,this.baseEncode=i,this.baseDecode=D,this.encoder=new xr(r,n,i),this.decoder=new Lr(r,n,D)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}}const Ie=({name:e,prefix:r,encode:n,decode:i})=>new jr(e,r,n,i),Fe=({prefix:e,name:r,alphabet:n})=>{const{encode:i,decode:D}=Fr(n,r);return Ie({prefix:e,name:r,encode:i,decode:l=>Nr(D(l))})},Ir=(e,r,n,i)=>{const D={};for(let E=0;E<r.length;++E)D[r[E]]=E;let l=e.length;for(;e[l-1]==="=";)--l;const w=new Uint8Array(l*n/8|0);let f=0,c=0,d=0;for(let E=0;E<l;++E){const y=D[e[E]];if(y===void 0)throw new SyntaxError(`Non-${i} character`);c=c<<n|y,f+=n,f>=8&&(f-=8,w[d++]=255&c>>f)}if(f>=n||255&c<<8-f)throw new SyntaxError("Unexpected end of data");return w},Rr=(e,r,n)=>{const i=r[r.length-1]==="=",D=(1<<n)-1;let l="",w=0,f=0;for(let c=0;c<e.length;++c)for(f=f<<8|e[c],w+=8;w>n;)w-=n,l+=r[D&f>>w];if(w&&(l+=r[D&f<<n-w]),i)for(;l.length*n&7;)l+="=";return l},Q=({name:e,prefix:r,bitsPerChar:n,alphabet:i})=>Ie({prefix:r,name:e,encode(D){return Rr(D,i,n)},decode(D){return Ir(D,i,n,e)}}),Pr=Ie({prefix:"\0",name:"identity",encode:e=>Mr(e),decode:e=>Tr(e)}),Hr=Object.freeze(Object.defineProperty({__proto__:null,identity:Pr},Symbol.toStringTag,{value:"Module"})),Kr=Q({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),zr=Object.freeze(Object.defineProperty({__proto__:null,base2:Kr},Symbol.toStringTag,{value:"Module"})),qr=Q({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Yr=Object.freeze(Object.defineProperty({__proto__:null,base8:qr},Symbol.toStringTag,{value:"Module"})),$r=Fe({prefix:"9",name:"base10",alphabet:"0123456789"}),Gr=Object.freeze(Object.defineProperty({__proto__:null,base10:$r},Symbol.toStringTag,{value:"Module"})),Vr=Q({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Wr=Q({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Xr=Object.freeze(Object.defineProperty({__proto__:null,base16:Vr,base16upper:Wr},Symbol.toStringTag,{value:"Module"})),Jr=Q({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Qr=Q({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Zr=Q({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),kr=Q({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),en=Q({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),tn=Q({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),rn=Q({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),nn=Q({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),an=Q({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),un=Object.freeze(Object.defineProperty({__proto__:null,base32:Jr,base32hex:en,base32hexpad:rn,base32hexpadupper:nn,base32hexupper:tn,base32pad:Zr,base32padupper:kr,base32upper:Qr,base32z:an},Symbol.toStringTag,{value:"Module"})),fn=Fe({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),hn=Fe({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),on=Object.freeze(Object.defineProperty({__proto__:null,base36:fn,base36upper:hn},Symbol.toStringTag,{value:"Module"})),sn=Fe({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),cn=Fe({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),ln=Object.freeze(Object.defineProperty({__proto__:null,base58btc:sn,base58flickr:cn},Symbol.toStringTag,{value:"Module"})),Dn=Q({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),_n=Q({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),dn=Q({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),En=Q({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),bn=Object.freeze(Object.defineProperty({__proto__:null,base64:Dn,base64pad:_n,base64url:dn,base64urlpad:En},Symbol.toStringTag,{value:"Module"})),xt=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),vn=xt.reduce((e,r,n)=>(e[n]=r,e),[]),wn=xt.reduce((e,r,n)=>(e[r.codePointAt(0)]=n,e),[]);function yn(e){return e.reduce((r,n)=>(r+=vn[n],r),"")}function gn(e){const r=[];for(const n of e){const i=wn[n.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${n}`);r.push(i)}return new Uint8Array(r)}const Sn=Ie({prefix:"🚀",name:"base256emoji",encode:yn,decode:gn}),mn=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:Sn},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;var Lt={};/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -1 +1 @@
1
- "use strict";const i=require("./index-hIJ0h_GZ.js");class b extends i.Hash{constructor(t,o){super(),this.finished=!1,this.destroyed=!1,i.ahash(t);const r=i.toBytes(o);if(this.iHash=t.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,n=new Uint8Array(c);n.set(r.length>c?t.create().update(r).digest():r);for(let s=0;s<n.length;s++)n[s]^=54;this.iHash.update(n),this.oHash=t.create();for(let s=0;s<n.length;s++)n[s]^=106;this.oHash.update(n),n.fill(0)}update(t){return i.aexists(this),this.iHash.update(t),this}digestInto(t){i.aexists(this),i.abytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:o,iHash:r,finished:c,destroyed:n,blockLen:s,outputLen:a}=this;return t=t,t.finished=c,t.destroyed=n,t.blockLen=s,t.outputLen=a,t.oHash=o._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const k=(e,t,o)=>new b(e,t).update(o).digest();k.create=(e,t)=>new b(e,t);function g(e,t,o,r){i.ahash(e);const c=i.checkOpts({dkLen:32,asyncTick:10},r),{c:n,dkLen:s,asyncTick:a}=c;if(i.anumber(n),i.anumber(s),i.anumber(a),n<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const u=i.toBytes(t),d=i.toBytes(o),l=new Uint8Array(s),p=k.create(e,u),h=p._cloneInto().update(d);return{c:n,dkLen:s,asyncTick:a,DK:l,PRF:p,PRFSalt:h}}function I(e,t,o,r,c){return e.destroy(),t.destroy(),r&&r.destroy(),c.fill(0),o}function x(e,t,o,r){const{c,dkLen:n,DK:s,PRF:a,PRFSalt:u}=g(e,t,o,r);let d;const l=new Uint8Array(4),p=i.createView(l),h=new Uint8Array(a.outputLen);for(let w=1,f=0;f<n;w++,f+=a.outputLen){const y=s.subarray(f,f+a.outputLen);p.setInt32(0,w,!1),(d=u._cloneInto(d)).update(l).digestInto(h),y.set(h.subarray(0,y.length));for(let L=1;L<c;L++){a._cloneInto(d).update(h).digestInto(h);for(let H=0;H<y.length;H++)y[H]^=h[H]}}return I(a,u,s,d,h)}/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */function m(e){if(typeof e!="string")throw new TypeError("invalid mnemonic type: "+typeof e);return e.normalize("NFKD")}function A(e){const t=m(e),o=t.split(" ");if(![12,15,18,21,24].includes(o.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:o}}const F=e=>m("mnemonic"+e);function P(e,t=""){return x(i.sha512,A(e).nfkd,F(t),{c:2048,dkLen:64})}exports.hmac=k;exports.mnemonicToSeedSync=P;
1
+ "use strict";const i=require("./index-D5ta6SAe.js");class b extends i.Hash{constructor(t,o){super(),this.finished=!1,this.destroyed=!1,i.ahash(t);const r=i.toBytes(o);if(this.iHash=t.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,n=new Uint8Array(c);n.set(r.length>c?t.create().update(r).digest():r);for(let s=0;s<n.length;s++)n[s]^=54;this.iHash.update(n),this.oHash=t.create();for(let s=0;s<n.length;s++)n[s]^=106;this.oHash.update(n),n.fill(0)}update(t){return i.aexists(this),this.iHash.update(t),this}digestInto(t){i.aexists(this),i.abytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:o,iHash:r,finished:c,destroyed:n,blockLen:s,outputLen:a}=this;return t=t,t.finished=c,t.destroyed=n,t.blockLen=s,t.outputLen=a,t.oHash=o._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const k=(e,t,o)=>new b(e,t).update(o).digest();k.create=(e,t)=>new b(e,t);function g(e,t,o,r){i.ahash(e);const c=i.checkOpts({dkLen:32,asyncTick:10},r),{c:n,dkLen:s,asyncTick:a}=c;if(i.anumber(n),i.anumber(s),i.anumber(a),n<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const u=i.toBytes(t),d=i.toBytes(o),l=new Uint8Array(s),p=k.create(e,u),h=p._cloneInto().update(d);return{c:n,dkLen:s,asyncTick:a,DK:l,PRF:p,PRFSalt:h}}function I(e,t,o,r,c){return e.destroy(),t.destroy(),r&&r.destroy(),c.fill(0),o}function x(e,t,o,r){const{c,dkLen:n,DK:s,PRF:a,PRFSalt:u}=g(e,t,o,r);let d;const l=new Uint8Array(4),p=i.createView(l),h=new Uint8Array(a.outputLen);for(let w=1,f=0;f<n;w++,f+=a.outputLen){const y=s.subarray(f,f+a.outputLen);p.setInt32(0,w,!1),(d=u._cloneInto(d)).update(l).digestInto(h),y.set(h.subarray(0,y.length));for(let L=1;L<c;L++){a._cloneInto(d).update(h).digestInto(h);for(let H=0;H<y.length;H++)y[H]^=h[H]}}return I(a,u,s,d,h)}/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */function m(e){if(typeof e!="string")throw new TypeError("invalid mnemonic type: "+typeof e);return e.normalize("NFKD")}function A(e){const t=m(e),o=t.split(" ");if(![12,15,18,21,24].includes(o.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:o}}const F=e=>m("mnemonic"+e);function P(e,t=""){return x(i.sha512,A(e).nfkd,F(t),{c:2048,dkLen:64})}exports.hmac=k;exports.mnemonicToSeedSync=P;
@@ -1,5 +1,5 @@
1
- import { aO as P, aP as b, aQ as k, aR as g, aH as A, aI as F, aS as O, aT as H, Q as T } from "./index-C6iaLaJq.mjs";
2
- class m extends P {
1
+ import { aO as O, aP as b, aQ as k, aR as g, aH as P, aI as A, aS as F, aT as H, O as T } from "./index-BAhBSTHO.mjs";
2
+ class m extends O {
3
3
  constructor(t, i) {
4
4
  super(), this.finished = !1, this.destroyed = !1, b(t);
5
5
  const o = k(i);
@@ -19,7 +19,7 @@ class m extends P {
19
19
  return g(this), this.iHash.update(t), this;
20
20
  }
21
21
  digestInto(t) {
22
- g(this), A(t, this.outputLen), this.finished = !0, this.iHash.digestInto(t), this.oHash.update(t), this.oHash.digestInto(t), this.destroy();
22
+ g(this), P(t, this.outputLen), this.finished = !0, this.iHash.digestInto(t), this.oHash.update(t), this.oHash.digestInto(t), this.destroy();
23
23
  }
24
24
  digest() {
25
25
  const t = new Uint8Array(this.oHash.outputLen);
@@ -38,7 +38,7 @@ const I = (e, t, i) => new m(e, t).update(i).digest();
38
38
  I.create = (e, t) => new m(e, t);
39
39
  function _(e, t, i, o) {
40
40
  b(e);
41
- const a = O({ dkLen: 32, asyncTick: 10 }, o), { c: s, dkLen: n, asyncTick: r } = a;
41
+ const a = F({ dkLen: 32, asyncTick: 10 }, o), { c: s, dkLen: n, asyncTick: r } = a;
42
42
  if (H(s), H(n), H(r), s < 1)
43
43
  throw new Error("PBKDF2: iterations (c) should be >= 1");
44
44
  const d = k(t), h = k(i), u = new Uint8Array(n), l = I.create(e, d), c = l._cloneInto().update(h);
@@ -50,7 +50,7 @@ function E(e, t, i, o, a) {
50
50
  function R(e, t, i, o) {
51
51
  const { c: a, dkLen: s, DK: n, PRF: r, PRFSalt: d } = _(e, t, i, o);
52
52
  let h;
53
- const u = new Uint8Array(4), l = F(u), c = new Uint8Array(r.outputLen);
53
+ const u = new Uint8Array(4), l = A(u), c = new Uint8Array(r.outputLen);
54
54
  for (let w = 1, p = 0; p < s; w++, p += r.outputLen) {
55
55
  const f = n.subarray(p, p + r.outputLen);
56
56
  l.setInt32(0, w, !1), (h = d._cloneInto(h)).update(u).digestInto(c), f.set(c.subarray(0, f.length));
@@ -1,4 +1,4 @@
1
- import { cD as Mt, aw as xt, cy as Lt, cE as jt, cl as Bt } from "./index-C6iaLaJq.mjs";
1
+ import { cE as Mt, av as xt, cz as Lt, cF as jt, cm as Bt } from "./index-BAhBSTHO.mjs";
2
2
  function It(e, r) {
3
3
  for (var n = 0; n < r.length; n++) {
4
4
  const i = r[n];
@@ -1,6 +1,6 @@
1
1
  const fe = Symbol(), ee = Object.getPrototypeOf, G = /* @__PURE__ */ new WeakMap(), me = (e) => e && (G.has(e) ? G.get(e) : ee(e) === Object.prototype || ee(e) === Array.prototype), ge = (e) => me(e) && e[fe] || null, te = (e, t = !0) => {
2
2
  G.set(e, t);
3
- }, z = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, REACT_APP_CONNECT_GIT_HASH: "f3e2348ce4d17de817ae4eea097fa890dc70f16b", REACT_APP_CONNECT_VERSION: "1.2.0-beta.0-development", SSR: !1 }, q = (e) => typeof e == "object" && e !== null, A = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakSet(), he = (e = Object.is, t = (n, h) => new Proxy(n, h), s = (n) => q(n) && !x.has(n) && (Array.isArray(n) || !(Symbol.iterator in n)) && !(n instanceof WeakMap) && !(n instanceof WeakSet) && !(n instanceof Error) && !(n instanceof Number) && !(n instanceof Date) && !(n instanceof String) && !(n instanceof RegExp) && !(n instanceof ArrayBuffer), r = (n) => {
3
+ }, z = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, REACT_APP_CONNECT_GIT_HASH: "2061a03995ff70ab63be4f5bf27a11075ae4a1c5", REACT_APP_CONNECT_VERSION: "1.3.0-beta.0-development", SSR: !1 }, q = (e) => typeof e == "object" && e !== null, A = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakSet(), he = (e = Object.is, t = (n, h) => new Proxy(n, h), s = (n) => q(n) && !x.has(n) && (Array.isArray(n) || !(Symbol.iterator in n)) && !(n instanceof WeakMap) && !(n instanceof WeakSet) && !(n instanceof Error) && !(n instanceof Number) && !(n instanceof Date) && !(n instanceof String) && !(n instanceof RegExp) && !(n instanceof ArrayBuffer), r = (n) => {
4
4
  switch (n.status) {
5
5
  case "fulfilled":
6
6
  return n.value;
@@ -375,7 +375,7 @@ class _e {
375
375
  }
376
376
  async initUi() {
377
377
  if (typeof window < "u") {
378
- await import("./index-o0AEhklr.mjs");
378
+ await import("./index-CpOpT2eM.mjs");
379
379
  const t = document.createElement("wcm-modal");
380
380
  document.body.insertAdjacentElement("beforeend", t), w.setIsUiLoaded(!0);
381
381
  }
@@ -1,8 +1,8 @@
1
1
  var Y = Object.defineProperty;
2
2
  var Z = (n, f, e) => f in n ? Y(n, f, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[f] = e;
3
3
  var d = (n, f, e) => Z(n, typeof f != "symbol" ? f + "" : f, e);
4
- import { U as y, bg as f0, bh as W, bi as p, bj as e0, bk as a0, bl as t0, bm as _, bn as b0, bo as n0, bp as d0, b4 as L, bq as O, E as v, a as C, br as D, s as U, b8 as u, bs as q, bb as c0, bt as N, bd as H, be as j, b2 as s0, bu as i0, bv as I, b1 as S, a4 as $, bf as V, _ as G } from "./index-C6iaLaJq.mjs";
5
- import "./index-C8__BuqK.mjs";
4
+ import { T as y, bg as f0, bh as W, bi as p, bj as e0, bk as a0, bl as t0, bm as _, bn as b0, bo as n0, bp as d0, b4 as L, bq as O, E as v, a as C, br as D, r as U, b8 as u, bs as q, bb as c0, bt as N, bd as H, be as j, b2 as s0, bu as i0, bv as I, b1 as S, a3 as $, bf as V, _ as G } from "./index-BAhBSTHO.mjs";
5
+ import "./index-CKnJa2J4.mjs";
6
6
  const r0 = new RegExp("^bytes([0-9]+)$"), p0 = new RegExp("^(u?int)([0-9]*)$"), y0 = new RegExp("^(.*)\\[([0-9]*)\\]$");
7
7
  function J(n, f, e) {
8
8
  switch (n) {
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ze=require("./events-Bs7CEKn9.js"),H=require("./index-hIJ0h_GZ.js"),T=require("./index-vWXFBAHR.js"),E=require("./index-S1YybQMR.js");var ne={};Object.defineProperty(ne,"__esModule",{value:!0});ne.getLocalStorage=ne.getLocalStorageOrThrow=ne.getCrypto=ne.getCryptoOrThrow=ne.getLocation=ne.getLocationOrThrow=ne.getNavigator=ne.getNavigatorOrThrow=ne.getDocument=ne.getDocumentOrThrow=ne.getFromWindowOrThrow=ne.getFromWindow=void 0;function or(a){let t;return typeof window<"u"&&typeof window[a]<"u"&&(t=window[a]),t}ne.getFromWindow=or;function $r(a){const t=or(a);if(!t)throw new Error(`${a} is not defined in Window`);return t}ne.getFromWindowOrThrow=$r;function sw(){return $r("document")}ne.getDocumentOrThrow=sw;function nw(){return or("document")}ne.getDocument=nw;function ow(){return $r("navigator")}ne.getNavigatorOrThrow=ow;function aw(){return or("navigator")}ne.getNavigator=aw;function cw(){return $r("location")}ne.getLocationOrThrow=cw;function uw(){return or("location")}ne.getLocation=uw;function hw(){return $r("crypto")}ne.getCryptoOrThrow=hw;function lw(){return or("crypto")}ne.getCrypto=lw;function pw(){return $r("localStorage")}ne.getLocalStorageOrThrow=pw;function dw(){return or("localStorage")}ne.getLocalStorage=dw;var bo={};Object.defineProperty(bo,"__esModule",{value:!0});bo.getWindowMetadata=void 0;const pu=ne;function fw(){let a,t;try{a=pu.getDocumentOrThrow(),t=pu.getLocationOrThrow()}catch{return null}function r(){const O=a.getElementsByTagName("link"),N=[];for(let q=0;q<O.length;q++){const D=O[q],K=D.getAttribute("rel");if(K&&K.toLowerCase().indexOf("icon")>-1){const F=D.getAttribute("href");if(F)if(F.toLowerCase().indexOf("https:")===-1&&F.toLowerCase().indexOf("http:")===-1&&F.indexOf("//")!==0){let G=t.protocol+"//"+t.host;if(F.indexOf("/")===0)G+=F;else{const de=t.pathname.split("/");de.pop();const Z=de.join("/");G+=Z+"/"+F}N.push(G)}else if(F.indexOf("//")===0){const G=t.protocol+F;N.push(G)}else N.push(F)}}return N}function s(...O){const N=a.getElementsByTagName("meta");for(let q=0;q<N.length;q++){const D=N[q],K=["itemprop","property","name"].map(F=>D.getAttribute(F)).filter(F=>F?O.includes(F):!1);if(K.length&&K){const F=D.getAttribute("content");if(F)return F}}return""}function o(){let O=s("name","og:site_name","og:title","twitter:title");return O||(O=a.title),O}function u(){return s("description","og:description","twitter:description","keywords")}const l=o(),f=u(),w=t.origin,b=r();return{description:f,url:w,icons:b,name:l}}bo.getWindowMetadata=fw;function gw(a,t=[]){const r=[];return Object.keys(a).forEach(s=>{if(t.length&&!t.includes(s))return;const o=a[s];r.push(...o.accounts)}),r}const yw={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}};function vw(a,t){const{message:r,code:s}=yw[a];return{message:r,code:s}}function co(a,t){return!!Array.isArray(a)}var Ar={};/*! *****************************************************************************
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ze=require("./events-Bu0pqh5u.js"),H=require("./index-D5ta6SAe.js"),T=require("./index-OdUgDqqR.js"),E=require("./index-DFS9XfYE.js");var ne={};Object.defineProperty(ne,"__esModule",{value:!0});ne.getLocalStorage=ne.getLocalStorageOrThrow=ne.getCrypto=ne.getCryptoOrThrow=ne.getLocation=ne.getLocationOrThrow=ne.getNavigator=ne.getNavigatorOrThrow=ne.getDocument=ne.getDocumentOrThrow=ne.getFromWindowOrThrow=ne.getFromWindow=void 0;function or(a){let t;return typeof window<"u"&&typeof window[a]<"u"&&(t=window[a]),t}ne.getFromWindow=or;function $r(a){const t=or(a);if(!t)throw new Error(`${a} is not defined in Window`);return t}ne.getFromWindowOrThrow=$r;function sw(){return $r("document")}ne.getDocumentOrThrow=sw;function nw(){return or("document")}ne.getDocument=nw;function ow(){return $r("navigator")}ne.getNavigatorOrThrow=ow;function aw(){return or("navigator")}ne.getNavigator=aw;function cw(){return $r("location")}ne.getLocationOrThrow=cw;function uw(){return or("location")}ne.getLocation=uw;function hw(){return $r("crypto")}ne.getCryptoOrThrow=hw;function lw(){return or("crypto")}ne.getCrypto=lw;function pw(){return $r("localStorage")}ne.getLocalStorageOrThrow=pw;function dw(){return or("localStorage")}ne.getLocalStorage=dw;var bo={};Object.defineProperty(bo,"__esModule",{value:!0});bo.getWindowMetadata=void 0;const pu=ne;function fw(){let a,t;try{a=pu.getDocumentOrThrow(),t=pu.getLocationOrThrow()}catch{return null}function r(){const O=a.getElementsByTagName("link"),N=[];for(let q=0;q<O.length;q++){const D=O[q],K=D.getAttribute("rel");if(K&&K.toLowerCase().indexOf("icon")>-1){const F=D.getAttribute("href");if(F)if(F.toLowerCase().indexOf("https:")===-1&&F.toLowerCase().indexOf("http:")===-1&&F.indexOf("//")!==0){let G=t.protocol+"//"+t.host;if(F.indexOf("/")===0)G+=F;else{const de=t.pathname.split("/");de.pop();const Z=de.join("/");G+=Z+"/"+F}N.push(G)}else if(F.indexOf("//")===0){const G=t.protocol+F;N.push(G)}else N.push(F)}}return N}function s(...O){const N=a.getElementsByTagName("meta");for(let q=0;q<N.length;q++){const D=N[q],K=["itemprop","property","name"].map(F=>D.getAttribute(F)).filter(F=>F?O.includes(F):!1);if(K.length&&K){const F=D.getAttribute("content");if(F)return F}}return""}function o(){let O=s("name","og:site_name","og:title","twitter:title");return O||(O=a.title),O}function u(){return s("description","og:description","twitter:description","keywords")}const l=o(),f=u(),w=t.origin,b=r();return{description:f,url:w,icons:b,name:l}}bo.getWindowMetadata=fw;function gw(a,t=[]){const r=[];return Object.keys(a).forEach(s=>{if(t.length&&!t.includes(s))return;const o=a[s];r.push(...o.accounts)}),r}const yw={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}};function vw(a,t){const{message:r,code:s}=yw[a];return{message:r,code:s}}function co(a,t){return!!Array.isArray(a)}var Ar={};/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -43,4 +43,4 @@ __p += '`),Y&&(R+=`' +
43
43
  function print() { __p += __j.call(arguments, '') }
44
44
  `:`;
45
45
  `)+R+`return __p
46
- }`;var B=uu(function(){return ee(d,j+"return "+R).apply(r,g)});if(B.source=R,Un(B))throw B;return B}function lm(e){return te(e).toLowerCase()}function pm(e){return te(e).toUpperCase()}function dm(e,i,n){if(e=te(e),e&&(n||i===r))return ma(e);if(!e||!(i=Be(i)))return e;var c=at(e),h=at(i),d=wa(c,h),g=_a(c,h)+1;return kt(c,d,g).join("")}function fm(e,i,n){if(e=te(e),e&&(n||i===r))return e.slice(0,Ea(e)+1);if(!e||!(i=Be(i)))return e;var c=at(e),h=_a(c,at(i))+1;return kt(c,0,h).join("")}function gm(e,i,n){if(e=te(e),e&&(n||i===r))return e.replace(qs,"");if(!e||!(i=Be(i)))return e;var c=at(e),h=wa(c,at(i));return kt(c,h).join("")}function ym(e,i){var n=cl,c=ul;if(le(i)){var h="separator"in i?i.separator:h;n="length"in i?V(i.length):n,c="omission"in i?Be(i.omission):c}e=te(e);var d=e.length;if(fr(e)){var g=at(e);d=g.length}if(n>=d)return e;var y=n-gr(c);if(y<1)return c;var m=g?kt(g,0,y).join(""):e.slice(0,y);if(h===r)return m+c;if(g&&(y+=m.length-y),Mn(h)){if(e.slice(y).search(h)){var P,S=m;for(h.global||(h=en(h.source,te(Lo.exec(h))+"g")),h.lastIndex=0;P=h.exec(S);)var R=P.index;m=m.slice(0,R===r?y:R)}}else if(e.indexOf(Be(h),y)!=y){var A=m.lastIndexOf(h);A>-1&&(m=m.slice(0,A))}return m+c}function vm(e){return e=te(e),e&&Rl.test(e)?e.replace(qo,Bp):e}var mm=Er(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),zn=hc("toUpperCase");function cu(e,i,n){return e=te(e),i=n?r:i,i===r?Lp(e)?Jp(e):Ap(e):e.match(i)||[]}var uu=W(function(e,i){try{return He(e,r,i)}catch(n){return Un(n)?n:new k(n)}}),wm=It(function(e,i){return Ye(i,function(n){n=yt(n),bt(e,n,jn(e[n],e))}),e});function _m(e){var i=e==null?0:e.length,n=U();return e=i?ue(e,function(c){if(typeof c[1]!="function")throw new Ze(l);return[n(c[0]),c[1]]}):[],W(function(c){for(var h=-1;++h<i;){var d=e[h];if(He(d[0],this,c))return He(d[1],this,c)}})}function bm(e){return Bd(et(e,O))}function Hn(e){return function(){return e}}function Em(e,i){return e==null||e!==e?i:e}var Im=pc(),Pm=pc(!0);function Ue(e){return e}function Vn(e){return za(typeof e=="function"?e:et(e,O))}function Sm(e){return Va(et(e,O))}function Om(e,i){return Ba(e,et(i,O))}var Rm=W(function(e,i){return function(n){return Yr(n,e,i)}}),Nm=W(function(e,i){return function(n){return Yr(e,n,i)}});function Bn(e,i,n){var c=be(i),h=Ki(i,c);n==null&&!(le(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Ki(i,be(i)));var d=!(le(n)&&"chain"in n)||!!n.chain,g=St(e);return Ye(h,function(y){var m=i[y];e[y]=m,g&&(e.prototype[y]=function(){var P=this.__chain__;if(d||P){var S=e(this.__wrapped__),R=S.__actions__=Fe(this.__actions__);return R.push({func:m,args:arguments,thisArg:e}),S.__chain__=P,S}return m.apply(e,Ft([this.value()],arguments))})}),e}function Cm(){return Ie._===this&&(Ie._=ed),this}function Kn(){}function $m(e){return e=V(e),W(function(i){return Ka(i,e)})}var Am=In(ue),Tm=In(da),xm=In(Ws);function hu(e){return $n(e)?Js(yt(e)):uf(e)}function Dm(e){return function(i){return e==null?r:Xt(e,i)}}var Fm=fc(),jm=fc(!0);function Wn(){return[]}function Jn(){return!1}function qm(){return{}}function Um(){return""}function Mm(){return!0}function Lm(e,i){if(e=V(e),e<1||e>xt)return[];var n=dt,c=Oe(e,dt);i=U(i),e-=dt;for(var h=Ys(c,i);++n<e;)i(n);return h}function km(e){return z(e)?ue(e,yt):Ke(e)?[e]:Fe($c(te(e)))}function zm(e){var i=++Zp;return te(e)+i}var Hm=Zi(function(e,i){return e+i},0),Vm=Pn("ceil"),Bm=Zi(function(e,i){return e/i},1),Km=Pn("floor");function Wm(e){return e&&e.length?Bi(e,Ue,un):r}function Jm(e,i){return e&&e.length?Bi(e,U(i,2),un):r}function Gm(e){return ya(e,Ue)}function Qm(e,i){return ya(e,U(i,2))}function Ym(e){return e&&e.length?Bi(e,Ue,dn):r}function Zm(e,i){return e&&e.length?Bi(e,U(i,2),dn):r}var Xm=Zi(function(e,i){return e*i},1),ew=Pn("round"),tw=Zi(function(e,i){return e-i},0);function rw(e){return e&&e.length?Qs(e,Ue):0}function iw(e,i){return e&&e.length?Qs(e,U(i,2)):0}return p.after=Sy,p.ary=kc,p.assign=pv,p.assignIn=tu,p.assignInWith=ls,p.assignWith=dv,p.at=fv,p.before=zc,p.bind=jn,p.bindAll=wm,p.bindKey=Hc,p.castArray=qy,p.chain=Uc,p.chunk=Kf,p.compact=Wf,p.concat=Jf,p.cond=_m,p.conforms=bm,p.constant=Hn,p.countBy=ry,p.create=gv,p.curry=Vc,p.curryRight=Bc,p.debounce=Kc,p.defaults=yv,p.defaultsDeep=vv,p.defer=Oy,p.delay=Ry,p.difference=Gf,p.differenceBy=Qf,p.differenceWith=Yf,p.drop=Zf,p.dropRight=Xf,p.dropRightWhile=eg,p.dropWhile=tg,p.fill=rg,p.filter=sy,p.flatMap=ay,p.flatMapDeep=cy,p.flatMapDepth=uy,p.flatten=Dc,p.flattenDeep=ig,p.flattenDepth=sg,p.flip=Ny,p.flow=Im,p.flowRight=Pm,p.fromPairs=ng,p.functions=Pv,p.functionsIn=Sv,p.groupBy=hy,p.initial=ag,p.intersection=cg,p.intersectionBy=ug,p.intersectionWith=hg,p.invert=Rv,p.invertBy=Nv,p.invokeMap=py,p.iteratee=Vn,p.keyBy=dy,p.keys=be,p.keysIn=qe,p.map=ns,p.mapKeys=$v,p.mapValues=Av,p.matches=Sm,p.matchesProperty=Om,p.memoize=as,p.merge=Tv,p.mergeWith=ru,p.method=Rm,p.methodOf=Nm,p.mixin=Bn,p.negate=cs,p.nthArg=$m,p.omit=xv,p.omitBy=Dv,p.once=Cy,p.orderBy=fy,p.over=Am,p.overArgs=$y,p.overEvery=Tm,p.overSome=xm,p.partial=qn,p.partialRight=Wc,p.partition=gy,p.pick=Fv,p.pickBy=iu,p.property=hu,p.propertyOf=Dm,p.pull=fg,p.pullAll=jc,p.pullAllBy=gg,p.pullAllWith=yg,p.pullAt=vg,p.range=Fm,p.rangeRight=jm,p.rearg=Ay,p.reject=my,p.remove=mg,p.rest=Ty,p.reverse=Dn,p.sampleSize=_y,p.set=qv,p.setWith=Uv,p.shuffle=by,p.slice=wg,p.sortBy=Py,p.sortedUniq=Og,p.sortedUniqBy=Rg,p.split=am,p.spread=xy,p.tail=Ng,p.take=Cg,p.takeRight=$g,p.takeRightWhile=Ag,p.takeWhile=Tg,p.tap=Wg,p.throttle=Dy,p.thru=ss,p.toArray=Zc,p.toPairs=su,p.toPairsIn=nu,p.toPath=km,p.toPlainObject=eu,p.transform=Mv,p.unary=Fy,p.union=xg,p.unionBy=Dg,p.unionWith=Fg,p.uniq=jg,p.uniqBy=qg,p.uniqWith=Ug,p.unset=Lv,p.unzip=Fn,p.unzipWith=qc,p.update=kv,p.updateWith=zv,p.values=Sr,p.valuesIn=Hv,p.without=Mg,p.words=cu,p.wrap=jy,p.xor=Lg,p.xorBy=kg,p.xorWith=zg,p.zip=Hg,p.zipObject=Vg,p.zipObjectDeep=Bg,p.zipWith=Kg,p.entries=su,p.entriesIn=nu,p.extend=tu,p.extendWith=ls,Bn(p,p),p.add=Hm,p.attempt=uu,p.camelCase=Wv,p.capitalize=ou,p.ceil=Vm,p.clamp=Vv,p.clone=Uy,p.cloneDeep=Ly,p.cloneDeepWith=ky,p.cloneWith=My,p.conformsTo=zy,p.deburr=au,p.defaultTo=Em,p.divide=Bm,p.endsWith=Jv,p.eq=ut,p.escape=Gv,p.escapeRegExp=Qv,p.every=iy,p.find=ny,p.findIndex=Tc,p.findKey=mv,p.findLast=oy,p.findLastIndex=xc,p.findLastKey=wv,p.floor=Km,p.forEach=Mc,p.forEachRight=Lc,p.forIn=_v,p.forInRight=bv,p.forOwn=Ev,p.forOwnRight=Iv,p.get=Ln,p.gt=Hy,p.gte=Vy,p.has=Ov,p.hasIn=kn,p.head=Fc,p.identity=Ue,p.includes=ly,p.indexOf=og,p.inRange=Bv,p.invoke=Cv,p.isArguments=rr,p.isArray=z,p.isArrayBuffer=By,p.isArrayLike=je,p.isArrayLikeObject=ge,p.isBoolean=Ky,p.isBuffer=zt,p.isDate=Wy,p.isElement=Jy,p.isEmpty=Gy,p.isEqual=Qy,p.isEqualWith=Yy,p.isError=Un,p.isFinite=Zy,p.isFunction=St,p.isInteger=Jc,p.isLength=us,p.isMap=Gc,p.isMatch=Xy,p.isMatchWith=ev,p.isNaN=tv,p.isNative=rv,p.isNil=sv,p.isNull=iv,p.isNumber=Qc,p.isObject=le,p.isObjectLike=pe,p.isPlainObject=ii,p.isRegExp=Mn,p.isSafeInteger=nv,p.isSet=Yc,p.isString=hs,p.isSymbol=Ke,p.isTypedArray=Pr,p.isUndefined=ov,p.isWeakMap=av,p.isWeakSet=cv,p.join=lg,p.kebabCase=Yv,p.last=rt,p.lastIndexOf=pg,p.lowerCase=Zv,p.lowerFirst=Xv,p.lt=uv,p.lte=hv,p.max=Wm,p.maxBy=Jm,p.mean=Gm,p.meanBy=Qm,p.min=Ym,p.minBy=Zm,p.stubArray=Wn,p.stubFalse=Jn,p.stubObject=qm,p.stubString=Um,p.stubTrue=Mm,p.multiply=Xm,p.nth=dg,p.noConflict=Cm,p.noop=Kn,p.now=os,p.pad=em,p.padEnd=tm,p.padStart=rm,p.parseInt=im,p.random=Kv,p.reduce=yy,p.reduceRight=vy,p.repeat=sm,p.replace=nm,p.result=jv,p.round=ew,p.runInContext=v,p.sample=wy,p.size=Ey,p.snakeCase=om,p.some=Iy,p.sortedIndex=_g,p.sortedIndexBy=bg,p.sortedIndexOf=Eg,p.sortedLastIndex=Ig,p.sortedLastIndexBy=Pg,p.sortedLastIndexOf=Sg,p.startCase=cm,p.startsWith=um,p.subtract=tw,p.sum=rw,p.sumBy=iw,p.template=hm,p.times=Lm,p.toFinite=Ot,p.toInteger=V,p.toLength=Xc,p.toLower=lm,p.toNumber=it,p.toSafeInteger=lv,p.toString=te,p.toUpper=pm,p.trim=dm,p.trimEnd=fm,p.trimStart=gm,p.truncate=ym,p.unescape=vm,p.uniqueId=zm,p.upperCase=mm,p.upperFirst=zn,p.each=Mc,p.eachRight=Lc,p.first=Fc,Bn(p,function(){var e={};return ft(p,function(i,n){re.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,Ye(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),Ye(["drop","take"],function(e,i){Q.prototype[e]=function(n){n=n===r?1:_e(V(n),0);var c=this.__filtered__&&!i?new Q(this):this.clone();return c.__filtered__?c.__takeCount__=Oe(n,c.__takeCount__):c.__views__.push({size:Oe(n,dt),type:e+(c.__dir__<0?"Right":"")}),c},Q.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Ye(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==Do||n==dl;Q.prototype[e]=function(h){var d=this.clone();return d.__iteratees__.push({iteratee:U(h,3),type:n}),d.__filtered__=d.__filtered__||c,d}}),Ye(["head","last"],function(e,i){var n="take"+(i?"Right":"");Q.prototype[e]=function(){return this[n](1).value()[0]}}),Ye(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");Q.prototype[e]=function(){return this.__filtered__?new Q(this):this[n](1)}}),Q.prototype.compact=function(){return this.filter(Ue)},Q.prototype.find=function(e){return this.filter(e).head()},Q.prototype.findLast=function(e){return this.reverse().find(e)},Q.prototype.invokeMap=W(function(e,i){return typeof e=="function"?new Q(this):this.map(function(n){return Yr(n,e,i)})}),Q.prototype.reject=function(e){return this.filter(cs(U(e)))},Q.prototype.slice=function(e,i){e=V(e);var n=this;return n.__filtered__&&(e>0||i<0)?new Q(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=V(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},Q.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Q.prototype.toArray=function(){return this.take(dt)},ft(Q.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],d=c||/^find/.test(i);h&&(p.prototype[i]=function(){var g=this.__wrapped__,y=c?[1]:arguments,m=g instanceof Q,P=y[0],S=m||z(g),R=function(J){var Y=h.apply(p,Ft([J],y));return c&&A?Y[0]:Y};S&&n&&typeof P=="function"&&P.length!=1&&(m=S=!1);var A=this.__chain__,j=!!this.__actions__.length,M=d&&!A,B=m&&!j;if(!d&&S){g=B?g:new Q(this);var L=e.apply(g,y);return L.__actions__.push({func:ss,args:[R],thisArg:r}),new Xe(L,A)}return M&&B?e.apply(this,y):(L=this.thru(R),M?c?L.value()[0]:L.value():L)})}),Ye(["pop","push","shift","sort","splice","unshift"],function(e){var i=$i[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var d=this.value();return i.apply(z(d)?d:[],h)}return this[n](function(g){return i.apply(z(g)?g:[],h)})}}),ft(Q.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";re.call(wr,c)||(wr[c]=[]),wr[c].push({name:i,func:n})}}),wr[Yi(r,G).name]=[{name:"wrapper",func:r}],Q.prototype.clone=yd,Q.prototype.reverse=vd,Q.prototype.value=md,p.prototype.at=Jg,p.prototype.chain=Gg,p.prototype.commit=Qg,p.prototype.next=Yg,p.prototype.plant=Xg,p.prototype.reverse=ey,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=ty,p.prototype.first=p.prototype.head,Vr&&(p.prototype[Vr]=Zg),p},yr=Gp();Jt?((Jt.exports=yr)._=yr,Hs._=yr):Ie._=yr}).call(hi)})(_o,_o.exports);var iI=Object.defineProperty,sI=Object.defineProperties,nI=Object.getOwnPropertyDescriptors,fh=Object.getOwnPropertySymbols,oI=Object.prototype.hasOwnProperty,aI=Object.prototype.propertyIsEnumerable,gh=(a,t,r)=>t in a?iI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,fs=(a,t)=>{for(var r in t||(t={}))oI.call(t,r)&&gh(a,r,t[r]);if(fh)for(var r of fh(t))aI.call(t,r)&&gh(a,r,t[r]);return a},cI=(a,t)=>sI(a,nI(t));function Bt(a,t,r){var s;const o=C0(a);return((s=t.rpcMap)==null?void 0:s[o.reference])||`${rI}?chainId=${o.namespace}:${o.reference}&projectId=${r}`}function ur(a){return a.includes(":")?a.split(":")[1]:a}function sl(a){return a.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function uI(a,t){const r=Object.keys(t.namespaces).filter(o=>o.includes(a));if(!r.length)return[];const s=[];return r.forEach(o=>{const u=t.namespaces[o].accounts;s.push(...u)}),s}function hI(a={},t={}){const r=yh(a),s=yh(t);return _o.exports.merge(r,s)}function yh(a){var t,r,s,o;const u={};if(!Cr(a))return u;for(const[l,f]of Object.entries(a)){const w=No(l)?[l]:f.chains,b=f.methods||[],C=f.events||[],O=f.rpcMap||{},N=li(l);u[N]=cI(fs(fs({},u[N]),f),{chains:Yn(w,(t=u[N])==null?void 0:t.chains),methods:Yn(b,(r=u[N])==null?void 0:r.methods),events:Yn(C,(s=u[N])==null?void 0:s.events),rpcMap:fs(fs({},O),(o=u[N])==null?void 0:o.rpcMap)})}return u}function lI(a){return a.includes(":")?a.split(":")[2]:a}function pI(a){const t={};for(const[r,s]of Object.entries(a)){const o=s.methods||[],u=s.events||[],l=s.accounts||[],f=No(r)?[r]:s.chains?s.chains:sl(s.accounts);t[r]={chains:f,methods:o,events:u,accounts:l}}return t}function so(a){return typeof a=="number"?a:a.includes("0x")?parseInt(a,16):a.includes(":")?Number(a.split(":")[1]):Number(a)}const nl={},he=a=>nl[a],no=(a,t)=>{nl[a]=t};class dI{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class fI{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||Bt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=parseInt(ur(r));t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let o=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";o=o.startsWith("0x")?o:`0x${o}`;const u=parseInt(o,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:o}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class gI{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class yI{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class vI{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),o=ur(r);t[o]=this.createHttpProvider(o,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class mI{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class wI{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class _I{constructor(t){this.name="near",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||Bt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace);return typeof s>"u"?void 0:new $t(new Kt(s,he("disableProviderPing")))}}var bI=Object.defineProperty,EI=Object.defineProperties,II=Object.getOwnPropertyDescriptors,vh=Object.getOwnPropertySymbols,PI=Object.prototype.hasOwnProperty,SI=Object.prototype.propertyIsEnumerable,mh=(a,t,r)=>t in a?bI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,gs=(a,t)=>{for(var r in t||(t={}))PI.call(t,r)&&mh(a,r,t[r]);if(vh)for(var r of vh(t))SI.call(t,r)&&mh(a,r,t[r]);return a},oo=(a,t)=>EI(a,II(t));class xo{constructor(t){this.events=new ze.ss,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:E.Tt(E.k({level:(t==null?void 0:t.logger)||ph})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new xo(t);return await r.initialize(),r}async request(t,r){const[s,o]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:gs({},t),chainId:`${s}:${o}`,topic:this.session.topic})}sendAsync(t,r,s){const o=new Date().getTime();this.request(t,s).then(u=>r(null,E.formatJsonRpcResult(o,u))).catch(u=>r(u,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:ve("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:o}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await o().then(u=>{this.session=u,this.namespaces||(this.namespaces=pI(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==rl)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,o]=this.validateChain(t);this.getProvider(s).setDefaultChain(o,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(nr(r)){for(const s of r)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await zE.init({logger:this.providerOpts.logger||ph,relayUrl:this.providerOpts.relayUrl||XE,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>li(r)))];no("client",this.client),no("events",this.events),no("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=uI(r,this.session),o=sl(s),u=hI(this.namespaces,this.optionalNamespaces),l=oo(gs({},u[r]),{accounts:s,chains:o});switch(r){case"eip155":this.rpcProviders[r]=new fI({namespace:l});break;case"solana":this.rpcProviders[r]=new gI({namespace:l});break;case"cosmos":this.rpcProviders[r]=new yI({namespace:l});break;case"polkadot":this.rpcProviders[r]=new dI({namespace:l});break;case"cip34":this.rpcProviders[r]=new vI({namespace:l});break;case"elrond":this.rpcProviders[r]=new mI({namespace:l});break;case"multiversx":this.rpcProviders[r]=new wI({namespace:l});break;case"near":this.rpcProviders[r]=new _I({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const o=s.data;o&&nr(o)&&this.events.emit("accountsChanged",o.map(lI))}else if(s.name==="chainChanged"){const o=r.chainId,u=r.event.data,l=li(o),f=so(o)!==so(u)?`${l}:${so(u)}`:o;this.onChainChanged(f)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:o}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=oo(gs({},u),{namespaces:o}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",oo(gs({},ve("USER_DISCONNECTED")),{data:t.topic}))}),this.on(At.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:o}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=o,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>li(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const o=li(Object.keys(this.namespaces)[0]),u=this.rpcProviders[o].getDefaultChain();return[o,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[o,u]=this.validateChain(t);r||this.getProvider(o).setDefaultChain(u),((s=this.namespaces[o])!=null?s:this.namespaces[`${o}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,r){this.client.core.storage.setItem(`${dh}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${dh}/${t}`)}}const OI=xo,RI="wc",NI="ethereum_provider",CI=`${RI}@2:${NI}:`,$I="https://rpc.walletconnect.com/v1/",_s=["eth_sendTransaction","personal_sign"],ol=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],bs=["chainChanged","accountsChanged"],al=["chainChanged","accountsChanged","message","disconnect","connect"];var AI=Object.defineProperty,TI=Object.defineProperties,xI=Object.getOwnPropertyDescriptors,wh=Object.getOwnPropertySymbols,DI=Object.prototype.hasOwnProperty,FI=Object.prototype.propertyIsEnumerable,_h=(a,t,r)=>t in a?AI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,di=(a,t)=>{for(var r in t||(t={}))DI.call(t,r)&&_h(a,r,t[r]);if(wh)for(var r of wh(t))FI.call(t,r)&&_h(a,r,t[r]);return a},bh=(a,t)=>TI(a,xI(t));function Es(a){return Number(a[0].split(":")[1])}function ao(a){return`0x${a.toString(16)}`}function jI(a){const{chains:t,optionalChains:r,methods:s,optionalMethods:o,events:u,optionalEvents:l,rpcMap:f}=a;if(!co(t))throw new Error("Invalid chains");const w={chains:t,methods:s||_s,events:u||bs,rpcMap:di({},t.length?{[Es(t)]:f[Es(t)]}:{})},b=u==null?void 0:u.filter(q=>!bs.includes(q)),C=s==null?void 0:s.filter(q=>!_s.includes(q));if(!r&&!l&&!o&&!(b!=null&&b.length)&&!(C!=null&&C.length))return{required:t.length?w:void 0};const O=(b==null?void 0:b.length)&&(C==null?void 0:C.length)||!r,N={chains:[...new Set(O?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(o!=null&&o.length?o:ol))],events:[...new Set(w.events.concat(l!=null&&l.length?l:al))],rpcMap:f};return{required:t.length?w:void 0,optional:r.length?N:void 0}}class Os{constructor(){this.events=new ze.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=CI,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new Os;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=jI(this.rpc);try{const o=await new Promise(async(l,f)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(b=>{!b.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(bh(di({namespaces:di({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(b=>{l(b)}).catch(b=>{f(new Error(b.message))})});if(!o)return;const u=gw(o.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:ao(this.chainId)})}catch(o){throw this.signer.logger.error(o),o}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",ao(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",bh(di({},vw("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",ao(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,o]=t.split(":");return{chainId:`${r}:${s}`,address:o}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const o=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=o.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=o.length?(t==null?void 0:t.methods)||_s:[],w=o.length?(t==null?void 0:t.events)||bs:[],b=(t==null?void 0:t.optionalMethods)||[],C=(t==null?void 0:t.optionalEvents)||[],O=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),N=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:o==null?void 0:o.map(q=>this.formatChainId(q)),optionalChains:u.map(q=>this.formatChainId(q)),methods:f,events:w,optionalMethods:b,optionalEvents:C,rpcMap:O,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:N,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(o=>{s[o]=this.getRpcUrl(o,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Es(this.rpc.chains):Es(this.rpc.optionalChains),this.signer=await OI.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await Promise.resolve().then(()=>require("./index-CqSLXgKG.js")).then(o=>o.index);r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(di({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:o}=t;r&&co(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)})),s&&co(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${$I}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const qI=Os;exports.EthereumProvider=qI;exports.OPTIONAL_EVENTS=al;exports.OPTIONAL_METHODS=ol;exports.REQUIRED_EVENTS=bs;exports.REQUIRED_METHODS=_s;exports.default=Os;
46
+ }`;var B=uu(function(){return ee(d,j+"return "+R).apply(r,g)});if(B.source=R,Un(B))throw B;return B}function lm(e){return te(e).toLowerCase()}function pm(e){return te(e).toUpperCase()}function dm(e,i,n){if(e=te(e),e&&(n||i===r))return ma(e);if(!e||!(i=Be(i)))return e;var c=at(e),h=at(i),d=wa(c,h),g=_a(c,h)+1;return kt(c,d,g).join("")}function fm(e,i,n){if(e=te(e),e&&(n||i===r))return e.slice(0,Ea(e)+1);if(!e||!(i=Be(i)))return e;var c=at(e),h=_a(c,at(i))+1;return kt(c,0,h).join("")}function gm(e,i,n){if(e=te(e),e&&(n||i===r))return e.replace(qs,"");if(!e||!(i=Be(i)))return e;var c=at(e),h=wa(c,at(i));return kt(c,h).join("")}function ym(e,i){var n=cl,c=ul;if(le(i)){var h="separator"in i?i.separator:h;n="length"in i?V(i.length):n,c="omission"in i?Be(i.omission):c}e=te(e);var d=e.length;if(fr(e)){var g=at(e);d=g.length}if(n>=d)return e;var y=n-gr(c);if(y<1)return c;var m=g?kt(g,0,y).join(""):e.slice(0,y);if(h===r)return m+c;if(g&&(y+=m.length-y),Mn(h)){if(e.slice(y).search(h)){var P,S=m;for(h.global||(h=en(h.source,te(Lo.exec(h))+"g")),h.lastIndex=0;P=h.exec(S);)var R=P.index;m=m.slice(0,R===r?y:R)}}else if(e.indexOf(Be(h),y)!=y){var A=m.lastIndexOf(h);A>-1&&(m=m.slice(0,A))}return m+c}function vm(e){return e=te(e),e&&Rl.test(e)?e.replace(qo,Bp):e}var mm=Er(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),zn=hc("toUpperCase");function cu(e,i,n){return e=te(e),i=n?r:i,i===r?Lp(e)?Jp(e):Ap(e):e.match(i)||[]}var uu=W(function(e,i){try{return He(e,r,i)}catch(n){return Un(n)?n:new k(n)}}),wm=It(function(e,i){return Ye(i,function(n){n=yt(n),bt(e,n,jn(e[n],e))}),e});function _m(e){var i=e==null?0:e.length,n=U();return e=i?ue(e,function(c){if(typeof c[1]!="function")throw new Ze(l);return[n(c[0]),c[1]]}):[],W(function(c){for(var h=-1;++h<i;){var d=e[h];if(He(d[0],this,c))return He(d[1],this,c)}})}function bm(e){return Bd(et(e,O))}function Hn(e){return function(){return e}}function Em(e,i){return e==null||e!==e?i:e}var Im=pc(),Pm=pc(!0);function Ue(e){return e}function Vn(e){return za(typeof e=="function"?e:et(e,O))}function Sm(e){return Va(et(e,O))}function Om(e,i){return Ba(e,et(i,O))}var Rm=W(function(e,i){return function(n){return Yr(n,e,i)}}),Nm=W(function(e,i){return function(n){return Yr(e,n,i)}});function Bn(e,i,n){var c=be(i),h=Ki(i,c);n==null&&!(le(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Ki(i,be(i)));var d=!(le(n)&&"chain"in n)||!!n.chain,g=St(e);return Ye(h,function(y){var m=i[y];e[y]=m,g&&(e.prototype[y]=function(){var P=this.__chain__;if(d||P){var S=e(this.__wrapped__),R=S.__actions__=Fe(this.__actions__);return R.push({func:m,args:arguments,thisArg:e}),S.__chain__=P,S}return m.apply(e,Ft([this.value()],arguments))})}),e}function Cm(){return Ie._===this&&(Ie._=ed),this}function Kn(){}function $m(e){return e=V(e),W(function(i){return Ka(i,e)})}var Am=In(ue),Tm=In(da),xm=In(Ws);function hu(e){return $n(e)?Js(yt(e)):uf(e)}function Dm(e){return function(i){return e==null?r:Xt(e,i)}}var Fm=fc(),jm=fc(!0);function Wn(){return[]}function Jn(){return!1}function qm(){return{}}function Um(){return""}function Mm(){return!0}function Lm(e,i){if(e=V(e),e<1||e>xt)return[];var n=dt,c=Oe(e,dt);i=U(i),e-=dt;for(var h=Ys(c,i);++n<e;)i(n);return h}function km(e){return z(e)?ue(e,yt):Ke(e)?[e]:Fe($c(te(e)))}function zm(e){var i=++Zp;return te(e)+i}var Hm=Zi(function(e,i){return e+i},0),Vm=Pn("ceil"),Bm=Zi(function(e,i){return e/i},1),Km=Pn("floor");function Wm(e){return e&&e.length?Bi(e,Ue,un):r}function Jm(e,i){return e&&e.length?Bi(e,U(i,2),un):r}function Gm(e){return ya(e,Ue)}function Qm(e,i){return ya(e,U(i,2))}function Ym(e){return e&&e.length?Bi(e,Ue,dn):r}function Zm(e,i){return e&&e.length?Bi(e,U(i,2),dn):r}var Xm=Zi(function(e,i){return e*i},1),ew=Pn("round"),tw=Zi(function(e,i){return e-i},0);function rw(e){return e&&e.length?Qs(e,Ue):0}function iw(e,i){return e&&e.length?Qs(e,U(i,2)):0}return p.after=Sy,p.ary=kc,p.assign=pv,p.assignIn=tu,p.assignInWith=ls,p.assignWith=dv,p.at=fv,p.before=zc,p.bind=jn,p.bindAll=wm,p.bindKey=Hc,p.castArray=qy,p.chain=Uc,p.chunk=Kf,p.compact=Wf,p.concat=Jf,p.cond=_m,p.conforms=bm,p.constant=Hn,p.countBy=ry,p.create=gv,p.curry=Vc,p.curryRight=Bc,p.debounce=Kc,p.defaults=yv,p.defaultsDeep=vv,p.defer=Oy,p.delay=Ry,p.difference=Gf,p.differenceBy=Qf,p.differenceWith=Yf,p.drop=Zf,p.dropRight=Xf,p.dropRightWhile=eg,p.dropWhile=tg,p.fill=rg,p.filter=sy,p.flatMap=ay,p.flatMapDeep=cy,p.flatMapDepth=uy,p.flatten=Dc,p.flattenDeep=ig,p.flattenDepth=sg,p.flip=Ny,p.flow=Im,p.flowRight=Pm,p.fromPairs=ng,p.functions=Pv,p.functionsIn=Sv,p.groupBy=hy,p.initial=ag,p.intersection=cg,p.intersectionBy=ug,p.intersectionWith=hg,p.invert=Rv,p.invertBy=Nv,p.invokeMap=py,p.iteratee=Vn,p.keyBy=dy,p.keys=be,p.keysIn=qe,p.map=ns,p.mapKeys=$v,p.mapValues=Av,p.matches=Sm,p.matchesProperty=Om,p.memoize=as,p.merge=Tv,p.mergeWith=ru,p.method=Rm,p.methodOf=Nm,p.mixin=Bn,p.negate=cs,p.nthArg=$m,p.omit=xv,p.omitBy=Dv,p.once=Cy,p.orderBy=fy,p.over=Am,p.overArgs=$y,p.overEvery=Tm,p.overSome=xm,p.partial=qn,p.partialRight=Wc,p.partition=gy,p.pick=Fv,p.pickBy=iu,p.property=hu,p.propertyOf=Dm,p.pull=fg,p.pullAll=jc,p.pullAllBy=gg,p.pullAllWith=yg,p.pullAt=vg,p.range=Fm,p.rangeRight=jm,p.rearg=Ay,p.reject=my,p.remove=mg,p.rest=Ty,p.reverse=Dn,p.sampleSize=_y,p.set=qv,p.setWith=Uv,p.shuffle=by,p.slice=wg,p.sortBy=Py,p.sortedUniq=Og,p.sortedUniqBy=Rg,p.split=am,p.spread=xy,p.tail=Ng,p.take=Cg,p.takeRight=$g,p.takeRightWhile=Ag,p.takeWhile=Tg,p.tap=Wg,p.throttle=Dy,p.thru=ss,p.toArray=Zc,p.toPairs=su,p.toPairsIn=nu,p.toPath=km,p.toPlainObject=eu,p.transform=Mv,p.unary=Fy,p.union=xg,p.unionBy=Dg,p.unionWith=Fg,p.uniq=jg,p.uniqBy=qg,p.uniqWith=Ug,p.unset=Lv,p.unzip=Fn,p.unzipWith=qc,p.update=kv,p.updateWith=zv,p.values=Sr,p.valuesIn=Hv,p.without=Mg,p.words=cu,p.wrap=jy,p.xor=Lg,p.xorBy=kg,p.xorWith=zg,p.zip=Hg,p.zipObject=Vg,p.zipObjectDeep=Bg,p.zipWith=Kg,p.entries=su,p.entriesIn=nu,p.extend=tu,p.extendWith=ls,Bn(p,p),p.add=Hm,p.attempt=uu,p.camelCase=Wv,p.capitalize=ou,p.ceil=Vm,p.clamp=Vv,p.clone=Uy,p.cloneDeep=Ly,p.cloneDeepWith=ky,p.cloneWith=My,p.conformsTo=zy,p.deburr=au,p.defaultTo=Em,p.divide=Bm,p.endsWith=Jv,p.eq=ut,p.escape=Gv,p.escapeRegExp=Qv,p.every=iy,p.find=ny,p.findIndex=Tc,p.findKey=mv,p.findLast=oy,p.findLastIndex=xc,p.findLastKey=wv,p.floor=Km,p.forEach=Mc,p.forEachRight=Lc,p.forIn=_v,p.forInRight=bv,p.forOwn=Ev,p.forOwnRight=Iv,p.get=Ln,p.gt=Hy,p.gte=Vy,p.has=Ov,p.hasIn=kn,p.head=Fc,p.identity=Ue,p.includes=ly,p.indexOf=og,p.inRange=Bv,p.invoke=Cv,p.isArguments=rr,p.isArray=z,p.isArrayBuffer=By,p.isArrayLike=je,p.isArrayLikeObject=ge,p.isBoolean=Ky,p.isBuffer=zt,p.isDate=Wy,p.isElement=Jy,p.isEmpty=Gy,p.isEqual=Qy,p.isEqualWith=Yy,p.isError=Un,p.isFinite=Zy,p.isFunction=St,p.isInteger=Jc,p.isLength=us,p.isMap=Gc,p.isMatch=Xy,p.isMatchWith=ev,p.isNaN=tv,p.isNative=rv,p.isNil=sv,p.isNull=iv,p.isNumber=Qc,p.isObject=le,p.isObjectLike=pe,p.isPlainObject=ii,p.isRegExp=Mn,p.isSafeInteger=nv,p.isSet=Yc,p.isString=hs,p.isSymbol=Ke,p.isTypedArray=Pr,p.isUndefined=ov,p.isWeakMap=av,p.isWeakSet=cv,p.join=lg,p.kebabCase=Yv,p.last=rt,p.lastIndexOf=pg,p.lowerCase=Zv,p.lowerFirst=Xv,p.lt=uv,p.lte=hv,p.max=Wm,p.maxBy=Jm,p.mean=Gm,p.meanBy=Qm,p.min=Ym,p.minBy=Zm,p.stubArray=Wn,p.stubFalse=Jn,p.stubObject=qm,p.stubString=Um,p.stubTrue=Mm,p.multiply=Xm,p.nth=dg,p.noConflict=Cm,p.noop=Kn,p.now=os,p.pad=em,p.padEnd=tm,p.padStart=rm,p.parseInt=im,p.random=Kv,p.reduce=yy,p.reduceRight=vy,p.repeat=sm,p.replace=nm,p.result=jv,p.round=ew,p.runInContext=v,p.sample=wy,p.size=Ey,p.snakeCase=om,p.some=Iy,p.sortedIndex=_g,p.sortedIndexBy=bg,p.sortedIndexOf=Eg,p.sortedLastIndex=Ig,p.sortedLastIndexBy=Pg,p.sortedLastIndexOf=Sg,p.startCase=cm,p.startsWith=um,p.subtract=tw,p.sum=rw,p.sumBy=iw,p.template=hm,p.times=Lm,p.toFinite=Ot,p.toInteger=V,p.toLength=Xc,p.toLower=lm,p.toNumber=it,p.toSafeInteger=lv,p.toString=te,p.toUpper=pm,p.trim=dm,p.trimEnd=fm,p.trimStart=gm,p.truncate=ym,p.unescape=vm,p.uniqueId=zm,p.upperCase=mm,p.upperFirst=zn,p.each=Mc,p.eachRight=Lc,p.first=Fc,Bn(p,function(){var e={};return ft(p,function(i,n){re.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,Ye(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),Ye(["drop","take"],function(e,i){Q.prototype[e]=function(n){n=n===r?1:_e(V(n),0);var c=this.__filtered__&&!i?new Q(this):this.clone();return c.__filtered__?c.__takeCount__=Oe(n,c.__takeCount__):c.__views__.push({size:Oe(n,dt),type:e+(c.__dir__<0?"Right":"")}),c},Q.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Ye(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==Do||n==dl;Q.prototype[e]=function(h){var d=this.clone();return d.__iteratees__.push({iteratee:U(h,3),type:n}),d.__filtered__=d.__filtered__||c,d}}),Ye(["head","last"],function(e,i){var n="take"+(i?"Right":"");Q.prototype[e]=function(){return this[n](1).value()[0]}}),Ye(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");Q.prototype[e]=function(){return this.__filtered__?new Q(this):this[n](1)}}),Q.prototype.compact=function(){return this.filter(Ue)},Q.prototype.find=function(e){return this.filter(e).head()},Q.prototype.findLast=function(e){return this.reverse().find(e)},Q.prototype.invokeMap=W(function(e,i){return typeof e=="function"?new Q(this):this.map(function(n){return Yr(n,e,i)})}),Q.prototype.reject=function(e){return this.filter(cs(U(e)))},Q.prototype.slice=function(e,i){e=V(e);var n=this;return n.__filtered__&&(e>0||i<0)?new Q(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=V(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},Q.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Q.prototype.toArray=function(){return this.take(dt)},ft(Q.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],d=c||/^find/.test(i);h&&(p.prototype[i]=function(){var g=this.__wrapped__,y=c?[1]:arguments,m=g instanceof Q,P=y[0],S=m||z(g),R=function(J){var Y=h.apply(p,Ft([J],y));return c&&A?Y[0]:Y};S&&n&&typeof P=="function"&&P.length!=1&&(m=S=!1);var A=this.__chain__,j=!!this.__actions__.length,M=d&&!A,B=m&&!j;if(!d&&S){g=B?g:new Q(this);var L=e.apply(g,y);return L.__actions__.push({func:ss,args:[R],thisArg:r}),new Xe(L,A)}return M&&B?e.apply(this,y):(L=this.thru(R),M?c?L.value()[0]:L.value():L)})}),Ye(["pop","push","shift","sort","splice","unshift"],function(e){var i=$i[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var d=this.value();return i.apply(z(d)?d:[],h)}return this[n](function(g){return i.apply(z(g)?g:[],h)})}}),ft(Q.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";re.call(wr,c)||(wr[c]=[]),wr[c].push({name:i,func:n})}}),wr[Yi(r,G).name]=[{name:"wrapper",func:r}],Q.prototype.clone=yd,Q.prototype.reverse=vd,Q.prototype.value=md,p.prototype.at=Jg,p.prototype.chain=Gg,p.prototype.commit=Qg,p.prototype.next=Yg,p.prototype.plant=Xg,p.prototype.reverse=ey,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=ty,p.prototype.first=p.prototype.head,Vr&&(p.prototype[Vr]=Zg),p},yr=Gp();Jt?((Jt.exports=yr)._=yr,Hs._=yr):Ie._=yr}).call(hi)})(_o,_o.exports);var iI=Object.defineProperty,sI=Object.defineProperties,nI=Object.getOwnPropertyDescriptors,fh=Object.getOwnPropertySymbols,oI=Object.prototype.hasOwnProperty,aI=Object.prototype.propertyIsEnumerable,gh=(a,t,r)=>t in a?iI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,fs=(a,t)=>{for(var r in t||(t={}))oI.call(t,r)&&gh(a,r,t[r]);if(fh)for(var r of fh(t))aI.call(t,r)&&gh(a,r,t[r]);return a},cI=(a,t)=>sI(a,nI(t));function Bt(a,t,r){var s;const o=C0(a);return((s=t.rpcMap)==null?void 0:s[o.reference])||`${rI}?chainId=${o.namespace}:${o.reference}&projectId=${r}`}function ur(a){return a.includes(":")?a.split(":")[1]:a}function sl(a){return a.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function uI(a,t){const r=Object.keys(t.namespaces).filter(o=>o.includes(a));if(!r.length)return[];const s=[];return r.forEach(o=>{const u=t.namespaces[o].accounts;s.push(...u)}),s}function hI(a={},t={}){const r=yh(a),s=yh(t);return _o.exports.merge(r,s)}function yh(a){var t,r,s,o;const u={};if(!Cr(a))return u;for(const[l,f]of Object.entries(a)){const w=No(l)?[l]:f.chains,b=f.methods||[],C=f.events||[],O=f.rpcMap||{},N=li(l);u[N]=cI(fs(fs({},u[N]),f),{chains:Yn(w,(t=u[N])==null?void 0:t.chains),methods:Yn(b,(r=u[N])==null?void 0:r.methods),events:Yn(C,(s=u[N])==null?void 0:s.events),rpcMap:fs(fs({},O),(o=u[N])==null?void 0:o.rpcMap)})}return u}function lI(a){return a.includes(":")?a.split(":")[2]:a}function pI(a){const t={};for(const[r,s]of Object.entries(a)){const o=s.methods||[],u=s.events||[],l=s.accounts||[],f=No(r)?[r]:s.chains?s.chains:sl(s.accounts);t[r]={chains:f,methods:o,events:u,accounts:l}}return t}function so(a){return typeof a=="number"?a:a.includes("0x")?parseInt(a,16):a.includes(":")?Number(a.split(":")[1]):Number(a)}const nl={},he=a=>nl[a],no=(a,t)=>{nl[a]=t};class dI{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class fI{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||Bt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=parseInt(ur(r));t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let o=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";o=o.startsWith("0x")?o:`0x${o}`;const u=parseInt(o,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:o}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class gI{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class yI{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class vI{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),o=ur(r);t[o]=this.createHttpProvider(o,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class mI{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class wI{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class _I{constructor(t){this.name="near",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||Bt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace);return typeof s>"u"?void 0:new $t(new Kt(s,he("disableProviderPing")))}}var bI=Object.defineProperty,EI=Object.defineProperties,II=Object.getOwnPropertyDescriptors,vh=Object.getOwnPropertySymbols,PI=Object.prototype.hasOwnProperty,SI=Object.prototype.propertyIsEnumerable,mh=(a,t,r)=>t in a?bI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,gs=(a,t)=>{for(var r in t||(t={}))PI.call(t,r)&&mh(a,r,t[r]);if(vh)for(var r of vh(t))SI.call(t,r)&&mh(a,r,t[r]);return a},oo=(a,t)=>EI(a,II(t));class xo{constructor(t){this.events=new ze.ss,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:E.Tt(E.k({level:(t==null?void 0:t.logger)||ph})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new xo(t);return await r.initialize(),r}async request(t,r){const[s,o]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:gs({},t),chainId:`${s}:${o}`,topic:this.session.topic})}sendAsync(t,r,s){const o=new Date().getTime();this.request(t,s).then(u=>r(null,E.formatJsonRpcResult(o,u))).catch(u=>r(u,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:ve("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:o}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await o().then(u=>{this.session=u,this.namespaces||(this.namespaces=pI(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==rl)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,o]=this.validateChain(t);this.getProvider(s).setDefaultChain(o,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(nr(r)){for(const s of r)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await zE.init({logger:this.providerOpts.logger||ph,relayUrl:this.providerOpts.relayUrl||XE,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>li(r)))];no("client",this.client),no("events",this.events),no("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=uI(r,this.session),o=sl(s),u=hI(this.namespaces,this.optionalNamespaces),l=oo(gs({},u[r]),{accounts:s,chains:o});switch(r){case"eip155":this.rpcProviders[r]=new fI({namespace:l});break;case"solana":this.rpcProviders[r]=new gI({namespace:l});break;case"cosmos":this.rpcProviders[r]=new yI({namespace:l});break;case"polkadot":this.rpcProviders[r]=new dI({namespace:l});break;case"cip34":this.rpcProviders[r]=new vI({namespace:l});break;case"elrond":this.rpcProviders[r]=new mI({namespace:l});break;case"multiversx":this.rpcProviders[r]=new wI({namespace:l});break;case"near":this.rpcProviders[r]=new _I({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const o=s.data;o&&nr(o)&&this.events.emit("accountsChanged",o.map(lI))}else if(s.name==="chainChanged"){const o=r.chainId,u=r.event.data,l=li(o),f=so(o)!==so(u)?`${l}:${so(u)}`:o;this.onChainChanged(f)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:o}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=oo(gs({},u),{namespaces:o}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",oo(gs({},ve("USER_DISCONNECTED")),{data:t.topic}))}),this.on(At.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:o}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=o,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>li(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const o=li(Object.keys(this.namespaces)[0]),u=this.rpcProviders[o].getDefaultChain();return[o,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[o,u]=this.validateChain(t);r||this.getProvider(o).setDefaultChain(u),((s=this.namespaces[o])!=null?s:this.namespaces[`${o}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,r){this.client.core.storage.setItem(`${dh}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${dh}/${t}`)}}const OI=xo,RI="wc",NI="ethereum_provider",CI=`${RI}@2:${NI}:`,$I="https://rpc.walletconnect.com/v1/",_s=["eth_sendTransaction","personal_sign"],ol=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],bs=["chainChanged","accountsChanged"],al=["chainChanged","accountsChanged","message","disconnect","connect"];var AI=Object.defineProperty,TI=Object.defineProperties,xI=Object.getOwnPropertyDescriptors,wh=Object.getOwnPropertySymbols,DI=Object.prototype.hasOwnProperty,FI=Object.prototype.propertyIsEnumerable,_h=(a,t,r)=>t in a?AI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,di=(a,t)=>{for(var r in t||(t={}))DI.call(t,r)&&_h(a,r,t[r]);if(wh)for(var r of wh(t))FI.call(t,r)&&_h(a,r,t[r]);return a},bh=(a,t)=>TI(a,xI(t));function Es(a){return Number(a[0].split(":")[1])}function ao(a){return`0x${a.toString(16)}`}function jI(a){const{chains:t,optionalChains:r,methods:s,optionalMethods:o,events:u,optionalEvents:l,rpcMap:f}=a;if(!co(t))throw new Error("Invalid chains");const w={chains:t,methods:s||_s,events:u||bs,rpcMap:di({},t.length?{[Es(t)]:f[Es(t)]}:{})},b=u==null?void 0:u.filter(q=>!bs.includes(q)),C=s==null?void 0:s.filter(q=>!_s.includes(q));if(!r&&!l&&!o&&!(b!=null&&b.length)&&!(C!=null&&C.length))return{required:t.length?w:void 0};const O=(b==null?void 0:b.length)&&(C==null?void 0:C.length)||!r,N={chains:[...new Set(O?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(o!=null&&o.length?o:ol))],events:[...new Set(w.events.concat(l!=null&&l.length?l:al))],rpcMap:f};return{required:t.length?w:void 0,optional:r.length?N:void 0}}class Os{constructor(){this.events=new ze.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=CI,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new Os;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=jI(this.rpc);try{const o=await new Promise(async(l,f)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(b=>{!b.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(bh(di({namespaces:di({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(b=>{l(b)}).catch(b=>{f(new Error(b.message))})});if(!o)return;const u=gw(o.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:ao(this.chainId)})}catch(o){throw this.signer.logger.error(o),o}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",ao(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",bh(di({},vw("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",ao(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,o]=t.split(":");return{chainId:`${r}:${s}`,address:o}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const o=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=o.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=o.length?(t==null?void 0:t.methods)||_s:[],w=o.length?(t==null?void 0:t.events)||bs:[],b=(t==null?void 0:t.optionalMethods)||[],C=(t==null?void 0:t.optionalEvents)||[],O=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),N=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:o==null?void 0:o.map(q=>this.formatChainId(q)),optionalChains:u.map(q=>this.formatChainId(q)),methods:f,events:w,optionalMethods:b,optionalEvents:C,rpcMap:O,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:N,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(o=>{s[o]=this.getRpcUrl(o,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Es(this.rpc.chains):Es(this.rpc.optionalChains),this.signer=await OI.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await Promise.resolve().then(()=>require("./index-BFbkaHZM.js")).then(o=>o.index);r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(di({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:o}=t;r&&co(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)})),s&&co(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${$I}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const qI=Os;exports.EthereumProvider=qI;exports.OPTIONAL_EVENTS=al;exports.OPTIONAL_METHODS=ol;exports.REQUIRED_EVENTS=bs;exports.REQUIRED_METHODS=_s;exports.default=Os;
@@ -1,7 +1,7 @@
1
- import { e as gt, s as xo } from "./events-CpDIhB3C.mjs";
2
- import { cl as Do, cm as $w, V as J, aw as Cw, ck as $u } from "./index-C6iaLaJq.mjs";
3
- import { c as F, s as Fo, x as Vh, r as Bh, H as Aw, a as Kh, q as Ss } from "./index-Bm1zXhFz.mjs";
4
- import { I as lr, f as ft, t as nt, c as Cu, C as Tw, r as xw, a as Dr, g as Wh, i as bt, b as $s, d as Au, e as Dw, h as Fw, j as Cs, p as Gh, _ as qw, E as ke, y as Qe, T as As, k as Ts, l as jw, m as Tu, n as Uw, s as Mw, o as qo, q as xs, u as Wt, v as Lw, w as xu } from "./index-wW7H3ciQ.mjs";
1
+ import { e as gt, s as xo } from "./events-jOp8E97m.mjs";
2
+ import { cm as Do, cn as $w, U as J, av as Cw, cl as $u } from "./index-BAhBSTHO.mjs";
3
+ import { c as F, s as Fo, x as Vh, r as Bh, H as Aw, a as Kh, q as Ss } from "./index-ieIOqnbv.mjs";
4
+ import { I as lr, f as ft, t as nt, c as Cu, C as Tw, r as xw, a as Dr, g as Wh, i as bt, b as $s, d as Au, e as Dw, h as Fw, j as Cs, p as Gh, _ as qw, E as ke, y as Qe, T as As, k as Ts, l as jw, m as Tu, n as Uw, s as Mw, o as qo, q as xs, u as Wt, v as Lw, w as xu } from "./index-BDForJp0.mjs";
5
5
  var se = {};
6
6
  Object.defineProperty(se, "__esModule", { value: !0 });
7
7
  se.getLocalStorage = se.getLocalStorageOrThrow = se.getCrypto = se.getCryptoOrThrow = se.getLocation = se.getLocationOrThrow = se.getNavigator = se.getNavigatorOrThrow = se.getDocument = se.getDocumentOrThrow = se.getFromWindowOrThrow = se.getFromWindow = void 0;
@@ -7825,7 +7825,7 @@ class Jo {
7825
7825
  if (this.rpc = this.getRpcConfig(t), this.chainId = this.rpc.chains.length ? Ns(this.rpc.chains) : Ns(this.rpc.optionalChains), this.signer = await uP.init({ projectId: this.rpc.projectId, metadata: this.rpc.metadata, disableProviderPing: t.disableProviderPing, relayUrl: t.relayUrl, storageOptions: t.storageOptions }), this.registerEventListeners(), await this.loadPersistedSession(), this.rpc.showQrModal) {
7826
7826
  let r;
7827
7827
  try {
7828
- const { WalletConnectModal: s } = await import("./index-B-UHVwW1.mjs").then((o) => o.i);
7828
+ const { WalletConnectModal: s } = await import("./index-v8vynoP2.mjs").then((o) => o.i);
7829
7829
  r = s;
7830
7830
  } catch {
7831
7831
  throw new Error("To use QR modal, please install @walletconnect/modal package");