@aptos-labs/ts-sdk 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +144 -0
- package/dist/browser/index.global.js +410 -0
- package/dist/browser/index.global.js.map +1 -0
- package/dist/cjs/index.d.ts +4965 -0
- package/dist/cjs/index.js +4762 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/esm/index.d.ts +4965 -0
- package/dist/esm/index.mjs +4645 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/types/index.d.ts +1247 -0
- package/dist/types/index.js +151 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +79 -0
- package/src/api/account.ts +360 -0
- package/src/api/aptos.ts +103 -0
- package/src/api/aptosConfig.ts +77 -0
- package/src/api/coin.ts +39 -0
- package/src/api/digitalAsset.ts +192 -0
- package/src/api/event.ts +78 -0
- package/src/api/faucet.ts +30 -0
- package/src/api/fungibleAsset.ts +82 -0
- package/src/api/general.ts +188 -0
- package/src/api/index.ts +5 -0
- package/src/api/staking.ts +58 -0
- package/src/api/transaction.ts +135 -0
- package/src/api/transactionSubmission.ts +168 -0
- package/src/bcs/consts.ts +12 -0
- package/src/bcs/deserializer.ts +248 -0
- package/src/bcs/index.ts +9 -0
- package/src/bcs/serializable/entryFunctionBytes.ts +61 -0
- package/src/bcs/serializable/fixedBytes.ts +65 -0
- package/src/bcs/serializable/movePrimitives.ts +211 -0
- package/src/bcs/serializable/moveStructs.ts +462 -0
- package/src/bcs/serializer.ts +353 -0
- package/src/client/core.ts +106 -0
- package/src/client/get.ts +109 -0
- package/src/client/index.ts +7 -0
- package/src/client/post.ts +90 -0
- package/src/client/types.ts +58 -0
- package/src/core/account.ts +180 -0
- package/src/core/accountAddress.ts +407 -0
- package/src/core/authenticationKey.ts +102 -0
- package/src/core/common.ts +40 -0
- package/src/core/crypto/asymmetricCrypto.ts +77 -0
- package/src/core/crypto/ed25519.ts +224 -0
- package/src/core/crypto/index.ts +7 -0
- package/src/core/crypto/multiEd25519.ts +251 -0
- package/src/core/crypto/secp256k1.ts +227 -0
- package/src/core/hex.ts +177 -0
- package/src/core/index.ts +9 -0
- package/src/index.ts +12 -0
- package/src/internal/account.ts +484 -0
- package/src/internal/coin.ts +32 -0
- package/src/internal/digitalAsset.ts +302 -0
- package/src/internal/event.ts +88 -0
- package/src/internal/faucet.ts +41 -0
- package/src/internal/fungibleAsset.ts +114 -0
- package/src/internal/general.ts +160 -0
- package/src/internal/queries/TokenActivitiesFieldsFragment.graphql +17 -0
- package/src/internal/queries/currentTokenOwnershipFieldsFragment.graphql +45 -0
- package/src/internal/queries/getAccountCoinCount.graphql +7 -0
- package/src/internal/queries/getAccountCoinsData.graphql +32 -0
- package/src/internal/queries/getAccountCollectionsWithOwnedTokens.graphql +33 -0
- package/src/internal/queries/getAccountOwnedObjects.graphql +16 -0
- package/src/internal/queries/getAccountOwnedTokens.graphql +11 -0
- package/src/internal/queries/getAccountOwnedTokensByTokenData.graphql +11 -0
- package/src/internal/queries/getAccountOwnedTokensFromCollectionAddress.graphql +11 -0
- package/src/internal/queries/getAccountTokensCount.graphql +7 -0
- package/src/internal/queries/getAccountTransactionsCount.graphql +7 -0
- package/src/internal/queries/getChainTopUserTransactions.graphql +5 -0
- package/src/internal/queries/getCollectionData.graphql +20 -0
- package/src/internal/queries/getCurrentFungibleAssetBalances.graphql +17 -0
- package/src/internal/queries/getDelegatedStakingActivities.graphql +12 -0
- package/src/internal/queries/getEvents.graphql +12 -0
- package/src/internal/queries/getFungibleAssetActivities.graphql +20 -0
- package/src/internal/queries/getFungibleAssetMetadata.graphql +16 -0
- package/src/internal/queries/getNumberOfDelegatorsQuery.graphql +9 -0
- package/src/internal/queries/getProcessorStatus.graphql +7 -0
- package/src/internal/queries/getTokenActivity.graphql +11 -0
- package/src/internal/queries/getTokenCurrentOwner.graphql +11 -0
- package/src/internal/queries/getTokenData.graphql +38 -0
- package/src/internal/staking.ts +68 -0
- package/src/internal/transaction.ts +245 -0
- package/src/internal/transactionSubmission.ts +162 -0
- package/src/transactions/authenticator/account.ts +121 -0
- package/src/transactions/authenticator/transaction.ts +222 -0
- package/src/transactions/instances/chainId.ts +26 -0
- package/src/transactions/instances/identifier.ts +28 -0
- package/src/transactions/instances/index.ts +9 -0
- package/src/transactions/instances/moduleId.ts +53 -0
- package/src/transactions/instances/rawTransaction.ts +199 -0
- package/src/transactions/instances/signedTransaction.ts +43 -0
- package/src/transactions/instances/transactionArgument.ts +37 -0
- package/src/transactions/instances/transactionPayload.ts +407 -0
- package/src/transactions/transaction_builder/transaction_builder.ts +541 -0
- package/src/transactions/typeTag/typeTag.ts +487 -0
- package/src/transactions/types.ts +262 -0
- package/src/types/codegen.yaml +33 -0
- package/src/types/generated/operations.ts +623 -0
- package/src/types/generated/queries.ts +737 -0
- package/src/types/generated/types.ts +10387 -0
- package/src/types/index.ts +944 -0
- package/src/types/indexer.ts +93 -0
- package/src/utils/apiEndpoints.ts +36 -0
- package/src/utils/const.ts +51 -0
- package/src/utils/hdKey.ts +113 -0
- package/src/utils/helpers.ts +12 -0
- package/src/utils/memoize.ts +68 -0
- package/src/version.ts +9 -0
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
"use strict";var aptosSDK=(()=>{var ad=Object.create;var to=Object.defineProperty;var Na=Object.getOwnPropertyDescriptor;var cd=Object.getOwnPropertyNames;var ud=Object.getPrototypeOf,fd=Object.prototype.hasOwnProperty;var Da=(r=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(r,{get:(e,t)=>(typeof require!="undefined"?require:e)[t]}):r)(function(r){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var ce=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),qa=(r,e)=>{for(var t in e)to(r,t,{get:e[t],enumerable:!0})},Ma=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of cd(e))!fd.call(r,o)&&o!==t&&to(r,o,{get:()=>e[o],enumerable:!(n=Na(e,o))||n.enumerable});return r};var oi=(r,e,t)=>(t=r!=null?ad(ud(r)):{},Ma(e||!r||!r.__esModule?to(t,"default",{value:r,enumerable:!0}):t,r)),ld=r=>Ma(to({},"__esModule",{value:!0}),r),Ar=(r,e,t,n)=>{for(var o=n>1?void 0:n?Na(e,t):e,i=r.length-1,a;i>=0;i--)(a=r[i])&&(o=(n?a(e,t,o):a(o))||o);return n&&o&&to(e,t,o),o};var si=ce((ag,Ga)=>{"use strict";Ga.exports=function(e,t){return function(){for(var o=new Array(arguments.length),i=0;i<o.length;i++)o[i]=arguments[i];return e.apply(t,o)}}});var Ze=ce((cg,$a)=>{"use strict";var dd=si(),ai=Object.prototype.toString,ci=function(r){return function(e){var t=ai.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())}}(Object.create(null));function Qr(r){return r=r.toLowerCase(),function(t){return ci(t)===r}}function ui(r){return Array.isArray(r)}function Ko(r){return typeof r=="undefined"}function pd(r){return r!==null&&!Ko(r)&&r.constructor!==null&&!Ko(r.constructor)&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}var La=Qr("ArrayBuffer");function hd(r){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&La(r.buffer),e}function gd(r){return typeof r=="string"}function yd(r){return typeof r=="number"}function Fa(r){return r!==null&&typeof r=="object"}function jo(r){if(ci(r)!=="object")return!1;var e=Object.getPrototypeOf(r);return e===null||e===Object.prototype}var xd=Qr("Date"),md=Qr("File"),bd=Qr("Blob"),Ad=Qr("FileList");function fi(r){return ai.call(r)==="[object Function]"}function wd(r){return Fa(r)&&fi(r.pipe)}function _d(r){var e="[object FormData]";return r&&(typeof FormData=="function"&&r instanceof FormData||ai.call(r)===e||fi(r.toString)&&r.toString()===e)}var Td=Qr("URLSearchParams");function vd(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function Ed(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function li(r,e){if(!(r===null||typeof r=="undefined"))if(typeof r!="object"&&(r=[r]),ui(r))for(var t=0,n=r.length;t<n;t++)e.call(null,r[t],t,r);else for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&e.call(null,r[o],o,r)}function ii(){var r={};function e(o,i){jo(r[i])&&jo(o)?r[i]=ii(r[i],o):jo(o)?r[i]=ii({},o):ui(o)?r[i]=o.slice():r[i]=o}for(var t=0,n=arguments.length;t<n;t++)li(arguments[t],e);return r}function Sd(r,e,t){return li(e,function(o,i){t&&typeof o=="function"?r[i]=dd(o,t):r[i]=o}),r}function Ud(r){return r.charCodeAt(0)===65279&&(r=r.slice(1)),r}function Bd(r,e,t,n){r.prototype=Object.create(e.prototype,n),r.prototype.constructor=r,t&&Object.assign(r.prototype,t)}function Cd(r,e,t){var n,o,i,a={};e=e||{};do{for(n=Object.getOwnPropertyNames(r),o=n.length;o-- >0;)i=n[o],a[i]||(e[i]=r[i],a[i]=!0);r=Object.getPrototypeOf(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e}function Id(r,e,t){r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;var n=r.indexOf(e,t);return n!==-1&&n===t}function Rd(r){if(!r)return null;var e=r.length;if(Ko(e))return null;for(var t=new Array(e);e-- >0;)t[e]=r[e];return t}var kd=function(r){return function(e){return r&&e instanceof r}}(typeof Uint8Array!="undefined"&&Object.getPrototypeOf(Uint8Array));$a.exports={isArray:ui,isArrayBuffer:La,isBuffer:pd,isFormData:_d,isArrayBufferView:hd,isString:gd,isNumber:yd,isObject:Fa,isPlainObject:jo,isUndefined:Ko,isDate:xd,isFile:md,isBlob:bd,isFunction:fi,isStream:wd,isURLSearchParams:Td,isStandardBrowserEnv:Ed,forEach:li,merge:ii,extend:Sd,trim:vd,stripBOM:Ud,inherits:Bd,toFlatObject:Cd,kindOf:ci,kindOfTest:Qr,endsWith:Id,toArray:Rd,isTypedArray:kd,isFileList:Ad}});var di=ce((ug,Ka)=>{"use strict";var Cn=Ze();function ja(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Ka.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(Cn.isURLSearchParams(t))o=t.toString();else{var i=[];Cn.forEach(t,function(d,h){d===null||typeof d=="undefined"||(Cn.isArray(d)?h=h+"[]":d=[d],Cn.forEach(d,function(g){Cn.isDate(g)?g=g.toISOString():Cn.isObject(g)&&(g=JSON.stringify(g)),i.push(ja(h)+"="+ja(g))}))}),o=i.join("&")}if(o){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}});var Qa=ce((fg,Va)=>{"use strict";var Od=Ze();function Vo(){this.handlers=[]}Vo.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};Vo.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Vo.prototype.forEach=function(e){Od.forEach(this.handlers,function(n){n!==null&&e(n)})};Va.exports=Vo});var Ya=ce((lg,Wa)=>{"use strict";var zd=Ze();Wa.exports=function(e,t){zd.forEach(e,function(o,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=o,delete e[i])})}});var Wr=ce((dg,ec)=>{"use strict";var Xa=Ze();function In(r,e,t,n,o){Error.call(this),this.message=r,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),n&&(this.request=n),o&&(this.response=o)}Xa.inherits(In,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 Za=In.prototype,Ja={};["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){Ja[r]={value:r}});Object.defineProperties(In,Ja);Object.defineProperty(Za,"isAxiosError",{value:!0});In.from=function(r,e,t,n,o,i){var a=Object.create(Za);return Xa.toFlatObject(r,a,function(d){return d!==Error.prototype}),In.call(a,r.message,e,t,n,o),a.name=r.name,i&&Object.assign(a,i),a};ec.exports=In});var pi=ce((pg,tc)=>{"use strict";tc.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var hi=ce((hg,rc)=>{"use strict";var zt=Ze();function Pd(r,e){e=e||new FormData;var t=[];function n(i){return i===null?"":zt.isDate(i)?i.toISOString():zt.isArrayBuffer(i)||zt.isTypedArray(i)?typeof Blob=="function"?new Blob([i]):Buffer.from(i):i}function o(i,a){if(zt.isPlainObject(i)||zt.isArray(i)){if(t.indexOf(i)!==-1)throw Error("Circular reference detected in "+a);t.push(i),zt.forEach(i,function(d,h){if(!zt.isUndefined(d)){var y=a?a+"."+h:h,g;if(d&&!a&&typeof d=="object"){if(zt.endsWith(h,"{}"))d=JSON.stringify(d);else if(zt.endsWith(h,"[]")&&(g=zt.toArray(d))){g.forEach(function(T){!zt.isUndefined(T)&&e.append(y,n(T))});return}}o(d,y)}}),t.pop()}else e.append(a,n(i))}return o(r),e}rc.exports=Pd});var oc=ce((gg,nc)=>{"use strict";var gi=Wr();nc.exports=function(e,t,n){var o=n.config.validateStatus;!n.status||!o||o(n.status)?e(n):t(new gi("Request failed with status code "+n.status,[gi.ERR_BAD_REQUEST,gi.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}});var ic=ce((yg,sc)=>{"use strict";var Qo=Ze();sc.exports=Qo.isStandardBrowserEnv()?function(){return{write:function(t,n,o,i,a,u){var d=[];d.push(t+"="+encodeURIComponent(n)),Qo.isNumber(o)&&d.push("expires="+new Date(o).toGMTString()),Qo.isString(i)&&d.push("path="+i),Qo.isString(a)&&d.push("domain="+a),u===!0&&d.push("secure"),document.cookie=d.join("; ")},read:function(t){var n=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var cc=ce((xg,ac)=>{"use strict";ac.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}});var fc=ce((mg,uc)=>{"use strict";uc.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}});var yi=ce((bg,lc)=>{"use strict";var Hd=cc(),Nd=fc();lc.exports=function(e,t){return e&&!Hd(t)?Nd(e,t):t}});var pc=ce((Ag,dc)=>{"use strict";var xi=Ze(),Dd=["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"];dc.exports=function(e){var t={},n,o,i;return e&&xi.forEach(e.split(`
|
|
2
|
+
`),function(u){if(i=u.indexOf(":"),n=xi.trim(u.substr(0,i)).toLowerCase(),o=xi.trim(u.substr(i+1)),n){if(t[n]&&Dd.indexOf(n)>=0)return;n==="set-cookie"?t[n]=(t[n]?t[n]:[]).concat([o]):t[n]=t[n]?t[n]+", "+o:o}}),t}});var yc=ce((wg,gc)=>{"use strict";var hc=Ze();gc.exports=hc.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),n;function o(i){var a=i;return e&&(t.setAttribute("href",a),a=t.href),t.setAttribute("href",a),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return n=o(window.location.href),function(a){var u=hc.isString(a)?o(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var ro=ce((_g,mc)=>{"use strict";var mi=Wr(),qd=Ze();function xc(r){mi.call(this,r==null?"canceled":r,mi.ERR_CANCELED),this.name="CanceledError"}qd.inherits(xc,mi,{__CANCEL__:!0});mc.exports=xc});var Ac=ce((Tg,bc)=>{"use strict";bc.exports=function(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}});var bi=ce((vg,wc)=>{"use strict";var no=Ze(),Md=oc(),Gd=ic(),Ld=di(),Fd=yi(),$d=pc(),jd=yc(),Kd=pi(),sr=Wr(),Vd=ro(),Qd=Ac();wc.exports=function(e){return new Promise(function(n,o){var i=e.data,a=e.headers,u=e.responseType,d;function h(){e.cancelToken&&e.cancelToken.unsubscribe(d),e.signal&&e.signal.removeEventListener("abort",d)}no.isFormData(i)&&no.isStandardBrowserEnv()&&delete a["Content-Type"];var y=new XMLHttpRequest;if(e.auth){var g=e.auth.username||"",T=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(g+":"+T)}var v=Fd(e.baseURL,e.url);y.open(e.method.toUpperCase(),Ld(v,e.params,e.paramsSerializer),!0),y.timeout=e.timeout;function I(){if(!!y){var k="getAllResponseHeaders"in y?$d(y.getAllResponseHeaders()):null,D=!u||u==="text"||u==="json"?y.responseText:y.response,C={data:D,status:y.status,statusText:y.statusText,headers:k,config:e,request:y};Md(function(F){n(F),h()},function(F){o(F),h()},C),y=null}}if("onloadend"in y?y.onloadend=I:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(I)},y.onabort=function(){!y||(o(new sr("Request aborted",sr.ECONNABORTED,e,y)),y=null)},y.onerror=function(){o(new sr("Network Error",sr.ERR_NETWORK,e,y,y)),y=null},y.ontimeout=function(){var D=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",C=e.transitional||Kd;e.timeoutErrorMessage&&(D=e.timeoutErrorMessage),o(new sr(D,C.clarifyTimeoutError?sr.ETIMEDOUT:sr.ECONNABORTED,e,y)),y=null},no.isStandardBrowserEnv()){var A=(e.withCredentials||jd(v))&&e.xsrfCookieName?Gd.read(e.xsrfCookieName):void 0;A&&(a[e.xsrfHeaderName]=A)}"setRequestHeader"in y&&no.forEach(a,function(D,C){typeof i=="undefined"&&C.toLowerCase()==="content-type"?delete a[C]:y.setRequestHeader(C,D)}),no.isUndefined(e.withCredentials)||(y.withCredentials=!!e.withCredentials),u&&u!=="json"&&(y.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&y.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&y.upload&&y.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(d=function(k){!y||(o(!k||k&&k.type?new Vd:k),y.abort(),y=null)},e.cancelToken&&e.cancelToken.subscribe(d),e.signal&&(e.signal.aborted?d():e.signal.addEventListener("abort",d))),i||(i=null);var E=Qd(v);if(E&&["http","https","file"].indexOf(E)===-1){o(new sr("Unsupported protocol "+E+":",sr.ERR_BAD_REQUEST,e));return}y.send(i)})}});var Tc=ce((Eg,_c)=>{_c.exports=null});var Yo=ce((Sg,Uc)=>{"use strict";var Je=Ze(),vc=Ya(),Ec=Wr(),Wd=pi(),Yd=hi(),Xd={"Content-Type":"application/x-www-form-urlencoded"};function Sc(r,e){!Je.isUndefined(r)&&Je.isUndefined(r["Content-Type"])&&(r["Content-Type"]=e)}function Zd(){var r;return typeof XMLHttpRequest!="undefined"?r=bi():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(r=bi()),r}function Jd(r,e,t){if(Je.isString(r))try{return(e||JSON.parse)(r),Je.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}var Wo={transitional:Wd,adapter:Zd(),transformRequest:[function(e,t){if(vc(t,"Accept"),vc(t,"Content-Type"),Je.isFormData(e)||Je.isArrayBuffer(e)||Je.isBuffer(e)||Je.isStream(e)||Je.isFile(e)||Je.isBlob(e))return e;if(Je.isArrayBufferView(e))return e.buffer;if(Je.isURLSearchParams(e))return Sc(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();var n=Je.isObject(e),o=t&&t["Content-Type"],i;if((i=Je.isFileList(e))||n&&o==="multipart/form-data"){var a=this.env&&this.env.FormData;return Yd(i?{"files[]":e}:e,a&&new a)}else if(n||o==="application/json")return Sc(t,"application/json"),Jd(e);return e}],transformResponse:[function(e){var t=this.transitional||Wo.transitional,n=t&&t.silentJSONParsing,o=t&&t.forcedJSONParsing,i=!n&&this.responseType==="json";if(i||o&&Je.isString(e)&&e.length)try{return JSON.parse(e)}catch(a){if(i)throw a.name==="SyntaxError"?Ec.from(a,Ec.ERR_BAD_RESPONSE,this,null,this.response):a}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Tc()},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Je.forEach(["delete","get","head"],function(e){Wo.headers[e]={}});Je.forEach(["post","put","patch"],function(e){Wo.headers[e]=Je.merge(Xd)});Uc.exports=Wo});var Cc=ce((Ug,Bc)=>{"use strict";var ep=Ze(),tp=Yo();Bc.exports=function(e,t,n){var o=this||tp;return ep.forEach(n,function(a){e=a.call(o,e,t)}),e}});var Ai=ce((Bg,Ic)=>{"use strict";Ic.exports=function(e){return!!(e&&e.__CANCEL__)}});var Oc=ce((Cg,kc)=>{"use strict";var Rc=Ze(),wi=Cc(),rp=Ai(),np=Yo(),op=ro();function _i(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new op}kc.exports=function(e){_i(e),e.headers=e.headers||{},e.data=wi.call(e,e.data,e.headers,e.transformRequest),e.headers=Rc.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Rc.forEach(["delete","get","head","post","put","patch","common"],function(o){delete e.headers[o]});var t=e.adapter||np.adapter;return t(e).then(function(o){return _i(e),o.data=wi.call(e,o.data,o.headers,e.transformResponse),o},function(o){return rp(o)||(_i(e),o&&o.response&&(o.response.data=wi.call(e,o.response.data,o.response.headers,e.transformResponse))),Promise.reject(o)})}});var Ti=ce((Ig,zc)=>{"use strict";var bt=Ze();zc.exports=function(e,t){t=t||{};var n={};function o(y,g){return bt.isPlainObject(y)&&bt.isPlainObject(g)?bt.merge(y,g):bt.isPlainObject(g)?bt.merge({},g):bt.isArray(g)?g.slice():g}function i(y){if(bt.isUndefined(t[y])){if(!bt.isUndefined(e[y]))return o(void 0,e[y])}else return o(e[y],t[y])}function a(y){if(!bt.isUndefined(t[y]))return o(void 0,t[y])}function u(y){if(bt.isUndefined(t[y])){if(!bt.isUndefined(e[y]))return o(void 0,e[y])}else return o(void 0,t[y])}function d(y){if(y in t)return o(e[y],t[y]);if(y in e)return o(void 0,e[y])}var h={url:a,method:a,data:a,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:d};return bt.forEach(Object.keys(e).concat(Object.keys(t)),function(g){var T=h[g]||i,v=T(g);bt.isUndefined(v)&&T!==d||(n[g]=v)}),n}});var vi=ce((Rg,Pc)=>{Pc.exports={version:"0.27.2"}});var Dc=ce((kg,Nc)=>{"use strict";var sp=vi().version,wr=Wr(),Ei={};["object","boolean","number","function","string","symbol"].forEach(function(r,e){Ei[r]=function(n){return typeof n===r||"a"+(e<1?"n ":" ")+r}});var Hc={};Ei.transitional=function(e,t,n){function o(i,a){return"[Axios v"+sp+"] Transitional option '"+i+"'"+a+(n?". "+n:"")}return function(i,a,u){if(e===!1)throw new wr(o(a," has been removed"+(t?" in "+t:"")),wr.ERR_DEPRECATED);return t&&!Hc[a]&&(Hc[a]=!0,console.warn(o(a," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,a,u):!0}};function ip(r,e,t){if(typeof r!="object")throw new wr("options must be an object",wr.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(r),o=n.length;o-- >0;){var i=n[o],a=e[i];if(a){var u=r[i],d=u===void 0||a(u,i,r);if(d!==!0)throw new wr("option "+i+" must be "+d,wr.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new wr("Unknown option "+i,wr.ERR_BAD_OPTION)}}Nc.exports={assertOptions:ip,validators:Ei}});var $c=ce((Og,Fc)=>{"use strict";var Gc=Ze(),ap=di(),qc=Qa(),Mc=Oc(),Xo=Ti(),cp=yi(),Lc=Dc(),Rn=Lc.validators;function kn(r){this.defaults=r,this.interceptors={request:new qc,response:new qc}}kn.prototype.request=function(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Xo(this.defaults,t),t.method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var n=t.transitional;n!==void 0&&Lc.assertOptions(n,{silentJSONParsing:Rn.transitional(Rn.boolean),forcedJSONParsing:Rn.transitional(Rn.boolean),clarifyTimeoutError:Rn.transitional(Rn.boolean)},!1);var o=[],i=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(t)===!1||(i=i&&v.synchronous,o.unshift(v.fulfilled,v.rejected))});var a=[];this.interceptors.response.forEach(function(v){a.push(v.fulfilled,v.rejected)});var u;if(!i){var d=[Mc,void 0];for(Array.prototype.unshift.apply(d,o),d=d.concat(a),u=Promise.resolve(t);d.length;)u=u.then(d.shift(),d.shift());return u}for(var h=t;o.length;){var y=o.shift(),g=o.shift();try{h=y(h)}catch(T){g(T);break}}try{u=Mc(h)}catch(T){return Promise.reject(T)}for(;a.length;)u=u.then(a.shift(),a.shift());return u};kn.prototype.getUri=function(e){e=Xo(this.defaults,e);var t=cp(e.baseURL,e.url);return ap(t,e.params,e.paramsSerializer)};Gc.forEach(["delete","get","head","options"],function(e){kn.prototype[e]=function(t,n){return this.request(Xo(n||{},{method:e,url:t,data:(n||{}).data}))}});Gc.forEach(["post","put","patch"],function(e){function t(n){return function(i,a,u){return this.request(Xo(u||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}kn.prototype[e]=t(),kn.prototype[e+"Form"]=t(!0)});Fc.exports=kn});var Kc=ce((zg,jc)=>{"use strict";var up=ro();function On(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(o){e=o});var t=this;this.promise.then(function(n){if(!!t._listeners){var o,i=t._listeners.length;for(o=0;o<i;o++)t._listeners[o](n);t._listeners=null}}),this.promise.then=function(n){var o,i=new Promise(function(a){t.subscribe(a),o=a}).then(n);return i.cancel=function(){t.unsubscribe(o)},i},r(function(o){t.reason||(t.reason=new up(o),e(t.reason))})}On.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};On.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};On.prototype.unsubscribe=function(e){if(!!this._listeners){var t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}};On.source=function(){var e,t=new On(function(o){e=o});return{token:t,cancel:e}};jc.exports=On});var Qc=ce((Pg,Vc)=>{"use strict";Vc.exports=function(e){return function(n){return e.apply(null,n)}}});var Yc=ce((Hg,Wc)=>{"use strict";var fp=Ze();Wc.exports=function(e){return fp.isObject(e)&&e.isAxiosError===!0}});var Jc=ce((Ng,Si)=>{"use strict";var Xc=Ze(),lp=si(),Zo=$c(),dp=Ti(),pp=Yo();function Zc(r){var e=new Zo(r),t=lp(Zo.prototype.request,e);return Xc.extend(t,Zo.prototype,e),Xc.extend(t,e),t.create=function(o){return Zc(dp(r,o))},t}var pt=Zc(pp);pt.Axios=Zo;pt.CanceledError=ro();pt.CancelToken=Kc();pt.isCancel=Ai();pt.VERSION=vi().version;pt.toFormData=hi();pt.AxiosError=Wr();pt.Cancel=pt.CanceledError;pt.all=function(e){return Promise.all(e)};pt.spread=Qc();pt.isAxiosError=Yc();Si.exports=pt;Si.exports.default=pt});var tu=ce((Dg,eu)=>{eu.exports=Jc()});var Cu=ce(()=>{});var Iu=ce((Yy,ds)=>{(function(r){"use strict";var e=function(c){var l,f=new Float64Array(16);if(c)for(l=0;l<c.length;l++)f[l]=c[l];return f},t=function(){throw new Error("no PRNG")},n=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var i=e(),a=e([1]),u=e([56129,1]),d=e([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=e([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),y=e([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),g=e([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),T=e([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function v(c,l,f,s){c[l]=f>>24&255,c[l+1]=f>>16&255,c[l+2]=f>>8&255,c[l+3]=f&255,c[l+4]=s>>24&255,c[l+5]=s>>16&255,c[l+6]=s>>8&255,c[l+7]=s&255}function I(c,l,f,s,p){var m,b=0;for(m=0;m<p;m++)b|=c[l+m]^f[s+m];return(1&b-1>>>8)-1}function A(c,l,f,s){return I(c,l,f,s,16)}function E(c,l,f,s){return I(c,l,f,s,32)}function k(c,l,f,s){for(var p=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,m=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,b=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,U=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,z=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,V=s[4]&255|(s[5]&255)<<8|(s[6]&255)<<16|(s[7]&255)<<24,N=l[0]&255|(l[1]&255)<<8|(l[2]&255)<<16|(l[3]&255)<<24,Se=l[4]&255|(l[5]&255)<<8|(l[6]&255)<<16|(l[7]&255)<<24,G=l[8]&255|(l[9]&255)<<8|(l[10]&255)<<16|(l[11]&255)<<24,re=l[12]&255|(l[13]&255)<<8|(l[14]&255)<<16|(l[15]&255)<<24,oe=s[8]&255|(s[9]&255)<<8|(s[10]&255)<<16|(s[11]&255)<<24,pe=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,de=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,se=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,ae=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,ie=s[12]&255|(s[13]&255)<<8|(s[14]&255)<<16|(s[15]&255)<<24,L=p,Y=m,q=b,j=U,K=z,H=V,w=N,_=Se,R=G,S=re,B=oe,O=pe,ee=de,he=se,xe=ae,ge=ie,x,we=0;we<20;we+=2)x=L+ee|0,K^=x<<7|x>>>32-7,x=K+L|0,R^=x<<9|x>>>32-9,x=R+K|0,ee^=x<<13|x>>>32-13,x=ee+R|0,L^=x<<18|x>>>32-18,x=H+Y|0,S^=x<<7|x>>>32-7,x=S+H|0,he^=x<<9|x>>>32-9,x=he+S|0,Y^=x<<13|x>>>32-13,x=Y+he|0,H^=x<<18|x>>>32-18,x=B+w|0,xe^=x<<7|x>>>32-7,x=xe+B|0,q^=x<<9|x>>>32-9,x=q+xe|0,w^=x<<13|x>>>32-13,x=w+q|0,B^=x<<18|x>>>32-18,x=ge+O|0,j^=x<<7|x>>>32-7,x=j+ge|0,_^=x<<9|x>>>32-9,x=_+j|0,O^=x<<13|x>>>32-13,x=O+_|0,ge^=x<<18|x>>>32-18,x=L+j|0,Y^=x<<7|x>>>32-7,x=Y+L|0,q^=x<<9|x>>>32-9,x=q+Y|0,j^=x<<13|x>>>32-13,x=j+q|0,L^=x<<18|x>>>32-18,x=H+K|0,w^=x<<7|x>>>32-7,x=w+H|0,_^=x<<9|x>>>32-9,x=_+w|0,K^=x<<13|x>>>32-13,x=K+_|0,H^=x<<18|x>>>32-18,x=B+S|0,O^=x<<7|x>>>32-7,x=O+B|0,R^=x<<9|x>>>32-9,x=R+O|0,S^=x<<13|x>>>32-13,x=S+R|0,B^=x<<18|x>>>32-18,x=ge+xe|0,ee^=x<<7|x>>>32-7,x=ee+ge|0,he^=x<<9|x>>>32-9,x=he+ee|0,xe^=x<<13|x>>>32-13,x=xe+he|0,ge^=x<<18|x>>>32-18;L=L+p|0,Y=Y+m|0,q=q+b|0,j=j+U|0,K=K+z|0,H=H+V|0,w=w+N|0,_=_+Se|0,R=R+G|0,S=S+re|0,B=B+oe|0,O=O+pe|0,ee=ee+de|0,he=he+se|0,xe=xe+ae|0,ge=ge+ie|0,c[0]=L>>>0&255,c[1]=L>>>8&255,c[2]=L>>>16&255,c[3]=L>>>24&255,c[4]=Y>>>0&255,c[5]=Y>>>8&255,c[6]=Y>>>16&255,c[7]=Y>>>24&255,c[8]=q>>>0&255,c[9]=q>>>8&255,c[10]=q>>>16&255,c[11]=q>>>24&255,c[12]=j>>>0&255,c[13]=j>>>8&255,c[14]=j>>>16&255,c[15]=j>>>24&255,c[16]=K>>>0&255,c[17]=K>>>8&255,c[18]=K>>>16&255,c[19]=K>>>24&255,c[20]=H>>>0&255,c[21]=H>>>8&255,c[22]=H>>>16&255,c[23]=H>>>24&255,c[24]=w>>>0&255,c[25]=w>>>8&255,c[26]=w>>>16&255,c[27]=w>>>24&255,c[28]=_>>>0&255,c[29]=_>>>8&255,c[30]=_>>>16&255,c[31]=_>>>24&255,c[32]=R>>>0&255,c[33]=R>>>8&255,c[34]=R>>>16&255,c[35]=R>>>24&255,c[36]=S>>>0&255,c[37]=S>>>8&255,c[38]=S>>>16&255,c[39]=S>>>24&255,c[40]=B>>>0&255,c[41]=B>>>8&255,c[42]=B>>>16&255,c[43]=B>>>24&255,c[44]=O>>>0&255,c[45]=O>>>8&255,c[46]=O>>>16&255,c[47]=O>>>24&255,c[48]=ee>>>0&255,c[49]=ee>>>8&255,c[50]=ee>>>16&255,c[51]=ee>>>24&255,c[52]=he>>>0&255,c[53]=he>>>8&255,c[54]=he>>>16&255,c[55]=he>>>24&255,c[56]=xe>>>0&255,c[57]=xe>>>8&255,c[58]=xe>>>16&255,c[59]=xe>>>24&255,c[60]=ge>>>0&255,c[61]=ge>>>8&255,c[62]=ge>>>16&255,c[63]=ge>>>24&255}function D(c,l,f,s){for(var p=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,m=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,b=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,U=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,z=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,V=s[4]&255|(s[5]&255)<<8|(s[6]&255)<<16|(s[7]&255)<<24,N=l[0]&255|(l[1]&255)<<8|(l[2]&255)<<16|(l[3]&255)<<24,Se=l[4]&255|(l[5]&255)<<8|(l[6]&255)<<16|(l[7]&255)<<24,G=l[8]&255|(l[9]&255)<<8|(l[10]&255)<<16|(l[11]&255)<<24,re=l[12]&255|(l[13]&255)<<8|(l[14]&255)<<16|(l[15]&255)<<24,oe=s[8]&255|(s[9]&255)<<8|(s[10]&255)<<16|(s[11]&255)<<24,pe=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,de=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,se=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,ae=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,ie=s[12]&255|(s[13]&255)<<8|(s[14]&255)<<16|(s[15]&255)<<24,L=p,Y=m,q=b,j=U,K=z,H=V,w=N,_=Se,R=G,S=re,B=oe,O=pe,ee=de,he=se,xe=ae,ge=ie,x,we=0;we<20;we+=2)x=L+ee|0,K^=x<<7|x>>>32-7,x=K+L|0,R^=x<<9|x>>>32-9,x=R+K|0,ee^=x<<13|x>>>32-13,x=ee+R|0,L^=x<<18|x>>>32-18,x=H+Y|0,S^=x<<7|x>>>32-7,x=S+H|0,he^=x<<9|x>>>32-9,x=he+S|0,Y^=x<<13|x>>>32-13,x=Y+he|0,H^=x<<18|x>>>32-18,x=B+w|0,xe^=x<<7|x>>>32-7,x=xe+B|0,q^=x<<9|x>>>32-9,x=q+xe|0,w^=x<<13|x>>>32-13,x=w+q|0,B^=x<<18|x>>>32-18,x=ge+O|0,j^=x<<7|x>>>32-7,x=j+ge|0,_^=x<<9|x>>>32-9,x=_+j|0,O^=x<<13|x>>>32-13,x=O+_|0,ge^=x<<18|x>>>32-18,x=L+j|0,Y^=x<<7|x>>>32-7,x=Y+L|0,q^=x<<9|x>>>32-9,x=q+Y|0,j^=x<<13|x>>>32-13,x=j+q|0,L^=x<<18|x>>>32-18,x=H+K|0,w^=x<<7|x>>>32-7,x=w+H|0,_^=x<<9|x>>>32-9,x=_+w|0,K^=x<<13|x>>>32-13,x=K+_|0,H^=x<<18|x>>>32-18,x=B+S|0,O^=x<<7|x>>>32-7,x=O+B|0,R^=x<<9|x>>>32-9,x=R+O|0,S^=x<<13|x>>>32-13,x=S+R|0,B^=x<<18|x>>>32-18,x=ge+xe|0,ee^=x<<7|x>>>32-7,x=ee+ge|0,he^=x<<9|x>>>32-9,x=he+ee|0,xe^=x<<13|x>>>32-13,x=xe+he|0,ge^=x<<18|x>>>32-18;c[0]=L>>>0&255,c[1]=L>>>8&255,c[2]=L>>>16&255,c[3]=L>>>24&255,c[4]=H>>>0&255,c[5]=H>>>8&255,c[6]=H>>>16&255,c[7]=H>>>24&255,c[8]=B>>>0&255,c[9]=B>>>8&255,c[10]=B>>>16&255,c[11]=B>>>24&255,c[12]=ge>>>0&255,c[13]=ge>>>8&255,c[14]=ge>>>16&255,c[15]=ge>>>24&255,c[16]=w>>>0&255,c[17]=w>>>8&255,c[18]=w>>>16&255,c[19]=w>>>24&255,c[20]=_>>>0&255,c[21]=_>>>8&255,c[22]=_>>>16&255,c[23]=_>>>24&255,c[24]=R>>>0&255,c[25]=R>>>8&255,c[26]=R>>>16&255,c[27]=R>>>24&255,c[28]=S>>>0&255,c[29]=S>>>8&255,c[30]=S>>>16&255,c[31]=S>>>24&255}function C(c,l,f,s){k(c,l,f,s)}function Z(c,l,f,s){D(c,l,f,s)}var F=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Q(c,l,f,s,p,m,b){var U=new Uint8Array(16),z=new Uint8Array(64),V,N;for(N=0;N<16;N++)U[N]=0;for(N=0;N<8;N++)U[N]=m[N];for(;p>=64;){for(C(z,U,b,F),N=0;N<64;N++)c[l+N]=f[s+N]^z[N];for(V=1,N=8;N<16;N++)V=V+(U[N]&255)|0,U[N]=V&255,V>>>=8;p-=64,l+=64,s+=64}if(p>0)for(C(z,U,b,F),N=0;N<p;N++)c[l+N]=f[s+N]^z[N];return 0}function J(c,l,f,s,p){var m=new Uint8Array(16),b=new Uint8Array(64),U,z;for(z=0;z<16;z++)m[z]=0;for(z=0;z<8;z++)m[z]=s[z];for(;f>=64;){for(C(b,m,p,F),z=0;z<64;z++)c[l+z]=b[z];for(U=1,z=8;z<16;z++)U=U+(m[z]&255)|0,m[z]=U&255,U>>>=8;f-=64,l+=64}if(f>0)for(C(b,m,p,F),z=0;z<f;z++)c[l+z]=b[z];return 0}function W(c,l,f,s,p){var m=new Uint8Array(32);Z(m,s,p,F);for(var b=new Uint8Array(8),U=0;U<8;U++)b[U]=s[U+16];return J(c,l,f,b,m)}function Te(c,l,f,s,p,m,b){var U=new Uint8Array(32);Z(U,m,b,F);for(var z=new Uint8Array(8),V=0;V<8;V++)z[V]=m[V+16];return Q(c,l,f,s,p,z,U)}var Ae=function(c){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 l,f,s,p,m,b,U,z;l=c[0]&255|(c[1]&255)<<8,this.r[0]=l&8191,f=c[2]&255|(c[3]&255)<<8,this.r[1]=(l>>>13|f<<3)&8191,s=c[4]&255|(c[5]&255)<<8,this.r[2]=(f>>>10|s<<6)&7939,p=c[6]&255|(c[7]&255)<<8,this.r[3]=(s>>>7|p<<9)&8191,m=c[8]&255|(c[9]&255)<<8,this.r[4]=(p>>>4|m<<12)&255,this.r[5]=m>>>1&8190,b=c[10]&255|(c[11]&255)<<8,this.r[6]=(m>>>14|b<<2)&8191,U=c[12]&255|(c[13]&255)<<8,this.r[7]=(b>>>11|U<<5)&8065,z=c[14]&255|(c[15]&255)<<8,this.r[8]=(U>>>8|z<<8)&8191,this.r[9]=z>>>5&127,this.pad[0]=c[16]&255|(c[17]&255)<<8,this.pad[1]=c[18]&255|(c[19]&255)<<8,this.pad[2]=c[20]&255|(c[21]&255)<<8,this.pad[3]=c[22]&255|(c[23]&255)<<8,this.pad[4]=c[24]&255|(c[25]&255)<<8,this.pad[5]=c[26]&255|(c[27]&255)<<8,this.pad[6]=c[28]&255|(c[29]&255)<<8,this.pad[7]=c[30]&255|(c[31]&255)<<8};Ae.prototype.blocks=function(c,l,f){for(var s=this.fin?0:2048,p,m,b,U,z,V,N,Se,G,re,oe,pe,de,se,ae,ie,L,Y,q,j=this.h[0],K=this.h[1],H=this.h[2],w=this.h[3],_=this.h[4],R=this.h[5],S=this.h[6],B=this.h[7],O=this.h[8],ee=this.h[9],he=this.r[0],xe=this.r[1],ge=this.r[2],x=this.r[3],we=this.r[4],Ue=this.r[5],Be=this.r[6],me=this.r[7],ve=this.r[8],Ee=this.r[9];f>=16;)p=c[l+0]&255|(c[l+1]&255)<<8,j+=p&8191,m=c[l+2]&255|(c[l+3]&255)<<8,K+=(p>>>13|m<<3)&8191,b=c[l+4]&255|(c[l+5]&255)<<8,H+=(m>>>10|b<<6)&8191,U=c[l+6]&255|(c[l+7]&255)<<8,w+=(b>>>7|U<<9)&8191,z=c[l+8]&255|(c[l+9]&255)<<8,_+=(U>>>4|z<<12)&8191,R+=z>>>1&8191,V=c[l+10]&255|(c[l+11]&255)<<8,S+=(z>>>14|V<<2)&8191,N=c[l+12]&255|(c[l+13]&255)<<8,B+=(V>>>11|N<<5)&8191,Se=c[l+14]&255|(c[l+15]&255)<<8,O+=(N>>>8|Se<<8)&8191,ee+=Se>>>5|s,G=0,re=G,re+=j*he,re+=K*(5*Ee),re+=H*(5*ve),re+=w*(5*me),re+=_*(5*Be),G=re>>>13,re&=8191,re+=R*(5*Ue),re+=S*(5*we),re+=B*(5*x),re+=O*(5*ge),re+=ee*(5*xe),G+=re>>>13,re&=8191,oe=G,oe+=j*xe,oe+=K*he,oe+=H*(5*Ee),oe+=w*(5*ve),oe+=_*(5*me),G=oe>>>13,oe&=8191,oe+=R*(5*Be),oe+=S*(5*Ue),oe+=B*(5*we),oe+=O*(5*x),oe+=ee*(5*ge),G+=oe>>>13,oe&=8191,pe=G,pe+=j*ge,pe+=K*xe,pe+=H*he,pe+=w*(5*Ee),pe+=_*(5*ve),G=pe>>>13,pe&=8191,pe+=R*(5*me),pe+=S*(5*Be),pe+=B*(5*Ue),pe+=O*(5*we),pe+=ee*(5*x),G+=pe>>>13,pe&=8191,de=G,de+=j*x,de+=K*ge,de+=H*xe,de+=w*he,de+=_*(5*Ee),G=de>>>13,de&=8191,de+=R*(5*ve),de+=S*(5*me),de+=B*(5*Be),de+=O*(5*Ue),de+=ee*(5*we),G+=de>>>13,de&=8191,se=G,se+=j*we,se+=K*x,se+=H*ge,se+=w*xe,se+=_*he,G=se>>>13,se&=8191,se+=R*(5*Ee),se+=S*(5*ve),se+=B*(5*me),se+=O*(5*Be),se+=ee*(5*Ue),G+=se>>>13,se&=8191,ae=G,ae+=j*Ue,ae+=K*we,ae+=H*x,ae+=w*ge,ae+=_*xe,G=ae>>>13,ae&=8191,ae+=R*he,ae+=S*(5*Ee),ae+=B*(5*ve),ae+=O*(5*me),ae+=ee*(5*Be),G+=ae>>>13,ae&=8191,ie=G,ie+=j*Be,ie+=K*Ue,ie+=H*we,ie+=w*x,ie+=_*ge,G=ie>>>13,ie&=8191,ie+=R*xe,ie+=S*he,ie+=B*(5*Ee),ie+=O*(5*ve),ie+=ee*(5*me),G+=ie>>>13,ie&=8191,L=G,L+=j*me,L+=K*Be,L+=H*Ue,L+=w*we,L+=_*x,G=L>>>13,L&=8191,L+=R*ge,L+=S*xe,L+=B*he,L+=O*(5*Ee),L+=ee*(5*ve),G+=L>>>13,L&=8191,Y=G,Y+=j*ve,Y+=K*me,Y+=H*Be,Y+=w*Ue,Y+=_*we,G=Y>>>13,Y&=8191,Y+=R*x,Y+=S*ge,Y+=B*xe,Y+=O*he,Y+=ee*(5*Ee),G+=Y>>>13,Y&=8191,q=G,q+=j*Ee,q+=K*ve,q+=H*me,q+=w*Be,q+=_*Ue,G=q>>>13,q&=8191,q+=R*we,q+=S*x,q+=B*ge,q+=O*xe,q+=ee*he,G+=q>>>13,q&=8191,G=(G<<2)+G|0,G=G+re|0,re=G&8191,G=G>>>13,oe+=G,j=re,K=oe,H=pe,w=de,_=se,R=ae,S=ie,B=L,O=Y,ee=q,l+=16,f-=16;this.h[0]=j,this.h[1]=K,this.h[2]=H,this.h[3]=w,this.h[4]=_,this.h[5]=R,this.h[6]=S,this.h[7]=B,this.h[8]=O,this.h[9]=ee},Ae.prototype.finish=function(c,l){var f=new Uint16Array(10),s,p,m,b;if(this.leftover){for(b=this.leftover,this.buffer[b++]=1;b<16;b++)this.buffer[b]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(s=this.h[1]>>>13,this.h[1]&=8191,b=2;b<10;b++)this.h[b]+=s,s=this.h[b]>>>13,this.h[b]&=8191;for(this.h[0]+=s*5,s=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=s,s=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=s,f[0]=this.h[0]+5,s=f[0]>>>13,f[0]&=8191,b=1;b<10;b++)f[b]=this.h[b]+s,s=f[b]>>>13,f[b]&=8191;for(f[9]-=1<<13,p=(s^1)-1,b=0;b<10;b++)f[b]&=p;for(p=~p,b=0;b<10;b++)this.h[b]=this.h[b]&p|f[b];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,m=this.h[0]+this.pad[0],this.h[0]=m&65535,b=1;b<8;b++)m=(this.h[b]+this.pad[b]|0)+(m>>>16)|0,this.h[b]=m&65535;c[l+0]=this.h[0]>>>0&255,c[l+1]=this.h[0]>>>8&255,c[l+2]=this.h[1]>>>0&255,c[l+3]=this.h[1]>>>8&255,c[l+4]=this.h[2]>>>0&255,c[l+5]=this.h[2]>>>8&255,c[l+6]=this.h[3]>>>0&255,c[l+7]=this.h[3]>>>8&255,c[l+8]=this.h[4]>>>0&255,c[l+9]=this.h[4]>>>8&255,c[l+10]=this.h[5]>>>0&255,c[l+11]=this.h[5]>>>8&255,c[l+12]=this.h[6]>>>0&255,c[l+13]=this.h[6]>>>8&255,c[l+14]=this.h[7]>>>0&255,c[l+15]=this.h[7]>>>8&255},Ae.prototype.update=function(c,l,f){var s,p;if(this.leftover){for(p=16-this.leftover,p>f&&(p=f),s=0;s<p;s++)this.buffer[this.leftover+s]=c[l+s];if(f-=p,l+=p,this.leftover+=p,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(f>=16&&(p=f-f%16,this.blocks(c,l,p),l+=p,f-=p),f){for(s=0;s<f;s++)this.buffer[this.leftover+s]=c[l+s];this.leftover+=f}};function ye(c,l,f,s,p,m){var b=new Ae(m);return b.update(f,s,p),b.finish(c,l),0}function Oe(c,l,f,s,p,m){var b=new Uint8Array(16);return ye(b,0,f,s,p,m),A(c,l,b,0)}function ze(c,l,f,s,p){var m;if(f<32)return-1;for(Te(c,0,l,0,f,s,p),ye(c,16,c,32,f-32,c),m=0;m<16;m++)c[m]=0;return 0}function rt(c,l,f,s,p){var m,b=new Uint8Array(32);if(f<32||(W(b,0,32,s,p),Oe(l,16,l,32,f-32,b)!==0))return-1;for(Te(c,0,l,0,f,s,p),m=0;m<32;m++)c[m]=0;return 0}function P(c,l){var f;for(f=0;f<16;f++)c[f]=l[f]|0}function $(c){var l,f,s=1;for(l=0;l<16;l++)f=c[l]+s+65535,s=Math.floor(f/65536),c[l]=f-s*65536;c[0]+=s-1+37*(s-1)}function ue(c,l,f){for(var s,p=~(f-1),m=0;m<16;m++)s=p&(c[m]^l[m]),c[m]^=s,l[m]^=s}function Ce(c,l){var f,s,p,m=e(),b=e();for(f=0;f<16;f++)b[f]=l[f];for($(b),$(b),$(b),s=0;s<2;s++){for(m[0]=b[0]-65517,f=1;f<15;f++)m[f]=b[f]-65535-(m[f-1]>>16&1),m[f-1]&=65535;m[15]=b[15]-32767-(m[14]>>16&1),p=m[15]>>16&1,m[14]&=65535,ue(b,m,1-p)}for(f=0;f<16;f++)c[2*f]=b[f]&255,c[2*f+1]=b[f]>>8}function Ie(c,l){var f=new Uint8Array(32),s=new Uint8Array(32);return Ce(f,c),Ce(s,l),E(f,0,s,0)}function Le(c){var l=new Uint8Array(32);return Ce(l,c),l[0]&1}function tt(c,l){var f;for(f=0;f<16;f++)c[f]=l[2*f]+(l[2*f+1]<<8);c[15]&=32767}function Pe(c,l,f){for(var s=0;s<16;s++)c[s]=l[s]+f[s]}function je(c,l,f){for(var s=0;s<16;s++)c[s]=l[s]-f[s]}function fe(c,l,f){var s,p,m=0,b=0,U=0,z=0,V=0,N=0,Se=0,G=0,re=0,oe=0,pe=0,de=0,se=0,ae=0,ie=0,L=0,Y=0,q=0,j=0,K=0,H=0,w=0,_=0,R=0,S=0,B=0,O=0,ee=0,he=0,xe=0,ge=0,x=f[0],we=f[1],Ue=f[2],Be=f[3],me=f[4],ve=f[5],Ee=f[6],Fe=f[7],Re=f[8],De=f[9],qe=f[10],Me=f[11],Qe=f[12],nt=f[13],ot=f[14],st=f[15];s=l[0],m+=s*x,b+=s*we,U+=s*Ue,z+=s*Be,V+=s*me,N+=s*ve,Se+=s*Ee,G+=s*Fe,re+=s*Re,oe+=s*De,pe+=s*qe,de+=s*Me,se+=s*Qe,ae+=s*nt,ie+=s*ot,L+=s*st,s=l[1],b+=s*x,U+=s*we,z+=s*Ue,V+=s*Be,N+=s*me,Se+=s*ve,G+=s*Ee,re+=s*Fe,oe+=s*Re,pe+=s*De,de+=s*qe,se+=s*Me,ae+=s*Qe,ie+=s*nt,L+=s*ot,Y+=s*st,s=l[2],U+=s*x,z+=s*we,V+=s*Ue,N+=s*Be,Se+=s*me,G+=s*ve,re+=s*Ee,oe+=s*Fe,pe+=s*Re,de+=s*De,se+=s*qe,ae+=s*Me,ie+=s*Qe,L+=s*nt,Y+=s*ot,q+=s*st,s=l[3],z+=s*x,V+=s*we,N+=s*Ue,Se+=s*Be,G+=s*me,re+=s*ve,oe+=s*Ee,pe+=s*Fe,de+=s*Re,se+=s*De,ae+=s*qe,ie+=s*Me,L+=s*Qe,Y+=s*nt,q+=s*ot,j+=s*st,s=l[4],V+=s*x,N+=s*we,Se+=s*Ue,G+=s*Be,re+=s*me,oe+=s*ve,pe+=s*Ee,de+=s*Fe,se+=s*Re,ae+=s*De,ie+=s*qe,L+=s*Me,Y+=s*Qe,q+=s*nt,j+=s*ot,K+=s*st,s=l[5],N+=s*x,Se+=s*we,G+=s*Ue,re+=s*Be,oe+=s*me,pe+=s*ve,de+=s*Ee,se+=s*Fe,ae+=s*Re,ie+=s*De,L+=s*qe,Y+=s*Me,q+=s*Qe,j+=s*nt,K+=s*ot,H+=s*st,s=l[6],Se+=s*x,G+=s*we,re+=s*Ue,oe+=s*Be,pe+=s*me,de+=s*ve,se+=s*Ee,ae+=s*Fe,ie+=s*Re,L+=s*De,Y+=s*qe,q+=s*Me,j+=s*Qe,K+=s*nt,H+=s*ot,w+=s*st,s=l[7],G+=s*x,re+=s*we,oe+=s*Ue,pe+=s*Be,de+=s*me,se+=s*ve,ae+=s*Ee,ie+=s*Fe,L+=s*Re,Y+=s*De,q+=s*qe,j+=s*Me,K+=s*Qe,H+=s*nt,w+=s*ot,_+=s*st,s=l[8],re+=s*x,oe+=s*we,pe+=s*Ue,de+=s*Be,se+=s*me,ae+=s*ve,ie+=s*Ee,L+=s*Fe,Y+=s*Re,q+=s*De,j+=s*qe,K+=s*Me,H+=s*Qe,w+=s*nt,_+=s*ot,R+=s*st,s=l[9],oe+=s*x,pe+=s*we,de+=s*Ue,se+=s*Be,ae+=s*me,ie+=s*ve,L+=s*Ee,Y+=s*Fe,q+=s*Re,j+=s*De,K+=s*qe,H+=s*Me,w+=s*Qe,_+=s*nt,R+=s*ot,S+=s*st,s=l[10],pe+=s*x,de+=s*we,se+=s*Ue,ae+=s*Be,ie+=s*me,L+=s*ve,Y+=s*Ee,q+=s*Fe,j+=s*Re,K+=s*De,H+=s*qe,w+=s*Me,_+=s*Qe,R+=s*nt,S+=s*ot,B+=s*st,s=l[11],de+=s*x,se+=s*we,ae+=s*Ue,ie+=s*Be,L+=s*me,Y+=s*ve,q+=s*Ee,j+=s*Fe,K+=s*Re,H+=s*De,w+=s*qe,_+=s*Me,R+=s*Qe,S+=s*nt,B+=s*ot,O+=s*st,s=l[12],se+=s*x,ae+=s*we,ie+=s*Ue,L+=s*Be,Y+=s*me,q+=s*ve,j+=s*Ee,K+=s*Fe,H+=s*Re,w+=s*De,_+=s*qe,R+=s*Me,S+=s*Qe,B+=s*nt,O+=s*ot,ee+=s*st,s=l[13],ae+=s*x,ie+=s*we,L+=s*Ue,Y+=s*Be,q+=s*me,j+=s*ve,K+=s*Ee,H+=s*Fe,w+=s*Re,_+=s*De,R+=s*qe,S+=s*Me,B+=s*Qe,O+=s*nt,ee+=s*ot,he+=s*st,s=l[14],ie+=s*x,L+=s*we,Y+=s*Ue,q+=s*Be,j+=s*me,K+=s*ve,H+=s*Ee,w+=s*Fe,_+=s*Re,R+=s*De,S+=s*qe,B+=s*Me,O+=s*Qe,ee+=s*nt,he+=s*ot,xe+=s*st,s=l[15],L+=s*x,Y+=s*we,q+=s*Ue,j+=s*Be,K+=s*me,H+=s*ve,w+=s*Ee,_+=s*Fe,R+=s*Re,S+=s*De,B+=s*qe,O+=s*Me,ee+=s*Qe,he+=s*nt,xe+=s*ot,ge+=s*st,m+=38*Y,b+=38*q,U+=38*j,z+=38*K,V+=38*H,N+=38*w,Se+=38*_,G+=38*R,re+=38*S,oe+=38*B,pe+=38*O,de+=38*ee,se+=38*he,ae+=38*xe,ie+=38*ge,p=1,s=m+p+65535,p=Math.floor(s/65536),m=s-p*65536,s=b+p+65535,p=Math.floor(s/65536),b=s-p*65536,s=U+p+65535,p=Math.floor(s/65536),U=s-p*65536,s=z+p+65535,p=Math.floor(s/65536),z=s-p*65536,s=V+p+65535,p=Math.floor(s/65536),V=s-p*65536,s=N+p+65535,p=Math.floor(s/65536),N=s-p*65536,s=Se+p+65535,p=Math.floor(s/65536),Se=s-p*65536,s=G+p+65535,p=Math.floor(s/65536),G=s-p*65536,s=re+p+65535,p=Math.floor(s/65536),re=s-p*65536,s=oe+p+65535,p=Math.floor(s/65536),oe=s-p*65536,s=pe+p+65535,p=Math.floor(s/65536),pe=s-p*65536,s=de+p+65535,p=Math.floor(s/65536),de=s-p*65536,s=se+p+65535,p=Math.floor(s/65536),se=s-p*65536,s=ae+p+65535,p=Math.floor(s/65536),ae=s-p*65536,s=ie+p+65535,p=Math.floor(s/65536),ie=s-p*65536,s=L+p+65535,p=Math.floor(s/65536),L=s-p*65536,m+=p-1+37*(p-1),p=1,s=m+p+65535,p=Math.floor(s/65536),m=s-p*65536,s=b+p+65535,p=Math.floor(s/65536),b=s-p*65536,s=U+p+65535,p=Math.floor(s/65536),U=s-p*65536,s=z+p+65535,p=Math.floor(s/65536),z=s-p*65536,s=V+p+65535,p=Math.floor(s/65536),V=s-p*65536,s=N+p+65535,p=Math.floor(s/65536),N=s-p*65536,s=Se+p+65535,p=Math.floor(s/65536),Se=s-p*65536,s=G+p+65535,p=Math.floor(s/65536),G=s-p*65536,s=re+p+65535,p=Math.floor(s/65536),re=s-p*65536,s=oe+p+65535,p=Math.floor(s/65536),oe=s-p*65536,s=pe+p+65535,p=Math.floor(s/65536),pe=s-p*65536,s=de+p+65535,p=Math.floor(s/65536),de=s-p*65536,s=se+p+65535,p=Math.floor(s/65536),se=s-p*65536,s=ae+p+65535,p=Math.floor(s/65536),ae=s-p*65536,s=ie+p+65535,p=Math.floor(s/65536),ie=s-p*65536,s=L+p+65535,p=Math.floor(s/65536),L=s-p*65536,m+=p-1+37*(p-1),c[0]=m,c[1]=b,c[2]=U,c[3]=z,c[4]=V,c[5]=N,c[6]=Se,c[7]=G,c[8]=re,c[9]=oe,c[10]=pe,c[11]=de,c[12]=se,c[13]=ae,c[14]=ie,c[15]=L}function Ve(c,l){fe(c,l,l)}function xr(c,l){var f=e(),s;for(s=0;s<16;s++)f[s]=l[s];for(s=253;s>=0;s--)Ve(f,f),s!==2&&s!==4&&fe(f,f,l);for(s=0;s<16;s++)c[s]=f[s]}function Ot(c,l){var f=e(),s;for(s=0;s<16;s++)f[s]=l[s];for(s=250;s>=0;s--)Ve(f,f),s!==1&&fe(f,f,l);for(s=0;s<16;s++)c[s]=f[s]}function mr(c,l,f){var s=new Uint8Array(32),p=new Float64Array(80),m,b,U=e(),z=e(),V=e(),N=e(),Se=e(),G=e();for(b=0;b<31;b++)s[b]=l[b];for(s[31]=l[31]&127|64,s[0]&=248,tt(p,f),b=0;b<16;b++)z[b]=p[b],N[b]=U[b]=V[b]=0;for(U[0]=N[0]=1,b=254;b>=0;--b)m=s[b>>>3]>>>(b&7)&1,ue(U,z,m),ue(V,N,m),Pe(Se,U,V),je(U,U,V),Pe(V,z,N),je(z,z,N),Ve(N,Se),Ve(G,U),fe(U,V,U),fe(V,z,Se),Pe(Se,U,V),je(U,U,V),Ve(z,U),je(V,N,G),fe(U,V,u),Pe(U,U,N),fe(V,V,U),fe(U,N,G),fe(N,z,p),Ve(z,Se),ue(U,z,m),ue(V,N,m);for(b=0;b<16;b++)p[b+16]=U[b],p[b+32]=V[b],p[b+48]=z[b],p[b+64]=N[b];var re=p.subarray(32),oe=p.subarray(16);return xr(re,re),fe(oe,oe,re),Ce(c,oe),0}function Ut(c,l){return mr(c,l,o)}function rr(c,l){return t(l,32),Ut(c,l)}function jr(c,l,f){var s=new Uint8Array(32);return mr(s,f,l),Z(c,n,s,F)}var nr=ze,xt=rt;function br(c,l,f,s,p,m){var b=new Uint8Array(32);return jr(b,p,m),nr(c,l,f,s,b)}function qo(c,l,f,s,p,m){var b=new Uint8Array(32);return jr(b,p,m),xt(c,l,f,s,b)}var Yn=[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 Ra(c,l,f,s){for(var p=new Int32Array(16),m=new Int32Array(16),b,U,z,V,N,Se,G,re,oe,pe,de,se,ae,ie,L,Y,q,j,K,H,w,_,R,S,B,O,ee=c[0],he=c[1],xe=c[2],ge=c[3],x=c[4],we=c[5],Ue=c[6],Be=c[7],me=l[0],ve=l[1],Ee=l[2],Fe=l[3],Re=l[4],De=l[5],qe=l[6],Me=l[7],Qe=0;s>=128;){for(K=0;K<16;K++)H=8*K+Qe,p[K]=f[H+0]<<24|f[H+1]<<16|f[H+2]<<8|f[H+3],m[K]=f[H+4]<<24|f[H+5]<<16|f[H+6]<<8|f[H+7];for(K=0;K<80;K++)if(b=ee,U=he,z=xe,V=ge,N=x,Se=we,G=Ue,re=Be,oe=me,pe=ve,de=Ee,se=Fe,ae=Re,ie=De,L=qe,Y=Me,w=Be,_=Me,R=_&65535,S=_>>>16,B=w&65535,O=w>>>16,w=(x>>>14|Re<<32-14)^(x>>>18|Re<<32-18)^(Re>>>41-32|x<<32-(41-32)),_=(Re>>>14|x<<32-14)^(Re>>>18|x<<32-18)^(x>>>41-32|Re<<32-(41-32)),R+=_&65535,S+=_>>>16,B+=w&65535,O+=w>>>16,w=x&we^~x&Ue,_=Re&De^~Re&qe,R+=_&65535,S+=_>>>16,B+=w&65535,O+=w>>>16,w=Yn[K*2],_=Yn[K*2+1],R+=_&65535,S+=_>>>16,B+=w&65535,O+=w>>>16,w=p[K%16],_=m[K%16],R+=_&65535,S+=_>>>16,B+=w&65535,O+=w>>>16,S+=R>>>16,B+=S>>>16,O+=B>>>16,q=B&65535|O<<16,j=R&65535|S<<16,w=q,_=j,R=_&65535,S=_>>>16,B=w&65535,O=w>>>16,w=(ee>>>28|me<<32-28)^(me>>>34-32|ee<<32-(34-32))^(me>>>39-32|ee<<32-(39-32)),_=(me>>>28|ee<<32-28)^(ee>>>34-32|me<<32-(34-32))^(ee>>>39-32|me<<32-(39-32)),R+=_&65535,S+=_>>>16,B+=w&65535,O+=w>>>16,w=ee&he^ee&xe^he&xe,_=me&ve^me&Ee^ve&Ee,R+=_&65535,S+=_>>>16,B+=w&65535,O+=w>>>16,S+=R>>>16,B+=S>>>16,O+=B>>>16,re=B&65535|O<<16,Y=R&65535|S<<16,w=V,_=se,R=_&65535,S=_>>>16,B=w&65535,O=w>>>16,w=q,_=j,R+=_&65535,S+=_>>>16,B+=w&65535,O+=w>>>16,S+=R>>>16,B+=S>>>16,O+=B>>>16,V=B&65535|O<<16,se=R&65535|S<<16,he=b,xe=U,ge=z,x=V,we=N,Ue=Se,Be=G,ee=re,ve=oe,Ee=pe,Fe=de,Re=se,De=ae,qe=ie,Me=L,me=Y,K%16===15)for(H=0;H<16;H++)w=p[H],_=m[H],R=_&65535,S=_>>>16,B=w&65535,O=w>>>16,w=p[(H+9)%16],_=m[(H+9)%16],R+=_&65535,S+=_>>>16,B+=w&65535,O+=w>>>16,q=p[(H+1)%16],j=m[(H+1)%16],w=(q>>>1|j<<32-1)^(q>>>8|j<<32-8)^q>>>7,_=(j>>>1|q<<32-1)^(j>>>8|q<<32-8)^(j>>>7|q<<32-7),R+=_&65535,S+=_>>>16,B+=w&65535,O+=w>>>16,q=p[(H+14)%16],j=m[(H+14)%16],w=(q>>>19|j<<32-19)^(j>>>61-32|q<<32-(61-32))^q>>>6,_=(j>>>19|q<<32-19)^(q>>>61-32|j<<32-(61-32))^(j>>>6|q<<32-6),R+=_&65535,S+=_>>>16,B+=w&65535,O+=w>>>16,S+=R>>>16,B+=S>>>16,O+=B>>>16,p[H]=B&65535|O<<16,m[H]=R&65535|S<<16;w=ee,_=me,R=_&65535,S=_>>>16,B=w&65535,O=w>>>16,w=c[0],_=l[0],R+=_&65535,S+=_>>>16,B+=w&65535,O+=w>>>16,S+=R>>>16,B+=S>>>16,O+=B>>>16,c[0]=ee=B&65535|O<<16,l[0]=me=R&65535|S<<16,w=he,_=ve,R=_&65535,S=_>>>16,B=w&65535,O=w>>>16,w=c[1],_=l[1],R+=_&65535,S+=_>>>16,B+=w&65535,O+=w>>>16,S+=R>>>16,B+=S>>>16,O+=B>>>16,c[1]=he=B&65535|O<<16,l[1]=ve=R&65535|S<<16,w=xe,_=Ee,R=_&65535,S=_>>>16,B=w&65535,O=w>>>16,w=c[2],_=l[2],R+=_&65535,S+=_>>>16,B+=w&65535,O+=w>>>16,S+=R>>>16,B+=S>>>16,O+=B>>>16,c[2]=xe=B&65535|O<<16,l[2]=Ee=R&65535|S<<16,w=ge,_=Fe,R=_&65535,S=_>>>16,B=w&65535,O=w>>>16,w=c[3],_=l[3],R+=_&65535,S+=_>>>16,B+=w&65535,O+=w>>>16,S+=R>>>16,B+=S>>>16,O+=B>>>16,c[3]=ge=B&65535|O<<16,l[3]=Fe=R&65535|S<<16,w=x,_=Re,R=_&65535,S=_>>>16,B=w&65535,O=w>>>16,w=c[4],_=l[4],R+=_&65535,S+=_>>>16,B+=w&65535,O+=w>>>16,S+=R>>>16,B+=S>>>16,O+=B>>>16,c[4]=x=B&65535|O<<16,l[4]=Re=R&65535|S<<16,w=we,_=De,R=_&65535,S=_>>>16,B=w&65535,O=w>>>16,w=c[5],_=l[5],R+=_&65535,S+=_>>>16,B+=w&65535,O+=w>>>16,S+=R>>>16,B+=S>>>16,O+=B>>>16,c[5]=we=B&65535|O<<16,l[5]=De=R&65535|S<<16,w=Ue,_=qe,R=_&65535,S=_>>>16,B=w&65535,O=w>>>16,w=c[6],_=l[6],R+=_&65535,S+=_>>>16,B+=w&65535,O+=w>>>16,S+=R>>>16,B+=S>>>16,O+=B>>>16,c[6]=Ue=B&65535|O<<16,l[6]=qe=R&65535|S<<16,w=Be,_=Me,R=_&65535,S=_>>>16,B=w&65535,O=w>>>16,w=c[7],_=l[7],R+=_&65535,S+=_>>>16,B+=w&65535,O+=w>>>16,S+=R>>>16,B+=S>>>16,O+=B>>>16,c[7]=Be=B&65535|O<<16,l[7]=Me=R&65535|S<<16,Qe+=128,s-=128}return s}function Kr(c,l,f){var s=new Int32Array(8),p=new Int32Array(8),m=new Uint8Array(256),b,U=f;for(s[0]=1779033703,s[1]=3144134277,s[2]=1013904242,s[3]=2773480762,s[4]=1359893119,s[5]=2600822924,s[6]=528734635,s[7]=1541459225,p[0]=4089235720,p[1]=2227873595,p[2]=4271175723,p[3]=1595750129,p[4]=2917565137,p[5]=725511199,p[6]=4215389547,p[7]=327033209,Ra(s,p,l,f),f%=128,b=0;b<f;b++)m[b]=l[U-f+b];for(m[f]=128,f=256-128*(f<112?1:0),m[f-9]=0,v(m,f-8,U/536870912|0,U<<3),Ra(s,p,m,f),b=0;b<8;b++)v(c,8*b,s[b],p[b]);return 0}function Mo(c,l){var f=e(),s=e(),p=e(),m=e(),b=e(),U=e(),z=e(),V=e(),N=e();je(f,c[1],c[0]),je(N,l[1],l[0]),fe(f,f,N),Pe(s,c[0],c[1]),Pe(N,l[0],l[1]),fe(s,s,N),fe(p,c[3],l[3]),fe(p,p,h),fe(m,c[2],l[2]),Pe(m,m,m),je(b,s,f),je(U,m,p),Pe(z,m,p),Pe(V,s,f),fe(c[0],b,U),fe(c[1],V,z),fe(c[2],z,U),fe(c[3],b,V)}function ka(c,l,f){var s;for(s=0;s<4;s++)ue(c[s],l[s],f)}function Qs(c,l){var f=e(),s=e(),p=e();xr(p,l[2]),fe(f,l[0],p),fe(s,l[1],p),Ce(c,s),c[31]^=Le(f)<<7}function Ws(c,l,f){var s,p;for(P(c[0],i),P(c[1],a),P(c[2],a),P(c[3],i),p=255;p>=0;--p)s=f[p/8|0]>>(p&7)&1,ka(c,l,s),Mo(l,c),Mo(c,c),ka(c,l,s)}function Go(c,l){var f=[e(),e(),e(),e()];P(f[0],y),P(f[1],g),P(f[2],a),fe(f[3],y,g),Ws(c,f,l)}function Ys(c,l,f){var s=new Uint8Array(64),p=[e(),e(),e(),e()],m;for(f||t(l,32),Kr(s,l,32),s[0]&=248,s[31]&=127,s[31]|=64,Go(p,s),Qs(c,p),m=0;m<32;m++)l[m+32]=c[m];return 0}var Lo=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 Xs(c,l){var f,s,p,m;for(s=63;s>=32;--s){for(f=0,p=s-32,m=s-12;p<m;++p)l[p]+=f-16*l[s]*Lo[p-(s-32)],f=Math.floor((l[p]+128)/256),l[p]-=f*256;l[p]+=f,l[s]=0}for(f=0,p=0;p<32;p++)l[p]+=f-(l[31]>>4)*Lo[p],f=l[p]>>8,l[p]&=255;for(p=0;p<32;p++)l[p]-=f*Lo[p];for(s=0;s<32;s++)l[s+1]+=l[s]>>8,c[s]=l[s]&255}function Zs(c){var l=new Float64Array(64),f;for(f=0;f<64;f++)l[f]=c[f];for(f=0;f<64;f++)c[f]=0;Xs(c,l)}function Oa(c,l,f,s){var p=new Uint8Array(64),m=new Uint8Array(64),b=new Uint8Array(64),U,z,V=new Float64Array(64),N=[e(),e(),e(),e()];Kr(p,s,32),p[0]&=248,p[31]&=127,p[31]|=64;var Se=f+64;for(U=0;U<f;U++)c[64+U]=l[U];for(U=0;U<32;U++)c[32+U]=p[32+U];for(Kr(b,c.subarray(32),f+32),Zs(b),Go(N,b),Qs(c,N),U=32;U<64;U++)c[U]=s[U];for(Kr(m,c,f+64),Zs(m),U=0;U<64;U++)V[U]=0;for(U=0;U<32;U++)V[U]=b[U];for(U=0;U<32;U++)for(z=0;z<32;z++)V[U+z]+=m[U]*p[z];return Xs(c.subarray(32),V),Se}function nd(c,l){var f=e(),s=e(),p=e(),m=e(),b=e(),U=e(),z=e();return P(c[2],a),tt(c[1],l),Ve(p,c[1]),fe(m,p,d),je(p,p,c[2]),Pe(m,c[2],m),Ve(b,m),Ve(U,b),fe(z,U,b),fe(f,z,p),fe(f,f,m),Ot(f,f),fe(f,f,p),fe(f,f,m),fe(f,f,m),fe(c[0],f,m),Ve(s,c[0]),fe(s,s,m),Ie(s,p)&&fe(c[0],c[0],T),Ve(s,c[0]),fe(s,s,m),Ie(s,p)?-1:(Le(c[0])===l[31]>>7&&je(c[0],i,c[0]),fe(c[3],c[0],c[1]),0)}function Js(c,l,f,s){var p,m=new Uint8Array(32),b=new Uint8Array(64),U=[e(),e(),e(),e()],z=[e(),e(),e(),e()];if(f<64||nd(z,s))return-1;for(p=0;p<f;p++)c[p]=l[p];for(p=0;p<32;p++)c[p+32]=s[p];if(Kr(b,c,f),Zs(b),Ws(U,z,b),Go(z,l.subarray(32)),Mo(U,z),Qs(m,U),f-=64,E(l,0,m,0)){for(p=0;p<f;p++)c[p]=0;return-1}for(p=0;p<f;p++)c[p]=l[p+64];return f}var ei=32,Fo=24,Xn=32,Un=16,Zn=32,$o=32,Jn=32,eo=32,ti=32,za=Fo,od=Xn,sd=Un,or=64,Vr=32,Bn=64,ri=32,ni=64;r.lowlevel={crypto_core_hsalsa20:Z,crypto_stream_xor:Te,crypto_stream:W,crypto_stream_salsa20_xor:Q,crypto_stream_salsa20:J,crypto_onetimeauth:ye,crypto_onetimeauth_verify:Oe,crypto_verify_16:A,crypto_verify_32:E,crypto_secretbox:ze,crypto_secretbox_open:rt,crypto_scalarmult:mr,crypto_scalarmult_base:Ut,crypto_box_beforenm:jr,crypto_box_afternm:nr,crypto_box:br,crypto_box_open:qo,crypto_box_keypair:rr,crypto_hash:Kr,crypto_sign:Oa,crypto_sign_keypair:Ys,crypto_sign_open:Js,crypto_secretbox_KEYBYTES:ei,crypto_secretbox_NONCEBYTES:Fo,crypto_secretbox_ZEROBYTES:Xn,crypto_secretbox_BOXZEROBYTES:Un,crypto_scalarmult_BYTES:Zn,crypto_scalarmult_SCALARBYTES:$o,crypto_box_PUBLICKEYBYTES:Jn,crypto_box_SECRETKEYBYTES:eo,crypto_box_BEFORENMBYTES:ti,crypto_box_NONCEBYTES:za,crypto_box_ZEROBYTES:od,crypto_box_BOXZEROBYTES:sd,crypto_sign_BYTES:or,crypto_sign_PUBLICKEYBYTES:Vr,crypto_sign_SECRETKEYBYTES:Bn,crypto_sign_SEEDBYTES:ri,crypto_hash_BYTES:ni,gf:e,D:d,L:Lo,pack25519:Ce,unpack25519:tt,M:fe,A:Pe,S:Ve,Z:je,pow2523:Ot,add:Mo,set25519:P,modL:Xs,scalarmult:Ws,scalarbase:Go};function Pa(c,l){if(c.length!==ei)throw new Error("bad key size");if(l.length!==Fo)throw new Error("bad nonce size")}function id(c,l){if(c.length!==Jn)throw new Error("bad public key size");if(l.length!==eo)throw new Error("bad secret key size")}function mt(){for(var c=0;c<arguments.length;c++)if(!(arguments[c]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Ha(c){for(var l=0;l<c.length;l++)c[l]=0}r.randomBytes=function(c){var l=new Uint8Array(c);return t(l,c),l},r.secretbox=function(c,l,f){mt(c,l,f),Pa(f,l);for(var s=new Uint8Array(Xn+c.length),p=new Uint8Array(s.length),m=0;m<c.length;m++)s[m+Xn]=c[m];return ze(p,s,s.length,l,f),p.subarray(Un)},r.secretbox.open=function(c,l,f){mt(c,l,f),Pa(f,l);for(var s=new Uint8Array(Un+c.length),p=new Uint8Array(s.length),m=0;m<c.length;m++)s[m+Un]=c[m];return s.length<32||rt(p,s,s.length,l,f)!==0?null:p.subarray(Xn)},r.secretbox.keyLength=ei,r.secretbox.nonceLength=Fo,r.secretbox.overheadLength=Un,r.scalarMult=function(c,l){if(mt(c,l),c.length!==$o)throw new Error("bad n size");if(l.length!==Zn)throw new Error("bad p size");var f=new Uint8Array(Zn);return mr(f,c,l),f},r.scalarMult.base=function(c){if(mt(c),c.length!==$o)throw new Error("bad n size");var l=new Uint8Array(Zn);return Ut(l,c),l},r.scalarMult.scalarLength=$o,r.scalarMult.groupElementLength=Zn,r.box=function(c,l,f,s){var p=r.box.before(f,s);return r.secretbox(c,l,p)},r.box.before=function(c,l){mt(c,l),id(c,l);var f=new Uint8Array(ti);return jr(f,c,l),f},r.box.after=r.secretbox,r.box.open=function(c,l,f,s){var p=r.box.before(f,s);return r.secretbox.open(c,l,p)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var c=new Uint8Array(Jn),l=new Uint8Array(eo);return rr(c,l),{publicKey:c,secretKey:l}},r.box.keyPair.fromSecretKey=function(c){if(mt(c),c.length!==eo)throw new Error("bad secret key size");var l=new Uint8Array(Jn);return Ut(l,c),{publicKey:l,secretKey:new Uint8Array(c)}},r.box.publicKeyLength=Jn,r.box.secretKeyLength=eo,r.box.sharedKeyLength=ti,r.box.nonceLength=za,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(c,l){if(mt(c,l),l.length!==Bn)throw new Error("bad secret key size");var f=new Uint8Array(or+c.length);return Oa(f,c,c.length,l),f},r.sign.open=function(c,l){if(mt(c,l),l.length!==Vr)throw new Error("bad public key size");var f=new Uint8Array(c.length),s=Js(f,c,c.length,l);if(s<0)return null;for(var p=new Uint8Array(s),m=0;m<p.length;m++)p[m]=f[m];return p},r.sign.detached=function(c,l){for(var f=r.sign(c,l),s=new Uint8Array(or),p=0;p<s.length;p++)s[p]=f[p];return s},r.sign.detached.verify=function(c,l,f){if(mt(c,l,f),l.length!==or)throw new Error("bad signature size");if(f.length!==Vr)throw new Error("bad public key size");var s=new Uint8Array(or+c.length),p=new Uint8Array(or+c.length),m;for(m=0;m<or;m++)s[m]=l[m];for(m=0;m<c.length;m++)s[m+or]=c[m];return Js(p,s,s.length,f)>=0},r.sign.keyPair=function(){var c=new Uint8Array(Vr),l=new Uint8Array(Bn);return Ys(c,l),{publicKey:c,secretKey:l}},r.sign.keyPair.fromSecretKey=function(c){if(mt(c),c.length!==Bn)throw new Error("bad secret key size");for(var l=new Uint8Array(Vr),f=0;f<l.length;f++)l[f]=c[32+f];return{publicKey:l,secretKey:new Uint8Array(c)}},r.sign.keyPair.fromSeed=function(c){if(mt(c),c.length!==ri)throw new Error("bad seed size");for(var l=new Uint8Array(Vr),f=new Uint8Array(Bn),s=0;s<32;s++)f[s]=c[s];return Ys(l,f,!0),{publicKey:l,secretKey:f}},r.sign.publicKeyLength=Vr,r.sign.secretKeyLength=Bn,r.sign.seedLength=ri,r.sign.signatureLength=or,r.hash=function(c){mt(c);var l=new Uint8Array(ni);return Kr(l,c,c.length),l},r.hash.hashLength=ni,r.verify=function(c,l){return mt(c,l),c.length===0||l.length===0||c.length!==l.length?!1:I(c,0,l,0,c.length)===0},r.setPRNG=function(c){t=c},function(){var c=typeof self!="undefined"?self.crypto||self.msCrypto:null;if(c&&c.getRandomValues){var l=65536;r.setPRNG(function(f,s){var p,m=new Uint8Array(s);for(p=0;p<s;p+=l)c.getRandomValues(m.subarray(p,p+Math.min(s-p,l)));for(p=0;p<s;p++)f[p]=m[p];Ha(m)})}else typeof Da!="undefined"&&(c=Cu(),c&&c.randomBytes&&r.setPRNG(function(f,s){var p,m=c.randomBytes(s);for(p=0;p<s;p++)f[p]=m[p];Ha(m)}))}()})(typeof ds!="undefined"&&ds.exports?ds.exports:self.nacl=self.nacl||{})});var bo=ce(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.output=dt.exists=dt.hash=dt.bytes=dt.bool=dt.number=void 0;function vs(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}dt.number=vs;function tf(r){if(typeof r!="boolean")throw new Error(`Expected boolean, not ${r}`)}dt.bool=tf;function oa(r,...e){if(!(r instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(e.length>0&&!e.includes(r.length))throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${r.length}`)}dt.bytes=oa;function rf(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");vs(r.outputLen),vs(r.blockLen)}dt.hash=rf;function nf(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}dt.exists=nf;function of(r,e){oa(r);let t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}dt.output=of;var Dh={number:vs,bool:tf,bytes:oa,hash:rf,exists:nf,output:of};dt.default=Dh});var sf=ce(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.crypto=void 0;Es.crypto={node:void 0,web:typeof self=="object"&&"crypto"in self?self.crypto:void 0}});var fn=ce(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.randomBytes=_e.wrapConstructorWithOpts=_e.wrapConstructor=_e.checkOpts=_e.Hash=_e.concatBytes=_e.toBytes=_e.utf8ToBytes=_e.asyncLoop=_e.nextTick=_e.hexToBytes=_e.bytesToHex=_e.isLE=_e.rotr=_e.createView=_e.u32=_e.u8=void 0;var Ss=sf(),qh=r=>new Uint8Array(r.buffer,r.byteOffset,r.byteLength);_e.u8=qh;var Mh=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4));_e.u32=Mh;var Gh=r=>new DataView(r.buffer,r.byteOffset,r.byteLength);_e.createView=Gh;var Lh=(r,e)=>r<<32-e|r>>>e;_e.rotr=Lh;_e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!_e.isLE)throw new Error("Non little-endian hardware is not supported");var Fh=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function $h(r){if(!(r instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(let t=0;t<r.length;t++)e+=Fh[r[t]];return e}_e.bytesToHex=$h;function jh(r){if(typeof r!="string")throw new TypeError("hexToBytes: expected string, got "+typeof r);if(r.length%2)throw new Error("hexToBytes: received invalid unpadded hex");let e=new Uint8Array(r.length/2);for(let t=0;t<e.length;t++){let n=t*2,o=r.slice(n,n+2),i=Number.parseInt(o,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");e[t]=i}return e}_e.hexToBytes=jh;var Kh=async()=>{};_e.nextTick=Kh;async function Vh(r,e,t){let n=Date.now();for(let o=0;o<r;o++){t(o);let i=Date.now()-n;i>=0&&i<e||(await(0,_e.nextTick)(),n+=i)}}_e.asyncLoop=Vh;function af(r){if(typeof r!="string")throw new TypeError(`utf8ToBytes expected string, got ${typeof r}`);return new TextEncoder().encode(r)}_e.utf8ToBytes=af;function ia(r){if(typeof r=="string"&&(r=af(r)),!(r instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof r})`);return r}_e.toBytes=ia;function Qh(...r){if(!r.every(n=>n instanceof Uint8Array))throw new Error("Uint8Array list expected");if(r.length===1)return r[0];let e=r.reduce((n,o)=>n+o.length,0),t=new Uint8Array(e);for(let n=0,o=0;n<r.length;n++){let i=r[n];t.set(i,o),o+=i.length}return t}_e.concatBytes=Qh;var sa=class{clone(){return this._cloneInto()}};_e.Hash=sa;var Wh=r=>Object.prototype.toString.call(r)==="[object Object]"&&r.constructor===Object;function Yh(r,e){if(e!==void 0&&(typeof e!="object"||!Wh(e)))throw new TypeError("Options should be object or undefined");return Object.assign(r,e)}_e.checkOpts=Yh;function Xh(r){let e=n=>r().update(ia(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}_e.wrapConstructor=Xh;function Zh(r){let e=(n,o)=>r(o).update(ia(n)).digest(),t=r({});return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=n=>r(n),e}_e.wrapConstructorWithOpts=Zh;function Jh(r=32){if(Ss.crypto.web)return Ss.crypto.web.getRandomValues(new Uint8Array(r));if(Ss.crypto.node)return new Uint8Array(Ss.crypto.node.randomBytes(r).buffer);throw new Error("The environment doesn't have randomBytes function")}_e.randomBytes=Jh});var uf=ce(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.hmac=void 0;var Us=bo(),cf=fn(),Bs=class extends cf.Hash{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,Us.default.hash(e);let n=(0,cf.toBytes)(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,i=new Uint8Array(o);i.set(n.length>o?e.create().update(n).digest():n);for(let a=0;a<i.length;a++)i[a]^=54;this.iHash.update(i),this.oHash=e.create();for(let a=0;a<i.length;a++)i[a]^=106;this.oHash.update(i),i.fill(0)}update(e){return Us.default.exists(this),this.iHash.update(e),this}digestInto(e){Us.default.exists(this),Us.default.bytes(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:n,finished:o,destroyed:i,blockLen:a,outputLen:u}=this;return e=e,e.finished=o,e.destroyed=i,e.blockLen=a,e.outputLen=u,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},e0=(r,e,t)=>new Bs(r,e).update(t).digest();Ao.hmac=e0;Ao.hmac.create=(r,e)=>new Bs(r,e)});var df=ce(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.pbkdf2Async=Kn.pbkdf2=void 0;var Cs=bo(),t0=uf(),jn=fn();function ff(r,e,t,n){Cs.default.hash(r);let o=(0,jn.checkOpts)({dkLen:32,asyncTick:10},n),{c:i,dkLen:a,asyncTick:u}=o;if(Cs.default.number(i),Cs.default.number(a),Cs.default.number(u),i<1)throw new Error("PBKDF2: iterations (c) should be >= 1");let d=(0,jn.toBytes)(e),h=(0,jn.toBytes)(t),y=new Uint8Array(a),g=t0.hmac.create(r,d),T=g._cloneInto().update(h);return{c:i,dkLen:a,asyncTick:u,DK:y,PRF:g,PRFSalt:T}}function lf(r,e,t,n,o){return r.destroy(),e.destroy(),n&&n.destroy(),o.fill(0),t}function r0(r,e,t,n){let{c:o,dkLen:i,DK:a,PRF:u,PRFSalt:d}=ff(r,e,t,n),h,y=new Uint8Array(4),g=(0,jn.createView)(y),T=new Uint8Array(u.outputLen);for(let v=1,I=0;I<i;v++,I+=u.outputLen){let A=a.subarray(I,I+u.outputLen);g.setInt32(0,v,!1),(h=d._cloneInto(h)).update(y).digestInto(T),A.set(T.subarray(0,A.length));for(let E=1;E<o;E++){u._cloneInto(h).update(T).digestInto(T);for(let k=0;k<A.length;k++)A[k]^=T[k]}}return lf(u,d,a,h,T)}Kn.pbkdf2=r0;async function n0(r,e,t,n){let{c:o,dkLen:i,asyncTick:a,DK:u,PRF:d,PRFSalt:h}=ff(r,e,t,n),y,g=new Uint8Array(4),T=(0,jn.createView)(g),v=new Uint8Array(d.outputLen);for(let I=1,A=0;A<i;I++,A+=d.outputLen){let E=u.subarray(A,A+d.outputLen);T.setInt32(0,I,!1),(y=h._cloneInto(y)).update(g).digestInto(v),E.set(v.subarray(0,E.length)),await(0,jn.asyncLoop)(o-1,a,k=>{d._cloneInto(y).update(v).digestInto(v);for(let D=0;D<E.length;D++)E[D]^=v[D]})}return lf(d,h,u,y,v)}Kn.pbkdf2Async=n0});var ua=ce(Is=>{"use strict";Object.defineProperty(Is,"__esModule",{value:!0});Is.SHA2=void 0;var aa=bo(),wo=fn();function o0(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let o=BigInt(32),i=BigInt(4294967295),a=Number(t>>o&i),u=Number(t&i),d=n?4:0,h=n?0:4;r.setUint32(e+d,a,n),r.setUint32(e+h,u,n)}var ca=class extends wo.Hash{constructor(e,t,n,o){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,wo.createView)(this.buffer)}update(e){aa.default.exists(this);let{view:t,buffer:n,blockLen:o}=this;e=(0,wo.toBytes)(e);let i=e.length;for(let a=0;a<i;){let u=Math.min(o-this.pos,i-a);if(u===o){let d=(0,wo.createView)(e);for(;o<=i-a;a+=o)this.process(d,a);continue}n.set(e.subarray(a,a+u),this.pos),this.pos+=u,a+=u,this.pos===o&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){aa.default.exists(this),aa.default.output(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:o,isLE:i}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(n,0),a=0);for(let d=a;d<o;d++)t[d]=0;o0(n,o-8,BigInt(this.length*8),i),this.process(n,0);let u=(0,wo.createView)(e);this.get().forEach((d,h)=>u.setUint32(4*h,d,i))}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:o,finished:i,destroyed:a,pos:u}=this;return e.length=o,e.pos=u,e.finished=i,e.destroyed=a,o%t&&e.buffer.set(n),e}};Is.SHA2=ca});var pf=ce(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.sha256=void 0;var s0=ua(),Nt=fn(),i0=(r,e,t)=>r&e^~r&t,a0=(r,e,t)=>r&e^r&t^e&t,c0=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]),kr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Or=new Uint32Array(64),fa=class extends s0.SHA2{constructor(){super(64,32,8,!1),this.A=kr[0]|0,this.B=kr[1]|0,this.C=kr[2]|0,this.D=kr[3]|0,this.E=kr[4]|0,this.F=kr[5]|0,this.G=kr[6]|0,this.H=kr[7]|0}get(){let{A:e,B:t,C:n,D:o,E:i,F:a,G:u,H:d}=this;return[e,t,n,o,i,a,u,d]}set(e,t,n,o,i,a,u,d){this.A=e|0,this.B=t|0,this.C=n|0,this.D=o|0,this.E=i|0,this.F=a|0,this.G=u|0,this.H=d|0}process(e,t){for(let g=0;g<16;g++,t+=4)Or[g]=e.getUint32(t,!1);for(let g=16;g<64;g++){let T=Or[g-15],v=Or[g-2],I=(0,Nt.rotr)(T,7)^(0,Nt.rotr)(T,18)^T>>>3,A=(0,Nt.rotr)(v,17)^(0,Nt.rotr)(v,19)^v>>>10;Or[g]=A+Or[g-7]+I+Or[g-16]|0}let{A:n,B:o,C:i,D:a,E:u,F:d,G:h,H:y}=this;for(let g=0;g<64;g++){let T=(0,Nt.rotr)(u,6)^(0,Nt.rotr)(u,11)^(0,Nt.rotr)(u,25),v=y+T+i0(u,d,h)+c0[g]+Or[g]|0,A=((0,Nt.rotr)(n,2)^(0,Nt.rotr)(n,13)^(0,Nt.rotr)(n,22))+a0(n,o,i)|0;y=h,h=d,d=u,u=a+v|0,a=i,i=o,o=n,n=v+A|0}n=n+this.A|0,o=o+this.B|0,i=i+this.C|0,a=a+this.D|0,u=u+this.E|0,d=d+this.F|0,h=h+this.G|0,y=y+this.H|0,this.set(n,o,i,a,u,d,h,y)}roundClean(){Or.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};Rs.sha256=(0,Nt.wrapConstructor)(()=>new fa)});var yf=ce(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.add=Rt.toBig=Rt.split=Rt.fromBig=void 0;var ks=BigInt(2**32-1),la=BigInt(32);function da(r,e=!1){return e?{h:Number(r&ks),l:Number(r>>la&ks)}:{h:Number(r>>la&ks)|0,l:Number(r&ks)|0}}Rt.fromBig=da;function hf(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o<r.length;o++){let{h:i,l:a}=da(r[o],e);[t[o],n[o]]=[i,a]}return[t,n]}Rt.split=hf;var u0=(r,e)=>BigInt(r>>>0)<<la|BigInt(e>>>0);Rt.toBig=u0;var f0=(r,e,t)=>r>>>t,l0=(r,e,t)=>r<<32-t|e>>>t,d0=(r,e,t)=>r>>>t|e<<32-t,p0=(r,e,t)=>r<<32-t|e>>>t,h0=(r,e,t)=>r<<64-t|e>>>t-32,g0=(r,e,t)=>r>>>t-32|e<<64-t,y0=(r,e)=>e,x0=(r,e)=>r,m0=(r,e,t)=>r<<t|e>>>32-t,b0=(r,e,t)=>e<<t|r>>>32-t,A0=(r,e,t)=>e<<t-32|r>>>64-t,w0=(r,e,t)=>r<<t-32|e>>>64-t;function gf(r,e,t,n){let o=(e>>>0)+(n>>>0);return{h:r+t+(o/2**32|0)|0,l:o|0}}Rt.add=gf;var _0=(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),T0=(r,e,t,n)=>e+t+n+(r/2**32|0)|0,v0=(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),E0=(r,e,t,n,o)=>e+t+n+o+(r/2**32|0)|0,S0=(r,e,t,n,o)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(o>>>0),U0=(r,e,t,n,o,i)=>e+t+n+o+i+(r/2**32|0)|0,B0={fromBig:da,split:hf,toBig:Rt.toBig,shrSH:f0,shrSL:l0,rotrSH:d0,rotrSL:p0,rotrBH:h0,rotrBL:g0,rotr32H:y0,rotr32L:x0,rotlSH:m0,rotlSL:b0,rotlBH:A0,rotlBL:w0,add:gf,add3L:_0,add3H:T0,add4L:v0,add4H:E0,add5H:U0,add5L:S0};Rt.default=B0});var xf=ce(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.sha384=jt.sha512_256=jt.sha512=jt.SHA512=void 0;var C0=ua(),be=yf(),ga=fn(),[I0,R0]=be.default.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))),zr=new Uint32Array(80),Pr=new Uint32Array(80),Vn=class extends C0.SHA2{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:e,Al:t,Bh:n,Bl:o,Ch:i,Cl:a,Dh:u,Dl:d,Eh:h,El:y,Fh:g,Fl:T,Gh:v,Gl:I,Hh:A,Hl:E}=this;return[e,t,n,o,i,a,u,d,h,y,g,T,v,I,A,E]}set(e,t,n,o,i,a,u,d,h,y,g,T,v,I,A,E){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=o|0,this.Ch=i|0,this.Cl=a|0,this.Dh=u|0,this.Dl=d|0,this.Eh=h|0,this.El=y|0,this.Fh=g|0,this.Fl=T|0,this.Gh=v|0,this.Gl=I|0,this.Hh=A|0,this.Hl=E|0}process(e,t){for(let C=0;C<16;C++,t+=4)zr[C]=e.getUint32(t),Pr[C]=e.getUint32(t+=4);for(let C=16;C<80;C++){let Z=zr[C-15]|0,F=Pr[C-15]|0,Q=be.default.rotrSH(Z,F,1)^be.default.rotrSH(Z,F,8)^be.default.shrSH(Z,F,7),J=be.default.rotrSL(Z,F,1)^be.default.rotrSL(Z,F,8)^be.default.shrSL(Z,F,7),W=zr[C-2]|0,Te=Pr[C-2]|0,Ae=be.default.rotrSH(W,Te,19)^be.default.rotrBH(W,Te,61)^be.default.shrSH(W,Te,6),ye=be.default.rotrSL(W,Te,19)^be.default.rotrBL(W,Te,61)^be.default.shrSL(W,Te,6),Oe=be.default.add4L(J,ye,Pr[C-7],Pr[C-16]),ze=be.default.add4H(Oe,Q,Ae,zr[C-7],zr[C-16]);zr[C]=ze|0,Pr[C]=Oe|0}let{Ah:n,Al:o,Bh:i,Bl:a,Ch:u,Cl:d,Dh:h,Dl:y,Eh:g,El:T,Fh:v,Fl:I,Gh:A,Gl:E,Hh:k,Hl:D}=this;for(let C=0;C<80;C++){let Z=be.default.rotrSH(g,T,14)^be.default.rotrSH(g,T,18)^be.default.rotrBH(g,T,41),F=be.default.rotrSL(g,T,14)^be.default.rotrSL(g,T,18)^be.default.rotrBL(g,T,41),Q=g&v^~g&A,J=T&I^~T&E,W=be.default.add5L(D,F,J,R0[C],Pr[C]),Te=be.default.add5H(W,k,Z,Q,I0[C],zr[C]),Ae=W|0,ye=be.default.rotrSH(n,o,28)^be.default.rotrBH(n,o,34)^be.default.rotrBH(n,o,39),Oe=be.default.rotrSL(n,o,28)^be.default.rotrBL(n,o,34)^be.default.rotrBL(n,o,39),ze=n&i^n&u^i&u,rt=o&a^o&d^a&d;k=A|0,D=E|0,A=v|0,E=I|0,v=g|0,I=T|0,{h:g,l:T}=be.default.add(h|0,y|0,Te|0,Ae|0),h=u|0,y=d|0,u=i|0,d=a|0,i=n|0,a=o|0;let P=be.default.add3L(Ae,Oe,rt);n=be.default.add3H(P,Te,ye,ze),o=P|0}({h:n,l:o}=be.default.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:i,l:a}=be.default.add(this.Bh|0,this.Bl|0,i|0,a|0),{h:u,l:d}=be.default.add(this.Ch|0,this.Cl|0,u|0,d|0),{h,l:y}=be.default.add(this.Dh|0,this.Dl|0,h|0,y|0),{h:g,l:T}=be.default.add(this.Eh|0,this.El|0,g|0,T|0),{h:v,l:I}=be.default.add(this.Fh|0,this.Fl|0,v|0,I|0),{h:A,l:E}=be.default.add(this.Gh|0,this.Gl|0,A|0,E|0),{h:k,l:D}=be.default.add(this.Hh|0,this.Hl|0,k|0,D|0),this.set(n,o,i,a,u,d,h,y,g,T,v,I,A,E,k,D)}roundClean(){zr.fill(0),Pr.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)}};jt.SHA512=Vn;var pa=class extends Vn{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}},ha=class extends Vn{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}};jt.sha512=(0,ga.wrapConstructor)(()=>new Vn);jt.sha512_256=(0,ga.wrapConstructor)(()=>new pa);jt.sha384=(0,ga.wrapConstructor)(()=>new ha)});var Cf=ce(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.bytes=X.stringToBytes=X.str=X.bytesToString=X.hex=X.utf8=X.bech32m=X.bech32=X.base58check=X.base58xmr=X.base58xrp=X.base58flickr=X.base58=X.base64url=X.base64=X.base32crockford=X.base32hex=X.base32=X.base16=X.utils=X.assertNumber=void 0;function Hr(r){if(!Number.isSafeInteger(r))throw new Error(`Wrong integer: ${r}`)}X.assertNumber=Hr;function Dt(...r){let e=(o,i)=>a=>o(i(a)),t=Array.from(r).reverse().reduce((o,i)=>o?e(o,i.encode):i.encode,void 0),n=r.reduce((o,i)=>o?e(o,i.decode):i.decode,void 0);return{encode:t,decode:n}}function Kt(r){return{encode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return e.map(t=>{if(Hr(t),t<0||t>=r.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${r.length})`);return r[t]})},decode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("alphabet.decode input should be array of strings");return e.map(t=>{if(typeof t!="string")throw new Error(`alphabet.decode: not string element=${t}`);let n=r.indexOf(t);if(n===-1)throw new Error(`Unknown letter: "${t}". Allowed: ${r}`);return n})}}}function Vt(r=""){if(typeof r!="string")throw new Error("join separator should be string");return{encode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("join.encode input should be array of strings");for(let t of e)if(typeof t!="string")throw new Error(`join.encode: non-string input=${t}`);return e.join(r)},decode:e=>{if(typeof e!="string")throw new Error("join.decode input should be string");return e.split(r)}}}function vo(r,e="="){if(Hr(r),typeof e!="string")throw new Error("padding chr should be string");return{encode(t){if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("padding.encode input should be array of strings");for(let n of t)if(typeof n!="string")throw new Error(`padding.encode: non-string input=${n}`);for(;t.length*r%8;)t.push(e);return t},decode(t){if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("padding.encode input should be array of strings");for(let o of t)if(typeof o!="string")throw new Error(`padding.decode: non-string input=${o}`);let n=t.length;if(n*r%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&t[n-1]===e;n--)if(!((n-1)*r%8))throw new Error("Invalid padding: string has too much padding");return t.slice(0,n)}}}function Tf(r){if(typeof r!="function")throw new Error("normalize fn should be function");return{encode:e=>e,decode:e=>r(e)}}function mf(r,e,t){if(e<2)throw new Error(`convertRadix: wrong from=${e}, base cannot be less than 2`);if(t<2)throw new Error(`convertRadix: wrong to=${t}, 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=[],i=Array.from(r);for(i.forEach(a=>{if(Hr(a),a<0||a>=e)throw new Error(`Wrong integer: ${a}`)});;){let a=0,u=!0;for(let d=n;d<i.length;d++){let h=i[d],y=e*a+h;if(!Number.isSafeInteger(y)||e*a/e!==a||y-h!==e*a)throw new Error("convertRadix: carry overflow");if(a=y%t,i[d]=Math.floor(y/t),!Number.isSafeInteger(i[d])||i[d]*t+a!==y)throw new Error("convertRadix: carry overflow");if(u)i[d]?u=!1:n=d;else continue}if(o.push(a),u)break}for(let a=0;a<r.length-1&&r[a]===0;a++)o.push(0);return o.reverse()}var vf=(r,e)=>e?vf(e,r%e):r,Os=(r,e)=>r+(e-vf(r,e));function ya(r,e,t,n){if(!Array.isArray(r))throw new Error("convertRadix2: data should be array");if(e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(t<=0||t>32)throw new Error(`convertRadix2: wrong to=${t}`);if(Os(e,t)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${t} carryBits=${Os(e,t)}`);let o=0,i=0,a=2**t-1,u=[];for(let d of r){if(Hr(d),d>=2**e)throw new Error(`convertRadix2: invalid data word=${d} from=${e}`);if(o=o<<e|d,i+e>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${e}`);for(i+=e;i>=t;i-=t)u.push((o>>i-t&a)>>>0);o&=2**i-1}if(o=o<<t-i&a,!n&&i>=e)throw new Error("Excess padding");if(!n&&o)throw new Error(`Non-zero padding: ${o}`);return n&&i>0&&u.push(o>>>0),u}function Ef(r){return Hr(r),{encode:e=>{if(!(e instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return mf(Array.from(e),2**8,r)},decode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(mf(e,r,2**8))}}}function gr(r,e=!1){if(Hr(r),r<=0||r>32)throw new Error("radix2: bits should be in (0..32]");if(Os(8,r)>32||Os(r,8)>32)throw new Error("radix2: carry overflow");return{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return ya(Array.from(t),8,r,!e)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(ya(t,r,8,e))}}}function bf(r){if(typeof r!="function")throw new Error("unsafeWrapper fn should be function");return function(...e){try{return r.apply(null,e)}catch(t){}}}function Sf(r,e){if(Hr(r),typeof e!="function")throw new Error("checksum fn should be function");return{encode(t){if(!(t instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");let n=e(t).slice(0,r),o=new Uint8Array(t.length+r);return o.set(t),o.set(n,t.length),o},decode(t){if(!(t instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");let n=t.slice(0,-r),o=e(n).slice(0,r),i=t.slice(-r);for(let a=0;a<r;a++)if(o[a]!==i[a])throw new Error("Invalid checksum");return n}}}X.utils={alphabet:Kt,chain:Dt,checksum:Sf,radix:Ef,radix2:gr,join:Vt,padding:vo};X.base16=Dt(gr(4),Kt("0123456789ABCDEF"),Vt(""));X.base32=Dt(gr(5),Kt("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),vo(5),Vt(""));X.base32hex=Dt(gr(5),Kt("0123456789ABCDEFGHIJKLMNOPQRSTUV"),vo(5),Vt(""));X.base32crockford=Dt(gr(5),Kt("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),Vt(""),Tf(r=>r.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));X.base64=Dt(gr(6),Kt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),vo(6),Vt(""));X.base64url=Dt(gr(6),Kt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),vo(6),Vt(""));var ma=r=>Dt(Ef(58),Kt(r),Vt(""));X.base58=ma("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");X.base58flickr=ma("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");X.base58xrp=ma("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");var Af=[0,2,3,5,6,7,9,10,11];X.base58xmr={encode(r){let e="";for(let t=0;t<r.length;t+=8){let n=r.subarray(t,t+8);e+=X.base58.encode(n).padStart(Af[n.length],"1")}return e},decode(r){let e=[];for(let t=0;t<r.length;t+=11){let n=r.slice(t,t+11),o=Af.indexOf(n.length),i=X.base58.decode(n);for(let a=0;a<i.length-o;a++)if(i[a]!==0)throw new Error("base58xmr: wrong padding");e=e.concat(Array.from(i.slice(i.length-o)))}return Uint8Array.from(e)}};var k0=r=>Dt(Sf(4,e=>r(r(e))),X.base58);X.base58check=k0;var xa=Dt(Kt("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),Vt("")),wf=[996825010,642813549,513874426,1027748829,705979059];function _o(r){let e=r>>25,t=(r&33554431)<<5;for(let n=0;n<wf.length;n++)(e>>n&1)===1&&(t^=wf[n]);return t}function _f(r,e,t=1){let n=r.length,o=1;for(let i=0;i<n;i++){let a=r.charCodeAt(i);if(a<33||a>126)throw new Error(`Invalid prefix (${r})`);o=_o(o)^a>>5}o=_o(o);for(let i=0;i<n;i++)o=_o(o)^r.charCodeAt(i)&31;for(let i of e)o=_o(o)^i;for(let i=0;i<6;i++)o=_o(o);return o^=t,xa.encode(ya([o%2**30],30,5,!1))}function Uf(r){let e=r==="bech32"?1:734539939,t=gr(5),n=t.decode,o=t.encode,i=bf(n);function a(y,g,T=90){if(typeof y!="string")throw new Error(`bech32.encode prefix should be string, not ${typeof y}`);if(!Array.isArray(g)||g.length&&typeof g[0]!="number")throw new Error(`bech32.encode words should be array of numbers, not ${typeof g}`);let v=y.length+7+g.length;if(T!==!1&&v>T)throw new TypeError(`Length ${v} exceeds limit ${T}`);return y=y.toLowerCase(),`${y}1${xa.encode(g)}${_f(y,g,e)}`}function u(y,g=90){if(typeof y!="string")throw new Error(`bech32.decode input should be string, not ${typeof y}`);if(y.length<8||g!==!1&&y.length>g)throw new TypeError(`Wrong string length: ${y.length} (${y}). Expected (8..${g})`);let T=y.toLowerCase();if(y!==T&&y!==y.toUpperCase())throw new Error("String must be lowercase or uppercase");y=T;let v=y.lastIndexOf("1");if(v===0||v===-1)throw new Error('Letter "1" must be present between prefix and data only');let I=y.slice(0,v),A=y.slice(v+1);if(A.length<6)throw new Error("Data must be at least 6 characters long");let E=xa.decode(A).slice(0,-6),k=_f(I,E,e);if(!A.endsWith(k))throw new Error(`Invalid checksum in ${y}: expected "${k}"`);return{prefix:I,words:E}}let d=bf(u);function h(y){let{prefix:g,words:T}=u(y,!1);return{prefix:g,words:T,bytes:n(T)}}return{encode:a,decode:u,decodeToBytes:h,decodeUnsafe:d,fromWords:n,fromWordsUnsafe:i,toWords:o}}X.bech32=Uf("bech32");X.bech32m=Uf("bech32m");X.utf8={encode:r=>new TextDecoder().decode(r),decode:r=>new TextEncoder().encode(r)};X.hex=Dt(gr(4),Kt("0123456789abcdef"),Vt(""),Tf(r=>{if(typeof r!="string"||r.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof r} with length ${r.length}`);return r.toLowerCase()}));var To={utf8:X.utf8,hex:X.hex,base16:X.base16,base32:X.base32,base64:X.base64,base64url:X.base64url,base58:X.base58,base58xmr:X.base58xmr},Bf=`Invalid encoding type. Available types: ${Object.keys(To).join(", ")}`,O0=(r,e)=>{if(typeof r!="string"||!To.hasOwnProperty(r))throw new TypeError(Bf);if(!(e instanceof Uint8Array))throw new TypeError("bytesToString() expects Uint8Array");return To[r].encode(e)};X.bytesToString=O0;X.str=X.bytesToString;var z0=(r,e)=>{if(!To.hasOwnProperty(r))throw new TypeError(Bf);if(typeof e!="string")throw new TypeError("stringToBytes() expects string");return To[r].decode(e)};X.stringToBytes=z0;X.bytes=X.stringToBytes});var qf=ce(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.mnemonicToSeedSync=yt.mnemonicToSeed=yt.validateMnemonic=yt.entropyToMnemonic=yt.mnemonicToEntropy=yt.generateMnemonic=void 0;var If=bo(),Rf=df(),P0=pf(),kf=xf(),H0=fn(),zs=Cf(),N0=r=>r[0]==="\u3042\u3044\u3053\u304F\u3057\u3093";function Of(r){if(typeof r!="string")throw new TypeError(`Invalid mnemonic type: ${typeof r}`);return r.normalize("NFKD")}function ba(r){let e=Of(r),t=e.split(" ");if(![12,15,18,21,24].includes(t.length))throw new Error("Invalid mnemonic");return{nfkd:e,words:t}}function zf(r){If.default.bytes(r,16,20,24,28,32)}function D0(r,e=128){if(If.default.number(e),e%32!==0||e>256)throw new TypeError("Invalid entropy");return Nf((0,H0.randomBytes)(e/8),r)}yt.generateMnemonic=D0;var q0=r=>{let e=8-r.length/4;return new Uint8Array([(0,P0.sha256)(r)[0]>>e<<e])};function Pf(r){if(!Array.isArray(r)||r.length!==2**11||typeof r[0]!="string")throw new Error("Worlist: expected array of 2048 strings");return r.forEach(e=>{if(typeof e!="string")throw new Error(`Wordlist: non-string element: ${e}`)}),zs.utils.chain(zs.utils.checksum(1,q0),zs.utils.radix2(11,!0),zs.utils.alphabet(r))}function Hf(r,e){let{words:t}=ba(r),n=Pf(e).decode(t);return zf(n),n}yt.mnemonicToEntropy=Hf;function Nf(r,e){return zf(r),Pf(e).encode(r).join(N0(e)?"\u3000":" ")}yt.entropyToMnemonic=Nf;function M0(r,e){try{Hf(r,e)}catch(t){return!1}return!0}yt.validateMnemonic=M0;var Df=r=>Of(`mnemonic${r}`);function G0(r,e=""){return(0,Rf.pbkdf2Async)(kf.sha512,ba(r).nfkd,Df(e),{c:2048,dkLen:64})}yt.mnemonicToSeed=G0;function L0(r,e=""){return(0,Rf.pbkdf2)(kf.sha512,ba(r).nfkd,Df(e),{c:2048,dkLen:64})}yt.mnemonicToSeedSync=L0});var sg={};qa(sg,{APTOS_PATH_REGEX:()=>Gf,Account:()=>Qt,AccountAddress:()=>M,AccountAuthenticatorVariant:()=>Ri,AddressInvalidReason:()=>Au,Aptos:()=>St,AptosApiError:()=>qt,AptosConfig:()=>So,AuthenticationKey:()=>$n,Bool:()=>Ke,DeriveScheme:()=>au,Deserializer:()=>tn,Ed25519PrivateKey:()=>on,Ed25519PublicKey:()=>He,Ed25519Signature:()=>We,EntryFunctionBytes:()=>rn,FixedBytes:()=>Er,Hex:()=>te,HexInvalidReason:()=>mu,KeyType:()=>Aa,MimeType:()=>Jo,MoveAbility:()=>su,MoveFunctionVisibility:()=>ou,MoveObject:()=>uo,MoveOption:()=>At,MoveString:()=>lt,MoveVector:()=>Ne,MultiEd25519PublicKey:()=>gt,MultiEd25519Signature:()=>dr,Network:()=>ts,NetworkToChainId:()=>rs,NetworkToFaucetAPI:()=>zi,NetworkToIndexerAPI:()=>es,NetworkToNodeAPI:()=>Oi,ParsingError:()=>ft,PrivateKey:()=>nn,PublicKey:()=>cr,RoleType:()=>iu,ScriptTransactionArgumentVariants:()=>zn,Secp256k1PrivateKey:()=>Ln,Secp256k1PublicKey:()=>ut,Secp256k1Signature:()=>It,Serializable:()=>le,Serializer:()=>Pt,Signature:()=>ur,SigningScheme:()=>oo,StructTag:()=>Tt,TransactionAuthenticatorVariant:()=>Ii,TransactionPayloadVariants:()=>Bi,TransactionResponseType:()=>ki,TransactionVariants:()=>Ci,TypeTag:()=>Xe,TypeTagAddress:()=>Dr,TypeTagBool:()=>ln,TypeTagParser:()=>Wn,TypeTagParserError:()=>Gs,TypeTagSigner:()=>Qn,TypeTagStruct:()=>Wt,TypeTagU128:()=>yn,TypeTagU16:()=>pn,TypeTagU256:()=>xn,TypeTagU32:()=>hn,TypeTagU64:()=>gn,TypeTagU8:()=>dn,TypeTagVariants:()=>Ui,TypeTagVector:()=>mn,U128:()=>Lt,U16:()=>Mt,U256:()=>Ft,U32:()=>Gt,U64:()=>at,U8:()=>Bt,aptosRequest:()=>so,derivePrivateKeyFromMnemonic:()=>wa,ensureBoolean:()=>fs,get:()=>gu,getAptosFullNode:()=>ht,isValidPath:()=>$f,objectStructTag:()=>Y0,optionStructTag:()=>W0,outOfRangeErrorMessage:()=>bu,paginateWithCursor:()=>Yr,post:()=>os,postAptosFaucet:()=>Ni,postAptosFullNode:()=>Xr,postAptosIndexer:()=>Hi,stringStructTag:()=>Cl,validateNumberInRange:()=>ar});var ru=oi(tu(),1);async function nu(r){var e;let{params:t,method:n,url:o,headers:i,body:a,overrides:u}=r,d={headers:i,method:n,url:o,params:t,data:a,withCredentials:(e=u==null?void 0:u.WITH_CREDENTIALS)!=null?e:!0};try{let h=await(0,ru.default)(d);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 qt=class extends Error{constructor(t,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=t}};var Jo=(n=>(n.JSON="application/json",n.BCS="application/x-bcs",n.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",n))(Jo||{}),Ui=(g=>(g[g.Bool=0]="Bool",g[g.U8=1]="U8",g[g.U64=2]="U64",g[g.U128=3]="U128",g[g.Address=4]="Address",g[g.Signer=5]="Signer",g[g.Vector=6]="Vector",g[g.Struct=7]="Struct",g[g.U16=8]="U16",g[g.U32=9]="U32",g[g.U256=10]="U256",g))(Ui||{}),zn=(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))(zn||{}),Bi=(n=>(n[n.Script=0]="Script",n[n.EntryFunction=2]="EntryFunction",n[n.Multisig=3]="Multisig",n))(Bi||{}),Ci=(t=>(t[t.MultiAgentTransaction=0]="MultiAgentTransaction",t[t.FeePayerTransaction=1]="FeePayerTransaction",t))(Ci||{}),Ii=(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.MultiAgent=2]="MultiAgent",i[i.FeePayer=3]="FeePayer",i[i.Secp256k1Ecdsa=4]="Secp256k1Ecdsa",i))(Ii||{}),Ri=(n=>(n[n.Ed25519=0]="Ed25519",n[n.MultiEd25519=1]="MultiEd25519",n[n.Secp256k1=2]="Secp256k1",n))(Ri||{}),ki=(i=>(i.Pending="pending_transaction",i.User="user_transaction",i.Genesis="genesis_transaction",i.BlockMetadata="block_metadata_transaction",i.StateCheckpoint="state_checkpoint_transaction",i))(ki||{}),ou=(n=>(n.PRIVATE="private",n.PUBLIC="public",n.FRIEND="friend",n))(ou||{}),su=(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(su||{}),iu=(t=>(t.VALIDATOR="validator",t.FULL_NODE="full_node",t))(iu||{}),oo=(n=>(n[n.Ed25519=0]="Ed25519",n[n.MultiEd25519=1]="MultiEd25519",n[n.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",n))(oo||{}),au=(i=>(i[i.DeriveAuid=251]="DeriveAuid",i[i.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",i[i.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",i[i.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",i[i.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",i))(au||{});var cu="0.0.0";var hp={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 gp(r,e,t,n,o,i){let a={...i==null?void 0:i.HEADERS,"x-aptos-client":`aptos-ts-sdk/${cu}`,"content-type":n!=null?n:"application/json"};return i!=null&&i.TOKEN&&(a.Authorization=`Bearer ${i==null?void 0:i.TOKEN}`),nu({url:r,method:e,body:t,params:o,headers:a,overrides:i})}async function so(r,e){var v;let{url:t,path:n,method:o,body:i,contentType:a,params:u,overrides:d}=r,h=`${t}/${n!=null?n:""}`,y=await gp(h,o,i,a,u,d),g={status:y.status,statusText:y.statusText,data:y.data,headers:y.headers,config:y.config,url:h};if(e.isIndexerRequest(t)){if(g.data.errors)throw new qt(r,g,(v=y.data.errors[0].message)!=null?v:`Unhandled Error ${y.status} : ${y.statusText}`);g.data=g.data.data}if(g.status>=200&&g.status<300)return g;let T=hp[g.status];throw new qt(r,g,T!=null?T:`Unhandled Error ${y.status} : ${y.statusText}`)}var es={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"},Oi={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"},zi={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"},ts=(i=>(i.MAINNET="mainnet",i.TESTNET="testnet",i.DEVNET="devnet",i.LOCAL="local",i.CUSTOM="custom",i))(ts||{}),rs={mainnet:1,testnet:2};var uu="devnet",fu=2e5,lu=20,ns=20,du="0x1::aptos_coin::AptosCoin",pu="APTOS::RawTransaction",Pi="APTOS::RawTransactionWithData";async function gu(r){let{aptosConfig:e,overrides:t,params:n,contentType:o,acceptType:i,path:a,originMethod:u,type:d}=r,h=e.getRequestUrl(d);return so({url:h,method:"GET",originMethod:u,path:a,contentType:o==null?void 0:o.valueOf(),acceptType:i==null?void 0:i.valueOf(),params:n,overrides:{...e,...t}},e)}async function ht(r){return gu({...r,type:0})}async function Yr(r){let e=[],t,n=r.params;for(;;){n.start=t;let o=await ht({aptosConfig:r.aptosConfig,originMethod:r.originMethod,path:r.path,params:n,overrides:r.overrides});if(t=o.headers["x-aptos-cursor"],delete o.headers,e.push(...o.data),t==null)break}return e}async function os(r){let{type:e,originMethod:t,path:n,body:o,acceptType:i,contentType:a,params:u,aptosConfig:d,overrides:h}=r,y=d.getRequestUrl(e);return so({url:y,method:"POST",originMethod:t,path:n,body:o,contentType:a==null?void 0:a.valueOf(),acceptType:i==null?void 0:i.valueOf(),params:u,overrides:{...d,...h}},d)}async function Xr(r){return os({...r,type:0})}async function Hi(r){return os({...r,type:1})}async function Ni(r){return os({...r,type:2})}var yp={node:void 0,web:typeof self=="object"&&"crypto"in self?self.crypto:void 0};var yu=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4)),ss=r=>new DataView(r.buffer,r.byteOffset,r.byteLength);var xp=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!xp)throw new Error("Non little-endian hardware is not supported");var mp=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function io(r){if(!(r instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(let t=0;t<r.length;t++)e+=mp[r[t]];return e}function is(r){if(typeof r!="string")throw new TypeError("hexToBytes: expected string, got "+typeof r);if(r.length%2)throw new Error("hexToBytes: received invalid unpadded hex");let e=new Uint8Array(r.length/2);for(let t=0;t<e.length;t++){let n=t*2,o=r.slice(n,n+2),i=Number.parseInt(o,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");e[t]=i}return e}function bp(r){if(typeof r!="string")throw new TypeError(`utf8ToBytes expected string, got ${typeof r}`);return new TextEncoder().encode(r)}function Tr(r){if(typeof r=="string"&&(r=bp(r)),!(r instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof r})`);return r}var _r=class{clone(){return this._cloneInto()}};function Pn(r){let e=n=>r().update(Tr(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}function xu(r){let e=(n,o)=>r(o).update(Tr(n)).digest(),t=r({});return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=n=>r(n),e}var as=2**8-1,cs=2**16-1,ir=2**32-1,Zr=BigInt(2)**BigInt(64)-BigInt(1),ao=BigInt(2)**BigInt(128)-BigInt(1),us=BigInt(2)**BigInt(256)-BigInt(1);var ft=class extends Error{constructor(t,n){super(t);this.invalidReason=n}};var mu=(n=>(n.TOO_SHORT="too_short",n.INVALID_LENGTH="invalid_length",n.INVALID_HEX_CHARS="invalid_hex_chars",n))(mu||{}),te=class{constructor(e){this.data=e}toUint8Array(){return this.data}toStringWithoutPrefix(){return io(this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromString(e){let t=e;if(t.startsWith("0x")&&(t=t.slice(2)),t.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(t.length%2!==0)throw new ft("Hex string must be an even number of hex characters.","invalid_length");try{return new te(is(t))}catch(n){let o=n;throw new ft(`Hex string contains invalid hex characters: ${o.message}`,"invalid_hex_chars")}}static fromHexInput(e){return e instanceof Uint8Array?new te(e):te.fromString(e)}static isValid(e){try{return te.fromString(e),{valid:!0}}catch(t){let n=t;return{valid:!1,invalidReason:n.invalidReason,invalidReasonMessage:n.message}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((t,n)=>t===e.data[n])}};var le=class{bcsToBytes(){let e=new Pt;return this.serialize(e),e.toUint8Array()}bcsToHex(){let e=this.bcsToBytes();return te.fromHexInput(e)}},Pt=class{constructor(e=64){if(e<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(e),this.offset=0}ensureBufferWillHandleSize(e){for(;this.buffer.byteLength<this.offset+e;){let t=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t}}appendToBuffer(e){this.ensureBufferWillHandleSize(e.length),new Uint8Array(this.buffer,this.offset).set(e),this.offset+=e.length}serializeWithFunction(e,t,n){this.ensureBufferWillHandleSize(t);let o=new DataView(this.buffer,this.offset);e.apply(o,[0,n,!0]),this.offset+=t}serializeStr(e){let t=new TextEncoder;this.serializeBytes(t.encode(e))}serializeBytes(e){this.serializeU32AsUleb128(e.length),this.appendToBuffer(e)}serializeFixedBytes(e){this.appendToBuffer(e)}serializeBool(e){fs(e);let t=e?1:0;this.appendToBuffer(new Uint8Array([t]))}serializeU8(e){this.appendToBuffer(new Uint8Array([e]))}serializeU16(e){this.serializeWithFunction(DataView.prototype.setUint16,2,e)}serializeU32(e){this.serializeWithFunction(DataView.prototype.setUint32,4,e)}serializeU64(e){let t=BigInt(e)&BigInt(ir),n=BigInt(e)>>BigInt(32);this.serializeU32(Number(t)),this.serializeU32(Number(n))}serializeU128(e){let t=BigInt(e)&Zr,n=BigInt(e)>>BigInt(64);this.serializeU64(t),this.serializeU64(n)}serializeU256(e){let t=BigInt(e)&ao,n=BigInt(e)>>BigInt(128);this.serializeU128(t),this.serializeU128(n)}serializeU32AsUleb128(e){let t=e,n=[];for(;t>>>7!==0;)n.push(t&127|128),t>>>=7;n.push(t),this.appendToBuffer(new Uint8Array(n))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(e){e.serialize(this)}serializeVector(e){this.serializeU32AsUleb128(e.length),e.forEach(t=>{t.serialize(this)})}};Ar([Jr(0,as)],Pt.prototype,"serializeU8",1),Ar([Jr(0,cs)],Pt.prototype,"serializeU16",1),Ar([Jr(0,ir)],Pt.prototype,"serializeU32",1),Ar([Jr(BigInt(0),Zr)],Pt.prototype,"serializeU64",1),Ar([Jr(BigInt(0),ao)],Pt.prototype,"serializeU128",1),Ar([Jr(BigInt(0),us)],Pt.prototype,"serializeU256",1),Ar([Jr(0,ir)],Pt.prototype,"serializeU32AsUleb128",1);function fs(r){if(typeof r!="boolean")throw new Error(`${r} is not a boolean value`)}var bu=(r,e,t)=>`${r} is out of range: [${e}, ${t}]`;function ar(r,e,t){let n=BigInt(r);if(n>BigInt(t)||n<BigInt(e))throw new Error(bu(r,e,t))}function Jr(r,e){return(t,n,o)=>{let i=o.value;return o.value=function(u){return ar(u,r,e),i.apply(this,[u])},o}}var Au=(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))(Au||{}),et=class extends le{constructor(t){super();if(t.data.length!==et.LENGTH)throw new ft("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=t.data}isSpecial(){return this.data.slice(0,this.data.length-1).every(t=>t===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let t=io(this.data);return this.isSpecial()&&(t=t[t.length-1]),t}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return io(this.data)}toUint8Array(){return this.data}serialize(t){t.serializeFixedBytes(this.data)}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){t.serializeU32AsUleb128(3),t.serialize(this)}static deserialize(t){let n=t.deserializeFixedBytes(et.LENGTH);return new et({data:n})}static fromString(t){if(!t.startsWith("0x"))throw new ft("Hex string must start with a leading 0x.","leading_zero_x_required");let n=et.fromStringRelaxed(t);if(t.length!==et.LONG_STRING_LENGTH+2)if(n.isSpecial()){if(t.length!==3)throw new ft(`The given hex string ${t} 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(t){let n=t;if(t.startsWith("0x")&&(n=t.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=is(n.padStart(64,"0"))}catch(i){let a=i;throw new ft(`Hex characters are invalid: ${a.message}`,"invalid_hex_chars")}return new et({data:o})}static fromHexInput(t){return t instanceof Uint8Array?new et({data:t}):et.fromString(t)}static fromHexInputRelaxed(t){return t instanceof Uint8Array?new et({data:t}):et.fromStringRelaxed(t)}static isValid(t){try{return t.relaxed?et.fromStringRelaxed(t.input):et.fromString(t.input),{valid:!0}}catch(n){let o=n;return{valid:!1,invalidReason:o.invalidReason,invalidReasonMessage:o.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((n,o)=>n===t.data[o])}},M=et;M.LENGTH=32,M.LONG_STRING_LENGTH=64,M.ONE=et.fromString("0x1"),M.TWO=et.fromString("0x2"),M.THREE=et.fromString("0x3"),M.FOUR=et.fromString("0x4");function Di(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function Ap(r){if(typeof r!="boolean")throw new Error(`Expected boolean, not ${r}`)}function wu(r,...e){if(!(r instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(e.length>0&&!e.includes(r.length))throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${r.length}`)}function wp(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Di(r.outputLen),Di(r.blockLen)}function _p(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function Tp(r,e){wu(r);let t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}var vp={number:Di,bool:Ap,bytes:wu,hash:wp,exists:_p,output:Tp},it=vp;var ls=BigInt(4294967295),qi=BigInt(32);function _u(r,e=!1){return e?{h:Number(r&ls),l:Number(r>>qi&ls)}:{h:Number(r>>qi&ls)|0,l:Number(r&ls)|0}}function Ep(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o<r.length;o++){let{h:i,l:a}=_u(r[o],e);[t[o],n[o]]=[i,a]}return[t,n]}var Sp=(r,e)=>BigInt(r>>>0)<<qi|BigInt(e>>>0),Up=(r,e,t)=>r>>>t,Bp=(r,e,t)=>r<<32-t|e>>>t,Cp=(r,e,t)=>r>>>t|e<<32-t,Ip=(r,e,t)=>r<<32-t|e>>>t,Rp=(r,e,t)=>r<<64-t|e>>>t-32,kp=(r,e,t)=>r>>>t-32|e<<64-t,Op=(r,e)=>e,zp=(r,e)=>r,Pp=(r,e,t)=>r<<t|e>>>32-t,Hp=(r,e,t)=>e<<t|r>>>32-t,Np=(r,e,t)=>e<<t-32|r>>>64-t,Dp=(r,e,t)=>r<<t-32|e>>>64-t;function qp(r,e,t,n){let o=(e>>>0)+(n>>>0);return{h:r+t+(o/2**32|0)|0,l:o|0}}var Mp=(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),Gp=(r,e,t,n)=>e+t+n+(r/2**32|0)|0,Lp=(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),Fp=(r,e,t,n,o)=>e+t+n+o+(r/2**32|0)|0,$p=(r,e,t,n,o)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(o>>>0),jp=(r,e,t,n,o,i)=>e+t+n+o+i+(r/2**32|0)|0,Kp={fromBig:_u,split:Ep,toBig:Sp,shrSH:Up,shrSL:Bp,rotrSH:Cp,rotrSL:Ip,rotrBH:Rp,rotrBL:kp,rotr32H:Op,rotr32L:zp,rotlSH:Pp,rotlSL:Hp,rotlBH:Np,rotlBL:Dp,add:qp,add3L:Mp,add3H:Gp,add4L:Lp,add4H:Fp,add5H:jp,add5L:$p},ne=Kp;var[Eu,Su,Uu]=[[],[],[]],Vp=BigInt(0),co=BigInt(1),Qp=BigInt(2),Wp=BigInt(7),Yp=BigInt(256),Xp=BigInt(113);for(let r=0,e=co,t=1,n=0;r<24;r++){[t,n]=[n,(2*t+3*n)%5],Eu.push(2*(5*n+t)),Su.push((r+1)*(r+2)/2%64);let o=Vp;for(let i=0;i<7;i++)e=(e<<co^(e>>Wp)*Xp)%Yp,e&Qp&&(o^=co<<(co<<BigInt(i))-co);Uu.push(o)}var[Zp,Jp]=ne.split(Uu,!0),Tu=(r,e,t)=>t>32?ne.rotlBH(r,e,t):ne.rotlSH(r,e,t),vu=(r,e,t)=>t>32?ne.rotlBL(r,e,t):ne.rotlSL(r,e,t);function eh(r,e=24){let t=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let a=0;a<10;a++)t[a]=r[a]^r[a+10]^r[a+20]^r[a+30]^r[a+40];for(let a=0;a<10;a+=2){let u=(a+8)%10,d=(a+2)%10,h=t[d],y=t[d+1],g=Tu(h,y,1)^t[u],T=vu(h,y,1)^t[u+1];for(let v=0;v<50;v+=10)r[a+v]^=g,r[a+v+1]^=T}let o=r[2],i=r[3];for(let a=0;a<24;a++){let u=Su[a],d=Tu(o,i,u),h=vu(o,i,u),y=Eu[a];o=r[y],i=r[y+1],r[y]=d,r[y+1]=h}for(let a=0;a<50;a+=10){for(let u=0;u<10;u++)t[u]=r[a+u];for(let u=0;u<10;u++)r[a+u]^=~t[(u+2)%10]&t[(u+4)%10]}r[0]^=Zp[n],r[1]^=Jp[n]}t.fill(0)}var Hn=class extends _r{constructor(e,t,n,o=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=o,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,it.number(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=yu(this.state)}keccak(){eh(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){it.exists(this);let{blockLen:t,state:n}=this;e=Tr(e);let o=e.length;for(let i=0;i<o;){let a=Math.min(t-this.pos,o-i);for(let u=0;u<a;u++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:n,blockLen:o}=this;e[n]^=t,(t&128)!==0&&n===o-1&&this.keccak(),e[o-1]^=128,this.keccak()}writeInto(e){it.exists(this,!1),it.bytes(e),this.finish();let t=this.state,{blockLen:n}=this;for(let o=0,i=e.length;o<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-o);e.set(t.subarray(this.posOut,this.posOut+a),o),this.posOut+=a,o+=a}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return it.number(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(it.output(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:n,outputLen:o,rounds:i,enableXOF:a}=this;return e||(e=new Hn(t,n,o,a,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=o,e.enableXOF=a,e.destroyed=this.destroyed,e}},vr=(r,e,t)=>Pn(()=>new Hn(e,r,t)),Dy=vr(6,144,224/8),en=vr(6,136,256/8),qy=vr(6,104,384/8),My=vr(6,72,512/8),Gy=vr(1,144,224/8),Ly=vr(1,136,256/8),Fy=vr(1,104,384/8),$y=vr(1,72,512/8),Bu=(r,e,t)=>xu((n={})=>new Hn(e,r,n.dkLen===void 0?t:n.dkLen,!0)),jy=Bu(31,168,128/8),Ky=Bu(31,136,256/8);var fo=oi(Iu());var tn=class{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeBytes(){let e=this.deserializeUleb128AsU32();return new Uint8Array(this.read(e))}deserializeFixedBytes(e){return new Uint8Array(this.read(e))}deserializeBool(){let e=new Uint8Array(this.read(1))[0];if(e!==1&&e!==0)throw new Error("Invalid boolean value");return e===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 e=this.deserializeU32(),t=this.deserializeU32();return BigInt(BigInt(t)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),t=this.deserializeU64();return BigInt(t<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),t=this.deserializeU128();return BigInt(t<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),t=0;for(;e<ir;){let n=this.deserializeU8();if(e|=BigInt(n&127)<<BigInt(t),(n&128)===0)break;t+=7}if(e>ir)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let t=this.deserializeUleb128AsU32(),n=new Array;for(let o=0;o<t;o+=1)n.push(this.deserialize(e));return n}};var Er=class extends le{constructor(t){super();this.value=te.fromHexInput(t).toUint8Array()}serialize(t){t.serializeFixedBytes(this.value)}serializeForEntryFunction(t){t.serialize(this)}serializeForScriptFunction(t){t.serialize(this)}static deserialize(t,n){let o=t.deserializeFixedBytes(n);return new Er(o)}};var rn=class extends le{constructor(t){super();this.value=new Er(t)}serialize(t){t.serialize(this.value)}serializeForEntryFunction(t){t.serializeU32AsUleb128(this.value.value.length),t.serialize(this)}static deserialize(t,n){let o=Er.deserialize(t,n);return new rn(o.value)}};var Ke=class extends le{constructor(t){super();fs(t),this.value=t}serialize(t){t.serializeBool(this.value)}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){t.serializeU32AsUleb128(5),t.serialize(this)}static deserialize(t){return new Ke(t.deserializeBool())}},Bt=class extends le{constructor(t){super();ar(t,0,as),this.value=t}serialize(t){t.serializeU8(this.value)}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){t.serializeU32AsUleb128(0),t.serialize(this)}static deserialize(t){return new Bt(t.deserializeU8())}},Mt=class extends le{constructor(t){super();ar(t,0,cs),this.value=t}serialize(t){t.serializeU16(this.value)}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){t.serializeU32AsUleb128(6),t.serialize(this)}static deserialize(t){return new Mt(t.deserializeU16())}},Gt=class extends le{constructor(t){super();ar(t,0,ir),this.value=t}serialize(t){t.serializeU32(this.value)}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){t.serializeU32AsUleb128(7),t.serialize(this)}static deserialize(t){return new Gt(t.deserializeU32())}},at=class extends le{constructor(t){super();ar(t,BigInt(0),Zr),this.value=BigInt(t)}serialize(t){t.serializeU64(this.value)}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){t.serializeU32AsUleb128(1),t.serialize(this)}static deserialize(t){return new at(t.deserializeU64())}},Lt=class extends le{constructor(t){super();ar(t,BigInt(0),ao),this.value=BigInt(t)}serialize(t){t.serializeU128(this.value)}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){t.serializeU32AsUleb128(2),t.serialize(this)}static deserialize(t){return new Lt(t.deserializeU128())}},Ft=class extends le{constructor(t){super();ar(t,BigInt(0),us),this.value=BigInt(t)}serialize(t){t.serializeU256(this.value)}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){t.serializeU32AsUleb128(8),t.serialize(this)}static deserialize(t){return new Ft(t.deserializeU256())}};var Ne=class extends le{constructor(t){super();this.values=t}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){if(!(this.values[0]instanceof Bt))throw new Error("Script function arguments only accept u8 vectors");t.serializeU32AsUleb128(4),t.serialize(this)}static U8(t){let n;if(Array.isArray(t)&&typeof t[0]=="number")n=t;else if(typeof t=="string"){let o=te.fromHexInput(t);n=Array.from(o.toUint8Array())}else if(t instanceof Uint8Array)n=Array.from(t);else throw new Error("Invalid input type");return new Ne(n.map(o=>new Bt(o)))}static U16(t){return new Ne(t.map(n=>new Mt(n)))}static U32(t){return new Ne(t.map(n=>new Gt(n)))}static U64(t){return new Ne(t.map(n=>new at(n)))}static U128(t){return new Ne(t.map(n=>new Lt(n)))}static U256(t){return new Ne(t.map(n=>new Ft(n)))}static Bool(t){return new Ne(t.map(n=>new Ke(n)))}static MoveString(t){return new Ne(t.map(n=>new lt(n)))}serialize(t){t.serializeVector(this.values)}static deserialize(t,n){let o=t.deserializeUleb128AsU32(),i=new Array;for(let a=0;a<o;a+=1)i.push(n.deserialize(t));return new Ne(i)}},lt=class extends le{constructor(t){super();this.value=t}serialize(t){t.serializeStr(this.value)}serializeForEntryFunction(t){let n=this.bcsToBytes();t.serializeBytes(n)}serializeForScriptFunction(t){Ne.U8(this.bcsToBytes()).serializeForScriptFunction(t)}static deserialize(t){return new lt(t.deserializeStr())}},At=class extends le{constructor(t){super();typeof t!="undefined"&&t!==null?this.vec=new Ne([t]):this.vec=new Ne([]),[this.value]=this.vec.values}serializeForEntryFunction(t){let n=this.bcsToBytes();t.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(t){this.vec.serialize(t)}static U8(t){return new At(t!=null?new Bt(t):void 0)}static U16(t){return new At(t!=null?new Mt(t):void 0)}static U32(t){return new At(t!=null?new Gt(t):void 0)}static U64(t){return new At(t!=null?new at(t):void 0)}static U128(t){return new At(t!=null?new Lt(t):void 0)}static U256(t){return new At(t!=null?new Ft(t):void 0)}static Bool(t){return new At(t!=null?new Ke(t):void 0)}static MoveString(t){return new At(t!=null?new lt(t):void 0)}static deserialize(t,n){let o=Ne.deserialize(t,n);return new At(o.values[0])}},uo=class extends le{constructor(t){super();t instanceof M?this.value=t:this.value=M.fromHexInputRelaxed(t)}serialize(t){t.serialize(this.value)}serializeForEntryFunction(t){this.value.serializeForEntryFunction(t)}serializeForScriptFunction(t){this.value.serializeForScriptFunction(t)}static deserialize(t){let n=t.deserialize(M);return new uo(n)}};var cr=class extends le{},nn=class extends le{},ur=class extends le{};var lo=class extends cr{constructor(t){super();let n=te.fromHexInput(t);if(n.toUint8Array().length!==lo.LENGTH)throw new Error(`PublicKey length should be ${lo.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(t){let{message:n,signature:o}=t,i=te.fromHexInput(n).toUint8Array(),a=te.fromHexInput(o.toUint8Array()).toUint8Array();return fo.default.sign.detached.verify(i,a,this.key.toUint8Array())}serialize(t){t.serializeBytes(this.key.toUint8Array())}static deserialize(t){let n=t.deserializeBytes();return new lo(n)}},He=lo;He.LENGTH=32;var fr=class extends nn{constructor(t){super();let n=te.fromHexInput(t);if(n.toUint8Array().length!==fr.LENGTH)throw new Error(`PrivateKey length should be ${fr.LENGTH}`);this.signingKeyPair=fo.default.sign.keyPair.fromSeed(n.toUint8Array().slice(0,fr.LENGTH))}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,fr.LENGTH)}toString(){return te.fromHexInput(this.toUint8Array()).toString()}sign(t){let n=te.fromHexInput(t),o=fo.default.sign.detached(n.toUint8Array(),this.signingKeyPair.secretKey);return new We(o)}serialize(t){t.serializeBytes(this.toUint8Array())}static deserialize(t){let n=t.deserializeBytes();return new fr(n)}static generate(){let t=fo.default.sign.keyPair();return new fr(t.secretKey.slice(0,fr.LENGTH))}publicKey(){let t=this.signingKeyPair.publicKey;return new He(t)}},on=fr;on.LENGTH=32;var po=class extends ur{constructor(t){super();let n=te.fromHexInput(t);if(n.toUint8Array().length!==po.LENGTH)throw new Error(`Signature length should be ${po.LENGTH}`);this.data=n}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(t){t.serializeBytes(this.data.toUint8Array())}static deserialize(t){let n=t.deserializeBytes();return new po(n)}},We=po;We.LENGTH=64;var lr=class extends cr{constructor(t){super();let{publicKeys:n,threshold:o}=t;if(n.length>lr.MAX_KEYS||n.length<lr.MIN_KEYS)throw new Error(`Must have between ${lr.MIN_KEYS} and ${lr.MAX_KEYS} public keys, inclusive`);if(o<lr.MIN_THRESHOLD||o>n.length)throw new Error(`Threshold must be between ${lr.MIN_THRESHOLD} and ${n.length}, inclusive`);this.publicKeys=n,this.threshold=o}toUint8Array(){let t=new Uint8Array(this.publicKeys.length*He.LENGTH+1);return this.publicKeys.forEach((n,o)=>{t.set(n.toUint8Array(),o*He.LENGTH)}),t[this.publicKeys.length*He.LENGTH]=this.threshold,t}toString(){return te.fromHexInput(this.toUint8Array()).toString()}verifySignature(t){throw new Error("TODO - Method not implemented.")}serialize(t){t.serializeBytes(this.toUint8Array())}static deserialize(t){let n=t.deserializeBytes(),o=n[n.length-1],i=[];for(let a=0;a<n.length-1;a+=He.LENGTH){let u=a;i.push(new He(n.subarray(u,u+He.LENGTH)))}return new lr({publicKeys:i,threshold:o})}},gt=lr;gt.MAX_KEYS=32,gt.MIN_KEYS=2,gt.MIN_THRESHOLD=1;var $t=class extends ur{constructor(t){super();let{signatures:n,bitmap:o}=t;if(o.length!==$t.BITMAP_LEN)throw new Error(`"bitmap" length should be ${$t.BITMAP_LEN}`);if(n.length>$t.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${$t.MAX_SIGNATURES_SUPPORTED}`);this.signatures=n,this.bitmap=o}toUint8Array(){let t=new Uint8Array(this.signatures.length*We.LENGTH+$t.BITMAP_LEN);return this.signatures.forEach((n,o)=>{t.set(n.toUint8Array(),o*We.LENGTH)}),t.set(this.bitmap,this.signatures.length*We.LENGTH),t}toString(){return te.fromHexInput(this.toUint8Array()).toString()}static createBitmap(t){let{bits:n}=t,o=128,i=new Uint8Array([0,0,0,0]),a=new Set;return n.forEach(u=>{if(u>=$t.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${$t.MAX_SIGNATURES_SUPPORTED-1}.`);if(a.has(u))throw new Error("Duplicate bits detected.");a.add(u);let d=Math.floor(u/8),h=i[d];h|=o>>u%8,i[d]=h}),i}serialize(t){t.serializeBytes(this.toUint8Array())}static deserialize(t){let n=t.deserializeBytes(),o=n.subarray(n.length-4),i=[];for(let a=0;a<n.length-o.length;a+=We.LENGTH){let u=a;i.push(new We(n.subarray(u,u+We.LENGTH)))}return new $t({signatures:i,bitmap:o})}},dr=$t;dr.MAX_SIGNATURES_SUPPORTED=32,dr.BITMAP_LEN=4;function Ru(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function Mi(r,...e){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(r.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${r.length}`)}function ku(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Ru(r.outputLen),Ru(r.blockLen)}function Nn(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function Ou(r,e){Mi(r);let t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}var ps=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var zu=r=>r instanceof Uint8Array;var hs=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),Ht=(r,e)=>r<<32-e|r>>>e,th=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!th)throw new Error("Non little-endian hardware is not supported");function rh(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function ho(r){if(typeof r=="string"&&(r=rh(r)),!zu(r))throw new Error(`expected Uint8Array, got ${typeof r}`);return r}function Pu(...r){let e=new Uint8Array(r.reduce((n,o)=>n+o.length,0)),t=0;return r.forEach(n=>{if(!zu(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}var Dn=class{clone(){return this._cloneInto()}},Kx={}.toString;function Hu(r){let e=n=>r().update(ho(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}function Nu(r=32){if(ps&&typeof ps.getRandomValues=="function")return ps.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}function nh(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let o=BigInt(32),i=BigInt(4294967295),a=Number(t>>o&i),u=Number(t&i),d=n?4:0,h=n?0:4;r.setUint32(e+d,a,n),r.setUint32(e+h,u,n)}var gs=class extends Dn{constructor(e,t,n,o){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=hs(this.buffer)}update(e){Nn(this);let{view:t,buffer:n,blockLen:o}=this;e=ho(e);let i=e.length;for(let a=0;a<i;){let u=Math.min(o-this.pos,i-a);if(u===o){let d=hs(e);for(;o<=i-a;a+=o)this.process(d,a);continue}n.set(e.subarray(a,a+u),this.pos),this.pos+=u,a+=u,this.pos===o&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Nn(this),Ou(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:o,isLE:i}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(n,0),a=0);for(let g=a;g<o;g++)t[g]=0;nh(n,o-8,BigInt(this.length*8),i),this.process(n,0);let u=hs(e),d=this.outputLen;if(d%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let h=d/4,y=this.get();if(h>y.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g<h;g++)u.setUint32(4*g,y[g],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:o,finished:i,destroyed:a,pos:u}=this;return e.length=o,e.pos=u,e.finished=i,e.destroyed=a,o%t&&e.buffer.set(n),e}};var oh=(r,e,t)=>r&e^~r&t,sh=(r,e,t)=>r&e^r&t^e&t,ih=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]),Sr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ur=new Uint32Array(64),Gi=class extends gs{constructor(){super(64,32,8,!1),this.A=Sr[0]|0,this.B=Sr[1]|0,this.C=Sr[2]|0,this.D=Sr[3]|0,this.E=Sr[4]|0,this.F=Sr[5]|0,this.G=Sr[6]|0,this.H=Sr[7]|0}get(){let{A:e,B:t,C:n,D:o,E:i,F:a,G:u,H:d}=this;return[e,t,n,o,i,a,u,d]}set(e,t,n,o,i,a,u,d){this.A=e|0,this.B=t|0,this.C=n|0,this.D=o|0,this.E=i|0,this.F=a|0,this.G=u|0,this.H=d|0}process(e,t){for(let g=0;g<16;g++,t+=4)Ur[g]=e.getUint32(t,!1);for(let g=16;g<64;g++){let T=Ur[g-15],v=Ur[g-2],I=Ht(T,7)^Ht(T,18)^T>>>3,A=Ht(v,17)^Ht(v,19)^v>>>10;Ur[g]=A+Ur[g-7]+I+Ur[g-16]|0}let{A:n,B:o,C:i,D:a,E:u,F:d,G:h,H:y}=this;for(let g=0;g<64;g++){let T=Ht(u,6)^Ht(u,11)^Ht(u,25),v=y+T+oh(u,d,h)+ih[g]+Ur[g]|0,A=(Ht(n,2)^Ht(n,13)^Ht(n,22))+sh(n,o,i)|0;y=h,h=d,d=u,u=a+v|0,a=i,i=o,o=n,n=v+A|0}n=n+this.A|0,o=o+this.B|0,i=i+this.C|0,a=a+this.D|0,u=u+this.E|0,d=d+this.F|0,h=h+this.G|0,y=y+this.H|0,this.set(n,o,i,a,u,d,h,y)}roundClean(){Ur.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Du=Hu(()=>new Gi);var ji={};qa(ji,{bitGet:()=>ph,bitLen:()=>dh,bitMask:()=>go,bitSet:()=>hh,bytesToHex:()=>sn,bytesToNumberBE:()=>pr,bytesToNumberLE:()=>ms,concatBytes:()=>qn,createHmacDrbg:()=>$i,ensureBytes:()=>wt,equalBytes:()=>fh,hexToBytes:()=>an,hexToNumber:()=>Fi,numberToBytesBE:()=>Br,numberToBytesLE:()=>bs,numberToHexUnpadded:()=>Gu,numberToVarBytesBE:()=>uh,utf8ToBytes:()=>lh,validateObject:()=>Cr});var Mu=BigInt(0),ys=BigInt(1),ah=BigInt(2),xs=r=>r instanceof Uint8Array,ch=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function sn(r){if(!xs(r))throw new Error("Uint8Array expected");let e="";for(let t=0;t<r.length;t++)e+=ch[r[t]];return e}function Gu(r){let e=r.toString(16);return e.length&1?`0${e}`:e}function Fi(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}function an(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let e=r.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let t=new Uint8Array(e/2);for(let n=0;n<t.length;n++){let o=n*2,i=r.slice(o,o+2),a=Number.parseInt(i,16);if(Number.isNaN(a)||a<0)throw new Error("Invalid byte sequence");t[n]=a}return t}function pr(r){return Fi(sn(r))}function ms(r){if(!xs(r))throw new Error("Uint8Array expected");return Fi(sn(Uint8Array.from(r).reverse()))}function Br(r,e){return an(r.toString(16).padStart(e*2,"0"))}function bs(r,e){return Br(r,e).reverse()}function uh(r){return an(Gu(r))}function wt(r,e,t){let n;if(typeof e=="string")try{n=an(e)}catch(i){throw new Error(`${r} must be valid hex string, got "${e}". Cause: ${i}`)}else if(xs(e))n=Uint8Array.from(e);else throw new Error(`${r} must be hex string or Uint8Array`);let o=n.length;if(typeof t=="number"&&o!==t)throw new Error(`${r} expected ${t} bytes, got ${o}`);return n}function qn(...r){let e=new Uint8Array(r.reduce((n,o)=>n+o.length,0)),t=0;return r.forEach(n=>{if(!xs(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}function fh(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function lh(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function dh(r){let e;for(e=0;r>Mu;r>>=ys,e+=1);return e}function ph(r,e){return r>>BigInt(e)&ys}var hh=(r,e,t)=>r|(t?ys:Mu)<<BigInt(e),go=r=>(ah<<BigInt(r-1))-ys,Li=r=>new Uint8Array(r),qu=r=>Uint8Array.from(r);function $i(r,e,t){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let n=Li(r),o=Li(r),i=0,a=()=>{n.fill(1),o.fill(0),i=0},u=(...g)=>t(o,n,...g),d=(g=Li())=>{o=u(qu([0]),g),n=u(),g.length!==0&&(o=u(qu([1]),g),n=u())},h=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let g=0,T=[];for(;g<e;){n=u();let v=n.slice();T.push(v),g+=n.length}return qn(...T)};return(g,T)=>{a(),d(g);let v;for(;!(v=T(h()));)d();return a(),v}}var gh={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,e)=>e.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function Cr(r,e,t={}){let n=(o,i,a)=>{let u=gh[i];if(typeof u!="function")throw new Error(`Invalid validator "${i}", expected function`);let d=r[o];if(!(a&&d===void 0)&&!u(d,r))throw new Error(`Invalid param ${String(o)}=${d} (${typeof d}), expected ${i}`)};for(let[o,i]of Object.entries(e))n(o,i,!1);for(let[o,i]of Object.entries(t))n(o,i,!0);return r}var Ye=BigInt(0),Ge=BigInt(1),cn=BigInt(2),yh=BigInt(3),Ki=BigInt(4),Lu=BigInt(5),Fu=BigInt(8),xh=BigInt(9),mh=BigInt(16);function ct(r,e){let t=r%e;return t>=Ye?t:e+t}function bh(r,e,t){if(t<=Ye||e<Ye)throw new Error("Expected power/modulo > 0");if(t===Ge)return Ye;let n=Ge;for(;e>Ye;)e&Ge&&(n=n*r%t),r=r*r%t,e>>=Ge;return n}function _t(r,e,t){let n=r;for(;e-- >Ye;)n*=n,n%=t;return n}function As(r,e){if(r===Ye||e<=Ye)throw new Error(`invert: expected positive integers, got n=${r} mod=${e}`);let t=ct(r,e),n=e,o=Ye,i=Ge,a=Ge,u=Ye;for(;t!==Ye;){let h=n/t,y=n%t,g=o-a*h,T=i-u*h;n=t,t=y,o=a,i=u,a=g,u=T}if(n!==Ge)throw new Error("invert: does not exist");return ct(o,e)}function Ah(r){let e=(r-Ge)/cn,t,n,o;for(t=r-Ge,n=0;t%cn===Ye;t/=cn,n++);for(o=cn;o<r&&bh(o,e,r)!==r-Ge;o++);if(n===1){let a=(r+Ge)/Ki;return function(d,h){let y=d.pow(h,a);if(!d.eql(d.sqr(y),h))throw new Error("Cannot find square root");return y}}let i=(t+Ge)/cn;return function(u,d){if(u.pow(d,e)===u.neg(u.ONE))throw new Error("Cannot find square root");let h=n,y=u.pow(u.mul(u.ONE,o),t),g=u.pow(d,i),T=u.pow(d,t);for(;!u.eql(T,u.ONE);){if(u.eql(T,u.ZERO))return u.ZERO;let v=1;for(let A=u.sqr(T);v<h&&!u.eql(A,u.ONE);v++)A=u.sqr(A);let I=u.pow(y,Ge<<BigInt(h-v-1));y=u.sqr(I),g=u.mul(g,I),T=u.mul(T,y),h=v}return g}}function wh(r){if(r%Ki===yh){let e=(r+Ge)/Ki;return function(n,o){let i=n.pow(o,e);if(!n.eql(n.sqr(i),o))throw new Error("Cannot find square root");return i}}if(r%Fu===Lu){let e=(r-Lu)/Fu;return function(n,o){let i=n.mul(o,cn),a=n.pow(i,e),u=n.mul(o,a),d=n.mul(n.mul(u,cn),a),h=n.mul(u,n.sub(d,n.ONE));if(!n.eql(n.sqr(h),o))throw new Error("Cannot find square root");return h}}return r%mh,Ah(r)}var _h=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Vi(r){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=_h.reduce((n,o)=>(n[o]="function",n),e);return Cr(r,t)}function Th(r,e,t){if(t<Ye)throw new Error("Expected power > 0");if(t===Ye)return r.ONE;if(t===Ge)return e;let n=r.ONE,o=e;for(;t>Ye;)t&Ge&&(n=r.mul(n,o)),o=r.sqr(o),t>>=Ge;return n}function vh(r,e){let t=new Array(e.length),n=e.reduce((i,a,u)=>r.is0(a)?i:(t[u]=i,r.mul(i,a)),r.ONE),o=r.inv(n);return e.reduceRight((i,a,u)=>r.is0(a)?i:(t[u]=r.mul(i,t[u]),r.mul(i,a)),o),t}function Qi(r,e){let t=e!==void 0?e:r.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function $u(r,e,t=!1,n={}){if(r<=Ye)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:o,nByteLength:i}=Qi(r,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");let a=wh(r),u=Object.freeze({ORDER:r,BITS:o,BYTES:i,MASK:go(o),ZERO:Ye,ONE:Ge,create:d=>ct(d,r),isValid:d=>{if(typeof d!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof d}`);return Ye<=d&&d<r},is0:d=>d===Ye,isOdd:d=>(d&Ge)===Ge,neg:d=>ct(-d,r),eql:(d,h)=>d===h,sqr:d=>ct(d*d,r),add:(d,h)=>ct(d+h,r),sub:(d,h)=>ct(d-h,r),mul:(d,h)=>ct(d*h,r),pow:(d,h)=>Th(u,d,h),div:(d,h)=>ct(d*As(h,r),r),sqrN:d=>d*d,addN:(d,h)=>d+h,subN:(d,h)=>d-h,mulN:(d,h)=>d*h,inv:d=>As(d,r),sqrt:n.sqrt||(d=>a(u,d)),invertBatch:d=>vh(u,d),cmov:(d,h,y)=>y?h:d,toBytes:d=>t?bs(d,i):Br(d,i),fromBytes:d=>{if(d.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${d.length}`);return t?ms(d):pr(d)}});return Object.freeze(u)}function ju(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let e=r.toString(2).length;return Math.ceil(e/8)}function Wi(r){let e=ju(r);return e+Math.ceil(e/2)}function Ku(r,e,t=!1){let n=r.length,o=ju(e),i=Wi(e);if(n<16||n<i||n>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);let a=t?pr(r):ms(r),u=ct(a,e-Ge)+Ge;return t?bs(u,o):Br(u,o)}var Sh=BigInt(0),Yi=BigInt(1);function Vu(r,e){let t=(o,i)=>{let a=i.negate();return o?a:i},n=o=>{let i=Math.ceil(e/o)+1,a=2**(o-1);return{windows:i,windowSize:a}};return{constTimeNegate:t,unsafeLadder(o,i){let a=r.ZERO,u=o;for(;i>Sh;)i&Yi&&(a=a.add(u)),u=u.double(),i>>=Yi;return a},precomputeWindow(o,i){let{windows:a,windowSize:u}=n(i),d=[],h=o,y=h;for(let g=0;g<a;g++){y=h,d.push(y);for(let T=1;T<u;T++)y=y.add(h),d.push(y);h=y.double()}return d},wNAF(o,i,a){let{windows:u,windowSize:d}=n(o),h=r.ZERO,y=r.BASE,g=BigInt(2**o-1),T=2**o,v=BigInt(o);for(let I=0;I<u;I++){let A=I*d,E=Number(a&g);a>>=v,E>d&&(E-=T,a+=Yi);let k=A,D=A+Math.abs(E)-1,C=I%2!==0,Z=E<0;E===0?y=y.add(t(C,i[k])):h=h.add(t(Z,i[D]))}return{p:h,f:y}},wNAFCached(o,i,a,u){let d=o._WINDOW_SIZE||1,h=i.get(o);return h||(h=this.precomputeWindow(o,d),d!==1&&i.set(o,u(h))),this.wNAF(d,h,a)}}}function Xi(r){return Vi(r.Fp),Cr(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Qi(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}function Uh(r){let e=Xi(r);Cr(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:t,Fp:n,a:o}=e;if(t){if(!n.eql(o,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}var{bytesToNumberBE:Bh,hexToBytes:Ch}=ji,un={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(r){let{Err:e}=un;if(r.length<2||r[0]!==2)throw new e("Invalid signature integer tag");let t=r[1],n=r.subarray(2,t+2);if(!t||n.length!==t)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:Bh(n),l:r.subarray(t+2)}},toSig(r){let{Err:e}=un,t=typeof r=="string"?Ch(r):r;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let n=t.length;if(n<2||t[0]!=48)throw new e("Invalid signature tag");if(t[1]!==n-2)throw new e("Invalid signature: incorrect length");let{d:o,l:i}=un._parseInt(t.subarray(2)),{d:a,l:u}=un._parseInt(i);if(u.length)throw new e("Invalid signature: left bytes after parsing");return{r:o,s:a}},hexFromSig(r){let e=h=>Number.parseInt(h[0],16)&8?"00"+h:h,t=h=>{let y=h.toString(16);return y.length&1?`0${y}`:y},n=e(t(r.s)),o=e(t(r.r)),i=n.length/2,a=o.length/2,u=t(i),d=t(a);return`30${t(a+i+4)}02${d}${o}02${u}${n}`}},hr=BigInt(0),Ct=BigInt(1),am=BigInt(2),Qu=BigInt(3),cm=BigInt(4);function Ih(r){let e=Uh(r),{Fp:t}=e,n=e.toBytes||((I,A,E)=>{let k=A.toAffine();return qn(Uint8Array.from([4]),t.toBytes(k.x),t.toBytes(k.y))}),o=e.fromBytes||(I=>{let A=I.subarray(1),E=t.fromBytes(A.subarray(0,t.BYTES)),k=t.fromBytes(A.subarray(t.BYTES,2*t.BYTES));return{x:E,y:k}});function i(I){let{a:A,b:E}=e,k=t.sqr(I),D=t.mul(k,I);return t.add(t.add(D,t.mul(I,A)),E)}if(!t.eql(t.sqr(e.Gy),i(e.Gx)))throw new Error("bad generator point: equation left != right");function a(I){return typeof I=="bigint"&&hr<I&&I<e.n}function u(I){if(!a(I))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function d(I){let{allowedPrivateKeyLengths:A,nByteLength:E,wrapPrivateKey:k,n:D}=e;if(A&&typeof I!="bigint"){if(I instanceof Uint8Array&&(I=sn(I)),typeof I!="string"||!A.includes(I.length))throw new Error("Invalid key");I=I.padStart(E*2,"0")}let C;try{C=typeof I=="bigint"?I:pr(wt("private key",I,E))}catch(Z){throw new Error(`private key must be ${E} bytes, hex or bigint, not ${typeof I}`)}return k&&(C=ct(C,D)),u(C),C}let h=new Map;function y(I){if(!(I instanceof g))throw new Error("ProjectivePoint expected")}class g{constructor(A,E,k){if(this.px=A,this.py=E,this.pz=k,A==null||!t.isValid(A))throw new Error("x required");if(E==null||!t.isValid(E))throw new Error("y required");if(k==null||!t.isValid(k))throw new Error("z required")}static fromAffine(A){let{x:E,y:k}=A||{};if(!A||!t.isValid(E)||!t.isValid(k))throw new Error("invalid affine point");if(A instanceof g)throw new Error("projective point not allowed");let D=C=>t.eql(C,t.ZERO);return D(E)&&D(k)?g.ZERO:new g(E,k,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(A){let E=t.invertBatch(A.map(k=>k.pz));return A.map((k,D)=>k.toAffine(E[D])).map(g.fromAffine)}static fromHex(A){let E=g.fromAffine(o(wt("pointHex",A)));return E.assertValidity(),E}static fromPrivateKey(A){return g.BASE.multiply(d(A))}_setWindowSize(A){this._WINDOW_SIZE=A,h.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:A,y:E}=this.toAffine();if(!t.isValid(A)||!t.isValid(E))throw new Error("bad point: x or y not FE");let k=t.sqr(E),D=i(A);if(!t.eql(k,D))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:A}=this.toAffine();if(t.isOdd)return!t.isOdd(A);throw new Error("Field doesn't support isOdd")}equals(A){y(A);let{px:E,py:k,pz:D}=this,{px:C,py:Z,pz:F}=A,Q=t.eql(t.mul(E,F),t.mul(C,D)),J=t.eql(t.mul(k,F),t.mul(Z,D));return Q&&J}negate(){return new g(this.px,t.neg(this.py),this.pz)}double(){let{a:A,b:E}=e,k=t.mul(E,Qu),{px:D,py:C,pz:Z}=this,F=t.ZERO,Q=t.ZERO,J=t.ZERO,W=t.mul(D,D),Te=t.mul(C,C),Ae=t.mul(Z,Z),ye=t.mul(D,C);return ye=t.add(ye,ye),J=t.mul(D,Z),J=t.add(J,J),F=t.mul(A,J),Q=t.mul(k,Ae),Q=t.add(F,Q),F=t.sub(Te,Q),Q=t.add(Te,Q),Q=t.mul(F,Q),F=t.mul(ye,F),J=t.mul(k,J),Ae=t.mul(A,Ae),ye=t.sub(W,Ae),ye=t.mul(A,ye),ye=t.add(ye,J),J=t.add(W,W),W=t.add(J,W),W=t.add(W,Ae),W=t.mul(W,ye),Q=t.add(Q,W),Ae=t.mul(C,Z),Ae=t.add(Ae,Ae),W=t.mul(Ae,ye),F=t.sub(F,W),J=t.mul(Ae,Te),J=t.add(J,J),J=t.add(J,J),new g(F,Q,J)}add(A){y(A);let{px:E,py:k,pz:D}=this,{px:C,py:Z,pz:F}=A,Q=t.ZERO,J=t.ZERO,W=t.ZERO,Te=e.a,Ae=t.mul(e.b,Qu),ye=t.mul(E,C),Oe=t.mul(k,Z),ze=t.mul(D,F),rt=t.add(E,k),P=t.add(C,Z);rt=t.mul(rt,P),P=t.add(ye,Oe),rt=t.sub(rt,P),P=t.add(E,D);let $=t.add(C,F);return P=t.mul(P,$),$=t.add(ye,ze),P=t.sub(P,$),$=t.add(k,D),Q=t.add(Z,F),$=t.mul($,Q),Q=t.add(Oe,ze),$=t.sub($,Q),W=t.mul(Te,P),Q=t.mul(Ae,ze),W=t.add(Q,W),Q=t.sub(Oe,W),W=t.add(Oe,W),J=t.mul(Q,W),Oe=t.add(ye,ye),Oe=t.add(Oe,ye),ze=t.mul(Te,ze),P=t.mul(Ae,P),Oe=t.add(Oe,ze),ze=t.sub(ye,ze),ze=t.mul(Te,ze),P=t.add(P,ze),ye=t.mul(Oe,P),J=t.add(J,ye),ye=t.mul($,P),Q=t.mul(rt,Q),Q=t.sub(Q,ye),ye=t.mul(rt,Oe),W=t.mul($,W),W=t.add(W,ye),new g(Q,J,W)}subtract(A){return this.add(A.negate())}is0(){return this.equals(g.ZERO)}wNAF(A){return v.wNAFCached(this,h,A,E=>{let k=t.invertBatch(E.map(D=>D.pz));return E.map((D,C)=>D.toAffine(k[C])).map(g.fromAffine)})}multiplyUnsafe(A){let E=g.ZERO;if(A===hr)return E;if(u(A),A===Ct)return this;let{endo:k}=e;if(!k)return v.unsafeLadder(this,A);let{k1neg:D,k1:C,k2neg:Z,k2:F}=k.splitScalar(A),Q=E,J=E,W=this;for(;C>hr||F>hr;)C&Ct&&(Q=Q.add(W)),F&Ct&&(J=J.add(W)),W=W.double(),C>>=Ct,F>>=Ct;return D&&(Q=Q.negate()),Z&&(J=J.negate()),J=new g(t.mul(J.px,k.beta),J.py,J.pz),Q.add(J)}multiply(A){u(A);let E=A,k,D,{endo:C}=e;if(C){let{k1neg:Z,k1:F,k2neg:Q,k2:J}=C.splitScalar(E),{p:W,f:Te}=this.wNAF(F),{p:Ae,f:ye}=this.wNAF(J);W=v.constTimeNegate(Z,W),Ae=v.constTimeNegate(Q,Ae),Ae=new g(t.mul(Ae.px,C.beta),Ae.py,Ae.pz),k=W.add(Ae),D=Te.add(ye)}else{let{p:Z,f:F}=this.wNAF(E);k=Z,D=F}return g.normalizeZ([k,D])[0]}multiplyAndAddUnsafe(A,E,k){let D=g.BASE,C=(F,Q)=>Q===hr||Q===Ct||!F.equals(D)?F.multiplyUnsafe(Q):F.multiply(Q),Z=C(this,E).add(C(A,k));return Z.is0()?void 0:Z}toAffine(A){let{px:E,py:k,pz:D}=this,C=this.is0();A==null&&(A=C?t.ONE:t.inv(D));let Z=t.mul(E,A),F=t.mul(k,A),Q=t.mul(D,A);if(C)return{x:t.ZERO,y:t.ZERO};if(!t.eql(Q,t.ONE))throw new Error("invZ was invalid");return{x:Z,y:F}}isTorsionFree(){let{h:A,isTorsionFree:E}=e;if(A===Ct)return!0;if(E)return E(g,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:A,clearCofactor:E}=e;return A===Ct?this:E?E(g,this):this.multiplyUnsafe(e.h)}toRawBytes(A=!0){return this.assertValidity(),n(g,this,A)}toHex(A=!0){return sn(this.toRawBytes(A))}}g.BASE=new g(e.Gx,e.Gy,t.ONE),g.ZERO=new g(t.ZERO,t.ONE,t.ZERO);let T=e.nBitLength,v=Vu(g,e.endo?Math.ceil(T/2):T);return{CURVE:e,ProjectivePoint:g,normPrivateKeyToScalar:d,weierstrassEquation:i,isWithinCurveOrder:a}}function Rh(r){let e=Xi(r);return Cr(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Wu(r){let e=Rh(r),{Fp:t,n}=e,o=t.BYTES+1,i=2*t.BYTES+1;function a(P){return hr<P&&P<t.ORDER}function u(P){return ct(P,n)}function d(P){return As(P,n)}let{ProjectivePoint:h,normPrivateKeyToScalar:y,weierstrassEquation:g,isWithinCurveOrder:T}=Ih({...e,toBytes(P,$,ue){let Ce=$.toAffine(),Ie=t.toBytes(Ce.x),Le=qn;return ue?Le(Uint8Array.from([$.hasEvenY()?2:3]),Ie):Le(Uint8Array.from([4]),Ie,t.toBytes(Ce.y))},fromBytes(P){let $=P.length,ue=P[0],Ce=P.subarray(1);if($===o&&(ue===2||ue===3)){let Ie=pr(Ce);if(!a(Ie))throw new Error("Point is not on curve");let Le=g(Ie),tt=t.sqrt(Le),Pe=(tt&Ct)===Ct;return(ue&1)===1!==Pe&&(tt=t.neg(tt)),{x:Ie,y:tt}}else if($===i&&ue===4){let Ie=t.fromBytes(Ce.subarray(0,t.BYTES)),Le=t.fromBytes(Ce.subarray(t.BYTES,2*t.BYTES));return{x:Ie,y:Le}}else throw new Error(`Point of length ${$} was invalid. Expected ${o} compressed bytes or ${i} uncompressed bytes`)}}),v=P=>sn(Br(P,e.nByteLength));function I(P){let $=n>>Ct;return P>$}function A(P){return I(P)?u(-P):P}let E=(P,$,ue)=>pr(P.slice($,ue));class k{constructor($,ue,Ce){this.r=$,this.s=ue,this.recovery=Ce,this.assertValidity()}static fromCompact($){let ue=e.nByteLength;return $=wt("compactSignature",$,ue*2),new k(E($,0,ue),E($,ue,2*ue))}static fromDER($){let{r:ue,s:Ce}=un.toSig(wt("DER",$));return new k(ue,Ce)}assertValidity(){if(!T(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!T(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit($){return new k(this.r,this.s,$)}recoverPublicKey($){let{r:ue,s:Ce,recovery:Ie}=this,Le=J(wt("msgHash",$));if(Ie==null||![0,1,2,3].includes(Ie))throw new Error("recovery id invalid");let tt=Ie===2||Ie===3?ue+e.n:ue;if(tt>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");let Pe=(Ie&1)===0?"02":"03",je=h.fromHex(Pe+v(tt)),fe=d(tt),Ve=u(-Le*fe),xr=u(Ce*fe),Ot=h.BASE.multiplyAndAddUnsafe(je,Ve,xr);if(!Ot)throw new Error("point at infinify");return Ot.assertValidity(),Ot}hasHighS(){return I(this.s)}normalizeS(){return this.hasHighS()?new k(this.r,u(-this.s),this.recovery):this}toDERRawBytes(){return an(this.toDERHex())}toDERHex(){return un.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return an(this.toCompactHex())}toCompactHex(){return v(this.r)+v(this.s)}}let D={isValidPrivateKey(P){try{return y(P),!0}catch($){return!1}},normPrivateKeyToScalar:y,randomPrivateKey:()=>{let P=Wi(e.n);return Ku(e.randomBytes(P),e.n)},precompute(P=8,$=h.BASE){return $._setWindowSize(P),$.multiply(BigInt(3)),$}};function C(P,$=!0){return h.fromPrivateKey(P).toRawBytes($)}function Z(P){let $=P instanceof Uint8Array,ue=typeof P=="string",Ce=($||ue)&&P.length;return $?Ce===o||Ce===i:ue?Ce===2*o||Ce===2*i:P instanceof h}function F(P,$,ue=!0){if(Z(P))throw new Error("first arg must be private key");if(!Z($))throw new Error("second arg must be public key");return h.fromHex($).multiply(y(P)).toRawBytes(ue)}let Q=e.bits2int||function(P){let $=pr(P),ue=P.length*8-e.nBitLength;return ue>0?$>>BigInt(ue):$},J=e.bits2int_modN||function(P){return u(Q(P))},W=go(e.nBitLength);function Te(P){if(typeof P!="bigint")throw new Error("bigint expected");if(!(hr<=P&&P<W))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Br(P,e.nByteLength)}function Ae(P,$,ue=ye){if(["recovered","canonical"].some(Ut=>Ut in ue))throw new Error("sign() legacy options not supported");let{hash:Ce,randomBytes:Ie}=e,{lowS:Le,prehash:tt,extraEntropy:Pe}=ue;Le==null&&(Le=!0),P=wt("msgHash",P),tt&&(P=wt("prehashed msgHash",Ce(P)));let je=J(P),fe=y($),Ve=[Te(fe),Te(je)];if(Pe!=null){let Ut=Pe===!0?Ie(t.BYTES):Pe;Ve.push(wt("extraEntropy",Ut))}let xr=qn(...Ve),Ot=je;function mr(Ut){let rr=Q(Ut);if(!T(rr))return;let jr=d(rr),nr=h.BASE.multiply(rr).toAffine(),xt=u(nr.x);if(xt===hr)return;let br=u(jr*u(Ot+xt*fe));if(br===hr)return;let qo=(nr.x===xt?0:2)|Number(nr.y&Ct),Yn=br;return Le&&I(br)&&(Yn=A(br),qo^=1),new k(xt,Yn,qo)}return{seed:xr,k2sig:mr}}let ye={lowS:e.lowS,prehash:!1},Oe={lowS:e.lowS,prehash:!1};function ze(P,$,ue=ye){let{seed:Ce,k2sig:Ie}=Ae(P,$,ue),Le=e;return $i(Le.hash.outputLen,Le.nByteLength,Le.hmac)(Ce,Ie)}h.BASE._setWindowSize(8);function rt(P,$,ue,Ce=Oe){var nr;let Ie=P;if($=wt("msgHash",$),ue=wt("publicKey",ue),"strict"in Ce)throw new Error("options.strict was renamed to lowS");let{lowS:Le,prehash:tt}=Ce,Pe,je;try{if(typeof Ie=="string"||Ie instanceof Uint8Array)try{Pe=k.fromDER(Ie)}catch(xt){if(!(xt instanceof un.Err))throw xt;Pe=k.fromCompact(Ie)}else if(typeof Ie=="object"&&typeof Ie.r=="bigint"&&typeof Ie.s=="bigint"){let{r:xt,s:br}=Ie;Pe=new k(xt,br)}else throw new Error("PARSE");je=h.fromHex(ue)}catch(xt){if(xt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(Le&&Pe.hasHighS())return!1;tt&&($=e.hash($));let{r:fe,s:Ve}=Pe,xr=J($),Ot=d(Ve),mr=u(xr*Ot),Ut=u(fe*Ot),rr=(nr=h.BASE.multiplyAndAddUnsafe(je,mr,Ut))==null?void 0:nr.toAffine();return rr?u(rr.x)===fe:!1}return{CURVE:e,getPublicKey:C,getSharedSecret:F,sign:ze,verify:rt,ProjectivePoint:h,Signature:k,utils:D}}var ws=class extends Dn{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,ku(e);let n=ho(t);if(this.iHash=e.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,i=new Uint8Array(o);i.set(n.length>o?e.create().update(n).digest():n);for(let a=0;a<i.length;a++)i[a]^=54;this.iHash.update(i),this.oHash=e.create();for(let a=0;a<i.length;a++)i[a]^=106;this.oHash.update(i),i.fill(0)}update(e){return Nn(this),this.iHash.update(e),this}digestInto(e){Nn(this),Mi(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:n,finished:o,destroyed:i,blockLen:a,outputLen:u}=this;return e=e,e.finished=o,e.destroyed=i,e.blockLen=a,e.outputLen=u,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Zi=(r,e,t)=>new ws(r,e).update(t).digest();Zi.create=(r,e)=>new ws(r,e);function kh(r){return{hash:r,hmac:(e,...t)=>Zi(r,e,Pu(...t)),randomBytes:Nu}}function Yu(r,e){let t=n=>Wu({...r,...kh(n)});return Object.freeze({...t(e),create:t})}var Ju=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Xu=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Oh=BigInt(1),Ji=BigInt(2),Zu=(r,e)=>(r+e/Ji)/e;function zh(r){let e=Ju,t=BigInt(3),n=BigInt(6),o=BigInt(11),i=BigInt(22),a=BigInt(23),u=BigInt(44),d=BigInt(88),h=r*r*r%e,y=h*h*r%e,g=_t(y,t,e)*y%e,T=_t(g,t,e)*y%e,v=_t(T,Ji,e)*h%e,I=_t(v,o,e)*v%e,A=_t(I,i,e)*I%e,E=_t(A,u,e)*A%e,k=_t(E,d,e)*E%e,D=_t(k,u,e)*A%e,C=_t(D,t,e)*y%e,Z=_t(C,a,e)*I%e,F=_t(Z,n,e)*h%e,Q=_t(F,Ji,e);if(!ea.eql(ea.sqr(Q),r))throw new Error("Cannot find square root");return Q}var ea=$u(Ju,void 0,void 0,{sqrt:zh}),Mn=Yu({a:BigInt(0),b:BigInt(7),Fp:ea,n:Xu,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{let e=Xu,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Oh*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=t,a=BigInt("0x100000000000000000000000000000000"),u=Zu(i*r,e),d=Zu(-n*r,e),h=ct(r-u*t-d*o,e),y=ct(-u*n-d*i,e),g=h>a,T=y>a;if(g&&(h=e-h),T&&(y=e-y),h>a||y>a)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:g,k1:h,k2neg:T,k2:y}}}},Du),Am=BigInt(0);var wm=Mn.ProjectivePoint;var yo=class extends cr{constructor(t){super();let n=te.fromHexInput(t);if(n.toUint8Array().length!==yo.LENGTH)throw new Error(`PublicKey length should be ${yo.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(t){let{message:n,signature:o}=t,i=te.fromHexInput(n).toUint8Array(),a=en(i),u=o.toUint8Array();return Mn.verify(u,a,this.toUint8Array())}serialize(t){t.serializeBytes(this.key.toUint8Array())}static deserialize(t){let n=t.deserializeBytes();return new yo(n)}},ut=yo;ut.LENGTH=65;var Gn=class extends nn{constructor(t){super();let n=te.fromHexInput(t);if(n.toUint8Array().length!==Gn.LENGTH)throw new Error(`PrivateKey length should be ${Gn.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}sign(t){let n=te.fromHexInput(t),o=en(n.toUint8Array()),i=Mn.sign(o,this.key.toUint8Array());return new It(i.toCompactRawBytes())}serialize(t){t.serializeBytes(this.toUint8Array())}static deserialize(t){let n=t.deserializeBytes();return new Gn(n)}static generate(){let t=Mn.utils.randomPrivateKey();return new Gn(t)}publicKey(){let t=Mn.getPublicKey(this.key.toUint8Array(),!1);return new ut(t)}},Ln=Gn;Ln.LENGTH=32;var xo=class extends ur{constructor(t){super();let n=te.fromHexInput(t);if(n.toUint8Array().length!==xo.LENGTH)throw new Error(`Signature length should be ${xo.LENGTH}`);this.data=n}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(t){t.serializeBytes(this.data.toUint8Array())}static deserialize(t){let n=t.deserializeBytes();return new xo(n)}},It=xo;It.LENGTH=64;var Fn=class{constructor(e){let{data:t}=e,n=te.fromHexInput(t);if(n.toUint8Array().length!==Fn.LENGTH)throw new Error(`Authentication Key length should be ${Fn.LENGTH}`);this.data=n}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromBytesAndScheme(e){let{bytes:t,scheme:n}=e,o=te.fromHexInput(t).toUint8Array(),i=new Uint8Array(o.length+1);i.set(o),i.set([n],o.length);let a=en.create();return a.update(i),new Fn({data:a.digest()})}static fromPublicKey(e){let{publicKey:t}=e,n;if(t instanceof He)n=0 .valueOf();else if(t instanceof gt)n=1 .valueOf();else if(t instanceof ut)n=2 .valueOf();else throw new Error("No supported authentication scheme for public key");let o=t.toUint8Array();return Fn.fromBytesAndScheme({bytes:o,scheme:n})}derivedAddress(){return new M({data:this.data.toUint8Array()})}},$n=Fn;$n.LENGTH=32;var _s=class extends _r{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,it.hash(e);let n=Tr(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,i=new Uint8Array(o);i.set(n.length>o?e.create().update(n).digest():n);for(let a=0;a<i.length;a++)i[a]^=54;this.iHash.update(i),this.oHash=e.create();for(let a=0;a<i.length;a++)i[a]^=106;this.oHash.update(i),i.fill(0)}update(e){return it.exists(this),this.iHash.update(e),this}digestInto(e){it.exists(this),it.bytes(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:n,finished:o,destroyed:i,blockLen:a,outputLen:u}=this;return e=e,e.finished=o,e.destroyed=i,e.blockLen=a,e.outputLen=u,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},ta=(r,e,t)=>new _s(r,e).update(t).digest();ta.create=(r,e)=>new _s(r,e);function Ph(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let o=BigInt(32),i=BigInt(4294967295),a=Number(t>>o&i),u=Number(t&i),d=n?4:0,h=n?0:4;r.setUint32(e+d,a,n),r.setUint32(e+h,u,n)}var Ts=class extends _r{constructor(e,t,n,o){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ss(this.buffer)}update(e){it.exists(this);let{view:t,buffer:n,blockLen:o}=this;e=Tr(e);let i=e.length;for(let a=0;a<i;){let u=Math.min(o-this.pos,i-a);if(u===o){let d=ss(e);for(;o<=i-a;a+=o)this.process(d,a);continue}n.set(e.subarray(a,a+u),this.pos),this.pos+=u,a+=u,this.pos===o&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){it.exists(this),it.output(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:o,isLE:i}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(n,0),a=0);for(let d=a;d<o;d++)t[d]=0;Ph(n,o-8,BigInt(this.length*8),i),this.process(n,0);let u=ss(e);this.get().forEach((d,h)=>u.setUint32(4*h,d,i))}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:o,finished:i,destroyed:a,pos:u}=this;return e.length=o,e.pos=u,e.finished=i,e.destroyed=a,o%t&&e.buffer.set(n),e}};var[Hh,Nh]=ne.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))),Ir=new Uint32Array(80),Rr=new Uint32Array(80),mo=class extends Ts{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:e,Al:t,Bh:n,Bl:o,Ch:i,Cl:a,Dh:u,Dl:d,Eh:h,El:y,Fh:g,Fl:T,Gh:v,Gl:I,Hh:A,Hl:E}=this;return[e,t,n,o,i,a,u,d,h,y,g,T,v,I,A,E]}set(e,t,n,o,i,a,u,d,h,y,g,T,v,I,A,E){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=o|0,this.Ch=i|0,this.Cl=a|0,this.Dh=u|0,this.Dl=d|0,this.Eh=h|0,this.El=y|0,this.Fh=g|0,this.Fl=T|0,this.Gh=v|0,this.Gl=I|0,this.Hh=A|0,this.Hl=E|0}process(e,t){for(let C=0;C<16;C++,t+=4)Ir[C]=e.getUint32(t),Rr[C]=e.getUint32(t+=4);for(let C=16;C<80;C++){let Z=Ir[C-15]|0,F=Rr[C-15]|0,Q=ne.rotrSH(Z,F,1)^ne.rotrSH(Z,F,8)^ne.shrSH(Z,F,7),J=ne.rotrSL(Z,F,1)^ne.rotrSL(Z,F,8)^ne.shrSL(Z,F,7),W=Ir[C-2]|0,Te=Rr[C-2]|0,Ae=ne.rotrSH(W,Te,19)^ne.rotrBH(W,Te,61)^ne.shrSH(W,Te,6),ye=ne.rotrSL(W,Te,19)^ne.rotrBL(W,Te,61)^ne.shrSL(W,Te,6),Oe=ne.add4L(J,ye,Rr[C-7],Rr[C-16]),ze=ne.add4H(Oe,Q,Ae,Ir[C-7],Ir[C-16]);Ir[C]=ze|0,Rr[C]=Oe|0}let{Ah:n,Al:o,Bh:i,Bl:a,Ch:u,Cl:d,Dh:h,Dl:y,Eh:g,El:T,Fh:v,Fl:I,Gh:A,Gl:E,Hh:k,Hl:D}=this;for(let C=0;C<80;C++){let Z=ne.rotrSH(g,T,14)^ne.rotrSH(g,T,18)^ne.rotrBH(g,T,41),F=ne.rotrSL(g,T,14)^ne.rotrSL(g,T,18)^ne.rotrBL(g,T,41),Q=g&v^~g&A,J=T&I^~T&E,W=ne.add5L(D,F,J,Nh[C],Rr[C]),Te=ne.add5H(W,k,Z,Q,Hh[C],Ir[C]),Ae=W|0,ye=ne.rotrSH(n,o,28)^ne.rotrBH(n,o,34)^ne.rotrBH(n,o,39),Oe=ne.rotrSL(n,o,28)^ne.rotrBL(n,o,34)^ne.rotrBL(n,o,39),ze=n&i^n&u^i&u,rt=o&a^o&d^a&d;k=A|0,D=E|0,A=v|0,E=I|0,v=g|0,I=T|0,{h:g,l:T}=ne.add(h|0,y|0,Te|0,Ae|0),h=u|0,y=d|0,u=i|0,d=a|0,i=n|0,a=o|0;let P=ne.add3L(Ae,Oe,rt);n=ne.add3H(P,Te,ye,ze),o=P|0}({h:n,l:o}=ne.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:i,l:a}=ne.add(this.Bh|0,this.Bl|0,i|0,a|0),{h:u,l:d}=ne.add(this.Ch|0,this.Cl|0,u|0,d|0),{h,l:y}=ne.add(this.Dh|0,this.Dl|0,h|0,y|0),{h:g,l:T}=ne.add(this.Eh|0,this.El|0,g|0,T|0),{h:v,l:I}=ne.add(this.Fh|0,this.Fl|0,v|0,I|0),{h:A,l:E}=ne.add(this.Gh|0,this.Gl|0,A|0,E|0),{h:k,l:D}=ne.add(this.Hh|0,this.Hl|0,k|0,D|0),this.set(n,o,i,a,u,d,h,y,g,T,v,I,A,E,k,D)}roundClean(){Ir.fill(0),Rr.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)}},ra=class extends mo{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}},na=class extends mo{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}},ef=Pn(()=>new mo),Vm=Pn(()=>new ra),Qm=Pn(()=>new na);var Mf=oi(qf()),Gf=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Aa=(e=>(e.ED25519="ed25519 seed",e))(Aa||{}),F0=2147483648,Lf=(r,e)=>{let t=ta.create(ef,r).update(e).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}},$0=({key:r,chainCode:e},t)=>{let n=new ArrayBuffer(4);new DataView(n).setUint32(0,t);let o=new Uint8Array(n),i=new Uint8Array([0]),a=new Uint8Array([...i,...r,...o]);return Lf(e,a)},j0=r=>r.replace("'",""),Ff=r=>r.split("/").slice(1).map(j0),$f=r=>Gf.test(r)?!Ff(r).some(Number.isNaN):!1,K0=r=>{let e=r.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return Mf.mnemonicToSeedSync(e)},wa=(r,e,t,n=F0)=>{if(!$f(e))throw new Error("Invalid derivation path");let{key:o,chainCode:i}=Lf(r,K0(t));return Ff(e).map(u=>parseInt(u,10)).reduce((u,d)=>$0(u,d+n),{key:o,chainCode:i})};var Qt=class{constructor(e){let{privateKey:t,address:n}=e;if(this.publicKey=t.publicKey(),this.publicKey instanceof He)this.signingScheme=0;else if(this.publicKey instanceof gt)this.signingScheme=1;else if(this.publicKey instanceof ut)this.signingScheme=2;else throw new Error("Can not create new Account, unsupported public key type");this.privateKey=t,this.accountAddress=n}static generate(e){let t;switch(e){case 2:t=Ln.generate();break;default:t=on.generate()}let n=new M({data:Qt.authKey({publicKey:t.publicKey()}).toUint8Array()});return new Qt({privateKey:t,address:n})}static fromPrivateKey(e){let t=e.publicKey(),n=Qt.authKey({publicKey:t}),o=new M({data:n.toUint8Array()});return Qt.fromPrivateKeyAndAddress({privateKey:e,address:o})}static fromPrivateKeyAndAddress(e){return new Qt(e)}static fromDerivationPath(e){let{path:t,mnemonic:n}=e,{key:o}=wa("ed25519 seed",t,n),i=new on(o);return Qt.fromPrivateKey(i)}static authKey(e){let{publicKey:t}=e;return $n.fromPublicKey({publicKey:t}).data}sign(e){return this.privateKey.sign(e)}verifySignature(e){let{message:t,signature:n}=e,o=te.fromHexInput(t).toUint8Array();return this.publicKey.verifySignature({message:o,signature:n})}};var Ps=`
|
|
3
|
+
fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {
|
|
4
|
+
token_standard
|
|
5
|
+
token_properties_mutated_v1
|
|
6
|
+
token_data_id
|
|
7
|
+
table_type_v1
|
|
8
|
+
storage_id
|
|
9
|
+
property_version_v1
|
|
10
|
+
owner_address
|
|
11
|
+
last_transaction_version
|
|
12
|
+
last_transaction_timestamp
|
|
13
|
+
is_soulbound_v2
|
|
14
|
+
is_fungible_v2
|
|
15
|
+
amount
|
|
16
|
+
current_token_data {
|
|
17
|
+
collection_id
|
|
18
|
+
description
|
|
19
|
+
is_fungible_v2
|
|
20
|
+
largest_property_version_v1
|
|
21
|
+
last_transaction_timestamp
|
|
22
|
+
last_transaction_version
|
|
23
|
+
maximum
|
|
24
|
+
supply
|
|
25
|
+
token_data_id
|
|
26
|
+
token_name
|
|
27
|
+
token_properties
|
|
28
|
+
token_standard
|
|
29
|
+
token_uri
|
|
30
|
+
current_collection {
|
|
31
|
+
collection_id
|
|
32
|
+
collection_name
|
|
33
|
+
creator_address
|
|
34
|
+
current_supply
|
|
35
|
+
description
|
|
36
|
+
last_transaction_timestamp
|
|
37
|
+
last_transaction_version
|
|
38
|
+
max_supply
|
|
39
|
+
mutable_description
|
|
40
|
+
mutable_uri
|
|
41
|
+
table_handle_v1
|
|
42
|
+
token_standard
|
|
43
|
+
total_minted_v2
|
|
44
|
+
uri
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`,V0=`
|
|
49
|
+
fragment TokenActivitiesFields on token_activities_v2 {
|
|
50
|
+
after_value
|
|
51
|
+
before_value
|
|
52
|
+
entry_function_id_str
|
|
53
|
+
event_account_address
|
|
54
|
+
event_index
|
|
55
|
+
from_address
|
|
56
|
+
is_fungible_v2
|
|
57
|
+
property_version_v1
|
|
58
|
+
to_address
|
|
59
|
+
token_amount
|
|
60
|
+
token_data_id
|
|
61
|
+
token_standard
|
|
62
|
+
transaction_timestamp
|
|
63
|
+
transaction_version
|
|
64
|
+
type
|
|
65
|
+
}
|
|
66
|
+
`,jf=`
|
|
67
|
+
query getAccountCoinsCount($address: String) {
|
|
68
|
+
current_fungible_asset_balances_aggregate(
|
|
69
|
+
where: {owner_address: {_eq: $address}}
|
|
70
|
+
) {
|
|
71
|
+
aggregate {
|
|
72
|
+
count
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
`,Kf=`
|
|
77
|
+
query getAccountCoinsData($where_condition: current_fungible_asset_balances_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_fungible_asset_balances_order_by!]) {
|
|
78
|
+
current_fungible_asset_balances(
|
|
79
|
+
where: $where_condition
|
|
80
|
+
offset: $offset
|
|
81
|
+
limit: $limit
|
|
82
|
+
order_by: $order_by
|
|
83
|
+
) {
|
|
84
|
+
amount
|
|
85
|
+
asset_type
|
|
86
|
+
is_frozen
|
|
87
|
+
is_primary
|
|
88
|
+
last_transaction_timestamp
|
|
89
|
+
last_transaction_version
|
|
90
|
+
owner_address
|
|
91
|
+
storage_id
|
|
92
|
+
token_standard
|
|
93
|
+
metadata {
|
|
94
|
+
token_standard
|
|
95
|
+
symbol
|
|
96
|
+
supply_aggregator_table_key_v1
|
|
97
|
+
supply_aggregator_table_handle_v1
|
|
98
|
+
project_uri
|
|
99
|
+
name
|
|
100
|
+
last_transaction_version
|
|
101
|
+
last_transaction_timestamp
|
|
102
|
+
icon_uri
|
|
103
|
+
decimals
|
|
104
|
+
creator_address
|
|
105
|
+
asset_type
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
`,Vf=`
|
|
110
|
+
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
|
+
current_collection_ownership_v2_view(
|
|
112
|
+
where: $where_condition
|
|
113
|
+
offset: $offset
|
|
114
|
+
limit: $limit
|
|
115
|
+
order_by: $order_by
|
|
116
|
+
) {
|
|
117
|
+
current_collection {
|
|
118
|
+
collection_id
|
|
119
|
+
collection_name
|
|
120
|
+
creator_address
|
|
121
|
+
current_supply
|
|
122
|
+
description
|
|
123
|
+
last_transaction_timestamp
|
|
124
|
+
last_transaction_version
|
|
125
|
+
mutable_description
|
|
126
|
+
max_supply
|
|
127
|
+
mutable_uri
|
|
128
|
+
table_handle_v1
|
|
129
|
+
token_standard
|
|
130
|
+
total_minted_v2
|
|
131
|
+
uri
|
|
132
|
+
}
|
|
133
|
+
collection_id
|
|
134
|
+
collection_name
|
|
135
|
+
collection_uri
|
|
136
|
+
creator_address
|
|
137
|
+
distinct_tokens
|
|
138
|
+
last_transaction_version
|
|
139
|
+
owner_address
|
|
140
|
+
single_token_uri
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
`,Qf=`
|
|
144
|
+
query getAccountOwnedObjects($where_condition: current_objects_bool_exp, $offset: Int, $limit: Int, $order_by: [current_objects_order_by!]) {
|
|
145
|
+
current_objects(
|
|
146
|
+
where: $where_condition
|
|
147
|
+
offset: $offset
|
|
148
|
+
limit: $limit
|
|
149
|
+
order_by: $order_by
|
|
150
|
+
) {
|
|
151
|
+
allow_ungated_transfer
|
|
152
|
+
state_key_hash
|
|
153
|
+
owner_address
|
|
154
|
+
object_address
|
|
155
|
+
last_transaction_version
|
|
156
|
+
last_guid_creation_num
|
|
157
|
+
is_deleted
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
`,Wf=`
|
|
161
|
+
query getAccountOwnedTokens($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
162
|
+
current_token_ownerships_v2(
|
|
163
|
+
where: $where_condition
|
|
164
|
+
offset: $offset
|
|
165
|
+
limit: $limit
|
|
166
|
+
order_by: $order_by
|
|
167
|
+
) {
|
|
168
|
+
...CurrentTokenOwnershipFields
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
${Ps}`,kb=`
|
|
172
|
+
query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
173
|
+
current_token_ownerships_v2(
|
|
174
|
+
where: $where_condition
|
|
175
|
+
offset: $offset
|
|
176
|
+
limit: $limit
|
|
177
|
+
order_by: $order_by
|
|
178
|
+
) {
|
|
179
|
+
...CurrentTokenOwnershipFields
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
${Ps}`,Yf=`
|
|
183
|
+
query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
184
|
+
current_token_ownerships_v2(
|
|
185
|
+
where: $where_condition
|
|
186
|
+
offset: $offset
|
|
187
|
+
limit: $limit
|
|
188
|
+
order_by: $order_by
|
|
189
|
+
) {
|
|
190
|
+
...CurrentTokenOwnershipFields
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
${Ps}`,Xf=`
|
|
194
|
+
query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {
|
|
195
|
+
current_token_ownerships_v2_aggregate(
|
|
196
|
+
where: $where_condition
|
|
197
|
+
offset: $offset
|
|
198
|
+
limit: $limit
|
|
199
|
+
) {
|
|
200
|
+
aggregate {
|
|
201
|
+
count
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
`,Zf=`
|
|
206
|
+
query getAccountTransactionsCount($address: String) {
|
|
207
|
+
account_transactions_aggregate(where: {account_address: {_eq: $address}}) {
|
|
208
|
+
aggregate {
|
|
209
|
+
count
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
`,Jf=`
|
|
214
|
+
query getChainTopUserTransactions($limit: Int) {
|
|
215
|
+
user_transactions(limit: $limit, order_by: {version: desc}) {
|
|
216
|
+
version
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
`,el=`
|
|
220
|
+
query getCollectionData($where_condition: current_collections_v2_bool_exp!) {
|
|
221
|
+
current_collections_v2(where: $where_condition) {
|
|
222
|
+
collection_id
|
|
223
|
+
collection_name
|
|
224
|
+
creator_address
|
|
225
|
+
current_supply
|
|
226
|
+
description
|
|
227
|
+
last_transaction_timestamp
|
|
228
|
+
last_transaction_version
|
|
229
|
+
max_supply
|
|
230
|
+
mutable_description
|
|
231
|
+
mutable_uri
|
|
232
|
+
table_handle_v1
|
|
233
|
+
token_standard
|
|
234
|
+
total_minted_v2
|
|
235
|
+
uri
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
`,tl=`
|
|
239
|
+
query getCurrentFungibleAssetBalances($where_condition: current_fungible_asset_balances_bool_exp, $offset: Int, $limit: Int) {
|
|
240
|
+
current_fungible_asset_balances(
|
|
241
|
+
where: $where_condition
|
|
242
|
+
offset: $offset
|
|
243
|
+
limit: $limit
|
|
244
|
+
) {
|
|
245
|
+
amount
|
|
246
|
+
asset_type
|
|
247
|
+
is_frozen
|
|
248
|
+
is_primary
|
|
249
|
+
last_transaction_timestamp
|
|
250
|
+
last_transaction_version
|
|
251
|
+
owner_address
|
|
252
|
+
storage_id
|
|
253
|
+
token_standard
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
`,rl=`
|
|
257
|
+
query getDelegatedStakingActivities($delegatorAddress: String, $poolAddress: String) {
|
|
258
|
+
delegated_staking_activities(
|
|
259
|
+
where: {delegator_address: {_eq: $delegatorAddress}, pool_address: {_eq: $poolAddress}}
|
|
260
|
+
) {
|
|
261
|
+
amount
|
|
262
|
+
delegator_address
|
|
263
|
+
event_index
|
|
264
|
+
event_type
|
|
265
|
+
pool_address
|
|
266
|
+
transaction_version
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
`,nl=`
|
|
270
|
+
query getEvents($where_condition: events_bool_exp, $offset: Int, $limit: Int, $order_by: [events_order_by!]) {
|
|
271
|
+
events(
|
|
272
|
+
where: $where_condition
|
|
273
|
+
offset: $offset
|
|
274
|
+
limit: $limit
|
|
275
|
+
order_by: $order_by
|
|
276
|
+
) {
|
|
277
|
+
account_address
|
|
278
|
+
creation_number
|
|
279
|
+
data
|
|
280
|
+
event_index
|
|
281
|
+
sequence_number
|
|
282
|
+
transaction_block_height
|
|
283
|
+
transaction_version
|
|
284
|
+
type
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
`,ol=`
|
|
288
|
+
query getFungibleAssetActivities($where_condition: fungible_asset_activities_bool_exp, $offset: Int, $limit: Int) {
|
|
289
|
+
fungible_asset_activities(
|
|
290
|
+
where: $where_condition
|
|
291
|
+
offset: $offset
|
|
292
|
+
limit: $limit
|
|
293
|
+
) {
|
|
294
|
+
amount
|
|
295
|
+
asset_type
|
|
296
|
+
block_height
|
|
297
|
+
entry_function_id_str
|
|
298
|
+
event_index
|
|
299
|
+
gas_fee_payer_address
|
|
300
|
+
is_frozen
|
|
301
|
+
is_gas_fee
|
|
302
|
+
is_transaction_success
|
|
303
|
+
owner_address
|
|
304
|
+
storage_id
|
|
305
|
+
storage_refund_amount
|
|
306
|
+
token_standard
|
|
307
|
+
transaction_timestamp
|
|
308
|
+
transaction_version
|
|
309
|
+
type
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
`,sl=`
|
|
313
|
+
query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_exp, $offset: Int, $limit: Int) {
|
|
314
|
+
fungible_asset_metadata(where: $where_condition, offset: $offset, limit: $limit) {
|
|
315
|
+
icon_uri
|
|
316
|
+
project_uri
|
|
317
|
+
supply_aggregator_table_handle_v1
|
|
318
|
+
supply_aggregator_table_key_v1
|
|
319
|
+
creator_address
|
|
320
|
+
asset_type
|
|
321
|
+
decimals
|
|
322
|
+
last_transaction_timestamp
|
|
323
|
+
last_transaction_version
|
|
324
|
+
name
|
|
325
|
+
symbol
|
|
326
|
+
token_standard
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
`,_a=`
|
|
330
|
+
query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp!, $order_by: [num_active_delegator_per_pool_order_by!]) {
|
|
331
|
+
num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
|
|
332
|
+
num_active_delegator
|
|
333
|
+
pool_address
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
`,il=`
|
|
337
|
+
query getProcessorStatus {
|
|
338
|
+
processor_status {
|
|
339
|
+
last_success_version
|
|
340
|
+
processor
|
|
341
|
+
last_updated
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
`,al=`
|
|
345
|
+
query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {
|
|
346
|
+
token_activities_v2(
|
|
347
|
+
where: $where_condition
|
|
348
|
+
order_by: $order_by
|
|
349
|
+
offset: $offset
|
|
350
|
+
limit: $limit
|
|
351
|
+
) {
|
|
352
|
+
...TokenActivitiesFields
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
${V0}`,Ta=`
|
|
356
|
+
query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
357
|
+
current_token_ownerships_v2(
|
|
358
|
+
where: $where_condition
|
|
359
|
+
offset: $offset
|
|
360
|
+
limit: $limit
|
|
361
|
+
order_by: $order_by
|
|
362
|
+
) {
|
|
363
|
+
...CurrentTokenOwnershipFields
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
${Ps}`,cl=`
|
|
367
|
+
query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
|
|
368
|
+
current_token_datas_v2(
|
|
369
|
+
where: $where_condition
|
|
370
|
+
offset: $offset
|
|
371
|
+
limit: $limit
|
|
372
|
+
order_by: $order_by
|
|
373
|
+
) {
|
|
374
|
+
collection_id
|
|
375
|
+
description
|
|
376
|
+
is_fungible_v2
|
|
377
|
+
largest_property_version_v1
|
|
378
|
+
last_transaction_timestamp
|
|
379
|
+
last_transaction_version
|
|
380
|
+
maximum
|
|
381
|
+
supply
|
|
382
|
+
token_data_id
|
|
383
|
+
token_name
|
|
384
|
+
token_properties
|
|
385
|
+
token_standard
|
|
386
|
+
token_uri
|
|
387
|
+
current_collection {
|
|
388
|
+
collection_id
|
|
389
|
+
collection_name
|
|
390
|
+
creator_address
|
|
391
|
+
current_supply
|
|
392
|
+
description
|
|
393
|
+
last_transaction_timestamp
|
|
394
|
+
last_transaction_version
|
|
395
|
+
max_supply
|
|
396
|
+
mutable_description
|
|
397
|
+
mutable_uri
|
|
398
|
+
table_handle_v1
|
|
399
|
+
token_standard
|
|
400
|
+
total_minted_v2
|
|
401
|
+
uri
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
`;async function Hs(r){let{aptosConfig:e}=r,{data:t}=await ht({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function ul(r){let{aptosConfig:e,ledgerVersion:t,options:n}=r,{data:o}=await ht({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:n==null?void 0:n.withTransactions}});return o}async function fl(r){let{aptosConfig:e,blockHeight:t,options:n}=r,{data:o}=await ht({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:n==null?void 0:n.withTransactions}});return o}async function Ns(r){let{aptosConfig:e,handle:t,data:n,options:o}=r;return(await Xr({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:o==null?void 0:o.ledgerVersion},body:n})).data}async function ll(r){var i,a;let{aptosConfig:e,payload:t,options:n}=r,{data:o}=await Xr({aptosConfig:e,originMethod:"view",path:"view",params:{ledger_version:n==null?void 0:n.ledgerVersion},body:{function:t.function,type_arguments:(i=t.typeArguments)!=null?i:[],arguments:(a=t.arguments)!=null?a:[]}});return o}async function dl(r){let{aptosConfig:e,limit:t}=r;return(await ke({aptosConfig:e,query:{query:Jf,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function ke(r){let{aptosConfig:e,query:t,originMethod:n}=r,{data:o}=await Hi({aptosConfig:e,originMethod:n!=null?n:"queryIndexer",path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return o}async function Q0(r){let{aptosConfig:e}=r;return(await ke({aptosConfig:e,query:{query:il},originMethod:"getProcessorStatuses"})).processor_status}async function Ds(r){return(await Q0({aptosConfig:r.aptosConfig}))[0].last_success_version}var va=new Map;function qs(r,e,t){return async(...n)=>{if(va.has(e)){let{value:i,timestamp:a}=va.get(e);if(t===void 0||Date.now()-a<=t)return i}let o=await r(...n);return va.set(e,{value:o,timestamp:Date.now()}),o}}async function Ms(r){let{aptosConfig:e,accountAddress:t}=r,{data:n}=await ht({aptosConfig:e,originMethod:"getInfo",path:`accounts/${M.fromHexInput(t).toString()}`});return n}async function hl(r){var o;let{aptosConfig:e,accountAddress:t,options:n}=r;return Yr({aptosConfig:e,originMethod:"getModules",path:`accounts/${M.fromHexInput(t).toString()}/modules`,params:{ledger_version:n==null?void 0:n.ledgerVersion,start:n==null?void 0:n.offset,limit:(o=n==null?void 0:n.limit)!=null?o:1e3}})}async function gl(r){var e;return((e=r.options)==null?void 0:e.ledgerVersion)!==void 0?pl(r):qs(async()=>pl(r),`module-${r.accountAddress}-${r.moduleName}`,1e3*60*5)()}async function pl(r){let{aptosConfig:e,accountAddress:t,moduleName:n,options:o}=r,{data:i}=await ht({aptosConfig:e,originMethod:"getModule",path:`accounts/${M.fromHexInput(t).toString()}/module/${n}`,params:{ledger_version:o==null?void 0:o.ledgerVersion}});return i}async function yl(r){let{aptosConfig:e,accountAddress:t,options:n}=r;return Yr({aptosConfig:e,originMethod:"getTransactions",path:`accounts/${M.fromHexInput(t).toString()}/transactions`,params:{start:n==null?void 0:n.offset,limit:n==null?void 0:n.limit}})}async function xl(r){var o;let{aptosConfig:e,accountAddress:t,options:n}=r;return Yr({aptosConfig:e,originMethod:"getResources",path:`accounts/${M.fromHexInput(t).toString()}/resources`,params:{ledger_version:n==null?void 0:n.ledgerVersion,start:n==null?void 0:n.offset,limit:(o=n==null?void 0:n.limit)!=null?o:999}})}async function Ea(r){let{aptosConfig:e,accountAddress:t,resourceType:n,options:o}=r,{data:i}=await ht({aptosConfig:e,originMethod:"getResource",path:`accounts/${M.fromHexInput(t).toString()}/resource/${n}`,params:{ledger_version:o==null?void 0:o.ledgerVersion}});return i}async function ml(r){let{aptosConfig:e,authenticationKey:t,options:n}=r,o=await Ea({aptosConfig:e,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:n}),{address_map:{handle:i}}=o.data;try{let a=await Ns({aptosConfig:e,handle:i,data:{key:te.fromHexInput(t).toString(),key_type:"address",value_type:"address"},options:n});return M.fromHexInput(a)}catch(a){if(a instanceof qt&&a.data.error_code==="table_item_not_found")return M.fromHexInput(t);throw a}}async function bl(r){let{aptosConfig:e,accountAddress:t}=r,o={owner_address:{_eq:M.fromHexInput(t).toString()},amount:{_gt:"0"}},a=await ke({aptosConfig:e,query:{query:Xf,variables:{where_condition:o}},originMethod:"getAccountTokensCount"});if(!a.current_token_ownerships_v2_aggregate.aggregate)throw Error("Failed to get the count of account tokens");return a.current_token_ownerships_v2_aggregate.aggregate.count}async function Al(r){var d,h;let{aptosConfig:e,accountAddress:t,options:n}=r,i={owner_address:{_eq:M.fromHexInput(t).toString()},amount:{_gt:0}};n!=null&&n.tokenStandard&&(i.token_standard={_eq:n==null?void 0:n.tokenStandard});let a={query:Wf,variables:{where_condition:i,offset:(d=n==null?void 0:n.pagination)==null?void 0:d.offset,limit:(h=n==null?void 0:n.pagination)==null?void 0:h.limit,order_by:n==null?void 0:n.orderBy}};return(await ke({aptosConfig:e,query:a,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function wl(r){var y,g;let{aptosConfig:e,accountAddress:t,collectionAddress:n,options:o}=r,i=M.fromHexInput(t).toString(),a=te.fromHexInput(n).toString(),u={owner_address:{_eq:i},current_token_data:{collection_id:{_eq:a}},amount:{_gt:0}};o!=null&&o.tokenStandard&&(u.token_standard={_eq:o==null?void 0:o.tokenStandard});let d={query:Yf,variables:{where_condition:u,offset:(y=o==null?void 0:o.pagination)==null?void 0:y.offset,limit:(g=o==null?void 0:o.pagination)==null?void 0:g.limit,order_by:o==null?void 0:o.orderBy}};return(await ke({aptosConfig:e,query:d,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function _l(r){var d,h;let{aptosConfig:e,accountAddress:t,options:n}=r,i={owner_address:{_eq:M.fromHexInput(t).toString()},amount:{_gt:0}};n!=null&&n.tokenStandard&&(i.current_collection={token_standard:{_eq:n==null?void 0:n.tokenStandard}});let a={query:Vf,variables:{where_condition:i,offset:(d=n==null?void 0:n.pagination)==null?void 0:d.offset,limit:(h=n==null?void 0:n.pagination)==null?void 0:h.limit,order_by:n==null?void 0:n.orderBy}};return(await ke({aptosConfig:e,query:a,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function Tl(r){let{aptosConfig:e,accountAddress:t}=r,n=M.fromHexInput(t).toString(),i=await ke({aptosConfig:e,query:{query:Zf,variables:{address:n}},originMethod:"getAccountTransactionsCount"});if(!i.account_transactions_aggregate.aggregate)throw Error("Failed to get the count of account transactions");return i.account_transactions_aggregate.aggregate.count}async function vl(r){var d,h;let{aptosConfig:e,accountAddress:t,options:n}=r,i={owner_address:{_eq:M.fromHexInput(t).toString()}},a={query:Kf,variables:{where_condition:i,offset:(d=n==null?void 0:n.pagination)==null?void 0:d.offset,limit:(h=n==null?void 0:n.pagination)==null?void 0:h.limit,order_by:n==null?void 0:n.orderBy}};return(await ke({aptosConfig:e,query:a,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function El(r){let{aptosConfig:e,accountAddress:t}=r,n=M.fromHexInput(t).toString(),i=await ke({aptosConfig:e,query:{query:jf,variables:{address:n}},originMethod:"getAccountCoinsCount"});if(!i.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return i.current_fungible_asset_balances_aggregate.aggregate.count}async function Sl(r){var d,h;let{aptosConfig:e,accountAddress:t,options:n}=r,i={owner_address:{_eq:M.fromHexInput(t).toString()}},a={query:Qf,variables:{where_condition:i,offset:(d=n==null?void 0:n.pagination)==null?void 0:d.offset,limit:(h=n==null?void 0:n.pagination)==null?void 0:h.limit,order_by:n==null?void 0:n.orderBy}};return(await ke({aptosConfig:e,query:a,originMethod:"getAccountOwnedObjects"})).current_objects}var Eo=class{constructor(e){this.config=e}async getAccountInfo(e){return Ms({aptosConfig:this.config,...e})}async getAccountModules(e){return hl({aptosConfig:this.config,...e})}async getAccountModule(e){return gl({aptosConfig:this.config,...e})}async getAccountTransactions(e){return yl({aptosConfig:this.config,...e})}async getAccountResources(e){return xl({aptosConfig:this.config,...e})}async getAccountResource(e){return Ea({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return ml({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return bl({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return Al({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return wl({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return _l({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return Tl({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return vl({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return El({aptosConfig:this.config,...e})}async getAccountOwnedObjects(e){return Sl({aptosConfig:this.config,...e})}};var So=class{constructor(e){var t,n;this.network=(t=e==null?void 0:e.network)!=null?t:uu,this.fullnode=e==null?void 0:e.fullnode,this.faucet=e==null?void 0:e.faucet,this.indexer=e==null?void 0:e.indexer,this.clientConfig=(n=e==null?void 0:e.clientConfig)!=null?n:{}}getRequestUrl(e){switch(e){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 Oi[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 zi[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 es[this.network];default:throw Error(`apiType ${e} is not supported`)}}isIndexerRequest(e){return es[this.network]===e}};var $e=class extends le{constructor(t){super();this.identifier=t}serialize(t){t.serializeStr(this.identifier)}static deserialize(t){let n=t.deserializeStr();return new $e(n)}};var Xe=class extends le{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return ln.load(e);case 1:return dn.load(e);case 2:return gn.load(e);case 3:return yn.load(e);case 4:return Dr.load(e);case 5:return Qn.load(e);case 6:return mn.load(e);case 7:return Wt.load(e);case 8:return pn.load(e);case 9:return hn.load(e);case 10:return xn.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${t}`)}}},ln=class extends Xe{serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new ln}},dn=class extends Xe{serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new dn}},pn=class extends Xe{serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new pn}},hn=class extends Xe{serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new hn}},gn=class extends Xe{serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new gn}},yn=class extends Xe{serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new yn}},xn=class extends Xe{serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new xn}},Dr=class extends Xe{serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new Dr}},Qn=class extends Xe{serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new Qn}},mn=class extends Xe{constructor(t){super();this.value=t}serialize(t){t.serializeU32AsUleb128(6),this.value.serialize(t)}static load(t){let n=Xe.deserialize(t);return new mn(n)}},Wt=class extends Xe{constructor(t){super();this.value=t}serialize(t){t.serializeU32AsUleb128(7),this.value.serialize(t)}static load(t){let n=Tt.deserialize(t);return new Wt(n)}isStringTypeTag(){return this.value.module_name.identifier==="string"&&this.value.name.identifier==="String"&&this.value.address.toString()===M.ONE.toString()}},Tt=class extends le{constructor(t,n,o,i){super();this.address=t,this.module_name=n,this.name=o,this.type_args=i}static fromString(t){let n=new Wn(t).parseTypeTag();return new Tt(n.value.address,n.value.module_name,n.value.name,n.value.type_args)}serialize(t){t.serialize(this.address),t.serialize(this.module_name),t.serialize(this.name),t.serializeVector(this.type_args)}static deserialize(t){let n=M.deserialize(t),o=$e.deserialize(t),i=$e.deserialize(t),a=t.deserializeVector(Xe);return new Tt(n,o,i,a)}},Cl=()=>new Tt(M.ONE,new $e("string"),new $e("String"),[]);function W0(r){return new Tt(M.ONE,new $e("option"),new $e("Option"),[r])}function Y0(r){return new Tt(M.ONE,new $e("object"),new $e("Object"),[r])}var Wn=class{constructor(e,t){this.typeTags=[];this.tokens=X0(e),this.typeTags=t||[]}consume(e){let t=this.tokens.shift();(!t||t[1]!==e)&&Nr("Invalid type tag.")}consumeWholeGeneric(){for(this.consume("<");this.tokens[0][1]!==">";)this.tokens[0][1]==="<"?this.consumeWholeGeneric():this.tokens.shift();this.consume(">")}parseCommaList(e,t){let n=[];for(this.tokens.length<=0&&Nr("Invalid type tag.");this.tokens[0][1]!==e&&(n.push(this.parseTypeTag()),!(this.tokens.length>0&&this.tokens[0][1]===e||(this.consume(","),this.tokens.length>0&&this.tokens[0][1]===e&&t)));)this.tokens.length<=0&&Nr("Invalid type tag.");return n}parseTypeTag(){this.tokens.length===0&&Nr("Invalid type tag.");let[e,t]=this.tokens.shift();if(t==="u8")return new dn;if(t==="u16")return new pn;if(t==="u32")return new hn;if(t==="u64")return new gn;if(t==="u128")return new yn;if(t==="u256")return new xn;if(t==="bool")return new ln;if(t==="address")return new Dr;if(t==="vector"){this.consume("<");let n=this.parseTypeTag();return this.consume(">"),new mn(n)}if(t==="string")return new Wt(Cl());if(e==="IDENT"&&(t.startsWith("0x")||t.startsWith("0X"))){let n=M.fromHexInput(t);this.consume("::");let[o,i]=this.tokens.shift();o!=="IDENT"&&Nr("Invalid type tag."),this.consume("::");let[a,u]=this.tokens.shift();if(a!=="IDENT"&&Nr("Invalid type tag."),M.ONE.toString()===n.toString()&&i==="object"&&u==="Object")return this.consumeWholeGeneric(),new Dr;let d=[];this.tokens.length>0&&this.tokens[0][1]==="<"&&(this.consume("<"),d=this.parseCommaList(">",!0),this.consume(">"));let h=new Tt(n,new $e(i),new $e(u),d);return new Wt(h)}if(e==="GENERIC"){this.typeTags.length===0&&Nr("Can't convert generic type since no typeTags were specified.");let n=parseInt(t.substring(1),10);return new Wn(this.typeTags[n]).parseTypeTag()}throw new Error("Invalid type tag.")}},Gs=class extends Error{constructor(e){super(e),this.name="TypeTagParserError"}};function X0(r){let e=0,t=[];for(;e<r.length;){let[n,o]=J0(r,e);n[0]!=="SPACE"&&t.push(n),e+=o}return t}function Nr(r){throw new Gs(r)}function Ul(r){return!!r.match(/\s/)}function Bl(r){return!!r.match(/[_A-Za-z0-9]/g)}function Z0(r){return!!r.match(/T\d+/g)}function J0(r,e){let t=r[e];if(t===":"){if(r.slice(e,e+2)==="::")return[["COLON","::"],2];Nr("Unrecognized token.")}else{if(t==="<")return[["LT","<"],1];if(t===">")return[["GT",">"],1];if(t===",")return[["COMMA",","],1];if(Ul(t)){let n="";for(let o=e;o<r.length;o+=1){let i=r[o];if(Ul(i))n=`${n}${i}`;else break}return[["SPACE",n],n.length]}else if(Bl(t)){let n="";for(let o=e;o<r.length;o+=1){let i=r[o];if(Bl(i))n=`${n}${i}`;else break}return Z0(n)?[["GENERIC",n],n.length]:[["IDENT",n],n.length]}}throw new Error("Unrecognized token.")}async function Sa(r){return new Promise(e=>{setTimeout(e,r)})}async function Il(r){let{aptosConfig:e,options:t}=r;return Yr({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:t==null?void 0:t.offset,limit:t==null?void 0:t.limit}})}async function Ls(r){let{aptosConfig:e}=r;return qs(async()=>{let{data:t}=await ht({aptosConfig:e,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${e.network}`,1e3*60*5)()}async function Rl(r){let{aptosConfig:e,ledgerVersion:t}=r,{data:n}=await ht({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return n}async function Fs(r){let{aptosConfig:e,transactionHash:t}=r,{data:n}=await ht({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return n}async function kl(r){let{aptosConfig:e,transactionHash:t}=r;try{return(await Fs({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(n){if((n==null?void 0:n.status)===404)return!0;throw n}}async function $s(r){var v,I,A;let{aptosConfig:e,transactionHash:t,options:n}=r,o=(v=n==null?void 0:n.timeoutSecs)!=null?v:ns,i=(I=n==null?void 0:n.checkSuccess)!=null?I:!0,a=(A=n==null?void 0:n.indexerVersionCheck)!=null?A:!0,u=!0,d=0,h,y,g=200,T=1.5;for(;u&&!(d>=o);){try{if(h=await Fs({aptosConfig:e,transactionHash:t}),u=h.type==="pending_transaction",!u)break}catch(E){if(!(E instanceof qt)||(y=E,E.status!==404&&E.status>=400&&E.status<500))throw E}await Sa(g),d+=g/1e3,g*=T}if(h===void 0)throw y||new Uo(`Fetching transaction ${t} failed and timed out after ${o} seconds`,h);if(h.type==="pending_transaction")throw new Uo(`Transaction ${t} timed out in pending state after ${o} seconds`,h);if(!i)return h;if(!h.success)throw new Ua(`Transaction ${t} failed with an error: ${h.vm_status}`,h);if(a)try{await eg({aptosConfig:e,ledgerVersion:Number(h.version)})}catch(E){throw new Uo(`Transaction ${t} 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 eg(r){let{aptosConfig:e,ledgerVersion:t}=r,n=3e3,o=new Date().getTime(),i=-1;for(;i<t;){if(new Date().getTime()-o>n)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(i=await Ds({aptosConfig:e}),i>=t)break;await Sa(200)}}var Uo=class extends Error{constructor(t,n){super(t);this.lastSubmittedTransaction=n}},Ua=class extends Error{constructor(t,n){super(t);this.transaction=n}};var vt=class extends le{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Yt.load(e);case 1:return Bo.load(e);case 2:return Xt.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${t}`)}}},Yt=class extends vt{constructor(t,n){super();this.public_key=t,this.signature=n}serialize(t){t.serializeU32AsUleb128(0),this.public_key.serialize(t),this.signature.serialize(t)}static load(t){let n=He.deserialize(t),o=We.deserialize(t);return new Yt(n,o)}},Bo=class extends vt{constructor(t,n){super();this.public_key=t,this.signature=n}serialize(t){t.serializeU32AsUleb128(1),this.public_key.serialize(t),this.signature.serialize(t)}static load(t){let n=gt.deserialize(t),o=dr.deserialize(t);return new Bo(n,o)}},Xt=class extends vt{constructor(t,n){super();this.public_key=t,this.signature=n}serialize(t){t.serializeU32AsUleb128(2),this.public_key.serialize(t),this.signature.serialize(t)}static load(t){let n=ut.deserialize(t),o=It.deserialize(t);return new Xt(n,o)}};var yr=class{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return qr.load(e);case 1:return Co.load(e);case 2:return Mr.load(e);case 3:return Gr.load(e);case 4:return Lr.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${t}`)}}},qr=class extends yr{constructor(t,n){super();this.public_key=t,this.signature=n}serialize(t){t.serializeU32AsUleb128(0),this.public_key.serialize(t),this.signature.serialize(t)}static load(t){let n=He.deserialize(t),o=We.deserialize(t);return new qr(n,o)}},Co=class extends yr{constructor(t,n){super();this.public_key=t,this.signature=n}serialize(t){t.serializeU32AsUleb128(1),this.public_key.serialize(t),this.signature.serialize(t)}static load(t){let n=gt.deserialize(t),o=dr.deserialize(t);return new Co(n,o)}},Mr=class extends yr{constructor(t,n,o){super();this.sender=t,this.secondary_signer_addresses=n,this.secondary_signers=o}serialize(t){t.serializeU32AsUleb128(2),this.sender.serialize(t),t.serializeVector(this.secondary_signer_addresses),t.serializeVector(this.secondary_signers)}static load(t){let n=vt.deserialize(t),o=t.deserializeVector(M),i=t.deserializeVector(vt);return new Mr(n,o,i)}},Gr=class extends yr{constructor(t,n,o,i){super();this.sender=t,this.secondary_signer_addresses=n,this.secondary_signers=o,this.fee_payer=i}serialize(t){t.serializeU32AsUleb128(3),this.sender.serialize(t),t.serializeVector(this.secondary_signer_addresses),t.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(t),this.fee_payer.authenticator.serialize(t)}static load(t){let n=vt.deserialize(t),o=t.deserializeVector(M),i=t.deserializeVector(vt),a=M.deserialize(t),u=vt.deserialize(t),d={address:a,authenticator:u};return new Gr(n,o,i,d)}},Lr=class extends yr{constructor(t,n){super();this.public_key=t,this.signature=n}serialize(t){t.serializeU32AsUleb128(4),this.public_key.serialize(t),this.signature.serialize(t)}static load(t){let n=ut.deserialize(t),o=It.deserialize(t);return new Lr(n,o)}};var Fr=class extends le{constructor(t){super();this.chainId=t}serialize(t){t.serializeU8(this.chainId)}static deserialize(t){let n=t.deserializeU8();return new Fr(n)}};var $r=class extends le{constructor(t,n){super();this.address=t,this.name=n}static fromStr(t){let n=t.split("::");if(n.length!==2)throw new Error("Invalid module id.");return new $r(M.fromString(n[0]),new $e(n[1]))}serialize(t){this.address.serialize(t),this.name.serialize(t)}static deserialize(t){let n=M.deserialize(t),o=$e.deserialize(t);return new $r(n,o)}};function tg(r){let e=r.deserializeUleb128AsU32();switch(e){case 0:return Bt.deserialize(r);case 1:return at.deserialize(r);case 2:return Lt.deserialize(r);case 3:return M.deserialize(r);case 4:return Ne.deserialize(r,Bt);case 5:return Ke.deserialize(r);case 6:return Mt.deserialize(r);case 7:return Gt.deserialize(r);case 8:return Ft.deserialize(r);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var bn=class extends le{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return An.load(e);case 2:return wn.load(e);case 3:return _n.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},An=class extends bn{constructor(t){super();this.script=t}serialize(t){t.serializeU32AsUleb128(0),this.script.serialize(t)}static load(t){let n=Tn.deserialize(t);return new An(n)}},wn=class extends bn{constructor(t){super();this.entryFunction=t}serialize(t){t.serializeU32AsUleb128(2),this.entryFunction.serialize(t)}static load(t){let n=Zt.deserialize(t);return new wn(n)}},_n=class extends bn{constructor(t){super();this.multiSig=t}serialize(t){t.serializeU32AsUleb128(3),this.multiSig.serialize(t)}static load(t){let n=vn.deserialize(t);return new _n(n)}},Zt=class{constructor(e,t,n,o){this.module_name=e,this.function_name=t,this.type_args=n,this.args=o}static build(e,t,n,o){return new Zt($r.fromStr(e),new $e(t),n,o)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForEntryFunction(e)})}static deserialize(e){let t=$r.deserialize(e),n=$e.deserialize(e),o=e.deserializeVector(Xe),i=e.deserializeUleb128AsU32(),a=new Array;for(let u=0;u<i;u+=1){let d=e.deserializeUleb128AsU32(),h=rn.deserialize(e,d);a.push(h)}return new Zt(t,n,o,a)}},Tn=class{constructor(e,t,n){this.bytecode=e,this.type_args=t,this.args=n}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForScriptFunction(e)})}static deserialize(e){let t=e.deserializeBytes(),n=e.deserializeVector(Xe),o=e.deserializeUleb128AsU32(),i=new Array;for(let a=0;a<o;a+=1){let u=tg(e);i.push(u)}return new Tn(t,n,i)}},vn=class{constructor(e,t){this.multisig_address=e,this.transaction_payload=t}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let t=M.deserialize(e),n=e.deserializeBool(),o;return n&&(o=En.deserialize(e)),new vn(t,o)}},En=class{constructor(e){this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new En(Zt.deserialize(e))}};var Et=class extends le{constructor(t,n,o,i,a,u,d){super();this.sender=t,this.sequence_number=n,this.payload=o,this.max_gas_amount=i,this.gas_unit_price=a,this.expiration_timestamp_secs=u,this.chain_id=d}serialize(t){this.sender.serialize(t),t.serializeU64(this.sequence_number),this.payload.serialize(t),t.serializeU64(this.max_gas_amount),t.serializeU64(this.gas_unit_price),t.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(t)}static deserialize(t){let n=M.deserialize(t),o=t.deserializeU64(),i=bn.deserialize(t),a=t.deserializeU64(),u=t.deserializeU64(),d=t.deserializeU64(),h=Fr.deserialize(t);return new Et(n,o,i,a,u,d,h)}},js=class extends le{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Jt.load(e);case 1:return er.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${t}`)}}},Jt=class extends js{constructor(t,n){super();this.raw_txn=t,this.secondary_signer_addresses=n}serialize(t){t.serializeU32AsUleb128(0),this.raw_txn.serialize(t),t.serializeVector(this.secondary_signer_addresses)}static load(t){let n=Et.deserialize(t),o=t.deserializeVector(M);return new Jt(n,o)}},er=class extends js{constructor(t,n,o){super();this.raw_txn=t,this.secondary_signer_addresses=n,this.fee_payer_address=o}serialize(t){t.serializeU32AsUleb128(1),this.raw_txn.serialize(t),t.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(t)}static load(t){let n=Et.deserialize(t),o=t.deserializeVector(M),i=M.deserialize(t);return new er(n,o,i)}};var kt=class extends le{constructor(t,n){super();this.raw_txn=t,this.authenticator=n}serialize(t){this.raw_txn.serialize(t),this.authenticator.serialize(t)}static deserialize(t){let n=Et.deserialize(t),o=yr.deserialize(t);return new kt(n,o)}};function Ol(r){var t,n,o;if("bytecode"in r)return new An(new Tn(te.fromHexInput(r.bytecode).toUint8Array(),(t=r.typeArguments)!=null?t:[],r.arguments));if("multisigAddress"in r){let i=r.function.split("::");return new _n(new vn(r.multisigAddress,new En(Zt.build(`${i[0]}::${i[1]}`,i[2],(n=r.typeArguments)!=null?n:[],r.arguments))))}let e=r.function.split("::");return new wn(Zt.build(`${e[0]}::${e[1]}`,e[2],(o=r.typeArguments)!=null?o:[],r.arguments))}async function rg(r){let{aptosConfig:e,sender:t,payload:n,options:o}=r,i=o!=null&&o.accountSequenceNumber?Promise.resolve({sequence_number:o.accountSequenceNumber}):Ms({aptosConfig:e,accountAddress:t}),a=rs[e.network]?Promise.resolve({chain_id:rs[e.network]}):Hs({aptosConfig:e}),u=o!=null&&o.gasUnitPrice?Promise.resolve({gas_estimate:o.gasUnitPrice}):Ls({aptosConfig:e}),[{sequence_number:d},{chain_id:h},{gas_estimate:y}]=await Promise.all([i,a,u]),{maxGasAmount:g,gasUnitPrice:T,expireTimestamp:v}={maxGasAmount:BigInt(fu),gasUnitPrice:BigInt(y),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+lu),...o};return new Et(M.fromHexInput(t),BigInt(d),n,BigInt(g),BigInt(T),BigInt(v),new Fr(h))}async function zl(r){let{aptosConfig:e,sender:t,payload:n,options:o,secondarySignerAddresses:i,feePayerAddress:a}=r,u=await rg({aptosConfig:e,sender:t,payload:n,options:o});if(a){let d=i?i.map(h=>M.fromHexInput(h)):[];return{rawTransaction:u.bcsToBytes(),secondarySignerAddresses:d,feePayerAddress:M.fromHexInput(a)}}if(i){let d=i.map(h=>M.fromHexInput(h));return{rawTransaction:u.bcsToBytes(),secondarySignerAddresses:d}}return{rawTransaction:u.bcsToBytes()}}function Pl(r){var h,y;let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:n,feePayerPublicKey:o}=r,i=new tn(t.rawTransaction),a=Et.deserialize(i),u=Ks(e);if(t.feePayerAddress){let g=new er(a,(h=t.secondarySignerAddresses)!=null?h:[],t.feePayerAddress),T=[];n&&(T=n.map(A=>Ks(A)));let v=Ks(o),I=new Gr(u,(y=t.secondarySignerAddresses)!=null?y:[],T,{address:t.feePayerAddress,authenticator:v});return new kt(g.raw_txn,I).bcsToBytes()}if(t.secondarySignerAddresses){let g=new Jt(a,t.secondarySignerAddresses),T=[];T=n.map(I=>Ks(I));let v=new Mr(u,t.secondarySignerAddresses,T);return new kt(g.raw_txn,v).bcsToBytes()}let d;if(u instanceof Yt)d=new qr(u.public_key,u.signature);else if(u instanceof Xt)d=new Lr(u.public_key,u.signature);else throw new Error("Invalid public key");return new kt(a,d).bcsToBytes()}function Ks(r){return r instanceof He?new Yt(new He(r.toUint8Array()),new We(new Uint8Array(64))):new Xt(new ut(r.toUint8Array()),new It(new Uint8Array(64)))}function Hl(r){let{signer:e,transaction:t}=r,n=Dl(t),o=og(n),i=e.sign(o);switch(e.signingScheme){case 0:return new Yt(new He(e.publicKey.toUint8Array()),new We(i.toUint8Array()));case 2:return new Xt(new ut(e.publicKey.toUint8Array()),new It(i.toUint8Array()));default:throw new Error(`Cannot sign transaction, signing scheme ${e.signingScheme} not supported`)}}function Nl(r){let{transaction:e,senderAuthenticator:t,secondarySignerAuthenticators:n}=r,o=Dl(e);if(n)return ng(o,t,n);let i=new tn(t.bcsToBytes()),a=vt.deserialize(i);if(a instanceof Yt){let u=new qr(a.public_key,a.signature);return new kt(o,u).bcsToBytes()}if(a instanceof Xt){let u=new Lr(a.public_key,a.signature);return new kt(o,u).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${a} is not a supported account authentication scheme`)}function Dl(r){var n;let e=new tn(r.rawTransaction),t=Et.deserialize(e);return r.feePayerAddress?new er(t,(n=r.secondarySignerAddresses)!=null?n:[],r.feePayerAddress):r.secondarySignerAddresses?new Jt(t,r.secondarySignerAddresses):t}function ng(r,e,t){if(r instanceof er){if(!t.feePayerAuthenticator)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let{feePayerAuthenticator:n,additionalSignersAuthenticators:o}=t,i=new Gr(e,r.secondary_signer_addresses,o!=null?o:[],{address:r.fee_payer_address,authenticator:n});return new kt(r.raw_txn,i).bcsToBytes()}if(r instanceof Jt){if(!t.additionalSignersAuthenticators)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let{additionalSignersAuthenticators:n}=t,o=new Mr(e,r.secondary_signer_addresses,n!=null?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 og(r){let e=en.create();if(r instanceof Et)e.update(pu);else if(r instanceof Jt)e.update(Pi);else if(r instanceof er)e.update(Pi);else throw new Error(`Unknown transaction type to sign on: ${r}`);let t=e.digest(),n=r.bcsToBytes(),o=new Uint8Array(t.length+n.length);return o.set(t),o.set(n,t.length),o}async function Sn(r){let{aptosConfig:e,sender:t,data:n,options:o,secondarySignerAddresses:i,feePayerAddress:a}=r,u=await Ol(n);return zl({aptosConfig:e,sender:t,payload:u,options:o,secondarySignerAddresses:i,feePayerAddress:a})}function Ba(r){return Hl({...r})}async function ql(r){var h,y,g,T,v,I;let{aptosConfig:e,transaction:t,signerPublicKey:n,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:a}=r,u=Pl({transaction:t,signerPublicKey:n,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:a}),{data:d}=await Xr({aptosConfig:e,body:u,path:"transactions/simulate",params:{estimate_gas_unit_price:(y=(h=r.options)==null?void 0:h.estimateGasUnitPrice)!=null?y:!1,estimate_max_gas_amount:(T=(g=r.options)==null?void 0:g.estimateMaxGasAmount)!=null?T:!1,estimate_prioritized_gas_unit_price:(I=(v=r.options)==null?void 0:v.estimatePrioritizedGasUnitPrice)!=null?I:!1},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return d}async function Ca(r){let{aptosConfig:e}=r,t=Nl({...r}),{data:n}=await Xr({aptosConfig:e,body:t,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return n}async function Ml(r){let{aptosConfig:e,sender:t,recipient:n,amount:o,coinType:i,options:a}=r,u=i!=null?i:du;return await Sn({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[new Wt(Tt.fromString(u))],arguments:[M.fromHexInput(n),new at(o)]},options:a})}var Io=class{constructor(e){this.config=e}async transferCoinTransaction(e){return Ml({aptosConfig:this.config,...e})}};async function Gl(r){let{aptosConfig:e,options:t,creator:n}=r;return await Sn({aptosConfig:e,sender:n.accountAddress.toString(),data:{function:"0x4::aptos_token::mint",arguments:[new lt(r.collection),new lt(r.description),new lt(r.name),new lt(r.uri),Ne.MoveString([]),Ne.MoveString([]),new Ne([])]},options:t})}async function Ll(r){let{aptosConfig:e,tokenAddress:t}=r,n={token_data_id:{_eq:te.fromHexInput(t).toString()}};return(await ke({aptosConfig:e,query:{query:cl,variables:{where_condition:n}},originMethod:"getTokenData"})).current_token_datas_v2[0]}async function Fl(r){let{aptosConfig:e,tokenAddress:t}=r,n={token_data_id:{_eq:te.fromHexInput(t).toString()}};return(await ke({aptosConfig:e,query:{query:Ta,variables:{where_condition:n}},originMethod:"getCurrentTokenOwnership"})).current_token_ownerships_v2[0]}async function $l(r){var u,d;let{aptosConfig:e,ownerAddress:t,options:n}=r,o={owner_address:{_eq:te.fromHexInput(t).toString()}},i={query:Ta,variables:{where_condition:o,offset:(u=n==null?void 0:n.pagination)==null?void 0:u.offset,limit:(d=n==null?void 0:n.pagination)==null?void 0:d.limit,order_by:n==null?void 0:n.orderBy}};return(await ke({aptosConfig:e,query:i,originMethod:"getOwnedTokens"})).current_token_ownerships_v2}async function jl(r){var u,d;let{aptosConfig:e,tokenAddress:t,options:n}=r,o={token_data_id:{_eq:te.fromHexInput(t).toString()}},i={query:al,variables:{where_condition:o,offset:(u=n==null?void 0:n.pagination)==null?void 0:u.offset,limit:(d=n==null?void 0:n.pagination)==null?void 0:d.limit,order_by:n==null?void 0:n.orderBy}};return(await ke({aptosConfig:e,query:i,originMethod:"getTokenActivity"})).token_activities_v2}async function Kl(r){var i,a,u,d,h,y,g,T,v,I,A,E;let{aptosConfig:e,options:t,creator:n}=r;return await Sn({aptosConfig:e,sender:n.accountAddress.toString(),data:{function:"0x4::aptos_token::create_collection",arguments:[new lt(r.description),new at((i=r.maxSupply)!=null?i:Zr),new lt(r.name),new lt(r.uri),new Ke((a=r.mutableDescription)!=null?a:!0),new Ke((u=r.mutableRoyalty)!=null?u:!0),new Ke((d=r.mutableURI)!=null?d:!0),new Ke((h=r.mutableTokenDescription)!=null?h:!0),new Ke((y=r.mutableTokenName)!=null?y:!0),new Ke((g=r.mutableTokenProperties)!=null?g:!0),new Ke((T=r.mutableTokenURI)!=null?T:!0),new Ke((v=r.tokensBurnableByCreator)!=null?v:!0),new Ke((I=r.tokensFreezableByCreator)!=null?I:!0),new at((A=r.royaltyNumerator)!=null?A:0),new at((E=r.royaltyDenominator)!=null?E:1)]},options:t})}async function Ia(r){var h;let{aptosConfig:e,creatorAddress:t,collectionName:n,options:o}=r,i=te.fromHexInput(t).toString(),a={collection_name:{_eq:n},creator_address:{_eq:i}};o!=null&&o.tokenStandard&&(a.token_standard={_eq:(h=o==null?void 0:o.tokenStandard)!=null?h:"v2"});let d=await ke({aptosConfig:e,query:{query:el,variables:{where_condition:a}},originMethod:"getCollectionData"});if(d.current_collections_v2.length===0)throw Error("Collection not found");return d.current_collections_v2[0]}async function Vl(r){return(await Ia(r)).collection_id}var Ro=class{constructor(e){this.config=e}async createCollectionTransaction(e){return Kl({aptosConfig:this.config,...e})}async getCollectionData(e){return Ia({aptosConfig:this.config,...e})}async getCollectionId(e){return Vl({aptosConfig:this.config,...e})}async mintTokenTransaction(e){return Gl({aptosConfig:this.config,...e})}async getTokenData(e){return Ll({aptosConfig:this.config,...e})}async getCurrentTokenOwnership(e){return Fl({aptosConfig:this.config,...e})}async getOwnedTokens(e){return $l({aptosConfig:this.config,...e})}async getTokenActivity(e){return jl({aptosConfig:this.config,...e})}};async function Ql(r){let{accountAddress:e,aptosConfig:t,creationNumber:n}=r,i={account_address:{_eq:M.fromHexInput(e).toString()},creation_number:{_eq:n}};return Vs({aptosConfig:t,options:{where:i}})}async function Wl(r){let{accountAddress:e,aptosConfig:t,eventType:n,options:o}=r,u={where:{account_address:{_eq:M.fromHexInput(e).toString()},type:{_eq:n}},pagination:o==null?void 0:o.pagination,orderBy:o==null?void 0:o.orderBy};return Vs({aptosConfig:t,options:u})}async function Vs(r){var i,a;let{aptosConfig:e,options:t}=r,n={query:nl,variables:{where_condition:t==null?void 0:t.where,offset:(i=t==null?void 0:t.pagination)==null?void 0:i.offset,limit:(a=t==null?void 0:t.pagination)==null?void 0:a.limit,order_by:t==null?void 0:t.orderBy}};return(await ke({aptosConfig:e,query:n,originMethod:"getEvents"})).events}var ko=class{constructor(e){this.config=e}async getAccountEventsByCreationNumber(e){return Ql({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return Wl({aptosConfig:this.config,...e})}async getEvents(e){return Vs({aptosConfig:this.config,...e})}};async function Yl(r){var u;let{aptosConfig:e,accountAddress:t,amount:n}=r,o=(u=r.timeoutSecs)!=null?u:ns,{data:i}=await Ni({aptosConfig:e,path:"fund",body:{address:M.fromHexInput(t).toString(),amount:n},originMethod:"fundAccount"}),a=i.txn_hashes[0];return await $s({aptosConfig:e,transactionHash:a,options:{timeoutSecs:o}}),a}var Oo=class{constructor(e){this.config=e}async fundAccount(e){return Yl({aptosConfig:this.config,...e})}};async function Xl(r){var i,a;let{aptosConfig:e,options:t}=r,n={query:sl,variables:{where_condition:t==null?void 0:t.where,limit:(i=t==null?void 0:t.pagination)==null?void 0:i.limit,offset:(a=t==null?void 0:t.pagination)==null?void 0:a.offset}};return(await ke({aptosConfig:e,query:n,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Zl(r){var i,a;let{aptosConfig:e,options:t}=r,n={query:ol,variables:{where_condition:t==null?void 0:t.where,limit:(i=t==null?void 0:t.pagination)==null?void 0:i.limit,offset:(a=t==null?void 0:t.pagination)==null?void 0:a.offset}};return(await ke({aptosConfig:e,query:n,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Jl(r){var i,a;let{aptosConfig:e,options:t}=r,n={query:tl,variables:{where_condition:t==null?void 0:t.where,limit:(i=t==null?void 0:t.pagination)==null?void 0:i.limit,offset:(a=t==null?void 0:t.pagination)==null?void 0:a.offset}};return(await ke({aptosConfig:e,query:n,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var zo=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return Xl({aptosConfig:this.config,...e})}async getFungibleAssetActivities(e){return Zl({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return Jl({aptosConfig:this.config,...e})}};var Po=class{constructor(e){this.config=e}async getLedgerInfo(){return Hs({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return ul({aptosConfig:this.config,...e})}async getBlockByHeight(e){return fl({aptosConfig:this.config,...e})}async getTableItem(e){return Ns({aptosConfig:this.config,...e})}async view(e){return ll({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return dl({aptosConfig:this.config,...e})}async queryIndexer(e){return ke({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return Ds({aptosConfig:this.config})}};async function ed(r){let{aptosConfig:e,poolAddress:t}=r,n=te.fromHexInput(t).toString(),i=await ke({aptosConfig:e,query:{query:_a,variables:{where_condition:{pool_address:{_eq:n}}}}});if(i.num_active_delegator_per_pool.length===0)throw Error("Delegator pool not found");return i.num_active_delegator_per_pool[0].num_active_delegator}async function td(r){let{aptosConfig:e,options:t}=r,n={query:_a,variables:{where_condition:{},order_by:t==null?void 0:t.orderBy}};return(await ke({aptosConfig:e,query:n})).num_active_delegator_per_pool}async function rd(r){let{aptosConfig:e,delegatorAddress:t,poolAddress:n}=r,o={query:rl,variables:{delegatorAddress:te.fromHexInput(t).toString(),poolAddress:te.fromHexInput(n).toString()}};return(await ke({aptosConfig:e,query:o})).delegated_staking_activities}var Ho=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return ed({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return td({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return rd({aptosConfig:this.config,...e})}};var No=class{constructor(e){this.config=e}async getTransactions(e){return Il({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return Rl({aptosConfig:this.config,...e})}async getTransactionByHash(e){return Fs({aptosConfig:this.config,...e})}async isPendingTransaction(e){return kl({aptosConfig:this.config,...e})}async waitForTransaction(e){return $s({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return Ls({aptosConfig:this.config})}};var Do=class{constructor(e){this.config=e}async generateTransaction(e){return Sn({aptosConfig:this.config,...e})}signTransaction(e){return Ba({...e})}async simulateTransaction(e){return ql({aptosConfig:this.config,...e})}async submitTransaction(e){return Ca({aptosConfig:this.config,...e})}async signAndSubmitTransaction(e){let{signer:t,transaction:n}=e,o=Ba({signer:t,transaction:n});return Ca({aptosConfig:this.config,transaction:n,senderAuthenticator:o})}};var St=class{constructor(e){this.config=new So(e),this.account=new Eo(this.config),this.coin=new Io(this.config),this.digitalAsset=new Ro(this.config),this.event=new ko(this.config),this.faucet=new Oo(this.config),this.fungibleAsset=new zo(this.config),this.general=new Po(this.config),this.staking=new Ho(this.config),this.transaction=new No(this.config),this.transactionSubmission=new Do(this.config)}};function tr(r,e,t){Object.getOwnPropertyNames(e.prototype).forEach(n=>{let o=Object.getOwnPropertyDescriptor(e.prototype,n);!o||(o.value=function(...i){return this[t][n](...i)},Object.defineProperty(r.prototype,n,o))})}tr(St,Eo,"account");tr(St,Io,"coin");tr(St,Ro,"digitalAsset");tr(St,ko,"event");tr(St,Oo,"faucet");tr(St,zo,"fungibleAsset");tr(St,Po,"general");tr(St,Ho,"staking");tr(St,No,"transaction");tr(St,Do,"transactionSubmission");return ld(sg);})();
|
|
406
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
407
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
408
|
+
/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
409
|
+
/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */
|
|
410
|
+
//# sourceMappingURL=index.global.js.map
|