@sentio/sdk-bundle 2.41.5 → 2.41.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/lib/aptos/builtin/0x1.js +1 -1
  2. package/lib/aptos/builtin/0x3.js +1 -1
  3. package/lib/aptos/builtin/index.js +1 -1
  4. package/lib/aptos/ext/index.js +1 -1
  5. package/lib/aptos/index.js +1 -1
  6. package/lib/btc/index.js +1 -1
  7. package/lib/{chunk-XYISSQEU.js → chunk-BX4KG2ZR.js} +2 -2
  8. package/lib/{chunk-LCUGDGMN.js → chunk-CCQHM2XD.js} +2 -2
  9. package/lib/{chunk-KY5AFKV5.js → chunk-DZVTAQNC.js} +2 -2
  10. package/lib/{chunk-MGIOFRXM.js → chunk-FFA6VNQP.js} +2 -2
  11. package/lib/{chunk-X7K74U6O.js → chunk-HITSEVEI.js} +2 -2
  12. package/lib/{chunk-3C4YSA42.js → chunk-HR3CXVT4.js} +2 -2
  13. package/lib/{chunk-4ACVSPIF.js → chunk-JDW2L37R.js} +2 -2
  14. package/lib/{chunk-RDBX2EIJ.js → chunk-L2WN35BE.js} +2 -2
  15. package/lib/{chunk-CJVPUD6U.js → chunk-LL6GKXEO.js} +2 -2
  16. package/lib/{chunk-BVDLKPY7.js → chunk-OU2BCESY.js} +2 -2
  17. package/lib/{chunk-PSYYSAEX.js → chunk-QC6KHXJD.js} +2 -2
  18. package/lib/{chunk-XZRRBRMQ.js → chunk-RSGRT2DV.js} +2 -2
  19. package/lib/{chunk-VEVTWG5S.js → chunk-RT6IFBHE.js} +2 -2
  20. package/lib/{chunk-CSVBDVD7.js → chunk-RWX5CV5W.js} +2 -2
  21. package/lib/{chunk-TW3ZXDJC.js → chunk-SBU7XQ42.js} +4 -4
  22. package/lib/{chunk-TW3ZXDJC.js.map → chunk-SBU7XQ42.js.map} +1 -1
  23. package/lib/{chunk-3KK6D6YO.js → chunk-WWVBF7HH.js} +2 -2
  24. package/lib/{chunk-VM5J6G66.js → chunk-YCDDNR5A.js} +2 -2
  25. package/lib/{chunk-4QS3NUUW.js → chunk-ZFXV2FHI.js} +2 -2
  26. package/lib/{chunk-JTQMVYTS.js → chunk-ZMRHWH7D.js} +11 -11
  27. package/lib/{chunk-JTQMVYTS.js.map → chunk-ZMRHWH7D.js.map} +1 -1
  28. package/lib/core/index.js +1 -1
  29. package/lib/eth/builtin/eacaggregatorproxy.js +1 -1
  30. package/lib/eth/builtin/erc1155.js +1 -1
  31. package/lib/eth/builtin/erc20.js +1 -1
  32. package/lib/eth/builtin/erc721.js +1 -1
  33. package/lib/eth/builtin/index.js +1 -1
  34. package/lib/eth/builtin/weth9.js +1 -1
  35. package/lib/eth/codegen/index.js +1 -1
  36. package/lib/eth/index.js +1 -1
  37. package/lib/fuel/codegen/index.js +1 -1
  38. package/lib/fuel/codegen/index.js.map +1 -1
  39. package/lib/fuel/index.js +1 -1
  40. package/lib/index.js +1 -1
  41. package/lib/move/index.js +1 -1
  42. package/lib/solana/builtin/index.js +1 -1
  43. package/lib/solana/index.js +1 -1
  44. package/lib/stark/index.js +1 -1
  45. package/lib/store/index.js +1 -1
  46. package/lib/sui/builtin/0x1.js +1 -1
  47. package/lib/sui/builtin/0x2.js +1 -1
  48. package/lib/sui/builtin/0x3.js +1 -1
  49. package/lib/sui/builtin/index.js +1 -1
  50. package/lib/sui/ext/index.js +1 -1
  51. package/lib/sui/index.js +1 -1
  52. package/lib/testing/index.js +1 -1
  53. package/lib/utils/index.js +1 -1
  54. package/package.json +2 -2
  55. /package/lib/{chunk-XYISSQEU.js.map → chunk-BX4KG2ZR.js.map} +0 -0
  56. /package/lib/{chunk-LCUGDGMN.js.map → chunk-CCQHM2XD.js.map} +0 -0
  57. /package/lib/{chunk-KY5AFKV5.js.map → chunk-DZVTAQNC.js.map} +0 -0
  58. /package/lib/{chunk-MGIOFRXM.js.map → chunk-FFA6VNQP.js.map} +0 -0
  59. /package/lib/{chunk-X7K74U6O.js.map → chunk-HITSEVEI.js.map} +0 -0
  60. /package/lib/{chunk-3C4YSA42.js.map → chunk-HR3CXVT4.js.map} +0 -0
  61. /package/lib/{chunk-4ACVSPIF.js.map → chunk-JDW2L37R.js.map} +0 -0
  62. /package/lib/{chunk-RDBX2EIJ.js.map → chunk-L2WN35BE.js.map} +0 -0
  63. /package/lib/{chunk-CJVPUD6U.js.map → chunk-LL6GKXEO.js.map} +0 -0
  64. /package/lib/{chunk-BVDLKPY7.js.map → chunk-OU2BCESY.js.map} +0 -0
  65. /package/lib/{chunk-PSYYSAEX.js.map → chunk-QC6KHXJD.js.map} +0 -0
  66. /package/lib/{chunk-XZRRBRMQ.js.map → chunk-RSGRT2DV.js.map} +0 -0
  67. /package/lib/{chunk-VEVTWG5S.js.map → chunk-RT6IFBHE.js.map} +0 -0
  68. /package/lib/{chunk-CSVBDVD7.js.map → chunk-RWX5CV5W.js.map} +0 -0
  69. /package/lib/{chunk-3KK6D6YO.js.map → chunk-WWVBF7HH.js.map} +0 -0
  70. /package/lib/{chunk-VM5J6G66.js.map → chunk-YCDDNR5A.js.map} +0 -0
  71. /package/lib/{chunk-4QS3NUUW.js.map → chunk-ZFXV2FHI.js.map} +0 -0
@@ -1,3 +1,3 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import{a as p,b as g}from"../../chunk-TMGVB5QH.js";import{Ta as C,Ua as a,Va as c,Wa as u,Xa as h,Ya as w,Za as d,_a as v}from"../../chunk-BVDLKPY7.js";import{c as s}from"../../chunk-WFUK2UMU.js";import"../../chunk-3FX7DHPT.js";import"../../chunk-SSMP6EWG.js";import"../../chunk-F2HFFA4Z.js";import"../../chunk-NHARQGR7.js";import"../../chunk-PE6MZT4O.js";import"../../chunk-KY5AFKV5.js";import"../../chunk-PNA6LFOX.js";import"../../chunk-4ACVSPIF.js";import"../../chunk-KBIQLRRR.js";import"../../chunk-LBLFXPCY.js";import"../../chunk-LCUGDGMN.js";import"../../chunk-3KK6D6YO.js";import"../../chunk-4QS3NUUW.js";import"../../chunk-2GOCSOX5.js";import"../../chunk-7HVQTJAO.js";import"../../chunk-JTQMVYTS.js";import"../../chunk-TW3ZXDJC.js";import"../../chunk-PLLN42GP.js";import"../../chunk-NMFPLO65.js";import"../../chunk-K6FJLTBX.js";import"../../chunk-GQE2JYJW.js";import"../../chunk-DJQ5RDDN.js";import"../../chunk-FC546GTB.js";import"../../chunk-LLHU72AA.js";var i=class{calculateValueInUsd(e,r,o,t=s.MAIN_NET){return d(e,r,o,t)}getCoinInfo(e){return u(e)}whiteListed(e){return c(e)}whitelistCoins(){return a()}},m=new i,f=class extends p{coinList=new i};async function I(n,e,r,o,t){return g(m,n,e,r,o,t)}function l(n,e,r){if(!e.changes)throw Error("No resource change found, did you forget set fetchOption to { resourceChanges: true } ");for(let o of e.changes){if(o.type!=="write_resource")continue;let t=o;if(t.address===n.guid.account_address&&t.data.type===`0x1::coin::CoinStore<${r}>`)return{value:BigInt(t.data.data.coin.value)}}}export{m as AptosCoinList,f as AptosDex,i as CoinList,d as calculateValueInUsd,v as delay,l as findNewCoinBalances,u as getCoinInfo,h as getCoinInfoWithFallback,I as getPairValue,w as getPrice,C as initCoinList,c as whiteListed,a as whitelistCoins};
2
+ import{a as p,b as g}from"../../chunk-TMGVB5QH.js";import{Ta as C,Ua as a,Va as c,Wa as u,Xa as h,Ya as w,Za as d,_a as v}from"../../chunk-OU2BCESY.js";import{c as s}from"../../chunk-WFUK2UMU.js";import"../../chunk-3FX7DHPT.js";import"../../chunk-SSMP6EWG.js";import"../../chunk-F2HFFA4Z.js";import"../../chunk-NHARQGR7.js";import"../../chunk-PE6MZT4O.js";import"../../chunk-DZVTAQNC.js";import"../../chunk-PNA6LFOX.js";import"../../chunk-JDW2L37R.js";import"../../chunk-KBIQLRRR.js";import"../../chunk-LBLFXPCY.js";import"../../chunk-CCQHM2XD.js";import"../../chunk-WWVBF7HH.js";import"../../chunk-ZFXV2FHI.js";import"../../chunk-2GOCSOX5.js";import"../../chunk-7HVQTJAO.js";import"../../chunk-ZMRHWH7D.js";import"../../chunk-SBU7XQ42.js";import"../../chunk-PLLN42GP.js";import"../../chunk-NMFPLO65.js";import"../../chunk-K6FJLTBX.js";import"../../chunk-GQE2JYJW.js";import"../../chunk-DJQ5RDDN.js";import"../../chunk-FC546GTB.js";import"../../chunk-LLHU72AA.js";var i=class{calculateValueInUsd(e,r,o,t=s.MAIN_NET){return d(e,r,o,t)}getCoinInfo(e){return u(e)}whiteListed(e){return c(e)}whitelistCoins(){return a()}},m=new i,f=class extends p{coinList=new i};async function I(n,e,r,o,t){return g(m,n,e,r,o,t)}function l(n,e,r){if(!e.changes)throw Error("No resource change found, did you forget set fetchOption to { resourceChanges: true } ");for(let o of e.changes){if(o.type!=="write_resource")continue;let t=o;if(t.address===n.guid.account_address&&t.data.type===`0x1::coin::CoinStore<${r}>`)return{value:BigInt(t.data.data.coin.value)}}}export{m as AptosCoinList,f as AptosDex,i as CoinList,d as calculateValueInUsd,v as delay,l as findNewCoinBalances,u as getCoinInfo,h as getCoinInfoWithFallback,I as getPairValue,w as getPrice,C as initCoinList,c as whiteListed,a as whitelistCoins};
3
3
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,3 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import{$a as n,a as d,b as e,c as f,d as g,e as h,f as i,g as j,h as k,i as l,j as m}from"../chunk-BVDLKPY7.js";import{c as a,d as b}from"../chunk-WFUK2UMU.js";import"../chunk-3FX7DHPT.js";import"../chunk-SSMP6EWG.js";import"../chunk-F2HFFA4Z.js";import"../chunk-NHARQGR7.js";import"../chunk-PE6MZT4O.js";import"../chunk-KY5AFKV5.js";import"../chunk-PNA6LFOX.js";import"../chunk-4ACVSPIF.js";import{q as c}from"../chunk-KBIQLRRR.js";import"../chunk-LBLFXPCY.js";import"../chunk-LCUGDGMN.js";import"../chunk-3KK6D6YO.js";import"../chunk-4QS3NUUW.js";import"../chunk-2GOCSOX5.js";import"../chunk-7HVQTJAO.js";import"../chunk-JTQMVYTS.js";import"../chunk-TW3ZXDJC.js";import"../chunk-PLLN42GP.js";import"../chunk-NMFPLO65.js";import"../chunk-K6FJLTBX.js";import"../chunk-GQE2JYJW.js";import"../chunk-DJQ5RDDN.js";import"../chunk-FC546GTB.js";import"../chunk-LLHU72AA.js";export{h as AptosBaseProcessor,b as AptosBindOptions,f as AptosContext,i as AptosModulesProcessor,a as AptosNetwork,n as AptosPlugin,k as AptosResourceProcessorTemplate,g as AptosResourcesContext,j as AptosResourcesProcessor,c as BUILTIN_TYPES,d as MoveCoder,e as defaultMoveCoder,m as getAptosClient,l as getChainQueryClient};
2
+ import{$a as n,a as d,b as e,c as f,d as g,e as h,f as i,g as j,h as k,i as l,j as m}from"../chunk-OU2BCESY.js";import{c as a,d as b}from"../chunk-WFUK2UMU.js";import"../chunk-3FX7DHPT.js";import"../chunk-SSMP6EWG.js";import"../chunk-F2HFFA4Z.js";import"../chunk-NHARQGR7.js";import"../chunk-PE6MZT4O.js";import"../chunk-DZVTAQNC.js";import"../chunk-PNA6LFOX.js";import"../chunk-JDW2L37R.js";import{q as c}from"../chunk-KBIQLRRR.js";import"../chunk-LBLFXPCY.js";import"../chunk-CCQHM2XD.js";import"../chunk-WWVBF7HH.js";import"../chunk-ZFXV2FHI.js";import"../chunk-2GOCSOX5.js";import"../chunk-7HVQTJAO.js";import"../chunk-ZMRHWH7D.js";import"../chunk-SBU7XQ42.js";import"../chunk-PLLN42GP.js";import"../chunk-NMFPLO65.js";import"../chunk-K6FJLTBX.js";import"../chunk-GQE2JYJW.js";import"../chunk-DJQ5RDDN.js";import"../chunk-FC546GTB.js";import"../chunk-LLHU72AA.js";export{h as AptosBaseProcessor,b as AptosBindOptions,f as AptosContext,i as AptosModulesProcessor,a as AptosNetwork,n as AptosPlugin,k as AptosResourceProcessorTemplate,g as AptosResourcesContext,j as AptosResourcesProcessor,c as BUILTIN_TYPES,d as MoveCoder,e as defaultMoveCoder,m as getAptosClient,l as getChainQueryClient};
3
3
  //# sourceMappingURL=index.js.map
package/lib/btc/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import{a as r,b as e,c as f,d as o}from"../chunk-VEVTWG5S.js";import"../chunk-LBLFXPCY.js";import"../chunk-JTQMVYTS.js";import"../chunk-TW3ZXDJC.js";import"../chunk-PLLN42GP.js";import"../chunk-NMFPLO65.js";import"../chunk-K6FJLTBX.js";import"../chunk-GQE2JYJW.js";import"../chunk-DJQ5RDDN.js";import"../chunk-FC546GTB.js";import"../chunk-LLHU72AA.js";export{r as BTCContext,o as BTCPlugin,f as BTCProcessor,e as BTCProcessorState};
2
+ import{a as r,b as e,c as f,d as o}from"../chunk-RT6IFBHE.js";import"../chunk-LBLFXPCY.js";import"../chunk-ZMRHWH7D.js";import"../chunk-SBU7XQ42.js";import"../chunk-PLLN42GP.js";import"../chunk-NMFPLO65.js";import"../chunk-K6FJLTBX.js";import"../chunk-GQE2JYJW.js";import"../chunk-DJQ5RDDN.js";import"../chunk-FC546GTB.js";import"../chunk-LLHU72AA.js";export{r as BTCContext,o as BTCPlugin,f as BTCProcessor,e as BTCProcessorState};
3
3
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import{b as ed}from"./chunk-DEW7KMCM.js";import{a as Qf,b as r0}from"./chunk-SSMP6EWG.js";import{a as Zf}from"./chunk-7HVQTJAO.js";import{$b as Kt,D as _c,Hc as t0,Sb as $f,Tb as fi,Ub as xc,Vb as wr,W as Mf,Wb as vc,Xb as qf,Yb as Wf,Zb as Zg,_b as di,ac as Ht,bc as Hf,bd as Jf,cc as jf,dc as Vf,ec as Gf,fc as Xf,gc as Qg,hc as hi,ic as e0,pc as Yf}from"./chunk-JTQMVYTS.js";import{e as dn}from"./chunk-TW3ZXDJC.js";import{a as Kf,c as Jg}from"./chunk-NMFPLO65.js";import{c as Sc,d as Xg,h as kc,i as Yg}from"./chunk-GQE2JYJW.js";import{x as zf,y as Gg}from"./chunk-DJQ5RDDN.js";import{a as ae,b as We,c as oe,d as Ps,e as re,f as Ts,g as Df}from"./chunk-LLHU72AA.js";function l0(s){let e=Xf(s);return qf(s,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function id(s){let e=l0(s),{Fp:t,n:r,prehash:o,hash:n,randomBytes:i,nByteLength:c,h:l}=e,p=yi<<BigInt(c*8)-kt,f=t.create,b=e.uvRatio||((X,U)=>{try{return{isValid:!0,value:t.sqrt(X*t.inv(U))}}catch{return{isValid:!1,value:jt}}}),_=e.adjustScalarBytes||(X=>X),g=e.domain||((X,U,Z)=>{if(U.length||Z)throw new Error("Contexts/pre-hash are not supported");return X}),k=X=>typeof X=="bigint"&&jt<X,S=(X,U)=>k(X)&&k(U)&&X<U,A=X=>X===jt||S(X,p);function C(X,U){if(S(X,U))return X;throw new Error(`Expected valid scalar < ${U}, got ${typeof X} ${X}`)}function P(X){return X===jt?X:C(X,r)}let D=new Map;function V(X){if(!(X instanceof q))throw new Error("ExtendedPoint expected")}class q{constructor(U,Z,se,ye){if(this.ex=U,this.ey=Z,this.ez=se,this.et=ye,!A(U))throw new Error("x required");if(!A(Z))throw new Error("y required");if(!A(se))throw new Error("z required");if(!A(ye))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(U){if(U instanceof q)throw new Error("extended point not allowed");let{x:Z,y:se}=U||{};if(!A(Z)||!A(se))throw new Error("invalid affine point");return new q(Z,se,kt,f(Z*se))}static normalizeZ(U){let Z=t.invertBatch(U.map(se=>se.ez));return U.map((se,ye)=>se.toAffine(Z[ye])).map(q.fromAffine)}_setWindowSize(U){this._WINDOW_SIZE=U,D.delete(this)}assertValidity(){let{a:U,d:Z}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:se,ey:ye,ez:ge,et:ve}=this,Ce=f(se*se),Ee=f(ye*ye),Oe=f(ge*ge),Ve=f(Oe*Oe),nt=f(Ce*U),Lt=f(Oe*f(nt+Ee)),st=f(Ve+f(Z*f(Ce*Ee)));if(Lt!==st)throw new Error("bad point: equation left != right (1)");let er=f(se*ye),Wt=f(ge*ve);if(er!==Wt)throw new Error("bad point: equation left != right (2)")}equals(U){V(U);let{ex:Z,ey:se,ez:ye}=this,{ex:ge,ey:ve,ez:Ce}=U,Ee=f(Z*Ce),Oe=f(ge*ye),Ve=f(se*Ce),nt=f(ve*ye);return Ee===Oe&&Ve===nt}is0(){return this.equals(q.ZERO)}negate(){return new q(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){let{a:U}=e,{ex:Z,ey:se,ez:ye}=this,ge=f(Z*Z),ve=f(se*se),Ce=f(yi*f(ye*ye)),Ee=f(U*ge),Oe=Z+se,Ve=f(f(Oe*Oe)-ge-ve),nt=Ee+ve,Lt=nt-Ce,st=Ee-ve,er=f(Ve*Lt),Wt=f(nt*st),Mn=f(Ve*st),zn=f(Lt*nt);return new q(er,Wt,zn,Mn)}add(U){V(U);let{a:Z,d:se}=e,{ex:ye,ey:ge,ez:ve,et:Ce}=this,{ex:Ee,ey:Oe,ez:Ve,et:nt}=U;if(Z===BigInt(-1)){let ei=f((ge-ye)*(Oe+Ee)),vs=f((ge+ye)*(Oe-Ee)),Es=f(vs-ei);if(Es===jt)return this.double();let ti=f(ve*yi*nt),As=f(Ce*yi*Ve),ri=As+ti,ni=vs+ei,si=As-ti,uc=f(ri*Es),lc=f(ni*si),fc=f(ri*si),oi=f(Es*ni);return new q(uc,lc,oi,fc)}let Lt=f(ye*Ee),st=f(ge*Oe),er=f(Ce*se*nt),Wt=f(ve*Ve),Mn=f((ye+ge)*(Ee+Oe)-Lt-st),zn=Wt-er,$n=Wt+er,qn=f(st-Z*Lt),Zo=f(Mn*zn),ln=f($n*qn),fn=f(Mn*qn),Qo=f(zn*$n);return new q(Zo,ln,Qo,fn)}subtract(U){return this.add(U.negate())}wNAF(U){return Re.wNAFCached(this,D,U,q.normalizeZ)}multiply(U){let{p:Z,f:se}=this.wNAF(C(U,r));return q.normalizeZ([Z,se])[0]}multiplyUnsafe(U){let Z=P(U);return Z===jt?de:this.equals(de)||Z===kt?this:this.equals(fe)?this.wNAF(Z).p:Re.unsafeLadder(this,Z)}isSmallOrder(){return this.multiplyUnsafe(l).is0()}isTorsionFree(){return Re.unsafeLadder(this,r).is0()}toAffine(U){let{ex:Z,ey:se,ez:ye}=this,ge=this.is0();U==null&&(U=ge?c0:t.inv(ye));let ve=f(Z*U),Ce=f(se*U),Ee=f(ye*U);if(ge)return{x:jt,y:kt};if(Ee!==kt)throw new Error("invZ was invalid");return{x:ve,y:Ce}}clearCofactor(){let{h:U}=e;return U===kt?this:this.multiplyUnsafe(U)}static fromHex(U,Z=!1){let{d:se,a:ye}=e,ge=t.BYTES;U=wr("pointHex",U,ge);let ve=U.slice(),Ce=U[ge-1];ve[ge-1]=Ce&-129;let Ee=fi(ve);Ee===jt||(Z?C(Ee,p):C(Ee,t.ORDER));let Oe=f(Ee*Ee),Ve=f(Oe-kt),nt=f(se*Oe-ye),{isValid:Lt,value:st}=b(Ve,nt);if(!Lt)throw new Error("Point.fromHex: invalid y coordinate");let er=(st&kt)===kt,Wt=(Ce&128)!==0;if(!Z&&st===jt&&Wt)throw new Error("Point.fromHex: x=0 and x_0=1");return Wt!==er&&(st=f(-st)),q.fromAffine({x:st,y:Ee})}static fromPrivateKey(U){return rt(U).point}toRawBytes(){let{x:U,y:Z}=this.toAffine(),se=xc(Z,t.BYTES);return se[se.length-1]|=U&kt?128:0,se}toHex(){return $f(this.toRawBytes())}}q.BASE=new q(e.Gx,e.Gy,kt,f(e.Gx*e.Gy)),q.ZERO=new q(jt,kt,kt,jt);let{BASE:fe,ZERO:de}=q,Re=Gf(q,c*8);function ut(X){return Kt(X,r)}function $e(X){return ut(fi(X))}function rt(X){let U=c;X=wr("private key",X,U);let Z=wr("hashed private key",n(X),2*U),se=_(Z.slice(0,U)),ye=Z.slice(U,2*U),ge=$e(se),ve=fe.multiply(ge),Ce=ve.toRawBytes();return{head:se,prefix:ye,scalar:ge,point:ve,pointBytes:Ce}}function Qt(X){return rt(X).pointBytes}function ks(X=new Uint8Array,...U){let Z=vc(...U);return $e(n(g(Z,wr("context",X),!!o)))}function Jo(X,U,Z={}){X=wr("message",X),o&&(X=o(X));let{prefix:se,scalar:ye,pointBytes:ge}=rt(U),ve=ks(Z.context,se,X),Ce=fe.multiply(ve).toRawBytes(),Ee=ks(Z.context,Ce,ge,X),Oe=ut(ve+Ee*ye);P(Oe);let Ve=vc(Ce,xc(Oe,t.BYTES));return wr("result",Ve,c*2)}let Dr=u0;function xs(X,U,Z,se=Dr){let{context:ye,zip215:ge}=se,ve=t.BYTES;X=wr("signature",X,2*ve),U=wr("message",U),o&&(U=o(U));let Ce=fi(X.slice(ve,2*ve)),Ee,Oe,Ve;try{Ee=q.fromHex(Z,ge),Oe=q.fromHex(X.slice(0,ve),ge),Ve=fe.multiplyUnsafe(Ce)}catch{return!1}if(!ge&&Ee.isSmallOrder())return!1;let nt=ks(ye,Oe.toRawBytes(),Ee.toRawBytes(),U);return Oe.add(Ee.multiplyUnsafe(nt)).subtract(Ve).clearCofactor().equals(q.ZERO)}return fe._setWindowSize(8),{CURVE:e,getPublicKey:Qt,sign:Jo,verify:xs,ExtendedPoint:q,utils:{getExtendedPublicKey:rt,randomPrivateKey:()=>i(t.BYTES),precompute(X=8,U=q.BASE){return U._setWindowSize(X),U.multiply(BigInt(3)),U}}}}var jt,kt,yi,c0,u0,ad=We(()=>{Qg();Vf();Wf();Wf();jt=BigInt(0),kt=BigInt(1),yi=BigInt(2),c0=BigInt(8),u0={zip215:!0}});function p0(s){let e=BigInt(10),t=BigInt(20),r=BigInt(40),o=BigInt(80),n=Ic,c=s*s%n*s%n,l=Ht(c,ud,n)*c%n,p=Ht(l,f0,n)*s%n,f=Ht(p,d0,n)*p%n,b=Ht(f,e,n)*f%n,_=Ht(b,t,n)*b%n,g=Ht(_,r,n)*_%n,k=Ht(g,o,n)*g%n,S=Ht(k,o,n)*g%n,A=Ht(S,e,n)*f%n;return{pow_p_5_8:Ht(A,ud,n)*s%n,b2:c}}function y0(s){return s[0]&=248,s[31]&=127,s[31]|=64,s}function m0(s,e){let t=Ic,r=Kt(e*e*e,t),o=Kt(r*r*e,t),n=p0(s*o).pow_p_5_8,i=Kt(s*r*n,t),c=Kt(e*i*i,t),l=i,p=Kt(i*cd,t),f=c===s,b=c===Kt(-s,t),_=c===Kt(-s*cd,t);return f&&(i=l),(b||_)&&(i=p),Hf(i,t)&&(i=Kt(-i,t)),{isValid:f||b,value:i}}var Ic,cd,mx,f0,ud,gx,d0,h0,g0,b0,pn,ld=We(()=>{r0();Gg();ad();Vf();Ic=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),cd=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),mx=BigInt(0),f0=BigInt(1),ud=BigInt(2),gx=BigInt(3),d0=BigInt(5),h0=BigInt(8);g0=(()=>jf(Ic,void 0,!0))(),b0=(()=>({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:g0,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:h0,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Qf,randomBytes:zf,adjustScalarBytes:y0,uvRatio:m0}))(),pn=(()=>id(b0))()});var hd=oe((Bc,dd)=>{var mi=ae("buffer"),tr=mi.Buffer;function fd(s,e){for(var t in s)e[t]=s[t]}tr.from&&tr.alloc&&tr.allocUnsafe&&tr.allocUnsafeSlow?dd.exports=mi:(fd(mi,Bc),Bc.Buffer=yn);function yn(s,e,t){return tr(s,e,t)}yn.prototype=Object.create(tr.prototype);fd(tr,yn);yn.from=function(s,e,t){if(typeof s=="number")throw new TypeError("Argument must not be a number");return tr(s,e,t)};yn.alloc=function(s,e,t){if(typeof s!="number")throw new TypeError("Argument must be a number");var r=tr(s);return e!==void 0?typeof t=="string"?r.fill(e,t):r.fill(e):r.fill(0),r};yn.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return tr(s)};yn.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return mi.SlowBuffer(s)}});var yd=oe((wx,pd)=>{"use strict";var gi=hd().Buffer;function w0(s){if(s.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),t=0;t<e.length;t++)e[t]=255;for(var r=0;r<s.length;r++){var o=s.charAt(r),n=o.charCodeAt(0);if(e[n]!==255)throw new TypeError(o+" is ambiguous");e[n]=r}var i=s.length,c=s.charAt(0),l=Math.log(i)/Math.log(256),p=Math.log(256)/Math.log(i);function f(g){if((Array.isArray(g)||g instanceof Uint8Array)&&(g=gi.from(g)),!gi.isBuffer(g))throw new TypeError("Expected Buffer");if(g.length===0)return"";for(var k=0,S=0,A=0,C=g.length;A!==C&&g[A]===0;)A++,k++;for(var P=(C-A)*p+1>>>0,D=new Uint8Array(P);A!==C;){for(var V=g[A],q=0,fe=P-1;(V!==0||q<S)&&fe!==-1;fe--,q++)V+=256*D[fe]>>>0,D[fe]=V%i>>>0,V=V/i>>>0;if(V!==0)throw new Error("Non-zero carry");S=q,A++}for(var de=P-S;de!==P&&D[de]===0;)de++;for(var Re=c.repeat(k);de<P;++de)Re+=s.charAt(D[de]);return Re}function b(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return gi.alloc(0);for(var k=0,S=0,A=0;g[k]===c;)S++,k++;for(var C=(g.length-k)*l+1>>>0,P=new Uint8Array(C);g[k];){var D=e[g.charCodeAt(k)];if(D===255)return;for(var V=0,q=C-1;(D!==0||V<A)&&q!==-1;q--,V++)D+=i*P[q]>>>0,P[q]=D%256>>>0,D=D/256>>>0;if(D!==0)throw new Error("Non-zero carry");A=V,k++}for(var fe=C-A;fe!==C&&P[fe]===0;)fe++;var de=gi.allocUnsafe(S+(C-fe));de.fill(0,0,S);for(var Re=S;fe!==C;)de[Re++]=P[fe++];return de}function _(g){var k=b(g);if(k)return k;throw new Error("Non-base"+i+" character")}return{encode:f,decodeUnsafe:b,decode:_}}pd.exports=w0});var Hn=oe((_x,md)=>{var _0=yd(),S0="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";md.exports=_0(S0)});var gd=oe(Cc=>{"use strict";function _r(s,e,t){return e<=s&&s<=t}function ki(s){if(s===void 0)return{};if(s===Object(s))return s;throw TypeError("Could not convert argument to dictionary")}function k0(s){for(var e=String(s),t=e.length,r=0,o=[];r<t;){var n=e.charCodeAt(r);if(n<55296||n>57343)o.push(n);else if(56320<=n&&n<=57343)o.push(65533);else if(55296<=n&&n<=56319)if(r===t-1)o.push(65533);else{var i=s.charCodeAt(r+1);if(56320<=i&&i<=57343){var c=n&1023,l=i&1023;o.push(65536+(c<<10)+l),r+=1}else o.push(65533)}r+=1}return o}function x0(s){for(var e="",t=0;t<s.length;++t){var r=s[t];r<=65535?e+=String.fromCharCode(r):(r-=65536,e+=String.fromCharCode((r>>10)+55296,(r&1023)+56320))}return e}var bi=-1;function Rc(s){this.tokens=[].slice.call(s)}Rc.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():bi},prepend:function(s){if(Array.isArray(s))for(var e=s;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(s)},push:function(s){if(Array.isArray(s))for(var e=s;e.length;)this.tokens.push(e.shift());else this.tokens.push(s)}};var jn=-1;function Lc(s,e){if(s)throw TypeError("Decoder error");return e||65533}var wi="utf-8";function _i(s,e){if(!(this instanceof _i))return new _i(s,e);if(s=s!==void 0?String(s).toLowerCase():wi,s!==wi)throw new Error("Encoding not supported. Only utf-8 is supported");e=ki(e),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!e.fatal,this._ignoreBOM=!!e.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}_i.prototype={decode:function(e,t){var r;typeof e=="object"&&e instanceof ArrayBuffer?r=new Uint8Array(e):typeof e=="object"&&"buffer"in e&&e.buffer instanceof ArrayBuffer?r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):r=new Uint8Array(0),t=ki(t),this._streaming||(this._decoder=new v0({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!t.stream;for(var o=new Rc(r),n=[],i;!o.endOfStream()&&(i=this._decoder.handler(o,o.read()),i!==jn);)i!==null&&(Array.isArray(i)?n.push.apply(n,i):n.push(i));if(!this._streaming){do{if(i=this._decoder.handler(o,o.read()),i===jn)break;i!==null&&(Array.isArray(i)?n.push.apply(n,i):n.push(i))}while(!o.endOfStream());this._decoder=null}return n.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(n[0]===65279?(this._BOMseen=!0,n.shift()):this._BOMseen=!0),x0(n)}};function Si(s,e){if(!(this instanceof Si))return new Si(s,e);if(s=s!==void 0?String(s).toLowerCase():wi,s!==wi)throw new Error("Encoding not supported. Only utf-8 is supported");e=ki(e),this._streaming=!1,this._encoder=null,this._options={fatal:!!e.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}Si.prototype={encode:function(e,t){e=e?String(e):"",t=ki(t),this._streaming||(this._encoder=new E0(this._options)),this._streaming=!!t.stream;for(var r=[],o=new Rc(k0(e)),n;!o.endOfStream()&&(n=this._encoder.handler(o,o.read()),n!==jn);)Array.isArray(n)?r.push.apply(r,n):r.push(n);if(!this._streaming){for(;n=this._encoder.handler(o,o.read()),n!==jn;)Array.isArray(n)?r.push.apply(r,n):r.push(n);this._encoder=null}return new Uint8Array(r)}};function v0(s){var e=s.fatal,t=0,r=0,o=0,n=128,i=191;this.handler=function(c,l){if(l===bi&&o!==0)return o=0,Lc(e);if(l===bi)return jn;if(o===0){if(_r(l,0,127))return l;if(_r(l,194,223))o=1,t=l-192;else if(_r(l,224,239))l===224&&(n=160),l===237&&(i=159),o=2,t=l-224;else if(_r(l,240,244))l===240&&(n=144),l===244&&(i=143),o=3,t=l-240;else return Lc(e);return t=t<<6*o,null}if(!_r(l,n,i))return t=o=r=0,n=128,i=191,c.prepend(l),Lc(e);if(n=128,i=191,r+=1,t+=l-128<<6*(o-r),r!==o)return null;var p=t;return t=o=r=0,p}}function E0(s){var e=s.fatal;this.handler=function(t,r){if(r===bi)return jn;if(_r(r,0,127))return r;var o,n;_r(r,128,2047)?(o=1,n=192):_r(r,2048,65535)?(o=2,n=224):_r(r,65536,1114111)&&(o=3,n=240);for(var i=[(r>>6*o)+n];o>0;){var c=r>>6*(o-1);i.push(128|c&63),o-=1}return i}}Cc.TextEncoder=Si;Cc.TextDecoder=_i});var kd=oe(Le=>{"use strict";var A0=Le&&Le.__createBinding||(Object.create?function(s,e,t,r){r===void 0&&(r=t),Object.defineProperty(s,r,{enumerable:!0,get:function(){return e[t]}})}:function(s,e,t,r){r===void 0&&(r=t),s[r]=e[t]}),I0=Le&&Le.__setModuleDefault||(Object.create?function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}:function(s,e){s.default=e}),rr=Le&&Le.__decorate||function(s,e,t,r){var o=arguments.length,n=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(s,e,t,r);else for(var c=s.length-1;c>=0;c--)(i=s[c])&&(n=(o<3?i(n):o>3?i(e,t,n):i(e,t))||n);return o>3&&n&&Object.defineProperty(e,t,n),n},B0=Le&&Le.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.hasOwnProperty.call(s,t)&&A0(e,s,t);return I0(e,s),e},bd=Le&&Le.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Le,"__esModule",{value:!0});Le.deserializeUnchecked=Le.deserialize=Le.serialize=Le.BinaryReader=Le.BinaryWriter=Le.BorshError=Le.baseDecode=Le.baseEncode=void 0;var $r=bd(dn()),wd=bd(Hn()),L0=B0(gd()),R0=typeof TextDecoder!="function"?L0.TextDecoder:TextDecoder,C0=new R0("utf-8",{fatal:!0});function P0(s){return typeof s=="string"&&(s=Buffer.from(s,"utf8")),wd.default.encode(Buffer.from(s))}Le.baseEncode=P0;function T0(s){return Buffer.from(wd.default.decode(s))}Le.baseDecode=T0;var Pc=1024,et=class extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}};Le.BorshError=et;var xi=class{constructor(){this.buf=Buffer.alloc(Pc),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer.concat([this.buf,Buffer.alloc(Pc)]))}writeU8(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU16(e){this.maybeResize(),this.buf.writeUInt16LE(e,this.length),this.length+=2}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(Buffer.from(new $r.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(Buffer.from(new $r.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(Buffer.from(new $r.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(Buffer.from(new $r.default(e).toArray("le",64)))}writeBuffer(e){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),e,Buffer.alloc(Pc)]),this.length+=e.length}writeString(e){this.maybeResize();let t=Buffer.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(Buffer.from(e))}writeArray(e,t){this.maybeResize(),this.writeU32(e.length);for(let r of e)this.maybeResize(),t(r)}toArray(){return this.buf.subarray(0,this.length)}};Le.BinaryWriter=xi;function nr(s,e,t){let r=t.value;t.value=function(...o){try{return r.apply(this,o)}catch(n){if(n instanceof RangeError){let i=n.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(i)>=0)throw new et("Reached the end of buffer when deserializing")}throw n}}}var lt=class{constructor(e){this.buf=e,this.offset=0}readU8(){let e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){let e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){let e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){let e=this.readBuffer(8);return new $r.default(e,"le")}readU128(){let e=this.readBuffer(16);return new $r.default(e,"le")}readU256(){let e=this.readBuffer(32);return new $r.default(e,"le")}readU512(){let e=this.readBuffer(64);return new $r.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new et(`Expected buffer length ${e} isn't within bounds`);let t=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,t}readString(){let e=this.readU32(),t=this.readBuffer(e);try{return C0.decode(t)}catch(r){throw new et(`Error decoding UTF-8 string: ${r}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){let t=this.readU32(),r=Array();for(let o=0;o<t;++o)r.push(e());return r}};rr([nr],lt.prototype,"readU8",null);rr([nr],lt.prototype,"readU16",null);rr([nr],lt.prototype,"readU32",null);rr([nr],lt.prototype,"readU64",null);rr([nr],lt.prototype,"readU128",null);rr([nr],lt.prototype,"readU256",null);rr([nr],lt.prototype,"readU512",null);rr([nr],lt.prototype,"readString",null);rr([nr],lt.prototype,"readFixedArray",null);rr([nr],lt.prototype,"readArray",null);Le.BinaryReader=lt;function _d(s){return s.charAt(0).toUpperCase()+s.slice(1)}function mn(s,e,t,r,o){try{if(typeof r=="string")o[`write${_d(r)}`](t);else if(r instanceof Array)if(typeof r[0]=="number"){if(t.length!==r[0])throw new et(`Expecting byte array of length ${r[0]}, but got ${t.length} bytes`);o.writeFixedArray(t)}else if(r.length===2&&typeof r[1]=="number"){if(t.length!==r[1])throw new et(`Expecting byte array of length ${r[1]}, but got ${t.length} bytes`);for(let n=0;n<r[1];n++)mn(s,null,t[n],r[0],o)}else o.writeArray(t,n=>{mn(s,e,n,r[0],o)});else if(r.kind!==void 0)switch(r.kind){case"option":{t==null?o.writeU8(0):(o.writeU8(1),mn(s,e,t,r.type,o));break}case"map":{o.writeU32(t.size),t.forEach((n,i)=>{mn(s,e,i,r.key,o),mn(s,e,n,r.value,o)});break}default:throw new et(`FieldType ${r} unrecognized`)}else Sd(s,t,o)}catch(n){throw n instanceof et&&n.addToFieldPath(e),n}}function Sd(s,e,t){if(typeof e.borshSerialize=="function"){e.borshSerialize(t);return}let r=s.get(e.constructor);if(!r)throw new et(`Class ${e.constructor.name} is missing in schema`);if(r.kind==="struct")r.fields.map(([o,n])=>{mn(s,o,e[o],n,t)});else if(r.kind==="enum"){let o=e[r.field];for(let n=0;n<r.values.length;++n){let[i,c]=r.values[n];if(i===o){t.writeU8(n),mn(s,i,e[i],c,t);break}}}else throw new et(`Unexpected schema kind: ${r.kind} for ${e.constructor.name}`)}function O0(s,e,t=xi){let r=new t;return Sd(s,e,r),r.toArray()}Le.serialize=O0;function gn(s,e,t,r){try{if(typeof t=="string")return r[`read${_d(t)}`]();if(t instanceof Array){if(typeof t[0]=="number")return r.readFixedArray(t[0]);if(typeof t[1]=="number"){let o=[];for(let n=0;n<t[1];n++)o.push(gn(s,null,t[0],r));return o}else return r.readArray(()=>gn(s,e,t[0],r))}if(t.kind==="option")return r.readU8()?gn(s,e,t.type,r):void 0;if(t.kind==="map"){let o=new Map,n=r.readU32();for(let i=0;i<n;i++){let c=gn(s,e,t.key,r),l=gn(s,e,t.value,r);o.set(c,l)}return o}return Tc(s,t,r)}catch(o){throw o instanceof et&&o.addToFieldPath(e),o}}function Tc(s,e,t){if(typeof e.borshDeserialize=="function")return e.borshDeserialize(t);let r=s.get(e);if(!r)throw new et(`Class ${e.name} is missing in schema`);if(r.kind==="struct"){let o={};for(let[n,i]of s.get(e).fields)o[n]=gn(s,n,i,t);return new e(o)}if(r.kind==="enum"){let o=t.readU8();if(o>=r.values.length)throw new et(`Enum index: ${o} is out of range`);let[n,i]=r.values[o],c=gn(s,n,i,t);return new e({[n]:c})}throw new et(`Unexpected schema kind: ${r.kind} for ${e.constructor.name}`)}function N0(s,e,t,r=lt){let o=new r(t),n=Tc(s,e,o);if(o.offset<t.length)throw new et(`Unexpected ${t.length-o.offset} bytes after deserialized data`);return n}Le.deserialize=N0;function F0(s,e,t,r=lt){let o=new r(t);return Tc(s,e,o)}Le.deserializeUnchecked=F0});var Uc=oe(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.s16=E.s8=E.nu64be=E.u48be=E.u40be=E.u32be=E.u24be=E.u16be=E.nu64=E.u48=E.u40=E.u32=E.u24=E.u16=E.u8=E.offset=E.greedy=E.Constant=E.UTF8=E.CString=E.Blob=E.Boolean=E.BitField=E.BitStructure=E.VariantLayout=E.Union=E.UnionLayoutDiscriminator=E.UnionDiscriminator=E.Structure=E.Sequence=E.DoubleBE=E.Double=E.FloatBE=E.Float=E.NearInt64BE=E.NearInt64=E.NearUInt64BE=E.NearUInt64=E.IntBE=E.Int=E.UIntBE=E.UInt=E.OffsetLayout=E.GreedyCount=E.ExternalLayout=E.bindConstructorLayout=E.nameWithProperty=E.Layout=E.uint8ArrayToBuffer=E.checkUint8Array=void 0;E.constant=E.utf8=E.cstr=E.blob=E.unionLayoutDiscriminator=E.union=E.seq=E.bits=E.struct=E.f64be=E.f64=E.f32be=E.f32=E.ns64be=E.s48be=E.s40be=E.s32be=E.s24be=E.s16be=E.ns64=E.s48=E.s40=E.s32=E.s24=void 0;var Nc=ae("buffer");function Xn(s){if(!(s instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}E.checkUint8Array=Xn;function we(s){return Xn(s),Nc.Buffer.from(s.buffer,s.byteOffset,s.length)}E.uint8ArrayToBuffer=we;var ke=class{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){let t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}};E.Layout=ke;function Fc(s,e){return e.property?s+"["+e.property+"]":s}E.nameWithProperty=Fc;function U0(s,e){if(typeof s!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(s,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof ke))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");s.layout_=e,e.boundConstructor_=s,e.makeDestinationObject=()=>new s,Object.defineProperty(s.prototype,"encode",{value(t,r){return e.encode(this,t,r)},writable:!0}),Object.defineProperty(s,"decode",{value(t,r){return e.decode(t,r)},writable:!0})}E.bindConstructorLayout=U0;var ot=class extends ke{isCount(){throw new Error("ExternalLayout is abstract")}};E.ExternalLayout=ot;var vi=class extends ot{constructor(e=1,t){if(!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t=0){Xn(e);let r=e.length-t;return Math.floor(r/this.elementSpan)}encode(e,t,r){return 0}};E.GreedyCount=vi;var Os=class extends ot{constructor(e,t=0,r){if(!(e instanceof ke))throw new TypeError("layout must be a Layout");if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,r||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof pt||this.layout instanceof xt}decode(e,t=0){return this.layout.decode(e,t+this.offset)}encode(e,t,r=0){return this.layout.encode(e,t,r+this.offset)}};E.OffsetLayout=Os;var pt=class extends ke{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return we(e).readUIntLE(t,this.span)}encode(e,t,r=0){return we(t).writeUIntLE(e,r,this.span),this.span}};E.UInt=pt;var xt=class extends ke{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return we(e).readUIntBE(t,this.span)}encode(e,t,r=0){return we(t).writeUIntBE(e,r,this.span),this.span}};E.UIntBE=xt;var Sr=class extends ke{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return we(e).readIntLE(t,this.span)}encode(e,t,r=0){return we(t).writeIntLE(e,r,this.span),this.span}};E.Int=Sr;var qr=class extends ke{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return we(e).readIntBE(t,this.span)}encode(e,t,r=0){return we(t).writeIntBE(e,r,this.span),this.span}};E.IntBE=qr;var Oc=Math.pow(2,32);function $i(s){let e=Math.floor(s/Oc),t=s-e*Oc;return{hi32:e,lo32:t}}function qi(s,e){return s*Oc+e}var Ei=class extends ke{constructor(e){super(8,e)}decode(e,t=0){let r=we(e),o=r.readUInt32LE(t),n=r.readUInt32LE(t+4);return qi(n,o)}encode(e,t,r=0){let o=$i(e),n=we(t);return n.writeUInt32LE(o.lo32,r),n.writeUInt32LE(o.hi32,r+4),8}};E.NearUInt64=Ei;var Ai=class extends ke{constructor(e){super(8,e)}decode(e,t=0){let r=we(e),o=r.readUInt32BE(t),n=r.readUInt32BE(t+4);return qi(o,n)}encode(e,t,r=0){let o=$i(e),n=we(t);return n.writeUInt32BE(o.hi32,r),n.writeUInt32BE(o.lo32,r+4),8}};E.NearUInt64BE=Ai;var Ii=class extends ke{constructor(e){super(8,e)}decode(e,t=0){let r=we(e),o=r.readUInt32LE(t),n=r.readInt32LE(t+4);return qi(n,o)}encode(e,t,r=0){let o=$i(e),n=we(t);return n.writeUInt32LE(o.lo32,r),n.writeInt32LE(o.hi32,r+4),8}};E.NearInt64=Ii;var Bi=class extends ke{constructor(e){super(8,e)}decode(e,t=0){let r=we(e),o=r.readInt32BE(t),n=r.readUInt32BE(t+4);return qi(o,n)}encode(e,t,r=0){let o=$i(e),n=we(t);return n.writeInt32BE(o.hi32,r),n.writeUInt32BE(o.lo32,r+4),8}};E.NearInt64BE=Bi;var Li=class extends ke{constructor(e){super(4,e)}decode(e,t=0){return we(e).readFloatLE(t)}encode(e,t,r=0){return we(t).writeFloatLE(e,r),4}};E.Float=Li;var Ri=class extends ke{constructor(e){super(4,e)}decode(e,t=0){return we(e).readFloatBE(t)}encode(e,t,r=0){return we(t).writeFloatBE(e,r),4}};E.FloatBE=Ri;var Ci=class extends ke{constructor(e){super(8,e)}decode(e,t=0){return we(e).readDoubleLE(t)}encode(e,t,r=0){return we(t).writeDoubleLE(e,r),8}};E.Double=Ci;var Pi=class extends ke{constructor(e){super(8,e)}decode(e,t=0){return we(e).readDoubleBE(t)}encode(e,t,r=0){return we(t).writeDoubleBE(e,r),8}};E.DoubleBE=Pi;var Ti=class extends ke{constructor(e,t,r){if(!(e instanceof ke))throw new TypeError("elementLayout must be a Layout");if(!(t instanceof ot&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let o=-1;!(t instanceof ot)&&0<e.span&&(o=t*e.span),super(o,r),this.elementLayout=e,this.count=t}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0,o=this.count;if(o instanceof ot&&(o=o.decode(e,t)),0<this.elementLayout.span)r=o*this.elementLayout.span;else{let n=0;for(;n<o;)r+=this.elementLayout.getSpan(e,t+r),++n}return r}decode(e,t=0){let r=[],o=0,n=this.count;for(n instanceof ot&&(n=n.decode(e,t));o<n;)r.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),o+=1;return r}encode(e,t,r=0){let o=this.elementLayout,n=e.reduce((i,c)=>i+o.encode(c,t,r+i),0);return this.count instanceof ot&&this.count.encode(e.length,t,r),n}};E.Sequence=Ti;var Oi=class extends ke{constructor(e,t,r){if(!(Array.isArray(e)&&e.reduce((n,i)=>n&&i instanceof ke,!0)))throw new TypeError("fields must be array of Layout instances");typeof t=="boolean"&&r===void 0&&(r=t,t=void 0);for(let n of e)if(0>n.span&&n.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let o=-1;try{o=e.reduce((n,i)=>n+i.getSpan(),0)}catch{}super(o,t),this.fields=e,this.decodePrefixes=!!r}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce((o,n)=>{let i=n.getSpan(e,t);return t+=i,o+i},0)}catch{throw new RangeError("indeterminate span")}return r}decode(e,t=0){Xn(e);let r=this.makeDestinationObject();for(let o of this.fields)if(o.property!==void 0&&(r[o.property]=o.decode(e,t)),t+=o.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return r}encode(e,t,r=0){let o=r,n=0,i=0;for(let c of this.fields){let l=c.span;if(i=0<l?l:0,c.property!==void 0){let p=e[c.property];p!==void 0&&(i=c.encode(p,t,r),0>l&&(l=c.getSpan(t,r)))}n=r,r+=l}return n+i-o}fromArray(e){let t=this.makeDestinationObject();for(let r of this.fields)r.property!==void 0&&0<e.length&&(t[r.property]=e.shift());return t}layoutFor(e){if(typeof e!="string")throw new TypeError("property must be string");for(let t of this.fields)if(t.property===e)return t}offsetOf(e){if(typeof e!="string")throw new TypeError("property must be string");let t=0;for(let r of this.fields){if(r.property===e)return t;0>r.span?t=-1:0<=t&&(t+=r.span)}}};E.Structure=Oi;var Ns=class{constructor(e){this.property=e}decode(e,t){throw new Error("UnionDiscriminator is abstract")}encode(e,t,r){throw new Error("UnionDiscriminator is abstract")}};E.UnionDiscriminator=Ns;var Gn=class extends Ns{constructor(e,t){if(!(e instanceof ot&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,r){return this.layout.encode(e,t,r)}};E.UnionLayoutDiscriminator=Gn;var Fs=class extends ke{constructor(e,t,r){let o;if(e instanceof pt||e instanceof xt)o=new Gn(new Os(e));else if(e instanceof ot&&e.isCount())o=new Gn(e);else if(e instanceof Ns)o=e;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(t===void 0&&(t=null),!(t===null||t instanceof ke))throw new TypeError("defaultLayout must be null or a Layout");if(t!==null){if(0>t.span)throw new Error("defaultLayout must have constant span");t.property===void 0&&(t=t.replicate("content"))}let n=-1;t&&(n=t.span,0<=n&&(e instanceof pt||e instanceof xt)&&(n+=o.layout.span)),super(n,r),this.discriminator=o,this.usesPrefixDiscriminator=e instanceof pt||e instanceof xt,this.defaultLayout=t,this.registry={};let i=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(c){return i(c)},this.configGetSourceVariant=function(c){i=c.bind(this)}}getSpan(e,t=0){if(0<=this.span)return this.span;let r=this.getVariant(e,t);if(!r)throw new Error("unable to determine span for unrecognized variant");return r.getSpan(e,t)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;let t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||t.property&&Object.prototype.hasOwnProperty.call(e,t.property)))return t}else for(let t in this.registry){let r=this.registry[t];if(r.property&&Object.prototype.hasOwnProperty.call(e,r.property))return r}throw new Error("unable to infer src variant")}decode(e,t=0){let r,o=this.discriminator,n=o.decode(e,t),i=this.registry[n];if(i===void 0){let c=this.defaultLayout,l=0;this.usesPrefixDiscriminator&&(l=o.layout.span),r=this.makeDestinationObject(),r[o.property]=n,r[c.property]=c.decode(e,t+l)}else r=i.decode(e,t);return r}encode(e,t,r=0){let o=this.getSourceVariant(e);if(o===void 0){let n=this.discriminator,i=this.defaultLayout,c=0;return this.usesPrefixDiscriminator&&(c=n.layout.span),n.encode(e[n.property],t,r),c+i.encode(e[i.property],t,r+c)}return o.encode(e,t,r)}addVariant(e,t,r){let o=new Ni(this,e,t,r);return this.registry[e]=o,o}getVariant(e,t=0){let r;return e instanceof Uint8Array?r=this.discriminator.decode(e,t):r=e,this.registry[r]}};E.Union=Fs;var Ni=class extends ke{constructor(e,t,r,o){if(!(e instanceof Fs))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw new TypeError("variant must be a (non-negative) integer");if(typeof r=="string"&&o===void 0&&(o=r,r=null),r){if(!(r instanceof ke))throw new TypeError("layout must be a Layout");if(e.defaultLayout!==null&&0<=r.span&&r.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof o!="string")throw new TypeError("variant must have a String property")}let n=e.span;0>e.span&&(n=r?r.span:0,0<=n&&e.usesPrefixDiscriminator&&(n+=e.discriminator.layout.span)),super(n,o),this.union=e,this.variant=t,this.layout=r||null}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span);let o=0;return this.layout&&(o=this.layout.getSpan(e,t+r)),r+o}decode(e,t=0){let r=this.makeDestinationObject();if(this!==this.union.getVariant(e,t))throw new Error("variant mismatch");let o=0;return this.union.usesPrefixDiscriminator&&(o=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(e,t+o):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(e,t,r=0){let o=0;if(this.union.usesPrefixDiscriminator&&(o=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,r);let n=o;if(this.layout&&(this.layout.encode(e[this.property],t,r+o),n+=this.layout.getSpan(t,r+o),0<=this.union.span&&n>this.union.span))throw new Error("encoded variant overruns containing union");return n}fromArray(e){if(this.layout)return this.layout.fromArray(e)}};E.VariantLayout=Ni;function Vn(s){return 0>s&&(s+=4294967296),s}var Us=class extends ke{constructor(e,t,r){if(!(e instanceof pt||e instanceof xt))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof t=="string"&&r===void 0&&(r=t,t=!1),4<e.span)throw new RangeError("word cannot exceed 32 bits");super(e.span,r),this.word=e,this.msb=!!t,this.fields=[];let o=0;this._packedSetValue=function(n){return o=Vn(n),this},this._packedGetValue=function(){return o}}decode(e,t=0){let r=this.makeDestinationObject(),o=this.word.decode(e,t);this._packedSetValue(o);for(let n of this.fields)n.property!==void 0&&(r[n.property]=n.decode(e));return r}encode(e,t,r=0){let o=this.word.decode(t,r);this._packedSetValue(o);for(let n of this.fields)if(n.property!==void 0){let i=e[n.property];i!==void 0&&n.encode(i)}return this.word.encode(this._packedGetValue(),t,r)}addField(e,t){let r=new Ds(this,e,t);return this.fields.push(r),r}addBoolean(e){let t=new Fi(this,e);return this.fields.push(t),t}fieldFor(e){if(typeof e!="string")throw new TypeError("property must be string");for(let t of this.fields)if(t.property===e)return t}};E.BitStructure=Us;var Ds=class{constructor(e,t,r){if(!(e instanceof Us))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(t)||0>=t)throw new TypeError("bits must be positive integer");let o=8*e.span,n=e.fields.reduce((i,c)=>i+c.bits,0);if(t+n>o)throw new Error("bits too long for span remainder ("+(o-n)+" of "+o+" remain)");this.container=e,this.bits=t,this.valueMask=(1<<t)-1,t===32&&(this.valueMask=4294967295),this.start=n,this.container.msb&&(this.start=o-n-t),this.wordMask=Vn(this.valueMask<<this.start),this.property=r}decode(e,t){let r=this.container._packedGetValue();return Vn(r&this.wordMask)>>>this.start}encode(e){if(typeof e!="number"||!Number.isInteger(e)||e!==Vn(e&this.valueMask))throw new TypeError(Fc("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let t=this.container._packedGetValue(),r=Vn(e<<this.start);this.container._packedSetValue(Vn(t&~this.wordMask)|r)}};E.BitField=Ds;var Fi=class extends Ds{constructor(e,t){super(e,1,t)}decode(e,t){return!!super.decode(e,t)}encode(e){typeof e=="boolean"&&(e=+e),super.encode(e)}};E.Boolean=Fi;var Ui=class extends ke{constructor(e,t){if(!(e instanceof ot&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;e instanceof ot||(r=e),super(r,t),this.length=e}getSpan(e,t){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),r}decode(e,t=0){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),we(e).slice(t,t+r)}encode(e,t,r){let o=this.length;if(this.length instanceof ot&&(o=e.length),!(e instanceof Uint8Array&&o===e.length))throw new TypeError(Fc("Blob.encode",this)+" requires (length "+o+") Uint8Array as src");if(r+o>t.length)throw new RangeError("encoding overruns Uint8Array");let n=we(e);return we(t).write(n.toString("hex"),r,o,"hex"),this.length instanceof ot&&this.length.encode(o,t,r),o}};E.Blob=Ui;var Di=class extends ke{constructor(e){super(-1,e)}getSpan(e,t=0){Xn(e);let r=t;for(;r<e.length&&e[r]!==0;)r+=1;return 1+r-t}decode(e,t=0){let r=this.getSpan(e,t);return we(e).slice(t,t+r-1).toString("utf-8")}encode(e,t,r=0){typeof e!="string"&&(e=String(e));let o=Nc.Buffer.from(e,"utf8"),n=o.length;if(r+n>t.length)throw new RangeError("encoding overruns Buffer");let i=we(t);return o.copy(i,r),i[r+n]=0,n+1}};E.CString=Di;var Mi=class extends ke{constructor(e,t){if(typeof e=="string"&&t===void 0&&(t=e,e=void 0),e===void 0)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e,t=0){return Xn(e),e.length-t}decode(e,t=0){let r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return we(e).slice(t,t+r).toString("utf-8")}encode(e,t,r=0){typeof e!="string"&&(e=String(e));let o=Nc.Buffer.from(e,"utf8"),n=o.length;if(0<=this.maxSpan&&this.maxSpan<n)throw new RangeError("text length exceeds maxSpan");if(r+n>t.length)throw new RangeError("encoding overruns Buffer");return o.copy(we(t),r),n}};E.UTF8=Mi;var zi=class extends ke{constructor(e,t){super(0,t),this.value=e}decode(e,t){return this.value}encode(e,t,r){return 0}};E.Constant=zi;E.greedy=(s,e)=>new vi(s,e);E.offset=(s,e,t)=>new Os(s,e,t);E.u8=s=>new pt(1,s);E.u16=s=>new pt(2,s);E.u24=s=>new pt(3,s);E.u32=s=>new pt(4,s);E.u40=s=>new pt(5,s);E.u48=s=>new pt(6,s);E.nu64=s=>new Ei(s);E.u16be=s=>new xt(2,s);E.u24be=s=>new xt(3,s);E.u32be=s=>new xt(4,s);E.u40be=s=>new xt(5,s);E.u48be=s=>new xt(6,s);E.nu64be=s=>new Ai(s);E.s8=s=>new Sr(1,s);E.s16=s=>new Sr(2,s);E.s24=s=>new Sr(3,s);E.s32=s=>new Sr(4,s);E.s40=s=>new Sr(5,s);E.s48=s=>new Sr(6,s);E.ns64=s=>new Ii(s);E.s16be=s=>new qr(2,s);E.s24be=s=>new qr(3,s);E.s32be=s=>new qr(4,s);E.s40be=s=>new qr(5,s);E.s48be=s=>new qr(6,s);E.ns64be=s=>new Bi(s);E.f32=s=>new Li(s);E.f32be=s=>new Ri(s);E.f64=s=>new Ci(s);E.f64be=s=>new Pi(s);E.struct=(s,e,t)=>new Oi(s,e,t);E.bits=(s,e,t)=>new Us(s,e,t);E.seq=(s,e,t)=>new Ti(s,e,t);E.union=(s,e,t)=>new Fs(s,e,t);E.unionLayoutDiscriminator=(s,e)=>new Gn(s,e);E.blob=(s,e)=>new Ui(s,e);E.cstr=s=>new Di(s);E.utf8=(s,e)=>new Mi(s,e);E.constant=(s,e)=>new zi(s,e)});var vd=oe((vx,xd)=>{var Wi=ae("path").sep||"/";xd.exports=D0;function D0(s){if(typeof s!="string"||s.length<=7||s.substring(0,7)!="file://")throw new TypeError("must pass in a file:// URI to convert to a file path");var e=decodeURI(s.substring(7)),t=e.indexOf("/"),r=e.substring(0,t),o=e.substring(t+1);return r=="localhost"&&(r=""),r&&(r=Wi+Wi+r),o=o.replace(/^(.+)\|/,"$1:"),Wi=="\\"&&(o=o.replace(/\//g,"\\")),/^.+\:/.test(o)||(o=Wi+o),r+o}});var Bd=oe((Yn,Id)=>{var Dc=ae("fs"),Hi=ae("path"),M0=vd(),Ki=Hi.join,z0=Hi.dirname,Ed=Dc.accessSync&&function(s){try{Dc.accessSync(s)}catch{return!1}return!0}||Dc.existsSync||Hi.existsSync,Ad={arrow:process.env.NODE_BINDINGS_ARROW||" \u2192 ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};function $0(s){typeof s=="string"?s={bindings:s}:s||(s={}),Object.keys(Ad).map(function(l){l in s||(s[l]=Ad[l])}),s.module_root||(s.module_root=Yn.getRoot(Yn.getFileName())),Hi.extname(s.bindings)!=".node"&&(s.bindings+=".node");for(var e=typeof __webpack_require__=="function"?__non_webpack_require__:ae,t=[],r=0,o=s.try.length,n,i,c;r<o;r++){n=Ki.apply(null,s.try[r].map(function(l){return s[l]||l})),t.push(n);try{return i=s.path?e.resolve(n):e(n),s.path||(i.path=n),i}catch(l){if(l.code!=="MODULE_NOT_FOUND"&&l.code!=="QUALIFIED_PATH_RESOLUTION_FAILED"&&!/not find/i.test(l.message))throw l}}throw c=new Error(`Could not locate the bindings file. Tried:
2
+ import{b as ed}from"./chunk-DEW7KMCM.js";import{a as Qf,b as r0}from"./chunk-SSMP6EWG.js";import{a as Zf}from"./chunk-7HVQTJAO.js";import{$b as Kt,D as _c,Hc as t0,Sb as $f,Tb as fi,Ub as xc,Vb as wr,W as Mf,Wb as vc,Xb as qf,Yb as Wf,Zb as Zg,_b as di,ac as Ht,bc as Hf,bd as Jf,cc as jf,dc as Vf,ec as Gf,fc as Xf,gc as Qg,hc as hi,ic as e0,pc as Yf}from"./chunk-ZMRHWH7D.js";import{e as dn}from"./chunk-SBU7XQ42.js";import{a as Kf,c as Jg}from"./chunk-NMFPLO65.js";import{c as Sc,d as Xg,h as kc,i as Yg}from"./chunk-GQE2JYJW.js";import{x as zf,y as Gg}from"./chunk-DJQ5RDDN.js";import{a as ae,b as We,c as oe,d as Ps,e as re,f as Ts,g as Df}from"./chunk-LLHU72AA.js";function l0(s){let e=Xf(s);return qf(s,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function id(s){let e=l0(s),{Fp:t,n:r,prehash:o,hash:n,randomBytes:i,nByteLength:c,h:l}=e,p=yi<<BigInt(c*8)-kt,f=t.create,b=e.uvRatio||((X,U)=>{try{return{isValid:!0,value:t.sqrt(X*t.inv(U))}}catch{return{isValid:!1,value:jt}}}),_=e.adjustScalarBytes||(X=>X),g=e.domain||((X,U,Z)=>{if(U.length||Z)throw new Error("Contexts/pre-hash are not supported");return X}),k=X=>typeof X=="bigint"&&jt<X,S=(X,U)=>k(X)&&k(U)&&X<U,A=X=>X===jt||S(X,p);function C(X,U){if(S(X,U))return X;throw new Error(`Expected valid scalar < ${U}, got ${typeof X} ${X}`)}function P(X){return X===jt?X:C(X,r)}let D=new Map;function V(X){if(!(X instanceof q))throw new Error("ExtendedPoint expected")}class q{constructor(U,Z,se,ye){if(this.ex=U,this.ey=Z,this.ez=se,this.et=ye,!A(U))throw new Error("x required");if(!A(Z))throw new Error("y required");if(!A(se))throw new Error("z required");if(!A(ye))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(U){if(U instanceof q)throw new Error("extended point not allowed");let{x:Z,y:se}=U||{};if(!A(Z)||!A(se))throw new Error("invalid affine point");return new q(Z,se,kt,f(Z*se))}static normalizeZ(U){let Z=t.invertBatch(U.map(se=>se.ez));return U.map((se,ye)=>se.toAffine(Z[ye])).map(q.fromAffine)}_setWindowSize(U){this._WINDOW_SIZE=U,D.delete(this)}assertValidity(){let{a:U,d:Z}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:se,ey:ye,ez:ge,et:ve}=this,Ce=f(se*se),Ee=f(ye*ye),Oe=f(ge*ge),Ve=f(Oe*Oe),nt=f(Ce*U),Lt=f(Oe*f(nt+Ee)),st=f(Ve+f(Z*f(Ce*Ee)));if(Lt!==st)throw new Error("bad point: equation left != right (1)");let er=f(se*ye),Wt=f(ge*ve);if(er!==Wt)throw new Error("bad point: equation left != right (2)")}equals(U){V(U);let{ex:Z,ey:se,ez:ye}=this,{ex:ge,ey:ve,ez:Ce}=U,Ee=f(Z*Ce),Oe=f(ge*ye),Ve=f(se*Ce),nt=f(ve*ye);return Ee===Oe&&Ve===nt}is0(){return this.equals(q.ZERO)}negate(){return new q(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){let{a:U}=e,{ex:Z,ey:se,ez:ye}=this,ge=f(Z*Z),ve=f(se*se),Ce=f(yi*f(ye*ye)),Ee=f(U*ge),Oe=Z+se,Ve=f(f(Oe*Oe)-ge-ve),nt=Ee+ve,Lt=nt-Ce,st=Ee-ve,er=f(Ve*Lt),Wt=f(nt*st),Mn=f(Ve*st),zn=f(Lt*nt);return new q(er,Wt,zn,Mn)}add(U){V(U);let{a:Z,d:se}=e,{ex:ye,ey:ge,ez:ve,et:Ce}=this,{ex:Ee,ey:Oe,ez:Ve,et:nt}=U;if(Z===BigInt(-1)){let ei=f((ge-ye)*(Oe+Ee)),vs=f((ge+ye)*(Oe-Ee)),Es=f(vs-ei);if(Es===jt)return this.double();let ti=f(ve*yi*nt),As=f(Ce*yi*Ve),ri=As+ti,ni=vs+ei,si=As-ti,uc=f(ri*Es),lc=f(ni*si),fc=f(ri*si),oi=f(Es*ni);return new q(uc,lc,oi,fc)}let Lt=f(ye*Ee),st=f(ge*Oe),er=f(Ce*se*nt),Wt=f(ve*Ve),Mn=f((ye+ge)*(Ee+Oe)-Lt-st),zn=Wt-er,$n=Wt+er,qn=f(st-Z*Lt),Zo=f(Mn*zn),ln=f($n*qn),fn=f(Mn*qn),Qo=f(zn*$n);return new q(Zo,ln,Qo,fn)}subtract(U){return this.add(U.negate())}wNAF(U){return Re.wNAFCached(this,D,U,q.normalizeZ)}multiply(U){let{p:Z,f:se}=this.wNAF(C(U,r));return q.normalizeZ([Z,se])[0]}multiplyUnsafe(U){let Z=P(U);return Z===jt?de:this.equals(de)||Z===kt?this:this.equals(fe)?this.wNAF(Z).p:Re.unsafeLadder(this,Z)}isSmallOrder(){return this.multiplyUnsafe(l).is0()}isTorsionFree(){return Re.unsafeLadder(this,r).is0()}toAffine(U){let{ex:Z,ey:se,ez:ye}=this,ge=this.is0();U==null&&(U=ge?c0:t.inv(ye));let ve=f(Z*U),Ce=f(se*U),Ee=f(ye*U);if(ge)return{x:jt,y:kt};if(Ee!==kt)throw new Error("invZ was invalid");return{x:ve,y:Ce}}clearCofactor(){let{h:U}=e;return U===kt?this:this.multiplyUnsafe(U)}static fromHex(U,Z=!1){let{d:se,a:ye}=e,ge=t.BYTES;U=wr("pointHex",U,ge);let ve=U.slice(),Ce=U[ge-1];ve[ge-1]=Ce&-129;let Ee=fi(ve);Ee===jt||(Z?C(Ee,p):C(Ee,t.ORDER));let Oe=f(Ee*Ee),Ve=f(Oe-kt),nt=f(se*Oe-ye),{isValid:Lt,value:st}=b(Ve,nt);if(!Lt)throw new Error("Point.fromHex: invalid y coordinate");let er=(st&kt)===kt,Wt=(Ce&128)!==0;if(!Z&&st===jt&&Wt)throw new Error("Point.fromHex: x=0 and x_0=1");return Wt!==er&&(st=f(-st)),q.fromAffine({x:st,y:Ee})}static fromPrivateKey(U){return rt(U).point}toRawBytes(){let{x:U,y:Z}=this.toAffine(),se=xc(Z,t.BYTES);return se[se.length-1]|=U&kt?128:0,se}toHex(){return $f(this.toRawBytes())}}q.BASE=new q(e.Gx,e.Gy,kt,f(e.Gx*e.Gy)),q.ZERO=new q(jt,kt,kt,jt);let{BASE:fe,ZERO:de}=q,Re=Gf(q,c*8);function ut(X){return Kt(X,r)}function $e(X){return ut(fi(X))}function rt(X){let U=c;X=wr("private key",X,U);let Z=wr("hashed private key",n(X),2*U),se=_(Z.slice(0,U)),ye=Z.slice(U,2*U),ge=$e(se),ve=fe.multiply(ge),Ce=ve.toRawBytes();return{head:se,prefix:ye,scalar:ge,point:ve,pointBytes:Ce}}function Qt(X){return rt(X).pointBytes}function ks(X=new Uint8Array,...U){let Z=vc(...U);return $e(n(g(Z,wr("context",X),!!o)))}function Jo(X,U,Z={}){X=wr("message",X),o&&(X=o(X));let{prefix:se,scalar:ye,pointBytes:ge}=rt(U),ve=ks(Z.context,se,X),Ce=fe.multiply(ve).toRawBytes(),Ee=ks(Z.context,Ce,ge,X),Oe=ut(ve+Ee*ye);P(Oe);let Ve=vc(Ce,xc(Oe,t.BYTES));return wr("result",Ve,c*2)}let Dr=u0;function xs(X,U,Z,se=Dr){let{context:ye,zip215:ge}=se,ve=t.BYTES;X=wr("signature",X,2*ve),U=wr("message",U),o&&(U=o(U));let Ce=fi(X.slice(ve,2*ve)),Ee,Oe,Ve;try{Ee=q.fromHex(Z,ge),Oe=q.fromHex(X.slice(0,ve),ge),Ve=fe.multiplyUnsafe(Ce)}catch{return!1}if(!ge&&Ee.isSmallOrder())return!1;let nt=ks(ye,Oe.toRawBytes(),Ee.toRawBytes(),U);return Oe.add(Ee.multiplyUnsafe(nt)).subtract(Ve).clearCofactor().equals(q.ZERO)}return fe._setWindowSize(8),{CURVE:e,getPublicKey:Qt,sign:Jo,verify:xs,ExtendedPoint:q,utils:{getExtendedPublicKey:rt,randomPrivateKey:()=>i(t.BYTES),precompute(X=8,U=q.BASE){return U._setWindowSize(X),U.multiply(BigInt(3)),U}}}}var jt,kt,yi,c0,u0,ad=We(()=>{Qg();Vf();Wf();Wf();jt=BigInt(0),kt=BigInt(1),yi=BigInt(2),c0=BigInt(8),u0={zip215:!0}});function p0(s){let e=BigInt(10),t=BigInt(20),r=BigInt(40),o=BigInt(80),n=Ic,c=s*s%n*s%n,l=Ht(c,ud,n)*c%n,p=Ht(l,f0,n)*s%n,f=Ht(p,d0,n)*p%n,b=Ht(f,e,n)*f%n,_=Ht(b,t,n)*b%n,g=Ht(_,r,n)*_%n,k=Ht(g,o,n)*g%n,S=Ht(k,o,n)*g%n,A=Ht(S,e,n)*f%n;return{pow_p_5_8:Ht(A,ud,n)*s%n,b2:c}}function y0(s){return s[0]&=248,s[31]&=127,s[31]|=64,s}function m0(s,e){let t=Ic,r=Kt(e*e*e,t),o=Kt(r*r*e,t),n=p0(s*o).pow_p_5_8,i=Kt(s*r*n,t),c=Kt(e*i*i,t),l=i,p=Kt(i*cd,t),f=c===s,b=c===Kt(-s,t),_=c===Kt(-s*cd,t);return f&&(i=l),(b||_)&&(i=p),Hf(i,t)&&(i=Kt(-i,t)),{isValid:f||b,value:i}}var Ic,cd,mx,f0,ud,gx,d0,h0,g0,b0,pn,ld=We(()=>{r0();Gg();ad();Vf();Ic=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),cd=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),mx=BigInt(0),f0=BigInt(1),ud=BigInt(2),gx=BigInt(3),d0=BigInt(5),h0=BigInt(8);g0=(()=>jf(Ic,void 0,!0))(),b0=(()=>({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:g0,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:h0,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Qf,randomBytes:zf,adjustScalarBytes:y0,uvRatio:m0}))(),pn=(()=>id(b0))()});var hd=oe((Bc,dd)=>{var mi=ae("buffer"),tr=mi.Buffer;function fd(s,e){for(var t in s)e[t]=s[t]}tr.from&&tr.alloc&&tr.allocUnsafe&&tr.allocUnsafeSlow?dd.exports=mi:(fd(mi,Bc),Bc.Buffer=yn);function yn(s,e,t){return tr(s,e,t)}yn.prototype=Object.create(tr.prototype);fd(tr,yn);yn.from=function(s,e,t){if(typeof s=="number")throw new TypeError("Argument must not be a number");return tr(s,e,t)};yn.alloc=function(s,e,t){if(typeof s!="number")throw new TypeError("Argument must be a number");var r=tr(s);return e!==void 0?typeof t=="string"?r.fill(e,t):r.fill(e):r.fill(0),r};yn.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return tr(s)};yn.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return mi.SlowBuffer(s)}});var yd=oe((wx,pd)=>{"use strict";var gi=hd().Buffer;function w0(s){if(s.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),t=0;t<e.length;t++)e[t]=255;for(var r=0;r<s.length;r++){var o=s.charAt(r),n=o.charCodeAt(0);if(e[n]!==255)throw new TypeError(o+" is ambiguous");e[n]=r}var i=s.length,c=s.charAt(0),l=Math.log(i)/Math.log(256),p=Math.log(256)/Math.log(i);function f(g){if((Array.isArray(g)||g instanceof Uint8Array)&&(g=gi.from(g)),!gi.isBuffer(g))throw new TypeError("Expected Buffer");if(g.length===0)return"";for(var k=0,S=0,A=0,C=g.length;A!==C&&g[A]===0;)A++,k++;for(var P=(C-A)*p+1>>>0,D=new Uint8Array(P);A!==C;){for(var V=g[A],q=0,fe=P-1;(V!==0||q<S)&&fe!==-1;fe--,q++)V+=256*D[fe]>>>0,D[fe]=V%i>>>0,V=V/i>>>0;if(V!==0)throw new Error("Non-zero carry");S=q,A++}for(var de=P-S;de!==P&&D[de]===0;)de++;for(var Re=c.repeat(k);de<P;++de)Re+=s.charAt(D[de]);return Re}function b(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return gi.alloc(0);for(var k=0,S=0,A=0;g[k]===c;)S++,k++;for(var C=(g.length-k)*l+1>>>0,P=new Uint8Array(C);g[k];){var D=e[g.charCodeAt(k)];if(D===255)return;for(var V=0,q=C-1;(D!==0||V<A)&&q!==-1;q--,V++)D+=i*P[q]>>>0,P[q]=D%256>>>0,D=D/256>>>0;if(D!==0)throw new Error("Non-zero carry");A=V,k++}for(var fe=C-A;fe!==C&&P[fe]===0;)fe++;var de=gi.allocUnsafe(S+(C-fe));de.fill(0,0,S);for(var Re=S;fe!==C;)de[Re++]=P[fe++];return de}function _(g){var k=b(g);if(k)return k;throw new Error("Non-base"+i+" character")}return{encode:f,decodeUnsafe:b,decode:_}}pd.exports=w0});var Hn=oe((_x,md)=>{var _0=yd(),S0="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";md.exports=_0(S0)});var gd=oe(Cc=>{"use strict";function _r(s,e,t){return e<=s&&s<=t}function ki(s){if(s===void 0)return{};if(s===Object(s))return s;throw TypeError("Could not convert argument to dictionary")}function k0(s){for(var e=String(s),t=e.length,r=0,o=[];r<t;){var n=e.charCodeAt(r);if(n<55296||n>57343)o.push(n);else if(56320<=n&&n<=57343)o.push(65533);else if(55296<=n&&n<=56319)if(r===t-1)o.push(65533);else{var i=s.charCodeAt(r+1);if(56320<=i&&i<=57343){var c=n&1023,l=i&1023;o.push(65536+(c<<10)+l),r+=1}else o.push(65533)}r+=1}return o}function x0(s){for(var e="",t=0;t<s.length;++t){var r=s[t];r<=65535?e+=String.fromCharCode(r):(r-=65536,e+=String.fromCharCode((r>>10)+55296,(r&1023)+56320))}return e}var bi=-1;function Rc(s){this.tokens=[].slice.call(s)}Rc.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():bi},prepend:function(s){if(Array.isArray(s))for(var e=s;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(s)},push:function(s){if(Array.isArray(s))for(var e=s;e.length;)this.tokens.push(e.shift());else this.tokens.push(s)}};var jn=-1;function Lc(s,e){if(s)throw TypeError("Decoder error");return e||65533}var wi="utf-8";function _i(s,e){if(!(this instanceof _i))return new _i(s,e);if(s=s!==void 0?String(s).toLowerCase():wi,s!==wi)throw new Error("Encoding not supported. Only utf-8 is supported");e=ki(e),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!e.fatal,this._ignoreBOM=!!e.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}_i.prototype={decode:function(e,t){var r;typeof e=="object"&&e instanceof ArrayBuffer?r=new Uint8Array(e):typeof e=="object"&&"buffer"in e&&e.buffer instanceof ArrayBuffer?r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):r=new Uint8Array(0),t=ki(t),this._streaming||(this._decoder=new v0({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!t.stream;for(var o=new Rc(r),n=[],i;!o.endOfStream()&&(i=this._decoder.handler(o,o.read()),i!==jn);)i!==null&&(Array.isArray(i)?n.push.apply(n,i):n.push(i));if(!this._streaming){do{if(i=this._decoder.handler(o,o.read()),i===jn)break;i!==null&&(Array.isArray(i)?n.push.apply(n,i):n.push(i))}while(!o.endOfStream());this._decoder=null}return n.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(n[0]===65279?(this._BOMseen=!0,n.shift()):this._BOMseen=!0),x0(n)}};function Si(s,e){if(!(this instanceof Si))return new Si(s,e);if(s=s!==void 0?String(s).toLowerCase():wi,s!==wi)throw new Error("Encoding not supported. Only utf-8 is supported");e=ki(e),this._streaming=!1,this._encoder=null,this._options={fatal:!!e.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}Si.prototype={encode:function(e,t){e=e?String(e):"",t=ki(t),this._streaming||(this._encoder=new E0(this._options)),this._streaming=!!t.stream;for(var r=[],o=new Rc(k0(e)),n;!o.endOfStream()&&(n=this._encoder.handler(o,o.read()),n!==jn);)Array.isArray(n)?r.push.apply(r,n):r.push(n);if(!this._streaming){for(;n=this._encoder.handler(o,o.read()),n!==jn;)Array.isArray(n)?r.push.apply(r,n):r.push(n);this._encoder=null}return new Uint8Array(r)}};function v0(s){var e=s.fatal,t=0,r=0,o=0,n=128,i=191;this.handler=function(c,l){if(l===bi&&o!==0)return o=0,Lc(e);if(l===bi)return jn;if(o===0){if(_r(l,0,127))return l;if(_r(l,194,223))o=1,t=l-192;else if(_r(l,224,239))l===224&&(n=160),l===237&&(i=159),o=2,t=l-224;else if(_r(l,240,244))l===240&&(n=144),l===244&&(i=143),o=3,t=l-240;else return Lc(e);return t=t<<6*o,null}if(!_r(l,n,i))return t=o=r=0,n=128,i=191,c.prepend(l),Lc(e);if(n=128,i=191,r+=1,t+=l-128<<6*(o-r),r!==o)return null;var p=t;return t=o=r=0,p}}function E0(s){var e=s.fatal;this.handler=function(t,r){if(r===bi)return jn;if(_r(r,0,127))return r;var o,n;_r(r,128,2047)?(o=1,n=192):_r(r,2048,65535)?(o=2,n=224):_r(r,65536,1114111)&&(o=3,n=240);for(var i=[(r>>6*o)+n];o>0;){var c=r>>6*(o-1);i.push(128|c&63),o-=1}return i}}Cc.TextEncoder=Si;Cc.TextDecoder=_i});var kd=oe(Le=>{"use strict";var A0=Le&&Le.__createBinding||(Object.create?function(s,e,t,r){r===void 0&&(r=t),Object.defineProperty(s,r,{enumerable:!0,get:function(){return e[t]}})}:function(s,e,t,r){r===void 0&&(r=t),s[r]=e[t]}),I0=Le&&Le.__setModuleDefault||(Object.create?function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}:function(s,e){s.default=e}),rr=Le&&Le.__decorate||function(s,e,t,r){var o=arguments.length,n=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(s,e,t,r);else for(var c=s.length-1;c>=0;c--)(i=s[c])&&(n=(o<3?i(n):o>3?i(e,t,n):i(e,t))||n);return o>3&&n&&Object.defineProperty(e,t,n),n},B0=Le&&Le.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.hasOwnProperty.call(s,t)&&A0(e,s,t);return I0(e,s),e},bd=Le&&Le.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Le,"__esModule",{value:!0});Le.deserializeUnchecked=Le.deserialize=Le.serialize=Le.BinaryReader=Le.BinaryWriter=Le.BorshError=Le.baseDecode=Le.baseEncode=void 0;var $r=bd(dn()),wd=bd(Hn()),L0=B0(gd()),R0=typeof TextDecoder!="function"?L0.TextDecoder:TextDecoder,C0=new R0("utf-8",{fatal:!0});function P0(s){return typeof s=="string"&&(s=Buffer.from(s,"utf8")),wd.default.encode(Buffer.from(s))}Le.baseEncode=P0;function T0(s){return Buffer.from(wd.default.decode(s))}Le.baseDecode=T0;var Pc=1024,et=class extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}};Le.BorshError=et;var xi=class{constructor(){this.buf=Buffer.alloc(Pc),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer.concat([this.buf,Buffer.alloc(Pc)]))}writeU8(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU16(e){this.maybeResize(),this.buf.writeUInt16LE(e,this.length),this.length+=2}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(Buffer.from(new $r.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(Buffer.from(new $r.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(Buffer.from(new $r.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(Buffer.from(new $r.default(e).toArray("le",64)))}writeBuffer(e){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),e,Buffer.alloc(Pc)]),this.length+=e.length}writeString(e){this.maybeResize();let t=Buffer.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(Buffer.from(e))}writeArray(e,t){this.maybeResize(),this.writeU32(e.length);for(let r of e)this.maybeResize(),t(r)}toArray(){return this.buf.subarray(0,this.length)}};Le.BinaryWriter=xi;function nr(s,e,t){let r=t.value;t.value=function(...o){try{return r.apply(this,o)}catch(n){if(n instanceof RangeError){let i=n.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(i)>=0)throw new et("Reached the end of buffer when deserializing")}throw n}}}var lt=class{constructor(e){this.buf=e,this.offset=0}readU8(){let e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){let e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){let e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){let e=this.readBuffer(8);return new $r.default(e,"le")}readU128(){let e=this.readBuffer(16);return new $r.default(e,"le")}readU256(){let e=this.readBuffer(32);return new $r.default(e,"le")}readU512(){let e=this.readBuffer(64);return new $r.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new et(`Expected buffer length ${e} isn't within bounds`);let t=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,t}readString(){let e=this.readU32(),t=this.readBuffer(e);try{return C0.decode(t)}catch(r){throw new et(`Error decoding UTF-8 string: ${r}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){let t=this.readU32(),r=Array();for(let o=0;o<t;++o)r.push(e());return r}};rr([nr],lt.prototype,"readU8",null);rr([nr],lt.prototype,"readU16",null);rr([nr],lt.prototype,"readU32",null);rr([nr],lt.prototype,"readU64",null);rr([nr],lt.prototype,"readU128",null);rr([nr],lt.prototype,"readU256",null);rr([nr],lt.prototype,"readU512",null);rr([nr],lt.prototype,"readString",null);rr([nr],lt.prototype,"readFixedArray",null);rr([nr],lt.prototype,"readArray",null);Le.BinaryReader=lt;function _d(s){return s.charAt(0).toUpperCase()+s.slice(1)}function mn(s,e,t,r,o){try{if(typeof r=="string")o[`write${_d(r)}`](t);else if(r instanceof Array)if(typeof r[0]=="number"){if(t.length!==r[0])throw new et(`Expecting byte array of length ${r[0]}, but got ${t.length} bytes`);o.writeFixedArray(t)}else if(r.length===2&&typeof r[1]=="number"){if(t.length!==r[1])throw new et(`Expecting byte array of length ${r[1]}, but got ${t.length} bytes`);for(let n=0;n<r[1];n++)mn(s,null,t[n],r[0],o)}else o.writeArray(t,n=>{mn(s,e,n,r[0],o)});else if(r.kind!==void 0)switch(r.kind){case"option":{t==null?o.writeU8(0):(o.writeU8(1),mn(s,e,t,r.type,o));break}case"map":{o.writeU32(t.size),t.forEach((n,i)=>{mn(s,e,i,r.key,o),mn(s,e,n,r.value,o)});break}default:throw new et(`FieldType ${r} unrecognized`)}else Sd(s,t,o)}catch(n){throw n instanceof et&&n.addToFieldPath(e),n}}function Sd(s,e,t){if(typeof e.borshSerialize=="function"){e.borshSerialize(t);return}let r=s.get(e.constructor);if(!r)throw new et(`Class ${e.constructor.name} is missing in schema`);if(r.kind==="struct")r.fields.map(([o,n])=>{mn(s,o,e[o],n,t)});else if(r.kind==="enum"){let o=e[r.field];for(let n=0;n<r.values.length;++n){let[i,c]=r.values[n];if(i===o){t.writeU8(n),mn(s,i,e[i],c,t);break}}}else throw new et(`Unexpected schema kind: ${r.kind} for ${e.constructor.name}`)}function O0(s,e,t=xi){let r=new t;return Sd(s,e,r),r.toArray()}Le.serialize=O0;function gn(s,e,t,r){try{if(typeof t=="string")return r[`read${_d(t)}`]();if(t instanceof Array){if(typeof t[0]=="number")return r.readFixedArray(t[0]);if(typeof t[1]=="number"){let o=[];for(let n=0;n<t[1];n++)o.push(gn(s,null,t[0],r));return o}else return r.readArray(()=>gn(s,e,t[0],r))}if(t.kind==="option")return r.readU8()?gn(s,e,t.type,r):void 0;if(t.kind==="map"){let o=new Map,n=r.readU32();for(let i=0;i<n;i++){let c=gn(s,e,t.key,r),l=gn(s,e,t.value,r);o.set(c,l)}return o}return Tc(s,t,r)}catch(o){throw o instanceof et&&o.addToFieldPath(e),o}}function Tc(s,e,t){if(typeof e.borshDeserialize=="function")return e.borshDeserialize(t);let r=s.get(e);if(!r)throw new et(`Class ${e.name} is missing in schema`);if(r.kind==="struct"){let o={};for(let[n,i]of s.get(e).fields)o[n]=gn(s,n,i,t);return new e(o)}if(r.kind==="enum"){let o=t.readU8();if(o>=r.values.length)throw new et(`Enum index: ${o} is out of range`);let[n,i]=r.values[o],c=gn(s,n,i,t);return new e({[n]:c})}throw new et(`Unexpected schema kind: ${r.kind} for ${e.constructor.name}`)}function N0(s,e,t,r=lt){let o=new r(t),n=Tc(s,e,o);if(o.offset<t.length)throw new et(`Unexpected ${t.length-o.offset} bytes after deserialized data`);return n}Le.deserialize=N0;function F0(s,e,t,r=lt){let o=new r(t);return Tc(s,e,o)}Le.deserializeUnchecked=F0});var Uc=oe(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.s16=E.s8=E.nu64be=E.u48be=E.u40be=E.u32be=E.u24be=E.u16be=E.nu64=E.u48=E.u40=E.u32=E.u24=E.u16=E.u8=E.offset=E.greedy=E.Constant=E.UTF8=E.CString=E.Blob=E.Boolean=E.BitField=E.BitStructure=E.VariantLayout=E.Union=E.UnionLayoutDiscriminator=E.UnionDiscriminator=E.Structure=E.Sequence=E.DoubleBE=E.Double=E.FloatBE=E.Float=E.NearInt64BE=E.NearInt64=E.NearUInt64BE=E.NearUInt64=E.IntBE=E.Int=E.UIntBE=E.UInt=E.OffsetLayout=E.GreedyCount=E.ExternalLayout=E.bindConstructorLayout=E.nameWithProperty=E.Layout=E.uint8ArrayToBuffer=E.checkUint8Array=void 0;E.constant=E.utf8=E.cstr=E.blob=E.unionLayoutDiscriminator=E.union=E.seq=E.bits=E.struct=E.f64be=E.f64=E.f32be=E.f32=E.ns64be=E.s48be=E.s40be=E.s32be=E.s24be=E.s16be=E.ns64=E.s48=E.s40=E.s32=E.s24=void 0;var Nc=ae("buffer");function Xn(s){if(!(s instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}E.checkUint8Array=Xn;function we(s){return Xn(s),Nc.Buffer.from(s.buffer,s.byteOffset,s.length)}E.uint8ArrayToBuffer=we;var ke=class{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){let t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}};E.Layout=ke;function Fc(s,e){return e.property?s+"["+e.property+"]":s}E.nameWithProperty=Fc;function U0(s,e){if(typeof s!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(s,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof ke))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");s.layout_=e,e.boundConstructor_=s,e.makeDestinationObject=()=>new s,Object.defineProperty(s.prototype,"encode",{value(t,r){return e.encode(this,t,r)},writable:!0}),Object.defineProperty(s,"decode",{value(t,r){return e.decode(t,r)},writable:!0})}E.bindConstructorLayout=U0;var ot=class extends ke{isCount(){throw new Error("ExternalLayout is abstract")}};E.ExternalLayout=ot;var vi=class extends ot{constructor(e=1,t){if(!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t=0){Xn(e);let r=e.length-t;return Math.floor(r/this.elementSpan)}encode(e,t,r){return 0}};E.GreedyCount=vi;var Os=class extends ot{constructor(e,t=0,r){if(!(e instanceof ke))throw new TypeError("layout must be a Layout");if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,r||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof pt||this.layout instanceof xt}decode(e,t=0){return this.layout.decode(e,t+this.offset)}encode(e,t,r=0){return this.layout.encode(e,t,r+this.offset)}};E.OffsetLayout=Os;var pt=class extends ke{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return we(e).readUIntLE(t,this.span)}encode(e,t,r=0){return we(t).writeUIntLE(e,r,this.span),this.span}};E.UInt=pt;var xt=class extends ke{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return we(e).readUIntBE(t,this.span)}encode(e,t,r=0){return we(t).writeUIntBE(e,r,this.span),this.span}};E.UIntBE=xt;var Sr=class extends ke{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return we(e).readIntLE(t,this.span)}encode(e,t,r=0){return we(t).writeIntLE(e,r,this.span),this.span}};E.Int=Sr;var qr=class extends ke{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return we(e).readIntBE(t,this.span)}encode(e,t,r=0){return we(t).writeIntBE(e,r,this.span),this.span}};E.IntBE=qr;var Oc=Math.pow(2,32);function $i(s){let e=Math.floor(s/Oc),t=s-e*Oc;return{hi32:e,lo32:t}}function qi(s,e){return s*Oc+e}var Ei=class extends ke{constructor(e){super(8,e)}decode(e,t=0){let r=we(e),o=r.readUInt32LE(t),n=r.readUInt32LE(t+4);return qi(n,o)}encode(e,t,r=0){let o=$i(e),n=we(t);return n.writeUInt32LE(o.lo32,r),n.writeUInt32LE(o.hi32,r+4),8}};E.NearUInt64=Ei;var Ai=class extends ke{constructor(e){super(8,e)}decode(e,t=0){let r=we(e),o=r.readUInt32BE(t),n=r.readUInt32BE(t+4);return qi(o,n)}encode(e,t,r=0){let o=$i(e),n=we(t);return n.writeUInt32BE(o.hi32,r),n.writeUInt32BE(o.lo32,r+4),8}};E.NearUInt64BE=Ai;var Ii=class extends ke{constructor(e){super(8,e)}decode(e,t=0){let r=we(e),o=r.readUInt32LE(t),n=r.readInt32LE(t+4);return qi(n,o)}encode(e,t,r=0){let o=$i(e),n=we(t);return n.writeUInt32LE(o.lo32,r),n.writeInt32LE(o.hi32,r+4),8}};E.NearInt64=Ii;var Bi=class extends ke{constructor(e){super(8,e)}decode(e,t=0){let r=we(e),o=r.readInt32BE(t),n=r.readUInt32BE(t+4);return qi(o,n)}encode(e,t,r=0){let o=$i(e),n=we(t);return n.writeInt32BE(o.hi32,r),n.writeUInt32BE(o.lo32,r+4),8}};E.NearInt64BE=Bi;var Li=class extends ke{constructor(e){super(4,e)}decode(e,t=0){return we(e).readFloatLE(t)}encode(e,t,r=0){return we(t).writeFloatLE(e,r),4}};E.Float=Li;var Ri=class extends ke{constructor(e){super(4,e)}decode(e,t=0){return we(e).readFloatBE(t)}encode(e,t,r=0){return we(t).writeFloatBE(e,r),4}};E.FloatBE=Ri;var Ci=class extends ke{constructor(e){super(8,e)}decode(e,t=0){return we(e).readDoubleLE(t)}encode(e,t,r=0){return we(t).writeDoubleLE(e,r),8}};E.Double=Ci;var Pi=class extends ke{constructor(e){super(8,e)}decode(e,t=0){return we(e).readDoubleBE(t)}encode(e,t,r=0){return we(t).writeDoubleBE(e,r),8}};E.DoubleBE=Pi;var Ti=class extends ke{constructor(e,t,r){if(!(e instanceof ke))throw new TypeError("elementLayout must be a Layout");if(!(t instanceof ot&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let o=-1;!(t instanceof ot)&&0<e.span&&(o=t*e.span),super(o,r),this.elementLayout=e,this.count=t}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0,o=this.count;if(o instanceof ot&&(o=o.decode(e,t)),0<this.elementLayout.span)r=o*this.elementLayout.span;else{let n=0;for(;n<o;)r+=this.elementLayout.getSpan(e,t+r),++n}return r}decode(e,t=0){let r=[],o=0,n=this.count;for(n instanceof ot&&(n=n.decode(e,t));o<n;)r.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),o+=1;return r}encode(e,t,r=0){let o=this.elementLayout,n=e.reduce((i,c)=>i+o.encode(c,t,r+i),0);return this.count instanceof ot&&this.count.encode(e.length,t,r),n}};E.Sequence=Ti;var Oi=class extends ke{constructor(e,t,r){if(!(Array.isArray(e)&&e.reduce((n,i)=>n&&i instanceof ke,!0)))throw new TypeError("fields must be array of Layout instances");typeof t=="boolean"&&r===void 0&&(r=t,t=void 0);for(let n of e)if(0>n.span&&n.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let o=-1;try{o=e.reduce((n,i)=>n+i.getSpan(),0)}catch{}super(o,t),this.fields=e,this.decodePrefixes=!!r}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce((o,n)=>{let i=n.getSpan(e,t);return t+=i,o+i},0)}catch{throw new RangeError("indeterminate span")}return r}decode(e,t=0){Xn(e);let r=this.makeDestinationObject();for(let o of this.fields)if(o.property!==void 0&&(r[o.property]=o.decode(e,t)),t+=o.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return r}encode(e,t,r=0){let o=r,n=0,i=0;for(let c of this.fields){let l=c.span;if(i=0<l?l:0,c.property!==void 0){let p=e[c.property];p!==void 0&&(i=c.encode(p,t,r),0>l&&(l=c.getSpan(t,r)))}n=r,r+=l}return n+i-o}fromArray(e){let t=this.makeDestinationObject();for(let r of this.fields)r.property!==void 0&&0<e.length&&(t[r.property]=e.shift());return t}layoutFor(e){if(typeof e!="string")throw new TypeError("property must be string");for(let t of this.fields)if(t.property===e)return t}offsetOf(e){if(typeof e!="string")throw new TypeError("property must be string");let t=0;for(let r of this.fields){if(r.property===e)return t;0>r.span?t=-1:0<=t&&(t+=r.span)}}};E.Structure=Oi;var Ns=class{constructor(e){this.property=e}decode(e,t){throw new Error("UnionDiscriminator is abstract")}encode(e,t,r){throw new Error("UnionDiscriminator is abstract")}};E.UnionDiscriminator=Ns;var Gn=class extends Ns{constructor(e,t){if(!(e instanceof ot&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,r){return this.layout.encode(e,t,r)}};E.UnionLayoutDiscriminator=Gn;var Fs=class extends ke{constructor(e,t,r){let o;if(e instanceof pt||e instanceof xt)o=new Gn(new Os(e));else if(e instanceof ot&&e.isCount())o=new Gn(e);else if(e instanceof Ns)o=e;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(t===void 0&&(t=null),!(t===null||t instanceof ke))throw new TypeError("defaultLayout must be null or a Layout");if(t!==null){if(0>t.span)throw new Error("defaultLayout must have constant span");t.property===void 0&&(t=t.replicate("content"))}let n=-1;t&&(n=t.span,0<=n&&(e instanceof pt||e instanceof xt)&&(n+=o.layout.span)),super(n,r),this.discriminator=o,this.usesPrefixDiscriminator=e instanceof pt||e instanceof xt,this.defaultLayout=t,this.registry={};let i=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(c){return i(c)},this.configGetSourceVariant=function(c){i=c.bind(this)}}getSpan(e,t=0){if(0<=this.span)return this.span;let r=this.getVariant(e,t);if(!r)throw new Error("unable to determine span for unrecognized variant");return r.getSpan(e,t)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;let t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||t.property&&Object.prototype.hasOwnProperty.call(e,t.property)))return t}else for(let t in this.registry){let r=this.registry[t];if(r.property&&Object.prototype.hasOwnProperty.call(e,r.property))return r}throw new Error("unable to infer src variant")}decode(e,t=0){let r,o=this.discriminator,n=o.decode(e,t),i=this.registry[n];if(i===void 0){let c=this.defaultLayout,l=0;this.usesPrefixDiscriminator&&(l=o.layout.span),r=this.makeDestinationObject(),r[o.property]=n,r[c.property]=c.decode(e,t+l)}else r=i.decode(e,t);return r}encode(e,t,r=0){let o=this.getSourceVariant(e);if(o===void 0){let n=this.discriminator,i=this.defaultLayout,c=0;return this.usesPrefixDiscriminator&&(c=n.layout.span),n.encode(e[n.property],t,r),c+i.encode(e[i.property],t,r+c)}return o.encode(e,t,r)}addVariant(e,t,r){let o=new Ni(this,e,t,r);return this.registry[e]=o,o}getVariant(e,t=0){let r;return e instanceof Uint8Array?r=this.discriminator.decode(e,t):r=e,this.registry[r]}};E.Union=Fs;var Ni=class extends ke{constructor(e,t,r,o){if(!(e instanceof Fs))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw new TypeError("variant must be a (non-negative) integer");if(typeof r=="string"&&o===void 0&&(o=r,r=null),r){if(!(r instanceof ke))throw new TypeError("layout must be a Layout");if(e.defaultLayout!==null&&0<=r.span&&r.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof o!="string")throw new TypeError("variant must have a String property")}let n=e.span;0>e.span&&(n=r?r.span:0,0<=n&&e.usesPrefixDiscriminator&&(n+=e.discriminator.layout.span)),super(n,o),this.union=e,this.variant=t,this.layout=r||null}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span);let o=0;return this.layout&&(o=this.layout.getSpan(e,t+r)),r+o}decode(e,t=0){let r=this.makeDestinationObject();if(this!==this.union.getVariant(e,t))throw new Error("variant mismatch");let o=0;return this.union.usesPrefixDiscriminator&&(o=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(e,t+o):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(e,t,r=0){let o=0;if(this.union.usesPrefixDiscriminator&&(o=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,r);let n=o;if(this.layout&&(this.layout.encode(e[this.property],t,r+o),n+=this.layout.getSpan(t,r+o),0<=this.union.span&&n>this.union.span))throw new Error("encoded variant overruns containing union");return n}fromArray(e){if(this.layout)return this.layout.fromArray(e)}};E.VariantLayout=Ni;function Vn(s){return 0>s&&(s+=4294967296),s}var Us=class extends ke{constructor(e,t,r){if(!(e instanceof pt||e instanceof xt))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof t=="string"&&r===void 0&&(r=t,t=!1),4<e.span)throw new RangeError("word cannot exceed 32 bits");super(e.span,r),this.word=e,this.msb=!!t,this.fields=[];let o=0;this._packedSetValue=function(n){return o=Vn(n),this},this._packedGetValue=function(){return o}}decode(e,t=0){let r=this.makeDestinationObject(),o=this.word.decode(e,t);this._packedSetValue(o);for(let n of this.fields)n.property!==void 0&&(r[n.property]=n.decode(e));return r}encode(e,t,r=0){let o=this.word.decode(t,r);this._packedSetValue(o);for(let n of this.fields)if(n.property!==void 0){let i=e[n.property];i!==void 0&&n.encode(i)}return this.word.encode(this._packedGetValue(),t,r)}addField(e,t){let r=new Ds(this,e,t);return this.fields.push(r),r}addBoolean(e){let t=new Fi(this,e);return this.fields.push(t),t}fieldFor(e){if(typeof e!="string")throw new TypeError("property must be string");for(let t of this.fields)if(t.property===e)return t}};E.BitStructure=Us;var Ds=class{constructor(e,t,r){if(!(e instanceof Us))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(t)||0>=t)throw new TypeError("bits must be positive integer");let o=8*e.span,n=e.fields.reduce((i,c)=>i+c.bits,0);if(t+n>o)throw new Error("bits too long for span remainder ("+(o-n)+" of "+o+" remain)");this.container=e,this.bits=t,this.valueMask=(1<<t)-1,t===32&&(this.valueMask=4294967295),this.start=n,this.container.msb&&(this.start=o-n-t),this.wordMask=Vn(this.valueMask<<this.start),this.property=r}decode(e,t){let r=this.container._packedGetValue();return Vn(r&this.wordMask)>>>this.start}encode(e){if(typeof e!="number"||!Number.isInteger(e)||e!==Vn(e&this.valueMask))throw new TypeError(Fc("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let t=this.container._packedGetValue(),r=Vn(e<<this.start);this.container._packedSetValue(Vn(t&~this.wordMask)|r)}};E.BitField=Ds;var Fi=class extends Ds{constructor(e,t){super(e,1,t)}decode(e,t){return!!super.decode(e,t)}encode(e){typeof e=="boolean"&&(e=+e),super.encode(e)}};E.Boolean=Fi;var Ui=class extends ke{constructor(e,t){if(!(e instanceof ot&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;e instanceof ot||(r=e),super(r,t),this.length=e}getSpan(e,t){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),r}decode(e,t=0){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),we(e).slice(t,t+r)}encode(e,t,r){let o=this.length;if(this.length instanceof ot&&(o=e.length),!(e instanceof Uint8Array&&o===e.length))throw new TypeError(Fc("Blob.encode",this)+" requires (length "+o+") Uint8Array as src");if(r+o>t.length)throw new RangeError("encoding overruns Uint8Array");let n=we(e);return we(t).write(n.toString("hex"),r,o,"hex"),this.length instanceof ot&&this.length.encode(o,t,r),o}};E.Blob=Ui;var Di=class extends ke{constructor(e){super(-1,e)}getSpan(e,t=0){Xn(e);let r=t;for(;r<e.length&&e[r]!==0;)r+=1;return 1+r-t}decode(e,t=0){let r=this.getSpan(e,t);return we(e).slice(t,t+r-1).toString("utf-8")}encode(e,t,r=0){typeof e!="string"&&(e=String(e));let o=Nc.Buffer.from(e,"utf8"),n=o.length;if(r+n>t.length)throw new RangeError("encoding overruns Buffer");let i=we(t);return o.copy(i,r),i[r+n]=0,n+1}};E.CString=Di;var Mi=class extends ke{constructor(e,t){if(typeof e=="string"&&t===void 0&&(t=e,e=void 0),e===void 0)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e,t=0){return Xn(e),e.length-t}decode(e,t=0){let r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return we(e).slice(t,t+r).toString("utf-8")}encode(e,t,r=0){typeof e!="string"&&(e=String(e));let o=Nc.Buffer.from(e,"utf8"),n=o.length;if(0<=this.maxSpan&&this.maxSpan<n)throw new RangeError("text length exceeds maxSpan");if(r+n>t.length)throw new RangeError("encoding overruns Buffer");return o.copy(we(t),r),n}};E.UTF8=Mi;var zi=class extends ke{constructor(e,t){super(0,t),this.value=e}decode(e,t){return this.value}encode(e,t,r){return 0}};E.Constant=zi;E.greedy=(s,e)=>new vi(s,e);E.offset=(s,e,t)=>new Os(s,e,t);E.u8=s=>new pt(1,s);E.u16=s=>new pt(2,s);E.u24=s=>new pt(3,s);E.u32=s=>new pt(4,s);E.u40=s=>new pt(5,s);E.u48=s=>new pt(6,s);E.nu64=s=>new Ei(s);E.u16be=s=>new xt(2,s);E.u24be=s=>new xt(3,s);E.u32be=s=>new xt(4,s);E.u40be=s=>new xt(5,s);E.u48be=s=>new xt(6,s);E.nu64be=s=>new Ai(s);E.s8=s=>new Sr(1,s);E.s16=s=>new Sr(2,s);E.s24=s=>new Sr(3,s);E.s32=s=>new Sr(4,s);E.s40=s=>new Sr(5,s);E.s48=s=>new Sr(6,s);E.ns64=s=>new Ii(s);E.s16be=s=>new qr(2,s);E.s24be=s=>new qr(3,s);E.s32be=s=>new qr(4,s);E.s40be=s=>new qr(5,s);E.s48be=s=>new qr(6,s);E.ns64be=s=>new Bi(s);E.f32=s=>new Li(s);E.f32be=s=>new Ri(s);E.f64=s=>new Ci(s);E.f64be=s=>new Pi(s);E.struct=(s,e,t)=>new Oi(s,e,t);E.bits=(s,e,t)=>new Us(s,e,t);E.seq=(s,e,t)=>new Ti(s,e,t);E.union=(s,e,t)=>new Fs(s,e,t);E.unionLayoutDiscriminator=(s,e)=>new Gn(s,e);E.blob=(s,e)=>new Ui(s,e);E.cstr=s=>new Di(s);E.utf8=(s,e)=>new Mi(s,e);E.constant=(s,e)=>new zi(s,e)});var vd=oe((vx,xd)=>{var Wi=ae("path").sep||"/";xd.exports=D0;function D0(s){if(typeof s!="string"||s.length<=7||s.substring(0,7)!="file://")throw new TypeError("must pass in a file:// URI to convert to a file path");var e=decodeURI(s.substring(7)),t=e.indexOf("/"),r=e.substring(0,t),o=e.substring(t+1);return r=="localhost"&&(r=""),r&&(r=Wi+Wi+r),o=o.replace(/^(.+)\|/,"$1:"),Wi=="\\"&&(o=o.replace(/\//g,"\\")),/^.+\:/.test(o)||(o=Wi+o),r+o}});var Bd=oe((Yn,Id)=>{var Dc=ae("fs"),Hi=ae("path"),M0=vd(),Ki=Hi.join,z0=Hi.dirname,Ed=Dc.accessSync&&function(s){try{Dc.accessSync(s)}catch{return!1}return!0}||Dc.existsSync||Hi.existsSync,Ad={arrow:process.env.NODE_BINDINGS_ARROW||" \u2192 ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};function $0(s){typeof s=="string"?s={bindings:s}:s||(s={}),Object.keys(Ad).map(function(l){l in s||(s[l]=Ad[l])}),s.module_root||(s.module_root=Yn.getRoot(Yn.getFileName())),Hi.extname(s.bindings)!=".node"&&(s.bindings+=".node");for(var e=typeof __webpack_require__=="function"?__non_webpack_require__:ae,t=[],r=0,o=s.try.length,n,i,c;r<o;r++){n=Ki.apply(null,s.try[r].map(function(l){return s[l]||l})),t.push(n);try{return i=s.path?e.resolve(n):e(n),s.path||(i.path=n),i}catch(l){if(l.code!=="MODULE_NOT_FOUND"&&l.code!=="QUALIFIED_PATH_RESOLUTION_FAILED"&&!/not find/i.test(l.message))throw l}}throw c=new Error(`Could not locate the bindings file. Tried:
3
3
  `+t.map(function(l){return s.arrow+l}).join(`
4
4
  `)),c.tries=t,c}Id.exports=Yn=$0;Yn.getFileName=function(e){var t=Error.prepareStackTrace,r=Error.stackTraceLimit,o={},n;Error.stackTraceLimit=10,Error.prepareStackTrace=function(c,l){for(var p=0,f=l.length;p<f;p++)if(n=l[p].getFileName(),n!==__filename)if(e){if(n!==e)return}else return},Error.captureStackTrace(o),o.stack,Error.prepareStackTrace=t,Error.stackTraceLimit=r;var i="file://";return n.indexOf(i)===0&&(n=M0(n)),n};Yn.getRoot=function(e){for(var t=z0(e),r;;){if(t==="."&&(t=process.cwd()),Ed(Ki(t,"package.json"))||Ed(Ki(t,"node_modules")))return t;if(r===t)throw new Error('Could not find module root given file: "'+e+'". Do you have a `package.json` file? ');r=t,t=Ki(t,"..")}}});var Ld=oe(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});var kr;try{kr=Bd()("bigint_buffer")}catch{console.warn("bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)")}function q0(s){if(kr===void 0){let e=Buffer.from(s);e.reverse();let t=e.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}return kr.toBigInt(s,!1)}Jn.toBigIntLE=q0;function W0(s){if(kr===void 0){let e=s.toString("hex");return e.length===0?BigInt(0):BigInt(`0x${e}`)}return kr.toBigInt(s,!0)}Jn.toBigIntBE=W0;function K0(s,e){if(kr===void 0){let t=s.toString(16),r=Buffer.from(t.padStart(e*2,"0").slice(0,e*2),"hex");return r.reverse(),r}return kr.fromBigInt(s,Buffer.allocUnsafe(e),!1)}Jn.toBufferLE=K0;function H0(s,e){if(kr===void 0){let t=s.toString(16);return Buffer.from(t.padStart(e*2,"0").slice(0,e*2),"hex")}return kr.fromBigInt(s,Buffer.allocUnsafe(e),!0)}Jn.toBufferBE=H0});function j0(s){return Wr(s)&&typeof s[Symbol.iterator]=="function"}function Wr(s){return typeof s=="object"&&s!=null}function Vt(s){return typeof s=="string"?JSON.stringify(s):""+s}function V0(s){let{done:e,value:t}=s.next();return e?void 0:t}function G0(s,e,t,r){if(s===!0)return;s===!1?s={}:typeof s=="string"&&(s={message:s});let{path:o,branch:n}=e,{type:i}=t,{refinement:c,message:l="Expected a value of type `"+i+"`"+(c?" with refinement `"+c+"`":"")+", but received: `"+Vt(r)+"`"}=s;return{value:r,type:i,refinement:c,key:o[o.length-1],path:o,branch:n,...s,message:l}}function*Rd(s,e,t,r){j0(s)||(s=[s]);for(let o of s){let n=G0(o,e,t,r);n&&(yield n)}}function*zc(s,e,t={}){let{path:r=[],branch:o=[s],coerce:n=!1,mask:i=!1}=t,c={path:r,branch:o};if(n&&(s=e.coercer(s,c),i&&e.type!=="type"&&Wr(e.schema)&&Wr(s)&&!Array.isArray(s)))for(let p in s)e.schema[p]===void 0&&delete s[p];let l=!0;for(let p of e.validator(s,c))l=!1,yield[p,void 0];for(let[p,f,b]of e.entries(s,c)){let _=zc(f,b,{path:p===void 0?r:[...r,p],branch:p===void 0?o:[...o,f],coerce:n,mask:i});for(let g of _)g[0]?(l=!1,yield[g[0],void 0]):n&&(f=g[1],p===void 0?s=f:s instanceof Map?s.set(p,f):s instanceof Set?s.add(f):Wr(s)&&(s[p]=f))}if(l)for(let p of e.refiner(s,c))l=!1,yield[p,void 0];l&&(yield[void 0,s])}function $c(s,e){let t=Ms(s,e);if(t[0])throw t[0]}function F(s,e){let t=Ms(s,e,{coerce:!0});if(t[0])throw t[0];return t[1]}function X0(s,e){let t=Ms(s,e,{coerce:!0,mask:!0});if(t[0])throw t[0];return t[1]}function Cd(s,e){return!Ms(s,e)[0]}function Ms(s,e,t={}){let r=zc(s,e,t),o=V0(r);return o[0]?[new Mc(o[0],function*(){for(let i of r)i[0]&&(yield i[0])}),void 0]:[void 0,o[1]]}function bn(s,e){return new Ot({type:s,schema:null,validator:e})}function Pd(){return bn("any",()=>!0)}function z(s){return new Ot({type:"array",schema:s,*entries(e){if(s&&Array.isArray(e))for(let[t,r]of e.entries())yield[t,r,s]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||"Expected an array value, but received: "+Vt(e)}})}function Gt(){return bn("boolean",s=>typeof s=="boolean")}function ji(s){return bn("instance",e=>e instanceof s||"Expected a `"+s.name+"` instance, but received: "+Vt(e))}function Fe(s){let e=Vt(s),t=typeof s;return new Ot({type:"literal",schema:t==="string"||t==="number"||t==="boolean"?s:null,validator(r){return r===s||"Expected the literal `"+e+"`, but received: "+Vt(r)}})}function Y0(){return bn("never",()=>!1)}function M(s){return new Ot({...s,validator:(e,t)=>e===null||s.validator(e,t),refiner:(e,t)=>e===null||s.refiner(e,t)})}function x(){return bn("number",s=>typeof s=="number"&&!isNaN(s)||"Expected a number, but received: "+Vt(s))}function Q(s){return new Ot({...s,validator:(e,t)=>e===void 0||s.validator(e,t),refiner:(e,t)=>e===void 0||s.refiner(e,t)})}function qc(s,e){return new Ot({type:"record",schema:null,*entries(t){if(Wr(t))for(let r in t){let o=t[r];yield[r,r,s],yield[r,o,e]}},validator(t){return Wr(t)||"Expected an object, but received: "+Vt(t)}})}function N(){return bn("string",s=>typeof s=="string"||"Expected a string, but received: "+Vt(s))}function Vi(s){let e=Y0();return new Ot({type:"tuple",schema:null,*entries(t){if(Array.isArray(t)){let r=Math.max(s.length,t.length);for(let o=0;o<r;o++)yield[o,t[o],s[o]||e]}},validator(t){return Array.isArray(t)||"Expected an array, but received: "+Vt(t)}})}function R(s){let e=Object.keys(s);return new Ot({type:"type",schema:s,*entries(t){if(Wr(t))for(let r of e)yield[r,t[r],s[r]]},validator(t){return Wr(t)||"Expected an object, but received: "+Vt(t)}})}function ft(s){let e=s.map(t=>t.type).join(" | ");return new Ot({type:"union",schema:null,validator(t,r){let o=[];for(let n of s){let[...i]=zc(t,n,r),[c]=i;if(c[0])for(let[l]of i)l&&o.push(l);else return[]}return["Expected the value to satisfy a union of `"+e+"`, but received: "+Vt(t),...o]}})}function Zn(){return bn("unknown",()=>!0)}function Qn(s,e,t){return new Ot({...s,coercer:(r,o)=>Cd(r,e)?s.coercer(t(r,o),o):s.coercer(r,o)})}var Mc,Ot,Td=We(()=>{Mc=class extends TypeError{constructor(e,t){let r,{message:o,...n}=e,{path:i}=e,c=i.length===0?o:"At path: "+i.join(".")+" -- "+o;super(c),Object.assign(this,n),this.name=this.constructor.name,this.failures=()=>{var l;return(l=r)!=null?l:r=[e,...t()]}}};Ot=class{constructor(e){let{type:t,schema:r,validator:o,refiner:n,coercer:i=l=>l,entries:c=function*(){}}=e;this.type=t,this.schema=r,this.entries=c,this.coercer=i,o?this.validator=(l,p)=>{let f=o(l,p);return Rd(f,p,this,l)}:this.validator=()=>[],n?this.refiner=(l,p)=>{let f=n(l,p);return Rd(f,p,this,l)}:this.refiner=()=>[]}assert(e){return $c(e,this)}create(e){return F(e,this)}is(e){return Cd(e,this)}mask(e){return X0(e,this)}validate(e,t={}){return Ms(e,this,t)}}});import J0 from"crypto";function zs(){return Gi>Xi.length-16&&(J0.randomFillSync(Xi),Gi=0),Xi.slice(Gi,Gi+=16)}var Xi,Gi,Wc=We(()=>{Xi=new Uint8Array(256),Gi=Xi.length});var Od,Nd=We(()=>{Od=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i});function Z0(s){return typeof s=="string"&&Od.test(s)}var Kr,$s=We(()=>{Nd();Kr=Z0});function Q0(s,e=0){let t=(tt[s[e+0]]+tt[s[e+1]]+tt[s[e+2]]+tt[s[e+3]]+"-"+tt[s[e+4]]+tt[s[e+5]]+"-"+tt[s[e+6]]+tt[s[e+7]]+"-"+tt[s[e+8]]+tt[s[e+9]]+"-"+tt[s[e+10]]+tt[s[e+11]]+tt[s[e+12]]+tt[s[e+13]]+tt[s[e+14]]+tt[s[e+15]]).toLowerCase();if(!Kr(t))throw TypeError("Stringified UUID is invalid");return t}var tt,Hr,qs=We(()=>{$s();tt=[];for(let s=0;s<256;++s)tt.push((s+256).toString(16).substr(1));Hr=Q0});function eb(s,e,t){let r=e&&t||0,o=e||new Array(16);s=s||{};let n=s.node||Fd,i=s.clockseq!==void 0?s.clockseq:Kc;if(n==null||i==null){let _=s.random||(s.rng||zs)();n==null&&(n=Fd=[_[0]|1,_[1],_[2],_[3],_[4],_[5]]),i==null&&(i=Kc=(_[6]<<8|_[7])&16383)}let c=s.msecs!==void 0?s.msecs:Date.now(),l=s.nsecs!==void 0?s.nsecs:jc+1,p=c-Hc+(l-jc)/1e4;if(p<0&&s.clockseq===void 0&&(i=i+1&16383),(p<0||c>Hc)&&s.nsecs===void 0&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Hc=c,jc=l,Kc=i,c+=122192928e5;let f=((c&268435455)*1e4+l)%4294967296;o[r++]=f>>>24&255,o[r++]=f>>>16&255,o[r++]=f>>>8&255,o[r++]=f&255;let b=c/4294967296*1e4&268435455;o[r++]=b>>>8&255,o[r++]=b&255,o[r++]=b>>>24&15|16,o[r++]=b>>>16&255,o[r++]=i>>>8|128,o[r++]=i&255;for(let _=0;_<6;++_)o[r+_]=n[_];return e||Hr(o)}var Fd,Kc,Hc,jc,Ud,Dd=We(()=>{Wc();qs();Hc=0,jc=0;Ud=eb});function tb(s){if(!Kr(s))throw TypeError("Invalid UUID");let e,t=new Uint8Array(16);return t[0]=(e=parseInt(s.slice(0,8),16))>>>24,t[1]=e>>>16&255,t[2]=e>>>8&255,t[3]=e&255,t[4]=(e=parseInt(s.slice(9,13),16))>>>8,t[5]=e&255,t[6]=(e=parseInt(s.slice(14,18),16))>>>8,t[7]=e&255,t[8]=(e=parseInt(s.slice(19,23),16))>>>8,t[9]=e&255,t[10]=(e=parseInt(s.slice(24,36),16))/1099511627776&255,t[11]=e/4294967296&255,t[12]=e>>>24&255,t[13]=e>>>16&255,t[14]=e>>>8&255,t[15]=e&255,t}var Yi,Vc=We(()=>{$s();Yi=tb});function rb(s){s=unescape(encodeURIComponent(s));let e=[];for(let t=0;t<s.length;++t)e.push(s.charCodeAt(t));return e}function Ji(s,e,t){function r(o,n,i,c){if(typeof o=="string"&&(o=rb(o)),typeof n=="string"&&(n=Yi(n)),n.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+o.length);if(l.set(n),l.set(o,n.length),l=t(l),l[6]=l[6]&15|e,l[8]=l[8]&63|128,i){c=c||0;for(let p=0;p<16;++p)i[c+p]=l[p];return i}return Hr(l)}try{r.name=s}catch{}return r.DNS=nb,r.URL=sb,r}var nb,sb,Gc=We(()=>{qs();Vc();nb="6ba7b810-9dad-11d1-80b4-00c04fd430c8",sb="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});import ob from"crypto";function ib(s){return Array.isArray(s)?s=Buffer.from(s):typeof s=="string"&&(s=Buffer.from(s,"utf8")),ob.createHash("md5").update(s).digest()}var Md,zd=We(()=>{Md=ib});var ab,$d,qd=We(()=>{Gc();zd();ab=Ji("v3",48,Md),$d=ab});function cb(s,e,t){s=s||{};let r=s.random||(s.rng||zs)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){t=t||0;for(let o=0;o<16;++o)e[t+o]=r[o];return e}return Hr(r)}var Wd,Kd=We(()=>{Wc();qs();Wd=cb});import ub from"crypto";function lb(s){return Array.isArray(s)?s=Buffer.from(s):typeof s=="string"&&(s=Buffer.from(s,"utf8")),ub.createHash("sha1").update(s).digest()}var Hd,jd=We(()=>{Hd=lb});var fb,Vd,Gd=We(()=>{Gc();jd();fb=Ji("v5",80,Hd),Vd=fb});var Xd,Yd=We(()=>{Xd="00000000-0000-0000-0000-000000000000"});function db(s){if(!Kr(s))throw TypeError("Invalid UUID");return parseInt(s.substr(14,1),16)}var Jd,Zd=We(()=>{$s();Jd=db});var Xc={};Ps(Xc,{NIL:()=>Xd,parse:()=>Yi,stringify:()=>Hr,v1:()=>Ud,v3:()=>$d,v4:()=>Wd,v5:()=>Vd,validate:()=>Kr,version:()=>Jd});var Yc=We(()=>{Dd();qd();Kd();Gd();Yd();Zd();$s();qs();Vc()});var eh=oe((pv,Qd)=>{"use strict";var hb=(Yc(),Ts(Xc)).v4,pb=function(s,e,t,r){if(typeof s!="string")throw new TypeError(s+" must be a string");r=r||{};let o=typeof r.version=="number"?r.version:2;if(o!==1&&o!==2)throw new TypeError(o+" must be 1 or 2");let n={method:s};if(o===2&&(n.jsonrpc="2.0"),e){if(typeof e!="object"&&!Array.isArray(e))throw new TypeError(e+" must be an object, array or omitted");n.params=e}if(typeof t>"u"){let i=typeof r.generator=="function"?r.generator:function(){return hb()};n.id=i(n,r)}else o===2&&t===null?r.notificationIdNull&&(n.id=null):n.id=t;return n};Qd.exports=pb});var rh=oe((yv,th)=>{"use strict";var yb=(Yc(),Ts(Xc)).v4,mb=eh(),Ws=function(s,e){if(!(this instanceof Ws))return new Ws(s,e);e||(e={}),this.options={reviver:typeof e.reviver<"u"?e.reviver:null,replacer:typeof e.replacer<"u"?e.replacer:null,generator:typeof e.generator<"u"?e.generator:function(){return yb()},version:typeof e.version<"u"?e.version:2,notificationIdNull:typeof e.notificationIdNull=="boolean"?e.notificationIdNull:!1},this.callServer=s};th.exports=Ws;Ws.prototype.request=function(s,e,t,r){let o=this,n=null,i=Array.isArray(s)&&typeof e=="function";if(this.options.version===1&&i)throw new TypeError("JSON-RPC 1.0 does not support batching");if(i||!i&&s&&typeof s=="object"&&typeof e=="function")r=e,n=s;else{typeof t=="function"&&(r=t,t=void 0);let p=typeof r=="function";try{n=mb(s,e,t,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(f){if(p)return r(f);throw f}if(!p)return n}let l;try{l=JSON.stringify(n,this.options.replacer)}catch(p){return r(p)}return this.callServer(l,function(p,f){o._parseResponse(p,f,r)}),n};Ws.prototype._parseResponse=function(s,e,t){if(s){t(s);return}if(!e)return t();let r;try{r=JSON.parse(e,this.options.reviver)}catch(o){return t(o)}if(t.length===3)if(Array.isArray(r)){let o=function(i){return typeof i.error<"u"},n=function(i){return!o(i)};return t(null,r.filter(o),r.filter(n))}else return t(null,r.error,r.result);t(null,r)}});var Qi=oe((mv,Jc)=>{"use strict";var gb=Object.prototype.hasOwnProperty,dt="~";function Ks(){}Object.create&&(Ks.prototype=Object.create(null),new Ks().__proto__||(dt=!1));function bb(s,e,t){this.fn=s,this.context=e,this.once=t||!1}function nh(s,e,t,r,o){if(typeof t!="function")throw new TypeError("The listener must be a function");var n=new bb(t,r||s,o),i=dt?dt+e:e;return s._events[i]?s._events[i].fn?s._events[i]=[s._events[i],n]:s._events[i].push(n):(s._events[i]=n,s._eventsCount++),s}function Zi(s,e){--s._eventsCount===0?s._events=new Ks:delete s._events[e]}function it(){this._events=new Ks,this._eventsCount=0}it.prototype.eventNames=function(){var e=[],t,r;if(this._eventsCount===0)return e;for(r in t=this._events)gb.call(t,r)&&e.push(dt?r.slice(1):r);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};it.prototype.listeners=function(e){var t=dt?dt+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,n=r.length,i=new Array(n);o<n;o++)i[o]=r[o].fn;return i};it.prototype.listenerCount=function(e){var t=dt?dt+e:e,r=this._events[t];return r?r.fn?1:r.length:0};it.prototype.emit=function(e,t,r,o,n,i){var c=dt?dt+e:e;if(!this._events[c])return!1;var l=this._events[c],p=arguments.length,f,b;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),p){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,o),!0;case 5:return l.fn.call(l.context,t,r,o,n),!0;case 6:return l.fn.call(l.context,t,r,o,n,i),!0}for(b=1,f=new Array(p-1);b<p;b++)f[b-1]=arguments[b];l.fn.apply(l.context,f)}else{var _=l.length,g;for(b=0;b<_;b++)switch(l[b].once&&this.removeListener(e,l[b].fn,void 0,!0),p){case 1:l[b].fn.call(l[b].context);break;case 2:l[b].fn.call(l[b].context,t);break;case 3:l[b].fn.call(l[b].context,t,r);break;case 4:l[b].fn.call(l[b].context,t,r,o);break;default:if(!f)for(g=1,f=new Array(p-1);g<p;g++)f[g-1]=arguments[g];l[b].fn.apply(l[b].context,f)}}return!0};it.prototype.on=function(e,t,r){return nh(this,e,t,r,!1)};it.prototype.once=function(e,t,r){return nh(this,e,t,r,!0)};it.prototype.removeListener=function(e,t,r,o){var n=dt?dt+e:e;if(!this._events[n])return this;if(!t)return Zi(this,n),this;var i=this._events[n];if(i.fn)i.fn===t&&(!o||i.once)&&(!r||i.context===r)&&Zi(this,n);else{for(var c=0,l=[],p=i.length;c<p;c++)(i[c].fn!==t||o&&!i[c].once||r&&i[c].context!==r)&&l.push(i[c]);l.length?this._events[n]=l.length===1?l[0]:l:Zi(this,n)}return this};it.prototype.removeAllListeners=function(e){var t;return e?(t=dt?dt+e:e,this._events[t]&&Zi(this,t)):(this._events=new Ks,this._eventsCount=0),this};it.prototype.off=it.prototype.removeListener;it.prototype.addListener=it.prototype.on;it.prefixed=dt;it.EventEmitter=it;typeof Jc<"u"&&(Jc.exports=it)});var sh=oe(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});es.createError=es.DefaultDataPack=void 0;var wb=new Map([[-32e3,"Event not provided"],[-32600,"Invalid Request"],[-32601,"Method not found"],[-32602,"Invalid params"],[-32603,"Internal error"],[-32604,"Params not found"],[-32605,"Method forbidden"],[-32606,"Event forbidden"],[-32700,"Parse error"]]),Zc=class{encode(e){return JSON.stringify(e)}decode(e){return JSON.parse(e)}};es.DefaultDataPack=Zc;function _b(s,e){let t={code:s,message:wb.get(s)||"Internal Server Error"};return e&&(t.data=e),t}es.createError=_b});var oh=oe(eu=>{"use strict";Object.defineProperty(eu,"__esModule",{value:!0});var Sb=Qi(),kb=sh(),Qc=class extends Sb.EventEmitter{address;rpc_id;queue;options;autoconnect;ready;reconnect;reconnect_timer_id;reconnect_interval;max_reconnects;rest_options;current_reconnects;generate_request_id;socket;webSocketFactory;dataPack;constructor(e,t="ws://localhost:8080",{autoconnect:r=!0,reconnect:o=!0,reconnect_interval:n=1e3,max_reconnects:i=5,...c}={},l,p){super(),this.webSocketFactory=e,this.queue={},this.rpc_id=0,this.address=t,this.autoconnect=r,this.ready=!1,this.reconnect=o,this.reconnect_timer_id=void 0,this.reconnect_interval=n,this.max_reconnects=i,this.rest_options=c,this.current_reconnects=0,this.generate_request_id=l||(()=>++this.rpc_id),p?this.dataPack=p:this.dataPack=new kb.DefaultDataPack,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(e,t,r,o){return!o&&typeof r=="object"&&(o=r,r=null),new Promise((n,i)=>{if(!this.ready)return i(new Error("socket not ready"));let c=this.generate_request_id(e,t),l={jsonrpc:"2.0",method:e,params:t||void 0,id:c};this.socket.send(this.dataPack.encode(l),o,p=>{if(p)return i(p);this.queue[c]={promise:[n,i]},r&&(this.queue[c].timeout=setTimeout(()=>{delete this.queue[c],i(new Error("reply timeout"))},r))})})}async login(e){let t=await this.call("rpc.login",e);if(!t)throw new Error("authentication failed");return t}async listMethods(){return await this.call("__listMethods")}notify(e,t){return new Promise((r,o)=>{if(!this.ready)return o(new Error("socket not ready"));let n={jsonrpc:"2.0",method:e,params:t};this.socket.send(this.dataPack.encode(n),i=>{if(i)return o(i);r()})})}async subscribe(e){typeof e=="string"&&(e=[e]);let t=await this.call("rpc.on",e);if(typeof e=="string"&&t[e]!=="ok")throw new Error("Failed subscribing to an event '"+e+"' with: "+t[e]);return t}async unsubscribe(e){typeof e=="string"&&(e=[e]);let t=await this.call("rpc.off",e);if(typeof e=="string"&&t[e]!=="ok")throw new Error("Failed unsubscribing from an event with: "+t);return t}close(e,t){this.socket.close(e||1e3,t)}setAutoReconnect(e){this.reconnect=e}setReconnectInterval(e){this.reconnect_interval=e}setMaxReconnects(e){this.max_reconnects=e}_connect(e,t){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(e,t),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:r})=>{r instanceof ArrayBuffer&&(r=Buffer.from(r).toString());try{r=this.dataPack.decode(r)}catch{return}if(r.notification&&this.listeners(r.notification).length){if(!Object.keys(r.params).length)return this.emit(r.notification);let o=[r.notification];if(r.params.constructor===Object)o.push(r.params);else for(let n=0;n<r.params.length;n++)o.push(r.params[n]);return Promise.resolve().then(()=>{this.emit.apply(this,o)})}if(!this.queue[r.id])return r.method?Promise.resolve().then(()=>{this.emit(r.method,r?.params)}):void 0;"error"in r=="result"in r&&this.queue[r.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[r.id].timeout&&clearTimeout(this.queue[r.id].timeout),r.error?this.queue[r.id].promise[1](r.error):this.queue[r.id].promise[0](r.result),delete this.queue[r.id]}),this.socket.addEventListener("error",r=>this.emit("error",r)),this.socket.addEventListener("close",({code:r,reason:o})=>{this.ready&&setTimeout(()=>this.emit("close",r,o),0),this.ready=!1,this.socket=void 0,r!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)&&(this.reconnect_timer_id=setTimeout(()=>this._connect(e,t),this.reconnect_interval)))})}};eu.default=Qc});var jr=oe((wv,ih)=>{"use strict";ih.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var kh=oe((_v,Sh)=>{var lh=ae("fs"),xr=ae("path"),fh=ae("os"),dh=typeof __webpack_require__=="function"?__non_webpack_require__:ae,xb=process.config&&process.config.variables||{},vb=!!process.env.PREBUILDS_ONLY,ah=process.versions.modules,tu=Ib()?"electron":Ab()?"node-webkit":"node",ru=process.env.npm_config_arch||fh.arch(),nu=process.env.npm_config_platform||fh.platform(),hh=process.env.LIBC||(Bb(nu)?"musl":"glibc"),su=process.env.ARM_VERSION||(ru==="arm64"?"8":xb.arm_version)||"",ph=(process.versions.uv||"").split(".")[0];Sh.exports=sr;function sr(s){return dh(sr.resolve(s))}sr.resolve=sr.path=function(s){s=xr.resolve(s||".");try{var e=dh(xr.join(s,"package.json")).name.toUpperCase().replace(/-/g,"_");process.env[e+"_PREBUILD"]&&(s=process.env[e+"_PREBUILD"])}catch{}if(!vb){var t=ch(xr.join(s,"build/Release"),uh);if(t)return t;var r=ch(xr.join(s,"build/Debug"),uh);if(r)return r}var o=c(s);if(o)return o;var n=c(xr.dirname(process.execPath));if(n)return n;var i=["platform="+nu,"arch="+ru,"runtime="+tu,"abi="+ah,"uv="+ph,su?"armv="+su:"","libc="+hh,"node="+process.versions.node,process.versions.electron?"electron="+process.versions.electron:"",typeof __webpack_require__=="function"?"webpack=true":""].filter(Boolean).join(" ");throw new Error("No native build was found for "+i+`
5
5
  loaded from: `+s+`
@@ -268,4 +268,4 @@ buffer-layout/lib/Layout.js:
268
268
  * @see {@link https://github.com/pabigot/buffer-layout|buffer-layout on GitHub}
269
269
  *)
270
270
  */
271
- //# sourceMappingURL=chunk-XYISSQEU.js.map
271
+ //# sourceMappingURL=chunk-BX4KG2ZR.js.map
@@ -1,3 +1,3 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import{D as f,S as I,T as A,U as k,V as C,b as u,g as R,h as B,j as s,r as F,u as E,v as T,w as O,x as S,z as N}from"./chunk-4QS3NUUW.js";import{d as j,g as P}from"./chunk-LLHU72AA.js";var g=f.connect("0x0",A),l=new u(["function name() view returns (bytes32)","function approve(address spender, uint256 value) returns (bool)","function totalSupply() view returns (uint256)","function transferFrom(address from, address to, uint256 value) returns (bool)","function decimals() view returns (uint8)","function balanceOf(address who) view returns (uint256)","function symbol() view returns (bytes32)","function transfer(address to, uint256 value) returns (bool)","function allowance(address owner, address spender) view returns (uint256)"]),m=class extends R{constructor(t){super(t),this.callStatic.contract=t}async name(t,e,a){try{if(e?.ethCallResults&&a){let n=l.encodeFunctionData("name",[]),r=C({context:a,calldata:n}),o=e.ethCallResults[r];if(o){let c=l.decodeFunctionResult("name",o).toArray();return c.length==1?c[0]:c}}return await this.contract.getFunction("name()")(t||{})}catch(n){let r=new Error().stack;throw s(n,void 0,r)}}async totalSupply(t,e,a){try{if(e?.ethCallResults&&a){let n=l.encodeFunctionData("totalSupply",[]),r=C({context:a,calldata:n}),o=e.ethCallResults[r];if(o){let c=l.decodeFunctionResult("totalSupply",o).toArray();return c.length==1?c[0]:c}}return await this.contract.getFunction("totalSupply()")(t||{})}catch(n){let r=new Error().stack;throw s(n,void 0,r)}}async decimals(t,e,a){try{if(e?.ethCallResults&&a){let n=l.encodeFunctionData("decimals",[]),r=C({context:a,calldata:n}),o=e.ethCallResults[r];if(o){let c=l.decodeFunctionResult("decimals",o).toArray();return c.length==1?c[0]:c}}return await this.contract.getFunction("decimals()")(t||{})}catch(n){let r=new Error().stack;throw s(n,void 0,r)}}async balanceOf(t,e,a,n){try{if(a?.ethCallResults&&n){let r=l.encodeFunctionData("balanceOf",[t]),o=C({context:n,calldata:r}),c=a.ethCallResults[o];if(c){let d=l.decodeFunctionResult("balanceOf",c).toArray();return d.length==1?d[0]:d}}return await this.contract.getFunction("balanceOf(address)")(t,e||{})}catch(r){let o=new Error().stack;throw s(r,void 0,o)}}async symbol(t,e,a){try{if(e?.ethCallResults&&a){let n=l.encodeFunctionData("symbol",[]),r=C({context:a,calldata:n}),o=e.ethCallResults[r];if(o){let c=l.decodeFunctionResult("symbol",o).toArray();return c.length==1?c[0]:c}}return await this.contract.getFunction("symbol()")(t||{})}catch(n){let r=new Error().stack;throw s(n,void 0,r)}}async allowance(t,e,a,n,r){try{if(n?.ethCallResults&&r){let o=l.encodeFunctionData("allowance",[t,e]),c=C({context:r,calldata:o}),d=n.ethCallResults[c];if(d){let h=l.decodeFunctionResult("allowance",d).toArray();return h.length==1?h[0]:h}}return await this.contract.getFunction("allowance(address,address)")(t,e,a||{})}catch(o){let c=new Error().stack;throw s(o,void 0,c)}}callStatic={contract:this.contract,async approve(t,e,a,n,r){try{if(n?.ethCallResults&&r){let o=l.encodeFunctionData("approve",[t,e]),c=C({context:r,calldata:o}),d=n.ethCallResults[c];if(d){let h=l.decodeFunctionResult("approve",d).toArray();return h.length==1?h[0]:h}}return await this.contract.getFunction("approve(address,uint256)").staticCall(t,e,a||{})}catch(o){let c=new Error().stack;throw s(o,void 0,c)}},async transferFrom(t,e,a,n,r,o){try{if(r?.ethCallResults&&o){let c=l.encodeFunctionData("transferFrom",[t,e,a]),d=C({context:o,calldata:c}),h=r.ethCallResults[d];if(h){let y=l.decodeFunctionResult("transferFrom",h).toArray();return y.length==1?y[0]:y}}return await this.contract.getFunction("transferFrom(address,address,uint256)").staticCall(t,e,a,n||{})}catch(c){let d=new Error().stack;throw s(c,void 0,d)}},async transfer(t,e,a,n,r){try{if(n?.ethCallResults&&r){let o=l.encodeFunctionData("transfer",[t,e]),c=C({context:r,calldata:o}),d=n.ethCallResults[c];if(d){let h=l.decodeFunctionResult("transfer",d).toArray();return h.length==1?h[0]:h}}return await this.contract.getFunction("transfer(address,uint256)").staticCall(t,e,a||{})}catch(o){let c=new Error().stack;throw s(o,void 0,c)}}};encodeCall={name(t){try{let a=new u(["function name()"]).encodeFunctionData("name",[]);return{context:t,calldata:a}}catch(e){let a=new Error().stack;throw s(e,void 0,a)}},approve(t,e,a){try{let r=new u(["function approve(address,uint256)"]).encodeFunctionData("approve",[t,e]);return{context:a,calldata:r}}catch(n){let r=new Error().stack;throw s(n,void 0,r)}},totalSupply(t){try{let a=new u(["function totalSupply()"]).encodeFunctionData("totalSupply",[]);return{context:t,calldata:a}}catch(e){let a=new Error().stack;throw s(e,void 0,a)}},transferFrom(t,e,a,n){try{let o=new u(["function transferFrom(address,address,uint256)"]).encodeFunctionData("transferFrom",[t,e,a]);return{context:n,calldata:o}}catch(r){let o=new Error().stack;throw s(r,void 0,o)}},decimals(t){try{let a=new u(["function decimals()"]).encodeFunctionData("decimals",[]);return{context:t,calldata:a}}catch(e){let a=new Error().stack;throw s(e,void 0,a)}},balanceOf(t,e){try{let n=new u(["function balanceOf(address)"]).encodeFunctionData("balanceOf",[t]);return{context:e,calldata:n}}catch(a){let n=new Error().stack;throw s(a,void 0,n)}},symbol(t){try{let a=new u(["function symbol()"]).encodeFunctionData("symbol",[]);return{context:t,calldata:a}}catch(e){let a=new Error().stack;throw s(e,void 0,a)}},transfer(t,e,a){try{let r=new u(["function transfer(address,uint256)"]).encodeFunctionData("transfer",[t,e]);return{context:a,calldata:r}}catch(n){let r=new Error().stack;throw s(n,void 0,r)}},allowance(t,e,a){try{let r=new u(["function allowance(address,address)"]).encodeFunctionData("allowance",[t,e]);return{context:a,calldata:r}}catch(n){let r=new Error().stack;throw s(n,void 0,r)}}}},b=class extends B{async name(t){let e={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.name({blockTag:this.context.blockNumber,...t},this.context.preparedData,e)}async totalSupply(t){let e={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.totalSupply({blockTag:this.context.blockNumber,...t},this.context.preparedData,e)}async decimals(t){let e={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.decimals({blockTag:this.context.blockNumber,...t},this.context.preparedData,e)}async balanceOf(t,e){let a={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.balanceOf(t,{blockTag:this.context.blockNumber,...e},this.context.preparedData,a)}async symbol(t){let e={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.symbol({blockTag:this.context.blockNumber,...t},this.context.preparedData,e)}async allowance(t,e,a){let n={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.allowance(t,e,{blockTag:this.context.blockNumber,...a},this.context.preparedData,n)}callStatic={view:this.view,context:this.context,async approve(t,e,a){let n={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.callStatic.approve(t,e,{blockTag:this.context.blockNumber,...a},this.context.preparedData,n)},async transferFrom(t,e,a,n){let r={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.callStatic.transferFrom(t,e,a,{blockTag:this.context.blockNumber,...n},this.context.preparedData,r)},async transfer(t,e,a){let n={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.callStatic.transfer(t,e,{blockTag:this.context.blockNumber,...a},this.context.preparedData,n)}};encodeCall={view:this.view,context:this.context,name(t){let e="0x"+this.context.blockNumber.toString(16);return t?.blockTag&&(e=typeof t.blockTag=="string"?t.blockTag:"0x"+t.blockTag.toString(16)),this.view.encodeCall.name({chainId:this.context.chainId.toString(),address:this.context.address,blockTag:e})},approve(t,e,a){let n="0x"+this.context.blockNumber.toString(16);return a?.blockTag&&(n=typeof a.blockTag=="string"?a.blockTag:"0x"+a.blockTag.toString(16)),this.view.encodeCall.approve(t,e,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:n})},totalSupply(t){let e="0x"+this.context.blockNumber.toString(16);return t?.blockTag&&(e=typeof t.blockTag=="string"?t.blockTag:"0x"+t.blockTag.toString(16)),this.view.encodeCall.totalSupply({chainId:this.context.chainId.toString(),address:this.context.address,blockTag:e})},transferFrom(t,e,a,n){let r="0x"+this.context.blockNumber.toString(16);return n?.blockTag&&(r=typeof n.blockTag=="string"?n.blockTag:"0x"+n.blockTag.toString(16)),this.view.encodeCall.transferFrom(t,e,a,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:r})},decimals(t){let e="0x"+this.context.blockNumber.toString(16);return t?.blockTag&&(e=typeof t.blockTag=="string"?t.blockTag:"0x"+t.blockTag.toString(16)),this.view.encodeCall.decimals({chainId:this.context.chainId.toString(),address:this.context.address,blockTag:e})},balanceOf(t,e){let a="0x"+this.context.blockNumber.toString(16);return e?.blockTag&&(a=typeof e.blockTag=="string"?e.blockTag:"0x"+e.blockTag.toString(16)),this.view.encodeCall.balanceOf(t,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:a})},symbol(t){let e="0x"+this.context.blockNumber.toString(16);return t?.blockTag&&(e=typeof t.blockTag=="string"?t.blockTag:"0x"+t.blockTag.toString(16)),this.view.encodeCall.symbol({chainId:this.context.chainId.toString(),address:this.context.address,blockTag:e})},transfer(t,e,a){let n="0x"+this.context.blockNumber.toString(16);return a?.blockTag&&(n=typeof a.blockTag=="string"?a.blockTag:"0x"+a.blockTag.toString(16)),this.view.encodeCall.transfer(t,e,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:n})},allowance(t,e,a){let n="0x"+this.context.blockNumber.toString(16);return a?.blockTag&&(n=typeof a.blockTag=="string"?a.blockTag:"0x"+a.blockTag.toString(16)),this.view.encodeCall.allowance(t,e,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:n})}}},w=class extends F{onEventApproval(t,e,a,n){return e||(e=g.filters["Approval(address,address,uint256)"](null,null,null)),super.onEthEvent(t,e,a,n)}onEventTransfer(t,e,a,n){return e||(e=g.filters["Transfer(address,address,uint256)"](null,null,null)),super.onEthEvent(t,e,a,n)}onCallName(t,e,a){return super.onEthTrace("0x06fdde03",t,e,a)}onCallApprove(t,e,a){return super.onEthTrace("0x095ea7b3",t,e,a)}onCallTotalSupply(t,e,a){return super.onEthTrace("0x18160ddd",t,e,a)}onCallTransferFrom(t,e,a){return super.onEthTrace("0x23b872dd",t,e,a)}onCallDecimals(t,e,a){return super.onEthTrace("0x313ce567",t,e,a)}onCallBalanceOf(t,e,a){return super.onEthTrace("0x70a08231",t,e,a)}onCallSymbol(t,e,a){return super.onEthTrace("0x95d89b41",t,e,a)}onCallTransfer(t,e,a){return super.onEthTrace("0xa9059cbb",t,e,a)}onCallAllowance(t,e,a){return super.onEthTrace("0xdd62ed3e",t,e,a)}CreateBoundContractView(){let t=x(this.config.network,this.config.address);return new b(this.config.address,t)}static bind(t){t.name||(t.name="ERC20Bytes");let e=E(t);return e||(e=new w(t),T(t,e)),e}},p=w;P(p,"filters",{Approval(t,e,a){return g.filters["Approval(address,address,uint256)"](t,e,a)},Transfer(t,e,a){return g.filters["Transfer(address,address,uint256)"](t,e,a)}});var v=class extends N{bindInternal(t){t.name||(t.name="ERC20Bytes");let e=E(t);return e||(e=new p(t),T(t,e)),e}onEventApproval(t,e,a,n){return e||(e=g.filters["Approval(address,address,uint256)"](null,null,null)),super.onEthEvent(t,e,a,n)}onEventTransfer(t,e,a,n){return e||(e=g.filters["Transfer(address,address,uint256)"](null,null,null)),super.onEthEvent(t,e,a,n)}};function x(i,t){let e=O("ERC20Bytes",t,i);if(!e){let a=f.connect(t,I(i));e=new m(a),S("ERC20Bytes",t,i,e)}return e}function K(i,t){let e=x(i.getChainId(),t),a=new b(t,e);return a.context=i,a.callStatic&&(a.callStatic.context=i),a}var W={};j(W,{ERC20BytesBoundContractView:()=>b,ERC20BytesContractView:()=>m,ERC20BytesProcessor:()=>p,ERC20BytesProcessorTemplate:()=>v,ERC20Bytes__factory:()=>f,getERC20BytesContract:()=>x,getERC20BytesContractOnContext:()=>K,mockApprovalLog:()=>V,mockTransferLog:()=>L});var D={blockHash:"0x0000000000000000000000000000000000000000000000000000000000000000",blockNumber:0,logIndex:0,removed:!1,transactionHash:"0x0000000000000000000000000000000000000000000000000000000000000000",transactionIndex:0};function V(i,t){let a=x(k.EthChainId.ETHEREUM,i).rawContract.interface.encodeEventLog("Approval(address,address,uint256)",[t.owner,t.spender,t.value]);return{...D,index:0,address:i,data:a.data,topics:a.topics}}function L(i,t){let a=x(k.EthChainId.ETHEREUM,i).rawContract.interface.encodeEventLog("Transfer(address,address,uint256)",[t.from,t.to,t.value]);return{...D,index:0,address:i,data:a.data,topics:a.topics}}export{p as a,v as b,x as c,W as d};
3
- //# sourceMappingURL=chunk-LCUGDGMN.js.map
2
+ import{D as f,S as I,T as A,U as k,V as C,b as u,g as R,h as B,j as s,r as F,u as E,v as T,w as O,x as S,z as N}from"./chunk-ZFXV2FHI.js";import{d as j,g as P}from"./chunk-LLHU72AA.js";var g=f.connect("0x0",A),l=new u(["function name() view returns (bytes32)","function approve(address spender, uint256 value) returns (bool)","function totalSupply() view returns (uint256)","function transferFrom(address from, address to, uint256 value) returns (bool)","function decimals() view returns (uint8)","function balanceOf(address who) view returns (uint256)","function symbol() view returns (bytes32)","function transfer(address to, uint256 value) returns (bool)","function allowance(address owner, address spender) view returns (uint256)"]),m=class extends R{constructor(t){super(t),this.callStatic.contract=t}async name(t,e,a){try{if(e?.ethCallResults&&a){let n=l.encodeFunctionData("name",[]),r=C({context:a,calldata:n}),o=e.ethCallResults[r];if(o){let c=l.decodeFunctionResult("name",o).toArray();return c.length==1?c[0]:c}}return await this.contract.getFunction("name()")(t||{})}catch(n){let r=new Error().stack;throw s(n,void 0,r)}}async totalSupply(t,e,a){try{if(e?.ethCallResults&&a){let n=l.encodeFunctionData("totalSupply",[]),r=C({context:a,calldata:n}),o=e.ethCallResults[r];if(o){let c=l.decodeFunctionResult("totalSupply",o).toArray();return c.length==1?c[0]:c}}return await this.contract.getFunction("totalSupply()")(t||{})}catch(n){let r=new Error().stack;throw s(n,void 0,r)}}async decimals(t,e,a){try{if(e?.ethCallResults&&a){let n=l.encodeFunctionData("decimals",[]),r=C({context:a,calldata:n}),o=e.ethCallResults[r];if(o){let c=l.decodeFunctionResult("decimals",o).toArray();return c.length==1?c[0]:c}}return await this.contract.getFunction("decimals()")(t||{})}catch(n){let r=new Error().stack;throw s(n,void 0,r)}}async balanceOf(t,e,a,n){try{if(a?.ethCallResults&&n){let r=l.encodeFunctionData("balanceOf",[t]),o=C({context:n,calldata:r}),c=a.ethCallResults[o];if(c){let d=l.decodeFunctionResult("balanceOf",c).toArray();return d.length==1?d[0]:d}}return await this.contract.getFunction("balanceOf(address)")(t,e||{})}catch(r){let o=new Error().stack;throw s(r,void 0,o)}}async symbol(t,e,a){try{if(e?.ethCallResults&&a){let n=l.encodeFunctionData("symbol",[]),r=C({context:a,calldata:n}),o=e.ethCallResults[r];if(o){let c=l.decodeFunctionResult("symbol",o).toArray();return c.length==1?c[0]:c}}return await this.contract.getFunction("symbol()")(t||{})}catch(n){let r=new Error().stack;throw s(n,void 0,r)}}async allowance(t,e,a,n,r){try{if(n?.ethCallResults&&r){let o=l.encodeFunctionData("allowance",[t,e]),c=C({context:r,calldata:o}),d=n.ethCallResults[c];if(d){let h=l.decodeFunctionResult("allowance",d).toArray();return h.length==1?h[0]:h}}return await this.contract.getFunction("allowance(address,address)")(t,e,a||{})}catch(o){let c=new Error().stack;throw s(o,void 0,c)}}callStatic={contract:this.contract,async approve(t,e,a,n,r){try{if(n?.ethCallResults&&r){let o=l.encodeFunctionData("approve",[t,e]),c=C({context:r,calldata:o}),d=n.ethCallResults[c];if(d){let h=l.decodeFunctionResult("approve",d).toArray();return h.length==1?h[0]:h}}return await this.contract.getFunction("approve(address,uint256)").staticCall(t,e,a||{})}catch(o){let c=new Error().stack;throw s(o,void 0,c)}},async transferFrom(t,e,a,n,r,o){try{if(r?.ethCallResults&&o){let c=l.encodeFunctionData("transferFrom",[t,e,a]),d=C({context:o,calldata:c}),h=r.ethCallResults[d];if(h){let y=l.decodeFunctionResult("transferFrom",h).toArray();return y.length==1?y[0]:y}}return await this.contract.getFunction("transferFrom(address,address,uint256)").staticCall(t,e,a,n||{})}catch(c){let d=new Error().stack;throw s(c,void 0,d)}},async transfer(t,e,a,n,r){try{if(n?.ethCallResults&&r){let o=l.encodeFunctionData("transfer",[t,e]),c=C({context:r,calldata:o}),d=n.ethCallResults[c];if(d){let h=l.decodeFunctionResult("transfer",d).toArray();return h.length==1?h[0]:h}}return await this.contract.getFunction("transfer(address,uint256)").staticCall(t,e,a||{})}catch(o){let c=new Error().stack;throw s(o,void 0,c)}}};encodeCall={name(t){try{let a=new u(["function name()"]).encodeFunctionData("name",[]);return{context:t,calldata:a}}catch(e){let a=new Error().stack;throw s(e,void 0,a)}},approve(t,e,a){try{let r=new u(["function approve(address,uint256)"]).encodeFunctionData("approve",[t,e]);return{context:a,calldata:r}}catch(n){let r=new Error().stack;throw s(n,void 0,r)}},totalSupply(t){try{let a=new u(["function totalSupply()"]).encodeFunctionData("totalSupply",[]);return{context:t,calldata:a}}catch(e){let a=new Error().stack;throw s(e,void 0,a)}},transferFrom(t,e,a,n){try{let o=new u(["function transferFrom(address,address,uint256)"]).encodeFunctionData("transferFrom",[t,e,a]);return{context:n,calldata:o}}catch(r){let o=new Error().stack;throw s(r,void 0,o)}},decimals(t){try{let a=new u(["function decimals()"]).encodeFunctionData("decimals",[]);return{context:t,calldata:a}}catch(e){let a=new Error().stack;throw s(e,void 0,a)}},balanceOf(t,e){try{let n=new u(["function balanceOf(address)"]).encodeFunctionData("balanceOf",[t]);return{context:e,calldata:n}}catch(a){let n=new Error().stack;throw s(a,void 0,n)}},symbol(t){try{let a=new u(["function symbol()"]).encodeFunctionData("symbol",[]);return{context:t,calldata:a}}catch(e){let a=new Error().stack;throw s(e,void 0,a)}},transfer(t,e,a){try{let r=new u(["function transfer(address,uint256)"]).encodeFunctionData("transfer",[t,e]);return{context:a,calldata:r}}catch(n){let r=new Error().stack;throw s(n,void 0,r)}},allowance(t,e,a){try{let r=new u(["function allowance(address,address)"]).encodeFunctionData("allowance",[t,e]);return{context:a,calldata:r}}catch(n){let r=new Error().stack;throw s(n,void 0,r)}}}},b=class extends B{async name(t){let e={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.name({blockTag:this.context.blockNumber,...t},this.context.preparedData,e)}async totalSupply(t){let e={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.totalSupply({blockTag:this.context.blockNumber,...t},this.context.preparedData,e)}async decimals(t){let e={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.decimals({blockTag:this.context.blockNumber,...t},this.context.preparedData,e)}async balanceOf(t,e){let a={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.balanceOf(t,{blockTag:this.context.blockNumber,...e},this.context.preparedData,a)}async symbol(t){let e={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.symbol({blockTag:this.context.blockNumber,...t},this.context.preparedData,e)}async allowance(t,e,a){let n={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.allowance(t,e,{blockTag:this.context.blockNumber,...a},this.context.preparedData,n)}callStatic={view:this.view,context:this.context,async approve(t,e,a){let n={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.callStatic.approve(t,e,{blockTag:this.context.blockNumber,...a},this.context.preparedData,n)},async transferFrom(t,e,a,n){let r={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.callStatic.transferFrom(t,e,a,{blockTag:this.context.blockNumber,...n},this.context.preparedData,r)},async transfer(t,e,a){let n={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.callStatic.transfer(t,e,{blockTag:this.context.blockNumber,...a},this.context.preparedData,n)}};encodeCall={view:this.view,context:this.context,name(t){let e="0x"+this.context.blockNumber.toString(16);return t?.blockTag&&(e=typeof t.blockTag=="string"?t.blockTag:"0x"+t.blockTag.toString(16)),this.view.encodeCall.name({chainId:this.context.chainId.toString(),address:this.context.address,blockTag:e})},approve(t,e,a){let n="0x"+this.context.blockNumber.toString(16);return a?.blockTag&&(n=typeof a.blockTag=="string"?a.blockTag:"0x"+a.blockTag.toString(16)),this.view.encodeCall.approve(t,e,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:n})},totalSupply(t){let e="0x"+this.context.blockNumber.toString(16);return t?.blockTag&&(e=typeof t.blockTag=="string"?t.blockTag:"0x"+t.blockTag.toString(16)),this.view.encodeCall.totalSupply({chainId:this.context.chainId.toString(),address:this.context.address,blockTag:e})},transferFrom(t,e,a,n){let r="0x"+this.context.blockNumber.toString(16);return n?.blockTag&&(r=typeof n.blockTag=="string"?n.blockTag:"0x"+n.blockTag.toString(16)),this.view.encodeCall.transferFrom(t,e,a,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:r})},decimals(t){let e="0x"+this.context.blockNumber.toString(16);return t?.blockTag&&(e=typeof t.blockTag=="string"?t.blockTag:"0x"+t.blockTag.toString(16)),this.view.encodeCall.decimals({chainId:this.context.chainId.toString(),address:this.context.address,blockTag:e})},balanceOf(t,e){let a="0x"+this.context.blockNumber.toString(16);return e?.blockTag&&(a=typeof e.blockTag=="string"?e.blockTag:"0x"+e.blockTag.toString(16)),this.view.encodeCall.balanceOf(t,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:a})},symbol(t){let e="0x"+this.context.blockNumber.toString(16);return t?.blockTag&&(e=typeof t.blockTag=="string"?t.blockTag:"0x"+t.blockTag.toString(16)),this.view.encodeCall.symbol({chainId:this.context.chainId.toString(),address:this.context.address,blockTag:e})},transfer(t,e,a){let n="0x"+this.context.blockNumber.toString(16);return a?.blockTag&&(n=typeof a.blockTag=="string"?a.blockTag:"0x"+a.blockTag.toString(16)),this.view.encodeCall.transfer(t,e,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:n})},allowance(t,e,a){let n="0x"+this.context.blockNumber.toString(16);return a?.blockTag&&(n=typeof a.blockTag=="string"?a.blockTag:"0x"+a.blockTag.toString(16)),this.view.encodeCall.allowance(t,e,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:n})}}},w=class extends F{onEventApproval(t,e,a,n){return e||(e=g.filters["Approval(address,address,uint256)"](null,null,null)),super.onEthEvent(t,e,a,n)}onEventTransfer(t,e,a,n){return e||(e=g.filters["Transfer(address,address,uint256)"](null,null,null)),super.onEthEvent(t,e,a,n)}onCallName(t,e,a){return super.onEthTrace("0x06fdde03",t,e,a)}onCallApprove(t,e,a){return super.onEthTrace("0x095ea7b3",t,e,a)}onCallTotalSupply(t,e,a){return super.onEthTrace("0x18160ddd",t,e,a)}onCallTransferFrom(t,e,a){return super.onEthTrace("0x23b872dd",t,e,a)}onCallDecimals(t,e,a){return super.onEthTrace("0x313ce567",t,e,a)}onCallBalanceOf(t,e,a){return super.onEthTrace("0x70a08231",t,e,a)}onCallSymbol(t,e,a){return super.onEthTrace("0x95d89b41",t,e,a)}onCallTransfer(t,e,a){return super.onEthTrace("0xa9059cbb",t,e,a)}onCallAllowance(t,e,a){return super.onEthTrace("0xdd62ed3e",t,e,a)}CreateBoundContractView(){let t=x(this.config.network,this.config.address);return new b(this.config.address,t)}static bind(t){t.name||(t.name="ERC20Bytes");let e=E(t);return e||(e=new w(t),T(t,e)),e}},p=w;P(p,"filters",{Approval(t,e,a){return g.filters["Approval(address,address,uint256)"](t,e,a)},Transfer(t,e,a){return g.filters["Transfer(address,address,uint256)"](t,e,a)}});var v=class extends N{bindInternal(t){t.name||(t.name="ERC20Bytes");let e=E(t);return e||(e=new p(t),T(t,e)),e}onEventApproval(t,e,a,n){return e||(e=g.filters["Approval(address,address,uint256)"](null,null,null)),super.onEthEvent(t,e,a,n)}onEventTransfer(t,e,a,n){return e||(e=g.filters["Transfer(address,address,uint256)"](null,null,null)),super.onEthEvent(t,e,a,n)}};function x(i,t){let e=O("ERC20Bytes",t,i);if(!e){let a=f.connect(t,I(i));e=new m(a),S("ERC20Bytes",t,i,e)}return e}function K(i,t){let e=x(i.getChainId(),t),a=new b(t,e);return a.context=i,a.callStatic&&(a.callStatic.context=i),a}var W={};j(W,{ERC20BytesBoundContractView:()=>b,ERC20BytesContractView:()=>m,ERC20BytesProcessor:()=>p,ERC20BytesProcessorTemplate:()=>v,ERC20Bytes__factory:()=>f,getERC20BytesContract:()=>x,getERC20BytesContractOnContext:()=>K,mockApprovalLog:()=>V,mockTransferLog:()=>L});var D={blockHash:"0x0000000000000000000000000000000000000000000000000000000000000000",blockNumber:0,logIndex:0,removed:!1,transactionHash:"0x0000000000000000000000000000000000000000000000000000000000000000",transactionIndex:0};function V(i,t){let a=x(k.EthChainId.ETHEREUM,i).rawContract.interface.encodeEventLog("Approval(address,address,uint256)",[t.owner,t.spender,t.value]);return{...D,index:0,address:i,data:a.data,topics:a.topics}}function L(i,t){let a=x(k.EthChainId.ETHEREUM,i).rawContract.interface.encodeEventLog("Transfer(address,address,uint256)",[t.from,t.to,t.value]);return{...D,index:0,address:i,data:a.data,topics:a.topics}}export{p as a,v as b,x as c,W as d};
3
+ //# sourceMappingURL=chunk-CCQHM2XD.js.map
@@ -1,5 +1,5 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import{c as Xn}from"./chunk-LCUGDGMN.js";import{e as Kn}from"./chunk-3KK6D6YO.js";import{U as Qn,_ as Yn,a as ir,i as Hn}from"./chunk-4QS3NUUW.js";import{a as nl}from"./chunk-7HVQTJAO.js";import{Ec as tr,Fc as rr,Gc as nr,Hc as rl,b as tl,bd as Wn,c as $n,k as H,oc as dt}from"./chunk-JTQMVYTS.js";import{a as k,b as _,c as v,d as Gn,e as Ge,f as ht,h as Jn,i as jn,j as er}from"./chunk-LLHU72AA.js";var Y=v(Q=>{"use strict";Q.getValueAsString=function(e){return Number.isNaN(e)?"Nan":Number.isFinite(e)?`${e}`:e<0?"-Inf":"+Inf"};Q.removeLabels=function(e,r,n){let i=hr(r,n);delete e[i]};Q.setValue=function(e,r,n){let i=hr(n);return e[i]={value:typeof r=="number"?r:0,labels:n||{}},e};Q.setValueDelta=function(e,r,n,i=""){let s=typeof r=="number"?r:0;return e[i]?e[i].value+=s:e[i]={value:s,labels:n},e};Q.getLabels=function(t,e){if(typeof e[0]=="object")return e[0];if(t.length!==e.length)throw new Error("Invalid number of arguments");let r={};for(let n=0;n<t.length;n++)r[t[n]]=e[n];return r};function Bi(t,e){if(t.length===0)return"";let r="";for(let n=0;n<t.length;n++){let i=t[n],s=e[i];s!==void 0&&(r+=`${i}:${s},`)}return r}function hr(t,e){if(e)return Bi(e,t);let r=Object.keys(t);return r.length>1&&r.sort(),Bi(r,t)}Q.hashObject=hr;Q.isObject=function(e){return e!==null&&typeof e=="object"};Q.nowTimestamp=function(){return Date.now()/1e3};var fr=class extends Map{add(e,r){this.has(e)?this.get(e).push(r):this.set(e,[r])}};Q.Grouper=fr});var Pe=v((Nh,mr)=>{"use strict";var{getValueAsString:qi}=Y(),U=class{static get PROMETHEUS_CONTENT_TYPE(){return"text/plain; version=0.0.4; charset=utf-8"}static get OPENMETRICS_CONTENT_TYPE(){return"application/openmetrics-text; version=1.0.0; charset=utf-8"}constructor(e=U.PROMETHEUS_CONTENT_TYPE){if(this._metrics={},this._collectors=[],this._defaultLabels={},e!==U.PROMETHEUS_CONTENT_TYPE&&e!==U.OPENMETRICS_CONTENT_TYPE)throw new TypeError(`Content type ${e} is unsupported`);this._contentType=e}getMetricsAsArray(){return Object.values(this._metrics)}async getMetricsAsString(e){let r=typeof e.getForPromString=="function"?await e.getForPromString():await e.get(),n=pr(r.name),i=`# HELP ${n} ${pr(r.help)}`,s=`# TYPE ${n} ${r.type}`,o=[i,s],a=Object.keys(this._defaultLabels).length>0?this._defaultLabels:null,l=this.contentType===U.OPENMETRICS_CONTENT_TYPE;for(let c of r.values||[]){let{metricName:u=n,labels:f={}}=c,{sharedLabels:h={}}=c;l&&r.type==="counter"&&(u=`${u}_total`),a&&(f={...f,...a,...f});let p=dr(f,h),b=yl(h),d=[...p,b].filter(Boolean),C=d.length?`{${d.join(",")}}`:"",m=`${u}${C} ${qi(c.value)}`,{exemplar:y}=c;if(y&&l){let S=dr(y.labelSet);m+=` # {${S.join(",")}} ${qi(y.value)} ${y.timestamp}`}o.push(m)}return o.join(`
2
+ import{c as Xn}from"./chunk-CCQHM2XD.js";import{e as Kn}from"./chunk-WWVBF7HH.js";import{U as Qn,_ as Yn,a as ir,i as Hn}from"./chunk-ZFXV2FHI.js";import{a as nl}from"./chunk-7HVQTJAO.js";import{Ec as tr,Fc as rr,Gc as nr,Hc as rl,b as tl,bd as Wn,c as $n,k as H,oc as dt}from"./chunk-ZMRHWH7D.js";import{a as k,b as _,c as v,d as Gn,e as Ge,f as ht,h as Jn,i as jn,j as er}from"./chunk-LLHU72AA.js";var Y=v(Q=>{"use strict";Q.getValueAsString=function(e){return Number.isNaN(e)?"Nan":Number.isFinite(e)?`${e}`:e<0?"-Inf":"+Inf"};Q.removeLabels=function(e,r,n){let i=hr(r,n);delete e[i]};Q.setValue=function(e,r,n){let i=hr(n);return e[i]={value:typeof r=="number"?r:0,labels:n||{}},e};Q.setValueDelta=function(e,r,n,i=""){let s=typeof r=="number"?r:0;return e[i]?e[i].value+=s:e[i]={value:s,labels:n},e};Q.getLabels=function(t,e){if(typeof e[0]=="object")return e[0];if(t.length!==e.length)throw new Error("Invalid number of arguments");let r={};for(let n=0;n<t.length;n++)r[t[n]]=e[n];return r};function Bi(t,e){if(t.length===0)return"";let r="";for(let n=0;n<t.length;n++){let i=t[n],s=e[i];s!==void 0&&(r+=`${i}:${s},`)}return r}function hr(t,e){if(e)return Bi(e,t);let r=Object.keys(t);return r.length>1&&r.sort(),Bi(r,t)}Q.hashObject=hr;Q.isObject=function(e){return e!==null&&typeof e=="object"};Q.nowTimestamp=function(){return Date.now()/1e3};var fr=class extends Map{add(e,r){this.has(e)?this.get(e).push(r):this.set(e,[r])}};Q.Grouper=fr});var Pe=v((Nh,mr)=>{"use strict";var{getValueAsString:qi}=Y(),U=class{static get PROMETHEUS_CONTENT_TYPE(){return"text/plain; version=0.0.4; charset=utf-8"}static get OPENMETRICS_CONTENT_TYPE(){return"application/openmetrics-text; version=1.0.0; charset=utf-8"}constructor(e=U.PROMETHEUS_CONTENT_TYPE){if(this._metrics={},this._collectors=[],this._defaultLabels={},e!==U.PROMETHEUS_CONTENT_TYPE&&e!==U.OPENMETRICS_CONTENT_TYPE)throw new TypeError(`Content type ${e} is unsupported`);this._contentType=e}getMetricsAsArray(){return Object.values(this._metrics)}async getMetricsAsString(e){let r=typeof e.getForPromString=="function"?await e.getForPromString():await e.get(),n=pr(r.name),i=`# HELP ${n} ${pr(r.help)}`,s=`# TYPE ${n} ${r.type}`,o=[i,s],a=Object.keys(this._defaultLabels).length>0?this._defaultLabels:null,l=this.contentType===U.OPENMETRICS_CONTENT_TYPE;for(let c of r.values||[]){let{metricName:u=n,labels:f={}}=c,{sharedLabels:h={}}=c;l&&r.type==="counter"&&(u=`${u}_total`),a&&(f={...f,...a,...f});let p=dr(f,h),b=yl(h),d=[...p,b].filter(Boolean),C=d.length?`{${d.join(",")}}`:"",m=`${u}${C} ${qi(c.value)}`,{exemplar:y}=c;if(y&&l){let S=dr(y.labelSet);m+=` # {${S.join(",")}} ${qi(y.value)} ${y.timestamp}`}o.push(m)}return o.join(`
3
3
  `)}async metrics(){let e=this.contentType===U.OPENMETRICS_CONTENT_TYPE,r=this.getMetricsAsArray().map(i=>(e&&i.type==="counter"&&(i.name=Sl(i.name)),this.getMetricsAsString(i))),n=await Promise.all(r);return e?`${n.join(`
4
4
  `)}
5
5
  # EOF
@@ -13,4 +13,4 @@ import{c as Xn}from"./chunk-LCUGDGMN.js";import{e as Kn}from"./chunk-3KK6D6YO.js
13
13
  `,o).length:f,c?(a===null?0:a.length)+l.length:0,c?l.length+f:0);return h<p},parse:function(n,i,s,o){let{bom:a,comment_no_infix:l,encoding:c,from_line:u,ltrim:f,max_record_size:h,raw:p,relax_quotes:b,rtrim:d,skip_empty_lines:C,to:m,to_line:y}=this.options,{comment:S,escape:T,quote:A,record_delimiter:Z}=this.options,{bomSkipped:W,previousBuf:ee,rawBuffer:ze,escapeIsQuote:ut}=this.state,I;if(ee===void 0)if(n===void 0){o();return}else I=n;else ee!==void 0&&n===void 0?I=ee:I=Buffer.concat([ee,n]);if(W===!1)if(a===!1)this.state.bomSkipped=!0;else if(I.length<3){if(i===!1){this.state.previousBuf=I;return}}else{for(let M in xe)if(xe[M].compare(I,0,xe[M].length)===0){let ie=xe[M].length;this.state.bufBytesStart+=ie,I=I.slice(ie),this.options=lr({...this.original_options,encoding:M}),{comment:S,escape:T,quote:A}=this.options;break}this.state.bomSkipped=!0}let Zt=I.length,E;for(E=0;E<Zt&&!this.__needMoreData(E,Zt,i);E++){if(this.state.wasRowDelimiter===!0&&(this.info.lines++,this.state.wasRowDelimiter=!1),y!==-1&&this.info.lines>y){this.state.stop=!0,o();return}this.state.quoting===!1&&Z.length===0&&this.__autoDiscoverRecordDelimiter(I,E)&&(Z=this.options.record_delimiter);let M=I[E];if(p===!0&&ze.append(M),(M===dl||M===pl)&&this.state.wasRowDelimiter===!1&&(this.state.wasRowDelimiter=!0),this.state.escaping===!0)this.state.escaping=!1;else{if(T!==null&&this.state.quoting===!0&&this.__isEscape(I,E,M)&&E+T.length<Zt)if(ut){if(this.__isQuote(I,E+T.length)){this.state.escaping=!0,E+=T.length-1;continue}}else{this.state.escaping=!0,E+=T.length-1;continue}if(this.state.commenting===!1&&this.__isQuote(I,E))if(this.state.quoting===!0){let D=I[E+A.length],fe=d&&this.__isCharTrimable(I,E+A.length),te=S!==null&&this.__compareBytes(S,I,E+A.length,D),he=this.__isDelimiter(I,E+A.length,D),ft=Z.length===0?this.__autoDiscoverRecordDelimiter(I,E+A.length):this.__isRecordDelimiter(D,I,E+A.length);if(T!==null&&this.__isEscape(I,E,M)&&this.__isQuote(I,E+T.length))E+=T.length-1;else if(!D||he||ft||te||fe){this.state.quoting=!1,this.state.wasQuoting=!0,E+=A.length-1;continue}else if(b===!1){let zn=this.__error(new N("CSV_INVALID_CLOSING_QUOTE",["Invalid Closing Quote:",`got "${String.fromCharCode(D)}"`,`at line ${this.info.lines}`,"instead of delimiter, record delimiter, trimable character","(if activated) or comment"],this.options,this.__infoField()));if(zn!==void 0)return zn}else this.state.quoting=!1,this.state.wasQuoting=!0,this.state.field.prepend(A),E+=A.length-1}else if(this.state.field.length!==0){if(b===!1){let D=this.__infoField(),fe=Object.keys(xe).map(he=>xe[he].equals(this.state.field.toString())?he:!1).filter(Boolean)[0],te=this.__error(new N("INVALID_OPENING_QUOTE",["Invalid Opening Quote:",`a quote is found on field ${JSON.stringify(D.column)} at line ${D.lines}, value is ${JSON.stringify(this.state.field.toString(c))}`,fe?`(${fe} bom)`:void 0],this.options,D,{field:this.state.field}));if(te!==void 0)return te}}else{this.state.quoting=!0,E+=A.length-1;continue}if(this.state.quoting===!1){let D=this.__isRecordDelimiter(M,I,E);if(D!==0){if(this.state.commenting&&this.state.wasQuoting===!1&&this.state.record.length===0&&this.state.field.length===0)this.info.comment_lines++;else{if(this.state.enabled===!1&&this.info.lines+(this.state.wasRowDelimiter===!0?1:0)>=u){this.state.enabled=!0,this.__resetField(),this.__resetRecord(),E+=D-1;continue}if(C===!0&&this.state.wasQuoting===!1&&this.state.record.length===0&&this.state.field.length===0){this.info.empty_lines++,E+=D-1;continue}this.info.bytes=this.state.bufBytesStart+E;let he=this.__onField();if(he!==void 0)return he;this.info.bytes=this.state.bufBytesStart+E+D;let ft=this.__onRecord(s);if(ft!==void 0)return ft;if(m!==-1&&this.info.records>=m){this.state.stop=!0,o();return}}this.state.commenting=!1,E+=D-1;continue}if(this.state.commenting)continue;if(S!==null&&(l===!1||this.state.record.length===0&&this.state.field.length===0)&&this.__compareBytes(S,I,E,M)!==0){this.state.commenting=!0;continue}let fe=this.__isDelimiter(I,E,M);if(fe!==0){this.info.bytes=this.state.bufBytesStart+E;let te=this.__onField();if(te!==void 0)return te;E+=fe-1;continue}}}if(this.state.commenting===!1&&h!==0&&this.state.record_length+this.state.field.length>h)return this.__error(new N("CSV_MAX_RECORD_SIZE",["Max Record Size:","record exceed the maximum number of tolerated bytes",`of ${h}`,`at line ${this.info.lines}`],this.options,this.__infoField()));let ie=f===!1||this.state.quoting===!0||this.state.field.length!==0||!this.__isCharTrimable(I,E),el=d===!1||this.state.wasQuoting===!1;if(ie===!0&&el===!0)this.state.field.append(M);else{if(d===!0&&!this.__isCharTrimable(I,E))return this.__error(new N("CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",["Invalid Closing Quote:","found non trimable byte after quote",`at line ${this.info.lines}`],this.options,this.__infoField()));ie===!1&&(E+=this.__isCharTrimable(I,E)-1);continue}}if(i===!0)if(this.state.quoting===!0){let M=this.__error(new N("CSV_QUOTE_NOT_CLOSED",["Quote Not Closed:",`the parsing is finished with an opening quote at line ${this.info.lines}`],this.options,this.__infoField()));if(M!==void 0)return M}else if(this.state.wasQuoting===!0||this.state.record.length!==0||this.state.field.length!==0){this.info.bytes=this.state.bufBytesStart+E;let M=this.__onField();if(M!==void 0)return M;let ie=this.__onRecord(s);if(ie!==void 0)return ie}else this.state.wasRowDelimiter===!0?this.info.empty_lines++:this.state.commenting===!0&&this.info.comment_lines++;else this.state.bufBytesStart+=E,this.state.previousBuf=I.slice(E);this.state.wasRowDelimiter===!0&&(this.info.lines++,this.state.wasRowDelimiter=!1)},__onRecord:function(n){let{columns:i,group_columns_by_name:s,encoding:o,info:a,from:l,relax_column_count:c,relax_column_count_less:u,relax_column_count_more:f,raw:h,skip_records_with_empty_values:p}=this.options,{enabled:b,record:d}=this.state;if(b===!1)return this.__resetRecord();let C=d.length;if(i===!0){if(p===!0&&ci(d)){this.__resetRecord();return}return this.__firstLineToColumns(d)}if(i===!1&&this.info.records===0&&(this.state.expectedRecordLength=C),C!==this.state.expectedRecordLength){let m=i===!1?new N("CSV_RECORD_INCONSISTENT_FIELDS_LENGTH",["Invalid Record Length:",`expect ${this.state.expectedRecordLength},`,`got ${C} on line ${this.info.lines}`],this.options,this.__infoField(),{record:d}):new N("CSV_RECORD_INCONSISTENT_COLUMNS",["Invalid Record Length:",`columns length is ${i.length},`,`got ${C} on line ${this.info.lines}`],this.options,this.__infoField(),{record:d});if(c===!0||u===!0&&C<this.state.expectedRecordLength||f===!0&&C>this.state.expectedRecordLength)this.info.invalid_field_length++,this.state.error=m;else{let y=this.__error(m);if(y)return y}}if(p===!0&&ci(d)){this.__resetRecord();return}if(this.state.recordHasError===!0){this.__resetRecord(),this.state.recordHasError=!1;return}if(this.info.records++,l===1||this.info.records>=l){let{objname:m}=this.options;if(i!==!1){let y={};for(let S=0,T=d.length;S<T;S++)i[S]===void 0||i[S].disabled||(s===!0&&y[i[S].name]!==void 0?Array.isArray(y[i[S].name])?y[i[S].name]=y[i[S].name].concat(d[S]):y[i[S].name]=[y[i[S].name],d[S]]:y[i[S].name]=d[S]);if(h===!0||a===!0){let S=Object.assign({record:y},h===!0?{raw:this.state.rawBuffer.toString(o)}:{},a===!0?{info:this.__infoRecord()}:{}),T=this.__push(m===void 0?S:[y[m],S],n);if(T)return T}else{let S=this.__push(m===void 0?y:[y[m],y],n);if(S)return S}}else if(h===!0||a===!0){let y=Object.assign({record:d},h===!0?{raw:this.state.rawBuffer.toString(o)}:{},a===!0?{info:this.__infoRecord()}:{}),S=this.__push(m===void 0?y:[d[m],y],n);if(S)return S}else{let y=this.__push(m===void 0?d:[d[m],d],n);if(y)return y}}this.__resetRecord()},__firstLineToColumns:function(n){let{firstLineToHeaders:i}=this.state;try{let s=i===void 0?n:i.call(null,n);if(!Array.isArray(s))return this.__error(new N("CSV_INVALID_COLUMN_MAPPING",["Invalid Column Mapping:","expect an array from column function,",`got ${JSON.stringify(s)}`],this.options,this.__infoField(),{headers:s}));let o=gt(s);this.state.expectedRecordLength=o.length,this.options.columns=o,this.__resetRecord();return}catch(s){return s}},__resetRecord:function(){this.options.raw===!0&&this.state.rawBuffer.reset(),this.state.error=void 0,this.state.record=[],this.state.record_length=0},__onField:function(){let{cast:n,encoding:i,rtrim:s,max_record_size:o}=this.options,{enabled:a,wasQuoting:l}=this.state;if(a===!1)return this.__resetField();let c=this.state.field.toString(i);if(s===!0&&l===!1&&(c=c.trimRight()),n===!0){let[u,f]=this.__cast(c);if(u!==void 0)return u;c=f}this.state.record.push(c),o!==0&&typeof c=="string"&&(this.state.record_length+=c.length),this.__resetField()},__resetField:function(){this.state.field.reset(),this.state.wasQuoting=!1},__push:function(n,i){let{on_record:s}=this.options;if(s!==void 0){let o=this.__infoRecord();try{n=s.call(null,n,o)}catch(a){return a}if(n==null)return}i(n)},__cast:function(n){let{columns:i,relax_column_count:s}=this.options;if(Array.isArray(i)===!0&&s&&this.options.columns.length<=this.state.record.length)return[void 0,void 0];if(this.state.castField!==null)try{let a=this.__infoField();return[void 0,this.state.castField.call(null,n,a)]}catch(a){return[a]}if(this.__isFloat(n))return[void 0,parseFloat(n)];if(this.options.cast_date!==!1){let a=this.__infoField();return[void 0,this.options.cast_date.call(null,n,a)]}return[void 0,n]},__isCharTrimable:function(n,i){return((o,a)=>{let{timchars:l}=this.state;e:for(let c=0;c<l.length;c++){let u=l[c];for(let f=0;f<u.length;f++)if(u[f]!==o[a+f])continue e;return u.length}return 0})(n,i)},__isFloat:function(n){return n-parseFloat(n)+1>=0},__compareBytes:function(n,i,s,o){if(n[0]!==o)return 0;let a=n.length;for(let l=1;l<a;l++)if(n[l]!==i[s+l])return 0;return a},__isDelimiter:function(n,i,s){let{delimiter:o,ignore_last_delimiters:a}=this.options;if(a===!0&&this.state.record.length===this.options.columns.length-1)return 0;if(a!==!1&&typeof a=="number"&&this.state.record.length===a-1)return 0;e:for(let l=0;l<o.length;l++){let c=o[l];if(c[0]===s){for(let u=1;u<c.length;u++)if(c[u]!==n[i+u])continue e;return c.length}}return 0},__isRecordDelimiter:function(n,i,s){let{record_delimiter:o}=this.options,a=o.length;e:for(let l=0;l<a;l++){let c=o[l],u=c.length;if(c[0]===n){for(let f=1;f<u;f++)if(c[f]!==i[s+f])continue e;return c.length}}return 0},__isEscape:function(n,i,s){let{escape:o}=this.options;if(o===null)return!1;let a=o.length;if(o[0]===s){for(let l=0;l<a;l++)if(o[l]!==n[i+l])return!1;return!0}return!1},__isQuote:function(n,i){let{quote:s}=this.options;if(s===null)return!1;let o=s.length;for(let a=0;a<o;a++)if(s[a]!==n[i+a])return!1;return!0},__autoDiscoverRecordDelimiter:function(n,i){let{encoding:s}=this.options,o=[Buffer.from(`\r
14
14
  `,s),Buffer.from(`
15
15
  `,s),Buffer.from("\r",s)];e:for(let a=0;a<o.length;a++){let l=o[a].length;for(let c=0;c<l;c++)if(o[a][c]!==n[i+c])continue e;return this.options.record_delimiter.push(o[a]),this.state.recordDelimiterMaxLength=o[a].length,o[a].length}return 0},__error:function(n){let{encoding:i,raw:s,skip_records_with_error:o}=this.options,a=typeof n=="string"?new Error(n):n;if(o){this.state.recordHasError=!0,this.options.on_skip!==void 0&&this.options.on_skip(a,s?this.state.rawBuffer.toString(i):void 0);return}else return a},__infoDataSet:function(){return{...this.info,columns:this.options.columns}},__infoRecord:function(){let{columns:n,raw:i,encoding:s}=this.options;return{...this.__infoDataSet(),error:this.state.error,header:n===!0,index:this.state.record.length,raw:i?this.state.rawBuffer.toString(s):void 0}},__infoField:function(){let{columns:n}=this.options,i=Array.isArray(n);return{...this.__infoRecord(),column:i===!0?n.length>this.state.record.length?n[this.state.record.length].name:null:this.state.record.length,quoting:this.state.wasQuoting}}}};var fi=function(t,e={}){typeof t=="string"&&(t=Buffer.from(t));let r=e&&e.objname?{}:[],n=ui(e),i=l=>{n.options.objname===void 0?r.push(l):r[l[0]]=l[1]},s=()=>{},o=n.parse(t,!1,i,s);if(o!==void 0)throw o;let a=n.parse(void 0,!0,i,s);if(a!==void 0)throw a;return r};var cr=Ge(nl(),1);import{createRequire as ml}from"module";import bt from"path";var _l=(n=>(n[n.USD=0]="USD",n[n.ETH=1]="ETH",n[n.BTC=2]="BTC",n))(_l||{});function gl(t){let r=ml(import.meta.url).resolve(t),n=bt.dirname(r);for(;!hi.existsSync(bt.join(n,"package.json"));)n=bt.dirname(n);return n}var yt=class{USD_ORACLE_MAP=new Map;ETH_ORACLE_MAP=new Map;BTC_ORACLE_MAP=new Map;ASSETS_INFOS=new Map;chainId;constructor(e,r){this.chainId=r;let n=gl("@sentio/sdk"),i=bt.join(n,"src","utils",e),s=hi.readFileSync(i,{encoding:"utf-8"}),a=fi(s,{delimiter:",",columns:["Pair","Asset","Type","Address"],skip_empty_lines:!0});for(let l of a){let c=l.Pair.split("/"),u=c[0].trim().toLowerCase(),f=c[1].trim().toLowerCase(),h=l.Address.toLowerCase();f==="usd"?this.USD_ORACLE_MAP.set(u,h):f==="eth"?this.ETH_ORACLE_MAP.set(u,h):f=="btc"?this.BTC_ORACLE_MAP.set(u,h):console.error("wrong asset record:"+JSON.stringify(l))}}async getPrice(e,r="latest",n=0){let i=this.USD_ORACLE_MAP;switch(n){case 1:i=this.ETH_ORACLE_MAP;break;case 2:i=this.BTC_ORACLE_MAP;break;default:}e=e.trim().toLowerCase();let s=i.get(e);if(!s)return{error:"No price feed found for asset"};let o=Kn(this.chainId,s);try{let a=await o.latestAnswer({blockTag:r}),l=this.ASSETS_INFOS.get(e);return l||(l=Number(await o.decimals()),this.ASSETS_INFOS.set(e,l)),{price:dt(a,l).toNumber()}}catch(a){return{error:"Price query error for "+e+" failed at "+s+" at chain "+this.chainId+". Details: "+a.toString()}}}},_h=new yt("chainlink-oracles.csv",cr.EthChainId.ETHEREUM),gh=new yt("chainlink-oracles-sepolia.csv",cr.EthChainId.SEPOLIA);var g=Ge(tl(),1);function di(){return{symbol:void 0,address:void 0}}var O={encode(t,e=g.default.Writer.create()){return t.symbol!==void 0&&e.uint32(18).string(t.symbol),t.address!==void 0&&Ce.encode(t.address,e.uint32(26).fork()).ldelim(),e},decode(t,e){let r=t instanceof g.default.Reader?t:g.default.Reader.create(t),n=e===void 0?r.len:r.pos+e,i=di();for(;r.pos<n;){let s=r.uint32();switch(s>>>3){case 2:if(s!==18)break;i.symbol=r.string();continue;case 3:if(s!==26)break;i.address=Ce.decode(r,r.uint32());continue}if((s&7)===4||s===0)break;r.skipType(s&7)}return i},fromJSON(t){return{symbol:w(t.symbol)?globalThis.String(t.symbol):void 0,address:w(t.address)?Ce.fromJSON(t.address):void 0}},toJSON(t){let e={};return t.symbol!==void 0&&(e.symbol=t.symbol),t.address!==void 0&&(e.address=Ce.toJSON(t.address)),e},create(t){return O.fromPartial(t??{})},fromPartial(t){let e=di();return e.symbol=t.symbol??void 0,e.address=t.address!==void 0&&t.address!==null?Ce.fromPartial(t.address):void 0,e}};function pi(){return{address:"",chain:""}}var Ce={encode(t,e=g.default.Writer.create()){return t.address!==""&&e.uint32(10).string(t.address),t.chain!==""&&e.uint32(18).string(t.chain),e},decode(t,e){let r=t instanceof g.default.Reader?t:g.default.Reader.create(t),n=e===void 0?r.len:r.pos+e,i=pi();for(;r.pos<n;){let s=r.uint32();switch(s>>>3){case 1:if(s!==10)break;i.address=r.string();continue;case 2:if(s!==18)break;i.chain=r.string();continue}if((s&7)===4||s===0)break;r.skipType(s&7)}return i},fromJSON(t){return{address:w(t.address)?globalThis.String(t.address):"",chain:w(t.chain)?globalThis.String(t.chain):""}},toJSON(t){let e={};return t.address!==""&&(e.address=t.address),t.chain!==""&&(e.chain=t.chain),e},create(t){return Ce.fromPartial(t??{})},fromPartial(t){let e=pi();return e.address=t.address??"",e.chain=t.chain??"",e}};function mi(){return{timestamp:void 0,coinId:void 0,source:""}}var Ci={encode(t,e=g.default.Writer.create()){return t.timestamp!==void 0&&H.encode(vt(t.timestamp),e.uint32(10).fork()).ldelim(),t.coinId!==void 0&&O.encode(t.coinId,e.uint32(18).fork()).ldelim(),t.source!==""&&e.uint32(26).string(t.source),e},decode(t,e){let r=t instanceof g.default.Reader?t:g.default.Reader.create(t),n=e===void 0?r.len:r.pos+e,i=mi();for(;r.pos<n;){let s=r.uint32();switch(s>>>3){case 1:if(s!==10)break;i.timestamp=Je(H.decode(r,r.uint32()));continue;case 2:if(s!==18)break;i.coinId=O.decode(r,r.uint32());continue;case 3:if(s!==26)break;i.source=r.string();continue}if((s&7)===4||s===0)break;r.skipType(s&7)}return i},fromJSON(t){return{timestamp:w(t.timestamp)?St(t.timestamp):void 0,coinId:w(t.coinId)?O.fromJSON(t.coinId):void 0,source:w(t.source)?globalThis.String(t.source):""}},toJSON(t){let e={};return t.timestamp!==void 0&&(e.timestamp=t.timestamp.toISOString()),t.coinId!==void 0&&(e.coinId=O.toJSON(t.coinId)),t.source!==""&&(e.source=t.source),e},create(t){return Ci.fromPartial(t??{})},fromPartial(t){let e=mi();return e.timestamp=t.timestamp??void 0,e.coinId=t.coinId!==void 0&&t.coinId!==null?O.fromPartial(t.coinId):void 0,e.source=t.source??"",e}};function _i(){return{price:0,timestamp:void 0}}var de={encode(t,e=g.default.Writer.create()){return t.price!==0&&e.uint32(9).double(t.price),t.timestamp!==void 0&&H.encode(vt(t.timestamp),e.uint32(18).fork()).ldelim(),e},decode(t,e){let r=t instanceof g.default.Reader?t:g.default.Reader.create(t),n=e===void 0?r.len:r.pos+e,i=_i();for(;r.pos<n;){let s=r.uint32();switch(s>>>3){case 1:if(s!==9)break;i.price=r.double();continue;case 2:if(s!==18)break;i.timestamp=Je(H.decode(r,r.uint32()));continue}if((s&7)===4||s===0)break;r.skipType(s&7)}return i},fromJSON(t){return{price:w(t.price)?globalThis.Number(t.price):0,timestamp:w(t.timestamp)?St(t.timestamp):void 0}},toJSON(t){let e={};return t.price!==0&&(e.price=t.price),t.timestamp!==void 0&&(e.timestamp=t.timestamp.toISOString()),e},create(t){return de.fromPartial(t??{})},fromPartial(t){let e=_i();return e.price=t.price??0,e.timestamp=t.timestamp??void 0,e}};function gi(){return{timestamps:[],coinIds:[]}}var Ii={encode(t,e=g.default.Writer.create()){for(let r of t.timestamps)H.encode(vt(r),e.uint32(10).fork()).ldelim();for(let r of t.coinIds)O.encode(r,e.uint32(18).fork()).ldelim();return e},decode(t,e){let r=t instanceof g.default.Reader?t:g.default.Reader.create(t),n=e===void 0?r.len:r.pos+e,i=gi();for(;r.pos<n;){let s=r.uint32();switch(s>>>3){case 1:if(s!==10)break;i.timestamps.push(Je(H.decode(r,r.uint32())));continue;case 2:if(s!==18)break;i.coinIds.push(O.decode(r,r.uint32()));continue}if((s&7)===4||s===0)break;r.skipType(s&7)}return i},fromJSON(t){return{timestamps:globalThis.Array.isArray(t?.timestamps)?t.timestamps.map(e=>St(e)):[],coinIds:globalThis.Array.isArray(t?.coinIds)?t.coinIds.map(e=>O.fromJSON(e)):[]}},toJSON(t){let e={};return t.timestamps?.length&&(e.timestamps=t.timestamps.map(r=>r.toISOString())),t.coinIds?.length&&(e.coinIds=t.coinIds.map(r=>O.toJSON(r))),e},create(t){return Ii.fromPartial(t??{})},fromPartial(t){let e=gi();return e.timestamps=t.timestamps?.map(r=>r)||[],e.coinIds=t.coinIds?.map(r=>O.fromPartial(r))||[],e}};function bi(){return{prices:[]}}var Ai={encode(t,e=g.default.Writer.create()){for(let r of t.prices)Ie.encode(r,e.uint32(10).fork()).ldelim();return e},decode(t,e){let r=t instanceof g.default.Reader?t:g.default.Reader.create(t),n=e===void 0?r.len:r.pos+e,i=bi();for(;r.pos<n;){let s=r.uint32();switch(s>>>3){case 1:if(s!==10)break;i.prices.push(Ie.decode(r,r.uint32()));continue}if((s&7)===4||s===0)break;r.skipType(s&7)}return i},fromJSON(t){return{prices:globalThis.Array.isArray(t?.prices)?t.prices.map(e=>Ie.fromJSON(e)):[]}},toJSON(t){let e={};return t.prices?.length&&(e.prices=t.prices.map(r=>Ie.toJSON(r))),e},create(t){return Ai.fromPartial(t??{})},fromPartial(t){let e=bi();return e.prices=t.prices?.map(r=>Ie.fromPartial(r))||[],e}};function yi(){return{coinId:void 0,price:void 0,error:void 0}}var Ie={encode(t,e=g.default.Writer.create()){return t.coinId!==void 0&&O.encode(t.coinId,e.uint32(10).fork()).ldelim(),t.price!==void 0&&Ae.encode(t.price,e.uint32(18).fork()).ldelim(),t.error!==void 0&&e.uint32(26).string(t.error),e},decode(t,e){let r=t instanceof g.default.Reader?t:g.default.Reader.create(t),n=e===void 0?r.len:r.pos+e,i=yi();for(;r.pos<n;){let s=r.uint32();switch(s>>>3){case 1:if(s!==10)break;i.coinId=O.decode(r,r.uint32());continue;case 2:if(s!==18)break;i.price=Ae.decode(r,r.uint32());continue;case 3:if(s!==26)break;i.error=r.string();continue}if((s&7)===4||s===0)break;r.skipType(s&7)}return i},fromJSON(t){return{coinId:w(t.coinId)?O.fromJSON(t.coinId):void 0,price:w(t.price)?Ae.fromJSON(t.price):void 0,error:w(t.error)?globalThis.String(t.error):void 0}},toJSON(t){let e={};return t.coinId!==void 0&&(e.coinId=O.toJSON(t.coinId)),t.price!==void 0&&(e.price=Ae.toJSON(t.price)),t.error!==void 0&&(e.error=t.error),e},create(t){return Ie.fromPartial(t??{})},fromPartial(t){let e=yi();return e.coinId=t.coinId!==void 0&&t.coinId!==null?O.fromPartial(t.coinId):void 0,e.price=t.price!==void 0&&t.price!==null?Ae.fromPartial(t.price):void 0,e.error=t.error??void 0,e}};function vi(){return{results:[]}}var Ae={encode(t,e=g.default.Writer.create()){for(let r of t.results)de.encode(r,e.uint32(10).fork()).ldelim();return e},decode(t,e){let r=t instanceof g.default.Reader?t:g.default.Reader.create(t),n=e===void 0?r.len:r.pos+e,i=vi();for(;r.pos<n;){let s=r.uint32();switch(s>>>3){case 1:if(s!==10)break;i.results.push(de.decode(r,r.uint32()));continue}if((s&7)===4||s===0)break;r.skipType(s&7)}return i},fromJSON(t){return{results:globalThis.Array.isArray(t?.results)?t.results.map(e=>de.fromJSON(e)):[]}},toJSON(t){let e={};return t.results?.length&&(e.results=t.results.map(r=>de.toJSON(r))),e},create(t){return Ae.fromPartial(t??{})},fromPartial(t){let e=vi();return e.results=t.results?.map(r=>de.fromPartial(r))||[],e}};function Si(){return{limit:0,offset:0,searchQuery:"",chain:""}}var Pi={encode(t,e=g.default.Writer.create()){return t.limit!==0&&e.uint32(8).int32(t.limit),t.offset!==0&&e.uint32(16).int32(t.offset),t.searchQuery!==""&&e.uint32(26).string(t.searchQuery),t.chain!==""&&e.uint32(34).string(t.chain),e},decode(t,e){let r=t instanceof g.default.Reader?t:g.default.Reader.create(t),n=e===void 0?r.len:r.pos+e,i=Si();for(;r.pos<n;){let s=r.uint32();switch(s>>>3){case 1:if(s!==8)break;i.limit=r.int32();continue;case 2:if(s!==16)break;i.offset=r.int32();continue;case 3:if(s!==26)break;i.searchQuery=r.string();continue;case 4:if(s!==34)break;i.chain=r.string();continue}if((s&7)===4||s===0)break;r.skipType(s&7)}return i},fromJSON(t){return{limit:w(t.limit)?globalThis.Number(t.limit):0,offset:w(t.offset)?globalThis.Number(t.offset):0,searchQuery:w(t.searchQuery)?globalThis.String(t.searchQuery):"",chain:w(t.chain)?globalThis.String(t.chain):""}},toJSON(t){let e={};return t.limit!==0&&(e.limit=Math.round(t.limit)),t.offset!==0&&(e.offset=Math.round(t.offset)),t.searchQuery!==""&&(e.searchQuery=t.searchQuery),t.chain!==""&&(e.chain=t.chain),e},create(t){return Pi.fromPartial(t??{})},fromPartial(t){let e=Si();return e.limit=t.limit??0,e.offset=t.offset??0,e.searchQuery=t.searchQuery??"",e.chain=t.chain??"",e}};function Ei(){return{coins:[],coinAddressesInChain:{}}}var Ri={encode(t,e=g.default.Writer.create()){for(let r of t.coins)O.encode(r,e.uint32(10).fork()).ldelim();return Object.entries(t.coinAddressesInChain).forEach(([r,n])=>{ur.encode({key:r,value:n},e.uint32(18).fork()).ldelim()}),e},decode(t,e){let r=t instanceof g.default.Reader?t:g.default.Reader.create(t),n=e===void 0?r.len:r.pos+e,i=Ei();for(;r.pos<n;){let s=r.uint32();switch(s>>>3){case 1:if(s!==10)break;i.coins.push(O.decode(r,r.uint32()));continue;case 2:if(s!==18)break;let o=ur.decode(r,r.uint32());o.value!==void 0&&(i.coinAddressesInChain[o.key]=o.value);continue}if((s&7)===4||s===0)break;r.skipType(s&7)}return i},fromJSON(t){return{coins:globalThis.Array.isArray(t?.coins)?t.coins.map(e=>O.fromJSON(e)):[],coinAddressesInChain:bl(t.coinAddressesInChain)?Object.entries(t.coinAddressesInChain).reduce((e,[r,n])=>(e[r]=O.fromJSON(n),e),{}):{}}},toJSON(t){let e={};if(t.coins?.length&&(e.coins=t.coins.map(r=>O.toJSON(r))),t.coinAddressesInChain){let r=Object.entries(t.coinAddressesInChain);r.length>0&&(e.coinAddressesInChain={},r.forEach(([n,i])=>{e.coinAddressesInChain[n]=O.toJSON(i)}))}return e},create(t){return Ri.fromPartial(t??{})},fromPartial(t){let e=Ei();return e.coins=t.coins?.map(r=>O.fromPartial(r))||[],e.coinAddressesInChain=Object.entries(t.coinAddressesInChain??{}).reduce((r,[n,i])=>(i!==void 0&&(r[n]=O.fromPartial(i)),r),{}),e}};function Ni(){return{key:"",value:void 0}}var ur={encode(t,e=g.default.Writer.create()){return t.key!==""&&e.uint32(10).string(t.key),t.value!==void 0&&O.encode(t.value,e.uint32(18).fork()).ldelim(),e},decode(t,e){let r=t instanceof g.default.Reader?t:g.default.Reader.create(t),n=e===void 0?r.len:r.pos+e,i=Ni();for(;r.pos<n;){let s=r.uint32();switch(s>>>3){case 1:if(s!==10)break;i.key=r.string();continue;case 2:if(s!==18)break;i.value=O.decode(r,r.uint32());continue}if((s&7)===4||s===0)break;r.skipType(s&7)}return i},fromJSON(t){return{key:w(t.key)?globalThis.String(t.key):"",value:w(t.value)?O.fromJSON(t.value):void 0}},toJSON(t){let e={};return t.key!==""&&(e.key=t.key),t.value!==void 0&&(e.value=O.toJSON(t.value)),e},create(t){return ur.fromPartial(t??{})},fromPartial(t){let e=Ni();return e.key=t.key??"",e.value=t.value!==void 0&&t.value!==null?O.fromPartial(t.value):void 0,e}};function wi(){return{prices:[],latestPrice:void 0}}var Mi={encode(t,e=g.default.Writer.create()){for(let r of t.prices)G.encode(r,e.uint32(10).fork()).ldelim();return t.latestPrice!==void 0&&G.encode(t.latestPrice,e.uint32(18).fork()).ldelim(),e},decode(t,e){let r=t instanceof g.default.Reader?t:g.default.Reader.create(t),n=e===void 0?r.len:r.pos+e,i=wi();for(;r.pos<n;){let s=r.uint32();switch(s>>>3){case 1:if(s!==10)break;i.prices.push(G.decode(r,r.uint32()));continue;case 2:if(s!==18)break;i.latestPrice=G.decode(r,r.uint32());continue}if((s&7)===4||s===0)break;r.skipType(s&7)}return i},fromJSON(t){return{prices:globalThis.Array.isArray(t?.prices)?t.prices.map(e=>G.fromJSON(e)):[],latestPrice:w(t.latestPrice)?G.fromJSON(t.latestPrice):void 0}},toJSON(t){let e={};return t.prices?.length&&(e.prices=t.prices.map(r=>G.toJSON(r))),t.latestPrice!==void 0&&(e.latestPrice=G.toJSON(t.latestPrice)),e},create(t){return Mi.fromPartial(t??{})},fromPartial(t){let e=wi();return e.prices=t.prices?.map(r=>G.fromPartial(r))||[],e.latestPrice=t.latestPrice!==void 0&&t.latestPrice!==null?G.fromPartial(t.latestPrice):void 0,e}};function Oi(){return{coinId:void 0,price:0,timestamp:void 0}}var G={encode(t,e=g.default.Writer.create()){return t.coinId!==void 0&&O.encode(t.coinId,e.uint32(10).fork()).ldelim(),t.price!==0&&e.uint32(17).double(t.price),t.timestamp!==void 0&&H.encode(vt(t.timestamp),e.uint32(26).fork()).ldelim(),e},decode(t,e){let r=t instanceof g.default.Reader?t:g.default.Reader.create(t),n=e===void 0?r.len:r.pos+e,i=Oi();for(;r.pos<n;){let s=r.uint32();switch(s>>>3){case 1:if(s!==10)break;i.coinId=O.decode(r,r.uint32());continue;case 2:if(s!==17)break;i.price=r.double();continue;case 3:if(s!==26)break;i.timestamp=Je(H.decode(r,r.uint32()));continue}if((s&7)===4||s===0)break;r.skipType(s&7)}return i},fromJSON(t){return{coinId:w(t.coinId)?O.fromJSON(t.coinId):void 0,price:w(t.price)?globalThis.Number(t.price):0,timestamp:w(t.timestamp)?St(t.timestamp):void 0}},toJSON(t){let e={};return t.coinId!==void 0&&(e.coinId=O.toJSON(t.coinId)),t.price!==0&&(e.price=t.price),t.timestamp!==void 0&&(e.timestamp=t.timestamp.toISOString()),e},create(t){return G.fromPartial(t??{})},fromPartial(t){let e=Oi();return e.coinId=t.coinId!==void 0&&t.coinId!==null?O.fromPartial(t.coinId):void 0,e.price=t.price??0,e.timestamp=t.timestamp??void 0,e}};function Ti(){return{name:"",symbol:"",chain:"",address:"",coingeckoId:"",decimals:0,logoUrl:"",projectUrl:"",accountAddress:"",moduleName:"",structName:""}}var ki={encode(t,e=g.default.Writer.create()){return t.name!==""&&e.uint32(10).string(t.name),t.symbol!==""&&e.uint32(18).string(t.symbol),t.chain!==""&&e.uint32(26).string(t.chain),t.address!==""&&e.uint32(34).string(t.address),t.coingeckoId!==""&&e.uint32(42).string(t.coingeckoId),t.decimals!==0&&e.uint32(48).uint32(t.decimals),t.logoUrl!==""&&e.uint32(58).string(t.logoUrl),t.projectUrl!==""&&e.uint32(66).string(t.projectUrl),t.accountAddress!==""&&e.uint32(74).string(t.accountAddress),t.moduleName!==""&&e.uint32(82).string(t.moduleName),t.structName!==""&&e.uint32(90).string(t.structName),e},decode(t,e){let r=t instanceof g.default.Reader?t:g.default.Reader.create(t),n=e===void 0?r.len:r.pos+e,i=Ti();for(;r.pos<n;){let s=r.uint32();switch(s>>>3){case 1:if(s!==10)break;i.name=r.string();continue;case 2:if(s!==18)break;i.symbol=r.string();continue;case 3:if(s!==26)break;i.chain=r.string();continue;case 4:if(s!==34)break;i.address=r.string();continue;case 5:if(s!==42)break;i.coingeckoId=r.string();continue;case 6:if(s!==48)break;i.decimals=r.uint32();continue;case 7:if(s!==58)break;i.logoUrl=r.string();continue;case 8:if(s!==66)break;i.projectUrl=r.string();continue;case 9:if(s!==74)break;i.accountAddress=r.string();continue;case 10:if(s!==82)break;i.moduleName=r.string();continue;case 11:if(s!==90)break;i.structName=r.string();continue}if((s&7)===4||s===0)break;r.skipType(s&7)}return i},fromJSON(t){return{name:w(t.name)?globalThis.String(t.name):"",symbol:w(t.symbol)?globalThis.String(t.symbol):"",chain:w(t.chain)?globalThis.String(t.chain):"",address:w(t.address)?globalThis.String(t.address):"",coingeckoId:w(t.coingeckoId)?globalThis.String(t.coingeckoId):"",decimals:w(t.decimals)?globalThis.Number(t.decimals):0,logoUrl:w(t.logoUrl)?globalThis.String(t.logoUrl):"",projectUrl:w(t.projectUrl)?globalThis.String(t.projectUrl):"",accountAddress:w(t.accountAddress)?globalThis.String(t.accountAddress):"",moduleName:w(t.moduleName)?globalThis.String(t.moduleName):"",structName:w(t.structName)?globalThis.String(t.structName):""}},toJSON(t){let e={};return t.name!==""&&(e.name=t.name),t.symbol!==""&&(e.symbol=t.symbol),t.chain!==""&&(e.chain=t.chain),t.address!==""&&(e.address=t.address),t.coingeckoId!==""&&(e.coingeckoId=t.coingeckoId),t.decimals!==0&&(e.decimals=Math.round(t.decimals)),t.logoUrl!==""&&(e.logoUrl=t.logoUrl),t.projectUrl!==""&&(e.projectUrl=t.projectUrl),t.accountAddress!==""&&(e.accountAddress=t.accountAddress),t.moduleName!==""&&(e.moduleName=t.moduleName),t.structName!==""&&(e.structName=t.structName),e},create(t){return ki.fromPartial(t??{})},fromPartial(t){let e=Ti();return e.name=t.name??"",e.symbol=t.symbol??"",e.chain=t.chain??"",e.address=t.address??"",e.coingeckoId=t.coingeckoId??"",e.decimals=t.decimals??0,e.logoUrl=t.logoUrl??"",e.projectUrl=t.projectUrl??"",e.accountAddress=t.accountAddress??"",e.moduleName=t.moduleName??"",e.structName=t.structName??"",e}};function xi(){return{symbol:"",message:""}}var Li={encode(t,e=g.default.Writer.create()){return t.symbol!==""&&e.uint32(10).string(t.symbol),t.message!==""&&e.uint32(18).string(t.message),e},decode(t,e){let r=t instanceof g.default.Reader?t:g.default.Reader.create(t),n=e===void 0?r.len:r.pos+e,i=xi();for(;r.pos<n;){let s=r.uint32();switch(s>>>3){case 1:if(s!==10)break;i.symbol=r.string();continue;case 2:if(s!==18)break;i.message=r.string();continue}if((s&7)===4||s===0)break;r.skipType(s&7)}return i},fromJSON(t){return{symbol:w(t.symbol)?globalThis.String(t.symbol):"",message:w(t.message)?globalThis.String(t.message):""}},toJSON(t){let e={};return t.symbol!==""&&(e.symbol=t.symbol),t.message!==""&&(e.message=t.message),e},create(t){return Li.fromPartial(t??{})},fromPartial(t){let e=xi();return e.symbol=t.symbol??"",e.message=t.message??"",e}},Di={name:"PriceService",fullName:"price_service.PriceService",methods:{getPrice:{name:"GetPrice",requestType:Ci,requestStream:!1,responseType:de,responseStream:!1,options:{_unknownFields:{578365826:[new Uint8Array([16,18,14,47,97,112,105,47,118,49,47,112,114,105,99,101,115])]}}},batchGetPrices:{name:"BatchGetPrices",requestType:Ii,requestStream:!1,responseType:Ai,responseStream:!1,options:{_unknownFields:{578365826:[new Uint8Array([22,18,20,47,97,112,105,47,118,49,47,112,114,105,99,101,115,47,98,97,116,99,104])]}}},listCoins:{name:"ListCoins",requestType:Pi,requestStream:!1,responseType:Ri,responseStream:!1,options:{_unknownFields:{578365826:[new Uint8Array([22,18,20,47,97,112,105,47,118,49,47,112,114,105,99,101,115,47,99,111,105,110,115])]}}},checkLatestPrice:{name:"CheckLatestPrice",requestType:$n,requestStream:!1,responseType:Mi,responseStream:!1,options:{_unknownFields:{578365826:[new Uint8Array([29,18,27,47,97,112,105,47,118,49,47,112,114,105,99,101,115,47,99,104,101,99,107,95,108,97,116,101,115,116])]}}},backfillCoin:{name:"BackfillCoin",requestType:ki,requestStream:!1,responseType:Li,responseStream:!1,options:{_unknownFields:{578365826:[new Uint8Array([28,34,23,47,97,112,105,47,118,49,47,112,114,105,99,101,115,47,98,97,99,107,102,105,108,108,58,1,42])]}}}}};function vt(t){let e=BigInt(Math.trunc(t.getTime()/1e3)),r=t.getTime()%1e3*1e6;return{seconds:e,nanos:r}}function Je(t){let e=(globalThis.Number(t.seconds.toString())||0)*1e3;return e+=(t.nanos||0)/1e6,new globalThis.Date(e)}function St(t){return t instanceof globalThis.Date?t:typeof t=="string"?new globalThis.Date(t):Je(H.fromJSON(t))}function bl(t){return typeof t=="object"&&t!==null}function w(t){return t!=null}var Ee=Ge(rl(),1),Xa=Ge(Ha(),1),Ka=Ge(Ya(),1);import{Endpoints as Sf}from"@sentio/runtime";function Fn(t){t||(t=Sf.INSTANCE.priceFeedAPI);let e=(0,Ee.createChannel)(t);return(0,Ee.createClientFactory)().use((0,Xa.prometheusClientMiddleware)()).use(Ka.retryMiddleware).create(Di,e)}var Se=new oe({max:1e5,ttl:1e3*60*60}),Fe;async function Za(t,e,r){return Fe||(Fe=Fn()),Ef(Fe,t,e,r)}async function Ef(t,e,r,n){let i=Vn(e),s=Vn(new Date),o;r.symbol?o=`${r.symbol}-${i}`:o=`${r.address?.address}-${r.address?.chain}-${i}`;let a=Se.get(o);return a||(a=t.getPrice({timestamp:e,coinId:r},{retry:!0,retryMaxAttempts:5}).then(c=>{if(c.timestamp)if(Vn(c.timestamp)===s)Se.delete(o);else{let h=Math.abs(c.timestamp.getTime()-e.getTime())/(1e3*60*60*24),p=n?.toleranceInDays||2;if(h>p){Se.delete(o);return}}else Se.delete(o);return c.price}).catch(c=>{if(setTimeout(()=>{Se.delete(o)},1e3),c.code===Ee.Status.NOT_FOUND||c.code===Ee.Status.UNKNOWN){console.error("price not found for ",JSON.stringify(r)," at ",i);return}throw Se.delete(o),c}),Se.set(o,a),a)}async function Nf(t,e,r,n){return Za(r,{address:{chain:t,address:e}},n)}async function wf(t,e,r){return Za(e,{symbol:t},r)}function Vn(t){return[t.getUTCDate(),t.getUTCMonth()+1,t.getUTCFullYear()].join("-")}async function Of(t){Fe||(Fe=Fn());let e=await Fe.listCoins({chain:t,limit:1e3});return Object.entries(e.coinAddressesInChain).map(([r,n])=>(n.symbol=r,n))}async function Lm(t,e=!1){try{return await t}catch(r){if(r instanceof Hn||r.code==="CALL_EXCEPTION"||r.code==="BAD_DATA"){e&&console.error("eth call exception, return undefined",r);return}throw r}}export{Ya as a,Ha as b,Tf as c,Cf as d,si as e,_l as f,gl as g,_h as h,gh as i,Fn as j,Nf as k,wf as l,Of as m,Lm as n};
16
- //# sourceMappingURL=chunk-KY5AFKV5.js.map
16
+ //# sourceMappingURL=chunk-DZVTAQNC.js.map