@wormhole-foundation/wormhole-connect 3.0.1-beta.1-development → 3.0.1-beta.2-development

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 (314) hide show
  1. package/dist/assets/{add-Cy39EVaY.js → add-CA46SOZ1.js} +1 -1
  2. package/dist/assets/{all-wallets-BG4OMn19.js → all-wallets-B1qnLkOo.js} +1 -1
  3. package/dist/assets/{app-store-B2VJcnKc.js → app-store-NTpCK9MF.js} +1 -1
  4. package/dist/assets/{apple-6OWWifFn.js → apple-DRVt4JWr.js} +1 -1
  5. package/dist/assets/{aptos-gb8snog6.js → aptos-63ExGocu.js} +1 -1
  6. package/dist/assets/{aptos-BuLH7jck.js → aptos-DkSiRwPH.js} +3 -3
  7. package/dist/assets/{arrow-bottom-YGKzRes5.js → arrow-bottom-CPth9tFV.js} +1 -1
  8. package/dist/assets/{arrow-bottom-circle-BH-P4D_L.js → arrow-bottom-circle-BWo9DWoB.js} +1 -1
  9. package/dist/assets/{arrow-left-DF2t0i5J.js → arrow-left-P6RmBJWT.js} +1 -1
  10. package/dist/assets/{arrow-right-CP40LqnJ.js → arrow-right-BHHiE7kD.js} +1 -1
  11. package/dist/assets/{arrow-top-DnKSFz-5.js → arrow-top-D5GRFsZm.js} +1 -1
  12. package/dist/assets/{bank-BpG6sNAE.js → bank-C2WLfHR8.js} +1 -1
  13. package/dist/assets/{basic-CLnavz_q.js → basic-BCJkH5GS.js} +1 -1
  14. package/dist/assets/{blake2b-B2b685Yu.js → blake2b-Bb1VZYtg.js} +1 -1
  15. package/dist/assets/{browser-BhlgRcS6.js → browser-BPjT1bN5.js} +1 -1
  16. package/dist/assets/{card-BTep0Fm_.js → card-JaBku5Bf.js} +1 -1
  17. package/dist/assets/{ccip-By49zU3M.js → ccip-CTrUg8DF.js} +1 -1
  18. package/dist/assets/{chain-Du7paeNG.js → chain-DF9mIQM9.js} +1 -1
  19. package/dist/assets/{checkmark-UEyfqUU3.js → checkmark-BQL5JCw2.js} +1 -1
  20. package/dist/assets/{checkmark-bold-DMLl2gC5.js → checkmark-bold-DP1vE2RN.js} +1 -1
  21. package/dist/assets/{chevron-bottom-CPv_izmZ.js → chevron-bottom-BV0Au0hP.js} +1 -1
  22. package/dist/assets/{chevron-left-0a7IeWd5.js → chevron-left-C4v6Iui8.js} +1 -1
  23. package/dist/assets/{chevron-right-B-0wsh8g.js → chevron-right-CbVMuuvx.js} +1 -1
  24. package/dist/assets/{chevron-top-BHFncmmu.js → chevron-top-CuIo_USv.js} +1 -1
  25. package/dist/assets/{chrome-store-BIaI9-ba.js → chrome-store-fbydRQd1.js} +1 -1
  26. package/dist/assets/{chunk-KJH4KKG6-Po5MChR6.js → chunk-KJH4KKG6-B7DCZZVY.js} +1 -1
  27. package/dist/assets/{clock-BQdD9J7H.js → clock-D62L3EFP.js} +1 -1
  28. package/dist/assets/{close-Cjok36co.js → close-BLRqO6Zn.js} +1 -1
  29. package/dist/assets/{coinPlaceholder-CneTHrCz.js → coinPlaceholder-0tmFvYYj.js} +1 -1
  30. package/dist/assets/{compass-Dit7B215.js → compass-Ba8-RKca.js} +1 -1
  31. package/dist/assets/{contract-BhySpM-Z.js → contract-bGGxC9_m.js} +1 -1
  32. package/dist/assets/{copy-JvNImG5R.js → copy-CWqrh_sD.js} +1 -1
  33. package/dist/assets/{create-gkOVonha.js → create-CbRd6EbF.js} +1 -1
  34. package/dist/assets/{cursor-CSwolbdC.js → cursor-DFYzmUAe.js} +1 -1
  35. package/dist/assets/{cursor-transparent-DQ2bEHaM.js → cursor-transparent-IY3fA7aT.js} +1 -1
  36. package/dist/assets/{desktop-F3wMUZcL.js → desktop-DLudyYW3.js} +1 -1
  37. package/dist/assets/{disconnect-vvd6SXmG.js → disconnect-gShcPNrf.js} +1 -1
  38. package/dist/assets/{discord-mwjbbdll.js → discord-S8T3fJF7.js} +1 -1
  39. package/dist/assets/{etherscan-ZpIOVA81.js → etherscan-C-ODOYjC.js} +1 -1
  40. package/dist/assets/{evm-fcQsoqVd.js → evm-D65l_VUA.js} +4 -4
  41. package/dist/assets/{evm-CWAxZ2a7.js → evm-DwqzhXfk.js} +3 -3
  42. package/dist/assets/{exclamation-triangle-CrFNsvqc.js → exclamation-triangle-I4hrUAkj.js} +1 -1
  43. package/dist/assets/{extension-C_zCCj6H.js → extension-C2E94rju.js} +1 -1
  44. package/dist/assets/{external-link-B0LEq1D3.js → external-link-BE25aYRx.js} +1 -1
  45. package/dist/assets/{facebook-B_HaXZVY.js → facebook-VHvsuzqv.js} +1 -1
  46. package/dist/assets/{farcaster-C9d4q5--.js → farcaster-sG7oFC35.js} +1 -1
  47. package/dist/assets/{filters-Coi2MlO2.js → filters-D9VcvmFo.js} +1 -1
  48. package/dist/assets/{github-DiDkJ9-4.js → github-BLJyKdzw.js} +1 -1
  49. package/dist/assets/{google-BHKYD7dA.js → google-C4YbBNSv.js} +1 -1
  50. package/dist/assets/{help-circle-lf3f_u3Q.js → help-circle-CMmVaOnp.js} +1 -1
  51. package/dist/assets/{id-BoAkobNw.js → id-g_mC9xVi.js} +1 -1
  52. package/dist/assets/{image-C9_T15rA.js → image-nAeKstDS.js} +1 -1
  53. package/dist/assets/{index-BgLBca6k.js → index-BTkoFKAW.js} +1 -1
  54. package/dist/assets/{index-Bx8vjRmV.js → index-BUtdFAj3.js} +1 -1
  55. package/dist/assets/index-BZFyhaji.js +1 -0
  56. package/dist/assets/{index-BpI-Jtyb.js → index-BqLA4xTj.js} +3 -3
  57. package/dist/assets/{index-BE55BSK7.js → index-C0-WLpMA.js} +1 -1
  58. package/dist/assets/{index-zEIfo2_n.js → index-CCOXtJ1P.js} +1 -1
  59. package/dist/assets/{index--d0JCrsI.js → index-CKPf-3Vo.js} +1 -1
  60. package/dist/assets/{index-DSTd1tRp.js → index-COZ2cSR6.js} +1 -1
  61. package/dist/assets/{index-BedU_k3i.js → index-CVqQ68io.js} +1 -1
  62. package/dist/assets/{index-DZ96gAj4.js → index-CVqXQiSE.js} +1 -1
  63. package/dist/assets/{index-TYicGq2L.js → index-CYFq9U58.js} +1 -1
  64. package/dist/assets/{index-BYTZG2bF.js → index-C_YTupmk.js} +1 -1
  65. package/dist/assets/{index-BJYqkXUw.js → index-Cu0b-jgK.js} +1 -1
  66. package/dist/assets/{index-DB7g9m_R.js → index-DA4wR-ie.js} +1 -1
  67. package/dist/assets/{index-kF0xEQ0E.js → index-DC3x_AFd.js} +1 -1
  68. package/dist/assets/{index-DMWfYwZZ.js → index-DKdokzug.js} +1 -1
  69. package/dist/assets/{index-BZCSByFC.js → index-DusYxt7C.js} +3 -3
  70. package/dist/assets/{index-BjvqCh5g.js → index-DynC8vQ4.js} +1 -1
  71. package/dist/assets/{index-Breet2G4.js → index-GmuqTVr0.js} +1 -1
  72. package/dist/assets/index.es-CWMLsIMc.js +47 -0
  73. package/dist/assets/index.es-g5_0R3zE.js +15 -0
  74. package/dist/assets/{info-C0I2HHbp.js → info-P71aU507.js} +1 -1
  75. package/dist/assets/{info-circle-BJmxBusI.js → info-circle-D8ZhpY4M.js} +1 -1
  76. package/dist/assets/{lightbulb-Chfw09TV.js → lightbulb-CWL8Hapk.js} +1 -1
  77. package/dist/assets/{mail-BGqa051c.js → mail-BKdMRnR2.js} +1 -1
  78. package/dist/assets/{mobile-DkPjbMNa.js → mobile-Bw0EoBkW.js} +1 -1
  79. package/dist/assets/{more-f7FKhsyw.js → more-BSKGQd1b.js} +1 -1
  80. package/dist/assets/{network-placeholder-DyyxIB08.js → network-placeholder-B1xqyidN.js} +1 -1
  81. package/dist/assets/{nftPlaceholder-CfDPimUz.js → nftPlaceholder-CuCsNvkN.js} +1 -1
  82. package/dist/assets/{off-BvnUT7bh.js → off-BX6zoZuA.js} +1 -1
  83. package/dist/assets/{play-store-Dl8Di4Xz.js → play-store-CCveEK_B.js} +1 -1
  84. package/dist/assets/{plus-Dtc5pm0q.js → plus-C02SGp4V.js} +1 -1
  85. package/dist/assets/{provider-jsonrpc-CG-x8-V6.js → provider-jsonrpc-DTnJKzTS.js} +1 -1
  86. package/dist/assets/{qr-code-b5m8lMyQ.js → qr-code-DGe_aS_i.js} +1 -1
  87. package/dist/assets/{recycle-horizontal-DztIZMpd.js → recycle-horizontal-DtRomJbx.js} +1 -1
  88. package/dist/assets/{refresh-Z55s9i8s.js → refresh-DPABcpes.js} +1 -1
  89. package/dist/assets/{reown-logo-BVpI-nfV.js → reown-logo-DG2ULLka.js} +1 -1
  90. package/dist/assets/{search-CjKBf0db.js → search-EURxday_.js} +1 -1
  91. package/dist/assets/{secp256k1-BHTD1Qmp.js → secp256k1-D-G9AbtW.js} +1 -1
  92. package/dist/assets/{secp256k1-CCS9UBYD.js → secp256k1-DfnLU_Rr.js} +1 -1
  93. package/dist/assets/{send-DRsIh8XD.js → send-t6aoH9GB.js} +1 -1
  94. package/dist/assets/signer-7-tpWjBV.js +2 -0
  95. package/dist/assets/{solana-D0M1N7L4.js → solana-C-diloCa.js} +18 -18
  96. package/dist/assets/solana-C6mHMmQi.js +2 -0
  97. package/dist/assets/solanaEmbed.esm-DhAz8SOB.js +10 -0
  98. package/dist/assets/{sui-DXdm7DBB.js → sui-DXg2Lhyt.js} +4 -4
  99. package/dist/assets/{sui-CXoaI0gx.js → sui-Pc10JTxL.js} +2 -2
  100. package/dist/assets/{swapHorizontal-COY_WODc.js → swapHorizontal-Cd2Bq-oX.js} +1 -1
  101. package/dist/assets/{swapHorizontalBold-C0JXN9CW.js → swapHorizontalBold-CK6YXqcD.js} +1 -1
  102. package/dist/assets/{swapHorizontalMedium-DH34hVvb.js → swapHorizontalMedium-BCT4Hlrg.js} +1 -1
  103. package/dist/assets/{swapHorizontalRoundedBold-Cbu2lR_U.js → swapHorizontalRoundedBold-C-NDd7Fq.js} +1 -1
  104. package/dist/assets/{swapVertical-CjpRMkF_.js → swapVertical-BfKszPb9.js} +1 -1
  105. package/dist/assets/{telegram-DxmYoEg_.js → telegram-D5sYoBZp.js} +1 -1
  106. package/dist/assets/{three-dots-GsCsg39y.js → three-dots-qiTqAG0h.js} +1 -1
  107. package/dist/assets/{tokens-DNQKjj3l.js → tokens-BjeNFBPV.js} +2 -2
  108. package/dist/assets/{twitch-LH0w9yHE.js → twitch-1VH6BaUA.js} +1 -1
  109. package/dist/assets/{twitterIcon-Ci6YQIIR.js → twitterIcon-hIEIDwcz.js} +1 -1
  110. package/dist/assets/{verify-CLWJXQKG.js → verify-DxvRt34f.js} +1 -1
  111. package/dist/assets/{verify-filled-Bgbn2dT_.js → verify-filled-RtidYdgS.js} +1 -1
  112. package/dist/assets/{w3m-modal-BR4v9o5N.js → w3m-modal-DI_ypCY0.js} +1 -1
  113. package/dist/assets/{wallet-Dy9a13FP.js → wallet-Cb9kcAk9.js} +1 -1
  114. package/dist/assets/{wallet-placeholder-BlMcAG8z.js → wallet-placeholder-pTFD8Qr_.js} +1 -1
  115. package/dist/assets/{walletconnect-BmSWYy7N.js → walletconnect-DvJIx5jD.js} +1 -1
  116. package/dist/assets/{warning-circle-DUSLmVwm.js → warning-circle-CRzNiBlj.js} +1 -1
  117. package/dist/assets/{x-D-BfG-2C.js → x-Dk-mK5uZ.js} +1 -1
  118. package/dist/main.js +74 -74
  119. package/dist/src/utils/wallet/solana.d.ts.map +1 -1
  120. package/dist/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
  121. package/lib/{add-DjQ9ptJ3.js → add-DVGSYBJf.js} +1 -1
  122. package/lib/{add-B42z-BMK.mjs → add-DrLWWjDN.mjs} +1 -1
  123. package/lib/{all-wallets-DafV-6aS.mjs → all-wallets-CjzZMHCA.mjs} +1 -1
  124. package/lib/{all-wallets-CTXkmZGh.js → all-wallets-DGVJQYa0.js} +1 -1
  125. package/lib/{app-store-CEiGuBPg.js → app-store-BABxSxrd.js} +1 -1
  126. package/lib/{app-store-Cl2NeyfU.mjs → app-store-kpf503GR.mjs} +1 -1
  127. package/lib/{apple-Bgd40Qpf.mjs → apple-C0AtBJDu.mjs} +1 -1
  128. package/lib/{apple-I35UUnyy.js → apple-C962M6Ax.js} +1 -1
  129. package/lib/{aptos-CFxhkz1T.mjs → aptos-XxQj_uxF.mjs} +1 -1
  130. package/lib/{aptos-Cwu1YPJ4.js → aptos-uWJCRLoQ.js} +1 -1
  131. package/lib/{arrow-bottom-ChKqsjAW.js → arrow-bottom-CIZJcZfr.js} +1 -1
  132. package/lib/{arrow-bottom-oM7dsIav.mjs → arrow-bottom-D0wK6uMJ.mjs} +1 -1
  133. package/lib/{arrow-bottom-circle-CrW7hvKb.mjs → arrow-bottom-circle-D5QwftYY.mjs} +1 -1
  134. package/lib/{arrow-bottom-circle-CZ_7PXrz.js → arrow-bottom-circle-iOl-NxXR.js} +1 -1
  135. package/lib/{arrow-left-BnsvMZrw.mjs → arrow-left-BL0dHjzy.mjs} +1 -1
  136. package/lib/{arrow-left-Bsuqh6ly.js → arrow-left-C-RAtnQ2.js} +1 -1
  137. package/lib/{arrow-right-BnOX1FPQ.js → arrow-right-COiq03Wj.js} +1 -1
  138. package/lib/{arrow-right-DCVdKrqV.mjs → arrow-right-DaZMOW_1.mjs} +1 -1
  139. package/lib/{arrow-top-CGNi9Abs.js → arrow-top-7Srj2XLP.js} +1 -1
  140. package/lib/{arrow-top-HQD35uzA.mjs → arrow-top-QPVhK81o.mjs} +1 -1
  141. package/lib/{bank-CC-gMFj5.js → bank-Bp2l8LtZ.js} +1 -1
  142. package/lib/{bank-5_XGvsWz.mjs → bank-C5lNHVtL.mjs} +1 -1
  143. package/lib/{basic-kfkYJmqS.mjs → basic-C5W71-rE.mjs} +2 -2
  144. package/lib/{basic-Cg6_7ml5.js → basic-DQ6ISwhI.js} +1 -1
  145. package/lib/{browser-CnMcQaL7.mjs → browser-CJhUYmz6.mjs} +1 -1
  146. package/lib/{browser-QU3oDASy.js → browser-DV0hL_fK.js} +1 -1
  147. package/lib/{card-2RHw5YuR.mjs → card-DSeabGLV.mjs} +1 -1
  148. package/lib/{card-Drhs2ElR.js → card-yZLq1X6c.js} +1 -1
  149. package/lib/{ccip-B-6LnaS-.js → ccip-BCsOYNZd.js} +1 -1
  150. package/lib/{ccip-HRN5GU9R.mjs → ccip-CFqlillN.mjs} +1 -1
  151. package/lib/{checkmark-DBiIELPX.js → checkmark-BW4NeFlB.js} +1 -1
  152. package/lib/{checkmark-DzamL7X4.mjs → checkmark-DhgNpDof.mjs} +1 -1
  153. package/lib/{checkmark-bold-Bj1aj7It.mjs → checkmark-bold-CxJkyUOt.mjs} +1 -1
  154. package/lib/{checkmark-bold-BtLa1z0X.js → checkmark-bold-DnEFF9eL.js} +1 -1
  155. package/lib/{chevron-bottom-BwEoAp0U.mjs → chevron-bottom-Pi9qTSKk.mjs} +1 -1
  156. package/lib/{chevron-bottom-BoXMZSSJ.js → chevron-bottom-Tb5GYU7P.js} +1 -1
  157. package/lib/{chevron-left-C8qlvot4.js → chevron-left-BRp6K_BQ.js} +1 -1
  158. package/lib/{chevron-left-Cd53L2Rd.mjs → chevron-left-Cl35pkRv.mjs} +1 -1
  159. package/lib/{chevron-right-BKR2Cj8x.js → chevron-right-D1Ic6C28.js} +1 -1
  160. package/lib/{chevron-right-BjnbXBQh.mjs → chevron-right-pjH-xKxB.mjs} +1 -1
  161. package/lib/{chevron-top-DZM0Kk5N.mjs → chevron-top-DSe-dX8z.mjs} +1 -1
  162. package/lib/{chevron-top-C1-UVQzc.js → chevron-top-SdyRa8IE.js} +1 -1
  163. package/lib/{chrome-store-DEpEGVnh.js → chrome-store-0qgfQSAS.js} +1 -1
  164. package/lib/{chrome-store-Be16ARhh.mjs → chrome-store-ThoUGIhl.mjs} +1 -1
  165. package/lib/{clock-2d6ryT3H.js → clock-2HqPHolX.js} +1 -1
  166. package/lib/{clock-lGyym1Yu.mjs → clock-B0sBEXQ5.mjs} +1 -1
  167. package/lib/{close-B-KS6tMf.js → close-BJQf5USo.js} +1 -1
  168. package/lib/{close-Bd0ixtrI.mjs → close-Bznv5frT.mjs} +1 -1
  169. package/lib/{coinPlaceholder-CM171HV_.mjs → coinPlaceholder-1gZoTAqN.mjs} +1 -1
  170. package/lib/{coinPlaceholder-1F-4zLUF.js → coinPlaceholder-CvvSiYI-.js} +1 -1
  171. package/lib/{compass-BtYGtp4s.js → compass-BBMA-82e.js} +1 -1
  172. package/lib/{compass-BC4EBgBf.mjs → compass-BE99mJOV.mjs} +1 -1
  173. package/lib/{constants-D2XMo5x9.js → constants-BDS32jve.js} +1 -1
  174. package/lib/{constants-CbX2Dhdb.mjs → constants-Bp_337ur.mjs} +3 -3
  175. package/lib/{copy-YhaE0x9J.js → copy-B_JboG8P.js} +1 -1
  176. package/lib/{copy-CBZyjKhN.mjs → copy-Cwolsgnk.mjs} +1 -1
  177. package/lib/{cursor-HObwislP.mjs → cursor-0EyS6nH4.mjs} +1 -1
  178. package/lib/{cursor-DbW8CM2r.js → cursor-C2jyr1Tt.js} +1 -1
  179. package/lib/{cursor-transparent-D8qt_JkJ.js → cursor-transparent-BaVE19A2.js} +1 -1
  180. package/lib/{cursor-transparent-DRSuTF8F.mjs → cursor-transparent-ZUI7NwAo.mjs} +1 -1
  181. package/lib/{desktop-BXB88_hI.mjs → desktop-B1U1mc6q.mjs} +1 -1
  182. package/lib/{desktop-DPSb6pT6.js → desktop-Dmz61Quh.js} +1 -1
  183. package/lib/{disconnect-DQlW_0l3.mjs → disconnect-8HUMogEY.mjs} +1 -1
  184. package/lib/{disconnect-voPLjD1W.js → disconnect-Bn_0Td6c.js} +1 -1
  185. package/lib/{discord-ZKqi5hgs.js → discord-4tBuPwio.js} +1 -1
  186. package/lib/{discord-rENS1KkQ.mjs → discord-DNMu-4pj.mjs} +1 -1
  187. package/lib/{etherscan-DuY447FG.js → etherscan-CdfpxSFw.js} +1 -1
  188. package/lib/{etherscan-CQI3NP6J.mjs → etherscan-DTafkFM9.mjs} +1 -1
  189. package/lib/{evm-B2lMpZxw.mjs → evm-B5SS0axR.mjs} +3 -3
  190. package/lib/{evm-G8FJAICS.js → evm-BZKMUp6E.js} +3 -3
  191. package/lib/{exclamation-triangle-D_u6lS5N.mjs → exclamation-triangle-BLb5RCv9.mjs} +1 -1
  192. package/lib/{exclamation-triangle-zkHXR2rM.js → exclamation-triangle-W8wr4W3B.js} +1 -1
  193. package/lib/{extension-DG4qfZ6E.js → extension-B3rp6j3f.js} +1 -1
  194. package/lib/{extension-ClXThzlK.mjs → extension-DqXaH5V_.mjs} +1 -1
  195. package/lib/{external-link-DzFTOSFi.js → external-link-DWSOPcgR.js} +1 -1
  196. package/lib/{external-link-DMigdm5_.mjs → external-link-DupOMQca.mjs} +1 -1
  197. package/lib/{facebook-CXPHu-CF.mjs → facebook-C25qgXgI.mjs} +1 -1
  198. package/lib/{facebook-DZcyCqTR.js → facebook-gaoSLwmV.js} +1 -1
  199. package/lib/{farcaster-3fnaNorD.mjs → farcaster-BKQVbYft.mjs} +1 -1
  200. package/lib/{farcaster-DGzbpSpo.js → farcaster-Dw_KFzSe.js} +1 -1
  201. package/lib/{filters-DOCA08Tb.mjs → filters-BRj-u8fO.mjs} +1 -1
  202. package/lib/{filters-GdndcLvS.js → filters-BSv2GVWx.js} +1 -1
  203. package/lib/{github-Bt6o8gEP.mjs → github-B8zYv5B1.mjs} +1 -1
  204. package/lib/{github-CS10Dwev.js → github-CVSqx81G.js} +1 -1
  205. package/lib/{google-oL8KgGKh.mjs → google-CJy4jhj7.mjs} +1 -1
  206. package/lib/{google-C3HmxVw4.js → google-DWyFM_-_.js} +1 -1
  207. package/lib/{help-circle-vyJ6xZHu.js → help-circle-BihX0QHp.js} +1 -1
  208. package/lib/{help-circle-Bwas4fUE.mjs → help-circle-D2kyGnMD.mjs} +1 -1
  209. package/lib/hosted.js +1 -1
  210. package/lib/hosted.mjs +1 -1
  211. package/lib/{id-BMthpDYz.mjs → id-BvDoX2i7.mjs} +1 -1
  212. package/lib/{id-Cn7OOd5x.js → id-ZWI-bwNJ.js} +1 -1
  213. package/lib/{image-Ci9ZM4mR.mjs → image-BeWwKKKj.mjs} +1 -1
  214. package/lib/{image-CgBZH2xZ.js → image-CNQTgOF8.js} +1 -1
  215. package/lib/{index-BvNzRolu.mjs → index-BXBTU3I5.mjs} +78 -78
  216. package/lib/{index-B5zOthpC.js → index-D2yjOpeA.js} +2 -2
  217. package/lib/{index-BI7ozQB8.mjs → index-Dpl42t-y.mjs} +19175 -19175
  218. package/lib/index-DwMMfwYI.js +304 -0
  219. package/lib/{index.es-CUXwE1pM.js → index.es-BvsB6Z8q.js} +1 -1
  220. package/lib/{index.es-C1D-rKkY.js → index.es-C2112Y2b.js} +1 -1
  221. package/lib/{index.es-BT9MvJ7o.mjs → index.es-C4KG3MSj.mjs} +1 -1
  222. package/lib/{index.es-B0qJRcfn.mjs → index.es-Cy_oFTNH.mjs} +3 -3
  223. package/lib/index.js +1 -1
  224. package/lib/index.mjs +1 -1
  225. package/lib/{info-D85fqVFL.js → info-C73QOiqc.js} +1 -1
  226. package/lib/{info-ELzT7QIr.mjs → info-CjKZyXW_.mjs} +1 -1
  227. package/lib/{info-circle-DK-6CdS6.mjs → info-circle-CEpS6rzX.mjs} +1 -1
  228. package/lib/{info-circle-NpvKzNp7.js → info-circle-DE-EmffO.js} +1 -1
  229. package/lib/{lightbulb-Dy_NOzox.mjs → lightbulb-BVq3C-EG.mjs} +1 -1
  230. package/lib/{lightbulb-CiJVLtFu.js → lightbulb-Dm6Hsfd3.js} +1 -1
  231. package/lib/{mail-X76s8rfB.mjs → mail-CqUQETIH.mjs} +1 -1
  232. package/lib/{mail-DMR6frsv.js → mail-GRon9tbg.js} +1 -1
  233. package/lib/{mobile-Dz75gLYD.js → mobile-BmGmHmVh.js} +1 -1
  234. package/lib/{mobile-CTWZtoa-.mjs → mobile-CEbEFp0X.mjs} +1 -1
  235. package/lib/{more-BwPnu0VI.js → more-CnS-NcGa.js} +1 -1
  236. package/lib/{more-BGUpPogP.mjs → more-Cs0cmKvd.mjs} +1 -1
  237. package/lib/{network-placeholder-CF8oh182.js → network-placeholder-CjPyqfGa.js} +1 -1
  238. package/lib/{network-placeholder-DU2R8jQ2.mjs → network-placeholder-DYuB36S0.mjs} +1 -1
  239. package/lib/{nftPlaceholder-CoKZUHau.mjs → nftPlaceholder-COJmgjQo.mjs} +1 -1
  240. package/lib/{nftPlaceholder-buAZxl05.js → nftPlaceholder-CoY2NOAz.js} +1 -1
  241. package/lib/{off-qyRQY4Vl.js → off-B-WmBPpa.js} +1 -1
  242. package/lib/{off-D0Z3jgVT.mjs → off-CZo3LYgL.mjs} +1 -1
  243. package/lib/{play-store-jvvEP4Tn.js → play-store-Chciiwp3.js} +1 -1
  244. package/lib/{play-store-CYMg-nje.mjs → play-store-Edmxg3AX.mjs} +1 -1
  245. package/lib/{plus-Bu2X2bwl.js → plus-C93OSdaz.js} +1 -1
  246. package/lib/{plus-B1VhqUcA.mjs → plus-D2jFkgs1.mjs} +1 -1
  247. package/lib/{qr-code-BAYTKQF7.mjs → qr-code-c2tFySK0.mjs} +1 -1
  248. package/lib/{qr-code-CbgdCuGb.js → qr-code-y78Lk8wE.js} +1 -1
  249. package/lib/{recycle-horizontal-DEJL9OlS.mjs → recycle-horizontal-CWycpdDF.mjs} +1 -1
  250. package/lib/{recycle-horizontal-DRYNZsFE.js → recycle-horizontal-PXk9BX3j.js} +1 -1
  251. package/lib/{refresh-KOIfdwUh.mjs → refresh-C77_db2T.mjs} +1 -1
  252. package/lib/{refresh-oE_ngLqp.js → refresh-mky0B17c.js} +1 -1
  253. package/lib/{reown-logo-Dmpg2FAv.mjs → reown-logo-0RkEf9EI.mjs} +1 -1
  254. package/lib/{reown-logo-C3Mide1i.js → reown-logo-DceXhK36.js} +1 -1
  255. package/lib/{search-CuC3rSF2.mjs → search-BrMSW1-8.mjs} +1 -1
  256. package/lib/{search-mOkjsGJ1.js → search-CWru3218.js} +1 -1
  257. package/lib/{secp256k1-rd_mphQA.js → secp256k1-BU-UfBCB.js} +1 -1
  258. package/lib/{secp256k1-C0qkk-vR.mjs → secp256k1-C4P0dmMC.mjs} +1 -1
  259. package/lib/{secp256k1-Bja14kVd.mjs → secp256k1-CI3_SM8F.mjs} +1 -1
  260. package/lib/{secp256k1-D4Srooit.js → secp256k1-Cks0bicH.js} +1 -1
  261. package/lib/{send-BB0_nSIX.js → send-CRyBVD1k.js} +1 -1
  262. package/lib/{send-yzjpu02e.mjs → send-DFkvxnIh.mjs} +1 -1
  263. package/lib/{solana-Dr0ynR-F.js → solana-BVnMWq13.js} +14 -14
  264. package/lib/{solana-BiosgjxK.mjs → solana-L02hbBDE.mjs} +387 -373
  265. package/lib/{solanaEmbed.esm-r6Bac8PP.js → solanaEmbed.esm-BG5cgKub.js} +1 -1
  266. package/lib/{solanaEmbed.esm-0jQKzy4d.mjs → solanaEmbed.esm-DSwNdsgx.mjs} +1 -1
  267. package/lib/src/utils/wallet/solana.d.ts.map +1 -1
  268. package/lib/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
  269. package/lib/{sui-CfRHIkOa.mjs → sui-CN1tZAOs.mjs} +1 -1
  270. package/lib/{sui-ggIMQCwd.js → sui-Dv1p0XoG.js} +1 -1
  271. package/lib/{swapHorizontal-C6KHRSpK.js → swapHorizontal-BiCkAPre.js} +1 -1
  272. package/lib/{swapHorizontal-zZeZYYWF.mjs → swapHorizontal-Bo_-2U6j.mjs} +1 -1
  273. package/lib/{swapHorizontalBold-1MC8ZOxh.mjs → swapHorizontalBold-BPL2XaSi.mjs} +1 -1
  274. package/lib/{swapHorizontalBold-DoVEdayo.js → swapHorizontalBold-CWHbSIEu.js} +1 -1
  275. package/lib/{swapHorizontalMedium-BOHZ9Dg5.mjs → swapHorizontalMedium-CTsDFfzR.mjs} +1 -1
  276. package/lib/{swapHorizontalMedium-DcR2VrrT.js → swapHorizontalMedium-D_2Z2Hfq.js} +1 -1
  277. package/lib/{swapHorizontalRoundedBold-JEVvyOfQ.mjs → swapHorizontalRoundedBold-8b5z2YJ_.mjs} +1 -1
  278. package/lib/{swapHorizontalRoundedBold-N6P7ZpxL.js → swapHorizontalRoundedBold-CDKFFagj.js} +1 -1
  279. package/lib/{swapVertical-CS2a-XY6.js → swapVertical-CNBatiM6.js} +1 -1
  280. package/lib/{swapVertical-BULwQAah.mjs → swapVertical-UTCgpnIJ.mjs} +1 -1
  281. package/lib/{telegram-DSzKqVhj.mjs → telegram-CVvlgH_Z.mjs} +1 -1
  282. package/lib/{telegram-DuIkJcxV.js → telegram-lTj0r5My.js} +1 -1
  283. package/lib/{three-dots-sLfFBOoe.js → three-dots-DQLgK82o.js} +1 -1
  284. package/lib/{three-dots-DgHvZG77.mjs → three-dots-KK4NyvR7.mjs} +1 -1
  285. package/lib/{tokens-Dl_W_iHS.js → tokens-B2pmB4Ph.js} +1 -1
  286. package/lib/{tokens-CA42f7sB.mjs → tokens-BQHmitaT.mjs} +1 -1
  287. package/lib/{twitch-BhO_1W8r.mjs → twitch-CO4nmS5o.mjs} +1 -1
  288. package/lib/{twitch-m9JiCf-P.js → twitch-wV3Yc6kA.js} +1 -1
  289. package/lib/{twitterIcon-fsFN1hu7.mjs → twitterIcon-BU99IvD2.mjs} +1 -1
  290. package/lib/{twitterIcon--GnF9nvE.js → twitterIcon-pCNPPny7.js} +1 -1
  291. package/lib/{verify-Bjs90N4f.js → verify-B21LHiy7.js} +1 -1
  292. package/lib/{verify-Db3SLGRB.mjs → verify-Ci9XMhb8.mjs} +1 -1
  293. package/lib/{verify-filled-Q7X_30fP.js → verify-filled-DCMcHuAt.js} +1 -1
  294. package/lib/{verify-filled-LLxJtqw8.mjs → verify-filled-LUtqUhbS.mjs} +1 -1
  295. package/lib/{w3m-modal-By8X9uSa.mjs → w3m-modal-BJkuxcj8.mjs} +2 -2
  296. package/lib/{w3m-modal-bNYiLd7-.js → w3m-modal-DJRTg4Aa.js} +1 -1
  297. package/lib/{wallet-C6wn2W37.js → wallet-BqBebKQF.js} +1 -1
  298. package/lib/{wallet-DyFpD6Ri.mjs → wallet-USpq1vKL.mjs} +1 -1
  299. package/lib/{wallet-placeholder-C0U4gPUC.mjs → wallet-placeholder-CL_evZUb.mjs} +1 -1
  300. package/lib/{wallet-placeholder-CX66BGYj.js → wallet-placeholder-Cf1u-2wB.js} +1 -1
  301. package/lib/{walletconnect-BaXoBzrQ.mjs → walletconnect-3g5k3agX.mjs} +1 -1
  302. package/lib/{walletconnect-C0zt_mNA.js → walletconnect-Da6ZdP8w.js} +1 -1
  303. package/lib/{warning-circle-DqwHoo9u.mjs → warning-circle-B3ivLfCN.mjs} +1 -1
  304. package/lib/{warning-circle-Dy3ZubCh.js → warning-circle-CvTdOy7u.js} +1 -1
  305. package/lib/{x-OReg0vUC.mjs → x-BOwtJrlH.mjs} +1 -1
  306. package/lib/{x-C4e8AToN.js → x-DQCRmr2P.js} +1 -1
  307. package/package.json +1 -1
  308. package/dist/assets/index-Z3Xir6L3.js +0 -1
  309. package/dist/assets/index.es-3Tq6bjFW.js +0 -47
  310. package/dist/assets/index.es-CBqWEk7T.js +0 -15
  311. package/dist/assets/signer-BRan8q4C.js +0 -2
  312. package/dist/assets/solana-B3bc0p0T.js +0 -2
  313. package/dist/assets/solanaEmbed.esm-Mnq6o_qa.js +0 -10
  314. package/lib/index-Drek_-UI.js +0 -304
@@ -1,3 +1,3 @@
1
- import{f as V,k as Jr,c$ as Qr,c as Xt,cL as ei,j as Vn,P as q,aX as vt,d0 as ve,b as G,d1 as Je,L as Fn,T as zn,cJ as qn,cK as Gn,cO as ti,cN as ni}from"../main.js";function ya(r){if(r!==void 0)return{connection:r}}var R={},b={};let U=class{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}};b.Layout=U;function Pt(r,t){return t.property?r+"["+t.property+"]":r}b.nameWithProperty=Pt;function ri(r,t){if(typeof r!="function")throw new TypeError("Class must be constructor");if(r.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof U))throw new TypeError("layout must be a Layout");if(t.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=t,t.boundConstructor_=r,t.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value:function(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(r,"decode",{value:function(e,n){return t.decode(e,n)},writable:!0})}b.bindConstructorLayout=ri;let Z=class extends U{isCount(){throw new Error("ExternalLayout is abstract")}};class Kn extends Z{constructor(t,e){if(t===void 0&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e){e===void 0&&(e=0);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}let Dt=class extends Z{constructor(t,e,n){if(!(t instanceof U))throw new TypeError("layout must be a Layout");if(e===void 0)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof te||this.layout instanceof se}decode(t,e){return e===void 0&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return n===void 0&&(n=0),this.layout.encode(t,e,n+this.offset)}},te=class extends U{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return e===void 0&&(e=0),t.readUIntLE(e,this.span)}encode(t,e,n){return n===void 0&&(n=0),e.writeUIntLE(t,n,this.span),this.span}},se=class extends U{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return e===void 0&&(e=0),t.readUIntBE(e,this.span)}encode(t,e,n){return n===void 0&&(n=0),e.writeUIntBE(t,n,this.span),this.span}};class pe extends U{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return e===void 0&&(e=0),t.readIntLE(e,this.span)}encode(t,e,n){return n===void 0&&(n=0),e.writeIntLE(t,n,this.span),this.span}}class _e extends U{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return e===void 0&&(e=0),t.readIntBE(e,this.span)}encode(t,e,n){return n===void 0&&(n=0),e.writeIntBE(t,n,this.span),this.span}}const bt=Math.pow(2,32);function Qe(r){const t=Math.floor(r/bt),e=r-t*bt;return{hi32:t,lo32:e}}function et(r,t){return r*bt+t}let ii=class extends U{constructor(t){super(8,t)}decode(t,e){e===void 0&&(e=0);const n=t.readUInt32LE(e),i=t.readUInt32LE(e+4);return et(i,n)}encode(t,e,n){n===void 0&&(n=0);const i=Qe(t);return e.writeUInt32LE(i.lo32,n),e.writeUInt32LE(i.hi32,n+4),8}};class oi extends U{constructor(t){super(8,t)}decode(t,e){e===void 0&&(e=0);const n=t.readUInt32BE(e),i=t.readUInt32BE(e+4);return et(n,i)}encode(t,e,n){n===void 0&&(n=0);const i=Qe(t);return e.writeUInt32BE(i.hi32,n),e.writeUInt32BE(i.lo32,n+4),8}}let si=class extends U{constructor(t){super(8,t)}decode(t,e){e===void 0&&(e=0);const n=t.readUInt32LE(e),i=t.readInt32LE(e+4);return et(i,n)}encode(t,e,n){n===void 0&&(n=0);const i=Qe(t);return e.writeUInt32LE(i.lo32,n),e.writeInt32LE(i.hi32,n+4),8}};class ai extends U{constructor(t){super(8,t)}decode(t,e){e===void 0&&(e=0);const n=t.readInt32BE(e),i=t.readUInt32BE(e+4);return et(n,i)}encode(t,e,n){n===void 0&&(n=0);const i=Qe(t);return e.writeInt32BE(i.hi32,n),e.writeUInt32BE(i.lo32,n+4),8}}class Zn extends U{constructor(t){super(4,t)}decode(t,e){return e===void 0&&(e=0),t.readFloatLE(e)}encode(t,e,n){return n===void 0&&(n=0),e.writeFloatLE(t,n),4}}class Hn extends U{constructor(t){super(4,t)}decode(t,e){return e===void 0&&(e=0),t.readFloatBE(e)}encode(t,e,n){return n===void 0&&(n=0),e.writeFloatBE(t,n),4}}class Wn extends U{constructor(t){super(8,t)}decode(t,e){return e===void 0&&(e=0),t.readDoubleLE(e)}encode(t,e,n){return n===void 0&&(n=0),e.writeDoubleLE(t,n),8}}class Xn extends U{constructor(t){super(8,t)}decode(t,e){return e===void 0&&(e=0),t.readDoubleBE(e)}encode(t,e,n){return n===void 0&&(n=0),e.writeDoubleBE(t,n),8}}class Yn extends U{constructor(t,e,n){if(!(t instanceof U))throw new TypeError("elementLayout must be a Layout");if(!(e instanceof Z&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let i=-1;!(e instanceof Z)&&0<t.span&&(i=e*t.span),super(i,n),this.elementLayout=t,this.count=e}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0,i=this.count;if(i instanceof Z&&(i=i.decode(t,e)),0<this.elementLayout.span)n=i*this.elementLayout.span;else{let o=0;for(;o<i;)n+=this.elementLayout.getSpan(t,e+n),++o}return n}decode(t,e){e===void 0&&(e=0);const n=[];let i=0,o=this.count;for(o instanceof Z&&(o=o.decode(t,e));i<o;)n.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),i+=1;return n}encode(t,e,n){n===void 0&&(n=0);const i=this.elementLayout,o=t.reduce((s,a)=>s+i.encode(a,e,n+s),0);return this.count instanceof Z&&this.count.encode(t.length,e,n),o}}let Jn=class extends U{constructor(t,e,n){if(!(Array.isArray(t)&&t.reduce((o,s)=>o&&s instanceof U,!0)))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const o of t)if(0>o.span&&o.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=t.reduce((o,s)=>o+s.getSpan(),0)}catch{}super(i,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;try{n=this.fields.reduce((i,o)=>{const s=o.getSpan(t,e);return e+=s,i+s},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e){e===void 0&&(e=0);const n=this.makeDestinationObject();for(const i of this.fields)if(i.property!==void 0&&(n[i.property]=i.decode(t,e)),e+=i.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){n===void 0&&(n=0);const i=n;let o=0,s=0;for(const a of this.fields){let d=a.span;if(s=0<d?d:0,a.property!==void 0){const c=t[a.property];c!==void 0&&(s=a.encode(c,e,n),0>d&&(d=a.getSpan(e,n)))}o=n,n+=d}return o+s-i}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0<t.length&&(e[n.property]=t.shift());return e}layoutFor(t){if(typeof t!="string")throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}offsetOf(t){if(typeof t!="string")throw new TypeError("property must be string");let e=0;for(const n of this.fields){if(n.property===t)return e;0>n.span?e=-1:0<=e&&(e+=n.span)}}},Ut=class{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}},Ke=class extends Ut{constructor(t,e){if(!(t instanceof Z&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}},Nt=class extends U{constructor(t,e,n){const i=t instanceof te||t instanceof se;if(i)t=new Ke(new Dt(t));else if(t instanceof Z&&t.isCount())t=new Ke(t);else if(!(t instanceof Ut))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof U))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let o=-1;e&&(o=e.span,0<=o&&i&&(o+=t.layout.span)),super(o,n),this.discriminator=t,this.usesPrefixDiscriminator=i,this.defaultLayout=e,this.registry={};let s=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(a){return s(a)},this.configGetSourceVariant=function(a){s=a.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){e===void 0&&(e=0);let n;const i=this.discriminator,o=i.decode(t,e);let s=this.registry[o];if(s===void 0){let a=0;s=this.defaultLayout,this.usesPrefixDiscriminator&&(a=i.layout.span),n=this.makeDestinationObject(),n[i.property]=o,n[s.property]=this.defaultLayout.decode(t,e+a)}else n=s.decode(t,e);return n}encode(t,e,n){n===void 0&&(n=0);const i=this.getSourceVariant(t);if(i===void 0){const o=this.discriminator,s=this.defaultLayout;let a=0;return this.usesPrefixDiscriminator&&(a=o.layout.span),o.encode(t[o.property],e,n),a+s.encode(t[s.property],e,n+a)}return i.encode(t,e,n)}addVariant(t,e,n){const i=new Qn(this,t,e,n);return this.registry[t]=i,i}getVariant(t,e){let n=t;return V.Buffer.isBuffer(t)&&(e===void 0&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}},Qn=class extends U{constructor(t,e,n,i){if(!(t instanceof Nt))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&i===void 0&&(i=n,n=null),n){if(!(n instanceof U))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof i!="string")throw new TypeError("variant must have a String property")}let o=t.span;0>t.span&&(o=n?n.span:0,0<=o&&t.usesPrefixDiscriminator&&(o+=t.discriminator.layout.span)),super(o,i),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(e===void 0&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+i):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){n===void 0&&(n=0);let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let o=i;if(this.layout&&(this.layout.encode(t[this.property],e,n+i),o+=this.layout.getSpan(e,n+i),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(t){if(this.layout)return this.layout.fromArray(t)}};function ge(r){return 0>r&&(r+=4294967296),r}class Mt extends U{constructor(t,e,n){if(!(t instanceof te||t instanceof se))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof e=="string"&&n===void 0&&(n=e,e=void 0),4<t.span)throw new RangeError("word cannot exceed 32 bits");super(t.span,n),this.word=t,this.msb=!!e,this.fields=[];let i=0;this._packedSetValue=function(o){return i=ge(o),this},this._packedGetValue=function(){return i}}decode(t,e){const n=this.makeDestinationObject();e===void 0&&(e=0);const i=this.word.decode(t,e);this._packedSetValue(i);for(const o of this.fields)o.property!==void 0&&(n[o.property]=o.decode(i));return n}encode(t,e,n){n===void 0&&(n=0);const i=this.word.decode(e,n);this._packedSetValue(i);for(const o of this.fields)if(o.property!==void 0){const s=t[o.property];s!==void 0&&o.encode(s)}return this.word.encode(this._packedGetValue(),e,n)}addField(t,e){const n=new Se(this,t,e);return this.fields.push(n),n}addBoolean(t){const e=new er(this,t);return this.fields.push(e),e}fieldFor(t){if(typeof t!="string")throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}}class Se{constructor(t,e,n){if(!(t instanceof Mt))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(e)||0>=e)throw new TypeError("bits must be positive integer");const i=8*t.span,o=t.fields.reduce((s,a)=>s+a.bits,0);if(e+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=t,this.bits=e,this.valueMask=(1<<e)-1,e===32&&(this.valueMask=4294967295),this.start=o,this.container.msb&&(this.start=i-o-e),this.wordMask=ge(this.valueMask<<this.start),this.property=n}decode(){const t=this.container._packedGetValue();return ge(t&this.wordMask)>>>this.start}encode(t){if(!Number.isInteger(t)||t!==ge(t&this.valueMask))throw new TypeError(Pt("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=ge(t<<this.start);this.container._packedSetValue(ge(e&~this.wordMask)|n)}}let er=class extends Se{constructor(t,e){super(t,1,e)}decode(t,e){return!!Se.prototype.decode.call(this,t,e)}encode(t){return typeof t=="boolean"&&(t=+t),Se.prototype.encode.call(this,t)}},tr=class extends U{constructor(t,e){if(!(t instanceof Z&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;t instanceof Z||(n=t),super(n,e),this.length=t}getSpan(t,e){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}decode(t,e){e===void 0&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let i=this.length;if(this.length instanceof Z&&(i=t.length),!(V.Buffer.isBuffer(t)&&i===t.length))throw new TypeError(Pt("Blob.encode",this)+" requires (length "+i+") Buffer as src");if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,i,"hex"),this.length instanceof Z&&this.length.encode(i,e,n),i}};class nr extends U{constructor(t){super(-1,t)}getSpan(t,e){if(!V.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");e===void 0&&(e=0);let n=e;for(;n<t.length&&t[n]!==0;)n+=1;return 1+n-e}decode(t,e,n){e===void 0&&(e=0);let i=this.getSpan(t,e);return t.slice(e,e+i-1).toString("utf-8")}encode(t,e,n){n===void 0&&(n=0),typeof t!="string"&&(t=t.toString());const i=new V.Buffer(t,"utf8"),o=i.length;if(n+o>e.length)throw new RangeError("encoding overruns Buffer");return i.copy(e,n),e[n+o]=0,o+1}}class rr extends U{constructor(t,e){if(typeof t=="string"&&e===void 0&&(e=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e){if(!V.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");return e===void 0&&(e=0),t.length-e}decode(t,e,n){e===void 0&&(e=0);let i=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");return t.slice(e,e+i).toString("utf-8")}encode(t,e,n){n===void 0&&(n=0),typeof t!="string"&&(t=t.toString());const i=new V.Buffer(t,"utf8"),o=i.length;if(0<=this.maxSpan&&this.maxSpan<o)throw new RangeError("text length exceeds maxSpan");if(n+o>e.length)throw new RangeError("encoding overruns Buffer");return i.copy(e,n),o}}class ir extends U{constructor(t,e){super(0,e),this.value=t}decode(t,e,n){return this.value}encode(t,e,n){return 0}}b.ExternalLayout=Z;b.GreedyCount=Kn;b.OffsetLayout=Dt;b.UInt=te;b.UIntBE=se;b.Int=pe;b.IntBE=_e;b.Float=Zn;b.FloatBE=Hn;b.Double=Wn;b.DoubleBE=Xn;b.Sequence=Yn;b.Structure=Jn;b.UnionDiscriminator=Ut;b.UnionLayoutDiscriminator=Ke;b.Union=Nt;b.VariantLayout=Qn;b.BitStructure=Mt;b.BitField=Se;b.Boolean=er;b.Blob=tr;b.CString=nr;b.UTF8=rr;b.Constant=ir;b.greedy=(r,t)=>new Kn(r,t);b.offset=(r,t,e)=>new Dt(r,t,e);b.u8=r=>new te(1,r);b.u16=r=>new te(2,r);b.u24=r=>new te(3,r);b.u32=r=>new te(4,r);b.u40=r=>new te(5,r);b.u48=r=>new te(6,r);b.nu64=r=>new ii(r);b.u16be=r=>new se(2,r);b.u24be=r=>new se(3,r);b.u32be=r=>new se(4,r);b.u40be=r=>new se(5,r);b.u48be=r=>new se(6,r);b.nu64be=r=>new oi(r);b.s8=r=>new pe(1,r);b.s16=r=>new pe(2,r);b.s24=r=>new pe(3,r);b.s32=r=>new pe(4,r);b.s40=r=>new pe(5,r);b.s48=r=>new pe(6,r);b.ns64=r=>new si(r);b.s16be=r=>new _e(2,r);b.s24be=r=>new _e(3,r);b.s32be=r=>new _e(4,r);b.s40be=r=>new _e(5,r);b.s48be=r=>new _e(6,r);b.ns64be=r=>new ai(r);b.f32=r=>new Zn(r);b.f32be=r=>new Hn(r);b.f64=r=>new Wn(r);b.f64be=r=>new Xn(r);b.struct=(r,t,e)=>new Jn(r,t,e);b.bits=(r,t,e)=>new Mt(r,t,e);b.seq=(r,t,e)=>new Yn(r,t,e);b.union=(r,t,e)=>new Nt(r,t,e);b.unionLayoutDiscriminator=(r,t)=>new Ke(r,t);b.blob=(r,t)=>new tr(r,t);b.cstr=r=>new nr(r);b.utf8=(r,t)=>new rr(r,t);b.const=(r,t)=>new ir(r,t);const ci=Jr(Qr);(function(r){var t=Xt&&Xt.__importDefault||function(k){return k&&k.__esModule?k:{default:k}};Object.defineProperty(r,"__esModule",{value:!0}),r.map=r.array=r.rustEnum=r.str=r.vecU8=r.tagged=r.vec=r.bool=r.option=r.publicKey=r.i256=r.u256=r.i128=r.u128=r.i64=r.u64=r.struct=r.f64=r.f32=r.i32=r.u32=r.i16=r.u16=r.i8=r.u8=void 0;const e=b,n=ci,i=t(ei);var o=b;Object.defineProperty(r,"u8",{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(r,"i8",{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(r,"u16",{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(r,"i16",{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(r,"u32",{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(r,"i32",{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(r,"f32",{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(r,"f64",{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(r,"struct",{enumerable:!0,get:function(){return o.struct}});class s extends e.Layout{constructor(v,l,h){super(v,h),this.blob=(0,e.blob)(v),this.signed=l}decode(v,l=0){const h=new i.default(this.blob.decode(v,l),10,"le");return this.signed?h.fromTwos(this.span*8).clone():h}encode(v,l,h=0){return this.signed&&(v=v.toTwos(this.span*8)),this.blob.encode(v.toArrayLike(V.Buffer,"le",this.span),l,h)}}function a(k){return new s(8,!1,k)}r.u64=a;function d(k){return new s(8,!0,k)}r.i64=d;function c(k){return new s(16,!1,k)}r.u128=c;function u(k){return new s(16,!0,k)}r.i128=u;function y(k){return new s(32,!1,k)}r.u256=y;function w(k){return new s(32,!0,k)}r.i256=w;class f extends e.Layout{constructor(v,l,h,x){super(v.span,x),this.layout=v,this.decoder=l,this.encoder=h}decode(v,l){return this.decoder(this.layout.decode(v,l))}encode(v,l,h){return this.layout.encode(this.encoder(v),l,h)}getSpan(v,l){return this.layout.getSpan(v,l)}}function p(k){return new f((0,e.blob)(32),v=>new n.PublicKey(v),v=>v.toBuffer(),k)}r.publicKey=p;class A extends e.Layout{constructor(v,l){super(-1,l),this.layout=v,this.discriminator=(0,e.u8)()}encode(v,l,h=0){return v==null?this.discriminator.encode(0,l,h):(this.discriminator.encode(1,l,h),this.layout.encode(v,l,h+1)+1)}decode(v,l=0){const h=this.discriminator.decode(v,l);if(h===0)return null;if(h===1)return this.layout.decode(v,l+1);throw new Error("Invalid option "+this.property)}getSpan(v,l=0){const h=this.discriminator.decode(v,l);if(h===0)return 1;if(h===1)return this.layout.getSpan(v,l+1)+1;throw new Error("Invalid option "+this.property)}}function g(k,v){return new A(k,v)}r.option=g;function E(k){return new f((0,e.u8)(),T,_,k)}r.bool=E;function T(k){if(k===0)return!1;if(k===1)return!0;throw new Error("Invalid bool: "+k)}function _(k){return k?1:0}function m(k,v){const l=(0,e.u32)("length"),h=(0,e.struct)([l,(0,e.seq)(k,(0,e.offset)(l,-l.span),"values")]);return new f(h,({values:x})=>x,x=>({values:x}),v)}r.vec=m;function L(k,v,l){const h=(0,e.struct)([a("tag"),v.replicate("data")]);function x({tag:D,data:F}){if(!D.eq(k))throw new Error("Invalid tag, expected: "+k.toString("hex")+", got: "+D.toString("hex"));return F}return new f(h,x,D=>({tag:k,data:D}),l)}r.tagged=L;function M(k){const v=(0,e.u32)("length"),l=(0,e.struct)([v,(0,e.blob)((0,e.offset)(v,-v.span),"data")]);return new f(l,({data:h})=>h,h=>({data:h}),k)}r.vecU8=M;function S(k){return new f(M(),v=>v.toString("utf-8"),v=>V.Buffer.from(v,"utf-8"),k)}r.str=S;function P(k,v,l){const h=(0,e.union)(l??(0,e.u8)(),v);return k.forEach((x,D)=>h.addVariant(D,x,x.property)),h}r.rustEnum=P;function B(k,v,l){const h=(0,e.struct)([(0,e.seq)(k,v,"values")]);return new f(h,({values:x})=>x,x=>({values:x}),l)}r.array=B;class O extends e.Layout{constructor(v,l,h){super(v.span+l.span,h),this.keyLayout=v,this.valueLayout=l}decode(v,l){l=l||0;const h=this.keyLayout.decode(v,l),x=this.valueLayout.decode(v,l+this.keyLayout.getSpan(v,l));return[h,x]}encode(v,l,h){h=h||0;const x=this.keyLayout.encode(v[0],l,h),D=this.valueLayout.encode(v[1],l,h+x);return x+D}getSpan(v,l){return this.keyLayout.getSpan(v,l)+this.valueLayout.getSpan(v,l)}}function C(k,v,l){const h=(0,e.u32)("length"),x=(0,e.struct)([h,(0,e.seq)(new O(k,v),(0,e.offset)(h,-h.span),"values")]);return new f(x,({values:D})=>new Map(D),D=>({values:Array.from(D.entries())}),l)}r.map=C})(R);var $t={exports:{}};const ui=/[\p{Lu}]/u,li=/[\p{Ll}]/u,Yt=/^[\p{Lu}](?![\p{Lu}])/gu,or=/([\p{Alpha}\p{N}_]|$)/u,sr=/[_.\- ]+/,di=new RegExp("^"+sr.source),Jt=new RegExp(sr.source+or.source,"gu"),Qt=new RegExp("\\d+"+or.source,"gu"),fi=(r,t,e)=>{let n=!1,i=!1,o=!1;for(let s=0;s<r.length;s++){const a=r[s];n&&ui.test(a)?(r=r.slice(0,s)+"-"+r.slice(s),n=!1,o=i,i=!0,s++):i&&o&&li.test(a)?(r=r.slice(0,s-1)+"-"+r.slice(s-1),o=i,i=!1,n=!0):(n=t(a)===a&&e(a)!==a,o=i,i=e(a)===a&&t(a)!==a)}return r},hi=(r,t)=>(Yt.lastIndex=0,r.replace(Yt,e=>t(e))),pi=(r,t)=>(Jt.lastIndex=0,Qt.lastIndex=0,r.replace(Jt,(e,n)=>t(n)).replace(Qt,e=>t(e))),ar=(r,t)=>{if(!(typeof r=="string"||Array.isArray(r)))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},Array.isArray(r)?r=r.map(o=>o.trim()).filter(o=>o.length).join("-"):r=r.trim(),r.length===0)return"";const e=t.locale===!1?o=>o.toLowerCase():o=>o.toLocaleLowerCase(t.locale),n=t.locale===!1?o=>o.toUpperCase():o=>o.toLocaleUpperCase(t.locale);return r.length===1?t.pascalCase?n(r):e(r):(r!==e(r)&&(r=fi(r,e,n)),r=r.replace(di,""),t.preserveConsecutiveUppercase?r=hi(r,e):r=e(r),t.pascalCase&&(r=n(r.charAt(0))+r.slice(1)),pi(r,n))};$t.exports=ar;$t.exports.default=ar;var wi=$t.exports;const j=Vn(wi);function Ee(r){let t=r.length;for(;--t>=0;)r[t]=0}const yi=3,gi=258,cr=29,mi=256,vi=mi+1+cr,ur=30,bi=512,_i=new Array((vi+2)*2);Ee(_i);const Ei=new Array(ur*2);Ee(Ei);const Ai=new Array(bi);Ee(Ai);const xi=new Array(gi-yi+1);Ee(xi);const ki=new Array(cr);Ee(ki);const Si=new Array(ur);Ee(Si);const Ii=(r,t,e,n)=>{let i=r&65535|0,o=r>>>16&65535|0,s=0;for(;e!==0;){s=e>2e3?2e3:e,e-=s;do i=i+t[n++]|0,o=o+i|0;while(--s);i%=65521,o%=65521}return i|o<<16|0};var _t=Ii;const Li=()=>{let r,t=[];for(var e=0;e<256;e++){r=e;for(var n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;t[e]=r}return t},Ti=new Uint32Array(Li()),Ci=(r,t,e,n)=>{const i=Ti,o=n+e;r^=-1;for(let s=n;s<o;s++)r=r>>>8^i[(r^t[s])&255];return r^-1};var Q=Ci,Et={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},lr={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const Oi=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);var Ri=function(r){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const n in e)Oi(e,n)&&(r[n]=e[n])}}return r},Bi=r=>{let t=0;for(let n=0,i=r.length;n<i;n++)t+=r[n].length;const e=new Uint8Array(t);for(let n=0,i=0,o=r.length;n<o;n++){let s=r[n];e.set(s,i),i+=s.length}return e},dr={assign:Ri,flattenChunks:Bi};let fr=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{fr=!1}const Te=new Uint8Array(256);for(let r=0;r<256;r++)Te[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;Te[254]=Te[254]=1;var Pi=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let t,e,n,i,o,s=r.length,a=0;for(i=0;i<s;i++)e=r.charCodeAt(i),(e&64512)===55296&&i+1<s&&(n=r.charCodeAt(i+1),(n&64512)===56320&&(e=65536+(e-55296<<10)+(n-56320),i++)),a+=e<128?1:e<2048?2:e<65536?3:4;for(t=new Uint8Array(a),o=0,i=0;o<a;i++)e=r.charCodeAt(i),(e&64512)===55296&&i+1<s&&(n=r.charCodeAt(i+1),(n&64512)===56320&&(e=65536+(e-55296<<10)+(n-56320),i++)),e<128?t[o++]=e:e<2048?(t[o++]=192|e>>>6,t[o++]=128|e&63):e<65536?(t[o++]=224|e>>>12,t[o++]=128|e>>>6&63,t[o++]=128|e&63):(t[o++]=240|e>>>18,t[o++]=128|e>>>12&63,t[o++]=128|e>>>6&63,t[o++]=128|e&63);return t};const Di=(r,t)=>{if(t<65534&&r.subarray&&fr)return String.fromCharCode.apply(null,r.length===t?r:r.subarray(0,t));let e="";for(let n=0;n<t;n++)e+=String.fromCharCode(r[n]);return e};var Ui=(r,t)=>{const e=t||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,t));let n,i;const o=new Array(e*2);for(i=0,n=0;n<e;){let s=r[n++];if(s<128){o[i++]=s;continue}let a=Te[s];if(a>4){o[i++]=65533,n+=a-1;continue}for(s&=a===2?31:a===3?15:7;a>1&&n<e;)s=s<<6|r[n++]&63,a--;if(a>1){o[i++]=65533;continue}s<65536?o[i++]=s:(s-=65536,o[i++]=55296|s>>10&1023,o[i++]=56320|s&1023)}return Di(o,i)},Ni=(r,t)=>{t=t||r.length,t>r.length&&(t=r.length);let e=t-1;for(;e>=0&&(r[e]&192)===128;)e--;return e<0||e===0?t:e+Te[r[e]]>t?e:t},At={string2buf:Pi,buf2string:Ui,utf8border:Ni};function Mi(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var $i=Mi;const Me=16209,ji=16191;var Vi=function(t,e){let n,i,o,s,a,d,c,u,y,w,f,p,A,g,E,T,_,m,L,M,S,P,B,O;const C=t.state;n=t.next_in,B=t.input,i=n+(t.avail_in-5),o=t.next_out,O=t.output,s=o-(e-t.avail_out),a=o+(t.avail_out-257),d=C.dmax,c=C.wsize,u=C.whave,y=C.wnext,w=C.window,f=C.hold,p=C.bits,A=C.lencode,g=C.distcode,E=(1<<C.lenbits)-1,T=(1<<C.distbits)-1;e:do{p<15&&(f+=B[n++]<<p,p+=8,f+=B[n++]<<p,p+=8),_=A[f&E];t:for(;;){if(m=_>>>24,f>>>=m,p-=m,m=_>>>16&255,m===0)O[o++]=_&65535;else if(m&16){L=_&65535,m&=15,m&&(p<m&&(f+=B[n++]<<p,p+=8),L+=f&(1<<m)-1,f>>>=m,p-=m),p<15&&(f+=B[n++]<<p,p+=8,f+=B[n++]<<p,p+=8),_=g[f&T];n:for(;;){if(m=_>>>24,f>>>=m,p-=m,m=_>>>16&255,m&16){if(M=_&65535,m&=15,p<m&&(f+=B[n++]<<p,p+=8,p<m&&(f+=B[n++]<<p,p+=8)),M+=f&(1<<m)-1,M>d){t.msg="invalid distance too far back",C.mode=Me;break e}if(f>>>=m,p-=m,m=o-s,M>m){if(m=M-m,m>u&&C.sane){t.msg="invalid distance too far back",C.mode=Me;break e}if(S=0,P=w,y===0){if(S+=c-m,m<L){L-=m;do O[o++]=w[S++];while(--m);S=o-M,P=O}}else if(y<m){if(S+=c+y-m,m-=y,m<L){L-=m;do O[o++]=w[S++];while(--m);if(S=0,y<L){m=y,L-=m;do O[o++]=w[S++];while(--m);S=o-M,P=O}}}else if(S+=y-m,m<L){L-=m;do O[o++]=w[S++];while(--m);S=o-M,P=O}for(;L>2;)O[o++]=P[S++],O[o++]=P[S++],O[o++]=P[S++],L-=3;L&&(O[o++]=P[S++],L>1&&(O[o++]=P[S++]))}else{S=o-M;do O[o++]=O[S++],O[o++]=O[S++],O[o++]=O[S++],L-=3;while(L>2);L&&(O[o++]=O[S++],L>1&&(O[o++]=O[S++]))}}else if(m&64){t.msg="invalid distance code",C.mode=Me;break e}else{_=g[(_&65535)+(f&(1<<m)-1)];continue n}break}}else if(m&64)if(m&32){C.mode=ji;break e}else{t.msg="invalid literal/length code",C.mode=Me;break e}else{_=A[(_&65535)+(f&(1<<m)-1)];continue t}break}}while(n<i&&o<a);L=p>>3,n-=L,p-=L<<3,f&=(1<<p)-1,t.next_in=n,t.next_out=o,t.avail_in=n<i?5+(i-n):5-(n-i),t.avail_out=o<a?257+(a-o):257-(o-a),C.hold=f,C.bits=p};const ye=15,en=852,tn=592,nn=0,ct=1,rn=2,Fi=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),zi=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),qi=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Gi=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),Ki=(r,t,e,n,i,o,s,a)=>{const d=a.bits;let c=0,u=0,y=0,w=0,f=0,p=0,A=0,g=0,E=0,T=0,_,m,L,M,S,P=null,B;const O=new Uint16Array(ye+1),C=new Uint16Array(ye+1);let k=null,v,l,h;for(c=0;c<=ye;c++)O[c]=0;for(u=0;u<n;u++)O[t[e+u]]++;for(f=d,w=ye;w>=1&&O[w]===0;w--);if(f>w&&(f=w),w===0)return i[o++]=1<<24|64<<16|0,i[o++]=1<<24|64<<16|0,a.bits=1,0;for(y=1;y<w&&O[y]===0;y++);for(f<y&&(f=y),g=1,c=1;c<=ye;c++)if(g<<=1,g-=O[c],g<0)return-1;if(g>0&&(r===nn||w!==1))return-1;for(C[1]=0,c=1;c<ye;c++)C[c+1]=C[c]+O[c];for(u=0;u<n;u++)t[e+u]!==0&&(s[C[t[e+u]]++]=u);if(r===nn?(P=k=s,B=20):r===ct?(P=Fi,k=zi,B=257):(P=qi,k=Gi,B=0),T=0,u=0,c=y,S=o,p=f,A=0,L=-1,E=1<<f,M=E-1,r===ct&&E>en||r===rn&&E>tn)return 1;for(;;){v=c-A,s[u]+1<B?(l=0,h=s[u]):s[u]>=B?(l=k[s[u]-B],h=P[s[u]-B]):(l=96,h=0),_=1<<c-A,m=1<<p,y=m;do m-=_,i[S+(T>>A)+m]=v<<24|l<<16|h|0;while(m!==0);for(_=1<<c-1;T&_;)_>>=1;if(_!==0?(T&=_-1,T+=_):T=0,u++,--O[c]===0){if(c===w)break;c=t[e+s[u]]}if(c>f&&(T&M)!==L){for(A===0&&(A=f),S+=y,p=c-A,g=1<<p;p+A<w&&(g-=O[p+A],!(g<=0));)p++,g<<=1;if(E+=1<<p,r===ct&&E>en||r===rn&&E>tn)return 1;L=T&M,i[L]=f<<24|p<<16|S-o|0}}return T!==0&&(i[S+T]=c-A<<24|64<<16|0),a.bits=f,0};var Ie=Ki;const Zi=0,hr=1,pr=2,{Z_FINISH:on,Z_BLOCK:Hi,Z_TREES:$e,Z_OK:he,Z_STREAM_END:Wi,Z_NEED_DICT:Xi,Z_STREAM_ERROR:Y,Z_DATA_ERROR:wr,Z_MEM_ERROR:yr,Z_BUF_ERROR:Yi,Z_DEFLATED:sn}=lr,tt=16180,an=16181,cn=16182,un=16183,ln=16184,dn=16185,fn=16186,hn=16187,pn=16188,wn=16189,Ze=16190,ne=16191,ut=16192,yn=16193,lt=16194,gn=16195,mn=16196,vn=16197,bn=16198,je=16199,Ve=16200,_n=16201,En=16202,An=16203,xn=16204,kn=16205,dt=16206,Sn=16207,In=16208,$=16209,gr=16210,mr=16211,Ji=852,Qi=592,eo=15,to=eo,Ln=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function no(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const we=r=>{if(!r)return 1;const t=r.state;return!t||t.strm!==r||t.mode<tt||t.mode>mr?1:0},vr=r=>{if(we(r))return Y;const t=r.state;return r.total_in=r.total_out=t.total=0,r.msg="",t.wrap&&(r.adler=t.wrap&1),t.mode=tt,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(Ji),t.distcode=t.distdyn=new Int32Array(Qi),t.sane=1,t.back=-1,he},br=r=>{if(we(r))return Y;const t=r.state;return t.wsize=0,t.whave=0,t.wnext=0,vr(r)},_r=(r,t)=>{let e;if(we(r))return Y;const n=r.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Y:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,br(r))},Er=(r,t)=>{if(!r)return Y;const e=new no;r.state=e,e.strm=r,e.window=null,e.mode=tt;const n=_r(r,t);return n!==he&&(r.state=null),n},ro=r=>Er(r,to);let Tn=!0,ft,ht;const io=r=>{if(Tn){ft=new Int32Array(512),ht=new Int32Array(32);let t=0;for(;t<144;)r.lens[t++]=8;for(;t<256;)r.lens[t++]=9;for(;t<280;)r.lens[t++]=7;for(;t<288;)r.lens[t++]=8;for(Ie(hr,r.lens,0,288,ft,0,r.work,{bits:9}),t=0;t<32;)r.lens[t++]=5;Ie(pr,r.lens,0,32,ht,0,r.work,{bits:5}),Tn=!1}r.lencode=ft,r.lenbits=9,r.distcode=ht,r.distbits=5},Ar=(r,t,e,n)=>{let i;const o=r.state;return o.window===null&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),n>=o.wsize?(o.window.set(t.subarray(e-o.wsize,e),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),o.window.set(t.subarray(e-n,e-n+i),o.wnext),n-=i,n?(o.window.set(t.subarray(e-n,e),0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0},oo=(r,t)=>{let e,n,i,o,s,a,d,c,u,y,w,f,p,A,g=0,E,T,_,m,L,M,S,P;const B=new Uint8Array(4);let O,C;const k=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(we(r)||!r.output||!r.input&&r.avail_in!==0)return Y;e=r.state,e.mode===ne&&(e.mode=ut),s=r.next_out,i=r.output,d=r.avail_out,o=r.next_in,n=r.input,a=r.avail_in,c=e.hold,u=e.bits,y=a,w=d,P=he;e:for(;;)switch(e.mode){case tt:if(e.wrap===0){e.mode=ut;break}for(;u<16;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if(e.wrap&2&&c===35615){e.wbits===0&&(e.wbits=15),e.check=0,B[0]=c&255,B[1]=c>>>8&255,e.check=Q(e.check,B,2,0),c=0,u=0,e.mode=an;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((c&255)<<8)+(c>>8))%31){r.msg="incorrect header check",e.mode=$;break}if((c&15)!==sn){r.msg="unknown compression method",e.mode=$;break}if(c>>>=4,u-=4,S=(c&15)+8,e.wbits===0&&(e.wbits=S),S>15||S>e.wbits){r.msg="invalid window size",e.mode=$;break}e.dmax=1<<e.wbits,e.flags=0,r.adler=e.check=1,e.mode=c&512?wn:ne,c=0,u=0;break;case an:for(;u<16;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if(e.flags=c,(e.flags&255)!==sn){r.msg="unknown compression method",e.mode=$;break}if(e.flags&57344){r.msg="unknown header flags set",e.mode=$;break}e.head&&(e.head.text=c>>8&1),e.flags&512&&e.wrap&4&&(B[0]=c&255,B[1]=c>>>8&255,e.check=Q(e.check,B,2,0)),c=0,u=0,e.mode=cn;case cn:for(;u<32;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}e.head&&(e.head.time=c),e.flags&512&&e.wrap&4&&(B[0]=c&255,B[1]=c>>>8&255,B[2]=c>>>16&255,B[3]=c>>>24&255,e.check=Q(e.check,B,4,0)),c=0,u=0,e.mode=un;case un:for(;u<16;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}e.head&&(e.head.xflags=c&255,e.head.os=c>>8),e.flags&512&&e.wrap&4&&(B[0]=c&255,B[1]=c>>>8&255,e.check=Q(e.check,B,2,0)),c=0,u=0,e.mode=ln;case ln:if(e.flags&1024){for(;u<16;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}e.length=c,e.head&&(e.head.extra_len=c),e.flags&512&&e.wrap&4&&(B[0]=c&255,B[1]=c>>>8&255,e.check=Q(e.check,B,2,0)),c=0,u=0}else e.head&&(e.head.extra=null);e.mode=dn;case dn:if(e.flags&1024&&(f=e.length,f>a&&(f=a),f&&(e.head&&(S=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(n.subarray(o,o+f),S)),e.flags&512&&e.wrap&4&&(e.check=Q(e.check,n,f,o)),a-=f,o+=f,e.length-=f),e.length))break e;e.length=0,e.mode=fn;case fn:if(e.flags&2048){if(a===0)break e;f=0;do S=n[o+f++],e.head&&S&&e.length<65536&&(e.head.name+=String.fromCharCode(S));while(S&&f<a);if(e.flags&512&&e.wrap&4&&(e.check=Q(e.check,n,f,o)),a-=f,o+=f,S)break e}else e.head&&(e.head.name=null);e.length=0,e.mode=hn;case hn:if(e.flags&4096){if(a===0)break e;f=0;do S=n[o+f++],e.head&&S&&e.length<65536&&(e.head.comment+=String.fromCharCode(S));while(S&&f<a);if(e.flags&512&&e.wrap&4&&(e.check=Q(e.check,n,f,o)),a-=f,o+=f,S)break e}else e.head&&(e.head.comment=null);e.mode=pn;case pn:if(e.flags&512){for(;u<16;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if(e.wrap&4&&c!==(e.check&65535)){r.msg="header crc mismatch",e.mode=$;break}c=0,u=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),r.adler=e.check=0,e.mode=ne;break;case wn:for(;u<32;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}r.adler=e.check=Ln(c),c=0,u=0,e.mode=Ze;case Ze:if(e.havedict===0)return r.next_out=s,r.avail_out=d,r.next_in=o,r.avail_in=a,e.hold=c,e.bits=u,Xi;r.adler=e.check=1,e.mode=ne;case ne:if(t===Hi||t===$e)break e;case ut:if(e.last){c>>>=u&7,u-=u&7,e.mode=dt;break}for(;u<3;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}switch(e.last=c&1,c>>>=1,u-=1,c&3){case 0:e.mode=yn;break;case 1:if(io(e),e.mode=je,t===$e){c>>>=2,u-=2;break e}break;case 2:e.mode=mn;break;case 3:r.msg="invalid block type",e.mode=$}c>>>=2,u-=2;break;case yn:for(c>>>=u&7,u-=u&7;u<32;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){r.msg="invalid stored block lengths",e.mode=$;break}if(e.length=c&65535,c=0,u=0,e.mode=lt,t===$e)break e;case lt:e.mode=gn;case gn:if(f=e.length,f){if(f>a&&(f=a),f>d&&(f=d),f===0)break e;i.set(n.subarray(o,o+f),s),a-=f,o+=f,d-=f,s+=f,e.length-=f;break}e.mode=ne;break;case mn:for(;u<14;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if(e.nlen=(c&31)+257,c>>>=5,u-=5,e.ndist=(c&31)+1,c>>>=5,u-=5,e.ncode=(c&15)+4,c>>>=4,u-=4,e.nlen>286||e.ndist>30){r.msg="too many length or distance symbols",e.mode=$;break}e.have=0,e.mode=vn;case vn:for(;e.have<e.ncode;){for(;u<3;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}e.lens[k[e.have++]]=c&7,c>>>=3,u-=3}for(;e.have<19;)e.lens[k[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,O={bits:e.lenbits},P=Ie(Zi,e.lens,0,19,e.lencode,0,e.work,O),e.lenbits=O.bits,P){r.msg="invalid code lengths set",e.mode=$;break}e.have=0,e.mode=bn;case bn:for(;e.have<e.nlen+e.ndist;){for(;g=e.lencode[c&(1<<e.lenbits)-1],E=g>>>24,T=g>>>16&255,_=g&65535,!(E<=u);){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if(_<16)c>>>=E,u-=E,e.lens[e.have++]=_;else{if(_===16){for(C=E+2;u<C;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if(c>>>=E,u-=E,e.have===0){r.msg="invalid bit length repeat",e.mode=$;break}S=e.lens[e.have-1],f=3+(c&3),c>>>=2,u-=2}else if(_===17){for(C=E+3;u<C;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}c>>>=E,u-=E,S=0,f=3+(c&7),c>>>=3,u-=3}else{for(C=E+7;u<C;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}c>>>=E,u-=E,S=0,f=11+(c&127),c>>>=7,u-=7}if(e.have+f>e.nlen+e.ndist){r.msg="invalid bit length repeat",e.mode=$;break}for(;f--;)e.lens[e.have++]=S}}if(e.mode===$)break;if(e.lens[256]===0){r.msg="invalid code -- missing end-of-block",e.mode=$;break}if(e.lenbits=9,O={bits:e.lenbits},P=Ie(hr,e.lens,0,e.nlen,e.lencode,0,e.work,O),e.lenbits=O.bits,P){r.msg="invalid literal/lengths set",e.mode=$;break}if(e.distbits=6,e.distcode=e.distdyn,O={bits:e.distbits},P=Ie(pr,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,O),e.distbits=O.bits,P){r.msg="invalid distances set",e.mode=$;break}if(e.mode=je,t===$e)break e;case je:e.mode=Ve;case Ve:if(a>=6&&d>=258){r.next_out=s,r.avail_out=d,r.next_in=o,r.avail_in=a,e.hold=c,e.bits=u,Vi(r,w),s=r.next_out,i=r.output,d=r.avail_out,o=r.next_in,n=r.input,a=r.avail_in,c=e.hold,u=e.bits,e.mode===ne&&(e.back=-1);break}for(e.back=0;g=e.lencode[c&(1<<e.lenbits)-1],E=g>>>24,T=g>>>16&255,_=g&65535,!(E<=u);){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if(T&&!(T&240)){for(m=E,L=T,M=_;g=e.lencode[M+((c&(1<<m+L)-1)>>m)],E=g>>>24,T=g>>>16&255,_=g&65535,!(m+E<=u);){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}c>>>=m,u-=m,e.back+=m}if(c>>>=E,u-=E,e.back+=E,e.length=_,T===0){e.mode=kn;break}if(T&32){e.back=-1,e.mode=ne;break}if(T&64){r.msg="invalid literal/length code",e.mode=$;break}e.extra=T&15,e.mode=_n;case _n:if(e.extra){for(C=e.extra;u<C;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}e.length+=c&(1<<e.extra)-1,c>>>=e.extra,u-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=En;case En:for(;g=e.distcode[c&(1<<e.distbits)-1],E=g>>>24,T=g>>>16&255,_=g&65535,!(E<=u);){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if(!(T&240)){for(m=E,L=T,M=_;g=e.distcode[M+((c&(1<<m+L)-1)>>m)],E=g>>>24,T=g>>>16&255,_=g&65535,!(m+E<=u);){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}c>>>=m,u-=m,e.back+=m}if(c>>>=E,u-=E,e.back+=E,T&64){r.msg="invalid distance code",e.mode=$;break}e.offset=_,e.extra=T&15,e.mode=An;case An:if(e.extra){for(C=e.extra;u<C;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}e.offset+=c&(1<<e.extra)-1,c>>>=e.extra,u-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){r.msg="invalid distance too far back",e.mode=$;break}e.mode=xn;case xn:if(d===0)break e;if(f=w-d,e.offset>f){if(f=e.offset-f,f>e.whave&&e.sane){r.msg="invalid distance too far back",e.mode=$;break}f>e.wnext?(f-=e.wnext,p=e.wsize-f):p=e.wnext-f,f>e.length&&(f=e.length),A=e.window}else A=i,p=s-e.offset,f=e.length;f>d&&(f=d),d-=f,e.length-=f;do i[s++]=A[p++];while(--f);e.length===0&&(e.mode=Ve);break;case kn:if(d===0)break e;i[s++]=e.length,d--,e.mode=Ve;break;case dt:if(e.wrap){for(;u<32;){if(a===0)break e;a--,c|=n[o++]<<u,u+=8}if(w-=d,r.total_out+=w,e.total+=w,e.wrap&4&&w&&(r.adler=e.check=e.flags?Q(e.check,i,w,s-w):_t(e.check,i,w,s-w)),w=d,e.wrap&4&&(e.flags?c:Ln(c))!==e.check){r.msg="incorrect data check",e.mode=$;break}c=0,u=0}e.mode=Sn;case Sn:if(e.wrap&&e.flags){for(;u<32;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if(e.wrap&4&&c!==(e.total&4294967295)){r.msg="incorrect length check",e.mode=$;break}c=0,u=0}e.mode=In;case In:P=Wi;break e;case $:P=wr;break e;case gr:return yr;case mr:default:return Y}return r.next_out=s,r.avail_out=d,r.next_in=o,r.avail_in=a,e.hold=c,e.bits=u,(e.wsize||w!==r.avail_out&&e.mode<$&&(e.mode<dt||t!==on))&&Ar(r,r.output,r.next_out,w-r.avail_out),y-=r.avail_in,w-=r.avail_out,r.total_in+=y,r.total_out+=w,e.total+=w,e.wrap&4&&w&&(r.adler=e.check=e.flags?Q(e.check,i,w,r.next_out-w):_t(e.check,i,w,r.next_out-w)),r.data_type=e.bits+(e.last?64:0)+(e.mode===ne?128:0)+(e.mode===je||e.mode===lt?256:0),(y===0&&w===0||t===on)&&P===he&&(P=Yi),P},so=r=>{if(we(r))return Y;let t=r.state;return t.window&&(t.window=null),r.state=null,he},ao=(r,t)=>{if(we(r))return Y;const e=r.state;return e.wrap&2?(e.head=t,t.done=!1,he):Y},co=(r,t)=>{const e=t.length;let n,i,o;return we(r)||(n=r.state,n.wrap!==0&&n.mode!==Ze)?Y:n.mode===Ze&&(i=1,i=_t(i,t,e,0),i!==n.check)?wr:(o=Ar(r,t,e,e),o?(n.mode=gr,yr):(n.havedict=1,he))};var uo=br,lo=_r,fo=vr,ho=ro,po=Er,wo=oo,yo=so,go=ao,mo=co,vo="pako inflate (from Nodeca project)",re={inflateReset:uo,inflateReset2:lo,inflateResetKeep:fo,inflateInit:ho,inflateInit2:po,inflate:wo,inflateEnd:yo,inflateGetHeader:go,inflateSetDictionary:mo,inflateInfo:vo};function bo(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var _o=bo;const xr=Object.prototype.toString,{Z_NO_FLUSH:Eo,Z_FINISH:Ao,Z_OK:Ce,Z_STREAM_END:pt,Z_NEED_DICT:wt,Z_STREAM_ERROR:xo,Z_DATA_ERROR:Cn,Z_MEM_ERROR:ko}=lr;function nt(r){this.options=dr.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(r&&r.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new $i,this.strm.avail_out=0;let e=re.inflateInit2(this.strm,t.windowBits);if(e!==Ce)throw new Error(Et[e]);if(this.header=new _o,re.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=At.string2buf(t.dictionary):xr.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=re.inflateSetDictionary(this.strm,t.dictionary),e!==Ce)))throw new Error(Et[e])}nt.prototype.push=function(r,t){const e=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let o,s,a;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?Ao:Eo,xr.call(r)==="[object ArrayBuffer]"?e.input=new Uint8Array(r):e.input=r,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),o=re.inflate(e,s),o===wt&&i&&(o=re.inflateSetDictionary(e,i),o===Ce?o=re.inflate(e,s):o===Cn&&(o=wt));e.avail_in>0&&o===pt&&e.state.wrap>0&&r[e.next_in]!==0;)re.inflateReset(e),o=re.inflate(e,s);switch(o){case xo:case Cn:case wt:case ko:return this.onEnd(o),this.ended=!0,!1}if(a=e.avail_out,e.next_out&&(e.avail_out===0||o===pt))if(this.options.to==="string"){let d=At.utf8border(e.output,e.next_out),c=e.next_out-d,u=At.buf2string(e.output,d);e.next_out=c,e.avail_out=n-c,c&&e.output.set(e.output.subarray(d,d+c),0),this.onData(u)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(!(o===Ce&&a===0)){if(o===pt)return o=re.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(e.avail_in===0)break}}return!0};nt.prototype.onData=function(r){this.chunks.push(r)};nt.prototype.onEnd=function(r){r===Ce&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=dr.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function So(r,t){const e=new nt(t);if(e.push(r),e.err)throw e.msg||Et[e.err];return e.result}var Io=So,Lo={inflate:Io};const{inflate:To}=Lo;var Co=To,kr={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(e=!1));function i(d,c,u){this.fn=d,this.context=c,this.once=u||!1}function o(d,c,u,y,w){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new i(u,y||d,w),p=e?e+c:c;return d._events[p]?d._events[p].fn?d._events[p]=[d._events[p],f]:d._events[p].push(f):(d._events[p]=f,d._eventsCount++),d}function s(d,c){--d._eventsCount===0?d._events=new n:delete d._events[c]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],u,y;if(this._eventsCount===0)return c;for(y in u=this._events)t.call(u,y)&&c.push(e?y.slice(1):y);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},a.prototype.listeners=function(c){var u=e?e+c:c,y=this._events[u];if(!y)return[];if(y.fn)return[y.fn];for(var w=0,f=y.length,p=new Array(f);w<f;w++)p[w]=y[w].fn;return p},a.prototype.listenerCount=function(c){var u=e?e+c:c,y=this._events[u];return y?y.fn?1:y.length:0},a.prototype.emit=function(c,u,y,w,f,p){var A=e?e+c:c;if(!this._events[A])return!1;var g=this._events[A],E=arguments.length,T,_;if(g.fn){switch(g.once&&this.removeListener(c,g.fn,void 0,!0),E){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,u),!0;case 3:return g.fn.call(g.context,u,y),!0;case 4:return g.fn.call(g.context,u,y,w),!0;case 5:return g.fn.call(g.context,u,y,w,f),!0;case 6:return g.fn.call(g.context,u,y,w,f,p),!0}for(_=1,T=new Array(E-1);_<E;_++)T[_-1]=arguments[_];g.fn.apply(g.context,T)}else{var m=g.length,L;for(_=0;_<m;_++)switch(g[_].once&&this.removeListener(c,g[_].fn,void 0,!0),E){case 1:g[_].fn.call(g[_].context);break;case 2:g[_].fn.call(g[_].context,u);break;case 3:g[_].fn.call(g[_].context,u,y);break;case 4:g[_].fn.call(g[_].context,u,y,w);break;default:if(!T)for(L=1,T=new Array(E-1);L<E;L++)T[L-1]=arguments[L];g[_].fn.apply(g[_].context,T)}}return!0},a.prototype.on=function(c,u,y){return o(this,c,u,y,!1)},a.prototype.once=function(c,u,y){return o(this,c,u,y,!0)},a.prototype.removeListener=function(c,u,y,w){var f=e?e+c:c;if(!this._events[f])return this;if(!u)return s(this,f),this;var p=this._events[f];if(p.fn)p.fn===u&&(!w||p.once)&&(!y||p.context===y)&&s(this,f);else{for(var A=0,g=[],E=p.length;A<E;A++)(p[A].fn!==u||w&&!p[A].once||y&&p[A].context!==y)&&g.push(p[A]);g.length?this._events[f]=g.length===1?g[0]:g:s(this,f)}return this},a.prototype.removeAllListeners=function(c){var u;return c?(u=e?e+c:c,this._events[u]&&s(this,u)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,r.exports=a})(kr);var Oo=kr.exports;const Ro=Vn(Oo);function Bo(r,t){return Array.apply(0,new Array(Math.ceil(r.length/t))).map((e,n)=>r.slice(n*t,(n+1)*t))}const xe=r=>"version"in r;function Po(r){return r.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),"0x")}function Do(r){r.indexOf("0x")===0&&(r=r.substr(2)),r.length%2===1&&(r="0"+r);let t=r.match(/.{2}/g);return t===null?G.Buffer.from([]):G.Buffer.from(t.map(e=>parseInt(e,16)))}var Uo=Object.freeze({__proto__:null,encode:Po,decode:Do});function Sr(r){return new TextDecoder("utf-8").decode(r)}function Ir(r){return new TextEncoder().encode(r)}var No=Object.freeze({__proto__:null,decode:Sr,encode:Ir});function xt(r){return ve.encode(r)}function Mo(r){return ve.decode(r)}var $o=Object.freeze({__proto__:null,encode:xt,decode:Mo});function kt(r){return r.toString("base64")}function jt(r){return G.Buffer.from(r,"base64")}var jo=Object.freeze({__proto__:null,encode:kt,decode:jt}),Vo=Object.freeze({__proto__:null,hex:Uo,utf8:No,bs58:$o,base64:jo});function Fo(r){const t=new Map;return r.errors&&r.errors.forEach(e=>{var n;let i=(n=e.msg)!==null&&n!==void 0?n:e.name;t.set(e.code,i)}),t}function zo(r,...t){if(r.args.length!=t.length)throw new Error("Invalid argument length");const e={};let n=0;return r.args.forEach(i=>{e[i.name]=t[n],n+=1}),e}function Lr(r,t={}){r.forEach(e=>{if("accounts"in e)Lr(e.accounts,t[e.name]);else if(t[e.name]===void 0)throw new Error(`Invalid arguments: ${e.name} not provided.`)})}function W(r){return r instanceof q?r:new q(r)}class qo extends TypeError{constructor(t,e){let n;const{message:i,...o}=t,{path:s}=t,a=s.length===0?i:"At path: "+s.join(".")+" -- "+i;super(a),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>{var d;return(d=n)!=null?d:n=[t,...e()]}}}function Go(r){return be(r)&&typeof r[Symbol.iterator]=="function"}function be(r){return typeof r=="object"&&r!=null}function ce(r){return typeof r=="string"?JSON.stringify(r):""+r}function Ko(r){const{done:t,value:e}=r.next();return t?void 0:e}function Zo(r,t,e,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:i,branch:o}=t,{type:s}=e,{refinement:a,message:d="Expected a value of type `"+s+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+ce(n)+"`"}=r;return{value:n,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...r,message:d}}function*On(r,t,e,n){Go(r)||(r=[r]);for(const i of r){const o=Zo(i,t,e,n);o&&(yield o)}}function*Vt(r,t,e){e===void 0&&(e={});const{path:n=[],branch:i=[r],coerce:o=!1,mask:s=!1}=e,a={path:n,branch:i};if(o&&(r=t.coercer(r,a),s&&t.type!=="type"&&be(t.schema)&&be(r)&&!Array.isArray(r)))for(const c in r)t.schema[c]===void 0&&delete r[c];let d=!0;for(const c of t.validator(r,a))d=!1,yield[c,void 0];for(let[c,u,y]of t.entries(r,a)){const w=Vt(u,y,{path:c===void 0?n:[...n,c],branch:c===void 0?i:[...i,u],coerce:o,mask:s});for(const f of w)f[0]?(d=!1,yield[f[0],void 0]):o&&(u=f[1],c===void 0?r=u:r instanceof Map?r.set(c,u):r instanceof Set?r.add(u):be(r)&&(r[c]=u))}if(d)for(const c of t.refiner(r,a))d=!1,yield[c,void 0];d&&(yield[void 0,r])}class ue{constructor(t){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:e,schema:n,validator:i,refiner:o,coercer:s=d=>d,entries:a=function*(){}}=t;this.type=e,this.schema=n,this.entries=a,this.coercer=s,i?this.validator=(d,c)=>{const u=i(d,c);return On(u,c,this,d)}:this.validator=()=>[],o?this.refiner=(d,c)=>{const u=o(d,c);return On(u,c,this,d)}:this.refiner=()=>[]}assert(t){return Ho(t,this)}create(t){return Ft(t,this)}is(t){return Tr(t,this)}mask(t){return Wo(t,this)}validate(t,e){return e===void 0&&(e={}),Be(t,this,e)}}function Ho(r,t){const e=Be(r,t);if(e[0])throw e[0]}function Ft(r,t){const e=Be(r,t,{coerce:!0});if(e[0])throw e[0];return e[1]}function Wo(r,t){const e=Be(r,t,{coerce:!0,mask:!0});if(e[0])throw e[0];return e[1]}function Tr(r,t){return!Be(r,t)[0]}function Be(r,t,e){e===void 0&&(e={});const n=Vt(r,t,e),i=Ko(n);return i[0]?[new qo(i[0],function*(){for(const s of n)s[0]&&(yield s[0])}),void 0]:[void 0,i[1]]}function Pe(r,t){return new ue({type:r,schema:null,validator:t})}function Xo(){return Pe("any",()=>!0)}function yt(r){return new ue({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(const[e,n]of t.entries())yield[e,n,r]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||"Expected an array value, but received: "+ce(t)}})}function Yo(){return Pe("boolean",r=>typeof r=="boolean")}function Rn(r){const t=ce(r);return new ue({type:"literal",schema:r,validator(e){return e===r||"Expected the literal `"+t+"`, but received: "+ce(e)}})}function Fe(r){return new ue({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function qe(){return Pe("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+ce(r))}function Ge(r){return new ue({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function le(){return Pe("string",r=>typeof r=="string"||"Expected a string, but received: "+ce(r))}function ae(r){const t=Object.keys(r);return new ue({type:"type",schema:r,*entries(e){if(be(e))for(const n of t)yield[n,e[n],r[n]]},validator(e){return be(e)||"Expected an object, but received: "+ce(e)}})}function Cr(r){const t=r.map(e=>e.type).join(" | ");return new ue({type:"union",schema:null,coercer(e,n){return(r.find(o=>{const[s]=o.validate(e,{coerce:!0});return!s})||zt()).coercer(e,n)},validator(e,n){const i=[];for(const o of r){const[...s]=Vt(e,o,n),[a]=s;if(a[0])for(const[d]of s)d&&i.push(d);else return[]}return["Expected the value to satisfy a union of `"+t+"`, but received: "+ce(e),...i]}})}function zt(){return Pe("unknown",()=>!0)}function Jo(r,t,e){return new ue({...r,coercer:(n,i)=>Tr(n,t)?r.coercer(e(n,i),i):r.coercer(n,i)})}async function Qo(r,t,e,n){r=W(r),n||(n=He());const i=new Fn;if(i.add(new zn({programId:r,keys:t??[],data:e})),n.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");return await n.sendAndConfirm(i,[])}const Bn=99;async function es(r,t,e){return(await qt(r,t,e)).map(i=>i?{publicKey:i.publicKey,account:i.account}:null)}async function qt(r,t,e){if(t.length<=Bn)return await Pn(r,t,e);{const n=Bo(t,Bn);return(await Promise.all(n.map(o=>Pn(r,o,e)))).flat()}}async function Pn(r,t,e){const n=e??r.commitment,{value:i,context:o}=await r.getMultipleAccountsInfoAndContext(t,n);return i.map((a,d)=>a===null?null:{publicKey:t[d],account:a,context:o})}async function Or(r,t,e,n,i){var o;e&&e.length>0&&t.sign(...e);const s=t._compile(),a=s.serialize(),c=t._serialize(a).toString("base64"),u={encoding:"base64",commitment:n??r.commitment};if(i){const p=(Array.isArray(i)?i:s.nonProgramIds()).map(A=>A.toBase58());u.accounts={encoding:"base64",addresses:p}}e&&(u.sigVerify=!0);const y=[c,u],w=await r._rpcRequest("simulateTransaction",y),f=Ft(w,is);if("error"in f){let p;if("data"in f.error&&(p=(o=f.error.data)===null||o===void 0?void 0:o.logs,p&&Array.isArray(p))){const A=`
2
- `,g=A+p.join(A);console.error(f.error.message,g)}throw new vt("failed to simulate transaction: "+f.error.message,p)}return f.result}function ts(r){return Jo(Rr(r),ns,t=>"error"in t?t:{...t,result:Ft(t.result,r)})}const ns=Rr(zt());function Rr(r){return Cr([ae({jsonrpc:Rn("2.0"),id:le(),result:r}),ae({jsonrpc:Rn("2.0"),id:le(),error:ae({code:zt(),message:le(),data:Ge(Xo())})})])}function rs(r){return ts(ae({context:ae({slot:qe()}),value:r}))}const is=rs(ae({err:Fe(Cr([ae({}),le()])),logs:Fe(yt(le())),accounts:Ge(Fe(yt(Fe(ae({executable:Yo(),owner:le(),lamports:qe(),data:yt(le()),rentEpoch:Ge(qe())}))))),unitsConsumed:Ge(qe())}));var os=Object.freeze({__proto__:null,invoke:Qo,getMultipleAccounts:es,getMultipleAccountsAndContext:qt,simulateTransaction:Or});class ss{constructor(t,e,n){this.connection=t,this.wallet=e,this.opts=n,this.publicKey=e==null?void 0:e.publicKey}static defaultOptions(){return{preflightCommitment:"processed",commitment:"processed"}}static local(t,e){throw new Error("Provider local is not available on browser.")}static env(){throw new Error("Provider env is not available on browser.")}async sendAndConfirm(t,e,n){var i,o,s,a;if(n===void 0&&(n=this.opts),xe(t))e&&t.sign(e);else if(t.feePayer=(i=t.feePayer)!==null&&i!==void 0?i:this.wallet.publicKey,t.recentBlockhash=(await this.connection.getLatestBlockhash(n.preflightCommitment)).blockhash,e)for(const c of e)t.partialSign(c);t=await this.wallet.signTransaction(t);const d=t.serialize();try{return await Dn(this.connection,d,n)}catch(c){if(c instanceof St){const u=xt(xe(t)?((o=t.signatures)===null||o===void 0?void 0:o[0])||new Uint8Array:(s=t.signature)!==null&&s!==void 0?s:new Uint8Array),y=await this.connection.getTransaction(u,{commitment:"confirmed"});if(y){const w=(a=y.meta)===null||a===void 0?void 0:a.logMessages;throw w?new vt(c.message,w):c}else throw c}else throw c}}async sendAll(t,e){var n,i,o;e===void 0&&(e=this.opts);const s=(await this.connection.getLatestBlockhash(e.preflightCommitment)).blockhash;let a=t.map(u=>{var y,w;if(xe(u.tx)){let f=u.tx;return u.signers&&f.sign(u.signers),f}else{let f=u.tx,p=(y=u.signers)!==null&&y!==void 0?y:[];return f.feePayer=(w=f.feePayer)!==null&&w!==void 0?w:this.wallet.publicKey,f.recentBlockhash=s,p.forEach(A=>{f.partialSign(A)}),f}});const d=await this.wallet.signAllTransactions(a),c=[];for(let u=0;u<a.length;u+=1){const y=d[u],w=y.serialize();try{c.push(await Dn(this.connection,w,e))}catch(f){if(f instanceof St){const p=xt(xe(y)?((n=y.signatures)===null||n===void 0?void 0:n[0])||new Uint8Array:(i=y.signature)!==null&&i!==void 0?i:new Uint8Array),A=await this.connection.getTransaction(p,{commitment:"confirmed"});if(A){const g=(o=A.meta)===null||o===void 0?void 0:o.logMessages;throw g?new vt(f.message,g):f}else throw f}else throw f}}return c}async simulate(t,e,n,i){let o=(await this.connection.getLatestBlockhash(n??this.connection.commitment)).blockhash,s;if(xe(t)?(e&&(t.sign(e),t=await this.wallet.signTransaction(t)),s=await this.connection.simulateTransaction(t,{commitment:n})):(t.feePayer=t.feePayer||this.wallet.publicKey,t.recentBlockhash=o,e&&(t=await this.wallet.signTransaction(t)),s=await Or(this.connection,t,e,n,i)),s.value.err)throw new as(s.value);return s.value}}class as extends Error{constructor(t,e){super(e),this.simulationResponse=t}}async function Dn(r,t,e){const n=e&&{skipPreflight:e.skipPreflight,preflightCommitment:e.preflightCommitment||e.commitment},i=await r.sendRawTransaction(t,n),o=(await r.confirmTransaction(i,e&&e.commitment)).value;if(o.err)throw new St(`Raw transaction ${i} failed (${JSON.stringify(o)})`);return i}class St extends Error{constructor(t){super(t)}}function He(){return ss.local()}const cs=new Set(["anchor-deprecated-state","debug-logs"]),Br=new Map;function us(r){if(!cs.has(r))throw new Error("Invalid feature");Br.set(r,!0)}function Gt(r){return Br.get(r)!==void 0}var ls=Object.freeze({__proto__:null,set:us,isSet:Gt});class We extends Error{constructor(t){super(t),this.name="IdlError"}}class De{constructor(t){this.stack=t}static parse(t){var e;const n=/^Program (\w*) invoke/,i=/^Program \w* success/,o=[];for(let s=0;s<t.length;s++){if(i.exec(t[s])){o.pop();continue}const a=(e=n.exec(t[s]))===null||e===void 0?void 0:e[1];a&&o.push(new q(a))}return new De(o)}}class Le extends Error{constructor(t,e,n,i,o,s){super(n.join(`
3
- `).replace("Program log: ","")),this.errorLogs=n,this.logs=i,this.error={errorCode:t,errorMessage:e,comparedValues:s,origin:o},this._programErrorStack=De.parse(i)}static parse(t){if(!t)return null;const e=t.findIndex(w=>w.startsWith("Program log: AnchorError"));if(e===-1)return null;const n=t[e],i=[n];let o;if(e+1<t.length){if(t[e+1]==="Program log: Left:"){const w=/^Program log: (.*)$/,f=w.exec(t[e+2])[1],p=w.exec(t[e+4])[1];o=[new q(f),new q(p)],i.push(...t.slice(e+1,e+5))}else if(t[e+1].startsWith("Program log: Left:")){const w=/^Program log: (Left|Right): (.*)$/,f=w.exec(t[e+1])[2],p=w.exec(t[e+2])[2];i.push(...t.slice(e+1,e+3)),o=[f,p]}}const a=/^Program log: AnchorError occurred\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(n),c=/^Program log: AnchorError thrown in (.*):(\d*)\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(n),y=/^Program log: AnchorError caused by account: (.*)\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(n);if(a){const[w,f,p]=a.slice(1,4),A={code:w,number:parseInt(f)};return new Le(A,p,i,t,void 0,o)}else if(c){const[w,f,p,A,g]=c.slice(1,6),E={code:p,number:parseInt(A)},T={file:w,line:parseInt(f)};return new Le(E,g,i,t,T,o)}else if(y){const[w,f,p,A]=y.slice(1,5),g=w,E={code:f,number:parseInt(p)};return new Le(E,A,i,t,g,o)}else return null}get program(){return this._programErrorStack.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){return this._programErrorStack.stack}toString(){return this.message}}class Xe extends Error{constructor(t,e,n){super(),this.code=t,this.msg=e,this.logs=n,n&&(this._programErrorStack=De.parse(n))}static parse(t,e){const n=t.toString();let i;if(n.includes("custom program error:")){let a=n.split("custom program error: ");if(a.length!==2)return null;i=a[1]}else{const a=n.match(/"Custom":([0-9]+)}/g);if(!a||a.length>1)return null;i=a[0].match(/([0-9]+)/g)[0]}let o;try{o=parseInt(i)}catch{return null}let s=e.get(o);return s!==void 0?new Xe(o,s,t.logs):(s=ds.get(o),s!==void 0?new Xe(o,s,t.logs):null)}get program(){var t;return(t=this._programErrorStack)===null||t===void 0?void 0:t.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){var t;return(t=this._programErrorStack)===null||t===void 0?void 0:t.stack}toString(){return this.msg}}function Pr(r,t){Gt("debug-logs")&&console.log("Translating error:",r);const e=Le.parse(r.logs);if(e)return e;const n=Xe.parse(r,t);if(n)return n;if(r.logs){const i={get:function(o,s){return s==="programErrorStack"?o.programErrorStack.stack:s==="program"?o.programErrorStack.stack[r.programErrorStack.stack.length-1]:Reflect.get(...arguments)}};return r.programErrorStack=De.parse(r.logs),new Proxy(r,i)}return r}const I={InstructionMissing:100,InstructionFallbackNotFound:101,InstructionDidNotDeserialize:102,InstructionDidNotSerialize:103,IdlInstructionStub:1e3,IdlInstructionInvalidProgram:1001,ConstraintMut:2e3,ConstraintHasOne:2001,ConstraintSigner:2002,ConstraintRaw:2003,ConstraintOwner:2004,ConstraintRentExempt:2005,ConstraintSeeds:2006,ConstraintExecutable:2007,ConstraintState:2008,ConstraintAssociated:2009,ConstraintAssociatedInit:2010,ConstraintClose:2011,ConstraintAddress:2012,ConstraintZero:2013,ConstraintTokenMint:2014,ConstraintTokenOwner:2015,ConstraintMintMintAuthority:2016,ConstraintMintFreezeAuthority:2017,ConstraintMintDecimals:2018,ConstraintSpace:2019,ConstraintAccountIsNone:2020,RequireViolated:2500,RequireEqViolated:2501,RequireKeysEqViolated:2502,RequireNeqViolated:2503,RequireKeysNeqViolated:2504,RequireGtViolated:2505,RequireGteViolated:2506,AccountDiscriminatorAlreadySet:3e3,AccountDiscriminatorNotFound:3001,AccountDiscriminatorMismatch:3002,AccountDidNotDeserialize:3003,AccountDidNotSerialize:3004,AccountNotEnoughKeys:3005,AccountNotMutable:3006,AccountOwnedByWrongProgram:3007,InvalidProgramId:3008,InvalidProgramExecutable:3009,AccountNotSigner:3010,AccountNotSystemOwned:3011,AccountNotInitialized:3012,AccountNotProgramData:3013,AccountNotAssociatedTokenAccount:3014,AccountSysvarMismatch:3015,AccountReallocExceedsLimit:3016,AccountDuplicateReallocs:3017,DeclaredProgramIdMismatch:4100,Deprecated:5e3},ds=new Map([[I.InstructionMissing,"8 byte instruction identifier not provided"],[I.InstructionFallbackNotFound,"Fallback functions are not supported"],[I.InstructionDidNotDeserialize,"The program could not deserialize the given instruction"],[I.InstructionDidNotSerialize,"The program could not serialize the given instruction"],[I.IdlInstructionStub,"The program was compiled without idl instructions"],[I.IdlInstructionInvalidProgram,"The transaction was given an invalid program for the IDL instruction"],[I.ConstraintMut,"A mut constraint was violated"],[I.ConstraintHasOne,"A has one constraint was violated"],[I.ConstraintSigner,"A signer constraint was violated"],[I.ConstraintRaw,"A raw constraint was violated"],[I.ConstraintOwner,"An owner constraint was violated"],[I.ConstraintRentExempt,"A rent exemption constraint was violated"],[I.ConstraintSeeds,"A seeds constraint was violated"],[I.ConstraintExecutable,"An executable constraint was violated"],[I.ConstraintState,"Deprecated Error, feel free to replace with something else"],[I.ConstraintAssociated,"An associated constraint was violated"],[I.ConstraintAssociatedInit,"An associated init constraint was violated"],[I.ConstraintClose,"A close constraint was violated"],[I.ConstraintAddress,"An address constraint was violated"],[I.ConstraintZero,"Expected zero account discriminant"],[I.ConstraintTokenMint,"A token mint constraint was violated"],[I.ConstraintTokenOwner,"A token owner constraint was violated"],[I.ConstraintMintMintAuthority,"A mint mint authority constraint was violated"],[I.ConstraintMintFreezeAuthority,"A mint freeze authority constraint was violated"],[I.ConstraintMintDecimals,"A mint decimals constraint was violated"],[I.ConstraintSpace,"A space constraint was violated"],[I.ConstraintAccountIsNone,"A required account for the constraint is None"],[I.RequireViolated,"A require expression was violated"],[I.RequireEqViolated,"A require_eq expression was violated"],[I.RequireKeysEqViolated,"A require_keys_eq expression was violated"],[I.RequireNeqViolated,"A require_neq expression was violated"],[I.RequireKeysNeqViolated,"A require_keys_neq expression was violated"],[I.RequireGtViolated,"A require_gt expression was violated"],[I.RequireGteViolated,"A require_gte expression was violated"],[I.AccountDiscriminatorAlreadySet,"The account discriminator was already set on this account"],[I.AccountDiscriminatorNotFound,"No 8 byte discriminator was found on the account"],[I.AccountDiscriminatorMismatch,"8 byte discriminator did not match what was expected"],[I.AccountDidNotDeserialize,"Failed to deserialize the account"],[I.AccountDidNotSerialize,"Failed to serialize the account"],[I.AccountNotEnoughKeys,"Not enough account keys given to the instruction"],[I.AccountNotMutable,"The given account is not mutable"],[I.AccountOwnedByWrongProgram,"The given account is owned by a different program than expected"],[I.InvalidProgramId,"Program ID was not as expected"],[I.InvalidProgramExecutable,"Program account is not executable"],[I.AccountNotSigner,"The given account did not sign"],[I.AccountNotSystemOwned,"The given account is not owned by the system program"],[I.AccountNotInitialized,"The program expected this account to be already initialized"],[I.AccountNotProgramData,"The given account is not a program data account"],[I.AccountNotAssociatedTokenAccount,"The given account is not the associated token account"],[I.AccountSysvarMismatch,"The given public key does not match the required sysvar"],[I.AccountReallocExceedsLimit,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[I.AccountDuplicateReallocs,"The account was duplicated for more than one reallocation"],[I.DeclaredProgramIdMismatch,"The declared program id does not match the actual program id"],[I.Deprecated,"The API being used is deprecated and should no longer be used"]]);var It=function(){return It=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},It.apply(this,arguments)},Lt=function(){return Lt=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Lt.apply(this,arguments)};function fs(r){return r.toLowerCase()}var hs=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],ps=/[^A-Z0-9]+/gi;function ws(r,t){t===void 0&&(t={});for(var e=t.splitRegexp,n=e===void 0?hs:e,i=t.stripRegexp,o=i===void 0?ps:i,s=t.transform,a=s===void 0?fs:s,d=t.delimiter,c=d===void 0?" ":d,u=Un(Un(r,n,"$1\0$2"),o,"\0"),y=0,w=u.length;u.charAt(y)==="\0";)y++;for(;u.charAt(w-1)==="\0";)w--;return u.slice(y,w).split("\0").map(a).join(c)}function Un(r,t,e){return t instanceof RegExp?r.replace(t,e):t.reduce(function(n,i){return n.replace(i,e)},r)}function ys(r,t){return t===void 0&&(t={}),ws(r,Lt({delimiter:"."},t))}function gs(r,t){return t===void 0&&(t={}),ys(r,It({delimiter:"_"},t))}class K{static fieldLayout(t,e){const n=t.name!==void 0?j(t.name):void 0;switch(t.type){case"bool":return R.bool(n);case"u8":return R.u8(n);case"i8":return R.i8(n);case"u16":return R.u16(n);case"i16":return R.i16(n);case"u32":return R.u32(n);case"i32":return R.i32(n);case"f32":return R.f32(n);case"u64":return R.u64(n);case"i64":return R.i64(n);case"f64":return R.f64(n);case"u128":return R.u128(n);case"i128":return R.i128(n);case"u256":return R.u256(n);case"i256":return R.i256(n);case"bytes":return R.vecU8(n);case"string":return R.str(n);case"publicKey":return R.publicKey(n);default:{if("vec"in t.type)return R.vec(K.fieldLayout({name:void 0,type:t.type.vec},e),n);if("option"in t.type)return R.option(K.fieldLayout({name:void 0,type:t.type.option},e),n);if("defined"in t.type){if(!e)throw new We("User defined types not provided");const i=t.type.defined,o=e.filter(s=>s.name===i);if(o.length!==1)throw new We(`Type not found: ${JSON.stringify(t)}`);return K.typeDefLayout(o[0],e,n)}else if("array"in t.type){let i=t.type.array[0],o=t.type.array[1],s=K.fieldLayout({name:void 0,type:i},e);return R.array(s,o,n)}else throw new Error(`Not yet implemented: ${t}`)}}}static typeDefLayout(t,e=[],n){switch(t.type.kind){case"struct":{const i=t.type.fields.map(o=>K.fieldLayout(o,e));return R.struct(i,n)}case"enum":{let i=t.type.variants.map(o=>{const s=j(o.name);if(!o.fields)return R.struct([],s);const a=o.fields.map((d,c)=>d!=null&&d.name?K.fieldLayout(d,e):K.fieldLayout({type:d,name:c.toString()},e));return R.struct(a,s)});return n!==void 0?R.rustEnum(i).replicate(n):R.rustEnum(i,n)}case"alias":return K.fieldLayout({type:t.type.value,name:t.name},e)}}}const Nn="global";class Kt{constructor(t){this.idl=t,this.ixLayout=Kt.parseIxLayout(t);const e=new Map;t.instructions.forEach(n=>{const i=Mn(Nn,n.name);e.set(ve.encode(i),{layout:this.ixLayout.get(n.name),name:n.name})}),this.sighashLayouts=e}encode(t,e){return this._encode(Nn,t,e)}_encode(t,e,n){const i=G.Buffer.alloc(1e3),o=j(e),s=this.ixLayout.get(o);if(!s)throw new Error(`Unknown method: ${o}`);const a=s.encode(n,i),d=i.slice(0,a);return G.Buffer.concat([Mn(t,e),d])}static parseIxLayout(t){const e=t.instructions.map(n=>{let i=n.args.map(s=>{var a,d;return K.fieldLayout(s,Array.from([...(a=t.accounts)!==null&&a!==void 0?a:[],...(d=t.types)!==null&&d!==void 0?d:[]]))});const o=j(n.name);return[o,R.struct(i,o)]});return new Map(e)}decode(t,e="hex"){typeof t=="string"&&(t=e==="hex"?G.Buffer.from(t,"hex"):ve.decode(t));let n=ve.encode(t.slice(0,8)),i=t.slice(8);const o=this.sighashLayouts.get(n);return o?{data:o.layout.decode(i),name:o.name}:null}format(t,e){return ee.format(t,e,this.idl)}}class ee{static format(t,e,n){const i=n.instructions.filter(d=>t.name===d.name)[0];if(i===void 0)return console.error("Invalid instruction given"),null;const o=i.args.map(d=>({name:d.name,type:ee.formatIdlType(d.type),data:ee.formatIdlData(d,t.data[d.name],n.types)})),s=ee.flattenIdlAccounts(i.accounts),a=e.map((d,c)=>c<s.length?{name:s[c].name,...d}:{name:void 0,...d});return{args:o,accounts:a}}static formatIdlType(t){if(typeof t=="string")return t;if("vec"in t)return`Vec<${this.formatIdlType(t.vec)}>`;if("option"in t)return`Option<${this.formatIdlType(t.option)}>`;if("defined"in t)return t.defined;if("array"in t)return`Array<${t.array[0]}; ${t.array[1]}>`;throw new Error(`Unknown IDL type: ${t}`)}static formatIdlData(t,e,n){if(typeof t.type=="string")return e.toString();if(t.type.hasOwnProperty("vec"))return"["+e.map(i=>this.formatIdlData({name:"",type:t.type.vec},i)).join(", ")+"]";if(t.type.hasOwnProperty("option"))return e===null?"null":this.formatIdlData({name:"",type:t.type.option},e,n);if(t.type.hasOwnProperty("defined")){if(n===void 0)throw new Error("User defined types not provided");const i=n.filter(o=>o.name===t.type.defined);if(i.length!==1)throw new Error(`Type not found: ${t.type.defined}`);return ee.formatIdlDataDefined(i[0],e,n)}return"unknown"}static formatIdlDataDefined(t,e,n){switch(t.type.kind){case"struct":{const i=t.type;return"{ "+Object.keys(e).map(s=>{const a=i.fields.find(d=>d.name===s);if(!a)throw new Error("Unable to find type");return s+": "+ee.formatIdlData(a,e[s],n)}).join(", ")+" }"}case"enum":{if(t.type.variants.length===0)return"{}";if(t.type.variants[0].name){const i=t.type.variants,o=Object.keys(e)[0],s=e[o],a=Object.keys(s).map(c=>{var u;const y=s[c],w=(u=i[o])===null||u===void 0?void 0:u.find(f=>f.name===c);if(!w)throw new Error("Unable to find variant");return c+": "+ee.formatIdlData(w,y,n)}).join(", "),d=j(o,{pascalCase:!0});return a.length===0?d:`${d} { ${a} }`}else return"Tuple formatting not yet implemented"}case"alias":return ee.formatIdlType(t.type.value)}}static flattenIdlAccounts(t,e){return t.map(n=>{const i=ms(n.name);if(n.hasOwnProperty("accounts")){const o=e?`${e} > ${i}`:i;return ee.flattenIdlAccounts(n.accounts,o)}else return{...n,name:e?`${e} > ${i}`:i}}).flat()}}function ms(r){const t=r.replace(/([A-Z])/g," $1");return t.charAt(0).toUpperCase()+t.slice(1)}function Mn(r,t){let e=gs(t),n=`${r}:${e}`;return G.Buffer.from(Je(n).slice(0,8))}function Dr(r,t){switch(t.type.kind){case"struct":return t.type.fields.map(e=>de(r,e.type)).reduce((e,n)=>e+n,0);case"enum":{const e=t.type.variants.map(n=>n.fields?n.fields.map(i=>typeof i=="object"&&"name"in i?de(r,i.type):de(r,i)).reduce((i,o)=>i+o,0):0);return Math.max(...e)+1}case"alias":return de(r,t.type.value)}}function de(r,t){var e,n;switch(t){case"bool":return 1;case"u8":return 1;case"i8":return 1;case"i16":return 2;case"u16":return 2;case"u32":return 4;case"i32":return 4;case"f32":return 4;case"u64":return 8;case"i64":return 8;case"f64":return 8;case"u128":return 16;case"i128":return 16;case"u256":return 32;case"i256":return 32;case"bytes":return 1;case"string":return 1;case"publicKey":return 32;default:if("vec"in t)return 1;if("option"in t)return 1+de(r,t.option);if("coption"in t)return 4+de(r,t.coption);if("defined"in t){const i=(n=(e=r.types)===null||e===void 0?void 0:e.filter(s=>s.name===t.defined))!==null&&n!==void 0?n:[];if(i.length!==1)throw new We(`Type not found: ${JSON.stringify(t)}`);let o=i[0];return Dr(r,o)}if("array"in t){let i=t.array[0],o=t.array[1];return de(r,i)*o}throw new Error(`Invalid type ${JSON.stringify(t)}`)}}const Tt=8;function Ur(r){return V.Buffer.from(Je(r).slice(0,Tt))}class me{constructor(t){if(t.accounts===void 0){this.accountLayouts=new Map;return}const e=t.accounts.map(n=>[n.name,K.typeDefLayout(n,t.types)]);this.accountLayouts=new Map(e),this.idl=t}async encode(t,e){const n=G.Buffer.alloc(1e3),i=this.accountLayouts.get(t);if(!i)throw new Error(`Unknown account: ${t}`);const o=i.encode(e,n);let s=n.slice(0,o),a=me.accountDiscriminator(t);return G.Buffer.concat([a,s])}decode(t,e){if(me.accountDiscriminator(t).compare(e.slice(0,8)))throw new Error("Invalid account discriminator");return this.decodeUnchecked(t,e)}decodeAny(t){const e=t.slice(0,8),n=Array.from(this.accountLayouts.keys()).find(i=>me.accountDiscriminator(i).equals(e));if(!n)throw new Error("Account descriminator not found");return this.decodeUnchecked(n,t)}decodeUnchecked(t,e){const n=e.subarray(Tt),i=this.accountLayouts.get(t);if(!i)throw new Error(`Unknown account: ${t}`);return i.decode(n)}memcmp(t,e){const n=me.accountDiscriminator(t);return{offset:0,bytes:ve.encode(e?G.Buffer.concat([n,e]):n)}}size(t){var e;return Tt+((e=Dr(this.idl,t))!==null&&e!==void 0?e:0)}static accountDiscriminator(t){const e=`account:${j(t,{pascalCase:!0,preserveConsecutiveUppercase:!0})}`;return Ur(e)}}class vs{constructor(t){if(t.events===void 0){this.layouts=new Map;return}const e=t.events.map(n=>{let i={name:n.name,type:{kind:"struct",fields:n.fields.map(o=>({name:o.name,type:o.type}))}};return[n.name,K.typeDefLayout(i,t.types)]});this.layouts=new Map(e),this.discriminators=new Map(t.events===void 0?[]:t.events.map(n=>[kt(bs(n.name)),n.name]))}decode(t){let e;try{e=jt(t)}catch{return null}const n=kt(e.slice(0,8)),i=this.discriminators.get(n);if(i===void 0)return null;const o=this.layouts.get(i);if(!o)throw new Error(`Unknown event: ${i}`);return{data:o.decode(e.slice(8)),name:i}}}function bs(r){return Ur(`event:${r}`)}class _s{constructor(t){if(t.types===void 0){this.typeLayouts=new Map;return}const e=t.types.map(n=>[n.name,K.typeDefLayout(n,t.types)]);this.typeLayouts=new Map(e),this.idl=t}encode(t,e){const n=G.Buffer.alloc(1e3),i=this.typeLayouts.get(t);if(!i)throw new Error(`Unknown type: ${t}`);const o=i.encode(e,n);return n.slice(0,o)}decode(t,e){const n=this.typeLayouts.get(t);if(!n)throw new Error(`Unknown type: ${t}`);return n.decode(e)}}class Nr{constructor(t){this.instruction=new Kt(t),this.accounts=new me(t),this.events=new vs(t),this.types=new _s(t)}}var Es=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof V.global<"u"?V.global:typeof self<"u"?self:{};function As(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}class H{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}var rt=H;function xs(r,t){return t.property?r+"["+t.property+"]":r}class fe extends H{isCount(){throw new Error("ExternalLayout is abstract")}}class Mr extends fe{constructor(t,e,n){if(!(t instanceof H))throw new TypeError("layout must be a Layout");if(e===void 0)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof it||this.layout instanceof $r}decode(t,e){return e===void 0&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return n===void 0&&(n=0),this.layout.encode(t,e,n+this.offset)}}class it extends H{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return e===void 0&&(e=0),t.readUIntLE(e,this.span)}encode(t,e,n){return n===void 0&&(n=0),e.writeUIntLE(t,n,this.span),this.span}}class $r extends H{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return e===void 0&&(e=0),t.readUIntBE(e,this.span)}encode(t,e,n){return n===void 0&&(n=0),e.writeUIntBE(t,n,this.span),this.span}}const Ct=Math.pow(2,32);function jr(r){const t=Math.floor(r/Ct),e=r-t*Ct;return{hi32:t,lo32:e}}function Vr(r,t){return r*Ct+t}class ks extends H{constructor(t){super(8,t)}decode(t,e){e===void 0&&(e=0);const n=t.readUInt32LE(e),i=t.readUInt32LE(e+4);return Vr(i,n)}encode(t,e,n){n===void 0&&(n=0);const i=jr(t);return e.writeUInt32LE(i.lo32,n),e.writeUInt32LE(i.hi32,n+4),8}}class Ss extends H{constructor(t){super(8,t)}decode(t,e){e===void 0&&(e=0);const n=t.readUInt32LE(e),i=t.readInt32LE(e+4);return Vr(i,n)}encode(t,e,n){n===void 0&&(n=0);const i=jr(t);return e.writeUInt32LE(i.lo32,n),e.writeInt32LE(i.hi32,n+4),8}}class Is extends H{constructor(t,e,n){if(!(Array.isArray(t)&&t.reduce((o,s)=>o&&s instanceof H,!0)))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const o of t)if(0>o.span&&o.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=t.reduce((o,s)=>o+s.getSpan(),0)}catch{}super(i,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;try{n=this.fields.reduce((i,o)=>{const s=o.getSpan(t,e);return e+=s,i+s},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e){e===void 0&&(e=0);const n=this.makeDestinationObject();for(const i of this.fields)if(i.property!==void 0&&(n[i.property]=i.decode(t,e)),e+=i.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){n===void 0&&(n=0);const i=n;let o=0,s=0;for(const a of this.fields){let d=a.span;if(s=0<d?d:0,a.property!==void 0){const c=t[a.property];c!==void 0&&(s=a.encode(c,e,n),0>d&&(d=a.getSpan(e,n)))}o=n,n+=d}return o+s-i}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0<t.length&&(e[n.property]=t.shift());return e}layoutFor(t){if(typeof t!="string")throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}offsetOf(t){if(typeof t!="string")throw new TypeError("property must be string");let e=0;for(const n of this.fields){if(n.property===t)return e;0>n.span?e=-1:0<=e&&(e+=n.span)}}}class Fr{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class $n extends Fr{constructor(t,e){if(!(t instanceof fe&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class zr extends H{constructor(t,e,n){const i=t instanceof it||t instanceof $r;if(i)t=new $n(new Mr(t));else if(t instanceof fe&&t.isCount())t=new $n(t);else if(!(t instanceof Fr))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof H))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let o=-1;e&&(o=e.span,0<=o&&i&&(o+=t.layout.span)),super(o,n),this.discriminator=t,this.usesPrefixDiscriminator=i,this.defaultLayout=e,this.registry={};let s=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(a){return s(a)},this.configGetSourceVariant=function(a){s=a.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){e===void 0&&(e=0);let n;const i=this.discriminator,o=i.decode(t,e);let s=this.registry[o];if(s===void 0){let a=0;s=this.defaultLayout,this.usesPrefixDiscriminator&&(a=i.layout.span),n=this.makeDestinationObject(),n[i.property]=o,n[s.property]=this.defaultLayout.decode(t,e+a)}else n=s.decode(t,e);return n}encode(t,e,n){n===void 0&&(n=0);const i=this.getSourceVariant(t);if(i===void 0){const o=this.discriminator,s=this.defaultLayout;let a=0;return this.usesPrefixDiscriminator&&(a=o.layout.span),o.encode(t[o.property],e,n),a+s.encode(t[s.property],e,n+a)}return i.encode(t,e,n)}addVariant(t,e,n){const i=new Ls(this,t,e,n);return this.registry[t]=i,i}getVariant(t,e){let n=t;return V.Buffer.isBuffer(t)&&(e===void 0&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class Ls extends H{constructor(t,e,n,i){if(!(t instanceof zr))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&i===void 0&&(i=n,n=null),n){if(!(n instanceof H))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof i!="string")throw new TypeError("variant must have a String property")}let o=t.span;0>t.span&&(o=n?n.span:0,0<=o&&t.usesPrefixDiscriminator&&(o+=t.discriminator.layout.span)),super(o,i),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(e===void 0&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+i):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){n===void 0&&(n=0);let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let o=i;if(this.layout&&(this.layout.encode(t[this.property],e,n+i),o+=this.layout.getSpan(e,n+i),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}class Ts extends H{constructor(t,e){if(!(t instanceof fe&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;t instanceof fe||(n=t),super(n,e),this.length=t}getSpan(t,e){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}decode(t,e){e===void 0&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let i=this.length;if(this.length instanceof fe&&(i=t.length),!(V.Buffer.isBuffer(t)&&i===t.length))throw new TypeError(xs("Blob.encode",this)+" requires (length "+i+") Buffer as src");if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,i,"hex"),this.length instanceof fe&&this.length.encode(i,e,n),i}}var Cs=(r,t,e)=>new Mr(r,t,e),Os=r=>new it(1,r),ie=r=>new it(4,r),Rs=r=>new ks(r),oe=r=>new Ss(r),z=(r,t,e)=>new Is(r,t,e),qr=(r,t,e)=>new zr(r,t,e),Ue=(r,t)=>new Ts(r,t);class Bs extends rt{constructor(t){super(-1,t),this.property=t,this.layout=z([ie("length"),ie("lengthPadding"),Ue(Cs(ie(),-8),"chars")],this.property)}encode(t,e,n=0){if(t==null)return this.layout.span;const i={chars:V.Buffer.from(t,"utf8")};return this.layout.encode(i,e,n)}decode(t,e=0){return this.layout.decode(t,e).chars.toString()}getSpan(t,e=0){return ie().span+ie().span+new Gn(new Uint8Array(t).slice(e,e+4),10,"le").toNumber()}}function ot(r){return new Bs(r)}function J(r){return Ue(32,r)}const X=qr(ie("instruction"));X.addVariant(0,z([oe("lamports"),oe("space"),J("owner")]),"createAccount");X.addVariant(1,z([J("owner")]),"assign");X.addVariant(2,z([oe("lamports")]),"transfer");X.addVariant(3,z([J("base"),ot("seed"),oe("lamports"),oe("space"),J("owner")]),"createAccountWithSeed");X.addVariant(4,z([J("authorized")]),"advanceNonceAccount");X.addVariant(5,z([oe("lamports")]),"withdrawNonceAccount");X.addVariant(6,z([J("authorized")]),"initializeNonceAccount");X.addVariant(7,z([J("authorized")]),"authorizeNonceAccount");X.addVariant(8,z([oe("space")]),"allocate");X.addVariant(9,z([J("base"),ot("seed"),oe("space"),J("owner")]),"allocateWithSeed");X.addVariant(10,z([J("base"),ot("seed"),J("owner")]),"assignWithSeed");X.addVariant(11,z([oe("lamports"),ot("seed"),J("owner")]),"transferWithSeed");Math.max(...Object.values(X.registry).map(r=>r.span));class Ps extends rt{constructor(t,e,n,i){super(t.span,i),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}function jn(r){return new Ps(Ue(32),t=>new q(t),t=>t.toBuffer(),r)}z([ie("version"),ie("state"),jn("authorizedPubkey"),jn("nonce"),z([Rs("lamportsPerSignature")],"feeCalculator")]);function Ds(r){return new TextDecoder().decode(Je(r))}var Us=Object.freeze({__proto__:null,hash:Ds});function Ns(r,t,e){const n=G.Buffer.concat([r.toBuffer(),G.Buffer.from(t),e.toBuffer()]);return new q(Je(n))}function Gr(r,...t){let e=[G.Buffer.from([97,110,99,104,111,114])];t.forEach(i=>{e.push(i instanceof G.Buffer?i:W(i).toBuffer())});const[n]=q.findProgramAddressSync(e,W(r));return n}var Ms=Object.freeze({__proto__:null,createWithSeedSync:Ns,associated:Gr});const Zt=new q("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),Ht=new q("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");function $s({mint:r,owner:t}){return q.findProgramAddressSync([t.toBuffer(),Zt.toBuffer(),r.toBuffer()],Ht)[0]}var js=Object.freeze({__proto__:null,TOKEN_PROGRAM_ID:Zt,ASSOCIATED_PROGRAM_ID:Ht,associatedAddress:$s}),Ot={exports:{}};(function(r,t){var e=typeof self<"u"?self:Es,n=function(){function o(){this.fetch=!1,this.DOMException=e.DOMException}return o.prototype=e,new o}();(function(o){(function(s){var a={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function d(l){return l&&DataView.prototype.isPrototypeOf(l)}if(a.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(l){return l&&c.indexOf(Object.prototype.toString.call(l))>-1};function y(l){if(typeof l!="string"&&(l=String(l)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(l))throw new TypeError("Invalid character in header field name");return l.toLowerCase()}function w(l){return typeof l!="string"&&(l=String(l)),l}function f(l){var h={next:function(){var x=l.shift();return{done:x===void 0,value:x}}};return a.iterable&&(h[Symbol.iterator]=function(){return h}),h}function p(l){this.map={},l instanceof p?l.forEach(function(h,x){this.append(x,h)},this):Array.isArray(l)?l.forEach(function(h){this.append(h[0],h[1])},this):l&&Object.getOwnPropertyNames(l).forEach(function(h){this.append(h,l[h])},this)}p.prototype.append=function(l,h){l=y(l),h=w(h);var x=this.map[l];this.map[l]=x?x+", "+h:h},p.prototype.delete=function(l){delete this.map[y(l)]},p.prototype.get=function(l){return l=y(l),this.has(l)?this.map[l]:null},p.prototype.has=function(l){return this.map.hasOwnProperty(y(l))},p.prototype.set=function(l,h){this.map[y(l)]=w(h)},p.prototype.forEach=function(l,h){for(var x in this.map)this.map.hasOwnProperty(x)&&l.call(h,this.map[x],x,this)},p.prototype.keys=function(){var l=[];return this.forEach(function(h,x){l.push(x)}),f(l)},p.prototype.values=function(){var l=[];return this.forEach(function(h){l.push(h)}),f(l)},p.prototype.entries=function(){var l=[];return this.forEach(function(h,x){l.push([x,h])}),f(l)},a.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function A(l){if(l.bodyUsed)return Promise.reject(new TypeError("Already read"));l.bodyUsed=!0}function g(l){return new Promise(function(h,x){l.onload=function(){h(l.result)},l.onerror=function(){x(l.error)}})}function E(l){var h=new FileReader,x=g(h);return h.readAsArrayBuffer(l),x}function T(l){var h=new FileReader,x=g(h);return h.readAsText(l),x}function _(l){for(var h=new Uint8Array(l),x=new Array(h.length),D=0;D<h.length;D++)x[D]=String.fromCharCode(h[D]);return x.join("")}function m(l){if(l.slice)return l.slice(0);var h=new Uint8Array(l.byteLength);return h.set(new Uint8Array(l)),h.buffer}function L(){return this.bodyUsed=!1,this._initBody=function(l){this._bodyInit=l,l?typeof l=="string"?this._bodyText=l:a.blob&&Blob.prototype.isPrototypeOf(l)?this._bodyBlob=l:a.formData&&FormData.prototype.isPrototypeOf(l)?this._bodyFormData=l:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)?this._bodyText=l.toString():a.arrayBuffer&&a.blob&&d(l)?(this._bodyArrayBuffer=m(l.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(l)||u(l))?this._bodyArrayBuffer=m(l):this._bodyText=l=Object.prototype.toString.call(l):this._bodyText="",this.headers.get("content-type")||(typeof l=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var l=A(this);if(l)return l;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?A(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(E)}),this.text=function(){var l=A(this);if(l)return l;if(this._bodyBlob)return T(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(_(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(B)}),this.json=function(){return this.text().then(JSON.parse)},this}var M=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function S(l){var h=l.toUpperCase();return M.indexOf(h)>-1?h:l}function P(l,h){h=h||{};var x=h.body;if(l instanceof P){if(l.bodyUsed)throw new TypeError("Already read");this.url=l.url,this.credentials=l.credentials,h.headers||(this.headers=new p(l.headers)),this.method=l.method,this.mode=l.mode,this.signal=l.signal,!x&&l._bodyInit!=null&&(x=l._bodyInit,l.bodyUsed=!0)}else this.url=String(l);if(this.credentials=h.credentials||this.credentials||"same-origin",(h.headers||!this.headers)&&(this.headers=new p(h.headers)),this.method=S(h.method||this.method||"GET"),this.mode=h.mode||this.mode||null,this.signal=h.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&x)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(x)}P.prototype.clone=function(){return new P(this,{body:this._bodyInit})};function B(l){var h=new FormData;return l.trim().split("&").forEach(function(x){if(x){var D=x.split("="),F=D.shift().replace(/\+/g," "),N=D.join("=").replace(/\+/g," ");h.append(decodeURIComponent(F),decodeURIComponent(N))}}),h}function O(l){var h=new p,x=l.replace(/\r?\n[\t ]+/g," ");return x.split(/\r?\n/).forEach(function(D){var F=D.split(":"),N=F.shift().trim();if(N){var Ne=F.join(":").trim();h.append(N,Ne)}}),h}L.call(P.prototype);function C(l,h){h||(h={}),this.type="default",this.status=h.status===void 0?200:h.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in h?h.statusText:"OK",this.headers=new p(h.headers),this.url=h.url||"",this._initBody(l)}L.call(C.prototype),C.prototype.clone=function(){return new C(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},C.error=function(){var l=new C(null,{status:0,statusText:""});return l.type="error",l};var k=[301,302,303,307,308];C.redirect=function(l,h){if(k.indexOf(h)===-1)throw new RangeError("Invalid status code");return new C(null,{status:h,headers:{location:l}})},s.DOMException=o.DOMException;try{new s.DOMException}catch{s.DOMException=function(h,x){this.message=h,this.name=x;var D=Error(h);this.stack=D.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function v(l,h){return new Promise(function(x,D){var F=new P(l,h);if(F.signal&&F.signal.aborted)return D(new s.DOMException("Aborted","AbortError"));var N=new XMLHttpRequest;function Ne(){N.abort()}N.onload=function(){var Ae={status:N.status,statusText:N.statusText,headers:O(N.getAllResponseHeaders()||"")};Ae.url="responseURL"in N?N.responseURL:Ae.headers.get("X-Request-URL");var at="response"in N?N.response:N.responseText;x(new C(at,Ae))},N.onerror=function(){D(new TypeError("Network request failed"))},N.ontimeout=function(){D(new TypeError("Network request failed"))},N.onabort=function(){D(new s.DOMException("Aborted","AbortError"))},N.open(F.method,F.url,!0),F.credentials==="include"?N.withCredentials=!0:F.credentials==="omit"&&(N.withCredentials=!1),"responseType"in N&&a.blob&&(N.responseType="blob"),F.headers.forEach(function(Ae,at){N.setRequestHeader(at,Ae)}),F.signal&&(F.signal.addEventListener("abort",Ne),N.onreadystatechange=function(){N.readyState===4&&F.signal.removeEventListener("abort",Ne)}),N.send(typeof F._bodyInit>"u"?null:F._bodyInit)})}return v.polyfill=!0,o.fetch||(o.fetch=v,o.Headers=p,o.Request=P,o.Response=C),s.Headers=p,s.Request=P,s.Response=C,s.fetch=v,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,r.exports=t})(Ot,Ot.exports);var Vs=As(Ot.exports);async function Fs(r,t,e=5){const n=`https://api.apr.dev/api/v0/program/${t.toString()}/latest?limit=${e}`,[i,o]=await Promise.all([Kr(r,t),Vs(n)]),s=(await o.json()).filter(d=>!d.aborted&&d.state==="Built"&&d.verified==="Verified");if(s.length===0)return null;const a=s[0];return i.slot.toNumber()!==a.verified_slot?null:a}async function Kr(r,t){const e=await r.getAccountInfo(t);if(e===null)throw new Error("program account not found");const{program:n}=Rt(e.data),i=await r.getAccountInfo(n.programdataAddress);if(i===null)throw new Error("program data account not found");const{programData:o}=Rt(i.data);return o}const zs=R.rustEnum([R.struct([],"uninitialized"),R.struct([R.option(R.publicKey(),"authorityAddress")],"buffer"),R.struct([R.publicKey("programdataAddress")],"program"),R.struct([R.u64("slot"),R.option(R.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,R.u32());function Rt(r){return zs.decode(r)}var qs=Object.freeze({__proto__:null,verifiedBuild:Fs,fetchData:Kr,decodeUpgradeableLoaderState:Rt}),Oa=Object.freeze({__proto__:null,sha256:Us,rpc:os,publicKey:Ms,bytes:Vo,token:js,features:ls,registry:qs});function Gs(r){return"accounts"in r}async function Ks(r){const t=(await q.findProgramAddress([],r))[0];return await q.createWithSeed(t,Zs(),r)}function Zs(){return"anchor:idl"}const Hs=R.struct([R.publicKey("authority"),R.vecU8("data")]);function Ws(r){return Hs.decode(r)}function st(r,t){var e,n;let i={};const o=r.args?r.args.length:0;if(t.length>o){if(t.length!==o+1)throw new Error(`provided too many arguments ${t} to instruction ${r==null?void 0:r.name} expecting: ${(n=(e=r.args)===null||e===void 0?void 0:e.map(s=>s.name))!==null&&n!==void 0?n:[]}`);i=t.pop()}return[t,i]}class Ye{static build(t,e,n){if(t.name==="_inner")throw new We("the _inner name is reserved");const i=(...o)=>{const[s,a]=st(t,[...o]);Lr(t.accounts,a.accounts),Xs(t,...o);const d=i.accounts(a.accounts);return a.remainingAccounts!==void 0&&d.push(...a.remainingAccounts),Gt("debug-logs")&&console.log("Outgoing account metas:",d),new zn({keys:d,programId:n,data:e(t.name,zo(t,...s))})};return i.accounts=o=>Ye.accountsArray(o,t.accounts,n,t.name),i}static accountsArray(t,e,n,i){return t?e.map(o=>{if(("accounts"in o?o.accounts:void 0)!==void 0){const a=t[o.name];return Ye.accountsArray(a,o.accounts,n,i).flat()}else{const a=o;let d;try{d=W(t[o.name])}catch{throw new Error(`Wrong input type for account "${o.name}" in the instruction accounts object${i!==void 0?' for instruction "'+i+'"':""}. Expected PublicKey or string.`)}const c=a.isOptional&&d.equals(n),u=a.isMut&&!c,y=a.isSigner&&!c;return{pubkey:d,isWritable:u,isSigner:y}}}).flat():[]}}function Xs(r,...t){}class Ys{static build(t,e){return(...i)=>{var o,s,a;const[,d]=st(t,[...i]),c=new Fn;if(d.preInstructions&&d.instructions)throw new Error("instructions is deprecated, use preInstructions");return(o=d.preInstructions)===null||o===void 0||o.forEach(u=>c.add(u)),(s=d.instructions)===null||s===void 0||s.forEach(u=>c.add(u)),c.add(e(...i)),(a=d.postInstructions)===null||a===void 0||a.forEach(u=>c.add(u)),c}}}class Js{static build(t,e,n,i){return async(...s)=>{var a;const d=e(...s),[,c]=st(t,[...s]);if(i.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");try{return await i.sendAndConfirm(d,(a=c.signers)!==null&&a!==void 0?a:[],c.options)}catch(u){throw Pr(u,n)}}}}class Qs{static build(t,e,n,i){var o;const s={};return(o=t.accounts)===null||o===void 0||o.forEach(a=>{const d=j(a.name);s[d]=new ea(t,a,n,i,e)}),s}}class ea{get size(){return this._size}get programId(){return this._programId}get provider(){return this._provider}get coder(){return this._coder}get idlAccount(){return this._idlAccount}constructor(t,e,n,i,o){this._idlAccount=e,this._programId=n,this._provider=i??He(),this._coder=o??new Nr(t),this._size=this._coder.accounts.size(e)}async fetchNullable(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);return n}async fetchNullableAndContext(t,e){const n=await this.getAccountInfoAndContext(t,e),{value:i,context:o}=n;return{data:i&&i.data.length!==0?this._coder.accounts.decode(this._idlAccount.name,i.data):null,context:o}}async fetch(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);if(n===null)throw new Error(`Account does not exist or has no data ${t.toString()}`);return n}async fetchAndContext(t,e){const{data:n,context:i}=await this.fetchNullableAndContext(t,e);if(n===null)throw new Error(`Account does not exist ${t.toString()}`);return{data:n,context:i}}async fetchMultiple(t,e){return(await this.fetchMultipleAndContext(t,e)).map(i=>i?i.data:null)}async fetchMultipleAndContext(t,e){return(await qt(this._provider.connection,t.map(i=>W(i)),e)).map(i=>{if(i==null)return null;const{account:o,context:s}=i;return{data:this._coder.accounts.decode(this._idlAccount.name,o.data),context:s}})}async all(t){const e=this.coder.accounts.memcmp(this._idlAccount.name,t instanceof V.Buffer?t:void 0),n=[];return(e==null?void 0:e.offset)!=null&&(e==null?void 0:e.bytes)!=null&&n.push({memcmp:{offset:e.offset,bytes:e.bytes}}),(e==null?void 0:e.dataSize)!=null&&n.push({dataSize:e.dataSize}),(await this._provider.connection.getProgramAccounts(this._programId,{commitment:this._provider.connection.commitment,filters:[...n,...Array.isArray(t)?t:[]]})).map(({pubkey:o,account:s})=>({publicKey:o,account:this._coder.accounts.decode(this._idlAccount.name,s.data)}))}subscribe(t,e){const n=ke.get(t.toString());if(n)return n.ee;const i=new Ro;t=W(t);const o=this._provider.connection.onAccountChange(t,s=>{const a=this._coder.accounts.decode(this._idlAccount.name,s.data);i.emit("change",a)},e);return ke.set(t.toString(),{ee:i,listener:o}),i}async unsubscribe(t){let e=ke.get(t.toString());if(!e){console.warn("Address is not subscribed");return}ke&&await this._provider.connection.removeAccountChangeListener(e.listener).then(()=>{ke.delete(t.toString())}).catch(console.error)}async createInstruction(t,e){const n=this.size;if(this._provider.publicKey===void 0)throw new Error("This function requires the Provider interface implementor to have a 'publicKey' field.");return qn.createAccount({fromPubkey:this._provider.publicKey,newAccountPubkey:t.publicKey,space:e??n,lamports:await this._provider.connection.getMinimumBalanceForRentExemption(e??n),programId:this._programId})}async associated(...t){const e=await this.associatedAddress(...t);return await this.fetch(e)}async associatedAddress(...t){return await Gr(this._programId,...t)}async getAccountInfo(t,e){return await this._provider.connection.getAccountInfo(W(t),e)}async getAccountInfoAndContext(t,e){return await this._provider.connection.getAccountInfoAndContext(W(t),e)}}const ke=new Map,Bt="Program log: ",Zr="Program data: ",ta=Bt.length,na=Zr.length;class ra{constructor(t,e,n){this._programId=t,this._provider=e,this._eventParser=new Hr(t,n),this._eventCallbacks=new Map,this._eventListeners=new Map,this._listenerIdCount=0}addEventListener(t,e){var n;let i=this._listenerIdCount;return this._listenerIdCount+=1,this._eventListeners.has(t)||this._eventListeners.set(t,[]),this._eventListeners.set(t,((n=this._eventListeners.get(t))!==null&&n!==void 0?n:[]).concat(i)),this._eventCallbacks.set(i,[t,e]),this._onLogsSubscriptionId!==void 0||(this._onLogsSubscriptionId=this._provider.connection.onLogs(this._programId,(o,s)=>{if(!o.err)for(const a of this._eventParser.parseLogs(o.logs)){const d=this._eventListeners.get(a.name);d&&d.forEach(c=>{const u=this._eventCallbacks.get(c);if(u){const[,y]=u;y(a.data,s.slot,o.signature)}})}})),i}async removeEventListener(t){const e=this._eventCallbacks.get(t);if(!e)throw new Error(`Event listener ${t} doesn't exist!`);const[n]=e;let i=this._eventListeners.get(n);if(!i)throw new Error(`Event listeners don't exist for ${n}!`);if(this._eventCallbacks.delete(t),i=i.filter(o=>o!==t),this._eventListeners.set(n,i),i.length===0&&this._eventListeners.delete(n),this._eventCallbacks.size===0){if(this._eventListeners.size!==0)throw new Error(`Expected event listeners size to be 0 but got ${this._eventListeners.size}`);this._onLogsSubscriptionId!==void 0&&(await this._provider.connection.removeOnLogsListener(this._onLogsSubscriptionId),this._onLogsSubscriptionId=void 0)}}}class Hr{constructor(t,e){this.coder=e,this.programId=t}*parseLogs(t,e=!1){const n=new oa(t),i=new ia;let o=n.next();for(;o!==null;){let[s,a,d]=this.handleLog(i,o,e);s&&(yield s),a&&i.push(a),d&&i.pop(),o=n.next()}}handleLog(t,e,n){return t.stack.length>0&&t.program()===this.programId.toString()?this.handleProgramLog(e,n):[null,...this.handleSystemLog(e)]}handleProgramLog(t,e){if(t.startsWith(Bt)||t.startsWith(Zr)){const n=t.startsWith(Bt)?t.slice(ta):t.slice(na),i=this.coder.events.decode(n);if(e&&i===null)throw new Error(`Unable to decode event ${n}`);return[i,null,!1]}else return[null,...this.handleSystemLog(t)]}handleSystemLog(t){const e=t.split(":")[0];return e.match(/^Program (.*) success/g)!==null?[null,!0]:e.startsWith(`Program ${this.programId.toString()} invoke`)?[this.programId.toString(),!1]:e.includes("invoke")?["cpi",!1]:[null,!1]}}class ia{constructor(){this.stack=[]}program(){if(!this.stack.length)throw new Error("Expected the stack to have elements");return this.stack[this.stack.length-1]}push(t){this.stack.push(t)}pop(){if(!this.stack.length)throw new Error("Expected the stack to have elements");this.stack.pop()}}class oa{constructor(t){this.logs=t}next(){if(this.logs.length===0)return null;let t=this.logs[0];return this.logs=this.logs.slice(1),t}}class sa{static build(t,e,n,i,o,s,a){return async(...c)=>{var u;const y=e(...c),[,w]=st(t,[...c]);let f;if(i.simulate===void 0)throw new Error("This function requires 'Provider.simulate' to be implemented.");try{f=await i.simulate(y,w.signers,(u=w.options)===null||u===void 0?void 0:u.commitment)}catch(g){throw Pr(g,n)}if(f===void 0)throw new Error("Unable to simulate transaction");const p=f.logs;if(!p)throw new Error("Simulated logs not found");const A=[];if(a.events){let g=new Hr(s,o);for(const E of g.parseLogs(p))A.push(E)}return{events:A,raw:p}}}}function gt(r){return new Wr(Ue(8),t=>Wt.fromBuffer(t),t=>t.toBuffer(),r)}function ze(r){return new Wr(Ue(32),t=>new q(t),t=>t.toBuffer(),r)}function mt(r,t){return new aa(r,t)}class Wr extends rt{constructor(t,e,n,i){super(t.span,i),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}class aa extends rt{constructor(t,e){super(-1,e),this.layout=t,this.discriminator=ie()}encode(t,e,n=0){return t==null?this.layout.span+this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+4)+4)}decode(t,e=0){const n=this.discriminator.decode(t,e);if(n===0)return null;if(n===1)return this.layout.decode(t,e+4);throw new Error("Invalid coption "+this.layout.property)}getSpan(t,e=0){return this.layout.getSpan(t,e+4)+4}}class Wt extends Gn{toBuffer(){const t=super.toArray().reverse(),e=V.Buffer.from(t);if(e.length===8)return e;if(e.length>=8)throw new Error("u64 too large");const n=V.Buffer.alloc(8);return e.copy(n),n}static fromBuffer(t){if(t.length!==8)throw new Error(`Invalid buffer length: ${t.length}`);return new Wt([...t].reverse().map(e=>`00${e.toString(16)}`.slice(-2)).join(""),16)}}const ca=z([ze("mint"),ze("owner"),gt("amount"),mt(ze(),"delegate"),(r=>{const t=qr(Os("discriminator"),null,r);return t.addVariant(0,z([]),"uninitialized"),t.addVariant(1,z([]),"initialized"),t.addVariant(2,z([]),"frozen"),t})("state"),mt(gt(),"isNative"),gt("delegatedAmount"),mt(ze(),"closeAuthority")]);function ua(r){return ca.decode(r)}class Oe{constructor(t,e,n,i,o,s,a,d){this._accounts=e,this._provider=n,this._programId=i,this._idlIx=o,this._idlTypes=a,this._customResolver=d,this._args=t,this._accountStore=new la(n,s,this._programId)}args(t){this._args=t}async resolve(){for(await this.resolveConst(this._idlIx.accounts),this._resolveEventCpi(this._idlIx.accounts);await this.resolvePdas(this._idlIx.accounts)+await this.resolveRelations(this._idlIx.accounts)+await this.resolveCustom()>0;);}async resolveCustom(){if(this._customResolver){const{accounts:t,resolved:e}=await this._customResolver({args:this._args,accounts:this._accounts,provider:this._provider,programId:this._programId,idlIx:this._idlIx});return this._accounts=t,e}return 0}resolveOptionalsHelper(t,e){const n={};for(const i of e){const o=i.name,s=t[o];s!==void 0&&(Xr(s)?Gs(i)?n[o]=this.resolveOptionalsHelper(s,i.accounts):n[o]=Yr(s):s!==null?n[o]=W(s):i.isOptional&&(n[o]=this._programId))}return n}resolveOptionals(t){Object.assign(this._accounts,this.resolveOptionalsHelper(t,this._idlIx.accounts))}get(t){const e=t.reduce((n,i)=>n&&n[i],this._accounts);if(e&&e.toBase58)return e}set(t,e){let n=this._accounts;t.forEach((i,o)=>{o==t.length-1&&(n[i]=e),n[i]=n[i]||{},n=n[i]})}async resolveConst(t,e=[]){for(let n=0;n<t.length;n+=1){const i=t[n],o=i.accounts;o&&await this.resolveConst(o,[...e,j(i.name)]);const s=i,a=j(i.name);if(s.isSigner&&!this.get([...e,a])){if(this._provider.wallet===void 0)throw new Error("This function requires the Provider interface implementor to have a 'wallet' field.");this.set([...e,a],this._provider.wallet.publicKey)}Reflect.has(Oe.CONST_ACCOUNTS,a)&&!this.get([...e,a])&&this.set([...e,a],Oe.CONST_ACCOUNTS[a])}}_resolveEventCpi(t,e=[]){for(const n in t){const i=t[n],o=i.accounts;o&&this._resolveEventCpi(o,[...e,j(i.name)]);const s=+n+1;if(s===t.length)return;const a=j(t[n].name),d=j(t[s].name);if(a==="eventAuthority"&&d==="program"){const c=[...e,a],u=[...e,d];this.get(c)||this.set(c,q.findProgramAddressSync([V.Buffer.from("__event_authority")],this._programId)[0]),this.get(u)||this.set(u,this._programId);return}}}async resolvePdas(t,e=[]){let n=0;for(let i=0;i<t.length;i+=1){const o=t[i],s=o.accounts;s&&(n+=await this.resolvePdas(s,[...e,j(o.name)]));const a=o,d=j(o.name);a.pda&&a.pda.seeds.length>0&&!this.get([...e,d])&&await this.autoPopulatePda(a,e)&&(n+=1)}return n}async resolveRelations(t,e=[]){let n=0;for(let i=0;i<t.length;i+=1){const o=t[i],s=o.accounts;s&&(n+=await this.resolveRelations(s,[...e,j(o.name)]));const a=o.relations||[],d=j(o.name),c=[...e,d],u=this.get(c);if(u){const y=a.filter(w=>!this.get([...e,j(w)]));if(n+=y.length,y.length>0){const w=await this._accountStore.fetchAccount({publicKey:u});await Promise.all(y.map(async f=>{const p=j(f);return this.set([...e,p],w[p]),w[p]}))}}}return n}async autoPopulatePda(t,e=[]){if(!t.pda||!t.pda.seeds)throw new Error("Must have seeds");const n=await Promise.all(t.pda.seeds.map(s=>this.toBuffer(s,e)));if(n.some(s=>typeof s>"u"))return;const i=await this.parseProgramId(t,e);if(!i)return;const[o]=await q.findProgramAddress(n,i);this.set([...e,j(t.name)],o)}async parseProgramId(t,e=[]){var n;if(!(!((n=t.pda)===null||n===void 0)&&n.programId))return this._programId;switch(t.pda.programId.kind){case"const":return new q(this.toBufferConst(t.pda.programId.value));case"arg":return this.argValue(t.pda.programId);case"account":return await this.accountValue(t.pda.programId,e);default:throw new Error(`Unexpected program seed kind: ${t.pda.programId.kind}`)}}async toBuffer(t,e=[]){switch(t.kind){case"const":return this.toBufferConst(t);case"arg":return await this.toBufferArg(t);case"account":return await this.toBufferAccount(t,e);default:throw new Error(`Unexpected seed kind: ${t.kind}`)}}getType(t,e=[]){if(e.length>0&&t.defined){const n=this._idlTypes.find(s=>s.name===t.defined);if(!n)throw new Error(`Cannot find type ${t.defined}`);const o=n.type.fields.find(s=>s.name===e[0]);return this.getType(o.type,e.slice(1))}return t}toBufferConst(t){return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),t.value)}async toBufferArg(t){const e=this.argValue(t);if(!(typeof e>"u"))return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),e)}argValue(t){const e=t.path.split("."),n=j(e[0]),i=this._idlIx.args.findIndex(o=>o.name===n);if(i===-1)throw new Error(`Unable to find argument for seed: ${n}`);return e.slice(1).reduce((o,s)=>(o||{})[s],this._args[i])}async toBufferAccount(t,e=[]){const n=await this.accountValue(t,e);if(n)return this.toBufferValue(t.type,n)}async accountValue(t,e=[]){const n=t.path.split("."),i=n[0],o=this.get([...e,j(i)]);if(o===null)throw new Error("fieldPubkey is null");if(n.length===1)return o;const s=await this._accountStore.fetchAccount({publicKey:o,name:t.account});return this.parseAccountValue(s,n.slice(1))}parseAccountValue(t,e){let n;for(;e.length>0;)n=t[j(e[0])],e=e.slice(1);return n}toBufferValue(t,e){switch(t){case"u8":return V.Buffer.from([e]);case"u16":let n=V.Buffer.alloc(2);return n.writeUInt16LE(e),n;case"u32":let i=V.Buffer.alloc(4);return i.writeUInt32LE(e),i;case"u64":let o=V.Buffer.alloc(8);return o.writeBigUInt64LE(BigInt(e)),o;case"string":return V.Buffer.from(Ir(e));case"publicKey":return e.toBuffer();default:if(t.array)return V.Buffer.from(e);throw new Error(`Unexpected seed type: ${t}`)}}}Oe.CONST_ACCOUNTS={associatedTokenProgram:Ht,rent:ni,systemProgram:qn.programId,tokenProgram:Zt,clock:ti};class la{constructor(t,e,n){this._provider=t,this._programId=n,this._cache=new Map,this._idls={},this._idls[n.toBase58()]=e}async ensureIdl(t){if(!this._idls[t.toBase58()]){const e=await Re.fetchIdl(t,this._provider);if(e){const n=new Re(e,t,this._provider);this._idls[t.toBase58()]=n.account}}return this._idls[t.toBase58()]}async fetchAccount({publicKey:t,name:e,programId:n=this._programId}){const i=t.toString();if(!this._cache.has(i))if(e==="TokenAccount"){const o=await this._provider.connection.getAccountInfo(t);if(o===null)throw new Error(`invalid account info for ${i}`);const s=ua(o.data);this._cache.set(i,s)}else if(e){const o=await this.ensureIdl(n);if(o){const s=o[j(e)];if(s){const a=await s.fetch(t);this._cache.set(i,a)}}}else{const o=await this._provider.connection.getAccountInfo(t);if(o===null)throw new Error(`invalid account info for ${i}`);const s=o.data,a=await this.ensureIdl(o.owner);if(a){const d=Object.values(a)[0];if(!d)throw new Error("No accounts for this program");const c=d.coder.accounts.decodeAny(s);this._cache.set(i,c)}}return this._cache.get(i)}}class da{static build(t,e,n,i,o,s,a,d,c,u,y){return(...w)=>new fa(w,i,o,s,a,d,t,e,n,c,u,y)}}function Xr(r){return typeof r=="object"&&r!==null&&!("_bn"in r)}function Yr(r,t){const e={};for(const n in r){const i=r[n];if(i===null)throw new Error("Failed to resolve optionals due to IDL type mismatch with input accounts!");e[n]=Xr(i)?Yr(i):W(i)}return e}class fa{constructor(t,e,n,i,o,s,a,d,c,u,y,w){this._ixFn=e,this._txFn=n,this._rpcFn=i,this._simulateFn=o,this._viewFn=s,this._programId=d,this._accounts={},this._remainingAccounts=[],this._signers=[],this._preInstructions=[],this._postInstructions=[],this._autoResolveAccounts=!0,this._args=t,this._accountsResolver=new Oe(t,this._accounts,a,d,c,u,y,w)}args(t){this._args=t,this._accountsResolver.args(t)}async pubkeys(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._accounts}accounts(t){return this._autoResolveAccounts=!0,this._accountsResolver.resolveOptionals(t),this}accountsStrict(t){return this._autoResolveAccounts=!1,this._accountsResolver.resolveOptionals(t),this}signers(t){return this._signers=this._signers.concat(t),this}remainingAccounts(t){return this._remainingAccounts=this._remainingAccounts.concat(t),this}preInstructions(t){return this._preInstructions=this._preInstructions.concat(t),this}postInstructions(t){return this._postInstructions=this._postInstructions.concat(t),this}async rpc(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._rpcFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async rpcAndKeys(t){return{pubkeys:await this.pubkeys(),signature:await this.rpc(t)}}async view(t){if(this._autoResolveAccounts&&await this._accountsResolver.resolve(),!this._viewFn)throw new Error("Method does not support views");return this._viewFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async simulate(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._simulateFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async instruction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._ixFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}async prepare(){return{instruction:await this.instruction(),pubkeys:await this.pubkeys(),signers:await this._signers}}async transaction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._txFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}}class ha{static build(t,e,n,i){const o=e.accounts.find(d=>d.isMut),s=!!e.returns;return o||!s?void 0:async(...d)=>{var c,u;let y=await n(...d);const w=`Program return: ${t} `;let f=y.raw.find(E=>E.startsWith(w));if(!f)throw new Error("View expected return log");let p=jt(f.slice(w.length)),A=e.returns;if(!A)throw new Error("View expected return type");return K.fieldLayout({type:A},Array.from([...(c=i.accounts)!==null&&c!==void 0?c:[],...(u=i.types)!==null&&u!==void 0?u:[]])).decode(p)}}}class pa{static build(t,e,n,i,o){const s={},a={},d={},c={},u={},y={},w=Fo(t),f=t.accounts?Qs.build(t,e,n,i):{};return t.instructions.forEach(p=>{const A=Ye.build(p,(M,S)=>e.instruction.encode(M,S),n),g=Ys.build(p,A),E=Js.build(p,g,w,i),T=sa.build(p,g,w,i,e,n,t),_=ha.build(n,p,T,t),m=da.build(i,n,p,A,g,E,T,_,f,t.types||[],o&&o(p)),L=j(p.name);a[L]=A,d[L]=g,s[L]=E,c[L]=T,u[L]=m,_&&(y[L]=_)}),[s,a,d,f,c,u,y]}}class Re{get programId(){return this._programId}get idl(){return this._idl}get coder(){return this._coder}get provider(){return this._provider}constructor(t,e,n,i,o){e=W(e),n||(n=He()),this._idl=t,this._provider=n,this._programId=e,this._coder=i??new Nr(t),this._events=new ra(this._programId,n,this._coder);const[s,a,d,c,u,y,w]=pa.build(t,this._coder,e,n,o??(()=>{}));this.rpc=s,this.instruction=a,this.transaction=d,this.account=c,this.simulate=u,this.methods=y,this.views=w}static async at(t,e){const n=W(t),i=await Re.fetchIdl(n,e);if(!i)throw new Error(`IDL not found for program: ${t.toString()}`);return new Re(i,n,e)}static async fetchIdl(t,e){e=e??He();const n=W(t),i=await Ks(n),o=await e.connection.getAccountInfo(i);if(!o)return null;let s=Ws(o.data.slice(8));const a=Co(s.data);return JSON.parse(Sr(a))}addEventListener(t,e){return this._events.addEventListener(t,e)}async removeEventListener(t){return await this._events.removeEventListener(t)}}new q("11111111111111111111111111111111");export{Re as P,ya as c,R as d,Oa as i};
1
+ import{f as V,k as Jr,d0 as Qr,c as Yt,cM as ei,j as Vn,P as q,aY as vt,d1 as ve,b as G,d2 as Je,O as Fn,T as zn,cK as qn,cL as Gn,cP as ti,cO as ni}from"../main.js";function ya(r){if(r!==void 0)return{connection:r}}var R={},b={};let U=class{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}};b.Layout=U;function Pt(r,t){return t.property?r+"["+t.property+"]":r}b.nameWithProperty=Pt;function ri(r,t){if(typeof r!="function")throw new TypeError("Class must be constructor");if(r.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof U))throw new TypeError("layout must be a Layout");if(t.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=t,t.boundConstructor_=r,t.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value:function(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(r,"decode",{value:function(e,n){return t.decode(e,n)},writable:!0})}b.bindConstructorLayout=ri;let Z=class extends U{isCount(){throw new Error("ExternalLayout is abstract")}};class Kn extends Z{constructor(t,e){if(t===void 0&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e){e===void 0&&(e=0);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}let Dt=class extends Z{constructor(t,e,n){if(!(t instanceof U))throw new TypeError("layout must be a Layout");if(e===void 0)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof te||this.layout instanceof se}decode(t,e){return e===void 0&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return n===void 0&&(n=0),this.layout.encode(t,e,n+this.offset)}},te=class extends U{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return e===void 0&&(e=0),t.readUIntLE(e,this.span)}encode(t,e,n){return n===void 0&&(n=0),e.writeUIntLE(t,n,this.span),this.span}},se=class extends U{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return e===void 0&&(e=0),t.readUIntBE(e,this.span)}encode(t,e,n){return n===void 0&&(n=0),e.writeUIntBE(t,n,this.span),this.span}};class pe extends U{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return e===void 0&&(e=0),t.readIntLE(e,this.span)}encode(t,e,n){return n===void 0&&(n=0),e.writeIntLE(t,n,this.span),this.span}}class _e extends U{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return e===void 0&&(e=0),t.readIntBE(e,this.span)}encode(t,e,n){return n===void 0&&(n=0),e.writeIntBE(t,n,this.span),this.span}}const bt=Math.pow(2,32);function Qe(r){const t=Math.floor(r/bt),e=r-t*bt;return{hi32:t,lo32:e}}function et(r,t){return r*bt+t}let ii=class extends U{constructor(t){super(8,t)}decode(t,e){e===void 0&&(e=0);const n=t.readUInt32LE(e),i=t.readUInt32LE(e+4);return et(i,n)}encode(t,e,n){n===void 0&&(n=0);const i=Qe(t);return e.writeUInt32LE(i.lo32,n),e.writeUInt32LE(i.hi32,n+4),8}};class oi extends U{constructor(t){super(8,t)}decode(t,e){e===void 0&&(e=0);const n=t.readUInt32BE(e),i=t.readUInt32BE(e+4);return et(n,i)}encode(t,e,n){n===void 0&&(n=0);const i=Qe(t);return e.writeUInt32BE(i.hi32,n),e.writeUInt32BE(i.lo32,n+4),8}}let si=class extends U{constructor(t){super(8,t)}decode(t,e){e===void 0&&(e=0);const n=t.readUInt32LE(e),i=t.readInt32LE(e+4);return et(i,n)}encode(t,e,n){n===void 0&&(n=0);const i=Qe(t);return e.writeUInt32LE(i.lo32,n),e.writeInt32LE(i.hi32,n+4),8}};class ai extends U{constructor(t){super(8,t)}decode(t,e){e===void 0&&(e=0);const n=t.readInt32BE(e),i=t.readUInt32BE(e+4);return et(n,i)}encode(t,e,n){n===void 0&&(n=0);const i=Qe(t);return e.writeInt32BE(i.hi32,n),e.writeUInt32BE(i.lo32,n+4),8}}class Zn extends U{constructor(t){super(4,t)}decode(t,e){return e===void 0&&(e=0),t.readFloatLE(e)}encode(t,e,n){return n===void 0&&(n=0),e.writeFloatLE(t,n),4}}class Hn extends U{constructor(t){super(4,t)}decode(t,e){return e===void 0&&(e=0),t.readFloatBE(e)}encode(t,e,n){return n===void 0&&(n=0),e.writeFloatBE(t,n),4}}class Wn extends U{constructor(t){super(8,t)}decode(t,e){return e===void 0&&(e=0),t.readDoubleLE(e)}encode(t,e,n){return n===void 0&&(n=0),e.writeDoubleLE(t,n),8}}class Yn extends U{constructor(t){super(8,t)}decode(t,e){return e===void 0&&(e=0),t.readDoubleBE(e)}encode(t,e,n){return n===void 0&&(n=0),e.writeDoubleBE(t,n),8}}class Xn extends U{constructor(t,e,n){if(!(t instanceof U))throw new TypeError("elementLayout must be a Layout");if(!(e instanceof Z&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let i=-1;!(e instanceof Z)&&0<t.span&&(i=e*t.span),super(i,n),this.elementLayout=t,this.count=e}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0,i=this.count;if(i instanceof Z&&(i=i.decode(t,e)),0<this.elementLayout.span)n=i*this.elementLayout.span;else{let o=0;for(;o<i;)n+=this.elementLayout.getSpan(t,e+n),++o}return n}decode(t,e){e===void 0&&(e=0);const n=[];let i=0,o=this.count;for(o instanceof Z&&(o=o.decode(t,e));i<o;)n.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),i+=1;return n}encode(t,e,n){n===void 0&&(n=0);const i=this.elementLayout,o=t.reduce((s,a)=>s+i.encode(a,e,n+s),0);return this.count instanceof Z&&this.count.encode(t.length,e,n),o}}let Jn=class extends U{constructor(t,e,n){if(!(Array.isArray(t)&&t.reduce((o,s)=>o&&s instanceof U,!0)))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const o of t)if(0>o.span&&o.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=t.reduce((o,s)=>o+s.getSpan(),0)}catch{}super(i,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;try{n=this.fields.reduce((i,o)=>{const s=o.getSpan(t,e);return e+=s,i+s},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e){e===void 0&&(e=0);const n=this.makeDestinationObject();for(const i of this.fields)if(i.property!==void 0&&(n[i.property]=i.decode(t,e)),e+=i.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){n===void 0&&(n=0);const i=n;let o=0,s=0;for(const a of this.fields){let d=a.span;if(s=0<d?d:0,a.property!==void 0){const c=t[a.property];c!==void 0&&(s=a.encode(c,e,n),0>d&&(d=a.getSpan(e,n)))}o=n,n+=d}return o+s-i}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0<t.length&&(e[n.property]=t.shift());return e}layoutFor(t){if(typeof t!="string")throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}offsetOf(t){if(typeof t!="string")throw new TypeError("property must be string");let e=0;for(const n of this.fields){if(n.property===t)return e;0>n.span?e=-1:0<=e&&(e+=n.span)}}},Ut=class{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}},Ke=class extends Ut{constructor(t,e){if(!(t instanceof Z&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}},Nt=class extends U{constructor(t,e,n){const i=t instanceof te||t instanceof se;if(i)t=new Ke(new Dt(t));else if(t instanceof Z&&t.isCount())t=new Ke(t);else if(!(t instanceof Ut))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof U))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let o=-1;e&&(o=e.span,0<=o&&i&&(o+=t.layout.span)),super(o,n),this.discriminator=t,this.usesPrefixDiscriminator=i,this.defaultLayout=e,this.registry={};let s=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(a){return s(a)},this.configGetSourceVariant=function(a){s=a.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){e===void 0&&(e=0);let n;const i=this.discriminator,o=i.decode(t,e);let s=this.registry[o];if(s===void 0){let a=0;s=this.defaultLayout,this.usesPrefixDiscriminator&&(a=i.layout.span),n=this.makeDestinationObject(),n[i.property]=o,n[s.property]=this.defaultLayout.decode(t,e+a)}else n=s.decode(t,e);return n}encode(t,e,n){n===void 0&&(n=0);const i=this.getSourceVariant(t);if(i===void 0){const o=this.discriminator,s=this.defaultLayout;let a=0;return this.usesPrefixDiscriminator&&(a=o.layout.span),o.encode(t[o.property],e,n),a+s.encode(t[s.property],e,n+a)}return i.encode(t,e,n)}addVariant(t,e,n){const i=new Qn(this,t,e,n);return this.registry[t]=i,i}getVariant(t,e){let n=t;return V.Buffer.isBuffer(t)&&(e===void 0&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}},Qn=class extends U{constructor(t,e,n,i){if(!(t instanceof Nt))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&i===void 0&&(i=n,n=null),n){if(!(n instanceof U))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof i!="string")throw new TypeError("variant must have a String property")}let o=t.span;0>t.span&&(o=n?n.span:0,0<=o&&t.usesPrefixDiscriminator&&(o+=t.discriminator.layout.span)),super(o,i),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(e===void 0&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+i):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){n===void 0&&(n=0);let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let o=i;if(this.layout&&(this.layout.encode(t[this.property],e,n+i),o+=this.layout.getSpan(e,n+i),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(t){if(this.layout)return this.layout.fromArray(t)}};function ge(r){return 0>r&&(r+=4294967296),r}class Mt extends U{constructor(t,e,n){if(!(t instanceof te||t instanceof se))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof e=="string"&&n===void 0&&(n=e,e=void 0),4<t.span)throw new RangeError("word cannot exceed 32 bits");super(t.span,n),this.word=t,this.msb=!!e,this.fields=[];let i=0;this._packedSetValue=function(o){return i=ge(o),this},this._packedGetValue=function(){return i}}decode(t,e){const n=this.makeDestinationObject();e===void 0&&(e=0);const i=this.word.decode(t,e);this._packedSetValue(i);for(const o of this.fields)o.property!==void 0&&(n[o.property]=o.decode(i));return n}encode(t,e,n){n===void 0&&(n=0);const i=this.word.decode(e,n);this._packedSetValue(i);for(const o of this.fields)if(o.property!==void 0){const s=t[o.property];s!==void 0&&o.encode(s)}return this.word.encode(this._packedGetValue(),e,n)}addField(t,e){const n=new Se(this,t,e);return this.fields.push(n),n}addBoolean(t){const e=new er(this,t);return this.fields.push(e),e}fieldFor(t){if(typeof t!="string")throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}}class Se{constructor(t,e,n){if(!(t instanceof Mt))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(e)||0>=e)throw new TypeError("bits must be positive integer");const i=8*t.span,o=t.fields.reduce((s,a)=>s+a.bits,0);if(e+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=t,this.bits=e,this.valueMask=(1<<e)-1,e===32&&(this.valueMask=4294967295),this.start=o,this.container.msb&&(this.start=i-o-e),this.wordMask=ge(this.valueMask<<this.start),this.property=n}decode(){const t=this.container._packedGetValue();return ge(t&this.wordMask)>>>this.start}encode(t){if(!Number.isInteger(t)||t!==ge(t&this.valueMask))throw new TypeError(Pt("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=ge(t<<this.start);this.container._packedSetValue(ge(e&~this.wordMask)|n)}}let er=class extends Se{constructor(t,e){super(t,1,e)}decode(t,e){return!!Se.prototype.decode.call(this,t,e)}encode(t){return typeof t=="boolean"&&(t=+t),Se.prototype.encode.call(this,t)}},tr=class extends U{constructor(t,e){if(!(t instanceof Z&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;t instanceof Z||(n=t),super(n,e),this.length=t}getSpan(t,e){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}decode(t,e){e===void 0&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let i=this.length;if(this.length instanceof Z&&(i=t.length),!(V.Buffer.isBuffer(t)&&i===t.length))throw new TypeError(Pt("Blob.encode",this)+" requires (length "+i+") Buffer as src");if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,i,"hex"),this.length instanceof Z&&this.length.encode(i,e,n),i}};class nr extends U{constructor(t){super(-1,t)}getSpan(t,e){if(!V.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");e===void 0&&(e=0);let n=e;for(;n<t.length&&t[n]!==0;)n+=1;return 1+n-e}decode(t,e,n){e===void 0&&(e=0);let i=this.getSpan(t,e);return t.slice(e,e+i-1).toString("utf-8")}encode(t,e,n){n===void 0&&(n=0),typeof t!="string"&&(t=t.toString());const i=new V.Buffer(t,"utf8"),o=i.length;if(n+o>e.length)throw new RangeError("encoding overruns Buffer");return i.copy(e,n),e[n+o]=0,o+1}}class rr extends U{constructor(t,e){if(typeof t=="string"&&e===void 0&&(e=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e){if(!V.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");return e===void 0&&(e=0),t.length-e}decode(t,e,n){e===void 0&&(e=0);let i=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");return t.slice(e,e+i).toString("utf-8")}encode(t,e,n){n===void 0&&(n=0),typeof t!="string"&&(t=t.toString());const i=new V.Buffer(t,"utf8"),o=i.length;if(0<=this.maxSpan&&this.maxSpan<o)throw new RangeError("text length exceeds maxSpan");if(n+o>e.length)throw new RangeError("encoding overruns Buffer");return i.copy(e,n),o}}class ir extends U{constructor(t,e){super(0,e),this.value=t}decode(t,e,n){return this.value}encode(t,e,n){return 0}}b.ExternalLayout=Z;b.GreedyCount=Kn;b.OffsetLayout=Dt;b.UInt=te;b.UIntBE=se;b.Int=pe;b.IntBE=_e;b.Float=Zn;b.FloatBE=Hn;b.Double=Wn;b.DoubleBE=Yn;b.Sequence=Xn;b.Structure=Jn;b.UnionDiscriminator=Ut;b.UnionLayoutDiscriminator=Ke;b.Union=Nt;b.VariantLayout=Qn;b.BitStructure=Mt;b.BitField=Se;b.Boolean=er;b.Blob=tr;b.CString=nr;b.UTF8=rr;b.Constant=ir;b.greedy=(r,t)=>new Kn(r,t);b.offset=(r,t,e)=>new Dt(r,t,e);b.u8=r=>new te(1,r);b.u16=r=>new te(2,r);b.u24=r=>new te(3,r);b.u32=r=>new te(4,r);b.u40=r=>new te(5,r);b.u48=r=>new te(6,r);b.nu64=r=>new ii(r);b.u16be=r=>new se(2,r);b.u24be=r=>new se(3,r);b.u32be=r=>new se(4,r);b.u40be=r=>new se(5,r);b.u48be=r=>new se(6,r);b.nu64be=r=>new oi(r);b.s8=r=>new pe(1,r);b.s16=r=>new pe(2,r);b.s24=r=>new pe(3,r);b.s32=r=>new pe(4,r);b.s40=r=>new pe(5,r);b.s48=r=>new pe(6,r);b.ns64=r=>new si(r);b.s16be=r=>new _e(2,r);b.s24be=r=>new _e(3,r);b.s32be=r=>new _e(4,r);b.s40be=r=>new _e(5,r);b.s48be=r=>new _e(6,r);b.ns64be=r=>new ai(r);b.f32=r=>new Zn(r);b.f32be=r=>new Hn(r);b.f64=r=>new Wn(r);b.f64be=r=>new Yn(r);b.struct=(r,t,e)=>new Jn(r,t,e);b.bits=(r,t,e)=>new Mt(r,t,e);b.seq=(r,t,e)=>new Xn(r,t,e);b.union=(r,t,e)=>new Nt(r,t,e);b.unionLayoutDiscriminator=(r,t)=>new Ke(r,t);b.blob=(r,t)=>new tr(r,t);b.cstr=r=>new nr(r);b.utf8=(r,t)=>new rr(r,t);b.const=(r,t)=>new ir(r,t);const ci=Jr(Qr);(function(r){var t=Yt&&Yt.__importDefault||function(k){return k&&k.__esModule?k:{default:k}};Object.defineProperty(r,"__esModule",{value:!0}),r.map=r.array=r.rustEnum=r.str=r.vecU8=r.tagged=r.vec=r.bool=r.option=r.publicKey=r.i256=r.u256=r.i128=r.u128=r.i64=r.u64=r.struct=r.f64=r.f32=r.i32=r.u32=r.i16=r.u16=r.i8=r.u8=void 0;const e=b,n=ci,i=t(ei);var o=b;Object.defineProperty(r,"u8",{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(r,"i8",{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(r,"u16",{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(r,"i16",{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(r,"u32",{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(r,"i32",{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(r,"f32",{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(r,"f64",{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(r,"struct",{enumerable:!0,get:function(){return o.struct}});class s extends e.Layout{constructor(v,l,h){super(v,h),this.blob=(0,e.blob)(v),this.signed=l}decode(v,l=0){const h=new i.default(this.blob.decode(v,l),10,"le");return this.signed?h.fromTwos(this.span*8).clone():h}encode(v,l,h=0){return this.signed&&(v=v.toTwos(this.span*8)),this.blob.encode(v.toArrayLike(V.Buffer,"le",this.span),l,h)}}function a(k){return new s(8,!1,k)}r.u64=a;function d(k){return new s(8,!0,k)}r.i64=d;function c(k){return new s(16,!1,k)}r.u128=c;function u(k){return new s(16,!0,k)}r.i128=u;function y(k){return new s(32,!1,k)}r.u256=y;function w(k){return new s(32,!0,k)}r.i256=w;class f extends e.Layout{constructor(v,l,h,x){super(v.span,x),this.layout=v,this.decoder=l,this.encoder=h}decode(v,l){return this.decoder(this.layout.decode(v,l))}encode(v,l,h){return this.layout.encode(this.encoder(v),l,h)}getSpan(v,l){return this.layout.getSpan(v,l)}}function p(k){return new f((0,e.blob)(32),v=>new n.PublicKey(v),v=>v.toBuffer(),k)}r.publicKey=p;class A extends e.Layout{constructor(v,l){super(-1,l),this.layout=v,this.discriminator=(0,e.u8)()}encode(v,l,h=0){return v==null?this.discriminator.encode(0,l,h):(this.discriminator.encode(1,l,h),this.layout.encode(v,l,h+1)+1)}decode(v,l=0){const h=this.discriminator.decode(v,l);if(h===0)return null;if(h===1)return this.layout.decode(v,l+1);throw new Error("Invalid option "+this.property)}getSpan(v,l=0){const h=this.discriminator.decode(v,l);if(h===0)return 1;if(h===1)return this.layout.getSpan(v,l+1)+1;throw new Error("Invalid option "+this.property)}}function g(k,v){return new A(k,v)}r.option=g;function E(k){return new f((0,e.u8)(),T,_,k)}r.bool=E;function T(k){if(k===0)return!1;if(k===1)return!0;throw new Error("Invalid bool: "+k)}function _(k){return k?1:0}function m(k,v){const l=(0,e.u32)("length"),h=(0,e.struct)([l,(0,e.seq)(k,(0,e.offset)(l,-l.span),"values")]);return new f(h,({values:x})=>x,x=>({values:x}),v)}r.vec=m;function L(k,v,l){const h=(0,e.struct)([a("tag"),v.replicate("data")]);function x({tag:D,data:F}){if(!D.eq(k))throw new Error("Invalid tag, expected: "+k.toString("hex")+", got: "+D.toString("hex"));return F}return new f(h,x,D=>({tag:k,data:D}),l)}r.tagged=L;function M(k){const v=(0,e.u32)("length"),l=(0,e.struct)([v,(0,e.blob)((0,e.offset)(v,-v.span),"data")]);return new f(l,({data:h})=>h,h=>({data:h}),k)}r.vecU8=M;function S(k){return new f(M(),v=>v.toString("utf-8"),v=>V.Buffer.from(v,"utf-8"),k)}r.str=S;function P(k,v,l){const h=(0,e.union)(l??(0,e.u8)(),v);return k.forEach((x,D)=>h.addVariant(D,x,x.property)),h}r.rustEnum=P;function B(k,v,l){const h=(0,e.struct)([(0,e.seq)(k,v,"values")]);return new f(h,({values:x})=>x,x=>({values:x}),l)}r.array=B;class O extends e.Layout{constructor(v,l,h){super(v.span+l.span,h),this.keyLayout=v,this.valueLayout=l}decode(v,l){l=l||0;const h=this.keyLayout.decode(v,l),x=this.valueLayout.decode(v,l+this.keyLayout.getSpan(v,l));return[h,x]}encode(v,l,h){h=h||0;const x=this.keyLayout.encode(v[0],l,h),D=this.valueLayout.encode(v[1],l,h+x);return x+D}getSpan(v,l){return this.keyLayout.getSpan(v,l)+this.valueLayout.getSpan(v,l)}}function C(k,v,l){const h=(0,e.u32)("length"),x=(0,e.struct)([h,(0,e.seq)(new O(k,v),(0,e.offset)(h,-h.span),"values")]);return new f(x,({values:D})=>new Map(D),D=>({values:Array.from(D.entries())}),l)}r.map=C})(R);var $t={exports:{}};const ui=/[\p{Lu}]/u,li=/[\p{Ll}]/u,Xt=/^[\p{Lu}](?![\p{Lu}])/gu,or=/([\p{Alpha}\p{N}_]|$)/u,sr=/[_.\- ]+/,di=new RegExp("^"+sr.source),Jt=new RegExp(sr.source+or.source,"gu"),Qt=new RegExp("\\d+"+or.source,"gu"),fi=(r,t,e)=>{let n=!1,i=!1,o=!1;for(let s=0;s<r.length;s++){const a=r[s];n&&ui.test(a)?(r=r.slice(0,s)+"-"+r.slice(s),n=!1,o=i,i=!0,s++):i&&o&&li.test(a)?(r=r.slice(0,s-1)+"-"+r.slice(s-1),o=i,i=!1,n=!0):(n=t(a)===a&&e(a)!==a,o=i,i=e(a)===a&&t(a)!==a)}return r},hi=(r,t)=>(Xt.lastIndex=0,r.replace(Xt,e=>t(e))),pi=(r,t)=>(Jt.lastIndex=0,Qt.lastIndex=0,r.replace(Jt,(e,n)=>t(n)).replace(Qt,e=>t(e))),ar=(r,t)=>{if(!(typeof r=="string"||Array.isArray(r)))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},Array.isArray(r)?r=r.map(o=>o.trim()).filter(o=>o.length).join("-"):r=r.trim(),r.length===0)return"";const e=t.locale===!1?o=>o.toLowerCase():o=>o.toLocaleLowerCase(t.locale),n=t.locale===!1?o=>o.toUpperCase():o=>o.toLocaleUpperCase(t.locale);return r.length===1?t.pascalCase?n(r):e(r):(r!==e(r)&&(r=fi(r,e,n)),r=r.replace(di,""),t.preserveConsecutiveUppercase?r=hi(r,e):r=e(r),t.pascalCase&&(r=n(r.charAt(0))+r.slice(1)),pi(r,n))};$t.exports=ar;$t.exports.default=ar;var wi=$t.exports;const j=Vn(wi);function Ee(r){let t=r.length;for(;--t>=0;)r[t]=0}const yi=3,gi=258,cr=29,mi=256,vi=mi+1+cr,ur=30,bi=512,_i=new Array((vi+2)*2);Ee(_i);const Ei=new Array(ur*2);Ee(Ei);const Ai=new Array(bi);Ee(Ai);const xi=new Array(gi-yi+1);Ee(xi);const ki=new Array(cr);Ee(ki);const Si=new Array(ur);Ee(Si);const Ii=(r,t,e,n)=>{let i=r&65535|0,o=r>>>16&65535|0,s=0;for(;e!==0;){s=e>2e3?2e3:e,e-=s;do i=i+t[n++]|0,o=o+i|0;while(--s);i%=65521,o%=65521}return i|o<<16|0};var _t=Ii;const Li=()=>{let r,t=[];for(var e=0;e<256;e++){r=e;for(var n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;t[e]=r}return t},Ti=new Uint32Array(Li()),Ci=(r,t,e,n)=>{const i=Ti,o=n+e;r^=-1;for(let s=n;s<o;s++)r=r>>>8^i[(r^t[s])&255];return r^-1};var Q=Ci,Et={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},lr={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const Oi=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);var Ri=function(r){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const n in e)Oi(e,n)&&(r[n]=e[n])}}return r},Bi=r=>{let t=0;for(let n=0,i=r.length;n<i;n++)t+=r[n].length;const e=new Uint8Array(t);for(let n=0,i=0,o=r.length;n<o;n++){let s=r[n];e.set(s,i),i+=s.length}return e},dr={assign:Ri,flattenChunks:Bi};let fr=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{fr=!1}const Te=new Uint8Array(256);for(let r=0;r<256;r++)Te[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;Te[254]=Te[254]=1;var Pi=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let t,e,n,i,o,s=r.length,a=0;for(i=0;i<s;i++)e=r.charCodeAt(i),(e&64512)===55296&&i+1<s&&(n=r.charCodeAt(i+1),(n&64512)===56320&&(e=65536+(e-55296<<10)+(n-56320),i++)),a+=e<128?1:e<2048?2:e<65536?3:4;for(t=new Uint8Array(a),o=0,i=0;o<a;i++)e=r.charCodeAt(i),(e&64512)===55296&&i+1<s&&(n=r.charCodeAt(i+1),(n&64512)===56320&&(e=65536+(e-55296<<10)+(n-56320),i++)),e<128?t[o++]=e:e<2048?(t[o++]=192|e>>>6,t[o++]=128|e&63):e<65536?(t[o++]=224|e>>>12,t[o++]=128|e>>>6&63,t[o++]=128|e&63):(t[o++]=240|e>>>18,t[o++]=128|e>>>12&63,t[o++]=128|e>>>6&63,t[o++]=128|e&63);return t};const Di=(r,t)=>{if(t<65534&&r.subarray&&fr)return String.fromCharCode.apply(null,r.length===t?r:r.subarray(0,t));let e="";for(let n=0;n<t;n++)e+=String.fromCharCode(r[n]);return e};var Ui=(r,t)=>{const e=t||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,t));let n,i;const o=new Array(e*2);for(i=0,n=0;n<e;){let s=r[n++];if(s<128){o[i++]=s;continue}let a=Te[s];if(a>4){o[i++]=65533,n+=a-1;continue}for(s&=a===2?31:a===3?15:7;a>1&&n<e;)s=s<<6|r[n++]&63,a--;if(a>1){o[i++]=65533;continue}s<65536?o[i++]=s:(s-=65536,o[i++]=55296|s>>10&1023,o[i++]=56320|s&1023)}return Di(o,i)},Ni=(r,t)=>{t=t||r.length,t>r.length&&(t=r.length);let e=t-1;for(;e>=0&&(r[e]&192)===128;)e--;return e<0||e===0?t:e+Te[r[e]]>t?e:t},At={string2buf:Pi,buf2string:Ui,utf8border:Ni};function Mi(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var $i=Mi;const Me=16209,ji=16191;var Vi=function(t,e){let n,i,o,s,a,d,c,u,y,w,f,p,A,g,E,T,_,m,L,M,S,P,B,O;const C=t.state;n=t.next_in,B=t.input,i=n+(t.avail_in-5),o=t.next_out,O=t.output,s=o-(e-t.avail_out),a=o+(t.avail_out-257),d=C.dmax,c=C.wsize,u=C.whave,y=C.wnext,w=C.window,f=C.hold,p=C.bits,A=C.lencode,g=C.distcode,E=(1<<C.lenbits)-1,T=(1<<C.distbits)-1;e:do{p<15&&(f+=B[n++]<<p,p+=8,f+=B[n++]<<p,p+=8),_=A[f&E];t:for(;;){if(m=_>>>24,f>>>=m,p-=m,m=_>>>16&255,m===0)O[o++]=_&65535;else if(m&16){L=_&65535,m&=15,m&&(p<m&&(f+=B[n++]<<p,p+=8),L+=f&(1<<m)-1,f>>>=m,p-=m),p<15&&(f+=B[n++]<<p,p+=8,f+=B[n++]<<p,p+=8),_=g[f&T];n:for(;;){if(m=_>>>24,f>>>=m,p-=m,m=_>>>16&255,m&16){if(M=_&65535,m&=15,p<m&&(f+=B[n++]<<p,p+=8,p<m&&(f+=B[n++]<<p,p+=8)),M+=f&(1<<m)-1,M>d){t.msg="invalid distance too far back",C.mode=Me;break e}if(f>>>=m,p-=m,m=o-s,M>m){if(m=M-m,m>u&&C.sane){t.msg="invalid distance too far back",C.mode=Me;break e}if(S=0,P=w,y===0){if(S+=c-m,m<L){L-=m;do O[o++]=w[S++];while(--m);S=o-M,P=O}}else if(y<m){if(S+=c+y-m,m-=y,m<L){L-=m;do O[o++]=w[S++];while(--m);if(S=0,y<L){m=y,L-=m;do O[o++]=w[S++];while(--m);S=o-M,P=O}}}else if(S+=y-m,m<L){L-=m;do O[o++]=w[S++];while(--m);S=o-M,P=O}for(;L>2;)O[o++]=P[S++],O[o++]=P[S++],O[o++]=P[S++],L-=3;L&&(O[o++]=P[S++],L>1&&(O[o++]=P[S++]))}else{S=o-M;do O[o++]=O[S++],O[o++]=O[S++],O[o++]=O[S++],L-=3;while(L>2);L&&(O[o++]=O[S++],L>1&&(O[o++]=O[S++]))}}else if(m&64){t.msg="invalid distance code",C.mode=Me;break e}else{_=g[(_&65535)+(f&(1<<m)-1)];continue n}break}}else if(m&64)if(m&32){C.mode=ji;break e}else{t.msg="invalid literal/length code",C.mode=Me;break e}else{_=A[(_&65535)+(f&(1<<m)-1)];continue t}break}}while(n<i&&o<a);L=p>>3,n-=L,p-=L<<3,f&=(1<<p)-1,t.next_in=n,t.next_out=o,t.avail_in=n<i?5+(i-n):5-(n-i),t.avail_out=o<a?257+(a-o):257-(o-a),C.hold=f,C.bits=p};const ye=15,en=852,tn=592,nn=0,ct=1,rn=2,Fi=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),zi=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),qi=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Gi=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),Ki=(r,t,e,n,i,o,s,a)=>{const d=a.bits;let c=0,u=0,y=0,w=0,f=0,p=0,A=0,g=0,E=0,T=0,_,m,L,M,S,P=null,B;const O=new Uint16Array(ye+1),C=new Uint16Array(ye+1);let k=null,v,l,h;for(c=0;c<=ye;c++)O[c]=0;for(u=0;u<n;u++)O[t[e+u]]++;for(f=d,w=ye;w>=1&&O[w]===0;w--);if(f>w&&(f=w),w===0)return i[o++]=1<<24|64<<16|0,i[o++]=1<<24|64<<16|0,a.bits=1,0;for(y=1;y<w&&O[y]===0;y++);for(f<y&&(f=y),g=1,c=1;c<=ye;c++)if(g<<=1,g-=O[c],g<0)return-1;if(g>0&&(r===nn||w!==1))return-1;for(C[1]=0,c=1;c<ye;c++)C[c+1]=C[c]+O[c];for(u=0;u<n;u++)t[e+u]!==0&&(s[C[t[e+u]]++]=u);if(r===nn?(P=k=s,B=20):r===ct?(P=Fi,k=zi,B=257):(P=qi,k=Gi,B=0),T=0,u=0,c=y,S=o,p=f,A=0,L=-1,E=1<<f,M=E-1,r===ct&&E>en||r===rn&&E>tn)return 1;for(;;){v=c-A,s[u]+1<B?(l=0,h=s[u]):s[u]>=B?(l=k[s[u]-B],h=P[s[u]-B]):(l=96,h=0),_=1<<c-A,m=1<<p,y=m;do m-=_,i[S+(T>>A)+m]=v<<24|l<<16|h|0;while(m!==0);for(_=1<<c-1;T&_;)_>>=1;if(_!==0?(T&=_-1,T+=_):T=0,u++,--O[c]===0){if(c===w)break;c=t[e+s[u]]}if(c>f&&(T&M)!==L){for(A===0&&(A=f),S+=y,p=c-A,g=1<<p;p+A<w&&(g-=O[p+A],!(g<=0));)p++,g<<=1;if(E+=1<<p,r===ct&&E>en||r===rn&&E>tn)return 1;L=T&M,i[L]=f<<24|p<<16|S-o|0}}return T!==0&&(i[S+T]=c-A<<24|64<<16|0),a.bits=f,0};var Ie=Ki;const Zi=0,hr=1,pr=2,{Z_FINISH:on,Z_BLOCK:Hi,Z_TREES:$e,Z_OK:he,Z_STREAM_END:Wi,Z_NEED_DICT:Yi,Z_STREAM_ERROR:X,Z_DATA_ERROR:wr,Z_MEM_ERROR:yr,Z_BUF_ERROR:Xi,Z_DEFLATED:sn}=lr,tt=16180,an=16181,cn=16182,un=16183,ln=16184,dn=16185,fn=16186,hn=16187,pn=16188,wn=16189,Ze=16190,ne=16191,ut=16192,yn=16193,lt=16194,gn=16195,mn=16196,vn=16197,bn=16198,je=16199,Ve=16200,_n=16201,En=16202,An=16203,xn=16204,kn=16205,dt=16206,Sn=16207,In=16208,$=16209,gr=16210,mr=16211,Ji=852,Qi=592,eo=15,to=eo,Ln=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function no(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const we=r=>{if(!r)return 1;const t=r.state;return!t||t.strm!==r||t.mode<tt||t.mode>mr?1:0},vr=r=>{if(we(r))return X;const t=r.state;return r.total_in=r.total_out=t.total=0,r.msg="",t.wrap&&(r.adler=t.wrap&1),t.mode=tt,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(Ji),t.distcode=t.distdyn=new Int32Array(Qi),t.sane=1,t.back=-1,he},br=r=>{if(we(r))return X;const t=r.state;return t.wsize=0,t.whave=0,t.wnext=0,vr(r)},_r=(r,t)=>{let e;if(we(r))return X;const n=r.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?X:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,br(r))},Er=(r,t)=>{if(!r)return X;const e=new no;r.state=e,e.strm=r,e.window=null,e.mode=tt;const n=_r(r,t);return n!==he&&(r.state=null),n},ro=r=>Er(r,to);let Tn=!0,ft,ht;const io=r=>{if(Tn){ft=new Int32Array(512),ht=new Int32Array(32);let t=0;for(;t<144;)r.lens[t++]=8;for(;t<256;)r.lens[t++]=9;for(;t<280;)r.lens[t++]=7;for(;t<288;)r.lens[t++]=8;for(Ie(hr,r.lens,0,288,ft,0,r.work,{bits:9}),t=0;t<32;)r.lens[t++]=5;Ie(pr,r.lens,0,32,ht,0,r.work,{bits:5}),Tn=!1}r.lencode=ft,r.lenbits=9,r.distcode=ht,r.distbits=5},Ar=(r,t,e,n)=>{let i;const o=r.state;return o.window===null&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),n>=o.wsize?(o.window.set(t.subarray(e-o.wsize,e),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),o.window.set(t.subarray(e-n,e-n+i),o.wnext),n-=i,n?(o.window.set(t.subarray(e-n,e),0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0},oo=(r,t)=>{let e,n,i,o,s,a,d,c,u,y,w,f,p,A,g=0,E,T,_,m,L,M,S,P;const B=new Uint8Array(4);let O,C;const k=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(we(r)||!r.output||!r.input&&r.avail_in!==0)return X;e=r.state,e.mode===ne&&(e.mode=ut),s=r.next_out,i=r.output,d=r.avail_out,o=r.next_in,n=r.input,a=r.avail_in,c=e.hold,u=e.bits,y=a,w=d,P=he;e:for(;;)switch(e.mode){case tt:if(e.wrap===0){e.mode=ut;break}for(;u<16;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if(e.wrap&2&&c===35615){e.wbits===0&&(e.wbits=15),e.check=0,B[0]=c&255,B[1]=c>>>8&255,e.check=Q(e.check,B,2,0),c=0,u=0,e.mode=an;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((c&255)<<8)+(c>>8))%31){r.msg="incorrect header check",e.mode=$;break}if((c&15)!==sn){r.msg="unknown compression method",e.mode=$;break}if(c>>>=4,u-=4,S=(c&15)+8,e.wbits===0&&(e.wbits=S),S>15||S>e.wbits){r.msg="invalid window size",e.mode=$;break}e.dmax=1<<e.wbits,e.flags=0,r.adler=e.check=1,e.mode=c&512?wn:ne,c=0,u=0;break;case an:for(;u<16;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if(e.flags=c,(e.flags&255)!==sn){r.msg="unknown compression method",e.mode=$;break}if(e.flags&57344){r.msg="unknown header flags set",e.mode=$;break}e.head&&(e.head.text=c>>8&1),e.flags&512&&e.wrap&4&&(B[0]=c&255,B[1]=c>>>8&255,e.check=Q(e.check,B,2,0)),c=0,u=0,e.mode=cn;case cn:for(;u<32;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}e.head&&(e.head.time=c),e.flags&512&&e.wrap&4&&(B[0]=c&255,B[1]=c>>>8&255,B[2]=c>>>16&255,B[3]=c>>>24&255,e.check=Q(e.check,B,4,0)),c=0,u=0,e.mode=un;case un:for(;u<16;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}e.head&&(e.head.xflags=c&255,e.head.os=c>>8),e.flags&512&&e.wrap&4&&(B[0]=c&255,B[1]=c>>>8&255,e.check=Q(e.check,B,2,0)),c=0,u=0,e.mode=ln;case ln:if(e.flags&1024){for(;u<16;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}e.length=c,e.head&&(e.head.extra_len=c),e.flags&512&&e.wrap&4&&(B[0]=c&255,B[1]=c>>>8&255,e.check=Q(e.check,B,2,0)),c=0,u=0}else e.head&&(e.head.extra=null);e.mode=dn;case dn:if(e.flags&1024&&(f=e.length,f>a&&(f=a),f&&(e.head&&(S=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(n.subarray(o,o+f),S)),e.flags&512&&e.wrap&4&&(e.check=Q(e.check,n,f,o)),a-=f,o+=f,e.length-=f),e.length))break e;e.length=0,e.mode=fn;case fn:if(e.flags&2048){if(a===0)break e;f=0;do S=n[o+f++],e.head&&S&&e.length<65536&&(e.head.name+=String.fromCharCode(S));while(S&&f<a);if(e.flags&512&&e.wrap&4&&(e.check=Q(e.check,n,f,o)),a-=f,o+=f,S)break e}else e.head&&(e.head.name=null);e.length=0,e.mode=hn;case hn:if(e.flags&4096){if(a===0)break e;f=0;do S=n[o+f++],e.head&&S&&e.length<65536&&(e.head.comment+=String.fromCharCode(S));while(S&&f<a);if(e.flags&512&&e.wrap&4&&(e.check=Q(e.check,n,f,o)),a-=f,o+=f,S)break e}else e.head&&(e.head.comment=null);e.mode=pn;case pn:if(e.flags&512){for(;u<16;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if(e.wrap&4&&c!==(e.check&65535)){r.msg="header crc mismatch",e.mode=$;break}c=0,u=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),r.adler=e.check=0,e.mode=ne;break;case wn:for(;u<32;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}r.adler=e.check=Ln(c),c=0,u=0,e.mode=Ze;case Ze:if(e.havedict===0)return r.next_out=s,r.avail_out=d,r.next_in=o,r.avail_in=a,e.hold=c,e.bits=u,Yi;r.adler=e.check=1,e.mode=ne;case ne:if(t===Hi||t===$e)break e;case ut:if(e.last){c>>>=u&7,u-=u&7,e.mode=dt;break}for(;u<3;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}switch(e.last=c&1,c>>>=1,u-=1,c&3){case 0:e.mode=yn;break;case 1:if(io(e),e.mode=je,t===$e){c>>>=2,u-=2;break e}break;case 2:e.mode=mn;break;case 3:r.msg="invalid block type",e.mode=$}c>>>=2,u-=2;break;case yn:for(c>>>=u&7,u-=u&7;u<32;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){r.msg="invalid stored block lengths",e.mode=$;break}if(e.length=c&65535,c=0,u=0,e.mode=lt,t===$e)break e;case lt:e.mode=gn;case gn:if(f=e.length,f){if(f>a&&(f=a),f>d&&(f=d),f===0)break e;i.set(n.subarray(o,o+f),s),a-=f,o+=f,d-=f,s+=f,e.length-=f;break}e.mode=ne;break;case mn:for(;u<14;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if(e.nlen=(c&31)+257,c>>>=5,u-=5,e.ndist=(c&31)+1,c>>>=5,u-=5,e.ncode=(c&15)+4,c>>>=4,u-=4,e.nlen>286||e.ndist>30){r.msg="too many length or distance symbols",e.mode=$;break}e.have=0,e.mode=vn;case vn:for(;e.have<e.ncode;){for(;u<3;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}e.lens[k[e.have++]]=c&7,c>>>=3,u-=3}for(;e.have<19;)e.lens[k[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,O={bits:e.lenbits},P=Ie(Zi,e.lens,0,19,e.lencode,0,e.work,O),e.lenbits=O.bits,P){r.msg="invalid code lengths set",e.mode=$;break}e.have=0,e.mode=bn;case bn:for(;e.have<e.nlen+e.ndist;){for(;g=e.lencode[c&(1<<e.lenbits)-1],E=g>>>24,T=g>>>16&255,_=g&65535,!(E<=u);){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if(_<16)c>>>=E,u-=E,e.lens[e.have++]=_;else{if(_===16){for(C=E+2;u<C;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if(c>>>=E,u-=E,e.have===0){r.msg="invalid bit length repeat",e.mode=$;break}S=e.lens[e.have-1],f=3+(c&3),c>>>=2,u-=2}else if(_===17){for(C=E+3;u<C;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}c>>>=E,u-=E,S=0,f=3+(c&7),c>>>=3,u-=3}else{for(C=E+7;u<C;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}c>>>=E,u-=E,S=0,f=11+(c&127),c>>>=7,u-=7}if(e.have+f>e.nlen+e.ndist){r.msg="invalid bit length repeat",e.mode=$;break}for(;f--;)e.lens[e.have++]=S}}if(e.mode===$)break;if(e.lens[256]===0){r.msg="invalid code -- missing end-of-block",e.mode=$;break}if(e.lenbits=9,O={bits:e.lenbits},P=Ie(hr,e.lens,0,e.nlen,e.lencode,0,e.work,O),e.lenbits=O.bits,P){r.msg="invalid literal/lengths set",e.mode=$;break}if(e.distbits=6,e.distcode=e.distdyn,O={bits:e.distbits},P=Ie(pr,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,O),e.distbits=O.bits,P){r.msg="invalid distances set",e.mode=$;break}if(e.mode=je,t===$e)break e;case je:e.mode=Ve;case Ve:if(a>=6&&d>=258){r.next_out=s,r.avail_out=d,r.next_in=o,r.avail_in=a,e.hold=c,e.bits=u,Vi(r,w),s=r.next_out,i=r.output,d=r.avail_out,o=r.next_in,n=r.input,a=r.avail_in,c=e.hold,u=e.bits,e.mode===ne&&(e.back=-1);break}for(e.back=0;g=e.lencode[c&(1<<e.lenbits)-1],E=g>>>24,T=g>>>16&255,_=g&65535,!(E<=u);){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if(T&&!(T&240)){for(m=E,L=T,M=_;g=e.lencode[M+((c&(1<<m+L)-1)>>m)],E=g>>>24,T=g>>>16&255,_=g&65535,!(m+E<=u);){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}c>>>=m,u-=m,e.back+=m}if(c>>>=E,u-=E,e.back+=E,e.length=_,T===0){e.mode=kn;break}if(T&32){e.back=-1,e.mode=ne;break}if(T&64){r.msg="invalid literal/length code",e.mode=$;break}e.extra=T&15,e.mode=_n;case _n:if(e.extra){for(C=e.extra;u<C;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}e.length+=c&(1<<e.extra)-1,c>>>=e.extra,u-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=En;case En:for(;g=e.distcode[c&(1<<e.distbits)-1],E=g>>>24,T=g>>>16&255,_=g&65535,!(E<=u);){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if(!(T&240)){for(m=E,L=T,M=_;g=e.distcode[M+((c&(1<<m+L)-1)>>m)],E=g>>>24,T=g>>>16&255,_=g&65535,!(m+E<=u);){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}c>>>=m,u-=m,e.back+=m}if(c>>>=E,u-=E,e.back+=E,T&64){r.msg="invalid distance code",e.mode=$;break}e.offset=_,e.extra=T&15,e.mode=An;case An:if(e.extra){for(C=e.extra;u<C;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}e.offset+=c&(1<<e.extra)-1,c>>>=e.extra,u-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){r.msg="invalid distance too far back",e.mode=$;break}e.mode=xn;case xn:if(d===0)break e;if(f=w-d,e.offset>f){if(f=e.offset-f,f>e.whave&&e.sane){r.msg="invalid distance too far back",e.mode=$;break}f>e.wnext?(f-=e.wnext,p=e.wsize-f):p=e.wnext-f,f>e.length&&(f=e.length),A=e.window}else A=i,p=s-e.offset,f=e.length;f>d&&(f=d),d-=f,e.length-=f;do i[s++]=A[p++];while(--f);e.length===0&&(e.mode=Ve);break;case kn:if(d===0)break e;i[s++]=e.length,d--,e.mode=Ve;break;case dt:if(e.wrap){for(;u<32;){if(a===0)break e;a--,c|=n[o++]<<u,u+=8}if(w-=d,r.total_out+=w,e.total+=w,e.wrap&4&&w&&(r.adler=e.check=e.flags?Q(e.check,i,w,s-w):_t(e.check,i,w,s-w)),w=d,e.wrap&4&&(e.flags?c:Ln(c))!==e.check){r.msg="incorrect data check",e.mode=$;break}c=0,u=0}e.mode=Sn;case Sn:if(e.wrap&&e.flags){for(;u<32;){if(a===0)break e;a--,c+=n[o++]<<u,u+=8}if(e.wrap&4&&c!==(e.total&4294967295)){r.msg="incorrect length check",e.mode=$;break}c=0,u=0}e.mode=In;case In:P=Wi;break e;case $:P=wr;break e;case gr:return yr;case mr:default:return X}return r.next_out=s,r.avail_out=d,r.next_in=o,r.avail_in=a,e.hold=c,e.bits=u,(e.wsize||w!==r.avail_out&&e.mode<$&&(e.mode<dt||t!==on))&&Ar(r,r.output,r.next_out,w-r.avail_out),y-=r.avail_in,w-=r.avail_out,r.total_in+=y,r.total_out+=w,e.total+=w,e.wrap&4&&w&&(r.adler=e.check=e.flags?Q(e.check,i,w,r.next_out-w):_t(e.check,i,w,r.next_out-w)),r.data_type=e.bits+(e.last?64:0)+(e.mode===ne?128:0)+(e.mode===je||e.mode===lt?256:0),(y===0&&w===0||t===on)&&P===he&&(P=Xi),P},so=r=>{if(we(r))return X;let t=r.state;return t.window&&(t.window=null),r.state=null,he},ao=(r,t)=>{if(we(r))return X;const e=r.state;return e.wrap&2?(e.head=t,t.done=!1,he):X},co=(r,t)=>{const e=t.length;let n,i,o;return we(r)||(n=r.state,n.wrap!==0&&n.mode!==Ze)?X:n.mode===Ze&&(i=1,i=_t(i,t,e,0),i!==n.check)?wr:(o=Ar(r,t,e,e),o?(n.mode=gr,yr):(n.havedict=1,he))};var uo=br,lo=_r,fo=vr,ho=ro,po=Er,wo=oo,yo=so,go=ao,mo=co,vo="pako inflate (from Nodeca project)",re={inflateReset:uo,inflateReset2:lo,inflateResetKeep:fo,inflateInit:ho,inflateInit2:po,inflate:wo,inflateEnd:yo,inflateGetHeader:go,inflateSetDictionary:mo,inflateInfo:vo};function bo(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var _o=bo;const xr=Object.prototype.toString,{Z_NO_FLUSH:Eo,Z_FINISH:Ao,Z_OK:Ce,Z_STREAM_END:pt,Z_NEED_DICT:wt,Z_STREAM_ERROR:xo,Z_DATA_ERROR:Cn,Z_MEM_ERROR:ko}=lr;function nt(r){this.options=dr.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(r&&r.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new $i,this.strm.avail_out=0;let e=re.inflateInit2(this.strm,t.windowBits);if(e!==Ce)throw new Error(Et[e]);if(this.header=new _o,re.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=At.string2buf(t.dictionary):xr.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=re.inflateSetDictionary(this.strm,t.dictionary),e!==Ce)))throw new Error(Et[e])}nt.prototype.push=function(r,t){const e=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let o,s,a;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?Ao:Eo,xr.call(r)==="[object ArrayBuffer]"?e.input=new Uint8Array(r):e.input=r,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),o=re.inflate(e,s),o===wt&&i&&(o=re.inflateSetDictionary(e,i),o===Ce?o=re.inflate(e,s):o===Cn&&(o=wt));e.avail_in>0&&o===pt&&e.state.wrap>0&&r[e.next_in]!==0;)re.inflateReset(e),o=re.inflate(e,s);switch(o){case xo:case Cn:case wt:case ko:return this.onEnd(o),this.ended=!0,!1}if(a=e.avail_out,e.next_out&&(e.avail_out===0||o===pt))if(this.options.to==="string"){let d=At.utf8border(e.output,e.next_out),c=e.next_out-d,u=At.buf2string(e.output,d);e.next_out=c,e.avail_out=n-c,c&&e.output.set(e.output.subarray(d,d+c),0),this.onData(u)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(!(o===Ce&&a===0)){if(o===pt)return o=re.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(e.avail_in===0)break}}return!0};nt.prototype.onData=function(r){this.chunks.push(r)};nt.prototype.onEnd=function(r){r===Ce&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=dr.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function So(r,t){const e=new nt(t);if(e.push(r),e.err)throw e.msg||Et[e.err];return e.result}var Io=So,Lo={inflate:Io};const{inflate:To}=Lo;var Co=To,kr={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(e=!1));function i(d,c,u){this.fn=d,this.context=c,this.once=u||!1}function o(d,c,u,y,w){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new i(u,y||d,w),p=e?e+c:c;return d._events[p]?d._events[p].fn?d._events[p]=[d._events[p],f]:d._events[p].push(f):(d._events[p]=f,d._eventsCount++),d}function s(d,c){--d._eventsCount===0?d._events=new n:delete d._events[c]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],u,y;if(this._eventsCount===0)return c;for(y in u=this._events)t.call(u,y)&&c.push(e?y.slice(1):y);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},a.prototype.listeners=function(c){var u=e?e+c:c,y=this._events[u];if(!y)return[];if(y.fn)return[y.fn];for(var w=0,f=y.length,p=new Array(f);w<f;w++)p[w]=y[w].fn;return p},a.prototype.listenerCount=function(c){var u=e?e+c:c,y=this._events[u];return y?y.fn?1:y.length:0},a.prototype.emit=function(c,u,y,w,f,p){var A=e?e+c:c;if(!this._events[A])return!1;var g=this._events[A],E=arguments.length,T,_;if(g.fn){switch(g.once&&this.removeListener(c,g.fn,void 0,!0),E){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,u),!0;case 3:return g.fn.call(g.context,u,y),!0;case 4:return g.fn.call(g.context,u,y,w),!0;case 5:return g.fn.call(g.context,u,y,w,f),!0;case 6:return g.fn.call(g.context,u,y,w,f,p),!0}for(_=1,T=new Array(E-1);_<E;_++)T[_-1]=arguments[_];g.fn.apply(g.context,T)}else{var m=g.length,L;for(_=0;_<m;_++)switch(g[_].once&&this.removeListener(c,g[_].fn,void 0,!0),E){case 1:g[_].fn.call(g[_].context);break;case 2:g[_].fn.call(g[_].context,u);break;case 3:g[_].fn.call(g[_].context,u,y);break;case 4:g[_].fn.call(g[_].context,u,y,w);break;default:if(!T)for(L=1,T=new Array(E-1);L<E;L++)T[L-1]=arguments[L];g[_].fn.apply(g[_].context,T)}}return!0},a.prototype.on=function(c,u,y){return o(this,c,u,y,!1)},a.prototype.once=function(c,u,y){return o(this,c,u,y,!0)},a.prototype.removeListener=function(c,u,y,w){var f=e?e+c:c;if(!this._events[f])return this;if(!u)return s(this,f),this;var p=this._events[f];if(p.fn)p.fn===u&&(!w||p.once)&&(!y||p.context===y)&&s(this,f);else{for(var A=0,g=[],E=p.length;A<E;A++)(p[A].fn!==u||w&&!p[A].once||y&&p[A].context!==y)&&g.push(p[A]);g.length?this._events[f]=g.length===1?g[0]:g:s(this,f)}return this},a.prototype.removeAllListeners=function(c){var u;return c?(u=e?e+c:c,this._events[u]&&s(this,u)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,r.exports=a})(kr);var Oo=kr.exports;const Ro=Vn(Oo);function Bo(r,t){return Array.apply(0,new Array(Math.ceil(r.length/t))).map((e,n)=>r.slice(n*t,(n+1)*t))}const xe=r=>"version"in r;function Po(r){return r.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),"0x")}function Do(r){r.indexOf("0x")===0&&(r=r.substr(2)),r.length%2===1&&(r="0"+r);let t=r.match(/.{2}/g);return t===null?G.Buffer.from([]):G.Buffer.from(t.map(e=>parseInt(e,16)))}var Uo=Object.freeze({__proto__:null,encode:Po,decode:Do});function Sr(r){return new TextDecoder("utf-8").decode(r)}function Ir(r){return new TextEncoder().encode(r)}var No=Object.freeze({__proto__:null,decode:Sr,encode:Ir});function xt(r){return ve.encode(r)}function Mo(r){return ve.decode(r)}var $o=Object.freeze({__proto__:null,encode:xt,decode:Mo});function kt(r){return r.toString("base64")}function jt(r){return G.Buffer.from(r,"base64")}var jo=Object.freeze({__proto__:null,encode:kt,decode:jt}),Vo=Object.freeze({__proto__:null,hex:Uo,utf8:No,bs58:$o,base64:jo});function Fo(r){const t=new Map;return r.errors&&r.errors.forEach(e=>{var n;let i=(n=e.msg)!==null&&n!==void 0?n:e.name;t.set(e.code,i)}),t}function zo(r,...t){if(r.args.length!=t.length)throw new Error("Invalid argument length");const e={};let n=0;return r.args.forEach(i=>{e[i.name]=t[n],n+=1}),e}function Lr(r,t={}){r.forEach(e=>{if("accounts"in e)Lr(e.accounts,t[e.name]);else if(t[e.name]===void 0)throw new Error(`Invalid arguments: ${e.name} not provided.`)})}function W(r){return r instanceof q?r:new q(r)}class qo extends TypeError{constructor(t,e){let n;const{message:i,...o}=t,{path:s}=t,a=s.length===0?i:"At path: "+s.join(".")+" -- "+i;super(a),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>{var d;return(d=n)!=null?d:n=[t,...e()]}}}function Go(r){return be(r)&&typeof r[Symbol.iterator]=="function"}function be(r){return typeof r=="object"&&r!=null}function ce(r){return typeof r=="string"?JSON.stringify(r):""+r}function Ko(r){const{done:t,value:e}=r.next();return t?void 0:e}function Zo(r,t,e,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:i,branch:o}=t,{type:s}=e,{refinement:a,message:d="Expected a value of type `"+s+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+ce(n)+"`"}=r;return{value:n,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...r,message:d}}function*On(r,t,e,n){Go(r)||(r=[r]);for(const i of r){const o=Zo(i,t,e,n);o&&(yield o)}}function*Vt(r,t,e){e===void 0&&(e={});const{path:n=[],branch:i=[r],coerce:o=!1,mask:s=!1}=e,a={path:n,branch:i};if(o&&(r=t.coercer(r,a),s&&t.type!=="type"&&be(t.schema)&&be(r)&&!Array.isArray(r)))for(const c in r)t.schema[c]===void 0&&delete r[c];let d=!0;for(const c of t.validator(r,a))d=!1,yield[c,void 0];for(let[c,u,y]of t.entries(r,a)){const w=Vt(u,y,{path:c===void 0?n:[...n,c],branch:c===void 0?i:[...i,u],coerce:o,mask:s});for(const f of w)f[0]?(d=!1,yield[f[0],void 0]):o&&(u=f[1],c===void 0?r=u:r instanceof Map?r.set(c,u):r instanceof Set?r.add(u):be(r)&&(r[c]=u))}if(d)for(const c of t.refiner(r,a))d=!1,yield[c,void 0];d&&(yield[void 0,r])}class ue{constructor(t){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:e,schema:n,validator:i,refiner:o,coercer:s=d=>d,entries:a=function*(){}}=t;this.type=e,this.schema=n,this.entries=a,this.coercer=s,i?this.validator=(d,c)=>{const u=i(d,c);return On(u,c,this,d)}:this.validator=()=>[],o?this.refiner=(d,c)=>{const u=o(d,c);return On(u,c,this,d)}:this.refiner=()=>[]}assert(t){return Ho(t,this)}create(t){return Ft(t,this)}is(t){return Tr(t,this)}mask(t){return Wo(t,this)}validate(t,e){return e===void 0&&(e={}),Be(t,this,e)}}function Ho(r,t){const e=Be(r,t);if(e[0])throw e[0]}function Ft(r,t){const e=Be(r,t,{coerce:!0});if(e[0])throw e[0];return e[1]}function Wo(r,t){const e=Be(r,t,{coerce:!0,mask:!0});if(e[0])throw e[0];return e[1]}function Tr(r,t){return!Be(r,t)[0]}function Be(r,t,e){e===void 0&&(e={});const n=Vt(r,t,e),i=Ko(n);return i[0]?[new qo(i[0],function*(){for(const s of n)s[0]&&(yield s[0])}),void 0]:[void 0,i[1]]}function Pe(r,t){return new ue({type:r,schema:null,validator:t})}function Yo(){return Pe("any",()=>!0)}function yt(r){return new ue({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(const[e,n]of t.entries())yield[e,n,r]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||"Expected an array value, but received: "+ce(t)}})}function Xo(){return Pe("boolean",r=>typeof r=="boolean")}function Rn(r){const t=ce(r);return new ue({type:"literal",schema:r,validator(e){return e===r||"Expected the literal `"+t+"`, but received: "+ce(e)}})}function Fe(r){return new ue({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function qe(){return Pe("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+ce(r))}function Ge(r){return new ue({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function le(){return Pe("string",r=>typeof r=="string"||"Expected a string, but received: "+ce(r))}function ae(r){const t=Object.keys(r);return new ue({type:"type",schema:r,*entries(e){if(be(e))for(const n of t)yield[n,e[n],r[n]]},validator(e){return be(e)||"Expected an object, but received: "+ce(e)}})}function Cr(r){const t=r.map(e=>e.type).join(" | ");return new ue({type:"union",schema:null,coercer(e,n){return(r.find(o=>{const[s]=o.validate(e,{coerce:!0});return!s})||zt()).coercer(e,n)},validator(e,n){const i=[];for(const o of r){const[...s]=Vt(e,o,n),[a]=s;if(a[0])for(const[d]of s)d&&i.push(d);else return[]}return["Expected the value to satisfy a union of `"+t+"`, but received: "+ce(e),...i]}})}function zt(){return Pe("unknown",()=>!0)}function Jo(r,t,e){return new ue({...r,coercer:(n,i)=>Tr(n,t)?r.coercer(e(n,i),i):r.coercer(n,i)})}async function Qo(r,t,e,n){r=W(r),n||(n=He());const i=new Fn;if(i.add(new zn({programId:r,keys:t??[],data:e})),n.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");return await n.sendAndConfirm(i,[])}const Bn=99;async function es(r,t,e){return(await qt(r,t,e)).map(i=>i?{publicKey:i.publicKey,account:i.account}:null)}async function qt(r,t,e){if(t.length<=Bn)return await Pn(r,t,e);{const n=Bo(t,Bn);return(await Promise.all(n.map(o=>Pn(r,o,e)))).flat()}}async function Pn(r,t,e){const n=e??r.commitment,{value:i,context:o}=await r.getMultipleAccountsInfoAndContext(t,n);return i.map((a,d)=>a===null?null:{publicKey:t[d],account:a,context:o})}async function Or(r,t,e,n,i){var o;e&&e.length>0&&t.sign(...e);const s=t._compile(),a=s.serialize(),c=t._serialize(a).toString("base64"),u={encoding:"base64",commitment:n??r.commitment};if(i){const p=(Array.isArray(i)?i:s.nonProgramIds()).map(A=>A.toBase58());u.accounts={encoding:"base64",addresses:p}}e&&(u.sigVerify=!0);const y=[c,u],w=await r._rpcRequest("simulateTransaction",y),f=Ft(w,is);if("error"in f){let p;if("data"in f.error&&(p=(o=f.error.data)===null||o===void 0?void 0:o.logs,p&&Array.isArray(p))){const A=`
2
+ `,g=A+p.join(A);console.error(f.error.message,g)}throw new vt("failed to simulate transaction: "+f.error.message,p)}return f.result}function ts(r){return Jo(Rr(r),ns,t=>"error"in t?t:{...t,result:Ft(t.result,r)})}const ns=Rr(zt());function Rr(r){return Cr([ae({jsonrpc:Rn("2.0"),id:le(),result:r}),ae({jsonrpc:Rn("2.0"),id:le(),error:ae({code:zt(),message:le(),data:Ge(Yo())})})])}function rs(r){return ts(ae({context:ae({slot:qe()}),value:r}))}const is=rs(ae({err:Fe(Cr([ae({}),le()])),logs:Fe(yt(le())),accounts:Ge(Fe(yt(Fe(ae({executable:Xo(),owner:le(),lamports:qe(),data:yt(le()),rentEpoch:Ge(qe())}))))),unitsConsumed:Ge(qe())}));var os=Object.freeze({__proto__:null,invoke:Qo,getMultipleAccounts:es,getMultipleAccountsAndContext:qt,simulateTransaction:Or});class ss{constructor(t,e,n){this.connection=t,this.wallet=e,this.opts=n,this.publicKey=e==null?void 0:e.publicKey}static defaultOptions(){return{preflightCommitment:"processed",commitment:"processed"}}static local(t,e){throw new Error("Provider local is not available on browser.")}static env(){throw new Error("Provider env is not available on browser.")}async sendAndConfirm(t,e,n){var i,o,s,a;if(n===void 0&&(n=this.opts),xe(t))e&&t.sign(e);else if(t.feePayer=(i=t.feePayer)!==null&&i!==void 0?i:this.wallet.publicKey,t.recentBlockhash=(await this.connection.getLatestBlockhash(n.preflightCommitment)).blockhash,e)for(const c of e)t.partialSign(c);t=await this.wallet.signTransaction(t);const d=t.serialize();try{return await Dn(this.connection,d,n)}catch(c){if(c instanceof St){const u=xt(xe(t)?((o=t.signatures)===null||o===void 0?void 0:o[0])||new Uint8Array:(s=t.signature)!==null&&s!==void 0?s:new Uint8Array),y=await this.connection.getTransaction(u,{commitment:"confirmed"});if(y){const w=(a=y.meta)===null||a===void 0?void 0:a.logMessages;throw w?new vt(c.message,w):c}else throw c}else throw c}}async sendAll(t,e){var n,i,o;e===void 0&&(e=this.opts);const s=(await this.connection.getLatestBlockhash(e.preflightCommitment)).blockhash;let a=t.map(u=>{var y,w;if(xe(u.tx)){let f=u.tx;return u.signers&&f.sign(u.signers),f}else{let f=u.tx,p=(y=u.signers)!==null&&y!==void 0?y:[];return f.feePayer=(w=f.feePayer)!==null&&w!==void 0?w:this.wallet.publicKey,f.recentBlockhash=s,p.forEach(A=>{f.partialSign(A)}),f}});const d=await this.wallet.signAllTransactions(a),c=[];for(let u=0;u<a.length;u+=1){const y=d[u],w=y.serialize();try{c.push(await Dn(this.connection,w,e))}catch(f){if(f instanceof St){const p=xt(xe(y)?((n=y.signatures)===null||n===void 0?void 0:n[0])||new Uint8Array:(i=y.signature)!==null&&i!==void 0?i:new Uint8Array),A=await this.connection.getTransaction(p,{commitment:"confirmed"});if(A){const g=(o=A.meta)===null||o===void 0?void 0:o.logMessages;throw g?new vt(f.message,g):f}else throw f}else throw f}}return c}async simulate(t,e,n,i){let o=(await this.connection.getLatestBlockhash(n??this.connection.commitment)).blockhash,s;if(xe(t)?(e&&(t.sign(e),t=await this.wallet.signTransaction(t)),s=await this.connection.simulateTransaction(t,{commitment:n})):(t.feePayer=t.feePayer||this.wallet.publicKey,t.recentBlockhash=o,e&&(t=await this.wallet.signTransaction(t)),s=await Or(this.connection,t,e,n,i)),s.value.err)throw new as(s.value);return s.value}}class as extends Error{constructor(t,e){super(e),this.simulationResponse=t}}async function Dn(r,t,e){const n=e&&{skipPreflight:e.skipPreflight,preflightCommitment:e.preflightCommitment||e.commitment},i=await r.sendRawTransaction(t,n),o=(await r.confirmTransaction(i,e&&e.commitment)).value;if(o.err)throw new St(`Raw transaction ${i} failed (${JSON.stringify(o)})`);return i}class St extends Error{constructor(t){super(t)}}function He(){return ss.local()}const cs=new Set(["anchor-deprecated-state","debug-logs"]),Br=new Map;function us(r){if(!cs.has(r))throw new Error("Invalid feature");Br.set(r,!0)}function Gt(r){return Br.get(r)!==void 0}var ls=Object.freeze({__proto__:null,set:us,isSet:Gt});class We extends Error{constructor(t){super(t),this.name="IdlError"}}class De{constructor(t){this.stack=t}static parse(t){var e;const n=/^Program (\w*) invoke/,i=/^Program \w* success/,o=[];for(let s=0;s<t.length;s++){if(i.exec(t[s])){o.pop();continue}const a=(e=n.exec(t[s]))===null||e===void 0?void 0:e[1];a&&o.push(new q(a))}return new De(o)}}class Le extends Error{constructor(t,e,n,i,o,s){super(n.join(`
3
+ `).replace("Program log: ","")),this.errorLogs=n,this.logs=i,this.error={errorCode:t,errorMessage:e,comparedValues:s,origin:o},this._programErrorStack=De.parse(i)}static parse(t){if(!t)return null;const e=t.findIndex(w=>w.startsWith("Program log: AnchorError"));if(e===-1)return null;const n=t[e],i=[n];let o;if(e+1<t.length){if(t[e+1]==="Program log: Left:"){const w=/^Program log: (.*)$/,f=w.exec(t[e+2])[1],p=w.exec(t[e+4])[1];o=[new q(f),new q(p)],i.push(...t.slice(e+1,e+5))}else if(t[e+1].startsWith("Program log: Left:")){const w=/^Program log: (Left|Right): (.*)$/,f=w.exec(t[e+1])[2],p=w.exec(t[e+2])[2];i.push(...t.slice(e+1,e+3)),o=[f,p]}}const a=/^Program log: AnchorError occurred\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(n),c=/^Program log: AnchorError thrown in (.*):(\d*)\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(n),y=/^Program log: AnchorError caused by account: (.*)\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(n);if(a){const[w,f,p]=a.slice(1,4),A={code:w,number:parseInt(f)};return new Le(A,p,i,t,void 0,o)}else if(c){const[w,f,p,A,g]=c.slice(1,6),E={code:p,number:parseInt(A)},T={file:w,line:parseInt(f)};return new Le(E,g,i,t,T,o)}else if(y){const[w,f,p,A]=y.slice(1,5),g=w,E={code:f,number:parseInt(p)};return new Le(E,A,i,t,g,o)}else return null}get program(){return this._programErrorStack.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){return this._programErrorStack.stack}toString(){return this.message}}class Ye extends Error{constructor(t,e,n){super(),this.code=t,this.msg=e,this.logs=n,n&&(this._programErrorStack=De.parse(n))}static parse(t,e){const n=t.toString();let i;if(n.includes("custom program error:")){let a=n.split("custom program error: ");if(a.length!==2)return null;i=a[1]}else{const a=n.match(/"Custom":([0-9]+)}/g);if(!a||a.length>1)return null;i=a[0].match(/([0-9]+)/g)[0]}let o;try{o=parseInt(i)}catch{return null}let s=e.get(o);return s!==void 0?new Ye(o,s,t.logs):(s=ds.get(o),s!==void 0?new Ye(o,s,t.logs):null)}get program(){var t;return(t=this._programErrorStack)===null||t===void 0?void 0:t.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){var t;return(t=this._programErrorStack)===null||t===void 0?void 0:t.stack}toString(){return this.msg}}function Pr(r,t){Gt("debug-logs")&&console.log("Translating error:",r);const e=Le.parse(r.logs);if(e)return e;const n=Ye.parse(r,t);if(n)return n;if(r.logs){const i={get:function(o,s){return s==="programErrorStack"?o.programErrorStack.stack:s==="program"?o.programErrorStack.stack[r.programErrorStack.stack.length-1]:Reflect.get(...arguments)}};return r.programErrorStack=De.parse(r.logs),new Proxy(r,i)}return r}const I={InstructionMissing:100,InstructionFallbackNotFound:101,InstructionDidNotDeserialize:102,InstructionDidNotSerialize:103,IdlInstructionStub:1e3,IdlInstructionInvalidProgram:1001,ConstraintMut:2e3,ConstraintHasOne:2001,ConstraintSigner:2002,ConstraintRaw:2003,ConstraintOwner:2004,ConstraintRentExempt:2005,ConstraintSeeds:2006,ConstraintExecutable:2007,ConstraintState:2008,ConstraintAssociated:2009,ConstraintAssociatedInit:2010,ConstraintClose:2011,ConstraintAddress:2012,ConstraintZero:2013,ConstraintTokenMint:2014,ConstraintTokenOwner:2015,ConstraintMintMintAuthority:2016,ConstraintMintFreezeAuthority:2017,ConstraintMintDecimals:2018,ConstraintSpace:2019,ConstraintAccountIsNone:2020,RequireViolated:2500,RequireEqViolated:2501,RequireKeysEqViolated:2502,RequireNeqViolated:2503,RequireKeysNeqViolated:2504,RequireGtViolated:2505,RequireGteViolated:2506,AccountDiscriminatorAlreadySet:3e3,AccountDiscriminatorNotFound:3001,AccountDiscriminatorMismatch:3002,AccountDidNotDeserialize:3003,AccountDidNotSerialize:3004,AccountNotEnoughKeys:3005,AccountNotMutable:3006,AccountOwnedByWrongProgram:3007,InvalidProgramId:3008,InvalidProgramExecutable:3009,AccountNotSigner:3010,AccountNotSystemOwned:3011,AccountNotInitialized:3012,AccountNotProgramData:3013,AccountNotAssociatedTokenAccount:3014,AccountSysvarMismatch:3015,AccountReallocExceedsLimit:3016,AccountDuplicateReallocs:3017,DeclaredProgramIdMismatch:4100,Deprecated:5e3},ds=new Map([[I.InstructionMissing,"8 byte instruction identifier not provided"],[I.InstructionFallbackNotFound,"Fallback functions are not supported"],[I.InstructionDidNotDeserialize,"The program could not deserialize the given instruction"],[I.InstructionDidNotSerialize,"The program could not serialize the given instruction"],[I.IdlInstructionStub,"The program was compiled without idl instructions"],[I.IdlInstructionInvalidProgram,"The transaction was given an invalid program for the IDL instruction"],[I.ConstraintMut,"A mut constraint was violated"],[I.ConstraintHasOne,"A has one constraint was violated"],[I.ConstraintSigner,"A signer constraint was violated"],[I.ConstraintRaw,"A raw constraint was violated"],[I.ConstraintOwner,"An owner constraint was violated"],[I.ConstraintRentExempt,"A rent exemption constraint was violated"],[I.ConstraintSeeds,"A seeds constraint was violated"],[I.ConstraintExecutable,"An executable constraint was violated"],[I.ConstraintState,"Deprecated Error, feel free to replace with something else"],[I.ConstraintAssociated,"An associated constraint was violated"],[I.ConstraintAssociatedInit,"An associated init constraint was violated"],[I.ConstraintClose,"A close constraint was violated"],[I.ConstraintAddress,"An address constraint was violated"],[I.ConstraintZero,"Expected zero account discriminant"],[I.ConstraintTokenMint,"A token mint constraint was violated"],[I.ConstraintTokenOwner,"A token owner constraint was violated"],[I.ConstraintMintMintAuthority,"A mint mint authority constraint was violated"],[I.ConstraintMintFreezeAuthority,"A mint freeze authority constraint was violated"],[I.ConstraintMintDecimals,"A mint decimals constraint was violated"],[I.ConstraintSpace,"A space constraint was violated"],[I.ConstraintAccountIsNone,"A required account for the constraint is None"],[I.RequireViolated,"A require expression was violated"],[I.RequireEqViolated,"A require_eq expression was violated"],[I.RequireKeysEqViolated,"A require_keys_eq expression was violated"],[I.RequireNeqViolated,"A require_neq expression was violated"],[I.RequireKeysNeqViolated,"A require_keys_neq expression was violated"],[I.RequireGtViolated,"A require_gt expression was violated"],[I.RequireGteViolated,"A require_gte expression was violated"],[I.AccountDiscriminatorAlreadySet,"The account discriminator was already set on this account"],[I.AccountDiscriminatorNotFound,"No 8 byte discriminator was found on the account"],[I.AccountDiscriminatorMismatch,"8 byte discriminator did not match what was expected"],[I.AccountDidNotDeserialize,"Failed to deserialize the account"],[I.AccountDidNotSerialize,"Failed to serialize the account"],[I.AccountNotEnoughKeys,"Not enough account keys given to the instruction"],[I.AccountNotMutable,"The given account is not mutable"],[I.AccountOwnedByWrongProgram,"The given account is owned by a different program than expected"],[I.InvalidProgramId,"Program ID was not as expected"],[I.InvalidProgramExecutable,"Program account is not executable"],[I.AccountNotSigner,"The given account did not sign"],[I.AccountNotSystemOwned,"The given account is not owned by the system program"],[I.AccountNotInitialized,"The program expected this account to be already initialized"],[I.AccountNotProgramData,"The given account is not a program data account"],[I.AccountNotAssociatedTokenAccount,"The given account is not the associated token account"],[I.AccountSysvarMismatch,"The given public key does not match the required sysvar"],[I.AccountReallocExceedsLimit,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[I.AccountDuplicateReallocs,"The account was duplicated for more than one reallocation"],[I.DeclaredProgramIdMismatch,"The declared program id does not match the actual program id"],[I.Deprecated,"The API being used is deprecated and should no longer be used"]]);var It=function(){return It=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},It.apply(this,arguments)},Lt=function(){return Lt=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Lt.apply(this,arguments)};function fs(r){return r.toLowerCase()}var hs=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],ps=/[^A-Z0-9]+/gi;function ws(r,t){t===void 0&&(t={});for(var e=t.splitRegexp,n=e===void 0?hs:e,i=t.stripRegexp,o=i===void 0?ps:i,s=t.transform,a=s===void 0?fs:s,d=t.delimiter,c=d===void 0?" ":d,u=Un(Un(r,n,"$1\0$2"),o,"\0"),y=0,w=u.length;u.charAt(y)==="\0";)y++;for(;u.charAt(w-1)==="\0";)w--;return u.slice(y,w).split("\0").map(a).join(c)}function Un(r,t,e){return t instanceof RegExp?r.replace(t,e):t.reduce(function(n,i){return n.replace(i,e)},r)}function ys(r,t){return t===void 0&&(t={}),ws(r,Lt({delimiter:"."},t))}function gs(r,t){return t===void 0&&(t={}),ys(r,It({delimiter:"_"},t))}class K{static fieldLayout(t,e){const n=t.name!==void 0?j(t.name):void 0;switch(t.type){case"bool":return R.bool(n);case"u8":return R.u8(n);case"i8":return R.i8(n);case"u16":return R.u16(n);case"i16":return R.i16(n);case"u32":return R.u32(n);case"i32":return R.i32(n);case"f32":return R.f32(n);case"u64":return R.u64(n);case"i64":return R.i64(n);case"f64":return R.f64(n);case"u128":return R.u128(n);case"i128":return R.i128(n);case"u256":return R.u256(n);case"i256":return R.i256(n);case"bytes":return R.vecU8(n);case"string":return R.str(n);case"publicKey":return R.publicKey(n);default:{if("vec"in t.type)return R.vec(K.fieldLayout({name:void 0,type:t.type.vec},e),n);if("option"in t.type)return R.option(K.fieldLayout({name:void 0,type:t.type.option},e),n);if("defined"in t.type){if(!e)throw new We("User defined types not provided");const i=t.type.defined,o=e.filter(s=>s.name===i);if(o.length!==1)throw new We(`Type not found: ${JSON.stringify(t)}`);return K.typeDefLayout(o[0],e,n)}else if("array"in t.type){let i=t.type.array[0],o=t.type.array[1],s=K.fieldLayout({name:void 0,type:i},e);return R.array(s,o,n)}else throw new Error(`Not yet implemented: ${t}`)}}}static typeDefLayout(t,e=[],n){switch(t.type.kind){case"struct":{const i=t.type.fields.map(o=>K.fieldLayout(o,e));return R.struct(i,n)}case"enum":{let i=t.type.variants.map(o=>{const s=j(o.name);if(!o.fields)return R.struct([],s);const a=o.fields.map((d,c)=>d!=null&&d.name?K.fieldLayout(d,e):K.fieldLayout({type:d,name:c.toString()},e));return R.struct(a,s)});return n!==void 0?R.rustEnum(i).replicate(n):R.rustEnum(i,n)}case"alias":return K.fieldLayout({type:t.type.value,name:t.name},e)}}}const Nn="global";class Kt{constructor(t){this.idl=t,this.ixLayout=Kt.parseIxLayout(t);const e=new Map;t.instructions.forEach(n=>{const i=Mn(Nn,n.name);e.set(ve.encode(i),{layout:this.ixLayout.get(n.name),name:n.name})}),this.sighashLayouts=e}encode(t,e){return this._encode(Nn,t,e)}_encode(t,e,n){const i=G.Buffer.alloc(1e3),o=j(e),s=this.ixLayout.get(o);if(!s)throw new Error(`Unknown method: ${o}`);const a=s.encode(n,i),d=i.slice(0,a);return G.Buffer.concat([Mn(t,e),d])}static parseIxLayout(t){const e=t.instructions.map(n=>{let i=n.args.map(s=>{var a,d;return K.fieldLayout(s,Array.from([...(a=t.accounts)!==null&&a!==void 0?a:[],...(d=t.types)!==null&&d!==void 0?d:[]]))});const o=j(n.name);return[o,R.struct(i,o)]});return new Map(e)}decode(t,e="hex"){typeof t=="string"&&(t=e==="hex"?G.Buffer.from(t,"hex"):ve.decode(t));let n=ve.encode(t.slice(0,8)),i=t.slice(8);const o=this.sighashLayouts.get(n);return o?{data:o.layout.decode(i),name:o.name}:null}format(t,e){return ee.format(t,e,this.idl)}}class ee{static format(t,e,n){const i=n.instructions.filter(d=>t.name===d.name)[0];if(i===void 0)return console.error("Invalid instruction given"),null;const o=i.args.map(d=>({name:d.name,type:ee.formatIdlType(d.type),data:ee.formatIdlData(d,t.data[d.name],n.types)})),s=ee.flattenIdlAccounts(i.accounts),a=e.map((d,c)=>c<s.length?{name:s[c].name,...d}:{name:void 0,...d});return{args:o,accounts:a}}static formatIdlType(t){if(typeof t=="string")return t;if("vec"in t)return`Vec<${this.formatIdlType(t.vec)}>`;if("option"in t)return`Option<${this.formatIdlType(t.option)}>`;if("defined"in t)return t.defined;if("array"in t)return`Array<${t.array[0]}; ${t.array[1]}>`;throw new Error(`Unknown IDL type: ${t}`)}static formatIdlData(t,e,n){if(typeof t.type=="string")return e.toString();if(t.type.hasOwnProperty("vec"))return"["+e.map(i=>this.formatIdlData({name:"",type:t.type.vec},i)).join(", ")+"]";if(t.type.hasOwnProperty("option"))return e===null?"null":this.formatIdlData({name:"",type:t.type.option},e,n);if(t.type.hasOwnProperty("defined")){if(n===void 0)throw new Error("User defined types not provided");const i=n.filter(o=>o.name===t.type.defined);if(i.length!==1)throw new Error(`Type not found: ${t.type.defined}`);return ee.formatIdlDataDefined(i[0],e,n)}return"unknown"}static formatIdlDataDefined(t,e,n){switch(t.type.kind){case"struct":{const i=t.type;return"{ "+Object.keys(e).map(s=>{const a=i.fields.find(d=>d.name===s);if(!a)throw new Error("Unable to find type");return s+": "+ee.formatIdlData(a,e[s],n)}).join(", ")+" }"}case"enum":{if(t.type.variants.length===0)return"{}";if(t.type.variants[0].name){const i=t.type.variants,o=Object.keys(e)[0],s=e[o],a=Object.keys(s).map(c=>{var u;const y=s[c],w=(u=i[o])===null||u===void 0?void 0:u.find(f=>f.name===c);if(!w)throw new Error("Unable to find variant");return c+": "+ee.formatIdlData(w,y,n)}).join(", "),d=j(o,{pascalCase:!0});return a.length===0?d:`${d} { ${a} }`}else return"Tuple formatting not yet implemented"}case"alias":return ee.formatIdlType(t.type.value)}}static flattenIdlAccounts(t,e){return t.map(n=>{const i=ms(n.name);if(n.hasOwnProperty("accounts")){const o=e?`${e} > ${i}`:i;return ee.flattenIdlAccounts(n.accounts,o)}else return{...n,name:e?`${e} > ${i}`:i}}).flat()}}function ms(r){const t=r.replace(/([A-Z])/g," $1");return t.charAt(0).toUpperCase()+t.slice(1)}function Mn(r,t){let e=gs(t),n=`${r}:${e}`;return G.Buffer.from(Je(n).slice(0,8))}function Dr(r,t){switch(t.type.kind){case"struct":return t.type.fields.map(e=>de(r,e.type)).reduce((e,n)=>e+n,0);case"enum":{const e=t.type.variants.map(n=>n.fields?n.fields.map(i=>typeof i=="object"&&"name"in i?de(r,i.type):de(r,i)).reduce((i,o)=>i+o,0):0);return Math.max(...e)+1}case"alias":return de(r,t.type.value)}}function de(r,t){var e,n;switch(t){case"bool":return 1;case"u8":return 1;case"i8":return 1;case"i16":return 2;case"u16":return 2;case"u32":return 4;case"i32":return 4;case"f32":return 4;case"u64":return 8;case"i64":return 8;case"f64":return 8;case"u128":return 16;case"i128":return 16;case"u256":return 32;case"i256":return 32;case"bytes":return 1;case"string":return 1;case"publicKey":return 32;default:if("vec"in t)return 1;if("option"in t)return 1+de(r,t.option);if("coption"in t)return 4+de(r,t.coption);if("defined"in t){const i=(n=(e=r.types)===null||e===void 0?void 0:e.filter(s=>s.name===t.defined))!==null&&n!==void 0?n:[];if(i.length!==1)throw new We(`Type not found: ${JSON.stringify(t)}`);let o=i[0];return Dr(r,o)}if("array"in t){let i=t.array[0],o=t.array[1];return de(r,i)*o}throw new Error(`Invalid type ${JSON.stringify(t)}`)}}const Tt=8;function Ur(r){return V.Buffer.from(Je(r).slice(0,Tt))}class me{constructor(t){if(t.accounts===void 0){this.accountLayouts=new Map;return}const e=t.accounts.map(n=>[n.name,K.typeDefLayout(n,t.types)]);this.accountLayouts=new Map(e),this.idl=t}async encode(t,e){const n=G.Buffer.alloc(1e3),i=this.accountLayouts.get(t);if(!i)throw new Error(`Unknown account: ${t}`);const o=i.encode(e,n);let s=n.slice(0,o),a=me.accountDiscriminator(t);return G.Buffer.concat([a,s])}decode(t,e){if(me.accountDiscriminator(t).compare(e.slice(0,8)))throw new Error("Invalid account discriminator");return this.decodeUnchecked(t,e)}decodeAny(t){const e=t.slice(0,8),n=Array.from(this.accountLayouts.keys()).find(i=>me.accountDiscriminator(i).equals(e));if(!n)throw new Error("Account descriminator not found");return this.decodeUnchecked(n,t)}decodeUnchecked(t,e){const n=e.subarray(Tt),i=this.accountLayouts.get(t);if(!i)throw new Error(`Unknown account: ${t}`);return i.decode(n)}memcmp(t,e){const n=me.accountDiscriminator(t);return{offset:0,bytes:ve.encode(e?G.Buffer.concat([n,e]):n)}}size(t){var e;return Tt+((e=Dr(this.idl,t))!==null&&e!==void 0?e:0)}static accountDiscriminator(t){const e=`account:${j(t,{pascalCase:!0,preserveConsecutiveUppercase:!0})}`;return Ur(e)}}class vs{constructor(t){if(t.events===void 0){this.layouts=new Map;return}const e=t.events.map(n=>{let i={name:n.name,type:{kind:"struct",fields:n.fields.map(o=>({name:o.name,type:o.type}))}};return[n.name,K.typeDefLayout(i,t.types)]});this.layouts=new Map(e),this.discriminators=new Map(t.events===void 0?[]:t.events.map(n=>[kt(bs(n.name)),n.name]))}decode(t){let e;try{e=jt(t)}catch{return null}const n=kt(e.slice(0,8)),i=this.discriminators.get(n);if(i===void 0)return null;const o=this.layouts.get(i);if(!o)throw new Error(`Unknown event: ${i}`);return{data:o.decode(e.slice(8)),name:i}}}function bs(r){return Ur(`event:${r}`)}class _s{constructor(t){if(t.types===void 0){this.typeLayouts=new Map;return}const e=t.types.map(n=>[n.name,K.typeDefLayout(n,t.types)]);this.typeLayouts=new Map(e),this.idl=t}encode(t,e){const n=G.Buffer.alloc(1e3),i=this.typeLayouts.get(t);if(!i)throw new Error(`Unknown type: ${t}`);const o=i.encode(e,n);return n.slice(0,o)}decode(t,e){const n=this.typeLayouts.get(t);if(!n)throw new Error(`Unknown type: ${t}`);return n.decode(e)}}class Nr{constructor(t){this.instruction=new Kt(t),this.accounts=new me(t),this.events=new vs(t),this.types=new _s(t)}}var Es=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof V.global<"u"?V.global:typeof self<"u"?self:{};function As(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}class H{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}var rt=H;function xs(r,t){return t.property?r+"["+t.property+"]":r}class fe extends H{isCount(){throw new Error("ExternalLayout is abstract")}}class Mr extends fe{constructor(t,e,n){if(!(t instanceof H))throw new TypeError("layout must be a Layout");if(e===void 0)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof it||this.layout instanceof $r}decode(t,e){return e===void 0&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return n===void 0&&(n=0),this.layout.encode(t,e,n+this.offset)}}class it extends H{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return e===void 0&&(e=0),t.readUIntLE(e,this.span)}encode(t,e,n){return n===void 0&&(n=0),e.writeUIntLE(t,n,this.span),this.span}}class $r extends H{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return e===void 0&&(e=0),t.readUIntBE(e,this.span)}encode(t,e,n){return n===void 0&&(n=0),e.writeUIntBE(t,n,this.span),this.span}}const Ct=Math.pow(2,32);function jr(r){const t=Math.floor(r/Ct),e=r-t*Ct;return{hi32:t,lo32:e}}function Vr(r,t){return r*Ct+t}class ks extends H{constructor(t){super(8,t)}decode(t,e){e===void 0&&(e=0);const n=t.readUInt32LE(e),i=t.readUInt32LE(e+4);return Vr(i,n)}encode(t,e,n){n===void 0&&(n=0);const i=jr(t);return e.writeUInt32LE(i.lo32,n),e.writeUInt32LE(i.hi32,n+4),8}}class Ss extends H{constructor(t){super(8,t)}decode(t,e){e===void 0&&(e=0);const n=t.readUInt32LE(e),i=t.readInt32LE(e+4);return Vr(i,n)}encode(t,e,n){n===void 0&&(n=0);const i=jr(t);return e.writeUInt32LE(i.lo32,n),e.writeInt32LE(i.hi32,n+4),8}}class Is extends H{constructor(t,e,n){if(!(Array.isArray(t)&&t.reduce((o,s)=>o&&s instanceof H,!0)))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const o of t)if(0>o.span&&o.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=t.reduce((o,s)=>o+s.getSpan(),0)}catch{}super(i,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;try{n=this.fields.reduce((i,o)=>{const s=o.getSpan(t,e);return e+=s,i+s},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e){e===void 0&&(e=0);const n=this.makeDestinationObject();for(const i of this.fields)if(i.property!==void 0&&(n[i.property]=i.decode(t,e)),e+=i.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){n===void 0&&(n=0);const i=n;let o=0,s=0;for(const a of this.fields){let d=a.span;if(s=0<d?d:0,a.property!==void 0){const c=t[a.property];c!==void 0&&(s=a.encode(c,e,n),0>d&&(d=a.getSpan(e,n)))}o=n,n+=d}return o+s-i}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0<t.length&&(e[n.property]=t.shift());return e}layoutFor(t){if(typeof t!="string")throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}offsetOf(t){if(typeof t!="string")throw new TypeError("property must be string");let e=0;for(const n of this.fields){if(n.property===t)return e;0>n.span?e=-1:0<=e&&(e+=n.span)}}}class Fr{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class $n extends Fr{constructor(t,e){if(!(t instanceof fe&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class zr extends H{constructor(t,e,n){const i=t instanceof it||t instanceof $r;if(i)t=new $n(new Mr(t));else if(t instanceof fe&&t.isCount())t=new $n(t);else if(!(t instanceof Fr))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof H))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let o=-1;e&&(o=e.span,0<=o&&i&&(o+=t.layout.span)),super(o,n),this.discriminator=t,this.usesPrefixDiscriminator=i,this.defaultLayout=e,this.registry={};let s=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(a){return s(a)},this.configGetSourceVariant=function(a){s=a.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){e===void 0&&(e=0);let n;const i=this.discriminator,o=i.decode(t,e);let s=this.registry[o];if(s===void 0){let a=0;s=this.defaultLayout,this.usesPrefixDiscriminator&&(a=i.layout.span),n=this.makeDestinationObject(),n[i.property]=o,n[s.property]=this.defaultLayout.decode(t,e+a)}else n=s.decode(t,e);return n}encode(t,e,n){n===void 0&&(n=0);const i=this.getSourceVariant(t);if(i===void 0){const o=this.discriminator,s=this.defaultLayout;let a=0;return this.usesPrefixDiscriminator&&(a=o.layout.span),o.encode(t[o.property],e,n),a+s.encode(t[s.property],e,n+a)}return i.encode(t,e,n)}addVariant(t,e,n){const i=new Ls(this,t,e,n);return this.registry[t]=i,i}getVariant(t,e){let n=t;return V.Buffer.isBuffer(t)&&(e===void 0&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class Ls extends H{constructor(t,e,n,i){if(!(t instanceof zr))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&i===void 0&&(i=n,n=null),n){if(!(n instanceof H))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof i!="string")throw new TypeError("variant must have a String property")}let o=t.span;0>t.span&&(o=n?n.span:0,0<=o&&t.usesPrefixDiscriminator&&(o+=t.discriminator.layout.span)),super(o,i),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(e===void 0&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+i):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){n===void 0&&(n=0);let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let o=i;if(this.layout&&(this.layout.encode(t[this.property],e,n+i),o+=this.layout.getSpan(e,n+i),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}class Ts extends H{constructor(t,e){if(!(t instanceof fe&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;t instanceof fe||(n=t),super(n,e),this.length=t}getSpan(t,e){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}decode(t,e){e===void 0&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let i=this.length;if(this.length instanceof fe&&(i=t.length),!(V.Buffer.isBuffer(t)&&i===t.length))throw new TypeError(xs("Blob.encode",this)+" requires (length "+i+") Buffer as src");if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,i,"hex"),this.length instanceof fe&&this.length.encode(i,e,n),i}}var Cs=(r,t,e)=>new Mr(r,t,e),Os=r=>new it(1,r),ie=r=>new it(4,r),Rs=r=>new ks(r),oe=r=>new Ss(r),z=(r,t,e)=>new Is(r,t,e),qr=(r,t,e)=>new zr(r,t,e),Ue=(r,t)=>new Ts(r,t);class Bs extends rt{constructor(t){super(-1,t),this.property=t,this.layout=z([ie("length"),ie("lengthPadding"),Ue(Cs(ie(),-8),"chars")],this.property)}encode(t,e,n=0){if(t==null)return this.layout.span;const i={chars:V.Buffer.from(t,"utf8")};return this.layout.encode(i,e,n)}decode(t,e=0){return this.layout.decode(t,e).chars.toString()}getSpan(t,e=0){return ie().span+ie().span+new Gn(new Uint8Array(t).slice(e,e+4),10,"le").toNumber()}}function ot(r){return new Bs(r)}function J(r){return Ue(32,r)}const Y=qr(ie("instruction"));Y.addVariant(0,z([oe("lamports"),oe("space"),J("owner")]),"createAccount");Y.addVariant(1,z([J("owner")]),"assign");Y.addVariant(2,z([oe("lamports")]),"transfer");Y.addVariant(3,z([J("base"),ot("seed"),oe("lamports"),oe("space"),J("owner")]),"createAccountWithSeed");Y.addVariant(4,z([J("authorized")]),"advanceNonceAccount");Y.addVariant(5,z([oe("lamports")]),"withdrawNonceAccount");Y.addVariant(6,z([J("authorized")]),"initializeNonceAccount");Y.addVariant(7,z([J("authorized")]),"authorizeNonceAccount");Y.addVariant(8,z([oe("space")]),"allocate");Y.addVariant(9,z([J("base"),ot("seed"),oe("space"),J("owner")]),"allocateWithSeed");Y.addVariant(10,z([J("base"),ot("seed"),J("owner")]),"assignWithSeed");Y.addVariant(11,z([oe("lamports"),ot("seed"),J("owner")]),"transferWithSeed");Math.max(...Object.values(Y.registry).map(r=>r.span));class Ps extends rt{constructor(t,e,n,i){super(t.span,i),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}function jn(r){return new Ps(Ue(32),t=>new q(t),t=>t.toBuffer(),r)}z([ie("version"),ie("state"),jn("authorizedPubkey"),jn("nonce"),z([Rs("lamportsPerSignature")],"feeCalculator")]);function Ds(r){return new TextDecoder().decode(Je(r))}var Us=Object.freeze({__proto__:null,hash:Ds});function Ns(r,t,e){const n=G.Buffer.concat([r.toBuffer(),G.Buffer.from(t),e.toBuffer()]);return new q(Je(n))}function Gr(r,...t){let e=[G.Buffer.from([97,110,99,104,111,114])];t.forEach(i=>{e.push(i instanceof G.Buffer?i:W(i).toBuffer())});const[n]=q.findProgramAddressSync(e,W(r));return n}var Ms=Object.freeze({__proto__:null,createWithSeedSync:Ns,associated:Gr});const Zt=new q("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),Ht=new q("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");function $s({mint:r,owner:t}){return q.findProgramAddressSync([t.toBuffer(),Zt.toBuffer(),r.toBuffer()],Ht)[0]}var js=Object.freeze({__proto__:null,TOKEN_PROGRAM_ID:Zt,ASSOCIATED_PROGRAM_ID:Ht,associatedAddress:$s}),Ot={exports:{}};(function(r,t){var e=typeof self<"u"?self:Es,n=function(){function o(){this.fetch=!1,this.DOMException=e.DOMException}return o.prototype=e,new o}();(function(o){(function(s){var a={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function d(l){return l&&DataView.prototype.isPrototypeOf(l)}if(a.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(l){return l&&c.indexOf(Object.prototype.toString.call(l))>-1};function y(l){if(typeof l!="string"&&(l=String(l)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(l))throw new TypeError("Invalid character in header field name");return l.toLowerCase()}function w(l){return typeof l!="string"&&(l=String(l)),l}function f(l){var h={next:function(){var x=l.shift();return{done:x===void 0,value:x}}};return a.iterable&&(h[Symbol.iterator]=function(){return h}),h}function p(l){this.map={},l instanceof p?l.forEach(function(h,x){this.append(x,h)},this):Array.isArray(l)?l.forEach(function(h){this.append(h[0],h[1])},this):l&&Object.getOwnPropertyNames(l).forEach(function(h){this.append(h,l[h])},this)}p.prototype.append=function(l,h){l=y(l),h=w(h);var x=this.map[l];this.map[l]=x?x+", "+h:h},p.prototype.delete=function(l){delete this.map[y(l)]},p.prototype.get=function(l){return l=y(l),this.has(l)?this.map[l]:null},p.prototype.has=function(l){return this.map.hasOwnProperty(y(l))},p.prototype.set=function(l,h){this.map[y(l)]=w(h)},p.prototype.forEach=function(l,h){for(var x in this.map)this.map.hasOwnProperty(x)&&l.call(h,this.map[x],x,this)},p.prototype.keys=function(){var l=[];return this.forEach(function(h,x){l.push(x)}),f(l)},p.prototype.values=function(){var l=[];return this.forEach(function(h){l.push(h)}),f(l)},p.prototype.entries=function(){var l=[];return this.forEach(function(h,x){l.push([x,h])}),f(l)},a.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function A(l){if(l.bodyUsed)return Promise.reject(new TypeError("Already read"));l.bodyUsed=!0}function g(l){return new Promise(function(h,x){l.onload=function(){h(l.result)},l.onerror=function(){x(l.error)}})}function E(l){var h=new FileReader,x=g(h);return h.readAsArrayBuffer(l),x}function T(l){var h=new FileReader,x=g(h);return h.readAsText(l),x}function _(l){for(var h=new Uint8Array(l),x=new Array(h.length),D=0;D<h.length;D++)x[D]=String.fromCharCode(h[D]);return x.join("")}function m(l){if(l.slice)return l.slice(0);var h=new Uint8Array(l.byteLength);return h.set(new Uint8Array(l)),h.buffer}function L(){return this.bodyUsed=!1,this._initBody=function(l){this._bodyInit=l,l?typeof l=="string"?this._bodyText=l:a.blob&&Blob.prototype.isPrototypeOf(l)?this._bodyBlob=l:a.formData&&FormData.prototype.isPrototypeOf(l)?this._bodyFormData=l:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)?this._bodyText=l.toString():a.arrayBuffer&&a.blob&&d(l)?(this._bodyArrayBuffer=m(l.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(l)||u(l))?this._bodyArrayBuffer=m(l):this._bodyText=l=Object.prototype.toString.call(l):this._bodyText="",this.headers.get("content-type")||(typeof l=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var l=A(this);if(l)return l;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?A(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(E)}),this.text=function(){var l=A(this);if(l)return l;if(this._bodyBlob)return T(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(_(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(B)}),this.json=function(){return this.text().then(JSON.parse)},this}var M=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function S(l){var h=l.toUpperCase();return M.indexOf(h)>-1?h:l}function P(l,h){h=h||{};var x=h.body;if(l instanceof P){if(l.bodyUsed)throw new TypeError("Already read");this.url=l.url,this.credentials=l.credentials,h.headers||(this.headers=new p(l.headers)),this.method=l.method,this.mode=l.mode,this.signal=l.signal,!x&&l._bodyInit!=null&&(x=l._bodyInit,l.bodyUsed=!0)}else this.url=String(l);if(this.credentials=h.credentials||this.credentials||"same-origin",(h.headers||!this.headers)&&(this.headers=new p(h.headers)),this.method=S(h.method||this.method||"GET"),this.mode=h.mode||this.mode||null,this.signal=h.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&x)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(x)}P.prototype.clone=function(){return new P(this,{body:this._bodyInit})};function B(l){var h=new FormData;return l.trim().split("&").forEach(function(x){if(x){var D=x.split("="),F=D.shift().replace(/\+/g," "),N=D.join("=").replace(/\+/g," ");h.append(decodeURIComponent(F),decodeURIComponent(N))}}),h}function O(l){var h=new p,x=l.replace(/\r?\n[\t ]+/g," ");return x.split(/\r?\n/).forEach(function(D){var F=D.split(":"),N=F.shift().trim();if(N){var Ne=F.join(":").trim();h.append(N,Ne)}}),h}L.call(P.prototype);function C(l,h){h||(h={}),this.type="default",this.status=h.status===void 0?200:h.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in h?h.statusText:"OK",this.headers=new p(h.headers),this.url=h.url||"",this._initBody(l)}L.call(C.prototype),C.prototype.clone=function(){return new C(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},C.error=function(){var l=new C(null,{status:0,statusText:""});return l.type="error",l};var k=[301,302,303,307,308];C.redirect=function(l,h){if(k.indexOf(h)===-1)throw new RangeError("Invalid status code");return new C(null,{status:h,headers:{location:l}})},s.DOMException=o.DOMException;try{new s.DOMException}catch{s.DOMException=function(h,x){this.message=h,this.name=x;var D=Error(h);this.stack=D.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function v(l,h){return new Promise(function(x,D){var F=new P(l,h);if(F.signal&&F.signal.aborted)return D(new s.DOMException("Aborted","AbortError"));var N=new XMLHttpRequest;function Ne(){N.abort()}N.onload=function(){var Ae={status:N.status,statusText:N.statusText,headers:O(N.getAllResponseHeaders()||"")};Ae.url="responseURL"in N?N.responseURL:Ae.headers.get("X-Request-URL");var at="response"in N?N.response:N.responseText;x(new C(at,Ae))},N.onerror=function(){D(new TypeError("Network request failed"))},N.ontimeout=function(){D(new TypeError("Network request failed"))},N.onabort=function(){D(new s.DOMException("Aborted","AbortError"))},N.open(F.method,F.url,!0),F.credentials==="include"?N.withCredentials=!0:F.credentials==="omit"&&(N.withCredentials=!1),"responseType"in N&&a.blob&&(N.responseType="blob"),F.headers.forEach(function(Ae,at){N.setRequestHeader(at,Ae)}),F.signal&&(F.signal.addEventListener("abort",Ne),N.onreadystatechange=function(){N.readyState===4&&F.signal.removeEventListener("abort",Ne)}),N.send(typeof F._bodyInit>"u"?null:F._bodyInit)})}return v.polyfill=!0,o.fetch||(o.fetch=v,o.Headers=p,o.Request=P,o.Response=C),s.Headers=p,s.Request=P,s.Response=C,s.fetch=v,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,r.exports=t})(Ot,Ot.exports);var Vs=As(Ot.exports);async function Fs(r,t,e=5){const n=`https://api.apr.dev/api/v0/program/${t.toString()}/latest?limit=${e}`,[i,o]=await Promise.all([Kr(r,t),Vs(n)]),s=(await o.json()).filter(d=>!d.aborted&&d.state==="Built"&&d.verified==="Verified");if(s.length===0)return null;const a=s[0];return i.slot.toNumber()!==a.verified_slot?null:a}async function Kr(r,t){const e=await r.getAccountInfo(t);if(e===null)throw new Error("program account not found");const{program:n}=Rt(e.data),i=await r.getAccountInfo(n.programdataAddress);if(i===null)throw new Error("program data account not found");const{programData:o}=Rt(i.data);return o}const zs=R.rustEnum([R.struct([],"uninitialized"),R.struct([R.option(R.publicKey(),"authorityAddress")],"buffer"),R.struct([R.publicKey("programdataAddress")],"program"),R.struct([R.u64("slot"),R.option(R.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,R.u32());function Rt(r){return zs.decode(r)}var qs=Object.freeze({__proto__:null,verifiedBuild:Fs,fetchData:Kr,decodeUpgradeableLoaderState:Rt}),Oa=Object.freeze({__proto__:null,sha256:Us,rpc:os,publicKey:Ms,bytes:Vo,token:js,features:ls,registry:qs});function Gs(r){return"accounts"in r}async function Ks(r){const t=(await q.findProgramAddress([],r))[0];return await q.createWithSeed(t,Zs(),r)}function Zs(){return"anchor:idl"}const Hs=R.struct([R.publicKey("authority"),R.vecU8("data")]);function Ws(r){return Hs.decode(r)}function st(r,t){var e,n;let i={};const o=r.args?r.args.length:0;if(t.length>o){if(t.length!==o+1)throw new Error(`provided too many arguments ${t} to instruction ${r==null?void 0:r.name} expecting: ${(n=(e=r.args)===null||e===void 0?void 0:e.map(s=>s.name))!==null&&n!==void 0?n:[]}`);i=t.pop()}return[t,i]}class Xe{static build(t,e,n){if(t.name==="_inner")throw new We("the _inner name is reserved");const i=(...o)=>{const[s,a]=st(t,[...o]);Lr(t.accounts,a.accounts),Ys(t,...o);const d=i.accounts(a.accounts);return a.remainingAccounts!==void 0&&d.push(...a.remainingAccounts),Gt("debug-logs")&&console.log("Outgoing account metas:",d),new zn({keys:d,programId:n,data:e(t.name,zo(t,...s))})};return i.accounts=o=>Xe.accountsArray(o,t.accounts,n,t.name),i}static accountsArray(t,e,n,i){return t?e.map(o=>{if(("accounts"in o?o.accounts:void 0)!==void 0){const a=t[o.name];return Xe.accountsArray(a,o.accounts,n,i).flat()}else{const a=o;let d;try{d=W(t[o.name])}catch{throw new Error(`Wrong input type for account "${o.name}" in the instruction accounts object${i!==void 0?' for instruction "'+i+'"':""}. Expected PublicKey or string.`)}const c=a.isOptional&&d.equals(n),u=a.isMut&&!c,y=a.isSigner&&!c;return{pubkey:d,isWritable:u,isSigner:y}}}).flat():[]}}function Ys(r,...t){}class Xs{static build(t,e){return(...i)=>{var o,s,a;const[,d]=st(t,[...i]),c=new Fn;if(d.preInstructions&&d.instructions)throw new Error("instructions is deprecated, use preInstructions");return(o=d.preInstructions)===null||o===void 0||o.forEach(u=>c.add(u)),(s=d.instructions)===null||s===void 0||s.forEach(u=>c.add(u)),c.add(e(...i)),(a=d.postInstructions)===null||a===void 0||a.forEach(u=>c.add(u)),c}}}class Js{static build(t,e,n,i){return async(...s)=>{var a;const d=e(...s),[,c]=st(t,[...s]);if(i.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");try{return await i.sendAndConfirm(d,(a=c.signers)!==null&&a!==void 0?a:[],c.options)}catch(u){throw Pr(u,n)}}}}class Qs{static build(t,e,n,i){var o;const s={};return(o=t.accounts)===null||o===void 0||o.forEach(a=>{const d=j(a.name);s[d]=new ea(t,a,n,i,e)}),s}}class ea{get size(){return this._size}get programId(){return this._programId}get provider(){return this._provider}get coder(){return this._coder}get idlAccount(){return this._idlAccount}constructor(t,e,n,i,o){this._idlAccount=e,this._programId=n,this._provider=i??He(),this._coder=o??new Nr(t),this._size=this._coder.accounts.size(e)}async fetchNullable(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);return n}async fetchNullableAndContext(t,e){const n=await this.getAccountInfoAndContext(t,e),{value:i,context:o}=n;return{data:i&&i.data.length!==0?this._coder.accounts.decode(this._idlAccount.name,i.data):null,context:o}}async fetch(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);if(n===null)throw new Error(`Account does not exist or has no data ${t.toString()}`);return n}async fetchAndContext(t,e){const{data:n,context:i}=await this.fetchNullableAndContext(t,e);if(n===null)throw new Error(`Account does not exist ${t.toString()}`);return{data:n,context:i}}async fetchMultiple(t,e){return(await this.fetchMultipleAndContext(t,e)).map(i=>i?i.data:null)}async fetchMultipleAndContext(t,e){return(await qt(this._provider.connection,t.map(i=>W(i)),e)).map(i=>{if(i==null)return null;const{account:o,context:s}=i;return{data:this._coder.accounts.decode(this._idlAccount.name,o.data),context:s}})}async all(t){const e=this.coder.accounts.memcmp(this._idlAccount.name,t instanceof V.Buffer?t:void 0),n=[];return(e==null?void 0:e.offset)!=null&&(e==null?void 0:e.bytes)!=null&&n.push({memcmp:{offset:e.offset,bytes:e.bytes}}),(e==null?void 0:e.dataSize)!=null&&n.push({dataSize:e.dataSize}),(await this._provider.connection.getProgramAccounts(this._programId,{commitment:this._provider.connection.commitment,filters:[...n,...Array.isArray(t)?t:[]]})).map(({pubkey:o,account:s})=>({publicKey:o,account:this._coder.accounts.decode(this._idlAccount.name,s.data)}))}subscribe(t,e){const n=ke.get(t.toString());if(n)return n.ee;const i=new Ro;t=W(t);const o=this._provider.connection.onAccountChange(t,s=>{const a=this._coder.accounts.decode(this._idlAccount.name,s.data);i.emit("change",a)},e);return ke.set(t.toString(),{ee:i,listener:o}),i}async unsubscribe(t){let e=ke.get(t.toString());if(!e){console.warn("Address is not subscribed");return}ke&&await this._provider.connection.removeAccountChangeListener(e.listener).then(()=>{ke.delete(t.toString())}).catch(console.error)}async createInstruction(t,e){const n=this.size;if(this._provider.publicKey===void 0)throw new Error("This function requires the Provider interface implementor to have a 'publicKey' field.");return qn.createAccount({fromPubkey:this._provider.publicKey,newAccountPubkey:t.publicKey,space:e??n,lamports:await this._provider.connection.getMinimumBalanceForRentExemption(e??n),programId:this._programId})}async associated(...t){const e=await this.associatedAddress(...t);return await this.fetch(e)}async associatedAddress(...t){return await Gr(this._programId,...t)}async getAccountInfo(t,e){return await this._provider.connection.getAccountInfo(W(t),e)}async getAccountInfoAndContext(t,e){return await this._provider.connection.getAccountInfoAndContext(W(t),e)}}const ke=new Map,Bt="Program log: ",Zr="Program data: ",ta=Bt.length,na=Zr.length;class ra{constructor(t,e,n){this._programId=t,this._provider=e,this._eventParser=new Hr(t,n),this._eventCallbacks=new Map,this._eventListeners=new Map,this._listenerIdCount=0}addEventListener(t,e){var n;let i=this._listenerIdCount;return this._listenerIdCount+=1,this._eventListeners.has(t)||this._eventListeners.set(t,[]),this._eventListeners.set(t,((n=this._eventListeners.get(t))!==null&&n!==void 0?n:[]).concat(i)),this._eventCallbacks.set(i,[t,e]),this._onLogsSubscriptionId!==void 0||(this._onLogsSubscriptionId=this._provider.connection.onLogs(this._programId,(o,s)=>{if(!o.err)for(const a of this._eventParser.parseLogs(o.logs)){const d=this._eventListeners.get(a.name);d&&d.forEach(c=>{const u=this._eventCallbacks.get(c);if(u){const[,y]=u;y(a.data,s.slot,o.signature)}})}})),i}async removeEventListener(t){const e=this._eventCallbacks.get(t);if(!e)throw new Error(`Event listener ${t} doesn't exist!`);const[n]=e;let i=this._eventListeners.get(n);if(!i)throw new Error(`Event listeners don't exist for ${n}!`);if(this._eventCallbacks.delete(t),i=i.filter(o=>o!==t),this._eventListeners.set(n,i),i.length===0&&this._eventListeners.delete(n),this._eventCallbacks.size===0){if(this._eventListeners.size!==0)throw new Error(`Expected event listeners size to be 0 but got ${this._eventListeners.size}`);this._onLogsSubscriptionId!==void 0&&(await this._provider.connection.removeOnLogsListener(this._onLogsSubscriptionId),this._onLogsSubscriptionId=void 0)}}}class Hr{constructor(t,e){this.coder=e,this.programId=t}*parseLogs(t,e=!1){const n=new oa(t),i=new ia;let o=n.next();for(;o!==null;){let[s,a,d]=this.handleLog(i,o,e);s&&(yield s),a&&i.push(a),d&&i.pop(),o=n.next()}}handleLog(t,e,n){return t.stack.length>0&&t.program()===this.programId.toString()?this.handleProgramLog(e,n):[null,...this.handleSystemLog(e)]}handleProgramLog(t,e){if(t.startsWith(Bt)||t.startsWith(Zr)){const n=t.startsWith(Bt)?t.slice(ta):t.slice(na),i=this.coder.events.decode(n);if(e&&i===null)throw new Error(`Unable to decode event ${n}`);return[i,null,!1]}else return[null,...this.handleSystemLog(t)]}handleSystemLog(t){const e=t.split(":")[0];return e.match(/^Program (.*) success/g)!==null?[null,!0]:e.startsWith(`Program ${this.programId.toString()} invoke`)?[this.programId.toString(),!1]:e.includes("invoke")?["cpi",!1]:[null,!1]}}class ia{constructor(){this.stack=[]}program(){if(!this.stack.length)throw new Error("Expected the stack to have elements");return this.stack[this.stack.length-1]}push(t){this.stack.push(t)}pop(){if(!this.stack.length)throw new Error("Expected the stack to have elements");this.stack.pop()}}class oa{constructor(t){this.logs=t}next(){if(this.logs.length===0)return null;let t=this.logs[0];return this.logs=this.logs.slice(1),t}}class sa{static build(t,e,n,i,o,s,a){return async(...c)=>{var u;const y=e(...c),[,w]=st(t,[...c]);let f;if(i.simulate===void 0)throw new Error("This function requires 'Provider.simulate' to be implemented.");try{f=await i.simulate(y,w.signers,(u=w.options)===null||u===void 0?void 0:u.commitment)}catch(g){throw Pr(g,n)}if(f===void 0)throw new Error("Unable to simulate transaction");const p=f.logs;if(!p)throw new Error("Simulated logs not found");const A=[];if(a.events){let g=new Hr(s,o);for(const E of g.parseLogs(p))A.push(E)}return{events:A,raw:p}}}}function gt(r){return new Wr(Ue(8),t=>Wt.fromBuffer(t),t=>t.toBuffer(),r)}function ze(r){return new Wr(Ue(32),t=>new q(t),t=>t.toBuffer(),r)}function mt(r,t){return new aa(r,t)}class Wr extends rt{constructor(t,e,n,i){super(t.span,i),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}class aa extends rt{constructor(t,e){super(-1,e),this.layout=t,this.discriminator=ie()}encode(t,e,n=0){return t==null?this.layout.span+this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+4)+4)}decode(t,e=0){const n=this.discriminator.decode(t,e);if(n===0)return null;if(n===1)return this.layout.decode(t,e+4);throw new Error("Invalid coption "+this.layout.property)}getSpan(t,e=0){return this.layout.getSpan(t,e+4)+4}}class Wt extends Gn{toBuffer(){const t=super.toArray().reverse(),e=V.Buffer.from(t);if(e.length===8)return e;if(e.length>=8)throw new Error("u64 too large");const n=V.Buffer.alloc(8);return e.copy(n),n}static fromBuffer(t){if(t.length!==8)throw new Error(`Invalid buffer length: ${t.length}`);return new Wt([...t].reverse().map(e=>`00${e.toString(16)}`.slice(-2)).join(""),16)}}const ca=z([ze("mint"),ze("owner"),gt("amount"),mt(ze(),"delegate"),(r=>{const t=qr(Os("discriminator"),null,r);return t.addVariant(0,z([]),"uninitialized"),t.addVariant(1,z([]),"initialized"),t.addVariant(2,z([]),"frozen"),t})("state"),mt(gt(),"isNative"),gt("delegatedAmount"),mt(ze(),"closeAuthority")]);function ua(r){return ca.decode(r)}class Oe{constructor(t,e,n,i,o,s,a,d){this._accounts=e,this._provider=n,this._programId=i,this._idlIx=o,this._idlTypes=a,this._customResolver=d,this._args=t,this._accountStore=new la(n,s,this._programId)}args(t){this._args=t}async resolve(){for(await this.resolveConst(this._idlIx.accounts),this._resolveEventCpi(this._idlIx.accounts);await this.resolvePdas(this._idlIx.accounts)+await this.resolveRelations(this._idlIx.accounts)+await this.resolveCustom()>0;);}async resolveCustom(){if(this._customResolver){const{accounts:t,resolved:e}=await this._customResolver({args:this._args,accounts:this._accounts,provider:this._provider,programId:this._programId,idlIx:this._idlIx});return this._accounts=t,e}return 0}resolveOptionalsHelper(t,e){const n={};for(const i of e){const o=i.name,s=t[o];s!==void 0&&(Yr(s)?Gs(i)?n[o]=this.resolveOptionalsHelper(s,i.accounts):n[o]=Xr(s):s!==null?n[o]=W(s):i.isOptional&&(n[o]=this._programId))}return n}resolveOptionals(t){Object.assign(this._accounts,this.resolveOptionalsHelper(t,this._idlIx.accounts))}get(t){const e=t.reduce((n,i)=>n&&n[i],this._accounts);if(e&&e.toBase58)return e}set(t,e){let n=this._accounts;t.forEach((i,o)=>{o==t.length-1&&(n[i]=e),n[i]=n[i]||{},n=n[i]})}async resolveConst(t,e=[]){for(let n=0;n<t.length;n+=1){const i=t[n],o=i.accounts;o&&await this.resolveConst(o,[...e,j(i.name)]);const s=i,a=j(i.name);if(s.isSigner&&!this.get([...e,a])){if(this._provider.wallet===void 0)throw new Error("This function requires the Provider interface implementor to have a 'wallet' field.");this.set([...e,a],this._provider.wallet.publicKey)}Reflect.has(Oe.CONST_ACCOUNTS,a)&&!this.get([...e,a])&&this.set([...e,a],Oe.CONST_ACCOUNTS[a])}}_resolveEventCpi(t,e=[]){for(const n in t){const i=t[n],o=i.accounts;o&&this._resolveEventCpi(o,[...e,j(i.name)]);const s=+n+1;if(s===t.length)return;const a=j(t[n].name),d=j(t[s].name);if(a==="eventAuthority"&&d==="program"){const c=[...e,a],u=[...e,d];this.get(c)||this.set(c,q.findProgramAddressSync([V.Buffer.from("__event_authority")],this._programId)[0]),this.get(u)||this.set(u,this._programId);return}}}async resolvePdas(t,e=[]){let n=0;for(let i=0;i<t.length;i+=1){const o=t[i],s=o.accounts;s&&(n+=await this.resolvePdas(s,[...e,j(o.name)]));const a=o,d=j(o.name);a.pda&&a.pda.seeds.length>0&&!this.get([...e,d])&&await this.autoPopulatePda(a,e)&&(n+=1)}return n}async resolveRelations(t,e=[]){let n=0;for(let i=0;i<t.length;i+=1){const o=t[i],s=o.accounts;s&&(n+=await this.resolveRelations(s,[...e,j(o.name)]));const a=o.relations||[],d=j(o.name),c=[...e,d],u=this.get(c);if(u){const y=a.filter(w=>!this.get([...e,j(w)]));if(n+=y.length,y.length>0){const w=await this._accountStore.fetchAccount({publicKey:u});await Promise.all(y.map(async f=>{const p=j(f);return this.set([...e,p],w[p]),w[p]}))}}}return n}async autoPopulatePda(t,e=[]){if(!t.pda||!t.pda.seeds)throw new Error("Must have seeds");const n=await Promise.all(t.pda.seeds.map(s=>this.toBuffer(s,e)));if(n.some(s=>typeof s>"u"))return;const i=await this.parseProgramId(t,e);if(!i)return;const[o]=await q.findProgramAddress(n,i);this.set([...e,j(t.name)],o)}async parseProgramId(t,e=[]){var n;if(!(!((n=t.pda)===null||n===void 0)&&n.programId))return this._programId;switch(t.pda.programId.kind){case"const":return new q(this.toBufferConst(t.pda.programId.value));case"arg":return this.argValue(t.pda.programId);case"account":return await this.accountValue(t.pda.programId,e);default:throw new Error(`Unexpected program seed kind: ${t.pda.programId.kind}`)}}async toBuffer(t,e=[]){switch(t.kind){case"const":return this.toBufferConst(t);case"arg":return await this.toBufferArg(t);case"account":return await this.toBufferAccount(t,e);default:throw new Error(`Unexpected seed kind: ${t.kind}`)}}getType(t,e=[]){if(e.length>0&&t.defined){const n=this._idlTypes.find(s=>s.name===t.defined);if(!n)throw new Error(`Cannot find type ${t.defined}`);const o=n.type.fields.find(s=>s.name===e[0]);return this.getType(o.type,e.slice(1))}return t}toBufferConst(t){return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),t.value)}async toBufferArg(t){const e=this.argValue(t);if(!(typeof e>"u"))return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),e)}argValue(t){const e=t.path.split("."),n=j(e[0]),i=this._idlIx.args.findIndex(o=>o.name===n);if(i===-1)throw new Error(`Unable to find argument for seed: ${n}`);return e.slice(1).reduce((o,s)=>(o||{})[s],this._args[i])}async toBufferAccount(t,e=[]){const n=await this.accountValue(t,e);if(n)return this.toBufferValue(t.type,n)}async accountValue(t,e=[]){const n=t.path.split("."),i=n[0],o=this.get([...e,j(i)]);if(o===null)throw new Error("fieldPubkey is null");if(n.length===1)return o;const s=await this._accountStore.fetchAccount({publicKey:o,name:t.account});return this.parseAccountValue(s,n.slice(1))}parseAccountValue(t,e){let n;for(;e.length>0;)n=t[j(e[0])],e=e.slice(1);return n}toBufferValue(t,e){switch(t){case"u8":return V.Buffer.from([e]);case"u16":let n=V.Buffer.alloc(2);return n.writeUInt16LE(e),n;case"u32":let i=V.Buffer.alloc(4);return i.writeUInt32LE(e),i;case"u64":let o=V.Buffer.alloc(8);return o.writeBigUInt64LE(BigInt(e)),o;case"string":return V.Buffer.from(Ir(e));case"publicKey":return e.toBuffer();default:if(t.array)return V.Buffer.from(e);throw new Error(`Unexpected seed type: ${t}`)}}}Oe.CONST_ACCOUNTS={associatedTokenProgram:Ht,rent:ni,systemProgram:qn.programId,tokenProgram:Zt,clock:ti};class la{constructor(t,e,n){this._provider=t,this._programId=n,this._cache=new Map,this._idls={},this._idls[n.toBase58()]=e}async ensureIdl(t){if(!this._idls[t.toBase58()]){const e=await Re.fetchIdl(t,this._provider);if(e){const n=new Re(e,t,this._provider);this._idls[t.toBase58()]=n.account}}return this._idls[t.toBase58()]}async fetchAccount({publicKey:t,name:e,programId:n=this._programId}){const i=t.toString();if(!this._cache.has(i))if(e==="TokenAccount"){const o=await this._provider.connection.getAccountInfo(t);if(o===null)throw new Error(`invalid account info for ${i}`);const s=ua(o.data);this._cache.set(i,s)}else if(e){const o=await this.ensureIdl(n);if(o){const s=o[j(e)];if(s){const a=await s.fetch(t);this._cache.set(i,a)}}}else{const o=await this._provider.connection.getAccountInfo(t);if(o===null)throw new Error(`invalid account info for ${i}`);const s=o.data,a=await this.ensureIdl(o.owner);if(a){const d=Object.values(a)[0];if(!d)throw new Error("No accounts for this program");const c=d.coder.accounts.decodeAny(s);this._cache.set(i,c)}}return this._cache.get(i)}}class da{static build(t,e,n,i,o,s,a,d,c,u,y){return(...w)=>new fa(w,i,o,s,a,d,t,e,n,c,u,y)}}function Yr(r){return typeof r=="object"&&r!==null&&!("_bn"in r)}function Xr(r,t){const e={};for(const n in r){const i=r[n];if(i===null)throw new Error("Failed to resolve optionals due to IDL type mismatch with input accounts!");e[n]=Yr(i)?Xr(i):W(i)}return e}class fa{constructor(t,e,n,i,o,s,a,d,c,u,y,w){this._ixFn=e,this._txFn=n,this._rpcFn=i,this._simulateFn=o,this._viewFn=s,this._programId=d,this._accounts={},this._remainingAccounts=[],this._signers=[],this._preInstructions=[],this._postInstructions=[],this._autoResolveAccounts=!0,this._args=t,this._accountsResolver=new Oe(t,this._accounts,a,d,c,u,y,w)}args(t){this._args=t,this._accountsResolver.args(t)}async pubkeys(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._accounts}accounts(t){return this._autoResolveAccounts=!0,this._accountsResolver.resolveOptionals(t),this}accountsStrict(t){return this._autoResolveAccounts=!1,this._accountsResolver.resolveOptionals(t),this}signers(t){return this._signers=this._signers.concat(t),this}remainingAccounts(t){return this._remainingAccounts=this._remainingAccounts.concat(t),this}preInstructions(t){return this._preInstructions=this._preInstructions.concat(t),this}postInstructions(t){return this._postInstructions=this._postInstructions.concat(t),this}async rpc(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._rpcFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async rpcAndKeys(t){return{pubkeys:await this.pubkeys(),signature:await this.rpc(t)}}async view(t){if(this._autoResolveAccounts&&await this._accountsResolver.resolve(),!this._viewFn)throw new Error("Method does not support views");return this._viewFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async simulate(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._simulateFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async instruction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._ixFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}async prepare(){return{instruction:await this.instruction(),pubkeys:await this.pubkeys(),signers:await this._signers}}async transaction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._txFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}}class ha{static build(t,e,n,i){const o=e.accounts.find(d=>d.isMut),s=!!e.returns;return o||!s?void 0:async(...d)=>{var c,u;let y=await n(...d);const w=`Program return: ${t} `;let f=y.raw.find(E=>E.startsWith(w));if(!f)throw new Error("View expected return log");let p=jt(f.slice(w.length)),A=e.returns;if(!A)throw new Error("View expected return type");return K.fieldLayout({type:A},Array.from([...(c=i.accounts)!==null&&c!==void 0?c:[],...(u=i.types)!==null&&u!==void 0?u:[]])).decode(p)}}}class pa{static build(t,e,n,i,o){const s={},a={},d={},c={},u={},y={},w=Fo(t),f=t.accounts?Qs.build(t,e,n,i):{};return t.instructions.forEach(p=>{const A=Xe.build(p,(M,S)=>e.instruction.encode(M,S),n),g=Xs.build(p,A),E=Js.build(p,g,w,i),T=sa.build(p,g,w,i,e,n,t),_=ha.build(n,p,T,t),m=da.build(i,n,p,A,g,E,T,_,f,t.types||[],o&&o(p)),L=j(p.name);a[L]=A,d[L]=g,s[L]=E,c[L]=T,u[L]=m,_&&(y[L]=_)}),[s,a,d,f,c,u,y]}}class Re{get programId(){return this._programId}get idl(){return this._idl}get coder(){return this._coder}get provider(){return this._provider}constructor(t,e,n,i,o){e=W(e),n||(n=He()),this._idl=t,this._provider=n,this._programId=e,this._coder=i??new Nr(t),this._events=new ra(this._programId,n,this._coder);const[s,a,d,c,u,y,w]=pa.build(t,this._coder,e,n,o??(()=>{}));this.rpc=s,this.instruction=a,this.transaction=d,this.account=c,this.simulate=u,this.methods=y,this.views=w}static async at(t,e){const n=W(t),i=await Re.fetchIdl(n,e);if(!i)throw new Error(`IDL not found for program: ${t.toString()}`);return new Re(i,n,e)}static async fetchIdl(t,e){e=e??He();const n=W(t),i=await Ks(n),o=await e.connection.getAccountInfo(i);if(!o)return null;let s=Ws(o.data.slice(8));const a=Co(s.data);return JSON.parse(Sr(a))}addEventListener(t,e){return this._events.addEventListener(t,e)}async removeEventListener(t){return await this._events.removeEventListener(t)}}new q("11111111111111111111111111111111");export{Re as P,ya as c,R as d,Oa as i};