@aptos-labs/ts-sdk 0.0.6 → 0.0.7
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/README.md +9 -4
- package/dist/browser/index.d.ts +564 -338
- package/dist/browser/index.global.js +46 -25
- package/dist/browser/index.global.js.map +1 -1
- package/dist/common/index.d.ts +564 -338
- package/dist/common/index.js +45 -24
- package/dist/common/index.js.map +1 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +212 -18
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +8 -0
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/coin.d.mts +2 -2
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +3 -3
- 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.d.mts +4 -0
- 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.d.mts +53 -0
- package/dist/esm/api/transactionSubmission/build.mjs +2 -0
- package/dist/esm/api/transactionSubmission/build.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission/sign.d.mts +50 -0
- package/dist/esm/api/transactionSubmission/sign.mjs +2 -0
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission/simulate.d.mts +53 -0
- package/dist/esm/api/transactionSubmission/simulate.mjs +2 -0
- package/dist/esm/api/transactionSubmission/simulate.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission/submit.d.mts +51 -0
- package/dist/esm/api/transactionSubmission/submit.mjs +2 -0
- package/dist/esm/api/transactionSubmission/submit.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission.d.mts +9 -60
- package/dist/esm/api/transactionSubmission.mjs +1 -1
- package/dist/esm/{chunk-NGCFPQ22.mjs → chunk-2OZRBXLM.mjs} +2 -2
- package/dist/esm/{chunk-TQD4IGUM.mjs → chunk-33T7WTB6.mjs} +2 -2
- package/dist/esm/chunk-3732I6BR.mjs +2 -0
- package/dist/esm/chunk-3732I6BR.mjs.map +1 -0
- package/dist/esm/chunk-3VZ3OZKC.mjs +2 -0
- package/dist/esm/chunk-3VZ3OZKC.mjs.map +1 -0
- package/dist/esm/chunk-4KTQIWUP.mjs +2 -0
- package/dist/esm/chunk-4KTQIWUP.mjs.map +1 -0
- package/dist/esm/chunk-5LO7FR2P.mjs +2 -0
- package/dist/esm/chunk-5LO7FR2P.mjs.map +1 -0
- package/dist/esm/{chunk-Q6N6QACD.mjs → chunk-67OGU66P.mjs} +2 -2
- package/dist/esm/{chunk-V45RFKH7.mjs → chunk-72F5YXGC.mjs} +2 -2
- package/dist/esm/chunk-72F5YXGC.mjs.map +1 -0
- package/dist/esm/{chunk-2W744GUN.mjs → chunk-BFQRMCY2.mjs} +2 -2
- package/dist/esm/{chunk-WKY5ENCK.mjs → chunk-BM4HBROC.mjs} +2 -2
- package/dist/esm/chunk-DRPMIJH7.mjs +2 -0
- package/dist/esm/chunk-DRPMIJH7.mjs.map +1 -0
- package/dist/esm/{chunk-UPLWWSB4.mjs → chunk-GAI75GOG.mjs} +2 -2
- package/dist/esm/{chunk-7MNEEVXY.mjs → chunk-GU4OUKAF.mjs} +2 -2
- package/dist/esm/{chunk-EQ5BEDJ7.mjs → chunk-HO7K2UAK.mjs} +2 -2
- package/dist/esm/{chunk-U3LO2FSJ.mjs → chunk-IBH7IOIM.mjs} +2 -2
- package/dist/esm/{chunk-R26XML3D.mjs → chunk-J5BH7V37.mjs} +2 -2
- package/dist/esm/chunk-L7AA75WZ.mjs +2 -0
- package/dist/esm/chunk-L7AA75WZ.mjs.map +1 -0
- package/dist/esm/chunk-LACQ537H.mjs +2 -0
- package/dist/esm/{chunk-NYFVEKF6.mjs.map → chunk-LACQ537H.mjs.map} +1 -1
- package/dist/esm/{chunk-EGOYLZBU.mjs → chunk-LDAD54H5.mjs} +2 -2
- package/dist/esm/chunk-LXW3A3MJ.mjs +2 -0
- package/dist/esm/chunk-LXW3A3MJ.mjs.map +1 -0
- package/dist/esm/{chunk-4RVIA63I.mjs → chunk-M2V2POWK.mjs} +2 -2
- package/dist/esm/{chunk-3JVGSFHP.mjs → chunk-ND3ZQKTT.mjs} +2 -2
- package/dist/esm/chunk-O2B54NZT.mjs +2 -0
- package/dist/esm/chunk-O2B54NZT.mjs.map +1 -0
- package/dist/esm/chunk-OCW2L33Q.mjs +2 -0
- package/dist/esm/chunk-OCW2L33Q.mjs.map +1 -0
- package/dist/esm/{chunk-VMQWW5UT.mjs → chunk-OCYS4V2V.mjs} +2 -2
- package/dist/esm/{chunk-BWMNPUTK.mjs → chunk-OSTH5JRX.mjs} +2 -2
- package/dist/esm/chunk-OSTH5JRX.mjs.map +1 -0
- package/dist/esm/{chunk-Z2UDRTHA.mjs → chunk-OVHY6ZUJ.mjs} +2 -2
- package/dist/esm/chunk-PZCMSHY6.mjs +2 -0
- package/dist/esm/{chunk-P32MY5YF.mjs → chunk-RHS5ROLP.mjs} +2 -2
- package/dist/esm/chunk-RHS5ROLP.mjs.map +1 -0
- package/dist/esm/{chunk-BFSEVKNA.mjs → chunk-RKKU2SY5.mjs} +2 -2
- package/dist/esm/chunk-TGKB6ALT.mjs +2 -0
- package/dist/esm/chunk-TGKB6ALT.mjs.map +1 -0
- package/dist/esm/{chunk-GEFQFRL3.mjs → chunk-TPWSHFFI.mjs} +2 -2
- package/dist/esm/{chunk-WX43AJTD.mjs → chunk-UDBH4CER.mjs} +42 -21
- package/dist/esm/chunk-UDBH4CER.mjs.map +1 -0
- package/dist/esm/{chunk-VYAVLUPJ.mjs → chunk-WEJAI26R.mjs} +2 -2
- package/dist/esm/{chunk-JDS7K2WI.mjs → chunk-WL4OXZLN.mjs} +2 -2
- package/dist/esm/{chunk-AAIBCWZY.mjs → chunk-Y2HRRUZ6.mjs} +2 -2
- package/dist/esm/{chunk-J5ZFOJN2.mjs → chunk-ZLW65YCO.mjs} +2 -2
- package/dist/esm/chunk-ZUHN56GM.mjs +2 -0
- package/dist/esm/chunk-ZUHN56GM.mjs.map +1 -0
- 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/authenticationKey.mjs +1 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +6 -2
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +80 -13
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +2 -2
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +3 -3
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.d.mts +3 -3
- 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.d.mts +2 -2
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +13 -44
- 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/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.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 +3 -6
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- 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 +15 -41
- package/dist/esm/types/generated/operations.d.mts +28 -2
- package/dist/esm/types/generated/queries.d.mts +5 -2
- package/dist/esm/types/generated/queries.mjs +1 -1
- package/dist/esm/types/index.d.mts +1 -1
- package/dist/esm/types/indexer.d.mts +3 -2
- package/package.json +1 -1
- package/src/api/ans.ts +250 -11
- package/src/api/aptos.ts +20 -0
- package/src/api/coin.ts +2 -2
- package/src/api/digitalAsset.ts +3 -3
- package/src/api/transactionSubmission/build.ts +42 -0
- package/src/api/transactionSubmission/sign.ts +44 -0
- package/src/api/transactionSubmission/simulate.ts +56 -0
- package/src/api/transactionSubmission/submit.ts +53 -0
- package/src/api/transactionSubmission.ts +4 -143
- package/src/internal/ans.ts +406 -20
- package/src/internal/coin.ts +3 -3
- package/src/internal/digitalAsset.ts +5 -5
- package/src/internal/queries/ansTokenFragment.graphql +9 -0
- package/src/internal/queries/getNames.graphql +11 -0
- package/src/internal/transactionSubmission.ts +29 -21
- package/src/transactions/transactionBuilder/transactionBuilder.ts +20 -43
- package/src/transactions/types.ts +14 -45
- package/src/types/generated/operations.ts +29 -0
- package/src/types/generated/queries.ts +34 -0
- package/src/types/indexer.ts +3 -0
- package/dist/esm/chunk-BP5ZO7NK.mjs +0 -2
- package/dist/esm/chunk-BP5ZO7NK.mjs.map +0 -1
- package/dist/esm/chunk-BWMNPUTK.mjs.map +0 -1
- package/dist/esm/chunk-EYXHVA6W.mjs +0 -2
- package/dist/esm/chunk-EYXHVA6W.mjs.map +0 -1
- package/dist/esm/chunk-IG5CHHSI.mjs +0 -2
- package/dist/esm/chunk-IG5CHHSI.mjs.map +0 -1
- package/dist/esm/chunk-IXMB2GOK.mjs +0 -2
- package/dist/esm/chunk-IXMB2GOK.mjs.map +0 -1
- package/dist/esm/chunk-NTD3H2S4.mjs +0 -2
- package/dist/esm/chunk-NTD3H2S4.mjs.map +0 -1
- package/dist/esm/chunk-NYFVEKF6.mjs +0 -2
- package/dist/esm/chunk-P32MY5YF.mjs.map +0 -1
- package/dist/esm/chunk-UNQNACJT.mjs +0 -2
- package/dist/esm/chunk-V45RFKH7.mjs.map +0 -1
- package/dist/esm/chunk-VOYW2TZW.mjs +0 -2
- package/dist/esm/chunk-VOYW2TZW.mjs.map +0 -1
- package/dist/esm/chunk-WX43AJTD.mjs.map +0 -1
- package/dist/esm/chunk-Y5DJPHJT.mjs +0 -2
- package/dist/esm/chunk-Y5DJPHJT.mjs.map +0 -1
- /package/dist/esm/{chunk-NGCFPQ22.mjs.map → chunk-2OZRBXLM.mjs.map} +0 -0
- /package/dist/esm/{chunk-TQD4IGUM.mjs.map → chunk-33T7WTB6.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q6N6QACD.mjs.map → chunk-67OGU66P.mjs.map} +0 -0
- /package/dist/esm/{chunk-2W744GUN.mjs.map → chunk-BFQRMCY2.mjs.map} +0 -0
- /package/dist/esm/{chunk-WKY5ENCK.mjs.map → chunk-BM4HBROC.mjs.map} +0 -0
- /package/dist/esm/{chunk-UPLWWSB4.mjs.map → chunk-GAI75GOG.mjs.map} +0 -0
- /package/dist/esm/{chunk-7MNEEVXY.mjs.map → chunk-GU4OUKAF.mjs.map} +0 -0
- /package/dist/esm/{chunk-EQ5BEDJ7.mjs.map → chunk-HO7K2UAK.mjs.map} +0 -0
- /package/dist/esm/{chunk-U3LO2FSJ.mjs.map → chunk-IBH7IOIM.mjs.map} +0 -0
- /package/dist/esm/{chunk-R26XML3D.mjs.map → chunk-J5BH7V37.mjs.map} +0 -0
- /package/dist/esm/{chunk-EGOYLZBU.mjs.map → chunk-LDAD54H5.mjs.map} +0 -0
- /package/dist/esm/{chunk-4RVIA63I.mjs.map → chunk-M2V2POWK.mjs.map} +0 -0
- /package/dist/esm/{chunk-3JVGSFHP.mjs.map → chunk-ND3ZQKTT.mjs.map} +0 -0
- /package/dist/esm/{chunk-VMQWW5UT.mjs.map → chunk-OCYS4V2V.mjs.map} +0 -0
- /package/dist/esm/{chunk-Z2UDRTHA.mjs.map → chunk-OVHY6ZUJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-UNQNACJT.mjs.map → chunk-PZCMSHY6.mjs.map} +0 -0
- /package/dist/esm/{chunk-BFSEVKNA.mjs.map → chunk-RKKU2SY5.mjs.map} +0 -0
- /package/dist/esm/{chunk-GEFQFRL3.mjs.map → chunk-TPWSHFFI.mjs.map} +0 -0
- /package/dist/esm/{chunk-VYAVLUPJ.mjs.map → chunk-WEJAI26R.mjs.map} +0 -0
- /package/dist/esm/{chunk-JDS7K2WI.mjs.map → chunk-WL4OXZLN.mjs.map} +0 -0
- /package/dist/esm/{chunk-AAIBCWZY.mjs.map → chunk-Y2HRRUZ6.mjs.map} +0 -0
- /package/dist/esm/{chunk-J5ZFOJN2.mjs.map → chunk-ZLW65YCO.mjs.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var aptosSDK=(()=>{var Fd=Object.create;var Zn=Object.defineProperty;var Za=Object.getOwnPropertyDescriptor;var Kd=Object.getOwnPropertyNames;var Hd=Object.getPrototypeOf,$d=Object.prototype.hasOwnProperty;var Ja=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var we=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),ec=(r,t)=>{for(var e in t)Zn(r,e,{get:t[e],enumerable:!0})},tc=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Kd(t))!$d.call(r,o)&&o!==e&&Zn(r,o,{get:()=>t[o],enumerable:!(n=Za(t,o))||n.enumerable});return r};var rc=(r,t,e)=>(e=r!=null?Fd(Hd(r)):{},tc(t||!r||!r.__esModule?Zn(e,"default",{value:r,enumerable:!0}):e,r)),Vd=r=>tc(Zn({},"__esModule",{value:!0}),r),wr=(r,t,e,n)=>{for(var o=n>1?void 0:n?Za(t,e):t,s=r.length-1,c;s>=0;s--)(c=r[s])&&(o=(n?c(t,e,o):c(o))||o);return n&&o&&Zn(t,e,o),o};var Ec=we(()=>{"use strict"});var Sc=we((oy,ri)=>{"use strict";(function(r){"use strict";var t=function(a){var d,f=new Float64Array(16);if(a)for(d=0;d<a.length;d++)f[d]=a[d];return f},e=function(){throw new Error("no PRNG")},n=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var s=t(),c=t([1]),u=t([56129,1]),p=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=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]),x=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),_=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function T(a,d,f,i){a[d]=f>>24&255,a[d+1]=f>>16&255,a[d+2]=f>>8&255,a[d+3]=f&255,a[d+4]=i>>24&255,a[d+5]=i>>16&255,a[d+6]=i>>8&255,a[d+7]=i&255}function N(a,d,f,i,l){var m,A=0;for(m=0;m<l;m++)A|=a[d+m]^f[i+m];return(1&A-1>>>8)-1}function E(a,d,f,i){return N(a,d,f,i,16)}function R(a,d,f,i){return N(a,d,f,i,32)}function P(a,d,f,i){for(var l=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,m=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,A=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,S=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,B=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,V=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,D=d[0]&255|(d[1]&255)<<8|(d[2]&255)<<16|(d[3]&255)<<24,Te=d[4]&255|(d[5]&255)<<8|(d[6]&255)<<16|(d[7]&255)<<24,G=d[8]&255|(d[9]&255)<<8|(d[10]&255)<<16|(d[11]&255)<<24,te=d[12]&255|(d[13]&255)<<8|(d[14]&255)<<16|(d[15]&255)<<24,re=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,ue=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,ce=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,ne=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,ie=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,oe=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,F=l,W=m,q=A,H=S,$=B,M=V,b=D,w=Te,C=G,v=te,U=re,I=ue,Y=ce,fe=ne,le=ie,de=oe,g,he=0;he<20;he+=2)g=F+Y|0,$^=g<<7|g>>>32-7,g=$+F|0,C^=g<<9|g>>>32-9,g=C+$|0,Y^=g<<13|g>>>32-13,g=Y+C|0,F^=g<<18|g>>>32-18,g=M+W|0,v^=g<<7|g>>>32-7,g=v+M|0,fe^=g<<9|g>>>32-9,g=fe+v|0,W^=g<<13|g>>>32-13,g=W+fe|0,M^=g<<18|g>>>32-18,g=U+b|0,le^=g<<7|g>>>32-7,g=le+U|0,q^=g<<9|g>>>32-9,g=q+le|0,b^=g<<13|g>>>32-13,g=b+q|0,U^=g<<18|g>>>32-18,g=de+I|0,H^=g<<7|g>>>32-7,g=H+de|0,w^=g<<9|g>>>32-9,g=w+H|0,I^=g<<13|g>>>32-13,g=I+w|0,de^=g<<18|g>>>32-18,g=F+H|0,W^=g<<7|g>>>32-7,g=W+F|0,q^=g<<9|g>>>32-9,g=q+W|0,H^=g<<13|g>>>32-13,g=H+q|0,F^=g<<18|g>>>32-18,g=M+$|0,b^=g<<7|g>>>32-7,g=b+M|0,w^=g<<9|g>>>32-9,g=w+b|0,$^=g<<13|g>>>32-13,g=$+w|0,M^=g<<18|g>>>32-18,g=U+v|0,I^=g<<7|g>>>32-7,g=I+U|0,C^=g<<9|g>>>32-9,g=C+I|0,v^=g<<13|g>>>32-13,g=v+C|0,U^=g<<18|g>>>32-18,g=de+le|0,Y^=g<<7|g>>>32-7,g=Y+de|0,fe^=g<<9|g>>>32-9,g=fe+Y|0,le^=g<<13|g>>>32-13,g=le+fe|0,de^=g<<18|g>>>32-18;F=F+l|0,W=W+m|0,q=q+A|0,H=H+S|0,$=$+B|0,M=M+V|0,b=b+D|0,w=w+Te|0,C=C+G|0,v=v+te|0,U=U+re|0,I=I+ue|0,Y=Y+ce|0,fe=fe+ne|0,le=le+ie|0,de=de+oe|0,a[0]=F>>>0&255,a[1]=F>>>8&255,a[2]=F>>>16&255,a[3]=F>>>24&255,a[4]=W>>>0&255,a[5]=W>>>8&255,a[6]=W>>>16&255,a[7]=W>>>24&255,a[8]=q>>>0&255,a[9]=q>>>8&255,a[10]=q>>>16&255,a[11]=q>>>24&255,a[12]=H>>>0&255,a[13]=H>>>8&255,a[14]=H>>>16&255,a[15]=H>>>24&255,a[16]=$>>>0&255,a[17]=$>>>8&255,a[18]=$>>>16&255,a[19]=$>>>24&255,a[20]=M>>>0&255,a[21]=M>>>8&255,a[22]=M>>>16&255,a[23]=M>>>24&255,a[24]=b>>>0&255,a[25]=b>>>8&255,a[26]=b>>>16&255,a[27]=b>>>24&255,a[28]=w>>>0&255,a[29]=w>>>8&255,a[30]=w>>>16&255,a[31]=w>>>24&255,a[32]=C>>>0&255,a[33]=C>>>8&255,a[34]=C>>>16&255,a[35]=C>>>24&255,a[36]=v>>>0&255,a[37]=v>>>8&255,a[38]=v>>>16&255,a[39]=v>>>24&255,a[40]=U>>>0&255,a[41]=U>>>8&255,a[42]=U>>>16&255,a[43]=U>>>24&255,a[44]=I>>>0&255,a[45]=I>>>8&255,a[46]=I>>>16&255,a[47]=I>>>24&255,a[48]=Y>>>0&255,a[49]=Y>>>8&255,a[50]=Y>>>16&255,a[51]=Y>>>24&255,a[52]=fe>>>0&255,a[53]=fe>>>8&255,a[54]=fe>>>16&255,a[55]=fe>>>24&255,a[56]=le>>>0&255,a[57]=le>>>8&255,a[58]=le>>>16&255,a[59]=le>>>24&255,a[60]=de>>>0&255,a[61]=de>>>8&255,a[62]=de>>>16&255,a[63]=de>>>24&255}function Q(a,d,f,i){for(var l=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,m=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,A=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,S=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,B=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,V=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,D=d[0]&255|(d[1]&255)<<8|(d[2]&255)<<16|(d[3]&255)<<24,Te=d[4]&255|(d[5]&255)<<8|(d[6]&255)<<16|(d[7]&255)<<24,G=d[8]&255|(d[9]&255)<<8|(d[10]&255)<<16|(d[11]&255)<<24,te=d[12]&255|(d[13]&255)<<8|(d[14]&255)<<16|(d[15]&255)<<24,re=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,ue=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,ce=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,ne=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,ie=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,oe=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,F=l,W=m,q=A,H=S,$=B,M=V,b=D,w=Te,C=G,v=te,U=re,I=ue,Y=ce,fe=ne,le=ie,de=oe,g,he=0;he<20;he+=2)g=F+Y|0,$^=g<<7|g>>>32-7,g=$+F|0,C^=g<<9|g>>>32-9,g=C+$|0,Y^=g<<13|g>>>32-13,g=Y+C|0,F^=g<<18|g>>>32-18,g=M+W|0,v^=g<<7|g>>>32-7,g=v+M|0,fe^=g<<9|g>>>32-9,g=fe+v|0,W^=g<<13|g>>>32-13,g=W+fe|0,M^=g<<18|g>>>32-18,g=U+b|0,le^=g<<7|g>>>32-7,g=le+U|0,q^=g<<9|g>>>32-9,g=q+le|0,b^=g<<13|g>>>32-13,g=b+q|0,U^=g<<18|g>>>32-18,g=de+I|0,H^=g<<7|g>>>32-7,g=H+de|0,w^=g<<9|g>>>32-9,g=w+H|0,I^=g<<13|g>>>32-13,g=I+w|0,de^=g<<18|g>>>32-18,g=F+H|0,W^=g<<7|g>>>32-7,g=W+F|0,q^=g<<9|g>>>32-9,g=q+W|0,H^=g<<13|g>>>32-13,g=H+q|0,F^=g<<18|g>>>32-18,g=M+$|0,b^=g<<7|g>>>32-7,g=b+M|0,w^=g<<9|g>>>32-9,g=w+b|0,$^=g<<13|g>>>32-13,g=$+w|0,M^=g<<18|g>>>32-18,g=U+v|0,I^=g<<7|g>>>32-7,g=I+U|0,C^=g<<9|g>>>32-9,g=C+I|0,v^=g<<13|g>>>32-13,g=v+C|0,U^=g<<18|g>>>32-18,g=de+le|0,Y^=g<<7|g>>>32-7,g=Y+de|0,fe^=g<<9|g>>>32-9,g=fe+Y|0,le^=g<<13|g>>>32-13,g=le+fe|0,de^=g<<18|g>>>32-18;a[0]=F>>>0&255,a[1]=F>>>8&255,a[2]=F>>>16&255,a[3]=F>>>24&255,a[4]=M>>>0&255,a[5]=M>>>8&255,a[6]=M>>>16&255,a[7]=M>>>24&255,a[8]=U>>>0&255,a[9]=U>>>8&255,a[10]=U>>>16&255,a[11]=U>>>24&255,a[12]=de>>>0&255,a[13]=de>>>8&255,a[14]=de>>>16&255,a[15]=de>>>24&255,a[16]=b>>>0&255,a[17]=b>>>8&255,a[18]=b>>>16&255,a[19]=b>>>24&255,a[20]=w>>>0&255,a[21]=w>>>8&255,a[22]=w>>>16&255,a[23]=w>>>24&255,a[24]=C>>>0&255,a[25]=C>>>8&255,a[26]=C>>>16&255,a[27]=C>>>24&255,a[28]=v>>>0&255,a[29]=v>>>8&255,a[30]=v>>>16&255,a[31]=v>>>24&255}function z(a,d,f,i){P(a,d,f,i)}function ee(a,d,f,i){Q(a,d,f,i)}var L=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function j(a,d,f,i,l,m,A){var S=new Uint8Array(16),B=new Uint8Array(64),V,D;for(D=0;D<16;D++)S[D]=0;for(D=0;D<8;D++)S[D]=m[D];for(;l>=64;){for(z(B,S,A,L),D=0;D<64;D++)a[d+D]=f[i+D]^B[D];for(V=1,D=8;D<16;D++)V=V+(S[D]&255)|0,S[D]=V&255,V>>>=8;l-=64,d+=64,i+=64}if(l>0)for(z(B,S,A,L),D=0;D<l;D++)a[d+D]=f[i+D]^B[D];return 0}function J(a,d,f,i,l){var m=new Uint8Array(16),A=new Uint8Array(64),S,B;for(B=0;B<16;B++)m[B]=0;for(B=0;B<8;B++)m[B]=i[B];for(;f>=64;){for(z(A,m,l,L),B=0;B<64;B++)a[d+B]=A[B];for(S=1,B=8;B<16;B++)S=S+(m[B]&255)|0,m[B]=S&255,S>>>=8;f-=64,d+=64}if(f>0)for(z(A,m,l,L),B=0;B<f;B++)a[d+B]=A[B];return 0}function X(a,d,f,i,l){var m=new Uint8Array(32);ee(m,i,l,L);for(var A=new Uint8Array(8),S=0;S<8;S++)A[S]=i[S+16];return J(a,d,f,A,m)}function Re(a,d,f,i,l,m,A){var S=new Uint8Array(32);ee(S,m,A,L);for(var B=new Uint8Array(8),V=0;V<8;V++)B[V]=m[V+16];return j(a,d,f,i,l,B,S)}var xe=function(a){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 d,f,i,l,m,A,S,B;d=a[0]&255|(a[1]&255)<<8,this.r[0]=d&8191,f=a[2]&255|(a[3]&255)<<8,this.r[1]=(d>>>13|f<<3)&8191,i=a[4]&255|(a[5]&255)<<8,this.r[2]=(f>>>10|i<<6)&7939,l=a[6]&255|(a[7]&255)<<8,this.r[3]=(i>>>7|l<<9)&8191,m=a[8]&255|(a[9]&255)<<8,this.r[4]=(l>>>4|m<<12)&255,this.r[5]=m>>>1&8190,A=a[10]&255|(a[11]&255)<<8,this.r[6]=(m>>>14|A<<2)&8191,S=a[12]&255|(a[13]&255)<<8,this.r[7]=(A>>>11|S<<5)&8065,B=a[14]&255|(a[15]&255)<<8,this.r[8]=(S>>>8|B<<8)&8191,this.r[9]=B>>>5&127,this.pad[0]=a[16]&255|(a[17]&255)<<8,this.pad[1]=a[18]&255|(a[19]&255)<<8,this.pad[2]=a[20]&255|(a[21]&255)<<8,this.pad[3]=a[22]&255|(a[23]&255)<<8,this.pad[4]=a[24]&255|(a[25]&255)<<8,this.pad[5]=a[26]&255|(a[27]&255)<<8,this.pad[6]=a[28]&255|(a[29]&255)<<8,this.pad[7]=a[30]&255|(a[31]&255)<<8};xe.prototype.blocks=function(a,d,f){for(var i=this.fin?0:2048,l,m,A,S,B,V,D,Te,G,te,re,ue,ce,ne,ie,oe,F,W,q,H=this.h[0],$=this.h[1],M=this.h[2],b=this.h[3],w=this.h[4],C=this.h[5],v=this.h[6],U=this.h[7],I=this.h[8],Y=this.h[9],fe=this.r[0],le=this.r[1],de=this.r[2],g=this.r[3],he=this.r[4],ve=this.r[5],_e=this.r[6],ge=this.r[7],Ae=this.r[8],be=this.r[9];f>=16;)l=a[d+0]&255|(a[d+1]&255)<<8,H+=l&8191,m=a[d+2]&255|(a[d+3]&255)<<8,$+=(l>>>13|m<<3)&8191,A=a[d+4]&255|(a[d+5]&255)<<8,M+=(m>>>10|A<<6)&8191,S=a[d+6]&255|(a[d+7]&255)<<8,b+=(A>>>7|S<<9)&8191,B=a[d+8]&255|(a[d+9]&255)<<8,w+=(S>>>4|B<<12)&8191,C+=B>>>1&8191,V=a[d+10]&255|(a[d+11]&255)<<8,v+=(B>>>14|V<<2)&8191,D=a[d+12]&255|(a[d+13]&255)<<8,U+=(V>>>11|D<<5)&8191,Te=a[d+14]&255|(a[d+15]&255)<<8,I+=(D>>>8|Te<<8)&8191,Y+=Te>>>5|i,G=0,te=G,te+=H*fe,te+=$*(5*be),te+=M*(5*Ae),te+=b*(5*ge),te+=w*(5*_e),G=te>>>13,te&=8191,te+=C*(5*ve),te+=v*(5*he),te+=U*(5*g),te+=I*(5*de),te+=Y*(5*le),G+=te>>>13,te&=8191,re=G,re+=H*le,re+=$*fe,re+=M*(5*be),re+=b*(5*Ae),re+=w*(5*ge),G=re>>>13,re&=8191,re+=C*(5*_e),re+=v*(5*ve),re+=U*(5*he),re+=I*(5*g),re+=Y*(5*de),G+=re>>>13,re&=8191,ue=G,ue+=H*de,ue+=$*le,ue+=M*fe,ue+=b*(5*be),ue+=w*(5*Ae),G=ue>>>13,ue&=8191,ue+=C*(5*ge),ue+=v*(5*_e),ue+=U*(5*ve),ue+=I*(5*he),ue+=Y*(5*g),G+=ue>>>13,ue&=8191,ce=G,ce+=H*g,ce+=$*de,ce+=M*le,ce+=b*fe,ce+=w*(5*be),G=ce>>>13,ce&=8191,ce+=C*(5*Ae),ce+=v*(5*ge),ce+=U*(5*_e),ce+=I*(5*ve),ce+=Y*(5*he),G+=ce>>>13,ce&=8191,ne=G,ne+=H*he,ne+=$*g,ne+=M*de,ne+=b*le,ne+=w*fe,G=ne>>>13,ne&=8191,ne+=C*(5*be),ne+=v*(5*Ae),ne+=U*(5*ge),ne+=I*(5*_e),ne+=Y*(5*ve),G+=ne>>>13,ne&=8191,ie=G,ie+=H*ve,ie+=$*he,ie+=M*g,ie+=b*de,ie+=w*le,G=ie>>>13,ie&=8191,ie+=C*fe,ie+=v*(5*be),ie+=U*(5*Ae),ie+=I*(5*ge),ie+=Y*(5*_e),G+=ie>>>13,ie&=8191,oe=G,oe+=H*_e,oe+=$*ve,oe+=M*he,oe+=b*g,oe+=w*de,G=oe>>>13,oe&=8191,oe+=C*le,oe+=v*fe,oe+=U*(5*be),oe+=I*(5*Ae),oe+=Y*(5*ge),G+=oe>>>13,oe&=8191,F=G,F+=H*ge,F+=$*_e,F+=M*ve,F+=b*he,F+=w*g,G=F>>>13,F&=8191,F+=C*de,F+=v*le,F+=U*fe,F+=I*(5*be),F+=Y*(5*Ae),G+=F>>>13,F&=8191,W=G,W+=H*Ae,W+=$*ge,W+=M*_e,W+=b*ve,W+=w*he,G=W>>>13,W&=8191,W+=C*g,W+=v*de,W+=U*le,W+=I*fe,W+=Y*(5*be),G+=W>>>13,W&=8191,q=G,q+=H*be,q+=$*Ae,q+=M*ge,q+=b*_e,q+=w*ve,G=q>>>13,q&=8191,q+=C*he,q+=v*g,q+=U*de,q+=I*le,q+=Y*fe,G+=q>>>13,q&=8191,G=(G<<2)+G|0,G=G+te|0,te=G&8191,G=G>>>13,re+=G,H=te,$=re,M=ue,b=ce,w=ne,C=ie,v=oe,U=F,I=W,Y=q,d+=16,f-=16;this.h[0]=H,this.h[1]=$,this.h[2]=M,this.h[3]=b,this.h[4]=w,this.h[5]=C,this.h[6]=v,this.h[7]=U,this.h[8]=I,this.h[9]=Y},xe.prototype.finish=function(a,d){var f=new Uint16Array(10),i,l,m,A;if(this.leftover){for(A=this.leftover,this.buffer[A++]=1;A<16;A++)this.buffer[A]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(i=this.h[1]>>>13,this.h[1]&=8191,A=2;A<10;A++)this.h[A]+=i,i=this.h[A]>>>13,this.h[A]&=8191;for(this.h[0]+=i*5,i=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=i,i=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=i,f[0]=this.h[0]+5,i=f[0]>>>13,f[0]&=8191,A=1;A<10;A++)f[A]=this.h[A]+i,i=f[A]>>>13,f[A]&=8191;for(f[9]-=8192,l=(i^1)-1,A=0;A<10;A++)f[A]&=l;for(l=~l,A=0;A<10;A++)this.h[A]=this.h[A]&l|f[A];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,m=this.h[0]+this.pad[0],this.h[0]=m&65535,A=1;A<8;A++)m=(this.h[A]+this.pad[A]|0)+(m>>>16)|0,this.h[A]=m&65535;a[d+0]=this.h[0]>>>0&255,a[d+1]=this.h[0]>>>8&255,a[d+2]=this.h[1]>>>0&255,a[d+3]=this.h[1]>>>8&255,a[d+4]=this.h[2]>>>0&255,a[d+5]=this.h[2]>>>8&255,a[d+6]=this.h[3]>>>0&255,a[d+7]=this.h[3]>>>8&255,a[d+8]=this.h[4]>>>0&255,a[d+9]=this.h[4]>>>8&255,a[d+10]=this.h[5]>>>0&255,a[d+11]=this.h[5]>>>8&255,a[d+12]=this.h[6]>>>0&255,a[d+13]=this.h[6]>>>8&255,a[d+14]=this.h[7]>>>0&255,a[d+15]=this.h[7]>>>8&255},xe.prototype.update=function(a,d,f){var i,l;if(this.leftover){for(l=16-this.leftover,l>f&&(l=f),i=0;i<l;i++)this.buffer[this.leftover+i]=a[d+i];if(f-=l,d+=l,this.leftover+=l,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(f>=16&&(l=f-f%16,this.blocks(a,d,l),d+=l,f-=l),f){for(i=0;i<f;i++)this.buffer[this.leftover+i]=a[d+i];this.leftover+=f}};function ye(a,d,f,i,l,m){var A=new xe(m);return A.update(f,i,l),A.finish(a,d),0}function Ve(a,d,f,i,l,m){var A=new Uint8Array(16);return ye(A,0,f,i,l,m),E(a,d,A,0)}function Qe(a,d,f,i,l){var m;if(f<32)return-1;for(Re(a,0,d,0,f,i,l),ye(a,16,a,32,f-32,a),m=0;m<16;m++)a[m]=0;return 0}function dt(a,d,f,i,l){var m,A=new Uint8Array(32);if(f<32||(X(A,0,32,i,l),Ve(d,16,d,32,f-32,A)!==0))return-1;for(Re(a,0,d,0,f,i,l),m=0;m<32;m++)a[m]=0;return 0}function O(a,d){var f;for(f=0;f<16;f++)a[f]=d[f]|0}function K(a){var d,f,i=1;for(d=0;d<16;d++)f=a[d]+i+65535,i=Math.floor(f/65536),a[d]=f-i*65536;a[0]+=i-1+37*(i-1)}function se(a,d,f){for(var i,l=~(f-1),m=0;m<16;m++)i=l&(a[m]^d[m]),a[m]^=i,d[m]^=i}function Ee(a,d){var f,i,l,m=t(),A=t();for(f=0;f<16;f++)A[f]=d[f];for(K(A),K(A),K(A),i=0;i<2;i++){for(m[0]=A[0]-65517,f=1;f<15;f++)m[f]=A[f]-65535-(m[f-1]>>16&1),m[f-1]&=65535;m[15]=A[15]-32767-(m[14]>>16&1),l=m[15]>>16&1,m[14]&=65535,se(A,m,1-l)}for(f=0;f<16;f++)a[2*f]=A[f]&255,a[2*f+1]=A[f]>>8}function Se(a,d){var f=new Uint8Array(32),i=new Uint8Array(32);return Ee(f,a),Ee(i,d),R(f,0,i,0)}function je(a){var d=new Uint8Array(32);return Ee(d,a),d[0]&1}function ot(a,d){var f;for(f=0;f<16;f++)a[f]=d[2*f]+(d[2*f+1]<<8);a[15]&=32767}function ke(a,d,f){for(var i=0;i<16;i++)a[i]=d[i]+f[i]}function Xe(a,d,f){for(var i=0;i<16;i++)a[i]=d[i]-f[i]}function ae(a,d,f){var i,l,m=0,A=0,S=0,B=0,V=0,D=0,Te=0,G=0,te=0,re=0,ue=0,ce=0,ne=0,ie=0,oe=0,F=0,W=0,q=0,H=0,$=0,M=0,b=0,w=0,C=0,v=0,U=0,I=0,Y=0,fe=0,le=0,de=0,g=f[0],he=f[1],ve=f[2],_e=f[3],ge=f[4],Ae=f[5],be=f[6],We=f[7],Ue=f[8],Me=f[9],De=f[10],qe=f[11],Je=f[12],st=f[13],at=f[14],ct=f[15];i=d[0],m+=i*g,A+=i*he,S+=i*ve,B+=i*_e,V+=i*ge,D+=i*Ae,Te+=i*be,G+=i*We,te+=i*Ue,re+=i*Me,ue+=i*De,ce+=i*qe,ne+=i*Je,ie+=i*st,oe+=i*at,F+=i*ct,i=d[1],A+=i*g,S+=i*he,B+=i*ve,V+=i*_e,D+=i*ge,Te+=i*Ae,G+=i*be,te+=i*We,re+=i*Ue,ue+=i*Me,ce+=i*De,ne+=i*qe,ie+=i*Je,oe+=i*st,F+=i*at,W+=i*ct,i=d[2],S+=i*g,B+=i*he,V+=i*ve,D+=i*_e,Te+=i*ge,G+=i*Ae,te+=i*be,re+=i*We,ue+=i*Ue,ce+=i*Me,ne+=i*De,ie+=i*qe,oe+=i*Je,F+=i*st,W+=i*at,q+=i*ct,i=d[3],B+=i*g,V+=i*he,D+=i*ve,Te+=i*_e,G+=i*ge,te+=i*Ae,re+=i*be,ue+=i*We,ce+=i*Ue,ne+=i*Me,ie+=i*De,oe+=i*qe,F+=i*Je,W+=i*st,q+=i*at,H+=i*ct,i=d[4],V+=i*g,D+=i*he,Te+=i*ve,G+=i*_e,te+=i*ge,re+=i*Ae,ue+=i*be,ce+=i*We,ne+=i*Ue,ie+=i*Me,oe+=i*De,F+=i*qe,W+=i*Je,q+=i*st,H+=i*at,$+=i*ct,i=d[5],D+=i*g,Te+=i*he,G+=i*ve,te+=i*_e,re+=i*ge,ue+=i*Ae,ce+=i*be,ne+=i*We,ie+=i*Ue,oe+=i*Me,F+=i*De,W+=i*qe,q+=i*Je,H+=i*st,$+=i*at,M+=i*ct,i=d[6],Te+=i*g,G+=i*he,te+=i*ve,re+=i*_e,ue+=i*ge,ce+=i*Ae,ne+=i*be,ie+=i*We,oe+=i*Ue,F+=i*Me,W+=i*De,q+=i*qe,H+=i*Je,$+=i*st,M+=i*at,b+=i*ct,i=d[7],G+=i*g,te+=i*he,re+=i*ve,ue+=i*_e,ce+=i*ge,ne+=i*Ae,ie+=i*be,oe+=i*We,F+=i*Ue,W+=i*Me,q+=i*De,H+=i*qe,$+=i*Je,M+=i*st,b+=i*at,w+=i*ct,i=d[8],te+=i*g,re+=i*he,ue+=i*ve,ce+=i*_e,ne+=i*ge,ie+=i*Ae,oe+=i*be,F+=i*We,W+=i*Ue,q+=i*Me,H+=i*De,$+=i*qe,M+=i*Je,b+=i*st,w+=i*at,C+=i*ct,i=d[9],re+=i*g,ue+=i*he,ce+=i*ve,ne+=i*_e,ie+=i*ge,oe+=i*Ae,F+=i*be,W+=i*We,q+=i*Ue,H+=i*Me,$+=i*De,M+=i*qe,b+=i*Je,w+=i*st,C+=i*at,v+=i*ct,i=d[10],ue+=i*g,ce+=i*he,ne+=i*ve,ie+=i*_e,oe+=i*ge,F+=i*Ae,W+=i*be,q+=i*We,H+=i*Ue,$+=i*Me,M+=i*De,b+=i*qe,w+=i*Je,C+=i*st,v+=i*at,U+=i*ct,i=d[11],ce+=i*g,ne+=i*he,ie+=i*ve,oe+=i*_e,F+=i*ge,W+=i*Ae,q+=i*be,H+=i*We,$+=i*Ue,M+=i*Me,b+=i*De,w+=i*qe,C+=i*Je,v+=i*st,U+=i*at,I+=i*ct,i=d[12],ne+=i*g,ie+=i*he,oe+=i*ve,F+=i*_e,W+=i*ge,q+=i*Ae,H+=i*be,$+=i*We,M+=i*Ue,b+=i*Me,w+=i*De,C+=i*qe,v+=i*Je,U+=i*st,I+=i*at,Y+=i*ct,i=d[13],ie+=i*g,oe+=i*he,F+=i*ve,W+=i*_e,q+=i*ge,H+=i*Ae,$+=i*be,M+=i*We,b+=i*Ue,w+=i*Me,C+=i*De,v+=i*qe,U+=i*Je,I+=i*st,Y+=i*at,fe+=i*ct,i=d[14],oe+=i*g,F+=i*he,W+=i*ve,q+=i*_e,H+=i*ge,$+=i*Ae,M+=i*be,b+=i*We,w+=i*Ue,C+=i*Me,v+=i*De,U+=i*qe,I+=i*Je,Y+=i*st,fe+=i*at,le+=i*ct,i=d[15],F+=i*g,W+=i*he,q+=i*ve,H+=i*_e,$+=i*ge,M+=i*Ae,b+=i*be,w+=i*We,C+=i*Ue,v+=i*Me,U+=i*De,I+=i*qe,Y+=i*Je,fe+=i*st,le+=i*at,de+=i*ct,m+=38*W,A+=38*q,S+=38*H,B+=38*$,V+=38*M,D+=38*b,Te+=38*w,G+=38*C,te+=38*v,re+=38*U,ue+=38*I,ce+=38*Y,ne+=38*fe,ie+=38*le,oe+=38*de,l=1,i=m+l+65535,l=Math.floor(i/65536),m=i-l*65536,i=A+l+65535,l=Math.floor(i/65536),A=i-l*65536,i=S+l+65535,l=Math.floor(i/65536),S=i-l*65536,i=B+l+65535,l=Math.floor(i/65536),B=i-l*65536,i=V+l+65535,l=Math.floor(i/65536),V=i-l*65536,i=D+l+65535,l=Math.floor(i/65536),D=i-l*65536,i=Te+l+65535,l=Math.floor(i/65536),Te=i-l*65536,i=G+l+65535,l=Math.floor(i/65536),G=i-l*65536,i=te+l+65535,l=Math.floor(i/65536),te=i-l*65536,i=re+l+65535,l=Math.floor(i/65536),re=i-l*65536,i=ue+l+65535,l=Math.floor(i/65536),ue=i-l*65536,i=ce+l+65535,l=Math.floor(i/65536),ce=i-l*65536,i=ne+l+65535,l=Math.floor(i/65536),ne=i-l*65536,i=ie+l+65535,l=Math.floor(i/65536),ie=i-l*65536,i=oe+l+65535,l=Math.floor(i/65536),oe=i-l*65536,i=F+l+65535,l=Math.floor(i/65536),F=i-l*65536,m+=l-1+37*(l-1),l=1,i=m+l+65535,l=Math.floor(i/65536),m=i-l*65536,i=A+l+65535,l=Math.floor(i/65536),A=i-l*65536,i=S+l+65535,l=Math.floor(i/65536),S=i-l*65536,i=B+l+65535,l=Math.floor(i/65536),B=i-l*65536,i=V+l+65535,l=Math.floor(i/65536),V=i-l*65536,i=D+l+65535,l=Math.floor(i/65536),D=i-l*65536,i=Te+l+65535,l=Math.floor(i/65536),Te=i-l*65536,i=G+l+65535,l=Math.floor(i/65536),G=i-l*65536,i=te+l+65535,l=Math.floor(i/65536),te=i-l*65536,i=re+l+65535,l=Math.floor(i/65536),re=i-l*65536,i=ue+l+65535,l=Math.floor(i/65536),ue=i-l*65536,i=ce+l+65535,l=Math.floor(i/65536),ce=i-l*65536,i=ne+l+65535,l=Math.floor(i/65536),ne=i-l*65536,i=ie+l+65535,l=Math.floor(i/65536),ie=i-l*65536,i=oe+l+65535,l=Math.floor(i/65536),oe=i-l*65536,i=F+l+65535,l=Math.floor(i/65536),F=i-l*65536,m+=l-1+37*(l-1),a[0]=m,a[1]=A,a[2]=S,a[3]=B,a[4]=V,a[5]=D,a[6]=Te,a[7]=G,a[8]=te,a[9]=re,a[10]=ue,a[11]=ce,a[12]=ne,a[13]=ie,a[14]=oe,a[15]=F}function Ze(a,d){ae(a,d,d)}function xr(a,d){var f=t(),i;for(i=0;i<16;i++)f[i]=d[i];for(i=253;i>=0;i--)Ze(f,f),i!==2&&i!==4&&ae(f,f,d);for(i=0;i<16;i++)a[i]=f[i]}function Rt(a,d){var f=t(),i;for(i=0;i<16;i++)f[i]=d[i];for(i=250;i>=0;i--)Ze(f,f),i!==1&&ae(f,f,d);for(i=0;i<16;i++)a[i]=f[i]}function Ar(a,d,f){var i=new Uint8Array(32),l=new Float64Array(80),m,A,S=t(),B=t(),V=t(),D=t(),Te=t(),G=t();for(A=0;A<31;A++)i[A]=d[A];for(i[31]=d[31]&127|64,i[0]&=248,ot(l,f),A=0;A<16;A++)B[A]=l[A],D[A]=S[A]=V[A]=0;for(S[0]=D[0]=1,A=254;A>=0;--A)m=i[A>>>3]>>>(A&7)&1,se(S,B,m),se(V,D,m),ke(Te,S,V),Xe(S,S,V),ke(V,B,D),Xe(B,B,D),Ze(D,Te),Ze(G,S),ae(S,V,S),ae(V,B,Te),ke(Te,S,V),Xe(S,S,V),Ze(B,S),Xe(V,D,G),ae(S,V,u),ke(S,S,D),ae(V,V,S),ae(S,D,G),ae(D,B,l),Ze(B,Te),se(S,B,m),se(V,D,m);for(A=0;A<16;A++)l[A+16]=S[A],l[A+32]=V[A],l[A+48]=B[A],l[A+64]=D[A];var te=l.subarray(32),re=l.subarray(16);return xr(te,te),ae(re,re,te),Ee(a,re),0}function vt(a,d){return Ar(a,d,o)}function Zt(a,d){return e(d,32),vt(a,d)}function Nr(a,d,f){var i=new Uint8Array(32);return Ar(i,f,d),ee(a,n,i,L)}var mt=Qe,br=dt;function En(a,d,f,i,l,m){var A=new Uint8Array(32);return Nr(A,l,m),mt(a,d,f,i,A)}function No(a,d,f,i,l,m){var A=new Uint8Array(32);return Nr(A,l,m),br(a,d,f,i,A)}var Qn=[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 Va(a,d,f,i){for(var l=new Int32Array(16),m=new Int32Array(16),A,S,B,V,D,Te,G,te,re,ue,ce,ne,ie,oe,F,W,q,H,$,M,b,w,C,v,U,I,Y=a[0],fe=a[1],le=a[2],de=a[3],g=a[4],he=a[5],ve=a[6],_e=a[7],ge=d[0],Ae=d[1],be=d[2],We=d[3],Ue=d[4],Me=d[5],De=d[6],qe=d[7],Je=0;i>=128;){for($=0;$<16;$++)M=8*$+Je,l[$]=f[M+0]<<24|f[M+1]<<16|f[M+2]<<8|f[M+3],m[$]=f[M+4]<<24|f[M+5]<<16|f[M+6]<<8|f[M+7];for($=0;$<80;$++)if(A=Y,S=fe,B=le,V=de,D=g,Te=he,G=ve,te=_e,re=ge,ue=Ae,ce=be,ne=We,ie=Ue,oe=Me,F=De,W=qe,b=_e,w=qe,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=(g>>>14|Ue<<32-14)^(g>>>18|Ue<<32-18)^(Ue>>>41-32|g<<32-(41-32)),w=(Ue>>>14|g<<32-14)^(Ue>>>18|g<<32-18)^(g>>>41-32|Ue<<32-(41-32)),C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,b=g&he^~g&ve,w=Ue&Me^~Ue&De,C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,b=Qn[$*2],w=Qn[$*2+1],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,b=l[$%16],w=m[$%16],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,q=U&65535|I<<16,H=C&65535|v<<16,b=q,w=H,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=(Y>>>28|ge<<32-28)^(ge>>>34-32|Y<<32-(34-32))^(ge>>>39-32|Y<<32-(39-32)),w=(ge>>>28|Y<<32-28)^(Y>>>34-32|ge<<32-(34-32))^(Y>>>39-32|ge<<32-(39-32)),C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,b=Y&fe^Y&le^fe&le,w=ge&Ae^ge&be^Ae&be,C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,te=U&65535|I<<16,W=C&65535|v<<16,b=V,w=ne,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=q,w=H,C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,V=U&65535|I<<16,ne=C&65535|v<<16,fe=A,le=S,de=B,g=V,he=D,ve=Te,_e=G,Y=te,Ae=re,be=ue,We=ce,Ue=ne,Me=ie,De=oe,qe=F,ge=W,$%16===15)for(M=0;M<16;M++)b=l[M],w=m[M],C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=l[(M+9)%16],w=m[(M+9)%16],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,q=l[(M+1)%16],H=m[(M+1)%16],b=(q>>>1|H<<32-1)^(q>>>8|H<<32-8)^q>>>7,w=(H>>>1|q<<32-1)^(H>>>8|q<<32-8)^(H>>>7|q<<32-7),C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,q=l[(M+14)%16],H=m[(M+14)%16],b=(q>>>19|H<<32-19)^(H>>>61-32|q<<32-(61-32))^q>>>6,w=(H>>>19|q<<32-19)^(q>>>61-32|H<<32-(61-32))^(H>>>6|q<<32-6),C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,l[M]=U&65535|I<<16,m[M]=C&65535|v<<16;b=Y,w=ge,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=a[0],w=d[0],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,a[0]=Y=U&65535|I<<16,d[0]=ge=C&65535|v<<16,b=fe,w=Ae,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=a[1],w=d[1],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,a[1]=fe=U&65535|I<<16,d[1]=Ae=C&65535|v<<16,b=le,w=be,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=a[2],w=d[2],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,a[2]=le=U&65535|I<<16,d[2]=be=C&65535|v<<16,b=de,w=We,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=a[3],w=d[3],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,a[3]=de=U&65535|I<<16,d[3]=We=C&65535|v<<16,b=g,w=Ue,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=a[4],w=d[4],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,a[4]=g=U&65535|I<<16,d[4]=Ue=C&65535|v<<16,b=he,w=Me,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=a[5],w=d[5],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,a[5]=he=U&65535|I<<16,d[5]=Me=C&65535|v<<16,b=ve,w=De,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=a[6],w=d[6],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,a[6]=ve=U&65535|I<<16,d[6]=De=C&65535|v<<16,b=_e,w=qe,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=a[7],w=d[7],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,a[7]=_e=U&65535|I<<16,d[7]=qe=C&65535|v<<16,Je+=128,i-=128}return i}function Mr(a,d,f){var i=new Int32Array(8),l=new Int32Array(8),m=new Uint8Array(256),A,S=f;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,l[0]=4089235720,l[1]=2227873595,l[2]=4271175723,l[3]=1595750129,l[4]=2917565137,l[5]=725511199,l[6]=4215389547,l[7]=327033209,Va(i,l,d,f),f%=128,A=0;A<f;A++)m[A]=d[S-f+A];for(m[f]=128,f=256-128*(f<112?1:0),m[f-9]=0,T(m,f-8,S/536870912|0,S<<3),Va(i,l,m,f),A=0;A<8;A++)T(a,8*A,i[A],l[A]);return 0}function Mo(a,d){var f=t(),i=t(),l=t(),m=t(),A=t(),S=t(),B=t(),V=t(),D=t();Xe(f,a[1],a[0]),Xe(D,d[1],d[0]),ae(f,f,D),ke(i,a[0],a[1]),ke(D,d[0],d[1]),ae(i,i,D),ae(l,a[3],d[3]),ae(l,l,h),ae(m,a[2],d[2]),ke(m,m,m),Xe(A,i,f),Xe(S,m,l),ke(B,m,l),ke(V,i,f),ae(a[0],A,S),ae(a[1],V,B),ae(a[2],B,S),ae(a[3],A,V)}function Qa(a,d,f){var i;for(i=0;i<4;i++)se(a[i],d[i],f)}function ji(a,d){var f=t(),i=t(),l=t();xr(l,d[2]),ae(f,d[0],l),ae(i,d[1],l),Ee(a,i),a[31]^=je(f)<<7}function Wi(a,d,f){var i,l;for(O(a[0],s),O(a[1],c),O(a[2],c),O(a[3],s),l=255;l>=0;--l)i=f[l/8|0]>>(l&7)&1,Qa(a,d,i),Mo(d,a),Mo(a,a),Qa(a,d,i)}function Do(a,d){var f=[t(),t(),t(),t()];O(f[0],y),O(f[1],x),O(f[2],c),ae(f[3],y,x),Wi(a,f,d)}function Yi(a,d,f){var i=new Uint8Array(64),l=[t(),t(),t(),t()],m;for(f||e(d,32),Mr(i,d,32),i[0]&=248,i[31]&=127,i[31]|=64,Do(l,i),ji(a,l),m=0;m<32;m++)d[m+32]=a[m];return 0}var qo=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 Xi(a,d){var f,i,l,m;for(i=63;i>=32;--i){for(f=0,l=i-32,m=i-12;l<m;++l)d[l]+=f-16*d[i]*qo[l-(i-32)],f=Math.floor((d[l]+128)/256),d[l]-=f*256;d[l]+=f,d[i]=0}for(f=0,l=0;l<32;l++)d[l]+=f-(d[31]>>4)*qo[l],f=d[l]>>8,d[l]&=255;for(l=0;l<32;l++)d[l]-=f*qo[l];for(i=0;i<32;i++)d[i+1]+=d[i]>>8,a[i]=d[i]&255}function Zi(a){var d=new Float64Array(64),f;for(f=0;f<64;f++)d[f]=a[f];for(f=0;f<64;f++)a[f]=0;Xi(a,d)}function ja(a,d,f,i){var l=new Uint8Array(64),m=new Uint8Array(64),A=new Uint8Array(64),S,B,V=new Float64Array(64),D=[t(),t(),t(),t()];Mr(l,i,32),l[0]&=248,l[31]&=127,l[31]|=64;var Te=f+64;for(S=0;S<f;S++)a[64+S]=d[S];for(S=0;S<32;S++)a[32+S]=l[32+S];for(Mr(A,a.subarray(32),f+32),Zi(A),Do(D,A),ji(a,D),S=32;S<64;S++)a[S]=i[S];for(Mr(m,a,f+64),Zi(m),S=0;S<64;S++)V[S]=0;for(S=0;S<32;S++)V[S]=A[S];for(S=0;S<32;S++)for(B=0;B<32;B++)V[S+B]+=m[S]*l[B];return Xi(a.subarray(32),V),Te}function Dd(a,d){var f=t(),i=t(),l=t(),m=t(),A=t(),S=t(),B=t();return O(a[2],c),ot(a[1],d),Ze(l,a[1]),ae(m,l,p),Xe(l,l,a[2]),ke(m,a[2],m),Ze(A,m),Ze(S,A),ae(B,S,A),ae(f,B,l),ae(f,f,m),Rt(f,f),ae(f,f,l),ae(f,f,m),ae(f,f,m),ae(a[0],f,m),Ze(i,a[0]),ae(i,i,m),Se(i,l)&&ae(a[0],a[0],_),Ze(i,a[0]),ae(i,i,m),Se(i,l)?-1:(je(a[0])===d[31]>>7&&Xe(a[0],s,a[0]),ae(a[3],a[0],a[1]),0)}function Ji(a,d,f,i){var l,m=new Uint8Array(32),A=new Uint8Array(64),S=[t(),t(),t(),t()],B=[t(),t(),t(),t()];if(f<64||Dd(B,i))return-1;for(l=0;l<f;l++)a[l]=d[l];for(l=0;l<32;l++)a[l+32]=i[l];if(Mr(A,a,f),Zi(A),Wi(S,B,A),Do(B,d.subarray(32)),Mo(S,B),ji(m,S),f-=64,R(d,0,m,0)){for(l=0;l<f;l++)a[l]=0;return-1}for(l=0;l<f;l++)a[l]=d[l+64];return f}var es=32,Go=24,jn=32,Sn=16,Wn=32,Lo=32,Yn=32,Xn=32,ts=32,Wa=Go,qd=jn,Gd=Sn,Jt=64,Dr=32,Un=64,rs=32,ns=64;r.lowlevel={crypto_core_hsalsa20:ee,crypto_stream_xor:Re,crypto_stream:X,crypto_stream_salsa20_xor:j,crypto_stream_salsa20:J,crypto_onetimeauth:ye,crypto_onetimeauth_verify:Ve,crypto_verify_16:E,crypto_verify_32:R,crypto_secretbox:Qe,crypto_secretbox_open:dt,crypto_scalarmult:Ar,crypto_scalarmult_base:vt,crypto_box_beforenm:Nr,crypto_box_afternm:mt,crypto_box:En,crypto_box_open:No,crypto_box_keypair:Zt,crypto_hash:Mr,crypto_sign:ja,crypto_sign_keypair:Yi,crypto_sign_open:Ji,crypto_secretbox_KEYBYTES:es,crypto_secretbox_NONCEBYTES:Go,crypto_secretbox_ZEROBYTES:jn,crypto_secretbox_BOXZEROBYTES:Sn,crypto_scalarmult_BYTES:Wn,crypto_scalarmult_SCALARBYTES:Lo,crypto_box_PUBLICKEYBYTES:Yn,crypto_box_SECRETKEYBYTES:Xn,crypto_box_BEFORENMBYTES:ts,crypto_box_NONCEBYTES:Wa,crypto_box_ZEROBYTES:qd,crypto_box_BOXZEROBYTES:Gd,crypto_sign_BYTES:Jt,crypto_sign_PUBLICKEYBYTES:Dr,crypto_sign_SECRETKEYBYTES:Un,crypto_sign_SEEDBYTES:rs,crypto_hash_BYTES:ns,gf:t,D:p,L:qo,pack25519:Ee,unpack25519:ot,M:ae,A:ke,S:Ze,Z:Xe,pow2523:Rt,add:Mo,set25519:O,modL:Xi,scalarmult:Wi,scalarbase:Do};function Ya(a,d){if(a.length!==es)throw new Error("bad key size");if(d.length!==Go)throw new Error("bad nonce size")}function Ld(a,d){if(a.length!==Yn)throw new Error("bad public key size");if(d.length!==Xn)throw new Error("bad secret key size")}function xt(){for(var a=0;a<arguments.length;a++)if(!(arguments[a]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Xa(a){for(var d=0;d<a.length;d++)a[d]=0}r.randomBytes=function(a){var d=new Uint8Array(a);return e(d,a),d},r.secretbox=function(a,d,f){xt(a,d,f),Ya(f,d);for(var i=new Uint8Array(jn+a.length),l=new Uint8Array(i.length),m=0;m<a.length;m++)i[m+jn]=a[m];return Qe(l,i,i.length,d,f),l.subarray(Sn)},r.secretbox.open=function(a,d,f){xt(a,d,f),Ya(f,d);for(var i=new Uint8Array(Sn+a.length),l=new Uint8Array(i.length),m=0;m<a.length;m++)i[m+Sn]=a[m];return i.length<32||dt(l,i,i.length,d,f)!==0?null:l.subarray(jn)},r.secretbox.keyLength=es,r.secretbox.nonceLength=Go,r.secretbox.overheadLength=Sn,r.scalarMult=function(a,d){if(xt(a,d),a.length!==Lo)throw new Error("bad n size");if(d.length!==Wn)throw new Error("bad p size");var f=new Uint8Array(Wn);return Ar(f,a,d),f},r.scalarMult.base=function(a){if(xt(a),a.length!==Lo)throw new Error("bad n size");var d=new Uint8Array(Wn);return vt(d,a),d},r.scalarMult.scalarLength=Lo,r.scalarMult.groupElementLength=Wn,r.box=function(a,d,f,i){var l=r.box.before(f,i);return r.secretbox(a,d,l)},r.box.before=function(a,d){xt(a,d),Ld(a,d);var f=new Uint8Array(ts);return Nr(f,a,d),f},r.box.after=r.secretbox,r.box.open=function(a,d,f,i){var l=r.box.before(f,i);return r.secretbox.open(a,d,l)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var a=new Uint8Array(Yn),d=new Uint8Array(Xn);return Zt(a,d),{publicKey:a,secretKey:d}},r.box.keyPair.fromSecretKey=function(a){if(xt(a),a.length!==Xn)throw new Error("bad secret key size");var d=new Uint8Array(Yn);return vt(d,a),{publicKey:d,secretKey:new Uint8Array(a)}},r.box.publicKeyLength=Yn,r.box.secretKeyLength=Xn,r.box.sharedKeyLength=ts,r.box.nonceLength=Wa,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(a,d){if(xt(a,d),d.length!==Un)throw new Error("bad secret key size");var f=new Uint8Array(Jt+a.length);return ja(f,a,a.length,d),f},r.sign.open=function(a,d){if(xt(a,d),d.length!==Dr)throw new Error("bad public key size");var f=new Uint8Array(a.length),i=Ji(f,a,a.length,d);if(i<0)return null;for(var l=new Uint8Array(i),m=0;m<l.length;m++)l[m]=f[m];return l},r.sign.detached=function(a,d){for(var f=r.sign(a,d),i=new Uint8Array(Jt),l=0;l<i.length;l++)i[l]=f[l];return i},r.sign.detached.verify=function(a,d,f){if(xt(a,d,f),d.length!==Jt)throw new Error("bad signature size");if(f.length!==Dr)throw new Error("bad public key size");var i=new Uint8Array(Jt+a.length),l=new Uint8Array(Jt+a.length),m;for(m=0;m<Jt;m++)i[m]=d[m];for(m=0;m<a.length;m++)i[m+Jt]=a[m];return Ji(l,i,i.length,f)>=0},r.sign.keyPair=function(){var a=new Uint8Array(Dr),d=new Uint8Array(Un);return Yi(a,d),{publicKey:a,secretKey:d}},r.sign.keyPair.fromSecretKey=function(a){if(xt(a),a.length!==Un)throw new Error("bad secret key size");for(var d=new Uint8Array(Dr),f=0;f<d.length;f++)d[f]=a[32+f];return{publicKey:d,secretKey:new Uint8Array(a)}},r.sign.keyPair.fromSeed=function(a){if(xt(a),a.length!==rs)throw new Error("bad seed size");for(var d=new Uint8Array(Dr),f=new Uint8Array(Un),i=0;i<32;i++)f[i]=a[i];return Yi(d,f,!0),{publicKey:d,secretKey:f}},r.sign.publicKeyLength=Dr,r.sign.secretKeyLength=Un,r.sign.seedLength=rs,r.sign.signatureLength=Jt,r.hash=function(a){xt(a);var d=new Uint8Array(ns);return Mr(d,a,a.length),d},r.hash.hashLength=ns,r.verify=function(a,d){return xt(a,d),a.length===0||d.length===0||a.length!==d.length?!1:N(a,0,d,0,a.length)===0},r.setPRNG=function(a){e=a},function(){var a=typeof self<"u"?self.crypto||self.msCrypto:null;if(a&&a.getRandomValues){var d=65536;r.setPRNG(function(f,i){var l,m=new Uint8Array(i);for(l=0;l<i;l+=d)a.getRandomValues(m.subarray(l,l+Math.min(i-l,d)));for(l=0;l<i;l++)f[l]=m[l];Xa(m)})}else typeof Ja<"u"&&(a=Ec(),a&&a.randomBytes&&r.setPRNG(function(f,i){var l,m=a.randomBytes(i);for(l=0;l<i;l++)f[l]=m[l];Xa(m)}))}()})(typeof ri<"u"&&ri.exports?ri.exports:self.nacl=self.nacl||{})});var sa=we((Ox,Mu)=>{"use strict";Mu.exports=function(t,e){return function(){for(var o=new Array(arguments.length),s=0;s<o.length;s++)o[s]=arguments[s];return t.apply(e,o)}}});var rt=we((zx,Gu)=>{"use strict";var Sp=sa(),ca=Object.prototype.toString,ua=function(r){return function(t){var e=ca.call(t);return r[e]||(r[e]=e.slice(8,-1).toLowerCase())}}(Object.create(null));function sn(r){return r=r.toLowerCase(),function(e){return ua(e)===r}}function fa(r){return Array.isArray(r)}function vi(r){return typeof r>"u"}function Up(r){return r!==null&&!vi(r)&&r.constructor!==null&&!vi(r.constructor)&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}var Du=sn("ArrayBuffer");function Cp(r){var t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(r):t=r&&r.buffer&&Du(r.buffer),t}function Ip(r){return typeof r=="string"}function Bp(r){return typeof r=="number"}function qu(r){return r!==null&&typeof r=="object"}function Ti(r){if(ua(r)!=="object")return!1;var t=Object.getPrototypeOf(r);return t===null||t===Object.prototype}var Rp=sn("Date"),Pp=sn("File"),kp=sn("Blob"),Op=sn("FileList");function da(r){return ca.call(r)==="[object Function]"}function zp(r){return qu(r)&&da(r.pipe)}function Np(r){var t="[object FormData]";return r&&(typeof FormData=="function"&&r instanceof FormData||ca.call(r)===t||da(r.toString)&&r.toString()===t)}var Mp=sn("URLSearchParams");function Dp(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function qp(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function la(r,t){if(!(r===null||typeof r>"u"))if(typeof r!="object"&&(r=[r]),fa(r))for(var e=0,n=r.length;e<n;e++)t.call(null,r[e],e,r);else for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&t.call(null,r[o],o,r)}function aa(){var r={};function t(o,s){Ti(r[s])&&Ti(o)?r[s]=aa(r[s],o):Ti(o)?r[s]=aa({},o):fa(o)?r[s]=o.slice():r[s]=o}for(var e=0,n=arguments.length;e<n;e++)la(arguments[e],t);return r}function Gp(r,t,e){return la(t,function(o,s){e&&typeof o=="function"?r[s]=Sp(o,e):r[s]=o}),r}function Lp(r){return r.charCodeAt(0)===65279&&(r=r.slice(1)),r}function Fp(r,t,e,n){r.prototype=Object.create(t.prototype,n),r.prototype.constructor=r,e&&Object.assign(r.prototype,e)}function Kp(r,t,e){var n,o,s,c={};t=t||{};do{for(n=Object.getOwnPropertyNames(r),o=n.length;o-- >0;)s=n[o],c[s]||(t[s]=r[s],c[s]=!0);r=Object.getPrototypeOf(r)}while(r&&(!e||e(r,t))&&r!==Object.prototype);return t}function Hp(r,t,e){r=String(r),(e===void 0||e>r.length)&&(e=r.length),e-=t.length;var n=r.indexOf(t,e);return n!==-1&&n===e}function $p(r){if(!r)return null;var t=r.length;if(vi(t))return null;for(var e=new Array(t);t-- >0;)e[t]=r[t];return e}var Vp=function(r){return function(t){return r&&t instanceof r}}(typeof Uint8Array<"u"&&Object.getPrototypeOf(Uint8Array));Gu.exports={isArray:fa,isArrayBuffer:Du,isBuffer:Up,isFormData:Np,isArrayBufferView:Cp,isString:Ip,isNumber:Bp,isObject:qu,isPlainObject:Ti,isUndefined:vi,isDate:Rp,isFile:Pp,isBlob:kp,isFunction:da,isStream:zp,isURLSearchParams:Mp,isStandardBrowserEnv:qp,forEach:la,merge:aa,extend:Gp,trim:Dp,stripBOM:Lp,inherits:Fp,toFlatObject:Kp,kindOf:ua,kindOfTest:sn,endsWith:Hp,toArray:$p,isTypedArray:Vp,isFileList:Op}});var pa=we((Nx,Fu)=>{"use strict";var kn=rt();function Lu(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Fu.exports=function(t,e,n){if(!e)return t;var o;if(n)o=n(e);else if(kn.isURLSearchParams(e))o=e.toString();else{var s=[];kn.forEach(e,function(p,h){p===null||typeof p>"u"||(kn.isArray(p)?h=h+"[]":p=[p],kn.forEach(p,function(x){kn.isDate(x)?x=x.toISOString():kn.isObject(x)&&(x=JSON.stringify(x)),s.push(Lu(h)+"="+Lu(x))}))}),o=s.join("&")}if(o){var c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}});var Hu=we((Mx,Ku)=>{"use strict";var Qp=rt();function _i(){this.handlers=[]}_i.prototype.use=function(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};_i.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)};_i.prototype.forEach=function(t){Qp.forEach(this.handlers,function(n){n!==null&&t(n)})};Ku.exports=_i});var Vu=we((Dx,$u)=>{"use strict";var jp=rt();$u.exports=function(t,e){jp.forEach(t,function(o,s){s!==e&&s.toUpperCase()===e.toUpperCase()&&(t[e]=o,delete t[s])})}});var an=we((qx,Yu)=>{"use strict";var Qu=rt();function On(r,t,e,n,o){Error.call(this),this.message=r,this.name="AxiosError",t&&(this.code=t),e&&(this.config=e),n&&(this.request=n),o&&(this.response=o)}Qu.inherits(On,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var ju=On.prototype,Wu={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach(function(r){Wu[r]={value:r}});Object.defineProperties(On,Wu);Object.defineProperty(ju,"isAxiosError",{value:!0});On.from=function(r,t,e,n,o,s){var c=Object.create(ju);return Qu.toFlatObject(r,c,function(p){return p!==Error.prototype}),On.call(c,r.message,t,e,n,o),c.name=r.name,s&&Object.assign(c,s),c};Yu.exports=On});var ga=we((Gx,Xu)=>{"use strict";Xu.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var ha=we((Lx,Zu)=>{"use strict";var Lt=rt();function Wp(r,t){t=t||new FormData;var e=[];function n(s){return s===null?"":Lt.isDate(s)?s.toISOString():Lt.isArrayBuffer(s)||Lt.isTypedArray(s)?typeof Blob=="function"?new Blob([s]):Buffer.from(s):s}function o(s,c){if(Lt.isPlainObject(s)||Lt.isArray(s)){if(e.indexOf(s)!==-1)throw Error("Circular reference detected in "+c);e.push(s),Lt.forEach(s,function(p,h){if(!Lt.isUndefined(p)){var y=c?c+"."+h:h,x;if(p&&!c&&typeof p=="object"){if(Lt.endsWith(h,"{}"))p=JSON.stringify(p);else if(Lt.endsWith(h,"[]")&&(x=Lt.toArray(p))){x.forEach(function(_){!Lt.isUndefined(_)&&t.append(y,n(_))});return}}o(p,y)}}),e.pop()}else t.append(c,n(s))}return o(r),t}Zu.exports=Wp});var ef=we((Fx,Ju)=>{"use strict";var ya=an();Ju.exports=function(t,e,n){var o=n.config.validateStatus;!n.status||!o||o(n.status)?t(n):e(new ya("Request failed with status code "+n.status,[ya.ERR_BAD_REQUEST,ya.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}});var rf=we((Kx,tf)=>{"use strict";var Ei=rt();tf.exports=Ei.isStandardBrowserEnv()?function(){return{write:function(e,n,o,s,c,u){var p=[];p.push(e+"="+encodeURIComponent(n)),Ei.isNumber(o)&&p.push("expires="+new Date(o).toGMTString()),Ei.isString(s)&&p.push("path="+s),Ei.isString(c)&&p.push("domain="+c),u===!0&&p.push("secure"),document.cookie=p.join("; ")},read:function(e){var n=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var of=we((Hx,nf)=>{"use strict";nf.exports=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}});var af=we(($x,sf)=>{"use strict";sf.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}});var ma=we((Vx,cf)=>{"use strict";var Yp=of(),Xp=af();cf.exports=function(t,e){return t&&!Yp(e)?Xp(t,e):e}});var ff=we((Qx,uf)=>{"use strict";var xa=rt(),Zp=["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"];uf.exports=function(t){var e={},n,o,s;return t&&xa.forEach(t.split(`
|
|
2
|
-
`),function(u){if(s=u.indexOf(":"),n=xa.trim(u.substr(0,s)).toLowerCase(),o=xa.trim(u.substr(s+1)),n){if(e[n]&&Zp.indexOf(n)>=0)return;n==="set-cookie"?e[n]=(e[n]?e[n]:[]).concat([o]):e[n]=e[n]?e[n]+", "+o:o}}),e}});var pf=we((jx,lf)=>{"use strict";var df=rt();lf.exports=df.isStandardBrowserEnv()?function(){var t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a"),n;function o(s){var c=s;return t&&(e.setAttribute("href",c),c=e.href),e.setAttribute("href",c),{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 n=o(window.location.href),function(c){var u=df.isString(c)?o(c):c;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var po=we((Wx,hf)=>{"use strict";var Aa=an(),Jp=rt();function gf(r){Aa.call(this,r??"canceled",Aa.ERR_CANCELED),this.name="CanceledError"}Jp.inherits(gf,Aa,{__CANCEL__:!0});hf.exports=gf});var mf=we((Yx,yf)=>{"use strict";yf.exports=function(t){var e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}});var ba=we((Xx,xf)=>{"use strict";var go=rt(),eg=ef(),tg=rf(),rg=pa(),ng=ma(),og=ff(),ig=pf(),sg=ga(),lr=an(),ag=po(),cg=mf();xf.exports=function(t){return new Promise(function(n,o){var s=t.data,c=t.headers,u=t.responseType,p;function h(){t.cancelToken&&t.cancelToken.unsubscribe(p),t.signal&&t.signal.removeEventListener("abort",p)}go.isFormData(s)&&go.isStandardBrowserEnv()&&delete c["Content-Type"];var y=new XMLHttpRequest;if(t.auth){var x=t.auth.username||"",_=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";c.Authorization="Basic "+btoa(x+":"+_)}var T=ng(t.baseURL,t.url);y.open(t.method.toUpperCase(),rg(T,t.params,t.paramsSerializer),!0),y.timeout=t.timeout;function N(){if(y){var P="getAllResponseHeaders"in y?og(y.getAllResponseHeaders()):null,Q=!u||u==="text"||u==="json"?y.responseText:y.response,z={data:Q,status:y.status,statusText:y.statusText,headers:P,config:t,request:y};eg(function(L){n(L),h()},function(L){o(L),h()},z),y=null}}if("onloadend"in y?y.onloadend=N:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(N)},y.onabort=function(){y&&(o(new lr("Request aborted",lr.ECONNABORTED,t,y)),y=null)},y.onerror=function(){o(new lr("Network Error",lr.ERR_NETWORK,t,y,y)),y=null},y.ontimeout=function(){var Q=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",z=t.transitional||sg;t.timeoutErrorMessage&&(Q=t.timeoutErrorMessage),o(new lr(Q,z.clarifyTimeoutError?lr.ETIMEDOUT:lr.ECONNABORTED,t,y)),y=null},go.isStandardBrowserEnv()){var E=(t.withCredentials||ig(T))&&t.xsrfCookieName?tg.read(t.xsrfCookieName):void 0;E&&(c[t.xsrfHeaderName]=E)}"setRequestHeader"in y&&go.forEach(c,function(Q,z){typeof s>"u"&&z.toLowerCase()==="content-type"?delete c[z]:y.setRequestHeader(z,Q)}),go.isUndefined(t.withCredentials)||(y.withCredentials=!!t.withCredentials),u&&u!=="json"&&(y.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&y.addEventListener("progress",t.onDownloadProgress),typeof t.onUploadProgress=="function"&&y.upload&&y.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(p=function(P){y&&(o(!P||P&&P.type?new ag:P),y.abort(),y=null)},t.cancelToken&&t.cancelToken.subscribe(p),t.signal&&(t.signal.aborted?p():t.signal.addEventListener("abort",p))),s||(s=null);var R=cg(T);if(R&&["http","https","file"].indexOf(R)===-1){o(new lr("Unsupported protocol "+R+":",lr.ERR_BAD_REQUEST,t));return}y.send(s)})}});var bf=we((Zx,Af)=>{"use strict";Af.exports=null});var Ui=we((Jx,_f)=>{"use strict";var nt=rt(),wf=Vu(),Tf=an(),ug=ga(),fg=ha(),dg={"Content-Type":"application/x-www-form-urlencoded"};function vf(r,t){!nt.isUndefined(r)&&nt.isUndefined(r["Content-Type"])&&(r["Content-Type"]=t)}function lg(){var r;return typeof XMLHttpRequest<"u"?r=ba():typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]"&&(r=ba()),r}function pg(r,t,e){if(nt.isString(r))try{return(t||JSON.parse)(r),nt.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(e||JSON.stringify)(r)}var Si={transitional:ug,adapter:lg(),transformRequest:[function(t,e){if(wf(e,"Accept"),wf(e,"Content-Type"),nt.isFormData(t)||nt.isArrayBuffer(t)||nt.isBuffer(t)||nt.isStream(t)||nt.isFile(t)||nt.isBlob(t))return t;if(nt.isArrayBufferView(t))return t.buffer;if(nt.isURLSearchParams(t))return vf(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString();var n=nt.isObject(t),o=e&&e["Content-Type"],s;if((s=nt.isFileList(t))||n&&o==="multipart/form-data"){var c=this.env&&this.env.FormData;return fg(s?{"files[]":t}:t,c&&new c)}else if(n||o==="application/json")return vf(e,"application/json"),pg(t);return t}],transformResponse:[function(t){var e=this.transitional||Si.transitional,n=e&&e.silentJSONParsing,o=e&&e.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||o&&nt.isString(t)&&t.length)try{return JSON.parse(t)}catch(c){if(s)throw c.name==="SyntaxError"?Tf.from(c,Tf.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:bf()},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};nt.forEach(["delete","get","head"],function(t){Si.headers[t]={}});nt.forEach(["post","put","patch"],function(t){Si.headers[t]=nt.merge(dg)});_f.exports=Si});var Sf=we((eA,Ef)=>{"use strict";var gg=rt(),hg=Ui();Ef.exports=function(t,e,n){var o=this||hg;return gg.forEach(n,function(c){t=c.call(o,t,e)}),t}});var wa=we((tA,Uf)=>{"use strict";Uf.exports=function(t){return!!(t&&t.__CANCEL__)}});var Bf=we((rA,If)=>{"use strict";var Cf=rt(),Ta=Sf(),yg=wa(),mg=Ui(),xg=po();function va(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new xg}If.exports=function(t){va(t),t.headers=t.headers||{},t.data=Ta.call(t,t.data,t.headers,t.transformRequest),t.headers=Cf.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),Cf.forEach(["delete","get","head","post","put","patch","common"],function(o){delete t.headers[o]});var e=t.adapter||mg.adapter;return e(t).then(function(o){return va(t),o.data=Ta.call(t,o.data,o.headers,t.transformResponse),o},function(o){return yg(o)||(va(t),o&&o.response&&(o.response.data=Ta.call(t,o.response.data,o.response.headers,t.transformResponse))),Promise.reject(o)})}});var _a=we((nA,Rf)=>{"use strict";var Tt=rt();Rf.exports=function(t,e){e=e||{};var n={};function o(y,x){return Tt.isPlainObject(y)&&Tt.isPlainObject(x)?Tt.merge(y,x):Tt.isPlainObject(x)?Tt.merge({},x):Tt.isArray(x)?x.slice():x}function s(y){if(Tt.isUndefined(e[y])){if(!Tt.isUndefined(t[y]))return o(void 0,t[y])}else return o(t[y],e[y])}function c(y){if(!Tt.isUndefined(e[y]))return o(void 0,e[y])}function u(y){if(Tt.isUndefined(e[y])){if(!Tt.isUndefined(t[y]))return o(void 0,t[y])}else return o(void 0,e[y])}function p(y){if(y in e)return o(t[y],e[y]);if(y in t)return o(void 0,t[y])}var h={url:c,method:c,data:c,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:p};return Tt.forEach(Object.keys(t).concat(Object.keys(e)),function(x){var _=h[x]||s,T=_(x);Tt.isUndefined(T)&&_!==p||(n[x]=T)}),n}});var Ea=we((oA,Pf)=>{"use strict";Pf.exports={version:"0.27.2"}});var zf=we((iA,Of)=>{"use strict";var Ag=Ea().version,kr=an(),Sa={};["object","boolean","number","function","string","symbol"].forEach(function(r,t){Sa[r]=function(n){return typeof n===r||"a"+(t<1?"n ":" ")+r}});var kf={};Sa.transitional=function(t,e,n){function o(s,c){return"[Axios v"+Ag+"] Transitional option '"+s+"'"+c+(n?". "+n:"")}return function(s,c,u){if(t===!1)throw new kr(o(c," has been removed"+(e?" in "+e:"")),kr.ERR_DEPRECATED);return e&&!kf[c]&&(kf[c]=!0,console.warn(o(c," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(s,c,u):!0}};function bg(r,t,e){if(typeof r!="object")throw new kr("options must be an object",kr.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(r),o=n.length;o-- >0;){var s=n[o],c=t[s];if(c){var u=r[s],p=u===void 0||c(u,s,r);if(p!==!0)throw new kr("option "+s+" must be "+p,kr.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new kr("Unknown option "+s,kr.ERR_BAD_OPTION)}}Of.exports={assertOptions:bg,validators:Sa}});var Lf=we((sA,Gf)=>{"use strict";var Df=rt(),wg=pa(),Nf=Hu(),Mf=Bf(),Ci=_a(),Tg=ma(),qf=zf(),zn=qf.validators;function Nn(r){this.defaults=r,this.interceptors={request:new Nf,response:new Nf}}Nn.prototype.request=function(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=Ci(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var n=e.transitional;n!==void 0&&qf.assertOptions(n,{silentJSONParsing:zn.transitional(zn.boolean),forcedJSONParsing:zn.transitional(zn.boolean),clarifyTimeoutError:zn.transitional(zn.boolean)},!1);var o=[],s=!0;this.interceptors.request.forEach(function(T){typeof T.runWhen=="function"&&T.runWhen(e)===!1||(s=s&&T.synchronous,o.unshift(T.fulfilled,T.rejected))});var c=[];this.interceptors.response.forEach(function(T){c.push(T.fulfilled,T.rejected)});var u;if(!s){var p=[Mf,void 0];for(Array.prototype.unshift.apply(p,o),p=p.concat(c),u=Promise.resolve(e);p.length;)u=u.then(p.shift(),p.shift());return u}for(var h=e;o.length;){var y=o.shift(),x=o.shift();try{h=y(h)}catch(_){x(_);break}}try{u=Mf(h)}catch(_){return Promise.reject(_)}for(;c.length;)u=u.then(c.shift(),c.shift());return u};Nn.prototype.getUri=function(t){t=Ci(this.defaults,t);var e=Tg(t.baseURL,t.url);return wg(e,t.params,t.paramsSerializer)};Df.forEach(["delete","get","head","options"],function(t){Nn.prototype[t]=function(e,n){return this.request(Ci(n||{},{method:t,url:e,data:(n||{}).data}))}});Df.forEach(["post","put","patch"],function(t){function e(n){return function(s,c,u){return this.request(Ci(u||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:c}))}}Nn.prototype[t]=e(),Nn.prototype[t+"Form"]=e(!0)});Gf.exports=Nn});var Kf=we((aA,Ff)=>{"use strict";var vg=po();function Mn(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(o){t=o});var e=this;this.promise.then(function(n){if(e._listeners){var o,s=e._listeners.length;for(o=0;o<s;o++)e._listeners[o](n);e._listeners=null}}),this.promise.then=function(n){var o,s=new Promise(function(c){e.subscribe(c),o=c}).then(n);return s.cancel=function(){e.unsubscribe(o)},s},r(function(o){e.reason||(e.reason=new vg(o),t(e.reason))})}Mn.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};Mn.prototype.subscribe=function(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]};Mn.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}};Mn.source=function(){var t,e=new Mn(function(o){t=o});return{token:e,cancel:t}};Ff.exports=Mn});var $f=we((cA,Hf)=>{"use strict";Hf.exports=function(t){return function(n){return t.apply(null,n)}}});var Qf=we((uA,Vf)=>{"use strict";var _g=rt();Vf.exports=function(t){return _g.isObject(t)&&t.isAxiosError===!0}});var Yf=we((fA,Ua)=>{"use strict";var jf=rt(),Eg=sa(),Ii=Lf(),Sg=_a(),Ug=Ui();function Wf(r){var t=new Ii(r),e=Eg(Ii.prototype.request,t);return jf.extend(e,Ii.prototype,t),jf.extend(e,t),e.create=function(o){return Wf(Sg(r,o))},e}var gt=Wf(Ug);gt.Axios=Ii;gt.CanceledError=po();gt.CancelToken=Kf();gt.isCancel=wa();gt.VERSION=Ea().version;gt.toFormData=ha();gt.AxiosError=an();gt.Cancel=gt.CanceledError;gt.all=function(t){return Promise.all(t)};gt.spread=$f();gt.isAxiosError=Qf();Ua.exports=gt;Ua.exports.default=gt});var Zf=we((dA,Xf)=>{"use strict";Xf.exports=Yf()});var Hg={};ec(Hg,{APTOS_BIP44_REGEX:()=>Oc,APTOS_COIN:()=>xs,APTOS_HARDENED_REGEX:()=>kc,Account:()=>dr,AccountAddress:()=>k,AccountAuthenticator:()=>ht,AccountAuthenticatorEd25519:()=>gr,AccountAuthenticatorMultiEd25519:()=>ki,AccountAuthenticatorMultiKey:()=>Dn,AccountAuthenticatorSingleKey:()=>Wt,AccountAuthenticatorVariant:()=>cs,AddressInvalidReason:()=>mc,AnyPublicKeyVariant:()=>us,AnySignatureVariant:()=>fs,Aptos:()=>yt,AptosApiError:()=>Vt,AptosApiType:()=>to,AptosConfig:()=>ho,AuthenticationKey:()=>Gt,Bool:()=>Ge,CKDPriv:()=>zs,ChainId:()=>ln,DEFAULT_MAX_GAS_AMOUNT:()=>ys,DEFAULT_NETWORK:()=>hs,DEFAULT_TXN_EXP_SEC_FROM_NOW:()=>ms,DEFAULT_TXN_TIMEOUT_SEC:()=>ro,DeriveScheme:()=>ac,Deserializer:()=>io,Ed25519PrivateKey:()=>or,Ed25519PublicKey:()=>Pe,Ed25519Signature:()=>Ke,EntryFunction:()=>vn,EntryFunctionBytes:()=>so,FeePayerRawTransaction:()=>mr,FixedBytes:()=>Er,HARDENED_OFFSET:()=>Ps,Hex:()=>me,HexInvalidReason:()=>hc,Identifier:()=>Ne,KeyType:()=>zc,MimeType:()=>Fo,ModuleId:()=>qn,MoveAbility:()=>ic,MoveFunctionVisibility:()=>oc,MoveOption:()=>Nt,MoveString:()=>Fe,MoveVector:()=>Be,MultiAgentRawTransaction:()=>yr,MultiEd25519PublicKey:()=>Dt,MultiEd25519Signature:()=>Yr,MultiKey:()=>nn,MultiSig:()=>Hn,MultisigTransactionPayload:()=>$n,Network:()=>eo,NetworkToChainId:()=>Ho,NetworkToFaucetAPI:()=>gs,NetworkToIndexerAPI:()=>Ko,NetworkToNetworkName:()=>Qd,NetworkToNodeAPI:()=>ps,ParsingError:()=>ft,PrivateKey:()=>Vr,PublicKey:()=>At,RAW_TRANSACTION_SALT:()=>As,RAW_TRANSACTION_WITH_DATA_SALT:()=>$o,RawTransaction:()=>Ft,RawTransactionWithData:()=>Ao,RoleType:()=>sc,RotationProofChallenge:()=>yo,Script:()=>Kn,ScriptTransactionArgumentVariants:()=>Cn,Secp256k1PrivateKey:()=>cr,Secp256k1PublicKey:()=>qt,Secp256k1Signature:()=>ur,Serializable:()=>Z,Serializer:()=>Ot,Signature:()=>Mt,SignedTransaction:()=>Kt,SigningScheme:()=>In,SigningSchemeInput:()=>ls,StructTag:()=>Xt,TransactionAuthenticator:()=>Yt,TransactionAuthenticatorEd25519:()=>cn,TransactionAuthenticatorFeePayer:()=>fn,TransactionAuthenticatorMultiAgent:()=>un,TransactionAuthenticatorMultiEd25519:()=>Oi,TransactionAuthenticatorSingleSender:()=>dn,TransactionAuthenticatorVariant:()=>as,TransactionPayload:()=>zr,TransactionPayloadEntryFunction:()=>Ln,TransactionPayloadMultisig:()=>Fn,TransactionPayloadScript:()=>Gn,TransactionPayloadVariants:()=>is,TransactionResponseType:()=>ds,TransactionVariants:()=>ss,TypeTag:()=>$e,TypeTagAddress:()=>bn,TypeTagBool:()=>pn,TypeTagGeneric:()=>wn,TypeTagParserError:()=>Oe,TypeTagParserErrorType:()=>ad,TypeTagReference:()=>xo,TypeTagSigner:()=>Or,TypeTagStruct:()=>hr,TypeTagU128:()=>xn,TypeTagU16:()=>hn,TypeTagU256:()=>An,TypeTagU32:()=>yn,TypeTagU64:()=>mn,TypeTagU8:()=>gn,TypeTagVariants:()=>os,TypeTagVector:()=>Tn,U128:()=>St,U16:()=>_t,U256:()=>Ut,U32:()=>Et,U64:()=>Le,U8:()=>it,aptosCoinStructTag:()=>Ig,aptosRequest:()=>Jn,buildTransaction:()=>Eo,convertArgument:()=>Na,deriveKey:()=>ii,deriveTransactionType:()=>Ga,deserializeFromScriptArgument:()=>od,ensureBoolean:()=>Xo,fetchEntryFunctionAbi:()=>za,findFirstNonSignerArg:()=>ka,generateMultiSignersSignedTransaction:()=>dd,generateRawTransaction:()=>fd,generateSignedTransaction:()=>qa,generateSignedTransactionForSimulation:()=>Ma,generateTransactionPayload:()=>_o,generateTransactionPayloadWithABI:()=>cd,get:()=>fc,getAptosFullNode:()=>lt,getAuthenticatorForSimulation:()=>vo,getFunctionParts:()=>$i,getSigningMessage:()=>ld,isBcsAddress:()=>To,isBcsBool:()=>Ni,isBcsFixedBytes:()=>Pa,isBcsString:()=>Mi,isBcsU128:()=>Fi,isBcsU16:()=>qi,isBcsU256:()=>Ki,isBcsU32:()=>Gi,isBcsU64:()=>Li,isBcsU8:()=>Di,isBool:()=>Ba,isLargeNumber:()=>wo,isNull:()=>Ra,isNumber:()=>bo,isScriptDataInput:()=>Hi,isString:()=>_n,isValidBIP44Path:()=>ks,isValidHardenedPath:()=>Os,mnemonicToSeed:()=>co,objectStructTag:()=>Pg,optionStructTag:()=>Rg,outOfRangeErrorMessage:()=>yc,paginateWithCursor:()=>qr,parseTypeTag:()=>Vn,post:()=>Vo,postAptosFaucet:()=>ws,postAptosFullNode:()=>Gr,postAptosIndexer:()=>bs,request:()=>uc,sign:()=>Da,splitPath:()=>Ns,standardizeTypeTags:()=>Oa,stringStructTag:()=>Bg,throwTypeMismatch:()=>ze,validateNumberInRange:()=>tr});var Vt=class extends Error{constructor(e,n,o){super(o);this.name="AptosApiError",this.url=n.url,this.status=n.status,this.statusText=n.statusText,this.data=n.data,this.request=e}};var nc="0.0.4";var Fo=(n=>(n.JSON="application/json",n.BCS="application/x-bcs",n.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",n))(Fo||{}),os=(T=>(T[T.Bool=0]="Bool",T[T.U8=1]="U8",T[T.U64=2]="U64",T[T.U128=3]="U128",T[T.Address=4]="Address",T[T.Signer=5]="Signer",T[T.Vector=6]="Vector",T[T.Struct=7]="Struct",T[T.U16=8]="U16",T[T.U32=9]="U32",T[T.U256=10]="U256",T[T.Reference=254]="Reference",T[T.Generic=255]="Generic",T))(os||{}),Cn=(h=>(h[h.U8=0]="U8",h[h.U64=1]="U64",h[h.U128=2]="U128",h[h.Address=3]="Address",h[h.U8Vector=4]="U8Vector",h[h.Bool=5]="Bool",h[h.U16=6]="U16",h[h.U32=7]="U32",h[h.U256=8]="U256",h))(Cn||{}),is=(n=>(n[n.Script=0]="Script",n[n.EntryFunction=2]="EntryFunction",n[n.Multisig=3]="Multisig",n))(is||{}),ss=(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(ss||{}),as=(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))(as||{}),cs=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(cs||{}),us=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(us||{}),fs=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(fs||{}),ds=(s=>(s.Pending="pending_transaction",s.User="user_transaction",s.Genesis="genesis_transaction",s.BlockMetadata="block_metadata_transaction",s.StateCheckpoint="state_checkpoint_transaction",s))(ds||{}),oc=(n=>(n.PRIVATE="private",n.PUBLIC="public",n.FRIEND="friend",n))(oc||{}),ic=(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(ic||{}),sc=(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(sc||{}),In=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(In||{}),ls=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(ls||{}),ac=(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))(ac||{});var cc={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 uc(r,t){let{url:e,method:n,body:o,contentType:s,params:c,overrides:u}=r,p={...u?.HEADERS,"x-aptos-client":`aptos-ts-sdk/${nc}`,"content-type":s??"application/json"};return u?.AUTH_TOKEN&&e.includes("faucet")&&(p.Authorization=`Bearer ${u?.AUTH_TOKEN}`),t.provider({url:e,method:n,body:o,params:c,headers:p,overrides:u})}async function Jn(r,t){let{url:e,path:n}=r,o=`${e}/${n??""}`,s=await uc({...r,url:o},t.client),c={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 p=c.data;if(p.errors)throw new Vt(r,c,p.errors[0].message??`Unhandled Error ${s.status} : ${s.statusText}`);c.data=p.data}if(c.status>=200&&c.status<300)return c;let u;throw"message"in s.data&&"error_code"in s.data?u=JSON.stringify(s.data):c.status in cc?u=cc[c.status]:u=`Unhandled Error ${s.status} : ${s.statusText}`,new Vt(r,c,u)}var Ko={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"},ps={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"},gs={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"},eo=(s=>(s.MAINNET="mainnet",s.TESTNET="testnet",s.DEVNET="devnet",s.LOCAL="local",s.CUSTOM="custom",s))(eo||{}),Ho={mainnet:1,testnet:2},Qd={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var to=(n=>(n[n.FULLNODE=0]="FULLNODE",n[n.INDEXER=1]="INDEXER",n[n.FAUCET=2]="FAUCET",n))(to||{}),hs="devnet",ys=2e5,ms=20,ro=20,xs="0x1::aptos_coin::AptosCoin",As="APTOS::RawTransaction",$o="APTOS::RawTransactionWithData";async function fc(r){let{aptosConfig:t,overrides:e,params:n,contentType:o,acceptType:s,path:c,originMethod:u,type:p}=r,h=t.getRequestUrl(p);return Jn({url:h,method:"GET",originMethod:u,path:c,contentType:o?.valueOf(),acceptType:s?.valueOf(),params:n,overrides:{...t.clientConfig,...e}},t)}async function lt(r){return fc({...r,type:0})}async function qr(r){let t=[],e,n=r.params;for(;;){n.start=e;let o=await lt({aptosConfig:r.aptosConfig,originMethod:r.originMethod,path:r.path,params:n,overrides:r.overrides});if(e=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),e==null)break}return t}async function Vo(r){let{type:t,originMethod:e,path:n,body:o,acceptType:s,contentType:c,params:u,aptosConfig:p,overrides:h}=r,y=p.getRequestUrl(t);return Jn({url:y,method:"POST",originMethod:e,path:n,body:o,contentType:c?.valueOf(),acceptType:s?.valueOf(),params:u,overrides:{...p.clientConfig,...h}},p)}async function Gr(r){return Vo({...r,type:0})}async function bs(r){return Vo({...r,type:1})}async function ws(r){return Vo({...r,type:2})}var Qo=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var Ts=r=>r instanceof Uint8Array;var dc=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4)),Qt=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),Pt=(r,t)=>r<<32-t|r>>>t,jd=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!jd)throw new Error("Non little-endian hardware is not supported");var Wd=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function Lr(r){if(!Ts(r))throw new Error("Uint8Array expected");let t="";for(let e=0;e<r.length;e++)t+=Wd[r[e]];return t}function Bn(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.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 n=0;n<e.length;n++){let o=n*2,s=r.slice(o,o+2),c=Number.parseInt(s,16);if(Number.isNaN(c)||c<0)throw new Error("Invalid byte sequence");e[n]=c}return e}function vs(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function kt(r){if(typeof r=="string"&&(r=vs(r)),!Ts(r))throw new Error(`expected Uint8Array, got ${typeof r}`);return r}function Fr(...r){let t=new Uint8Array(r.reduce((n,o)=>n+o.length,0)),e=0;return r.forEach(n=>{if(!Ts(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}var Tr=class{clone(){return this._cloneInto()}},Yd={}.toString;function lc(r,t){if(t!==void 0&&Yd.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(r,t)}function vr(r){let t=n=>r().update(kt(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function pc(r){let t=(n,o)=>r(o).update(kt(n)).digest(),e=r({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>r(n),t}function gc(r=32){if(Qo&&typeof Qo.getRandomValues=="function")return Qo.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}var jo=2**8-1,Wo=2**16-1,er=2**32-1,Kr=BigInt(2)**BigInt(64)-BigInt(1),no=BigInt(2)**BigInt(128)-BigInt(1),Yo=BigInt(2)**BigInt(256)-BigInt(1);var ft=class extends Error{constructor(e,n){super(e);this.invalidReason=n}};var hc=(n=>(n.TOO_SHORT="too_short",n.INVALID_LENGTH="invalid_length",n.INVALID_HEX_CHARS="invalid_hex_chars",n))(hc||{}),me=class r{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return Lr(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 ft("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 ft("Hex string must be an even number of hex characters.","invalid_length");try{return new r(Bn(e))}catch(n){let o=n;throw new ft(`Hex string contains invalid hex characters: ${o.message}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new r(t):r.fromString(t)}static isValid(t){try{return r.fromString(t),{valid:!0}}catch(e){let n=e;return{valid:!1,invalidReason:n.invalidReason,invalidReasonMessage:n.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,n)=>e===t.data[n])}};var Z=class{bcsToBytes(){let t=new Ot;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return me.fromHexInput(t)}},Ot=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,n){this.ensureBufferWillHandleSize(e);let o=new DataView(this.buffer,this.offset);t.apply(o,[0,n,!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){Xo(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(er),n=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(n))}serializeU128(t){let e=BigInt(t)&Kr,n=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(n)}serializeU256(t){let e=BigInt(t)&no,n=BigInt(t)>>BigInt(128);this.serializeU128(e),this.serializeU128(n)}serializeU32AsUleb128(t){let e=t,n=[];for(;e>>>7;)n.push(e&127|128),e>>>=7;n.push(e),this.appendToBuffer(new Uint8Array(n))}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)})}};wr([Hr(0,jo)],Ot.prototype,"serializeU8",1),wr([Hr(0,Wo)],Ot.prototype,"serializeU16",1),wr([Hr(0,er)],Ot.prototype,"serializeU32",1),wr([Hr(BigInt(0),Kr)],Ot.prototype,"serializeU64",1),wr([Hr(BigInt(0),no)],Ot.prototype,"serializeU128",1),wr([Hr(BigInt(0),Yo)],Ot.prototype,"serializeU256",1),wr([Hr(0,er)],Ot.prototype,"serializeU32AsUleb128",1);function Xo(r){if(typeof r!="boolean")throw new Error(`${r} is not a boolean value`)}var yc=(r,t,e)=>`${r} is out of range: [${t}, ${e}]`;function tr(r,t,e){let n=BigInt(r);if(n>BigInt(e)||n<BigInt(t))throw new Error(yc(r,t,e))}function Hr(r,t){return(e,n,o)=>{let s=o.value;return o.value=function(u){return tr(u,r,t),s.apply(this,[u])},o}}var mc=(u=>(u.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",u.INVALID_HEX_CHARS="invalid_hex_chars",u.TOO_SHORT="too_short",u.TOO_LONG="too_long",u.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",u.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",u.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",u))(mc||{}),Ie=class Ie extends Z{constructor(e){super();if(e.length!==Ie.LENGTH)throw new ft("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=Lr(this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return Lr(this.data)}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let n=e.deserializeFixedBytes(Ie.LENGTH);return new Ie(n)}static fromString(e){if(!e.startsWith("0x"))throw new ft("Hex string must start with a leading 0x.","leading_zero_x_required");let n=Ie.fromStringRelaxed(e);if(e.length!==Ie.LONG_STRING_LENGTH+2)if(n.isSpecial()){if(e.length!==3)throw new ft(`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 ft(`The given hex string ${n} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return n}static fromStringRelaxed(e){let n=e;if(e.startsWith("0x")&&(n=e.slice(2)),n.length===0)throw new ft("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(n.length>64)throw new ft("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let o;try{o=Bn(n.padStart(64,"0"))}catch(s){let c=s;throw new ft(`Hex characters are invalid: ${c.message}`,"invalid_hex_chars")}return new Ie(o)}static fromRelaxed(e){return e instanceof Ie?e:e instanceof Uint8Array?new Ie(e):Ie.fromStringRelaxed(e)}static from(e){return e instanceof Ie?e:e instanceof Uint8Array?new Ie(e):Ie.fromString(e)}static isValid(e){try{return e.relaxed?Ie.fromRelaxed(e.input):Ie.from(e.input),{valid:!0}}catch(n){let o=n;return{valid:!1,invalidReason:o.invalidReason,invalidReasonMessage:o.message}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((n,o)=>n===e.data[o])}};Ie.LENGTH=32,Ie.LONG_STRING_LENGTH=64,Ie.ZERO=Ie.from("0x0"),Ie.ONE=Ie.from("0x1"),Ie.TWO=Ie.from("0x2"),Ie.THREE=Ie.from("0x3"),Ie.FOUR=Ie.from("0x4");var k=Ie;function rr(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function zt(r,...t){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(r.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${r.length}`)}function Zo(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");rr(r.outputLen),rr(r.blockLen)}function nr(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function Jo(r,t){zt(r);let e=t.outputLen;if(r.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var ei=BigInt(4294967295),_s=BigInt(32);function xc(r,t=!1){return t?{h:Number(r&ei),l:Number(r>>_s&ei)}:{h:Number(r>>_s&ei)|0,l:Number(r&ei)|0}}function Es(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o<r.length;o++){let{h:s,l:c}=xc(r[o],t);[e[o],n[o]]=[s,c]}return[e,n]}var Xd=(r,t)=>BigInt(r>>>0)<<_s|BigInt(t>>>0),Zd=(r,t,e)=>r>>>e,Jd=(r,t,e)=>r<<32-e|t>>>e,el=(r,t,e)=>r>>>e|t<<32-e,tl=(r,t,e)=>r<<32-e|t>>>e,rl=(r,t,e)=>r<<64-e|t>>>e-32,nl=(r,t,e)=>r>>>e-32|t<<64-e,ol=(r,t)=>t,il=(r,t)=>r,Ss=(r,t,e)=>r<<e|t>>>32-e,Us=(r,t,e)=>t<<e|r>>>32-e,Cs=(r,t,e)=>t<<e-32|r>>>64-e,Is=(r,t,e)=>r<<e-32|t>>>64-e;function sl(r,t,e,n){let o=(t>>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var al=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),cl=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,ul=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),fl=(r,t,e,n,o)=>t+e+n+o+(r/2**32|0)|0,dl=(r,t,e,n,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(o>>>0),ll=(r,t,e,n,o,s)=>t+e+n+o+s+(r/2**32|0)|0;var pl={fromBig:xc,split:Es,toBig:Xd,shrSH:Zd,shrSL:Jd,rotrSH:el,rotrSL:tl,rotrBH:rl,rotrBL:nl,rotr32H:ol,rotr32L:il,rotlSH:Ss,rotlSL:Us,rotlBH:Cs,rotlBL:Is,add:sl,add3L:al,add3H:cl,add4L:ul,add4H:fl,add5H:ll,add5L:dl},pe=pl;var[wc,Tc,vc]=[[],[],[]],gl=BigInt(0),oo=BigInt(1),hl=BigInt(2),yl=BigInt(7),ml=BigInt(256),xl=BigInt(113);for(let r=0,t=oo,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],wc.push(2*(5*n+e)),Tc.push((r+1)*(r+2)/2%64);let o=gl;for(let s=0;s<7;s++)t=(t<<oo^(t>>yl)*xl)%ml,t&hl&&(o^=oo<<(oo<<BigInt(s))-oo);vc.push(o)}var[Al,bl]=Es(vc,!0),Ac=(r,t,e)=>e>32?Cs(r,t,e):Ss(r,t,e),bc=(r,t,e)=>e>32?Is(r,t,e):Us(r,t,e);function wl(r,t=24){let e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let c=0;c<10;c++)e[c]=r[c]^r[c+10]^r[c+20]^r[c+30]^r[c+40];for(let c=0;c<10;c+=2){let u=(c+8)%10,p=(c+2)%10,h=e[p],y=e[p+1],x=Ac(h,y,1)^e[u],_=bc(h,y,1)^e[u+1];for(let T=0;T<50;T+=10)r[c+T]^=x,r[c+T+1]^=_}let o=r[2],s=r[3];for(let c=0;c<24;c++){let u=Tc[c],p=Ac(o,s,u),h=bc(o,s,u),y=wc[c];o=r[y],s=r[y+1],r[y]=p,r[y+1]=h}for(let c=0;c<50;c+=10){for(let u=0;u<10;u++)e[u]=r[c+u];for(let u=0;u<10;u++)r[c+u]^=~e[(u+2)%10]&e[(u+4)%10]}r[0]^=Al[n],r[1]^=bl[n]}e.fill(0)}var ti=class r extends Tr{constructor(t,e,n,o=!1,s=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=o,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,rr(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=dc(this.state)}keccak(){wl(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){nr(this);let{blockLen:e,state:n}=this;t=kt(t);let o=t.length;for(let s=0;s<o;){let c=Math.min(e-this.pos,o-s);for(let u=0;u<c;u++)n[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:n,blockLen:o}=this;t[n]^=e,e&128&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){nr(this,!1),zt(t),this.finish();let e=this.state,{blockLen:n}=this;for(let o=0,s=t.length;o<s;){this.posOut>=n&&this.keccak();let c=Math.min(n-this.posOut,s-o);t.set(e.subarray(this.posOut,this.posOut+c),o),this.posOut+=c,o+=c}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return rr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Jo(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:n,outputLen:o,rounds:s,enableXOF:c}=this;return t||(t=new r(e,n,o,c,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=o,t.enableXOF=c,t.destroyed=this.destroyed,t}},_r=(r,t,e)=>vr(()=>new ti(t,r,e)),Vh=_r(6,144,224/8),$r=_r(6,136,256/8),Qh=_r(6,104,384/8),jh=_r(6,72,512/8),Wh=_r(1,144,224/8),Yh=_r(1,136,256/8),Xh=_r(1,104,384/8),Zh=_r(1,72,512/8),_c=(r,t,e)=>pc((n={})=>new ti(t,r,n.dkLen===void 0?e:n.dkLen,!0)),Jh=_c(31,168,128/8),ey=_c(31,136,256/8);var uo=rc(Sc());var io=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<er;){let n=this.deserializeU8();if(t|=BigInt(n&127)<<BigInt(e),!(n&128))break;e+=7}if(t>er)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(),n=new Array;for(let o=0;o<e;o+=1)n.push(this.deserialize(t));return n}};var Er=class r extends Z{constructor(e){super();this.value=me.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,n){let o=e.deserializeFixedBytes(n);return new r(o)}};var so=class r extends Z{constructor(e){super();this.value=new Er(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,n){let o=Er.deserialize(e,n);return new r(o.value)}};var Ge=class r extends Z{constructor(e){super();Xo(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new r(e.deserializeBool())}},it=class r extends Z{constructor(e){super();tr(e,0,jo),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new r(e.deserializeU8())}},_t=class r extends Z{constructor(e){super();tr(e,0,Wo),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new r(e.deserializeU16())}},Et=class r extends Z{constructor(e){super();tr(e,0,er),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new r(e.deserializeU32())}},Le=class r extends Z{constructor(e){super();tr(e,BigInt(0),Kr),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new r(e.deserializeU64())}},St=class r extends Z{constructor(e){super();tr(e,BigInt(0),no),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new r(e.deserializeU128())}},Ut=class r extends Z{constructor(e){super();tr(e,BigInt(0),Yo),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new r(e.deserializeU256())}};var Be=class r extends Z{constructor(e){super();this.values=e}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){if(!(this.values[0]instanceof it)&&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 n;if(Array.isArray(e)&&typeof e[0]=="number")n=e;else if(typeof e=="string"){let o=me.fromHexInput(e);n=Array.from(o.toUint8Array())}else if(e instanceof Uint8Array)n=Array.from(e);else throw new Error("Invalid input type");return new r(n.map(o=>new it(o)))}static U16(e){return new r(e.map(n=>new _t(n)))}static U32(e){return new r(e.map(n=>new Et(n)))}static U64(e){return new r(e.map(n=>new Le(n)))}static U128(e){return new r(e.map(n=>new St(n)))}static U256(e){return new r(e.map(n=>new Ut(n)))}static Bool(e){return new r(e.map(n=>new Ge(n)))}static MoveString(e){return new r(e.map(n=>new Fe(n)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,n){let o=e.deserializeUleb128AsU32(),s=new Array;for(let c=0;c<o;c+=1)s.push(n.deserialize(e));return new r(s)}},Fe=class r extends Z{constructor(e){super();this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){let n=this.bcsToBytes().slice(1);Be.U8(n).serializeForScriptFunction(e)}static deserialize(e){return new r(e.deserializeStr())}},Nt=class r extends Z{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new Be([e]):this.vec=new Be([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}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 r(e!=null?new it(e):void 0)}static U16(e){return new r(e!=null?new _t(e):void 0)}static U32(e){return new r(e!=null?new Et(e):void 0)}static U64(e){return new r(e!=null?new Le(e):void 0)}static U128(e){return new r(e!=null?new St(e):void 0)}static U256(e){return new r(e!=null?new Ut(e):void 0)}static Bool(e){return new r(e!=null?new Ge(e):void 0)}static MoveString(e){return new r(e!=null?new Fe(e):void 0)}static deserialize(e,n){let o=Be.deserialize(e,n);return new r(o.values[0])}};var At=class extends Z{},Vr=class extends Z{},Mt=class extends Z{};var ni=class extends Tr{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,Zo(t);let n=kt(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(n.length>o?t.create().update(n).digest():n);for(let c=0;c<s.length;c++)s[c]^=54;this.iHash.update(s),this.oHash=t.create();for(let c=0;c<s.length;c++)s[c]^=106;this.oHash.update(s),s.fill(0)}update(t){return nr(this),this.iHash.update(t),this}digestInto(t){nr(this),zt(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:n,finished:o,destroyed:s,blockLen:c,outputLen:u}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=c,t.outputLen=u,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},jt=(r,t,e)=>new ni(r,t).update(e).digest();jt.create=(r,t)=>new ni(r,t);function Tl(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let o=BigInt(32),s=BigInt(4294967295),c=Number(e>>o&s),u=Number(e&s),p=n?4:0,h=n?0:4;r.setUint32(t+p,c,n),r.setUint32(t+h,u,n)}var Sr=class extends Tr{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Qt(this.buffer)}update(t){nr(this);let{view:e,buffer:n,blockLen:o}=this;t=kt(t);let s=t.length;for(let c=0;c<s;){let u=Math.min(o-this.pos,s-c);if(u===o){let p=Qt(t);for(;o<=s-c;c+=o)this.process(p,c);continue}n.set(t.subarray(c,c+u),this.pos),this.pos+=u,c+=u,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){nr(this),Jo(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:o,isLE:s}=this,{pos:c}=this;e[c++]=128,this.buffer.subarray(c).fill(0),this.padOffset>o-c&&(this.process(n,0),c=0);for(let x=c;x<o;x++)e[x]=0;Tl(n,o-8,BigInt(this.length*8),s),this.process(n,0);let u=Qt(t),p=this.outputLen;if(p%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let h=p/4,y=this.get();if(h>y.length)throw new Error("_sha2: outputLen bigger than state");for(let x=0;x<h;x++)u.setUint32(4*x,y[x],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:o,finished:s,destroyed:c,pos:u}=this;return t.length=o,t.pos=u,t.finished=s,t.destroyed=c,o%e&&t.buffer.set(n),t}};var[vl,_l]=(()=>pe.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(r=>BigInt(r))))(),Ur=new Uint32Array(80),Cr=new Uint32Array(80),Bs=class extends Sr{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:n,Bl:o,Ch:s,Cl:c,Dh:u,Dl:p,Eh:h,El:y,Fh:x,Fl:_,Gh:T,Gl:N,Hh:E,Hl:R}=this;return[t,e,n,o,s,c,u,p,h,y,x,_,T,N,E,R]}set(t,e,n,o,s,c,u,p,h,y,x,_,T,N,E,R){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=o|0,this.Ch=s|0,this.Cl=c|0,this.Dh=u|0,this.Dl=p|0,this.Eh=h|0,this.El=y|0,this.Fh=x|0,this.Fl=_|0,this.Gh=T|0,this.Gl=N|0,this.Hh=E|0,this.Hl=R|0}process(t,e){for(let z=0;z<16;z++,e+=4)Ur[z]=t.getUint32(e),Cr[z]=t.getUint32(e+=4);for(let z=16;z<80;z++){let ee=Ur[z-15]|0,L=Cr[z-15]|0,j=pe.rotrSH(ee,L,1)^pe.rotrSH(ee,L,8)^pe.shrSH(ee,L,7),J=pe.rotrSL(ee,L,1)^pe.rotrSL(ee,L,8)^pe.shrSL(ee,L,7),X=Ur[z-2]|0,Re=Cr[z-2]|0,xe=pe.rotrSH(X,Re,19)^pe.rotrBH(X,Re,61)^pe.shrSH(X,Re,6),ye=pe.rotrSL(X,Re,19)^pe.rotrBL(X,Re,61)^pe.shrSL(X,Re,6),Ve=pe.add4L(J,ye,Cr[z-7],Cr[z-16]),Qe=pe.add4H(Ve,j,xe,Ur[z-7],Ur[z-16]);Ur[z]=Qe|0,Cr[z]=Ve|0}let{Ah:n,Al:o,Bh:s,Bl:c,Ch:u,Cl:p,Dh:h,Dl:y,Eh:x,El:_,Fh:T,Fl:N,Gh:E,Gl:R,Hh:P,Hl:Q}=this;for(let z=0;z<80;z++){let ee=pe.rotrSH(x,_,14)^pe.rotrSH(x,_,18)^pe.rotrBH(x,_,41),L=pe.rotrSL(x,_,14)^pe.rotrSL(x,_,18)^pe.rotrBL(x,_,41),j=x&T^~x&E,J=_&N^~_&R,X=pe.add5L(Q,L,J,_l[z],Cr[z]),Re=pe.add5H(X,P,ee,j,vl[z],Ur[z]),xe=X|0,ye=pe.rotrSH(n,o,28)^pe.rotrBH(n,o,34)^pe.rotrBH(n,o,39),Ve=pe.rotrSL(n,o,28)^pe.rotrBL(n,o,34)^pe.rotrBL(n,o,39),Qe=n&s^n&u^s&u,dt=o&c^o&p^c&p;P=E|0,Q=R|0,E=T|0,R=N|0,T=x|0,N=_|0,{h:x,l:_}=pe.add(h|0,y|0,Re|0,xe|0),h=u|0,y=p|0,u=s|0,p=c|0,s=n|0,c=o|0;let O=pe.add3L(xe,Ve,dt);n=pe.add3H(O,Re,ye,Qe),o=O|0}({h:n,l:o}=pe.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:c}=pe.add(this.Bh|0,this.Bl|0,s|0,c|0),{h:u,l:p}=pe.add(this.Ch|0,this.Cl|0,u|0,p|0),{h,l:y}=pe.add(this.Dh|0,this.Dl|0,h|0,y|0),{h:x,l:_}=pe.add(this.Eh|0,this.El|0,x|0,_|0),{h:T,l:N}=pe.add(this.Fh|0,this.Fl|0,T|0,N|0),{h:E,l:R}=pe.add(this.Gh|0,this.Gl|0,E|0,R|0),{h:P,l:Q}=pe.add(this.Hh|0,this.Hl|0,P|0,Q|0),this.set(n,o,s,c,u,p,h,y,x,_,T,N,E,R,P,Q)}roundClean(){Ur.fill(0),Cr.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 Qr=vr(()=>new Bs);function El(r,t,e,n){Zo(r);let o=lc({dkLen:32,asyncTick:10},n),{c:s,dkLen:c,asyncTick:u}=o;if(rr(s),rr(c),rr(u),s<1)throw new Error("PBKDF2: iterations (c) should be >= 1");let p=kt(t),h=kt(e),y=new Uint8Array(c),x=jt.create(r,p),_=x._cloneInto().update(h);return{c:s,dkLen:c,asyncTick:u,DK:y,PRF:x,PRFSalt:_}}function Sl(r,t,e,n,o){return r.destroy(),t.destroy(),n&&n.destroy(),o.fill(0),e}function Uc(r,t,e,n){let{c:o,dkLen:s,DK:c,PRF:u,PRFSalt:p}=El(r,t,e,n),h,y=new Uint8Array(4),x=Qt(y),_=new Uint8Array(u.outputLen);for(let T=1,N=0;N<s;T++,N+=u.outputLen){let E=c.subarray(N,N+u.outputLen);x.setInt32(0,T,!1),(h=p._cloneInto(h)).update(y).digestInto(_),E.set(_.subarray(0,E.length));for(let R=1;R<o;R++){u._cloneInto(h).update(_).digestInto(_);for(let P=0;P<E.length;P++)E[P]^=_[P]}}return Sl(u,p,c,h,_)}var Ul=(r,t,e)=>r&t^~r&e,Cl=(r,t,e)=>r&t^r&e^t&e,Il=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]),Br=new Uint32Array(64),Rs=class extends Sr{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:n,D:o,E:s,F:c,G:u,H:p}=this;return[t,e,n,o,s,c,u,p]}set(t,e,n,o,s,c,u,p){this.A=t|0,this.B=e|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=c|0,this.G=u|0,this.H=p|0}process(t,e){for(let x=0;x<16;x++,e+=4)Br[x]=t.getUint32(e,!1);for(let x=16;x<64;x++){let _=Br[x-15],T=Br[x-2],N=Pt(_,7)^Pt(_,18)^_>>>3,E=Pt(T,17)^Pt(T,19)^T>>>10;Br[x]=E+Br[x-7]+N+Br[x-16]|0}let{A:n,B:o,C:s,D:c,E:u,F:p,G:h,H:y}=this;for(let x=0;x<64;x++){let _=Pt(u,6)^Pt(u,11)^Pt(u,25),T=y+_+Ul(u,p,h)+Il[x]+Br[x]|0,E=(Pt(n,2)^Pt(n,13)^Pt(n,22))+Cl(n,o,s)|0;y=h,h=p,p=u,u=c+T|0,c=s,s=o,o=n,n=T+E|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,c=c+this.D|0,u=u+this.E|0,p=p+this.F|0,h=h+this.G|0,y=y+this.H|0,this.set(n,o,s,c,u,p,h,y)}roundClean(){Br.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var ao=vr(()=>new Rs);function oi(r){if(!Number.isSafeInteger(r))throw new Error(`Wrong integer: ${r}`)}function Ic(...r){let t=(o,s)=>c=>o(s(c)),e=Array.from(r).reverse().reduce((o,s)=>o?t(o,s.encode):s.encode,void 0),n=r.reduce((o,s)=>o?t(o,s.decode):s.decode,void 0);return{encode:e,decode:n}}function Bl(r){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>=r.length)throw new Error(`Digit index outside alphabet: ${e} (alphabet: ${r.length})`);return r[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 n=r.indexOf(e);if(n===-1)throw new Error(`Unknown letter: "${e}". Allowed: ${r}`);return n})}}}function Rl(r=""){if(typeof r!="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(r)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(r)}}}function Cc(r,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(r))throw new Error("convertRadix: data should be array");if(!r.length)return[];let n=0,o=[],s=Array.from(r);for(s.forEach(c=>{if(c<0||c>=t)throw new Error(`Wrong integer: ${c}`)});;){let c=0,u=!0;for(let p=n;p<s.length;p++){let h=s[p],y=t*c+h;if(!Number.isSafeInteger(y)||t*c/t!==c||y-h!==t*c)throw new Error("convertRadix: carry overflow");c=y%e;let x=Math.floor(y/e);if(s[p]=x,!Number.isSafeInteger(x)||x*e+c!==y)throw new Error("convertRadix: carry overflow");if(u)x?u=!1:n=p;else continue}if(o.push(c),u)break}for(let c=0;c<r.length-1&&r[c]===0;c++)o.push(0);return o.reverse()}function Pl(r){return{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return Cc(Array.from(t),2**8,r)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(Cc(t,r,2**8))}}}function kl(r,t){if(typeof t!="function")throw new Error("checksum fn should be function");return{encode(e){if(!(e instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");let n=t(e).slice(0,r),o=new Uint8Array(e.length+r);return o.set(e),o.set(n,e.length),o},decode(e){if(!(e instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");let n=e.slice(0,-r),o=t(n).slice(0,r),s=e.slice(-r);for(let c=0;c<r;c++)if(o[c]!==s[c])throw new Error("Invalid checksum");return n}}}var Ol=r=>Ic(Pl(58),Bl(r),Rl("")),zl=Ol("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var Bc=r=>Ic(kl(4,t=>r(r(t))),zl);function Rc(r){if(typeof r!="string")throw new TypeError(`Invalid mnemonic type: ${typeof r}`);return r.normalize("NFKD")}function Nl(r){let t=Rc(r),e=t.split(" ");if(![12,15,18,21,24].includes(e.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:e}}var Ml=r=>Rc(`mnemonic${r}`);function Pc(r,t=""){return Uc(Qr,Nl(r).nfkd,Ml(t),{c:2048,dkLen:64})}var kc=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Oc=/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,zc=(t=>(t.ED25519="ed25519 seed",t))(zc||{}),Ps=2147483648;function ks(r){return Oc.test(r)}function Os(r){return kc.test(r)}var ii=(r,t)=>{let e=jt.create(Qr,r).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},zs=({key:r,chainCode:t},e)=>{let n=new ArrayBuffer(4);new DataView(n).setUint32(0,e);let o=new Uint8Array(n),s=new Uint8Array([0]),c=new Uint8Array([...s,...r,...o]);return ii(t,c)},ql=r=>r.replace("'",""),Ns=r=>r.split("/").slice(1).map(ql),co=r=>{let t=r.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return Pc(t)};var jr=class jr extends At{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==jr.LENGTH)throw new Error(`PublicKey length should be ${jr.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:n,signature:o}=e,s=me.fromHexInput(n).toUint8Array(),c=o.toUint8Array();return uo.default.sign.detached.verify(s,c,this.key.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new jr(n)}static load(e){let n=e.deserializeBytes();return new jr(n)}};jr.LENGTH=32;var Pe=jr,pt=class pt extends Vr{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==pt.LENGTH)throw new Error(`PrivateKey length should be ${pt.LENGTH}`);this.signingKeyPair=uo.default.sign.keyPair.fromSeed(n.toUint8Array().slice(0,pt.LENGTH))}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,pt.LENGTH)}toString(){return me.fromHexInput(this.toUint8Array()).toString()}sign(e){let n=me.fromHexInput(e),o=uo.default.sign.detached(n.toUint8Array(),this.signingKeyPair.secretKey);return new Ke(o)}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new pt(n)}static generate(){let e=uo.default.sign.keyPair();return new pt(e.secretKey.slice(0,pt.LENGTH))}publicKey(){let e=this.signingKeyPair.publicKey;return new Pe(e)}static fromDerivationPath(e,n){if(!Os(e))throw new Error(`Invalid derivation path ${e}`);return pt.fromDerivationPathInner(e,co(n))}static fromDerivationPathInner(e,n,o=Ps){let{key:s,chainCode:c}=ii(pt.SLIP_0010_SEED,n),u=Ns(e).map(h=>parseInt(h,10)),{key:p}=u.reduce((h,y)=>zs(h,y+o),{key:s,chainCode:c});return new pt(p)}};pt.LENGTH=32,pt.SLIP_0010_SEED="ed25519 seed";var or=pt,Wr=class Wr extends Mt{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==Wr.LENGTH)throw new Error(`Signature length should be ${Wr.LENGTH}`);this.data=n}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new Wr(n)}static load(e){let n=e.deserializeBytes();return new Wr(n)}};Wr.LENGTH=64;var Ke=Wr;var Ct=class Ct extends At{constructor(e){super();let{publicKeys:n,threshold:o}=e;if(n.length>Ct.MAX_KEYS||n.length<Ct.MIN_KEYS)throw new Error(`Must have between ${Ct.MIN_KEYS} and ${Ct.MAX_KEYS} public keys, inclusive`);if(o<Ct.MIN_THRESHOLD||o>n.length)throw new Error(`Threshold must be between ${Ct.MIN_THRESHOLD} and ${n.length}, inclusive`);this.publicKeys=n,this.threshold=o}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*Pe.LENGTH+1);return this.publicKeys.forEach((n,o)=>{e.set(n.toUint8Array(),o*Pe.LENGTH)}),e[this.publicKeys.length*Pe.LENGTH]=this.threshold,e}toString(){return me.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("TODO - Method not implemented.")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes(),o=n[n.length-1],s=[];for(let c=0;c<n.length-1;c+=Pe.LENGTH){let u=c;s.push(new Pe(n.subarray(u,u+Pe.LENGTH)))}return new Ct({publicKeys:s,threshold:o})}};Ct.MAX_KEYS=32,Ct.MIN_KEYS=2,Ct.MIN_THRESHOLD=1;var Dt=Ct,It=class It extends Mt{constructor(e){super();let{signatures:n,bitmap:o}=e;if(o.length!==It.BITMAP_LEN)throw new Error(`"bitmap" length should be ${It.BITMAP_LEN}`);if(n.length>It.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${It.MAX_SIGNATURES_SUPPORTED}`);this.signatures=n,this.bitmap=o}toUint8Array(){let e=new Uint8Array(this.signatures.length*Ke.LENGTH+It.BITMAP_LEN);return this.signatures.forEach((n,o)=>{e.set(n.toUint8Array(),o*Ke.LENGTH)}),e.set(this.bitmap,this.signatures.length*Ke.LENGTH),e}toString(){return me.fromHexInput(this.toUint8Array()).toString()}static createBitmap(e){let{bits:n}=e,o=128,s=new Uint8Array([0,0,0,0]),c=new Set;return n.forEach(u=>{if(u>=It.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${It.MAX_SIGNATURES_SUPPORTED-1}.`);if(c.has(u))throw new Error("Duplicate bits detected.");c.add(u);let p=Math.floor(u/8),h=s[p];h|=o>>u%8,s[p]=h}),s}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes(),o=n.subarray(n.length-4),s=[];for(let c=0;c<n.length-o.length;c+=Ke.LENGTH){let u=c;s.push(new Ke(n.subarray(u,u+Ke.LENGTH)))}return new It({signatures:s,bitmap:o})}};It.MAX_SIGNATURES_SUPPORTED=32,It.BITMAP_LEN=4;var Yr=It;var Gs={};ec(Gs,{bitGet:()=>Vl,bitLen:()=>$l,bitMask:()=>fo,bitSet:()=>Ql,bytesToHex:()=>Xr,bytesToNumberBE:()=>ir,bytesToNumberLE:()=>ci,concatBytes:()=>Rn,createHmacDrbg:()=>qs,ensureBytes:()=>bt,equalBytes:()=>Kl,hexToBytes:()=>Zr,hexToNumber:()=>Ds,numberToBytesBE:()=>Rr,numberToBytesLE:()=>ui,numberToHexUnpadded:()=>Dc,numberToVarBytesBE:()=>Fl,utf8ToBytes:()=>Hl,validateObject:()=>Pr});var Mc=BigInt(0),si=BigInt(1),Gl=BigInt(2),ai=r=>r instanceof Uint8Array,Ll=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function Xr(r){if(!ai(r))throw new Error("Uint8Array expected");let t="";for(let e=0;e<r.length;e++)t+=Ll[r[e]];return t}function Dc(r){let t=r.toString(16);return t.length&1?`0${t}`:t}function Ds(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}function Zr(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.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 n=0;n<e.length;n++){let o=n*2,s=r.slice(o,o+2),c=Number.parseInt(s,16);if(Number.isNaN(c)||c<0)throw new Error("Invalid byte sequence");e[n]=c}return e}function ir(r){return Ds(Xr(r))}function ci(r){if(!ai(r))throw new Error("Uint8Array expected");return Ds(Xr(Uint8Array.from(r).reverse()))}function Rr(r,t){return Zr(r.toString(16).padStart(t*2,"0"))}function ui(r,t){return Rr(r,t).reverse()}function Fl(r){return Zr(Dc(r))}function bt(r,t,e){let n;if(typeof t=="string")try{n=Zr(t)}catch(s){throw new Error(`${r} must be valid hex string, got "${t}". Cause: ${s}`)}else if(ai(t))n=Uint8Array.from(t);else throw new Error(`${r} must be hex string or Uint8Array`);let o=n.length;if(typeof e=="number"&&o!==e)throw new Error(`${r} expected ${e} bytes, got ${o}`);return n}function Rn(...r){let t=new Uint8Array(r.reduce((n,o)=>n+o.length,0)),e=0;return r.forEach(n=>{if(!ai(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}function Kl(r,t){if(r.length!==t.length)return!1;for(let e=0;e<r.length;e++)if(r[e]!==t[e])return!1;return!0}function Hl(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function $l(r){let t;for(t=0;r>Mc;r>>=si,t+=1);return t}function Vl(r,t){return r>>BigInt(t)&si}var Ql=(r,t,e)=>r|(e?si:Mc)<<BigInt(t),fo=r=>(Gl<<BigInt(r-1))-si,Ms=r=>new Uint8Array(r),Nc=r=>Uint8Array.from(r);function qs(r,t,e){if(typeof r!="number"||r<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 n=Ms(r),o=Ms(r),s=0,c=()=>{n.fill(1),o.fill(0),s=0},u=(...x)=>e(o,n,...x),p=(x=Ms())=>{o=u(Nc([0]),x),n=u(),x.length!==0&&(o=u(Nc([1]),x),n=u())},h=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let x=0,_=[];for(;x<t;){n=u();let T=n.slice();_.push(T),x+=n.length}return Rn(..._)};return(x,_)=>{c(),p(x);let T;for(;!(T=_(h()));)p();return c(),T}}var jl={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||r instanceof Uint8Array,isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function Pr(r,t,e={}){let n=(o,s,c)=>{let u=jl[s];if(typeof u!="function")throw new Error(`Invalid validator "${s}", expected function`);let p=r[o];if(!(c&&p===void 0)&&!u(p,r))throw new Error(`Invalid param ${String(o)}=${p} (${typeof p}), expected ${s}`)};for(let[o,s]of Object.entries(t))n(o,s,!1);for(let[o,s]of Object.entries(e))n(o,s,!0);return r}var et=BigInt(0),He=BigInt(1),Jr=BigInt(2),Wl=BigInt(3),Ls=BigInt(4),qc=BigInt(5),Gc=BigInt(8),Yl=BigInt(9),Xl=BigInt(16);function tt(r,t){let e=r%t;return e>=et?e:t+e}function Zl(r,t,e){if(e<=et||t<et)throw new Error("Expected power/modulo > 0");if(e===He)return et;let n=He;for(;t>et;)t&He&&(n=n*r%e),r=r*r%e,t>>=He;return n}function wt(r,t,e){let n=r;for(;t-- >et;)n*=n,n%=e;return n}function fi(r,t){if(r===et||t<=et)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=tt(r,t),n=t,o=et,s=He,c=He,u=et;for(;e!==et;){let h=n/e,y=n%e,x=o-c*h,_=s-u*h;n=e,e=y,o=c,s=u,c=x,u=_}if(n!==He)throw new Error("invert: does not exist");return tt(o,t)}function Jl(r){let t=(r-He)/Jr,e,n,o;for(e=r-He,n=0;e%Jr===et;e/=Jr,n++);for(o=Jr;o<r&&Zl(o,t,r)!==r-He;o++);if(n===1){let c=(r+He)/Ls;return function(p,h){let y=p.pow(h,c);if(!p.eql(p.sqr(y),h))throw new Error("Cannot find square root");return y}}let s=(e+He)/Jr;return function(u,p){if(u.pow(p,t)===u.neg(u.ONE))throw new Error("Cannot find square root");let h=n,y=u.pow(u.mul(u.ONE,o),e),x=u.pow(p,s),_=u.pow(p,e);for(;!u.eql(_,u.ONE);){if(u.eql(_,u.ZERO))return u.ZERO;let T=1;for(let E=u.sqr(_);T<h&&!u.eql(E,u.ONE);T++)E=u.sqr(E);let N=u.pow(y,He<<BigInt(h-T-1));y=u.sqr(N),x=u.mul(x,N),_=u.mul(_,y),h=T}return x}}function ep(r){if(r%Ls===Wl){let t=(r+He)/Ls;return function(n,o){let s=n.pow(o,t);if(!n.eql(n.sqr(s),o))throw new Error("Cannot find square root");return s}}if(r%Gc===qc){let t=(r-qc)/Gc;return function(n,o){let s=n.mul(o,Jr),c=n.pow(s,t),u=n.mul(o,c),p=n.mul(n.mul(u,Jr),c),h=n.mul(u,n.sub(p,n.ONE));if(!n.eql(n.sqr(h),o))throw new Error("Cannot find square root");return h}}return r%Xl,Jl(r)}var tp=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Fs(r){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=tp.reduce((n,o)=>(n[o]="function",n),t);return Pr(r,e)}function rp(r,t,e){if(e<et)throw new Error("Expected power > 0");if(e===et)return r.ONE;if(e===He)return t;let n=r.ONE,o=t;for(;e>et;)e&He&&(n=r.mul(n,o)),o=r.sqr(o),e>>=He;return n}function np(r,t){let e=new Array(t.length),n=t.reduce((s,c,u)=>r.is0(c)?s:(e[u]=s,r.mul(s,c)),r.ONE),o=r.inv(n);return t.reduceRight((s,c,u)=>r.is0(c)?s:(e[u]=r.mul(s,e[u]),r.mul(s,c)),o),e}function Ks(r,t){let e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function Lc(r,t,e=!1,n={}){if(r<=et)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:o,nByteLength:s}=Ks(r,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let c=ep(r),u=Object.freeze({ORDER:r,BITS:o,BYTES:s,MASK:fo(o),ZERO:et,ONE:He,create:p=>tt(p,r),isValid:p=>{if(typeof p!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof p}`);return et<=p&&p<r},is0:p=>p===et,isOdd:p=>(p&He)===He,neg:p=>tt(-p,r),eql:(p,h)=>p===h,sqr:p=>tt(p*p,r),add:(p,h)=>tt(p+h,r),sub:(p,h)=>tt(p-h,r),mul:(p,h)=>tt(p*h,r),pow:(p,h)=>rp(u,p,h),div:(p,h)=>tt(p*fi(h,r),r),sqrN:p=>p*p,addN:(p,h)=>p+h,subN:(p,h)=>p-h,mulN:(p,h)=>p*h,inv:p=>fi(p,r),sqrt:n.sqrt||(p=>c(u,p)),invertBatch:p=>np(u,p),cmov:(p,h,y)=>y?h:p,toBytes:p=>e?ui(p,s):Rr(p,s),fromBytes:p=>{if(p.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${p.length}`);return e?ci(p):ir(p)}});return Object.freeze(u)}function Fc(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let t=r.toString(2).length;return Math.ceil(t/8)}function Hs(r){let t=Fc(r);return t+Math.ceil(t/2)}function Kc(r,t,e=!1){let n=r.length,o=Fc(t),s=Hs(t);if(n<16||n<s||n>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);let c=e?ir(r):ci(r),u=tt(c,t-He)+He;return e?ui(u,o):Rr(u,o)}var ip=BigInt(0),$s=BigInt(1);function Hc(r,t){let e=(o,s)=>{let c=s.negate();return o?c:s},n=o=>{let s=Math.ceil(t/o)+1,c=2**(o-1);return{windows:s,windowSize:c}};return{constTimeNegate:e,unsafeLadder(o,s){let c=r.ZERO,u=o;for(;s>ip;)s&$s&&(c=c.add(u)),u=u.double(),s>>=$s;return c},precomputeWindow(o,s){let{windows:c,windowSize:u}=n(s),p=[],h=o,y=h;for(let x=0;x<c;x++){y=h,p.push(y);for(let _=1;_<u;_++)y=y.add(h),p.push(y);h=y.double()}return p},wNAF(o,s,c){let{windows:u,windowSize:p}=n(o),h=r.ZERO,y=r.BASE,x=BigInt(2**o-1),_=2**o,T=BigInt(o);for(let N=0;N<u;N++){let E=N*p,R=Number(c&x);c>>=T,R>p&&(R-=_,c+=$s);let P=E,Q=E+Math.abs(R)-1,z=N%2!==0,ee=R<0;R===0?y=y.add(e(z,s[P])):h=h.add(e(ee,s[Q]))}return{p:h,f:y}},wNAFCached(o,s,c,u){let p=o._WINDOW_SIZE||1,h=s.get(o);return h||(h=this.precomputeWindow(o,p),p!==1&&s.set(o,u(h))),this.wNAF(p,h,c)}}}function Vs(r){return Fs(r.Fp),Pr(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ks(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}function sp(r){let t=Vs(r);Pr(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:n,a:o}=t;if(e){if(!n.eql(o,n.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:ap,hexToBytes:cp}=Gs,en={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(r){let{Err:t}=en;if(r.length<2||r[0]!==2)throw new t("Invalid signature integer tag");let e=r[1],n=r.subarray(2,e+2);if(!e||n.length!==e)throw new t("Invalid signature integer: wrong length");if(n[0]&128)throw new t("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:ap(n),l:r.subarray(e+2)}},toSig(r){let{Err:t}=en,e=typeof r=="string"?cp(r):r;if(!(e instanceof Uint8Array))throw new Error("ui8a expected");let n=e.length;if(n<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==n-2)throw new t("Invalid signature: incorrect length");let{d:o,l:s}=en._parseInt(e.subarray(2)),{d:c,l:u}=en._parseInt(s);if(u.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s:c}},hexFromSig(r){let t=h=>Number.parseInt(h[0],16)&8?"00"+h:h,e=h=>{let y=h.toString(16);return y.length&1?`0${y}`:y},n=t(e(r.s)),o=t(e(r.r)),s=n.length/2,c=o.length/2,u=e(s),p=e(c);return`30${e(c+s+4)}02${p}${o}02${u}${n}`}},sr=BigInt(0),Bt=BigInt(1),Im=BigInt(2),$c=BigInt(3),Bm=BigInt(4);function up(r){let t=sp(r),{Fp:e}=t,n=t.toBytes||((N,E,R)=>{let P=E.toAffine();return Rn(Uint8Array.from([4]),e.toBytes(P.x),e.toBytes(P.y))}),o=t.fromBytes||(N=>{let E=N.subarray(1),R=e.fromBytes(E.subarray(0,e.BYTES)),P=e.fromBytes(E.subarray(e.BYTES,2*e.BYTES));return{x:R,y:P}});function s(N){let{a:E,b:R}=t,P=e.sqr(N),Q=e.mul(P,N);return e.add(e.add(Q,e.mul(N,E)),R)}if(!e.eql(e.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function c(N){return typeof N=="bigint"&&sr<N&&N<t.n}function u(N){if(!c(N))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function p(N){let{allowedPrivateKeyLengths:E,nByteLength:R,wrapPrivateKey:P,n:Q}=t;if(E&&typeof N!="bigint"){if(N instanceof Uint8Array&&(N=Xr(N)),typeof N!="string"||!E.includes(N.length))throw new Error("Invalid key");N=N.padStart(R*2,"0")}let z;try{z=typeof N=="bigint"?N:ir(bt("private key",N,R))}catch{throw new Error(`private key must be ${R} bytes, hex or bigint, not ${typeof N}`)}return P&&(z=tt(z,Q)),u(z),z}let h=new Map;function y(N){if(!(N instanceof x))throw new Error("ProjectivePoint expected")}class x{constructor(E,R,P){if(this.px=E,this.py=R,this.pz=P,E==null||!e.isValid(E))throw new Error("x required");if(R==null||!e.isValid(R))throw new Error("y required");if(P==null||!e.isValid(P))throw new Error("z required")}static fromAffine(E){let{x:R,y:P}=E||{};if(!E||!e.isValid(R)||!e.isValid(P))throw new Error("invalid affine point");if(E instanceof x)throw new Error("projective point not allowed");let Q=z=>e.eql(z,e.ZERO);return Q(R)&&Q(P)?x.ZERO:new x(R,P,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(E){let R=e.invertBatch(E.map(P=>P.pz));return E.map((P,Q)=>P.toAffine(R[Q])).map(x.fromAffine)}static fromHex(E){let R=x.fromAffine(o(bt("pointHex",E)));return R.assertValidity(),R}static fromPrivateKey(E){return x.BASE.multiply(p(E))}_setWindowSize(E){this._WINDOW_SIZE=E,h.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:E,y:R}=this.toAffine();if(!e.isValid(E)||!e.isValid(R))throw new Error("bad point: x or y not FE");let P=e.sqr(R),Q=s(E);if(!e.eql(P,Q))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:E}=this.toAffine();if(e.isOdd)return!e.isOdd(E);throw new Error("Field doesn't support isOdd")}equals(E){y(E);let{px:R,py:P,pz:Q}=this,{px:z,py:ee,pz:L}=E,j=e.eql(e.mul(R,L),e.mul(z,Q)),J=e.eql(e.mul(P,L),e.mul(ee,Q));return j&&J}negate(){return new x(this.px,e.neg(this.py),this.pz)}double(){let{a:E,b:R}=t,P=e.mul(R,$c),{px:Q,py:z,pz:ee}=this,L=e.ZERO,j=e.ZERO,J=e.ZERO,X=e.mul(Q,Q),Re=e.mul(z,z),xe=e.mul(ee,ee),ye=e.mul(Q,z);return ye=e.add(ye,ye),J=e.mul(Q,ee),J=e.add(J,J),L=e.mul(E,J),j=e.mul(P,xe),j=e.add(L,j),L=e.sub(Re,j),j=e.add(Re,j),j=e.mul(L,j),L=e.mul(ye,L),J=e.mul(P,J),xe=e.mul(E,xe),ye=e.sub(X,xe),ye=e.mul(E,ye),ye=e.add(ye,J),J=e.add(X,X),X=e.add(J,X),X=e.add(X,xe),X=e.mul(X,ye),j=e.add(j,X),xe=e.mul(z,ee),xe=e.add(xe,xe),X=e.mul(xe,ye),L=e.sub(L,X),J=e.mul(xe,Re),J=e.add(J,J),J=e.add(J,J),new x(L,j,J)}add(E){y(E);let{px:R,py:P,pz:Q}=this,{px:z,py:ee,pz:L}=E,j=e.ZERO,J=e.ZERO,X=e.ZERO,Re=t.a,xe=e.mul(t.b,$c),ye=e.mul(R,z),Ve=e.mul(P,ee),Qe=e.mul(Q,L),dt=e.add(R,P),O=e.add(z,ee);dt=e.mul(dt,O),O=e.add(ye,Ve),dt=e.sub(dt,O),O=e.add(R,Q);let K=e.add(z,L);return O=e.mul(O,K),K=e.add(ye,Qe),O=e.sub(O,K),K=e.add(P,Q),j=e.add(ee,L),K=e.mul(K,j),j=e.add(Ve,Qe),K=e.sub(K,j),X=e.mul(Re,O),j=e.mul(xe,Qe),X=e.add(j,X),j=e.sub(Ve,X),X=e.add(Ve,X),J=e.mul(j,X),Ve=e.add(ye,ye),Ve=e.add(Ve,ye),Qe=e.mul(Re,Qe),O=e.mul(xe,O),Ve=e.add(Ve,Qe),Qe=e.sub(ye,Qe),Qe=e.mul(Re,Qe),O=e.add(O,Qe),ye=e.mul(Ve,O),J=e.add(J,ye),ye=e.mul(K,O),j=e.mul(dt,j),j=e.sub(j,ye),ye=e.mul(dt,Ve),X=e.mul(K,X),X=e.add(X,ye),new x(j,J,X)}subtract(E){return this.add(E.negate())}is0(){return this.equals(x.ZERO)}wNAF(E){return T.wNAFCached(this,h,E,R=>{let P=e.invertBatch(R.map(Q=>Q.pz));return R.map((Q,z)=>Q.toAffine(P[z])).map(x.fromAffine)})}multiplyUnsafe(E){let R=x.ZERO;if(E===sr)return R;if(u(E),E===Bt)return this;let{endo:P}=t;if(!P)return T.unsafeLadder(this,E);let{k1neg:Q,k1:z,k2neg:ee,k2:L}=P.splitScalar(E),j=R,J=R,X=this;for(;z>sr||L>sr;)z&Bt&&(j=j.add(X)),L&Bt&&(J=J.add(X)),X=X.double(),z>>=Bt,L>>=Bt;return Q&&(j=j.negate()),ee&&(J=J.negate()),J=new x(e.mul(J.px,P.beta),J.py,J.pz),j.add(J)}multiply(E){u(E);let R=E,P,Q,{endo:z}=t;if(z){let{k1neg:ee,k1:L,k2neg:j,k2:J}=z.splitScalar(R),{p:X,f:Re}=this.wNAF(L),{p:xe,f:ye}=this.wNAF(J);X=T.constTimeNegate(ee,X),xe=T.constTimeNegate(j,xe),xe=new x(e.mul(xe.px,z.beta),xe.py,xe.pz),P=X.add(xe),Q=Re.add(ye)}else{let{p:ee,f:L}=this.wNAF(R);P=ee,Q=L}return x.normalizeZ([P,Q])[0]}multiplyAndAddUnsafe(E,R,P){let Q=x.BASE,z=(L,j)=>j===sr||j===Bt||!L.equals(Q)?L.multiplyUnsafe(j):L.multiply(j),ee=z(this,R).add(z(E,P));return ee.is0()?void 0:ee}toAffine(E){let{px:R,py:P,pz:Q}=this,z=this.is0();E==null&&(E=z?e.ONE:e.inv(Q));let ee=e.mul(R,E),L=e.mul(P,E),j=e.mul(Q,E);if(z)return{x:e.ZERO,y:e.ZERO};if(!e.eql(j,e.ONE))throw new Error("invZ was invalid");return{x:ee,y:L}}isTorsionFree(){let{h:E,isTorsionFree:R}=t;if(E===Bt)return!0;if(R)return R(x,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:E,clearCofactor:R}=t;return E===Bt?this:R?R(x,this):this.multiplyUnsafe(t.h)}toRawBytes(E=!0){return this.assertValidity(),n(x,this,E)}toHex(E=!0){return Xr(this.toRawBytes(E))}}x.BASE=new x(t.Gx,t.Gy,e.ONE),x.ZERO=new x(e.ZERO,e.ONE,e.ZERO);let _=t.nBitLength,T=Hc(x,t.endo?Math.ceil(_/2):_);return{CURVE:t,ProjectivePoint:x,normPrivateKeyToScalar:p,weierstrassEquation:s,isWithinCurveOrder:c}}function fp(r){let t=Vs(r);return Pr(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Vc(r){let t=fp(r),{Fp:e,n}=t,o=e.BYTES+1,s=2*e.BYTES+1;function c(O){return sr<O&&O<e.ORDER}function u(O){return tt(O,n)}function p(O){return fi(O,n)}let{ProjectivePoint:h,normPrivateKeyToScalar:y,weierstrassEquation:x,isWithinCurveOrder:_}=up({...t,toBytes(O,K,se){let Ee=K.toAffine(),Se=e.toBytes(Ee.x),je=Rn;return se?je(Uint8Array.from([K.hasEvenY()?2:3]),Se):je(Uint8Array.from([4]),Se,e.toBytes(Ee.y))},fromBytes(O){let K=O.length,se=O[0],Ee=O.subarray(1);if(K===o&&(se===2||se===3)){let Se=ir(Ee);if(!c(Se))throw new Error("Point is not on curve");let je=x(Se),ot=e.sqrt(je),ke=(ot&Bt)===Bt;return(se&1)===1!==ke&&(ot=e.neg(ot)),{x:Se,y:ot}}else if(K===s&&se===4){let Se=e.fromBytes(Ee.subarray(0,e.BYTES)),je=e.fromBytes(Ee.subarray(e.BYTES,2*e.BYTES));return{x:Se,y:je}}else throw new Error(`Point of length ${K} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`)}}),T=O=>Xr(Rr(O,t.nByteLength));function N(O){let K=n>>Bt;return O>K}function E(O){return N(O)?u(-O):O}let R=(O,K,se)=>ir(O.slice(K,se));class P{constructor(K,se,Ee){this.r=K,this.s=se,this.recovery=Ee,this.assertValidity()}static fromCompact(K){let se=t.nByteLength;return K=bt("compactSignature",K,se*2),new P(R(K,0,se),R(K,se,2*se))}static fromDER(K){let{r:se,s:Ee}=en.toSig(bt("DER",K));return new P(se,Ee)}assertValidity(){if(!_(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!_(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(K){return new P(this.r,this.s,K)}recoverPublicKey(K){let{r:se,s:Ee,recovery:Se}=this,je=J(bt("msgHash",K));if(Se==null||![0,1,2,3].includes(Se))throw new Error("recovery id invalid");let ot=Se===2||Se===3?se+t.n:se;if(ot>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let ke=Se&1?"03":"02",Xe=h.fromHex(ke+T(ot)),ae=p(ot),Ze=u(-je*ae),xr=u(Ee*ae),Rt=h.BASE.multiplyAndAddUnsafe(Xe,Ze,xr);if(!Rt)throw new Error("point at infinify");return Rt.assertValidity(),Rt}hasHighS(){return N(this.s)}normalizeS(){return this.hasHighS()?new P(this.r,u(-this.s),this.recovery):this}toDERRawBytes(){return Zr(this.toDERHex())}toDERHex(){return en.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Zr(this.toCompactHex())}toCompactHex(){return T(this.r)+T(this.s)}}let Q={isValidPrivateKey(O){try{return y(O),!0}catch{return!1}},normPrivateKeyToScalar:y,randomPrivateKey:()=>{let O=Hs(t.n);return Kc(t.randomBytes(O),t.n)},precompute(O=8,K=h.BASE){return K._setWindowSize(O),K.multiply(BigInt(3)),K}};function z(O,K=!0){return h.fromPrivateKey(O).toRawBytes(K)}function ee(O){let K=O instanceof Uint8Array,se=typeof O=="string",Ee=(K||se)&&O.length;return K?Ee===o||Ee===s:se?Ee===2*o||Ee===2*s:O instanceof h}function L(O,K,se=!0){if(ee(O))throw new Error("first arg must be private key");if(!ee(K))throw new Error("second arg must be public key");return h.fromHex(K).multiply(y(O)).toRawBytes(se)}let j=t.bits2int||function(O){let K=ir(O),se=O.length*8-t.nBitLength;return se>0?K>>BigInt(se):K},J=t.bits2int_modN||function(O){return u(j(O))},X=fo(t.nBitLength);function Re(O){if(typeof O!="bigint")throw new Error("bigint expected");if(!(sr<=O&&O<X))throw new Error(`bigint expected < 2^${t.nBitLength}`);return Rr(O,t.nByteLength)}function xe(O,K,se=ye){if(["recovered","canonical"].some(vt=>vt in se))throw new Error("sign() legacy options not supported");let{hash:Ee,randomBytes:Se}=t,{lowS:je,prehash:ot,extraEntropy:ke}=se;je==null&&(je=!0),O=bt("msgHash",O),ot&&(O=bt("prehashed msgHash",Ee(O)));let Xe=J(O),ae=y(K),Ze=[Re(ae),Re(Xe)];if(ke!=null){let vt=ke===!0?Se(e.BYTES):ke;Ze.push(bt("extraEntropy",vt))}let xr=Rn(...Ze),Rt=Xe;function Ar(vt){let Zt=j(vt);if(!_(Zt))return;let Nr=p(Zt),mt=h.BASE.multiply(Zt).toAffine(),br=u(mt.x);if(br===sr)return;let En=u(Nr*u(Rt+br*ae));if(En===sr)return;let No=(mt.x===br?0:2)|Number(mt.y&Bt),Qn=En;return je&&N(En)&&(Qn=E(En),No^=1),new P(br,Qn,No)}return{seed:xr,k2sig:Ar}}let ye={lowS:t.lowS,prehash:!1},Ve={lowS:t.lowS,prehash:!1};function Qe(O,K,se=ye){let{seed:Ee,k2sig:Se}=xe(O,K,se),je=t;return qs(je.hash.outputLen,je.nByteLength,je.hmac)(Ee,Se)}h.BASE._setWindowSize(8);function dt(O,K,se,Ee=Ve){let Se=O;if(K=bt("msgHash",K),se=bt("publicKey",se),"strict"in Ee)throw new Error("options.strict was renamed to lowS");let{lowS:je,prehash:ot}=Ee,ke,Xe;try{if(typeof Se=="string"||Se instanceof Uint8Array)try{ke=P.fromDER(Se)}catch(mt){if(!(mt instanceof en.Err))throw mt;ke=P.fromCompact(Se)}else if(typeof Se=="object"&&typeof Se.r=="bigint"&&typeof Se.s=="bigint"){let{r:mt,s:br}=Se;ke=new P(mt,br)}else throw new Error("PARSE");Xe=h.fromHex(se)}catch(mt){if(mt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(je&&ke.hasHighS())return!1;ot&&(K=t.hash(K));let{r:ae,s:Ze}=ke,xr=J(K),Rt=p(Ze),Ar=u(xr*Rt),vt=u(ae*Rt),Zt=h.BASE.multiplyAndAddUnsafe(Xe,Ar,vt)?.toAffine();return Zt?u(Zt.x)===ae:!1}return{CURVE:t,getPublicKey:z,getSharedSecret:L,sign:Qe,verify:dt,ProjectivePoint:h,Signature:P,utils:Q}}function dp(r){return{hash:r,hmac:(t,...e)=>jt(r,t,Fr(...e)),randomBytes:gc}}function Qc(r,t){let e=n=>Vc({...r,...dp(n)});return Object.freeze({...e(t),create:e})}var Yc=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),jc=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),lp=BigInt(1),Qs=BigInt(2),Wc=(r,t)=>(r+t/Qs)/t;function pp(r){let t=Yc,e=BigInt(3),n=BigInt(6),o=BigInt(11),s=BigInt(22),c=BigInt(23),u=BigInt(44),p=BigInt(88),h=r*r*r%t,y=h*h*r%t,x=wt(y,e,t)*y%t,_=wt(x,e,t)*y%t,T=wt(_,Qs,t)*h%t,N=wt(T,o,t)*T%t,E=wt(N,s,t)*N%t,R=wt(E,u,t)*E%t,P=wt(R,p,t)*R%t,Q=wt(P,u,t)*E%t,z=wt(Q,e,t)*y%t,ee=wt(z,c,t)*N%t,L=wt(ee,n,t)*h%t,j=wt(L,Qs,t);if(!js.eql(js.sqr(j),r))throw new Error("Cannot find square root");return j}var js=Lc(Yc,void 0,void 0,{sqrt:pp}),ut=Qc({a:BigInt(0),b:BigInt(7),Fp:js,n:jc,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{let t=jc,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-lp*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,c=BigInt("0x100000000000000000000000000000000"),u=Wc(s*r,t),p=Wc(-n*r,t),h=tt(r-u*e-p*o,t),y=tt(-u*n-p*s,t),x=h>c,_=y>c;if(x&&(h=t-h),_&&(y=t-y),h>c||y>c)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:x,k1:h,k2neg:_,k2:y}}}},ao),qm=BigInt(0);var Gm=ut.ProjectivePoint;var gp=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Zc=Uint8Array.from({length:16},(r,t)=>t),hp=Zc.map(r=>(9*r+5)%16),Ys=[Zc],Xs=[hp];for(let r=0;r<4;r++)for(let t of[Ys,Xs])t.push(t[r].map(e=>gp[e]));var Jc=[[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(r=>new Uint8Array(r)),yp=Ys.map((r,t)=>r.map(e=>Jc[t][e])),mp=Xs.map((r,t)=>r.map(e=>Jc[t][e])),xp=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Ap=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),di=(r,t)=>r<<t|r>>>32-t;function Xc(r,t,e,n){return r===0?t^e^n:r===1?t&e|~t&n:r===2?(t|~e)^n:r===3?t&n|e&~n:t^(e|~n)}var li=new Uint32Array(16),Ws=class extends Sr{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:n,h3:o,h4:s}=this;return[t,e,n,o,s]}set(t,e,n,o,s){this.h0=t|0,this.h1=e|0,this.h2=n|0,this.h3=o|0,this.h4=s|0}process(t,e){for(let T=0;T<16;T++,e+=4)li[T]=t.getUint32(e,!0);let n=this.h0|0,o=n,s=this.h1|0,c=s,u=this.h2|0,p=u,h=this.h3|0,y=h,x=this.h4|0,_=x;for(let T=0;T<5;T++){let N=4-T,E=xp[T],R=Ap[T],P=Ys[T],Q=Xs[T],z=yp[T],ee=mp[T];for(let L=0;L<16;L++){let j=di(n+Xc(T,s,u,h)+li[P[L]]+E,z[L])+x|0;n=x,x=h,h=di(u,10)|0,u=s,s=j}for(let L=0;L<16;L++){let j=di(o+Xc(N,c,p,y)+li[Q[L]]+R,ee[L])+_|0;o=_,_=y,y=di(p,10)|0,p=c,c=j}}this.set(this.h1+u+y|0,this.h2+h+_|0,this.h3+x+o|0,this.h4+n+c|0,this.h0+s+p|0)}roundClean(){li.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}},eu=vr(()=>new Ws);var pi=ut.ProjectivePoint,Zs=Bc(ao);function tu(r){return BigInt(`0x${Lr(r)}`)}function bp(r){return Bn(r.toString(16).padStart(64,"0"))}var wp=vs("Bitcoin seed"),Js={private:76066276,public:76067358},ea=2147483648,Tp=r=>eu(ao(r)),vp=r=>Qt(r).getUint32(0,!1),gi=r=>{if(!Number.isSafeInteger(r)||r<0||r>2**32-1)throw new Error(`Invalid number=${r}. Should be from 0 to 2 ** 32 - 1`);let t=new Uint8Array(4);return Qt(t).setUint32(0,r,!1),t},hi=class r{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return vp(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 Zs.encode(this.serialize(this.versions.private,Fr(new Uint8Array([0]),t)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return Zs.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(t,e=Js){if(zt(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 n=jt(Qr,wp,t);return new r({versions:e,chainCode:n.slice(32),privateKey:n.slice(0,32)})}static fromExtendedKey(t,e=Js){let n=Zs.decode(t),o=Qt(n),s=o.getUint32(0,!1),c={versions:e,depth:n[4],parentFingerprint:o.getUint32(5,!1),index:o.getUint32(9,!1),chainCode:n.slice(13,45)},u=n.slice(45),p=u[0]===0;if(s!==e[p?"private":"public"])throw new Error("Version mismatch");return p?new r({...c,privateKey:u.slice(1)}):new r({...c,publicKey:u})}static fromJSON(t){return r.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||Js,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(!ut.utils.isValidPrivateKey(t.privateKey))throw new Error("Invalid private key");this.privKey=typeof t.privateKey=="bigint"?t.privateKey:tu(t.privateKey),this.privKeyBytes=bp(this.privKey),this.pubKey=ut.getPublicKey(t.privateKey,!0)}else if(t.publicKey)this.pubKey=pi.fromHex(t.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=Tp(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("/"),n=this;for(let o of e){let s=/^(\d+)('?)$/.exec(o),c=s&&s[1];if(!s||s.length!==3||typeof c!="string")throw new Error(`Invalid child index: ${o}`);let u=+c;if(!Number.isSafeInteger(u)||u>=ea)throw new Error("Invalid index");s[2]==="'"&&(u+=ea),n=n.deriveChild(u)}return n}deriveChild(t){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let e=gi(t);if(t>=ea){let u=this.privateKey;if(!u)throw new Error("Could not derive hardened child key");e=Fr(new Uint8Array([0]),u,e)}else e=Fr(this.pubKey,e);let n=jt(Qr,this.chainCode,e),o=tu(n.slice(0,32)),s=n.slice(32);if(!ut.utils.isValidPrivateKey(o))throw new Error("Tweak bigger than curve order");let c={versions:this.versions,chainCode:s,depth:this.depth+1,parentFingerprint:this.fingerprint,index:t};try{if(this.privateKey){let u=tt(this.privKey+o,ut.CURVE.n);if(!ut.utils.isValidPrivateKey(u))throw new Error("The tweak was out of range or the resulted private key is invalid");c.privateKey=u}else{let u=pi.fromHex(this.pubKey).add(pi.fromPrivateKey(o));if(u.equals(pi.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");c.publicKey=u.toRawBytes(!0)}return new r(c)}catch{return this.deriveChild(t+1)}}sign(t){if(!this.privateKey)throw new Error("No privateKey set!");return zt(t,32),ut.sign(t,this.privKey).toCompactRawBytes()}verify(t,e){if(zt(t,32),zt(e,64),!this.publicKey)throw new Error("No publicKey set!");let n;try{n=ut.Signature.fromCompact(e)}catch{return!1}return ut.verify(n,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 zt(e,33),Fr(gi(t),new Uint8Array([this.depth]),gi(this.parentFingerprint),gi(this.index),this.chainCode,e)}};var tn=class tn extends At{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==tn.LENGTH)throw new Error(`PublicKey length should be ${tn.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:n,signature:o}=e,s=me.fromHexInput(n).toUint8Array(),c=$r(s),u=o.toUint8Array();return ut.verify(u,c,this.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new tn(n)}static load(e){let n=e.deserializeBytes();return new tn(n)}};tn.LENGTH=65;var qt=tn,ar=class ar extends Vr{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==ar.LENGTH)throw new Error(`PrivateKey length should be ${ar.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}sign(e){let n=me.fromHexInput(e),o=$r(n.toUint8Array()),s=ut.sign(o,this.key.toUint8Array());return new ur(s.toCompactRawBytes())}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new ar(n)}static generate(){let e=ut.utils.randomPrivateKey();return new ar(e)}publicKey(){let e=ut.getPublicKey(this.key.toUint8Array(),!1);return new qt(e)}static fromDerivationPath(e,n){if(!ks(e))throw new Error(`Invalid derivation path ${e}`);return ar.fromDerivationPathInner(e,co(n))}static fromDerivationPathInner(e,n){let{privateKey:o}=hi.fromMasterSeed(n).derive(e);if(o===null)throw new Error("Invalid key");return new ar(o)}};ar.LENGTH=32;var cr=ar,rn=class rn extends Mt{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==rn.LENGTH)throw new Error(`Signature length should be ${rn.LENGTH}, recieved ${n.toUint8Array().length}`);this.data=n}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new rn(n)}static load(e){let n=e.deserializeBytes();return new rn(n)}};rn.LENGTH=64;var ur=rn;var Ye=class r extends At{constructor(e){super();this.publicKey=e}toUint8Array(){return this.publicKey.toUint8Array()}toString(){return this.publicKey.toString()}verifySignature(e){let{message:n,signature:o}=e;return this.publicKey.verifySignature({message:n,signature:o})}serialize(e){if(this.publicKey instanceof Pe)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else if(this.publicKey instanceof qt)e.serializeU32AsUleb128(1),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let n=e.deserializeUleb128AsU32();switch(n){case 0:return new r(Pe.load(e));case 1:return new r(qt.load(e));default:throw new Error(`Unknown variant index for AnyPublicKey: ${n}`)}}};var nn=class r extends At{constructor(e){super();let{publicKeys:n,signaturesRequired:o}=e;if(o<1)throw new Error("The number of required signatures needs to be greater then 0");if(n.length<o)throw new Error(`Provided ${n.length} public keys is smaller than the ${o} required signatures`);let s=[];n.forEach(c=>{c instanceof Ye?s.push(c):s.push(new Ye(c))}),this.publicKeys=s,this.signaturesRequired=o}toUint8Array(){return this.bcsToBytes()}createBitmap(e){let{bits:n}=e,o=128,s=new Uint8Array([0,0,0,0]),c=new Set;return n.forEach((u,p)=>{if(p+1>this.publicKeys.length)throw new Error(`Signature index ${p+1} is out of public keys range, ${this.publicKeys.length}.`);if(c.has(u))throw new Error(`Duplicate bit ${u} detected.`);c.add(u);let h=Math.floor(u/8),y=s[h];y|=o>>u%8,s[h]=y}),s}toString(){return me.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 n=e.deserializeVector(Ye),o=e.deserializeU8();return new r({publicKeys:n,signaturesRequired:o})}};var fr=class fr extends Z{constructor(e){super();let{data:n}=e,o=me.fromHexInput(n);if(o.toUint8Array().length!==fr.LENGTH)throw new Error(`Authentication Key length should be ${fr.LENGTH}`);this.data=o}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let n=e.deserializeFixedBytes(fr.LENGTH);return new fr({data:n})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromPublicKeyAndScheme(e){let{publicKey:n,scheme:o}=e,s;switch(o){case 3:case 2:{let p=n.bcsToBytes();s=new Uint8Array([...p,o]);break}case 0:case 1:{let p=n.toUint8Array(),h=me.fromHexInput(p).toUint8Array();s=new Uint8Array([...h,o]);break}default:throw new Error(`Scheme ${o} is not supported`)}let c=$r.create();c.update(s);let u=c.digest();return new fr({data:u})}static fromPublicKey(e){let{publicKey:n}=e,o;if(n instanceof Pe)o=0 .valueOf();else if(n instanceof Dt)o=1 .valueOf();else if(n instanceof Ye)o=2 .valueOf();else if(n instanceof nn)o=3 .valueOf();else throw new Error("No supported authentication scheme for public key");return fr.fromPublicKeyAndScheme({publicKey:n,scheme:o})}derivedAddress(){return new k(this.data.toUint8Array())}};fr.LENGTH=32;var Gt=fr;var dr=class r{constructor(t){let{privateKey:e,address:n,legacy:o}=t,s=o??!0;if(this.publicKey=e.publicKey(),this.publicKey instanceof Pe)s?this.signingScheme=0:(this.publicKey=new Ye(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof Dt)this.signingScheme=1;else if(this.publicKey instanceof qt)this.publicKey=new Ye(this.publicKey),this.signingScheme=2;else throw new Error("Can not create new Account, unsupported public key type");this.privateKey=e,this.accountAddress=n}static generate(t){let e=t?.legacy??!0,n,o;switch(t?.scheme){case 2:n=cr.generate(),o=new Ye(n.publicKey());break;default:n=or.generate(),e===!1?o=new Ye(n.publicKey()):o=n.publicKey()}let c=Gt.fromPublicKey({publicKey:o}).derivedAddress();return new r({privateKey:n,address:c,legacy:t?.legacy})}static fromPrivateKey(t){let{privateKey:e,legacy:n}=t,o=n??!0,s;if(e instanceof cr)s=new Ye(e.publicKey());else if(e instanceof or)o?s=e.publicKey():s=new Ye(e.publicKey());else throw new Error(`Unsupported private key ${e}`);let u=Gt.fromPublicKey({publicKey:s}).derivedAddress();return new r({privateKey:e,address:u,legacy:o})}static fromPrivateKeyAndAddress(t){let{privateKey:e,address:n,legacy:o}=t;return new r({privateKey:e,address:n,legacy:o})}static fromDerivationPath(t){let{path:e,mnemonic:n,scheme:o,legacy:s}=t,c;switch(o){case 2:c=cr.fromDerivationPath(e,n);break;case 0:c=or.fromDerivationPath(e,n);break;default:throw new Error(`Unsupported scheme ${o}`)}return r.fromPrivateKey({privateKey:c,legacy:s})}static authKey(t){let{publicKey:e}=t;return Gt.fromPublicKey({publicKey:e})}sign(t){return this.privateKey.sign(t)}verifySignature(t){let{message:e,signature:n}=t,o=me.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:o,signature:n})}};var _p=`
|
|
1
|
+
"use strict";var aptosSDK=(()=>{var ul=Object.create;var oo=Object.defineProperty;var fc=Object.getOwnPropertyDescriptor;var fl=Object.getOwnPropertyNames;var dl=Object.getPrototypeOf,ll=Object.prototype.hasOwnProperty;var dc=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var Te=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),lc=(r,t)=>{for(var e in t)oo(r,e,{get:t[e],enumerable:!0})},pc=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of fl(t))!ll.call(r,o)&&o!==e&&oo(r,o,{get:()=>t[o],enumerable:!(n=fc(t,o))||n.enumerable});return r};var gc=(r,t,e)=>(e=r!=null?ul(dl(r)):{},pc(t||!r||!r.__esModule?oo(e,"default",{value:r,enumerable:!0}):e,r)),pl=r=>pc(oo({},"__esModule",{value:!0}),r),yt=(r,t,e,n)=>{for(var o=n>1?void 0:n?fc(t,e):t,s=r.length-1,c;s>=0;s--)(c=r[s])&&(o=(n?c(t,e,o):c(o))||o);return n&&o&&oo(t,e,o),o};var Mc=Te(()=>{"use strict"});var Dc=Te((vh,ci)=>{"use strict";(function(r){"use strict";var t=function(a){var d,f=new Float64Array(16);if(a)for(d=0;d<a.length;d++)f[d]=a[d];return f},e=function(){throw new Error("no PRNG")},n=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var s=t(),c=t([1]),u=t([56129,1]),p=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=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]),x=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),C=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function T(a,d,f,i){a[d]=f>>24&255,a[d+1]=f>>16&255,a[d+2]=f>>8&255,a[d+3]=f&255,a[d+4]=i>>24&255,a[d+5]=i>>16&255,a[d+6]=i>>8&255,a[d+7]=i&255}function z(a,d,f,i,l){var m,A=0;for(m=0;m<l;m++)A|=a[d+m]^f[i+m];return(1&A-1>>>8)-1}function _(a,d,f,i){return z(a,d,f,i,16)}function I(a,d,f,i){return z(a,d,f,i,32)}function P(a,d,f,i){for(var l=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,m=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,A=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,S=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,R=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,Q=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,D=d[0]&255|(d[1]&255)<<8|(d[2]&255)<<16|(d[3]&255)<<24,_e=d[4]&255|(d[5]&255)<<8|(d[6]&255)<<16|(d[7]&255)<<24,q=d[8]&255|(d[9]&255)<<8|(d[10]&255)<<16|(d[11]&255)<<24,te=d[12]&255|(d[13]&255)<<8|(d[14]&255)<<16|(d[15]&255)<<24,re=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,ue=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,ce=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,ne=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,ie=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,oe=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,F=l,W=m,G=A,H=S,V=R,M=Q,b=D,w=_e,U=q,v=te,E=re,B=ue,Y=ce,fe=ne,le=ie,de=oe,g,ye=0;ye<20;ye+=2)g=F+Y|0,V^=g<<7|g>>>32-7,g=V+F|0,U^=g<<9|g>>>32-9,g=U+V|0,Y^=g<<13|g>>>32-13,g=Y+U|0,F^=g<<18|g>>>32-18,g=M+W|0,v^=g<<7|g>>>32-7,g=v+M|0,fe^=g<<9|g>>>32-9,g=fe+v|0,W^=g<<13|g>>>32-13,g=W+fe|0,M^=g<<18|g>>>32-18,g=E+b|0,le^=g<<7|g>>>32-7,g=le+E|0,G^=g<<9|g>>>32-9,g=G+le|0,b^=g<<13|g>>>32-13,g=b+G|0,E^=g<<18|g>>>32-18,g=de+B|0,H^=g<<7|g>>>32-7,g=H+de|0,w^=g<<9|g>>>32-9,g=w+H|0,B^=g<<13|g>>>32-13,g=B+w|0,de^=g<<18|g>>>32-18,g=F+H|0,W^=g<<7|g>>>32-7,g=W+F|0,G^=g<<9|g>>>32-9,g=G+W|0,H^=g<<13|g>>>32-13,g=H+G|0,F^=g<<18|g>>>32-18,g=M+V|0,b^=g<<7|g>>>32-7,g=b+M|0,w^=g<<9|g>>>32-9,g=w+b|0,V^=g<<13|g>>>32-13,g=V+w|0,M^=g<<18|g>>>32-18,g=E+v|0,B^=g<<7|g>>>32-7,g=B+E|0,U^=g<<9|g>>>32-9,g=U+B|0,v^=g<<13|g>>>32-13,g=v+U|0,E^=g<<18|g>>>32-18,g=de+le|0,Y^=g<<7|g>>>32-7,g=Y+de|0,fe^=g<<9|g>>>32-9,g=fe+Y|0,le^=g<<13|g>>>32-13,g=le+fe|0,de^=g<<18|g>>>32-18;F=F+l|0,W=W+m|0,G=G+A|0,H=H+S|0,V=V+R|0,M=M+Q|0,b=b+D|0,w=w+_e|0,U=U+q|0,v=v+te|0,E=E+re|0,B=B+ue|0,Y=Y+ce|0,fe=fe+ne|0,le=le+ie|0,de=de+oe|0,a[0]=F>>>0&255,a[1]=F>>>8&255,a[2]=F>>>16&255,a[3]=F>>>24&255,a[4]=W>>>0&255,a[5]=W>>>8&255,a[6]=W>>>16&255,a[7]=W>>>24&255,a[8]=G>>>0&255,a[9]=G>>>8&255,a[10]=G>>>16&255,a[11]=G>>>24&255,a[12]=H>>>0&255,a[13]=H>>>8&255,a[14]=H>>>16&255,a[15]=H>>>24&255,a[16]=V>>>0&255,a[17]=V>>>8&255,a[18]=V>>>16&255,a[19]=V>>>24&255,a[20]=M>>>0&255,a[21]=M>>>8&255,a[22]=M>>>16&255,a[23]=M>>>24&255,a[24]=b>>>0&255,a[25]=b>>>8&255,a[26]=b>>>16&255,a[27]=b>>>24&255,a[28]=w>>>0&255,a[29]=w>>>8&255,a[30]=w>>>16&255,a[31]=w>>>24&255,a[32]=U>>>0&255,a[33]=U>>>8&255,a[34]=U>>>16&255,a[35]=U>>>24&255,a[36]=v>>>0&255,a[37]=v>>>8&255,a[38]=v>>>16&255,a[39]=v>>>24&255,a[40]=E>>>0&255,a[41]=E>>>8&255,a[42]=E>>>16&255,a[43]=E>>>24&255,a[44]=B>>>0&255,a[45]=B>>>8&255,a[46]=B>>>16&255,a[47]=B>>>24&255,a[48]=Y>>>0&255,a[49]=Y>>>8&255,a[50]=Y>>>16&255,a[51]=Y>>>24&255,a[52]=fe>>>0&255,a[53]=fe>>>8&255,a[54]=fe>>>16&255,a[55]=fe>>>24&255,a[56]=le>>>0&255,a[57]=le>>>8&255,a[58]=le>>>16&255,a[59]=le>>>24&255,a[60]=de>>>0&255,a[61]=de>>>8&255,a[62]=de>>>16&255,a[63]=de>>>24&255}function $(a,d,f,i){for(var l=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,m=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,A=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,S=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,R=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,Q=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,D=d[0]&255|(d[1]&255)<<8|(d[2]&255)<<16|(d[3]&255)<<24,_e=d[4]&255|(d[5]&255)<<8|(d[6]&255)<<16|(d[7]&255)<<24,q=d[8]&255|(d[9]&255)<<8|(d[10]&255)<<16|(d[11]&255)<<24,te=d[12]&255|(d[13]&255)<<8|(d[14]&255)<<16|(d[15]&255)<<24,re=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,ue=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,ce=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,ne=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,ie=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,oe=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,F=l,W=m,G=A,H=S,V=R,M=Q,b=D,w=_e,U=q,v=te,E=re,B=ue,Y=ce,fe=ne,le=ie,de=oe,g,ye=0;ye<20;ye+=2)g=F+Y|0,V^=g<<7|g>>>32-7,g=V+F|0,U^=g<<9|g>>>32-9,g=U+V|0,Y^=g<<13|g>>>32-13,g=Y+U|0,F^=g<<18|g>>>32-18,g=M+W|0,v^=g<<7|g>>>32-7,g=v+M|0,fe^=g<<9|g>>>32-9,g=fe+v|0,W^=g<<13|g>>>32-13,g=W+fe|0,M^=g<<18|g>>>32-18,g=E+b|0,le^=g<<7|g>>>32-7,g=le+E|0,G^=g<<9|g>>>32-9,g=G+le|0,b^=g<<13|g>>>32-13,g=b+G|0,E^=g<<18|g>>>32-18,g=de+B|0,H^=g<<7|g>>>32-7,g=H+de|0,w^=g<<9|g>>>32-9,g=w+H|0,B^=g<<13|g>>>32-13,g=B+w|0,de^=g<<18|g>>>32-18,g=F+H|0,W^=g<<7|g>>>32-7,g=W+F|0,G^=g<<9|g>>>32-9,g=G+W|0,H^=g<<13|g>>>32-13,g=H+G|0,F^=g<<18|g>>>32-18,g=M+V|0,b^=g<<7|g>>>32-7,g=b+M|0,w^=g<<9|g>>>32-9,g=w+b|0,V^=g<<13|g>>>32-13,g=V+w|0,M^=g<<18|g>>>32-18,g=E+v|0,B^=g<<7|g>>>32-7,g=B+E|0,U^=g<<9|g>>>32-9,g=U+B|0,v^=g<<13|g>>>32-13,g=v+U|0,E^=g<<18|g>>>32-18,g=de+le|0,Y^=g<<7|g>>>32-7,g=Y+de|0,fe^=g<<9|g>>>32-9,g=fe+Y|0,le^=g<<13|g>>>32-13,g=le+fe|0,de^=g<<18|g>>>32-18;a[0]=F>>>0&255,a[1]=F>>>8&255,a[2]=F>>>16&255,a[3]=F>>>24&255,a[4]=M>>>0&255,a[5]=M>>>8&255,a[6]=M>>>16&255,a[7]=M>>>24&255,a[8]=E>>>0&255,a[9]=E>>>8&255,a[10]=E>>>16&255,a[11]=E>>>24&255,a[12]=de>>>0&255,a[13]=de>>>8&255,a[14]=de>>>16&255,a[15]=de>>>24&255,a[16]=b>>>0&255,a[17]=b>>>8&255,a[18]=b>>>16&255,a[19]=b>>>24&255,a[20]=w>>>0&255,a[21]=w>>>8&255,a[22]=w>>>16&255,a[23]=w>>>24&255,a[24]=U>>>0&255,a[25]=U>>>8&255,a[26]=U>>>16&255,a[27]=U>>>24&255,a[28]=v>>>0&255,a[29]=v>>>8&255,a[30]=v>>>16&255,a[31]=v>>>24&255}function N(a,d,f,i){P(a,d,f,i)}function ee(a,d,f,i){$(a,d,f,i)}var L=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function j(a,d,f,i,l,m,A){var S=new Uint8Array(16),R=new Uint8Array(64),Q,D;for(D=0;D<16;D++)S[D]=0;for(D=0;D<8;D++)S[D]=m[D];for(;l>=64;){for(N(R,S,A,L),D=0;D<64;D++)a[d+D]=f[i+D]^R[D];for(Q=1,D=8;D<16;D++)Q=Q+(S[D]&255)|0,S[D]=Q&255,Q>>>=8;l-=64,d+=64,i+=64}if(l>0)for(N(R,S,A,L),D=0;D<l;D++)a[d+D]=f[i+D]^R[D];return 0}function J(a,d,f,i,l){var m=new Uint8Array(16),A=new Uint8Array(64),S,R;for(R=0;R<16;R++)m[R]=0;for(R=0;R<8;R++)m[R]=i[R];for(;f>=64;){for(N(A,m,l,L),R=0;R<64;R++)a[d+R]=A[R];for(S=1,R=8;R<16;R++)S=S+(m[R]&255)|0,m[R]=S&255,S>>>=8;f-=64,d+=64}if(f>0)for(N(A,m,l,L),R=0;R<f;R++)a[d+R]=A[R];return 0}function X(a,d,f,i,l){var m=new Uint8Array(32);ee(m,i,l,L);for(var A=new Uint8Array(8),S=0;S<8;S++)A[S]=i[S+16];return J(a,d,f,A,m)}function Re(a,d,f,i,l,m,A){var S=new Uint8Array(32);ee(S,m,A,L);for(var R=new Uint8Array(8),Q=0;Q<8;Q++)R[Q]=m[Q+16];return j(a,d,f,i,l,R,S)}var Ae=function(a){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 d,f,i,l,m,A,S,R;d=a[0]&255|(a[1]&255)<<8,this.r[0]=d&8191,f=a[2]&255|(a[3]&255)<<8,this.r[1]=(d>>>13|f<<3)&8191,i=a[4]&255|(a[5]&255)<<8,this.r[2]=(f>>>10|i<<6)&7939,l=a[6]&255|(a[7]&255)<<8,this.r[3]=(i>>>7|l<<9)&8191,m=a[8]&255|(a[9]&255)<<8,this.r[4]=(l>>>4|m<<12)&255,this.r[5]=m>>>1&8190,A=a[10]&255|(a[11]&255)<<8,this.r[6]=(m>>>14|A<<2)&8191,S=a[12]&255|(a[13]&255)<<8,this.r[7]=(A>>>11|S<<5)&8065,R=a[14]&255|(a[15]&255)<<8,this.r[8]=(S>>>8|R<<8)&8191,this.r[9]=R>>>5&127,this.pad[0]=a[16]&255|(a[17]&255)<<8,this.pad[1]=a[18]&255|(a[19]&255)<<8,this.pad[2]=a[20]&255|(a[21]&255)<<8,this.pad[3]=a[22]&255|(a[23]&255)<<8,this.pad[4]=a[24]&255|(a[25]&255)<<8,this.pad[5]=a[26]&255|(a[27]&255)<<8,this.pad[6]=a[28]&255|(a[29]&255)<<8,this.pad[7]=a[30]&255|(a[31]&255)<<8};Ae.prototype.blocks=function(a,d,f){for(var i=this.fin?0:2048,l,m,A,S,R,Q,D,_e,q,te,re,ue,ce,ne,ie,oe,F,W,G,H=this.h[0],V=this.h[1],M=this.h[2],b=this.h[3],w=this.h[4],U=this.h[5],v=this.h[6],E=this.h[7],B=this.h[8],Y=this.h[9],fe=this.r[0],le=this.r[1],de=this.r[2],g=this.r[3],ye=this.r[4],ve=this.r[5],Se=this.r[6],ge=this.r[7],be=this.r[8],we=this.r[9];f>=16;)l=a[d+0]&255|(a[d+1]&255)<<8,H+=l&8191,m=a[d+2]&255|(a[d+3]&255)<<8,V+=(l>>>13|m<<3)&8191,A=a[d+4]&255|(a[d+5]&255)<<8,M+=(m>>>10|A<<6)&8191,S=a[d+6]&255|(a[d+7]&255)<<8,b+=(A>>>7|S<<9)&8191,R=a[d+8]&255|(a[d+9]&255)<<8,w+=(S>>>4|R<<12)&8191,U+=R>>>1&8191,Q=a[d+10]&255|(a[d+11]&255)<<8,v+=(R>>>14|Q<<2)&8191,D=a[d+12]&255|(a[d+13]&255)<<8,E+=(Q>>>11|D<<5)&8191,_e=a[d+14]&255|(a[d+15]&255)<<8,B+=(D>>>8|_e<<8)&8191,Y+=_e>>>5|i,q=0,te=q,te+=H*fe,te+=V*(5*we),te+=M*(5*be),te+=b*(5*ge),te+=w*(5*Se),q=te>>>13,te&=8191,te+=U*(5*ve),te+=v*(5*ye),te+=E*(5*g),te+=B*(5*de),te+=Y*(5*le),q+=te>>>13,te&=8191,re=q,re+=H*le,re+=V*fe,re+=M*(5*we),re+=b*(5*be),re+=w*(5*ge),q=re>>>13,re&=8191,re+=U*(5*Se),re+=v*(5*ve),re+=E*(5*ye),re+=B*(5*g),re+=Y*(5*de),q+=re>>>13,re&=8191,ue=q,ue+=H*de,ue+=V*le,ue+=M*fe,ue+=b*(5*we),ue+=w*(5*be),q=ue>>>13,ue&=8191,ue+=U*(5*ge),ue+=v*(5*Se),ue+=E*(5*ve),ue+=B*(5*ye),ue+=Y*(5*g),q+=ue>>>13,ue&=8191,ce=q,ce+=H*g,ce+=V*de,ce+=M*le,ce+=b*fe,ce+=w*(5*we),q=ce>>>13,ce&=8191,ce+=U*(5*be),ce+=v*(5*ge),ce+=E*(5*Se),ce+=B*(5*ve),ce+=Y*(5*ye),q+=ce>>>13,ce&=8191,ne=q,ne+=H*ye,ne+=V*g,ne+=M*de,ne+=b*le,ne+=w*fe,q=ne>>>13,ne&=8191,ne+=U*(5*we),ne+=v*(5*be),ne+=E*(5*ge),ne+=B*(5*Se),ne+=Y*(5*ve),q+=ne>>>13,ne&=8191,ie=q,ie+=H*ve,ie+=V*ye,ie+=M*g,ie+=b*de,ie+=w*le,q=ie>>>13,ie&=8191,ie+=U*fe,ie+=v*(5*we),ie+=E*(5*be),ie+=B*(5*ge),ie+=Y*(5*Se),q+=ie>>>13,ie&=8191,oe=q,oe+=H*Se,oe+=V*ve,oe+=M*ye,oe+=b*g,oe+=w*de,q=oe>>>13,oe&=8191,oe+=U*le,oe+=v*fe,oe+=E*(5*we),oe+=B*(5*be),oe+=Y*(5*ge),q+=oe>>>13,oe&=8191,F=q,F+=H*ge,F+=V*Se,F+=M*ve,F+=b*ye,F+=w*g,q=F>>>13,F&=8191,F+=U*de,F+=v*le,F+=E*fe,F+=B*(5*we),F+=Y*(5*be),q+=F>>>13,F&=8191,W=q,W+=H*be,W+=V*ge,W+=M*Se,W+=b*ve,W+=w*ye,q=W>>>13,W&=8191,W+=U*g,W+=v*de,W+=E*le,W+=B*fe,W+=Y*(5*we),q+=W>>>13,W&=8191,G=q,G+=H*we,G+=V*be,G+=M*ge,G+=b*Se,G+=w*ve,q=G>>>13,G&=8191,G+=U*ye,G+=v*g,G+=E*de,G+=B*le,G+=Y*fe,q+=G>>>13,G&=8191,q=(q<<2)+q|0,q=q+te|0,te=q&8191,q=q>>>13,re+=q,H=te,V=re,M=ue,b=ce,w=ne,U=ie,v=oe,E=F,B=W,Y=G,d+=16,f-=16;this.h[0]=H,this.h[1]=V,this.h[2]=M,this.h[3]=b,this.h[4]=w,this.h[5]=U,this.h[6]=v,this.h[7]=E,this.h[8]=B,this.h[9]=Y},Ae.prototype.finish=function(a,d){var f=new Uint16Array(10),i,l,m,A;if(this.leftover){for(A=this.leftover,this.buffer[A++]=1;A<16;A++)this.buffer[A]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(i=this.h[1]>>>13,this.h[1]&=8191,A=2;A<10;A++)this.h[A]+=i,i=this.h[A]>>>13,this.h[A]&=8191;for(this.h[0]+=i*5,i=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=i,i=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=i,f[0]=this.h[0]+5,i=f[0]>>>13,f[0]&=8191,A=1;A<10;A++)f[A]=this.h[A]+i,i=f[A]>>>13,f[A]&=8191;for(f[9]-=8192,l=(i^1)-1,A=0;A<10;A++)f[A]&=l;for(l=~l,A=0;A<10;A++)this.h[A]=this.h[A]&l|f[A];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,m=this.h[0]+this.pad[0],this.h[0]=m&65535,A=1;A<8;A++)m=(this.h[A]+this.pad[A]|0)+(m>>>16)|0,this.h[A]=m&65535;a[d+0]=this.h[0]>>>0&255,a[d+1]=this.h[0]>>>8&255,a[d+2]=this.h[1]>>>0&255,a[d+3]=this.h[1]>>>8&255,a[d+4]=this.h[2]>>>0&255,a[d+5]=this.h[2]>>>8&255,a[d+6]=this.h[3]>>>0&255,a[d+7]=this.h[3]>>>8&255,a[d+8]=this.h[4]>>>0&255,a[d+9]=this.h[4]>>>8&255,a[d+10]=this.h[5]>>>0&255,a[d+11]=this.h[5]>>>8&255,a[d+12]=this.h[6]>>>0&255,a[d+13]=this.h[6]>>>8&255,a[d+14]=this.h[7]>>>0&255,a[d+15]=this.h[7]>>>8&255},Ae.prototype.update=function(a,d,f){var i,l;if(this.leftover){for(l=16-this.leftover,l>f&&(l=f),i=0;i<l;i++)this.buffer[this.leftover+i]=a[d+i];if(f-=l,d+=l,this.leftover+=l,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(f>=16&&(l=f-f%16,this.blocks(a,d,l),d+=l,f-=l),f){for(i=0;i<f;i++)this.buffer[this.leftover+i]=a[d+i];this.leftover+=f}};function he(a,d,f,i,l,m){var A=new Ae(m);return A.update(f,i,l),A.finish(a,d),0}function He(a,d,f,i,l,m){var A=new Uint8Array(16);return he(A,0,f,i,l,m),_(a,d,A,0)}function $e(a,d,f,i,l){var m;if(f<32)return-1;for(Re(a,0,d,0,f,i,l),he(a,16,a,32,f-32,a),m=0;m<16;m++)a[m]=0;return 0}function gt(a,d,f,i,l){var m,A=new Uint8Array(32);if(f<32||(X(A,0,32,i,l),He(d,16,d,32,f-32,A)!==0))return-1;for(Re(a,0,d,0,f,i,l),m=0;m<32;m++)a[m]=0;return 0}function k(a,d){var f;for(f=0;f<16;f++)a[f]=d[f]|0}function K(a){var d,f,i=1;for(d=0;d<16;d++)f=a[d]+i+65535,i=Math.floor(f/65536),a[d]=f-i*65536;a[0]+=i-1+37*(i-1)}function se(a,d,f){for(var i,l=~(f-1),m=0;m<16;m++)i=l&(a[m]^d[m]),a[m]^=i,d[m]^=i}function Ee(a,d){var f,i,l,m=t(),A=t();for(f=0;f<16;f++)A[f]=d[f];for(K(A),K(A),K(A),i=0;i<2;i++){for(m[0]=A[0]-65517,f=1;f<15;f++)m[f]=A[f]-65535-(m[f-1]>>16&1),m[f-1]&=65535;m[15]=A[15]-32767-(m[14]>>16&1),l=m[15]>>16&1,m[14]&=65535,se(A,m,1-l)}for(f=0;f<16;f++)a[2*f]=A[f]&255,a[2*f+1]=A[f]>>8}function Ce(a,d){var f=new Uint8Array(32),i=new Uint8Array(32);return Ee(f,a),Ee(i,d),I(f,0,i,0)}function Ve(a){var d=new Uint8Array(32);return Ee(d,a),d[0]&1}function it(a,d){var f;for(f=0;f<16;f++)a[f]=d[2*f]+(d[2*f+1]<<8);a[15]&=32767}function Oe(a,d,f){for(var i=0;i<16;i++)a[i]=d[i]+f[i]}function We(a,d,f){for(var i=0;i<16;i++)a[i]=d[i]-f[i]}function ae(a,d,f){var i,l,m=0,A=0,S=0,R=0,Q=0,D=0,_e=0,q=0,te=0,re=0,ue=0,ce=0,ne=0,ie=0,oe=0,F=0,W=0,G=0,H=0,V=0,M=0,b=0,w=0,U=0,v=0,E=0,B=0,Y=0,fe=0,le=0,de=0,g=f[0],ye=f[1],ve=f[2],Se=f[3],ge=f[4],be=f[5],we=f[6],Qe=f[7],Ue=f[8],Me=f[9],De=f[10],Ge=f[11],Je=f[12],ct=f[13],ut=f[14],ft=f[15];i=d[0],m+=i*g,A+=i*ye,S+=i*ve,R+=i*Se,Q+=i*ge,D+=i*be,_e+=i*we,q+=i*Qe,te+=i*Ue,re+=i*Me,ue+=i*De,ce+=i*Ge,ne+=i*Je,ie+=i*ct,oe+=i*ut,F+=i*ft,i=d[1],A+=i*g,S+=i*ye,R+=i*ve,Q+=i*Se,D+=i*ge,_e+=i*be,q+=i*we,te+=i*Qe,re+=i*Ue,ue+=i*Me,ce+=i*De,ne+=i*Ge,ie+=i*Je,oe+=i*ct,F+=i*ut,W+=i*ft,i=d[2],S+=i*g,R+=i*ye,Q+=i*ve,D+=i*Se,_e+=i*ge,q+=i*be,te+=i*we,re+=i*Qe,ue+=i*Ue,ce+=i*Me,ne+=i*De,ie+=i*Ge,oe+=i*Je,F+=i*ct,W+=i*ut,G+=i*ft,i=d[3],R+=i*g,Q+=i*ye,D+=i*ve,_e+=i*Se,q+=i*ge,te+=i*be,re+=i*we,ue+=i*Qe,ce+=i*Ue,ne+=i*Me,ie+=i*De,oe+=i*Ge,F+=i*Je,W+=i*ct,G+=i*ut,H+=i*ft,i=d[4],Q+=i*g,D+=i*ye,_e+=i*ve,q+=i*Se,te+=i*ge,re+=i*be,ue+=i*we,ce+=i*Qe,ne+=i*Ue,ie+=i*Me,oe+=i*De,F+=i*Ge,W+=i*Je,G+=i*ct,H+=i*ut,V+=i*ft,i=d[5],D+=i*g,_e+=i*ye,q+=i*ve,te+=i*Se,re+=i*ge,ue+=i*be,ce+=i*we,ne+=i*Qe,ie+=i*Ue,oe+=i*Me,F+=i*De,W+=i*Ge,G+=i*Je,H+=i*ct,V+=i*ut,M+=i*ft,i=d[6],_e+=i*g,q+=i*ye,te+=i*ve,re+=i*Se,ue+=i*ge,ce+=i*be,ne+=i*we,ie+=i*Qe,oe+=i*Ue,F+=i*Me,W+=i*De,G+=i*Ge,H+=i*Je,V+=i*ct,M+=i*ut,b+=i*ft,i=d[7],q+=i*g,te+=i*ye,re+=i*ve,ue+=i*Se,ce+=i*ge,ne+=i*be,ie+=i*we,oe+=i*Qe,F+=i*Ue,W+=i*Me,G+=i*De,H+=i*Ge,V+=i*Je,M+=i*ct,b+=i*ut,w+=i*ft,i=d[8],te+=i*g,re+=i*ye,ue+=i*ve,ce+=i*Se,ne+=i*ge,ie+=i*be,oe+=i*we,F+=i*Qe,W+=i*Ue,G+=i*Me,H+=i*De,V+=i*Ge,M+=i*Je,b+=i*ct,w+=i*ut,U+=i*ft,i=d[9],re+=i*g,ue+=i*ye,ce+=i*ve,ne+=i*Se,ie+=i*ge,oe+=i*be,F+=i*we,W+=i*Qe,G+=i*Ue,H+=i*Me,V+=i*De,M+=i*Ge,b+=i*Je,w+=i*ct,U+=i*ut,v+=i*ft,i=d[10],ue+=i*g,ce+=i*ye,ne+=i*ve,ie+=i*Se,oe+=i*ge,F+=i*be,W+=i*we,G+=i*Qe,H+=i*Ue,V+=i*Me,M+=i*De,b+=i*Ge,w+=i*Je,U+=i*ct,v+=i*ut,E+=i*ft,i=d[11],ce+=i*g,ne+=i*ye,ie+=i*ve,oe+=i*Se,F+=i*ge,W+=i*be,G+=i*we,H+=i*Qe,V+=i*Ue,M+=i*Me,b+=i*De,w+=i*Ge,U+=i*Je,v+=i*ct,E+=i*ut,B+=i*ft,i=d[12],ne+=i*g,ie+=i*ye,oe+=i*ve,F+=i*Se,W+=i*ge,G+=i*be,H+=i*we,V+=i*Qe,M+=i*Ue,b+=i*Me,w+=i*De,U+=i*Ge,v+=i*Je,E+=i*ct,B+=i*ut,Y+=i*ft,i=d[13],ie+=i*g,oe+=i*ye,F+=i*ve,W+=i*Se,G+=i*ge,H+=i*be,V+=i*we,M+=i*Qe,b+=i*Ue,w+=i*Me,U+=i*De,v+=i*Ge,E+=i*Je,B+=i*ct,Y+=i*ut,fe+=i*ft,i=d[14],oe+=i*g,F+=i*ye,W+=i*ve,G+=i*Se,H+=i*ge,V+=i*be,M+=i*we,b+=i*Qe,w+=i*Ue,U+=i*Me,v+=i*De,E+=i*Ge,B+=i*Je,Y+=i*ct,fe+=i*ut,le+=i*ft,i=d[15],F+=i*g,W+=i*ye,G+=i*ve,H+=i*Se,V+=i*ge,M+=i*be,b+=i*we,w+=i*Qe,U+=i*Ue,v+=i*Me,E+=i*De,B+=i*Ge,Y+=i*Je,fe+=i*ct,le+=i*ut,de+=i*ft,m+=38*W,A+=38*G,S+=38*H,R+=38*V,Q+=38*M,D+=38*b,_e+=38*w,q+=38*U,te+=38*v,re+=38*E,ue+=38*B,ce+=38*Y,ne+=38*fe,ie+=38*le,oe+=38*de,l=1,i=m+l+65535,l=Math.floor(i/65536),m=i-l*65536,i=A+l+65535,l=Math.floor(i/65536),A=i-l*65536,i=S+l+65535,l=Math.floor(i/65536),S=i-l*65536,i=R+l+65535,l=Math.floor(i/65536),R=i-l*65536,i=Q+l+65535,l=Math.floor(i/65536),Q=i-l*65536,i=D+l+65535,l=Math.floor(i/65536),D=i-l*65536,i=_e+l+65535,l=Math.floor(i/65536),_e=i-l*65536,i=q+l+65535,l=Math.floor(i/65536),q=i-l*65536,i=te+l+65535,l=Math.floor(i/65536),te=i-l*65536,i=re+l+65535,l=Math.floor(i/65536),re=i-l*65536,i=ue+l+65535,l=Math.floor(i/65536),ue=i-l*65536,i=ce+l+65535,l=Math.floor(i/65536),ce=i-l*65536,i=ne+l+65535,l=Math.floor(i/65536),ne=i-l*65536,i=ie+l+65535,l=Math.floor(i/65536),ie=i-l*65536,i=oe+l+65535,l=Math.floor(i/65536),oe=i-l*65536,i=F+l+65535,l=Math.floor(i/65536),F=i-l*65536,m+=l-1+37*(l-1),l=1,i=m+l+65535,l=Math.floor(i/65536),m=i-l*65536,i=A+l+65535,l=Math.floor(i/65536),A=i-l*65536,i=S+l+65535,l=Math.floor(i/65536),S=i-l*65536,i=R+l+65535,l=Math.floor(i/65536),R=i-l*65536,i=Q+l+65535,l=Math.floor(i/65536),Q=i-l*65536,i=D+l+65535,l=Math.floor(i/65536),D=i-l*65536,i=_e+l+65535,l=Math.floor(i/65536),_e=i-l*65536,i=q+l+65535,l=Math.floor(i/65536),q=i-l*65536,i=te+l+65535,l=Math.floor(i/65536),te=i-l*65536,i=re+l+65535,l=Math.floor(i/65536),re=i-l*65536,i=ue+l+65535,l=Math.floor(i/65536),ue=i-l*65536,i=ce+l+65535,l=Math.floor(i/65536),ce=i-l*65536,i=ne+l+65535,l=Math.floor(i/65536),ne=i-l*65536,i=ie+l+65535,l=Math.floor(i/65536),ie=i-l*65536,i=oe+l+65535,l=Math.floor(i/65536),oe=i-l*65536,i=F+l+65535,l=Math.floor(i/65536),F=i-l*65536,m+=l-1+37*(l-1),a[0]=m,a[1]=A,a[2]=S,a[3]=R,a[4]=Q,a[5]=D,a[6]=_e,a[7]=q,a[8]=te,a[9]=re,a[10]=ue,a[11]=ce,a[12]=ne,a[13]=ie,a[14]=oe,a[15]=F}function Ze(a,d){ae(a,d,d)}function Ar(a,d){var f=t(),i;for(i=0;i<16;i++)f[i]=d[i];for(i=253;i>=0;i--)Ze(f,f),i!==2&&i!==4&&ae(f,f,d);for(i=0;i<16;i++)a[i]=f[i]}function kt(a,d){var f=t(),i;for(i=0;i<16;i++)f[i]=d[i];for(i=250;i>=0;i--)Ze(f,f),i!==1&&ae(f,f,d);for(i=0;i<16;i++)a[i]=f[i]}function br(a,d,f){var i=new Uint8Array(32),l=new Float64Array(80),m,A,S=t(),R=t(),Q=t(),D=t(),_e=t(),q=t();for(A=0;A<31;A++)i[A]=d[A];for(i[31]=d[31]&127|64,i[0]&=248,it(l,f),A=0;A<16;A++)R[A]=l[A],D[A]=S[A]=Q[A]=0;for(S[0]=D[0]=1,A=254;A>=0;--A)m=i[A>>>3]>>>(A&7)&1,se(S,R,m),se(Q,D,m),Oe(_e,S,Q),We(S,S,Q),Oe(Q,R,D),We(R,R,D),Ze(D,_e),Ze(q,S),ae(S,Q,S),ae(Q,R,_e),Oe(_e,S,Q),We(S,S,Q),Ze(R,S),We(Q,D,q),ae(S,Q,u),Oe(S,S,D),ae(Q,Q,S),ae(S,D,q),ae(D,R,l),Ze(R,_e),se(S,R,m),se(Q,D,m);for(A=0;A<16;A++)l[A+16]=S[A],l[A+32]=Q[A],l[A+48]=R[A],l[A+64]=D[A];var te=l.subarray(32),re=l.subarray(16);return Ar(te,te),ae(re,re,te),Ee(a,re),0}function Et(a,d){return br(a,d,o)}function Zt(a,d){return e(d,32),Et(a,d)}function Gr(a,d,f){var i=new Uint8Array(32);return br(i,f,d),ee(a,n,i,L)}var bt=$e,wr=gt;function In(a,d,f,i,l,m){var A=new Uint8Array(32);return Gr(A,l,m),bt(a,d,f,i,A)}function Fo(a,d,f,i,l,m){var A=new Uint8Array(32);return Gr(A,l,m),wr(a,d,f,i,A)}var Jn=[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 oc(a,d,f,i){for(var l=new Int32Array(16),m=new Int32Array(16),A,S,R,Q,D,_e,q,te,re,ue,ce,ne,ie,oe,F,W,G,H,V,M,b,w,U,v,E,B,Y=a[0],fe=a[1],le=a[2],de=a[3],g=a[4],ye=a[5],ve=a[6],Se=a[7],ge=d[0],be=d[1],we=d[2],Qe=d[3],Ue=d[4],Me=d[5],De=d[6],Ge=d[7],Je=0;i>=128;){for(V=0;V<16;V++)M=8*V+Je,l[V]=f[M+0]<<24|f[M+1]<<16|f[M+2]<<8|f[M+3],m[V]=f[M+4]<<24|f[M+5]<<16|f[M+6]<<8|f[M+7];for(V=0;V<80;V++)if(A=Y,S=fe,R=le,Q=de,D=g,_e=ye,q=ve,te=Se,re=ge,ue=be,ce=we,ne=Qe,ie=Ue,oe=Me,F=De,W=Ge,b=Se,w=Ge,U=w&65535,v=w>>>16,E=b&65535,B=b>>>16,b=(g>>>14|Ue<<32-14)^(g>>>18|Ue<<32-18)^(Ue>>>41-32|g<<32-(41-32)),w=(Ue>>>14|g<<32-14)^(Ue>>>18|g<<32-18)^(g>>>41-32|Ue<<32-(41-32)),U+=w&65535,v+=w>>>16,E+=b&65535,B+=b>>>16,b=g&ye^~g&ve,w=Ue&Me^~Ue&De,U+=w&65535,v+=w>>>16,E+=b&65535,B+=b>>>16,b=Jn[V*2],w=Jn[V*2+1],U+=w&65535,v+=w>>>16,E+=b&65535,B+=b>>>16,b=l[V%16],w=m[V%16],U+=w&65535,v+=w>>>16,E+=b&65535,B+=b>>>16,v+=U>>>16,E+=v>>>16,B+=E>>>16,G=E&65535|B<<16,H=U&65535|v<<16,b=G,w=H,U=w&65535,v=w>>>16,E=b&65535,B=b>>>16,b=(Y>>>28|ge<<32-28)^(ge>>>34-32|Y<<32-(34-32))^(ge>>>39-32|Y<<32-(39-32)),w=(ge>>>28|Y<<32-28)^(Y>>>34-32|ge<<32-(34-32))^(Y>>>39-32|ge<<32-(39-32)),U+=w&65535,v+=w>>>16,E+=b&65535,B+=b>>>16,b=Y&fe^Y&le^fe&le,w=ge&be^ge&we^be&we,U+=w&65535,v+=w>>>16,E+=b&65535,B+=b>>>16,v+=U>>>16,E+=v>>>16,B+=E>>>16,te=E&65535|B<<16,W=U&65535|v<<16,b=Q,w=ne,U=w&65535,v=w>>>16,E=b&65535,B=b>>>16,b=G,w=H,U+=w&65535,v+=w>>>16,E+=b&65535,B+=b>>>16,v+=U>>>16,E+=v>>>16,B+=E>>>16,Q=E&65535|B<<16,ne=U&65535|v<<16,fe=A,le=S,de=R,g=Q,ye=D,ve=_e,Se=q,Y=te,be=re,we=ue,Qe=ce,Ue=ne,Me=ie,De=oe,Ge=F,ge=W,V%16===15)for(M=0;M<16;M++)b=l[M],w=m[M],U=w&65535,v=w>>>16,E=b&65535,B=b>>>16,b=l[(M+9)%16],w=m[(M+9)%16],U+=w&65535,v+=w>>>16,E+=b&65535,B+=b>>>16,G=l[(M+1)%16],H=m[(M+1)%16],b=(G>>>1|H<<32-1)^(G>>>8|H<<32-8)^G>>>7,w=(H>>>1|G<<32-1)^(H>>>8|G<<32-8)^(H>>>7|G<<32-7),U+=w&65535,v+=w>>>16,E+=b&65535,B+=b>>>16,G=l[(M+14)%16],H=m[(M+14)%16],b=(G>>>19|H<<32-19)^(H>>>61-32|G<<32-(61-32))^G>>>6,w=(H>>>19|G<<32-19)^(G>>>61-32|H<<32-(61-32))^(H>>>6|G<<32-6),U+=w&65535,v+=w>>>16,E+=b&65535,B+=b>>>16,v+=U>>>16,E+=v>>>16,B+=E>>>16,l[M]=E&65535|B<<16,m[M]=U&65535|v<<16;b=Y,w=ge,U=w&65535,v=w>>>16,E=b&65535,B=b>>>16,b=a[0],w=d[0],U+=w&65535,v+=w>>>16,E+=b&65535,B+=b>>>16,v+=U>>>16,E+=v>>>16,B+=E>>>16,a[0]=Y=E&65535|B<<16,d[0]=ge=U&65535|v<<16,b=fe,w=be,U=w&65535,v=w>>>16,E=b&65535,B=b>>>16,b=a[1],w=d[1],U+=w&65535,v+=w>>>16,E+=b&65535,B+=b>>>16,v+=U>>>16,E+=v>>>16,B+=E>>>16,a[1]=fe=E&65535|B<<16,d[1]=be=U&65535|v<<16,b=le,w=we,U=w&65535,v=w>>>16,E=b&65535,B=b>>>16,b=a[2],w=d[2],U+=w&65535,v+=w>>>16,E+=b&65535,B+=b>>>16,v+=U>>>16,E+=v>>>16,B+=E>>>16,a[2]=le=E&65535|B<<16,d[2]=we=U&65535|v<<16,b=de,w=Qe,U=w&65535,v=w>>>16,E=b&65535,B=b>>>16,b=a[3],w=d[3],U+=w&65535,v+=w>>>16,E+=b&65535,B+=b>>>16,v+=U>>>16,E+=v>>>16,B+=E>>>16,a[3]=de=E&65535|B<<16,d[3]=Qe=U&65535|v<<16,b=g,w=Ue,U=w&65535,v=w>>>16,E=b&65535,B=b>>>16,b=a[4],w=d[4],U+=w&65535,v+=w>>>16,E+=b&65535,B+=b>>>16,v+=U>>>16,E+=v>>>16,B+=E>>>16,a[4]=g=E&65535|B<<16,d[4]=Ue=U&65535|v<<16,b=ye,w=Me,U=w&65535,v=w>>>16,E=b&65535,B=b>>>16,b=a[5],w=d[5],U+=w&65535,v+=w>>>16,E+=b&65535,B+=b>>>16,v+=U>>>16,E+=v>>>16,B+=E>>>16,a[5]=ye=E&65535|B<<16,d[5]=Me=U&65535|v<<16,b=ve,w=De,U=w&65535,v=w>>>16,E=b&65535,B=b>>>16,b=a[6],w=d[6],U+=w&65535,v+=w>>>16,E+=b&65535,B+=b>>>16,v+=U>>>16,E+=v>>>16,B+=E>>>16,a[6]=ve=E&65535|B<<16,d[6]=De=U&65535|v<<16,b=Se,w=Ge,U=w&65535,v=w>>>16,E=b&65535,B=b>>>16,b=a[7],w=d[7],U+=w&65535,v+=w>>>16,E+=b&65535,B+=b>>>16,v+=U>>>16,E+=v>>>16,B+=E>>>16,a[7]=Se=E&65535|B<<16,d[7]=Ge=U&65535|v<<16,Je+=128,i-=128}return i}function qr(a,d,f){var i=new Int32Array(8),l=new Int32Array(8),m=new Uint8Array(256),A,S=f;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,l[0]=4089235720,l[1]=2227873595,l[2]=4271175723,l[3]=1595750129,l[4]=2917565137,l[5]=725511199,l[6]=4215389547,l[7]=327033209,oc(i,l,d,f),f%=128,A=0;A<f;A++)m[A]=d[S-f+A];for(m[f]=128,f=256-128*(f<112?1:0),m[f-9]=0,T(m,f-8,S/536870912|0,S<<3),oc(i,l,m,f),A=0;A<8;A++)T(a,8*A,i[A],l[A]);return 0}function Ko(a,d){var f=t(),i=t(),l=t(),m=t(),A=t(),S=t(),R=t(),Q=t(),D=t();We(f,a[1],a[0]),We(D,d[1],d[0]),ae(f,f,D),Oe(i,a[0],a[1]),Oe(D,d[0],d[1]),ae(i,i,D),ae(l,a[3],d[3]),ae(l,l,y),ae(m,a[2],d[2]),Oe(m,m,m),We(A,i,f),We(S,m,l),Oe(R,m,l),Oe(Q,i,f),ae(a[0],A,S),ae(a[1],Q,R),ae(a[2],R,S),ae(a[3],A,Q)}function ic(a,d,f){var i;for(i=0;i<4;i++)se(a[i],d[i],f)}function ns(a,d){var f=t(),i=t(),l=t();Ar(l,d[2]),ae(f,d[0],l),ae(i,d[1],l),Ee(a,i),a[31]^=Ve(f)<<7}function os(a,d,f){var i,l;for(k(a[0],s),k(a[1],c),k(a[2],c),k(a[3],s),l=255;l>=0;--l)i=f[l/8|0]>>(l&7)&1,ic(a,d,i),Ko(d,a),Ko(a,a),ic(a,d,i)}function Ho(a,d){var f=[t(),t(),t(),t()];k(f[0],h),k(f[1],x),k(f[2],c),ae(f[3],h,x),os(a,f,d)}function is(a,d,f){var i=new Uint8Array(64),l=[t(),t(),t(),t()],m;for(f||e(d,32),qr(i,d,32),i[0]&=248,i[31]&=127,i[31]|=64,Ho(l,i),ns(a,l),m=0;m<32;m++)d[m+32]=a[m];return 0}var $o=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 ss(a,d){var f,i,l,m;for(i=63;i>=32;--i){for(f=0,l=i-32,m=i-12;l<m;++l)d[l]+=f-16*d[i]*$o[l-(i-32)],f=Math.floor((d[l]+128)/256),d[l]-=f*256;d[l]+=f,d[i]=0}for(f=0,l=0;l<32;l++)d[l]+=f-(d[31]>>4)*$o[l],f=d[l]>>8,d[l]&=255;for(l=0;l<32;l++)d[l]-=f*$o[l];for(i=0;i<32;i++)d[i+1]+=d[i]>>8,a[i]=d[i]&255}function as(a){var d=new Float64Array(64),f;for(f=0;f<64;f++)d[f]=a[f];for(f=0;f<64;f++)a[f]=0;ss(a,d)}function sc(a,d,f,i){var l=new Uint8Array(64),m=new Uint8Array(64),A=new Uint8Array(64),S,R,Q=new Float64Array(64),D=[t(),t(),t(),t()];qr(l,i,32),l[0]&=248,l[31]&=127,l[31]|=64;var _e=f+64;for(S=0;S<f;S++)a[64+S]=d[S];for(S=0;S<32;S++)a[32+S]=l[32+S];for(qr(A,a.subarray(32),f+32),as(A),Ho(D,A),ns(a,D),S=32;S<64;S++)a[S]=i[S];for(qr(m,a,f+64),as(m),S=0;S<64;S++)Q[S]=0;for(S=0;S<32;S++)Q[S]=A[S];for(S=0;S<32;S++)for(R=0;R<32;R++)Q[S+R]+=m[S]*l[R];return ss(a.subarray(32),Q),_e}function il(a,d){var f=t(),i=t(),l=t(),m=t(),A=t(),S=t(),R=t();return k(a[2],c),it(a[1],d),Ze(l,a[1]),ae(m,l,p),We(l,l,a[2]),Oe(m,a[2],m),Ze(A,m),Ze(S,A),ae(R,S,A),ae(f,R,l),ae(f,f,m),kt(f,f),ae(f,f,l),ae(f,f,m),ae(f,f,m),ae(a[0],f,m),Ze(i,a[0]),ae(i,i,m),Ce(i,l)&&ae(a[0],a[0],C),Ze(i,a[0]),ae(i,i,m),Ce(i,l)?-1:(Ve(a[0])===d[31]>>7&&We(a[0],s,a[0]),ae(a[3],a[0],a[1]),0)}function cs(a,d,f,i){var l,m=new Uint8Array(32),A=new Uint8Array(64),S=[t(),t(),t(),t()],R=[t(),t(),t(),t()];if(f<64||il(R,i))return-1;for(l=0;l<f;l++)a[l]=d[l];for(l=0;l<32;l++)a[l+32]=i[l];if(qr(A,a,f),as(A),os(S,R,A),Ho(R,d.subarray(32)),Ko(S,R),ns(m,S),f-=64,I(d,0,m,0)){for(l=0;l<f;l++)a[l]=0;return-1}for(l=0;l<f;l++)a[l]=d[l+64];return f}var us=32,Vo=24,eo=32,Rn=16,to=32,Qo=32,ro=32,no=32,fs=32,ac=Vo,sl=eo,al=Rn,Jt=64,Lr=32,Pn=64,ds=32,ls=64;r.lowlevel={crypto_core_hsalsa20:ee,crypto_stream_xor:Re,crypto_stream:X,crypto_stream_salsa20_xor:j,crypto_stream_salsa20:J,crypto_onetimeauth:he,crypto_onetimeauth_verify:He,crypto_verify_16:_,crypto_verify_32:I,crypto_secretbox:$e,crypto_secretbox_open:gt,crypto_scalarmult:br,crypto_scalarmult_base:Et,crypto_box_beforenm:Gr,crypto_box_afternm:bt,crypto_box:In,crypto_box_open:Fo,crypto_box_keypair:Zt,crypto_hash:qr,crypto_sign:sc,crypto_sign_keypair:is,crypto_sign_open:cs,crypto_secretbox_KEYBYTES:us,crypto_secretbox_NONCEBYTES:Vo,crypto_secretbox_ZEROBYTES:eo,crypto_secretbox_BOXZEROBYTES:Rn,crypto_scalarmult_BYTES:to,crypto_scalarmult_SCALARBYTES:Qo,crypto_box_PUBLICKEYBYTES:ro,crypto_box_SECRETKEYBYTES:no,crypto_box_BEFORENMBYTES:fs,crypto_box_NONCEBYTES:ac,crypto_box_ZEROBYTES:sl,crypto_box_BOXZEROBYTES:al,crypto_sign_BYTES:Jt,crypto_sign_PUBLICKEYBYTES:Lr,crypto_sign_SECRETKEYBYTES:Pn,crypto_sign_SEEDBYTES:ds,crypto_hash_BYTES:ls,gf:t,D:p,L:$o,pack25519:Ee,unpack25519:it,M:ae,A:Oe,S:Ze,Z:We,pow2523:kt,add:Ko,set25519:k,modL:ss,scalarmult:os,scalarbase:Ho};function cc(a,d){if(a.length!==us)throw new Error("bad key size");if(d.length!==Vo)throw new Error("bad nonce size")}function cl(a,d){if(a.length!==ro)throw new Error("bad public key size");if(d.length!==no)throw new Error("bad secret key size")}function wt(){for(var a=0;a<arguments.length;a++)if(!(arguments[a]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function uc(a){for(var d=0;d<a.length;d++)a[d]=0}r.randomBytes=function(a){var d=new Uint8Array(a);return e(d,a),d},r.secretbox=function(a,d,f){wt(a,d,f),cc(f,d);for(var i=new Uint8Array(eo+a.length),l=new Uint8Array(i.length),m=0;m<a.length;m++)i[m+eo]=a[m];return $e(l,i,i.length,d,f),l.subarray(Rn)},r.secretbox.open=function(a,d,f){wt(a,d,f),cc(f,d);for(var i=new Uint8Array(Rn+a.length),l=new Uint8Array(i.length),m=0;m<a.length;m++)i[m+Rn]=a[m];return i.length<32||gt(l,i,i.length,d,f)!==0?null:l.subarray(eo)},r.secretbox.keyLength=us,r.secretbox.nonceLength=Vo,r.secretbox.overheadLength=Rn,r.scalarMult=function(a,d){if(wt(a,d),a.length!==Qo)throw new Error("bad n size");if(d.length!==to)throw new Error("bad p size");var f=new Uint8Array(to);return br(f,a,d),f},r.scalarMult.base=function(a){if(wt(a),a.length!==Qo)throw new Error("bad n size");var d=new Uint8Array(to);return Et(d,a),d},r.scalarMult.scalarLength=Qo,r.scalarMult.groupElementLength=to,r.box=function(a,d,f,i){var l=r.box.before(f,i);return r.secretbox(a,d,l)},r.box.before=function(a,d){wt(a,d),cl(a,d);var f=new Uint8Array(fs);return Gr(f,a,d),f},r.box.after=r.secretbox,r.box.open=function(a,d,f,i){var l=r.box.before(f,i);return r.secretbox.open(a,d,l)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var a=new Uint8Array(ro),d=new Uint8Array(no);return Zt(a,d),{publicKey:a,secretKey:d}},r.box.keyPair.fromSecretKey=function(a){if(wt(a),a.length!==no)throw new Error("bad secret key size");var d=new Uint8Array(ro);return Et(d,a),{publicKey:d,secretKey:new Uint8Array(a)}},r.box.publicKeyLength=ro,r.box.secretKeyLength=no,r.box.sharedKeyLength=fs,r.box.nonceLength=ac,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(a,d){if(wt(a,d),d.length!==Pn)throw new Error("bad secret key size");var f=new Uint8Array(Jt+a.length);return sc(f,a,a.length,d),f},r.sign.open=function(a,d){if(wt(a,d),d.length!==Lr)throw new Error("bad public key size");var f=new Uint8Array(a.length),i=cs(f,a,a.length,d);if(i<0)return null;for(var l=new Uint8Array(i),m=0;m<l.length;m++)l[m]=f[m];return l},r.sign.detached=function(a,d){for(var f=r.sign(a,d),i=new Uint8Array(Jt),l=0;l<i.length;l++)i[l]=f[l];return i},r.sign.detached.verify=function(a,d,f){if(wt(a,d,f),d.length!==Jt)throw new Error("bad signature size");if(f.length!==Lr)throw new Error("bad public key size");var i=new Uint8Array(Jt+a.length),l=new Uint8Array(Jt+a.length),m;for(m=0;m<Jt;m++)i[m]=d[m];for(m=0;m<a.length;m++)i[m+Jt]=a[m];return cs(l,i,i.length,f)>=0},r.sign.keyPair=function(){var a=new Uint8Array(Lr),d=new Uint8Array(Pn);return is(a,d),{publicKey:a,secretKey:d}},r.sign.keyPair.fromSecretKey=function(a){if(wt(a),a.length!==Pn)throw new Error("bad secret key size");for(var d=new Uint8Array(Lr),f=0;f<d.length;f++)d[f]=a[32+f];return{publicKey:d,secretKey:new Uint8Array(a)}},r.sign.keyPair.fromSeed=function(a){if(wt(a),a.length!==ds)throw new Error("bad seed size");for(var d=new Uint8Array(Lr),f=new Uint8Array(Pn),i=0;i<32;i++)f[i]=a[i];return is(d,f,!0),{publicKey:d,secretKey:f}},r.sign.publicKeyLength=Lr,r.sign.secretKeyLength=Pn,r.sign.seedLength=ds,r.sign.signatureLength=Jt,r.hash=function(a){wt(a);var d=new Uint8Array(ls);return qr(d,a,a.length),d},r.hash.hashLength=ls,r.verify=function(a,d){return wt(a,d),a.length===0||d.length===0||a.length!==d.length?!1:z(a,0,d,0,a.length)===0},r.setPRNG=function(a){e=a},function(){var a=typeof self<"u"?self.crypto||self.msCrypto:null;if(a&&a.getRandomValues){var d=65536;r.setPRNG(function(f,i){var l,m=new Uint8Array(i);for(l=0;l<i;l+=d)a.getRandomValues(m.subarray(l,l+Math.min(i-l,d)));for(l=0;l<i;l++)f[l]=m[l];uc(m)})}else typeof dc<"u"&&(a=Mc(),a&&a.randomBytes&&r.setPRNG(function(f,i){var l,m=a.randomBytes(i);for(l=0;l<i;l++)f[l]=m[l];uc(m)}))}()})(typeof ci<"u"&&ci.exports?ci.exports:self.nacl=self.nacl||{})});var ha=Te((eA,Wu)=>{"use strict";Wu.exports=function(t,e){return function(){for(var o=new Array(arguments.length),s=0;s<o.length;s++)o[s]=arguments[s];return t.apply(e,o)}}});var rt=Te((tA,Zu)=>{"use strict";var jp=ha(),xa=Object.prototype.toString,Aa=function(r){return function(t){var e=xa.call(t);return r[e]||(r[e]=e.slice(8,-1).toLowerCase())}}(Object.create(null));function un(r){return r=r.toLowerCase(),function(e){return Aa(e)===r}}function ba(r){return Array.isArray(r)}function Ui(r){return typeof r>"u"}function Wp(r){return r!==null&&!Ui(r)&&r.constructor!==null&&!Ui(r.constructor)&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}var Yu=un("ArrayBuffer");function Yp(r){var t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(r):t=r&&r.buffer&&Yu(r.buffer),t}function Xp(r){return typeof r=="string"}function Zp(r){return typeof r=="number"}function Xu(r){return r!==null&&typeof r=="object"}function Ci(r){if(Aa(r)!=="object")return!1;var t=Object.getPrototypeOf(r);return t===null||t===Object.prototype}var Jp=un("Date"),eg=un("File"),tg=un("Blob"),rg=un("FileList");function wa(r){return xa.call(r)==="[object Function]"}function ng(r){return Xu(r)&&wa(r.pipe)}function og(r){var t="[object FormData]";return r&&(typeof FormData=="function"&&r instanceof FormData||xa.call(r)===t||wa(r.toString)&&r.toString()===t)}var ig=un("URLSearchParams");function sg(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function ag(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function Ta(r,t){if(!(r===null||typeof r>"u"))if(typeof r!="object"&&(r=[r]),ba(r))for(var e=0,n=r.length;e<n;e++)t.call(null,r[e],e,r);else for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&t.call(null,r[o],o,r)}function ma(){var r={};function t(o,s){Ci(r[s])&&Ci(o)?r[s]=ma(r[s],o):Ci(o)?r[s]=ma({},o):ba(o)?r[s]=o.slice():r[s]=o}for(var e=0,n=arguments.length;e<n;e++)Ta(arguments[e],t);return r}function cg(r,t,e){return Ta(t,function(o,s){e&&typeof o=="function"?r[s]=jp(o,e):r[s]=o}),r}function ug(r){return r.charCodeAt(0)===65279&&(r=r.slice(1)),r}function fg(r,t,e,n){r.prototype=Object.create(t.prototype,n),r.prototype.constructor=r,e&&Object.assign(r.prototype,e)}function dg(r,t,e){var n,o,s,c={};t=t||{};do{for(n=Object.getOwnPropertyNames(r),o=n.length;o-- >0;)s=n[o],c[s]||(t[s]=r[s],c[s]=!0);r=Object.getPrototypeOf(r)}while(r&&(!e||e(r,t))&&r!==Object.prototype);return t}function lg(r,t,e){r=String(r),(e===void 0||e>r.length)&&(e=r.length),e-=t.length;var n=r.indexOf(t,e);return n!==-1&&n===e}function pg(r){if(!r)return null;var t=r.length;if(Ui(t))return null;for(var e=new Array(t);t-- >0;)e[t]=r[t];return e}var gg=function(r){return function(t){return r&&t instanceof r}}(typeof Uint8Array<"u"&&Object.getPrototypeOf(Uint8Array));Zu.exports={isArray:ba,isArrayBuffer:Yu,isBuffer:Wp,isFormData:og,isArrayBufferView:Yp,isString:Xp,isNumber:Zp,isObject:Xu,isPlainObject:Ci,isUndefined:Ui,isDate:Jp,isFile:eg,isBlob:tg,isFunction:wa,isStream:ng,isURLSearchParams:ig,isStandardBrowserEnv:ag,forEach:Ta,merge:ma,extend:cg,trim:sg,stripBOM:ug,inherits:fg,toFlatObject:dg,kindOf:Aa,kindOfTest:un,endsWith:lg,toArray:pg,isTypedArray:gg,isFileList:rg}});var _a=Te((rA,ef)=>{"use strict";var Gn=rt();function Ju(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}ef.exports=function(t,e,n){if(!e)return t;var o;if(n)o=n(e);else if(Gn.isURLSearchParams(e))o=e.toString();else{var s=[];Gn.forEach(e,function(p,y){p===null||typeof p>"u"||(Gn.isArray(p)?y=y+"[]":p=[p],Gn.forEach(p,function(x){Gn.isDate(x)?x=x.toISOString():Gn.isObject(x)&&(x=JSON.stringify(x)),s.push(Ju(y)+"="+Ju(x))}))}),o=s.join("&")}if(o){var c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}});var rf=Te((nA,tf)=>{"use strict";var yg=rt();function Bi(){this.handlers=[]}Bi.prototype.use=function(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};Bi.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)};Bi.prototype.forEach=function(t){yg.forEach(this.handlers,function(n){n!==null&&t(n)})};tf.exports=Bi});var of=Te((oA,nf)=>{"use strict";var hg=rt();nf.exports=function(t,e){hg.forEach(t,function(o,s){s!==e&&s.toUpperCase()===e.toUpperCase()&&(t[e]=o,delete t[s])})}});var fn=Te((iA,uf)=>{"use strict";var sf=rt();function qn(r,t,e,n,o){Error.call(this),this.message=r,this.name="AxiosError",t&&(this.code=t),e&&(this.config=e),n&&(this.request=n),o&&(this.response=o)}sf.inherits(qn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var af=qn.prototype,cf={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach(function(r){cf[r]={value:r}});Object.defineProperties(qn,cf);Object.defineProperty(af,"isAxiosError",{value:!0});qn.from=function(r,t,e,n,o,s){var c=Object.create(af);return sf.toFlatObject(r,c,function(p){return p!==Error.prototype}),qn.call(c,r.message,t,e,n,o),c.name=r.name,s&&Object.assign(c,s),c};uf.exports=qn});var va=Te((sA,ff)=>{"use strict";ff.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var Sa=Te((aA,df)=>{"use strict";var Kt=rt();function mg(r,t){t=t||new FormData;var e=[];function n(s){return s===null?"":Kt.isDate(s)?s.toISOString():Kt.isArrayBuffer(s)||Kt.isTypedArray(s)?typeof Blob=="function"?new Blob([s]):Buffer.from(s):s}function o(s,c){if(Kt.isPlainObject(s)||Kt.isArray(s)){if(e.indexOf(s)!==-1)throw Error("Circular reference detected in "+c);e.push(s),Kt.forEach(s,function(p,y){if(!Kt.isUndefined(p)){var h=c?c+"."+y:y,x;if(p&&!c&&typeof p=="object"){if(Kt.endsWith(y,"{}"))p=JSON.stringify(p);else if(Kt.endsWith(y,"[]")&&(x=Kt.toArray(p))){x.forEach(function(C){!Kt.isUndefined(C)&&t.append(h,n(C))});return}}o(p,h)}}),e.pop()}else t.append(c,n(s))}return o(r),t}df.exports=mg});var pf=Te((cA,lf)=>{"use strict";var Ea=fn();lf.exports=function(t,e,n){var o=n.config.validateStatus;!n.status||!o||o(n.status)?t(n):e(new Ea("Request failed with status code "+n.status,[Ea.ERR_BAD_REQUEST,Ea.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}});var yf=Te((uA,gf)=>{"use strict";var Ii=rt();gf.exports=Ii.isStandardBrowserEnv()?function(){return{write:function(e,n,o,s,c,u){var p=[];p.push(e+"="+encodeURIComponent(n)),Ii.isNumber(o)&&p.push("expires="+new Date(o).toGMTString()),Ii.isString(s)&&p.push("path="+s),Ii.isString(c)&&p.push("domain="+c),u===!0&&p.push("secure"),document.cookie=p.join("; ")},read:function(e){var n=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var mf=Te((fA,hf)=>{"use strict";hf.exports=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}});var Af=Te((dA,xf)=>{"use strict";xf.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}});var Ca=Te((lA,bf)=>{"use strict";var xg=mf(),Ag=Af();bf.exports=function(t,e){return t&&!xg(e)?Ag(t,e):e}});var Tf=Te((pA,wf)=>{"use strict";var Ua=rt(),bg=["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"];wf.exports=function(t){var e={},n,o,s;return t&&Ua.forEach(t.split(`
|
|
2
|
+
`),function(u){if(s=u.indexOf(":"),n=Ua.trim(u.substr(0,s)).toLowerCase(),o=Ua.trim(u.substr(s+1)),n){if(e[n]&&bg.indexOf(n)>=0)return;n==="set-cookie"?e[n]=(e[n]?e[n]:[]).concat([o]):e[n]=e[n]?e[n]+", "+o:o}}),e}});var Sf=Te((gA,vf)=>{"use strict";var _f=rt();vf.exports=_f.isStandardBrowserEnv()?function(){var t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a"),n;function o(s){var c=s;return t&&(e.setAttribute("href",c),c=e.href),e.setAttribute("href",c),{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 n=o(window.location.href),function(c){var u=_f.isString(c)?o(c):c;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var xo=Te((yA,Cf)=>{"use strict";var Ba=fn(),wg=rt();function Ef(r){Ba.call(this,r??"canceled",Ba.ERR_CANCELED),this.name="CanceledError"}wg.inherits(Ef,Ba,{__CANCEL__:!0});Cf.exports=Ef});var Bf=Te((hA,Uf)=>{"use strict";Uf.exports=function(t){var e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}});var Ia=Te((mA,If)=>{"use strict";var Ao=rt(),Tg=pf(),_g=yf(),vg=_a(),Sg=Ca(),Eg=Tf(),Cg=Sf(),Ug=va(),lr=fn(),Bg=xo(),Ig=Bf();If.exports=function(t){return new Promise(function(n,o){var s=t.data,c=t.headers,u=t.responseType,p;function y(){t.cancelToken&&t.cancelToken.unsubscribe(p),t.signal&&t.signal.removeEventListener("abort",p)}Ao.isFormData(s)&&Ao.isStandardBrowserEnv()&&delete c["Content-Type"];var h=new XMLHttpRequest;if(t.auth){var x=t.auth.username||"",C=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";c.Authorization="Basic "+btoa(x+":"+C)}var T=Sg(t.baseURL,t.url);h.open(t.method.toUpperCase(),vg(T,t.params,t.paramsSerializer),!0),h.timeout=t.timeout;function z(){if(h){var P="getAllResponseHeaders"in h?Eg(h.getAllResponseHeaders()):null,$=!u||u==="text"||u==="json"?h.responseText:h.response,N={data:$,status:h.status,statusText:h.statusText,headers:P,config:t,request:h};Tg(function(L){n(L),y()},function(L){o(L),y()},N),h=null}}if("onloadend"in h?h.onloadend=z:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(z)},h.onabort=function(){h&&(o(new lr("Request aborted",lr.ECONNABORTED,t,h)),h=null)},h.onerror=function(){o(new lr("Network Error",lr.ERR_NETWORK,t,h,h)),h=null},h.ontimeout=function(){var $=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",N=t.transitional||Ug;t.timeoutErrorMessage&&($=t.timeoutErrorMessage),o(new lr($,N.clarifyTimeoutError?lr.ETIMEDOUT:lr.ECONNABORTED,t,h)),h=null},Ao.isStandardBrowserEnv()){var _=(t.withCredentials||Cg(T))&&t.xsrfCookieName?_g.read(t.xsrfCookieName):void 0;_&&(c[t.xsrfHeaderName]=_)}"setRequestHeader"in h&&Ao.forEach(c,function($,N){typeof s>"u"&&N.toLowerCase()==="content-type"?delete c[N]:h.setRequestHeader(N,$)}),Ao.isUndefined(t.withCredentials)||(h.withCredentials=!!t.withCredentials),u&&u!=="json"&&(h.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&h.addEventListener("progress",t.onDownloadProgress),typeof t.onUploadProgress=="function"&&h.upload&&h.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(p=function(P){h&&(o(!P||P&&P.type?new Bg:P),h.abort(),h=null)},t.cancelToken&&t.cancelToken.subscribe(p),t.signal&&(t.signal.aborted?p():t.signal.addEventListener("abort",p))),s||(s=null);var I=Ig(T);if(I&&["http","https","file"].indexOf(I)===-1){o(new lr("Unsupported protocol "+I+":",lr.ERR_BAD_REQUEST,t));return}h.send(s)})}});var Pf=Te((xA,Rf)=>{"use strict";Rf.exports=null});var Pi=Te((AA,zf)=>{"use strict";var nt=rt(),Of=of(),kf=fn(),Rg=va(),Pg=Sa(),Og={"Content-Type":"application/x-www-form-urlencoded"};function Nf(r,t){!nt.isUndefined(r)&&nt.isUndefined(r["Content-Type"])&&(r["Content-Type"]=t)}function kg(){var r;return typeof XMLHttpRequest<"u"?r=Ia():typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]"&&(r=Ia()),r}function Ng(r,t,e){if(nt.isString(r))try{return(t||JSON.parse)(r),nt.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(e||JSON.stringify)(r)}var Ri={transitional:Rg,adapter:kg(),transformRequest:[function(t,e){if(Of(e,"Accept"),Of(e,"Content-Type"),nt.isFormData(t)||nt.isArrayBuffer(t)||nt.isBuffer(t)||nt.isStream(t)||nt.isFile(t)||nt.isBlob(t))return t;if(nt.isArrayBufferView(t))return t.buffer;if(nt.isURLSearchParams(t))return Nf(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString();var n=nt.isObject(t),o=e&&e["Content-Type"],s;if((s=nt.isFileList(t))||n&&o==="multipart/form-data"){var c=this.env&&this.env.FormData;return Pg(s?{"files[]":t}:t,c&&new c)}else if(n||o==="application/json")return Nf(e,"application/json"),Ng(t);return t}],transformResponse:[function(t){var e=this.transitional||Ri.transitional,n=e&&e.silentJSONParsing,o=e&&e.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||o&&nt.isString(t)&&t.length)try{return JSON.parse(t)}catch(c){if(s)throw c.name==="SyntaxError"?kf.from(c,kf.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:Pf()},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};nt.forEach(["delete","get","head"],function(t){Ri.headers[t]={}});nt.forEach(["post","put","patch"],function(t){Ri.headers[t]=nt.merge(Og)});zf.exports=Ri});var Df=Te((bA,Mf)=>{"use strict";var zg=rt(),Mg=Pi();Mf.exports=function(t,e,n){var o=this||Mg;return zg.forEach(n,function(c){t=c.call(o,t,e)}),t}});var Ra=Te((wA,Gf)=>{"use strict";Gf.exports=function(t){return!!(t&&t.__CANCEL__)}});var Ff=Te((TA,Lf)=>{"use strict";var qf=rt(),Pa=Df(),Dg=Ra(),Gg=Pi(),qg=xo();function Oa(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new qg}Lf.exports=function(t){Oa(t),t.headers=t.headers||{},t.data=Pa.call(t,t.data,t.headers,t.transformRequest),t.headers=qf.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),qf.forEach(["delete","get","head","post","put","patch","common"],function(o){delete t.headers[o]});var e=t.adapter||Gg.adapter;return e(t).then(function(o){return Oa(t),o.data=Pa.call(t,o.data,o.headers,t.transformResponse),o},function(o){return Dg(o)||(Oa(t),o&&o.response&&(o.response.data=Pa.call(t,o.response.data,o.response.headers,t.transformResponse))),Promise.reject(o)})}});var ka=Te((_A,Kf)=>{"use strict";var St=rt();Kf.exports=function(t,e){e=e||{};var n={};function o(h,x){return St.isPlainObject(h)&&St.isPlainObject(x)?St.merge(h,x):St.isPlainObject(x)?St.merge({},x):St.isArray(x)?x.slice():x}function s(h){if(St.isUndefined(e[h])){if(!St.isUndefined(t[h]))return o(void 0,t[h])}else return o(t[h],e[h])}function c(h){if(!St.isUndefined(e[h]))return o(void 0,e[h])}function u(h){if(St.isUndefined(e[h])){if(!St.isUndefined(t[h]))return o(void 0,t[h])}else return o(void 0,e[h])}function p(h){if(h in e)return o(t[h],e[h]);if(h in t)return o(void 0,t[h])}var y={url:c,method:c,data:c,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:p};return St.forEach(Object.keys(t).concat(Object.keys(e)),function(x){var C=y[x]||s,T=C(x);St.isUndefined(T)&&C!==p||(n[x]=T)}),n}});var Na=Te((vA,Hf)=>{"use strict";Hf.exports={version:"0.27.2"}});var Qf=Te((SA,Vf)=>{"use strict";var Lg=Na().version,Nr=fn(),za={};["object","boolean","number","function","string","symbol"].forEach(function(r,t){za[r]=function(n){return typeof n===r||"a"+(t<1?"n ":" ")+r}});var $f={};za.transitional=function(t,e,n){function o(s,c){return"[Axios v"+Lg+"] Transitional option '"+s+"'"+c+(n?". "+n:"")}return function(s,c,u){if(t===!1)throw new Nr(o(c," has been removed"+(e?" in "+e:"")),Nr.ERR_DEPRECATED);return e&&!$f[c]&&($f[c]=!0,console.warn(o(c," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(s,c,u):!0}};function Fg(r,t,e){if(typeof r!="object")throw new Nr("options must be an object",Nr.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(r),o=n.length;o-- >0;){var s=n[o],c=t[s];if(c){var u=r[s],p=u===void 0||c(u,s,r);if(p!==!0)throw new Nr("option "+s+" must be "+p,Nr.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new Nr("Unknown option "+s,Nr.ERR_BAD_OPTION)}}Vf.exports={assertOptions:Fg,validators:za}});var Jf=Te((EA,Zf)=>{"use strict";var Yf=rt(),Kg=_a(),jf=rf(),Wf=Ff(),Oi=ka(),Hg=Ca(),Xf=Qf(),Ln=Xf.validators;function Fn(r){this.defaults=r,this.interceptors={request:new jf,response:new jf}}Fn.prototype.request=function(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=Oi(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var n=e.transitional;n!==void 0&&Xf.assertOptions(n,{silentJSONParsing:Ln.transitional(Ln.boolean),forcedJSONParsing:Ln.transitional(Ln.boolean),clarifyTimeoutError:Ln.transitional(Ln.boolean)},!1);var o=[],s=!0;this.interceptors.request.forEach(function(T){typeof T.runWhen=="function"&&T.runWhen(e)===!1||(s=s&&T.synchronous,o.unshift(T.fulfilled,T.rejected))});var c=[];this.interceptors.response.forEach(function(T){c.push(T.fulfilled,T.rejected)});var u;if(!s){var p=[Wf,void 0];for(Array.prototype.unshift.apply(p,o),p=p.concat(c),u=Promise.resolve(e);p.length;)u=u.then(p.shift(),p.shift());return u}for(var y=e;o.length;){var h=o.shift(),x=o.shift();try{y=h(y)}catch(C){x(C);break}}try{u=Wf(y)}catch(C){return Promise.reject(C)}for(;c.length;)u=u.then(c.shift(),c.shift());return u};Fn.prototype.getUri=function(t){t=Oi(this.defaults,t);var e=Hg(t.baseURL,t.url);return Kg(e,t.params,t.paramsSerializer)};Yf.forEach(["delete","get","head","options"],function(t){Fn.prototype[t]=function(e,n){return this.request(Oi(n||{},{method:t,url:e,data:(n||{}).data}))}});Yf.forEach(["post","put","patch"],function(t){function e(n){return function(s,c,u){return this.request(Oi(u||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:c}))}}Fn.prototype[t]=e(),Fn.prototype[t+"Form"]=e(!0)});Zf.exports=Fn});var td=Te((CA,ed)=>{"use strict";var $g=xo();function Kn(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(o){t=o});var e=this;this.promise.then(function(n){if(e._listeners){var o,s=e._listeners.length;for(o=0;o<s;o++)e._listeners[o](n);e._listeners=null}}),this.promise.then=function(n){var o,s=new Promise(function(c){e.subscribe(c),o=c}).then(n);return s.cancel=function(){e.unsubscribe(o)},s},r(function(o){e.reason||(e.reason=new $g(o),t(e.reason))})}Kn.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};Kn.prototype.subscribe=function(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]};Kn.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}};Kn.source=function(){var t,e=new Kn(function(o){t=o});return{token:e,cancel:t}};ed.exports=Kn});var nd=Te((UA,rd)=>{"use strict";rd.exports=function(t){return function(n){return t.apply(null,n)}}});var id=Te((BA,od)=>{"use strict";var Vg=rt();od.exports=function(t){return Vg.isObject(t)&&t.isAxiosError===!0}});var cd=Te((IA,Ma)=>{"use strict";var sd=rt(),Qg=ha(),ki=Jf(),jg=ka(),Wg=Pi();function ad(r){var t=new ki(r),e=Qg(ki.prototype.request,t);return sd.extend(e,ki.prototype,t),sd.extend(e,t),e.create=function(o){return ad(jg(r,o))},e}var xt=ad(Wg);xt.Axios=ki;xt.CanceledError=xo();xt.CancelToken=td();xt.isCancel=Ra();xt.VERSION=Na().version;xt.toFormData=Sa();xt.AxiosError=fn();xt.Cancel=xt.CanceledError;xt.all=function(t){return Promise.all(t)};xt.spread=nd();xt.isAxiosError=id();Ma.exports=xt;Ma.exports.default=xt});var fd=Te((RA,ud)=>{"use strict";ud.exports=cd()});var fy={};lc(fy,{APTOS_BIP44_REGEX:()=>Vc,APTOS_COIN:()=>Cs,APTOS_HARDENED_REGEX:()=>$c,Account:()=>dr,AccountAddress:()=>O,AccountAuthenticator:()=>At,AccountAuthenticatorEd25519:()=>gr,AccountAuthenticatorMultiEd25519:()=>Di,AccountAuthenticatorMultiKey:()=>Hn,AccountAuthenticatorSingleKey:()=>jt,AccountAuthenticatorVariant:()=>ms,AddressInvalidReason:()=>Bc,AnyPublicKeyVariant:()=>xs,AnySignatureVariant:()=>As,Aptos:()=>ot,AptosApiError:()=>$t,AptosApiType:()=>ao,AptosConfig:()=>bo,AuthenticationKey:()=>Ft,Bool:()=>qe,CKDPriv:()=>$s,ChainId:()=>yn,DEFAULT_MAX_GAS_AMOUNT:()=>Ss,DEFAULT_NETWORK:()=>vs,DEFAULT_TXN_EXP_SEC_FROM_NOW:()=>Es,DEFAULT_TXN_TIMEOUT_SEC:()=>co,DeriveScheme:()=>Ac,Deserializer:()=>Gs,Ed25519PrivateKey:()=>or,Ed25519PublicKey:()=>Pe,Ed25519Signature:()=>Le,EntryFunction:()=>En,EntryFunctionBytes:()=>lo,FeePayerRawTransaction:()=>mr,FixedBytes:()=>Sr,HARDENED_OFFSET:()=>Fs,Hex:()=>me,HexInvalidReason:()=>Cc,Identifier:()=>ze,KeyType:()=>Qc,MimeType:()=>jo,ModuleId:()=>$n,MoveAbility:()=>mc,MoveFunctionVisibility:()=>hc,MoveOption:()=>Er,MoveString:()=>Xe,MoveVector:()=>Ie,MultiAgentRawTransaction:()=>hr,MultiEd25519PublicKey:()=>qt,MultiEd25519Signature:()=>Jr,MultiKey:()=>an,MultiSig:()=>Yn,MultisigTransactionPayload:()=>Xn,Network:()=>so,NetworkToChainId:()=>Yo,NetworkToFaucetAPI:()=>_s,NetworkToIndexerAPI:()=>Wo,NetworkToNetworkName:()=>gl,NetworkToNodeAPI:()=>Ts,ParsingError:()=>lt,PrivateKey:()=>Wr,PublicKey:()=>Tt,RAW_TRANSACTION_SALT:()=>Us,RAW_TRANSACTION_WITH_DATA_SALT:()=>Xo,RawTransaction:()=>Xt,RawTransactionWithData:()=>vo,RoleType:()=>xc,RotationProofChallenge:()=>wo,Script:()=>Wn,ScriptTransactionArgumentVariants:()=>On,Secp256k1PrivateKey:()=>cr,Secp256k1PublicKey:()=>Lt,Secp256k1Signature:()=>ur,Serializable:()=>Z,Serializer:()=>Mt,Signature:()=>Gt,SignedTransaction:()=>Ht,SigningScheme:()=>kn,SigningSchemeInput:()=>ws,StructTag:()=>Yt,TransactionAuthenticator:()=>Wt,TransactionAuthenticatorEd25519:()=>dn,TransactionAuthenticatorFeePayer:()=>pn,TransactionAuthenticatorMultiAgent:()=>ln,TransactionAuthenticatorMultiEd25519:()=>Gi,TransactionAuthenticatorSingleSender:()=>gn,TransactionAuthenticatorVariant:()=>hs,TransactionPayload:()=>Mr,TransactionPayloadEntryFunction:()=>Qn,TransactionPayloadMultisig:()=>jn,TransactionPayloadScript:()=>Vn,TransactionPayloadVariants:()=>gs,TransactionResponseType:()=>bs,TransactionVariants:()=>ys,TypeTag:()=>Ke,TypeTagAddress:()=>_n,TypeTagBool:()=>hn,TypeTagGeneric:()=>vn,TypeTagParserError:()=>ke,TypeTagParserErrorType:()=>Ad,TypeTagReference:()=>_o,TypeTagSigner:()=>zr,TypeTagStruct:()=>yr,TypeTagU128:()=>wn,TypeTagU16:()=>xn,TypeTagU256:()=>Tn,TypeTagU32:()=>An,TypeTagU64:()=>bn,TypeTagU8:()=>mn,TypeTagVariants:()=>ps,TypeTagVector:()=>Sn,U128:()=>Bt,U16:()=>Ct,U256:()=>It,U32:()=>Ut,U64:()=>Ye,U8:()=>st,aptosCoinStructTag:()=>Xg,aptosRequest:()=>io,buildTransaction:()=>Zi,convertArgument:()=>Va,deriveKey:()=>di,deriveTransactionType:()=>Ya,deserializeFromScriptArgument:()=>hd,ensureBoolean:()=>ni,fetchEntryFunctionAbi:()=>$a,findFirstNonSignerArg:()=>Ka,generateMultiSignersSignedTransaction:()=>_d,generateRawTransaction:()=>Td,generateSignedTransaction:()=>Wa,generateSignedTransactionForSimulation:()=>Qa,generateTransactionPayload:()=>Bo,generateTransactionPayloadWithABI:()=>bd,get:()=>Tc,getAptosFullNode:()=>ht,getAuthenticatorForSimulation:()=>Uo,getFunctionParts:()=>Yi,getSigningMessage:()=>vd,isBcsAddress:()=>Co,isBcsBool:()=>Li,isBcsFixedBytes:()=>Fa,isBcsString:()=>Fi,isBcsU128:()=>Qi,isBcsU16:()=>Hi,isBcsU256:()=>ji,isBcsU32:()=>$i,isBcsU64:()=>Vi,isBcsU8:()=>Ki,isBool:()=>qa,isLargeNumber:()=>Eo,isNull:()=>La,isNumber:()=>So,isScriptDataInput:()=>Wi,isString:()=>Cn,isValidBIP44Path:()=>Ks,isValidHardenedPath:()=>Hs,mnemonicToSeed:()=>go,objectStructTag:()=>ey,optionStructTag:()=>Jg,outOfRangeErrorMessage:()=>Uc,paginateWithCursor:()=>Fr,parseTypeTag:()=>Zn,post:()=>Zo,postAptosFaucet:()=>Is,postAptosFullNode:()=>Kr,postAptosIndexer:()=>Bs,request:()=>wc,sign:()=>ja,splitPath:()=>Vs,standardizeTypeTags:()=>Ha,stringStructTag:()=>Zg,throwTypeMismatch:()=>Ne,validateNumberInRange:()=>tr});var $t=class extends Error{constructor(e,n,o){super(o);this.name="AptosApiError",this.url=n.url,this.status=n.status,this.statusText=n.statusText,this.data=n.data,this.request=e}};var yc="0.0.4";var jo=(n=>(n.JSON="application/json",n.BCS="application/x-bcs",n.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",n))(jo||{}),ps=(T=>(T[T.Bool=0]="Bool",T[T.U8=1]="U8",T[T.U64=2]="U64",T[T.U128=3]="U128",T[T.Address=4]="Address",T[T.Signer=5]="Signer",T[T.Vector=6]="Vector",T[T.Struct=7]="Struct",T[T.U16=8]="U16",T[T.U32=9]="U32",T[T.U256=10]="U256",T[T.Reference=254]="Reference",T[T.Generic=255]="Generic",T))(ps||{}),On=(y=>(y[y.U8=0]="U8",y[y.U64=1]="U64",y[y.U128=2]="U128",y[y.Address=3]="Address",y[y.U8Vector=4]="U8Vector",y[y.Bool=5]="Bool",y[y.U16=6]="U16",y[y.U32=7]="U32",y[y.U256=8]="U256",y))(On||{}),gs=(n=>(n[n.Script=0]="Script",n[n.EntryFunction=2]="EntryFunction",n[n.Multisig=3]="Multisig",n))(gs||{}),ys=(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(ys||{}),hs=(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))(hs||{}),ms=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(ms||{}),xs=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(xs||{}),As=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(As||{}),bs=(s=>(s.Pending="pending_transaction",s.User="user_transaction",s.Genesis="genesis_transaction",s.BlockMetadata="block_metadata_transaction",s.StateCheckpoint="state_checkpoint_transaction",s))(bs||{}),hc=(n=>(n.PRIVATE="private",n.PUBLIC="public",n.FRIEND="friend",n))(hc||{}),mc=(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(mc||{}),xc=(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(xc||{}),kn=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(kn||{}),ws=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(ws||{}),Ac=(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))(Ac||{});var bc={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 wc(r,t){let{url:e,method:n,body:o,contentType:s,params:c,overrides:u}=r,p={...u?.HEADERS,"x-aptos-client":`aptos-ts-sdk/${yc}`,"content-type":s??"application/json"};return u?.AUTH_TOKEN&&e.includes("faucet")&&(p.Authorization=`Bearer ${u?.AUTH_TOKEN}`),t.provider({url:e,method:n,body:o,params:c,headers:p,overrides:u})}async function io(r,t){let{url:e,path:n}=r,o=`${e}/${n??""}`,s=await wc({...r,url:o},t.client),c={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 p=c.data;if(p.errors)throw new $t(r,c,p.errors[0].message??`Unhandled Error ${s.status} : ${s.statusText}`);c.data=p.data}if(c.status>=200&&c.status<300)return c;let u;throw"message"in s.data&&"error_code"in s.data?u=JSON.stringify(s.data):c.status in bc?u=bc[c.status]:u=`Unhandled Error ${s.status} : ${s.statusText}`,new $t(r,c,u)}var Wo={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"},Ts={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"},_s={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"},so=(s=>(s.MAINNET="mainnet",s.TESTNET="testnet",s.DEVNET="devnet",s.LOCAL="local",s.CUSTOM="custom",s))(so||{}),Yo={mainnet:1,testnet:2},gl={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var ao=(n=>(n[n.FULLNODE=0]="FULLNODE",n[n.INDEXER=1]="INDEXER",n[n.FAUCET=2]="FAUCET",n))(ao||{}),vs="devnet",Ss=2e5,Es=20,co=20,Cs="0x1::aptos_coin::AptosCoin",Us="APTOS::RawTransaction",Xo="APTOS::RawTransactionWithData";async function Tc(r){let{aptosConfig:t,overrides:e,params:n,contentType:o,acceptType:s,path:c,originMethod:u,type:p}=r,y=t.getRequestUrl(p);return io({url:y,method:"GET",originMethod:u,path:c,contentType:o?.valueOf(),acceptType:s?.valueOf(),params:n,overrides:{...t.clientConfig,...e}},t)}async function ht(r){return Tc({...r,type:0})}async function Fr(r){let t=[],e,n=r.params;for(;;){n.start=e;let o=await ht({aptosConfig:r.aptosConfig,originMethod:r.originMethod,path:r.path,params:n,overrides:r.overrides});if(e=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),e==null)break}return t}async function Zo(r){let{type:t,originMethod:e,path:n,body:o,acceptType:s,contentType:c,params:u,aptosConfig:p,overrides:y}=r,h=p.getRequestUrl(t);return io({url:h,method:"POST",originMethod:e,path:n,body:o,contentType:c?.valueOf(),acceptType:s?.valueOf(),params:u,overrides:{...p.clientConfig,...y}},p)}async function Kr(r){return Zo({...r,type:0})}async function Bs(r){return Zo({...r,type:1})}async function Is(r){return Zo({...r,type:2})}var Jo=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var Rs=r=>r instanceof Uint8Array;var _c=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4)),Vt=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),Nt=(r,t)=>r<<32-t|r>>>t,yl=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!yl)throw new Error("Non little-endian hardware is not supported");var hl=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function Hr(r){if(!Rs(r))throw new Error("Uint8Array expected");let t="";for(let e=0;e<r.length;e++)t+=hl[r[e]];return t}function Nn(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.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 n=0;n<e.length;n++){let o=n*2,s=r.slice(o,o+2),c=Number.parseInt(s,16);if(Number.isNaN(c)||c<0)throw new Error("Invalid byte sequence");e[n]=c}return e}function Ps(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function zt(r){if(typeof r=="string"&&(r=Ps(r)),!Rs(r))throw new Error(`expected Uint8Array, got ${typeof r}`);return r}function $r(...r){let t=new Uint8Array(r.reduce((n,o)=>n+o.length,0)),e=0;return r.forEach(n=>{if(!Rs(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}var Tr=class{clone(){return this._cloneInto()}},ml={}.toString;function vc(r,t){if(t!==void 0&&ml.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(r,t)}function _r(r){let t=n=>r().update(zt(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function Sc(r){let t=(n,o)=>r(o).update(zt(n)).digest(),e=r({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>r(n),t}function Ec(r=32){if(Jo&&typeof Jo.getRandomValues=="function")return Jo.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}var ei=2**8-1,ti=2**16-1,er=2**32-1,Vr=BigInt(2)**BigInt(64)-BigInt(1),uo=BigInt(2)**BigInt(128)-BigInt(1),ri=BigInt(2)**BigInt(256)-BigInt(1);var lt=class extends Error{constructor(e,n){super(e);this.invalidReason=n}};var Cc=(n=>(n.TOO_SHORT="too_short",n.INVALID_LENGTH="invalid_length",n.INVALID_HEX_CHARS="invalid_hex_chars",n))(Cc||{}),me=class r{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return Hr(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 lt("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 lt("Hex string must be an even number of hex characters.","invalid_length");try{return new r(Nn(e))}catch(n){let o=n;throw new lt(`Hex string contains invalid hex characters: ${o.message}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new r(t):r.fromString(t)}static isValid(t){try{return r.fromString(t),{valid:!0}}catch(e){let n=e;return{valid:!1,invalidReason:n.invalidReason,invalidReasonMessage:n.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,n)=>e===t.data[n])}};var Z=class{bcsToBytes(){let t=new Mt;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return me.fromHexInput(t)}},Mt=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,n){this.ensureBufferWillHandleSize(e);let o=new DataView(this.buffer,this.offset);t.apply(o,[0,n,!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){ni(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(er),n=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(n))}serializeU128(t){let e=BigInt(t)&Vr,n=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(n)}serializeU256(t){let e=BigInt(t)&uo,n=BigInt(t)>>BigInt(128);this.serializeU128(e),this.serializeU128(n)}serializeU32AsUleb128(t){let e=t,n=[];for(;e>>>7;)n.push(e&127|128),e>>>=7;n.push(e),this.appendToBuffer(new Uint8Array(n))}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)})}};yt([Qr(0,ei)],Mt.prototype,"serializeU8",1),yt([Qr(0,ti)],Mt.prototype,"serializeU16",1),yt([Qr(0,er)],Mt.prototype,"serializeU32",1),yt([Qr(BigInt(0),Vr)],Mt.prototype,"serializeU64",1),yt([Qr(BigInt(0),uo)],Mt.prototype,"serializeU128",1),yt([Qr(BigInt(0),ri)],Mt.prototype,"serializeU256",1),yt([Qr(0,er)],Mt.prototype,"serializeU32AsUleb128",1);function ni(r){if(typeof r!="boolean")throw new Error(`${r} is not a boolean value`)}var Uc=(r,t,e)=>`${r} is out of range: [${t}, ${e}]`;function tr(r,t,e){let n=BigInt(r);if(n>BigInt(e)||n<BigInt(t))throw new Error(Uc(r,t,e))}function Qr(r,t){return(e,n,o)=>{let s=o.value;return o.value=function(u){return tr(u,r,t),s.apply(this,[u])},o}}var Bc=(u=>(u.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",u.INVALID_HEX_CHARS="invalid_hex_chars",u.TOO_SHORT="too_short",u.TOO_LONG="too_long",u.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",u.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",u.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",u))(Bc||{}),Be=class Be extends Z{constructor(e){super();if(e.length!==Be.LENGTH)throw new lt("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=Hr(this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return Hr(this.data)}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let n=e.deserializeFixedBytes(Be.LENGTH);return new Be(n)}static fromString(e){if(!e.startsWith("0x"))throw new lt("Hex string must start with a leading 0x.","leading_zero_x_required");let n=Be.fromStringRelaxed(e);if(e.length!==Be.LONG_STRING_LENGTH+2)if(n.isSpecial()){if(e.length!==3)throw new lt(`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 lt(`The given hex string ${n} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return n}static fromStringRelaxed(e){let n=e;if(e.startsWith("0x")&&(n=e.slice(2)),n.length===0)throw new lt("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(n.length>64)throw new lt("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let o;try{o=Nn(n.padStart(64,"0"))}catch(s){let c=s;throw new lt(`Hex characters are invalid: ${c.message}`,"invalid_hex_chars")}return new Be(o)}static fromRelaxed(e){return e instanceof Be?e:e instanceof Uint8Array?new Be(e):Be.fromStringRelaxed(e)}static from(e){return e instanceof Be?e:e instanceof Uint8Array?new Be(e):Be.fromString(e)}static isValid(e){try{return e.relaxed?Be.fromRelaxed(e.input):Be.from(e.input),{valid:!0}}catch(n){let o=n;return{valid:!1,invalidReason:o.invalidReason,invalidReasonMessage:o.message}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((n,o)=>n===e.data[o])}};Be.LENGTH=32,Be.LONG_STRING_LENGTH=64,Be.ZERO=Be.from("0x0"),Be.ONE=Be.from("0x1"),Be.TWO=Be.from("0x2"),Be.THREE=Be.from("0x3"),Be.FOUR=Be.from("0x4");var O=Be;function rr(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function Dt(r,...t){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(r.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${r.length}`)}function oi(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");rr(r.outputLen),rr(r.blockLen)}function nr(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function ii(r,t){Dt(r);let e=t.outputLen;if(r.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var si=BigInt(4294967295),Os=BigInt(32);function Ic(r,t=!1){return t?{h:Number(r&si),l:Number(r>>Os&si)}:{h:Number(r>>Os&si)|0,l:Number(r&si)|0}}function ks(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o<r.length;o++){let{h:s,l:c}=Ic(r[o],t);[e[o],n[o]]=[s,c]}return[e,n]}var xl=(r,t)=>BigInt(r>>>0)<<Os|BigInt(t>>>0),Al=(r,t,e)=>r>>>e,bl=(r,t,e)=>r<<32-e|t>>>e,wl=(r,t,e)=>r>>>e|t<<32-e,Tl=(r,t,e)=>r<<32-e|t>>>e,_l=(r,t,e)=>r<<64-e|t>>>e-32,vl=(r,t,e)=>r>>>e-32|t<<64-e,Sl=(r,t)=>t,El=(r,t)=>r,Ns=(r,t,e)=>r<<e|t>>>32-e,zs=(r,t,e)=>t<<e|r>>>32-e,Ms=(r,t,e)=>t<<e-32|r>>>64-e,Ds=(r,t,e)=>r<<e-32|t>>>64-e;function Cl(r,t,e,n){let o=(t>>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var Ul=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),Bl=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,Il=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),Rl=(r,t,e,n,o)=>t+e+n+o+(r/2**32|0)|0,Pl=(r,t,e,n,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(o>>>0),Ol=(r,t,e,n,o,s)=>t+e+n+o+s+(r/2**32|0)|0;var kl={fromBig:Ic,split:ks,toBig:xl,shrSH:Al,shrSL:bl,rotrSH:wl,rotrSL:Tl,rotrBH:_l,rotrBL:vl,rotr32H:Sl,rotr32L:El,rotlSH:Ns,rotlSL:zs,rotlBH:Ms,rotlBL:Ds,add:Cl,add3L:Ul,add3H:Bl,add4L:Il,add4H:Rl,add5H:Ol,add5L:Pl},pe=kl;var[Oc,kc,Nc]=[[],[],[]],Nl=BigInt(0),fo=BigInt(1),zl=BigInt(2),Ml=BigInt(7),Dl=BigInt(256),Gl=BigInt(113);for(let r=0,t=fo,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],Oc.push(2*(5*n+e)),kc.push((r+1)*(r+2)/2%64);let o=Nl;for(let s=0;s<7;s++)t=(t<<fo^(t>>Ml)*Gl)%Dl,t&zl&&(o^=fo<<(fo<<BigInt(s))-fo);Nc.push(o)}var[ql,Ll]=ks(Nc,!0),Rc=(r,t,e)=>e>32?Ms(r,t,e):Ns(r,t,e),Pc=(r,t,e)=>e>32?Ds(r,t,e):zs(r,t,e);function Fl(r,t=24){let e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let c=0;c<10;c++)e[c]=r[c]^r[c+10]^r[c+20]^r[c+30]^r[c+40];for(let c=0;c<10;c+=2){let u=(c+8)%10,p=(c+2)%10,y=e[p],h=e[p+1],x=Rc(y,h,1)^e[u],C=Pc(y,h,1)^e[u+1];for(let T=0;T<50;T+=10)r[c+T]^=x,r[c+T+1]^=C}let o=r[2],s=r[3];for(let c=0;c<24;c++){let u=kc[c],p=Rc(o,s,u),y=Pc(o,s,u),h=Oc[c];o=r[h],s=r[h+1],r[h]=p,r[h+1]=y}for(let c=0;c<50;c+=10){for(let u=0;u<10;u++)e[u]=r[c+u];for(let u=0;u<10;u++)r[c+u]^=~e[(u+2)%10]&e[(u+4)%10]}r[0]^=ql[n],r[1]^=Ll[n]}e.fill(0)}var ai=class r extends Tr{constructor(t,e,n,o=!1,s=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=o,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,rr(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=_c(this.state)}keccak(){Fl(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){nr(this);let{blockLen:e,state:n}=this;t=zt(t);let o=t.length;for(let s=0;s<o;){let c=Math.min(e-this.pos,o-s);for(let u=0;u<c;u++)n[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:n,blockLen:o}=this;t[n]^=e,e&128&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){nr(this,!1),Dt(t),this.finish();let e=this.state,{blockLen:n}=this;for(let o=0,s=t.length;o<s;){this.posOut>=n&&this.keccak();let c=Math.min(n-this.posOut,s-o);t.set(e.subarray(this.posOut,this.posOut+c),o),this.posOut+=c,o+=c}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return rr(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:n,outputLen:o,rounds:s,enableXOF:c}=this;return t||(t=new r(e,n,o,c,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=o,t.enableXOF=c,t.destroyed=this.destroyed,t}},vr=(r,t,e)=>_r(()=>new ai(t,r,e)),lh=vr(6,144,224/8),jr=vr(6,136,256/8),ph=vr(6,104,384/8),gh=vr(6,72,512/8),yh=vr(1,144,224/8),hh=vr(1,136,256/8),mh=vr(1,104,384/8),xh=vr(1,72,512/8),zc=(r,t,e)=>Sc((n={})=>new ai(t,r,n.dkLen===void 0?e:n.dkLen,!0)),Ah=zc(31,168,128/8),bh=zc(31,136,256/8);var yo=gc(Dc());var Gs=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<er;){let n=this.deserializeU8();if(t|=BigInt(n&127)<<BigInt(e),!(n&128))break;e+=7}if(t>er)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(),n=new Array;for(let o=0;o<e;o+=1)n.push(this.deserialize(t));return n}};var Sr=class r extends Z{constructor(e){super();this.value=me.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,n){let o=e.deserializeFixedBytes(n);return new r(o)}};var lo=class r extends Z{constructor(e){super();this.value=new Sr(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,n){let o=Sr.deserialize(e,n);return new r(o.value)}};var qe=class r extends Z{constructor(e){super();ni(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new r(e.deserializeBool())}},st=class r extends Z{constructor(e){super();tr(e,0,ei),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new r(e.deserializeU8())}},Ct=class r extends Z{constructor(e){super();tr(e,0,ti),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new r(e.deserializeU16())}},Ut=class r extends Z{constructor(e){super();tr(e,0,er),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new r(e.deserializeU32())}},Ye=class r extends Z{constructor(e){super();tr(e,BigInt(0),Vr),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new r(e.deserializeU64())}},Bt=class r extends Z{constructor(e){super();tr(e,BigInt(0),uo),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new r(e.deserializeU128())}},It=class r extends Z{constructor(e){super();tr(e,BigInt(0),ri),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new r(e.deserializeU256())}};var Ie=class r extends Z{constructor(e){super();this.values=e}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){if(!(this.values[0]instanceof st)&&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 n;if(Array.isArray(e)&&typeof e[0]=="number")n=e;else if(typeof e=="string"){let o=me.fromHexInput(e);n=Array.from(o.toUint8Array())}else if(e instanceof Uint8Array)n=Array.from(e);else throw new Error("Invalid input type");return new r(n.map(o=>new st(o)))}static U16(e){return new r(e.map(n=>new Ct(n)))}static U32(e){return new r(e.map(n=>new Ut(n)))}static U64(e){return new r(e.map(n=>new Ye(n)))}static U128(e){return new r(e.map(n=>new Bt(n)))}static U256(e){return new r(e.map(n=>new It(n)))}static Bool(e){return new r(e.map(n=>new qe(n)))}static MoveString(e){return new r(e.map(n=>new Xe(n)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,n){let o=e.deserializeUleb128AsU32(),s=new Array;for(let c=0;c<o;c+=1)s.push(n.deserialize(e));return new r(s)}},Xe=class r extends Z{constructor(e){super();this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){let n=this.bcsToBytes().slice(1);Ie.U8(n).serializeForScriptFunction(e)}static deserialize(e){return new r(e.deserializeStr())}},Er=class r extends Z{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new Ie([e]):this.vec=new Ie([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}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 r(e!=null?new st(e):void 0)}static U16(e){return new r(e!=null?new Ct(e):void 0)}static U32(e){return new r(e!=null?new Ut(e):void 0)}static U64(e){return new r(e!=null?new Ye(e):void 0)}static U128(e){return new r(e!=null?new Bt(e):void 0)}static U256(e){return new r(e!=null?new It(e):void 0)}static Bool(e){return new r(e!=null?new qe(e):void 0)}static MoveString(e){return new r(e!=null?new Xe(e):void 0)}static deserialize(e,n){let o=Ie.deserialize(e,n);return new r(o.values[0])}};var Tt=class extends Z{},Wr=class extends Z{},Gt=class extends Z{};var ui=class extends Tr{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,oi(t);let n=zt(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(n.length>o?t.create().update(n).digest():n);for(let c=0;c<s.length;c++)s[c]^=54;this.iHash.update(s),this.oHash=t.create();for(let c=0;c<s.length;c++)s[c]^=106;this.oHash.update(s),s.fill(0)}update(t){return nr(this),this.iHash.update(t),this}digestInto(t){nr(this),Dt(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:n,finished:o,destroyed:s,blockLen:c,outputLen:u}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=c,t.outputLen=u,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Qt=(r,t,e)=>new ui(r,t).update(e).digest();Qt.create=(r,t)=>new ui(r,t);function Kl(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let o=BigInt(32),s=BigInt(4294967295),c=Number(e>>o&s),u=Number(e&s),p=n?4:0,y=n?0:4;r.setUint32(t+p,c,n),r.setUint32(t+y,u,n)}var Cr=class extends Tr{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Vt(this.buffer)}update(t){nr(this);let{view:e,buffer:n,blockLen:o}=this;t=zt(t);let s=t.length;for(let c=0;c<s;){let u=Math.min(o-this.pos,s-c);if(u===o){let p=Vt(t);for(;o<=s-c;c+=o)this.process(p,c);continue}n.set(t.subarray(c,c+u),this.pos),this.pos+=u,c+=u,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){nr(this),ii(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:o,isLE:s}=this,{pos:c}=this;e[c++]=128,this.buffer.subarray(c).fill(0),this.padOffset>o-c&&(this.process(n,0),c=0);for(let x=c;x<o;x++)e[x]=0;Kl(n,o-8,BigInt(this.length*8),s),this.process(n,0);let u=Vt(t),p=this.outputLen;if(p%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let y=p/4,h=this.get();if(y>h.length)throw new Error("_sha2: outputLen bigger than state");for(let x=0;x<y;x++)u.setUint32(4*x,h[x],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:o,finished:s,destroyed:c,pos:u}=this;return t.length=o,t.pos=u,t.finished=s,t.destroyed=c,o%e&&t.buffer.set(n),t}};var[Hl,$l]=(()=>pe.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(r=>BigInt(r))))(),Ur=new Uint32Array(80),Br=new Uint32Array(80),qs=class extends Cr{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:n,Bl:o,Ch:s,Cl:c,Dh:u,Dl:p,Eh:y,El:h,Fh:x,Fl:C,Gh:T,Gl:z,Hh:_,Hl:I}=this;return[t,e,n,o,s,c,u,p,y,h,x,C,T,z,_,I]}set(t,e,n,o,s,c,u,p,y,h,x,C,T,z,_,I){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=o|0,this.Ch=s|0,this.Cl=c|0,this.Dh=u|0,this.Dl=p|0,this.Eh=y|0,this.El=h|0,this.Fh=x|0,this.Fl=C|0,this.Gh=T|0,this.Gl=z|0,this.Hh=_|0,this.Hl=I|0}process(t,e){for(let N=0;N<16;N++,e+=4)Ur[N]=t.getUint32(e),Br[N]=t.getUint32(e+=4);for(let N=16;N<80;N++){let ee=Ur[N-15]|0,L=Br[N-15]|0,j=pe.rotrSH(ee,L,1)^pe.rotrSH(ee,L,8)^pe.shrSH(ee,L,7),J=pe.rotrSL(ee,L,1)^pe.rotrSL(ee,L,8)^pe.shrSL(ee,L,7),X=Ur[N-2]|0,Re=Br[N-2]|0,Ae=pe.rotrSH(X,Re,19)^pe.rotrBH(X,Re,61)^pe.shrSH(X,Re,6),he=pe.rotrSL(X,Re,19)^pe.rotrBL(X,Re,61)^pe.shrSL(X,Re,6),He=pe.add4L(J,he,Br[N-7],Br[N-16]),$e=pe.add4H(He,j,Ae,Ur[N-7],Ur[N-16]);Ur[N]=$e|0,Br[N]=He|0}let{Ah:n,Al:o,Bh:s,Bl:c,Ch:u,Cl:p,Dh:y,Dl:h,Eh:x,El:C,Fh:T,Fl:z,Gh:_,Gl:I,Hh:P,Hl:$}=this;for(let N=0;N<80;N++){let ee=pe.rotrSH(x,C,14)^pe.rotrSH(x,C,18)^pe.rotrBH(x,C,41),L=pe.rotrSL(x,C,14)^pe.rotrSL(x,C,18)^pe.rotrBL(x,C,41),j=x&T^~x&_,J=C&z^~C&I,X=pe.add5L($,L,J,$l[N],Br[N]),Re=pe.add5H(X,P,ee,j,Hl[N],Ur[N]),Ae=X|0,he=pe.rotrSH(n,o,28)^pe.rotrBH(n,o,34)^pe.rotrBH(n,o,39),He=pe.rotrSL(n,o,28)^pe.rotrBL(n,o,34)^pe.rotrBL(n,o,39),$e=n&s^n&u^s&u,gt=o&c^o&p^c&p;P=_|0,$=I|0,_=T|0,I=z|0,T=x|0,z=C|0,{h:x,l:C}=pe.add(y|0,h|0,Re|0,Ae|0),y=u|0,h=p|0,u=s|0,p=c|0,s=n|0,c=o|0;let k=pe.add3L(Ae,He,gt);n=pe.add3H(k,Re,he,$e),o=k|0}({h:n,l:o}=pe.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:c}=pe.add(this.Bh|0,this.Bl|0,s|0,c|0),{h:u,l:p}=pe.add(this.Ch|0,this.Cl|0,u|0,p|0),{h:y,l:h}=pe.add(this.Dh|0,this.Dl|0,y|0,h|0),{h:x,l:C}=pe.add(this.Eh|0,this.El|0,x|0,C|0),{h:T,l:z}=pe.add(this.Fh|0,this.Fl|0,T|0,z|0),{h:_,l:I}=pe.add(this.Gh|0,this.Gl|0,_|0,I|0),{h:P,l:$}=pe.add(this.Hh|0,this.Hl|0,P|0,$|0),this.set(n,o,s,c,u,p,y,h,x,C,T,z,_,I,P,$)}roundClean(){Ur.fill(0),Br.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 Yr=_r(()=>new qs);function Vl(r,t,e,n){oi(r);let o=vc({dkLen:32,asyncTick:10},n),{c:s,dkLen:c,asyncTick:u}=o;if(rr(s),rr(c),rr(u),s<1)throw new Error("PBKDF2: iterations (c) should be >= 1");let p=zt(t),y=zt(e),h=new Uint8Array(c),x=Qt.create(r,p),C=x._cloneInto().update(y);return{c:s,dkLen:c,asyncTick:u,DK:h,PRF:x,PRFSalt:C}}function Ql(r,t,e,n,o){return r.destroy(),t.destroy(),n&&n.destroy(),o.fill(0),e}function Gc(r,t,e,n){let{c:o,dkLen:s,DK:c,PRF:u,PRFSalt:p}=Vl(r,t,e,n),y,h=new Uint8Array(4),x=Vt(h),C=new Uint8Array(u.outputLen);for(let T=1,z=0;z<s;T++,z+=u.outputLen){let _=c.subarray(z,z+u.outputLen);x.setInt32(0,T,!1),(y=p._cloneInto(y)).update(h).digestInto(C),_.set(C.subarray(0,_.length));for(let I=1;I<o;I++){u._cloneInto(y).update(C).digestInto(C);for(let P=0;P<_.length;P++)_[P]^=C[P]}}return Ql(u,p,c,y,C)}var jl=(r,t,e)=>r&t^~r&e,Wl=(r,t,e)=>r&t^r&e^t&e,Yl=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]),Rr=new Uint32Array(64),Ls=class extends Cr{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:n,D:o,E:s,F:c,G:u,H:p}=this;return[t,e,n,o,s,c,u,p]}set(t,e,n,o,s,c,u,p){this.A=t|0,this.B=e|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=c|0,this.G=u|0,this.H=p|0}process(t,e){for(let x=0;x<16;x++,e+=4)Rr[x]=t.getUint32(e,!1);for(let x=16;x<64;x++){let C=Rr[x-15],T=Rr[x-2],z=Nt(C,7)^Nt(C,18)^C>>>3,_=Nt(T,17)^Nt(T,19)^T>>>10;Rr[x]=_+Rr[x-7]+z+Rr[x-16]|0}let{A:n,B:o,C:s,D:c,E:u,F:p,G:y,H:h}=this;for(let x=0;x<64;x++){let C=Nt(u,6)^Nt(u,11)^Nt(u,25),T=h+C+jl(u,p,y)+Yl[x]+Rr[x]|0,_=(Nt(n,2)^Nt(n,13)^Nt(n,22))+Wl(n,o,s)|0;h=y,y=p,p=u,u=c+T|0,c=s,s=o,o=n,n=T+_|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,c=c+this.D|0,u=u+this.E|0,p=p+this.F|0,y=y+this.G|0,h=h+this.H|0,this.set(n,o,s,c,u,p,y,h)}roundClean(){Rr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var po=_r(()=>new Ls);function fi(r){if(!Number.isSafeInteger(r))throw new Error(`Wrong integer: ${r}`)}function Lc(...r){let t=(o,s)=>c=>o(s(c)),e=Array.from(r).reverse().reduce((o,s)=>o?t(o,s.encode):s.encode,void 0),n=r.reduce((o,s)=>o?t(o,s.decode):s.decode,void 0);return{encode:e,decode:n}}function Xl(r){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>=r.length)throw new Error(`Digit index outside alphabet: ${e} (alphabet: ${r.length})`);return r[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 n=r.indexOf(e);if(n===-1)throw new Error(`Unknown letter: "${e}". Allowed: ${r}`);return n})}}}function Zl(r=""){if(typeof r!="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(r)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(r)}}}function qc(r,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(r))throw new Error("convertRadix: data should be array");if(!r.length)return[];let n=0,o=[],s=Array.from(r);for(s.forEach(c=>{if(c<0||c>=t)throw new Error(`Wrong integer: ${c}`)});;){let c=0,u=!0;for(let p=n;p<s.length;p++){let y=s[p],h=t*c+y;if(!Number.isSafeInteger(h)||t*c/t!==c||h-y!==t*c)throw new Error("convertRadix: carry overflow");c=h%e;let x=Math.floor(h/e);if(s[p]=x,!Number.isSafeInteger(x)||x*e+c!==h)throw new Error("convertRadix: carry overflow");if(u)x?u=!1:n=p;else continue}if(o.push(c),u)break}for(let c=0;c<r.length-1&&r[c]===0;c++)o.push(0);return o.reverse()}function Jl(r){return{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return qc(Array.from(t),2**8,r)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(qc(t,r,2**8))}}}function ep(r,t){if(typeof t!="function")throw new Error("checksum fn should be function");return{encode(e){if(!(e instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");let n=t(e).slice(0,r),o=new Uint8Array(e.length+r);return o.set(e),o.set(n,e.length),o},decode(e){if(!(e instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");let n=e.slice(0,-r),o=t(n).slice(0,r),s=e.slice(-r);for(let c=0;c<r;c++)if(o[c]!==s[c])throw new Error("Invalid checksum");return n}}}var tp=r=>Lc(Jl(58),Xl(r),Zl("")),rp=tp("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var Fc=r=>Lc(ep(4,t=>r(r(t))),rp);function Kc(r){if(typeof r!="string")throw new TypeError(`Invalid mnemonic type: ${typeof r}`);return r.normalize("NFKD")}function np(r){let t=Kc(r),e=t.split(" ");if(![12,15,18,21,24].includes(e.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:e}}var op=r=>Kc(`mnemonic${r}`);function Hc(r,t=""){return Gc(Yr,np(r).nfkd,op(t),{c:2048,dkLen:64})}var $c=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Vc=/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,Qc=(t=>(t.ED25519="ed25519 seed",t))(Qc||{}),Fs=2147483648;function Ks(r){return Vc.test(r)}function Hs(r){return $c.test(r)}var di=(r,t)=>{let e=Qt.create(Yr,r).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},$s=({key:r,chainCode:t},e)=>{let n=new ArrayBuffer(4);new DataView(n).setUint32(0,e);let o=new Uint8Array(n),s=new Uint8Array([0]),c=new Uint8Array([...s,...r,...o]);return di(t,c)},sp=r=>r.replace("'",""),Vs=r=>r.split("/").slice(1).map(sp),go=r=>{let t=r.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return Hc(t)};var Xr=class Xr extends Tt{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==Xr.LENGTH)throw new Error(`PublicKey length should be ${Xr.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:n,signature:o}=e,s=me.fromHexInput(n).toUint8Array(),c=o.toUint8Array();return yo.default.sign.detached.verify(s,c,this.key.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new Xr(n)}static load(e){let n=e.deserializeBytes();return new Xr(n)}};Xr.LENGTH=32;var Pe=Xr,mt=class mt extends Wr{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==mt.LENGTH)throw new Error(`PrivateKey length should be ${mt.LENGTH}`);this.signingKeyPair=yo.default.sign.keyPair.fromSeed(n.toUint8Array().slice(0,mt.LENGTH))}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,mt.LENGTH)}toString(){return me.fromHexInput(this.toUint8Array()).toString()}sign(e){let n=me.fromHexInput(e),o=yo.default.sign.detached(n.toUint8Array(),this.signingKeyPair.secretKey);return new Le(o)}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new mt(n)}static generate(){let e=yo.default.sign.keyPair();return new mt(e.secretKey.slice(0,mt.LENGTH))}publicKey(){let e=this.signingKeyPair.publicKey;return new Pe(e)}static fromDerivationPath(e,n){if(!Hs(e))throw new Error(`Invalid derivation path ${e}`);return mt.fromDerivationPathInner(e,go(n))}static fromDerivationPathInner(e,n,o=Fs){let{key:s,chainCode:c}=di(mt.SLIP_0010_SEED,n),u=Vs(e).map(y=>parseInt(y,10)),{key:p}=u.reduce((y,h)=>$s(y,h+o),{key:s,chainCode:c});return new mt(p)}};mt.LENGTH=32,mt.SLIP_0010_SEED="ed25519 seed";var or=mt,Zr=class Zr extends Gt{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==Zr.LENGTH)throw new Error(`Signature length should be ${Zr.LENGTH}`);this.data=n}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new Zr(n)}static load(e){let n=e.deserializeBytes();return new Zr(n)}};Zr.LENGTH=64;var Le=Zr;var Rt=class Rt extends Tt{constructor(e){super();let{publicKeys:n,threshold:o}=e;if(n.length>Rt.MAX_KEYS||n.length<Rt.MIN_KEYS)throw new Error(`Must have between ${Rt.MIN_KEYS} and ${Rt.MAX_KEYS} public keys, inclusive`);if(o<Rt.MIN_THRESHOLD||o>n.length)throw new Error(`Threshold must be between ${Rt.MIN_THRESHOLD} and ${n.length}, inclusive`);this.publicKeys=n,this.threshold=o}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*Pe.LENGTH+1);return this.publicKeys.forEach((n,o)=>{e.set(n.toUint8Array(),o*Pe.LENGTH)}),e[this.publicKeys.length*Pe.LENGTH]=this.threshold,e}toString(){return me.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("TODO - Method not implemented.")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes(),o=n[n.length-1],s=[];for(let c=0;c<n.length-1;c+=Pe.LENGTH){let u=c;s.push(new Pe(n.subarray(u,u+Pe.LENGTH)))}return new Rt({publicKeys:s,threshold:o})}};Rt.MAX_KEYS=32,Rt.MIN_KEYS=2,Rt.MIN_THRESHOLD=1;var qt=Rt,Pt=class Pt extends Gt{constructor(e){super();let{signatures:n,bitmap:o}=e;if(o.length!==Pt.BITMAP_LEN)throw new Error(`"bitmap" length should be ${Pt.BITMAP_LEN}`);if(n.length>Pt.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${Pt.MAX_SIGNATURES_SUPPORTED}`);this.signatures=n,this.bitmap=o}toUint8Array(){let e=new Uint8Array(this.signatures.length*Le.LENGTH+Pt.BITMAP_LEN);return this.signatures.forEach((n,o)=>{e.set(n.toUint8Array(),o*Le.LENGTH)}),e.set(this.bitmap,this.signatures.length*Le.LENGTH),e}toString(){return me.fromHexInput(this.toUint8Array()).toString()}static createBitmap(e){let{bits:n}=e,o=128,s=new Uint8Array([0,0,0,0]),c=new Set;return n.forEach(u=>{if(u>=Pt.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${Pt.MAX_SIGNATURES_SUPPORTED-1}.`);if(c.has(u))throw new Error("Duplicate bits detected.");c.add(u);let p=Math.floor(u/8),y=s[p];y|=o>>u%8,s[p]=y}),s}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes(),o=n.subarray(n.length-4),s=[];for(let c=0;c<n.length-o.length;c+=Le.LENGTH){let u=c;s.push(new Le(n.subarray(u,u+Le.LENGTH)))}return new Pt({signatures:s,bitmap:o})}};Pt.MAX_SIGNATURES_SUPPORTED=32,Pt.BITMAP_LEN=4;var Jr=Pt;var Ys={};lc(Ys,{bitGet:()=>pp,bitLen:()=>lp,bitMask:()=>ho,bitSet:()=>gp,bytesToHex:()=>en,bytesToNumberBE:()=>ir,bytesToNumberLE:()=>gi,concatBytes:()=>zn,createHmacDrbg:()=>Ws,ensureBytes:()=>_t,equalBytes:()=>fp,hexToBytes:()=>tn,hexToNumber:()=>js,numberToBytesBE:()=>Pr,numberToBytesLE:()=>yi,numberToHexUnpadded:()=>Yc,numberToVarBytesBE:()=>up,utf8ToBytes:()=>dp,validateObject:()=>Or});var Wc=BigInt(0),li=BigInt(1),ap=BigInt(2),pi=r=>r instanceof Uint8Array,cp=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function en(r){if(!pi(r))throw new Error("Uint8Array expected");let t="";for(let e=0;e<r.length;e++)t+=cp[r[e]];return t}function Yc(r){let t=r.toString(16);return t.length&1?`0${t}`:t}function js(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}function tn(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.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 n=0;n<e.length;n++){let o=n*2,s=r.slice(o,o+2),c=Number.parseInt(s,16);if(Number.isNaN(c)||c<0)throw new Error("Invalid byte sequence");e[n]=c}return e}function ir(r){return js(en(r))}function gi(r){if(!pi(r))throw new Error("Uint8Array expected");return js(en(Uint8Array.from(r).reverse()))}function Pr(r,t){return tn(r.toString(16).padStart(t*2,"0"))}function yi(r,t){return Pr(r,t).reverse()}function up(r){return tn(Yc(r))}function _t(r,t,e){let n;if(typeof t=="string")try{n=tn(t)}catch(s){throw new Error(`${r} must be valid hex string, got "${t}". Cause: ${s}`)}else if(pi(t))n=Uint8Array.from(t);else throw new Error(`${r} must be hex string or Uint8Array`);let o=n.length;if(typeof e=="number"&&o!==e)throw new Error(`${r} expected ${e} bytes, got ${o}`);return n}function zn(...r){let t=new Uint8Array(r.reduce((n,o)=>n+o.length,0)),e=0;return r.forEach(n=>{if(!pi(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}function fp(r,t){if(r.length!==t.length)return!1;for(let e=0;e<r.length;e++)if(r[e]!==t[e])return!1;return!0}function dp(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function lp(r){let t;for(t=0;r>Wc;r>>=li,t+=1);return t}function pp(r,t){return r>>BigInt(t)&li}var gp=(r,t,e)=>r|(e?li:Wc)<<BigInt(t),ho=r=>(ap<<BigInt(r-1))-li,Qs=r=>new Uint8Array(r),jc=r=>Uint8Array.from(r);function Ws(r,t,e){if(typeof r!="number"||r<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 n=Qs(r),o=Qs(r),s=0,c=()=>{n.fill(1),o.fill(0),s=0},u=(...x)=>e(o,n,...x),p=(x=Qs())=>{o=u(jc([0]),x),n=u(),x.length!==0&&(o=u(jc([1]),x),n=u())},y=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let x=0,C=[];for(;x<t;){n=u();let T=n.slice();C.push(T),x+=n.length}return zn(...C)};return(x,C)=>{c(),p(x);let T;for(;!(T=C(y()));)p();return c(),T}}var yp={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||r instanceof Uint8Array,isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function Or(r,t,e={}){let n=(o,s,c)=>{let u=yp[s];if(typeof u!="function")throw new Error(`Invalid validator "${s}", expected function`);let p=r[o];if(!(c&&p===void 0)&&!u(p,r))throw new Error(`Invalid param ${String(o)}=${p} (${typeof p}), expected ${s}`)};for(let[o,s]of Object.entries(t))n(o,s,!1);for(let[o,s]of Object.entries(e))n(o,s,!0);return r}var et=BigInt(0),Fe=BigInt(1),rn=BigInt(2),hp=BigInt(3),Xs=BigInt(4),Xc=BigInt(5),Zc=BigInt(8),mp=BigInt(9),xp=BigInt(16);function tt(r,t){let e=r%t;return e>=et?e:t+e}function Ap(r,t,e){if(e<=et||t<et)throw new Error("Expected power/modulo > 0");if(e===Fe)return et;let n=Fe;for(;t>et;)t&Fe&&(n=n*r%e),r=r*r%e,t>>=Fe;return n}function vt(r,t,e){let n=r;for(;t-- >et;)n*=n,n%=e;return n}function hi(r,t){if(r===et||t<=et)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=tt(r,t),n=t,o=et,s=Fe,c=Fe,u=et;for(;e!==et;){let y=n/e,h=n%e,x=o-c*y,C=s-u*y;n=e,e=h,o=c,s=u,c=x,u=C}if(n!==Fe)throw new Error("invert: does not exist");return tt(o,t)}function bp(r){let t=(r-Fe)/rn,e,n,o;for(e=r-Fe,n=0;e%rn===et;e/=rn,n++);for(o=rn;o<r&&Ap(o,t,r)!==r-Fe;o++);if(n===1){let c=(r+Fe)/Xs;return function(p,y){let h=p.pow(y,c);if(!p.eql(p.sqr(h),y))throw new Error("Cannot find square root");return h}}let s=(e+Fe)/rn;return function(u,p){if(u.pow(p,t)===u.neg(u.ONE))throw new Error("Cannot find square root");let y=n,h=u.pow(u.mul(u.ONE,o),e),x=u.pow(p,s),C=u.pow(p,e);for(;!u.eql(C,u.ONE);){if(u.eql(C,u.ZERO))return u.ZERO;let T=1;for(let _=u.sqr(C);T<y&&!u.eql(_,u.ONE);T++)_=u.sqr(_);let z=u.pow(h,Fe<<BigInt(y-T-1));h=u.sqr(z),x=u.mul(x,z),C=u.mul(C,h),y=T}return x}}function wp(r){if(r%Xs===hp){let t=(r+Fe)/Xs;return function(n,o){let s=n.pow(o,t);if(!n.eql(n.sqr(s),o))throw new Error("Cannot find square root");return s}}if(r%Zc===Xc){let t=(r-Xc)/Zc;return function(n,o){let s=n.mul(o,rn),c=n.pow(s,t),u=n.mul(o,c),p=n.mul(n.mul(u,rn),c),y=n.mul(u,n.sub(p,n.ONE));if(!n.eql(n.sqr(y),o))throw new Error("Cannot find square root");return y}}return r%xp,bp(r)}var Tp=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Zs(r){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=Tp.reduce((n,o)=>(n[o]="function",n),t);return Or(r,e)}function _p(r,t,e){if(e<et)throw new Error("Expected power > 0");if(e===et)return r.ONE;if(e===Fe)return t;let n=r.ONE,o=t;for(;e>et;)e&Fe&&(n=r.mul(n,o)),o=r.sqr(o),e>>=Fe;return n}function vp(r,t){let e=new Array(t.length),n=t.reduce((s,c,u)=>r.is0(c)?s:(e[u]=s,r.mul(s,c)),r.ONE),o=r.inv(n);return t.reduceRight((s,c,u)=>r.is0(c)?s:(e[u]=r.mul(s,e[u]),r.mul(s,c)),o),e}function Js(r,t){let e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function Jc(r,t,e=!1,n={}){if(r<=et)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:o,nByteLength:s}=Js(r,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let c=wp(r),u=Object.freeze({ORDER:r,BITS:o,BYTES:s,MASK:ho(o),ZERO:et,ONE:Fe,create:p=>tt(p,r),isValid:p=>{if(typeof p!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof p}`);return et<=p&&p<r},is0:p=>p===et,isOdd:p=>(p&Fe)===Fe,neg:p=>tt(-p,r),eql:(p,y)=>p===y,sqr:p=>tt(p*p,r),add:(p,y)=>tt(p+y,r),sub:(p,y)=>tt(p-y,r),mul:(p,y)=>tt(p*y,r),pow:(p,y)=>_p(u,p,y),div:(p,y)=>tt(p*hi(y,r),r),sqrN:p=>p*p,addN:(p,y)=>p+y,subN:(p,y)=>p-y,mulN:(p,y)=>p*y,inv:p=>hi(p,r),sqrt:n.sqrt||(p=>c(u,p)),invertBatch:p=>vp(u,p),cmov:(p,y,h)=>h?y:p,toBytes:p=>e?yi(p,s):Pr(p,s),fromBytes:p=>{if(p.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${p.length}`);return e?gi(p):ir(p)}});return Object.freeze(u)}function eu(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let t=r.toString(2).length;return Math.ceil(t/8)}function ea(r){let t=eu(r);return t+Math.ceil(t/2)}function tu(r,t,e=!1){let n=r.length,o=eu(t),s=ea(t);if(n<16||n<s||n>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);let c=e?ir(r):gi(r),u=tt(c,t-Fe)+Fe;return e?yi(u,o):Pr(u,o)}var Ep=BigInt(0),ta=BigInt(1);function ru(r,t){let e=(o,s)=>{let c=s.negate();return o?c:s},n=o=>{let s=Math.ceil(t/o)+1,c=2**(o-1);return{windows:s,windowSize:c}};return{constTimeNegate:e,unsafeLadder(o,s){let c=r.ZERO,u=o;for(;s>Ep;)s&ta&&(c=c.add(u)),u=u.double(),s>>=ta;return c},precomputeWindow(o,s){let{windows:c,windowSize:u}=n(s),p=[],y=o,h=y;for(let x=0;x<c;x++){h=y,p.push(h);for(let C=1;C<u;C++)h=h.add(y),p.push(h);y=h.double()}return p},wNAF(o,s,c){let{windows:u,windowSize:p}=n(o),y=r.ZERO,h=r.BASE,x=BigInt(2**o-1),C=2**o,T=BigInt(o);for(let z=0;z<u;z++){let _=z*p,I=Number(c&x);c>>=T,I>p&&(I-=C,c+=ta);let P=_,$=_+Math.abs(I)-1,N=z%2!==0,ee=I<0;I===0?h=h.add(e(N,s[P])):y=y.add(e(ee,s[$]))}return{p:y,f:h}},wNAFCached(o,s,c,u){let p=o._WINDOW_SIZE||1,y=s.get(o);return y||(y=this.precomputeWindow(o,p),p!==1&&s.set(o,u(y))),this.wNAF(p,y,c)}}}function ra(r){return Zs(r.Fp),Or(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Js(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}function Cp(r){let t=ra(r);Or(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:n,a:o}=t;if(e){if(!n.eql(o,n.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:Up,hexToBytes:Bp}=Ys,nn={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(r){let{Err:t}=nn;if(r.length<2||r[0]!==2)throw new t("Invalid signature integer tag");let e=r[1],n=r.subarray(2,e+2);if(!e||n.length!==e)throw new t("Invalid signature integer: wrong length");if(n[0]&128)throw new t("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:Up(n),l:r.subarray(e+2)}},toSig(r){let{Err:t}=nn,e=typeof r=="string"?Bp(r):r;if(!(e instanceof Uint8Array))throw new Error("ui8a expected");let n=e.length;if(n<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==n-2)throw new t("Invalid signature: incorrect length");let{d:o,l:s}=nn._parseInt(e.subarray(2)),{d:c,l:u}=nn._parseInt(s);if(u.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s:c}},hexFromSig(r){let t=y=>Number.parseInt(y[0],16)&8?"00"+y:y,e=y=>{let h=y.toString(16);return h.length&1?`0${h}`:h},n=t(e(r.s)),o=t(e(r.r)),s=n.length/2,c=o.length/2,u=e(s),p=e(c);return`30${e(c+s+4)}02${p}${o}02${u}${n}`}},sr=BigInt(0),Ot=BigInt(1),Wm=BigInt(2),nu=BigInt(3),Ym=BigInt(4);function Ip(r){let t=Cp(r),{Fp:e}=t,n=t.toBytes||((z,_,I)=>{let P=_.toAffine();return zn(Uint8Array.from([4]),e.toBytes(P.x),e.toBytes(P.y))}),o=t.fromBytes||(z=>{let _=z.subarray(1),I=e.fromBytes(_.subarray(0,e.BYTES)),P=e.fromBytes(_.subarray(e.BYTES,2*e.BYTES));return{x:I,y:P}});function s(z){let{a:_,b:I}=t,P=e.sqr(z),$=e.mul(P,z);return e.add(e.add($,e.mul(z,_)),I)}if(!e.eql(e.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function c(z){return typeof z=="bigint"&&sr<z&&z<t.n}function u(z){if(!c(z))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function p(z){let{allowedPrivateKeyLengths:_,nByteLength:I,wrapPrivateKey:P,n:$}=t;if(_&&typeof z!="bigint"){if(z instanceof Uint8Array&&(z=en(z)),typeof z!="string"||!_.includes(z.length))throw new Error("Invalid key");z=z.padStart(I*2,"0")}let N;try{N=typeof z=="bigint"?z:ir(_t("private key",z,I))}catch{throw new Error(`private key must be ${I} bytes, hex or bigint, not ${typeof z}`)}return P&&(N=tt(N,$)),u(N),N}let y=new Map;function h(z){if(!(z instanceof x))throw new Error("ProjectivePoint expected")}class x{constructor(_,I,P){if(this.px=_,this.py=I,this.pz=P,_==null||!e.isValid(_))throw new Error("x required");if(I==null||!e.isValid(I))throw new Error("y required");if(P==null||!e.isValid(P))throw new Error("z required")}static fromAffine(_){let{x:I,y:P}=_||{};if(!_||!e.isValid(I)||!e.isValid(P))throw new Error("invalid affine point");if(_ instanceof x)throw new Error("projective point not allowed");let $=N=>e.eql(N,e.ZERO);return $(I)&&$(P)?x.ZERO:new x(I,P,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(_){let I=e.invertBatch(_.map(P=>P.pz));return _.map((P,$)=>P.toAffine(I[$])).map(x.fromAffine)}static fromHex(_){let I=x.fromAffine(o(_t("pointHex",_)));return I.assertValidity(),I}static fromPrivateKey(_){return x.BASE.multiply(p(_))}_setWindowSize(_){this._WINDOW_SIZE=_,y.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:_,y:I}=this.toAffine();if(!e.isValid(_)||!e.isValid(I))throw new Error("bad point: x or y not FE");let P=e.sqr(I),$=s(_);if(!e.eql(P,$))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(_);throw new Error("Field doesn't support isOdd")}equals(_){h(_);let{px:I,py:P,pz:$}=this,{px:N,py:ee,pz:L}=_,j=e.eql(e.mul(I,L),e.mul(N,$)),J=e.eql(e.mul(P,L),e.mul(ee,$));return j&&J}negate(){return new x(this.px,e.neg(this.py),this.pz)}double(){let{a:_,b:I}=t,P=e.mul(I,nu),{px:$,py:N,pz:ee}=this,L=e.ZERO,j=e.ZERO,J=e.ZERO,X=e.mul($,$),Re=e.mul(N,N),Ae=e.mul(ee,ee),he=e.mul($,N);return he=e.add(he,he),J=e.mul($,ee),J=e.add(J,J),L=e.mul(_,J),j=e.mul(P,Ae),j=e.add(L,j),L=e.sub(Re,j),j=e.add(Re,j),j=e.mul(L,j),L=e.mul(he,L),J=e.mul(P,J),Ae=e.mul(_,Ae),he=e.sub(X,Ae),he=e.mul(_,he),he=e.add(he,J),J=e.add(X,X),X=e.add(J,X),X=e.add(X,Ae),X=e.mul(X,he),j=e.add(j,X),Ae=e.mul(N,ee),Ae=e.add(Ae,Ae),X=e.mul(Ae,he),L=e.sub(L,X),J=e.mul(Ae,Re),J=e.add(J,J),J=e.add(J,J),new x(L,j,J)}add(_){h(_);let{px:I,py:P,pz:$}=this,{px:N,py:ee,pz:L}=_,j=e.ZERO,J=e.ZERO,X=e.ZERO,Re=t.a,Ae=e.mul(t.b,nu),he=e.mul(I,N),He=e.mul(P,ee),$e=e.mul($,L),gt=e.add(I,P),k=e.add(N,ee);gt=e.mul(gt,k),k=e.add(he,He),gt=e.sub(gt,k),k=e.add(I,$);let K=e.add(N,L);return k=e.mul(k,K),K=e.add(he,$e),k=e.sub(k,K),K=e.add(P,$),j=e.add(ee,L),K=e.mul(K,j),j=e.add(He,$e),K=e.sub(K,j),X=e.mul(Re,k),j=e.mul(Ae,$e),X=e.add(j,X),j=e.sub(He,X),X=e.add(He,X),J=e.mul(j,X),He=e.add(he,he),He=e.add(He,he),$e=e.mul(Re,$e),k=e.mul(Ae,k),He=e.add(He,$e),$e=e.sub(he,$e),$e=e.mul(Re,$e),k=e.add(k,$e),he=e.mul(He,k),J=e.add(J,he),he=e.mul(K,k),j=e.mul(gt,j),j=e.sub(j,he),he=e.mul(gt,He),X=e.mul(K,X),X=e.add(X,he),new x(j,J,X)}subtract(_){return this.add(_.negate())}is0(){return this.equals(x.ZERO)}wNAF(_){return T.wNAFCached(this,y,_,I=>{let P=e.invertBatch(I.map($=>$.pz));return I.map(($,N)=>$.toAffine(P[N])).map(x.fromAffine)})}multiplyUnsafe(_){let I=x.ZERO;if(_===sr)return I;if(u(_),_===Ot)return this;let{endo:P}=t;if(!P)return T.unsafeLadder(this,_);let{k1neg:$,k1:N,k2neg:ee,k2:L}=P.splitScalar(_),j=I,J=I,X=this;for(;N>sr||L>sr;)N&Ot&&(j=j.add(X)),L&Ot&&(J=J.add(X)),X=X.double(),N>>=Ot,L>>=Ot;return $&&(j=j.negate()),ee&&(J=J.negate()),J=new x(e.mul(J.px,P.beta),J.py,J.pz),j.add(J)}multiply(_){u(_);let I=_,P,$,{endo:N}=t;if(N){let{k1neg:ee,k1:L,k2neg:j,k2:J}=N.splitScalar(I),{p:X,f:Re}=this.wNAF(L),{p:Ae,f:he}=this.wNAF(J);X=T.constTimeNegate(ee,X),Ae=T.constTimeNegate(j,Ae),Ae=new x(e.mul(Ae.px,N.beta),Ae.py,Ae.pz),P=X.add(Ae),$=Re.add(he)}else{let{p:ee,f:L}=this.wNAF(I);P=ee,$=L}return x.normalizeZ([P,$])[0]}multiplyAndAddUnsafe(_,I,P){let $=x.BASE,N=(L,j)=>j===sr||j===Ot||!L.equals($)?L.multiplyUnsafe(j):L.multiply(j),ee=N(this,I).add(N(_,P));return ee.is0()?void 0:ee}toAffine(_){let{px:I,py:P,pz:$}=this,N=this.is0();_==null&&(_=N?e.ONE:e.inv($));let ee=e.mul(I,_),L=e.mul(P,_),j=e.mul($,_);if(N)return{x:e.ZERO,y:e.ZERO};if(!e.eql(j,e.ONE))throw new Error("invZ was invalid");return{x:ee,y:L}}isTorsionFree(){let{h:_,isTorsionFree:I}=t;if(_===Ot)return!0;if(I)return I(x,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:_,clearCofactor:I}=t;return _===Ot?this:I?I(x,this):this.multiplyUnsafe(t.h)}toRawBytes(_=!0){return this.assertValidity(),n(x,this,_)}toHex(_=!0){return en(this.toRawBytes(_))}}x.BASE=new x(t.Gx,t.Gy,e.ONE),x.ZERO=new x(e.ZERO,e.ONE,e.ZERO);let C=t.nBitLength,T=ru(x,t.endo?Math.ceil(C/2):C);return{CURVE:t,ProjectivePoint:x,normPrivateKeyToScalar:p,weierstrassEquation:s,isWithinCurveOrder:c}}function Rp(r){let t=ra(r);return Or(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function ou(r){let t=Rp(r),{Fp:e,n}=t,o=e.BYTES+1,s=2*e.BYTES+1;function c(k){return sr<k&&k<e.ORDER}function u(k){return tt(k,n)}function p(k){return hi(k,n)}let{ProjectivePoint:y,normPrivateKeyToScalar:h,weierstrassEquation:x,isWithinCurveOrder:C}=Ip({...t,toBytes(k,K,se){let Ee=K.toAffine(),Ce=e.toBytes(Ee.x),Ve=zn;return se?Ve(Uint8Array.from([K.hasEvenY()?2:3]),Ce):Ve(Uint8Array.from([4]),Ce,e.toBytes(Ee.y))},fromBytes(k){let K=k.length,se=k[0],Ee=k.subarray(1);if(K===o&&(se===2||se===3)){let Ce=ir(Ee);if(!c(Ce))throw new Error("Point is not on curve");let Ve=x(Ce),it=e.sqrt(Ve),Oe=(it&Ot)===Ot;return(se&1)===1!==Oe&&(it=e.neg(it)),{x:Ce,y:it}}else if(K===s&&se===4){let Ce=e.fromBytes(Ee.subarray(0,e.BYTES)),Ve=e.fromBytes(Ee.subarray(e.BYTES,2*e.BYTES));return{x:Ce,y:Ve}}else throw new Error(`Point of length ${K} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`)}}),T=k=>en(Pr(k,t.nByteLength));function z(k){let K=n>>Ot;return k>K}function _(k){return z(k)?u(-k):k}let I=(k,K,se)=>ir(k.slice(K,se));class P{constructor(K,se,Ee){this.r=K,this.s=se,this.recovery=Ee,this.assertValidity()}static fromCompact(K){let se=t.nByteLength;return K=_t("compactSignature",K,se*2),new P(I(K,0,se),I(K,se,2*se))}static fromDER(K){let{r:se,s:Ee}=nn.toSig(_t("DER",K));return new P(se,Ee)}assertValidity(){if(!C(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!C(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(K){return new P(this.r,this.s,K)}recoverPublicKey(K){let{r:se,s:Ee,recovery:Ce}=this,Ve=J(_t("msgHash",K));if(Ce==null||![0,1,2,3].includes(Ce))throw new Error("recovery id invalid");let it=Ce===2||Ce===3?se+t.n:se;if(it>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let Oe=Ce&1?"03":"02",We=y.fromHex(Oe+T(it)),ae=p(it),Ze=u(-Ve*ae),Ar=u(Ee*ae),kt=y.BASE.multiplyAndAddUnsafe(We,Ze,Ar);if(!kt)throw new Error("point at infinify");return kt.assertValidity(),kt}hasHighS(){return z(this.s)}normalizeS(){return this.hasHighS()?new P(this.r,u(-this.s),this.recovery):this}toDERRawBytes(){return tn(this.toDERHex())}toDERHex(){return nn.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return tn(this.toCompactHex())}toCompactHex(){return T(this.r)+T(this.s)}}let $={isValidPrivateKey(k){try{return h(k),!0}catch{return!1}},normPrivateKeyToScalar:h,randomPrivateKey:()=>{let k=ea(t.n);return tu(t.randomBytes(k),t.n)},precompute(k=8,K=y.BASE){return K._setWindowSize(k),K.multiply(BigInt(3)),K}};function N(k,K=!0){return y.fromPrivateKey(k).toRawBytes(K)}function ee(k){let K=k instanceof Uint8Array,se=typeof k=="string",Ee=(K||se)&&k.length;return K?Ee===o||Ee===s:se?Ee===2*o||Ee===2*s:k instanceof y}function L(k,K,se=!0){if(ee(k))throw new Error("first arg must be private key");if(!ee(K))throw new Error("second arg must be public key");return y.fromHex(K).multiply(h(k)).toRawBytes(se)}let j=t.bits2int||function(k){let K=ir(k),se=k.length*8-t.nBitLength;return se>0?K>>BigInt(se):K},J=t.bits2int_modN||function(k){return u(j(k))},X=ho(t.nBitLength);function Re(k){if(typeof k!="bigint")throw new Error("bigint expected");if(!(sr<=k&&k<X))throw new Error(`bigint expected < 2^${t.nBitLength}`);return Pr(k,t.nByteLength)}function Ae(k,K,se=he){if(["recovered","canonical"].some(Et=>Et in se))throw new Error("sign() legacy options not supported");let{hash:Ee,randomBytes:Ce}=t,{lowS:Ve,prehash:it,extraEntropy:Oe}=se;Ve==null&&(Ve=!0),k=_t("msgHash",k),it&&(k=_t("prehashed msgHash",Ee(k)));let We=J(k),ae=h(K),Ze=[Re(ae),Re(We)];if(Oe!=null){let Et=Oe===!0?Ce(e.BYTES):Oe;Ze.push(_t("extraEntropy",Et))}let Ar=zn(...Ze),kt=We;function br(Et){let Zt=j(Et);if(!C(Zt))return;let Gr=p(Zt),bt=y.BASE.multiply(Zt).toAffine(),wr=u(bt.x);if(wr===sr)return;let In=u(Gr*u(kt+wr*ae));if(In===sr)return;let Fo=(bt.x===wr?0:2)|Number(bt.y&Ot),Jn=In;return Ve&&z(In)&&(Jn=_(In),Fo^=1),new P(wr,Jn,Fo)}return{seed:Ar,k2sig:br}}let he={lowS:t.lowS,prehash:!1},He={lowS:t.lowS,prehash:!1};function $e(k,K,se=he){let{seed:Ee,k2sig:Ce}=Ae(k,K,se),Ve=t;return Ws(Ve.hash.outputLen,Ve.nByteLength,Ve.hmac)(Ee,Ce)}y.BASE._setWindowSize(8);function gt(k,K,se,Ee=He){let Ce=k;if(K=_t("msgHash",K),se=_t("publicKey",se),"strict"in Ee)throw new Error("options.strict was renamed to lowS");let{lowS:Ve,prehash:it}=Ee,Oe,We;try{if(typeof Ce=="string"||Ce instanceof Uint8Array)try{Oe=P.fromDER(Ce)}catch(bt){if(!(bt instanceof nn.Err))throw bt;Oe=P.fromCompact(Ce)}else if(typeof Ce=="object"&&typeof Ce.r=="bigint"&&typeof Ce.s=="bigint"){let{r:bt,s:wr}=Ce;Oe=new P(bt,wr)}else throw new Error("PARSE");We=y.fromHex(se)}catch(bt){if(bt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(Ve&&Oe.hasHighS())return!1;it&&(K=t.hash(K));let{r:ae,s:Ze}=Oe,Ar=J(K),kt=p(Ze),br=u(Ar*kt),Et=u(ae*kt),Zt=y.BASE.multiplyAndAddUnsafe(We,br,Et)?.toAffine();return Zt?u(Zt.x)===ae:!1}return{CURVE:t,getPublicKey:N,getSharedSecret:L,sign:$e,verify:gt,ProjectivePoint:y,Signature:P,utils:$}}function Pp(r){return{hash:r,hmac:(t,...e)=>Qt(r,t,$r(...e)),randomBytes:Ec}}function iu(r,t){let e=n=>ou({...r,...Pp(n)});return Object.freeze({...e(t),create:e})}var cu=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),su=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Op=BigInt(1),na=BigInt(2),au=(r,t)=>(r+t/na)/t;function kp(r){let t=cu,e=BigInt(3),n=BigInt(6),o=BigInt(11),s=BigInt(22),c=BigInt(23),u=BigInt(44),p=BigInt(88),y=r*r*r%t,h=y*y*r%t,x=vt(h,e,t)*h%t,C=vt(x,e,t)*h%t,T=vt(C,na,t)*y%t,z=vt(T,o,t)*T%t,_=vt(z,s,t)*z%t,I=vt(_,u,t)*_%t,P=vt(I,p,t)*I%t,$=vt(P,u,t)*_%t,N=vt($,e,t)*h%t,ee=vt(N,c,t)*z%t,L=vt(ee,n,t)*y%t,j=vt(L,na,t);if(!oa.eql(oa.sqr(j),r))throw new Error("Cannot find square root");return j}var oa=Jc(cu,void 0,void 0,{sqrt:kp}),dt=iu({a:BigInt(0),b:BigInt(7),Fp:oa,n:su,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{let t=su,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Op*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,c=BigInt("0x100000000000000000000000000000000"),u=au(s*r,t),p=au(-n*r,t),y=tt(r-u*e-p*o,t),h=tt(-u*n-p*s,t),x=y>c,C=h>c;if(x&&(y=t-y),C&&(h=t-h),y>c||h>c)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:x,k1:y,k2neg:C,k2:h}}}},po),i0=BigInt(0);var s0=dt.ProjectivePoint;var Np=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),fu=Uint8Array.from({length:16},(r,t)=>t),zp=fu.map(r=>(9*r+5)%16),sa=[fu],aa=[zp];for(let r=0;r<4;r++)for(let t of[sa,aa])t.push(t[r].map(e=>Np[e]));var du=[[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(r=>new Uint8Array(r)),Mp=sa.map((r,t)=>r.map(e=>du[t][e])),Dp=aa.map((r,t)=>r.map(e=>du[t][e])),Gp=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),qp=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),mi=(r,t)=>r<<t|r>>>32-t;function uu(r,t,e,n){return r===0?t^e^n:r===1?t&e|~t&n:r===2?(t|~e)^n:r===3?t&n|e&~n:t^(e|~n)}var xi=new Uint32Array(16),ia=class extends Cr{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:n,h3:o,h4:s}=this;return[t,e,n,o,s]}set(t,e,n,o,s){this.h0=t|0,this.h1=e|0,this.h2=n|0,this.h3=o|0,this.h4=s|0}process(t,e){for(let T=0;T<16;T++,e+=4)xi[T]=t.getUint32(e,!0);let n=this.h0|0,o=n,s=this.h1|0,c=s,u=this.h2|0,p=u,y=this.h3|0,h=y,x=this.h4|0,C=x;for(let T=0;T<5;T++){let z=4-T,_=Gp[T],I=qp[T],P=sa[T],$=aa[T],N=Mp[T],ee=Dp[T];for(let L=0;L<16;L++){let j=mi(n+uu(T,s,u,y)+xi[P[L]]+_,N[L])+x|0;n=x,x=y,y=mi(u,10)|0,u=s,s=j}for(let L=0;L<16;L++){let j=mi(o+uu(z,c,p,h)+xi[$[L]]+I,ee[L])+C|0;o=C,C=h,h=mi(p,10)|0,p=c,c=j}}this.set(this.h1+u+h|0,this.h2+y+C|0,this.h3+x+o|0,this.h4+n+c|0,this.h0+s+p|0)}roundClean(){xi.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}},lu=_r(()=>new ia);var Ai=dt.ProjectivePoint,ca=Fc(po);function pu(r){return BigInt(`0x${Hr(r)}`)}function Lp(r){return Nn(r.toString(16).padStart(64,"0"))}var Fp=Ps("Bitcoin seed"),ua={private:76066276,public:76067358},fa=2147483648,Kp=r=>lu(po(r)),Hp=r=>Vt(r).getUint32(0,!1),bi=r=>{if(!Number.isSafeInteger(r)||r<0||r>2**32-1)throw new Error(`Invalid number=${r}. Should be from 0 to 2 ** 32 - 1`);let t=new Uint8Array(4);return Vt(t).setUint32(0,r,!1),t},wi=class r{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return Hp(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 ca.encode(this.serialize(this.versions.private,$r(new Uint8Array([0]),t)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return ca.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(t,e=ua){if(Dt(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 n=Qt(Yr,Fp,t);return new r({versions:e,chainCode:n.slice(32),privateKey:n.slice(0,32)})}static fromExtendedKey(t,e=ua){let n=ca.decode(t),o=Vt(n),s=o.getUint32(0,!1),c={versions:e,depth:n[4],parentFingerprint:o.getUint32(5,!1),index:o.getUint32(9,!1),chainCode:n.slice(13,45)},u=n.slice(45),p=u[0]===0;if(s!==e[p?"private":"public"])throw new Error("Version mismatch");return p?new r({...c,privateKey:u.slice(1)}):new r({...c,publicKey:u})}static fromJSON(t){return r.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||ua,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(!dt.utils.isValidPrivateKey(t.privateKey))throw new Error("Invalid private key");this.privKey=typeof t.privateKey=="bigint"?t.privateKey:pu(t.privateKey),this.privKeyBytes=Lp(this.privKey),this.pubKey=dt.getPublicKey(t.privateKey,!0)}else if(t.publicKey)this.pubKey=Ai.fromHex(t.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=Kp(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("/"),n=this;for(let o of e){let s=/^(\d+)('?)$/.exec(o),c=s&&s[1];if(!s||s.length!==3||typeof c!="string")throw new Error(`Invalid child index: ${o}`);let u=+c;if(!Number.isSafeInteger(u)||u>=fa)throw new Error("Invalid index");s[2]==="'"&&(u+=fa),n=n.deriveChild(u)}return n}deriveChild(t){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let e=bi(t);if(t>=fa){let u=this.privateKey;if(!u)throw new Error("Could not derive hardened child key");e=$r(new Uint8Array([0]),u,e)}else e=$r(this.pubKey,e);let n=Qt(Yr,this.chainCode,e),o=pu(n.slice(0,32)),s=n.slice(32);if(!dt.utils.isValidPrivateKey(o))throw new Error("Tweak bigger than curve order");let c={versions:this.versions,chainCode:s,depth:this.depth+1,parentFingerprint:this.fingerprint,index:t};try{if(this.privateKey){let u=tt(this.privKey+o,dt.CURVE.n);if(!dt.utils.isValidPrivateKey(u))throw new Error("The tweak was out of range or the resulted private key is invalid");c.privateKey=u}else{let u=Ai.fromHex(this.pubKey).add(Ai.fromPrivateKey(o));if(u.equals(Ai.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");c.publicKey=u.toRawBytes(!0)}return new r(c)}catch{return this.deriveChild(t+1)}}sign(t){if(!this.privateKey)throw new Error("No privateKey set!");return Dt(t,32),dt.sign(t,this.privKey).toCompactRawBytes()}verify(t,e){if(Dt(t,32),Dt(e,64),!this.publicKey)throw new Error("No publicKey set!");let n;try{n=dt.Signature.fromCompact(e)}catch{return!1}return dt.verify(n,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 Dt(e,33),$r(bi(t),new Uint8Array([this.depth]),bi(this.parentFingerprint),bi(this.index),this.chainCode,e)}};var on=class on extends Tt{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==on.LENGTH)throw new Error(`PublicKey length should be ${on.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:n,signature:o}=e,s=me.fromHexInput(n).toUint8Array(),c=jr(s),u=o.toUint8Array();return dt.verify(u,c,this.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new on(n)}static load(e){let n=e.deserializeBytes();return new on(n)}};on.LENGTH=65;var Lt=on,ar=class ar extends Wr{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==ar.LENGTH)throw new Error(`PrivateKey length should be ${ar.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}sign(e){let n=me.fromHexInput(e),o=jr(n.toUint8Array()),s=dt.sign(o,this.key.toUint8Array());return new ur(s.toCompactRawBytes())}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new ar(n)}static generate(){let e=dt.utils.randomPrivateKey();return new ar(e)}publicKey(){let e=dt.getPublicKey(this.key.toUint8Array(),!1);return new Lt(e)}static fromDerivationPath(e,n){if(!Ks(e))throw new Error(`Invalid derivation path ${e}`);return ar.fromDerivationPathInner(e,go(n))}static fromDerivationPathInner(e,n){let{privateKey:o}=wi.fromMasterSeed(n).derive(e);if(o===null)throw new Error("Invalid key");return new ar(o)}};ar.LENGTH=32;var cr=ar,sn=class sn extends Gt{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==sn.LENGTH)throw new Error(`Signature length should be ${sn.LENGTH}, recieved ${n.toUint8Array().length}`);this.data=n}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new sn(n)}static load(e){let n=e.deserializeBytes();return new sn(n)}};sn.LENGTH=64;var ur=sn;var je=class r extends Tt{constructor(e){super();this.publicKey=e}toUint8Array(){return this.publicKey.toUint8Array()}toString(){return this.publicKey.toString()}verifySignature(e){let{message:n,signature:o}=e;return this.publicKey.verifySignature({message:n,signature:o})}serialize(e){if(this.publicKey instanceof Pe)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else if(this.publicKey instanceof Lt)e.serializeU32AsUleb128(1),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let n=e.deserializeUleb128AsU32();switch(n){case 0:return new r(Pe.load(e));case 1:return new r(Lt.load(e));default:throw new Error(`Unknown variant index for AnyPublicKey: ${n}`)}}};var an=class r extends Tt{constructor(e){super();let{publicKeys:n,signaturesRequired:o}=e;if(o<1)throw new Error("The number of required signatures needs to be greater then 0");if(n.length<o)throw new Error(`Provided ${n.length} public keys is smaller than the ${o} required signatures`);let s=[];n.forEach(c=>{c instanceof je?s.push(c):s.push(new je(c))}),this.publicKeys=s,this.signaturesRequired=o}toUint8Array(){return this.bcsToBytes()}createBitmap(e){let{bits:n}=e,o=128,s=new Uint8Array([0,0,0,0]),c=new Set;return n.forEach((u,p)=>{if(p+1>this.publicKeys.length)throw new Error(`Signature index ${p+1} is out of public keys range, ${this.publicKeys.length}.`);if(c.has(u))throw new Error(`Duplicate bit ${u} detected.`);c.add(u);let y=Math.floor(u/8),h=s[y];h|=o>>u%8,s[y]=h}),s}toString(){return me.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 n=e.deserializeVector(je),o=e.deserializeU8();return new r({publicKeys:n,signaturesRequired:o})}};var fr=class fr extends Z{constructor(e){super();let{data:n}=e,o=me.fromHexInput(n);if(o.toUint8Array().length!==fr.LENGTH)throw new Error(`Authentication Key length should be ${fr.LENGTH}`);this.data=o}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let n=e.deserializeFixedBytes(fr.LENGTH);return new fr({data:n})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromPublicKeyAndScheme(e){let{publicKey:n,scheme:o}=e,s;switch(o){case 3:case 2:{let p=n.bcsToBytes();s=new Uint8Array([...p,o]);break}case 0:case 1:{let p=n.toUint8Array(),y=me.fromHexInput(p).toUint8Array();s=new Uint8Array([...y,o]);break}default:throw new Error(`Scheme ${o} is not supported`)}let c=jr.create();c.update(s);let u=c.digest();return new fr({data:u})}static fromPublicKey(e){let{publicKey:n}=e,o;if(n instanceof Pe)o=0 .valueOf();else if(n instanceof qt)o=1 .valueOf();else if(n instanceof je)o=2 .valueOf();else if(n instanceof an)o=3 .valueOf();else throw new Error("No supported authentication scheme for public key");return fr.fromPublicKeyAndScheme({publicKey:n,scheme:o})}derivedAddress(){return new O(this.data.toUint8Array())}};fr.LENGTH=32;var Ft=fr;var dr=class r{constructor(t){let{privateKey:e,address:n,legacy:o}=t,s=o??!0;if(this.publicKey=e.publicKey(),this.publicKey instanceof Pe)s?this.signingScheme=0:(this.publicKey=new je(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof qt)this.signingScheme=1;else if(this.publicKey instanceof Lt)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=n}static generate(t){let e=t?.legacy??!0,n,o;switch(t?.scheme){case 2:n=cr.generate(),o=new je(n.publicKey());break;default:n=or.generate(),e===!1?o=new je(n.publicKey()):o=n.publicKey()}let c=Ft.fromPublicKey({publicKey:o}).derivedAddress();return new r({privateKey:n,address:c,legacy:t?.legacy})}static fromPrivateKey(t){let{privateKey:e,legacy:n}=t,o=n??!0,s;if(e instanceof cr)s=new je(e.publicKey());else if(e instanceof or)o?s=e.publicKey():s=new je(e.publicKey());else throw new Error(`Unsupported private key ${e}`);let u=Ft.fromPublicKey({publicKey:s}).derivedAddress();return new r({privateKey:e,address:u,legacy:o})}static fromPrivateKeyAndAddress(t){let{privateKey:e,address:n,legacy:o}=t;return new r({privateKey:e,address:n,legacy:o})}static fromDerivationPath(t){let{path:e,mnemonic:n,scheme:o,legacy:s}=t,c;switch(o){case 2:c=cr.fromDerivationPath(e,n);break;case 0:c=or.fromDerivationPath(e,n);break;default:throw new Error(`Unsupported scheme ${o}`)}return r.fromPrivateKey({privateKey:c,legacy:s})}static authKey(t){let{publicKey:e}=t;return Ft.fromPublicKey({publicKey:e})}sign(t){return this.privateKey.sign(t)}verifySignature(t){let{message:e,signature:n}=t,o=me.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:o,signature:n})}};var $p=`
|
|
3
3
|
fragment TokenActivitiesFields on token_activities_v2 {
|
|
4
4
|
after_value
|
|
5
5
|
before_value
|
|
@@ -17,7 +17,17 @@
|
|
|
17
17
|
transaction_version
|
|
18
18
|
type
|
|
19
19
|
}
|
|
20
|
-
`,
|
|
20
|
+
`,Vp=`
|
|
21
|
+
fragment AnsTokenFragment on current_aptos_names {
|
|
22
|
+
domain
|
|
23
|
+
expiration_timestamp
|
|
24
|
+
registered_address
|
|
25
|
+
subdomain
|
|
26
|
+
token_standard
|
|
27
|
+
is_primary
|
|
28
|
+
owner_address
|
|
29
|
+
}
|
|
30
|
+
`,Ti=`
|
|
21
31
|
fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {
|
|
22
32
|
token_standard
|
|
23
33
|
token_properties_mutated_v1
|
|
@@ -63,7 +73,7 @@
|
|
|
63
73
|
}
|
|
64
74
|
}
|
|
65
75
|
}
|
|
66
|
-
`,
|
|
76
|
+
`,gu=`
|
|
67
77
|
query getAccountCoinsCount($address: String) {
|
|
68
78
|
current_fungible_asset_balances_aggregate(
|
|
69
79
|
where: {owner_address: {_eq: $address}}
|
|
@@ -73,7 +83,7 @@
|
|
|
73
83
|
}
|
|
74
84
|
}
|
|
75
85
|
}
|
|
76
|
-
`,
|
|
86
|
+
`,yu=`
|
|
77
87
|
query getAccountCoinsData($where_condition: current_fungible_asset_balances_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_fungible_asset_balances_order_by!]) {
|
|
78
88
|
current_fungible_asset_balances(
|
|
79
89
|
where: $where_condition
|
|
@@ -106,7 +116,7 @@
|
|
|
106
116
|
}
|
|
107
117
|
}
|
|
108
118
|
}
|
|
109
|
-
`,
|
|
119
|
+
`,hu=`
|
|
110
120
|
query getAccountCollectionsWithOwnedTokens($where_condition: current_collection_ownership_v2_view_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_collection_ownership_v2_view_order_by!]) {
|
|
111
121
|
current_collection_ownership_v2_view(
|
|
112
122
|
where: $where_condition
|
|
@@ -140,7 +150,7 @@
|
|
|
140
150
|
single_token_uri
|
|
141
151
|
}
|
|
142
152
|
}
|
|
143
|
-
`,
|
|
153
|
+
`,mu=`
|
|
144
154
|
query getAccountOwnedObjects($where_condition: current_objects_bool_exp, $offset: Int, $limit: Int, $order_by: [current_objects_order_by!]) {
|
|
145
155
|
current_objects(
|
|
146
156
|
where: $where_condition
|
|
@@ -157,7 +167,7 @@
|
|
|
157
167
|
is_deleted
|
|
158
168
|
}
|
|
159
169
|
}
|
|
160
|
-
`,
|
|
170
|
+
`,xu=`
|
|
161
171
|
query getAccountOwnedTokens($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
162
172
|
current_token_ownerships_v2(
|
|
163
173
|
where: $where_condition
|
|
@@ -168,7 +178,7 @@
|
|
|
168
178
|
...CurrentTokenOwnershipFields
|
|
169
179
|
}
|
|
170
180
|
}
|
|
171
|
-
${
|
|
181
|
+
${Ti}`,ax=`
|
|
172
182
|
query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
173
183
|
current_token_ownerships_v2(
|
|
174
184
|
where: $where_condition
|
|
@@ -179,7 +189,7 @@
|
|
|
179
189
|
...CurrentTokenOwnershipFields
|
|
180
190
|
}
|
|
181
191
|
}
|
|
182
|
-
${
|
|
192
|
+
${Ti}`,Au=`
|
|
183
193
|
query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
184
194
|
current_token_ownerships_v2(
|
|
185
195
|
where: $where_condition
|
|
@@ -190,7 +200,7 @@
|
|
|
190
200
|
...CurrentTokenOwnershipFields
|
|
191
201
|
}
|
|
192
202
|
}
|
|
193
|
-
${
|
|
203
|
+
${Ti}`,bu=`
|
|
194
204
|
query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {
|
|
195
205
|
current_token_ownerships_v2_aggregate(
|
|
196
206
|
where: $where_condition
|
|
@@ -202,7 +212,7 @@
|
|
|
202
212
|
}
|
|
203
213
|
}
|
|
204
214
|
}
|
|
205
|
-
`,
|
|
215
|
+
`,wu=`
|
|
206
216
|
query getAccountTransactionsCount($address: String) {
|
|
207
217
|
account_transactions_aggregate(where: {account_address: {_eq: $address}}) {
|
|
208
218
|
aggregate {
|
|
@@ -210,13 +220,13 @@
|
|
|
210
220
|
}
|
|
211
221
|
}
|
|
212
222
|
}
|
|
213
|
-
`,
|
|
223
|
+
`,Tu=`
|
|
214
224
|
query getChainTopUserTransactions($limit: Int) {
|
|
215
225
|
user_transactions(limit: $limit, order_by: {version: desc}) {
|
|
216
226
|
version
|
|
217
227
|
}
|
|
218
228
|
}
|
|
219
|
-
`,
|
|
229
|
+
`,_u=`
|
|
220
230
|
query getCollectionData($where_condition: current_collections_v2_bool_exp!) {
|
|
221
231
|
current_collections_v2(where: $where_condition) {
|
|
222
232
|
collection_id
|
|
@@ -235,7 +245,7 @@
|
|
|
235
245
|
uri
|
|
236
246
|
}
|
|
237
247
|
}
|
|
238
|
-
`,
|
|
248
|
+
`,vu=`
|
|
239
249
|
query getCurrentFungibleAssetBalances($where_condition: current_fungible_asset_balances_bool_exp, $offset: Int, $limit: Int) {
|
|
240
250
|
current_fungible_asset_balances(
|
|
241
251
|
where: $where_condition
|
|
@@ -253,7 +263,7 @@
|
|
|
253
263
|
token_standard
|
|
254
264
|
}
|
|
255
265
|
}
|
|
256
|
-
`,
|
|
266
|
+
`,Su=`
|
|
257
267
|
query getDelegatedStakingActivities($delegatorAddress: String, $poolAddress: String) {
|
|
258
268
|
delegated_staking_activities(
|
|
259
269
|
where: {delegator_address: {_eq: $delegatorAddress}, pool_address: {_eq: $poolAddress}}
|
|
@@ -266,7 +276,7 @@
|
|
|
266
276
|
transaction_version
|
|
267
277
|
}
|
|
268
278
|
}
|
|
269
|
-
`,
|
|
279
|
+
`,Eu=`
|
|
270
280
|
query getEvents($where_condition: events_bool_exp, $offset: Int, $limit: Int, $order_by: [events_order_by!]) {
|
|
271
281
|
events(
|
|
272
282
|
where: $where_condition
|
|
@@ -285,7 +295,7 @@
|
|
|
285
295
|
indexed_type
|
|
286
296
|
}
|
|
287
297
|
}
|
|
288
|
-
`,
|
|
298
|
+
`,Cu=`
|
|
289
299
|
query getFungibleAssetActivities($where_condition: fungible_asset_activities_bool_exp, $offset: Int, $limit: Int) {
|
|
290
300
|
fungible_asset_activities(
|
|
291
301
|
where: $where_condition
|
|
@@ -310,7 +320,7 @@
|
|
|
310
320
|
type
|
|
311
321
|
}
|
|
312
322
|
}
|
|
313
|
-
`,
|
|
323
|
+
`,Uu=`
|
|
314
324
|
query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_exp, $offset: Int, $limit: Int) {
|
|
315
325
|
fungible_asset_metadata(where: $where_condition, offset: $offset, limit: $limit) {
|
|
316
326
|
icon_uri
|
|
@@ -327,14 +337,25 @@
|
|
|
327
337
|
token_standard
|
|
328
338
|
}
|
|
329
339
|
}
|
|
330
|
-
`,
|
|
340
|
+
`,Mn=`
|
|
341
|
+
query getNames($offset: Int, $limit: Int, $where_condition: current_aptos_names_bool_exp, $order_by: [current_aptos_names_order_by!]) {
|
|
342
|
+
current_aptos_names(
|
|
343
|
+
limit: $limit
|
|
344
|
+
where: $where_condition
|
|
345
|
+
order_by: $order_by
|
|
346
|
+
offset: $offset
|
|
347
|
+
) {
|
|
348
|
+
...AnsTokenFragment
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
${Vp}`,da=`
|
|
331
352
|
query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp!, $order_by: [num_active_delegator_per_pool_order_by!]) {
|
|
332
353
|
num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
|
|
333
354
|
num_active_delegator
|
|
334
355
|
pool_address
|
|
335
356
|
}
|
|
336
357
|
}
|
|
337
|
-
`,
|
|
358
|
+
`,Bu=`
|
|
338
359
|
query getProcessorStatus {
|
|
339
360
|
processor_status {
|
|
340
361
|
last_success_version
|
|
@@ -342,7 +363,7 @@
|
|
|
342
363
|
last_updated
|
|
343
364
|
}
|
|
344
365
|
}
|
|
345
|
-
`,
|
|
366
|
+
`,Iu=`
|
|
346
367
|
query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {
|
|
347
368
|
token_activities_v2(
|
|
348
369
|
where: $where_condition
|
|
@@ -353,7 +374,7 @@
|
|
|
353
374
|
...TokenActivitiesFields
|
|
354
375
|
}
|
|
355
376
|
}
|
|
356
|
-
${
|
|
377
|
+
${$p}`,la=`
|
|
357
378
|
query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
358
379
|
current_token_ownerships_v2(
|
|
359
380
|
where: $where_condition
|
|
@@ -364,7 +385,7 @@
|
|
|
364
385
|
...CurrentTokenOwnershipFields
|
|
365
386
|
}
|
|
366
387
|
}
|
|
367
|
-
${
|
|
388
|
+
${Ti}`,Ru=`
|
|
368
389
|
query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
|
|
369
390
|
current_token_datas_v2(
|
|
370
391
|
where: $where_condition
|
|
@@ -403,7 +424,7 @@
|
|
|
403
424
|
}
|
|
404
425
|
}
|
|
405
426
|
}
|
|
406
|
-
`;async function mi(r){let{aptosConfig:t}=r,{data:e}=await lt({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function bu(r){let{aptosConfig:t,ledgerVersion:e,options:n}=r,{data:o}=await lt({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:n?.withTransactions}});return o}async function wu(r){let{aptosConfig:t,blockHeight:e,options:n}=r,{data:o}=await lt({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:n?.withTransactions}});return o}async function xi(r){let{aptosConfig:t,handle:e,data:n,options:o}=r;return(await Gr({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:o?.ledgerVersion},body:n})).data}async function Ai(r){let{aptosConfig:t,payload:e,options:n}=r,{data:o}=await Gr({aptosConfig:t,originMethod:"view",path:"view",params:{ledger_version:n?.ledgerVersion},body:{function:e.function,type_arguments:e.typeArguments??[],arguments:e.functionArguments??[]}});return o}async function Tu(r){let{aptosConfig:t,limit:e}=r;return(await Ce({aptosConfig:t,query:{query:fu,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function Ce(r){let{aptosConfig:t,query:e,originMethod:n}=r,{data:o}=await bs({aptosConfig:t,originMethod:n??"queryIndexer",path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return o}async function Ep(r){let{aptosConfig:t}=r;return(await Ce({aptosConfig:t,query:{query:mu},originMethod:"getProcessorStatuses"})).processor_status}async function bi(r){return(await Ep({aptosConfig:r.aptosConfig}))[0].last_success_version}var na=new Map;function Pn(r,t,e){return async(...n)=>{if(na.has(t)){let{value:s,timestamp:c}=na.get(t);if(e===void 0||Date.now()-c<=e)return s}let o=await r(...n);return na.set(t,{value:o,timestamp:Date.now()}),o}}async function on(r){let{aptosConfig:t,accountAddress:e}=r,{data:n}=await lt({aptosConfig:t,originMethod:"getInfo",path:`accounts/${k.from(e).toString()}`});return n}async function Eu(r){let{aptosConfig:t,accountAddress:e,options:n}=r;return qr({aptosConfig:t,originMethod:"getModules",path:`accounts/${k.from(e).toString()}/modules`,params:{ledger_version:n?.ledgerVersion,start:n?.offset,limit:n?.limit??1e3}})}async function wi(r){return r.options?.ledgerVersion!==void 0?vu(r):Pn(async()=>vu(r),`module-${r.accountAddress}-${r.moduleName}`,1e3*60*5)()}async function vu(r){let{aptosConfig:t,accountAddress:e,moduleName:n,options:o}=r,{data:s}=await lt({aptosConfig:t,originMethod:"getModule",path:`accounts/${k.from(e).toString()}/module/${n}`,params:{ledger_version:o?.ledgerVersion}});return s}async function Su(r){let{aptosConfig:t,accountAddress:e,options:n}=r;return qr({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${k.from(e).toString()}/transactions`,params:{start:n?.offset,limit:n?.limit}})}async function Uu(r){let{aptosConfig:t,accountAddress:e,options:n}=r;return qr({aptosConfig:t,originMethod:"getResources",path:`accounts/${k.from(e).toString()}/resources`,params:{ledger_version:n?.ledgerVersion,start:n?.offset,limit:n?.limit??999}})}async function oa(r){let{aptosConfig:t,accountAddress:e,resourceType:n,options:o}=r,{data:s}=await lt({aptosConfig:t,originMethod:"getResource",path:`accounts/${k.from(e).toString()}/resource/${n}`,params:{ledger_version:o?.ledgerVersion}});return s.data}async function ia(r){let{aptosConfig:t,authenticationKey:e,options:n}=r,o=await oa({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:n}),{address_map:{handle:s}}=o,c=k.from(e);try{let u=await xi({aptosConfig:t,handle:s,data:{key:c.toString(),key_type:"address",value_type:"address"},options:n});return k.from(u)}catch(u){if(u instanceof Vt&&u.data.error_code==="table_item_not_found")return c;throw u}}async function Cu(r){let{aptosConfig:t,accountAddress:e}=r,o={owner_address:{_eq:k.from(e).toStringLong()},amount:{_gt:0}},c=await Ce({aptosConfig:t,query:{query:cu,variables:{where_condition:o}},originMethod:"getAccountTokensCount"});if(!c.current_token_ownerships_v2_aggregate.aggregate)throw Error("Failed to get the count of account tokens");return c.current_token_ownerships_v2_aggregate.aggregate.count}async function Iu(r){let{aptosConfig:t,accountAddress:e,options:n}=r,s={owner_address:{_eq:k.from(e).toStringLong()},amount:{_gt:0}};n?.tokenStandard&&(s.token_standard={_eq:n?.tokenStandard});let c={query:su,variables:{where_condition:s,offset:n?.pagination?.offset,limit:n?.pagination?.limit,order_by:n?.orderBy}};return(await Ce({aptosConfig:t,query:c,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Bu(r){let{aptosConfig:t,accountAddress:e,collectionAddress:n,options:o}=r,s=k.from(e).toStringLong(),c=k.from(n).toStringLong(),u={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:c}},amount:{_gt:0}};o?.tokenStandard&&(u.token_standard={_eq:o?.tokenStandard});let p={query:au,variables:{where_condition:u,offset:o?.pagination?.offset,limit:o?.pagination?.limit,order_by:o?.orderBy}};return(await Ce({aptosConfig:t,query:p,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function Ru(r){let{aptosConfig:t,accountAddress:e,options:n}=r,s={owner_address:{_eq:k.from(e).toStringLong()},amount:{_gt:0}};n?.tokenStandard&&(s.current_collection={token_standard:{_eq:n?.tokenStandard}});let c={query:ou,variables:{where_condition:s,offset:n?.pagination?.offset,limit:n?.pagination?.limit,order_by:n?.orderBy}};return(await Ce({aptosConfig:t,query:c,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function Pu(r){let{aptosConfig:t,accountAddress:e}=r,n=k.from(e).toStringLong(),s=await Ce({aptosConfig:t,query:{query:uu,variables:{address:n}},originMethod:"getAccountTransactionsCount"});if(!s.account_transactions_aggregate.aggregate)throw Error("Failed to get the count of account transactions");return s.account_transactions_aggregate.aggregate.count}async function ku(r){let{aptosConfig:t,accountAddress:e,options:n}=r,s={owner_address:{_eq:k.from(e).toStringLong()}},c={query:nu,variables:{where_condition:s,offset:n?.pagination?.offset,limit:n?.pagination?.limit,order_by:n?.orderBy}};return(await Ce({aptosConfig:t,query:c,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Ou(r){let{aptosConfig:t,accountAddress:e}=r,n=k.from(e).toStringLong(),s=await Ce({aptosConfig:t,query:{query:ru,variables:{address:n}},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 zu(r){let{aptosConfig:t,accountAddress:e,options:n}=r,s={owner_address:{_eq:k.from(e).toStringLong()}},c={query:iu,variables:{where_condition:s,offset:n?.pagination?.offset,limit:n?.pagination?.limit,order_by:n?.orderBy}};return(await Ce({aptosConfig:t,query:c,originMethod:"getAccountOwnedObjects"})).current_objects}async function Nu(r){let{aptosConfig:t,privateKey:e}=r,n=new Ye(e.publicKey());if(e instanceof cr){let s=Gt.fromPublicKeyAndScheme({publicKey:n,scheme:2}).derivedAddress();return dr.fromPrivateKeyAndAddress({privateKey:e,address:s})}if(e instanceof or){let o=Gt.fromPublicKeyAndScheme({publicKey:n,scheme:2});if(await _u({authKey:o,aptosConfig:t})){let p=o.derivedAddress();return dr.fromPrivateKeyAndAddress({privateKey:e,address:p,legacy:!1})}let c=Gt.fromPublicKeyAndScheme({publicKey:n,scheme:0});if(await _u({authKey:c,aptosConfig:t})){let p=c.derivedAddress();return dr.fromPrivateKeyAndAddress({privateKey:e,address:p,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function _u(r){let{aptosConfig:t,authKey:e}=r,n=await ia({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await on({aptosConfig:t,accountAddress:n}),!0}catch(o){if(o.status===404)return!1;throw new Error(`Error while looking for an account info ${n.toString()}`)}}var lo=class{constructor(t){this.config=t}async getAccountInfo(t){return on({aptosConfig:this.config,...t})}async getAccountModules(t){return Eu({aptosConfig:this.config,...t})}async getAccountModule(t){return wi({aptosConfig:this.config,...t})}async getAccountTransactions(t){return Su({aptosConfig:this.config,...t})}async getAccountResources(t){return Uu({aptosConfig:this.config,...t})}async getAccountResource(t){return oa({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return ia({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return Cu({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return Iu({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return Bu({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return Ru({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return Pu({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return ku({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return Ou({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return zu({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return Nu({aptosConfig:this.config,...t})}};var Jf=rc(Zf(),1);async function ed(r){var t;let{params:e,method:n,url:o,headers:s,body:c,overrides:u}=r,p={headers:s,method:n,url:o,params:e,data:c,withCredentials:(t=u?.WITH_CREDENTIALS)!=null?t:!0};try{let h=await(0,Jf.default)(p);return{status:h.status,statusText:h.statusText,data:h.data,headers:h.headers,config:h.config}}catch(h){let y=h;if(y.response)return y.response;throw h}}var ho=class{constructor(t){this.network=t?.network??hs,this.fullnode=t?.fullnode,this.faucet=t?.faucet,this.indexer=t?.indexer,this.client=t?.client??{provider:ed},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 ps[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 gs[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 Ko[this.network];default:throw Error(`apiType ${t} is not supported`)}}isIndexerRequest(t){return Ko[this.network]===t}};var yo=class extends Z{constructor(e){super();this.accountAddress=k.ONE;this.moduleName=new Fe("account");this.structName=new Fe("RotationProofChallenge");this.sequenceNumber=new Le(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=Be.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 pr=class r extends Mt{constructor(e){super();this.signature=e}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(e){if(this.signature instanceof Ke)e.serializeU32AsUleb128(0),this.signature.serialize(e);else if(this.signature instanceof ur)e.serializeU32AsUleb128(1),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let n=e.deserializeUleb128AsU32();switch(n){case 0:return new r(Ke.load(e));case 1:return new r(ur.load(e));default:throw new Error(`Unknown variant index for AnySignature: ${n}`)}}};async function Ca(r){return new Promise(t=>{setTimeout(t,r)})}async function td(r){let{aptosConfig:t,options:e}=r;return qr({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:e?.offset,limit:e?.limit}})}async function Bi(r){let{aptosConfig:t}=r;return Pn(async()=>{let{data:e}=await lt({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function rd(r){let{aptosConfig:t,ledgerVersion:e}=r,{data:n}=await lt({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return n}async function Ri(r){let{aptosConfig:t,transactionHash:e}=r,{data:n}=await lt({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return n}async function nd(r){let{aptosConfig:t,transactionHash:e}=r;try{return(await Ri({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(n){if(n?.status===404)return!0;throw n}}async function Pi(r){let{aptosConfig:t,transactionHash:e,options:n}=r,o=n?.timeoutSecs??ro,s=n?.checkSuccess??!0,c=n?.indexerVersionCheck??!0,u=!0,p=0,h,y,x=200,_=1.5;for(;u&&!(p>=o);){try{if(h=await Ri({aptosConfig:t,transactionHash:e}),u=h.type==="pending_transaction",!u)break}catch(T){if(!(T instanceof Vt)||(y=T,T.status!==404&&T.status>=400&&T.status<500))throw T}await Ca(x),p+=x/1e3,x*=_}if(h===void 0)throw y||new mo(`Fetching transaction ${e} failed and timed out after ${o} seconds`,h);if(h.type==="pending_transaction")throw new mo(`Transaction ${e} timed out in pending state after ${o} seconds`,h);if(!s)return h;if(!h.success)throw new Ia(`Transaction ${e} failed with an error: ${h.vm_status}`,h);if(c)try{await Cg({aptosConfig:t,ledgerVersion:Number(h.version)})}catch{throw new mo(`Transaction ${e} committed, but timed out waiting for indexer to sync with ledger version ${h.version}.You can disable this check by setting \`indexerVersionCheck\` to false in the \`extraArgs\` parameter.`,h)}return h}async function Cg(r){let{aptosConfig:t,ledgerVersion:e}=r,n=3e3,o=new Date().getTime(),s=-1;for(;s<e;){if(new Date().getTime()-o>n)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(s=await bi({aptosConfig:t}),s>=e)break;await Ca(200)}}var mo=class extends Error{constructor(e,n){super(e);this.lastSubmittedTransaction=n}},Ia=class extends Error{constructor(e,n){super(e);this.transaction=n}};var ht=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return gr.load(t);case 1:return ki.load(t);case 2:return Wt.load(t);case 3:return Dn.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}},gr=class r extends ht{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Pe.deserialize(e),o=Ke.deserialize(e);return new r(n,o)}},ki=class r extends ht{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Dt.deserialize(e),o=Yr.deserialize(e);return new r(n,o)}},Wt=class r extends ht{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Ye.deserialize(e),o=pr.deserialize(e);return new r(n,o)}},Dn=class r extends ht{constructor(e,n,o){super();this.public_keys=e,this.signatures=n,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 n=nn.deserialize(e),o=e.deserializeVector(pr),s=e.deserializeBytes();return new r(n,o,s)}};var Yt=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return cn.load(t);case 1:return Oi.load(t);case 2:return un.load(t);case 3:return fn.load(t);case 4:return dn.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},cn=class r extends Yt{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Pe.deserialize(e),o=Ke.deserialize(e);return new r(n,o)}},Oi=class r extends Yt{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Dt.deserialize(e),o=Yr.deserialize(e);return new r(n,o)}},un=class r extends Yt{constructor(e,n,o){super();this.sender=e,this.secondary_signer_addresses=n,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 n=ht.deserialize(e),o=e.deserializeVector(k),s=e.deserializeVector(ht);return new r(n,o,s)}},fn=class r extends Yt{constructor(e,n,o,s){super();this.sender=e,this.secondary_signer_addresses=n,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 n=ht.deserialize(e),o=e.deserializeVector(k),s=e.deserializeVector(ht),c=k.deserialize(e),u=ht.deserialize(e),p={address:c,authenticator:u};return new r(n,o,s,p)}},dn=class r extends Yt{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let n=ht.deserialize(e);return new r(n)}};var ln=class r extends Z{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let n=e.deserializeU8();return new r(n)}};var Ne=class r extends Z{constructor(e){super();this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let n=e.deserializeStr();return new r(n)}};var qn=class r extends Z{constructor(e,n){super();this.address=e,this.name=n}static fromStr(e){let n=e.split("::");if(n.length!==2)throw new Error("Invalid module id.");return new r(k.fromStringRelaxed(n[0]),new Ne(n[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let n=k.deserialize(e),o=Ne.deserialize(e);return new r(n,o)}};var $e=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return pn.load(t);case 1:return gn.load(t);case 2:return mn.load(t);case 3:return xn.load(t);case 4:return bn.load(t);case 5:return Or.load(t);case 6:return Tn.load(t);case 7:return hr.load(t);case 8:return hn.load(t);case 9:return yn.load(t);case 10:return An.load(t);case 255:return wn.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof pn}isAddress(){return this instanceof bn}isGeneric(){return this instanceof wn}isSigner(){return this instanceof Or}isVector(){return this instanceof Tn}isStruct(){return this instanceof hr}isU8(){return this instanceof gn}isU16(){return this instanceof hn}isU32(){return this instanceof yn}isU64(){return this instanceof mn}isU128(){return this instanceof xn}isU256(){return this instanceof An}},pn=class r extends $e{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new r}},gn=class r extends $e{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new r}},hn=class r extends $e{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new r}},yn=class r extends $e{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new r}},mn=class r extends $e{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new r}},xn=class r extends $e{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new r}},An=class r extends $e{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new r}},bn=class r extends $e{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new r}},Or=class r extends $e{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new r}},xo=class r extends $e{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let n=$e.deserialize(e);return new r(n)}},wn=class r extends $e{constructor(e){super();this.value=e}toString(){return`T${this.value}`}serialize(e){e.serializeU32AsUleb128(255),e.serializeU32(this.value)}static load(e){let n=e.deserializeU32();return new r(n)}},Tn=class r extends $e{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 n=$e.deserialize(e);return new r(n)}},hr=class r extends $e{constructor(e){super();this.value=e}toString(){let e="";return this.value.typeArgs.length>0&&(e=`<${this.value.typeArgs.map(n=>n.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 n=Xt.deserialize(e);return new r(n)}isTypeTag(e,n,o){return this.value.moduleName.identifier===n&&this.value.name.identifier===o&&this.value.address.equals(e)}isString(){return this.isTypeTag(k.ONE,"string","String")}isOption(){return this.isTypeTag(k.ONE,"option","Option")}isObject(){return this.isTypeTag(k.ONE,"object","Object")}},Xt=class r extends Z{constructor(e,n,o,s){super();this.address=e,this.moduleName=n,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 n=k.deserialize(e),o=Ne.deserialize(e),s=Ne.deserialize(e),c=e.deserializeVector($e);return new r(n,o,s,c)}};function Ig(){return new Xt(k.ONE,new Ne("aptos_coin"),new Ne("AptosCoin"),[])}function Bg(){return new Xt(k.ONE,new Ne("string"),new Ne("String"),[])}function Rg(r){return new Xt(k.ONE,new Ne("option"),new Ne("Option"),[r])}function Pg(r){return new Xt(k.ONE,new Ne("object"),new Ne("Object"),[r])}function od(r){let t=r.deserializeUleb128AsU32();switch(t){case 0:return it.deserialize(r);case 1:return Le.deserialize(r);case 2:return St.deserialize(r);case 3:return k.deserialize(r);case 4:return Be.deserialize(r,it);case 5:return Ge.deserialize(r);case 6:return _t.deserialize(r);case 7:return Et.deserialize(r);case 8:return Ut.deserialize(r);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var zr=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Gn.load(t);case 2:return Ln.load(t);case 3:return Fn.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},Gn=class r extends zr{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let n=Kn.deserialize(e);return new r(n)}},Ln=class r extends zr{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let n=vn.deserialize(e);return new r(n)}},Fn=class r extends zr{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let n=Hn.deserialize(e);return new r(n)}},vn=class r{constructor(t,e,n,o){this.module_name=t,this.function_name=e,this.type_args=n,this.args=o}static build(t,e,n,o){return new r(qn.fromStr(t),new Ne(e),n,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=qn.deserialize(t),n=Ne.deserialize(t),o=t.deserializeVector($e),s=t.deserializeUleb128AsU32(),c=new Array;for(let u=0;u<s;u+=1){let p=t.deserializeUleb128AsU32(),h=so.deserialize(t,p);c.push(h)}return new r(e,n,o,c)}},Kn=class r{constructor(t,e,n){this.bytecode=t,this.type_args=e,this.args=n}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(),n=t.deserializeVector($e),o=t.deserializeUleb128AsU32(),s=new Array;for(let c=0;c<o;c+=1){let u=od(t);s.push(u)}return new r(e,n,s)}},Hn=class r{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=k.deserialize(t),n=t.deserializeBool(),o;return n&&(o=$n.deserialize(t)),new r(e,o)}},$n=class r{constructor(t){this.transaction_payload=t}serialize(t){t.serializeU32AsUleb128(0),this.transaction_payload.serialize(t)}static deserialize(t){return t.deserializeUleb128AsU32(),new r(vn.deserialize(t))}};var Ft=class r extends Z{constructor(e,n,o,s,c,u,p){super();this.sender=e,this.sequence_number=n,this.payload=o,this.max_gas_amount=s,this.gas_unit_price=c,this.expiration_timestamp_secs=u,this.chain_id=p}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 n=k.deserialize(e),o=e.deserializeU64(),s=zr.deserialize(e),c=e.deserializeU64(),u=e.deserializeU64(),p=e.deserializeU64(),h=ln.deserialize(e);return new r(n,o,s,c,u,p,h)}},Ao=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return yr.load(t);case 1:return mr.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},yr=class r extends Ao{constructor(e,n){super();this.raw_txn=e,this.secondary_signer_addresses=n}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let n=Ft.deserialize(e),o=e.deserializeVector(k);return new r(n,o)}},mr=class r extends Ao{constructor(e,n,o){super();this.raw_txn=e,this.secondary_signer_addresses=n,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 n=Ft.deserialize(e),o=e.deserializeVector(k),s=k.deserialize(e);return new r(n,o,s)}};var Kt=class r extends Z{constructor(e,n){super();this.raw_txn=e,this.authenticator=n}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let n=Ft.deserialize(e),o=Yt.deserialize(e);return new r(n,o)}};function id(r){return!!r.match(/^[_a-zA-Z0-9]+$/)}function sd(r){return!!r.match(/\s/)}function kg(r){return!!r.match(/^T[0-9]+$/)}function Og(r,t){let e=t;for(;e<r.length;e+=1){let n=r[e];if(!sd(n))break}return e}var ad=(_=>(_.InvalidTypeTag="unknown type",_.UnexpectedGenericType="unexpected generic type",_.UnexpectedTypeArgumentClose="unexpected '>'",_.UnexpectedWhitespaceCharacter="unexpected whitespace character",_.UnexpectedComma="unexpected ','",_.TypeArgumentCountMismatch="type argument count doesn't match expected amount",_.MissingTypeArgumentClose="no matching '>' for '<'",_.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",_.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",_.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",_.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",_.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",_))(ad||{}),Oe=class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function Vn(r,t){let e=t?.allowGenerics??!1,n=[],o=[],s=[],c=0,u="",p=1;for(;c<r.length;){let h=r[c];if(h==="<")n.push({savedExpectedTypes:p,savedStr:u,savedTypes:s}),u="",s=[],p=1;else if(h===">"){if(u!==""){let N=zi(u,o,e);s.push(N)}let y=n.pop();if(y===void 0)throw new Oe(r,"unexpected '>'");if(p!==s.length)throw new Oe(r,"type argument count doesn't match expected amount");let{savedStr:x,savedTypes:_,savedExpectedTypes:T}=y;o=s,s=_,u=x,p=T}else if(h===","){if(u.length!==0){let y=zi(u,o,e);o=[],s.push(y),u="",p+=1}}else if(sd(h)){let y=!1;if(u.length!==0){let _=zi(u,o,e);o=[],s.push(_),u="",y=!0}c=Og(r,c);let x=r[c];if(c<r.length&&y&&x!==","&&x!==">")throw new Oe(r,"unexpected whitespace character");continue}else u+=h;c+=1}if(n.length>0)throw new Oe(r,"no matching '>' for '<'");switch(s.length){case 0:return zi(u,o,e);case 1:if(u==="")return s[0];throw new Oe(r,"unexpected ','");default:throw new Oe(r,"unexpected whitespace character")}}function zi(r,t,e){switch(r){case"&signer":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new xo(new Or);case"signer":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new Or;case"bool":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new pn;case"address":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new bn;case"u8":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new gn;case"u16":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new hn;case"u32":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new yn;case"u64":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new mn;case"u128":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new xn;case"u256":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new An;case"vector":if(t.length!==1)throw new Oe(r,"vector type expected to have exactly one type argument");return new Tn(t[0]);default:if(kg(r)){if(e)return new wn(Number(r.split("T")[1]));throw new Oe(r,"unexpected generic type")}if(!r.match(/.*:.*/))throw new Oe(r,"unknown type");let n=r.split("::");if(n.length!==3)throw new Oe(r,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!id(n[1]))throw new Oe(r,"module name must only contain alphanumeric or '_' characters");if(!id(n[2]))throw new Oe(r,"struct name must only contain alphanumeric or '_' characters");return new hr(new Xt(k.fromStringRelaxed(n[0]),new Ne(n[1]),new Ne(n[2]),t))}}function Ba(r){return typeof r=="boolean"}function _n(r){return typeof r=="string"}function bo(r){return typeof r=="number"}function wo(r){return typeof r=="number"||typeof r=="bigint"||typeof r=="string"}function Ra(r){return r==null}function Ni(r){return r instanceof Ge}function To(r){return r instanceof k}function Mi(r){return r instanceof Fe}function Pa(r){return r instanceof Er}function Di(r){return r instanceof it}function qi(r){return r instanceof _t}function Gi(r){return r instanceof Et}function Li(r){return r instanceof Le}function Fi(r){return r instanceof St}function Ki(r){return r instanceof Ut}function Hi(r){return"bytecode"in r}function ze(r,t){throw new Error(`Type mismatch for argument ${t}, expected '${r}'`)}function ka(r){let t=r.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?r.params.length:t}function $i(r){let t=r.split("::");if(t.length!==3)throw new Error(`Invalid function ${r}`);let e=t[0],n=t[1],o=t[2];return{moduleAddress:e,moduleName:n,functionName:o}}function Oa(r){return r?.map(t=>_n(t)?Vn(t):t)??[]}async function za(r,t,e,n){let s=(await wi({aptosConfig:n,accountAddress:r,moduleName:t})).abi?.exposed_functions.find(p=>p.name===e);if(!s)throw new Error(`Could not find entry function ABI for '${r}::${t}::${e}'`);if(!s.is_entry)throw new Error(`'${r}::${t}::${e}' is not an entry function`);let c=ka(s),u=[];for(let p=c;p<s.params.length;p+=1)u.push(Vn(s.params[p],{allowGenerics:!0}));return{typeParameters:s.generic_type_params,parameters:u}}function Na(r,t,e,n,o){if(n>=t.parameters.length)throw new Error(`Too many arguments for '${r}', expected ${t.parameters.length}`);return Ni(e)||Di(e)||qi(e)||Gi(e)||Li(e)||Fi(e)||Ki(e)||To(e)||Mi(e)||Pa(e)||e instanceof Be||e instanceof Nt?(zg(t,e,n),e):Vi(e,t.parameters[n],n,o)}function Vi(r,t,e,n){if(t.isBool()){if(Ba(r))return new Ge(r);ze("boolean",e)}if(t.isAddress()){if(_n(r))return k.fromStringRelaxed(r);ze("string",e)}if(t.isU8()){if(bo(r))return new it(r);ze("number",e)}if(t.isU16()){if(bo(r))return new _t(r);ze("number",e)}if(t.isU32()){if(bo(r))return new Et(r);ze("number",e)}if(t.isU64()){if(wo(r))return new Le(BigInt(r));ze("bigint | number | string",e)}if(t.isU128()){if(wo(r))return new St(BigInt(r));ze("bigint | number | string",e)}if(t.isU256()){if(wo(r))return new Ut(BigInt(r));ze("bigint | number | string",e)}if(t.isGeneric()){let o=t.value;if(o<0||o>=n.length)throw new Error(`Generic argument ${t.toString()} is invalid for argument ${e}`);Vi(r,n[o],e,n)}if(t.isVector()){if(t.value.isU8()&&_n(r))return Be.U8(me.fromHexInput(r).toUint8Array());if(Array.isArray(r))return new Be(r.map(o=>Vi(o,t.value,e,n)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(_n(r))return new Fe(r);ze("string",e)}if(t.isObject()){if(_n(r))return k.fromStringRelaxed(r);ze("string",e)}if(t.isOption())return Ra(r)?new Nt(null):new Nt(Vi(r,t.value.typeArgs[0],e,n));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 zg(r,t,e){let n=r.parameters[e];if(n.isBool()){if(Ni(t))return;ze("Bool",e)}if(n.isAddress()){if(To(t))return;ze("AccountAddress",e)}if(n.isU8()){if(Di(t))return;ze("U8",e)}if(n.isU16()){if(qi(t))return;ze("U16",e)}if(n.isU32()){if(Gi(t))return;ze("U32",e)}if(n.isU64()){if(Li(t))return;ze("U64",e)}if(n.isU128()){if(Fi(t))return;ze("U128",e)}if(n.isU256()){if(Ki(t))return;ze("U256",e)}if(n.isVector()){if(t instanceof Be)return;ze("MoveVector",e)}if(n instanceof hr){if(n.isString()){if(Mi(t))return;ze("MoveString",e)}if(n.isObject()){if(To(t))return;ze("AccountAddress",e)}if(n.isOption()){if(t instanceof Nt)return;ze("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${n.toString()}'`)}async function _o(r){if(Hi(r))return ud(r);let{moduleAddress:t,moduleName:e,functionName:n}=$i(r.function),o=await Pn(async()=>za(t,e,n,r.aptosConfig),`entry-function-${r.aptosConfig.network}-${t}-${e}-${n}`,1e3*60*5)();return cd(r,o)}function cd(r,t){if(Hi(r))return ud(r);let{moduleAddress:e,moduleName:n,functionName:o}=$i(r.function),s=Oa(r.typeArguments);if(s.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${s.length}`);let c=r.functionArguments.map((p,h)=>Na(r.function,t,p,h,s));if(c.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${n}::${o}', expected ${t.parameters.length} but got ${c.length}`);let u=vn.build(`${e}::${n}`,o,s,c);if("multisigAddress"in r){let p;return typeof r.multisigAddress=="string"?p=k.from(r.multisigAddress):p=r.multisigAddress,new Fn(new Hn(p,new $n(u)))}return new Ln(u)}function ud(r){return new Gn(new Kn(me.fromHexInput(r.bytecode).toUint8Array(),r.typeArguments??[],r.functionArguments))}async function fd(r){let{aptosConfig:t,sender:e,payload:n,options:o}=r,s=o?.accountSequenceNumber?Promise.resolve({sequence_number:o.accountSequenceNumber}):on({aptosConfig:t,accountAddress:e}),c=Ho[t.network]?Promise.resolve({chain_id:Ho[t.network]}):mi({aptosConfig:t}),u=o?.gasUnitPrice?Promise.resolve({gas_estimate:o.gasUnitPrice}):Bi({aptosConfig:t}),[{sequence_number:p},{chain_id:h},{gas_estimate:y}]=await Promise.all([s,c,u]),{maxGasAmount:x,gasUnitPrice:_,expireTimestamp:T}={maxGasAmount:o?.maxGasAmount?BigInt(o.maxGasAmount):BigInt(ys),gasUnitPrice:BigInt(y),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+ms),...o};return new Ft(k.fromRelaxed(e),BigInt(p),n,BigInt(x),BigInt(_),BigInt(T),new ln(h))}async function Eo(r){let{aptosConfig:t,sender:e,payload:n,options:o}=r,s=await fd({aptosConfig:t,sender:e,payload:n,options:o});if("feePayerAddress"in r){let c=r.secondarySignerAddresses?.map(u=>k.fromRelaxed(u))??[];return{rawTransaction:s,secondarySignerAddresses:c,feePayerAddress:r?.feePayerAddress!==void 0?k.fromRelaxed(r.feePayerAddress):void 0}}if("secondarySignerAddresses"in r){let c=r.secondarySignerAddresses?.map(u=>k.fromRelaxed(u))??[];return{rawTransaction:s,secondarySignerAddresses:c}}return{rawTransaction:s}}function Ma(r){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:n,feePayerPublicKey:o}=r,s=new io(e.rawTransaction.bcsToBytes()),c=Ft.deserialize(s),u=vo(t);if("feePayerAddress"in e){let h=new mr(c,e.secondarySignerAddresses??[],e.feePayerAddress),y=[];n&&(y=n.map(T=>vo(T)));let x=vo(o),_=new fn(u,e.secondarySignerAddresses??[],y,{address:e.feePayerAddress,authenticator:x});return new Kt(h.raw_txn,_).bcsToBytes()}if("secondarySignerAddresses"in e){let h=new yr(c,e.secondarySignerAddresses),y=[];y=n.map(_=>vo(_));let x=new un(u,e.secondarySignerAddresses,y);return new Kt(h.raw_txn,x).bcsToBytes()}let p;if(u instanceof gr)p=new cn(u.public_key,u.signature);else if(u instanceof Wt)p=new dn(u);else throw new Error("Invalid public key");return new Kt(c,p).bcsToBytes()}function vo(r){if(r instanceof Ye){if(r.publicKey instanceof Pe)return new Wt(r,new pr(new Ke(new Uint8Array(64))));if(r.publicKey instanceof qt)return new Wt(r,new pr(new ur(new Uint8Array(64))))}return new gr(new Pe(r.toUint8Array()),new Ke(new Uint8Array(64)))}function Da(r){let{signer:t,transaction:e}=r,n=Ga(e),o=ld(n),s=t.sign(o);switch(t.signingScheme){case 0:return new gr(new Pe(t.publicKey.toUint8Array()),new Ke(s.toUint8Array()));case 2:return new Wt(t.publicKey,new pr(s));default:throw new Error(`Cannot sign transaction, signing scheme ${t.signingScheme} not supported`)}}function qa(r){let{transaction:t,senderAuthenticator:e,feePayerAuthenticator:n,additionalSignersAuthenticators:o}=r,s=Ga(t);if(n||o)return dd(s,e,n,o);if(e instanceof gr){let c=new cn(e.public_key,e.signature);return new Kt(s,c).bcsToBytes()}if(e instanceof Wt||e instanceof Dn){let c=new dn(e);return new Kt(s,c).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${e} is not a supported account authentication scheme`)}function Ga(r){return"feePayerAddress"in r?new mr(r.rawTransaction,r.secondarySignerAddresses??[],r.feePayerAddress):"secondarySignerAddresses"in r?new yr(r.rawTransaction,r.secondarySignerAddresses):r.rawTransaction}function dd(r,t,e,n){if(r instanceof mr){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let o=new fn(t,r.secondary_signer_addresses,n??[],{address:r.fee_payer_address,authenticator:e});return new Kt(r.raw_txn,o).bcsToBytes()}if(r instanceof yr){if(!n)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let o=new un(t,r.secondary_signer_addresses,n??[]);return new Kt(r.raw_txn,o).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof r} transaction is not supported`)}function ld(r){let t=$r.create();if(r instanceof Ft)t.update(As);else if(r instanceof yr)t.update($o);else if(r instanceof mr)t.update($o);else throw new Error(`Unknown transaction type to sign on: ${r}`);let e=t.digest(),n=r.bcsToBytes(),o=new Uint8Array(e.length+n.length);return o.set(e),o.set(n,e.length),o}async function Ht(r){let{aptosConfig:t,sender:e,data:n,options:o}=r,s;if("bytecode"in n?s=n:"multisigAddress"in n?s={aptosConfig:t,multisigAddress:n.multisigAddress,function:n.function,functionArguments:n.functionArguments,typeArguments:n.typeArguments}:s={aptosConfig:t,function:n.function,functionArguments:n.functionArguments,typeArguments:n.typeArguments},Ng(r)){let{secondarySignerAddresses:u}=r,p=r.hasFeePayer?k.ZERO:void 0,h=await _o(s);return Eo({aptosConfig:t,sender:e,payload:h,options:o,secondarySignerAddresses:u,feePayerAddress:p})}if(Mg(r)){let{secondarySignerAddresses:u}=r,p=await _o(s);return Eo({aptosConfig:t,sender:e,payload:p,options:o,secondarySignerAddresses:u})}let c=await _o(s);return Eo({aptosConfig:t,sender:e,payload:c,options:o})}function Ng(r){return"hasFeePayer"in r}function Mg(r){return"secondarySignerAddresses"in r}function La(r){return Da({...r})}async function pd(r){let{aptosConfig:t,transaction:e,signerPublicKey:n,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:c}=r,u=Ma({transaction:e,signerPublicKey:n,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:c}),{data:p}=await Gr({aptosConfig:t,body:u,path:"transactions/simulate",params:{estimate_gas_unit_price:r.options?.estimateGasUnitPrice??!1,estimate_max_gas_amount:r.options?.estimateMaxGasAmount??!1,estimate_prioritized_gas_unit_price:r.options?.estimatePrioritizedGasUnitPrice??!1},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return p}async function Fa(r){let{aptosConfig:t}=r,e=qa({...r}),{data:n}=await Gr({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return n}async function Ka(r){let{aptosConfig:t,signer:e,transaction:n}=r,o=La({signer:e,transaction:n});return Fa({aptosConfig:t,transaction:n,senderAuthenticator:o})}async function gd(r){let{aptosConfig:t,account:e,metadataBytes:n,moduleBytecode:o,options:s}=r,c=o.map(p=>Be.U8(p));return await Ht({aptosConfig:t,sender:k.fromRelaxed(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[Be.U8(n),new Be(c)]},options:s})}async function hd(r){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:n}=r,o=await on({aptosConfig:t,accountAddress:e.accountAddress.toString()}),s=dr.fromPrivateKey({privateKey:n,legacy:!0}),u=new yo({sequenceNumber:BigInt(o.sequence_number),originator:e.accountAddress,currentAuthKey:k.from(o.authentication_key),newPublicKey:s.publicKey}).bcsToBytes(),p=e.sign(u),h=s.sign(u),y=await Ht({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new it(e.signingScheme.valueOf()),Be.U8(e.publicKey.toUint8Array()),new it(s.signingScheme.valueOf()),Be.U8(s.publicKey.toUint8Array()),Be.U8(p.toUint8Array()),Be.U8(h.toUint8Array())]}});return await Ka({aptosConfig:t,signer:e,transaction:y})}async function yd(r){let{aptosConfig:t,sender:e,recipient:n,amount:o,coinType:s,options:c}=r,u=s??xs;return await Ht({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[Vn(u)],functionArguments:[k.from(n),new Le(o)]},options:c})}var So=class{constructor(t){this.config=t}async transferCoinTransaction(t){return yd({aptosConfig:this.config,...t})}};async function md(r){let{aptosConfig:t,options:e,creator:n}=r;return await Ht({aptosConfig:t,sender:n.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new Fe(r.collection),new Fe(r.description),new Fe(r.name),new Fe(r.uri),Be.MoveString([]),Be.MoveString([]),new Be([])]},options:e})}async function xd(r){let{aptosConfig:t,tokenAddress:e}=r,n={token_data_id:{_eq:k.from(e).toStringLong()}};return(await Ce({aptosConfig:t,query:{query:Au,variables:{where_condition:n}},originMethod:"getTokenData"})).current_token_datas_v2[0]}async function Ad(r){let{aptosConfig:t,tokenAddress:e}=r,n={token_data_id:{_eq:k.from(e).toStringLong()}};return(await Ce({aptosConfig:t,query:{query:ra,variables:{where_condition:n}},originMethod:"getCurrentTokenOwnership"})).current_token_ownerships_v2[0]}async function bd(r){let{aptosConfig:t,ownerAddress:e,options:n}=r,o={owner_address:{_eq:k.from(e).toStringLong()}},s={query:ra,variables:{where_condition:o,offset:n?.pagination?.offset,limit:n?.pagination?.limit,order_by:n?.orderBy}};return(await Ce({aptosConfig:t,query:s,originMethod:"getOwnedTokens"})).current_token_ownerships_v2}async function wd(r){let{aptosConfig:t,tokenAddress:e,options:n}=r,o={token_data_id:{_eq:k.from(e).toStringLong()}},s={query:xu,variables:{where_condition:o,offset:n?.pagination?.offset,limit:n?.pagination?.limit,order_by:n?.orderBy}};return(await Ce({aptosConfig:t,query:s,originMethod:"getTokenActivity"})).token_activities_v2}async function Td(r){let{aptosConfig:t,options:e,creator:n}=r;return await Ht({aptosConfig:t,sender:n.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new Fe(r.description),new Le(r.maxSupply??Kr),new Fe(r.name),new Fe(r.uri),new Ge(r.mutableDescription??!0),new Ge(r.mutableRoyalty??!0),new Ge(r.mutableURI??!0),new Ge(r.mutableTokenDescription??!0),new Ge(r.mutableTokenName??!0),new Ge(r.mutableTokenProperties??!0),new Ge(r.mutableTokenURI??!0),new Ge(r.tokensBurnableByCreator??!0),new Ge(r.tokensFreezableByCreator??!0),new Le(r.royaltyNumerator??0),new Le(r.royaltyDenominator??1)]},options:e})}async function Ha(r){let{aptosConfig:t,creatorAddress:e,collectionName:n,options:o}=r,s=k.from(e),c={collection_name:{_eq:n},creator_address:{_eq:s.toStringLong()}};return o?.tokenStandard&&(c.token_standard={_eq:o?.tokenStandard??"v2"}),(await Ce({aptosConfig:t,query:{query:du,variables:{where_condition:c}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function vd(r){return(await Ha(r)).collection_id}var Uo=class{constructor(t){this.config=t}async createCollectionTransaction(t){return Td({aptosConfig:this.config,...t})}async getCollectionData(t){return Ha({aptosConfig:this.config,...t})}async getCollectionId(t){return vd({aptosConfig:this.config,...t})}async mintTokenTransaction(t){return md({aptosConfig:this.config,...t})}async getTokenData(t){return xd({aptosConfig:this.config,...t})}async getCurrentTokenOwnership(t){return Ad({aptosConfig:this.config,...t})}async getOwnedTokens(t){return bd({aptosConfig:this.config,...t})}async getTokenActivity(t){return wd({aptosConfig:this.config,...t})}};async function _d(r){let{accountAddress:t,aptosConfig:e,creationNumber:n}=r,s={account_address:{_eq:k.from(t).toStringLong()},creation_number:{_eq:n}};return Qi({aptosConfig:e,options:{where:s}})}async function Ed(r){let{accountAddress:t,aptosConfig:e,eventType:n,options:o}=r,u={where:{account_address:{_eq:k.fromRelaxed(t).toStringLong()},indexed_type:{_eq:n}},pagination:o?.pagination,orderBy:o?.orderBy};return Qi({aptosConfig:e,options:u})}async function Qi(r){let{aptosConfig:t,options:e}=r,n={query:gu,variables:{where_condition:e?.where,offset:e?.pagination?.offset,limit:e?.pagination?.limit,order_by:e?.orderBy}};return(await Ce({aptosConfig:t,query:n,originMethod:"getEvents"})).events}var Co=class{constructor(t){this.config=t}async getAccountEventsByCreationNumber(t){return _d({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return Ed({aptosConfig:this.config,...t})}async getEvents(t){return Qi({aptosConfig:this.config,...t})}};async function Sd(r){let{aptosConfig:t,accountAddress:e,amount:n,options:o}=r,s=o?.timeoutSecs||ro,{data:c}=await ws({aptosConfig:t,path:"fund",body:{address:k.fromRelaxed(e).toString(),amount:n},originMethod:"fundAccount"}),u=c.txn_hashes[0];return await Pi({aptosConfig:t,transactionHash:u,options:{timeoutSecs:s,checkSuccess:o?.checkSuccess,indexerVersionCheck:o?.indexerVersionCheck}}),u}var Io=class{constructor(t){this.config=t}async fundAccount(t){return Sd({aptosConfig:this.config,...t})}};async function $a(r){let{aptosConfig:t,options:e}=r,n={query:yu,variables:{where_condition:e?.where,limit:e?.pagination?.limit,offset:e?.pagination?.offset}};return(await Ce({aptosConfig:t,query:n,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Ud(r){let{aptosConfig:t,options:e}=r,n={query:hu,variables:{where_condition:e?.where,limit:e?.pagination?.limit,offset:e?.pagination?.offset}};return(await Ce({aptosConfig:t,query:n,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Cd(r){let{aptosConfig:t,options:e}=r,n={query:lu,variables:{where_condition:e?.where,limit:e?.pagination?.limit,offset:e?.pagination?.offset}};return(await Ce({aptosConfig:t,query:n,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var Bo=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return $a({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return(await $a({aptosConfig:this.config,options:{where:{asset_type:{_eq:t}}}}))[0]}async getFungibleAssetActivities(t){return Ud({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return Cd({aptosConfig:this.config,...t})}};var Ro=class{constructor(t){this.config=t}async getLedgerInfo(){return mi({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return bu({aptosConfig:this.config,...t})}async getBlockByHeight(t){return wu({aptosConfig:this.config,...t})}async getTableItem(t){return xi({aptosConfig:this.config,...t})}async view(t){return Ai({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return Tu({aptosConfig:this.config,...t})}async queryIndexer(t){return Ce({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return bi({aptosConfig:this.config})}};var Id=["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 Bd(r){return!(!r||r.length<3||r.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(r))}function Rd(r){let[t,e,...n]=r.replace(/\.apt$/,"").split(".");if(n.length>0)throw new Error(`${r} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!Bd(t))throw new Error(`${t} is not valid. ${Id}`);if(e&&!Bd(e))throw new Error(`${e} is not valid. ${Id}`);return{domainName:e||t,subdomainName:e?t:void 0}}var Dg="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",qg={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:Dg,custom:null,devnet:null};function Pd(r){let t=qg[r.network];if(!t)throw new Error(`The ANS contract is not deployed to ${r.network}`);return t}var Gg=r=>({vec:[r]}),Lg=()=>({vec:[]}),Fg=r=>r!=null?Gg(r):Lg(),Kg=r=>{if(r&&typeof r=="object"&&"vec"in r&&Array.isArray(r.vec))return r.vec[0]};async function kd(r){let{aptosConfig:t,name:e}=r,n=Pd(t),{domainName:o,subdomainName:s}=Rd(e),c=await Ai({aptosConfig:t,payload:{function:`${n}::router::get_owner_addr`,functionArguments:[o,Fg(s)]}}),u=Kg(c[0]);return u?k.fromRelaxed(u).toString():void 0}async function Od(r){let{aptosConfig:t,expiration:e,name:n,sender:o,targetAddress:s,toAddress:c,options:u}=r,p=Pd(t),{domainName:h,subdomainName:y}=Rd(n),x=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(y&&!x)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(x&&!y)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){if(e.years!==1)throw new Error("For now, names can only be registered for 1 year at a time");let _=e.years*31536e3;return await Ht({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[new Fe(h),new Le(_),new Nt(s?k.from(s):null),new Nt(c?k.from(c):null)]},options:u})}throw new Error(`Policy ${e.policy} is not supported yet`)}var Po=class{constructor(t){this.config=t}async getOwnerAddress(t){return kd({aptosConfig:this.config,...t})}async registerName(t){return Od({aptosConfig:this.config,...t})}};async function zd(r){let{aptosConfig:t,poolAddress:e}=r,n=k.fromRelaxed(e).toStringLong(),s=await Ce({aptosConfig:t,query:{query:ta,variables:{where_condition:{pool_address:{_eq:n}}}}});if(s.num_active_delegator_per_pool.length===0)throw Error("Delegator pool not found");return s.num_active_delegator_per_pool[0].num_active_delegator}async function Nd(r){let{aptosConfig:t,options:e}=r,n={query:ta,variables:{where_condition:{},order_by:e?.orderBy}};return(await Ce({aptosConfig:t,query:n})).num_active_delegator_per_pool}async function Md(r){let{aptosConfig:t,delegatorAddress:e,poolAddress:n}=r,o={query:pu,variables:{delegatorAddress:k.fromRelaxed(e).toStringLong(),poolAddress:k.fromRelaxed(n).toStringLong()}};return(await Ce({aptosConfig:t,query:o})).delegated_staking_activities}var ko=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return zd({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return Nd({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return Md({aptosConfig:this.config,...t})}};var Oo=class{constructor(t){this.config=t}async getTransactions(t){return td({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return rd({aptosConfig:this.config,...t})}async getTransactionByHash(t){return Ri({aptosConfig:this.config,...t})}async isPendingTransaction(t){return nd({aptosConfig:this.config,...t})}async waitForTransaction(t){return Pi({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return Bi({aptosConfig:this.config})}};var zo=class{constructor(t){this.config=t}async generateTransaction(t){return Ht({aptosConfig:this.config,...t})}signTransaction(t){let{signer:e,transaction:n,asFeePayer:o}=t;if("feePayerAddress"in n&&o)n.feePayerAddress=e.accountAddress;else if(o)throw new Error("Transaction being signed is not a Fee payer transaction, but `asFeePayer` is set to true");return La({signer:e,transaction:n})}async simulateTransaction(t){return pd({aptosConfig:this.config,...t})}async submitTransaction(t){return Fa({aptosConfig:this.config,...t})}async signAndSubmitTransaction(t){let{signer:e,transaction:n}=t;return Ka({aptosConfig:this.config,signer:e,transaction:n})}async publishPackageTransaction(t){return gd({aptosConfig:this.config,...t})}async rotateAuthKey(t){return hd({aptosConfig:this.config,...t})}};var yt=class{constructor(t){this.config=new ho(t),this.account=new lo(this.config),this.ans=new Po(this.config),this.coin=new So(this.config),this.digitalAsset=new Uo(this.config),this.event=new Co(this.config),this.faucet=new Io(this.config),this.fungibleAsset=new Bo(this.config),this.general=new Ro(this.config),this.staking=new ko(this.config),this.transaction=new Oo(this.config),this.transactionSubmission=new zo(this.config)}};function $t(r,t,e){Object.getOwnPropertyNames(t.prototype).forEach(n=>{let o=Object.getOwnPropertyDescriptor(t.prototype,n);o&&(o.value=function(...s){return this[e][n](...s)},Object.defineProperty(r.prototype,n,o))})}$t(yt,lo,"account");$t(yt,Po,"ans");$t(yt,So,"coin");$t(yt,Uo,"digitalAsset");$t(yt,Co,"event");$t(yt,Io,"faucet");$t(yt,Bo,"fungibleAsset");$t(yt,Ro,"general");$t(yt,ko,"staking");$t(yt,Oo,"transaction");$t(yt,zo,"transactionSubmission");return Vd(Hg);})();
|
|
427
|
+
`;async function _i(r){let{aptosConfig:t}=r,{data:e}=await ht({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function Pu(r){let{aptosConfig:t,ledgerVersion:e,options:n}=r,{data:o}=await ht({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:n?.withTransactions}});return o}async function Ou(r){let{aptosConfig:t,blockHeight:e,options:n}=r,{data:o}=await ht({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:n?.withTransactions}});return o}async function vi(r){let{aptosConfig:t,handle:e,data:n,options:o}=r;return(await Kr({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:o?.ledgerVersion},body:n})).data}async function kr(r){let{aptosConfig:t,payload:e,options:n}=r,{data:o}=await Kr({aptosConfig:t,originMethod:"view",path:"view",params:{ledger_version:n?.ledgerVersion},body:{function:e.function,type_arguments:e.typeArguments??[],arguments:e.functionArguments??[]}});return o}async function ku(r){let{aptosConfig:t,limit:e}=r;return(await xe({aptosConfig:t,query:{query:Tu,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function xe(r){let{aptosConfig:t,query:e,originMethod:n}=r,{data:o}=await Bs({aptosConfig:t,originMethod:n??"queryIndexer",path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return o}async function Qp(r){let{aptosConfig:t}=r;return(await xe({aptosConfig:t,query:{query:Bu},originMethod:"getProcessorStatuses"})).processor_status}async function Si(r){return(await Qp({aptosConfig:r.aptosConfig}))[0].last_success_version}var pa=new Map;function Dn(r,t,e){return async(...n)=>{if(pa.has(t)){let{value:s,timestamp:c}=pa.get(t);if(e===void 0||Date.now()-c<=e)return s}let o=await r(...n);return pa.set(t,{value:o,timestamp:Date.now()}),o}}async function cn(r){let{aptosConfig:t,accountAddress:e}=r,{data:n}=await ht({aptosConfig:t,originMethod:"getInfo",path:`accounts/${O.from(e).toString()}`});return n}async function Mu(r){let{aptosConfig:t,accountAddress:e,options:n}=r;return Fr({aptosConfig:t,originMethod:"getModules",path:`accounts/${O.from(e).toString()}/modules`,params:{ledger_version:n?.ledgerVersion,start:n?.offset,limit:n?.limit??1e3}})}async function Ei(r){return r.options?.ledgerVersion!==void 0?Nu(r):Dn(async()=>Nu(r),`module-${r.accountAddress}-${r.moduleName}`,1e3*60*5)()}async function Nu(r){let{aptosConfig:t,accountAddress:e,moduleName:n,options:o}=r,{data:s}=await ht({aptosConfig:t,originMethod:"getModule",path:`accounts/${O.from(e).toString()}/module/${n}`,params:{ledger_version:o?.ledgerVersion}});return s}async function Du(r){let{aptosConfig:t,accountAddress:e,options:n}=r;return Fr({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${O.from(e).toString()}/transactions`,params:{start:n?.offset,limit:n?.limit}})}async function Gu(r){let{aptosConfig:t,accountAddress:e,options:n}=r;return Fr({aptosConfig:t,originMethod:"getResources",path:`accounts/${O.from(e).toString()}/resources`,params:{ledger_version:n?.ledgerVersion,start:n?.offset,limit:n?.limit??999}})}async function ga(r){let{aptosConfig:t,accountAddress:e,resourceType:n,options:o}=r,{data:s}=await ht({aptosConfig:t,originMethod:"getResource",path:`accounts/${O.from(e).toString()}/resource/${n}`,params:{ledger_version:o?.ledgerVersion}});return s.data}async function ya(r){let{aptosConfig:t,authenticationKey:e,options:n}=r,o=await ga({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:n}),{address_map:{handle:s}}=o,c=O.from(e);try{let u=await vi({aptosConfig:t,handle:s,data:{key:c.toString(),key_type:"address",value_type:"address"},options:n});return O.from(u)}catch(u){if(u instanceof $t&&u.data.error_code==="table_item_not_found")return c;throw u}}async function qu(r){let{aptosConfig:t,accountAddress:e}=r,o={owner_address:{_eq:O.from(e).toStringLong()},amount:{_gt:0}},c=await xe({aptosConfig:t,query:{query:bu,variables:{where_condition:o}},originMethod:"getAccountTokensCount"});if(!c.current_token_ownerships_v2_aggregate.aggregate)throw Error("Failed to get the count of account tokens");return c.current_token_ownerships_v2_aggregate.aggregate.count}async function Lu(r){let{aptosConfig:t,accountAddress:e,options:n}=r,s={owner_address:{_eq:O.from(e).toStringLong()},amount:{_gt:0}};n?.tokenStandard&&(s.token_standard={_eq:n?.tokenStandard});let c={query:xu,variables:{where_condition:s,offset:n?.pagination?.offset,limit:n?.pagination?.limit,order_by:n?.orderBy}};return(await xe({aptosConfig:t,query:c,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Fu(r){let{aptosConfig:t,accountAddress:e,collectionAddress:n,options:o}=r,s=O.from(e).toStringLong(),c=O.from(n).toStringLong(),u={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:c}},amount:{_gt:0}};o?.tokenStandard&&(u.token_standard={_eq:o?.tokenStandard});let p={query:Au,variables:{where_condition:u,offset:o?.pagination?.offset,limit:o?.pagination?.limit,order_by:o?.orderBy}};return(await xe({aptosConfig:t,query:p,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function Ku(r){let{aptosConfig:t,accountAddress:e,options:n}=r,s={owner_address:{_eq:O.from(e).toStringLong()},amount:{_gt:0}};n?.tokenStandard&&(s.current_collection={token_standard:{_eq:n?.tokenStandard}});let c={query:hu,variables:{where_condition:s,offset:n?.pagination?.offset,limit:n?.pagination?.limit,order_by:n?.orderBy}};return(await xe({aptosConfig:t,query:c,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function Hu(r){let{aptosConfig:t,accountAddress:e}=r,n=O.from(e).toStringLong(),s=await xe({aptosConfig:t,query:{query:wu,variables:{address:n}},originMethod:"getAccountTransactionsCount"});if(!s.account_transactions_aggregate.aggregate)throw Error("Failed to get the count of account transactions");return s.account_transactions_aggregate.aggregate.count}async function $u(r){let{aptosConfig:t,accountAddress:e,options:n}=r,s={owner_address:{_eq:O.from(e).toStringLong()}},c={query:yu,variables:{where_condition:s,offset:n?.pagination?.offset,limit:n?.pagination?.limit,order_by:n?.orderBy}};return(await xe({aptosConfig:t,query:c,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Vu(r){let{aptosConfig:t,accountAddress:e}=r,n=O.from(e).toStringLong(),s=await xe({aptosConfig:t,query:{query:gu,variables:{address:n}},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 Qu(r){let{aptosConfig:t,accountAddress:e,options:n}=r,s={owner_address:{_eq:O.from(e).toStringLong()}},c={query:mu,variables:{where_condition:s,offset:n?.pagination?.offset,limit:n?.pagination?.limit,order_by:n?.orderBy}};return(await xe({aptosConfig:t,query:c,originMethod:"getAccountOwnedObjects"})).current_objects}async function ju(r){let{aptosConfig:t,privateKey:e}=r,n=new je(e.publicKey());if(e instanceof cr){let s=Ft.fromPublicKeyAndScheme({publicKey:n,scheme:2}).derivedAddress();return dr.fromPrivateKeyAndAddress({privateKey:e,address:s})}if(e instanceof or){let o=Ft.fromPublicKeyAndScheme({publicKey:n,scheme:2});if(await zu({authKey:o,aptosConfig:t})){let p=o.derivedAddress();return dr.fromPrivateKeyAndAddress({privateKey:e,address:p,legacy:!1})}let c=Ft.fromPublicKeyAndScheme({publicKey:n,scheme:0});if(await zu({authKey:c,aptosConfig:t})){let p=c.derivedAddress();return dr.fromPrivateKeyAndAddress({privateKey:e,address:p,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function zu(r){let{aptosConfig:t,authKey:e}=r,n=await ya({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await cn({aptosConfig:t,accountAddress:n}),!0}catch(o){if(o.status===404)return!1;throw new Error(`Error while looking for an account info ${n.toString()}`)}}var mo=class{constructor(t){this.config=t}async getAccountInfo(t){return cn({aptosConfig:this.config,...t})}async getAccountModules(t){return Mu({aptosConfig:this.config,...t})}async getAccountModule(t){return Ei({aptosConfig:this.config,...t})}async getAccountTransactions(t){return Du({aptosConfig:this.config,...t})}async getAccountResources(t){return Gu({aptosConfig:this.config,...t})}async getAccountResource(t){return ga({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return ya({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return qu({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return Lu({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return Fu({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return Ku({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return Hu({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return $u({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return Vu({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return Qu({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return ju({aptosConfig:this.config,...t})}};var dd=gc(fd(),1);async function ld(r){var t;let{params:e,method:n,url:o,headers:s,body:c,overrides:u}=r,p={headers:s,method:n,url:o,params:e,data:c,withCredentials:(t=u?.WITH_CREDENTIALS)!=null?t:!0};try{let y=await(0,dd.default)(p);return{status:y.status,statusText:y.statusText,data:y.data,headers:y.headers,config:y.config}}catch(y){let h=y;if(h.response)return h.response;throw y}}var bo=class{constructor(t){this.network=t?.network??vs,this.fullnode=t?.fullnode,this.faucet=t?.faucet,this.indexer=t?.indexer,this.client=t?.client??{provider:ld},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 Ts[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 _s[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 Wo[this.network];default:throw Error(`apiType ${t} is not supported`)}}isIndexerRequest(t){return Wo[this.network]===t}};var wo=class extends Z{constructor(e){super();this.accountAddress=O.ONE;this.moduleName=new Xe("account");this.structName=new Xe("RotationProofChallenge");this.sequenceNumber=new Ye(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=Ie.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 pr=class r extends Gt{constructor(e){super();this.signature=e}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(e){if(this.signature instanceof Le)e.serializeU32AsUleb128(0),this.signature.serialize(e);else if(this.signature instanceof ur)e.serializeU32AsUleb128(1),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let n=e.deserializeUleb128AsU32();switch(n){case 0:return new r(Le.load(e));case 1:return new r(ur.load(e));default:throw new Error(`Unknown variant index for AnySignature: ${n}`)}}};async function Da(r){return new Promise(t=>{setTimeout(t,r)})}async function pd(r){let{aptosConfig:t,options:e}=r;return Fr({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:e?.offset,limit:e?.limit}})}async function Ni(r){let{aptosConfig:t}=r;return Dn(async()=>{let{data:e}=await ht({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function gd(r){let{aptosConfig:t,ledgerVersion:e}=r,{data:n}=await ht({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return n}async function zi(r){let{aptosConfig:t,transactionHash:e}=r,{data:n}=await ht({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return n}async function yd(r){let{aptosConfig:t,transactionHash:e}=r;try{return(await zi({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(n){if(n?.status===404)return!0;throw n}}async function Mi(r){let{aptosConfig:t,transactionHash:e,options:n}=r,o=n?.timeoutSecs??co,s=n?.checkSuccess??!0,c=n?.indexerVersionCheck??!0,u=!0,p=0,y,h,x=200,C=1.5;for(;u&&!(p>=o);){try{if(y=await zi({aptosConfig:t,transactionHash:e}),u=y.type==="pending_transaction",!u)break}catch(T){if(!(T instanceof $t)||(h=T,T.status!==404&&T.status>=400&&T.status<500))throw T}await Da(x),p+=x/1e3,x*=C}if(y===void 0)throw h||new To(`Fetching transaction ${e} failed and timed out after ${o} seconds`,y);if(y.type==="pending_transaction")throw new To(`Transaction ${e} timed out in pending state after ${o} seconds`,y);if(!s)return y;if(!y.success)throw new Ga(`Transaction ${e} failed with an error: ${y.vm_status}`,y);if(c)try{await Yg({aptosConfig:t,ledgerVersion:Number(y.version)})}catch{throw new To(`Transaction ${e} committed, but timed out waiting for indexer to sync with ledger version ${y.version}.You can disable this check by setting \`indexerVersionCheck\` to false in the \`extraArgs\` parameter.`,y)}return y}async function Yg(r){let{aptosConfig:t,ledgerVersion:e}=r,n=3e3,o=new Date().getTime(),s=-1;for(;s<e;){if(new Date().getTime()-o>n)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(s=await Si({aptosConfig:t}),s>=e)break;await Da(200)}}var To=class extends Error{constructor(e,n){super(e);this.lastSubmittedTransaction=n}},Ga=class extends Error{constructor(e,n){super(e);this.transaction=n}};var At=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return gr.load(t);case 1:return Di.load(t);case 2:return jt.load(t);case 3:return Hn.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}},gr=class r extends At{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Pe.deserialize(e),o=Le.deserialize(e);return new r(n,o)}},Di=class r extends At{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=qt.deserialize(e),o=Jr.deserialize(e);return new r(n,o)}},jt=class r extends At{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=je.deserialize(e),o=pr.deserialize(e);return new r(n,o)}},Hn=class r extends At{constructor(e,n,o){super();this.public_keys=e,this.signatures=n,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 n=an.deserialize(e),o=e.deserializeVector(pr),s=e.deserializeBytes();return new r(n,o,s)}};var Wt=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return dn.load(t);case 1:return Gi.load(t);case 2:return ln.load(t);case 3:return pn.load(t);case 4:return gn.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},dn=class r extends Wt{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Pe.deserialize(e),o=Le.deserialize(e);return new r(n,o)}},Gi=class r extends Wt{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=qt.deserialize(e),o=Jr.deserialize(e);return new r(n,o)}},ln=class r extends Wt{constructor(e,n,o){super();this.sender=e,this.secondary_signer_addresses=n,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 n=At.deserialize(e),o=e.deserializeVector(O),s=e.deserializeVector(At);return new r(n,o,s)}},pn=class r extends Wt{constructor(e,n,o,s){super();this.sender=e,this.secondary_signer_addresses=n,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 n=At.deserialize(e),o=e.deserializeVector(O),s=e.deserializeVector(At),c=O.deserialize(e),u=At.deserialize(e),p={address:c,authenticator:u};return new r(n,o,s,p)}},gn=class r extends Wt{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let n=At.deserialize(e);return new r(n)}};var yn=class r extends Z{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let n=e.deserializeU8();return new r(n)}};var ze=class r extends Z{constructor(e){super();this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let n=e.deserializeStr();return new r(n)}};var $n=class r extends Z{constructor(e,n){super();this.address=e,this.name=n}static fromStr(e){let n=e.split("::");if(n.length!==2)throw new Error("Invalid module id.");return new r(O.fromStringRelaxed(n[0]),new ze(n[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let n=O.deserialize(e),o=ze.deserialize(e);return new r(n,o)}};var Ke=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return hn.load(t);case 1:return mn.load(t);case 2:return bn.load(t);case 3:return wn.load(t);case 4:return _n.load(t);case 5:return zr.load(t);case 6:return Sn.load(t);case 7:return yr.load(t);case 8:return xn.load(t);case 9:return An.load(t);case 10:return Tn.load(t);case 255:return vn.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof hn}isAddress(){return this instanceof _n}isGeneric(){return this instanceof vn}isSigner(){return this instanceof zr}isVector(){return this instanceof Sn}isStruct(){return this instanceof yr}isU8(){return this instanceof mn}isU16(){return this instanceof xn}isU32(){return this instanceof An}isU64(){return this instanceof bn}isU128(){return this instanceof wn}isU256(){return this instanceof Tn}},hn=class r extends Ke{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new r}},mn=class r extends Ke{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new r}},xn=class r extends Ke{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new r}},An=class r extends Ke{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new r}},bn=class r extends Ke{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new r}},wn=class r extends Ke{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new r}},Tn=class r extends Ke{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new r}},_n=class r extends Ke{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new r}},zr=class r extends Ke{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new r}},_o=class r extends Ke{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let n=Ke.deserialize(e);return new r(n)}},vn=class r extends Ke{constructor(e){super();this.value=e}toString(){return`T${this.value}`}serialize(e){e.serializeU32AsUleb128(255),e.serializeU32(this.value)}static load(e){let n=e.deserializeU32();return new r(n)}},Sn=class r extends Ke{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 n=Ke.deserialize(e);return new r(n)}},yr=class r extends Ke{constructor(e){super();this.value=e}toString(){let e="";return this.value.typeArgs.length>0&&(e=`<${this.value.typeArgs.map(n=>n.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 n=Yt.deserialize(e);return new r(n)}isTypeTag(e,n,o){return this.value.moduleName.identifier===n&&this.value.name.identifier===o&&this.value.address.equals(e)}isString(){return this.isTypeTag(O.ONE,"string","String")}isOption(){return this.isTypeTag(O.ONE,"option","Option")}isObject(){return this.isTypeTag(O.ONE,"object","Object")}},Yt=class r extends Z{constructor(e,n,o,s){super();this.address=e,this.moduleName=n,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 n=O.deserialize(e),o=ze.deserialize(e),s=ze.deserialize(e),c=e.deserializeVector(Ke);return new r(n,o,s,c)}};function Xg(){return new Yt(O.ONE,new ze("aptos_coin"),new ze("AptosCoin"),[])}function Zg(){return new Yt(O.ONE,new ze("string"),new ze("String"),[])}function Jg(r){return new Yt(O.ONE,new ze("option"),new ze("Option"),[r])}function ey(r){return new Yt(O.ONE,new ze("object"),new ze("Object"),[r])}function hd(r){let t=r.deserializeUleb128AsU32();switch(t){case 0:return st.deserialize(r);case 1:return Ye.deserialize(r);case 2:return Bt.deserialize(r);case 3:return O.deserialize(r);case 4:return Ie.deserialize(r,st);case 5:return qe.deserialize(r);case 6:return Ct.deserialize(r);case 7:return Ut.deserialize(r);case 8:return It.deserialize(r);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var Mr=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Vn.load(t);case 2:return Qn.load(t);case 3:return jn.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},Vn=class r extends Mr{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let n=Wn.deserialize(e);return new r(n)}},Qn=class r extends Mr{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let n=En.deserialize(e);return new r(n)}},jn=class r extends Mr{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let n=Yn.deserialize(e);return new r(n)}},En=class r{constructor(t,e,n,o){this.module_name=t,this.function_name=e,this.type_args=n,this.args=o}static build(t,e,n,o){return new r($n.fromStr(t),new ze(e),n,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=$n.deserialize(t),n=ze.deserialize(t),o=t.deserializeVector(Ke),s=t.deserializeUleb128AsU32(),c=new Array;for(let u=0;u<s;u+=1){let p=t.deserializeUleb128AsU32(),y=lo.deserialize(t,p);c.push(y)}return new r(e,n,o,c)}},Wn=class r{constructor(t,e,n){this.bytecode=t,this.type_args=e,this.args=n}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(),n=t.deserializeVector(Ke),o=t.deserializeUleb128AsU32(),s=new Array;for(let c=0;c<o;c+=1){let u=hd(t);s.push(u)}return new r(e,n,s)}},Yn=class r{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=O.deserialize(t),n=t.deserializeBool(),o;return n&&(o=Xn.deserialize(t)),new r(e,o)}},Xn=class r{constructor(t){this.transaction_payload=t}serialize(t){t.serializeU32AsUleb128(0),this.transaction_payload.serialize(t)}static deserialize(t){return t.deserializeUleb128AsU32(),new r(En.deserialize(t))}};var Xt=class r extends Z{constructor(e,n,o,s,c,u,p){super();this.sender=e,this.sequence_number=n,this.payload=o,this.max_gas_amount=s,this.gas_unit_price=c,this.expiration_timestamp_secs=u,this.chain_id=p}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 n=O.deserialize(e),o=e.deserializeU64(),s=Mr.deserialize(e),c=e.deserializeU64(),u=e.deserializeU64(),p=e.deserializeU64(),y=yn.deserialize(e);return new r(n,o,s,c,u,p,y)}},vo=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return hr.load(t);case 1:return mr.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},hr=class r extends vo{constructor(e,n){super();this.raw_txn=e,this.secondary_signer_addresses=n}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let n=Xt.deserialize(e),o=e.deserializeVector(O);return new r(n,o)}},mr=class r extends vo{constructor(e,n,o){super();this.raw_txn=e,this.secondary_signer_addresses=n,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 n=Xt.deserialize(e),o=e.deserializeVector(O),s=O.deserialize(e);return new r(n,o,s)}};var Ht=class r extends Z{constructor(e,n){super();this.raw_txn=e,this.authenticator=n}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let n=Xt.deserialize(e),o=Wt.deserialize(e);return new r(n,o)}};function md(r){return!!r.match(/^[_a-zA-Z0-9]+$/)}function xd(r){return!!r.match(/\s/)}function ty(r){return!!r.match(/^T[0-9]+$/)}function ry(r,t){let e=t;for(;e<r.length;e+=1){let n=r[e];if(!xd(n))break}return e}var Ad=(C=>(C.InvalidTypeTag="unknown type",C.UnexpectedGenericType="unexpected generic type",C.UnexpectedTypeArgumentClose="unexpected '>'",C.UnexpectedWhitespaceCharacter="unexpected whitespace character",C.UnexpectedComma="unexpected ','",C.TypeArgumentCountMismatch="type argument count doesn't match expected amount",C.MissingTypeArgumentClose="no matching '>' for '<'",C.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",C.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",C.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",C.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",C.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",C))(Ad||{}),ke=class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function Zn(r,t){let e=t?.allowGenerics??!1,n=[],o=[],s=[],c=0,u="",p=1;for(;c<r.length;){let y=r[c];if(y==="<")n.push({savedExpectedTypes:p,savedStr:u,savedTypes:s}),u="",s=[],p=1;else if(y===">"){if(u!==""){let z=qi(u,o,e);s.push(z)}let h=n.pop();if(h===void 0)throw new ke(r,"unexpected '>'");if(p!==s.length)throw new ke(r,"type argument count doesn't match expected amount");let{savedStr:x,savedTypes:C,savedExpectedTypes:T}=h;o=s,s=C,u=x,p=T}else if(y===","){if(u.length!==0){let h=qi(u,o,e);o=[],s.push(h),u="",p+=1}}else if(xd(y)){let h=!1;if(u.length!==0){let C=qi(u,o,e);o=[],s.push(C),u="",h=!0}c=ry(r,c);let x=r[c];if(c<r.length&&h&&x!==","&&x!==">")throw new ke(r,"unexpected whitespace character");continue}else u+=y;c+=1}if(n.length>0)throw new ke(r,"no matching '>' for '<'");switch(s.length){case 0:return qi(u,o,e);case 1:if(u==="")return s[0];throw new ke(r,"unexpected ','");default:throw new ke(r,"unexpected whitespace character")}}function qi(r,t,e){switch(r){case"&signer":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new _o(new zr);case"signer":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new zr;case"bool":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new hn;case"address":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new _n;case"u8":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new mn;case"u16":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new xn;case"u32":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new An;case"u64":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new bn;case"u128":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new wn;case"u256":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new Tn;case"vector":if(t.length!==1)throw new ke(r,"vector type expected to have exactly one type argument");return new Sn(t[0]);default:if(ty(r)){if(e)return new vn(Number(r.split("T")[1]));throw new ke(r,"unexpected generic type")}if(!r.match(/.*:.*/))throw new ke(r,"unknown type");let n=r.split("::");if(n.length!==3)throw new ke(r,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!md(n[1]))throw new ke(r,"module name must only contain alphanumeric or '_' characters");if(!md(n[2]))throw new ke(r,"struct name must only contain alphanumeric or '_' characters");return new yr(new Yt(O.fromStringRelaxed(n[0]),new ze(n[1]),new ze(n[2]),t))}}function qa(r){return typeof r=="boolean"}function Cn(r){return typeof r=="string"}function So(r){return typeof r=="number"}function Eo(r){return typeof r=="number"||typeof r=="bigint"||typeof r=="string"}function La(r){return r==null}function Li(r){return r instanceof qe}function Co(r){return r instanceof O}function Fi(r){return r instanceof Xe}function Fa(r){return r instanceof Sr}function Ki(r){return r instanceof st}function Hi(r){return r instanceof Ct}function $i(r){return r instanceof Ut}function Vi(r){return r instanceof Ye}function Qi(r){return r instanceof Bt}function ji(r){return r instanceof It}function Wi(r){return"bytecode"in r}function Ne(r,t){throw new Error(`Type mismatch for argument ${t}, expected '${r}'`)}function Ka(r){let t=r.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?r.params.length:t}function Yi(r){let t=r.split("::");if(t.length!==3)throw new Error(`Invalid function ${r}`);let e=t[0],n=t[1],o=t[2];return{moduleAddress:e,moduleName:n,functionName:o}}function Ha(r){return r?.map(t=>Cn(t)?Zn(t):t)??[]}async function $a(r,t,e,n){let s=(await Ei({aptosConfig:n,accountAddress:r,moduleName:t})).abi?.exposed_functions.find(p=>p.name===e);if(!s)throw new Error(`Could not find entry function ABI for '${r}::${t}::${e}'`);if(!s.is_entry)throw new Error(`'${r}::${t}::${e}' is not an entry function`);let c=Ka(s),u=[];for(let p=c;p<s.params.length;p+=1)u.push(Zn(s.params[p],{allowGenerics:!0}));return{typeParameters:s.generic_type_params,parameters:u}}function Va(r,t,e,n,o){if(n>=t.parameters.length)throw new Error(`Too many arguments for '${r}', expected ${t.parameters.length}`);return Li(e)||Ki(e)||Hi(e)||$i(e)||Vi(e)||Qi(e)||ji(e)||Co(e)||Fi(e)||Fa(e)||e instanceof Ie||e instanceof Er?(ny(t,e,n),e):Xi(e,t.parameters[n],n,o)}function Xi(r,t,e,n){if(t.isBool()){if(qa(r))return new qe(r);Ne("boolean",e)}if(t.isAddress()){if(Cn(r))return O.fromStringRelaxed(r);Ne("string",e)}if(t.isU8()){if(So(r))return new st(r);Ne("number",e)}if(t.isU16()){if(So(r))return new Ct(r);Ne("number",e)}if(t.isU32()){if(So(r))return new Ut(r);Ne("number",e)}if(t.isU64()){if(Eo(r))return new Ye(BigInt(r));Ne("bigint | number | string",e)}if(t.isU128()){if(Eo(r))return new Bt(BigInt(r));Ne("bigint | number | string",e)}if(t.isU256()){if(Eo(r))return new It(BigInt(r));Ne("bigint | number | string",e)}if(t.isGeneric()){let o=t.value;if(o<0||o>=n.length)throw new Error(`Generic argument ${t.toString()} is invalid for argument ${e}`);Xi(r,n[o],e,n)}if(t.isVector()){if(t.value.isU8()&&Cn(r))return Ie.U8(me.fromHexInput(r).toUint8Array());if(Array.isArray(r))return new Ie(r.map(o=>Xi(o,t.value,e,n)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(Cn(r))return new Xe(r);Ne("string",e)}if(t.isObject()){if(Cn(r))return O.fromStringRelaxed(r);Ne("string",e)}if(t.isOption())return La(r)?new Er(null):new Er(Xi(r,t.value.typeArgs[0],e,n));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 ny(r,t,e){let n=r.parameters[e];if(n.isBool()){if(Li(t))return;Ne("Bool",e)}if(n.isAddress()){if(Co(t))return;Ne("AccountAddress",e)}if(n.isU8()){if(Ki(t))return;Ne("U8",e)}if(n.isU16()){if(Hi(t))return;Ne("U16",e)}if(n.isU32()){if($i(t))return;Ne("U32",e)}if(n.isU64()){if(Vi(t))return;Ne("U64",e)}if(n.isU128()){if(Qi(t))return;Ne("U128",e)}if(n.isU256()){if(ji(t))return;Ne("U256",e)}if(n.isVector()){if(t instanceof Ie)return;Ne("MoveVector",e)}if(n instanceof yr){if(n.isString()){if(Fi(t))return;Ne("MoveString",e)}if(n.isObject()){if(Co(t))return;Ne("AccountAddress",e)}if(n.isOption()){if(t instanceof Er)return;Ne("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${n.toString()}'`)}async function Bo(r){if(Wi(r))return wd(r);let{moduleAddress:t,moduleName:e,functionName:n}=Yi(r.function),o=await Dn(async()=>$a(t,e,n,r.aptosConfig),`entry-function-${r.aptosConfig.network}-${t}-${e}-${n}`,1e3*60*5)();return bd(r,o)}function bd(r,t){if(Wi(r))return wd(r);let{moduleAddress:e,moduleName:n,functionName:o}=Yi(r.function),s=Ha(r.typeArguments);if(s.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${s.length}`);let c=r.functionArguments.map((p,y)=>Va(r.function,t,p,y,s));if(c.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${n}::${o}', expected ${t.parameters.length} but got ${c.length}`);let u=En.build(`${e}::${n}`,o,s,c);if("multisigAddress"in r){let p;return typeof r.multisigAddress=="string"?p=O.from(r.multisigAddress):p=r.multisigAddress,new jn(new Yn(p,new Xn(u)))}return new Qn(u)}function wd(r){return new Vn(new Wn(me.fromHexInput(r.bytecode).toUint8Array(),r.typeArguments??[],r.functionArguments))}async function Td(r){let{aptosConfig:t,sender:e,payload:n,options:o}=r,s=o?.accountSequenceNumber?Promise.resolve({sequence_number:o.accountSequenceNumber}):cn({aptosConfig:t,accountAddress:e}),c=Yo[t.network]?Promise.resolve({chain_id:Yo[t.network]}):_i({aptosConfig:t}),u=o?.gasUnitPrice?Promise.resolve({gas_estimate:o.gasUnitPrice}):Ni({aptosConfig:t}),[{sequence_number:p},{chain_id:y},{gas_estimate:h}]=await Promise.all([s,c,u]),{maxGasAmount:x,gasUnitPrice:C,expireTimestamp:T}={maxGasAmount:o?.maxGasAmount?BigInt(o.maxGasAmount):BigInt(Ss),gasUnitPrice:BigInt(h),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+Es),...o};return new Xt(O.fromRelaxed(e),BigInt(p),n,BigInt(x),BigInt(C),BigInt(T),new yn(y))}async function Zi(r){let{aptosConfig:t,sender:e,payload:n,options:o}=r,s=await Td({aptosConfig:t,sender:e,payload:n,options:o});if("secondarySignerAddresses"in r){let c=r.secondarySignerAddresses?.map(u=>O.fromRelaxed(u))??[];return{rawTransaction:s,secondarySignerAddresses:c,feePayerAddress:r.feePayerAddress?O.fromRelaxed(r.feePayerAddress):void 0}}return{rawTransaction:s,feePayerAddress:r.feePayerAddress?O.fromRelaxed(r.feePayerAddress):void 0}}function Qa(r){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:n,feePayerPublicKey:o}=r,s=Uo(t);if(e.feePayerAddress){let u=new mr(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress),p=[];n&&(p=n.map(x=>Uo(x)));let y=Uo(o),h=new pn(s,e.secondarySignerAddresses??[],p,{address:e.feePayerAddress,authenticator:y});return new Ht(u.raw_txn,h).bcsToBytes()}if(e.secondarySignerAddresses){let u=new hr(e.rawTransaction,e.secondarySignerAddresses),p=[];p=n.map(h=>Uo(h));let y=new ln(s,e.secondarySignerAddresses,p);return new Ht(u.raw_txn,y).bcsToBytes()}let c;if(s instanceof gr)c=new dn(s.public_key,s.signature);else if(s instanceof jt)c=new gn(s);else throw new Error("Invalid public key");return new Ht(e.rawTransaction,c).bcsToBytes()}function Uo(r){if(r instanceof je){if(r.publicKey instanceof Pe)return new jt(r,new pr(new Le(new Uint8Array(64))));if(r.publicKey instanceof Lt)return new jt(r,new pr(new ur(new Uint8Array(64))))}return new gr(new Pe(r.toUint8Array()),new Le(new Uint8Array(64)))}function ja(r){let{signer:t,transaction:e}=r,n=Ya(e),o=vd(n),s=t.sign(o);switch(t.signingScheme){case 0:return new gr(new Pe(t.publicKey.toUint8Array()),new Le(s.toUint8Array()));case 2:return new jt(t.publicKey,new pr(s));default:throw new Error(`Cannot sign transaction, signing scheme ${t.signingScheme} not supported`)}}function Wa(r){let{transaction:t,senderAuthenticator:e,feePayerAuthenticator:n,additionalSignersAuthenticators:o}=r,s=Ya(t);if(n||o)return _d(s,e,n,o);if(e instanceof gr){let c=new dn(e.public_key,e.signature);return new Ht(s,c).bcsToBytes()}if(e instanceof jt||e instanceof Hn){let c=new gn(e);return new Ht(s,c).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${e} is not a supported account authentication scheme`)}function Ya(r){return r.feePayerAddress?new mr(r.rawTransaction,r.secondarySignerAddresses??[],r.feePayerAddress):r.secondarySignerAddresses?new hr(r.rawTransaction,r.secondarySignerAddresses):r.rawTransaction}function _d(r,t,e,n){if(r instanceof mr){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let o=new pn(t,r.secondary_signer_addresses,n??[],{address:r.fee_payer_address,authenticator:e});return new Ht(r.raw_txn,o).bcsToBytes()}if(r instanceof hr){if(!n)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let o=new ln(t,r.secondary_signer_addresses,n??[]);return new Ht(r.raw_txn,o).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof r} transaction is not supported`)}function vd(r){let t=jr.create();if(r instanceof Xt)t.update(Us);else if(r instanceof hr)t.update(Xo);else if(r instanceof mr)t.update(Xo);else throw new Error(`Unknown transaction type to sign on: ${r}`);let e=t.digest(),n=r.bcsToBytes(),o=new Uint8Array(e.length+n.length);return o.set(e),o.set(n,e.length),o}async function at(r){let{aptosConfig:t,sender:e,data:n,options:o}=r,s,c;"bytecode"in n?(s=n,c=await Bo(s)):"multisigAddress"in n?(s={aptosConfig:t,multisigAddress:n.multisigAddress,function:n.function,functionArguments:n.functionArguments,typeArguments:n.typeArguments},c=await Bo(s)):(s={aptosConfig:t,function:n.function,functionArguments:n.functionArguments,typeArguments:n.typeArguments},c=await Bo(s));let u;if(oy(r)&&(u=O.ZERO.toString()),iy(r)){let{secondarySignerAddresses:p}=r;return Zi({aptosConfig:t,sender:e,payload:c,options:o,secondarySignerAddresses:p,feePayerAddress:u})}return Zi({aptosConfig:t,sender:e,payload:c,options:o,feePayerAddress:u})}function oy(r){return r.withFeePayer===!0}function iy(r){return"secondarySignerAddresses"in r}function Ji(r){return ja({...r})}async function Xa(r){let{aptosConfig:t,transaction:e,signerPublicKey:n,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:c}=r,u=Qa({transaction:e,signerPublicKey:n,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:c}),{data:p}=await Kr({aptosConfig:t,body:u,path:"transactions/simulate",params:{estimate_gas_unit_price:r.options?.estimateGasUnitPrice??!1,estimate_max_gas_amount:r.options?.estimateMaxGasAmount??!1,estimate_prioritized_gas_unit_price:r.options?.estimatePrioritizedGasUnitPrice??!1},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return p}async function es(r){let{aptosConfig:t}=r,e=Wa({...r}),{data:n}=await Kr({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return n}async function Za(r){let{aptosConfig:t,signer:e,transaction:n}=r,o=Ji({signer:e,transaction:n});return es({aptosConfig:t,transaction:n,senderAuthenticator:o})}async function Sd(r){let{aptosConfig:t,account:e,metadataBytes:n,moduleBytecode:o,options:s}=r,c=o.map(p=>Ie.U8(p));return await at({aptosConfig:t,sender:O.fromRelaxed(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[Ie.U8(n),new Ie(c)]},options:s})}async function Ed(r){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:n}=r,o=await cn({aptosConfig:t,accountAddress:e.accountAddress.toString()}),s=dr.fromPrivateKey({privateKey:n,legacy:!0}),u=new wo({sequenceNumber:BigInt(o.sequence_number),originator:e.accountAddress,currentAuthKey:O.from(o.authentication_key),newPublicKey:s.publicKey}).bcsToBytes(),p=e.sign(u),y=s.sign(u),h=await at({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new st(e.signingScheme.valueOf()),Ie.U8(e.publicKey.toUint8Array()),new st(s.signingScheme.valueOf()),Ie.U8(s.publicKey.toUint8Array()),Ie.U8(p.toUint8Array()),Ie.U8(y.toUint8Array())]}});return await Za({aptosConfig:t,signer:e,transaction:h})}async function Cd(r){let{aptosConfig:t,sender:e,recipient:n,amount:o,coinType:s,options:c}=r,u=s??Cs;return await at({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[Zn(u)],functionArguments:[O.from(n),new Ye(o)]},options:c})}var Io=class{constructor(t){this.config=t}async transferCoinTransaction(t){return Cd({aptosConfig:this.config,...t})}};async function Ud(r){let{aptosConfig:t,options:e,creator:n}=r;return await at({aptosConfig:t,sender:n.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new Xe(r.collection),new Xe(r.description),new Xe(r.name),new Xe(r.uri),Ie.MoveString([]),Ie.MoveString([]),new Ie([])]},options:e})}async function Bd(r){let{aptosConfig:t,tokenAddress:e}=r,n={token_data_id:{_eq:O.from(e).toStringLong()}};return(await xe({aptosConfig:t,query:{query:Ru,variables:{where_condition:n}},originMethod:"getTokenData"})).current_token_datas_v2[0]}async function Id(r){let{aptosConfig:t,tokenAddress:e}=r,n={token_data_id:{_eq:O.from(e).toStringLong()}};return(await xe({aptosConfig:t,query:{query:la,variables:{where_condition:n}},originMethod:"getCurrentTokenOwnership"})).current_token_ownerships_v2[0]}async function Rd(r){let{aptosConfig:t,ownerAddress:e,options:n}=r,o={owner_address:{_eq:O.from(e).toStringLong()}},s={query:la,variables:{where_condition:o,offset:n?.pagination?.offset,limit:n?.pagination?.limit,order_by:n?.orderBy}};return(await xe({aptosConfig:t,query:s,originMethod:"getOwnedTokens"})).current_token_ownerships_v2}async function Pd(r){let{aptosConfig:t,tokenAddress:e,options:n}=r,o={token_data_id:{_eq:O.from(e).toStringLong()}},s={query:Iu,variables:{where_condition:o,offset:n?.pagination?.offset,limit:n?.pagination?.limit,order_by:n?.orderBy}};return(await xe({aptosConfig:t,query:s,originMethod:"getTokenActivity"})).token_activities_v2}async function Od(r){let{aptosConfig:t,options:e,creator:n}=r;return await at({aptosConfig:t,sender:n.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new Xe(r.description),new Ye(r.maxSupply??Vr),new Xe(r.name),new Xe(r.uri),new qe(r.mutableDescription??!0),new qe(r.mutableRoyalty??!0),new qe(r.mutableURI??!0),new qe(r.mutableTokenDescription??!0),new qe(r.mutableTokenName??!0),new qe(r.mutableTokenProperties??!0),new qe(r.mutableTokenURI??!0),new qe(r.tokensBurnableByCreator??!0),new qe(r.tokensFreezableByCreator??!0),new Ye(r.royaltyNumerator??0),new Ye(r.royaltyDenominator??1)]},options:e})}async function Ja(r){let{aptosConfig:t,creatorAddress:e,collectionName:n,options:o}=r,s=O.from(e),c={collection_name:{_eq:n},creator_address:{_eq:s.toStringLong()}};return o?.tokenStandard&&(c.token_standard={_eq:o?.tokenStandard??"v2"}),(await xe({aptosConfig:t,query:{query:_u,variables:{where_condition:c}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function kd(r){return(await Ja(r)).collection_id}var Ro=class{constructor(t){this.config=t}async createCollectionTransaction(t){return Od({aptosConfig:this.config,...t})}async getCollectionData(t){return Ja({aptosConfig:this.config,...t})}async getCollectionId(t){return kd({aptosConfig:this.config,...t})}async mintTokenTransaction(t){return Ud({aptosConfig:this.config,...t})}async getTokenData(t){return Bd({aptosConfig:this.config,...t})}async getCurrentTokenOwnership(t){return Id({aptosConfig:this.config,...t})}async getOwnedTokens(t){return Rd({aptosConfig:this.config,...t})}async getTokenActivity(t){return Pd({aptosConfig:this.config,...t})}};async function Nd(r){let{accountAddress:t,aptosConfig:e,creationNumber:n}=r,s={account_address:{_eq:O.from(t).toStringLong()},creation_number:{_eq:n}};return ts({aptosConfig:e,options:{where:s}})}async function zd(r){let{accountAddress:t,aptosConfig:e,eventType:n,options:o}=r,u={where:{account_address:{_eq:O.fromRelaxed(t).toStringLong()},indexed_type:{_eq:n}},pagination:o?.pagination,orderBy:o?.orderBy};return ts({aptosConfig:e,options:u})}async function ts(r){let{aptosConfig:t,options:e}=r,n={query:Eu,variables:{where_condition:e?.where,offset:e?.pagination?.offset,limit:e?.pagination?.limit,order_by:e?.orderBy}};return(await xe({aptosConfig:t,query:n,originMethod:"getEvents"})).events}var Po=class{constructor(t){this.config=t}async getAccountEventsByCreationNumber(t){return Nd({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return zd({aptosConfig:this.config,...t})}async getEvents(t){return ts({aptosConfig:this.config,...t})}};async function Md(r){let{aptosConfig:t,accountAddress:e,amount:n,options:o}=r,s=o?.timeoutSecs||co,{data:c}=await Is({aptosConfig:t,path:"fund",body:{address:O.fromRelaxed(e).toString(),amount:n},originMethod:"fundAccount"}),u=c.txn_hashes[0];return await Mi({aptosConfig:t,transactionHash:u,options:{timeoutSecs:s,checkSuccess:o?.checkSuccess,indexerVersionCheck:o?.indexerVersionCheck}}),u}var Oo=class{constructor(t){this.config=t}async fundAccount(t){return Md({aptosConfig:this.config,...t})}};async function ec(r){let{aptosConfig:t,options:e}=r,n={query:Uu,variables:{where_condition:e?.where,limit:e?.pagination?.limit,offset:e?.pagination?.offset}};return(await xe({aptosConfig:t,query:n,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Dd(r){let{aptosConfig:t,options:e}=r,n={query:Cu,variables:{where_condition:e?.where,limit:e?.pagination?.limit,offset:e?.pagination?.offset}};return(await xe({aptosConfig:t,query:n,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Gd(r){let{aptosConfig:t,options:e}=r,n={query:vu,variables:{where_condition:e?.where,limit:e?.pagination?.limit,offset:e?.pagination?.offset}};return(await xe({aptosConfig:t,query:n,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var ko=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return ec({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return(await ec({aptosConfig:this.config,options:{where:{asset_type:{_eq:t}}}}))[0]}async getFungibleAssetActivities(t){return Dd({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return Gd({aptosConfig:this.config,...t})}};var No=class{constructor(t){this.config=t}async getLedgerInfo(){return _i({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return Pu({aptosConfig:this.config,...t})}async getBlockByHeight(t){return Ou({aptosConfig:this.config,...t})}async getTableItem(t){return vi({aptosConfig:this.config,...t})}async view(t){return kr({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return ku({aptosConfig:this.config,...t})}async queryIndexer(t){return xe({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return Si({aptosConfig:this.config})}};var qd=["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 Ld(r){return!(!r||r.length<3||r.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(r))}function Dr(r){let[t,e,...n]=r.replace(/\.apt$/,"").split(".");if(n.length>0)throw new Error(`${r} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!Ld(t))throw new Error(`${t} is not valid. ${qd}`);if(e&&!Ld(e))throw new Error(`${e} is not valid. ${qd}`);return{domainName:e||t,subdomainName:e?t:void 0}}var sy="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",ay={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:sy,custom:null,devnet:null};function xr(r){let t=ay[r.network];if(!t)throw new Error(`The ANS contract is not deployed to ${r.network}`);return t}var cy=r=>({vec:[r]}),uy=()=>({vec:[]}),tc=r=>r!=null?cy(r):uy(),rs=r=>{if(r&&typeof r=="object"&&"vec"in r&&Array.isArray(r.vec))return r.vec[0]};async function Fd(r){let{aptosConfig:t,name:e}=r,n=xr(t),{domainName:o,subdomainName:s}=Dr(e),c=await kr({aptosConfig:t,payload:{function:`${n}::router::get_owner_addr`,functionArguments:[o,tc(s)]}}),u=rs(c[0]);return u?O.fromRelaxed(u).toString():void 0}async function Kd(r){let{aptosConfig:t,expiration:e,name:n,sender:o,targetAddress:s,toAddress:c,options:u,transferable:p}=r,y=xr(t),{domainName:h,subdomainName:x}=Dr(n),C=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(x&&!C)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(C&&!x)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){let I=e.years??1;if(I!==1)throw new Error("For now, names can only be registered for 1 year at a time");let $=I*31536e3;return await at({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${y}::router::register_domain`,functionArguments:[h,$,s,c]},options:u})}if(!x)throw new Error(`${e.policy} requires a subdomain to be provided.`);let T=await rc({aptosConfig:t,name:h});if(!T)throw new Error("The domain does not exist");T*=1e3;let z=e.policy==="subdomain:independent"?e.expirationDate.valueOf():T;if(z>T)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await at({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${y}::router::register_subdomain`,functionArguments:[h,x,Math.round(z/1e3),e.policy==="subdomain:follow-domain"?1:0,!!p,s,c]},options:u})}async function rc(r){let{aptosConfig:t,name:e}=r,n=xr(t),{domainName:o,subdomainName:s}=Dr(e);try{return(await kr({aptosConfig:t,payload:{function:`${n}::router::get_expiration`,functionArguments:[o,tc(s)]}}))[0]}catch{return}}async function Hd(r){let{aptosConfig:t,address:e}=r,n=xr(t),o=await kr({aptosConfig:t,payload:{function:`${n}::router::get_primary_name`,functionArguments:[O.fromRelaxed(e).toString()]}}),s=rs(o[1]),c=rs(o[0]);if(s)return[c,s].filter(Boolean).join(".")}async function $d(r){let{aptosConfig:t,sender:e,name:n,options:o}=r,s=xr(t);if(!n)return await at({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:o});let{domainName:c,subdomainName:u}=Dr(n);return await at({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[c,u]},options:o})}async function Vd(r){let{aptosConfig:t,name:e}=r,n=xr(t),{domainName:o,subdomainName:s}=Dr(e),c=await kr({aptosConfig:t,payload:{function:`${n}::router::get_target_addr`,functionArguments:[o,tc(s)]}}),u=rs(c[0]);return u?O.fromRelaxed(u).toString():void 0}async function Qd(r){let{aptosConfig:t,sender:e,name:n,address:o,options:s}=r,c=xr(t),{domainName:u,subdomainName:p}=Dr(n);return await at({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${c}::router::set_target_addr`,functionArguments:[u,p,o]},options:s})}async function jd(r){let{aptosConfig:t,name:e}=r,{domainName:n,subdomainName:o=""}=Dr(e);return(await xe({aptosConfig:t,query:{query:Mn,variables:{where_condition:{domain:{_eq:n},subdomain:{_eq:o}},limit:1}},originMethod:"getName"})).current_aptos_names[0]}async function Wd(r){let{aptosConfig:t,options:e,accountAddress:n}=r,o=await nc({aptosConfig:t});return(await xe({aptosConfig:t,originMethod:"getAccountNames",query:{query:Mn,variables:{limit:e?.pagination?.limit,offset:e?.pagination?.offset,order_by:e?.orderBy,where_condition:{...r.options?.where??{},owner_address:{_eq:n.toString()},expiration_timestamp:{_gte:o}}}}})).current_aptos_names}async function Yd(r){let{aptosConfig:t,options:e,accountAddress:n}=r,o=await nc({aptosConfig:t});return(await xe({aptosConfig:t,originMethod:"getAccountDomains",query:{query:Mn,variables:{limit:e?.pagination?.limit,offset:e?.pagination?.offset,order_by:e?.orderBy,where_condition:{...r.options?.where??{},owner_address:{_eq:n.toString()},expiration_timestamp:{_gte:o},subdomain:{_eq:""}}}}})).current_aptos_names}async function Xd(r){let{aptosConfig:t,options:e,accountAddress:n}=r,o=await nc({aptosConfig:t});return(await xe({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:Mn,variables:{limit:e?.pagination?.limit,offset:e?.pagination?.offset,order_by:e?.orderBy,where_condition:{...r.options?.where??{},owner_address:{_eq:n.toString()},expiration_timestamp:{_gte:o},subdomain:{_neq:""}}}}})).current_aptos_names}async function Zd(r){let{aptosConfig:t,options:e,domain:n}=r;return(await xe({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:Mn,variables:{limit:e?.pagination?.limit,offset:e?.pagination?.offset,order_by:e?.orderBy,where_condition:{...r.options?.where??{},domain:{_eq:n},subdomain:{_neq:""}}}}})).current_aptos_names}async function nc(r){let{aptosConfig:t}=r,e=xr(t),s=(await kr({aptosConfig:t,payload:{function:`${e}::config::reregistration_grace_sec`,functionArguments:[]}}))[0]/60/60/24,c=()=>new Date;return new Date(c().setDate(c().getDate()-s)).toISOString()}async function Jd(r){let{aptosConfig:t,sender:e,name:n,years:o=1,options:s}=r,c=xr(t),u=o*31536e3,{domainName:p,subdomainName:y}=Dr(n);if(y)throw new Error("Subdomains cannot be renewed");if(o!==1)throw new Error("Currently, only 1 year renewals are supported");return await at({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${c}::router::renew_domain`,functionArguments:[p,u]},options:s})}var zo=class{constructor(t){this.config=t}async getOwnerAddress(t){return Fd({aptosConfig:this.config,...t})}async getExpiration(t){return rc({aptosConfig:this.config,...t})}async getTargetAddress(t){return Vd({aptosConfig:this.config,...t})}async setTargetAddress(t){return Qd({aptosConfig:this.config,...t})}async getPrimaryName(t){return Hd({aptosConfig:this.config,...t})}async setPrimaryName(t){return $d({aptosConfig:this.config,...t})}async registerName(t){return Kd({aptosConfig:this.config,...t})}async renewDomain(t){return Jd({aptosConfig:this.config,...t})}async getName(t){return jd({aptosConfig:this.config,...t})}async getAccountNames(t){return Wd({aptosConfig:this.config,...t})}async getAccountDomains(t){return Yd({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return Xd({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return Zd({aptosConfig:this.config,...t})}};async function el(r){let{aptosConfig:t,poolAddress:e}=r,n=O.fromRelaxed(e).toStringLong(),s=await xe({aptosConfig:t,query:{query:da,variables:{where_condition:{pool_address:{_eq:n}}}}});if(s.num_active_delegator_per_pool.length===0)throw Error("Delegator pool not found");return s.num_active_delegator_per_pool[0].num_active_delegator}async function tl(r){let{aptosConfig:t,options:e}=r,n={query:da,variables:{where_condition:{},order_by:e?.orderBy}};return(await xe({aptosConfig:t,query:n})).num_active_delegator_per_pool}async function rl(r){let{aptosConfig:t,delegatorAddress:e,poolAddress:n}=r,o={query:Su,variables:{delegatorAddress:O.fromRelaxed(e).toStringLong(),poolAddress:O.fromRelaxed(n).toStringLong()}};return(await xe({aptosConfig:t,query:o})).delegated_staking_activities}var Mo=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return el({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return tl({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return rl({aptosConfig:this.config,...t})}};var Do=class{constructor(t){this.config=t}async getTransactions(t){return pd({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return gd({aptosConfig:this.config,...t})}async getTransactionByHash(t){return zi({aptosConfig:this.config,...t})}async isPendingTransaction(t){return yd({aptosConfig:this.config,...t})}async waitForTransaction(t){return Mi({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return Ni({aptosConfig:this.config})}};var Go=class{constructor(t){this.config=t}async signAndSubmitTransaction(t){let{signer:e,transaction:n}=t;return Za({aptosConfig:this.config,signer:e,transaction:n})}async publishPackageTransaction(t){return Sd({aptosConfig:this.config,...t})}async rotateAuthKey(t){return Ed({aptosConfig:this.config,...t})}};var qo=class{constructor(t){this.config=t}async transaction(t){return at({aptosConfig:this.config,...t})}async multiAgentTransaction(t){return at({aptosConfig:this.config,...t})}};var Lo=class{constructor(t){this.config=t}transaction(t){return Ji({...t})}transactionAsFeePayer(t){let{signer:e,transaction:n}=t;if(!n.feePayerAddress)throw new Error(`Transaction ${n} is not a Fee Payer transaction`);return n.feePayerAddress=e.accountAddress,Ji({signer:e,transaction:n})}};var Un=class{constructor(t){this.config=t}async transaction(t){return Xa({aptosConfig:this.config,...t})}async multiAgentTransaction(t){return Xa({aptosConfig:this.config,...t})}};yt([nl],Un.prototype,"transaction",1),yt([nl],Un.prototype,"multiAgentTransaction",1);function nl(r,t,e){let n=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 n.apply(this,o)},e}var Bn=class{constructor(t){this.config=t}async transaction(t){return es({aptosConfig:this.config,...t})}async multiAgentTransaction(t){return es({aptosConfig:this.config,...t})}};yt([ol],Bn.prototype,"transaction",1),yt([ol],Bn.prototype,"multiAgentTransaction",1);function ol(r,t,e){let n=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 n.apply(this,o)},e}var ot=class{constructor(t){this.config=new bo(t),this.account=new mo(this.config),this.ans=new zo(this.config),this.coin=new Io(this.config),this.digitalAsset=new Ro(this.config),this.event=new Po(this.config),this.faucet=new Oo(this.config),this.fungibleAsset=new ko(this.config),this.general=new No(this.config),this.staking=new Mo(this.config),this.transaction=new Do(this.config),this.transactionSubmission=new Go(this.config),this.build=new qo(this.config),this.sign=new Lo(this.config),this.simulate=new Un(this.config),this.submit=new Bn(this.config)}};function pt(r,t,e){Object.getOwnPropertyNames(t.prototype).forEach(n=>{let o=Object.getOwnPropertyDescriptor(t.prototype,n);o&&(o.value=function(...s){return this[e][n](...s)},Object.defineProperty(r.prototype,n,o))})}pt(ot,mo,"account");pt(ot,zo,"ans");pt(ot,Io,"coin");pt(ot,Ro,"digitalAsset");pt(ot,Po,"event");pt(ot,Oo,"faucet");pt(ot,ko,"fungibleAsset");pt(ot,No,"general");pt(ot,Mo,"staking");pt(ot,Do,"transaction");pt(ot,Go,"transactionSubmission");pt(ot,qo,"build");pt(ot,Lo,"sign");pt(ot,Un,"simulate");pt(ot,Bn,"submit");return pl(fy);})();
|
|
407
428
|
/*! Bundled license information:
|
|
408
429
|
|
|
409
430
|
@noble/hashes/esm/utils.js:
|