@stakekit/widget 0.0.293 → 0.0.294

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 (144) hide show
  1. package/dist/bundle/{DateTime-BBRIKkPv.js → DateTime-CMMZj2i-.js} +54 -54
  2. package/dist/bundle/{assets-vw12jo1v.js → assets-Bc9gJ-IT.js} +6 -6
  3. package/dist/bundle/{cardano-connector-DCWdS4Lt.js → cardano-connector-4FH7sm5s.js} +2 -2
  4. package/dist/bundle/{configured-chains-Bc6_pgMo.js → configured-chains-DF5IpaPp.js} +1 -1
  5. package/dist/bundle/{cosmos-connector-meta-Br67nymZ.js → cosmos-connector-meta-BKRBGzAs.js} +1 -1
  6. package/dist/bundle/index.bundle.js +13834 -13695
  7. package/dist/bundle/{ledger-connector-wZ-AWITi.js → ledger-connector-Em3Ex6Ns.js} +5 -5
  8. package/dist/bundle/{network-D8-Flo2u.js → network-D2ajkWp0.js} +1 -1
  9. package/dist/bundle/{reward-rate-chart-B41r4AU4.js → reward-rate-chart-6q6gJawR.js} +4 -4
  10. package/dist/bundle/{solana-connector-CXe_nU4I.js → solana-connector-DHrdMGZC.js} +3 -3
  11. package/dist/bundle/{stellar-connector-Cdl9Hnba.js → stellar-connector-DkR_jg41.js} +2 -2
  12. package/dist/bundle/{styles.css-BJ7-ORZP.js → styles.css-DQG3ba8V.js} +6 -6
  13. package/dist/bundle/{substrate-connector-DFeFqV_q.js → substrate-connector-CzewVoQ6.js} +1 -1
  14. package/dist/bundle/{ton-connector-CWmOukzn.js → ton-connector-CcahoFeW.js} +3 -3
  15. package/dist/bundle/{transaction-BwhgjU0e.js → transaction-BGiGADTK.js} +1 -1
  16. package/dist/bundle/{transaction-CUoDE6CU.js → transaction-BvpQWKqm.js} +1 -1
  17. package/dist/bundle/{transaction-B8S7Vgaq.js → transaction-CD_QhA6u.js} +2 -2
  18. package/dist/bundle/{transaction-DxrR2BHC.js → transaction-CiEShf7a.js} +1 -1
  19. package/dist/bundle/{tron-connector--M_0_Iy7.js → tron-connector-Dy_36o_J.js} +3 -3
  20. package/dist/bundle/{utils-CoW929-6.js → utils-BMTuLksW.js} +1 -1
  21. package/dist/bundle/{wallet-manager-C3rmOq7t.js → wallet-manager-BLaLHs2U.js} +11 -11
  22. package/dist/package/{DateTime-DJZXpaqx.js → DateTime-CGVpQQm9.js} +24 -2
  23. package/dist/package/{assets-BuIo5TOF.js → assets-CEn8BPdT.js} +1 -1
  24. package/dist/package/{cardano-connector-DIZuipB7.js → cardano-connector-BDWTBXaS.js} +2 -2
  25. package/dist/package/{configured-chains-B6PD9hvx.js → configured-chains-CRuy8tse.js} +1 -1
  26. package/dist/package/{cosmos-connector-meta-CgvZWkLV.js → cosmos-connector-meta-B-ke1Dvw.js} +1 -1
  27. package/dist/package/index.package.js +1682 -1449
  28. package/dist/package/{ledger-connector-B3kEcKjM.js → ledger-connector-BQDRUjOJ.js} +5 -5
  29. package/dist/package/{network-B4Qs3uRl.js → network-K03Uj00V.js} +1 -1
  30. package/dist/package/{reward-rate-chart-B42ZCby7.js → reward-rate-chart-DBx39GdL.js} +2 -2
  31. package/dist/package/{solana-connector-VG2pC1EJ.js → solana-connector-fL70NOkD.js} +3 -3
  32. package/dist/package/{stellar-connector-DO9tJUOg.js → stellar-connector-C_33sqO5.js} +2 -2
  33. package/dist/package/{styles.css-DwJjrmLr.js → styles.css-BOghDWGq.js} +1 -1
  34. package/dist/package/{substrate-connector-P80MVt5T.js → substrate-connector-Cr7LEt2o.js} +1 -1
  35. package/dist/package/{ton-connector-3rqiqNZO.js → ton-connector-81-rUhzX.js} +3 -3
  36. package/dist/package/{transaction-DTbU7sxm.js → transaction-BHIZ9rKF.js} +1 -1
  37. package/dist/package/{transaction-CuMGfUeE.js → transaction-C5e_gCK6.js} +1 -1
  38. package/dist/package/{transaction-V39s0qKU.js → transaction-DMMfLvk1.js} +2 -2
  39. package/dist/package/{transaction-Do_oUKxl.js → transaction-DgdU5pHH.js} +1 -1
  40. package/dist/package/{tron-connector-CKUZFHDh.js → tron-connector-Cuez3U16.js} +3 -3
  41. package/dist/package/{wallet-manager-CioQJQ5H.js → wallet-manager-DWFwmdLb.js} +2 -2
  42. package/dist/website/assets/AlertController-Dd3t1FDe.js +1 -0
  43. package/dist/website/assets/{CaipNetworkUtil-CIgzbD6k.js → CaipNetworkUtil-CyIDQhS0.js} +1 -1
  44. package/dist/website/assets/DateTime-ByC3zr_K.js +1 -0
  45. package/dist/website/assets/{HelpersUtil-BokHy7la.js → HelpersUtil-Bpil3MMz.js} +1 -1
  46. package/dist/website/assets/ModalController-BhWRBcfd.js +5 -0
  47. package/dist/website/assets/{albedo.module-Dn9vkw3f.js → albedo.module-DkOe0Unb.js} +1 -1
  48. package/dist/website/assets/assets-DXO6qW6R.js +2 -0
  49. package/dist/website/assets/{axios-Dl6BaS8Y.js → axios-rFNl7rAx.js} +2 -2
  50. package/dist/website/assets/{base-signer-b1ff2VPI-DF_m1Hx-.js → base-signer-b1ff2VPI-DEykpag5.js} +1 -1
  51. package/dist/website/assets/{basic-Bt_YnOIC.js → basic-By5_muQ4.js} +1 -1
  52. package/dist/website/assets/bignumber-FohbSRh0.js +1 -0
  53. package/dist/website/assets/blakejs-x6iaQxOd.js +3 -0
  54. package/dist/website/assets/bn-Ck4DeaX2.js +1 -0
  55. package/dist/website/assets/{browser-ponyfill-_v4sZCld.js → browser-ponyfill-lHyeX8iJ.js} +1 -1
  56. package/dist/website/assets/{bs58-CiFyCgrv.js → bs58-gzsgdke5.js} +1 -1
  57. package/dist/website/assets/{build-DM4Sawu1.js → build-ClRxYQRR.js} +1 -1
  58. package/dist/website/assets/{build-Butjcagw.js → build-TBrHU398.js} +1 -1
  59. package/dist/website/assets/{build-B5AnTSOq.js → build-Tl3I8dhV.js} +1 -1
  60. package/dist/website/assets/{cardano-connector-BC5bF4Y2.js → cardano-connector-8El4Ztf_.js} +9 -9
  61. package/dist/website/assets/{configured-chains-Bp7rWkOZ.js → configured-chains-DQ_M8-li.js} +1 -1
  62. package/dist/website/assets/core-BiDQVY37.js +2 -0
  63. package/dist/website/assets/{cosmos-connector-meta-CZFaunIB.js → cosmos-connector-meta-DRTieEt0.js} +1 -1
  64. package/dist/website/assets/dist-BVuLBvyS.js +7 -0
  65. package/dist/website/assets/{dist-BKdXTi2f.js → dist-Bo7ZdXT8.js} +3 -3
  66. package/dist/website/assets/{dist-7PipG_eL.js → dist-DlLKQSrv.js} +3 -3
  67. package/dist/website/assets/dist-ZKTSEBXW.js +1 -0
  68. package/dist/website/assets/{elliptic-j9CClrcl.js → elliptic-BdE4gFqn.js} +2 -2
  69. package/dist/website/assets/{esm-DVfwo40P.js → esm-BjyHrLEJ.js} +1 -1
  70. package/dist/website/assets/events-CMzhc0tf.js +1 -0
  71. package/dist/website/assets/{extrinsic-encoding-B3zynq2U.js → extrinsic-encoding-BIj1XBpl.js} +1 -1
  72. package/dist/website/assets/{features-LE43LGiF.js → features-Cy1CFK9a.js} +1 -1
  73. package/dist/website/assets/{fhevm-relayer-DXLb4mIw-bVmGMiQn.js → fhevm-relayer-DXLb4mIw-Bbrz0cha.js} +5 -3
  74. package/dist/website/assets/freighter.module-DsmrpiWT.js +1 -0
  75. package/dist/website/assets/index-7hHJ2eI5.js +558 -0
  76. package/dist/website/assets/index-zFAIWvcU.css +1 -0
  77. package/dist/website/assets/{index.es-D6B6PG3M.js → index.es-BGzDKZr_.js} +1 -1
  78. package/dist/website/assets/index.es-BHs2-Pa6.js +1 -0
  79. package/dist/website/assets/{index.es-wqX1ruQA.js → index.es-Bpga9r91.js} +5 -5
  80. package/dist/website/assets/{kms_lib-mPebVu09.js → kms_lib-BgnOy0xU.js} +1 -1
  81. package/dist/website/assets/{kms_lib-Bh_Z1nH6.js → kms_lib-w0jRi8cP.js} +1 -1
  82. package/dist/website/assets/{ledger-connector-BOOoTKx_.js → ledger-connector-CNNjVgC1.js} +3 -3
  83. package/dist/website/assets/{lib-es-5LFNYQ9J.js → lib-es-DmH9FYVZ.js} +1 -1
  84. package/dist/website/assets/lobstr.module-BUAItZUt.js +1 -0
  85. package/dist/website/assets/{nacl-fast-BI97gFtf.js → nacl-fast-B5R4wpqG.js} +1 -1
  86. package/dist/website/assets/{nacl-util-DCWJejqG.js → nacl-util-6167mj42.js} +1 -1
  87. package/dist/website/assets/{network-CEcIzsgc.js → network-BVzpe0Ii.js} +1 -1
  88. package/dist/website/assets/{polkadot-ledger-transaction-DaDP252u.js → polkadot-ledger-transaction-Dp6EFfyV.js} +1 -1
  89. package/dist/website/assets/registry-BgQw-qJW.js +1 -0
  90. package/dist/website/assets/{reward-rate-chart-COP_M115.js → reward-rate-chart-CO_yI4og.js} +4 -4
  91. package/dist/website/assets/{safe-buffer-Dz6e-rwu.js → safe-buffer-BUgQmBOp.js} +1 -1
  92. package/dist/website/assets/{safe-connector-DG2cXEO5.js → safe-connector-BObu9WgG.js} +2 -2
  93. package/dist/website/assets/{solana-connector-DSpWnxwA.js → solana-connector-CVuV_EKp.js} +1 -1
  94. package/dist/website/assets/{src-Zq1Jw-Sn.js → src-DbdC_Alu.js} +1 -1
  95. package/dist/website/assets/{src-hSPfFTzN.js → src-Dl7INWvU.js} +1 -1
  96. package/dist/website/assets/state-D5Nw1L4F.js +1 -0
  97. package/dist/website/assets/{stellar-connector-BAbbdkSK.js → stellar-connector-Ba7Jcrbg.js} +1 -1
  98. package/dist/website/assets/styles.css-NtRiu07M.js +1 -0
  99. package/dist/website/assets/substrate-connector-hQ3vc47X.js +2 -0
  100. package/dist/website/assets/tfhe-BACovsAk.js +1 -0
  101. package/dist/website/assets/{tfhe-DuWT_ao1.js → tfhe-BSAXrnM6.js} +1 -1
  102. package/dist/website/assets/ton-connector-CU1xiP2u.js +2264 -0
  103. package/dist/website/assets/tracking-variants-CtfEiKNR.js +93 -0
  104. package/dist/website/assets/{transaction-BH4ssPh3.js → transaction-B5hUD0AE.js} +1 -1
  105. package/dist/website/assets/{transaction-BVuftLt1.js → transaction-BWEzzOww.js} +1 -1
  106. package/dist/website/assets/transaction-BmFUkzQv.js +2 -0
  107. package/dist/website/assets/{transaction-1KdJeqcp.js → transaction-C_iyacpP.js} +1 -1
  108. package/dist/website/assets/{tron-connector-CJURHEQe.js → tron-connector-gXtlAAuG.js} +7 -7
  109. package/dist/website/assets/{tx-Bkou_ALe.js → tx-Cosvp39i.js} +1 -1
  110. package/dist/website/assets/{utils-CH0e59XB.js → utils-meUBO1X1.js} +1 -1
  111. package/dist/website/assets/{viem-BQ_7aeKB.js → viem-8-EtcU49.js} +1 -1
  112. package/dist/website/assets/{w3m-modal-BLY--NNS.js → w3m-modal-HS9RLkN8.js} +2 -2
  113. package/dist/website/assets/wallet-manager-BQrZx180.js +5 -0
  114. package/dist/website/assets/{web-4qAQ-Ymk.js → web-azgm2Psf.js} +1 -1
  115. package/dist/website/assets/{wui-list-item-1gzb5UQJ.js → wui-list-item-CfZ1WQql.js} +1 -1
  116. package/dist/website/assets/{xbull.module-B4N1LGQD.js → xbull.module-DQx6rh7x.js} +1 -1
  117. package/dist/website/index.html +19 -19
  118. package/package.json +2 -2
  119. package/dist/website/assets/AlertController-CH5fpr36.js +0 -1
  120. package/dist/website/assets/DateTime-DR7XeJxF.js +0 -1
  121. package/dist/website/assets/ModalController-CWwEAkfw.js +0 -5
  122. package/dist/website/assets/assets-Dk5ppLtc.js +0 -2
  123. package/dist/website/assets/bignumber-CziKLYjt.js +0 -1
  124. package/dist/website/assets/blakejs-Dx-Zt5zT.js +0 -3
  125. package/dist/website/assets/bn-CJG5j3KW.js +0 -1
  126. package/dist/website/assets/core-uatW2d6Y.js +0 -2
  127. package/dist/website/assets/dist-CELdgNh9.js +0 -1
  128. package/dist/website/assets/dist-omv2KNC4.js +0 -5
  129. package/dist/website/assets/events-D2w4OsQJ.js +0 -1
  130. package/dist/website/assets/freighter.module-CaBNS6Y-.js +0 -1
  131. package/dist/website/assets/index-CRRnuuvK.js +0 -540
  132. package/dist/website/assets/index-mVJBJZFp.css +0 -1
  133. package/dist/website/assets/index.es-DCi2xZ1b.js +0 -1
  134. package/dist/website/assets/lobstr.module-GQjJAf8P.js +0 -1
  135. package/dist/website/assets/registry-DVfYVrCY.js +0 -1
  136. package/dist/website/assets/state-B8Vu3fYx.js +0 -1
  137. package/dist/website/assets/styles.css-BK5OO2Hh.js +0 -1
  138. package/dist/website/assets/substrate-connector-CwnGlD2K.js +0 -2
  139. package/dist/website/assets/tfhe-PDJAG8Bv.js +0 -1
  140. package/dist/website/assets/ton-connector-DMNOeieX.js +0 -2264
  141. package/dist/website/assets/tracking-variants-CuRpr0B_.js +0 -85
  142. package/dist/website/assets/transaction-CbxrIerN.js +0 -2
  143. package/dist/website/assets/wallet-manager-D8tOJ1jy.js +0 -5
  144. package/dist/website/mockServiceWorker.js +0 -460
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/polkadot-ledger-transaction-DaDP252u.js","assets/Result-DQM8aaFz.js","assets/registry-DVfYVrCY.js","assets/rolldown-runtime-BcKkbAw3.js","assets/dist-D6L6gF64.js","assets/sha3-DRlIjSdj.js","assets/_u64-BLNH_r32.js","assets/esm-CjTnkPtf.js","assets/bn-CJG5j3KW.js","assets/secp256k1-BcfUQvi6.js","assets/hmac-DY3QYcUU.js","assets/_shortw_utils-60uxgahw.js","assets/blake2b-BMPujwy0.js","assets/blake2-CL6aokTA.js"])))=>i.map(i=>d[i]);
2
- import{s as e,t}from"./rolldown-runtime-BcKkbAw3.js";import{c as n,d as r,i,r as a,t as o}from"./Result-DQM8aaFz.js";import{vi as s}from"./Cause-1VWVIQY3.js";import{A as c,B as l,C as u,K as d,M as f,k as p,p as m,q as h,r as g,rt as _,sn as v,vt as y}from"./assets-Dk5ppLtc.js";import{F as b,n as x,s as S,t as C}from"./wagmi-connect-result-ChkXAqK2.js";import{$ as ee,G as w,It as te,K as T,Wt as E,j as D,l as ne,nt as re,w as ie}from"./Effect-Cu_VlOsF.js";import{t as ae}from"./preload-helper-BLdHbfdN.js";import{S as oe,b as se,l as ce,n as le,o as ue,s as de,t as fe,w as pe,y as me}from"./transaction-1KdJeqcp.js";import{a as he,o as ge}from"./network-CEcIzsgc.js";import{er as _e}from"./call-ttPZjh8C.js";import{r as O,t as k}from"./dist-CELdgNh9.js";import{t as ve}from"./current-value-stream-B0d3-tpK.js";import{t as ye}from"./events-D2w4OsQJ.js";import{t as be}from"./lib-es-5LFNYQ9J.js";import{a as xe,i as Se,n as Ce}from"./transaction-BVuftLt1.js";import{n as we}from"./transaction-BH4ssPh3.js";import{$ as Te,$n as Ee,$t as De,A as Oe,An as ke,At as Ae,B as je,Bn as Me,Bt as Ne,C as Pe,Cn as Fe,D as Ie,Dn as Le,Dt as Re,E as ze,En as Be,Et as Ve,F as He,Ft as Ue,G as We,Gn as Ge,Gt as Ke,H as qe,Ht as Je,I as Ye,It as Xe,J as Ze,Jn as Qe,Jt as $e,K as et,Kn as tt,Kt as nt,L as rt,Ln as it,Lt as at,M as ot,Mn as st,Mt as ct,N as lt,Nt as ut,O as dt,On as ft,Ot as pt,P as mt,Pt as ht,Q as gt,Qn as _t,Qt as vt,R as yt,Rn as bt,Rt as xt,S as St,Sn as Ct,St as wt,T as Tt,Tn as Et,Tt as Dt,U as Ot,Un as kt,Ut as At,V as jt,Vn as Mt,Vt as Nt,Wn as A,Wt as Pt,X as Ft,Xn as It,Xt as Lt,Y as Rt,Yn as zt,Z as Bt,Zn as Vt,Zt as Ht,_ as Ut,_n as Wt,_r as Gt,_t as Kt,an as qt,ar as Jt,at as Yt,b as Xt,bn as Zt,bt as Qt,c as $t,cn as en,cr as tn,ct as nn,dn as rn,dr as an,dt as on,en as sn,er as cn,et as ln,fn as un,fr as dn,ft as fn,g as pn,gn as mn,gr as hn,gt as gn,h as _n,hn as vn,hr as yn,i as bn,in as xn,ir as Sn,it as Cn,j as wn,jn as Tn,jt as En,k as Dn,kn as On,kt as kn,l as An,ln as jn,lr as Mn,lt as Nn,m as Pn,mn as Fn,mr as In,mt as Ln,n as Rn,nn as zn,nr as Bn,nt as Vn,o as Hn,on as Un,or as Wn,ot as Gn,p as Kn,pn as qn,pr as Jn,pt as Yn,q as Xn,qn as Zn,qt as Qn,r as $n,rn as er,rr as tr,rt as nr,s as rr,sn as ir,sr as ar,st as or,t as sr,tn as cr,tr as lr,tt as ur,u as dr,un as fr,ur as pr,ut as mr,v as hr,vn as gr,vr as _r,vt as vr,w as yr,wn as br,wt as xr,x as Sr,xn as Cr,xt as wr,y as Tr,yn as Er,yt as Dr,zn as Or,zt as kr}from"./api-DpIjV5BK.js";import{t as Ar}from"./wagmi-connector-events-uWDzb_Wq.js";O();var jr=e(ye()),Mr;(function(e){e.Unknown=`Unknown`,e.LocationServicesDisabled=`LocationServicesDisabled`,e.LocationServicesUnauthorized=`LocationServicesUnauthorized`,e.BluetoothScanStartFailed=`BluetoothScanStartFailed`})(Mr||={});var Nr=class extends Error{id;constructor(e,t){let n=`TransportError`;super(e||n),this.name=n,this.message=e,this.stack=Error(e).stack,this.id=t}},Pr={ACCESS_CONDITION_NOT_FULFILLED:38916,ALGORITHM_NOT_SUPPORTED:38020,CLA_NOT_SUPPORTED:28160,CLA_NOT_SUPPORTED_BOOTLOADER:28161,CODE_BLOCKED:38976,CODE_NOT_INITIALIZED:38914,COMMAND_INCOMPATIBLE_FILE_STRUCTURE:27009,CONDITIONS_OF_USE_NOT_SATISFIED:27013,CONTRADICTION_INVALIDATION:38928,CONTRADICTION_SECRET_CODE_STATUS:38920,DEVICE_IN_RECOVERY_MODE:26159,CUSTOM_IMAGE_EMPTY:26158,FILE_ALREADY_EXISTS:27273,FILE_NOT_FOUND:37892,GP_AUTH_FAILED:25344,HALTED:28586,INCONSISTENT_FILE:37896,INCORRECT_DATA:27264,INCORRECT_LENGTH:26368,INCORRECT_P1_P2:27392,INS_NOT_SUPPORTED:27904,DEVICE_NOT_ONBOARDED:27911,DEVICE_NOT_ONBOARDED_2:26129,INVALID_KCV:38021,INVALID_OFFSET:37890,LICENSING:28482,LOCKED_DEVICE:21781,MAX_VALUE_REACHED:38992,MEMORY_PROBLEM:37440,MISSING_CRITICAL_PARAMETER:26624,NO_EF_SELECTED:37888,NOT_ENOUGH_MEMORY_SPACE:27268,OK:36864,PIN_REMAINING_ATTEMPTS:25536,REFERENCED_DATA_NOT_FOUND:27272,SECURITY_STATUS_NOT_SATISFIED:27010,TECHNICAL_PROBLEM:28416,UNKNOWN_APDU:27906,USER_REFUSED_ON_DEVICE:21761,NOT_ENOUGH_SPACE:20738,APP_NOT_FOUND_OR_INVALID_CONTEXT:20771,INVALID_APP_NAME_LENGTH:26378,GEN_AES_KEY_FAILED:21529,INTERNAL_CRYPTO_OPERATION_FAILED:21530,INTERNAL_COMPUTE_AES_CMAC_FAILED:21531,ENCRYPT_APP_STORAGE_FAILED:21532,INVALID_BACKUP_STATE:26178,PIN_NOT_SET:21762,INVALID_BACKUP_LENGTH:26419,INVALID_RESTORE_STATE:26179,INVALID_CHUNK_LENGTH:26420,INVALID_BACKUP_HEADER:26698,SW_BAD_STATE:45063};function Fr(e){switch(e){case 26368:return`Incorrect length`;case 26624:return`Missing critical parameter`;case 27010:return`Security not satisfied (dongle locked or have invalid access rights)`;case 27013:return`Condition of use not satisfied (denied by the user?)`;case 27264:return`Invalid data received`;case 27392:return`Invalid parameter received`;case 21781:return`Locked device`;case 45063:return`Unexpected state on the device`}if(28416<=e&&e<=28671)return`Internal error, please report`}var Ir=class e extends Error{statusCode;statusText;constructor(t,{canBeMappedToChildError:n=!0}={}){let r=Object.entries(Pr).find(([,e])=>e===t)?.[0]||`UNKNOWN_ERROR`,i=`Ledger device: ${Fr(t)||r} (0x${t.toString(16)})`;if(super(i||`TransportStatusError`),this.name=`TransportStatusError`,this.statusCode=t,this.statusText=r,Object.setPrototypeOf(this,e.prototype),n&&t===Pr.LOCKED_DEVICE)return new Lr(i)}},Lr=class e extends Ir{constructor(t){super(Pr.LOCKED_DEVICE,{canBeMappedToChildError:!1}),t&&(this.message=t),this.name=`LockedDeviceError`,Object.setPrototypeOf(this,e.prototype)}},Rr=class extends Error{name=`TransportRaceCondition`;constructor(e){super(e||`TransportRaceCondition`)}},zr=`transport`,Br=class{exchangeTimeout=3e4;unresponsiveTimeout=15e3;deviceModel=null;tracer;constructor({context:e,logType:t}={}){this.tracer=new be(t??zr,e)}static isSupported;static list;static listen;static open;exchange(e,{abortTimeoutMs:t}={}){throw Error(`exchange not implemented`)}exchangeBulk(e,t){let n=!1;return(async()=>{if(!n)for(let r of e){let e=await this.exchange(r);if(n)return;let i=e.readUInt16BE(e.length-2);if(i!==Pr.OK)throw new Ir(i);t.next(e)}})().then(()=>!n&&t.complete(),e=>!n&&t.error(e)),{unsubscribe:()=>{n=!0}}}setScrambleKey(e){}close(){return Promise.resolve()}_events=new jr.default;on(e,t){this._events.on(e,t)}off(e,t){this._events.removeListener(e,t)}emit(e,...t){this._events.emit(e,...t)}setDebugMode(){}setExchangeTimeout(e){this.exchangeTimeout=e}setExchangeUnresponsiveTimeout(e){this.unresponsiveTimeout=e}send=async(e,t,n,r,i=k.alloc(0),a=[Pr.OK],{abortTimeoutMs:o}={})=>{let s=this.tracer.withUpdatedContext({function:`send`});if(i.length>=256)throw s.trace(`data.length exceeded 256 bytes limit`,{dataLength:i.length}),new Nr(`data.length exceed 256 bytes limit. Got: `+i.length,`DataLengthTooBig`);let c=await this.exchange(k.concat([k.from([e,t,n,r]),k.from([i.length]),i]),{abortTimeoutMs:o}),l=c.readUInt16BE(c.length-2);if(!a.some(e=>e===l))throw new Ir(l);return c};static create(e=3e3,t){return new Promise((n,r)=>{let i=!1,a=this.listen({next:t=>{i=!0,a&&a.unsubscribe(),o&&clearTimeout(o),this.open(t.descriptor,e).then(n,r)},error:e=>{o&&clearTimeout(o),r(e)},complete:()=>{o&&clearTimeout(o),i||r(new Nr(this.ErrorMessage_NoDeviceFound,`NoDeviceFound`))}}),o=t?setTimeout(()=>{a.unsubscribe(),r(new Nr(this.ErrorMessage_ListenTimeout,`ListenTimeout`))},t):null})}exchangeBusyPromise;async exchangeAtomicImpl(e){let t=this.tracer.withUpdatedContext({function:`exchangeAtomicImpl`,unresponsiveTimeout:this.unresponsiveTimeout});if(this.exchangeBusyPromise)throw t.trace(`Atomic exchange is already busy`),new Rr(`An action was already pending on the Ledger device. Please deny or reconnect.`);let n,r=new Promise(e=>{n=e});this.exchangeBusyPromise=r;let i=!1,a=setTimeout(()=>{t.trace(`Timeout reached, emitting Transport event "unresponsive"`,{unresponsiveTimeout:this.unresponsiveTimeout}),i=!0,this.emit(`unresponsive`)},this.unresponsiveTimeout);try{let n=await e();return i&&(t.trace(`Device was unresponsive, emitting responsive`),this.emit(`responsive`)),n}finally{t.trace(`Finalize, clearing busy guard`),clearTimeout(a),n&&n(),this.exchangeBusyPromise=null}}decorateAppAPIMethods(e,t,n){for(let r of t)e[r]=this.decorateAppAPIMethod(r,e[r],e,n)}_appAPIlock=null;decorateAppAPIMethod(e,t,n,r){return async(...i)=>{let{_appAPIlock:a}=this;if(a)return Promise.reject(new Nr(`Ledger Device is busy (lock `+a+`)`,`TransportLocked`));try{return this._appAPIlock=e,this.setScrambleKey(r),await t.apply(n,i)}finally{this._appAPIlock=null}}}setTraceContext(e){this.tracer=this.tracer.withContext(e)}updateTraceContext(e){this.tracer.updateContext(e)}getTraceContext(){return this.tracer.getContext()}static ErrorMessage_ListenTimeout=`No Ledger device found (timeout)`;static ErrorMessage_NoDeviceFound=`No Ledger device found`},Vr=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Hr=Math.ceil,Ur=Math.floor,j=`[BigNumber Error] `,Wr=j+`Number primitive has more than 15 significant digits: `,Gr=0x5af3107a4000,M=14,Kr=9007199254740991,qr=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,0xe8d4a51000,0x9184e72a000],Jr=1e7,N=1e9;function Yr(e){var t,n,r,i=v.prototype={constructor:v,toString:null,valueOf:null},a=new v(1),o=20,s=4,c=-7,l=21,u=-1e7,d=1e7,f=!1,p=1,m=0,h={prefix:``,groupSize:3,secondaryGroupSize:0,groupSeparator:`,`,decimalSeparator:`.`,fractionGroupSize:0,fractionGroupSeparator:`\xA0`,suffix:``},g=`0123456789abcdefghijklmnopqrstuvwxyz`,_=!0;function v(e,t){var i,a,c,l,f,p,m,h,y=this;if(!(y instanceof v))return new v(e,t);if(t==null){if(e&&e._isBigNumber===!0){y.s=e.s,!e.c||e.e>d?y.c=y.e=null:e.e<u?y.c=[y.e=0]:(y.e=e.e,y.c=e.c.slice());return}if((p=typeof e==`number`)&&e*0==0){if(y.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,f=e;f>=10;f/=10,l++);l>d?y.c=y.e=null:(y.e=l,y.c=[e]);return}h=String(e)}else{if(!Vr.test(h=String(e)))return r(y,h,p);y.s=h.charCodeAt(0)==45?(h=h.slice(1),-1):1}(l=h.indexOf(`.`))>-1&&(h=h.replace(`.`,``)),(f=h.search(/e/i))>0?(l<0&&(l=f),l+=+h.slice(f+1),h=h.substring(0,f)):l<0&&(l=h.length)}else{if(F(t,2,g.length,`Base`),t==10&&_)return y=new v(e),S(y,o+y.e+1,s);if(h=String(e),p=typeof e==`number`){if(e*0!=0)return r(y,h,p,t);if(y.s=1/e<0?(h=h.slice(1),-1):1,v.DEBUG&&h.replace(/^0\.0*|\./,``).length>15)throw Error(Wr+e)}else y.s=h.charCodeAt(0)===45?(h=h.slice(1),-1):1;for(i=g.slice(0,t),l=f=0,m=h.length;f<m;f++)if(i.indexOf(a=h.charAt(f))<0){if(a==`.`){if(f>l){l=m;continue}}else if(!c&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){c=!0,f=-1,l=0;continue}return r(y,String(e),p,t)}p=!1,h=n(h,t,10,y.s),(l=h.indexOf(`.`))>-1?h=h.replace(`.`,``):l=h.length}for(f=0;h.charCodeAt(f)===48;f++);for(m=h.length;h.charCodeAt(--m)===48;);if(h=h.slice(f,++m)){if(m-=f,p&&v.DEBUG&&m>15&&(e>Kr||e!==Ur(e)))throw Error(Wr+y.s*e);if((l=l-f-1)>d)y.c=y.e=null;else if(l<u)y.c=[y.e=0];else{if(y.e=l,y.c=[],f=(l+1)%M,l<0&&(f+=M),f<m){for(f&&y.c.push(+h.slice(0,f)),m-=M;f<m;)y.c.push(+h.slice(f,f+=M));f=M-(h=h.slice(f)).length}else f-=m;for(;f--;h+=`0`);y.c.push(+h)}}else y.c=[y.e=0]}v.clone=Yr,v.ROUND_UP=0,v.ROUND_DOWN=1,v.ROUND_CEIL=2,v.ROUND_FLOOR=3,v.ROUND_HALF_UP=4,v.ROUND_HALF_DOWN=5,v.ROUND_HALF_EVEN=6,v.ROUND_HALF_CEIL=7,v.ROUND_HALF_FLOOR=8,v.EUCLID=9,v.config=v.set=function(e){var t,n;if(e!=null){if(typeof e==`object`){if(e.hasOwnProperty(t=`DECIMAL_PLACES`)&&(n=e[t],F(n,0,N,t),o=n),e.hasOwnProperty(t=`ROUNDING_MODE`)&&(n=e[t],F(n,0,8,t),s=n),e.hasOwnProperty(t=`EXPONENTIAL_AT`)&&(n=e[t],n&&n.pop?(F(n[0],-N,0,t),F(n[1],0,N,t),c=n[0],l=n[1]):(F(n,-N,N,t),c=-(l=n<0?-n:n))),e.hasOwnProperty(t=`RANGE`)){if(n=e[t],n&&n.pop)F(n[0],-N,-1,t),F(n[1],1,N,t),u=n[0],d=n[1];else if(F(n,-N,N,t),n)u=-(d=n<0?-n:n);else throw Error(j+t+` cannot be zero: `+n)}if(e.hasOwnProperty(t=`CRYPTO`)){if(n=e[t],n===!!n){if(n){if(typeof crypto<`u`&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=n;else throw f=!n,Error(j+`crypto unavailable`)}else f=n}else throw Error(j+t+` not true or false: `+n)}if(e.hasOwnProperty(t=`MODULO_MODE`)&&(n=e[t],F(n,0,9,t),p=n),e.hasOwnProperty(t=`POW_PRECISION`)&&(n=e[t],F(n,0,N,t),m=n),e.hasOwnProperty(t=`FORMAT`)){if(n=e[t],typeof n==`object`)h=n;else throw Error(j+t+` not an object: `+n)}if(e.hasOwnProperty(t=`ALPHABET`)){if(n=e[t],typeof n==`string`&&!/^.?$|[+\-.\s]|(.).*\1/.test(n))_=n.slice(0,10)==`0123456789`,g=n;else throw Error(j+t+` invalid: `+n)}}else throw Error(j+`Object expected: `+e)}return{DECIMAL_PLACES:o,ROUNDING_MODE:s,EXPONENTIAL_AT:[c,l],RANGE:[u,d],CRYPTO:f,MODULO_MODE:p,POW_PRECISION:m,FORMAT:h,ALPHABET:g}},v.isBigNumber=function(e){if(!e||e._isBigNumber!==!0)return!1;if(!v.DEBUG)return!0;var t,n,r=e.c,i=e.e,a=e.s;out:if({}.toString.call(r)==`[object Array]`){if((a===1||a===-1)&&i>=-N&&i<=N&&i===Ur(i)){if(r[0]===0){if(i===0&&r.length===1)return!0;break out}if(t=(i+1)%M,t<1&&(t+=M),String(r[0]).length==t){for(t=0;t<r.length;t++)if(n=r[t],n<0||n>=Gr||n!==Ur(n))break out;if(n!==0)return!0}}}else if(r===null&&i===null&&(a===null||a===1||a===-1))return!0;throw Error(j+`Invalid BigNumber: `+e)},v.maximum=v.max=function(){return b(arguments,-1)},v.minimum=v.min=function(){return b(arguments,1)},v.random=(function(){var e=9007199254740992,t=Math.random()*e&2097151?function(){return Ur(Math.random()*e)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(e){var n,r,i,s,c,l=0,u=[],d=new v(a);if(e==null?e=o:F(e,0,N),s=Hr(e/M),f){if(crypto.getRandomValues){for(n=crypto.getRandomValues(new Uint32Array(s*=2));l<s;)c=n[l]*131072+(n[l+1]>>>11),c>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),n[l]=r[0],n[l+1]=r[1]):(u.push(c%0x5af3107a4000),l+=2);l=s/2}else if(crypto.randomBytes){for(n=crypto.randomBytes(s*=7);l<s;)c=(n[l]&31)*281474976710656+n[l+1]*1099511627776+n[l+2]*4294967296+n[l+3]*16777216+(n[l+4]<<16)+(n[l+5]<<8)+n[l+6],c>=9e15?crypto.randomBytes(7).copy(n,l):(u.push(c%0x5af3107a4000),l+=7);l=s/7}else throw f=!1,Error(j+`crypto unavailable`)}if(!f)for(;l<s;)c=t(),c<9e15&&(u[l++]=c%0x5af3107a4000);for(s=u[--l],e%=M,s&&e&&(c=qr[M-e],u[l]=Ur(s/c)*c);u[l]===0;u.pop(),l--);if(l<0)u=[i=0];else{for(i=-1;u[0]===0;u.splice(0,1),i-=M);for(l=1,c=u[0];c>=10;c/=10,l++);l<M&&(i-=M-l)}return d.e=i,d.c=u,d}})(),v.sum=function(){for(var e=1,t=arguments,n=new v(t[0]);e<t.length;)n=n.plus(t[e++]);return n},n=(function(){var e=`0123456789`;function n(e,t,n,r){for(var i,a=[0],o,s=0,c=e.length;s<c;){for(o=a.length;o--;a[o]*=t);for(a[0]+=r.indexOf(e.charAt(s++)),i=0;i<a.length;i++)a[i]>n-1&&(a[i+1]??(a[i+1]=0),a[i+1]+=a[i]/n|0,a[i]%=n)}return a.reverse()}return function(r,i,a,c,l){var u,d,f,p,h,_,y,b,x=r.indexOf(`.`),S=o,C=s;for(x>=0&&(p=m,m=0,r=r.replace(`.`,``),b=new v(i),_=b.pow(r.length-x),m=p,b.c=n(ei(Xr(_.c),_.e,`0`),10,a,e),b.e=b.c.length),y=n(r,i,a,l?(u=g,e):(u=e,g)),f=p=y.length;y[--p]==0;y.pop());if(!y[0])return u.charAt(0);if(x<0?--f:(_.c=y,_.e=f,_.s=c,_=t(_,b,S,C,a),y=_.c,h=_.r,f=_.e),d=f+S+1,x=y[d],p=a/2,h=h||d<0||y[d+1]!=null,h=C<4?(x!=null||h)&&(C==0||C==(_.s<0?3:2)):x>p||x==p&&(C==4||h||C==6&&y[d-1]&1||C==(_.s<0?8:7)),d<1||!y[0])r=h?ei(u.charAt(1),-S,u.charAt(0)):u.charAt(0);else{if(y.length=d,h)for(--a;++y[--d]>a;)y[d]=0,d||(++f,y=[1].concat(y));for(p=y.length;!y[--p];);for(x=0,r=``;x<=p;r+=u.charAt(y[x++]));r=ei(r,f,u.charAt(0))}return r}})(),t=(function(){function e(e,t,n){var r,i,a,o,s=0,c=e.length,l=t%Jr,u=t/Jr|0;for(e=e.slice();c--;)a=e[c]%Jr,o=e[c]/Jr|0,r=u*a+o*l,i=l*a+r%Jr*Jr+s,s=(i/n|0)+(r/Jr|0)+u*o,e[c]=i%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=+(e[n]<t[n]),e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,i,a,o,s){var c,l,u,d,f,p,m,h,g,_,y,b,x,C,ee,w,te,T=r.s==i.s?1:-1,E=r.c,D=i.c;if(!E||!E[0]||!D||!D[0])return new v(!r.s||!i.s||(E?D&&E[0]==D[0]:!D)?NaN:E&&E[0]==0||!D?T*0:T/0);for(h=new v(T),g=h.c=[],l=r.e-i.e,T=a+l+1,s||(s=Gr,l=P(r.e/M)-P(i.e/M),T=T/M|0),u=0;D[u]==(E[u]||0);u++);if(D[u]>(E[u]||0)&&l--,T<0)g.push(1),d=!0;else{for(C=E.length,w=D.length,u=0,T+=2,f=Ur(s/(D[0]+1)),f>1&&(D=e(D,f,s),E=e(E,f,s),w=D.length,C=E.length),x=w,_=E.slice(0,w),y=_.length;y<w;_[y++]=0);te=D.slice(),te=[0].concat(te),ee=D[0],D[1]>=s/2&&ee++;do{if(f=0,c=t(D,_,w,y),c<0){if(b=_[0],w!=y&&(b=b*s+(_[1]||0)),f=Ur(b/ee),f>1)for(f>=s&&(f=s-1),p=e(D,f,s),m=p.length,y=_.length;t(p,_,m,y)==1;)f--,n(p,w<m?te:D,m,s),m=p.length,c=1;else f==0&&(c=f=1),p=D.slice(),m=p.length;if(m<y&&(p=[0].concat(p)),n(_,p,y,s),y=_.length,c==-1)for(;t(D,_,w,y)<1;)f++,n(_,w<y?te:D,y,s),y=_.length}else c===0&&(f++,_=[0]);g[u++]=f,_[0]?_[y++]=E[x]||0:(_=[E[x]],y=1)}while((x++<C||_[0]!=null)&&T--);d=_[0]!=null,g[0]||g.splice(0,1)}if(s==Gr){for(u=1,T=g[0];T>=10;T/=10,u++);S(h,a+(h.e=u+l*M-1)+1,o,d)}else h.e=l,h.r=+d;return h}})();function y(e,t,n,r){var i,a,o,u,d;if(n==null?n=s:F(n,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,t==null)d=Xr(e.c),d=r==1||r==2&&(o<=c||o>=l)?$r(d,o):ei(d,o,`0`);else if(e=S(new v(e),t,n),a=e.e,d=Xr(e.c),u=d.length,r==1||r==2&&(t<=a||a<=c)){for(;u<t;d+=`0`,u++);d=$r(d,a)}else if(t-=o+(r===2&&a>o),d=ei(d,a,`0`),a+1>u){if(--t>0)for(d+=`.`;t--;d+=`0`);}else if(t+=a-u,t>0)for(a+1==u&&(d+=`.`);t--;d+=`0`);return e.s<0&&i?`-`+d:d}function b(e,t){for(var n,r,i=1,a=new v(e[0]);i<e.length;i++)r=new v(e[i]),(!r.s||(n=Zr(a,r))===t||n===0&&a.s===t)&&(a=r);return a}function x(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*M-1)>d?e.c=e.e=null:n<u?e.c=[e.e=0]:(e.e=n,e.c=t),e}r=(function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,n=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(a,o,s,c){var l,u=s?o:o.replace(i,``);if(r.test(u))a.s=isNaN(u)?null:u<0?-1:1;else{if(!s&&(u=u.replace(e,function(e,t,n){return l=(n=n.toLowerCase())==`x`?16:n==`b`?2:8,!c||c==l?t:e}),c&&(l=c,u=u.replace(t,`$1`).replace(n,`0.$1`)),o!=u))return new v(u,l);if(v.DEBUG)throw Error(j+`Not a`+(c?` base `+c:``)+` number: `+o);a.s=null}a.c=a.e=null}})();function S(e,t,n,r){var i,a,o,s,c,l,f,p=e.c,m=qr;if(p){out:{for(i=1,s=p[0];s>=10;s/=10,i++);if(a=t-i,a<0)a+=M,o=t,c=p[l=0],f=Ur(c/m[i-o-1]%10);else if(l=Hr((a+1)/M),l>=p.length){if(r){for(;p.length<=l;p.push(0));c=f=0,i=1,a%=M,o=a-M+1}else break out}else{for(c=s=p[l],i=1;s>=10;s/=10,i++);a%=M,o=a-M+i,f=o<0?0:Ur(c/m[i-o-1]%10)}if(r=r||t<0||p[l+1]!=null||(o<0?c:c%m[i-o-1]),r=n<4?(f||r)&&(n==0||n==(e.s<0?3:2)):f>5||f==5&&(n==4||r||n==6&&(a>0?o>0?c/m[i-o]:0:p[l-1])%10&1||n==(e.s<0?8:7)),t<1||!p[0])return p.length=0,r?(t-=e.e+1,p[0]=m[(M-t%M)%M],e.e=-t||0):p[0]=e.e=0,e;if(a==0?(p.length=l,s=1,l--):(p.length=l+1,s=m[M-a],p[l]=o>0?Ur(c/m[i-o]%m[o])*s:0),r)for(;;)if(l==0){for(a=1,o=p[0];o>=10;o/=10,a++);for(o=p[0]+=s,s=1;o>=10;o/=10,s++);a!=s&&(e.e++,p[0]==Gr&&(p[0]=1));break}else{if(p[l]+=s,p[l]!=Gr)break;p[l--]=0,s=1}for(a=p.length;p[--a]===0;p.pop());}e.e>d?e.c=e.e=null:e.e<u&&(e.c=[e.e=0])}return e}function C(e){var t,n=e.e;return n===null?e.toString():(t=Xr(e.c),t=n<=c||n>=l?$r(t,n):ei(t,n,`0`),e.s<0?`-`+t:t)}return i.absoluteValue=i.abs=function(){var e=new v(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return Zr(this,new v(e,t))},i.decimalPlaces=i.dp=function(e,t){var n,r,i,a=this;if(e!=null)return F(e,0,N),t==null?t=s:F(t,0,8),S(new v(a),e+a.e+1,t);if(!(n=a.c))return null;if(r=((i=n.length-1)-P(this.e/M))*M,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},i.dividedBy=i.div=function(e,n){return t(this,new v(e,n),o,s)},i.dividedToIntegerBy=i.idiv=function(e,n){return t(this,new v(e,n),0,1)},i.exponentiatedBy=i.pow=function(e,t){var n,r,i,o,c,l,u,d,f,p=this;if(e=new v(e),e.c&&!e.isInteger())throw Error(j+`Exponent not an integer: `+C(e));if(t!=null&&(t=new v(t)),l=e.e>14,!p.c||!p.c[0]||p.c[0]==1&&!p.e&&p.c.length==1||!e.c||!e.c[0])return f=new v((+C(p))**(l?e.s*(2-Qr(e)):+C(e))),t?f.mod(t):f;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new v(NaN);r=!u&&p.isInteger()&&t.isInteger(),r&&(p=p.mod(t))}else if(e.e>9&&(p.e>0||p.e<-1||(p.e==0?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return o=p.s<0&&Qr(e)?-0:0,p.e>-1&&(o=1/o),new v(u?1/o:o);else m&&(o=Hr(m/M+2));for(l?(n=new v(.5),u&&(e.s=1),d=Qr(e)):(i=Math.abs(+C(e)),d=i%2),f=new v(a);;){if(d){if(f=f.times(p),!f.c)break;o?f.c.length>o&&(f.c.length=o):r&&(f=f.mod(t))}if(i){if(i=Ur(i/2),i===0)break;d=i%2}else if(e=e.times(n),S(e,e.e+1,1),e.e>14)d=Qr(e);else{if(i=+C(e),i===0)break;d=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):r&&(p=p.mod(t))}return r?f:(u&&(f=a.div(f)),t?f.mod(t):o?S(f,m,s,c):f)},i.integerValue=function(e){var t=new v(this);return e==null?e=s:F(e,0,8),S(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return Zr(this,new v(e,t))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return Zr(this,new v(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return(t=Zr(this,new v(e,t)))===1||t===0},i.isInteger=function(){return!!this.c&&P(this.e/M)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return Zr(this,new v(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return(t=Zr(this,new v(e,t)))===-1||t===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(e,t){var n,r,i,a,o=this,c=o.s;if(e=new v(e,t),t=e.s,!c||!t)return new v(NaN);if(c!=t)return e.s=-t,o.plus(e);var l=o.e/M,u=e.e/M,d=o.c,f=e.c;if(!l||!u){if(!d||!f)return d?(e.s=-t,e):new v(f?o:NaN);if(!d[0]||!f[0])return f[0]?(e.s=-t,e):new v(d[0]?o:s==3?-0:0)}if(l=P(l),u=P(u),d=d.slice(),c=l-u){for((a=c<0)?(c=-c,i=d):(u=l,i=f),i.reverse(),t=c;t--;i.push(0));i.reverse()}else for(r=(a=(c=d.length)<(t=f.length))?c:t,c=t=0;t<r;t++)if(d[t]!=f[t]){a=d[t]<f[t];break}if(a&&(i=d,d=f,f=i,e.s=-e.s),t=(r=f.length)-(n=d.length),t>0)for(;t--;d[n++]=0);for(t=Gr-1;r>c;){if(d[--r]<f[r]){for(n=r;n&&!d[--n];d[n]=t);--d[n],d[r]+=Gr}d[r]-=f[r]}for(;d[0]==0;d.splice(0,1),--u);return d[0]?x(e,d,u):(e.s=s==3?-1:1,e.c=[e.e=0],e)},i.modulo=i.mod=function(e,n){var r,i,a=this;return e=new v(e,n),!a.c||!e.s||e.c&&!e.c[0]?new v(NaN):!e.c||a.c&&!a.c[0]?new v(a):(p==9?(i=e.s,e.s=1,r=t(a,e,0,3),e.s=i,r.s*=i):r=t(a,e,0,p),e=a.minus(r.times(e)),!e.c[0]&&p==1&&(e.s=a.s),e)},i.multipliedBy=i.times=function(e,t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=this,y=_.c,b=(e=new v(e,t)).c;if(!y||!b||!y[0]||!b[0])return!_.s||!e.s||y&&!y[0]&&!b||b&&!b[0]&&!y?e.c=e.e=e.s=null:(e.s*=_.s,!y||!b?e.c=e.e=null:(e.c=[0],e.e=0)),e;for(r=P(_.e/M)+P(e.e/M),e.s*=_.s,c=y.length,d=b.length,c<d&&(m=y,y=b,b=m,i=c,c=d,d=i),i=c+d,m=[];i--;m.push(0));for(h=Gr,g=Jr,i=d;--i>=0;){for(n=0,f=b[i]%g,p=b[i]/g|0,o=c,a=i+o;a>i;)l=y[--o]%g,u=y[o]/g|0,s=p*l+u*f,l=f*l+s%g*g+m[a]+n,n=(l/h|0)+(s/g|0)+p*u,m[a--]=l%h;m[a]=n}return n?++r:m.splice(0,1),x(e,m,r)},i.negated=function(){var e=new v(this);return e.s=-e.s||null,e},i.plus=function(e,t){var n,r=this,i=r.s;if(e=new v(e,t),t=e.s,!i||!t)return new v(NaN);if(i!=t)return e.s=-t,r.minus(e);var a=r.e/M,o=e.e/M,s=r.c,c=e.c;if(!a||!o){if(!s||!c)return new v(i/0);if(!s[0]||!c[0])return c[0]?e:new v(s[0]?r:i*0)}if(a=P(a),o=P(o),s=s.slice(),i=a-o){for(i>0?(o=a,n=c):(i=-i,n=s),n.reverse();i--;n.push(0));n.reverse()}for(i=s.length,t=c.length,i-t<0&&(n=c,c=s,s=n,t=i),i=0;t;)i=(s[--t]=s[t]+c[t]+i)/Gr|0,s[t]=Gr===s[t]?0:s[t]%Gr;return i&&(s=[i].concat(s),++o),x(e,s,o)},i.precision=i.sd=function(e,t){var n,r,i,a=this;if(e!=null&&e!==!!e)return F(e,1,N),t==null?t=s:F(t,0,8),S(new v(a),e,t);if(!(n=a.c))return null;if(i=n.length-1,r=i*M+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&a.e+1>r&&(r=a.e+1),r},i.shiftedBy=function(e){return F(e,-Kr,Kr),this.times(`1e`+e)},i.squareRoot=i.sqrt=function(){var e,n,r,i,a,c=this,l=c.c,u=c.s,d=c.e,f=o+4,p=new v(`0.5`);if(u!==1||!l||!l[0])return new v(!u||u<0&&(!l||l[0])?NaN:l?c:1/0);if(u=Math.sqrt(+C(c)),u==0||u==1/0?(n=Xr(l),(n.length+d)%2==0&&(n+=`0`),u=Math.sqrt(+n),d=P((d+1)/2)-(d<0||d%2),u==1/0?n=`5e`+d:(n=u.toExponential(),n=n.slice(0,n.indexOf(`e`)+1)+d),r=new v(n)):r=new v(u+``),r.c[0]){for(d=r.e,u=d+f,u<3&&(u=0);;)if(a=r,r=p.times(a.plus(t(c,a,f,1))),Xr(a.c).slice(0,u)===(n=Xr(r.c)).slice(0,u)){if(r.e<d&&--u,n=n.slice(u-3,u+1),n==`9999`||!i&&n==`4999`){if(!i&&(S(a,a.e+o+2,0),a.times(a).eq(c))){r=a;break}f+=4,u+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)==`5`)&&(S(r,r.e+o+2,1),e=!r.times(r).eq(c));break}}}return S(r,r.e+o+1,s,e)},i.toExponential=function(e,t){return e!=null&&(F(e,0,N),e++),y(this,e,t,1)},i.toFixed=function(e,t){return e!=null&&(F(e,0,N),e=e+this.e+1),y(this,e,t)},i.toFormat=function(e,t,n){var r,i=this;if(n==null)e!=null&&t&&typeof t==`object`?(n=t,t=null):e&&typeof e==`object`?(n=e,e=t=null):n=h;else if(typeof n!=`object`)throw Error(j+`Argument not an object: `+n);if(r=i.toFixed(e,t),i.c){var a,o=r.split(`.`),s=+n.groupSize,c=+n.secondaryGroupSize,l=n.groupSeparator||``,u=o[0],d=o[1],f=i.s<0,p=f?u.slice(1):u,m=p.length;if(c&&(a=s,s=c,c=a,m-=a),s>0&&m>0){for(a=m%s||s,u=p.substr(0,a);a<m;a+=s)u+=l+p.substr(a,s);c>0&&(u+=l+p.slice(a)),f&&(u=`-`+u)}r=d?u+(n.decimalSeparator||``)+((c=+n.fractionGroupSize)?d.replace(RegExp(`\\d{`+c+`}\\B`,`g`),`$&`+(n.fractionGroupSeparator||``)):d):u}return(n.prefix||``)+r+(n.suffix||``)},i.toFraction=function(e){var n,r,i,o,c,l,u,f,p,m,h,g,_=this,y=_.c;if(e!=null&&(u=new v(e),!u.isInteger()&&(u.c||u.s!==1)||u.lt(a)))throw Error(j+`Argument `+(u.isInteger()?`out of range: `:`not an integer: `)+C(u));if(!y)return new v(_);for(n=new v(a),p=r=new v(a),i=f=new v(a),g=Xr(y),c=n.e=g.length-_.e-1,n.c[0]=qr[(l=c%M)<0?M+l:l],e=!e||u.comparedTo(n)>0?c>0?n:p:u,l=d,d=1/0,u=new v(g),f.c[0]=0;m=t(u,n,0,1),o=r.plus(m.times(i)),o.comparedTo(e)!=1;)r=i,i=o,p=f.plus(m.times(o=p)),f=o,n=u.minus(m.times(o=n)),u=o;return o=t(e.minus(r),i,0,1),f=f.plus(o.times(p)),r=r.plus(o.times(i)),f.s=p.s=_.s,c*=2,h=t(p,i,c,s).minus(_).abs().comparedTo(t(f,r,c,s).minus(_).abs())<1?[p,i]:[f,r],d=l,h},i.toNumber=function(){return+C(this)},i.toPrecision=function(e,t){return e!=null&&F(e,1,N),y(this,e,t,2)},i.toString=function(e){var t,r=this,i=r.s,a=r.e;return a===null?i?(t=`Infinity`,i<0&&(t=`-`+t)):t=`NaN`:(e==null?t=a<=c||a>=l?$r(Xr(r.c),a):ei(Xr(r.c),a,`0`):e===10&&_?(r=S(new v(r),o+a+1,s),t=ei(Xr(r.c),r.e,`0`)):(F(e,2,g.length,`Base`),t=n(ei(Xr(r.c),a,`0`),10,e,i,!0)),i<0&&r.c[0]&&(t=`-`+t)),t},i.valueOf=i.toJSON=function(){return C(this)},i._isBigNumber=!0,i[Symbol.toStringTag]=`BigNumber`,i[Symbol.for(`nodejs.util.inspect.custom`)]=i.valueOf,e!=null&&v.set(e),v}function P(e){var t=e|0;return e>0||e===t?t:t-1}function Xr(e){for(var t,n,r=1,i=e.length,a=e[0]+``;r<i;){for(t=e[r++]+``,n=M-t.length;n--;t=`0`+t);a+=t}for(i=a.length;a.charCodeAt(--i)===48;);return a.slice(0,i+1||1)}function Zr(e,t){var n,r,i=e.c,a=t.c,o=e.s,s=t.s,c=e.e,l=t.e;if(!o||!s)return null;if(n=i&&!i[0],r=a&&!a[0],n||r)return n?r?0:-s:o;if(o!=s)return o;if(n=o<0,r=c==l,!i||!a)return r?0:!i^n?1:-1;if(!r)return c>l^n?1:-1;for(s=(c=i.length)<(l=a.length)?c:l,o=0;o<s;o++)if(i[o]!=a[o])return i[o]>a[o]^n?1:-1;return c==l?0:c>l^n?1:-1}function F(e,t,n,r){if(e<t||e>n||e!==Ur(e))throw Error(j+(r||`Argument`)+(typeof e==`number`?e<t||e>n?` out of range: `:` not an integer: `:` not a primitive number: `)+String(e))}function Qr(e){var t=e.c.length-1;return P(e.e/M)==t&&e.c[t]%2!=0}function $r(e,t){return(e.length>1?e.charAt(0)+`.`+e.slice(1):e)+(t<0?`e`:`e+`)+t}function ei(e,t,n){var r,i;if(t<0){for(i=n+`.`;++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+`.`+e.slice(t));return e}var I=Yr(),ti=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},ni=`~memo`,ri=[];function ii(e){return typeof e==`object`&&!!e}function ai(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var oi=new WeakMap,si=0,ci=1,li=2;function ui(e,t,n){let r=oi.get(e);if(r!==void 0)return r?li:si;if(t.has(e))return li;t.add(e);let i=si,a=e=>{if(i!==li&&e?._zod){let r=ui(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=si;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?ci:o.value?._zod?ui(o.value,t,n):si;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=In(c);s(e?o(e,!0):ci),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?ui(r,t,!1):ci);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),di(e,i)}function di(e,t){return t!==ci&&oi.set(e,t===li),t}function fi(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var pi,mi=[],hi={alloc(e,t,n){let r=pi;if(!r)return n;pi=void 0;let i={value:n,issues:null};return r.set(t.value,i),mi.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&_i(n,e.value))throw new ti;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=ui(e,new Set,!1);if(i===si)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===li||r?n=!0:r=!0}let l=s.value;if(!ii(l))return t(s,c);let u=c[ni];u||(u={buckets:new WeakMap,backEdges:void 0},c[ni]=u);let d;i===c?d=a:(d=fi(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...ai(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;pi=d;let p=mi.length,m=t(s,c);pi=void 0;let h=mi.length>p?mi.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?ai(e.issues):ri),e)):(h&&(h.issues=m.issues.length?ai(m.issues):ri),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function gi(){return hi}function _i(e,t){let n=e[ni]?.backEdges;return n!==void 0&&ii(t)&&n.has(t)}var vi=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(an(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${_r(e.values[0])}`:`Invalid option: expected one of ${Sn(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${Sn(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function yi(){return{localeError:vi()}}var bi,xi=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Si(){return new xi}(bi=globalThis).__zod_globalRegistry??(bi.__zod_globalRegistry=Si());var Ci=globalThis.__zod_globalRegistry;function wi(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&zt(e,t,n[t]);return e}function Ti(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Ci,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Ei(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function L(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,L(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&wi(o.schema,c),t.io===`input`&&R(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Di(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Oi(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Di(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Di(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/polkadot-ledger-transaction-Dp6EFfyV.js","assets/Result-DQM8aaFz.js","assets/registry-BgQw-qJW.js","assets/rolldown-runtime-BcKkbAw3.js","assets/dist-D6L6gF64.js","assets/sha3-DRlIjSdj.js","assets/_u64-BLNH_r32.js","assets/esm-CjTnkPtf.js","assets/bn-Ck4DeaX2.js","assets/secp256k1-BcfUQvi6.js","assets/hmac-DY3QYcUU.js","assets/_shortw_utils-60uxgahw.js","assets/blake2b-BMPujwy0.js","assets/blake2-CL6aokTA.js"])))=>i.map(i=>d[i]);
2
+ import{s as e,t}from"./rolldown-runtime-BcKkbAw3.js";import{c as n,d as r,i,r as a,t as o}from"./Result-DQM8aaFz.js";import{vi as s}from"./Cause-1VWVIQY3.js";import{A as c,B as l,C as u,K as d,M as f,cn as p,k as m,p as h,q as g,r as _,rt as v,vt as y}from"./assets-DXO6qW6R.js";import{F as b,n as x,s as S,t as C}from"./wagmi-connect-result-ChkXAqK2.js";import{$ as ee,G as w,It as te,K as T,Wt as E,j as D,l as ne,nt as re,w as ie}from"./Effect-Cu_VlOsF.js";import{t as ae}from"./preload-helper-BLdHbfdN.js";import{S as oe,b as se,l as ce,n as le,o as ue,s as de,t as fe,w as pe,y as me}from"./transaction-C_iyacpP.js";import{a as he,o as ge}from"./network-BVzpe0Ii.js";import{er as _e}from"./call-ttPZjh8C.js";import{r as O,t as k}from"./dist-ZKTSEBXW.js";import{t as ve}from"./current-value-stream-B0d3-tpK.js";import{t as ye}from"./events-CMzhc0tf.js";import{t as be}from"./lib-es-DmH9FYVZ.js";import{a as xe,i as Se,n as Ce}from"./transaction-BWEzzOww.js";import{n as we}from"./transaction-B5hUD0AE.js";import{$ as Te,$n as Ee,$t as De,A as Oe,An as ke,At as Ae,B as je,Bn as Me,Bt as Ne,C as Pe,Cn as Fe,D as Ie,Dn as Le,Dt as Re,E as ze,En as Be,Et as Ve,F as He,Ft as Ue,G as We,Gn as Ge,Gt as Ke,H as qe,Ht as Je,I as Ye,It as Xe,J as Ze,Jn as Qe,Jt as $e,K as et,Kn as tt,Kt as nt,L as rt,Ln as it,Lt as at,M as ot,Mn as st,Mt as ct,N as lt,Nt as ut,O as dt,On as ft,Ot as pt,P as mt,Pt as ht,Q as gt,Qn as _t,Qt as vt,R as yt,Rn as bt,Rt as xt,S as St,Sn as Ct,St as wt,T as Tt,Tn as Et,Tt as Dt,U as Ot,Un as kt,Ut as At,V as jt,Vn as Mt,Vt as Nt,Wn as A,Wt as Pt,X as Ft,Xn as It,Xt as Lt,Y as Rt,Yn as zt,Z as Bt,Zn as Vt,Zt as Ht,_ as Ut,_n as Wt,_r as Gt,_t as Kt,an as qt,ar as Jt,at as Yt,b as Xt,bn as Zt,bt as Qt,c as $t,cn as en,cr as tn,ct as nn,dn as rn,dr as an,dt as on,en as sn,er as cn,et as ln,fn as un,fr as dn,ft as fn,g as pn,gn as mn,gr as hn,gt as gn,h as _n,hn as vn,hr as yn,i as bn,in as xn,ir as Sn,it as Cn,j as wn,jn as Tn,jt as En,k as Dn,kn as On,kt as kn,l as An,ln as jn,lr as Mn,lt as Nn,m as Pn,mn as Fn,mr as In,mt as Ln,n as Rn,nn as zn,nr as Bn,nt as Vn,o as Hn,on as Un,or as Wn,ot as Gn,p as Kn,pn as qn,pr as Jn,pt as Yn,q as Xn,qn as Zn,qt as Qn,r as $n,rn as er,rr as tr,rt as nr,s as rr,sn as ir,sr as ar,st as or,t as sr,tn as cr,tr as lr,tt as ur,u as dr,un as fr,ur as pr,ut as mr,v as hr,vn as gr,vr as _r,vt as vr,w as yr,wn as br,wt as xr,x as Sr,xn as Cr,xt as wr,y as Tr,yn as Er,yt as Dr,zn as Or,zt as kr}from"./api-DpIjV5BK.js";import{t as Ar}from"./wagmi-connector-events-uWDzb_Wq.js";O();var jr=e(ye()),Mr;(function(e){e.Unknown=`Unknown`,e.LocationServicesDisabled=`LocationServicesDisabled`,e.LocationServicesUnauthorized=`LocationServicesUnauthorized`,e.BluetoothScanStartFailed=`BluetoothScanStartFailed`})(Mr||={});var Nr=class extends Error{id;constructor(e,t){let n=`TransportError`;super(e||n),this.name=n,this.message=e,this.stack=Error(e).stack,this.id=t}},Pr={ACCESS_CONDITION_NOT_FULFILLED:38916,ALGORITHM_NOT_SUPPORTED:38020,CLA_NOT_SUPPORTED:28160,CLA_NOT_SUPPORTED_BOOTLOADER:28161,CODE_BLOCKED:38976,CODE_NOT_INITIALIZED:38914,COMMAND_INCOMPATIBLE_FILE_STRUCTURE:27009,CONDITIONS_OF_USE_NOT_SATISFIED:27013,CONTRADICTION_INVALIDATION:38928,CONTRADICTION_SECRET_CODE_STATUS:38920,DEVICE_IN_RECOVERY_MODE:26159,CUSTOM_IMAGE_EMPTY:26158,FILE_ALREADY_EXISTS:27273,FILE_NOT_FOUND:37892,GP_AUTH_FAILED:25344,HALTED:28586,INCONSISTENT_FILE:37896,INCORRECT_DATA:27264,INCORRECT_LENGTH:26368,INCORRECT_P1_P2:27392,INS_NOT_SUPPORTED:27904,DEVICE_NOT_ONBOARDED:27911,DEVICE_NOT_ONBOARDED_2:26129,INVALID_KCV:38021,INVALID_OFFSET:37890,LICENSING:28482,LOCKED_DEVICE:21781,MAX_VALUE_REACHED:38992,MEMORY_PROBLEM:37440,MISSING_CRITICAL_PARAMETER:26624,NO_EF_SELECTED:37888,NOT_ENOUGH_MEMORY_SPACE:27268,OK:36864,PIN_REMAINING_ATTEMPTS:25536,REFERENCED_DATA_NOT_FOUND:27272,SECURITY_STATUS_NOT_SATISFIED:27010,TECHNICAL_PROBLEM:28416,UNKNOWN_APDU:27906,USER_REFUSED_ON_DEVICE:21761,NOT_ENOUGH_SPACE:20738,APP_NOT_FOUND_OR_INVALID_CONTEXT:20771,INVALID_APP_NAME_LENGTH:26378,GEN_AES_KEY_FAILED:21529,INTERNAL_CRYPTO_OPERATION_FAILED:21530,INTERNAL_COMPUTE_AES_CMAC_FAILED:21531,ENCRYPT_APP_STORAGE_FAILED:21532,INVALID_BACKUP_STATE:26178,PIN_NOT_SET:21762,INVALID_BACKUP_LENGTH:26419,INVALID_RESTORE_STATE:26179,INVALID_CHUNK_LENGTH:26420,INVALID_BACKUP_HEADER:26698,SW_BAD_STATE:45063};function Fr(e){switch(e){case 26368:return`Incorrect length`;case 26624:return`Missing critical parameter`;case 27010:return`Security not satisfied (dongle locked or have invalid access rights)`;case 27013:return`Condition of use not satisfied (denied by the user?)`;case 27264:return`Invalid data received`;case 27392:return`Invalid parameter received`;case 21781:return`Locked device`;case 45063:return`Unexpected state on the device`}if(28416<=e&&e<=28671)return`Internal error, please report`}var Ir=class e extends Error{statusCode;statusText;constructor(t,{canBeMappedToChildError:n=!0}={}){let r=Object.entries(Pr).find(([,e])=>e===t)?.[0]||`UNKNOWN_ERROR`,i=`Ledger device: ${Fr(t)||r} (0x${t.toString(16)})`;if(super(i||`TransportStatusError`),this.name=`TransportStatusError`,this.statusCode=t,this.statusText=r,Object.setPrototypeOf(this,e.prototype),n&&t===Pr.LOCKED_DEVICE)return new Lr(i)}},Lr=class e extends Ir{constructor(t){super(Pr.LOCKED_DEVICE,{canBeMappedToChildError:!1}),t&&(this.message=t),this.name=`LockedDeviceError`,Object.setPrototypeOf(this,e.prototype)}},Rr=class extends Error{name=`TransportRaceCondition`;constructor(e){super(e||`TransportRaceCondition`)}},zr=`transport`,Br=class{exchangeTimeout=3e4;unresponsiveTimeout=15e3;deviceModel=null;tracer;constructor({context:e,logType:t}={}){this.tracer=new be(t??zr,e)}static isSupported;static list;static listen;static open;exchange(e,{abortTimeoutMs:t}={}){throw Error(`exchange not implemented`)}exchangeBulk(e,t){let n=!1;return(async()=>{if(!n)for(let r of e){let e=await this.exchange(r);if(n)return;let i=e.readUInt16BE(e.length-2);if(i!==Pr.OK)throw new Ir(i);t.next(e)}})().then(()=>!n&&t.complete(),e=>!n&&t.error(e)),{unsubscribe:()=>{n=!0}}}setScrambleKey(e){}close(){return Promise.resolve()}_events=new jr.default;on(e,t){this._events.on(e,t)}off(e,t){this._events.removeListener(e,t)}emit(e,...t){this._events.emit(e,...t)}setDebugMode(){console.warn(`setDebugMode is deprecated. use @ledgerhq/logs instead. No logs are emitted in this anymore.`)}setExchangeTimeout(e){this.exchangeTimeout=e}setExchangeUnresponsiveTimeout(e){this.unresponsiveTimeout=e}send=async(e,t,n,r,i=k.alloc(0),a=[Pr.OK],{abortTimeoutMs:o}={})=>{let s=this.tracer.withUpdatedContext({function:`send`});if(i.length>=256)throw s.trace(`data.length exceeded 256 bytes limit`,{dataLength:i.length}),new Nr(`data.length exceed 256 bytes limit. Got: `+i.length,`DataLengthTooBig`);let c=await this.exchange(k.concat([k.from([e,t,n,r]),k.from([i.length]),i]),{abortTimeoutMs:o}),l=c.readUInt16BE(c.length-2);if(!a.some(e=>e===l))throw new Ir(l);return c};static create(e=3e3,t){return new Promise((n,r)=>{let i=!1,a=this.listen({next:t=>{i=!0,a&&a.unsubscribe(),o&&clearTimeout(o),this.open(t.descriptor,e).then(n,r)},error:e=>{o&&clearTimeout(o),r(e)},complete:()=>{o&&clearTimeout(o),i||r(new Nr(this.ErrorMessage_NoDeviceFound,`NoDeviceFound`))}}),o=t?setTimeout(()=>{a.unsubscribe(),r(new Nr(this.ErrorMessage_ListenTimeout,`ListenTimeout`))},t):null})}exchangeBusyPromise;async exchangeAtomicImpl(e){let t=this.tracer.withUpdatedContext({function:`exchangeAtomicImpl`,unresponsiveTimeout:this.unresponsiveTimeout});if(this.exchangeBusyPromise)throw t.trace(`Atomic exchange is already busy`),new Rr(`An action was already pending on the Ledger device. Please deny or reconnect.`);let n,r=new Promise(e=>{n=e});this.exchangeBusyPromise=r;let i=!1,a=setTimeout(()=>{t.trace(`Timeout reached, emitting Transport event "unresponsive"`,{unresponsiveTimeout:this.unresponsiveTimeout}),i=!0,this.emit(`unresponsive`)},this.unresponsiveTimeout);try{let n=await e();return i&&(t.trace(`Device was unresponsive, emitting responsive`),this.emit(`responsive`)),n}finally{t.trace(`Finalize, clearing busy guard`),clearTimeout(a),n&&n(),this.exchangeBusyPromise=null}}decorateAppAPIMethods(e,t,n){for(let r of t)e[r]=this.decorateAppAPIMethod(r,e[r],e,n)}_appAPIlock=null;decorateAppAPIMethod(e,t,n,r){return async(...i)=>{let{_appAPIlock:a}=this;if(a)return Promise.reject(new Nr(`Ledger Device is busy (lock `+a+`)`,`TransportLocked`));try{return this._appAPIlock=e,this.setScrambleKey(r),await t.apply(n,i)}finally{this._appAPIlock=null}}}setTraceContext(e){this.tracer=this.tracer.withContext(e)}updateTraceContext(e){this.tracer.updateContext(e)}getTraceContext(){return this.tracer.getContext()}static ErrorMessage_ListenTimeout=`No Ledger device found (timeout)`;static ErrorMessage_NoDeviceFound=`No Ledger device found`},Vr=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Hr=Math.ceil,Ur=Math.floor,j=`[BigNumber Error] `,Wr=j+`Number primitive has more than 15 significant digits: `,Gr=0x5af3107a4000,M=14,Kr=9007199254740991,qr=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,0xe8d4a51000,0x9184e72a000],Jr=1e7,N=1e9;function Yr(e){var t,n,r,i=v.prototype={constructor:v,toString:null,valueOf:null},a=new v(1),o=20,s=4,c=-7,l=21,u=-1e7,d=1e7,f=!1,p=1,m=0,h={prefix:``,groupSize:3,secondaryGroupSize:0,groupSeparator:`,`,decimalSeparator:`.`,fractionGroupSize:0,fractionGroupSeparator:`\xA0`,suffix:``},g=`0123456789abcdefghijklmnopqrstuvwxyz`,_=!0;function v(e,t){var i,a,c,l,f,p,m,h,y=this;if(!(y instanceof v))return new v(e,t);if(t==null){if(e&&e._isBigNumber===!0){y.s=e.s,!e.c||e.e>d?y.c=y.e=null:e.e<u?y.c=[y.e=0]:(y.e=e.e,y.c=e.c.slice());return}if((p=typeof e==`number`)&&e*0==0){if(y.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,f=e;f>=10;f/=10,l++);l>d?y.c=y.e=null:(y.e=l,y.c=[e]);return}h=String(e)}else{if(!Vr.test(h=String(e)))return r(y,h,p);y.s=h.charCodeAt(0)==45?(h=h.slice(1),-1):1}(l=h.indexOf(`.`))>-1&&(h=h.replace(`.`,``)),(f=h.search(/e/i))>0?(l<0&&(l=f),l+=+h.slice(f+1),h=h.substring(0,f)):l<0&&(l=h.length)}else{if(F(t,2,g.length,`Base`),t==10&&_)return y=new v(e),S(y,o+y.e+1,s);if(h=String(e),p=typeof e==`number`){if(e*0!=0)return r(y,h,p,t);if(y.s=1/e<0?(h=h.slice(1),-1):1,v.DEBUG&&h.replace(/^0\.0*|\./,``).length>15)throw Error(Wr+e)}else y.s=h.charCodeAt(0)===45?(h=h.slice(1),-1):1;for(i=g.slice(0,t),l=f=0,m=h.length;f<m;f++)if(i.indexOf(a=h.charAt(f))<0){if(a==`.`){if(f>l){l=m;continue}}else if(!c&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){c=!0,f=-1,l=0;continue}return r(y,String(e),p,t)}p=!1,h=n(h,t,10,y.s),(l=h.indexOf(`.`))>-1?h=h.replace(`.`,``):l=h.length}for(f=0;h.charCodeAt(f)===48;f++);for(m=h.length;h.charCodeAt(--m)===48;);if(h=h.slice(f,++m)){if(m-=f,p&&v.DEBUG&&m>15&&(e>Kr||e!==Ur(e)))throw Error(Wr+y.s*e);if((l=l-f-1)>d)y.c=y.e=null;else if(l<u)y.c=[y.e=0];else{if(y.e=l,y.c=[],f=(l+1)%M,l<0&&(f+=M),f<m){for(f&&y.c.push(+h.slice(0,f)),m-=M;f<m;)y.c.push(+h.slice(f,f+=M));f=M-(h=h.slice(f)).length}else f-=m;for(;f--;h+=`0`);y.c.push(+h)}}else y.c=[y.e=0]}v.clone=Yr,v.ROUND_UP=0,v.ROUND_DOWN=1,v.ROUND_CEIL=2,v.ROUND_FLOOR=3,v.ROUND_HALF_UP=4,v.ROUND_HALF_DOWN=5,v.ROUND_HALF_EVEN=6,v.ROUND_HALF_CEIL=7,v.ROUND_HALF_FLOOR=8,v.EUCLID=9,v.config=v.set=function(e){var t,n;if(e!=null){if(typeof e==`object`){if(e.hasOwnProperty(t=`DECIMAL_PLACES`)&&(n=e[t],F(n,0,N,t),o=n),e.hasOwnProperty(t=`ROUNDING_MODE`)&&(n=e[t],F(n,0,8,t),s=n),e.hasOwnProperty(t=`EXPONENTIAL_AT`)&&(n=e[t],n&&n.pop?(F(n[0],-N,0,t),F(n[1],0,N,t),c=n[0],l=n[1]):(F(n,-N,N,t),c=-(l=n<0?-n:n))),e.hasOwnProperty(t=`RANGE`)){if(n=e[t],n&&n.pop)F(n[0],-N,-1,t),F(n[1],1,N,t),u=n[0],d=n[1];else if(F(n,-N,N,t),n)u=-(d=n<0?-n:n);else throw Error(j+t+` cannot be zero: `+n)}if(e.hasOwnProperty(t=`CRYPTO`)){if(n=e[t],n===!!n){if(n){if(typeof crypto<`u`&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=n;else throw f=!n,Error(j+`crypto unavailable`)}else f=n}else throw Error(j+t+` not true or false: `+n)}if(e.hasOwnProperty(t=`MODULO_MODE`)&&(n=e[t],F(n,0,9,t),p=n),e.hasOwnProperty(t=`POW_PRECISION`)&&(n=e[t],F(n,0,N,t),m=n),e.hasOwnProperty(t=`FORMAT`)){if(n=e[t],typeof n==`object`)h=n;else throw Error(j+t+` not an object: `+n)}if(e.hasOwnProperty(t=`ALPHABET`)){if(n=e[t],typeof n==`string`&&!/^.?$|[+\-.\s]|(.).*\1/.test(n))_=n.slice(0,10)==`0123456789`,g=n;else throw Error(j+t+` invalid: `+n)}}else throw Error(j+`Object expected: `+e)}return{DECIMAL_PLACES:o,ROUNDING_MODE:s,EXPONENTIAL_AT:[c,l],RANGE:[u,d],CRYPTO:f,MODULO_MODE:p,POW_PRECISION:m,FORMAT:h,ALPHABET:g}},v.isBigNumber=function(e){if(!e||e._isBigNumber!==!0)return!1;if(!v.DEBUG)return!0;var t,n,r=e.c,i=e.e,a=e.s;out:if({}.toString.call(r)==`[object Array]`){if((a===1||a===-1)&&i>=-N&&i<=N&&i===Ur(i)){if(r[0]===0){if(i===0&&r.length===1)return!0;break out}if(t=(i+1)%M,t<1&&(t+=M),String(r[0]).length==t){for(t=0;t<r.length;t++)if(n=r[t],n<0||n>=Gr||n!==Ur(n))break out;if(n!==0)return!0}}}else if(r===null&&i===null&&(a===null||a===1||a===-1))return!0;throw Error(j+`Invalid BigNumber: `+e)},v.maximum=v.max=function(){return b(arguments,-1)},v.minimum=v.min=function(){return b(arguments,1)},v.random=(function(){var e=9007199254740992,t=Math.random()*e&2097151?function(){return Ur(Math.random()*e)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(e){var n,r,i,s,c,l=0,u=[],d=new v(a);if(e==null?e=o:F(e,0,N),s=Hr(e/M),f){if(crypto.getRandomValues){for(n=crypto.getRandomValues(new Uint32Array(s*=2));l<s;)c=n[l]*131072+(n[l+1]>>>11),c>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),n[l]=r[0],n[l+1]=r[1]):(u.push(c%0x5af3107a4000),l+=2);l=s/2}else if(crypto.randomBytes){for(n=crypto.randomBytes(s*=7);l<s;)c=(n[l]&31)*281474976710656+n[l+1]*1099511627776+n[l+2]*4294967296+n[l+3]*16777216+(n[l+4]<<16)+(n[l+5]<<8)+n[l+6],c>=9e15?crypto.randomBytes(7).copy(n,l):(u.push(c%0x5af3107a4000),l+=7);l=s/7}else throw f=!1,Error(j+`crypto unavailable`)}if(!f)for(;l<s;)c=t(),c<9e15&&(u[l++]=c%0x5af3107a4000);for(s=u[--l],e%=M,s&&e&&(c=qr[M-e],u[l]=Ur(s/c)*c);u[l]===0;u.pop(),l--);if(l<0)u=[i=0];else{for(i=-1;u[0]===0;u.splice(0,1),i-=M);for(l=1,c=u[0];c>=10;c/=10,l++);l<M&&(i-=M-l)}return d.e=i,d.c=u,d}})(),v.sum=function(){for(var e=1,t=arguments,n=new v(t[0]);e<t.length;)n=n.plus(t[e++]);return n},n=(function(){var e=`0123456789`;function n(e,t,n,r){for(var i,a=[0],o,s=0,c=e.length;s<c;){for(o=a.length;o--;a[o]*=t);for(a[0]+=r.indexOf(e.charAt(s++)),i=0;i<a.length;i++)a[i]>n-1&&(a[i+1]??(a[i+1]=0),a[i+1]+=a[i]/n|0,a[i]%=n)}return a.reverse()}return function(r,i,a,c,l){var u,d,f,p,h,_,y,b,x=r.indexOf(`.`),S=o,C=s;for(x>=0&&(p=m,m=0,r=r.replace(`.`,``),b=new v(i),_=b.pow(r.length-x),m=p,b.c=n(ei(Xr(_.c),_.e,`0`),10,a,e),b.e=b.c.length),y=n(r,i,a,l?(u=g,e):(u=e,g)),f=p=y.length;y[--p]==0;y.pop());if(!y[0])return u.charAt(0);if(x<0?--f:(_.c=y,_.e=f,_.s=c,_=t(_,b,S,C,a),y=_.c,h=_.r,f=_.e),d=f+S+1,x=y[d],p=a/2,h=h||d<0||y[d+1]!=null,h=C<4?(x!=null||h)&&(C==0||C==(_.s<0?3:2)):x>p||x==p&&(C==4||h||C==6&&y[d-1]&1||C==(_.s<0?8:7)),d<1||!y[0])r=h?ei(u.charAt(1),-S,u.charAt(0)):u.charAt(0);else{if(y.length=d,h)for(--a;++y[--d]>a;)y[d]=0,d||(++f,y=[1].concat(y));for(p=y.length;!y[--p];);for(x=0,r=``;x<=p;r+=u.charAt(y[x++]));r=ei(r,f,u.charAt(0))}return r}})(),t=(function(){function e(e,t,n){var r,i,a,o,s=0,c=e.length,l=t%Jr,u=t/Jr|0;for(e=e.slice();c--;)a=e[c]%Jr,o=e[c]/Jr|0,r=u*a+o*l,i=l*a+r%Jr*Jr+s,s=(i/n|0)+(r/Jr|0)+u*o,e[c]=i%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=+(e[n]<t[n]),e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,i,a,o,s){var c,l,u,d,f,p,m,h,g,_,y,b,x,C,ee,w,te,T=r.s==i.s?1:-1,E=r.c,D=i.c;if(!E||!E[0]||!D||!D[0])return new v(!r.s||!i.s||(E?D&&E[0]==D[0]:!D)?NaN:E&&E[0]==0||!D?T*0:T/0);for(h=new v(T),g=h.c=[],l=r.e-i.e,T=a+l+1,s||(s=Gr,l=P(r.e/M)-P(i.e/M),T=T/M|0),u=0;D[u]==(E[u]||0);u++);if(D[u]>(E[u]||0)&&l--,T<0)g.push(1),d=!0;else{for(C=E.length,w=D.length,u=0,T+=2,f=Ur(s/(D[0]+1)),f>1&&(D=e(D,f,s),E=e(E,f,s),w=D.length,C=E.length),x=w,_=E.slice(0,w),y=_.length;y<w;_[y++]=0);te=D.slice(),te=[0].concat(te),ee=D[0],D[1]>=s/2&&ee++;do{if(f=0,c=t(D,_,w,y),c<0){if(b=_[0],w!=y&&(b=b*s+(_[1]||0)),f=Ur(b/ee),f>1)for(f>=s&&(f=s-1),p=e(D,f,s),m=p.length,y=_.length;t(p,_,m,y)==1;)f--,n(p,w<m?te:D,m,s),m=p.length,c=1;else f==0&&(c=f=1),p=D.slice(),m=p.length;if(m<y&&(p=[0].concat(p)),n(_,p,y,s),y=_.length,c==-1)for(;t(D,_,w,y)<1;)f++,n(_,w<y?te:D,y,s),y=_.length}else c===0&&(f++,_=[0]);g[u++]=f,_[0]?_[y++]=E[x]||0:(_=[E[x]],y=1)}while((x++<C||_[0]!=null)&&T--);d=_[0]!=null,g[0]||g.splice(0,1)}if(s==Gr){for(u=1,T=g[0];T>=10;T/=10,u++);S(h,a+(h.e=u+l*M-1)+1,o,d)}else h.e=l,h.r=+d;return h}})();function y(e,t,n,r){var i,a,o,u,d;if(n==null?n=s:F(n,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,t==null)d=Xr(e.c),d=r==1||r==2&&(o<=c||o>=l)?$r(d,o):ei(d,o,`0`);else if(e=S(new v(e),t,n),a=e.e,d=Xr(e.c),u=d.length,r==1||r==2&&(t<=a||a<=c)){for(;u<t;d+=`0`,u++);d=$r(d,a)}else if(t-=o+(r===2&&a>o),d=ei(d,a,`0`),a+1>u){if(--t>0)for(d+=`.`;t--;d+=`0`);}else if(t+=a-u,t>0)for(a+1==u&&(d+=`.`);t--;d+=`0`);return e.s<0&&i?`-`+d:d}function b(e,t){for(var n,r,i=1,a=new v(e[0]);i<e.length;i++)r=new v(e[i]),(!r.s||(n=Zr(a,r))===t||n===0&&a.s===t)&&(a=r);return a}function x(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*M-1)>d?e.c=e.e=null:n<u?e.c=[e.e=0]:(e.e=n,e.c=t),e}r=(function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,n=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(a,o,s,c){var l,u=s?o:o.replace(i,``);if(r.test(u))a.s=isNaN(u)?null:u<0?-1:1;else{if(!s&&(u=u.replace(e,function(e,t,n){return l=(n=n.toLowerCase())==`x`?16:n==`b`?2:8,!c||c==l?t:e}),c&&(l=c,u=u.replace(t,`$1`).replace(n,`0.$1`)),o!=u))return new v(u,l);if(v.DEBUG)throw Error(j+`Not a`+(c?` base `+c:``)+` number: `+o);a.s=null}a.c=a.e=null}})();function S(e,t,n,r){var i,a,o,s,c,l,f,p=e.c,m=qr;if(p){out:{for(i=1,s=p[0];s>=10;s/=10,i++);if(a=t-i,a<0)a+=M,o=t,c=p[l=0],f=Ur(c/m[i-o-1]%10);else if(l=Hr((a+1)/M),l>=p.length){if(r){for(;p.length<=l;p.push(0));c=f=0,i=1,a%=M,o=a-M+1}else break out}else{for(c=s=p[l],i=1;s>=10;s/=10,i++);a%=M,o=a-M+i,f=o<0?0:Ur(c/m[i-o-1]%10)}if(r=r||t<0||p[l+1]!=null||(o<0?c:c%m[i-o-1]),r=n<4?(f||r)&&(n==0||n==(e.s<0?3:2)):f>5||f==5&&(n==4||r||n==6&&(a>0?o>0?c/m[i-o]:0:p[l-1])%10&1||n==(e.s<0?8:7)),t<1||!p[0])return p.length=0,r?(t-=e.e+1,p[0]=m[(M-t%M)%M],e.e=-t||0):p[0]=e.e=0,e;if(a==0?(p.length=l,s=1,l--):(p.length=l+1,s=m[M-a],p[l]=o>0?Ur(c/m[i-o]%m[o])*s:0),r)for(;;)if(l==0){for(a=1,o=p[0];o>=10;o/=10,a++);for(o=p[0]+=s,s=1;o>=10;o/=10,s++);a!=s&&(e.e++,p[0]==Gr&&(p[0]=1));break}else{if(p[l]+=s,p[l]!=Gr)break;p[l--]=0,s=1}for(a=p.length;p[--a]===0;p.pop());}e.e>d?e.c=e.e=null:e.e<u&&(e.c=[e.e=0])}return e}function C(e){var t,n=e.e;return n===null?e.toString():(t=Xr(e.c),t=n<=c||n>=l?$r(t,n):ei(t,n,`0`),e.s<0?`-`+t:t)}return i.absoluteValue=i.abs=function(){var e=new v(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return Zr(this,new v(e,t))},i.decimalPlaces=i.dp=function(e,t){var n,r,i,a=this;if(e!=null)return F(e,0,N),t==null?t=s:F(t,0,8),S(new v(a),e+a.e+1,t);if(!(n=a.c))return null;if(r=((i=n.length-1)-P(this.e/M))*M,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},i.dividedBy=i.div=function(e,n){return t(this,new v(e,n),o,s)},i.dividedToIntegerBy=i.idiv=function(e,n){return t(this,new v(e,n),0,1)},i.exponentiatedBy=i.pow=function(e,t){var n,r,i,o,c,l,u,d,f,p=this;if(e=new v(e),e.c&&!e.isInteger())throw Error(j+`Exponent not an integer: `+C(e));if(t!=null&&(t=new v(t)),l=e.e>14,!p.c||!p.c[0]||p.c[0]==1&&!p.e&&p.c.length==1||!e.c||!e.c[0])return f=new v((+C(p))**(l?e.s*(2-Qr(e)):+C(e))),t?f.mod(t):f;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new v(NaN);r=!u&&p.isInteger()&&t.isInteger(),r&&(p=p.mod(t))}else if(e.e>9&&(p.e>0||p.e<-1||(p.e==0?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return o=p.s<0&&Qr(e)?-0:0,p.e>-1&&(o=1/o),new v(u?1/o:o);else m&&(o=Hr(m/M+2));for(l?(n=new v(.5),u&&(e.s=1),d=Qr(e)):(i=Math.abs(+C(e)),d=i%2),f=new v(a);;){if(d){if(f=f.times(p),!f.c)break;o?f.c.length>o&&(f.c.length=o):r&&(f=f.mod(t))}if(i){if(i=Ur(i/2),i===0)break;d=i%2}else if(e=e.times(n),S(e,e.e+1,1),e.e>14)d=Qr(e);else{if(i=+C(e),i===0)break;d=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):r&&(p=p.mod(t))}return r?f:(u&&(f=a.div(f)),t?f.mod(t):o?S(f,m,s,c):f)},i.integerValue=function(e){var t=new v(this);return e==null?e=s:F(e,0,8),S(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return Zr(this,new v(e,t))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return Zr(this,new v(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return(t=Zr(this,new v(e,t)))===1||t===0},i.isInteger=function(){return!!this.c&&P(this.e/M)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return Zr(this,new v(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return(t=Zr(this,new v(e,t)))===-1||t===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(e,t){var n,r,i,a,o=this,c=o.s;if(e=new v(e,t),t=e.s,!c||!t)return new v(NaN);if(c!=t)return e.s=-t,o.plus(e);var l=o.e/M,u=e.e/M,d=o.c,f=e.c;if(!l||!u){if(!d||!f)return d?(e.s=-t,e):new v(f?o:NaN);if(!d[0]||!f[0])return f[0]?(e.s=-t,e):new v(d[0]?o:s==3?-0:0)}if(l=P(l),u=P(u),d=d.slice(),c=l-u){for((a=c<0)?(c=-c,i=d):(u=l,i=f),i.reverse(),t=c;t--;i.push(0));i.reverse()}else for(r=(a=(c=d.length)<(t=f.length))?c:t,c=t=0;t<r;t++)if(d[t]!=f[t]){a=d[t]<f[t];break}if(a&&(i=d,d=f,f=i,e.s=-e.s),t=(r=f.length)-(n=d.length),t>0)for(;t--;d[n++]=0);for(t=Gr-1;r>c;){if(d[--r]<f[r]){for(n=r;n&&!d[--n];d[n]=t);--d[n],d[r]+=Gr}d[r]-=f[r]}for(;d[0]==0;d.splice(0,1),--u);return d[0]?x(e,d,u):(e.s=s==3?-1:1,e.c=[e.e=0],e)},i.modulo=i.mod=function(e,n){var r,i,a=this;return e=new v(e,n),!a.c||!e.s||e.c&&!e.c[0]?new v(NaN):!e.c||a.c&&!a.c[0]?new v(a):(p==9?(i=e.s,e.s=1,r=t(a,e,0,3),e.s=i,r.s*=i):r=t(a,e,0,p),e=a.minus(r.times(e)),!e.c[0]&&p==1&&(e.s=a.s),e)},i.multipliedBy=i.times=function(e,t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=this,y=_.c,b=(e=new v(e,t)).c;if(!y||!b||!y[0]||!b[0])return!_.s||!e.s||y&&!y[0]&&!b||b&&!b[0]&&!y?e.c=e.e=e.s=null:(e.s*=_.s,!y||!b?e.c=e.e=null:(e.c=[0],e.e=0)),e;for(r=P(_.e/M)+P(e.e/M),e.s*=_.s,c=y.length,d=b.length,c<d&&(m=y,y=b,b=m,i=c,c=d,d=i),i=c+d,m=[];i--;m.push(0));for(h=Gr,g=Jr,i=d;--i>=0;){for(n=0,f=b[i]%g,p=b[i]/g|0,o=c,a=i+o;a>i;)l=y[--o]%g,u=y[o]/g|0,s=p*l+u*f,l=f*l+s%g*g+m[a]+n,n=(l/h|0)+(s/g|0)+p*u,m[a--]=l%h;m[a]=n}return n?++r:m.splice(0,1),x(e,m,r)},i.negated=function(){var e=new v(this);return e.s=-e.s||null,e},i.plus=function(e,t){var n,r=this,i=r.s;if(e=new v(e,t),t=e.s,!i||!t)return new v(NaN);if(i!=t)return e.s=-t,r.minus(e);var a=r.e/M,o=e.e/M,s=r.c,c=e.c;if(!a||!o){if(!s||!c)return new v(i/0);if(!s[0]||!c[0])return c[0]?e:new v(s[0]?r:i*0)}if(a=P(a),o=P(o),s=s.slice(),i=a-o){for(i>0?(o=a,n=c):(i=-i,n=s),n.reverse();i--;n.push(0));n.reverse()}for(i=s.length,t=c.length,i-t<0&&(n=c,c=s,s=n,t=i),i=0;t;)i=(s[--t]=s[t]+c[t]+i)/Gr|0,s[t]=Gr===s[t]?0:s[t]%Gr;return i&&(s=[i].concat(s),++o),x(e,s,o)},i.precision=i.sd=function(e,t){var n,r,i,a=this;if(e!=null&&e!==!!e)return F(e,1,N),t==null?t=s:F(t,0,8),S(new v(a),e,t);if(!(n=a.c))return null;if(i=n.length-1,r=i*M+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&a.e+1>r&&(r=a.e+1),r},i.shiftedBy=function(e){return F(e,-Kr,Kr),this.times(`1e`+e)},i.squareRoot=i.sqrt=function(){var e,n,r,i,a,c=this,l=c.c,u=c.s,d=c.e,f=o+4,p=new v(`0.5`);if(u!==1||!l||!l[0])return new v(!u||u<0&&(!l||l[0])?NaN:l?c:1/0);if(u=Math.sqrt(+C(c)),u==0||u==1/0?(n=Xr(l),(n.length+d)%2==0&&(n+=`0`),u=Math.sqrt(+n),d=P((d+1)/2)-(d<0||d%2),u==1/0?n=`5e`+d:(n=u.toExponential(),n=n.slice(0,n.indexOf(`e`)+1)+d),r=new v(n)):r=new v(u+``),r.c[0]){for(d=r.e,u=d+f,u<3&&(u=0);;)if(a=r,r=p.times(a.plus(t(c,a,f,1))),Xr(a.c).slice(0,u)===(n=Xr(r.c)).slice(0,u)){if(r.e<d&&--u,n=n.slice(u-3,u+1),n==`9999`||!i&&n==`4999`){if(!i&&(S(a,a.e+o+2,0),a.times(a).eq(c))){r=a;break}f+=4,u+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)==`5`)&&(S(r,r.e+o+2,1),e=!r.times(r).eq(c));break}}}return S(r,r.e+o+1,s,e)},i.toExponential=function(e,t){return e!=null&&(F(e,0,N),e++),y(this,e,t,1)},i.toFixed=function(e,t){return e!=null&&(F(e,0,N),e=e+this.e+1),y(this,e,t)},i.toFormat=function(e,t,n){var r,i=this;if(n==null)e!=null&&t&&typeof t==`object`?(n=t,t=null):e&&typeof e==`object`?(n=e,e=t=null):n=h;else if(typeof n!=`object`)throw Error(j+`Argument not an object: `+n);if(r=i.toFixed(e,t),i.c){var a,o=r.split(`.`),s=+n.groupSize,c=+n.secondaryGroupSize,l=n.groupSeparator||``,u=o[0],d=o[1],f=i.s<0,p=f?u.slice(1):u,m=p.length;if(c&&(a=s,s=c,c=a,m-=a),s>0&&m>0){for(a=m%s||s,u=p.substr(0,a);a<m;a+=s)u+=l+p.substr(a,s);c>0&&(u+=l+p.slice(a)),f&&(u=`-`+u)}r=d?u+(n.decimalSeparator||``)+((c=+n.fractionGroupSize)?d.replace(RegExp(`\\d{`+c+`}\\B`,`g`),`$&`+(n.fractionGroupSeparator||``)):d):u}return(n.prefix||``)+r+(n.suffix||``)},i.toFraction=function(e){var n,r,i,o,c,l,u,f,p,m,h,g,_=this,y=_.c;if(e!=null&&(u=new v(e),!u.isInteger()&&(u.c||u.s!==1)||u.lt(a)))throw Error(j+`Argument `+(u.isInteger()?`out of range: `:`not an integer: `)+C(u));if(!y)return new v(_);for(n=new v(a),p=r=new v(a),i=f=new v(a),g=Xr(y),c=n.e=g.length-_.e-1,n.c[0]=qr[(l=c%M)<0?M+l:l],e=!e||u.comparedTo(n)>0?c>0?n:p:u,l=d,d=1/0,u=new v(g),f.c[0]=0;m=t(u,n,0,1),o=r.plus(m.times(i)),o.comparedTo(e)!=1;)r=i,i=o,p=f.plus(m.times(o=p)),f=o,n=u.minus(m.times(o=n)),u=o;return o=t(e.minus(r),i,0,1),f=f.plus(o.times(p)),r=r.plus(o.times(i)),f.s=p.s=_.s,c*=2,h=t(p,i,c,s).minus(_).abs().comparedTo(t(f,r,c,s).minus(_).abs())<1?[p,i]:[f,r],d=l,h},i.toNumber=function(){return+C(this)},i.toPrecision=function(e,t){return e!=null&&F(e,1,N),y(this,e,t,2)},i.toString=function(e){var t,r=this,i=r.s,a=r.e;return a===null?i?(t=`Infinity`,i<0&&(t=`-`+t)):t=`NaN`:(e==null?t=a<=c||a>=l?$r(Xr(r.c),a):ei(Xr(r.c),a,`0`):e===10&&_?(r=S(new v(r),o+a+1,s),t=ei(Xr(r.c),r.e,`0`)):(F(e,2,g.length,`Base`),t=n(ei(Xr(r.c),a,`0`),10,e,i,!0)),i<0&&r.c[0]&&(t=`-`+t)),t},i.valueOf=i.toJSON=function(){return C(this)},i._isBigNumber=!0,i[Symbol.toStringTag]=`BigNumber`,i[Symbol.for(`nodejs.util.inspect.custom`)]=i.valueOf,e!=null&&v.set(e),v}function P(e){var t=e|0;return e>0||e===t?t:t-1}function Xr(e){for(var t,n,r=1,i=e.length,a=e[0]+``;r<i;){for(t=e[r++]+``,n=M-t.length;n--;t=`0`+t);a+=t}for(i=a.length;a.charCodeAt(--i)===48;);return a.slice(0,i+1||1)}function Zr(e,t){var n,r,i=e.c,a=t.c,o=e.s,s=t.s,c=e.e,l=t.e;if(!o||!s)return null;if(n=i&&!i[0],r=a&&!a[0],n||r)return n?r?0:-s:o;if(o!=s)return o;if(n=o<0,r=c==l,!i||!a)return r?0:!i^n?1:-1;if(!r)return c>l^n?1:-1;for(s=(c=i.length)<(l=a.length)?c:l,o=0;o<s;o++)if(i[o]!=a[o])return i[o]>a[o]^n?1:-1;return c==l?0:c>l^n?1:-1}function F(e,t,n,r){if(e<t||e>n||e!==Ur(e))throw Error(j+(r||`Argument`)+(typeof e==`number`?e<t||e>n?` out of range: `:` not an integer: `:` not a primitive number: `)+String(e))}function Qr(e){var t=e.c.length-1;return P(e.e/M)==t&&e.c[t]%2!=0}function $r(e,t){return(e.length>1?e.charAt(0)+`.`+e.slice(1):e)+(t<0?`e`:`e+`)+t}function ei(e,t,n){var r,i;if(t<0){for(i=n+`.`;++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+`.`+e.slice(t));return e}var I=Yr(),ti=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},ni=`~memo`,ri=[];function ii(e){return typeof e==`object`&&!!e}function ai(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var oi=new WeakMap,si=0,ci=1,li=2;function ui(e,t,n){let r=oi.get(e);if(r!==void 0)return r?li:si;if(t.has(e))return li;t.add(e);let i=si,a=e=>{if(i!==li&&e?._zod){let r=ui(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=si;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?ci:o.value?._zod?ui(o.value,t,n):si;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=In(c);s(e?o(e,!0):ci),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?ui(r,t,!1):ci);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),di(e,i)}function di(e,t){return t!==ci&&oi.set(e,t===li),t}function fi(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var pi,mi=[],hi={alloc(e,t,n){let r=pi;if(!r)return n;pi=void 0;let i={value:n,issues:null};return r.set(t.value,i),mi.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&_i(n,e.value))throw new ti;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=ui(e,new Set,!1);if(i===si)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===li||r?n=!0:r=!0}let l=s.value;if(!ii(l))return t(s,c);let u=c[ni];u||(u={buckets:new WeakMap,backEdges:void 0},c[ni]=u);let d;i===c?d=a:(d=fi(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...ai(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;pi=d;let p=mi.length,m=t(s,c);pi=void 0;let h=mi.length>p?mi.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?ai(e.issues):ri),e)):(h&&(h.issues=m.issues.length?ai(m.issues):ri),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function gi(){return hi}function _i(e,t){let n=e[ni]?.backEdges;return n!==void 0&&ii(t)&&n.has(t)}var vi=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(an(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${_r(e.values[0])}`:`Invalid option: expected one of ${Sn(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${Sn(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function yi(){return{localeError:vi()}}var bi,xi=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Si(){return new xi}(bi=globalThis).__zod_globalRegistry??(bi.__zod_globalRegistry=Si());var Ci=globalThis.__zod_globalRegistry;function wi(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&zt(e,t,n[t]);return e}function Ti(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Ci,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Ei(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function L(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,L(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&wi(o.schema,c),t.io===`input`&&R(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Di(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Oi(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Di(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Di(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
3
3
 
4
4
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function ki(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;ki(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Ai=new Set([`type`,`properties`,`required`,`additionalProperties`]),ji=[`oneOf`,`anyOf`];function Mi(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Ni(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ai.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Mi(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}let i=e.length===1?e[0]:Ni(e)??{allOf:e};zt(n,r,i)}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Mi(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Pi(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ai)if(t in e)return;let n=t.filter(e=>ji.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Ni(t);else{let e=n[0],i=ji.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Ni([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,wi(e,r))}function Fi(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):wi(i,s),wi(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())ki(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Pi(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}wi(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,zt(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Li(t,`input`,e.processors),output:Li(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function R(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return R(r.element,n);if(r.type===`set`)return R(r.valueType,n);if(r.type===`lazy`)return R(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return R(r.innerType,n);if(r.type===`intersection`)return R(r.left,n)||R(r.right,n);if(r.type===`record`||r.type===`map`)return R(r.keyType,n)||R(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:R(r.in,n)||R(r.out,n);if(r.type===`object`){for(let e in r.shape)if(R(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(R(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(R(e,n))return!0;return!!(r.rest&&R(r.rest,n))}return!1}var Ii=(e,t={})=>n=>{let r=Ti({...n,processors:t});return L(e,r),Oi(r,e),Fi(r,e)},Li=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ti({...i??{},target:a,io:t,processors:n});return L(e,o),Oi(o,e),Fi(o,e)},Ri=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},zi=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Bi=(e,t)=>{Ri(e,`minimum`,t),zi(e,`maximum`,t)},Vi=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Hi=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Ui=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Wi=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Gi=(e,t)=>Ri(e,`minimum`,t.minimum),Ki=(e,t)=>zi(e,`maximum`,t.maximum),qi=e=>(t,n)=>{Wi(t,n.format);let[r,i]=e[n.format];Ri(t,`minimum`,r),zi(t,`maximum`,i)},Ji={greater_than:(e,t)=>Ri(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>zi(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Vi(e,t.value),number_format:qi(Qe),bigint_format:qi(Zn),min_length:Gi,max_length:Ki,length_equals:(e,t)=>Bi(e,t.length),min_size:Gi,max_size:Ki,size_equals:(e,t)=>Bi(e,t.size),string_format:(e,t)=>{Wi(e,t.format),t.pattern&&Hi(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Ui(e,t.mime)};function Yi(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Ji[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Ri(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Ri(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&zi(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&zi(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Vi(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Ui(t,i.mime);for(let e of i.patterns??[])Hi(t,e);return t}var Xi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Zi=new Map([[Fn,Wt],[vn,gr]]),Qi=e=>Zi.get(e)??e,$i=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Yi(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Xi[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Qi);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},ea=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Yi(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Ei(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},ta=(e,t,n,r)=>{n.type=`boolean`},na=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},ra=(e,t,n,r)=>{Ei(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},ia=(e,t,n,r)=>{Ei(e,t,n,r,`Void cannot be represented in JSON Schema`)},aa=(e,t,n,r)=>{n.not={}},oa=(e,t,n,r)=>{let i=e._zod.def,a=cn(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},sa=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Ei(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Ei(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},ca=(e,t,n,r)=>{Ei(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},la=(e,t,n,r)=>{Ei(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},ua=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Yi(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=L(a.element,t,{...r,path:[...r.path,`items`]})};function da(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?da(t.out):t.type===`catch`?da(t.innerType):e._zod.optin}var fa=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Ei(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)zt(i.properties,e,L(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?da(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=L(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},pa=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>L(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ma=(e,t,n,r)=>{let i=e._zod.def,a=L(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=L(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function ha(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=ha(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>ha(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?Zt:Er).source),p):p}var ga=new WeakMap;function _a(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of ga.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=ha(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var va=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=Yi(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=L(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)zt(i.patternProperties,Qi(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=L(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=ga.get(t);n||(n=[],ga.set(t,n),t.deferred.push(()=>_a(t))),n.push(e)}i.additionalProperties=L(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&da(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},ya=(e,t,n,r)=>{let i=e._zod.def,a=L(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},ba=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},xa=Symbol();function Sa(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Ei(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),xa):JSON.parse(o)}var Ca=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Sa(i.defaultValue,e,t,n,r);o!==xa&&(n.default=o)},wa=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Sa(i.defaultValue,e,t,n,r);o!==xa&&(n._prefault=o)},Ta=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Ei(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Ea=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;L(o,t,r);let s=t.seen.get(e);s.ref=o},Da=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Oa=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType};function ka({id:e,name:t,address:n,currency:r,balance:i,spendableBalance:a,blockHeight:o,lastSyncDate:s,parentAccountId:c,publicKey:l,readiness:u}){return{id:e,name:t,address:n,currency:r,balance:new I(i),spendableBalance:new I(a),blockHeight:o,lastSyncDate:new Date(s),parentAccountId:c,publicKey:l,readiness:u}}var Aa=new WeakSet([Object.prototype,Error.prototype]);function ja(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Ma=(e,t)=>{Or.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Aa.has(n)||(Aa.add(n),ja(n,`format`,e=>t=>Mt(e,t)),ja(n,`flatten`,e=>t=>Me(e,t)),ja(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Jt,2)}),ja(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Jt,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},Na=A(`ZodError`,Ma),Pa=A(`ZodError`,Ma,void 0,{Parent:Error}),Fa=Et(Pa),Ia=Be(Pa),La=Tn(Pa),Ra=st(Pa),za=Fe(Pa),Ba=Cr(Pa),Va=br(Pa),Ha=Ct(Pa),Ua=On(Pa),Wa=Le(Pa),Ga=ke(Pa),Ka=ft(Pa);function qa(){tt.localeError||Ge(yi())}function Ja(){tt.memoizer||Ge({memoizer:gi()})}var z=A(`ZodType`,(e,t)=>(qa(),qt.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ar(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return It(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(ms(e,t))},superRefine(e,t){return this.check(hs(e,t))},overwrite(e){return this.check(Ot(e))},optional(){return Xo(this)},exactOptional(){return Qo(this)},nullable(){return es(this)},nullish(){return Xo(es(this))},nonoptional(e){return os(this,e)},array(){return G(this)},or(e){return q([this,e])},and(e){return Ho(this,e)},transform(e){return us(this,Jo(e))},default(e){return ns(this,e)},prefault(e){return is(this,e)},catch(e){return cs(this,e)},pipe(e){return us(this,e)},readonly(){return fs(this)},describe(e){let t=this.clone();return Ci.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ci.get(this);let t=this.clone();return Ci.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return lr(this,`~standard`,{...mn(this),jsonSchema:{input:Li(this,`input`),output:Li(this,`output`)}})},set"~standard"(e){pr(this,`~standard`,e)},parse:function e(t,n){return Fa(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Ia(this,t,n,{callee:e})},safeParse(e,t){return La(this,e,t)},async safeParseAsync(e,t){return Ra(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){pr(this,`spa`,e)},validate(e,t){return it(this,e,t)},validateAsync(e,t){return bt(this,e,t)},encode:function e(t,n){return za(this,t,n,{callee:e})},decode:function e(t,n){return Ba(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Va(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Ha(this,t,n,{callee:e})},safeEncode(e,t){return Ua(this,e,t)},safeDecode(e,t){return Wa(this,e,t)},async safeEncodeAsync(e,t){return Ga(this,e,t)},async safeDecodeAsync(e,t){return Ka(this,e,t)},toJSONSchema(e){return Ii(this,{})(e)},get description(){return Ci.get(this)?.description},get _def(){return this._zod.def}}),Ya=A(`_ZodString`,(e,t)=>{zn.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$i(e,t,n,r)},_t({format:e=>Yi(e).format??null,minLength:e=>Yi(e).minimum??null,maxLength:e=>Yi(e).maximum??null},{regex(...e){return this.check(et(...e))},includes(...e){return this.check(Xt(...e))},startsWith(...e){return this.check(Ze(...e))},endsWith(...e){return this.check(pn(...e))},min(...e){return this.check(He(...e))},max(...e){return this.check(mt(...e))},length(...e){return this.check(Oe(...e))},nonempty(...e){return this.check(He(1,...e))},lowercase(e){return this.check(wn(e))},uppercase(e){return this.check(nr(e))},trim(){return this.check(Te())},normalize(...e){return this.check(je(...e))},toLowerCase(){return this.check(Bt())},toUpperCase(){return this.check(gt())},slugify(){return this.check(Xn())}})),Xa=A(`ZodString`,(e,t)=>{zn.init(e,t),Ya.init(e,t)},{email(e){return this.check(Pn(to,e))},url(e){return this.check(Cn(io,e))},jwt(e){return this.check(dt(bo,e))},emoji(e){return this.check(_n(ao,e))},guid(e){return this.check(Tr(no,e))},uuid(e){return this.check(Yt(ro,e))},uuidv4(e){return this.check(Gn(ro,e))},uuidv6(e){return this.check(or(ro,e))},uuidv7(e){return this.check(nn(ro,e))},nanoid(e){return this.check(rt(oo,e))},cuid(e){return this.check(An(so,e))},cuid2(e){return this.check(dr(co,e))},ulid(e){return this.check(ln(lo,e))},base64(e){return this.check($n(_o,e))},base64url(e){return this.check(bn(vo,e))},xid(e){return this.check(mr(uo,e))},ksuid(e){return this.check(Dn(fo,e))},ipv4(e){return this.check(St(po,e))},ipv6(e){return this.check(Pe(mo,e))},cidrv4(e){return this.check(rr(ho,e))},cidrv6(e){return this.check($t(go,e))},e164(e){return this.check(Kn(yo,e))},datetime(e){return this.check(Tt(Za,e))},date(e){return this.check(yr(Qa,e))},time(e){return this.check(Ie($a,e))},duration(e){return this.check(ze(eo,e))}});function B(e){return Rt(Xa,e)}var V=A(`ZodStringFormat`,(e,t)=>{er.init(e,t),Ya.init(e,t)}),Za=A(`ZodISODateTime`,(e,t)=>{Ue.init(e,t),V.init(e,t)}),Qa=A(`ZodISODate`,(e,t)=>{ht.init(e,t),V.init(e,t)}),$a=A(`ZodISOTime`,(e,t)=>{at.init(e,t),V.init(e,t)}),eo=A(`ZodISODuration`,(e,t)=>{Xe.init(e,t),V.init(e,t)}),to=A(`ZodEmail`,(e,t)=>{Re.init(e,t),V.init(e,t)}),no=A(`ZodGUID`,(e,t)=>{En.init(e,t),V.init(e,t)}),ro=A(`ZodUUID`,(e,t)=>{en.init(e,t),V.init(e,t)}),io=A(`ZodURL`,(e,t)=>{ir.init(e,t),V.init(e,t)}),ao=A(`ZodEmoji`,(e,t)=>{pt.init(e,t),V.init(e,t)}),oo=A(`ZodNanoID`,(e,t)=>{Je.init(e,t),V.init(e,t)}),so=A(`ZodCUID`,(e,t)=>{Dr.init(e,t),V.init(e,t)}),co=A(`ZodCUID2`,(e,t)=>{Qt.init(e,t),V.init(e,t)}),lo=A(`ZodULID`,(e,t)=>{Un.init(e,t),V.init(e,t)}),uo=A(`ZodXID`,(e,t)=>{qn.init(e,t),V.init(e,t)}),fo=A(`ZodKSUID`,(e,t)=>{Ne.init(e,t),V.init(e,t)}),po=A(`ZodIPv4`,(e,t)=>{ct.init(e,t),V.init(e,t)}),mo=A(`ZodIPv6`,(e,t)=>{ut.init(e,t),V.init(e,t)}),ho=A(`ZodCIDRv4`,(e,t)=>{Kt.init(e,t),V.init(e,t)}),go=A(`ZodCIDRv6`,(e,t)=>{vr.init(e,t),V.init(e,t)}),_o=A(`ZodBase64`,(e,t)=>{Yn.init(e,t),V.init(e,t)}),vo=A(`ZodBase64URL`,(e,t)=>{Ln.init(e,t),V.init(e,t)}),yo=A(`ZodE164`,(e,t)=>{Ve.init(e,t),V.init(e,t)}),bo=A(`ZodJWT`,(e,t)=>{kr.init(e,t),V.init(e,t)}),xo=A(`ZodNumber`,(e,t)=>{Qn.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ea(e,t,n,r),e.isFinite=!0},_t({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Yi(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Yi(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Yi(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Yi(e).format??null},{gt(e,t){return this.check(Ut(e,t))},gte(e,t){return this.check(hr(e,t))},min(e,t){return this.check(hr(e,t))},lt(e,t){return this.check(ot(e,t))},lte(e,t){return this.check(lt(e,t))},max(e,t){return this.check(lt(e,t))},int(e){return this.check(Co(e))},safe(e){return this.check(Co(e))},positive(e){return this.check(Ut(0,e))},nonnegative(e){return this.check(hr(0,e))},negative(e){return this.check(ot(0,e))},nonpositive(e){return this.check(lt(0,e))},multipleOf(e,t){return this.check(Ye(e,t))},step(e,t){return this.check(Ye(e,t))},finite(){return this}}));function H(e){return qe(xo,e)}var So=A(`ZodNumberFormat`,(e,t)=>{$e.init(e,t),xo.init(e,t)});function Co(e){return Sr(So,e)}var wo=A(`ZodBoolean`,(e,t)=>{gn.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ta(e,t,n,r)});function U(e){return Hn(wo,e)}var To=A(`ZodUndefined`,(e,t)=>{jn.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ra(e,t,n,r)});function Eo(e){return ur(To,e)}var Do=A(`ZodNull`,(e,t)=>{Ke.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>na(e,t,n,r)});function W(e){return jt(Do,e)}var Oo=A(`ZodAny`,(e,t)=>{on.init(e,t),z.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ko(){return sr(Oo)}var Ao=A(`ZodUnknown`,(e,t)=>{rn.init(e,t),z.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function jo(){return Vn(Ao)}var Mo=A(`ZodNever`,(e,t)=>{At.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aa(e,t,n,r)});function No(e){return yt(Mo,e)}var Po=A(`ZodVoid`,(e,t)=>{un.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ia(e,t,n,r)});function Fo(e){return Nn(Po,e)}var Io=A(`ZodArray`,(e,t)=>{Ja(),fn.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ua(e,t,n,r),e.element=t.element},{min(e,t){return this.check(He(e,t))},nonempty(e){return this.check(He(1,e))},max(e,t){return this.check(mt(e,t))},length(e,t){return this.check(Oe(e,t))},unwrap(){return this.element}});function G(e,t){return Rn(Io,e,t)}var Lo=A(`ZodObject`,(e,t)=>{Ja(),Lt.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fa(e,t,n,r),Bn(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return J(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ar(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ar(this._zod.def,{catchall:jo()}))},loose(){return this.clone(ar(this._zod.def,{catchall:jo()}))},strict(){return this.clone(ar(this._zod.def,{catchall:No()}))},strip(){return this.clone(ar(this._zod.def,{catchall:void 0}))},extend(e){return Ee(this,e)},safeExtend(e){return hn(this,e)},merge(e){return Wn(this,e)},pick(e){return Jn(this,e)},omit(e){return Mn(this,e)},partial(...e){return dn(Yo,this,e[0])},exactPartial(...e){return dn(Zo,this,e[0],`exactPartial`)},required(...e){return yn(as,this,e[0])}});function K(e,t){return new Lo({type:`object`,shape:e??{},...tn(t)})}var Ro=A(`ZodUnion`,(e,t)=>{fr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pa(e,t,n,r),e.options=t.options});function q(e,t){return new Ro({type:`union`,options:e,...tn(t)})}var zo=A(`ZodDiscriminatedUnion`,(e,t)=>{Ro.init(e,t),Dt.init(e,t)});function Bo(e,t,n){return new zo({type:`union`,options:t,discriminator:e,...tn(n)})}var Vo=A(`ZodIntersection`,(e,t)=>{xt.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ma(e,t,n,r)});function Ho(e,t){return new Vo({type:`intersection`,left:e,right:t})}var Uo=A(`ZodRecord`,(e,t)=>{Ja(),cr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>va(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Wo(e,t,n){return!t||!t._zod?new Uo({type:`record`,keyType:B(),valueType:e,...tn(t)}):new Uo({type:`record`,keyType:e,valueType:t,...tn(n)})}var Go=A(`ZodEnum`,(e,t)=>{kn.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oa(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Go({...t,checks:[],...tn(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Go({...t,checks:[],...tn(r),entries:i})}});function J(e,t){return new Go({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...tn(t)})}var Ko=A(`ZodLiteral`,(e,t)=>{Nt.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sa(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Y(e,t){return new Ko({type:`literal`,values:Array.isArray(e)?e:[e],...tn(t)})}var qo=A(`ZodTransform`,(e,t)=>{Ja(),xn.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>la(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new kt(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(tr(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(tr(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Jo(e){return new qo({type:`transform`,transform:e})}var Yo=A(`ZodOptional`,(e,t)=>{Ht.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xo(e){return new Yo({type:`optional`,innerType:e})}var Zo=A(`ZodExactOptional`,(e,t)=>{Ae.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Qo(e){return new Zo({type:`optional`,innerType:e})}var $o=A(`ZodNullable`,(e,t)=>{nt.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ya(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function es(e){return new $o({type:`nullable`,innerType:e})}var ts=A(`ZodDefault`,(e,t)=>{xr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ca(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ns(e,t){return new ts({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Gt(t)}})}var rs=A(`ZodPrefault`,(e,t)=>{De.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function is(e,t){return new rs({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Gt(t)}})}var as=A(`ZodNonOptional`,(e,t)=>{Pt.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ba(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function os(e,t){return new as({type:`nonoptional`,innerType:e,...tn(t)})}var ss=A(`ZodCatch`,(e,t)=>{wr.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ta(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function cs(e,t){return new ss({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Vt(t)})}var ls=A(`ZodPipe`,(e,t)=>{vt.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ea(e,t,n,r),e.in=t.in,e.out=t.out});function us(e,t){return new ls({type:`pipe`,in:e,out:t})}var ds=A(`ZodReadonly`,(e,t)=>{sn.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Da(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fs(e){return new ds({type:`readonly`,innerType:e})}var ps=A(`ZodCustom`,(e,t)=>{wt.init(e,t),z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ca(e,t,n,r)});function ms(e,t={}){return We(ps,e,t)}function hs(e,t){return Ft(e,t)}var gs=K({ready:U(),reason:B().min(1).optional()}),_s=K({id:B(),name:B(),address:B(),currency:B(),balance:B(),spendableBalance:B(),blockHeight:q([H(),Eo()]),lastSyncDate:B(),parentAccountId:B().optional(),publicKey:B().optional(),readiness:gs.optional()}),vs=J([`CryptoCurrency`,`TokenCurrency`]),ys=J([`ERC20`]),bs=K({color:B(),ticker:B(),id:B(),name:B(),decimals:H()}),xs=Bo(`type`,[bs.extend({type:Y(vs.enum.CryptoCurrency),family:B()}),bs.extend({type:Y(vs.enum.TokenCurrency),parent:B()}).extend({standard:ys,contract:B()})]),X=K({amount:B(),recipient:B()}),Z=J(`aleo.algorand.aptos.bitcoin.cardano.casper.celo.crypto_org.cosmos.elrond.ethereum.filecoin.hedera.hypercore.internet_computer.kaspa.near.neo.polkadot.ripple.solana.stacks.stellar.sui.tezos.ton.tron.vechain`.split(`.`)),Ss=({family:e,mode:t,fees:n,assetId:r,memo:i,amount:a,recipient:o})=>({family:e,amount:a.toString(),recipient:o,fees:n?n.toString():void 0,memo:i,mode:t,assetId:r}),Cs=({family:e,mode:t,fees:n,assetId:r,memo:i,amount:a,recipient:o})=>({family:e,amount:new I(a),recipient:o,fees:n?new I(n):void 0,memo:i,mode:t,assetId:r}),ws=({family:e,mode:t,fees:n,amount:r,recipient:i})=>({family:e,amount:r.toString(),recipient:i,fees:n?n.toString():void 0,mode:t}),Ts=({family:e,mode:t,fees:n,amount:r,recipient:i})=>({family:e,amount:new I(r),recipient:i,fees:n?new I(n):void 0,mode:t});O();function Es({family:e,amount:t,recipient:n,feePerByte:r,opReturnData:i,changeAddress:a}){return{family:e,amount:t.toString(),recipient:n,feePerByte:r?.toString(),opReturnDataHex:i?.toString(`hex`),changeAddress:a}}function Ds({family:e,amount:t,recipient:n,feePerByte:r,opReturnDataHex:i,changeAddress:a}){return{family:e,amount:new I(t),recipient:n,feePerByte:r?new I(r):void 0,opReturnData:i?k.from(i,`hex`):void 0,changeAddress:a}}function Os({amount:e,family:t,fees:n=void 0,index:r=void 0,mode:i,recipient:a}){return{amount:e.toString(),family:t,fees:n?n.toString():void 0,index:r,mode:i,recipient:a}}function ks({amount:e,family:t,fees:n=void 0,index:r=void 0,mode:i,recipient:a}){return{amount:new I(e),family:t,fees:n?new I(n):void 0,index:r,mode:i,recipient:a}}var As=({amount:e,recipient:t,family:n,mode:r,fees:i,gas:a,memo:o,sourceValidator:s,validators:c})=>({amount:e.toString(),recipient:t,family:n,mode:r,fees:i?i.toString():void 0,gas:a?a.toString():void 0,memo:o,sourceValidator:s??void 0,validators:c?c.map(e=>({...e,amount:e.amount.toString()})):void 0}),js=({amount:e,recipient:t,family:n,mode:r,fees:i,gas:a,memo:o,sourceValidator:s,validators:c})=>({amount:new I(e),recipient:t,family:n,mode:r,fees:i?new I(i):void 0,gas:a?new I(a):void 0,memo:o,sourceValidator:s??void 0,validators:c?c.map(e=>({...e,amount:new I(e.amount)})):void 0}),Ms=({family:e,mode:t,fees:n,amount:r,recipient:i})=>({family:e,amount:r.toString(),recipient:i,fees:n?n.toString():void 0,mode:t}),Ns=({family:e,mode:t,fees:n,amount:r,recipient:i})=>({family:e,amount:new I(r),recipient:i,fees:n?new I(n):void 0,mode:t});O();function Ps({family:e,amount:t,recipient:n,nonce:r,data:i,gasPrice:a,gasLimit:o,maxPriorityFeePerGas:s,maxFeePerGas:c,sponsored:l}){return{family:e,amount:t.toString(),recipient:n,nonce:r,data:i?i.toString(`hex`):void 0,gasPrice:a?a.toString():void 0,gasLimit:o?o.toString():void 0,maxPriorityFeePerGas:s?s.toString():void 0,maxFeePerGas:c?c.toString():void 0,sponsored:l}}function Fs({family:e,amount:t,recipient:n,nonce:r,data:i,gasPrice:a,gasLimit:o,maxPriorityFeePerGas:s,maxFeePerGas:c,sponsored:l}){return{family:e,amount:new I(t),recipient:n,nonce:r,data:i?k.from(i,`hex`):void 0,gasPrice:a?new I(a):void 0,gasLimit:o?new I(o):void 0,maxPriorityFeePerGas:s?new I(s):void 0,maxFeePerGas:c?new I(c):void 0,sponsored:l}}function Is({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:e.toString(),recipient:t,family:n,mode:r,fees:i?.toString()}}function Ls({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:new I(e),recipient:t,family:n,mode:r,fees:i?new I(i):void 0}}function Rs({amount:e,family:t,memo:n=void 0,recipient:r}){return{amount:e.toString(),family:t,memo:n,recipient:r}}function zs({amount:e,family:t,memo:n=void 0,recipient:r}){return{amount:new I(e),family:t,memo:n,recipient:r}}function Bs({family:e,amount:t,recipient:n,customFeeRate:r}){return{family:e,amount:t.toString(),recipient:n,customFeeRate:r?.toString()}}function Vs({family:e,amount:t,recipient:n,customFeeRate:r}){return{family:e,amount:new I(t),recipient:n,customFeeRate:r?new I(r):void 0}}O();function Hs({amount:e,data:t=void 0,family:n,method:r,nonce:i,params:a=void 0,gasLimit:o,gasFeeCap:s,gasPremium:c,recipient:l,version:u}){return{amount:e.toString(),data:t?t.toString(`hex`):void 0,family:n,gasLimit:o.toNumber(),gasFeeCap:s.toString(),gasPremium:c.toString(),method:r,nonce:i,params:a,recipient:l,version:u}}function Us({amount:e,data:t=void 0,family:n,method:r,nonce:i,params:a=void 0,gasLimit:o,gasFeeCap:s,gasPremium:c,recipient:l,version:u}){return{amount:new I(e),data:t?k.from(t,`hex`):void 0,family:n,gasLimit:new I(o),gasFeeCap:new I(s),gasPremium:new I(c),nonce:i,method:r,params:a,recipient:l,version:u}}function Ws({amount:e,recipient:t,family:n}){return{amount:e.toString(),recipient:t,family:n}}function Gs({amount:e,recipient:t,family:n}){return{amount:new I(e),recipient:t,family:n}}var Ks=({amount:e,recipient:t,family:n,mode:r,fee:i,era:a,validators:o,numOfSlashingSpans:s,rewardDestination:c})=>({amount:e.toString(),recipient:t,family:n,mode:r,fee:i?i.toString():void 0,era:a,validators:o,numOfSlashingSpans:s,rewardDestination:c}),qs=({amount:e,recipient:t,family:n,mode:r,fee:i,era:a,validators:o,numOfSlashingSpans:s,rewardDestination:c})=>({amount:new I(e),recipient:t,family:n,mode:r,fee:i?new I(i):void 0,era:a,validators:o,numOfSlashingSpans:s,rewardDestination:c}),Js=({family:e,fee:t,tag:n,amount:r,recipient:i})=>({family:e,amount:r.toString(),recipient:i,fee:t?t.toString():void 0,tag:n}),Ys=({family:e,fee:t,tag:n,amount:r,recipient:i})=>({family:e,amount:new I(r),recipient:i,fee:t?new I(t):void 0,tag:n}),Xs=({amount:e,recipient:t,family:n,fees:r,memoType:i,memoValue:a})=>({amount:e.toString(),recipient:t,family:n,fees:r?r.toString():void 0,memoType:i,memoValue:a}),Zs=({amount:e,recipient:t,family:n,fees:r,memoType:i,memoValue:a})=>({amount:new I(e),recipient:t,family:n,fees:r?new I(r):void 0,memoType:i,memoValue:a}),Qs=({amount:e,recipient:t,family:n,mode:r,fees:i,gasLimit:a})=>({amount:e.toString(),recipient:t,family:n,mode:r,fees:i?i.toString():void 0,gasLimit:a?a.toString():void 0}),$s=({amount:e,recipient:t,family:n,mode:r,fees:i,gasLimit:a})=>({amount:new I(e),recipient:t,family:n,mode:r,fees:i?new I(i):void 0,gasLimit:a?new I(a):void 0}),ec=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.inspectSymbol=void 0,e.inspectSymbol=Symbol.for(`nodejs.util.inspect.custom`)})),tc=t((e=>{O(),Object.defineProperty(e,"__esModule",{value:!0}),e.crc16=void 0;function t(e){let t=0,n=k.alloc(e.length+2);n.set(e);for(let e of n){let n=128;for(;n>0;)t<<=1,e&n&&(t+=1),n>>=1,t>65535&&(t&=65535,t^=4129)}return k.from([Math.floor(t/256),t%256])}e.crc16=t})),nc=t((e=>{O();var t;Object.defineProperty(e,"__esModule",{value:!0}),e.address=e.Address=void 0;var n=ec(),r=tc(),i=17,a=81,o=128;function s(e){if(typeof e==`string`&&!c.isFriendly(e))throw Error(`Unknown address type`);let t=k.isBuffer(e)?e:k.from(e,`base64`);if(t.length!==36)throw Error(`Unknown address type: byte length is not equal to 36`);let n=t.subarray(0,34),s=t.subarray(34,36),l=(0,r.crc16)(n);if(l[0]!==s[0]||l[1]!==s[1])throw Error(`Invalid checksum: `+e);let u=n[0],d=!1,f=!1;if(u&o&&(d=!0,u^=o),u!==i&&u!==a)throw`Unknown address tag`;f=u===i;let p=null;p=n[1]===255?-1:n[1];let m=n.subarray(2,34);return{isTestOnly:d,isBounceable:f,workchain:p,hashPart:m}}var c=class e{static isAddress(t){return t instanceof e}static isFriendly(e){return!(e.length!==48||!/^[A-Za-z0-9+/_-]+$/.test(e))}static isRaw(e){if(e.indexOf(`:`)===-1)return!1;let[t,n]=e.split(`:`);return!(!Number.isInteger(parseFloat(t))||!/[a-f0-9]+/.test(n.toLowerCase())||n.length!==64)}static normalize(t){return typeof t==`string`?e.parse(t).toString():t.toString()}static parse(t){if(e.isFriendly(t))return this.parseFriendly(t).address;if(e.isRaw(t))return this.parseRaw(t);throw Error(`Unknown address type: `+t)}static parseRaw(t){let n=parseInt(t.split(`:`)[0]),r=k.from(t.split(`:`)[1],`hex`);return new e(n,r)}static parseFriendly(t){if(k.isBuffer(t)){let n=s(t);return{isBounceable:n.isBounceable,isTestOnly:n.isTestOnly,address:new e(n.workchain,n.hashPart)}}{let n=s(t.replace(/\-/g,`+`).replace(/_/g,`/`));return{isBounceable:n.isBounceable,isTestOnly:n.isTestOnly,address:new e(n.workchain,n.hashPart)}}}constructor(e,n){if(this.toRawString=()=>this.workChain+`:`+this.hash.toString(`hex`),this.toRaw=()=>{let e=k.alloc(36);return e.set(this.hash),e.set([this.workChain,this.workChain,this.workChain,this.workChain],32),e},this.toStringBuffer=e=>{let t=e&&e.testOnly!==void 0?e.testOnly:!1,n=!(e&&e.bounceable!==void 0)||e.bounceable?i:a;t&&(n|=o);let s=k.alloc(34);s[0]=n,s[1]=this.workChain,s.set(this.hash,2);let c=k.alloc(36);return c.set(s),c.set((0,r.crc16)(s),34),c},this.toString=e=>{let t=e&&e.urlSafe!==void 0?e.urlSafe:!0,n=this.toStringBuffer(e);return t?n.toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`):n.toString(`base64`)},this[t]=()=>this.toString(),n.length!==32)throw Error(`Invalid address hash length: `+n.length);this.workChain=e,this.hash=n,Object.freeze(this)}equals(e){return e.workChain===this.workChain&&e.hash.equals(this.hash)}};e.Address=c,t=n.inspectSymbol;function l(e){return c.parse(e)}e.address=l})),rc=t((e=>{var t;Object.defineProperty(e,"__esModule",{value:!0}),e.ExternalAddress=void 0;var n=ec();e.ExternalAddress=class e{static isAddress(t){return t instanceof e}constructor(e,n){this[t]=()=>this.toString(),this.value=e,this.bits=n}toString(){return`External<${this.bits}:${this.value}>`}},t=n.inspectSymbol})),ic=t((e=>{O(),Object.defineProperty(e,"__esModule",{value:!0}),e.base32Decode=e.base32Encode=void 0;var t=`abcdefghijklmnopqrstuvwxyz234567`;function n(e){let n=e.byteLength,r=0,i=0,a=``;for(let o=0;o<n;o++)for(i=i<<8|e[o],r+=8;r>=5;)a+=t[i>>>r-5&31],r-=5;return r>0&&(a+=t[i<<5-r&31]),a}e.base32Encode=n;function r(e,t){let n=e.indexOf(t);if(n===-1)throw Error(`Invalid character found: `+t);return n}function i(e){let n;n=e.toLowerCase();let{length:i}=n,a=0,o=0,s=0,c=k.alloc(i*5/8|0);for(let e=0;e<i;e++)o=o<<5|r(t,n[e]),a+=5,a>=8&&(c[s++]=o>>>a-8&255,a-=8);return c}e.base32Decode=i})),ac=t((e=>{O();var t;Object.defineProperty(e,"__esModule",{value:!0}),e.ADNLAddress=void 0;var n=ec(),r=ic(),i=tc();e.ADNLAddress=class e{static parseFriendly(t){if(t.length!==55)throw Error(`Invalid address`);t=`f`+t;let n=(0,r.base32Decode)(t);if(n[0]!==45)throw Error(`Invalid address`);let a=n.slice(33);if(!(0,i.crc16)(n.slice(0,33)).equals(a))throw Error(`Invalid address`);return new e(n.slice(1,33))}static parseRaw(t){let n=k.from(t,`base64`);return new e(n)}constructor(e){if(this.toRaw=()=>this.address.toString(`hex`).toUpperCase(),this.toString=()=>{let e=k.concat([k.from([45]),this.address]),t=(0,i.crc16)(e);return e=k.concat([e,t]),(0,r.base32Encode)(e).slice(1)},this[t]=()=>this.toString(),e.length!==32)throw Error(`Invalid address`);this.address=e}equals(e){return this.address.equals(e.address)}},t=n.inspectSymbol})),oc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.paddedBufferToBits=e.bitsToPaddedBuffer=void 0;var t=cc(),n=sc();function r(e){let n=new t.BitBuilder(Math.ceil(e.length/8)*8);n.writeBits(e);let r=Math.ceil(e.length/8)*8-e.length;for(let e=0;e<r;e++)e===0?n.writeBit(1):n.writeBit(0);return n.buffer()}e.bitsToPaddedBuffer=r;function i(e){let t=0;for(let n=e.length-1;n>=0;n--)if(e[n]!==0){let r=e[n],i=r&-r;i&1||(i=Math.log2(i)+1),n>0&&(t=n<<3),t+=8-i;break}return new n.BitString(e,0,t)}e.paddedBufferToBits=i})),sc=t((e=>{O();var t;Object.defineProperty(e,"__esModule",{value:!0}),e.BitString=void 0;var n=oc(),r=ec(),i=class e{static isBitString(t){return t instanceof e}constructor(e,n,r){if(this[t]=()=>this.toString(),r<0)throw Error(`Length ${r} is out of bounds`);this._length=r,this._data=e,this._offset=n}get length(){return this._length}at(e){if(e>=this._length)throw Error(`Index ${e} > ${this._length} is out of bounds`);if(e<0)throw Error(`Index ${e} < 0 is out of bounds`);let t=this._offset+e>>3,n=7-(this._offset+e)%8;return!!(this._data[t]&1<<n)}substring(t,n){if(t>this._length)throw Error(`Offset(${t}) > ${this._length} is out of bounds`);if(t<0)throw Error(`Offset(${t}) < 0 is out of bounds`);if(n===0)return e.EMPTY;if(t+n>this._length)throw Error(`Offset ${t} + Length ${n} > ${this._length} is out of bounds`);return new e(this._data,this._offset+t,n)}subbuffer(e,t){if(e>this._length||e<0)throw Error(`Offset ${e} is out of bounds`);if(e+t>this._length)throw Error(`Offset + Length = ${e+t} is out of bounds`);if(t%8!=0||(this._offset+e)%8!=0)return null;let n=this._offset+e>>3,r=n+(t>>3);return this._data.subarray(n,r)}equals(e){if(this._length!==e._length)return!1;for(let t=0;t<this._length;t++)if(this.at(t)!==e.at(t))return!1;return!0}toString(){let e=(0,n.bitsToPaddedBuffer)(this);if(this._length%4==0){let t=e.subarray(0,Math.ceil(this._length/8)).toString(`hex`).toUpperCase();return this._length%8==0?t:t.substring(0,t.length-1)}{let t=e.toString(`hex`).toUpperCase();return this._length%8<=4?t.substring(0,t.length-1)+`_`:t+`_`}}};e.BitString=i,t=r.inspectSymbol,i.EMPTY=new i(k.alloc(0),0,0)})),cc=t((e=>{O(),Object.defineProperty(e,"__esModule",{value:!0}),e.BitBuilder=void 0;var t=nc(),n=rc(),r=sc();e.BitBuilder=class{constructor(e=1023){this._buffer=k.alloc(Math.ceil(e/8)),this._length=0}get length(){return this._length}writeBit(e){let t=this._length;if(t>this._buffer.length*8)throw Error(`BitBuilder overflow`);(typeof e==`boolean`&&e===!0||typeof e==`number`&&e>0)&&(this._buffer[t/8|0]|=1<<7-t%8),this._length++}writeBits(e){for(let t=0;t<e.length;t++)this.writeBit(e.at(t))}writeBuffer(e){if(this._length%8==0){if(this._length+e.length*8>this._buffer.length*8)throw Error(`BitBuilder overflow`);e.copy(this._buffer,this._length/8),this._length+=e.length*8}else for(let t=0;t<e.length;t++)this.writeUint(e[t],8)}writeUint(e,t){if(t<0||!Number.isSafeInteger(t))throw Error(`invalid bit length. Got ${t}`);let n=BigInt(e);if(t===0){if(n!==0n)throw Error(`value is not zero for ${t} bits. Got ${e}`);return}let r=1n<<BigInt(t);if(n<0||n>=r)throw Error(`bitLength is too small for a value ${e}. Got ${t}`);if(this._length+t>this._buffer.length*8)throw Error(`BitBuilder overflow`);let i=8-this._length%8;if(i>0){let e=Math.floor(this._length/8);if(t<i){let r=Number(n);this._buffer[e]|=r<<i-t,this._length+=t}else{let r=Number(n>>BigInt(t-i));this._buffer[e]|=r,this._length+=i}}for(t-=i;t>0;)t>=8?(this._buffer[this._length/8]=Number(n>>BigInt(t-8)&255n),this._length+=8,t-=8):(this._buffer[this._length/8]=Number(n<<BigInt(8-t)&255n),this._length+=t,t=0)}writeInt(e,t){let n=BigInt(e);if(t<0||!Number.isSafeInteger(t))throw Error(`invalid bit length. Got ${t}`);if(t===0){if(n!==0n)throw Error(`value is not zero for ${t} bits. Got ${e}`);return}if(t===1){if(n!==-1n&&n!==0n)throw Error(`value is not zero or -1 for ${t} bits. Got ${e}`);this.writeBit(n===-1n);return}let r=1n<<BigInt(t)-1n;if(n<-r||n>=r)throw Error(`value is out of range for ${t} bits. Got ${e}`);n<0?(this.writeBit(!0),n=r+n):this.writeBit(!1),this.writeUint(n,t-1)}writeVarUint(e,t){let n=BigInt(e);if(t<0||!Number.isSafeInteger(t))throw Error(`invalid bit length. Got ${t}`);if(n<0)throw Error(`value is negative. Got ${e}`);if(n===0n){this.writeUint(0,t);return}let r=Math.ceil(n.toString(2).length/8),i=r*8;this.writeUint(r,t),this.writeUint(n,i)}writeVarInt(e,t){let n=BigInt(e);if(t<0||!Number.isSafeInteger(t))throw Error(`invalid bit length. Got ${t}`);if(n===0n){this.writeUint(0,t);return}let r=n>0?n:-n,i=Math.ceil((r.toString(2).length+1)/8),a=i*8;this.writeUint(i,t),this.writeInt(n,a)}writeCoins(e){this.writeVarUint(e,4)}writeAddress(e){if(e==null){this.writeUint(0,2);return}if(t.Address.isAddress(e)){this.writeUint(2,2),this.writeUint(0,1),this.writeInt(e.workChain,8),this.writeBuffer(e.hash);return}if(n.ExternalAddress.isAddress(e)){this.writeUint(1,2),this.writeUint(e.bits,9),this.writeUint(e.value,e.bits);return}throw Error(`Invalid address. Got ${e}`)}build(){return new r.BitString(this._buffer,0,this._length)}buffer(){if(this._length%8!=0)throw Error(`BitBuilder buffer is not byte aligned`);return this._buffer.subarray(0,this._length/8)}}})),lc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CellType=void 0;var t;(function(e){e[e.Ordinary=-1]=`Ordinary`,e[e.PrunedBranch=1]=`PrunedBranch`,e[e.Library=2]=`Library`,e[e.MerkleProof=3]=`MerkleProof`,e[e.MerkleUpdate=4]=`MerkleUpdate`})(t||(e.CellType=t={}))})),uc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.readUnaryLength=void 0;function t(e){let t=0;for(;e.loadBit();)t++;return t}e.readUnaryLength=t})),dc=t((e=>{O(),Object.defineProperty(e,"__esModule",{value:!0}),e.BitReader=void 0;var t=nc(),n=rc();e.BitReader=class e{constructor(e,t=0){this._checkpoints=[],this._bits=e,this._offset=t}get offset(){return this._offset}get remaining(){return this._bits.length-this._offset}skip(e){if(e<0||this._offset+e>this._bits.length)throw Error(`Index ${this._offset+e} is out of bounds`);this._offset+=e}reset(){this._offset=this._checkpoints.length>0?this._checkpoints.pop():0}save(){this._checkpoints.push(this._offset)}loadBit(){let e=this._bits.at(this._offset);return this._offset++,e}preloadBit(){return this._bits.at(this._offset)}loadBits(e){let t=this._bits.substring(this._offset,e);return this._offset+=e,t}preloadBits(e){return this._bits.substring(this._offset,e)}loadBuffer(e){let t=this._preloadBuffer(e,this._offset);return this._offset+=e*8,t}preloadBuffer(e){return this._preloadBuffer(e,this._offset)}loadUint(e){return this._toSafeInteger(this.loadUintBig(e),`loadUintBig`)}loadUintBig(e){let t=this.preloadUintBig(e);return this._offset+=e,t}preloadUint(e){return this._toSafeInteger(this._preloadUint(e,this._offset),`preloadUintBig`)}preloadUintBig(e){return this._preloadUint(e,this._offset)}loadInt(e){let t=this._preloadInt(e,this._offset);return this._offset+=e,this._toSafeInteger(t,`loadUintBig`)}loadIntBig(e){let t=this._preloadInt(e,this._offset);return this._offset+=e,t}preloadInt(e){return this._toSafeInteger(this._preloadInt(e,this._offset),`preloadIntBig`)}preloadIntBig(e){return this._preloadInt(e,this._offset)}loadVarUint(e){let t=Number(this.loadUint(e));return this._toSafeInteger(this.loadUintBig(t*8),`loadVarUintBig`)}loadVarUintBig(e){let t=Number(this.loadUint(e));return this.loadUintBig(t*8)}preloadVarUint(e){let t=Number(this._preloadUint(e,this._offset));return this._toSafeInteger(this._preloadUint(t*8,this._offset+e),`preloadVarUintBig`)}preloadVarUintBig(e){let t=Number(this._preloadUint(e,this._offset));return this._preloadUint(t*8,this._offset+e)}loadVarInt(e){let t=Number(this.loadUint(e));return this._toSafeInteger(this.loadIntBig(t*8),`loadVarIntBig`)}loadVarIntBig(e){let t=Number(this.loadUint(e));return this.loadIntBig(t*8)}preloadVarInt(e){let t=Number(this._preloadUint(e,this._offset));return this._toSafeInteger(this._preloadInt(t*8,this._offset+e),`preloadVarIntBig`)}preloadVarIntBig(e){let t=Number(this._preloadUint(e,this._offset));return this._preloadInt(t*8,this._offset+e)}loadCoins(){return this.loadVarUintBig(4)}preloadCoins(){return this.preloadVarUintBig(4)}loadAddress(){let e=Number(this._preloadUint(2,this._offset));if(e===2)return this._loadInternalAddress();throw Error(`Invalid address: `+e)}loadMaybeAddress(){let e=Number(this._preloadUint(2,this._offset));if(e===0)return this._offset+=2,null;if(e===2)return this._loadInternalAddress();throw Error(`Invalid address`)}loadExternalAddress(){if(Number(this._preloadUint(2,this._offset))===1)return this._loadExternalAddress();throw Error(`Invalid address`)}loadMaybeExternalAddress(){let e=Number(this._preloadUint(2,this._offset));if(e===0)return this._offset+=2,null;if(e===1)return this._loadExternalAddress();throw Error(`Invalid address`)}loadAddressAny(){let e=Number(this._preloadUint(2,this._offset));if(e===0)return this._offset+=2,null;if(e===2)return this._loadInternalAddress();if(e===1)return this._loadExternalAddress();throw Error(e===3?`Unsupported`:`Unreachable`)}loadPaddedBits(e){if(e%8!=0)throw Error(`Invalid number of bits`);let t=e;for(;;)if(this._bits.at(this._offset+t-1)){t--;break}else t--;let n=this._bits.substring(this._offset,t);return this._offset+=e,n}clone(){return new e(this._bits,this._offset)}_preloadInt(e,t){if(e==0)return 0n;let n=this._bits.at(t),r=0n;for(let n=0;n<e-1;n++)this._bits.at(t+1+n)&&(r+=1n<<BigInt(e-n-1-1));return n&&(r-=1n<<BigInt(e-1)),r}_preloadUint(e,t){if(e==0)return 0n;let n=0n;for(let r=0;r<e;r++)this._bits.at(t+r)&&(n+=1n<<BigInt(e-r-1));return n}_preloadBuffer(e,t){let n=this._bits.subbuffer(t,e*8);if(n)return n;let r=k.alloc(e);for(let n=0;n<e;n++)r[n]=Number(this._preloadUint(8,t+n*8));return r}_loadInternalAddress(){if(Number(this._preloadUint(2,this._offset))!==2)throw Error(`Invalid address`);let e,n;this._preloadUint(1,this._offset+2)!==0n&&(n=Number(this._preloadUint(5,this._offset+3)),e=this._preloadUint(n,this._offset+8),this._offset+=5+n);let r=Number(this._preloadInt(8,this._offset+3)),i=this._preloadBuffer(32,this._offset+11);if(n!==void 0&&e!==void 0){let t=Number(e),r=0,a=0,o=n;for(;o>0;){let e=Math.min(8-a,o),n=(1<<e)-1<<8-a-e,s=(t>>o-e&(1<<e)-1)<<8-a-e;i[r]=i[r]&~n|s,o-=e,a+=e,a===8&&(r++,a=0)}}return this._offset+=267,new t.Address(r,i)}_loadExternalAddress(){if(Number(this._preloadUint(2,this._offset))!==1)throw Error(`Invalid address`);let e=Number(this._preloadUint(9,this._offset+2)),t=this._preloadUint(e,this._offset+11);return this._offset+=11+e,new n.ExternalAddress(t,e)}_toSafeInteger(e,t){if(BigInt(2**53-1)<e||e<BigInt(-(2**53-1)))throw TypeError(`${e} is out of safe integer range. Use ${t} instead`);return Number(e)}}})),fc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.convertToMerkleProof=e.exoticMerkleProof=void 0;var t=dc(),n=Q();function r(e,n){let r=new t.BitReader(e);if(e.length!==280)throw Error(`Merkle Proof cell must have exactly (8 + 256 + 16) bits, got "${e.length}"`);if(n.length!==1)throw Error(`Merkle Proof cell must have exactly 1 ref, got "${n.length}"`);let i=r.loadUint(8);if(i!==3)throw Error(`Merkle Proof cell must have type 3, got "${i}"`);let a=r.loadBuffer(32),o=r.loadUint(16),s=n[0].hash(0),c=n[0].depth(0);if(o!==c)throw Error(`Merkle Proof cell ref depth must be exactly "${o}", got "${c}"`);if(!a.equals(s))throw Error(`Merkle Proof cell ref hash must be exactly "${a.toString(`hex`)}", got "${s.toString(`hex`)}"`);return{proofDepth:o,proofHash:a}}e.exoticMerkleProof=r;function i(e){return(0,n.beginCell)().storeUint(3,8).storeBuffer(e.hash(0)).storeUint(e.depth(0),16).storeRef(e).endCell({exotic:!0})}e.convertToMerkleProof=i})),pc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.generateMerkleProof=e.generateMerkleProofDirect=void 0;var t=Q(),n=uc(),r=fc();function i(e){return(0,t.beginCell)().storeUint(1,8).storeUint(1,8).storeBuffer(e.hash(0)).storeUint(e.depth(0),16).endCell({exotic:!0})}function a(e,r,o,s){let c=r.asCell();if(s.length==0)return i(c);let l=+!!r.loadBit(),u=0,d=e;if(l===0){u=(0,n.readUnaryLength)(r);for(let e=0;e<u;e++)d+=r.loadBit()?`1`:`0`}else if(+!!r.loadBit()==0){u=r.loadUint(Math.ceil(Math.log2(o+1)));for(let e=0;e<u;e++)d+=r.loadBit()?`1`:`0`}else{let e=r.loadBit()?`1`:`0`;u=r.loadUint(Math.ceil(Math.log2(o+1)));for(let t=0;t<u;t++)d+=e}if(o-u===0)return c;{let e=c.beginParse(),n=e.loadRef(),r=e.loadRef();if(!n.isExotic){let e=s.filter(e=>d+`0`===e.slice(0,d.length+1));n=a(d+`0`,n.beginParse(),o-u-1,e)}if(!r.isExotic){let e=s.filter(e=>d+`1`===e.slice(0,d.length+1));r=a(d+`1`,r.beginParse(),o-u-1,e)}return(0,t.beginCell)().storeSlice(e).storeRef(n).storeRef(r).endCell()}}function o(e,n,r){return n.forEach(t=>{if(!e.has(t))throw Error(`Trying to generate merkle proof for a missing key "${t}"`)}),a(``,(0,t.beginCell)().storeDictDirect(e).asSlice(),r.bits,n.map(e=>r.serialize(e).toString(2).padStart(r.bits,`0`)))}e.generateMerkleProofDirect=o;function s(e,t,n){return(0,r.convertToMerkleProof)(o(e,t,n))}e.generateMerkleProof=s})),mc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.generateMerkleUpdate=void 0;var t=Q(),n=pc();function r(e,n){return(0,t.beginCell)().storeUint(4,8).storeBuffer(e.hash(0)).storeBuffer(n.hash(0)).storeUint(e.depth(0),16).storeUint(n.depth(0),16).storeRef(e).storeRef(n).endCell({exotic:!0})}function i(e,t,i,a){let o=(0,n.generateMerkleProof)(e,[t],i).refs[0];e.set(t,a);let s=(0,n.generateMerkleProof)(e,[t],i).refs[0];return r(o,s)}e.generateMerkleUpdate=i})),hc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseDict=void 0;function t(e){let t=0;for(;e.loadBit();)t++;return t}function n(e,r,i,a,o){let s=+!!r.loadBit(),c=0,l=e;if(s===0){c=t(r);for(let e=0;e<c;e++)l+=r.loadBit()?`1`:`0`}else if(+!!r.loadBit()==0){c=r.loadUint(Math.ceil(Math.log2(i+1)));for(let e=0;e<c;e++)l+=r.loadBit()?`1`:`0`}else{let e=r.loadBit()?`1`:`0`;c=r.loadUint(Math.ceil(Math.log2(i+1)));for(let t=0;t<c;t++)l+=e}if(i-c===0)a.set(BigInt(`0b`+l),o(r));else{let e=r.loadRef(),t=r.loadRef();e.isExotic||n(l+`0`,e.beginParse(),i-c-1,a,o),t.isExotic||n(l+`1`,t.beginParse(),i-c-1,a,o)}}function r(e,t,r){let i=new Map;return e&&n(``,e,t,i,r),i}e.parseDict=r})),gc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.findCommonPrefix=void 0;function t(e,t=0){if(e.length===0)return``;let n=e[0].slice(t);for(let r=1;r<e.length;r++){let i=e[r];for(;i.indexOf(n,t)!==t;)if(n=n.substring(0,n.length-1),n===``)return n}return n}e.findCommonPrefix=t})),_c=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.serializeDict=e.detectLabelType=e.writeLabelSame=e.writeLabelLong=e.writeLabelShort=e.buildTree=void 0;var t=Q(),n=gc();function r(e,t){for(;e.length<t;)e=`0`+e;return e}function i(e,t){if(e.size===0)throw Error(`Internal inconsistency`);let n=new Map,r=new Map;for(let[i,a]of e.entries())i[t]===`0`?n.set(i,a):r.set(i,a);if(n.size===0)throw Error(`Internal inconsistency. Left emtpy.`);if(r.size===0)throw Error(`Internal inconsistency. Right emtpy.`);return{left:n,right:r}}function a(e,t){if(e.size===0)throw Error(`Internal inconsistency`);if(e.size===1)return{type:`leaf`,value:Array.from(e.values())[0]};let{left:n,right:r}=i(e,t);return{type:`fork`,left:o(n,t+1),right:o(r,t+1)}}function o(e,t=0){if(e.size===0)throw Error(`Internal inconsistency`);let r=(0,n.findCommonPrefix)(Array.from(e.keys()),t);return{label:r,node:a(e,r.length+t)}}function s(e,t){let n=new Map;for(let i of Array.from(e.keys())){let a=r(i.toString(2),t);n.set(a,e.get(i))}return o(n)}e.buildTree=s;function c(e,t){t.storeBit(0);for(let n=0;n<e.length;n++)t.storeBit(1);return t.storeBit(0),e.length>0&&t.storeUint(BigInt(`0b`+e),e.length),t}e.writeLabelShort=c;function l(e){return 1+e.length+1+e.length}function u(e,t,n){n.storeBit(1),n.storeBit(0);let r=Math.ceil(Math.log2(t+1));return n.storeUint(e.length,r),e.length>0&&n.storeUint(BigInt(`0b`+e),e.length),n}e.writeLabelLong=u;function d(e,t){return 2+Math.ceil(Math.log2(t+1))+e.length}function f(e,t,n,r){r.storeBit(1),r.storeBit(1),r.storeBit(e);let i=Math.ceil(Math.log2(n+1));r.storeUint(t,i)}e.writeLabelSame=f;function p(e){return 3+Math.ceil(Math.log2(e+1))}function m(e){if(e.length===0||e.length===1)return!0;for(let t=1;t<e.length;t++)if(e[t]!==e[0])return!1;return!0}function h(e,t){let n=`short`,r=l(e),i=d(e,t);if(i<r&&(r=i,n=`long`),m(e)){let e=p(t);e<r&&(r=e,n=`same`)}return n}e.detectLabelType=h;function g(e,t,n){let r=h(e,t);r===`short`?c(e,n):r===`long`?u(e,t,n):r===`same`&&f(e[0]===`1`,e.length,t,n)}function _(e,n,r,i){if(e.type===`leaf`&&r(e.value,i),e.type===`fork`){let a=(0,t.beginCell)(),o=(0,t.beginCell)();v(e.left,n-1,r,a),v(e.right,n-1,r,o),i.storeRef(a),i.storeRef(o)}}function v(e,t,n,r){g(e.label,t,r),_(e.node,t-e.label.length,n,r)}function y(e,t,n,r){v(s(e,t),t,n,r)}e.serializeDict=y})),vc=t((e=>{O(),Object.defineProperty(e,"__esModule",{value:!0}),e.deserializeInternalKey=e.serializeInternalKey=void 0;var t=nc(),n=sc(),r=oc();function i(e){if(typeof e==`number`){if(!Number.isSafeInteger(e))throw Error(`Invalid key type: not a safe integer: `+e);return`n:`+e.toString(10)}if(typeof e==`bigint`)return`b:`+e.toString(10);if(t.Address.isAddress(e))return`a:`+e.toString();if(k.isBuffer(e))return`f:`+e.toString(`hex`);if(n.BitString.isBitString(e))return`B:`+e.toString();throw Error(`Invalid key type`)}e.serializeInternalKey=i;function a(e){let i=e.slice(0,2),a=e.slice(2);if(i===`n:`)return parseInt(a,10);if(i===`b:`)return BigInt(a);if(i===`a:`)return t.Address.parse(a);if(i===`f:`)return k.from(a,`hex`);if(i===`B:`){let e=a.slice(-1)==`_`;if(e||a.length%2!=0){let t=e?a.length-1:a.length,i=a.substr(0,t)+`0`;return!e&&t&1?new n.BitString(k.from(i,`hex`),0,t<<2):(0,r.paddedBufferToBits)(k.from(i,`hex`))}return new n.BitString(k.from(a,`hex`),0,a.length<<2)}throw Error(`Invalid key type: `+i)}e.deserializeInternalKey=a})),yc=t((e=>{O(),Object.defineProperty(e,"__esModule",{value:!0}),e.Dictionary=void 0;var t=nc(),n=Q(),r=Nc(),i=sc(),a=pc(),o=mc(),s=hc(),c=_c(),l=vc(),u=class e{static empty(t,n){return t&&n?new e(new Map,t,n):new e(new Map,null,null)}static load(t,n,i){let a;if(i instanceof r.Cell){if(i.isExotic)return e.empty(t,n);a=i.beginParse()}else a=i;let o=a.loadMaybeRef();return o&&!o.isExotic?e.loadDirect(t,n,o.beginParse()):e.empty(t,n)}static loadDirect(t,n,i){if(!i)return e.empty(t,n);let a;a=i instanceof r.Cell?i.beginParse():i;let o=(0,s.parseDict)(a,t.bits,n.parse),c=new Map;for(let[e,n]of o)c.set((0,l.serializeInternalKey)(t.parse(e)),n);return new e(c,t,n)}constructor(e,t,n){this._key=t,this._value=n,this._map=e}get size(){return this._map.size}get(e){return this._map.get((0,l.serializeInternalKey)(e))}has(e){return this._map.has((0,l.serializeInternalKey)(e))}set(e,t){return this._map.set((0,l.serializeInternalKey)(e),t),this}delete(e){let t=(0,l.serializeInternalKey)(e);return this._map.delete(t)}clear(){this._map.clear()}*[Symbol.iterator](){for(let[e,t]of this._map)yield[(0,l.deserializeInternalKey)(e),t]}keys(){return Array.from(this._map.keys()).map(e=>(0,l.deserializeInternalKey)(e))}values(){return Array.from(this._map.values())}store(e,t,r){if(this._map.size===0)e.storeBit(0);else{let i=this._key;t!=null&&(i=t);let a=this._value;if(r!=null&&(a=r),!i)throw Error(`Key serializer is not defined`);if(!a)throw Error(`Value serializer is not defined`);let o=new Map;for(let[e,t]of this._map)o.set(i.serialize((0,l.deserializeInternalKey)(e)),t);e.storeBit(1);let s=(0,n.beginCell)();(0,c.serializeDict)(o,i.bits,a.serialize,s),e.storeRef(s.endCell())}}storeDirect(e,t,n){if(this._map.size===0)throw Error(`Cannot store empty dictionary directly`);let r=this._key;t!=null&&(r=t);let i=this._value;if(n!=null&&(i=n),!r)throw Error(`Key serializer is not defined`);if(!i)throw Error(`Value serializer is not defined`);let a=new Map;for(let[e,t]of this._map)a.set(r.serialize((0,l.deserializeInternalKey)(e)),t);(0,c.serializeDict)(a,r.bits,i.serialize,e)}generateMerkleProof(e){return(0,a.generateMerkleProof)(this,e,this._key)}generateMerkleProofDirect(e){return(0,a.generateMerkleProofDirect)(this,e,this._key)}generateMerkleUpdate(e,t){return(0,o.generateMerkleUpdate)(this,e,this._key,t)}};e.Dictionary=u,u.Keys={Address:()=>d(),BigInt:e=>f(e),Int:e=>p(e),BigUint:e=>m(e),Uint:e=>h(e),Buffer:e=>g(e),BitString:e=>_(e)},u.Values={BigInt:e=>y(e),Int:e=>v(e),BigVarInt:e=>b(e),BigUint:e=>C(e),Uint:e=>S(e),BigVarUint:e=>x(e),Bool:()=>ee(),Address:()=>w(),Cell:()=>te(),Buffer:e=>E(e),BitString:e=>D(e),Dictionary:(e,t)=>T(e,t)};function d(){return{bits:267,serialize:e=>{if(!t.Address.isAddress(e))throw Error(`Key is not an address`);return(0,n.beginCell)().storeAddress(e).endCell().beginParse().preloadUintBig(267)},parse:e=>(0,n.beginCell)().storeUint(e,267).endCell().beginParse().loadAddress()}}function f(e){return{bits:e,serialize:t=>{if(typeof t!=`bigint`)throw Error(`Key is not a bigint`);return(0,n.beginCell)().storeInt(t,e).endCell().beginParse().loadUintBig(e)},parse:t=>(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadIntBig(e)}}function p(e){return{bits:e,serialize:t=>{if(typeof t!=`number`)throw Error(`Key is not a number`);if(!Number.isSafeInteger(t))throw Error(`Key is not a safe integer: `+t);return(0,n.beginCell)().storeInt(t,e).endCell().beginParse().loadUintBig(e)},parse:t=>(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadInt(e)}}function m(e){return{bits:e,serialize:t=>{if(typeof t!=`bigint`)throw Error(`Key is not a bigint`);if(t<0)throw Error(`Key is negative: `+t);return(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadUintBig(e)},parse:t=>(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadUintBig(e)}}function h(e){return{bits:e,serialize:t=>{if(typeof t!=`number`)throw Error(`Key is not a number`);if(!Number.isSafeInteger(t))throw Error(`Key is not a safe integer: `+t);if(t<0)throw Error(`Key is negative: `+t);return(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadUintBig(e)},parse:t=>Number((0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadUint(e))}}function g(e){return{bits:e*8,serialize:t=>{if(!k.isBuffer(t))throw Error(`Key is not a buffer`);return(0,n.beginCell)().storeBuffer(t).endCell().beginParse().loadUintBig(e*8)},parse:t=>(0,n.beginCell)().storeUint(t,e*8).endCell().beginParse().loadBuffer(e)}}function _(e){return{bits:e,serialize:t=>{if(!i.BitString.isBitString(t))throw Error(`Key is not a BitString`);return(0,n.beginCell)().storeBits(t).endCell().beginParse().loadUintBig(e)},parse:t=>(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadBits(e)}}function v(e){return{serialize:(t,n)=>{n.storeInt(t,e)},parse:t=>{let n=t.loadInt(e);return t.endParse(),n}}}function y(e){return{serialize:(t,n)=>{n.storeInt(t,e)},parse:t=>{let n=t.loadIntBig(e);return t.endParse(),n}}}function b(e){return{serialize:(t,n)=>{n.storeVarInt(t,e)},parse:t=>{let n=t.loadVarIntBig(e);return t.endParse(),n}}}function x(e){return{serialize:(t,n)=>{n.storeVarUint(t,e)},parse:t=>{let n=t.loadVarUintBig(e);return t.endParse(),n}}}function S(e){return{serialize:(t,n)=>{n.storeUint(t,e)},parse:t=>{let n=t.loadUint(e);return t.endParse(),n}}}function C(e){return{serialize:(t,n)=>{n.storeUint(t,e)},parse:t=>{let n=t.loadUintBig(e);return t.endParse(),n}}}function ee(){return{serialize:(e,t)=>{t.storeBit(e)},parse:e=>{let t=e.loadBit();return e.endParse(),t}}}function w(){return{serialize:(e,t)=>{t.storeAddress(e)},parse:e=>{let t=e.loadAddress();return e.endParse(),t}}}function te(){return{serialize:(e,t)=>{t.storeRef(e)},parse:e=>{let t=e.loadRef();return e.endParse(),t}}}function T(e,t){return{serialize:(e,t)=>{e.store(t)},parse:n=>{let r=u.load(e,t,n);return n.endParse(),r}}}function E(e){return{serialize:(t,n)=>{if(t.length!==e)throw Error(`Invalid buffer size`);n.storeBuffer(t)},parse:t=>{let n=t.loadBuffer(e);return t.endParse(),n}}}function D(e){return{serialize:(t,n)=>{if(t.length!==e)throw Error(`Invalid BitString size`);n.storeBits(t)},parse:t=>{let n=t.loadBits(e);return t.endParse(),n}}}})),bc=t((e=>{O(),Object.defineProperty(e,"__esModule",{value:!0}),e.writeString=e.stringToCell=e.readString=void 0;var t=Q();function n(e){if(e.remainingBits%8!=0)throw Error(`Invalid string length: ${e.remainingBits}`);if(e.remainingRefs!==0&&e.remainingRefs!==1)throw Error(`invalid number of refs: ${e.remainingRefs}`);let t;return t=e.remainingBits===0?k.alloc(0):e.loadBuffer(e.remainingBits/8),e.remainingRefs===1&&(t=k.concat([t,n(e.loadRef().beginParse())])),t}function r(e){return n(e).toString()}e.readString=r;function i(e,n){if(e.length>0){let r=Math.floor(n.availableBits/8);if(e.length>r){let a=e.subarray(0,r),o=e.subarray(r);n=n.storeBuffer(a);let s=(0,t.beginCell)();i(o,s),n=n.storeRef(s.endCell())}else n=n.storeBuffer(e)}}function a(e){let n=(0,t.beginCell)();return i(k.from(e),n),n.endCell()}e.stringToCell=a;function o(e,t){i(k.from(e),t)}e.writeString=o})),xc=t((e=>{var t;Object.defineProperty(e,"__esModule",{value:!0}),e.Slice=void 0;var n=ec(),r=yc(),i=Q(),a=bc();e.Slice=class e{constructor(e,n){this[t]=()=>this.toString(),this._reader=e.clone(),this._refs=[...n],this._refsOffset=0}get remainingBits(){return this._reader.remaining}get offsetBits(){return this._reader.offset}get remainingRefs(){return this._refs.length-this._refsOffset}get offsetRefs(){return this._refsOffset}skip(e){return this._reader.skip(e),this}loadBit(){return this._reader.loadBit()}preloadBit(){return this._reader.preloadBit()}loadBoolean(){return this.loadBit()}loadMaybeBoolean(){return this.loadBit()?this.loadBoolean():null}loadBits(e){return this._reader.loadBits(e)}preloadBits(e){return this._reader.preloadBits(e)}loadUint(e){return this._reader.loadUint(e)}loadUintBig(e){return this._reader.loadUintBig(e)}preloadUint(e){return this._reader.preloadUint(e)}preloadUintBig(e){return this._reader.preloadUintBig(e)}loadMaybeUint(e){return this.loadBit()?this.loadUint(e):null}loadMaybeUintBig(e){return this.loadBit()?this.loadUintBig(e):null}loadInt(e){return this._reader.loadInt(e)}loadIntBig(e){return this._reader.loadIntBig(e)}preloadInt(e){return this._reader.preloadInt(e)}preloadIntBig(e){return this._reader.preloadIntBig(e)}loadMaybeInt(e){return this.loadBit()?this.loadInt(e):null}loadMaybeIntBig(e){return this.loadBit()?this.loadIntBig(e):null}loadVarUint(e){return this._reader.loadVarUint(e)}loadVarUintBig(e){return this._reader.loadVarUintBig(e)}preloadVarUint(e){return this._reader.preloadVarUint(e)}preloadVarUintBig(e){return this._reader.preloadVarUintBig(e)}loadVarInt(e){return this._reader.loadVarInt(e)}loadVarIntBig(e){return this._reader.loadVarIntBig(e)}preloadVarInt(e){return this._reader.preloadVarInt(e)}preloadVarIntBig(e){return this._reader.preloadVarIntBig(e)}loadCoins(){return this._reader.loadCoins()}preloadCoins(){return this._reader.preloadCoins()}loadMaybeCoins(){return this._reader.loadBit()?this._reader.loadCoins():null}loadAddress(){return this._reader.loadAddress()}loadMaybeAddress(){return this._reader.loadMaybeAddress()}loadExternalAddress(){return this._reader.loadExternalAddress()}loadMaybeExternalAddress(){return this._reader.loadMaybeExternalAddress()}loadAddressAny(){return this._reader.loadAddressAny()}loadRef(){if(this._refsOffset>=this._refs.length)throw Error(`No more references`);return this._refs[this._refsOffset++]}preloadRef(){if(this._refsOffset>=this._refs.length)throw Error(`No more references`);return this._refs[this._refsOffset]}loadMaybeRef(){return this.loadBit()?this.loadRef():null}preloadMaybeRef(){return this.preloadBit()?this.preloadRef():null}loadBuffer(e){return this._reader.loadBuffer(e)}preloadBuffer(e){return this._reader.preloadBuffer(e)}loadStringTail(){return(0,a.readString)(this)}loadMaybeStringTail(){return this.loadBit()?(0,a.readString)(this):null}loadStringRefTail(){return(0,a.readString)(this.loadRef().beginParse())}loadMaybeStringRefTail(){let e=this.loadMaybeRef();return e?(0,a.readString)(e.beginParse()):null}loadDict(e,t){return r.Dictionary.load(e,t,this)}loadDictDirect(e,t){return r.Dictionary.loadDirect(e,t,this)}endParse(){if(this.remainingBits>0||this.remainingRefs>0)throw Error(`Slice is not empty`)}asCell(){return(0,i.beginCell)().storeSlice(this).endCell()}asBuilder(){return(0,i.beginCell)().storeSlice(this)}clone(t=!1){if(t){let t=this._reader.clone();return t.reset(),new e(t,this._refs)}{let t=new e(this._reader,this._refs);return t._refsOffset=this._refsOffset,t}}toString(){return this.asCell().toString()}},t=n.inspectSymbol})),Sc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.exoticLibrary=void 0;var t=dc();function n(e,n){let r=new t.BitReader(e);if(e.length!==264)throw Error(`Library cell must have exactly (8 + 256) bits, got "${e.length}"`);let i=r.loadUint(8);if(i!==2)throw Error(`Library cell must have type 2, got "${i}"`);return{}}e.exoticLibrary=n})),Cc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.exoticMerkleUpdate=void 0;var t=dc();function n(e,n){let r=new t.BitReader(e);if(e.length!==552)throw Error(`Merkle Update cell must have exactly (8 + (2 * (256 + 16))) bits, got "${e.length}"`);if(n.length!==2)throw Error(`Merkle Update cell must have exactly 2 refs, got "${n.length}"`);let i=r.loadUint(8);if(i!==4)throw Error(`Merkle Update cell type must be exactly 4, got "${i}"`);let a=r.loadBuffer(32),o=r.loadBuffer(32),s=r.loadUint(16),c=r.loadUint(16);if(s!==n[0].depth(0))throw Error(`Merkle Update cell ref depth must be exactly "${s}", got "${n[0].depth(0)}"`);if(!a.equals(n[0].hash(0)))throw Error(`Merkle Update cell ref hash must be exactly "${a.toString(`hex`)}", got "${n[0].hash(0).toString(`hex`)}"`);if(c!==n[1].depth(0))throw Error(`Merkle Update cell ref depth must be exactly "${c}", got "${n[1].depth(0)}"`);if(!o.equals(n[1].hash(0)))throw Error(`Merkle Update cell ref hash must be exactly "${o.toString(`hex`)}", got "${n[1].hash(0).toString(`hex`)}"`);return{proofDepth1:s,proofDepth2:c,proofHash1:a,proofHash2:o}}e.exoticMerkleUpdate=n})),wc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LevelMask=void 0,e.LevelMask=class e{constructor(e=0){this._mask=0,this._mask=e,this._hashIndex=t(this._mask),this._hashCount=this._hashIndex+1}get value(){return this._mask}get level(){return 32-Math.clz32(this._mask)}get hashIndex(){return this._hashIndex}get hashCount(){return this._hashCount}apply(t){return new e(this._mask&(1<<t)-1)}isSignificant(e){return e===0||(this._mask>>e-1)%2!=0}};function t(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}})),Tc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.exoticPruned=void 0;var t=dc(),n=wc();function r(e,r){let i=new t.BitReader(e),a=i.loadUint(8);if(a!==1)throw Error(`Pruned branch cell must have type 1, got "${a}"`);if(r.length!==0)throw Error(`Pruned Branch cell can't has refs, got "${r.length}"`);let o;if(e.length===280)o=new n.LevelMask(1);else{if(o=new n.LevelMask(i.loadUint(8)),o.level<1||o.level>3)throw Error(`Pruned Branch cell level must be >= 1 and <= 3, got "${o.level}/${o.value}"`);let t=16+o.apply(o.level-1).hashCount*272;if(e.length!==t)throw Error(`Pruned branch cell must have exactly ${t} bits, got "${e.length}"`)}let s=[],c=[],l=[];for(let e=0;e<o.level;e++)c.push(i.loadBuffer(32));for(let e=0;e<o.level;e++)l.push(i.loadUint(16));for(let e=0;e<o.level;e++)s.push({depth:l[e],hash:c[e]});return{mask:o.value,pruned:s}}e.exoticPruned=r})),Ec=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveExotic=void 0;var t=dc(),n=lc(),r=Sc(),i=fc(),a=Cc(),o=Tc(),s=wc();function c(e,t){let r=(0,o.exoticPruned)(e,t),i=[],a=[],c=new s.LevelMask(r.mask);for(let e=0;e<r.pruned.length;e++)i.push(r.pruned[e].depth),a.push(r.pruned[e].hash);return{type:n.CellType.PrunedBranch,depths:i,hashes:a,mask:c}}function l(e,t){(0,r.exoticLibrary)(e,t);let i=[],a=[],o=new s.LevelMask;return{type:n.CellType.Library,depths:i,hashes:a,mask:o}}function u(e,t){(0,i.exoticMerkleProof)(e,t);let r=[],a=[],o=new s.LevelMask(t[0].level()>>1);return{type:n.CellType.MerkleProof,depths:r,hashes:a,mask:o}}function d(e,t){(0,a.exoticMerkleUpdate)(e,t);let r=[],i=[],o=new s.LevelMask((t[0].level()|t[1].level())>>1);return{type:n.CellType.MerkleUpdate,depths:r,hashes:i,mask:o}}function f(e,n){let r=new t.BitReader(e).preloadUint(8);if(r===1)return c(e,n);if(r===2)return l(e,n);if(r===3)return u(e,n);if(r===4)return d(e,n);throw Error(`Invalid exotic cell type: `+r)}e.resolveExotic=f})),Dc=t((e=>{O(),Object.defineProperty(e,"__esModule",{value:!0}),e.getRepr=e.getBitsDescriptor=e.getRefsDescriptor=void 0;var t=lc(),n=oc();function r(e,n,r){return e.length+(r===t.CellType.Ordinary?0:1)*8+n*32}e.getRefsDescriptor=r;function i(e){let t=e.length;return Math.ceil(t/8)+Math.floor(t/8)}e.getBitsDescriptor=i;function a(e,a,o,s,c,l){let u=Math.ceil(a.length/8),d=k.alloc(2+u+34*o.length),f=0;d[f++]=r(o,c,l),d[f++]=i(e),(0,n.bitsToPaddedBuffer)(a).copy(d,f),f+=u;for(let e of o){let n;n=l==t.CellType.MerkleProof||l==t.CellType.MerkleUpdate?e.depth(s+1):e.depth(s),d[f++]=Math.floor(n/256),d[f++]=n%256}for(let e of o){let n;n=l==t.CellType.MerkleProof||l==t.CellType.MerkleUpdate?e.hash(s+1):e.hash(s),n.copy(d,f),f+=32}return d}e.getRepr=a})),Oc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.wonderCalculator=void 0;var t=sc(),n=lc(),r=wc(),i=Tc(),a=fc(),o=Dc(),s=xe(),c=Cc(),l=Sc();function u(e,u,d){let f,p=null;if(e===n.CellType.Ordinary){let e=0;for(let t of d)e|=t.mask.value;f=new r.LevelMask(e)}else if(e===n.CellType.PrunedBranch)p=(0,i.exoticPruned)(u,d),f=new r.LevelMask(p.mask);else if(e===n.CellType.MerkleProof)(0,a.exoticMerkleProof)(u,d),f=new r.LevelMask(d[0].mask.value>>1);else if(e===n.CellType.MerkleUpdate)(0,c.exoticMerkleUpdate)(u,d),f=new r.LevelMask((d[0].mask.value|d[1].mask.value)>>1);else if(e===n.CellType.Library)(0,l.exoticLibrary)(u,d),f=new r.LevelMask;else throw Error(`Unsupported exotic type`);let m=[],h=[],g=e===n.CellType.PrunedBranch?1:f.hashCount,_=f.hashCount-g;for(let r=0,i=0;r<=f.level;r++){if(!f.isSignificant(r))continue;if(i<_){i++;continue}let a;if(i===_){if(r!==0&&e!==n.CellType.PrunedBranch)throw Error(`Invalid`);a=u}else{if(r===0||e===n.CellType.PrunedBranch)throw Error(`Invalid: `+r+`, `+e);a=new t.BitString(h[i-_-1],0,256)}let c=0;for(let t of d){let i;i=e==n.CellType.MerkleProof||e==n.CellType.MerkleUpdate?t.depth(r+1):t.depth(r),c=Math.max(c,i)}d.length>0&&c++;let l=(0,o.getRepr)(u,a,d,r,f.apply(r).value,e),p=(0,s.sha256_sync)(l),g=i-_;m[g]=c,h[g]=p,i++}let v=[],y=[];if(p)for(let e=0;e<4;e++){let{hashIndex:t}=f.apply(e),{hashIndex:n}=f;t===n?(v.push(h[0]),y.push(m[0])):(v.push(p.pruned[t].hash),y.push(p.pruned[t].depth))}else for(let e=0;e<4;e++)v.push(h[f.apply(e).hashIndex]),y.push(m[f.apply(e).hashIndex]);return{mask:f,hashes:v,depths:y}}e.wonderCalculator=u})),kc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.topologicalSort=void 0;function t(e){let t=[e],n=new Map,r=new Set,i=[];for(;t.length>0;){let e=[...t];t=[];for(let i of e){let e=i.hash().toString(`hex`);if(!n.has(e)){r.add(e),n.set(e,{cell:i,refs:i.refs.map(e=>e.hash().toString(`hex`))});for(let e of i.refs)t.push(e)}}}let a=new Set;function o(e){if(!r.has(e))return;if(a.has(e))throw Error(`Not a DAG`);a.add(e);let t=n.get(e).refs;for(let e=t.length-1;e>=0;e--)o(t[e]);i.push(e),a.delete(e),r.delete(e)}for(;r.size>0;){let e=Array.from(r)[0];o(e)}let s=new Map;for(let e=0;e<i.length;e++)s.set(i[i.length-e-1],e);let c=[];for(let e=i.length-1;e>=0;e--){let t=i[e],r=n.get(t);c.push({cell:r.cell,refs:r.refs.map(e=>s.get(e))})}return c}e.topologicalSort=t})),Ac=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.bitsForNumber=void 0;function t(e,t){let n=BigInt(e);if(t===`int`)return n===0n||n===-1n?1:(n>0?n:-n).toString(2).length+1;if(t===`uint`){if(n<0)throw Error(`value is negative. Got ${e}`);return n.toString(2).length}throw Error(`invalid mode. Got ${t}`)}e.bitsForNumber=t})),jc=t((e=>{O(),Object.defineProperty(e,"__esModule",{value:!0}),e.crc32c=void 0;var t=2197175160;function n(e){let n=-1;for(let r=0;r<e.length;r++)n^=e[r],n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1;n^=4294967295;let r=k.alloc(4);return r.writeInt32LE(n),r}e.crc32c=n})),Mc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.serializeBoc=e.deserializeBoc=e.parseBoc=void 0;var t=dc(),n=sc(),r=Nc(),i=kc(),a=Ac(),o=cc(),s=Dc(),c=oc(),l=jc();function u(e){return d(e&7)}function d(e){let t=0;for(let n=0;n<3;n++)t+=e&1,e>>=1;return t+1}function f(e,t){let r=e.loadUint(8),i=r%8,a=!!(r&8),o=e.loadUint(8),s=Math.ceil(o/2),c=!!(o%2),l=r>>5,d=!!(r&16),f=d?u(l)*32:0,p=d?u(l)*2:0;e.skip(f*8),e.skip(p*8);let m=n.BitString.EMPTY;s>0&&(m=c?e.loadPaddedBits(s*8):e.loadBits(s*8));let h=[];for(let n=0;n<i;n++)h.push(e.loadUint(t*8));return{bits:m,refs:h,exotic:a}}function p(e,t){return 2+Math.ceil(e.bits.length/8)+e.refs.length*t}function m(e){let r=new t.BitReader(new n.BitString(e,0,e.length*8)),i=r.loadUint(32);if(i===1761568243){let e=r.loadUint(8),t=r.loadUint(8),n=r.loadUint(e*8),i=r.loadUint(e*8),a=r.loadUint(e*8),o=r.loadUint(t*8);return{size:e,offBytes:t,cells:n,roots:i,absent:a,totalCellSize:o,index:r.loadBuffer(n*t),cellData:r.loadBuffer(o),root:[0]}}if(i===2898503464){let t=r.loadUint(8),n=r.loadUint(8),i=r.loadUint(t*8),a=r.loadUint(t*8),o=r.loadUint(t*8),s=r.loadUint(n*8),c=r.loadBuffer(i*n),u=r.loadBuffer(s),d=r.loadBuffer(4);if(!(0,l.crc32c)(e.subarray(0,e.length-4)).equals(d))throw Error(`Invalid CRC32C`);return{size:t,offBytes:n,cells:i,roots:a,absent:o,totalCellSize:s,index:c,cellData:u,root:[0]}}if(i===3052313714){let t=r.loadUint(1),n=r.loadUint(1);r.loadUint(1),r.loadUint(2);let i=r.loadUint(3),a=r.loadUint(8),o=r.loadUint(i*8),s=r.loadUint(i*8),c=r.loadUint(i*8),u=r.loadUint(a*8),d=[];for(let e=0;e<s;e++)d.push(r.loadUint(i*8));let f=null;t&&(f=r.loadBuffer(o*a));let p=r.loadBuffer(u);if(n){let t=r.loadBuffer(4);if(!(0,l.crc32c)(e.subarray(0,e.length-4)).equals(t))throw Error(`Invalid CRC32C`)}return{size:i,offBytes:a,cells:o,roots:s,absent:c,totalCellSize:u,index:f,cellData:p,root:d}}throw Error(`Invalid magic`)}e.parseBoc=m;function h(e){let i=m(e),a=new t.BitReader(new n.BitString(i.cellData,0,i.cellData.length*8)),o=[];for(let e=0;e<i.cells;e++){let e=f(a,i.size);o.push({...e,result:null})}for(let e=o.length-1;e>=0;e--){if(o[e].result)throw Error(`Impossible`);let t=[];for(let n of o[e].refs){if(!o[n].result)throw Error(`Invalid BOC file`);t.push(o[n].result)}o[e].result=new r.Cell({bits:o[e].bits,refs:t,exotic:o[e].exotic})}let s=[];for(let e=0;e<i.root.length;e++)s.push(o[i.root[e]].result);return s}e.deserializeBoc=h;function g(e,t,n,r){let i=(0,s.getRefsDescriptor)(e.refs,e.mask.value,e.type),a=(0,s.getBitsDescriptor)(e.bits);r.writeUint(i,8),r.writeUint(a,8),r.writeBuffer((0,c.bitsToPaddedBuffer)(e.bits));for(let e of t)r.writeUint(e,n*8)}function _(e,t){let n=(0,i.topologicalSort)(e),r=n.length,s=t.idx,c=t.crc32,u=Math.max(Math.ceil((0,a.bitsForNumber)(r,`uint`)/8),1),d=0,f=[];for(let e of n){let t=p(e.cell,u);d+=t,f.push(d)}let m=Math.max(Math.ceil((0,a.bitsForNumber)(d,`uint`)/8),1),h=(6+3*u+m+1*u+(s?r*m:0)+d+(c?4:0))*8,_=new o.BitBuilder(h);if(_.writeUint(3052313714,32),_.writeBit(s),_.writeBit(c),_.writeBit(!1),_.writeUint(0,2),_.writeUint(u,3),_.writeUint(m,8),_.writeUint(r,u*8),_.writeUint(1,u*8),_.writeUint(0,u*8),_.writeUint(d,m*8),_.writeUint(0,u*8),s)for(let e=0;e<r;e++)_.writeUint(f[e],m*8);for(let e=0;e<r;e++)g(n[e].cell,n[e].refs,u,_);if(c){let e=(0,l.crc32c)(_.buffer());_.writeBuffer(e)}let v=_.buffer();if(v.length!==h/8)throw Error(`Internal error`);return v}e.serializeBoc=_})),Nc=t((e=>{O();var t;Object.defineProperty(e,"__esModule",{value:!0}),e.Cell=void 0;var n=ec(),r=sc(),i=lc(),a=xc(),o=Ec(),s=Oc(),c=Mc(),l=dc(),u=Q(),d=class e{static fromBoc(e){return(0,c.deserializeBoc)(e)}static fromBase64(t){let n=e.fromBoc(k.from(t,`base64`));if(n.length!==1)throw Error(`Deserialized more than one cell`);return n[0]}static fromHex(t){let n=e.fromBoc(k.from(t,`hex`));if(n.length!==1)throw Error(`Deserialized more than one cell`);return n[0]}constructor(e){this._hashes=[],this._depths=[],this.beginParse=(e=!1)=>{if(this.isExotic&&!e)throw Error(`Exotic cells cannot be parsed`);return new a.Slice(new l.BitReader(this.bits),this.refs)},this.hash=(e=3)=>this._hashes[Math.min(this._hashes.length-1,e)],this.depth=(e=3)=>this._depths[Math.min(this._depths.length-1,e)],this.level=()=>this.mask.level,this.equals=e=>this.hash().equals(e.hash()),this[t]=()=>this.toString();let n=r.BitString.EMPTY;e&&e.bits&&(n=e.bits);let c=[];e&&e.refs&&(c=[...e.refs]);let u,d,f,p=i.CellType.Ordinary;if(e&&e.exotic){let e=(0,o.resolveExotic)(n,c),t=(0,s.wonderCalculator)(e.type,n,c);f=t.mask,d=t.depths,u=t.hashes,p=e.type}else{if(c.length>4)throw Error(`Invalid number of references`);if(n.length>1023)throw Error(`Bits overflow: ${n.length} > 1023`);let e=(0,s.wonderCalculator)(i.CellType.Ordinary,n,c);f=e.mask,d=e.depths,u=e.hashes,p=i.CellType.Ordinary}this.type=p,this.bits=n,this.refs=c,this.mask=f,this._depths=d,this._hashes=u,Object.freeze(this),Object.freeze(this.refs),Object.freeze(this.bits),Object.freeze(this.mask),Object.freeze(this._depths),Object.freeze(this._hashes)}get isExotic(){return this.type!==i.CellType.Ordinary}toBoc(e){let t=e&&e.idx!==null&&e.idx!==void 0?e.idx:!1,n=e&&e.crc32!==null&&e.crc32!==void 0?e.crc32:!0;return(0,c.serializeBoc)(this,{idx:t,crc32:n})}toString(e){let t=e||``,n=`x`;this.isExotic&&(this.type===i.CellType.MerkleProof?n=`p`:this.type===i.CellType.MerkleUpdate?n=`u`:this.type===i.CellType.PrunedBranch&&(n=`p`));let r=t+(this.isExotic?n:`x`)+`{`+this.bits.toString()+`}`;for(let e in this.refs){let n=this.refs[e];r+=`
5
- `+n.toString(t+` `)}return r}asSlice(){return this.beginParse()}asBuilder(){return(0,u.beginCell)().storeSlice(this.asSlice())}};e.Cell=d,t=n.inspectSymbol,d.EMPTY=new d})),Q=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Builder=e.beginCell=void 0;var t=cc(),n=Nc(),r=bc();function i(){return new a}e.beginCell=i;var a=class e{constructor(){this._bits=new t.BitBuilder,this._refs=[]}get bits(){return this._bits.length}get refs(){return this._refs.length}get availableBits(){return 1023-this.bits}get availableRefs(){return 4-this.refs}storeBit(e){return this._bits.writeBit(e),this}storeBits(e){return this._bits.writeBits(e),this}storeBuffer(e,t){if(t!=null&&e.length!==t)throw Error(`Buffer length ${e.length} is not equal to ${t}`);return this._bits.writeBuffer(e),this}storeMaybeBuffer(e,t){return e===null?this.storeBit(0):(this.storeBit(1),this.storeBuffer(e,t)),this}storeUint(e,t){return this._bits.writeUint(e,t),this}storeMaybeUint(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeUint(e,t)),this}storeInt(e,t){return this._bits.writeInt(e,t),this}storeMaybeInt(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeInt(e,t)),this}storeVarUint(e,t){return this._bits.writeVarUint(e,t),this}storeMaybeVarUint(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeVarUint(e,t)),this}storeVarInt(e,t){return this._bits.writeVarInt(e,t),this}storeMaybeVarInt(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeVarInt(e,t)),this}storeCoins(e){return this._bits.writeCoins(e),this}storeMaybeCoins(e){return e==null?this.storeBit(0):(this.storeBit(1),this.storeCoins(e)),this}storeAddress(e){return this._bits.writeAddress(e),this}storeRef(t){if(this._refs.length>=4)throw Error(`Too many references`);if(t instanceof n.Cell)this._refs.push(t);else if(t instanceof e)this._refs.push(t.endCell());else throw Error(`Invalid argument`);return this}storeMaybeRef(e){return e?(this.storeBit(1),this.storeRef(e)):this.storeBit(0),this}storeSlice(e){let t=e.clone();for(t.remainingBits>0&&this.storeBits(t.loadBits(t.remainingBits));t.remainingRefs>0;)this.storeRef(t.loadRef());return this}storeMaybeSlice(e){return e?(this.storeBit(1),this.storeSlice(e)):this.storeBit(0),this}storeBuilder(e){return this.storeSlice(e.endCell().beginParse())}storeMaybeBuilder(e){return e?(this.storeBit(1),this.storeBuilder(e)):this.storeBit(0),this}storeWritable(e){return typeof e==`object`?e.writeTo(this):e(this),this}storeMaybeWritable(e){return e?(this.storeBit(1),this.storeWritable(e)):this.storeBit(0),this}store(e){return this.storeWritable(e),this}storeStringTail(e){return(0,r.writeString)(e,this),this}storeMaybeStringTail(e){return e==null?this.storeBit(0):(this.storeBit(1),(0,r.writeString)(e,this)),this}storeStringRefTail(e){return this.storeRef(i().storeStringTail(e)),this}storeMaybeStringRefTail(e){return e==null?this.storeBit(0):(this.storeBit(1),this.storeStringRefTail(e)),this}storeDict(e,t,n){return e?e.store(this,t,n):this.storeBit(0),this}storeDictDirect(e,t,n){return e.storeDirect(this,t,n),this}endCell(e){return new n.Cell({bits:this._bits.build(),refs:this._refs,exotic:e?.exotic})}asCell(){return this.endCell()}asSlice(){return this.endCell().beginParse()}};e.Builder=a})),Pc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SimpleLibraryValue=e.storeSimpleLibrary=e.loadSimpleLibrary=void 0;function t(e){return{public:e.loadBit(),root:e.loadRef()}}e.loadSimpleLibrary=t;function n(e){return t=>{t.storeBit(e.public),t.storeRef(e.root)}}e.storeSimpleLibrary=n,e.SimpleLibraryValue={serialize(e,t){n(e)(t)},parse(e){return t(e)}}})),Fc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTickTock=e.loadTickTock=void 0;function t(e){return{tick:e.loadBit(),tock:e.loadBit()}}e.loadTickTock=t;function n(e){return t=>{t.storeBit(e.tick),t.storeBit(e.tock)}}e.storeTickTock=n})),Ic=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeStateInit=e.loadStateInit=void 0;var t=yc(),n=Pc(),r=Fc();function i(e){let i;e.loadBit()&&(i=e.loadUint(5));let a;e.loadBit()&&(a=(0,r.loadTickTock)(e));let o=e.loadMaybeRef(),s=e.loadMaybeRef(),c=e.loadDict(t.Dictionary.Keys.BigUint(256),n.SimpleLibraryValue);return c.size===0&&(c=void 0),{splitDepth:i,special:a,code:o,data:s,libraries:c}}e.loadStateInit=i;function a(e){return t=>{e.splitDepth!==null&&e.splitDepth!==void 0?(t.storeBit(!0),t.storeUint(e.splitDepth,5)):t.storeBit(!1),e.special!==null&&e.special!==void 0?(t.storeBit(!0),t.store((0,r.storeTickTock)(e.special))):t.storeBit(!1),t.storeMaybeRef(e.code),t.storeMaybeRef(e.data),t.storeDict(e.libraries)}}e.storeStateInit=a})),Lc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contractAddress=void 0;var t=Q(),n=Ic(),r=nc();function i(e,i){let a=(0,t.beginCell)().store((0,n.storeStateInit)(i)).endCell().hash();return new r.Address(e,a)}e.contractAddress=i})),Rc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseTuple=e.serializeTuple=e.parseTupleItem=e.serializeTupleItem=void 0;var t=Q(),n=BigInt(`-9223372036854775808`),r=BigInt(`9223372036854775807`);function i(e,a){if(e.type===`null`)a.storeUint(0,8);else if(e.type===`int`)e.value<=r&&e.value>=n?(a.storeUint(1,8),a.storeInt(e.value,64)):(a.storeUint(256,15),a.storeInt(e.value,257));else if(e.type===`nan`)a.storeInt(767,16);else if(e.type===`cell`)a.storeUint(3,8),a.storeRef(e.cell);else if(e.type===`slice`)a.storeUint(4,8),a.storeUint(0,10),a.storeUint(e.cell.bits.length,10),a.storeUint(0,3),a.storeUint(e.cell.refs.length,3),a.storeRef(e.cell);else if(e.type===`builder`)a.storeUint(5,8),a.storeRef(e.cell);else if(e.type===`tuple`){let n=null,r=null;for(let a=0;a<e.items.length;a++){let o=n;n=r,r=o,a>1&&(n=(0,t.beginCell)().storeRef(r).storeRef(n).endCell());let s=(0,t.beginCell)();i(e.items[a],s),r=s.endCell()}a.storeUint(7,8),a.storeUint(e.items.length,16),n&&a.storeRef(n),r&&a.storeRef(r)}else throw Error(`Invalid value`)}e.serializeTupleItem=i;function a(e){let n=e.loadUint(8);if(n===0)return{type:`null`};if(n===1)return{type:`int`,value:e.loadIntBig(64)};if(n===2)return e.loadUint(7)===0?{type:`int`,value:e.loadIntBig(257)}:(e.loadBit(),{type:`nan`});if(n===3)return{type:`cell`,cell:e.loadRef()};if(n===4){let n=e.loadUint(10),r=e.loadUint(10),i=e.loadUint(3),a=e.loadUint(3),o=e.loadRef().beginParse();o.skip(n);let s=o.loadBits(r-n),c=(0,t.beginCell)().storeBits(s);if(i<a){for(let e=0;e<i;e++)o.loadRef();for(let e=0;e<a-i;e++)c.storeRef(o.loadRef())}return{type:`slice`,cell:c.endCell()}}if(n===5)return{type:`builder`,cell:e.loadRef()};if(n===7){let t=e.loadUint(16),n=[];if(t>1){let r=e.loadRef().beginParse(),i=e.loadRef().beginParse();n.unshift(a(i));for(let e=0;e<t-2;e++){let e=r;r=e.loadRef().beginParse(),i=e.loadRef().beginParse(),n.unshift(a(i))}n.unshift(a(r))}else t===1&&n.push(a(e.loadRef().beginParse()));return{type:`tuple`,items:n}}throw Error(`Unsupported stack item`)}e.parseTupleItem=a;function o(e,n){if(e.length>0){let r=(0,t.beginCell)();o(e.slice(0,e.length-1),r),n.storeRef(r.endCell()),i(e[e.length-1],n)}}function s(e){let n=(0,t.beginCell)();return n.storeUint(e.length,24),o([...e],n),n.endCell()}e.serializeTuple=s;function c(e){let t=[],n=e.beginParse(),r=n.loadUint(24);for(let e=0;e<r;e++){let e=n.loadRef();t.unshift(a(n)),n=e.beginParse()}return t}e.parseTuple=c})),zc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TupleReader=void 0,e.TupleReader=class e{constructor(e){this.items=[...e]}get remaining(){return this.items.length}peek(){if(this.items.length===0)throw Error(`EOF`);return this.items[0]}pop(){if(this.items.length===0)throw Error(`EOF`);let e=this.items[0];return this.items.splice(0,1),e}skip(e=1){for(let t=0;t<e;t++)this.pop();return this}readBigNumber(){let e=this.pop();if(e.type!==`int`)throw Error(`Not a number`);return e.value}readBigNumberOpt(){let e=this.pop();if(e.type===`null`)return null;if(e.type!==`int`)throw Error(`Not a number`);return e.value}readNumber(){return Number(this.readBigNumber())}readNumberOpt(){let e=this.readBigNumberOpt();return e===null?null:Number(e)}readBoolean(){return this.readNumber()!==0}readBooleanOpt(){let e=this.readNumberOpt();return e===null?null:e!==0}readAddress(){let e=this.readCell().beginParse().loadAddress();if(e!==null)return e;throw Error(`Not an address`)}readAddressOpt(){let e=this.readCellOpt();return e===null?null:e.beginParse().loadMaybeAddress()}readCell(){let e=this.pop();if(e.type!==`cell`&&e.type!==`slice`&&e.type!==`builder`)throw Error(`Not a cell: `+e.type);return e.cell}readCellOpt(){let e=this.pop();if(e.type===`null`)return null;if(e.type!==`cell`&&e.type!==`slice`&&e.type!==`builder`)throw Error(`Not a cell`);return e.cell}readTuple(){let t=this.pop();if(t.type!==`tuple`)throw Error(`Not a tuple`);return new e(t.items)}readTupleOpt(){let t=this.pop();if(t.type===`null`)return null;if(t.type!==`tuple`)throw Error(`Not a tuple`);return new e(t.items)}static readLispList(e){let t=[],n=e;for(;n!==null;){var r=n.pop();if(n.items.length===0||n.items[0].type!==`tuple`&&n.items[0].type!==`null`)throw Error(`Lisp list consists only from (any, tuple) elements and ends with null`);n=n.readTupleOpt(),t.push(r)}return t}readLispListDirect(){return this.items.length===1&&this.items[0].type===`null`?[]:e.readLispList(this)}readLispList(){return e.readLispList(this.readTupleOpt())}readBuffer(){let e=this.readCell().beginParse();if(e.remainingRefs!==0||e.remainingBits%8!=0)throw Error(`Not a buffer`);return e.loadBuffer(e.remainingBits/8)}readBufferOpt(){let e=this.readCellOpt();if(e!==null){let t=e.beginParse();if(t.remainingRefs!==0||t.remainingBits%8!=0)throw Error(`Not a buffer`);return t.loadBuffer(t.remainingBits/8)}return null}readString(){return this.readCell().beginParse().loadStringTail()}readStringOpt(){let e=this.readCellOpt();return e===null?null:e.beginParse().loadStringTail()}}})),Bc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TupleBuilder=void 0;var t=Q(),n=Nc(),r=xc();e.TupleBuilder=class{constructor(){this._tuple=[]}writeNumber(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`int`,value:BigInt(e)})}writeBoolean(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`int`,value:e?-1n:0n})}writeBuffer(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`slice`,cell:(0,t.beginCell)().storeBuffer(e).endCell()})}writeString(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`slice`,cell:(0,t.beginCell)().storeStringTail(e).endCell()})}writeCell(e){e==null?this._tuple.push({type:`null`}):e instanceof n.Cell?this._tuple.push({type:`cell`,cell:e}):e instanceof r.Slice&&this._tuple.push({type:`cell`,cell:e.asCell()})}writeSlice(e){e==null?this._tuple.push({type:`null`}):e instanceof n.Cell?this._tuple.push({type:`slice`,cell:e}):e instanceof r.Slice&&this._tuple.push({type:`slice`,cell:e.asCell()})}writeBuilder(e){e==null?this._tuple.push({type:`null`}):e instanceof n.Cell?this._tuple.push({type:`builder`,cell:e}):e instanceof r.Slice&&this._tuple.push({type:`builder`,cell:e.asCell()})}writeTuple(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`tuple`,items:e})}writeAddress(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`slice`,cell:(0,t.beginCell)().storeAddress(e).endCell()})}build(){return[...this._tuple]}}})),Vc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.fromNano=e.toNano=void 0;function t(e){if(typeof e==`bigint`)return e*1000000000n;{if(typeof e==`number`){if(!Number.isFinite(e))throw Error(`Invalid number`);if(Math.log10(e)<=6)e=e.toLocaleString(`en`,{minimumFractionDigits:9,useGrouping:!1});else if(e-Math.trunc(e)===0)e=e.toLocaleString(`en`,{maximumFractionDigits:0,useGrouping:!1});else throw Error(`Not enough precision for a number value. Use string value instead`)}let t=!1;for(;e.startsWith(`-`);)t=!t,e=e.slice(1);if(e===`.`)throw Error(`Invalid number`);let n=e.split(`.`);if(n.length>2)throw Error(`Invalid number`);let r=n[0],i=n[1];if(r||=`0`,i||=`0`,i.length>9)throw Error(`Invalid number`);for(;i.length<9;)i+=`0`;let a=BigInt(r)*1000000000n+BigInt(i);return t&&(a=-a),a}}e.toNano=t;function n(e){let t=BigInt(e),n=!1;t<0&&(n=!0,t=-t);let r=(t%1000000000n).toString();for(;r.length<9;)r=`0`+r;r=r.match(/^([0-9]*[1-9]|0)(0*)/)[1];let i=`${(t/1000000000n).toString()}${r===`0`?``:`.${r}`}`;return n&&(i=`-`+i),i}e.fromNano=n})),Hc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.packExtraCurrencyCell=e.packExtraCurrencyDict=e.storeExtraCurrency=e.loadMaybeExtraCurrency=e.loadExtraCurrency=void 0;var t=Q(),n=yc();function r(e){let t=e instanceof n.Dictionary?e:n.Dictionary.loadDirect(n.Dictionary.Keys.Uint(32),n.Dictionary.Values.BigVarUint(5),e),r={};for(let[e,n]of t)r[e]=n;return r}e.loadExtraCurrency=r;function i(e){let t=e.loadMaybeRef();return t===null?t:r(t)}e.loadMaybeExtraCurrency=i;function a(e){return t=>{t.storeDict(o(e))}}e.storeExtraCurrency=a;function o(e){let t=n.Dictionary.empty(n.Dictionary.Keys.Uint(32),n.Dictionary.Values.BigVarUint(5));return Object.entries(e).map(([e,n])=>t.set(Number(e),n)),t}e.packExtraCurrencyDict=o;function s(e){return(0,t.beginCell)().storeDictDirect(o(e)).endCell()}e.packExtraCurrencyCell=s})),Uc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.comment=e.external=e.internal=void 0;var t=nc(),n=Nc(),r=Q(),i=Vc(),a=Hc();function o(e){let o=!0;e.bounce!==null&&e.bounce!==void 0&&(o=e.bounce);let s;if(typeof e.to==`string`)s=t.Address.parse(e.to);else if(t.Address.isAddress(e.to))s=e.to;else throw Error(`Invalid address ${e.to}`);let c;c=typeof e.value==`string`?(0,i.toNano)(e.value):e.value;let l;e.extracurrency&&(l=(0,a.packExtraCurrencyDict)(e.extracurrency));let u=n.Cell.EMPTY;return typeof e.body==`string`?u=(0,r.beginCell)().storeUint(0,32).storeStringTail(e.body).endCell():e.body&&(u=e.body),{info:{type:`internal`,dest:s,value:{coins:c,other:l},bounce:o,ihrDisabled:!0,bounced:!1,ihrFee:0n,forwardFee:0n,createdAt:0,createdLt:0n},init:e.init??void 0,body:u}}e.internal=o;function s(e){let r;if(typeof e.to==`string`)r=t.Address.parse(e.to);else if(t.Address.isAddress(e.to))r=e.to;else throw Error(`Invalid address ${e.to}`);return{info:{type:`external-in`,dest:r,importFee:0n},init:e.init??void 0,body:e.body||n.Cell.EMPTY}}e.external=s;function c(e){return(0,r.beginCell)().storeUint(0,32).storeStringTail(e).endCell()}e.comment=c})),Wc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccountState=e.loadAccountState=void 0;var t=Ic();function n(e){return e.loadBit()?{type:`active`,state:(0,t.loadStateInit)(e)}:e.loadBit()?{type:`frozen`,stateHash:e.loadUintBig(256)}:{type:`uninit`}}e.loadAccountState=n;function r(e){return n=>{e.type===`active`?(n.storeBit(!0),n.store((0,t.storeStateInit)(e.state))):e.type===`frozen`?(n.storeBit(!1),n.storeBit(!0),n.storeUint(e.stateHash,256)):e.type===`uninit`&&(n.storeBit(!1),n.storeBit(!1))}}e.storeAccountState=r})),Gc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeCurrencyCollection=e.loadCurrencyCollection=void 0;var t=yc();function n(e){let n=e.loadCoins(),r=e.loadDict(t.Dictionary.Keys.Uint(32),t.Dictionary.Values.BigVarUint(5));return r.size===0?{coins:n}:{other:r,coins:n}}e.loadCurrencyCollection=n;function r(e){return t=>{t.storeCoins(e.coins),e.other?t.storeDict(e.other):t.storeBit(0)}}e.storeCurrencyCollection=r})),Kc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccountStorage=e.loadAccountStorage=void 0;var t=Wc(),n=Gc();function r(e){return{lastTransLt:e.loadUintBig(64),balance:(0,n.loadCurrencyCollection)(e),state:(0,t.loadAccountState)(e)}}e.loadAccountStorage=r;function i(e){return r=>{r.storeUint(e.lastTransLt,64),r.store((0,n.storeCurrencyCollection)(e.balance)),r.store((0,t.storeAccountState)(e.state))}}e.storeAccountStorage=i})),qc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeStorageExtraInfo=e.loadStorageExtraInfo=void 0;function t(e){let t=e.loadUint(3);if(t===0)return null;if(t===1)return{dictHash:e.loadUintBig(256)};throw Error(`Invalid storage extra info header: ${t}`)}e.loadStorageExtraInfo=t;function n(e){return t=>{e==null?t.storeUint(0,3):(t.storeUint(1,3),t.storeUint(e.dictHash,256))}}e.storeStorageExtraInfo=n})),Jc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeStorageUsed=e.loadStorageUsed=void 0;function t(e){return{cells:e.loadVarUintBig(3),bits:e.loadVarUintBig(3)}}e.loadStorageUsed=t;function n(e){return t=>{t.storeVarUint(e.cells,3),t.storeVarUint(e.bits,3)}}e.storeStorageUsed=n})),Yc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeStorageInfo=e.loadStorageInfo=void 0;var t=qc(),n=Jc();function r(e){return{used:(0,n.loadStorageUsed)(e),storageExtra:(0,t.loadStorageExtraInfo)(e),lastPaid:e.loadUint(32),duePayment:e.loadMaybeCoins()}}e.loadStorageInfo=r;function i(e){return r=>{r.store((0,n.storeStorageUsed)(e.used)),r.store((0,t.storeStorageExtraInfo)(e.storageExtra)),r.storeUint(e.lastPaid,32),r.storeMaybeCoins(e.duePayment)}}e.storeStorageInfo=i})),Xc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccount=e.loadAccount=void 0;var t=Kc(),n=Yc();function r(e){return{addr:e.loadAddress(),storageStats:(0,n.loadStorageInfo)(e),storage:(0,t.loadAccountStorage)(e)}}e.loadAccount=r;function i(e){return r=>{r.storeAddress(e.addr),r.store((0,n.storeStorageInfo)(e.storageStats)),r.store((0,t.storeAccountStorage)(e.storage))}}e.storeAccount=i})),Zc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccountStatus=e.loadAccountStatus=void 0;function t(e){let t=e.loadUint(2);if(t===0)return`uninitialized`;if(t===1)return`frozen`;if(t===2)return`active`;if(t===3)return`non-existing`;throw Error(`Invalid data`)}e.loadAccountStatus=t;function n(e){return t=>{if(e===`uninitialized`)t.storeUint(0,2);else if(e===`frozen`)t.storeUint(1,2);else if(e===`active`)t.storeUint(2,2);else if(e===`non-existing`)t.storeUint(3,2);else throw Error(`Invalid data`);return t}}e.storeAccountStatus=n})),Qc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccountStatusChange=e.loadAccountStatusChange=void 0;function t(e){return e.loadBit()?e.loadBit()?`deleted`:`frozen`:`unchanged`}e.loadAccountStatusChange=t;function n(e){return t=>{if(e==`unchanged`)t.storeBit(0);else if(e===`frozen`)t.storeBit(1),t.storeBit(0);else if(e===`deleted`)t.storeBit(1),t.storeBit(1);else throw Error(`Invalid account status change`)}}e.storeAccountStatusChange=n})),$c=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeCommonMessageInfoRelaxed=e.loadCommonMessageInfoRelaxed=void 0;var t=Gc();function n(e){if(!e.loadBit())return{type:`internal`,ihrDisabled:e.loadBit(),bounce:e.loadBit(),bounced:e.loadBit(),src:e.loadMaybeAddress(),dest:e.loadAddress(),value:(0,t.loadCurrencyCollection)(e),ihrFee:e.loadCoins(),forwardFee:e.loadCoins(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)};if(!e.loadBit())throw Error(`External In message is not possible for CommonMessageInfoRelaxed`);return{type:`external-out`,src:e.loadMaybeAddress(),dest:e.loadMaybeExternalAddress(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)}}e.loadCommonMessageInfoRelaxed=n;function r(e){return n=>{if(e.type===`internal`)n.storeBit(0),n.storeBit(e.ihrDisabled),n.storeBit(e.bounce),n.storeBit(e.bounced),n.storeAddress(e.src),n.storeAddress(e.dest),n.store((0,t.storeCurrencyCollection)(e.value)),n.storeCoins(e.ihrFee),n.storeCoins(e.forwardFee),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else if(e.type===`external-out`)n.storeBit(1),n.storeBit(1),n.storeAddress(e.src),n.storeAddress(e.dest),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else throw Error(`Unknown CommonMessageInfo type`)}}e.storeCommonMessageInfoRelaxed=r})),el=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeMessageRelaxed=e.loadMessageRelaxed=void 0;var t=Q(),n=$c(),r=Ic();function i(e){let t=(0,n.loadCommonMessageInfoRelaxed)(e),i=null;e.loadBit()&&(i=e.loadBit()?(0,r.loadStateInit)(e.loadRef().beginParse()):(0,r.loadStateInit)(e));let a=e.loadBit()?e.loadRef():e.asCell();return{info:t,init:i,body:a}}e.loadMessageRelaxed=i;function a(e,i){return a=>{if(a.store((0,n.storeCommonMessageInfoRelaxed)(e.info)),e.init){a.storeBit(!0);let n=(0,t.beginCell)().store((0,r.storeStateInit)(e.init)),o=!1;o=i&&i.forceRef?!0:!(a.availableBits-2>=n.bits),o?(a.storeBit(!0),a.storeRef(n)):(a.storeBit(!1),a.storeBuilder(n))}else a.storeBit(!1);let o=!1;o=i&&i.forceRef?!0:!(a.availableBits-1>=e.body.bits.length&&a.refs+e.body.refs.length<=4&&!e.body.isExotic),o?(a.storeBit(!0),a.storeRef(e.body)):(a.storeBit(!1),a.storeBuilder(e.body.asBuilder()))}}e.storeMessageRelaxed=a})),tl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeLibRef=e.loadLibRef=void 0;function t(e){return e.loadUint(1)===0?{type:`hash`,libHash:e.loadBuffer(32)}:{type:`ref`,library:e.loadRef()}}e.loadLibRef=t;function n(e){return t=>{e.type===`hash`?(t.storeUint(0,1),t.storeBuffer(e.libHash)):(t.storeUint(1,1),t.storeRef(e.library))}}e.storeLibRef=n})),nl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.loadOutList=e.storeOutList=e.loadOutAction=e.storeOutAction=void 0;var t=el(),n=Q(),r=Gc(),i=tl();function a(e){switch(e.type){case`sendMsg`:return s(e);case`setCode`:return l(e);case`reserve`:return d(e);case`changeLibrary`:return p(e);default:throw Error(`Unknown action type ${e.type}`)}}e.storeOutAction=a;var o=247711853;function s(e){return r=>{r.storeUint(o,32).storeUint(e.mode,8).storeRef((0,n.beginCell)().store((0,t.storeMessageRelaxed)(e.outMsg)).endCell())}}var c=2907562126;function l(e){return t=>{t.storeUint(c,32).storeRef(e.newCode)}}var u=921090057;function d(e){return t=>{t.storeUint(u,32).storeUint(e.mode,8).store((0,r.storeCurrencyCollection)(e.currency))}}var f=653925844;function p(e){return t=>{t.storeUint(f,32).storeUint(e.mode,7).store((0,i.storeLibRef)(e.libRef))}}function m(e){let n=e.loadUint(32);if(n===o)return{type:`sendMsg`,mode:e.loadUint(8),outMsg:(0,t.loadMessageRelaxed)(e.loadRef().beginParse())};if(n===c)return{type:`setCode`,newCode:e.loadRef()};if(n===u)return{type:`reserve`,mode:e.loadUint(8),currency:(0,r.loadCurrencyCollection)(e)};if(n===f)return{type:`changeLibrary`,mode:e.loadUint(7),libRef:(0,i.loadLibRef)(e)};throw Error(`Unknown out action tag 0x${n.toString(16)}`)}e.loadOutAction=m;function h(e){let t=e.reduce((e,t)=>(0,n.beginCell)().storeRef(e).store(a(t)).endCell(),(0,n.beginCell)().endCell());return e=>{e.storeSlice(t.beginParse())}}e.storeOutList=h;function g(e){let t=[];for(;e.remainingRefs;){let n=e.loadRef();t.push(m(e)),e=n.beginParse()}return t.reverse()}e.loadOutList=g})),rl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeCommonMessageInfo=e.loadCommonMessageInfo=void 0;var t=Gc();function n(e){return e.loadBit()?e.loadBit()?{type:`external-out`,src:e.loadAddress(),dest:e.loadMaybeExternalAddress(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)}:{type:`external-in`,src:e.loadMaybeExternalAddress(),dest:e.loadAddress(),importFee:e.loadCoins()}:{type:`internal`,ihrDisabled:e.loadBit(),bounce:e.loadBit(),bounced:e.loadBit(),src:e.loadAddress(),dest:e.loadAddress(),value:(0,t.loadCurrencyCollection)(e),ihrFee:e.loadCoins(),forwardFee:e.loadCoins(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)}}e.loadCommonMessageInfo=n;function r(e){return n=>{if(e.type===`internal`)n.storeBit(0),n.storeBit(e.ihrDisabled),n.storeBit(e.bounce),n.storeBit(e.bounced),n.storeAddress(e.src),n.storeAddress(e.dest),n.store((0,t.storeCurrencyCollection)(e.value)),n.storeCoins(e.ihrFee),n.storeCoins(e.forwardFee),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else if(e.type===`external-in`)n.storeBit(1),n.storeBit(0),n.storeAddress(e.src),n.storeAddress(e.dest),n.storeCoins(e.importFee);else if(e.type===`external-out`)n.storeBit(1),n.storeBit(1),n.storeAddress(e.src),n.storeAddress(e.dest),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else throw Error(`Unknown CommonMessageInfo type`)}}e.storeCommonMessageInfo=r})),il=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeComputeSkipReason=e.loadComputeSkipReason=void 0;function t(e){let t=e.loadUint(2);if(t===0)return`no-state`;if(t===1)return`bad-state`;if(t===2)return`no-gas`;throw Error(`Unknown ComputeSkipReason: ${t}`)}e.loadComputeSkipReason=t;function n(e){return t=>{if(e===`no-state`)t.storeUint(0,2);else if(e===`bad-state`)t.storeUint(1,2);else if(e===`no-gas`)t.storeUint(2,2);else throw Error(`Unknown ComputeSkipReason: ${e}`)}}e.storeComputeSkipReason=n})),al=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeDepthBalanceInfo=e.loadDepthBalanceInfo=void 0;var t=Gc();function n(e){return{splitDepth:e.loadUint(5),balance:(0,t.loadCurrencyCollection)(e)}}e.loadDepthBalanceInfo=n;function r(e){return n=>{n.storeUint(e.splitDepth,5),n.store((0,t.storeCurrencyCollection)(e.balance))}}e.storeDepthBalanceInfo=r})),ol=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeHashUpdate=e.loadHashUpdate=void 0;function t(e){if(e.loadUint(8)!==114)throw Error(`Invalid data`);return{oldHash:e.loadBuffer(32),newHash:e.loadBuffer(32)}}e.loadHashUpdate=t;function n(e){return t=>{t.storeUint(114,8),t.storeBuffer(e.oldHash),t.storeBuffer(e.newHash)}}e.storeHashUpdate=n})),sl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.loadMasterchainStateExtra=void 0;var t=yc(),n=Gc();function r(e){if(e.loadUint(16)!==52262)throw Error(`Invalid data`);e.loadBit()&&e.loadRef();let r=e.loadUintBig(256);return{config:t.Dictionary.load(t.Dictionary.Keys.Int(32),t.Dictionary.Values.Cell(),e),configAddress:r,globalBalance:(0,n.loadCurrencyCollection)(e)}}e.loadMasterchainStateExtra=r})),cl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MessageValue=e.storeMessage=e.loadMessage=void 0;var t=Q(),n=rl(),r=Ic();function i(e){let t=(0,n.loadCommonMessageInfo)(e),i=null;e.loadBit()&&(i=e.loadBit()?(0,r.loadStateInit)(e.loadRef().beginParse()):(0,r.loadStateInit)(e));let a=e.loadBit()?e.loadRef():e.asCell();return{info:t,init:i,body:a}}e.loadMessage=i;function a(e,i){return a=>{if(a.store((0,n.storeCommonMessageInfo)(e.info)),e.init){a.storeBit(!0);let n=(0,t.beginCell)().store((0,r.storeStateInit)(e.init)),o=!1;o=i&&i.forceRef?!0:a.availableBits-2<n.bits+e.body.bits.length,o?(a.storeBit(!0),a.storeRef(n)):(a.storeBit(!1),a.storeBuilder(n))}else a.storeBit(!1);let o=!1;o=i&&i.forceRef?!0:a.availableBits-1<e.body.bits.length||a.refs+e.body.refs.length>4,o?(a.storeBit(!0),a.storeRef(e.body)):(a.storeBit(!1),a.storeBuilder(e.body.asBuilder()))}}e.storeMessage=a,e.MessageValue={serialize(e,n){n.storeRef((0,t.beginCell)().store(a(e)))},parse(e){return i(e.loadRef().beginParse())}}})),ll=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SendMode=void 0;var t;(function(e){e[e.CARRY_ALL_REMAINING_BALANCE=128]=`CARRY_ALL_REMAINING_BALANCE`,e[e.CARRY_ALL_REMAINING_INCOMING_VALUE=64]=`CARRY_ALL_REMAINING_INCOMING_VALUE`,e[e.DESTROY_ACCOUNT_IF_ZERO=32]=`DESTROY_ACCOUNT_IF_ZERO`,e[e.PAY_GAS_SEPARATELY=1]=`PAY_GAS_SEPARATELY`,e[e.IGNORE_ERRORS=2]=`IGNORE_ERRORS`,e[e.NONE=0]=`NONE`})(t||(e.SendMode=t={}))})),ul=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReserveMode=void 0;var t;(function(e){e[e.THIS_AMOUNT=0]=`THIS_AMOUNT`,e[e.LEAVE_THIS_AMOUNT=1]=`LEAVE_THIS_AMOUNT`,e[e.AT_MOST_THIS_AMOUNT=2]=`AT_MOST_THIS_AMOUNT`,e[e.LEAVE_MAX_THIS_AMOUNT=3]=`LEAVE_MAX_THIS_AMOUNT`,e[e.BEFORE_BALANCE_PLUS_THIS_AMOUNT=4]=`BEFORE_BALANCE_PLUS_THIS_AMOUNT`,e[e.LEAVE_BBALANCE_PLUS_THIS_AMOUNT=5]=`LEAVE_BBALANCE_PLUS_THIS_AMOUNT`,e[e.BEFORE_BALANCE_MINUS_THIS_AMOUNT=12]=`BEFORE_BALANCE_MINUS_THIS_AMOUNT`,e[e.LEAVE_BEFORE_BALANCE_MINUS_THIS_AMOUNT=13]=`LEAVE_BEFORE_BALANCE_MINUS_THIS_AMOUNT`})(t||(e.ReserveMode=t={}))})),dl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeShardAccount=e.loadShardAccount=void 0;var t=Q(),n=Xc();function r(e){let t=e.loadRef(),r;if(!t.isExotic){let e=t.beginParse();e.loadBit()&&(r=(0,n.loadAccount)(e))}return{account:r,lastTransactionHash:e.loadUintBig(256),lastTransactionLt:e.loadUintBig(64)}}e.loadShardAccount=r;function i(e){return r=>{e.account?r.storeRef((0,t.beginCell)().storeBit(!0).store((0,n.storeAccount)(e.account))):r.storeRef((0,t.beginCell)().storeBit(!1)),r.storeUint(e.lastTransactionHash,256),r.storeUint(e.lastTransactionLt,64)}}e.storeShardAccount=i})),fl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeShardAccounts=e.loadShardAccounts=e.ShardAccountRefValue=void 0;var t=yc(),n=al(),r=dl();e.ShardAccountRefValue={parse:e=>({depthBalanceInfo:(0,n.loadDepthBalanceInfo)(e),shardAccount:(0,r.loadShardAccount)(e)}),serialize(e,t){t.store((0,n.storeDepthBalanceInfo)(e.depthBalanceInfo)),t.store((0,r.storeShardAccount)(e.shardAccount))}};function i(n){return t.Dictionary.load(t.Dictionary.Keys.BigUint(256),e.ShardAccountRefValue,n)}e.loadShardAccounts=i;function a(e){return t=>{t.storeDict(e)}}e.storeShardAccounts=a})),pl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeShardIdent=e.loadShardIdent=void 0;function t(e){if(e.loadUint(2)!==0)throw Error(`Invalid data`);return{shardPrefixBits:e.loadUint(6),workchainId:e.loadInt(32),shardPrefix:e.loadUintBig(64)}}e.loadShardIdent=t;function n(e){return t=>{t.storeUint(0,2),t.storeUint(e.shardPrefixBits,6),t.storeInt(e.workchainId,32),t.storeUint(e.shardPrefix,64)}}e.storeShardIdent=n})),ml=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.loadShardStateUnsplit=void 0;var t=sl(),n=fl(),r=pl();function i(e){if(e.loadUint(32)!==2418257890)throw Error(`Invalid data`);let i=e.loadInt(32),a=(0,r.loadShardIdent)(e),o=e.loadUint(32),s=e.loadUint(32),c=e.loadUint(32),l=e.loadUintBig(64),u=e.loadUint(32);e.loadRef();let d=e.loadBit(),f=e.loadRef(),p;f.isExotic||(p=(0,n.loadShardAccounts)(f.beginParse())),e.loadRef();let m=e.loadBit(),h=null;if(m){let n=e.loadRef();n.isExotic||(h=(0,t.loadMasterchainStateExtra)(n.beginParse()))}return{globalId:i,shardId:a,seqno:o,vertSeqNo:s,genUtime:c,genLt:l,minRefMcSeqno:u,beforeSplit:d,accounts:p,extras:h}}e.loadShardStateUnsplit=i})),hl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeSplitMergeInfo=e.loadSplitMergeInfo=void 0;function t(e){return{currentShardPrefixLength:e.loadUint(6),accountSplitDepth:e.loadUint(6),thisAddress:e.loadUintBig(256),siblingAddress:e.loadUintBig(256)}}e.loadSplitMergeInfo=t;function n(e){return t=>{t.storeUint(e.currentShardPrefixLength,6),t.storeUint(e.accountSplitDepth,6),t.storeUint(e.thisAddress,256),t.storeUint(e.siblingAddress,256)}}e.storeSplitMergeInfo=n})),gl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionActionPhase=e.loadTransactionActionPhase=void 0;var t=Qc(),n=Jc();function r(e){return{success:e.loadBit(),valid:e.loadBit(),noFunds:e.loadBit(),statusChange:(0,t.loadAccountStatusChange)(e),totalFwdFees:e.loadBit()?e.loadCoins():void 0,totalActionFees:e.loadBit()?e.loadCoins():void 0,resultCode:e.loadInt(32),resultArg:e.loadBit()?e.loadInt(32):void 0,totalActions:e.loadUint(16),specActions:e.loadUint(16),skippedActions:e.loadUint(16),messagesCreated:e.loadUint(16),actionListHash:e.loadUintBig(256),totalMessageSize:(0,n.loadStorageUsed)(e)}}e.loadTransactionActionPhase=r;function i(e){return r=>{r.storeBit(e.success),r.storeBit(e.valid),r.storeBit(e.noFunds),r.store((0,t.storeAccountStatusChange)(e.statusChange)),r.storeMaybeCoins(e.totalFwdFees),r.storeMaybeCoins(e.totalActionFees),r.storeInt(e.resultCode,32),r.storeMaybeInt(e.resultArg,32),r.storeUint(e.totalActions,16),r.storeUint(e.specActions,16),r.storeUint(e.skippedActions,16),r.storeUint(e.messagesCreated,16),r.storeUint(e.actionListHash,256),r.store((0,n.storeStorageUsed)(e.totalMessageSize))}}e.storeTransactionActionPhase=i})),_l=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionBouncePhase=e.loadTransactionBouncePhase=void 0;var t=Jc();function n(e){return e.loadBit()?{type:`ok`,messageSize:(0,t.loadStorageUsed)(e),messageFees:e.loadCoins(),forwardFees:e.loadCoins()}:e.loadBit()?{type:`no-funds`,messageSize:(0,t.loadStorageUsed)(e),requiredForwardFees:e.loadCoins()}:{type:`negative-funds`}}e.loadTransactionBouncePhase=n;function r(e){return n=>{if(e.type===`ok`)n.storeBit(!0),n.store((0,t.storeStorageUsed)(e.messageSize)),n.storeCoins(e.messageFees),n.storeCoins(e.forwardFees);else if(e.type===`negative-funds`)n.storeBit(!1),n.storeBit(!1);else if(e.type===`no-funds`)n.storeBit(!1),n.storeBit(!0),n.store((0,t.storeStorageUsed)(e.messageSize)),n.storeCoins(e.requiredForwardFees);else throw Error(`Invalid TransactionBouncePhase type`)}}e.storeTransactionBouncePhase=r})),vl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionComputePhase=e.loadTransactionComputePhase=void 0;var t=Q(),n=il();function r(e){if(!e.loadBit())return{type:`skipped`,reason:(0,n.loadComputeSkipReason)(e)};let t=e.loadBit(),r=e.loadBit(),i=e.loadBit(),a=e.loadCoins(),o=e.loadRef().beginParse();return{type:`vm`,success:t,messageStateUsed:r,accountActivated:i,gasFees:a,gasUsed:o.loadVarUintBig(3),gasLimit:o.loadVarUintBig(3),gasCredit:o.loadBit()?o.loadVarUintBig(2):void 0,mode:o.loadUint(8),exitCode:o.loadInt(32),exitArg:o.loadBit()?o.loadInt(32):void 0,vmSteps:o.loadUint(32),vmInitStateHash:o.loadUintBig(256),vmFinalStateHash:o.loadUintBig(256)}}e.loadTransactionComputePhase=r;function i(e){return r=>{if(e.type===`skipped`){r.storeBit(0),r.store((0,n.storeComputeSkipReason)(e.reason));return}r.storeBit(1),r.storeBit(e.success),r.storeBit(e.messageStateUsed),r.storeBit(e.accountActivated),r.storeCoins(e.gasFees),r.storeRef((0,t.beginCell)().storeVarUint(e.gasUsed,3).storeVarUint(e.gasLimit,3).store(t=>e.gasCredit!==void 0&&e.gasCredit!==null?t.storeBit(1).storeVarUint(e.gasCredit,2):t.storeBit(0)).storeUint(e.mode,8).storeInt(e.exitCode,32).store(t=>e.exitArg!==void 0&&e.exitArg!==null?t.storeBit(1).storeInt(e.exitArg,32):t.storeBit(0)).storeUint(e.vmSteps,32).storeUint(e.vmInitStateHash,256).storeUint(e.vmFinalStateHash,256).endCell())}}e.storeTransactionComputePhase=i})),yl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionCreditPhase=e.loadTransactionCreditPhase=void 0;var t=Gc();function n(e){return{dueFeesColelcted:e.loadBit()?e.loadCoins():void 0,credit:(0,t.loadCurrencyCollection)(e)}}e.loadTransactionCreditPhase=n;function r(e){return n=>{e.dueFeesColelcted===null||e.dueFeesColelcted===void 0?n.storeBit(!1):(n.storeBit(!0),n.storeCoins(e.dueFeesColelcted)),n.store((0,t.storeCurrencyCollection)(e.credit))}}e.storeTransactionCreditPhase=r})),bl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionsStoragePhase=e.loadTransactionStoragePhase=void 0;var t=Qc();function n(e){let n=e.loadCoins(),r;e.loadBit()&&(r=e.loadCoins());let i=(0,t.loadAccountStatusChange)(e);return{storageFeesCollected:n,storageFeesDue:r,statusChange:i}}e.loadTransactionStoragePhase=n;function r(e){return n=>{n.storeCoins(e.storageFeesCollected),e.storageFeesDue===null||e.storageFeesDue===void 0?n.storeBit(!1):(n.storeBit(!0),n.storeCoins(e.storageFeesDue)),n.store((0,t.storeAccountStatusChange)(e.statusChange))}}e.storeTransactionsStoragePhase=r})),xl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionDescription=e.loadTransactionDescription=void 0;var t=Q(),n=hl(),r=Sl(),i=gl(),a=_l(),o=vl(),s=yl(),c=bl();function l(e){let t=e.loadUint(4);if(t===0){let t=e.loadBit(),n;e.loadBit()&&(n=(0,c.loadTransactionStoragePhase)(e));let r;e.loadBit()&&(r=(0,s.loadTransactionCreditPhase)(e));let l=(0,o.loadTransactionComputePhase)(e),u;e.loadBit()&&(u=(0,i.loadTransactionActionPhase)(e.loadRef().beginParse()));let d=e.loadBit(),f;e.loadBit()&&(f=(0,a.loadTransactionBouncePhase)(e));let p=e.loadBit();return{type:`generic`,creditFirst:t,storagePhase:n,creditPhase:r,computePhase:l,actionPhase:u,bouncePhase:f,aborted:d,destroyed:p}}if(t===1)return{type:`storage`,storagePhase:(0,c.loadTransactionStoragePhase)(e)};if(t===2||t===3){let n=t===3,r=(0,c.loadTransactionStoragePhase)(e),a=(0,o.loadTransactionComputePhase)(e),s;e.loadBit()&&(s=(0,i.loadTransactionActionPhase)(e.loadRef().beginParse()));let l=e.loadBit(),u=e.loadBit();return{type:`tick-tock`,isTock:n,storagePhase:r,computePhase:a,actionPhase:s,aborted:l,destroyed:u}}if(t===4){let t=(0,n.loadSplitMergeInfo)(e),r;e.loadBit()&&(r=(0,c.loadTransactionStoragePhase)(e));let a=(0,o.loadTransactionComputePhase)(e),s;e.loadBit()&&(s=(0,i.loadTransactionActionPhase)(e.loadRef().beginParse()));let l=e.loadBit(),u=e.loadBit();return{type:`split-prepare`,splitInfo:t,storagePhase:r,computePhase:a,actionPhase:s,aborted:l,destroyed:u}}if(t===5)return{type:`split-install`,splitInfo:(0,n.loadSplitMergeInfo)(e),prepareTransaction:(0,r.loadTransaction)(e.loadRef().beginParse()),installed:e.loadBit()};throw Error(`Unsupported transaction description type ${t}`)}e.loadTransactionDescription=l;function u(e){return l=>{if(e.type===`generic`)l.storeUint(0,4),l.storeBit(e.creditFirst),e.storagePhase?(l.storeBit(!0),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase))):l.storeBit(!1),e.creditPhase?(l.storeBit(!0),l.store((0,s.storeTransactionCreditPhase)(e.creditPhase))):l.storeBit(!1),l.store((0,o.storeTransactionComputePhase)(e.computePhase)),e.actionPhase?(l.storeBit(!0),l.storeRef((0,t.beginCell)().store((0,i.storeTransactionActionPhase)(e.actionPhase)))):l.storeBit(!1),l.storeBit(e.aborted),e.bouncePhase?(l.storeBit(!0),l.store((0,a.storeTransactionBouncePhase)(e.bouncePhase))):l.storeBit(!1),l.storeBit(e.destroyed);else if(e.type===`storage`)l.storeUint(1,4),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase));else if(e.type===`tick-tock`)l.storeUint(e.isTock?3:2,4),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase)),l.store((0,o.storeTransactionComputePhase)(e.computePhase)),e.actionPhase?(l.storeBit(!0),l.storeRef((0,t.beginCell)().store((0,i.storeTransactionActionPhase)(e.actionPhase)))):l.storeBit(!1),l.storeBit(e.aborted),l.storeBit(e.destroyed);else if(e.type===`split-prepare`)l.storeUint(4,4),l.store((0,n.storeSplitMergeInfo)(e.splitInfo)),e.storagePhase?(l.storeBit(!0),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase))):l.storeBit(!1),l.store((0,o.storeTransactionComputePhase)(e.computePhase)),e.actionPhase?(l.storeBit(!0),l.store((0,i.storeTransactionActionPhase)(e.actionPhase))):l.storeBit(!1),l.storeBit(e.aborted),l.storeBit(e.destroyed);else if(e.type===`split-install`)l.storeUint(5,4),l.store((0,n.storeSplitMergeInfo)(e.splitInfo)),l.storeRef((0,t.beginCell)().store((0,r.storeTransaction)(e.prepareTransaction))),l.storeBit(e.installed);else throw Error(`Unsupported transaction description type ${e.type}`)}}e.storeTransactionDescription=u})),Sl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransaction=e.loadTransaction=void 0;var t=Q(),n=yc(),r=Zc(),i=Gc(),a=ol(),o=cl(),s=xl();function c(e){let t=e.asCell();if(e.loadUint(4)!==7)throw Error(`Invalid data`);let c=e.loadUintBig(256),l=e.loadUintBig(64),u=e.loadUintBig(256),d=e.loadUintBig(64),f=e.loadUint(32),p=e.loadUint(15),m=(0,r.loadAccountStatus)(e),h=(0,r.loadAccountStatus)(e),g=e.loadRef().beginParse(),_=g.loadBit()?(0,o.loadMessage)(g.loadRef().beginParse()):void 0,v=g.loadDict(n.Dictionary.Keys.Uint(15),o.MessageValue);return g.endParse(),{address:c,lt:l,prevTransactionHash:u,prevTransactionLt:d,now:f,outMessagesCount:p,oldStatus:m,endStatus:h,inMessage:_,outMessages:v,totalFees:(0,i.loadCurrencyCollection)(e),stateUpdate:(0,a.loadHashUpdate)(e.loadRef().beginParse()),description:(0,s.loadTransactionDescription)(e.loadRef().beginParse()),raw:t,hash:()=>t.hash()}}e.loadTransaction=c;function l(e){return n=>{n.storeUint(7,4),n.storeUint(e.address,256),n.storeUint(e.lt,64),n.storeUint(e.prevTransactionHash,256),n.storeUint(e.prevTransactionLt,64),n.storeUint(e.now,32),n.storeUint(e.outMessagesCount,15),n.store((0,r.storeAccountStatus)(e.oldStatus)),n.store((0,r.storeAccountStatus)(e.endStatus));let c=(0,t.beginCell)();e.inMessage?(c.storeBit(!0),c.storeRef((0,t.beginCell)().store((0,o.storeMessage)(e.inMessage)))):c.storeBit(!1),c.storeDict(e.outMessages),n.storeRef(c),n.store((0,i.storeCurrencyCollection)(e.totalFees)),n.storeRef((0,t.beginCell)().store((0,a.storeHashUpdate)(e.stateUpdate))),n.storeRef((0,t.beginCell)().store((0,s.storeTransactionDescription)(e.description)))}}e.storeTransaction=l})),Cl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.loadSimpleLibrary=e.loadShardStateUnsplit=e.storeShardIdent=e.loadShardIdent=e.storeShardAccounts=e.loadShardAccounts=e.ShardAccountRefValue=e.storeShardAccount=e.loadShardAccount=e.ReserveMode=e.SendMode=e.storeMessageRelaxed=e.loadMessageRelaxed=e.storeMessage=e.loadMessage=e.loadMasterchainStateExtra=e.storeHashUpdate=e.loadHashUpdate=e.storeExtraCurrency=e.loadMaybeExtraCurrency=e.loadExtraCurrency=e.packExtraCurrencyDict=e.packExtraCurrencyCell=e.storeDepthBalanceInfo=e.loadDepthBalanceInfo=e.storeCurrencyCollection=e.loadCurrencyCollection=e.storeComputeSkipReason=e.loadComputeSkipReason=e.storeCommonMessageInfoRelaxed=e.loadCommonMessageInfoRelaxed=e.storeCommonMessageInfo=e.loadCommonMessageInfo=e.storeOutList=e.loadOutList=e.storeOutAction=e.loadOutAction=e.storeAccountStorage=e.loadAccountStorage=e.storeAccountStatusChange=e.loadAccountStatusChange=e.storeAccountStatus=e.loadAccountStatus=e.storeAccountState=e.loadAccountState=e.storeAccount=e.loadAccount=e.comment=e.external=e.internal=void 0,e.storeTransactionsStoragePhase=e.loadTransactionStoragePhase=e.storeTransactionDescription=e.loadTransactionDescription=e.storeTransactionCreditPhase=e.loadTransactionCreditPhase=e.storeTransactionComputePhase=e.loadTransactionComputePhase=e.storeTransactionBouncePhase=e.loadTransactionBouncePhase=e.storeTransactionActionPhase=e.loadTransactionActionPhase=e.storeTransaction=e.loadTransaction=e.storeTickTock=e.loadTickTock=e.storeStorageUsed=e.loadStorageUsed=e.storeStorageInfo=e.loadStorageInfo=e.storeStateInit=e.loadStateInit=e.storeSplitMergeInfo=e.loadSplitMergeInfo=e.storeLibRef=e.loadLibRef=e.storeSimpleLibrary=void 0;var t=Uc();Object.defineProperty(e,"internal",{enumerable:!0,get:function(){return t.internal}}),Object.defineProperty(e,"external",{enumerable:!0,get:function(){return t.external}}),Object.defineProperty(e,"comment",{enumerable:!0,get:function(){return t.comment}});var n=Xc();Object.defineProperty(e,"loadAccount",{enumerable:!0,get:function(){return n.loadAccount}}),Object.defineProperty(e,"storeAccount",{enumerable:!0,get:function(){return n.storeAccount}});var r=Wc();Object.defineProperty(e,"loadAccountState",{enumerable:!0,get:function(){return r.loadAccountState}}),Object.defineProperty(e,"storeAccountState",{enumerable:!0,get:function(){return r.storeAccountState}});var i=Zc();Object.defineProperty(e,"loadAccountStatus",{enumerable:!0,get:function(){return i.loadAccountStatus}}),Object.defineProperty(e,"storeAccountStatus",{enumerable:!0,get:function(){return i.storeAccountStatus}});var a=Qc();Object.defineProperty(e,"loadAccountStatusChange",{enumerable:!0,get:function(){return a.loadAccountStatusChange}}),Object.defineProperty(e,"storeAccountStatusChange",{enumerable:!0,get:function(){return a.storeAccountStatusChange}});var o=Kc();Object.defineProperty(e,"loadAccountStorage",{enumerable:!0,get:function(){return o.loadAccountStorage}}),Object.defineProperty(e,"storeAccountStorage",{enumerable:!0,get:function(){return o.storeAccountStorage}});var s=nl();Object.defineProperty(e,"loadOutAction",{enumerable:!0,get:function(){return s.loadOutAction}}),Object.defineProperty(e,"storeOutAction",{enumerable:!0,get:function(){return s.storeOutAction}}),Object.defineProperty(e,"loadOutList",{enumerable:!0,get:function(){return s.loadOutList}}),Object.defineProperty(e,"storeOutList",{enumerable:!0,get:function(){return s.storeOutList}});var c=rl();Object.defineProperty(e,"loadCommonMessageInfo",{enumerable:!0,get:function(){return c.loadCommonMessageInfo}}),Object.defineProperty(e,"storeCommonMessageInfo",{enumerable:!0,get:function(){return c.storeCommonMessageInfo}});var l=$c();Object.defineProperty(e,"loadCommonMessageInfoRelaxed",{enumerable:!0,get:function(){return l.loadCommonMessageInfoRelaxed}}),Object.defineProperty(e,"storeCommonMessageInfoRelaxed",{enumerable:!0,get:function(){return l.storeCommonMessageInfoRelaxed}});var u=il();Object.defineProperty(e,"loadComputeSkipReason",{enumerable:!0,get:function(){return u.loadComputeSkipReason}}),Object.defineProperty(e,"storeComputeSkipReason",{enumerable:!0,get:function(){return u.storeComputeSkipReason}});var d=Gc();Object.defineProperty(e,"loadCurrencyCollection",{enumerable:!0,get:function(){return d.loadCurrencyCollection}}),Object.defineProperty(e,"storeCurrencyCollection",{enumerable:!0,get:function(){return d.storeCurrencyCollection}});var f=al();Object.defineProperty(e,"loadDepthBalanceInfo",{enumerable:!0,get:function(){return f.loadDepthBalanceInfo}}),Object.defineProperty(e,"storeDepthBalanceInfo",{enumerable:!0,get:function(){return f.storeDepthBalanceInfo}});var p=Hc();Object.defineProperty(e,"packExtraCurrencyCell",{enumerable:!0,get:function(){return p.packExtraCurrencyCell}}),Object.defineProperty(e,"packExtraCurrencyDict",{enumerable:!0,get:function(){return p.packExtraCurrencyDict}}),Object.defineProperty(e,"loadExtraCurrency",{enumerable:!0,get:function(){return p.loadExtraCurrency}}),Object.defineProperty(e,"loadMaybeExtraCurrency",{enumerable:!0,get:function(){return p.loadMaybeExtraCurrency}}),Object.defineProperty(e,"storeExtraCurrency",{enumerable:!0,get:function(){return p.storeExtraCurrency}});var m=ol();Object.defineProperty(e,"loadHashUpdate",{enumerable:!0,get:function(){return m.loadHashUpdate}}),Object.defineProperty(e,"storeHashUpdate",{enumerable:!0,get:function(){return m.storeHashUpdate}});var h=sl();Object.defineProperty(e,"loadMasterchainStateExtra",{enumerable:!0,get:function(){return h.loadMasterchainStateExtra}});var g=cl();Object.defineProperty(e,"loadMessage",{enumerable:!0,get:function(){return g.loadMessage}}),Object.defineProperty(e,"storeMessage",{enumerable:!0,get:function(){return g.storeMessage}});var _=el();Object.defineProperty(e,"loadMessageRelaxed",{enumerable:!0,get:function(){return _.loadMessageRelaxed}}),Object.defineProperty(e,"storeMessageRelaxed",{enumerable:!0,get:function(){return _.storeMessageRelaxed}});var v=ll();Object.defineProperty(e,"SendMode",{enumerable:!0,get:function(){return v.SendMode}});var y=ul();Object.defineProperty(e,"ReserveMode",{enumerable:!0,get:function(){return y.ReserveMode}});var b=dl();Object.defineProperty(e,"loadShardAccount",{enumerable:!0,get:function(){return b.loadShardAccount}}),Object.defineProperty(e,"storeShardAccount",{enumerable:!0,get:function(){return b.storeShardAccount}});var x=fl();Object.defineProperty(e,"ShardAccountRefValue",{enumerable:!0,get:function(){return x.ShardAccountRefValue}}),Object.defineProperty(e,"loadShardAccounts",{enumerable:!0,get:function(){return x.loadShardAccounts}}),Object.defineProperty(e,"storeShardAccounts",{enumerable:!0,get:function(){return x.storeShardAccounts}});var S=pl();Object.defineProperty(e,"loadShardIdent",{enumerable:!0,get:function(){return S.loadShardIdent}}),Object.defineProperty(e,"storeShardIdent",{enumerable:!0,get:function(){return S.storeShardIdent}});var C=ml();Object.defineProperty(e,"loadShardStateUnsplit",{enumerable:!0,get:function(){return C.loadShardStateUnsplit}});var ee=Pc();Object.defineProperty(e,"loadSimpleLibrary",{enumerable:!0,get:function(){return ee.loadSimpleLibrary}}),Object.defineProperty(e,"storeSimpleLibrary",{enumerable:!0,get:function(){return ee.storeSimpleLibrary}});var w=tl();Object.defineProperty(e,"loadLibRef",{enumerable:!0,get:function(){return w.loadLibRef}}),Object.defineProperty(e,"storeLibRef",{enumerable:!0,get:function(){return w.storeLibRef}});var te=hl();Object.defineProperty(e,"loadSplitMergeInfo",{enumerable:!0,get:function(){return te.loadSplitMergeInfo}}),Object.defineProperty(e,"storeSplitMergeInfo",{enumerable:!0,get:function(){return te.storeSplitMergeInfo}});var T=Ic();Object.defineProperty(e,"loadStateInit",{enumerable:!0,get:function(){return T.loadStateInit}}),Object.defineProperty(e,"storeStateInit",{enumerable:!0,get:function(){return T.storeStateInit}});var E=Yc();Object.defineProperty(e,"loadStorageInfo",{enumerable:!0,get:function(){return E.loadStorageInfo}}),Object.defineProperty(e,"storeStorageInfo",{enumerable:!0,get:function(){return E.storeStorageInfo}});var D=Jc();Object.defineProperty(e,"loadStorageUsed",{enumerable:!0,get:function(){return D.loadStorageUsed}}),Object.defineProperty(e,"storeStorageUsed",{enumerable:!0,get:function(){return D.storeStorageUsed}});var ne=Fc();Object.defineProperty(e,"loadTickTock",{enumerable:!0,get:function(){return ne.loadTickTock}}),Object.defineProperty(e,"storeTickTock",{enumerable:!0,get:function(){return ne.storeTickTock}});var re=Sl();Object.defineProperty(e,"loadTransaction",{enumerable:!0,get:function(){return re.loadTransaction}}),Object.defineProperty(e,"storeTransaction",{enumerable:!0,get:function(){return re.storeTransaction}});var ie=gl();Object.defineProperty(e,"loadTransactionActionPhase",{enumerable:!0,get:function(){return ie.loadTransactionActionPhase}}),Object.defineProperty(e,"storeTransactionActionPhase",{enumerable:!0,get:function(){return ie.storeTransactionActionPhase}});var ae=_l();Object.defineProperty(e,"loadTransactionBouncePhase",{enumerable:!0,get:function(){return ae.loadTransactionBouncePhase}}),Object.defineProperty(e,"storeTransactionBouncePhase",{enumerable:!0,get:function(){return ae.storeTransactionBouncePhase}});var oe=vl();Object.defineProperty(e,"loadTransactionComputePhase",{enumerable:!0,get:function(){return oe.loadTransactionComputePhase}}),Object.defineProperty(e,"storeTransactionComputePhase",{enumerable:!0,get:function(){return oe.storeTransactionComputePhase}});var se=yl();Object.defineProperty(e,"loadTransactionCreditPhase",{enumerable:!0,get:function(){return se.loadTransactionCreditPhase}}),Object.defineProperty(e,"storeTransactionCreditPhase",{enumerable:!0,get:function(){return se.storeTransactionCreditPhase}});var ce=xl();Object.defineProperty(e,"loadTransactionDescription",{enumerable:!0,get:function(){return ce.loadTransactionDescription}}),Object.defineProperty(e,"storeTransactionDescription",{enumerable:!0,get:function(){return ce.storeTransactionDescription}});var le=bl();Object.defineProperty(e,"loadTransactionStoragePhase",{enumerable:!0,get:function(){return le.loadTransactionStoragePhase}}),Object.defineProperty(e,"storeTransactionsStoragePhase",{enumerable:!0,get:function(){return le.storeTransactionsStoragePhase}})})),wl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.openContract=void 0;var t=nc(),n=Nc();function r(e,r){let i,a=null;if(!t.Address.isAddress(e.address))throw Error(`Invalid address`);if(i=e.address,e.init){if(!(e.init.code instanceof n.Cell))throw Error(`Invalid init.code`);if(!(e.init.data instanceof n.Cell))throw Error(`Invalid init.data`);a=e.init}let o=r({address:i,init:a});return new Proxy(e,{get(e,t){let n=e[t];return typeof t==`string`&&(t.startsWith(`get`)||t.startsWith(`send`)||t.startsWith(`is`))&&typeof n==`function`?(...t)=>n.apply(e,[o,...t]):n}})}e.openContract=r})),Tl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ComputeError=void 0,e.ComputeError=class e extends Error{constructor(t,n,r){super(t),this.exitCode=n,this.debugLogs=r&&r.debugLogs?r.debugLogs:null,this.logs=r&&r.logs?r.logs:null,Object.setPrototypeOf(this,e.prototype)}}})),El=t((e=>{O(),Object.defineProperty(e,"__esModule",{value:!0}),e.getMethodId=void 0;var t=new Int16Array([0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920]);function n(e){e instanceof k||(e=k.from(e));let n=0;for(let r=0;r<e.length;r++){let i=e[r];n=(t[(n>>8^i)&255]^n<<8)&65535}return n}function r(e){return n(e)&65535|65536}e.getMethodId=r})),Dl=t((e=>{O(),Object.defineProperty(e,"__esModule",{value:!0}),e.safeSignVerify=e.safeSign=void 0;var t=xe(),n=8,r=64;function i(e,i){let a=k.from(i);if(a.length>r)throw Error(`Seed can be longer than 64 bytes`);if(a.length<n)throw Error(`Seed must be at least 8 bytes`);return(0,t.sha256_sync)(k.concat([k.from([255,255]),a,e.hash()]))}function a(e,n,r=`ton-safe-sign-magic`){return(0,t.sign)(i(e,r),n)}e.safeSign=a;function o(e,n,r,a=`ton-safe-sign-magic`){return(0,t.signVerify)(i(e,a),n,r)}e.safeSignVerify=o})),Ol=t((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.safeSignVerify=e.safeSign=e.getMethodId=e.base32Encode=e.base32Decode=e.crc32c=e.crc16=e.fromNano=e.toNano=e.ComputeError=e.openContract=e.TupleBuilder=e.TupleReader=e.serializeTupleItem=e.parseTupleItem=e.serializeTuple=e.parseTuple=e.generateMerkleUpdate=e.generateMerkleProofDirect=e.generateMerkleProof=e.exoticPruned=e.exoticMerkleUpdate=e.convertToMerkleProof=e.exoticMerkleProof=e.Dictionary=e.Cell=e.CellType=e.Slice=e.beginCell=e.Builder=e.BitBuilder=e.BitReader=e.BitString=e.contractAddress=e.ADNLAddress=e.ExternalAddress=e.address=e.Address=void 0;var r=nc();Object.defineProperty(e,"Address",{enumerable:!0,get:function(){return r.Address}}),Object.defineProperty(e,"address",{enumerable:!0,get:function(){return r.address}});var i=rc();Object.defineProperty(e,"ExternalAddress",{enumerable:!0,get:function(){return i.ExternalAddress}});var a=ac();Object.defineProperty(e,"ADNLAddress",{enumerable:!0,get:function(){return a.ADNLAddress}});var o=Lc();Object.defineProperty(e,"contractAddress",{enumerable:!0,get:function(){return o.contractAddress}});var s=sc();Object.defineProperty(e,"BitString",{enumerable:!0,get:function(){return s.BitString}});var c=dc();Object.defineProperty(e,"BitReader",{enumerable:!0,get:function(){return c.BitReader}});var l=cc();Object.defineProperty(e,"BitBuilder",{enumerable:!0,get:function(){return l.BitBuilder}});var u=Q();Object.defineProperty(e,"Builder",{enumerable:!0,get:function(){return u.Builder}}),Object.defineProperty(e,"beginCell",{enumerable:!0,get:function(){return u.beginCell}});var d=xc();Object.defineProperty(e,"Slice",{enumerable:!0,get:function(){return d.Slice}});var f=lc();Object.defineProperty(e,"CellType",{enumerable:!0,get:function(){return f.CellType}});var p=Nc();Object.defineProperty(e,"Cell",{enumerable:!0,get:function(){return p.Cell}});var m=yc();Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return m.Dictionary}});var h=fc();Object.defineProperty(e,"exoticMerkleProof",{enumerable:!0,get:function(){return h.exoticMerkleProof}}),Object.defineProperty(e,"convertToMerkleProof",{enumerable:!0,get:function(){return h.convertToMerkleProof}});var g=Cc();Object.defineProperty(e,"exoticMerkleUpdate",{enumerable:!0,get:function(){return g.exoticMerkleUpdate}});var _=Tc();Object.defineProperty(e,"exoticPruned",{enumerable:!0,get:function(){return _.exoticPruned}});var v=pc();Object.defineProperty(e,"generateMerkleProof",{enumerable:!0,get:function(){return v.generateMerkleProof}}),Object.defineProperty(e,"generateMerkleProofDirect",{enumerable:!0,get:function(){return v.generateMerkleProofDirect}});var y=mc();Object.defineProperty(e,"generateMerkleUpdate",{enumerable:!0,get:function(){return y.generateMerkleUpdate}});var b=Rc();Object.defineProperty(e,"parseTuple",{enumerable:!0,get:function(){return b.parseTuple}}),Object.defineProperty(e,"serializeTuple",{enumerable:!0,get:function(){return b.serializeTuple}}),Object.defineProperty(e,"parseTupleItem",{enumerable:!0,get:function(){return b.parseTupleItem}}),Object.defineProperty(e,"serializeTupleItem",{enumerable:!0,get:function(){return b.serializeTupleItem}});var x=zc();Object.defineProperty(e,"TupleReader",{enumerable:!0,get:function(){return x.TupleReader}});var S=Bc();Object.defineProperty(e,"TupleBuilder",{enumerable:!0,get:function(){return S.TupleBuilder}}),n(Cl(),e);var C=wl();Object.defineProperty(e,"openContract",{enumerable:!0,get:function(){return C.openContract}});var ee=Tl();Object.defineProperty(e,"ComputeError",{enumerable:!0,get:function(){return ee.ComputeError}});var w=Vc();Object.defineProperty(e,"toNano",{enumerable:!0,get:function(){return w.toNano}}),Object.defineProperty(e,"fromNano",{enumerable:!0,get:function(){return w.fromNano}});var te=tc();Object.defineProperty(e,"crc16",{enumerable:!0,get:function(){return te.crc16}});var T=jc();Object.defineProperty(e,"crc32c",{enumerable:!0,get:function(){return T.crc32c}});var E=ic();Object.defineProperty(e,"base32Decode",{enumerable:!0,get:function(){return E.base32Decode}}),Object.defineProperty(e,"base32Encode",{enumerable:!0,get:function(){return E.base32Encode}});var D=El();Object.defineProperty(e,"getMethodId",{enumerable:!0,get:function(){return D.getMethodId}});var ne=Dl();Object.defineProperty(e,"safeSign",{enumerable:!0,get:function(){return ne.safeSign}}),Object.defineProperty(e,"safeSignVerify",{enumerable:!0,get:function(){return ne.safeSignVerify}})}));O();var $=Ol(),kl=({amount:e,recipient:t,family:n,fees:r,comment:i,payload:a})=>({amount:e.toString(),recipient:t,family:n,fees:r.toString(),comment:i,payload:a?Nl(a):void 0}),Al=({amount:e,recipient:t,family:n,fees:r,comment:i,payload:a})=>({amount:new I(e),recipient:t,family:n,fees:new I(r),comment:i,payload:a?Ml(a):void 0}),jl=e=>{try{return $.Cell.fromBase64(e)}catch{return k.from(e,`hex`)}},Ml=e=>{switch(e.type){case`unsafe`:return{type:e.type,message:$.Cell.fromBase64(e.message)};case`jetton-transfer`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,amount:BigInt(e.amount),destination:$.Address.parse(e.destination),responseDestination:$.Address.parse(e.responseDestination),customPayload:e.customPayload?$.Cell.fromBase64(e.customPayload):null,forwardAmount:BigInt(e.forwardAmount),forwardPayload:e.forwardPayload?$.Cell.fromBase64(e.forwardPayload):null,knownJetton:e.knownJetton};case`nft-transfer`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,newOwner:$.Address.parse(e.newOwner),responseDestination:$.Address.parse(e.responseDestination),customPayload:e.customPayload?$.Cell.fromBase64(e.customPayload):null,forwardAmount:BigInt(e.forwardAmount),forwardPayload:e.forwardPayload?$.Cell.fromBase64(e.forwardPayload):null};case`jetton-burn`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,amount:BigInt(e.amount),responseDestination:$.Address.parse(e.responseDestination),customPayload:e.customPayload?jl(e.customPayload):null};case`add-whitelist`:case`single-nominator-change-validator`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,address:$.Address.parse(e.address)};case`single-nominator-withdraw`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,amount:BigInt(e.amount)};case`tonstakers-deposit`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,appId:e.appId?BigInt(e.appId):null};case`vote-for-proposal`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,votingAddress:$.Address.parse(e.votingAddress),expirationDate:e.expirationDate,vote:e.vote,needConfirmation:e.needConfirmation};case`change-dns-record`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,record:e.record.type===`wallet`?{type:e.record.type,value:e.record.value?{address:$.Address.parse(e.record.value.address),capabilities:e.record.value.capabilities}:null}:{type:e.record.type,key:k.from(e.record.key,`hex`),value:e.record.value?$.Cell.fromBase64(e.record.value):null}};case`token-bridge-pay-swap`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,swapId:k.from(e.swapId,`hex`)};case`tonwhales-pool-deposit`:return{type:e.type,queryId:BigInt(e.queryId),gasLimit:BigInt(e.gasLimit)};case`tonwhales-pool-withdraw`:return{type:e.type,queryId:BigInt(e.queryId),gasLimit:BigInt(e.gasLimit),amount:BigInt(e.amount)};case`vesting-send-msg-comment`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,sendMode:e.sendMode,value:BigInt(e.value),destination:$.Address.parse(e.destination),text:e.text};case`comment`:return e;default:return e}},Nl=e=>{switch(e.type){case`unsafe`:return{type:e.type,message:e.message.toBoc().toString(`base64`)};case`jetton-transfer`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,amount:e.amount.toString(),destination:e.destination.toRawString(),responseDestination:e.responseDestination.toRawString(),customPayload:e.customPayload?e.customPayload.toBoc().toString(`base64`):null,forwardAmount:e.forwardAmount.toString(),forwardPayload:e.forwardPayload?e.forwardPayload.toBoc().toString(`base64`):null,knownJetton:e.knownJetton};case`nft-transfer`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,newOwner:e.newOwner.toRawString(),responseDestination:e.responseDestination.toRawString(),customPayload:e.customPayload?e.customPayload.toBoc().toString(`base64`):null,forwardAmount:e.forwardAmount.toString(),forwardPayload:e.forwardPayload?e.forwardPayload.toBoc().toString(`base64`):null};case`jetton-burn`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,amount:e.amount.toString(),responseDestination:e.responseDestination.toRawString(),customPayload:e.customPayload&&`toBoc`in e.customPayload?e.customPayload.toBoc().toString(`base64`):e.customPayload?e.customPayload.toString(`hex`):null};case`add-whitelist`:case`single-nominator-change-validator`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,address:e.address.toRawString()};case`single-nominator-withdraw`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,amount:e.amount.toString()};case`tonstakers-deposit`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,appId:typeof e.appId==`bigint`?e.appId.toString():null};case`vote-for-proposal`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,votingAddress:e.votingAddress.toRawString(),expirationDate:e.expirationDate,vote:e.vote,needConfirmation:e.needConfirmation};case`change-dns-record`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,record:e.record.type===`wallet`?{type:e.record.type,value:e.record.value?{address:e.record.value.address.toRawString(),capabilities:e.record.value.capabilities}:null}:{type:e.record.type,key:e.record.key.toString(`hex`),value:e.record.value?e.record.value.toBoc().toString(`base64`):null}};case`token-bridge-pay-swap`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,swapId:e.swapId.toString(`hex`)};case`tonwhales-pool-deposit`:return{type:e.type,queryId:e.queryId.toString(),gasLimit:e.gasLimit.toString()};case`tonwhales-pool-withdraw`:return{type:e.type,queryId:e.queryId.toString(),gasLimit:e.gasLimit.toString(),amount:e.amount.toString()};case`vesting-send-msg-comment`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,sendMode:e.sendMode,value:e.value.toString(),destination:e.destination.toRawString(),text:e.text};case`comment`:return e;default:return e}},Pl=({amount:e,recipient:t,family:n,mode:r,resource:i,duration:a,votes:o})=>({amount:e.toString(),recipient:t,family:n,mode:r,resource:i,duration:a,votes:o}),Fl=({amount:e,recipient:t,family:n,mode:r,resource:i,duration:a,votes:o})=>({amount:new I(e),recipient:t,family:n,mode:r,resource:i,duration:a,votes:o});function Il({amount:e,data:t,family:n,fees:r,gasLimit:i,mode:a,recipient:o}){return{family:n,amount:e.toString(),recipient:o,mode:a,fees:r?r.toString():void 0,data:t,gasLimit:i}}function Ll({amount:e,data:t,family:n,fees:r,gasLimit:i,mode:a,recipient:o}){return{family:n,mode:a,amount:new I(e),recipient:o,fees:r?new I(r):void 0,data:t,gasLimit:i}}function Rl({amount:e,family:t,fees:n,memo:r,mode:i,recipient:a}){return{amount:e.toString(),family:t,fees:n?n.toString():void 0,memo:r,mode:i,recipient:a}}function zl({amount:e,family:t,fees:n,memo:r,mode:i,recipient:a}){return{amount:new I(e),family:t,fees:n?new I(n):void 0,memo:r,mode:i,recipient:a}}function Bl({amount:e,family:t,model:n,recipient:r,raw:i}){return{amount:e.toString(),family:t,model:JSON.stringify(n),recipient:r,raw:i}}function Vl({family:e,amount:t,model:n,recipient:r,raw:i}){return{amount:new I(t),family:e,model:JSON.parse(n),recipient:r,raw:i}}var Hl=({amount:e,recipient:t,family:n,estimatedFees:r,body:i})=>({amount:e.toString(),recipient:t,family:n,estimatedFees:r,body:i}),Ul=({amount:e,recipient:t,family:n,estimatedFees:r,body:i})=>({amount:new I(e),recipient:t,family:n,estimatedFees:r,body:i}),Wl=({amount:e,recipient:t,family:n,fee:r,nonce:i,memo:a,network:o,anchorMode:s})=>({amount:e.toString(),recipient:t,family:n,fee:r?.toString(),nonce:i?.toString(),memo:a,network:o,anchorMode:s}),Gl=({amount:e,recipient:t,family:n,fee:r,nonce:i,memo:a,network:o,anchorMode:s})=>({amount:new I(e),recipient:t,family:n,fee:r?new I(r):void 0,nonce:i?new I(i):void 0,memo:a,network:o===`mainnet`?o:`testnet`,anchorMode:s}),Kl=({amount:e,recipient:t,family:n,fees:r,memo:i})=>({amount:e.toFixed(),recipient:t,family:n,fees:r.toString(),memo:i}),ql=({amount:e,recipient:t,family:n,fees:r,memo:i})=>({amount:new I(e),recipient:t,family:n,fees:new I(r),memo:i}),Jl=({amount:e,recipient:t,family:n,fees:r,transferId:i})=>({amount:e.toFixed(),recipient:t,family:n,fees:r.toString(),transferId:i}),Yl=({amount:e,recipient:t,family:n,fees:r,transferId:i})=>({amount:new I(e),recipient:t,family:n,fees:new I(r),transferId:i});function Xl({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:e.toString(),recipient:t,family:n,mode:r,fees:i?.toString()}}function Zl({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:new I(e),recipient:t,family:n,mode:r,fees:i?new I(i):void 0}}function Ql({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:e.toString(),recipient:t,family:n,mode:r,fees:i.toString()}}function $l({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:new I(e),recipient:t,family:n,mode:r,fees:new I(i)}}function eu(e){switch(e.family){case`ethereum`:return Ps(e);case`bitcoin`:return Es(e);case`algorand`:return Ss(e);case`aptos`:return ws(e);case`crypto_org`:return Ms(e);case`ripple`:return Js(e);case`celo`:return Os(e);case`cosmos`:return As(e);case`hedera`:return Rs(e);case`kaspa`:return Bs(e);case`filecoin`:return Hs(e);case`tezos`:return Qs(e);case`polkadot`:return Ks(e);case`stellar`:return Xs(e);case`ton`:return kl(e);case`tron`:return Pl(e);case`near`:return Is(e);case`neo`:return Ws(e);case`elrond`:return Il(e);case`cardano`:return Rl(e);case`solana`:return Bl(e);case`vechain`:return Hl(e);case`stacks`:return Wl(e);case`internet_computer`:return Kl(e);case`casper`:return Jl(e);case`sui`:return Xl(e);case`aleo`:return Ql(e);default:return e}}function tu(e){switch(e.family){case`ethereum`:return Fs(e);case`bitcoin`:return Ds(e);case`algorand`:return Cs(e);case`aptos`:return Ts(e);case`crypto_org`:return Ns(e);case`ripple`:return Ys(e);case`celo`:return ks(e);case`cosmos`:return js(e);case`hedera`:return zs(e);case`kaspa`:return Vs(e);case`filecoin`:return Us(e);case`tezos`:return $s(e);case`polkadot`:return qs(e);case`stellar`:return Zs(e);case`ton`:return Al(e);case`tron`:return Fl(e);case`near`:return Ls(e);case`neo`:return Gs(e);case`elrond`:return Ll(e);case`cardano`:return zl(e);case`solana`:return Vl(e);case`vechain`:return Ul(e);case`stacks`:return Gl(e);case`internet_computer`:return ql(e);case`casper`:return Yl(e);case`sui`:return Zl(e);case`aleo`:return $l(e);default:return e}}var nu=J([`send`,`optIn`,`claimReward`,`optOut`]),ru=X.extend({family:Y(Z.enum.algorand),mode:nu,fees:B().optional(),assetId:B().optional(),memo:B().optional()}),iu=J([`send`]),au=X.extend({family:Y(Z.enum.aptos),mode:iu,fees:B().optional()}),ou=X.extend({family:Y(Z.enum.bitcoin),feePerByte:B().optional(),opReturnDataHex:B().max(160).optional(),changeAddress:B().optional()}),su=J([`send`,`lock`,`unlock`,`withdraw`,`vote`,`revoke`,`activate`,`register`]),cu=X.extend({family:Y(Z.enum.celo),fees:B().optional().nullable(),mode:su,index:H().optional().nullable()}),lu=J([`send`,`delegate`,`undelegate`,`redelegate`,`claimReward`,`claimRewardCompound`]),uu=K({address:B(),amount:B()}),du=X.extend({family:Y(Z.enum.cosmos),mode:lu,fees:B().optional(),gas:B().optional(),memo:B().optional(),sourceValidator:B().optional(),validators:G(uu).optional()}),fu=X.extend({family:Y(Z.enum.crypto_org),mode:B(),fees:B().optional()}),pu=X.extend({family:Y(Z.enum.ethereum),nonce:H().optional(),data:B().optional(),gasPrice:B().optional(),gasLimit:B().optional(),maxPriorityFeePerGas:B().optional(),maxFeePerGas:B().optional(),sponsored:U().optional()}),mu=X.extend({family:Y(Z.enum.near),mode:B(),fees:B().optional()}),hu=X.extend({family:Y(Z.enum.neo)}),gu=J([`send`,`bond`,`unbond`,`rebond`,`withdrawUnbonded`,`setController`,`nominate`,`chill`,`claimReward`]),_u=J([`Staked`,`Stash`,`Controller`,`Account`,`None`]),vu=X.extend({family:Y(Z.enum.polkadot),mode:gu,fee:B().optional(),era:H().optional(),validators:G(B()).optional(),rewardDestination:_u.optional(),numOfSlashingSpans:H().optional()}),yu=X.extend({family:Y(Z.enum.ripple),fee:B().optional(),tag:H()}),bu=X.extend({family:Y(Z.enum.solana),model:B(),raw:Xo(B())}),xu=J([`MEMO_TEXT`,`MEMO_ID`,`MEMO_HASH`,`MEMO_RETURN`]),Su=X.extend({family:Y(Z.enum.stellar),fees:B().optional(),memoType:xu.optional(),memoValue:B().optional()}),Cu=J([`send`,`delegate`,`undelegate`]),wu=X.extend({family:Y(Z.enum.tezos),mode:Cu,fees:B().optional(),gasLimit:B().optional()}),Tu=K({isEncrypted:U(),text:B()}),Eu=K({type:Y(`jetton-transfer`),queryId:q([B(),W()]),amount:B(),destination:B(),responseDestination:B(),customPayload:q([B(),W()]),forwardAmount:B(),forwardPayload:q([B(),W()]),knownJetton:q([K({jettonId:H(),workchain:H()}),W()])}),Du=K({type:Y(`nft-transfer`),queryId:q([B(),W()]),newOwner:B(),responseDestination:B(),customPayload:q([B(),W()]),forwardAmount:B(),forwardPayload:q([B(),W()])}),Ou=q([K({type:Y(`comment`),text:B()}),Eu,Du,K({type:Y(`unsafe`),message:B()}),K({type:Y(`jetton-burn`),queryId:q([B(),W()]),amount:B(),responseDestination:B(),customPayload:q([B(),W()])}),K({type:Y(`add-whitelist`),queryId:q([B(),W()]),address:B()}),K({type:Y(`single-nominator-withdraw`),queryId:q([B(),W()]),amount:B()}),K({type:Y(`single-nominator-change-validator`),queryId:q([B(),W()]),address:B()}),K({type:Y(`tonstakers-deposit`),queryId:q([B(),W()]),appId:q([B(),W()])}),K({type:Y(`vote-for-proposal`),queryId:q([B(),W()]),votingAddress:B(),expirationDate:H(),vote:U(),needConfirmation:U()}),K({type:Y(`change-dns-record`),queryId:q([B(),W()]),record:q([K({type:Y(`wallet`),value:q([K({address:B(),capabilities:q([K({isWallet:U()}),W()])}),W()])}),K({type:Y(`unknown`),key:B(),value:q([B(),W()])})])}),K({type:Y(`token-bridge-pay-swap`),queryId:q([B(),W()]),swapId:B()}),K({type:Y(`tonwhales-pool-deposit`),queryId:B(),gasLimit:B()}),K({type:Y(`tonwhales-pool-withdraw`),queryId:B(),gasLimit:B(),amount:B()}),K({type:Y(`vesting-send-msg-comment`),queryId:q([B(),W()]),sendMode:H(),value:B(),destination:B(),text:B()})]),ku=X.extend({family:Y(Z.enum.ton),fees:B(),comment:Tu,payload:Ou.optional()}),Au=J([`send`,`freeze`,`unfreeze`,`vote`,`claimReward`,`withdrawExpireUnfreeze`,`unDelegateResource`,`legacyUnfreeze`]),ju=J([`BANDWIDTH`,`ENERGY`]),Mu=K({address:B(),voteCount:H()}),Nu=X.extend({family:Y(Z.enum.tron),mode:Au,resource:ju.optional(),duration:H().optional(),votes:G(Mu).default([])}),Pu=X.extend({family:Y(Z.enum.hedera),memo:B().max(100).optional()}),Fu=X.extend({family:Y(Z.enum.kaspa),customFeeRate:B().optional()}),Iu=X.extend({data:B().optional(),family:Y(Z.enum.filecoin),gasLimit:H(),gasFeeCap:B(),gasPremium:B(),method:H(),nonce:H(),params:B().optional(),version:H()});J([`send`,`delegate`,`reDelegateRewards`,`unDelegate`,`claimRewards`,`withdraw`]);var Lu=X.extend({family:Y(Z.enum.elrond),mode:q([Y(`send`),Y(`delegate`),Y(`reDelegateRewards`),Y(`unDelegate`),Y(`claimRewards`),Y(`withdraw`)]),fees:B().optional(),data:B().optional(),gasLimit:H()}),Ru=X.extend({family:Y(Z.enum.cardano),fees:B().optional(),mode:B(),memo:B().optional()}),zu=K({to:B().nullable(),value:q([B(),H()]),data:B(),comment:B().optional(),abi:B().optional()}),Bu=K({chainTag:H(),blockRef:B(),expiration:H(),clauses:G(zu),gasPriceCoef:H().optional(),gas:q([B(),H()]),dependsOn:B().nullable(),nonce:q([B(),H()]),maxFeePerGas:q([B(),H()]).optional(),maxPriorityFeePerGas:q([B(),H()]).optional(),reserved:K({features:H().optional(),unused:G(ko()).optional()}).optional()}),Vu=X.extend({family:Y(Z.enum.vechain),estimatedFees:B(),body:Bu}),Hu=X.extend({family:Y(Z.enum.stacks),fee:B().optional(),nonce:B().optional(),memo:B().optional(),network:B(),anchorMode:H()}),Uu=X.extend({family:Y(Z.enum.internet_computer),fees:B(),memo:B().optional()}),Wu=X.extend({family:Y(Z.enum.casper),fees:B(),transferId:B().optional()}),Gu=X.extend({family:Y(Z.enum.sui),mode:B(),fees:B().optional()}),Ku=J([`transfer_public`]),qu=Bo(`family`,[ru,au,ou,cu,du,fu,pu,Pu,Fu,Iu,mu,hu,vu,yu,Su,wu,ku,Nu,Lu,Ru,bu,Vu,Hu,Uu,Wu,Gu,X.extend({family:Y(Z.enum.aleo),mode:Ku,fees:B()})]),Ju=class{prefix=``;constructor(e){this.prefix=e?`[${e}] `:``}log(e,...t){}warn(e,...t){}debug(e,...t){}error(e,...t){}},Yu=new Ju(`WindowMessage`),Xu=class{target;logger;_onMessage;constructor(e=window,t=Yu){this.target=e,this.logger=t}connect=()=>{this.target.addEventListener(`message`,this._onMessageEvent,!1),this.target.document?.addEventListener(`message`,this._onMessageEvent,!1),this.logger.debug(`event listeners registered`)};disconnect=()=>{this.target.removeEventListener(`message`,this._onMessageEvent,!1),this.target.document?.removeEventListener(`message`,this._onMessageEvent,!1),this.logger.debug(`event listeners unregistered`)};_onMessageEvent=e=>{if(this._onMessage){if(this.logger.debug(`received message event`,e),e.data&&typeof e.data==`string`)try{let t=e.data;Date.now()>0?(this.logger.log(`received message`,t),this._onMessage(t)):this.logger.debug(`not a wallet API message`)}catch(e){this.logger.warn(`parse error`),e instanceof Error&&this._onMessage(e.message)}else this.logger.debug(`ignoring message same origin`)}else this.logger.debug(`no handler registered`)};set onMessage(e){this._onMessage=e}get onMessage(){return this._onMessage}send=e=>{try{this.target.ReactNativeWebView?(this.logger.log(`sending message (ReactNativeWebview)`,e),this.target.ReactNativeWebView.postMessage(e)):this.target.ElectronWebview?(this.logger.log(`sending message (ElectronWebview)`,e),this.target.ElectronWebview.postMessage(e)):(this.logger.log(`sending message`,e),this.target.top?.postMessage(e,`*`))}catch(e){throw this.logger.error(`unexpected error on send`,e),e}}},Zu;(function(e){e.Slow=`slow`,e.Medium=`medium`,e.Fast=`fast`})(Zu||={});var Qu;(function(e){e.Blue=`blue`,e.NanoS=`nanoS`,e.NanoX=`nanoX`})(Qu||={});var $u;(function(e){e[e.SWAP=0]=`SWAP`,e[e.SELL=1]=`SELL`,e[e.FUND=2]=`FUND`})($u||={});var ed=J([`NOT_IMPLEMENTED_BY_WALLET`,`ACCOUNT_NOT_FOUND`,`CURRENCY_NOT_FOUND`,`PERMISSION_DENIED`,`UNKNOWN_ERROR`,`UNAUTHORIZED_STORE`]),td=K({code:Y(ed.enum.NOT_IMPLEMENTED_BY_WALLET),message:B(),data:K({methodId:B()})}),nd=K({code:Y(ed.enum.ACCOUNT_NOT_FOUND),message:B(),data:K({accountId:B()})}),rd=K({code:Y(ed.enum.CURRENCY_NOT_FOUND),message:B(),data:K({currencyId:B()})}),id=K({code:Y(ed.enum.PERMISSION_DENIED),message:B(),data:K({methodId:B()})}),ad=K({name:B().optional(),message:B().optional(),stack:B().optional(),cause:jo().optional(),code:B().optional()}),od=Bo(`code`,[td,nd,rd,id,K({code:Y(ed.enum.UNKNOWN_ERROR),message:B(),data:ad.passthrough()})]);function sd(e){return{code:`UNKNOWN_ERROR`,message:`an unhandled error was thrown`,data:e}}var cd=class extends Error{errorData;constructor(e){super(e.message),this.errorData=e}getCode(){return this.errorData.code}getData(){return this.errorData}};function ld(e){if(e instanceof Error){let t={name:e.name,message:e.message,stack:e.stack},{code:n,cause:r}=e;return typeof n==`string`&&(t.code=n),r!==void 0&&(t.cause=r),t}return typeof e==`string`?{message:e}:typeof e==`object`&&e?e:{}}function ud(e){if(!e||e.message===void 0&&e.name===void 0)return;let t=Error(e.message);return e.name&&(t.name=e.name),e.stack&&(t.stack=e.stack),e.code!==void 0&&(t.code=e.code),e.cause!==void 0&&(t.cause=e.cause),t}var dd=class extends Error{err;constructor(e){super(e.message),this.err=e}getCode(){return this.err.code}getData(){return this.err.data}},fd;(function(e){e[e.PARSE_ERROR=-32700]=`PARSE_ERROR`,e[e.INVALID_REQUEST=-32600]=`INVALID_REQUEST`,e[e.METHOD_NOT_FOUND=-32601]=`METHOD_NOT_FOUND`,e[e.INVALID_PARAMS=-32602]=`INVALID_PARAMS`,e[e.INTERNAL_ERROR=-32603]=`INTERNAL_ERROR`,e[e.SERVER_ERROR=-32e3]=`SERVER_ERROR`})(fd||={});var pd=q([B(),H(),W()]),md=K({jsonrpc:Y(`2.0`),method:B(),params:ko(),id:pd.optional()}).strict(),hd=K({code:H(),message:B(),data:ko().optional()}).strict(),gd=K({jsonrpc:Y(`2.0`),id:pd,result:K({}).passthrough().optional()}).strict(),_d=q([md,q([K({jsonrpc:Y(`2.0`),id:pd,error:hd}).strict(),gd])]);function vd(e){try{let t=JSON.parse(e);return _d.parse(t)}catch(e){throw e instanceof SyntaxError?new dd({code:fd.PARSE_ERROR,message:`parse error`}):e instanceof Na?new dd({code:fd.INVALID_REQUEST,message:`invalid request`}):e}}function yd(e){return{jsonrpc:`2.0`,...e}}var bd=class{transport;requestHandlers;ongoingRequests={};constructor(e,t){this.transport=e,this.requestHandlers=t,this.transport.onMessage=e=>{this.handleMessage(e)}}_request(e){return new Promise((t,n)=>{if(!e.id){n(Error(`requests need to have an id`));return}let r=e=>{if(`error`in e){if(e.error.code===fd.SERVER_ERROR){let t=od.parse(e.error.data);if(t.code===`UNKNOWN_ERROR`){n(ud(t.data));return}n(new cd(t));return}n(new dd(e.error));return}t(e.result)};this.ongoingRequests[e.id]=r,this.transport.send(JSON.stringify(e))})}_notify(e){this.transport.send(JSON.stringify(e))}request(e,t){let n=crypto.randomUUID();return this._request({id:n,jsonrpc:`2.0`,method:e,params:t})}notify(e,t){return this._notify({jsonrpc:`2.0`,method:e,params:t})}async handleRpcRequest(e){try{let t=await this.onRequest(e);if(e.id){let n=yd({id:e.id,result:t});this.transport.send(JSON.stringify(n))}}catch(e){throw e instanceof Na?new dd({code:fd.INVALID_PARAMS,message:e.message,data:e.flatten()}):e instanceof cd?new dd({code:fd.SERVER_ERROR,message:`unexpected server error`,data:e.getData()}):e instanceof dd?e:new dd({code:fd.SERVER_ERROR,message:`unexpected server error`,data:sd(ld(e))})}}async handleMessage(e){let t=!1,n;try{let r=vd(e);n=r.id,`method`in r?await this.handleRpcRequest(r):(t=!0,this.handleRpcResponse(r))}catch(e){if(t)throw e;if(e instanceof dd){let t=yd({id:n??null,error:{code:e.getCode(),message:e.message,data:e.getData()}});this.transport.send(JSON.stringify(t));return}throw e}}handleRpcResponse(e){if(!e.id)return;let t=this.ongoingRequests[e.id];if(!t)throw Error(`no ongoingRequest ${e.id}`);t(e)}},xd={params:K({accountId:B()}),result:K({maxSpendable:B().regex(/^(0|[1-9]\d*)$/)})},Sd={params:K({accountId:B(),derivationPath:B().optional()}),result:K({publicKey:B()})},Cd={params:K({currencyIds:G(B()).optional()}).optional(),result:K({rawAccounts:G(_s)})},wd={params:K({accountId:B(),tokenCurrency:B().optional()}),result:K({address:B()})},Td={params:K({currencyIds:G(B()).optional(),showAccountFilter:U().optional(),drawerConfiguration:K({assets:K({filter:B().optional(),leftElement:B().optional(),rightElement:B().optional()}).optional(),networks:K({leftElement:B().optional(),rightElement:B().optional()}).optional()}).optional(),useCase:B().optional(),uiUseCase:B().optional()}),result:K({rawAccount:_s})},Ed={params:K({accountId:B(),derivationPath:B().optional()}),result:K({address:B()})},Dd={params:K({accountId:B(),intentions:G(J([`payment`,`ordinal`])).optional()}),result:K({addresses:G(K({address:B(),publicKey:B().optional(),path:B().optional(),intention:B().optional()}))})},Od={params:K({accountId:B(),derivationPath:B().optional()}),result:K({publicKey:B()})},kd={params:K({accountId:B()}),result:K({xPub:B()})},Ad={params:K({accountId:B(),psbt:B(),broadcast:U().optional()}),result:K({psbtSigned:B(),txHash:B().optional()})},jd={params:K({currencyIds:G(B()).optional()}).optional(),result:K({currencies:G(xs)})},Md=J([`blue`,`nanoS`,`nanoSP`,`nanoX`,`stax`,`europa`,`apex`]),Nd={params:K({transportId:B()}),result:K({transportId:B()})},Pd={params:K({apduHex:B(),transportId:B()}),result:K({responseHex:B()})},Fd={params:K({deviceId:B()}),result:K({transportId:B()})},Id={params:K({appName:B().optional(),allowManager:U().optional(),appVersionRange:B().optional(),firmwareVersionRange:B().optional(),seeded:U().optional(),devices:Md.array().nonempty().optional()}),result:K({deviceId:B()})},Ld={params:K({appName:B().optional(),allowManager:U().optional(),appVersionRange:B().optional(),firmwareVersionRange:B().optional(),seeded:U().optional(),devices:Md.array().nonempty().optional()}),result:K({transportId:B()})},Rd=J([`SLOW`,`MEDIUM`,`FAST`,`CUSTOM`]),zd=K({provider:B(),fromAccountId:B(),rawTransaction:qu,hexBinaryPayload:B(),hexSignature:B(),feeStrategy:Rd,tokenCurrency:B().optional()}),Bd={params:Bo(`exchangeType`,[zd.extend({exchangeType:Y(`FUND`)}),zd.extend({exchangeType:Y(`SELL`)}),zd.extend({exchangeType:Y(`SWAP`),toAccountId:B(),swapId:B(),rate:H()})]),result:K({transactionHash:B()})},Vd={params:K({exchangeType:J([`SWAP`,`SELL`,`FUND`,`SWAP_NG`,`SELL_NG`,`FUND_NG`])}),result:K({transactionId:B()})},Hd=K({hwAppId:B().optional(),dependencies:G(B()).optional()}),Ud={params:K({accountId:B(),hexMessage:B(),options:Hd.optional(),meta:Wo(B(),jo()).optional()}),result:K({hexSignedMessage:B()})},Wd={params:K({key:B().min(1),storeId:B().min(1).optional()}),result:K({value:B().optional()})},Gd={params:K({key:B(),value:B(),storeId:B().optional()}),result:Fo().optional()},Kd=K({hwAppId:B().optional(),dependencies:G(B()).optional()}),qd={params:K({accountId:B(),rawTransaction:qu,options:Kd.optional(),meta:Wo(B(),jo()).optional(),tokenCurrency:B().optional()}),result:K({signedTransactionHex:B()})},Jd=K({hwAppId:B().optional(),dependencies:G(B()).optional()}),Yd={params:K({accountId:B(),rawTransaction:qu,options:Jd.optional(),meta:Wo(B(),jo()).optional(),tokenCurrency:B().optional()}),result:K({transactionHash:B()})},Xd=K({hwAppId:B().optional(),dependencies:G(B()).optional()}),Zd={params:K({accountId:B(),rawTransaction:B(),broadcast:U().optional(),options:Xd.optional(),meta:Wo(B(),jo()).optional()}),result:K({signedTransactionHex:B(),transactionHash:B().optional()})},Qd={params:K({}),result:K({methodIds:G(B())})},$d={params:K({}),result:K({tracking:U(),wallet:K({name:B(),version:B()})})},ef={params:K({}),result:K({userId:B()})};J([`account.getMaxSpendable`,`account.getPublicKey`,`account.list`,`account.receive`,`account.request`,`currency.list`,`device.close`,`device.exchange`,`device.transport`,`message.sign`,`transaction.sign`,`transaction.signRaw`,`transaction.signAndBroadcast`,`wallet.capabilities`,`wallet.info`,`wallet.userId`]),O();var tf=class e extends Br{walletApi;transportId;constructor(e,t){super(),this.transportId=t,this.walletApi=e}static isSupported=()=>Promise.resolve(!0);static list=()=>Promise.resolve([]);static listen=e=>({unsubscribe:()=>{}});static open({walletApi:t,transportId:n}){return Promise.resolve(new e(t,n))}async exchange(e){let t=e.toString(`hex`),n=await this.walletApi.request(`device.exchange`,{transportId:this.transportId,apduHex:t}),r=Pd.result.parse(n);return k.from(r.responseHex,`hex`)}setScrambleKey(){}async close(){let e=await this.walletApi.request(`device.close`,{transportId:this.transportId});Nd.result.parse(e)}},nf=class{client;constructor(e){this.client=e}async list(e){let t=await this.client.request(`account.list`,{currencyIds:e?.currencyIds});return Cd.result.parse(t).rawAccounts.map(ka)}async request(e){let t=await this.client.request(`account.request`,{currencyIds:e?.currencyIds,showAccountFilter:e?.showAccountFilter,drawerConfiguration:e?.drawerConfiguration,useCase:e?.useCase,uiUseCase:e?.uiUseCase});return ka(Td.result.parse(t).rawAccount)}async receive(e){let t=await this.client.request(`account.receive`,{accountId:e});return wd.result.parse(t).address}async getPublicKey(e,t){let n=await this.client.request(`account.getPublicKey`,{accountId:e,derivationPath:t});return Sd.result.parse(n).publicKey}async getMaxSpendable(e){let t=await this.client.request(`account.getMaxSpendable`,{accountId:e});return new I(xd.result.parse(t).maxSpendable)}},rf=class{client;constructor(e){this.client=e}async getAddress(e,t){let n=await this.client.request(`bitcoin.getAddress`,{accountId:e,derivationPath:t});return Ed.result.parse(n).address}async getAddresses(e,t){let n=await this.client.request(`bitcoin.getAddresses`,{accountId:e,intentions:t});return Dd.result.parse(n).addresses}async getPublicKey(e,t){let n=await this.client.request(`bitcoin.getPublicKey`,{accountId:e,derivationPath:t});return Od.result.parse(n).publicKey}async getXPub(e){let t=await this.client.request(`bitcoin.getXPub`,{accountId:e});return kd.result.parse(t).xPub}async signPsbt(e,t,n){let r=await this.client.request(`bitcoin.signPsbt`,{accountId:e,psbt:t,broadcast:n}),{psbtSigned:i,txHash:a}=Ad.result.parse(r);return{psbtSigned:i,txHash:a}}},af=class{client;constructor(e){this.client=e}async list(e){let t=await this.client.request(`currency.list`,{currencyIds:e?.currencyIds});return jd.result.parse(t).currencies}},of=class{client;constructor(e){this.client=e}async transport(e){let t=await this.client.request(`device.transport`,e),n=Ld.result.parse(t);return tf.open({walletApi:this.client,transportId:n.transportId})}async open(e){let t=await this.client.request(`device.open`,e),n=Fd.result.parse(t);return tf.open({walletApi:this.client,transportId:n.transportId})}async select(e){let t=await this.client.request(`device.select`,e);return Id.result.parse(t)}},sf=class{client;constructor(e){this.client=e}async start(e){let t=await this.client.request(`exchange.start`,{exchangeType:e});return Vd.result.parse(t).transactionId}async completeSwap({provider:e,fromAccountId:t,toAccountId:n,swapId:r,rate:i,transaction:a,binaryPayload:o,signature:s,feeStrategy:c,tokenCurrency:l}){let u=await this.client.request(`exchange.complete`,{exchangeType:`SWAP`,provider:e,fromAccountId:t,toAccountId:n,swapId:r,rate:i,rawTransaction:eu(a),hexBinaryPayload:o.toString(`hex`),hexSignature:s.toString(`hex`),feeStrategy:c,tokenCurrency:l});return Bd.result.parse(u).transactionHash}async completeSell({provider:e,fromAccountId:t,transaction:n,binaryPayload:r,signature:i,feeStrategy:a}){let o=await this.client.request(`exchange.complete`,{exchangeType:`SELL`,provider:e,fromAccountId:t,rawTransaction:eu(n),hexBinaryPayload:r.toString(`hex`),hexSignature:i.toString(`hex`),feeStrategy:a});return Bd.result.parse(o).transactionHash}async completeFund({provider:e,fromAccountId:t,transaction:n,binaryPayload:r,signature:i,feeStrategy:a,tokenCurrency:o}){let s=await this.client.request(`exchange.complete`,{exchangeType:`FUND`,provider:e,fromAccountId:t,rawTransaction:eu(n),hexBinaryPayload:r.toString(`hex`),hexSignature:i.toString(`hex`),feeStrategy:a,tokenCurrency:o});return Bd.result.parse(s).transactionHash}};O();var cf=class{client;constructor(e){this.client=e}async sign(e,t,n,r){let i=await this.client.request(`message.sign`,{accountId:e,hexMessage:t.toString(`hex`),options:n,meta:r}),a=Ud.result.parse(i);return k.from(a.hexSignedMessage,`hex`)}},lf=class{client;constructor(e){this.client=e}async get(e,t){let n=await this.client.request(`storage.get`,{key:e,storeId:t});return Wd.result.parse(n).value}async set(e,t,n){let r=await this.client.request(`storage.set`,{key:e,value:t,storeId:n});return Gd.result.parse(r)}};O();var uf=class{client;constructor(e){this.client=e}async sign(e,t,n,r){let i=await this.client.request(`transaction.sign`,{accountId:e,rawTransaction:eu(t),options:n,meta:r}),a=qd.result.parse(i);return k.from(a.signedTransactionHex,`hex`)}async signRaw(e,t,n,r,i){let a=await this.client.request(`transaction.signRaw`,{accountId:e,rawTransaction:t,broadcast:n,options:r,meta:i});return Zd.result.parse(a)}async signAndBroadcast(e,t,n,r){let i=await this.client.request(`transaction.signAndBroadcast`,{accountId:e,rawTransaction:eu(t),options:n,meta:r});return Yd.result.parse(i).transactionHash}},df=class{client;constructor(e){this.client=e}async userId(){let e=await this.client.request(`wallet.userId`,{});return ef.result.parse(e).userId}async info(){let e=await this.client.request(`wallet.info`,{});return $d.result.parse(e)}async capabilities(){let e=await this.client.request(`wallet.capabilities`,{});return Qd.result.parse(e).methodIds}},ff=new Ju(`Wallet-API-Client`),pf={"event.account.updated":e=>Promise.resolve()},mf=class extends bd{account;bitcoin;currency;device;message;storage;transaction;wallet;exchange;custom;logger;constructor(e,t=ff,n,r={}){super(e,{...pf,...r}),this.logger=t,this.account=new nf(this),this.bitcoin=new rf(this),this.currency=new af(this),this.device=new of(this),this.message=new cf(this),this.storage=new lf(this),this.transaction=new uf(this),this.wallet=new df(this),this.exchange=new sf(this),this.custom=n?n(this):{}}setEventHandlers(e){this.requestHandlers={...pf,...e}}onRequest(e){this.logger.log(e.method);let t=this.requestHandlers[e.method];if(!t)throw new dd({code:fd.METHOD_NOT_FOUND,message:`method not found`});return t(e)}},hf={near:{"*":{currencyId:`near`,family:`near`,network:`near`}},tezos:{"*":{currencyId:`tezos`,family:`tezos`,network:`tezos`}},solana:{"*":{currencyId:`solana`,family:`solana`,network:`solana`}},tron:{"*":{currencyId:`tron`,family:`tron`,network:`tron`}},ton:{"*":{currencyId:`ton`,family:`ton`,network:`ton`}},polkadot:{"*":{currencyId:`assethub_polkadot`,family:`polkadot`,network:`polkadot`}},celo:{"*":{currencyId:`celo`,family:`celo`,network:`celo`}},ethereum:{ethereum:{currencyId:`ethereum`,family:`ethereum`,network:`ethereum`},polygon:{currencyId:`polygon`,family:`ethereum`,network:`polygon`},arbitrum:{currencyId:`arbitrum`,family:`ethereum`,network:`arbitrum`},optimism:{currencyId:`optimism`,family:`ethereum`,network:`optimism`},avalanche_c_chain:{currencyId:`avalanche_c_chain`,family:`ethereum`,network:`avalanche-c`},ethereum_hoodi:{currencyId:`ethereum_hoodi`,family:`ethereum`,network:`ethereum-hoodi`},bsc:{currencyId:`bsc`,family:`ethereum`,network:`binance`}},cosmos:{cosmos:{currencyId:`cosmos`,family:`cosmos`,network:`cosmos`},crypto_org:{currencyId:`crypto_org`,family:`cosmos`,network:`cronos`},osmo:{currencyId:`osmo`,family:`cosmos`,network:`osmosis`},coreum:{currencyId:`coreum`,family:`cosmos`,network:`coreum`},axelar:{currencyId:`axelar`,family:`cosmos`,network:`axelar`},stargaze:{currencyId:`stargaze`,family:`cosmos`,network:`stargaze`},secret_network:{currencyId:`secret_network`,family:`cosmos`,network:`secret`},umee:{currencyId:`umee`,family:`cosmos`,network:`umee`},desmos:{currencyId:`desmos`,family:`cosmos`,network:`desmos`},onomy:{currencyId:`onomy`,family:`cosmos`,network:`onomy`},quicksilver:{currencyId:`quicksilver`,family:`cosmos`,network:`quicksilver`},persistence:{currencyId:`persistence`,family:`cosmos`,network:`persistence`},dydx:{currencyId:`dydx`,family:`cosmos`,network:`dydx`},injective:{currencyId:`injective`,family:`cosmos`,network:`injective`},sei:{currencyId:`sei`,family:`cosmos`,network:`sei`},mantra:{currencyId:`mantra`,family:`cosmos`,network:`mantra`}}},gf=new Map([[`polkadot`,1],[`avalanche-c`,2],[`tron`,3],[`binance`,4],[`cronos`,5],[`polygon`,6]]);O();var _f=Se(),vf=u(c({amount:y(u(p)),gasLimit:y(u(p)),token:y(u(c({decimals:m})))})),yf=_(vf),bf=_(l),xf=new Set([`polygon`,`optimism`,`arbitrum`,`avalanche-c`,`core`]),Sf=class extends f()(`LedgerTransactionPreparationError`,{message:p}){},Cf=e=>new Sf({message:e}),wf=T(function*(){let e=yield*ne(E({try:()=>ae(()=>import(`./polkadot-ledger-transaction-DaDP252u.js`).then(e=>e.buildPolkadotLedgerTransaction),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])),catch:()=>Cf(`Could not load Polkadot transaction support`)}));return({family:t,network:n,tx:r,txMeta:i})=>d(bf)(r).pipe(re(()=>Cf(`Failed to parse tx`)),D(r=>n===`polkadot`?i?Tf({loadPolkadotBuilder:e,payload:r,txMeta:i}):ie(Cf(`Missing classic transaction metadata`)):w(Ef({family:t,network:n,payload:r,txMeta:i})).pipe(re(Cf))))}),Tf=({loadPolkadotBuilder:e,payload:t,txMeta:n})=>w(le(fe,t)).pipe(re(Cf),D(t=>e.pipe(D(e=>w(e({fee:Ff(Nf(n.gasEstimate)).toString(),payload:t,txMeta:n})).pipe(re(Cf)))))),Ef=({family:e,network:t,payload:i,txMeta:s})=>{if(ge(t))return le(ue,i).pipe(n(e=>Df({network:t,tx:e})));if(e===`borrow`)return o(`Unsupported Borrow network`);if(!s)return o(`Missing classic transaction metadata`);switch(t){case`tron`:return le(we,i).pipe(a(()=>kf(s)));case`near`:return Af(s);case`tezos`:return jf(s);case`ton`:return le(Ce,i).pipe(a(e=>Mf(e,s)));default:return he(t)?Of(s):r(i)}},Df=({network:e,tx:t})=>{let n={amount:(t.value??0n).toString(),recipient:t.to,family:`ethereum`,gasLimit:t.gasLimit.toString(),data:k.from(_e(t.data)).toString(`hex`)};return t.maxFeePerGas&&t.maxPriorityFeePerGas&&!xf.has(e)?(n.maxFeePerGas=t.maxFeePerGas.toString(),n.maxPriorityFeePerGas=t.maxPriorityFeePerGas.toString()):t.gasPrice&&(n.gasPrice=t.gasPrice.toString()),n},Of=e=>{let t=e.rawArguments?.validatorAddress,n=If(e.txType),i=Pf(e)??(Lf(n)?se():null);return!t||i===null?o(`Missing Cosmos Ledger arguments`):r({family:`cosmos`,mode:n,validators:[{address:t,amount:i.toString()}],amount:i.toString(),recipient:t,memo:`via StakeKit CID-1009`})},kf=e=>{let t=Pf(e),i=e.rawArguments?.tronResource,a=e.rawArguments?.validatorAddress??e.rawArguments?.validatorAddresses?.[0],s=e.address;return(()=>{switch(e.txType){case`FREEZE_BANDWIDTH`:case`FREEZE_ENERGY`:return!t||!i?o(`Missing Tron freeze arguments`):r({amount:t.toString(),recipient:s,family:`tron`,mode:`freeze`,resource:i});case`VOTE`:{let r=e.rawArguments?.validatorAddresses;return!t||!r?.length?o(`Missing Tron vote arguments`):Bf({txMeta:e,validatorAddresses:r}).pipe(n(e=>({amount:t.toString(),recipient:s,family:`tron`,mode:`vote`,votes:e})))}case`UNDELEGATE_BANDWIDTH`:case`UNDELEGATE_ENERGY`:return!t||!i||!a?o(`Missing Tron undelegate arguments`):r({amount:t.toString(),recipient:String(a),family:`tron`,mode:`unDelegateResource`,resource:i});case`UNFREEZE_LEGACY_BANDWIDTH`:case`UNFREEZE_LEGACY_ENERGY`:return r({amount:`0`,recipient:``,family:`tron`,mode:`legacyUnfreeze`,resource:i});case`UNFREEZE_BANDWIDTH`:case`UNFREEZE_ENERGY`:return!t||!i?o(`Missing Tron unfreeze arguments`):r({amount:t.toString(),recipient:s,family:`tron`,mode:`unfreeze`,resource:i});case`CLAIM_REWARDS`:return r({amount:`0`,recipient:s,family:`tron`,mode:`claimReward`});default:return o(`Unsupported Tron Ledger transaction type: ${e.txType}`)}})().pipe(n(e=>({...e,votes:e.votes??[]})))},Af=e=>{let t=e.rawArguments?.validatorAddress,n=Pf(e);return!t||!n?o(`Missing Near Ledger arguments`):r({amount:n.toString(),recipient:t,family:`near`,mode:Rf(e.txType),fees:Ff(Nf(e.gasEstimate)).toString()})},jf=e=>{let t=Nf(e.gasEstimate),n=e.txType===`UNSTAKE`,i=n?``:e.rawArguments?.validatorAddress;return!n&&!i?o(`Missing Tezos Ledger validator`):r({family:`tezos`,mode:n?`undelegate`:`delegate`,amount:`0`,recipient:i??``,fees:Ff(t).toString(),gasLimit:String(t?.gasLimit??0)})},Mf=(e,t)=>{let n=Nf(t.gasEstimate);if(!(`message`in e)){let t=e[0];return t?r({family:`ton`,amount:t.amount,recipient:t.address,fees:Ff(n).toString(),comment:{text:t.payload,isEncrypted:!1}}):o(`Unsupported Ton Ledger transaction payload`)}try{let t=(0,_f.loadMessageRelaxed)(_f.Cell.fromBase64(e.message).beginParse()),i=t.info;return r({family:`ton`,amount:i.value.coins.toString(),recipient:i.dest.toString(),fees:Ff(n).toString(),comment:{text:t.body.toBoc().toString(`base64`),isEncrypted:!1}})}catch{return o(`Unsupported Ton Ledger transaction payload`)}},Nf=e=>e?h(yf)(e).pipe(s):null,Pf=e=>{if(e.amountRaw)return me(e.amountRaw);let t=e.rawArguments?.amount??e.amount,n=e.inputToken?.decimals;return!t||n===void 0?null:me(t).multipliedBy(me(10).pow(n))},Ff=e=>!e?.amount||!e.token?se():me(e.amount).multipliedBy(me(10).pow(e.token.decimals)),If=e=>{switch(e){case`STAKE`:return`delegate`;case`UNSTAKE`:return`undelegate`;case`RESTAKE`:case`REBOND`:return`redelegate`;case`RESTAKE_REWARDS`:return`claimRewardCompound`;case`CLAIM_REWARDS`:return`claimReward`;default:return`delegate`}},Lf=e=>e===`claimReward`||e===`claimRewardCompound`,Rf=e=>{switch(e){case`STAKE`:return`stake`;case`UNSTAKE`:return`unstake`;case`WITHDRAW`:case`CLAIM_UNSTAKED`:return`withdraw`;default:return`stake`}},zf=e=>{let t=e.rawArguments?.amount??e.amount;if(t)return me(t);let n=e.inputToken?.decimals;return!e.amountRaw||n===void 0?null:me(e.amountRaw).dividedBy(me(10).pow(n))},Bf=({txMeta:e,validatorAddresses:t})=>{let n=zf(e);if(!n)return o(`Missing Tron vote arguments`);let i=t.length,a=n.dividedToIntegerBy(i),s=n.modulo(i).integerValue(pe.ROUND_FLOOR);if(!a.isFinite()||!s.isFinite()||a.isNegative()||s.isNegative())return o(`Invalid Tron vote count`);if(a.plus(1).gt(2**53-1))return o(`Tron vote count exceeds Ledger limits`);let c=oe(s);if(c==null)return o(`Invalid Tron vote count`);let l=t.map((e,t)=>{let n=oe(a.plus(+(t<c)));return n==null?null:{address:e,voteCount:n}});return l.some(e=>e==null)?o(`Invalid Tron vote count`):r(l.filter(e=>e!=null))},Vf=({accounts:e,ledgerCurrencies:t,enabledChainsMap:n})=>{let{accountsFamilies:r,accountsCurrencies:i}=e.reduce((e,n)=>{let r=t.get(n.currency);return r&&(e.accountsFamilies.add(r),e.accountsCurrencies.add(n.currency)),e},{accountsFamilies:new Set,accountsCurrencies:new Set}),a=v(hf).reduce((e,[t,a])=>{let o=Object.keys(a).reduce((e,t)=>{let o=a[t];if(!o)return e;let s=n.evm[o.network]?.wagmiChain||n.cosmos[o.network]?.wagmiChain||n.misc[o.network]?.wagmiChain||n.substrate[o.network]?.wagmiChain;return s?r.has(o.family)&&(t===`*`||i.has(o.currencyId))?{...e,[t]:{...o,chain:s,enabled:!0}}:gf.has(o.network)?{...e,[t]:{...o,chain:s,enabled:!1}}:e:e},{});return{...e,[t]:o}},{});return Object.keys(a).reduce((e,t)=>{let n=a[t],r=Object.keys(n).reduce((e,t)=>{let r=n[t];return r&&e.set(t,r),e},new Map);return e.set(t,r),e},new Map)},Hf=e=>E({try:()=>e.currency.list({currencyIds:Object.values(hf).flatMap(e=>Object.values(e).map(e=>e.currencyId))}),catch:e=>new S({cause:e,message:`could not get currencies`,operation:`ledger-list-currencies`})}).pipe(ee(e=>e.reduce((e,t)=>(t.type===`CryptoCurrency`?e.cryptoCurrency.set(t.id,t.family):e.tokenCurrency.push(t),e),{cryptoCurrency:new Map,tokenCurrency:[]})),ee(e=>(e.tokenCurrency.forEach(t=>{let n=e.cryptoCurrency.get(t.parent);n&&e.cryptoCurrency.set(t.id,n)}),e.cryptoCurrency))),Uf=({walletDetailsParams:e,enabledChainsMap:t,isLedgerDappBrowser:n,prepareTransaction:a,queryParams:s,runWalletEffect:c})=>x(l=>{let u=ve([]),d=ve([]),f=ve(void 0),p=f.changes.pipe(b(e=>e?.parentAccountId??e?.id)),m=[],h=ve([]),g=null,_=null,v=null,y=new Xu;y.connect();let x=new mf(y),w=async e=>{l.emitter.emit(`message`,{type:`connecting`});let n=await c(Hf(x)),r=await c(E({try:()=>x.account.list(),catch:e=>new S({cause:e,message:`could not get accounts`,operation:`ledger-list-accounts`})}).pipe(ee(e=>({accounts:e,accountsMap:new Map(e.map(e=>[e.id,e]))})),ee(e=>e.accounts.map(t=>t.parentAccountId?(()=>{let n=e.accountsMap.get(t.parentAccountId);return n?{...t,currency:n.currency}:t})():t))));m=r.filter(e=>!e.parentAccountId);let a=Vf({ledgerCurrencies:n,accounts:m,enabledChainsMap:t});_=new Map([...a.values()].flatMap(e=>[...e.values()].map(e=>[e.chain.id,e.currencyId]))),v=a;let{enabled:o,disabled:p}=[...a.values()].reduce((e,t)=>(t.forEach(t=>{t.enabled?e.enabled.push(t.chain):e.disabled.push(t.chain)}),e),{enabled:[],disabled:[]});u.set([...o,...p]),d.set(p);let y=r.reduce((e,t)=>{let r=n.get(t.currency);if(!r)return e;let i=a.get(r);if(!r||!i)return e;let o=i.get(`*`)||i.get(t.currency);return o&&e.push({account:t,chainItem:o}),e},[]).sort((e,t)=>(gf.get(e.chainItem.network)||999)-(gf.get(t.chainItem.network)||999));if(!y.length){let t=a.get(`ethereum`)?.get(`ethereum`);if(!t)throw Error(`Default chain not found`);return h.set([]),g=t,D([`N/A`]),ne(t.chain.id.toString()),C(e?.withCapabilities,[`N/A`],t.chain.id)}let b=s.accountId?s.accountId.startsWith(`js:`)?{type:`address`,address:s.accountId.split(`:`)[3]}:{type:`accountId`,accountId:s.accountId}:null,w=(b?y.find(e=>b.type===`address`?e.account.address===b.address:e.account.id===b.accountId):void 0)??(s.network?y.find(e=>e.chainItem.network===s.network):void 0)??y[0];if(!w)throw Error(`Account not found`);return f.set(w.account),g=w.chainItem,h.set(i(te())),D([w.account.address]),ne(g.chain.id.toString()),C(e?.withCapabilities,[w.account.address],g.chain.id)},te=()=>g?r(m.filter(e=>e.currency===g?.currencyId)):o(Error(`Current chain not found`)),{onAccountsChanged:D,onChainChanged:ne,onDisconnect:re}=Ar(l.emitter,ce),ie=async()=>({}),ae=async()=>n,oe=async()=>y.disconnect(),se=async()=>{let e=g?.chain.id;if(!e)throw Error(`Chain not found`);return e},le=async()=>[f.get()?.address],ue=e=>{f.set(e),D([e.address])},fe=e=>T(function*(){let t=_?.get(e.id);if(!t)return yield*new S({message:`Chain not found`,operation:`ledger-request-account`});let n=yield*E({try:()=>x.account.request({currencyIds:[t]}),catch:e=>new S({cause:e,message:`could not request account`,operation:`ledger-request-account`})});return m.push(n),u.set([...u.get(),e]),d.set(d.get().filter(t=>t.id!==e.id)),yield*E({try:()=>pe({chainId:e.id}),catch:e=>new S({cause:e,message:`failed to switch to new chain`,operation:`ledger-switch-chain`})})}),pe=async({chainId:e})=>{let t=g;if(!t||!v)throw Error(`Chain not found`);let n=[...v.values()].flatMap(e=>[...e.values()]).find(t=>t.chain.id===e);if(!n)throw Error(`Chain not found`);if(t.chain.id!==n.chain.id||!f.get()){g=n;let e=i(te());h.set(e),f.set(e[0])}let r=f.get();if(!r)throw Error(`Account not found`);return ne(e.toString()),D([r.address]),n.chain};return{...e,id:de.id,name:de.name,type:de.type,connect:w,onAccountsChanged:D,onChainChanged:ne,onDisconnect:re,getProvider:ie,isAuthorized:ae,getChainId:se,disconnect:oe,switchChain:pe,getAccounts:le,switchAccount:ue,requestAndSwitchAccount:fe,walletApiClient:x,$accountsOnCurrentChain:h.changes,$filteredChains:u.changes,$currentAccountId:p,$disabledChains:d.changes,noAccountPlaceholder:`N/A`,deserializeTransaction:tu,prepareTransaction:a}}),Wf=({enabledChainsMap:e,isLedgerDappBrowser:t,queryParams:n,runWalletEffect:r})=>T(function*(){let i=yield*wf;return{groupName:`Ledger Live`,wallets:[()=>({id:de.id,name:de.name,iconUrl:g.ledgerLogo,iconBackground:`#fff`,chainGroup:{id:de.id,title:de.name,iconUrl:g.ledgerLogo},availability:{_tag:`Injected`,detect:te(t)},createConnector:a=>Uf({walletDetailsParams:a,enabledChainsMap:e,isLedgerDappBrowser:t,prepareTransaction:i,queryParams:n,runWalletEffect:r})})]}});export{Wf as ledgerLiveConnector};
5
+ `+n.toString(t+` `)}return r}asSlice(){return this.beginParse()}asBuilder(){return(0,u.beginCell)().storeSlice(this.asSlice())}};e.Cell=d,t=n.inspectSymbol,d.EMPTY=new d})),Q=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Builder=e.beginCell=void 0;var t=cc(),n=Nc(),r=bc();function i(){return new a}e.beginCell=i;var a=class e{constructor(){this._bits=new t.BitBuilder,this._refs=[]}get bits(){return this._bits.length}get refs(){return this._refs.length}get availableBits(){return 1023-this.bits}get availableRefs(){return 4-this.refs}storeBit(e){return this._bits.writeBit(e),this}storeBits(e){return this._bits.writeBits(e),this}storeBuffer(e,t){if(t!=null&&e.length!==t)throw Error(`Buffer length ${e.length} is not equal to ${t}`);return this._bits.writeBuffer(e),this}storeMaybeBuffer(e,t){return e===null?this.storeBit(0):(this.storeBit(1),this.storeBuffer(e,t)),this}storeUint(e,t){return this._bits.writeUint(e,t),this}storeMaybeUint(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeUint(e,t)),this}storeInt(e,t){return this._bits.writeInt(e,t),this}storeMaybeInt(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeInt(e,t)),this}storeVarUint(e,t){return this._bits.writeVarUint(e,t),this}storeMaybeVarUint(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeVarUint(e,t)),this}storeVarInt(e,t){return this._bits.writeVarInt(e,t),this}storeMaybeVarInt(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeVarInt(e,t)),this}storeCoins(e){return this._bits.writeCoins(e),this}storeMaybeCoins(e){return e==null?this.storeBit(0):(this.storeBit(1),this.storeCoins(e)),this}storeAddress(e){return this._bits.writeAddress(e),this}storeRef(t){if(this._refs.length>=4)throw Error(`Too many references`);if(t instanceof n.Cell)this._refs.push(t);else if(t instanceof e)this._refs.push(t.endCell());else throw Error(`Invalid argument`);return this}storeMaybeRef(e){return e?(this.storeBit(1),this.storeRef(e)):this.storeBit(0),this}storeSlice(e){let t=e.clone();for(t.remainingBits>0&&this.storeBits(t.loadBits(t.remainingBits));t.remainingRefs>0;)this.storeRef(t.loadRef());return this}storeMaybeSlice(e){return e?(this.storeBit(1),this.storeSlice(e)):this.storeBit(0),this}storeBuilder(e){return this.storeSlice(e.endCell().beginParse())}storeMaybeBuilder(e){return e?(this.storeBit(1),this.storeBuilder(e)):this.storeBit(0),this}storeWritable(e){return typeof e==`object`?e.writeTo(this):e(this),this}storeMaybeWritable(e){return e?(this.storeBit(1),this.storeWritable(e)):this.storeBit(0),this}store(e){return this.storeWritable(e),this}storeStringTail(e){return(0,r.writeString)(e,this),this}storeMaybeStringTail(e){return e==null?this.storeBit(0):(this.storeBit(1),(0,r.writeString)(e,this)),this}storeStringRefTail(e){return this.storeRef(i().storeStringTail(e)),this}storeMaybeStringRefTail(e){return e==null?this.storeBit(0):(this.storeBit(1),this.storeStringRefTail(e)),this}storeDict(e,t,n){return e?e.store(this,t,n):this.storeBit(0),this}storeDictDirect(e,t,n){return e.storeDirect(this,t,n),this}endCell(e){return new n.Cell({bits:this._bits.build(),refs:this._refs,exotic:e?.exotic})}asCell(){return this.endCell()}asSlice(){return this.endCell().beginParse()}};e.Builder=a})),Pc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SimpleLibraryValue=e.storeSimpleLibrary=e.loadSimpleLibrary=void 0;function t(e){return{public:e.loadBit(),root:e.loadRef()}}e.loadSimpleLibrary=t;function n(e){return t=>{t.storeBit(e.public),t.storeRef(e.root)}}e.storeSimpleLibrary=n,e.SimpleLibraryValue={serialize(e,t){n(e)(t)},parse(e){return t(e)}}})),Fc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTickTock=e.loadTickTock=void 0;function t(e){return{tick:e.loadBit(),tock:e.loadBit()}}e.loadTickTock=t;function n(e){return t=>{t.storeBit(e.tick),t.storeBit(e.tock)}}e.storeTickTock=n})),Ic=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeStateInit=e.loadStateInit=void 0;var t=yc(),n=Pc(),r=Fc();function i(e){let i;e.loadBit()&&(i=e.loadUint(5));let a;e.loadBit()&&(a=(0,r.loadTickTock)(e));let o=e.loadMaybeRef(),s=e.loadMaybeRef(),c=e.loadDict(t.Dictionary.Keys.BigUint(256),n.SimpleLibraryValue);return c.size===0&&(c=void 0),{splitDepth:i,special:a,code:o,data:s,libraries:c}}e.loadStateInit=i;function a(e){return t=>{e.splitDepth!==null&&e.splitDepth!==void 0?(t.storeBit(!0),t.storeUint(e.splitDepth,5)):t.storeBit(!1),e.special!==null&&e.special!==void 0?(t.storeBit(!0),t.store((0,r.storeTickTock)(e.special))):t.storeBit(!1),t.storeMaybeRef(e.code),t.storeMaybeRef(e.data),t.storeDict(e.libraries)}}e.storeStateInit=a})),Lc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contractAddress=void 0;var t=Q(),n=Ic(),r=nc();function i(e,i){let a=(0,t.beginCell)().store((0,n.storeStateInit)(i)).endCell().hash();return new r.Address(e,a)}e.contractAddress=i})),Rc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseTuple=e.serializeTuple=e.parseTupleItem=e.serializeTupleItem=void 0;var t=Q(),n=BigInt(`-9223372036854775808`),r=BigInt(`9223372036854775807`);function i(e,a){if(e.type===`null`)a.storeUint(0,8);else if(e.type===`int`)e.value<=r&&e.value>=n?(a.storeUint(1,8),a.storeInt(e.value,64)):(a.storeUint(256,15),a.storeInt(e.value,257));else if(e.type===`nan`)a.storeInt(767,16);else if(e.type===`cell`)a.storeUint(3,8),a.storeRef(e.cell);else if(e.type===`slice`)a.storeUint(4,8),a.storeUint(0,10),a.storeUint(e.cell.bits.length,10),a.storeUint(0,3),a.storeUint(e.cell.refs.length,3),a.storeRef(e.cell);else if(e.type===`builder`)a.storeUint(5,8),a.storeRef(e.cell);else if(e.type===`tuple`){let n=null,r=null;for(let a=0;a<e.items.length;a++){let o=n;n=r,r=o,a>1&&(n=(0,t.beginCell)().storeRef(r).storeRef(n).endCell());let s=(0,t.beginCell)();i(e.items[a],s),r=s.endCell()}a.storeUint(7,8),a.storeUint(e.items.length,16),n&&a.storeRef(n),r&&a.storeRef(r)}else throw Error(`Invalid value`)}e.serializeTupleItem=i;function a(e){let n=e.loadUint(8);if(n===0)return{type:`null`};if(n===1)return{type:`int`,value:e.loadIntBig(64)};if(n===2)return e.loadUint(7)===0?{type:`int`,value:e.loadIntBig(257)}:(e.loadBit(),{type:`nan`});if(n===3)return{type:`cell`,cell:e.loadRef()};if(n===4){let n=e.loadUint(10),r=e.loadUint(10),i=e.loadUint(3),a=e.loadUint(3),o=e.loadRef().beginParse();o.skip(n);let s=o.loadBits(r-n),c=(0,t.beginCell)().storeBits(s);if(i<a){for(let e=0;e<i;e++)o.loadRef();for(let e=0;e<a-i;e++)c.storeRef(o.loadRef())}return{type:`slice`,cell:c.endCell()}}if(n===5)return{type:`builder`,cell:e.loadRef()};if(n===7){let t=e.loadUint(16),n=[];if(t>1){let r=e.loadRef().beginParse(),i=e.loadRef().beginParse();n.unshift(a(i));for(let e=0;e<t-2;e++){let e=r;r=e.loadRef().beginParse(),i=e.loadRef().beginParse(),n.unshift(a(i))}n.unshift(a(r))}else t===1&&n.push(a(e.loadRef().beginParse()));return{type:`tuple`,items:n}}throw Error(`Unsupported stack item`)}e.parseTupleItem=a;function o(e,n){if(e.length>0){let r=(0,t.beginCell)();o(e.slice(0,e.length-1),r),n.storeRef(r.endCell()),i(e[e.length-1],n)}}function s(e){let n=(0,t.beginCell)();return n.storeUint(e.length,24),o([...e],n),n.endCell()}e.serializeTuple=s;function c(e){let t=[],n=e.beginParse(),r=n.loadUint(24);for(let e=0;e<r;e++){let e=n.loadRef();t.unshift(a(n)),n=e.beginParse()}return t}e.parseTuple=c})),zc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TupleReader=void 0,e.TupleReader=class e{constructor(e){this.items=[...e]}get remaining(){return this.items.length}peek(){if(this.items.length===0)throw Error(`EOF`);return this.items[0]}pop(){if(this.items.length===0)throw Error(`EOF`);let e=this.items[0];return this.items.splice(0,1),e}skip(e=1){for(let t=0;t<e;t++)this.pop();return this}readBigNumber(){let e=this.pop();if(e.type!==`int`)throw Error(`Not a number`);return e.value}readBigNumberOpt(){let e=this.pop();if(e.type===`null`)return null;if(e.type!==`int`)throw Error(`Not a number`);return e.value}readNumber(){return Number(this.readBigNumber())}readNumberOpt(){let e=this.readBigNumberOpt();return e===null?null:Number(e)}readBoolean(){return this.readNumber()!==0}readBooleanOpt(){let e=this.readNumberOpt();return e===null?null:e!==0}readAddress(){let e=this.readCell().beginParse().loadAddress();if(e!==null)return e;throw Error(`Not an address`)}readAddressOpt(){let e=this.readCellOpt();return e===null?null:e.beginParse().loadMaybeAddress()}readCell(){let e=this.pop();if(e.type!==`cell`&&e.type!==`slice`&&e.type!==`builder`)throw Error(`Not a cell: `+e.type);return e.cell}readCellOpt(){let e=this.pop();if(e.type===`null`)return null;if(e.type!==`cell`&&e.type!==`slice`&&e.type!==`builder`)throw Error(`Not a cell`);return e.cell}readTuple(){let t=this.pop();if(t.type!==`tuple`)throw Error(`Not a tuple`);return new e(t.items)}readTupleOpt(){let t=this.pop();if(t.type===`null`)return null;if(t.type!==`tuple`)throw Error(`Not a tuple`);return new e(t.items)}static readLispList(e){let t=[],n=e;for(;n!==null;){var r=n.pop();if(n.items.length===0||n.items[0].type!==`tuple`&&n.items[0].type!==`null`)throw Error(`Lisp list consists only from (any, tuple) elements and ends with null`);n=n.readTupleOpt(),t.push(r)}return t}readLispListDirect(){return this.items.length===1&&this.items[0].type===`null`?[]:e.readLispList(this)}readLispList(){return e.readLispList(this.readTupleOpt())}readBuffer(){let e=this.readCell().beginParse();if(e.remainingRefs!==0||e.remainingBits%8!=0)throw Error(`Not a buffer`);return e.loadBuffer(e.remainingBits/8)}readBufferOpt(){let e=this.readCellOpt();if(e!==null){let t=e.beginParse();if(t.remainingRefs!==0||t.remainingBits%8!=0)throw Error(`Not a buffer`);return t.loadBuffer(t.remainingBits/8)}return null}readString(){return this.readCell().beginParse().loadStringTail()}readStringOpt(){let e=this.readCellOpt();return e===null?null:e.beginParse().loadStringTail()}}})),Bc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TupleBuilder=void 0;var t=Q(),n=Nc(),r=xc();e.TupleBuilder=class{constructor(){this._tuple=[]}writeNumber(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`int`,value:BigInt(e)})}writeBoolean(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`int`,value:e?-1n:0n})}writeBuffer(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`slice`,cell:(0,t.beginCell)().storeBuffer(e).endCell()})}writeString(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`slice`,cell:(0,t.beginCell)().storeStringTail(e).endCell()})}writeCell(e){e==null?this._tuple.push({type:`null`}):e instanceof n.Cell?this._tuple.push({type:`cell`,cell:e}):e instanceof r.Slice&&this._tuple.push({type:`cell`,cell:e.asCell()})}writeSlice(e){e==null?this._tuple.push({type:`null`}):e instanceof n.Cell?this._tuple.push({type:`slice`,cell:e}):e instanceof r.Slice&&this._tuple.push({type:`slice`,cell:e.asCell()})}writeBuilder(e){e==null?this._tuple.push({type:`null`}):e instanceof n.Cell?this._tuple.push({type:`builder`,cell:e}):e instanceof r.Slice&&this._tuple.push({type:`builder`,cell:e.asCell()})}writeTuple(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`tuple`,items:e})}writeAddress(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`slice`,cell:(0,t.beginCell)().storeAddress(e).endCell()})}build(){return[...this._tuple]}}})),Vc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.fromNano=e.toNano=void 0;function t(e){if(typeof e==`bigint`)return e*1000000000n;{if(typeof e==`number`){if(!Number.isFinite(e))throw Error(`Invalid number`);if(Math.log10(e)<=6)e=e.toLocaleString(`en`,{minimumFractionDigits:9,useGrouping:!1});else if(e-Math.trunc(e)===0)e=e.toLocaleString(`en`,{maximumFractionDigits:0,useGrouping:!1});else throw Error(`Not enough precision for a number value. Use string value instead`)}let t=!1;for(;e.startsWith(`-`);)t=!t,e=e.slice(1);if(e===`.`)throw Error(`Invalid number`);let n=e.split(`.`);if(n.length>2)throw Error(`Invalid number`);let r=n[0],i=n[1];if(r||=`0`,i||=`0`,i.length>9)throw Error(`Invalid number`);for(;i.length<9;)i+=`0`;let a=BigInt(r)*1000000000n+BigInt(i);return t&&(a=-a),a}}e.toNano=t;function n(e){let t=BigInt(e),n=!1;t<0&&(n=!0,t=-t);let r=(t%1000000000n).toString();for(;r.length<9;)r=`0`+r;r=r.match(/^([0-9]*[1-9]|0)(0*)/)[1];let i=`${(t/1000000000n).toString()}${r===`0`?``:`.${r}`}`;return n&&(i=`-`+i),i}e.fromNano=n})),Hc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.packExtraCurrencyCell=e.packExtraCurrencyDict=e.storeExtraCurrency=e.loadMaybeExtraCurrency=e.loadExtraCurrency=void 0;var t=Q(),n=yc();function r(e){let t=e instanceof n.Dictionary?e:n.Dictionary.loadDirect(n.Dictionary.Keys.Uint(32),n.Dictionary.Values.BigVarUint(5),e),r={};for(let[e,n]of t)r[e]=n;return r}e.loadExtraCurrency=r;function i(e){let t=e.loadMaybeRef();return t===null?t:r(t)}e.loadMaybeExtraCurrency=i;function a(e){return t=>{t.storeDict(o(e))}}e.storeExtraCurrency=a;function o(e){let t=n.Dictionary.empty(n.Dictionary.Keys.Uint(32),n.Dictionary.Values.BigVarUint(5));return Object.entries(e).map(([e,n])=>t.set(Number(e),n)),t}e.packExtraCurrencyDict=o;function s(e){return(0,t.beginCell)().storeDictDirect(o(e)).endCell()}e.packExtraCurrencyCell=s})),Uc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.comment=e.external=e.internal=void 0;var t=nc(),n=Nc(),r=Q(),i=Vc(),a=Hc();function o(e){let o=!0;e.bounce!==null&&e.bounce!==void 0&&(o=e.bounce);let s;if(typeof e.to==`string`)s=t.Address.parse(e.to);else if(t.Address.isAddress(e.to))s=e.to;else throw Error(`Invalid address ${e.to}`);let c;c=typeof e.value==`string`?(0,i.toNano)(e.value):e.value;let l;e.extracurrency&&(l=(0,a.packExtraCurrencyDict)(e.extracurrency));let u=n.Cell.EMPTY;return typeof e.body==`string`?u=(0,r.beginCell)().storeUint(0,32).storeStringTail(e.body).endCell():e.body&&(u=e.body),{info:{type:`internal`,dest:s,value:{coins:c,other:l},bounce:o,ihrDisabled:!0,bounced:!1,ihrFee:0n,forwardFee:0n,createdAt:0,createdLt:0n},init:e.init??void 0,body:u}}e.internal=o;function s(e){let r;if(typeof e.to==`string`)r=t.Address.parse(e.to);else if(t.Address.isAddress(e.to))r=e.to;else throw Error(`Invalid address ${e.to}`);return{info:{type:`external-in`,dest:r,importFee:0n},init:e.init??void 0,body:e.body||n.Cell.EMPTY}}e.external=s;function c(e){return(0,r.beginCell)().storeUint(0,32).storeStringTail(e).endCell()}e.comment=c})),Wc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccountState=e.loadAccountState=void 0;var t=Ic();function n(e){return e.loadBit()?{type:`active`,state:(0,t.loadStateInit)(e)}:e.loadBit()?{type:`frozen`,stateHash:e.loadUintBig(256)}:{type:`uninit`}}e.loadAccountState=n;function r(e){return n=>{e.type===`active`?(n.storeBit(!0),n.store((0,t.storeStateInit)(e.state))):e.type===`frozen`?(n.storeBit(!1),n.storeBit(!0),n.storeUint(e.stateHash,256)):e.type===`uninit`&&(n.storeBit(!1),n.storeBit(!1))}}e.storeAccountState=r})),Gc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeCurrencyCollection=e.loadCurrencyCollection=void 0;var t=yc();function n(e){let n=e.loadCoins(),r=e.loadDict(t.Dictionary.Keys.Uint(32),t.Dictionary.Values.BigVarUint(5));return r.size===0?{coins:n}:{other:r,coins:n}}e.loadCurrencyCollection=n;function r(e){return t=>{t.storeCoins(e.coins),e.other?t.storeDict(e.other):t.storeBit(0)}}e.storeCurrencyCollection=r})),Kc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccountStorage=e.loadAccountStorage=void 0;var t=Wc(),n=Gc();function r(e){return{lastTransLt:e.loadUintBig(64),balance:(0,n.loadCurrencyCollection)(e),state:(0,t.loadAccountState)(e)}}e.loadAccountStorage=r;function i(e){return r=>{r.storeUint(e.lastTransLt,64),r.store((0,n.storeCurrencyCollection)(e.balance)),r.store((0,t.storeAccountState)(e.state))}}e.storeAccountStorage=i})),qc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeStorageExtraInfo=e.loadStorageExtraInfo=void 0;function t(e){let t=e.loadUint(3);if(t===0)return null;if(t===1)return{dictHash:e.loadUintBig(256)};throw Error(`Invalid storage extra info header: ${t}`)}e.loadStorageExtraInfo=t;function n(e){return t=>{e==null?t.storeUint(0,3):(t.storeUint(1,3),t.storeUint(e.dictHash,256))}}e.storeStorageExtraInfo=n})),Jc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeStorageUsed=e.loadStorageUsed=void 0;function t(e){return{cells:e.loadVarUintBig(3),bits:e.loadVarUintBig(3)}}e.loadStorageUsed=t;function n(e){return t=>{t.storeVarUint(e.cells,3),t.storeVarUint(e.bits,3)}}e.storeStorageUsed=n})),Yc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeStorageInfo=e.loadStorageInfo=void 0;var t=qc(),n=Jc();function r(e){return{used:(0,n.loadStorageUsed)(e),storageExtra:(0,t.loadStorageExtraInfo)(e),lastPaid:e.loadUint(32),duePayment:e.loadMaybeCoins()}}e.loadStorageInfo=r;function i(e){return r=>{r.store((0,n.storeStorageUsed)(e.used)),r.store((0,t.storeStorageExtraInfo)(e.storageExtra)),r.storeUint(e.lastPaid,32),r.storeMaybeCoins(e.duePayment)}}e.storeStorageInfo=i})),Xc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccount=e.loadAccount=void 0;var t=Kc(),n=Yc();function r(e){return{addr:e.loadAddress(),storageStats:(0,n.loadStorageInfo)(e),storage:(0,t.loadAccountStorage)(e)}}e.loadAccount=r;function i(e){return r=>{r.storeAddress(e.addr),r.store((0,n.storeStorageInfo)(e.storageStats)),r.store((0,t.storeAccountStorage)(e.storage))}}e.storeAccount=i})),Zc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccountStatus=e.loadAccountStatus=void 0;function t(e){let t=e.loadUint(2);if(t===0)return`uninitialized`;if(t===1)return`frozen`;if(t===2)return`active`;if(t===3)return`non-existing`;throw Error(`Invalid data`)}e.loadAccountStatus=t;function n(e){return t=>{if(e===`uninitialized`)t.storeUint(0,2);else if(e===`frozen`)t.storeUint(1,2);else if(e===`active`)t.storeUint(2,2);else if(e===`non-existing`)t.storeUint(3,2);else throw Error(`Invalid data`);return t}}e.storeAccountStatus=n})),Qc=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccountStatusChange=e.loadAccountStatusChange=void 0;function t(e){return e.loadBit()?e.loadBit()?`deleted`:`frozen`:`unchanged`}e.loadAccountStatusChange=t;function n(e){return t=>{if(e==`unchanged`)t.storeBit(0);else if(e===`frozen`)t.storeBit(1),t.storeBit(0);else if(e===`deleted`)t.storeBit(1),t.storeBit(1);else throw Error(`Invalid account status change`)}}e.storeAccountStatusChange=n})),$c=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeCommonMessageInfoRelaxed=e.loadCommonMessageInfoRelaxed=void 0;var t=Gc();function n(e){if(!e.loadBit())return{type:`internal`,ihrDisabled:e.loadBit(),bounce:e.loadBit(),bounced:e.loadBit(),src:e.loadMaybeAddress(),dest:e.loadAddress(),value:(0,t.loadCurrencyCollection)(e),ihrFee:e.loadCoins(),forwardFee:e.loadCoins(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)};if(!e.loadBit())throw Error(`External In message is not possible for CommonMessageInfoRelaxed`);return{type:`external-out`,src:e.loadMaybeAddress(),dest:e.loadMaybeExternalAddress(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)}}e.loadCommonMessageInfoRelaxed=n;function r(e){return n=>{if(e.type===`internal`)n.storeBit(0),n.storeBit(e.ihrDisabled),n.storeBit(e.bounce),n.storeBit(e.bounced),n.storeAddress(e.src),n.storeAddress(e.dest),n.store((0,t.storeCurrencyCollection)(e.value)),n.storeCoins(e.ihrFee),n.storeCoins(e.forwardFee),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else if(e.type===`external-out`)n.storeBit(1),n.storeBit(1),n.storeAddress(e.src),n.storeAddress(e.dest),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else throw Error(`Unknown CommonMessageInfo type`)}}e.storeCommonMessageInfoRelaxed=r})),el=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeMessageRelaxed=e.loadMessageRelaxed=void 0;var t=Q(),n=$c(),r=Ic();function i(e){let t=(0,n.loadCommonMessageInfoRelaxed)(e),i=null;e.loadBit()&&(i=e.loadBit()?(0,r.loadStateInit)(e.loadRef().beginParse()):(0,r.loadStateInit)(e));let a=e.loadBit()?e.loadRef():e.asCell();return{info:t,init:i,body:a}}e.loadMessageRelaxed=i;function a(e,i){return a=>{if(a.store((0,n.storeCommonMessageInfoRelaxed)(e.info)),e.init){a.storeBit(!0);let n=(0,t.beginCell)().store((0,r.storeStateInit)(e.init)),o=!1;o=i&&i.forceRef?!0:!(a.availableBits-2>=n.bits),o?(a.storeBit(!0),a.storeRef(n)):(a.storeBit(!1),a.storeBuilder(n))}else a.storeBit(!1);let o=!1;o=i&&i.forceRef?!0:!(a.availableBits-1>=e.body.bits.length&&a.refs+e.body.refs.length<=4&&!e.body.isExotic),o?(a.storeBit(!0),a.storeRef(e.body)):(a.storeBit(!1),a.storeBuilder(e.body.asBuilder()))}}e.storeMessageRelaxed=a})),tl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeLibRef=e.loadLibRef=void 0;function t(e){return e.loadUint(1)===0?{type:`hash`,libHash:e.loadBuffer(32)}:{type:`ref`,library:e.loadRef()}}e.loadLibRef=t;function n(e){return t=>{e.type===`hash`?(t.storeUint(0,1),t.storeBuffer(e.libHash)):(t.storeUint(1,1),t.storeRef(e.library))}}e.storeLibRef=n})),nl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.loadOutList=e.storeOutList=e.loadOutAction=e.storeOutAction=void 0;var t=el(),n=Q(),r=Gc(),i=tl();function a(e){switch(e.type){case`sendMsg`:return s(e);case`setCode`:return l(e);case`reserve`:return d(e);case`changeLibrary`:return p(e);default:throw Error(`Unknown action type ${e.type}`)}}e.storeOutAction=a;var o=247711853;function s(e){return r=>{r.storeUint(o,32).storeUint(e.mode,8).storeRef((0,n.beginCell)().store((0,t.storeMessageRelaxed)(e.outMsg)).endCell())}}var c=2907562126;function l(e){return t=>{t.storeUint(c,32).storeRef(e.newCode)}}var u=921090057;function d(e){return t=>{t.storeUint(u,32).storeUint(e.mode,8).store((0,r.storeCurrencyCollection)(e.currency))}}var f=653925844;function p(e){return t=>{t.storeUint(f,32).storeUint(e.mode,7).store((0,i.storeLibRef)(e.libRef))}}function m(e){let n=e.loadUint(32);if(n===o)return{type:`sendMsg`,mode:e.loadUint(8),outMsg:(0,t.loadMessageRelaxed)(e.loadRef().beginParse())};if(n===c)return{type:`setCode`,newCode:e.loadRef()};if(n===u)return{type:`reserve`,mode:e.loadUint(8),currency:(0,r.loadCurrencyCollection)(e)};if(n===f)return{type:`changeLibrary`,mode:e.loadUint(7),libRef:(0,i.loadLibRef)(e)};throw Error(`Unknown out action tag 0x${n.toString(16)}`)}e.loadOutAction=m;function h(e){let t=e.reduce((e,t)=>(0,n.beginCell)().storeRef(e).store(a(t)).endCell(),(0,n.beginCell)().endCell());return e=>{e.storeSlice(t.beginParse())}}e.storeOutList=h;function g(e){let t=[];for(;e.remainingRefs;){let n=e.loadRef();t.push(m(e)),e=n.beginParse()}return t.reverse()}e.loadOutList=g})),rl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeCommonMessageInfo=e.loadCommonMessageInfo=void 0;var t=Gc();function n(e){return e.loadBit()?e.loadBit()?{type:`external-out`,src:e.loadAddress(),dest:e.loadMaybeExternalAddress(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)}:{type:`external-in`,src:e.loadMaybeExternalAddress(),dest:e.loadAddress(),importFee:e.loadCoins()}:{type:`internal`,ihrDisabled:e.loadBit(),bounce:e.loadBit(),bounced:e.loadBit(),src:e.loadAddress(),dest:e.loadAddress(),value:(0,t.loadCurrencyCollection)(e),ihrFee:e.loadCoins(),forwardFee:e.loadCoins(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)}}e.loadCommonMessageInfo=n;function r(e){return n=>{if(e.type===`internal`)n.storeBit(0),n.storeBit(e.ihrDisabled),n.storeBit(e.bounce),n.storeBit(e.bounced),n.storeAddress(e.src),n.storeAddress(e.dest),n.store((0,t.storeCurrencyCollection)(e.value)),n.storeCoins(e.ihrFee),n.storeCoins(e.forwardFee),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else if(e.type===`external-in`)n.storeBit(1),n.storeBit(0),n.storeAddress(e.src),n.storeAddress(e.dest),n.storeCoins(e.importFee);else if(e.type===`external-out`)n.storeBit(1),n.storeBit(1),n.storeAddress(e.src),n.storeAddress(e.dest),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else throw Error(`Unknown CommonMessageInfo type`)}}e.storeCommonMessageInfo=r})),il=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeComputeSkipReason=e.loadComputeSkipReason=void 0;function t(e){let t=e.loadUint(2);if(t===0)return`no-state`;if(t===1)return`bad-state`;if(t===2)return`no-gas`;throw Error(`Unknown ComputeSkipReason: ${t}`)}e.loadComputeSkipReason=t;function n(e){return t=>{if(e===`no-state`)t.storeUint(0,2);else if(e===`bad-state`)t.storeUint(1,2);else if(e===`no-gas`)t.storeUint(2,2);else throw Error(`Unknown ComputeSkipReason: ${e}`)}}e.storeComputeSkipReason=n})),al=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeDepthBalanceInfo=e.loadDepthBalanceInfo=void 0;var t=Gc();function n(e){return{splitDepth:e.loadUint(5),balance:(0,t.loadCurrencyCollection)(e)}}e.loadDepthBalanceInfo=n;function r(e){return n=>{n.storeUint(e.splitDepth,5),n.store((0,t.storeCurrencyCollection)(e.balance))}}e.storeDepthBalanceInfo=r})),ol=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeHashUpdate=e.loadHashUpdate=void 0;function t(e){if(e.loadUint(8)!==114)throw Error(`Invalid data`);return{oldHash:e.loadBuffer(32),newHash:e.loadBuffer(32)}}e.loadHashUpdate=t;function n(e){return t=>{t.storeUint(114,8),t.storeBuffer(e.oldHash),t.storeBuffer(e.newHash)}}e.storeHashUpdate=n})),sl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.loadMasterchainStateExtra=void 0;var t=yc(),n=Gc();function r(e){if(e.loadUint(16)!==52262)throw Error(`Invalid data`);e.loadBit()&&e.loadRef();let r=e.loadUintBig(256);return{config:t.Dictionary.load(t.Dictionary.Keys.Int(32),t.Dictionary.Values.Cell(),e),configAddress:r,globalBalance:(0,n.loadCurrencyCollection)(e)}}e.loadMasterchainStateExtra=r})),cl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MessageValue=e.storeMessage=e.loadMessage=void 0;var t=Q(),n=rl(),r=Ic();function i(e){let t=(0,n.loadCommonMessageInfo)(e),i=null;e.loadBit()&&(i=e.loadBit()?(0,r.loadStateInit)(e.loadRef().beginParse()):(0,r.loadStateInit)(e));let a=e.loadBit()?e.loadRef():e.asCell();return{info:t,init:i,body:a}}e.loadMessage=i;function a(e,i){return a=>{if(a.store((0,n.storeCommonMessageInfo)(e.info)),e.init){a.storeBit(!0);let n=(0,t.beginCell)().store((0,r.storeStateInit)(e.init)),o=!1;o=i&&i.forceRef?!0:a.availableBits-2<n.bits+e.body.bits.length,o?(a.storeBit(!0),a.storeRef(n)):(a.storeBit(!1),a.storeBuilder(n))}else a.storeBit(!1);let o=!1;o=i&&i.forceRef?!0:a.availableBits-1<e.body.bits.length||a.refs+e.body.refs.length>4,o?(a.storeBit(!0),a.storeRef(e.body)):(a.storeBit(!1),a.storeBuilder(e.body.asBuilder()))}}e.storeMessage=a,e.MessageValue={serialize(e,n){n.storeRef((0,t.beginCell)().store(a(e)))},parse(e){return i(e.loadRef().beginParse())}}})),ll=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SendMode=void 0;var t;(function(e){e[e.CARRY_ALL_REMAINING_BALANCE=128]=`CARRY_ALL_REMAINING_BALANCE`,e[e.CARRY_ALL_REMAINING_INCOMING_VALUE=64]=`CARRY_ALL_REMAINING_INCOMING_VALUE`,e[e.DESTROY_ACCOUNT_IF_ZERO=32]=`DESTROY_ACCOUNT_IF_ZERO`,e[e.PAY_GAS_SEPARATELY=1]=`PAY_GAS_SEPARATELY`,e[e.IGNORE_ERRORS=2]=`IGNORE_ERRORS`,e[e.NONE=0]=`NONE`})(t||(e.SendMode=t={}))})),ul=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReserveMode=void 0;var t;(function(e){e[e.THIS_AMOUNT=0]=`THIS_AMOUNT`,e[e.LEAVE_THIS_AMOUNT=1]=`LEAVE_THIS_AMOUNT`,e[e.AT_MOST_THIS_AMOUNT=2]=`AT_MOST_THIS_AMOUNT`,e[e.LEAVE_MAX_THIS_AMOUNT=3]=`LEAVE_MAX_THIS_AMOUNT`,e[e.BEFORE_BALANCE_PLUS_THIS_AMOUNT=4]=`BEFORE_BALANCE_PLUS_THIS_AMOUNT`,e[e.LEAVE_BBALANCE_PLUS_THIS_AMOUNT=5]=`LEAVE_BBALANCE_PLUS_THIS_AMOUNT`,e[e.BEFORE_BALANCE_MINUS_THIS_AMOUNT=12]=`BEFORE_BALANCE_MINUS_THIS_AMOUNT`,e[e.LEAVE_BEFORE_BALANCE_MINUS_THIS_AMOUNT=13]=`LEAVE_BEFORE_BALANCE_MINUS_THIS_AMOUNT`})(t||(e.ReserveMode=t={}))})),dl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeShardAccount=e.loadShardAccount=void 0;var t=Q(),n=Xc();function r(e){let t=e.loadRef(),r;if(!t.isExotic){let e=t.beginParse();e.loadBit()&&(r=(0,n.loadAccount)(e))}return{account:r,lastTransactionHash:e.loadUintBig(256),lastTransactionLt:e.loadUintBig(64)}}e.loadShardAccount=r;function i(e){return r=>{e.account?r.storeRef((0,t.beginCell)().storeBit(!0).store((0,n.storeAccount)(e.account))):r.storeRef((0,t.beginCell)().storeBit(!1)),r.storeUint(e.lastTransactionHash,256),r.storeUint(e.lastTransactionLt,64)}}e.storeShardAccount=i})),fl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeShardAccounts=e.loadShardAccounts=e.ShardAccountRefValue=void 0;var t=yc(),n=al(),r=dl();e.ShardAccountRefValue={parse:e=>({depthBalanceInfo:(0,n.loadDepthBalanceInfo)(e),shardAccount:(0,r.loadShardAccount)(e)}),serialize(e,t){t.store((0,n.storeDepthBalanceInfo)(e.depthBalanceInfo)),t.store((0,r.storeShardAccount)(e.shardAccount))}};function i(n){return t.Dictionary.load(t.Dictionary.Keys.BigUint(256),e.ShardAccountRefValue,n)}e.loadShardAccounts=i;function a(e){return t=>{t.storeDict(e)}}e.storeShardAccounts=a})),pl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeShardIdent=e.loadShardIdent=void 0;function t(e){if(e.loadUint(2)!==0)throw Error(`Invalid data`);return{shardPrefixBits:e.loadUint(6),workchainId:e.loadInt(32),shardPrefix:e.loadUintBig(64)}}e.loadShardIdent=t;function n(e){return t=>{t.storeUint(0,2),t.storeUint(e.shardPrefixBits,6),t.storeInt(e.workchainId,32),t.storeUint(e.shardPrefix,64)}}e.storeShardIdent=n})),ml=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.loadShardStateUnsplit=void 0;var t=sl(),n=fl(),r=pl();function i(e){if(e.loadUint(32)!==2418257890)throw Error(`Invalid data`);let i=e.loadInt(32),a=(0,r.loadShardIdent)(e),o=e.loadUint(32),s=e.loadUint(32),c=e.loadUint(32),l=e.loadUintBig(64),u=e.loadUint(32);e.loadRef();let d=e.loadBit(),f=e.loadRef(),p;f.isExotic||(p=(0,n.loadShardAccounts)(f.beginParse())),e.loadRef();let m=e.loadBit(),h=null;if(m){let n=e.loadRef();n.isExotic||(h=(0,t.loadMasterchainStateExtra)(n.beginParse()))}return{globalId:i,shardId:a,seqno:o,vertSeqNo:s,genUtime:c,genLt:l,minRefMcSeqno:u,beforeSplit:d,accounts:p,extras:h}}e.loadShardStateUnsplit=i})),hl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeSplitMergeInfo=e.loadSplitMergeInfo=void 0;function t(e){return{currentShardPrefixLength:e.loadUint(6),accountSplitDepth:e.loadUint(6),thisAddress:e.loadUintBig(256),siblingAddress:e.loadUintBig(256)}}e.loadSplitMergeInfo=t;function n(e){return t=>{t.storeUint(e.currentShardPrefixLength,6),t.storeUint(e.accountSplitDepth,6),t.storeUint(e.thisAddress,256),t.storeUint(e.siblingAddress,256)}}e.storeSplitMergeInfo=n})),gl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionActionPhase=e.loadTransactionActionPhase=void 0;var t=Qc(),n=Jc();function r(e){return{success:e.loadBit(),valid:e.loadBit(),noFunds:e.loadBit(),statusChange:(0,t.loadAccountStatusChange)(e),totalFwdFees:e.loadBit()?e.loadCoins():void 0,totalActionFees:e.loadBit()?e.loadCoins():void 0,resultCode:e.loadInt(32),resultArg:e.loadBit()?e.loadInt(32):void 0,totalActions:e.loadUint(16),specActions:e.loadUint(16),skippedActions:e.loadUint(16),messagesCreated:e.loadUint(16),actionListHash:e.loadUintBig(256),totalMessageSize:(0,n.loadStorageUsed)(e)}}e.loadTransactionActionPhase=r;function i(e){return r=>{r.storeBit(e.success),r.storeBit(e.valid),r.storeBit(e.noFunds),r.store((0,t.storeAccountStatusChange)(e.statusChange)),r.storeMaybeCoins(e.totalFwdFees),r.storeMaybeCoins(e.totalActionFees),r.storeInt(e.resultCode,32),r.storeMaybeInt(e.resultArg,32),r.storeUint(e.totalActions,16),r.storeUint(e.specActions,16),r.storeUint(e.skippedActions,16),r.storeUint(e.messagesCreated,16),r.storeUint(e.actionListHash,256),r.store((0,n.storeStorageUsed)(e.totalMessageSize))}}e.storeTransactionActionPhase=i})),_l=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionBouncePhase=e.loadTransactionBouncePhase=void 0;var t=Jc();function n(e){return e.loadBit()?{type:`ok`,messageSize:(0,t.loadStorageUsed)(e),messageFees:e.loadCoins(),forwardFees:e.loadCoins()}:e.loadBit()?{type:`no-funds`,messageSize:(0,t.loadStorageUsed)(e),requiredForwardFees:e.loadCoins()}:{type:`negative-funds`}}e.loadTransactionBouncePhase=n;function r(e){return n=>{if(e.type===`ok`)n.storeBit(!0),n.store((0,t.storeStorageUsed)(e.messageSize)),n.storeCoins(e.messageFees),n.storeCoins(e.forwardFees);else if(e.type===`negative-funds`)n.storeBit(!1),n.storeBit(!1);else if(e.type===`no-funds`)n.storeBit(!1),n.storeBit(!0),n.store((0,t.storeStorageUsed)(e.messageSize)),n.storeCoins(e.requiredForwardFees);else throw Error(`Invalid TransactionBouncePhase type`)}}e.storeTransactionBouncePhase=r})),vl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionComputePhase=e.loadTransactionComputePhase=void 0;var t=Q(),n=il();function r(e){if(!e.loadBit())return{type:`skipped`,reason:(0,n.loadComputeSkipReason)(e)};let t=e.loadBit(),r=e.loadBit(),i=e.loadBit(),a=e.loadCoins(),o=e.loadRef().beginParse();return{type:`vm`,success:t,messageStateUsed:r,accountActivated:i,gasFees:a,gasUsed:o.loadVarUintBig(3),gasLimit:o.loadVarUintBig(3),gasCredit:o.loadBit()?o.loadVarUintBig(2):void 0,mode:o.loadUint(8),exitCode:o.loadInt(32),exitArg:o.loadBit()?o.loadInt(32):void 0,vmSteps:o.loadUint(32),vmInitStateHash:o.loadUintBig(256),vmFinalStateHash:o.loadUintBig(256)}}e.loadTransactionComputePhase=r;function i(e){return r=>{if(e.type===`skipped`){r.storeBit(0),r.store((0,n.storeComputeSkipReason)(e.reason));return}r.storeBit(1),r.storeBit(e.success),r.storeBit(e.messageStateUsed),r.storeBit(e.accountActivated),r.storeCoins(e.gasFees),r.storeRef((0,t.beginCell)().storeVarUint(e.gasUsed,3).storeVarUint(e.gasLimit,3).store(t=>e.gasCredit!==void 0&&e.gasCredit!==null?t.storeBit(1).storeVarUint(e.gasCredit,2):t.storeBit(0)).storeUint(e.mode,8).storeInt(e.exitCode,32).store(t=>e.exitArg!==void 0&&e.exitArg!==null?t.storeBit(1).storeInt(e.exitArg,32):t.storeBit(0)).storeUint(e.vmSteps,32).storeUint(e.vmInitStateHash,256).storeUint(e.vmFinalStateHash,256).endCell())}}e.storeTransactionComputePhase=i})),yl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionCreditPhase=e.loadTransactionCreditPhase=void 0;var t=Gc();function n(e){return{dueFeesColelcted:e.loadBit()?e.loadCoins():void 0,credit:(0,t.loadCurrencyCollection)(e)}}e.loadTransactionCreditPhase=n;function r(e){return n=>{e.dueFeesColelcted===null||e.dueFeesColelcted===void 0?n.storeBit(!1):(n.storeBit(!0),n.storeCoins(e.dueFeesColelcted)),n.store((0,t.storeCurrencyCollection)(e.credit))}}e.storeTransactionCreditPhase=r})),bl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionsStoragePhase=e.loadTransactionStoragePhase=void 0;var t=Qc();function n(e){let n=e.loadCoins(),r;e.loadBit()&&(r=e.loadCoins());let i=(0,t.loadAccountStatusChange)(e);return{storageFeesCollected:n,storageFeesDue:r,statusChange:i}}e.loadTransactionStoragePhase=n;function r(e){return n=>{n.storeCoins(e.storageFeesCollected),e.storageFeesDue===null||e.storageFeesDue===void 0?n.storeBit(!1):(n.storeBit(!0),n.storeCoins(e.storageFeesDue)),n.store((0,t.storeAccountStatusChange)(e.statusChange))}}e.storeTransactionsStoragePhase=r})),xl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionDescription=e.loadTransactionDescription=void 0;var t=Q(),n=hl(),r=Sl(),i=gl(),a=_l(),o=vl(),s=yl(),c=bl();function l(e){let t=e.loadUint(4);if(t===0){let t=e.loadBit(),n;e.loadBit()&&(n=(0,c.loadTransactionStoragePhase)(e));let r;e.loadBit()&&(r=(0,s.loadTransactionCreditPhase)(e));let l=(0,o.loadTransactionComputePhase)(e),u;e.loadBit()&&(u=(0,i.loadTransactionActionPhase)(e.loadRef().beginParse()));let d=e.loadBit(),f;e.loadBit()&&(f=(0,a.loadTransactionBouncePhase)(e));let p=e.loadBit();return{type:`generic`,creditFirst:t,storagePhase:n,creditPhase:r,computePhase:l,actionPhase:u,bouncePhase:f,aborted:d,destroyed:p}}if(t===1)return{type:`storage`,storagePhase:(0,c.loadTransactionStoragePhase)(e)};if(t===2||t===3){let n=t===3,r=(0,c.loadTransactionStoragePhase)(e),a=(0,o.loadTransactionComputePhase)(e),s;e.loadBit()&&(s=(0,i.loadTransactionActionPhase)(e.loadRef().beginParse()));let l=e.loadBit(),u=e.loadBit();return{type:`tick-tock`,isTock:n,storagePhase:r,computePhase:a,actionPhase:s,aborted:l,destroyed:u}}if(t===4){let t=(0,n.loadSplitMergeInfo)(e),r;e.loadBit()&&(r=(0,c.loadTransactionStoragePhase)(e));let a=(0,o.loadTransactionComputePhase)(e),s;e.loadBit()&&(s=(0,i.loadTransactionActionPhase)(e.loadRef().beginParse()));let l=e.loadBit(),u=e.loadBit();return{type:`split-prepare`,splitInfo:t,storagePhase:r,computePhase:a,actionPhase:s,aborted:l,destroyed:u}}if(t===5)return{type:`split-install`,splitInfo:(0,n.loadSplitMergeInfo)(e),prepareTransaction:(0,r.loadTransaction)(e.loadRef().beginParse()),installed:e.loadBit()};throw Error(`Unsupported transaction description type ${t}`)}e.loadTransactionDescription=l;function u(e){return l=>{if(e.type===`generic`)l.storeUint(0,4),l.storeBit(e.creditFirst),e.storagePhase?(l.storeBit(!0),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase))):l.storeBit(!1),e.creditPhase?(l.storeBit(!0),l.store((0,s.storeTransactionCreditPhase)(e.creditPhase))):l.storeBit(!1),l.store((0,o.storeTransactionComputePhase)(e.computePhase)),e.actionPhase?(l.storeBit(!0),l.storeRef((0,t.beginCell)().store((0,i.storeTransactionActionPhase)(e.actionPhase)))):l.storeBit(!1),l.storeBit(e.aborted),e.bouncePhase?(l.storeBit(!0),l.store((0,a.storeTransactionBouncePhase)(e.bouncePhase))):l.storeBit(!1),l.storeBit(e.destroyed);else if(e.type===`storage`)l.storeUint(1,4),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase));else if(e.type===`tick-tock`)l.storeUint(e.isTock?3:2,4),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase)),l.store((0,o.storeTransactionComputePhase)(e.computePhase)),e.actionPhase?(l.storeBit(!0),l.storeRef((0,t.beginCell)().store((0,i.storeTransactionActionPhase)(e.actionPhase)))):l.storeBit(!1),l.storeBit(e.aborted),l.storeBit(e.destroyed);else if(e.type===`split-prepare`)l.storeUint(4,4),l.store((0,n.storeSplitMergeInfo)(e.splitInfo)),e.storagePhase?(l.storeBit(!0),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase))):l.storeBit(!1),l.store((0,o.storeTransactionComputePhase)(e.computePhase)),e.actionPhase?(l.storeBit(!0),l.store((0,i.storeTransactionActionPhase)(e.actionPhase))):l.storeBit(!1),l.storeBit(e.aborted),l.storeBit(e.destroyed);else if(e.type===`split-install`)l.storeUint(5,4),l.store((0,n.storeSplitMergeInfo)(e.splitInfo)),l.storeRef((0,t.beginCell)().store((0,r.storeTransaction)(e.prepareTransaction))),l.storeBit(e.installed);else throw Error(`Unsupported transaction description type ${e.type}`)}}e.storeTransactionDescription=u})),Sl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransaction=e.loadTransaction=void 0;var t=Q(),n=yc(),r=Zc(),i=Gc(),a=ol(),o=cl(),s=xl();function c(e){let t=e.asCell();if(e.loadUint(4)!==7)throw Error(`Invalid data`);let c=e.loadUintBig(256),l=e.loadUintBig(64),u=e.loadUintBig(256),d=e.loadUintBig(64),f=e.loadUint(32),p=e.loadUint(15),m=(0,r.loadAccountStatus)(e),h=(0,r.loadAccountStatus)(e),g=e.loadRef().beginParse(),_=g.loadBit()?(0,o.loadMessage)(g.loadRef().beginParse()):void 0,v=g.loadDict(n.Dictionary.Keys.Uint(15),o.MessageValue);return g.endParse(),{address:c,lt:l,prevTransactionHash:u,prevTransactionLt:d,now:f,outMessagesCount:p,oldStatus:m,endStatus:h,inMessage:_,outMessages:v,totalFees:(0,i.loadCurrencyCollection)(e),stateUpdate:(0,a.loadHashUpdate)(e.loadRef().beginParse()),description:(0,s.loadTransactionDescription)(e.loadRef().beginParse()),raw:t,hash:()=>t.hash()}}e.loadTransaction=c;function l(e){return n=>{n.storeUint(7,4),n.storeUint(e.address,256),n.storeUint(e.lt,64),n.storeUint(e.prevTransactionHash,256),n.storeUint(e.prevTransactionLt,64),n.storeUint(e.now,32),n.storeUint(e.outMessagesCount,15),n.store((0,r.storeAccountStatus)(e.oldStatus)),n.store((0,r.storeAccountStatus)(e.endStatus));let c=(0,t.beginCell)();e.inMessage?(c.storeBit(!0),c.storeRef((0,t.beginCell)().store((0,o.storeMessage)(e.inMessage)))):c.storeBit(!1),c.storeDict(e.outMessages),n.storeRef(c),n.store((0,i.storeCurrencyCollection)(e.totalFees)),n.storeRef((0,t.beginCell)().store((0,a.storeHashUpdate)(e.stateUpdate))),n.storeRef((0,t.beginCell)().store((0,s.storeTransactionDescription)(e.description)))}}e.storeTransaction=l})),Cl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.loadSimpleLibrary=e.loadShardStateUnsplit=e.storeShardIdent=e.loadShardIdent=e.storeShardAccounts=e.loadShardAccounts=e.ShardAccountRefValue=e.storeShardAccount=e.loadShardAccount=e.ReserveMode=e.SendMode=e.storeMessageRelaxed=e.loadMessageRelaxed=e.storeMessage=e.loadMessage=e.loadMasterchainStateExtra=e.storeHashUpdate=e.loadHashUpdate=e.storeExtraCurrency=e.loadMaybeExtraCurrency=e.loadExtraCurrency=e.packExtraCurrencyDict=e.packExtraCurrencyCell=e.storeDepthBalanceInfo=e.loadDepthBalanceInfo=e.storeCurrencyCollection=e.loadCurrencyCollection=e.storeComputeSkipReason=e.loadComputeSkipReason=e.storeCommonMessageInfoRelaxed=e.loadCommonMessageInfoRelaxed=e.storeCommonMessageInfo=e.loadCommonMessageInfo=e.storeOutList=e.loadOutList=e.storeOutAction=e.loadOutAction=e.storeAccountStorage=e.loadAccountStorage=e.storeAccountStatusChange=e.loadAccountStatusChange=e.storeAccountStatus=e.loadAccountStatus=e.storeAccountState=e.loadAccountState=e.storeAccount=e.loadAccount=e.comment=e.external=e.internal=void 0,e.storeTransactionsStoragePhase=e.loadTransactionStoragePhase=e.storeTransactionDescription=e.loadTransactionDescription=e.storeTransactionCreditPhase=e.loadTransactionCreditPhase=e.storeTransactionComputePhase=e.loadTransactionComputePhase=e.storeTransactionBouncePhase=e.loadTransactionBouncePhase=e.storeTransactionActionPhase=e.loadTransactionActionPhase=e.storeTransaction=e.loadTransaction=e.storeTickTock=e.loadTickTock=e.storeStorageUsed=e.loadStorageUsed=e.storeStorageInfo=e.loadStorageInfo=e.storeStateInit=e.loadStateInit=e.storeSplitMergeInfo=e.loadSplitMergeInfo=e.storeLibRef=e.loadLibRef=e.storeSimpleLibrary=void 0;var t=Uc();Object.defineProperty(e,"internal",{enumerable:!0,get:function(){return t.internal}}),Object.defineProperty(e,"external",{enumerable:!0,get:function(){return t.external}}),Object.defineProperty(e,"comment",{enumerable:!0,get:function(){return t.comment}});var n=Xc();Object.defineProperty(e,"loadAccount",{enumerable:!0,get:function(){return n.loadAccount}}),Object.defineProperty(e,"storeAccount",{enumerable:!0,get:function(){return n.storeAccount}});var r=Wc();Object.defineProperty(e,"loadAccountState",{enumerable:!0,get:function(){return r.loadAccountState}}),Object.defineProperty(e,"storeAccountState",{enumerable:!0,get:function(){return r.storeAccountState}});var i=Zc();Object.defineProperty(e,"loadAccountStatus",{enumerable:!0,get:function(){return i.loadAccountStatus}}),Object.defineProperty(e,"storeAccountStatus",{enumerable:!0,get:function(){return i.storeAccountStatus}});var a=Qc();Object.defineProperty(e,"loadAccountStatusChange",{enumerable:!0,get:function(){return a.loadAccountStatusChange}}),Object.defineProperty(e,"storeAccountStatusChange",{enumerable:!0,get:function(){return a.storeAccountStatusChange}});var o=Kc();Object.defineProperty(e,"loadAccountStorage",{enumerable:!0,get:function(){return o.loadAccountStorage}}),Object.defineProperty(e,"storeAccountStorage",{enumerable:!0,get:function(){return o.storeAccountStorage}});var s=nl();Object.defineProperty(e,"loadOutAction",{enumerable:!0,get:function(){return s.loadOutAction}}),Object.defineProperty(e,"storeOutAction",{enumerable:!0,get:function(){return s.storeOutAction}}),Object.defineProperty(e,"loadOutList",{enumerable:!0,get:function(){return s.loadOutList}}),Object.defineProperty(e,"storeOutList",{enumerable:!0,get:function(){return s.storeOutList}});var c=rl();Object.defineProperty(e,"loadCommonMessageInfo",{enumerable:!0,get:function(){return c.loadCommonMessageInfo}}),Object.defineProperty(e,"storeCommonMessageInfo",{enumerable:!0,get:function(){return c.storeCommonMessageInfo}});var l=$c();Object.defineProperty(e,"loadCommonMessageInfoRelaxed",{enumerable:!0,get:function(){return l.loadCommonMessageInfoRelaxed}}),Object.defineProperty(e,"storeCommonMessageInfoRelaxed",{enumerable:!0,get:function(){return l.storeCommonMessageInfoRelaxed}});var u=il();Object.defineProperty(e,"loadComputeSkipReason",{enumerable:!0,get:function(){return u.loadComputeSkipReason}}),Object.defineProperty(e,"storeComputeSkipReason",{enumerable:!0,get:function(){return u.storeComputeSkipReason}});var d=Gc();Object.defineProperty(e,"loadCurrencyCollection",{enumerable:!0,get:function(){return d.loadCurrencyCollection}}),Object.defineProperty(e,"storeCurrencyCollection",{enumerable:!0,get:function(){return d.storeCurrencyCollection}});var f=al();Object.defineProperty(e,"loadDepthBalanceInfo",{enumerable:!0,get:function(){return f.loadDepthBalanceInfo}}),Object.defineProperty(e,"storeDepthBalanceInfo",{enumerable:!0,get:function(){return f.storeDepthBalanceInfo}});var p=Hc();Object.defineProperty(e,"packExtraCurrencyCell",{enumerable:!0,get:function(){return p.packExtraCurrencyCell}}),Object.defineProperty(e,"packExtraCurrencyDict",{enumerable:!0,get:function(){return p.packExtraCurrencyDict}}),Object.defineProperty(e,"loadExtraCurrency",{enumerable:!0,get:function(){return p.loadExtraCurrency}}),Object.defineProperty(e,"loadMaybeExtraCurrency",{enumerable:!0,get:function(){return p.loadMaybeExtraCurrency}}),Object.defineProperty(e,"storeExtraCurrency",{enumerable:!0,get:function(){return p.storeExtraCurrency}});var m=ol();Object.defineProperty(e,"loadHashUpdate",{enumerable:!0,get:function(){return m.loadHashUpdate}}),Object.defineProperty(e,"storeHashUpdate",{enumerable:!0,get:function(){return m.storeHashUpdate}});var h=sl();Object.defineProperty(e,"loadMasterchainStateExtra",{enumerable:!0,get:function(){return h.loadMasterchainStateExtra}});var g=cl();Object.defineProperty(e,"loadMessage",{enumerable:!0,get:function(){return g.loadMessage}}),Object.defineProperty(e,"storeMessage",{enumerable:!0,get:function(){return g.storeMessage}});var _=el();Object.defineProperty(e,"loadMessageRelaxed",{enumerable:!0,get:function(){return _.loadMessageRelaxed}}),Object.defineProperty(e,"storeMessageRelaxed",{enumerable:!0,get:function(){return _.storeMessageRelaxed}});var v=ll();Object.defineProperty(e,"SendMode",{enumerable:!0,get:function(){return v.SendMode}});var y=ul();Object.defineProperty(e,"ReserveMode",{enumerable:!0,get:function(){return y.ReserveMode}});var b=dl();Object.defineProperty(e,"loadShardAccount",{enumerable:!0,get:function(){return b.loadShardAccount}}),Object.defineProperty(e,"storeShardAccount",{enumerable:!0,get:function(){return b.storeShardAccount}});var x=fl();Object.defineProperty(e,"ShardAccountRefValue",{enumerable:!0,get:function(){return x.ShardAccountRefValue}}),Object.defineProperty(e,"loadShardAccounts",{enumerable:!0,get:function(){return x.loadShardAccounts}}),Object.defineProperty(e,"storeShardAccounts",{enumerable:!0,get:function(){return x.storeShardAccounts}});var S=pl();Object.defineProperty(e,"loadShardIdent",{enumerable:!0,get:function(){return S.loadShardIdent}}),Object.defineProperty(e,"storeShardIdent",{enumerable:!0,get:function(){return S.storeShardIdent}});var C=ml();Object.defineProperty(e,"loadShardStateUnsplit",{enumerable:!0,get:function(){return C.loadShardStateUnsplit}});var ee=Pc();Object.defineProperty(e,"loadSimpleLibrary",{enumerable:!0,get:function(){return ee.loadSimpleLibrary}}),Object.defineProperty(e,"storeSimpleLibrary",{enumerable:!0,get:function(){return ee.storeSimpleLibrary}});var w=tl();Object.defineProperty(e,"loadLibRef",{enumerable:!0,get:function(){return w.loadLibRef}}),Object.defineProperty(e,"storeLibRef",{enumerable:!0,get:function(){return w.storeLibRef}});var te=hl();Object.defineProperty(e,"loadSplitMergeInfo",{enumerable:!0,get:function(){return te.loadSplitMergeInfo}}),Object.defineProperty(e,"storeSplitMergeInfo",{enumerable:!0,get:function(){return te.storeSplitMergeInfo}});var T=Ic();Object.defineProperty(e,"loadStateInit",{enumerable:!0,get:function(){return T.loadStateInit}}),Object.defineProperty(e,"storeStateInit",{enumerable:!0,get:function(){return T.storeStateInit}});var E=Yc();Object.defineProperty(e,"loadStorageInfo",{enumerable:!0,get:function(){return E.loadStorageInfo}}),Object.defineProperty(e,"storeStorageInfo",{enumerable:!0,get:function(){return E.storeStorageInfo}});var D=Jc();Object.defineProperty(e,"loadStorageUsed",{enumerable:!0,get:function(){return D.loadStorageUsed}}),Object.defineProperty(e,"storeStorageUsed",{enumerable:!0,get:function(){return D.storeStorageUsed}});var ne=Fc();Object.defineProperty(e,"loadTickTock",{enumerable:!0,get:function(){return ne.loadTickTock}}),Object.defineProperty(e,"storeTickTock",{enumerable:!0,get:function(){return ne.storeTickTock}});var re=Sl();Object.defineProperty(e,"loadTransaction",{enumerable:!0,get:function(){return re.loadTransaction}}),Object.defineProperty(e,"storeTransaction",{enumerable:!0,get:function(){return re.storeTransaction}});var ie=gl();Object.defineProperty(e,"loadTransactionActionPhase",{enumerable:!0,get:function(){return ie.loadTransactionActionPhase}}),Object.defineProperty(e,"storeTransactionActionPhase",{enumerable:!0,get:function(){return ie.storeTransactionActionPhase}});var ae=_l();Object.defineProperty(e,"loadTransactionBouncePhase",{enumerable:!0,get:function(){return ae.loadTransactionBouncePhase}}),Object.defineProperty(e,"storeTransactionBouncePhase",{enumerable:!0,get:function(){return ae.storeTransactionBouncePhase}});var oe=vl();Object.defineProperty(e,"loadTransactionComputePhase",{enumerable:!0,get:function(){return oe.loadTransactionComputePhase}}),Object.defineProperty(e,"storeTransactionComputePhase",{enumerable:!0,get:function(){return oe.storeTransactionComputePhase}});var se=yl();Object.defineProperty(e,"loadTransactionCreditPhase",{enumerable:!0,get:function(){return se.loadTransactionCreditPhase}}),Object.defineProperty(e,"storeTransactionCreditPhase",{enumerable:!0,get:function(){return se.storeTransactionCreditPhase}});var ce=xl();Object.defineProperty(e,"loadTransactionDescription",{enumerable:!0,get:function(){return ce.loadTransactionDescription}}),Object.defineProperty(e,"storeTransactionDescription",{enumerable:!0,get:function(){return ce.storeTransactionDescription}});var le=bl();Object.defineProperty(e,"loadTransactionStoragePhase",{enumerable:!0,get:function(){return le.loadTransactionStoragePhase}}),Object.defineProperty(e,"storeTransactionsStoragePhase",{enumerable:!0,get:function(){return le.storeTransactionsStoragePhase}})})),wl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.openContract=void 0;var t=nc(),n=Nc();function r(e,r){let i,a=null;if(!t.Address.isAddress(e.address))throw Error(`Invalid address`);if(i=e.address,e.init){if(!(e.init.code instanceof n.Cell))throw Error(`Invalid init.code`);if(!(e.init.data instanceof n.Cell))throw Error(`Invalid init.data`);a=e.init}let o=r({address:i,init:a});return new Proxy(e,{get(e,t){let n=e[t];return typeof t==`string`&&(t.startsWith(`get`)||t.startsWith(`send`)||t.startsWith(`is`))&&typeof n==`function`?(...t)=>n.apply(e,[o,...t]):n}})}e.openContract=r})),Tl=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ComputeError=void 0,e.ComputeError=class e extends Error{constructor(t,n,r){super(t),this.exitCode=n,this.debugLogs=r&&r.debugLogs?r.debugLogs:null,this.logs=r&&r.logs?r.logs:null,Object.setPrototypeOf(this,e.prototype)}}})),El=t((e=>{O(),Object.defineProperty(e,"__esModule",{value:!0}),e.getMethodId=void 0;var t=new Int16Array([0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920]);function n(e){e instanceof k||(e=k.from(e));let n=0;for(let r=0;r<e.length;r++){let i=e[r];n=(t[(n>>8^i)&255]^n<<8)&65535}return n}function r(e){return n(e)&65535|65536}e.getMethodId=r})),Dl=t((e=>{O(),Object.defineProperty(e,"__esModule",{value:!0}),e.safeSignVerify=e.safeSign=void 0;var t=xe(),n=8,r=64;function i(e,i){let a=k.from(i);if(a.length>r)throw Error(`Seed can be longer than 64 bytes`);if(a.length<n)throw Error(`Seed must be at least 8 bytes`);return(0,t.sha256_sync)(k.concat([k.from([255,255]),a,e.hash()]))}function a(e,n,r=`ton-safe-sign-magic`){return(0,t.sign)(i(e,r),n)}e.safeSign=a;function o(e,n,r,a=`ton-safe-sign-magic`){return(0,t.signVerify)(i(e,a),n,r)}e.safeSignVerify=o})),Ol=t((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.safeSignVerify=e.safeSign=e.getMethodId=e.base32Encode=e.base32Decode=e.crc32c=e.crc16=e.fromNano=e.toNano=e.ComputeError=e.openContract=e.TupleBuilder=e.TupleReader=e.serializeTupleItem=e.parseTupleItem=e.serializeTuple=e.parseTuple=e.generateMerkleUpdate=e.generateMerkleProofDirect=e.generateMerkleProof=e.exoticPruned=e.exoticMerkleUpdate=e.convertToMerkleProof=e.exoticMerkleProof=e.Dictionary=e.Cell=e.CellType=e.Slice=e.beginCell=e.Builder=e.BitBuilder=e.BitReader=e.BitString=e.contractAddress=e.ADNLAddress=e.ExternalAddress=e.address=e.Address=void 0;var r=nc();Object.defineProperty(e,"Address",{enumerable:!0,get:function(){return r.Address}}),Object.defineProperty(e,"address",{enumerable:!0,get:function(){return r.address}});var i=rc();Object.defineProperty(e,"ExternalAddress",{enumerable:!0,get:function(){return i.ExternalAddress}});var a=ac();Object.defineProperty(e,"ADNLAddress",{enumerable:!0,get:function(){return a.ADNLAddress}});var o=Lc();Object.defineProperty(e,"contractAddress",{enumerable:!0,get:function(){return o.contractAddress}});var s=sc();Object.defineProperty(e,"BitString",{enumerable:!0,get:function(){return s.BitString}});var c=dc();Object.defineProperty(e,"BitReader",{enumerable:!0,get:function(){return c.BitReader}});var l=cc();Object.defineProperty(e,"BitBuilder",{enumerable:!0,get:function(){return l.BitBuilder}});var u=Q();Object.defineProperty(e,"Builder",{enumerable:!0,get:function(){return u.Builder}}),Object.defineProperty(e,"beginCell",{enumerable:!0,get:function(){return u.beginCell}});var d=xc();Object.defineProperty(e,"Slice",{enumerable:!0,get:function(){return d.Slice}});var f=lc();Object.defineProperty(e,"CellType",{enumerable:!0,get:function(){return f.CellType}});var p=Nc();Object.defineProperty(e,"Cell",{enumerable:!0,get:function(){return p.Cell}});var m=yc();Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return m.Dictionary}});var h=fc();Object.defineProperty(e,"exoticMerkleProof",{enumerable:!0,get:function(){return h.exoticMerkleProof}}),Object.defineProperty(e,"convertToMerkleProof",{enumerable:!0,get:function(){return h.convertToMerkleProof}});var g=Cc();Object.defineProperty(e,"exoticMerkleUpdate",{enumerable:!0,get:function(){return g.exoticMerkleUpdate}});var _=Tc();Object.defineProperty(e,"exoticPruned",{enumerable:!0,get:function(){return _.exoticPruned}});var v=pc();Object.defineProperty(e,"generateMerkleProof",{enumerable:!0,get:function(){return v.generateMerkleProof}}),Object.defineProperty(e,"generateMerkleProofDirect",{enumerable:!0,get:function(){return v.generateMerkleProofDirect}});var y=mc();Object.defineProperty(e,"generateMerkleUpdate",{enumerable:!0,get:function(){return y.generateMerkleUpdate}});var b=Rc();Object.defineProperty(e,"parseTuple",{enumerable:!0,get:function(){return b.parseTuple}}),Object.defineProperty(e,"serializeTuple",{enumerable:!0,get:function(){return b.serializeTuple}}),Object.defineProperty(e,"parseTupleItem",{enumerable:!0,get:function(){return b.parseTupleItem}}),Object.defineProperty(e,"serializeTupleItem",{enumerable:!0,get:function(){return b.serializeTupleItem}});var x=zc();Object.defineProperty(e,"TupleReader",{enumerable:!0,get:function(){return x.TupleReader}});var S=Bc();Object.defineProperty(e,"TupleBuilder",{enumerable:!0,get:function(){return S.TupleBuilder}}),n(Cl(),e);var C=wl();Object.defineProperty(e,"openContract",{enumerable:!0,get:function(){return C.openContract}});var ee=Tl();Object.defineProperty(e,"ComputeError",{enumerable:!0,get:function(){return ee.ComputeError}});var w=Vc();Object.defineProperty(e,"toNano",{enumerable:!0,get:function(){return w.toNano}}),Object.defineProperty(e,"fromNano",{enumerable:!0,get:function(){return w.fromNano}});var te=tc();Object.defineProperty(e,"crc16",{enumerable:!0,get:function(){return te.crc16}});var T=jc();Object.defineProperty(e,"crc32c",{enumerable:!0,get:function(){return T.crc32c}});var E=ic();Object.defineProperty(e,"base32Decode",{enumerable:!0,get:function(){return E.base32Decode}}),Object.defineProperty(e,"base32Encode",{enumerable:!0,get:function(){return E.base32Encode}});var D=El();Object.defineProperty(e,"getMethodId",{enumerable:!0,get:function(){return D.getMethodId}});var ne=Dl();Object.defineProperty(e,"safeSign",{enumerable:!0,get:function(){return ne.safeSign}}),Object.defineProperty(e,"safeSignVerify",{enumerable:!0,get:function(){return ne.safeSignVerify}})}));O();var $=Ol(),kl=({amount:e,recipient:t,family:n,fees:r,comment:i,payload:a})=>({amount:e.toString(),recipient:t,family:n,fees:r.toString(),comment:i,payload:a?Nl(a):void 0}),Al=({amount:e,recipient:t,family:n,fees:r,comment:i,payload:a})=>({amount:new I(e),recipient:t,family:n,fees:new I(r),comment:i,payload:a?Ml(a):void 0}),jl=e=>{try{return $.Cell.fromBase64(e)}catch{return k.from(e,`hex`)}},Ml=e=>{switch(e.type){case`unsafe`:return{type:e.type,message:$.Cell.fromBase64(e.message)};case`jetton-transfer`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,amount:BigInt(e.amount),destination:$.Address.parse(e.destination),responseDestination:$.Address.parse(e.responseDestination),customPayload:e.customPayload?$.Cell.fromBase64(e.customPayload):null,forwardAmount:BigInt(e.forwardAmount),forwardPayload:e.forwardPayload?$.Cell.fromBase64(e.forwardPayload):null,knownJetton:e.knownJetton};case`nft-transfer`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,newOwner:$.Address.parse(e.newOwner),responseDestination:$.Address.parse(e.responseDestination),customPayload:e.customPayload?$.Cell.fromBase64(e.customPayload):null,forwardAmount:BigInt(e.forwardAmount),forwardPayload:e.forwardPayload?$.Cell.fromBase64(e.forwardPayload):null};case`jetton-burn`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,amount:BigInt(e.amount),responseDestination:$.Address.parse(e.responseDestination),customPayload:e.customPayload?jl(e.customPayload):null};case`add-whitelist`:case`single-nominator-change-validator`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,address:$.Address.parse(e.address)};case`single-nominator-withdraw`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,amount:BigInt(e.amount)};case`tonstakers-deposit`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,appId:e.appId?BigInt(e.appId):null};case`vote-for-proposal`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,votingAddress:$.Address.parse(e.votingAddress),expirationDate:e.expirationDate,vote:e.vote,needConfirmation:e.needConfirmation};case`change-dns-record`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,record:e.record.type===`wallet`?{type:e.record.type,value:e.record.value?{address:$.Address.parse(e.record.value.address),capabilities:e.record.value.capabilities}:null}:{type:e.record.type,key:k.from(e.record.key,`hex`),value:e.record.value?$.Cell.fromBase64(e.record.value):null}};case`token-bridge-pay-swap`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,swapId:k.from(e.swapId,`hex`)};case`tonwhales-pool-deposit`:return{type:e.type,queryId:BigInt(e.queryId),gasLimit:BigInt(e.gasLimit)};case`tonwhales-pool-withdraw`:return{type:e.type,queryId:BigInt(e.queryId),gasLimit:BigInt(e.gasLimit),amount:BigInt(e.amount)};case`vesting-send-msg-comment`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,sendMode:e.sendMode,value:BigInt(e.value),destination:$.Address.parse(e.destination),text:e.text};case`comment`:return e;default:return e}},Nl=e=>{switch(e.type){case`unsafe`:return{type:e.type,message:e.message.toBoc().toString(`base64`)};case`jetton-transfer`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,amount:e.amount.toString(),destination:e.destination.toRawString(),responseDestination:e.responseDestination.toRawString(),customPayload:e.customPayload?e.customPayload.toBoc().toString(`base64`):null,forwardAmount:e.forwardAmount.toString(),forwardPayload:e.forwardPayload?e.forwardPayload.toBoc().toString(`base64`):null,knownJetton:e.knownJetton};case`nft-transfer`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,newOwner:e.newOwner.toRawString(),responseDestination:e.responseDestination.toRawString(),customPayload:e.customPayload?e.customPayload.toBoc().toString(`base64`):null,forwardAmount:e.forwardAmount.toString(),forwardPayload:e.forwardPayload?e.forwardPayload.toBoc().toString(`base64`):null};case`jetton-burn`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,amount:e.amount.toString(),responseDestination:e.responseDestination.toRawString(),customPayload:e.customPayload&&`toBoc`in e.customPayload?e.customPayload.toBoc().toString(`base64`):e.customPayload?e.customPayload.toString(`hex`):null};case`add-whitelist`:case`single-nominator-change-validator`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,address:e.address.toRawString()};case`single-nominator-withdraw`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,amount:e.amount.toString()};case`tonstakers-deposit`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,appId:typeof e.appId==`bigint`?e.appId.toString():null};case`vote-for-proposal`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,votingAddress:e.votingAddress.toRawString(),expirationDate:e.expirationDate,vote:e.vote,needConfirmation:e.needConfirmation};case`change-dns-record`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,record:e.record.type===`wallet`?{type:e.record.type,value:e.record.value?{address:e.record.value.address.toRawString(),capabilities:e.record.value.capabilities}:null}:{type:e.record.type,key:e.record.key.toString(`hex`),value:e.record.value?e.record.value.toBoc().toString(`base64`):null}};case`token-bridge-pay-swap`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,swapId:e.swapId.toString(`hex`)};case`tonwhales-pool-deposit`:return{type:e.type,queryId:e.queryId.toString(),gasLimit:e.gasLimit.toString()};case`tonwhales-pool-withdraw`:return{type:e.type,queryId:e.queryId.toString(),gasLimit:e.gasLimit.toString(),amount:e.amount.toString()};case`vesting-send-msg-comment`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,sendMode:e.sendMode,value:e.value.toString(),destination:e.destination.toRawString(),text:e.text};case`comment`:return e;default:return e}},Pl=({amount:e,recipient:t,family:n,mode:r,resource:i,duration:a,votes:o})=>({amount:e.toString(),recipient:t,family:n,mode:r,resource:i,duration:a,votes:o}),Fl=({amount:e,recipient:t,family:n,mode:r,resource:i,duration:a,votes:o})=>({amount:new I(e),recipient:t,family:n,mode:r,resource:i,duration:a,votes:o});function Il({amount:e,data:t,family:n,fees:r,gasLimit:i,mode:a,recipient:o}){return{family:n,amount:e.toString(),recipient:o,mode:a,fees:r?r.toString():void 0,data:t,gasLimit:i}}function Ll({amount:e,data:t,family:n,fees:r,gasLimit:i,mode:a,recipient:o}){return{family:n,mode:a,amount:new I(e),recipient:o,fees:r?new I(r):void 0,data:t,gasLimit:i}}function Rl({amount:e,family:t,fees:n,memo:r,mode:i,recipient:a}){return{amount:e.toString(),family:t,fees:n?n.toString():void 0,memo:r,mode:i,recipient:a}}function zl({amount:e,family:t,fees:n,memo:r,mode:i,recipient:a}){return{amount:new I(e),family:t,fees:n?new I(n):void 0,memo:r,mode:i,recipient:a}}function Bl({amount:e,family:t,model:n,recipient:r,raw:i}){return{amount:e.toString(),family:t,model:JSON.stringify(n),recipient:r,raw:i}}function Vl({family:e,amount:t,model:n,recipient:r,raw:i}){return{amount:new I(t),family:e,model:JSON.parse(n),recipient:r,raw:i}}var Hl=({amount:e,recipient:t,family:n,estimatedFees:r,body:i})=>({amount:e.toString(),recipient:t,family:n,estimatedFees:r,body:i}),Ul=({amount:e,recipient:t,family:n,estimatedFees:r,body:i})=>({amount:new I(e),recipient:t,family:n,estimatedFees:r,body:i}),Wl=({amount:e,recipient:t,family:n,fee:r,nonce:i,memo:a,network:o,anchorMode:s})=>({amount:e.toString(),recipient:t,family:n,fee:r?.toString(),nonce:i?.toString(),memo:a,network:o,anchorMode:s}),Gl=({amount:e,recipient:t,family:n,fee:r,nonce:i,memo:a,network:o,anchorMode:s})=>({amount:new I(e),recipient:t,family:n,fee:r?new I(r):void 0,nonce:i?new I(i):void 0,memo:a,network:o===`mainnet`?o:`testnet`,anchorMode:s}),Kl=({amount:e,recipient:t,family:n,fees:r,memo:i})=>({amount:e.toFixed(),recipient:t,family:n,fees:r.toString(),memo:i}),ql=({amount:e,recipient:t,family:n,fees:r,memo:i})=>({amount:new I(e),recipient:t,family:n,fees:new I(r),memo:i}),Jl=({amount:e,recipient:t,family:n,fees:r,transferId:i})=>({amount:e.toFixed(),recipient:t,family:n,fees:r.toString(),transferId:i}),Yl=({amount:e,recipient:t,family:n,fees:r,transferId:i})=>({amount:new I(e),recipient:t,family:n,fees:new I(r),transferId:i});function Xl({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:e.toString(),recipient:t,family:n,mode:r,fees:i?.toString()}}function Zl({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:new I(e),recipient:t,family:n,mode:r,fees:i?new I(i):void 0}}function Ql({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:e.toString(),recipient:t,family:n,mode:r,fees:i.toString()}}function $l({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:new I(e),recipient:t,family:n,mode:r,fees:new I(i)}}function eu(e){switch(e.family){case`ethereum`:return Ps(e);case`bitcoin`:return Es(e);case`algorand`:return Ss(e);case`aptos`:return ws(e);case`crypto_org`:return Ms(e);case`ripple`:return Js(e);case`celo`:return Os(e);case`cosmos`:return As(e);case`hedera`:return Rs(e);case`kaspa`:return Bs(e);case`filecoin`:return Hs(e);case`tezos`:return Qs(e);case`polkadot`:return Ks(e);case`stellar`:return Xs(e);case`ton`:return kl(e);case`tron`:return Pl(e);case`near`:return Is(e);case`neo`:return Ws(e);case`elrond`:return Il(e);case`cardano`:return Rl(e);case`solana`:return Bl(e);case`vechain`:return Hl(e);case`stacks`:return Wl(e);case`internet_computer`:return Kl(e);case`casper`:return Jl(e);case`sui`:return Xl(e);case`aleo`:return Ql(e);default:return e}}function tu(e){switch(e.family){case`ethereum`:return Fs(e);case`bitcoin`:return Ds(e);case`algorand`:return Cs(e);case`aptos`:return Ts(e);case`crypto_org`:return Ns(e);case`ripple`:return Ys(e);case`celo`:return ks(e);case`cosmos`:return js(e);case`hedera`:return zs(e);case`kaspa`:return Vs(e);case`filecoin`:return Us(e);case`tezos`:return $s(e);case`polkadot`:return qs(e);case`stellar`:return Zs(e);case`ton`:return Al(e);case`tron`:return Fl(e);case`near`:return Ls(e);case`neo`:return Gs(e);case`elrond`:return Ll(e);case`cardano`:return zl(e);case`solana`:return Vl(e);case`vechain`:return Ul(e);case`stacks`:return Gl(e);case`internet_computer`:return ql(e);case`casper`:return Yl(e);case`sui`:return Zl(e);case`aleo`:return $l(e);default:return e}}var nu=J([`send`,`optIn`,`claimReward`,`optOut`]),ru=X.extend({family:Y(Z.enum.algorand),mode:nu,fees:B().optional(),assetId:B().optional(),memo:B().optional()}),iu=J([`send`]),au=X.extend({family:Y(Z.enum.aptos),mode:iu,fees:B().optional()}),ou=X.extend({family:Y(Z.enum.bitcoin),feePerByte:B().optional(),opReturnDataHex:B().max(160).optional(),changeAddress:B().optional()}),su=J([`send`,`lock`,`unlock`,`withdraw`,`vote`,`revoke`,`activate`,`register`]),cu=X.extend({family:Y(Z.enum.celo),fees:B().optional().nullable(),mode:su,index:H().optional().nullable()}),lu=J([`send`,`delegate`,`undelegate`,`redelegate`,`claimReward`,`claimRewardCompound`]),uu=K({address:B(),amount:B()}),du=X.extend({family:Y(Z.enum.cosmos),mode:lu,fees:B().optional(),gas:B().optional(),memo:B().optional(),sourceValidator:B().optional(),validators:G(uu).optional()}),fu=X.extend({family:Y(Z.enum.crypto_org),mode:B(),fees:B().optional()}),pu=X.extend({family:Y(Z.enum.ethereum),nonce:H().optional(),data:B().optional(),gasPrice:B().optional(),gasLimit:B().optional(),maxPriorityFeePerGas:B().optional(),maxFeePerGas:B().optional(),sponsored:U().optional()}),mu=X.extend({family:Y(Z.enum.near),mode:B(),fees:B().optional()}),hu=X.extend({family:Y(Z.enum.neo)}),gu=J([`send`,`bond`,`unbond`,`rebond`,`withdrawUnbonded`,`setController`,`nominate`,`chill`,`claimReward`]),_u=J([`Staked`,`Stash`,`Controller`,`Account`,`None`]),vu=X.extend({family:Y(Z.enum.polkadot),mode:gu,fee:B().optional(),era:H().optional(),validators:G(B()).optional(),rewardDestination:_u.optional(),numOfSlashingSpans:H().optional()}),yu=X.extend({family:Y(Z.enum.ripple),fee:B().optional(),tag:H()}),bu=X.extend({family:Y(Z.enum.solana),model:B(),raw:Xo(B())}),xu=J([`MEMO_TEXT`,`MEMO_ID`,`MEMO_HASH`,`MEMO_RETURN`]),Su=X.extend({family:Y(Z.enum.stellar),fees:B().optional(),memoType:xu.optional(),memoValue:B().optional()}),Cu=J([`send`,`delegate`,`undelegate`]),wu=X.extend({family:Y(Z.enum.tezos),mode:Cu,fees:B().optional(),gasLimit:B().optional()}),Tu=K({isEncrypted:U(),text:B()}),Eu=K({type:Y(`jetton-transfer`),queryId:q([B(),W()]),amount:B(),destination:B(),responseDestination:B(),customPayload:q([B(),W()]),forwardAmount:B(),forwardPayload:q([B(),W()]),knownJetton:q([K({jettonId:H(),workchain:H()}),W()])}),Du=K({type:Y(`nft-transfer`),queryId:q([B(),W()]),newOwner:B(),responseDestination:B(),customPayload:q([B(),W()]),forwardAmount:B(),forwardPayload:q([B(),W()])}),Ou=q([K({type:Y(`comment`),text:B()}),Eu,Du,K({type:Y(`unsafe`),message:B()}),K({type:Y(`jetton-burn`),queryId:q([B(),W()]),amount:B(),responseDestination:B(),customPayload:q([B(),W()])}),K({type:Y(`add-whitelist`),queryId:q([B(),W()]),address:B()}),K({type:Y(`single-nominator-withdraw`),queryId:q([B(),W()]),amount:B()}),K({type:Y(`single-nominator-change-validator`),queryId:q([B(),W()]),address:B()}),K({type:Y(`tonstakers-deposit`),queryId:q([B(),W()]),appId:q([B(),W()])}),K({type:Y(`vote-for-proposal`),queryId:q([B(),W()]),votingAddress:B(),expirationDate:H(),vote:U(),needConfirmation:U()}),K({type:Y(`change-dns-record`),queryId:q([B(),W()]),record:q([K({type:Y(`wallet`),value:q([K({address:B(),capabilities:q([K({isWallet:U()}),W()])}),W()])}),K({type:Y(`unknown`),key:B(),value:q([B(),W()])})])}),K({type:Y(`token-bridge-pay-swap`),queryId:q([B(),W()]),swapId:B()}),K({type:Y(`tonwhales-pool-deposit`),queryId:B(),gasLimit:B()}),K({type:Y(`tonwhales-pool-withdraw`),queryId:B(),gasLimit:B(),amount:B()}),K({type:Y(`vesting-send-msg-comment`),queryId:q([B(),W()]),sendMode:H(),value:B(),destination:B(),text:B()})]),ku=X.extend({family:Y(Z.enum.ton),fees:B(),comment:Tu,payload:Ou.optional()}),Au=J([`send`,`freeze`,`unfreeze`,`vote`,`claimReward`,`withdrawExpireUnfreeze`,`unDelegateResource`,`legacyUnfreeze`]),ju=J([`BANDWIDTH`,`ENERGY`]),Mu=K({address:B(),voteCount:H()}),Nu=X.extend({family:Y(Z.enum.tron),mode:Au,resource:ju.optional(),duration:H().optional(),votes:G(Mu).default([])}),Pu=X.extend({family:Y(Z.enum.hedera),memo:B().max(100).optional()}),Fu=X.extend({family:Y(Z.enum.kaspa),customFeeRate:B().optional()}),Iu=X.extend({data:B().optional(),family:Y(Z.enum.filecoin),gasLimit:H(),gasFeeCap:B(),gasPremium:B(),method:H(),nonce:H(),params:B().optional(),version:H()});J([`send`,`delegate`,`reDelegateRewards`,`unDelegate`,`claimRewards`,`withdraw`]);var Lu=X.extend({family:Y(Z.enum.elrond),mode:q([Y(`send`),Y(`delegate`),Y(`reDelegateRewards`),Y(`unDelegate`),Y(`claimRewards`),Y(`withdraw`)]),fees:B().optional(),data:B().optional(),gasLimit:H()}),Ru=X.extend({family:Y(Z.enum.cardano),fees:B().optional(),mode:B(),memo:B().optional()}),zu=K({to:B().nullable(),value:q([B(),H()]),data:B(),comment:B().optional(),abi:B().optional()}),Bu=K({chainTag:H(),blockRef:B(),expiration:H(),clauses:G(zu),gasPriceCoef:H().optional(),gas:q([B(),H()]),dependsOn:B().nullable(),nonce:q([B(),H()]),maxFeePerGas:q([B(),H()]).optional(),maxPriorityFeePerGas:q([B(),H()]).optional(),reserved:K({features:H().optional(),unused:G(ko()).optional()}).optional()}),Vu=X.extend({family:Y(Z.enum.vechain),estimatedFees:B(),body:Bu}),Hu=X.extend({family:Y(Z.enum.stacks),fee:B().optional(),nonce:B().optional(),memo:B().optional(),network:B(),anchorMode:H()}),Uu=X.extend({family:Y(Z.enum.internet_computer),fees:B(),memo:B().optional()}),Wu=X.extend({family:Y(Z.enum.casper),fees:B(),transferId:B().optional()}),Gu=X.extend({family:Y(Z.enum.sui),mode:B(),fees:B().optional()}),Ku=J([`transfer_public`]),qu=Bo(`family`,[ru,au,ou,cu,du,fu,pu,Pu,Fu,Iu,mu,hu,vu,yu,Su,wu,ku,Nu,Lu,Ru,bu,Vu,Hu,Uu,Wu,Gu,X.extend({family:Y(Z.enum.aleo),mode:Ku,fees:B()})]),Ju=class{prefix=``;constructor(e){this.prefix=e?`[${e}] `:``}log(e,...t){console.log(`%c${this.prefix}${e}`,`background: #6490f1; color: #fff`,...t)}warn(e,...t){console.warn(`%c${this.prefix}${e}`,`background: #6490f1; color: #f80`,...t)}debug(e,...t){console.debug(`%c${this.prefix}${e}`,`background: #6490f1; color: #777`,...t)}error(e,...t){console.error(`%c${this.prefix}${e}`,`background: #6490f1; color: #f00`,...t)}},Yu=new Ju(`WindowMessage`),Xu=class{target;logger;_onMessage;constructor(e=window,t=Yu){this.target=e,this.logger=t}connect=()=>{this.target.addEventListener(`message`,this._onMessageEvent,!1),this.target.document?.addEventListener(`message`,this._onMessageEvent,!1),this.logger.debug(`event listeners registered`)};disconnect=()=>{this.target.removeEventListener(`message`,this._onMessageEvent,!1),this.target.document?.removeEventListener(`message`,this._onMessageEvent,!1),this.logger.debug(`event listeners unregistered`)};_onMessageEvent=e=>{if(this._onMessage){if(this.logger.debug(`received message event`,e),e.data&&typeof e.data==`string`)try{let t=e.data;Date.now()>0?(this.logger.log(`received message`,t),this._onMessage(t)):this.logger.debug(`not a wallet API message`)}catch(e){this.logger.warn(`parse error`),e instanceof Error&&this._onMessage(e.message),console.error(`unknown error`)}else this.logger.debug(`ignoring message same origin`)}else this.logger.debug(`no handler registered`)};set onMessage(e){this._onMessage=e}get onMessage(){return this._onMessage}send=e=>{try{this.target.ReactNativeWebView?(this.logger.log(`sending message (ReactNativeWebview)`,e),this.target.ReactNativeWebView.postMessage(e)):this.target.ElectronWebview?(this.logger.log(`sending message (ElectronWebview)`,e),this.target.ElectronWebview.postMessage(e)):(this.logger.log(`sending message`,e),this.target.top?.postMessage(e,`*`))}catch(e){throw this.logger.error(`unexpected error on send`,e),e}}},Zu;(function(e){e.Slow=`slow`,e.Medium=`medium`,e.Fast=`fast`})(Zu||={});var Qu;(function(e){e.Blue=`blue`,e.NanoS=`nanoS`,e.NanoX=`nanoX`})(Qu||={});var $u;(function(e){e[e.SWAP=0]=`SWAP`,e[e.SELL=1]=`SELL`,e[e.FUND=2]=`FUND`})($u||={});var ed=J([`NOT_IMPLEMENTED_BY_WALLET`,`ACCOUNT_NOT_FOUND`,`CURRENCY_NOT_FOUND`,`PERMISSION_DENIED`,`UNKNOWN_ERROR`,`UNAUTHORIZED_STORE`]),td=K({code:Y(ed.enum.NOT_IMPLEMENTED_BY_WALLET),message:B(),data:K({methodId:B()})}),nd=K({code:Y(ed.enum.ACCOUNT_NOT_FOUND),message:B(),data:K({accountId:B()})}),rd=K({code:Y(ed.enum.CURRENCY_NOT_FOUND),message:B(),data:K({currencyId:B()})}),id=K({code:Y(ed.enum.PERMISSION_DENIED),message:B(),data:K({methodId:B()})}),ad=K({name:B().optional(),message:B().optional(),stack:B().optional(),cause:jo().optional(),code:B().optional()}),od=Bo(`code`,[td,nd,rd,id,K({code:Y(ed.enum.UNKNOWN_ERROR),message:B(),data:ad.passthrough()})]);function sd(e){return{code:`UNKNOWN_ERROR`,message:`an unhandled error was thrown`,data:e}}var cd=class extends Error{errorData;constructor(e){super(e.message),this.errorData=e}getCode(){return this.errorData.code}getData(){return this.errorData}};function ld(e){if(e instanceof Error){let t={name:e.name,message:e.message,stack:e.stack},{code:n,cause:r}=e;return typeof n==`string`&&(t.code=n),r!==void 0&&(t.cause=r),t}return typeof e==`string`?{message:e}:typeof e==`object`&&e?e:{}}function ud(e){if(!e||e.message===void 0&&e.name===void 0)return;let t=Error(e.message);return e.name&&(t.name=e.name),e.stack&&(t.stack=e.stack),e.code!==void 0&&(t.code=e.code),e.cause!==void 0&&(t.cause=e.cause),t}var dd=class extends Error{err;constructor(e){super(e.message),this.err=e}getCode(){return this.err.code}getData(){return this.err.data}},fd;(function(e){e[e.PARSE_ERROR=-32700]=`PARSE_ERROR`,e[e.INVALID_REQUEST=-32600]=`INVALID_REQUEST`,e[e.METHOD_NOT_FOUND=-32601]=`METHOD_NOT_FOUND`,e[e.INVALID_PARAMS=-32602]=`INVALID_PARAMS`,e[e.INTERNAL_ERROR=-32603]=`INTERNAL_ERROR`,e[e.SERVER_ERROR=-32e3]=`SERVER_ERROR`})(fd||={});var pd=q([B(),H(),W()]),md=K({jsonrpc:Y(`2.0`),method:B(),params:ko(),id:pd.optional()}).strict(),hd=K({code:H(),message:B(),data:ko().optional()}).strict(),gd=K({jsonrpc:Y(`2.0`),id:pd,result:K({}).passthrough().optional()}).strict(),_d=q([md,q([K({jsonrpc:Y(`2.0`),id:pd,error:hd}).strict(),gd])]);function vd(e){try{let t=JSON.parse(e);return _d.parse(t)}catch(e){throw e instanceof SyntaxError?new dd({code:fd.PARSE_ERROR,message:`parse error`}):e instanceof Na?new dd({code:fd.INVALID_REQUEST,message:`invalid request`}):e}}function yd(e){return{jsonrpc:`2.0`,...e}}var bd=class{transport;requestHandlers;ongoingRequests={};constructor(e,t){this.transport=e,this.requestHandlers=t,this.transport.onMessage=e=>{this.handleMessage(e)}}_request(e){return new Promise((t,n)=>{if(!e.id){n(Error(`requests need to have an id`));return}let r=e=>{if(`error`in e){if(e.error.code===fd.SERVER_ERROR){let t=od.parse(e.error.data);if(t.code===`UNKNOWN_ERROR`){n(ud(t.data));return}n(new cd(t));return}n(new dd(e.error));return}t(e.result)};this.ongoingRequests[e.id]=r,this.transport.send(JSON.stringify(e))})}_notify(e){this.transport.send(JSON.stringify(e))}request(e,t){let n=crypto.randomUUID();return this._request({id:n,jsonrpc:`2.0`,method:e,params:t})}notify(e,t){return this._notify({jsonrpc:`2.0`,method:e,params:t})}async handleRpcRequest(e){try{let t=await this.onRequest(e);if(e.id){let n=yd({id:e.id,result:t});this.transport.send(JSON.stringify(n))}}catch(e){throw e instanceof Na?new dd({code:fd.INVALID_PARAMS,message:e.message,data:e.flatten()}):e instanceof cd?new dd({code:fd.SERVER_ERROR,message:`unexpected server error`,data:e.getData()}):e instanceof dd?e:new dd({code:fd.SERVER_ERROR,message:`unexpected server error`,data:sd(ld(e))})}}async handleMessage(e){let t=!1,n;try{let r=vd(e);n=r.id,`method`in r?await this.handleRpcRequest(r):(t=!0,this.handleRpcResponse(r))}catch(e){if(t)throw e;if(e instanceof dd){let t=yd({id:n??null,error:{code:e.getCode(),message:e.message,data:e.getData()}});this.transport.send(JSON.stringify(t));return}throw e}}handleRpcResponse(e){if(!e.id)return;let t=this.ongoingRequests[e.id];if(!t)throw Error(`no ongoingRequest ${e.id}`);t(e)}},xd={params:K({accountId:B()}),result:K({maxSpendable:B().regex(/^(0|[1-9]\d*)$/)})},Sd={params:K({accountId:B(),derivationPath:B().optional()}),result:K({publicKey:B()})},Cd={params:K({currencyIds:G(B()).optional()}).optional(),result:K({rawAccounts:G(_s)})},wd={params:K({accountId:B(),tokenCurrency:B().optional()}),result:K({address:B()})},Td={params:K({currencyIds:G(B()).optional(),showAccountFilter:U().optional(),drawerConfiguration:K({assets:K({filter:B().optional(),leftElement:B().optional(),rightElement:B().optional()}).optional(),networks:K({leftElement:B().optional(),rightElement:B().optional()}).optional()}).optional(),useCase:B().optional(),uiUseCase:B().optional()}),result:K({rawAccount:_s})},Ed={params:K({accountId:B(),derivationPath:B().optional()}),result:K({address:B()})},Dd={params:K({accountId:B(),intentions:G(J([`payment`,`ordinal`])).optional()}),result:K({addresses:G(K({address:B(),publicKey:B().optional(),path:B().optional(),intention:B().optional()}))})},Od={params:K({accountId:B(),derivationPath:B().optional()}),result:K({publicKey:B()})},kd={params:K({accountId:B()}),result:K({xPub:B()})},Ad={params:K({accountId:B(),psbt:B(),broadcast:U().optional()}),result:K({psbtSigned:B(),txHash:B().optional()})},jd={params:K({currencyIds:G(B()).optional()}).optional(),result:K({currencies:G(xs)})},Md=J([`blue`,`nanoS`,`nanoSP`,`nanoX`,`stax`,`europa`,`apex`]),Nd={params:K({transportId:B()}),result:K({transportId:B()})},Pd={params:K({apduHex:B(),transportId:B()}),result:K({responseHex:B()})},Fd={params:K({deviceId:B()}),result:K({transportId:B()})},Id={params:K({appName:B().optional(),allowManager:U().optional(),appVersionRange:B().optional(),firmwareVersionRange:B().optional(),seeded:U().optional(),devices:Md.array().nonempty().optional()}),result:K({deviceId:B()})},Ld={params:K({appName:B().optional(),allowManager:U().optional(),appVersionRange:B().optional(),firmwareVersionRange:B().optional(),seeded:U().optional(),devices:Md.array().nonempty().optional()}),result:K({transportId:B()})},Rd=J([`SLOW`,`MEDIUM`,`FAST`,`CUSTOM`]),zd=K({provider:B(),fromAccountId:B(),rawTransaction:qu,hexBinaryPayload:B(),hexSignature:B(),feeStrategy:Rd,tokenCurrency:B().optional()}),Bd={params:Bo(`exchangeType`,[zd.extend({exchangeType:Y(`FUND`)}),zd.extend({exchangeType:Y(`SELL`)}),zd.extend({exchangeType:Y(`SWAP`),toAccountId:B(),swapId:B(),rate:H()})]),result:K({transactionHash:B()})},Vd={params:K({exchangeType:J([`SWAP`,`SELL`,`FUND`,`SWAP_NG`,`SELL_NG`,`FUND_NG`])}),result:K({transactionId:B()})},Hd=K({hwAppId:B().optional(),dependencies:G(B()).optional()}),Ud={params:K({accountId:B(),hexMessage:B(),options:Hd.optional(),meta:Wo(B(),jo()).optional()}),result:K({hexSignedMessage:B()})},Wd={params:K({key:B().min(1),storeId:B().min(1).optional()}),result:K({value:B().optional()})},Gd={params:K({key:B(),value:B(),storeId:B().optional()}),result:Fo().optional()},Kd=K({hwAppId:B().optional(),dependencies:G(B()).optional()}),qd={params:K({accountId:B(),rawTransaction:qu,options:Kd.optional(),meta:Wo(B(),jo()).optional(),tokenCurrency:B().optional()}),result:K({signedTransactionHex:B()})},Jd=K({hwAppId:B().optional(),dependencies:G(B()).optional()}),Yd={params:K({accountId:B(),rawTransaction:qu,options:Jd.optional(),meta:Wo(B(),jo()).optional(),tokenCurrency:B().optional()}),result:K({transactionHash:B()})},Xd=K({hwAppId:B().optional(),dependencies:G(B()).optional()}),Zd={params:K({accountId:B(),rawTransaction:B(),broadcast:U().optional(),options:Xd.optional(),meta:Wo(B(),jo()).optional()}),result:K({signedTransactionHex:B(),transactionHash:B().optional()})},Qd={params:K({}),result:K({methodIds:G(B())})},$d={params:K({}),result:K({tracking:U(),wallet:K({name:B(),version:B()})})},ef={params:K({}),result:K({userId:B()})};J([`account.getMaxSpendable`,`account.getPublicKey`,`account.list`,`account.receive`,`account.request`,`currency.list`,`device.close`,`device.exchange`,`device.transport`,`message.sign`,`transaction.sign`,`transaction.signRaw`,`transaction.signAndBroadcast`,`wallet.capabilities`,`wallet.info`,`wallet.userId`]),O();var tf=class e extends Br{walletApi;transportId;constructor(e,t){super(),this.transportId=t,this.walletApi=e}static isSupported=()=>Promise.resolve(!0);static list=()=>Promise.resolve([]);static listen=e=>({unsubscribe:()=>{}});static open({walletApi:t,transportId:n}){return Promise.resolve(new e(t,n))}async exchange(e){let t=e.toString(`hex`),n=await this.walletApi.request(`device.exchange`,{transportId:this.transportId,apduHex:t}),r=Pd.result.parse(n);return k.from(r.responseHex,`hex`)}setScrambleKey(){}async close(){let e=await this.walletApi.request(`device.close`,{transportId:this.transportId});Nd.result.parse(e)}},nf=class{client;constructor(e){this.client=e}async list(e){let t=await this.client.request(`account.list`,{currencyIds:e?.currencyIds});return Cd.result.parse(t).rawAccounts.map(ka)}async request(e){let t=await this.client.request(`account.request`,{currencyIds:e?.currencyIds,showAccountFilter:e?.showAccountFilter,drawerConfiguration:e?.drawerConfiguration,useCase:e?.useCase,uiUseCase:e?.uiUseCase});return ka(Td.result.parse(t).rawAccount)}async receive(e){let t=await this.client.request(`account.receive`,{accountId:e});return wd.result.parse(t).address}async getPublicKey(e,t){let n=await this.client.request(`account.getPublicKey`,{accountId:e,derivationPath:t});return Sd.result.parse(n).publicKey}async getMaxSpendable(e){let t=await this.client.request(`account.getMaxSpendable`,{accountId:e});return new I(xd.result.parse(t).maxSpendable)}},rf=class{client;constructor(e){this.client=e}async getAddress(e,t){let n=await this.client.request(`bitcoin.getAddress`,{accountId:e,derivationPath:t});return Ed.result.parse(n).address}async getAddresses(e,t){let n=await this.client.request(`bitcoin.getAddresses`,{accountId:e,intentions:t});return Dd.result.parse(n).addresses}async getPublicKey(e,t){let n=await this.client.request(`bitcoin.getPublicKey`,{accountId:e,derivationPath:t});return Od.result.parse(n).publicKey}async getXPub(e){let t=await this.client.request(`bitcoin.getXPub`,{accountId:e});return kd.result.parse(t).xPub}async signPsbt(e,t,n){let r=await this.client.request(`bitcoin.signPsbt`,{accountId:e,psbt:t,broadcast:n}),{psbtSigned:i,txHash:a}=Ad.result.parse(r);return{psbtSigned:i,txHash:a}}},af=class{client;constructor(e){this.client=e}async list(e){let t=await this.client.request(`currency.list`,{currencyIds:e?.currencyIds});return jd.result.parse(t).currencies}},of=class{client;constructor(e){this.client=e}async transport(e){let t=await this.client.request(`device.transport`,e),n=Ld.result.parse(t);return tf.open({walletApi:this.client,transportId:n.transportId})}async open(e){let t=await this.client.request(`device.open`,e),n=Fd.result.parse(t);return tf.open({walletApi:this.client,transportId:n.transportId})}async select(e){let t=await this.client.request(`device.select`,e);return Id.result.parse(t)}},sf=class{client;constructor(e){this.client=e}async start(e){let t=await this.client.request(`exchange.start`,{exchangeType:e});return Vd.result.parse(t).transactionId}async completeSwap({provider:e,fromAccountId:t,toAccountId:n,swapId:r,rate:i,transaction:a,binaryPayload:o,signature:s,feeStrategy:c,tokenCurrency:l}){let u=await this.client.request(`exchange.complete`,{exchangeType:`SWAP`,provider:e,fromAccountId:t,toAccountId:n,swapId:r,rate:i,rawTransaction:eu(a),hexBinaryPayload:o.toString(`hex`),hexSignature:s.toString(`hex`),feeStrategy:c,tokenCurrency:l});return Bd.result.parse(u).transactionHash}async completeSell({provider:e,fromAccountId:t,transaction:n,binaryPayload:r,signature:i,feeStrategy:a}){let o=await this.client.request(`exchange.complete`,{exchangeType:`SELL`,provider:e,fromAccountId:t,rawTransaction:eu(n),hexBinaryPayload:r.toString(`hex`),hexSignature:i.toString(`hex`),feeStrategy:a});return Bd.result.parse(o).transactionHash}async completeFund({provider:e,fromAccountId:t,transaction:n,binaryPayload:r,signature:i,feeStrategy:a,tokenCurrency:o}){let s=await this.client.request(`exchange.complete`,{exchangeType:`FUND`,provider:e,fromAccountId:t,rawTransaction:eu(n),hexBinaryPayload:r.toString(`hex`),hexSignature:i.toString(`hex`),feeStrategy:a,tokenCurrency:o});return Bd.result.parse(s).transactionHash}};O();var cf=class{client;constructor(e){this.client=e}async sign(e,t,n,r){let i=await this.client.request(`message.sign`,{accountId:e,hexMessage:t.toString(`hex`),options:n,meta:r}),a=Ud.result.parse(i);return k.from(a.hexSignedMessage,`hex`)}},lf=class{client;constructor(e){this.client=e}async get(e,t){let n=await this.client.request(`storage.get`,{key:e,storeId:t});return Wd.result.parse(n).value}async set(e,t,n){let r=await this.client.request(`storage.set`,{key:e,value:t,storeId:n});return Gd.result.parse(r)}};O();var uf=class{client;constructor(e){this.client=e}async sign(e,t,n,r){let i=await this.client.request(`transaction.sign`,{accountId:e,rawTransaction:eu(t),options:n,meta:r}),a=qd.result.parse(i);return k.from(a.signedTransactionHex,`hex`)}async signRaw(e,t,n,r,i){let a=await this.client.request(`transaction.signRaw`,{accountId:e,rawTransaction:t,broadcast:n,options:r,meta:i});return Zd.result.parse(a)}async signAndBroadcast(e,t,n,r){let i=await this.client.request(`transaction.signAndBroadcast`,{accountId:e,rawTransaction:eu(t),options:n,meta:r});return Yd.result.parse(i).transactionHash}},df=class{client;constructor(e){this.client=e}async userId(){let e=await this.client.request(`wallet.userId`,{});return ef.result.parse(e).userId}async info(){let e=await this.client.request(`wallet.info`,{});return $d.result.parse(e)}async capabilities(){let e=await this.client.request(`wallet.capabilities`,{});return Qd.result.parse(e).methodIds}},ff=new Ju(`Wallet-API-Client`),pf={"event.account.updated":e=>Promise.resolve()},mf=class extends bd{account;bitcoin;currency;device;message;storage;transaction;wallet;exchange;custom;logger;constructor(e,t=ff,n,r={}){super(e,{...pf,...r}),this.logger=t,this.account=new nf(this),this.bitcoin=new rf(this),this.currency=new af(this),this.device=new of(this),this.message=new cf(this),this.storage=new lf(this),this.transaction=new uf(this),this.wallet=new df(this),this.exchange=new sf(this),this.custom=n?n(this):{}}setEventHandlers(e){this.requestHandlers={...pf,...e}}onRequest(e){this.logger.log(e.method);let t=this.requestHandlers[e.method];if(!t)throw new dd({code:fd.METHOD_NOT_FOUND,message:`method not found`});return t(e)}},hf={near:{"*":{currencyId:`near`,family:`near`,network:`near`}},tezos:{"*":{currencyId:`tezos`,family:`tezos`,network:`tezos`}},solana:{"*":{currencyId:`solana`,family:`solana`,network:`solana`}},tron:{"*":{currencyId:`tron`,family:`tron`,network:`tron`}},ton:{"*":{currencyId:`ton`,family:`ton`,network:`ton`}},polkadot:{"*":{currencyId:`assethub_polkadot`,family:`polkadot`,network:`polkadot`}},celo:{"*":{currencyId:`celo`,family:`celo`,network:`celo`}},ethereum:{ethereum:{currencyId:`ethereum`,family:`ethereum`,network:`ethereum`},polygon:{currencyId:`polygon`,family:`ethereum`,network:`polygon`},arbitrum:{currencyId:`arbitrum`,family:`ethereum`,network:`arbitrum`},optimism:{currencyId:`optimism`,family:`ethereum`,network:`optimism`},avalanche_c_chain:{currencyId:`avalanche_c_chain`,family:`ethereum`,network:`avalanche-c`},ethereum_hoodi:{currencyId:`ethereum_hoodi`,family:`ethereum`,network:`ethereum-hoodi`},bsc:{currencyId:`bsc`,family:`ethereum`,network:`binance`}},cosmos:{cosmos:{currencyId:`cosmos`,family:`cosmos`,network:`cosmos`},crypto_org:{currencyId:`crypto_org`,family:`cosmos`,network:`cronos`},osmo:{currencyId:`osmo`,family:`cosmos`,network:`osmosis`},coreum:{currencyId:`coreum`,family:`cosmos`,network:`coreum`},axelar:{currencyId:`axelar`,family:`cosmos`,network:`axelar`},stargaze:{currencyId:`stargaze`,family:`cosmos`,network:`stargaze`},secret_network:{currencyId:`secret_network`,family:`cosmos`,network:`secret`},umee:{currencyId:`umee`,family:`cosmos`,network:`umee`},desmos:{currencyId:`desmos`,family:`cosmos`,network:`desmos`},onomy:{currencyId:`onomy`,family:`cosmos`,network:`onomy`},quicksilver:{currencyId:`quicksilver`,family:`cosmos`,network:`quicksilver`},persistence:{currencyId:`persistence`,family:`cosmos`,network:`persistence`},dydx:{currencyId:`dydx`,family:`cosmos`,network:`dydx`},injective:{currencyId:`injective`,family:`cosmos`,network:`injective`},sei:{currencyId:`sei`,family:`cosmos`,network:`sei`},mantra:{currencyId:`mantra`,family:`cosmos`,network:`mantra`}}},gf=new Map([[`polkadot`,1],[`avalanche-c`,2],[`tron`,3],[`binance`,4],[`cronos`,5],[`polygon`,6]]);O();var _f=Se(),vf=u(c({amount:y(u(m)),gasLimit:y(u(m)),token:y(u(c({decimals:h})))})),yf=v(vf),bf=v(l),xf=new Set([`polygon`,`optimism`,`arbitrum`,`avalanche-c`,`core`]),Sf=class extends f()(`LedgerTransactionPreparationError`,{message:m}){},Cf=e=>new Sf({message:e}),wf=T(function*(){let e=yield*ne(E({try:()=>ae(()=>import(`./polkadot-ledger-transaction-Dp6EFfyV.js`).then(e=>e.buildPolkadotLedgerTransaction),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])),catch:()=>Cf(`Could not load Polkadot transaction support`)}));return({family:t,network:n,tx:r,txMeta:i})=>d(bf)(r).pipe(re(()=>Cf(`Failed to parse tx`)),D(r=>n===`polkadot`?i?Tf({loadPolkadotBuilder:e,payload:r,txMeta:i}):ie(Cf(`Missing classic transaction metadata`)):w(Ef({family:t,network:n,payload:r,txMeta:i})).pipe(re(Cf))))}),Tf=({loadPolkadotBuilder:e,payload:t,txMeta:n})=>w(le(fe,t)).pipe(re(Cf),D(t=>e.pipe(D(e=>w(e({fee:Ff(Nf(n.gasEstimate)).toString(),payload:t,txMeta:n})).pipe(re(Cf)))))),Ef=({family:e,network:t,payload:i,txMeta:s})=>{if(ge(t))return le(ue,i).pipe(n(e=>Df({network:t,tx:e})));if(e===`borrow`)return o(`Unsupported Borrow network`);if(!s)return o(`Missing classic transaction metadata`);switch(t){case`tron`:return le(we,i).pipe(a(()=>kf(s)));case`near`:return Af(s);case`tezos`:return jf(s);case`ton`:return le(Ce,i).pipe(a(e=>Mf(e,s)));default:return he(t)?Of(s):r(i)}},Df=({network:e,tx:t})=>{let n={amount:(t.value??0n).toString(),recipient:t.to,family:`ethereum`,gasLimit:t.gasLimit.toString(),data:k.from(_e(t.data)).toString(`hex`)};return t.maxFeePerGas&&t.maxPriorityFeePerGas&&!xf.has(e)?(n.maxFeePerGas=t.maxFeePerGas.toString(),n.maxPriorityFeePerGas=t.maxPriorityFeePerGas.toString()):t.gasPrice&&(n.gasPrice=t.gasPrice.toString()),n},Of=e=>{let t=e.rawArguments?.validatorAddress,n=If(e.txType),i=Pf(e)??(Lf(n)?se():null);return!t||i===null?o(`Missing Cosmos Ledger arguments`):r({family:`cosmos`,mode:n,validators:[{address:t,amount:i.toString()}],amount:i.toString(),recipient:t,memo:`via StakeKit CID-1009`})},kf=e=>{let t=Pf(e),i=e.rawArguments?.tronResource,a=e.rawArguments?.validatorAddress??e.rawArguments?.validatorAddresses?.[0],s=e.address;return(()=>{switch(e.txType){case`FREEZE_BANDWIDTH`:case`FREEZE_ENERGY`:return!t||!i?o(`Missing Tron freeze arguments`):r({amount:t.toString(),recipient:s,family:`tron`,mode:`freeze`,resource:i});case`VOTE`:{let r=e.rawArguments?.validatorAddresses;return!t||!r?.length?o(`Missing Tron vote arguments`):Bf({txMeta:e,validatorAddresses:r}).pipe(n(e=>({amount:t.toString(),recipient:s,family:`tron`,mode:`vote`,votes:e})))}case`UNDELEGATE_BANDWIDTH`:case`UNDELEGATE_ENERGY`:return!t||!i||!a?o(`Missing Tron undelegate arguments`):r({amount:t.toString(),recipient:String(a),family:`tron`,mode:`unDelegateResource`,resource:i});case`UNFREEZE_LEGACY_BANDWIDTH`:case`UNFREEZE_LEGACY_ENERGY`:return r({amount:`0`,recipient:``,family:`tron`,mode:`legacyUnfreeze`,resource:i});case`UNFREEZE_BANDWIDTH`:case`UNFREEZE_ENERGY`:return!t||!i?o(`Missing Tron unfreeze arguments`):r({amount:t.toString(),recipient:s,family:`tron`,mode:`unfreeze`,resource:i});case`CLAIM_REWARDS`:return r({amount:`0`,recipient:s,family:`tron`,mode:`claimReward`});default:return o(`Unsupported Tron Ledger transaction type: ${e.txType}`)}})().pipe(n(e=>({...e,votes:e.votes??[]})))},Af=e=>{let t=e.rawArguments?.validatorAddress,n=Pf(e);return!t||!n?o(`Missing Near Ledger arguments`):r({amount:n.toString(),recipient:t,family:`near`,mode:Rf(e.txType),fees:Ff(Nf(e.gasEstimate)).toString()})},jf=e=>{let t=Nf(e.gasEstimate),n=e.txType===`UNSTAKE`,i=n?``:e.rawArguments?.validatorAddress;return!n&&!i?o(`Missing Tezos Ledger validator`):r({family:`tezos`,mode:n?`undelegate`:`delegate`,amount:`0`,recipient:i??``,fees:Ff(t).toString(),gasLimit:String(t?.gasLimit??0)})},Mf=(e,t)=>{let n=Nf(t.gasEstimate);if(!(`message`in e)){let t=e[0];return t?r({family:`ton`,amount:t.amount,recipient:t.address,fees:Ff(n).toString(),comment:{text:t.payload,isEncrypted:!1}}):o(`Unsupported Ton Ledger transaction payload`)}try{let t=(0,_f.loadMessageRelaxed)(_f.Cell.fromBase64(e.message).beginParse()),i=t.info;return r({family:`ton`,amount:i.value.coins.toString(),recipient:i.dest.toString(),fees:Ff(n).toString(),comment:{text:t.body.toBoc().toString(`base64`),isEncrypted:!1}})}catch{return o(`Unsupported Ton Ledger transaction payload`)}},Nf=e=>e?g(yf)(e).pipe(s):null,Pf=e=>{if(e.amountRaw)return me(e.amountRaw);let t=e.rawArguments?.amount??e.amount,n=e.inputToken?.decimals;return!t||n===void 0?null:me(t).multipliedBy(me(10).pow(n))},Ff=e=>!e?.amount||!e.token?se():me(e.amount).multipliedBy(me(10).pow(e.token.decimals)),If=e=>{switch(e){case`STAKE`:return`delegate`;case`UNSTAKE`:return`undelegate`;case`RESTAKE`:case`REBOND`:return`redelegate`;case`RESTAKE_REWARDS`:return`claimRewardCompound`;case`CLAIM_REWARDS`:return`claimReward`;default:return`delegate`}},Lf=e=>e===`claimReward`||e===`claimRewardCompound`,Rf=e=>{switch(e){case`STAKE`:return`stake`;case`UNSTAKE`:return`unstake`;case`WITHDRAW`:case`CLAIM_UNSTAKED`:return`withdraw`;default:return`stake`}},zf=e=>{let t=e.rawArguments?.amount??e.amount;if(t)return me(t);let n=e.inputToken?.decimals;return!e.amountRaw||n===void 0?null:me(e.amountRaw).dividedBy(me(10).pow(n))},Bf=({txMeta:e,validatorAddresses:t})=>{let n=zf(e);if(!n)return o(`Missing Tron vote arguments`);let i=t.length,a=n.dividedToIntegerBy(i),s=n.modulo(i).integerValue(pe.ROUND_FLOOR);if(!a.isFinite()||!s.isFinite()||a.isNegative()||s.isNegative())return o(`Invalid Tron vote count`);if(a.plus(1).gt(2**53-1))return o(`Tron vote count exceeds Ledger limits`);let c=oe(s);if(c==null)return o(`Invalid Tron vote count`);let l=t.map((e,t)=>{let n=oe(a.plus(+(t<c)));return n==null?null:{address:e,voteCount:n}});return l.some(e=>e==null)?o(`Invalid Tron vote count`):r(l.filter(e=>e!=null))},Vf=({accounts:e,ledgerCurrencies:t,enabledChainsMap:n})=>{let{accountsFamilies:r,accountsCurrencies:i}=e.reduce((e,n)=>{let r=t.get(n.currency);return r&&(e.accountsFamilies.add(r),e.accountsCurrencies.add(n.currency)),e},{accountsFamilies:new Set,accountsCurrencies:new Set}),a=p(hf).reduce((e,[t,a])=>{let o=Object.keys(a).reduce((e,t)=>{let o=a[t];if(!o)return e;let s=n.evm[o.network]?.wagmiChain||n.cosmos[o.network]?.wagmiChain||n.misc[o.network]?.wagmiChain||n.substrate[o.network]?.wagmiChain;return s?r.has(o.family)&&(t===`*`||i.has(o.currencyId))?{...e,[t]:{...o,chain:s,enabled:!0}}:gf.has(o.network)?{...e,[t]:{...o,chain:s,enabled:!1}}:e:e},{});return{...e,[t]:o}},{});return Object.keys(a).reduce((e,t)=>{let n=a[t],r=Object.keys(n).reduce((e,t)=>{let r=n[t];return r&&e.set(t,r),e},new Map);return e.set(t,r),e},new Map)},Hf=e=>E({try:()=>e.currency.list({currencyIds:Object.values(hf).flatMap(e=>Object.values(e).map(e=>e.currencyId))}),catch:e=>new S({cause:e,message:`could not get currencies`,operation:`ledger-list-currencies`})}).pipe(ee(e=>e.reduce((e,t)=>(t.type===`CryptoCurrency`?e.cryptoCurrency.set(t.id,t.family):e.tokenCurrency.push(t),e),{cryptoCurrency:new Map,tokenCurrency:[]})),ee(e=>(e.tokenCurrency.forEach(t=>{let n=e.cryptoCurrency.get(t.parent);n&&e.cryptoCurrency.set(t.id,n)}),e.cryptoCurrency))),Uf=({walletDetailsParams:e,enabledChainsMap:t,isLedgerDappBrowser:n,prepareTransaction:a,queryParams:s,runWalletEffect:c})=>x(l=>{let u=ve([]),d=ve([]),f=ve(void 0),p=f.changes.pipe(b(e=>e?.parentAccountId??e?.id)),m=[],h=ve([]),g=null,_=null,v=null,y=new Xu;y.connect();let x=new mf(y),w=async e=>{l.emitter.emit(`message`,{type:`connecting`});let n=await c(Hf(x)),r=await c(E({try:()=>x.account.list(),catch:e=>new S({cause:e,message:`could not get accounts`,operation:`ledger-list-accounts`})}).pipe(ee(e=>({accounts:e,accountsMap:new Map(e.map(e=>[e.id,e]))})),ee(e=>e.accounts.map(t=>t.parentAccountId?(()=>{let n=e.accountsMap.get(t.parentAccountId);return n?{...t,currency:n.currency}:t})():t))));m=r.filter(e=>!e.parentAccountId);let a=Vf({ledgerCurrencies:n,accounts:m,enabledChainsMap:t});_=new Map([...a.values()].flatMap(e=>[...e.values()].map(e=>[e.chain.id,e.currencyId]))),v=a;let{enabled:o,disabled:p}=[...a.values()].reduce((e,t)=>(t.forEach(t=>{t.enabled?e.enabled.push(t.chain):e.disabled.push(t.chain)}),e),{enabled:[],disabled:[]});u.set([...o,...p]),d.set(p);let y=r.reduce((e,t)=>{let r=n.get(t.currency);if(!r)return e;let i=a.get(r);if(!r||!i)return e;let o=i.get(`*`)||i.get(t.currency);return o&&e.push({account:t,chainItem:o}),e},[]).sort((e,t)=>(gf.get(e.chainItem.network)||999)-(gf.get(t.chainItem.network)||999));if(!y.length){let t=a.get(`ethereum`)?.get(`ethereum`);if(!t)throw Error(`Default chain not found`);return h.set([]),g=t,D([`N/A`]),ne(t.chain.id.toString()),C(e?.withCapabilities,[`N/A`],t.chain.id)}let b=s.accountId?s.accountId.startsWith(`js:`)?{type:`address`,address:s.accountId.split(`:`)[3]}:{type:`accountId`,accountId:s.accountId}:null,w=(b?y.find(e=>b.type===`address`?e.account.address===b.address:e.account.id===b.accountId):void 0)??(s.network?y.find(e=>e.chainItem.network===s.network):void 0)??y[0];if(!w)throw Error(`Account not found`);return f.set(w.account),g=w.chainItem,h.set(i(te())),D([w.account.address]),ne(g.chain.id.toString()),C(e?.withCapabilities,[w.account.address],g.chain.id)},te=()=>g?r(m.filter(e=>e.currency===g?.currencyId)):o(Error(`Current chain not found`)),{onAccountsChanged:D,onChainChanged:ne,onDisconnect:re}=Ar(l.emitter,ce),ie=async()=>({}),ae=async()=>n,oe=async()=>y.disconnect(),se=async()=>{let e=g?.chain.id;if(!e)throw Error(`Chain not found`);return e},le=async()=>[f.get()?.address],ue=e=>{f.set(e),D([e.address])},fe=e=>T(function*(){let t=_?.get(e.id);if(!t)return yield*new S({message:`Chain not found`,operation:`ledger-request-account`});let n=yield*E({try:()=>x.account.request({currencyIds:[t]}),catch:e=>new S({cause:e,message:`could not request account`,operation:`ledger-request-account`})});return m.push(n),u.set([...u.get(),e]),d.set(d.get().filter(t=>t.id!==e.id)),yield*E({try:()=>pe({chainId:e.id}),catch:e=>new S({cause:e,message:`failed to switch to new chain`,operation:`ledger-switch-chain`})})}),pe=async({chainId:e})=>{let t=g;if(!t||!v)throw Error(`Chain not found`);let n=[...v.values()].flatMap(e=>[...e.values()]).find(t=>t.chain.id===e);if(!n)throw Error(`Chain not found`);if(t.chain.id!==n.chain.id||!f.get()){g=n;let e=i(te());h.set(e),f.set(e[0])}let r=f.get();if(!r)throw Error(`Account not found`);return ne(e.toString()),D([r.address]),n.chain};return{...e,id:de.id,name:de.name,type:de.type,connect:w,onAccountsChanged:D,onChainChanged:ne,onDisconnect:re,getProvider:ie,isAuthorized:ae,getChainId:se,disconnect:oe,switchChain:pe,getAccounts:le,switchAccount:ue,requestAndSwitchAccount:fe,walletApiClient:x,$accountsOnCurrentChain:h.changes,$filteredChains:u.changes,$currentAccountId:p,$disabledChains:d.changes,noAccountPlaceholder:`N/A`,deserializeTransaction:tu,prepareTransaction:a}}),Wf=({enabledChainsMap:e,isLedgerDappBrowser:t,queryParams:n,runWalletEffect:r})=>T(function*(){let i=yield*wf;return{groupName:`Ledger Live`,wallets:[()=>({id:de.id,name:de.name,iconUrl:_.ledgerLogo,iconBackground:`#fff`,chainGroup:{id:de.id,title:de.name,iconUrl:_.ledgerLogo},availability:{_tag:`Injected`,detect:te(t)},createConnector:a=>Uf({walletDetailsParams:a,enabledChainsMap:e,isLedgerDappBrowser:t,prepareTransaction:i,queryParams:n,runWalletEffect:r})})]}});export{Wf as ledgerLiveConnector};