@btc-vision/bitcoin 6.4.10 → 6.5.1

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 (220) hide show
  1. package/.babelrc +13 -4
  2. package/.mocharc.json +13 -13
  3. package/.prettierrc.json +12 -12
  4. package/CHANGELOG.md +403 -403
  5. package/CONTRIBUTING.md +83 -83
  6. package/LICENSE +21 -21
  7. package/README.md +201 -201
  8. package/browser/chunks/crypto-C6FlKKmp.js +2006 -0
  9. package/browser/chunks/payments-BE4vwHhV.js +1045 -0
  10. package/browser/chunks/psbt-Dlosf9CT.js +3853 -0
  11. package/browser/chunks/script-COWGdiOo.js +318 -0
  12. package/browser/chunks/transaction-BiXwH2v4.js +421 -0
  13. package/browser/chunks/utils-BKmkTzNZ.js +759 -0
  14. package/browser/crypto/crypto.d.ts +1 -1
  15. package/browser/index.d.ts +7 -27
  16. package/browser/index.js +92 -2
  17. package/build/index.d.ts +7 -27
  18. package/build/index.js +2 -2
  19. package/cjs/package.json +3 -3
  20. package/gulpfile.js +42 -42
  21. package/package.json +153 -150
  22. package/src/bip66.ts +107 -107
  23. package/src/block.ts +233 -233
  24. package/src/bufferutils.ts +188 -188
  25. package/src/crypto.ts +108 -108
  26. package/src/ecc_lib.ts +94 -94
  27. package/src/hooks/AdvancedSignatureManager.ts +104 -104
  28. package/src/hooks/SignatureManager.ts +84 -84
  29. package/src/index.ts +83 -105
  30. package/src/merkle.ts +31 -31
  31. package/src/opcodes.ts +280 -280
  32. package/src/payments/bip341.ts +140 -140
  33. package/src/payments/embed.ts +61 -61
  34. package/src/payments/index.ts +172 -172
  35. package/src/payments/lazy.ts +28 -28
  36. package/src/payments/p2ms.ts +156 -156
  37. package/src/payments/p2op.ts +195 -195
  38. package/src/payments/p2pk.ts +93 -93
  39. package/src/payments/p2pkh.ts +214 -214
  40. package/src/payments/p2tr.ts +309 -309
  41. package/src/psbt/bip371.ts +441 -441
  42. package/src/push_data.ts +97 -97
  43. package/src/script.ts +247 -247
  44. package/src/script_number.ts +72 -72
  45. package/src/script_signature.ts +91 -91
  46. package/src/transaction.ts +656 -656
  47. package/test/address.spec.ts +155 -155
  48. package/test/bitcoin.core.spec.ts +212 -212
  49. package/test/block.spec.ts +171 -171
  50. package/test/bufferutils.spec.ts +450 -450
  51. package/test/crypto.spec.ts +49 -49
  52. package/test/fixtures/address.json +329 -329
  53. package/test/fixtures/block.json +148 -148
  54. package/test/fixtures/bufferutils.json +102 -102
  55. package/test/fixtures/core/README.md +26 -26
  56. package/test/fixtures/core/base58_encode_decode.json +50 -50
  57. package/test/fixtures/core/base58_keys_invalid.json +152 -152
  58. package/test/fixtures/core/base58_keys_valid.json +452 -452
  59. package/test/fixtures/core/blocks.json +27 -27
  60. package/test/fixtures/core/sig_canonical.json +7 -7
  61. package/test/fixtures/core/sig_noncanonical.json +33 -33
  62. package/test/fixtures/core/sighash.json +3505 -3505
  63. package/test/fixtures/core/tx_valid.json +2023 -2023
  64. package/test/fixtures/crypto.json +43 -43
  65. package/test/fixtures/ecdsa.json +217 -217
  66. package/test/fixtures/ecpair.json +141 -141
  67. package/test/fixtures/embed.json +108 -108
  68. package/test/fixtures/p2ms.json +434 -434
  69. package/test/fixtures/p2pk.json +179 -179
  70. package/test/fixtures/p2pkh.json +276 -276
  71. package/test/fixtures/p2sh.json +508 -508
  72. package/test/fixtures/p2tr.json +1198 -1198
  73. package/test/fixtures/p2wpkh.json +290 -290
  74. package/test/fixtures/p2wsh.json +489 -489
  75. package/test/fixtures/psbt.json +924 -924
  76. package/test/fixtures/script.json +465 -465
  77. package/test/fixtures/script_number.json +225 -225
  78. package/test/fixtures/signature.json +140 -140
  79. package/test/fixtures/transaction.json +916 -916
  80. package/test/integration/_regtest.ts +6 -6
  81. package/test/integration/addresses.spec.ts +142 -142
  82. package/test/integration/bip32.spec.ts +130 -130
  83. package/test/integration/blocks.spec.ts +28 -28
  84. package/test/integration/cltv.spec.ts +241 -241
  85. package/test/integration/csv.spec.ts +452 -452
  86. package/test/integration/payments.spec.ts +110 -110
  87. package/test/integration/taproot.spec.ts +663 -663
  88. package/test/integration/transactions.spec.ts +668 -668
  89. package/test/payments.spec.ts +114 -114
  90. package/test/payments.utils.ts +165 -165
  91. package/test/psbt.spec.ts +1285 -1285
  92. package/test/script.spec.ts +186 -186
  93. package/test/script_number.spec.ts +26 -26
  94. package/test/script_signature.spec.ts +66 -66
  95. package/test/transaction.spec.ts +337 -337
  96. package/test/ts-node-register.js +7 -7
  97. package/test/tsconfig.json +48 -48
  98. package/test/types.spec.ts +53 -53
  99. package/tsconfig.base.json +27 -27
  100. package/tsconfig.json +19 -19
  101. package/tsconfig.webpack.json +18 -18
  102. package/vite.config.browser.ts +93 -0
  103. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/.ready +0 -0
  104. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/.release-please-manifest.json +0 -3
  105. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/CHANGELOG.md +0 -962
  106. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/CONTRIBUTING.md +0 -34
  107. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/LICENSE +0 -24
  108. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/README.md +0 -273
  109. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/SECURITY.md +0 -2
  110. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/addon.gypi +0 -204
  111. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/bin/node-gyp.js +0 -138
  112. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/.release-please-manifest.json +0 -3
  113. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/LICENSE +0 -28
  114. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/data/ninja/build.ninja +0 -4
  115. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc +0 -12
  116. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/GypVsCMake.md +0 -116
  117. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/Hacking.md +0 -46
  118. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/InputFormatReference.md +0 -1080
  119. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/LanguageSpecification.md +0 -430
  120. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/README.md +0 -27
  121. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/Testing.md +0 -450
  122. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/UserDocumentation.md +0 -965
  123. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp +0 -8
  124. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp.bat +0 -5
  125. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp_main.py +0 -45
  126. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +0 -365
  127. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +0 -206
  128. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +0 -1272
  129. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +0 -1547
  130. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +0 -59
  131. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +0 -153
  132. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +0 -271
  133. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +0 -574
  134. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +0 -692
  135. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/common.py +0 -711
  136. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +0 -171
  137. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +0 -169
  138. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +0 -113
  139. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +0 -55
  140. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
  141. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +0 -804
  142. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +0 -1173
  143. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +0 -1318
  144. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +0 -127
  145. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +0 -103
  146. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +0 -461
  147. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +0 -89
  148. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +0 -57
  149. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +0 -2745
  150. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +0 -3976
  151. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +0 -44
  152. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +0 -2964
  153. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +0 -67
  154. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +0 -1391
  155. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +0 -25
  156. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/input.py +0 -3115
  157. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +0 -98
  158. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +0 -771
  159. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +0 -1260
  160. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +0 -174
  161. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +0 -61
  162. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +0 -373
  163. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +0 -1938
  164. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation_test.py +0 -53
  165. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +0 -302
  166. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +0 -3198
  167. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +0 -65
  168. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE +0 -3
  169. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.APACHE +0 -177
  170. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.BSD +0 -23
  171. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/__init__.py +0 -15
  172. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_elffile.py +0 -108
  173. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_manylinux.py +0 -252
  174. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_musllinux.py +0 -83
  175. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_parser.py +0 -359
  176. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_structures.py +0 -61
  177. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_tokenizer.py +0 -192
  178. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/markers.py +0 -252
  179. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/metadata.py +0 -825
  180. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/py.typed +0 -0
  181. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/requirements.py +0 -90
  182. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/specifiers.py +0 -1030
  183. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/tags.py +0 -553
  184. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/utils.py +0 -172
  185. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/version.py +0 -563
  186. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pyproject.toml +0 -120
  187. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/release-please-config.json +0 -11
  188. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/test_gyp.py +0 -261
  189. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/Find-VisualStudio.cs +0 -250
  190. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/build.js +0 -227
  191. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/clean.js +0 -15
  192. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/configure.js +0 -328
  193. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/create-config-gypi.js +0 -150
  194. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/download.js +0 -39
  195. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-node-directory.js +0 -63
  196. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-python.js +0 -310
  197. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-visualstudio.js +0 -590
  198. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/install.js +0 -415
  199. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/list.js +0 -26
  200. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/log.js +0 -168
  201. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/node-gyp.js +0 -188
  202. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/process-release.js +0 -146
  203. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/rebuild.js +0 -12
  204. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/remove.js +0 -43
  205. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/util.js +0 -81
  206. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/macOS_Catalina_acid_test.sh +0 -21
  207. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/package.json +0 -51
  208. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/release-please-config.json +0 -40
  209. package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/src/win_delay_load_hook.cc +0 -39
  210. package/browser/index.js.LICENSE.txt +0 -14
  211. package/browser/ops.d.ts +0 -126
  212. package/build/ops.d.ts +0 -126
  213. package/build/ops.js +0 -127
  214. package/coverage/tmp/coverage-31752-1735543485354-0.json +0 -1
  215. package/coverage/tmp/coverage-59920-1735543484555-0.json +0 -1
  216. package/coverage/tmp/coverage-66252-1735543483919-0.json +0 -1
  217. package/coverage/tmp/coverage-68440-1735543485236-0.json +0 -1
  218. package/coverage/tmp/coverage-70588-1735543484426-0.json +0 -1
  219. package/coverage/tmp/coverage-79292-1735543485296-0.json +0 -1
  220. package/coverage/tmp/coverage-80212-1735543483980-0.json +0 -1
@@ -0,0 +1,759 @@
1
+ import { B as A, g as fn, f as R } from "./crypto-C6FlKKmp.js";
2
+ import { o as _ } from "./script-COWGdiOo.js";
3
+ function Cn(n) {
4
+ if (n.length < 8 || n.length > 72 || n[0] !== 48 || n[1] !== n.length - 2 || n[2] !== 2) return !1;
5
+ const r = n[3];
6
+ if (r === 0 || 5 + r >= n.length || n[4 + r] !== 2) return !1;
7
+ const t = n[5 + r];
8
+ return !(t === 0 || 6 + r + t !== n.length || n[4] & 128 || r > 1 && n[4] === 0 && !(n[5] & 128) || n[r + 6] & 128 || t > 1 && n[r + 6] === 0 && !(n[r + 7] & 128));
9
+ }
10
+ function Fn(n) {
11
+ if (n.length < 8) throw new Error("DER sequence length is too short");
12
+ if (n.length > 72) throw new Error("DER sequence length is too long");
13
+ if (n[0] !== 48) throw new Error("Expected DER sequence");
14
+ if (n[1] !== n.length - 2) throw new Error("DER sequence length is invalid");
15
+ if (n[2] !== 2) throw new Error("Expected DER integer");
16
+ const r = n[3];
17
+ if (r === 0) throw new Error("R length is zero");
18
+ if (5 + r >= n.length) throw new Error("R length is too long");
19
+ if (n[4 + r] !== 2) throw new Error("Expected DER integer (2)");
20
+ const t = n[5 + r];
21
+ if (t === 0) throw new Error("S length is zero");
22
+ if (6 + r + t !== n.length) throw new Error("S length is invalid");
23
+ if (n[4] & 128) throw new Error("R value is negative");
24
+ if (r > 1 && n[4] === 0 && !(n[5] & 128))
25
+ throw new Error("R value excessively padded");
26
+ if (n[r + 6] & 128) throw new Error("S value is negative");
27
+ if (t > 1 && n[r + 6] === 0 && !(n[r + 7] & 128))
28
+ throw new Error("S value excessively padded");
29
+ return {
30
+ r: n.slice(4, 4 + r),
31
+ s: n.slice(6 + r)
32
+ };
33
+ }
34
+ function Mn(n, r) {
35
+ const t = n.length, e = r.length;
36
+ if (t === 0) throw new Error("R length is zero");
37
+ if (e === 0) throw new Error("S length is zero");
38
+ if (t > 33) throw new Error("R length is too long");
39
+ if (e > 33) throw new Error("S length is too long");
40
+ if (n[0] & 128) throw new Error("R value is negative");
41
+ if (r[0] & 128) throw new Error("S value is negative");
42
+ if (t > 1 && n[0] === 0 && !(n[1] & 128)) throw new Error("R value excessively padded");
43
+ if (e > 1 && r[0] === 0 && !(r[1] & 128)) throw new Error("S value excessively padded");
44
+ const a = A.allocUnsafe(6 + t + e);
45
+ return a[0] = 48, a[1] = a.length - 2, a[2] = 2, a[3] = n.length, n.copy(a, 4), a[4 + t] = 2, a[5 + t] = r.length, r.copy(a, 6 + t), a;
46
+ }
47
+ function cn(n) {
48
+ return n < _.OP_PUSHDATA1 ? 1 : n <= 255 ? 2 : n <= 65535 ? 3 : 5;
49
+ }
50
+ function zn(n, r, t) {
51
+ const e = cn(r);
52
+ return e === 1 ? n.writeUInt8(r, t) : e === 2 ? (n.writeUInt8(_.OP_PUSHDATA1, t), n.writeUInt8(r, t + 1)) : e === 3 ? (n.writeUInt8(_.OP_PUSHDATA2, t), n.writeUInt16LE(r, t + 1)) : (n.writeUInt8(_.OP_PUSHDATA4, t), n.writeUInt32LE(r, t + 1)), e;
53
+ }
54
+ function Xn(n, r) {
55
+ const t = n.readUInt8(r);
56
+ let e, a;
57
+ if (t < _.OP_PUSHDATA1)
58
+ e = t, a = 1;
59
+ else if (t === _.OP_PUSHDATA1) {
60
+ if (r + 2 > n.length) return null;
61
+ e = n.readUInt8(r + 1), a = 2;
62
+ } else if (t === _.OP_PUSHDATA2) {
63
+ if (r + 3 > n.length) return null;
64
+ e = n.readUInt16LE(r + 1), a = 3;
65
+ } else {
66
+ if (r + 5 > n.length) return null;
67
+ if (t !== _.OP_PUSHDATA4) throw new Error("Unexpected opcode");
68
+ e = n.readUInt32LE(r + 1), a = 5;
69
+ }
70
+ return {
71
+ opcode: t,
72
+ number: e,
73
+ size: a
74
+ };
75
+ }
76
+ var p, q;
77
+ function j() {
78
+ if (q) return p;
79
+ q = 1;
80
+ var n = {
81
+ Array: function(t) {
82
+ return t != null && t.constructor === Array;
83
+ },
84
+ Boolean: function(t) {
85
+ return typeof t == "boolean";
86
+ },
87
+ Function: function(t) {
88
+ return typeof t == "function";
89
+ },
90
+ Nil: function(t) {
91
+ return t == null;
92
+ },
93
+ Number: function(t) {
94
+ return typeof t == "number";
95
+ },
96
+ Object: function(t) {
97
+ return typeof t == "object";
98
+ },
99
+ String: function(t) {
100
+ return typeof t == "string";
101
+ },
102
+ "": function() {
103
+ return !0;
104
+ }
105
+ };
106
+ n.Null = n.Nil;
107
+ for (var r in n)
108
+ n[r].toJSON = function(t) {
109
+ return t;
110
+ }.bind(null, r);
111
+ return p = n, p;
112
+ }
113
+ var P, H;
114
+ function z() {
115
+ if (H) return P;
116
+ H = 1;
117
+ var n = j();
118
+ function r(i) {
119
+ return i.name || i.toString().match(/function (.*?)\s*\(/)[1];
120
+ }
121
+ function t(i) {
122
+ return n.Nil(i) ? "" : r(i.constructor);
123
+ }
124
+ function e(i) {
125
+ return n.Function(i) ? "" : n.String(i) ? JSON.stringify(i) : i && n.Object(i) ? "" : i;
126
+ }
127
+ function a(i, f) {
128
+ Error.captureStackTrace && Error.captureStackTrace(i, f);
129
+ }
130
+ function d(i) {
131
+ return n.Function(i) ? i.toJSON ? i.toJSON() : r(i) : n.Array(i) ? "Array" : i && n.Object(i) ? "Object" : i !== void 0 ? i : "";
132
+ }
133
+ function N(i, f, o) {
134
+ var u = e(f);
135
+ return "Expected " + d(i) + ", got" + (o !== "" ? " " + o : "") + (u !== "" ? " " + u : "");
136
+ }
137
+ function l(i, f, o) {
138
+ o = o || t(f), this.message = N(i, f, o), a(this, l), this.__type = i, this.__value = f, this.__valueTypeName = o;
139
+ }
140
+ l.prototype = Object.create(Error.prototype), l.prototype.constructor = l;
141
+ function E(i, f, o, u, s) {
142
+ var g = '" of type ';
143
+ return f === "key" && (g = '" with key type '), N('property "' + d(o) + g + d(i), u, s);
144
+ }
145
+ function h(i, f, o, u, s) {
146
+ i ? (s = s || t(u), this.message = E(i, o, f, u, s)) : this.message = 'Unexpected property "' + f + '"', a(this, l), this.__label = o, this.__property = f, this.__type = i, this.__value = u, this.__valueTypeName = s;
147
+ }
148
+ h.prototype = Object.create(Error.prototype), h.prototype.constructor = l;
149
+ function x(i, f) {
150
+ return new l(i, {}, f);
151
+ }
152
+ function y(i, f, o) {
153
+ return i instanceof h ? (f = f + "." + i.__property, i = new h(
154
+ i.__type,
155
+ f,
156
+ i.__label,
157
+ i.__value,
158
+ i.__valueTypeName
159
+ )) : i instanceof l && (i = new h(
160
+ i.__type,
161
+ f,
162
+ o,
163
+ i.__value,
164
+ i.__valueTypeName
165
+ )), a(i), i;
166
+ }
167
+ return P = {
168
+ TfTypeError: l,
169
+ TfPropertyTypeError: h,
170
+ tfCustomError: x,
171
+ tfSubError: y,
172
+ tfJSON: d,
173
+ getValueTypeName: t
174
+ }, P;
175
+ }
176
+ var V, D;
177
+ function un() {
178
+ if (D) return V;
179
+ D = 1;
180
+ var n = j(), r = z();
181
+ function t(c) {
182
+ return A.isBuffer(c);
183
+ }
184
+ function e(c) {
185
+ return typeof c == "string" && /^([0-9a-f]{2})+$/i.test(c);
186
+ }
187
+ function a(c, L) {
188
+ var U = c.toJSON();
189
+ function B(O) {
190
+ if (!c(O)) return !1;
191
+ if (O.length === L) return !0;
192
+ throw r.tfCustomError(U + "(Length: " + L + ")", U + "(Length: " + O.length + ")");
193
+ }
194
+ return B.toJSON = function() {
195
+ return U;
196
+ }, B;
197
+ }
198
+ var d = a.bind(null, n.Array), N = a.bind(null, t), l = a.bind(null, e), E = a.bind(null, n.String);
199
+ function h(c, L, U) {
200
+ U = U || n.Number;
201
+ function B(O, on) {
202
+ return U(O, on) && O > c && O < L;
203
+ }
204
+ return B.toJSON = function() {
205
+ return `${U.toJSON()} between [${c}, ${L}]`;
206
+ }, B;
207
+ }
208
+ var x = Math.pow(2, 53) - 1;
209
+ function y(c) {
210
+ return typeof c == "number" && isFinite(c);
211
+ }
212
+ function i(c) {
213
+ return c << 24 >> 24 === c;
214
+ }
215
+ function f(c) {
216
+ return c << 16 >> 16 === c;
217
+ }
218
+ function o(c) {
219
+ return (c | 0) === c;
220
+ }
221
+ function u(c) {
222
+ return typeof c == "number" && c >= -x && c <= x && Math.floor(c) === c;
223
+ }
224
+ function s(c) {
225
+ return (c & 255) === c;
226
+ }
227
+ function g(c) {
228
+ return (c & 65535) === c;
229
+ }
230
+ function m(c) {
231
+ return c >>> 0 === c;
232
+ }
233
+ function I(c) {
234
+ return typeof c == "number" && c >= 0 && c <= x && Math.floor(c) === c;
235
+ }
236
+ var S = {
237
+ ArrayN: d,
238
+ Buffer: t,
239
+ BufferN: N,
240
+ Finite: y,
241
+ Hex: e,
242
+ HexN: l,
243
+ Int8: i,
244
+ Int16: f,
245
+ Int32: o,
246
+ Int53: u,
247
+ Range: h,
248
+ StringN: E,
249
+ UInt8: s,
250
+ UInt16: g,
251
+ UInt32: m,
252
+ UInt53: I
253
+ };
254
+ for (var T in S)
255
+ S[T].toJSON = function(c) {
256
+ return c;
257
+ }.bind(null, T);
258
+ return V = S, V;
259
+ }
260
+ var $, C;
261
+ function sn() {
262
+ if (C) return $;
263
+ C = 1;
264
+ var n = z(), r = j(), t = n.tfJSON, e = n.TfTypeError, a = n.TfPropertyTypeError, d = n.tfSubError, N = n.getValueTypeName, l = {
265
+ arrayOf: function(f, o) {
266
+ f = E(f), o = o || {};
267
+ function u(s, g) {
268
+ return !r.Array(s) || r.Nil(s) || o.minLength !== void 0 && s.length < o.minLength || o.maxLength !== void 0 && s.length > o.maxLength || o.length !== void 0 && s.length !== o.length ? !1 : s.every(function(m, I) {
269
+ try {
270
+ return h(f, m, g);
271
+ } catch (S) {
272
+ throw d(S, I);
273
+ }
274
+ });
275
+ }
276
+ return u.toJSON = function() {
277
+ var s = "[" + t(f) + "]";
278
+ return o.length !== void 0 ? s += "{" + o.length + "}" : (o.minLength !== void 0 || o.maxLength !== void 0) && (s += "{" + (o.minLength === void 0 ? 0 : o.minLength) + "," + (o.maxLength === void 0 ? 1 / 0 : o.maxLength) + "}"), s;
279
+ }, u;
280
+ },
281
+ maybe: function i(f) {
282
+ f = E(f);
283
+ function o(u, s) {
284
+ return r.Nil(u) || f(u, s, i);
285
+ }
286
+ return o.toJSON = function() {
287
+ return "?" + t(f);
288
+ }, o;
289
+ },
290
+ map: function(f, o) {
291
+ f = E(f), o && (o = E(o));
292
+ function u(s, g) {
293
+ if (!r.Object(s) || r.Nil(s)) return !1;
294
+ for (var m in s) {
295
+ try {
296
+ o && h(o, m, g);
297
+ } catch (S) {
298
+ throw d(S, m, "key");
299
+ }
300
+ try {
301
+ var I = s[m];
302
+ h(f, I, g);
303
+ } catch (S) {
304
+ throw d(S, m);
305
+ }
306
+ }
307
+ return !0;
308
+ }
309
+ return o ? u.toJSON = function() {
310
+ return "{" + t(o) + ": " + t(f) + "}";
311
+ } : u.toJSON = function() {
312
+ return "{" + t(f) + "}";
313
+ }, u;
314
+ },
315
+ object: function(f) {
316
+ var o = {};
317
+ for (var u in f)
318
+ o[u] = E(f[u]);
319
+ function s(g, m) {
320
+ if (!r.Object(g) || r.Nil(g)) return !1;
321
+ var I;
322
+ try {
323
+ for (I in o) {
324
+ var S = o[I], T = g[I];
325
+ h(S, T, m);
326
+ }
327
+ } catch (c) {
328
+ throw d(c, I);
329
+ }
330
+ if (m) {
331
+ for (I in g)
332
+ if (!o[I])
333
+ throw new a(void 0, I);
334
+ }
335
+ return !0;
336
+ }
337
+ return s.toJSON = function() {
338
+ return t(o);
339
+ }, s;
340
+ },
341
+ anyOf: function() {
342
+ var f = [].slice.call(arguments).map(E);
343
+ function o(u, s) {
344
+ return f.some(function(g) {
345
+ try {
346
+ return h(g, u, s);
347
+ } catch {
348
+ return !1;
349
+ }
350
+ });
351
+ }
352
+ return o.toJSON = function() {
353
+ return f.map(t).join("|");
354
+ }, o;
355
+ },
356
+ allOf: function() {
357
+ var f = [].slice.call(arguments).map(E);
358
+ function o(u, s) {
359
+ return f.every(function(g) {
360
+ try {
361
+ return h(g, u, s);
362
+ } catch {
363
+ return !1;
364
+ }
365
+ });
366
+ }
367
+ return o.toJSON = function() {
368
+ return f.map(t).join(" & ");
369
+ }, o;
370
+ },
371
+ quacksLike: function(f) {
372
+ function o(u) {
373
+ return f === N(u);
374
+ }
375
+ return o.toJSON = function() {
376
+ return f;
377
+ }, o;
378
+ },
379
+ tuple: function() {
380
+ var f = [].slice.call(arguments).map(E);
381
+ function o(u, s) {
382
+ return r.Nil(u) || r.Nil(u.length) || s && u.length !== f.length ? !1 : f.every(function(g, m) {
383
+ try {
384
+ return h(g, u[m], s);
385
+ } catch (I) {
386
+ throw d(I, m);
387
+ }
388
+ });
389
+ }
390
+ return o.toJSON = function() {
391
+ return "(" + f.map(t).join(", ") + ")";
392
+ }, o;
393
+ },
394
+ value: function(f) {
395
+ function o(u) {
396
+ return u === f;
397
+ }
398
+ return o.toJSON = function() {
399
+ return f;
400
+ }, o;
401
+ }
402
+ };
403
+ l.oneOf = l.anyOf;
404
+ function E(i) {
405
+ if (r.String(i))
406
+ return i[0] === "?" ? l.maybe(i.slice(1)) : r[i] || l.quacksLike(i);
407
+ if (i && r.Object(i)) {
408
+ if (r.Array(i)) {
409
+ if (i.length !== 1) throw new TypeError("Expected compile() parameter of type Array of length 1");
410
+ return l.arrayOf(i[0]);
411
+ }
412
+ return l.object(i);
413
+ } else if (r.Function(i))
414
+ return i;
415
+ return l.value(i);
416
+ }
417
+ function h(i, f, o, u) {
418
+ if (r.Function(i)) {
419
+ if (i(f, o)) return !0;
420
+ throw new e(u || i, f);
421
+ }
422
+ return h(E(i), f, o);
423
+ }
424
+ for (var x in r)
425
+ h[x] = r[x];
426
+ for (x in l)
427
+ h[x] = l[x];
428
+ var y = un();
429
+ for (x in y)
430
+ h[x] = y[x];
431
+ return h.compile = E, h.TfTypeError = e, h.TfPropertyTypeError = a, $ = h, $;
432
+ }
433
+ var an = sn();
434
+ const hn = /* @__PURE__ */ fn(an), w = hn, F = R.alloc(32, 0), M = R.from(
435
+ "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",
436
+ "hex"
437
+ );
438
+ function ln(n, r) {
439
+ return n.length !== r.length ? !1 : n.every((t, e) => t.equals(r[e]));
440
+ }
441
+ function gn(n) {
442
+ if (!R.isBuffer(n) || n.length < 33) return !1;
443
+ const r = n[0], t = n.slice(1, 33);
444
+ if (t.compare(F) === 0 || t.compare(M) >= 0) return !1;
445
+ if ((r === 2 || r === 3) && n.length === 33)
446
+ return !0;
447
+ if (n.length !== 65) return !1;
448
+ const e = n.slice(33);
449
+ return e.compare(F) === 0 || e.compare(M) >= 0 ? !1 : r === 4 || r === 6 || r === 7;
450
+ }
451
+ const wn = 21 * 1e14;
452
+ function dn(n) {
453
+ return w.UInt53(n) && n <= wn;
454
+ }
455
+ const X = 254;
456
+ function G(n) {
457
+ return !n || !("output" in n) || !R.isBuffer(n.output) ? !1 : n.version !== void 0 ? (n.version & X) === n.version : !0;
458
+ }
459
+ function b(n) {
460
+ return Y(n) ? n.length !== 2 ? !1 : n.every((r) => b(r)) : G(n);
461
+ }
462
+ const En = w.BufferN(32), mn = w.BufferN(20), In = w.BufferN(32), xn = w.Number, Y = w.Array, Sn = w.Boolean, Nn = w.String, J = w.Buffer, Un = w.Hex, _n = w.maybe, v = w.tuple, On = w.UInt8, k = w.UInt32, yn = w.Function, An = w.BufferN, Ln = w.Null, Bn = w.oneOf, Tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
463
+ __proto__: null,
464
+ Array: Y,
465
+ Boolean: Sn,
466
+ Buffer: J,
467
+ Buffer256bit: En,
468
+ BufferN: An,
469
+ Function: yn,
470
+ Hash160bit: mn,
471
+ Hash256bit: In,
472
+ Hex: Un,
473
+ Null: Ln,
474
+ Number: xn,
475
+ Satoshi: dn,
476
+ String: Nn,
477
+ TAPLEAF_VERSION_MASK: X,
478
+ UInt32: k,
479
+ UInt8: On,
480
+ isPoint: gn,
481
+ isTapleaf: G,
482
+ isTaptree: b,
483
+ maybe: _n,
484
+ oneOf: Bn,
485
+ stacksEqual: ln,
486
+ tuple: v,
487
+ typeforce: w
488
+ }, Symbol.toStringTag, { value: "Module" })), Z = "0123456789abcdefABCDEF";
489
+ Z.split("").map((n) => n.codePointAt(0));
490
+ Array(256).fill(!0).map((n, r) => {
491
+ const t = String.fromCodePoint(r), e = Z.indexOf(t);
492
+ return e < 0 ? void 0 : e < 16 ? e : e - 6;
493
+ });
494
+ new TextEncoder();
495
+ new TextDecoder();
496
+ function Rn(n, r, t, e) {
497
+ if (r + 2 > n.length)
498
+ throw new Error("Offset is outside the bounds of Uint8Array");
499
+ if (e = e.toUpperCase(), t > 65535)
500
+ throw new Error(`The value of "value" is out of range. It must be >= 0 and <= 65535. Received ${t}`);
501
+ e === "LE" ? (n[r] = t & 255, n[r + 1] = t >> 8 & 255) : (n[r] = t >> 8 & 255, n[r + 1] = t & 255);
502
+ }
503
+ function pn(n, r, t, e) {
504
+ if (r + 4 > n.length)
505
+ throw new Error("Offset is outside the bounds of Uint8Array");
506
+ if (e = e.toUpperCase(), t > 4294967295)
507
+ throw new Error(`The value of "value" is out of range. It must be >= 0 and <= ${4294967295}. Received ${t}`);
508
+ e === "LE" ? (n[r] = t & 255, n[r + 1] = t >> 8 & 255, n[r + 2] = t >> 16 & 255, n[r + 3] = t >> 24 & 255) : (n[r] = t >> 24 & 255, n[r + 1] = t >> 16 & 255, n[r + 2] = t >> 8 & 255, n[r + 3] = t & 255);
509
+ }
510
+ function Pn(n, r, t, e) {
511
+ if (r + 8 > n.length)
512
+ throw new Error("Offset is outside the bounds of Uint8Array");
513
+ if (e = e.toUpperCase(), t > 0xffffffffffffffffn)
514
+ throw new Error(`The value of "value" is out of range. It must be >= 0 and <= ${0xffffffffffffffffn}. Received ${t}`);
515
+ e === "LE" ? (n[r] = Number(t & 0xffn), n[r + 1] = Number(t >> 8n & 0xffn), n[r + 2] = Number(t >> 16n & 0xffn), n[r + 3] = Number(t >> 24n & 0xffn), n[r + 4] = Number(t >> 32n & 0xffn), n[r + 5] = Number(t >> 40n & 0xffn), n[r + 6] = Number(t >> 48n & 0xffn), n[r + 7] = Number(t >> 56n & 0xffn)) : (n[r] = Number(t >> 56n & 0xffn), n[r + 1] = Number(t >> 48n & 0xffn), n[r + 2] = Number(t >> 40n & 0xffn), n[r + 3] = Number(t >> 32n & 0xffn), n[r + 4] = Number(t >> 24n & 0xffn), n[r + 5] = Number(t >> 16n & 0xffn), n[r + 6] = Number(t >> 8n & 0xffn), n[r + 7] = Number(t & 0xffn));
516
+ }
517
+ function Vn(n, r, t) {
518
+ if (r + 2 > n.length)
519
+ throw new Error("Offset is outside the bounds of Uint8Array");
520
+ if (t = t.toUpperCase(), t === "LE") {
521
+ let e = 0;
522
+ return e = (e << 8) + n[r + 1], e = (e << 8) + n[r], e;
523
+ } else {
524
+ let e = 0;
525
+ return e = (e << 8) + n[r], e = (e << 8) + n[r + 1], e;
526
+ }
527
+ }
528
+ function $n(n, r, t) {
529
+ if (r + 4 > n.length)
530
+ throw new Error("Offset is outside the bounds of Uint8Array");
531
+ if (t = t.toUpperCase(), t === "LE") {
532
+ let e = 0;
533
+ return e = (e << 8) + n[r + 3] >>> 0, e = (e << 8) + n[r + 2] >>> 0, e = (e << 8) + n[r + 1] >>> 0, e = (e << 8) + n[r] >>> 0, e;
534
+ } else {
535
+ let e = 0;
536
+ return e = (e << 8) + n[r] >>> 0, e = (e << 8) + n[r + 1] >>> 0, e = (e << 8) + n[r + 2] >>> 0, e = (e << 8) + n[r + 3] >>> 0, e;
537
+ }
538
+ }
539
+ function jn(n, r, t) {
540
+ if (r + 8 > n.length)
541
+ throw new Error("Offset is outside the bounds of Uint8Array");
542
+ if (t = t.toUpperCase(), t === "LE") {
543
+ let e = 0n;
544
+ return e = (e << 8n) + BigInt(n[r + 7]), e = (e << 8n) + BigInt(n[r + 6]), e = (e << 8n) + BigInt(n[r + 5]), e = (e << 8n) + BigInt(n[r + 4]), e = (e << 8n) + BigInt(n[r + 3]), e = (e << 8n) + BigInt(n[r + 2]), e = (e << 8n) + BigInt(n[r + 1]), e = (e << 8n) + BigInt(n[r]), e;
545
+ } else {
546
+ let e = 0n;
547
+ return e = (e << 8n) + BigInt(n[r]), e = (e << 8n) + BigInt(n[r + 1]), e = (e << 8n) + BigInt(n[r + 2]), e = (e << 8n) + BigInt(n[r + 3]), e = (e << 8n) + BigInt(n[r + 4]), e = (e << 8n) + BigInt(n[r + 5]), e = (e << 8n) + BigInt(n[r + 6]), e = (e << 8n) + BigInt(n[r + 7]), e;
548
+ }
549
+ }
550
+ const Jn = (n) => {
551
+ if (n < 0 || n > 0xffffffffffffffffn)
552
+ throw new RangeError("value out of range");
553
+ };
554
+ function vn(n) {
555
+ if (n < 0 || n > Number.MAX_SAFE_INTEGER || n % 1 !== 0)
556
+ throw new RangeError("value out of range");
557
+ }
558
+ function Q(n) {
559
+ typeof n == "number" ? vn(n) : Jn(n);
560
+ }
561
+ function W(n, r, t) {
562
+ Q(n), t === void 0 && (t = 0), r === void 0 && (r = new Uint8Array(nn(n)));
563
+ let e = 0;
564
+ return n < 253 ? (r.set([Number(n)], t), e = 1) : n <= 65535 ? (r.set([253], t), Rn(r, t + 1, Number(n), "LE"), e = 3) : n <= 4294967295 ? (r.set([254], t), pn(r, t + 1, Number(n), "LE"), e = 5) : (r.set([255], t), Pn(r, t + 1, BigInt(n), "LE"), e = 9), { buffer: r, bytes: e };
565
+ }
566
+ function K(n, r) {
567
+ r === void 0 && (r = 0);
568
+ const t = n.at(r);
569
+ if (t === void 0)
570
+ throw new Error("buffer too small");
571
+ if (t < 253)
572
+ return { numberValue: t, bigintValue: BigInt(t), bytes: 1 };
573
+ if (t === 253) {
574
+ const e = Vn(n, r + 1, "LE");
575
+ return {
576
+ numberValue: e,
577
+ bigintValue: BigInt(e),
578
+ bytes: 3
579
+ };
580
+ } else if (t === 254) {
581
+ const e = $n(n, r + 1, "LE");
582
+ return {
583
+ numberValue: e,
584
+ bigintValue: BigInt(e),
585
+ bytes: 5
586
+ };
587
+ } else {
588
+ const e = jn(n, r + 1, "LE");
589
+ return { numberValue: e <= Number.MAX_SAFE_INTEGER ? Number(e) : null, bigintValue: e, bytes: 9 };
590
+ }
591
+ }
592
+ function nn(n) {
593
+ return Q(n), n < 253 ? 1 : n <= 65535 ? 3 : n <= 4294967295 ? 5 : 9;
594
+ }
595
+ const Gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
596
+ __proto__: null,
597
+ decode: K,
598
+ encode: W,
599
+ encodingLength: nn
600
+ }, Symbol.toStringTag, { value: "Module" })), { typeforce: rn } = Tn;
601
+ function tn(n, r) {
602
+ if (typeof n != "number") throw new Error("cannot write a non-number as a number");
603
+ if (n < 0) throw new Error("specified a negative value for writing an unsigned value");
604
+ if (n > r) throw new Error("RangeError: value out of range");
605
+ if (Math.floor(n) !== n) throw new Error("value has a fractional component");
606
+ }
607
+ function kn(n, r) {
608
+ const t = n.readUInt32LE(r);
609
+ let e = n.readUInt32LE(r + 4);
610
+ return e *= 4294967296, tn(e + t, 9007199254740991), e + t;
611
+ }
612
+ function qn(n, r, t) {
613
+ return tn(r, 9007199254740991), n.writeInt32LE(r & -1, t), n.writeUInt32LE(Math.floor(r / 4294967296), t + 4), t + 8;
614
+ }
615
+ function bn(n) {
616
+ if (n.length < 1) return n;
617
+ let r = n.length - 1, t = 0;
618
+ for (let e = 0; e < n.length / 2; e++)
619
+ t = n[e], n[e] = n[r], n[r] = t, r--;
620
+ return n;
621
+ }
622
+ function Yn(n) {
623
+ const r = A.allocUnsafe(n.length);
624
+ return n.copy(r), r;
625
+ }
626
+ class en {
627
+ constructor(r, t = 0) {
628
+ this.buffer = r, this.offset = t, rn(v(J, k), [r, t]);
629
+ }
630
+ static withCapacity(r) {
631
+ return new en(A.alloc(r));
632
+ }
633
+ writeUInt8(r) {
634
+ this.offset = this.buffer.writeUInt8(r, this.offset);
635
+ }
636
+ writeInt32(r) {
637
+ this.offset = this.buffer.writeInt32LE(r, this.offset);
638
+ }
639
+ writeUInt32(r) {
640
+ this.offset = this.buffer.writeUInt32LE(r, this.offset);
641
+ }
642
+ writeUInt64(r) {
643
+ this.offset = qn(this.buffer, r, this.offset);
644
+ }
645
+ writeVarInt(r) {
646
+ const t = W(r, this.buffer, this.offset);
647
+ this.offset += t.bytes;
648
+ }
649
+ writeSlice(r) {
650
+ if (this.buffer.length < this.offset + r.length)
651
+ throw new Error("Cannot write slice out of bounds");
652
+ this.offset += r.copy(this.buffer, this.offset);
653
+ }
654
+ writeVarSlice(r) {
655
+ this.writeVarInt(r.length), this.writeSlice(r);
656
+ }
657
+ writeVector(r) {
658
+ this.writeVarInt(r.length), r.forEach((t) => this.writeVarSlice(t));
659
+ }
660
+ end() {
661
+ if (this.buffer.length === this.offset)
662
+ return this.buffer;
663
+ throw new Error(`buffer size ${this.buffer.length}, offset ${this.offset}`);
664
+ }
665
+ }
666
+ class Zn {
667
+ constructor(r, t = 0) {
668
+ this.buffer = r, this.offset = t, rn(v(J, k), [r, t]);
669
+ }
670
+ readUInt8() {
671
+ const r = this.buffer.readUInt8(this.offset);
672
+ return this.offset++, r;
673
+ }
674
+ readInt32() {
675
+ const r = this.buffer.readInt32LE(this.offset);
676
+ return this.offset += 4, r;
677
+ }
678
+ readUInt32() {
679
+ const r = this.buffer.readUInt32LE(this.offset);
680
+ return this.offset += 4, r;
681
+ }
682
+ readUInt64() {
683
+ const r = kn(this.buffer, this.offset);
684
+ return this.offset += 8, r;
685
+ }
686
+ readVarInt() {
687
+ const r = K(this.buffer, this.offset);
688
+ return this.offset += r.bytes, r.numberValue || 0;
689
+ }
690
+ readSlice(r) {
691
+ if (this.buffer.length < this.offset + r)
692
+ throw new Error("Cannot read slice out of bounds");
693
+ const t = A.from(this.buffer.subarray(this.offset, this.offset + r));
694
+ return this.offset += r, t;
695
+ }
696
+ readVarSlice() {
697
+ return this.readSlice(this.readVarInt());
698
+ }
699
+ readVector() {
700
+ const r = this.readVarInt(), t = [];
701
+ for (let e = 0; e < r; e++) t.push(this.readVarSlice());
702
+ return t;
703
+ }
704
+ }
705
+ function Qn(n, r) {
706
+ if (!Array.isArray(n)) throw TypeError("Expected values Array");
707
+ if (typeof r != "function") throw TypeError("Expected digest Function");
708
+ let t = n.length;
709
+ const e = n.concat();
710
+ for (; t > 1; ) {
711
+ let a = 0;
712
+ for (let d = 0; d < t; d += 2, ++a) {
713
+ const N = e[d], l = d + 1 === t ? N : e[d + 1], E = A.concat([N, l]);
714
+ e[a] = r(E);
715
+ }
716
+ t = a;
717
+ }
718
+ return e[0];
719
+ }
720
+ export {
721
+ Y as A,
722
+ en as B,
723
+ Xn as C,
724
+ Nn as D,
725
+ Un as E,
726
+ yn as F,
727
+ Cn as G,
728
+ mn as H,
729
+ Ln as N,
730
+ dn as S,
731
+ X as T,
732
+ On as U,
733
+ v as a,
734
+ G as b,
735
+ Yn as c,
736
+ Gn as d,
737
+ kn as e,
738
+ Zn as f,
739
+ nn as g,
740
+ W as h,
741
+ b as i,
742
+ gn as j,
743
+ Tn as k,
744
+ In as l,
745
+ k as m,
746
+ _n as n,
747
+ J as o,
748
+ xn as p,
749
+ Qn as q,
750
+ bn as r,
751
+ ln as s,
752
+ w as t,
753
+ Fn as u,
754
+ An as v,
755
+ qn as w,
756
+ Mn as x,
757
+ cn as y,
758
+ zn as z
759
+ };