@aptos-labs/ts-sdk 1.5.1 → 1.7.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.
- package/dist/browser/index.d.ts +33 -4
- package/dist/browser/index.global.js +30 -30
- package/dist/browser/index.global.js.map +1 -1
- package/dist/common/index.d.ts +33 -4
- package/dist/common/index.js +26 -26
- package/dist/common/index.js.map +1 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +12 -0
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/{chunk-APOQ4ODM.mjs → chunk-2QV6HI3M.mjs} +2 -2
- package/dist/esm/chunk-3NOQE6U3.mjs +2 -0
- package/dist/esm/chunk-3NOQE6U3.mjs.map +1 -0
- package/dist/esm/chunk-3UYBNX3P.mjs +2 -0
- package/dist/esm/{chunk-X3SXV2RB.mjs.map → chunk-3UYBNX3P.mjs.map} +1 -1
- package/dist/esm/{chunk-2BSSYT6I.mjs → chunk-4SAUEZTN.mjs} +2 -2
- package/dist/esm/chunk-4SAUEZTN.mjs.map +1 -0
- package/dist/esm/{chunk-6XQ33PLM.mjs → chunk-5L6SRCJP.mjs} +2 -2
- package/dist/esm/{chunk-J4CN3Q2R.mjs → chunk-5WXR2O3T.mjs} +2 -2
- package/dist/esm/chunk-6UNBJAV6.mjs +2 -0
- package/dist/esm/chunk-6UNBJAV6.mjs.map +1 -0
- package/dist/esm/chunk-6Y3VBRMN.mjs +2 -0
- package/dist/esm/chunk-6Y3VBRMN.mjs.map +1 -0
- package/dist/esm/chunk-77SKA4HT.mjs +2 -0
- package/dist/esm/chunk-77SKA4HT.mjs.map +1 -0
- package/dist/esm/{chunk-IK7JAKXG.mjs → chunk-7JTOGYO7.mjs} +2 -2
- package/dist/esm/{chunk-VP5JCW6I.mjs → chunk-A2QH4A6D.mjs} +2 -2
- package/dist/esm/chunk-AA3GRJNL.mjs +2 -0
- package/dist/esm/chunk-AA3GRJNL.mjs.map +1 -0
- package/dist/esm/{chunk-CFQDJZBD.mjs → chunk-C7ZX475J.mjs} +2 -2
- package/dist/esm/{chunk-4DI53MOX.mjs → chunk-CCUD52OF.mjs} +2 -2
- package/dist/esm/{chunk-4DI53MOX.mjs.map → chunk-CCUD52OF.mjs.map} +1 -1
- package/dist/esm/{chunk-BDHRLMQP.mjs → chunk-CX5ULWJQ.mjs} +2 -2
- package/dist/esm/{chunk-6IMEQXW4.mjs → chunk-D2GNCG27.mjs} +2 -2
- package/dist/esm/{chunk-3T4NSGK5.mjs → chunk-DRF6AMEZ.mjs} +2 -2
- package/dist/esm/{chunk-FGHNLZRH.mjs → chunk-ERWQOVBF.mjs} +2 -2
- package/dist/esm/{chunk-DSGIOUTJ.mjs → chunk-ESX5X52V.mjs} +2 -2
- package/dist/esm/{chunk-P7B32QR3.mjs → chunk-FBFMQZTM.mjs} +2 -2
- package/dist/esm/{chunk-WXWFKCGO.mjs → chunk-FP5DPRYL.mjs} +2 -2
- package/dist/esm/{chunk-HV4ZPHSZ.mjs → chunk-GVHOHNHT.mjs} +2 -2
- package/dist/esm/chunk-IKCBGNRD.mjs +2 -0
- package/dist/esm/{chunk-R3URESCV.mjs.map → chunk-IKCBGNRD.mjs.map} +1 -1
- package/dist/esm/chunk-INV6U3KS.mjs +2 -0
- package/dist/esm/chunk-INV6U3KS.mjs.map +1 -0
- package/dist/esm/{chunk-2MOYURM2.mjs → chunk-J6RCCKOA.mjs} +2 -2
- package/dist/esm/{chunk-DIWRS4YQ.mjs → chunk-JLL7BCD4.mjs} +2 -2
- package/dist/esm/{chunk-ZDT4TIOP.mjs → chunk-MKERJNYN.mjs} +2 -2
- package/dist/esm/{chunk-4QWK47EH.mjs → chunk-NWRKJFHV.mjs} +2 -2
- package/dist/esm/{chunk-S4QKXXBT.mjs → chunk-OVSV4Y32.mjs} +2 -2
- package/dist/esm/{chunk-K6IBDLVC.mjs → chunk-OWZLBIDD.mjs} +2 -2
- package/dist/esm/chunk-PJNPLRPR.mjs +2 -0
- package/dist/esm/chunk-PJNPLRPR.mjs.map +1 -0
- package/dist/esm/{chunk-NXAHJ4KY.mjs → chunk-Q7JKS6WV.mjs} +2 -2
- package/dist/esm/{chunk-ED2OMOMT.mjs → chunk-RIL4SHXC.mjs} +2 -2
- package/dist/esm/{chunk-PPNI7SJK.mjs → chunk-RNO5ZG3C.mjs} +2 -2
- package/dist/esm/{chunk-7WQA7OMS.mjs → chunk-SBMJNU2O.mjs} +2 -2
- package/dist/esm/chunk-SZYATFM7.mjs +2 -0
- package/dist/esm/chunk-SZYATFM7.mjs.map +1 -0
- package/dist/esm/{chunk-LFWMWCS3.mjs → chunk-T5IFXLOP.mjs} +2 -2
- package/dist/esm/{chunk-LFWMWCS3.mjs.map → chunk-T5IFXLOP.mjs.map} +1 -1
- package/dist/esm/chunk-TVURQPLA.mjs +2 -0
- package/dist/esm/chunk-TVURQPLA.mjs.map +1 -0
- package/dist/esm/{chunk-J46VAO6L.mjs → chunk-UCHGKGCF.mjs} +2 -2
- package/dist/esm/{chunk-DHFOORW6.mjs → chunk-UJAX75ON.mjs} +2 -2
- package/dist/esm/{chunk-ACMNL2LL.mjs → chunk-WC2WSKYZ.mjs} +2 -2
- package/dist/esm/{chunk-QYB75IJ6.mjs → chunk-WK36MJRI.mjs} +2 -2
- package/dist/esm/{chunk-6KILJ43F.mjs → chunk-WQI2RH2S.mjs} +2 -2
- package/dist/esm/{chunk-HT6K4NWZ.mjs → chunk-XOBXX273.mjs} +2 -2
- package/dist/esm/{chunk-TRTTUBC4.mjs → chunk-XQIWF5HY.mjs} +2 -2
- package/dist/esm/{chunk-25YXK6L2.mjs → chunk-YE3DZD6T.mjs} +2 -2
- package/dist/esm/{chunk-4TGKQEEE.mjs → chunk-YGMT4GQ5.mjs} +2 -2
- package/dist/esm/{chunk-W5PZ5Z4H.mjs → chunk-Z6XNTGNK.mjs} +2 -2
- package/dist/esm/{chunk-W5PZ5Z4H.mjs.map → chunk-Z6XNTGNK.mjs.map} +1 -1
- package/dist/esm/{chunk-JBWJE4IP.mjs → chunk-ZFPA45OK.mjs} +2 -2
- package/dist/esm/{chunk-JRQMEVDE.mjs → chunk-ZIZ7PVK2.mjs} +2 -2
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/account.mjs +1 -1
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/crypto/anyPublicKey.mjs +1 -1
- package/dist/esm/core/crypto/anySignature.mjs +1 -1
- package/dist/esm/core/crypto/asymmetricCrypto.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +4 -4
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.d.mts +2 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +1 -1
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +7 -1
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +4 -3
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.d.mts +1 -0
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +9 -1
- package/dist/esm/utils/apiEndpoints.d.mts +1 -0
- package/dist/esm/utils/apiEndpoints.mjs +1 -1
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +16 -16
- package/src/api/aptosConfig.ts +18 -0
- package/src/api/digitalAsset.ts +4 -4
- package/src/client/core.ts +9 -2
- package/src/client/get.ts +3 -7
- package/src/internal/ans.ts +1 -0
- package/src/internal/coin.ts +9 -4
- package/src/internal/digitalAsset.ts +197 -60
- package/src/internal/event.ts +9 -2
- package/src/internal/fungibleAsset.ts +15 -3
- package/src/internal/transactionSubmission.ts +40 -14
- package/src/transactions/management/transactionWorker.ts +9 -5
- package/src/transactions/transactionBuilder/transactionBuilder.ts +41 -30
- package/src/transactions/typeTag/index.ts +4 -0
- package/src/transactions/typeTag/parser.ts +1 -1
- package/src/transactions/types.ts +11 -0
- package/src/utils/apiEndpoints.ts +6 -0
- package/src/version.ts +1 -1
- package/dist/esm/chunk-2BSSYT6I.mjs.map +0 -1
- package/dist/esm/chunk-2RN7N3EO.mjs +0 -2
- package/dist/esm/chunk-2RN7N3EO.mjs.map +0 -1
- package/dist/esm/chunk-ATHZ7INX.mjs +0 -2
- package/dist/esm/chunk-ATHZ7INX.mjs.map +0 -1
- package/dist/esm/chunk-BQYQ45QQ.mjs +0 -2
- package/dist/esm/chunk-BQYQ45QQ.mjs.map +0 -1
- package/dist/esm/chunk-C53MNMPH.mjs +0 -2
- package/dist/esm/chunk-C53MNMPH.mjs.map +0 -1
- package/dist/esm/chunk-FE2DRPX7.mjs +0 -2
- package/dist/esm/chunk-FE2DRPX7.mjs.map +0 -1
- package/dist/esm/chunk-FHUT4EJH.mjs +0 -2
- package/dist/esm/chunk-FHUT4EJH.mjs.map +0 -1
- package/dist/esm/chunk-HI6QP2FB.mjs +0 -2
- package/dist/esm/chunk-HI6QP2FB.mjs.map +0 -1
- package/dist/esm/chunk-JMV2QDNW.mjs +0 -2
- package/dist/esm/chunk-JMV2QDNW.mjs.map +0 -1
- package/dist/esm/chunk-LV33NV4J.mjs +0 -2
- package/dist/esm/chunk-LV33NV4J.mjs.map +0 -1
- package/dist/esm/chunk-R3URESCV.mjs +0 -2
- package/dist/esm/chunk-X3SXV2RB.mjs +0 -2
- /package/dist/esm/{chunk-APOQ4ODM.mjs.map → chunk-2QV6HI3M.mjs.map} +0 -0
- /package/dist/esm/{chunk-6XQ33PLM.mjs.map → chunk-5L6SRCJP.mjs.map} +0 -0
- /package/dist/esm/{chunk-J4CN3Q2R.mjs.map → chunk-5WXR2O3T.mjs.map} +0 -0
- /package/dist/esm/{chunk-IK7JAKXG.mjs.map → chunk-7JTOGYO7.mjs.map} +0 -0
- /package/dist/esm/{chunk-VP5JCW6I.mjs.map → chunk-A2QH4A6D.mjs.map} +0 -0
- /package/dist/esm/{chunk-CFQDJZBD.mjs.map → chunk-C7ZX475J.mjs.map} +0 -0
- /package/dist/esm/{chunk-BDHRLMQP.mjs.map → chunk-CX5ULWJQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-6IMEQXW4.mjs.map → chunk-D2GNCG27.mjs.map} +0 -0
- /package/dist/esm/{chunk-3T4NSGK5.mjs.map → chunk-DRF6AMEZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-FGHNLZRH.mjs.map → chunk-ERWQOVBF.mjs.map} +0 -0
- /package/dist/esm/{chunk-DSGIOUTJ.mjs.map → chunk-ESX5X52V.mjs.map} +0 -0
- /package/dist/esm/{chunk-P7B32QR3.mjs.map → chunk-FBFMQZTM.mjs.map} +0 -0
- /package/dist/esm/{chunk-WXWFKCGO.mjs.map → chunk-FP5DPRYL.mjs.map} +0 -0
- /package/dist/esm/{chunk-HV4ZPHSZ.mjs.map → chunk-GVHOHNHT.mjs.map} +0 -0
- /package/dist/esm/{chunk-2MOYURM2.mjs.map → chunk-J6RCCKOA.mjs.map} +0 -0
- /package/dist/esm/{chunk-DIWRS4YQ.mjs.map → chunk-JLL7BCD4.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZDT4TIOP.mjs.map → chunk-MKERJNYN.mjs.map} +0 -0
- /package/dist/esm/{chunk-4QWK47EH.mjs.map → chunk-NWRKJFHV.mjs.map} +0 -0
- /package/dist/esm/{chunk-S4QKXXBT.mjs.map → chunk-OVSV4Y32.mjs.map} +0 -0
- /package/dist/esm/{chunk-K6IBDLVC.mjs.map → chunk-OWZLBIDD.mjs.map} +0 -0
- /package/dist/esm/{chunk-NXAHJ4KY.mjs.map → chunk-Q7JKS6WV.mjs.map} +0 -0
- /package/dist/esm/{chunk-ED2OMOMT.mjs.map → chunk-RIL4SHXC.mjs.map} +0 -0
- /package/dist/esm/{chunk-PPNI7SJK.mjs.map → chunk-RNO5ZG3C.mjs.map} +0 -0
- /package/dist/esm/{chunk-7WQA7OMS.mjs.map → chunk-SBMJNU2O.mjs.map} +0 -0
- /package/dist/esm/{chunk-J46VAO6L.mjs.map → chunk-UCHGKGCF.mjs.map} +0 -0
- /package/dist/esm/{chunk-DHFOORW6.mjs.map → chunk-UJAX75ON.mjs.map} +0 -0
- /package/dist/esm/{chunk-ACMNL2LL.mjs.map → chunk-WC2WSKYZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-QYB75IJ6.mjs.map → chunk-WK36MJRI.mjs.map} +0 -0
- /package/dist/esm/{chunk-6KILJ43F.mjs.map → chunk-WQI2RH2S.mjs.map} +0 -0
- /package/dist/esm/{chunk-HT6K4NWZ.mjs.map → chunk-XOBXX273.mjs.map} +0 -0
- /package/dist/esm/{chunk-TRTTUBC4.mjs.map → chunk-XQIWF5HY.mjs.map} +0 -0
- /package/dist/esm/{chunk-25YXK6L2.mjs.map → chunk-YE3DZD6T.mjs.map} +0 -0
- /package/dist/esm/{chunk-4TGKQEEE.mjs.map → chunk-YGMT4GQ5.mjs.map} +0 -0
- /package/dist/esm/{chunk-JBWJE4IP.mjs.map → chunk-ZFPA45OK.mjs.map} +0 -0
- /package/dist/esm/{chunk-JRQMEVDE.mjs.map → chunk-ZIZ7PVK2.mjs.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var aptosSDK=(()=>{var Zp=Object.create;var Ko=Object.defineProperty;var Wu=Object.getOwnPropertyDescriptor;var Xp=Object.getOwnPropertyNames;var Jp=Object.getPrototypeOf,eg=Object.prototype.hasOwnProperty;var Qu=(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 Ia=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),Ks=(n,t)=>{for(var e in t)Ko(n,e,{get:t[e],enumerable:!0})},Yu=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Xp(t))!eg.call(n,o)&&o!==e&&Ko(n,o,{get:()=>t[o],enumerable:!(r=Wu(t,o))||r.enumerable});return n};var Zu=(n,t,e)=>(e=n!=null?Zp(Jp(n)):{},Yu(t||!n||!n.__esModule?Ko(e,"default",{value:n,enumerable:!0}):e,n)),tg=n=>Yu(Ko({},"__esModule",{value:!0}),n),Ct=(n,t,e,r)=>{for(var o=r>1?void 0:r?Wu(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&&Ko(t,e,o),o};var wf=Ia(()=>{"use strict"});var Tf=Ia((oA,oi)=>{"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]),h=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 y(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,q=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,ue=a[8]&255|(a[9]&255)<<8|(a[10]&255)<<16|(a[11]&255)<<24,ge=l[16]&255|(l[17]&255)<<8|(l[18]&255)<<16|(l[19]&255)<<24,pe=l[20]&255|(l[21]&255)<<8|(l[22]&255)<<16|(l[23]&255)<<24,fe=l[24]&255|(l[25]&255)<<8|(l[26]&255)<<16|(l[27]&255)<<24,le=l[28]&255|(l[29]&255)<<8|(l[30]&255)<<16|(l[31]&255)<<24,de=a[12]&255|(a[13]&255)<<8|(a[14]&255)<<16|(a[15]&255)<<24,Z=m,oe=x,W=E,X=O,J=q,V=ee,C=j,U=Re,D=Y,R=ce,N=ue,G=ge,ie=pe,me=fe,ye=le,he=de,A,_e=0;_e<20;_e+=2)A=Z+ie|0,J^=A<<7|A>>>25,A=J+Z|0,D^=A<<9|A>>>23,A=D+J|0,ie^=A<<13|A>>>19,A=ie+D|0,Z^=A<<18|A>>>14,A=V+oe|0,R^=A<<7|A>>>25,A=R+V|0,me^=A<<9|A>>>23,A=me+R|0,oe^=A<<13|A>>>19,A=oe+me|0,V^=A<<18|A>>>14,A=N+C|0,ye^=A<<7|A>>>25,A=ye+N|0,W^=A<<9|A>>>23,A=W+ye|0,C^=A<<13|A>>>19,A=C+W|0,N^=A<<18|A>>>14,A=he+G|0,X^=A<<7|A>>>25,A=X+he|0,U^=A<<9|A>>>23,A=U+X|0,G^=A<<13|A>>>19,A=G+U|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,U^=A<<9|A>>>23,A=U+C|0,J^=A<<13|A>>>19,A=J+U|0,V^=A<<18|A>>>14,A=N+R|0,G^=A<<7|A>>>25,A=G+N|0,D^=A<<9|A>>>23,A=D+G|0,R^=A<<13|A>>>19,A=R+D|0,N^=A<<18|A>>>14,A=he+ye|0,ie^=A<<7|A>>>25,A=ie+he|0,me^=A<<9|A>>>23,A=me+ie|0,ye^=A<<13|A>>>19,A=ye+me|0,he^=A<<18|A>>>14;Z=Z+m|0,oe=oe+x|0,W=W+E|0,X=X+O|0,J=J+q|0,V=V+ee|0,C=C+j|0,U=U+Re|0,D=D+Y|0,R=R+ce|0,N=N+ue|0,G=G+ge|0,ie=ie+pe|0,me=me+fe|0,ye=ye+le|0,he=he+de|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]=U>>>0&255,f[29]=U>>>8&255,f[30]=U>>>16&255,f[31]=U>>>24&255,f[32]=D>>>0&255,f[33]=D>>>8&255,f[34]=D>>>16&255,f[35]=D>>>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]=G>>>0&255,f[45]=G>>>8&255,f[46]=G>>>16&255,f[47]=G>>>24&255,f[48]=ie>>>0&255,f[49]=ie>>>8&255,f[50]=ie>>>16&255,f[51]=ie>>>24&255,f[52]=me>>>0&255,f[53]=me>>>8&255,f[54]=me>>>16&255,f[55]=me>>>24&255,f[56]=ye>>>0&255,f[57]=ye>>>8&255,f[58]=ye>>>16&255,f[59]=ye>>>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,q=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,ue=a[8]&255|(a[9]&255)<<8|(a[10]&255)<<16|(a[11]&255)<<24,ge=l[16]&255|(l[17]&255)<<8|(l[18]&255)<<16|(l[19]&255)<<24,pe=l[20]&255|(l[21]&255)<<8|(l[22]&255)<<16|(l[23]&255)<<24,fe=l[24]&255|(l[25]&255)<<8|(l[26]&255)<<16|(l[27]&255)<<24,le=l[28]&255|(l[29]&255)<<8|(l[30]&255)<<16|(l[31]&255)<<24,de=a[12]&255|(a[13]&255)<<8|(a[14]&255)<<16|(a[15]&255)<<24,Z=m,oe=x,W=E,X=O,J=q,V=ee,C=j,U=Re,D=Y,R=ce,N=ue,G=ge,ie=pe,me=fe,ye=le,he=de,A,_e=0;_e<20;_e+=2)A=Z+ie|0,J^=A<<7|A>>>25,A=J+Z|0,D^=A<<9|A>>>23,A=D+J|0,ie^=A<<13|A>>>19,A=ie+D|0,Z^=A<<18|A>>>14,A=V+oe|0,R^=A<<7|A>>>25,A=R+V|0,me^=A<<9|A>>>23,A=me+R|0,oe^=A<<13|A>>>19,A=oe+me|0,V^=A<<18|A>>>14,A=N+C|0,ye^=A<<7|A>>>25,A=ye+N|0,W^=A<<9|A>>>23,A=W+ye|0,C^=A<<13|A>>>19,A=C+W|0,N^=A<<18|A>>>14,A=he+G|0,X^=A<<7|A>>>25,A=X+he|0,U^=A<<9|A>>>23,A=U+X|0,G^=A<<13|A>>>19,A=G+U|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,U^=A<<9|A>>>23,A=U+C|0,J^=A<<13|A>>>19,A=J+U|0,V^=A<<18|A>>>14,A=N+R|0,G^=A<<7|A>>>25,A=G+N|0,D^=A<<9|A>>>23,A=D+G|0,R^=A<<13|A>>>19,A=R+D|0,N^=A<<18|A>>>14,A=he+ye|0,ie^=A<<7|A>>>25,A=ie+he|0,me^=A<<9|A>>>23,A=me+ie|0,ye^=A<<13|A>>>19,A=ye+me|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]=U>>>0&255,f[21]=U>>>8&255,f[22]=U>>>16&255,f[23]=U>>>24&255,f[24]=D>>>0&255,f[25]=D>>>8&255,f[26]=D>>>16&255,f[27]=D>>>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 M=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function z(f,p,l,a,m,x,E){var O=new Uint8Array(16),q=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(q,O,E,M),j=0;j<64;j++)f[p+j]=l[a+j]^q[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(q,O,E,M),j=0;j<m;j++)f[p+j]=l[a+j]^q[j];return 0}function L(f,p,l,a,m){var x=new Uint8Array(16),E=new Uint8Array(64),O,q;for(q=0;q<16;q++)x[q]=0;for(q=0;q<8;q++)x[q]=a[q];for(;l>=64;){for(P(E,x,m,M),q=0;q<64;q++)f[p+q]=E[q];for(O=1,q=8;q<16;q++)O=O+(x[q]&255)|0,x[q]=O&255,O>>>=8;l-=64,p+=64}if(l>0)for(P(E,x,m,M),q=0;q<l;q++)f[p+q]=E[q];return 0}function K(f,p,l,a,m){var x=new Uint8Array(32);$(x,a,m,M);for(var E=new Uint8Array(8),O=0;O<8;O++)E[O]=a[O+16];return L(f,p,l,E,x)}function we(f,p,l,a,m,x,E){var O=new Uint8Array(32);$(O,x,E,M);for(var q=new Uint8Array(8),ee=0;ee<8;ee++)q[ee]=x[ee+16];return z(f,p,l,a,m,q,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,q;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,q=f[14]&255|(f[15]&255)<<8,this.r[8]=(O>>>8|q<<8)&8191,this.r[9]=q>>>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,q,ee,j,Re,Y,ce,ue,ge,pe,fe,le,de,Z,oe,W,X=this.h[0],J=this.h[1],V=this.h[2],C=this.h[3],U=this.h[4],D=this.h[5],R=this.h[6],N=this.h[7],G=this.h[8],ie=this.h[9],me=this.r[0],ye=this.r[1],he=this.r[2],A=this.r[3],_e=this.r[4],Oe=this.r[5],Ne=this.r[6],be=this.r[7],Ue=this.r[8],Ie=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,q=f[p+8]&255|(f[p+9]&255)<<8,U+=(O>>>4|q<<12)&8191,D+=q>>>1&8191,ee=f[p+10]&255|(f[p+11]&255)<<8,R+=(q>>>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,G+=(j>>>8|Re<<8)&8191,ie+=Re>>>5|a,Y=0,ce=Y,ce+=X*me,ce+=J*(5*Ie),ce+=V*(5*Ue),ce+=C*(5*be),ce+=U*(5*Ne),Y=ce>>>13,ce&=8191,ce+=D*(5*Oe),ce+=R*(5*_e),ce+=N*(5*A),ce+=G*(5*he),ce+=ie*(5*ye),Y+=ce>>>13,ce&=8191,ue=Y,ue+=X*ye,ue+=J*me,ue+=V*(5*Ie),ue+=C*(5*Ue),ue+=U*(5*be),Y=ue>>>13,ue&=8191,ue+=D*(5*Ne),ue+=R*(5*Oe),ue+=N*(5*_e),ue+=G*(5*A),ue+=ie*(5*he),Y+=ue>>>13,ue&=8191,ge=Y,ge+=X*he,ge+=J*ye,ge+=V*me,ge+=C*(5*Ie),ge+=U*(5*Ue),Y=ge>>>13,ge&=8191,ge+=D*(5*be),ge+=R*(5*Ne),ge+=N*(5*Oe),ge+=G*(5*_e),ge+=ie*(5*A),Y+=ge>>>13,ge&=8191,pe=Y,pe+=X*A,pe+=J*he,pe+=V*ye,pe+=C*me,pe+=U*(5*Ie),Y=pe>>>13,pe&=8191,pe+=D*(5*Ue),pe+=R*(5*be),pe+=N*(5*Ne),pe+=G*(5*Oe),pe+=ie*(5*_e),Y+=pe>>>13,pe&=8191,fe=Y,fe+=X*_e,fe+=J*A,fe+=V*he,fe+=C*ye,fe+=U*me,Y=fe>>>13,fe&=8191,fe+=D*(5*Ie),fe+=R*(5*Ue),fe+=N*(5*be),fe+=G*(5*Ne),fe+=ie*(5*Oe),Y+=fe>>>13,fe&=8191,le=Y,le+=X*Oe,le+=J*_e,le+=V*A,le+=C*he,le+=U*ye,Y=le>>>13,le&=8191,le+=D*me,le+=R*(5*Ie),le+=N*(5*Ue),le+=G*(5*be),le+=ie*(5*Ne),Y+=le>>>13,le&=8191,de=Y,de+=X*Ne,de+=J*Oe,de+=V*_e,de+=C*A,de+=U*he,Y=de>>>13,de&=8191,de+=D*ye,de+=R*me,de+=N*(5*Ie),de+=G*(5*Ue),de+=ie*(5*be),Y+=de>>>13,de&=8191,Z=Y,Z+=X*be,Z+=J*Ne,Z+=V*Oe,Z+=C*_e,Z+=U*A,Y=Z>>>13,Z&=8191,Z+=D*he,Z+=R*ye,Z+=N*me,Z+=G*(5*Ie),Z+=ie*(5*Ue),Y+=Z>>>13,Z&=8191,oe=Y,oe+=X*Ue,oe+=J*be,oe+=V*Ne,oe+=C*Oe,oe+=U*_e,Y=oe>>>13,oe&=8191,oe+=D*A,oe+=R*he,oe+=N*ye,oe+=G*me,oe+=ie*(5*Ie),Y+=oe>>>13,oe&=8191,W=Y,W+=X*Ie,W+=J*Ue,W+=V*be,W+=C*Ne,W+=U*Oe,Y=W>>>13,W&=8191,W+=D*_e,W+=R*A,W+=N*he,W+=G*ye,W+=ie*me,Y+=W>>>13,W&=8191,Y=(Y<<2)+Y|0,Y=Y+ce|0,ce=Y&8191,Y=Y>>>13,ue+=Y,X=ce,J=ue,V=ge,C=pe,U=fe,D=le,R=de,N=Z,G=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]=U,this.h[5]=D,this.h[6]=R,this.h[7]=N,this.h[8]=G,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 ve(f,p,l,a,m,x){var E=new Uint8Array(16);return Q(E,0,l,a,m,x),y(f,p,E,0)}function Ce(f,p,l,a,m){var x;if(l<32)return-1;for(we(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 Ve(f,p,l,a,m){var x,E=new Uint8Array(32);if(l<32||(K(E,0,32,a,m),ve(p,16,p,32,l-32,E)!==0))return-1;for(we(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 B(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(B(E),B(E),B(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 xe(f){var p=new Uint8Array(32);return ne(p,f),p[0]&1}function ke(f,p){var l;for(l=0;l<16;l++)f[l]=p[2*l]+(p[2*l+1]<<8);f[15]&=32767}function Te(f,p,l){for(var a=0;a<16;a++)f[a]=p[a]+l[a]}function De(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,q=0,ee=0,j=0,Re=0,Y=0,ce=0,ue=0,ge=0,pe=0,fe=0,le=0,de=0,Z=0,oe=0,W=0,X=0,J=0,V=0,C=0,U=0,D=0,R=0,N=0,G=0,ie=0,me=0,ye=0,he=0,A=l[0],_e=l[1],Oe=l[2],Ne=l[3],be=l[4],Ue=l[5],Ie=l[6],rt=l[7],Me=l[8],Qe=l[9],Ye=l[10],Ze=l[11],at=l[12],gt=l[13],mt=l[14],ht=l[15];a=p[0],x+=a*A,E+=a*_e,O+=a*Oe,q+=a*Ne,ee+=a*be,j+=a*Ue,Re+=a*Ie,Y+=a*rt,ce+=a*Me,ue+=a*Qe,ge+=a*Ye,pe+=a*Ze,fe+=a*at,le+=a*gt,de+=a*mt,Z+=a*ht,a=p[1],E+=a*A,O+=a*_e,q+=a*Oe,ee+=a*Ne,j+=a*be,Re+=a*Ue,Y+=a*Ie,ce+=a*rt,ue+=a*Me,ge+=a*Qe,pe+=a*Ye,fe+=a*Ze,le+=a*at,de+=a*gt,Z+=a*mt,oe+=a*ht,a=p[2],O+=a*A,q+=a*_e,ee+=a*Oe,j+=a*Ne,Re+=a*be,Y+=a*Ue,ce+=a*Ie,ue+=a*rt,ge+=a*Me,pe+=a*Qe,fe+=a*Ye,le+=a*Ze,de+=a*at,Z+=a*gt,oe+=a*mt,W+=a*ht,a=p[3],q+=a*A,ee+=a*_e,j+=a*Oe,Re+=a*Ne,Y+=a*be,ce+=a*Ue,ue+=a*Ie,ge+=a*rt,pe+=a*Me,fe+=a*Qe,le+=a*Ye,de+=a*Ze,Z+=a*at,oe+=a*gt,W+=a*mt,X+=a*ht,a=p[4],ee+=a*A,j+=a*_e,Re+=a*Oe,Y+=a*Ne,ce+=a*be,ue+=a*Ue,ge+=a*Ie,pe+=a*rt,fe+=a*Me,le+=a*Qe,de+=a*Ye,Z+=a*Ze,oe+=a*at,W+=a*gt,X+=a*mt,J+=a*ht,a=p[5],j+=a*A,Re+=a*_e,Y+=a*Oe,ce+=a*Ne,ue+=a*be,ge+=a*Ue,pe+=a*Ie,fe+=a*rt,le+=a*Me,de+=a*Qe,Z+=a*Ye,oe+=a*Ze,W+=a*at,X+=a*gt,J+=a*mt,V+=a*ht,a=p[6],Re+=a*A,Y+=a*_e,ce+=a*Oe,ue+=a*Ne,ge+=a*be,pe+=a*Ue,fe+=a*Ie,le+=a*rt,de+=a*Me,Z+=a*Qe,oe+=a*Ye,W+=a*Ze,X+=a*at,J+=a*gt,V+=a*mt,C+=a*ht,a=p[7],Y+=a*A,ce+=a*_e,ue+=a*Oe,ge+=a*Ne,pe+=a*be,fe+=a*Ue,le+=a*Ie,de+=a*rt,Z+=a*Me,oe+=a*Qe,W+=a*Ye,X+=a*Ze,J+=a*at,V+=a*gt,C+=a*mt,U+=a*ht,a=p[8],ce+=a*A,ue+=a*_e,ge+=a*Oe,pe+=a*Ne,fe+=a*be,le+=a*Ue,de+=a*Ie,Z+=a*rt,oe+=a*Me,W+=a*Qe,X+=a*Ye,J+=a*Ze,V+=a*at,C+=a*gt,U+=a*mt,D+=a*ht,a=p[9],ue+=a*A,ge+=a*_e,pe+=a*Oe,fe+=a*Ne,le+=a*be,de+=a*Ue,Z+=a*Ie,oe+=a*rt,W+=a*Me,X+=a*Qe,J+=a*Ye,V+=a*Ze,C+=a*at,U+=a*gt,D+=a*mt,R+=a*ht,a=p[10],ge+=a*A,pe+=a*_e,fe+=a*Oe,le+=a*Ne,de+=a*be,Z+=a*Ue,oe+=a*Ie,W+=a*rt,X+=a*Me,J+=a*Qe,V+=a*Ye,C+=a*Ze,U+=a*at,D+=a*gt,R+=a*mt,N+=a*ht,a=p[11],pe+=a*A,fe+=a*_e,le+=a*Oe,de+=a*Ne,Z+=a*be,oe+=a*Ue,W+=a*Ie,X+=a*rt,J+=a*Me,V+=a*Qe,C+=a*Ye,U+=a*Ze,D+=a*at,R+=a*gt,N+=a*mt,G+=a*ht,a=p[12],fe+=a*A,le+=a*_e,de+=a*Oe,Z+=a*Ne,oe+=a*be,W+=a*Ue,X+=a*Ie,J+=a*rt,V+=a*Me,C+=a*Qe,U+=a*Ye,D+=a*Ze,R+=a*at,N+=a*gt,G+=a*mt,ie+=a*ht,a=p[13],le+=a*A,de+=a*_e,Z+=a*Oe,oe+=a*Ne,W+=a*be,X+=a*Ue,J+=a*Ie,V+=a*rt,C+=a*Me,U+=a*Qe,D+=a*Ye,R+=a*Ze,N+=a*at,G+=a*gt,ie+=a*mt,me+=a*ht,a=p[14],de+=a*A,Z+=a*_e,oe+=a*Oe,W+=a*Ne,X+=a*be,J+=a*Ue,V+=a*Ie,C+=a*rt,U+=a*Me,D+=a*Qe,R+=a*Ye,N+=a*Ze,G+=a*at,ie+=a*gt,me+=a*mt,ye+=a*ht,a=p[15],Z+=a*A,oe+=a*_e,W+=a*Oe,X+=a*Ne,J+=a*be,V+=a*Ue,C+=a*Ie,U+=a*rt,D+=a*Me,R+=a*Qe,N+=a*Ye,G+=a*Ze,ie+=a*at,me+=a*gt,ye+=a*mt,he+=a*ht,x+=38*oe,E+=38*W,O+=38*X,q+=38*J,ee+=38*V,j+=38*C,Re+=38*U,Y+=38*D,ce+=38*R,ue+=38*N,ge+=38*G,pe+=38*ie,fe+=38*me,le+=38*ye,de+=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=q+m+65535,m=Math.floor(a/65536),q=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=ue+m+65535,m=Math.floor(a/65536),ue=a-m*65536,a=ge+m+65535,m=Math.floor(a/65536),ge=a-m*65536,a=pe+m+65535,m=Math.floor(a/65536),pe=a-m*65536,a=fe+m+65535,m=Math.floor(a/65536),fe=a-m*65536,a=le+m+65535,m=Math.floor(a/65536),le=a-m*65536,a=de+m+65535,m=Math.floor(a/65536),de=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=q+m+65535,m=Math.floor(a/65536),q=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=ue+m+65535,m=Math.floor(a/65536),ue=a-m*65536,a=ge+m+65535,m=Math.floor(a/65536),ge=a-m*65536,a=pe+m+65535,m=Math.floor(a/65536),pe=a-m*65536,a=fe+m+65535,m=Math.floor(a/65536),fe=a-m*65536,a=le+m+65535,m=Math.floor(a/65536),le=a-m*65536,a=de+m+65535,m=Math.floor(a/65536),de=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]=q,f[4]=ee,f[5]=j,f[6]=Re,f[7]=Y,f[8]=ce,f[9]=ue,f[10]=ge,f[11]=pe,f[12]=fe,f[13]=le,f[14]=de,f[15]=Z}function Ke(f,p){se(f,p,p)}function vt(f,p){var l=t(),a;for(a=0;a<16;a++)l[a]=p[a];for(a=253;a>=0;a--)Ke(l,l),a!==2&&a!==4&&se(l,l,p);for(a=0;a<16;a++)f[a]=l[a]}function ot(f,p){var l=t(),a;for(a=0;a<16;a++)l[a]=p[a];for(a=250;a>=0;a--)Ke(l,l),a!==1&&se(l,l,p);for(a=0;a<16;a++)f[a]=l[a]}function Dt(f,p,l){var a=new Uint8Array(32),m=new Float64Array(80),x,E,O=t(),q=t(),ee=t(),j=t(),Re=t(),Y=t();for(E=0;E<31;E++)a[E]=p[E];for(a[31]=p[31]&127|64,a[0]&=248,ke(m,l),E=0;E<16;E++)q[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,q,x),H(ee,j,x),Te(Re,O,ee),De(O,O,ee),Te(ee,q,j),De(q,q,j),Ke(j,Re),Ke(Y,O),se(O,ee,O),se(ee,q,Re),Te(Re,O,ee),De(O,O,ee),Ke(q,O),De(ee,j,Y),se(O,ee,c),Te(O,O,j),se(ee,ee,O),se(O,j,Y),se(j,q,m),Ke(q,Re),H(O,q,x),H(ee,j,x);for(E=0;E<16;E++)m[E+16]=O[E],m[E+32]=ee[E],m[E+48]=q[E],m[E+64]=j[E];var ce=m.subarray(32),ue=m.subarray(16);return vt(ce,ce),se(ue,ue,ce),ne(f,ue),0}function st(f,p){return Dt(f,p,o)}function pt(f,p){return e(p,32),st(f,p)}function fn(f,p,l){var a=new Uint8Array(32);return Dt(a,l,p),$(f,r,a,M)}var He=Ce,bt=Ve;function Yt(f,p,l,a,m,x){var E=new Uint8Array(32);return fn(E,m,x),He(f,p,l,a,E)}function xr(f,p,l,a,m,x){var E=new Uint8Array(32);return fn(E,m,x),bt(f,p,l,a,E)}var Hn=[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 Ku(f,p,l,a){for(var m=new Int32Array(16),x=new Int32Array(16),E,O,q,ee,j,Re,Y,ce,ue,ge,pe,fe,le,de,Z,oe,W,X,J,V,C,U,D,R,N,G,ie=f[0],me=f[1],ye=f[2],he=f[3],A=f[4],_e=f[5],Oe=f[6],Ne=f[7],be=p[0],Ue=p[1],Ie=p[2],rt=p[3],Me=p[4],Qe=p[5],Ye=p[6],Ze=p[7],at=0;a>=128;){for(J=0;J<16;J++)V=8*J+at,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=me,q=ye,ee=he,j=A,Re=_e,Y=Oe,ce=Ne,ue=be,ge=Ue,pe=Ie,fe=rt,le=Me,de=Qe,Z=Ye,oe=Ze,C=Ne,U=Ze,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=(A>>>14|Me<<18)^(A>>>18|Me<<14)^(Me>>>9|A<<23),U=(Me>>>14|A<<18)^(Me>>>18|A<<14)^(A>>>9|Me<<23),D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,C=A&_e^~A&Oe,U=Me&Qe^~Me&Ye,D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,C=Hn[J*2],U=Hn[J*2+1],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,C=m[J%16],U=x[J%16],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,W=N&65535|G<<16,X=D&65535|R<<16,C=W,U=X,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=(ie>>>28|be<<4)^(be>>>2|ie<<30)^(be>>>7|ie<<25),U=(be>>>28|ie<<4)^(ie>>>2|be<<30)^(ie>>>7|be<<25),D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,C=ie&me^ie&ye^me&ye,U=be&Ue^be&Ie^Ue&Ie,D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,ce=N&65535|G<<16,oe=D&65535|R<<16,C=ee,U=fe,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=W,U=X,D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,ee=N&65535|G<<16,fe=D&65535|R<<16,me=E,ye=O,he=q,A=ee,_e=j,Oe=Re,Ne=Y,ie=ce,Ue=ue,Ie=ge,rt=pe,Me=fe,Qe=le,Ye=de,Ze=Z,be=oe,J%16===15)for(V=0;V<16;V++)C=m[V],U=x[V],D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=m[(V+9)%16],U=x[(V+9)%16],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,W=m[(V+1)%16],X=x[(V+1)%16],C=(W>>>1|X<<31)^(W>>>8|X<<24)^W>>>7,U=(X>>>1|W<<31)^(X>>>8|W<<24)^(X>>>7|W<<25),D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,W=m[(V+14)%16],X=x[(V+14)%16],C=(W>>>19|X<<13)^(X>>>29|W<<3)^W>>>6,U=(X>>>19|W<<13)^(W>>>29|X<<3)^(X>>>6|W<<26),D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,m[V]=N&65535|G<<16,x[V]=D&65535|R<<16;C=ie,U=be,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=f[0],U=p[0],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,f[0]=ie=N&65535|G<<16,p[0]=be=D&65535|R<<16,C=me,U=Ue,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=f[1],U=p[1],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,f[1]=me=N&65535|G<<16,p[1]=Ue=D&65535|R<<16,C=ye,U=Ie,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=f[2],U=p[2],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,f[2]=ye=N&65535|G<<16,p[2]=Ie=D&65535|R<<16,C=he,U=rt,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=f[3],U=p[3],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,f[3]=he=N&65535|G<<16,p[3]=rt=D&65535|R<<16,C=A,U=Me,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=f[4],U=p[4],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,f[4]=A=N&65535|G<<16,p[4]=Me=D&65535|R<<16,C=_e,U=Qe,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=f[5],U=p[5],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,f[5]=_e=N&65535|G<<16,p[5]=Qe=D&65535|R<<16,C=Oe,U=Ye,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=f[6],U=p[6],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,f[6]=Oe=N&65535|G<<16,p[6]=Ye=D&65535|R<<16,C=Ne,U=Ze,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=f[7],U=p[7],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,f[7]=Ne=N&65535|G<<16,p[7]=Ze=D&65535|R<<16,at+=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,Ku(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),Ku(a,m,x,l),E=0;E<8;E++)S(f,8*E,a[E],m[E]);return 0}function Ds(f,p){var l=t(),a=t(),m=t(),x=t(),E=t(),O=t(),q=t(),ee=t(),j=t();De(l,f[1],f[0]),De(j,p[1],p[0]),se(l,l,j),Te(a,f[0],f[1]),Te(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]),Te(x,x,x),De(E,a,l),De(O,x,m),Te(q,x,m),Te(ee,a,l),se(f[0],E,O),se(f[1],ee,q),se(f[2],q,O),se(f[3],E,ee)}function Fu(f,p,l){var a;for(a=0;a<4;a++)H(f[a],p[a],l)}function xa(f,p){var l=t(),a=t(),m=t();vt(m,p[2]),se(l,p[0],m),se(a,p[1],m),ne(f,a),f[31]^=xe(l)<<7}function ba(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,Fu(f,p,a),Ds(p,f),Ds(f,f),Fu(f,p,a)}function Ms(f,p){var l=[t(),t(),t(),t()];_(l[0],h),_(l[1],g),_(l[2],i),se(l[3],h,g),ba(f,l,p)}function wa(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,Ms(m,a),xa(f,m),x=0;x<32;x++)p[x+32]=f[x];return 0}var Gs=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 Ta(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]*Gs[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)*Gs[m],l=p[m]>>8,p[m]&=255;for(m=0;m<32;m++)p[m]-=l*Gs[m];for(a=0;a<32;a++)p[a+1]+=p[a]>>8,f[a]=p[a]&255}function _a(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;Ta(f,p)}function Hu(f,p,l,a){var m=new Uint8Array(64),x=new Uint8Array(64),E=new Uint8Array(64),O,q,ee=new Float64Array(64),j=[t(),t(),t(),t()];br(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(br(E,f.subarray(32),l+32),_a(E),Ms(j,E),xa(f,j),O=32;O<64;O++)f[O]=a[O];for(br(x,f,l+64),_a(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(q=0;q<32;q++)ee[O+q]+=x[O]*m[q];return Ta(f.subarray(32),ee),Re}function jp(f,p){var l=t(),a=t(),m=t(),x=t(),E=t(),O=t(),q=t();return _(f[2],i),ke(f[1],p),Ke(m,f[1]),se(x,m,u),De(m,m,f[2]),Te(x,f[2],x),Ke(E,x),Ke(O,E),se(q,O,E),se(l,q,m),se(l,l,x),ot(l,l),se(l,l,m),se(l,l,x),se(l,l,x),se(f[0],l,x),Ke(a,f[0]),se(a,a,x),re(a,m)&&se(f[0],f[0],T),Ke(a,f[0]),se(a,a,x),re(a,m)?-1:(xe(f[0])===p[31]>>7&&De(f[0],s,f[0]),se(f[3],f[0],f[1]),0)}function Ea(f,p,l,a){var m,x=new Uint8Array(32),E=new Uint8Array(64),O=[t(),t(),t(),t()],q=[t(),t(),t(),t()];if(l<64||jp(q,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),_a(E),ba(O,q,E),Ms(q,p.subarray(32)),Ds(O,q),xa(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 Sa=32,Ls=24,Mo=32,ao=16,Go=32,qs=32,Lo=32,qo=32,va=32,$u=Ls,Wp=Mo,Qp=ao,En=64,wr=32,co=64,Ca=32,Ua=64;n.lowlevel={crypto_core_hsalsa20:$,crypto_stream_xor:we,crypto_stream:K,crypto_stream_salsa20_xor:z,crypto_stream_salsa20:L,crypto_onetimeauth:Q,crypto_onetimeauth_verify:ve,crypto_verify_16:y,crypto_verify_32:w,crypto_secretbox:Ce,crypto_secretbox_open:Ve,crypto_scalarmult:Dt,crypto_scalarmult_base:st,crypto_box_beforenm:fn,crypto_box_afternm:He,crypto_box:Yt,crypto_box_open:xr,crypto_box_keypair:pt,crypto_hash:br,crypto_sign:Hu,crypto_sign_keypair:wa,crypto_sign_open:Ea,crypto_secretbox_KEYBYTES:Sa,crypto_secretbox_NONCEBYTES:Ls,crypto_secretbox_ZEROBYTES:Mo,crypto_secretbox_BOXZEROBYTES:ao,crypto_scalarmult_BYTES:Go,crypto_scalarmult_SCALARBYTES:qs,crypto_box_PUBLICKEYBYTES:Lo,crypto_box_SECRETKEYBYTES:qo,crypto_box_BEFORENMBYTES:va,crypto_box_NONCEBYTES:$u,crypto_box_ZEROBYTES:Wp,crypto_box_BOXZEROBYTES:Qp,crypto_sign_BYTES:En,crypto_sign_PUBLICKEYBYTES:wr,crypto_sign_SECRETKEYBYTES:co,crypto_sign_SEEDBYTES:Ca,crypto_hash_BYTES:Ua,gf:t,D:u,L:Gs,pack25519:ne,unpack25519:ke,M:se,A:Te,S:Ke,Z:De,pow2523:ot,add:Ds,set25519:_,modL:Ta,scalarmult:ba,scalarbase:Ms};function Vu(f,p){if(f.length!==Sa)throw new Error("bad key size");if(p.length!==Ls)throw new Error("bad nonce size")}function Yp(f,p){if(f.length!==Lo)throw new Error("bad public key size");if(p.length!==qo)throw new Error("bad secret key size")}function It(){for(var f=0;f<arguments.length;f++)if(!(arguments[f]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ju(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){It(f,p,l),Vu(l,p);for(var a=new Uint8Array(Mo+f.length),m=new Uint8Array(a.length),x=0;x<f.length;x++)a[x+Mo]=f[x];return Ce(m,a,a.length,p,l),m.subarray(ao)},n.secretbox.open=function(f,p,l){It(f,p,l),Vu(l,p);for(var a=new Uint8Array(ao+f.length),m=new Uint8Array(a.length),x=0;x<f.length;x++)a[x+ao]=f[x];return a.length<32||Ve(m,a,a.length,p,l)!==0?null:m.subarray(Mo)},n.secretbox.keyLength=Sa,n.secretbox.nonceLength=Ls,n.secretbox.overheadLength=ao,n.scalarMult=function(f,p){if(It(f,p),f.length!==qs)throw new Error("bad n size");if(p.length!==Go)throw new Error("bad p size");var l=new Uint8Array(Go);return Dt(l,f,p),l},n.scalarMult.base=function(f){if(It(f),f.length!==qs)throw new Error("bad n size");var p=new Uint8Array(Go);return st(p,f),p},n.scalarMult.scalarLength=qs,n.scalarMult.groupElementLength=Go,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){It(f,p),Yp(f,p);var l=new Uint8Array(va);return fn(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(Lo),p=new Uint8Array(qo);return pt(f,p),{publicKey:f,secretKey:p}},n.box.keyPair.fromSecretKey=function(f){if(It(f),f.length!==qo)throw new Error("bad secret key size");var p=new Uint8Array(Lo);return st(p,f),{publicKey:p,secretKey:new Uint8Array(f)}},n.box.publicKeyLength=Lo,n.box.secretKeyLength=qo,n.box.sharedKeyLength=va,n.box.nonceLength=$u,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(f,p){if(It(f,p),p.length!==co)throw new Error("bad secret key size");var l=new Uint8Array(En+f.length);return Hu(l,f,f.length,p),l},n.sign.open=function(f,p){if(It(f,p),p.length!==wr)throw new Error("bad public key size");var l=new Uint8Array(f.length),a=Ea(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(En),m=0;m<a.length;m++)a[m]=l[m];return a},n.sign.detached.verify=function(f,p,l){if(It(f,p,l),p.length!==En)throw new Error("bad signature size");if(l.length!==wr)throw new Error("bad public key size");var a=new Uint8Array(En+f.length),m=new Uint8Array(En+f.length),x;for(x=0;x<En;x++)a[x]=p[x];for(x=0;x<f.length;x++)a[x+En]=f[x];return Ea(m,a,a.length,l)>=0},n.sign.keyPair=function(){var f=new Uint8Array(wr),p=new Uint8Array(co);return wa(f,p),{publicKey:f,secretKey:p}},n.sign.keyPair.fromSecretKey=function(f){if(It(f),f.length!==co)throw new Error("bad secret key size");for(var p=new Uint8Array(wr),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(It(f),f.length!==Ca)throw new Error("bad seed size");for(var p=new Uint8Array(wr),l=new Uint8Array(co),a=0;a<32;a++)l[a]=f[a];return wa(p,l,!0),{publicKey:p,secretKey:l}},n.sign.publicKeyLength=wr,n.sign.secretKeyLength=co,n.sign.seedLength=Ca,n.sign.signatureLength=En,n.hash=function(f){It(f);var p=new Uint8Array(Ua);return br(p,f,f.length),p},n.hash.hashLength=Ua,n.verify=function(f,p){return It(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];ju(x)})}else typeof Qu<"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];ju(x)}))}()})(typeof oi<"u"&&oi.exports?oi.exports:self.nacl=self.nacl||{})});var $p=Ia((Q6,Gu)=>{"use strict";var Ky=Object.prototype.hasOwnProperty,St="~";function Os(){}Object.create&&(Os.prototype=Object.create(null),new Os().__proto__||(St=!1));function Fy(n,t,e){this.fn=n,this.context=t,this.once=e||!1}function Hp(n,t,e,r,o){if(typeof e!="function")throw new TypeError("The listener must be a function");var s=new Fy(e,r||n,o),i=St?St+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 ma(n,t){--n._eventsCount===0?n._events=new Os:delete n._events[t]}function xt(){this._events=new Os,this._eventsCount=0}xt.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)Ky.call(e,r)&&t.push(St?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};xt.prototype.listeners=function(t){var e=St?St+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};xt.prototype.listenerCount=function(t){var e=St?St+t:t,r=this._events[e];return r?r.fn?1:r.length:0};xt.prototype.emit=function(t,e,r,o,s,i){var c=St?St+t:t;if(!this._events[c])return!1;var u=this._events[c],d=arguments.length,h,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,h=new Array(d-1);g<d;g++)h[g-1]=arguments[g];u.fn.apply(u.context,h)}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(!h)for(S=1,h=new Array(d-1);S<d;S++)h[S-1]=arguments[S];u[g].fn.apply(u[g].context,h)}}return!0};xt.prototype.on=function(t,e,r){return Hp(this,t,e,r,!1)};xt.prototype.once=function(t,e,r){return Hp(this,t,e,r,!0)};xt.prototype.removeListener=function(t,e,r,o){var s=St?St+t:t;if(!this._events[s])return this;if(!e)return ma(this,s),this;var i=this._events[s];if(i.fn)i.fn===e&&(!o||i.once)&&(!r||i.context===r)&&ma(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:ma(this,s)}return this};xt.prototype.removeAllListeners=function(t){var e;return t?(e=St?St+t:t,this._events[e]&&ma(this,e)):(this._events=new Os,this._eventsCount=0),this};xt.prototype.off=xt.prototype.removeListener;xt.prototype.addListener=xt.prototype.on;xt.prefixed=St;xt.EventEmitter=xt;typeof Gu<"u"&&(Gu.exports=xt)});var Hy={};Ks(Hy,{APTOS_BIP44_REGEX:()=>Cf,APTOS_COIN:()=>jo,APTOS_HARDENED_REGEX:()=>vf,Account:()=>Ln,AccountAddress:()=>F,AccountAuthenticator:()=>Ut,AccountAuthenticatorEd25519:()=>An,AccountAuthenticatorMultiEd25519:()=>ms,AccountAuthenticatorMultiKey:()=>Kr,AccountAuthenticatorSingleKey:()=>cn,AccountAuthenticatorVariant:()=>Na,AccountSequenceNumber:()=>Ns,AddressInvalidReason:()=>pf,AnyPublicKey:()=>je,AnyPublicKeyVariant:()=>ka,AnySignature:()=>mn,AnySignatureVariant:()=>za,Aptos:()=>zt,AptosApiError:()=>dn,AptosApiType:()=>$o,AptosConfig:()=>ps,AuthenticationKey:()=>an,Bool:()=>Xe,CKDPriv:()=>ac,ChainId:()=>jr,DEFAULT_MAX_GAS_AMOUNT:()=>qa,DEFAULT_NETWORK:()=>La,DEFAULT_TXN_EXP_SEC_FROM_NOW:()=>Ka,DEFAULT_TXN_TIMEOUT_SEC:()=>Vo,DeriveScheme:()=>nf,Deserializer:()=>tc,Ed25519PrivateKey:()=>Pn,Ed25519PublicKey:()=>qe,Ed25519Signature:()=>Je,EntryFunction:()=>oo,EntryFunctionBytes:()=>Yo,FeePayerRawTransaction:()=>Tn,FixedBytes:()=>Wn,HARDENED_OFFSET:()=>oc,Hex:()=>Be,HexInvalidReason:()=>df,Identifier:()=>We,KeyType:()=>Uf,MimeType:()=>Fs,ModuleId:()=>vo,MoveAbility:()=>ef,MoveFunctionVisibility:()=>Ju,MoveOption:()=>Bn,MoveString:()=>yt,MoveVector:()=>Le,MultiAgentRawTransaction:()=>wn,MultiEd25519PublicKey:()=>nn,MultiEd25519Signature:()=>Rr,MultiKey:()=>qr,MultiSig:()=>Po,MultiSigTransactionPayload:()=>Ro,Network:()=>Ho,NetworkToChainId:()=>Vs,NetworkToFaucetAPI:()=>Ga,NetworkToIndexerAPI:()=>$s,NetworkToNetworkName:()=>lg,NetworkToNodeAPI:()=>Ma,ParsingError:()=>wt,PrivateKey:()=>Br,ProcessorType:()=>Tr,PublicKey:()=>Pt,RAW_TRANSACTION_SALT:()=>Fa,RAW_TRANSACTION_WITH_DATA_SALT:()=>js,RawTransaction:()=>Wt,RawTransactionWithData:()=>ys,RoleType:()=>tf,RotationProofChallenge:()=>gs,Script:()=>Bo,ScriptTransactionArgumentVariants:()=>uo,Secp256k1PrivateKey:()=>Dn,Secp256k1PublicKey:()=>Vt,Secp256k1Signature:()=>Mn,Serializable:()=>ae,Serializer:()=>Jt,Signature:()=>tn,SignedTransaction:()=>un,SigningScheme:()=>fo,SigningSchemeInput:()=>Da,StructTag:()=>bn,TransactionAuthenticator:()=>xn,TransactionAuthenticatorEd25519:()=>Fr,TransactionAuthenticatorFeePayer:()=>$r,TransactionAuthenticatorMultiAgent:()=>Hr,TransactionAuthenticatorMultiEd25519:()=>Yi,TransactionAuthenticatorSingleSender:()=>Vr,TransactionAuthenticatorVariant:()=>Oa,TransactionPayload:()=>hr,TransactionPayloadEntryFunction:()=>Uo,TransactionPayloadMultiSig:()=>Io,TransactionPayloadScript:()=>Co,TransactionPayloadVariants:()=>Pa,TransactionResponseType:()=>Hs,TransactionVariants:()=>Ra,TransactionWorker:()=>ks,TransactionWorkerEventsEnum:()=>qu,TypeTag:()=>nt,TypeTagAddress:()=>to,TypeTagBool:()=>Wr,TypeTagGeneric:()=>no,TypeTagParserError:()=>Fe,TypeTagParserErrorType:()=>Hl,TypeTagReference:()=>hs,TypeTagSigner:()=>mr,TypeTagStruct:()=>Kn,TypeTagU128:()=>Jr,TypeTagU16:()=>Yr,TypeTagU256:()=>eo,TypeTagU32:()=>Zr,TypeTagU64:()=>Xr,TypeTagU8:()=>Qr,TypeTagVariants:()=>Ba,TypeTagVector:()=>ro,U128:()=>Lt,U16:()=>Mt,U256:()=>qt,U32:()=>Gt,U64:()=>ft,U8:()=>lt,aptosCoinStructTag:()=>vy,aptosRequest:()=>Fo,buildTransaction:()=>ca,checkOrConvertArgument:()=>io,convertArgument:()=>Su,deriveKey:()=>ii,deriveTransactionType:()=>Iu,deserializeFromScriptArgument:()=>ql,ensureBoolean:()=>Js,fetchEntryFunctionAbi:()=>Eu,findFirstNonSignerArg:()=>wu,generateMultiSignersSignedTransaction:()=>Ql,generateRawTransaction:()=>Wl,generateSignedTransaction:()=>Uu,generateSignedTransactionForSimulation:()=>vu,generateSigningMessage:()=>ua,generateTransactionPayload:()=>Ts,generateTransactionPayloadWithABI:()=>Vl,get:()=>Ha,getAptosFullNode:()=>Bt,getAuthenticatorForSimulation:()=>ws,getFunctionParts:()=>aa,isBcsAddress:()=>bs,isBcsBool:()=>Xi,isBcsFixedBytes:()=>$l,isBcsString:()=>Ji,isBcsU128:()=>oa,isBcsU16:()=>ta,isBcsU256:()=>sa,isBcsU32:()=>na,isBcsU64:()=>ra,isBcsU8:()=>ea,isBlockMetadataTransactionResponse:()=>sg,isBool:()=>Au,isEd25519Signature:()=>ag,isEncodedEntryFunctionArgument:()=>bu,isFeePayerSignature:()=>fg,isGenesisTransactionResponse:()=>og,isLargeNumber:()=>xs,isMultiAgentSignature:()=>ug,isMultiEd25519Signature:()=>dg,isNull:()=>xu,isNumber:()=>As,isPendingTransactionResponse:()=>ng,isScriptDataInput:()=>ia,isSecp256k1Signature:()=>cg,isStateCheckpointTransactionResponse:()=>ig,isString:()=>so,isUserTransactionResponse:()=>rg,isValidBIP44Path:()=>sc,isValidHardenedPath:()=>ic,mnemonicToSeed:()=>Xo,objectStructTag:()=>Iy,optionStructTag:()=>Uy,outOfRangeErrorMessage:()=>lf,paginateWithCursor:()=>_r,parseTypeTag:()=>Oo,post:()=>Ws,postAptosFaucet:()=>Va,postAptosFullNode:()=>Er,postAptosIndexer:()=>$a,promiseFulfilledStatus:()=>Lu,request:()=>of,sign:()=>Cu,splitPath:()=>cc,standardizeTypeTags:()=>_u,stringStructTag:()=>Cy,throwTypeMismatch:()=>$e,validateNumberInRange:()=>Cn});var dn=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 Xu="1.5.1";var Fs=(r=>(r.JSON="application/json",r.BCS="application/x-bcs",r.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",r))(Fs||{}),Ba=(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))(Ba||{}),uo=(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))(uo||{}),Pa=(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(Pa||{}),Ra=(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(Ra||{}),Oa=(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))(Oa||{}),Na=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(Na||{}),ka=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(ka||{}),za=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(za||{}),Hs=(s=>(s.Pending="pending_transaction",s.User="user_transaction",s.Genesis="genesis_transaction",s.BlockMetadata="block_metadata_transaction",s.StateCheckpoint="state_checkpoint_transaction",s))(Hs||{});function ng(n){return n.type==="pending_transaction"}function rg(n){return n.type==="user_transaction"}function og(n){return n.type==="genesis_transaction"}function sg(n){return n.type==="block_metadata_transaction"}function ig(n){return n.type==="state_checkpoint_transaction"}function ag(n){return"signature"in n&&n.signature==="ed25519_signature"}function cg(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function ug(n){return n.type==="multi_agent_signature"}function fg(n){return n.type==="fee_payer_signature"}function dg(n){return n.type==="multi_ed25519_signature"}var Ju=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(Ju||{}),ef=(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(ef||{}),tf=(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(tf||{}),fo=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(fo||{}),Da=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(Da||{}),nf=(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))(nf||{});var rf={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 of(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/${Xu}`,"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 Fo(n,t){let{url:e,path:r}=n,o=r?`${e}/${r}`:e,s=await of({...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 dn(n,i,u.errors[0].message??`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 rf?c=rf[i.status]:c=`Unhandled Error ${i.status} : ${i.statusText}`,new dn(n,i,c)}var $s={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",local:"http://127.0.0.1:8090/v1/graphql"},Ma={mainnet:"https://fullnode.mainnet.aptoslabs.com/v1",testnet:"https://fullnode.testnet.aptoslabs.com/v1",devnet:"https://fullnode.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},Ga={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},Ho=(s=>(s.MAINNET="mainnet",s.TESTNET="testnet",s.DEVNET="devnet",s.LOCAL="local",s.CUSTOM="custom",s))(Ho||{}),Vs={mainnet:1,testnet:2},lg={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var $o=(r=>(r[r.FULLNODE=0]="FULLNODE",r[r.INDEXER=1]="INDEXER",r[r.FAUCET=2]="FAUCET",r))($o||{}),La="devnet",qa=2e5,Ka=20,Vo=20,jo="0x1::aptos_coin::AptosCoin",Fa="APTOS::RawTransaction",js="APTOS::RawTransactionWithData",Tr=(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))(Tr||{});async function Ha(n){let{aptosConfig:t,overrides:e,params:r,contentType:o,acceptType:s,path:i,originMethod:c,type:u}=n,d=t.getRequestUrl(u);return Fo({url:d,method:"GET",originMethod:c,path:i,contentType:o?.valueOf(),acceptType:s?.valueOf(),params:r,overrides:{...t.clientConfig,...e}},t)}async function Bt(n){return Ha({...n,type:0})}async function _r(n){let t=[],e,r=n.params;for(;;){r.start=e;let o=await Ha({type:0,aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});if(e=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),e==null)break}return t}async function Ws(n){let{type:t,originMethod:e,path:r,body:o,acceptType:s,contentType:i,params:c,aptosConfig:u,overrides:d}=n,h=u.getRequestUrl(t);return Fo({url:h,method:"POST",originMethod:e,path:r,body:o,contentType:i?.valueOf(),acceptType:s?.valueOf(),params:c,overrides:{...u.clientConfig,...d}},u)}async function Er(n){return Ws({...n,type:0})}async function $a(n){return Ws({...n,type:1})}async function Va(n){return Ws({...n,type:2})}var Qs=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var af=n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4));function ja(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}var ln=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),Zt=(n,t)=>n<<32-t|n>>>t,pg=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!pg)throw new Error("Non little-endian hardware is not supported");var gg=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function Sr(n){if(!ja(n))throw new Error("Uint8Array expected");let t="";for(let e=0;e<n.length;e++)t+=gg[n[e]];return t}var Sn={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function sf(n){if(n>=Sn._0&&n<=Sn._9)return n-Sn._0;if(n>=Sn._A&&n<=Sn._F)return n-(Sn._A-10);if(n>=Sn._a&&n<=Sn._f)return n-(Sn._a-10)}function lo(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=sf(n.charCodeAt(s)),c=sf(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 Wa(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function Xt(n){if(typeof n=="string"&&(n=Wa(n)),!ja(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}function vr(...n){let t=0;for(let r=0;r<n.length;r++){let o=n[r];if(!ja(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 $n=class{clone(){return this._cloneInto()}},mg={}.toString;function cf(n,t){if(t!==void 0&&mg.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(n,t)}function Vn(n){let t=r=>n().update(Xt(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function uf(n){let t=(r,o)=>n(o).update(Xt(r)).digest(),e=n({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>n(r),t}function ff(n=32){if(Qs&&typeof Qs.getRandomValues=="function")return Qs.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}var Ys=255,Zs=65535,vn=4294967295,Cr=18446744073709551615n,Wo=340282366920938463463374607431768211455n,Xs=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var wt=class extends Error{constructor(e,r){super(e);this.invalidReason=r}};var df=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(df||{}),Be=class n{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return Sr(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 wt("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 wt("Hex string must be an even number of hex characters.","invalid_length");try{return new n(lo(e))}catch(r){throw new wt(`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 Jt;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return Be.fromHexInput(t)}},Jt=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){Js(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(vn),r=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(r))}serializeU128(t){let e=BigInt(t)&Cr,r=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(r)}serializeU256(t){let e=BigInt(t)&Wo,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)})}};Ct([Ur(0,Ys)],Jt.prototype,"serializeU8",1),Ct([Ur(0,Zs)],Jt.prototype,"serializeU16",1),Ct([Ur(0,vn)],Jt.prototype,"serializeU32",1),Ct([Ur(BigInt(0),Cr)],Jt.prototype,"serializeU64",1),Ct([Ur(BigInt(0),Wo)],Jt.prototype,"serializeU128",1),Ct([Ur(BigInt(0),Xs)],Jt.prototype,"serializeU256",1),Ct([Ur(0,vn)],Jt.prototype,"serializeU32AsUleb128",1);function Js(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var lf=(n,t,e)=>`${n} is out of range: [${t}, ${e}]`;function Cn(n,t,e){let r=BigInt(n);if(r>BigInt(e)||r<BigInt(t))throw new Error(lf(n,t,e))}function Ur(n,t){return(e,r,o)=>{let s=o.value;return o.value=function(c){return Cn(c,n,t),s.apply(this,[c])},o}}var pf=(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))(pf||{}),Ge=class Ge extends ae{constructor(e){super();if(e.length!==Ge.LENGTH)throw new wt("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=Sr(this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return Sr(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(Ge.LENGTH);return new Ge(r)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new wt("Hex string must start with a leading 0x.","leading_zero_x_required");let r=Ge.fromString(e);if(e.length!==Ge.LONG_STRING_LENGTH+2)if(r.isSpecial()){if(e.length!==3)throw new wt(`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 wt(`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 wt("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(r.length>64)throw new wt("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let o;try{o=lo(r.padStart(64,"0"))}catch(s){throw new wt(`Hex characters are invalid: ${s?.message}`,"invalid_hex_chars")}return new Ge(o)}static from(e){return e instanceof Ge?e:e instanceof Uint8Array?new Ge(e):Ge.fromString(e)}static fromStrict(e){return e instanceof Ge?e:e instanceof Uint8Array?new Ge(e):Ge.fromStringStrict(e)}static isValid(e){try{return e.strict?Ge.fromStrict(e.input):Ge.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])}};Ge.LENGTH=32,Ge.LONG_STRING_LENGTH=64,Ge.ZERO=Ge.from("0x0"),Ge.ONE=Ge.from("0x1"),Ge.TWO=Ge.from("0x2"),Ge.THREE=Ge.from("0x3"),Ge.FOUR=Ge.from("0x4");var F=Ge;function Un(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 en(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 ei(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Un(n.outputLen),Un(n.blockLen)}function In(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 ti(n,t){en(n);let e=t.outputLen;if(n.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var ni=BigInt(4294967295),Qa=BigInt(32);function gf(n,t=!1){return t?{h:Number(n&ni),l:Number(n>>Qa&ni)}:{h:Number(n>>Qa&ni)|0,l:Number(n&ni)|0}}function Ya(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}=gf(n[o],t);[e[o],r[o]]=[s,i]}return[e,r]}var yg=(n,t)=>BigInt(n>>>0)<<Qa|BigInt(t>>>0),Ag=(n,t,e)=>n>>>e,xg=(n,t,e)=>n<<32-e|t>>>e,bg=(n,t,e)=>n>>>e|t<<32-e,wg=(n,t,e)=>n<<32-e|t>>>e,Tg=(n,t,e)=>n<<64-e|t>>>e-32,_g=(n,t,e)=>n>>>e-32|t<<64-e,Eg=(n,t)=>t,Sg=(n,t)=>n,Za=(n,t,e)=>n<<e|t>>>32-e,Xa=(n,t,e)=>t<<e|n>>>32-e,Ja=(n,t,e)=>t<<e-32|n>>>64-e,ec=(n,t,e)=>n<<e-32|t>>>64-e;function vg(n,t,e,r){let o=(t>>>0)+(r>>>0);return{h:n+e+(o/2**32|0)|0,l:o|0}}var Cg=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),Ug=(n,t,e,r)=>t+e+r+(n/2**32|0)|0,Ig=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),Bg=(n,t,e,r,o)=>t+e+r+o+(n/2**32|0)|0,Pg=(n,t,e,r,o)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(o>>>0),Rg=(n,t,e,r,o,s)=>t+e+r+o+s+(n/2**32|0)|0;var Og={fromBig:gf,split:Ya,toBig:yg,shrSH:Ag,shrSL:xg,rotrSH:bg,rotrSL:wg,rotrBH:Tg,rotrBL:_g,rotr32H:Eg,rotr32L:Sg,rotlSH:Za,rotlSL:Xa,rotlBH:Ja,rotlBL:ec,add:vg,add3L:Cg,add3H:Ug,add4L:Ig,add4H:Bg,add5H:Rg,add5L:Pg},Ae=Og;var[yf,Af,xf]=[[],[],[]],Ng=BigInt(0),Qo=BigInt(1),kg=BigInt(2),zg=BigInt(7),Dg=BigInt(256),Mg=BigInt(113);for(let n=0,t=Qo,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],yf.push(2*(5*r+e)),Af.push((n+1)*(n+2)/2%64);let o=Ng;for(let s=0;s<7;s++)t=(t<<Qo^(t>>zg)*Mg)%Dg,t&kg&&(o^=Qo<<(Qo<<BigInt(s))-Qo);xf.push(o)}var[Gg,Lg]=Ya(xf,!0),mf=(n,t,e)=>e>32?Ja(n,t,e):Za(n,t,e),hf=(n,t,e)=>e>32?ec(n,t,e):Xa(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],h=e[u+1],g=mf(d,h,1)^e[c],T=hf(d,h,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=Af[i],u=mf(o,s,c),d=hf(o,s,c),h=yf[i];o=n[h],s=n[h+1],n[h]=u,n[h+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]^=Gg[r],n[1]^=Lg[r]}e.fill(0)}var ri=class n extends $n{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,Un(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=af(this.state)}keccak(){qg(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){In(this);let{blockLen:e,state:r}=this;t=Xt(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){In(this,!1),en(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 Un(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ti(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}},jn=(n,t,e)=>Vn(()=>new ri(t,n,e)),V0=jn(6,144,224/8),Ir=jn(6,136,256/8),j0=jn(6,104,384/8),W0=jn(6,72,512/8),Q0=jn(1,144,224/8),Y0=jn(1,136,256/8),Z0=jn(1,104,384/8),X0=jn(1,72,512/8),bf=(n,t,e)=>uf((r={})=>new ri(t,n,r.dkLen===void 0?e:r.dkLen,!0)),J0=bf(31,168,128/8),eA=bf(31,136,256/8);var Jo=Zu(Tf());var tc=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<vn;){let r=this.deserializeU8();if(t|=BigInt(r&127)<<BigInt(e),!(r&128))break;e+=7}if(t>vn)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 Wn=class n extends ae{constructor(e){super();this.value=Be.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 Yo=class n extends ae{constructor(e){super();this.value=new Wn(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,r){let o=Wn.deserialize(e,r);return new n(o.value)}};var Xe=class n extends ae{constructor(e){super();Js(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())}},lt=class n extends ae{constructor(e){super();Cn(e,0,Ys),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())}},Mt=class n extends ae{constructor(e){super();Cn(e,0,Zs),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())}},Gt=class n extends ae{constructor(e){super();Cn(e,0,vn),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())}},ft=class n extends ae{constructor(e){super();Cn(e,BigInt(0),Cr),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())}},Lt=class n extends ae{constructor(e){super();Cn(e,BigInt(0),Wo),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();Cn(e,BigInt(0),Xs),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 Le=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 lt)&&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=Be.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 lt(o)))}static U16(e){return new n(e.map(r=>new Mt(r)))}static U32(e){return new n(e.map(r=>new Gt(r)))}static U64(e){return new n(e.map(r=>new ft(r)))}static U128(e){return new n(e.map(r=>new Lt(r)))}static U256(e){return new n(e.map(r=>new qt(r)))}static Bool(e){return new n(e.map(r=>new Xe(r)))}static MoveString(e){return new n(e.map(r=>new yt(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)}},yt=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);Le.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},Bn=class n extends ae{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new Le([e]):this.vec=new Le([]),[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 lt(e):void 0)}static U16(e){return new n(e!=null?new Mt(e):void 0)}static U32(e){return new n(e!=null?new Gt(e):void 0)}static U64(e){return new n(e!=null?new ft(e):void 0)}static U128(e){return new n(e!=null?new Lt(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 Xe(e):void 0)}static MoveString(e){return new n(e!=null?new yt(e):void 0)}static deserialize(e,r){let o=Le.deserialize(e,r);return new n(o.values[0])}};var Pt=class extends ae{},Br=class extends ae{},tn=class extends ae{};var si=class extends $n{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,ei(t);let r=Xt(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 In(this),this.iHash.update(t),this}digestInto(t){In(this),en(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()}},pn=(n,t,e)=>new si(n,t).update(e).digest();pn.create=(n,t)=>new si(n,t);function Kg(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 Qn=class extends $n{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=ln(this.buffer)}update(t){In(this);let{view:e,buffer:r,blockLen:o}=this;t=Xt(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=ln(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){In(this),ti(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;Kg(r,o-8,BigInt(this.length*8),s),this.process(r,0);let c=ln(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let d=u/4,h=this.get();if(d>h.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g<d;g++)c.setUint32(4*g,h[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[Fg,Hg]=Ae.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))),Yn=new Uint32Array(80),Zn=new Uint32Array(80),nc=class extends Qn{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:h,Fh:g,Fl:T,Gh:S,Gl:b,Hh:y,Hl:w}=this;return[t,e,r,o,s,i,c,u,d,h,g,T,S,b,y,w]}set(t,e,r,o,s,i,c,u,d,h,g,T,S,b,y,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=h|0,this.Fh=g|0,this.Fl=T|0,this.Gh=S|0,this.Gl=b|0,this.Hh=y|0,this.Hl=w|0}process(t,e){for(let P=0;P<16;P++,e+=4)Yn[P]=t.getUint32(e),Zn[P]=t.getUint32(e+=4);for(let P=16;P<80;P++){let $=Yn[P-15]|0,M=Zn[P-15]|0,z=Ae.rotrSH($,M,1)^Ae.rotrSH($,M,8)^Ae.shrSH($,M,7),L=Ae.rotrSL($,M,1)^Ae.rotrSL($,M,8)^Ae.shrSL($,M,7),K=Yn[P-2]|0,we=Zn[P-2]|0,te=Ae.rotrSH(K,we,19)^Ae.rotrBH(K,we,61)^Ae.shrSH(K,we,6),Q=Ae.rotrSL(K,we,19)^Ae.rotrBL(K,we,61)^Ae.shrSL(K,we,6),ve=Ae.add4L(L,Q,Zn[P-7],Zn[P-16]),Ce=Ae.add4H(ve,z,te,Yn[P-7],Yn[P-16]);Yn[P]=Ce|0,Zn[P]=ve|0}let{Ah:r,Al:o,Bh:s,Bl:i,Ch:c,Cl:u,Dh:d,Dl:h,Eh:g,El:T,Fh:S,Fl:b,Gh:y,Gl:w,Hh:v,Hl:k}=this;for(let P=0;P<80;P++){let $=Ae.rotrSH(g,T,14)^Ae.rotrSH(g,T,18)^Ae.rotrBH(g,T,41),M=Ae.rotrSL(g,T,14)^Ae.rotrSL(g,T,18)^Ae.rotrBL(g,T,41),z=g&S^~g&y,L=T&b^~T&w,K=Ae.add5L(k,M,L,Hg[P],Zn[P]),we=Ae.add5H(K,v,$,z,Fg[P],Yn[P]),te=K|0,Q=Ae.rotrSH(r,o,28)^Ae.rotrBH(r,o,34)^Ae.rotrBH(r,o,39),ve=Ae.rotrSL(r,o,28)^Ae.rotrBL(r,o,34)^Ae.rotrBL(r,o,39),Ce=r&s^r&c^s&c,Ve=o&i^o&u^i&u;v=y|0,k=w|0,y=S|0,w=b|0,S=g|0,b=T|0,{h:g,l:T}=Ae.add(d|0,h|0,we|0,te|0),d=c|0,h=u|0,c=s|0,u=i|0,s=r|0,i=o|0;let _=Ae.add3L(te,ve,Ve);r=Ae.add3H(_,we,Q,Ce),o=_|0}({h:r,l:o}=Ae.add(this.Ah|0,this.Al|0,r|0,o|0)),{h:s,l:i}=Ae.add(this.Bh|0,this.Bl|0,s|0,i|0),{h:c,l:u}=Ae.add(this.Ch|0,this.Cl|0,c|0,u|0),{h:d,l:h}=Ae.add(this.Dh|0,this.Dl|0,d|0,h|0),{h:g,l:T}=Ae.add(this.Eh|0,this.El|0,g|0,T|0),{h:S,l:b}=Ae.add(this.Fh|0,this.Fl|0,S|0,b|0),{h:y,l:w}=Ae.add(this.Gh|0,this.Gl|0,y|0,w|0),{h:v,l:k}=Ae.add(this.Hh|0,this.Hl|0,v|0,k|0),this.set(r,o,s,i,c,u,d,h,g,T,S,b,y,w,v,k)}roundClean(){Yn.fill(0),Zn.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 Pr=Vn(()=>new nc);function $g(n,t,e,r){ei(n);let o=cf({dkLen:32,asyncTick:10},r),{c:s,dkLen:i,asyncTick:c}=o;if(Un(s),Un(i),Un(c),s<1)throw new Error("PBKDF2: iterations (c) should be >= 1");let u=Xt(t),d=Xt(e),h=new Uint8Array(i),g=pn.create(n,u),T=g._cloneInto().update(d);return{c:s,dkLen:i,asyncTick:c,DK:h,PRF:g,PRFSalt:T}}function Vg(n,t,e,r,o){return n.destroy(),t.destroy(),r&&r.destroy(),o.fill(0),e}function _f(n,t,e,r){let{c:o,dkLen:s,DK:i,PRF:c,PRFSalt:u}=$g(n,t,e,r),d,h=new Uint8Array(4),g=ln(h),T=new Uint8Array(c.outputLen);for(let S=1,b=0;b<s;S++,b+=c.outputLen){let y=i.subarray(b,b+c.outputLen);g.setInt32(0,S,!1),(d=u._cloneInto(d)).update(h).digestInto(T),y.set(T.subarray(0,y.length));for(let w=1;w<o;w++){c._cloneInto(d).update(T).digestInto(T);for(let v=0;v<y.length;v++)y[v]^=T[v]}}return Vg(c,u,i,d,T)}var jg=(n,t,e)=>n&t^~n&e,Wg=(n,t,e)=>n&t^n&e^t&e,Qg=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]),Xn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Jn=new Uint32Array(64),rc=class extends Qn{constructor(){super(64,32,8,!1),this.A=Xn[0]|0,this.B=Xn[1]|0,this.C=Xn[2]|0,this.D=Xn[3]|0,this.E=Xn[4]|0,this.F=Xn[5]|0,this.G=Xn[6]|0,this.H=Xn[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)Jn[g]=t.getUint32(e,!1);for(let g=16;g<64;g++){let T=Jn[g-15],S=Jn[g-2],b=Zt(T,7)^Zt(T,18)^T>>>3,y=Zt(S,17)^Zt(S,19)^S>>>10;Jn[g]=y+Jn[g-7]+b+Jn[g-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:u,G:d,H:h}=this;for(let g=0;g<64;g++){let T=Zt(c,6)^Zt(c,11)^Zt(c,25),S=h+T+jg(c,u,d)+Qg[g]+Jn[g]|0,y=(Zt(r,2)^Zt(r,13)^Zt(r,22))+Wg(r,o,s)|0;h=d,d=u,u=c,c=i+S|0,i=s,s=o,o=r,r=S+y|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,h=h+this.H|0,this.set(r,o,s,i,c,u,d,h)}roundClean(){Jn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Zo=Vn(()=>new rc);function Ef(n){if(typeof n!="string")throw new TypeError(`Invalid mnemonic type: ${typeof n}`);return n.normalize("NFKD")}function Yg(n){let t=Ef(n),e=t.split(" ");if(![12,15,18,21,24].includes(e.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:e}}var Zg=n=>Ef(`mnemonic${n}`);function Sf(n,t=""){return _f(Pr,Yg(n).nfkd,Zg(t),{c:2048,dkLen:64})}var vf=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Cf=/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,Uf=(t=>(t.ED25519="ed25519 seed",t))(Uf||{}),oc=2147483648;function sc(n){return Cf.test(n)}function ic(n){return vf.test(n)}var ii=(n,t)=>{let e=pn.create(Pr,n).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},ac=({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 ii(t,i)},Jg=n=>n.replace("'",""),cc=n=>n.split("/").slice(1).map(Jg),Xo=n=>{let t=n.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return Sf(t)};var er=class er extends Pt{constructor(e){super();let r=Be.fromHexInput(e);if(r.toUint8Array().length!==er.LENGTH)throw new Error(`PublicKey length should be ${er.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:r,signature:o}=e,s=Be.fromHexInput(r).toUint8Array(),i=o.toUint8Array();return Jo.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 er(r)}static load(e){let r=e.deserializeBytes();return new er(r)}static isPublicKey(e){return e instanceof er}};er.LENGTH=32;var qe=er,Tt=class Tt extends Br{constructor(e){super();let r=Be.fromHexInput(e);if(r.toUint8Array().length!==Tt.LENGTH)throw new Error(`PrivateKey length should be ${Tt.LENGTH}`);this.signingKeyPair=Jo.default.sign.keyPair.fromSeed(r.toUint8Array().slice(0,Tt.LENGTH))}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,Tt.LENGTH)}toString(){return Be.fromHexInput(this.toUint8Array()).toString()}sign(e){let r=Be.fromHexInput(e),o=Jo.default.sign.detached(r.toUint8Array(),this.signingKeyPair.secretKey);return new Je(o)}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Tt(r)}static generate(){let e=Jo.default.sign.keyPair();return new Tt(e.secretKey.slice(0,Tt.LENGTH))}publicKey(){let e=this.signingKeyPair.publicKey;return new qe(e)}static fromDerivationPath(e,r){if(!ic(e))throw new Error(`Invalid derivation path ${e}`);return Tt.fromDerivationPathInner(e,Xo(r))}static fromDerivationPathInner(e,r,o=oc){let{key:s,chainCode:i}=ii(Tt.SLIP_0010_SEED,r),c=cc(e).map(d=>parseInt(d,10)),{key:u}=c.reduce((d,h)=>ac(d,h+o),{key:s,chainCode:i});return new Tt(u)}static isPrivateKey(e){return e instanceof Tt}};Tt.LENGTH=32,Tt.SLIP_0010_SEED="ed25519 seed";var Pn=Tt,tr=class tr extends tn{constructor(e){super();let r=Be.fromHexInput(e);if(r.toUint8Array().length!==tr.LENGTH)throw new Error(`Signature length should be ${tr.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 tr(r)}static load(e){let r=e.deserializeBytes();return new tr(r)}static isSignature(e){return e instanceof tr}};tr.LENGTH=64;var Je=tr;var Kt=class Kt extends Pt{constructor(e){super();let{publicKeys:r,threshold:o}=e;if(r.length>Kt.MAX_KEYS||r.length<Kt.MIN_KEYS)throw new Error(`Must have between ${Kt.MIN_KEYS} and ${Kt.MAX_KEYS} public keys, inclusive`);if(o<Kt.MIN_THRESHOLD||o>r.length)throw new Error(`Threshold must be between ${Kt.MIN_THRESHOLD} and ${r.length}, inclusive`);this.publicKeys=r,this.threshold=o}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*qe.LENGTH+1);return this.publicKeys.forEach((r,o)=>{e.set(r.toUint8Array(),o*qe.LENGTH)}),e[this.publicKeys.length*qe.LENGTH]=this.threshold,e}toString(){return Be.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+=qe.LENGTH){let c=i;s.push(new qe(r.subarray(c,c+qe.LENGTH)))}return new Kt({publicKeys:s,threshold:o})}};Kt.MAX_KEYS=32,Kt.MIN_KEYS=2,Kt.MIN_THRESHOLD=1;var nn=Kt,Ft=class Ft extends tn{constructor(e){super();let{signatures:r,bitmap:o}=e;if(o.length!==Ft.BITMAP_LEN)throw new Error(`"bitmap" length should be ${Ft.BITMAP_LEN}`);if(r.length>Ft.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${Ft.MAX_SIGNATURES_SUPPORTED}`);this.signatures=r,this.bitmap=o}toUint8Array(){let e=new Uint8Array(this.signatures.length*Je.LENGTH+Ft.BITMAP_LEN);return this.signatures.forEach((r,o)=>{e.set(r.toUint8Array(),o*Je.LENGTH)}),e.set(this.bitmap,this.signatures.length*Je.LENGTH),e}toString(){return Be.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>=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.");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+=Je.LENGTH){let c=i;s.push(new Je(r.subarray(c,c+Je.LENGTH)))}return new Ft({signatures:s,bitmap:o})}};Ft.MAX_SIGNATURES_SUPPORTED=32,Ft.BITMAP_LEN=4;var Rr=Ft;function If(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function uc(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 Bf(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");If(n.outputLen),If(n.blockLen)}function po(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 Pf(n,t){uc(n);let e=t.outputLen;if(n.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var ai=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var Rf=n=>n instanceof Uint8Array;var ci=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),rn=(n,t)=>n<<32-t|n>>>t,em=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!em)throw new Error("Non little-endian hardware is not supported");function tm(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function es(n){if(typeof n=="string"&&(n=tm(n)),!Rf(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}function Of(...n){let t=new Uint8Array(n.reduce((r,o)=>r+o.length,0)),e=0;return n.forEach(r=>{if(!Rf(r))throw new Error("Uint8Array expected");t.set(r,e),e+=r.length}),t}var go=class{clone(){return this._cloneInto()}},Ex={}.toString;function Nf(n){let t=r=>n().update(es(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function kf(n=32){if(ai&&typeof ai.getRandomValues=="function")return ai.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}function nm(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 ui=class extends go{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=ci(this.buffer)}update(t){po(this);let{view:e,buffer:r,blockLen:o}=this;t=es(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=ci(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){po(this),Pf(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;nm(r,o-8,BigInt(this.length*8),s),this.process(r,0);let c=ci(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let d=u/4,h=this.get();if(d>h.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g<d;g++)c.setUint32(4*g,h[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 rm=(n,t,e)=>n&t^~n&e,om=(n,t,e)=>n&t^n&e^t&e,sm=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]),nr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),rr=new Uint32Array(64),fc=class extends ui{constructor(){super(64,32,8,!1),this.A=nr[0]|0,this.B=nr[1]|0,this.C=nr[2]|0,this.D=nr[3]|0,this.E=nr[4]|0,this.F=nr[5]|0,this.G=nr[6]|0,this.H=nr[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)rr[g]=t.getUint32(e,!1);for(let g=16;g<64;g++){let T=rr[g-15],S=rr[g-2],b=rn(T,7)^rn(T,18)^T>>>3,y=rn(S,17)^rn(S,19)^S>>>10;rr[g]=y+rr[g-7]+b+rr[g-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:u,G:d,H:h}=this;for(let g=0;g<64;g++){let T=rn(c,6)^rn(c,11)^rn(c,25),S=h+T+rm(c,u,d)+sm[g]+rr[g]|0,y=(rn(r,2)^rn(r,13)^rn(r,22))+om(r,o,s)|0;h=d,d=u,u=c,c=i+S|0,i=s,s=o,o=r,r=S+y|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,h=h+this.H|0,this.set(r,o,s,i,c,u,d,h)}roundClean(){rr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var zf=Nf(()=>new fc);var gc={};Ks(gc,{bitGet:()=>lm,bitLen:()=>dm,bitMask:()=>ts,bitSet:()=>pm,bytesToHex:()=>Or,bytesToNumberBE:()=>Rn,bytesToNumberLE:()=>li,concatBytes:()=>mo,createHmacDrbg:()=>pc,ensureBytes:()=>Rt,equalBytes:()=>um,hexToBytes:()=>Nr,hexToNumber:()=>lc,numberToBytesBE:()=>or,numberToBytesLE:()=>pi,numberToHexUnpadded:()=>Gf,numberToVarBytesBE:()=>cm,utf8ToBytes:()=>fm,validateObject:()=>sr});var Mf=BigInt(0),fi=BigInt(1),im=BigInt(2),di=n=>n instanceof Uint8Array,am=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function Or(n){if(!di(n))throw new Error("Uint8Array expected");let t="";for(let e=0;e<n.length;e++)t+=am[n[e]];return t}function Gf(n){let t=n.toString(16);return t.length&1?`0${t}`:t}function lc(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return BigInt(n===""?"0":`0x${n}`)}function Nr(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 Rn(n){return lc(Or(n))}function li(n){if(!di(n))throw new Error("Uint8Array expected");return lc(Or(Uint8Array.from(n).reverse()))}function or(n,t){return Nr(n.toString(16).padStart(t*2,"0"))}function pi(n,t){return or(n,t).reverse()}function cm(n){return Nr(Gf(n))}function Rt(n,t,e){let r;if(typeof t=="string")try{r=Nr(t)}catch(s){throw new Error(`${n} must be valid hex string, got "${t}". Cause: ${s}`)}else if(di(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 mo(...n){let t=new Uint8Array(n.reduce((r,o)=>r+o.length,0)),e=0;return n.forEach(r=>{if(!di(r))throw new Error("Uint8Array expected");t.set(r,e),e+=r.length}),t}function um(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 fm(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function dm(n){let t;for(t=0;n>Mf;n>>=fi,t+=1);return t}function lm(n,t){return n>>BigInt(t)&fi}var pm=(n,t,e)=>n|(e?fi:Mf)<<BigInt(t),ts=n=>(im<<BigInt(n-1))-fi,dc=n=>new Uint8Array(n),Df=n=>Uint8Array.from(n);function pc(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=dc(n),o=dc(n),s=0,i=()=>{r.fill(1),o.fill(0),s=0},c=(...g)=>e(o,r,...g),u=(g=dc())=>{o=c(Df([0]),g),r=c(),g.length!==0&&(o=c(Df([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 mo(...T)};return(g,T)=>{i(),u(g);let S;for(;!(S=T(d()));)u();return i(),S}}var gm={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 sr(n,t,e={}){let r=(o,s,i)=>{let c=gm[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 ct=BigInt(0),et=BigInt(1),kr=BigInt(2),mm=BigInt(3),mc=BigInt(4),Lf=BigInt(5),qf=BigInt(8),hm=BigInt(9),ym=BigInt(16);function At(n,t){let e=n%t;return e>=ct?e:t+e}function Am(n,t,e){if(e<=ct||t<ct)throw new Error("Expected power/modulo > 0");if(e===et)return ct;let r=et;for(;t>ct;)t&et&&(r=r*n%e),n=n*n%e,t>>=et;return r}function Ot(n,t,e){let r=n;for(;t-- >ct;)r*=r,r%=e;return r}function gi(n,t){if(n===ct||t<=ct)throw new Error(`invert: expected positive integers, got n=${n} mod=${t}`);let e=At(n,t),r=t,o=ct,s=et,i=et,c=ct;for(;e!==ct;){let d=r/e,h=r%e,g=o-i*d,T=s-c*d;r=e,e=h,o=i,s=c,i=g,c=T}if(r!==et)throw new Error("invert: does not exist");return At(o,t)}function xm(n){let t=(n-et)/kr,e,r,o;for(e=n-et,r=0;e%kr===ct;e/=kr,r++);for(o=kr;o<n&&Am(o,t,n)!==n-et;o++);if(r===1){let i=(n+et)/mc;return function(u,d){let h=u.pow(d,i);if(!u.eql(u.sqr(h),d))throw new Error("Cannot find square root");return h}}let s=(e+et)/kr;return function(c,u){if(c.pow(u,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let d=r,h=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 y=c.sqr(T);S<d&&!c.eql(y,c.ONE);S++)y=c.sqr(y);let b=c.pow(h,et<<BigInt(d-S-1));h=c.sqr(b),g=c.mul(g,b),T=c.mul(T,h),d=S}return g}}function bm(n){if(n%mc===mm){let t=(n+et)/mc;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%qf===Lf){let t=(n-Lf)/qf;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%ym,xm(n)}var wm=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function hc(n){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=wm.reduce((r,o)=>(r[o]="function",r),t);return sr(n,e)}function Tm(n,t,e){if(e<ct)throw new Error("Expected power > 0");if(e===ct)return n.ONE;if(e===et)return t;let r=n.ONE,o=t;for(;e>ct;)e&et&&(r=n.mul(r,o)),o=n.sqr(o),e>>=et;return r}function _m(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 yc(n,t){let e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function Kf(n,t,e=!1,r={}){if(n<=ct)throw new Error(`Expected Field ORDER > 0, got ${n}`);let{nBitLength:o,nByteLength:s}=yc(n,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let i=bm(n),c=Object.freeze({ORDER:n,BITS:o,BYTES:s,MASK:ts(o),ZERO:ct,ONE:et,create:u=>At(u,n),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return ct<=u&&u<n},is0:u=>u===ct,isOdd:u=>(u&et)===et,neg:u=>At(-u,n),eql:(u,d)=>u===d,sqr:u=>At(u*u,n),add:(u,d)=>At(u+d,n),sub:(u,d)=>At(u-d,n),mul:(u,d)=>At(u*d,n),pow:(u,d)=>Tm(c,u,d),div:(u,d)=>At(u*gi(d,n),n),sqrN:u=>u*u,addN:(u,d)=>u+d,subN:(u,d)=>u-d,mulN:(u,d)=>u*d,inv:u=>gi(u,n),sqrt:r.sqrt||(u=>i(c,u)),invertBatch:u=>_m(c,u),cmov:(u,d,h)=>h?d:u,toBytes:u=>e?pi(u,s):or(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return e?li(u):Rn(u)}});return Object.freeze(c)}function Ff(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 Ac(n){let t=Ff(n);return t+Math.ceil(t/2)}function Hf(n,t,e=!1){let r=n.length,o=Ff(t),s=Ac(t);if(r<16||r<s||r>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);let i=e?Rn(n):li(n),c=At(i,t-et)+et;return e?pi(c,o):or(c,o)}var Sm=BigInt(0),xc=BigInt(1);function $f(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>Sm;)s&xc&&(i=i.add(c)),c=c.double(),s>>=xc;return i},precomputeWindow(o,s){let{windows:i,windowSize:c}=r(s),u=[],d=o,h=d;for(let g=0;g<i;g++){h=d,u.push(h);for(let T=1;T<c;T++)h=h.add(d),u.push(h);d=h.double()}return u},wNAF(o,s,i){let{windows:c,windowSize:u}=r(o),d=n.ZERO,h=n.BASE,g=BigInt(2**o-1),T=2**o,S=BigInt(o);for(let b=0;b<c;b++){let y=b*u,w=Number(i&g);i>>=S,w>u&&(w-=T,i+=xc);let v=y,k=y+Math.abs(w)-1,P=b%2!==0,$=w<0;w===0?h=h.add(e(P,s[v])):d=d.add(e($,s[k]))}return{p:d,f:h}},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 bc(n){return hc(n.Fp),sr(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...yc(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}function vm(n){let t=bc(n);sr(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:Cm,hexToBytes:Um}=gc,zr={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(n){let{Err:t}=zr;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:Cm(r),l:n.subarray(e+2)}},toSig(n){let{Err:t}=zr,e=typeof n=="string"?Um(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}=zr._parseInt(e.subarray(2)),{d:i,l:c}=zr._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 h=d.toString(16);return h.length&1?`0${h}`:h},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}`}},On=BigInt(0),Ht=BigInt(1),Gx=BigInt(2),Vf=BigInt(3),Lx=BigInt(4);function Im(n){let t=vm(n),{Fp:e}=t,r=t.toBytes||((b,y,w)=>{let v=y.toAffine();return mo(Uint8Array.from([4]),e.toBytes(v.x),e.toBytes(v.y))}),o=t.fromBytes||(b=>{let y=b.subarray(1),w=e.fromBytes(y.subarray(0,e.BYTES)),v=e.fromBytes(y.subarray(e.BYTES,2*e.BYTES));return{x:w,y:v}});function s(b){let{a:y,b:w}=t,v=e.sqr(b),k=e.mul(v,b);return e.add(e.add(k,e.mul(b,y)),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"&&On<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:y,nByteLength:w,wrapPrivateKey:v,n:k}=t;if(y&&typeof b!="bigint"){if(b instanceof Uint8Array&&(b=Or(b)),typeof b!="string"||!y.includes(b.length))throw new Error("Invalid key");b=b.padStart(w*2,"0")}let P;try{P=typeof b=="bigint"?b:Rn(Rt("private key",b,w))}catch{throw new Error(`private key must be ${w} bytes, hex or bigint, not ${typeof b}`)}return v&&(P=At(P,k)),c(P),P}let d=new Map;function h(b){if(!(b instanceof g))throw new Error("ProjectivePoint expected")}class g{constructor(y,w,v){if(this.px=y,this.py=w,this.pz=v,y==null||!e.isValid(y))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(y){let{x:w,y:v}=y||{};if(!y||!e.isValid(w)||!e.isValid(v))throw new Error("invalid affine point");if(y 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(y){let w=e.invertBatch(y.map(v=>v.pz));return y.map((v,k)=>v.toAffine(w[k])).map(g.fromAffine)}static fromHex(y){let w=g.fromAffine(o(Rt("pointHex",y)));return w.assertValidity(),w}static fromPrivateKey(y){return g.BASE.multiply(u(y))}_setWindowSize(y){this._WINDOW_SIZE=y,d.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:y,y:w}=this.toAffine();if(!e.isValid(y)||!e.isValid(w))throw new Error("bad point: x or y not FE");let v=e.sqr(w),k=s(y);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}=this.toAffine();if(e.isOdd)return!e.isOdd(y);throw new Error("Field doesn't support isOdd")}equals(y){h(y);let{px:w,py:v,pz:k}=this,{px:P,py:$,pz:M}=y,z=e.eql(e.mul(w,M),e.mul(P,k)),L=e.eql(e.mul(v,M),e.mul($,k));return z&&L}negate(){return new g(this.px,e.neg(this.py),this.pz)}double(){let{a:y,b:w}=t,v=e.mul(w,Vf),{px:k,py:P,pz:$}=this,M=e.ZERO,z=e.ZERO,L=e.ZERO,K=e.mul(k,k),we=e.mul(P,P),te=e.mul($,$),Q=e.mul(k,P);return Q=e.add(Q,Q),L=e.mul(k,$),L=e.add(L,L),M=e.mul(y,L),z=e.mul(v,te),z=e.add(M,z),M=e.sub(we,z),z=e.add(we,z),z=e.mul(M,z),M=e.mul(Q,M),L=e.mul(v,L),te=e.mul(y,te),Q=e.sub(K,te),Q=e.mul(y,Q),Q=e.add(Q,L),L=e.add(K,K),K=e.add(L,K),K=e.add(K,te),K=e.mul(K,Q),z=e.add(z,K),te=e.mul(P,$),te=e.add(te,te),K=e.mul(te,Q),M=e.sub(M,K),L=e.mul(te,we),L=e.add(L,L),L=e.add(L,L),new g(M,z,L)}add(y){h(y);let{px:w,py:v,pz:k}=this,{px:P,py:$,pz:M}=y,z=e.ZERO,L=e.ZERO,K=e.ZERO,we=t.a,te=e.mul(t.b,Vf),Q=e.mul(w,P),ve=e.mul(v,$),Ce=e.mul(k,M),Ve=e.add(w,v),_=e.add(P,$);Ve=e.mul(Ve,_),_=e.add(Q,ve),Ve=e.sub(Ve,_),_=e.add(w,k);let B=e.add(P,M);return _=e.mul(_,B),B=e.add(Q,Ce),_=e.sub(_,B),B=e.add(v,k),z=e.add($,M),B=e.mul(B,z),z=e.add(ve,Ce),B=e.sub(B,z),K=e.mul(we,_),z=e.mul(te,Ce),K=e.add(z,K),z=e.sub(ve,K),K=e.add(ve,K),L=e.mul(z,K),ve=e.add(Q,Q),ve=e.add(ve,Q),Ce=e.mul(we,Ce),_=e.mul(te,_),ve=e.add(ve,Ce),Ce=e.sub(Q,Ce),Ce=e.mul(we,Ce),_=e.add(_,Ce),Q=e.mul(ve,_),L=e.add(L,Q),Q=e.mul(B,_),z=e.mul(Ve,z),z=e.sub(z,Q),Q=e.mul(Ve,ve),K=e.mul(B,K),K=e.add(K,Q),new g(z,L,K)}subtract(y){return this.add(y.negate())}is0(){return this.equals(g.ZERO)}wNAF(y){return S.wNAFCached(this,d,y,w=>{let v=e.invertBatch(w.map(k=>k.pz));return w.map((k,P)=>k.toAffine(v[P])).map(g.fromAffine)})}multiplyUnsafe(y){let w=g.ZERO;if(y===On)return w;if(c(y),y===Ht)return this;let{endo:v}=t;if(!v)return S.unsafeLadder(this,y);let{k1neg:k,k1:P,k2neg:$,k2:M}=v.splitScalar(y),z=w,L=w,K=this;for(;P>On||M>On;)P&Ht&&(z=z.add(K)),M&Ht&&(L=L.add(K)),K=K.double(),P>>=Ht,M>>=Ht;return k&&(z=z.negate()),$&&(L=L.negate()),L=new g(e.mul(L.px,v.beta),L.py,L.pz),z.add(L)}multiply(y){c(y);let w=y,v,k,{endo:P}=t;if(P){let{k1neg:$,k1:M,k2neg:z,k2:L}=P.splitScalar(w),{p:K,f:we}=this.wNAF(M),{p:te,f:Q}=this.wNAF(L);K=S.constTimeNegate($,K),te=S.constTimeNegate(z,te),te=new g(e.mul(te.px,P.beta),te.py,te.pz),v=K.add(te),k=we.add(Q)}else{let{p:$,f:M}=this.wNAF(w);v=$,k=M}return g.normalizeZ([v,k])[0]}multiplyAndAddUnsafe(y,w,v){let k=g.BASE,P=(M,z)=>z===On||z===Ht||!M.equals(k)?M.multiplyUnsafe(z):M.multiply(z),$=P(this,w).add(P(y,v));return $.is0()?void 0:$}toAffine(y){let{px:w,py:v,pz:k}=this,P=this.is0();y==null&&(y=P?e.ONE:e.inv(k));let $=e.mul(w,y),M=e.mul(v,y),z=e.mul(k,y);if(P)return{x:e.ZERO,y:e.ZERO};if(!e.eql(z,e.ONE))throw new Error("invZ was invalid");return{x:$,y:M}}isTorsionFree(){let{h:y,isTorsionFree:w}=t;if(y===Ht)return!0;if(w)return w(g,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:y,clearCofactor:w}=t;return y===Ht?this:w?w(g,this):this.multiplyUnsafe(t.h)}toRawBytes(y=!0){return this.assertValidity(),r(g,this,y)}toHex(y=!0){return Or(this.toRawBytes(y))}}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=$f(g,t.endo?Math.ceil(T/2):T);return{CURVE:t,ProjectivePoint:g,normPrivateKeyToScalar:u,weierstrassEquation:s,isWithinCurveOrder:i}}function Bm(n){let t=bc(n);return sr(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function jf(n){let t=Bm(n),{Fp:e,n:r}=t,o=e.BYTES+1,s=2*e.BYTES+1;function i(_){return On<_&&_<e.ORDER}function c(_){return At(_,r)}function u(_){return gi(_,r)}let{ProjectivePoint:d,normPrivateKeyToScalar:h,weierstrassEquation:g,isWithinCurveOrder:T}=Im({...t,toBytes(_,B,H){let ne=B.toAffine(),re=e.toBytes(ne.x),xe=mo;return H?xe(Uint8Array.from([B.hasEvenY()?2:3]),re):xe(Uint8Array.from([4]),re,e.toBytes(ne.y))},fromBytes(_){let B=_.length,H=_[0],ne=_.subarray(1);if(B===o&&(H===2||H===3)){let re=Rn(ne);if(!i(re))throw new Error("Point is not on curve");let xe=g(re),ke=e.sqrt(xe),Te=(ke&Ht)===Ht;return(H&1)===1!==Te&&(ke=e.neg(ke)),{x:re,y:ke}}else if(B===s&&H===4){let re=e.fromBytes(ne.subarray(0,e.BYTES)),xe=e.fromBytes(ne.subarray(e.BYTES,2*e.BYTES));return{x:re,y:xe}}else throw new Error(`Point of length ${B} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`)}}),S=_=>Or(or(_,t.nByteLength));function b(_){let B=r>>Ht;return _>B}function y(_){return b(_)?c(-_):_}let w=(_,B,H)=>Rn(_.slice(B,H));class v{constructor(B,H,ne){this.r=B,this.s=H,this.recovery=ne,this.assertValidity()}static fromCompact(B){let H=t.nByteLength;return B=Rt("compactSignature",B,H*2),new v(w(B,0,H),w(B,H,2*H))}static fromDER(B){let{r:H,s:ne}=zr.toSig(Rt("DER",B));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(B){return new v(this.r,this.s,B)}recoverPublicKey(B){let{r:H,s:ne,recovery:re}=this,xe=L(Rt("msgHash",B));if(re==null||![0,1,2,3].includes(re))throw new Error("recovery id invalid");let ke=re===2||re===3?H+t.n:H;if(ke>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let Te=re&1?"03":"02",De=d.fromHex(Te+S(ke)),se=u(ke),Ke=c(-xe*se),vt=c(ne*se),ot=d.BASE.multiplyAndAddUnsafe(De,Ke,vt);if(!ot)throw new Error("point at infinify");return ot.assertValidity(),ot}hasHighS(){return b(this.s)}normalizeS(){return this.hasHighS()?new v(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return Nr(this.toDERHex())}toDERHex(){return zr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Nr(this.toCompactHex())}toCompactHex(){return S(this.r)+S(this.s)}}let k={isValidPrivateKey(_){try{return h(_),!0}catch{return!1}},normPrivateKeyToScalar:h,randomPrivateKey:()=>{let _=Ac(t.n);return Hf(t.randomBytes(_),t.n)},precompute(_=8,B=d.BASE){return B._setWindowSize(_),B.multiply(BigInt(3)),B}};function P(_,B=!0){return d.fromPrivateKey(_).toRawBytes(B)}function $(_){let B=_ instanceof Uint8Array,H=typeof _=="string",ne=(B||H)&&_.length;return B?ne===o||ne===s:H?ne===2*o||ne===2*s:_ instanceof d}function M(_,B,H=!0){if($(_))throw new Error("first arg must be private key");if(!$(B))throw new Error("second arg must be public key");return d.fromHex(B).multiply(h(_)).toRawBytes(H)}let z=t.bits2int||function(_){let B=Rn(_),H=_.length*8-t.nBitLength;return H>0?B>>BigInt(H):B},L=t.bits2int_modN||function(_){return c(z(_))},K=ts(t.nBitLength);function we(_){if(typeof _!="bigint")throw new Error("bigint expected");if(!(On<=_&&_<K))throw new Error(`bigint expected < 2^${t.nBitLength}`);return or(_,t.nByteLength)}function te(_,B,H=Q){if(["recovered","canonical"].some(st=>st in H))throw new Error("sign() legacy options not supported");let{hash:ne,randomBytes:re}=t,{lowS:xe,prehash:ke,extraEntropy:Te}=H;xe==null&&(xe=!0),_=Rt("msgHash",_),ke&&(_=Rt("prehashed msgHash",ne(_)));let De=L(_),se=h(B),Ke=[we(se),we(De)];if(Te!=null){let st=Te===!0?re(e.BYTES):Te;Ke.push(Rt("extraEntropy",st))}let vt=mo(...Ke),ot=De;function Dt(st){let pt=z(st);if(!T(pt))return;let fn=u(pt),He=d.BASE.multiply(pt).toAffine(),bt=c(He.x);if(bt===On)return;let Yt=c(fn*c(ot+bt*se));if(Yt===On)return;let xr=(He.x===bt?0:2)|Number(He.y&Ht),Hn=Yt;return xe&&b(Yt)&&(Hn=y(Yt),xr^=1),new v(bt,Hn,xr)}return{seed:vt,k2sig:Dt}}let Q={lowS:t.lowS,prehash:!1},ve={lowS:t.lowS,prehash:!1};function Ce(_,B,H=Q){let{seed:ne,k2sig:re}=te(_,B,H),xe=t;return pc(xe.hash.outputLen,xe.nByteLength,xe.hmac)(ne,re)}d.BASE._setWindowSize(8);function Ve(_,B,H,ne=ve){let re=_;if(B=Rt("msgHash",B),H=Rt("publicKey",H),"strict"in ne)throw new Error("options.strict was renamed to lowS");let{lowS:xe,prehash:ke}=ne,Te,De;try{if(typeof re=="string"||re instanceof Uint8Array)try{Te=v.fromDER(re)}catch(He){if(!(He instanceof zr.Err))throw He;Te=v.fromCompact(re)}else if(typeof re=="object"&&typeof re.r=="bigint"&&typeof re.s=="bigint"){let{r:He,s:bt}=re;Te=new v(He,bt)}else throw new Error("PARSE");De=d.fromHex(H)}catch(He){if(He.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(xe&&Te.hasHighS())return!1;ke&&(B=t.hash(B));let{r:se,s:Ke}=Te,vt=L(B),ot=u(Ke),Dt=c(vt*ot),st=c(se*ot),pt=d.BASE.multiplyAndAddUnsafe(De,Dt,st)?.toAffine();return pt?c(pt.x)===se:!1}return{CURVE:t,getPublicKey:P,getSharedSecret:M,sign:Ce,verify:Ve,ProjectivePoint:d,Signature:v,utils:k}}var mi=class extends go{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,Bf(t);let r=es(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 po(this),this.iHash.update(t),this}digestInto(t){po(this),uc(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()}},wc=(n,t,e)=>new mi(n,t).update(e).digest();wc.create=(n,t)=>new mi(n,t);function Pm(n){return{hash:n,hmac:(t,...e)=>wc(n,t,Of(...e)),randomBytes:kf}}function Wf(n,t){let e=r=>jf({...n,...Pm(r)});return Object.freeze({...e(t),create:e})}var Zf=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Qf=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Rm=BigInt(1),Tc=BigInt(2),Yf=(n,t)=>(n+t/Tc)/t;function Om(n){let t=Zf,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,h=d*d*n%t,g=Ot(h,e,t)*h%t,T=Ot(g,e,t)*h%t,S=Ot(T,Tc,t)*d%t,b=Ot(S,o,t)*S%t,y=Ot(b,s,t)*b%t,w=Ot(y,c,t)*y%t,v=Ot(w,u,t)*w%t,k=Ot(v,c,t)*y%t,P=Ot(k,e,t)*h%t,$=Ot(P,i,t)*b%t,M=Ot($,r,t)*d%t,z=Ot(M,Tc,t);if(!_c.eql(_c.sqr(z),n))throw new Error("Cannot find square root");return z}var _c=Kf(Zf,void 0,void 0,{sqrt:Om}),ho=Wf({a:BigInt(0),b:BigInt(7),Fp:_c,n:Qf,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{let t=Qf,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Rm*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,i=BigInt("0x100000000000000000000000000000000"),c=Yf(s*n,t),u=Yf(-r*n,t),d=At(n-c*e-u*o,t),h=At(-c*r-u*s,t),g=d>i,T=h>i;if(g&&(d=t-d),T&&(h=t-h),d>i||h>i)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:g,k1:d,k2neg:T,k2:h}}}},zf),Xx=BigInt(0);var Jx=ho.ProjectivePoint;var Nm=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Jf=Uint8Array.from({length:16},(n,t)=>t),km=Jf.map(n=>(9*n+5)%16),Sc=[Jf],vc=[km];for(let n=0;n<4;n++)for(let t of[Sc,vc])t.push(t[n].map(e=>Nm[e]));var ed=[[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=Sc.map((n,t)=>n.map(e=>ed[t][e])),Dm=vc.map((n,t)=>n.map(e=>ed[t][e])),Mm=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Gm=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),hi=(n,t)=>n<<t|n>>>32-t;function Xf(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 yi=new Uint32Array(16),Ec=class extends Qn{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)yi[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,h=d,g=this.h4|0,T=g;for(let S=0;S<5;S++){let b=4-S,y=Mm[S],w=Gm[S],v=Sc[S],k=vc[S],P=zm[S],$=Dm[S];for(let M=0;M<16;M++){let z=hi(r+Xf(S,s,c,d)+yi[v[M]]+y,P[M])+g|0;r=g,g=d,d=hi(c,10)|0,c=s,s=z}for(let M=0;M<16;M++){let z=hi(o+Xf(b,i,u,h)+yi[k[M]]+w,$[M])+T|0;o=T,T=h,h=hi(u,10)|0,u=i,i=z}}this.set(this.h1+c+h|0,this.h2+d+T|0,this.h3+g+o|0,this.h4+r+i|0,this.h0+s+u|0)}roundClean(){yi.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}},td=Vn(()=>new Ec);var Bc={};Ks(Bc,{bitGet:()=>Vm,bitLen:()=>$m,bitMask:()=>ns,bitSet:()=>jm,bytesToHex:()=>Dr,bytesToNumberBE:()=>kn,bytesToNumberLE:()=>xi,concatBytes:()=>yo,createHmacDrbg:()=>Ic,ensureBytes:()=>Nt,equalBytes:()=>Fm,hexToBytes:()=>Mr,hexToNumber:()=>Uc,isBytes:()=>on,numberToBytesBE:()=>ir,numberToBytesLE:()=>bi,numberToHexUnpadded:()=>sd,numberToVarBytesBE:()=>Km,utf8ToBytes:()=>Hm,validateObject:()=>ar});var od=BigInt(0),Ai=BigInt(1),Lm=BigInt(2);function on(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 Dr(n){if(!on(n))throw new Error("Uint8Array expected");let t="";for(let e=0;e<n.length;e++)t+=qm[n[e]];return t}function sd(n){let t=n.toString(16);return t.length&1?`0${t}`:t}function Uc(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return BigInt(n===""?"0":`0x${n}`)}var Nn={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function nd(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 Mr(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=nd(n.charCodeAt(s)),c=nd(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 kn(n){return Uc(Dr(n))}function xi(n){if(!on(n))throw new Error("Uint8Array expected");return Uc(Dr(Uint8Array.from(n).reverse()))}function ir(n,t){return Mr(n.toString(16).padStart(t*2,"0"))}function bi(n,t){return ir(n,t).reverse()}function Km(n){return Mr(sd(n))}function Nt(n,t,e){let r;if(typeof t=="string")try{r=Mr(t)}catch(s){throw new Error(`${n} must be valid hex string, got "${t}". Cause: ${s}`)}else if(on(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 yo(...n){let t=0;for(let o=0;o<n.length;o++){let s=n[o];if(!on(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 Fm(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 Hm(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function $m(n){let t;for(t=0;n>od;n>>=Ai,t+=1);return t}function Vm(n,t){return n>>BigInt(t)&Ai}var jm=(n,t,e)=>n|(e?Ai:od)<<BigInt(t),ns=n=>(Lm<<BigInt(n-1))-Ai,Cc=n=>new Uint8Array(n),rd=n=>Uint8Array.from(n);function Ic(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=Cc(n),o=Cc(n),s=0,i=()=>{r.fill(1),o.fill(0),s=0},c=(...g)=>e(o,r,...g),u=(g=Cc())=>{o=c(rd([0]),g),r=c(),g.length!==0&&(o=c(rd([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 yo(...T)};return(g,T)=>{i(),u(g);let S;for(;!(S=T(d()));)u();return i(),S}}var Wm={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"||on(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 ar(n,t,e={}){let r=(o,s,i)=>{let c=Wm[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 ut=BigInt(0),tt=BigInt(1),Gr=BigInt(2),Qm=BigInt(3),Pc=BigInt(4),id=BigInt(5),ad=BigInt(8),Ym=BigInt(9),Zm=BigInt(16);function dt(n,t){let e=n%t;return e>=ut?e:t+e}function Xm(n,t,e){if(e<=ut||t<ut)throw new Error("Expected power/modulo > 0");if(e===tt)return ut;let r=tt;for(;t>ut;)t&tt&&(r=r*n%e),n=n*n%e,t>>=tt;return r}function kt(n,t,e){let r=n;for(;t-- >ut;)r*=r,r%=e;return r}function wi(n,t){if(n===ut||t<=ut)throw new Error(`invert: expected positive integers, got n=${n} mod=${t}`);let e=dt(n,t),r=t,o=ut,s=tt,i=tt,c=ut;for(;e!==ut;){let d=r/e,h=r%e,g=o-i*d,T=s-c*d;r=e,e=h,o=i,s=c,i=g,c=T}if(r!==tt)throw new Error("invert: does not exist");return dt(o,t)}function Jm(n){let t=(n-tt)/Gr,e,r,o;for(e=n-tt,r=0;e%Gr===ut;e/=Gr,r++);for(o=Gr;o<n&&Xm(o,t,n)!==n-tt;o++);if(r===1){let i=(n+tt)/Pc;return function(u,d){let h=u.pow(d,i);if(!u.eql(u.sqr(h),d))throw new Error("Cannot find square root");return h}}let s=(e+tt)/Gr;return function(c,u){if(c.pow(u,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let d=r,h=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 y=c.sqr(T);S<d&&!c.eql(y,c.ONE);S++)y=c.sqr(y);let b=c.pow(h,tt<<BigInt(d-S-1));h=c.sqr(b),g=c.mul(g,b),T=c.mul(T,h),d=S}return g}}function eh(n){if(n%Pc===Qm){let t=(n+tt)/Pc;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%ad===id){let t=(n-id)/ad;return function(r,o){let s=r.mul(o,Gr),i=r.pow(s,t),c=r.mul(o,i),u=r.mul(r.mul(c,Gr),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%Zm,Jm(n)}var th=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Rc(n){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=th.reduce((r,o)=>(r[o]="function",r),t);return ar(n,e)}function nh(n,t,e){if(e<ut)throw new Error("Expected power > 0");if(e===ut)return n.ONE;if(e===tt)return t;let r=n.ONE,o=t;for(;e>ut;)e&tt&&(r=n.mul(r,o)),o=n.sqr(o),e>>=tt;return r}function rh(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 Oc(n,t){let e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function cd(n,t,e=!1,r={}){if(n<=ut)throw new Error(`Expected Field ORDER > 0, got ${n}`);let{nBitLength:o,nByteLength:s}=Oc(n,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let i=eh(n),c=Object.freeze({ORDER:n,BITS:o,BYTES:s,MASK:ns(o),ZERO:ut,ONE:tt,create:u=>dt(u,n),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return ut<=u&&u<n},is0:u=>u===ut,isOdd:u=>(u&tt)===tt,neg:u=>dt(-u,n),eql:(u,d)=>u===d,sqr:u=>dt(u*u,n),add:(u,d)=>dt(u+d,n),sub:(u,d)=>dt(u-d,n),mul:(u,d)=>dt(u*d,n),pow:(u,d)=>nh(c,u,d),div:(u,d)=>dt(u*wi(d,n),n),sqrN:u=>u*u,addN:(u,d)=>u+d,subN:(u,d)=>u-d,mulN:(u,d)=>u*d,inv:u=>wi(u,n),sqrt:r.sqrt||(u=>i(c,u)),invertBatch:u=>rh(c,u),cmov:(u,d,h)=>h?d:u,toBytes:u=>e?bi(u,s):ir(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return e?xi(u):kn(u)}});return Object.freeze(c)}function ud(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 Nc(n){let t=ud(n);return t+Math.ceil(t/2)}function fd(n,t,e=!1){let r=n.length,o=ud(t),s=Nc(t);if(r<16||r<s||r>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);let i=e?kn(n):xi(n),c=dt(i,t-tt)+tt;return e?bi(c,o):ir(c,o)}var sh=BigInt(0),kc=BigInt(1);function dd(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>sh;)s&kc&&(i=i.add(c)),c=c.double(),s>>=kc;return i},precomputeWindow(o,s){let{windows:i,windowSize:c}=r(s),u=[],d=o,h=d;for(let g=0;g<i;g++){h=d,u.push(h);for(let T=1;T<c;T++)h=h.add(d),u.push(h);d=h.double()}return u},wNAF(o,s,i){let{windows:c,windowSize:u}=r(o),d=n.ZERO,h=n.BASE,g=BigInt(2**o-1),T=2**o,S=BigInt(o);for(let b=0;b<c;b++){let y=b*u,w=Number(i&g);i>>=S,w>u&&(w-=T,i+=kc);let v=y,k=y+Math.abs(w)-1,P=b%2!==0,$=w<0;w===0?h=h.add(e(P,s[v])):d=d.add(e($,s[k]))}return{p:d,f:h}},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 zc(n){return Rc(n.Fp),ar(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Oc(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}function ih(n){let t=zc(n);ar(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:ah,hexToBytes:ch}=Bc,Lr={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(n){let{Err:t}=Lr;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:ah(r),l:n.subarray(e+2)}},toSig(n){let{Err:t}=Lr,e=typeof n=="string"?ch(n):n;if(!on(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}=Lr._parseInt(e.subarray(2)),{d:i,l:c}=Lr._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 h=d.toString(16);return h.length&1?`0${h}`:h},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}`}},zn=BigInt(0),$t=BigInt(1),db=BigInt(2),ld=BigInt(3),lb=BigInt(4);function uh(n){let t=ih(n),{Fp:e}=t,r=t.toBytes||((b,y,w)=>{let v=y.toAffine();return yo(Uint8Array.from([4]),e.toBytes(v.x),e.toBytes(v.y))}),o=t.fromBytes||(b=>{let y=b.subarray(1),w=e.fromBytes(y.subarray(0,e.BYTES)),v=e.fromBytes(y.subarray(e.BYTES,2*e.BYTES));return{x:w,y:v}});function s(b){let{a:y,b:w}=t,v=e.sqr(b),k=e.mul(v,b);return e.add(e.add(k,e.mul(b,y)),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"&&zn<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:y,nByteLength:w,wrapPrivateKey:v,n:k}=t;if(y&&typeof b!="bigint"){if(on(b)&&(b=Dr(b)),typeof b!="string"||!y.includes(b.length))throw new Error("Invalid key");b=b.padStart(w*2,"0")}let P;try{P=typeof b=="bigint"?b:kn(Nt("private key",b,w))}catch{throw new Error(`private key must be ${w} bytes, hex or bigint, not ${typeof b}`)}return v&&(P=dt(P,k)),c(P),P}let d=new Map;function h(b){if(!(b instanceof g))throw new Error("ProjectivePoint expected")}class g{constructor(y,w,v){if(this.px=y,this.py=w,this.pz=v,y==null||!e.isValid(y))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(y){let{x:w,y:v}=y||{};if(!y||!e.isValid(w)||!e.isValid(v))throw new Error("invalid affine point");if(y 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(y){let w=e.invertBatch(y.map(v=>v.pz));return y.map((v,k)=>v.toAffine(w[k])).map(g.fromAffine)}static fromHex(y){let w=g.fromAffine(o(Nt("pointHex",y)));return w.assertValidity(),w}static fromPrivateKey(y){return g.BASE.multiply(u(y))}_setWindowSize(y){this._WINDOW_SIZE=y,d.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:y,y:w}=this.toAffine();if(!e.isValid(y)||!e.isValid(w))throw new Error("bad point: x or y not FE");let v=e.sqr(w),k=s(y);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}=this.toAffine();if(e.isOdd)return!e.isOdd(y);throw new Error("Field doesn't support isOdd")}equals(y){h(y);let{px:w,py:v,pz:k}=this,{px:P,py:$,pz:M}=y,z=e.eql(e.mul(w,M),e.mul(P,k)),L=e.eql(e.mul(v,M),e.mul($,k));return z&&L}negate(){return new g(this.px,e.neg(this.py),this.pz)}double(){let{a:y,b:w}=t,v=e.mul(w,ld),{px:k,py:P,pz:$}=this,M=e.ZERO,z=e.ZERO,L=e.ZERO,K=e.mul(k,k),we=e.mul(P,P),te=e.mul($,$),Q=e.mul(k,P);return Q=e.add(Q,Q),L=e.mul(k,$),L=e.add(L,L),M=e.mul(y,L),z=e.mul(v,te),z=e.add(M,z),M=e.sub(we,z),z=e.add(we,z),z=e.mul(M,z),M=e.mul(Q,M),L=e.mul(v,L),te=e.mul(y,te),Q=e.sub(K,te),Q=e.mul(y,Q),Q=e.add(Q,L),L=e.add(K,K),K=e.add(L,K),K=e.add(K,te),K=e.mul(K,Q),z=e.add(z,K),te=e.mul(P,$),te=e.add(te,te),K=e.mul(te,Q),M=e.sub(M,K),L=e.mul(te,we),L=e.add(L,L),L=e.add(L,L),new g(M,z,L)}add(y){h(y);let{px:w,py:v,pz:k}=this,{px:P,py:$,pz:M}=y,z=e.ZERO,L=e.ZERO,K=e.ZERO,we=t.a,te=e.mul(t.b,ld),Q=e.mul(w,P),ve=e.mul(v,$),Ce=e.mul(k,M),Ve=e.add(w,v),_=e.add(P,$);Ve=e.mul(Ve,_),_=e.add(Q,ve),Ve=e.sub(Ve,_),_=e.add(w,k);let B=e.add(P,M);return _=e.mul(_,B),B=e.add(Q,Ce),_=e.sub(_,B),B=e.add(v,k),z=e.add($,M),B=e.mul(B,z),z=e.add(ve,Ce),B=e.sub(B,z),K=e.mul(we,_),z=e.mul(te,Ce),K=e.add(z,K),z=e.sub(ve,K),K=e.add(ve,K),L=e.mul(z,K),ve=e.add(Q,Q),ve=e.add(ve,Q),Ce=e.mul(we,Ce),_=e.mul(te,_),ve=e.add(ve,Ce),Ce=e.sub(Q,Ce),Ce=e.mul(we,Ce),_=e.add(_,Ce),Q=e.mul(ve,_),L=e.add(L,Q),Q=e.mul(B,_),z=e.mul(Ve,z),z=e.sub(z,Q),Q=e.mul(Ve,ve),K=e.mul(B,K),K=e.add(K,Q),new g(z,L,K)}subtract(y){return this.add(y.negate())}is0(){return this.equals(g.ZERO)}wNAF(y){return S.wNAFCached(this,d,y,w=>{let v=e.invertBatch(w.map(k=>k.pz));return w.map((k,P)=>k.toAffine(v[P])).map(g.fromAffine)})}multiplyUnsafe(y){let w=g.ZERO;if(y===zn)return w;if(c(y),y===$t)return this;let{endo:v}=t;if(!v)return S.unsafeLadder(this,y);let{k1neg:k,k1:P,k2neg:$,k2:M}=v.splitScalar(y),z=w,L=w,K=this;for(;P>zn||M>zn;)P&$t&&(z=z.add(K)),M&$t&&(L=L.add(K)),K=K.double(),P>>=$t,M>>=$t;return k&&(z=z.negate()),$&&(L=L.negate()),L=new g(e.mul(L.px,v.beta),L.py,L.pz),z.add(L)}multiply(y){c(y);let w=y,v,k,{endo:P}=t;if(P){let{k1neg:$,k1:M,k2neg:z,k2:L}=P.splitScalar(w),{p:K,f:we}=this.wNAF(M),{p:te,f:Q}=this.wNAF(L);K=S.constTimeNegate($,K),te=S.constTimeNegate(z,te),te=new g(e.mul(te.px,P.beta),te.py,te.pz),v=K.add(te),k=we.add(Q)}else{let{p:$,f:M}=this.wNAF(w);v=$,k=M}return g.normalizeZ([v,k])[0]}multiplyAndAddUnsafe(y,w,v){let k=g.BASE,P=(M,z)=>z===zn||z===$t||!M.equals(k)?M.multiplyUnsafe(z):M.multiply(z),$=P(this,w).add(P(y,v));return $.is0()?void 0:$}toAffine(y){let{px:w,py:v,pz:k}=this,P=this.is0();y==null&&(y=P?e.ONE:e.inv(k));let $=e.mul(w,y),M=e.mul(v,y),z=e.mul(k,y);if(P)return{x:e.ZERO,y:e.ZERO};if(!e.eql(z,e.ONE))throw new Error("invZ was invalid");return{x:$,y:M}}isTorsionFree(){let{h:y,isTorsionFree:w}=t;if(y===$t)return!0;if(w)return w(g,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:y,clearCofactor:w}=t;return y===$t?this:w?w(g,this):this.multiplyUnsafe(t.h)}toRawBytes(y=!0){return this.assertValidity(),r(g,this,y)}toHex(y=!0){return Dr(this.toRawBytes(y))}}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=dd(g,t.endo?Math.ceil(T/2):T);return{CURVE:t,ProjectivePoint:g,normPrivateKeyToScalar:u,weierstrassEquation:s,isWithinCurveOrder:i}}function fh(n){let t=zc(n);return ar(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function pd(n){let t=fh(n),{Fp:e,n:r}=t,o=e.BYTES+1,s=2*e.BYTES+1;function i(_){return zn<_&&_<e.ORDER}function c(_){return dt(_,r)}function u(_){return wi(_,r)}let{ProjectivePoint:d,normPrivateKeyToScalar:h,weierstrassEquation:g,isWithinCurveOrder:T}=uh({...t,toBytes(_,B,H){let ne=B.toAffine(),re=e.toBytes(ne.x),xe=yo;return H?xe(Uint8Array.from([B.hasEvenY()?2:3]),re):xe(Uint8Array.from([4]),re,e.toBytes(ne.y))},fromBytes(_){let B=_.length,H=_[0],ne=_.subarray(1);if(B===o&&(H===2||H===3)){let re=kn(ne);if(!i(re))throw new Error("Point is not on curve");let xe=g(re),ke=e.sqrt(xe),Te=(ke&$t)===$t;return(H&1)===1!==Te&&(ke=e.neg(ke)),{x:re,y:ke}}else if(B===s&&H===4){let re=e.fromBytes(ne.subarray(0,e.BYTES)),xe=e.fromBytes(ne.subarray(e.BYTES,2*e.BYTES));return{x:re,y:xe}}else throw new Error(`Point of length ${B} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`)}}),S=_=>Dr(ir(_,t.nByteLength));function b(_){let B=r>>$t;return _>B}function y(_){return b(_)?c(-_):_}let w=(_,B,H)=>kn(_.slice(B,H));class v{constructor(B,H,ne){this.r=B,this.s=H,this.recovery=ne,this.assertValidity()}static fromCompact(B){let H=t.nByteLength;return B=Nt("compactSignature",B,H*2),new v(w(B,0,H),w(B,H,2*H))}static fromDER(B){let{r:H,s:ne}=Lr.toSig(Nt("DER",B));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(B){return new v(this.r,this.s,B)}recoverPublicKey(B){let{r:H,s:ne,recovery:re}=this,xe=L(Nt("msgHash",B));if(re==null||![0,1,2,3].includes(re))throw new Error("recovery id invalid");let ke=re===2||re===3?H+t.n:H;if(ke>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let Te=re&1?"03":"02",De=d.fromHex(Te+S(ke)),se=u(ke),Ke=c(-xe*se),vt=c(ne*se),ot=d.BASE.multiplyAndAddUnsafe(De,Ke,vt);if(!ot)throw new Error("point at infinify");return ot.assertValidity(),ot}hasHighS(){return b(this.s)}normalizeS(){return this.hasHighS()?new v(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return Mr(this.toDERHex())}toDERHex(){return Lr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Mr(this.toCompactHex())}toCompactHex(){return S(this.r)+S(this.s)}}let k={isValidPrivateKey(_){try{return h(_),!0}catch{return!1}},normPrivateKeyToScalar:h,randomPrivateKey:()=>{let _=Nc(t.n);return fd(t.randomBytes(_),t.n)},precompute(_=8,B=d.BASE){return B._setWindowSize(_),B.multiply(BigInt(3)),B}};function P(_,B=!0){return d.fromPrivateKey(_).toRawBytes(B)}function $(_){let B=on(_),H=typeof _=="string",ne=(B||H)&&_.length;return B?ne===o||ne===s:H?ne===2*o||ne===2*s:_ instanceof d}function M(_,B,H=!0){if($(_))throw new Error("first arg must be private key");if(!$(B))throw new Error("second arg must be public key");return d.fromHex(B).multiply(h(_)).toRawBytes(H)}let z=t.bits2int||function(_){let B=kn(_),H=_.length*8-t.nBitLength;return H>0?B>>BigInt(H):B},L=t.bits2int_modN||function(_){return c(z(_))},K=ns(t.nBitLength);function we(_){if(typeof _!="bigint")throw new Error("bigint expected");if(!(zn<=_&&_<K))throw new Error(`bigint expected < 2^${t.nBitLength}`);return ir(_,t.nByteLength)}function te(_,B,H=Q){if(["recovered","canonical"].some(st=>st in H))throw new Error("sign() legacy options not supported");let{hash:ne,randomBytes:re}=t,{lowS:xe,prehash:ke,extraEntropy:Te}=H;xe==null&&(xe=!0),_=Nt("msgHash",_),ke&&(_=Nt("prehashed msgHash",ne(_)));let De=L(_),se=h(B),Ke=[we(se),we(De)];if(Te!=null){let st=Te===!0?re(e.BYTES):Te;Ke.push(Nt("extraEntropy",st))}let vt=yo(...Ke),ot=De;function Dt(st){let pt=z(st);if(!T(pt))return;let fn=u(pt),He=d.BASE.multiply(pt).toAffine(),bt=c(He.x);if(bt===zn)return;let Yt=c(fn*c(ot+bt*se));if(Yt===zn)return;let xr=(He.x===bt?0:2)|Number(He.y&$t),Hn=Yt;return xe&&b(Yt)&&(Hn=y(Yt),xr^=1),new v(bt,Hn,xr)}return{seed:vt,k2sig:Dt}}let Q={lowS:t.lowS,prehash:!1},ve={lowS:t.lowS,prehash:!1};function Ce(_,B,H=Q){let{seed:ne,k2sig:re}=te(_,B,H),xe=t;return Ic(xe.hash.outputLen,xe.nByteLength,xe.hmac)(ne,re)}d.BASE._setWindowSize(8);function Ve(_,B,H,ne=ve){let re=_;if(B=Nt("msgHash",B),H=Nt("publicKey",H),"strict"in ne)throw new Error("options.strict was renamed to lowS");let{lowS:xe,prehash:ke}=ne,Te,De;try{if(typeof re=="string"||on(re))try{Te=v.fromDER(re)}catch(He){if(!(He instanceof Lr.Err))throw He;Te=v.fromCompact(re)}else if(typeof re=="object"&&typeof re.r=="bigint"&&typeof re.s=="bigint"){let{r:He,s:bt}=re;Te=new v(He,bt)}else throw new Error("PARSE");De=d.fromHex(H)}catch(He){if(He.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(xe&&Te.hasHighS())return!1;ke&&(B=t.hash(B));let{r:se,s:Ke}=Te,vt=L(B),ot=u(Ke),Dt=c(vt*ot),st=c(se*ot),pt=d.BASE.multiplyAndAddUnsafe(De,Dt,st)?.toAffine();return pt?c(pt.x)===se:!1}return{CURVE:t,getPublicKey:P,getSharedSecret:M,sign:Ce,verify:Ve,ProjectivePoint:d,Signature:v,utils:k}}function dh(n){return{hash:n,hmac:(t,...e)=>pn(n,t,vr(...e)),randomBytes:ff}}function gd(n,t){let e=r=>pd({...n,...dh(r)});return Object.freeze({...e(t),create:e})}var yd=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),md=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),lh=BigInt(1),Dc=BigInt(2),hd=(n,t)=>(n+t/Dc)/t;function ph(n){let t=yd,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,h=d*d*n%t,g=kt(h,e,t)*h%t,T=kt(g,e,t)*h%t,S=kt(T,Dc,t)*d%t,b=kt(S,o,t)*S%t,y=kt(b,s,t)*b%t,w=kt(y,c,t)*y%t,v=kt(w,u,t)*w%t,k=kt(v,c,t)*y%t,P=kt(k,e,t)*h%t,$=kt(P,i,t)*b%t,M=kt($,r,t)*d%t,z=kt(M,Dc,t);if(!Mc.eql(Mc.sqr(z),n))throw new Error("Cannot find square root");return z}var Mc=cd(yd,void 0,void 0,{sqrt:ph}),sn=gd({a:BigInt(0),b:BigInt(7),Fp:Mc,n:md,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{let t=md,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-lh*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,i=BigInt("0x100000000000000000000000000000000"),c=hd(s*n,t),u=hd(-r*n,t),d=dt(n-c*e-u*o,t),h=dt(-c*r-u*s,t),g=d>i,T=h>i;if(g&&(d=t-d),T&&(h=t-h),d>i||h>i)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:g,k1:d,k2neg:T,k2:h}}}},Zo),wb=BigInt(0);var Tb=sn.ProjectivePoint;function Ti(n){if(!Number.isSafeInteger(n))throw new Error(`Wrong integer: ${n}`)}function Gc(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}function xd(...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 gh(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 mh(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 Ad(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],h=t*i+d;if(!Number.isSafeInteger(h)||t*i/t!==i||h-d!==t*i)throw new Error("convertRadix: carry overflow");i=h%e;let g=Math.floor(h/e);if(s[u]=g,!Number.isSafeInteger(g)||g*e+i!==h)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 hh(n){return{encode:t=>{if(!Gc(t))throw new Error("radix.encode input should be Uint8Array");return Ad(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(Ad(t,n,2**8))}}}function yh(n,t){if(typeof t!="function")throw new Error("checksum fn should be function");return{encode(e){if(!Gc(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(!Gc(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 Ah=n=>xd(hh(58),gh(n),mh("")),xh=Ah("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var bd=n=>xd(yh(4,t=>n(n(t))),xh);var _i=sn.ProjectivePoint,Lc=bd(Zo);function wd(n){return BigInt(`0x${Sr(n)}`)}function bh(n){return lo(n.toString(16).padStart(64,"0"))}var wh=Wa("Bitcoin seed"),qc={private:76066276,public:76067358},Kc=2147483648,Th=n=>td(Zo(n)),_h=n=>ln(n).getUint32(0,!1),Ei=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 ln(t).setUint32(0,n,!1),t},Si=class n{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return _h(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 Lc.encode(this.serialize(this.versions.private,vr(new Uint8Array([0]),t)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return Lc.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(t,e=qc){if(en(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=pn(Pr,wh,t);return new n({versions:e,chainCode:r.slice(32),privateKey:r.slice(0,32)})}static fromExtendedKey(t,e=qc){let r=Lc.decode(t),o=ln(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||qc,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(!sn.utils.isValidPrivateKey(t.privateKey))throw new Error("Invalid private key");this.privKey=typeof t.privateKey=="bigint"?t.privateKey:wd(t.privateKey),this.privKeyBytes=bh(this.privKey),this.pubKey=sn.getPublicKey(t.privateKey,!0)}else if(t.publicKey)this.pubKey=_i.fromHex(t.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=Th(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>=Kc)throw new Error("Invalid index");s[2]==="'"&&(c+=Kc),r=r.deriveChild(c)}return r}deriveChild(t){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let e=Ei(t);if(t>=Kc){let c=this.privateKey;if(!c)throw new Error("Could not derive hardened child key");e=vr(new Uint8Array([0]),c,e)}else e=vr(this.pubKey,e);let r=pn(Pr,this.chainCode,e),o=wd(r.slice(0,32)),s=r.slice(32);if(!sn.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=dt(this.privKey+o,sn.CURVE.n);if(!sn.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=_i.fromHex(this.pubKey).add(_i.fromPrivateKey(o));if(c.equals(_i.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 en(t,32),sn.sign(t,this.privKey).toCompactRawBytes()}verify(t,e){if(en(t,32),en(e,64),!this.publicKey)throw new Error("No publicKey set!");let r;try{r=sn.Signature.fromCompact(e)}catch{return!1}return sn.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 en(e,33),vr(Ei(t),new Uint8Array([this.depth]),Ei(this.parentFingerprint),Ei(this.index),this.chainCode,e)}};var cr=class cr extends Pt{constructor(e){super();let r=Be.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=Be.fromHexInput(r).toUint8Array(),i=Ir(s),c=o.toUint8Array();return ho.verify(c,i,this.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=65;var Vt=cr,gn=class gn extends Br{constructor(e){super();let r=Be.fromHexInput(e);if(r.toUint8Array().length!==gn.LENGTH)throw new Error(`PrivateKey length should be ${gn.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}sign(e){let r=Be.fromHexInput(e),o=Ir(r.toUint8Array()),s=ho.sign(o,this.key.toUint8Array());return new Mn(s.toCompactRawBytes())}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new gn(r)}static generate(){let e=ho.utils.randomPrivateKey();return new gn(e)}publicKey(){let e=ho.getPublicKey(this.key.toUint8Array(),!1);return new Vt(e)}static fromDerivationPath(e,r){if(!sc(e))throw new Error(`Invalid derivation path ${e}`);return gn.fromDerivationPathInner(e,Xo(r))}static fromDerivationPathInner(e,r){let{privateKey:o}=Si.fromMasterSeed(r).derive(e);if(o===null)throw new Error("Invalid key");return new gn(o)}static isPrivateKey(e){return e instanceof gn}};gn.LENGTH=32;var Dn=gn,ur=class ur extends tn{constructor(e){super();let r=Be.fromHexInput(e);if(r.toUint8Array().length!==ur.LENGTH)throw new Error(`Signature length should be ${ur.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 ur(r)}static load(e){let r=e.deserializeBytes();return new ur(r)}static isSignature(e){return e instanceof ur}};ur.LENGTH=64;var Mn=ur;var je=class n extends Pt{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 qe)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else if(this.publicKey instanceof Vt)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(qe.load(e));case 1:return new n(Vt.load(e));default:throw new Error(`Unknown variant index for AnyPublicKey: ${r}`)}}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof qe}isSecp256k1PublicKey(){return this.publicKey instanceof Vt}};var qr=class n extends Pt{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 je?s.push(i):s.push(new je(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),h=s[d];h|=o>>c%8,s[d]=h}),s}toString(){return Be.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(je),o=e.deserializeU8();return new n({publicKeys:r,signaturesRequired:o})}};var Gn=class Gn extends ae{constructor(e){super();let{data:r}=e,o=Be.fromHexInput(r);if(o.toUint8Array().length!==Gn.LENGTH)throw new Error(`Authentication Key length should be ${Gn.LENGTH}`);this.data=o}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeFixedBytes(Gn.LENGTH);return new Gn({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=Be.fromHexInput(u).toUint8Array();s=new Uint8Array([...d,o]);break}default:throw new Error(`Scheme ${o} is not supported`)}let i=Ir.create();i.update(s);let c=i.digest();return new Gn({data:c})}static fromPublicKey(e){let{publicKey:r}=e,o;if(r instanceof qe)o=0 .valueOf();else if(r instanceof nn)o=1 .valueOf();else if(r instanceof je)o=2 .valueOf();else if(r instanceof qr)o=3 .valueOf();else throw new Error("No supported authentication scheme for public key");return Gn.fromPublicKeyAndScheme({publicKey:r,scheme:o})}derivedAddress(){return new F(this.data.toUint8Array())}};Gn.LENGTH=32;var an=Gn;var Ln=class n{constructor(t){let{privateKey:e,address:r,legacy:o}=t,s=o??!0;if(this.publicKey=e.publicKey(),this.publicKey instanceof qe)s?this.signingScheme=0:(this.publicKey=new je(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof nn)this.signingScheme=1;else if(this.publicKey instanceof Vt)this.publicKey=new je(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=Dn.generate(),o=new je(r.publicKey());break;default:r=Pn.generate(),e===!1?o=new je(r.publicKey()):o=r.publicKey()}let i=an.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 Dn)s=new je(e.publicKey());else if(e instanceof Pn)o?s=e.publicKey():s=new je(e.publicKey());else throw new Error(`Unsupported private key ${e}`);let c=an.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=Dn.fromDerivationPath(e,r);break;case 0:i=Pn.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 an.fromPublicKey({publicKey:e})}sign(t){return this.privateKey.sign(t)}verifySignature(t){let{message:e,signature:r}=t,o=Be.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:o,signature:r})}};var Eh=`
|
|
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=`
|
|
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
|
-
`,
|
|
19
|
+
`,vy=`
|
|
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
|
-
`,
|
|
29
|
+
`,Pi=`
|
|
30
30
|
fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {
|
|
31
31
|
token_standard
|
|
32
32
|
token_properties_mutated_v1
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
`,
|
|
75
|
+
`,Sd=`
|
|
76
76
|
query getAccountCoinsCount($address: String) {
|
|
77
77
|
current_fungible_asset_balances_aggregate(
|
|
78
78
|
where: {owner_address: {_eq: $address}}
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
`,
|
|
85
|
+
`,vd=`
|
|
86
86
|
query getAccountCoinsData($where_condition: current_fungible_asset_balances_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_fungible_asset_balances_order_by!]) {
|
|
87
87
|
current_fungible_asset_balances(
|
|
88
88
|
where: $where_condition
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
`,
|
|
118
|
+
`,Cd=`
|
|
119
119
|
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
120
|
current_collection_ownership_v2_view(
|
|
121
121
|
where: $where_condition
|
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
single_token_uri
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
`,
|
|
152
|
+
`,Id=`
|
|
153
153
|
query getAccountOwnedObjects($where_condition: current_objects_bool_exp, $offset: Int, $limit: Int, $order_by: [current_objects_order_by!]) {
|
|
154
154
|
current_objects(
|
|
155
155
|
where: $where_condition
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
is_deleted
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
`,
|
|
169
|
+
`,Bd=`
|
|
170
170
|
query getAccountOwnedTokens($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
171
171
|
current_token_ownerships_v2(
|
|
172
172
|
where: $where_condition
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
...CurrentTokenOwnershipFields
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
-
${
|
|
180
|
+
${Pi}`,Lw=`
|
|
181
181
|
query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
182
182
|
current_token_ownerships_v2(
|
|
183
183
|
where: $where_condition
|
|
@@ -188,7 +188,7 @@
|
|
|
188
188
|
...CurrentTokenOwnershipFields
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
${
|
|
191
|
+
${Pi}`,Ud=`
|
|
192
192
|
query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
193
193
|
current_token_ownerships_v2(
|
|
194
194
|
where: $where_condition
|
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
...CurrentTokenOwnershipFields
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
${
|
|
202
|
+
${Pi}`,Pd=`
|
|
203
203
|
query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {
|
|
204
204
|
current_token_ownerships_v2_aggregate(
|
|
205
205
|
where: $where_condition
|
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
`,
|
|
214
|
+
`,Rd=`
|
|
215
215
|
query getAccountTransactionsCount($address: String) {
|
|
216
216
|
account_transactions_aggregate(where: {account_address: {_eq: $address}}) {
|
|
217
217
|
aggregate {
|
|
@@ -219,13 +219,13 @@
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
`,
|
|
222
|
+
`,Od=`
|
|
223
223
|
query getChainTopUserTransactions($limit: Int) {
|
|
224
224
|
user_transactions(limit: $limit, order_by: {version: desc}) {
|
|
225
225
|
version
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
-
`,
|
|
228
|
+
`,Nd=`
|
|
229
229
|
query getCollectionData($where_condition: current_collections_v2_bool_exp!) {
|
|
230
230
|
current_collections_v2(where: $where_condition) {
|
|
231
231
|
collection_id
|
|
@@ -244,7 +244,7 @@
|
|
|
244
244
|
uri
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
`,
|
|
247
|
+
`,kd=`
|
|
248
248
|
query getCurrentFungibleAssetBalances($where_condition: current_fungible_asset_balances_bool_exp, $offset: Int, $limit: Int) {
|
|
249
249
|
current_fungible_asset_balances(
|
|
250
250
|
where: $where_condition
|
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
token_standard
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
-
`,
|
|
265
|
+
`,Dd=`
|
|
266
266
|
query getDelegatedStakingActivities($delegatorAddress: String, $poolAddress: String) {
|
|
267
267
|
delegated_staking_activities(
|
|
268
268
|
where: {delegator_address: {_eq: $delegatorAddress}, pool_address: {_eq: $poolAddress}}
|
|
@@ -275,7 +275,7 @@
|
|
|
275
275
|
transaction_version
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
-
`,
|
|
278
|
+
`,zd=`
|
|
279
279
|
query getEvents($where_condition: events_bool_exp, $offset: Int, $limit: Int, $order_by: [events_order_by!]) {
|
|
280
280
|
events(
|
|
281
281
|
where: $where_condition
|
|
@@ -294,7 +294,7 @@
|
|
|
294
294
|
indexed_type
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
|
-
`,
|
|
297
|
+
`,Md=`
|
|
298
298
|
query getFungibleAssetActivities($where_condition: fungible_asset_activities_bool_exp, $offset: Int, $limit: Int) {
|
|
299
299
|
fungible_asset_activities(
|
|
300
300
|
where: $where_condition
|
|
@@ -319,7 +319,7 @@
|
|
|
319
319
|
type
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
|
-
`,
|
|
322
|
+
`,Gd=`
|
|
323
323
|
query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_exp, $offset: Int, $limit: Int) {
|
|
324
324
|
fungible_asset_metadata(where: $where_condition, offset: $offset, limit: $limit) {
|
|
325
325
|
icon_uri
|
|
@@ -336,7 +336,7 @@
|
|
|
336
336
|
token_standard
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
`,
|
|
339
|
+
`,wo=`
|
|
340
340
|
query getNames($offset: Int, $limit: Int, $where_condition: current_aptos_names_bool_exp, $order_by: [current_aptos_names_order_by!]) {
|
|
341
341
|
current_aptos_names(
|
|
342
342
|
limit: $limit
|
|
@@ -347,14 +347,14 @@
|
|
|
347
347
|
...AnsTokenFragment
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
${
|
|
350
|
+
${vy}`,Vc=`
|
|
351
351
|
query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp, $order_by: [num_active_delegator_per_pool_order_by!]) {
|
|
352
352
|
num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
|
|
353
353
|
num_active_delegator
|
|
354
354
|
pool_address
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
-
`,
|
|
357
|
+
`,jc=`
|
|
358
358
|
query getProcessorStatus($where_condition: processor_status_bool_exp) {
|
|
359
359
|
processor_status(where: $where_condition) {
|
|
360
360
|
last_success_version
|
|
@@ -362,7 +362,7 @@
|
|
|
362
362
|
last_updated
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
|
-
`,
|
|
365
|
+
`,Ld=`
|
|
366
366
|
query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {
|
|
367
367
|
token_activities_v2(
|
|
368
368
|
where: $where_condition
|
|
@@ -373,7 +373,7 @@
|
|
|
373
373
|
...TokenActivitiesFields
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
-
${
|
|
376
|
+
${Sy}`,Wc=`
|
|
377
377
|
query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
378
378
|
current_token_ownerships_v2(
|
|
379
379
|
where: $where_condition
|
|
@@ -384,7 +384,7 @@
|
|
|
384
384
|
...CurrentTokenOwnershipFields
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
|
-
${
|
|
387
|
+
${Pi}`,qd=`
|
|
388
388
|
query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
|
|
389
389
|
current_token_datas_v2(
|
|
390
390
|
where: $where_condition
|
|
@@ -423,11 +423,11 @@
|
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
|
-
`;async function Ci(n){let{aptosConfig:t}=n,{data:e}=await Bt({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function Gd(n){let{aptosConfig:t,ledgerVersion:e,options:r}=n,{data:o}=await Bt({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:r?.withTransactions}});return o}async function Ld(n){let{aptosConfig:t,blockHeight:e,options:r}=n,{data:o}=await Bt({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:r?.withTransactions}});return o}async function Ui(n){let{aptosConfig:t,handle:e,data:r,options:o}=n;return(await Er({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:o?.ledgerVersion},body:r})).data}async function fr(n){let{aptosConfig:t,payload:e,options:r}=n,{data:o}=await Er({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 qd(n){let{aptosConfig:t,limit:e}=n;return(await Se({aptosConfig:t,query:{query:Bd,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function Se(n){let{aptosConfig:t,query:e,originMethod:r}=n,{data:o}=await $a({aptosConfig:t,originMethod:r??"queryIndexer",path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return o}async function vh(n){let{aptosConfig:t}=n;return(await Se({aptosConfig:t,query:{query:Hc},originMethod:"getProcessorStatuses"})).processor_status}async function Ii(n){let t=await vh({aptosConfig:n.aptosConfig});return BigInt(t[0].last_success_version)}async function Bi(n){let{aptosConfig:t,processorType:e}=n,r={processor:{_eq:e.valueOf()}};return(await Se({aptosConfig:t,query:{query:Hc,variables:{where_condition:r}},originMethod:"getProcessorStatus"})).processor_status[0]}var Vc=new Map;function xo(n,t,e){return async(...r)=>{if(Vc.has(t)){let{value:s,timestamp:i}=Vc.get(t);if(e===void 0||Date.now()-i<=e)return s}let o=await n(...r);return Vc.set(t,{value:o,timestamp:Date.now()}),o}}var mn=class n extends tn{constructor(e){super();this.signature=e}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(e){if(this.signature instanceof Je)e.serializeU32AsUleb128(0),this.signature.serialize(e);else if(this.signature instanceof Mn)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(Je.load(e));case 1:return new n(Mn.load(e));default:throw new Error(`Unknown variant index for AnySignature: ${r}`)}}};async function hn(n){let{aptosConfig:t,accountAddress:e}=n,{data:r}=await Bt({aptosConfig:t,originMethod:"getInfo",path:`accounts/${F.from(e).toString()}`});return r}async function Hd(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return _r({aptosConfig:t,originMethod:"getModules",path:`accounts/${F.from(e).toString()}/modules`,params:{ledger_version:r?.ledgerVersion,start:r?.offset,limit:r?.limit??1e3}})}async function Pi(n){return n.options?.ledgerVersion!==void 0?Kd(n):xo(async()=>Kd(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function Kd(n){let{aptosConfig:t,accountAddress:e,moduleName:r,options:o}=n,{data:s}=await Bt({aptosConfig:t,originMethod:"getModule",path:`accounts/${F.from(e).toString()}/module/${r}`,params:{ledger_version:o?.ledgerVersion}});return s}async function $d(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return _r({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${F.from(e).toString()}/transactions`,params:{start:r?.offset,limit:r?.limit}})}async function Vd(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return _r({aptosConfig:t,originMethod:"getResources",path:`accounts/${F.from(e).toString()}/resources`,params:{ledger_version:r?.ledgerVersion,start:r?.offset,limit:r?.limit??999}})}async function jc(n){let{aptosConfig:t,accountAddress:e,resourceType:r,options:o}=n,{data:s}=await Bt({aptosConfig:t,originMethod:"getResource",path:`accounts/${F.from(e).toString()}/resource/${r}`,params:{ledger_version:o?.ledgerVersion}});return s.data}async function Wc(n){let{aptosConfig:t,authenticationKey:e,options:r}=n,o=await jc({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:s}}=o,i=F.from(e);try{let c=await Ui({aptosConfig:t,handle:s,data:{key:i.toString(),key_type:"address",value_type:"address"},options:r});return F.from(c)}catch(c){if(c instanceof dn&&c.data.error_code==="table_item_not_found")return i;throw c}}async function jd(n){let{aptosConfig:t,accountAddress:e}=n,o={owner_address:{_eq:F.from(e).toStringLong()},amount:{_gt:0}},i=await Se({aptosConfig:t,query:{query:Ud,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 Wd(n){let{aptosConfig:t,accountAddress:e,options:r}=n,s={owner_address:{_eq:F.from(e).toStringLong()},amount:{_gt:0}};r?.tokenStandard&&(s.token_standard={_eq:r?.tokenStandard});let i={query:vd,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 Qd(n){let{aptosConfig:t,accountAddress:e,collectionAddress:r,options:o}=n,s=F.from(e).toStringLong(),i=F.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:Cd,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 Yd(n){let{aptosConfig:t,accountAddress:e,options:r}=n,s={owner_address:{_eq:F.from(e).toStringLong()},amount:{_gt:0}};r?.tokenStandard&&(s.current_collection={token_standard:{_eq:r?.tokenStandard}});let i={query:Ed,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 Zd(n){let{aptosConfig:t,accountAddress:e}=n,r=F.from(e).toStringLong(),s=await Se({aptosConfig:t,query:{query:Id,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return s.account_transactions_aggregate.aggregate?s.account_transactions_aggregate.aggregate.count:0}async function Xd(n){let{aptosConfig:t,accountAddress:e,coinType:r}=n,o=F.from(e).toStringLong(),s=await Qc({aptosConfig:t,accountAddress:o,options:{where:{asset_type:{_eq:r}}}});return s[0]?s[0].amount:0}async function Qc(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o=F.from(e).toStringLong(),s={...r?.where,owner_address:{_eq:o}},i={query:_d,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 Jd(n){let{aptosConfig:t,accountAddress:e}=n,r=F.from(e).toStringLong(),s=await Se({aptosConfig:t,query:{query:Td,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 el(n){let{aptosConfig:t,accountAddress:e,options:r}=n,s={owner_address:{_eq:F.from(e).toStringLong()}},i={query:Sd,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 tl(n){let{aptosConfig:t,privateKey:e}=n,r=new je(e.publicKey());if(e instanceof Dn){let s=an.fromPublicKeyAndScheme({publicKey:r,scheme:2}).derivedAddress();return Ln.fromPrivateKeyAndAddress({privateKey:e,address:s})}if(e instanceof Pn){let o=an.fromPublicKeyAndScheme({publicKey:r,scheme:2});if(await Fd({authKey:o,aptosConfig:t})){let u=o.derivedAddress();return Ln.fromPrivateKeyAndAddress({privateKey:e,address:u,legacy:!1})}let i=an.fromPublicKeyAndScheme({publicKey:r,scheme:0});if(await Fd({authKey:i,aptosConfig:t})){let u=i.derivedAddress();return Ln.fromPrivateKeyAndAddress({privateKey:e,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function Fd(n){let{aptosConfig:t,authKey:e}=n,r=await Wc({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await hn({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 dr(n){return new Promise(t=>{setTimeout(t,n)})}async function nl(n){let{aptosConfig:t,options:e}=n;return _r({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:e?.offset,limit:e?.limit}})}async function Oi(n){let{aptosConfig:t}=n;return xo(async()=>{let{data:e}=await Bt({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function rl(n){let{aptosConfig:t,ledgerVersion:e}=n,{data:r}=await Bt({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return r}async function Ni(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await Bt({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return r}async function ol(n){let{aptosConfig:t,transactionHash:e}=n;try{return(await Ni({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(r){if(r?.status===404)return!0;throw r}}async function bo(n){let{aptosConfig:t,transactionHash:e,options:r}=n,o=r?.timeoutSecs??Vo,s=r?.checkSuccess??!0,i=!0,c=0,u,d,h=200,g=1.5;for(;i&&!(c>=o);){try{if(u=await Ni({aptosConfig:t,transactionHash:e}),i=u.type==="pending_transaction",!i)break}catch(T){if(!(T instanceof dn)||(d=T,T.status!==404&&T.status>=400&&T.status<500))throw T}await dr(h),c+=h/1e3,h*=g}if(u===void 0)throw d||new Ri(`Fetching transaction ${e} failed and timed out after ${o} seconds`,u);if(u.type==="pending_transaction")throw new Ri(`Transaction ${e} timed out in pending state after ${o} seconds`,u);if(!s)return u;if(!u.success)throw new Yc(`Transaction ${e} failed with an error: ${u.vm_status}`,u);return u}async function ki(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 Ii({aptosConfig:t}):i=(await Bi({aptosConfig:t,processorType:e})).last_success_version,i>=r)break;await dr(200)}}var Ri=class extends Error{constructor(e,r){super(e);this.lastSubmittedTransaction=r}},Yc=class extends Error{constructor(e,r){super(e);this.transaction=r}};async function ze(n){n.minimumLedgerVersion!==void 0&&await ki({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}var rs=class{constructor(t){this.config=t}async getAccountInfo(t){return hn({aptosConfig:this.config,...t})}async getAccountModules(t){return Hd({aptosConfig:this.config,...t})}async getAccountModule(t){return Pi({aptosConfig:this.config,...t})}async getAccountTransactions(t){return $d({aptosConfig:this.config,...t})}async getAccountResources(t){return Vd({aptosConfig:this.config,...t})}async getAccountResource(t){return jc({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return Wc({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),jd({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Wd({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Qd({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Yd({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),Zd({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Qc({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Jd({aptosConfig:this.config,...t})}async getAccountAPTAmount(t){return this.getAccountCoinAmount({coinType:jo,...t})}async getAccountCoinAmount(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Xd({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),el({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return tl({aptosConfig:this.config,...t})}};function os(n,t){return function(){return n.apply(t,arguments)}}var{toString:Ch}=Object.prototype,{getPrototypeOf:Jc}=Object,Di=(n=>t=>{let e=Ch.call(t);return n[e]||(n[e]=e.slice(8,-1).toLowerCase())})(Object.create(null)),yn=n=>(n=n.toLowerCase(),t=>Di(t)===n),Mi=n=>t=>typeof t===n,{isArray:wo}=Array,ss=Mi("undefined");function Uh(n){return n!==null&&!ss(n)&&n.constructor!==null&&!ss(n.constructor)&&jt(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}var al=yn("ArrayBuffer");function Ih(n){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(n):t=n&&n.buffer&&al(n.buffer),t}var Bh=Mi("string"),jt=Mi("function"),cl=Mi("number"),Gi=n=>n!==null&&typeof n=="object",Ph=n=>n===!0||n===!1,zi=n=>{if(Di(n)!=="object")return!1;let t=Jc(n);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},Rh=yn("Date"),Oh=yn("File"),Nh=yn("Blob"),kh=yn("FileList"),zh=n=>Gi(n)&&jt(n.pipe),Dh=n=>{let t;return n&&(typeof FormData=="function"&&n instanceof FormData||jt(n.append)&&((t=Di(n))==="formdata"||t==="object"&&jt(n.toString)&&n.toString()==="[object FormData]"))},Mh=yn("URLSearchParams"),Gh=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function is(n,t,{allOwnKeys:e=!1}={}){if(n===null||typeof n>"u")return;let r,o;if(typeof n!="object"&&(n=[n]),wo(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 ul(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 fl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,dl=n=>!ss(n)&&n!==fl;function Xc(){let{caseless:n}=dl(this)&&this||{},t={},e=(r,o)=>{let s=n&&ul(t,o)||o;zi(t[s])&&zi(r)?t[s]=Xc(t[s],r):zi(r)?t[s]=Xc({},r):wo(r)?t[s]=r.slice():t[s]=r};for(let r=0,o=arguments.length;r<o;r++)arguments[r]&&is(arguments[r],e);return t}var Lh=(n,t,e,{allOwnKeys:r}={})=>(is(t,(o,s)=>{e&&jt(o)?n[s]=os(o,e):n[s]=o},{allOwnKeys:r}),n),qh=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),Kh=(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)},Fh=(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&&Jc(n)}while(n&&(!e||e(n,t))&&n!==Object.prototype);return t},Hh=(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},$h=n=>{if(!n)return null;if(wo(n))return n;let t=n.length;if(!cl(t))return null;let e=new Array(t);for(;t-- >0;)e[t]=n[t];return e},Vh=(n=>t=>n&&t instanceof n)(typeof Uint8Array<"u"&&Jc(Uint8Array)),jh=(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])}},Wh=(n,t)=>{let e,r=[];for(;(e=n.exec(t))!==null;)r.push(e);return r},Qh=yn("HTMLFormElement"),Yh=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,r,o){return r.toUpperCase()+o}),sl=(({hasOwnProperty:n})=>(t,e)=>n.call(t,e))(Object.prototype),Zh=yn("RegExp"),ll=(n,t)=>{let e=Object.getOwnPropertyDescriptors(n),r={};is(e,(o,s)=>{let i;(i=t(o,s,n))!==!1&&(r[s]=i||o)}),Object.defineProperties(n,r)},Xh=n=>{ll(n,(t,e)=>{if(jt(n)&&["arguments","caller","callee"].indexOf(e)!==-1)return!1;let r=n[e];if(jt(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+"'")})}})},Jh=(n,t)=>{let e={},r=o=>{o.forEach(s=>{e[s]=!0})};return wo(n)?r(n):r(String(n).split(t)),e},ey=()=>{},ty=(n,t)=>(n=+n,Number.isFinite(n)?n:t),Zc="abcdefghijklmnopqrstuvwxyz",il="0123456789",pl={DIGIT:il,ALPHA:Zc,ALPHA_DIGIT:Zc+Zc.toUpperCase()+il},ny=(n=16,t=pl.ALPHA_DIGIT)=>{let e="",{length:r}=t;for(;n--;)e+=t[Math.random()*r|0];return e};function ry(n){return!!(n&&jt(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}var oy=n=>{let t=new Array(10),e=(r,o)=>{if(Gi(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[o]=r;let s=wo(r)?[]:{};return is(r,(i,c)=>{let u=e(i,o+1);!ss(u)&&(s[c]=u)}),t[o]=void 0,s}}return r};return e(n,0)},sy=yn("AsyncFunction"),iy=n=>n&&(Gi(n)||jt(n))&&jt(n.then)&&jt(n.catch),I={isArray:wo,isArrayBuffer:al,isBuffer:Uh,isFormData:Dh,isArrayBufferView:Ih,isString:Bh,isNumber:cl,isBoolean:Ph,isObject:Gi,isPlainObject:zi,isUndefined:ss,isDate:Rh,isFile:Oh,isBlob:Nh,isRegExp:Zh,isFunction:jt,isStream:zh,isURLSearchParams:Mh,isTypedArray:Vh,isFileList:kh,forEach:is,merge:Xc,extend:Lh,trim:Gh,stripBOM:qh,inherits:Kh,toFlatObject:Fh,kindOf:Di,kindOfTest:yn,endsWith:Hh,toArray:$h,forEachEntry:jh,matchAll:Wh,isHTMLForm:Qh,hasOwnProperty:sl,hasOwnProp:sl,reduceDescriptors:ll,freezeMethods:Xh,toObjectSet:Jh,toCamelCase:Yh,noop:ey,toFiniteNumber:ty,findKey:ul,global:fl,isContextDefined:dl,ALPHABET:pl,generateString:ny,isSpecCompliantForm:ry,toJSONObject:oy,isAsyncFn:sy,isThenable:iy};function To(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)}I.inherits(To,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:I.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var gl=To.prototype,ml={};["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=>{ml[n]={value:n}});Object.defineProperties(To,ml);Object.defineProperty(gl,"isAxiosError",{value:!0});To.from=(n,t,e,r,o,s)=>{let i=Object.create(gl);return I.toFlatObject(n,i,function(u){return u!==Error.prototype},c=>c!=="isAxiosError"),To.call(i,n.message,t,e,r,o),i.cause=n,i.name=n.name,s&&Object.assign(i,s),i};var Ee=To;var Li=null;function eu(n){return I.isPlainObject(n)||I.isArray(n)}function yl(n){return I.endsWith(n,"[]")?n.slice(0,-2):n}function hl(n,t,e){return n?n.concat(t).map(function(o,s){return o=yl(o),!e&&s?"["+o+"]":o}).join(e?".":""):t}function ay(n){return I.isArray(n)&&!n.some(eu)}var cy=I.toFlatObject(I,{},null,function(t){return/^is[A-Z]/.test(t)});function uy(n,t,e){if(!I.isObject(n))throw new TypeError("target must be an object");t=t||new(Li||FormData),e=I.toFlatObject(e,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,w){return!I.isUndefined(w[y])});let r=e.metaTokens,o=e.visitor||h,s=e.dots,i=e.indexes,u=(e.Blob||typeof Blob<"u"&&Blob)&&I.isSpecCompliantForm(t);if(!I.isFunction(o))throw new TypeError("visitor must be a function");function d(b){if(b===null)return"";if(I.isDate(b))return b.toISOString();if(!u&&I.isBlob(b))throw new Ee("Blob is not supported. Use a Buffer instead.");return I.isArrayBuffer(b)||I.isTypedArray(b)?u&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function h(b,y,w){let v=b;if(b&&!w&&typeof b=="object"){if(I.endsWith(y,"{}"))y=r?y:y.slice(0,-2),b=JSON.stringify(b);else if(I.isArray(b)&&ay(b)||(I.isFileList(b)||I.endsWith(y,"[]"))&&(v=I.toArray(b)))return y=yl(y),v.forEach(function(P,$){!(I.isUndefined(P)||P===null)&&t.append(i===!0?hl([y],$,s):i===null?y:y+"[]",d(P))}),!1}return eu(b)?!0:(t.append(hl(w,y,s),d(b)),!1)}let g=[],T=Object.assign(cy,{defaultVisitor:h,convertValue:d,isVisitable:eu});function S(b,y){if(!I.isUndefined(b)){if(g.indexOf(b)!==-1)throw Error("Circular reference detected in "+y.join("."));g.push(b),I.forEach(b,function(v,k){(!(I.isUndefined(v)||v===null)&&o.call(t,v,I.isString(k)?k.trim():k,y,T))===!0&&S(v,y?y.concat(k):[k])}),g.pop()}}if(!I.isObject(n))throw new TypeError("data must be an object");return S(n),t}var lr=uy;function Al(n){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function xl(n,t){this._pairs=[],n&&lr(n,this,t)}var bl=xl.prototype;bl.append=function(t,e){this._pairs.push([t,e])};bl.toString=function(t){let e=t?function(r){return t.call(this,r,Al)}:Al;return this._pairs.map(function(o){return e(o[0])+"="+e(o[1])},"").join("&")};var qi=xl;function fy(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function as(n,t,e){if(!t)return n;let r=e&&e.encode||fy,o=e&&e.serialize,s;if(o?s=o(t,e):s=I.isURLSearchParams(t)?t.toString():new qi(t,e).toString(r),s){let i=n.indexOf("#");i!==-1&&(n=n.slice(0,i)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}var tu=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){I.forEach(this.handlers,function(r){r!==null&&t(r)})}},nu=tu;var Ki={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var wl=typeof URLSearchParams<"u"?URLSearchParams:qi;var Tl=typeof FormData<"u"?FormData:null;var _l=typeof Blob<"u"?Blob:null;var El={isBrowser:!0,classes:{URLSearchParams:wl,FormData:Tl,Blob:_l},protocols:["http","https","file","blob","url","data"]};var ru={};Ks(ru,{hasBrowserEnv:()=>Sl,hasStandardBrowserEnv:()=>dy,hasStandardBrowserWebWorkerEnv:()=>ly});var Sl=typeof window<"u"&&typeof document<"u",dy=(n=>Sl&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),ly=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function";var _t={...ru,...El};function ou(n,t){return lr(n,new _t.classes.URLSearchParams,Object.assign({visitor:function(e,r,o,s){return _t.isNode&&I.isBuffer(e)?(this.append(r,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function py(n){return I.matchAll(/\w+|\[(\w*)]/g,n).map(t=>t[0]==="[]"?"":t[1]||t[0])}function gy(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 my(n){function t(e,r,o,s){let i=e[s++],c=Number.isFinite(+i),u=s>=e.length;return i=!i&&I.isArray(o)?o.length:i,u?(I.hasOwnProp(o,i)?o[i]=[o[i],r]:o[i]=r,!c):((!o[i]||!I.isObject(o[i]))&&(o[i]=[]),t(e,r,o[i],s)&&I.isArray(o[i])&&(o[i]=gy(o[i])),!c)}if(I.isFormData(n)&&I.isFunction(n.entries)){let e={};return I.forEachEntry(n,(r,o)=>{t(py(r),o,e,0)}),e}return null}var Fi=my;function hy(n,t,e){if(I.isString(n))try{return(t||JSON.parse)(n),I.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(e||JSON.stringify)(n)}var su={transitional:Ki,adapter:["xhr","http"],transformRequest:[function(t,e){let r=e.getContentType()||"",o=r.indexOf("application/json")>-1,s=I.isObject(t);if(s&&I.isHTMLForm(t)&&(t=new FormData(t)),I.isFormData(t))return o&&o?JSON.stringify(Fi(t)):t;if(I.isArrayBuffer(t)||I.isBuffer(t)||I.isStream(t)||I.isFile(t)||I.isBlob(t))return t;if(I.isArrayBufferView(t))return t.buffer;if(I.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 ou(t,this.formSerializer).toString();if((c=I.isFileList(t))||r.indexOf("multipart/form-data")>-1){let u=this.env&&this.env.FormData;return lr(c?{"files[]":t}:t,u&&new u,this.formSerializer)}}return s||o?(e.setContentType("application/json",!1),hy(t)):t}],transformResponse:[function(t){let e=this.transitional||su.transitional,r=e&&e.forcedJSONParsing,o=this.responseType==="json";if(t&&I.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"?Ee.from(c,Ee.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:_t.classes.FormData,Blob:_t.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};I.forEach(["delete","get","head","post","put","patch"],n=>{su.headers[n]={}});var _o=su;var yy=I.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"]),vl=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]&&
|
|
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[
|
|
429
|
-
`+s.map(
|
|
430
|
-
`):" "+Nl(s[0]):"as no adapter specified";throw new Ee("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:du};function lu(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new pr(null,n)}function Vi(n){return lu(n),n.headers=Et.from(n.headers),n.data=us.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),$i.getAdapter(n.adapter||_o.adapter)(n).then(function(r){return lu(n),r.data=us.call(n,n.transformResponse,r),r.headers=Et.from(r.headers),r},function(r){return fs(r)||(lu(n),r&&r.response&&(r.response.data=us.call(n,n.transformResponse,r.response),r.response.headers=Et.from(r.response.headers))),Promise.reject(r)})}var kl=n=>n instanceof Et?n.toJSON():n;function qn(n,t){t=t||{};let e={};function r(d,h,g){return I.isPlainObject(d)&&I.isPlainObject(h)?I.merge.call({caseless:g},d,h):I.isPlainObject(h)?I.merge({},h):I.isArray(h)?h.slice():h}function o(d,h,g){if(I.isUndefined(h)){if(!I.isUndefined(d))return r(void 0,d,g)}else return r(d,h,g)}function s(d,h){if(!I.isUndefined(h))return r(void 0,h)}function i(d,h){if(I.isUndefined(h)){if(!I.isUndefined(d))return r(void 0,d)}else return r(void 0,h)}function c(d,h,g){if(g in t)return r(d,h);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,h)=>o(kl(d),kl(h),!0)};return I.forEach(Object.keys(Object.assign({},n,t)),function(h){let g=u[h]||o,T=g(n[h],t[h],h);I.isUndefined(T)&&g!==c||(e[h]=T)}),e}var ji="1.6.2";var pu={};["object","boolean","number","function","string","symbol"].forEach((n,t)=>{pu[n]=function(r){return typeof r===n||"a"+(t<1?"n ":" ")+n}});var zl={};pu.transitional=function(t,e,r){function o(s,i){return"[Axios v"+ji+"] Transitional option '"+s+"'"+i+(r?". "+r:"")}return(s,i,c)=>{if(t===!1)throw new Ee(o(i," has been removed"+(e?" in "+e:"")),Ee.ERR_DEPRECATED);return e&&!zl[i]&&(zl[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 Sy(n,t,e){if(typeof n!="object")throw new Ee("options must be an object",Ee.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 Ee("option "+s+" must be "+u,Ee.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new Ee("Unknown option "+s,Ee.ERR_BAD_OPTION)}}var Wi={assertOptions:Sy,validators:pu};var gr=Wi.validators,So=class{constructor(t){this.defaults=t,this.interceptors={request:new nu,response:new nu}}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&&Wi.assertOptions(r,{silentJSONParsing:gr.transitional(gr.boolean),forcedJSONParsing:gr.transitional(gr.boolean),clarifyTimeoutError:gr.transitional(gr.boolean)},!1),o!=null&&(I.isFunction(o)?e.paramsSerializer={serialize:o}:Wi.assertOptions(o,{encode:gr.function,serialize:gr.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let i=s&&I.merge(s.common,s[e.method]);s&&I.forEach(["delete","get","head","post","put","patch","common"],b=>{delete s[b]}),e.headers=Et.concat(i,s);let c=[],u=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(e)===!1||(u=u&&y.synchronous,c.unshift(y.fulfilled,y.rejected))});let d=[];this.interceptors.response.forEach(function(y){d.push(y.fulfilled,y.rejected)});let h,g=0,T;if(!u){let b=[Vi.bind(this),void 0];for(b.unshift.apply(b,c),b.push.apply(b,d),T=b.length,h=Promise.resolve(e);g<T;)h=h.then(b[g++],b[g++]);return h}T=c.length;let S=e;for(g=0;g<T;){let b=c[g++],y=c[g++];try{S=b(S)}catch(w){y.call(this,w);break}}try{h=Vi.call(this,S)}catch(b){return Promise.reject(b)}for(g=0,T=d.length;g<T;)h=h.then(d[g++],d[g++]);return h}getUri(t){t=qn(this.defaults,t);let e=ds(t.baseURL,t.url);return as(e,t.params,t.paramsSerializer)}};I.forEach(["delete","get","head","options"],function(t){So.prototype[t]=function(e,r){return this.request(qn(r||{},{method:t,url:e,data:(r||{}).data}))}});I.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}))}}So.prototype[t]=e(),So.prototype[t+"Form"]=e(!0)});var ls=So;var gu=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 pr(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}}},Dl=gu;function mu(n){return function(e){return n.apply(null,e)}}function hu(n){return I.isObject(n)&&n.isAxiosError===!0}var yu={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(yu).forEach(([n,t])=>{yu[t]=n});var Ml=yu;function Gl(n){let t=new ls(n),e=os(ls.prototype.request,t);return I.extend(e,ls.prototype,t,{allOwnKeys:!0}),I.extend(e,t,null,{allOwnKeys:!0}),e.create=function(o){return Gl(qn(n,o))},e}var it=Gl(_o);it.Axios=ls;it.CanceledError=pr;it.CancelToken=Dl;it.isCancel=fs;it.VERSION=ji;it.toFormData=lr;it.AxiosError=Ee;it.Cancel=it.CanceledError;it.all=function(t){return Promise.all(t)};it.spread=mu;it.isAxiosError=hu;it.mergeConfig=qn;it.AxiosHeaders=Et;it.formToJSON=n=>Fi(I.isHTMLForm(n)?new FormData(n):n);it.getAdapter=$i.getAdapter;it.HttpStatusCode=Ml;it.default=it;var Qi=it;var{Axios:l_,AxiosError:p_,CanceledError:g_,isCancel:m_,CancelToken:h_,VERSION:y_,all:A_,Cancel:x_,isAxiosError:b_,spread:w_,toFormData:T_,AxiosHeaders:__,HttpStatusCode:E_,formToJSON:S_,getAdapter:v_,mergeConfig:C_}=Qi;async function Ll(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 Qi(u);return{status:d.status,statusText:d.statusText,data:d.data,headers:d.headers,config:d.config}}catch(d){let h=d;if(h.response)return h.response;throw d}}var ps=class{constructor(t){this.network=t?.network??La,this.fullnode=t?.fullnode,this.faucet=t?.faucet,this.indexer=t?.indexer,this.client=t?.client??{provider:Ll},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 Ma[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 Ga[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 $s[this.network];default:throw Error(`apiType ${t} is not supported`)}}isIndexerRequest(t){return $s[this.network]===t}};var gs=class extends ae{constructor(e){super();this.accountAddress=F.ONE;this.moduleName=new yt("account");this.structName=new yt("RotationProofChallenge");this.sequenceNumber=new ft(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=Le.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 Ut=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return An.load(t);case 1:return ms.load(t);case 2:return cn.load(t);case 3:return Kr.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof An}isMultiEd25519(){return this instanceof ms}isSingleKey(){return this instanceof cn}isMultiKey(){return this instanceof Kr}},An=class n extends Ut{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=qe.deserialize(e),o=Je.deserialize(e);return new n(r,o)}},ms=class n extends Ut{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=nn.deserialize(e),o=Rr.deserialize(e);return new n(r,o)}},cn=class n extends Ut{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=je.deserialize(e),o=mn.deserialize(e);return new n(r,o)}},Kr=class n extends Ut{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=qr.deserialize(e),o=e.deserializeVector(mn),s=e.deserializeBytes();return new n(r,o,s)}};var xn=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Fr.load(t);case 1:return Yi.load(t);case 2:return Hr.load(t);case 3:return $r.load(t);case 4:return Vr.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},Fr=class n extends xn{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=qe.deserialize(e),o=Je.deserialize(e);return new n(r,o)}},Yi=class n extends xn{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=nn.deserialize(e),o=Rr.deserialize(e);return new n(r,o)}},Hr=class n extends xn{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=Ut.deserialize(e),o=e.deserializeVector(F),s=e.deserializeVector(Ut);return new n(r,o,s)}},$r=class n extends xn{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=Ut.deserialize(e),o=e.deserializeVector(F),s=e.deserializeVector(Ut),i=F.deserialize(e),c=Ut.deserialize(e),u={address:i,authenticator:c};return new n(r,o,s,u)}},Vr=class n extends xn{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=Ut.deserialize(e);return new n(r)}};var jr=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 We=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 vo=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(F.fromString(r[0]),new We(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=F.deserialize(e),o=We.deserialize(e);return new n(r,o)}};var nt=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Wr.load(t);case 1:return Qr.load(t);case 2:return Xr.load(t);case 3:return Jr.load(t);case 4:return to.load(t);case 5:return mr.load(t);case 6:return ro.load(t);case 7:return Kn.load(t);case 8:return Yr.load(t);case 9:return Zr.load(t);case 10:return eo.load(t);case 255:return no.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof Wr}isAddress(){return this instanceof to}isGeneric(){return this instanceof no}isSigner(){return this instanceof mr}isVector(){return this instanceof ro}isStruct(){return this instanceof Kn}isU8(){return this instanceof Qr}isU16(){return this instanceof Yr}isU32(){return this instanceof Zr}isU64(){return this instanceof Xr}isU128(){return this instanceof Jr}isU256(){return this instanceof eo}},Wr=class n extends nt{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new n}},Qr=class n extends nt{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new n}},Yr=class n extends nt{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new n}},Zr=class n extends nt{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new n}},Xr=class n extends nt{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new n}},Jr=class n extends nt{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new n}},eo=class n extends nt{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new n}},to=class n extends nt{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new n}},mr=class n extends nt{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new n}},hs=class n extends nt{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let r=nt.deserialize(e);return new n(r)}},no=class n extends nt{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)}},ro=class n extends nt{constructor(e){super();this.value=e}toString(){return`vector<${this.value.toString()}>`}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){let r=nt.deserialize(e);return new n(r)}},Kn=class n extends nt{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(F.ONE,"string","String")}isOption(){return this.isTypeTag(F.ONE,"option","Option")}isObject(){return this.isTypeTag(F.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=F.deserialize(e),o=We.deserialize(e),s=We.deserialize(e),i=e.deserializeVector(nt);return new n(r,o,s,i)}};function vy(){return new bn(F.ONE,new We("aptos_coin"),new We("AptosCoin"),[])}function Cy(){return new bn(F.ONE,new We("string"),new We("String"),[])}function Uy(n){return new bn(F.ONE,new We("option"),new We("Option"),[n])}function Iy(n){return new bn(F.ONE,new We("object"),new We("Object"),[n])}function ql(n){let t=n.deserializeUleb128AsU32();switch(t){case 0:return lt.deserialize(n);case 1:return ft.deserialize(n);case 2:return Lt.deserialize(n);case 3:return F.deserialize(n);case 4:return Le.deserialize(n,lt);case 5:return Xe.deserialize(n);case 6:return Mt.deserialize(n);case 7:return Gt.deserialize(n);case 8:return qt.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var hr=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Co.load(t);case 2:return Uo.load(t);case 3:return Io.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},Co=class n extends hr{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=Bo.deserialize(e);return new n(r)}},Uo=class n extends hr{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=oo.deserialize(e);return new n(r)}},Io=class n extends hr{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=Po.deserialize(e);return new n(r)}},oo=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(vo.fromStr(t),new We(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=vo.deserialize(t),r=We.deserialize(t),o=t.deserializeVector(nt),s=t.deserializeUleb128AsU32(),i=new Array;for(let c=0;c<s;c+=1){let u=t.deserializeUleb128AsU32(),d=Yo.deserialize(t,u);i.push(d)}return new n(e,r,o,i)}},Bo=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(nt),o=t.deserializeUleb128AsU32(),s=new Array;for(let i=0;i<o;i+=1){let c=ql(t);s.push(c)}return new n(e,r,s)}},Po=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=F.deserialize(t),r=t.deserializeBool(),o;return r&&(o=Ro.deserialize(t)),new n(e,o)}},Ro=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(oo.deserialize(e))}};var Wt=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=F.deserialize(e),o=e.deserializeU64(),s=hr.deserialize(e),i=e.deserializeU64(),c=e.deserializeU64(),u=e.deserializeU64(),d=jr.deserialize(e);return new n(r,o,s,i,c,u,d)}},ys=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return wn.load(t);case 1:return Tn.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},wn=class n extends ys{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=Wt.deserialize(e),o=e.deserializeVector(F);return new n(r,o)}},Tn=class n extends ys{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=Wt.deserialize(e),o=e.deserializeVector(F),s=F.deserialize(e);return new n(r,o,s)}};var un=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=Wt.deserialize(e),o=xn.deserialize(e);return new n(r,o)}};function Kl(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Fl(n){return!!n.match(/\s/)}function By(n){return!!n.match(/^T[0-9]+$/)}function Py(n,t){let e=t;for(;e<n.length;e+=1){let r=n[e];if(!Fl(r))break}return e}var Hl=(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))(Hl||{}),Fe=class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function Oo(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=Zi(c,o,e);s.push(b)}let h=r.pop();if(h===void 0)throw new Fe(n,"unexpected '>'");if(u!==s.length)throw new Fe(n,"type argument count doesn't match expected amount");let{savedStr:g,savedTypes:T,savedExpectedTypes:S}=h;o=s,s=T,c=g,u=S}else if(d===","){if(c.length!==0){let h=Zi(c,o,e);o=[],s.push(h),c="",u+=1}}else if(Fl(d)){let h=!1;if(c.length!==0){let T=Zi(c,o,e);o=[],s.push(T),c="",h=!0}i=Py(n,i);let g=n[i];if(i<n.length&&h&&g!==","&&g!==">")throw new Fe(n,"unexpected whitespace character");continue}else c+=d;i+=1}if(r.length>0)throw new Fe(n,"no matching '>' for '<'");switch(s.length){case 0:return Zi(c,o,e);case 1:if(c==="")return s[0];throw new Fe(n,"unexpected ','");default:throw new Fe(n,"unexpected whitespace character")}}function Zi(n,t,e){switch(n){case"&signer":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new hs(new mr);case"signer":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new mr;case"bool":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new Wr;case"address":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new to;case"u8":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new Qr;case"u16":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new Yr;case"u32":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new Zr;case"u64":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new Xr;case"u128":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new Jr;case"u256":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new eo;case"vector":if(t.length!==1)throw new Fe(n,"vector type expected to have exactly one type argument");return new ro(t[0]);default:if(By(n)){if(e)return new no(Number(n.split("T")[1]));throw new Fe(n,"unexpected generic type")}if(!n.match(/.*:.*/))throw new Fe(n,"unknown type");let r=n.split("::");if(r.length!==3)throw new Fe(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!Kl(r[1]))throw new Fe(n,"module name must only contain alphanumeric or '_' characters");if(!Kl(r[2]))throw new Fe(n,"struct name must only contain alphanumeric or '_' characters");return new Kn(new bn(F.fromString(r[0]),new We(r[1]),new We(r[2]),t))}}function Au(n){return typeof n=="boolean"}function so(n){return typeof n=="string"}function As(n){return typeof n=="number"}function xs(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function xu(n){return n==null}function bu(n){return Xi(n)||ea(n)||ta(n)||na(n)||ra(n)||oa(n)||sa(n)||bs(n)||Ji(n)||$l(n)||n instanceof Le||n instanceof Bn}function Xi(n){return n instanceof Xe}function bs(n){return n instanceof F}function Ji(n){return n instanceof yt}function $l(n){return n instanceof Wn}function ea(n){return n instanceof lt}function ta(n){return n instanceof Mt}function na(n){return n instanceof Gt}function ra(n){return n instanceof ft}function oa(n){return n instanceof Lt}function sa(n){return n instanceof qt}function ia(n){return"bytecode"in n}function $e(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function wu(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function aa(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 Ry=new TextEncoder;function _u(n){return n?.map(t=>so(t)?Oo(t):t)??[]}async function Eu(n,t,e,r){let s=(await Pi({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=wu(s),c=[];for(let u=i;u<s.params.length;u+=1)c.push(Oo(s.params[u],{allowGenerics:!0}));return{typeParameters:s.generic_type_params,parameters:c}}function Su(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 io(e,s,r,o)}function io(n,t,e,r){return bu(n)?(Tu(t,n,e),n):Oy(n,t,e,r)}function Oy(n,t,e,r){if(t.isBool()){if(Au(n))return new Xe(n);$e("boolean",e)}if(t.isAddress()){if(so(n))return F.fromString(n);$e("string | AccountAddress",e)}if(t.isU8()){if(As(n))return new lt(n);$e("number",e)}if(t.isU16()){if(As(n))return new Mt(n);$e("number",e)}if(t.isU32()){if(As(n))return new Gt(n);$e("number",e)}if(t.isU64()){if(xs(n))return new ft(BigInt(n));$e("bigint | number | string",e)}if(t.isU128()){if(xs(n))return new Lt(BigInt(n));$e("bigint | number | string",e)}if(t.isU256()){if(xs(n))return new qt(BigInt(n));$e("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 io(n,r[o],e,r)}if(t.isVector()){if(t.value.isU8()){if(so(n))return Le.U8(Ry.encode(n));if(n instanceof Uint8Array)return Le.U8(n);if(n instanceof ArrayBuffer)return Le.U8(new Uint8Array(n))}if(Array.isArray(n))return new Le(n.map(o=>io(o,t.value,e,r)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(so(n))return new yt(n);$e("string",e)}if(t.isObject()){if(so(n))return F.fromString(n);$e("string | AccountAddress",e)}if(t.isOption())return xu(n)?new Bn(null):new Bn(io(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 Tu(n,t,e){if(n.isBool()){if(Xi(t))return;$e("Bool",e)}if(n.isAddress()){if(bs(t))return;$e("AccountAddress",e)}if(n.isU8()){if(ea(t))return;$e("U8",e)}if(n.isU16()){if(ta(t))return;$e("U16",e)}if(n.isU32()){if(na(t))return;$e("U32",e)}if(n.isU64()){if(ra(t))return;$e("U64",e)}if(n.isU128()){if(oa(t))return;$e("U128",e)}if(n.isU256()){if(sa(t))return;$e("U256",e)}if(n.isVector()){if(t instanceof Le){t.values.length>0&&Tu(n.value,t.values[0],e);return}$e("MoveVector",e)}if(n instanceof Kn){if(n.isString()){if(Ji(t))return;$e("MoveString",e)}if(n.isObject()){if(bs(t))return;$e("AccountAddress",e)}if(n.isOption()){if(t instanceof Bn){t.value!==void 0&&Tu(n.value.typeArgs[0],t.value,e);return}$e("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${n.toString()}'`)}async function Ts(n){if(ia(n))return jl(n);let{moduleAddress:t,moduleName:e,functionName:r}=aa(n.function),o=await xo(async()=>Eu(t,e,r,n.aptosConfig),`entry-function-${n.aptosConfig.network}-${t}-${e}-${r}`,1e3*60*5)();return Vl(n,o)}function Vl(n,t){if(ia(n))return jl(n);let{moduleAddress:e,moduleName:r,functionName:o}=aa(n.function),s=_u(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)=>Su(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=oo.build(`${e}::${r}`,o,s,i);if("multisigAddress"in n){let u=F.from(n.multisigAddress);return new Io(new Po(u,new Ro(c)))}return new Uo(c)}function jl(n){return new Co(new Bo(Be.fromHexInput(n.bytecode).toUint8Array(),n.typeArguments??[],n.functionArguments))}async function Wl(n){let{aptosConfig:t,sender:e,payload:r,options:o}=n,s=o?.accountSequenceNumber!==void 0?Promise.resolve({sequence_number:o.accountSequenceNumber}):hn({aptosConfig:t,accountAddress:e}),i=Vs[t.network]?Promise.resolve({chain_id:Vs[t.network]}):Ci({aptosConfig:t}),c=o?.gasUnitPrice?Promise.resolve({gas_estimate:o.gasUnitPrice}):Oi({aptosConfig:t}),[{sequence_number:u},{chain_id:d},{gas_estimate:h}]=await Promise.all([s,i,c]),{maxGasAmount:g,gasUnitPrice:T,expireTimestamp:S}={maxGasAmount:o?.maxGasAmount?BigInt(o.maxGasAmount):BigInt(qa),gasUnitPrice:BigInt(h),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+Ka),...o};return new Wt(F.from(e),BigInt(u),r,BigInt(g),BigInt(T),BigInt(S),new jr(d))}async function ca(n){let{aptosConfig:t,sender:e,payload:r,options:o}=n,s=await Wl({aptosConfig:t,sender:e,payload:r,options:o});if("secondarySignerAddresses"in n){let i=n.secondarySignerAddresses?.map(c=>F.from(c))??[];return{rawTransaction:s,secondarySignerAddresses:i,feePayerAddress:n.feePayerAddress?F.from(n.feePayerAddress):void 0}}return{rawTransaction:s,feePayerAddress:n.feePayerAddress?F.from(n.feePayerAddress):void 0}}function vu(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:r,feePayerPublicKey:o}=n,s=ws(t);if(e.feePayerAddress){let c=new Tn(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress),u=[];r&&(u=r.map(g=>ws(g)));let d=ws(o),h=new $r(s,e.secondarySignerAddresses??[],u,{address:e.feePayerAddress,authenticator:d});return new un(c.raw_txn,h).bcsToBytes()}if(e.secondarySignerAddresses){let c=new wn(e.rawTransaction,e.secondarySignerAddresses),u=[];u=r.map(h=>ws(h));let d=new Hr(s,e.secondarySignerAddresses,u);return new un(c.raw_txn,d).bcsToBytes()}let i;if(s instanceof An)i=new Fr(s.public_key,s.signature);else if(s instanceof cn)i=new Vr(s);else throw new Error("Invalid public key");return new un(e.rawTransaction,i).bcsToBytes()}function ws(n){if(n instanceof je){if(n.publicKey instanceof qe)return new cn(n,new mn(new Je(new Uint8Array(64))));if(n.publicKey instanceof Vt)return new cn(n,new mn(new Mn(new Uint8Array(64))))}return new An(new qe(n.toUint8Array()),new Je(new Uint8Array(64)))}function Cu(n){let{signer:t,transaction:e}=n,r=ua(e),o=t.sign(r);switch(t.signingScheme){case 0:return new An(new qe(t.publicKey.toUint8Array()),new Je(o.toUint8Array()));case 2:if(!je.isPublicKey(t.publicKey))throw new Error(`Cannot sign transaction, public key does not match ${t.signingScheme}`);return new cn(t.publicKey,new mn(o));default:throw new Error(`Cannot sign transaction, signing scheme ${t.signingScheme} not supported`)}}function Uu(n){let{transaction:t,senderAuthenticator:e,feePayerAuthenticator:r,additionalSignersAuthenticators:o}=n,s=Iu(t);if((r||o)&&(s instanceof wn||s instanceof Tn))return Ql(s,e,r,o);if(e instanceof An&&s instanceof Wt){let i=new Fr(e.public_key,e.signature);return new un(s,i).bcsToBytes()}if((e instanceof cn||e instanceof Kr)&&s instanceof Wt){let i=new Vr(e);return new un(s,i).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${e} is not a supported account authentication scheme`)}function Iu(n){return n.feePayerAddress?new Tn(n.rawTransaction,n.secondarySignerAddresses??[],n.feePayerAddress):n.secondarySignerAddresses?new wn(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function Ql(n,t,e,r){if(n instanceof Tn){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let o=new $r(t,n.secondary_signer_addresses,r??[],{address:n.fee_payer_address,authenticator:e});return new un(n.raw_txn,o).bcsToBytes()}if(n instanceof wn){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let o=new Hr(t,n.secondary_signer_addresses,r??[]);return new un(n.raw_txn,o).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof n} transaction is not supported`)}function ua(n){let t=Iu(n),e=Ir.create();if(t instanceof Wt)e.update(Fa);else if(t instanceof wn)e.update(js);else if(t instanceof Tn)e.update(js);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 Pe(n){let t=await Ny(n);return ky(n,t)}async function Ny(n){let{aptosConfig:t,data:e}=n,r,o;return"bytecode"in e?(r=e,o=await Ts(r)):"multisigAddress"in e?(r={aptosConfig:t,multisigAddress:e.multisigAddress,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await Ts(r)):(r={aptosConfig:t,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await Ts(r)),o}async function ky(n,t){let{aptosConfig:e,sender:r,options:o}=n,s;if(zy(n)&&(s=F.ZERO.toString()),Dy(n)){let{secondarySignerAddresses:i}=n;return ca({aptosConfig:e,sender:r,payload:t,options:o,secondarySignerAddresses:i,feePayerAddress:s})}return ca({aptosConfig:e,sender:r,payload:t,options:o,feePayerAddress:s})}function zy(n){return n.withFeePayer===!0}function Dy(n){return"secondarySignerAddresses"in n}function Yl(n){let{transaction:t}=n;return ua(t)}function fa(n){return Cu({...n})}async function Bu(n){let{aptosConfig:t,transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:i}=n,c=vu({transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:i}),{data:u}=await Er({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 da(n){let{aptosConfig:t}=n,e=Uu({...n}),{data:r}=await Er({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function _s(n){let{aptosConfig:t,signer:e,transaction:r}=n,o=fa({signer:e,transaction:r});return da({aptosConfig:t,transaction:r,senderAuthenticator:o})}async function Zl(n){let{aptosConfig:t,account:e,metadataBytes:r,moduleBytecode:o,options:s}=n,i=o.map(u=>Le.U8(u));return await Pe({aptosConfig:t,sender:F.from(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[Le.U8(r),new Le(i)]},options:s})}async function Xl(n){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:r}=n,o=await hn({aptosConfig:t,accountAddress:e.accountAddress}),s=Ln.fromPrivateKey({privateKey:r,legacy:!0}),c=new gs({sequenceNumber:BigInt(o.sequence_number),originator:e.accountAddress,currentAuthKey:F.from(o.authentication_key),newPublicKey:s.publicKey}).bcsToBytes(),u=e.sign(c),d=s.sign(c),h=await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new lt(e.signingScheme.valueOf()),Le.U8(e.publicKey.toUint8Array()),new lt(s.signingScheme.valueOf()),Le.U8(s.publicKey.toUint8Array()),Le.U8(u.toUint8Array()),Le.U8(d.toUint8Array())]}});return await _s({aptosConfig:t,signer:e,transaction:h})}async function Jl(n){let{aptosConfig:t,sender:e,recipient:r,amount:o,coinType:s,options:i}=n;return await Pe({aptosConfig:t,sender:e,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[s??jo],functionArguments:[r,o]},options:i})}var Es=class{constructor(t){this.config=t}async transferCoinTransaction(t){return Jl({aptosConfig:this.config,...t})}};var yr={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},Qt="0x4::token::Token";async function ep(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:F.from(e).toStringLong()}};return(await Se({aptosConfig:t,query:{query:Md,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function tp(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:F.from(e).toStringLong()}};return(await Se({aptosConfig:t,query:{query:$c,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function np(n){let{aptosConfig:t,ownerAddress:e,options:r}=n,o={owner_address:{_eq:F.from(e).toStringLong()},amount:{_gt:0}},s={query:$c,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 rp(n){let{aptosConfig:t,digitalAssetAddress:e,options:r}=n,o={token_data_id:{_eq:F.from(e).toStringLong()}},s={query:Dd,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}async function op(n){let{aptosConfig:t,options:e,creator:r}=n;return await Pe({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new yt(n.description),new ft(n.maxSupply??Cr),new yt(n.name),new yt(n.uri),new Xe(n.mutableDescription??!0),new Xe(n.mutableRoyalty??!0),new Xe(n.mutableURI??!0),new Xe(n.mutableTokenDescription??!0),new Xe(n.mutableTokenName??!0),new Xe(n.mutableTokenProperties??!0),new Xe(n.mutableTokenURI??!0),new Xe(n.tokensBurnableByCreator??!0),new Xe(n.tokensFreezableByCreator??!0),new ft(n.royaltyNumerator??0),new ft(n.royaltyDenominator??1)]},options:e})}async function Pu(n){let{aptosConfig:t,creatorAddress:e,collectionName:r,options:o}=n,s=F.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:Pd,variables:{where_condition:i}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function sp(n){return(await Pu(n)).collection_id}async function ip(n){let{aptosConfig:t,options:e,creator:r,collection:o,description:s,name:i,uri:c,propertyKeys:u,propertyTypes:d,propertyValues:h}=n,g=d?.map(S=>yr[S]);return await Pe({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[o,s,i,c,u??[],g??[],bp(h??[],g??[])]},options:e})}async function ap(n){let{aptosConfig:t,sender:e,digitalAssetAddress:r,recipient:o,digitalAssetType:s,options:i}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[s??Qt],functionArguments:[r,o]},options:i})}async function cp(n){let{aptosConfig:t,account:e,collection:r,description:o,name:s,uri:i,recipient:c,propertyKeys:u,propertyTypes:d,propertyValues:h,options:g}=n;if(u?.length!==h?.length)throw new Error("Property keys and property values counts do not match");if(d?.length!==h?.length)throw new Error("Property types and property values counts do not match");let T=d?.map(b=>yr[b]);return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,o,s,i,u??[],T??[],bp(h??[],T??[]),c]},options:g})}async function up(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:o,options:s}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[o??Qt],functionArguments:[r]},options:s})}async function fp(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:o,options:s}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[o??Qt],functionArguments:[r]},options:s})}async function dp(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:o,options:s}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[o??Qt],functionArguments:[r]},options:s})}async function lp(n){let{aptosConfig:t,creator:e,description:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[s??Qt],functionArguments:[o,r]},options:i})}async function pp(n){let{aptosConfig:t,creator:e,name:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[s??Qt],functionArguments:[o,r]},options:i})}async function gp(n){let{aptosConfig:t,creator:e,uri:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[s??Qt],functionArguments:[o,r]},options:i})}async function mp(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:u}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[c??Qt],functionArguments:[i,r,yr[o],Ru(s,yr[o])]},options:u})}async function hp(n){let{aptosConfig:t,creator:e,propertyKey:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[s??Qt],functionArguments:[o,r]},options:i})}async function yp(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:u}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[c??Qt],functionArguments:[i,r,yr[o],Ru(s,yr[o])]},options:u})}async function Ap(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:u}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[c??Qt,yr[o]],functionArguments:[i,r,s]},options:u})}async function xp(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:u}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[c??Qt,yr[o]],functionArguments:[i,r,s]},options:u})}function bp(n,t){let e=new Array;return t.forEach((r,o)=>{e.push(Ru(n[o],r))}),e}function Ru(n,t){let e=Oo(t);return io(n,e,0,[]).bcsToBytes()}var Ss=class{constructor(t){this.config=t}async getCollectionData(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Pu({aptosConfig:this.config,...t})}async getCollectionId(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),sp({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ep({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),tp({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),np({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),rp({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return op({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return ip({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return ap({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return cp({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return up({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return fp({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return dp({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return lp({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return pp({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return gp({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return mp({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return hp({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return yp({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return Ap({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return xp({aptosConfig:this.config,...t})}};async function wp(n){let{accountAddress:t,aptosConfig:e,creationNumber:r}=n,s={account_address:{_eq:F.from(t).toStringLong()},creation_number:{_eq:r}};return la({aptosConfig:e,options:{where:s}})}async function Tp(n){let{accountAddress:t,aptosConfig:e,eventType:r,options:o}=n,c={where:{account_address:{_eq:F.from(t).toStringLong()},indexed_type:{_eq:r}},pagination:o,orderBy:o?.orderBy};return la({aptosConfig:e,options:c})}async function la(n){let{aptosConfig:t,options:e}=n,r={query:Nd,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 vs=class{constructor(t){this.config=t}async getAccountEventsByCreationNumber(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),wp({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),Tp({aptosConfig:this.config,...t})}async getEvents(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"events_processor"}),la({aptosConfig:this.config,...t})}};async function _p(n){let{aptosConfig:t,accountAddress:e,amount:r,options:o}=n,s=o?.timeoutSecs||Vo,{data:i}=await Va({aptosConfig:t,path:"fund",body:{address:F.from(e).toString(),amount:r},originMethod:"fundAccount"}),c=i.txn_hashes[0],u=await bo({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 Cs=class{constructor(t){this.config=t}async fundAccount(t){let e=await _p({aptosConfig:this.config,...t});return t.options?.waitForIndexer!==!1&&await ki({aptosConfig:this.config,minimumLedgerVersion:BigInt(e.version)}),e}};async function Ou(n){let{aptosConfig:t,options:e}=n,r={query:zd,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 Ep(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 Sp(n){let{aptosConfig:t,options:e}=n,r={query:Rd,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await Se({aptosConfig:t,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}async function vp(n){let{aptosConfig:t,sender:e,fungibleAssetMetadataAddress:r,recipient:o,amount:s,options:i}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,o,s]},options:i})}var Us=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Ou({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),(await Ou({aptosConfig:this.config,options:{where:{asset_type:{_eq:t.assetType}}}}))[0]}async getFungibleAssetActivities(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Ep({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Sp({aptosConfig:this.config,...t})}async transferFungibleAsset(t){return vp({aptosConfig:this.config,...t})}};var Is=class{constructor(t){this.config=t}async getLedgerInfo(){return Ci({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return Gd({aptosConfig:this.config,...t})}async getBlockByHeight(t){return Ld({aptosConfig:this.config,...t})}async getTableItem(t){return Ui({aptosConfig:this.config,...t})}async view(t){return fr({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return qd({aptosConfig:this.config,...t})}async queryIndexer(t){return Se({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return Ii({aptosConfig:this.config})}async getProcessorStatus(t){return Bi({aptosConfig:this.config,processorType:t})}};var Cp=["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 Up(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Ar(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(!Up(t))throw new Error(`${t} is not valid. ${Cp}`);if(e&&!Up(e))throw new Error(`${e} is not valid. ${Cp}`);return{domainName:e||t,subdomainName:e?t:void 0}}var My="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Gy={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:My,custom:null,devnet:null};function Fn(n){let t=Gy[n.network];if(!t)throw new Error(`The ANS contract is not deployed to ${n.network}`);return t}var Ly=n=>({vec:[n]}),qy=()=>({vec:[]}),Nu=n=>n!=null?Ly(n):qy(),pa=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Ip(n){let{aptosConfig:t,name:e}=n,r=Fn(t),{domainName:o,subdomainName:s}=Ar(e),i=await fr({aptosConfig:t,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[o,Nu(s)]}}),c=pa(i[0]);return c?F.from(c).toString():void 0}async function Bp(n){let{aptosConfig:t,expiration:e,name:r,sender:o,targetAddress:s,toAddress:i,options:c,transferable:u}=n,d=Fn(t),{domainName:h,subdomainName:g}=Ar(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 Pe({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${d}::router::register_domain`,functionArguments:[h,k,s,i]},options:c})}if(!g)throw new Error(`${e.policy} requires a subdomain to be provided.`);let S=await ku({aptosConfig:t,name:h});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 Pe({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${d}::router::register_subdomain`,functionArguments:[h,g,Math.round(b/1e3),e.policy==="subdomain:follow-domain"?1:0,!!u,s,i]},options:c})}async function ku(n){let{aptosConfig:t,name:e}=n,r=Fn(t),{domainName:o,subdomainName:s}=Ar(e);try{let i=await fr({aptosConfig:t,payload:{function:`${r}::router::get_expiration`,functionArguments:[o,Nu(s)]}});return Number(i[0])*1e3}catch{return}}async function Pp(n){let{aptosConfig:t,address:e}=n,r=Fn(t),o=await fr({aptosConfig:t,payload:{function:`${r}::router::get_primary_name`,functionArguments:[F.from(e).toString()]}}),s=pa(o[1]),i=pa(o[0]);if(s)return[i,s].filter(Boolean).join(".")}async function Rp(n){let{aptosConfig:t,sender:e,name:r,options:o}=n,s=Fn(t);if(!r)return await Pe({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:o});let{domainName:i,subdomainName:c}=Ar(r);return await Pe({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[i,c]},options:o})}async function Op(n){let{aptosConfig:t,name:e}=n,r=Fn(t),{domainName:o,subdomainName:s}=Ar(e),i=await fr({aptosConfig:t,payload:{function:`${r}::router::get_target_addr`,functionArguments:[o,Nu(s)]}}),c=pa(i[0]);return c?F.from(c).toString():void 0}async function Np(n){let{aptosConfig:t,sender:e,name:r,address:o,options:s}=n,i=Fn(t),{domainName:c,subdomainName:u}=Ar(r);return await Pe({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::set_target_addr`,functionArguments:[c,u,o]},options:s})}async function kp(n){let{aptosConfig:t,name:e}=n,{domainName:r,subdomainName:o=""}=Ar(e),c=(await Se({aptosConfig:t,query:{query:Ao,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:o}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return c&&(c=Bs(c)),c}async function zp(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await zu({aptosConfig:t});return(await Se({aptosConfig:t,originMethod:"getAccountNames",query:{query:Ao,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(Bs)}async function Dp(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await zu({aptosConfig:t});return(await Se({aptosConfig:t,originMethod:"getAccountDomains",query:{query:Ao,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(Bs)}async function Mp(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await zu({aptosConfig:t});return(await Se({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:Ao,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(Bs)}async function Gp(n){let{aptosConfig:t,options:e,domain:r}=n;return(await Se({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:Ao,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(Bs)}async function zu(n){let{aptosConfig:t}=n,e=Fn(t),[r]=await fr({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 Lp(n){let{aptosConfig:t,sender:e,name:r,years:o=1,options:s}=n,i=Fn(t),c=o*31536e3,{domainName:u,subdomainName:d}=Ar(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 Pe({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::renew_domain`,functionArguments:[u,c]},options:s})}function Bs(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).valueOf()}}var Ps=class{constructor(t){this.config=t}async getOwnerAddress(t){return Ip({aptosConfig:this.config,...t})}async getExpiration(t){return ku({aptosConfig:this.config,...t})}async getTargetAddress(t){return Op({aptosConfig:this.config,...t})}async setTargetAddress(t){return Np({aptosConfig:this.config,...t})}async getPrimaryName(t){return Pp({aptosConfig:this.config,...t})}async setPrimaryName(t){return Rp({aptosConfig:this.config,...t})}async registerName(t){return Bp({aptosConfig:this.config,...t})}async renewDomain(t){return Lp({aptosConfig:this.config,...t})}async getName(t){return kp({aptosConfig:this.config,...t})}async getAccountNames(t){return zp({aptosConfig:this.config,...t})}async getAccountDomains(t){return Dp({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return Mp({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return Gp({aptosConfig:this.config,...t})}};async function qp(n){let{aptosConfig:t,poolAddress:e}=n,r=F.from(e).toStringLong(),s=await Se({aptosConfig:t,query:{query:Fc,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 Kp(n){let{aptosConfig:t,options:e}=n,r={query:Fc,variables:{order_by:e?.orderBy}};return(await Se({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function Fp(n){let{aptosConfig:t,delegatorAddress:e,poolAddress:r}=n,o={query:Od,variables:{delegatorAddress:F.from(e).toStringLong(),poolAddress:F.from(r).toStringLong()}};return(await Se({aptosConfig:t,query:o})).delegated_staking_activities}var Rs=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"stake_processor"}),qp({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"stake_processor"}),Kp({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"stake_processor"}),Fp({aptosConfig:this.config,...t})}};var ga=class{constructor(t){this.config=t}async simple(t){return Pe({aptosConfig:this.config,...t})}async multiAgent(t){return Pe({aptosConfig:this.config,...t})}};function Du(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 Mu(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 No=class{constructor(t){this.config=t}async simple(t){return Bu({aptosConfig:this.config,...t})}async multiAgent(t){return Bu({aptosConfig:this.config,...t})}};Ct([Mu],No.prototype,"simple",1),Ct([Mu],No.prototype,"multiAgent",1);var ko=class{constructor(t){this.config=t}async simple(t){return da({aptosConfig:this.config,...t})}async multiAgent(t){return da({aptosConfig:this.config,...t})}};Ct([Du],ko.prototype,"simple",1),Ct([Du],ko.prototype,"multiAgent",1);var Vp=Zu($p(),1);var ha=Vp.default;var ya=()=>Math.floor(Date.now()/1e3),Ns=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 dr(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=ya();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await dr(this.sleepTime),ya()-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 hn({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await hn({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 dr(this.sleepTime);this.lock=!0;try{await this.update();let t=ya();for(;this.lastUncommintedNumber!==this.currentNumber;)ya()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await dr(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 zo=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 Do("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},Do=class extends Error{};var Lu="fulfilled",qu=(s=>(s.TransactionSent="transactionSent",s.TransactionSendFailed="transactionSendFailed",s.TransactionExecuted="transactionExecuted",s.TransactionExecutionFailed="transactionExecutionFailed",s.ExecutionFinish="executionFinish",s))(qu||{}),ks=class extends ha{constructor(e,r,o=30,s=100,i=10){super();this.taskQueue=new zo;this.transactionsQueue=new zo;this.outstandingTransactions=new zo;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=e,this.account=r,this.started=!1,this.accountSequnceNumber=new Ns(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=_s({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([o,e])}}catch(e){if(e instanceof Do)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===Lu?(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 Do)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async checkTransaction(e,r){try{let o=[];o.push(bo({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===Lu?(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){await this.transactionsQueue.enqueue([e,r])}async generateNextTransaction(e,r){if(this.transactionsQueue.isEmpty())return;let[o,s]=await this.transactionsQueue.dequeue();return await Pe({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 Aa=class extends ha{constructor(e){super();this.config=e}start(e){let{sender:r}=e;this.account=r,this.transactionWorker=new ks(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 zs=class{constructor(t){this.config=t,this.build=new ga(this.config),this.simulate=new No(this.config),this.submit=new ko(this.config),this.batch=new Aa(this.config)}async getTransactions(t){return nl({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return rl({aptosConfig:this.config,...t})}async getTransactionByHash(t){return Ni({aptosConfig:this.config,...t})}async isPendingTransaction(t){return ol({aptosConfig:this.config,...t})}async waitForTransaction(t){return bo({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return Oi({aptosConfig:this.config})}getSigningMessage(t){return Yl(t)}async publishPackageTransaction(t){return Zl({aptosConfig:this.config,...t})}async rotateAuthKey(t){return Xl({aptosConfig:this.config,...t})}sign(t){return fa({...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,fa({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 _s({aptosConfig:this.config,signer:e,transaction:r})}};var zt=class{constructor(t){this.config=new ps(t),this.account=new rs(this.config),this.ans=new Ps(this.config),this.coin=new Es(this.config),this.digitalAsset=new Ss(this.config),this.event=new vs(this.config),this.faucet=new Cs(this.config),this.fungibleAsset=new Us(this.config),this.general=new Is(this.config),this.staking=new Rs(this.config),this.transaction=new zs(this.config)}};function _n(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))})}_n(zt,rs,"account");_n(zt,Ps,"ans");_n(zt,Es,"coin");_n(zt,Ss,"digitalAsset");_n(zt,vs,"event");_n(zt,Cs,"faucet");_n(zt,Us,"fungibleAsset");_n(zt,Is,"general");_n(zt,Rs,"staking");_n(zt,zs,"transaction");return tg(Hy);})();
|
|
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);})();
|
|
431
431
|
/*! Bundled license information:
|
|
432
432
|
|
|
433
433
|
@noble/hashes/esm/utils.js:
|