@ghostlytools/cli 1.11.3 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/README.md +52 -30
  2. package/SKILL.md +4 -2
  3. package/dist/assets/{api-DBlaoz8i.js → api-DLzCtePC.js} +533 -195
  4. package/dist/assets/api-DLzCtePC.js.map +1 -0
  5. package/dist/assets/{api-DgU4MZPD.js → api-DYMKyb1k.js} +2 -2
  6. package/dist/assets/{apiKit-DesObIDf.js → apiKit-CVaEzKWQ.js} +104 -21
  7. package/dist/assets/apiKit-CVaEzKWQ.js.map +1 -0
  8. package/dist/assets/appFetch-D56GsYuq.js +602 -0
  9. package/dist/assets/appFetch-D56GsYuq.js.map +1 -0
  10. package/dist/assets/apps-BPFW19Wc.js +1 -0
  11. package/dist/assets/{apps-DkMjDHML.js → apps-XnZ8VEuj.js} +66 -38
  12. package/dist/assets/apps-XnZ8VEuj.js.map +1 -0
  13. package/dist/assets/{argon2id-088uQfnH.js → argon2id-B9wFdSj6.js} +2 -3
  14. package/dist/assets/{argon2id-088uQfnH.js.map → argon2id-B9wFdSj6.js.map} +1 -1
  15. package/dist/assets/{arkade-CarKONmH.js → arkade-DryM-q5n.js} +6 -7
  16. package/dist/assets/arkade-DryM-q5n.js.map +1 -0
  17. package/dist/assets/backup-COX6j1_W.js +1 -0
  18. package/dist/assets/{backup-C0OJCJlM.js → backup-DpyvT9Z6.js} +108 -50
  19. package/dist/assets/backup-DpyvT9Z6.js.map +1 -0
  20. package/dist/assets/bark_ffi_wasm_bg-CcafsJla.js +5 -0
  21. package/dist/assets/{bark_ffi_wasm_bg-EY2uc0Bx.js.map → bark_ffi_wasm_bg-CcafsJla.js.map} +1 -1
  22. package/dist/assets/{bark_ffi_wasm_bg-Bxru_BVW.wasm → bark_ffi_wasm_bg-VNmaJsc9.wasm} +0 -0
  23. package/dist/assets/{bitcoind-CdSmvy2y.js → bitcoind-DTsrd7TF.js} +4 -5
  24. package/dist/assets/{bitcoind-CdSmvy2y.js.map → bitcoind-DTsrd7TF.js.map} +1 -1
  25. package/dist/assets/bitcoindevkit_bg-BWQHx7vd.js +5 -0
  26. package/dist/assets/{bitcoindevkit_bg-B-iLWrmX.js.map → bitcoindevkit_bg-BWQHx7vd.js.map} +1 -1
  27. package/dist/assets/bitcoindevkit_bg-DXil67yS.wasm +0 -0
  28. package/dist/assets/{blobFiles-BmsrvZc3.js → blobFiles-DDs34n0r.js} +4 -5
  29. package/dist/assets/{blobFiles-BmsrvZc3.js.map → blobFiles-DDs34n0r.js.map} +1 -1
  30. package/dist/assets/breez_sdk_spark_wasm_bg.wasm +0 -0
  31. package/dist/assets/buttons-Bq7pTXqF.js +1 -0
  32. package/dist/assets/{buttons-fZTEa_2i.js → buttons-BvWqHJeh.js} +46 -23
  33. package/dist/assets/buttons-BvWqHJeh.js.map +1 -0
  34. package/dist/assets/bytes-C1DNGY18.js +132 -0
  35. package/dist/assets/bytes-C1DNGY18.js.map +1 -0
  36. package/dist/assets/{childEnv-K_IzUqQx.js → childEnv-C-99hdbL.js} +2 -3
  37. package/dist/assets/{childEnv-K_IzUqQx.js.map → childEnv-C-99hdbL.js.map} +1 -1
  38. package/dist/assets/{client-Ibk3-e60.js → client-kGZ3ZdUW.js} +30 -13
  39. package/dist/assets/client-kGZ3ZdUW.js.map +1 -0
  40. package/dist/assets/{codec-DMpQqVSt.js → codec-B2rH1mfx.js} +2 -4
  41. package/dist/assets/{codec-DMpQqVSt.js.map → codec-B2rH1mfx.js.map} +1 -1
  42. package/dist/assets/domainProofs-BDNP1dIy.js +280 -0
  43. package/dist/assets/domainProofs-BDNP1dIy.js.map +1 -0
  44. package/dist/assets/{endpoint-DarqblYE.js → endpoint-B0vE5ojY.js} +421 -420
  45. package/dist/assets/endpoint-B0vE5ojY.js.map +1 -0
  46. package/dist/assets/engineErrors--9hfgKlK.js +150 -0
  47. package/dist/assets/engineErrors--9hfgKlK.js.map +1 -0
  48. package/dist/assets/{envelope-CvQVCGdf.js → envelope-Bi2kMqbp.js} +3 -4
  49. package/dist/assets/{envelope-CvQVCGdf.js.map → envelope-Bi2kMqbp.js.map} +1 -1
  50. package/dist/assets/{errors-Dt-ZnyOX.js → errors-DDLFO4Gf.js} +31 -5
  51. package/dist/assets/errors-DDLFO4Gf.js.map +1 -0
  52. package/dist/assets/{fedimintSdk-zV_5Qdqz.js → fedimintSdk-D-6H9Pe7.js} +4 -5
  53. package/dist/assets/{fedimintSdk-zV_5Qdqz.js.map → fedimintSdk-D-6H9Pe7.js.map} +1 -1
  54. package/dist/assets/fedimint_client_wasm_bg-Cr5xGD-w.js +5 -0
  55. package/dist/assets/{fedimint_client_wasm_bg-BtHHlFpp.js.map → fedimint_client_wasm_bg-Cr5xGD-w.js.map} +1 -1
  56. package/dist/assets/fileBytes-CCKbwqG_.js +1 -0
  57. package/dist/assets/{fileBytes-BLPZq9YU.js → fileBytes-CfvUXdSy.js} +5 -7
  58. package/dist/assets/fileBytes-CfvUXdSy.js.map +1 -0
  59. package/dist/assets/{fileBytes-B0z9A6Le.js → fileBytes-tj6-VZcB.js} +3 -4
  60. package/dist/assets/{fileBytes-B0z9A6Le.js.map → fileBytes-tj6-VZcB.js.map} +1 -1
  61. package/dist/assets/fileBytesIdb-B0zzJ6p7.js +1 -0
  62. package/dist/assets/{fileBytesIdb-Bmlrl9EO.js → fileBytesIdb-BJirUAjI.js} +4 -5
  63. package/dist/assets/{fileBytesIdb-Bmlrl9EO.js.map → fileBytesIdb-BJirUAjI.js.map} +1 -1
  64. package/dist/assets/{fileBytesOpfs-DBS0kbPT.js → fileBytesOpfs-DRUYLER4.js} +4 -5
  65. package/dist/assets/{fileBytesOpfs-DBS0kbPT.js.map → fileBytesOpfs-DRUYLER4.js.map} +1 -1
  66. package/dist/assets/{fixedHosts-6gKn8dp2.js → fixedHosts-CPSsGOI2.js} +4 -5
  67. package/dist/assets/{fixedHosts-6gKn8dp2.js.map → fixedHosts-CPSsGOI2.js.map} +1 -1
  68. package/dist/assets/{ghostly_iroh_web-BzAXJUYH.js → ghostly_iroh_web-DIj5xGmR.js} +2 -3
  69. package/dist/assets/{ghostly_iroh_web-BzAXJUYH.js.map → ghostly_iroh_web-DIj5xGmR.js.map} +1 -1
  70. package/dist/assets/{src-DjVj2ynY.js → groupMeta-DTQAJG50.js} +4879 -23799
  71. package/dist/assets/groupMeta-DTQAJG50.js.map +1 -0
  72. package/dist/assets/{host-CYlIiY3r.js → host-z0FAHP9Z.js} +750 -245
  73. package/dist/assets/host-z0FAHP9Z.js.map +1 -0
  74. package/dist/assets/{hyperdhtRelay-CdsLcAhY.js → hyperdhtRelay-CvsAfQRQ.js} +5 -6
  75. package/dist/assets/hyperdhtRelay-CvsAfQRQ.js.map +1 -0
  76. package/dist/assets/hyperdhtRelay-bjNGacf5.js +32 -0
  77. package/dist/assets/hyperdhtRelay-bjNGacf5.js.map +1 -0
  78. package/dist/assets/{idb-CEuoNsTv.js → idb-ewvbqyDI.js} +2 -3
  79. package/dist/assets/{idb-CEuoNsTv.js.map → idb-ewvbqyDI.js.map} +1 -1
  80. package/dist/assets/identityProofs-Cksc_K7_.js +940 -0
  81. package/dist/assets/identityProofs-Cksc_K7_.js.map +1 -0
  82. package/dist/assets/{irohWeb-D2IuloLL.js → irohWeb-CLBx5MIv.js} +3061 -86
  83. package/dist/assets/irohWeb-CLBx5MIv.js.map +1 -0
  84. package/dist/assets/joinTrace-CBr1jbch.js +1 -0
  85. package/dist/assets/{joinTrace-CjRDFy85.js → joinTrace-xKBe73j9.js} +2 -3
  86. package/dist/assets/{joinTrace-CjRDFy85.js.map → joinTrace-xKBe73j9.js.map} +1 -1
  87. package/dist/assets/{legacy_ciphers-JJOu0JXL.js → legacy_ciphers-BnYATjxo.js} +2 -3
  88. package/dist/assets/{legacy_ciphers-JJOu0JXL.js.map → legacy_ciphers-BnYATjxo.js.map} +1 -1
  89. package/dist/assets/linkPreview-DdMf-YAc.js +252 -0
  90. package/dist/assets/linkPreview-DdMf-YAc.js.map +1 -0
  91. package/dist/assets/{main-C0PfjKTe.js → main-CVqkvuIo.js} +536 -173
  92. package/dist/assets/main-CVqkvuIo.js.map +1 -0
  93. package/dist/assets/{mainline-Cu61qcPS.js → mainline-CVrd0C1n.js} +72 -18
  94. package/dist/assets/mainline-CVrd0C1n.js.map +1 -0
  95. package/dist/assets/mints-BcBODVVW.js +1 -0
  96. package/dist/assets/{mints-j5XAOk4f.js → mints-CMDLbMeH.js} +8 -6
  97. package/dist/assets/mints-CMDLbMeH.js.map +1 -0
  98. package/dist/assets/{nacl-fast-CDhNCYHs.js → nacl-fast-B1ThWvuM.js} +2 -3
  99. package/dist/assets/{nacl-fast-CDhNCYHs.js.map → nacl-fast-B1ThWvuM.js.map} +1 -1
  100. package/dist/assets/{networkReason-Dt7Yx_n4.js → networkReason-Be-hMghr.js} +10 -14
  101. package/dist/assets/{networkReason-Dt7Yx_n4.js.map → networkReason-Be-hMghr.js.map} +1 -1
  102. package/dist/assets/{noble_curves-DDWn5AH0.js → noble_curves-DqpNlhAU.js} +3 -4
  103. package/dist/assets/{noble_curves-DDWn5AH0.js.map → noble_curves-DqpNlhAU.js.map} +1 -1
  104. package/dist/assets/{noble_hashes-B7AZyFyS.js → noble_hashes-LFe1N2xt.js} +3 -4
  105. package/dist/assets/{noble_hashes-B7AZyFyS.js.map → noble_hashes-LFe1N2xt.js.map} +1 -1
  106. package/dist/assets/{nwc-CtZypDcv.js → nwc-DKE2FXr6.js} +5 -6
  107. package/dist/assets/{nwc-CtZypDcv.js.map → nwc-DKE2FXr6.js.map} +1 -1
  108. package/dist/assets/nwcProvider-pL2XqSbW.js +208 -0
  109. package/dist/assets/nwcProvider-pL2XqSbW.js.map +1 -0
  110. package/dist/assets/{openpgp-BBFr-zHQ.js → openpgp-LkR_Zof0.js} +14 -15
  111. package/dist/assets/{openpgp-BBFr-zHQ.js.map → openpgp-LkR_Zof0.js.map} +1 -1
  112. package/dist/assets/ownDid-DY3rYqDI.js +862 -0
  113. package/dist/assets/ownDid-DY3rYqDI.js.map +1 -0
  114. package/dist/assets/{ownStatus-D4HC6tNR.js → ownStatus-DMEhrpkd.js} +81 -19
  115. package/dist/assets/ownStatus-DMEhrpkd.js.map +1 -0
  116. package/dist/assets/pairedTransports-BKmvlKz1.js +581 -0
  117. package/dist/assets/pairedTransports-BKmvlKz1.js.map +1 -0
  118. package/dist/assets/paymentIntent-DySU3Ajm.js +349 -0
  119. package/dist/assets/paymentIntent-DySU3Ajm.js.map +1 -0
  120. package/dist/assets/pkarr-BQo4PcCg.js +367 -0
  121. package/dist/assets/pkarr-BQo4PcCg.js.map +1 -0
  122. package/dist/assets/{profiles-Ccdq6Xf6.js → profiles-BFSGqDFC.js} +30 -16
  123. package/dist/assets/profiles-BFSGqDFC.js.map +1 -0
  124. package/dist/assets/registry-B15Yg_1C.js +1 -0
  125. package/dist/assets/{registry-LvxsLJ5S.js → registry-rXgaZeNn.js} +1273 -58
  126. package/dist/assets/registry-rXgaZeNn.js.map +1 -0
  127. package/dist/assets/relay-Cjfmdec0.js +2219 -0
  128. package/dist/assets/relay-Cjfmdec0.js.map +1 -0
  129. package/dist/assets/resolve-CIc3KZMV.js +970 -0
  130. package/dist/assets/resolve-CIc3KZMV.js.map +1 -0
  131. package/dist/assets/{restoredRows-C3LcxmOw.js → restoredRows-D_WSHE7H.js} +3 -4
  132. package/dist/assets/{restoredRows-C3LcxmOw.js.map → restoredRows-D_WSHE7H.js.map} +1 -1
  133. package/dist/assets/{secretGuard-B7Hj0Kvz.js → secretGuard-B4-LlMjv.js} +75 -16
  134. package/dist/assets/{secretGuard-B7Hj0Kvz.js.map → secretGuard-B4-LlMjv.js.map} +1 -1
  135. package/dist/assets/secretGuard-BmmnEbYf.js +1 -0
  136. package/dist/assets/{server-Q3VcNqGt.js → server-CQR7NLCz.js} +10200 -625
  137. package/dist/assets/server-CQR7NLCz.js.map +1 -0
  138. package/dist/assets/{sha512-BYId-G-T.js → sha512-DST9fbWH.js} +2 -3
  139. package/dist/assets/{sha512-BYId-G-T.js.map → sha512-DST9fbWH.js.map} +1 -1
  140. package/dist/assets/sshForges-BnvwmNj-.js +539 -0
  141. package/dist/assets/sshForges-BnvwmNj-.js.map +1 -0
  142. package/dist/assets/{storage-Bya5b2Xt.js → storage-BpjdxvO2.js} +243 -34
  143. package/dist/assets/storage-BpjdxvO2.js.map +1 -0
  144. package/dist/assets/text-li76pThX.js +106 -0
  145. package/dist/assets/text-li76pThX.js.map +1 -0
  146. package/dist/assets/{translate-iQZq4TnY.js → translate-BcbSWkuq.js} +21 -26
  147. package/dist/assets/{translate-iQZq4TnY.js.map → translate-BcbSWkuq.js.map} +1 -1
  148. package/dist/assets/{tree-store-N362nuzZ.js → tree-store-CAchkO_l.js} +22 -6
  149. package/dist/assets/tree-store-CAchkO_l.js.map +1 -0
  150. package/dist/assets/{types-Clyb52K2.js → types-CdWwgvyt.js} +2 -3
  151. package/dist/assets/{types-Clyb52K2.js.map → types-CdWwgvyt.js.map} +1 -1
  152. package/dist/assets/{unbzip2-stream-B1C-JX9L.js → unbzip2-stream-BtkYGpC5.js} +2 -3
  153. package/dist/assets/{unbzip2-stream-B1C-JX9L.js.map → unbzip2-stream-BtkYGpC5.js.map} +1 -1
  154. package/dist/assets/{usdt-DnyTGdTX.js → usdt-CBJ4Q5Ji.js} +7 -7
  155. package/dist/assets/usdt-CBJ4Q5Ji.js.map +1 -0
  156. package/dist/assets/{waitNotice-Cn0WJ-He.js → waitNotice-BGM0QOS2.js} +27 -4
  157. package/dist/assets/waitNotice-BGM0QOS2.js.map +1 -0
  158. package/dist/assets/{web-DwgdhfcY.js → web-68CYFCl9.js} +314 -91
  159. package/dist/assets/web-68CYFCl9.js.map +1 -0
  160. package/dist/ghostly.mjs +3 -5
  161. package/dist/ghostly.mjs.map +1 -1
  162. package/npm-shrinkwrap.json +225 -200
  163. package/package.json +16 -16
  164. package/dist/assets/api-DBlaoz8i.js.map +0 -1
  165. package/dist/assets/apiKit-DesObIDf.js.map +0 -1
  166. package/dist/assets/appFetch-C8yZIq1e.js +0 -194
  167. package/dist/assets/appFetch-C8yZIq1e.js.map +0 -1
  168. package/dist/assets/apps-DkMjDHML.js.map +0 -1
  169. package/dist/assets/apps-rzxsjfBV.js +0 -2
  170. package/dist/assets/arkade-CarKONmH.js.map +0 -1
  171. package/dist/assets/backup-C0OJCJlM.js.map +0 -1
  172. package/dist/assets/backup-CgWU7x0T.js +0 -2
  173. package/dist/assets/bark_ffi_wasm_bg-EY2uc0Bx.js +0 -6
  174. package/dist/assets/bitcoindProvider-BvoRh0D5.js +0 -97
  175. package/dist/assets/bitcoindProvider-BvoRh0D5.js.map +0 -1
  176. package/dist/assets/bitcoindevkit_bg-B-iLWrmX.js +0 -6
  177. package/dist/assets/bitcoindevkit_bg-CRkZTSbO.wasm +0 -0
  178. package/dist/assets/buttons-Cco0Agfa.js +0 -2
  179. package/dist/assets/buttons-fZTEa_2i.js.map +0 -1
  180. package/dist/assets/client-Ibk3-e60.js.map +0 -1
  181. package/dist/assets/endpoint-DarqblYE.js.map +0 -1
  182. package/dist/assets/errors-Dt-ZnyOX.js.map +0 -1
  183. package/dist/assets/fedimint_client_wasm_bg-BtHHlFpp.js +0 -6
  184. package/dist/assets/fileBytes-BLPZq9YU.js.map +0 -1
  185. package/dist/assets/fileBytes-BtIyoDF2.js +0 -2
  186. package/dist/assets/fileBytesIdb-D8mAK4pF.js +0 -2
  187. package/dist/assets/host-CYlIiY3r.js.map +0 -1
  188. package/dist/assets/hyperdhtRelay-1wzya_0L.js +0 -25
  189. package/dist/assets/hyperdhtRelay-1wzya_0L.js.map +0 -1
  190. package/dist/assets/hyperdhtRelay-CdsLcAhY.js.map +0 -1
  191. package/dist/assets/irohWeb-D2IuloLL.js.map +0 -1
  192. package/dist/assets/joinTrace-D-fnt2p3.js +0 -2
  193. package/dist/assets/jsonOut-POtMBS_V.js +0 -16
  194. package/dist/assets/jsonOut-POtMBS_V.js.map +0 -1
  195. package/dist/assets/main-C0PfjKTe.js.map +0 -1
  196. package/dist/assets/mainline-Cu61qcPS.js.map +0 -1
  197. package/dist/assets/mints-BaOmx517.js +0 -2
  198. package/dist/assets/mints-j5XAOk4f.js.map +0 -1
  199. package/dist/assets/nwcProvider-DYHkd0iu.js +0 -88
  200. package/dist/assets/nwcProvider-DYHkd0iu.js.map +0 -1
  201. package/dist/assets/ownDid-CJ0ta8CL.js +0 -282
  202. package/dist/assets/ownDid-CJ0ta8CL.js.map +0 -1
  203. package/dist/assets/ownStatus-D4HC6tNR.js.map +0 -1
  204. package/dist/assets/profiles-Ccdq6Xf6.js.map +0 -1
  205. package/dist/assets/registry-CE0PpQAE.js +0 -2
  206. package/dist/assets/registry-LvxsLJ5S.js.map +0 -1
  207. package/dist/assets/resolve-6kVu2DE5.js +0 -400
  208. package/dist/assets/resolve-6kVu2DE5.js.map +0 -1
  209. package/dist/assets/secretGuard-DUr6bgKc.js +0 -2
  210. package/dist/assets/server-Q3VcNqGt.js.map +0 -1
  211. package/dist/assets/src-DjVj2ynY.js.map +0 -1
  212. package/dist/assets/sshForges-DeZ9cN9Q.js +0 -261
  213. package/dist/assets/sshForges-DeZ9cN9Q.js.map +0 -1
  214. package/dist/assets/storage-Bya5b2Xt.js.map +0 -1
  215. package/dist/assets/tree-store-N362nuzZ.js.map +0 -1
  216. package/dist/assets/usdt-DnyTGdTX.js.map +0 -1
  217. package/dist/assets/waitNotice-Cn0WJ-He.js.map +0 -1
  218. package/dist/assets/web-DwgdhfcY.js.map +0 -1
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/@breeztech/breez-sdk-spark/web/tree-store/index.js
1
+ // ../../node_modules/@breeztech/breez-sdk-spark/web/tree-store/index.js
2
2
  /**
3
3
  * ES module implementation of the durable tree store for browsers, backed by
4
4
  * IndexedDB. Ports the two-table (leaves + ancestors) model and reservation /
@@ -19,7 +19,7 @@
19
19
  var RESERVATION_TIMEOUT_MS = 3e5;
20
20
  /** Spent-leaf markers older than this (relative to a refresh) are pruned. */
21
21
  var SPENT_MARKER_CLEANUP_THRESHOLD_MS = 3e5;
22
- var DB_VERSION = 5;
22
+ var DB_VERSION = 6;
23
23
  var STORE_LEAVES = "leaves";
24
24
  var STORE_ANCESTORS = "ancestors";
25
25
  var STORE_RESERVATIONS = "reservations";
@@ -86,10 +86,11 @@ var WebTreeStore = class {
86
86
  const leaves = db.createObjectStore(STORE_LEAVES, { keyPath: "id" });
87
87
  leaves.createIndex("reservation_id", "reservation_id", { unique: false });
88
88
  leaves.createIndex("chain_complete", "chain_complete", { unique: false });
89
+ leaves.createIndex("status", "status", { unique: false });
89
90
  }
90
91
  if (event.oldVersion < 2 && db.objectStoreNames.contains(STORE_ANCESTORS)) db.deleteObjectStore(STORE_ANCESTORS);
91
92
  if (!db.objectStoreNames.contains(STORE_ANCESTORS)) db.createObjectStore(STORE_ANCESTORS, { keyPath: ["leaf_id", "id"] }).createIndex("leaf_id", "leaf_id", { unique: false });
92
- if (event.oldVersion > 0 && event.oldVersion < DB_VERSION) {
93
+ if (event.oldVersion > 0 && event.oldVersion < 5) {
93
94
  const tx = event.target.transaction;
94
95
  const leaves = tx.objectStore(STORE_LEAVES);
95
96
  if (!leaves.indexNames.contains("chain_complete")) leaves.createIndex("chain_complete", "chain_complete", { unique: false });
@@ -112,6 +113,7 @@ var WebTreeStore = class {
112
113
  };
113
114
  };
114
115
  }
116
+ if (event.oldVersion > 0 && event.oldVersion < 6) event.target.transaction.objectStore(STORE_LEAVES).createIndex("status", "status", { unique: false });
115
117
  if (!db.objectStoreNames.contains(STORE_RESERVATIONS)) db.createObjectStore(STORE_RESERVATIONS, { keyPath: "id" });
116
118
  if (!db.objectStoreNames.contains(STORE_SPENT)) db.createObjectStore(STORE_SPENT, { keyPath: "id" });
117
119
  if (!db.objectStoreNames.contains(STORE_SWAP_STATUS)) db.createObjectStore(STORE_SWAP_STATUS, { keyPath: "id" });
@@ -327,6 +329,22 @@ var WebTreeStore = class {
327
329
  throw new TreeStoreError(`Failed to get leaves: ${error.message}`, error);
328
330
  }
329
331
  }
332
+ async getLeavesWithStatus(statuses) {
333
+ try {
334
+ const distinct = [...new Set(statuses)];
335
+ if (distinct.length === 0) return [];
336
+ return await this._txRun([STORE_LEAVES], "readonly", distinct.map((status) => ({
337
+ name: status,
338
+ store: STORE_LEAVES,
339
+ index: "status",
340
+ key: status,
341
+ all: true
342
+ })), (res) => distinct.flatMap((status) => res[status].map((row) => row.data)));
343
+ } catch (error) {
344
+ if (error instanceof TreeStoreError) throw error;
345
+ throw new TreeStoreError(`Failed to get leaves with status: ${error.message}`, error);
346
+ }
347
+ }
330
348
  async getAvailableBalance() {
331
349
  try {
332
350
  return await this._txRun([STORE_LEAVES, STORE_RESERVATIONS], "readonly", [{
@@ -664,7 +682,6 @@ var WebTreeStore = class {
664
682
  leafMap.delete(l.id);
665
683
  for (const existingId of (ancestorRowsByLeaf.get(l.id) || /* @__PURE__ */ new Map()).keys()) ancestorsStore.delete([l.id, existingId]);
666
684
  }
667
- change.concat(reserved);
668
685
  for (const p of change) {
669
686
  const row = this._leafRow(p, false, leafMap.get(p.id));
670
687
  leavesStore.put(row);
@@ -1025,7 +1042,6 @@ async function createWebTreeStore(dbName, logger = null) {
1025
1042
  await store.initialize();
1026
1043
  return store;
1027
1044
  }
1028
- //#endregion
1029
1045
  export { createWebTreeStore };
1030
1046
 
1031
- //# sourceMappingURL=tree-store-N362nuzZ.js.map
1047
+ //# sourceMappingURL=tree-store-CAchkO_l.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-store-CAchkO_l.js","names":[],"sources":["../../../../node_modules/@breeztech/breez-sdk-spark/web/tree-store/index.js"],"sourcesContent":["/**\n * ES module implementation of the durable tree store for browsers, backed by\n * IndexedDB. Ports the two-table (leaves + ancestors) model and reservation /\n * refresh / spent-guard semantics of the PostgreSQL tree store to a single-user\n * IndexedDB database: no user_id scoping and no `brz_` table prefix, since each\n * browser origin has its own isolated database.\n *\n * IndexedDB transaction lifetime: a transaction auto-commits once its request\n * queue drains and control returns to the event loop, so awaiting any non-IDB\n * promise mid-transaction closes it. Every logical operation therefore runs in\n * ONE transaction: all reads are issued up front, and the compute + writes run\n * synchronously inside the last read's success handler (never awaiting anything\n * that isn't part of the transaction). Because IndexedDB serializes readwrite\n * transactions with overlapping store scope, this also gives the mutating ops\n * the same serialization the Postgres backend gets from its per-tenant lock.\n */\n\n/** Reservations older than this are stale and get released on the next refresh. */\nconst RESERVATION_TIMEOUT_MS = 300 * 1000; // 5 minutes\n\n/** Spent-leaf markers older than this (relative to a refresh) are pruned. */\nconst SPENT_MARKER_CLEANUP_THRESHOLD_MS = 5 * 60 * 1000; // 5 minutes\n\nconst DB_VERSION = 6;\n\nconst STORE_LEAVES = \"leaves\";\nconst STORE_ANCESTORS = \"ancestors\";\nconst STORE_RESERVATIONS = \"reservations\";\nconst STORE_SPENT = \"spent\";\nconst STORE_SWAP_STATUS = \"swapStatus\";\n\n/** Singleton key of the swap-status row. */\nconst SWAP_STATUS_ID = 1;\n\nclass TreeStoreError extends Error {\n constructor(message, cause = null) {\n super(message);\n this.name = \"TreeStoreError\";\n this.cause = cause;\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, TreeStoreError);\n }\n }\n}\n\nfunction _resolveIndexedDB() {\n if (typeof indexedDB !== \"undefined\") return indexedDB;\n if (typeof globalThis !== \"undefined\" && globalThis.indexedDB) {\n return globalThis.indexedDB;\n }\n if (typeof self !== \"undefined\" && self.indexedDB) return self.indexedDB;\n if (typeof window !== \"undefined\" && window.indexedDB) return window.indexedDB;\n return null;\n}\n\n/**\n * Pair a leaf with its ancestors (nearest first) by walking `parent_node_id`\n * through `nodes`. Returns null if the leaf itself is absent; stops at a gap or\n * cycle, returning a partial chain.\n * @param {Map<string, object>} nodes\n * @param {string} leafId\n * @returns {{leaf: object, ancestors: Array<object>}|null}\n */\nfunction assembleExitChain(nodes, leafId) {\n const leaf = nodes.get(leafId);\n if (!leaf) return null;\n const ancestors = [];\n const visited = new Set([leafId]);\n let current = leaf.parent_node_id;\n while (current != null && !visited.has(current)) {\n visited.add(current);\n const node = nodes.get(current);\n if (!node) break;\n ancestors.push(node);\n current = node.parent_node_id;\n }\n return { leaf, ancestors };\n}\n\nclass WebTreeStore {\n constructor(dbName = \"BreezSdkSparkTree\", logger = null) {\n this.dbName = dbName;\n this.db = null;\n this.logger = logger;\n }\n\n async initialize() {\n if (this.db) return this;\n\n const idbFactory = _resolveIndexedDB();\n if (!idbFactory) {\n throw new TreeStoreError(\"IndexedDB is not available in this environment\");\n }\n\n this.db = await new Promise((resolve, reject) => {\n const request = idbFactory.open(this.dbName, DB_VERSION);\n\n request.onupgradeneeded = (event) => {\n const db = event.target.result;\n\n // Spendable leaf pool. `data` is the full TreeNode; the other columns\n // are projected out of it so queries avoid deserializing the blob.\n if (!db.objectStoreNames.contains(STORE_LEAVES)) {\n const leaves = db.createObjectStore(STORE_LEAVES, { keyPath: \"id\" });\n leaves.createIndex(\"reservation_id\", \"reservation_id\", {\n unique: false,\n });\n // Stored 0/1 rather than as a boolean: IndexedDB rejects booleans as\n // index keys, and indexing this is what keeps leavesMissingExitChains\n // off a full scan of the store.\n leaves.createIndex(\"chain_complete\", \"chain_complete\", {\n unique: false,\n });\n leaves.createIndex(\"status\", \"status\", { unique: false });\n }\n\n // Intermediate exit-chain nodes, kept separate from the leaf pool and\n // carrying no pool metadata (no reservation / missing / added_at). Each\n // row is owned by the leaf it belongs to (key `[leaf_id, id]`), so a\n // node shared by several leaves' chains stores one row per leaf rather\n // than one deduplicated row. Version 1 keyed this store by `id` alone;\n // a keyPath cannot be changed in place, and there is no data worth\n // migrating out of it, so it is dropped and recreated. Gated on\n // `oldVersion` so a later, unrelated version bump does not wipe it again.\n if (event.oldVersion < 2 && db.objectStoreNames.contains(STORE_ANCESTORS)) {\n db.deleteObjectStore(STORE_ANCESTORS);\n }\n if (!db.objectStoreNames.contains(STORE_ANCESTORS)) {\n const ancestors = db.createObjectStore(STORE_ANCESTORS, {\n keyPath: [\"leaf_id\", \"id\"],\n });\n ancestors.createIndex(\"leaf_id\", \"leaf_id\", { unique: false });\n }\n\n // An existing wallet gets the flag derived from the ancestor rows it\n // already holds, so it does not refetch every chain. The index is\n // created here and populated by the rewrite below, since createIndex\n // cannot run from an async callback. The flag has had its current\n // meaning since v5, so a database already at v5 or later keeps the\n // flags it holds.\n if (event.oldVersion > 0 && event.oldVersion < 5) {\n const tx = event.target.transaction;\n const leaves = tx.objectStore(STORE_LEAVES);\n if (!leaves.indexNames.contains(\"chain_complete\")) {\n leaves.createIndex(\"chain_complete\", \"chain_complete\", {\n unique: false,\n });\n }\n\n const ancestors = tx.objectStore(STORE_ANCESTORS);\n const linked = new Set();\n ancestors.openCursor().onsuccess = (cursorEvent) => {\n const cursor = cursorEvent.target.result;\n if (cursor) {\n linked.add(`${cursor.value.leaf_id}\\u0000${cursor.value.id}`);\n cursor.continue();\n return;\n }\n leaves.openCursor().onsuccess = (leafEvent) => {\n const leafCursor = leafEvent.target.result;\n if (!leafCursor) return;\n const row = leafCursor.value;\n row.chain_complete =\n row.parent_node_id == null ||\n linked.has(`${row.id}\\u0000${row.parent_node_id}`)\n ? 1\n : 0;\n leafCursor.update(row);\n leafCursor.continue();\n };\n };\n }\n\n // Every leaf row already carries its status, and IndexedDB builds a new\n // index from the rows a store holds, so this needs no rewrite.\n if (event.oldVersion > 0 && event.oldVersion < 6) {\n event.target.transaction\n .objectStore(STORE_LEAVES)\n .createIndex(\"status\", \"status\", { unique: false });\n }\n\n if (!db.objectStoreNames.contains(STORE_RESERVATIONS)) {\n db.createObjectStore(STORE_RESERVATIONS, { keyPath: \"id\" });\n }\n\n if (!db.objectStoreNames.contains(STORE_SPENT)) {\n db.createObjectStore(STORE_SPENT, { keyPath: \"id\" });\n }\n\n if (!db.objectStoreNames.contains(STORE_SWAP_STATUS)) {\n db.createObjectStore(STORE_SWAP_STATUS, { keyPath: \"id\" });\n }\n };\n\n request.onsuccess = () => {\n const db = request.result;\n // Close on a version change requested by another connection so it is\n // not blocked by this one.\n db.onversionchange = () => {\n db.close();\n this.db = null;\n };\n resolve(db);\n };\n\n request.onerror = () =>\n reject(\n new TreeStoreError(\n `Failed to open IndexedDB: ${request.error?.message || \"Unknown error\"}`,\n request.error\n )\n );\n\n request.onblocked = () => {\n // Another open connection holds an older version. It will resolve once\n // that connection closes (see onversionchange above).\n };\n });\n\n return this;\n }\n\n close() {\n if (this.db) {\n this.db.close();\n this.db = null;\n }\n }\n\n // ===== Transaction runner =====\n\n /**\n * Runs one transaction. `reads` is a list of `{ name, store, key?, index?,\n * all? }`: with a key it is a `get`, without it a `getAll`, and `all` with a\n * key reads every record under that key; `index` reads through that\n * index on `store` instead of the store directly. All reads are issued up\n * front; once the last completes, `compute(results, tx)` runs synchronously\n * in that read's success handler and may issue writes on `tx`. Its return\n * value resolves the promise on `oncomplete`, so writes are durable before\n * resolve. `compute` must never await a non-IDB promise (it would close `tx`).\n */\n _txRun(storeNames, mode, reads, compute) {\n return new Promise((resolve, reject) => {\n if (!this.db) {\n reject(new TreeStoreError(\"Database not initialized\"));\n return;\n }\n\n let tx;\n try {\n tx = this.db.transaction(storeNames, mode);\n } catch (e) {\n reject(e);\n return;\n }\n\n let outcome;\n let settled = false;\n let computeError = null;\n const done = (fn) => {\n if (!settled) {\n settled = true;\n fn();\n }\n };\n\n tx.oncomplete = () => done(() => resolve(outcome));\n tx.onabort = () =>\n done(() =>\n reject(\n computeError ||\n new TreeStoreError(\n `transaction aborted: ${tx.error?.message || \"unknown\"}`,\n tx.error\n )\n )\n );\n tx.onerror = () =>\n done(() =>\n reject(\n computeError ||\n new TreeStoreError(\n `transaction error: ${tx.error?.message || \"unknown\"}`,\n tx.error\n )\n )\n );\n\n const runCompute = (results) => {\n try {\n outcome = compute(results, tx);\n } catch (e) {\n computeError = e;\n try {\n tx.abort();\n } catch (_) {\n done(() => reject(e));\n }\n }\n };\n\n if (reads.length === 0) {\n runCompute({});\n return;\n }\n\n const results = {};\n let pending = reads.length;\n for (const r of reads) {\n let req;\n try {\n const store = tx.objectStore(r.store);\n const source = r.index ? store.index(r.index) : store;\n if (r.keysOnly) {\n // Primary keys of the matching records, without reading a value.\n req = source.getAllKeys(r.key);\n } else if (r.all) {\n // Every record under `key`, rather than the single first match a\n // bare `get` returns. An index key matches many records.\n req = source.getAll(r.key);\n } else {\n req = \"key\" in r ? source.get(r.key) : source.getAll();\n }\n } catch (e) {\n done(() => reject(e));\n return;\n }\n req.onsuccess = () => {\n results[r.name] = req.result;\n pending -= 1;\n if (pending === 0) runCompute(results);\n };\n // A failed request bubbles to the transaction and aborts it, surfacing\n // via tx.onabort above.\n }\n });\n }\n\n // ===== Reads =====\n\n /**\n * Reconstruct the exit chains for many leaves in one transaction, each as\n * { leaf, ancestors } with ancestors nearest first. A leaf absent from the store\n * is skipped; a chain that hits a gap comes back partial.\n * @param {Array<string>} leafIds\n * @returns {Promise<Array<{leaf: object, ancestors: Array<object>}>>}\n */\n async getExitChains(leafIds) {\n try {\n if (!leafIds || leafIds.length === 0) return [];\n return await new Promise((resolve, reject) => {\n if (!this.db) {\n reject(new TreeStoreError(\"Database not initialized\"));\n return;\n }\n // Each requested leaf's own ancestor rows (via the leaf_id index) plus\n // the leaf itself, walked one chain at a time so a node id stored under\n // another leaf can never cross-contaminate this one. All reads are\n // issued up front; oncomplete only fires once every one of them (and\n // any request queued afterwards) has settled.\n const tx = this.db.transaction([STORE_LEAVES, STORE_ANCESTORS], \"readonly\");\n const leavesStore = tx.objectStore(STORE_LEAVES);\n const ancestorsIndex = tx.objectStore(STORE_ANCESTORS).index(\"leaf_id\");\n\n const leafById = new Map();\n const ancestorsByLeaf = new Map();\n let settled = false;\n const fail = (msg) => {\n if (!settled) {\n settled = true;\n reject(new TreeStoreError(msg));\n }\n };\n tx.onabort = () =>\n fail(`Failed to get exit chains: ${tx.error?.message || \"aborted\"}`);\n tx.onerror = () =>\n fail(`Failed to get exit chains: ${tx.error?.message || \"error\"}`);\n tx.oncomplete = () => {\n if (settled) return;\n settled = true;\n const result = [];\n for (const id of leafIds) {\n const leafRow = leafById.get(id);\n if (!leafRow) continue;\n const nodes = ancestorsByLeaf.get(id) || new Map();\n nodes.set(leafRow.id, leafRow.data);\n const pedigree = assembleExitChain(nodes, id);\n if (pedigree) result.push(pedigree);\n }\n resolve(result);\n };\n\n for (const id of leafIds) {\n const leafReq = leavesStore.get(id);\n leafReq.onsuccess = () => {\n if (leafReq.result) leafById.set(id, leafReq.result);\n };\n const ancestorsReq = ancestorsIndex.getAll(id);\n ancestorsReq.onsuccess = () => {\n const nodes = new Map();\n for (const row of ancestorsReq.result || []) nodes.set(row.id, row.data);\n ancestorsByLeaf.set(id, nodes);\n };\n }\n });\n } catch (error) {\n if (error instanceof TreeStoreError) throw error;\n throw new TreeStoreError(`Failed to get exit chains: ${error.message}`, error);\n }\n }\n\n /**\n * Ids of the stored leaves whose chain cannot back an exit: the leaf has a\n * parent, and no ancestor row of its own holds that parent.\n * @returns {Promise<Array<string>>}\n */\n async leavesMissingExitChains() {\n try {\n // A leaf that is itself a root is always flagged complete, so the flag\n // alone selects what needs a chain, and the index yields the leaf ids\n // without deserializing a single stored node.\n return await this._txRun(\n [STORE_LEAVES],\n \"readonly\",\n [\n {\n name: \"ids\",\n store: STORE_LEAVES,\n index: \"chain_complete\",\n key: 0,\n keysOnly: true,\n },\n ],\n (res) => res.ids\n );\n } catch (error) {\n if (error instanceof TreeStoreError) throw error;\n throw new TreeStoreError(\n `Failed to get leaves missing exit chains: ${error.message}`,\n error\n );\n }\n }\n\n async getLeaves() {\n try {\n return await this._txRun(\n [STORE_LEAVES, STORE_RESERVATIONS],\n \"readonly\",\n [\n { name: \"leaves\", store: STORE_LEAVES },\n { name: \"reservations\", store: STORE_RESERVATIONS },\n ],\n (res) => {\n const resMap = new Map(res.reservations.map((r) => [r.id, r]));\n const available = [];\n const notAvailable = [];\n const availableMissingFromOperators = [];\n const reservedForPayment = [];\n const reservedForSwap = [];\n\n for (const row of res.leaves) {\n const node = row.data;\n const purpose =\n row.reservation_id != null\n ? resMap.get(row.reservation_id)?.purpose\n : undefined;\n\n const spendable = node.status === \"Available\";\n if (purpose) {\n if (purpose === \"Payment\") reservedForPayment.push(node);\n else if (purpose === \"Swap\") reservedForSwap.push(node);\n } else if (!spendable) {\n notAvailable.push(node);\n } else if (row.is_missing_from_operators) {\n availableMissingFromOperators.push(node);\n } else {\n available.push(node);\n }\n }\n\n return {\n available,\n notAvailable,\n availableMissingFromOperators,\n reservedForPayment,\n reservedForSwap,\n };\n }\n );\n } catch (error) {\n if (error instanceof TreeStoreError) throw error;\n throw new TreeStoreError(`Failed to get leaves: ${error.message}`, error);\n }\n }\n\n async getLeavesWithStatus(statuses) {\n try {\n const distinct = [...new Set(statuses)];\n if (distinct.length === 0) return [];\n return await this._txRun(\n [STORE_LEAVES],\n \"readonly\",\n distinct.map((status) => ({\n name: status,\n store: STORE_LEAVES,\n index: \"status\",\n key: status,\n all: true,\n })),\n (res) => distinct.flatMap((status) => res[status].map((row) => row.data))\n );\n } catch (error) {\n if (error instanceof TreeStoreError) throw error;\n throw new TreeStoreError(\n `Failed to get leaves with status: ${error.message}`,\n error\n );\n }\n }\n\n async getAvailableBalance() {\n try {\n return await this._txRun(\n [STORE_LEAVES, STORE_RESERVATIONS],\n \"readonly\",\n [\n { name: \"leaves\", store: STORE_LEAVES },\n { name: \"reservations\", store: STORE_RESERVATIONS },\n ],\n (res) => {\n const resMap = new Map(res.reservations.map((r) => [r.id, r]));\n // Spendable = unreserved-available + swap-reserved (mirrors\n // Leaves::balance, which also counts missing-from-operators leaves\n // that are still Available and unreserved).\n let balance = 0n;\n for (const row of res.leaves) {\n const purpose =\n row.reservation_id != null\n ? resMap.get(row.reservation_id)?.purpose\n : undefined;\n const included =\n (row.reservation_id == null && row.status === \"Available\") ||\n purpose === \"Swap\";\n if (included) balance += BigInt(row.value);\n }\n return balance;\n }\n );\n } catch (error) {\n if (error instanceof TreeStoreError) throw error;\n throw new TreeStoreError(\n `Failed to get available balance: ${error.message}`,\n error\n );\n }\n }\n\n async getVerifiedLeafKeys() {\n try {\n // Every stored leaf passed the ownership check on its way in, whatever\n // its status, so all of them are projected.\n return await this._txRun(\n [STORE_LEAVES],\n \"readonly\",\n [{ name: \"leaves\", store: STORE_LEAVES }],\n (res) =>\n res.leaves.map((row) => [\n row.id,\n row.verifying_public_key,\n row.signing_public_key,\n ])\n );\n } catch (error) {\n if (error instanceof TreeStoreError) throw error;\n throw new TreeStoreError(\n `Failed to get verified leaf keys: ${error.message}`,\n error\n );\n }\n }\n\n async now() {\n return this._nowMs();\n }\n\n // ===== Writes =====\n\n async addLeaves(leaves) {\n try {\n if (!leaves || leaves.length === 0) return;\n const leafIds = leaves.map((l) => l.id);\n\n await this._txRun(\n [STORE_LEAVES, STORE_SPENT],\n \"readwrite\",\n [{ name: \"leaves\", store: STORE_LEAVES }],\n (res, tx) => {\n const leavesStore = tx.objectStore(STORE_LEAVES);\n const spentStore = tx.objectStore(STORE_SPENT);\n\n const leafMap = new Map(res.leaves.map((r) => [r.id, r]));\n\n // Re-adding a leaf clears any stale spent marker for it.\n for (const id of leafIds) spentStore.delete(id);\n\n for (const leaf of leaves) {\n leavesStore.put(this._leafRow(leaf, false, leafMap.get(leaf.id)));\n }\n }\n );\n } catch (error) {\n if (error instanceof TreeStoreError) throw error;\n throw new TreeStoreError(`Failed to add leaves: ${error.message}`, error);\n }\n }\n\n async storeAncestors(pedigrees) {\n try {\n if (!pedigrees || pedigrees.length === 0) return;\n\n // Scoped to the pedigrees' own rows: reading the two stores whole would\n // deserialize every leaf and ancestor row the wallet holds to write a\n // handful of chains.\n const reads = [];\n for (const p of pedigrees) {\n reads.push({\n name: `leaf:${p.leaf.id}`,\n store: STORE_LEAVES,\n key: p.leaf.id,\n });\n reads.push({\n name: `ancestors:${p.leaf.id}`,\n store: STORE_ANCESTORS,\n index: \"leaf_id\",\n key: p.leaf.id,\n all: true,\n });\n }\n\n await this._txRun(\n [STORE_LEAVES, STORE_ANCESTORS],\n \"readwrite\",\n reads,\n (res, tx) => {\n const ancestorsStore = tx.objectStore(STORE_ANCESTORS);\n const leavesStore = tx.objectStore(STORE_LEAVES);\n const ancestorRowsByLeaf = this._ancestorRowsByLeaf(\n pedigrees.flatMap((p) => res[`ancestors:${p.leaf.id}`] || [])\n );\n // A leaf can be spent between its chain being resolved and this write,\n // and a chain is only ever removed with its leaf. Writing one for a leaf\n // that is already gone would leave it behind for good.\n const leafRowsById = new Map();\n for (const p of pedigrees) {\n const row = res[`leaf:${p.leaf.id}`];\n if (row) {\n leafRowsById.set(row.id, row);\n }\n }\n\n for (const p of pedigrees) {\n const leafRow = leafRowsById.get(p.leaf.id);\n if (!leafRow) {\n continue;\n }\n this._replaceAncestors(\n ancestorsStore,\n ancestorRowsByLeaf,\n p.leaf.id,\n p.ancestors\n );\n // This write only touches ancestor rows, so the leaf's completeness\n // flag has to be refreshed alongside them. Judged against the stored\n // leaf, not the fetched one: a renewal may have reparented it while\n // the chain was in flight, in which case the chain that just arrived\n // no longer reaches it.\n const chainComplete = this._chainComplete(\n leafRow.data,\n p.ancestors,\n leafRow\n );\n if (chainComplete !== !!leafRow.chain_complete) {\n leavesStore.put({\n ...leafRow,\n chain_complete: chainComplete ? 1 : 0,\n });\n }\n }\n }\n );\n } catch (error) {\n if (error instanceof TreeStoreError) throw error;\n throw new TreeStoreError(`Failed to store ancestors: ${error.message}`, error);\n }\n }\n\n async setLeaves(leaves, missingLeaves, refreshStartedAtMs) {\n try {\n const reported = leaves || [];\n const missing = missingLeaves || [];\n const refreshMs = refreshStartedAtMs;\n\n await this._txRun(\n [STORE_LEAVES, STORE_ANCESTORS, STORE_RESERVATIONS, STORE_SPENT, STORE_SWAP_STATUS],\n \"readwrite\",\n [\n { name: \"leaves\", store: STORE_LEAVES },\n { name: \"ancestors\", store: STORE_ANCESTORS },\n { name: \"reservations\", store: STORE_RESERVATIONS },\n { name: \"spent\", store: STORE_SPENT },\n { name: \"swap\", store: STORE_SWAP_STATUS, key: SWAP_STATUS_ID },\n ],\n (res, tx) => {\n const leavesStore = tx.objectStore(STORE_LEAVES);\n const ancestorsStore = tx.objectStore(STORE_ANCESTORS);\n const reservationsStore = tx.objectStore(STORE_RESERVATIONS);\n const spentStore = tx.objectStore(STORE_SPENT);\n\n const nowMs = this._nowMs();\n const leafMap = new Map(res.leaves.map((r) => [r.id, { ...r }]));\n const ancestorRowsByLeaf = this._ancestorRowsByLeaf(res.ancestors);\n\n // Release + drop stale reservations BEFORE the swap guard, otherwise a\n // stale Swap reservation would pin has_active_swap true forever and\n // set_leaves could never make progress.\n const staleCutoff = nowMs - RESERVATION_TIMEOUT_MS;\n const staleIds = new Set(\n res.reservations.filter((r) => r.created_at < staleCutoff).map((r) => r.id)\n );\n for (const id of staleIds) reservationsStore.delete(id);\n for (const row of leafMap.values()) {\n if (row.reservation_id != null && staleIds.has(row.reservation_id)) {\n row.reservation_id = null;\n leavesStore.put(row);\n }\n }\n const remainingReservations = res.reservations.filter(\n (r) => !staleIds.has(r.id)\n );\n\n // Swap guard: skip the refresh body if a swap is in flight or one\n // completed during the refresh (its change would otherwise be lost).\n const hasActiveSwap = remainingReservations.some((r) => r.purpose === \"Swap\");\n const swapCompletedDuringRefresh =\n !!res.swap && res.swap.last_completed_at >= refreshMs;\n if (hasActiveSwap || swapCompletedDuringRefresh) {\n return; // stale-reservation cleanup above still commits\n }\n\n // Prune old spent markers, then collect the ones still fresh enough to\n // suppress re-adding a just-spent leaf during this refresh window.\n const spentCleanupCutoff = refreshMs - SPENT_MARKER_CLEANUP_THRESHOLD_MS;\n for (const s of res.spent) {\n if (s.spent_at < spentCleanupCutoff) spentStore.delete(s.id);\n }\n const spentIds = new Set(\n res.spent.filter((s) => s.spent_at >= refreshMs).map((s) => s.id)\n );\n\n // Delete non-reserved leaves added before the refresh started (this\n // includes leaves released just above by the stale-reservation\n // cleanup). A leaf reported again in this same refresh is re-inserted\n // below, so its ancestor rows must survive: only ids that do NOT\n // reappear (truly gone, e.g. spent) get their ancestor rows dropped\n // alongside them.\n // Taken before the deletion below: a refresh carries leaves alone, so\n // the chain-complete flag a reported leaf keeps has to come from the\n // row it already had, or every refresh would report every leaf as\n // missing its chain.\n const priorRows = new Map(leafMap);\n\n const deletedIds = [];\n for (const row of Array.from(leafMap.values())) {\n if (row.reservation_id == null && row.added_at < refreshMs) {\n leavesStore.delete(row.id);\n leafMap.delete(row.id);\n deletedIds.push(row.id);\n }\n }\n\n const liveLeaves = reported.filter((p) => !spentIds.has(p.id));\n const liveMissing = missing.filter((p) => !spentIds.has(p.id));\n\n for (const p of liveLeaves) {\n const row = this._leafRow(p, false, priorRows.get(p.id));\n leavesStore.put(row);\n leafMap.set(row.id, row);\n }\n for (const p of liveMissing) {\n const row = this._leafRow(p, true, priorRows.get(p.id));\n leavesStore.put(row);\n leafMap.set(row.id, row);\n }\n\n const survivingIds = new Set();\n for (const p of reported.concat(missing)) {\n if (!spentIds.has(p.id)) survivingIds.add(p.id);\n }\n for (const id of deletedIds) {\n if (survivingIds.has(id)) continue;\n for (const existingId of (ancestorRowsByLeaf.get(id) || new Map()).keys()) {\n ancestorsStore.delete([id, existingId]);\n }\n }\n }\n );\n } catch (error) {\n if (error instanceof TreeStoreError) throw error;\n throw new TreeStoreError(`Failed to set leaves: ${error.message}`, error);\n }\n }\n\n async cancelReservation(id, leavesToKeep) {\n try {\n const keep = leavesToKeep || [];\n await this._txRun(\n [STORE_LEAVES, STORE_ANCESTORS, STORE_RESERVATIONS],\n \"readwrite\",\n [\n { name: \"leaves\", store: STORE_LEAVES },\n { name: \"ancestors\", store: STORE_ANCESTORS },\n { name: \"res\", store: STORE_RESERVATIONS, key: id },\n ],\n (res, tx) => {\n // Return leavesToKeep to the pool even when the reservation is already\n // gone (e.g. released by stale cleanup): dropping them here would lose\n // the leaves until the next refresh. The deletes below no-op in that case.\n const leavesStore = tx.objectStore(STORE_LEAVES);\n const ancestorsStore = tx.objectStore(STORE_ANCESTORS);\n const reservationsStore = tx.objectStore(STORE_RESERVATIONS);\n\n const keepIds = new Set(keep.map((l) => l.id));\n const ancestorRowsByLeaf = this._ancestorRowsByLeaf(res.ancestors);\n const leafMap = new Map(res.leaves.map((r) => [r.id, r]));\n // A kept leaf keeps its ancestor rows, so the row rebuilt below has to\n // keep the flag that describes them.\n const priorRows = new Map(leafMap);\n for (const l of res.leaves) {\n if (l.reservation_id !== id) continue;\n leavesStore.delete(l.id);\n leafMap.delete(l.id);\n // A kept leaf's ancestor rows stay put; a dropped leaf's are\n // removed with it.\n if (!keepIds.has(l.id)) {\n for (const existingId of (ancestorRowsByLeaf.get(l.id) || new Map()).keys()) {\n ancestorsStore.delete([l.id, existingId]);\n }\n }\n }\n reservationsStore.delete(id);\n\n if (keep.length > 0) {\n // Only re-insert the leaves: a kept leaf's ancestor rows were left\n // untouched above.\n for (const leaf of keep) {\n // The chain flag carries over: those rows were deliberately kept.\n // So does any reservation other than this one, since a leaf the\n // refresh released and another reservation then took is not this\n // cancellation's to free.\n const prior = priorRows.get(leaf.id);\n const held = prior?.reservation_id === id ? undefined : prior;\n const chainComplete = this._chainComplete(leaf, undefined, prior);\n leavesStore.put(this._leafRow(leaf, false, held, chainComplete));\n }\n }\n }\n );\n } catch (error) {\n if (error instanceof TreeStoreError) throw error;\n throw new TreeStoreError(\n `Failed to cancel reservation '${id}': ${error.message}`,\n error\n );\n }\n }\n\n async finalizeReservation(id, newLeaves) {\n try {\n const added = newLeaves || null;\n await this._txRun(\n [STORE_LEAVES, STORE_ANCESTORS, STORE_RESERVATIONS, STORE_SPENT, STORE_SWAP_STATUS],\n \"readwrite\",\n [\n { name: \"leaves\", store: STORE_LEAVES },\n { name: \"ancestors\", store: STORE_ANCESTORS },\n { name: \"res\", store: STORE_RESERVATIONS, key: id },\n ],\n (res, tx) => {\n const leavesStore = tx.objectStore(STORE_LEAVES);\n const ancestorsStore = tx.objectStore(STORE_ANCESTORS);\n const reservationsStore = tx.objectStore(STORE_RESERVATIONS);\n const spentStore = tx.objectStore(STORE_SPENT);\n const swapStore = tx.objectStore(STORE_SWAP_STATUS);\n\n const nowMs = this._nowMs();\n const leafMap = new Map(res.leaves.map((r) => [r.id, r]));\n const ancestorRowsByLeaf = this._ancestorRowsByLeaf(res.ancestors);\n\n let isSwap = false;\n if (res.res) {\n isSwap = res.res.purpose === \"Swap\";\n for (const l of res.leaves) {\n if (l.reservation_id === id) {\n spentStore.put({ id: l.id, spent_at: nowMs });\n leavesStore.delete(l.id);\n leafMap.delete(l.id);\n // The spent leaf owns these ancestor rows; remove them now\n // since there is no later reclaim pass.\n for (const existingId of (ancestorRowsByLeaf.get(l.id) || new Map()).keys()) {\n ancestorsStore.delete([l.id, existingId]);\n }\n }\n }\n reservationsStore.delete(id);\n }\n\n if (added && added.length > 0) {\n for (const p of added) {\n const row = this._leafRow(p, false, leafMap.get(p.id));\n leavesStore.put(row);\n leafMap.set(row.id, row);\n }\n }\n\n if (isSwap && added && added.length > 0) {\n swapStore.put({ id: SWAP_STATUS_ID, last_completed_at: nowMs });\n }\n }\n );\n } catch (error) {\n if (error instanceof TreeStoreError) throw error;\n throw new TreeStoreError(\n `Failed to finalize reservation '${id}': ${error.message}`,\n error\n );\n }\n }\n\n async updateReservation(reservationId, reservedLeaves, changeLeaves) {\n try {\n const reserved = reservedLeaves || [];\n const change = changeLeaves || [];\n return await this._txRun(\n [STORE_LEAVES, STORE_ANCESTORS, STORE_RESERVATIONS, STORE_SPENT],\n \"readwrite\",\n [\n { name: \"leaves\", store: STORE_LEAVES },\n { name: \"ancestors\", store: STORE_ANCESTORS },\n { name: \"res\", store: STORE_RESERVATIONS, key: reservationId },\n ],\n (res, tx) => {\n if (!res.res) {\n throw new TreeStoreError(`Reservation ${reservationId} not found`);\n }\n const leavesStore = tx.objectStore(STORE_LEAVES);\n const ancestorsStore = tx.objectStore(STORE_ANCESTORS);\n const reservationsStore = tx.objectStore(STORE_RESERVATIONS);\n const spentStore = tx.objectStore(STORE_SPENT);\n\n const nowMs = this._nowMs();\n const leafMap = new Map(res.leaves.map((r) => [r.id, r]));\n const ancestorRowsByLeaf = this._ancestorRowsByLeaf(res.ancestors);\n\n // Old reserved leaves are consumed by the swap: mark spent and drop,\n // along with the ancestor rows they own, since there is no later\n // reclaim pass.\n for (const l of res.leaves) {\n if (l.reservation_id === reservationId) {\n spentStore.put({ id: l.id, spent_at: nowMs });\n leavesStore.delete(l.id);\n leafMap.delete(l.id);\n for (const existingId of (ancestorRowsByLeaf.get(l.id) || new Map()).keys()) {\n ancestorsStore.delete([l.id, existingId]);\n }\n }\n }\n\n // Change leaves go back to the available pool.\n for (const p of change) {\n const row = this._leafRow(p, false, leafMap.get(p.id));\n leavesStore.put(row);\n leafMap.set(row.id, row);\n }\n // Reserved leaves stay attached to this same reservation.\n for (const p of reserved) {\n const row = this._leafRow(p, false, leafMap.get(p.id));\n row.reservation_id = reservationId;\n leavesStore.put(row);\n leafMap.set(row.id, row);\n }\n\n reservationsStore.put({ ...res.res, pending_change_amount: 0 });\n\n // Return value must be plain TreeNodes: the Rust side deserializes\n // Vec<TreeNode>.\n return { id: reservationId, leaves: reserved };\n }\n );\n } catch (error) {\n if (error instanceof TreeStoreError) throw error;\n throw new TreeStoreError(\n `Failed to update reservation '${reservationId}': ${error.message}`,\n error\n );\n }\n }\n\n async tryReserveLeaves(targetAmounts, exactOnly, purpose) {\n try {\n return await this._txRun(\n [STORE_LEAVES, STORE_RESERVATIONS],\n \"readwrite\",\n [\n { name: \"leaves\", store: STORE_LEAVES },\n { name: \"reservations\", store: STORE_RESERVATIONS },\n ],\n (res, tx) => {\n const leavesStore = tx.objectStore(STORE_LEAVES);\n const reservationsStore = tx.objectStore(STORE_RESERVATIONS);\n\n const targetAmount = targetAmounts ? this._totalSats(targetAmounts) : 0;\n const maxTarget = this._maxTargetForPrefilter(targetAmounts);\n\n const leafMap = new Map(res.leaves.map((r) => [r.id, r]));\n const eligible = this._eligibleSlim(res.leaves);\n // True total over ALL eligible leaves, not the prefiltered set: the\n // WaitForPending decision below must not be derived from the slim set.\n const available = eligible.reduce((s, l) => s + l.value, 0);\n const slim = this._slimCandidates(eligible, maxTarget);\n const pending = res.reservations.reduce(\n (s, r) => s + (r.pending_change_amount || 0),\n 0\n );\n\n const selected = this._selectLeavesByTargetAmounts(slim, targetAmounts);\n if (selected !== null) {\n if (selected.length === 0) {\n throw new TreeStoreError(\"NonReservableLeaves\");\n }\n const ids = selected.map((s) => s.id);\n const fullLeaves = ids.map((leafId) => leafMap.get(leafId).data);\n const reservationId = this._generateId();\n this._createReservation(\n reservationsStore,\n leavesStore,\n leafMap,\n reservationId,\n ids,\n purpose,\n 0\n );\n return {\n type: \"success\",\n reservation: { id: reservationId, leaves: fullLeaves },\n };\n }\n\n if (!exactOnly) {\n const minSelected = this._selectLeavesByMinimumAmount(slim, targetAmount);\n if (minSelected !== null) {\n const ids = minSelected.map((s) => s.id);\n const fullLeaves = ids.map((leafId) => leafMap.get(leafId).data);\n const reservedAmount = fullLeaves.reduce((s, l) => s + l.value, 0);\n const pendingChange =\n reservedAmount > targetAmount && targetAmount > 0\n ? reservedAmount - targetAmount\n : 0;\n const reservationId = this._generateId();\n this._createReservation(\n reservationsStore,\n leavesStore,\n leafMap,\n reservationId,\n ids,\n purpose,\n pendingChange\n );\n return {\n type: \"success\",\n reservation: { id: reservationId, leaves: fullLeaves },\n };\n }\n }\n\n if (available + pending >= targetAmount) {\n return {\n type: \"waitForPending\",\n needed: targetAmount,\n available,\n pending,\n };\n }\n return { type: \"insufficientFunds\" };\n }\n );\n } catch (error) {\n if (error instanceof TreeStoreError) throw error;\n throw new TreeStoreError(\n `Failed to try reserve leaves: ${error.message}`,\n error\n );\n }\n }\n\n async tryReserveLeavesByIds(leafIds, purpose) {\n try {\n if (!leafIds || leafIds.length === 0) {\n throw new TreeStoreError(\"NonReservableLeaves\");\n }\n return await this._txRun(\n [STORE_LEAVES, STORE_RESERVATIONS],\n \"readwrite\",\n [{ name: \"leaves\", store: STORE_LEAVES }],\n (res, tx) => {\n const leavesStore = tx.objectStore(STORE_LEAVES);\n const reservationsStore = tx.objectStore(STORE_RESERVATIONS);\n\n const leafMap = new Map(res.leaves.map((r) => [r.id, r]));\n const eligibleIds = new Set(\n res.leaves\n .filter(\n (r) =>\n r.status === \"Available\" &&\n !r.is_missing_from_operators &&\n r.reservation_id == null\n )\n .map((r) => r.id)\n );\n // Every requested leaf must be available and unreserved (and the ids\n // distinct); otherwise reserve nothing.\n const matched = new Set(leafIds.filter((id) => eligibleIds.has(id)));\n if (matched.size !== leafIds.length) {\n throw new TreeStoreError(\"NonReservableLeaves\");\n }\n\n const fullLeaves = leafIds.map((id) => leafMap.get(id).data);\n const reservationId = this._generateId();\n this._createReservation(\n reservationsStore,\n leavesStore,\n leafMap,\n reservationId,\n leafIds,\n purpose,\n 0\n );\n return { id: reservationId, leaves: fullLeaves };\n }\n );\n } catch (error) {\n if (error instanceof TreeStoreError) throw error;\n throw new TreeStoreError(\n `Failed to try reserve leaves by ids: ${error.message}`,\n error\n );\n }\n }\n\n async trySelectLeaves(targetAmounts) {\n try {\n const targetAmount = targetAmounts ? this._totalSats(targetAmounts) : 0;\n const maxTarget = this._maxTargetForPrefilter(targetAmounts);\n return await this._txRun(\n [STORE_LEAVES],\n \"readonly\",\n [{ name: \"leaves\", store: STORE_LEAVES }],\n (res) => {\n const leafMap = new Map(res.leaves.map((r) => [r.id, r]));\n const slim = this._slimCandidates(this._eligibleSlim(res.leaves), maxTarget);\n\n const selected = this._selectLeavesByTargetAmounts(slim, targetAmounts);\n if (selected !== null && selected.length > 0) {\n return {\n type: \"exact\",\n leaves: selected.map((s) => leafMap.get(s.id).data),\n };\n }\n\n const minSelected = this._selectLeavesByMinimumAmount(slim, targetAmount);\n if (minSelected !== null) {\n return {\n type: \"swapNeeded\",\n leaves: minSelected.map((s) => leafMap.get(s.id).data),\n };\n }\n\n return { type: \"insufficientFunds\" };\n }\n );\n } catch (error) {\n if (error instanceof TreeStoreError) throw error;\n throw new TreeStoreError(\n `Failed to try select leaves: ${error.message}`,\n error\n );\n }\n }\n\n // ===== Private helpers =====\n\n _nowMs() {\n return Date.now();\n }\n\n _generateId() {\n if (typeof crypto !== \"undefined\" && crypto.randomUUID) {\n return crypto.randomUUID();\n }\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n }\n\n /** Row shape for the leaf pool. Preserves `reservation_id` from an existing\n * row; every other field comes from the operators' latest copy. */\n _leafRow(node, isMissing, existingRow, chainComplete) {\n return {\n id: node.id,\n parent_node_id: node.parent_node_id ?? null,\n status: node.status,\n value: node.value,\n verifying_public_key: node.verifying_public_key,\n signing_public_key: node.signing_keyshare.public_key,\n is_missing_from_operators: !!isMissing,\n reservation_id: existingRow ? existingRow.reservation_id ?? null : null,\n added_at: this._nowMs(),\n // Denormalized and indexed so leavesMissingExitChains reads only the ids\n // it wants, rather than every leaf row. Stored 0/1: IndexedDB rejects\n // booleans as index keys.\n chain_complete: (\n chainComplete !== undefined\n ? chainComplete\n : this._chainComplete(node, undefined, existingRow)\n )\n ? 1\n : 0,\n data: node,\n };\n }\n\n /**\n * Whether `node` has a stored chain reaching its current parent, which is what\n * makes it exitable without the operators. A stored chain runs from some parent\n * to a root, so holding the parent the leaf has now means it spans the whole\n * path. A leaf that is itself a root needs no ancestors. An empty incoming\n * chain means \"unknown\", not \"none\", so it keeps whatever the row already\n * claimed, unless the leaf has been reparented since: the chain then describes\n * the parent it had before.\n */\n _chainComplete(node, ancestors, existingRow) {\n if (node.parent_node_id == null) return true;\n if (ancestors && ancestors.length > 0) {\n return ancestors.some((a) => a.id === node.parent_node_id);\n }\n if (!existingRow) return false;\n return (\n existingRow.parent_node_id === node.parent_node_id &&\n !!existingRow.chain_complete\n );\n }\n\n /** Row shape for an ancestor: no pool metadata (reservation / missing / added_at).\n * `leaf_id` plus `id` is the key, so the same node stores one row per leaf\n * that descends from it rather than one row shared by all of them. */\n _ancestorRow(leafId, node) {\n return {\n leaf_id: leafId,\n id: node.id,\n parent_node_id: node.parent_node_id ?? null,\n status: node.status,\n value: node.value,\n verifying_public_key: node.verifying_public_key,\n signing_public_key: node.signing_keyshare.public_key,\n data: node,\n };\n }\n\n /** Groups ancestor rows (from a full-store read) by the leaf that owns them,\n * as `Map<leaf_id, Map<id, row>>`, so a leaf's existing rows can be found\n * and deleted by key without a range scan on the compound `[leaf_id, id]`\n * keyPath. */\n _ancestorRowsByLeaf(ancestorRows) {\n const map = new Map();\n for (const row of ancestorRows || []) {\n let byId = map.get(row.leaf_id);\n if (!byId) {\n byId = new Map();\n map.set(row.leaf_id, byId);\n }\n byId.set(row.id, row);\n }\n return map;\n }\n\n /**\n * Replaces `leafId`'s ancestor rows wholesale (delete then insert), keeping\n * `ancestorRowsByLeaf` current so a later step in the same transaction sees\n * this leaf's live rows rather than a stale snapshot. An empty `nodes` list\n * is a no-op: it means the chain is unknown, not that the leaf has none.\n */\n _replaceAncestors(ancestorsStore, ancestorRowsByLeaf, leafId, nodes) {\n if (!nodes || nodes.length === 0) return;\n\n const ownRows = ancestorRowsByLeaf.get(leafId);\n if (ownRows) {\n for (const existingId of ownRows.keys()) {\n ancestorsStore.delete([leafId, existingId]);\n }\n }\n const newRows = new Map();\n for (const node of nodes) {\n const row = this._ancestorRow(leafId, node);\n ancestorsStore.put(row);\n newRows.set(node.id, row);\n }\n ancestorRowsByLeaf.set(leafId, newRows);\n }\n\n _createReservation(\n reservationsStore,\n leavesStore,\n leafMap,\n reservationId,\n leafIds,\n purpose,\n pendingChange\n ) {\n reservationsStore.put({\n id: reservationId,\n purpose,\n pending_change_amount: pendingChange,\n created_at: this._nowMs(),\n });\n for (const id of leafIds) {\n const row = leafMap.get(id);\n if (row) {\n row.reservation_id = reservationId;\n leavesStore.put(row);\n }\n }\n }\n\n /** Slim `{id, value}` projection of the leaves eligible for selection. */\n _eligibleSlim(leafRows) {\n return leafRows\n .filter(\n (r) =>\n r.status === \"Available\" &&\n !r.is_missing_from_operators &&\n r.reservation_id == null\n )\n .map((r) => ({ id: r.id, value: r.value }));\n }\n\n /**\n * Prefilter mirroring the SQL slim candidate set: every eligible leaf with\n * value <= maxTarget, plus the single smallest leaf with value > maxTarget\n * (the minimum-amount fallback where one larger leaf alone suffices).\n */\n _slimCandidates(eligible, maxTarget) {\n const small = eligible.filter((l) => l.value <= maxTarget);\n let smallestBig = null;\n for (const l of eligible) {\n if (l.value > maxTarget && (smallestBig === null || l.value < smallestBig.value)) {\n smallestBig = l;\n }\n }\n return smallestBig ? [...small, smallestBig] : small;\n }\n\n _maxTargetForPrefilter(targetAmounts) {\n if (!targetAmounts) return Number.MAX_SAFE_INTEGER;\n if (targetAmounts.type === \"amountAndFee\") {\n return targetAmounts.amountSats + (targetAmounts.feeSats || 0);\n }\n if (targetAmounts.type === \"exactDenominations\") {\n return targetAmounts.denominations.reduce((m, v) => m + v, 0);\n }\n return Number.MAX_SAFE_INTEGER;\n }\n\n _totalSats(targetAmounts) {\n if (targetAmounts.type === \"amountAndFee\") {\n return targetAmounts.amountSats + (targetAmounts.feeSats || 0);\n }\n if (targetAmounts.type === \"exactDenominations\") {\n return targetAmounts.denominations.reduce((sum, d) => sum + d, 0);\n }\n return 0;\n }\n\n _selectLeavesByTargetAmounts(leaves, targetAmounts) {\n if (!targetAmounts) {\n return [...leaves];\n }\n\n if (targetAmounts.type === \"amountAndFee\") {\n const amountLeaves = this._selectLeavesByExactAmount(\n leaves,\n targetAmounts.amountSats\n );\n if (amountLeaves === null) return null;\n\n if (targetAmounts.feeSats != null && targetAmounts.feeSats > 0) {\n const amountIds = new Set(amountLeaves.map((l) => l.id));\n const remaining = leaves.filter((l) => !amountIds.has(l.id));\n const feeLeaves = this._selectLeavesByExactAmount(\n remaining,\n targetAmounts.feeSats\n );\n if (feeLeaves === null) return null;\n return [...amountLeaves, ...feeLeaves];\n }\n\n return amountLeaves;\n }\n\n if (targetAmounts.type === \"exactDenominations\") {\n return this._selectLeavesByExactDenominations(\n leaves,\n targetAmounts.denominations\n );\n }\n\n return null;\n }\n\n _selectLeavesByExactAmount(leaves, targetAmount) {\n if (targetAmount === 0) return null;\n\n const totalAvailable = leaves.reduce((sum, l) => sum + l.value, 0);\n if (totalAvailable < targetAmount) return null;\n\n const single = leaves.find((l) => l.value === targetAmount);\n if (single) return [single];\n\n const multipleResult = this._findExactMultipleMatch(leaves, targetAmount);\n return multipleResult;\n }\n\n _selectLeavesByExactDenominations(leaves, denominations) {\n const remaining = [...leaves];\n const selected = [];\n\n for (const denomination of denominations) {\n const idx = remaining.findIndex((l) => l.value === denomination);\n if (idx === -1) return null;\n selected.push(remaining[idx]);\n remaining.splice(idx, 1);\n }\n\n return selected;\n }\n\n _selectLeavesByMinimumAmount(leaves, targetAmount) {\n if (targetAmount === 0) return null;\n\n const totalAvailable = leaves.reduce((sum, l) => sum + l.value, 0);\n if (totalAvailable < targetAmount) return null;\n\n const result = [];\n let sum = 0;\n for (const leaf of leaves) {\n sum += leaf.value;\n result.push(leaf);\n if (sum >= targetAmount) break;\n }\n\n return sum >= targetAmount ? result : null;\n }\n\n _findExactMultipleMatch(leaves, targetAmount) {\n if (targetAmount === 0) return [];\n if (leaves.length === 0) return null;\n\n const result = this._greedyExactMatch(leaves, targetAmount);\n if (result) return result;\n\n const powerOfTwoLeaves = leaves.filter((l) => this._isPowerOfTwo(l.value));\n if (powerOfTwoLeaves.length === leaves.length) return null;\n\n return this._greedyExactMatch(powerOfTwoLeaves, targetAmount);\n }\n\n _greedyExactMatch(leaves, targetAmount) {\n const sorted = [...leaves].sort((a, b) => b.value - a.value);\n const result = [];\n let remaining = targetAmount;\n\n for (const leaf of sorted) {\n if (leaf.value > remaining) continue;\n remaining -= leaf.value;\n result.push(leaf);\n if (remaining === 0) return result;\n }\n\n return null;\n }\n\n _isPowerOfTwo(value) {\n return value > 0 && (value & (value - 1)) === 0;\n }\n}\n\n/**\n * Opens (or creates) the IndexedDB database and returns a ready tree store.\n *\n * @param {string} dbName - Database name (one database per SDK instance).\n * @param {object} [logger] - Optional logger.\n * @returns {Promise<WebTreeStore>}\n */\nexport async function createWebTreeStore(dbName, logger = null) {\n const store = new WebTreeStore(dbName, logger);\n await store.initialize();\n return store;\n}\n\n/**\n * Deletes a tree store database. Intended for tests that need a clean database;\n * production code never calls this.\n *\n * @param {string} dbName\n * @returns {Promise<void>}\n */\nexport async function deleteWebTreeStore(dbName) {\n await new Promise((resolve, reject) => {\n const req = indexedDB.deleteDatabase(dbName);\n req.onsuccess = () => resolve();\n req.onerror = () => reject(req.error);\n // A stale open connection can block deletion; proceed anyway.\n req.onblocked = () => resolve();\n });\n}\n\nexport { WebTreeStore, TreeStoreError };\n"],"ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,IAAM,yBAAyB;;AAG/B,IAAM,oCAAoC;AAE1C,IAAM,aAAa;AAEnB,IAAM,eAAe;AACrB,IAAM,kBAAkB;AACxB,IAAM,qBAAqB;AAC3B,IAAM,cAAc;AACpB,IAAM,oBAAoB;;AAG1B,IAAM,iBAAiB;AAEvB,IAAM,iBAAN,MAAM,uBAAuB,MAAM;CACjC,YAAY,SAAS,QAAQ,MAAM;EACjC,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,QAAQ;EACb,IAAI,MAAM,mBACR,MAAM,kBAAkB,MAAM,cAAc;CAEhD;AACF;AAEA,SAAS,oBAAoB;CAC3B,IAAI,OAAO,cAAc,aAAa,OAAO;CAC7C,IAAI,OAAO,eAAe,eAAe,WAAW,WAClD,OAAO,WAAW;CAEpB,IAAI,OAAO,SAAS,eAAe,KAAK,WAAW,OAAO,KAAK;CAC/D,IAAI,OAAO,WAAW,eAAe,OAAO,WAAW,OAAO,OAAO;CACrE,OAAO;AACT;;;;;;;;;AAUA,SAAS,kBAAkB,OAAO,QAAQ;CACxC,MAAM,OAAO,MAAM,IAAI,MAAM;CAC7B,IAAI,CAAC,MAAM,OAAO;CAClB,MAAM,YAAY,C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engine/paymentAdapters/providers/types.ts
2
2
  var PROVIDER_PLATFORMS = [
3
3
  "web",
4
4
  "extension",
@@ -117,7 +117,6 @@ function redact(error, secrets = {}) {
117
117
  for (const value of Object.values(secrets)) if (value && value.length >= 4) message = message.split(value).join("•••");
118
118
  return message.slice(0, 300);
119
119
  }
120
- //#endregion
121
120
  export { describeProvider as a, offeredIn as c, sourceProblem as d, SourceUnreachableError as i, providerDescriptorProblems as l, PROVIDER_PLATFORMS as n, isNothingSpentError as o, SourceConfigError as r, networkMode as s, NothingSpentError as t, redact as u };
122
121
 
123
- //# sourceMappingURL=types-Clyb52K2.js.map
122
+ //# sourceMappingURL=types-CdWwgvyt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-Clyb52K2.js","names":[],"sources":["../../../browser/src/engine/paymentAdapters/providers/types.ts"],"sourcesContent":["import type { BitcoinNetwork } from \"@ghostly/core\";\nimport type { WalletMode } from \"../../../shared/mints\";\n\n/**\n * What every wallet provider (a source of Lightning or of on-chain Bitcoin) shares: where it runs, how\n * it is configured, and the one distinction that keeps money safe. See PROVIDERS.md.\n */\n\n/** Where Ghostly runs: the web app, the browser extension (engine in an offscreen document), the Tauri app. */\nexport type ProviderPlatform = \"web\" | \"extension\" | \"desktop\";\nexport const PROVIDER_PLATFORMS: readonly ProviderPlatform[] = [\"web\", \"extension\", \"desktop\"];\nexport type ProviderKind = \"lightning\" | \"onchain\";\n/** The chain a provider's sats live on. Only `bitcoin` is real money; the others belong to the Testnet mode. */\nexport type ProviderNetwork = BitcoinNetwork;\nexport const PROVIDER_NETWORKS: readonly ProviderNetwork[] = [\"bitcoin\", \"signet\", \"testnet\", \"regtest\", \"mutinynet\"];\nexport const networkMode = (network: ProviderNetwork): WalletMode => (network === \"bitcoin\" ? \"mainnet\" : \"testnet\");\n\n/**\n * One field of a provider's configuration form. The wallet card renders these; a provider that needs\n * more registers its own form component instead (apps/ui/src/components/wallet/providers/forms.ts).\n * `secret` fields (an NWC URI, a macaroon, a rune, an API key, a password) are sealed before they are\n * stored, never shown again, never put in the engine state, and never logged.\n */\nexport interface ProviderField {\n name: string;\n label: string;\n kind: \"text\" | \"url\" | \"secret\" | \"select\" | \"textarea\";\n placeholder?: string;\n help?: string;\n optional?: boolean;\n /** `select` only. */\n options?: { value: string; label: string }[];\n /** Pre-filled per mode, e.g. a public test server for Testnet. */\n defaults?: Partial<Record<WalletMode, string>>;\n /**\n * Values offered under a `url` or `text` field (a list to pick from, anything may still be typed), each\n * only while the other fields hold `when`: e.g. a public Esplora server per network.\n */\n suggestions?: { value: string; label: string; when?: Record<string, string> }[];\n /**\n * A server address that can be changed on a saved source without its secrets being typed again, and\n * without changing whose money it is: an Esplora server of a BDK wallet (the wallet is the phrase). The\n * source's \"Change server\" edits these fields only. Never mark a field that picks another account (a\n * node's URL: another node is other money).\n */\n changeable?: boolean;\n}\n\n/** What the person typed, split by the field kinds: `config` is shown back, `secrets` never is. */\nexport interface ProviderSettings {\n config: Record<string, string>;\n secrets: Record<string, string>;\n}\n\n/** What the engine hands a provider's factory. */\nexport interface ProviderHost {\n platform: ProviderPlatform;\n /** The wallet mode the source is for: its provider must be on a network of this mode. */\n mode: WalletMode;\n /**\n * Reserved for the built-in Cashu mint source: the engine's own wallet. It is not part of the SDK, and\n * no other provider should read it.\n */\n cashu?: unknown;\n /**\n * Reserved for the built-in Cashu mint source: the Cashu balance of the mode in the engine's last wallet view, once\n * there is one. The view is made again whenever the wallet changes.\n */\n cashuBalance?: () => number | undefined;\n /** Reserved for the built-in Fedimint source: the engine's Fedimint wallet (its joined federations). Not part of the SDK. */\n fedimint?: unknown;\n /** Ends when the source is replaced, the mode switches or the engine stops: abort long waits on it. */\n signal: AbortSignal;\n /**\n * Desktop only: calls a command of the Tauri app (apps/desktop), for what a WebView cannot do (a pinned\n * certificate, no CORS, a raw socket). Absent on the web and in the extension.\n */\n invoke?: <T>(command: string, args: Record<string, unknown>) => Promise<T>;\n}\n\n/**\n * A provider module's export. Registering a provider is adding its module and one line in\n * `registry.ts`; everything else (storage, sealing, per-mode sources, the card, journals) is shared.\n */\nexport interface ProviderDescriptor<P> {\n id: string;\n label: string;\n kind: ProviderKind;\n /** One line under the name in the source picker: what it is and who holds the money. */\n description: string;\n /** Networks it can run on. A mode lists only providers with a network of that mode. */\n networks: readonly ProviderNetwork[];\n platforms: readonly ProviderPlatform[];\n fields: readonly ProviderField[];\n /** Custodial (someone else holds the sats) or still experimental: said in the picker. */\n custodial?: boolean;\n experimental?: boolean;\n /** Checks the form before anything is contacted; throws a message fit for the person. */\n validate?(settings: ProviderSettings, mode: WalletMode): void;\n /**\n * The wallet these (validated) settings reach, whatever their spelling: two sources with the same answer are one\n * wallet, and the same balance. Absent: the same settings, byte for byte.\n */\n wallet?(settings: ProviderSettings): string;\n /** Connects. The engine then asks `info()` and refuses a network of the other mode. */\n create(settings: ProviderSettings, host: ProviderHost): Promise<P>;\n}\n\n/** A provider can be offered here: it runs on this platform and on a network of this mode. */\nexport const offeredIn = (descriptor: { platforms: readonly ProviderPlatform[]; networks: readonly ProviderNetwork[] }, platform: ProviderPlatform, mode: WalletMode) =>\n descriptor.platforms.includes(platform) && descriptor.networks.some((network) => networkMode(network) === mode);\n\nconst FIELD_KINDS = [\"text\", \"url\", \"secret\", \"select\", \"textarea\"];\n/** What is stored with the profile and sent on the wire in journals: stable, short, lowercase. */\nexport const PROVIDER_ID = /^[a-z][a-z0-9-]{0,31}$/;\n\n/**\n * Problems with a provider descriptor, empty when it is well-formed. The registry refuses a descriptor\n * with any; the contract suite checks the same list, so an author sees them before the app does.\n */\nexport function providerDescriptorProblems(d: ProviderDescriptor<unknown>): string[] {\n const problems: string[] = [];\n if (!PROVIDER_ID.test(d.id ?? \"\")) problems.push(\"id must match ^[a-z][a-z0-9-]{0,31}$\");\n if (!d.label?.trim()) problems.push(\"label is empty\");\n if (d.kind !== \"lightning\" && d.kind !== \"onchain\") problems.push(\"kind must be lightning or onchain\");\n if (!d.description?.trim()) problems.push(\"description is empty: say what it is and who holds the money\");\n if (!Array.isArray(d.networks) || !d.networks.length) problems.push(\"no networks\");\n else for (const n of d.networks) if (!PROVIDER_NETWORKS.includes(n)) problems.push(`unknown network ${String(n)}`);\n if (!Array.isArray(d.platforms) || !d.platforms.length) problems.push(\"no platforms\");\n else for (const p of d.platforms) if (!PROVIDER_PLATFORMS.includes(p)) problems.push(`unknown platform ${String(p)}`);\n if (!Array.isArray(d.fields)) problems.push(\"fields must be a list (empty when there is nothing to configure)\");\n else {\n const names = d.fields.map((f) => f.name);\n if (new Set(names).size !== names.length) problems.push(\"field names are not unique\");\n for (const f of d.fields) {\n if (!/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/.test(f.name ?? \"\")) problems.push(`field ${String(f.name)} has an invalid name`);\n if (!f.label?.trim()) problems.push(`field ${f.name} has no label`);\n if (!FIELD_KINDS.includes(f.kind)) problems.push(`field ${f.name} has an unknown kind`);\n if (f.kind === \"select\" && !f.options?.length) problems.push(`field ${f.name} is a select without options`);\n if (f.suggestions !== undefined && (!Array.isArray(f.suggestions) || f.suggestions.some((o: { value?: unknown; label?: unknown } | undefined) => typeof o?.value !== \"string\" || typeof o?.label !== \"string\"))) problems.push(`field ${f.name} has malformed suggestions`);\n if (f.changeable && (f.kind === \"secret\" || f.kind === \"select\")) problems.push(`field ${f.name} cannot be changeable: only a server address can`);\n }\n }\n if (typeof d.create !== \"function\") problems.push(\"create is not a function\");\n if (d.validate !== undefined && typeof d.validate !== \"function\") problems.push(\"validate is not a function\");\n if (d.wallet !== undefined && typeof d.wallet !== \"function\") problems.push(\"wallet is not a function\");\n return problems;\n}\n\n/** The serializable part of a descriptor, for the UI (a function cannot cross the extension's port). */\nexport type ProviderDescriptorView = Omit<ProviderDescriptor<unknown>, \"create\" | \"validate\" | \"wallet\">;\n/** Only these fields reach the UI, whatever else a provider module keeps on its descriptor. */\nexport const describeProvider = ({ id, label, kind, description, networks, platforms, fields, custodial, experimental }: ProviderDescriptor<unknown>): ProviderDescriptorView =>\n ({ id, label, kind, description, networks, platforms, fields, custodial, experimental });\n\n/**\n * The provider proved that nothing left the wallet (refused before sending, no route found before any\n * HTLC, a transaction that was never broadcast). Safe to try again, with this or another source.\n *\n * Any other error from a spend means the outcome is UNKNOWN: the payment may be in flight or done. It is\n * recorded as such and only reconciled (asked about), never retried. When in doubt, do not throw this.\n */\nexport class NothingSpentError extends Error {\n constructor(message: string) { super(message); this.name = \"NothingSpentError\"; }\n}\n\n/**\n * The source could not be reached: no answer, a time-out, a refused connection, a server error. The\n * engine keeps trying by itself (with backoff) and shows the source as connecting meanwhile.\n */\nexport class SourceUnreachableError extends Error {\n constructor(message: string, cause?: unknown) { super(message); this.name = \"SourceUnreachableError\"; if (cause !== undefined) Object.assign(this, { cause }); }\n}\n\n/**\n * A setting of the source is wrong (a server on another network, a phrase that makes no wallet): trying\n * again changes nothing until the setting does. The engine shows it as unavailable at once.\n */\nexport class SourceConfigError extends Error {\n constructor(message: string, cause?: unknown) { super(message); this.name = \"SourceConfigError\"; if (cause !== undefined) Object.assign(this, { cause }); }\n}\n\n/** What went wrong connecting a source, by name (a plugin bundles its own copies of these classes). */\nexport type SourceProblem = \"unreachable\" | \"config\" | \"other\";\nexport const sourceProblem = (error: unknown): SourceProblem =>\n error instanceof Error && error.name === \"SourceUnreachableError\" ? \"unreachable\" : error instanceof Error && error.name === \"SourceConfigError\" ? \"config\" : \"other\";\n\n/**\n * Whether an error says nothing was spent. By name, not by class: a provider built outside the app (an\n * SDK plugin bundled with its own copy of `NothingSpentError`) must be understood the same way.\n */\nexport const isNothingSpentError = (error: unknown): error is NothingSpentError =>\n error instanceof NothingSpentError || (error instanceof Error && error.name === \"NothingSpentError\");\n\n/**\n * An error message fit to show and store: every secret the source was given is blanked out, in case a\n * library echoed a URI or a key back.\n */\nexport function redact(error: unknown, secrets: Record<string, string> = {}): string {\n let message = error instanceof Error ? error.message : String(error);\n for (const value of Object.values(secrets)) if (value && value.length >= 4) message = message.split(value).join(\"•••\");\n return message.slice(0, 300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Y,SAAiB;EAAE,MAAM,OAAO;EAAG,KAAK,OAAO;CAAqB;AAClF;;;;;AAMA,IAAa,yBAAb,cAA4C,MAAM;CAChD,YAAY,SAAiB,OAAiB;EAAE,MAAM,OAAO;EAAG,KAAK,OAAO;EAA0B,IAAI,UAAU,KAAA,GAAW,OAAO,OAAO,MAAM,EAAE,MAAM,CAAC;CAAG;AACjK;;;;;AAMA,IAAa,oBAAb,cAAuC,MAAM;CAC3C,YAAY,SAAiB,OAAiB;EAAE,MAAM,OAAO;EAAG,KAAK,OAAO;EAAqB,IAAI,UAAU,KAAA,GAAW,OAAO,OAAO,MAAM,EAAE,MAAM,CAAC;CAAG;AAC5J;AAIA,IAAa,iBAAiB,UAC5B,iBAAiB,SAAS,MAAM,SAAS,2BAA2B,gBAAgB,iBAAiB,SAAS,MAAM,SAAS,sBAAsB,WAAW;;;;;AAMhK,IAAa,uBAAuB,UAClC,iBAAiB,qBAAsB,iBAAiB,SAAS,MAAM,SAAS;;;;;AAMlF,SAAgB,OAAO,OAAgB,UAAkC,CAAC,GAAW;CACnF,IAAI,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACnE,KAAK,MAAM,SAAS,OAAO,OAAO,OAAO,GAAG,IAAI,SAAS,MAAM,UAAU,GAAG,UAAU,QAAQ,MAAM,KAAK,CAAC,CAAC,KAAK,KAAK;CACrH,OAAO,QAAQ,MAAM,GAAG,GAAG;AAC7B"}
1
+ {"version":3,"file":"types-CdWwgvyt.js","names":[],"sources":["../../../browser/src/engine/paymentAdapters/providers/types.ts"],"sourcesContent":["import type { BitcoinNetwork } from \"@ghostly/core\";\nimport type { WalletMode } from \"../../../shared/mints\";\n\n/**\n * What every wallet provider (a source of Lightning or of on-chain Bitcoin) shares: where it runs, how\n * it is configured, and the one distinction that keeps money safe. See PROVIDERS.md.\n */\n\n/** Where Ghostly runs: the web app, the browser extension (engine in an offscreen document), the Tauri app. */\nexport type ProviderPlatform = \"web\" | \"extension\" | \"desktop\";\nexport const PROVIDER_PLATFORMS: readonly ProviderPlatform[] = [\"web\", \"extension\", \"desktop\"];\nexport type ProviderKind = \"lightning\" | \"onchain\";\n/** The chain a provider's sats live on. Only `bitcoin` is real money; the others belong to the Testnet mode. */\nexport type ProviderNetwork = BitcoinNetwork;\nexport const PROVIDER_NETWORKS: readonly ProviderNetwork[] = [\"bitcoin\", \"signet\", \"testnet\", \"regtest\", \"mutinynet\"];\nexport const networkMode = (network: ProviderNetwork): WalletMode => (network === \"bitcoin\" ? \"mainnet\" : \"testnet\");\n\n/**\n * One field of a provider's configuration form. The wallet card renders these; a provider that needs\n * more registers its own form component instead (apps/ui/src/components/wallet/providers/forms.ts).\n * `secret` fields (an NWC URI, a macaroon, a rune, an API key, a password) are sealed before they are\n * stored, never shown again, never put in the engine state, and never logged.\n */\nexport interface ProviderField {\n name: string;\n label: string;\n kind: \"text\" | \"url\" | \"secret\" | \"select\" | \"textarea\";\n placeholder?: string;\n help?: string;\n optional?: boolean;\n /** `select` only. */\n options?: { value: string; label: string }[];\n /** Pre-filled per mode, e.g. a public test server for Testnet. */\n defaults?: Partial<Record<WalletMode, string>>;\n /**\n * Values offered under a `url` or `text` field (a list to pick from, anything may still be typed), each\n * only while the other fields hold `when`: e.g. a public Esplora server per network.\n */\n suggestions?: { value: string; label: string; when?: Record<string, string> }[];\n /**\n * A server address that can be changed on a saved source without its secrets being typed again, and\n * without changing whose money it is: an Esplora server of a BDK wallet (the wallet is the phrase). The\n * source's \"Change server\" edits these fields only. Never mark a field that picks another account (a\n * node's URL: another node is other money).\n */\n changeable?: boolean;\n}\n\n/** What the person typed, split by the field kinds: `config` is shown back, `secrets` never is. */\nexport interface ProviderSettings {\n config: Record<string, string>;\n secrets: Record<string, string>;\n}\n\n/** What the engine hands a provider's factory. */\nexport interface ProviderHost {\n platform: ProviderPlatform;\n /** The wallet mode the source is for: its provider must be on a network of this mode. */\n mode: WalletMode;\n /**\n * Reserved for the built-in Cashu mint source: the engine's own wallet. It is not part of the SDK, and\n * no other provider should read it.\n */\n cashu?: unknown;\n /**\n * Reserved for the built-in Cashu mint source: the Cashu balance of the mode in the engine's last wallet view, once\n * there is one. The view is made again whenever the wallet changes.\n */\n cashuBalance?: () => number | undefined;\n /** Reserved for the built-in Fedimint source: the engine's Fedimint wallet (its joined federations). Not part of the SDK. */\n fedimint?: unknown;\n /** Ends when the source is replaced, the mode switches or the engine stops: abort long waits on it. */\n signal: AbortSignal;\n /**\n * Desktop only: calls a command of the Tauri app (apps/desktop), for what a WebView cannot do (a pinned\n * certificate, no CORS, a raw socket). Absent on the web and in the extension.\n */\n invoke?: <T>(command: string, args: Record<string, unknown>) => Promise<T>;\n}\n\n/**\n * A provider module's export. Registering a provider is adding its module and one line in\n * `registry.ts`; everything else (storage, sealing, per-mode sources, the card, journals) is shared.\n */\nexport interface ProviderDescriptor<P> {\n id: string;\n label: string;\n kind: ProviderKind;\n /** One line under the name in the source picker: what it is and who holds the money. */\n description: string;\n /** Networks it can run on. A mode lists only providers with a network of that mode. */\n networks: readonly ProviderNetwork[];\n platforms: readonly ProviderPlatform[];\n fields: readonly ProviderField[];\n /** Custodial (someone else holds the sats) or still experimental: said in the picker. */\n custodial?: boolean;\n experimental?: boolean;\n /** Checks the form before anything is contacted; throws a message fit for the person. */\n validate?(settings: ProviderSettings, mode: WalletMode): void;\n /**\n * The wallet these (validated) settings reach, whatever their spelling: two sources with the same answer are one\n * wallet, and the same balance. Absent: the same settings, byte for byte.\n */\n wallet?(settings: ProviderSettings): string;\n /** Connects. The engine then asks `info()` and refuses a network of the other mode. */\n create(settings: ProviderSettings, host: ProviderHost): Promise<P>;\n}\n\n/** A provider can be offered here: it runs on this platform and on a network of this mode. */\nexport const offeredIn = (descriptor: { platforms: readonly ProviderPlatform[]; networks: readonly ProviderNetwork[] }, platform: ProviderPlatform, mode: WalletMode) =>\n descriptor.platforms.includes(platform) && descriptor.networks.some((network) => networkMode(network) === mode);\n\nconst FIELD_KINDS = [\"text\", \"url\", \"secret\", \"select\", \"textarea\"];\n/** What is stored with the profile and sent on the wire in journals: stable, short, lowercase. */\nexport const PROVIDER_ID = /^[a-z][a-z0-9-]{0,31}$/;\n\n/**\n * Problems with a provider descriptor, empty when it is well-formed. The registry refuses a descriptor\n * with any; the contract suite checks the same list, so an author sees them before the app does.\n */\nexport function providerDescriptorProblems(d: ProviderDescriptor<unknown>): string[] {\n const problems: string[] = [];\n if (!PROVIDER_ID.test(d.id ?? \"\")) problems.push(\"id must match ^[a-z][a-z0-9-]{0,31}$\");\n if (!d.label?.trim()) problems.push(\"label is empty\");\n if (d.kind !== \"lightning\" && d.kind !== \"onchain\") problems.push(\"kind must be lightning or onchain\");\n if (!d.description?.trim()) problems.push(\"description is empty: say what it is and who holds the money\");\n if (!Array.isArray(d.networks) || !d.networks.length) problems.push(\"no networks\");\n else for (const n of d.networks) if (!PROVIDER_NETWORKS.includes(n)) problems.push(`unknown network ${String(n)}`);\n if (!Array.isArray(d.platforms) || !d.platforms.length) problems.push(\"no platforms\");\n else for (const p of d.platforms) if (!PROVIDER_PLATFORMS.includes(p)) problems.push(`unknown platform ${String(p)}`);\n if (!Array.isArray(d.fields)) problems.push(\"fields must be a list (empty when there is nothing to configure)\");\n else {\n const names = d.fields.map((f) => f.name);\n if (new Set(names).size !== names.length) problems.push(\"field names are not unique\");\n for (const f of d.fields) {\n if (!/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/.test(f.name ?? \"\")) problems.push(`field ${String(f.name)} has an invalid name`);\n if (!f.label?.trim()) problems.push(`field ${f.name} has no label`);\n if (!FIELD_KINDS.includes(f.kind)) problems.push(`field ${f.name} has an unknown kind`);\n if (f.kind === \"select\" && !f.options?.length) problems.push(`field ${f.name} is a select without options`);\n if (f.suggestions !== undefined && (!Array.isArray(f.suggestions) || f.suggestions.some((o: { value?: unknown; label?: unknown } | undefined) => typeof o?.value !== \"string\" || typeof o?.label !== \"string\"))) problems.push(`field ${f.name} has malformed suggestions`);\n if (f.changeable && (f.kind === \"secret\" || f.kind === \"select\")) problems.push(`field ${f.name} cannot be changeable: only a server address can`);\n }\n }\n if (typeof d.create !== \"function\") problems.push(\"create is not a function\");\n if (d.validate !== undefined && typeof d.validate !== \"function\") problems.push(\"validate is not a function\");\n if (d.wallet !== undefined && typeof d.wallet !== \"function\") problems.push(\"wallet is not a function\");\n return problems;\n}\n\n/** The serializable part of a descriptor, for the UI (a function cannot cross the extension's port). */\nexport type ProviderDescriptorView = Omit<ProviderDescriptor<unknown>, \"create\" | \"validate\" | \"wallet\">;\n/** Only these fields reach the UI, whatever else a provider module keeps on its descriptor. */\nexport const describeProvider = ({ id, label, kind, description, networks, platforms, fields, custodial, experimental }: ProviderDescriptor<unknown>): ProviderDescriptorView =>\n ({ id, label, kind, description, networks, platforms, fields, custodial, experimental });\n\n/**\n * The provider proved that nothing left the wallet (refused before sending, no route found before any\n * HTLC, a transaction that was never broadcast). Safe to try again, with this or another source.\n *\n * Any other error from a spend means the outcome is UNKNOWN: the payment may be in flight or done. It is\n * recorded as such and only reconciled (asked about), never retried. When in doubt, do not throw this.\n */\nexport class NothingSpentError extends Error {\n constructor(message: string) { super(message); this.name = \"NothingSpentError\"; }\n}\n\n/**\n * The source could not be reached: no answer, a time-out, a refused connection, a server error. The\n * engine keeps trying by itself (with backoff) and shows the source as connecting meanwhile.\n */\nexport class SourceUnreachableError extends Error {\n constructor(message: string, cause?: unknown) { super(message); this.name = \"SourceUnreachableError\"; if (cause !== undefined) Object.assign(this, { cause }); }\n}\n\n/**\n * A setting of the source is wrong (a server on another network, a phrase that makes no wallet): trying\n * again changes nothing until the setting does. The engine shows it as unavailable at once.\n */\nexport class SourceConfigError extends Error {\n constructor(message: string, cause?: unknown) { super(message); this.name = \"SourceConfigError\"; if (cause !== undefined) Object.assign(this, { cause }); }\n}\n\n/** What went wrong connecting a source, by name (a plugin bundles its own copies of these classes). */\nexport type SourceProblem = \"unreachable\" | \"config\" | \"other\";\nexport const sourceProblem = (error: unknown): SourceProblem =>\n error instanceof Error && error.name === \"SourceUnreachableError\" ? \"unreachable\" : error instanceof Error && error.name === \"SourceConfigError\" ? \"config\" : \"other\";\n\n/**\n * Whether an error says nothing was spent. By name, not by class: a provider built outside the app (an\n * SDK plugin bundled with its own copy of `NothingSpentError`) must be understood the same way.\n */\nexport const isNothingSpentError = (error: unknown): error is NothingSpentError =>\n error instanceof NothingSpentError || (error instanceof Error && error.name === \"NothingSpentError\");\n\n/**\n * An error message fit to show and store: every secret the source was given is blanked out, in case a\n * library echoed a URI or a key back.\n */\nexport function redact(error: unknown, secrets: Record<string, string> = {}): string {\n let message = error instanceof Error ? error.message : String(error);\n for (const value of Object.values(secrets)) if (value && value.length >= 4) message = message.split(value).join(\"•••\");\n return message.slice(0, 300);\n}\n"],"mappings":";AAUA,IAAa,qBAAkD;CAAC;CAAO;CAAa;AAAS;AAI7F,IAAa,oBAAgD;CAAC;CAAW;CAAU;CAAW;CAAW;AAAW;AACpH,IAAa,eAAe,YAA0C,YAAY,YAAY,YAAY;;AA8F1G,IAAa,aAAa,YAA8F,UAA4B,SAClJ,WAAW,UAAU,SAAS,QAAQ,KAAK,WAAW,SAAS,MAAM,YAAY,YAAY,OAAO,MAAM,IAAI;AAEhH,IAAM,cAAc;CAAC;CAAQ;CAAO;CAAU;CAAU;AAAU;;AAElE,IAAa,cAAc;;;;;AAM3B,SAAgB,2BAA2B,GAA0C;CACnF,MAAM,WAAqB,CAAC;CAC5B,IAAI,CAAC,YAAY,KAAK,EAAE,MAAM,EAAE,GAAG,SAAS,KAAK,sCAAsC;CACvF,IAAI,CAAC,EAAE,OAAO,KAAK,GAAG,SAAS,KAAK,gBAAgB;CACpD,IAAI,EAAE,SAAS,eAAe,EAAE,SAAS,WAAW,SAAS,KAAK,mCAAmC;CACrG,IAAI,CAAC,EAAE,aAAa,KAAK,GAAG,SAAS,KAAK,8DAA8D;CACxG,IAAI,CAAC,MAAM,QAAQ,EAAE,QAAQ,KAAK,CAAC,EAAE,SAAS,QAAQ,SAAS,KAAK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MAAM,UAAU,GAAG,UAAU,QAAQ,MAAM,KAAK,CAAC,CAAC,KAAK,KAAK;CACrH,OAAO,QAAQ,MAAM,GAAG,GAAG;AAC7B"}
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/openpgp/dist/lightweight/unbzip2-stream.mjs
1
+ // ../../node_modules/openpgp/dist/lightweight/unbzip2-stream.mjs
2
2
  /*! OpenPGP.js v6.3.2 - 2026-09-24 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function(e) {
@@ -675,7 +675,6 @@ var index$1 = /*#__PURE__*/ _mergeNamespaces({
675
675
  __proto__: null,
676
676
  default: /* @__PURE__ */ getDefaultExportFromCjs(unbzip2StreamExports)
677
677
  }, [unbzip2StreamExports]);
678
- //#endregion
679
678
  export { index$1 as i };
680
679
 
681
- //# sourceMappingURL=unbzip2-stream-B1C-JX9L.js.map
680
+ //# sourceMappingURL=unbzip2-stream-BtkYGpC5.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unbzip2-stream-B1C-JX9L.js","names":[],"sources":["../../../../node_modules/openpgp/dist/lightweight/unbzip2-stream.mjs"],"sourcesContent":["/*! OpenPGP.js v6.3.2 - 2026-09-24 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */\nconst globalThis = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nfunction _mergeNamespaces(n, m) {\n\tm.forEach(function (e) {\n\t\te && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {\n\t\t\tif (k !== 'default' && !(k in n)) {\n\t\t\t\tvar d = Object.getOwnPropertyDescriptor(e, k);\n\t\t\t\tObject.defineProperty(n, k, d.get ? d : {\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tget: function () { return e[k]; }\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t});\n\treturn Object.freeze(n);\n}\n\nfunction getDefaultExportFromCjs (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\n/* \n bzip2.js - a small bzip2 decompression implementation\n \n Copyright 2011 by antimatter15 (antimatter15@gmail.com)\n \n Based on micro-bunzip by Rob Landley (rob@landley.net).\n\n Copyright (c) 2011 by antimatter15 (antimatter15@gmail.com).\n\n Permission is hereby granted, free of charge, to any person obtaining a\n copy of this software and associated documentation files (the \"Software\"),\n to deal in the Software without restriction, including without limitation\n the rights to use, copy, modify, merge, publish, distribute, sublicense,\n and/or sell copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included\n in all copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH\n THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nvar bzip2_1;\nvar hasRequiredBzip2;\n\nfunction requireBzip2 () {\n\tif (hasRequiredBzip2) return bzip2_1;\n\thasRequiredBzip2 = 1;\n\tfunction Bzip2Error(message) {\n\t this.name = 'Bzip2Error';\n\t this.message = message;\n\t this.stack = (new Error()).stack;\n\t}\n\tBzip2Error.prototype = new Error;\n\t \n\tvar message = {\n\t Error: function(message) {throw new Bzip2Error(message);}\n\t};\n\n\tvar bzip2 = {};\n\tbzip2.Bzip2Error = Bzip2Error;\n\n\tbzip2.crcTable =\n\t[\n\t 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9,\n\t 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005,\n\t 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,\n\t 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd,\n\t 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9,\n\t 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,\n\t 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011,\n\t 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd,\n\t 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,\n\t 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5,\n\t 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81,\n\t 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,\n\t 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49,\n\t 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95,\n\t 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,\n\t 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d,\n\t 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae,\n\t 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,\n\t 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16,\n\t 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca,\n\t 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,\n\t 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02,\n\t 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066,\n\t 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,\n\t 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e,\n\t 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692,\n\t 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,\n\t 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a,\n\t 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e,\n\t 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,\n\t 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686,\n\t 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a,\n\t 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,\n\t 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb,\n\t 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f,\n\t 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,\n\t 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47,\n\t 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b,\n\t 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,\n\t 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623,\n\t 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7,\n\t 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,\n\t 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f,\n\t 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3,\n\t 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,\n\t 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b,\n\t 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f,\n\t 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,\n\t 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640,\n\t 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c,\n\t 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,\n\t 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24,\n\t 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30,\n\t 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,\n\t 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088,\n\t 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654,\n\t 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,\n\t 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c,\n\t 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18,\n\t 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,\n\t 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0,\n\t 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c,\n\t 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,\n\t 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4\n\t];\n\n\tbzip2.array = function(bytes) {\n\t var bit = 0, byte = 0;\n\t var BITMASK = [0, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF ];\n\t return function(n) {\n\t var result = 0;\n\t while(n > 0) {\n\t var left = 8 - bit;\n\t if (n >= left) {\n\t result <<= left;\n\t result |= (BITMASK[left] & bytes[byte++]);\n\t bit = 0;\n\t n -= left;\n\t } else {\n\t result <<= n;\n\t result |= ((bytes[byte] & (BITMASK[n] << (8 - n - bit))) >> (8 - n - bit));\n\t bit += n;\n\t n = 0;\n\t }\n\t }\n\t return result;\n\t }\n\t};\n\n\t \n\tbzip2.simple = function(srcbuffer, stream) {\n\t var bits = bzip2.array(srcbuffer);\n\t var size = bzip2.header(bits);\n\t var ret = false;\n\t var bufsize = 100000 * size;\n\t var buf = new Int32Array(bufsize);\n\t \n\t do {\n\t ret = bzip2.decompress(bits, stream, buf, bufsize); \n\t } while(!ret);\n\t};\n\n\tbzip2.header = function(bits) {\n\t this.byteCount = new Int32Array(256);\n\t this.symToByte = new Uint8Array(256);\n\t this.mtfSymbol = new Int32Array(256);\n\t this.selectors = new Uint8Array(0x8000);\n\n\t if (bits(8*3) != 4348520) message.Error(\"No magic number found\");\n\n\t var i = bits(8) - 48;\n\t if (i < 1 || i > 9) message.Error(\"Not a BZIP archive\");\n\t return i;\n\t};\n\n\n\t//takes a function for reading the block data (starting with 0x314159265359)\n\t//a block size (0-9) (optional, defaults to 9)\n\t//a length at which to stop decompressing and return the output\n\tbzip2.decompress = function(bits, stream, buf, bufsize, streamCRC) {\n\t var MAX_HUFCODE_BITS = 20;\n\t var MAX_SYMBOLS = 258;\n\t var SYMBOL_RUNA = 0;\n\t var SYMBOL_RUNB = 1;\n\t var GROUP_SIZE = 50;\n\t var crc = 0 ^ (-1);\n\t \n\t for(var h = '', i = 0; i < 6; i++) h += bits(8).toString(16);\n\t if (h == \"177245385090\") {\n\t var finalCRC = bits(32)|0;\n\t if (finalCRC !== streamCRC) message.Error(\"Error in bzip2: crc32 do not match\");\n\t // align stream to byte\n\t bits(null);\n\t return null; // reset streamCRC for next call\n\t }\n\t if (h != \"314159265359\") message.Error(\"Invalid bzip data\");\n\t var crcblock = bits(32)|0; // CRC code\n\t if (bits(1)) message.Error(\"unsupported obsolete version\");\n\t var origPtr = bits(24);\n\t if (origPtr > bufsize) message.Error(\"Initial position larger than buffer size\");\n\t var t = bits(16);\n\t var symTotal = 0;\n\t for (i = 0; i < 16; i++) {\n\t if (t & (1 << (15 - i))) {\n\t var k = bits(16);\n\t for(j = 0; j < 16; j++) {\n\t if (k & (1 << (15 - j))) {\n\t this.symToByte[symTotal++] = (16 * i) + j;\n\t }\n\t }\n\t }\n\t }\n\n\t var groupCount = bits(3);\n\t if (groupCount < 2 || groupCount > 6) message.Error(\"Invalid bzip data\");\n\t var nSelectors = bits(15);\n\t if (nSelectors == 0) message.Error(\"Invalid bzip data\");\n\t for(var i = 0; i < groupCount; i++) this.mtfSymbol[i] = i;\n\n\t for(var i = 0; i < nSelectors; i++) {\n\t for(var j = 0; bits(1); j++) if (j >= groupCount) message.Error(\"Invalid bzip data\");\n\t var uc = this.mtfSymbol[j];\n\t for(var k = j-1; k>=0; k--) {\n\t this.mtfSymbol[k+1] = this.mtfSymbol[k];\n\t }\n\t this.mtfSymbol[0] = uc;\n\t this.selectors[i] = uc;\n\t }\n\n\t var symCount = symTotal + 2;\n\t var groups = [];\n\t var length = new Uint8Array(MAX_SYMBOLS),\n\t temp = new Uint16Array(MAX_HUFCODE_BITS+1);\n\n\t var hufGroup;\n\n\t for(var j = 0; j < groupCount; j++) {\n\t t = bits(5); //lengths\n\t for(var i = 0; i < symCount; i++) {\n\t while(true){\n\t if (t < 1 || t > MAX_HUFCODE_BITS) message.Error(\"Invalid bzip data\");\n\t if (!bits(1)) break;\n\t if (!bits(1)) t++;\n\t else t--;\n\t }\n\t length[i] = t;\n\t }\n\t var minLen, maxLen;\n\t minLen = maxLen = length[0];\n\t for(var i = 1; i < symCount; i++) {\n\t if (length[i] > maxLen) maxLen = length[i];\n\t else if (length[i] < minLen) minLen = length[i];\n\t }\n\t hufGroup = groups[j] = {};\n\t hufGroup.permute = new Int32Array(MAX_SYMBOLS);\n\t hufGroup.limit = new Int32Array(MAX_HUFCODE_BITS + 1);\n\t hufGroup.base = new Int32Array(MAX_HUFCODE_BITS + 1);\n\n\t hufGroup.minLen = minLen;\n\t hufGroup.maxLen = maxLen;\n\t var base = hufGroup.base;\n\t var limit = hufGroup.limit;\n\t var pp = 0;\n\t for(var i = minLen; i <= maxLen; i++)\n\t for(var t = 0; t < symCount; t++)\n\t if (length[t] == i) hufGroup.permute[pp++] = t;\n\t for(i = minLen; i <= maxLen; i++) temp[i] = limit[i] = 0;\n\t for(i = 0; i < symCount; i++) temp[length[i]]++;\n\t pp = t = 0;\n\t for(i = minLen; i < maxLen; i++) {\n\t pp += temp[i];\n\t limit[i] = pp - 1;\n\t pp <<= 1;\n\t base[i+1] = pp - (t += temp[i]);\n\t }\n\t limit[maxLen] = pp + temp[maxLen] - 1;\n\t base[minLen] = 0;\n\t }\n\n\t for(var i = 0; i < 256; i++) { \n\t this.mtfSymbol[i] = i;\n\t this.byteCount[i] = 0;\n\t }\n\t var runPos, count, symCount, selector;\n\t runPos = count = symCount = selector = 0; \n\t while(true) {\n\t if (!(symCount--)) {\n\t symCount = GROUP_SIZE - 1;\n\t if (selector >= nSelectors) message.Error(\"Invalid bzip data\");\n\t hufGroup = groups[this.selectors[selector++]];\n\t base = hufGroup.base;\n\t limit = hufGroup.limit;\n\t }\n\t i = hufGroup.minLen;\n\t j = bits(i);\n\t while(true) {\n\t if (i > hufGroup.maxLen) message.Error(\"Invalid bzip data\");\n\t if (j <= limit[i]) break;\n\t i++;\n\t j = (j << 1) | bits(1);\n\t }\n\t j -= base[i];\n\t if (j < 0 || j >= MAX_SYMBOLS) message.Error(\"Invalid bzip data\");\n\t var nextSym = hufGroup.permute[j];\n\t if (nextSym == SYMBOL_RUNA || nextSym == SYMBOL_RUNB) {\n\t if (!runPos){\n\t runPos = 1;\n\t t = 0;\n\t }\n\t if (nextSym == SYMBOL_RUNA) t += runPos;\n\t else t += 2 * runPos;\n\t runPos <<= 1;\n\t continue;\n\t }\n\t if (runPos) {\n\t runPos = 0;\n\t if (count + t > bufsize) message.Error(\"Invalid bzip data\");\n\t uc = this.symToByte[this.mtfSymbol[0]];\n\t this.byteCount[uc] += t;\n\t while(t--) buf[count++] = uc;\n\t }\n\t if (nextSym > symTotal) break;\n\t if (count >= bufsize) message.Error(\"Invalid bzip data\");\n\t i = nextSym - 1;\n\t uc = this.mtfSymbol[i];\n\t for(var k = i-1; k>=0; k--) {\n\t this.mtfSymbol[k+1] = this.mtfSymbol[k];\n\t }\n\t this.mtfSymbol[0] = uc;\n\t uc = this.symToByte[uc];\n\t this.byteCount[uc]++;\n\t buf[count++] = uc;\n\t }\n\t if (origPtr < 0 || origPtr >= count) message.Error(\"Invalid bzip data\");\n\t var j = 0;\n\t for(var i = 0; i < 256; i++) {\n\t k = j + this.byteCount[i];\n\t this.byteCount[i] = j;\n\t j = k;\n\t }\n\t for(var i = 0; i < count; i++) {\n\t uc = buf[i] & 0xff;\n\t buf[this.byteCount[uc]] |= (i << 8);\n\t this.byteCount[uc]++;\n\t }\n\t var pos = 0, current = 0, run = 0;\n\t if (count) {\n\t pos = buf[origPtr];\n\t current = (pos & 0xff);\n\t pos >>= 8;\n\t run = -1;\n\t }\n\t count = count;\n\t var copies, previous, outbyte;\n\t while(count) {\n\t count--;\n\t previous = current;\n\t pos = buf[pos];\n\t current = pos & 0xff;\n\t pos >>= 8;\n\t if (run++ == 3) {\n\t copies = current;\n\t outbyte = previous;\n\t current = -1;\n\t } else {\n\t copies = 1;\n\t outbyte = current;\n\t }\n\t while(copies--) {\n\t crc = ((crc << 8) ^ this.crcTable[((crc>>24) ^ outbyte) & 0xFF])&0xFFFFFFFF; // crc32\n\t stream(outbyte);\n\t }\n\t if (current != previous) run = 0;\n\t }\n\n\t crc = (crc ^ (-1)) >>> 0;\n\t if ((crc|0) != (crcblock|0)) message.Error(\"Error in bzip2: crc32 do not match\");\n\t streamCRC = (crc ^ ((streamCRC << 1) | (streamCRC >>> 31))) & 0xFFFFFFFF;\n\t return streamCRC;\n\t};\n\n\tbzip2_1 = bzip2;\n\treturn bzip2_1;\n}\n\nvar bit_iterator;\nvar hasRequiredBit_iterator;\n\nfunction requireBit_iterator () {\n\tif (hasRequiredBit_iterator) return bit_iterator;\n\thasRequiredBit_iterator = 1;\n\tvar BITMASK = [0, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF];\n\n\t// returns a function that reads bits.\n\t// takes a buffer iterator as input\n\tbit_iterator = function bitIterator(nextBuffer) {\n\t var bit = 0, byte = 0;\n\t var bytes = nextBuffer();\n\t var f = function(n) {\n\t if (n === null && bit != 0) { // align to byte boundary\n\t bit = 0;\n\t byte++;\n\t return;\n\t }\n\t var result = 0;\n\t while(n > 0) {\n\t if (byte >= bytes.length) {\n\t byte = 0;\n\t bytes = nextBuffer();\n\t }\n\t var left = 8 - bit;\n\t if (bit === 0 && n > 0)\n\t f.bytesRead++;\n\t if (n >= left) {\n\t result <<= left;\n\t result |= (BITMASK[left] & bytes[byte++]);\n\t bit = 0;\n\t n -= left;\n\t } else {\n\t result <<= n;\n\t result |= ((bytes[byte] & (BITMASK[n] << (8 - n - bit))) >> (8 - n - bit));\n\t bit += n;\n\t n = 0;\n\t }\n\t }\n\t return result;\n\t };\n\t f.bytesRead = 0;\n\t return f;\n\t};\n\treturn bit_iterator;\n}\n\nvar unbzip2Stream_1;\nvar hasRequiredUnbzip2Stream;\n\nfunction requireUnbzip2Stream () {\n\tif (hasRequiredUnbzip2Stream) return unbzip2Stream_1;\n\thasRequiredUnbzip2Stream = 1;\n\tconst bz2 = requireBzip2();\n\tconst bitIterator = requireBit_iterator();\n\n\tunbzip2Stream_1 = unbzip2Stream;\n\n\tfunction unbzip2Stream(input, maxDecompressedBytes = Infinity) {\n\t const bufferQueue = [];\n\t let hasBytes = 0;\n\t let blockSize = 0;\n\t let broken = false;\n\t let hasAllData = false;\n\t let bitReader = null;\n\t let streamCRC = null;\n\t let totalOut = 0; // cumulative decompressed bytes across all blocks\n\n\t function decompressBlock(push){\n\t if(!blockSize) {\n\t blockSize = bz2.header(bitReader);\n\t streamCRC = 0;\n\t return false;\n\t } else {\n\t const bufsize = 100000 * blockSize;\n\t const buf = new Int32Array(bufsize);\n\n\t // Growable output buffer\n\t let chunk = new Uint8Array(32768);\n\t let chunkLen = 0;\n\t const f = function(b) {\n\t if (++totalOut > maxDecompressedBytes) {\n\t throw new Error('Maximum decompressed size exceeded');\n\t }\n\t if (chunkLen === chunk.length) {\n\t // Grow the chunk buffer\n\t const newLen = Math.min(chunk.length * 2, chunkLen + (maxDecompressedBytes - totalOut) + 1);\n\t const bigger = new Uint8Array(newLen);\n\t bigger.set(chunk);\n\t chunk = bigger;\n\t }\n\t chunk[chunkLen++] = b;\n\t };\n\n\t streamCRC = bz2.decompress(bitReader, f, buf, bufsize, streamCRC);\n\t if (streamCRC === null) {\n\t // reset for next bzip2 header\n\t blockSize = 0;\n\t return false;\n\t } else {\n\t push(chunk.subarray(0, chunkLen));\n\t return true;\n\t }\n\t }\n\t }\n\n\t let outlength = 0;\n\t function decompressAndQueue(controller) {\n\t if (broken) return;\n\t try {\n\t return decompressBlock(function(d) {\n\t controller.enqueue(d);\n\t if (d !== null) {\n\t outlength += d.length;\n\t }\n\t });\n\t } catch(e) {\n\t controller.error(e);\n\t broken = true;\n\t return true;\n\t }\n\t }\n\n\t let inputReader;\n\t return new ReadableStream({\n\t start() {\n\t inputReader = input.getReader();\n\t },\n\t async pull(controller) {\n\t try {\n\t while (true) {\n\t while (!(\n\t hasAllData ||\n\t (\n\t bitReader &&\n\t hasBytes - bitReader.bytesRead + 1 >= 25000 + 100000 * (blockSize || 4)\n\t )\n\t )) {\n\t const { value, done } = await inputReader.read();\n\t if (!done) {\n\t bufferQueue.push(value);\n\t hasBytes += value.length;\n\t if (bitReader === null) {\n\t bitReader = bitIterator(function() {\n\t return bufferQueue.shift();\n\t });\n\t }\n\t } else {\n\t hasAllData = true;\n\t }\n\t }\n\t while (\n\t hasAllData ?\n\t (bitReader && hasBytes > bitReader.bytesRead) :\n\t (\n\t bitReader &&\n\t hasBytes - bitReader.bytesRead + 1 >= 25000 + 100000 * (blockSize || 4)\n\t )\n\t ) {\n\t //console.error('decompressing with', hasBytes - bitReader.bytesRead + 1, 'bytes in buffer');\n\t if (decompressAndQueue(controller)) {\n\t return; // `pull` will get called again\n\t }\n\t }\n\t if (hasAllData && !broken && (!bitReader || hasBytes <= bitReader.bytesRead)) {\n\t if (streamCRC === null) {\n\t controller.close();\n\t } else {\n\t controller.error(new Error(\"input stream ended prematurely\"));\n\t }\n\t return;\n\t }\n\t }\n\t } catch (e) {\n\t controller.error(e);\n\t }\n\t },\n\t async cancel(reason) {\n\t await inputReader.abort(reason);\n\t }\n\t }, { highWaterMark: 0 });\n\t}\n\treturn unbzip2Stream_1;\n}\n\nvar unbzip2StreamExports = requireUnbzip2Stream();\nvar index = /*@__PURE__*/getDefaultExportFromCjs(unbzip2StreamExports);\n\nvar index$1 = /*#__PURE__*/_mergeNamespaces({\n\t__proto__: null,\n\tdefault: index\n}, [unbzip2StreamExports]);\n\nexport { index$1 as i };\n"],"ignoreList":[0],"mappings":";;AAGA,SAAS,iBAAiB,GAAG,GAAG;CAC/B,EAAE,QAAQ,SAAU,GAAG;EACtB,KAAK,OAAO,MAAM,YAAY,CAAC,MAAM,QAAQ,CAAC,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC,QAAQ,SAAU,GAAG;GACtF,IAAI,MAAM,aAAa,EAAE,KAAK,IAAI;IACjC,IAAI,IAAI,OAAO,yBAAyB,GAAG,CAAC;IAC5C,OAAO,eAAe,GAAG,GAAG,EAAE,MAAM,IAAI;KACvC,YAAY;KACZ,KAAK,WAAY;MAAE,OAAO,EAAE;KAAI;IACjC,CAAC;GACF;EACD,CAAC;CACF,CAAC;CACD,OAAO,OAAO,OAAO,CAAC;AACvB;AAEA,SAAS,wBAAyB,GAAG;CACpC,OAAO,KAAK,EAAE,cAAc,OAAO,UAAU,eAAe,KAAK,GAAG,SAAS,IAAI,EAAE,aAAa;AACjG;AA8BA,IAAI;AACJ,IAAI;AAEJ,SAAS,eAAgB;CACxB,IAAI,kBAAkB,OAAO;CAC7B,mBAAmB;CACnB,SAAS,WAAW,SAAS;EACzB,KAAK,OAAO;EACZ,KAAK,UAAU;EACf,KAAK,yBAAS,IAAI,MAAM,EAAA,CAAG;CAC/B;CACA,WAAW,4BAAY,IAAI,MAAI;CAE/B,IAAI,UAAU,EACV,OAAO,SAAS,SAAS;EAAC,MAAM,IAAI,WAAW,OAAO;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M,UAAU;GAClC;GACA,MAAM,KAAK,YAAY;IACnB,IAAI;KACA,OAAO,MAAM;MACT,OAAO,EACH,cAEQ,aACA,WAAW,UAAU,YAAY,KAAK,OAAQ,OAAU,aAAa,KAE9E;OACC,MAAM,EAAE,OAAO,SAAS,MAAM,YAAY,KAAK;OAC/C,IAAI,CAAC,MAAM;QACP,YAAY,KAAK,KAAK;QACtB,YAAY,MAAM;QAClB,IAAI,cAAc,MACd,YAAY,YAAY,WAAW;SAC/B,OAAO,YAAY,MAAM;QAC7B,CAAC;OAET,OACI,aAAa;MAErB;MACA,OACI,aACK,aAAa,WAAW,UAAU,YAE/B,aACA,WAAW,UAAU,YAAY,KAAK,OAAQ,OAAU,aAAa,IAI7E,IAAI,mBAAmB,UAAU,GAC7B;MAGR,IAAI,cAAc,CAAC,WAAW,CAAC,aAAa,YAAY,UAAU,YAAY;OAC1E,IAAI,cAAc,MACd,WAAW,MAAM;YAEjB,WAAW,sBAAM,IAAI,MAAM,gCAAgC,CAAC;OAEhE;MACJ;KACJ;IACJ,SAAS,GAAG;KACR,WAAW,MAAM,CAAC;IACtB;GACJ;GACA,MAAM,OAAO,QAAQ;IACjB,MAAM,YAAY,MAAM,MAAM;GAClC;EACJ,GAAG,EAAE,eAAe,EAAE,CAAC;CAC3B;CACA,OAAO;AACR;AAEA,IAAI,uBAAuB,qBAAqB;AAGhD,IAAI,UAAuB,+BAAiB;CAC3C,WAAW;CACX,SAJwB,wCAAwB,oBAInC;AACd,GAAG,CAAC,oBAAoB,CAAC"}
1
+ {"version":3,"file":"unbzip2-stream-BtkYGpC5.js","names":[],"sources":["../../../../node_modules/openpgp/dist/lightweight/unbzip2-stream.mjs"],"sourcesContent":["/*! OpenPGP.js v6.3.2 - 2026-09-24 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */\nconst globalThis = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nfunction _mergeNamespaces(n, m) {\n\tm.forEach(function (e) {\n\t\te && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {\n\t\t\tif (k !== 'default' && !(k in n)) {\n\t\t\t\tvar d = Object.getOwnPropertyDescriptor(e, k);\n\t\t\t\tObject.defineProperty(n, k, d.get ? d : {\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tget: function () { return e[k]; }\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t});\n\treturn Object.freeze(n);\n}\n\nfunction getDefaultExportFromCjs (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\n/* \n bzip2.js - a small bzip2 decompression implementation\n \n Copyright 2011 by antimatter15 (antimatter15@gmail.com)\n \n Based on micro-bunzip by Rob Landley (rob@landley.net).\n\n Copyright (c) 2011 by antimatter15 (antimatter15@gmail.com).\n\n Permission is hereby granted, free of charge, to any person obtaining a\n copy of this software and associated documentation files (the \"Software\"),\n to deal in the Software without restriction, including without limitation\n the rights to use, copy, modify, merge, publish, distribute, sublicense,\n and/or sell copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included\n in all copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH\n THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nvar bzip2_1;\nvar hasRequiredBzip2;\n\nfunction requireBzip2 () {\n\tif (hasRequiredBzip2) return bzip2_1;\n\thasRequiredBzip2 = 1;\n\tfunction Bzip2Error(message) {\n\t this.name = 'Bzip2Error';\n\t this.message = message;\n\t this.stack = (new Error()).stack;\n\t}\n\tBzip2Error.prototype = new Error;\n\t \n\tvar message = {\n\t Error: function(message) {throw new Bzip2Error(message);}\n\t};\n\n\tvar bzip2 = {};\n\tbzip2.Bzip2Error = Bzip2Error;\n\n\tbzip2.crcTable =\n\t[\n\t 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9,\n\t 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005,\n\t 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,\n\t 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd,\n\t 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9,\n\t 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,\n\t 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011,\n\t 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd,\n\t 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,\n\t 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5,\n\t 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81,\n\t 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,\n\t 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49,\n\t 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95,\n\t 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,\n\t 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d,\n\t 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae,\n\t 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,\n\t 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16,\n\t 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca,\n\t 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,\n\t 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02,\n\t 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066,\n\t 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,\n\t 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e,\n\t 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692,\n\t 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,\n\t 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a,\n\t 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e,\n\t 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,\n\t 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686,\n\t 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a,\n\t 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,\n\t 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb,\n\t 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f,\n\t 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,\n\t 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47,\n\t 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b,\n\t 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,\n\t 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623,\n\t 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7,\n\t 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,\n\t 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f,\n\t 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3,\n\t 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,\n\t 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b,\n\t 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f,\n\t 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,\n\t 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640,\n\t 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c,\n\t 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,\n\t 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24,\n\t 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30,\n\t 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,\n\t 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088,\n\t 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654,\n\t 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,\n\t 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c,\n\t 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18,\n\t 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,\n\t 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0,\n\t 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c,\n\t 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,\n\t 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4\n\t];\n\n\tbzip2.array = function(bytes) {\n\t var bit = 0, byte = 0;\n\t var BITMASK = [0, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF ];\n\t return function(n) {\n\t var result = 0;\n\t while(n > 0) {\n\t var left = 8 - bit;\n\t if (n >= left) {\n\t result <<= left;\n\t result |= (BITMASK[left] & bytes[byte++]);\n\t bit = 0;\n\t n -= left;\n\t } else {\n\t result <<= n;\n\t result |= ((bytes[byte] & (BITMASK[n] << (8 - n - bit))) >> (8 - n - bit));\n\t bit += n;\n\t n = 0;\n\t }\n\t }\n\t return result;\n\t }\n\t};\n\n\t \n\tbzip2.simple = function(srcbuffer, stream) {\n\t var bits = bzip2.array(srcbuffer);\n\t var size = bzip2.header(bits);\n\t var ret = false;\n\t var bufsize = 100000 * size;\n\t var buf = new Int32Array(bufsize);\n\t \n\t do {\n\t ret = bzip2.decompress(bits, stream, buf, bufsize); \n\t } while(!ret);\n\t};\n\n\tbzip2.header = function(bits) {\n\t this.byteCount = new Int32Array(256);\n\t this.symToByte = new Uint8Array(256);\n\t this.mtfSymbol = new Int32Array(256);\n\t this.selectors = new Uint8Array(0x8000);\n\n\t if (bits(8*3) != 4348520) message.Error(\"No magic number found\");\n\n\t var i = bits(8) - 48;\n\t if (i < 1 || i > 9) message.Error(\"Not a BZIP archive\");\n\t return i;\n\t};\n\n\n\t//takes a function for reading the block data (starting with 0x314159265359)\n\t//a block size (0-9) (optional, defaults to 9)\n\t//a length at which to stop decompressing and return the output\n\tbzip2.decompress = function(bits, stream, buf, bufsize, streamCRC) {\n\t var MAX_HUFCODE_BITS = 20;\n\t var MAX_SYMBOLS = 258;\n\t var SYMBOL_RUNA = 0;\n\t var SYMBOL_RUNB = 1;\n\t var GROUP_SIZE = 50;\n\t var crc = 0 ^ (-1);\n\t \n\t for(var h = '', i = 0; i < 6; i++) h += bits(8).toString(16);\n\t if (h == \"177245385090\") {\n\t var finalCRC = bits(32)|0;\n\t if (finalCRC !== streamCRC) message.Error(\"Error in bzip2: crc32 do not match\");\n\t // align stream to byte\n\t bits(null);\n\t return null; // reset streamCRC for next call\n\t }\n\t if (h != \"314159265359\") message.Error(\"Invalid bzip data\");\n\t var crcblock = bits(32)|0; // CRC code\n\t if (bits(1)) message.Error(\"unsupported obsolete version\");\n\t var origPtr = bits(24);\n\t if (origPtr > bufsize) message.Error(\"Initial position larger than buffer size\");\n\t var t = bits(16);\n\t var symTotal = 0;\n\t for (i = 0; i < 16; i++) {\n\t if (t & (1 << (15 - i))) {\n\t var k = bits(16);\n\t for(j = 0; j < 16; j++) {\n\t if (k & (1 << (15 - j))) {\n\t this.symToByte[symTotal++] = (16 * i) + j;\n\t }\n\t }\n\t }\n\t }\n\n\t var groupCount = bits(3);\n\t if (groupCount < 2 || groupCount > 6) message.Error(\"Invalid bzip data\");\n\t var nSelectors = bits(15);\n\t if (nSelectors == 0) message.Error(\"Invalid bzip data\");\n\t for(var i = 0; i < groupCount; i++) this.mtfSymbol[i] = i;\n\n\t for(var i = 0; i < nSelectors; i++) {\n\t for(var j = 0; bits(1); j++) if (j >= groupCount) message.Error(\"Invalid bzip data\");\n\t var uc = this.mtfSymbol[j];\n\t for(var k = j-1; k>=0; k--) {\n\t this.mtfSymbol[k+1] = this.mtfSymbol[k];\n\t }\n\t this.mtfSymbol[0] = uc;\n\t this.selectors[i] = uc;\n\t }\n\n\t var symCount = symTotal + 2;\n\t var groups = [];\n\t var length = new Uint8Array(MAX_SYMBOLS),\n\t temp = new Uint16Array(MAX_HUFCODE_BITS+1);\n\n\t var hufGroup;\n\n\t for(var j = 0; j < groupCount; j++) {\n\t t = bits(5); //lengths\n\t for(var i = 0; i < symCount; i++) {\n\t while(true){\n\t if (t < 1 || t > MAX_HUFCODE_BITS) message.Error(\"Invalid bzip data\");\n\t if (!bits(1)) break;\n\t if (!bits(1)) t++;\n\t else t--;\n\t }\n\t length[i] = t;\n\t }\n\t var minLen, maxLen;\n\t minLen = maxLen = length[0];\n\t for(var i = 1; i < symCount; i++) {\n\t if (length[i] > maxLen) maxLen = length[i];\n\t else if (length[i] < minLen) minLen = length[i];\n\t }\n\t hufGroup = groups[j] = {};\n\t hufGroup.permute = new Int32Array(MAX_SYMBOLS);\n\t hufGroup.limit = new Int32Array(MAX_HUFCODE_BITS + 1);\n\t hufGroup.base = new Int32Array(MAX_HUFCODE_BITS + 1);\n\n\t hufGroup.minLen = minLen;\n\t hufGroup.maxLen = maxLen;\n\t var base = hufGroup.base;\n\t var limit = hufGroup.limit;\n\t var pp = 0;\n\t for(var i = minLen; i <= maxLen; i++)\n\t for(var t = 0; t < symCount; t++)\n\t if (length[t] == i) hufGroup.permute[pp++] = t;\n\t for(i = minLen; i <= maxLen; i++) temp[i] = limit[i] = 0;\n\t for(i = 0; i < symCount; i++) temp[length[i]]++;\n\t pp = t = 0;\n\t for(i = minLen; i < maxLen; i++) {\n\t pp += temp[i];\n\t limit[i] = pp - 1;\n\t pp <<= 1;\n\t base[i+1] = pp - (t += temp[i]);\n\t }\n\t limit[maxLen] = pp + temp[maxLen] - 1;\n\t base[minLen] = 0;\n\t }\n\n\t for(var i = 0; i < 256; i++) { \n\t this.mtfSymbol[i] = i;\n\t this.byteCount[i] = 0;\n\t }\n\t var runPos, count, symCount, selector;\n\t runPos = count = symCount = selector = 0; \n\t while(true) {\n\t if (!(symCount--)) {\n\t symCount = GROUP_SIZE - 1;\n\t if (selector >= nSelectors) message.Error(\"Invalid bzip data\");\n\t hufGroup = groups[this.selectors[selector++]];\n\t base = hufGroup.base;\n\t limit = hufGroup.limit;\n\t }\n\t i = hufGroup.minLen;\n\t j = bits(i);\n\t while(true) {\n\t if (i > hufGroup.maxLen) message.Error(\"Invalid bzip data\");\n\t if (j <= limit[i]) break;\n\t i++;\n\t j = (j << 1) | bits(1);\n\t }\n\t j -= base[i];\n\t if (j < 0 || j >= MAX_SYMBOLS) message.Error(\"Invalid bzip data\");\n\t var nextSym = hufGroup.permute[j];\n\t if (nextSym == SYMBOL_RUNA || nextSym == SYMBOL_RUNB) {\n\t if (!runPos){\n\t runPos = 1;\n\t t = 0;\n\t }\n\t if (nextSym == SYMBOL_RUNA) t += runPos;\n\t else t += 2 * runPos;\n\t runPos <<= 1;\n\t continue;\n\t }\n\t if (runPos) {\n\t runPos = 0;\n\t if (count + t > bufsize) message.Error(\"Invalid bzip data\");\n\t uc = this.symToByte[this.mtfSymbol[0]];\n\t this.byteCount[uc] += t;\n\t while(t--) buf[count++] = uc;\n\t }\n\t if (nextSym > symTotal) break;\n\t if (count >= bufsize) message.Error(\"Invalid bzip data\");\n\t i = nextSym - 1;\n\t uc = this.mtfSymbol[i];\n\t for(var k = i-1; k>=0; k--) {\n\t this.mtfSymbol[k+1] = this.mtfSymbol[k];\n\t }\n\t this.mtfSymbol[0] = uc;\n\t uc = this.symToByte[uc];\n\t this.byteCount[uc]++;\n\t buf[count++] = uc;\n\t }\n\t if (origPtr < 0 || origPtr >= count) message.Error(\"Invalid bzip data\");\n\t var j = 0;\n\t for(var i = 0; i < 256; i++) {\n\t k = j + this.byteCount[i];\n\t this.byteCount[i] = j;\n\t j = k;\n\t }\n\t for(var i = 0; i < count; i++) {\n\t uc = buf[i] & 0xff;\n\t buf[this.byteCount[uc]] |= (i << 8);\n\t this.byteCount[uc]++;\n\t }\n\t var pos = 0, current = 0, run = 0;\n\t if (count) {\n\t pos = buf[origPtr];\n\t current = (pos & 0xff);\n\t pos >>= 8;\n\t run = -1;\n\t }\n\t count = count;\n\t var copies, previous, outbyte;\n\t while(count) {\n\t count--;\n\t previous = current;\n\t pos = buf[pos];\n\t current = pos & 0xff;\n\t pos >>= 8;\n\t if (run++ == 3) {\n\t copies = current;\n\t outbyte = previous;\n\t current = -1;\n\t } else {\n\t copies = 1;\n\t outbyte = current;\n\t }\n\t while(copies--) {\n\t crc = ((crc << 8) ^ this.crcTable[((crc>>24) ^ outbyte) & 0xFF])&0xFFFFFFFF; // crc32\n\t stream(outbyte);\n\t }\n\t if (current != previous) run = 0;\n\t }\n\n\t crc = (crc ^ (-1)) >>> 0;\n\t if ((crc|0) != (crcblock|0)) message.Error(\"Error in bzip2: crc32 do not match\");\n\t streamCRC = (crc ^ ((streamCRC << 1) | (streamCRC >>> 31))) & 0xFFFFFFFF;\n\t return streamCRC;\n\t};\n\n\tbzip2_1 = bzip2;\n\treturn bzip2_1;\n}\n\nvar bit_iterator;\nvar hasRequiredBit_iterator;\n\nfunction requireBit_iterator () {\n\tif (hasRequiredBit_iterator) return bit_iterator;\n\thasRequiredBit_iterator = 1;\n\tvar BITMASK = [0, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF];\n\n\t// returns a function that reads bits.\n\t// takes a buffer iterator as input\n\tbit_iterator = function bitIterator(nextBuffer) {\n\t var bit = 0, byte = 0;\n\t var bytes = nextBuffer();\n\t var f = function(n) {\n\t if (n === null && bit != 0) { // align to byte boundary\n\t bit = 0;\n\t byte++;\n\t return;\n\t }\n\t var result = 0;\n\t while(n > 0) {\n\t if (byte >= bytes.length) {\n\t byte = 0;\n\t bytes = nextBuffer();\n\t }\n\t var left = 8 - bit;\n\t if (bit === 0 && n > 0)\n\t f.bytesRead++;\n\t if (n >= left) {\n\t result <<= left;\n\t result |= (BITMASK[left] & bytes[byte++]);\n\t bit = 0;\n\t n -= left;\n\t } else {\n\t result <<= n;\n\t result |= ((bytes[byte] & (BITMASK[n] << (8 - n - bit))) >> (8 - n - bit));\n\t bit += n;\n\t n = 0;\n\t }\n\t }\n\t return result;\n\t };\n\t f.bytesRead = 0;\n\t return f;\n\t};\n\treturn bit_iterator;\n}\n\nvar unbzip2Stream_1;\nvar hasRequiredUnbzip2Stream;\n\nfunction requireUnbzip2Stream () {\n\tif (hasRequiredUnbzip2Stream) return unbzip2Stream_1;\n\thasRequiredUnbzip2Stream = 1;\n\tconst bz2 = requireBzip2();\n\tconst bitIterator = requireBit_iterator();\n\n\tunbzip2Stream_1 = unbzip2Stream;\n\n\tfunction unbzip2Stream(input, maxDecompressedBytes = Infinity) {\n\t const bufferQueue = [];\n\t let hasBytes = 0;\n\t let blockSize = 0;\n\t let broken = false;\n\t let hasAllData = false;\n\t let bitReader = null;\n\t let streamCRC = null;\n\t let totalOut = 0; // cumulative decompressed bytes across all blocks\n\n\t function decompressBlock(push){\n\t if(!blockSize) {\n\t blockSize = bz2.header(bitReader);\n\t streamCRC = 0;\n\t return false;\n\t } else {\n\t const bufsize = 100000 * blockSize;\n\t const buf = new Int32Array(bufsize);\n\n\t // Growable output buffer\n\t let chunk = new Uint8Array(32768);\n\t let chunkLen = 0;\n\t const f = function(b) {\n\t if (++totalOut > maxDecompressedBytes) {\n\t throw new Error('Maximum decompressed size exceeded');\n\t }\n\t if (chunkLen === chunk.length) {\n\t // Grow the chunk buffer\n\t const newLen = Math.min(chunk.length * 2, chunkLen + (maxDecompressedBytes - totalOut) + 1);\n\t const bigger = new Uint8Array(newLen);\n\t bigger.set(chunk);\n\t chunk = bigger;\n\t }\n\t chunk[chunkLen++] = b;\n\t };\n\n\t streamCRC = bz2.decompress(bitReader, f, buf, bufsize, streamCRC);\n\t if (streamCRC === null) {\n\t // reset for next bzip2 header\n\t blockSize = 0;\n\t return false;\n\t } else {\n\t push(chunk.subarray(0, chunkLen));\n\t return true;\n\t }\n\t }\n\t }\n\n\t let outlength = 0;\n\t function decompressAndQueue(controller) {\n\t if (broken) return;\n\t try {\n\t return decompressBlock(function(d) {\n\t controller.enqueue(d);\n\t if (d !== null) {\n\t outlength += d.length;\n\t }\n\t });\n\t } catch(e) {\n\t controller.error(e);\n\t broken = true;\n\t return true;\n\t }\n\t }\n\n\t let inputReader;\n\t return new ReadableStream({\n\t start() {\n\t inputReader = input.getReader();\n\t },\n\t async pull(controller) {\n\t try {\n\t while (true) {\n\t while (!(\n\t hasAllData ||\n\t (\n\t bitReader &&\n\t hasBytes - bitReader.bytesRead + 1 >= 25000 + 100000 * (blockSize || 4)\n\t )\n\t )) {\n\t const { value, done } = await inputReader.read();\n\t if (!done) {\n\t bufferQueue.push(value);\n\t hasBytes += value.length;\n\t if (bitReader === null) {\n\t bitReader = bitIterator(function() {\n\t return bufferQueue.shift();\n\t });\n\t }\n\t } else {\n\t hasAllData = true;\n\t }\n\t }\n\t while (\n\t hasAllData ?\n\t (bitReader && hasBytes > bitReader.bytesRead) :\n\t (\n\t bitReader &&\n\t hasBytes - bitReader.bytesRead + 1 >= 25000 + 100000 * (blockSize || 4)\n\t )\n\t ) {\n\t //console.error('decompressing with', hasBytes - bitReader.bytesRead + 1, 'bytes in buffer');\n\t if (decompressAndQueue(controller)) {\n\t return; // `pull` will get called again\n\t }\n\t }\n\t if (hasAllData && !broken && (!bitReader || hasBytes <= bitReader.bytesRead)) {\n\t if (streamCRC === null) {\n\t controller.close();\n\t } else {\n\t controller.error(new Error(\"input stream ended prematurely\"));\n\t }\n\t return;\n\t }\n\t }\n\t } catch (e) {\n\t controller.error(e);\n\t }\n\t },\n\t async cancel(reason) {\n\t await inputReader.abort(reason);\n\t }\n\t }, { highWaterMark: 0 });\n\t}\n\treturn unbzip2Stream_1;\n}\n\nvar unbzip2StreamExports = requireUnbzip2Stream();\nvar index = /*@__PURE__*/getDefaultExportFromCjs(unbzip2StreamExports);\n\nvar index$1 = /*#__PURE__*/_mergeNamespaces({\n\t__proto__: null,\n\tdefault: index\n}, [unbzip2StreamExports]);\n\nexport { index$1 as i };\n"],"ignoreList":[0],"mappings":";;AAGA,SAAS,iBAAiB,GAAG,GAAG;CAC/B,EAAE,QAAQ,SAAU,GAAG;EACtB,KAAK,OAAO,MAAM,YAAY,CAAC,MAAM,QAAQ,CAAC,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC,QAAQ,SAAU,GAAG;GACtF,IAAI,MAAM,aAAa,EAAE,KAAK,IAAI;IACjC,IAAI,IAAI,OAAO,yBAAyB,GAAG,CAAC;IAC5C,OAAO,eAAe,GAAG,GAAG,EAAE,MAAM,IAAI;KACvC,YAAY;KACZ,KAAK,WAAY;MAAE,OAAO,EAAE;KAAI;IACjC,CAAC;GACF;EACD,CAAC;CACF,CAAC;CACD,OAAO,OAAO,OAAO,CAAC;AACvB;AAEA,SAAS,wBAAyB,GAAG;CACpC,OAAO,KAAK,EAAE,cAAc,OAAO,UAAU,eAAe,KAAK,GAAG,SAAS,IAAI,EAAE,aAAa;A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AC,oBAAoB,CAAC"}
@@ -1,9 +1,10 @@
1
- import { an as TEST_USDT_FAUCET_AMOUNT, en as EVM_TEST_CHAINS, fn as validatePaymentTarget, in as SEPOLIA_TEST_USDT_FAUCET, ir as engineError, nn as PaymentPreflightError, on as USDT_PUBLIC_RPC, rn as SEPOLIA_TEST_USDT } from "./src-DjVj2ynY.js";
2
- import { a as sealSeed, n as rpcHost, o as unsealSeed, t as networkReason } from "./networkReason-Dt7Yx_n4.js";
3
- import { mnemonicToSeedSync } from "@scure/bip39";
1
+ import { a as SEPOLIA_TEST_USDT, c as USDT_PUBLIC_RPC, h as validatePaymentTarget, i as PaymentPreflightError, n as EVM_TEST_CHAINS, o as SEPOLIA_TEST_USDT_FAUCET, s as TEST_USDT_FAUCET_AMOUNT } from "./paymentIntent-DySU3Ajm.js";
2
+ import { n as engineError } from "./engineErrors--9hfgKlK.js";
3
+ import { a as sealSeed, n as rpcHost, o as unsealSeed, t as networkReason } from "./networkReason-Be-hMghr.js";
4
+ import { mnemonicToSeedWebcrypto } from "@scure/bip39";
4
5
  import WalletManagerEvm from "@tetherto/wdk-wallet-evm";
5
6
  import { Interface, Transaction, getAddress, keccak256 } from "ethers";
6
- //#region ../browser/src/engine/paymentAdapters/usdt.ts
7
+ // ../browser/src/engine/paymentAdapters/usdt.ts
7
8
  var faucet = new Interface(["function mint(address token,address to,uint256 amount) returns (uint256)"]);
8
9
  var erc20 = new Interface([
9
10
  "function decimals() view returns(uint8)",
@@ -91,7 +92,7 @@ var UsdtAdapter = class UsdtAdapter {
91
92
  if (inspected.decimals !== config.decimals || inspected.codeHash !== config.codeHash) throw new Error("Token metadata changed; do not use this wallet configuration");
92
93
  const adapter = new UsdtAdapter(config);
93
94
  adapter.mnemonic = mnemonic;
94
- const seed = mnemonicToSeedSync(mnemonic);
95
+ const seed = await mnemonicToSeedWebcrypto(mnemonic);
95
96
  try {
96
97
  adapter.manager = new WalletManagerEvm(seed, {
97
98
  provider: { request: ({ method, params }) => adapter.rpc(method, params ?? []) },
@@ -407,7 +408,6 @@ var UsdtAdapter = class UsdtAdapter {
407
408
  return operation;
408
409
  }
409
410
  };
410
- //#endregion
411
411
  export { UsdtAdapter, wireProvider };
412
412
 
413
- //# sourceMappingURL=usdt-DnyTGdTX.js.map
413
+ //# sourceMappingURL=usdt-CBJ4Q5Ji.js.map