@aptos-labs/ts-sdk 1.7.0 → 1.9.0

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 (370) hide show
  1. package/dist/browser/index.d.ts +1226 -975
  2. package/dist/browser/index.global.js +32 -30
  3. package/dist/browser/index.global.js.map +1 -1
  4. package/dist/common/index.d.ts +1226 -975
  5. package/dist/common/index.js +27 -25
  6. package/dist/common/index.js.map +1 -1
  7. package/dist/esm/api/account.d.mts +12 -6
  8. package/dist/esm/api/account.mjs +1 -1
  9. package/dist/esm/api/ans.d.mts +11 -12
  10. package/dist/esm/api/ans.mjs +1 -1
  11. package/dist/esm/api/aptos.d.mts +13 -14
  12. package/dist/esm/api/aptos.mjs +1 -1
  13. package/dist/esm/api/aptosConfig.mjs +1 -1
  14. package/dist/esm/api/coin.d.mts +13 -13
  15. package/dist/esm/api/coin.mjs +1 -1
  16. package/dist/esm/api/digitalAsset.d.mts +20 -10
  17. package/dist/esm/api/digitalAsset.mjs +1 -1
  18. package/dist/esm/api/event.d.mts +14 -1
  19. package/dist/esm/api/event.mjs +1 -1
  20. package/dist/esm/api/faucet.mjs +1 -1
  21. package/dist/esm/api/fungibleAsset.d.mts +9 -10
  22. package/dist/esm/api/fungibleAsset.mjs +1 -1
  23. package/dist/esm/api/general.mjs +1 -1
  24. package/dist/esm/api/index.d.mts +13 -14
  25. package/dist/esm/api/index.mjs +1 -1
  26. package/dist/esm/api/staking.mjs +1 -1
  27. package/dist/esm/api/transaction.d.mts +5 -6
  28. package/dist/esm/api/transaction.mjs +1 -1
  29. package/dist/esm/api/transactionSubmission/build.d.mts +8 -8
  30. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  31. package/dist/esm/api/transactionSubmission/management.d.mts +11 -12
  32. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  33. package/dist/esm/api/transactionSubmission/sign.d.mts +11 -12
  34. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  35. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  36. package/dist/esm/api/transactionSubmission/simulate.d.mts +11 -11
  37. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  38. package/dist/esm/api/transactionSubmission/submit.d.mts +6 -6
  39. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  40. package/dist/esm/api/utils.mjs +1 -1
  41. package/dist/esm/bcs/index.mjs +1 -1
  42. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  43. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  44. package/dist/esm/chunk-2E2JOGE5.mjs +2 -0
  45. package/dist/esm/chunk-2E2JOGE5.mjs.map +1 -0
  46. package/dist/esm/chunk-3EUOBVCT.mjs +2 -0
  47. package/dist/esm/{chunk-A2QH4A6D.mjs.map → chunk-3EUOBVCT.mjs.map} +1 -1
  48. package/dist/esm/{chunk-RNO5ZG3C.mjs → chunk-52RTAMN7.mjs} +2 -2
  49. package/dist/esm/chunk-7BDYKJXX.mjs +2 -0
  50. package/dist/esm/chunk-7BDYKJXX.mjs.map +1 -0
  51. package/dist/esm/{chunk-WQI2RH2S.mjs → chunk-7U36LMP4.mjs} +2 -2
  52. package/dist/esm/{chunk-NWRKJFHV.mjs → chunk-ARIC32W7.mjs} +2 -2
  53. package/dist/esm/{chunk-RIL4SHXC.mjs → chunk-B7M3OWHV.mjs} +2 -2
  54. package/dist/esm/{chunk-C7ZX475J.mjs → chunk-BBUAAJRA.mjs} +2 -2
  55. package/dist/esm/chunk-C3HM7HQP.mjs +2 -0
  56. package/dist/esm/chunk-C3HM7HQP.mjs.map +1 -0
  57. package/dist/esm/{chunk-DRF6AMEZ.mjs → chunk-CHA5DSSD.mjs} +2 -2
  58. package/dist/esm/chunk-CVEJHRAU.mjs +2 -0
  59. package/dist/esm/chunk-CVEJHRAU.mjs.map +1 -0
  60. package/dist/esm/chunk-DE5OOOVY.mjs +2 -0
  61. package/dist/esm/{chunk-3UYBNX3P.mjs.map → chunk-DE5OOOVY.mjs.map} +1 -1
  62. package/dist/esm/{chunk-IKCBGNRD.mjs → chunk-DGOT2VR5.mjs} +2 -2
  63. package/dist/esm/{chunk-GVHOHNHT.mjs → chunk-EF2F7NWO.mjs} +2 -2
  64. package/dist/esm/{chunk-J6RCCKOA.mjs → chunk-EQZ757ES.mjs} +2 -2
  65. package/dist/esm/{chunk-CX5ULWJQ.mjs → chunk-F67Y7YH6.mjs} +2 -2
  66. package/dist/esm/{chunk-JLL7BCD4.mjs → chunk-FVMVV4V3.mjs} +2 -2
  67. package/dist/esm/chunk-FWDKABRW.mjs +2 -0
  68. package/dist/esm/chunk-FWDKABRW.mjs.map +1 -0
  69. package/dist/esm/chunk-G62HQC77.mjs +2 -0
  70. package/dist/esm/chunk-G62HQC77.mjs.map +1 -0
  71. package/dist/esm/{chunk-ESX5X52V.mjs → chunk-GQOOXOTN.mjs} +2 -2
  72. package/dist/esm/chunk-GRJJBGHT.mjs +2 -0
  73. package/dist/esm/chunk-GRJJBGHT.mjs.map +1 -0
  74. package/dist/esm/chunk-HEPV52CH.mjs +2 -0
  75. package/dist/esm/chunk-HEPV52CH.mjs.map +1 -0
  76. package/dist/esm/{chunk-XQIWF5HY.mjs → chunk-I3TCHVQQ.mjs} +2 -2
  77. package/dist/esm/{chunk-3NOQE6U3.mjs → chunk-ILJWEPDW.mjs} +2 -2
  78. package/dist/esm/chunk-INORE66K.mjs +2 -0
  79. package/dist/esm/chunk-INORE66K.mjs.map +1 -0
  80. package/dist/esm/{chunk-5L6SRCJP.mjs → chunk-J6MWD4XN.mjs} +2 -2
  81. package/dist/esm/{chunk-YGMT4GQ5.mjs → chunk-JEHR6GKW.mjs} +2 -2
  82. package/dist/esm/chunk-JEHR6GKW.mjs.map +1 -0
  83. package/dist/esm/chunk-KUX6GQ2E.mjs +1 -0
  84. package/dist/esm/{chunk-6UNBJAV6.mjs → chunk-KWJTVJ7C.mjs} +2 -2
  85. package/dist/esm/chunk-KWJTVJ7C.mjs.map +1 -0
  86. package/dist/esm/{chunk-WK36MJRI.mjs → chunk-LLL2LFYH.mjs} +2 -2
  87. package/dist/esm/chunk-LMXP3JUU.mjs +2 -0
  88. package/dist/esm/chunk-LMXP3JUU.mjs.map +1 -0
  89. package/dist/esm/{chunk-5WXR2O3T.mjs → chunk-N65SOKJQ.mjs} +2 -2
  90. package/dist/esm/{chunk-XOBXX273.mjs → chunk-NL3XVNS5.mjs} +2 -2
  91. package/dist/esm/{chunk-Q7JKS6WV.mjs → chunk-NURFZOR4.mjs} +2 -2
  92. package/dist/esm/{chunk-MKERJNYN.mjs → chunk-OG56TYZE.mjs} +2 -2
  93. package/dist/esm/chunk-Q6WOHF4A.mjs +2 -0
  94. package/dist/esm/chunk-Q6WOHF4A.mjs.map +1 -0
  95. package/dist/esm/chunk-QA4XWNIH.mjs +2 -0
  96. package/dist/esm/chunk-QA4XWNIH.mjs.map +1 -0
  97. package/dist/esm/chunk-QE4ASJ5K.mjs +1 -0
  98. package/dist/esm/chunk-QR72RXBS.mjs +2 -0
  99. package/dist/esm/chunk-QR72RXBS.mjs.map +1 -0
  100. package/dist/esm/{chunk-TVURQPLA.mjs → chunk-R4VJDSIP.mjs} +2 -2
  101. package/dist/esm/{chunk-O57QZZF2.mjs → chunk-S2F6CSH4.mjs} +2 -2
  102. package/dist/esm/chunk-S2F6CSH4.mjs.map +1 -0
  103. package/dist/esm/{chunk-BQSE5HHW.mjs → chunk-S4SEFF4K.mjs} +3 -1
  104. package/dist/esm/chunk-S4SEFF4K.mjs.map +1 -0
  105. package/dist/esm/{chunk-OVSV4Y32.mjs → chunk-SXIFL5DQ.mjs} +2 -2
  106. package/dist/esm/{chunk-OVSV4Y32.mjs.map → chunk-SXIFL5DQ.mjs.map} +1 -1
  107. package/dist/esm/{chunk-Z6XNTGNK.mjs → chunk-TN5BUH4F.mjs} +2 -2
  108. package/dist/esm/chunk-TNVR7SNR.mjs +2 -0
  109. package/dist/esm/chunk-TNVR7SNR.mjs.map +1 -0
  110. package/dist/esm/chunk-TX7UK75Q.mjs +2 -0
  111. package/dist/esm/chunk-TX7UK75Q.mjs.map +1 -0
  112. package/dist/esm/{chunk-YE3DZD6T.mjs → chunk-UIUSDBCL.mjs} +2 -2
  113. package/dist/esm/{chunk-7JTOGYO7.mjs → chunk-UMLDKLDL.mjs} +2 -2
  114. package/dist/esm/chunk-UVSRX4SV.mjs +1 -0
  115. package/dist/esm/{chunk-6Y3VBRMN.mjs → chunk-VEVBHH3M.mjs} +2 -2
  116. package/dist/esm/{chunk-T5IFXLOP.mjs → chunk-VMXBMAYK.mjs} +2 -2
  117. package/dist/esm/chunk-WKUXBIYB.mjs +2 -0
  118. package/dist/esm/chunk-WKUXBIYB.mjs.map +1 -0
  119. package/dist/esm/chunk-WME5D6YR.mjs +2 -0
  120. package/dist/esm/chunk-WME5D6YR.mjs.map +1 -0
  121. package/dist/esm/chunk-WTHNSNAX.mjs +2 -0
  122. package/dist/esm/chunk-WTHNSNAX.mjs.map +1 -0
  123. package/dist/esm/{chunk-WC2WSKYZ.mjs → chunk-X5C3LYI7.mjs} +2 -2
  124. package/dist/esm/chunk-XKD7W5NO.mjs +2 -0
  125. package/dist/esm/{chunk-UJAX75ON.mjs.map → chunk-XKD7W5NO.mjs.map} +1 -1
  126. package/dist/esm/{chunk-OWZLBIDD.mjs → chunk-XTPFQ4MH.mjs} +2 -2
  127. package/dist/esm/{chunk-D2GNCG27.mjs → chunk-Y5AJLNUD.mjs} +2 -2
  128. package/dist/esm/chunk-YDAA4RG4.mjs +2 -0
  129. package/dist/esm/chunk-YDAA4RG4.mjs.map +1 -0
  130. package/dist/esm/{chunk-ZFPA45OK.mjs → chunk-YR2R3LW4.mjs} +2 -2
  131. package/dist/esm/chunk-YZZO6VDC.mjs +2 -0
  132. package/dist/esm/chunk-YZZO6VDC.mjs.map +1 -0
  133. package/dist/esm/client/core.mjs +1 -1
  134. package/dist/esm/client/get.mjs +1 -1
  135. package/dist/esm/client/index.mjs +1 -1
  136. package/dist/esm/client/post.mjs +1 -1
  137. package/dist/esm/core/account/Account.d.mts +20 -0
  138. package/dist/esm/core/account/Account.mjs +2 -0
  139. package/dist/esm/core/account/Ed25519Account.d.mts +20 -0
  140. package/dist/esm/core/account/Ed25519Account.mjs +2 -0
  141. package/dist/esm/core/account/SingleKeyAccount.d.mts +20 -0
  142. package/dist/esm/core/account/SingleKeyAccount.mjs +2 -0
  143. package/dist/esm/core/account/SingleKeyAccount.mjs.map +1 -0
  144. package/dist/esm/core/account/index.d.mts +305 -0
  145. package/dist/esm/core/account/index.mjs +2 -0
  146. package/dist/esm/core/account/index.mjs.map +1 -0
  147. package/dist/esm/core/accountAddress.mjs +1 -1
  148. package/dist/esm/core/authenticationKey.d.mts +7 -68
  149. package/dist/esm/core/authenticationKey.mjs +1 -1
  150. package/dist/esm/core/crypto/ed25519.d.mts +49 -61
  151. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  152. package/dist/esm/core/crypto/index.d.mts +9 -6
  153. package/dist/esm/core/crypto/index.mjs +1 -1
  154. package/dist/esm/core/crypto/multiEd25519.d.mts +17 -14
  155. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  156. package/dist/esm/core/crypto/multiKey.d.mts +70 -17
  157. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  158. package/dist/esm/core/crypto/privateKey.d.mts +35 -0
  159. package/dist/esm/core/crypto/privateKey.mjs +2 -0
  160. package/dist/esm/core/crypto/privateKey.mjs.map +1 -0
  161. package/dist/esm/core/crypto/publicKey.d.mts +13 -0
  162. package/dist/esm/core/crypto/publicKey.mjs +2 -0
  163. package/dist/esm/core/crypto/publicKey.mjs.map +1 -0
  164. package/dist/esm/core/crypto/secp256k1.d.mts +43 -67
  165. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  166. package/dist/esm/core/crypto/signature.d.mts +28 -0
  167. package/dist/esm/core/crypto/signature.mjs +2 -0
  168. package/dist/esm/core/crypto/signature.mjs.map +1 -0
  169. package/dist/esm/core/crypto/singleKey.d.mts +68 -0
  170. package/dist/esm/core/crypto/singleKey.mjs +2 -0
  171. package/dist/esm/core/crypto/singleKey.mjs.map +1 -0
  172. package/dist/esm/core/index.d.mts +9 -8
  173. package/dist/esm/core/index.mjs +1 -1
  174. package/dist/esm/index.d.mts +9 -9
  175. package/dist/esm/index.mjs +1 -1
  176. package/dist/esm/internal/account.d.mts +9 -3
  177. package/dist/esm/internal/account.mjs +1 -1
  178. package/dist/esm/internal/ans.d.mts +10 -11
  179. package/dist/esm/internal/ans.mjs +1 -1
  180. package/dist/esm/internal/coin.d.mts +9 -9
  181. package/dist/esm/internal/coin.mjs +1 -1
  182. package/dist/esm/internal/digitalAsset.d.mts +15 -12
  183. package/dist/esm/internal/digitalAsset.mjs +1 -1
  184. package/dist/esm/internal/event.d.mts +7 -2
  185. package/dist/esm/internal/event.mjs +1 -1
  186. package/dist/esm/internal/faucet.d.mts +1 -1
  187. package/dist/esm/internal/faucet.mjs +1 -1
  188. package/dist/esm/internal/fungibleAsset.d.mts +9 -10
  189. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  190. package/dist/esm/internal/general.mjs +1 -1
  191. package/dist/esm/internal/staking.d.mts +1 -1
  192. package/dist/esm/internal/staking.mjs +1 -1
  193. package/dist/esm/internal/transaction.mjs +1 -1
  194. package/dist/esm/internal/transactionSubmission.d.mts +10 -11
  195. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  196. package/dist/esm/publicKey-lq5djCIY.d.mts +113 -0
  197. package/dist/esm/transactions/authenticator/account.d.mts +6 -4
  198. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  199. package/dist/esm/transactions/authenticator/index.d.mts +6 -6
  200. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  201. package/dist/esm/transactions/authenticator/transaction.d.mts +5 -5
  202. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  203. package/dist/esm/transactions/index.d.mts +6 -7
  204. package/dist/esm/transactions/index.mjs +1 -1
  205. package/dist/esm/transactions/instances/index.d.mts +4 -4
  206. package/dist/esm/transactions/instances/index.mjs +1 -1
  207. package/dist/esm/transactions/instances/moduleId.d.mts +1 -1
  208. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  209. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  210. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +2 -1
  211. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  212. package/dist/esm/transactions/instances/signedTransaction.d.mts +8 -8
  213. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  214. package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -1
  215. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  216. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +11 -5
  217. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  218. package/dist/esm/transactions/management/index.d.mts +11 -12
  219. package/dist/esm/transactions/management/index.mjs +1 -1
  220. package/dist/esm/transactions/management/transactionWorker.d.mts +11 -12
  221. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  222. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +10 -10
  223. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  224. package/dist/esm/transactions/transactionBuilder/index.d.mts +9 -10
  225. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  226. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +8 -8
  227. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  228. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +9 -10
  229. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  230. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  231. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  232. package/dist/esm/transactions/types.d.mts +9 -9
  233. package/dist/esm/types/generated/operations.d.mts +6 -0
  234. package/dist/esm/types/generated/queries.d.mts +6 -6
  235. package/dist/esm/types/generated/queries.mjs +1 -1
  236. package/dist/esm/types/generated/types.d.mts +594 -56
  237. package/dist/esm/types/generated/types.mjs +1 -1
  238. package/dist/esm/types/generated/types.mjs.map +1 -1
  239. package/dist/esm/types/index.d.mts +35 -6
  240. package/dist/esm/types/index.mjs +1 -1
  241. package/dist/esm/utils/const.d.mts +1 -2
  242. package/dist/esm/utils/const.mjs +1 -1
  243. package/dist/esm/utils/index.d.mts +1 -1
  244. package/dist/esm/utils/index.mjs +1 -1
  245. package/dist/esm/version.d.mts +1 -1
  246. package/dist/esm/version.mjs +1 -1
  247. package/package.json +16 -16
  248. package/src/api/aptosConfig.ts +2 -2
  249. package/src/api/digitalAsset.ts +20 -0
  250. package/src/api/event.ts +27 -1
  251. package/src/core/account/Account.ts +245 -0
  252. package/src/core/account/Ed25519Account.ts +88 -0
  253. package/src/core/account/SingleKeyAccount.ts +120 -0
  254. package/src/core/account/index.ts +3 -0
  255. package/src/core/authenticationKey.ts +18 -52
  256. package/src/core/crypto/ed25519.ts +118 -104
  257. package/src/core/crypto/index.ts +6 -5
  258. package/src/core/crypto/multiEd25519.ts +98 -44
  259. package/src/core/crypto/multiKey.ts +192 -34
  260. package/src/core/crypto/privateKey.ts +25 -0
  261. package/src/core/crypto/publicKey.ts +52 -0
  262. package/src/core/crypto/secp256k1.ts +108 -111
  263. package/src/core/crypto/signature.ts +46 -0
  264. package/src/core/crypto/singleKey.ts +180 -0
  265. package/src/internal/account.ts +5 -3
  266. package/src/internal/digitalAsset.ts +26 -0
  267. package/src/internal/event.ts +33 -1
  268. package/src/internal/queries/currentTokenOwnershipFieldsFragment.graphql +1 -0
  269. package/src/internal/queries/getTokenData.graphql +1 -0
  270. package/src/transactions/authenticator/account.ts +1 -2
  271. package/src/transactions/instances/rotationProofChallenge.ts +1 -1
  272. package/src/transactions/transactionBuilder/transactionBuilder.ts +3 -21
  273. package/src/transactions/types.ts +1 -1
  274. package/src/types/generated/operations.ts +6 -0
  275. package/src/types/generated/queries.ts +2 -0
  276. package/src/types/generated/types.ts +662 -55
  277. package/src/types/index.ts +40 -4
  278. package/src/utils/const.ts +0 -4
  279. package/src/version.ts +1 -1
  280. package/dist/esm/chunk-2QV6HI3M.mjs +0 -2
  281. package/dist/esm/chunk-2QV6HI3M.mjs.map +0 -1
  282. package/dist/esm/chunk-3UYBNX3P.mjs +0 -2
  283. package/dist/esm/chunk-4SAUEZTN.mjs +0 -2
  284. package/dist/esm/chunk-4SAUEZTN.mjs.map +0 -1
  285. package/dist/esm/chunk-6UNBJAV6.mjs.map +0 -1
  286. package/dist/esm/chunk-7IGH7N52.mjs +0 -2
  287. package/dist/esm/chunk-7IGH7N52.mjs.map +0 -1
  288. package/dist/esm/chunk-A2QH4A6D.mjs +0 -2
  289. package/dist/esm/chunk-AA3GRJNL.mjs +0 -2
  290. package/dist/esm/chunk-AA3GRJNL.mjs.map +0 -1
  291. package/dist/esm/chunk-ALFESCPU.mjs +0 -2
  292. package/dist/esm/chunk-ALFESCPU.mjs.map +0 -1
  293. package/dist/esm/chunk-BQSE5HHW.mjs.map +0 -1
  294. package/dist/esm/chunk-CCUD52OF.mjs +0 -2
  295. package/dist/esm/chunk-CCUD52OF.mjs.map +0 -1
  296. package/dist/esm/chunk-ERWQOVBF.mjs +0 -2
  297. package/dist/esm/chunk-ERWQOVBF.mjs.map +0 -1
  298. package/dist/esm/chunk-FBFMQZTM.mjs +0 -2
  299. package/dist/esm/chunk-FBFMQZTM.mjs.map +0 -1
  300. package/dist/esm/chunk-FP5DPRYL.mjs +0 -2
  301. package/dist/esm/chunk-FP5DPRYL.mjs.map +0 -1
  302. package/dist/esm/chunk-HHJBCGAQ.mjs +0 -2
  303. package/dist/esm/chunk-HHJBCGAQ.mjs.map +0 -1
  304. package/dist/esm/chunk-I7WRJY7K.mjs +0 -2
  305. package/dist/esm/chunk-I7WRJY7K.mjs.map +0 -1
  306. package/dist/esm/chunk-INV6U3KS.mjs +0 -2
  307. package/dist/esm/chunk-INV6U3KS.mjs.map +0 -1
  308. package/dist/esm/chunk-O57QZZF2.mjs.map +0 -1
  309. package/dist/esm/chunk-SBMJNU2O.mjs +0 -2
  310. package/dist/esm/chunk-SBMJNU2O.mjs.map +0 -1
  311. package/dist/esm/chunk-SZYATFM7.mjs +0 -2
  312. package/dist/esm/chunk-SZYATFM7.mjs.map +0 -1
  313. package/dist/esm/chunk-UCHGKGCF.mjs +0 -2
  314. package/dist/esm/chunk-UCHGKGCF.mjs.map +0 -1
  315. package/dist/esm/chunk-UIVJXLRM.mjs +0 -1
  316. package/dist/esm/chunk-UJAX75ON.mjs +0 -2
  317. package/dist/esm/chunk-V6JFR2CB.mjs +0 -2
  318. package/dist/esm/chunk-V6JFR2CB.mjs.map +0 -1
  319. package/dist/esm/chunk-YGMT4GQ5.mjs.map +0 -1
  320. package/dist/esm/chunk-ZFIMVSCR.mjs +0 -2
  321. package/dist/esm/chunk-ZFIMVSCR.mjs.map +0 -1
  322. package/dist/esm/chunk-ZIZ7PVK2.mjs +0 -2
  323. package/dist/esm/chunk-ZIZ7PVK2.mjs.map +0 -1
  324. package/dist/esm/core/account.d.mts +0 -184
  325. package/dist/esm/core/account.mjs +0 -2
  326. package/dist/esm/core/crypto/anyPublicKey.d.mts +0 -59
  327. package/dist/esm/core/crypto/anyPublicKey.mjs +0 -2
  328. package/dist/esm/core/crypto/anySignature.d.mts +0 -31
  329. package/dist/esm/core/crypto/anySignature.mjs +0 -2
  330. package/dist/esm/core/crypto/asymmetricCrypto.d.mts +0 -74
  331. package/dist/esm/core/crypto/asymmetricCrypto.mjs +0 -2
  332. package/src/core/account.ts +0 -282
  333. package/src/core/crypto/anyPublicKey.ts +0 -92
  334. package/src/core/crypto/anySignature.ts +0 -56
  335. package/src/core/crypto/asymmetricCrypto.ts +0 -77
  336. /package/dist/esm/{chunk-RNO5ZG3C.mjs.map → chunk-52RTAMN7.mjs.map} +0 -0
  337. /package/dist/esm/{chunk-WQI2RH2S.mjs.map → chunk-7U36LMP4.mjs.map} +0 -0
  338. /package/dist/esm/{chunk-NWRKJFHV.mjs.map → chunk-ARIC32W7.mjs.map} +0 -0
  339. /package/dist/esm/{chunk-RIL4SHXC.mjs.map → chunk-B7M3OWHV.mjs.map} +0 -0
  340. /package/dist/esm/{chunk-C7ZX475J.mjs.map → chunk-BBUAAJRA.mjs.map} +0 -0
  341. /package/dist/esm/{chunk-DRF6AMEZ.mjs.map → chunk-CHA5DSSD.mjs.map} +0 -0
  342. /package/dist/esm/{chunk-IKCBGNRD.mjs.map → chunk-DGOT2VR5.mjs.map} +0 -0
  343. /package/dist/esm/{chunk-GVHOHNHT.mjs.map → chunk-EF2F7NWO.mjs.map} +0 -0
  344. /package/dist/esm/{chunk-J6RCCKOA.mjs.map → chunk-EQZ757ES.mjs.map} +0 -0
  345. /package/dist/esm/{chunk-CX5ULWJQ.mjs.map → chunk-F67Y7YH6.mjs.map} +0 -0
  346. /package/dist/esm/{chunk-JLL7BCD4.mjs.map → chunk-FVMVV4V3.mjs.map} +0 -0
  347. /package/dist/esm/{chunk-ESX5X52V.mjs.map → chunk-GQOOXOTN.mjs.map} +0 -0
  348. /package/dist/esm/{chunk-XQIWF5HY.mjs.map → chunk-I3TCHVQQ.mjs.map} +0 -0
  349. /package/dist/esm/{chunk-3NOQE6U3.mjs.map → chunk-ILJWEPDW.mjs.map} +0 -0
  350. /package/dist/esm/{chunk-5L6SRCJP.mjs.map → chunk-J6MWD4XN.mjs.map} +0 -0
  351. /package/dist/esm/{chunk-UIVJXLRM.mjs.map → chunk-KUX6GQ2E.mjs.map} +0 -0
  352. /package/dist/esm/{chunk-WK36MJRI.mjs.map → chunk-LLL2LFYH.mjs.map} +0 -0
  353. /package/dist/esm/{chunk-5WXR2O3T.mjs.map → chunk-N65SOKJQ.mjs.map} +0 -0
  354. /package/dist/esm/{chunk-XOBXX273.mjs.map → chunk-NL3XVNS5.mjs.map} +0 -0
  355. /package/dist/esm/{chunk-Q7JKS6WV.mjs.map → chunk-NURFZOR4.mjs.map} +0 -0
  356. /package/dist/esm/{chunk-MKERJNYN.mjs.map → chunk-OG56TYZE.mjs.map} +0 -0
  357. /package/dist/esm/{core/account.mjs.map → chunk-QE4ASJ5K.mjs.map} +0 -0
  358. /package/dist/esm/{chunk-TVURQPLA.mjs.map → chunk-R4VJDSIP.mjs.map} +0 -0
  359. /package/dist/esm/{chunk-Z6XNTGNK.mjs.map → chunk-TN5BUH4F.mjs.map} +0 -0
  360. /package/dist/esm/{chunk-YE3DZD6T.mjs.map → chunk-UIUSDBCL.mjs.map} +0 -0
  361. /package/dist/esm/{chunk-7JTOGYO7.mjs.map → chunk-UMLDKLDL.mjs.map} +0 -0
  362. /package/dist/esm/{core/crypto/anyPublicKey.mjs.map → chunk-UVSRX4SV.mjs.map} +0 -0
  363. /package/dist/esm/{chunk-6Y3VBRMN.mjs.map → chunk-VEVBHH3M.mjs.map} +0 -0
  364. /package/dist/esm/{chunk-T5IFXLOP.mjs.map → chunk-VMXBMAYK.mjs.map} +0 -0
  365. /package/dist/esm/{chunk-WC2WSKYZ.mjs.map → chunk-X5C3LYI7.mjs.map} +0 -0
  366. /package/dist/esm/{chunk-OWZLBIDD.mjs.map → chunk-XTPFQ4MH.mjs.map} +0 -0
  367. /package/dist/esm/{chunk-D2GNCG27.mjs.map → chunk-Y5AJLNUD.mjs.map} +0 -0
  368. /package/dist/esm/{chunk-ZFPA45OK.mjs.map → chunk-YR2R3LW4.mjs.map} +0 -0
  369. /package/dist/esm/core/{crypto/anySignature.mjs.map → account/Account.mjs.map} +0 -0
  370. /package/dist/esm/core/{crypto/asymmetricCrypto.mjs.map → account/Ed25519Account.mjs.map} +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";var aptosSDK=(()=>{var Xp=Object.create;var Ho=Object.defineProperty;var Xu=Object.getOwnPropertyDescriptor;var Jp=Object.getOwnPropertyNames;var eg=Object.getPrototypeOf,tg=Object.prototype.hasOwnProperty;var Ju=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var Oa=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),$s=(n,t)=>{for(var e in t)Ho(n,e,{get:t[e],enumerable:!0})},ef=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Jp(t))!tg.call(n,o)&&o!==e&&Ho(n,o,{get:()=>t[o],enumerable:!(r=Xu(t,o))||r.enumerable});return n};var tf=(n,t,e)=>(e=n!=null?Xp(eg(n)):{},ef(t||!n||!n.__esModule?Ho(e,"default",{value:n,enumerable:!0}):e,n)),ng=n=>ef(Ho({},"__esModule",{value:!0}),n),Ot=(n,t,e,r)=>{for(var o=r>1?void 0:r?Xu(t,e):t,s=n.length-1,i;s>=0;s--)(i=n[s])&&(o=(r?i(t,e,o):i(o))||o);return r&&o&&Ho(t,e,o),o};var Ef=Oa(()=>{"use strict"});var Sf=Oa((_A,ui)=>{"use strict";(function(n){"use strict";var t=function(f){var p,l=new Float64Array(16);if(f)for(p=0;p<f.length;p++)l[p]=f[p];return l},e=function(){throw new Error("no PRNG")},r=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var s=t(),i=t([1]),c=t([56129,1]),u=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),y=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),g=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),T=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function S(f,p,l,a){f[p]=l>>24&255,f[p+1]=l>>16&255,f[p+2]=l>>8&255,f[p+3]=l&255,f[p+4]=a>>24&255,f[p+5]=a>>16&255,f[p+6]=a>>8&255,f[p+7]=a&255}function b(f,p,l,a,m){var x,E=0;for(x=0;x<m;x++)E|=f[p+x]^l[a+x];return(1&E-1>>>8)-1}function h(f,p,l,a){return b(f,p,l,a,16)}function w(f,p,l,a){return b(f,p,l,a,32)}function v(f,p,l,a){for(var m=a[0]&255|(a[1]&255)<<8|(a[2]&255)<<16|(a[3]&255)<<24,x=l[0]&255|(l[1]&255)<<8|(l[2]&255)<<16|(l[3]&255)<<24,E=l[4]&255|(l[5]&255)<<8|(l[6]&255)<<16|(l[7]&255)<<24,O=l[8]&255|(l[9]&255)<<8|(l[10]&255)<<16|(l[11]&255)<<24,K=l[12]&255|(l[13]&255)<<8|(l[14]&255)<<16|(l[15]&255)<<24,ee=a[4]&255|(a[5]&255)<<8|(a[6]&255)<<16|(a[7]&255)<<24,j=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,Oe=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,Y=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,ce=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,fe=a[8]&255|(a[9]&255)<<8|(a[10]&255)<<16|(a[11]&255)<<24,me=l[16]&255|(l[17]&255)<<8|(l[18]&255)<<16|(l[19]&255)<<24,ge=l[20]&255|(l[21]&255)<<8|(l[22]&255)<<16|(l[23]&255)<<24,de=l[24]&255|(l[25]&255)<<8|(l[26]&255)<<16|(l[27]&255)<<24,pe=l[28]&255|(l[29]&255)<<8|(l[30]&255)<<16|(l[31]&255)<<24,le=a[12]&255|(a[13]&255)<<8|(a[14]&255)<<16|(a[15]&255)<<24,Z=m,oe=x,W=E,X=O,J=K,V=ee,C=j,I=Oe,z=Y,R=ce,N=fe,L=me,ie=ge,ye=de,Ae=pe,he=le,A,Ee=0;Ee<20;Ee+=2)A=Z+ie|0,J^=A<<7|A>>>25,A=J+Z|0,z^=A<<9|A>>>23,A=z+J|0,ie^=A<<13|A>>>19,A=ie+z|0,Z^=A<<18|A>>>14,A=V+oe|0,R^=A<<7|A>>>25,A=R+V|0,ye^=A<<9|A>>>23,A=ye+R|0,oe^=A<<13|A>>>19,A=oe+ye|0,V^=A<<18|A>>>14,A=N+C|0,Ae^=A<<7|A>>>25,A=Ae+N|0,W^=A<<9|A>>>23,A=W+Ae|0,C^=A<<13|A>>>19,A=C+W|0,N^=A<<18|A>>>14,A=he+L|0,X^=A<<7|A>>>25,A=X+he|0,I^=A<<9|A>>>23,A=I+X|0,L^=A<<13|A>>>19,A=L+I|0,he^=A<<18|A>>>14,A=Z+X|0,oe^=A<<7|A>>>25,A=oe+Z|0,W^=A<<9|A>>>23,A=W+oe|0,X^=A<<13|A>>>19,A=X+W|0,Z^=A<<18|A>>>14,A=V+J|0,C^=A<<7|A>>>25,A=C+V|0,I^=A<<9|A>>>23,A=I+C|0,J^=A<<13|A>>>19,A=J+I|0,V^=A<<18|A>>>14,A=N+R|0,L^=A<<7|A>>>25,A=L+N|0,z^=A<<9|A>>>23,A=z+L|0,R^=A<<13|A>>>19,A=R+z|0,N^=A<<18|A>>>14,A=he+Ae|0,ie^=A<<7|A>>>25,A=ie+he|0,ye^=A<<9|A>>>23,A=ye+ie|0,Ae^=A<<13|A>>>19,A=Ae+ye|0,he^=A<<18|A>>>14;Z=Z+m|0,oe=oe+x|0,W=W+E|0,X=X+O|0,J=J+K|0,V=V+ee|0,C=C+j|0,I=I+Oe|0,z=z+Y|0,R=R+ce|0,N=N+fe|0,L=L+me|0,ie=ie+ge|0,ye=ye+de|0,Ae=Ae+pe|0,he=he+le|0,f[0]=Z>>>0&255,f[1]=Z>>>8&255,f[2]=Z>>>16&255,f[3]=Z>>>24&255,f[4]=oe>>>0&255,f[5]=oe>>>8&255,f[6]=oe>>>16&255,f[7]=oe>>>24&255,f[8]=W>>>0&255,f[9]=W>>>8&255,f[10]=W>>>16&255,f[11]=W>>>24&255,f[12]=X>>>0&255,f[13]=X>>>8&255,f[14]=X>>>16&255,f[15]=X>>>24&255,f[16]=J>>>0&255,f[17]=J>>>8&255,f[18]=J>>>16&255,f[19]=J>>>24&255,f[20]=V>>>0&255,f[21]=V>>>8&255,f[22]=V>>>16&255,f[23]=V>>>24&255,f[24]=C>>>0&255,f[25]=C>>>8&255,f[26]=C>>>16&255,f[27]=C>>>24&255,f[28]=I>>>0&255,f[29]=I>>>8&255,f[30]=I>>>16&255,f[31]=I>>>24&255,f[32]=z>>>0&255,f[33]=z>>>8&255,f[34]=z>>>16&255,f[35]=z>>>24&255,f[36]=R>>>0&255,f[37]=R>>>8&255,f[38]=R>>>16&255,f[39]=R>>>24&255,f[40]=N>>>0&255,f[41]=N>>>8&255,f[42]=N>>>16&255,f[43]=N>>>24&255,f[44]=L>>>0&255,f[45]=L>>>8&255,f[46]=L>>>16&255,f[47]=L>>>24&255,f[48]=ie>>>0&255,f[49]=ie>>>8&255,f[50]=ie>>>16&255,f[51]=ie>>>24&255,f[52]=ye>>>0&255,f[53]=ye>>>8&255,f[54]=ye>>>16&255,f[55]=ye>>>24&255,f[56]=Ae>>>0&255,f[57]=Ae>>>8&255,f[58]=Ae>>>16&255,f[59]=Ae>>>24&255,f[60]=he>>>0&255,f[61]=he>>>8&255,f[62]=he>>>16&255,f[63]=he>>>24&255}function k(f,p,l,a){for(var m=a[0]&255|(a[1]&255)<<8|(a[2]&255)<<16|(a[3]&255)<<24,x=l[0]&255|(l[1]&255)<<8|(l[2]&255)<<16|(l[3]&255)<<24,E=l[4]&255|(l[5]&255)<<8|(l[6]&255)<<16|(l[7]&255)<<24,O=l[8]&255|(l[9]&255)<<8|(l[10]&255)<<16|(l[11]&255)<<24,K=l[12]&255|(l[13]&255)<<8|(l[14]&255)<<16|(l[15]&255)<<24,ee=a[4]&255|(a[5]&255)<<8|(a[6]&255)<<16|(a[7]&255)<<24,j=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,Oe=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,Y=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,ce=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,fe=a[8]&255|(a[9]&255)<<8|(a[10]&255)<<16|(a[11]&255)<<24,me=l[16]&255|(l[17]&255)<<8|(l[18]&255)<<16|(l[19]&255)<<24,ge=l[20]&255|(l[21]&255)<<8|(l[22]&255)<<16|(l[23]&255)<<24,de=l[24]&255|(l[25]&255)<<8|(l[26]&255)<<16|(l[27]&255)<<24,pe=l[28]&255|(l[29]&255)<<8|(l[30]&255)<<16|(l[31]&255)<<24,le=a[12]&255|(a[13]&255)<<8|(a[14]&255)<<16|(a[15]&255)<<24,Z=m,oe=x,W=E,X=O,J=K,V=ee,C=j,I=Oe,z=Y,R=ce,N=fe,L=me,ie=ge,ye=de,Ae=pe,he=le,A,Ee=0;Ee<20;Ee+=2)A=Z+ie|0,J^=A<<7|A>>>25,A=J+Z|0,z^=A<<9|A>>>23,A=z+J|0,ie^=A<<13|A>>>19,A=ie+z|0,Z^=A<<18|A>>>14,A=V+oe|0,R^=A<<7|A>>>25,A=R+V|0,ye^=A<<9|A>>>23,A=ye+R|0,oe^=A<<13|A>>>19,A=oe+ye|0,V^=A<<18|A>>>14,A=N+C|0,Ae^=A<<7|A>>>25,A=Ae+N|0,W^=A<<9|A>>>23,A=W+Ae|0,C^=A<<13|A>>>19,A=C+W|0,N^=A<<18|A>>>14,A=he+L|0,X^=A<<7|A>>>25,A=X+he|0,I^=A<<9|A>>>23,A=I+X|0,L^=A<<13|A>>>19,A=L+I|0,he^=A<<18|A>>>14,A=Z+X|0,oe^=A<<7|A>>>25,A=oe+Z|0,W^=A<<9|A>>>23,A=W+oe|0,X^=A<<13|A>>>19,A=X+W|0,Z^=A<<18|A>>>14,A=V+J|0,C^=A<<7|A>>>25,A=C+V|0,I^=A<<9|A>>>23,A=I+C|0,J^=A<<13|A>>>19,A=J+I|0,V^=A<<18|A>>>14,A=N+R|0,L^=A<<7|A>>>25,A=L+N|0,z^=A<<9|A>>>23,A=z+L|0,R^=A<<13|A>>>19,A=R+z|0,N^=A<<18|A>>>14,A=he+Ae|0,ie^=A<<7|A>>>25,A=ie+he|0,ye^=A<<9|A>>>23,A=ye+ie|0,Ae^=A<<13|A>>>19,A=Ae+ye|0,he^=A<<18|A>>>14;f[0]=Z>>>0&255,f[1]=Z>>>8&255,f[2]=Z>>>16&255,f[3]=Z>>>24&255,f[4]=V>>>0&255,f[5]=V>>>8&255,f[6]=V>>>16&255,f[7]=V>>>24&255,f[8]=N>>>0&255,f[9]=N>>>8&255,f[10]=N>>>16&255,f[11]=N>>>24&255,f[12]=he>>>0&255,f[13]=he>>>8&255,f[14]=he>>>16&255,f[15]=he>>>24&255,f[16]=C>>>0&255,f[17]=C>>>8&255,f[18]=C>>>16&255,f[19]=C>>>24&255,f[20]=I>>>0&255,f[21]=I>>>8&255,f[22]=I>>>16&255,f[23]=I>>>24&255,f[24]=z>>>0&255,f[25]=z>>>8&255,f[26]=z>>>16&255,f[27]=z>>>24&255,f[28]=R>>>0&255,f[29]=R>>>8&255,f[30]=R>>>16&255,f[31]=R>>>24&255}function P(f,p,l,a){v(f,p,l,a)}function $(f,p,l,a){k(f,p,l,a)}var G=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function D(f,p,l,a,m,x,E){var O=new Uint8Array(16),K=new Uint8Array(64),ee,j;for(j=0;j<16;j++)O[j]=0;for(j=0;j<8;j++)O[j]=x[j];for(;m>=64;){for(P(K,O,E,G),j=0;j<64;j++)f[p+j]=l[a+j]^K[j];for(ee=1,j=8;j<16;j++)ee=ee+(O[j]&255)|0,O[j]=ee&255,ee>>>=8;m-=64,p+=64,a+=64}if(m>0)for(P(K,O,E,G),j=0;j<m;j++)f[p+j]=l[a+j]^K[j];return 0}function q(f,p,l,a,m){var x=new Uint8Array(16),E=new Uint8Array(64),O,K;for(K=0;K<16;K++)x[K]=0;for(K=0;K<8;K++)x[K]=a[K];for(;l>=64;){for(P(E,x,m,G),K=0;K<64;K++)f[p+K]=E[K];for(O=1,K=8;K<16;K++)O=O+(x[K]&255)|0,x[K]=O&255,O>>>=8;l-=64,p+=64}if(l>0)for(P(E,x,m,G),K=0;K<l;K++)f[p+K]=E[K];return 0}function F(f,p,l,a,m){var x=new Uint8Array(32);$(x,a,m,G);for(var E=new Uint8Array(8),O=0;O<8;O++)E[O]=a[O+16];return q(f,p,l,E,x)}function Te(f,p,l,a,m,x,E){var O=new Uint8Array(32);$(O,x,E,G);for(var K=new Uint8Array(8),ee=0;ee<8;ee++)K[ee]=x[ee+16];return D(f,p,l,a,m,K,O)}var te=function(f){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var p,l,a,m,x,E,O,K;p=f[0]&255|(f[1]&255)<<8,this.r[0]=p&8191,l=f[2]&255|(f[3]&255)<<8,this.r[1]=(p>>>13|l<<3)&8191,a=f[4]&255|(f[5]&255)<<8,this.r[2]=(l>>>10|a<<6)&7939,m=f[6]&255|(f[7]&255)<<8,this.r[3]=(a>>>7|m<<9)&8191,x=f[8]&255|(f[9]&255)<<8,this.r[4]=(m>>>4|x<<12)&255,this.r[5]=x>>>1&8190,E=f[10]&255|(f[11]&255)<<8,this.r[6]=(x>>>14|E<<2)&8191,O=f[12]&255|(f[13]&255)<<8,this.r[7]=(E>>>11|O<<5)&8065,K=f[14]&255|(f[15]&255)<<8,this.r[8]=(O>>>8|K<<8)&8191,this.r[9]=K>>>5&127,this.pad[0]=f[16]&255|(f[17]&255)<<8,this.pad[1]=f[18]&255|(f[19]&255)<<8,this.pad[2]=f[20]&255|(f[21]&255)<<8,this.pad[3]=f[22]&255|(f[23]&255)<<8,this.pad[4]=f[24]&255|(f[25]&255)<<8,this.pad[5]=f[26]&255|(f[27]&255)<<8,this.pad[6]=f[28]&255|(f[29]&255)<<8,this.pad[7]=f[30]&255|(f[31]&255)<<8};te.prototype.blocks=function(f,p,l){for(var a=this.fin?0:2048,m,x,E,O,K,ee,j,Oe,Y,ce,fe,me,ge,de,pe,le,Z,oe,W,X=this.h[0],J=this.h[1],V=this.h[2],C=this.h[3],I=this.h[4],z=this.h[5],R=this.h[6],N=this.h[7],L=this.h[8],ie=this.h[9],ye=this.r[0],Ae=this.r[1],he=this.r[2],A=this.r[3],Ee=this.r[4],Ne=this.r[5],ke=this.r[6],we=this.r[7],Be=this.r[8],Ue=this.r[9];l>=16;)m=f[p+0]&255|(f[p+1]&255)<<8,X+=m&8191,x=f[p+2]&255|(f[p+3]&255)<<8,J+=(m>>>13|x<<3)&8191,E=f[p+4]&255|(f[p+5]&255)<<8,V+=(x>>>10|E<<6)&8191,O=f[p+6]&255|(f[p+7]&255)<<8,C+=(E>>>7|O<<9)&8191,K=f[p+8]&255|(f[p+9]&255)<<8,I+=(O>>>4|K<<12)&8191,z+=K>>>1&8191,ee=f[p+10]&255|(f[p+11]&255)<<8,R+=(K>>>14|ee<<2)&8191,j=f[p+12]&255|(f[p+13]&255)<<8,N+=(ee>>>11|j<<5)&8191,Oe=f[p+14]&255|(f[p+15]&255)<<8,L+=(j>>>8|Oe<<8)&8191,ie+=Oe>>>5|a,Y=0,ce=Y,ce+=X*ye,ce+=J*(5*Ue),ce+=V*(5*Be),ce+=C*(5*we),ce+=I*(5*ke),Y=ce>>>13,ce&=8191,ce+=z*(5*Ne),ce+=R*(5*Ee),ce+=N*(5*A),ce+=L*(5*he),ce+=ie*(5*Ae),Y+=ce>>>13,ce&=8191,fe=Y,fe+=X*Ae,fe+=J*ye,fe+=V*(5*Ue),fe+=C*(5*Be),fe+=I*(5*we),Y=fe>>>13,fe&=8191,fe+=z*(5*ke),fe+=R*(5*Ne),fe+=N*(5*Ee),fe+=L*(5*A),fe+=ie*(5*he),Y+=fe>>>13,fe&=8191,me=Y,me+=X*he,me+=J*Ae,me+=V*ye,me+=C*(5*Ue),me+=I*(5*Be),Y=me>>>13,me&=8191,me+=z*(5*we),me+=R*(5*ke),me+=N*(5*Ne),me+=L*(5*Ee),me+=ie*(5*A),Y+=me>>>13,me&=8191,ge=Y,ge+=X*A,ge+=J*he,ge+=V*Ae,ge+=C*ye,ge+=I*(5*Ue),Y=ge>>>13,ge&=8191,ge+=z*(5*Be),ge+=R*(5*we),ge+=N*(5*ke),ge+=L*(5*Ne),ge+=ie*(5*Ee),Y+=ge>>>13,ge&=8191,de=Y,de+=X*Ee,de+=J*A,de+=V*he,de+=C*Ae,de+=I*ye,Y=de>>>13,de&=8191,de+=z*(5*Ue),de+=R*(5*Be),de+=N*(5*we),de+=L*(5*ke),de+=ie*(5*Ne),Y+=de>>>13,de&=8191,pe=Y,pe+=X*Ne,pe+=J*Ee,pe+=V*A,pe+=C*he,pe+=I*Ae,Y=pe>>>13,pe&=8191,pe+=z*ye,pe+=R*(5*Ue),pe+=N*(5*Be),pe+=L*(5*we),pe+=ie*(5*ke),Y+=pe>>>13,pe&=8191,le=Y,le+=X*ke,le+=J*Ne,le+=V*Ee,le+=C*A,le+=I*he,Y=le>>>13,le&=8191,le+=z*Ae,le+=R*ye,le+=N*(5*Ue),le+=L*(5*Be),le+=ie*(5*we),Y+=le>>>13,le&=8191,Z=Y,Z+=X*we,Z+=J*ke,Z+=V*Ne,Z+=C*Ee,Z+=I*A,Y=Z>>>13,Z&=8191,Z+=z*he,Z+=R*Ae,Z+=N*ye,Z+=L*(5*Ue),Z+=ie*(5*Be),Y+=Z>>>13,Z&=8191,oe=Y,oe+=X*Be,oe+=J*we,oe+=V*ke,oe+=C*Ne,oe+=I*Ee,Y=oe>>>13,oe&=8191,oe+=z*A,oe+=R*he,oe+=N*Ae,oe+=L*ye,oe+=ie*(5*Ue),Y+=oe>>>13,oe&=8191,W=Y,W+=X*Ue,W+=J*Be,W+=V*we,W+=C*ke,W+=I*Ne,Y=W>>>13,W&=8191,W+=z*Ee,W+=R*A,W+=N*he,W+=L*Ae,W+=ie*ye,Y+=W>>>13,W&=8191,Y=(Y<<2)+Y|0,Y=Y+ce|0,ce=Y&8191,Y=Y>>>13,fe+=Y,X=ce,J=fe,V=me,C=ge,I=de,z=pe,R=le,N=Z,L=oe,ie=W,p+=16,l-=16;this.h[0]=X,this.h[1]=J,this.h[2]=V,this.h[3]=C,this.h[4]=I,this.h[5]=z,this.h[6]=R,this.h[7]=N,this.h[8]=L,this.h[9]=ie},te.prototype.finish=function(f,p){var l=new Uint16Array(10),a,m,x,E;if(this.leftover){for(E=this.leftover,this.buffer[E++]=1;E<16;E++)this.buffer[E]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(a=this.h[1]>>>13,this.h[1]&=8191,E=2;E<10;E++)this.h[E]+=a,a=this.h[E]>>>13,this.h[E]&=8191;for(this.h[0]+=a*5,a=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=a,a=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=a,l[0]=this.h[0]+5,a=l[0]>>>13,l[0]&=8191,E=1;E<10;E++)l[E]=this.h[E]+a,a=l[E]>>>13,l[E]&=8191;for(l[9]-=8192,m=(a^1)-1,E=0;E<10;E++)l[E]&=m;for(m=~m,E=0;E<10;E++)this.h[E]=this.h[E]&m|l[E];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,x=this.h[0]+this.pad[0],this.h[0]=x&65535,E=1;E<8;E++)x=(this.h[E]+this.pad[E]|0)+(x>>>16)|0,this.h[E]=x&65535;f[p+0]=this.h[0]>>>0&255,f[p+1]=this.h[0]>>>8&255,f[p+2]=this.h[1]>>>0&255,f[p+3]=this.h[1]>>>8&255,f[p+4]=this.h[2]>>>0&255,f[p+5]=this.h[2]>>>8&255,f[p+6]=this.h[3]>>>0&255,f[p+7]=this.h[3]>>>8&255,f[p+8]=this.h[4]>>>0&255,f[p+9]=this.h[4]>>>8&255,f[p+10]=this.h[5]>>>0&255,f[p+11]=this.h[5]>>>8&255,f[p+12]=this.h[6]>>>0&255,f[p+13]=this.h[6]>>>8&255,f[p+14]=this.h[7]>>>0&255,f[p+15]=this.h[7]>>>8&255},te.prototype.update=function(f,p,l){var a,m;if(this.leftover){for(m=16-this.leftover,m>l&&(m=l),a=0;a<m;a++)this.buffer[this.leftover+a]=f[p+a];if(l-=m,p+=m,this.leftover+=m,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(l>=16&&(m=l-l%16,this.blocks(f,p,m),p+=m,l-=m),l){for(a=0;a<l;a++)this.buffer[this.leftover+a]=f[p+a];this.leftover+=l}};function Q(f,p,l,a,m,x){var E=new te(x);return E.update(l,a,m),E.finish(f,p),0}function Ce(f,p,l,a,m,x){var E=new Uint8Array(16);return Q(E,0,l,a,m,x),h(f,p,E,0)}function Ie(f,p,l,a,m){var x;if(l<32)return-1;for(Te(f,0,p,0,l,a,m),Q(f,16,f,32,l-32,f),x=0;x<16;x++)f[x]=0;return 0}function Ye(f,p,l,a,m){var x,E=new Uint8Array(32);if(l<32||(F(E,0,32,a,m),Ce(p,16,p,32,l-32,E)!==0))return-1;for(Te(f,0,p,0,l,a,m),x=0;x<32;x++)f[x]=0;return 0}function _(f,p){var l;for(l=0;l<16;l++)f[l]=p[l]|0}function U(f){var p,l,a=1;for(p=0;p<16;p++)l=f[p]+a+65535,a=Math.floor(l/65536),f[p]=l-a*65536;f[0]+=a-1+37*(a-1)}function H(f,p,l){for(var a,m=~(l-1),x=0;x<16;x++)a=m&(f[x]^p[x]),f[x]^=a,p[x]^=a}function ne(f,p){var l,a,m,x=t(),E=t();for(l=0;l<16;l++)E[l]=p[l];for(U(E),U(E),U(E),a=0;a<2;a++){for(x[0]=E[0]-65517,l=1;l<15;l++)x[l]=E[l]-65535-(x[l-1]>>16&1),x[l-1]&=65535;x[15]=E[15]-32767-(x[14]>>16&1),m=x[15]>>16&1,x[14]&=65535,H(E,x,1-m)}for(l=0;l<16;l++)f[2*l]=E[l]&255,f[2*l+1]=E[l]>>8}function re(f,p){var l=new Uint8Array(32),a=new Uint8Array(32);return ne(l,f),ne(a,p),w(l,0,a,0)}function be(f){var p=new Uint8Array(32);return ne(p,f),p[0]&1}function ze(f,p){var l;for(l=0;l<16;l++)f[l]=p[2*l]+(p[2*l+1]<<8);f[15]&=32767}function _e(f,p,l){for(var a=0;a<16;a++)f[a]=p[a]+l[a]}function Le(f,p,l){for(var a=0;a<16;a++)f[a]=p[a]-l[a]}function se(f,p,l){var a,m,x=0,E=0,O=0,K=0,ee=0,j=0,Oe=0,Y=0,ce=0,fe=0,me=0,ge=0,de=0,pe=0,le=0,Z=0,oe=0,W=0,X=0,J=0,V=0,C=0,I=0,z=0,R=0,N=0,L=0,ie=0,ye=0,Ae=0,he=0,A=l[0],Ee=l[1],Ne=l[2],ke=l[3],we=l[4],Be=l[5],Ue=l[6],ct=l[7],qe=l[8],Je=l[9],et=l[10],tt=l[11],lt=l[12],bt=l[13],wt=l[14],Tt=l[15];a=p[0],x+=a*A,E+=a*Ee,O+=a*Ne,K+=a*ke,ee+=a*we,j+=a*Be,Oe+=a*Ue,Y+=a*ct,ce+=a*qe,fe+=a*Je,me+=a*et,ge+=a*tt,de+=a*lt,pe+=a*bt,le+=a*wt,Z+=a*Tt,a=p[1],E+=a*A,O+=a*Ee,K+=a*Ne,ee+=a*ke,j+=a*we,Oe+=a*Be,Y+=a*Ue,ce+=a*ct,fe+=a*qe,me+=a*Je,ge+=a*et,de+=a*tt,pe+=a*lt,le+=a*bt,Z+=a*wt,oe+=a*Tt,a=p[2],O+=a*A,K+=a*Ee,ee+=a*Ne,j+=a*ke,Oe+=a*we,Y+=a*Be,ce+=a*Ue,fe+=a*ct,me+=a*qe,ge+=a*Je,de+=a*et,pe+=a*tt,le+=a*lt,Z+=a*bt,oe+=a*wt,W+=a*Tt,a=p[3],K+=a*A,ee+=a*Ee,j+=a*Ne,Oe+=a*ke,Y+=a*we,ce+=a*Be,fe+=a*Ue,me+=a*ct,ge+=a*qe,de+=a*Je,pe+=a*et,le+=a*tt,Z+=a*lt,oe+=a*bt,W+=a*wt,X+=a*Tt,a=p[4],ee+=a*A,j+=a*Ee,Oe+=a*Ne,Y+=a*ke,ce+=a*we,fe+=a*Be,me+=a*Ue,ge+=a*ct,de+=a*qe,pe+=a*Je,le+=a*et,Z+=a*tt,oe+=a*lt,W+=a*bt,X+=a*wt,J+=a*Tt,a=p[5],j+=a*A,Oe+=a*Ee,Y+=a*Ne,ce+=a*ke,fe+=a*we,me+=a*Be,ge+=a*Ue,de+=a*ct,pe+=a*qe,le+=a*Je,Z+=a*et,oe+=a*tt,W+=a*lt,X+=a*bt,J+=a*wt,V+=a*Tt,a=p[6],Oe+=a*A,Y+=a*Ee,ce+=a*Ne,fe+=a*ke,me+=a*we,ge+=a*Be,de+=a*Ue,pe+=a*ct,le+=a*qe,Z+=a*Je,oe+=a*et,W+=a*tt,X+=a*lt,J+=a*bt,V+=a*wt,C+=a*Tt,a=p[7],Y+=a*A,ce+=a*Ee,fe+=a*Ne,me+=a*ke,ge+=a*we,de+=a*Be,pe+=a*Ue,le+=a*ct,Z+=a*qe,oe+=a*Je,W+=a*et,X+=a*tt,J+=a*lt,V+=a*bt,C+=a*wt,I+=a*Tt,a=p[8],ce+=a*A,fe+=a*Ee,me+=a*Ne,ge+=a*ke,de+=a*we,pe+=a*Be,le+=a*Ue,Z+=a*ct,oe+=a*qe,W+=a*Je,X+=a*et,J+=a*tt,V+=a*lt,C+=a*bt,I+=a*wt,z+=a*Tt,a=p[9],fe+=a*A,me+=a*Ee,ge+=a*Ne,de+=a*ke,pe+=a*we,le+=a*Be,Z+=a*Ue,oe+=a*ct,W+=a*qe,X+=a*Je,J+=a*et,V+=a*tt,C+=a*lt,I+=a*bt,z+=a*wt,R+=a*Tt,a=p[10],me+=a*A,ge+=a*Ee,de+=a*Ne,pe+=a*ke,le+=a*we,Z+=a*Be,oe+=a*Ue,W+=a*ct,X+=a*qe,J+=a*Je,V+=a*et,C+=a*tt,I+=a*lt,z+=a*bt,R+=a*wt,N+=a*Tt,a=p[11],ge+=a*A,de+=a*Ee,pe+=a*Ne,le+=a*ke,Z+=a*we,oe+=a*Be,W+=a*Ue,X+=a*ct,J+=a*qe,V+=a*Je,C+=a*et,I+=a*tt,z+=a*lt,R+=a*bt,N+=a*wt,L+=a*Tt,a=p[12],de+=a*A,pe+=a*Ee,le+=a*Ne,Z+=a*ke,oe+=a*we,W+=a*Be,X+=a*Ue,J+=a*ct,V+=a*qe,C+=a*Je,I+=a*et,z+=a*tt,R+=a*lt,N+=a*bt,L+=a*wt,ie+=a*Tt,a=p[13],pe+=a*A,le+=a*Ee,Z+=a*Ne,oe+=a*ke,W+=a*we,X+=a*Be,J+=a*Ue,V+=a*ct,C+=a*qe,I+=a*Je,z+=a*et,R+=a*tt,N+=a*lt,L+=a*bt,ie+=a*wt,ye+=a*Tt,a=p[14],le+=a*A,Z+=a*Ee,oe+=a*Ne,W+=a*ke,X+=a*we,J+=a*Be,V+=a*Ue,C+=a*ct,I+=a*qe,z+=a*Je,R+=a*et,N+=a*tt,L+=a*lt,ie+=a*bt,ye+=a*wt,Ae+=a*Tt,a=p[15],Z+=a*A,oe+=a*Ee,W+=a*Ne,X+=a*ke,J+=a*we,V+=a*Be,C+=a*Ue,I+=a*ct,z+=a*qe,R+=a*Je,N+=a*et,L+=a*tt,ie+=a*lt,ye+=a*bt,Ae+=a*wt,he+=a*Tt,x+=38*oe,E+=38*W,O+=38*X,K+=38*J,ee+=38*V,j+=38*C,Oe+=38*I,Y+=38*z,ce+=38*R,fe+=38*N,me+=38*L,ge+=38*ie,de+=38*ye,pe+=38*Ae,le+=38*he,m=1,a=x+m+65535,m=Math.floor(a/65536),x=a-m*65536,a=E+m+65535,m=Math.floor(a/65536),E=a-m*65536,a=O+m+65535,m=Math.floor(a/65536),O=a-m*65536,a=K+m+65535,m=Math.floor(a/65536),K=a-m*65536,a=ee+m+65535,m=Math.floor(a/65536),ee=a-m*65536,a=j+m+65535,m=Math.floor(a/65536),j=a-m*65536,a=Oe+m+65535,m=Math.floor(a/65536),Oe=a-m*65536,a=Y+m+65535,m=Math.floor(a/65536),Y=a-m*65536,a=ce+m+65535,m=Math.floor(a/65536),ce=a-m*65536,a=fe+m+65535,m=Math.floor(a/65536),fe=a-m*65536,a=me+m+65535,m=Math.floor(a/65536),me=a-m*65536,a=ge+m+65535,m=Math.floor(a/65536),ge=a-m*65536,a=de+m+65535,m=Math.floor(a/65536),de=a-m*65536,a=pe+m+65535,m=Math.floor(a/65536),pe=a-m*65536,a=le+m+65535,m=Math.floor(a/65536),le=a-m*65536,a=Z+m+65535,m=Math.floor(a/65536),Z=a-m*65536,x+=m-1+37*(m-1),m=1,a=x+m+65535,m=Math.floor(a/65536),x=a-m*65536,a=E+m+65535,m=Math.floor(a/65536),E=a-m*65536,a=O+m+65535,m=Math.floor(a/65536),O=a-m*65536,a=K+m+65535,m=Math.floor(a/65536),K=a-m*65536,a=ee+m+65535,m=Math.floor(a/65536),ee=a-m*65536,a=j+m+65535,m=Math.floor(a/65536),j=a-m*65536,a=Oe+m+65535,m=Math.floor(a/65536),Oe=a-m*65536,a=Y+m+65535,m=Math.floor(a/65536),Y=a-m*65536,a=ce+m+65535,m=Math.floor(a/65536),ce=a-m*65536,a=fe+m+65535,m=Math.floor(a/65536),fe=a-m*65536,a=me+m+65535,m=Math.floor(a/65536),me=a-m*65536,a=ge+m+65535,m=Math.floor(a/65536),ge=a-m*65536,a=de+m+65535,m=Math.floor(a/65536),de=a-m*65536,a=pe+m+65535,m=Math.floor(a/65536),pe=a-m*65536,a=le+m+65535,m=Math.floor(a/65536),le=a-m*65536,a=Z+m+65535,m=Math.floor(a/65536),Z=a-m*65536,x+=m-1+37*(m-1),f[0]=x,f[1]=E,f[2]=O,f[3]=K,f[4]=ee,f[5]=j,f[6]=Oe,f[7]=Y,f[8]=ce,f[9]=fe,f[10]=me,f[11]=ge,f[12]=de,f[13]=pe,f[14]=le,f[15]=Z}function $e(f,p){se(f,p,p)}function Rt(f,p){var l=t(),a;for(a=0;a<16;a++)l[a]=p[a];for(a=253;a>=0;a--)$e(l,l),a!==2&&a!==4&&se(l,l,p);for(a=0;a<16;a++)f[a]=l[a]}function ut(f,p){var l=t(),a;for(a=0;a<16;a++)l[a]=p[a];for(a=250;a>=0;a--)$e(l,l),a!==1&&se(l,l,p);for(a=0;a<16;a++)f[a]=l[a]}function $t(f,p,l){var a=new Uint8Array(32),m=new Float64Array(80),x,E,O=t(),K=t(),ee=t(),j=t(),Oe=t(),Y=t();for(E=0;E<31;E++)a[E]=p[E];for(a[31]=p[31]&127|64,a[0]&=248,ze(m,l),E=0;E<16;E++)K[E]=m[E],j[E]=O[E]=ee[E]=0;for(O[0]=j[0]=1,E=254;E>=0;--E)x=a[E>>>3]>>>(E&7)&1,H(O,K,x),H(ee,j,x),_e(Oe,O,ee),Le(O,O,ee),_e(ee,K,j),Le(K,K,j),$e(j,Oe),$e(Y,O),se(O,ee,O),se(ee,K,Oe),_e(Oe,O,ee),Le(O,O,ee),$e(K,O),Le(ee,j,Y),se(O,ee,c),_e(O,O,j),se(ee,ee,O),se(O,j,Y),se(j,K,m),$e(K,Oe),H(O,K,x),H(ee,j,x);for(E=0;E<16;E++)m[E+16]=O[E],m[E+32]=ee[E],m[E+48]=K[E],m[E+64]=j[E];var ce=m.subarray(32),fe=m.subarray(16);return Rt(ce,ce),se(fe,fe,ce),ne(f,fe),0}function ft(f,p){return $t(f,p,o)}function xt(f,p){return e(p,32),ft(f,p)}function xn(f,p,l){var a=new Uint8Array(32);return $t(a,l,p),$(f,r,a,G)}var We=Ie,St=Ye;function on(f,p,l,a,m,x){var E=new Uint8Array(32);return xn(E,m,x),We(f,p,l,a,E)}function Ir(f,p,l,a,m,x){var E=new Uint8Array(32);return xn(E,m,x),St(f,p,l,a,E)}var Xn=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Vu(f,p,l,a){for(var m=new Int32Array(16),x=new Int32Array(16),E,O,K,ee,j,Oe,Y,ce,fe,me,ge,de,pe,le,Z,oe,W,X,J,V,C,I,z,R,N,L,ie=f[0],ye=f[1],Ae=f[2],he=f[3],A=f[4],Ee=f[5],Ne=f[6],ke=f[7],we=p[0],Be=p[1],Ue=p[2],ct=p[3],qe=p[4],Je=p[5],et=p[6],tt=p[7],lt=0;a>=128;){for(J=0;J<16;J++)V=8*J+lt,m[J]=l[V+0]<<24|l[V+1]<<16|l[V+2]<<8|l[V+3],x[J]=l[V+4]<<24|l[V+5]<<16|l[V+6]<<8|l[V+7];for(J=0;J<80;J++)if(E=ie,O=ye,K=Ae,ee=he,j=A,Oe=Ee,Y=Ne,ce=ke,fe=we,me=Be,ge=Ue,de=ct,pe=qe,le=Je,Z=et,oe=tt,C=ke,I=tt,z=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=(A>>>14|qe<<18)^(A>>>18|qe<<14)^(qe>>>9|A<<23),I=(qe>>>14|A<<18)^(qe>>>18|A<<14)^(A>>>9|qe<<23),z+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,C=A&Ee^~A&Ne,I=qe&Je^~qe&et,z+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,C=Xn[J*2],I=Xn[J*2+1],z+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,C=m[J%16],I=x[J%16],z+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=z>>>16,N+=R>>>16,L+=N>>>16,W=N&65535|L<<16,X=z&65535|R<<16,C=W,I=X,z=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=(ie>>>28|we<<4)^(we>>>2|ie<<30)^(we>>>7|ie<<25),I=(we>>>28|ie<<4)^(ie>>>2|we<<30)^(ie>>>7|we<<25),z+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,C=ie&ye^ie&Ae^ye&Ae,I=we&Be^we&Ue^Be&Ue,z+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=z>>>16,N+=R>>>16,L+=N>>>16,ce=N&65535|L<<16,oe=z&65535|R<<16,C=ee,I=de,z=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=W,I=X,z+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=z>>>16,N+=R>>>16,L+=N>>>16,ee=N&65535|L<<16,de=z&65535|R<<16,ye=E,Ae=O,he=K,A=ee,Ee=j,Ne=Oe,ke=Y,ie=ce,Be=fe,Ue=me,ct=ge,qe=de,Je=pe,et=le,tt=Z,we=oe,J%16===15)for(V=0;V<16;V++)C=m[V],I=x[V],z=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=m[(V+9)%16],I=x[(V+9)%16],z+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,W=m[(V+1)%16],X=x[(V+1)%16],C=(W>>>1|X<<31)^(W>>>8|X<<24)^W>>>7,I=(X>>>1|W<<31)^(X>>>8|W<<24)^(X>>>7|W<<25),z+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,W=m[(V+14)%16],X=x[(V+14)%16],C=(W>>>19|X<<13)^(X>>>29|W<<3)^W>>>6,I=(X>>>19|W<<13)^(W>>>29|X<<3)^(X>>>6|W<<26),z+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=z>>>16,N+=R>>>16,L+=N>>>16,m[V]=N&65535|L<<16,x[V]=z&65535|R<<16;C=ie,I=we,z=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=f[0],I=p[0],z+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=z>>>16,N+=R>>>16,L+=N>>>16,f[0]=ie=N&65535|L<<16,p[0]=we=z&65535|R<<16,C=ye,I=Be,z=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=f[1],I=p[1],z+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=z>>>16,N+=R>>>16,L+=N>>>16,f[1]=ye=N&65535|L<<16,p[1]=Be=z&65535|R<<16,C=Ae,I=Ue,z=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=f[2],I=p[2],z+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=z>>>16,N+=R>>>16,L+=N>>>16,f[2]=Ae=N&65535|L<<16,p[2]=Ue=z&65535|R<<16,C=he,I=ct,z=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=f[3],I=p[3],z+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=z>>>16,N+=R>>>16,L+=N>>>16,f[3]=he=N&65535|L<<16,p[3]=ct=z&65535|R<<16,C=A,I=qe,z=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=f[4],I=p[4],z+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=z>>>16,N+=R>>>16,L+=N>>>16,f[4]=A=N&65535|L<<16,p[4]=qe=z&65535|R<<16,C=Ee,I=Je,z=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=f[5],I=p[5],z+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=z>>>16,N+=R>>>16,L+=N>>>16,f[5]=Ee=N&65535|L<<16,p[5]=Je=z&65535|R<<16,C=Ne,I=et,z=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=f[6],I=p[6],z+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=z>>>16,N+=R>>>16,L+=N>>>16,f[6]=Ne=N&65535|L<<16,p[6]=et=z&65535|R<<16,C=ke,I=tt,z=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=f[7],I=p[7],z+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=z>>>16,N+=R>>>16,L+=N>>>16,f[7]=ke=N&65535|L<<16,p[7]=tt=z&65535|R<<16,lt+=128,a-=128}return a}function Br(f,p,l){var a=new Int32Array(8),m=new Int32Array(8),x=new Uint8Array(256),E,O=l;for(a[0]=1779033703,a[1]=3144134277,a[2]=1013904242,a[3]=2773480762,a[4]=1359893119,a[5]=2600822924,a[6]=528734635,a[7]=1541459225,m[0]=4089235720,m[1]=2227873595,m[2]=4271175723,m[3]=1595750129,m[4]=2917565137,m[5]=725511199,m[6]=4215389547,m[7]=327033209,Vu(a,m,p,l),l%=128,E=0;E<l;E++)x[E]=p[O-l+E];for(x[l]=128,l=256-128*(l<112?1:0),x[l-9]=0,S(x,l-8,O/536870912|0,O<<3),Vu(a,m,x,l),E=0;E<8;E++)S(f,8*E,a[E],m[E]);return 0}function Ls(f,p){var l=t(),a=t(),m=t(),x=t(),E=t(),O=t(),K=t(),ee=t(),j=t();Le(l,f[1],f[0]),Le(j,p[1],p[0]),se(l,l,j),_e(a,f[0],f[1]),_e(j,p[0],p[1]),se(a,a,j),se(m,f[3],p[3]),se(m,m,d),se(x,f[2],p[2]),_e(x,x,x),Le(E,a,l),Le(O,x,m),_e(K,x,m),_e(ee,a,l),se(f[0],E,O),se(f[1],ee,K),se(f[2],K,O),se(f[3],E,ee)}function ju(f,p,l){var a;for(a=0;a<4;a++)H(f[a],p[a],l)}function _a(f,p){var l=t(),a=t(),m=t();Rt(m,p[2]),se(l,p[0],m),se(a,p[1],m),ne(f,a),f[31]^=be(l)<<7}function Ea(f,p,l){var a,m;for(_(f[0],s),_(f[1],i),_(f[2],i),_(f[3],s),m=255;m>=0;--m)a=l[m/8|0]>>(m&7)&1,ju(f,p,a),Ls(p,f),Ls(f,f),ju(f,p,a)}function qs(f,p){var l=[t(),t(),t(),t()];_(l[0],y),_(l[1],g),_(l[2],i),se(l[3],y,g),Ea(f,l,p)}function Sa(f,p,l){var a=new Uint8Array(64),m=[t(),t(),t(),t()],x;for(l||e(p,32),Br(a,p,32),a[0]&=248,a[31]&=127,a[31]|=64,qs(m,a),_a(f,m),x=0;x<32;x++)p[x+32]=f[x];return 0}var Ks=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function va(f,p){var l,a,m,x;for(a=63;a>=32;--a){for(l=0,m=a-32,x=a-12;m<x;++m)p[m]+=l-16*p[a]*Ks[m-(a-32)],l=Math.floor((p[m]+128)/256),p[m]-=l*256;p[m]+=l,p[a]=0}for(l=0,m=0;m<32;m++)p[m]+=l-(p[31]>>4)*Ks[m],l=p[m]>>8,p[m]&=255;for(m=0;m<32;m++)p[m]-=l*Ks[m];for(a=0;a<32;a++)p[a+1]+=p[a]>>8,f[a]=p[a]&255}function Ca(f){var p=new Float64Array(64),l;for(l=0;l<64;l++)p[l]=f[l];for(l=0;l<64;l++)f[l]=0;va(f,p)}function Wu(f,p,l,a){var m=new Uint8Array(64),x=new Uint8Array(64),E=new Uint8Array(64),O,K,ee=new Float64Array(64),j=[t(),t(),t(),t()];Br(m,a,32),m[0]&=248,m[31]&=127,m[31]|=64;var Oe=l+64;for(O=0;O<l;O++)f[64+O]=p[O];for(O=0;O<32;O++)f[32+O]=m[32+O];for(Br(E,f.subarray(32),l+32),Ca(E),qs(j,E),_a(f,j),O=32;O<64;O++)f[O]=a[O];for(Br(x,f,l+64),Ca(x),O=0;O<64;O++)ee[O]=0;for(O=0;O<32;O++)ee[O]=E[O];for(O=0;O<32;O++)for(K=0;K<32;K++)ee[O+K]+=x[O]*m[K];return va(f.subarray(32),ee),Oe}function Wp(f,p){var l=t(),a=t(),m=t(),x=t(),E=t(),O=t(),K=t();return _(f[2],i),ze(f[1],p),$e(m,f[1]),se(x,m,u),Le(m,m,f[2]),_e(x,f[2],x),$e(E,x),$e(O,E),se(K,O,E),se(l,K,m),se(l,l,x),ut(l,l),se(l,l,m),se(l,l,x),se(l,l,x),se(f[0],l,x),$e(a,f[0]),se(a,a,x),re(a,m)&&se(f[0],f[0],T),$e(a,f[0]),se(a,a,x),re(a,m)?-1:(be(f[0])===p[31]>>7&&Le(f[0],s,f[0]),se(f[3],f[0],f[1]),0)}function Ia(f,p,l,a){var m,x=new Uint8Array(32),E=new Uint8Array(64),O=[t(),t(),t(),t()],K=[t(),t(),t(),t()];if(l<64||Wp(K,a))return-1;for(m=0;m<l;m++)f[m]=p[m];for(m=0;m<32;m++)f[m+32]=a[m];if(Br(E,f,l),Ca(E),Ea(O,K,E),qs(K,p.subarray(32)),Ls(O,K),_a(x,O),l-=64,w(p,0,x,0)){for(m=0;m<l;m++)f[m]=0;return-1}for(m=0;m<l;m++)f[m]=p[m+64];return l}var Ba=32,Fs=24,Lo=32,fo=16,qo=32,Hs=32,Ko=32,Fo=32,Ua=32,Qu=Fs,Qp=Lo,Yp=fo,On=64,Ur=32,lo=64,Pa=32,Ra=64;n.lowlevel={crypto_core_hsalsa20:$,crypto_stream_xor:Te,crypto_stream:F,crypto_stream_salsa20_xor:D,crypto_stream_salsa20:q,crypto_onetimeauth:Q,crypto_onetimeauth_verify:Ce,crypto_verify_16:h,crypto_verify_32:w,crypto_secretbox:Ie,crypto_secretbox_open:Ye,crypto_scalarmult:$t,crypto_scalarmult_base:ft,crypto_box_beforenm:xn,crypto_box_afternm:We,crypto_box:on,crypto_box_open:Ir,crypto_box_keypair:xt,crypto_hash:Br,crypto_sign:Wu,crypto_sign_keypair:Sa,crypto_sign_open:Ia,crypto_secretbox_KEYBYTES:Ba,crypto_secretbox_NONCEBYTES:Fs,crypto_secretbox_ZEROBYTES:Lo,crypto_secretbox_BOXZEROBYTES:fo,crypto_scalarmult_BYTES:qo,crypto_scalarmult_SCALARBYTES:Hs,crypto_box_PUBLICKEYBYTES:Ko,crypto_box_SECRETKEYBYTES:Fo,crypto_box_BEFORENMBYTES:Ua,crypto_box_NONCEBYTES:Qu,crypto_box_ZEROBYTES:Qp,crypto_box_BOXZEROBYTES:Yp,crypto_sign_BYTES:On,crypto_sign_PUBLICKEYBYTES:Ur,crypto_sign_SECRETKEYBYTES:lo,crypto_sign_SEEDBYTES:Pa,crypto_hash_BYTES:Ra,gf:t,D:u,L:Ks,pack25519:ne,unpack25519:ze,M:se,A:_e,S:$e,Z:Le,pow2523:ut,add:Ls,set25519:_,modL:va,scalarmult:Ea,scalarbase:qs};function Yu(f,p){if(f.length!==Ba)throw new Error("bad key size");if(p.length!==Fs)throw new Error("bad nonce size")}function Zp(f,p){if(f.length!==Ko)throw new Error("bad public key size");if(p.length!==Fo)throw new Error("bad secret key size")}function zt(){for(var f=0;f<arguments.length;f++)if(!(arguments[f]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Zu(f){for(var p=0;p<f.length;p++)f[p]=0}n.randomBytes=function(f){var p=new Uint8Array(f);return e(p,f),p},n.secretbox=function(f,p,l){zt(f,p,l),Yu(l,p);for(var a=new Uint8Array(Lo+f.length),m=new Uint8Array(a.length),x=0;x<f.length;x++)a[x+Lo]=f[x];return Ie(m,a,a.length,p,l),m.subarray(fo)},n.secretbox.open=function(f,p,l){zt(f,p,l),Yu(l,p);for(var a=new Uint8Array(fo+f.length),m=new Uint8Array(a.length),x=0;x<f.length;x++)a[x+fo]=f[x];return a.length<32||Ye(m,a,a.length,p,l)!==0?null:m.subarray(Lo)},n.secretbox.keyLength=Ba,n.secretbox.nonceLength=Fs,n.secretbox.overheadLength=fo,n.scalarMult=function(f,p){if(zt(f,p),f.length!==Hs)throw new Error("bad n size");if(p.length!==qo)throw new Error("bad p size");var l=new Uint8Array(qo);return $t(l,f,p),l},n.scalarMult.base=function(f){if(zt(f),f.length!==Hs)throw new Error("bad n size");var p=new Uint8Array(qo);return ft(p,f),p},n.scalarMult.scalarLength=Hs,n.scalarMult.groupElementLength=qo,n.box=function(f,p,l,a){var m=n.box.before(l,a);return n.secretbox(f,p,m)},n.box.before=function(f,p){zt(f,p),Zp(f,p);var l=new Uint8Array(Ua);return xn(l,f,p),l},n.box.after=n.secretbox,n.box.open=function(f,p,l,a){var m=n.box.before(l,a);return n.secretbox.open(f,p,m)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var f=new Uint8Array(Ko),p=new Uint8Array(Fo);return xt(f,p),{publicKey:f,secretKey:p}},n.box.keyPair.fromSecretKey=function(f){if(zt(f),f.length!==Fo)throw new Error("bad secret key size");var p=new Uint8Array(Ko);return ft(p,f),{publicKey:p,secretKey:new Uint8Array(f)}},n.box.publicKeyLength=Ko,n.box.secretKeyLength=Fo,n.box.sharedKeyLength=Ua,n.box.nonceLength=Qu,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(f,p){if(zt(f,p),p.length!==lo)throw new Error("bad secret key size");var l=new Uint8Array(On+f.length);return Wu(l,f,f.length,p),l},n.sign.open=function(f,p){if(zt(f,p),p.length!==Ur)throw new Error("bad public key size");var l=new Uint8Array(f.length),a=Ia(l,f,f.length,p);if(a<0)return null;for(var m=new Uint8Array(a),x=0;x<m.length;x++)m[x]=l[x];return m},n.sign.detached=function(f,p){for(var l=n.sign(f,p),a=new Uint8Array(On),m=0;m<a.length;m++)a[m]=l[m];return a},n.sign.detached.verify=function(f,p,l){if(zt(f,p,l),p.length!==On)throw new Error("bad signature size");if(l.length!==Ur)throw new Error("bad public key size");var a=new Uint8Array(On+f.length),m=new Uint8Array(On+f.length),x;for(x=0;x<On;x++)a[x]=p[x];for(x=0;x<f.length;x++)a[x+On]=f[x];return Ia(m,a,a.length,l)>=0},n.sign.keyPair=function(){var f=new Uint8Array(Ur),p=new Uint8Array(lo);return Sa(f,p),{publicKey:f,secretKey:p}},n.sign.keyPair.fromSecretKey=function(f){if(zt(f),f.length!==lo)throw new Error("bad secret key size");for(var p=new Uint8Array(Ur),l=0;l<p.length;l++)p[l]=f[32+l];return{publicKey:p,secretKey:new Uint8Array(f)}},n.sign.keyPair.fromSeed=function(f){if(zt(f),f.length!==Pa)throw new Error("bad seed size");for(var p=new Uint8Array(Ur),l=new Uint8Array(lo),a=0;a<32;a++)l[a]=f[a];return Sa(p,l,!0),{publicKey:p,secretKey:l}},n.sign.publicKeyLength=Ur,n.sign.secretKeyLength=lo,n.sign.seedLength=Pa,n.sign.signatureLength=On,n.hash=function(f){zt(f);var p=new Uint8Array(Ra);return Br(p,f,f.length),p},n.hash.hashLength=Ra,n.verify=function(f,p){return zt(f,p),f.length===0||p.length===0||f.length!==p.length?!1:b(f,0,p,0,f.length)===0},n.setPRNG=function(f){e=f},function(){var f=typeof self<"u"?self.crypto||self.msCrypto:null;if(f&&f.getRandomValues){var p=65536;n.setPRNG(function(l,a){var m,x=new Uint8Array(a);for(m=0;m<a;m+=p)f.getRandomValues(x.subarray(m,m+Math.min(a-m,p)));for(m=0;m<a;m++)l[m]=x[m];Zu(x)})}else typeof Ju<"u"&&(f=Ef(),f&&f.randomBytes&&n.setPRNG(function(l,a){var m,x=f.randomBytes(a);for(m=0;m<a;m++)l[m]=x[m];Zu(x)}))}()})(typeof ui<"u"&&ui.exports?ui.exports:self.nacl=self.nacl||{})});var Vp=Oa((R6,Fu)=>{"use strict";var a0=Object.prototype.hasOwnProperty,Pt="~";function Ds(){}Object.create&&(Ds.prototype=Object.create(null),new Ds().__proto__||(Pt=!1));function c0(n,t,e){this.fn=n,this.context=t,this.once=e||!1}function $p(n,t,e,r,o){if(typeof e!="function")throw new TypeError("The listener must be a function");var s=new c0(e,r||n,o),i=Pt?Pt+t:t;return n._events[i]?n._events[i].fn?n._events[i]=[n._events[i],s]:n._events[i].push(s):(n._events[i]=s,n._eventsCount++),n}function xa(n,t){--n._eventsCount===0?n._events=new Ds:delete n._events[t]}function Et(){this._events=new Ds,this._eventsCount=0}Et.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)a0.call(e,r)&&t.push(Pt?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Et.prototype.listeners=function(t){var e=Pt?Pt+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,s=r.length,i=new Array(s);o<s;o++)i[o]=r[o].fn;return i};Et.prototype.listenerCount=function(t){var e=Pt?Pt+t:t,r=this._events[e];return r?r.fn?1:r.length:0};Et.prototype.emit=function(t,e,r,o,s,i){var c=Pt?Pt+t:t;if(!this._events[c])return!1;var u=this._events[c],d=arguments.length,y,g;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,r),!0;case 4:return u.fn.call(u.context,e,r,o),!0;case 5:return u.fn.call(u.context,e,r,o,s),!0;case 6:return u.fn.call(u.context,e,r,o,s,i),!0}for(g=1,y=new Array(d-1);g<d;g++)y[g-1]=arguments[g];u.fn.apply(u.context,y)}else{var T=u.length,S;for(g=0;g<T;g++)switch(u[g].once&&this.removeListener(t,u[g].fn,void 0,!0),d){case 1:u[g].fn.call(u[g].context);break;case 2:u[g].fn.call(u[g].context,e);break;case 3:u[g].fn.call(u[g].context,e,r);break;case 4:u[g].fn.call(u[g].context,e,r,o);break;default:if(!y)for(S=1,y=new Array(d-1);S<d;S++)y[S-1]=arguments[S];u[g].fn.apply(u[g].context,y)}}return!0};Et.prototype.on=function(t,e,r){return $p(this,t,e,r,!1)};Et.prototype.once=function(t,e,r){return $p(this,t,e,r,!0)};Et.prototype.removeListener=function(t,e,r,o){var s=Pt?Pt+t:t;if(!this._events[s])return this;if(!e)return xa(this,s),this;var i=this._events[s];if(i.fn)i.fn===e&&(!o||i.once)&&(!r||i.context===r)&&xa(this,s);else{for(var c=0,u=[],d=i.length;c<d;c++)(i[c].fn!==e||o&&!i[c].once||r&&i[c].context!==r)&&u.push(i[c]);u.length?this._events[s]=u.length===1?u[0]:u:xa(this,s)}return this};Et.prototype.removeAllListeners=function(t){var e;return t?(e=Pt?Pt+t:t,this._events[e]&&xa(this,e)):(this._events=new Ds,this._eventsCount=0),this};Et.prototype.off=Et.prototype.removeListener;Et.prototype.addListener=Et.prototype.on;Et.prefixed=Pt;Et.EventEmitter=Et;typeof Fu<"u"&&(Fu.exports=Et)});var u0={};$s(u0,{APTOS_BIP44_REGEX:()=>Uf,APTOS_COIN:()=>Qo,APTOS_HARDENED_REGEX:()=>Bf,Account:()=>Qn,AccountAddress:()=>M,AccountAuthenticator:()=>Nt,AccountAuthenticatorEd25519:()=>Cn,AccountAuthenticatorMultiEd25519:()=>hs,AccountAuthenticatorMultiKey:()=>Zr,AccountAuthenticatorSingleKey:()=>yn,AccountAuthenticatorVariant:()=>Ma,AccountSequenceNumber:()=>zs,AddressInvalidReason:()=>yf,AnyPublicKey:()=>Ze,AnyPublicKeyVariant:()=>Ga,AnySignature:()=>En,AnySignatureVariant:()=>La,Aptos:()=>Ht,AptosApiError:()=>bn,AptosApiType:()=>jo,AptosConfig:()=>ms,AuthenticationKey:()=>mn,Bool:()=>nt,CKDPriv:()=>fc,ChainId:()=>no,DEFAULT_MAX_GAS_AMOUNT:()=>Ha,DEFAULT_NETWORK:()=>Fa,DEFAULT_TXN_EXP_SEC_FROM_NOW:()=>$a,DEFAULT_TXN_TIMEOUT_SEC:()=>Wo,DeriveScheme:()=>sf,Deserializer:()=>oc,Ed25519PrivateKey:()=>Ln,Ed25519PublicKey:()=>Fe,Ed25519Signature:()=>rt,EntryFunction:()=>ao,EntryFunctionBytes:()=>Xo,FeePayerRawTransaction:()=>Pn,FixedBytes:()=>nr,HARDENED_OFFSET:()=>ac,Hex:()=>Pe,HexInvalidReason:()=>gf,Identifier:()=>Xe,KeyType:()=>Pf,MimeType:()=>Vs,ModuleId:()=>Bo,MoveAbility:()=>qa,MoveFunctionVisibility:()=>rf,MoveOption:()=>Gn,MoveString:()=>Me,MoveVector:()=>De,MultiAgentRawTransaction:()=>Un,MultiEd25519PublicKey:()=>dn,MultiEd25519Signature:()=>qr,MultiKey:()=>Yr,MultiSig:()=>No,MultiSigTransactionPayload:()=>ko,Network:()=>Vo,NetworkToChainId:()=>Zs,NetworkToFaucetAPI:()=>Ys,NetworkToIndexerAPI:()=>Ws,NetworkToNetworkName:()=>pg,NetworkToNodeAPI:()=>Qs,ParsingError:()=>vt,PrivateKey:()=>Gr,ProcessorType:()=>Pr,PublicKey:()=>Gt,RAW_TRANSACTION_SALT:()=>Va,RAW_TRANSACTION_WITH_DATA_SALT:()=>Xs,RawTransaction:()=>nn,RawTransactionWithData:()=>xs,RoleType:()=>of,RotationProofChallenge:()=>ys,Script:()=>Oo,ScriptTransactionArgumentVariants:()=>po,Secp256k1PrivateKey:()=>Vn,Secp256k1PublicKey:()=>en,Secp256k1Signature:()=>jn,Serializable:()=>ae,Serializer:()=>cn,Signature:()=>fn,SignedTransaction:()=>An,SigningScheme:()=>go,SigningSchemeInput:()=>Ka,StructTag:()=>Bn,TransactionAuthenticator:()=>In,TransactionAuthenticatorEd25519:()=>Xr,TransactionAuthenticatorFeePayer:()=>eo,TransactionAuthenticatorMultiAgent:()=>Jr,TransactionAuthenticatorMultiEd25519:()=>ta,TransactionAuthenticatorSingleSender:()=>to,TransactionAuthenticatorVariant:()=>za,TransactionPayload:()=>Er,TransactionPayloadEntryFunction:()=>Po,TransactionPayloadMultiSig:()=>Ro,TransactionPayloadScript:()=>Uo,TransactionPayloadVariants:()=>ka,TransactionResponseType:()=>js,TransactionVariants:()=>Da,TransactionWorker:()=>Ms,TransactionWorkerEventsEnum:()=>$u,TypeTag:()=>it,TypeTagAddress:()=>kt,TypeTagBool:()=>At,TypeTagGeneric:()=>at,TypeTagParserError:()=>je,TypeTagParserErrorType:()=>jl,TypeTagReference:()=>As,TypeTagSigner:()=>_r,TypeTagStruct:()=>ue,TypeTagU128:()=>so,TypeTagU16:()=>ro,TypeTagU256:()=>io,TypeTagU32:()=>oo,TypeTagU64:()=>Ut,TypeTagU8:()=>hn,TypeTagVariants:()=>Na,TypeTagVector:()=>Ve,U128:()=>Wt,U16:()=>Vt,U256:()=>Qt,U32:()=>jt,U64:()=>mt,U8:()=>ht,aptosCoinStructTag:()=>Ch,aptosRequest:()=>$o,buildTransaction:()=>la,checkOrConvertArgument:()=>uo,convertArgument:()=>Bu,deriveKey:()=>di,deriveTransactionType:()=>Ou,deserializeFromScriptArgument:()=>Hl,ensureBoolean:()=>oi,fetchEntryFunctionAbi:()=>Iu,findFirstNonSignerArg:()=>Su,generateMultiSignersSignedTransaction:()=>Yl,generateRawTransaction:()=>Ql,generateSignedTransaction:()=>Ru,generateSignedTransactionForSimulation:()=>Uu,generateSigningMessage:()=>pa,generateTransactionPayload:()=>Es,generateTransactionPayloadWithABI:()=>Ss,get:()=>ja,getAptosFullNode:()=>Mt,getAuthenticatorForSimulation:()=>_s,getFunctionParts:()=>da,isBcsAddress:()=>Ts,isBcsBool:()=>ra,isBcsFixedBytes:()=>Wl,isBcsString:()=>oa,isBcsU128:()=>ua,isBcsU16:()=>ia,isBcsU256:()=>fa,isBcsU32:()=>aa,isBcsU64:()=>ca,isBcsU8:()=>sa,isBlockMetadataTransactionResponse:()=>ig,isBool:()=>wu,isEd25519Signature:()=>cg,isEncodedEntryFunctionArgument:()=>_u,isFeePayerSignature:()=>dg,isGenesisTransactionResponse:()=>sg,isLargeNumber:()=>ws,isMultiAgentSignature:()=>fg,isMultiEd25519Signature:()=>lg,isNull:()=>Tu,isNumber:()=>bs,isPendingTransactionResponse:()=>rg,isScriptDataInput:()=>Eu,isSecp256k1Signature:()=>ug,isStateCheckpointTransactionResponse:()=>ag,isString:()=>co,isUserTransactionResponse:()=>og,isValidBIP44Path:()=>cc,isValidHardenedPath:()=>uc,mnemonicToSeed:()=>es,objectStructTag:()=>Dt,optionStructTag:()=>Ih,outOfRangeErrorMessage:()=>mf,paginateWithCursor:()=>Rr,parseTypeTag:()=>Sr,post:()=>Js,postAptosFaucet:()=>Qa,postAptosFullNode:()=>Or,postAptosIndexer:()=>Wa,promiseFulfilledStatus:()=>Hu,request:()=>cf,sign:()=>Pu,splitPath:()=>dc,standardizeTypeTags:()=>Cu,stringStructTag:()=>He,throwTypeMismatch:()=>Qe,validateNumberInRange:()=>Dn});var bn=class extends Error{constructor(e,r,o){super(o);this.name="AptosApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.data=r.data,this.request=e}};var nf="1.6.0";var Vs=(r=>(r.JSON="application/json",r.BCS="application/x-bcs",r.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",r))(Vs||{}),Na=(S=>(S[S.Bool=0]="Bool",S[S.U8=1]="U8",S[S.U64=2]="U64",S[S.U128=3]="U128",S[S.Address=4]="Address",S[S.Signer=5]="Signer",S[S.Vector=6]="Vector",S[S.Struct=7]="Struct",S[S.U16=8]="U16",S[S.U32=9]="U32",S[S.U256=10]="U256",S[S.Reference=254]="Reference",S[S.Generic=255]="Generic",S))(Na||{}),po=(d=>(d[d.U8=0]="U8",d[d.U64=1]="U64",d[d.U128=2]="U128",d[d.Address=3]="Address",d[d.U8Vector=4]="U8Vector",d[d.Bool=5]="Bool",d[d.U16=6]="U16",d[d.U32=7]="U32",d[d.U256=8]="U256",d))(po||{}),ka=(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(ka||{}),Da=(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(Da||{}),za=(s=>(s[s.Ed25519=0]="Ed25519",s[s.MultiEd25519=1]="MultiEd25519",s[s.MultiAgent=2]="MultiAgent",s[s.FeePayer=3]="FeePayer",s[s.SingleSender=4]="SingleSender",s))(za||{}),Ma=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(Ma||{}),Ga=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(Ga||{}),La=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(La||{}),js=(s=>(s.Pending="pending_transaction",s.User="user_transaction",s.Genesis="genesis_transaction",s.BlockMetadata="block_metadata_transaction",s.StateCheckpoint="state_checkpoint_transaction",s))(js||{});function rg(n){return n.type==="pending_transaction"}function og(n){return n.type==="user_transaction"}function sg(n){return n.type==="genesis_transaction"}function ig(n){return n.type==="block_metadata_transaction"}function ag(n){return n.type==="state_checkpoint_transaction"}function cg(n){return"signature"in n&&n.signature==="ed25519_signature"}function ug(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function fg(n){return n.type==="multi_agent_signature"}function dg(n){return n.type==="fee_payer_signature"}function lg(n){return n.type==="multi_ed25519_signature"}var rf=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(rf||{}),qa=(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(qa||{}),of=(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(of||{}),go=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(go||{}),Ka=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(Ka||{}),sf=(s=>(s[s.DeriveAuid=251]="DeriveAuid",s[s.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",s[s.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",s[s.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",s[s.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",s))(sf||{});var af={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function cf(n,t){let{url:e,method:r,body:o,contentType:s,params:i,overrides:c}=n,u={...c?.HEADERS,"x-aptos-client":`aptos-typescript-sdk/${nf}`,"content-type":s??"application/json"};return c?.AUTH_TOKEN&&e.includes("faucet")&&(u.Authorization=`Bearer ${c?.AUTH_TOKEN}`),c?.API_KEY&&!e.includes("faucet")&&(u.Authorization=`Bearer ${c?.API_KEY}`),t.provider({url:e,method:r,body:o,params:i,headers:u,overrides:c})}async function $o(n,t){let{url:e,path:r}=n,o=r?`${e}/${r}`:e,s=await cf({...n,url:o},t.client),i={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(t.isIndexerRequest(e)){let u=i.data;if(u.errors)throw new bn(n,i,`Indexer error: ${u.errors[0].message}`??`Indexer unhandled Error ${s.status} : ${s.statusText}`);i.data=u.data}if(i.status>=200&&i.status<300)return i;let c;throw i&&i.data&&"message"in i.data&&"error_code"in i.data?c=JSON.stringify(i.data):i.status in af?c=af[i.status]:c=`Unhandled Error ${i.status} : ${i.statusText}`,new bn(n,i,`${t.isFullnodeRequest(e)?"Fullnode":"Faucet"} error: ${c}`)}var Ws={mainnet:"https://indexer.mainnet.aptoslabs.com/v1/graphql",testnet:"https://indexer-testnet.staging.gcp.aptosdev.com/v1/graphql",devnet:"https://indexer-devnet.staging.gcp.aptosdev.com/v1/graphql",randomnet:"https://indexer-randomnet.hasura.app/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},Qs={mainnet:"https://fullnode.mainnet.aptoslabs.com/v1",testnet:"https://fullnode.testnet.aptoslabs.com/v1",devnet:"https://fullnode.devnet.aptoslabs.com/v1",randomnet:"https://fullnode.random.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},Ys={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",randomnet:"https://faucet.random.aptoslabs.com",local:"http://127.0.0.1:8081"},Vo=(i=>(i.MAINNET="mainnet",i.TESTNET="testnet",i.DEVNET="devnet",i.RANDOMNET="randomnet",i.LOCAL="local",i.CUSTOM="custom",i))(Vo||{}),Zs={mainnet:1,testnet:2,randomnet:70},pg={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",randomnet:"randomnet",local:"local",custom:"custom"};var jo=(r=>(r[r.FULLNODE=0]="FULLNODE",r[r.INDEXER=1]="INDEXER",r[r.FAUCET=2]="FAUCET",r))(jo||{}),Fa="devnet",Ha=2e5,$a=20,Wo=20,Qo="0x1::aptos_coin::AptosCoin",Va="APTOS::RawTransaction",Xs="APTOS::RawTransactionWithData",Pr=(c=>(c.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",c.DEFAULT="default_processor",c.EVENTS_PROCESSOR="events_processor",c.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",c.STAKE_PROCESSOR="stake_processor",c.TOKEN_V2_PROCESSOR="token_v2_processor",c.USER_TRANSACTION_PROCESSOR="user_transaction_processor",c))(Pr||{});async function ja(n){let{aptosConfig:t,overrides:e,params:r,contentType:o,acceptType:s,path:i,originMethod:c,type:u}=n,d=t.getRequestUrl(u);return $o({url:d,method:"GET",originMethod:c,path:i,contentType:o?.valueOf(),acceptType:s?.valueOf(),params:r,overrides:{...t.clientConfig,...e}},t)}async function Mt(n){return ja({...n,type:0})}async function Rr(n){let t=[],e,r=n.params;do{let o=await ja({type:0,aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});e=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),r.start=e}while(e!=null);return t}async function Js(n){let{type:t,originMethod:e,path:r,body:o,acceptType:s,contentType:i,params:c,aptosConfig:u,overrides:d}=n,y=u.getRequestUrl(t);return $o({url:y,method:"POST",originMethod:e,path:r,body:o,contentType:i?.valueOf(),acceptType:s?.valueOf(),params:c,overrides:{...u.clientConfig,...d}},u)}async function Or(n){return Js({...n,type:0})}async function Wa(n){return Js({...n,type:1})}async function Qa(n){return Js({...n,type:2})}var ei=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var ff=n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4));function Ya(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}var wn=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),sn=(n,t)=>n<<32-t|n>>>t,gg=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!gg)throw new Error("Non little-endian hardware is not supported");var mg=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function Nr(n){if(!Ya(n))throw new Error("Uint8Array expected");let t="";for(let e=0;e<n.length;e++)t+=mg[n[e]];return t}var Nn={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function uf(n){if(n>=Nn._0&&n<=Nn._9)return n-Nn._0;if(n>=Nn._A&&n<=Nn._F)return n-(Nn._A-10);if(n>=Nn._a&&n<=Nn._f)return n-(Nn._a-10)}function mo(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);let t=n.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(e);for(let o=0,s=0;o<e;o++,s+=2){let i=uf(n.charCodeAt(s)),c=uf(n.charCodeAt(s+1));if(i===void 0||c===void 0){let u=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+s)}r[o]=i*16+c}return r}function Za(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function an(n){if(typeof n=="string"&&(n=Za(n)),!Ya(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}function kr(...n){let t=0;for(let r=0;r<n.length;r++){let o=n[r];if(!Ya(o))throw new Error("Uint8Array expected");t+=o.length}let e=new Uint8Array(t);for(let r=0,o=0;r<n.length;r++){let s=n[r];e.set(s,o),o+=s.length}return e}var Jn=class{clone(){return this._cloneInto()}},yg={}.toString;function df(n,t){if(t!==void 0&&yg.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(n,t)}function er(n){let t=r=>n().update(an(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function lf(n){let t=(r,o)=>n(o).update(an(r)).digest(),e=n({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>n(r),t}function pf(n=32){if(ei&&typeof ei.getRandomValues=="function")return ei.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}var ti=255,ni=65535,kn=4294967295,Dr=18446744073709551615n,Yo=340282366920938463463374607431768211455n,ri=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var vt=class extends Error{constructor(e,r){super(e);this.invalidReason=r}};var gf=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(gf||{}),Pe=class n{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return Nr(this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromString(t){let e=t;if(e.startsWith("0x")&&(e=e.slice(2)),e.length===0)throw new vt("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(e.length%2!==0)throw new vt("Hex string must be an even number of hex characters.","invalid_length");try{return new n(mo(e))}catch(r){throw new vt(`Hex string contains invalid hex characters: ${r?.message}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new n(t):n.fromString(t)}static isValid(t){try{return n.fromString(t),{valid:!0}}catch(e){return{valid:!1,invalidReason:e?.invalidReason,invalidReasonMessage:e?.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,r)=>e===t.data[r])}};var ae=class{bcsToBytes(){let t=new cn;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return Pe.fromHexInput(t)}},cn=class{constructor(t=64){if(t<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(t),this.offset=0}ensureBufferWillHandleSize(t){for(;this.buffer.byteLength<this.offset+t;){let e=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e}}appendToBuffer(t){this.ensureBufferWillHandleSize(t.length),new Uint8Array(this.buffer,this.offset).set(t),this.offset+=t.length}serializeWithFunction(t,e,r){this.ensureBufferWillHandleSize(e);let o=new DataView(this.buffer,this.offset);t.apply(o,[0,r,!0]),this.offset+=e}serializeStr(t){let e=new TextEncoder;this.serializeBytes(e.encode(t))}serializeBytes(t){this.serializeU32AsUleb128(t.length),this.appendToBuffer(t)}serializeFixedBytes(t){this.appendToBuffer(t)}serializeBool(t){oi(t);let e=t?1:0;this.appendToBuffer(new Uint8Array([e]))}serializeU8(t){this.appendToBuffer(new Uint8Array([t]))}serializeU16(t){this.serializeWithFunction(DataView.prototype.setUint16,2,t)}serializeU32(t){this.serializeWithFunction(DataView.prototype.setUint32,4,t)}serializeU64(t){let e=BigInt(t)&BigInt(kn),r=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(r))}serializeU128(t){let e=BigInt(t)&Dr,r=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(r)}serializeU256(t){let e=BigInt(t)&Yo,r=BigInt(t)>>BigInt(128);this.serializeU128(e),this.serializeU128(r)}serializeU32AsUleb128(t){let e=t,r=[];for(;e>>>7;)r.push(e&127|128),e>>>=7;r.push(e),this.appendToBuffer(new Uint8Array(r))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(t){t.serialize(this)}serializeVector(t){this.serializeU32AsUleb128(t.length),t.forEach(e=>{e.serialize(this)})}};Ot([zr(0,ti)],cn.prototype,"serializeU8",1),Ot([zr(0,ni)],cn.prototype,"serializeU16",1),Ot([zr(0,kn)],cn.prototype,"serializeU32",1),Ot([zr(BigInt(0),Dr)],cn.prototype,"serializeU64",1),Ot([zr(BigInt(0),Yo)],cn.prototype,"serializeU128",1),Ot([zr(BigInt(0),ri)],cn.prototype,"serializeU256",1),Ot([zr(0,kn)],cn.prototype,"serializeU32AsUleb128",1);function oi(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var mf=(n,t,e)=>`${n} is out of range: [${t}, ${e}]`;function Dn(n,t,e){let r=BigInt(n);if(r>BigInt(e)||r<BigInt(t))throw new Error(mf(n,t,e))}function zr(n,t){return(e,r,o)=>{let s=o.value;return o.value=function(c){return Dn(c,n,t),s.apply(this,[c])},o}}var yf=(c=>(c.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",c.INVALID_HEX_CHARS="invalid_hex_chars",c.TOO_SHORT="too_short",c.TOO_LONG="too_long",c.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",c.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",c.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",c))(yf||{}),Ke=class Ke extends ae{constructor(e){super();if(e.length!==Ke.LENGTH)throw new vt("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=e}isSpecial(){return this.data.slice(0,this.data.length-1).every(e=>e===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let e=Nr(this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return Nr(this.data)}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let r=e.deserializeFixedBytes(Ke.LENGTH);return new Ke(r)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new vt("Hex string must start with a leading 0x.","leading_zero_x_required");let r=Ke.fromString(e);if(e.length!==Ke.LONG_STRING_LENGTH+2)if(r.isSpecial()){if(e.length!==3)throw new vt(`The given hex string ${e} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new vt(`The given hex string ${e} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return r}static fromString(e){let r=e;if(e.startsWith("0x")&&(r=e.slice(2)),r.length===0)throw new vt("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(r.length>64)throw new vt("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let o;try{o=mo(r.padStart(64,"0"))}catch(s){throw new vt(`Hex characters are invalid: ${s?.message}`,"invalid_hex_chars")}return new Ke(o)}static from(e){return e instanceof Ke?e:e instanceof Uint8Array?new Ke(e):Ke.fromString(e)}static fromStrict(e){return e instanceof Ke?e:e instanceof Uint8Array?new Ke(e):Ke.fromStringStrict(e)}static isValid(e){try{return e.strict?Ke.fromStrict(e.input):Ke.from(e.input),{valid:!0}}catch(r){return{valid:!1,invalidReason:r?.invalidReason,invalidReasonMessage:r?.message}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((r,o)=>r===e.data[o])}};Ke.LENGTH=32,Ke.LONG_STRING_LENGTH=64,Ke.ZERO=Ke.from("0x0"),Ke.ONE=Ke.from("0x1"),Ke.TWO=Ke.from("0x2"),Ke.THREE=Ke.from("0x3"),Ke.FOUR=Ke.from("0x4");var M=Ke;function zn(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function hg(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}function un(n,...t){if(!hg(n))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(n.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${n.length}`)}function si(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");zn(n.outputLen),zn(n.blockLen)}function Mn(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function ii(n,t){un(n);let e=t.outputLen;if(n.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var ai=BigInt(4294967295),Xa=BigInt(32);function hf(n,t=!1){return t?{h:Number(n&ai),l:Number(n>>Xa&ai)}:{h:Number(n>>Xa&ai)|0,l:Number(n&ai)|0}}function Ja(n,t=!1){let e=new Uint32Array(n.length),r=new Uint32Array(n.length);for(let o=0;o<n.length;o++){let{h:s,l:i}=hf(n[o],t);[e[o],r[o]]=[s,i]}return[e,r]}var Ag=(n,t)=>BigInt(n>>>0)<<Xa|BigInt(t>>>0),xg=(n,t,e)=>n>>>e,bg=(n,t,e)=>n<<32-e|t>>>e,wg=(n,t,e)=>n>>>e|t<<32-e,Tg=(n,t,e)=>n<<32-e|t>>>e,_g=(n,t,e)=>n<<64-e|t>>>e-32,Eg=(n,t,e)=>n>>>e-32|t<<64-e,Sg=(n,t)=>t,vg=(n,t)=>n,ec=(n,t,e)=>n<<e|t>>>32-e,tc=(n,t,e)=>t<<e|n>>>32-e,nc=(n,t,e)=>t<<e-32|n>>>64-e,rc=(n,t,e)=>n<<e-32|t>>>64-e;function Cg(n,t,e,r){let o=(t>>>0)+(r>>>0);return{h:n+e+(o/2**32|0)|0,l:o|0}}var Ig=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),Bg=(n,t,e,r)=>t+e+r+(n/2**32|0)|0,Ug=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),Pg=(n,t,e,r,o)=>t+e+r+o+(n/2**32|0)|0,Rg=(n,t,e,r,o)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(o>>>0),Og=(n,t,e,r,o,s)=>t+e+r+o+s+(n/2**32|0)|0;var Ng={fromBig:hf,split:Ja,toBig:Ag,shrSH:xg,shrSL:bg,rotrSH:wg,rotrSL:Tg,rotrBH:_g,rotrBL:Eg,rotr32H:Sg,rotr32L:vg,rotlSH:ec,rotlSL:tc,rotlBH:nc,rotlBL:rc,add:Cg,add3L:Ig,add3H:Bg,add4L:Ug,add4H:Pg,add5H:Og,add5L:Rg},xe=Ng;var[bf,wf,Tf]=[[],[],[]],kg=BigInt(0),Zo=BigInt(1),Dg=BigInt(2),zg=BigInt(7),Mg=BigInt(256),Gg=BigInt(113);for(let n=0,t=Zo,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],bf.push(2*(5*r+e)),wf.push((n+1)*(n+2)/2%64);let o=kg;for(let s=0;s<7;s++)t=(t<<Zo^(t>>zg)*Gg)%Mg,t&Dg&&(o^=Zo<<(Zo<<BigInt(s))-Zo);Tf.push(o)}var[Lg,qg]=Ja(Tf,!0),Af=(n,t,e)=>e>32?nc(n,t,e):ec(n,t,e),xf=(n,t,e)=>e>32?rc(n,t,e):tc(n,t,e);function Kg(n,t=24){let e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)e[i]=n[i]^n[i+10]^n[i+20]^n[i+30]^n[i+40];for(let i=0;i<10;i+=2){let c=(i+8)%10,u=(i+2)%10,d=e[u],y=e[u+1],g=Af(d,y,1)^e[c],T=xf(d,y,1)^e[c+1];for(let S=0;S<50;S+=10)n[i+S]^=g,n[i+S+1]^=T}let o=n[2],s=n[3];for(let i=0;i<24;i++){let c=wf[i],u=Af(o,s,c),d=xf(o,s,c),y=bf[i];o=n[y],s=n[y+1],n[y]=u,n[y+1]=d}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)e[c]=n[i+c];for(let c=0;c<10;c++)n[i+c]^=~e[(c+2)%10]&e[(c+4)%10]}n[0]^=Lg[r],n[1]^=qg[r]}e.fill(0)}var ci=class n extends Jn{constructor(t,e,r,o=!1,s=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=o,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,zn(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ff(this.state)}keccak(){Kg(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){Mn(this);let{blockLen:e,state:r}=this;t=an(t);let o=t.length;for(let s=0;s<o;){let i=Math.min(e-this.pos,o-s);for(let c=0;c<i;c++)r[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:e,pos:r,blockLen:o}=this;t[r]^=e,e&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){Mn(this,!1),un(t),this.finish();let e=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();let i=Math.min(r-this.posOut,s-o);t.set(e.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return zn(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ii(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:e,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new n(e,r,o,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}},tr=(n,t,e)=>er(()=>new ci(t,n,e)),dA=tr(6,144,224/8),Mr=tr(6,136,256/8),lA=tr(6,104,384/8),pA=tr(6,72,512/8),gA=tr(1,144,224/8),mA=tr(1,136,256/8),yA=tr(1,104,384/8),hA=tr(1,72,512/8),_f=(n,t,e)=>lf((r={})=>new ci(t,n,r.dkLen===void 0?e:r.dkLen,!0)),AA=_f(31,168,128/8),xA=_f(31,136,256/8);var ts=tf(Sf());var oc=class{constructor(t){this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t,0),this.offset=0}read(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}deserializeStr(){let t=this.deserializeBytes();return new TextDecoder().decode(t)}deserializeBytes(){let t=this.deserializeUleb128AsU32();return new Uint8Array(this.read(t))}deserializeFixedBytes(t){return new Uint8Array(this.read(t))}deserializeBool(){let t=new Uint8Array(this.read(1))[0];if(t!==1&&t!==0)throw new Error("Invalid boolean value");return t===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let t=this.deserializeU32(),e=this.deserializeU32();return BigInt(BigInt(e)<<BigInt(32)|BigInt(t))}deserializeU128(){let t=this.deserializeU64(),e=this.deserializeU64();return BigInt(e<<BigInt(64)|t)}deserializeU256(){let t=this.deserializeU128(),e=this.deserializeU128();return BigInt(e<<BigInt(128)|t)}deserializeUleb128AsU32(){let t=BigInt(0),e=0;for(;t<kn;){let r=this.deserializeU8();if(t|=BigInt(r&127)<<BigInt(e),!(r&128))break;e+=7}if(t>kn)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(t)}deserialize(t){return t.deserialize(this)}deserializeVector(t){let e=this.deserializeUleb128AsU32(),r=new Array;for(let o=0;o<e;o+=1)r.push(this.deserialize(t));return r}};var nr=class n extends ae{constructor(e){super();this.value=Pe.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,r){let o=e.deserializeFixedBytes(r);return new n(o)}};var Xo=class n extends ae{constructor(e){super();this.value=new nr(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,r){let o=nr.deserialize(e,r);return new n(o.value)}};var nt=class n extends ae{constructor(e){super();oi(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new n(e.deserializeBool())}},ht=class n extends ae{constructor(e){super();Dn(e,0,ti),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new n(e.deserializeU8())}},Vt=class n extends ae{constructor(e){super();Dn(e,0,ni),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new n(e.deserializeU16())}},jt=class n extends ae{constructor(e){super();Dn(e,0,kn),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new n(e.deserializeU32())}},mt=class n extends ae{constructor(e){super();Dn(e,BigInt(0),Dr),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new n(e.deserializeU64())}},Wt=class n extends ae{constructor(e){super();Dn(e,BigInt(0),Yo),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new n(e.deserializeU128())}},Qt=class n extends ae{constructor(e){super();Dn(e,BigInt(0),ri),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new n(e.deserializeU256())}};var De=class n extends ae{constructor(e){super();this.values=e}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){if(!(this.values[0]instanceof ht)&&this.values[0]!==void 0)throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let r;if(Array.isArray(e)&&typeof e[0]=="number")r=e;else if(typeof e=="string"){let o=Pe.fromHexInput(e);r=Array.from(o.toUint8Array())}else if(e instanceof Uint8Array)r=Array.from(e);else throw new Error("Invalid input type");return new n(r.map(o=>new ht(o)))}static U16(e){return new n(e.map(r=>new Vt(r)))}static U32(e){return new n(e.map(r=>new jt(r)))}static U64(e){return new n(e.map(r=>new mt(r)))}static U128(e){return new n(e.map(r=>new Wt(r)))}static U256(e){return new n(e.map(r=>new Qt(r)))}static Bool(e){return new n(e.map(r=>new nt(r)))}static MoveString(e){return new n(e.map(r=>new Me(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let o=e.deserializeUleb128AsU32(),s=new Array;for(let i=0;i<o;i+=1)s.push(r.deserialize(e));return new n(s)}},Me=class n extends ae{constructor(e){super();this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){let r=this.bcsToBytes().slice(1);De.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},Gn=class n extends ae{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new De([e]):this.vec=new De([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new ht(e):void 0)}static U16(e){return new n(e!=null?new Vt(e):void 0)}static U32(e){return new n(e!=null?new jt(e):void 0)}static U64(e){return new n(e!=null?new mt(e):void 0)}static U128(e){return new n(e!=null?new Wt(e):void 0)}static U256(e){return new n(e!=null?new Qt(e):void 0)}static Bool(e){return new n(e!=null?new nt(e):void 0)}static MoveString(e){return new n(e!=null?new Me(e):void 0)}static deserialize(e,r){let o=De.deserialize(e,r);return new n(o.values[0])}};var Gt=class extends ae{},Gr=class extends ae{},fn=class extends ae{};var fi=class extends Jn{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,si(t);let r=an(e);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;let o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),s.fill(0)}update(t){return Mn(this),this.iHash.update(t),this}digestInto(t){Mn(this),un(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:e,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Tn=(n,t,e)=>new fi(n,t).update(e).digest();Tn.create=(n,t)=>new fi(n,t);function Fg(n,t,e,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(t,e,r);let o=BigInt(32),s=BigInt(4294967295),i=Number(e>>o&s),c=Number(e&s),u=r?4:0,d=r?0:4;n.setUint32(t+u,i,r),n.setUint32(t+d,c,r)}var rr=class extends Jn{constructor(t,e,r,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=wn(this.buffer)}update(t){Mn(this);let{view:e,buffer:r,blockLen:o}=this;t=an(t);let s=t.length;for(let i=0;i<s;){let c=Math.min(o-this.pos,s-i);if(c===o){let u=wn(t);for(;o<=s-i;i+=o)this.process(u,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Mn(this),ii(t,this),this.finished=!0;let{buffer:e,view:r,blockLen:o,isLE:s}=this,{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(r,0),i=0);for(let g=i;g<o;g++)e[g]=0;Fg(r,o-8,BigInt(this.length*8),s),this.process(r,0);let c=wn(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let d=u/4,y=this.get();if(d>y.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g<d;g++)c.setUint32(4*g,y[g],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.length=o,t.pos=c,t.finished=s,t.destroyed=i,o%e&&t.buffer.set(r),t}};var[Hg,$g]=xe.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),or=new Uint32Array(80),sr=new Uint32Array(80),sc=class extends rr{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:r,Bl:o,Ch:s,Cl:i,Dh:c,Dl:u,Eh:d,El:y,Fh:g,Fl:T,Gh:S,Gl:b,Hh:h,Hl:w}=this;return[t,e,r,o,s,i,c,u,d,y,g,T,S,b,h,w]}set(t,e,r,o,s,i,c,u,d,y,g,T,S,b,h,w){this.Ah=t|0,this.Al=e|0,this.Bh=r|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=c|0,this.Dl=u|0,this.Eh=d|0,this.El=y|0,this.Fh=g|0,this.Fl=T|0,this.Gh=S|0,this.Gl=b|0,this.Hh=h|0,this.Hl=w|0}process(t,e){for(let P=0;P<16;P++,e+=4)or[P]=t.getUint32(e),sr[P]=t.getUint32(e+=4);for(let P=16;P<80;P++){let $=or[P-15]|0,G=sr[P-15]|0,D=xe.rotrSH($,G,1)^xe.rotrSH($,G,8)^xe.shrSH($,G,7),q=xe.rotrSL($,G,1)^xe.rotrSL($,G,8)^xe.shrSL($,G,7),F=or[P-2]|0,Te=sr[P-2]|0,te=xe.rotrSH(F,Te,19)^xe.rotrBH(F,Te,61)^xe.shrSH(F,Te,6),Q=xe.rotrSL(F,Te,19)^xe.rotrBL(F,Te,61)^xe.shrSL(F,Te,6),Ce=xe.add4L(q,Q,sr[P-7],sr[P-16]),Ie=xe.add4H(Ce,D,te,or[P-7],or[P-16]);or[P]=Ie|0,sr[P]=Ce|0}let{Ah:r,Al:o,Bh:s,Bl:i,Ch:c,Cl:u,Dh:d,Dl:y,Eh:g,El:T,Fh:S,Fl:b,Gh:h,Gl:w,Hh:v,Hl:k}=this;for(let P=0;P<80;P++){let $=xe.rotrSH(g,T,14)^xe.rotrSH(g,T,18)^xe.rotrBH(g,T,41),G=xe.rotrSL(g,T,14)^xe.rotrSL(g,T,18)^xe.rotrBL(g,T,41),D=g&S^~g&h,q=T&b^~T&w,F=xe.add5L(k,G,q,$g[P],sr[P]),Te=xe.add5H(F,v,$,D,Hg[P],or[P]),te=F|0,Q=xe.rotrSH(r,o,28)^xe.rotrBH(r,o,34)^xe.rotrBH(r,o,39),Ce=xe.rotrSL(r,o,28)^xe.rotrBL(r,o,34)^xe.rotrBL(r,o,39),Ie=r&s^r&c^s&c,Ye=o&i^o&u^i&u;v=h|0,k=w|0,h=S|0,w=b|0,S=g|0,b=T|0,{h:g,l:T}=xe.add(d|0,y|0,Te|0,te|0),d=c|0,y=u|0,c=s|0,u=i|0,s=r|0,i=o|0;let _=xe.add3L(te,Ce,Ye);r=xe.add3H(_,Te,Q,Ie),o=_|0}({h:r,l:o}=xe.add(this.Ah|0,this.Al|0,r|0,o|0)),{h:s,l:i}=xe.add(this.Bh|0,this.Bl|0,s|0,i|0),{h:c,l:u}=xe.add(this.Ch|0,this.Cl|0,c|0,u|0),{h:d,l:y}=xe.add(this.Dh|0,this.Dl|0,d|0,y|0),{h:g,l:T}=xe.add(this.Eh|0,this.El|0,g|0,T|0),{h:S,l:b}=xe.add(this.Fh|0,this.Fl|0,S|0,b|0),{h,l:w}=xe.add(this.Gh|0,this.Gl|0,h|0,w|0),{h:v,l:k}=xe.add(this.Hh|0,this.Hl|0,v|0,k|0),this.set(r,o,s,i,c,u,d,y,g,T,S,b,h,w,v,k)}roundClean(){or.fill(0),sr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var Lr=er(()=>new sc);function Vg(n,t,e,r){si(n);let o=df({dkLen:32,asyncTick:10},r),{c:s,dkLen:i,asyncTick:c}=o;if(zn(s),zn(i),zn(c),s<1)throw new Error("PBKDF2: iterations (c) should be >= 1");let u=an(t),d=an(e),y=new Uint8Array(i),g=Tn.create(n,u),T=g._cloneInto().update(d);return{c:s,dkLen:i,asyncTick:c,DK:y,PRF:g,PRFSalt:T}}function jg(n,t,e,r,o){return n.destroy(),t.destroy(),r&&r.destroy(),o.fill(0),e}function vf(n,t,e,r){let{c:o,dkLen:s,DK:i,PRF:c,PRFSalt:u}=Vg(n,t,e,r),d,y=new Uint8Array(4),g=wn(y),T=new Uint8Array(c.outputLen);for(let S=1,b=0;b<s;S++,b+=c.outputLen){let h=i.subarray(b,b+c.outputLen);g.setInt32(0,S,!1),(d=u._cloneInto(d)).update(y).digestInto(T),h.set(T.subarray(0,h.length));for(let w=1;w<o;w++){c._cloneInto(d).update(T).digestInto(T);for(let v=0;v<h.length;v++)h[v]^=T[v]}}return jg(c,u,i,d,T)}var Wg=(n,t,e)=>n&t^~n&e,Qg=(n,t,e)=>n&t^n&e^t&e,Yg=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ir=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ar=new Uint32Array(64),ic=class extends rr{constructor(){super(64,32,8,!1),this.A=ir[0]|0,this.B=ir[1]|0,this.C=ir[2]|0,this.D=ir[3]|0,this.E=ir[4]|0,this.F=ir[5]|0,this.G=ir[6]|0,this.H=ir[7]|0}get(){let{A:t,B:e,C:r,D:o,E:s,F:i,G:c,H:u}=this;return[t,e,r,o,s,i,c,u]}set(t,e,r,o,s,i,c,u){this.A=t|0,this.B=e|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=u|0}process(t,e){for(let g=0;g<16;g++,e+=4)ar[g]=t.getUint32(e,!1);for(let g=16;g<64;g++){let T=ar[g-15],S=ar[g-2],b=sn(T,7)^sn(T,18)^T>>>3,h=sn(S,17)^sn(S,19)^S>>>10;ar[g]=h+ar[g-7]+b+ar[g-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:u,G:d,H:y}=this;for(let g=0;g<64;g++){let T=sn(c,6)^sn(c,11)^sn(c,25),S=y+T+Wg(c,u,d)+Yg[g]+ar[g]|0,h=(sn(r,2)^sn(r,13)^sn(r,22))+Qg(r,o,s)|0;y=d,d=u,u=c,c=i+S|0,i=s,s=o,o=r,r=S+h|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,u=u+this.F|0,d=d+this.G|0,y=y+this.H|0,this.set(r,o,s,i,c,u,d,y)}roundClean(){ar.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Jo=er(()=>new ic);function Cf(n){if(typeof n!="string")throw new TypeError(`Invalid mnemonic type: ${typeof n}`);return n.normalize("NFKD")}function Zg(n){let t=Cf(n),e=t.split(" ");if(![12,15,18,21,24].includes(e.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:e}}var Xg=n=>Cf(`mnemonic${n}`);function If(n,t=""){return vf(Lr,Zg(n).nfkd,Xg(t),{c:2048,dkLen:64})}var Bf=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Uf=/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,Pf=(t=>(t.ED25519="ed25519 seed",t))(Pf||{}),ac=2147483648;function cc(n){return Uf.test(n)}function uc(n){return Bf.test(n)}var di=(n,t)=>{let e=Tn.create(Lr,n).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},fc=({key:n,chainCode:t},e)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,e);let o=new Uint8Array(r),s=new Uint8Array([0]),i=new Uint8Array([...s,...n,...o]);return di(t,i)},em=n=>n.replace("'",""),dc=n=>n.split("/").slice(1).map(em),es=n=>{let t=n.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return If(t)};var cr=class cr extends Gt{constructor(e){super();let r=Pe.fromHexInput(e);if(r.toUint8Array().length!==cr.LENGTH)throw new Error(`PublicKey length should be ${cr.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:r,signature:o}=e,s=Pe.fromHexInput(r).toUint8Array(),i=o.toUint8Array();return ts.default.sign.detached.verify(s,i,this.key.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new cr(r)}static load(e){let r=e.deserializeBytes();return new cr(r)}static isPublicKey(e){return e instanceof cr}};cr.LENGTH=32;var Fe=cr,Ct=class Ct extends Gr{constructor(e){super();let r=Pe.fromHexInput(e);if(r.toUint8Array().length!==Ct.LENGTH)throw new Error(`PrivateKey length should be ${Ct.LENGTH}`);this.signingKeyPair=ts.default.sign.keyPair.fromSeed(r.toUint8Array().slice(0,Ct.LENGTH))}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,Ct.LENGTH)}toString(){return Pe.fromHexInput(this.toUint8Array()).toString()}sign(e){let r=Pe.fromHexInput(e),o=ts.default.sign.detached(r.toUint8Array(),this.signingKeyPair.secretKey);return new rt(o)}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Ct(r)}static generate(){let e=ts.default.sign.keyPair();return new Ct(e.secretKey.slice(0,Ct.LENGTH))}publicKey(){let e=this.signingKeyPair.publicKey;return new Fe(e)}static fromDerivationPath(e,r){if(!uc(e))throw new Error(`Invalid derivation path ${e}`);return Ct.fromDerivationPathInner(e,es(r))}static fromDerivationPathInner(e,r,o=ac){let{key:s,chainCode:i}=di(Ct.SLIP_0010_SEED,r),c=dc(e).map(d=>parseInt(d,10)),{key:u}=c.reduce((d,y)=>fc(d,y+o),{key:s,chainCode:i});return new Ct(u)}static isPrivateKey(e){return e instanceof Ct}};Ct.LENGTH=32,Ct.SLIP_0010_SEED="ed25519 seed";var Ln=Ct,ur=class ur extends fn{constructor(e){super();let r=Pe.fromHexInput(e);if(r.toUint8Array().length!==ur.LENGTH)throw new Error(`Signature length should be ${ur.LENGTH}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new ur(r)}static load(e){let r=e.deserializeBytes();return new ur(r)}static isSignature(e){return e instanceof ur}};ur.LENGTH=64;var rt=ur;var Yt=class Yt extends Gt{constructor(e){super();let{publicKeys:r,threshold:o}=e;if(r.length>Yt.MAX_KEYS||r.length<Yt.MIN_KEYS)throw new Error(`Must have between ${Yt.MIN_KEYS} and ${Yt.MAX_KEYS} public keys, inclusive`);if(o<Yt.MIN_THRESHOLD||o>r.length)throw new Error(`Threshold must be between ${Yt.MIN_THRESHOLD} and ${r.length}, inclusive`);this.publicKeys=r,this.threshold=o}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*Fe.LENGTH+1);return this.publicKeys.forEach((r,o)=>{e.set(r.toUint8Array(),o*Fe.LENGTH)}),e[this.publicKeys.length*Fe.LENGTH]=this.threshold,e}toString(){return Pe.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("TODO - Method not implemented.")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),o=r[r.length-1],s=[];for(let i=0;i<r.length-1;i+=Fe.LENGTH){let c=i;s.push(new Fe(r.subarray(c,c+Fe.LENGTH)))}return new Yt({publicKeys:s,threshold:o})}};Yt.MAX_KEYS=32,Yt.MIN_KEYS=2,Yt.MIN_THRESHOLD=1;var dn=Yt,Zt=class Zt extends fn{constructor(e){super();let{signatures:r,bitmap:o}=e;if(o.length!==Zt.BITMAP_LEN)throw new Error(`"bitmap" length should be ${Zt.BITMAP_LEN}`);if(r.length>Zt.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${Zt.MAX_SIGNATURES_SUPPORTED}`);this.signatures=r,this.bitmap=o}toUint8Array(){let e=new Uint8Array(this.signatures.length*rt.LENGTH+Zt.BITMAP_LEN);return this.signatures.forEach((r,o)=>{e.set(r.toUint8Array(),o*rt.LENGTH)}),e.set(this.bitmap,this.signatures.length*rt.LENGTH),e}toString(){return Pe.fromHexInput(this.toUint8Array()).toString()}static createBitmap(e){let{bits:r}=e,o=128,s=new Uint8Array([0,0,0,0]),i=new Set;return r.forEach(c=>{if(c>=Zt.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${Zt.MAX_SIGNATURES_SUPPORTED-1}.`);if(i.has(c))throw new Error("Duplicate bits detected.");i.add(c);let u=Math.floor(c/8),d=s[u];d|=o>>c%8,s[u]=d}),s}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),o=r.subarray(r.length-4),s=[];for(let i=0;i<r.length-o.length;i+=rt.LENGTH){let c=i;s.push(new rt(r.subarray(c,c+rt.LENGTH)))}return new Zt({signatures:s,bitmap:o})}};Zt.MAX_SIGNATURES_SUPPORTED=32,Zt.BITMAP_LEN=4;var qr=Zt;function Rf(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function lc(n,...t){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(n.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${n.length}`)}function Of(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Rf(n.outputLen),Rf(n.blockLen)}function yo(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function Nf(n,t){lc(n);let e=t.outputLen;if(n.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var li=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var kf=n=>n instanceof Uint8Array;var pi=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),ln=(n,t)=>n<<32-t|n>>>t,tm=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!tm)throw new Error("Non little-endian hardware is not supported");function nm(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function ns(n){if(typeof n=="string"&&(n=nm(n)),!kf(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}function Df(...n){let t=new Uint8Array(n.reduce((r,o)=>r+o.length,0)),e=0;return n.forEach(r=>{if(!kf(r))throw new Error("Uint8Array expected");t.set(r,e),e+=r.length}),t}var ho=class{clone(){return this._cloneInto()}},Fx={}.toString;function zf(n){let t=r=>n().update(ns(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function Mf(n=32){if(li&&typeof li.getRandomValues=="function")return li.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}function rm(n,t,e,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(t,e,r);let o=BigInt(32),s=BigInt(4294967295),i=Number(e>>o&s),c=Number(e&s),u=r?4:0,d=r?0:4;n.setUint32(t+u,i,r),n.setUint32(t+d,c,r)}var gi=class extends ho{constructor(t,e,r,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=pi(this.buffer)}update(t){yo(this);let{view:e,buffer:r,blockLen:o}=this;t=ns(t);let s=t.length;for(let i=0;i<s;){let c=Math.min(o-this.pos,s-i);if(c===o){let u=pi(t);for(;o<=s-i;i+=o)this.process(u,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){yo(this),Nf(t,this),this.finished=!0;let{buffer:e,view:r,blockLen:o,isLE:s}=this,{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(r,0),i=0);for(let g=i;g<o;g++)e[g]=0;rm(r,o-8,BigInt(this.length*8),s),this.process(r,0);let c=pi(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let d=u/4,y=this.get();if(d>y.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g<d;g++)c.setUint32(4*g,y[g],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.length=o,t.pos=c,t.finished=s,t.destroyed=i,o%e&&t.buffer.set(r),t}};var om=(n,t,e)=>n&t^~n&e,sm=(n,t,e)=>n&t^n&e^t&e,im=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),fr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),dr=new Uint32Array(64),pc=class extends gi{constructor(){super(64,32,8,!1),this.A=fr[0]|0,this.B=fr[1]|0,this.C=fr[2]|0,this.D=fr[3]|0,this.E=fr[4]|0,this.F=fr[5]|0,this.G=fr[6]|0,this.H=fr[7]|0}get(){let{A:t,B:e,C:r,D:o,E:s,F:i,G:c,H:u}=this;return[t,e,r,o,s,i,c,u]}set(t,e,r,o,s,i,c,u){this.A=t|0,this.B=e|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=u|0}process(t,e){for(let g=0;g<16;g++,e+=4)dr[g]=t.getUint32(e,!1);for(let g=16;g<64;g++){let T=dr[g-15],S=dr[g-2],b=ln(T,7)^ln(T,18)^T>>>3,h=ln(S,17)^ln(S,19)^S>>>10;dr[g]=h+dr[g-7]+b+dr[g-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:u,G:d,H:y}=this;for(let g=0;g<64;g++){let T=ln(c,6)^ln(c,11)^ln(c,25),S=y+T+om(c,u,d)+im[g]+dr[g]|0,h=(ln(r,2)^ln(r,13)^ln(r,22))+sm(r,o,s)|0;y=d,d=u,u=c,c=i+S|0,i=s,s=o,o=r,r=S+h|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,u=u+this.F|0,d=d+this.G|0,y=y+this.H|0,this.set(r,o,s,i,c,u,d,y)}roundClean(){dr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Gf=zf(()=>new pc);var hc={};$s(hc,{bitGet:()=>pm,bitLen:()=>lm,bitMask:()=>rs,bitSet:()=>gm,bytesToHex:()=>Kr,bytesToNumberBE:()=>qn,bytesToNumberLE:()=>hi,concatBytes:()=>Ao,createHmacDrbg:()=>yc,ensureBytes:()=>Lt,equalBytes:()=>fm,hexToBytes:()=>Fr,hexToNumber:()=>mc,numberToBytesBE:()=>lr,numberToBytesLE:()=>Ai,numberToHexUnpadded:()=>Kf,numberToVarBytesBE:()=>um,utf8ToBytes:()=>dm,validateObject:()=>pr});var qf=BigInt(0),mi=BigInt(1),am=BigInt(2),yi=n=>n instanceof Uint8Array,cm=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function Kr(n){if(!yi(n))throw new Error("Uint8Array expected");let t="";for(let e=0;e<n.length;e++)t+=cm[n[e]];return t}function Kf(n){let t=n.toString(16);return t.length&1?`0${t}`:t}function mc(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return BigInt(n===""?"0":`0x${n}`)}function Fr(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);let t=n.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let e=new Uint8Array(t/2);for(let r=0;r<e.length;r++){let o=r*2,s=n.slice(o,o+2),i=Number.parseInt(s,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");e[r]=i}return e}function qn(n){return mc(Kr(n))}function hi(n){if(!yi(n))throw new Error("Uint8Array expected");return mc(Kr(Uint8Array.from(n).reverse()))}function lr(n,t){return Fr(n.toString(16).padStart(t*2,"0"))}function Ai(n,t){return lr(n,t).reverse()}function um(n){return Fr(Kf(n))}function Lt(n,t,e){let r;if(typeof t=="string")try{r=Fr(t)}catch(s){throw new Error(`${n} must be valid hex string, got "${t}". Cause: ${s}`)}else if(yi(t))r=Uint8Array.from(t);else throw new Error(`${n} must be hex string or Uint8Array`);let o=r.length;if(typeof e=="number"&&o!==e)throw new Error(`${n} expected ${e} bytes, got ${o}`);return r}function Ao(...n){let t=new Uint8Array(n.reduce((r,o)=>r+o.length,0)),e=0;return n.forEach(r=>{if(!yi(r))throw new Error("Uint8Array expected");t.set(r,e),e+=r.length}),t}function fm(n,t){if(n.length!==t.length)return!1;for(let e=0;e<n.length;e++)if(n[e]!==t[e])return!1;return!0}function dm(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function lm(n){let t;for(t=0;n>qf;n>>=mi,t+=1);return t}function pm(n,t){return n>>BigInt(t)&mi}var gm=(n,t,e)=>n|(e?mi:qf)<<BigInt(t),rs=n=>(am<<BigInt(n-1))-mi,gc=n=>new Uint8Array(n),Lf=n=>Uint8Array.from(n);function yc(n,t,e){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let r=gc(n),o=gc(n),s=0,i=()=>{r.fill(1),o.fill(0),s=0},c=(...g)=>e(o,r,...g),u=(g=gc())=>{o=c(Lf([0]),g),r=c(),g.length!==0&&(o=c(Lf([1]),g),r=c())},d=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let g=0,T=[];for(;g<t;){r=c();let S=r.slice();T.push(S),g+=r.length}return Ao(...T)};return(g,T)=>{i(),u(g);let S;for(;!(S=T(d()));)u();return i(),S}}var mm={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||n instanceof Uint8Array,isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,t)=>t.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function pr(n,t,e={}){let r=(o,s,i)=>{let c=mm[s];if(typeof c!="function")throw new Error(`Invalid validator "${s}", expected function`);let u=n[o];if(!(i&&u===void 0)&&!c(u,n))throw new Error(`Invalid param ${String(o)}=${u} (${typeof u}), expected ${s}`)};for(let[o,s]of Object.entries(t))r(o,s,!1);for(let[o,s]of Object.entries(e))r(o,s,!0);return n}var pt=BigInt(0),ot=BigInt(1),Hr=BigInt(2),ym=BigInt(3),Ac=BigInt(4),Ff=BigInt(5),Hf=BigInt(8),hm=BigInt(9),Am=BigInt(16);function _t(n,t){let e=n%t;return e>=pt?e:t+e}function xm(n,t,e){if(e<=pt||t<pt)throw new Error("Expected power/modulo > 0");if(e===ot)return pt;let r=ot;for(;t>pt;)t&ot&&(r=r*n%e),n=n*n%e,t>>=ot;return r}function qt(n,t,e){let r=n;for(;t-- >pt;)r*=r,r%=e;return r}function xi(n,t){if(n===pt||t<=pt)throw new Error(`invert: expected positive integers, got n=${n} mod=${t}`);let e=_t(n,t),r=t,o=pt,s=ot,i=ot,c=pt;for(;e!==pt;){let d=r/e,y=r%e,g=o-i*d,T=s-c*d;r=e,e=y,o=i,s=c,i=g,c=T}if(r!==ot)throw new Error("invert: does not exist");return _t(o,t)}function bm(n){let t=(n-ot)/Hr,e,r,o;for(e=n-ot,r=0;e%Hr===pt;e/=Hr,r++);for(o=Hr;o<n&&xm(o,t,n)!==n-ot;o++);if(r===1){let i=(n+ot)/Ac;return function(u,d){let y=u.pow(d,i);if(!u.eql(u.sqr(y),d))throw new Error("Cannot find square root");return y}}let s=(e+ot)/Hr;return function(c,u){if(c.pow(u,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let d=r,y=c.pow(c.mul(c.ONE,o),e),g=c.pow(u,s),T=c.pow(u,e);for(;!c.eql(T,c.ONE);){if(c.eql(T,c.ZERO))return c.ZERO;let S=1;for(let h=c.sqr(T);S<d&&!c.eql(h,c.ONE);S++)h=c.sqr(h);let b=c.pow(y,ot<<BigInt(d-S-1));y=c.sqr(b),g=c.mul(g,b),T=c.mul(T,y),d=S}return g}}function wm(n){if(n%Ac===ym){let t=(n+ot)/Ac;return function(r,o){let s=r.pow(o,t);if(!r.eql(r.sqr(s),o))throw new Error("Cannot find square root");return s}}if(n%Hf===Ff){let t=(n-Ff)/Hf;return function(r,o){let s=r.mul(o,Hr),i=r.pow(s,t),c=r.mul(o,i),u=r.mul(r.mul(c,Hr),i),d=r.mul(c,r.sub(u,r.ONE));if(!r.eql(r.sqr(d),o))throw new Error("Cannot find square root");return d}}return n%Am,bm(n)}var Tm=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function xc(n){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=Tm.reduce((r,o)=>(r[o]="function",r),t);return pr(n,e)}function _m(n,t,e){if(e<pt)throw new Error("Expected power > 0");if(e===pt)return n.ONE;if(e===ot)return t;let r=n.ONE,o=t;for(;e>pt;)e&ot&&(r=n.mul(r,o)),o=n.sqr(o),e>>=ot;return r}function Em(n,t){let e=new Array(t.length),r=t.reduce((s,i,c)=>n.is0(i)?s:(e[c]=s,n.mul(s,i)),n.ONE),o=n.inv(r);return t.reduceRight((s,i,c)=>n.is0(i)?s:(e[c]=n.mul(s,e[c]),n.mul(s,i)),o),e}function bc(n,t){let e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function $f(n,t,e=!1,r={}){if(n<=pt)throw new Error(`Expected Field ORDER > 0, got ${n}`);let{nBitLength:o,nByteLength:s}=bc(n,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let i=wm(n),c=Object.freeze({ORDER:n,BITS:o,BYTES:s,MASK:rs(o),ZERO:pt,ONE:ot,create:u=>_t(u,n),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return pt<=u&&u<n},is0:u=>u===pt,isOdd:u=>(u&ot)===ot,neg:u=>_t(-u,n),eql:(u,d)=>u===d,sqr:u=>_t(u*u,n),add:(u,d)=>_t(u+d,n),sub:(u,d)=>_t(u-d,n),mul:(u,d)=>_t(u*d,n),pow:(u,d)=>_m(c,u,d),div:(u,d)=>_t(u*xi(d,n),n),sqrN:u=>u*u,addN:(u,d)=>u+d,subN:(u,d)=>u-d,mulN:(u,d)=>u*d,inv:u=>xi(u,n),sqrt:r.sqrt||(u=>i(c,u)),invertBatch:u=>Em(c,u),cmov:(u,d,y)=>y?d:u,toBytes:u=>e?Ai(u,s):lr(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return e?hi(u):qn(u)}});return Object.freeze(c)}function Vf(n){if(typeof n!="bigint")throw new Error("field order must be bigint");let t=n.toString(2).length;return Math.ceil(t/8)}function wc(n){let t=Vf(n);return t+Math.ceil(t/2)}function jf(n,t,e=!1){let r=n.length,o=Vf(t),s=wc(t);if(r<16||r<s||r>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);let i=e?qn(n):hi(n),c=_t(i,t-ot)+ot;return e?Ai(c,o):lr(c,o)}var vm=BigInt(0),Tc=BigInt(1);function Wf(n,t){let e=(o,s)=>{let i=s.negate();return o?i:s},r=o=>{let s=Math.ceil(t/o)+1,i=2**(o-1);return{windows:s,windowSize:i}};return{constTimeNegate:e,unsafeLadder(o,s){let i=n.ZERO,c=o;for(;s>vm;)s&Tc&&(i=i.add(c)),c=c.double(),s>>=Tc;return i},precomputeWindow(o,s){let{windows:i,windowSize:c}=r(s),u=[],d=o,y=d;for(let g=0;g<i;g++){y=d,u.push(y);for(let T=1;T<c;T++)y=y.add(d),u.push(y);d=y.double()}return u},wNAF(o,s,i){let{windows:c,windowSize:u}=r(o),d=n.ZERO,y=n.BASE,g=BigInt(2**o-1),T=2**o,S=BigInt(o);for(let b=0;b<c;b++){let h=b*u,w=Number(i&g);i>>=S,w>u&&(w-=T,i+=Tc);let v=h,k=h+Math.abs(w)-1,P=b%2!==0,$=w<0;w===0?y=y.add(e(P,s[v])):d=d.add(e($,s[k]))}return{p:d,f:y}},wNAFCached(o,s,i,c){let u=o._WINDOW_SIZE||1,d=s.get(o);return d||(d=this.precomputeWindow(o,u),u!==1&&s.set(o,c(d))),this.wNAF(u,d,i)}}}function _c(n){return xc(n.Fp),pr(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...bc(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}function Cm(n){let t=_c(n);pr(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:r,a:o}=t;if(e){if(!r.eql(o,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:Im,hexToBytes:Bm}=hc,$r={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(n){let{Err:t}=$r;if(n.length<2||n[0]!==2)throw new t("Invalid signature integer tag");let e=n[1],r=n.subarray(2,e+2);if(!e||r.length!==e)throw new t("Invalid signature integer: wrong length");if(r[0]&128)throw new t("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:Im(r),l:n.subarray(e+2)}},toSig(n){let{Err:t}=$r,e=typeof n=="string"?Bm(n):n;if(!(e instanceof Uint8Array))throw new Error("ui8a expected");let r=e.length;if(r<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==r-2)throw new t("Invalid signature: incorrect length");let{d:o,l:s}=$r._parseInt(e.subarray(2)),{d:i,l:c}=$r._parseInt(s);if(c.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s:i}},hexFromSig(n){let t=d=>Number.parseInt(d[0],16)&8?"00"+d:d,e=d=>{let y=d.toString(16);return y.length&1?`0${y}`:y},r=t(e(n.s)),o=t(e(n.r)),s=r.length/2,i=o.length/2,c=e(s),u=e(i);return`30${e(i+s+4)}02${u}${o}02${c}${r}`}},Kn=BigInt(0),Xt=BigInt(1),ob=BigInt(2),Qf=BigInt(3),sb=BigInt(4);function Um(n){let t=Cm(n),{Fp:e}=t,r=t.toBytes||((b,h,w)=>{let v=h.toAffine();return Ao(Uint8Array.from([4]),e.toBytes(v.x),e.toBytes(v.y))}),o=t.fromBytes||(b=>{let h=b.subarray(1),w=e.fromBytes(h.subarray(0,e.BYTES)),v=e.fromBytes(h.subarray(e.BYTES,2*e.BYTES));return{x:w,y:v}});function s(b){let{a:h,b:w}=t,v=e.sqr(b),k=e.mul(v,b);return e.add(e.add(k,e.mul(b,h)),w)}if(!e.eql(e.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function i(b){return typeof b=="bigint"&&Kn<b&&b<t.n}function c(b){if(!i(b))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function u(b){let{allowedPrivateKeyLengths:h,nByteLength:w,wrapPrivateKey:v,n:k}=t;if(h&&typeof b!="bigint"){if(b instanceof Uint8Array&&(b=Kr(b)),typeof b!="string"||!h.includes(b.length))throw new Error("Invalid key");b=b.padStart(w*2,"0")}let P;try{P=typeof b=="bigint"?b:qn(Lt("private key",b,w))}catch{throw new Error(`private key must be ${w} bytes, hex or bigint, not ${typeof b}`)}return v&&(P=_t(P,k)),c(P),P}let d=new Map;function y(b){if(!(b instanceof g))throw new Error("ProjectivePoint expected")}class g{constructor(h,w,v){if(this.px=h,this.py=w,this.pz=v,h==null||!e.isValid(h))throw new Error("x required");if(w==null||!e.isValid(w))throw new Error("y required");if(v==null||!e.isValid(v))throw new Error("z required")}static fromAffine(h){let{x:w,y:v}=h||{};if(!h||!e.isValid(w)||!e.isValid(v))throw new Error("invalid affine point");if(h instanceof g)throw new Error("projective point not allowed");let k=P=>e.eql(P,e.ZERO);return k(w)&&k(v)?g.ZERO:new g(w,v,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(h){let w=e.invertBatch(h.map(v=>v.pz));return h.map((v,k)=>v.toAffine(w[k])).map(g.fromAffine)}static fromHex(h){let w=g.fromAffine(o(Lt("pointHex",h)));return w.assertValidity(),w}static fromPrivateKey(h){return g.BASE.multiply(u(h))}_setWindowSize(h){this._WINDOW_SIZE=h,d.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:h,y:w}=this.toAffine();if(!e.isValid(h)||!e.isValid(w))throw new Error("bad point: x or y not FE");let v=e.sqr(w),k=s(h);if(!e.eql(v,k))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:h}=this.toAffine();if(e.isOdd)return!e.isOdd(h);throw new Error("Field doesn't support isOdd")}equals(h){y(h);let{px:w,py:v,pz:k}=this,{px:P,py:$,pz:G}=h,D=e.eql(e.mul(w,G),e.mul(P,k)),q=e.eql(e.mul(v,G),e.mul($,k));return D&&q}negate(){return new g(this.px,e.neg(this.py),this.pz)}double(){let{a:h,b:w}=t,v=e.mul(w,Qf),{px:k,py:P,pz:$}=this,G=e.ZERO,D=e.ZERO,q=e.ZERO,F=e.mul(k,k),Te=e.mul(P,P),te=e.mul($,$),Q=e.mul(k,P);return Q=e.add(Q,Q),q=e.mul(k,$),q=e.add(q,q),G=e.mul(h,q),D=e.mul(v,te),D=e.add(G,D),G=e.sub(Te,D),D=e.add(Te,D),D=e.mul(G,D),G=e.mul(Q,G),q=e.mul(v,q),te=e.mul(h,te),Q=e.sub(F,te),Q=e.mul(h,Q),Q=e.add(Q,q),q=e.add(F,F),F=e.add(q,F),F=e.add(F,te),F=e.mul(F,Q),D=e.add(D,F),te=e.mul(P,$),te=e.add(te,te),F=e.mul(te,Q),G=e.sub(G,F),q=e.mul(te,Te),q=e.add(q,q),q=e.add(q,q),new g(G,D,q)}add(h){y(h);let{px:w,py:v,pz:k}=this,{px:P,py:$,pz:G}=h,D=e.ZERO,q=e.ZERO,F=e.ZERO,Te=t.a,te=e.mul(t.b,Qf),Q=e.mul(w,P),Ce=e.mul(v,$),Ie=e.mul(k,G),Ye=e.add(w,v),_=e.add(P,$);Ye=e.mul(Ye,_),_=e.add(Q,Ce),Ye=e.sub(Ye,_),_=e.add(w,k);let U=e.add(P,G);return _=e.mul(_,U),U=e.add(Q,Ie),_=e.sub(_,U),U=e.add(v,k),D=e.add($,G),U=e.mul(U,D),D=e.add(Ce,Ie),U=e.sub(U,D),F=e.mul(Te,_),D=e.mul(te,Ie),F=e.add(D,F),D=e.sub(Ce,F),F=e.add(Ce,F),q=e.mul(D,F),Ce=e.add(Q,Q),Ce=e.add(Ce,Q),Ie=e.mul(Te,Ie),_=e.mul(te,_),Ce=e.add(Ce,Ie),Ie=e.sub(Q,Ie),Ie=e.mul(Te,Ie),_=e.add(_,Ie),Q=e.mul(Ce,_),q=e.add(q,Q),Q=e.mul(U,_),D=e.mul(Ye,D),D=e.sub(D,Q),Q=e.mul(Ye,Ce),F=e.mul(U,F),F=e.add(F,Q),new g(D,q,F)}subtract(h){return this.add(h.negate())}is0(){return this.equals(g.ZERO)}wNAF(h){return S.wNAFCached(this,d,h,w=>{let v=e.invertBatch(w.map(k=>k.pz));return w.map((k,P)=>k.toAffine(v[P])).map(g.fromAffine)})}multiplyUnsafe(h){let w=g.ZERO;if(h===Kn)return w;if(c(h),h===Xt)return this;let{endo:v}=t;if(!v)return S.unsafeLadder(this,h);let{k1neg:k,k1:P,k2neg:$,k2:G}=v.splitScalar(h),D=w,q=w,F=this;for(;P>Kn||G>Kn;)P&Xt&&(D=D.add(F)),G&Xt&&(q=q.add(F)),F=F.double(),P>>=Xt,G>>=Xt;return k&&(D=D.negate()),$&&(q=q.negate()),q=new g(e.mul(q.px,v.beta),q.py,q.pz),D.add(q)}multiply(h){c(h);let w=h,v,k,{endo:P}=t;if(P){let{k1neg:$,k1:G,k2neg:D,k2:q}=P.splitScalar(w),{p:F,f:Te}=this.wNAF(G),{p:te,f:Q}=this.wNAF(q);F=S.constTimeNegate($,F),te=S.constTimeNegate(D,te),te=new g(e.mul(te.px,P.beta),te.py,te.pz),v=F.add(te),k=Te.add(Q)}else{let{p:$,f:G}=this.wNAF(w);v=$,k=G}return g.normalizeZ([v,k])[0]}multiplyAndAddUnsafe(h,w,v){let k=g.BASE,P=(G,D)=>D===Kn||D===Xt||!G.equals(k)?G.multiplyUnsafe(D):G.multiply(D),$=P(this,w).add(P(h,v));return $.is0()?void 0:$}toAffine(h){let{px:w,py:v,pz:k}=this,P=this.is0();h==null&&(h=P?e.ONE:e.inv(k));let $=e.mul(w,h),G=e.mul(v,h),D=e.mul(k,h);if(P)return{x:e.ZERO,y:e.ZERO};if(!e.eql(D,e.ONE))throw new Error("invZ was invalid");return{x:$,y:G}}isTorsionFree(){let{h,isTorsionFree:w}=t;if(h===Xt)return!0;if(w)return w(g,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h,clearCofactor:w}=t;return h===Xt?this:w?w(g,this):this.multiplyUnsafe(t.h)}toRawBytes(h=!0){return this.assertValidity(),r(g,this,h)}toHex(h=!0){return Kr(this.toRawBytes(h))}}g.BASE=new g(t.Gx,t.Gy,e.ONE),g.ZERO=new g(e.ZERO,e.ONE,e.ZERO);let T=t.nBitLength,S=Wf(g,t.endo?Math.ceil(T/2):T);return{CURVE:t,ProjectivePoint:g,normPrivateKeyToScalar:u,weierstrassEquation:s,isWithinCurveOrder:i}}function Pm(n){let t=_c(n);return pr(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Yf(n){let t=Pm(n),{Fp:e,n:r}=t,o=e.BYTES+1,s=2*e.BYTES+1;function i(_){return Kn<_&&_<e.ORDER}function c(_){return _t(_,r)}function u(_){return xi(_,r)}let{ProjectivePoint:d,normPrivateKeyToScalar:y,weierstrassEquation:g,isWithinCurveOrder:T}=Um({...t,toBytes(_,U,H){let ne=U.toAffine(),re=e.toBytes(ne.x),be=Ao;return H?be(Uint8Array.from([U.hasEvenY()?2:3]),re):be(Uint8Array.from([4]),re,e.toBytes(ne.y))},fromBytes(_){let U=_.length,H=_[0],ne=_.subarray(1);if(U===o&&(H===2||H===3)){let re=qn(ne);if(!i(re))throw new Error("Point is not on curve");let be=g(re),ze=e.sqrt(be),_e=(ze&Xt)===Xt;return(H&1)===1!==_e&&(ze=e.neg(ze)),{x:re,y:ze}}else if(U===s&&H===4){let re=e.fromBytes(ne.subarray(0,e.BYTES)),be=e.fromBytes(ne.subarray(e.BYTES,2*e.BYTES));return{x:re,y:be}}else throw new Error(`Point of length ${U} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`)}}),S=_=>Kr(lr(_,t.nByteLength));function b(_){let U=r>>Xt;return _>U}function h(_){return b(_)?c(-_):_}let w=(_,U,H)=>qn(_.slice(U,H));class v{constructor(U,H,ne){this.r=U,this.s=H,this.recovery=ne,this.assertValidity()}static fromCompact(U){let H=t.nByteLength;return U=Lt("compactSignature",U,H*2),new v(w(U,0,H),w(U,H,2*H))}static fromDER(U){let{r:H,s:ne}=$r.toSig(Lt("DER",U));return new v(H,ne)}assertValidity(){if(!T(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!T(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(U){return new v(this.r,this.s,U)}recoverPublicKey(U){let{r:H,s:ne,recovery:re}=this,be=q(Lt("msgHash",U));if(re==null||![0,1,2,3].includes(re))throw new Error("recovery id invalid");let ze=re===2||re===3?H+t.n:H;if(ze>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let _e=re&1?"03":"02",Le=d.fromHex(_e+S(ze)),se=u(ze),$e=c(-be*se),Rt=c(ne*se),ut=d.BASE.multiplyAndAddUnsafe(Le,$e,Rt);if(!ut)throw new Error("point at infinify");return ut.assertValidity(),ut}hasHighS(){return b(this.s)}normalizeS(){return this.hasHighS()?new v(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return Fr(this.toDERHex())}toDERHex(){return $r.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Fr(this.toCompactHex())}toCompactHex(){return S(this.r)+S(this.s)}}let k={isValidPrivateKey(_){try{return y(_),!0}catch{return!1}},normPrivateKeyToScalar:y,randomPrivateKey:()=>{let _=wc(t.n);return jf(t.randomBytes(_),t.n)},precompute(_=8,U=d.BASE){return U._setWindowSize(_),U.multiply(BigInt(3)),U}};function P(_,U=!0){return d.fromPrivateKey(_).toRawBytes(U)}function $(_){let U=_ instanceof Uint8Array,H=typeof _=="string",ne=(U||H)&&_.length;return U?ne===o||ne===s:H?ne===2*o||ne===2*s:_ instanceof d}function G(_,U,H=!0){if($(_))throw new Error("first arg must be private key");if(!$(U))throw new Error("second arg must be public key");return d.fromHex(U).multiply(y(_)).toRawBytes(H)}let D=t.bits2int||function(_){let U=qn(_),H=_.length*8-t.nBitLength;return H>0?U>>BigInt(H):U},q=t.bits2int_modN||function(_){return c(D(_))},F=rs(t.nBitLength);function Te(_){if(typeof _!="bigint")throw new Error("bigint expected");if(!(Kn<=_&&_<F))throw new Error(`bigint expected < 2^${t.nBitLength}`);return lr(_,t.nByteLength)}function te(_,U,H=Q){if(["recovered","canonical"].some(ft=>ft in H))throw new Error("sign() legacy options not supported");let{hash:ne,randomBytes:re}=t,{lowS:be,prehash:ze,extraEntropy:_e}=H;be==null&&(be=!0),_=Lt("msgHash",_),ze&&(_=Lt("prehashed msgHash",ne(_)));let Le=q(_),se=y(U),$e=[Te(se),Te(Le)];if(_e!=null){let ft=_e===!0?re(e.BYTES):_e;$e.push(Lt("extraEntropy",ft))}let Rt=Ao(...$e),ut=Le;function $t(ft){let xt=D(ft);if(!T(xt))return;let xn=u(xt),We=d.BASE.multiply(xt).toAffine(),St=c(We.x);if(St===Kn)return;let on=c(xn*c(ut+St*se));if(on===Kn)return;let Ir=(We.x===St?0:2)|Number(We.y&Xt),Xn=on;return be&&b(on)&&(Xn=h(on),Ir^=1),new v(St,Xn,Ir)}return{seed:Rt,k2sig:$t}}let Q={lowS:t.lowS,prehash:!1},Ce={lowS:t.lowS,prehash:!1};function Ie(_,U,H=Q){let{seed:ne,k2sig:re}=te(_,U,H),be=t;return yc(be.hash.outputLen,be.nByteLength,be.hmac)(ne,re)}d.BASE._setWindowSize(8);function Ye(_,U,H,ne=Ce){let re=_;if(U=Lt("msgHash",U),H=Lt("publicKey",H),"strict"in ne)throw new Error("options.strict was renamed to lowS");let{lowS:be,prehash:ze}=ne,_e,Le;try{if(typeof re=="string"||re instanceof Uint8Array)try{_e=v.fromDER(re)}catch(We){if(!(We instanceof $r.Err))throw We;_e=v.fromCompact(re)}else if(typeof re=="object"&&typeof re.r=="bigint"&&typeof re.s=="bigint"){let{r:We,s:St}=re;_e=new v(We,St)}else throw new Error("PARSE");Le=d.fromHex(H)}catch(We){if(We.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(be&&_e.hasHighS())return!1;ze&&(U=t.hash(U));let{r:se,s:$e}=_e,Rt=q(U),ut=u($e),$t=c(Rt*ut),ft=c(se*ut),xt=d.BASE.multiplyAndAddUnsafe(Le,$t,ft)?.toAffine();return xt?c(xt.x)===se:!1}return{CURVE:t,getPublicKey:P,getSharedSecret:G,sign:Ie,verify:Ye,ProjectivePoint:d,Signature:v,utils:k}}var bi=class extends ho{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,Of(t);let r=ns(e);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;let o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),s.fill(0)}update(t){return yo(this),this.iHash.update(t),this}digestInto(t){yo(this),lc(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:e,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Ec=(n,t,e)=>new bi(n,t).update(e).digest();Ec.create=(n,t)=>new bi(n,t);function Rm(n){return{hash:n,hmac:(t,...e)=>Ec(n,t,Df(...e)),randomBytes:Mf}}function Zf(n,t){let e=r=>Yf({...n,...Rm(r)});return Object.freeze({...e(t),create:e})}var ed=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Xf=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Om=BigInt(1),Sc=BigInt(2),Jf=(n,t)=>(n+t/Sc)/t;function Nm(n){let t=ed,e=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),u=BigInt(88),d=n*n*n%t,y=d*d*n%t,g=qt(y,e,t)*y%t,T=qt(g,e,t)*y%t,S=qt(T,Sc,t)*d%t,b=qt(S,o,t)*S%t,h=qt(b,s,t)*b%t,w=qt(h,c,t)*h%t,v=qt(w,u,t)*w%t,k=qt(v,c,t)*h%t,P=qt(k,e,t)*y%t,$=qt(P,i,t)*b%t,G=qt($,r,t)*d%t,D=qt(G,Sc,t);if(!vc.eql(vc.sqr(D),n))throw new Error("Cannot find square root");return D}var vc=$f(ed,void 0,void 0,{sqrt:Nm}),xo=Zf({a:BigInt(0),b:BigInt(7),Fp:vc,n:Xf,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{let t=Xf,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Om*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,i=BigInt("0x100000000000000000000000000000000"),c=Jf(s*n,t),u=Jf(-r*n,t),d=_t(n-c*e-u*o,t),y=_t(-c*r-u*s,t),g=d>i,T=y>i;if(g&&(d=t-d),T&&(y=t-y),d>i||y>i)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:g,k1:d,k2neg:T,k2:y}}}},Gf),hb=BigInt(0);var Ab=xo.ProjectivePoint;var km=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),nd=Uint8Array.from({length:16},(n,t)=>t),Dm=nd.map(n=>(9*n+5)%16),Ic=[nd],Bc=[Dm];for(let n=0;n<4;n++)for(let t of[Ic,Bc])t.push(t[n].map(e=>km[e]));var rd=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(n=>new Uint8Array(n)),zm=Ic.map((n,t)=>n.map(e=>rd[t][e])),Mm=Bc.map((n,t)=>n.map(e=>rd[t][e])),Gm=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Lm=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),wi=(n,t)=>n<<t|n>>>32-t;function td(n,t,e,r){return n===0?t^e^r:n===1?t&e|~t&r:n===2?(t|~e)^r:n===3?t&r|e&~r:t^(e|~r)}var Ti=new Uint32Array(16),Cc=class extends rr{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){let{h0:t,h1:e,h2:r,h3:o,h4:s}=this;return[t,e,r,o,s]}set(t,e,r,o,s){this.h0=t|0,this.h1=e|0,this.h2=r|0,this.h3=o|0,this.h4=s|0}process(t,e){for(let S=0;S<16;S++,e+=4)Ti[S]=t.getUint32(e,!0);let r=this.h0|0,o=r,s=this.h1|0,i=s,c=this.h2|0,u=c,d=this.h3|0,y=d,g=this.h4|0,T=g;for(let S=0;S<5;S++){let b=4-S,h=Gm[S],w=Lm[S],v=Ic[S],k=Bc[S],P=zm[S],$=Mm[S];for(let G=0;G<16;G++){let D=wi(r+td(S,s,c,d)+Ti[v[G]]+h,P[G])+g|0;r=g,g=d,d=wi(c,10)|0,c=s,s=D}for(let G=0;G<16;G++){let D=wi(o+td(b,i,u,y)+Ti[k[G]]+w,$[G])+T|0;o=T,T=y,y=wi(u,10)|0,u=i,i=D}}this.set(this.h1+c+y|0,this.h2+d+T|0,this.h3+g+o|0,this.h4+r+i|0,this.h0+s+u|0)}roundClean(){Ti.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}},od=er(()=>new Cc);var Oc={};$s(Oc,{bitGet:()=>jm,bitLen:()=>Vm,bitMask:()=>os,bitSet:()=>Wm,bytesToHex:()=>Vr,bytesToNumberBE:()=>Hn,bytesToNumberLE:()=>Ei,concatBytes:()=>bo,createHmacDrbg:()=>Rc,ensureBytes:()=>Kt,equalBytes:()=>Hm,hexToBytes:()=>jr,hexToNumber:()=>Pc,isBytes:()=>pn,numberToBytesBE:()=>gr,numberToBytesLE:()=>Si,numberToHexUnpadded:()=>cd,numberToVarBytesBE:()=>Fm,utf8ToBytes:()=>$m,validateObject:()=>mr});var ad=BigInt(0),_i=BigInt(1),qm=BigInt(2);function pn(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}var Km=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function Vr(n){if(!pn(n))throw new Error("Uint8Array expected");let t="";for(let e=0;e<n.length;e++)t+=Km[n[e]];return t}function cd(n){let t=n.toString(16);return t.length&1?`0${t}`:t}function Pc(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return BigInt(n===""?"0":`0x${n}`)}var Fn={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function sd(n){if(n>=Fn._0&&n<=Fn._9)return n-Fn._0;if(n>=Fn._A&&n<=Fn._F)return n-(Fn._A-10);if(n>=Fn._a&&n<=Fn._f)return n-(Fn._a-10)}function jr(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);let t=n.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(e);for(let o=0,s=0;o<e;o++,s+=2){let i=sd(n.charCodeAt(s)),c=sd(n.charCodeAt(s+1));if(i===void 0||c===void 0){let u=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+s)}r[o]=i*16+c}return r}function Hn(n){return Pc(Vr(n))}function Ei(n){if(!pn(n))throw new Error("Uint8Array expected");return Pc(Vr(Uint8Array.from(n).reverse()))}function gr(n,t){return jr(n.toString(16).padStart(t*2,"0"))}function Si(n,t){return gr(n,t).reverse()}function Fm(n){return jr(cd(n))}function Kt(n,t,e){let r;if(typeof t=="string")try{r=jr(t)}catch(s){throw new Error(`${n} must be valid hex string, got "${t}". Cause: ${s}`)}else if(pn(t))r=Uint8Array.from(t);else throw new Error(`${n} must be hex string or Uint8Array`);let o=r.length;if(typeof e=="number"&&o!==e)throw new Error(`${n} expected ${e} bytes, got ${o}`);return r}function bo(...n){let t=0;for(let o=0;o<n.length;o++){let s=n[o];if(!pn(s))throw new Error("Uint8Array expected");t+=s.length}let e=new Uint8Array(t),r=0;for(let o=0;o<n.length;o++){let s=n[o];e.set(s,r),r+=s.length}return e}function Hm(n,t){if(n.length!==t.length)return!1;let e=0;for(let r=0;r<n.length;r++)e|=n[r]^t[r];return e===0}function $m(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function Vm(n){let t;for(t=0;n>ad;n>>=_i,t+=1);return t}function jm(n,t){return n>>BigInt(t)&_i}var Wm=(n,t,e)=>n|(e?_i:ad)<<BigInt(t),os=n=>(qm<<BigInt(n-1))-_i,Uc=n=>new Uint8Array(n),id=n=>Uint8Array.from(n);function Rc(n,t,e){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let r=Uc(n),o=Uc(n),s=0,i=()=>{r.fill(1),o.fill(0),s=0},c=(...g)=>e(o,r,...g),u=(g=Uc())=>{o=c(id([0]),g),r=c(),g.length!==0&&(o=c(id([1]),g),r=c())},d=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let g=0,T=[];for(;g<t;){r=c();let S=r.slice();T.push(S),g+=r.length}return bo(...T)};return(g,T)=>{i(),u(g);let S;for(;!(S=T(d()));)u();return i(),S}}var Qm={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||pn(n),isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,t)=>t.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function mr(n,t,e={}){let r=(o,s,i)=>{let c=Qm[s];if(typeof c!="function")throw new Error(`Invalid validator "${s}", expected function`);let u=n[o];if(!(i&&u===void 0)&&!c(u,n))throw new Error(`Invalid param ${String(o)}=${u} (${typeof u}), expected ${s}`)};for(let[o,s]of Object.entries(t))r(o,s,!1);for(let[o,s]of Object.entries(e))r(o,s,!0);return n}var gt=BigInt(0),st=BigInt(1),Wr=BigInt(2),Ym=BigInt(3),Nc=BigInt(4),ud=BigInt(5),fd=BigInt(8),Zm=BigInt(9),Xm=BigInt(16);function yt(n,t){let e=n%t;return e>=gt?e:t+e}function Jm(n,t,e){if(e<=gt||t<gt)throw new Error("Expected power/modulo > 0");if(e===st)return gt;let r=st;for(;t>gt;)t&st&&(r=r*n%e),n=n*n%e,t>>=st;return r}function Ft(n,t,e){let r=n;for(;t-- >gt;)r*=r,r%=e;return r}function vi(n,t){if(n===gt||t<=gt)throw new Error(`invert: expected positive integers, got n=${n} mod=${t}`);let e=yt(n,t),r=t,o=gt,s=st,i=st,c=gt;for(;e!==gt;){let d=r/e,y=r%e,g=o-i*d,T=s-c*d;r=e,e=y,o=i,s=c,i=g,c=T}if(r!==st)throw new Error("invert: does not exist");return yt(o,t)}function ey(n){let t=(n-st)/Wr,e,r,o;for(e=n-st,r=0;e%Wr===gt;e/=Wr,r++);for(o=Wr;o<n&&Jm(o,t,n)!==n-st;o++);if(r===1){let i=(n+st)/Nc;return function(u,d){let y=u.pow(d,i);if(!u.eql(u.sqr(y),d))throw new Error("Cannot find square root");return y}}let s=(e+st)/Wr;return function(c,u){if(c.pow(u,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let d=r,y=c.pow(c.mul(c.ONE,o),e),g=c.pow(u,s),T=c.pow(u,e);for(;!c.eql(T,c.ONE);){if(c.eql(T,c.ZERO))return c.ZERO;let S=1;for(let h=c.sqr(T);S<d&&!c.eql(h,c.ONE);S++)h=c.sqr(h);let b=c.pow(y,st<<BigInt(d-S-1));y=c.sqr(b),g=c.mul(g,b),T=c.mul(T,y),d=S}return g}}function ty(n){if(n%Nc===Ym){let t=(n+st)/Nc;return function(r,o){let s=r.pow(o,t);if(!r.eql(r.sqr(s),o))throw new Error("Cannot find square root");return s}}if(n%fd===ud){let t=(n-ud)/fd;return function(r,o){let s=r.mul(o,Wr),i=r.pow(s,t),c=r.mul(o,i),u=r.mul(r.mul(c,Wr),i),d=r.mul(c,r.sub(u,r.ONE));if(!r.eql(r.sqr(d),o))throw new Error("Cannot find square root");return d}}return n%Xm,ey(n)}var ny=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function kc(n){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=ny.reduce((r,o)=>(r[o]="function",r),t);return mr(n,e)}function ry(n,t,e){if(e<gt)throw new Error("Expected power > 0");if(e===gt)return n.ONE;if(e===st)return t;let r=n.ONE,o=t;for(;e>gt;)e&st&&(r=n.mul(r,o)),o=n.sqr(o),e>>=st;return r}function oy(n,t){let e=new Array(t.length),r=t.reduce((s,i,c)=>n.is0(i)?s:(e[c]=s,n.mul(s,i)),n.ONE),o=n.inv(r);return t.reduceRight((s,i,c)=>n.is0(i)?s:(e[c]=n.mul(s,e[c]),n.mul(s,i)),o),e}function Dc(n,t){let e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function dd(n,t,e=!1,r={}){if(n<=gt)throw new Error(`Expected Field ORDER > 0, got ${n}`);let{nBitLength:o,nByteLength:s}=Dc(n,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let i=ty(n),c=Object.freeze({ORDER:n,BITS:o,BYTES:s,MASK:os(o),ZERO:gt,ONE:st,create:u=>yt(u,n),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return gt<=u&&u<n},is0:u=>u===gt,isOdd:u=>(u&st)===st,neg:u=>yt(-u,n),eql:(u,d)=>u===d,sqr:u=>yt(u*u,n),add:(u,d)=>yt(u+d,n),sub:(u,d)=>yt(u-d,n),mul:(u,d)=>yt(u*d,n),pow:(u,d)=>ry(c,u,d),div:(u,d)=>yt(u*vi(d,n),n),sqrN:u=>u*u,addN:(u,d)=>u+d,subN:(u,d)=>u-d,mulN:(u,d)=>u*d,inv:u=>vi(u,n),sqrt:r.sqrt||(u=>i(c,u)),invertBatch:u=>oy(c,u),cmov:(u,d,y)=>y?d:u,toBytes:u=>e?Si(u,s):gr(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return e?Ei(u):Hn(u)}});return Object.freeze(c)}function ld(n){if(typeof n!="bigint")throw new Error("field order must be bigint");let t=n.toString(2).length;return Math.ceil(t/8)}function zc(n){let t=ld(n);return t+Math.ceil(t/2)}function pd(n,t,e=!1){let r=n.length,o=ld(t),s=zc(t);if(r<16||r<s||r>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);let i=e?Hn(n):Ei(n),c=yt(i,t-st)+st;return e?Si(c,o):gr(c,o)}var iy=BigInt(0),Mc=BigInt(1);function gd(n,t){let e=(o,s)=>{let i=s.negate();return o?i:s},r=o=>{let s=Math.ceil(t/o)+1,i=2**(o-1);return{windows:s,windowSize:i}};return{constTimeNegate:e,unsafeLadder(o,s){let i=n.ZERO,c=o;for(;s>iy;)s&Mc&&(i=i.add(c)),c=c.double(),s>>=Mc;return i},precomputeWindow(o,s){let{windows:i,windowSize:c}=r(s),u=[],d=o,y=d;for(let g=0;g<i;g++){y=d,u.push(y);for(let T=1;T<c;T++)y=y.add(d),u.push(y);d=y.double()}return u},wNAF(o,s,i){let{windows:c,windowSize:u}=r(o),d=n.ZERO,y=n.BASE,g=BigInt(2**o-1),T=2**o,S=BigInt(o);for(let b=0;b<c;b++){let h=b*u,w=Number(i&g);i>>=S,w>u&&(w-=T,i+=Mc);let v=h,k=h+Math.abs(w)-1,P=b%2!==0,$=w<0;w===0?y=y.add(e(P,s[v])):d=d.add(e($,s[k]))}return{p:d,f:y}},wNAFCached(o,s,i,c){let u=o._WINDOW_SIZE||1,d=s.get(o);return d||(d=this.precomputeWindow(o,u),u!==1&&s.set(o,c(d))),this.wNAF(u,d,i)}}}function Gc(n){return kc(n.Fp),mr(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Dc(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}function ay(n){let t=Gc(n);mr(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:r,a:o}=t;if(e){if(!r.eql(o,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:cy,hexToBytes:uy}=Oc,Qr={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(n){let{Err:t}=Qr;if(n.length<2||n[0]!==2)throw new t("Invalid signature integer tag");let e=n[1],r=n.subarray(2,e+2);if(!e||r.length!==e)throw new t("Invalid signature integer: wrong length");if(r[0]&128)throw new t("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:cy(r),l:n.subarray(e+2)}},toSig(n){let{Err:t}=Qr,e=typeof n=="string"?uy(n):n;if(!pn(e))throw new Error("ui8a expected");let r=e.length;if(r<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==r-2)throw new t("Invalid signature: incorrect length");let{d:o,l:s}=Qr._parseInt(e.subarray(2)),{d:i,l:c}=Qr._parseInt(s);if(c.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s:i}},hexFromSig(n){let t=d=>Number.parseInt(d[0],16)&8?"00"+d:d,e=d=>{let y=d.toString(16);return y.length&1?`0${y}`:y},r=t(e(n.s)),o=t(e(n.r)),s=r.length/2,i=o.length/2,c=e(s),u=e(i);return`30${e(i+s+4)}02${u}${o}02${c}${r}`}},$n=BigInt(0),Jt=BigInt(1),Ub=BigInt(2),md=BigInt(3),Pb=BigInt(4);function fy(n){let t=ay(n),{Fp:e}=t,r=t.toBytes||((b,h,w)=>{let v=h.toAffine();return bo(Uint8Array.from([4]),e.toBytes(v.x),e.toBytes(v.y))}),o=t.fromBytes||(b=>{let h=b.subarray(1),w=e.fromBytes(h.subarray(0,e.BYTES)),v=e.fromBytes(h.subarray(e.BYTES,2*e.BYTES));return{x:w,y:v}});function s(b){let{a:h,b:w}=t,v=e.sqr(b),k=e.mul(v,b);return e.add(e.add(k,e.mul(b,h)),w)}if(!e.eql(e.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function i(b){return typeof b=="bigint"&&$n<b&&b<t.n}function c(b){if(!i(b))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function u(b){let{allowedPrivateKeyLengths:h,nByteLength:w,wrapPrivateKey:v,n:k}=t;if(h&&typeof b!="bigint"){if(pn(b)&&(b=Vr(b)),typeof b!="string"||!h.includes(b.length))throw new Error("Invalid key");b=b.padStart(w*2,"0")}let P;try{P=typeof b=="bigint"?b:Hn(Kt("private key",b,w))}catch{throw new Error(`private key must be ${w} bytes, hex or bigint, not ${typeof b}`)}return v&&(P=yt(P,k)),c(P),P}let d=new Map;function y(b){if(!(b instanceof g))throw new Error("ProjectivePoint expected")}class g{constructor(h,w,v){if(this.px=h,this.py=w,this.pz=v,h==null||!e.isValid(h))throw new Error("x required");if(w==null||!e.isValid(w))throw new Error("y required");if(v==null||!e.isValid(v))throw new Error("z required")}static fromAffine(h){let{x:w,y:v}=h||{};if(!h||!e.isValid(w)||!e.isValid(v))throw new Error("invalid affine point");if(h instanceof g)throw new Error("projective point not allowed");let k=P=>e.eql(P,e.ZERO);return k(w)&&k(v)?g.ZERO:new g(w,v,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(h){let w=e.invertBatch(h.map(v=>v.pz));return h.map((v,k)=>v.toAffine(w[k])).map(g.fromAffine)}static fromHex(h){let w=g.fromAffine(o(Kt("pointHex",h)));return w.assertValidity(),w}static fromPrivateKey(h){return g.BASE.multiply(u(h))}_setWindowSize(h){this._WINDOW_SIZE=h,d.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:h,y:w}=this.toAffine();if(!e.isValid(h)||!e.isValid(w))throw new Error("bad point: x or y not FE");let v=e.sqr(w),k=s(h);if(!e.eql(v,k))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:h}=this.toAffine();if(e.isOdd)return!e.isOdd(h);throw new Error("Field doesn't support isOdd")}equals(h){y(h);let{px:w,py:v,pz:k}=this,{px:P,py:$,pz:G}=h,D=e.eql(e.mul(w,G),e.mul(P,k)),q=e.eql(e.mul(v,G),e.mul($,k));return D&&q}negate(){return new g(this.px,e.neg(this.py),this.pz)}double(){let{a:h,b:w}=t,v=e.mul(w,md),{px:k,py:P,pz:$}=this,G=e.ZERO,D=e.ZERO,q=e.ZERO,F=e.mul(k,k),Te=e.mul(P,P),te=e.mul($,$),Q=e.mul(k,P);return Q=e.add(Q,Q),q=e.mul(k,$),q=e.add(q,q),G=e.mul(h,q),D=e.mul(v,te),D=e.add(G,D),G=e.sub(Te,D),D=e.add(Te,D),D=e.mul(G,D),G=e.mul(Q,G),q=e.mul(v,q),te=e.mul(h,te),Q=e.sub(F,te),Q=e.mul(h,Q),Q=e.add(Q,q),q=e.add(F,F),F=e.add(q,F),F=e.add(F,te),F=e.mul(F,Q),D=e.add(D,F),te=e.mul(P,$),te=e.add(te,te),F=e.mul(te,Q),G=e.sub(G,F),q=e.mul(te,Te),q=e.add(q,q),q=e.add(q,q),new g(G,D,q)}add(h){y(h);let{px:w,py:v,pz:k}=this,{px:P,py:$,pz:G}=h,D=e.ZERO,q=e.ZERO,F=e.ZERO,Te=t.a,te=e.mul(t.b,md),Q=e.mul(w,P),Ce=e.mul(v,$),Ie=e.mul(k,G),Ye=e.add(w,v),_=e.add(P,$);Ye=e.mul(Ye,_),_=e.add(Q,Ce),Ye=e.sub(Ye,_),_=e.add(w,k);let U=e.add(P,G);return _=e.mul(_,U),U=e.add(Q,Ie),_=e.sub(_,U),U=e.add(v,k),D=e.add($,G),U=e.mul(U,D),D=e.add(Ce,Ie),U=e.sub(U,D),F=e.mul(Te,_),D=e.mul(te,Ie),F=e.add(D,F),D=e.sub(Ce,F),F=e.add(Ce,F),q=e.mul(D,F),Ce=e.add(Q,Q),Ce=e.add(Ce,Q),Ie=e.mul(Te,Ie),_=e.mul(te,_),Ce=e.add(Ce,Ie),Ie=e.sub(Q,Ie),Ie=e.mul(Te,Ie),_=e.add(_,Ie),Q=e.mul(Ce,_),q=e.add(q,Q),Q=e.mul(U,_),D=e.mul(Ye,D),D=e.sub(D,Q),Q=e.mul(Ye,Ce),F=e.mul(U,F),F=e.add(F,Q),new g(D,q,F)}subtract(h){return this.add(h.negate())}is0(){return this.equals(g.ZERO)}wNAF(h){return S.wNAFCached(this,d,h,w=>{let v=e.invertBatch(w.map(k=>k.pz));return w.map((k,P)=>k.toAffine(v[P])).map(g.fromAffine)})}multiplyUnsafe(h){let w=g.ZERO;if(h===$n)return w;if(c(h),h===Jt)return this;let{endo:v}=t;if(!v)return S.unsafeLadder(this,h);let{k1neg:k,k1:P,k2neg:$,k2:G}=v.splitScalar(h),D=w,q=w,F=this;for(;P>$n||G>$n;)P&Jt&&(D=D.add(F)),G&Jt&&(q=q.add(F)),F=F.double(),P>>=Jt,G>>=Jt;return k&&(D=D.negate()),$&&(q=q.negate()),q=new g(e.mul(q.px,v.beta),q.py,q.pz),D.add(q)}multiply(h){c(h);let w=h,v,k,{endo:P}=t;if(P){let{k1neg:$,k1:G,k2neg:D,k2:q}=P.splitScalar(w),{p:F,f:Te}=this.wNAF(G),{p:te,f:Q}=this.wNAF(q);F=S.constTimeNegate($,F),te=S.constTimeNegate(D,te),te=new g(e.mul(te.px,P.beta),te.py,te.pz),v=F.add(te),k=Te.add(Q)}else{let{p:$,f:G}=this.wNAF(w);v=$,k=G}return g.normalizeZ([v,k])[0]}multiplyAndAddUnsafe(h,w,v){let k=g.BASE,P=(G,D)=>D===$n||D===Jt||!G.equals(k)?G.multiplyUnsafe(D):G.multiply(D),$=P(this,w).add(P(h,v));return $.is0()?void 0:$}toAffine(h){let{px:w,py:v,pz:k}=this,P=this.is0();h==null&&(h=P?e.ONE:e.inv(k));let $=e.mul(w,h),G=e.mul(v,h),D=e.mul(k,h);if(P)return{x:e.ZERO,y:e.ZERO};if(!e.eql(D,e.ONE))throw new Error("invZ was invalid");return{x:$,y:G}}isTorsionFree(){let{h,isTorsionFree:w}=t;if(h===Jt)return!0;if(w)return w(g,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h,clearCofactor:w}=t;return h===Jt?this:w?w(g,this):this.multiplyUnsafe(t.h)}toRawBytes(h=!0){return this.assertValidity(),r(g,this,h)}toHex(h=!0){return Vr(this.toRawBytes(h))}}g.BASE=new g(t.Gx,t.Gy,e.ONE),g.ZERO=new g(e.ZERO,e.ONE,e.ZERO);let T=t.nBitLength,S=gd(g,t.endo?Math.ceil(T/2):T);return{CURVE:t,ProjectivePoint:g,normPrivateKeyToScalar:u,weierstrassEquation:s,isWithinCurveOrder:i}}function dy(n){let t=Gc(n);return mr(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function yd(n){let t=dy(n),{Fp:e,n:r}=t,o=e.BYTES+1,s=2*e.BYTES+1;function i(_){return $n<_&&_<e.ORDER}function c(_){return yt(_,r)}function u(_){return vi(_,r)}let{ProjectivePoint:d,normPrivateKeyToScalar:y,weierstrassEquation:g,isWithinCurveOrder:T}=fy({...t,toBytes(_,U,H){let ne=U.toAffine(),re=e.toBytes(ne.x),be=bo;return H?be(Uint8Array.from([U.hasEvenY()?2:3]),re):be(Uint8Array.from([4]),re,e.toBytes(ne.y))},fromBytes(_){let U=_.length,H=_[0],ne=_.subarray(1);if(U===o&&(H===2||H===3)){let re=Hn(ne);if(!i(re))throw new Error("Point is not on curve");let be=g(re),ze=e.sqrt(be),_e=(ze&Jt)===Jt;return(H&1)===1!==_e&&(ze=e.neg(ze)),{x:re,y:ze}}else if(U===s&&H===4){let re=e.fromBytes(ne.subarray(0,e.BYTES)),be=e.fromBytes(ne.subarray(e.BYTES,2*e.BYTES));return{x:re,y:be}}else throw new Error(`Point of length ${U} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`)}}),S=_=>Vr(gr(_,t.nByteLength));function b(_){let U=r>>Jt;return _>U}function h(_){return b(_)?c(-_):_}let w=(_,U,H)=>Hn(_.slice(U,H));class v{constructor(U,H,ne){this.r=U,this.s=H,this.recovery=ne,this.assertValidity()}static fromCompact(U){let H=t.nByteLength;return U=Kt("compactSignature",U,H*2),new v(w(U,0,H),w(U,H,2*H))}static fromDER(U){let{r:H,s:ne}=Qr.toSig(Kt("DER",U));return new v(H,ne)}assertValidity(){if(!T(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!T(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(U){return new v(this.r,this.s,U)}recoverPublicKey(U){let{r:H,s:ne,recovery:re}=this,be=q(Kt("msgHash",U));if(re==null||![0,1,2,3].includes(re))throw new Error("recovery id invalid");let ze=re===2||re===3?H+t.n:H;if(ze>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let _e=re&1?"03":"02",Le=d.fromHex(_e+S(ze)),se=u(ze),$e=c(-be*se),Rt=c(ne*se),ut=d.BASE.multiplyAndAddUnsafe(Le,$e,Rt);if(!ut)throw new Error("point at infinify");return ut.assertValidity(),ut}hasHighS(){return b(this.s)}normalizeS(){return this.hasHighS()?new v(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return jr(this.toDERHex())}toDERHex(){return Qr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return jr(this.toCompactHex())}toCompactHex(){return S(this.r)+S(this.s)}}let k={isValidPrivateKey(_){try{return y(_),!0}catch{return!1}},normPrivateKeyToScalar:y,randomPrivateKey:()=>{let _=zc(t.n);return pd(t.randomBytes(_),t.n)},precompute(_=8,U=d.BASE){return U._setWindowSize(_),U.multiply(BigInt(3)),U}};function P(_,U=!0){return d.fromPrivateKey(_).toRawBytes(U)}function $(_){let U=pn(_),H=typeof _=="string",ne=(U||H)&&_.length;return U?ne===o||ne===s:H?ne===2*o||ne===2*s:_ instanceof d}function G(_,U,H=!0){if($(_))throw new Error("first arg must be private key");if(!$(U))throw new Error("second arg must be public key");return d.fromHex(U).multiply(y(_)).toRawBytes(H)}let D=t.bits2int||function(_){let U=Hn(_),H=_.length*8-t.nBitLength;return H>0?U>>BigInt(H):U},q=t.bits2int_modN||function(_){return c(D(_))},F=os(t.nBitLength);function Te(_){if(typeof _!="bigint")throw new Error("bigint expected");if(!($n<=_&&_<F))throw new Error(`bigint expected < 2^${t.nBitLength}`);return gr(_,t.nByteLength)}function te(_,U,H=Q){if(["recovered","canonical"].some(ft=>ft in H))throw new Error("sign() legacy options not supported");let{hash:ne,randomBytes:re}=t,{lowS:be,prehash:ze,extraEntropy:_e}=H;be==null&&(be=!0),_=Kt("msgHash",_),ze&&(_=Kt("prehashed msgHash",ne(_)));let Le=q(_),se=y(U),$e=[Te(se),Te(Le)];if(_e!=null){let ft=_e===!0?re(e.BYTES):_e;$e.push(Kt("extraEntropy",ft))}let Rt=bo(...$e),ut=Le;function $t(ft){let xt=D(ft);if(!T(xt))return;let xn=u(xt),We=d.BASE.multiply(xt).toAffine(),St=c(We.x);if(St===$n)return;let on=c(xn*c(ut+St*se));if(on===$n)return;let Ir=(We.x===St?0:2)|Number(We.y&Jt),Xn=on;return be&&b(on)&&(Xn=h(on),Ir^=1),new v(St,Xn,Ir)}return{seed:Rt,k2sig:$t}}let Q={lowS:t.lowS,prehash:!1},Ce={lowS:t.lowS,prehash:!1};function Ie(_,U,H=Q){let{seed:ne,k2sig:re}=te(_,U,H),be=t;return Rc(be.hash.outputLen,be.nByteLength,be.hmac)(ne,re)}d.BASE._setWindowSize(8);function Ye(_,U,H,ne=Ce){let re=_;if(U=Kt("msgHash",U),H=Kt("publicKey",H),"strict"in ne)throw new Error("options.strict was renamed to lowS");let{lowS:be,prehash:ze}=ne,_e,Le;try{if(typeof re=="string"||pn(re))try{_e=v.fromDER(re)}catch(We){if(!(We instanceof Qr.Err))throw We;_e=v.fromCompact(re)}else if(typeof re=="object"&&typeof re.r=="bigint"&&typeof re.s=="bigint"){let{r:We,s:St}=re;_e=new v(We,St)}else throw new Error("PARSE");Le=d.fromHex(H)}catch(We){if(We.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(be&&_e.hasHighS())return!1;ze&&(U=t.hash(U));let{r:se,s:$e}=_e,Rt=q(U),ut=u($e),$t=c(Rt*ut),ft=c(se*ut),xt=d.BASE.multiplyAndAddUnsafe(Le,$t,ft)?.toAffine();return xt?c(xt.x)===se:!1}return{CURVE:t,getPublicKey:P,getSharedSecret:G,sign:Ie,verify:Ye,ProjectivePoint:d,Signature:v,utils:k}}function ly(n){return{hash:n,hmac:(t,...e)=>Tn(n,t,kr(...e)),randomBytes:pf}}function hd(n,t){let e=r=>yd({...n,...ly(r)});return Object.freeze({...e(t),create:e})}var bd=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Ad=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),py=BigInt(1),Lc=BigInt(2),xd=(n,t)=>(n+t/Lc)/t;function gy(n){let t=bd,e=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),u=BigInt(88),d=n*n*n%t,y=d*d*n%t,g=Ft(y,e,t)*y%t,T=Ft(g,e,t)*y%t,S=Ft(T,Lc,t)*d%t,b=Ft(S,o,t)*S%t,h=Ft(b,s,t)*b%t,w=Ft(h,c,t)*h%t,v=Ft(w,u,t)*w%t,k=Ft(v,c,t)*h%t,P=Ft(k,e,t)*y%t,$=Ft(P,i,t)*b%t,G=Ft($,r,t)*d%t,D=Ft(G,Lc,t);if(!qc.eql(qc.sqr(D),n))throw new Error("Cannot find square root");return D}var qc=dd(bd,void 0,void 0,{sqrt:gy}),gn=hd({a:BigInt(0),b:BigInt(7),Fp:qc,n:Ad,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{let t=Ad,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-py*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,i=BigInt("0x100000000000000000000000000000000"),c=xd(s*n,t),u=xd(-r*n,t),d=yt(n-c*e-u*o,t),y=yt(-c*r-u*s,t),g=d>i,T=y>i;if(g&&(d=t-d),T&&(y=t-y),d>i||y>i)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:g,k1:d,k2neg:T,k2:y}}}},Jo),Lb=BigInt(0);var qb=gn.ProjectivePoint;function Ci(n){if(!Number.isSafeInteger(n))throw new Error(`Wrong integer: ${n}`)}function Kc(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}function Td(...n){let t=s=>s,e=(s,i)=>c=>s(i(c)),r=n.map(s=>s.encode).reduceRight(e,t),o=n.map(s=>s.decode).reduce(e,t);return{encode:r,decode:o}}function my(n){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(e=>{if(e<0||e>=n.length)throw new Error(`Digit index outside alphabet: ${e} (alphabet: ${n.length})`);return n[e]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(e=>{if(typeof e!="string")throw new Error(`alphabet.decode: not string element=${e}`);let r=n.indexOf(e);if(r===-1)throw new Error(`Unknown letter: "${e}". Allowed: ${n}`);return r})}}}function yy(n=""){if(typeof n!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let e of t)if(typeof e!="string")throw new Error(`join.encode: non-string input=${e}`);return t.join(n)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(n)}}}function wd(n,t,e){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(e<2)throw new Error(`convertRadix: wrong to=${e}, base cannot be less than 2`);if(!Array.isArray(n))throw new Error("convertRadix: data should be array");if(!n.length)return[];let r=0,o=[],s=Array.from(n);for(s.forEach(i=>{if(i<0||i>=t)throw new Error(`Wrong integer: ${i}`)});;){let i=0,c=!0;for(let u=r;u<s.length;u++){let d=s[u],y=t*i+d;if(!Number.isSafeInteger(y)||t*i/t!==i||y-d!==t*i)throw new Error("convertRadix: carry overflow");i=y%e;let g=Math.floor(y/e);if(s[u]=g,!Number.isSafeInteger(g)||g*e+i!==y)throw new Error("convertRadix: carry overflow");if(c)g?c=!1:r=u;else continue}if(o.push(i),c)break}for(let i=0;i<n.length-1&&n[i]===0;i++)o.push(0);return o.reverse()}function hy(n){return{encode:t=>{if(!Kc(t))throw new Error("radix.encode input should be Uint8Array");return wd(Array.from(t),2**8,n)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(wd(t,n,2**8))}}}function Ay(n,t){if(typeof t!="function")throw new Error("checksum fn should be function");return{encode(e){if(!Kc(e))throw new Error("checksum.encode: input should be Uint8Array");let r=t(e).slice(0,n),o=new Uint8Array(e.length+n);return o.set(e),o.set(r,e.length),o},decode(e){if(!Kc(e))throw new Error("checksum.decode: input should be Uint8Array");let r=e.slice(0,-n),o=t(r).slice(0,n),s=e.slice(-n);for(let i=0;i<n;i++)if(o[i]!==s[i])throw new Error("Invalid checksum");return r}}}var xy=n=>Td(hy(58),my(n),yy("")),by=xy("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var _d=n=>Td(Ay(4,t=>n(n(t))),by);var Ii=gn.ProjectivePoint,Fc=_d(Jo);function Ed(n){return BigInt(`0x${Nr(n)}`)}function wy(n){return mo(n.toString(16).padStart(64,"0"))}var Ty=Za("Bitcoin seed"),Hc={private:76066276,public:76067358},$c=2147483648,_y=n=>od(Jo(n)),Ey=n=>wn(n).getUint32(0,!1),Bi=n=>{if(!Number.isSafeInteger(n)||n<0||n>2**32-1)throw new Error(`Invalid number=${n}. Should be from 0 to 2 ** 32 - 1`);let t=new Uint8Array(4);return wn(t).setUint32(0,n,!1),t},Ui=class n{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return Ey(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){let t=this.privateKey;if(!t)throw new Error("No private key");return Fc.encode(this.serialize(this.versions.private,kr(new Uint8Array([0]),t)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return Fc.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(t,e=Hc){if(un(t),8*t.length<128||8*t.length>512)throw new Error(`HDKey: wrong seed length=${t.length}. Should be between 128 and 512 bits; 256 bits is advised)`);let r=Tn(Lr,Ty,t);return new n({versions:e,chainCode:r.slice(32),privateKey:r.slice(0,32)})}static fromExtendedKey(t,e=Hc){let r=Fc.decode(t),o=wn(r),s=o.getUint32(0,!1),i={versions:e,depth:r[4],parentFingerprint:o.getUint32(5,!1),index:o.getUint32(9,!1),chainCode:r.slice(13,45)},c=r.slice(45),u=c[0]===0;if(s!==e[u?"private":"public"])throw new Error("Version mismatch");return u?new n({...i,privateKey:c.slice(1)}):new n({...i,publicKey:c})}static fromJSON(t){return n.fromExtendedKey(t.xpriv)}constructor(t){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!t||typeof t!="object")throw new Error("HDKey.constructor must not be called directly");if(this.versions=t.versions||Hc,this.depth=t.depth||0,this.chainCode=t.chainCode,this.index=t.index||0,this.parentFingerprint=t.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(t.publicKey&&t.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(t.privateKey){if(!gn.utils.isValidPrivateKey(t.privateKey))throw new Error("Invalid private key");this.privKey=typeof t.privateKey=="bigint"?t.privateKey:Ed(t.privateKey),this.privKeyBytes=wy(this.privKey),this.pubKey=gn.getPublicKey(t.privateKey,!0)}else if(t.publicKey)this.pubKey=Ii.fromHex(t.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=_y(this.pubKey)}derive(t){if(!/^[mM]'?/.test(t))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(t))return this;let e=t.replace(/^[mM]'?\//,"").split("/"),r=this;for(let o of e){let s=/^(\d+)('?)$/.exec(o),i=s&&s[1];if(!s||s.length!==3||typeof i!="string")throw new Error(`Invalid child index: ${o}`);let c=+i;if(!Number.isSafeInteger(c)||c>=$c)throw new Error("Invalid index");s[2]==="'"&&(c+=$c),r=r.deriveChild(c)}return r}deriveChild(t){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let e=Bi(t);if(t>=$c){let c=this.privateKey;if(!c)throw new Error("Could not derive hardened child key");e=kr(new Uint8Array([0]),c,e)}else e=kr(this.pubKey,e);let r=Tn(Lr,this.chainCode,e),o=Ed(r.slice(0,32)),s=r.slice(32);if(!gn.utils.isValidPrivateKey(o))throw new Error("Tweak bigger than curve order");let i={versions:this.versions,chainCode:s,depth:this.depth+1,parentFingerprint:this.fingerprint,index:t};try{if(this.privateKey){let c=yt(this.privKey+o,gn.CURVE.n);if(!gn.utils.isValidPrivateKey(c))throw new Error("The tweak was out of range or the resulted private key is invalid");i.privateKey=c}else{let c=Ii.fromHex(this.pubKey).add(Ii.fromPrivateKey(o));if(c.equals(Ii.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");i.publicKey=c.toRawBytes(!0)}return new n(i)}catch{return this.deriveChild(t+1)}}sign(t){if(!this.privateKey)throw new Error("No privateKey set!");return un(t,32),gn.sign(t,this.privKey).toCompactRawBytes()}verify(t,e){if(un(t,32),un(e,64),!this.publicKey)throw new Error("No publicKey set!");let r;try{r=gn.Signature.fromCompact(e)}catch{return!1}return gn.verify(r,t,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(t,e){if(!this.chainCode)throw new Error("No chainCode set");return un(e,33),kr(Bi(t),new Uint8Array([this.depth]),Bi(this.parentFingerprint),Bi(this.index),this.chainCode,e)}};var yr=class yr extends Gt{constructor(e){super();let r=Pe.fromHexInput(e);if(r.toUint8Array().length!==yr.LENGTH)throw new Error(`PublicKey length should be ${yr.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:r,signature:o}=e,s=Pe.fromHexInput(r).toUint8Array(),i=Mr(s),c=o.toUint8Array();return xo.verify(c,i,this.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new yr(r)}static load(e){let r=e.deserializeBytes();return new yr(r)}static isPublicKey(e){return e instanceof yr}};yr.LENGTH=65;var en=yr,_n=class _n extends Gr{constructor(e){super();let r=Pe.fromHexInput(e);if(r.toUint8Array().length!==_n.LENGTH)throw new Error(`PrivateKey length should be ${_n.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}sign(e){let r=Pe.fromHexInput(e),o=Mr(r.toUint8Array()),s=xo.sign(o,this.key.toUint8Array());return new jn(s.toCompactRawBytes())}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new _n(r)}static generate(){let e=xo.utils.randomPrivateKey();return new _n(e)}publicKey(){let e=xo.getPublicKey(this.key.toUint8Array(),!1);return new en(e)}static fromDerivationPath(e,r){if(!cc(e))throw new Error(`Invalid derivation path ${e}`);return _n.fromDerivationPathInner(e,es(r))}static fromDerivationPathInner(e,r){let{privateKey:o}=Ui.fromMasterSeed(r).derive(e);if(o===null)throw new Error("Invalid key");return new _n(o)}static isPrivateKey(e){return e instanceof _n}};_n.LENGTH=32;var Vn=_n,hr=class hr extends fn{constructor(e){super();let r=Pe.fromHexInput(e);if(r.toUint8Array().length!==hr.LENGTH)throw new Error(`Signature length should be ${hr.LENGTH}, recieved ${r.toUint8Array().length}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new hr(r)}static load(e){let r=e.deserializeBytes();return new hr(r)}static isSignature(e){return e instanceof hr}};hr.LENGTH=64;var jn=hr;var Ze=class n extends Gt{constructor(e){super();this.publicKey=e}toUint8Array(){return this.publicKey.toUint8Array()}toString(){return this.publicKey.toString()}verifySignature(e){let{message:r,signature:o}=e;return this.publicKey.verifySignature({message:r,signature:o})}serialize(e){if(this.publicKey instanceof Fe)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else if(this.publicKey instanceof en)e.serializeU32AsUleb128(1),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(Fe.load(e));case 1:return new n(en.load(e));default:throw new Error(`Unknown variant index for AnyPublicKey: ${r}`)}}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof Fe}isSecp256k1PublicKey(){return this.publicKey instanceof en}};var Yr=class n extends Gt{constructor(e){super();let{publicKeys:r,signaturesRequired:o}=e;if(o<1)throw new Error("The number of required signatures needs to be greater then 0");if(r.length<o)throw new Error(`Provided ${r.length} public keys is smaller than the ${o} required signatures`);let s=[];r.forEach(i=>{i instanceof Ze?s.push(i):s.push(new Ze(i))}),this.publicKeys=s,this.signaturesRequired=o}toUint8Array(){return this.bcsToBytes()}createBitmap(e){let{bits:r}=e,o=128,s=new Uint8Array([0,0,0,0]),i=new Set;return r.forEach((c,u)=>{if(u+1>this.publicKeys.length)throw new Error(`Signature index ${u+1} is out of public keys range, ${this.publicKeys.length}.`);if(i.has(c))throw new Error(`Duplicate bit ${c} detected.`);i.add(c);let d=Math.floor(c/8),y=s[d];y|=o>>c%8,s[d]=y}),s}toString(){return Pe.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("not implemented")}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let r=e.deserializeVector(Ze),o=e.deserializeU8();return new n({publicKeys:r,signaturesRequired:o})}};var Wn=class Wn extends ae{constructor(e){super();let{data:r}=e,o=Pe.fromHexInput(r);if(o.toUint8Array().length!==Wn.LENGTH)throw new Error(`Authentication Key length should be ${Wn.LENGTH}`);this.data=o}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeFixedBytes(Wn.LENGTH);return new Wn({data:r})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromPublicKeyAndScheme(e){let{publicKey:r,scheme:o}=e,s;switch(o){case 3:case 2:{let u=r.bcsToBytes();s=new Uint8Array([...u,o]);break}case 0:case 1:{let u=r.toUint8Array(),d=Pe.fromHexInput(u).toUint8Array();s=new Uint8Array([...d,o]);break}default:throw new Error(`Scheme ${o} is not supported`)}let i=Mr.create();i.update(s);let c=i.digest();return new Wn({data:c})}static fromPublicKey(e){let{publicKey:r}=e,o;if(r instanceof Fe)o=0 .valueOf();else if(r instanceof dn)o=1 .valueOf();else if(r instanceof Ze)o=2 .valueOf();else if(r instanceof Yr)o=3 .valueOf();else throw new Error("No supported authentication scheme for public key");return Wn.fromPublicKeyAndScheme({publicKey:r,scheme:o})}derivedAddress(){return new M(this.data.toUint8Array())}};Wn.LENGTH=32;var mn=Wn;var Qn=class n{constructor(t){let{privateKey:e,address:r,legacy:o}=t,s=o??!0;if(this.publicKey=e.publicKey(),this.publicKey instanceof Fe)s?this.signingScheme=0:(this.publicKey=new Ze(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof dn)this.signingScheme=1;else if(this.publicKey instanceof en)this.publicKey=new Ze(this.publicKey),this.signingScheme=2;else throw new Error("Can not create new Account, unsupported public key type");this.privateKey=e,this.accountAddress=r}static generate(t){let e=t?.legacy??!0,r,o;switch(t?.scheme){case 2:r=Vn.generate(),o=new Ze(r.publicKey());break;default:r=Ln.generate(),e===!1?o=new Ze(r.publicKey()):o=r.publicKey()}let i=mn.fromPublicKey({publicKey:o}).derivedAddress();return new n({privateKey:r,address:i,legacy:t?.legacy})}static fromPrivateKey(t){let{privateKey:e,legacy:r}=t,o=r??!0,s;if(e instanceof Vn)s=new Ze(e.publicKey());else if(e instanceof Ln)o?s=e.publicKey():s=new Ze(e.publicKey());else throw new Error(`Unsupported private key ${e}`);let c=mn.fromPublicKey({publicKey:s}).derivedAddress();return new n({privateKey:e,address:c,legacy:o})}static fromPrivateKeyAndAddress(t){let{privateKey:e,address:r,legacy:o}=t;return new n({privateKey:e,address:r,legacy:o})}static fromDerivationPath(t){let{path:e,mnemonic:r,scheme:o,legacy:s}=t,i;switch(o){case 2:i=Vn.fromDerivationPath(e,r);break;case 0:i=Ln.fromDerivationPath(e,r);break;default:throw new Error(`Unsupported scheme ${o}`)}return n.fromPrivateKey({privateKey:i,legacy:s})}static authKey(t){let{publicKey:e}=t;return mn.fromPublicKey({publicKey:e})}sign(t){return this.privateKey.sign(t)}verifySignature(t){let{message:e,signature:r}=t,o=Pe.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:o,signature:r})}};var Sy=`
1
+ "use strict";var aptosSDK=(()=>{var sg=Object.create;var Vo=Object.defineProperty;var nf=Object.getOwnPropertyDescriptor;var ig=Object.getOwnPropertyNames;var ag=Object.getPrototypeOf,cg=Object.prototype.hasOwnProperty;var rf=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var za=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),Ws=(n,t)=>{for(var e in t)Vo(n,e,{get:t[e],enumerable:!0})},of=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ig(t))!cg.call(n,o)&&o!==e&&Vo(n,o,{get:()=>t[o],enumerable:!(r=nf(t,o))||r.enumerable});return n};var sf=(n,t,e)=>(e=n!=null?sg(ag(n)):{},of(t||!n||!n.__esModule?Vo(e,"default",{value:n,enumerable:!0}):e,n)),ug=n=>of(Vo({},"__esModule",{value:!0}),n),kt=(n,t,e,r)=>{for(var o=r>1?void 0:r?nf(t,e):t,s=n.length-1,i;s>=0;s--)(i=n[s])&&(o=(r?i(t,e,o):i(o))||o);return r&&o&&Vo(t,e,o),o};var wf=za(()=>{"use strict"});var Tf=za((QA,si)=>{"use strict";(function(n){"use strict";var t=function(f){var p,l=new Float64Array(16);if(f)for(p=0;p<f.length;p++)l[p]=f[p];return l},e=function(){throw new Error("no PRNG")},r=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var s=t(),i=t([1]),c=t([56129,1]),u=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),y=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),g=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),T=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function S(f,p,l,a){f[p]=l>>24&255,f[p+1]=l>>16&255,f[p+2]=l>>8&255,f[p+3]=l&255,f[p+4]=a>>24&255,f[p+5]=a>>16&255,f[p+6]=a>>8&255,f[p+7]=a&255}function b(f,p,l,a,m){var x,_=0;for(x=0;x<m;x++)_|=f[p+x]^l[a+x];return(1&_-1>>>8)-1}function h(f,p,l,a){return b(f,p,l,a,16)}function w(f,p,l,a){return b(f,p,l,a,32)}function v(f,p,l,a){for(var m=a[0]&255|(a[1]&255)<<8|(a[2]&255)<<16|(a[3]&255)<<24,x=l[0]&255|(l[1]&255)<<8|(l[2]&255)<<16|(l[3]&255)<<24,_=l[4]&255|(l[5]&255)<<8|(l[6]&255)<<16|(l[7]&255)<<24,O=l[8]&255|(l[9]&255)<<8|(l[10]&255)<<16|(l[11]&255)<<24,K=l[12]&255|(l[13]&255)<<8|(l[14]&255)<<16|(l[15]&255)<<24,ee=a[4]&255|(a[5]&255)<<8|(a[6]&255)<<16|(a[7]&255)<<24,j=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,Re=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,Y=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,ce=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,fe=a[8]&255|(a[9]&255)<<8|(a[10]&255)<<16|(a[11]&255)<<24,me=l[16]&255|(l[17]&255)<<8|(l[18]&255)<<16|(l[19]&255)<<24,ge=l[20]&255|(l[21]&255)<<8|(l[22]&255)<<16|(l[23]&255)<<24,de=l[24]&255|(l[25]&255)<<8|(l[26]&255)<<16|(l[27]&255)<<24,pe=l[28]&255|(l[29]&255)<<8|(l[30]&255)<<16|(l[31]&255)<<24,le=a[12]&255|(a[13]&255)<<8|(a[14]&255)<<16|(a[15]&255)<<24,Z=m,oe=x,W=_,X=O,J=K,V=ee,C=j,I=Re,G=Y,R=ce,N=fe,L=me,ae=ge,ye=de,Ae=pe,he=le,A,_e=0;_e<20;_e+=2)A=Z+ae|0,J^=A<<7|A>>>25,A=J+Z|0,G^=A<<9|A>>>23,A=G+J|0,ae^=A<<13|A>>>19,A=ae+G|0,Z^=A<<18|A>>>14,A=V+oe|0,R^=A<<7|A>>>25,A=R+V|0,ye^=A<<9|A>>>23,A=ye+R|0,oe^=A<<13|A>>>19,A=oe+ye|0,V^=A<<18|A>>>14,A=N+C|0,Ae^=A<<7|A>>>25,A=Ae+N|0,W^=A<<9|A>>>23,A=W+Ae|0,C^=A<<13|A>>>19,A=C+W|0,N^=A<<18|A>>>14,A=he+L|0,X^=A<<7|A>>>25,A=X+he|0,I^=A<<9|A>>>23,A=I+X|0,L^=A<<13|A>>>19,A=L+I|0,he^=A<<18|A>>>14,A=Z+X|0,oe^=A<<7|A>>>25,A=oe+Z|0,W^=A<<9|A>>>23,A=W+oe|0,X^=A<<13|A>>>19,A=X+W|0,Z^=A<<18|A>>>14,A=V+J|0,C^=A<<7|A>>>25,A=C+V|0,I^=A<<9|A>>>23,A=I+C|0,J^=A<<13|A>>>19,A=J+I|0,V^=A<<18|A>>>14,A=N+R|0,L^=A<<7|A>>>25,A=L+N|0,G^=A<<9|A>>>23,A=G+L|0,R^=A<<13|A>>>19,A=R+G|0,N^=A<<18|A>>>14,A=he+Ae|0,ae^=A<<7|A>>>25,A=ae+he|0,ye^=A<<9|A>>>23,A=ye+ae|0,Ae^=A<<13|A>>>19,A=Ae+ye|0,he^=A<<18|A>>>14;Z=Z+m|0,oe=oe+x|0,W=W+_|0,X=X+O|0,J=J+K|0,V=V+ee|0,C=C+j|0,I=I+Re|0,G=G+Y|0,R=R+ce|0,N=N+fe|0,L=L+me|0,ae=ae+ge|0,ye=ye+de|0,Ae=Ae+pe|0,he=he+le|0,f[0]=Z>>>0&255,f[1]=Z>>>8&255,f[2]=Z>>>16&255,f[3]=Z>>>24&255,f[4]=oe>>>0&255,f[5]=oe>>>8&255,f[6]=oe>>>16&255,f[7]=oe>>>24&255,f[8]=W>>>0&255,f[9]=W>>>8&255,f[10]=W>>>16&255,f[11]=W>>>24&255,f[12]=X>>>0&255,f[13]=X>>>8&255,f[14]=X>>>16&255,f[15]=X>>>24&255,f[16]=J>>>0&255,f[17]=J>>>8&255,f[18]=J>>>16&255,f[19]=J>>>24&255,f[20]=V>>>0&255,f[21]=V>>>8&255,f[22]=V>>>16&255,f[23]=V>>>24&255,f[24]=C>>>0&255,f[25]=C>>>8&255,f[26]=C>>>16&255,f[27]=C>>>24&255,f[28]=I>>>0&255,f[29]=I>>>8&255,f[30]=I>>>16&255,f[31]=I>>>24&255,f[32]=G>>>0&255,f[33]=G>>>8&255,f[34]=G>>>16&255,f[35]=G>>>24&255,f[36]=R>>>0&255,f[37]=R>>>8&255,f[38]=R>>>16&255,f[39]=R>>>24&255,f[40]=N>>>0&255,f[41]=N>>>8&255,f[42]=N>>>16&255,f[43]=N>>>24&255,f[44]=L>>>0&255,f[45]=L>>>8&255,f[46]=L>>>16&255,f[47]=L>>>24&255,f[48]=ae>>>0&255,f[49]=ae>>>8&255,f[50]=ae>>>16&255,f[51]=ae>>>24&255,f[52]=ye>>>0&255,f[53]=ye>>>8&255,f[54]=ye>>>16&255,f[55]=ye>>>24&255,f[56]=Ae>>>0&255,f[57]=Ae>>>8&255,f[58]=Ae>>>16&255,f[59]=Ae>>>24&255,f[60]=he>>>0&255,f[61]=he>>>8&255,f[62]=he>>>16&255,f[63]=he>>>24&255}function k(f,p,l,a){for(var m=a[0]&255|(a[1]&255)<<8|(a[2]&255)<<16|(a[3]&255)<<24,x=l[0]&255|(l[1]&255)<<8|(l[2]&255)<<16|(l[3]&255)<<24,_=l[4]&255|(l[5]&255)<<8|(l[6]&255)<<16|(l[7]&255)<<24,O=l[8]&255|(l[9]&255)<<8|(l[10]&255)<<16|(l[11]&255)<<24,K=l[12]&255|(l[13]&255)<<8|(l[14]&255)<<16|(l[15]&255)<<24,ee=a[4]&255|(a[5]&255)<<8|(a[6]&255)<<16|(a[7]&255)<<24,j=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,Re=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,Y=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,ce=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,fe=a[8]&255|(a[9]&255)<<8|(a[10]&255)<<16|(a[11]&255)<<24,me=l[16]&255|(l[17]&255)<<8|(l[18]&255)<<16|(l[19]&255)<<24,ge=l[20]&255|(l[21]&255)<<8|(l[22]&255)<<16|(l[23]&255)<<24,de=l[24]&255|(l[25]&255)<<8|(l[26]&255)<<16|(l[27]&255)<<24,pe=l[28]&255|(l[29]&255)<<8|(l[30]&255)<<16|(l[31]&255)<<24,le=a[12]&255|(a[13]&255)<<8|(a[14]&255)<<16|(a[15]&255)<<24,Z=m,oe=x,W=_,X=O,J=K,V=ee,C=j,I=Re,G=Y,R=ce,N=fe,L=me,ae=ge,ye=de,Ae=pe,he=le,A,_e=0;_e<20;_e+=2)A=Z+ae|0,J^=A<<7|A>>>25,A=J+Z|0,G^=A<<9|A>>>23,A=G+J|0,ae^=A<<13|A>>>19,A=ae+G|0,Z^=A<<18|A>>>14,A=V+oe|0,R^=A<<7|A>>>25,A=R+V|0,ye^=A<<9|A>>>23,A=ye+R|0,oe^=A<<13|A>>>19,A=oe+ye|0,V^=A<<18|A>>>14,A=N+C|0,Ae^=A<<7|A>>>25,A=Ae+N|0,W^=A<<9|A>>>23,A=W+Ae|0,C^=A<<13|A>>>19,A=C+W|0,N^=A<<18|A>>>14,A=he+L|0,X^=A<<7|A>>>25,A=X+he|0,I^=A<<9|A>>>23,A=I+X|0,L^=A<<13|A>>>19,A=L+I|0,he^=A<<18|A>>>14,A=Z+X|0,oe^=A<<7|A>>>25,A=oe+Z|0,W^=A<<9|A>>>23,A=W+oe|0,X^=A<<13|A>>>19,A=X+W|0,Z^=A<<18|A>>>14,A=V+J|0,C^=A<<7|A>>>25,A=C+V|0,I^=A<<9|A>>>23,A=I+C|0,J^=A<<13|A>>>19,A=J+I|0,V^=A<<18|A>>>14,A=N+R|0,L^=A<<7|A>>>25,A=L+N|0,G^=A<<9|A>>>23,A=G+L|0,R^=A<<13|A>>>19,A=R+G|0,N^=A<<18|A>>>14,A=he+Ae|0,ae^=A<<7|A>>>25,A=ae+he|0,ye^=A<<9|A>>>23,A=ye+ae|0,Ae^=A<<13|A>>>19,A=Ae+ye|0,he^=A<<18|A>>>14;f[0]=Z>>>0&255,f[1]=Z>>>8&255,f[2]=Z>>>16&255,f[3]=Z>>>24&255,f[4]=V>>>0&255,f[5]=V>>>8&255,f[6]=V>>>16&255,f[7]=V>>>24&255,f[8]=N>>>0&255,f[9]=N>>>8&255,f[10]=N>>>16&255,f[11]=N>>>24&255,f[12]=he>>>0&255,f[13]=he>>>8&255,f[14]=he>>>16&255,f[15]=he>>>24&255,f[16]=C>>>0&255,f[17]=C>>>8&255,f[18]=C>>>16&255,f[19]=C>>>24&255,f[20]=I>>>0&255,f[21]=I>>>8&255,f[22]=I>>>16&255,f[23]=I>>>24&255,f[24]=G>>>0&255,f[25]=G>>>8&255,f[26]=G>>>16&255,f[27]=G>>>24&255,f[28]=R>>>0&255,f[29]=R>>>8&255,f[30]=R>>>16&255,f[31]=R>>>24&255}function U(f,p,l,a){v(f,p,l,a)}function $(f,p,l,a){k(f,p,l,a)}var M=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function D(f,p,l,a,m,x,_){var O=new Uint8Array(16),K=new Uint8Array(64),ee,j;for(j=0;j<16;j++)O[j]=0;for(j=0;j<8;j++)O[j]=x[j];for(;m>=64;){for(U(K,O,_,M),j=0;j<64;j++)f[p+j]=l[a+j]^K[j];for(ee=1,j=8;j<16;j++)ee=ee+(O[j]&255)|0,O[j]=ee&255,ee>>>=8;m-=64,p+=64,a+=64}if(m>0)for(U(K,O,_,M),j=0;j<m;j++)f[p+j]=l[a+j]^K[j];return 0}function q(f,p,l,a,m){var x=new Uint8Array(16),_=new Uint8Array(64),O,K;for(K=0;K<16;K++)x[K]=0;for(K=0;K<8;K++)x[K]=a[K];for(;l>=64;){for(U(_,x,m,M),K=0;K<64;K++)f[p+K]=_[K];for(O=1,K=8;K<16;K++)O=O+(x[K]&255)|0,x[K]=O&255,O>>>=8;l-=64,p+=64}if(l>0)for(U(_,x,m,M),K=0;K<l;K++)f[p+K]=_[K];return 0}function F(f,p,l,a,m){var x=new Uint8Array(32);$(x,a,m,M);for(var _=new Uint8Array(8),O=0;O<8;O++)_[O]=a[O+16];return q(f,p,l,_,x)}function Te(f,p,l,a,m,x,_){var O=new Uint8Array(32);$(O,x,_,M);for(var K=new Uint8Array(8),ee=0;ee<8;ee++)K[ee]=x[ee+16];return D(f,p,l,a,m,K,O)}var te=function(f){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var p,l,a,m,x,_,O,K;p=f[0]&255|(f[1]&255)<<8,this.r[0]=p&8191,l=f[2]&255|(f[3]&255)<<8,this.r[1]=(p>>>13|l<<3)&8191,a=f[4]&255|(f[5]&255)<<8,this.r[2]=(l>>>10|a<<6)&7939,m=f[6]&255|(f[7]&255)<<8,this.r[3]=(a>>>7|m<<9)&8191,x=f[8]&255|(f[9]&255)<<8,this.r[4]=(m>>>4|x<<12)&255,this.r[5]=x>>>1&8190,_=f[10]&255|(f[11]&255)<<8,this.r[6]=(x>>>14|_<<2)&8191,O=f[12]&255|(f[13]&255)<<8,this.r[7]=(_>>>11|O<<5)&8065,K=f[14]&255|(f[15]&255)<<8,this.r[8]=(O>>>8|K<<8)&8191,this.r[9]=K>>>5&127,this.pad[0]=f[16]&255|(f[17]&255)<<8,this.pad[1]=f[18]&255|(f[19]&255)<<8,this.pad[2]=f[20]&255|(f[21]&255)<<8,this.pad[3]=f[22]&255|(f[23]&255)<<8,this.pad[4]=f[24]&255|(f[25]&255)<<8,this.pad[5]=f[26]&255|(f[27]&255)<<8,this.pad[6]=f[28]&255|(f[29]&255)<<8,this.pad[7]=f[30]&255|(f[31]&255)<<8};te.prototype.blocks=function(f,p,l){for(var a=this.fin?0:2048,m,x,_,O,K,ee,j,Re,Y,ce,fe,me,ge,de,pe,le,Z,oe,W,X=this.h[0],J=this.h[1],V=this.h[2],C=this.h[3],I=this.h[4],G=this.h[5],R=this.h[6],N=this.h[7],L=this.h[8],ae=this.h[9],ye=this.r[0],Ae=this.r[1],he=this.r[2],A=this.r[3],_e=this.r[4],Oe=this.r[5],Ne=this.r[6],we=this.r[7],Be=this.r[8],Pe=this.r[9];l>=16;)m=f[p+0]&255|(f[p+1]&255)<<8,X+=m&8191,x=f[p+2]&255|(f[p+3]&255)<<8,J+=(m>>>13|x<<3)&8191,_=f[p+4]&255|(f[p+5]&255)<<8,V+=(x>>>10|_<<6)&8191,O=f[p+6]&255|(f[p+7]&255)<<8,C+=(_>>>7|O<<9)&8191,K=f[p+8]&255|(f[p+9]&255)<<8,I+=(O>>>4|K<<12)&8191,G+=K>>>1&8191,ee=f[p+10]&255|(f[p+11]&255)<<8,R+=(K>>>14|ee<<2)&8191,j=f[p+12]&255|(f[p+13]&255)<<8,N+=(ee>>>11|j<<5)&8191,Re=f[p+14]&255|(f[p+15]&255)<<8,L+=(j>>>8|Re<<8)&8191,ae+=Re>>>5|a,Y=0,ce=Y,ce+=X*ye,ce+=J*(5*Pe),ce+=V*(5*Be),ce+=C*(5*we),ce+=I*(5*Ne),Y=ce>>>13,ce&=8191,ce+=G*(5*Oe),ce+=R*(5*_e),ce+=N*(5*A),ce+=L*(5*he),ce+=ae*(5*Ae),Y+=ce>>>13,ce&=8191,fe=Y,fe+=X*Ae,fe+=J*ye,fe+=V*(5*Pe),fe+=C*(5*Be),fe+=I*(5*we),Y=fe>>>13,fe&=8191,fe+=G*(5*Ne),fe+=R*(5*Oe),fe+=N*(5*_e),fe+=L*(5*A),fe+=ae*(5*he),Y+=fe>>>13,fe&=8191,me=Y,me+=X*he,me+=J*Ae,me+=V*ye,me+=C*(5*Pe),me+=I*(5*Be),Y=me>>>13,me&=8191,me+=G*(5*we),me+=R*(5*Ne),me+=N*(5*Oe),me+=L*(5*_e),me+=ae*(5*A),Y+=me>>>13,me&=8191,ge=Y,ge+=X*A,ge+=J*he,ge+=V*Ae,ge+=C*ye,ge+=I*(5*Pe),Y=ge>>>13,ge&=8191,ge+=G*(5*Be),ge+=R*(5*we),ge+=N*(5*Ne),ge+=L*(5*Oe),ge+=ae*(5*_e),Y+=ge>>>13,ge&=8191,de=Y,de+=X*_e,de+=J*A,de+=V*he,de+=C*Ae,de+=I*ye,Y=de>>>13,de&=8191,de+=G*(5*Pe),de+=R*(5*Be),de+=N*(5*we),de+=L*(5*Ne),de+=ae*(5*Oe),Y+=de>>>13,de&=8191,pe=Y,pe+=X*Oe,pe+=J*_e,pe+=V*A,pe+=C*he,pe+=I*Ae,Y=pe>>>13,pe&=8191,pe+=G*ye,pe+=R*(5*Pe),pe+=N*(5*Be),pe+=L*(5*we),pe+=ae*(5*Ne),Y+=pe>>>13,pe&=8191,le=Y,le+=X*Ne,le+=J*Oe,le+=V*_e,le+=C*A,le+=I*he,Y=le>>>13,le&=8191,le+=G*Ae,le+=R*ye,le+=N*(5*Pe),le+=L*(5*Be),le+=ae*(5*we),Y+=le>>>13,le&=8191,Z=Y,Z+=X*we,Z+=J*Ne,Z+=V*Oe,Z+=C*_e,Z+=I*A,Y=Z>>>13,Z&=8191,Z+=G*he,Z+=R*Ae,Z+=N*ye,Z+=L*(5*Pe),Z+=ae*(5*Be),Y+=Z>>>13,Z&=8191,oe=Y,oe+=X*Be,oe+=J*we,oe+=V*Ne,oe+=C*Oe,oe+=I*_e,Y=oe>>>13,oe&=8191,oe+=G*A,oe+=R*he,oe+=N*Ae,oe+=L*ye,oe+=ae*(5*Pe),Y+=oe>>>13,oe&=8191,W=Y,W+=X*Pe,W+=J*Be,W+=V*we,W+=C*Ne,W+=I*Oe,Y=W>>>13,W&=8191,W+=G*_e,W+=R*A,W+=N*he,W+=L*Ae,W+=ae*ye,Y+=W>>>13,W&=8191,Y=(Y<<2)+Y|0,Y=Y+ce|0,ce=Y&8191,Y=Y>>>13,fe+=Y,X=ce,J=fe,V=me,C=ge,I=de,G=pe,R=le,N=Z,L=oe,ae=W,p+=16,l-=16;this.h[0]=X,this.h[1]=J,this.h[2]=V,this.h[3]=C,this.h[4]=I,this.h[5]=G,this.h[6]=R,this.h[7]=N,this.h[8]=L,this.h[9]=ae},te.prototype.finish=function(f,p){var l=new Uint16Array(10),a,m,x,_;if(this.leftover){for(_=this.leftover,this.buffer[_++]=1;_<16;_++)this.buffer[_]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(a=this.h[1]>>>13,this.h[1]&=8191,_=2;_<10;_++)this.h[_]+=a,a=this.h[_]>>>13,this.h[_]&=8191;for(this.h[0]+=a*5,a=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=a,a=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=a,l[0]=this.h[0]+5,a=l[0]>>>13,l[0]&=8191,_=1;_<10;_++)l[_]=this.h[_]+a,a=l[_]>>>13,l[_]&=8191;for(l[9]-=8192,m=(a^1)-1,_=0;_<10;_++)l[_]&=m;for(m=~m,_=0;_<10;_++)this.h[_]=this.h[_]&m|l[_];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,x=this.h[0]+this.pad[0],this.h[0]=x&65535,_=1;_<8;_++)x=(this.h[_]+this.pad[_]|0)+(x>>>16)|0,this.h[_]=x&65535;f[p+0]=this.h[0]>>>0&255,f[p+1]=this.h[0]>>>8&255,f[p+2]=this.h[1]>>>0&255,f[p+3]=this.h[1]>>>8&255,f[p+4]=this.h[2]>>>0&255,f[p+5]=this.h[2]>>>8&255,f[p+6]=this.h[3]>>>0&255,f[p+7]=this.h[3]>>>8&255,f[p+8]=this.h[4]>>>0&255,f[p+9]=this.h[4]>>>8&255,f[p+10]=this.h[5]>>>0&255,f[p+11]=this.h[5]>>>8&255,f[p+12]=this.h[6]>>>0&255,f[p+13]=this.h[6]>>>8&255,f[p+14]=this.h[7]>>>0&255,f[p+15]=this.h[7]>>>8&255},te.prototype.update=function(f,p,l){var a,m;if(this.leftover){for(m=16-this.leftover,m>l&&(m=l),a=0;a<m;a++)this.buffer[this.leftover+a]=f[p+a];if(l-=m,p+=m,this.leftover+=m,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(l>=16&&(m=l-l%16,this.blocks(f,p,m),p+=m,l-=m),l){for(a=0;a<l;a++)this.buffer[this.leftover+a]=f[p+a];this.leftover+=l}};function Q(f,p,l,a,m,x){var _=new te(x);return _.update(l,a,m),_.finish(f,p),0}function Ce(f,p,l,a,m,x){var _=new Uint8Array(16);return Q(_,0,l,a,m,x),h(f,p,_,0)}function Ie(f,p,l,a,m){var x;if(l<32)return-1;for(Te(f,0,p,0,l,a,m),Q(f,16,f,32,l-32,f),x=0;x<16;x++)f[x]=0;return 0}function Qe(f,p,l,a,m){var x,_=new Uint8Array(32);if(l<32||(F(_,0,32,a,m),Ce(p,16,p,32,l-32,_)!==0))return-1;for(Te(f,0,p,0,l,a,m),x=0;x<32;x++)f[x]=0;return 0}function E(f,p){var l;for(l=0;l<16;l++)f[l]=p[l]|0}function P(f){var p,l,a=1;for(p=0;p<16;p++)l=f[p]+a+65535,a=Math.floor(l/65536),f[p]=l-a*65536;f[0]+=a-1+37*(a-1)}function H(f,p,l){for(var a,m=~(l-1),x=0;x<16;x++)a=m&(f[x]^p[x]),f[x]^=a,p[x]^=a}function ne(f,p){var l,a,m,x=t(),_=t();for(l=0;l<16;l++)_[l]=p[l];for(P(_),P(_),P(_),a=0;a<2;a++){for(x[0]=_[0]-65517,l=1;l<15;l++)x[l]=_[l]-65535-(x[l-1]>>16&1),x[l-1]&=65535;x[15]=_[15]-32767-(x[14]>>16&1),m=x[15]>>16&1,x[14]&=65535,H(_,x,1-m)}for(l=0;l<16;l++)f[2*l]=_[l]&255,f[2*l+1]=_[l]>>8}function re(f,p){var l=new Uint8Array(32),a=new Uint8Array(32);return ne(l,f),ne(a,p),w(l,0,a,0)}function be(f){var p=new Uint8Array(32);return ne(p,f),p[0]&1}function ze(f,p){var l;for(l=0;l<16;l++)f[l]=p[2*l]+(p[2*l+1]<<8);f[15]&=32767}function Ee(f,p,l){for(var a=0;a<16;a++)f[a]=p[a]+l[a]}function Le(f,p,l){for(var a=0;a<16;a++)f[a]=p[a]-l[a]}function ie(f,p,l){var a,m,x=0,_=0,O=0,K=0,ee=0,j=0,Re=0,Y=0,ce=0,fe=0,me=0,ge=0,de=0,pe=0,le=0,Z=0,oe=0,W=0,X=0,J=0,V=0,C=0,I=0,G=0,R=0,N=0,L=0,ae=0,ye=0,Ae=0,he=0,A=l[0],_e=l[1],Oe=l[2],Ne=l[3],we=l[4],Be=l[5],Pe=l[6],at=l[7],qe=l[8],Ze=l[9],Xe=l[10],Je=l[11],dt=l[12],xt=l[13],bt=l[14],wt=l[15];a=p[0],x+=a*A,_+=a*_e,O+=a*Oe,K+=a*Ne,ee+=a*we,j+=a*Be,Re+=a*Pe,Y+=a*at,ce+=a*qe,fe+=a*Ze,me+=a*Xe,ge+=a*Je,de+=a*dt,pe+=a*xt,le+=a*bt,Z+=a*wt,a=p[1],_+=a*A,O+=a*_e,K+=a*Oe,ee+=a*Ne,j+=a*we,Re+=a*Be,Y+=a*Pe,ce+=a*at,fe+=a*qe,me+=a*Ze,ge+=a*Xe,de+=a*Je,pe+=a*dt,le+=a*xt,Z+=a*bt,oe+=a*wt,a=p[2],O+=a*A,K+=a*_e,ee+=a*Oe,j+=a*Ne,Re+=a*we,Y+=a*Be,ce+=a*Pe,fe+=a*at,me+=a*qe,ge+=a*Ze,de+=a*Xe,pe+=a*Je,le+=a*dt,Z+=a*xt,oe+=a*bt,W+=a*wt,a=p[3],K+=a*A,ee+=a*_e,j+=a*Oe,Re+=a*Ne,Y+=a*we,ce+=a*Be,fe+=a*Pe,me+=a*at,ge+=a*qe,de+=a*Ze,pe+=a*Xe,le+=a*Je,Z+=a*dt,oe+=a*xt,W+=a*bt,X+=a*wt,a=p[4],ee+=a*A,j+=a*_e,Re+=a*Oe,Y+=a*Ne,ce+=a*we,fe+=a*Be,me+=a*Pe,ge+=a*at,de+=a*qe,pe+=a*Ze,le+=a*Xe,Z+=a*Je,oe+=a*dt,W+=a*xt,X+=a*bt,J+=a*wt,a=p[5],j+=a*A,Re+=a*_e,Y+=a*Oe,ce+=a*Ne,fe+=a*we,me+=a*Be,ge+=a*Pe,de+=a*at,pe+=a*qe,le+=a*Ze,Z+=a*Xe,oe+=a*Je,W+=a*dt,X+=a*xt,J+=a*bt,V+=a*wt,a=p[6],Re+=a*A,Y+=a*_e,ce+=a*Oe,fe+=a*Ne,me+=a*we,ge+=a*Be,de+=a*Pe,pe+=a*at,le+=a*qe,Z+=a*Ze,oe+=a*Xe,W+=a*Je,X+=a*dt,J+=a*xt,V+=a*bt,C+=a*wt,a=p[7],Y+=a*A,ce+=a*_e,fe+=a*Oe,me+=a*Ne,ge+=a*we,de+=a*Be,pe+=a*Pe,le+=a*at,Z+=a*qe,oe+=a*Ze,W+=a*Xe,X+=a*Je,J+=a*dt,V+=a*xt,C+=a*bt,I+=a*wt,a=p[8],ce+=a*A,fe+=a*_e,me+=a*Oe,ge+=a*Ne,de+=a*we,pe+=a*Be,le+=a*Pe,Z+=a*at,oe+=a*qe,W+=a*Ze,X+=a*Xe,J+=a*Je,V+=a*dt,C+=a*xt,I+=a*bt,G+=a*wt,a=p[9],fe+=a*A,me+=a*_e,ge+=a*Oe,de+=a*Ne,pe+=a*we,le+=a*Be,Z+=a*Pe,oe+=a*at,W+=a*qe,X+=a*Ze,J+=a*Xe,V+=a*Je,C+=a*dt,I+=a*xt,G+=a*bt,R+=a*wt,a=p[10],me+=a*A,ge+=a*_e,de+=a*Oe,pe+=a*Ne,le+=a*we,Z+=a*Be,oe+=a*Pe,W+=a*at,X+=a*qe,J+=a*Ze,V+=a*Xe,C+=a*Je,I+=a*dt,G+=a*xt,R+=a*bt,N+=a*wt,a=p[11],ge+=a*A,de+=a*_e,pe+=a*Oe,le+=a*Ne,Z+=a*we,oe+=a*Be,W+=a*Pe,X+=a*at,J+=a*qe,V+=a*Ze,C+=a*Xe,I+=a*Je,G+=a*dt,R+=a*xt,N+=a*bt,L+=a*wt,a=p[12],de+=a*A,pe+=a*_e,le+=a*Oe,Z+=a*Ne,oe+=a*we,W+=a*Be,X+=a*Pe,J+=a*at,V+=a*qe,C+=a*Ze,I+=a*Xe,G+=a*Je,R+=a*dt,N+=a*xt,L+=a*bt,ae+=a*wt,a=p[13],pe+=a*A,le+=a*_e,Z+=a*Oe,oe+=a*Ne,W+=a*we,X+=a*Be,J+=a*Pe,V+=a*at,C+=a*qe,I+=a*Ze,G+=a*Xe,R+=a*Je,N+=a*dt,L+=a*xt,ae+=a*bt,ye+=a*wt,a=p[14],le+=a*A,Z+=a*_e,oe+=a*Oe,W+=a*Ne,X+=a*we,J+=a*Be,V+=a*Pe,C+=a*at,I+=a*qe,G+=a*Ze,R+=a*Xe,N+=a*Je,L+=a*dt,ae+=a*xt,ye+=a*bt,Ae+=a*wt,a=p[15],Z+=a*A,oe+=a*_e,W+=a*Oe,X+=a*Ne,J+=a*we,V+=a*Be,C+=a*Pe,I+=a*at,G+=a*qe,R+=a*Ze,N+=a*Xe,L+=a*Je,ae+=a*dt,ye+=a*xt,Ae+=a*bt,he+=a*wt,x+=38*oe,_+=38*W,O+=38*X,K+=38*J,ee+=38*V,j+=38*C,Re+=38*I,Y+=38*G,ce+=38*R,fe+=38*N,me+=38*L,ge+=38*ae,de+=38*ye,pe+=38*Ae,le+=38*he,m=1,a=x+m+65535,m=Math.floor(a/65536),x=a-m*65536,a=_+m+65535,m=Math.floor(a/65536),_=a-m*65536,a=O+m+65535,m=Math.floor(a/65536),O=a-m*65536,a=K+m+65535,m=Math.floor(a/65536),K=a-m*65536,a=ee+m+65535,m=Math.floor(a/65536),ee=a-m*65536,a=j+m+65535,m=Math.floor(a/65536),j=a-m*65536,a=Re+m+65535,m=Math.floor(a/65536),Re=a-m*65536,a=Y+m+65535,m=Math.floor(a/65536),Y=a-m*65536,a=ce+m+65535,m=Math.floor(a/65536),ce=a-m*65536,a=fe+m+65535,m=Math.floor(a/65536),fe=a-m*65536,a=me+m+65535,m=Math.floor(a/65536),me=a-m*65536,a=ge+m+65535,m=Math.floor(a/65536),ge=a-m*65536,a=de+m+65535,m=Math.floor(a/65536),de=a-m*65536,a=pe+m+65535,m=Math.floor(a/65536),pe=a-m*65536,a=le+m+65535,m=Math.floor(a/65536),le=a-m*65536,a=Z+m+65535,m=Math.floor(a/65536),Z=a-m*65536,x+=m-1+37*(m-1),m=1,a=x+m+65535,m=Math.floor(a/65536),x=a-m*65536,a=_+m+65535,m=Math.floor(a/65536),_=a-m*65536,a=O+m+65535,m=Math.floor(a/65536),O=a-m*65536,a=K+m+65535,m=Math.floor(a/65536),K=a-m*65536,a=ee+m+65535,m=Math.floor(a/65536),ee=a-m*65536,a=j+m+65535,m=Math.floor(a/65536),j=a-m*65536,a=Re+m+65535,m=Math.floor(a/65536),Re=a-m*65536,a=Y+m+65535,m=Math.floor(a/65536),Y=a-m*65536,a=ce+m+65535,m=Math.floor(a/65536),ce=a-m*65536,a=fe+m+65535,m=Math.floor(a/65536),fe=a-m*65536,a=me+m+65535,m=Math.floor(a/65536),me=a-m*65536,a=ge+m+65535,m=Math.floor(a/65536),ge=a-m*65536,a=de+m+65535,m=Math.floor(a/65536),de=a-m*65536,a=pe+m+65535,m=Math.floor(a/65536),pe=a-m*65536,a=le+m+65535,m=Math.floor(a/65536),le=a-m*65536,a=Z+m+65535,m=Math.floor(a/65536),Z=a-m*65536,x+=m-1+37*(m-1),f[0]=x,f[1]=_,f[2]=O,f[3]=K,f[4]=ee,f[5]=j,f[6]=Re,f[7]=Y,f[8]=ce,f[9]=fe,f[10]=me,f[11]=ge,f[12]=de,f[13]=pe,f[14]=le,f[15]=Z}function He(f,p){ie(f,p,p)}function Nt(f,p){var l=t(),a;for(a=0;a<16;a++)l[a]=p[a];for(a=253;a>=0;a--)He(l,l),a!==2&&a!==4&&ie(l,l,p);for(a=0;a<16;a++)f[a]=l[a]}function ct(f,p){var l=t(),a;for(a=0;a<16;a++)l[a]=p[a];for(a=250;a>=0;a--)He(l,l),a!==1&&ie(l,l,p);for(a=0;a<16;a++)f[a]=l[a]}function Yt(f,p,l){var a=new Uint8Array(32),m=new Float64Array(80),x,_,O=t(),K=t(),ee=t(),j=t(),Re=t(),Y=t();for(_=0;_<31;_++)a[_]=p[_];for(a[31]=p[31]&127|64,a[0]&=248,ze(m,l),_=0;_<16;_++)K[_]=m[_],j[_]=O[_]=ee[_]=0;for(O[0]=j[0]=1,_=254;_>=0;--_)x=a[_>>>3]>>>(_&7)&1,H(O,K,x),H(ee,j,x),Ee(Re,O,ee),Le(O,O,ee),Ee(ee,K,j),Le(K,K,j),He(j,Re),He(Y,O),ie(O,ee,O),ie(ee,K,Re),Ee(Re,O,ee),Le(O,O,ee),He(K,O),Le(ee,j,Y),ie(O,ee,c),Ee(O,O,j),ie(ee,ee,O),ie(O,j,Y),ie(j,K,m),He(K,Re),H(O,K,x),H(ee,j,x);for(_=0;_<16;_++)m[_+16]=O[_],m[_+32]=ee[_],m[_+48]=K[_],m[_+64]=j[_];var ce=m.subarray(32),fe=m.subarray(16);return Nt(ce,ce),ie(fe,fe,ce),ne(f,fe),0}function ut(f,p){return Yt(f,p,o)}function At(f,p){return e(p,32),ut(f,p)}function wn(f,p,l){var a=new Uint8Array(32);return Yt(a,l,p),$(f,r,a,M)}var je=Ie,St=Qe;function un(f,p,l,a,m,x){var _=new Uint8Array(32);return wn(_,m,x),je(f,p,l,a,_)}function vr(f,p,l,a,m,x){var _=new Uint8Array(32);return wn(_,m,x),St(f,p,l,a,_)}var Zn=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Yu(f,p,l,a){for(var m=new Int32Array(16),x=new Int32Array(16),_,O,K,ee,j,Re,Y,ce,fe,me,ge,de,pe,le,Z,oe,W,X,J,V,C,I,G,R,N,L,ae=f[0],ye=f[1],Ae=f[2],he=f[3],A=f[4],_e=f[5],Oe=f[6],Ne=f[7],we=p[0],Be=p[1],Pe=p[2],at=p[3],qe=p[4],Ze=p[5],Xe=p[6],Je=p[7],dt=0;a>=128;){for(J=0;J<16;J++)V=8*J+dt,m[J]=l[V+0]<<24|l[V+1]<<16|l[V+2]<<8|l[V+3],x[J]=l[V+4]<<24|l[V+5]<<16|l[V+6]<<8|l[V+7];for(J=0;J<80;J++)if(_=ae,O=ye,K=Ae,ee=he,j=A,Re=_e,Y=Oe,ce=Ne,fe=we,me=Be,ge=Pe,de=at,pe=qe,le=Ze,Z=Xe,oe=Je,C=Ne,I=Je,G=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=(A>>>14|qe<<18)^(A>>>18|qe<<14)^(qe>>>9|A<<23),I=(qe>>>14|A<<18)^(qe>>>18|A<<14)^(A>>>9|qe<<23),G+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,C=A&_e^~A&Oe,I=qe&Ze^~qe&Xe,G+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,C=Zn[J*2],I=Zn[J*2+1],G+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,C=m[J%16],I=x[J%16],G+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=G>>>16,N+=R>>>16,L+=N>>>16,W=N&65535|L<<16,X=G&65535|R<<16,C=W,I=X,G=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=(ae>>>28|we<<4)^(we>>>2|ae<<30)^(we>>>7|ae<<25),I=(we>>>28|ae<<4)^(ae>>>2|we<<30)^(ae>>>7|we<<25),G+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,C=ae&ye^ae&Ae^ye&Ae,I=we&Be^we&Pe^Be&Pe,G+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=G>>>16,N+=R>>>16,L+=N>>>16,ce=N&65535|L<<16,oe=G&65535|R<<16,C=ee,I=de,G=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=W,I=X,G+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=G>>>16,N+=R>>>16,L+=N>>>16,ee=N&65535|L<<16,de=G&65535|R<<16,ye=_,Ae=O,he=K,A=ee,_e=j,Oe=Re,Ne=Y,ae=ce,Be=fe,Pe=me,at=ge,qe=de,Ze=pe,Xe=le,Je=Z,we=oe,J%16===15)for(V=0;V<16;V++)C=m[V],I=x[V],G=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=m[(V+9)%16],I=x[(V+9)%16],G+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,W=m[(V+1)%16],X=x[(V+1)%16],C=(W>>>1|X<<31)^(W>>>8|X<<24)^W>>>7,I=(X>>>1|W<<31)^(X>>>8|W<<24)^(X>>>7|W<<25),G+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,W=m[(V+14)%16],X=x[(V+14)%16],C=(W>>>19|X<<13)^(X>>>29|W<<3)^W>>>6,I=(X>>>19|W<<13)^(W>>>29|X<<3)^(X>>>6|W<<26),G+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=G>>>16,N+=R>>>16,L+=N>>>16,m[V]=N&65535|L<<16,x[V]=G&65535|R<<16;C=ae,I=we,G=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=f[0],I=p[0],G+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=G>>>16,N+=R>>>16,L+=N>>>16,f[0]=ae=N&65535|L<<16,p[0]=we=G&65535|R<<16,C=ye,I=Be,G=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=f[1],I=p[1],G+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=G>>>16,N+=R>>>16,L+=N>>>16,f[1]=ye=N&65535|L<<16,p[1]=Be=G&65535|R<<16,C=Ae,I=Pe,G=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=f[2],I=p[2],G+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=G>>>16,N+=R>>>16,L+=N>>>16,f[2]=Ae=N&65535|L<<16,p[2]=Pe=G&65535|R<<16,C=he,I=at,G=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=f[3],I=p[3],G+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=G>>>16,N+=R>>>16,L+=N>>>16,f[3]=he=N&65535|L<<16,p[3]=at=G&65535|R<<16,C=A,I=qe,G=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=f[4],I=p[4],G+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=G>>>16,N+=R>>>16,L+=N>>>16,f[4]=A=N&65535|L<<16,p[4]=qe=G&65535|R<<16,C=_e,I=Ze,G=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=f[5],I=p[5],G+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=G>>>16,N+=R>>>16,L+=N>>>16,f[5]=_e=N&65535|L<<16,p[5]=Ze=G&65535|R<<16,C=Oe,I=Xe,G=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=f[6],I=p[6],G+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=G>>>16,N+=R>>>16,L+=N>>>16,f[6]=Oe=N&65535|L<<16,p[6]=Xe=G&65535|R<<16,C=Ne,I=Je,G=I&65535,R=I>>>16,N=C&65535,L=C>>>16,C=f[7],I=p[7],G+=I&65535,R+=I>>>16,N+=C&65535,L+=C>>>16,R+=G>>>16,N+=R>>>16,L+=N>>>16,f[7]=Ne=N&65535|L<<16,p[7]=Je=G&65535|R<<16,dt+=128,a-=128}return a}function Cr(f,p,l){var a=new Int32Array(8),m=new Int32Array(8),x=new Uint8Array(256),_,O=l;for(a[0]=1779033703,a[1]=3144134277,a[2]=1013904242,a[3]=2773480762,a[4]=1359893119,a[5]=2600822924,a[6]=528734635,a[7]=1541459225,m[0]=4089235720,m[1]=2227873595,m[2]=4271175723,m[3]=1595750129,m[4]=2917565137,m[5]=725511199,m[6]=4215389547,m[7]=327033209,Yu(a,m,p,l),l%=128,_=0;_<l;_++)x[_]=p[O-l+_];for(x[l]=128,l=256-128*(l<112?1:0),x[l-9]=0,S(x,l-8,O/536870912|0,O<<3),Yu(a,m,x,l),_=0;_<8;_++)S(f,8*_,a[_],m[_]);return 0}function Fs(f,p){var l=t(),a=t(),m=t(),x=t(),_=t(),O=t(),K=t(),ee=t(),j=t();Le(l,f[1],f[0]),Le(j,p[1],p[0]),ie(l,l,j),Ee(a,f[0],f[1]),Ee(j,p[0],p[1]),ie(a,a,j),ie(m,f[3],p[3]),ie(m,m,d),ie(x,f[2],p[2]),Ee(x,x,x),Le(_,a,l),Le(O,x,m),Ee(K,x,m),Ee(ee,a,l),ie(f[0],_,O),ie(f[1],ee,K),ie(f[2],K,O),ie(f[3],_,ee)}function Zu(f,p,l){var a;for(a=0;a<4;a++)H(f[a],p[a],l)}function Ca(f,p){var l=t(),a=t(),m=t();Nt(m,p[2]),ie(l,p[0],m),ie(a,p[1],m),ne(f,a),f[31]^=be(l)<<7}function Ia(f,p,l){var a,m;for(E(f[0],s),E(f[1],i),E(f[2],i),E(f[3],s),m=255;m>=0;--m)a=l[m/8|0]>>(m&7)&1,Zu(f,p,a),Fs(p,f),Fs(f,f),Zu(f,p,a)}function Hs(f,p){var l=[t(),t(),t(),t()];E(l[0],y),E(l[1],g),E(l[2],i),ie(l[3],y,g),Ia(f,l,p)}function Ba(f,p,l){var a=new Uint8Array(64),m=[t(),t(),t(),t()],x;for(l||e(p,32),Cr(a,p,32),a[0]&=248,a[31]&=127,a[31]|=64,Hs(m,a),Ca(f,m),x=0;x<32;x++)p[x+32]=f[x];return 0}var $s=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Pa(f,p){var l,a,m,x;for(a=63;a>=32;--a){for(l=0,m=a-32,x=a-12;m<x;++m)p[m]+=l-16*p[a]*$s[m-(a-32)],l=Math.floor((p[m]+128)/256),p[m]-=l*256;p[m]+=l,p[a]=0}for(l=0,m=0;m<32;m++)p[m]+=l-(p[31]>>4)*$s[m],l=p[m]>>8,p[m]&=255;for(m=0;m<32;m++)p[m]-=l*$s[m];for(a=0;a<32;a++)p[a+1]+=p[a]>>8,f[a]=p[a]&255}function Ua(f){var p=new Float64Array(64),l;for(l=0;l<64;l++)p[l]=f[l];for(l=0;l<64;l++)f[l]=0;Pa(f,p)}function Xu(f,p,l,a){var m=new Uint8Array(64),x=new Uint8Array(64),_=new Uint8Array(64),O,K,ee=new Float64Array(64),j=[t(),t(),t(),t()];Cr(m,a,32),m[0]&=248,m[31]&=127,m[31]|=64;var Re=l+64;for(O=0;O<l;O++)f[64+O]=p[O];for(O=0;O<32;O++)f[32+O]=m[32+O];for(Cr(_,f.subarray(32),l+32),Ua(_),Hs(j,_),Ca(f,j),O=32;O<64;O++)f[O]=a[O];for(Cr(x,f,l+64),Ua(x),O=0;O<64;O++)ee[O]=0;for(O=0;O<32;O++)ee[O]=_[O];for(O=0;O<32;O++)for(K=0;K<32;K++)ee[O+K]+=x[O]*m[K];return Pa(f.subarray(32),ee),Re}function tg(f,p){var l=t(),a=t(),m=t(),x=t(),_=t(),O=t(),K=t();return E(f[2],i),ze(f[1],p),He(m,f[1]),ie(x,m,u),Le(m,m,f[2]),Ee(x,f[2],x),He(_,x),He(O,_),ie(K,O,_),ie(l,K,m),ie(l,l,x),ct(l,l),ie(l,l,m),ie(l,l,x),ie(l,l,x),ie(f[0],l,x),He(a,f[0]),ie(a,a,x),re(a,m)&&ie(f[0],f[0],T),He(a,f[0]),ie(a,a,x),re(a,m)?-1:(be(f[0])===p[31]>>7&&Le(f[0],s,f[0]),ie(f[3],f[0],f[1]),0)}function Ra(f,p,l,a){var m,x=new Uint8Array(32),_=new Uint8Array(64),O=[t(),t(),t(),t()],K=[t(),t(),t(),t()];if(l<64||tg(K,a))return-1;for(m=0;m<l;m++)f[m]=p[m];for(m=0;m<32;m++)f[m+32]=a[m];if(Cr(_,f,l),Ua(_),Ia(O,K,_),Hs(K,p.subarray(32)),Fs(O,K),Ca(x,O),l-=64,w(p,0,x,0)){for(m=0;m<l;m++)f[m]=0;return-1}for(m=0;m<l;m++)f[m]=p[m+64];return l}var Oa=32,Vs=24,Ko=32,fo=16,Fo=32,js=32,Ho=32,$o=32,Na=32,Ju=Vs,ng=Ko,rg=fo,kn=64,Ir=32,lo=64,ka=32,Da=64;n.lowlevel={crypto_core_hsalsa20:$,crypto_stream_xor:Te,crypto_stream:F,crypto_stream_salsa20_xor:D,crypto_stream_salsa20:q,crypto_onetimeauth:Q,crypto_onetimeauth_verify:Ce,crypto_verify_16:h,crypto_verify_32:w,crypto_secretbox:Ie,crypto_secretbox_open:Qe,crypto_scalarmult:Yt,crypto_scalarmult_base:ut,crypto_box_beforenm:wn,crypto_box_afternm:je,crypto_box:un,crypto_box_open:vr,crypto_box_keypair:At,crypto_hash:Cr,crypto_sign:Xu,crypto_sign_keypair:Ba,crypto_sign_open:Ra,crypto_secretbox_KEYBYTES:Oa,crypto_secretbox_NONCEBYTES:Vs,crypto_secretbox_ZEROBYTES:Ko,crypto_secretbox_BOXZEROBYTES:fo,crypto_scalarmult_BYTES:Fo,crypto_scalarmult_SCALARBYTES:js,crypto_box_PUBLICKEYBYTES:Ho,crypto_box_SECRETKEYBYTES:$o,crypto_box_BEFORENMBYTES:Na,crypto_box_NONCEBYTES:Ju,crypto_box_ZEROBYTES:ng,crypto_box_BOXZEROBYTES:rg,crypto_sign_BYTES:kn,crypto_sign_PUBLICKEYBYTES:Ir,crypto_sign_SECRETKEYBYTES:lo,crypto_sign_SEEDBYTES:ka,crypto_hash_BYTES:Da,gf:t,D:u,L:$s,pack25519:ne,unpack25519:ze,M:ie,A:Ee,S:He,Z:Le,pow2523:ct,add:Fs,set25519:E,modL:Pa,scalarmult:Ia,scalarbase:Hs};function ef(f,p){if(f.length!==Oa)throw new Error("bad key size");if(p.length!==Vs)throw new Error("bad nonce size")}function og(f,p){if(f.length!==Ho)throw new Error("bad public key size");if(p.length!==$o)throw new Error("bad secret key size")}function Mt(){for(var f=0;f<arguments.length;f++)if(!(arguments[f]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function tf(f){for(var p=0;p<f.length;p++)f[p]=0}n.randomBytes=function(f){var p=new Uint8Array(f);return e(p,f),p},n.secretbox=function(f,p,l){Mt(f,p,l),ef(l,p);for(var a=new Uint8Array(Ko+f.length),m=new Uint8Array(a.length),x=0;x<f.length;x++)a[x+Ko]=f[x];return Ie(m,a,a.length,p,l),m.subarray(fo)},n.secretbox.open=function(f,p,l){Mt(f,p,l),ef(l,p);for(var a=new Uint8Array(fo+f.length),m=new Uint8Array(a.length),x=0;x<f.length;x++)a[x+fo]=f[x];return a.length<32||Qe(m,a,a.length,p,l)!==0?null:m.subarray(Ko)},n.secretbox.keyLength=Oa,n.secretbox.nonceLength=Vs,n.secretbox.overheadLength=fo,n.scalarMult=function(f,p){if(Mt(f,p),f.length!==js)throw new Error("bad n size");if(p.length!==Fo)throw new Error("bad p size");var l=new Uint8Array(Fo);return Yt(l,f,p),l},n.scalarMult.base=function(f){if(Mt(f),f.length!==js)throw new Error("bad n size");var p=new Uint8Array(Fo);return ut(p,f),p},n.scalarMult.scalarLength=js,n.scalarMult.groupElementLength=Fo,n.box=function(f,p,l,a){var m=n.box.before(l,a);return n.secretbox(f,p,m)},n.box.before=function(f,p){Mt(f,p),og(f,p);var l=new Uint8Array(Na);return wn(l,f,p),l},n.box.after=n.secretbox,n.box.open=function(f,p,l,a){var m=n.box.before(l,a);return n.secretbox.open(f,p,m)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var f=new Uint8Array(Ho),p=new Uint8Array($o);return At(f,p),{publicKey:f,secretKey:p}},n.box.keyPair.fromSecretKey=function(f){if(Mt(f),f.length!==$o)throw new Error("bad secret key size");var p=new Uint8Array(Ho);return ut(p,f),{publicKey:p,secretKey:new Uint8Array(f)}},n.box.publicKeyLength=Ho,n.box.secretKeyLength=$o,n.box.sharedKeyLength=Na,n.box.nonceLength=Ju,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(f,p){if(Mt(f,p),p.length!==lo)throw new Error("bad secret key size");var l=new Uint8Array(kn+f.length);return Xu(l,f,f.length,p),l},n.sign.open=function(f,p){if(Mt(f,p),p.length!==Ir)throw new Error("bad public key size");var l=new Uint8Array(f.length),a=Ra(l,f,f.length,p);if(a<0)return null;for(var m=new Uint8Array(a),x=0;x<m.length;x++)m[x]=l[x];return m},n.sign.detached=function(f,p){for(var l=n.sign(f,p),a=new Uint8Array(kn),m=0;m<a.length;m++)a[m]=l[m];return a},n.sign.detached.verify=function(f,p,l){if(Mt(f,p,l),p.length!==kn)throw new Error("bad signature size");if(l.length!==Ir)throw new Error("bad public key size");var a=new Uint8Array(kn+f.length),m=new Uint8Array(kn+f.length),x;for(x=0;x<kn;x++)a[x]=p[x];for(x=0;x<f.length;x++)a[x+kn]=f[x];return Ra(m,a,a.length,l)>=0},n.sign.keyPair=function(){var f=new Uint8Array(Ir),p=new Uint8Array(lo);return Ba(f,p),{publicKey:f,secretKey:p}},n.sign.keyPair.fromSecretKey=function(f){if(Mt(f),f.length!==lo)throw new Error("bad secret key size");for(var p=new Uint8Array(Ir),l=0;l<p.length;l++)p[l]=f[32+l];return{publicKey:p,secretKey:new Uint8Array(f)}},n.sign.keyPair.fromSeed=function(f){if(Mt(f),f.length!==ka)throw new Error("bad seed size");for(var p=new Uint8Array(Ir),l=new Uint8Array(lo),a=0;a<32;a++)l[a]=f[a];return Ba(p,l,!0),{publicKey:p,secretKey:l}},n.sign.publicKeyLength=Ir,n.sign.secretKeyLength=lo,n.sign.seedLength=ka,n.sign.signatureLength=kn,n.hash=function(f){Mt(f);var p=new Uint8Array(Da);return Cr(p,f,f.length),p},n.hash.hashLength=Da,n.verify=function(f,p){return Mt(f,p),f.length===0||p.length===0||f.length!==p.length?!1:b(f,0,p,0,f.length)===0},n.setPRNG=function(f){e=f},function(){var f=typeof self<"u"?self.crypto||self.msCrypto:null;if(f&&f.getRandomValues){var p=65536;n.setPRNG(function(l,a){var m,x=new Uint8Array(a);for(m=0;m<a;m+=p)f.getRandomValues(x.subarray(m,m+Math.min(a-m,p)));for(m=0;m<a;m++)l[m]=x[m];tf(x)})}else typeof rf<"u"&&(f=wf(),f&&f.randomBytes&&n.setPRNG(function(l,a){var m,x=f.randomBytes(a);for(m=0;m<a;m++)l[m]=x[m];tf(x)}))}()})(typeof si<"u"&&si.exports?si.exports:self.nacl=self.nacl||{})});var Jp=za((x6,ju)=>{"use strict";var y0=Object.prototype.hasOwnProperty,Ot="~";function Ms(){}Object.create&&(Ms.prototype=Object.create(null),new Ms().__proto__||(Ot=!1));function h0(n,t,e){this.fn=n,this.context=t,this.once=e||!1}function Xp(n,t,e,r,o){if(typeof e!="function")throw new TypeError("The listener must be a function");var s=new h0(e,r||n,o),i=Ot?Ot+t:t;return n._events[i]?n._events[i].fn?n._events[i]=[n._events[i],s]:n._events[i].push(s):(n._events[i]=s,n._eventsCount++),n}function Ea(n,t){--n._eventsCount===0?n._events=new Ms:delete n._events[t]}function _t(){this._events=new Ms,this._eventsCount=0}_t.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)y0.call(e,r)&&t.push(Ot?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};_t.prototype.listeners=function(t){var e=Ot?Ot+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,s=r.length,i=new Array(s);o<s;o++)i[o]=r[o].fn;return i};_t.prototype.listenerCount=function(t){var e=Ot?Ot+t:t,r=this._events[e];return r?r.fn?1:r.length:0};_t.prototype.emit=function(t,e,r,o,s,i){var c=Ot?Ot+t:t;if(!this._events[c])return!1;var u=this._events[c],d=arguments.length,y,g;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,r),!0;case 4:return u.fn.call(u.context,e,r,o),!0;case 5:return u.fn.call(u.context,e,r,o,s),!0;case 6:return u.fn.call(u.context,e,r,o,s,i),!0}for(g=1,y=new Array(d-1);g<d;g++)y[g-1]=arguments[g];u.fn.apply(u.context,y)}else{var T=u.length,S;for(g=0;g<T;g++)switch(u[g].once&&this.removeListener(t,u[g].fn,void 0,!0),d){case 1:u[g].fn.call(u[g].context);break;case 2:u[g].fn.call(u[g].context,e);break;case 3:u[g].fn.call(u[g].context,e,r);break;case 4:u[g].fn.call(u[g].context,e,r,o);break;default:if(!y)for(S=1,y=new Array(d-1);S<d;S++)y[S-1]=arguments[S];u[g].fn.apply(u[g].context,y)}}return!0};_t.prototype.on=function(t,e,r){return Xp(this,t,e,r,!1)};_t.prototype.once=function(t,e,r){return Xp(this,t,e,r,!0)};_t.prototype.removeListener=function(t,e,r,o){var s=Ot?Ot+t:t;if(!this._events[s])return this;if(!e)return Ea(this,s),this;var i=this._events[s];if(i.fn)i.fn===e&&(!o||i.once)&&(!r||i.context===r)&&Ea(this,s);else{for(var c=0,u=[],d=i.length;c<d;c++)(i[c].fn!==e||o&&!i[c].once||r&&i[c].context!==r)&&u.push(i[c]);u.length?this._events[s]=u.length===1?u[0]:u:Ea(this,s)}return this};_t.prototype.removeAllListeners=function(t){var e;return t?(e=Ot?Ot+t:t,this._events[e]&&Ea(this,e)):(this._events=new Ms,this._eventsCount=0),this};_t.prototype.off=_t.prototype.removeListener;_t.prototype.addListener=_t.prototype.on;_t.prefixed=Ot;_t.EventEmitter=_t;typeof ju<"u"&&(ju.exports=_t)});var A0={};Ws(A0,{APTOS_BIP44_REGEX:()=>Nf,APTOS_COIN:()=>Yo,APTOS_HARDENED_REGEX:()=>Of,Account:()=>Wn,AccountAddress:()=>z,AccountAuthenticator:()=>Dt,AccountAuthenticatorEd25519:()=>An,AccountAuthenticatorMultiEd25519:()=>as,AccountAuthenticatorMultiKey:()=>Qr,AccountAuthenticatorSingleKey:()=>on,AccountAuthenticatorVariant:()=>Ka,AccountPublicKey:()=>gn,AccountSequenceNumber:()=>Ls,AddressInvalidReason:()=>bf,AnyPublicKey:()=>Bt,AnyPublicKeyVariant:()=>Fa,AnySignature:()=>Et,AnySignatureVariant:()=>Ha,Aptos:()=>Qt,AptosApiError:()=>Tn,AptosApiType:()=>Wo,AptosConfig:()=>As,AuthenticationKey:()=>Ct,Bool:()=>et,CKDPriv:()=>lc,ChainId:()=>no,DEFAULT_MAX_GAS_AMOUNT:()=>Va,DEFAULT_TXN_EXP_SEC_FROM_NOW:()=>ja,DEFAULT_TXN_TIMEOUT_SEC:()=>Qo,DeriveScheme:()=>ff,Deserializer:()=>ec,Ed25519Account:()=>Yr,Ed25519PrivateKey:()=>Kt,Ed25519PublicKey:()=>tt,Ed25519Signature:()=>nt,EntryFunction:()=>ao,EntryFunctionBytes:()=>Xo,FeePayerRawTransaction:()=>On,FixedBytes:()=>er,HARDENED_OFFSET:()=>uc,Hex:()=>Ge,HexInvalidReason:()=>Af,Identifier:()=>Ye,KeyType:()=>kf,MimeType:()=>Qs,ModuleId:()=>Uo,MoveAbility:()=>$a,MoveFunctionVisibility:()=>cf,MoveOption:()=>Ln,MoveString:()=>Me,MoveVector:()=>ke,MultiAgentRawTransaction:()=>Rn,MultiEd25519PublicKey:()=>Mr,MultiEd25519Signature:()=>cr,MultiKey:()=>is,MultiKeySignature:()=>Wc,MultiSig:()=>Do,MultiSigTransactionPayload:()=>zo,Network:()=>oa,NetworkToChainId:()=>sa,NetworkToFaucetAPI:()=>ra,NetworkToIndexerAPI:()=>ta,NetworkToNetworkName:()=>Nh,NetworkToNodeAPI:()=>na,ParsingError:()=>vt,ProcessorType:()=>Br,PublicKey:()=>mo,RAW_TRANSACTION_SALT:()=>Wa,RAW_TRANSACTION_WITH_DATA_SALT:()=>Xs,RawTransaction:()=>an,RawTransactionWithData:()=>ws,RoleType:()=>uf,RotationProofChallenge:()=>xs,Script:()=>ko,ScriptTransactionArgumentVariants:()=>po,Secp256k1PrivateKey:()=>mr,Secp256k1PublicKey:()=>vn,Secp256k1Signature:()=>Cn,Serializable:()=>se,Serializer:()=>ln,Signature:()=>qt,SignedTransaction:()=>bn,SigningScheme:()=>Dn,SigningSchemeInput:()=>Zs,SingleKeyAccount:()=>Zr,StructTag:()=>Un,TransactionAuthenticator:()=>Pn,TransactionAuthenticatorEd25519:()=>Xr,TransactionAuthenticatorFeePayer:()=>eo,TransactionAuthenticatorMultiAgent:()=>Jr,TransactionAuthenticatorMultiEd25519:()=>ia,TransactionAuthenticatorSingleSender:()=>to,TransactionAuthenticatorVariant:()=>qa,TransactionPayload:()=>Tr,TransactionPayloadEntryFunction:()=>Oo,TransactionPayloadMultiSig:()=>No,TransactionPayloadScript:()=>Ro,TransactionPayloadVariants:()=>Ma,TransactionResponseType:()=>Ys,TransactionVariants:()=>La,TransactionWorker:()=>qs,TransactionWorkerEventsEnum:()=>Qu,TypeTag:()=>st,TypeTagAddress:()=>zt,TypeTagBool:()=>ht,TypeTagGeneric:()=>it,TypeTagParserError:()=>Ve,TypeTagParserErrorType:()=>Zl,TypeTagReference:()=>bs,TypeTagSigner:()=>wr,TypeTagStruct:()=>ue,TypeTagU128:()=>so,TypeTagU16:()=>ro,TypeTagU256:()=>io,TypeTagU32:()=>oo,TypeTagU64:()=>Rt,TypeTagU8:()=>xn,TypeTagVariants:()=>Ga,TypeTagVector:()=>$e,U128:()=>Jt,U16:()=>Zt,U256:()=>en,U32:()=>Xt,U64:()=>gt,U8:()=>yt,aptosCoinStructTag:()=>kh,aptosRequest:()=>jo,buildTransaction:()=>ha,checkOrConvertArgument:()=>uo,convertArgument:()=>Ou,deriveKey:()=>di,deriveTransactionType:()=>zu,deserializeFromScriptArgument:()=>Wl,ensureBoolean:()=>oi,fetchEntryFunctionAbi:()=>Ru,findFirstNonSignerArg:()=>Bu,generateMultiSignersSignedTransaction:()=>ep,generateRawTransaction:()=>Jl,generateSignedTransaction:()=>Du,generateSignedTransactionForSimulation:()=>Nu,generateSigningMessage:()=>Aa,generateTransactionPayload:()=>vs,generateTransactionPayloadWithABI:()=>Cs,get:()=>Qa,getAptosFullNode:()=>Lt,getAuthenticatorForSimulation:()=>Ss,getFunctionParts:()=>ya,isBcsAddress:()=>_s,isBcsBool:()=>ca,isBcsFixedBytes:()=>Xl,isBcsString:()=>ua,isBcsU128:()=>ga,isBcsU16:()=>da,isBcsU256:()=>ma,isBcsU32:()=>la,isBcsU64:()=>pa,isBcsU8:()=>fa,isBlockMetadataTransactionResponse:()=>pg,isBool:()=>Su,isEd25519Signature:()=>yg,isEncodedEntryFunctionArgument:()=>Cu,isFeePayerSignature:()=>xg,isGenesisTransactionResponse:()=>lg,isLargeNumber:()=>Es,isMultiAgentSignature:()=>Ag,isMultiEd25519Signature:()=>bg,isNull:()=>vu,isNumber:()=>Ts,isPendingTransactionResponse:()=>fg,isScriptDataInput:()=>Iu,isSecp256k1Signature:()=>hg,isStateCheckpointTransactionResponse:()=>gg,isString:()=>co,isUserTransactionResponse:()=>dg,isValidBIP44Path:()=>fc,isValidHardenedPath:()=>dc,isValidatorTransactionResponse:()=>mg,mnemonicToSeed:()=>ts,objectStructTag:()=>Gt,optionStructTag:()=>Dh,outOfRangeErrorMessage:()=>xf,paginateWithCursor:()=>Pr,parseTypeTag:()=>Er,post:()=>Js,postAptosFaucet:()=>Za,postAptosFullNode:()=>Ur,postAptosIndexer:()=>Ya,promiseFulfilledStatus:()=>Wu,request:()=>lf,sign:()=>ku,splitPath:()=>pc,standardizeTypeTags:()=>Uu,stringStructTag:()=>Fe,throwTypeMismatch:()=>We,validateNumberInRange:()=>Mn});var Tn=class extends Error{constructor(e,r,o){super(o);this.name="AptosApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.data=r.data,this.request=e}};var af="1.9.0";var Qs=(r=>(r.JSON="application/json",r.BCS="application/x-bcs",r.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",r))(Qs||{}),Ga=(S=>(S[S.Bool=0]="Bool",S[S.U8=1]="U8",S[S.U64=2]="U64",S[S.U128=3]="U128",S[S.Address=4]="Address",S[S.Signer=5]="Signer",S[S.Vector=6]="Vector",S[S.Struct=7]="Struct",S[S.U16=8]="U16",S[S.U32=9]="U32",S[S.U256=10]="U256",S[S.Reference=254]="Reference",S[S.Generic=255]="Generic",S))(Ga||{}),po=(d=>(d[d.U8=0]="U8",d[d.U64=1]="U64",d[d.U128=2]="U128",d[d.Address=3]="Address",d[d.U8Vector=4]="U8Vector",d[d.Bool=5]="Bool",d[d.U16=6]="U16",d[d.U32=7]="U32",d[d.U256=8]="U256",d))(po||{}),Ma=(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(Ma||{}),La=(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(La||{}),qa=(s=>(s[s.Ed25519=0]="Ed25519",s[s.MultiEd25519=1]="MultiEd25519",s[s.MultiAgent=2]="MultiAgent",s[s.FeePayer=3]="FeePayer",s[s.SingleSender=4]="SingleSender",s))(qa||{}),Ka=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(Ka||{}),Fa=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(Fa||{}),Ha=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(Ha||{}),Ys=(i=>(i.Pending="pending_transaction",i.User="user_transaction",i.Genesis="genesis_transaction",i.BlockMetadata="block_metadata_transaction",i.StateCheckpoint="state_checkpoint_transaction",i.Validator="validator_transaction",i))(Ys||{});function fg(n){return n.type==="pending_transaction"}function dg(n){return n.type==="user_transaction"}function lg(n){return n.type==="genesis_transaction"}function pg(n){return n.type==="block_metadata_transaction"}function gg(n){return n.type==="state_checkpoint_transaction"}function mg(n){return n.type==="validator_transaction"}function yg(n){return"signature"in n&&n.signature==="ed25519_signature"}function hg(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function Ag(n){return n.type==="multi_agent_signature"}function xg(n){return n.type==="fee_payer_signature"}function bg(n){return n.type==="multi_ed25519_signature"}var cf=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(cf||{}),$a=(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))($a||{}),uf=(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(uf||{}),Dn=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(Dn||{}),Zs=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(Zs||{}),ff=(s=>(s[s.DeriveAuid=251]="DeriveAuid",s[s.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",s[s.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",s[s.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",s[s.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",s))(ff||{});var df={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function lf(n,t){let{url:e,method:r,body:o,contentType:s,params:i,overrides:c}=n,u={...c?.HEADERS,"x-aptos-client":`aptos-typescript-sdk/${af}`,"content-type":s??"application/json"};return c?.AUTH_TOKEN&&e.includes("faucet")&&(u.Authorization=`Bearer ${c?.AUTH_TOKEN}`),c?.API_KEY&&!e.includes("faucet")&&(u.Authorization=`Bearer ${c?.API_KEY}`),t.provider({url:e,method:r,body:o,params:i,headers:u,overrides:c})}async function jo(n,t){let{url:e,path:r}=n,o=r?`${e}/${r}`:e,s=await lf({...n,url:o},t.client),i={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(t.isIndexerRequest(e)){let u=i.data;if(u.errors)throw new Tn(n,i,`Indexer error: ${u.errors[0].message}`??`Indexer unhandled Error ${s.status} : ${s.statusText}`);i.data=u.data}if(i.status>=200&&i.status<300)return i;let c;throw i&&i.data&&"message"in i.data&&"error_code"in i.data?c=JSON.stringify(i.data):i.status in df?c=df[i.status]:c=`Unhandled Error ${i.status} : ${i.statusText}`,new Tn(n,i,`${t.isFullnodeRequest(e)?"Fullnode":"Faucet"} error: ${c}`)}var Wo=(r=>(r[r.FULLNODE=0]="FULLNODE",r[r.INDEXER=1]="INDEXER",r[r.FAUCET=2]="FAUCET",r))(Wo||{}),Va=2e5,ja=20,Qo=20,Yo="0x1::aptos_coin::AptosCoin",Wa="APTOS::RawTransaction",Xs="APTOS::RawTransactionWithData",Br=(c=>(c.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",c.DEFAULT="default_processor",c.EVENTS_PROCESSOR="events_processor",c.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",c.STAKE_PROCESSOR="stake_processor",c.TOKEN_V2_PROCESSOR="token_v2_processor",c.USER_TRANSACTION_PROCESSOR="user_transaction_processor",c))(Br||{});async function Qa(n){let{aptosConfig:t,overrides:e,params:r,contentType:o,acceptType:s,path:i,originMethod:c,type:u}=n,d=t.getRequestUrl(u);return jo({url:d,method:"GET",originMethod:c,path:i,contentType:o?.valueOf(),acceptType:s?.valueOf(),params:r,overrides:{...t.clientConfig,...e}},t)}async function Lt(n){return Qa({...n,type:0})}async function Pr(n){let t=[],e,r=n.params;do{let o=await Qa({type:0,aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});e=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),r.start=e}while(e!=null);return t}async function Js(n){let{type:t,originMethod:e,path:r,body:o,acceptType:s,contentType:i,params:c,aptosConfig:u,overrides:d}=n,y=u.getRequestUrl(t);return jo({url:y,method:"POST",originMethod:e,path:r,body:o,contentType:i?.valueOf(),acceptType:s?.valueOf(),params:c,overrides:{...u.clientConfig,...d}},u)}async function Ur(n){return Js({...n,type:0})}async function Ya(n){return Js({...n,type:1})}async function Za(n){return Js({...n,type:2})}var ei=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var gf=n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4));function Xa(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}var En=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),fn=(n,t)=>n<<32-t|n>>>t,wg=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!wg)throw new Error("Non little-endian hardware is not supported");var Tg=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function Rr(n){if(!Xa(n))throw new Error("Uint8Array expected");let t="";for(let e=0;e<n.length;e++)t+=Tg[n[e]];return t}var zn={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function pf(n){if(n>=zn._0&&n<=zn._9)return n-zn._0;if(n>=zn._A&&n<=zn._F)return n-(zn._A-10);if(n>=zn._a&&n<=zn._f)return n-(zn._a-10)}function go(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);let t=n.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(e);for(let o=0,s=0;o<e;o++,s+=2){let i=pf(n.charCodeAt(s)),c=pf(n.charCodeAt(s+1));if(i===void 0||c===void 0){let u=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+s)}r[o]=i*16+c}return r}function Ja(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function dn(n){if(typeof n=="string"&&(n=Ja(n)),!Xa(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}function Or(...n){let t=0;for(let r=0;r<n.length;r++){let o=n[r];if(!Xa(o))throw new Error("Uint8Array expected");t+=o.length}let e=new Uint8Array(t);for(let r=0,o=0;r<n.length;r++){let s=n[r];e.set(s,o),o+=s.length}return e}var Xn=class{clone(){return this._cloneInto()}},Eg={}.toString;function mf(n,t){if(t!==void 0&&Eg.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(n,t)}function Jn(n){let t=r=>n().update(dn(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function yf(n){let t=(r,o)=>n(o).update(dn(r)).digest(),e=n({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>n(r),t}function hf(n=32){if(ei&&typeof ei.getRandomValues=="function")return ei.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}var ti=255,ni=65535,Gn=4294967295,Nr=18446744073709551615n,Zo=340282366920938463463374607431768211455n,ri=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var vt=class extends Error{constructor(e,r){super(e);this.invalidReason=r}};var Af=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(Af||{}),Ge=class n{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return Rr(this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromString(t){let e=t;if(e.startsWith("0x")&&(e=e.slice(2)),e.length===0)throw new vt("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(e.length%2!==0)throw new vt("Hex string must be an even number of hex characters.","invalid_length");try{return new n(go(e))}catch(r){throw new vt(`Hex string contains invalid hex characters: ${r?.message}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new n(t):n.fromString(t)}static isValid(t){try{return n.fromString(t),{valid:!0}}catch(e){return{valid:!1,invalidReason:e?.invalidReason,invalidReasonMessage:e?.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,r)=>e===t.data[r])}};var se=class{bcsToBytes(){let t=new ln;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return Ge.fromHexInput(t)}},ln=class{constructor(t=64){if(t<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(t),this.offset=0}ensureBufferWillHandleSize(t){for(;this.buffer.byteLength<this.offset+t;){let e=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e}}appendToBuffer(t){this.ensureBufferWillHandleSize(t.length),new Uint8Array(this.buffer,this.offset).set(t),this.offset+=t.length}serializeWithFunction(t,e,r){this.ensureBufferWillHandleSize(e);let o=new DataView(this.buffer,this.offset);t.apply(o,[0,r,!0]),this.offset+=e}serializeStr(t){let e=new TextEncoder;this.serializeBytes(e.encode(t))}serializeBytes(t){this.serializeU32AsUleb128(t.length),this.appendToBuffer(t)}serializeFixedBytes(t){this.appendToBuffer(t)}serializeBool(t){oi(t);let e=t?1:0;this.appendToBuffer(new Uint8Array([e]))}serializeU8(t){this.appendToBuffer(new Uint8Array([t]))}serializeU16(t){this.serializeWithFunction(DataView.prototype.setUint16,2,t)}serializeU32(t){this.serializeWithFunction(DataView.prototype.setUint32,4,t)}serializeU64(t){let e=BigInt(t)&BigInt(Gn),r=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(r))}serializeU128(t){let e=BigInt(t)&Nr,r=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(r)}serializeU256(t){let e=BigInt(t)&Zo,r=BigInt(t)>>BigInt(128);this.serializeU128(e),this.serializeU128(r)}serializeU32AsUleb128(t){let e=t,r=[];for(;e>>>7;)r.push(e&127|128),e>>>=7;r.push(e),this.appendToBuffer(new Uint8Array(r))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(t){t.serialize(this)}serializeVector(t){this.serializeU32AsUleb128(t.length),t.forEach(e=>{e.serialize(this)})}};kt([kr(0,ti)],ln.prototype,"serializeU8",1),kt([kr(0,ni)],ln.prototype,"serializeU16",1),kt([kr(0,Gn)],ln.prototype,"serializeU32",1),kt([kr(BigInt(0),Nr)],ln.prototype,"serializeU64",1),kt([kr(BigInt(0),Zo)],ln.prototype,"serializeU128",1),kt([kr(BigInt(0),ri)],ln.prototype,"serializeU256",1),kt([kr(0,Gn)],ln.prototype,"serializeU32AsUleb128",1);function oi(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var xf=(n,t,e)=>`${n} is out of range: [${t}, ${e}]`;function Mn(n,t,e){let r=BigInt(n);if(r>BigInt(e)||r<BigInt(t))throw new Error(xf(n,t,e))}function kr(n,t){return(e,r,o)=>{let s=o.value;return o.value=function(c){return Mn(c,n,t),s.apply(this,[c])},o}}var bf=(c=>(c.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",c.INVALID_HEX_CHARS="invalid_hex_chars",c.TOO_SHORT="too_short",c.TOO_LONG="too_long",c.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",c.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",c.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",c))(bf||{}),Ke=class Ke extends se{constructor(e){super();if(e.length!==Ke.LENGTH)throw new vt("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=e}isSpecial(){return this.data.slice(0,this.data.length-1).every(e=>e===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let e=Rr(this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return Rr(this.data)}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let r=e.deserializeFixedBytes(Ke.LENGTH);return new Ke(r)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new vt("Hex string must start with a leading 0x.","leading_zero_x_required");let r=Ke.fromString(e);if(e.length!==Ke.LONG_STRING_LENGTH+2)if(r.isSpecial()){if(e.length!==3)throw new vt(`The given hex string ${e} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new vt(`The given hex string ${e} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return r}static fromString(e){let r=e;if(e.startsWith("0x")&&(r=e.slice(2)),r.length===0)throw new vt("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(r.length>64)throw new vt("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let o;try{o=go(r.padStart(64,"0"))}catch(s){throw new vt(`Hex characters are invalid: ${s?.message}`,"invalid_hex_chars")}return new Ke(o)}static from(e){return e instanceof Ke?e:e instanceof Uint8Array?new Ke(e):Ke.fromString(e)}static fromStrict(e){return e instanceof Ke?e:e instanceof Uint8Array?new Ke(e):Ke.fromStringStrict(e)}static isValid(e){try{return e.strict?Ke.fromStrict(e.input):Ke.from(e.input),{valid:!0}}catch(r){return{valid:!1,invalidReason:r?.invalidReason,invalidReasonMessage:r?.message}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((r,o)=>r===e.data[o])}};Ke.LENGTH=32,Ke.LONG_STRING_LENGTH=64,Ke.ZERO=Ke.from("0x0"),Ke.ONE=Ke.from("0x1"),Ke.TWO=Ke.from("0x2"),Ke.THREE=Ke.from("0x3"),Ke.FOUR=Ke.from("0x4");var z=Ke;var ec=class{constructor(t){this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t,0),this.offset=0}read(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}deserializeStr(){let t=this.deserializeBytes();return new TextDecoder().decode(t)}deserializeBytes(){let t=this.deserializeUleb128AsU32();return new Uint8Array(this.read(t))}deserializeFixedBytes(t){return new Uint8Array(this.read(t))}deserializeBool(){let t=new Uint8Array(this.read(1))[0];if(t!==1&&t!==0)throw new Error("Invalid boolean value");return t===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let t=this.deserializeU32(),e=this.deserializeU32();return BigInt(BigInt(e)<<BigInt(32)|BigInt(t))}deserializeU128(){let t=this.deserializeU64(),e=this.deserializeU64();return BigInt(e<<BigInt(64)|t)}deserializeU256(){let t=this.deserializeU128(),e=this.deserializeU128();return BigInt(e<<BigInt(128)|t)}deserializeUleb128AsU32(){let t=BigInt(0),e=0;for(;t<Gn;){let r=this.deserializeU8();if(t|=BigInt(r&127)<<BigInt(e),!(r&128))break;e+=7}if(t>Gn)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(t)}deserialize(t){return t.deserialize(this)}deserializeVector(t){let e=this.deserializeUleb128AsU32(),r=new Array;for(let o=0;o<e;o+=1)r.push(this.deserialize(t));return r}};var er=class n extends se{constructor(e){super();this.value=Ge.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,r){let o=e.deserializeFixedBytes(r);return new n(o)}};var Xo=class n extends se{constructor(e){super();this.value=new er(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,r){let o=er.deserialize(e,r);return new n(o.value)}};var et=class n extends se{constructor(e){super();oi(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new n(e.deserializeBool())}},yt=class n extends se{constructor(e){super();Mn(e,0,ti),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new n(e.deserializeU8())}},Zt=class n extends se{constructor(e){super();Mn(e,0,ni),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new n(e.deserializeU16())}},Xt=class n extends se{constructor(e){super();Mn(e,0,Gn),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new n(e.deserializeU32())}},gt=class n extends se{constructor(e){super();Mn(e,BigInt(0),Nr),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new n(e.deserializeU64())}},Jt=class n extends se{constructor(e){super();Mn(e,BigInt(0),Zo),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new n(e.deserializeU128())}},en=class n extends se{constructor(e){super();Mn(e,BigInt(0),ri),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new n(e.deserializeU256())}};var ke=class n extends se{constructor(e){super();this.values=e}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){if(!(this.values[0]instanceof yt)&&this.values[0]!==void 0)throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let r;if(Array.isArray(e)&&typeof e[0]=="number")r=e;else if(typeof e=="string"){let o=Ge.fromHexInput(e);r=Array.from(o.toUint8Array())}else if(e instanceof Uint8Array)r=Array.from(e);else throw new Error("Invalid input type");return new n(r.map(o=>new yt(o)))}static U16(e){return new n(e.map(r=>new Zt(r)))}static U32(e){return new n(e.map(r=>new Xt(r)))}static U64(e){return new n(e.map(r=>new gt(r)))}static U128(e){return new n(e.map(r=>new Jt(r)))}static U256(e){return new n(e.map(r=>new en(r)))}static Bool(e){return new n(e.map(r=>new et(r)))}static MoveString(e){return new n(e.map(r=>new Me(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let o=e.deserializeUleb128AsU32(),s=new Array;for(let i=0;i<o;i+=1)s.push(r.deserialize(e));return new n(s)}},Me=class n extends se{constructor(e){super();this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){let r=this.bcsToBytes().slice(1);ke.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},Ln=class n extends se{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new ke([e]):this.vec=new ke([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new yt(e):void 0)}static U16(e){return new n(e!=null?new Zt(e):void 0)}static U32(e){return new n(e!=null?new Xt(e):void 0)}static U64(e){return new n(e!=null?new gt(e):void 0)}static U128(e){return new n(e!=null?new Jt(e):void 0)}static U256(e){return new n(e!=null?new en(e):void 0)}static Bool(e){return new n(e!=null?new et(e):void 0)}static MoveString(e){return new n(e!=null?new Me(e):void 0)}static deserialize(e,r){let o=ke.deserialize(e,r);return new n(o.values[0])}};var ns=sf(Tf());function qn(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function _g(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}function pn(n,...t){if(!_g(n))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(n.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${n.length}`)}function ii(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");qn(n.outputLen),qn(n.blockLen)}function Kn(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function ai(n,t){pn(n);let e=t.outputLen;if(n.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var ci=BigInt(4294967295),tc=BigInt(32);function Ef(n,t=!1){return t?{h:Number(n&ci),l:Number(n>>tc&ci)}:{h:Number(n>>tc&ci)|0,l:Number(n&ci)|0}}function nc(n,t=!1){let e=new Uint32Array(n.length),r=new Uint32Array(n.length);for(let o=0;o<n.length;o++){let{h:s,l:i}=Ef(n[o],t);[e[o],r[o]]=[s,i]}return[e,r]}var Sg=(n,t)=>BigInt(n>>>0)<<tc|BigInt(t>>>0),vg=(n,t,e)=>n>>>e,Cg=(n,t,e)=>n<<32-e|t>>>e,Ig=(n,t,e)=>n>>>e|t<<32-e,Bg=(n,t,e)=>n<<32-e|t>>>e,Pg=(n,t,e)=>n<<64-e|t>>>e-32,Ug=(n,t,e)=>n>>>e-32|t<<64-e,Rg=(n,t)=>t,Og=(n,t)=>n,rc=(n,t,e)=>n<<e|t>>>32-e,oc=(n,t,e)=>t<<e|n>>>32-e,sc=(n,t,e)=>t<<e-32|n>>>64-e,ic=(n,t,e)=>n<<e-32|t>>>64-e;function Ng(n,t,e,r){let o=(t>>>0)+(r>>>0);return{h:n+e+(o/2**32|0)|0,l:o|0}}var kg=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),Dg=(n,t,e,r)=>t+e+r+(n/2**32|0)|0,zg=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),Gg=(n,t,e,r,o)=>t+e+r+o+(n/2**32|0)|0,Mg=(n,t,e,r,o)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(o>>>0),Lg=(n,t,e,r,o,s)=>t+e+r+o+s+(n/2**32|0)|0;var qg={fromBig:Ef,split:nc,toBig:Sg,shrSH:vg,shrSL:Cg,rotrSH:Ig,rotrSL:Bg,rotrBH:Pg,rotrBL:Ug,rotr32H:Rg,rotr32L:Og,rotlSH:rc,rotlSL:oc,rotlBH:sc,rotlBL:ic,add:Ng,add3L:kg,add3H:Dg,add4L:zg,add4H:Gg,add5H:Lg,add5L:Mg},xe=qg;var[vf,Cf,If]=[[],[],[]],Kg=BigInt(0),Jo=BigInt(1),Fg=BigInt(2),Hg=BigInt(7),$g=BigInt(256),Vg=BigInt(113);for(let n=0,t=Jo,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],vf.push(2*(5*r+e)),Cf.push((n+1)*(n+2)/2%64);let o=Kg;for(let s=0;s<7;s++)t=(t<<Jo^(t>>Hg)*Vg)%$g,t&Fg&&(o^=Jo<<(Jo<<BigInt(s))-Jo);If.push(o)}var[jg,Wg]=nc(If,!0),_f=(n,t,e)=>e>32?sc(n,t,e):rc(n,t,e),Sf=(n,t,e)=>e>32?ic(n,t,e):oc(n,t,e);function Qg(n,t=24){let e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)e[i]=n[i]^n[i+10]^n[i+20]^n[i+30]^n[i+40];for(let i=0;i<10;i+=2){let c=(i+8)%10,u=(i+2)%10,d=e[u],y=e[u+1],g=_f(d,y,1)^e[c],T=Sf(d,y,1)^e[c+1];for(let S=0;S<50;S+=10)n[i+S]^=g,n[i+S+1]^=T}let o=n[2],s=n[3];for(let i=0;i<24;i++){let c=Cf[i],u=_f(o,s,c),d=Sf(o,s,c),y=vf[i];o=n[y],s=n[y+1],n[y]=u,n[y+1]=d}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)e[c]=n[i+c];for(let c=0;c<10;c++)n[i+c]^=~e[(c+2)%10]&e[(c+4)%10]}n[0]^=jg[r],n[1]^=Wg[r]}e.fill(0)}var ui=class n extends Xn{constructor(t,e,r,o=!1,s=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=o,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,qn(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=gf(this.state)}keccak(){Qg(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){Kn(this);let{blockLen:e,state:r}=this;t=dn(t);let o=t.length;for(let s=0;s<o;){let i=Math.min(e-this.pos,o-s);for(let c=0;c<i;c++)r[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:e,pos:r,blockLen:o}=this;t[r]^=e,e&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){Kn(this,!1),pn(t),this.finish();let e=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();let i=Math.min(r-this.posOut,s-o);t.set(e.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return qn(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ai(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:e,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new n(e,r,o,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}},tr=(n,t,e)=>Jn(()=>new ui(t,n,e)),nx=tr(6,144,224/8),Dr=tr(6,136,256/8),rx=tr(6,104,384/8),ox=tr(6,72,512/8),sx=tr(1,144,224/8),ix=tr(1,136,256/8),ax=tr(1,104,384/8),cx=tr(1,72,512/8),Bf=(n,t,e)=>yf((r={})=>new ui(t,n,r.dkLen===void 0?e:r.dkLen,!0)),ux=Bf(31,168,128/8),fx=Bf(31,136,256/8);var nr=class nr extends se{constructor(e){super();let{data:r}=e,o=Ge.fromHexInput(r);if(o.toUint8Array().length!==nr.LENGTH)throw new Error(`Authentication Key length should be ${nr.LENGTH}`);this.data=o}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeFixedBytes(nr.LENGTH);return new nr({data:r})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:r,input:o}=e,s=Ge.fromHexInput(o).toUint8Array(),i=new Uint8Array([...s,r]),c=Dr.create();c.update(i);let u=c.digest();return new nr({data:u})}static fromPublicKeyAndScheme(e){let{publicKey:r}=e;return r.authKey()}static fromPublicKey(e){let{publicKey:r}=e;return r.authKey()}derivedAddress(){return new z(this.data.toUint8Array())}};nr.LENGTH=32;var Ct=nr;var fi=class extends Xn{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,ii(t);let r=dn(e);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;let o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),s.fill(0)}update(t){return Kn(this),this.iHash.update(t),this}digestInto(t){Kn(this),pn(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:e,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},_n=(n,t,e)=>new fi(n,t).update(e).digest();_n.create=(n,t)=>new fi(n,t);function Yg(n,t,e,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(t,e,r);let o=BigInt(32),s=BigInt(4294967295),i=Number(e>>o&s),c=Number(e&s),u=r?4:0,d=r?0:4;n.setUint32(t+u,i,r),n.setUint32(t+d,c,r)}var rr=class extends Xn{constructor(t,e,r,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=En(this.buffer)}update(t){Kn(this);let{view:e,buffer:r,blockLen:o}=this;t=dn(t);let s=t.length;for(let i=0;i<s;){let c=Math.min(o-this.pos,s-i);if(c===o){let u=En(t);for(;o<=s-i;i+=o)this.process(u,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Kn(this),ai(t,this),this.finished=!0;let{buffer:e,view:r,blockLen:o,isLE:s}=this,{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(r,0),i=0);for(let g=i;g<o;g++)e[g]=0;Yg(r,o-8,BigInt(this.length*8),s),this.process(r,0);let c=En(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let d=u/4,y=this.get();if(d>y.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g<d;g++)c.setUint32(4*g,y[g],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.length=o,t.pos=c,t.finished=s,t.destroyed=i,o%e&&t.buffer.set(r),t}};var[Zg,Xg]=xe.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),or=new Uint32Array(80),sr=new Uint32Array(80),ac=class extends rr{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:r,Bl:o,Ch:s,Cl:i,Dh:c,Dl:u,Eh:d,El:y,Fh:g,Fl:T,Gh:S,Gl:b,Hh:h,Hl:w}=this;return[t,e,r,o,s,i,c,u,d,y,g,T,S,b,h,w]}set(t,e,r,o,s,i,c,u,d,y,g,T,S,b,h,w){this.Ah=t|0,this.Al=e|0,this.Bh=r|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=c|0,this.Dl=u|0,this.Eh=d|0,this.El=y|0,this.Fh=g|0,this.Fl=T|0,this.Gh=S|0,this.Gl=b|0,this.Hh=h|0,this.Hl=w|0}process(t,e){for(let U=0;U<16;U++,e+=4)or[U]=t.getUint32(e),sr[U]=t.getUint32(e+=4);for(let U=16;U<80;U++){let $=or[U-15]|0,M=sr[U-15]|0,D=xe.rotrSH($,M,1)^xe.rotrSH($,M,8)^xe.shrSH($,M,7),q=xe.rotrSL($,M,1)^xe.rotrSL($,M,8)^xe.shrSL($,M,7),F=or[U-2]|0,Te=sr[U-2]|0,te=xe.rotrSH(F,Te,19)^xe.rotrBH(F,Te,61)^xe.shrSH(F,Te,6),Q=xe.rotrSL(F,Te,19)^xe.rotrBL(F,Te,61)^xe.shrSL(F,Te,6),Ce=xe.add4L(q,Q,sr[U-7],sr[U-16]),Ie=xe.add4H(Ce,D,te,or[U-7],or[U-16]);or[U]=Ie|0,sr[U]=Ce|0}let{Ah:r,Al:o,Bh:s,Bl:i,Ch:c,Cl:u,Dh:d,Dl:y,Eh:g,El:T,Fh:S,Fl:b,Gh:h,Gl:w,Hh:v,Hl:k}=this;for(let U=0;U<80;U++){let $=xe.rotrSH(g,T,14)^xe.rotrSH(g,T,18)^xe.rotrBH(g,T,41),M=xe.rotrSL(g,T,14)^xe.rotrSL(g,T,18)^xe.rotrBL(g,T,41),D=g&S^~g&h,q=T&b^~T&w,F=xe.add5L(k,M,q,Xg[U],sr[U]),Te=xe.add5H(F,v,$,D,Zg[U],or[U]),te=F|0,Q=xe.rotrSH(r,o,28)^xe.rotrBH(r,o,34)^xe.rotrBH(r,o,39),Ce=xe.rotrSL(r,o,28)^xe.rotrBL(r,o,34)^xe.rotrBL(r,o,39),Ie=r&s^r&c^s&c,Qe=o&i^o&u^i&u;v=h|0,k=w|0,h=S|0,w=b|0,S=g|0,b=T|0,{h:g,l:T}=xe.add(d|0,y|0,Te|0,te|0),d=c|0,y=u|0,c=s|0,u=i|0,s=r|0,i=o|0;let E=xe.add3L(te,Ce,Qe);r=xe.add3H(E,Te,Q,Ie),o=E|0}({h:r,l:o}=xe.add(this.Ah|0,this.Al|0,r|0,o|0)),{h:s,l:i}=xe.add(this.Bh|0,this.Bl|0,s|0,i|0),{h:c,l:u}=xe.add(this.Ch|0,this.Cl|0,c|0,u|0),{h:d,l:y}=xe.add(this.Dh|0,this.Dl|0,d|0,y|0),{h:g,l:T}=xe.add(this.Eh|0,this.El|0,g|0,T|0),{h:S,l:b}=xe.add(this.Fh|0,this.Fl|0,S|0,b|0),{h,l:w}=xe.add(this.Gh|0,this.Gl|0,h|0,w|0),{h:v,l:k}=xe.add(this.Hh|0,this.Hl|0,v|0,k|0),this.set(r,o,s,i,c,u,d,y,g,T,S,b,h,w,v,k)}roundClean(){or.fill(0),sr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var zr=Jn(()=>new ac);function Jg(n,t,e,r){ii(n);let o=mf({dkLen:32,asyncTick:10},r),{c:s,dkLen:i,asyncTick:c}=o;if(qn(s),qn(i),qn(c),s<1)throw new Error("PBKDF2: iterations (c) should be >= 1");let u=dn(t),d=dn(e),y=new Uint8Array(i),g=_n.create(n,u),T=g._cloneInto().update(d);return{c:s,dkLen:i,asyncTick:c,DK:y,PRF:g,PRFSalt:T}}function em(n,t,e,r,o){return n.destroy(),t.destroy(),r&&r.destroy(),o.fill(0),e}function Pf(n,t,e,r){let{c:o,dkLen:s,DK:i,PRF:c,PRFSalt:u}=Jg(n,t,e,r),d,y=new Uint8Array(4),g=En(y),T=new Uint8Array(c.outputLen);for(let S=1,b=0;b<s;S++,b+=c.outputLen){let h=i.subarray(b,b+c.outputLen);g.setInt32(0,S,!1),(d=u._cloneInto(d)).update(y).digestInto(T),h.set(T.subarray(0,h.length));for(let w=1;w<o;w++){c._cloneInto(d).update(T).digestInto(T);for(let v=0;v<h.length;v++)h[v]^=T[v]}}return em(c,u,i,d,T)}var tm=(n,t,e)=>n&t^~n&e,nm=(n,t,e)=>n&t^n&e^t&e,rm=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ir=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ar=new Uint32Array(64),cc=class extends rr{constructor(){super(64,32,8,!1),this.A=ir[0]|0,this.B=ir[1]|0,this.C=ir[2]|0,this.D=ir[3]|0,this.E=ir[4]|0,this.F=ir[5]|0,this.G=ir[6]|0,this.H=ir[7]|0}get(){let{A:t,B:e,C:r,D:o,E:s,F:i,G:c,H:u}=this;return[t,e,r,o,s,i,c,u]}set(t,e,r,o,s,i,c,u){this.A=t|0,this.B=e|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=u|0}process(t,e){for(let g=0;g<16;g++,e+=4)ar[g]=t.getUint32(e,!1);for(let g=16;g<64;g++){let T=ar[g-15],S=ar[g-2],b=fn(T,7)^fn(T,18)^T>>>3,h=fn(S,17)^fn(S,19)^S>>>10;ar[g]=h+ar[g-7]+b+ar[g-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:u,G:d,H:y}=this;for(let g=0;g<64;g++){let T=fn(c,6)^fn(c,11)^fn(c,25),S=y+T+tm(c,u,d)+rm[g]+ar[g]|0,h=(fn(r,2)^fn(r,13)^fn(r,22))+nm(r,o,s)|0;y=d,d=u,u=c,c=i+S|0,i=s,s=o,o=r,r=S+h|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,u=u+this.F|0,d=d+this.G|0,y=y+this.H|0,this.set(r,o,s,i,c,u,d,y)}roundClean(){ar.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var es=Jn(()=>new cc);function Uf(n){if(typeof n!="string")throw new TypeError(`Invalid mnemonic type: ${typeof n}`);return n.normalize("NFKD")}function om(n){let t=Uf(n),e=t.split(" ");if(![12,15,18,21,24].includes(e.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:e}}var sm=n=>Uf(`mnemonic${n}`);function Rf(n,t=""){return Pf(zr,om(n).nfkd,sm(t),{c:2048,dkLen:64})}var Of=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Nf=/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,kf=(t=>(t.ED25519="ed25519 seed",t))(kf||{}),uc=2147483648;function fc(n){return Nf.test(n)}function dc(n){return Of.test(n)}var di=(n,t)=>{let e=_n.create(zr,n).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},lc=({key:n,chainCode:t},e)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,e);let o=new Uint8Array(r),s=new Uint8Array([0]),i=new Uint8Array([...s,...n,...o]);return di(t,i)},am=n=>n.replace("'",""),pc=n=>n.split("/").slice(1).map(am),ts=n=>{let t=n.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return Rf(t)};var mo=class extends se{toString(){let t=this.toUint8Array();return Ge.fromHexInput(t).toString()}},gn=class extends mo{};var qt=class extends se{toString(){let t=this.toUint8Array();return Ge.fromHexInput(t).toString()}};var Gr=class Gr extends gn{constructor(e){super();let r=Ge.fromHexInput(e);if(r.toUint8Array().length!==Gr.LENGTH)throw new Error(`PublicKey length should be ${Gr.LENGTH}`);this.key=r}verifySignature(e){let{message:r,signature:o}=e;if(!(o instanceof nt))return!1;let s=Ge.fromHexInput(r).toUint8Array(),i=o.toUint8Array(),c=this.key.toUint8Array();return ns.default.sign.detached.verify(s,i,c)}authKey(){return Ct.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Gr(r)}static isPublicKey(e){return e instanceof Gr}};Gr.LENGTH=32;var tt=Gr,It=class It extends se{constructor(e){super();let r=Ge.fromHexInput(e);if(r.toUint8Array().length!==It.LENGTH)throw new Error(`PrivateKey length should be ${It.LENGTH}`);this.signingKeyPair=ns.default.sign.keyPair.fromSeed(r.toUint8Array().slice(0,It.LENGTH))}static generate(){let e=ns.default.sign.keyPair();return new It(e.secretKey.slice(0,It.LENGTH))}static fromDerivationPath(e,r){if(!dc(e))throw new Error(`Invalid derivation path ${e}`);return It.fromDerivationPathInner(e,ts(r))}static fromDerivationPathInner(e,r,o=uc){let{key:s,chainCode:i}=di(It.SLIP_0010_SEED,r),c=pc(e).map(d=>parseInt(d,10)),{key:u}=c.reduce((d,y)=>lc(d,y+o),{key:s,chainCode:i});return new It(u)}publicKey(){let e=this.signingKeyPair.publicKey;return new tt(e)}sign(e){let r=Ge.fromHexInput(e).toUint8Array(),o=ns.default.sign.detached(r,this.signingKeyPair.secretKey);return new nt(o)}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,It.LENGTH)}toString(){return Ge.fromHexInput(this.toUint8Array()).toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new It(r)}static isPrivateKey(e){return e instanceof It}};It.LENGTH=32,It.SLIP_0010_SEED="ed25519 seed";var Kt=It,yo=class yo extends qt{constructor(e){super();let r=Ge.fromHexInput(e);if(r.toUint8Array().length!==yo.LENGTH)throw new Error(`Signature length should be ${yo.LENGTH}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new yo(r)}};yo.LENGTH=64;var nt=yo;var tn=class tn extends gn{constructor(e){super();let{publicKeys:r,threshold:o}=e;if(r.length>tn.MAX_KEYS||r.length<tn.MIN_KEYS)throw new Error(`Must have between ${tn.MIN_KEYS} and ${tn.MAX_KEYS} public keys, inclusive`);if(o<tn.MIN_THRESHOLD||o>r.length)throw new Error(`Threshold must be between ${tn.MIN_THRESHOLD} and ${r.length}, inclusive`);this.publicKeys=r,this.threshold=o}verifySignature(e){let{message:r,signature:o}=e;if(!(o instanceof cr))return!1;let s=[];for(let i=0;i<4;i+=1)for(let c=0;c<8;c+=1)if((o.bitmap[i]&1<<7-c)!==0){let d=i*8+c;s.push(d)}if(s.length!==o.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(s.length<this.threshold)throw new Error("Not enough signatures");for(let i=0;i<s.length;i+=1)if(!this.publicKeys[s[i]].verifySignature({message:r,signature:o.signatures[i]}))return!1;return!0}authKey(){return Ct.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*tt.LENGTH+1);return this.publicKeys.forEach((r,o)=>{e.set(r.toUint8Array(),o*tt.LENGTH)}),e[this.publicKeys.length*tt.LENGTH]=this.threshold,e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),o=r[r.length-1],s=[];for(let i=0;i<r.length-1;i+=tt.LENGTH){let c=i;s.push(new tt(r.subarray(c,c+tt.LENGTH)))}return new tn({publicKeys:s,threshold:o})}};tn.MAX_KEYS=32,tn.MIN_KEYS=2,tn.MIN_THRESHOLD=1;var Mr=tn,Ft=class Ft extends qt{constructor(e){super();let{signatures:r,bitmap:o}=e;if(r.length>Ft.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${Ft.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=r,!(o instanceof Uint8Array))this.bitmap=Ft.createBitmap({bits:o});else{if(o.length!==Ft.BITMAP_LEN)throw new Error(`"bitmap" length should be ${Ft.BITMAP_LEN}`);this.bitmap=o}}toUint8Array(){let e=new Uint8Array(this.signatures.length*nt.LENGTH+Ft.BITMAP_LEN);return this.signatures.forEach((r,o)=>{e.set(r.toUint8Array(),o*nt.LENGTH)}),e.set(this.bitmap,this.signatures.length*nt.LENGTH),e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),o=r.subarray(r.length-4),s=[];for(let i=0;i<r.length-o.length;i+=nt.LENGTH){let c=i;s.push(new nt(r.subarray(c,c+nt.LENGTH)))}return new Ft({signatures:s,bitmap:o})}static createBitmap(e){let{bits:r}=e,o=128,s=new Uint8Array([0,0,0,0]),i=new Set;return r.forEach((c,u)=>{if(c>=Ft.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${Ft.MAX_SIGNATURES_SUPPORTED-1}.`);if(i.has(c))throw new Error("Duplicate bits detected.");if(u>0&&c<=r[u-1])throw new Error("The bits need to be sorted in ascending order.");i.add(c);let d=Math.floor(c/8),y=s[d];y|=o>>c%8,s[d]=y}),s}};Ft.MAX_SIGNATURES_SUPPORTED=32,Ft.BITMAP_LEN=4;var cr=Ft;function Df(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function gc(n,...t){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(n.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${n.length}`)}function zf(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Df(n.outputLen),Df(n.blockLen)}function ho(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function Gf(n,t){gc(n);let e=t.outputLen;if(n.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var li=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var Mf=n=>n instanceof Uint8Array;var pi=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),mn=(n,t)=>n<<32-t|n>>>t,cm=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!cm)throw new Error("Non little-endian hardware is not supported");function um(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function rs(n){if(typeof n=="string"&&(n=um(n)),!Mf(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}function Lf(...n){let t=new Uint8Array(n.reduce((r,o)=>r+o.length,0)),e=0;return n.forEach(r=>{if(!Mf(r))throw new Error("Uint8Array expected");t.set(r,e),e+=r.length}),t}var Ao=class{clone(){return this._cloneInto()}},mb={}.toString;function qf(n){let t=r=>n().update(rs(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function Kf(n=32){if(li&&typeof li.getRandomValues=="function")return li.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}function fm(n,t,e,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(t,e,r);let o=BigInt(32),s=BigInt(4294967295),i=Number(e>>o&s),c=Number(e&s),u=r?4:0,d=r?0:4;n.setUint32(t+u,i,r),n.setUint32(t+d,c,r)}var gi=class extends Ao{constructor(t,e,r,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=pi(this.buffer)}update(t){ho(this);let{view:e,buffer:r,blockLen:o}=this;t=rs(t);let s=t.length;for(let i=0;i<s;){let c=Math.min(o-this.pos,s-i);if(c===o){let u=pi(t);for(;o<=s-i;i+=o)this.process(u,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){ho(this),Gf(t,this),this.finished=!0;let{buffer:e,view:r,blockLen:o,isLE:s}=this,{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(r,0),i=0);for(let g=i;g<o;g++)e[g]=0;fm(r,o-8,BigInt(this.length*8),s),this.process(r,0);let c=pi(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let d=u/4,y=this.get();if(d>y.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g<d;g++)c.setUint32(4*g,y[g],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.length=o,t.pos=c,t.finished=s,t.destroyed=i,o%e&&t.buffer.set(r),t}};var dm=(n,t,e)=>n&t^~n&e,lm=(n,t,e)=>n&t^n&e^t&e,pm=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ur=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),fr=new Uint32Array(64),mc=class extends gi{constructor(){super(64,32,8,!1),this.A=ur[0]|0,this.B=ur[1]|0,this.C=ur[2]|0,this.D=ur[3]|0,this.E=ur[4]|0,this.F=ur[5]|0,this.G=ur[6]|0,this.H=ur[7]|0}get(){let{A:t,B:e,C:r,D:o,E:s,F:i,G:c,H:u}=this;return[t,e,r,o,s,i,c,u]}set(t,e,r,o,s,i,c,u){this.A=t|0,this.B=e|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=u|0}process(t,e){for(let g=0;g<16;g++,e+=4)fr[g]=t.getUint32(e,!1);for(let g=16;g<64;g++){let T=fr[g-15],S=fr[g-2],b=mn(T,7)^mn(T,18)^T>>>3,h=mn(S,17)^mn(S,19)^S>>>10;fr[g]=h+fr[g-7]+b+fr[g-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:u,G:d,H:y}=this;for(let g=0;g<64;g++){let T=mn(c,6)^mn(c,11)^mn(c,25),S=y+T+dm(c,u,d)+pm[g]+fr[g]|0,h=(mn(r,2)^mn(r,13)^mn(r,22))+lm(r,o,s)|0;y=d,d=u,u=c,c=i+S|0,i=s,s=o,o=r,r=S+h|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,u=u+this.F|0,d=d+this.G|0,y=y+this.H|0,this.set(r,o,s,i,c,u,d,y)}roundClean(){fr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Ff=qf(()=>new mc);var xc={};Ws(xc,{bitGet:()=>bm,bitLen:()=>xm,bitMask:()=>os,bitSet:()=>wm,bytesToHex:()=>Lr,bytesToNumberBE:()=>Fn,bytesToNumberLE:()=>hi,concatBytes:()=>xo,createHmacDrbg:()=>Ac,ensureBytes:()=>Ht,equalBytes:()=>hm,hexToBytes:()=>qr,hexToNumber:()=>hc,numberToBytesBE:()=>dr,numberToBytesLE:()=>Ai,numberToHexUnpadded:()=>Vf,numberToVarBytesBE:()=>ym,utf8ToBytes:()=>Am,validateObject:()=>lr});var $f=BigInt(0),mi=BigInt(1),gm=BigInt(2),yi=n=>n instanceof Uint8Array,mm=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function Lr(n){if(!yi(n))throw new Error("Uint8Array expected");let t="";for(let e=0;e<n.length;e++)t+=mm[n[e]];return t}function Vf(n){let t=n.toString(16);return t.length&1?`0${t}`:t}function hc(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return BigInt(n===""?"0":`0x${n}`)}function qr(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);let t=n.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let e=new Uint8Array(t/2);for(let r=0;r<e.length;r++){let o=r*2,s=n.slice(o,o+2),i=Number.parseInt(s,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");e[r]=i}return e}function Fn(n){return hc(Lr(n))}function hi(n){if(!yi(n))throw new Error("Uint8Array expected");return hc(Lr(Uint8Array.from(n).reverse()))}function dr(n,t){return qr(n.toString(16).padStart(t*2,"0"))}function Ai(n,t){return dr(n,t).reverse()}function ym(n){return qr(Vf(n))}function Ht(n,t,e){let r;if(typeof t=="string")try{r=qr(t)}catch(s){throw new Error(`${n} must be valid hex string, got "${t}". Cause: ${s}`)}else if(yi(t))r=Uint8Array.from(t);else throw new Error(`${n} must be hex string or Uint8Array`);let o=r.length;if(typeof e=="number"&&o!==e)throw new Error(`${n} expected ${e} bytes, got ${o}`);return r}function xo(...n){let t=new Uint8Array(n.reduce((r,o)=>r+o.length,0)),e=0;return n.forEach(r=>{if(!yi(r))throw new Error("Uint8Array expected");t.set(r,e),e+=r.length}),t}function hm(n,t){if(n.length!==t.length)return!1;for(let e=0;e<n.length;e++)if(n[e]!==t[e])return!1;return!0}function Am(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function xm(n){let t;for(t=0;n>$f;n>>=mi,t+=1);return t}function bm(n,t){return n>>BigInt(t)&mi}var wm=(n,t,e)=>n|(e?mi:$f)<<BigInt(t),os=n=>(gm<<BigInt(n-1))-mi,yc=n=>new Uint8Array(n),Hf=n=>Uint8Array.from(n);function Ac(n,t,e){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let r=yc(n),o=yc(n),s=0,i=()=>{r.fill(1),o.fill(0),s=0},c=(...g)=>e(o,r,...g),u=(g=yc())=>{o=c(Hf([0]),g),r=c(),g.length!==0&&(o=c(Hf([1]),g),r=c())},d=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let g=0,T=[];for(;g<t;){r=c();let S=r.slice();T.push(S),g+=r.length}return xo(...T)};return(g,T)=>{i(),u(g);let S;for(;!(S=T(d()));)u();return i(),S}}var Tm={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||n instanceof Uint8Array,isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,t)=>t.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function lr(n,t,e={}){let r=(o,s,i)=>{let c=Tm[s];if(typeof c!="function")throw new Error(`Invalid validator "${s}", expected function`);let u=n[o];if(!(i&&u===void 0)&&!c(u,n))throw new Error(`Invalid param ${String(o)}=${u} (${typeof u}), expected ${s}`)};for(let[o,s]of Object.entries(t))r(o,s,!1);for(let[o,s]of Object.entries(e))r(o,s,!0);return n}var lt=BigInt(0),rt=BigInt(1),Kr=BigInt(2),Em=BigInt(3),bc=BigInt(4),jf=BigInt(5),Wf=BigInt(8),_m=BigInt(9),Sm=BigInt(16);function Tt(n,t){let e=n%t;return e>=lt?e:t+e}function vm(n,t,e){if(e<=lt||t<lt)throw new Error("Expected power/modulo > 0");if(e===rt)return lt;let r=rt;for(;t>lt;)t&rt&&(r=r*n%e),n=n*n%e,t>>=rt;return r}function $t(n,t,e){let r=n;for(;t-- >lt;)r*=r,r%=e;return r}function xi(n,t){if(n===lt||t<=lt)throw new Error(`invert: expected positive integers, got n=${n} mod=${t}`);let e=Tt(n,t),r=t,o=lt,s=rt,i=rt,c=lt;for(;e!==lt;){let d=r/e,y=r%e,g=o-i*d,T=s-c*d;r=e,e=y,o=i,s=c,i=g,c=T}if(r!==rt)throw new Error("invert: does not exist");return Tt(o,t)}function Cm(n){let t=(n-rt)/Kr,e,r,o;for(e=n-rt,r=0;e%Kr===lt;e/=Kr,r++);for(o=Kr;o<n&&vm(o,t,n)!==n-rt;o++);if(r===1){let i=(n+rt)/bc;return function(u,d){let y=u.pow(d,i);if(!u.eql(u.sqr(y),d))throw new Error("Cannot find square root");return y}}let s=(e+rt)/Kr;return function(c,u){if(c.pow(u,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let d=r,y=c.pow(c.mul(c.ONE,o),e),g=c.pow(u,s),T=c.pow(u,e);for(;!c.eql(T,c.ONE);){if(c.eql(T,c.ZERO))return c.ZERO;let S=1;for(let h=c.sqr(T);S<d&&!c.eql(h,c.ONE);S++)h=c.sqr(h);let b=c.pow(y,rt<<BigInt(d-S-1));y=c.sqr(b),g=c.mul(g,b),T=c.mul(T,y),d=S}return g}}function Im(n){if(n%bc===Em){let t=(n+rt)/bc;return function(r,o){let s=r.pow(o,t);if(!r.eql(r.sqr(s),o))throw new Error("Cannot find square root");return s}}if(n%Wf===jf){let t=(n-jf)/Wf;return function(r,o){let s=r.mul(o,Kr),i=r.pow(s,t),c=r.mul(o,i),u=r.mul(r.mul(c,Kr),i),d=r.mul(c,r.sub(u,r.ONE));if(!r.eql(r.sqr(d),o))throw new Error("Cannot find square root");return d}}return n%Sm,Cm(n)}var Bm=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function wc(n){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=Bm.reduce((r,o)=>(r[o]="function",r),t);return lr(n,e)}function Pm(n,t,e){if(e<lt)throw new Error("Expected power > 0");if(e===lt)return n.ONE;if(e===rt)return t;let r=n.ONE,o=t;for(;e>lt;)e&rt&&(r=n.mul(r,o)),o=n.sqr(o),e>>=rt;return r}function Um(n,t){let e=new Array(t.length),r=t.reduce((s,i,c)=>n.is0(i)?s:(e[c]=s,n.mul(s,i)),n.ONE),o=n.inv(r);return t.reduceRight((s,i,c)=>n.is0(i)?s:(e[c]=n.mul(s,e[c]),n.mul(s,i)),o),e}function Tc(n,t){let e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function Qf(n,t,e=!1,r={}){if(n<=lt)throw new Error(`Expected Field ORDER > 0, got ${n}`);let{nBitLength:o,nByteLength:s}=Tc(n,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let i=Im(n),c=Object.freeze({ORDER:n,BITS:o,BYTES:s,MASK:os(o),ZERO:lt,ONE:rt,create:u=>Tt(u,n),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return lt<=u&&u<n},is0:u=>u===lt,isOdd:u=>(u&rt)===rt,neg:u=>Tt(-u,n),eql:(u,d)=>u===d,sqr:u=>Tt(u*u,n),add:(u,d)=>Tt(u+d,n),sub:(u,d)=>Tt(u-d,n),mul:(u,d)=>Tt(u*d,n),pow:(u,d)=>Pm(c,u,d),div:(u,d)=>Tt(u*xi(d,n),n),sqrN:u=>u*u,addN:(u,d)=>u+d,subN:(u,d)=>u-d,mulN:(u,d)=>u*d,inv:u=>xi(u,n),sqrt:r.sqrt||(u=>i(c,u)),invertBatch:u=>Um(c,u),cmov:(u,d,y)=>y?d:u,toBytes:u=>e?Ai(u,s):dr(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return e?hi(u):Fn(u)}});return Object.freeze(c)}function Yf(n){if(typeof n!="bigint")throw new Error("field order must be bigint");let t=n.toString(2).length;return Math.ceil(t/8)}function Ec(n){let t=Yf(n);return t+Math.ceil(t/2)}function Zf(n,t,e=!1){let r=n.length,o=Yf(t),s=Ec(t);if(r<16||r<s||r>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);let i=e?Fn(n):hi(n),c=Tt(i,t-rt)+rt;return e?Ai(c,o):dr(c,o)}var Om=BigInt(0),_c=BigInt(1);function Xf(n,t){let e=(o,s)=>{let i=s.negate();return o?i:s},r=o=>{let s=Math.ceil(t/o)+1,i=2**(o-1);return{windows:s,windowSize:i}};return{constTimeNegate:e,unsafeLadder(o,s){let i=n.ZERO,c=o;for(;s>Om;)s&_c&&(i=i.add(c)),c=c.double(),s>>=_c;return i},precomputeWindow(o,s){let{windows:i,windowSize:c}=r(s),u=[],d=o,y=d;for(let g=0;g<i;g++){y=d,u.push(y);for(let T=1;T<c;T++)y=y.add(d),u.push(y);d=y.double()}return u},wNAF(o,s,i){let{windows:c,windowSize:u}=r(o),d=n.ZERO,y=n.BASE,g=BigInt(2**o-1),T=2**o,S=BigInt(o);for(let b=0;b<c;b++){let h=b*u,w=Number(i&g);i>>=S,w>u&&(w-=T,i+=_c);let v=h,k=h+Math.abs(w)-1,U=b%2!==0,$=w<0;w===0?y=y.add(e(U,s[v])):d=d.add(e($,s[k]))}return{p:d,f:y}},wNAFCached(o,s,i,c){let u=o._WINDOW_SIZE||1,d=s.get(o);return d||(d=this.precomputeWindow(o,u),u!==1&&s.set(o,c(d))),this.wNAF(u,d,i)}}}function Sc(n){return wc(n.Fp),lr(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Tc(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}function Nm(n){let t=Sc(n);lr(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:r,a:o}=t;if(e){if(!r.eql(o,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:km,hexToBytes:Dm}=xc,Fr={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(n){let{Err:t}=Fr;if(n.length<2||n[0]!==2)throw new t("Invalid signature integer tag");let e=n[1],r=n.subarray(2,e+2);if(!e||r.length!==e)throw new t("Invalid signature integer: wrong length");if(r[0]&128)throw new t("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:km(r),l:n.subarray(e+2)}},toSig(n){let{Err:t}=Fr,e=typeof n=="string"?Dm(n):n;if(!(e instanceof Uint8Array))throw new Error("ui8a expected");let r=e.length;if(r<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==r-2)throw new t("Invalid signature: incorrect length");let{d:o,l:s}=Fr._parseInt(e.subarray(2)),{d:i,l:c}=Fr._parseInt(s);if(c.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s:i}},hexFromSig(n){let t=d=>Number.parseInt(d[0],16)&8?"00"+d:d,e=d=>{let y=d.toString(16);return y.length&1?`0${y}`:y},r=t(e(n.s)),o=t(e(n.r)),s=r.length/2,i=o.length/2,c=e(s),u=e(i);return`30${e(i+s+4)}02${u}${o}02${c}${r}`}},Hn=BigInt(0),nn=BigInt(1),Pb=BigInt(2),Jf=BigInt(3),Ub=BigInt(4);function zm(n){let t=Nm(n),{Fp:e}=t,r=t.toBytes||((b,h,w)=>{let v=h.toAffine();return xo(Uint8Array.from([4]),e.toBytes(v.x),e.toBytes(v.y))}),o=t.fromBytes||(b=>{let h=b.subarray(1),w=e.fromBytes(h.subarray(0,e.BYTES)),v=e.fromBytes(h.subarray(e.BYTES,2*e.BYTES));return{x:w,y:v}});function s(b){let{a:h,b:w}=t,v=e.sqr(b),k=e.mul(v,b);return e.add(e.add(k,e.mul(b,h)),w)}if(!e.eql(e.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function i(b){return typeof b=="bigint"&&Hn<b&&b<t.n}function c(b){if(!i(b))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function u(b){let{allowedPrivateKeyLengths:h,nByteLength:w,wrapPrivateKey:v,n:k}=t;if(h&&typeof b!="bigint"){if(b instanceof Uint8Array&&(b=Lr(b)),typeof b!="string"||!h.includes(b.length))throw new Error("Invalid key");b=b.padStart(w*2,"0")}let U;try{U=typeof b=="bigint"?b:Fn(Ht("private key",b,w))}catch{throw new Error(`private key must be ${w} bytes, hex or bigint, not ${typeof b}`)}return v&&(U=Tt(U,k)),c(U),U}let d=new Map;function y(b){if(!(b instanceof g))throw new Error("ProjectivePoint expected")}class g{constructor(h,w,v){if(this.px=h,this.py=w,this.pz=v,h==null||!e.isValid(h))throw new Error("x required");if(w==null||!e.isValid(w))throw new Error("y required");if(v==null||!e.isValid(v))throw new Error("z required")}static fromAffine(h){let{x:w,y:v}=h||{};if(!h||!e.isValid(w)||!e.isValid(v))throw new Error("invalid affine point");if(h instanceof g)throw new Error("projective point not allowed");let k=U=>e.eql(U,e.ZERO);return k(w)&&k(v)?g.ZERO:new g(w,v,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(h){let w=e.invertBatch(h.map(v=>v.pz));return h.map((v,k)=>v.toAffine(w[k])).map(g.fromAffine)}static fromHex(h){let w=g.fromAffine(o(Ht("pointHex",h)));return w.assertValidity(),w}static fromPrivateKey(h){return g.BASE.multiply(u(h))}_setWindowSize(h){this._WINDOW_SIZE=h,d.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:h,y:w}=this.toAffine();if(!e.isValid(h)||!e.isValid(w))throw new Error("bad point: x or y not FE");let v=e.sqr(w),k=s(h);if(!e.eql(v,k))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:h}=this.toAffine();if(e.isOdd)return!e.isOdd(h);throw new Error("Field doesn't support isOdd")}equals(h){y(h);let{px:w,py:v,pz:k}=this,{px:U,py:$,pz:M}=h,D=e.eql(e.mul(w,M),e.mul(U,k)),q=e.eql(e.mul(v,M),e.mul($,k));return D&&q}negate(){return new g(this.px,e.neg(this.py),this.pz)}double(){let{a:h,b:w}=t,v=e.mul(w,Jf),{px:k,py:U,pz:$}=this,M=e.ZERO,D=e.ZERO,q=e.ZERO,F=e.mul(k,k),Te=e.mul(U,U),te=e.mul($,$),Q=e.mul(k,U);return Q=e.add(Q,Q),q=e.mul(k,$),q=e.add(q,q),M=e.mul(h,q),D=e.mul(v,te),D=e.add(M,D),M=e.sub(Te,D),D=e.add(Te,D),D=e.mul(M,D),M=e.mul(Q,M),q=e.mul(v,q),te=e.mul(h,te),Q=e.sub(F,te),Q=e.mul(h,Q),Q=e.add(Q,q),q=e.add(F,F),F=e.add(q,F),F=e.add(F,te),F=e.mul(F,Q),D=e.add(D,F),te=e.mul(U,$),te=e.add(te,te),F=e.mul(te,Q),M=e.sub(M,F),q=e.mul(te,Te),q=e.add(q,q),q=e.add(q,q),new g(M,D,q)}add(h){y(h);let{px:w,py:v,pz:k}=this,{px:U,py:$,pz:M}=h,D=e.ZERO,q=e.ZERO,F=e.ZERO,Te=t.a,te=e.mul(t.b,Jf),Q=e.mul(w,U),Ce=e.mul(v,$),Ie=e.mul(k,M),Qe=e.add(w,v),E=e.add(U,$);Qe=e.mul(Qe,E),E=e.add(Q,Ce),Qe=e.sub(Qe,E),E=e.add(w,k);let P=e.add(U,M);return E=e.mul(E,P),P=e.add(Q,Ie),E=e.sub(E,P),P=e.add(v,k),D=e.add($,M),P=e.mul(P,D),D=e.add(Ce,Ie),P=e.sub(P,D),F=e.mul(Te,E),D=e.mul(te,Ie),F=e.add(D,F),D=e.sub(Ce,F),F=e.add(Ce,F),q=e.mul(D,F),Ce=e.add(Q,Q),Ce=e.add(Ce,Q),Ie=e.mul(Te,Ie),E=e.mul(te,E),Ce=e.add(Ce,Ie),Ie=e.sub(Q,Ie),Ie=e.mul(Te,Ie),E=e.add(E,Ie),Q=e.mul(Ce,E),q=e.add(q,Q),Q=e.mul(P,E),D=e.mul(Qe,D),D=e.sub(D,Q),Q=e.mul(Qe,Ce),F=e.mul(P,F),F=e.add(F,Q),new g(D,q,F)}subtract(h){return this.add(h.negate())}is0(){return this.equals(g.ZERO)}wNAF(h){return S.wNAFCached(this,d,h,w=>{let v=e.invertBatch(w.map(k=>k.pz));return w.map((k,U)=>k.toAffine(v[U])).map(g.fromAffine)})}multiplyUnsafe(h){let w=g.ZERO;if(h===Hn)return w;if(c(h),h===nn)return this;let{endo:v}=t;if(!v)return S.unsafeLadder(this,h);let{k1neg:k,k1:U,k2neg:$,k2:M}=v.splitScalar(h),D=w,q=w,F=this;for(;U>Hn||M>Hn;)U&nn&&(D=D.add(F)),M&nn&&(q=q.add(F)),F=F.double(),U>>=nn,M>>=nn;return k&&(D=D.negate()),$&&(q=q.negate()),q=new g(e.mul(q.px,v.beta),q.py,q.pz),D.add(q)}multiply(h){c(h);let w=h,v,k,{endo:U}=t;if(U){let{k1neg:$,k1:M,k2neg:D,k2:q}=U.splitScalar(w),{p:F,f:Te}=this.wNAF(M),{p:te,f:Q}=this.wNAF(q);F=S.constTimeNegate($,F),te=S.constTimeNegate(D,te),te=new g(e.mul(te.px,U.beta),te.py,te.pz),v=F.add(te),k=Te.add(Q)}else{let{p:$,f:M}=this.wNAF(w);v=$,k=M}return g.normalizeZ([v,k])[0]}multiplyAndAddUnsafe(h,w,v){let k=g.BASE,U=(M,D)=>D===Hn||D===nn||!M.equals(k)?M.multiplyUnsafe(D):M.multiply(D),$=U(this,w).add(U(h,v));return $.is0()?void 0:$}toAffine(h){let{px:w,py:v,pz:k}=this,U=this.is0();h==null&&(h=U?e.ONE:e.inv(k));let $=e.mul(w,h),M=e.mul(v,h),D=e.mul(k,h);if(U)return{x:e.ZERO,y:e.ZERO};if(!e.eql(D,e.ONE))throw new Error("invZ was invalid");return{x:$,y:M}}isTorsionFree(){let{h,isTorsionFree:w}=t;if(h===nn)return!0;if(w)return w(g,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h,clearCofactor:w}=t;return h===nn?this:w?w(g,this):this.multiplyUnsafe(t.h)}toRawBytes(h=!0){return this.assertValidity(),r(g,this,h)}toHex(h=!0){return Lr(this.toRawBytes(h))}}g.BASE=new g(t.Gx,t.Gy,e.ONE),g.ZERO=new g(e.ZERO,e.ONE,e.ZERO);let T=t.nBitLength,S=Xf(g,t.endo?Math.ceil(T/2):T);return{CURVE:t,ProjectivePoint:g,normPrivateKeyToScalar:u,weierstrassEquation:s,isWithinCurveOrder:i}}function Gm(n){let t=Sc(n);return lr(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function ed(n){let t=Gm(n),{Fp:e,n:r}=t,o=e.BYTES+1,s=2*e.BYTES+1;function i(E){return Hn<E&&E<e.ORDER}function c(E){return Tt(E,r)}function u(E){return xi(E,r)}let{ProjectivePoint:d,normPrivateKeyToScalar:y,weierstrassEquation:g,isWithinCurveOrder:T}=zm({...t,toBytes(E,P,H){let ne=P.toAffine(),re=e.toBytes(ne.x),be=xo;return H?be(Uint8Array.from([P.hasEvenY()?2:3]),re):be(Uint8Array.from([4]),re,e.toBytes(ne.y))},fromBytes(E){let P=E.length,H=E[0],ne=E.subarray(1);if(P===o&&(H===2||H===3)){let re=Fn(ne);if(!i(re))throw new Error("Point is not on curve");let be=g(re),ze=e.sqrt(be),Ee=(ze&nn)===nn;return(H&1)===1!==Ee&&(ze=e.neg(ze)),{x:re,y:ze}}else if(P===s&&H===4){let re=e.fromBytes(ne.subarray(0,e.BYTES)),be=e.fromBytes(ne.subarray(e.BYTES,2*e.BYTES));return{x:re,y:be}}else throw new Error(`Point of length ${P} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`)}}),S=E=>Lr(dr(E,t.nByteLength));function b(E){let P=r>>nn;return E>P}function h(E){return b(E)?c(-E):E}let w=(E,P,H)=>Fn(E.slice(P,H));class v{constructor(P,H,ne){this.r=P,this.s=H,this.recovery=ne,this.assertValidity()}static fromCompact(P){let H=t.nByteLength;return P=Ht("compactSignature",P,H*2),new v(w(P,0,H),w(P,H,2*H))}static fromDER(P){let{r:H,s:ne}=Fr.toSig(Ht("DER",P));return new v(H,ne)}assertValidity(){if(!T(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!T(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(P){return new v(this.r,this.s,P)}recoverPublicKey(P){let{r:H,s:ne,recovery:re}=this,be=q(Ht("msgHash",P));if(re==null||![0,1,2,3].includes(re))throw new Error("recovery id invalid");let ze=re===2||re===3?H+t.n:H;if(ze>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let Ee=re&1?"03":"02",Le=d.fromHex(Ee+S(ze)),ie=u(ze),He=c(-be*ie),Nt=c(ne*ie),ct=d.BASE.multiplyAndAddUnsafe(Le,He,Nt);if(!ct)throw new Error("point at infinify");return ct.assertValidity(),ct}hasHighS(){return b(this.s)}normalizeS(){return this.hasHighS()?new v(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return qr(this.toDERHex())}toDERHex(){return Fr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return qr(this.toCompactHex())}toCompactHex(){return S(this.r)+S(this.s)}}let k={isValidPrivateKey(E){try{return y(E),!0}catch{return!1}},normPrivateKeyToScalar:y,randomPrivateKey:()=>{let E=Ec(t.n);return Zf(t.randomBytes(E),t.n)},precompute(E=8,P=d.BASE){return P._setWindowSize(E),P.multiply(BigInt(3)),P}};function U(E,P=!0){return d.fromPrivateKey(E).toRawBytes(P)}function $(E){let P=E instanceof Uint8Array,H=typeof E=="string",ne=(P||H)&&E.length;return P?ne===o||ne===s:H?ne===2*o||ne===2*s:E instanceof d}function M(E,P,H=!0){if($(E))throw new Error("first arg must be private key");if(!$(P))throw new Error("second arg must be public key");return d.fromHex(P).multiply(y(E)).toRawBytes(H)}let D=t.bits2int||function(E){let P=Fn(E),H=E.length*8-t.nBitLength;return H>0?P>>BigInt(H):P},q=t.bits2int_modN||function(E){return c(D(E))},F=os(t.nBitLength);function Te(E){if(typeof E!="bigint")throw new Error("bigint expected");if(!(Hn<=E&&E<F))throw new Error(`bigint expected < 2^${t.nBitLength}`);return dr(E,t.nByteLength)}function te(E,P,H=Q){if(["recovered","canonical"].some(ut=>ut in H))throw new Error("sign() legacy options not supported");let{hash:ne,randomBytes:re}=t,{lowS:be,prehash:ze,extraEntropy:Ee}=H;be==null&&(be=!0),E=Ht("msgHash",E),ze&&(E=Ht("prehashed msgHash",ne(E)));let Le=q(E),ie=y(P),He=[Te(ie),Te(Le)];if(Ee!=null){let ut=Ee===!0?re(e.BYTES):Ee;He.push(Ht("extraEntropy",ut))}let Nt=xo(...He),ct=Le;function Yt(ut){let At=D(ut);if(!T(At))return;let wn=u(At),je=d.BASE.multiply(At).toAffine(),St=c(je.x);if(St===Hn)return;let un=c(wn*c(ct+St*ie));if(un===Hn)return;let vr=(je.x===St?0:2)|Number(je.y&nn),Zn=un;return be&&b(un)&&(Zn=h(un),vr^=1),new v(St,Zn,vr)}return{seed:Nt,k2sig:Yt}}let Q={lowS:t.lowS,prehash:!1},Ce={lowS:t.lowS,prehash:!1};function Ie(E,P,H=Q){let{seed:ne,k2sig:re}=te(E,P,H),be=t;return Ac(be.hash.outputLen,be.nByteLength,be.hmac)(ne,re)}d.BASE._setWindowSize(8);function Qe(E,P,H,ne=Ce){let re=E;if(P=Ht("msgHash",P),H=Ht("publicKey",H),"strict"in ne)throw new Error("options.strict was renamed to lowS");let{lowS:be,prehash:ze}=ne,Ee,Le;try{if(typeof re=="string"||re instanceof Uint8Array)try{Ee=v.fromDER(re)}catch(je){if(!(je instanceof Fr.Err))throw je;Ee=v.fromCompact(re)}else if(typeof re=="object"&&typeof re.r=="bigint"&&typeof re.s=="bigint"){let{r:je,s:St}=re;Ee=new v(je,St)}else throw new Error("PARSE");Le=d.fromHex(H)}catch(je){if(je.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(be&&Ee.hasHighS())return!1;ze&&(P=t.hash(P));let{r:ie,s:He}=Ee,Nt=q(P),ct=u(He),Yt=c(Nt*ct),ut=c(ie*ct),At=d.BASE.multiplyAndAddUnsafe(Le,Yt,ut)?.toAffine();return At?c(At.x)===ie:!1}return{CURVE:t,getPublicKey:U,getSharedSecret:M,sign:Ie,verify:Qe,ProjectivePoint:d,Signature:v,utils:k}}var bi=class extends Ao{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,zf(t);let r=rs(e);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;let o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),s.fill(0)}update(t){return ho(this),this.iHash.update(t),this}digestInto(t){ho(this),gc(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:e,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},vc=(n,t,e)=>new bi(n,t).update(e).digest();vc.create=(n,t)=>new bi(n,t);function Mm(n){return{hash:n,hmac:(t,...e)=>vc(n,t,Lf(...e)),randomBytes:Kf}}function td(n,t){let e=r=>ed({...n,...Mm(r)});return Object.freeze({...e(t),create:e})}var od=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),nd=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Lm=BigInt(1),Cc=BigInt(2),rd=(n,t)=>(n+t/Cc)/t;function qm(n){let t=od,e=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),u=BigInt(88),d=n*n*n%t,y=d*d*n%t,g=$t(y,e,t)*y%t,T=$t(g,e,t)*y%t,S=$t(T,Cc,t)*d%t,b=$t(S,o,t)*S%t,h=$t(b,s,t)*b%t,w=$t(h,c,t)*h%t,v=$t(w,u,t)*w%t,k=$t(v,c,t)*h%t,U=$t(k,e,t)*y%t,$=$t(U,i,t)*b%t,M=$t($,r,t)*d%t,D=$t(M,Cc,t);if(!Ic.eql(Ic.sqr(D),n))throw new Error("Cannot find square root");return D}var Ic=Qf(od,void 0,void 0,{sqrt:qm}),bo=td({a:BigInt(0),b:BigInt(7),Fp:Ic,n:nd,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{let t=nd,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Lm*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,i=BigInt("0x100000000000000000000000000000000"),c=rd(s*n,t),u=rd(-r*n,t),d=Tt(n-c*e-u*o,t),y=Tt(-c*r-u*s,t),g=d>i,T=y>i;if(g&&(d=t-d),T&&(y=t-y),d>i||y>i)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:g,k1:d,k2neg:T,k2:y}}}},Ff),Fb=BigInt(0);var Hb=bo.ProjectivePoint;var Km=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),id=Uint8Array.from({length:16},(n,t)=>t),Fm=id.map(n=>(9*n+5)%16),Pc=[id],Uc=[Fm];for(let n=0;n<4;n++)for(let t of[Pc,Uc])t.push(t[n].map(e=>Km[e]));var ad=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(n=>new Uint8Array(n)),Hm=Pc.map((n,t)=>n.map(e=>ad[t][e])),$m=Uc.map((n,t)=>n.map(e=>ad[t][e])),Vm=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),jm=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),wi=(n,t)=>n<<t|n>>>32-t;function sd(n,t,e,r){return n===0?t^e^r:n===1?t&e|~t&r:n===2?(t|~e)^r:n===3?t&r|e&~r:t^(e|~r)}var Ti=new Uint32Array(16),Bc=class extends rr{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){let{h0:t,h1:e,h2:r,h3:o,h4:s}=this;return[t,e,r,o,s]}set(t,e,r,o,s){this.h0=t|0,this.h1=e|0,this.h2=r|0,this.h3=o|0,this.h4=s|0}process(t,e){for(let S=0;S<16;S++,e+=4)Ti[S]=t.getUint32(e,!0);let r=this.h0|0,o=r,s=this.h1|0,i=s,c=this.h2|0,u=c,d=this.h3|0,y=d,g=this.h4|0,T=g;for(let S=0;S<5;S++){let b=4-S,h=Vm[S],w=jm[S],v=Pc[S],k=Uc[S],U=Hm[S],$=$m[S];for(let M=0;M<16;M++){let D=wi(r+sd(S,s,c,d)+Ti[v[M]]+h,U[M])+g|0;r=g,g=d,d=wi(c,10)|0,c=s,s=D}for(let M=0;M<16;M++){let D=wi(o+sd(b,i,u,y)+Ti[k[M]]+w,$[M])+T|0;o=T,T=y,y=wi(u,10)|0,u=i,i=D}}this.set(this.h1+c+y|0,this.h2+d+T|0,this.h3+g+o|0,this.h4+r+i|0,this.h0+s+u|0)}roundClean(){Ti.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}},cd=Jn(()=>new Bc);var kc={};Ws(kc,{bitGet:()=>ey,bitLen:()=>Jm,bitMask:()=>ss,bitSet:()=>ty,bytesToHex:()=>Hr,bytesToNumberBE:()=>Vn,bytesToNumberLE:()=>_i,concatBytes:()=>wo,createHmacDrbg:()=>Nc,ensureBytes:()=>Vt,equalBytes:()=>Zm,hexToBytes:()=>$r,hexToNumber:()=>Oc,isBytes:()=>yn,numberToBytesBE:()=>pr,numberToBytesLE:()=>Si,numberToHexUnpadded:()=>ld,numberToVarBytesBE:()=>Ym,utf8ToBytes:()=>Xm,validateObject:()=>gr});var dd=BigInt(0),Ei=BigInt(1),Wm=BigInt(2);function yn(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}var Qm=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function Hr(n){if(!yn(n))throw new Error("Uint8Array expected");let t="";for(let e=0;e<n.length;e++)t+=Qm[n[e]];return t}function ld(n){let t=n.toString(16);return t.length&1?`0${t}`:t}function Oc(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return BigInt(n===""?"0":`0x${n}`)}var $n={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function ud(n){if(n>=$n._0&&n<=$n._9)return n-$n._0;if(n>=$n._A&&n<=$n._F)return n-($n._A-10);if(n>=$n._a&&n<=$n._f)return n-($n._a-10)}function $r(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);let t=n.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(e);for(let o=0,s=0;o<e;o++,s+=2){let i=ud(n.charCodeAt(s)),c=ud(n.charCodeAt(s+1));if(i===void 0||c===void 0){let u=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+s)}r[o]=i*16+c}return r}function Vn(n){return Oc(Hr(n))}function _i(n){if(!yn(n))throw new Error("Uint8Array expected");return Oc(Hr(Uint8Array.from(n).reverse()))}function pr(n,t){return $r(n.toString(16).padStart(t*2,"0"))}function Si(n,t){return pr(n,t).reverse()}function Ym(n){return $r(ld(n))}function Vt(n,t,e){let r;if(typeof t=="string")try{r=$r(t)}catch(s){throw new Error(`${n} must be valid hex string, got "${t}". Cause: ${s}`)}else if(yn(t))r=Uint8Array.from(t);else throw new Error(`${n} must be hex string or Uint8Array`);let o=r.length;if(typeof e=="number"&&o!==e)throw new Error(`${n} expected ${e} bytes, got ${o}`);return r}function wo(...n){let t=0;for(let o=0;o<n.length;o++){let s=n[o];if(!yn(s))throw new Error("Uint8Array expected");t+=s.length}let e=new Uint8Array(t),r=0;for(let o=0;o<n.length;o++){let s=n[o];e.set(s,r),r+=s.length}return e}function Zm(n,t){if(n.length!==t.length)return!1;let e=0;for(let r=0;r<n.length;r++)e|=n[r]^t[r];return e===0}function Xm(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function Jm(n){let t;for(t=0;n>dd;n>>=Ei,t+=1);return t}function ey(n,t){return n>>BigInt(t)&Ei}var ty=(n,t,e)=>n|(e?Ei:dd)<<BigInt(t),ss=n=>(Wm<<BigInt(n-1))-Ei,Rc=n=>new Uint8Array(n),fd=n=>Uint8Array.from(n);function Nc(n,t,e){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let r=Rc(n),o=Rc(n),s=0,i=()=>{r.fill(1),o.fill(0),s=0},c=(...g)=>e(o,r,...g),u=(g=Rc())=>{o=c(fd([0]),g),r=c(),g.length!==0&&(o=c(fd([1]),g),r=c())},d=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let g=0,T=[];for(;g<t;){r=c();let S=r.slice();T.push(S),g+=r.length}return wo(...T)};return(g,T)=>{i(),u(g);let S;for(;!(S=T(d()));)u();return i(),S}}var ny={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||yn(n),isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,t)=>t.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function gr(n,t,e={}){let r=(o,s,i)=>{let c=ny[s];if(typeof c!="function")throw new Error(`Invalid validator "${s}", expected function`);let u=n[o];if(!(i&&u===void 0)&&!c(u,n))throw new Error(`Invalid param ${String(o)}=${u} (${typeof u}), expected ${s}`)};for(let[o,s]of Object.entries(t))r(o,s,!1);for(let[o,s]of Object.entries(e))r(o,s,!0);return n}var pt=BigInt(0),ot=BigInt(1),Vr=BigInt(2),ry=BigInt(3),Dc=BigInt(4),pd=BigInt(5),gd=BigInt(8),oy=BigInt(9),sy=BigInt(16);function mt(n,t){let e=n%t;return e>=pt?e:t+e}function iy(n,t,e){if(e<=pt||t<pt)throw new Error("Expected power/modulo > 0");if(e===ot)return pt;let r=ot;for(;t>pt;)t&ot&&(r=r*n%e),n=n*n%e,t>>=ot;return r}function jt(n,t,e){let r=n;for(;t-- >pt;)r*=r,r%=e;return r}function vi(n,t){if(n===pt||t<=pt)throw new Error(`invert: expected positive integers, got n=${n} mod=${t}`);let e=mt(n,t),r=t,o=pt,s=ot,i=ot,c=pt;for(;e!==pt;){let d=r/e,y=r%e,g=o-i*d,T=s-c*d;r=e,e=y,o=i,s=c,i=g,c=T}if(r!==ot)throw new Error("invert: does not exist");return mt(o,t)}function ay(n){let t=(n-ot)/Vr,e,r,o;for(e=n-ot,r=0;e%Vr===pt;e/=Vr,r++);for(o=Vr;o<n&&iy(o,t,n)!==n-ot;o++);if(r===1){let i=(n+ot)/Dc;return function(u,d){let y=u.pow(d,i);if(!u.eql(u.sqr(y),d))throw new Error("Cannot find square root");return y}}let s=(e+ot)/Vr;return function(c,u){if(c.pow(u,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let d=r,y=c.pow(c.mul(c.ONE,o),e),g=c.pow(u,s),T=c.pow(u,e);for(;!c.eql(T,c.ONE);){if(c.eql(T,c.ZERO))return c.ZERO;let S=1;for(let h=c.sqr(T);S<d&&!c.eql(h,c.ONE);S++)h=c.sqr(h);let b=c.pow(y,ot<<BigInt(d-S-1));y=c.sqr(b),g=c.mul(g,b),T=c.mul(T,y),d=S}return g}}function cy(n){if(n%Dc===ry){let t=(n+ot)/Dc;return function(r,o){let s=r.pow(o,t);if(!r.eql(r.sqr(s),o))throw new Error("Cannot find square root");return s}}if(n%gd===pd){let t=(n-pd)/gd;return function(r,o){let s=r.mul(o,Vr),i=r.pow(s,t),c=r.mul(o,i),u=r.mul(r.mul(c,Vr),i),d=r.mul(c,r.sub(u,r.ONE));if(!r.eql(r.sqr(d),o))throw new Error("Cannot find square root");return d}}return n%sy,ay(n)}var uy=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function zc(n){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=uy.reduce((r,o)=>(r[o]="function",r),t);return gr(n,e)}function fy(n,t,e){if(e<pt)throw new Error("Expected power > 0");if(e===pt)return n.ONE;if(e===ot)return t;let r=n.ONE,o=t;for(;e>pt;)e&ot&&(r=n.mul(r,o)),o=n.sqr(o),e>>=ot;return r}function dy(n,t){let e=new Array(t.length),r=t.reduce((s,i,c)=>n.is0(i)?s:(e[c]=s,n.mul(s,i)),n.ONE),o=n.inv(r);return t.reduceRight((s,i,c)=>n.is0(i)?s:(e[c]=n.mul(s,e[c]),n.mul(s,i)),o),e}function Gc(n,t){let e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function md(n,t,e=!1,r={}){if(n<=pt)throw new Error(`Expected Field ORDER > 0, got ${n}`);let{nBitLength:o,nByteLength:s}=Gc(n,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let i=cy(n),c=Object.freeze({ORDER:n,BITS:o,BYTES:s,MASK:ss(o),ZERO:pt,ONE:ot,create:u=>mt(u,n),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return pt<=u&&u<n},is0:u=>u===pt,isOdd:u=>(u&ot)===ot,neg:u=>mt(-u,n),eql:(u,d)=>u===d,sqr:u=>mt(u*u,n),add:(u,d)=>mt(u+d,n),sub:(u,d)=>mt(u-d,n),mul:(u,d)=>mt(u*d,n),pow:(u,d)=>fy(c,u,d),div:(u,d)=>mt(u*vi(d,n),n),sqrN:u=>u*u,addN:(u,d)=>u+d,subN:(u,d)=>u-d,mulN:(u,d)=>u*d,inv:u=>vi(u,n),sqrt:r.sqrt||(u=>i(c,u)),invertBatch:u=>dy(c,u),cmov:(u,d,y)=>y?d:u,toBytes:u=>e?Si(u,s):pr(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return e?_i(u):Vn(u)}});return Object.freeze(c)}function yd(n){if(typeof n!="bigint")throw new Error("field order must be bigint");let t=n.toString(2).length;return Math.ceil(t/8)}function Mc(n){let t=yd(n);return t+Math.ceil(t/2)}function hd(n,t,e=!1){let r=n.length,o=yd(t),s=Mc(t);if(r<16||r<s||r>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);let i=e?Vn(n):_i(n),c=mt(i,t-ot)+ot;return e?Si(c,o):pr(c,o)}var py=BigInt(0),Lc=BigInt(1);function Ad(n,t){let e=(o,s)=>{let i=s.negate();return o?i:s},r=o=>{let s=Math.ceil(t/o)+1,i=2**(o-1);return{windows:s,windowSize:i}};return{constTimeNegate:e,unsafeLadder(o,s){let i=n.ZERO,c=o;for(;s>py;)s&Lc&&(i=i.add(c)),c=c.double(),s>>=Lc;return i},precomputeWindow(o,s){let{windows:i,windowSize:c}=r(s),u=[],d=o,y=d;for(let g=0;g<i;g++){y=d,u.push(y);for(let T=1;T<c;T++)y=y.add(d),u.push(y);d=y.double()}return u},wNAF(o,s,i){let{windows:c,windowSize:u}=r(o),d=n.ZERO,y=n.BASE,g=BigInt(2**o-1),T=2**o,S=BigInt(o);for(let b=0;b<c;b++){let h=b*u,w=Number(i&g);i>>=S,w>u&&(w-=T,i+=Lc);let v=h,k=h+Math.abs(w)-1,U=b%2!==0,$=w<0;w===0?y=y.add(e(U,s[v])):d=d.add(e($,s[k]))}return{p:d,f:y}},wNAFCached(o,s,i,c){let u=o._WINDOW_SIZE||1,d=s.get(o);return d||(d=this.precomputeWindow(o,u),u!==1&&s.set(o,c(d))),this.wNAF(u,d,i)}}}function qc(n){return zc(n.Fp),gr(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Gc(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}function gy(n){let t=qc(n);gr(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:r,a:o}=t;if(e){if(!r.eql(o,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:my,hexToBytes:yy}=kc,jr={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(n){let{Err:t}=jr;if(n.length<2||n[0]!==2)throw new t("Invalid signature integer tag");let e=n[1],r=n.subarray(2,e+2);if(!e||r.length!==e)throw new t("Invalid signature integer: wrong length");if(r[0]&128)throw new t("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:my(r),l:n.subarray(e+2)}},toSig(n){let{Err:t}=jr,e=typeof n=="string"?yy(n):n;if(!yn(e))throw new Error("ui8a expected");let r=e.length;if(r<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==r-2)throw new t("Invalid signature: incorrect length");let{d:o,l:s}=jr._parseInt(e.subarray(2)),{d:i,l:c}=jr._parseInt(s);if(c.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s:i}},hexFromSig(n){let t=d=>Number.parseInt(d[0],16)&8?"00"+d:d,e=d=>{let y=d.toString(16);return y.length&1?`0${y}`:y},r=t(e(n.s)),o=t(e(n.r)),s=r.length/2,i=o.length/2,c=e(s),u=e(i);return`30${e(i+s+4)}02${u}${o}02${c}${r}`}},jn=BigInt(0),rn=BigInt(1),nw=BigInt(2),xd=BigInt(3),rw=BigInt(4);function hy(n){let t=gy(n),{Fp:e}=t,r=t.toBytes||((b,h,w)=>{let v=h.toAffine();return wo(Uint8Array.from([4]),e.toBytes(v.x),e.toBytes(v.y))}),o=t.fromBytes||(b=>{let h=b.subarray(1),w=e.fromBytes(h.subarray(0,e.BYTES)),v=e.fromBytes(h.subarray(e.BYTES,2*e.BYTES));return{x:w,y:v}});function s(b){let{a:h,b:w}=t,v=e.sqr(b),k=e.mul(v,b);return e.add(e.add(k,e.mul(b,h)),w)}if(!e.eql(e.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function i(b){return typeof b=="bigint"&&jn<b&&b<t.n}function c(b){if(!i(b))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function u(b){let{allowedPrivateKeyLengths:h,nByteLength:w,wrapPrivateKey:v,n:k}=t;if(h&&typeof b!="bigint"){if(yn(b)&&(b=Hr(b)),typeof b!="string"||!h.includes(b.length))throw new Error("Invalid key");b=b.padStart(w*2,"0")}let U;try{U=typeof b=="bigint"?b:Vn(Vt("private key",b,w))}catch{throw new Error(`private key must be ${w} bytes, hex or bigint, not ${typeof b}`)}return v&&(U=mt(U,k)),c(U),U}let d=new Map;function y(b){if(!(b instanceof g))throw new Error("ProjectivePoint expected")}class g{constructor(h,w,v){if(this.px=h,this.py=w,this.pz=v,h==null||!e.isValid(h))throw new Error("x required");if(w==null||!e.isValid(w))throw new Error("y required");if(v==null||!e.isValid(v))throw new Error("z required")}static fromAffine(h){let{x:w,y:v}=h||{};if(!h||!e.isValid(w)||!e.isValid(v))throw new Error("invalid affine point");if(h instanceof g)throw new Error("projective point not allowed");let k=U=>e.eql(U,e.ZERO);return k(w)&&k(v)?g.ZERO:new g(w,v,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(h){let w=e.invertBatch(h.map(v=>v.pz));return h.map((v,k)=>v.toAffine(w[k])).map(g.fromAffine)}static fromHex(h){let w=g.fromAffine(o(Vt("pointHex",h)));return w.assertValidity(),w}static fromPrivateKey(h){return g.BASE.multiply(u(h))}_setWindowSize(h){this._WINDOW_SIZE=h,d.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:h,y:w}=this.toAffine();if(!e.isValid(h)||!e.isValid(w))throw new Error("bad point: x or y not FE");let v=e.sqr(w),k=s(h);if(!e.eql(v,k))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:h}=this.toAffine();if(e.isOdd)return!e.isOdd(h);throw new Error("Field doesn't support isOdd")}equals(h){y(h);let{px:w,py:v,pz:k}=this,{px:U,py:$,pz:M}=h,D=e.eql(e.mul(w,M),e.mul(U,k)),q=e.eql(e.mul(v,M),e.mul($,k));return D&&q}negate(){return new g(this.px,e.neg(this.py),this.pz)}double(){let{a:h,b:w}=t,v=e.mul(w,xd),{px:k,py:U,pz:$}=this,M=e.ZERO,D=e.ZERO,q=e.ZERO,F=e.mul(k,k),Te=e.mul(U,U),te=e.mul($,$),Q=e.mul(k,U);return Q=e.add(Q,Q),q=e.mul(k,$),q=e.add(q,q),M=e.mul(h,q),D=e.mul(v,te),D=e.add(M,D),M=e.sub(Te,D),D=e.add(Te,D),D=e.mul(M,D),M=e.mul(Q,M),q=e.mul(v,q),te=e.mul(h,te),Q=e.sub(F,te),Q=e.mul(h,Q),Q=e.add(Q,q),q=e.add(F,F),F=e.add(q,F),F=e.add(F,te),F=e.mul(F,Q),D=e.add(D,F),te=e.mul(U,$),te=e.add(te,te),F=e.mul(te,Q),M=e.sub(M,F),q=e.mul(te,Te),q=e.add(q,q),q=e.add(q,q),new g(M,D,q)}add(h){y(h);let{px:w,py:v,pz:k}=this,{px:U,py:$,pz:M}=h,D=e.ZERO,q=e.ZERO,F=e.ZERO,Te=t.a,te=e.mul(t.b,xd),Q=e.mul(w,U),Ce=e.mul(v,$),Ie=e.mul(k,M),Qe=e.add(w,v),E=e.add(U,$);Qe=e.mul(Qe,E),E=e.add(Q,Ce),Qe=e.sub(Qe,E),E=e.add(w,k);let P=e.add(U,M);return E=e.mul(E,P),P=e.add(Q,Ie),E=e.sub(E,P),P=e.add(v,k),D=e.add($,M),P=e.mul(P,D),D=e.add(Ce,Ie),P=e.sub(P,D),F=e.mul(Te,E),D=e.mul(te,Ie),F=e.add(D,F),D=e.sub(Ce,F),F=e.add(Ce,F),q=e.mul(D,F),Ce=e.add(Q,Q),Ce=e.add(Ce,Q),Ie=e.mul(Te,Ie),E=e.mul(te,E),Ce=e.add(Ce,Ie),Ie=e.sub(Q,Ie),Ie=e.mul(Te,Ie),E=e.add(E,Ie),Q=e.mul(Ce,E),q=e.add(q,Q),Q=e.mul(P,E),D=e.mul(Qe,D),D=e.sub(D,Q),Q=e.mul(Qe,Ce),F=e.mul(P,F),F=e.add(F,Q),new g(D,q,F)}subtract(h){return this.add(h.negate())}is0(){return this.equals(g.ZERO)}wNAF(h){return S.wNAFCached(this,d,h,w=>{let v=e.invertBatch(w.map(k=>k.pz));return w.map((k,U)=>k.toAffine(v[U])).map(g.fromAffine)})}multiplyUnsafe(h){let w=g.ZERO;if(h===jn)return w;if(c(h),h===rn)return this;let{endo:v}=t;if(!v)return S.unsafeLadder(this,h);let{k1neg:k,k1:U,k2neg:$,k2:M}=v.splitScalar(h),D=w,q=w,F=this;for(;U>jn||M>jn;)U&rn&&(D=D.add(F)),M&rn&&(q=q.add(F)),F=F.double(),U>>=rn,M>>=rn;return k&&(D=D.negate()),$&&(q=q.negate()),q=new g(e.mul(q.px,v.beta),q.py,q.pz),D.add(q)}multiply(h){c(h);let w=h,v,k,{endo:U}=t;if(U){let{k1neg:$,k1:M,k2neg:D,k2:q}=U.splitScalar(w),{p:F,f:Te}=this.wNAF(M),{p:te,f:Q}=this.wNAF(q);F=S.constTimeNegate($,F),te=S.constTimeNegate(D,te),te=new g(e.mul(te.px,U.beta),te.py,te.pz),v=F.add(te),k=Te.add(Q)}else{let{p:$,f:M}=this.wNAF(w);v=$,k=M}return g.normalizeZ([v,k])[0]}multiplyAndAddUnsafe(h,w,v){let k=g.BASE,U=(M,D)=>D===jn||D===rn||!M.equals(k)?M.multiplyUnsafe(D):M.multiply(D),$=U(this,w).add(U(h,v));return $.is0()?void 0:$}toAffine(h){let{px:w,py:v,pz:k}=this,U=this.is0();h==null&&(h=U?e.ONE:e.inv(k));let $=e.mul(w,h),M=e.mul(v,h),D=e.mul(k,h);if(U)return{x:e.ZERO,y:e.ZERO};if(!e.eql(D,e.ONE))throw new Error("invZ was invalid");return{x:$,y:M}}isTorsionFree(){let{h,isTorsionFree:w}=t;if(h===rn)return!0;if(w)return w(g,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h,clearCofactor:w}=t;return h===rn?this:w?w(g,this):this.multiplyUnsafe(t.h)}toRawBytes(h=!0){return this.assertValidity(),r(g,this,h)}toHex(h=!0){return Hr(this.toRawBytes(h))}}g.BASE=new g(t.Gx,t.Gy,e.ONE),g.ZERO=new g(e.ZERO,e.ONE,e.ZERO);let T=t.nBitLength,S=Ad(g,t.endo?Math.ceil(T/2):T);return{CURVE:t,ProjectivePoint:g,normPrivateKeyToScalar:u,weierstrassEquation:s,isWithinCurveOrder:i}}function Ay(n){let t=qc(n);return gr(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function bd(n){let t=Ay(n),{Fp:e,n:r}=t,o=e.BYTES+1,s=2*e.BYTES+1;function i(E){return jn<E&&E<e.ORDER}function c(E){return mt(E,r)}function u(E){return vi(E,r)}let{ProjectivePoint:d,normPrivateKeyToScalar:y,weierstrassEquation:g,isWithinCurveOrder:T}=hy({...t,toBytes(E,P,H){let ne=P.toAffine(),re=e.toBytes(ne.x),be=wo;return H?be(Uint8Array.from([P.hasEvenY()?2:3]),re):be(Uint8Array.from([4]),re,e.toBytes(ne.y))},fromBytes(E){let P=E.length,H=E[0],ne=E.subarray(1);if(P===o&&(H===2||H===3)){let re=Vn(ne);if(!i(re))throw new Error("Point is not on curve");let be=g(re),ze=e.sqrt(be),Ee=(ze&rn)===rn;return(H&1)===1!==Ee&&(ze=e.neg(ze)),{x:re,y:ze}}else if(P===s&&H===4){let re=e.fromBytes(ne.subarray(0,e.BYTES)),be=e.fromBytes(ne.subarray(e.BYTES,2*e.BYTES));return{x:re,y:be}}else throw new Error(`Point of length ${P} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`)}}),S=E=>Hr(pr(E,t.nByteLength));function b(E){let P=r>>rn;return E>P}function h(E){return b(E)?c(-E):E}let w=(E,P,H)=>Vn(E.slice(P,H));class v{constructor(P,H,ne){this.r=P,this.s=H,this.recovery=ne,this.assertValidity()}static fromCompact(P){let H=t.nByteLength;return P=Vt("compactSignature",P,H*2),new v(w(P,0,H),w(P,H,2*H))}static fromDER(P){let{r:H,s:ne}=jr.toSig(Vt("DER",P));return new v(H,ne)}assertValidity(){if(!T(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!T(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(P){return new v(this.r,this.s,P)}recoverPublicKey(P){let{r:H,s:ne,recovery:re}=this,be=q(Vt("msgHash",P));if(re==null||![0,1,2,3].includes(re))throw new Error("recovery id invalid");let ze=re===2||re===3?H+t.n:H;if(ze>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let Ee=re&1?"03":"02",Le=d.fromHex(Ee+S(ze)),ie=u(ze),He=c(-be*ie),Nt=c(ne*ie),ct=d.BASE.multiplyAndAddUnsafe(Le,He,Nt);if(!ct)throw new Error("point at infinify");return ct.assertValidity(),ct}hasHighS(){return b(this.s)}normalizeS(){return this.hasHighS()?new v(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return $r(this.toDERHex())}toDERHex(){return jr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return $r(this.toCompactHex())}toCompactHex(){return S(this.r)+S(this.s)}}let k={isValidPrivateKey(E){try{return y(E),!0}catch{return!1}},normPrivateKeyToScalar:y,randomPrivateKey:()=>{let E=Mc(t.n);return hd(t.randomBytes(E),t.n)},precompute(E=8,P=d.BASE){return P._setWindowSize(E),P.multiply(BigInt(3)),P}};function U(E,P=!0){return d.fromPrivateKey(E).toRawBytes(P)}function $(E){let P=yn(E),H=typeof E=="string",ne=(P||H)&&E.length;return P?ne===o||ne===s:H?ne===2*o||ne===2*s:E instanceof d}function M(E,P,H=!0){if($(E))throw new Error("first arg must be private key");if(!$(P))throw new Error("second arg must be public key");return d.fromHex(P).multiply(y(E)).toRawBytes(H)}let D=t.bits2int||function(E){let P=Vn(E),H=E.length*8-t.nBitLength;return H>0?P>>BigInt(H):P},q=t.bits2int_modN||function(E){return c(D(E))},F=ss(t.nBitLength);function Te(E){if(typeof E!="bigint")throw new Error("bigint expected");if(!(jn<=E&&E<F))throw new Error(`bigint expected < 2^${t.nBitLength}`);return pr(E,t.nByteLength)}function te(E,P,H=Q){if(["recovered","canonical"].some(ut=>ut in H))throw new Error("sign() legacy options not supported");let{hash:ne,randomBytes:re}=t,{lowS:be,prehash:ze,extraEntropy:Ee}=H;be==null&&(be=!0),E=Vt("msgHash",E),ze&&(E=Vt("prehashed msgHash",ne(E)));let Le=q(E),ie=y(P),He=[Te(ie),Te(Le)];if(Ee!=null){let ut=Ee===!0?re(e.BYTES):Ee;He.push(Vt("extraEntropy",ut))}let Nt=wo(...He),ct=Le;function Yt(ut){let At=D(ut);if(!T(At))return;let wn=u(At),je=d.BASE.multiply(At).toAffine(),St=c(je.x);if(St===jn)return;let un=c(wn*c(ct+St*ie));if(un===jn)return;let vr=(je.x===St?0:2)|Number(je.y&rn),Zn=un;return be&&b(un)&&(Zn=h(un),vr^=1),new v(St,Zn,vr)}return{seed:Nt,k2sig:Yt}}let Q={lowS:t.lowS,prehash:!1},Ce={lowS:t.lowS,prehash:!1};function Ie(E,P,H=Q){let{seed:ne,k2sig:re}=te(E,P,H),be=t;return Nc(be.hash.outputLen,be.nByteLength,be.hmac)(ne,re)}d.BASE._setWindowSize(8);function Qe(E,P,H,ne=Ce){let re=E;if(P=Vt("msgHash",P),H=Vt("publicKey",H),"strict"in ne)throw new Error("options.strict was renamed to lowS");let{lowS:be,prehash:ze}=ne,Ee,Le;try{if(typeof re=="string"||yn(re))try{Ee=v.fromDER(re)}catch(je){if(!(je instanceof jr.Err))throw je;Ee=v.fromCompact(re)}else if(typeof re=="object"&&typeof re.r=="bigint"&&typeof re.s=="bigint"){let{r:je,s:St}=re;Ee=new v(je,St)}else throw new Error("PARSE");Le=d.fromHex(H)}catch(je){if(je.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(be&&Ee.hasHighS())return!1;ze&&(P=t.hash(P));let{r:ie,s:He}=Ee,Nt=q(P),ct=u(He),Yt=c(Nt*ct),ut=c(ie*ct),At=d.BASE.multiplyAndAddUnsafe(Le,Yt,ut)?.toAffine();return At?c(At.x)===ie:!1}return{CURVE:t,getPublicKey:U,getSharedSecret:M,sign:Ie,verify:Qe,ProjectivePoint:d,Signature:v,utils:k}}function xy(n){return{hash:n,hmac:(t,...e)=>_n(n,t,Or(...e)),randomBytes:hf}}function wd(n,t){let e=r=>bd({...n,...xy(r)});return Object.freeze({...e(t),create:e})}var _d=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Td=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),by=BigInt(1),Kc=BigInt(2),Ed=(n,t)=>(n+t/Kc)/t;function wy(n){let t=_d,e=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),u=BigInt(88),d=n*n*n%t,y=d*d*n%t,g=jt(y,e,t)*y%t,T=jt(g,e,t)*y%t,S=jt(T,Kc,t)*d%t,b=jt(S,o,t)*S%t,h=jt(b,s,t)*b%t,w=jt(h,c,t)*h%t,v=jt(w,u,t)*w%t,k=jt(v,c,t)*h%t,U=jt(k,e,t)*y%t,$=jt(U,i,t)*b%t,M=jt($,r,t)*d%t,D=jt(M,Kc,t);if(!Fc.eql(Fc.sqr(D),n))throw new Error("Cannot find square root");return D}var Fc=md(_d,void 0,void 0,{sqrt:wy}),hn=wd({a:BigInt(0),b:BigInt(7),Fp:Fc,n:Td,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{let t=Td,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-by*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,i=BigInt("0x100000000000000000000000000000000"),c=Ed(s*n,t),u=Ed(-r*n,t),d=mt(n-c*e-u*o,t),y=mt(-c*r-u*s,t),g=d>i,T=y>i;if(g&&(d=t-d),T&&(y=t-y),d>i||y>i)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:g,k1:d,k2neg:T,k2:y}}}},es),lw=BigInt(0);var pw=hn.ProjectivePoint;function Ci(n){if(!Number.isSafeInteger(n))throw new Error(`Wrong integer: ${n}`)}function Hc(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}function vd(...n){let t=s=>s,e=(s,i)=>c=>s(i(c)),r=n.map(s=>s.encode).reduceRight(e,t),o=n.map(s=>s.decode).reduce(e,t);return{encode:r,decode:o}}function Ty(n){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(e=>{if(e<0||e>=n.length)throw new Error(`Digit index outside alphabet: ${e} (alphabet: ${n.length})`);return n[e]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(e=>{if(typeof e!="string")throw new Error(`alphabet.decode: not string element=${e}`);let r=n.indexOf(e);if(r===-1)throw new Error(`Unknown letter: "${e}". Allowed: ${n}`);return r})}}}function Ey(n=""){if(typeof n!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let e of t)if(typeof e!="string")throw new Error(`join.encode: non-string input=${e}`);return t.join(n)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(n)}}}function Sd(n,t,e){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(e<2)throw new Error(`convertRadix: wrong to=${e}, base cannot be less than 2`);if(!Array.isArray(n))throw new Error("convertRadix: data should be array");if(!n.length)return[];let r=0,o=[],s=Array.from(n);for(s.forEach(i=>{if(i<0||i>=t)throw new Error(`Wrong integer: ${i}`)});;){let i=0,c=!0;for(let u=r;u<s.length;u++){let d=s[u],y=t*i+d;if(!Number.isSafeInteger(y)||t*i/t!==i||y-d!==t*i)throw new Error("convertRadix: carry overflow");i=y%e;let g=Math.floor(y/e);if(s[u]=g,!Number.isSafeInteger(g)||g*e+i!==y)throw new Error("convertRadix: carry overflow");if(c)g?c=!1:r=u;else continue}if(o.push(i),c)break}for(let i=0;i<n.length-1&&n[i]===0;i++)o.push(0);return o.reverse()}function _y(n){return{encode:t=>{if(!Hc(t))throw new Error("radix.encode input should be Uint8Array");return Sd(Array.from(t),2**8,n)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(Sd(t,n,2**8))}}}function Sy(n,t){if(typeof t!="function")throw new Error("checksum fn should be function");return{encode(e){if(!Hc(e))throw new Error("checksum.encode: input should be Uint8Array");let r=t(e).slice(0,n),o=new Uint8Array(e.length+n);return o.set(e),o.set(r,e.length),o},decode(e){if(!Hc(e))throw new Error("checksum.decode: input should be Uint8Array");let r=e.slice(0,-n),o=t(r).slice(0,n),s=e.slice(-n);for(let i=0;i<n;i++)if(o[i]!==s[i])throw new Error("Invalid checksum");return r}}}var vy=n=>vd(_y(58),Ty(n),Ey("")),Cy=vy("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var Cd=n=>vd(Sy(4,t=>n(n(t))),Cy);var Ii=hn.ProjectivePoint,$c=Cd(es);function Id(n){return BigInt(`0x${Rr(n)}`)}function Iy(n){return go(n.toString(16).padStart(64,"0"))}var By=Ja("Bitcoin seed"),Vc={private:76066276,public:76067358},jc=2147483648,Py=n=>cd(es(n)),Uy=n=>En(n).getUint32(0,!1),Bi=n=>{if(!Number.isSafeInteger(n)||n<0||n>2**32-1)throw new Error(`Invalid number=${n}. Should be from 0 to 2 ** 32 - 1`);let t=new Uint8Array(4);return En(t).setUint32(0,n,!1),t},Pi=class n{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return Uy(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){let t=this.privateKey;if(!t)throw new Error("No private key");return $c.encode(this.serialize(this.versions.private,Or(new Uint8Array([0]),t)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return $c.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(t,e=Vc){if(pn(t),8*t.length<128||8*t.length>512)throw new Error(`HDKey: wrong seed length=${t.length}. Should be between 128 and 512 bits; 256 bits is advised)`);let r=_n(zr,By,t);return new n({versions:e,chainCode:r.slice(32),privateKey:r.slice(0,32)})}static fromExtendedKey(t,e=Vc){let r=$c.decode(t),o=En(r),s=o.getUint32(0,!1),i={versions:e,depth:r[4],parentFingerprint:o.getUint32(5,!1),index:o.getUint32(9,!1),chainCode:r.slice(13,45)},c=r.slice(45),u=c[0]===0;if(s!==e[u?"private":"public"])throw new Error("Version mismatch");return u?new n({...i,privateKey:c.slice(1)}):new n({...i,publicKey:c})}static fromJSON(t){return n.fromExtendedKey(t.xpriv)}constructor(t){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!t||typeof t!="object")throw new Error("HDKey.constructor must not be called directly");if(this.versions=t.versions||Vc,this.depth=t.depth||0,this.chainCode=t.chainCode,this.index=t.index||0,this.parentFingerprint=t.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(t.publicKey&&t.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(t.privateKey){if(!hn.utils.isValidPrivateKey(t.privateKey))throw new Error("Invalid private key");this.privKey=typeof t.privateKey=="bigint"?t.privateKey:Id(t.privateKey),this.privKeyBytes=Iy(this.privKey),this.pubKey=hn.getPublicKey(t.privateKey,!0)}else if(t.publicKey)this.pubKey=Ii.fromHex(t.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=Py(this.pubKey)}derive(t){if(!/^[mM]'?/.test(t))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(t))return this;let e=t.replace(/^[mM]'?\//,"").split("/"),r=this;for(let o of e){let s=/^(\d+)('?)$/.exec(o),i=s&&s[1];if(!s||s.length!==3||typeof i!="string")throw new Error(`Invalid child index: ${o}`);let c=+i;if(!Number.isSafeInteger(c)||c>=jc)throw new Error("Invalid index");s[2]==="'"&&(c+=jc),r=r.deriveChild(c)}return r}deriveChild(t){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let e=Bi(t);if(t>=jc){let c=this.privateKey;if(!c)throw new Error("Could not derive hardened child key");e=Or(new Uint8Array([0]),c,e)}else e=Or(this.pubKey,e);let r=_n(zr,this.chainCode,e),o=Id(r.slice(0,32)),s=r.slice(32);if(!hn.utils.isValidPrivateKey(o))throw new Error("Tweak bigger than curve order");let i={versions:this.versions,chainCode:s,depth:this.depth+1,parentFingerprint:this.fingerprint,index:t};try{if(this.privateKey){let c=mt(this.privKey+o,hn.CURVE.n);if(!hn.utils.isValidPrivateKey(c))throw new Error("The tweak was out of range or the resulted private key is invalid");i.privateKey=c}else{let c=Ii.fromHex(this.pubKey).add(Ii.fromPrivateKey(o));if(c.equals(Ii.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");i.publicKey=c.toRawBytes(!0)}return new n(i)}catch{return this.deriveChild(t+1)}}sign(t){if(!this.privateKey)throw new Error("No privateKey set!");return pn(t,32),hn.sign(t,this.privKey).toCompactRawBytes()}verify(t,e){if(pn(t,32),pn(e,64),!this.publicKey)throw new Error("No publicKey set!");let r;try{r=hn.Signature.fromCompact(e)}catch{return!1}return hn.verify(r,t,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(t,e){if(!this.chainCode)throw new Error("No chainCode set");return pn(e,33),Or(Bi(t),new Uint8Array([this.depth]),Bi(this.parentFingerprint),Bi(this.index),this.chainCode,e)}};var Wr=class Wr extends mo{constructor(e){super();let r=Ge.fromHexInput(e);if(r.toUint8Array().length!==Wr.LENGTH)throw new Error(`PublicKey length should be ${Wr.LENGTH}`);this.key=r}verifySignature(e){let{message:r,signature:o}=e;if(!(o instanceof Cn))return!1;let s=Ge.fromHexInput(r).toUint8Array(),i=Dr(s),c=o.toUint8Array();return bo.verify(c,i,this.key.toUint8Array())}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Wr(r)}static isPublicKey(e){return e instanceof Wr}};Wr.LENGTH=65;var vn=Wr,Sn=class Sn extends se{constructor(e){super();let r=Ge.fromHexInput(e);if(r.toUint8Array().length!==Sn.LENGTH)throw new Error(`PrivateKey length should be ${Sn.LENGTH}`);this.key=r}static generate(){let e=bo.utils.randomPrivateKey();return new Sn(e)}static fromDerivationPath(e,r){if(!fc(e))throw new Error(`Invalid derivation path ${e}`);return Sn.fromDerivationPathInner(e,ts(r))}static fromDerivationPathInner(e,r){let{privateKey:o}=Pi.fromMasterSeed(r).derive(e);if(o===null)throw new Error("Invalid key");return new Sn(o)}sign(e){let r=Ge.fromHexInput(e),o=Dr(r.toUint8Array()),s=bo.sign(o,this.key.toUint8Array());return new Cn(s.toCompactRawBytes())}publicKey(){let e=bo.getPublicKey(this.key.toUint8Array(),!1);return new vn(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Sn(r)}static isPrivateKey(e){return e instanceof Sn}};Sn.LENGTH=32;var mr=Sn,To=class To extends qt{constructor(e){super();let r=Ge.fromHexInput(e);if(r.toUint8Array().length!==To.LENGTH)throw new Error(`Signature length should be ${To.LENGTH}, received ${r.toUint8Array().length}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new To(r)}};To.LENGTH=64;var Cn=To;var Bt=class n extends gn{constructor(e){super();if(this.publicKey=e,e instanceof tt)this.variant=0;else if(e instanceof vn)this.variant=1;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:r,signature:o}=e;return o instanceof Et?this.publicKey.verifySignature({message:r,signature:o.signature}):!1}authKey(){return Ct.fromSchemeAndBytes({scheme:2,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.publicKey.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32(),o;switch(r){case 0:o=tt.deserialize(e);break;case 1:o=vn.deserialize(e);break;default:throw new Error(`Unknown variant index for AnyPublicKey: ${r}`)}return new n(o)}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof tt}isSecp256k1PublicKey(){return this.publicKey instanceof vn}},Et=class n extends qt{constructor(e){super();if(this.signature=e,e instanceof nt)this.variant=0;else if(e instanceof Cn)this.variant=1;else throw new Error("Unsupported signature type")}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32(),o;switch(r){case 0:o=nt.deserialize(e);break;case 1:o=Cn.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${r}`)}return new n(o)}};function Bd(n){let t=n;return t-=t>>1&1431655765,t=(t&858993459)+(t>>2&858993459),(t+(t>>4)&252645135)*16843009>>24}var is=class n extends gn{constructor(e){super();let{publicKeys:r,signaturesRequired:o}=e;if(o<1)throw new Error("The number of required signatures needs to be greater than 0");if(r.length<o)throw new Error(`Provided ${r.length} public keys is smaller than the ${o} required signatures`);this.publicKeys=r.map(s=>s instanceof Bt?s:new Bt(s)),this.signaturesRequired=o}verifySignature(e){throw new Error("not implemented")}authKey(){return Ct.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let r=e.deserializeVector(Bt),o=e.deserializeU8();return new n({publicKeys:r,signaturesRequired:o})}createBitmap(e){let{bits:r}=e,o=128,s=new Uint8Array([0,0,0,0]),i=new Set;return r.forEach((c,u)=>{if(u+1>this.publicKeys.length)throw new Error(`Signature index ${u+1} is out of public keys range, ${this.publicKeys.length}.`);if(i.has(c))throw new Error(`Duplicate bit ${c} detected.`);i.add(c);let d=Math.floor(c/8),y=s[d];y|=o>>c%8,s[d]=y}),s}},Wt=class Wt extends qt{constructor(e){super();let{signatures:r,bitmap:o}=e;if(r.length>Wt.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${Wt.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=r.map(i=>i instanceof Et?i:new Et(i)),!(o instanceof Uint8Array))this.bitmap=Wt.createBitmap({bits:o});else{if(o.length!==Wt.BITMAP_LEN)throw new Error(`"bitmap" length should be ${Wt.BITMAP_LEN}`);this.bitmap=o}let s=this.bitmap.reduce((i,c)=>i+Bd(c),0);if(s!==this.signatures.length)throw new Error(`Expecting ${s} signatures from the bitmap, but got ${this.signatures.length}`)}static createBitmap(e){let{bits:r}=e,o=128,s=new Uint8Array([0,0,0,0]),i=new Set;return r.forEach(c=>{if(c>=Wt.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${Wt.MAX_SIGNATURES_SUPPORTED-1}.`);if(i.has(c))throw new Error("Duplicate bits detected.");i.add(c);let u=Math.floor(c/8),d=s[u];d|=o>>c%8,s[u]=d}),s}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let r=e.deserializeBytes(),o=r.reduce((i,c)=>i+Bd(c),0),s=[];for(let i=0;i<o;i+=1){let c=Et.deserialize(e);s.push(c)}return new Wt({signatures:s,bitmap:r})}};Wt.BITMAP_LEN=4,Wt.MAX_SIGNATURES_SUPPORTED=Wt.BITMAP_LEN*8;var Wc=Wt;var Dt=class extends se{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return An.load(t);case 1:return as.load(t);case 2:return on.load(t);case 3:return Qr.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof An}isMultiEd25519(){return this instanceof as}isSingleKey(){return this instanceof on}isMultiKey(){return this instanceof Qr}},An=class n extends Dt{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=tt.deserialize(e),o=nt.deserialize(e);return new n(r,o)}},as=class n extends Dt{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=Mr.deserialize(e),o=cr.deserialize(e);return new n(r,o)}},on=class n extends Dt{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=Bt.deserialize(e),o=Et.deserialize(e);return new n(r,o)}},Qr=class n extends Dt{constructor(e,r,o){super();this.public_keys=e,this.signatures=r,this.signatures_bitmap=o}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),e.serializeVector(this.signatures),e.serializeBytes(this.signatures_bitmap)}static load(e){let r=is.deserialize(e),o=e.deserializeVector(Et),s=e.deserializeBytes();return new n(r,o,s)}};var Yr=class n{constructor(t){this.signingScheme=0;let{privateKey:e,address:r}=t;this.privateKey=e,this.publicKey=e.publicKey(),this.accountAddress=r?z.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let t=Kt.generate();return new n({privateKey:t})}static fromDerivationPath(t){let{path:e,mnemonic:r}=t,o=Kt.fromDerivationPath(e,r);return new n({privateKey:o})}verifySignature(t){return this.publicKey.verifySignature(t)}signWithAuthenticator(t){let e=this.privateKey.sign(t);return new An(this.publicKey,e)}sign(t){return this.signWithAuthenticator(t).signature}};var Zr=class n{constructor(t){this.signingScheme=2;let{privateKey:e,address:r}=t;this.privateKey=e,this.publicKey=new Bt(e.publicKey()),this.accountAddress=r?z.from(r):this.publicKey.authKey().derivedAddress()}static generate(t={}){let{scheme:e=0}=t,r;switch(e){case 0:r=Kt.generate();break;case 2:r=mr.generate();break;default:throw new Error(`Unsupported signature scheme ${e}`)}return new n({privateKey:r})}static fromDerivationPath(t){let{scheme:e=0,path:r,mnemonic:o}=t,s;switch(e){case 0:s=Kt.fromDerivationPath(r,o);break;case 2:s=mr.fromDerivationPath(r,o);break;default:throw new Error(`Unsupported signature scheme ${e}`)}return new n({privateKey:s})}verifySignature(t){return this.publicKey.verifySignature(t)}signWithAuthenticator(t){let e=this.privateKey.sign(t),r=new Et(e);return new on(this.publicKey,r)}sign(t){return this.signWithAuthenticator(t).signature}};var Wn=class{static generate(t={}){let{scheme:e=0,legacy:r=!0}=t;return e===0&&r?Yr.generate():Zr.generate({scheme:e})}static fromPrivateKey(t){let{privateKey:e,address:r,legacy:o=!0}=t;return e instanceof Kt&&o?new Yr({privateKey:e,address:r}):new Zr({privateKey:e,address:r})}static fromPrivateKeyAndAddress(t){return this.fromPrivateKey(t)}static fromDerivationPath(t){let{scheme:e=0,mnemonic:r,path:o,legacy:s=!0}=t;return e===0&&s?Yr.fromDerivationPath({mnemonic:r,path:o}):Zr.fromDerivationPath({scheme:e,mnemonic:r,path:o})}static authKey(t){let{publicKey:e}=t;return e.authKey()}verifySignature(t){return this.publicKey.verifySignature(t)}};var Ry=`
2
2
  fragment TokenActivitiesFields on token_activities_v2 {
3
3
  after_value
4
4
  before_value
@@ -16,7 +16,7 @@
16
16
  transaction_version
17
17
  type
18
18
  }
19
- `,vy=`
19
+ `,Oy=`
20
20
  fragment AnsTokenFragment on current_aptos_names {
21
21
  domain
22
22
  expiration_timestamp
@@ -26,7 +26,7 @@
26
26
  is_primary
27
27
  owner_address
28
28
  }
29
- `,Pi=`
29
+ `,Ui=`
30
30
  fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {
31
31
  token_standard
32
32
  token_properties_mutated_v1
@@ -54,6 +54,7 @@
54
54
  token_properties
55
55
  token_standard
56
56
  token_uri
57
+ decimals
57
58
  current_collection {
58
59
  collection_id
59
60
  collection_name
@@ -72,7 +73,7 @@
72
73
  }
73
74
  }
74
75
  }
75
- `,Sd=`
76
+ `,Pd=`
76
77
  query getAccountCoinsCount($address: String) {
77
78
  current_fungible_asset_balances_aggregate(
78
79
  where: {owner_address: {_eq: $address}}
@@ -82,7 +83,7 @@
82
83
  }
83
84
  }
84
85
  }
85
- `,vd=`
86
+ `,Ud=`
86
87
  query getAccountCoinsData($where_condition: current_fungible_asset_balances_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_fungible_asset_balances_order_by!]) {
87
88
  current_fungible_asset_balances(
88
89
  where: $where_condition
@@ -115,7 +116,7 @@
115
116
  }
116
117
  }
117
118
  }
118
- `,Cd=`
119
+ `,Rd=`
119
120
  query getAccountCollectionsWithOwnedTokens($where_condition: current_collection_ownership_v2_view_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_collection_ownership_v2_view_order_by!]) {
120
121
  current_collection_ownership_v2_view(
121
122
  where: $where_condition
@@ -149,7 +150,7 @@
149
150
  single_token_uri
150
151
  }
151
152
  }
152
- `,Id=`
153
+ `,Od=`
153
154
  query getAccountOwnedObjects($where_condition: current_objects_bool_exp, $offset: Int, $limit: Int, $order_by: [current_objects_order_by!]) {
154
155
  current_objects(
155
156
  where: $where_condition
@@ -166,7 +167,7 @@
166
167
  is_deleted
167
168
  }
168
169
  }
169
- `,Bd=`
170
+ `,Nd=`
170
171
  query getAccountOwnedTokens($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
171
172
  current_token_ownerships_v2(
172
173
  where: $where_condition
@@ -177,7 +178,7 @@
177
178
  ...CurrentTokenOwnershipFields
178
179
  }
179
180
  }
180
- ${Pi}`,Lw=`
181
+ ${Ui}`,Z1=`
181
182
  query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
182
183
  current_token_ownerships_v2(
183
184
  where: $where_condition
@@ -188,7 +189,7 @@
188
189
  ...CurrentTokenOwnershipFields
189
190
  }
190
191
  }
191
- ${Pi}`,Ud=`
192
+ ${Ui}`,kd=`
192
193
  query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
193
194
  current_token_ownerships_v2(
194
195
  where: $where_condition
@@ -199,7 +200,7 @@
199
200
  ...CurrentTokenOwnershipFields
200
201
  }
201
202
  }
202
- ${Pi}`,Pd=`
203
+ ${Ui}`,Dd=`
203
204
  query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {
204
205
  current_token_ownerships_v2_aggregate(
205
206
  where: $where_condition
@@ -211,7 +212,7 @@
211
212
  }
212
213
  }
213
214
  }
214
- `,Rd=`
215
+ `,zd=`
215
216
  query getAccountTransactionsCount($address: String) {
216
217
  account_transactions_aggregate(where: {account_address: {_eq: $address}}) {
217
218
  aggregate {
@@ -219,13 +220,13 @@
219
220
  }
220
221
  }
221
222
  }
222
- `,Od=`
223
+ `,Gd=`
223
224
  query getChainTopUserTransactions($limit: Int) {
224
225
  user_transactions(limit: $limit, order_by: {version: desc}) {
225
226
  version
226
227
  }
227
228
  }
228
- `,Nd=`
229
+ `,Qc=`
229
230
  query getCollectionData($where_condition: current_collections_v2_bool_exp!) {
230
231
  current_collections_v2(where: $where_condition) {
231
232
  collection_id
@@ -244,7 +245,7 @@
244
245
  uri
245
246
  }
246
247
  }
247
- `,kd=`
248
+ `,Md=`
248
249
  query getCurrentFungibleAssetBalances($where_condition: current_fungible_asset_balances_bool_exp, $offset: Int, $limit: Int) {
249
250
  current_fungible_asset_balances(
250
251
  where: $where_condition
@@ -262,7 +263,7 @@
262
263
  token_standard
263
264
  }
264
265
  }
265
- `,Dd=`
266
+ `,Ld=`
266
267
  query getDelegatedStakingActivities($delegatorAddress: String, $poolAddress: String) {
267
268
  delegated_staking_activities(
268
269
  where: {delegator_address: {_eq: $delegatorAddress}, pool_address: {_eq: $poolAddress}}
@@ -275,7 +276,7 @@
275
276
  transaction_version
276
277
  }
277
278
  }
278
- `,zd=`
279
+ `,qd=`
279
280
  query getEvents($where_condition: events_bool_exp, $offset: Int, $limit: Int, $order_by: [events_order_by!]) {
280
281
  events(
281
282
  where: $where_condition
@@ -294,7 +295,7 @@
294
295
  indexed_type
295
296
  }
296
297
  }
297
- `,Md=`
298
+ `,Kd=`
298
299
  query getFungibleAssetActivities($where_condition: fungible_asset_activities_bool_exp, $offset: Int, $limit: Int) {
299
300
  fungible_asset_activities(
300
301
  where: $where_condition
@@ -319,7 +320,7 @@
319
320
  type
320
321
  }
321
322
  }
322
- `,Gd=`
323
+ `,Fd=`
323
324
  query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_exp, $offset: Int, $limit: Int) {
324
325
  fungible_asset_metadata(where: $where_condition, offset: $offset, limit: $limit) {
325
326
  icon_uri
@@ -336,7 +337,7 @@
336
337
  token_standard
337
338
  }
338
339
  }
339
- `,wo=`
340
+ `,Eo=`
340
341
  query getNames($offset: Int, $limit: Int, $where_condition: current_aptos_names_bool_exp, $order_by: [current_aptos_names_order_by!]) {
341
342
  current_aptos_names(
342
343
  limit: $limit
@@ -347,14 +348,14 @@
347
348
  ...AnsTokenFragment
348
349
  }
349
350
  }
350
- ${vy}`,Vc=`
351
+ ${Oy}`,Yc=`
351
352
  query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp, $order_by: [num_active_delegator_per_pool_order_by!]) {
352
353
  num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
353
354
  num_active_delegator
354
355
  pool_address
355
356
  }
356
357
  }
357
- `,jc=`
358
+ `,Zc=`
358
359
  query getProcessorStatus($where_condition: processor_status_bool_exp) {
359
360
  processor_status(where: $where_condition) {
360
361
  last_success_version
@@ -362,7 +363,7 @@
362
363
  last_updated
363
364
  }
364
365
  }
365
- `,Ld=`
366
+ `,Hd=`
366
367
  query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {
367
368
  token_activities_v2(
368
369
  where: $where_condition
@@ -373,7 +374,7 @@
373
374
  ...TokenActivitiesFields
374
375
  }
375
376
  }
376
- ${Sy}`,Wc=`
377
+ ${Ry}`,Xc=`
377
378
  query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
378
379
  current_token_ownerships_v2(
379
380
  where: $where_condition
@@ -384,7 +385,7 @@
384
385
  ...CurrentTokenOwnershipFields
385
386
  }
386
387
  }
387
- ${Pi}`,qd=`
388
+ ${Ui}`,$d=`
388
389
  query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
389
390
  current_token_datas_v2(
390
391
  where: $where_condition
@@ -405,6 +406,7 @@
405
406
  token_properties
406
407
  token_standard
407
408
  token_uri
409
+ decimals
408
410
  current_collection {
409
411
  collection_id
410
412
  collection_name
@@ -423,11 +425,11 @@
423
425
  }
424
426
  }
425
427
  }
426
- `;async function Ri(n){let{aptosConfig:t}=n,{data:e}=await Mt({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function Kd(n){let{aptosConfig:t,ledgerVersion:e,options:r}=n,{data:o}=await Mt({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:r?.withTransactions}});return o}async function Fd(n){let{aptosConfig:t,blockHeight:e,options:r}=n,{data:o}=await Mt({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:r?.withTransactions}});return o}async function Oi(n){let{aptosConfig:t,handle:e,data:r,options:o}=n;return(await Or({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:o?.ledgerVersion},body:r})).data}async function Ar(n){let{aptosConfig:t,payload:e,options:r}=n,{data:o}=await Or({aptosConfig:t,originMethod:"view",path:"view",params:{ledger_version:r?.ledgerVersion},body:{function:e.function,type_arguments:e.typeArguments??[],arguments:e.functionArguments??[]}});return o}async function Hd(n){let{aptosConfig:t,limit:e}=n;return(await ve({aptosConfig:t,query:{query:Od,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function ve(n){let{aptosConfig:t,query:e,originMethod:r}=n,{data:o}=await Wa({aptosConfig:t,originMethod:r??"queryIndexer",path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return o}async function Cy(n){let{aptosConfig:t}=n;return(await ve({aptosConfig:t,query:{query:jc},originMethod:"getProcessorStatuses"})).processor_status}async function Ni(n){let t=await Cy({aptosConfig:n.aptosConfig});return BigInt(t[0].last_success_version)}async function ki(n){let{aptosConfig:t,processorType:e}=n,r={processor:{_eq:e.valueOf()}};return(await ve({aptosConfig:t,query:{query:jc,variables:{where_condition:r}},originMethod:"getProcessorStatus"})).processor_status[0]}var Qc=new Map;function To(n,t,e){return async(...r)=>{if(Qc.has(t)){let{value:s,timestamp:i}=Qc.get(t);if(e===void 0||Date.now()-i<=e)return s}let o=await n(...r);return Qc.set(t,{value:o,timestamp:Date.now()}),o}}var En=class n extends fn{constructor(e){super();this.signature=e}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(e){if(this.signature instanceof rt)e.serializeU32AsUleb128(0),this.signature.serialize(e);else if(this.signature instanceof jn)e.serializeU32AsUleb128(1),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(rt.load(e));case 1:return new n(jn.load(e));default:throw new Error(`Unknown variant index for AnySignature: ${r}`)}}};async function Sn(n){let{aptosConfig:t,accountAddress:e}=n,{data:r}=await Mt({aptosConfig:t,originMethod:"getInfo",path:`accounts/${M.from(e).toString()}`});return r}async function jd(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Rr({aptosConfig:t,originMethod:"getModules",path:`accounts/${M.from(e).toString()}/modules`,params:{ledger_version:r?.ledgerVersion,start:r?.offset,limit:r?.limit??1e3}})}async function Di(n){return n.options?.ledgerVersion!==void 0?$d(n):To(async()=>$d(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function $d(n){let{aptosConfig:t,accountAddress:e,moduleName:r,options:o}=n,{data:s}=await Mt({aptosConfig:t,originMethod:"getModule",path:`accounts/${M.from(e).toString()}/module/${r}`,params:{ledger_version:o?.ledgerVersion}});return s}async function Wd(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Rr({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${M.from(e).toString()}/transactions`,params:{start:r?.offset,limit:r?.limit}})}async function Qd(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Rr({aptosConfig:t,originMethod:"getResources",path:`accounts/${M.from(e).toString()}/resources`,params:{ledger_version:r?.ledgerVersion,start:r?.offset,limit:r?.limit??999}})}async function Yc(n){let{aptosConfig:t,accountAddress:e,resourceType:r,options:o}=n,{data:s}=await Mt({aptosConfig:t,originMethod:"getResource",path:`accounts/${M.from(e).toString()}/resource/${r}`,params:{ledger_version:o?.ledgerVersion}});return s.data}async function Zc(n){let{aptosConfig:t,authenticationKey:e,options:r}=n,o=await Yc({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:s}}=o,i=M.from(e);try{let c=await Oi({aptosConfig:t,handle:s,data:{key:i.toString(),key_type:"address",value_type:"address"},options:r});return M.from(c)}catch(c){if(c instanceof bn&&c.data.error_code==="table_item_not_found")return i;throw c}}async function Yd(n){let{aptosConfig:t,accountAddress:e}=n,o={owner_address:{_eq:M.from(e).toStringLong()},amount:{_gt:0}},i=await ve({aptosConfig:t,query:{query:Pd,variables:{where_condition:o}},originMethod:"getAccountTokensCount"});return i.current_token_ownerships_v2_aggregate.aggregate?i.current_token_ownerships_v2_aggregate.aggregate.count:0}async function Zd(n){let{aptosConfig:t,accountAddress:e,options:r}=n,s={owner_address:{_eq:M.from(e).toStringLong()},amount:{_gt:0}};r?.tokenStandard&&(s.token_standard={_eq:r?.tokenStandard});let i={query:Bd,variables:{where_condition:s,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await ve({aptosConfig:t,query:i,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Xd(n){let{aptosConfig:t,accountAddress:e,collectionAddress:r,options:o}=n,s=M.from(e).toStringLong(),i=M.from(r).toStringLong(),c={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:i}},amount:{_gt:0}};o?.tokenStandard&&(c.token_standard={_eq:o?.tokenStandard});let u={query:Ud,variables:{where_condition:c,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await ve({aptosConfig:t,query:u,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function Jd(n){let{aptosConfig:t,accountAddress:e,options:r}=n,s={owner_address:{_eq:M.from(e).toStringLong()},amount:{_gt:0}};r?.tokenStandard&&(s.current_collection={token_standard:{_eq:r?.tokenStandard}});let i={query:Cd,variables:{where_condition:s,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await ve({aptosConfig:t,query:i,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function el(n){let{aptosConfig:t,accountAddress:e}=n,r=M.from(e).toStringLong(),s=await ve({aptosConfig:t,query:{query:Rd,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return s.account_transactions_aggregate.aggregate?s.account_transactions_aggregate.aggregate.count:0}async function tl(n){let{aptosConfig:t,accountAddress:e,coinType:r}=n,o=M.from(e).toStringLong(),s=await Xc({aptosConfig:t,accountAddress:o,options:{where:{asset_type:{_eq:r}}}});return s[0]?s[0].amount:0}async function Xc(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o=M.from(e).toStringLong(),s={...r?.where,owner_address:{_eq:o}},i={query:vd,variables:{where_condition:s,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await ve({aptosConfig:t,query:i,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function nl(n){let{aptosConfig:t,accountAddress:e}=n,r=M.from(e).toStringLong(),s=await ve({aptosConfig:t,query:{query:Sd,variables:{address:r}},originMethod:"getAccountCoinsCount"});if(!s.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return s.current_fungible_asset_balances_aggregate.aggregate.count}async function rl(n){let{aptosConfig:t,accountAddress:e,options:r}=n,s={owner_address:{_eq:M.from(e).toStringLong()}},i={query:Id,variables:{where_condition:s,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await ve({aptosConfig:t,query:i,originMethod:"getAccountOwnedObjects"})).current_objects}async function ol(n){let{aptosConfig:t,privateKey:e}=n,r=new Ze(e.publicKey());if(e instanceof Vn){let s=mn.fromPublicKeyAndScheme({publicKey:r,scheme:2}).derivedAddress();return Qn.fromPrivateKeyAndAddress({privateKey:e,address:s})}if(e instanceof Ln){let o=mn.fromPublicKeyAndScheme({publicKey:r,scheme:2});if(await Vd({authKey:o,aptosConfig:t})){let u=o.derivedAddress();return Qn.fromPrivateKeyAndAddress({privateKey:e,address:u,legacy:!1})}let i=mn.fromPublicKeyAndScheme({publicKey:r,scheme:0});if(await Vd({authKey:i,aptosConfig:t})){let u=i.derivedAddress();return Qn.fromPrivateKeyAndAddress({privateKey:e,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function Vd(n){let{aptosConfig:t,authKey:e}=n,r=await Zc({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await Sn({aptosConfig:t,accountAddress:r}),!0}catch(o){if(o.status===404)return!1;throw new Error(`Error while looking for an account info ${r.toString()}`)}}async function xr(n){return new Promise(t=>{setTimeout(t,n)})}async function sl(n){let{aptosConfig:t,options:e}=n;return Rr({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:e?.offset,limit:e?.limit}})}async function Mi(n){let{aptosConfig:t}=n;return To(async()=>{let{data:e}=await Mt({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function il(n){let{aptosConfig:t,ledgerVersion:e}=n,{data:r}=await Mt({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return r}async function Gi(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await Mt({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return r}async function al(n){let{aptosConfig:t,transactionHash:e}=n;try{return(await Gi({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(r){if(r?.status===404)return!0;throw r}}async function _o(n){let{aptosConfig:t,transactionHash:e,options:r}=n,o=r?.timeoutSecs??Wo,s=r?.checkSuccess??!0,i=!0,c=0,u,d,y=200,g=1.5;for(;i&&!(c>=o);){try{if(u=await Gi({aptosConfig:t,transactionHash:e}),i=u.type==="pending_transaction",!i)break}catch(T){if(!(T instanceof bn)||(d=T,T.status!==404&&T.status>=400&&T.status<500))throw T}await xr(y),c+=y/1e3,y*=g}if(u===void 0)throw d||new zi(`Fetching transaction ${e} failed and timed out after ${o} seconds`,u);if(u.type==="pending_transaction")throw new zi(`Transaction ${e} timed out in pending state after ${o} seconds`,u);if(!s)return u;if(!u.success)throw new Jc(`Transaction ${e} failed with an error: ${u.vm_status}`,u);return u}async function Li(n){let{aptosConfig:t,processorType:e}=n,r=BigInt(n.minimumLedgerVersion),o=3e3,s=new Date().getTime(),i=BigInt(-1);for(;i<r;){if(new Date().getTime()-s>o)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(e===void 0?i=await Ni({aptosConfig:t}):i=(await ki({aptosConfig:t,processorType:e})).last_success_version,i>=r)break;await xr(200)}}var zi=class extends Error{constructor(e,r){super(e);this.lastSubmittedTransaction=r}},Jc=class extends Error{constructor(e,r){super(e);this.transaction=r}};async function Ge(n){n.minimumLedgerVersion!==void 0&&await Li({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}var ss=class{constructor(t){this.config=t}async getAccountInfo(t){return Sn({aptosConfig:this.config,...t})}async getAccountModules(t){return jd({aptosConfig:this.config,...t})}async getAccountModule(t){return Di({aptosConfig:this.config,...t})}async getAccountTransactions(t){return Wd({aptosConfig:this.config,...t})}async getAccountResources(t){return Qd({aptosConfig:this.config,...t})}async getAccountResource(t){return Yc({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return Zc({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return await Ge({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),Yd({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return await Ge({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Zd({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return await Ge({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Xd({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return await Ge({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Jd({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return await Ge({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),el({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return await Ge({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Xc({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return await Ge({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),nl({aptosConfig:this.config,...t})}async getAccountAPTAmount(t){return this.getAccountCoinAmount({coinType:Qo,...t})}async getAccountCoinAmount(t){return await Ge({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),tl({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return await Ge({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),rl({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return ol({aptosConfig:this.config,...t})}};function is(n,t){return function(){return n.apply(t,arguments)}}var{toString:Iy}=Object.prototype,{getPrototypeOf:nu}=Object,Ki=(n=>t=>{let e=Iy.call(t);return n[e]||(n[e]=e.slice(8,-1).toLowerCase())})(Object.create(null)),vn=n=>(n=n.toLowerCase(),t=>Ki(t)===n),Fi=n=>t=>typeof t===n,{isArray:Eo}=Array,as=Fi("undefined");function By(n){return n!==null&&!as(n)&&n.constructor!==null&&!as(n.constructor)&&tn(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}var fl=vn("ArrayBuffer");function Uy(n){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(n):t=n&&n.buffer&&fl(n.buffer),t}var Py=Fi("string"),tn=Fi("function"),dl=Fi("number"),Hi=n=>n!==null&&typeof n=="object",Ry=n=>n===!0||n===!1,qi=n=>{if(Ki(n)!=="object")return!1;let t=nu(n);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},Oy=vn("Date"),Ny=vn("File"),ky=vn("Blob"),Dy=vn("FileList"),zy=n=>Hi(n)&&tn(n.pipe),My=n=>{let t;return n&&(typeof FormData=="function"&&n instanceof FormData||tn(n.append)&&((t=Ki(n))==="formdata"||t==="object"&&tn(n.toString)&&n.toString()==="[object FormData]"))},Gy=vn("URLSearchParams"),Ly=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function cs(n,t,{allOwnKeys:e=!1}={}){if(n===null||typeof n>"u")return;let r,o;if(typeof n!="object"&&(n=[n]),Eo(n))for(r=0,o=n.length;r<o;r++)t.call(null,n[r],r,n);else{let s=e?Object.getOwnPropertyNames(n):Object.keys(n),i=s.length,c;for(r=0;r<i;r++)c=s[r],t.call(null,n[c],c,n)}}function ll(n,t){t=t.toLowerCase();let e=Object.keys(n),r=e.length,o;for(;r-- >0;)if(o=e[r],t===o.toLowerCase())return o;return null}var pl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,gl=n=>!as(n)&&n!==pl;function tu(){let{caseless:n}=gl(this)&&this||{},t={},e=(r,o)=>{let s=n&&ll(t,o)||o;qi(t[s])&&qi(r)?t[s]=tu(t[s],r):qi(r)?t[s]=tu({},r):Eo(r)?t[s]=r.slice():t[s]=r};for(let r=0,o=arguments.length;r<o;r++)arguments[r]&&cs(arguments[r],e);return t}var qy=(n,t,e,{allOwnKeys:r}={})=>(cs(t,(o,s)=>{e&&tn(o)?n[s]=is(o,e):n[s]=o},{allOwnKeys:r}),n),Ky=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),Fy=(n,t,e,r)=>{n.prototype=Object.create(t.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:t.prototype}),e&&Object.assign(n.prototype,e)},Hy=(n,t,e,r)=>{let o,s,i,c={};if(t=t||{},n==null)return t;do{for(o=Object.getOwnPropertyNames(n),s=o.length;s-- >0;)i=o[s],(!r||r(i,n,t))&&!c[i]&&(t[i]=n[i],c[i]=!0);n=e!==!1&&nu(n)}while(n&&(!e||e(n,t))&&n!==Object.prototype);return t},$y=(n,t,e)=>{n=String(n),(e===void 0||e>n.length)&&(e=n.length),e-=t.length;let r=n.indexOf(t,e);return r!==-1&&r===e},Vy=n=>{if(!n)return null;if(Eo(n))return n;let t=n.length;if(!dl(t))return null;let e=new Array(t);for(;t-- >0;)e[t]=n[t];return e},jy=(n=>t=>n&&t instanceof n)(typeof Uint8Array<"u"&&nu(Uint8Array)),Wy=(n,t)=>{let r=(n&&n[Symbol.iterator]).call(n),o;for(;(o=r.next())&&!o.done;){let s=o.value;t.call(n,s[0],s[1])}},Qy=(n,t)=>{let e,r=[];for(;(e=n.exec(t))!==null;)r.push(e);return r},Yy=vn("HTMLFormElement"),Zy=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,r,o){return r.toUpperCase()+o}),cl=(({hasOwnProperty:n})=>(t,e)=>n.call(t,e))(Object.prototype),Xy=vn("RegExp"),ml=(n,t)=>{let e=Object.getOwnPropertyDescriptors(n),r={};cs(e,(o,s)=>{let i;(i=t(o,s,n))!==!1&&(r[s]=i||o)}),Object.defineProperties(n,r)},Jy=n=>{ml(n,(t,e)=>{if(tn(n)&&["arguments","caller","callee"].indexOf(e)!==-1)return!1;let r=n[e];if(tn(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+e+"'")})}})},eh=(n,t)=>{let e={},r=o=>{o.forEach(s=>{e[s]=!0})};return Eo(n)?r(n):r(String(n).split(t)),e},th=()=>{},nh=(n,t)=>(n=+n,Number.isFinite(n)?n:t),eu="abcdefghijklmnopqrstuvwxyz",ul="0123456789",yl={DIGIT:ul,ALPHA:eu,ALPHA_DIGIT:eu+eu.toUpperCase()+ul},rh=(n=16,t=yl.ALPHA_DIGIT)=>{let e="",{length:r}=t;for(;n--;)e+=t[Math.random()*r|0];return e};function oh(n){return!!(n&&tn(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}var sh=n=>{let t=new Array(10),e=(r,o)=>{if(Hi(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[o]=r;let s=Eo(r)?[]:{};return cs(r,(i,c)=>{let u=e(i,o+1);!as(u)&&(s[c]=u)}),t[o]=void 0,s}}return r};return e(n,0)},ih=vn("AsyncFunction"),ah=n=>n&&(Hi(n)||tn(n))&&tn(n.then)&&tn(n.catch),B={isArray:Eo,isArrayBuffer:fl,isBuffer:By,isFormData:My,isArrayBufferView:Uy,isString:Py,isNumber:dl,isBoolean:Ry,isObject:Hi,isPlainObject:qi,isUndefined:as,isDate:Oy,isFile:Ny,isBlob:ky,isRegExp:Xy,isFunction:tn,isStream:zy,isURLSearchParams:Gy,isTypedArray:jy,isFileList:Dy,forEach:cs,merge:tu,extend:qy,trim:Ly,stripBOM:Ky,inherits:Fy,toFlatObject:Hy,kindOf:Ki,kindOfTest:vn,endsWith:$y,toArray:Vy,forEachEntry:Wy,matchAll:Qy,isHTMLForm:Yy,hasOwnProperty:cl,hasOwnProp:cl,reduceDescriptors:ml,freezeMethods:Jy,toObjectSet:eh,toCamelCase:Zy,noop:th,toFiniteNumber:nh,findKey:ll,global:pl,isContextDefined:gl,ALPHABET:yl,generateString:rh,isSpecCompliantForm:oh,toJSONObject:sh,isAsyncFn:ih,isThenable:ah};function So(n,t,e,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",t&&(this.code=t),e&&(this.config=e),r&&(this.request=r),o&&(this.response=o)}B.inherits(So,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:B.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var hl=So.prototype,Al={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{Al[n]={value:n}});Object.defineProperties(So,Al);Object.defineProperty(hl,"isAxiosError",{value:!0});So.from=(n,t,e,r,o,s)=>{let i=Object.create(hl);return B.toFlatObject(n,i,function(u){return u!==Error.prototype},c=>c!=="isAxiosError"),So.call(i,n.message,t,e,r,o),i.cause=n,i.name=n.name,s&&Object.assign(i,s),i};var Se=So;var $i=null;function ru(n){return B.isPlainObject(n)||B.isArray(n)}function bl(n){return B.endsWith(n,"[]")?n.slice(0,-2):n}function xl(n,t,e){return n?n.concat(t).map(function(o,s){return o=bl(o),!e&&s?"["+o+"]":o}).join(e?".":""):t}function ch(n){return B.isArray(n)&&!n.some(ru)}var uh=B.toFlatObject(B,{},null,function(t){return/^is[A-Z]/.test(t)});function fh(n,t,e){if(!B.isObject(n))throw new TypeError("target must be an object");t=t||new($i||FormData),e=B.toFlatObject(e,{metaTokens:!0,dots:!1,indexes:!1},!1,function(h,w){return!B.isUndefined(w[h])});let r=e.metaTokens,o=e.visitor||y,s=e.dots,i=e.indexes,u=(e.Blob||typeof Blob<"u"&&Blob)&&B.isSpecCompliantForm(t);if(!B.isFunction(o))throw new TypeError("visitor must be a function");function d(b){if(b===null)return"";if(B.isDate(b))return b.toISOString();if(!u&&B.isBlob(b))throw new Se("Blob is not supported. Use a Buffer instead.");return B.isArrayBuffer(b)||B.isTypedArray(b)?u&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function y(b,h,w){let v=b;if(b&&!w&&typeof b=="object"){if(B.endsWith(h,"{}"))h=r?h:h.slice(0,-2),b=JSON.stringify(b);else if(B.isArray(b)&&ch(b)||(B.isFileList(b)||B.endsWith(h,"[]"))&&(v=B.toArray(b)))return h=bl(h),v.forEach(function(P,$){!(B.isUndefined(P)||P===null)&&t.append(i===!0?xl([h],$,s):i===null?h:h+"[]",d(P))}),!1}return ru(b)?!0:(t.append(xl(w,h,s),d(b)),!1)}let g=[],T=Object.assign(uh,{defaultVisitor:y,convertValue:d,isVisitable:ru});function S(b,h){if(!B.isUndefined(b)){if(g.indexOf(b)!==-1)throw Error("Circular reference detected in "+h.join("."));g.push(b),B.forEach(b,function(v,k){(!(B.isUndefined(v)||v===null)&&o.call(t,v,B.isString(k)?k.trim():k,h,T))===!0&&S(v,h?h.concat(k):[k])}),g.pop()}}if(!B.isObject(n))throw new TypeError("data must be an object");return S(n),t}var br=fh;function wl(n){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Tl(n,t){this._pairs=[],n&&br(n,this,t)}var _l=Tl.prototype;_l.append=function(t,e){this._pairs.push([t,e])};_l.toString=function(t){let e=t?function(r){return t.call(this,r,wl)}:wl;return this._pairs.map(function(o){return e(o[0])+"="+e(o[1])},"").join("&")};var Vi=Tl;function dh(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function us(n,t,e){if(!t)return n;let r=e&&e.encode||dh,o=e&&e.serialize,s;if(o?s=o(t,e):s=B.isURLSearchParams(t)?t.toString():new Vi(t,e).toString(r),s){let i=n.indexOf("#");i!==-1&&(n=n.slice(0,i)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}var ou=class{constructor(){this.handlers=[]}use(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){B.forEach(this.handlers,function(r){r!==null&&t(r)})}},su=ou;var ji={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var El=typeof URLSearchParams<"u"?URLSearchParams:Vi;var Sl=typeof FormData<"u"?FormData:null;var vl=typeof Blob<"u"?Blob:null;var Cl={isBrowser:!0,classes:{URLSearchParams:El,FormData:Sl,Blob:vl},protocols:["http","https","file","blob","url","data"]};var iu={};$s(iu,{hasBrowserEnv:()=>Il,hasStandardBrowserEnv:()=>lh,hasStandardBrowserWebWorkerEnv:()=>ph});var Il=typeof window<"u"&&typeof document<"u",lh=(n=>Il&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),ph=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function";var It={...iu,...Cl};function au(n,t){return br(n,new It.classes.URLSearchParams,Object.assign({visitor:function(e,r,o,s){return It.isNode&&B.isBuffer(e)?(this.append(r,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function gh(n){return B.matchAll(/\w+|\[(\w*)]/g,n).map(t=>t[0]==="[]"?"":t[1]||t[0])}function mh(n){let t={},e=Object.keys(n),r,o=e.length,s;for(r=0;r<o;r++)s=e[r],t[s]=n[s];return t}function yh(n){function t(e,r,o,s){let i=e[s++],c=Number.isFinite(+i),u=s>=e.length;return i=!i&&B.isArray(o)?o.length:i,u?(B.hasOwnProp(o,i)?o[i]=[o[i],r]:o[i]=r,!c):((!o[i]||!B.isObject(o[i]))&&(o[i]=[]),t(e,r,o[i],s)&&B.isArray(o[i])&&(o[i]=mh(o[i])),!c)}if(B.isFormData(n)&&B.isFunction(n.entries)){let e={};return B.forEachEntry(n,(r,o)=>{t(gh(r),o,e,0)}),e}return null}var Wi=yh;function hh(n,t,e){if(B.isString(n))try{return(t||JSON.parse)(n),B.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(e||JSON.stringify)(n)}var cu={transitional:ji,adapter:["xhr","http"],transformRequest:[function(t,e){let r=e.getContentType()||"",o=r.indexOf("application/json")>-1,s=B.isObject(t);if(s&&B.isHTMLForm(t)&&(t=new FormData(t)),B.isFormData(t))return o&&o?JSON.stringify(Wi(t)):t;if(B.isArrayBuffer(t)||B.isBuffer(t)||B.isStream(t)||B.isFile(t)||B.isBlob(t))return t;if(B.isArrayBufferView(t))return t.buffer;if(B.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return au(t,this.formSerializer).toString();if((c=B.isFileList(t))||r.indexOf("multipart/form-data")>-1){let u=this.env&&this.env.FormData;return br(c?{"files[]":t}:t,u&&new u,this.formSerializer)}}return s||o?(e.setContentType("application/json",!1),hh(t)):t}],transformResponse:[function(t){let e=this.transitional||cu.transitional,r=e&&e.forcedJSONParsing,o=this.responseType==="json";if(t&&B.isString(t)&&(r&&!this.responseType||o)){let i=!(e&&e.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(c){if(i)throw c.name==="SyntaxError"?Se.from(c,Se.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:It.classes.FormData,Blob:It.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};B.forEach(["delete","get","head","post","put","patch"],n=>{cu.headers[n]={}});var vo=cu;var Ah=B.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Bl=n=>{let t={},e,r,o;return n&&n.split(`
427
- `).forEach(function(i){o=i.indexOf(":"),e=i.substring(0,o).trim().toLowerCase(),r=i.substring(o+1).trim(),!(!e||t[e]&&Ah[e])&&(e==="set-cookie"?t[e]?t[e].push(r):t[e]=[r]:t[e]=t[e]?t[e]+", "+r:r)}),t};var Ul=Symbol("internals");function fs(n){return n&&String(n).trim().toLowerCase()}function Qi(n){return n===!1||n==null?n:B.isArray(n)?n.map(Qi):String(n)}function xh(n){let t=Object.create(null),e=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=e.exec(n);)t[r[1]]=r[2];return t}var bh=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function uu(n,t,e,r,o){if(B.isFunction(r))return r.call(this,t,e);if(o&&(t=e),!!B.isString(t)){if(B.isString(r))return t.indexOf(r)!==-1;if(B.isRegExp(r))return r.test(t)}}function wh(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,e,r)=>e.toUpperCase()+r)}function Th(n,t){let e=B.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+e,{value:function(o,s,i){return this[r].call(this,t,o,s,i)},configurable:!0})})}var Co=class{constructor(t){t&&this.set(t)}set(t,e,r){let o=this;function s(c,u,d){let y=fs(u);if(!y)throw new Error("header name must be a non-empty string");let g=B.findKey(o,y);(!g||o[g]===void 0||d===!0||d===void 0&&o[g]!==!1)&&(o[g||u]=Qi(c))}let i=(c,u)=>B.forEach(c,(d,y)=>s(d,y,u));return B.isPlainObject(t)||t instanceof this.constructor?i(t,e):B.isString(t)&&(t=t.trim())&&!bh(t)?i(Bl(t),e):t!=null&&s(e,t,r),this}get(t,e){if(t=fs(t),t){let r=B.findKey(this,t);if(r){let o=this[r];if(!e)return o;if(e===!0)return xh(o);if(B.isFunction(e))return e.call(this,o,r);if(B.isRegExp(e))return e.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=fs(t),t){let r=B.findKey(this,t);return!!(r&&this[r]!==void 0&&(!e||uu(this,this[r],r,e)))}return!1}delete(t,e){let r=this,o=!1;function s(i){if(i=fs(i),i){let c=B.findKey(r,i);c&&(!e||uu(r,r[c],c,e))&&(delete r[c],o=!0)}}return B.isArray(t)?t.forEach(s):s(t),o}clear(t){let e=Object.keys(this),r=e.length,o=!1;for(;r--;){let s=e[r];(!t||uu(this,this[s],s,t,!0))&&(delete this[s],o=!0)}return o}normalize(t){let e=this,r={};return B.forEach(this,(o,s)=>{let i=B.findKey(r,s);if(i){e[i]=Qi(o),delete e[s];return}let c=t?wh(s):String(s).trim();c!==s&&delete e[s],e[c]=Qi(o),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let e=Object.create(null);return B.forEach(this,(r,o)=>{r!=null&&r!==!1&&(e[o]=t&&B.isArray(r)?r.join(", "):r)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join(`
428
- `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){let r=new this(t);return e.forEach(o=>r.set(o)),r}static accessor(t){let r=(this[Ul]=this[Ul]={accessors:{}}).accessors,o=this.prototype;function s(i){let c=fs(i);r[c]||(Th(o,i),r[c]=!0)}return B.isArray(t)?t.forEach(s):s(t),this}};Co.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);B.reduceDescriptors(Co.prototype,({value:n},t)=>{let e=t[0].toUpperCase()+t.slice(1);return{get:()=>n,set(r){this[e]=r}}});B.freezeMethods(Co);var Bt=Co;function ds(n,t){let e=this||vo,r=t||e,o=Bt.from(r.headers),s=r.data;return B.forEach(n,function(c){s=c.call(e,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function ls(n){return!!(n&&n.__CANCEL__)}function Pl(n,t,e){Se.call(this,n??"canceled",Se.ERR_CANCELED,t,e),this.name="CanceledError"}B.inherits(Pl,Se,{__CANCEL__:!0});var wr=Pl;function fu(n,t,e){let r=e.config.validateStatus;!e.status||!r||r(e.status)?n(e):t(new Se("Request failed with status code "+e.status,[Se.ERR_BAD_REQUEST,Se.ERR_BAD_RESPONSE][Math.floor(e.status/100)-4],e.config,e.request,e))}var Rl=It.hasStandardBrowserEnv?{write(n,t,e,r,o,s){let i=[n+"="+encodeURIComponent(t)];B.isNumber(e)&&i.push("expires="+new Date(e).toGMTString()),B.isString(r)&&i.push("path="+r),B.isString(o)&&i.push("domain="+o),s===!0&&i.push("secure"),document.cookie=i.join("; ")},read(n){let t=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function du(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function lu(n,t){return t?n.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):n}function ps(n,t){return n&&!du(t)?lu(n,t):t}var Ol=It.hasStandardBrowserEnv?function(){let t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a"),r;function o(s){let i=s;return t&&(e.setAttribute("href",i),i=e.href),e.setAttribute("href",i),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:e.pathname.charAt(0)==="/"?e.pathname:"/"+e.pathname}}return r=o(window.location.href),function(i){let c=B.isString(i)?o(i):i;return c.protocol===r.protocol&&c.host===r.host}}():function(){return function(){return!0}}();function pu(n){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return t&&t[1]||""}function _h(n,t){n=n||10;let e=new Array(n),r=new Array(n),o=0,s=0,i;return t=t!==void 0?t:1e3,function(u){let d=Date.now(),y=r[s];i||(i=d),e[o]=u,r[o]=d;let g=s,T=0;for(;g!==o;)T+=e[g++],g=g%n;if(o=(o+1)%n,o===s&&(s=(s+1)%n),d-i<t)return;let S=y&&d-y;return S?Math.round(T*1e3/S):void 0}}var Nl=_h;function kl(n,t){let e=0,r=Nl(50,250);return o=>{let s=o.loaded,i=o.lengthComputable?o.total:void 0,c=s-e,u=r(c),d=s<=i;e=s;let y={loaded:s,total:i,progress:i?s/i:void 0,bytes:c,rate:u||void 0,estimated:u&&i&&d?(i-s)/u:void 0,event:o};y[t?"download":"upload"]=!0,n(y)}}var Eh=typeof XMLHttpRequest<"u",Dl=Eh&&function(n){return new Promise(function(e,r){let o=n.data,s=Bt.from(n.headers).normalize(),{responseType:i,withXSRFToken:c}=n,u;function d(){n.cancelToken&&n.cancelToken.unsubscribe(u),n.signal&&n.signal.removeEventListener("abort",u)}let y;if(B.isFormData(o)){if(It.hasStandardBrowserEnv||It.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((y=s.getContentType())!==!1){let[h,...w]=y?y.split(";").map(v=>v.trim()).filter(Boolean):[];s.setContentType([h||"multipart/form-data",...w].join("; "))}}let g=new XMLHttpRequest;if(n.auth){let h=n.auth.username||"",w=n.auth.password?unescape(encodeURIComponent(n.auth.password)):"";s.set("Authorization","Basic "+btoa(h+":"+w))}let T=ps(n.baseURL,n.url);g.open(n.method.toUpperCase(),us(T,n.params,n.paramsSerializer),!0),g.timeout=n.timeout;function S(){if(!g)return;let h=Bt.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),v={data:!i||i==="text"||i==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:h,config:n,request:g};fu(function(P){e(P),d()},function(P){r(P),d()},v),g=null}if("onloadend"in g?g.onloadend=S:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(S)},g.onabort=function(){g&&(r(new Se("Request aborted",Se.ECONNABORTED,n,g)),g=null)},g.onerror=function(){r(new Se("Network Error",Se.ERR_NETWORK,n,g)),g=null},g.ontimeout=function(){let w=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",v=n.transitional||ji;n.timeoutErrorMessage&&(w=n.timeoutErrorMessage),r(new Se(w,v.clarifyTimeoutError?Se.ETIMEDOUT:Se.ECONNABORTED,n,g)),g=null},It.hasStandardBrowserEnv&&(c&&B.isFunction(c)&&(c=c(n)),c||c!==!1&&Ol(T))){let h=n.xsrfHeaderName&&n.xsrfCookieName&&Rl.read(n.xsrfCookieName);h&&s.set(n.xsrfHeaderName,h)}o===void 0&&s.setContentType(null),"setRequestHeader"in g&&B.forEach(s.toJSON(),function(w,v){g.setRequestHeader(v,w)}),B.isUndefined(n.withCredentials)||(g.withCredentials=!!n.withCredentials),i&&i!=="json"&&(g.responseType=n.responseType),typeof n.onDownloadProgress=="function"&&g.addEventListener("progress",kl(n.onDownloadProgress,!0)),typeof n.onUploadProgress=="function"&&g.upload&&g.upload.addEventListener("progress",kl(n.onUploadProgress)),(n.cancelToken||n.signal)&&(u=h=>{g&&(r(!h||h.type?new wr(null,n,g):h),g.abort(),g=null)},n.cancelToken&&n.cancelToken.subscribe(u),n.signal&&(n.signal.aborted?u():n.signal.addEventListener("abort",u)));let b=pu(T);if(b&&It.protocols.indexOf(b)===-1){r(new Se("Unsupported protocol "+b+":",Se.ERR_BAD_REQUEST,n));return}g.send(o||null)})};var gu={http:$i,xhr:Dl};B.forEach(gu,(n,t)=>{if(n){try{Object.defineProperty(n,"name",{value:t})}catch{}Object.defineProperty(n,"adapterName",{value:t})}});var zl=n=>`- ${n}`,Sh=n=>B.isFunction(n)||n===null||n===!1,Yi={getAdapter:n=>{n=B.isArray(n)?n:[n];let{length:t}=n,e,r,o={};for(let s=0;s<t;s++){e=n[s];let i;if(r=e,!Sh(e)&&(r=gu[(i=String(e)).toLowerCase()],r===void 0))throw new Se(`Unknown adapter '${i}'`);if(r)break;o[i||"#"+s]=r}if(!r){let s=Object.entries(o).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build")),i=t?s.length>1?`since :
429
- `+s.map(zl).join(`
430
- `):" "+zl(s[0]):"as no adapter specified";throw new Se("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:gu};function mu(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new wr(null,n)}function Zi(n){return mu(n),n.headers=Bt.from(n.headers),n.data=ds.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),Yi.getAdapter(n.adapter||vo.adapter)(n).then(function(r){return mu(n),r.data=ds.call(n,n.transformResponse,r),r.headers=Bt.from(r.headers),r},function(r){return ls(r)||(mu(n),r&&r.response&&(r.response.data=ds.call(n,n.transformResponse,r.response),r.response.headers=Bt.from(r.response.headers))),Promise.reject(r)})}var Ml=n=>n instanceof Bt?n.toJSON():n;function Yn(n,t){t=t||{};let e={};function r(d,y,g){return B.isPlainObject(d)&&B.isPlainObject(y)?B.merge.call({caseless:g},d,y):B.isPlainObject(y)?B.merge({},y):B.isArray(y)?y.slice():y}function o(d,y,g){if(B.isUndefined(y)){if(!B.isUndefined(d))return r(void 0,d,g)}else return r(d,y,g)}function s(d,y){if(!B.isUndefined(y))return r(void 0,y)}function i(d,y){if(B.isUndefined(y)){if(!B.isUndefined(d))return r(void 0,d)}else return r(void 0,y)}function c(d,y,g){if(g in t)return r(d,y);if(g in n)return r(void 0,d)}let u={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(d,y)=>o(Ml(d),Ml(y),!0)};return B.forEach(Object.keys(Object.assign({},n,t)),function(y){let g=u[y]||o,T=g(n[y],t[y],y);B.isUndefined(T)&&g!==c||(e[y]=T)}),e}var Xi="1.6.2";var yu={};["object","boolean","number","function","string","symbol"].forEach((n,t)=>{yu[n]=function(r){return typeof r===n||"a"+(t<1?"n ":" ")+n}});var Gl={};yu.transitional=function(t,e,r){function o(s,i){return"[Axios v"+Xi+"] Transitional option '"+s+"'"+i+(r?". "+r:"")}return(s,i,c)=>{if(t===!1)throw new Se(o(i," has been removed"+(e?" in "+e:"")),Se.ERR_DEPRECATED);return e&&!Gl[i]&&(Gl[i]=!0,console.warn(o(i," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(s,i,c):!0}};function vh(n,t,e){if(typeof n!="object")throw new Se("options must be an object",Se.ERR_BAD_OPTION_VALUE);let r=Object.keys(n),o=r.length;for(;o-- >0;){let s=r[o],i=t[s];if(i){let c=n[s],u=c===void 0||i(c,s,n);if(u!==!0)throw new Se("option "+s+" must be "+u,Se.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new Se("Unknown option "+s,Se.ERR_BAD_OPTION)}}var Ji={assertOptions:vh,validators:yu};var Tr=Ji.validators,Io=class{constructor(t){this.defaults=t,this.interceptors={request:new su,response:new su}}request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=Yn(this.defaults,e);let{transitional:r,paramsSerializer:o,headers:s}=e;r!==void 0&&Ji.assertOptions(r,{silentJSONParsing:Tr.transitional(Tr.boolean),forcedJSONParsing:Tr.transitional(Tr.boolean),clarifyTimeoutError:Tr.transitional(Tr.boolean)},!1),o!=null&&(B.isFunction(o)?e.paramsSerializer={serialize:o}:Ji.assertOptions(o,{encode:Tr.function,serialize:Tr.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let i=s&&B.merge(s.common,s[e.method]);s&&B.forEach(["delete","get","head","post","put","patch","common"],b=>{delete s[b]}),e.headers=Bt.concat(i,s);let c=[],u=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(e)===!1||(u=u&&h.synchronous,c.unshift(h.fulfilled,h.rejected))});let d=[];this.interceptors.response.forEach(function(h){d.push(h.fulfilled,h.rejected)});let y,g=0,T;if(!u){let b=[Zi.bind(this),void 0];for(b.unshift.apply(b,c),b.push.apply(b,d),T=b.length,y=Promise.resolve(e);g<T;)y=y.then(b[g++],b[g++]);return y}T=c.length;let S=e;for(g=0;g<T;){let b=c[g++],h=c[g++];try{S=b(S)}catch(w){h.call(this,w);break}}try{y=Zi.call(this,S)}catch(b){return Promise.reject(b)}for(g=0,T=d.length;g<T;)y=y.then(d[g++],d[g++]);return y}getUri(t){t=Yn(this.defaults,t);let e=ps(t.baseURL,t.url);return us(e,t.params,t.paramsSerializer)}};B.forEach(["delete","get","head","options"],function(t){Io.prototype[t]=function(e,r){return this.request(Yn(r||{},{method:t,url:e,data:(r||{}).data}))}});B.forEach(["post","put","patch"],function(t){function e(r){return function(s,i,c){return this.request(Yn(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}Io.prototype[t]=e(),Io.prototype[t+"Form"]=e(!0)});var gs=Io;var hu=class n{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(s){e=s});let r=this;this.promise.then(o=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s,i=new Promise(c=>{r.subscribe(c),s=c}).then(o);return i.cancel=function(){r.unsubscribe(s)},i},t(function(s,i,c){r.reason||(r.reason=new wr(s,i,c),e(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}static source(){let t;return{token:new n(function(o){t=o}),cancel:t}}},Ll=hu;function Au(n){return function(e){return n.apply(null,e)}}function xu(n){return B.isObject(n)&&n.isAxiosError===!0}var bu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(bu).forEach(([n,t])=>{bu[t]=n});var ql=bu;function Kl(n){let t=new gs(n),e=is(gs.prototype.request,t);return B.extend(e,gs.prototype,t,{allOwnKeys:!0}),B.extend(e,t,null,{allOwnKeys:!0}),e.create=function(o){return Kl(Yn(n,o))},e}var dt=Kl(vo);dt.Axios=gs;dt.CanceledError=wr;dt.CancelToken=Ll;dt.isCancel=ls;dt.VERSION=Xi;dt.toFormData=br;dt.AxiosError=Se;dt.Cancel=dt.CanceledError;dt.all=function(t){return Promise.all(t)};dt.spread=Au;dt.isAxiosError=xu;dt.mergeConfig=Yn;dt.AxiosHeaders=Bt;dt.formToJSON=n=>Wi(B.isHTMLForm(n)?new FormData(n):n);dt.getAdapter=Yi.getAdapter;dt.HttpStatusCode=ql;dt.default=dt;var ea=dt;var{Axios:P_,AxiosError:R_,CanceledError:O_,isCancel:N_,CancelToken:k_,VERSION:D_,all:z_,Cancel:M_,isAxiosError:G_,spread:L_,toFormData:q_,AxiosHeaders:K_,HttpStatusCode:F_,formToJSON:H_,getAdapter:$_,mergeConfig:V_}=ea;async function Fl(n){var t;let{params:e,method:r,url:o,headers:s,body:i,overrides:c}=n,u={headers:s,method:r,url:o,params:e,data:i,withCredentials:(t=c?.WITH_CREDENTIALS)!=null?t:!0};try{let d=await ea(u);return{status:d.status,statusText:d.statusText,data:d.data,headers:d.headers,config:d.config}}catch(d){let y=d;if(y.response)return y.response;throw d}}var ms=class{constructor(t){this.network=t?.network??Fa,this.fullnode=t?.fullnode,this.faucet=t?.faucet,this.indexer=t?.indexer,this.client=t?.client??{provider:Fl},this.clientConfig=t?.clientConfig??{}}getRequestUrl(t){switch(t){case 0:if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return Qs[this.network];case 2:if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return Ys[this.network];case 1:if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return Ws[this.network];default:throw Error(`apiType ${t} is not supported`)}}isIndexerRequest(t){return Ws[this.network]===t}isFullnodeRequest(t){return Qs[this.network]===t}isFaucetRequest(t){return Ys[this.network]===t}};var ys=class extends ae{constructor(e){super();this.accountAddress=M.ONE;this.moduleName=new Me("account");this.structName=new Me("RotationProofChallenge");this.sequenceNumber=new mt(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=De.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};var Nt=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Cn.load(t);case 1:return hs.load(t);case 2:return yn.load(t);case 3:return Zr.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof Cn}isMultiEd25519(){return this instanceof hs}isSingleKey(){return this instanceof yn}isMultiKey(){return this instanceof Zr}},Cn=class n extends Nt{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=Fe.deserialize(e),o=rt.deserialize(e);return new n(r,o)}},hs=class n extends Nt{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=dn.deserialize(e),o=qr.deserialize(e);return new n(r,o)}},yn=class n extends Nt{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=Ze.deserialize(e),o=En.deserialize(e);return new n(r,o)}},Zr=class n extends Nt{constructor(e,r,o){super();this.public_keys=e,this.signatures=r,this.signatures_bitmap=o}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),e.serializeVector(this.signatures),e.serializeBytes(this.signatures_bitmap)}static load(e){let r=Yr.deserialize(e),o=e.deserializeVector(En),s=e.deserializeBytes();return new n(r,o,s)}};var In=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Xr.load(t);case 1:return ta.load(t);case 2:return Jr.load(t);case 3:return eo.load(t);case 4:return to.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},Xr=class n extends In{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=Fe.deserialize(e),o=rt.deserialize(e);return new n(r,o)}},ta=class n extends In{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=dn.deserialize(e),o=qr.deserialize(e);return new n(r,o)}},Jr=class n extends In{constructor(e,r,o){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=o}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let r=Nt.deserialize(e),o=e.deserializeVector(M),s=e.deserializeVector(Nt);return new n(r,o,s)}},eo=class n extends In{constructor(e,r,o,s){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=o,this.fee_payer=s}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let r=Nt.deserialize(e),o=e.deserializeVector(M),s=e.deserializeVector(Nt),i=M.deserialize(e),c=Nt.deserialize(e),u={address:i,authenticator:c};return new n(r,o,s,u)}},to=class n extends In{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=Nt.deserialize(e);return new n(r)}};var no=class n extends ae{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let r=e.deserializeU8();return new n(r)}};var Xe=class n extends ae{constructor(e){super();this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let r=e.deserializeStr();return new n(r)}};var Bo=class n extends ae{constructor(e,r){super();this.address=e,this.name=r}static fromStr(e){let r=e.split("::");if(r.length!==2)throw new Error("Invalid module id.");return new n(M.fromString(r[0]),new Xe(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=M.deserialize(e),o=Xe.deserialize(e);return new n(r,o)}};var it=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return At.load(t);case 1:return hn.load(t);case 2:return Ut.load(t);case 3:return so.load(t);case 4:return kt.load(t);case 5:return _r.load(t);case 6:return Ve.load(t);case 7:return ue.load(t);case 8:return ro.load(t);case 9:return oo.load(t);case 10:return io.load(t);case 255:return at.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof At}isAddress(){return this instanceof kt}isGeneric(){return this instanceof at}isSigner(){return this instanceof _r}isVector(){return this instanceof Ve}isStruct(){return this instanceof ue}isU8(){return this instanceof hn}isU16(){return this instanceof ro}isU32(){return this instanceof oo}isU64(){return this instanceof Ut}isU128(){return this instanceof so}isU256(){return this instanceof io}},At=class n extends it{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new n}},hn=class n extends it{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new n}},ro=class n extends it{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new n}},oo=class n extends it{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new n}},Ut=class n extends it{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new n}},so=class n extends it{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new n}},io=class n extends it{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new n}},kt=class n extends it{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new n}},_r=class n extends it{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new n}},As=class n extends it{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let r=it.deserialize(e);return new n(r)}},at=class n extends it{constructor(e){super();this.value=e;if(e<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(e){e.serializeU32AsUleb128(255),e.serializeU32(this.value)}static load(e){let r=e.deserializeU32();return new n(r)}},Ve=class n extends it{constructor(e){super();this.value=e}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new hn)}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){let r=it.deserialize(e);return new n(r)}},ue=class n extends it{constructor(e){super();this.value=e}toString(){let e="";return this.value.typeArgs.length>0&&(e=`<${this.value.typeArgs.map(r=>r.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${e}`}serialize(e){e.serializeU32AsUleb128(7),this.value.serialize(e)}static load(e){let r=Bn.deserialize(e);return new n(r)}isTypeTag(e,r,o){return this.value.moduleName.identifier===r&&this.value.name.identifier===o&&this.value.address.equals(e)}isString(){return this.isTypeTag(M.ONE,"string","String")}isOption(){return this.isTypeTag(M.ONE,"option","Option")}isObject(){return this.isTypeTag(M.ONE,"object","Object")}},Bn=class n extends ae{constructor(e,r,o,s){super();this.address=e,this.moduleName=r,this.name=o,this.typeArgs=s}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let r=M.deserialize(e),o=Xe.deserialize(e),s=Xe.deserialize(e),i=e.deserializeVector(it);return new n(r,o,s,i)}};function Ch(){return new Bn(M.ONE,new Xe("aptos_coin"),new Xe("AptosCoin"),[])}function He(){return new Bn(M.ONE,new Xe("string"),new Xe("String"),[])}function Ih(n){return new Bn(M.ONE,new Xe("option"),new Xe("Option"),[n])}function Dt(n){return new Bn(M.ONE,new Xe("object"),new Xe("Object"),[n])}function Hl(n){let t=n.deserializeUleb128AsU32();switch(t){case 0:return ht.deserialize(n);case 1:return mt.deserialize(n);case 2:return Wt.deserialize(n);case 3:return M.deserialize(n);case 4:return De.deserialize(n,ht);case 5:return nt.deserialize(n);case 6:return Vt.deserialize(n);case 7:return jt.deserialize(n);case 8:return Qt.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var Er=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Uo.load(t);case 2:return Po.load(t);case 3:return Ro.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},Uo=class n extends Er{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=Oo.deserialize(e);return new n(r)}},Po=class n extends Er{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=ao.deserialize(e);return new n(r)}},Ro=class n extends Er{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=No.deserialize(e);return new n(r)}},ao=class n{constructor(t,e,r,o){this.module_name=t,this.function_name=e,this.type_args=r,this.args=o}static build(t,e,r,o){return new n(Bo.fromStr(t),new Xe(e),r,o)}serialize(t){this.module_name.serialize(t),this.function_name.serialize(t),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForEntryFunction(t)})}static deserialize(t){let e=Bo.deserialize(t),r=Xe.deserialize(t),o=t.deserializeVector(it),s=t.deserializeUleb128AsU32(),i=new Array;for(let c=0;c<s;c+=1){let u=t.deserializeUleb128AsU32(),d=Xo.deserialize(t,u);i.push(d)}return new n(e,r,o,i)}},Oo=class n{constructor(t,e,r){this.bytecode=t,this.type_args=e,this.args=r}serialize(t){t.serializeBytes(this.bytecode),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForScriptFunction(t)})}static deserialize(t){let e=t.deserializeBytes(),r=t.deserializeVector(it),o=t.deserializeUleb128AsU32(),s=new Array;for(let i=0;i<o;i+=1){let c=Hl(t);s.push(c)}return new n(e,r,s)}},No=class n{constructor(t,e){this.multisig_address=t,this.transaction_payload=e}serialize(t){this.multisig_address.serialize(t),this.transaction_payload===void 0?t.serializeBool(!1):(t.serializeBool(!0),this.transaction_payload.serialize(t))}static deserialize(t){let e=M.deserialize(t),r=t.deserializeBool(),o;return r&&(o=ko.deserialize(t)),new n(e,o)}},ko=class n extends ae{constructor(e){super();this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new n(ao.deserialize(e))}};var nn=class n extends ae{constructor(e,r,o,s,i,c,u){super();this.sender=e,this.sequence_number=r,this.payload=o,this.max_gas_amount=s,this.gas_unit_price=i,this.expiration_timestamp_secs=c,this.chain_id=u}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let r=M.deserialize(e),o=e.deserializeU64(),s=Er.deserialize(e),i=e.deserializeU64(),c=e.deserializeU64(),u=e.deserializeU64(),d=no.deserialize(e);return new n(r,o,s,i,c,u,d)}},xs=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Un.load(t);case 1:return Pn.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},Un=class n extends xs{constructor(e,r){super();this.raw_txn=e,this.secondary_signer_addresses=r}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let r=nn.deserialize(e),o=e.deserializeVector(M);return new n(r,o)}},Pn=class n extends xs{constructor(e,r,o){super();this.raw_txn=e,this.secondary_signer_addresses=r,this.fee_payer_address=o}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let r=nn.deserialize(e),o=e.deserializeVector(M),s=M.deserialize(e);return new n(r,o,s)}};var An=class n extends ae{constructor(e,r){super();this.raw_txn=e,this.authenticator=r}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let r=nn.deserialize(e),o=In.deserialize(e);return new n(r,o)}};function $l(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Vl(n){return!!n.match(/\s/)}function Bh(n){return!!n.match(/^T[0-9]+$/)}function Uh(n,t){let e=t;for(;e<n.length;e+=1){let r=n[e];if(!Vl(r))break}return e}var jl=(T=>(T.InvalidTypeTag="unknown type",T.UnexpectedGenericType="unexpected generic type",T.UnexpectedTypeArgumentClose="unexpected '>'",T.UnexpectedWhitespaceCharacter="unexpected whitespace character",T.UnexpectedComma="unexpected ','",T.TypeArgumentCountMismatch="type argument count doesn't match expected amount",T.MissingTypeArgumentClose="no matching '>' for '<'",T.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",T.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",T.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",T.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",T.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",T))(jl||{}),je=class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function Sr(n,t){let e=t?.allowGenerics??!1,r=[],o=[],s=[],i=0,c="",u=1;for(;i<n.length;){let d=n[i];if(d==="<")r.push({savedExpectedTypes:u,savedStr:c,savedTypes:s}),c="",s=[],u=1;else if(d===">"){if(c!==""){let b=na(c,o,e);s.push(b)}let y=r.pop();if(y===void 0)throw new je(n,"unexpected '>'");if(u!==s.length)throw new je(n,"type argument count doesn't match expected amount");let{savedStr:g,savedTypes:T,savedExpectedTypes:S}=y;o=s,s=T,c=g,u=S}else if(d===","){if(c.length!==0){let y=na(c,o,e);o=[],s.push(y),c="",u+=1}}else if(Vl(d)){let y=!1;if(c.length!==0){let T=na(c,o,e);o=[],s.push(T),c="",y=!0}i=Uh(n,i);let g=n[i];if(i<n.length&&y&&g!==","&&g!==">")throw new je(n,"unexpected whitespace character");continue}else c+=d;i+=1}if(r.length>0)throw new je(n,"no matching '>' for '<'");switch(s.length){case 0:return na(c,o,e);case 1:if(c==="")return s[0];throw new je(n,"unexpected ','");default:throw new je(n,"unexpected whitespace character")}}function na(n,t,e){switch(n){case"&signer":if(t.length>0)throw new je(n,"primitive types not expected to have type arguments");return new As(new _r);case"signer":if(t.length>0)throw new je(n,"primitive types not expected to have type arguments");return new _r;case"bool":if(t.length>0)throw new je(n,"primitive types not expected to have type arguments");return new At;case"address":if(t.length>0)throw new je(n,"primitive types not expected to have type arguments");return new kt;case"u8":if(t.length>0)throw new je(n,"primitive types not expected to have type arguments");return new hn;case"u16":if(t.length>0)throw new je(n,"primitive types not expected to have type arguments");return new ro;case"u32":if(t.length>0)throw new je(n,"primitive types not expected to have type arguments");return new oo;case"u64":if(t.length>0)throw new je(n,"primitive types not expected to have type arguments");return new Ut;case"u128":if(t.length>0)throw new je(n,"primitive types not expected to have type arguments");return new so;case"u256":if(t.length>0)throw new je(n,"primitive types not expected to have type arguments");return new io;case"vector":if(t.length!==1)throw new je(n,"vector type expected to have exactly one type argument");return new Ve(t[0]);default:if(Bh(n)){if(e)return new at(Number(n.split("T")[1]));throw new je(n,"unexpected generic type")}if(!n.match(/.*:.*/))throw new je(n,"unknown type");let r=n.split("::");if(r.length!==3)throw new je(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!$l(r[1]))throw new je(n,"module name must only contain alphanumeric or '_' characters");if(!$l(r[2]))throw new je(n,"struct name must only contain alphanumeric or '_' characters");return new ue(new Bn(M.fromString(r[0]),new Xe(r[1]),new Xe(r[2]),t))}}function wu(n){return typeof n=="boolean"}function co(n){return typeof n=="string"}function bs(n){return typeof n=="number"}function ws(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function Tu(n){return n==null}function _u(n){return ra(n)||sa(n)||ia(n)||aa(n)||ca(n)||ua(n)||fa(n)||Ts(n)||oa(n)||Wl(n)||n instanceof De||n instanceof Gn}function ra(n){return n instanceof nt}function Ts(n){return n instanceof M}function oa(n){return n instanceof Me}function Wl(n){return n instanceof nr}function sa(n){return n instanceof ht}function ia(n){return n instanceof Vt}function aa(n){return n instanceof jt}function ca(n){return n instanceof mt}function ua(n){return n instanceof Wt}function fa(n){return n instanceof Qt}function Eu(n){return"bytecode"in n}function Qe(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function Su(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function da(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],r=t[1],o=t[2];return{moduleAddress:e,moduleName:r,functionName:o}}var Ph=new TextEncoder;function Cu(n){return n?.map(t=>co(t)?Sr(t):t)??[]}async function Iu(n,t,e,r){let s=(await Di({aptosConfig:r,accountAddress:n,moduleName:t})).abi?.exposed_functions.find(u=>u.name===e);if(!s)throw new Error(`Could not find entry function ABI for '${n}::${t}::${e}'`);if(!s.is_entry)throw new Error(`'${n}::${t}::${e}' is not an entry function`);let i=Su(s),c=[];for(let u=i;u<s.params.length;u+=1)c.push(Sr(s.params[u],{allowGenerics:!0}));return{typeParameters:s.generic_type_params,parameters:c}}function Bu(n,t,e,r,o){if(r>=t.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${t.parameters.length}`);let s=t.parameters[r];return uo(e,s,r,o)}function uo(n,t,e,r){return _u(n)?(vu(t,n,e),n):Rh(n,t,e,r)}function Rh(n,t,e,r){if(t.isBool()){if(wu(n))return new nt(n);Qe("boolean",e)}if(t.isAddress()){if(co(n))return M.fromString(n);Qe("string | AccountAddress",e)}if(t.isU8()){if(bs(n))return new ht(n);Qe("number",e)}if(t.isU16()){if(bs(n))return new Vt(n);Qe("number",e)}if(t.isU32()){if(bs(n))return new jt(n);Qe("number",e)}if(t.isU64()){if(ws(n))return new mt(BigInt(n));Qe("bigint | number | string",e)}if(t.isU128()){if(ws(n))return new Wt(BigInt(n));Qe("bigint | number | string",e)}if(t.isU256()){if(ws(n))return new Qt(BigInt(n));Qe("bigint | number | string",e)}if(t.isGeneric()){let o=t.value;if(o<0||o>=r.length)throw new Error(`Generic argument ${t.toString()} is invalid for argument ${e}`);return uo(n,r[o],e,r)}if(t.isVector()){if(t.value.isU8()){if(co(n))return De.U8(Ph.encode(n));if(n instanceof Uint8Array)return De.U8(n);if(n instanceof ArrayBuffer)return De.U8(new Uint8Array(n))}if(Array.isArray(n))return new De(n.map(o=>uo(o,t.value,e,r)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(co(n))return new Me(n);Qe("string",e)}if(t.isObject()){if(co(n))return M.fromString(n);Qe("string | AccountAddress",e)}if(t.isOption())return Tu(n)?new Gn(null):new Gn(uo(n,t.value.typeArgs[0],e,r));throw new Error(`Unsupported struct input type for argument ${e}, type '${t.toString()}'`)}throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}function vu(n,t,e){if(n.isBool()){if(ra(t))return;Qe("Bool",e)}if(n.isAddress()){if(Ts(t))return;Qe("AccountAddress",e)}if(n.isU8()){if(sa(t))return;Qe("U8",e)}if(n.isU16()){if(ia(t))return;Qe("U16",e)}if(n.isU32()){if(aa(t))return;Qe("U32",e)}if(n.isU64()){if(ca(t))return;Qe("U64",e)}if(n.isU128()){if(ua(t))return;Qe("U128",e)}if(n.isU256()){if(fa(t))return;Qe("U256",e)}if(n.isVector()){if(t instanceof De){t.values.length>0&&vu(n.value,t.values[0],e);return}Qe("MoveVector",e)}if(n instanceof ue){if(n.isString()){if(oa(t))return;Qe("MoveString",e)}if(n.isObject()){if(Ts(t))return;Qe("AccountAddress",e)}if(n.isOption()){if(t instanceof Gn){t.value!==void 0&&vu(n.value.typeArgs[0],t.value,e);return}Qe("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${n.toString()}'`)}async function Es(n){if(Eu(n))return Oh(n);let{moduleAddress:t,moduleName:e,functionName:r}=da(n.function),o=await To(async()=>Iu(t,e,r,n.aptosConfig),`entry-function-${n.aptosConfig.network}-${t}-${e}-${r}`,1e3*60*5)();return Ss({abi:o,...n})}function Ss(n){let t=n.abi,{moduleAddress:e,moduleName:r,functionName:o}=da(n.function),s=Cu(n.typeArguments);if(s.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${s.length}`);let i=n.functionArguments.map((u,d)=>Bu(n.function,t,u,d,s));if(i.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${o}', expected ${t.parameters.length} but got ${i.length}`);let c=ao.build(`${e}::${r}`,o,s,i);if("multisigAddress"in n){let u=M.from(n.multisigAddress);return new Ro(new No(u,new ko(c)))}return new Po(c)}function Oh(n){return new Uo(new Oo(Pe.fromHexInput(n.bytecode).toUint8Array(),n.typeArguments??[],n.functionArguments))}async function Ql(n){let{aptosConfig:t,sender:e,payload:r,options:o,feePayerAddress:s}=n,i=Zs[t.network]?Promise.resolve({chain_id:Zs[t.network]}):Ri({aptosConfig:t}),c=o?.gasUnitPrice?Promise.resolve({gas_estimate:o.gasUnitPrice}):Mi({aptosConfig:t}),[{chain_id:u},{gas_estimate:d}]=await Promise.all([i,c]),y=o?.accountSequenceNumber!==void 0?Promise.resolve({sequence_number:o.accountSequenceNumber}):Sn({aptosConfig:t,accountAddress:e}),g;if(s&&M.from(s).equals(M.ZERO))try{let{sequence_number:h}=await y;g=h}catch{g="0"}else{let{sequence_number:h}=await y;g=h}let{maxGasAmount:T,gasUnitPrice:S,expireTimestamp:b}={maxGasAmount:o?.maxGasAmount?BigInt(o.maxGasAmount):BigInt(Ha),gasUnitPrice:BigInt(d),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+$a),...o};return new nn(M.from(e),BigInt(g),r,BigInt(T),BigInt(S),BigInt(b),new no(u))}async function la(n){let{aptosConfig:t,sender:e,payload:r,options:o,feePayerAddress:s}=n,i=await Ql({aptosConfig:t,sender:e,payload:r,options:o,feePayerAddress:s});if("secondarySignerAddresses"in n){let c=n.secondarySignerAddresses?.map(u=>M.from(u))??[];return{rawTransaction:i,secondarySignerAddresses:c,feePayerAddress:n.feePayerAddress?M.from(n.feePayerAddress):void 0}}return{rawTransaction:i,feePayerAddress:n.feePayerAddress?M.from(n.feePayerAddress):void 0}}function Uu(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:r,feePayerPublicKey:o}=n,s=_s(t);if(e.feePayerAddress){let c=new Pn(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress),u=[];r&&(u=r.map(g=>_s(g)));let d=_s(o),y=new eo(s,e.secondarySignerAddresses??[],u,{address:e.feePayerAddress,authenticator:d});return new An(c.raw_txn,y).bcsToBytes()}if(e.secondarySignerAddresses){let c=new Un(e.rawTransaction,e.secondarySignerAddresses),u=[];u=r.map(y=>_s(y));let d=new Jr(s,e.secondarySignerAddresses,u);return new An(c.raw_txn,d).bcsToBytes()}let i;if(s instanceof Cn)i=new Xr(s.public_key,s.signature);else if(s instanceof yn)i=new to(s);else throw new Error("Invalid public key");return new An(e.rawTransaction,i).bcsToBytes()}function _s(n){if(n instanceof Ze){if(n.publicKey instanceof Fe)return new yn(n,new En(new rt(new Uint8Array(64))));if(n.publicKey instanceof en)return new yn(n,new En(new jn(new Uint8Array(64))))}return new Cn(new Fe(n.toUint8Array()),new rt(new Uint8Array(64)))}function Pu(n){let{signer:t,transaction:e}=n,r=pa(e),o=t.sign(r);switch(t.signingScheme){case 0:return new Cn(new Fe(t.publicKey.toUint8Array()),new rt(o.toUint8Array()));case 2:if(!Ze.isPublicKey(t.publicKey))throw new Error(`Cannot sign transaction, public key does not match ${t.signingScheme}`);return new yn(t.publicKey,new En(o));default:throw new Error(`Cannot sign transaction, signing scheme ${t.signingScheme} not supported`)}}function Ru(n){let{transaction:t,senderAuthenticator:e,feePayerAuthenticator:r,additionalSignersAuthenticators:o}=n,s=Ou(t);if((r||o)&&(s instanceof Un||s instanceof Pn))return Yl(s,e,r,o);if(e instanceof Cn&&s instanceof nn){let i=new Xr(e.public_key,e.signature);return new An(s,i).bcsToBytes()}if((e instanceof yn||e instanceof Zr)&&s instanceof nn){let i=new to(e);return new An(s,i).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${e} is not a supported account authentication scheme`)}function Ou(n){return n.feePayerAddress?new Pn(n.rawTransaction,n.secondarySignerAddresses??[],n.feePayerAddress):n.secondarySignerAddresses?new Un(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function Yl(n,t,e,r){if(n instanceof Pn){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let o=new eo(t,n.secondary_signer_addresses,r??[],{address:n.fee_payer_address,authenticator:e});return new An(n.raw_txn,o).bcsToBytes()}if(n instanceof Un){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let o=new Jr(t,n.secondary_signer_addresses,r??[]);return new An(n.raw_txn,o).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof n} transaction is not supported`)}function pa(n){let t=Ou(n),e=Mr.create();if(t instanceof nn)e.update(Va);else if(t instanceof Un)e.update(Xs);else if(t instanceof Pn)e.update(Xs);else throw new Error(`Unknown transaction type to sign on: ${t}`);let r=e.digest(),o=t.bcsToBytes(),s=new Uint8Array(r.length+o.length);return s.set(r),s.set(o,r.length),s}async function Re(n){let t=await Nh(n);return kh(n,t)}async function Nh(n){let{aptosConfig:t,data:e}=n,r,o;return"bytecode"in e?o=await Es(e):"multisigAddress"in e?e.abi?o=Ss({abi:e.abi,...e}):(r={aptosConfig:t,multisigAddress:e.multisigAddress,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await Es(r)):e.abi?o=Ss({abi:e.abi,...e}):(r={aptosConfig:t,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await Es(r)),o}async function kh(n,t){let{aptosConfig:e,sender:r,options:o}=n,s;if(Dh(n)&&(s=M.ZERO.toString()),zh(n)){let{secondarySignerAddresses:i}=n;return la({aptosConfig:e,sender:r,payload:t,options:o,secondarySignerAddresses:i,feePayerAddress:s})}return la({aptosConfig:e,sender:r,payload:t,options:o,feePayerAddress:s})}function Dh(n){return n.withFeePayer===!0}function zh(n){return"secondarySignerAddresses"in n}function Zl(n){let{transaction:t}=n;return pa(t)}function ga(n){return Pu({...n})}async function Nu(n){let{aptosConfig:t,transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:i}=n,c=Uu({transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:i}),{data:u}=await Or({aptosConfig:t,body:c,path:"transactions/simulate",params:{estimate_gas_unit_price:n.options?.estimateGasUnitPrice??!1,estimate_max_gas_amount:n.options?.estimateMaxGasAmount??!1,estimate_prioritized_gas_unit_price:n.options?.estimatePrioritizedGasUnitPrice??!1},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return u}async function ma(n){let{aptosConfig:t}=n,e=Ru({...n}),{data:r}=await Or({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function vs(n){let{aptosConfig:t,signer:e,transaction:r}=n,o=ga({signer:e,transaction:r});return ma({aptosConfig:t,transaction:r,senderAuthenticator:o})}var Mh={typeParameters:[],parameters:[Ve.u8(),new Ve(Ve.u8())]};async function Xl(n){let{aptosConfig:t,account:e,metadataBytes:r,moduleBytecode:o,options:s}=n,i=o.map(c=>De.U8(c));return Re({aptosConfig:t,sender:M.from(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[De.U8(r),new De(i)],abi:Mh},options:s})}var Gh={typeParameters:[],parameters:[new hn,Ve.u8(),new hn,Ve.u8(),Ve.u8(),Ve.u8()]};async function Jl(n){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:r}=n,o=await Sn({aptosConfig:t,accountAddress:e.accountAddress}),s=Qn.fromPrivateKey({privateKey:r,legacy:!0}),c=new ys({sequenceNumber:BigInt(o.sequence_number),originator:e.accountAddress,currentAuthKey:M.from(o.authentication_key),newPublicKey:s.publicKey}).bcsToBytes(),u=e.sign(c),d=s.sign(c),y=await Re({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new ht(e.signingScheme.valueOf()),De.U8(e.publicKey.toUint8Array()),new ht(s.signingScheme.valueOf()),De.U8(s.publicKey.toUint8Array()),De.U8(u.toUint8Array()),De.U8(d.toUint8Array())],abi:Gh}});return vs({aptosConfig:t,signer:e,transaction:y})}var Lh={typeParameters:[{constraints:[]}],parameters:[new kt,new Ut]};async function ep(n){let{aptosConfig:t,sender:e,recipient:r,amount:o,coinType:s,options:i}=n;return Re({aptosConfig:t,sender:e,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[s??Qo],functionArguments:[r,o],abi:Lh},options:i})}var Cs=class{constructor(t){this.config=t}async transferCoinTransaction(t){return ep({aptosConfig:this.config,...t})}};var vr={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},rn="0x4::token::Token";async function tp(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:M.from(e).toStringLong()}};return(await ve({aptosConfig:t,query:{query:qd,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function np(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:M.from(e).toStringLong()}};return(await ve({aptosConfig:t,query:{query:Wc,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function rp(n){let{aptosConfig:t,ownerAddress:e,options:r}=n,o={owner_address:{_eq:M.from(e).toStringLong()},amount:{_gt:0}},s={query:Wc,variables:{where_condition:o,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await ve({aptosConfig:t,query:s,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function op(n){let{aptosConfig:t,digitalAssetAddress:e,options:r}=n,o={token_data_id:{_eq:M.from(e).toStringLong()}},s={query:Ld,variables:{where_condition:o,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await ve({aptosConfig:t,query:s,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var qh={typeParameters:[],parameters:[new ue(He()),new Ut,new ue(He()),new ue(He()),new At,new At,new At,new At,new At,new At,new At,new At,new At,new Ut,new Ut]};async function sp(n){let{aptosConfig:t,options:e,creator:r}=n;return Re({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new Me(n.description),new mt(n.maxSupply??Dr),new Me(n.name),new Me(n.uri),new nt(n.mutableDescription??!0),new nt(n.mutableRoyalty??!0),new nt(n.mutableURI??!0),new nt(n.mutableTokenDescription??!0),new nt(n.mutableTokenName??!0),new nt(n.mutableTokenProperties??!0),new nt(n.mutableTokenURI??!0),new nt(n.tokensBurnableByCreator??!0),new nt(n.tokensFreezableByCreator??!0),new mt(n.royaltyNumerator??0),new mt(n.royaltyDenominator??1)],abi:qh},options:e})}async function ku(n){let{aptosConfig:t,creatorAddress:e,collectionName:r,options:o}=n,s=M.from(e),i={collection_name:{_eq:r},creator_address:{_eq:s.toStringLong()}};return o?.tokenStandard&&(i.token_standard={_eq:o?.tokenStandard??"v2"}),(await ve({aptosConfig:t,query:{query:Nd,variables:{where_condition:i}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function ip(n){return(await ku(n)).collection_id}var Kh={typeParameters:[],parameters:[new ue(He()),new ue(He()),new ue(He()),new ue(He()),new Ve(new ue(He())),new Ve(new ue(He())),new Ve(Ve.u8())]};async function ap(n){let{aptosConfig:t,options:e,creator:r,collection:o,description:s,name:i,uri:c,propertyKeys:u,propertyTypes:d,propertyValues:y}=n,g=d?.map(T=>vr[T]);return Re({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new Me(o),new Me(s),new Me(i),new Me(c),De.MoveString(u??[]),De.MoveString(g??[]),wp(y??[],g??[])],abi:Kh},options:e})}var Fh={typeParameters:[{constraints:["key"]}],parameters:[new ue(Dt(new at(0))),new kt]};async function cp(n){let{aptosConfig:t,sender:e,digitalAssetAddress:r,recipient:o,digitalAssetType:s,options:i}=n;return Re({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[s??rn],functionArguments:[M.from(r),M.from(o)],abi:Fh},options:i})}var Hh={typeParameters:[],parameters:[new ue(He()),new ue(He()),new ue(He()),new ue(He()),new Ve(new ue(He())),new Ve(new ue(He())),new Ve(Ve.u8()),new kt]};async function up(n){let{aptosConfig:t,account:e,collection:r,description:o,name:s,uri:i,recipient:c,propertyKeys:u,propertyTypes:d,propertyValues:y,options:g}=n;if(u?.length!==y?.length)throw new Error("Property keys and property values counts do not match");if(d?.length!==y?.length)throw new Error("Property types and property values counts do not match");let T=d?.map(S=>vr[S]);return Re({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,o,s,i,De.MoveString(u??[]),De.MoveString(T??[]),wp(y??[],T??[]),c],abi:Hh},options:g})}var $h={typeParameters:[{constraints:["key"]}],parameters:[new ue(Dt(new at(0)))]};async function fp(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:o,options:s}=n;return Re({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[o??rn],functionArguments:[M.from(r)],abi:$h},options:s})}var Vh={typeParameters:[{constraints:["key"]}],parameters:[new ue(Dt(new at(0)))]};async function dp(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:o,options:s}=n;return Re({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[o??rn],functionArguments:[r],abi:Vh},options:s})}var jh={typeParameters:[{constraints:["key"]}],parameters:[new ue(Dt(new at(0)))]};async function lp(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:o,options:s}=n;return Re({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[o??rn],functionArguments:[r],abi:jh},options:s})}var Wh={typeParameters:[{constraints:["key"]}],parameters:[new ue(Dt(new at(0))),new ue(He())]};async function pp(n){let{aptosConfig:t,creator:e,description:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return Re({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[s??rn],functionArguments:[M.from(o),new Me(r)],abi:Wh},options:i})}var Qh={typeParameters:[{constraints:["key"]}],parameters:[new ue(Dt(new at(0))),new ue(He())]};async function gp(n){let{aptosConfig:t,creator:e,name:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return Re({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[s??rn],functionArguments:[M.from(o),new Me(r)],abi:Qh},options:i})}var Yh={typeParameters:[{constraints:["key"]}],parameters:[new ue(Dt(new at(0))),new ue(He())]};async function mp(n){let{aptosConfig:t,creator:e,uri:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return Re({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[s??rn],functionArguments:[M.from(o),new Me(r)],abi:Yh},options:i})}var Zh={typeParameters:[{constraints:["key"]}],parameters:[new ue(Dt(new at(0))),new ue(He()),new ue(He()),Ve.u8()]};async function yp(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:u}=n;return Re({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[c??rn],functionArguments:[M.from(i),new Me(r),new Me(vr[o]),De.U8(Du(s,vr[o]))],abi:Zh},options:u})}var Xh={typeParameters:[{constraints:["key"]}],parameters:[new ue(Dt(new at(0))),new ue(He())]};async function hp(n){let{aptosConfig:t,creator:e,propertyKey:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return Re({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[s??rn],functionArguments:[M.from(o),new Me(r)],abi:Xh},options:i})}var Jh={typeParameters:[{constraints:["key"]}],parameters:[new ue(Dt(new at(0))),new ue(He()),new ue(He()),Ve.u8()]};async function Ap(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:u}=n;return Re({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[c??rn],functionArguments:[M.from(i),new Me(r),new Me(vr[o]),Du(s,vr[o])],abi:Jh},options:u})}var e0={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new ue(Dt(new at(0))),new ue(He()),new at(1)]};async function xp(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:u}=n;return Re({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[c??rn,vr[o]],functionArguments:[M.from(i),new Me(r),s],abi:e0},options:u})}var t0={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new ue(Dt(new at(0))),new ue(He()),new at(1)]};async function bp(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:u}=n;return Re({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[c??rn,vr[o]],functionArguments:[M.from(i),new Me(r),s],abi:t0},options:u})}function wp(n,t){let e=new Array;return t.forEach((r,o)=>{e.push(Du(n[o],r))}),e}function Du(n,t){let e=Sr(t);return uo(n,e,0,[]).bcsToBytes()}var Is=class{constructor(t){this.config=t}async getCollectionData(t){return await Ge({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ku({aptosConfig:this.config,...t})}async getCollectionId(t){return await Ge({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ip({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await Ge({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),tp({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await Ge({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),np({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await Ge({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),rp({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await Ge({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),op({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return sp({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return ap({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return cp({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return up({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return fp({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return dp({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return lp({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return pp({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return gp({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return mp({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return yp({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return hp({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return Ap({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return xp({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return bp({aptosConfig:this.config,...t})}};async function Tp(n){let{accountAddress:t,aptosConfig:e,creationNumber:r,options:o}=n,c={where:{account_address:{_eq:M.from(t).toStringLong()},creation_number:{_eq:r}},pagination:o,orderBy:o?.orderBy};return ya({aptosConfig:e,options:c})}async function _p(n){let{accountAddress:t,aptosConfig:e,eventType:r,options:o}=n,c={where:{account_address:{_eq:M.from(t).toStringLong()},indexed_type:{_eq:r}},pagination:o,orderBy:o?.orderBy};return ya({aptosConfig:e,options:c})}async function ya(n){let{aptosConfig:t,options:e}=n,r={query:zd,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await ve({aptosConfig:t,query:r,originMethod:"getEvents"})).events}var Bs=class{constructor(t){this.config=t}async getAccountEventsByCreationNumber(t){return await Ge({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),Tp({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return await Ge({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),_p({aptosConfig:this.config,...t})}async getEvents(t){return await Ge({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"events_processor"}),ya({aptosConfig:this.config,...t})}};async function Ep(n){let{aptosConfig:t,accountAddress:e,amount:r,options:o}=n,s=o?.timeoutSecs||Wo,{data:i}=await Qa({aptosConfig:t,path:"fund",body:{address:M.from(e).toString(),amount:r},originMethod:"fundAccount"}),c=i.txn_hashes[0],u=await _o({aptosConfig:t,transactionHash:c,options:{timeoutSecs:s,checkSuccess:o?.checkSuccess}});if(u.type==="user_transaction")return u;throw new Error(`Unexpected transaction received for fund account: ${u.type}`)}var Us=class{constructor(t){this.config=t}async fundAccount(t){let e=await Ep({aptosConfig:this.config,...t});return t.options?.waitForIndexer!==!1&&await Li({aptosConfig:this.config,minimumLedgerVersion:BigInt(e.version)}),e}};async function zu(n){let{aptosConfig:t,options:e}=n,r={query:Gd,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await ve({aptosConfig:t,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Sp(n){let{aptosConfig:t,options:e}=n,r={query:Md,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await ve({aptosConfig:t,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function vp(n){let{aptosConfig:t,options:e}=n,r={query:kd,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await ve({aptosConfig:t,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var n0={typeParameters:[],parameters:[Sr("0x1::object::Object"),new kt,new Ut]};async function Cp(n){let{aptosConfig:t,sender:e,fungibleAssetMetadataAddress:r,recipient:o,amount:s,options:i}=n;return Re({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,o,s],abi:n0},options:i})}var Ps=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return await Ge({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),zu({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return await Ge({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),(await zu({aptosConfig:this.config,options:{where:{asset_type:{_eq:t.assetType}}}}))[0]}async getFungibleAssetActivities(t){return await Ge({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Sp({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return await Ge({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),vp({aptosConfig:this.config,...t})}async transferFungibleAsset(t){return Cp({aptosConfig:this.config,...t})}};var Rs=class{constructor(t){this.config=t}async getLedgerInfo(){return Ri({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return Kd({aptosConfig:this.config,...t})}async getBlockByHeight(t){return Fd({aptosConfig:this.config,...t})}async getTableItem(t){return Oi({aptosConfig:this.config,...t})}async view(t){return Ar({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return Hd({aptosConfig:this.config,...t})}async queryIndexer(t){return ve({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return Ni({aptosConfig:this.config})}async getProcessorStatus(t){return ki({aptosConfig:this.config,processorType:t})}};var Ip=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function Bp(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Cr(n){let[t,e,...r]=n.replace(/\.apt$/,"").split(".");if(r.length>0)throw new Error(`${n} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!Bp(t))throw new Error(`${t} is not valid. ${Ip}`);if(e&&!Bp(e))throw new Error(`${e} is not valid. ${Ip}`);return{domainName:e||t,subdomainName:e?t:void 0}}var r0="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",o0={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:r0,custom:null,devnet:null,randomnet:null};function Zn(n){let t=o0[n.network];if(!t)throw new Error(`The ANS contract is not deployed to ${n.network}`);return t}var s0=n=>({vec:[n]}),i0=()=>({vec:[]}),Mu=n=>n!=null?s0(n):i0(),ha=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Up(n){let{aptosConfig:t,name:e}=n,r=Zn(t),{domainName:o,subdomainName:s}=Cr(e),i=await Ar({aptosConfig:t,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[o,Mu(s)]}}),c=ha(i[0]);return c?M.from(c).toString():void 0}async function Pp(n){let{aptosConfig:t,expiration:e,name:r,sender:o,targetAddress:s,toAddress:i,options:c,transferable:u}=n,d=Zn(t),{domainName:y,subdomainName:g}=Cr(r),T=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(g&&!T)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(T&&!g)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){let w=e.years??1;if(w!==1)throw new Error("For now, names can only be registered for 1 year at a time");let k=w*31536e3;return await Re({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${d}::router::register_domain`,functionArguments:[y,k,s,i]},options:c})}if(!g)throw new Error(`${e.policy} requires a subdomain to be provided.`);let S=await Gu({aptosConfig:t,name:y});if(!S)throw new Error("The domain does not exist");let b=e.policy==="subdomain:independent"?e.expirationDate:S;if(b>S)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await Re({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${d}::router::register_subdomain`,functionArguments:[y,g,Math.round(b/1e3),e.policy==="subdomain:follow-domain"?1:0,!!u,s,i]},options:c})}async function Gu(n){let{aptosConfig:t,name:e}=n,r=Zn(t),{domainName:o,subdomainName:s}=Cr(e);try{let i=await Ar({aptosConfig:t,payload:{function:`${r}::router::get_expiration`,functionArguments:[o,Mu(s)]}});return Number(i[0])*1e3}catch{return}}async function Rp(n){let{aptosConfig:t,address:e}=n,r=Zn(t),o=await Ar({aptosConfig:t,payload:{function:`${r}::router::get_primary_name`,functionArguments:[M.from(e).toString()]}}),s=ha(o[1]),i=ha(o[0]);if(s)return[i,s].filter(Boolean).join(".")}async function Op(n){let{aptosConfig:t,sender:e,name:r,options:o}=n,s=Zn(t);if(!r)return await Re({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:o});let{domainName:i,subdomainName:c}=Cr(r);return await Re({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[i,c]},options:o})}async function Np(n){let{aptosConfig:t,name:e}=n,r=Zn(t),{domainName:o,subdomainName:s}=Cr(e),i=await Ar({aptosConfig:t,payload:{function:`${r}::router::get_target_addr`,functionArguments:[o,Mu(s)]}}),c=ha(i[0]);return c?M.from(c).toString():void 0}async function kp(n){let{aptosConfig:t,sender:e,name:r,address:o,options:s}=n,i=Zn(t),{domainName:c,subdomainName:u}=Cr(r);return await Re({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::set_target_addr`,functionArguments:[c,u,o]},options:s})}async function Dp(n){let{aptosConfig:t,name:e}=n,{domainName:r,subdomainName:o=""}=Cr(e),c=(await ve({aptosConfig:t,query:{query:wo,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:o}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return c&&(c=Os(c)),c}async function zp(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await Lu({aptosConfig:t});return(await ve({aptosConfig:t,originMethod:"getAccountNames",query:{query:wo,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...n.options?.where??{},owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o}}}}})).current_aptos_names.map(Os)}async function Mp(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await Lu({aptosConfig:t});return(await ve({aptosConfig:t,originMethod:"getAccountDomains",query:{query:wo,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...n.options?.where??{},owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_eq:""}}}}})).current_aptos_names.map(Os)}async function Gp(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await Lu({aptosConfig:t});return(await ve({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:wo,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...n.options?.where??{},owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_neq:""}}}}})).current_aptos_names.map(Os)}async function Lp(n){let{aptosConfig:t,options:e,domain:r}=n;return(await ve({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:wo,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...n.options?.where??{},domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(Os)}async function Lu(n){let{aptosConfig:t}=n,e=Zn(t),[r]=await Ar({aptosConfig:t,payload:{function:`${e}::config::reregistration_grace_sec`,functionArguments:[]}}),o=r/60/60/24,s=()=>new Date;return new Date(s().setDate(s().getDate()-o)).toISOString()}async function qp(n){let{aptosConfig:t,sender:e,name:r,years:o=1,options:s}=n,i=Zn(t),c=o*31536e3,{domainName:u,subdomainName:d}=Cr(r);if(d)throw new Error("Subdomains cannot be renewed");if(o!==1)throw new Error("Currently, only 1 year renewals are supported");return await Re({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::renew_domain`,functionArguments:[u,c]},options:s})}function Os(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).valueOf()}}var Ns=class{constructor(t){this.config=t}async getOwnerAddress(t){return Up({aptosConfig:this.config,...t})}async getExpiration(t){return Gu({aptosConfig:this.config,...t})}async getTargetAddress(t){return Np({aptosConfig:this.config,...t})}async setTargetAddress(t){return kp({aptosConfig:this.config,...t})}async getPrimaryName(t){return Rp({aptosConfig:this.config,...t})}async setPrimaryName(t){return Op({aptosConfig:this.config,...t})}async registerName(t){return Pp({aptosConfig:this.config,...t})}async renewDomain(t){return qp({aptosConfig:this.config,...t})}async getName(t){return Dp({aptosConfig:this.config,...t})}async getAccountNames(t){return zp({aptosConfig:this.config,...t})}async getAccountDomains(t){return Mp({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return Gp({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return Lp({aptosConfig:this.config,...t})}};async function Kp(n){let{aptosConfig:t,poolAddress:e}=n,r=M.from(e).toStringLong(),s=await ve({aptosConfig:t,query:{query:Vc,variables:{where_condition:{pool_address:{_eq:r}}}}});return s.num_active_delegator_per_pool[0]?s.num_active_delegator_per_pool[0].num_active_delegator:0}async function Fp(n){let{aptosConfig:t,options:e}=n,r={query:Vc,variables:{order_by:e?.orderBy}};return(await ve({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function Hp(n){let{aptosConfig:t,delegatorAddress:e,poolAddress:r}=n,o={query:Dd,variables:{delegatorAddress:M.from(e).toStringLong(),poolAddress:M.from(r).toStringLong()}};return(await ve({aptosConfig:t,query:o})).delegated_staking_activities}var ks=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return await Ge({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"stake_processor"}),Kp({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return await Ge({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"stake_processor"}),Fp({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return await Ge({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"stake_processor"}),Hp({aptosConfig:this.config,...t})}};var Aa=class{constructor(t){this.config=t}async simple(t){return Re({aptosConfig:this.config,...t})}async multiAgent(t){return Re({aptosConfig:this.config,...t})}};function qu(n,t,e){let r=e.value;return e.value=async function(...o){let[s]=o;if(s.transaction.feePayerAddress&&!s.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,o)},e}function Ku(n,t,e){let r=e.value;return e.value=async function(...o){let[s]=o;if(s.transaction.feePayerAddress&&!s.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,o)},e}var Do=class{constructor(t){this.config=t}async simple(t){return Nu({aptosConfig:this.config,...t})}async multiAgent(t){return Nu({aptosConfig:this.config,...t})}};Ot([Ku],Do.prototype,"simple",1),Ot([Ku],Do.prototype,"multiAgent",1);var zo=class{constructor(t){this.config=t}async simple(t){return ma({aptosConfig:this.config,...t})}async multiAgent(t){return ma({aptosConfig:this.config,...t})}};Ot([qu],zo.prototype,"simple",1),Ot([qu],zo.prototype,"multiAgent",1);var jp=tf(Vp(),1);var ba=jp.default;var wa=()=>Math.floor(Date.now()/1e3),zs=class{constructor(t,e,r,o,s){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=e,this.maxWaitTime=r,this.maximumInFlight=o,this.sleepTime=s}async nextSequenceNumber(){for(;this.lock;)await xr(this.sleepTime);this.lock=!0;let t=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let e=wa();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await xr(this.sleepTime),wa()-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}t=this.currentNumber,this.currentNumber+=BigInt(1)}catch(e){console.error("error in getting next sequence number for this account",e)}finally{this.lock=!1}return t}async initialize(){let{sequence_number:t}=await Sn({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await Sn({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(t),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await xr(this.sleepTime);this.lock=!0;try{await this.update();let t=wa();for(;this.lastUncommintedNumber!==this.currentNumber;)wa()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await xr(this.sleepTime),await this.update())}catch(t){console.error("error in synchronizing this account sequence number with the one on chain",t)}finally{this.lock=!1}}}};var Mo=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(t){if(this.cancelled=!1,this.pendingDequeue.length>0){this.pendingDequeue.shift()?.resolve(t);return}this.queue.push(t)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((t,e)=>{this.pendingDequeue.push({resolve:t,reject:e})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:t})=>{t(new Go("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},Go=class extends Error{};var Hu="fulfilled",$u=(s=>(s.TransactionSent="transactionSent",s.TransactionSendFailed="transactionSendFailed",s.TransactionExecuted="transactionExecuted",s.TransactionExecutionFailed="transactionExecutionFailed",s.ExecutionFinish="executionFinish",s))($u||{}),Ms=class extends ba{constructor(e,r,o=30,s=100,i=10){super();this.taskQueue=new Mo;this.transactionsQueue=new Mo;this.outstandingTransactions=new Mo;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=e,this.account=r,this.started=!1,this.accountSequnceNumber=new zs(e,r,o,s,i)}async submitNextTransaction(){try{for(;;){let e=await this.accountSequnceNumber.nextSequenceNumber();if(e===null)return;let r=await this.generateNextTransaction(this.account,e);if(!r)return;let o=vs({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([o,e])}}catch(e){if(e instanceof Go)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async processTransactions(){try{for(;;){let e=[],r=[],[o,s]=await this.outstandingTransactions.dequeue();for(e.push(o),r.push(s);!this.outstandingTransactions.isEmpty();)[o,s]=await this.outstandingTransactions.dequeue(),e.push(o),r.push(s);let i=await Promise.allSettled(e);for(let c=0;c<i.length&&c<r.length;c+=1){let u=i[c];s=r[c],u.status===Hu?(this.sentTransactions.push([u.value.hash,s,null]),this.emit("transactionSent",{message:`transaction hash ${u.value.hash} has been committed to chain`,transactionHash:u.value.hash}),await this.checkTransaction(u,s)):(this.sentTransactions.push([u.status,s,u.reason]),this.emit("transactionSendFailed",{message:`failed to commit transaction ${this.sentTransactions.length} with error ${u.reason}`,error:u.reason}))}this.emit("executionFinish",{message:`execute ${i.length} transactions finished`})}}catch(e){if(e instanceof Go)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async checkTransaction(e,r){try{let o=[];o.push(_o({aptosConfig:this.aptosConfig,transactionHash:e.value.hash}));let s=await Promise.allSettled(o);for(let i=0;i<s.length;i+=1){let c=s[i];c.status===Hu?(this.executedTransactions.push([c.value.hash,r,null]),this.emit("transactionExecuted",{message:`transaction hash ${c.value.hash} has been executed on chain`,transactionHash:e.value.hash})):(this.executedTransactions.push([c.status,r,c.reason]),this.emit("transactionExecutionFailed",{message:`failed to execute transaction ${this.executedTransactions.length} with error ${c.reason}`,error:c.reason}))}}catch(o){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${o}`)}}async push(e,r){this.transactionsQueue.enqueue([e,r])}async generateNextTransaction(e,r){if(this.transactionsQueue.isEmpty())return;let[o,s]=await this.transactionsQueue.dequeue();return Re({aptosConfig:this.aptosConfig,sender:e.accountAddress,data:o,options:{...s,accountSequenceNumber:r}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(e){throw new Error(`Unable to start transaction batching: ${e}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};var Ta=class extends ba{constructor(e){super();this.config=e}start(e){let{sender:r}=e;this.account=r,this.transactionWorker=new Ms(this.config,r),this.transactionWorker.start(),this.registerToEvents()}push(e){let{data:r,options:o}=e;for(let s of r)this.transactionWorker.push(s,o)}registerToEvents(){this.transactionWorker.on("transactionSent",async e=>{this.emit("transactionSent",e)}),this.transactionWorker.on("transactionSendFailed",async e=>{this.emit("transactionSendFailed",e)}),this.transactionWorker.on("transactionExecuted",async e=>{this.emit("transactionExecuted",e)}),this.transactionWorker.on("transactionExecutionFailed",async e=>{this.emit("transactionExecutionFailed",e)}),this.transactionWorker.on("executionFinish",async e=>{this.emit("executionFinish",e)})}forSingleAccount(e){try{let{sender:r,data:o,options:s}=e;this.start({sender:r}),this.push({data:o,options:s})}catch(r){throw new Error(`failed to submit transactions with error: ${r}`)}}};var Gs=class{constructor(t){this.config=t,this.build=new Aa(this.config),this.simulate=new Do(this.config),this.submit=new zo(this.config),this.batch=new Ta(this.config)}async getTransactions(t){return sl({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return il({aptosConfig:this.config,...t})}async getTransactionByHash(t){return Gi({aptosConfig:this.config,...t})}async isPendingTransaction(t){return al({aptosConfig:this.config,...t})}async waitForTransaction(t){return _o({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return Mi({aptosConfig:this.config})}getSigningMessage(t){return Zl(t)}async publishPackageTransaction(t){return Xl({aptosConfig:this.config,...t})}async rotateAuthKey(t){return Jl({aptosConfig:this.config,...t})}sign(t){return ga({...t})}signAsFeePayer(t){let{signer:e,transaction:r}=t;if(!r.feePayerAddress)throw new Error(`Transaction ${r} is not a Fee Payer transaction`);return r.feePayerAddress=e.accountAddress,ga({signer:e,transaction:r})}async batchTransactionsForSingleAccount(t){try{let{sender:e,data:r,options:o}=t;this.batch.forSingleAccount({sender:e,data:r,options:o})}catch(e){throw new Error(`failed to submit transactions with error: ${e}`)}}async signAndSubmitTransaction(t){let{signer:e,transaction:r}=t;return vs({aptosConfig:this.config,signer:e,transaction:r})}};var Ht=class{constructor(t){this.config=new ms(t),this.account=new ss(this.config),this.ans=new Ns(this.config),this.coin=new Cs(this.config),this.digitalAsset=new Is(this.config),this.event=new Bs(this.config),this.faucet=new Us(this.config),this.fungibleAsset=new Ps(this.config),this.general=new Rs(this.config),this.staking=new ks(this.config),this.transaction=new Gs(this.config)}};function Rn(n,t,e){Object.getOwnPropertyNames(t.prototype).forEach(r=>{let o=Object.getOwnPropertyDescriptor(t.prototype,r);o&&(o.value=function(...s){return this[e][r](...s)},Object.defineProperty(n.prototype,r,o))})}Rn(Ht,ss,"account");Rn(Ht,Ns,"ans");Rn(Ht,Cs,"coin");Rn(Ht,Is,"digitalAsset");Rn(Ht,Bs,"event");Rn(Ht,Us,"faucet");Rn(Ht,Ps,"fungibleAsset");Rn(Ht,Rs,"general");Rn(Ht,ks,"staking");Rn(Ht,Gs,"transaction");return ng(u0);})();
428
+ `;async function Ri(n){let{aptosConfig:t}=n,{data:e}=await Lt({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function Vd(n){let{aptosConfig:t,ledgerVersion:e,options:r}=n,{data:o}=await Lt({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:r?.withTransactions}});return o}async function jd(n){let{aptosConfig:t,blockHeight:e,options:r}=n,{data:o}=await Lt({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:r?.withTransactions}});return o}async function Oi(n){let{aptosConfig:t,handle:e,data:r,options:o}=n;return(await Ur({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:o?.ledgerVersion},body:r})).data}async function yr(n){let{aptosConfig:t,payload:e,options:r}=n,{data:o}=await Ur({aptosConfig:t,originMethod:"view",path:"view",params:{ledger_version:r?.ledgerVersion},body:{function:e.function,type_arguments:e.typeArguments??[],arguments:e.functionArguments??[]}});return o}async function Wd(n){let{aptosConfig:t,limit:e}=n;return(await Se({aptosConfig:t,query:{query:Gd,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function Se(n){let{aptosConfig:t,query:e,originMethod:r}=n,{data:o}=await Ya({aptosConfig:t,originMethod:r??"queryIndexer",path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return o}async function Ny(n){let{aptosConfig:t}=n;return(await Se({aptosConfig:t,query:{query:Zc},originMethod:"getProcessorStatuses"})).processor_status}async function Ni(n){let t=await Ny({aptosConfig:n.aptosConfig});return BigInt(t[0].last_success_version)}async function ki(n){let{aptosConfig:t,processorType:e}=n,r={processor:{_eq:e.valueOf()}};return(await Se({aptosConfig:t,query:{query:Zc,variables:{where_condition:r}},originMethod:"getProcessorStatus"})).processor_status[0]}var Jc=new Map;function _o(n,t,e){return async(...r)=>{if(Jc.has(t)){let{value:s,timestamp:i}=Jc.get(t);if(e===void 0||Date.now()-i<=e)return s}let o=await n(...r);return Jc.set(t,{value:o,timestamp:Date.now()}),o}}async function In(n){let{aptosConfig:t,accountAddress:e}=n,{data:r}=await Lt({aptosConfig:t,originMethod:"getInfo",path:`accounts/${z.from(e).toString()}`});return r}async function Zd(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Pr({aptosConfig:t,originMethod:"getModules",path:`accounts/${z.from(e).toString()}/modules`,params:{ledger_version:r?.ledgerVersion,start:r?.offset,limit:r?.limit??1e3}})}async function Di(n){return n.options?.ledgerVersion!==void 0?Qd(n):_o(async()=>Qd(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function Qd(n){let{aptosConfig:t,accountAddress:e,moduleName:r,options:o}=n,{data:s}=await Lt({aptosConfig:t,originMethod:"getModule",path:`accounts/${z.from(e).toString()}/module/${r}`,params:{ledger_version:o?.ledgerVersion}});return s}async function Xd(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Pr({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${z.from(e).toString()}/transactions`,params:{start:r?.offset,limit:r?.limit}})}async function Jd(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Pr({aptosConfig:t,originMethod:"getResources",path:`accounts/${z.from(e).toString()}/resources`,params:{ledger_version:r?.ledgerVersion,start:r?.offset,limit:r?.limit??999}})}async function eu(n){let{aptosConfig:t,accountAddress:e,resourceType:r,options:o}=n,{data:s}=await Lt({aptosConfig:t,originMethod:"getResource",path:`accounts/${z.from(e).toString()}/resource/${r}`,params:{ledger_version:o?.ledgerVersion}});return s.data}async function tu(n){let{aptosConfig:t,authenticationKey:e,options:r}=n,o=await eu({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:s}}=o,i=z.from(e);try{let c=await Oi({aptosConfig:t,handle:s,data:{key:i.toString(),key_type:"address",value_type:"address"},options:r});return z.from(c)}catch(c){if(c instanceof Tn&&c.data.error_code==="table_item_not_found")return i;throw c}}async function el(n){let{aptosConfig:t,accountAddress:e}=n,o={owner_address:{_eq:z.from(e).toStringLong()},amount:{_gt:0}},i=await Se({aptosConfig:t,query:{query:Dd,variables:{where_condition:o}},originMethod:"getAccountTokensCount"});return i.current_token_ownerships_v2_aggregate.aggregate?i.current_token_ownerships_v2_aggregate.aggregate.count:0}async function tl(n){let{aptosConfig:t,accountAddress:e,options:r}=n,s={owner_address:{_eq:z.from(e).toStringLong()},amount:{_gt:0}};r?.tokenStandard&&(s.token_standard={_eq:r?.tokenStandard});let i={query:Nd,variables:{where_condition:s,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await Se({aptosConfig:t,query:i,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function nl(n){let{aptosConfig:t,accountAddress:e,collectionAddress:r,options:o}=n,s=z.from(e).toStringLong(),i=z.from(r).toStringLong(),c={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:i}},amount:{_gt:0}};o?.tokenStandard&&(c.token_standard={_eq:o?.tokenStandard});let u={query:kd,variables:{where_condition:c,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await Se({aptosConfig:t,query:u,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function rl(n){let{aptosConfig:t,accountAddress:e,options:r}=n,s={owner_address:{_eq:z.from(e).toStringLong()},amount:{_gt:0}};r?.tokenStandard&&(s.current_collection={token_standard:{_eq:r?.tokenStandard}});let i={query:Rd,variables:{where_condition:s,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await Se({aptosConfig:t,query:i,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function ol(n){let{aptosConfig:t,accountAddress:e}=n,r=z.from(e).toStringLong(),s=await Se({aptosConfig:t,query:{query:zd,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return s.account_transactions_aggregate.aggregate?s.account_transactions_aggregate.aggregate.count:0}async function sl(n){let{aptosConfig:t,accountAddress:e,coinType:r}=n,o=z.from(e).toStringLong(),s=await nu({aptosConfig:t,accountAddress:o,options:{where:{asset_type:{_eq:r}}}});return s[0]?s[0].amount:0}async function nu(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o=z.from(e).toStringLong(),s={...r?.where,owner_address:{_eq:o}},i={query:Ud,variables:{where_condition:s,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await Se({aptosConfig:t,query:i,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function il(n){let{aptosConfig:t,accountAddress:e}=n,r=z.from(e).toStringLong(),s=await Se({aptosConfig:t,query:{query:Pd,variables:{address:r}},originMethod:"getAccountCoinsCount"});if(!s.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return s.current_fungible_asset_balances_aggregate.aggregate.count}async function al(n){let{aptosConfig:t,accountAddress:e,options:r}=n,s={owner_address:{_eq:z.from(e).toStringLong()}},i={query:Od,variables:{where_condition:s,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await Se({aptosConfig:t,query:i,originMethod:"getAccountOwnedObjects"})).current_objects}async function cl(n){let{aptosConfig:t,privateKey:e}=n,r=new Bt(e.publicKey());if(e instanceof mr){let s=Ct.fromPublicKeyAndScheme({publicKey:r,scheme:2}).derivedAddress();return Wn.fromPrivateKeyAndAddress({privateKey:e,address:s})}if(e instanceof Kt){let o=Ct.fromPublicKeyAndScheme({publicKey:r,scheme:2});if(await Yd({authKey:o,aptosConfig:t})){let u=o.derivedAddress();return Wn.fromPrivateKeyAndAddress({privateKey:e,address:u,legacy:!1})}let i=Ct.fromPublicKeyAndScheme({publicKey:r.publicKey,scheme:0});if(await Yd({authKey:i,aptosConfig:t})){let u=i.derivedAddress();return Wn.fromPrivateKeyAndAddress({privateKey:e,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function Yd(n){let{aptosConfig:t,authKey:e}=n,r=await tu({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await In({aptosConfig:t,accountAddress:r}),!0}catch(o){if(o.status===404)return!1;throw new Error(`Error while looking for an account info ${r.toString()}`)}}async function hr(n){return new Promise(t=>{setTimeout(t,n)})}async function ul(n){let{aptosConfig:t,options:e}=n;return Pr({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:e?.offset,limit:e?.limit}})}async function Gi(n){let{aptosConfig:t}=n;return _o(async()=>{let{data:e}=await Lt({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function fl(n){let{aptosConfig:t,ledgerVersion:e}=n,{data:r}=await Lt({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return r}async function Mi(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await Lt({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return r}async function dl(n){let{aptosConfig:t,transactionHash:e}=n;try{return(await Mi({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(r){if(r?.status===404)return!0;throw r}}async function So(n){let{aptosConfig:t,transactionHash:e,options:r}=n,o=r?.timeoutSecs??20,s=r?.checkSuccess??!0,i=!0,c=0,u,d,y=200,g=1.5;for(;i&&!(c>=o);){try{if(u=await Mi({aptosConfig:t,transactionHash:e}),i=u.type==="pending_transaction",!i)break}catch(T){if(!(T instanceof Tn)||(d=T,T.status!==404&&T.status>=400&&T.status<500))throw T}await hr(y),c+=y/1e3,y*=g}if(u===void 0)throw d||new zi(`Fetching transaction ${e} failed and timed out after ${o} seconds`,u);if(u.type==="pending_transaction")throw new zi(`Transaction ${e} timed out in pending state after ${o} seconds`,u);if(!s)return u;if(!u.success)throw new ru(`Transaction ${e} failed with an error: ${u.vm_status}`,u);return u}async function Li(n){let{aptosConfig:t,processorType:e}=n,r=BigInt(n.minimumLedgerVersion),o=3e3,s=new Date().getTime(),i=BigInt(-1);for(;i<r;){if(new Date().getTime()-s>o)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(e===void 0?i=await Ni({aptosConfig:t}):i=(await ki({aptosConfig:t,processorType:e})).last_success_version,i>=r)break;await hr(200)}}var zi=class extends Error{constructor(e,r){super(e);this.lastSubmittedTransaction=r}},ru=class extends Error{constructor(e,r){super(e);this.transaction=r}};async function De(n){n.minimumLedgerVersion!==void 0&&await Li({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}var cs=class{constructor(t){this.config=t}async getAccountInfo(t){return In({aptosConfig:this.config,...t})}async getAccountModules(t){return Zd({aptosConfig:this.config,...t})}async getAccountModule(t){return Di({aptosConfig:this.config,...t})}async getAccountTransactions(t){return Xd({aptosConfig:this.config,...t})}async getAccountResources(t){return Jd({aptosConfig:this.config,...t})}async getAccountResource(t){return eu({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return tu({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),el({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),tl({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),nl({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),rl({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),ol({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),nu({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),il({aptosConfig:this.config,...t})}async getAccountAPTAmount(t){return this.getAccountCoinAmount({coinType:Yo,...t})}async getAccountCoinAmount(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),sl({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),al({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return cl({aptosConfig:this.config,...t})}};function us(n,t){return function(){return n.apply(t,arguments)}}var{toString:ky}=Object.prototype,{getPrototypeOf:iu}=Object,Ki=(n=>t=>{let e=ky.call(t);return n[e]||(n[e]=e.slice(8,-1).toLowerCase())})(Object.create(null)),Bn=n=>(n=n.toLowerCase(),t=>Ki(t)===n),Fi=n=>t=>typeof t===n,{isArray:vo}=Array,fs=Fi("undefined");function Dy(n){return n!==null&&!fs(n)&&n.constructor!==null&&!fs(n.constructor)&&sn(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}var gl=Bn("ArrayBuffer");function zy(n){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(n):t=n&&n.buffer&&gl(n.buffer),t}var Gy=Fi("string"),sn=Fi("function"),ml=Fi("number"),Hi=n=>n!==null&&typeof n=="object",My=n=>n===!0||n===!1,qi=n=>{if(Ki(n)!=="object")return!1;let t=iu(n);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},Ly=Bn("Date"),qy=Bn("File"),Ky=Bn("Blob"),Fy=Bn("FileList"),Hy=n=>Hi(n)&&sn(n.pipe),$y=n=>{let t;return n&&(typeof FormData=="function"&&n instanceof FormData||sn(n.append)&&((t=Ki(n))==="formdata"||t==="object"&&sn(n.toString)&&n.toString()==="[object FormData]"))},Vy=Bn("URLSearchParams"),jy=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ds(n,t,{allOwnKeys:e=!1}={}){if(n===null||typeof n>"u")return;let r,o;if(typeof n!="object"&&(n=[n]),vo(n))for(r=0,o=n.length;r<o;r++)t.call(null,n[r],r,n);else{let s=e?Object.getOwnPropertyNames(n):Object.keys(n),i=s.length,c;for(r=0;r<i;r++)c=s[r],t.call(null,n[c],c,n)}}function yl(n,t){t=t.toLowerCase();let e=Object.keys(n),r=e.length,o;for(;r-- >0;)if(o=e[r],t===o.toLowerCase())return o;return null}var hl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Al=n=>!fs(n)&&n!==hl;function su(){let{caseless:n}=Al(this)&&this||{},t={},e=(r,o)=>{let s=n&&yl(t,o)||o;qi(t[s])&&qi(r)?t[s]=su(t[s],r):qi(r)?t[s]=su({},r):vo(r)?t[s]=r.slice():t[s]=r};for(let r=0,o=arguments.length;r<o;r++)arguments[r]&&ds(arguments[r],e);return t}var Wy=(n,t,e,{allOwnKeys:r}={})=>(ds(t,(o,s)=>{e&&sn(o)?n[s]=us(o,e):n[s]=o},{allOwnKeys:r}),n),Qy=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),Yy=(n,t,e,r)=>{n.prototype=Object.create(t.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:t.prototype}),e&&Object.assign(n.prototype,e)},Zy=(n,t,e,r)=>{let o,s,i,c={};if(t=t||{},n==null)return t;do{for(o=Object.getOwnPropertyNames(n),s=o.length;s-- >0;)i=o[s],(!r||r(i,n,t))&&!c[i]&&(t[i]=n[i],c[i]=!0);n=e!==!1&&iu(n)}while(n&&(!e||e(n,t))&&n!==Object.prototype);return t},Xy=(n,t,e)=>{n=String(n),(e===void 0||e>n.length)&&(e=n.length),e-=t.length;let r=n.indexOf(t,e);return r!==-1&&r===e},Jy=n=>{if(!n)return null;if(vo(n))return n;let t=n.length;if(!ml(t))return null;let e=new Array(t);for(;t-- >0;)e[t]=n[t];return e},eh=(n=>t=>n&&t instanceof n)(typeof Uint8Array<"u"&&iu(Uint8Array)),th=(n,t)=>{let r=(n&&n[Symbol.iterator]).call(n),o;for(;(o=r.next())&&!o.done;){let s=o.value;t.call(n,s[0],s[1])}},nh=(n,t)=>{let e,r=[];for(;(e=n.exec(t))!==null;)r.push(e);return r},rh=Bn("HTMLFormElement"),oh=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,r,o){return r.toUpperCase()+o}),ll=(({hasOwnProperty:n})=>(t,e)=>n.call(t,e))(Object.prototype),sh=Bn("RegExp"),xl=(n,t)=>{let e=Object.getOwnPropertyDescriptors(n),r={};ds(e,(o,s)=>{let i;(i=t(o,s,n))!==!1&&(r[s]=i||o)}),Object.defineProperties(n,r)},ih=n=>{xl(n,(t,e)=>{if(sn(n)&&["arguments","caller","callee"].indexOf(e)!==-1)return!1;let r=n[e];if(sn(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+e+"'")})}})},ah=(n,t)=>{let e={},r=o=>{o.forEach(s=>{e[s]=!0})};return vo(n)?r(n):r(String(n).split(t)),e},ch=()=>{},uh=(n,t)=>(n=+n,Number.isFinite(n)?n:t),ou="abcdefghijklmnopqrstuvwxyz",pl="0123456789",bl={DIGIT:pl,ALPHA:ou,ALPHA_DIGIT:ou+ou.toUpperCase()+pl},fh=(n=16,t=bl.ALPHA_DIGIT)=>{let e="",{length:r}=t;for(;n--;)e+=t[Math.random()*r|0];return e};function dh(n){return!!(n&&sn(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}var lh=n=>{let t=new Array(10),e=(r,o)=>{if(Hi(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[o]=r;let s=vo(r)?[]:{};return ds(r,(i,c)=>{let u=e(i,o+1);!fs(u)&&(s[c]=u)}),t[o]=void 0,s}}return r};return e(n,0)},ph=Bn("AsyncFunction"),gh=n=>n&&(Hi(n)||sn(n))&&sn(n.then)&&sn(n.catch),B={isArray:vo,isArrayBuffer:gl,isBuffer:Dy,isFormData:$y,isArrayBufferView:zy,isString:Gy,isNumber:ml,isBoolean:My,isObject:Hi,isPlainObject:qi,isUndefined:fs,isDate:Ly,isFile:qy,isBlob:Ky,isRegExp:sh,isFunction:sn,isStream:Hy,isURLSearchParams:Vy,isTypedArray:eh,isFileList:Fy,forEach:ds,merge:su,extend:Wy,trim:jy,stripBOM:Qy,inherits:Yy,toFlatObject:Zy,kindOf:Ki,kindOfTest:Bn,endsWith:Xy,toArray:Jy,forEachEntry:th,matchAll:nh,isHTMLForm:rh,hasOwnProperty:ll,hasOwnProp:ll,reduceDescriptors:xl,freezeMethods:ih,toObjectSet:ah,toCamelCase:oh,noop:ch,toFiniteNumber:uh,findKey:yl,global:hl,isContextDefined:Al,ALPHABET:bl,generateString:fh,isSpecCompliantForm:dh,toJSONObject:lh,isAsyncFn:ph,isThenable:gh};function Co(n,t,e,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",t&&(this.code=t),e&&(this.config=e),r&&(this.request=r),o&&(this.response=o)}B.inherits(Co,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:B.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var wl=Co.prototype,Tl={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{Tl[n]={value:n}});Object.defineProperties(Co,Tl);Object.defineProperty(wl,"isAxiosError",{value:!0});Co.from=(n,t,e,r,o,s)=>{let i=Object.create(wl);return B.toFlatObject(n,i,function(u){return u!==Error.prototype},c=>c!=="isAxiosError"),Co.call(i,n.message,t,e,r,o),i.cause=n,i.name=n.name,s&&Object.assign(i,s),i};var ve=Co;var $i=null;function au(n){return B.isPlainObject(n)||B.isArray(n)}function _l(n){return B.endsWith(n,"[]")?n.slice(0,-2):n}function El(n,t,e){return n?n.concat(t).map(function(o,s){return o=_l(o),!e&&s?"["+o+"]":o}).join(e?".":""):t}function mh(n){return B.isArray(n)&&!n.some(au)}var yh=B.toFlatObject(B,{},null,function(t){return/^is[A-Z]/.test(t)});function hh(n,t,e){if(!B.isObject(n))throw new TypeError("target must be an object");t=t||new($i||FormData),e=B.toFlatObject(e,{metaTokens:!0,dots:!1,indexes:!1},!1,function(h,w){return!B.isUndefined(w[h])});let r=e.metaTokens,o=e.visitor||y,s=e.dots,i=e.indexes,u=(e.Blob||typeof Blob<"u"&&Blob)&&B.isSpecCompliantForm(t);if(!B.isFunction(o))throw new TypeError("visitor must be a function");function d(b){if(b===null)return"";if(B.isDate(b))return b.toISOString();if(!u&&B.isBlob(b))throw new ve("Blob is not supported. Use a Buffer instead.");return B.isArrayBuffer(b)||B.isTypedArray(b)?u&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function y(b,h,w){let v=b;if(b&&!w&&typeof b=="object"){if(B.endsWith(h,"{}"))h=r?h:h.slice(0,-2),b=JSON.stringify(b);else if(B.isArray(b)&&mh(b)||(B.isFileList(b)||B.endsWith(h,"[]"))&&(v=B.toArray(b)))return h=_l(h),v.forEach(function(U,$){!(B.isUndefined(U)||U===null)&&t.append(i===!0?El([h],$,s):i===null?h:h+"[]",d(U))}),!1}return au(b)?!0:(t.append(El(w,h,s),d(b)),!1)}let g=[],T=Object.assign(yh,{defaultVisitor:y,convertValue:d,isVisitable:au});function S(b,h){if(!B.isUndefined(b)){if(g.indexOf(b)!==-1)throw Error("Circular reference detected in "+h.join("."));g.push(b),B.forEach(b,function(v,k){(!(B.isUndefined(v)||v===null)&&o.call(t,v,B.isString(k)?k.trim():k,h,T))===!0&&S(v,h?h.concat(k):[k])}),g.pop()}}if(!B.isObject(n))throw new TypeError("data must be an object");return S(n),t}var Ar=hh;function Sl(n){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function vl(n,t){this._pairs=[],n&&Ar(n,this,t)}var Cl=vl.prototype;Cl.append=function(t,e){this._pairs.push([t,e])};Cl.toString=function(t){let e=t?function(r){return t.call(this,r,Sl)}:Sl;return this._pairs.map(function(o){return e(o[0])+"="+e(o[1])},"").join("&")};var Vi=vl;function Ah(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ls(n,t,e){if(!t)return n;let r=e&&e.encode||Ah,o=e&&e.serialize,s;if(o?s=o(t,e):s=B.isURLSearchParams(t)?t.toString():new Vi(t,e).toString(r),s){let i=n.indexOf("#");i!==-1&&(n=n.slice(0,i)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}var cu=class{constructor(){this.handlers=[]}use(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){B.forEach(this.handlers,function(r){r!==null&&t(r)})}},uu=cu;var ji={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Il=typeof URLSearchParams<"u"?URLSearchParams:Vi;var Bl=typeof FormData<"u"?FormData:null;var Pl=typeof Blob<"u"?Blob:null;var Ul={isBrowser:!0,classes:{URLSearchParams:Il,FormData:Bl,Blob:Pl},protocols:["http","https","file","blob","url","data"]};var fu={};Ws(fu,{hasBrowserEnv:()=>Rl,hasStandardBrowserEnv:()=>xh,hasStandardBrowserWebWorkerEnv:()=>bh});var Rl=typeof window<"u"&&typeof document<"u",xh=(n=>Rl&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),bh=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function";var Pt={...fu,...Ul};function du(n,t){return Ar(n,new Pt.classes.URLSearchParams,Object.assign({visitor:function(e,r,o,s){return Pt.isNode&&B.isBuffer(e)?(this.append(r,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function wh(n){return B.matchAll(/\w+|\[(\w*)]/g,n).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Th(n){let t={},e=Object.keys(n),r,o=e.length,s;for(r=0;r<o;r++)s=e[r],t[s]=n[s];return t}function Eh(n){function t(e,r,o,s){let i=e[s++],c=Number.isFinite(+i),u=s>=e.length;return i=!i&&B.isArray(o)?o.length:i,u?(B.hasOwnProp(o,i)?o[i]=[o[i],r]:o[i]=r,!c):((!o[i]||!B.isObject(o[i]))&&(o[i]=[]),t(e,r,o[i],s)&&B.isArray(o[i])&&(o[i]=Th(o[i])),!c)}if(B.isFormData(n)&&B.isFunction(n.entries)){let e={};return B.forEachEntry(n,(r,o)=>{t(wh(r),o,e,0)}),e}return null}var Wi=Eh;function _h(n,t,e){if(B.isString(n))try{return(t||JSON.parse)(n),B.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(e||JSON.stringify)(n)}var lu={transitional:ji,adapter:["xhr","http"],transformRequest:[function(t,e){let r=e.getContentType()||"",o=r.indexOf("application/json")>-1,s=B.isObject(t);if(s&&B.isHTMLForm(t)&&(t=new FormData(t)),B.isFormData(t))return o&&o?JSON.stringify(Wi(t)):t;if(B.isArrayBuffer(t)||B.isBuffer(t)||B.isStream(t)||B.isFile(t)||B.isBlob(t))return t;if(B.isArrayBufferView(t))return t.buffer;if(B.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return du(t,this.formSerializer).toString();if((c=B.isFileList(t))||r.indexOf("multipart/form-data")>-1){let u=this.env&&this.env.FormData;return Ar(c?{"files[]":t}:t,u&&new u,this.formSerializer)}}return s||o?(e.setContentType("application/json",!1),_h(t)):t}],transformResponse:[function(t){let e=this.transitional||lu.transitional,r=e&&e.forcedJSONParsing,o=this.responseType==="json";if(t&&B.isString(t)&&(r&&!this.responseType||o)){let i=!(e&&e.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(c){if(i)throw c.name==="SyntaxError"?ve.from(c,ve.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Pt.classes.FormData,Blob:Pt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};B.forEach(["delete","get","head","post","put","patch"],n=>{lu.headers[n]={}});var Io=lu;var Sh=B.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ol=n=>{let t={},e,r,o;return n&&n.split(`
429
+ `).forEach(function(i){o=i.indexOf(":"),e=i.substring(0,o).trim().toLowerCase(),r=i.substring(o+1).trim(),!(!e||t[e]&&Sh[e])&&(e==="set-cookie"?t[e]?t[e].push(r):t[e]=[r]:t[e]=t[e]?t[e]+", "+r:r)}),t};var Nl=Symbol("internals");function ps(n){return n&&String(n).trim().toLowerCase()}function Qi(n){return n===!1||n==null?n:B.isArray(n)?n.map(Qi):String(n)}function vh(n){let t=Object.create(null),e=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=e.exec(n);)t[r[1]]=r[2];return t}var Ch=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function pu(n,t,e,r,o){if(B.isFunction(r))return r.call(this,t,e);if(o&&(t=e),!!B.isString(t)){if(B.isString(r))return t.indexOf(r)!==-1;if(B.isRegExp(r))return r.test(t)}}function Ih(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,e,r)=>e.toUpperCase()+r)}function Bh(n,t){let e=B.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+e,{value:function(o,s,i){return this[r].call(this,t,o,s,i)},configurable:!0})})}var Bo=class{constructor(t){t&&this.set(t)}set(t,e,r){let o=this;function s(c,u,d){let y=ps(u);if(!y)throw new Error("header name must be a non-empty string");let g=B.findKey(o,y);(!g||o[g]===void 0||d===!0||d===void 0&&o[g]!==!1)&&(o[g||u]=Qi(c))}let i=(c,u)=>B.forEach(c,(d,y)=>s(d,y,u));return B.isPlainObject(t)||t instanceof this.constructor?i(t,e):B.isString(t)&&(t=t.trim())&&!Ch(t)?i(Ol(t),e):t!=null&&s(e,t,r),this}get(t,e){if(t=ps(t),t){let r=B.findKey(this,t);if(r){let o=this[r];if(!e)return o;if(e===!0)return vh(o);if(B.isFunction(e))return e.call(this,o,r);if(B.isRegExp(e))return e.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=ps(t),t){let r=B.findKey(this,t);return!!(r&&this[r]!==void 0&&(!e||pu(this,this[r],r,e)))}return!1}delete(t,e){let r=this,o=!1;function s(i){if(i=ps(i),i){let c=B.findKey(r,i);c&&(!e||pu(r,r[c],c,e))&&(delete r[c],o=!0)}}return B.isArray(t)?t.forEach(s):s(t),o}clear(t){let e=Object.keys(this),r=e.length,o=!1;for(;r--;){let s=e[r];(!t||pu(this,this[s],s,t,!0))&&(delete this[s],o=!0)}return o}normalize(t){let e=this,r={};return B.forEach(this,(o,s)=>{let i=B.findKey(r,s);if(i){e[i]=Qi(o),delete e[s];return}let c=t?Ih(s):String(s).trim();c!==s&&delete e[s],e[c]=Qi(o),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let e=Object.create(null);return B.forEach(this,(r,o)=>{r!=null&&r!==!1&&(e[o]=t&&B.isArray(r)?r.join(", "):r)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join(`
430
+ `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){let r=new this(t);return e.forEach(o=>r.set(o)),r}static accessor(t){let r=(this[Nl]=this[Nl]={accessors:{}}).accessors,o=this.prototype;function s(i){let c=ps(i);r[c]||(Bh(o,i),r[c]=!0)}return B.isArray(t)?t.forEach(s):s(t),this}};Bo.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);B.reduceDescriptors(Bo.prototype,({value:n},t)=>{let e=t[0].toUpperCase()+t.slice(1);return{get:()=>n,set(r){this[e]=r}}});B.freezeMethods(Bo);var Ut=Bo;function gs(n,t){let e=this||Io,r=t||e,o=Ut.from(r.headers),s=r.data;return B.forEach(n,function(c){s=c.call(e,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function ms(n){return!!(n&&n.__CANCEL__)}function kl(n,t,e){ve.call(this,n??"canceled",ve.ERR_CANCELED,t,e),this.name="CanceledError"}B.inherits(kl,ve,{__CANCEL__:!0});var xr=kl;function gu(n,t,e){let r=e.config.validateStatus;!e.status||!r||r(e.status)?n(e):t(new ve("Request failed with status code "+e.status,[ve.ERR_BAD_REQUEST,ve.ERR_BAD_RESPONSE][Math.floor(e.status/100)-4],e.config,e.request,e))}var Dl=Pt.hasStandardBrowserEnv?{write(n,t,e,r,o,s){let i=[n+"="+encodeURIComponent(t)];B.isNumber(e)&&i.push("expires="+new Date(e).toGMTString()),B.isString(r)&&i.push("path="+r),B.isString(o)&&i.push("domain="+o),s===!0&&i.push("secure"),document.cookie=i.join("; ")},read(n){let t=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function mu(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function yu(n,t){return t?n.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):n}function ys(n,t){return n&&!mu(t)?yu(n,t):t}var zl=Pt.hasStandardBrowserEnv?function(){let t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a"),r;function o(s){let i=s;return t&&(e.setAttribute("href",i),i=e.href),e.setAttribute("href",i),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:e.pathname.charAt(0)==="/"?e.pathname:"/"+e.pathname}}return r=o(window.location.href),function(i){let c=B.isString(i)?o(i):i;return c.protocol===r.protocol&&c.host===r.host}}():function(){return function(){return!0}}();function hu(n){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return t&&t[1]||""}function Ph(n,t){n=n||10;let e=new Array(n),r=new Array(n),o=0,s=0,i;return t=t!==void 0?t:1e3,function(u){let d=Date.now(),y=r[s];i||(i=d),e[o]=u,r[o]=d;let g=s,T=0;for(;g!==o;)T+=e[g++],g=g%n;if(o=(o+1)%n,o===s&&(s=(s+1)%n),d-i<t)return;let S=y&&d-y;return S?Math.round(T*1e3/S):void 0}}var Gl=Ph;function Ml(n,t){let e=0,r=Gl(50,250);return o=>{let s=o.loaded,i=o.lengthComputable?o.total:void 0,c=s-e,u=r(c),d=s<=i;e=s;let y={loaded:s,total:i,progress:i?s/i:void 0,bytes:c,rate:u||void 0,estimated:u&&i&&d?(i-s)/u:void 0,event:o};y[t?"download":"upload"]=!0,n(y)}}var Uh=typeof XMLHttpRequest<"u",Ll=Uh&&function(n){return new Promise(function(e,r){let o=n.data,s=Ut.from(n.headers).normalize(),{responseType:i,withXSRFToken:c}=n,u;function d(){n.cancelToken&&n.cancelToken.unsubscribe(u),n.signal&&n.signal.removeEventListener("abort",u)}let y;if(B.isFormData(o)){if(Pt.hasStandardBrowserEnv||Pt.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((y=s.getContentType())!==!1){let[h,...w]=y?y.split(";").map(v=>v.trim()).filter(Boolean):[];s.setContentType([h||"multipart/form-data",...w].join("; "))}}let g=new XMLHttpRequest;if(n.auth){let h=n.auth.username||"",w=n.auth.password?unescape(encodeURIComponent(n.auth.password)):"";s.set("Authorization","Basic "+btoa(h+":"+w))}let T=ys(n.baseURL,n.url);g.open(n.method.toUpperCase(),ls(T,n.params,n.paramsSerializer),!0),g.timeout=n.timeout;function S(){if(!g)return;let h=Ut.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),v={data:!i||i==="text"||i==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:h,config:n,request:g};gu(function(U){e(U),d()},function(U){r(U),d()},v),g=null}if("onloadend"in g?g.onloadend=S:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(S)},g.onabort=function(){g&&(r(new ve("Request aborted",ve.ECONNABORTED,n,g)),g=null)},g.onerror=function(){r(new ve("Network Error",ve.ERR_NETWORK,n,g)),g=null},g.ontimeout=function(){let w=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",v=n.transitional||ji;n.timeoutErrorMessage&&(w=n.timeoutErrorMessage),r(new ve(w,v.clarifyTimeoutError?ve.ETIMEDOUT:ve.ECONNABORTED,n,g)),g=null},Pt.hasStandardBrowserEnv&&(c&&B.isFunction(c)&&(c=c(n)),c||c!==!1&&zl(T))){let h=n.xsrfHeaderName&&n.xsrfCookieName&&Dl.read(n.xsrfCookieName);h&&s.set(n.xsrfHeaderName,h)}o===void 0&&s.setContentType(null),"setRequestHeader"in g&&B.forEach(s.toJSON(),function(w,v){g.setRequestHeader(v,w)}),B.isUndefined(n.withCredentials)||(g.withCredentials=!!n.withCredentials),i&&i!=="json"&&(g.responseType=n.responseType),typeof n.onDownloadProgress=="function"&&g.addEventListener("progress",Ml(n.onDownloadProgress,!0)),typeof n.onUploadProgress=="function"&&g.upload&&g.upload.addEventListener("progress",Ml(n.onUploadProgress)),(n.cancelToken||n.signal)&&(u=h=>{g&&(r(!h||h.type?new xr(null,n,g):h),g.abort(),g=null)},n.cancelToken&&n.cancelToken.subscribe(u),n.signal&&(n.signal.aborted?u():n.signal.addEventListener("abort",u)));let b=hu(T);if(b&&Pt.protocols.indexOf(b)===-1){r(new ve("Unsupported protocol "+b+":",ve.ERR_BAD_REQUEST,n));return}g.send(o||null)})};var Au={http:$i,xhr:Ll};B.forEach(Au,(n,t)=>{if(n){try{Object.defineProperty(n,"name",{value:t})}catch{}Object.defineProperty(n,"adapterName",{value:t})}});var ql=n=>`- ${n}`,Rh=n=>B.isFunction(n)||n===null||n===!1,Yi={getAdapter:n=>{n=B.isArray(n)?n:[n];let{length:t}=n,e,r,o={};for(let s=0;s<t;s++){e=n[s];let i;if(r=e,!Rh(e)&&(r=Au[(i=String(e)).toLowerCase()],r===void 0))throw new ve(`Unknown adapter '${i}'`);if(r)break;o[i||"#"+s]=r}if(!r){let s=Object.entries(o).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build")),i=t?s.length>1?`since :
431
+ `+s.map(ql).join(`
432
+ `):" "+ql(s[0]):"as no adapter specified";throw new ve("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:Au};function xu(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new xr(null,n)}function Zi(n){return xu(n),n.headers=Ut.from(n.headers),n.data=gs.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),Yi.getAdapter(n.adapter||Io.adapter)(n).then(function(r){return xu(n),r.data=gs.call(n,n.transformResponse,r),r.headers=Ut.from(r.headers),r},function(r){return ms(r)||(xu(n),r&&r.response&&(r.response.data=gs.call(n,n.transformResponse,r.response),r.response.headers=Ut.from(r.response.headers))),Promise.reject(r)})}var Kl=n=>n instanceof Ut?n.toJSON():n;function Qn(n,t){t=t||{};let e={};function r(d,y,g){return B.isPlainObject(d)&&B.isPlainObject(y)?B.merge.call({caseless:g},d,y):B.isPlainObject(y)?B.merge({},y):B.isArray(y)?y.slice():y}function o(d,y,g){if(B.isUndefined(y)){if(!B.isUndefined(d))return r(void 0,d,g)}else return r(d,y,g)}function s(d,y){if(!B.isUndefined(y))return r(void 0,y)}function i(d,y){if(B.isUndefined(y)){if(!B.isUndefined(d))return r(void 0,d)}else return r(void 0,y)}function c(d,y,g){if(g in t)return r(d,y);if(g in n)return r(void 0,d)}let u={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(d,y)=>o(Kl(d),Kl(y),!0)};return B.forEach(Object.keys(Object.assign({},n,t)),function(y){let g=u[y]||o,T=g(n[y],t[y],y);B.isUndefined(T)&&g!==c||(e[y]=T)}),e}var Xi="1.6.2";var bu={};["object","boolean","number","function","string","symbol"].forEach((n,t)=>{bu[n]=function(r){return typeof r===n||"a"+(t<1?"n ":" ")+n}});var Fl={};bu.transitional=function(t,e,r){function o(s,i){return"[Axios v"+Xi+"] Transitional option '"+s+"'"+i+(r?". "+r:"")}return(s,i,c)=>{if(t===!1)throw new ve(o(i," has been removed"+(e?" in "+e:"")),ve.ERR_DEPRECATED);return e&&!Fl[i]&&(Fl[i]=!0,console.warn(o(i," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(s,i,c):!0}};function Oh(n,t,e){if(typeof n!="object")throw new ve("options must be an object",ve.ERR_BAD_OPTION_VALUE);let r=Object.keys(n),o=r.length;for(;o-- >0;){let s=r[o],i=t[s];if(i){let c=n[s],u=c===void 0||i(c,s,n);if(u!==!0)throw new ve("option "+s+" must be "+u,ve.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new ve("Unknown option "+s,ve.ERR_BAD_OPTION)}}var Ji={assertOptions:Oh,validators:bu};var br=Ji.validators,Po=class{constructor(t){this.defaults=t,this.interceptors={request:new uu,response:new uu}}request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=Qn(this.defaults,e);let{transitional:r,paramsSerializer:o,headers:s}=e;r!==void 0&&Ji.assertOptions(r,{silentJSONParsing:br.transitional(br.boolean),forcedJSONParsing:br.transitional(br.boolean),clarifyTimeoutError:br.transitional(br.boolean)},!1),o!=null&&(B.isFunction(o)?e.paramsSerializer={serialize:o}:Ji.assertOptions(o,{encode:br.function,serialize:br.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let i=s&&B.merge(s.common,s[e.method]);s&&B.forEach(["delete","get","head","post","put","patch","common"],b=>{delete s[b]}),e.headers=Ut.concat(i,s);let c=[],u=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(e)===!1||(u=u&&h.synchronous,c.unshift(h.fulfilled,h.rejected))});let d=[];this.interceptors.response.forEach(function(h){d.push(h.fulfilled,h.rejected)});let y,g=0,T;if(!u){let b=[Zi.bind(this),void 0];for(b.unshift.apply(b,c),b.push.apply(b,d),T=b.length,y=Promise.resolve(e);g<T;)y=y.then(b[g++],b[g++]);return y}T=c.length;let S=e;for(g=0;g<T;){let b=c[g++],h=c[g++];try{S=b(S)}catch(w){h.call(this,w);break}}try{y=Zi.call(this,S)}catch(b){return Promise.reject(b)}for(g=0,T=d.length;g<T;)y=y.then(d[g++],d[g++]);return y}getUri(t){t=Qn(this.defaults,t);let e=ys(t.baseURL,t.url);return ls(e,t.params,t.paramsSerializer)}};B.forEach(["delete","get","head","options"],function(t){Po.prototype[t]=function(e,r){return this.request(Qn(r||{},{method:t,url:e,data:(r||{}).data}))}});B.forEach(["post","put","patch"],function(t){function e(r){return function(s,i,c){return this.request(Qn(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}Po.prototype[t]=e(),Po.prototype[t+"Form"]=e(!0)});var hs=Po;var wu=class n{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(s){e=s});let r=this;this.promise.then(o=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s,i=new Promise(c=>{r.subscribe(c),s=c}).then(o);return i.cancel=function(){r.unsubscribe(s)},i},t(function(s,i,c){r.reason||(r.reason=new xr(s,i,c),e(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}static source(){let t;return{token:new n(function(o){t=o}),cancel:t}}},Hl=wu;function Tu(n){return function(e){return n.apply(null,e)}}function Eu(n){return B.isObject(n)&&n.isAxiosError===!0}var _u={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(_u).forEach(([n,t])=>{_u[t]=n});var $l=_u;function Vl(n){let t=new hs(n),e=us(hs.prototype.request,t);return B.extend(e,hs.prototype,t,{allOwnKeys:!0}),B.extend(e,t,null,{allOwnKeys:!0}),e.create=function(o){return Vl(Qn(n,o))},e}var ft=Vl(Io);ft.Axios=hs;ft.CanceledError=xr;ft.CancelToken=Hl;ft.isCancel=ms;ft.VERSION=Xi;ft.toFormData=Ar;ft.AxiosError=ve;ft.Cancel=ft.CanceledError;ft.all=function(t){return Promise.all(t)};ft.spread=Tu;ft.isAxiosError=Eu;ft.mergeConfig=Qn;ft.AxiosHeaders=Ut;ft.formToJSON=n=>Wi(B.isHTMLForm(n)?new FormData(n):n);ft.getAdapter=Yi.getAdapter;ft.HttpStatusCode=$l;ft.default=ft;var ea=ft;var{Axios:P_,AxiosError:U_,CanceledError:R_,isCancel:O_,CancelToken:N_,VERSION:k_,all:D_,Cancel:z_,isAxiosError:G_,spread:M_,toFormData:L_,AxiosHeaders:q_,HttpStatusCode:K_,formToJSON:F_,getAdapter:H_,mergeConfig:$_}=ea;async function jl(n){var t;let{params:e,method:r,url:o,headers:s,body:i,overrides:c}=n,u={headers:s,method:r,url:o,params:e,data:i,withCredentials:(t=c?.WITH_CREDENTIALS)!=null?t:!0};try{let d=await ea(u);return{status:d.status,statusText:d.statusText,data:d.data,headers:d.headers,config:d.config}}catch(d){let y=d;if(y.response)return y.response;throw d}}var ta={mainnet:"https://indexer.mainnet.aptoslabs.com/v1/graphql",testnet:"https://indexer-testnet.staging.gcp.aptosdev.com/v1/graphql",devnet:"https://indexer-devnet.staging.gcp.aptosdev.com/v1/graphql",randomnet:"https://indexer-randomnet.hasura.app/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},na={mainnet:"https://fullnode.mainnet.aptoslabs.com/v1",testnet:"https://fullnode.testnet.aptoslabs.com/v1",devnet:"https://fullnode.devnet.aptoslabs.com/v1",randomnet:"https://fullnode.random.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},ra={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",randomnet:"https://faucet.random.aptoslabs.com",local:"http://127.0.0.1:8081"},oa=(i=>(i.MAINNET="mainnet",i.TESTNET="testnet",i.DEVNET="devnet",i.RANDOMNET="randomnet",i.LOCAL="local",i.CUSTOM="custom",i))(oa||{}),sa={mainnet:1,testnet:2,randomnet:70},Nh={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",randomnet:"randomnet",local:"local",custom:"custom"};var As=class{constructor(t){this.network=t?.network??"devnet",this.fullnode=t?.fullnode,this.faucet=t?.faucet,this.indexer=t?.indexer,this.client=t?.client??{provider:jl},this.clientConfig=t?.clientConfig??{}}getRequestUrl(t){switch(t){case 0:if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return na[this.network];case 2:if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return ra[this.network];case 1:if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return ta[this.network];default:throw Error(`apiType ${t} is not supported`)}}isIndexerRequest(t){return ta[this.network]===t}isFullnodeRequest(t){return na[this.network]===t}isFaucetRequest(t){return ra[this.network]===t}};var xs=class extends se{constructor(e){super();this.accountAddress=z.ONE;this.moduleName=new Me("account");this.structName=new Me("RotationProofChallenge");this.sequenceNumber=new gt(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=ke.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};var Pn=class extends se{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Xr.load(t);case 1:return ia.load(t);case 2:return Jr.load(t);case 3:return eo.load(t);case 4:return to.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},Xr=class n extends Pn{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=tt.deserialize(e),o=nt.deserialize(e);return new n(r,o)}},ia=class n extends Pn{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=Mr.deserialize(e),o=cr.deserialize(e);return new n(r,o)}},Jr=class n extends Pn{constructor(e,r,o){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=o}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let r=Dt.deserialize(e),o=e.deserializeVector(z),s=e.deserializeVector(Dt);return new n(r,o,s)}},eo=class n extends Pn{constructor(e,r,o,s){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=o,this.fee_payer=s}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let r=Dt.deserialize(e),o=e.deserializeVector(z),s=e.deserializeVector(Dt),i=z.deserialize(e),c=Dt.deserialize(e),u={address:i,authenticator:c};return new n(r,o,s,u)}},to=class n extends Pn{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=Dt.deserialize(e);return new n(r)}};var no=class n extends se{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let r=e.deserializeU8();return new n(r)}};var Ye=class n extends se{constructor(e){super();this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let r=e.deserializeStr();return new n(r)}};var Uo=class n extends se{constructor(e,r){super();this.address=e,this.name=r}static fromStr(e){let r=e.split("::");if(r.length!==2)throw new Error("Invalid module id.");return new n(z.fromString(r[0]),new Ye(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=z.deserialize(e),o=Ye.deserialize(e);return new n(r,o)}};var st=class extends se{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return ht.load(t);case 1:return xn.load(t);case 2:return Rt.load(t);case 3:return so.load(t);case 4:return zt.load(t);case 5:return wr.load(t);case 6:return $e.load(t);case 7:return ue.load(t);case 8:return ro.load(t);case 9:return oo.load(t);case 10:return io.load(t);case 255:return it.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof ht}isAddress(){return this instanceof zt}isGeneric(){return this instanceof it}isSigner(){return this instanceof wr}isVector(){return this instanceof $e}isStruct(){return this instanceof ue}isU8(){return this instanceof xn}isU16(){return this instanceof ro}isU32(){return this instanceof oo}isU64(){return this instanceof Rt}isU128(){return this instanceof so}isU256(){return this instanceof io}},ht=class n extends st{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new n}},xn=class n extends st{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new n}},ro=class n extends st{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new n}},oo=class n extends st{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new n}},Rt=class n extends st{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new n}},so=class n extends st{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new n}},io=class n extends st{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new n}},zt=class n extends st{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new n}},wr=class n extends st{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new n}},bs=class n extends st{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let r=st.deserialize(e);return new n(r)}},it=class n extends st{constructor(e){super();this.value=e;if(e<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(e){e.serializeU32AsUleb128(255),e.serializeU32(this.value)}static load(e){let r=e.deserializeU32();return new n(r)}},$e=class n extends st{constructor(e){super();this.value=e}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new xn)}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){let r=st.deserialize(e);return new n(r)}},ue=class n extends st{constructor(e){super();this.value=e}toString(){let e="";return this.value.typeArgs.length>0&&(e=`<${this.value.typeArgs.map(r=>r.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${e}`}serialize(e){e.serializeU32AsUleb128(7),this.value.serialize(e)}static load(e){let r=Un.deserialize(e);return new n(r)}isTypeTag(e,r,o){return this.value.moduleName.identifier===r&&this.value.name.identifier===o&&this.value.address.equals(e)}isString(){return this.isTypeTag(z.ONE,"string","String")}isOption(){return this.isTypeTag(z.ONE,"option","Option")}isObject(){return this.isTypeTag(z.ONE,"object","Object")}},Un=class n extends se{constructor(e,r,o,s){super();this.address=e,this.moduleName=r,this.name=o,this.typeArgs=s}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let r=z.deserialize(e),o=Ye.deserialize(e),s=Ye.deserialize(e),i=e.deserializeVector(st);return new n(r,o,s,i)}};function kh(){return new Un(z.ONE,new Ye("aptos_coin"),new Ye("AptosCoin"),[])}function Fe(){return new Un(z.ONE,new Ye("string"),new Ye("String"),[])}function Dh(n){return new Un(z.ONE,new Ye("option"),new Ye("Option"),[n])}function Gt(n){return new Un(z.ONE,new Ye("object"),new Ye("Object"),[n])}function Wl(n){let t=n.deserializeUleb128AsU32();switch(t){case 0:return yt.deserialize(n);case 1:return gt.deserialize(n);case 2:return Jt.deserialize(n);case 3:return z.deserialize(n);case 4:return ke.deserialize(n,yt);case 5:return et.deserialize(n);case 6:return Zt.deserialize(n);case 7:return Xt.deserialize(n);case 8:return en.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var Tr=class extends se{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Ro.load(t);case 2:return Oo.load(t);case 3:return No.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},Ro=class n extends Tr{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=ko.deserialize(e);return new n(r)}},Oo=class n extends Tr{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=ao.deserialize(e);return new n(r)}},No=class n extends Tr{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=Do.deserialize(e);return new n(r)}},ao=class n{constructor(t,e,r,o){this.module_name=t,this.function_name=e,this.type_args=r,this.args=o}static build(t,e,r,o){return new n(Uo.fromStr(t),new Ye(e),r,o)}serialize(t){this.module_name.serialize(t),this.function_name.serialize(t),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForEntryFunction(t)})}static deserialize(t){let e=Uo.deserialize(t),r=Ye.deserialize(t),o=t.deserializeVector(st),s=t.deserializeUleb128AsU32(),i=new Array;for(let c=0;c<s;c+=1){let u=t.deserializeUleb128AsU32(),d=Xo.deserialize(t,u);i.push(d)}return new n(e,r,o,i)}},ko=class n{constructor(t,e,r){this.bytecode=t,this.type_args=e,this.args=r}serialize(t){t.serializeBytes(this.bytecode),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForScriptFunction(t)})}static deserialize(t){let e=t.deserializeBytes(),r=t.deserializeVector(st),o=t.deserializeUleb128AsU32(),s=new Array;for(let i=0;i<o;i+=1){let c=Wl(t);s.push(c)}return new n(e,r,s)}},Do=class n{constructor(t,e){this.multisig_address=t,this.transaction_payload=e}serialize(t){this.multisig_address.serialize(t),this.transaction_payload===void 0?t.serializeBool(!1):(t.serializeBool(!0),this.transaction_payload.serialize(t))}static deserialize(t){let e=z.deserialize(t),r=t.deserializeBool(),o;return r&&(o=zo.deserialize(t)),new n(e,o)}},zo=class n extends se{constructor(e){super();this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new n(ao.deserialize(e))}};var an=class n extends se{constructor(e,r,o,s,i,c,u){super();this.sender=e,this.sequence_number=r,this.payload=o,this.max_gas_amount=s,this.gas_unit_price=i,this.expiration_timestamp_secs=c,this.chain_id=u}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let r=z.deserialize(e),o=e.deserializeU64(),s=Tr.deserialize(e),i=e.deserializeU64(),c=e.deserializeU64(),u=e.deserializeU64(),d=no.deserialize(e);return new n(r,o,s,i,c,u,d)}},ws=class extends se{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Rn.load(t);case 1:return On.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},Rn=class n extends ws{constructor(e,r){super();this.raw_txn=e,this.secondary_signer_addresses=r}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let r=an.deserialize(e),o=e.deserializeVector(z);return new n(r,o)}},On=class n extends ws{constructor(e,r,o){super();this.raw_txn=e,this.secondary_signer_addresses=r,this.fee_payer_address=o}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let r=an.deserialize(e),o=e.deserializeVector(z),s=z.deserialize(e);return new n(r,o,s)}};var bn=class n extends se{constructor(e,r){super();this.raw_txn=e,this.authenticator=r}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let r=an.deserialize(e),o=Pn.deserialize(e);return new n(r,o)}};function Ql(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Yl(n){return!!n.match(/\s/)}function zh(n){return!!n.match(/^T[0-9]+$/)}function Gh(n,t){let e=t;for(;e<n.length;e+=1){let r=n[e];if(!Yl(r))break}return e}var Zl=(T=>(T.InvalidTypeTag="unknown type",T.UnexpectedGenericType="unexpected generic type",T.UnexpectedTypeArgumentClose="unexpected '>'",T.UnexpectedWhitespaceCharacter="unexpected whitespace character",T.UnexpectedComma="unexpected ','",T.TypeArgumentCountMismatch="type argument count doesn't match expected amount",T.MissingTypeArgumentClose="no matching '>' for '<'",T.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",T.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",T.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",T.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",T.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",T))(Zl||{}),Ve=class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function Er(n,t){let e=t?.allowGenerics??!1,r=[],o=[],s=[],i=0,c="",u=1;for(;i<n.length;){let d=n[i];if(d==="<")r.push({savedExpectedTypes:u,savedStr:c,savedTypes:s}),c="",s=[],u=1;else if(d===">"){if(c!==""){let b=aa(c,o,e);s.push(b)}let y=r.pop();if(y===void 0)throw new Ve(n,"unexpected '>'");if(u!==s.length)throw new Ve(n,"type argument count doesn't match expected amount");let{savedStr:g,savedTypes:T,savedExpectedTypes:S}=y;o=s,s=T,c=g,u=S}else if(d===","){if(c.length!==0){let y=aa(c,o,e);o=[],s.push(y),c="",u+=1}}else if(Yl(d)){let y=!1;if(c.length!==0){let T=aa(c,o,e);o=[],s.push(T),c="",y=!0}i=Gh(n,i);let g=n[i];if(i<n.length&&y&&g!==","&&g!==">")throw new Ve(n,"unexpected whitespace character");continue}else c+=d;i+=1}if(r.length>0)throw new Ve(n,"no matching '>' for '<'");switch(s.length){case 0:return aa(c,o,e);case 1:if(c==="")return s[0];throw new Ve(n,"unexpected ','");default:throw new Ve(n,"unexpected whitespace character")}}function aa(n,t,e){switch(n){case"&signer":if(t.length>0)throw new Ve(n,"primitive types not expected to have type arguments");return new bs(new wr);case"signer":if(t.length>0)throw new Ve(n,"primitive types not expected to have type arguments");return new wr;case"bool":if(t.length>0)throw new Ve(n,"primitive types not expected to have type arguments");return new ht;case"address":if(t.length>0)throw new Ve(n,"primitive types not expected to have type arguments");return new zt;case"u8":if(t.length>0)throw new Ve(n,"primitive types not expected to have type arguments");return new xn;case"u16":if(t.length>0)throw new Ve(n,"primitive types not expected to have type arguments");return new ro;case"u32":if(t.length>0)throw new Ve(n,"primitive types not expected to have type arguments");return new oo;case"u64":if(t.length>0)throw new Ve(n,"primitive types not expected to have type arguments");return new Rt;case"u128":if(t.length>0)throw new Ve(n,"primitive types not expected to have type arguments");return new so;case"u256":if(t.length>0)throw new Ve(n,"primitive types not expected to have type arguments");return new io;case"vector":if(t.length!==1)throw new Ve(n,"vector type expected to have exactly one type argument");return new $e(t[0]);default:if(zh(n)){if(e)return new it(Number(n.split("T")[1]));throw new Ve(n,"unexpected generic type")}if(!n.match(/:/))throw new Ve(n,"unknown type");let r=n.split("::");if(r.length!==3)throw new Ve(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!Ql(r[1]))throw new Ve(n,"module name must only contain alphanumeric or '_' characters");if(!Ql(r[2]))throw new Ve(n,"struct name must only contain alphanumeric or '_' characters");return new ue(new Un(z.fromString(r[0]),new Ye(r[1]),new Ye(r[2]),t))}}function Su(n){return typeof n=="boolean"}function co(n){return typeof n=="string"}function Ts(n){return typeof n=="number"}function Es(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function vu(n){return n==null}function Cu(n){return ca(n)||fa(n)||da(n)||la(n)||pa(n)||ga(n)||ma(n)||_s(n)||ua(n)||Xl(n)||n instanceof ke||n instanceof Ln}function ca(n){return n instanceof et}function _s(n){return n instanceof z}function ua(n){return n instanceof Me}function Xl(n){return n instanceof er}function fa(n){return n instanceof yt}function da(n){return n instanceof Zt}function la(n){return n instanceof Xt}function pa(n){return n instanceof gt}function ga(n){return n instanceof Jt}function ma(n){return n instanceof en}function Iu(n){return"bytecode"in n}function We(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function Bu(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function ya(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],r=t[1],o=t[2];return{moduleAddress:e,moduleName:r,functionName:o}}var Mh=new TextEncoder;function Uu(n){return n?.map(t=>co(t)?Er(t):t)??[]}async function Ru(n,t,e,r){let s=(await Di({aptosConfig:r,accountAddress:n,moduleName:t})).abi?.exposed_functions.find(u=>u.name===e);if(!s)throw new Error(`Could not find entry function ABI for '${n}::${t}::${e}'`);if(!s.is_entry)throw new Error(`'${n}::${t}::${e}' is not an entry function`);let i=Bu(s),c=[];for(let u=i;u<s.params.length;u+=1)c.push(Er(s.params[u],{allowGenerics:!0}));return{typeParameters:s.generic_type_params,parameters:c}}function Ou(n,t,e,r,o){if(r>=t.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${t.parameters.length}`);let s=t.parameters[r];return uo(e,s,r,o)}function uo(n,t,e,r){return Cu(n)?(Pu(t,n,e),n):Lh(n,t,e,r)}function Lh(n,t,e,r){if(t.isBool()){if(Su(n))return new et(n);We("boolean",e)}if(t.isAddress()){if(co(n))return z.fromString(n);We("string | AccountAddress",e)}if(t.isU8()){if(Ts(n))return new yt(n);We("number",e)}if(t.isU16()){if(Ts(n))return new Zt(n);We("number",e)}if(t.isU32()){if(Ts(n))return new Xt(n);We("number",e)}if(t.isU64()){if(Es(n))return new gt(BigInt(n));We("bigint | number | string",e)}if(t.isU128()){if(Es(n))return new Jt(BigInt(n));We("bigint | number | string",e)}if(t.isU256()){if(Es(n))return new en(BigInt(n));We("bigint | number | string",e)}if(t.isGeneric()){let o=t.value;if(o<0||o>=r.length)throw new Error(`Generic argument ${t.toString()} is invalid for argument ${e}`);return uo(n,r[o],e,r)}if(t.isVector()){if(t.value.isU8()){if(co(n))return ke.U8(Mh.encode(n));if(n instanceof Uint8Array)return ke.U8(n);if(n instanceof ArrayBuffer)return ke.U8(new Uint8Array(n))}if(Array.isArray(n))return new ke(n.map(o=>uo(o,t.value,e,r)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(co(n))return new Me(n);We("string",e)}if(t.isObject()){if(co(n))return z.fromString(n);We("string | AccountAddress",e)}if(t.isOption())return vu(n)?new Ln(null):new Ln(uo(n,t.value.typeArgs[0],e,r));throw new Error(`Unsupported struct input type for argument ${e}, type '${t.toString()}'`)}throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}function Pu(n,t,e){if(n.isBool()){if(ca(t))return;We("Bool",e)}if(n.isAddress()){if(_s(t))return;We("AccountAddress",e)}if(n.isU8()){if(fa(t))return;We("U8",e)}if(n.isU16()){if(da(t))return;We("U16",e)}if(n.isU32()){if(la(t))return;We("U32",e)}if(n.isU64()){if(pa(t))return;We("U64",e)}if(n.isU128()){if(ga(t))return;We("U128",e)}if(n.isU256()){if(ma(t))return;We("U256",e)}if(n.isVector()){if(t instanceof ke){t.values.length>0&&Pu(n.value,t.values[0],e);return}We("MoveVector",e)}if(n instanceof ue){if(n.isString()){if(ua(t))return;We("MoveString",e)}if(n.isObject()){if(_s(t))return;We("AccountAddress",e)}if(n.isOption()){if(t instanceof Ln){t.value!==void 0&&Pu(n.value.typeArgs[0],t.value,e);return}We("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${n.toString()}'`)}async function vs(n){if(Iu(n))return qh(n);let{moduleAddress:t,moduleName:e,functionName:r}=ya(n.function),o=await _o(async()=>Ru(t,e,r,n.aptosConfig),`entry-function-${n.aptosConfig.network}-${t}-${e}-${r}`,1e3*60*5)();return Cs({abi:o,...n})}function Cs(n){let t=n.abi,{moduleAddress:e,moduleName:r,functionName:o}=ya(n.function),s=Uu(n.typeArguments);if(s.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${s.length}`);let i=n.functionArguments.map((u,d)=>Ou(n.function,t,u,d,s));if(i.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${o}', expected ${t.parameters.length} but got ${i.length}`);let c=ao.build(`${e}::${r}`,o,s,i);if("multisigAddress"in n){let u=z.from(n.multisigAddress);return new No(new Do(u,new zo(c)))}return new Oo(c)}function qh(n){return new Ro(new ko(Ge.fromHexInput(n.bytecode).toUint8Array(),n.typeArguments??[],n.functionArguments))}async function Jl(n){let{aptosConfig:t,sender:e,payload:r,options:o,feePayerAddress:s}=n,i=sa[t.network]?Promise.resolve({chain_id:sa[t.network]}):Ri({aptosConfig:t}),c=o?.gasUnitPrice?Promise.resolve({gas_estimate:o.gasUnitPrice}):Gi({aptosConfig:t}),[{chain_id:u},{gas_estimate:d}]=await Promise.all([i,c]),y=o?.accountSequenceNumber!==void 0?Promise.resolve({sequence_number:o.accountSequenceNumber}):In({aptosConfig:t,accountAddress:e}),g;if(s&&z.from(s).equals(z.ZERO))try{let{sequence_number:h}=await y;g=h}catch{g="0"}else{let{sequence_number:h}=await y;g=h}let{maxGasAmount:T,gasUnitPrice:S,expireTimestamp:b}={maxGasAmount:o?.maxGasAmount?BigInt(o.maxGasAmount):BigInt(2e5),gasUnitPrice:BigInt(d),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+20),...o};return new an(z.from(e),BigInt(g),r,BigInt(T),BigInt(S),BigInt(b),new no(u))}async function ha(n){let{aptosConfig:t,sender:e,payload:r,options:o,feePayerAddress:s}=n,i=await Jl({aptosConfig:t,sender:e,payload:r,options:o,feePayerAddress:s});if("secondarySignerAddresses"in n){let c=n.secondarySignerAddresses?.map(u=>z.from(u))??[];return{rawTransaction:i,secondarySignerAddresses:c,feePayerAddress:n.feePayerAddress?z.from(n.feePayerAddress):void 0}}return{rawTransaction:i,feePayerAddress:n.feePayerAddress?z.from(n.feePayerAddress):void 0}}function Nu(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:r,feePayerPublicKey:o}=n,s=Ss(t);if(e.feePayerAddress){let c=new On(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress),u=[];r&&(u=r.map(g=>Ss(g)));let d=Ss(o),y=new eo(s,e.secondarySignerAddresses??[],u,{address:e.feePayerAddress,authenticator:d});return new bn(c.raw_txn,y).bcsToBytes()}if(e.secondarySignerAddresses){let c=new Rn(e.rawTransaction,e.secondarySignerAddresses),u=[];u=r.map(y=>Ss(y));let d=new Jr(s,e.secondarySignerAddresses,u);return new bn(c.raw_txn,d).bcsToBytes()}let i;if(s instanceof An)i=new Xr(s.public_key,s.signature);else if(s instanceof on)i=new to(s);else throw new Error("Invalid public key");return new bn(e.rawTransaction,i).bcsToBytes()}function Ss(n){if(n instanceof Bt){if(n.publicKey instanceof tt)return new on(n,new Et(new nt(new Uint8Array(64))));if(n.publicKey instanceof vn)return new on(n,new Et(new Cn(new Uint8Array(64))))}return new An(new tt(n.toUint8Array()),new nt(new Uint8Array(64)))}function ku(n){let{signer:t,transaction:e}=n,r=Aa(e);return t.signWithAuthenticator(r)}function Du(n){let{transaction:t,senderAuthenticator:e,feePayerAuthenticator:r,additionalSignersAuthenticators:o}=n,s=zu(t);if((r||o)&&(s instanceof Rn||s instanceof On))return ep(s,e,r,o);if(e instanceof An&&s instanceof an){let i=new Xr(e.public_key,e.signature);return new bn(s,i).bcsToBytes()}if((e instanceof on||e instanceof Qr)&&s instanceof an){let i=new to(e);return new bn(s,i).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${e} is not a supported account authentication scheme`)}function zu(n){return n.feePayerAddress?new On(n.rawTransaction,n.secondarySignerAddresses??[],n.feePayerAddress):n.secondarySignerAddresses?new Rn(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function ep(n,t,e,r){if(n instanceof On){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let o=new eo(t,n.secondary_signer_addresses,r??[],{address:n.fee_payer_address,authenticator:e});return new bn(n.raw_txn,o).bcsToBytes()}if(n instanceof Rn){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let o=new Jr(t,n.secondary_signer_addresses,r??[]);return new bn(n.raw_txn,o).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof n} transaction is not supported`)}function Aa(n){let t=zu(n),e=Dr.create();if(t instanceof an)e.update(Wa);else if(t instanceof Rn)e.update(Xs);else if(t instanceof On)e.update(Xs);else throw new Error(`Unknown transaction type to sign on: ${t}`);let r=e.digest(),o=t.bcsToBytes(),s=new Uint8Array(r.length+o.length);return s.set(r),s.set(o,r.length),s}async function Ue(n){let t=await Kh(n);return Fh(n,t)}async function Kh(n){let{aptosConfig:t,data:e}=n,r,o;return"bytecode"in e?o=await vs(e):"multisigAddress"in e?e.abi?o=Cs({abi:e.abi,...e}):(r={aptosConfig:t,multisigAddress:e.multisigAddress,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await vs(r)):e.abi?o=Cs({abi:e.abi,...e}):(r={aptosConfig:t,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await vs(r)),o}async function Fh(n,t){let{aptosConfig:e,sender:r,options:o}=n,s;if(Hh(n)&&(s=z.ZERO.toString()),$h(n)){let{secondarySignerAddresses:i}=n;return ha({aptosConfig:e,sender:r,payload:t,options:o,secondarySignerAddresses:i,feePayerAddress:s})}return ha({aptosConfig:e,sender:r,payload:t,options:o,feePayerAddress:s})}function Hh(n){return n.withFeePayer===!0}function $h(n){return"secondarySignerAddresses"in n}function tp(n){let{transaction:t}=n;return Aa(t)}function xa(n){return ku({...n})}async function Gu(n){let{aptosConfig:t,transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:i}=n,c=Nu({transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:i}),{data:u}=await Ur({aptosConfig:t,body:c,path:"transactions/simulate",params:{estimate_gas_unit_price:n.options?.estimateGasUnitPrice??!1,estimate_max_gas_amount:n.options?.estimateMaxGasAmount??!1,estimate_prioritized_gas_unit_price:n.options?.estimatePrioritizedGasUnitPrice??!1},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return u}async function ba(n){let{aptosConfig:t}=n,e=Du({...n}),{data:r}=await Ur({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function Is(n){let{aptosConfig:t,signer:e,transaction:r}=n,o=xa({signer:e,transaction:r});return ba({aptosConfig:t,transaction:r,senderAuthenticator:o})}var Vh={typeParameters:[],parameters:[$e.u8(),new $e($e.u8())]};async function np(n){let{aptosConfig:t,account:e,metadataBytes:r,moduleBytecode:o,options:s}=n,i=o.map(c=>ke.U8(c));return Ue({aptosConfig:t,sender:z.from(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[ke.U8(r),new ke(i)],abi:Vh},options:s})}var jh={typeParameters:[],parameters:[new xn,$e.u8(),new xn,$e.u8(),$e.u8(),$e.u8()]};async function rp(n){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:r}=n,o=await In({aptosConfig:t,accountAddress:e.accountAddress}),s=Wn.fromPrivateKey({privateKey:r,legacy:!0}),c=new xs({sequenceNumber:BigInt(o.sequence_number),originator:e.accountAddress,currentAuthKey:z.from(o.authentication_key),newPublicKey:s.publicKey}).bcsToBytes(),u=e.sign(c),d=s.sign(c),y=await Ue({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new yt(e.signingScheme.valueOf()),ke.U8(e.publicKey.toUint8Array()),new yt(s.signingScheme.valueOf()),ke.U8(s.publicKey.toUint8Array()),ke.U8(u.toUint8Array()),ke.U8(d.toUint8Array())],abi:jh}});return Is({aptosConfig:t,signer:e,transaction:y})}var Wh={typeParameters:[{constraints:[]}],parameters:[new zt,new Rt]};async function op(n){let{aptosConfig:t,sender:e,recipient:r,amount:o,coinType:s,options:i}=n;return Ue({aptosConfig:t,sender:e,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[s??Yo],functionArguments:[r,o],abi:Wh},options:i})}var Bs=class{constructor(t){this.config=t}async transferCoinTransaction(t){return op({aptosConfig:this.config,...t})}};var _r={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},cn="0x4::token::Token";async function sp(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:z.from(e).toStringLong()}};return(await Se({aptosConfig:t,query:{query:$d,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function ip(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:z.from(e).toStringLong()}};return(await Se({aptosConfig:t,query:{query:Xc,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function ap(n){let{aptosConfig:t,ownerAddress:e,options:r}=n,o={owner_address:{_eq:z.from(e).toStringLong()},amount:{_gt:0}},s={query:Xc,variables:{where_condition:o,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await Se({aptosConfig:t,query:s,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function cp(n){let{aptosConfig:t,digitalAssetAddress:e,options:r}=n,o={token_data_id:{_eq:z.from(e).toStringLong()}},s={query:Hd,variables:{where_condition:o,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await Se({aptosConfig:t,query:s,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var Qh={typeParameters:[],parameters:[new ue(Fe()),new Rt,new ue(Fe()),new ue(Fe()),new ht,new ht,new ht,new ht,new ht,new ht,new ht,new ht,new ht,new Rt,new Rt]};async function up(n){let{aptosConfig:t,options:e,creator:r}=n;return Ue({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new Me(n.description),new gt(n.maxSupply??Nr),new Me(n.name),new Me(n.uri),new et(n.mutableDescription??!0),new et(n.mutableRoyalty??!0),new et(n.mutableURI??!0),new et(n.mutableTokenDescription??!0),new et(n.mutableTokenName??!0),new et(n.mutableTokenProperties??!0),new et(n.mutableTokenURI??!0),new et(n.tokensBurnableByCreator??!0),new et(n.tokensFreezableByCreator??!0),new gt(n.royaltyNumerator??0),new gt(n.royaltyDenominator??1)],abi:Qh},options:e})}async function Mu(n){let{aptosConfig:t,creatorAddress:e,collectionName:r,options:o}=n,s=z.from(e),i={collection_name:{_eq:r},creator_address:{_eq:s.toStringLong()}};return o?.tokenStandard&&(i.token_standard={_eq:o?.tokenStandard??"v2"}),(await Se({aptosConfig:t,query:{query:Qc,variables:{where_condition:i}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function fp(n){let{aptosConfig:t,collectionId:e}=n,o={collection_id:{_eq:z.from(e).toStringLong()}};return(await Se({aptosConfig:t,query:{query:Qc,variables:{where_condition:o}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function dp(n){return(await Mu(n)).collection_id}var Yh={typeParameters:[],parameters:[new ue(Fe()),new ue(Fe()),new ue(Fe()),new ue(Fe()),new $e(new ue(Fe())),new $e(new ue(Fe())),new $e($e.u8())]};async function lp(n){let{aptosConfig:t,options:e,creator:r,collection:o,description:s,name:i,uri:c,propertyKeys:u,propertyTypes:d,propertyValues:y}=n,g=d?.map(T=>_r[T]);return Ue({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new Me(o),new Me(s),new Me(i),new Me(c),ke.MoveString(u??[]),ke.MoveString(g??[]),vp(y??[],g??[])],abi:Yh},options:e})}var Zh={typeParameters:[{constraints:["key"]}],parameters:[new ue(Gt(new it(0))),new zt]};async function pp(n){let{aptosConfig:t,sender:e,digitalAssetAddress:r,recipient:o,digitalAssetType:s,options:i}=n;return Ue({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[s??cn],functionArguments:[z.from(r),z.from(o)],abi:Zh},options:i})}var Xh={typeParameters:[],parameters:[new ue(Fe()),new ue(Fe()),new ue(Fe()),new ue(Fe()),new $e(new ue(Fe())),new $e(new ue(Fe())),new $e($e.u8()),new zt]};async function gp(n){let{aptosConfig:t,account:e,collection:r,description:o,name:s,uri:i,recipient:c,propertyKeys:u,propertyTypes:d,propertyValues:y,options:g}=n;if(u?.length!==y?.length)throw new Error("Property keys and property values counts do not match");if(d?.length!==y?.length)throw new Error("Property types and property values counts do not match");let T=d?.map(S=>_r[S]);return Ue({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,o,s,i,ke.MoveString(u??[]),ke.MoveString(T??[]),vp(y??[],T??[]),c],abi:Xh},options:g})}var Jh={typeParameters:[{constraints:["key"]}],parameters:[new ue(Gt(new it(0)))]};async function mp(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:o,options:s}=n;return Ue({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[o??cn],functionArguments:[z.from(r)],abi:Jh},options:s})}var e0={typeParameters:[{constraints:["key"]}],parameters:[new ue(Gt(new it(0)))]};async function yp(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:o,options:s}=n;return Ue({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[o??cn],functionArguments:[r],abi:e0},options:s})}var t0={typeParameters:[{constraints:["key"]}],parameters:[new ue(Gt(new it(0)))]};async function hp(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:o,options:s}=n;return Ue({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[o??cn],functionArguments:[r],abi:t0},options:s})}var n0={typeParameters:[{constraints:["key"]}],parameters:[new ue(Gt(new it(0))),new ue(Fe())]};async function Ap(n){let{aptosConfig:t,creator:e,description:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return Ue({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[s??cn],functionArguments:[z.from(o),new Me(r)],abi:n0},options:i})}var r0={typeParameters:[{constraints:["key"]}],parameters:[new ue(Gt(new it(0))),new ue(Fe())]};async function xp(n){let{aptosConfig:t,creator:e,name:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return Ue({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[s??cn],functionArguments:[z.from(o),new Me(r)],abi:r0},options:i})}var o0={typeParameters:[{constraints:["key"]}],parameters:[new ue(Gt(new it(0))),new ue(Fe())]};async function bp(n){let{aptosConfig:t,creator:e,uri:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return Ue({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[s??cn],functionArguments:[z.from(o),new Me(r)],abi:o0},options:i})}var s0={typeParameters:[{constraints:["key"]}],parameters:[new ue(Gt(new it(0))),new ue(Fe()),new ue(Fe()),$e.u8()]};async function wp(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:u}=n;return Ue({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[c??cn],functionArguments:[z.from(i),new Me(r),new Me(_r[o]),ke.U8(Lu(s,_r[o]))],abi:s0},options:u})}var i0={typeParameters:[{constraints:["key"]}],parameters:[new ue(Gt(new it(0))),new ue(Fe())]};async function Tp(n){let{aptosConfig:t,creator:e,propertyKey:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return Ue({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[s??cn],functionArguments:[z.from(o),new Me(r)],abi:i0},options:i})}var a0={typeParameters:[{constraints:["key"]}],parameters:[new ue(Gt(new it(0))),new ue(Fe()),new ue(Fe()),$e.u8()]};async function Ep(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:u}=n;return Ue({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[c??cn],functionArguments:[z.from(i),new Me(r),new Me(_r[o]),Lu(s,_r[o])],abi:a0},options:u})}var c0={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new ue(Gt(new it(0))),new ue(Fe()),new it(1)]};async function _p(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:u}=n;return Ue({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[c??cn,_r[o]],functionArguments:[z.from(i),new Me(r),s],abi:c0},options:u})}var u0={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new ue(Gt(new it(0))),new ue(Fe()),new it(1)]};async function Sp(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:u}=n;return Ue({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[c??cn,_r[o]],functionArguments:[z.from(i),new Me(r),s],abi:u0},options:u})}function vp(n,t){let e=new Array;return t.forEach((r,o)=>{e.push(Lu(n[o],r))}),e}function Lu(n,t){let e=Er(t);return uo(n,e,0,[]).bcsToBytes()}var Ps=class{constructor(t){this.config=t}async getCollectionData(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Mu({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),fp({aptosConfig:this.config,...t})}async getCollectionId(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),dp({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),sp({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ip({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ap({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),cp({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return up({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return lp({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return pp({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return gp({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return mp({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return yp({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return hp({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return Ap({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return xp({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return bp({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return wp({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return Tp({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return Ep({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return _p({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return Sp({aptosConfig:this.config,...t})}};var Cp=300,f0=n=>{if(n&&n.length>Cp)throw new Error(`Event type length exceeds the maximum length of ${Cp}`)};async function Ip(n){let{aptosConfig:t,eventType:e,options:r}=n,s={where:{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},creation_number:{_eq:"0"},sequence_number:{_eq:"0"},indexed_type:{_eq:e}},pagination:r,orderBy:r?.orderBy};return Us({aptosConfig:t,options:s})}async function Bp(n){let{accountAddress:t,aptosConfig:e,creationNumber:r,options:o}=n,c={where:{account_address:{_eq:z.from(t).toStringLong()},creation_number:{_eq:r}},pagination:o,orderBy:o?.orderBy};return Us({aptosConfig:e,options:c})}async function Pp(n){let{accountAddress:t,aptosConfig:e,eventType:r,options:o}=n,c={where:{account_address:{_eq:z.from(t).toStringLong()},indexed_type:{_eq:r}},pagination:o,orderBy:o?.orderBy};return Us({aptosConfig:e,options:c})}async function Us(n){let{aptosConfig:t,options:e}=n;f0(e?.where?.indexed_type?._eq);let r={query:qd,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await Se({aptosConfig:t,query:r,originMethod:"getEvents"})).events}var Rs=class{constructor(t){this.config=t}async getModuleEventsByEventType(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),Ip({aptosConfig:this.config,...t})}async getAccountEventsByCreationNumber(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),Bp({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return await De({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),Pp({aptosConfig:this.config,...t})}async getEvents(t){return await De({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"events_processor"}),Us({aptosConfig:this.config,...t})}};async function Up(n){let{aptosConfig:t,accountAddress:e,amount:r,options:o}=n,s=o?.timeoutSecs||20,{data:i}=await Za({aptosConfig:t,path:"fund",body:{address:z.from(e).toString(),amount:r},originMethod:"fundAccount"}),c=i.txn_hashes[0],u=await So({aptosConfig:t,transactionHash:c,options:{timeoutSecs:s,checkSuccess:o?.checkSuccess}});if(u.type==="user_transaction")return u;throw new Error(`Unexpected transaction received for fund account: ${u.type}`)}var Os=class{constructor(t){this.config=t}async fundAccount(t){let e=await Up({aptosConfig:this.config,...t});return t.options?.waitForIndexer!==!1&&await Li({aptosConfig:this.config,minimumLedgerVersion:BigInt(e.version)}),e}};async function qu(n){let{aptosConfig:t,options:e}=n,r={query:Fd,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await Se({aptosConfig:t,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Rp(n){let{aptosConfig:t,options:e}=n,r={query:Kd,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await Se({aptosConfig:t,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Op(n){let{aptosConfig:t,options:e}=n,r={query:Md,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await Se({aptosConfig:t,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var d0={typeParameters:[],parameters:[Er("0x1::object::Object"),new zt,new Rt]};async function Np(n){let{aptosConfig:t,sender:e,fungibleAssetMetadataAddress:r,recipient:o,amount:s,options:i}=n;return Ue({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,o,s],abi:d0},options:i})}var Ns=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return await De({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),qu({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return await De({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),(await qu({aptosConfig:this.config,options:{where:{asset_type:{_eq:t.assetType}}}}))[0]}async getFungibleAssetActivities(t){return await De({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Rp({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return await De({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Op({aptosConfig:this.config,...t})}async transferFungibleAsset(t){return Np({aptosConfig:this.config,...t})}};var ks=class{constructor(t){this.config=t}async getLedgerInfo(){return Ri({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return Vd({aptosConfig:this.config,...t})}async getBlockByHeight(t){return jd({aptosConfig:this.config,...t})}async getTableItem(t){return Oi({aptosConfig:this.config,...t})}async view(t){return yr({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return Wd({aptosConfig:this.config,...t})}async queryIndexer(t){return Se({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return Ni({aptosConfig:this.config})}async getProcessorStatus(t){return ki({aptosConfig:this.config,processorType:t})}};var kp=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function Dp(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Sr(n){let[t,e,...r]=n.replace(/\.apt$/,"").split(".");if(r.length>0)throw new Error(`${n} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!Dp(t))throw new Error(`${t} is not valid. ${kp}`);if(e&&!Dp(e))throw new Error(`${e} is not valid. ${kp}`);return{domainName:e||t,subdomainName:e?t:void 0}}var l0="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",p0={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:l0,custom:null,devnet:null,randomnet:null};function Yn(n){let t=p0[n.network];if(!t)throw new Error(`The ANS contract is not deployed to ${n.network}`);return t}var g0=n=>({vec:[n]}),m0=()=>({vec:[]}),Ku=n=>n!=null?g0(n):m0(),wa=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function zp(n){let{aptosConfig:t,name:e}=n,r=Yn(t),{domainName:o,subdomainName:s}=Sr(e),i=await yr({aptosConfig:t,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[o,Ku(s)]}}),c=wa(i[0]);return c?z.from(c).toString():void 0}async function Gp(n){let{aptosConfig:t,expiration:e,name:r,sender:o,targetAddress:s,toAddress:i,options:c,transferable:u}=n,d=Yn(t),{domainName:y,subdomainName:g}=Sr(r),T=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(g&&!T)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(T&&!g)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){let w=e.years??1;if(w!==1)throw new Error("For now, names can only be registered for 1 year at a time");let k=w*31536e3;return await Ue({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${d}::router::register_domain`,functionArguments:[y,k,s,i]},options:c})}if(!g)throw new Error(`${e.policy} requires a subdomain to be provided.`);let S=await Fu({aptosConfig:t,name:y});if(!S)throw new Error("The domain does not exist");let b=e.policy==="subdomain:independent"?e.expirationDate:S;if(b>S)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await Ue({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${d}::router::register_subdomain`,functionArguments:[y,g,Math.round(b/1e3),e.policy==="subdomain:follow-domain"?1:0,!!u,s,i]},options:c})}async function Fu(n){let{aptosConfig:t,name:e}=n,r=Yn(t),{domainName:o,subdomainName:s}=Sr(e);try{let i=await yr({aptosConfig:t,payload:{function:`${r}::router::get_expiration`,functionArguments:[o,Ku(s)]}});return Number(i[0])*1e3}catch{return}}async function Mp(n){let{aptosConfig:t,address:e}=n,r=Yn(t),o=await yr({aptosConfig:t,payload:{function:`${r}::router::get_primary_name`,functionArguments:[z.from(e).toString()]}}),s=wa(o[1]),i=wa(o[0]);if(s)return[i,s].filter(Boolean).join(".")}async function Lp(n){let{aptosConfig:t,sender:e,name:r,options:o}=n,s=Yn(t);if(!r)return await Ue({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:o});let{domainName:i,subdomainName:c}=Sr(r);return await Ue({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[i,c]},options:o})}async function qp(n){let{aptosConfig:t,name:e}=n,r=Yn(t),{domainName:o,subdomainName:s}=Sr(e),i=await yr({aptosConfig:t,payload:{function:`${r}::router::get_target_addr`,functionArguments:[o,Ku(s)]}}),c=wa(i[0]);return c?z.from(c).toString():void 0}async function Kp(n){let{aptosConfig:t,sender:e,name:r,address:o,options:s}=n,i=Yn(t),{domainName:c,subdomainName:u}=Sr(r);return await Ue({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::set_target_addr`,functionArguments:[c,u,o]},options:s})}async function Fp(n){let{aptosConfig:t,name:e}=n,{domainName:r,subdomainName:o=""}=Sr(e),c=(await Se({aptosConfig:t,query:{query:Eo,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:o}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return c&&(c=Ds(c)),c}async function Hp(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await Hu({aptosConfig:t});return(await Se({aptosConfig:t,originMethod:"getAccountNames",query:{query:Eo,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...n.options?.where??{},owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o}}}}})).current_aptos_names.map(Ds)}async function $p(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await Hu({aptosConfig:t});return(await Se({aptosConfig:t,originMethod:"getAccountDomains",query:{query:Eo,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...n.options?.where??{},owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_eq:""}}}}})).current_aptos_names.map(Ds)}async function Vp(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await Hu({aptosConfig:t});return(await Se({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:Eo,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...n.options?.where??{},owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_neq:""}}}}})).current_aptos_names.map(Ds)}async function jp(n){let{aptosConfig:t,options:e,domain:r}=n;return(await Se({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:Eo,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...n.options?.where??{},domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(Ds)}async function Hu(n){let{aptosConfig:t}=n,e=Yn(t),[r]=await yr({aptosConfig:t,payload:{function:`${e}::config::reregistration_grace_sec`,functionArguments:[]}}),o=r/60/60/24,s=()=>new Date;return new Date(s().setDate(s().getDate()-o)).toISOString()}async function Wp(n){let{aptosConfig:t,sender:e,name:r,years:o=1,options:s}=n,i=Yn(t),c=o*31536e3,{domainName:u,subdomainName:d}=Sr(r);if(d)throw new Error("Subdomains cannot be renewed");if(o!==1)throw new Error("Currently, only 1 year renewals are supported");return await Ue({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::renew_domain`,functionArguments:[u,c]},options:s})}function Ds(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).valueOf()}}var zs=class{constructor(t){this.config=t}async getOwnerAddress(t){return zp({aptosConfig:this.config,...t})}async getExpiration(t){return Fu({aptosConfig:this.config,...t})}async getTargetAddress(t){return qp({aptosConfig:this.config,...t})}async setTargetAddress(t){return Kp({aptosConfig:this.config,...t})}async getPrimaryName(t){return Mp({aptosConfig:this.config,...t})}async setPrimaryName(t){return Lp({aptosConfig:this.config,...t})}async registerName(t){return Gp({aptosConfig:this.config,...t})}async renewDomain(t){return Wp({aptosConfig:this.config,...t})}async getName(t){return Fp({aptosConfig:this.config,...t})}async getAccountNames(t){return Hp({aptosConfig:this.config,...t})}async getAccountDomains(t){return $p({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return Vp({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return jp({aptosConfig:this.config,...t})}};async function Qp(n){let{aptosConfig:t,poolAddress:e}=n,r=z.from(e).toStringLong(),s=await Se({aptosConfig:t,query:{query:Yc,variables:{where_condition:{pool_address:{_eq:r}}}}});return s.num_active_delegator_per_pool[0]?s.num_active_delegator_per_pool[0].num_active_delegator:0}async function Yp(n){let{aptosConfig:t,options:e}=n,r={query:Yc,variables:{order_by:e?.orderBy}};return(await Se({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function Zp(n){let{aptosConfig:t,delegatorAddress:e,poolAddress:r}=n,o={query:Ld,variables:{delegatorAddress:z.from(e).toStringLong(),poolAddress:z.from(r).toStringLong()}};return(await Se({aptosConfig:t,query:o})).delegated_staking_activities}var Gs=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return await De({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"stake_processor"}),Qp({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return await De({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"stake_processor"}),Yp({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return await De({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"stake_processor"}),Zp({aptosConfig:this.config,...t})}};var Ta=class{constructor(t){this.config=t}async simple(t){return Ue({aptosConfig:this.config,...t})}async multiAgent(t){return Ue({aptosConfig:this.config,...t})}};function $u(n,t,e){let r=e.value;return e.value=async function(...o){let[s]=o;if(s.transaction.feePayerAddress&&!s.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,o)},e}function Vu(n,t,e){let r=e.value;return e.value=async function(...o){let[s]=o;if(s.transaction.feePayerAddress&&!s.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,o)},e}var Go=class{constructor(t){this.config=t}async simple(t){return Gu({aptosConfig:this.config,...t})}async multiAgent(t){return Gu({aptosConfig:this.config,...t})}};kt([Vu],Go.prototype,"simple",1),kt([Vu],Go.prototype,"multiAgent",1);var Mo=class{constructor(t){this.config=t}async simple(t){return ba({aptosConfig:this.config,...t})}async multiAgent(t){return ba({aptosConfig:this.config,...t})}};kt([$u],Mo.prototype,"simple",1),kt([$u],Mo.prototype,"multiAgent",1);var eg=sf(Jp(),1);var _a=eg.default;var Sa=()=>Math.floor(Date.now()/1e3),Ls=class{constructor(t,e,r,o,s){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=e,this.maxWaitTime=r,this.maximumInFlight=o,this.sleepTime=s}async nextSequenceNumber(){for(;this.lock;)await hr(this.sleepTime);this.lock=!0;let t=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let e=Sa();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await hr(this.sleepTime),Sa()-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}t=this.currentNumber,this.currentNumber+=BigInt(1)}catch(e){console.error("error in getting next sequence number for this account",e)}finally{this.lock=!1}return t}async initialize(){let{sequence_number:t}=await In({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await In({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(t),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await hr(this.sleepTime);this.lock=!0;try{await this.update();let t=Sa();for(;this.lastUncommintedNumber!==this.currentNumber;)Sa()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await hr(this.sleepTime),await this.update())}catch(t){console.error("error in synchronizing this account sequence number with the one on chain",t)}finally{this.lock=!1}}}};var Lo=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(t){if(this.cancelled=!1,this.pendingDequeue.length>0){this.pendingDequeue.shift()?.resolve(t);return}this.queue.push(t)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((t,e)=>{this.pendingDequeue.push({resolve:t,reject:e})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:t})=>{t(new qo("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},qo=class extends Error{};var Wu="fulfilled",Qu=(s=>(s.TransactionSent="transactionSent",s.TransactionSendFailed="transactionSendFailed",s.TransactionExecuted="transactionExecuted",s.TransactionExecutionFailed="transactionExecutionFailed",s.ExecutionFinish="executionFinish",s))(Qu||{}),qs=class extends _a{constructor(e,r,o=30,s=100,i=10){super();this.taskQueue=new Lo;this.transactionsQueue=new Lo;this.outstandingTransactions=new Lo;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=e,this.account=r,this.started=!1,this.accountSequnceNumber=new Ls(e,r,o,s,i)}async submitNextTransaction(){try{for(;;){let e=await this.accountSequnceNumber.nextSequenceNumber();if(e===null)return;let r=await this.generateNextTransaction(this.account,e);if(!r)return;let o=Is({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([o,e])}}catch(e){if(e instanceof qo)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async processTransactions(){try{for(;;){let e=[],r=[],[o,s]=await this.outstandingTransactions.dequeue();for(e.push(o),r.push(s);!this.outstandingTransactions.isEmpty();)[o,s]=await this.outstandingTransactions.dequeue(),e.push(o),r.push(s);let i=await Promise.allSettled(e);for(let c=0;c<i.length&&c<r.length;c+=1){let u=i[c];s=r[c],u.status===Wu?(this.sentTransactions.push([u.value.hash,s,null]),this.emit("transactionSent",{message:`transaction hash ${u.value.hash} has been committed to chain`,transactionHash:u.value.hash}),await this.checkTransaction(u,s)):(this.sentTransactions.push([u.status,s,u.reason]),this.emit("transactionSendFailed",{message:`failed to commit transaction ${this.sentTransactions.length} with error ${u.reason}`,error:u.reason}))}this.emit("executionFinish",{message:`execute ${i.length} transactions finished`})}}catch(e){if(e instanceof qo)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async checkTransaction(e,r){try{let o=[];o.push(So({aptosConfig:this.aptosConfig,transactionHash:e.value.hash}));let s=await Promise.allSettled(o);for(let i=0;i<s.length;i+=1){let c=s[i];c.status===Wu?(this.executedTransactions.push([c.value.hash,r,null]),this.emit("transactionExecuted",{message:`transaction hash ${c.value.hash} has been executed on chain`,transactionHash:e.value.hash})):(this.executedTransactions.push([c.status,r,c.reason]),this.emit("transactionExecutionFailed",{message:`failed to execute transaction ${this.executedTransactions.length} with error ${c.reason}`,error:c.reason}))}}catch(o){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${o}`)}}async push(e,r){this.transactionsQueue.enqueue([e,r])}async generateNextTransaction(e,r){if(this.transactionsQueue.isEmpty())return;let[o,s]=await this.transactionsQueue.dequeue();return Ue({aptosConfig:this.aptosConfig,sender:e.accountAddress,data:o,options:{...s,accountSequenceNumber:r}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(e){throw new Error(`Unable to start transaction batching: ${e}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};var va=class extends _a{constructor(e){super();this.config=e}start(e){let{sender:r}=e;this.account=r,this.transactionWorker=new qs(this.config,r),this.transactionWorker.start(),this.registerToEvents()}push(e){let{data:r,options:o}=e;for(let s of r)this.transactionWorker.push(s,o)}registerToEvents(){this.transactionWorker.on("transactionSent",async e=>{this.emit("transactionSent",e)}),this.transactionWorker.on("transactionSendFailed",async e=>{this.emit("transactionSendFailed",e)}),this.transactionWorker.on("transactionExecuted",async e=>{this.emit("transactionExecuted",e)}),this.transactionWorker.on("transactionExecutionFailed",async e=>{this.emit("transactionExecutionFailed",e)}),this.transactionWorker.on("executionFinish",async e=>{this.emit("executionFinish",e)})}forSingleAccount(e){try{let{sender:r,data:o,options:s}=e;this.start({sender:r}),this.push({data:o,options:s})}catch(r){throw new Error(`failed to submit transactions with error: ${r}`)}}};var Ks=class{constructor(t){this.config=t,this.build=new Ta(this.config),this.simulate=new Go(this.config),this.submit=new Mo(this.config),this.batch=new va(this.config)}async getTransactions(t){return ul({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return fl({aptosConfig:this.config,...t})}async getTransactionByHash(t){return Mi({aptosConfig:this.config,...t})}async isPendingTransaction(t){return dl({aptosConfig:this.config,...t})}async waitForTransaction(t){return So({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return Gi({aptosConfig:this.config})}getSigningMessage(t){return tp(t)}async publishPackageTransaction(t){return np({aptosConfig:this.config,...t})}async rotateAuthKey(t){return rp({aptosConfig:this.config,...t})}sign(t){return xa({...t})}signAsFeePayer(t){let{signer:e,transaction:r}=t;if(!r.feePayerAddress)throw new Error(`Transaction ${r} is not a Fee Payer transaction`);return r.feePayerAddress=e.accountAddress,xa({signer:e,transaction:r})}async batchTransactionsForSingleAccount(t){try{let{sender:e,data:r,options:o}=t;this.batch.forSingleAccount({sender:e,data:r,options:o})}catch(e){throw new Error(`failed to submit transactions with error: ${e}`)}}async signAndSubmitTransaction(t){let{signer:e,transaction:r}=t;return Is({aptosConfig:this.config,signer:e,transaction:r})}};var Qt=class{constructor(t){this.config=new As(t),this.account=new cs(this.config),this.ans=new zs(this.config),this.coin=new Bs(this.config),this.digitalAsset=new Ps(this.config),this.event=new Rs(this.config),this.faucet=new Os(this.config),this.fungibleAsset=new Ns(this.config),this.general=new ks(this.config),this.staking=new Gs(this.config),this.transaction=new Ks(this.config)}};function Nn(n,t,e){Object.getOwnPropertyNames(t.prototype).forEach(r=>{let o=Object.getOwnPropertyDescriptor(t.prototype,r);o&&(o.value=function(...s){return this[e][r](...s)},Object.defineProperty(n.prototype,r,o))})}Nn(Qt,cs,"account");Nn(Qt,zs,"ans");Nn(Qt,Bs,"coin");Nn(Qt,Ps,"digitalAsset");Nn(Qt,Rs,"event");Nn(Qt,Os,"faucet");Nn(Qt,Ns,"fungibleAsset");Nn(Qt,ks,"general");Nn(Qt,Gs,"staking");Nn(Qt,Ks,"transaction");return ug(A0);})();
431
433
  /*! Bundled license information:
432
434
 
433
435
  @noble/hashes/esm/utils.js: