tenjin-cli 0.1.0-alpha.33 → 0.1.0-alpha.35

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 (495) hide show
  1. package/NOTICE.md +110 -0
  2. package/README.md +87 -81
  3. package/dist/{_esm-BIN7VY2L.js → _esm-2KST7HQ7.js} +7 -7
  4. package/dist/alive-5TV22PNF.js +51 -0
  5. package/dist/auth-XI7BJFLW.js +47 -0
  6. package/dist/{auto-update-Y24UL56V.js → auto-update-7L24KDWA.js} +4 -5
  7. package/dist/balance-DFHC6XEU.js +71 -0
  8. package/dist/{ccip-DHDFKTQV.js → ccip-HOW3DZYF.js} +4 -4
  9. package/dist/chunk-24XKUN2S.js +202 -0
  10. package/dist/chunk-24XKUN2S.js.map +1 -0
  11. package/dist/chunk-2L7TDGLV.js +56 -0
  12. package/dist/chunk-2L7TDGLV.js.map +1 -0
  13. package/dist/{chunk-C2Q76BVM.js → chunk-2U7H35IP.js} +29 -7
  14. package/dist/chunk-2U7H35IP.js.map +1 -0
  15. package/dist/chunk-2W4DQQUU.js +176 -0
  16. package/dist/chunk-2W4DQQUU.js.map +1 -0
  17. package/dist/{chunk-LRW6S53P.js → chunk-34SAECKZ.js} +35 -11
  18. package/dist/chunk-34SAECKZ.js.map +1 -0
  19. package/dist/{chunk-2I4QTOLB.js → chunk-3MZ7DYRO.js} +1 -1
  20. package/dist/chunk-3MZ7DYRO.js.map +1 -0
  21. package/dist/{chunk-RVPYTUP4.js → chunk-3Y2EHT4F.js} +13 -9
  22. package/dist/chunk-3Y2EHT4F.js.map +1 -0
  23. package/dist/chunk-3Y6BHIN6.js +169 -0
  24. package/dist/chunk-3Y6BHIN6.js.map +1 -0
  25. package/dist/{chunk-4K7TQHNP.js → chunk-3YPL6T3P.js} +17 -33
  26. package/dist/chunk-3YPL6T3P.js.map +1 -0
  27. package/dist/{chunk-E7SW44LM.js → chunk-44MVIRZH.js} +121 -6
  28. package/dist/chunk-44MVIRZH.js.map +1 -0
  29. package/dist/chunk-45MMSBHA.js +321 -0
  30. package/dist/chunk-45MMSBHA.js.map +1 -0
  31. package/dist/{chunk-3FMZGI7I.js → chunk-4CE6TMI5.js} +1 -1
  32. package/dist/chunk-4CE6TMI5.js.map +1 -0
  33. package/dist/{chunk-QXP3Z3JN.js → chunk-4MBCJFY4.js} +35 -3
  34. package/dist/chunk-4MBCJFY4.js.map +1 -0
  35. package/dist/chunk-4TPL54KW.js +227 -0
  36. package/dist/chunk-4TPL54KW.js.map +1 -0
  37. package/dist/chunk-54ELBTKE.js +1615 -0
  38. package/dist/chunk-54ELBTKE.js.map +1 -0
  39. package/dist/{chunk-NDGZDTSJ.js → chunk-5F4OB5B3.js} +115 -57
  40. package/dist/chunk-5F4OB5B3.js.map +1 -0
  41. package/dist/chunk-5HN4KVQU.js +3348 -0
  42. package/dist/chunk-5HN4KVQU.js.map +1 -0
  43. package/dist/{chunk-ZDZERB6L.js → chunk-5J4E5GYI.js} +572 -407
  44. package/dist/chunk-5J4E5GYI.js.map +1 -0
  45. package/dist/{chunk-ZNNXRNFD.js → chunk-5N4GGUBN.js} +48 -6
  46. package/dist/chunk-5N4GGUBN.js.map +1 -0
  47. package/dist/chunk-5USBZ2MU.js +58 -0
  48. package/dist/chunk-5USBZ2MU.js.map +1 -0
  49. package/dist/chunk-64WOMNYR.js +183 -0
  50. package/dist/chunk-64WOMNYR.js.map +1 -0
  51. package/dist/{chunk-ILNIZ5I2.js → chunk-65RS4LQS.js} +1825 -1715
  52. package/dist/chunk-65RS4LQS.js.map +1 -0
  53. package/dist/{chunk-IE7P2BZE.js → chunk-6QMDUDF2.js} +3 -3
  54. package/dist/{chunk-IADZOXKN.js → chunk-7SLOTLO7.js} +19 -697
  55. package/dist/chunk-7SLOTLO7.js.map +1 -0
  56. package/dist/{chunk-WFSPCCVW.js → chunk-7V25UAQO.js} +99 -99
  57. package/dist/{chunk-WFSPCCVW.js.map → chunk-7V25UAQO.js.map} +1 -1
  58. package/dist/chunk-BGA4DO5M.js +719 -0
  59. package/dist/chunk-BGA4DO5M.js.map +1 -0
  60. package/dist/chunk-BVP7YK2J.js +706 -0
  61. package/dist/chunk-BVP7YK2J.js.map +1 -0
  62. package/dist/chunk-C265QIMJ.js +83 -0
  63. package/dist/chunk-C265QIMJ.js.map +1 -0
  64. package/dist/{chunk-XQJXNMSB.js → chunk-CRG54LEB.js} +1 -1
  65. package/dist/chunk-CRG54LEB.js.map +1 -0
  66. package/dist/{chunk-KG3D7FIF.js → chunk-CZJOMUBP.js} +2 -2
  67. package/dist/{chunk-36RVGZNY.js → chunk-D6M3ZK66.js} +22 -39
  68. package/dist/chunk-D6M3ZK66.js.map +1 -0
  69. package/dist/{chunk-3UCIG4TG.js → chunk-DI4QAGRZ.js} +1 -11
  70. package/dist/chunk-DI4QAGRZ.js.map +1 -0
  71. package/dist/{chunk-JKKAIPTU.js → chunk-DIH2G3YG.js} +47 -10
  72. package/dist/chunk-DIH2G3YG.js.map +1 -0
  73. package/dist/chunk-DJ36BM62.js +78 -0
  74. package/dist/chunk-DJ36BM62.js.map +1 -0
  75. package/dist/chunk-DTEWAVNE.js +114 -0
  76. package/dist/chunk-DTEWAVNE.js.map +1 -0
  77. package/dist/chunk-F2KJAJ7T.js +13 -0
  78. package/dist/chunk-F2KJAJ7T.js.map +1 -0
  79. package/dist/{chunk-BF4XHEQK.js → chunk-F3QPGYOY.js} +6 -6
  80. package/dist/chunk-F3QPGYOY.js.map +1 -0
  81. package/dist/{chunk-3GNJXKIT.js → chunk-F43CV6UC.js} +2 -2
  82. package/dist/{chunk-J57UC3DD.js → chunk-FKVJKLPI.js} +3 -3
  83. package/dist/{chunk-V2LQLN5H.js → chunk-FYFHH7V5.js} +59 -8
  84. package/dist/{chunk-V2LQLN5H.js.map → chunk-FYFHH7V5.js.map} +1 -1
  85. package/dist/chunk-GAJC4BQZ.js +1096 -0
  86. package/dist/chunk-GAJC4BQZ.js.map +1 -0
  87. package/dist/{chunk-DOQGNFHM.js → chunk-GH5UKMZD.js} +2 -12
  88. package/dist/{chunk-DOQGNFHM.js.map → chunk-GH5UKMZD.js.map} +1 -1
  89. package/dist/{chunk-WYXUQGOL.js → chunk-HAZAN4UM.js} +7 -6
  90. package/dist/chunk-HAZAN4UM.js.map +1 -0
  91. package/dist/chunk-HI5XQOX2.js +393 -0
  92. package/dist/chunk-HI5XQOX2.js.map +1 -0
  93. package/dist/chunk-HKGUKAQW.js +488 -0
  94. package/dist/chunk-HKGUKAQW.js.map +1 -0
  95. package/dist/{chunk-SO3XRZPX.js → chunk-HPRVFJPM.js} +6 -6
  96. package/dist/{chunk-L6JEXB3E.js → chunk-HQR4BWKX.js} +3 -131
  97. package/dist/chunk-HQR4BWKX.js.map +1 -0
  98. package/dist/chunk-HZKANST2.js +177 -0
  99. package/dist/chunk-HZKANST2.js.map +1 -0
  100. package/dist/{chunk-UUGOUOVT.js → chunk-I557SAOM.js} +8 -2
  101. package/dist/chunk-I557SAOM.js.map +1 -0
  102. package/dist/{chunk-TC2WZLSC.js → chunk-IGLWLH73.js} +8 -7
  103. package/dist/chunk-IGLWLH73.js.map +1 -0
  104. package/dist/chunk-ILWCKCOI.js +58 -0
  105. package/dist/chunk-ILWCKCOI.js.map +1 -0
  106. package/dist/{chunk-2GP3HRYK.js → chunk-INSIW65E.js} +182 -182
  107. package/dist/{chunk-MPZUYCAP.js → chunk-IULCDMVG.js} +12 -1
  108. package/dist/chunk-IULCDMVG.js.map +1 -0
  109. package/dist/{chunk-INTFHMU4.js → chunk-IVNSUAVC.js} +25 -26
  110. package/dist/chunk-IVNSUAVC.js.map +1 -0
  111. package/dist/chunk-JDQZCREI.js +87 -0
  112. package/dist/chunk-JDQZCREI.js.map +1 -0
  113. package/dist/chunk-JHFFUVON.js +1050 -0
  114. package/dist/chunk-JHFFUVON.js.map +1 -0
  115. package/dist/{chunk-RL5UUDT4.js → chunk-JNUKLSMZ.js} +3 -3
  116. package/dist/chunk-JTILUN4W.js +2933 -0
  117. package/dist/chunk-JTILUN4W.js.map +1 -0
  118. package/dist/{chunk-OJNTCYQQ.js → chunk-JTX3BUDK.js} +37 -53
  119. package/dist/chunk-JTX3BUDK.js.map +1 -0
  120. package/dist/{chunk-X5ZBP3IY.js → chunk-JUUBBBY5.js} +2 -2
  121. package/dist/chunk-JUUBBBY5.js.map +1 -0
  122. package/dist/chunk-JWAK7JQB.js +15 -0
  123. package/dist/chunk-JWAK7JQB.js.map +1 -0
  124. package/dist/{chunk-UXZONNEQ.js → chunk-K5KNGC4I.js} +34 -31
  125. package/dist/chunk-K5KNGC4I.js.map +1 -0
  126. package/dist/chunk-KAQ4Q3TO.js +135 -0
  127. package/dist/chunk-KAQ4Q3TO.js.map +1 -0
  128. package/dist/chunk-KFVJYLVL.js +125 -0
  129. package/dist/chunk-KFVJYLVL.js.map +1 -0
  130. package/dist/chunk-KGUE5AVX.js +69 -0
  131. package/dist/chunk-KGUE5AVX.js.map +1 -0
  132. package/dist/{chunk-FVIGCDSV.js → chunk-KLDMLWXT.js} +11 -85
  133. package/dist/chunk-KLDMLWXT.js.map +1 -0
  134. package/dist/chunk-KNKDMTHU.js +453 -0
  135. package/dist/chunk-KNKDMTHU.js.map +1 -0
  136. package/dist/chunk-LDA6TAYQ.js +95 -0
  137. package/dist/chunk-LDA6TAYQ.js.map +1 -0
  138. package/dist/chunk-LWSSIZOY.js +347 -0
  139. package/dist/chunk-LWSSIZOY.js.map +1 -0
  140. package/dist/{chunk-ZURZHELF.js → chunk-MAHNZA6C.js} +158 -41
  141. package/dist/chunk-MAHNZA6C.js.map +1 -0
  142. package/dist/chunk-MEWZCIA6.js +220 -0
  143. package/dist/chunk-MEWZCIA6.js.map +1 -0
  144. package/dist/{chunk-2SNUOHAT.js → chunk-MEZJ3I63.js} +49 -1
  145. package/dist/chunk-MEZJ3I63.js.map +1 -0
  146. package/dist/chunk-MJDO4EXD.js +353 -0
  147. package/dist/chunk-MJDO4EXD.js.map +1 -0
  148. package/dist/chunk-NJA6NT3A.js +6595 -0
  149. package/dist/chunk-NJA6NT3A.js.map +1 -0
  150. package/dist/{chunk-LHHMV4GU.js → chunk-NVSKJPRC.js} +1 -1
  151. package/dist/{chunk-LHHMV4GU.js.map → chunk-NVSKJPRC.js.map} +1 -1
  152. package/dist/{chunk-4YOZGGTZ.js → chunk-OC7K2DVZ.js} +5 -5
  153. package/dist/chunk-OC7K2DVZ.js.map +1 -0
  154. package/dist/chunk-ODRPASFP.js +2078 -0
  155. package/dist/chunk-ODRPASFP.js.map +1 -0
  156. package/dist/chunk-OJJFANO6.js +133 -0
  157. package/dist/chunk-OJJFANO6.js.map +1 -0
  158. package/dist/{chunk-JNJWBTU2.js → chunk-OQWPRFAC.js} +332 -882
  159. package/dist/chunk-OQWPRFAC.js.map +1 -0
  160. package/dist/chunk-P4I7BFNJ.js +11 -0
  161. package/dist/chunk-P4I7BFNJ.js.map +1 -0
  162. package/dist/{chunk-SNNSAGMT.js → chunk-P6YQWIT2.js} +4058 -4039
  163. package/dist/chunk-P6YQWIT2.js.map +1 -0
  164. package/dist/{chunk-JRGFKVAZ.js → chunk-PETQ5WEA.js} +2 -2
  165. package/dist/{chunk-HMWYAUA6.js → chunk-Q6RSJCXB.js} +29 -69
  166. package/dist/chunk-Q6RSJCXB.js.map +1 -0
  167. package/dist/{chunk-U3IKUGRP.js → chunk-QKEUKBRK.js} +17 -23
  168. package/dist/chunk-QKEUKBRK.js.map +1 -0
  169. package/dist/{chunk-2RWB7RKE.js → chunk-QKYUCITR.js} +174 -5814
  170. package/dist/chunk-QKYUCITR.js.map +1 -0
  171. package/dist/chunk-QQDPRTLP.js +127 -0
  172. package/dist/chunk-QQDPRTLP.js.map +1 -0
  173. package/dist/chunk-QQYCYAKI.js +79 -0
  174. package/dist/chunk-QQYCYAKI.js.map +1 -0
  175. package/dist/chunk-R4KDH477.js +1064 -0
  176. package/dist/chunk-R4KDH477.js.map +1 -0
  177. package/dist/chunk-R5TR2DIK.js +119 -0
  178. package/dist/chunk-R5TR2DIK.js.map +1 -0
  179. package/dist/chunk-R62PKTAG.js +66 -0
  180. package/dist/chunk-R62PKTAG.js.map +1 -0
  181. package/dist/{chunk-BFDQ4WNW.js → chunk-RFZA7PSM.js} +4 -5
  182. package/dist/chunk-RFZA7PSM.js.map +1 -0
  183. package/dist/chunk-RGCPELQN.js +219 -0
  184. package/dist/chunk-RGCPELQN.js.map +1 -0
  185. package/dist/chunk-RGVCOG2S.js +910 -0
  186. package/dist/chunk-RGVCOG2S.js.map +1 -0
  187. package/dist/chunk-SOLNJ3AZ.js +209 -0
  188. package/dist/chunk-SOLNJ3AZ.js.map +1 -0
  189. package/dist/chunk-TFT2X7SH.js +77 -0
  190. package/dist/chunk-TFT2X7SH.js.map +1 -0
  191. package/dist/chunk-TUCKEEXE.js +2 -0
  192. package/dist/chunk-TVWCLUBI.js +293 -0
  193. package/dist/chunk-TVWCLUBI.js.map +1 -0
  194. package/dist/chunk-U4TRWSVE.js +78 -0
  195. package/dist/chunk-U4TRWSVE.js.map +1 -0
  196. package/dist/chunk-UIB33QQP.js +379 -0
  197. package/dist/chunk-UIB33QQP.js.map +1 -0
  198. package/dist/chunk-V6GIVALQ.js +1889 -0
  199. package/dist/chunk-V6GIVALQ.js.map +1 -0
  200. package/dist/chunk-VHXCPXUS.js +366 -0
  201. package/dist/chunk-VHXCPXUS.js.map +1 -0
  202. package/dist/{chunk-HGZEPQUT.js → chunk-VU6GMWF6.js} +17 -8
  203. package/dist/chunk-VU6GMWF6.js.map +1 -0
  204. package/dist/chunk-VWZYE3NC.js +8415 -0
  205. package/dist/chunk-VWZYE3NC.js.map +1 -0
  206. package/dist/{chunk-AGMVASXZ.js → chunk-W2GXIARJ.js} +88 -11
  207. package/dist/chunk-W2GXIARJ.js.map +1 -0
  208. package/dist/chunk-W4G3K3V7.js +288 -0
  209. package/dist/chunk-W4G3K3V7.js.map +1 -0
  210. package/dist/chunk-W74LJ5OT.js +588 -0
  211. package/dist/chunk-W74LJ5OT.js.map +1 -0
  212. package/dist/chunk-W7ELYLYK.js +233 -0
  213. package/dist/chunk-W7ELYLYK.js.map +1 -0
  214. package/dist/{chunk-BPMWXTFX.js → chunk-WFZX352D.js} +7 -7
  215. package/dist/chunk-WXA3WTPF.js +20 -0
  216. package/dist/chunk-WXA3WTPF.js.map +1 -0
  217. package/dist/chunk-XRGFH7FI.js +454 -0
  218. package/dist/chunk-XRGFH7FI.js.map +1 -0
  219. package/dist/chunk-XSCGUO2U.js +330 -0
  220. package/dist/chunk-XSCGUO2U.js.map +1 -0
  221. package/dist/chunk-XWROSMI5.js +1039 -0
  222. package/dist/chunk-XWROSMI5.js.map +1 -0
  223. package/dist/chunk-Y2EXZ47H.js +40 -0
  224. package/dist/chunk-Y2EXZ47H.js.map +1 -0
  225. package/dist/chunk-YJGEVBKZ.js +47 -0
  226. package/dist/chunk-YJGEVBKZ.js.map +1 -0
  227. package/dist/{chunk-6CMM6YCB.js → chunk-YWWMISDY.js} +2 -2
  228. package/dist/{chunk-WXA2BWTE.js → chunk-ZCT5DJ3G.js} +2 -48
  229. package/dist/chunk-ZCT5DJ3G.js.map +1 -0
  230. package/dist/chunk-ZEYA2WWX.js +982 -0
  231. package/dist/chunk-ZEYA2WWX.js.map +1 -0
  232. package/dist/chunk-ZRC7Z5X3.js +82 -0
  233. package/dist/chunk-ZRC7Z5X3.js.map +1 -0
  234. package/dist/{chunk-3AIHRXKO.js → chunk-ZS7JIUJ3.js} +12 -10
  235. package/dist/chunk-ZS7JIUJ3.js.map +1 -0
  236. package/dist/{clack-EZ7TDWQU.js → clack-Q4RNC5VE.js} +2 -6
  237. package/dist/{claude-cli-2YKABJJZ.js → claude-cli-GIIHOBGT.js} +4 -2
  238. package/dist/claude-install-BAUSJMW3.js +64 -0
  239. package/dist/{cli-E36SPKBW.js → cli-QY4KKA3D.js} +632 -150
  240. package/dist/cli-QY4KKA3D.js.map +1 -0
  241. package/dist/client-3YQKORVK.js +710 -0
  242. package/dist/client-3YQKORVK.js.map +1 -0
  243. package/dist/{codex-event-ZO2GEFE6.js → codex-event-EUTCAOTQ.js} +3 -5
  244. package/dist/{codex-host-KECJVTA2.js → codex-host-ZON3S6HU.js} +7 -7
  245. package/dist/{codex-install-HQZDGFXW.js → codex-install-HZV2DOAB.js} +242 -88
  246. package/dist/codex-install-HZV2DOAB.js.map +1 -0
  247. package/dist/config-QZOBMTEL.js +57 -0
  248. package/dist/config-names-Z5NZD5R2.js +224 -0
  249. package/dist/config-names-Z5NZD5R2.js.map +1 -0
  250. package/dist/config-rules-YOYHS6YL.js +55 -0
  251. package/dist/config-subagents-WQV2ZAD5.js +362 -0
  252. package/dist/config-subagents-WQV2ZAD5.js.map +1 -0
  253. package/dist/connect-YDWTYU4B.js +1020 -0
  254. package/dist/connect-YDWTYU4B.js.map +1 -0
  255. package/dist/core-0a66n3e7-TTP554XV.js +127 -0
  256. package/dist/core-0a66n3e7-TTP554XV.js.map +1 -0
  257. package/dist/core-0bmnpbz2-C2JIRVZO.js +10790 -0
  258. package/dist/core-0bmnpbz2-C2JIRVZO.js.map +1 -0
  259. package/dist/core-9je8ee1j-74DGHWPV.js +30 -0
  260. package/dist/core-9je8ee1j-74DGHWPV.js.map +1 -0
  261. package/dist/core-wadgcjfh-TSZFQZGH.js +666 -0
  262. package/dist/core-wadgcjfh-TSZFQZGH.js.map +1 -0
  263. package/dist/core-zg882d22-LKV5DZYW.js +37 -0
  264. package/dist/core-zg882d22-LKV5DZYW.js.map +1 -0
  265. package/dist/decision-QSKHOGCO.js +145 -0
  266. package/dist/{doctor-I6XQEKWD.js → doctor-ZWJXRD75.js} +162 -148
  267. package/dist/doctor-ZWJXRD75.js.map +1 -0
  268. package/dist/{env-proxy-R6ZMLQTT.js → env-proxy-XLSLHBKQ.js} +2 -2
  269. package/dist/{ethersCompat-Df4a6QIZ-X6YZWAML.js → ethersCompat-Df4a6QIZ-K3DMHR6Y.js} +5 -5
  270. package/dist/explicit-ME2NRADQ.js +371 -0
  271. package/dist/explicit-ME2NRADQ.js.map +1 -0
  272. package/dist/flush-stdio-NYIJ3QXT.js +18 -0
  273. package/dist/fund-VF7TLDJH.js +722 -0
  274. package/dist/fund-VF7TLDJH.js.map +1 -0
  275. package/dist/hook-command-VZ27MGWO.js +49 -0
  276. package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
  277. package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +2 -2
  278. package/dist/hosts/claude/tenjin/hooks/hook-data.ts +152 -0
  279. package/dist/hosts/claude/tenjin/hooks/hooks.json +7 -0
  280. package/dist/hosts/claude/tenjin/hooks/model-viewer.tsx +2987 -0
  281. package/dist/hosts/claude/tenjin/hooks/register.tsx +527 -56
  282. package/dist/hosts/claude/tenjin/skills/tenjin-pay/SKILL.md +14 -4
  283. package/dist/hosts/claude/tenjin/types/index.d.ts +144 -1
  284. package/dist/{hosts-DVQJ32QC.js → hosts-3EMTVM4H.js} +7 -6
  285. package/dist/index.js +18 -15
  286. package/dist/index.js.map +1 -1
  287. package/dist/install-ZA7L2UF3.js +115 -0
  288. package/dist/install-funding-JDGYTF72.js +30 -0
  289. package/dist/install-identity-FFAYEFLX.js +30 -0
  290. package/dist/{install-wallet-5M4OTYLX.js → install-wallet-2SFOVE3Q.js} +68 -53
  291. package/dist/install-wallet-2SFOVE3Q.js.map +1 -0
  292. package/dist/mcp-36S6MK3C.js +67642 -0
  293. package/dist/mcp-36S6MK3C.js.map +1 -0
  294. package/dist/new-install-5L4GY3LN.js +51 -0
  295. package/dist/{package-IJFGMWEV.js → package-BONDXSV3.js} +2 -2
  296. package/dist/{passphrase-IFTDS3CU.js → passphrase-T4ULBN4M.js} +16 -12
  297. package/dist/{paths-XCSAKISU.js → paths-O2KDWZ76.js} +18 -28
  298. package/dist/pay-CMV5KL74.js +74 -0
  299. package/dist/{payments-HFPPWHTV.js → payments-Z6UBZL4Z.js} +36 -26
  300. package/dist/payments-Z6UBZL4Z.js.map +1 -0
  301. package/dist/reclaim-subagent-credit-ABSF67SJ.js +105 -0
  302. package/dist/reclaim-subagent-credit-ABSF67SJ.js.map +1 -0
  303. package/dist/{redact-D7ASVWKL.js → redact-LOTHE5TS.js} +2 -8
  304. package/dist/redact-LOTHE5TS.js.map +1 -0
  305. package/dist/routing-quote-AHLAREXR.js +40 -0
  306. package/dist/routing-quote-AHLAREXR.js.map +1 -0
  307. package/dist/run-JH7ELYAM.js +88 -0
  308. package/dist/run-JH7ELYAM.js.map +1 -0
  309. package/dist/runtime-2GX4ALJP.js +410 -0
  310. package/dist/runtime-2GX4ALJP.js.map +1 -0
  311. package/dist/runtime-activate-IDQ2NCSP.js +39 -0
  312. package/dist/runtime-activate-IDQ2NCSP.js.map +1 -0
  313. package/dist/{runtime-fetch-ZSSSK72Y.js → runtime-fetch-6LOBHBEN.js} +4 -4
  314. package/dist/runtime-fetch-6LOBHBEN.js.map +1 -0
  315. package/dist/runtime-launchers-YAPKCBHV.js +31 -0
  316. package/dist/runtime-launchers-YAPKCBHV.js.map +1 -0
  317. package/dist/{runtime-layout-WIDILZ6K.js → runtime-layout-QHZQJV7C.js} +5 -4
  318. package/dist/runtime-layout-QHZQJV7C.js.map +1 -0
  319. package/dist/runtime-place-4POL4KK4.js +37 -0
  320. package/dist/runtime-place-4POL4KK4.js.map +1 -0
  321. package/dist/runtime-provenance-MNJGVBV2.js +12 -0
  322. package/dist/runtime-provenance-MNJGVBV2.js.map +1 -0
  323. package/dist/{secp256k1-ZZZT2CAX.js → secp256k1-N5P2GVGF.js} +3 -3
  324. package/dist/secp256k1-N5P2GVGF.js.map +1 -0
  325. package/dist/{send-GCVEAQKL.js → send-ELXFKEKY.js} +35 -32
  326. package/dist/send-ELXFKEKY.js.map +1 -0
  327. package/dist/status-FXUFWJDM.js +404 -0
  328. package/dist/status-FXUFWJDM.js.map +1 -0
  329. package/dist/{status-line-OPCXDHL2.js → status-line-IH5JBWBC.js} +51 -43
  330. package/dist/status-line-IH5JBWBC.js.map +1 -0
  331. package/dist/streamableHttp-CP2ZQBIK.js +768 -0
  332. package/dist/streamableHttp-CP2ZQBIK.js.map +1 -0
  333. package/dist/{uninstall-BAWRBXXQ.js → uninstall-LJZUKM4D.js} +76 -76
  334. package/dist/uninstall-LJZUKM4D.js.map +1 -0
  335. package/dist/update-EUIX72IX.js +68 -0
  336. package/dist/update-EUIX72IX.js.map +1 -0
  337. package/dist/usage-EKDC7LUC.js +180 -0
  338. package/dist/usage-EKDC7LUC.js.map +1 -0
  339. package/dist/{usdc-VG4CIOUK.js → usdc-YIHK2OMC.js} +8 -12
  340. package/dist/usdc-YIHK2OMC.js.map +1 -0
  341. package/dist/{viemAdapter-By13KInL-DOFTEIJV.js → viemAdapter-By13KInL-PRLSIESK.js} +5 -5
  342. package/dist/viemAdapter-By13KInL-PRLSIESK.js.map +1 -0
  343. package/dist/wallet-HSW757W6.js +80 -0
  344. package/dist/wallet-HSW757W6.js.map +1 -0
  345. package/dist/wallet-kdf-worker.mjs +1433 -818
  346. package/docs/agent-permissions.md +88 -155
  347. package/docs/router-reference.md +236 -0
  348. package/docs/safety-model.md +31 -33
  349. package/docs/subagents-internals.md +97 -0
  350. package/docs/subagents.md +348 -0
  351. package/docs/troubleshooting.md +10 -6
  352. package/package.json +12 -8
  353. package/scripts/installers/install.sh +7 -1
  354. package/dist/alive-GSOWKUOY.js +0 -38
  355. package/dist/chunk-2I4QTOLB.js.map +0 -1
  356. package/dist/chunk-2M2VPI2E.js +0 -560
  357. package/dist/chunk-2M2VPI2E.js.map +0 -1
  358. package/dist/chunk-2RWB7RKE.js.map +0 -1
  359. package/dist/chunk-2SNUOHAT.js.map +0 -1
  360. package/dist/chunk-3623BLPV.js +0 -184
  361. package/dist/chunk-3623BLPV.js.map +0 -1
  362. package/dist/chunk-36RVGZNY.js.map +0 -1
  363. package/dist/chunk-3AIHRXKO.js.map +0 -1
  364. package/dist/chunk-3FMZGI7I.js.map +0 -1
  365. package/dist/chunk-3UCIG4TG.js.map +0 -1
  366. package/dist/chunk-4K7TQHNP.js.map +0 -1
  367. package/dist/chunk-4LMUQMBH.js +0 -29
  368. package/dist/chunk-4LMUQMBH.js.map +0 -1
  369. package/dist/chunk-4USCZ2NI.js +0 -228
  370. package/dist/chunk-4USCZ2NI.js.map +0 -1
  371. package/dist/chunk-4YOZGGTZ.js.map +0 -1
  372. package/dist/chunk-62KNUYWD.js +0 -111
  373. package/dist/chunk-62KNUYWD.js.map +0 -1
  374. package/dist/chunk-A5GKIG5O.js +0 -2037
  375. package/dist/chunk-A5GKIG5O.js.map +0 -1
  376. package/dist/chunk-AGMVASXZ.js.map +0 -1
  377. package/dist/chunk-BF4XHEQK.js.map +0 -1
  378. package/dist/chunk-BFDQ4WNW.js.map +0 -1
  379. package/dist/chunk-C2Q76BVM.js.map +0 -1
  380. package/dist/chunk-CEXSOI5R.js +0 -808
  381. package/dist/chunk-CEXSOI5R.js.map +0 -1
  382. package/dist/chunk-E7SW44LM.js.map +0 -1
  383. package/dist/chunk-EDJWHDDL.js +0 -33
  384. package/dist/chunk-EDJWHDDL.js.map +0 -1
  385. package/dist/chunk-FVIGCDSV.js.map +0 -1
  386. package/dist/chunk-GTTUCOPD.js +0 -105
  387. package/dist/chunk-GTTUCOPD.js.map +0 -1
  388. package/dist/chunk-HDPUXS3Z.js +0 -122
  389. package/dist/chunk-HDPUXS3Z.js.map +0 -1
  390. package/dist/chunk-HGGWCP7W.js +0 -120
  391. package/dist/chunk-HGGWCP7W.js.map +0 -1
  392. package/dist/chunk-HGZEPQUT.js.map +0 -1
  393. package/dist/chunk-HMWYAUA6.js.map +0 -1
  394. package/dist/chunk-IADZOXKN.js.map +0 -1
  395. package/dist/chunk-ILNIZ5I2.js.map +0 -1
  396. package/dist/chunk-INTFHMU4.js.map +0 -1
  397. package/dist/chunk-JKKAIPTU.js.map +0 -1
  398. package/dist/chunk-JNJWBTU2.js.map +0 -1
  399. package/dist/chunk-KM7RY2ZS.js +0 -246
  400. package/dist/chunk-KM7RY2ZS.js.map +0 -1
  401. package/dist/chunk-KOGZDMHO.js +0 -21
  402. package/dist/chunk-KOGZDMHO.js.map +0 -1
  403. package/dist/chunk-L6JEXB3E.js.map +0 -1
  404. package/dist/chunk-LRW6S53P.js.map +0 -1
  405. package/dist/chunk-LXAYUOXI.js +0 -511
  406. package/dist/chunk-LXAYUOXI.js.map +0 -1
  407. package/dist/chunk-MEFB5KHA.js +0 -59
  408. package/dist/chunk-MEFB5KHA.js.map +0 -1
  409. package/dist/chunk-MPZUYCAP.js.map +0 -1
  410. package/dist/chunk-NDGZDTSJ.js.map +0 -1
  411. package/dist/chunk-OJNTCYQQ.js.map +0 -1
  412. package/dist/chunk-P3LFTKE7.js +0 -58
  413. package/dist/chunk-P3LFTKE7.js.map +0 -1
  414. package/dist/chunk-QXP3Z3JN.js.map +0 -1
  415. package/dist/chunk-RVPYTUP4.js.map +0 -1
  416. package/dist/chunk-SNNSAGMT.js.map +0 -1
  417. package/dist/chunk-TC2WZLSC.js.map +0 -1
  418. package/dist/chunk-TKPF35W6.js +0 -29
  419. package/dist/chunk-TKPF35W6.js.map +0 -1
  420. package/dist/chunk-U3IKUGRP.js.map +0 -1
  421. package/dist/chunk-UUGOUOVT.js.map +0 -1
  422. package/dist/chunk-UXZONNEQ.js.map +0 -1
  423. package/dist/chunk-WXA2BWTE.js.map +0 -1
  424. package/dist/chunk-WYXUQGOL.js.map +0 -1
  425. package/dist/chunk-X5ZBP3IY.js.map +0 -1
  426. package/dist/chunk-XKESD27X.js +0 -10
  427. package/dist/chunk-XKESD27X.js.map +0 -1
  428. package/dist/chunk-XQJXNMSB.js.map +0 -1
  429. package/dist/chunk-Y527D4TV.js +0 -56
  430. package/dist/chunk-Y527D4TV.js.map +0 -1
  431. package/dist/chunk-ZDZERB6L.js.map +0 -1
  432. package/dist/chunk-ZNNXRNFD.js.map +0 -1
  433. package/dist/chunk-ZURZHELF.js.map +0 -1
  434. package/dist/cli-E36SPKBW.js.map +0 -1
  435. package/dist/codex-install-HQZDGFXW.js.map +0 -1
  436. package/dist/config-HY2E4GGW.js +0 -55
  437. package/dist/doctor-I6XQEKWD.js.map +0 -1
  438. package/dist/fund-2QRO7OJL.js +0 -378
  439. package/dist/fund-2QRO7OJL.js.map +0 -1
  440. package/dist/hook-command-2UBCSZG6.js +0 -43
  441. package/dist/install-ILUX5C4A.js +0 -107
  442. package/dist/install-identity-TZKGY6LQ.js +0 -31
  443. package/dist/install-wallet-5M4OTYLX.js.map +0 -1
  444. package/dist/mcp-LE4DUS22.js +0 -14127
  445. package/dist/mcp-LE4DUS22.js.map +0 -1
  446. package/dist/pay-WCG3IH4R.js +0 -55
  447. package/dist/payments-HFPPWHTV.js.map +0 -1
  448. package/dist/plugin-registration-PZFI5GZW.js +0 -68
  449. package/dist/runtime-UZOKSUZX.js +0 -1321
  450. package/dist/runtime-UZOKSUZX.js.map +0 -1
  451. package/dist/send-GCVEAQKL.js.map +0 -1
  452. package/dist/status-HCVAOCN7.js +0 -150
  453. package/dist/status-HCVAOCN7.js.map +0 -1
  454. package/dist/status-line-OPCXDHL2.js.map +0 -1
  455. package/dist/uninstall-BAWRBXXQ.js.map +0 -1
  456. package/dist/update-CACXLQLR.js +0 -56
  457. package/dist/wallet-QL4UUXEZ.js +0 -55
  458. /package/dist/{_esm-BIN7VY2L.js.map → _esm-2KST7HQ7.js.map} +0 -0
  459. /package/dist/{alive-GSOWKUOY.js.map → alive-5TV22PNF.js.map} +0 -0
  460. /package/dist/{auto-update-Y24UL56V.js.map → auth-XI7BJFLW.js.map} +0 -0
  461. /package/dist/{ccip-DHDFKTQV.js.map → auto-update-7L24KDWA.js.map} +0 -0
  462. /package/dist/{clack-EZ7TDWQU.js.map → balance-DFHC6XEU.js.map} +0 -0
  463. /package/dist/{claude-cli-2YKABJJZ.js.map → ccip-HOW3DZYF.js.map} +0 -0
  464. /package/dist/{chunk-IE7P2BZE.js.map → chunk-6QMDUDF2.js.map} +0 -0
  465. /package/dist/{chunk-KG3D7FIF.js.map → chunk-CZJOMUBP.js.map} +0 -0
  466. /package/dist/{chunk-3GNJXKIT.js.map → chunk-F43CV6UC.js.map} +0 -0
  467. /package/dist/{chunk-J57UC3DD.js.map → chunk-FKVJKLPI.js.map} +0 -0
  468. /package/dist/{chunk-SO3XRZPX.js.map → chunk-HPRVFJPM.js.map} +0 -0
  469. /package/dist/{chunk-2GP3HRYK.js.map → chunk-INSIW65E.js.map} +0 -0
  470. /package/dist/{chunk-RL5UUDT4.js.map → chunk-JNUKLSMZ.js.map} +0 -0
  471. /package/dist/{chunk-JRGFKVAZ.js.map → chunk-PETQ5WEA.js.map} +0 -0
  472. /package/dist/{codex-event-ZO2GEFE6.js.map → chunk-TUCKEEXE.js.map} +0 -0
  473. /package/dist/{chunk-BPMWXTFX.js.map → chunk-WFZX352D.js.map} +0 -0
  474. /package/dist/{chunk-6CMM6YCB.js.map → chunk-YWWMISDY.js.map} +0 -0
  475. /package/dist/{codex-host-KECJVTA2.js.map → clack-Q4RNC5VE.js.map} +0 -0
  476. /package/dist/{config-HY2E4GGW.js.map → claude-cli-GIIHOBGT.js.map} +0 -0
  477. /package/dist/{env-proxy-R6ZMLQTT.js.map → claude-install-BAUSJMW3.js.map} +0 -0
  478. /package/dist/{ethersCompat-Df4a6QIZ-X6YZWAML.js.map → codex-event-EUTCAOTQ.js.map} +0 -0
  479. /package/dist/{hook-command-2UBCSZG6.js.map → codex-host-ZON3S6HU.js.map} +0 -0
  480. /package/dist/{hosts-DVQJ32QC.js.map → config-QZOBMTEL.js.map} +0 -0
  481. /package/dist/{install-ILUX5C4A.js.map → config-rules-YOYHS6YL.js.map} +0 -0
  482. /package/dist/{install-identity-TZKGY6LQ.js.map → decision-QSKHOGCO.js.map} +0 -0
  483. /package/dist/{package-IJFGMWEV.js.map → env-proxy-XLSLHBKQ.js.map} +0 -0
  484. /package/dist/{passphrase-IFTDS3CU.js.map → ethersCompat-Df4a6QIZ-K3DMHR6Y.js.map} +0 -0
  485. /package/dist/{paths-XCSAKISU.js.map → flush-stdio-NYIJ3QXT.js.map} +0 -0
  486. /package/dist/{pay-WCG3IH4R.js.map → hook-command-VZ27MGWO.js.map} +0 -0
  487. /package/dist/{plugin-registration-PZFI5GZW.js.map → hosts-3EMTVM4H.js.map} +0 -0
  488. /package/dist/{redact-D7ASVWKL.js.map → install-ZA7L2UF3.js.map} +0 -0
  489. /package/dist/{runtime-fetch-ZSSSK72Y.js.map → install-funding-JDGYTF72.js.map} +0 -0
  490. /package/dist/{runtime-layout-WIDILZ6K.js.map → install-identity-FFAYEFLX.js.map} +0 -0
  491. /package/dist/{secp256k1-ZZZT2CAX.js.map → new-install-5L4GY3LN.js.map} +0 -0
  492. /package/dist/{update-CACXLQLR.js.map → package-BONDXSV3.js.map} +0 -0
  493. /package/dist/{usdc-VG4CIOUK.js.map → passphrase-T4ULBN4M.js.map} +0 -0
  494. /package/dist/{viemAdapter-By13KInL-DOFTEIJV.js.map → paths-O2KDWZ76.js.map} +0 -0
  495. /package/dist/{wallet-QL4UUXEZ.js.map → pay-CMV5KL74.js.map} +0 -0
@@ -1,906 +1,1490 @@
1
1
  // src/lib/wallet/keystore-kdf-worker.ts
2
2
  import { parentPort, workerData } from "node:worker_threads";
3
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);
4
+ // node_modules/.pnpm/hash-wasm@4.12.0/node_modules/hash-wasm/dist/index.esm.js
5
+ function __awaiter(thisArg, _arguments, P, generator) {
6
+ function adopt(value) {
7
+ return value instanceof P ? value : new P(function(resolve) {
8
+ resolve(value);
9
+ });
10
+ }
11
+ return new (P || (P = Promise))(function(resolve, reject) {
12
+ function fulfilled(value) {
13
+ try {
14
+ step(generator.next(value));
15
+ } catch (e) {
16
+ reject(e);
17
+ }
18
+ }
19
+ function rejected(value) {
20
+ try {
21
+ step(generator["throw"](value));
22
+ } catch (e) {
23
+ reject(e);
24
+ }
25
+ }
26
+ function step(result) {
27
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
28
+ }
29
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
30
+ });
11
31
  }
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);
32
+ var Mutex = class {
33
+ constructor() {
34
+ this.mutex = Promise.resolve();
35
+ }
36
+ lock() {
37
+ let begin = () => {
38
+ };
39
+ this.mutex = this.mutex.then(() => new Promise(begin));
40
+ return new Promise((res) => {
41
+ begin = res;
42
+ });
43
+ }
44
+ dispatch(fn) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ const unlock = yield this.lock();
47
+ try {
48
+ return yield Promise.resolve(fn());
49
+ } finally {
50
+ unlock();
51
+ }
52
+ });
53
+ }
54
+ };
55
+ var _a;
56
+ function getGlobal() {
57
+ if (typeof globalThis !== "undefined")
58
+ return globalThis;
59
+ if (typeof self !== "undefined")
60
+ return self;
61
+ if (typeof window !== "undefined")
62
+ return window;
63
+ return global;
17
64
  }
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);
65
+ var globalObject = getGlobal();
66
+ var nodeBuffer = (_a = globalObject.Buffer) !== null && _a !== void 0 ? _a : null;
67
+ var textEncoder = globalObject.TextEncoder ? new globalObject.TextEncoder() : null;
68
+ function hexCharCodesToInt(a, b) {
69
+ return (a & 15) + (a >> 6 | a >> 3 & 8) << 4 | (b & 15) + (b >> 6 | b >> 3 & 8);
23
70
  }
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");
71
+ function writeHexToUInt8(buf, str) {
72
+ const size2 = str.length >> 1;
73
+ for (let i = 0; i < size2; i++) {
74
+ const index = i << 1;
75
+ buf[i] = hexCharCodesToInt(str.charCodeAt(index), str.charCodeAt(index + 1));
76
+ }
29
77
  }
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);
78
+ function hexStringEqualsUInt8(str, buf) {
79
+ if (str.length !== buf.length * 2) {
80
+ return false;
35
81
  }
82
+ for (let i = 0; i < buf.length; i++) {
83
+ const strIndex = i << 1;
84
+ if (buf[i] !== hexCharCodesToInt(str.charCodeAt(strIndex), str.charCodeAt(strIndex + 1))) {
85
+ return false;
86
+ }
87
+ }
88
+ return true;
36
89
  }
37
- function u32(arr) {
38
- return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
90
+ var alpha = "a".charCodeAt(0) - 10;
91
+ var digit = "0".charCodeAt(0);
92
+ function getDigestHex(tmpBuffer, input, hashLength) {
93
+ let p = 0;
94
+ for (let i = 0; i < hashLength; i++) {
95
+ let nibble = input[i] >>> 4;
96
+ tmpBuffer[p++] = nibble > 9 ? nibble + alpha : nibble + digit;
97
+ nibble = input[i] & 15;
98
+ tmpBuffer[p++] = nibble > 9 ? nibble + alpha : nibble + digit;
99
+ }
100
+ return String.fromCharCode.apply(null, tmpBuffer);
39
101
  }
40
- function clean(...arrays) {
41
- for (let i = 0; i < arrays.length; i++) {
42
- arrays[i].fill(0);
102
+ var getUInt8Buffer = nodeBuffer !== null ? (data) => {
103
+ if (typeof data === "string") {
104
+ const buf = nodeBuffer.from(data, "utf8");
105
+ return new Uint8Array(buf.buffer, buf.byteOffset, buf.length);
106
+ }
107
+ if (nodeBuffer.isBuffer(data)) {
108
+ return new Uint8Array(data.buffer, data.byteOffset, data.length);
109
+ }
110
+ if (ArrayBuffer.isView(data)) {
111
+ return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
112
+ }
113
+ throw new Error("Invalid data type!");
114
+ } : (data) => {
115
+ if (typeof data === "string") {
116
+ return textEncoder.encode(data);
117
+ }
118
+ if (ArrayBuffer.isView(data)) {
119
+ return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
43
120
  }
121
+ throw new Error("Invalid data type!");
122
+ };
123
+ var base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
124
+ var base64Lookup = new Uint8Array(256);
125
+ for (let i = 0; i < base64Chars.length; i++) {
126
+ base64Lookup[base64Chars.charCodeAt(i)] = i;
44
127
  }
45
- function createView(arr) {
46
- return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
128
+ function getDecodeBase64Length(data) {
129
+ let bufferLength = Math.floor(data.length * 0.75);
130
+ const len = data.length;
131
+ if (data[len - 1] === "=") {
132
+ bufferLength -= 1;
133
+ if (data[len - 2] === "=") {
134
+ bufferLength -= 1;
135
+ }
136
+ }
137
+ return bufferLength;
47
138
  }
48
- function rotr(word, shift) {
49
- return word << 32 - shift | word >>> shift;
139
+ function decodeBase64(data) {
140
+ const bufferLength = getDecodeBase64Length(data);
141
+ const len = data.length;
142
+ const bytes = new Uint8Array(bufferLength);
143
+ let p = 0;
144
+ for (let i = 0; i < len; i += 4) {
145
+ const encoded1 = base64Lookup[data.charCodeAt(i)];
146
+ const encoded2 = base64Lookup[data.charCodeAt(i + 1)];
147
+ const encoded3 = base64Lookup[data.charCodeAt(i + 2)];
148
+ const encoded4 = base64Lookup[data.charCodeAt(i + 3)];
149
+ bytes[p] = encoded1 << 2 | encoded2 >> 4;
150
+ p += 1;
151
+ bytes[p] = (encoded2 & 15) << 4 | encoded3 >> 2;
152
+ p += 1;
153
+ bytes[p] = (encoded3 & 3) << 6 | encoded4 & 63;
154
+ p += 1;
155
+ }
156
+ return bytes;
50
157
  }
51
- function rotl(word, shift) {
52
- return word << shift | word >>> 32 - shift >>> 0;
158
+ var MAX_HEAP = 16 * 1024;
159
+ var WASM_FUNC_HASH_LENGTH = 4;
160
+ var wasmMutex = new Mutex();
161
+ var wasmModuleCache = /* @__PURE__ */ new Map();
162
+ function WASMInterface(binary, hashLength) {
163
+ return __awaiter(this, void 0, void 0, function* () {
164
+ let wasmInstance = null;
165
+ let memoryView = null;
166
+ let initialized = false;
167
+ if (typeof WebAssembly === "undefined") {
168
+ throw new Error("WebAssembly is not supported in this environment!");
169
+ }
170
+ const writeMemory = (data, offset = 0) => {
171
+ memoryView.set(data, offset);
172
+ };
173
+ const getMemory = () => memoryView;
174
+ const getExports = () => wasmInstance.exports;
175
+ const setMemorySize = (totalSize) => {
176
+ wasmInstance.exports.Hash_SetMemorySize(totalSize);
177
+ const arrayOffset = wasmInstance.exports.Hash_GetBuffer();
178
+ const memoryBuffer = wasmInstance.exports.memory.buffer;
179
+ memoryView = new Uint8Array(memoryBuffer, arrayOffset, totalSize);
180
+ };
181
+ const getStateSize = () => {
182
+ const view = new DataView(wasmInstance.exports.memory.buffer);
183
+ const stateSize = view.getUint32(wasmInstance.exports.STATE_SIZE, true);
184
+ return stateSize;
185
+ };
186
+ const loadWASMPromise = wasmMutex.dispatch(() => __awaiter(this, void 0, void 0, function* () {
187
+ if (!wasmModuleCache.has(binary.name)) {
188
+ const asm = decodeBase64(binary.data);
189
+ const promise = WebAssembly.compile(asm);
190
+ wasmModuleCache.set(binary.name, promise);
191
+ }
192
+ const module = yield wasmModuleCache.get(binary.name);
193
+ wasmInstance = yield WebAssembly.instantiate(module, {
194
+ // env: {
195
+ // emscripten_memcpy_big: (dest, src, num) => {
196
+ // const memoryBuffer = wasmInstance.exports.memory.buffer;
197
+ // const memView = new Uint8Array(memoryBuffer, 0);
198
+ // memView.set(memView.subarray(src, src + num), dest);
199
+ // },
200
+ // print_memory: (offset, len) => {
201
+ // const memoryBuffer = wasmInstance.exports.memory.buffer;
202
+ // const memView = new Uint8Array(memoryBuffer, 0);
203
+ // console.log('print_int32', memView.subarray(offset, offset + len));
204
+ // },
205
+ // },
206
+ });
207
+ }));
208
+ const setupInterface = () => __awaiter(this, void 0, void 0, function* () {
209
+ if (!wasmInstance) {
210
+ yield loadWASMPromise;
211
+ }
212
+ const arrayOffset = wasmInstance.exports.Hash_GetBuffer();
213
+ const memoryBuffer = wasmInstance.exports.memory.buffer;
214
+ memoryView = new Uint8Array(memoryBuffer, arrayOffset, MAX_HEAP);
215
+ });
216
+ const init = (bits = null) => {
217
+ initialized = true;
218
+ wasmInstance.exports.Hash_Init(bits);
219
+ };
220
+ const updateUInt8Array = (data) => {
221
+ let read = 0;
222
+ while (read < data.length) {
223
+ const chunk = data.subarray(read, read + MAX_HEAP);
224
+ read += chunk.length;
225
+ memoryView.set(chunk);
226
+ wasmInstance.exports.Hash_Update(chunk.length);
227
+ }
228
+ };
229
+ const update = (data) => {
230
+ if (!initialized) {
231
+ throw new Error("update() called before init()");
232
+ }
233
+ const Uint8Buffer = getUInt8Buffer(data);
234
+ updateUInt8Array(Uint8Buffer);
235
+ };
236
+ const digestChars = new Uint8Array(hashLength * 2);
237
+ const digest = (outputType, padding = null) => {
238
+ if (!initialized) {
239
+ throw new Error("digest() called before init()");
240
+ }
241
+ initialized = false;
242
+ wasmInstance.exports.Hash_Final(padding);
243
+ if (outputType === "binary") {
244
+ return memoryView.slice(0, hashLength);
245
+ }
246
+ return getDigestHex(digestChars, memoryView, hashLength);
247
+ };
248
+ const save = () => {
249
+ if (!initialized) {
250
+ throw new Error("save() can only be called after init() and before digest()");
251
+ }
252
+ const stateOffset = wasmInstance.exports.Hash_GetState();
253
+ const stateLength = getStateSize();
254
+ const memoryBuffer = wasmInstance.exports.memory.buffer;
255
+ const internalState = new Uint8Array(memoryBuffer, stateOffset, stateLength);
256
+ const prefixedState = new Uint8Array(WASM_FUNC_HASH_LENGTH + stateLength);
257
+ writeHexToUInt8(prefixedState, binary.hash);
258
+ prefixedState.set(internalState, WASM_FUNC_HASH_LENGTH);
259
+ return prefixedState;
260
+ };
261
+ const load = (state) => {
262
+ if (!(state instanceof Uint8Array)) {
263
+ throw new Error("load() expects an Uint8Array generated by save()");
264
+ }
265
+ const stateOffset = wasmInstance.exports.Hash_GetState();
266
+ const stateLength = getStateSize();
267
+ const overallLength = WASM_FUNC_HASH_LENGTH + stateLength;
268
+ const memoryBuffer = wasmInstance.exports.memory.buffer;
269
+ if (state.length !== overallLength) {
270
+ throw new Error(`Bad state length (expected ${overallLength} bytes, got ${state.length})`);
271
+ }
272
+ if (!hexStringEqualsUInt8(binary.hash, state.subarray(0, WASM_FUNC_HASH_LENGTH))) {
273
+ throw new Error("This state was written by an incompatible hash implementation");
274
+ }
275
+ const internalState = state.subarray(WASM_FUNC_HASH_LENGTH);
276
+ new Uint8Array(memoryBuffer, stateOffset, stateLength).set(internalState);
277
+ initialized = true;
278
+ };
279
+ const isDataShort = (data) => {
280
+ if (typeof data === "string") {
281
+ return data.length < MAX_HEAP / 4;
282
+ }
283
+ return data.byteLength < MAX_HEAP;
284
+ };
285
+ let canSimplify = isDataShort;
286
+ switch (binary.name) {
287
+ case "argon2":
288
+ case "scrypt":
289
+ canSimplify = () => true;
290
+ break;
291
+ case "blake2b":
292
+ case "blake2s":
293
+ canSimplify = (data, initParam) => initParam <= 512 && isDataShort(data);
294
+ break;
295
+ case "blake3":
296
+ canSimplify = (data, initParam) => initParam === 0 && isDataShort(data);
297
+ break;
298
+ case "xxhash64":
299
+ // cannot simplify
300
+ case "xxhash3":
301
+ case "xxhash128":
302
+ case "crc64":
303
+ canSimplify = () => false;
304
+ break;
305
+ }
306
+ const calculate = (data, initParam = null, digestParam = null) => {
307
+ if (!canSimplify(data, initParam)) {
308
+ init(initParam);
309
+ update(data);
310
+ return digest("hex", digestParam);
311
+ }
312
+ const buffer = getUInt8Buffer(data);
313
+ memoryView.set(buffer);
314
+ wasmInstance.exports.Hash_Calculate(buffer.length, initParam, digestParam);
315
+ return getDigestHex(digestChars, memoryView, hashLength);
316
+ };
317
+ yield setupInterface();
318
+ return {
319
+ getMemory,
320
+ writeMemory,
321
+ getExports,
322
+ setMemorySize,
323
+ init,
324
+ update,
325
+ digest,
326
+ save,
327
+ load,
328
+ calculate,
329
+ hashLength
330
+ };
331
+ });
53
332
  }
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;
333
+ var mutex$l = new Mutex();
334
+ var mutex$k = new Mutex();
335
+ var uint32View = new DataView(new ArrayBuffer(4));
336
+ var mutex$j = new Mutex();
337
+ var mutex$i = new Mutex();
338
+ var mutex$h = new Mutex();
339
+ var mutex$g = new Mutex();
340
+ var polyBuffer = new Uint8Array(8);
341
+ var mutex$f = new Mutex();
342
+ var mutex$e = new Mutex();
343
+ var mutex$d = new Mutex();
344
+ var mutex$c = new Mutex();
345
+ var mutex$b = new Mutex();
346
+ var name$a = "sha256";
347
+ var data$a = "AGFzbQEAAAABEQRgAAF/YAF/AGAAAGACf38AAwgHAAEBAQIAAwUEAQECAgYOAn8BQfCJBQt/AEGACAsHcAgGbWVtb3J5AgAOSGFzaF9HZXRCdWZmZXIAAAlIYXNoX0luaXQAAQtIYXNoX1VwZGF0ZQACCkhhc2hfRmluYWwABA1IYXNoX0dldFN0YXRlAAUOSGFzaF9DYWxjdWxhdGUABgpTVEFURV9TSVpFAwEKnEoHBQBBgAkLnQEAQQBCADcDwIkBQQBBHEEgIABB4AFGIgAbNgLoiQFBAEKnn+anxvST/b5/Qquzj/yRo7Pw2wAgABs3A+CJAUEAQrGWgP6fooWs6ABC/6S5iMWR2oKbfyAAGzcD2IkBQQBCl7rDg5Onlod3QvLmu+Ojp/2npX8gABs3A9CJAUEAQti9loj8oLW+NkLnzKfQ1tDrs7t/IAAbNwPIiQEL7wICAX4Gf0EAQQApA8CJASIBIACtfDcDwIkBAkACQAJAIAGnQT9xIgINAEGACSEDDAELAkBBwAAgAmsi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d3NqIBdqIgNqIhIgESAJc3EgCXNqIBJBGncgEkEVd3MgEkEHd3NqQfOXgLd8aiIXIAMgAnMgAXEgAyACcXMgA0EedyADQRN3cyADQQp3c2ogGWoiAWoiE2ogICASaiAcIBFqIB8gCWogEyASIBFzcSARc2ogE0EadyATQRV3cyATQQd3c2pBx6KerX1qIhkgASADcyACcSABIANxcyABQR53IAFBE3dzIAFBCndzaiAaaiICaiIJIBMgEnNxIBJzaiAJQRp3IAlBFXdzIAlBB3dzakHRxqk2aiIaIAIgAXMgA3EgAiABcXMgAkEedyACQRN3cyACQQp3c2ogGGoiA2oiESAJIBNzcSATc2ogEUEadyARQRV3cyARQQd3c2pB59KkoQFqIhggAyACcyABcSADIAJxcyADQR53IANBE3dzIANBCndzaiAUaiIBaiISIBEgCXNxIAlzaiASQRp3IBJBFXdzIBJBB3dzakGFldy9AmoiFCABIANzIAJxIAEgA3FzIAFBHncgAUETd3MgAUEKd3NqIBdqIgJqIhMgI2ogJiASaiAiIBFqICUgCWogEyASIBFzcSARc2ogE0EadyATQRV3cyATQQd3c2pBuMLs8AJqIhcgAiABcyADcSACIAFxcyACQR53IAJBE3dzIAJBCndzaiAZaiIDaiIJIBMgEnNxIBJzaiAJQRp3IAlBFXdzIAlBB3dzakH827HpBGoiGSADIAJzIAFxIAMgAnFzIANBHncgA0ETd3MgA0EKd3NqIBpqIgFqIhEgCSATc3EgE3NqIBFBGncgEUEVd3MgEUEHd3NqQZOa4JkFaiIaIAEgA3MgAnEgASADcXMgAUEedyABQRN3cyABQQp3c2ogGGoiAmoiEiARIAlzcSAJc2ogEkEadyASQRV3cyASQQd3c2pB1OapqAZqIhggAiABcyADcSACIAFxcyACQR53IAJBE3dzIAJBCndzaiAUaiIDaiITaiAoIBJqICQgEWogJyAJaiATIBIgEXNxIBFzaiATQRp3IBNBFXdzIBNBB3dzakG7laizB2oiFCADIAJzIAFxIAMgAnFzIANBHncgA0ETd3MgA0EKd3NqIBdqIgFqIgkgEyASc3EgEnN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BgP4DcSAAQRh2cnI2AsiJAQJAQQAoAuiJASICRQ0AQQAhAANAIAFBgAlqIAFByIkBai0AADoAACABQQFqIQEgAiAAQQFqIgBB/wFxSw0ACwsLBgBBgIkBC6MBAEEAQgA3A8CJAUEAQRxBICABQeABRiIBGzYC6IkBQQBCp5/mp8b0k/2+f0Krs4/8kaOz8NsAIAEbNwPgiQFBAEKxloD+n6KFrOgAQv+kuYjFkdqCm38gARs3A9iJAUEAQpe6w4OTp5aHd0Ly5rvjo6f9p6V/IAEbNwPQiQFBAELYvZaI/KC1vjZC58yn0NbQ67O7fyABGzcDyIkBIAAQAhAECwsLAQBBgAgLBHAAAAA=";
348
+ var hash$a = "8c18dd94";
349
+ var wasmJson$a = {
350
+ name: name$a,
351
+ data: data$a,
352
+ hash: hash$a
353
+ };
354
+ var mutex$a = new Mutex();
355
+ var mutex$9 = new Mutex();
356
+ function createSHA256() {
357
+ return WASMInterface(wasmJson$a, 32).then((wasm) => {
358
+ wasm.init(256);
359
+ const obj = {
360
+ init: () => {
361
+ wasm.init(256);
362
+ return obj;
363
+ },
364
+ update: (data) => {
365
+ wasm.update(data);
366
+ return obj;
367
+ },
368
+ // biome-ignore lint/suspicious/noExplicitAny: Conflict with IHasher type
369
+ digest: (outputType) => wasm.digest(outputType),
370
+ save: () => wasm.save(),
371
+ load: (data) => {
372
+ wasm.load(data);
373
+ return obj;
374
+ },
375
+ blockSize: 64,
376
+ digestSize: 32
377
+ };
378
+ return obj;
379
+ });
57
380
  }
58
- function byteSwap32(arr) {
59
- for (let i = 0; i < arr.length; i++) {
60
- arr[i] = byteSwap(arr[i]);
381
+ var mutex$8 = new Mutex();
382
+ var mutex$7 = new Mutex();
383
+ var mutex$6 = new Mutex();
384
+ var mutex$5 = new Mutex();
385
+ var seedBuffer$2 = new Uint8Array(8);
386
+ var mutex$4 = new Mutex();
387
+ var seedBuffer$1 = new Uint8Array(8);
388
+ var mutex$3 = new Mutex();
389
+ var seedBuffer = new Uint8Array(8);
390
+ var mutex$2 = new Mutex();
391
+ function calculateKeyBuffer(hasher, key) {
392
+ const { blockSize } = hasher;
393
+ const buf = getUInt8Buffer(key);
394
+ if (buf.length > blockSize) {
395
+ hasher.update(buf);
396
+ const uintArr = hasher.digest("binary");
397
+ hasher.init();
398
+ return uintArr;
61
399
  }
62
- return arr;
400
+ return new Uint8Array(buf.buffer, buf.byteOffset, buf.length);
63
401
  }
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;
402
+ function calculateHmac(hasher, key) {
403
+ hasher.init();
404
+ const { blockSize } = hasher;
405
+ const keyBuf = calculateKeyBuffer(hasher, key);
406
+ const keyBuffer = new Uint8Array(blockSize);
407
+ keyBuffer.set(keyBuf);
408
+ const opad = new Uint8Array(blockSize);
409
+ for (let i = 0; i < blockSize; i++) {
410
+ const v = keyBuffer[i];
411
+ opad[i] = v ^ 92;
412
+ keyBuffer[i] = v ^ 54;
76
413
  }
414
+ hasher.update(keyBuffer);
415
+ const obj = {
416
+ init: () => {
417
+ hasher.init();
418
+ hasher.update(keyBuffer);
419
+ return obj;
420
+ },
421
+ update: (data) => {
422
+ hasher.update(data);
423
+ return obj;
424
+ },
425
+ digest: ((outputType) => {
426
+ const uintArr = hasher.digest("binary");
427
+ hasher.init();
428
+ hasher.update(opad);
429
+ hasher.update(uintArr);
430
+ return hasher.digest(outputType);
431
+ }),
432
+ save: () => {
433
+ throw new Error("save() not supported");
434
+ },
435
+ load: () => {
436
+ throw new Error("load() not supported");
437
+ },
438
+ blockSize: hasher.blockSize,
439
+ digestSize: hasher.digestSize
440
+ };
441
+ return obj;
77
442
  }
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;
443
+ function createHMAC(hash, key) {
444
+ if (!hash || !hash.then) {
445
+ throw new Error('Invalid hash function is provided! Usage: createHMAC(createMD5(), "key").');
446
+ }
447
+ return hash.then((hasher) => calculateHmac(hasher, key));
88
448
  }
89
- function kdfInputToBytes(data) {
90
- if (typeof data === "string")
91
- data = utf8ToBytes(data);
92
- abytes(data);
93
- return data;
449
+ function calculatePBKDF2(digest, salt, iterations, hashLength, outputType) {
450
+ return __awaiter(this, void 0, void 0, function* () {
451
+ const DK = new Uint8Array(hashLength);
452
+ const block1 = new Uint8Array(salt.length + 4);
453
+ const block1View = new DataView(block1.buffer);
454
+ const saltBuffer = getUInt8Buffer(salt);
455
+ const saltUIntBuffer = new Uint8Array(saltBuffer.buffer, saltBuffer.byteOffset, saltBuffer.length);
456
+ block1.set(saltUIntBuffer);
457
+ let destPos = 0;
458
+ const hLen = digest.digestSize;
459
+ const l = Math.ceil(hashLength / hLen);
460
+ let T = null;
461
+ let U = null;
462
+ for (let i = 1; i <= l; i++) {
463
+ block1View.setUint32(salt.length, i);
464
+ digest.init();
465
+ digest.update(block1);
466
+ T = digest.digest("binary");
467
+ U = T.slice();
468
+ for (let j = 1; j < iterations; j++) {
469
+ digest.init();
470
+ digest.update(U);
471
+ U = digest.digest("binary");
472
+ for (let k = 0; k < hLen; k++) {
473
+ T[k] ^= U[k];
474
+ }
475
+ }
476
+ DK.set(T.subarray(0, hashLength - destPos), destPos);
477
+ destPos += hLen;
478
+ }
479
+ if (outputType === "binary") {
480
+ return DK;
481
+ }
482
+ const digestChars = new Uint8Array(hashLength * 2);
483
+ return getDigestHex(digestChars, DK, hashLength);
484
+ });
94
485
  }
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;
486
+ var validateOptions$2 = (options) => {
487
+ if (!options || typeof options !== "object") {
488
+ throw new Error("Invalid options parameter. It requires an object.");
489
+ }
490
+ if (!options.hashFunction || !options.hashFunction.then) {
491
+ throw new Error('Invalid hash function is provided! Usage: pbkdf2("password", "salt", 1000, 32, createSHA1()).');
492
+ }
493
+ if (!Number.isInteger(options.iterations) || options.iterations < 1) {
494
+ throw new Error("Iterations should be a positive number");
495
+ }
496
+ if (!Number.isInteger(options.hashLength) || options.hashLength < 1) {
497
+ throw new Error("Hash length should be a positive number");
498
+ }
499
+ if (options.outputType === void 0) {
500
+ options.outputType = "hex";
501
+ }
502
+ if (!["hex", "binary"].includes(options.outputType)) {
503
+ throw new Error(`Insupported output type ${options.outputType}. Valid values: ['hex', 'binary']`);
504
+ }
505
+ };
506
+ function pbkdf2(options) {
507
+ return __awaiter(this, void 0, void 0, function* () {
508
+ validateOptions$2(options);
509
+ const hmac2 = yield createHMAC(options.hashFunction, options.password);
510
+ return calculatePBKDF2(hmac2, options.salt, options.iterations, options.hashLength, options.outputType);
511
+ });
100
512
  }
101
- var Hash = class {
513
+ var name$3 = "scrypt";
514
+ var data$3 = "AGFzbQEAAAABGwVgAX8Bf2AAAX9gBH9/f38AYAF/AGADf39/AAMGBQABAgMEBQYBAQKAgAIGCAF/AUGQiAQLBzkEBm1lbW9yeQIAEkhhc2hfU2V0TWVtb3J5U2l6ZQAADkhhc2hfR2V0QnVmZmVyAAEGc2NyeXB0AAQK7iYFWAECf0EAIQECQCAAQQAoAogIIgJGDQACQCAAIAJrIgBBEHYgAEGAgHxxIABJaiIAQABBf0cNAEH/AcAPC0EAIQFBAEEAKQOICCAAQRB0rXw3A4gICyABwAtwAQJ/AkBBACgCgAgiAA0AQQA/AEEQdCIANgKACEEAKAKICCIBQYCAIEYNAAJAQYCAICABayIAQRB2IABBgIB8cSAASWoiAEAAQX9HDQBBAA8LQQBBACkDiAggAEEQdK18NwOICEEAKAKACCEACyAAC6QFAQN/IAIgA0EHdCAAakFAaiIEKQMANwMAIAIgBCkDCDcDCCACIAQpAxA3AxAgAiAEKQMYNwMYIAIgBCkDIDcDICACIAQpAyg3AyggAiAEKQMwNwMwIAIgBCkDODcDOAJAIANFDQAgA0EBdCEFIANBBnQhBkEAIQMDQCACIAIpAwAgACkDAIU3AwAgAiACKQMIIABBCGopAwCFNwMIIAIgAikDECAAQRBqKQMAhTcDECACIAIpAxggAEEYaikDAIU3AxggAiACKQMgIABBIGopAwCFNwMgIAIgAikDKCAAQShqKQMAhTcDKCACIAIpAzAgAEEwaikDAIU3AzAgAiACKQM4IABBOGopAwCFNwM4IAIQAyABIAIpAwA3AwAgAUEIaiACKQMINwMAIAFBEGogAikDEDcDACABQRhqIAIpAxg3AwAgAUEgaiACKQMgNwMAIAFBKGogAikDKDcDACABQTBqIAIpAzA3AwAgAUE4aiACKQM4NwMAIAIgAikDACAAQcAAaikDAIU3AwAgAiACKQMIIABByABqKQMAhTcDCCACIAIpAxAgAEHQAGopAwCFNwMQIAIgAikDGCAAQdgAaikDAIU3AxggAiACKQMgIABB4ABqKQMAhTcDICACIAIpAyggAEHoAGopAwCFNwMoIAIgAikDMCAAQfAAaikDAIU3AzAgAiACKQM4IABB+ABqKQMAhTcDOCACEAMgASAGaiIEIAIpAwA3AwAgBEEIaiACKQMINwMAIARBEGogAikDEDcDACAEQRhqIAIpAxg3AwAgBEEgaiACKQMgNwMAIARBKGogAikDKDcDACAEQTBqIAIpAzA3AwAgBEE4aiACKQM4NwMAIABBgAFqIQAgAUHAAGohASADQQJqIgMgBUkNAAsLC7oNCAF+AX8BfgF/AX4BfwF+En8gACAAKAIEIAApAygiAUIgiKciAiAAKQM4IgNCIIinIgRqQQd3IAApAwgiBUIgiKdzIgYgBGpBCXcgACkDGCIHQiCIp3MiCCAGakENdyACcyIJIAenIgogAaciC2pBB3cgA6dzIgIgC2pBCXcgBadzIgwgAmpBDXcgCnMiDSAMakESdyALcyIOIAApAwAiAUIgiKciDyAAKQM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FLGyILQWBxIQ4gC0EBcSEPIAdBeGohECAHQXBqIREgB0FoaiESIAdBYGohEyAHQVhqIRQgB0FQaiEVIAdBSGohFiAHQUBqIRcgAa1Cf3whGCAEIAdqIRkgByAAQQh0IhpqIRsgACAKQYABamwhHCALQQRJIR1BACEeQQAhHwNAQQAoAoAIIiAgAyAfbGohIQJAIABFDQBBACEiAkAgHQ0AICAgHmohI0EAIQtBACEiA0AgByALaiIEICMgC2oiJCgCADYCACAEQQRqICRBBGooAgA2AgAgBEEIaiAkQQhqKAIANgIAIARBDGogJEEMaigCADYCACALQRBqIQsgDiAiQQRqIiJHDQALCyAPRQ0AIAcgIkECdCILaiAhIAtqKAIANgIACwJAIAFFDQBBACElIBwhIyAGISYDQCAFISQgACEiAkACQCAADQAgGyAXKQMANwMAIBsgFikDADcDCCAbIBUpAwA3AxAgGyAUKQMANwMYIBsgEykDADcDICAbIBIpAwA3AyggGyARKQMANwMwIBsgECkDADcDOAwBCwNAICQgJmoiCyAkIAxqIgQpAwA3AwAgC0EIaiAEQQhqKQMANwMAIAtBEGogBEEQaikDADcDACALQRhqIARBGGopAwA3AwAgC0EgaiAEQSBqKQMANwMAIAtBKGogBEEoaikDADcDACALQTBqIARBMGopAwA3AwAgC0E4aiAEQThqKQMANwMAIAtBwABqIARBwABqKQMANwMAIAtByABqIARByABqKQMANwMAIAtB0ABqIARB0ABqKQMANwMAIAtB2ABqIARB2ABqKQMANwMAIAtB4ABqIARB4ABqKQMANwMAIAtB6ABqIARB6ABqKQMANwMAIAtB8ABqIARB8ABqKQMANwMAIAtB+ABqIARB+ABqKQMANwMAICRBgAFqISQgIkF/aiIiDQALIAcgCCAbIAAQAiAFISQgACEiA0AgJCAjaiILICQgDWoiBCkDADcDACALQQhqIARBCGopAwA3AwAgC0EQaiAEQRBqKQMANwMAIAtBGGogBEEYaikDADcDACALQSBqIARBIGopAwA3AwAgC0EoaiAEQShqKQMANwMAIAtBMGogBEEwaikDADcDACALQThqIARBOGopAwA3AwAgC0HAAGogBEHAAGopAwA3AwAgC0HIAGogBEHIAGopAwA3AwAgC0HQAGogBEHQAGopAwA3AwAgC0HYAGogBEHYAGopAwA3AwAgC0HgAGogBEHgAGopAwA3AwAgC0HoAGogBEHoAGopAwA3AwAgC0HwAGogBEHwAGopAwA3AwAgC0H4AGogBEH4AGopAwA3AwAgJEGAAWohJCAiQX9qIiINAAsLIAggByAbIAAQAiAjIBpqISMgJiAaaiEmICVBAmoiJSABSQ0AC0EAISUDQAJAAkAgAA0AIBsgFykDADcDACAbIBYpAwA3AwggGyAVKQMANwMQIBsgFCkDADcDGCAbIBMpAwA3AyAgGyASKQMANwMoIBsgESkDADcDMCAbIBApAwA3AzgMAQsgACAKIBkpAgAgGIOnQQd0amwhJiAFISQgACEiA0AgJCAMaiILIAspAwAgJCAmaiIEKQMAhTcDACALQQhqIiMgIykDACAEQQhqKQMAhTcDACALQRBqIiMgIykDACAEQRBqKQMAhTcDACALQRhqIiMgIykDACAEQRhqKQMAhTcDACALQSBqIiMgIykDACAEQSBqKQMAhTcDACALQShqIiMgIykDACAEQShqKQMAhTcDACALQTBqIiMgIykDACAEQTBqKQMAhTcDACALQThqIiMgIykDACAEQThqKQMAhTcDACALQcAAaiIjICMpAwAgBEHAAGopAwCFNwMAIAtByABqIiMgIykDACAEQcgAaikDAIU3AwAgC0HQAGoiIyAjKQMAIARB0ABqKQMAhTcDACALQdgAaiIjICMpAwAgBEHYAGopAwCFNwMAIAtB4ABqIiMgIykDACAEQeAAaikDAIU3AwAgC0HoAGoiIyAjKQMAIARB6ABqKQMAhTcDACALQfAAaiIjICMpAwAgBEHwAGopAwCFNwMAIAtB+ABqIgsgCykDACAEQfgAaikDAIU3AwAgJEGAAWohJCAiQX9qIiINAAsgByAIIBsgABACIAAgCiAJKQIAIBiDp0EHdGpsISYgBSEkIAAhIgNAICQgDWoiCyALKQMAICQgJmoiBCkDAIU3AwAgC0EIaiIjICMpAwAgBEEIaikDAIU3AwAgC0EQaiIjICMpAwAgBEEQaikDAIU3AwAgC0EYaiIjICMpAwAgBEEYaikDAIU3AwAgC0EgaiIjICMpAwAgBEEgaikDAIU3AwAgC0EoaiIjICMpAwAgBEEoaikDAIU3AwAgC0EwaiIjICMpAwAgBEEwaikDAIU3AwAgC0E4aiIjICMpAwAgBEE4aikDAIU3AwAgC0HAAGoiIyAjKQMAIARBwABqKQMAhTcDACALQcgAaiIjICMpAwAgBEHIAGopAwCFNwMAIAtB0ABqIiMgIykDACAEQdAAaikDAIU3AwAgC0HYAGoiIyAjKQMAIARB2ABqKQMAhTcDACALQeAAaiIjICMpAwAgBEHgAGopAwCFNwMAIAtB6ABqIiMgIykDACAEQegAaikDAIU3AwAgC0HwAGoiIyAjKQMAIARB8ABqKQMAhTcDACALQfgAaiILIAspAwAgBEH4AGopAwCFNwMAICRBgAFqISQgIkF/aiIiDQALCyAIIAcgGyAAEAIgJUECaiIlIAFJDQALCwJAIABFDQBBACEiAkAgHQ0AICAgHmohI0EAIQtBACEiA0AgIyALaiIEIAcgC2oiJCgCADYCACAEQQRqICRBBGooAgA2AgAgBEEIaiAkQQhqKAIANgIAIARBDGogJEEMaigCADYCACALQRBqIQsgDiAiQQRqIiJHDQALCyAPRQ0AICEgIkECdCILaiAHIAtqKAIANgIACyAeIANqIR4gH0EBaiIfIAJHDQALCws=";
515
+ var hash$3 = "b32721f8";
516
+ var wasmJson$3 = {
517
+ name: name$3,
518
+ data: data$3,
519
+ hash: hash$3
102
520
  };
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;
521
+ function scryptInternal(options) {
522
+ return __awaiter(this, void 0, void 0, function* () {
523
+ const { costFactor, blockSize, parallelism, hashLength } = options;
524
+ const SHA256Hasher = createSHA256();
525
+ const blockData = yield pbkdf2({
526
+ password: options.password,
527
+ salt: options.salt,
528
+ iterations: 1,
529
+ hashLength: 128 * blockSize * parallelism,
530
+ hashFunction: SHA256Hasher,
531
+ outputType: "binary"
532
+ });
533
+ const scryptInterface = yield WASMInterface(wasmJson$3, 0);
534
+ const VSize = 128 * blockSize * costFactor;
535
+ const XYSize = 256 * blockSize;
536
+ scryptInterface.setMemorySize(blockData.length + VSize + XYSize);
537
+ scryptInterface.writeMemory(blockData, 0);
538
+ scryptInterface.getExports().scrypt(blockSize, costFactor, parallelism);
539
+ const expensiveSalt = scryptInterface.getMemory().subarray(0, 128 * blockSize * parallelism);
540
+ const outputData = yield pbkdf2({
541
+ password: options.password,
542
+ salt: expensiveSalt,
543
+ iterations: 1,
544
+ hashLength,
545
+ hashFunction: SHA256Hasher,
546
+ outputType: "binary"
547
+ });
548
+ if (options.outputType === "hex") {
549
+ const digestChars = new Uint8Array(hashLength * 2);
550
+ return getDigestHex(digestChars, outputData, hashLength);
551
+ }
552
+ return outputData;
553
+ });
110
554
  }
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);
555
+ var isPowerOfTwo = (v) => v && !(v & v - 1);
556
+ var validateOptions$1 = (options) => {
557
+ if (!options || typeof options !== "object") {
558
+ throw new Error("Invalid options parameter. It requires an object.");
136
559
  }
137
- update(buf) {
138
- aexists(this);
139
- this.iHash.update(buf);
140
- return this;
560
+ if (!Number.isInteger(options.blockSize) || options.blockSize < 1) {
561
+ throw new Error("Block size should be a positive number");
141
562
  }
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();
563
+ if (!Number.isInteger(options.costFactor) || options.costFactor < 2 || !isPowerOfTwo(options.costFactor)) {
564
+ throw new Error("Cost factor should be a power of 2, greater than 1");
150
565
  }
151
- digest() {
152
- const out = new Uint8Array(this.oHash.outputLen);
153
- this.digestInto(out);
154
- return out;
566
+ if (!Number.isInteger(options.parallelism) || options.parallelism < 1) {
567
+ throw new Error("Parallelism should be a positive number");
155
568
  }
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;
569
+ if (!Number.isInteger(options.hashLength) || options.hashLength < 1) {
570
+ throw new Error("Hash length should be a positive number.");
167
571
  }
168
- clone() {
169
- return this._cloneInto();
572
+ if (options.outputType === void 0) {
573
+ options.outputType = "hex";
170
574
  }
171
- destroy() {
172
- this.destroyed = true;
173
- this.oHash.destroy();
174
- this.iHash.destroy();
575
+ if (!["hex", "binary"].includes(options.outputType)) {
576
+ throw new Error(`Insupported output type ${options.outputType}. Valid values: ['hex', 'binary']`);
175
577
  }
176
578
  };
177
- var hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
178
- hmac.create = (hash, key) => new HMAC(hash, key);
579
+ function scrypt(options) {
580
+ return __awaiter(this, void 0, void 0, function* () {
581
+ validateOptions$1(options);
582
+ return scryptInternal(options);
583
+ });
584
+ }
585
+ var mutex$1 = new Mutex();
586
+ var mutex = new Mutex();
179
587
 
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 };
588
+ // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.6.7/node_modules/ox/_esm/core/version.js
589
+ var version = "0.1.1";
590
+
591
+ // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.6.7/node_modules/ox/_esm/core/internal/errors.js
592
+ function getVersion() {
593
+ return version;
196
594
  }
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
- }
595
+
596
+ // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.6.7/node_modules/ox/_esm/core/Errors.js
597
+ var BaseError = class _BaseError extends Error {
598
+ static setStaticOptions(options) {
599
+ _BaseError.prototype.docsOrigin = options.docsOrigin;
600
+ _BaseError.prototype.showVersion = options.showVersion;
601
+ _BaseError.prototype.version = options.version;
221
602
  }
222
- return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
603
+ constructor(shortMessage, options = {}) {
604
+ const details = (() => {
605
+ if (options.cause instanceof _BaseError) {
606
+ if (options.cause.details)
607
+ return options.cause.details;
608
+ if (options.cause.shortMessage)
609
+ return options.cause.shortMessage;
610
+ }
611
+ if (options.cause && "details" in options.cause && typeof options.cause.details === "string")
612
+ return options.cause.details;
613
+ if (options.cause?.message)
614
+ return options.cause.message;
615
+ return options.details;
616
+ })();
617
+ const docsPath = (() => {
618
+ if (options.cause instanceof _BaseError)
619
+ return options.cause.docsPath || options.docsPath;
620
+ return options.docsPath;
621
+ })();
622
+ const docsBaseUrl = options.docsOrigin ?? _BaseError.prototype.docsOrigin;
623
+ const docs = `${docsBaseUrl}${docsPath ?? ""}`;
624
+ const showVersion = Boolean(options.version ?? _BaseError.prototype.showVersion);
625
+ const version2 = options.version ?? _BaseError.prototype.version;
626
+ const message = [
627
+ shortMessage || "An error occurred.",
628
+ ...options.metaMessages ? ["", ...options.metaMessages] : [],
629
+ ...details || docsPath || showVersion ? [
630
+ "",
631
+ details ? `Details: ${details}` : void 0,
632
+ docsPath ? `See: ${docs}` : void 0,
633
+ showVersion ? `Version: ${version2}` : void 0
634
+ ] : []
635
+ ].filter((x) => typeof x === "string").join("\n");
636
+ super(message, options.cause ? { cause: options.cause } : void 0);
637
+ Object.defineProperty(this, "details", {
638
+ enumerable: true,
639
+ configurable: true,
640
+ writable: true,
641
+ value: void 0
642
+ });
643
+ Object.defineProperty(this, "docs", {
644
+ enumerable: true,
645
+ configurable: true,
646
+ writable: true,
647
+ value: void 0
648
+ });
649
+ Object.defineProperty(this, "docsOrigin", {
650
+ enumerable: true,
651
+ configurable: true,
652
+ writable: true,
653
+ value: void 0
654
+ });
655
+ Object.defineProperty(this, "docsPath", {
656
+ enumerable: true,
657
+ configurable: true,
658
+ writable: true,
659
+ value: void 0
660
+ });
661
+ Object.defineProperty(this, "shortMessage", {
662
+ enumerable: true,
663
+ configurable: true,
664
+ writable: true,
665
+ value: void 0
666
+ });
667
+ Object.defineProperty(this, "showVersion", {
668
+ enumerable: true,
669
+ configurable: true,
670
+ writable: true,
671
+ value: void 0
672
+ });
673
+ Object.defineProperty(this, "version", {
674
+ enumerable: true,
675
+ configurable: true,
676
+ writable: true,
677
+ value: void 0
678
+ });
679
+ Object.defineProperty(this, "cause", {
680
+ enumerable: true,
681
+ configurable: true,
682
+ writable: true,
683
+ value: void 0
684
+ });
685
+ Object.defineProperty(this, "name", {
686
+ enumerable: true,
687
+ configurable: true,
688
+ writable: true,
689
+ value: "BaseError"
690
+ });
691
+ this.cause = options.cause;
692
+ this.details = details;
693
+ this.docs = docs;
694
+ this.docsOrigin = docsBaseUrl;
695
+ this.docsPath = docsPath;
696
+ this.shortMessage = shortMessage;
697
+ this.showVersion = showVersion;
698
+ this.version = version2;
699
+ }
700
+ walk(fn) {
701
+ return walk(this, fn);
702
+ }
703
+ };
704
+ Object.defineProperty(BaseError, "defaultStaticOptions", {
705
+ enumerable: true,
706
+ configurable: true,
707
+ writable: true,
708
+ value: {
709
+ docsOrigin: "https://oxlib.sh",
710
+ showVersion: false,
711
+ version: `ox@${getVersion()}`
712
+ }
713
+ });
714
+ (() => {
715
+ BaseError.setStaticOptions(BaseError.defaultStaticOptions);
716
+ })();
717
+ function walk(err, fn) {
718
+ if (fn?.(err))
719
+ return err;
720
+ if (err && typeof err === "object" && "cause" in err && err.cause)
721
+ return walk(err.cause, fn);
722
+ return fn ? null : err;
223
723
  }
224
724
 
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);
725
+ // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.6.7/node_modules/ox/_esm/core/internal/bytes.js
726
+ var charCodeMap = {
727
+ zero: 48,
728
+ nine: 57,
729
+ A: 65,
730
+ F: 70,
731
+ a: 97,
732
+ f: 102
733
+ };
734
+ function charCodeToBase16(char) {
735
+ if (char >= charCodeMap.zero && char <= charCodeMap.nine)
736
+ return char - charCodeMap.zero;
737
+ if (char >= charCodeMap.A && char <= charCodeMap.F)
738
+ return char - (charCodeMap.A - 10);
739
+ if (char >= charCodeMap.a && char <= charCodeMap.f)
740
+ return char - (charCodeMap.a - 10);
741
+ return void 0;
237
742
  }
238
- function Chi(a, b, c) {
239
- return a & b ^ ~a & c;
743
+
744
+ // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.6.7/node_modules/ox/_esm/core/internal/hex.js
745
+ function assertSize(hex, size_) {
746
+ if (size(hex) > size_)
747
+ throw new SizeOverflowError({
748
+ givenSize: size(hex),
749
+ maxSize: size_
750
+ });
240
751
  }
241
- function Maj(a, b, c) {
242
- return a & b ^ a & c ^ b & c;
752
+ function pad(hex_, options = {}) {
753
+ const { dir, size: size2 = 32 } = options;
754
+ if (size2 === 0)
755
+ return hex_;
756
+ const hex = hex_.replace("0x", "");
757
+ if (hex.length > size2 * 2)
758
+ throw new SizeExceedsPaddingSizeError({
759
+ size: Math.ceil(hex.length / 2),
760
+ targetSize: size2,
761
+ type: "Hex"
762
+ });
763
+ return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size2 * 2, "0")}`;
243
764
  }
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;
765
+
766
+ // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.6.7/node_modules/ox/_esm/core/Hex.js
767
+ var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
768
+ function fromBytes(value, options = {}) {
769
+ let string = "";
770
+ for (let i = 0; i < value.length; i++)
771
+ string += hexes[value[i]];
772
+ const hex = `0x${string}`;
773
+ if (typeof options.size === "number") {
774
+ assertSize(hex, options.size);
775
+ return padRight(hex, options.size);
283
776
  }
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;
777
+ return hex;
778
+ }
779
+ function padRight(value, size2) {
780
+ return pad(value, { dir: "right", size: size2 });
781
+ }
782
+ function size(value) {
783
+ return Math.ceil((value.length - 2) / 2);
784
+ }
785
+ var SizeOverflowError = class extends BaseError {
786
+ constructor({ givenSize, maxSize }) {
787
+ super(`Size cannot exceed \`${maxSize}\` bytes. Given size: \`${givenSize}\` bytes.`);
788
+ Object.defineProperty(this, "name", {
789
+ enumerable: true,
790
+ configurable: true,
791
+ writable: true,
792
+ value: "Hex.SizeOverflowError"
793
+ });
329
794
  }
330
- clone() {
331
- return this._cloneInto();
795
+ };
796
+ var SizeExceedsPaddingSizeError = class extends BaseError {
797
+ constructor({ size: size2, targetSize, type }) {
798
+ super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (\`${size2}\`) exceeds padding size (\`${targetSize}\`).`);
799
+ Object.defineProperty(this, "name", {
800
+ enumerable: true,
801
+ configurable: true,
802
+ writable: true,
803
+ value: "Hex.SizeExceedsPaddingSizeError"
804
+ });
332
805
  }
333
806
  };
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
807
 
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;
808
+ // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.6.7/node_modules/ox/_esm/core/Bytes.js
809
+ function from(value) {
810
+ if (value instanceof Uint8Array)
811
+ return value;
812
+ if (typeof value === "string")
813
+ return fromHex(value);
814
+ return fromArray(value);
815
+ }
816
+ function fromArray(value) {
817
+ return value instanceof Uint8Array ? value : new Uint8Array(value);
818
+ }
819
+ function fromHex(value, options = {}) {
820
+ const { size: size2 } = options;
821
+ let hex = value;
822
+ if (size2) {
823
+ assertSize(value, size2);
824
+ hex = padRight(value, size2);
439
825
  }
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;
826
+ let hexString = hex.slice(2);
827
+ if (hexString.length % 2)
828
+ hexString = `0${hexString}`;
829
+ const length = hexString.length / 2;
830
+ const bytes = new Uint8Array(length);
831
+ for (let index = 0, j = 0; index < length; index++) {
832
+ const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
833
+ const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
834
+ if (nibbleLeft === void 0 || nibbleRight === void 0) {
835
+ throw new BaseError(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
464
836
  }
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);
837
+ bytes[index] = nibbleLeft << 4 | nibbleRight;
481
838
  }
482
- };
483
- var sha256 = /* @__PURE__ */ createHasher(() => new SHA256());
839
+ return bytes;
840
+ }
841
+ function random(length) {
842
+ return crypto.getRandomValues(new Uint8Array(length));
843
+ }
844
+ function toHex(value, options = {}) {
845
+ return fromBytes(value, options);
846
+ }
484
847
 
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;
848
+ // node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/utils.js
849
+ function isBytes(a) {
850
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
546
851
  }
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
- }
852
+ function anumber(n) {
853
+ if (!Number.isSafeInteger(n) || n < 0)
854
+ throw new Error("positive integer expected, got " + n);
558
855
  }
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)");
856
+ function abytes(b, ...lengths) {
857
+ if (!isBytes(b))
858
+ throw new Error("Uint8Array expected");
859
+ if (lengths.length > 0 && !lengths.includes(b.length))
860
+ throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
861
+ }
862
+ function ahash(h) {
863
+ if (typeof h !== "function" || typeof h.create !== "function")
864
+ throw new Error("Hash should be wrapped by utils.createHasher");
865
+ anumber(h.outputLen);
866
+ anumber(h.blockLen);
867
+ }
868
+ function aexists(instance, checkFinished = true) {
869
+ if (instance.destroyed)
870
+ throw new Error("Hash instance has been destroyed");
871
+ if (checkFinished && instance.finished)
872
+ throw new Error("Hash#digest() has already been called");
873
+ }
874
+ function aoutput(out, instance) {
875
+ abytes(out);
876
+ const min = instance.outputLen;
877
+ if (out.length < min) {
878
+ throw new Error("digestInto() expects output buffer of length at least " + min);
582
879
  }
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");
880
+ }
881
+ function u32(arr) {
882
+ return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
883
+ }
884
+ function clean(...arrays) {
885
+ for (let i = 0; i < arrays.length; i++) {
886
+ arrays[i].fill(0);
585
887
  }
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);
888
+ }
889
+ function createView(arr) {
890
+ return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
891
+ }
892
+ function rotr(word, shift) {
893
+ return word << 32 - shift | word >>> shift;
894
+ }
895
+ function rotl(word, shift) {
896
+ return word << shift | word >>> 32 - shift >>> 0;
897
+ }
898
+ var isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
899
+ function byteSwap(word) {
900
+ return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
901
+ }
902
+ function byteSwap32(arr) {
903
+ for (let i = 0; i < arr.length; i++) {
904
+ arr[i] = byteSwap(arr[i]);
589
905
  }
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
- };
906
+ return arr;
907
+ }
908
+ var swap32IfBE = isLE ? (u) => u : byteSwap32;
909
+ var nextTick = async () => {
910
+ };
911
+ async function asyncLoop(iters, tick, cb) {
912
+ let ts = Date.now();
913
+ for (let i = 0; i < iters; i++) {
914
+ cb(i);
915
+ const diff = Date.now() - ts;
916
+ if (diff >= 0 && diff < tick)
917
+ continue;
918
+ await nextTick();
919
+ ts += diff;
605
920
  }
606
- return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick };
607
921
  }
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;
922
+ function utf8ToBytes(str) {
923
+ if (typeof str !== "string")
924
+ throw new Error("string expected");
925
+ return new Uint8Array(new TextEncoder().encode(str));
612
926
  }
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);
927
+ function toBytes(data) {
928
+ if (typeof data === "string")
929
+ data = utf8ToBytes(data);
930
+ abytes(data);
931
+ return data;
637
932
  }
638
-
639
- // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.6.7/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.6.7/node_modules/ox/_esm/core/internal/errors.js
643
- function getVersion() {
644
- return version;
933
+ function kdfInputToBytes(data) {
934
+ if (typeof data === "string")
935
+ data = utf8ToBytes(data);
936
+ abytes(data);
937
+ return data;
938
+ }
939
+ function checkOpts(defaults, opts) {
940
+ if (opts !== void 0 && {}.toString.call(opts) !== "[object Object]")
941
+ throw new Error("options should be object or undefined");
942
+ const merged = Object.assign(defaults, opts);
943
+ return merged;
944
+ }
945
+ var Hash = class {
946
+ };
947
+ function createHasher(hashCons) {
948
+ const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
949
+ const tmp = hashCons();
950
+ hashC.outputLen = tmp.outputLen;
951
+ hashC.blockLen = tmp.blockLen;
952
+ hashC.create = () => hashCons();
953
+ return hashC;
645
954
  }
646
955
 
647
- // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.6.7/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;
956
+ // node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/hmac.js
957
+ var HMAC = class extends Hash {
958
+ constructor(hash, _key) {
959
+ super();
960
+ this.finished = false;
961
+ this.destroyed = false;
962
+ ahash(hash);
963
+ const key = toBytes(_key);
964
+ this.iHash = hash.create();
965
+ if (typeof this.iHash.update !== "function")
966
+ throw new Error("Expected instance of class which extends utils.Hash");
967
+ this.blockLen = this.iHash.blockLen;
968
+ this.outputLen = this.iHash.outputLen;
969
+ const blockLen = this.blockLen;
970
+ const pad3 = new Uint8Array(blockLen);
971
+ pad3.set(key.length > blockLen ? hash.create().update(key).digest() : key);
972
+ for (let i = 0; i < pad3.length; i++)
973
+ pad3[i] ^= 54;
974
+ this.iHash.update(pad3);
975
+ this.oHash = hash.create();
976
+ for (let i = 0; i < pad3.length; i++)
977
+ pad3[i] ^= 54 ^ 92;
978
+ this.oHash.update(pad3);
979
+ clean(pad3);
750
980
  }
751
- walk(fn) {
752
- return walk(this, fn);
981
+ update(buf) {
982
+ aexists(this);
983
+ this.iHash.update(buf);
984
+ return this;
985
+ }
986
+ digestInto(out) {
987
+ aexists(this);
988
+ abytes(out, this.outputLen);
989
+ this.finished = true;
990
+ this.iHash.digestInto(out);
991
+ this.oHash.update(out);
992
+ this.oHash.digestInto(out);
993
+ this.destroy();
994
+ }
995
+ digest() {
996
+ const out = new Uint8Array(this.oHash.outputLen);
997
+ this.digestInto(out);
998
+ return out;
999
+ }
1000
+ _cloneInto(to) {
1001
+ to || (to = Object.create(Object.getPrototypeOf(this), {}));
1002
+ const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
1003
+ to = to;
1004
+ to.finished = finished;
1005
+ to.destroyed = destroyed;
1006
+ to.blockLen = blockLen;
1007
+ to.outputLen = outputLen;
1008
+ to.oHash = oHash._cloneInto(to.oHash);
1009
+ to.iHash = iHash._cloneInto(to.iHash);
1010
+ return to;
1011
+ }
1012
+ clone() {
1013
+ return this._cloneInto();
1014
+ }
1015
+ destroy() {
1016
+ this.destroyed = true;
1017
+ this.oHash.destroy();
1018
+ this.iHash.destroy();
753
1019
  }
754
1020
  };
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()}`
1021
+ var hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
1022
+ hmac.create = (hash, key) => new HMAC(hash, key);
1023
+
1024
+ // node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/pbkdf2.js
1025
+ function pbkdf2Init(hash, _password, _salt, _opts) {
1026
+ ahash(hash);
1027
+ const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);
1028
+ const { c, dkLen, asyncTick } = opts;
1029
+ anumber(c);
1030
+ anumber(dkLen);
1031
+ anumber(asyncTick);
1032
+ if (c < 1)
1033
+ throw new Error("iterations (c) should be >= 1");
1034
+ const password = kdfInputToBytes(_password);
1035
+ const salt = kdfInputToBytes(_salt);
1036
+ const DK = new Uint8Array(dkLen);
1037
+ const PRF = hmac.create(hash, password);
1038
+ const PRFSalt = PRF._cloneInto().update(salt);
1039
+ return { c, dkLen, asyncTick, DK, PRF, PRFSalt };
1040
+ }
1041
+ function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) {
1042
+ PRF.destroy();
1043
+ PRFSalt.destroy();
1044
+ if (prfW)
1045
+ prfW.destroy();
1046
+ clean(u);
1047
+ return DK;
1048
+ }
1049
+ function pbkdf22(hash, password, salt, opts) {
1050
+ const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);
1051
+ let prfW;
1052
+ const arr = new Uint8Array(4);
1053
+ const view = createView(arr);
1054
+ const u = new Uint8Array(PRF.outputLen);
1055
+ for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {
1056
+ const Ti = DK.subarray(pos, pos + PRF.outputLen);
1057
+ view.setInt32(0, ti, false);
1058
+ (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
1059
+ Ti.set(u.subarray(0, Ti.length));
1060
+ for (let ui = 1; ui < c; ui++) {
1061
+ PRF._cloneInto(prfW).update(u).digestInto(u);
1062
+ for (let i = 0; i < Ti.length; i++)
1063
+ Ti[i] ^= u[i];
1064
+ }
763
1065
  }
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;
1066
+ return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
774
1067
  }
775
1068
 
776
- // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.6.7/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;
1069
+ // node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/_md.js
1070
+ function setBigUint64(view, byteOffset, value, isLE2) {
1071
+ if (typeof view.setBigUint64 === "function")
1072
+ return view.setBigUint64(byteOffset, value, isLE2);
1073
+ const _32n = BigInt(32);
1074
+ const _u32_max = BigInt(4294967295);
1075
+ const wh = Number(value >> _32n & _u32_max);
1076
+ const wl = Number(value & _u32_max);
1077
+ const h = isLE2 ? 4 : 0;
1078
+ const l = isLE2 ? 0 : 4;
1079
+ view.setUint32(byteOffset + h, wh, isLE2);
1080
+ view.setUint32(byteOffset + l, wl, isLE2);
793
1081
  }
794
-
795
- // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.6.7/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
- });
1082
+ function Chi(a, b, c) {
1083
+ return a & b ^ ~a & c;
802
1084
  }
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")}`;
1085
+ function Maj(a, b, c) {
1086
+ return a & b ^ a & c ^ b & c;
815
1087
  }
1088
+ var HashMD = class extends Hash {
1089
+ constructor(blockLen, outputLen, padOffset, isLE2) {
1090
+ super();
1091
+ this.finished = false;
1092
+ this.length = 0;
1093
+ this.pos = 0;
1094
+ this.destroyed = false;
1095
+ this.blockLen = blockLen;
1096
+ this.outputLen = outputLen;
1097
+ this.padOffset = padOffset;
1098
+ this.isLE = isLE2;
1099
+ this.buffer = new Uint8Array(blockLen);
1100
+ this.view = createView(this.buffer);
1101
+ }
1102
+ update(data) {
1103
+ aexists(this);
1104
+ data = toBytes(data);
1105
+ abytes(data);
1106
+ const { view, buffer, blockLen } = this;
1107
+ const len = data.length;
1108
+ for (let pos = 0; pos < len; ) {
1109
+ const take = Math.min(blockLen - this.pos, len - pos);
1110
+ if (take === blockLen) {
1111
+ const dataView = createView(data);
1112
+ for (; blockLen <= len - pos; pos += blockLen)
1113
+ this.process(dataView, pos);
1114
+ continue;
1115
+ }
1116
+ buffer.set(data.subarray(pos, pos + take), this.pos);
1117
+ this.pos += take;
1118
+ pos += take;
1119
+ if (this.pos === blockLen) {
1120
+ this.process(view, 0);
1121
+ this.pos = 0;
1122
+ }
1123
+ }
1124
+ this.length += data.length;
1125
+ this.roundClean();
1126
+ return this;
1127
+ }
1128
+ digestInto(out) {
1129
+ aexists(this);
1130
+ aoutput(out, this);
1131
+ this.finished = true;
1132
+ const { buffer, view, blockLen, isLE: isLE2 } = this;
1133
+ let { pos } = this;
1134
+ buffer[pos++] = 128;
1135
+ clean(this.buffer.subarray(pos));
1136
+ if (this.padOffset > blockLen - pos) {
1137
+ this.process(view, 0);
1138
+ pos = 0;
1139
+ }
1140
+ for (let i = pos; i < blockLen; i++)
1141
+ buffer[i] = 0;
1142
+ setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2);
1143
+ this.process(view, 0);
1144
+ const oview = createView(out);
1145
+ const len = this.outputLen;
1146
+ if (len % 4)
1147
+ throw new Error("_sha2: outputLen should be aligned to 32bit");
1148
+ const outLen = len / 4;
1149
+ const state = this.get();
1150
+ if (outLen > state.length)
1151
+ throw new Error("_sha2: outputLen bigger than state");
1152
+ for (let i = 0; i < outLen; i++)
1153
+ oview.setUint32(4 * i, state[i], isLE2);
1154
+ }
1155
+ digest() {
1156
+ const { buffer, outputLen } = this;
1157
+ this.digestInto(buffer);
1158
+ const res = buffer.slice(0, outputLen);
1159
+ this.destroy();
1160
+ return res;
1161
+ }
1162
+ _cloneInto(to) {
1163
+ to || (to = new this.constructor());
1164
+ to.set(...this.get());
1165
+ const { blockLen, buffer, length, finished, destroyed, pos } = this;
1166
+ to.destroyed = destroyed;
1167
+ to.finished = finished;
1168
+ to.length = length;
1169
+ to.pos = pos;
1170
+ if (length % blockLen)
1171
+ to.buffer.set(buffer);
1172
+ return to;
1173
+ }
1174
+ clone() {
1175
+ return this._cloneInto();
1176
+ }
1177
+ };
1178
+ var SHA256_IV = /* @__PURE__ */ Uint32Array.from([
1179
+ 1779033703,
1180
+ 3144134277,
1181
+ 1013904242,
1182
+ 2773480762,
1183
+ 1359893119,
1184
+ 2600822924,
1185
+ 528734635,
1186
+ 1541459225
1187
+ ]);
816
1188
 
817
- // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.6.7/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);
1189
+ // node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/sha2.js
1190
+ var SHA256_K = /* @__PURE__ */ Uint32Array.from([
1191
+ 1116352408,
1192
+ 1899447441,
1193
+ 3049323471,
1194
+ 3921009573,
1195
+ 961987163,
1196
+ 1508970993,
1197
+ 2453635748,
1198
+ 2870763221,
1199
+ 3624381080,
1200
+ 310598401,
1201
+ 607225278,
1202
+ 1426881987,
1203
+ 1925078388,
1204
+ 2162078206,
1205
+ 2614888103,
1206
+ 3248222580,
1207
+ 3835390401,
1208
+ 4022224774,
1209
+ 264347078,
1210
+ 604807628,
1211
+ 770255983,
1212
+ 1249150122,
1213
+ 1555081692,
1214
+ 1996064986,
1215
+ 2554220882,
1216
+ 2821834349,
1217
+ 2952996808,
1218
+ 3210313671,
1219
+ 3336571891,
1220
+ 3584528711,
1221
+ 113926993,
1222
+ 338241895,
1223
+ 666307205,
1224
+ 773529912,
1225
+ 1294757372,
1226
+ 1396182291,
1227
+ 1695183700,
1228
+ 1986661051,
1229
+ 2177026350,
1230
+ 2456956037,
1231
+ 2730485921,
1232
+ 2820302411,
1233
+ 3259730800,
1234
+ 3345764771,
1235
+ 3516065817,
1236
+ 3600352804,
1237
+ 4094571909,
1238
+ 275423344,
1239
+ 430227734,
1240
+ 506948616,
1241
+ 659060556,
1242
+ 883997877,
1243
+ 958139571,
1244
+ 1322822218,
1245
+ 1537002063,
1246
+ 1747873779,
1247
+ 1955562222,
1248
+ 2024104815,
1249
+ 2227730452,
1250
+ 2361852424,
1251
+ 2428436474,
1252
+ 2756734187,
1253
+ 3204031479,
1254
+ 3329325298
1255
+ ]);
1256
+ var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
1257
+ var SHA256 = class extends HashMD {
1258
+ constructor(outputLen = 32) {
1259
+ super(64, outputLen, 8, false);
1260
+ this.A = SHA256_IV[0] | 0;
1261
+ this.B = SHA256_IV[1] | 0;
1262
+ this.C = SHA256_IV[2] | 0;
1263
+ this.D = SHA256_IV[3] | 0;
1264
+ this.E = SHA256_IV[4] | 0;
1265
+ this.F = SHA256_IV[5] | 0;
1266
+ this.G = SHA256_IV[6] | 0;
1267
+ this.H = SHA256_IV[7] | 0;
1268
+ }
1269
+ get() {
1270
+ const { A, B, C, D, E, F, G, H } = this;
1271
+ return [A, B, C, D, E, F, G, H];
1272
+ }
1273
+ // prettier-ignore
1274
+ set(A, B, C, D, E, F, G, H) {
1275
+ this.A = A | 0;
1276
+ this.B = B | 0;
1277
+ this.C = C | 0;
1278
+ this.D = D | 0;
1279
+ this.E = E | 0;
1280
+ this.F = F | 0;
1281
+ this.G = G | 0;
1282
+ this.H = H | 0;
827
1283
  }
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
- });
1284
+ process(view, offset) {
1285
+ for (let i = 0; i < 16; i++, offset += 4)
1286
+ SHA256_W[i] = view.getUint32(offset, false);
1287
+ for (let i = 16; i < 64; i++) {
1288
+ const W15 = SHA256_W[i - 15];
1289
+ const W2 = SHA256_W[i - 2];
1290
+ const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
1291
+ const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
1292
+ SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
1293
+ }
1294
+ let { A, B, C, D, E, F, G, H } = this;
1295
+ for (let i = 0; i < 64; i++) {
1296
+ const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
1297
+ const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
1298
+ const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
1299
+ const T2 = sigma0 + Maj(A, B, C) | 0;
1300
+ H = G;
1301
+ G = F;
1302
+ F = E;
1303
+ E = D + T1 | 0;
1304
+ D = C;
1305
+ C = B;
1306
+ B = A;
1307
+ A = T1 + T2 | 0;
1308
+ }
1309
+ A = A + this.A | 0;
1310
+ B = B + this.B | 0;
1311
+ C = C + this.C | 0;
1312
+ D = D + this.D | 0;
1313
+ E = E + this.E | 0;
1314
+ F = F + this.F | 0;
1315
+ G = G + this.G | 0;
1316
+ H = H + this.H | 0;
1317
+ this.set(A, B, C, D, E, F, G, H);
845
1318
  }
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
- });
1319
+ roundClean() {
1320
+ clean(SHA256_W);
1321
+ }
1322
+ destroy() {
1323
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
1324
+ clean(this.buffer);
856
1325
  }
857
1326
  };
1327
+ var sha256 = /* @__PURE__ */ createHasher(() => new SHA256());
858
1328
 
859
- // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.6.7/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);
1329
+ // node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/scrypt.js
1330
+ function XorAndSalsa(prev, pi, input, ii, out, oi) {
1331
+ let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++];
1332
+ let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++];
1333
+ let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++];
1334
+ let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++];
1335
+ let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++];
1336
+ let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++];
1337
+ let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++];
1338
+ let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++];
1339
+ 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;
1340
+ for (let i = 0; i < 8; i += 2) {
1341
+ x04 ^= rotl(x00 + x12 | 0, 7);
1342
+ x08 ^= rotl(x04 + x00 | 0, 9);
1343
+ x12 ^= rotl(x08 + x04 | 0, 13);
1344
+ x00 ^= rotl(x12 + x08 | 0, 18);
1345
+ x09 ^= rotl(x05 + x01 | 0, 7);
1346
+ x13 ^= rotl(x09 + x05 | 0, 9);
1347
+ x01 ^= rotl(x13 + x09 | 0, 13);
1348
+ x05 ^= rotl(x01 + x13 | 0, 18);
1349
+ x14 ^= rotl(x10 + x06 | 0, 7);
1350
+ x02 ^= rotl(x14 + x10 | 0, 9);
1351
+ x06 ^= rotl(x02 + x14 | 0, 13);
1352
+ x10 ^= rotl(x06 + x02 | 0, 18);
1353
+ x03 ^= rotl(x15 + x11 | 0, 7);
1354
+ x07 ^= rotl(x03 + x15 | 0, 9);
1355
+ x11 ^= rotl(x07 + x03 | 0, 13);
1356
+ x15 ^= rotl(x11 + x07 | 0, 18);
1357
+ x01 ^= rotl(x00 + x03 | 0, 7);
1358
+ x02 ^= rotl(x01 + x00 | 0, 9);
1359
+ x03 ^= rotl(x02 + x01 | 0, 13);
1360
+ x00 ^= rotl(x03 + x02 | 0, 18);
1361
+ x06 ^= rotl(x05 + x04 | 0, 7);
1362
+ x07 ^= rotl(x06 + x05 | 0, 9);
1363
+ x04 ^= rotl(x07 + x06 | 0, 13);
1364
+ x05 ^= rotl(x04 + x07 | 0, 18);
1365
+ x11 ^= rotl(x10 + x09 | 0, 7);
1366
+ x08 ^= rotl(x11 + x10 | 0, 9);
1367
+ x09 ^= rotl(x08 + x11 | 0, 13);
1368
+ x10 ^= rotl(x09 + x08 | 0, 18);
1369
+ x12 ^= rotl(x15 + x14 | 0, 7);
1370
+ x13 ^= rotl(x12 + x15 | 0, 9);
1371
+ x14 ^= rotl(x13 + x12 | 0, 13);
1372
+ x15 ^= rotl(x14 + x13 | 0, 18);
1373
+ }
1374
+ out[oi++] = y00 + x00 | 0;
1375
+ out[oi++] = y01 + x01 | 0;
1376
+ out[oi++] = y02 + x02 | 0;
1377
+ out[oi++] = y03 + x03 | 0;
1378
+ out[oi++] = y04 + x04 | 0;
1379
+ out[oi++] = y05 + x05 | 0;
1380
+ out[oi++] = y06 + x06 | 0;
1381
+ out[oi++] = y07 + x07 | 0;
1382
+ out[oi++] = y08 + x08 | 0;
1383
+ out[oi++] = y09 + x09 | 0;
1384
+ out[oi++] = y10 + x10 | 0;
1385
+ out[oi++] = y11 + x11 | 0;
1386
+ out[oi++] = y12 + x12 | 0;
1387
+ out[oi++] = y13 + x13 | 0;
1388
+ out[oi++] = y14 + x14 | 0;
1389
+ out[oi++] = y15 + x15 | 0;
866
1390
  }
867
- function fromArray(value) {
868
- return value instanceof Uint8Array ? value : new Uint8Array(value);
1391
+ function BlockMix(input, ii, out, oi, r) {
1392
+ let head = oi + 0;
1393
+ let tail = oi + 16 * r;
1394
+ for (let i = 0; i < 16; i++)
1395
+ out[tail + i] = input[ii + (2 * r - 1) * 16 + i];
1396
+ for (let i = 0; i < r; i++, head += 16, ii += 16) {
1397
+ XorAndSalsa(out, tail, input, ii, out, head);
1398
+ if (i > 0)
1399
+ tail += 16;
1400
+ XorAndSalsa(out, head, input, ii += 16, out, tail);
1401
+ }
869
1402
  }
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);
1403
+ function scryptInit(password, salt, _opts) {
1404
+ const opts = checkOpts({
1405
+ dkLen: 32,
1406
+ asyncTick: 10,
1407
+ maxmem: 1024 ** 3 + 1024
1408
+ }, _opts);
1409
+ const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts;
1410
+ anumber(N);
1411
+ anumber(r);
1412
+ anumber(p);
1413
+ anumber(dkLen);
1414
+ anumber(asyncTick);
1415
+ anumber(maxmem);
1416
+ if (onProgress !== void 0 && typeof onProgress !== "function")
1417
+ throw new Error("progressCb should be function");
1418
+ const blockSize = 128 * r;
1419
+ const blockSize32 = blockSize / 4;
1420
+ const pow32 = Math.pow(2, 32);
1421
+ if (N <= 1 || (N & N - 1) !== 0 || N > pow32) {
1422
+ throw new Error("Scrypt: N must be larger than 1, a power of 2, and less than 2^32");
876
1423
  }
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;
1424
+ if (p < 0 || p > (pow32 - 1) * 32 / blockSize) {
1425
+ throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");
889
1426
  }
890
- return bytes;
1427
+ if (dkLen < 0 || dkLen > (pow32 - 1) * 32) {
1428
+ throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");
1429
+ }
1430
+ const memUsed = blockSize * (N + p);
1431
+ if (memUsed > maxmem) {
1432
+ throw new Error("Scrypt: memused is bigger than maxMem. Expected 128 * r * (N + p) > maxmem of " + maxmem);
1433
+ }
1434
+ const B = pbkdf22(sha256, password, salt, { c: 1, dkLen: blockSize * p });
1435
+ const B32 = u32(B);
1436
+ const V = u32(new Uint8Array(blockSize * N));
1437
+ const tmp = u32(new Uint8Array(blockSize));
1438
+ let blockMixCb = () => {
1439
+ };
1440
+ if (onProgress) {
1441
+ const totalBlockMix = 2 * N * p;
1442
+ const callbackPer = Math.max(Math.floor(totalBlockMix / 1e4), 1);
1443
+ let blockMixCnt = 0;
1444
+ blockMixCb = () => {
1445
+ blockMixCnt++;
1446
+ if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix))
1447
+ onProgress(blockMixCnt / totalBlockMix);
1448
+ };
1449
+ }
1450
+ return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick };
891
1451
  }
892
- function random(length) {
893
- return crypto.getRandomValues(new Uint8Array(length));
1452
+ function scryptOutput(password, dkLen, B, V, tmp) {
1453
+ const res = pbkdf22(sha256, password, B, { c: 1, dkLen });
1454
+ clean(B, V, tmp);
1455
+ return res;
894
1456
  }
895
- function toHex(value, options = {}) {
896
- return fromBytes(value, options);
1457
+ async function scryptAsync(password, salt, opts) {
1458
+ const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts);
1459
+ swap32IfBE(B32);
1460
+ for (let pi = 0; pi < p; pi++) {
1461
+ const Pi = blockSize32 * pi;
1462
+ for (let i = 0; i < blockSize32; i++)
1463
+ V[i] = B32[Pi + i];
1464
+ let pos = 0;
1465
+ await asyncLoop(N - 1, asyncTick, () => {
1466
+ BlockMix(V, pos, V, pos += blockSize32, r);
1467
+ blockMixCb();
1468
+ });
1469
+ BlockMix(V, (N - 1) * blockSize32, B32, Pi, r);
1470
+ blockMixCb();
1471
+ await asyncLoop(N, asyncTick, () => {
1472
+ const j = B32[Pi + blockSize32 - 16] % N;
1473
+ for (let k = 0; k < blockSize32; k++)
1474
+ tmp[k] = B32[Pi + k] ^ V[j * blockSize32 + k];
1475
+ BlockMix(tmp, 0, B32, Pi, r);
1476
+ blockMixCb();
1477
+ });
1478
+ }
1479
+ swap32IfBE(B32);
1480
+ return scryptOutput(password, dkLen, B, V, tmp);
897
1481
  }
898
1482
 
899
1483
  // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.6.7/node_modules/ox/_esm/core/Keystore.js
900
- function pbkdf22(options) {
1484
+ function pbkdf23(options) {
901
1485
  const { iv, iterations = 262144, password } = options;
902
1486
  const salt = options.salt ? from(options.salt) : random(32);
903
- const key = toHex(pbkdf2(sha256, password, salt, { c: iterations, dkLen: 32 }));
1487
+ const key = toHex(pbkdf22(sha256, password, salt, { c: iterations, dkLen: 32 }));
904
1488
  return defineKey(() => key, {
905
1489
  iv,
906
1490
  kdfparams: {
@@ -948,7 +1532,7 @@ async function toKeyAsync(keystore, options) {
948
1532
  password
949
1533
  });
950
1534
  case "pbkdf2":
951
- return await pbkdf22({
1535
+ return await pbkdf23({
952
1536
  iv: from(`0x${iv}`),
953
1537
  iterations: c,
954
1538
  password,
@@ -967,7 +1551,31 @@ function defineKey(key, options) {
967
1551
 
968
1552
  // src/lib/wallet/keystore-kdf-worker.ts
969
1553
  try {
970
- const key = await toKeyAsync(workerData.keystore, { password: workerData.password });
1554
+ const keystore = workerData.keystore;
1555
+ const params = keystore.crypto.kdfparams;
1556
+ const n = "n" in params ? params.n : 0;
1557
+ let key;
1558
+ if (keystore.crypto.kdf === "scrypt" && "r" in params && params.r === 1 && "p" in params && params.p === 8 && params.dklen === 32 && Number.isSafeInteger(n) && n >= 2 && n <= 262144 && (n & n - 1) === 0) {
1559
+ from(`0x${keystore.crypto.cipherparams.iv}`);
1560
+ const salt = from(`0x${params.salt}`);
1561
+ try {
1562
+ const derived = await scrypt({
1563
+ password: workerData.password,
1564
+ salt,
1565
+ costFactor: n,
1566
+ blockSize: 1,
1567
+ parallelism: 8,
1568
+ hashLength: 32,
1569
+ outputType: "binary"
1570
+ });
1571
+ key = toHex(derived);
1572
+ derived.fill(0);
1573
+ } catch {
1574
+ key = await toKeyAsync(keystore, { password: workerData.password });
1575
+ }
1576
+ } else {
1577
+ key = await toKeyAsync(keystore, { password: workerData.password });
1578
+ }
971
1579
  parentPort?.postMessage({ key: typeof key === "function" ? key() : key });
972
1580
  } catch {
973
1581
  parentPort?.postMessage({ error: "Keystore derivation failed." });
@@ -975,6 +1583,13 @@ try {
975
1583
  parentPort?.close();
976
1584
  /*! Bundled license information:
977
1585
 
1586
+ hash-wasm/dist/index.esm.js:
1587
+ (*!
1588
+ * hash-wasm (https://www.npmjs.com/package/hash-wasm)
1589
+ * (c) Dani Biro
1590
+ * @license MIT
1591
+ *)
1592
+
978
1593
  @noble/hashes/esm/utils.js:
979
1594
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
980
1595
  */