tenjin-cli 0.1.0-alpha.15 → 0.1.0-alpha.16

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 (267) hide show
  1. package/NOTICE.md +54 -7
  2. package/README.md +41 -310
  3. package/dist/{_esm-N4KAVXQR.js → _esm-CE7KNONL.js} +9 -10
  4. package/dist/{ccip-ZGGWQN4X.js → ccip-7RMRLAGV.js} +4 -4
  5. package/dist/{ccip-RPPPKTJR.js → ccip-NLCSCHKI.js} +5 -5
  6. package/dist/chunk-25TJPVBF.js +353 -0
  7. package/dist/chunk-25TJPVBF.js.map +1 -0
  8. package/dist/chunk-2BKS2FVE.js +93 -0
  9. package/dist/chunk-2BKS2FVE.js.map +1 -0
  10. package/dist/chunk-2QYORQBF.js +55 -0
  11. package/dist/chunk-2QYORQBF.js.map +1 -0
  12. package/dist/{chunk-NIKXHWOL.js → chunk-2U5ZVEV3.js} +16 -16
  13. package/dist/chunk-2U5ZVEV3.js.map +1 -0
  14. package/dist/{chunk-HPJGOLTN.js → chunk-3AJS6LLN.js} +13 -8
  15. package/dist/chunk-3AJS6LLN.js.map +1 -0
  16. package/dist/{chunk-KINZ23CV.js → chunk-3AUDA53C.js} +4740 -23
  17. package/dist/chunk-3AUDA53C.js.map +1 -0
  18. package/dist/{chunk-MJZZTKCC.js → chunk-56MOAIP5.js} +5 -10
  19. package/dist/chunk-56MOAIP5.js.map +1 -0
  20. package/dist/{chunk-U5S527PP.js → chunk-5IEP5EGE.js} +3 -3
  21. package/dist/chunk-5X4SZ5BF.js +227 -0
  22. package/dist/chunk-5X4SZ5BF.js.map +1 -0
  23. package/dist/chunk-7WEQQJLG.js +68 -0
  24. package/dist/chunk-7WEQQJLG.js.map +1 -0
  25. package/dist/{chunk-7FK2UN2T.js → chunk-AWQPGIR6.js} +65 -67
  26. package/dist/{chunk-7FK2UN2T.js.map → chunk-AWQPGIR6.js.map} +1 -1
  27. package/dist/{chunk-ZFJJ3EXC.js → chunk-BBVUVBUO.js} +516 -185
  28. package/dist/chunk-BBVUVBUO.js.map +1 -0
  29. package/dist/{chunk-JBIKAAT3.js → chunk-BFFM2WFK.js} +8 -8
  30. package/dist/chunk-BFFM2WFK.js.map +1 -0
  31. package/dist/{chunk-KYQVEKP5.js → chunk-BPMWXTFX.js} +8 -8
  32. package/dist/chunk-DMZZLPZN.js +205 -0
  33. package/dist/chunk-DMZZLPZN.js.map +1 -0
  34. package/dist/{chunk-47PP7TAG.js → chunk-EGELTSPU.js} +1356 -1356
  35. package/dist/chunk-EGELTSPU.js.map +1 -0
  36. package/dist/chunk-GULLJQXA.js +698 -0
  37. package/dist/chunk-GULLJQXA.js.map +1 -0
  38. package/dist/{chunk-S5RYMCV6.js → chunk-HPWO4O6S.js} +3 -3
  39. package/dist/chunk-HVRC33OL.js +174 -0
  40. package/dist/chunk-HVRC33OL.js.map +1 -0
  41. package/dist/{chunk-W6R3HAAG.js → chunk-JRGFKVAZ.js} +2 -2
  42. package/dist/{chunk-XJN5WUKL.js → chunk-KG3D7FIF.js} +2 -2
  43. package/dist/chunk-L3PVMIYQ.js +10328 -0
  44. package/dist/chunk-L3PVMIYQ.js.map +1 -0
  45. package/dist/{chunk-QW2Q2KAH.js → chunk-LHHMV4GU.js} +2 -2
  46. package/dist/{chunk-ZOBNS7CX.js → chunk-MEFB5KHA.js} +4 -18
  47. package/dist/chunk-MEFB5KHA.js.map +1 -0
  48. package/dist/{chunk-M2O56UK7.js → chunk-N35E6CM2.js} +293 -163
  49. package/dist/chunk-N35E6CM2.js.map +1 -0
  50. package/dist/chunk-OCBHUHWB.js +69 -0
  51. package/dist/chunk-OCBHUHWB.js.map +1 -0
  52. package/dist/chunk-OIM4HLN6.js +1405 -0
  53. package/dist/chunk-OIM4HLN6.js.map +1 -0
  54. package/dist/{chunk-VYOJOX4Z.js → chunk-OJLYNM4Z.js} +54 -33
  55. package/dist/chunk-OJLYNM4Z.js.map +1 -0
  56. package/dist/{chunk-POJRB2AE.js → chunk-POUWHWID.js} +2 -2
  57. package/dist/chunk-PZEN5PHN.js +285 -0
  58. package/dist/chunk-PZEN5PHN.js.map +1 -0
  59. package/dist/chunk-SKAHDQH7.js +1785 -0
  60. package/dist/chunk-SKAHDQH7.js.map +1 -0
  61. package/dist/{chunk-KZAAWQNP.js → chunk-TTNESUPQ.js} +3 -3
  62. package/dist/chunk-U5DXNFJC.js +137 -0
  63. package/dist/chunk-U5DXNFJC.js.map +1 -0
  64. package/dist/chunk-USS336NF.js +165 -0
  65. package/dist/chunk-USS336NF.js.map +1 -0
  66. package/dist/{chunk-UO22YNY4.js → chunk-WH7OWT6G.js} +49 -1
  67. package/dist/chunk-WH7OWT6G.js.map +1 -0
  68. package/dist/chunk-WXC57XGG.js +29 -0
  69. package/dist/chunk-WXC57XGG.js.map +1 -0
  70. package/dist/{chunk-YLYINX2H.js → chunk-XZKD7DIF.js} +3 -3
  71. package/dist/{chunk-CPCX67TI.js → chunk-YEETV6IW.js} +1079 -1039
  72. package/dist/chunk-YEETV6IW.js.map +1 -0
  73. package/dist/{chunk-OLWTRUTS.js → chunk-YJHHCWM3.js} +35 -16
  74. package/dist/chunk-YJHHCWM3.js.map +1 -0
  75. package/dist/{cli-KKRKBU5T.js → cli-M3XCSOU6.js} +289 -374
  76. package/dist/cli-M3XCSOU6.js.map +1 -0
  77. package/dist/config-MXOX7XDR.js +41 -0
  78. package/dist/{dist-U4M6QCKE.js → dist-3LOO6M4U.js} +10 -10
  79. package/dist/doctor-LU4YIZWM.js +349 -0
  80. package/dist/doctor-LU4YIZWM.js.map +1 -0
  81. package/dist/{ethersCompat-Df4a6QIZ-WHYKB6HA.js → ethersCompat-Df4a6QIZ-THAVUGIJ.js} +5 -5
  82. package/dist/{chunk-KAJZHIQ4.js → fund-A54P2QFK.js} +80 -24
  83. package/dist/fund-A54P2QFK.js.map +1 -0
  84. package/dist/hook-command-U6KWPEDQ.js +377 -0
  85. package/dist/hook-command-U6KWPEDQ.js.map +1 -0
  86. package/dist/index.js +8 -3
  87. package/dist/index.js.map +1 -1
  88. package/dist/install-XUM2XSHW.js +53 -0
  89. package/dist/install-wallet-QIOFORTX.js +105 -0
  90. package/dist/install-wallet-QIOFORTX.js.map +1 -0
  91. package/dist/{run-XYTQ5TWQ.js → mcp-HJC2PLRV.js} +3727 -10670
  92. package/dist/mcp-HJC2PLRV.js.map +1 -0
  93. package/dist/paths-P2N4JTDZ.js +49 -0
  94. package/dist/pay-SBXZEPEP.js +37 -0
  95. package/dist/redact-46ZHF2NH.js +17 -0
  96. package/dist/{secp256k1-XRPVBC6V.js → secp256k1-ZZZT2CAX.js} +3 -3
  97. package/dist/{send-G746D7PQ.js → send-ASD2ZXJD.js} +28 -29
  98. package/dist/send-ASD2ZXJD.js.map +1 -0
  99. package/dist/{chunk-QZ6ROAJU.js → skill-placement-NFVHY6A3.js} +157 -11
  100. package/dist/skill-placement-NFVHY6A3.js.map +1 -0
  101. package/dist/status-T2SDB57A.js +63 -0
  102. package/dist/status-T2SDB57A.js.map +1 -0
  103. package/dist/status-line-CGPUSDMC.js +71 -0
  104. package/dist/status-line-CGPUSDMC.js.map +1 -0
  105. package/dist/status-line-wiring-BYPHTYZE.js +30 -0
  106. package/dist/tenjin-daemon.mjs +20060 -0
  107. package/dist/tenjin-shim.mjs +251 -0
  108. package/dist/tenjin-vitest-reporter.mjs +49 -0
  109. package/dist/uninstall-FKYZHAM3.js +144 -0
  110. package/dist/uninstall-FKYZHAM3.js.map +1 -0
  111. package/dist/{update-R76LHOZW.js → update-ANJ2AOTN.js} +133 -16
  112. package/dist/update-ANJ2AOTN.js.map +1 -0
  113. package/dist/{viemAdapter-By13KInL-TUQJBMHM.js → viemAdapter-By13KInL-X2VY6CY3.js} +5 -5
  114. package/dist/wallet-PWAHVKWW.js +31 -0
  115. package/dist/wallet-kdf-worker.mjs +980 -0
  116. package/docs/agent-permissions.md +65 -354
  117. package/docs/safety-model.md +16 -6
  118. package/package.json +8 -7
  119. package/LICENSE +0 -21
  120. package/dist/buy-VIRNSYGN.js +0 -47
  121. package/dist/chunk-2MYQN7HM.js +0 -247
  122. package/dist/chunk-2MYQN7HM.js.map +0 -1
  123. package/dist/chunk-2RF2GIJQ.js +0 -1188
  124. package/dist/chunk-2RF2GIJQ.js.map +0 -1
  125. package/dist/chunk-3GL2Z5QK.js +0 -57
  126. package/dist/chunk-3GL2Z5QK.js.map +0 -1
  127. package/dist/chunk-47PP7TAG.js.map +0 -1
  128. package/dist/chunk-4CQIDQOT.js +0 -167
  129. package/dist/chunk-4CQIDQOT.js.map +0 -1
  130. package/dist/chunk-4KG27W2S.js +0 -614
  131. package/dist/chunk-4KG27W2S.js.map +0 -1
  132. package/dist/chunk-5QQTYWEU.js +0 -199
  133. package/dist/chunk-5QQTYWEU.js.map +0 -1
  134. package/dist/chunk-65DTCCJ7.js +0 -21
  135. package/dist/chunk-65DTCCJ7.js.map +0 -1
  136. package/dist/chunk-A5DKHMUN.js +0 -173
  137. package/dist/chunk-A5DKHMUN.js.map +0 -1
  138. package/dist/chunk-B63XPWQ4.js +0 -246
  139. package/dist/chunk-B63XPWQ4.js.map +0 -1
  140. package/dist/chunk-CAR6FHK6.js +0 -105
  141. package/dist/chunk-CAR6FHK6.js.map +0 -1
  142. package/dist/chunk-CPCX67TI.js.map +0 -1
  143. package/dist/chunk-CQBVCYI2.js +0 -162
  144. package/dist/chunk-CQBVCYI2.js.map +0 -1
  145. package/dist/chunk-DBU5CXBV.js +0 -4731
  146. package/dist/chunk-DBU5CXBV.js.map +0 -1
  147. package/dist/chunk-DHJD77OW.js +0 -81
  148. package/dist/chunk-DHJD77OW.js.map +0 -1
  149. package/dist/chunk-EDZSNPE5.js +0 -35
  150. package/dist/chunk-EDZSNPE5.js.map +0 -1
  151. package/dist/chunk-EFWZPUTC.js +0 -65
  152. package/dist/chunk-EFWZPUTC.js.map +0 -1
  153. package/dist/chunk-EPFL6CTE.js +0 -448
  154. package/dist/chunk-EPFL6CTE.js.map +0 -1
  155. package/dist/chunk-GHLVXVZD.js +0 -142
  156. package/dist/chunk-GHLVXVZD.js.map +0 -1
  157. package/dist/chunk-H3SOOJ2I.js +0 -580
  158. package/dist/chunk-H3SOOJ2I.js.map +0 -1
  159. package/dist/chunk-HPJGOLTN.js.map +0 -1
  160. package/dist/chunk-HRGBS2PA.js +0 -203
  161. package/dist/chunk-HRGBS2PA.js.map +0 -1
  162. package/dist/chunk-ITUXPJIS.js +0 -314
  163. package/dist/chunk-ITUXPJIS.js.map +0 -1
  164. package/dist/chunk-JBIKAAT3.js.map +0 -1
  165. package/dist/chunk-KAJZHIQ4.js.map +0 -1
  166. package/dist/chunk-KINZ23CV.js.map +0 -1
  167. package/dist/chunk-LRYV3SK7.js +0 -235
  168. package/dist/chunk-LRYV3SK7.js.map +0 -1
  169. package/dist/chunk-M2O56UK7.js.map +0 -1
  170. package/dist/chunk-MJZZTKCC.js.map +0 -1
  171. package/dist/chunk-NIKXHWOL.js.map +0 -1
  172. package/dist/chunk-OKDRDT74.js +0 -209
  173. package/dist/chunk-OKDRDT74.js.map +0 -1
  174. package/dist/chunk-OKYSNAS3.js +0 -2144
  175. package/dist/chunk-OKYSNAS3.js.map +0 -1
  176. package/dist/chunk-OLWTRUTS.js.map +0 -1
  177. package/dist/chunk-QQ6ELLSA.js +0 -143
  178. package/dist/chunk-QQ6ELLSA.js.map +0 -1
  179. package/dist/chunk-QZ6ROAJU.js.map +0 -1
  180. package/dist/chunk-R7RSCBI7.js +0 -794
  181. package/dist/chunk-R7RSCBI7.js.map +0 -1
  182. package/dist/chunk-SGK2B724.js +0 -67
  183. package/dist/chunk-SGK2B724.js.map +0 -1
  184. package/dist/chunk-U6VPKMGC.js +0 -390
  185. package/dist/chunk-U6VPKMGC.js.map +0 -1
  186. package/dist/chunk-UHTVXQ2O.js +0 -140
  187. package/dist/chunk-UHTVXQ2O.js.map +0 -1
  188. package/dist/chunk-UO22YNY4.js.map +0 -1
  189. package/dist/chunk-US456VUI.js +0 -149
  190. package/dist/chunk-US456VUI.js.map +0 -1
  191. package/dist/chunk-V44J2MXV.js +0 -400
  192. package/dist/chunk-V44J2MXV.js.map +0 -1
  193. package/dist/chunk-VJQKL3YH.js +0 -216
  194. package/dist/chunk-VJQKL3YH.js.map +0 -1
  195. package/dist/chunk-VJSQSLBM.js +0 -1442
  196. package/dist/chunk-VJSQSLBM.js.map +0 -1
  197. package/dist/chunk-VYOJOX4Z.js.map +0 -1
  198. package/dist/chunk-WY2K35OL.js +0 -269
  199. package/dist/chunk-WY2K35OL.js.map +0 -1
  200. package/dist/chunk-ZFJJ3EXC.js.map +0 -1
  201. package/dist/chunk-ZOBNS7CX.js.map +0 -1
  202. package/dist/cli-KKRKBU5T.js.map +0 -1
  203. package/dist/config-JMRUNYE6.js +0 -37
  204. package/dist/discover-B5HF6SHM.js +0 -102
  205. package/dist/discover-B5HF6SHM.js.map +0 -1
  206. package/dist/doctor-ZBG7X66D.js +0 -32
  207. package/dist/edit-PZJIILQE.js +0 -40
  208. package/dist/fund-EUDH5KPA.js +0 -40
  209. package/dist/inspect-QC6WEQPN.js +0 -37
  210. package/dist/install-GNK2W3PI.js +0 -972
  211. package/dist/install-GNK2W3PI.js.map +0 -1
  212. package/dist/outcome-KSGWZHUS.js +0 -24
  213. package/dist/pay-BC4UICPA.js +0 -361
  214. package/dist/pay-BC4UICPA.js.map +0 -1
  215. package/dist/publish-LXWFDIKF.js +0 -42
  216. package/dist/read-JMNUQ56P.js +0 -160
  217. package/dist/read-JMNUQ56P.js.map +0 -1
  218. package/dist/run-XYTQ5TWQ.js.map +0 -1
  219. package/dist/search-TSQAB45E.js +0 -25
  220. package/dist/secp256k1-XRPVBC6V.js.map +0 -1
  221. package/dist/send-G746D7PQ.js.map +0 -1
  222. package/dist/session-JBKWMJ24.js +0 -89
  223. package/dist/session-JBKWMJ24.js.map +0 -1
  224. package/dist/skill-heal-WKD67SLJ.js +0 -92
  225. package/dist/skill-heal-WKD67SLJ.js.map +0 -1
  226. package/dist/skill-placement-RIU4AMC2.js +0 -20
  227. package/dist/skill-placement-RIU4AMC2.js.map +0 -1
  228. package/dist/uninstall-5E263VTS.js +0 -73
  229. package/dist/uninstall-5E263VTS.js.map +0 -1
  230. package/dist/update-R76LHOZW.js.map +0 -1
  231. package/dist/usdc-4VCDHFWX.js +0 -38
  232. package/dist/usdc-4VCDHFWX.js.map +0 -1
  233. package/dist/viemAdapter-By13KInL-TUQJBMHM.js.map +0 -1
  234. package/dist/wallet-TQ7D5EQ7.js +0 -41
  235. package/dist/wallet-TQ7D5EQ7.js.map +0 -1
  236. package/dist/wallet-ZAVXWLWP.js +0 -32
  237. package/dist/wallet-ZAVXWLWP.js.map +0 -1
  238. package/docs/command-reference.md +0 -303
  239. package/skills/tenjin/SKILL.md +0 -373
  240. package/skills/tenjin-pay/SKILL.md +0 -76
  241. package/skills/tenjin-publish/SKILL.md +0 -227
  242. package/skills/tenjin-publish/references/maintain.md +0 -39
  243. package/skills/tenjin-search/SKILL.md +0 -154
  244. package/skills/tenjin-search/references/permissions.md +0 -112
  245. /package/dist/{_esm-N4KAVXQR.js.map → _esm-CE7KNONL.js.map} +0 -0
  246. /package/dist/{buy-VIRNSYGN.js.map → ccip-7RMRLAGV.js.map} +0 -0
  247. /package/dist/{ccip-RPPPKTJR.js.map → ccip-NLCSCHKI.js.map} +0 -0
  248. /package/dist/{chunk-U5S527PP.js.map → chunk-5IEP5EGE.js.map} +0 -0
  249. /package/dist/{chunk-KYQVEKP5.js.map → chunk-BPMWXTFX.js.map} +0 -0
  250. /package/dist/{chunk-S5RYMCV6.js.map → chunk-HPWO4O6S.js.map} +0 -0
  251. /package/dist/{chunk-W6R3HAAG.js.map → chunk-JRGFKVAZ.js.map} +0 -0
  252. /package/dist/{chunk-XJN5WUKL.js.map → chunk-KG3D7FIF.js.map} +0 -0
  253. /package/dist/{chunk-QW2Q2KAH.js.map → chunk-LHHMV4GU.js.map} +0 -0
  254. /package/dist/{chunk-POJRB2AE.js.map → chunk-POUWHWID.js.map} +0 -0
  255. /package/dist/{chunk-KZAAWQNP.js.map → chunk-TTNESUPQ.js.map} +0 -0
  256. /package/dist/{chunk-YLYINX2H.js.map → chunk-XZKD7DIF.js.map} +0 -0
  257. /package/dist/{ccip-ZGGWQN4X.js.map → config-MXOX7XDR.js.map} +0 -0
  258. /package/dist/{dist-U4M6QCKE.js.map → dist-3LOO6M4U.js.map} +0 -0
  259. /package/dist/{config-JMRUNYE6.js.map → ethersCompat-Df4a6QIZ-THAVUGIJ.js.map} +0 -0
  260. /package/dist/{doctor-ZBG7X66D.js.map → install-XUM2XSHW.js.map} +0 -0
  261. /package/dist/{edit-PZJIILQE.js.map → paths-P2N4JTDZ.js.map} +0 -0
  262. /package/dist/{ethersCompat-Df4a6QIZ-WHYKB6HA.js.map → pay-SBXZEPEP.js.map} +0 -0
  263. /package/dist/{fund-EUDH5KPA.js.map → redact-46ZHF2NH.js.map} +0 -0
  264. /package/dist/{inspect-QC6WEQPN.js.map → secp256k1-ZZZT2CAX.js.map} +0 -0
  265. /package/dist/{outcome-KSGWZHUS.js.map → status-line-wiring-BYPHTYZE.js.map} +0 -0
  266. /package/dist/{publish-LXWFDIKF.js.map → viemAdapter-By13KInL-X2VY6CY3.js.map} +0 -0
  267. /package/dist/{search-TSQAB45E.js.map → wallet-PWAHVKWW.js.map} +0 -0
@@ -0,0 +1,980 @@
1
+ // src/lib/wallet/keystore-kdf-worker.ts
2
+ import { parentPort, workerData } from "node:worker_threads";
3
+
4
+ // node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/utils.js
5
+ function isBytes(a) {
6
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
7
+ }
8
+ function anumber(n) {
9
+ if (!Number.isSafeInteger(n) || n < 0)
10
+ throw new Error("positive integer expected, got " + n);
11
+ }
12
+ function abytes(b, ...lengths) {
13
+ if (!isBytes(b))
14
+ throw new Error("Uint8Array expected");
15
+ if (lengths.length > 0 && !lengths.includes(b.length))
16
+ throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
17
+ }
18
+ function ahash(h) {
19
+ if (typeof h !== "function" || typeof h.create !== "function")
20
+ throw new Error("Hash should be wrapped by utils.createHasher");
21
+ anumber(h.outputLen);
22
+ anumber(h.blockLen);
23
+ }
24
+ function aexists(instance, checkFinished = true) {
25
+ if (instance.destroyed)
26
+ throw new Error("Hash instance has been destroyed");
27
+ if (checkFinished && instance.finished)
28
+ throw new Error("Hash#digest() has already been called");
29
+ }
30
+ function aoutput(out, instance) {
31
+ abytes(out);
32
+ const min = instance.outputLen;
33
+ if (out.length < min) {
34
+ throw new Error("digestInto() expects output buffer of length at least " + min);
35
+ }
36
+ }
37
+ function u32(arr) {
38
+ return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
39
+ }
40
+ function clean(...arrays) {
41
+ for (let i = 0; i < arrays.length; i++) {
42
+ arrays[i].fill(0);
43
+ }
44
+ }
45
+ function createView(arr) {
46
+ return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
47
+ }
48
+ function rotr(word, shift) {
49
+ return word << 32 - shift | word >>> shift;
50
+ }
51
+ function rotl(word, shift) {
52
+ return word << shift | word >>> 32 - shift >>> 0;
53
+ }
54
+ var isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
55
+ function byteSwap(word) {
56
+ return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
57
+ }
58
+ function byteSwap32(arr) {
59
+ for (let i = 0; i < arr.length; i++) {
60
+ arr[i] = byteSwap(arr[i]);
61
+ }
62
+ return arr;
63
+ }
64
+ var swap32IfBE = isLE ? (u) => u : byteSwap32;
65
+ var nextTick = async () => {
66
+ };
67
+ async function asyncLoop(iters, tick, cb) {
68
+ let ts = Date.now();
69
+ for (let i = 0; i < iters; i++) {
70
+ cb(i);
71
+ const diff = Date.now() - ts;
72
+ if (diff >= 0 && diff < tick)
73
+ continue;
74
+ await nextTick();
75
+ ts += diff;
76
+ }
77
+ }
78
+ function utf8ToBytes(str) {
79
+ if (typeof str !== "string")
80
+ throw new Error("string expected");
81
+ return new Uint8Array(new TextEncoder().encode(str));
82
+ }
83
+ function toBytes(data) {
84
+ if (typeof data === "string")
85
+ data = utf8ToBytes(data);
86
+ abytes(data);
87
+ return data;
88
+ }
89
+ function kdfInputToBytes(data) {
90
+ if (typeof data === "string")
91
+ data = utf8ToBytes(data);
92
+ abytes(data);
93
+ return data;
94
+ }
95
+ function checkOpts(defaults, opts) {
96
+ if (opts !== void 0 && {}.toString.call(opts) !== "[object Object]")
97
+ throw new Error("options should be object or undefined");
98
+ const merged = Object.assign(defaults, opts);
99
+ return merged;
100
+ }
101
+ var Hash = class {
102
+ };
103
+ function createHasher(hashCons) {
104
+ const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
105
+ const tmp = hashCons();
106
+ hashC.outputLen = tmp.outputLen;
107
+ hashC.blockLen = tmp.blockLen;
108
+ hashC.create = () => hashCons();
109
+ return hashC;
110
+ }
111
+
112
+ // node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/hmac.js
113
+ var HMAC = class extends Hash {
114
+ constructor(hash, _key) {
115
+ super();
116
+ this.finished = false;
117
+ this.destroyed = false;
118
+ ahash(hash);
119
+ const key = toBytes(_key);
120
+ this.iHash = hash.create();
121
+ if (typeof this.iHash.update !== "function")
122
+ throw new Error("Expected instance of class which extends utils.Hash");
123
+ this.blockLen = this.iHash.blockLen;
124
+ this.outputLen = this.iHash.outputLen;
125
+ const blockLen = this.blockLen;
126
+ const pad3 = new Uint8Array(blockLen);
127
+ pad3.set(key.length > blockLen ? hash.create().update(key).digest() : key);
128
+ for (let i = 0; i < pad3.length; i++)
129
+ pad3[i] ^= 54;
130
+ this.iHash.update(pad3);
131
+ this.oHash = hash.create();
132
+ for (let i = 0; i < pad3.length; i++)
133
+ pad3[i] ^= 54 ^ 92;
134
+ this.oHash.update(pad3);
135
+ clean(pad3);
136
+ }
137
+ update(buf) {
138
+ aexists(this);
139
+ this.iHash.update(buf);
140
+ return this;
141
+ }
142
+ digestInto(out) {
143
+ aexists(this);
144
+ abytes(out, this.outputLen);
145
+ this.finished = true;
146
+ this.iHash.digestInto(out);
147
+ this.oHash.update(out);
148
+ this.oHash.digestInto(out);
149
+ this.destroy();
150
+ }
151
+ digest() {
152
+ const out = new Uint8Array(this.oHash.outputLen);
153
+ this.digestInto(out);
154
+ return out;
155
+ }
156
+ _cloneInto(to) {
157
+ to || (to = Object.create(Object.getPrototypeOf(this), {}));
158
+ const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
159
+ to = to;
160
+ to.finished = finished;
161
+ to.destroyed = destroyed;
162
+ to.blockLen = blockLen;
163
+ to.outputLen = outputLen;
164
+ to.oHash = oHash._cloneInto(to.oHash);
165
+ to.iHash = iHash._cloneInto(to.iHash);
166
+ return to;
167
+ }
168
+ clone() {
169
+ return this._cloneInto();
170
+ }
171
+ destroy() {
172
+ this.destroyed = true;
173
+ this.oHash.destroy();
174
+ this.iHash.destroy();
175
+ }
176
+ };
177
+ var hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
178
+ hmac.create = (hash, key) => new HMAC(hash, key);
179
+
180
+ // node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/pbkdf2.js
181
+ function pbkdf2Init(hash, _password, _salt, _opts) {
182
+ ahash(hash);
183
+ const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);
184
+ const { c, dkLen, asyncTick } = opts;
185
+ anumber(c);
186
+ anumber(dkLen);
187
+ anumber(asyncTick);
188
+ if (c < 1)
189
+ throw new Error("iterations (c) should be >= 1");
190
+ const password = kdfInputToBytes(_password);
191
+ const salt = kdfInputToBytes(_salt);
192
+ const DK = new Uint8Array(dkLen);
193
+ const PRF = hmac.create(hash, password);
194
+ const PRFSalt = PRF._cloneInto().update(salt);
195
+ return { c, dkLen, asyncTick, DK, PRF, PRFSalt };
196
+ }
197
+ function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) {
198
+ PRF.destroy();
199
+ PRFSalt.destroy();
200
+ if (prfW)
201
+ prfW.destroy();
202
+ clean(u);
203
+ return DK;
204
+ }
205
+ function pbkdf2(hash, password, salt, opts) {
206
+ const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);
207
+ let prfW;
208
+ const arr = new Uint8Array(4);
209
+ const view = createView(arr);
210
+ const u = new Uint8Array(PRF.outputLen);
211
+ for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {
212
+ const Ti = DK.subarray(pos, pos + PRF.outputLen);
213
+ view.setInt32(0, ti, false);
214
+ (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
215
+ Ti.set(u.subarray(0, Ti.length));
216
+ for (let ui = 1; ui < c; ui++) {
217
+ PRF._cloneInto(prfW).update(u).digestInto(u);
218
+ for (let i = 0; i < Ti.length; i++)
219
+ Ti[i] ^= u[i];
220
+ }
221
+ }
222
+ return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
223
+ }
224
+
225
+ // node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/_md.js
226
+ function setBigUint64(view, byteOffset, value, isLE2) {
227
+ if (typeof view.setBigUint64 === "function")
228
+ return view.setBigUint64(byteOffset, value, isLE2);
229
+ const _32n = BigInt(32);
230
+ const _u32_max = BigInt(4294967295);
231
+ const wh = Number(value >> _32n & _u32_max);
232
+ const wl = Number(value & _u32_max);
233
+ const h = isLE2 ? 4 : 0;
234
+ const l = isLE2 ? 0 : 4;
235
+ view.setUint32(byteOffset + h, wh, isLE2);
236
+ view.setUint32(byteOffset + l, wl, isLE2);
237
+ }
238
+ function Chi(a, b, c) {
239
+ return a & b ^ ~a & c;
240
+ }
241
+ function Maj(a, b, c) {
242
+ return a & b ^ a & c ^ b & c;
243
+ }
244
+ var HashMD = class extends Hash {
245
+ constructor(blockLen, outputLen, padOffset, isLE2) {
246
+ super();
247
+ this.finished = false;
248
+ this.length = 0;
249
+ this.pos = 0;
250
+ this.destroyed = false;
251
+ this.blockLen = blockLen;
252
+ this.outputLen = outputLen;
253
+ this.padOffset = padOffset;
254
+ this.isLE = isLE2;
255
+ this.buffer = new Uint8Array(blockLen);
256
+ this.view = createView(this.buffer);
257
+ }
258
+ update(data) {
259
+ aexists(this);
260
+ data = toBytes(data);
261
+ abytes(data);
262
+ const { view, buffer, blockLen } = this;
263
+ const len = data.length;
264
+ for (let pos = 0; pos < len; ) {
265
+ const take = Math.min(blockLen - this.pos, len - pos);
266
+ if (take === blockLen) {
267
+ const dataView = createView(data);
268
+ for (; blockLen <= len - pos; pos += blockLen)
269
+ this.process(dataView, pos);
270
+ continue;
271
+ }
272
+ buffer.set(data.subarray(pos, pos + take), this.pos);
273
+ this.pos += take;
274
+ pos += take;
275
+ if (this.pos === blockLen) {
276
+ this.process(view, 0);
277
+ this.pos = 0;
278
+ }
279
+ }
280
+ this.length += data.length;
281
+ this.roundClean();
282
+ return this;
283
+ }
284
+ digestInto(out) {
285
+ aexists(this);
286
+ aoutput(out, this);
287
+ this.finished = true;
288
+ const { buffer, view, blockLen, isLE: isLE2 } = this;
289
+ let { pos } = this;
290
+ buffer[pos++] = 128;
291
+ clean(this.buffer.subarray(pos));
292
+ if (this.padOffset > blockLen - pos) {
293
+ this.process(view, 0);
294
+ pos = 0;
295
+ }
296
+ for (let i = pos; i < blockLen; i++)
297
+ buffer[i] = 0;
298
+ setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2);
299
+ this.process(view, 0);
300
+ const oview = createView(out);
301
+ const len = this.outputLen;
302
+ if (len % 4)
303
+ throw new Error("_sha2: outputLen should be aligned to 32bit");
304
+ const outLen = len / 4;
305
+ const state = this.get();
306
+ if (outLen > state.length)
307
+ throw new Error("_sha2: outputLen bigger than state");
308
+ for (let i = 0; i < outLen; i++)
309
+ oview.setUint32(4 * i, state[i], isLE2);
310
+ }
311
+ digest() {
312
+ const { buffer, outputLen } = this;
313
+ this.digestInto(buffer);
314
+ const res = buffer.slice(0, outputLen);
315
+ this.destroy();
316
+ return res;
317
+ }
318
+ _cloneInto(to) {
319
+ to || (to = new this.constructor());
320
+ to.set(...this.get());
321
+ const { blockLen, buffer, length, finished, destroyed, pos } = this;
322
+ to.destroyed = destroyed;
323
+ to.finished = finished;
324
+ to.length = length;
325
+ to.pos = pos;
326
+ if (length % blockLen)
327
+ to.buffer.set(buffer);
328
+ return to;
329
+ }
330
+ clone() {
331
+ return this._cloneInto();
332
+ }
333
+ };
334
+ var SHA256_IV = /* @__PURE__ */ Uint32Array.from([
335
+ 1779033703,
336
+ 3144134277,
337
+ 1013904242,
338
+ 2773480762,
339
+ 1359893119,
340
+ 2600822924,
341
+ 528734635,
342
+ 1541459225
343
+ ]);
344
+
345
+ // node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/sha2.js
346
+ var SHA256_K = /* @__PURE__ */ Uint32Array.from([
347
+ 1116352408,
348
+ 1899447441,
349
+ 3049323471,
350
+ 3921009573,
351
+ 961987163,
352
+ 1508970993,
353
+ 2453635748,
354
+ 2870763221,
355
+ 3624381080,
356
+ 310598401,
357
+ 607225278,
358
+ 1426881987,
359
+ 1925078388,
360
+ 2162078206,
361
+ 2614888103,
362
+ 3248222580,
363
+ 3835390401,
364
+ 4022224774,
365
+ 264347078,
366
+ 604807628,
367
+ 770255983,
368
+ 1249150122,
369
+ 1555081692,
370
+ 1996064986,
371
+ 2554220882,
372
+ 2821834349,
373
+ 2952996808,
374
+ 3210313671,
375
+ 3336571891,
376
+ 3584528711,
377
+ 113926993,
378
+ 338241895,
379
+ 666307205,
380
+ 773529912,
381
+ 1294757372,
382
+ 1396182291,
383
+ 1695183700,
384
+ 1986661051,
385
+ 2177026350,
386
+ 2456956037,
387
+ 2730485921,
388
+ 2820302411,
389
+ 3259730800,
390
+ 3345764771,
391
+ 3516065817,
392
+ 3600352804,
393
+ 4094571909,
394
+ 275423344,
395
+ 430227734,
396
+ 506948616,
397
+ 659060556,
398
+ 883997877,
399
+ 958139571,
400
+ 1322822218,
401
+ 1537002063,
402
+ 1747873779,
403
+ 1955562222,
404
+ 2024104815,
405
+ 2227730452,
406
+ 2361852424,
407
+ 2428436474,
408
+ 2756734187,
409
+ 3204031479,
410
+ 3329325298
411
+ ]);
412
+ var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
413
+ var SHA256 = class extends HashMD {
414
+ constructor(outputLen = 32) {
415
+ super(64, outputLen, 8, false);
416
+ this.A = SHA256_IV[0] | 0;
417
+ this.B = SHA256_IV[1] | 0;
418
+ this.C = SHA256_IV[2] | 0;
419
+ this.D = SHA256_IV[3] | 0;
420
+ this.E = SHA256_IV[4] | 0;
421
+ this.F = SHA256_IV[5] | 0;
422
+ this.G = SHA256_IV[6] | 0;
423
+ this.H = SHA256_IV[7] | 0;
424
+ }
425
+ get() {
426
+ const { A, B, C, D, E, F, G, H } = this;
427
+ return [A, B, C, D, E, F, G, H];
428
+ }
429
+ // prettier-ignore
430
+ set(A, B, C, D, E, F, G, H) {
431
+ this.A = A | 0;
432
+ this.B = B | 0;
433
+ this.C = C | 0;
434
+ this.D = D | 0;
435
+ this.E = E | 0;
436
+ this.F = F | 0;
437
+ this.G = G | 0;
438
+ this.H = H | 0;
439
+ }
440
+ process(view, offset) {
441
+ for (let i = 0; i < 16; i++, offset += 4)
442
+ SHA256_W[i] = view.getUint32(offset, false);
443
+ for (let i = 16; i < 64; i++) {
444
+ const W15 = SHA256_W[i - 15];
445
+ const W2 = SHA256_W[i - 2];
446
+ const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
447
+ const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
448
+ SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
449
+ }
450
+ let { A, B, C, D, E, F, G, H } = this;
451
+ for (let i = 0; i < 64; i++) {
452
+ const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
453
+ const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
454
+ const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
455
+ const T2 = sigma0 + Maj(A, B, C) | 0;
456
+ H = G;
457
+ G = F;
458
+ F = E;
459
+ E = D + T1 | 0;
460
+ D = C;
461
+ C = B;
462
+ B = A;
463
+ A = T1 + T2 | 0;
464
+ }
465
+ A = A + this.A | 0;
466
+ B = B + this.B | 0;
467
+ C = C + this.C | 0;
468
+ D = D + this.D | 0;
469
+ E = E + this.E | 0;
470
+ F = F + this.F | 0;
471
+ G = G + this.G | 0;
472
+ H = H + this.H | 0;
473
+ this.set(A, B, C, D, E, F, G, H);
474
+ }
475
+ roundClean() {
476
+ clean(SHA256_W);
477
+ }
478
+ destroy() {
479
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
480
+ clean(this.buffer);
481
+ }
482
+ };
483
+ var sha256 = /* @__PURE__ */ createHasher(() => new SHA256());
484
+
485
+ // node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/scrypt.js
486
+ function XorAndSalsa(prev, pi, input, ii, out, oi) {
487
+ let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++];
488
+ let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++];
489
+ let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++];
490
+ let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++];
491
+ let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++];
492
+ let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++];
493
+ let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++];
494
+ let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++];
495
+ let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15;
496
+ for (let i = 0; i < 8; i += 2) {
497
+ x04 ^= rotl(x00 + x12 | 0, 7);
498
+ x08 ^= rotl(x04 + x00 | 0, 9);
499
+ x12 ^= rotl(x08 + x04 | 0, 13);
500
+ x00 ^= rotl(x12 + x08 | 0, 18);
501
+ x09 ^= rotl(x05 + x01 | 0, 7);
502
+ x13 ^= rotl(x09 + x05 | 0, 9);
503
+ x01 ^= rotl(x13 + x09 | 0, 13);
504
+ x05 ^= rotl(x01 + x13 | 0, 18);
505
+ x14 ^= rotl(x10 + x06 | 0, 7);
506
+ x02 ^= rotl(x14 + x10 | 0, 9);
507
+ x06 ^= rotl(x02 + x14 | 0, 13);
508
+ x10 ^= rotl(x06 + x02 | 0, 18);
509
+ x03 ^= rotl(x15 + x11 | 0, 7);
510
+ x07 ^= rotl(x03 + x15 | 0, 9);
511
+ x11 ^= rotl(x07 + x03 | 0, 13);
512
+ x15 ^= rotl(x11 + x07 | 0, 18);
513
+ x01 ^= rotl(x00 + x03 | 0, 7);
514
+ x02 ^= rotl(x01 + x00 | 0, 9);
515
+ x03 ^= rotl(x02 + x01 | 0, 13);
516
+ x00 ^= rotl(x03 + x02 | 0, 18);
517
+ x06 ^= rotl(x05 + x04 | 0, 7);
518
+ x07 ^= rotl(x06 + x05 | 0, 9);
519
+ x04 ^= rotl(x07 + x06 | 0, 13);
520
+ x05 ^= rotl(x04 + x07 | 0, 18);
521
+ x11 ^= rotl(x10 + x09 | 0, 7);
522
+ x08 ^= rotl(x11 + x10 | 0, 9);
523
+ x09 ^= rotl(x08 + x11 | 0, 13);
524
+ x10 ^= rotl(x09 + x08 | 0, 18);
525
+ x12 ^= rotl(x15 + x14 | 0, 7);
526
+ x13 ^= rotl(x12 + x15 | 0, 9);
527
+ x14 ^= rotl(x13 + x12 | 0, 13);
528
+ x15 ^= rotl(x14 + x13 | 0, 18);
529
+ }
530
+ out[oi++] = y00 + x00 | 0;
531
+ out[oi++] = y01 + x01 | 0;
532
+ out[oi++] = y02 + x02 | 0;
533
+ out[oi++] = y03 + x03 | 0;
534
+ out[oi++] = y04 + x04 | 0;
535
+ out[oi++] = y05 + x05 | 0;
536
+ out[oi++] = y06 + x06 | 0;
537
+ out[oi++] = y07 + x07 | 0;
538
+ out[oi++] = y08 + x08 | 0;
539
+ out[oi++] = y09 + x09 | 0;
540
+ out[oi++] = y10 + x10 | 0;
541
+ out[oi++] = y11 + x11 | 0;
542
+ out[oi++] = y12 + x12 | 0;
543
+ out[oi++] = y13 + x13 | 0;
544
+ out[oi++] = y14 + x14 | 0;
545
+ out[oi++] = y15 + x15 | 0;
546
+ }
547
+ function BlockMix(input, ii, out, oi, r) {
548
+ let head = oi + 0;
549
+ let tail = oi + 16 * r;
550
+ for (let i = 0; i < 16; i++)
551
+ out[tail + i] = input[ii + (2 * r - 1) * 16 + i];
552
+ for (let i = 0; i < r; i++, head += 16, ii += 16) {
553
+ XorAndSalsa(out, tail, input, ii, out, head);
554
+ if (i > 0)
555
+ tail += 16;
556
+ XorAndSalsa(out, head, input, ii += 16, out, tail);
557
+ }
558
+ }
559
+ function scryptInit(password, salt, _opts) {
560
+ const opts = checkOpts({
561
+ dkLen: 32,
562
+ asyncTick: 10,
563
+ maxmem: 1024 ** 3 + 1024
564
+ }, _opts);
565
+ const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts;
566
+ anumber(N);
567
+ anumber(r);
568
+ anumber(p);
569
+ anumber(dkLen);
570
+ anumber(asyncTick);
571
+ anumber(maxmem);
572
+ if (onProgress !== void 0 && typeof onProgress !== "function")
573
+ throw new Error("progressCb should be function");
574
+ const blockSize = 128 * r;
575
+ const blockSize32 = blockSize / 4;
576
+ const pow32 = Math.pow(2, 32);
577
+ if (N <= 1 || (N & N - 1) !== 0 || N > pow32) {
578
+ throw new Error("Scrypt: N must be larger than 1, a power of 2, and less than 2^32");
579
+ }
580
+ if (p < 0 || p > (pow32 - 1) * 32 / blockSize) {
581
+ throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");
582
+ }
583
+ if (dkLen < 0 || dkLen > (pow32 - 1) * 32) {
584
+ throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");
585
+ }
586
+ const memUsed = blockSize * (N + p);
587
+ if (memUsed > maxmem) {
588
+ throw new Error("Scrypt: memused is bigger than maxMem. Expected 128 * r * (N + p) > maxmem of " + maxmem);
589
+ }
590
+ const B = pbkdf2(sha256, password, salt, { c: 1, dkLen: blockSize * p });
591
+ const B32 = u32(B);
592
+ const V = u32(new Uint8Array(blockSize * N));
593
+ const tmp = u32(new Uint8Array(blockSize));
594
+ let blockMixCb = () => {
595
+ };
596
+ if (onProgress) {
597
+ const totalBlockMix = 2 * N * p;
598
+ const callbackPer = Math.max(Math.floor(totalBlockMix / 1e4), 1);
599
+ let blockMixCnt = 0;
600
+ blockMixCb = () => {
601
+ blockMixCnt++;
602
+ if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix))
603
+ onProgress(blockMixCnt / totalBlockMix);
604
+ };
605
+ }
606
+ return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick };
607
+ }
608
+ function scryptOutput(password, dkLen, B, V, tmp) {
609
+ const res = pbkdf2(sha256, password, B, { c: 1, dkLen });
610
+ clean(B, V, tmp);
611
+ return res;
612
+ }
613
+ async function scryptAsync(password, salt, opts) {
614
+ const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts);
615
+ swap32IfBE(B32);
616
+ for (let pi = 0; pi < p; pi++) {
617
+ const Pi = blockSize32 * pi;
618
+ for (let i = 0; i < blockSize32; i++)
619
+ V[i] = B32[Pi + i];
620
+ let pos = 0;
621
+ await asyncLoop(N - 1, asyncTick, () => {
622
+ BlockMix(V, pos, V, pos += blockSize32, r);
623
+ blockMixCb();
624
+ });
625
+ BlockMix(V, (N - 1) * blockSize32, B32, Pi, r);
626
+ blockMixCb();
627
+ await asyncLoop(N, asyncTick, () => {
628
+ const j = B32[Pi + blockSize32 - 16] % N;
629
+ for (let k = 0; k < blockSize32; k++)
630
+ tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k];
631
+ BlockMix(tmp, 0, B32, Pi, r);
632
+ blockMixCb();
633
+ });
634
+ }
635
+ swap32IfBE(B32);
636
+ return scryptOutput(password, dkLen, B, V, tmp);
637
+ }
638
+
639
+ // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.4.3/node_modules/ox/_esm/core/version.js
640
+ var version = "0.1.1";
641
+
642
+ // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.4.3/node_modules/ox/_esm/core/internal/errors.js
643
+ function getVersion() {
644
+ return version;
645
+ }
646
+
647
+ // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.4.3/node_modules/ox/_esm/core/Errors.js
648
+ var BaseError = class _BaseError extends Error {
649
+ static setStaticOptions(options) {
650
+ _BaseError.prototype.docsOrigin = options.docsOrigin;
651
+ _BaseError.prototype.showVersion = options.showVersion;
652
+ _BaseError.prototype.version = options.version;
653
+ }
654
+ constructor(shortMessage, options = {}) {
655
+ const details = (() => {
656
+ if (options.cause instanceof _BaseError) {
657
+ if (options.cause.details)
658
+ return options.cause.details;
659
+ if (options.cause.shortMessage)
660
+ return options.cause.shortMessage;
661
+ }
662
+ if (options.cause && "details" in options.cause && typeof options.cause.details === "string")
663
+ return options.cause.details;
664
+ if (options.cause?.message)
665
+ return options.cause.message;
666
+ return options.details;
667
+ })();
668
+ const docsPath = (() => {
669
+ if (options.cause instanceof _BaseError)
670
+ return options.cause.docsPath || options.docsPath;
671
+ return options.docsPath;
672
+ })();
673
+ const docsBaseUrl = options.docsOrigin ?? _BaseError.prototype.docsOrigin;
674
+ const docs = `${docsBaseUrl}${docsPath ?? ""}`;
675
+ const showVersion = Boolean(options.version ?? _BaseError.prototype.showVersion);
676
+ const version2 = options.version ?? _BaseError.prototype.version;
677
+ const message = [
678
+ shortMessage || "An error occurred.",
679
+ ...options.metaMessages ? ["", ...options.metaMessages] : [],
680
+ ...details || docsPath || showVersion ? [
681
+ "",
682
+ details ? `Details: ${details}` : void 0,
683
+ docsPath ? `See: ${docs}` : void 0,
684
+ showVersion ? `Version: ${version2}` : void 0
685
+ ] : []
686
+ ].filter((x) => typeof x === "string").join("\n");
687
+ super(message, options.cause ? { cause: options.cause } : void 0);
688
+ Object.defineProperty(this, "details", {
689
+ enumerable: true,
690
+ configurable: true,
691
+ writable: true,
692
+ value: void 0
693
+ });
694
+ Object.defineProperty(this, "docs", {
695
+ enumerable: true,
696
+ configurable: true,
697
+ writable: true,
698
+ value: void 0
699
+ });
700
+ Object.defineProperty(this, "docsOrigin", {
701
+ enumerable: true,
702
+ configurable: true,
703
+ writable: true,
704
+ value: void 0
705
+ });
706
+ Object.defineProperty(this, "docsPath", {
707
+ enumerable: true,
708
+ configurable: true,
709
+ writable: true,
710
+ value: void 0
711
+ });
712
+ Object.defineProperty(this, "shortMessage", {
713
+ enumerable: true,
714
+ configurable: true,
715
+ writable: true,
716
+ value: void 0
717
+ });
718
+ Object.defineProperty(this, "showVersion", {
719
+ enumerable: true,
720
+ configurable: true,
721
+ writable: true,
722
+ value: void 0
723
+ });
724
+ Object.defineProperty(this, "version", {
725
+ enumerable: true,
726
+ configurable: true,
727
+ writable: true,
728
+ value: void 0
729
+ });
730
+ Object.defineProperty(this, "cause", {
731
+ enumerable: true,
732
+ configurable: true,
733
+ writable: true,
734
+ value: void 0
735
+ });
736
+ Object.defineProperty(this, "name", {
737
+ enumerable: true,
738
+ configurable: true,
739
+ writable: true,
740
+ value: "BaseError"
741
+ });
742
+ this.cause = options.cause;
743
+ this.details = details;
744
+ this.docs = docs;
745
+ this.docsOrigin = docsBaseUrl;
746
+ this.docsPath = docsPath;
747
+ this.shortMessage = shortMessage;
748
+ this.showVersion = showVersion;
749
+ this.version = version2;
750
+ }
751
+ walk(fn) {
752
+ return walk(this, fn);
753
+ }
754
+ };
755
+ Object.defineProperty(BaseError, "defaultStaticOptions", {
756
+ enumerable: true,
757
+ configurable: true,
758
+ writable: true,
759
+ value: {
760
+ docsOrigin: "https://oxlib.sh",
761
+ showVersion: false,
762
+ version: `ox@${getVersion()}`
763
+ }
764
+ });
765
+ (() => {
766
+ BaseError.setStaticOptions(BaseError.defaultStaticOptions);
767
+ })();
768
+ function walk(err, fn) {
769
+ if (fn?.(err))
770
+ return err;
771
+ if (err && typeof err === "object" && "cause" in err && err.cause)
772
+ return walk(err.cause, fn);
773
+ return fn ? null : err;
774
+ }
775
+
776
+ // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.4.3/node_modules/ox/_esm/core/internal/bytes.js
777
+ var charCodeMap = {
778
+ zero: 48,
779
+ nine: 57,
780
+ A: 65,
781
+ F: 70,
782
+ a: 97,
783
+ f: 102
784
+ };
785
+ function charCodeToBase16(char) {
786
+ if (char >= charCodeMap.zero && char <= charCodeMap.nine)
787
+ return char - charCodeMap.zero;
788
+ if (char >= charCodeMap.A && char <= charCodeMap.F)
789
+ return char - (charCodeMap.A - 10);
790
+ if (char >= charCodeMap.a && char <= charCodeMap.f)
791
+ return char - (charCodeMap.a - 10);
792
+ return void 0;
793
+ }
794
+
795
+ // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.4.3/node_modules/ox/_esm/core/internal/hex.js
796
+ function assertSize(hex, size_) {
797
+ if (size(hex) > size_)
798
+ throw new SizeOverflowError({
799
+ givenSize: size(hex),
800
+ maxSize: size_
801
+ });
802
+ }
803
+ function pad(hex_, options = {}) {
804
+ const { dir, size: size2 = 32 } = options;
805
+ if (size2 === 0)
806
+ return hex_;
807
+ const hex = hex_.replace("0x", "");
808
+ if (hex.length > size2 * 2)
809
+ throw new SizeExceedsPaddingSizeError({
810
+ size: Math.ceil(hex.length / 2),
811
+ targetSize: size2,
812
+ type: "Hex"
813
+ });
814
+ return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size2 * 2, "0")}`;
815
+ }
816
+
817
+ // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.4.3/node_modules/ox/_esm/core/Hex.js
818
+ var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
819
+ function fromBytes(value, options = {}) {
820
+ let string = "";
821
+ for (let i = 0; i < value.length; i++)
822
+ string += hexes[value[i]];
823
+ const hex = `0x${string}`;
824
+ if (typeof options.size === "number") {
825
+ assertSize(hex, options.size);
826
+ return padRight(hex, options.size);
827
+ }
828
+ return hex;
829
+ }
830
+ function padRight(value, size2) {
831
+ return pad(value, { dir: "right", size: size2 });
832
+ }
833
+ function size(value) {
834
+ return Math.ceil((value.length - 2) / 2);
835
+ }
836
+ var SizeOverflowError = class extends BaseError {
837
+ constructor({ givenSize, maxSize }) {
838
+ super(`Size cannot exceed \`${maxSize}\` bytes. Given size: \`${givenSize}\` bytes.`);
839
+ Object.defineProperty(this, "name", {
840
+ enumerable: true,
841
+ configurable: true,
842
+ writable: true,
843
+ value: "Hex.SizeOverflowError"
844
+ });
845
+ }
846
+ };
847
+ var SizeExceedsPaddingSizeError = class extends BaseError {
848
+ constructor({ size: size2, targetSize, type }) {
849
+ super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (\`${size2}\`) exceeds padding size (\`${targetSize}\`).`);
850
+ Object.defineProperty(this, "name", {
851
+ enumerable: true,
852
+ configurable: true,
853
+ writable: true,
854
+ value: "Hex.SizeExceedsPaddingSizeError"
855
+ });
856
+ }
857
+ };
858
+
859
+ // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.4.3/node_modules/ox/_esm/core/Bytes.js
860
+ function from(value) {
861
+ if (value instanceof Uint8Array)
862
+ return value;
863
+ if (typeof value === "string")
864
+ return fromHex(value);
865
+ return fromArray(value);
866
+ }
867
+ function fromArray(value) {
868
+ return value instanceof Uint8Array ? value : new Uint8Array(value);
869
+ }
870
+ function fromHex(value, options = {}) {
871
+ const { size: size2 } = options;
872
+ let hex = value;
873
+ if (size2) {
874
+ assertSize(value, size2);
875
+ hex = padRight(value, size2);
876
+ }
877
+ let hexString = hex.slice(2);
878
+ if (hexString.length % 2)
879
+ hexString = `0${hexString}`;
880
+ const length = hexString.length / 2;
881
+ const bytes = new Uint8Array(length);
882
+ for (let index = 0, j = 0; index < length; index++) {
883
+ const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
884
+ const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
885
+ if (nibbleLeft === void 0 || nibbleRight === void 0) {
886
+ throw new BaseError(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
887
+ }
888
+ bytes[index] = nibbleLeft << 4 | nibbleRight;
889
+ }
890
+ return bytes;
891
+ }
892
+ function random(length) {
893
+ return crypto.getRandomValues(new Uint8Array(length));
894
+ }
895
+ function toHex(value, options = {}) {
896
+ return fromBytes(value, options);
897
+ }
898
+
899
+ // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.4.3/node_modules/ox/_esm/core/Keystore.js
900
+ function pbkdf22(options) {
901
+ const { iv, iterations = 262144, password } = options;
902
+ const salt = options.salt ? from(options.salt) : random(32);
903
+ const key = toHex(pbkdf2(sha256, password, salt, { c: iterations, dkLen: 32 }));
904
+ return defineKey(() => key, {
905
+ iv,
906
+ kdfparams: {
907
+ c: iterations,
908
+ dklen: 32,
909
+ prf: "hmac-sha256",
910
+ salt: toHex(salt).slice(2)
911
+ },
912
+ kdf: "pbkdf2"
913
+ });
914
+ }
915
+ async function scryptAsync2(options) {
916
+ const { iv, n = 262144, password } = options;
917
+ const p = 8;
918
+ const r = 1;
919
+ const salt = options.salt ? from(options.salt) : random(32);
920
+ const key = toHex(await scryptAsync(password, salt, { N: n, dkLen: 32, r, p }));
921
+ return defineKey(() => key, {
922
+ iv,
923
+ kdfparams: {
924
+ dklen: 32,
925
+ n,
926
+ p,
927
+ r,
928
+ salt: toHex(salt).slice(2)
929
+ },
930
+ kdf: "scrypt"
931
+ });
932
+ }
933
+ async function toKeyAsync(keystore, options) {
934
+ const { crypto: crypto2 } = keystore;
935
+ const { password } = options;
936
+ const { cipherparams, kdf, kdfparams } = crypto2;
937
+ const { iv } = cipherparams;
938
+ const { c, n, p, r, salt } = kdfparams;
939
+ const [key] = await (async () => {
940
+ switch (kdf) {
941
+ case "scrypt":
942
+ return await scryptAsync2({
943
+ iv: from(`0x${iv}`),
944
+ n,
945
+ p,
946
+ r,
947
+ salt: from(`0x${salt}`),
948
+ password
949
+ });
950
+ case "pbkdf2":
951
+ return await pbkdf22({
952
+ iv: from(`0x${iv}`),
953
+ iterations: c,
954
+ password,
955
+ salt: from(`0x${salt}`)
956
+ });
957
+ default:
958
+ throw new Error("unsupported kdf");
959
+ }
960
+ })();
961
+ return key;
962
+ }
963
+ function defineKey(key, options) {
964
+ const iv = options.iv ? from(options.iv) : random(16);
965
+ return [key, { ...options, iv }];
966
+ }
967
+
968
+ // src/lib/wallet/keystore-kdf-worker.ts
969
+ try {
970
+ const key = await toKeyAsync(workerData.keystore, { password: workerData.password });
971
+ parentPort?.postMessage({ key: typeof key === "function" ? key() : key });
972
+ } catch {
973
+ parentPort?.postMessage({ error: "Keystore derivation failed." });
974
+ }
975
+ parentPort?.close();
976
+ /*! Bundled license information:
977
+
978
+ @noble/hashes/esm/utils.js:
979
+ (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
980
+ */