@cedros/login-react 0.0.12 → 0.0.14

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 (435) hide show
  1. package/README.md +68 -0
  2. package/dist/AdminDepositList-CyT4VBH8.js +311 -0
  3. package/dist/AdminDepositList-CyT4VBH8.js.map +1 -0
  4. package/dist/AdminDepositList-b2AXtLg0.cjs +1 -0
  5. package/dist/AdminDepositList-b2AXtLg0.cjs.map +1 -0
  6. package/dist/AdminWithdrawalHistory-Cud-yuWy.js +916 -0
  7. package/dist/AdminWithdrawalHistory-Cud-yuWy.js.map +1 -0
  8. package/dist/AdminWithdrawalHistory-DL9zbu2b.cjs +1 -0
  9. package/dist/AdminWithdrawalHistory-DL9zbu2b.cjs.map +1 -0
  10. package/dist/AuthenticationSettings-D739nNul.cjs +1 -0
  11. package/dist/AuthenticationSettings-D739nNul.cjs.map +1 -0
  12. package/dist/AuthenticationSettings-DtLoxQ2z.cjs +1 -0
  13. package/dist/AuthenticationSettings-DtLoxQ2z.cjs.map +1 -0
  14. package/dist/AuthenticationSettings-Dx3JCI3m.js +9 -0
  15. package/dist/AuthenticationSettings-Dx3JCI3m.js.map +1 -0
  16. package/dist/AuthenticationSettings-vowmQPXz.js +525 -0
  17. package/dist/AuthenticationSettings-vowmQPXz.js.map +1 -0
  18. package/dist/AutosaveStatus-CCrZszKA.cjs +1 -0
  19. package/dist/AutosaveStatus-CCrZszKA.cjs.map +1 -0
  20. package/dist/AutosaveStatus-Ciyt350A.js +1497 -0
  21. package/dist/AutosaveStatus-Ciyt350A.js.map +1 -0
  22. package/dist/CreditSystemSettings-BQ3h4CyM.js +210 -0
  23. package/dist/CreditSystemSettings-BQ3h4CyM.js.map +1 -0
  24. package/dist/CreditSystemSettings-C6dUsu72.cjs +1 -0
  25. package/dist/CreditSystemSettings-C6dUsu72.cjs.map +1 -0
  26. package/dist/CreditSystemSettings-CBot8EPW.cjs +1 -0
  27. package/dist/CreditSystemSettings-CBot8EPW.cjs.map +1 -0
  28. package/dist/CreditSystemSettings-bVuNLsqp.js +9 -0
  29. package/dist/CreditSystemSettings-bVuNLsqp.js.map +1 -0
  30. package/dist/DepositsSection-BkKUS4vk.cjs +1 -0
  31. package/dist/DepositsSection-BkKUS4vk.cjs.map +1 -0
  32. package/dist/{DepositsSection-0Hqr0yDm.js → DepositsSection-DD9MKUFt.js} +20 -14
  33. package/dist/DepositsSection-DD9MKUFt.js.map +1 -0
  34. package/dist/EmailRegisterForm-Pvm3I8GP.cjs +1 -0
  35. package/dist/EmailRegisterForm-Pvm3I8GP.cjs.map +1 -0
  36. package/dist/EmailRegisterForm-nI0BOIxR.js +927 -0
  37. package/dist/EmailRegisterForm-nI0BOIxR.js.map +1 -0
  38. package/dist/EmailSettings-B9qwPSiM.cjs +1 -0
  39. package/dist/EmailSettings-B9qwPSiM.cjs.map +1 -0
  40. package/dist/EmailSettings-CCA8dNCi.js +17 -0
  41. package/dist/EmailSettings-CCA8dNCi.js.map +1 -0
  42. package/dist/EmailSettings-RbgAq9FB.cjs +1 -0
  43. package/dist/EmailSettings-RbgAq9FB.cjs.map +1 -0
  44. package/dist/{AuthenticationSettings-BSoIQ58T.js → EmailSettings-mxlKNcPl.js} +3 -3
  45. package/dist/EmailSettings-mxlKNcPl.js.map +1 -0
  46. package/dist/EmbeddedWalletSettings-B4h-8rxB.cjs +1 -0
  47. package/dist/EmbeddedWalletSettings-B4h-8rxB.cjs.map +1 -0
  48. package/dist/EmbeddedWalletSettings-BInZvFZf.js +79 -0
  49. package/dist/EmbeddedWalletSettings-BInZvFZf.js.map +1 -0
  50. package/dist/{EmbeddedWalletSettings-iVf_3pn3.js → EmbeddedWalletSettings-CXlZFFDw.js} +3 -3
  51. package/dist/EmbeddedWalletSettings-CXlZFFDw.js.map +1 -0
  52. package/dist/EmbeddedWalletSettings-D5JXae1L.cjs +1 -0
  53. package/dist/EmbeddedWalletSettings-D5JXae1L.cjs.map +1 -0
  54. package/dist/ErrorMessage-CHbYbVi2.cjs +1 -0
  55. package/dist/ErrorMessage-CHbYbVi2.cjs.map +1 -0
  56. package/dist/ErrorMessage-CcEK0pYO.js +64 -0
  57. package/dist/ErrorMessage-CcEK0pYO.js.map +1 -0
  58. package/dist/{GoogleLoginButton-BzHr545L.js → GoogleLoginButton-CXwp4LsQ.js} +4 -3
  59. package/dist/{GoogleLoginButton-BzHr545L.js.map → GoogleLoginButton-CXwp4LsQ.js.map} +1 -1
  60. package/dist/GoogleLoginButton-zS_69-KV.cjs +1 -0
  61. package/dist/{GoogleLoginButton-DoAdOqb3.cjs.map → GoogleLoginButton-zS_69-KV.cjs.map} +1 -1
  62. package/dist/LoadingSpinner-6vml-zwr.js +79 -0
  63. package/dist/LoadingSpinner-6vml-zwr.js.map +1 -0
  64. package/dist/LoadingSpinner-d6sSxgQN.cjs +1 -0
  65. package/dist/LoadingSpinner-d6sSxgQN.cjs.map +1 -0
  66. package/dist/PermissionsSection-BPbE-hNx.cjs +1 -0
  67. package/dist/PermissionsSection-BPbE-hNx.cjs.map +1 -0
  68. package/dist/PermissionsSection-CighC1p6.js +1026 -0
  69. package/dist/PermissionsSection-CighC1p6.js.map +1 -0
  70. package/dist/ServerSettings-BE8fsE5k.js +84 -0
  71. package/dist/ServerSettings-BE8fsE5k.js.map +1 -0
  72. package/dist/ServerSettings-CYTlQ2xy.cjs +1 -0
  73. package/dist/ServerSettings-CYTlQ2xy.cjs.map +1 -0
  74. package/dist/ServerSettings-DFs9jQ3f.cjs +1 -0
  75. package/dist/ServerSettings-DFs9jQ3f.cjs.map +1 -0
  76. package/dist/{ServerSettings-C_osdbiX.js → ServerSettings-pSmWDC1d.js} +3 -3
  77. package/dist/ServerSettings-pSmWDC1d.js.map +1 -0
  78. package/dist/SettingsPageLayout--GZ_iHLc.js +50 -0
  79. package/dist/SettingsPageLayout--GZ_iHLc.js.map +1 -0
  80. package/dist/SettingsPageLayout-j5lMjEID.cjs +1 -0
  81. package/dist/SettingsPageLayout-j5lMjEID.cjs.map +1 -0
  82. package/dist/SolanaLoginButton-BjOxpE1C.cjs +1 -0
  83. package/dist/{SolanaLoginButton-CPzms0kf.cjs.map → SolanaLoginButton-BjOxpE1C.cjs.map} +1 -1
  84. package/dist/{SolanaLoginButton-C-CfZxAZ.js → SolanaLoginButton-P22QjBaO.js} +5 -4
  85. package/dist/{SolanaLoginButton-C-CfZxAZ.js.map → SolanaLoginButton-P22QjBaO.js.map} +1 -1
  86. package/dist/StatsBar-BX-hHtTq.js +66 -0
  87. package/dist/StatsBar-BX-hHtTq.js.map +1 -0
  88. package/dist/StatsBar-DTUZCwDD.cjs +1 -0
  89. package/dist/StatsBar-DTUZCwDD.cjs.map +1 -0
  90. package/dist/{TeamSection-Bjt72upx.js → TeamSection-BIECkp7g.js} +27 -26
  91. package/dist/TeamSection-BIECkp7g.js.map +1 -0
  92. package/dist/TeamSection-BOH9pv_E.cjs +1 -0
  93. package/dist/TeamSection-BOH9pv_E.cjs.map +1 -0
  94. package/dist/UsersSection-e6q7FHzx.cjs +1 -0
  95. package/dist/UsersSection-e6q7FHzx.cjs.map +1 -0
  96. package/dist/UsersSection-t-zm0jZW.js +33 -0
  97. package/dist/UsersSection-t-zm0jZW.js.map +1 -0
  98. package/dist/{WebhookSettings-IyhyTFes.js → WebhookSettings-Bb70MbFj.js} +4 -4
  99. package/dist/WebhookSettings-Bb70MbFj.js.map +1 -0
  100. package/dist/WebhookSettings-C-gvNAW1.cjs +1 -0
  101. package/dist/WebhookSettings-C-gvNAW1.cjs.map +1 -0
  102. package/dist/WebhookSettings-CGyDKjrm.cjs +1 -0
  103. package/dist/WebhookSettings-CGyDKjrm.cjs.map +1 -0
  104. package/dist/WebhookSettings-kIstSjZi.js +17 -0
  105. package/dist/WebhookSettings-kIstSjZi.js.map +1 -0
  106. package/dist/WithdrawalsSection-sljIyeaz.cjs +1 -0
  107. package/dist/WithdrawalsSection-sljIyeaz.cjs.map +1 -0
  108. package/dist/WithdrawalsSection-yRDTVFsb.js +27 -0
  109. package/dist/WithdrawalsSection-yRDTVFsb.js.map +1 -0
  110. package/dist/admin-only.cjs +1 -0
  111. package/dist/admin-only.cjs.map +1 -0
  112. package/dist/{admin/types.d.ts → admin-only.d.ts} +228 -167
  113. package/dist/admin-only.js +8 -0
  114. package/dist/admin-only.js.map +1 -0
  115. package/dist/assets/argon2Worker-Bi5TuQvD.js.map +1 -1
  116. package/dist/email-only.cjs +1 -1
  117. package/dist/email-only.d.ts +645 -16
  118. package/dist/email-only.js +16 -13
  119. package/dist/email-only.js.map +1 -1
  120. package/dist/google-only.cjs +1 -1
  121. package/dist/google-only.d.ts +554 -13
  122. package/dist/google-only.js +11 -8
  123. package/dist/google-only.js.map +1 -1
  124. package/dist/index.cjs +2061 -1
  125. package/dist/index.cjs.map +1 -1
  126. package/dist/index.d.ts +5030 -144
  127. package/dist/index.js +13482 -117
  128. package/dist/index.js.map +1 -1
  129. package/dist/login-react.css +1 -1
  130. package/dist/plugin-8_dpq7tC.cjs +1 -0
  131. package/dist/plugin-8_dpq7tC.cjs.map +1 -0
  132. package/dist/plugin-D1NdppqC.js +596 -0
  133. package/dist/plugin-D1NdppqC.js.map +1 -0
  134. package/dist/sanitization-Bo_tn-L2.cjs +1 -0
  135. package/dist/sanitization-Bo_tn-L2.cjs.map +1 -0
  136. package/dist/sanitization-CQ-H1MSg.js +39 -0
  137. package/dist/sanitization-CQ-H1MSg.js.map +1 -0
  138. package/dist/shamir-4DyQMJCk.cjs +1 -0
  139. package/dist/shamir-4DyQMJCk.cjs.map +1 -0
  140. package/dist/{solanaKeypair-BlXol3nh.js → shamir-L-s-Tp1Z.js} +765 -757
  141. package/dist/shamir-L-s-Tp1Z.js.map +1 -0
  142. package/dist/silentWalletEnroll-BgTb4H5I.cjs +1 -0
  143. package/dist/silentWalletEnroll-BgTb4H5I.cjs.map +1 -0
  144. package/dist/silentWalletEnroll-DWt6Pr3B.js +41 -0
  145. package/dist/silentWalletEnroll-DWt6Pr3B.js.map +1 -0
  146. package/dist/solana-only.cjs +1 -1
  147. package/dist/solana-only.d.ts +605 -13
  148. package/dist/solana-only.js +12 -9
  149. package/dist/solana-only.js.map +1 -1
  150. package/dist/style.d.ts +1 -0
  151. package/dist/useAdminDeposits-BTSyeAfg.js +151 -0
  152. package/dist/useAdminDeposits-BTSyeAfg.js.map +1 -0
  153. package/dist/useAdminDeposits-BkkCwHWp.cjs +1 -0
  154. package/dist/useAdminDeposits-BkkCwHWp.cjs.map +1 -0
  155. package/dist/{ErrorMessage-DU2VBb85.js → useAuth-C3dpk0po.js} +1005 -1241
  156. package/dist/useAuth-C3dpk0po.js.map +1 -0
  157. package/dist/useAuth-D3Pk_H3z.cjs +1 -0
  158. package/dist/useAuth-D3Pk_H3z.cjs.map +1 -0
  159. package/dist/useCedrosLogin-C9MrcZvh.cjs +1 -0
  160. package/dist/useCedrosLogin-C9MrcZvh.cjs.map +1 -0
  161. package/dist/useCedrosLogin-_94MmGGq.js +216 -0
  162. package/dist/useCedrosLogin-_94MmGGq.js.map +1 -0
  163. package/dist/useOrgs-C3pzMA9h.js +215 -0
  164. package/dist/useOrgs-C3pzMA9h.js.map +1 -0
  165. package/dist/useOrgs-DDVRCaVi.cjs +1 -0
  166. package/dist/useOrgs-DDVRCaVi.cjs.map +1 -0
  167. package/dist/useSystemSettings-DBlAMjFi.js +97 -0
  168. package/dist/useSystemSettings-DBlAMjFi.js.map +1 -0
  169. package/dist/useSystemSettings-DRrreszl.cjs +1 -0
  170. package/dist/useSystemSettings-DRrreszl.cjs.map +1 -0
  171. package/dist/useUsersStatsSummary-8qY7iP4G.cjs +1 -0
  172. package/dist/useUsersStatsSummary-8qY7iP4G.cjs.map +1 -0
  173. package/dist/useUsersStatsSummary-NjEFvWuz.js +1246 -0
  174. package/dist/useUsersStatsSummary-NjEFvWuz.js.map +1 -0
  175. package/dist/{validation-BebL7hMF.js → validation-B8kMV3BL.js} +1 -1
  176. package/dist/{validation-BebL7hMF.js.map → validation-B8kMV3BL.js.map} +1 -1
  177. package/dist/{validation-BeXIfuHB.cjs → validation-BuGQrA-K.cjs} +1 -1
  178. package/dist/{validation-BeXIfuHB.cjs.map → validation-BuGQrA-K.cjs.map} +1 -1
  179. package/package.json +11 -1
  180. package/dist/AuthenticationSettings-BSoIQ58T.js.map +0 -1
  181. package/dist/AuthenticationSettings-CNmWEPFV.cjs +0 -1
  182. package/dist/AuthenticationSettings-CNmWEPFV.cjs.map +0 -1
  183. package/dist/CreditSystemSettings-BYxoFwaP.js +0 -9
  184. package/dist/CreditSystemSettings-BYxoFwaP.js.map +0 -1
  185. package/dist/CreditSystemSettings-D2fLorNx.cjs +0 -1
  186. package/dist/CreditSystemSettings-D2fLorNx.cjs.map +0 -1
  187. package/dist/DepositsSection-0Hqr0yDm.js.map +0 -1
  188. package/dist/DepositsSection-CGKCzM-H.cjs +0 -1
  189. package/dist/DepositsSection-CGKCzM-H.cjs.map +0 -1
  190. package/dist/EmailRegisterForm-C0PStlj5.js +0 -961
  191. package/dist/EmailRegisterForm-C0PStlj5.js.map +0 -1
  192. package/dist/EmailRegisterForm-DaPLGws2.cjs +0 -1
  193. package/dist/EmailRegisterForm-DaPLGws2.cjs.map +0 -1
  194. package/dist/EmailSettings-CiLDwzNb.cjs +0 -1
  195. package/dist/EmailSettings-CiLDwzNb.cjs.map +0 -1
  196. package/dist/EmailSettings-DTjpO65J.js +0 -9
  197. package/dist/EmailSettings-DTjpO65J.js.map +0 -1
  198. package/dist/EmbeddedWalletSettings-CX7sYiPy.cjs +0 -1
  199. package/dist/EmbeddedWalletSettings-CX7sYiPy.cjs.map +0 -1
  200. package/dist/EmbeddedWalletSettings-iVf_3pn3.js.map +0 -1
  201. package/dist/ErrorMessage-BXHiYibN.cjs +0 -1
  202. package/dist/ErrorMessage-BXHiYibN.cjs.map +0 -1
  203. package/dist/ErrorMessage-DU2VBb85.js.map +0 -1
  204. package/dist/GoogleLoginButton-DoAdOqb3.cjs +0 -1
  205. package/dist/ServerSettings-C_osdbiX.js.map +0 -1
  206. package/dist/ServerSettings-HqSb_VDj.cjs +0 -1
  207. package/dist/ServerSettings-HqSb_VDj.cjs.map +0 -1
  208. package/dist/SolanaLoginButton-CPzms0kf.cjs +0 -1
  209. package/dist/TeamSection-Bjt72upx.js.map +0 -1
  210. package/dist/TeamSection-DZeWHkLd.cjs +0 -1
  211. package/dist/TeamSection-DZeWHkLd.cjs.map +0 -1
  212. package/dist/UsersSection-DU86czWP.cjs +0 -1
  213. package/dist/UsersSection-DU86czWP.cjs.map +0 -1
  214. package/dist/UsersSection-hAcyfSZk.js +0 -81
  215. package/dist/UsersSection-hAcyfSZk.js.map +0 -1
  216. package/dist/WebhookSettings-Br9bakAL.cjs +0 -1
  217. package/dist/WebhookSettings-Br9bakAL.cjs.map +0 -1
  218. package/dist/WebhookSettings-IyhyTFes.js.map +0 -1
  219. package/dist/WithdrawalsSection-B1415d-G.js +0 -20
  220. package/dist/WithdrawalsSection-B1415d-G.js.map +0 -1
  221. package/dist/WithdrawalsSection-iZJBuZ7O.cjs +0 -1
  222. package/dist/WithdrawalsSection-iZJBuZ7O.cjs.map +0 -1
  223. package/dist/admin/AdminShell.d.ts +0 -38
  224. package/dist/admin/icons.d.ts +0 -2
  225. package/dist/admin/index.d.ts +0 -10
  226. package/dist/admin/plugin.d.ts +0 -3
  227. package/dist/admin/sections/AuthenticationSettings.d.ts +0 -3
  228. package/dist/admin/sections/CreditSystemSettings.d.ts +0 -3
  229. package/dist/admin/sections/DepositsSection.d.ts +0 -3
  230. package/dist/admin/sections/EmailSettings.d.ts +0 -3
  231. package/dist/admin/sections/EmbeddedWalletSettings.d.ts +0 -3
  232. package/dist/admin/sections/FeatureSettings.d.ts +0 -3
  233. package/dist/admin/sections/InvitesSection.d.ts +0 -3
  234. package/dist/admin/sections/MembersSection.d.ts +0 -3
  235. package/dist/admin/sections/ServerSettings.d.ts +0 -3
  236. package/dist/admin/sections/SettingsSections.d.ts +0 -7
  237. package/dist/admin/sections/TeamSection.d.ts +0 -3
  238. package/dist/admin/sections/UsersSection.d.ts +0 -3
  239. package/dist/admin/sections/WebhookSettings.d.ts +0 -3
  240. package/dist/admin/sections/WithdrawalsSection.d.ts +0 -3
  241. package/dist/components/LoginButton.d.ts +0 -23
  242. package/dist/components/LoginForm.d.ts +0 -9
  243. package/dist/components/LoginModal.d.ts +0 -9
  244. package/dist/components/admin/AdminUserDetail.d.ts +0 -23
  245. package/dist/components/admin/AdminUserList.d.ts +0 -21
  246. package/dist/components/admin/CedrosAdminDashboard.d.ts +0 -52
  247. package/dist/components/admin/PermissionsSection.d.ts +0 -7
  248. package/dist/components/admin/ProfileDropdown.d.ts +0 -34
  249. package/dist/components/admin/SetupWizard.d.ts +0 -30
  250. package/dist/components/admin/StatsBar.d.ts +0 -17
  251. package/dist/components/admin/SystemSettings.d.ts +0 -19
  252. package/dist/components/admin/settings/AuthenticationSettings.d.ts +0 -4
  253. package/dist/components/admin/settings/AutosaveStatus.d.ts +0 -6
  254. package/dist/components/admin/settings/CreditSystemSettings.d.ts +0 -6
  255. package/dist/components/admin/settings/EmailSettings.d.ts +0 -4
  256. package/dist/components/admin/settings/EmbeddedWalletSettings.d.ts +0 -4
  257. package/dist/components/admin/settings/FeatureSettings.d.ts +0 -4
  258. package/dist/components/admin/settings/MessagingSettings.d.ts +0 -4
  259. package/dist/components/admin/settings/SecuritySettings.d.ts +0 -4
  260. package/dist/components/admin/settings/ServerSettings.d.ts +0 -4
  261. package/dist/components/admin/settings/SettingsPageLayout.d.ts +0 -16
  262. package/dist/components/admin/settings/SsoProvidersSettings.d.ts +0 -4
  263. package/dist/components/admin/settings/WebhookSettings.d.ts +0 -4
  264. package/dist/components/admin/settings/index.d.ts +0 -31
  265. package/dist/components/admin/settings/settingsInputs.d.ts +0 -79
  266. package/dist/components/admin/settings/settingsMetadata.d.ts +0 -18
  267. package/dist/components/apple/AppleLoginButton.d.ts +0 -29
  268. package/dist/components/deposit/CreditBalance.d.ts +0 -19
  269. package/dist/components/deposit/DepositFlow.d.ts +0 -118
  270. package/dist/components/deposit/FeeConfigDisplay.d.ts +0 -15
  271. package/dist/components/deposit/History.d.ts +0 -21
  272. package/dist/components/deposit/TieredAmountSlider.d.ts +0 -19
  273. package/dist/components/deposit/TokenSelector.d.ts +0 -23
  274. package/dist/components/deposit/admin/AdminDepositList.d.ts +0 -21
  275. package/dist/components/deposit/admin/AdminDepositStats.d.ts +0 -15
  276. package/dist/components/deposit/admin/AdminPrivacyPeriodDeposits.d.ts +0 -19
  277. package/dist/components/deposit/admin/AdminWithdrawalHistory.d.ts +0 -19
  278. package/dist/components/deposit/admin/AdminWithdrawalQueue.d.ts +0 -23
  279. package/dist/components/deposit/admin/AdminWithdrawalStats.d.ts +0 -10
  280. package/dist/components/deposit/admin/FeatureDisabledMessage.d.ts +0 -15
  281. package/dist/components/deposit/admin/PrivacySystemStatus.d.ts +0 -15
  282. package/dist/components/deposit/admin/featureDisabled.d.ts +0 -14
  283. package/dist/components/deposit/admin/index.d.ts +0 -22
  284. package/dist/components/deposit/index.d.ts +0 -12
  285. package/dist/components/deposit/tierUtils.d.ts +0 -8
  286. package/dist/components/deposit/tokens.d.ts +0 -19
  287. package/dist/components/email/EmailLoginForm.d.ts +0 -11
  288. package/dist/components/email/EmailRegisterForm.d.ts +0 -14
  289. package/dist/components/email/ForgotPasswordForm.d.ts +0 -17
  290. package/dist/components/email/PasswordInput.d.ts +0 -14
  291. package/dist/components/email/ResetPasswordForm.d.ts +0 -22
  292. package/dist/components/google/GoogleLoginButton.d.ts +0 -12
  293. package/dist/components/invites/InviteForm.d.ts +0 -38
  294. package/dist/components/invites/InviteList.d.ts +0 -40
  295. package/dist/components/members/MemberList.d.ts +0 -47
  296. package/dist/components/org/CreateOrgForm.d.ts +0 -7
  297. package/dist/components/org/OrgAvatar.d.ts +0 -7
  298. package/dist/components/org/OrgListView.d.ts +0 -9
  299. package/dist/components/org/OrgSelector.d.ts +0 -52
  300. package/dist/components/org/OrgSwitcher.d.ts +0 -47
  301. package/dist/components/org/icons.d.ts +0 -8
  302. package/dist/components/profile/UserProfileSettings.d.ts +0 -35
  303. package/dist/components/profile/index.d.ts +0 -2
  304. package/dist/components/sessions/SessionList.d.ts +0 -33
  305. package/dist/components/shared/ErrorBoundary.d.ts +0 -38
  306. package/dist/components/shared/ErrorMessage.d.ts +0 -14
  307. package/dist/components/shared/LoadingSpinner.d.ts +0 -16
  308. package/dist/components/solana/SolanaLoginButton.d.ts +0 -49
  309. package/dist/components/templates/FullPageLayout.d.ts +0 -40
  310. package/dist/components/templates/SplitPageLayout.d.ts +0 -44
  311. package/dist/components/templates/index.d.ts +0 -4
  312. package/dist/components/totp/OtpInput.d.ts +0 -32
  313. package/dist/components/totp/QrCode.d.ts +0 -21
  314. package/dist/components/totp/TotpSettings.d.ts +0 -38
  315. package/dist/components/totp/TotpSetup.d.ts +0 -23
  316. package/dist/components/totp/TotpVerify.d.ts +0 -25
  317. package/dist/components/totp/index.d.ts +0 -10
  318. package/dist/components/wallet/CapabilityWarning.d.ts +0 -11
  319. package/dist/components/wallet/PasskeyPrompt.d.ts +0 -34
  320. package/dist/components/wallet/RecoveryPhraseDisplay.d.ts +0 -18
  321. package/dist/components/wallet/RecoveryPhraseInput.d.ts +0 -21
  322. package/dist/components/wallet/WalletAddressRow.d.ts +0 -10
  323. package/dist/components/wallet/WalletEnrollment.d.ts +0 -15
  324. package/dist/components/wallet/WalletManager.d.ts +0 -9
  325. package/dist/components/wallet/WalletRecovery.d.ts +0 -19
  326. package/dist/components/wallet/WalletStatus.d.ts +0 -28
  327. package/dist/components/wallet/WalletUnlock.d.ts +0 -23
  328. package/dist/components/wallet/index.d.ts +0 -23
  329. package/dist/components/webauthn/PasskeyLoginButton.d.ts +0 -8
  330. package/dist/context/CedrosLoginContext.d.ts +0 -24
  331. package/dist/context/CedrosLoginProvider.d.ts +0 -17
  332. package/dist/context/EmbeddedWalletExposure.d.ts +0 -19
  333. package/dist/context/useCedrosLogin.d.ts +0 -12
  334. package/dist/crypto/aesGcm.d.ts +0 -89
  335. package/dist/crypto/argon2.d.ts +0 -65
  336. package/dist/crypto/argon2Worker.d.ts +0 -1
  337. package/dist/crypto/argon2WorkerClient.d.ts +0 -28
  338. package/dist/crypto/bip39.d.ts +0 -106
  339. package/dist/crypto/capabilities.d.ts +0 -35
  340. package/dist/crypto/entropy.d.ts +0 -56
  341. package/dist/crypto/hkdf.d.ts +0 -38
  342. package/dist/crypto/index.d.ts +0 -30
  343. package/dist/crypto/secureWipe.d.ts +0 -71
  344. package/dist/crypto/shamir.d.ts +0 -52
  345. package/dist/crypto/solanaKeypair.d.ts +0 -63
  346. package/dist/crypto/types.d.ts +0 -134
  347. package/dist/crypto/webauthnPrf.d.ts +0 -108
  348. package/dist/hooks/useAdminDeposits.d.ts +0 -10
  349. package/dist/hooks/useAdminUsers.d.ts +0 -28
  350. package/dist/hooks/useAppleAuth.d.ts +0 -52
  351. package/dist/hooks/useAuth.d.ts +0 -34
  352. package/dist/hooks/useAuthSession.d.ts +0 -19
  353. package/dist/hooks/useAuthorize.d.ts +0 -62
  354. package/dist/hooks/useCredits.d.ts +0 -11
  355. package/dist/hooks/useDashboardPermissions.d.ts +0 -45
  356. package/dist/hooks/useDeposit.d.ts +0 -16
  357. package/dist/hooks/useEmailAuth.d.ts +0 -60
  358. package/dist/hooks/useGoogleAuth.d.ts +0 -67
  359. package/dist/hooks/useInstantLink.d.ts +0 -42
  360. package/dist/hooks/useInvites.d.ts +0 -57
  361. package/dist/hooks/useMembers.d.ts +0 -52
  362. package/dist/hooks/useOrgs.d.ts +0 -49
  363. package/dist/hooks/usePasswordReset.d.ts +0 -32
  364. package/dist/hooks/usePendingRecovery.d.ts +0 -34
  365. package/dist/hooks/useProfile.d.ts +0 -35
  366. package/dist/hooks/useRateLimiter.d.ts +0 -58
  367. package/dist/hooks/useServerFeatures.d.ts +0 -55
  368. package/dist/hooks/useSessions.d.ts +0 -45
  369. package/dist/hooks/useSettingsAutosave.d.ts +0 -29
  370. package/dist/hooks/useSetup.d.ts +0 -25
  371. package/dist/hooks/useSolanaAuth.d.ts +0 -30
  372. package/dist/hooks/useSsoProviders.d.ts +0 -52
  373. package/dist/hooks/useSystemSettings.d.ts +0 -47
  374. package/dist/hooks/useThemeManager.d.ts +0 -11
  375. package/dist/hooks/useTotp.d.ts +0 -52
  376. package/dist/hooks/useTotpVerify.d.ts +0 -38
  377. package/dist/hooks/useTransactionSigning.d.ts +0 -45
  378. package/dist/hooks/useWallet.d.ts +0 -10
  379. package/dist/hooks/useWalletDiscovery.d.ts +0 -24
  380. package/dist/hooks/useWalletEnrollment.d.ts +0 -9
  381. package/dist/hooks/useWalletMaterial.d.ts +0 -10
  382. package/dist/hooks/useWalletRecovery.d.ts +0 -9
  383. package/dist/hooks/useWalletSigning.d.ts +0 -31
  384. package/dist/hooks/useWebAuthn.d.ts +0 -25
  385. package/dist/i18n/I18nProvider.d.ts +0 -16
  386. package/dist/i18n/context.d.ts +0 -6
  387. package/dist/i18n/index.d.ts +0 -5
  388. package/dist/i18n/translations.d.ts +0 -66
  389. package/dist/i18n/useI18n.d.ts +0 -9
  390. package/dist/index-ZS9AwAal.cjs +0 -2061
  391. package/dist/index-ZS9AwAal.cjs.map +0 -1
  392. package/dist/index-dgg5tlO7.js +0 -19650
  393. package/dist/index-dgg5tlO7.js.map +0 -1
  394. package/dist/silentWalletEnroll-C3JRAD9_.js +0 -42
  395. package/dist/silentWalletEnroll-C3JRAD9_.js.map +0 -1
  396. package/dist/silentWalletEnroll-DRYQAQfg.cjs +0 -1
  397. package/dist/silentWalletEnroll-DRYQAQfg.cjs.map +0 -1
  398. package/dist/solanaKeypair-BlXol3nh.js.map +0 -1
  399. package/dist/solanaKeypair-C-lIR1JY.cjs +0 -1
  400. package/dist/solanaKeypair-C-lIR1JY.cjs.map +0 -1
  401. package/dist/types/adminUser.d.ts +0 -168
  402. package/dist/types/auth.d.ts +0 -122
  403. package/dist/types/config.d.ts +0 -266
  404. package/dist/types/deposit.d.ts +0 -490
  405. package/dist/types/index.d.ts +0 -13
  406. package/dist/types/invite.d.ts +0 -71
  407. package/dist/types/member.d.ts +0 -45
  408. package/dist/types/org.d.ts +0 -133
  409. package/dist/types/profile.d.ts +0 -56
  410. package/dist/types/session.d.ts +0 -28
  411. package/dist/types/setup.d.ts +0 -47
  412. package/dist/types/systemSettings.d.ts +0 -85
  413. package/dist/types/totp.d.ts +0 -52
  414. package/dist/types/wallet.d.ts +0 -309
  415. package/dist/utils/adminUserApi.d.ts +0 -60
  416. package/dist/utils/apiClient.d.ts +0 -78
  417. package/dist/utils/cryptoShim.d.ts +0 -17
  418. package/dist/utils/csrf.d.ts +0 -1
  419. package/dist/utils/deviceDetection.d.ts +0 -17
  420. package/dist/utils/embeddedWallet.d.ts +0 -75
  421. package/dist/utils/inviteApi.d.ts +0 -31
  422. package/dist/utils/memberApi.d.ts +0 -23
  423. package/dist/utils/orgApi.d.ts +0 -36
  424. package/dist/utils/profileApi.d.ts +0 -26
  425. package/dist/utils/sanitization.d.ts +0 -66
  426. package/dist/utils/sessionApi.d.ts +0 -16
  427. package/dist/utils/setupApi.d.ts +0 -21
  428. package/dist/utils/silentWalletEnroll.d.ts +0 -41
  429. package/dist/utils/systemSettingsApi.d.ts +0 -18
  430. package/dist/utils/tabSync.d.ts +0 -46
  431. package/dist/utils/tokenManager.d.ts +0 -107
  432. package/dist/utils/unlockCredential.d.ts +0 -5
  433. package/dist/utils/validation.d.ts +0 -48
  434. package/dist/utils/walletDetection.d.ts +0 -23
  435. package/dist/utils/webauthnJson.d.ts +0 -21
@@ -1,7 +1,7 @@
1
- import { D as Be, e as Se, f as ht, i as ve, j as te } from "./ErrorMessage-DU2VBb85.js";
2
- let P = null, Ae = 0;
1
+ import { D as Be, v as ve, d as Se, e as ee, f as ht, h as Ae } from "./useAuth-C3dpk0po.js";
2
+ let P = null, Re = 0;
3
3
  const et = /* @__PURE__ */ new Map();
4
- function Re() {
4
+ function Ie() {
5
5
  return typeof Worker > "u" ? null : (P || (P = new Worker(new URL(
6
6
  /* @vite-ignore */
7
7
  "" + new URL("assets/argon2Worker-Bi5TuQvD.js", import.meta.url).href,
@@ -28,13 +28,14 @@ function Re() {
28
28
  et.clear(), P?.terminate(), P = null;
29
29
  }), P);
30
30
  }
31
- async function rr(e, t, n = Be) {
32
- const o = Re();
31
+ async function sr(e, t, n = Be) {
32
+ ve(n);
33
+ const o = Ie();
33
34
  return o ? new Promise((r, s) => {
34
- const a = Ae++;
35
- et.set(a, { resolve: r, reject: s });
35
+ const c = Re++;
36
+ et.set(c, { resolve: r, reject: s });
36
37
  const u = {
37
- id: a,
38
+ id: c,
38
39
  password: e,
39
40
  salt: t,
40
41
  params: n
@@ -42,10 +43,10 @@ async function rr(e, t, n = Be) {
42
43
  o.postMessage(u);
43
44
  }) : Se(e, t, n);
44
45
  }
45
- function Ie(e) {
46
+ function _e(e) {
46
47
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
47
48
  }
48
- function _e(e) {
49
+ function Ne(e) {
49
50
  if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
50
51
  var t = e.default;
51
52
  if (typeof t == "function") {
@@ -70,21 +71,21 @@ function _e(e) {
70
71
  }), n;
71
72
  }
72
73
  var it = { exports: {} };
73
- const Ne = globalThis.crypto, Oe = globalThis.crypto, Te = globalThis.crypto.subtle, Ce = globalThis.crypto.getRandomValues.bind(globalThis.crypto), Le = globalThis.crypto.randomUUID.bind(globalThis.crypto), Ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
74
+ const Oe = globalThis.crypto, Te = globalThis.crypto, Ce = globalThis.crypto.subtle, Le = globalThis.crypto.getRandomValues.bind(globalThis.crypto), He = globalThis.crypto.randomUUID.bind(globalThis.crypto), Ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
74
75
  __proto__: null,
75
- default: Ne,
76
- getRandomValues: Ce,
77
- randomUUID: Le,
78
- subtle: Te,
79
- webcrypto: Oe
80
- }, Symbol.toStringTag, { value: "Module" })), He = /* @__PURE__ */ _e(Ue);
81
- var De = it.exports, Ut;
82
- function qe() {
76
+ default: Oe,
77
+ getRandomValues: Le,
78
+ randomUUID: He,
79
+ subtle: Ce,
80
+ webcrypto: Te
81
+ }, Symbol.toStringTag, { value: "Module" })), De = /* @__PURE__ */ Ne(Ue);
82
+ var qe = it.exports, Ut;
83
+ function Me() {
83
84
  return Ut || (Ut = 1, (function(e, t) {
84
85
  (function(n, o) {
85
- e.exports = o(He);
86
- })(De, function(n) {
87
- var o, r, s, a, u;
86
+ e.exports = o(De);
87
+ })(qe, function(n) {
88
+ var o, r, s, c, u;
88
89
  function i() {
89
90
  o = {
90
91
  bits: 8,
@@ -133,7 +134,7 @@ function qe() {
133
134
  5,
134
135
  83
135
136
  ]
136
- }, r = {}, s = new Array(1024).join("0"), a = !0, u = [
137
+ }, r = {}, s = new Array(1024).join("0"), c = !0, u = [
137
138
  "nodeCryptoRandomBytes",
138
139
  "browserCryptoGetRandomValues",
139
140
  "testRandom"
@@ -142,117 +143,117 @@ function qe() {
142
143
  function x() {
143
144
  return !!(r && r.rng && typeof r.rng == "function");
144
145
  }
145
- function y(f, h) {
146
- var c;
146
+ function m(a, h) {
147
+ var f;
147
148
  if (h === 0 || h === 1)
148
- return f;
149
+ return a;
149
150
  if (h && h > 1024)
150
151
  throw new Error(
151
152
  "Padding must be multiples of no larger than 1024 bits."
152
153
  );
153
- return h = h || r.bits, f && (c = f.length % h), c ? (s + f).slice(
154
- -(h - c + f.length)
155
- ) : f;
154
+ return h = h || r.bits, a && (f = a.length % h), f ? (s + a).slice(
155
+ -(h - f + a.length)
156
+ ) : a;
156
157
  }
157
- function w(f) {
158
- var h = "", c, l;
159
- for (l = f.length - 1; l >= 0; l--) {
160
- if (c = parseInt(f[l], 16), isNaN(c))
158
+ function w(a) {
159
+ var h = "", f, l;
160
+ for (l = a.length - 1; l >= 0; l--) {
161
+ if (f = parseInt(a[l], 16), isNaN(f))
161
162
  throw new Error("Invalid hex character.");
162
- h = y(c.toString(2), 4) + h;
163
+ h = m(f.toString(2), 4) + h;
163
164
  }
164
165
  return h;
165
166
  }
166
- function S(f) {
167
- var h = "", c, l;
168
- for (f = y(f, 4), l = f.length; l >= 4; l -= 4) {
169
- if (c = parseInt(f.slice(l - 4, l), 2), isNaN(c))
167
+ function v(a) {
168
+ var h = "", f, l;
169
+ for (a = m(a, 4), l = a.length; l >= 4; l -= 4) {
170
+ if (f = parseInt(a.slice(l - 4, l), 2), isNaN(f))
170
171
  throw new Error("Invalid binary character.");
171
- h = c.toString(16) + h;
172
+ h = f.toString(16) + h;
172
173
  }
173
174
  return h;
174
175
  }
175
176
  function I() {
176
177
  return !!(n && typeof n == "object" && (typeof n.getRandomValues == "function" || typeof n.getRandomValues == "object") && (typeof Uint32Array == "function" || typeof Uint32Array == "object"));
177
178
  }
178
- function v() {
179
+ function S() {
179
180
  return typeof n == "object" && typeof n.randomBytes == "function";
180
181
  }
181
- function O(f) {
182
- function h(b, g, m, B) {
182
+ function O(a) {
183
+ function h(b, g, y, B) {
183
184
  var R = 0, C, L = "", q;
184
185
  for (g && (C = g.length - 1); R < C || L.length < b; )
185
- q = Math.abs(parseInt(g[R], m)), L = L + y(q.toString(2), B), R++;
186
+ q = Math.abs(parseInt(g[R], y)), L = L + m(q.toString(2), B), R++;
186
187
  return L = L.substr(-b), (L.match(/0/g) || []).length === L.length ? null : L;
187
188
  }
188
- function c(b) {
189
- var g, m, B, R, C = null;
190
- for (B = 16, R = 4, m = Math.ceil(b / 8); C === null; )
191
- g = n.randomBytes(m), C = h(b, g.toString("hex"), B, R);
189
+ function f(b) {
190
+ var g, y, B, R, C = null;
191
+ for (B = 16, R = 4, y = Math.ceil(b / 8); C === null; )
192
+ g = n.randomBytes(y), C = h(b, g.toString("hex"), B, R);
192
193
  return C;
193
194
  }
194
195
  function l(b) {
195
- var g, m, B, R = null;
196
- for (m = 10, B = 32, g = Math.ceil(b / 32); R === null; )
196
+ var g, y, B, R = null;
197
+ for (y = 10, B = 32, g = Math.ceil(b / 32); R === null; )
197
198
  R = h(
198
199
  b,
199
200
  n.getRandomValues(new Uint32Array(g)),
200
- m,
201
+ y,
201
202
  B
202
203
  );
203
204
  return R;
204
205
  }
205
206
  function d(b) {
206
- var g, m, B, R, C, L = null;
207
- R = 10, C = 32, m = Math.ceil(b / 32), B = 123456789, g = new Uint32Array(m);
207
+ var g, y, B, R, C, L = null;
208
+ R = 10, C = 32, y = Math.ceil(b / 32), B = 123456789, g = new Uint32Array(y);
208
209
  for (var q = 0; q < g.length; q++)
209
210
  g[q] = B;
210
211
  for (; L === null; )
211
212
  L = h(b, g, R, C);
212
213
  return L;
213
214
  }
214
- if (f && f === "testRandom")
215
- return r.typeCSPRNG = f, d;
216
- if (f && f === "nodeCryptoRandomBytes")
217
- return r.typeCSPRNG = f, c;
218
- if (f && f === "browserCryptoGetRandomValues")
219
- return r.typeCSPRNG = f, l;
220
- if (v())
221
- return r.typeCSPRNG = "nodeCryptoRandomBytes", c;
215
+ if (a && a === "testRandom")
216
+ return r.typeCSPRNG = a, d;
217
+ if (a && a === "nodeCryptoRandomBytes")
218
+ return r.typeCSPRNG = a, f;
219
+ if (a && a === "browserCryptoGetRandomValues")
220
+ return r.typeCSPRNG = a, l;
221
+ if (S())
222
+ return r.typeCSPRNG = "nodeCryptoRandomBytes", f;
222
223
  if (I())
223
224
  return r.typeCSPRNG = "browserCryptoGetRandomValues", l;
224
225
  }
225
- function _(f, h) {
226
- var c = [], l;
227
- for (h && (f = y(f, h)), l = f.length; l > r.bits; l -= r.bits)
228
- c.push(parseInt(f.slice(l - r.bits, l), 2));
229
- return c.push(parseInt(f.slice(0, l), 2)), c;
226
+ function _(a, h) {
227
+ var f = [], l;
228
+ for (h && (a = m(a, h)), l = a.length; l > r.bits; l -= r.bits)
229
+ f.push(parseInt(a.slice(l - r.bits, l), 2));
230
+ return f.push(parseInt(a.slice(0, l), 2)), f;
230
231
  }
231
- function E(f, h) {
232
- var c = r.logs[f], l = 0, d;
232
+ function E(a, h) {
233
+ var f = r.logs[a], l = 0, d;
233
234
  for (d = h.length - 1; d >= 0; d--)
234
- l !== 0 ? l = r.exps[(c + r.logs[l]) % r.maxShares] ^ h[d] : l = h[d];
235
+ l !== 0 ? l = r.exps[(f + r.logs[l]) % r.maxShares] ^ h[d] : l = h[d];
235
236
  return l;
236
237
  }
237
- function A(f, h, c) {
238
- var l = 0, d, b, g, m;
238
+ function A(a, h, f) {
239
+ var l = 0, d, b, g, y;
239
240
  for (g = 0, d = h.length; g < d; g++)
240
- if (c[g]) {
241
- for (b = r.logs[c[g]], m = 0; m < d; m++)
242
- if (g !== m) {
243
- if (f === h[m]) {
241
+ if (f[g]) {
242
+ for (b = r.logs[f[g]], y = 0; y < d; y++)
243
+ if (g !== y) {
244
+ if (a === h[y]) {
244
245
  b = -1;
245
246
  break;
246
247
  }
247
- b = (b + r.logs[f ^ h[m]] - r.logs[h[g] ^ h[m]] + r.maxShares) % r.maxShares;
248
+ b = (b + r.logs[a ^ h[y]] - r.logs[h[g] ^ h[y]] + r.maxShares) % r.maxShares;
248
249
  }
249
250
  l = b === -1 ? l : l ^ r.exps[b];
250
251
  }
251
252
  return l;
252
253
  }
253
- function p(f, h, c) {
254
- var l = [], d = [f], b, g;
255
- for (b = 1; b < c; b++)
254
+ function p(a, h, f) {
255
+ var l = [], d = [a], b, g;
256
+ for (b = 1; b < f; b++)
256
257
  d[b] = parseInt(r.rng(r.bits), 2);
257
258
  for (b = 1, g = h + 1; b < g; b++)
258
259
  l[b - 1] = {
@@ -261,150 +262,150 @@ function qe() {
261
262
  };
262
263
  return l;
263
264
  }
264
- function N(f, h, c) {
265
- var l, d, b, g, m;
266
- if (h = parseInt(h, r.radix), f = parseInt(f, 10) || r.bits, l = f.toString(36).toUpperCase(), b = Math.pow(2, f) - 1, g = b.toString(r.radix).length, d = y(h.toString(r.radix), g), typeof h != "number" || h % 1 !== 0 || h < 1 || h > b)
265
+ function N(a, h, f) {
266
+ var l, d, b, g, y;
267
+ if (h = parseInt(h, r.radix), a = parseInt(a, 10) || r.bits, l = a.toString(36).toUpperCase(), b = Math.pow(2, a) - 1, g = b.toString(r.radix).length, d = m(h.toString(r.radix), g), typeof h != "number" || h % 1 !== 0 || h < 1 || h > b)
267
268
  throw new Error(
268
269
  "Share id must be an integer between 1 and " + b + ", inclusive."
269
270
  );
270
- return m = l + d + c, m;
271
+ return y = l + d + f, y;
271
272
  }
272
273
  var T = {
273
- init: function(f, h) {
274
- var c = [], l = [], d = 1, b, g;
275
- if (i(), f && (typeof f != "number" || f % 1 !== 0 || f < o.minBits || f > o.maxBits))
274
+ init: function(a, h) {
275
+ var f = [], l = [], d = 1, b, g;
276
+ if (i(), a && (typeof a != "number" || a % 1 !== 0 || a < o.minBits || a > o.maxBits))
276
277
  throw new Error(
277
278
  "Number of bits must be an integer between " + o.minBits + " and " + o.maxBits + ", inclusive."
278
279
  );
279
280
  if (h && u.indexOf(h) === -1)
280
281
  throw new Error("Invalid RNG type argument : '" + h + "'");
281
- for (r.radix = o.radix, r.bits = f || o.bits, r.size = Math.pow(2, r.bits), r.maxShares = r.size - 1, b = o.primitivePolynomials[r.bits], g = 0; g < r.size; g++)
282
- l[g] = d, c[d] = g, d = d << 1, d >= r.size && (d = d ^ b, d = d & r.maxShares);
283
- if (r.logs = c, r.exps = l, h && this.setRNG(h), x() || this.setRNG(), !x() || !r.bits || !r.size || !r.maxShares || !r.logs || !r.exps || r.logs.length !== r.size || r.exps.length !== r.size)
282
+ for (r.radix = o.radix, r.bits = a || o.bits, r.size = Math.pow(2, r.bits), r.maxShares = r.size - 1, b = o.primitivePolynomials[r.bits], g = 0; g < r.size; g++)
283
+ l[g] = d, f[d] = g, d = d << 1, d >= r.size && (d = d ^ b, d = d & r.maxShares);
284
+ if (r.logs = f, r.exps = l, h && this.setRNG(h), x() || this.setRNG(), !x() || !r.bits || !r.size || !r.maxShares || !r.logs || !r.exps || r.logs.length !== r.size || r.exps.length !== r.size)
284
285
  throw new Error("Initialization failed.");
285
286
  },
286
287
  // Evaluates the Lagrange interpolation polynomial at x=`at` for
287
288
  // individual config.bits-length segments of each share in the `shares`
288
289
  // Array. Each share is expressed in base `inputRadix`. The output
289
290
  // is expressed in base `outputRadix'.
290
- combine: function(f, h) {
291
- var c, l, d, b, g = "", m, B, R, C = [], L = [];
292
- for (h = h || 0, c = 0, d = f.length; c < d; c++) {
293
- if (B = this.extractShareComponents(f[c]), m === void 0)
294
- m = B.bits;
295
- else if (B.bits !== m)
291
+ combine: function(a, h) {
292
+ var f, l, d, b, g = "", y, B, R, C = [], L = [];
293
+ for (h = h || 0, f = 0, d = a.length; f < d; f++) {
294
+ if (B = this.extractShareComponents(a[f]), y === void 0)
295
+ y = B.bits;
296
+ else if (B.bits !== y)
296
297
  throw new Error(
297
298
  "Mismatched shares: Different bit settings."
298
299
  );
299
- if (r.bits !== m && this.init(m), C.indexOf(B.id) === -1)
300
+ if (r.bits !== y && this.init(y), C.indexOf(B.id) === -1)
300
301
  for (C.push(B.id), R = _(w(B.data)), l = 0, b = R.length; l < b; l++)
301
302
  L[l] = L[l] || [], L[l][C.length - 1] = R[l];
302
303
  }
303
- for (c = 0, d = L.length; c < d; c++)
304
- g = y(A(h, C, L[c]).toString(2)) + g;
305
- return S(
304
+ for (f = 0, d = L.length; f < d; f++)
305
+ g = m(A(h, C, L[f]).toString(2)) + g;
306
+ return v(
306
307
  h >= 1 ? g : g.slice(g.indexOf("1") + 1)
307
308
  );
308
309
  },
309
310
  getConfig: function() {
310
- var f = {};
311
- return f.radix = r.radix, f.bits = r.bits, f.maxShares = r.maxShares, f.hasCSPRNG = x(), f.typeCSPRNG = r.typeCSPRNG, f;
311
+ var a = {};
312
+ return a.radix = r.radix, a.bits = r.bits, a.maxShares = r.maxShares, a.hasCSPRNG = x(), a.typeCSPRNG = r.typeCSPRNG, a;
312
313
  },
313
314
  // Given a public share, extract the bits (Integer), share ID (Integer), and share data (Hex)
314
315
  // and return an Object containing those components.
315
- extractShareComponents: function(f) {
316
- var h, c, l, d, b = {}, g, m;
317
- if (h = parseInt(f.substr(0, 1), 36), h && (typeof h != "number" || h % 1 !== 0 || h < o.minBits || h > o.maxBits))
316
+ extractShareComponents: function(a) {
317
+ var h, f, l, d, b = {}, g, y;
318
+ if (h = parseInt(a.substr(0, 1), 36), h && (typeof h != "number" || h % 1 !== 0 || h < o.minBits || h > o.maxBits))
318
319
  throw new Error(
319
320
  "Invalid share : Number of bits must be an integer between " + o.minBits + " and " + o.maxBits + ", inclusive."
320
321
  );
321
- if (d = Math.pow(2, h) - 1, l = (Math.pow(2, h) - 1).toString(r.radix).length, g = "^([a-kA-K3-9]{1})([a-fA-F0-9]{" + l + "})([a-fA-F0-9]+)$", m = new RegExp(g).exec(f), m && (c = parseInt(m[2], r.radix)), typeof c != "number" || c % 1 !== 0 || c < 1 || c > d)
322
+ if (d = Math.pow(2, h) - 1, l = (Math.pow(2, h) - 1).toString(r.radix).length, g = "^([a-kA-K3-9]{1})([a-fA-F0-9]{" + l + "})([a-fA-F0-9]+)$", y = new RegExp(g).exec(a), y && (f = parseInt(y[2], r.radix)), typeof f != "number" || f % 1 !== 0 || f < 1 || f > d)
322
323
  throw new Error(
323
324
  "Invalid share : Share id must be an integer between 1 and " + r.maxShares + ", inclusive."
324
325
  );
325
- if (m && m[3])
326
- return b.bits = h, b.id = c, b.data = m[3], b;
327
- throw new Error("The share data provided is invalid : " + f);
326
+ if (y && y[3])
327
+ return b.bits = h, b.id = f, b.data = y[3], b;
328
+ throw new Error("The share data provided is invalid : " + a);
328
329
  },
329
330
  // Set the PRNG to use. If no RNG function is supplied, pick a default using getRNG()
330
- setRNG: function(f) {
331
- var h = "Random number generator is invalid ", c = " Supply an CSPRNG of the form function(bits){} that returns a string containing 'bits' number of random 1's and 0's.";
332
- if (f && typeof f == "string" && u.indexOf(f) === -1)
333
- throw new Error("Invalid RNG type argument : '" + f + "'");
334
- if (f || (f = O()), f && typeof f == "string" && (f = O(f)), a) {
335
- if (f && typeof f != "function")
336
- throw new Error(h + "(Not a function)." + c);
337
- if (f && typeof f(r.bits) != "string")
331
+ setRNG: function(a) {
332
+ var h = "Random number generator is invalid ", f = " Supply an CSPRNG of the form function(bits){} that returns a string containing 'bits' number of random 1's and 0's.";
333
+ if (a && typeof a == "string" && u.indexOf(a) === -1)
334
+ throw new Error("Invalid RNG type argument : '" + a + "'");
335
+ if (a || (a = O()), a && typeof a == "string" && (a = O(a)), c) {
336
+ if (a && typeof a != "function")
337
+ throw new Error(h + "(Not a function)." + f);
338
+ if (a && typeof a(r.bits) != "string")
338
339
  throw new Error(
339
- h + "(Output is not a string)." + c
340
+ h + "(Output is not a string)." + f
340
341
  );
341
- if (f && !parseInt(f(r.bits), 2))
342
+ if (a && !parseInt(a(r.bits), 2))
342
343
  throw new Error(
343
- h + "(Binary string output not parseable to an Integer)." + c
344
+ h + "(Binary string output not parseable to an Integer)." + f
344
345
  );
345
- if (f && f(r.bits).length > r.bits)
346
+ if (a && a(r.bits).length > r.bits)
346
347
  throw new Error(
347
- h + "(Output length is greater than config.bits)." + c
348
+ h + "(Output length is greater than config.bits)." + f
348
349
  );
349
- if (f && f(r.bits).length < r.bits)
350
+ if (a && a(r.bits).length < r.bits)
350
351
  throw new Error(
351
- h + "(Output length is less than config.bits)." + c
352
+ h + "(Output length is less than config.bits)." + f
352
353
  );
353
354
  }
354
- return r.rng = f, !0;
355
+ return r.rng = a, !0;
355
356
  },
356
357
  // Converts a given UTF16 character string to the HEX representation.
357
358
  // Each character of the input string is represented by
358
359
  // `bytesPerChar` bytes in the output string which defaults to 2.
359
- str2hex: function(f, h) {
360
- var c, l, d = "", b, g, m, B;
361
- if (typeof f != "string")
360
+ str2hex: function(a, h) {
361
+ var f, l, d = "", b, g, y, B;
362
+ if (typeof a != "string")
362
363
  throw new Error("Input must be a character string.");
363
364
  if (h || (h = o.bytesPerChar), typeof h != "number" || h < 1 || h > o.maxBytesPerChar || h % 1 !== 0)
364
365
  throw new Error(
365
366
  "Bytes per character must be an integer between 1 and " + o.maxBytesPerChar + ", inclusive."
366
367
  );
367
- for (c = 2 * h, l = Math.pow(16, c) - 1, m = 0, B = f.length; m < B; m++) {
368
- if (g = f[m].charCodeAt(), isNaN(g))
369
- throw new Error("Invalid character: " + f[m]);
368
+ for (f = 2 * h, l = Math.pow(16, f) - 1, y = 0, B = a.length; y < B; y++) {
369
+ if (g = a[y].charCodeAt(), isNaN(g))
370
+ throw new Error("Invalid character: " + a[y]);
370
371
  if (g > l)
371
372
  throw b = Math.ceil(Math.log(g + 1) / Math.log(256)), new Error(
372
373
  "Invalid character code (" + g + "). Maximum allowable is 256^bytes-1 (" + l + "). To convert this character, use at least " + b + " bytes."
373
374
  );
374
- d = y(g.toString(16), c) + d;
375
+ d = m(g.toString(16), f) + d;
375
376
  }
376
377
  return d;
377
378
  },
378
379
  // Converts a given HEX number string to a UTF16 character string.
379
- hex2str: function(f, h) {
380
- var c, l = "", d, b;
381
- if (typeof f != "string")
380
+ hex2str: function(a, h) {
381
+ var f, l = "", d, b;
382
+ if (typeof a != "string")
382
383
  throw new Error("Input must be a hexadecimal string.");
383
384
  if (h = h || o.bytesPerChar, typeof h != "number" || h % 1 !== 0 || h < 1 || h > o.maxBytesPerChar)
384
385
  throw new Error(
385
386
  "Bytes per character must be an integer between 1 and " + o.maxBytesPerChar + ", inclusive."
386
387
  );
387
- for (c = 2 * h, f = y(f, c), d = 0, b = f.length; d < b; d += c)
388
+ for (f = 2 * h, a = m(a, f), d = 0, b = a.length; d < b; d += f)
388
389
  l = String.fromCharCode(
389
- parseInt(f.slice(d, d + c), 16)
390
+ parseInt(a.slice(d, d + f), 16)
390
391
  ) + l;
391
392
  return l;
392
393
  },
393
394
  // Generates a random bits-length number string using the PRNG
394
- random: function(f) {
395
- if (typeof f != "number" || f % 1 !== 0 || f < 2 || f > 65536)
395
+ random: function(a) {
396
+ if (typeof a != "number" || a % 1 !== 0 || a < 2 || a > 65536)
396
397
  throw new Error(
397
398
  "Number of bits must be an Integer between 1 and 65536."
398
399
  );
399
- return S(r.rng(f));
400
+ return v(r.rng(a));
400
401
  },
401
402
  // Divides a `secret` number String str expressed in radix `inputRadix` (optional, default 16)
402
403
  // into `numShares` shares, each expressed in radix `outputRadix` (optional, default to `inputRadix`),
403
404
  // requiring `threshold` number of shares to reconstruct the secret.
404
405
  // Optionally, zero-pads the secret to a length that is a multiple of padLength before sharing.
405
- share: function(f, h, c, l) {
406
- var d, b, g = new Array(h), m = new Array(h), B, R, C;
407
- if (l = l || 128, typeof f != "string")
406
+ share: function(a, h, f, l) {
407
+ var d, b, g = new Array(h), y = new Array(h), B, R, C;
408
+ if (l = l || 128, typeof a != "string")
408
409
  throw new Error("Secret must be a string.");
409
410
  if (typeof h != "number" || h % 1 !== 0 || h < 2)
410
411
  throw new Error(
@@ -414,42 +415,42 @@ function qe() {
414
415
  throw d = Math.ceil(Math.log(h + 1) / Math.LN2), new Error(
415
416
  "Number of shares must be an integer between 2 and 2^bits-1 (" + r.maxShares + "), inclusive. To create " + h + " shares, use at least " + d + " bits."
416
417
  );
417
- if (typeof c != "number" || c % 1 !== 0 || c < 2)
418
+ if (typeof f != "number" || f % 1 !== 0 || f < 2)
418
419
  throw new Error(
419
420
  "Threshold number of shares must be an integer between 2 and 2^bits-1 (" + r.maxShares + "), inclusive."
420
421
  );
421
- if (c > r.maxShares)
422
- throw d = Math.ceil(Math.log(c + 1) / Math.LN2), new Error(
423
- "Threshold number of shares must be an integer between 2 and 2^bits-1 (" + r.maxShares + "), inclusive. To use a threshold of " + c + ", use at least " + d + " bits."
422
+ if (f > r.maxShares)
423
+ throw d = Math.ceil(Math.log(f + 1) / Math.LN2), new Error(
424
+ "Threshold number of shares must be an integer between 2 and 2^bits-1 (" + r.maxShares + "), inclusive. To use a threshold of " + f + ", use at least " + d + " bits."
424
425
  );
425
- if (c > h)
426
+ if (f > h)
426
427
  throw new Error(
427
- "Threshold number of shares was " + c + " but must be less than or equal to the " + h + " shares specified as the total to generate."
428
+ "Threshold number of shares was " + f + " but must be less than or equal to the " + h + " shares specified as the total to generate."
428
429
  );
429
430
  if (typeof l != "number" || l % 1 !== 0 || l < 0 || l > 1024)
430
431
  throw new Error(
431
432
  "Zero-pad length must be an integer between 0 and 1024 inclusive."
432
433
  );
433
- for (f = "1" + w(f), f = _(f, l), B = 0, C = f.length; B < C; B++)
434
- for (b = p(f[B], h, c), R = 0; R < h; R++)
435
- g[R] = g[R] || b[R].x.toString(r.radix), m[R] = y(b[R].y.toString(2)) + (m[R] || "");
434
+ for (a = "1" + w(a), a = _(a, l), B = 0, C = a.length; B < C; B++)
435
+ for (b = p(a[B], h, f), R = 0; R < h; R++)
436
+ g[R] = g[R] || b[R].x.toString(r.radix), y[R] = m(b[R].y.toString(2)) + (y[R] || "");
436
437
  for (B = 0; B < h; B++)
437
438
  g[B] = N(
438
439
  r.bits,
439
440
  g[B],
440
- S(m[B])
441
+ v(y[B])
441
442
  );
442
443
  return g;
443
444
  },
444
445
  // Generate a new share with id `id` (a number between 1 and 2^bits-1)
445
446
  // `id` can be a Number or a String in the default radix (16)
446
- newShare: function(f, h) {
447
- var c, l;
448
- if (f && typeof f == "string" && (f = parseInt(f, r.radix)), l = f.toString(r.radix), f && l && h && h[0])
449
- return c = this.extractShareComponents(h[0]), N(
450
- c.bits,
447
+ newShare: function(a, h) {
448
+ var f, l;
449
+ if (a && typeof a == "string" && (a = parseInt(a, r.radix)), l = a.toString(r.radix), a && l && h && h[0])
450
+ return f = this.extractShareComponents(h[0]), N(
451
+ f.bits,
451
452
  l,
452
- this.combine(h, f)
453
+ this.combine(h, a)
453
454
  );
454
455
  throw new Error(
455
456
  "Invalid 'id' or 'shares' Array argument to newShare()."
@@ -458,11 +459,11 @@ function qe() {
458
459
  /* test-code */
459
460
  // export private functions so they can be unit tested directly.
460
461
  _reset: i,
461
- _padLeft: y,
462
+ _padLeft: m,
462
463
  _hex2bin: w,
463
- _bin2hex: S,
464
+ _bin2hex: v,
464
465
  _hasCryptoGetRandomValues: I,
465
- _hasCryptoRandomBytes: v,
466
+ _hasCryptoRandomBytes: S,
466
467
  _getRNG: O,
467
468
  _isSetRNG: x,
468
469
  _splitNumStringToIntArray: _,
@@ -476,271 +477,9 @@ function qe() {
476
477
  });
477
478
  })(it)), it.exports;
478
479
  }
479
- var Me = qe();
480
- const ee = /* @__PURE__ */ Ie(Me), Ge = 2, $e = 3;
481
- function or(e) {
482
- if (e.length !== 16)
483
- throw new Error(`Invalid seed length: expected 16, got ${e.length}`);
484
- const t = ne(e), n = ee.share(t, $e, Ge);
485
- if (n.length !== 3)
486
- throw new Error(`Unexpected share count: ${n.length}`);
487
- const o = lt(n[0]), r = lt(n[1]), s = lt(n[2]);
488
- return {
489
- shareA: ht(o),
490
- shareB: ht(r),
491
- shareC: ht(s)
492
- };
493
- }
494
- function sr(e, t) {
495
- const n = Ht(e), o = Ht(t);
496
- try {
497
- const r = ee.combine([n, o]), s = re(r);
498
- if (s.length !== 16)
499
- throw new Error(`Reconstructed seed has wrong length: ${s.length}`);
500
- return ve(s);
501
- } catch {
502
- throw new Error("Failed to reconstruct seed from shares");
503
- }
504
- }
505
- function ne(e) {
506
- return Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join("");
507
- }
480
+ var Ge = Me();
481
+ const ne = /* @__PURE__ */ _e(Ge);
508
482
  function re(e) {
509
- if (!/^[0-9a-fA-F]*$/.test(e))
510
- throw new Error("Invalid hex string: contains non-hex characters");
511
- if (e.length % 2 !== 0)
512
- throw new Error(`Invalid hex string: length ${e.length} is odd (must be even)`);
513
- const t = new Uint8Array(e.length / 2);
514
- for (let n = 0; n < t.length; n++)
515
- t[n] = parseInt(e.substr(n * 2, 2), 16);
516
- return t;
517
- }
518
- function lt(e) {
519
- const t = e.length % 2 === 0 ? e : "0" + e;
520
- return re(t);
521
- }
522
- function Ht(e) {
523
- const t = ne(e);
524
- return t.startsWith("0") && !t.startsWith("00") ? t.substring(1) : t;
525
- }
526
- function Ze(e) {
527
- return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
528
- }
529
- function At(e, ...t) {
530
- if (!Ze(e))
531
- throw new Error("Uint8Array expected");
532
- if (t.length > 0 && !t.includes(e.length))
533
- throw new Error("Uint8Array expected of length " + t + ", got length=" + e.length);
534
- }
535
- function Dt(e, t = !0) {
536
- if (e.destroyed)
537
- throw new Error("Hash instance has been destroyed");
538
- if (t && e.finished)
539
- throw new Error("Hash#digest() has already been called");
540
- }
541
- function je(e, t) {
542
- At(e);
543
- const n = t.outputLen;
544
- if (e.length < n)
545
- throw new Error("digestInto() expects output buffer of length at least " + n);
546
- }
547
- function yt(...e) {
548
- for (let t = 0; t < e.length; t++)
549
- e[t].fill(0);
550
- }
551
- function dt(e) {
552
- return new DataView(e.buffer, e.byteOffset, e.byteLength);
553
- }
554
- function Z(e, t) {
555
- return e << 32 - t | e >>> t;
556
- }
557
- function Ve(e) {
558
- if (typeof e != "string")
559
- throw new Error("string expected");
560
- return new Uint8Array(new TextEncoder().encode(e));
561
- }
562
- function oe(e) {
563
- return typeof e == "string" && (e = Ve(e)), At(e), e;
564
- }
565
- class ke {
566
- }
567
- function Ye(e) {
568
- const t = (o) => e().update(oe(o)).digest(), n = e();
569
- return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
570
- }
571
- function ze(e, t, n, o) {
572
- if (typeof e.setBigUint64 == "function")
573
- return e.setBigUint64(t, n, o);
574
- const r = BigInt(32), s = BigInt(4294967295), a = Number(n >> r & s), u = Number(n & s), i = o ? 4 : 0, x = o ? 0 : 4;
575
- e.setUint32(t + i, a, o), e.setUint32(t + x, u, o);
576
- }
577
- function Ke(e, t, n) {
578
- return e & t ^ ~e & n;
579
- }
580
- function Xe(e, t, n) {
581
- return e & t ^ e & n ^ t & n;
582
- }
583
- let We = class extends ke {
584
- constructor(t, n, o, r) {
585
- super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = t, this.outputLen = n, this.padOffset = o, this.isLE = r, this.buffer = new Uint8Array(t), this.view = dt(this.buffer);
586
- }
587
- update(t) {
588
- Dt(this), t = oe(t), At(t);
589
- const { view: n, buffer: o, blockLen: r } = this, s = t.length;
590
- for (let a = 0; a < s; ) {
591
- const u = Math.min(r - this.pos, s - a);
592
- if (u === r) {
593
- const i = dt(t);
594
- for (; r <= s - a; a += r)
595
- this.process(i, a);
596
- continue;
597
- }
598
- o.set(t.subarray(a, a + u), this.pos), this.pos += u, a += u, this.pos === r && (this.process(n, 0), this.pos = 0);
599
- }
600
- return this.length += t.length, this.roundClean(), this;
601
- }
602
- digestInto(t) {
603
- Dt(this), je(t, this), this.finished = !0;
604
- const { buffer: n, view: o, blockLen: r, isLE: s } = this;
605
- let { pos: a } = this;
606
- n[a++] = 128, yt(this.buffer.subarray(a)), this.padOffset > r - a && (this.process(o, 0), a = 0);
607
- for (let w = a; w < r; w++)
608
- n[w] = 0;
609
- ze(o, r - 8, BigInt(this.length * 8), s), this.process(o, 0);
610
- const u = dt(t), i = this.outputLen;
611
- if (i % 4)
612
- throw new Error("_sha2: outputLen should be aligned to 32bit");
613
- const x = i / 4, y = this.get();
614
- if (x > y.length)
615
- throw new Error("_sha2: outputLen bigger than state");
616
- for (let w = 0; w < x; w++)
617
- u.setUint32(4 * w, y[w], s);
618
- }
619
- digest() {
620
- const { buffer: t, outputLen: n } = this;
621
- this.digestInto(t);
622
- const o = t.slice(0, n);
623
- return this.destroy(), o;
624
- }
625
- _cloneInto(t) {
626
- t || (t = new this.constructor()), t.set(...this.get());
627
- const { blockLen: n, buffer: o, length: r, finished: s, destroyed: a, pos: u } = this;
628
- return t.destroyed = a, t.finished = s, t.length = r, t.pos = u, r % n && t.buffer.set(o), t;
629
- }
630
- clone() {
631
- return this._cloneInto();
632
- }
633
- };
634
- const Y = /* @__PURE__ */ Uint32Array.from([
635
- 1779033703,
636
- 3144134277,
637
- 1013904242,
638
- 2773480762,
639
- 1359893119,
640
- 2600822924,
641
- 528734635,
642
- 1541459225
643
- ]), Pe = /* @__PURE__ */ Uint32Array.from([
644
- 1116352408,
645
- 1899447441,
646
- 3049323471,
647
- 3921009573,
648
- 961987163,
649
- 1508970993,
650
- 2453635748,
651
- 2870763221,
652
- 3624381080,
653
- 310598401,
654
- 607225278,
655
- 1426881987,
656
- 1925078388,
657
- 2162078206,
658
- 2614888103,
659
- 3248222580,
660
- 3835390401,
661
- 4022224774,
662
- 264347078,
663
- 604807628,
664
- 770255983,
665
- 1249150122,
666
- 1555081692,
667
- 1996064986,
668
- 2554220882,
669
- 2821834349,
670
- 2952996808,
671
- 3210313671,
672
- 3336571891,
673
- 3584528711,
674
- 113926993,
675
- 338241895,
676
- 666307205,
677
- 773529912,
678
- 1294757372,
679
- 1396182291,
680
- 1695183700,
681
- 1986661051,
682
- 2177026350,
683
- 2456956037,
684
- 2730485921,
685
- 2820302411,
686
- 3259730800,
687
- 3345764771,
688
- 3516065817,
689
- 3600352804,
690
- 4094571909,
691
- 275423344,
692
- 430227734,
693
- 506948616,
694
- 659060556,
695
- 883997877,
696
- 958139571,
697
- 1322822218,
698
- 1537002063,
699
- 1747873779,
700
- 1955562222,
701
- 2024104815,
702
- 2227730452,
703
- 2361852424,
704
- 2428436474,
705
- 2756734187,
706
- 3204031479,
707
- 3329325298
708
- ]), z = /* @__PURE__ */ new Uint32Array(64);
709
- class Fe extends We {
710
- constructor(t = 32) {
711
- super(64, t, 8, !1), this.A = Y[0] | 0, this.B = Y[1] | 0, this.C = Y[2] | 0, this.D = Y[3] | 0, this.E = Y[4] | 0, this.F = Y[5] | 0, this.G = Y[6] | 0, this.H = Y[7] | 0;
712
- }
713
- get() {
714
- const { A: t, B: n, C: o, D: r, E: s, F: a, G: u, H: i } = this;
715
- return [t, n, o, r, s, a, u, i];
716
- }
717
- // prettier-ignore
718
- set(t, n, o, r, s, a, u, i) {
719
- this.A = t | 0, this.B = n | 0, this.C = o | 0, this.D = r | 0, this.E = s | 0, this.F = a | 0, this.G = u | 0, this.H = i | 0;
720
- }
721
- process(t, n) {
722
- for (let w = 0; w < 16; w++, n += 4)
723
- z[w] = t.getUint32(n, !1);
724
- for (let w = 16; w < 64; w++) {
725
- const S = z[w - 15], I = z[w - 2], v = Z(S, 7) ^ Z(S, 18) ^ S >>> 3, O = Z(I, 17) ^ Z(I, 19) ^ I >>> 10;
726
- z[w] = O + z[w - 7] + v + z[w - 16] | 0;
727
- }
728
- let { A: o, B: r, C: s, D: a, E: u, F: i, G: x, H: y } = this;
729
- for (let w = 0; w < 64; w++) {
730
- const S = Z(u, 6) ^ Z(u, 11) ^ Z(u, 25), I = y + S + Ke(u, i, x) + Pe[w] + z[w] | 0, O = (Z(o, 2) ^ Z(o, 13) ^ Z(o, 22)) + Xe(o, r, s) | 0;
731
- y = x, x = i, i = u, u = a + I | 0, a = s, s = r, r = o, o = I + O | 0;
732
- }
733
- o = o + this.A | 0, r = r + this.B | 0, s = s + this.C | 0, a = a + this.D | 0, u = u + this.E | 0, i = i + this.F | 0, x = x + this.G | 0, y = y + this.H | 0, this.set(o, r, s, a, u, i, x, y);
734
- }
735
- roundClean() {
736
- yt(z);
737
- }
738
- destroy() {
739
- this.set(0, 0, 0, 0, 0, 0, 0, 0), yt(this.buffer);
740
- }
741
- }
742
- const Qe = /* @__PURE__ */ Ye(() => new Fe());
743
- function se(e) {
744
483
  return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
745
484
  }
746
485
  function Rt(e, t = "") {
@@ -750,43 +489,43 @@ function Rt(e, t = "") {
750
489
  }
751
490
  }
752
491
  function D(e, t, n = "") {
753
- const o = se(e), r = e?.length, s = t !== void 0;
492
+ const o = re(e), r = e?.length, s = t !== void 0;
754
493
  if (!o || s && r !== t) {
755
- const a = n && `"${n}" `, u = s ? ` of length ${t}` : "", i = o ? `length=${r}` : `type=${typeof e}`;
756
- throw new Error(a + "expected Uint8Array" + u + ", got " + i);
494
+ const c = n && `"${n}" `, u = s ? ` of length ${t}` : "", i = o ? `length=${r}` : `type=${typeof e}`;
495
+ throw new Error(c + "expected Uint8Array" + u + ", got " + i);
757
496
  }
758
497
  return e;
759
498
  }
760
- function qt(e, t = !0) {
499
+ function Dt(e, t = !0) {
761
500
  if (e.destroyed)
762
501
  throw new Error("Hash instance has been destroyed");
763
502
  if (t && e.finished)
764
503
  throw new Error("Hash#digest() has already been called");
765
504
  }
766
- function Je(e, t) {
505
+ function $e(e, t) {
767
506
  D(e, void 0, "digestInto() output");
768
507
  const n = t.outputLen;
769
508
  if (e.length < n)
770
509
  throw new Error('"digestInto() output" expected to be of length >=' + n);
771
510
  }
772
- function Et(...e) {
511
+ function mt(...e) {
773
512
  for (let t = 0; t < e.length; t++)
774
513
  e[t].fill(0);
775
514
  }
776
- function bt(e) {
515
+ function lt(e) {
777
516
  return new DataView(e.buffer, e.byteOffset, e.byteLength);
778
517
  }
779
- const ie = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", tn = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
518
+ const oe = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", Ze = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
780
519
  function It(e) {
781
- if (D(e), ie)
520
+ if (D(e), oe)
782
521
  return e.toHex();
783
522
  let t = "";
784
523
  for (let n = 0; n < e.length; n++)
785
- t += tn[e[n]];
524
+ t += Ze[e[n]];
786
525
  return t;
787
526
  }
788
527
  const V = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
789
- function Mt(e) {
528
+ function qt(e) {
790
529
  if (e >= V._0 && e <= V._9)
791
530
  return e - V._0;
792
531
  if (e >= V.A && e <= V.F)
@@ -794,26 +533,26 @@ function Mt(e) {
794
533
  if (e >= V.a && e <= V.f)
795
534
  return e - (V.a - 10);
796
535
  }
797
- function ce(e) {
536
+ function se(e) {
798
537
  if (typeof e != "string")
799
538
  throw new Error("hex string expected, got " + typeof e);
800
- if (ie)
539
+ if (oe)
801
540
  return Uint8Array.fromHex(e);
802
541
  const t = e.length, n = t / 2;
803
542
  if (t % 2)
804
543
  throw new Error("hex string expected, got unpadded hex of length " + t);
805
544
  const o = new Uint8Array(n);
806
545
  for (let r = 0, s = 0; r < n; r++, s += 2) {
807
- const a = Mt(e.charCodeAt(s)), u = Mt(e.charCodeAt(s + 1));
808
- if (a === void 0 || u === void 0) {
546
+ const c = qt(e.charCodeAt(s)), u = qt(e.charCodeAt(s + 1));
547
+ if (c === void 0 || u === void 0) {
809
548
  const i = e[s] + e[s + 1];
810
549
  throw new Error('hex string expected, got non-hex character "' + i + '" at index ' + s);
811
550
  }
812
- o[r] = a * 16 + u;
551
+ o[r] = c * 16 + u;
813
552
  }
814
553
  return o;
815
554
  }
816
- function Gt(...e) {
555
+ function Mt(...e) {
817
556
  let t = 0;
818
557
  for (let o = 0; o < e.length; o++) {
819
558
  const r = e[o];
@@ -826,20 +565,20 @@ function Gt(...e) {
826
565
  }
827
566
  return n;
828
567
  }
829
- function en(e, t = {}) {
568
+ function je(e, t = {}) {
830
569
  const n = (r, s) => e(s).update(r).digest(), o = e(void 0);
831
570
  return n.outputLen = o.outputLen, n.blockLen = o.blockLen, n.create = (r) => e(r), Object.assign(n, t), Object.freeze(n);
832
571
  }
833
- function nn(e = 32) {
572
+ function Ve(e = 32) {
834
573
  const t = typeof globalThis == "object" ? globalThis.crypto : null;
835
574
  if (typeof t?.getRandomValues != "function")
836
575
  throw new Error("crypto.getRandomValues must be defined");
837
576
  return t.getRandomValues(new Uint8Array(e));
838
577
  }
839
- const rn = (e) => ({
578
+ const ke = (e) => ({
840
579
  oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, e])
841
580
  });
842
- class on {
581
+ let Ke = class {
843
582
  blockLen;
844
583
  outputLen;
845
584
  padOffset;
@@ -852,39 +591,39 @@ class on {
852
591
  pos = 0;
853
592
  destroyed = !1;
854
593
  constructor(t, n, o, r) {
855
- this.blockLen = t, this.outputLen = n, this.padOffset = o, this.isLE = r, this.buffer = new Uint8Array(t), this.view = bt(this.buffer);
594
+ this.blockLen = t, this.outputLen = n, this.padOffset = o, this.isLE = r, this.buffer = new Uint8Array(t), this.view = lt(this.buffer);
856
595
  }
857
596
  update(t) {
858
- qt(this), D(t);
597
+ Dt(this), D(t);
859
598
  const { view: n, buffer: o, blockLen: r } = this, s = t.length;
860
- for (let a = 0; a < s; ) {
861
- const u = Math.min(r - this.pos, s - a);
599
+ for (let c = 0; c < s; ) {
600
+ const u = Math.min(r - this.pos, s - c);
862
601
  if (u === r) {
863
- const i = bt(t);
864
- for (; r <= s - a; a += r)
865
- this.process(i, a);
602
+ const i = lt(t);
603
+ for (; r <= s - c; c += r)
604
+ this.process(i, c);
866
605
  continue;
867
606
  }
868
- o.set(t.subarray(a, a + u), this.pos), this.pos += u, a += u, this.pos === r && (this.process(n, 0), this.pos = 0);
607
+ o.set(t.subarray(c, c + u), this.pos), this.pos += u, c += u, this.pos === r && (this.process(n, 0), this.pos = 0);
869
608
  }
870
609
  return this.length += t.length, this.roundClean(), this;
871
610
  }
872
611
  digestInto(t) {
873
- qt(this), Je(t, this), this.finished = !0;
612
+ Dt(this), $e(t, this), this.finished = !0;
874
613
  const { buffer: n, view: o, blockLen: r, isLE: s } = this;
875
- let { pos: a } = this;
876
- n[a++] = 128, Et(this.buffer.subarray(a)), this.padOffset > r - a && (this.process(o, 0), a = 0);
877
- for (let w = a; w < r; w++)
614
+ let { pos: c } = this;
615
+ n[c++] = 128, mt(this.buffer.subarray(c)), this.padOffset > r - c && (this.process(o, 0), c = 0);
616
+ for (let w = c; w < r; w++)
878
617
  n[w] = 0;
879
618
  o.setBigUint64(r - 8, BigInt(this.length * 8), s), this.process(o, 0);
880
- const u = bt(t), i = this.outputLen;
619
+ const u = lt(t), i = this.outputLen;
881
620
  if (i % 4)
882
621
  throw new Error("_sha2: outputLen must be aligned to 32bit");
883
- const x = i / 4, y = this.get();
884
- if (x > y.length)
622
+ const x = i / 4, m = this.get();
623
+ if (x > m.length)
885
624
  throw new Error("_sha2: outputLen bigger than state");
886
625
  for (let w = 0; w < x; w++)
887
- u.setUint32(4 * w, y[w], s);
626
+ u.setUint32(4 * w, m[w], s);
888
627
  }
889
628
  digest() {
890
629
  const { buffer: t, outputLen: n } = this;
@@ -894,13 +633,13 @@ class on {
894
633
  }
895
634
  _cloneInto(t) {
896
635
  t ||= new this.constructor(), t.set(...this.get());
897
- const { blockLen: n, buffer: o, length: r, finished: s, destroyed: a, pos: u } = this;
898
- return t.destroyed = a, t.finished = s, t.length = r, t.pos = u, r % n && t.buffer.set(o), t;
636
+ const { blockLen: n, buffer: o, length: r, finished: s, destroyed: c, pos: u } = this;
637
+ return t.destroyed = c, t.finished = s, t.length = r, t.pos = u, r % n && t.buffer.set(o), t;
899
638
  }
900
639
  clone() {
901
640
  return this._cloneInto();
902
641
  }
903
- }
642
+ };
904
643
  const M = /* @__PURE__ */ Uint32Array.from([
905
644
  1779033703,
906
645
  4089235720,
@@ -918,25 +657,25 @@ const M = /* @__PURE__ */ Uint32Array.from([
918
657
  4215389547,
919
658
  1541459225,
920
659
  327033209
921
- ]), rt = /* @__PURE__ */ BigInt(2 ** 32 - 1), $t = /* @__PURE__ */ BigInt(32);
922
- function sn(e, t = !1) {
923
- return t ? { h: Number(e & rt), l: Number(e >> $t & rt) } : { h: Number(e >> $t & rt) | 0, l: Number(e & rt) | 0 };
660
+ ]), rt = /* @__PURE__ */ BigInt(2 ** 32 - 1), Gt = /* @__PURE__ */ BigInt(32);
661
+ function Ye(e, t = !1) {
662
+ return t ? { h: Number(e & rt), l: Number(e >> Gt & rt) } : { h: Number(e >> Gt & rt) | 0, l: Number(e & rt) | 0 };
924
663
  }
925
- function cn(e, t = !1) {
664
+ function ze(e, t = !1) {
926
665
  const n = e.length;
927
666
  let o = new Uint32Array(n), r = new Uint32Array(n);
928
667
  for (let s = 0; s < n; s++) {
929
- const { h: a, l: u } = sn(e[s], t);
930
- [o[s], r[s]] = [a, u];
668
+ const { h: c, l: u } = Ye(e[s], t);
669
+ [o[s], r[s]] = [c, u];
931
670
  }
932
671
  return [o, r];
933
672
  }
934
- const Zt = (e, t, n) => e >>> n, jt = (e, t, n) => e << 32 - n | t >>> n, J = (e, t, n) => e >>> n | t << 32 - n, tt = (e, t, n) => e << 32 - n | t >>> n, ot = (e, t, n) => e << 64 - n | t >>> n - 32, st = (e, t, n) => e >>> n - 32 | t << 64 - n;
673
+ const $t = (e, t, n) => e >>> n, Zt = (e, t, n) => e << 32 - n | t >>> n, J = (e, t, n) => e >>> n | t << 32 - n, tt = (e, t, n) => e << 32 - n | t >>> n, ot = (e, t, n) => e << 64 - n | t >>> n - 32, st = (e, t, n) => e >>> n - 32 | t << 64 - n;
935
674
  function k(e, t, n, o) {
936
675
  const r = (t >>> 0) + (o >>> 0);
937
676
  return { h: e + n + (r / 2 ** 32 | 0) | 0, l: r | 0 };
938
677
  }
939
- const fn = (e, t, n) => (e >>> 0) + (t >>> 0) + (n >>> 0), an = (e, t, n, o) => t + n + o + (e / 2 ** 32 | 0) | 0, un = (e, t, n, o) => (e >>> 0) + (t >>> 0) + (n >>> 0) + (o >>> 0), hn = (e, t, n, o, r) => t + n + o + r + (e / 2 ** 32 | 0) | 0, ln = (e, t, n, o, r) => (e >>> 0) + (t >>> 0) + (n >>> 0) + (o >>> 0) + (r >>> 0), dn = (e, t, n, o, r, s) => t + n + o + r + s + (e / 2 ** 32 | 0) | 0, fe = cn([
678
+ const Xe = (e, t, n) => (e >>> 0) + (t >>> 0) + (n >>> 0), We = (e, t, n, o) => t + n + o + (e / 2 ** 32 | 0) | 0, Pe = (e, t, n, o) => (e >>> 0) + (t >>> 0) + (n >>> 0) + (o >>> 0), Fe = (e, t, n, o, r) => t + n + o + r + (e / 2 ** 32 | 0) | 0, Qe = (e, t, n, o, r) => (e >>> 0) + (t >>> 0) + (n >>> 0) + (o >>> 0) + (r >>> 0), Je = (e, t, n, o, r, s) => t + n + o + r + s + (e / 2 ** 32 | 0) | 0, ie = ze([
940
679
  "0x428a2f98d728ae22",
941
680
  "0x7137449123ef65cd",
942
681
  "0xb5c0fbcfec4d3b2f",
@@ -1017,44 +756,44 @@ const fn = (e, t, n) => (e >>> 0) + (t >>> 0) + (n >>> 0), an = (e, t, n, o) =>
1017
756
  "0x597f299cfc657e2a",
1018
757
  "0x5fcb6fab3ad6faec",
1019
758
  "0x6c44198c4a475817"
1020
- ].map((e) => BigInt(e))), bn = fe[0], gn = fe[1], K = /* @__PURE__ */ new Uint32Array(80), X = /* @__PURE__ */ new Uint32Array(80);
1021
- class wn extends on {
759
+ ].map((e) => BigInt(e))), tn = ie[0], en = ie[1], K = /* @__PURE__ */ new Uint32Array(80), Y = /* @__PURE__ */ new Uint32Array(80);
760
+ class nn extends Ke {
1022
761
  constructor(t) {
1023
762
  super(128, t, 16, !1);
1024
763
  }
1025
764
  // prettier-ignore
1026
765
  get() {
1027
- const { Ah: t, Al: n, Bh: o, Bl: r, Ch: s, Cl: a, Dh: u, Dl: i, Eh: x, El: y, Fh: w, Fl: S, Gh: I, Gl: v, Hh: O, Hl: _ } = this;
1028
- return [t, n, o, r, s, a, u, i, x, y, w, S, I, v, O, _];
766
+ const { Ah: t, Al: n, Bh: o, Bl: r, Ch: s, Cl: c, Dh: u, Dl: i, Eh: x, El: m, Fh: w, Fl: v, Gh: I, Gl: S, Hh: O, Hl: _ } = this;
767
+ return [t, n, o, r, s, c, u, i, x, m, w, v, I, S, O, _];
1029
768
  }
1030
769
  // prettier-ignore
1031
- set(t, n, o, r, s, a, u, i, x, y, w, S, I, v, O, _) {
1032
- this.Ah = t | 0, this.Al = n | 0, this.Bh = o | 0, this.Bl = r | 0, this.Ch = s | 0, this.Cl = a | 0, this.Dh = u | 0, this.Dl = i | 0, this.Eh = x | 0, this.El = y | 0, this.Fh = w | 0, this.Fl = S | 0, this.Gh = I | 0, this.Gl = v | 0, this.Hh = O | 0, this.Hl = _ | 0;
770
+ set(t, n, o, r, s, c, u, i, x, m, w, v, I, S, O, _) {
771
+ this.Ah = t | 0, this.Al = n | 0, this.Bh = o | 0, this.Bl = r | 0, this.Ch = s | 0, this.Cl = c | 0, this.Dh = u | 0, this.Dl = i | 0, this.Eh = x | 0, this.El = m | 0, this.Fh = w | 0, this.Fl = v | 0, this.Gh = I | 0, this.Gl = S | 0, this.Hh = O | 0, this.Hl = _ | 0;
1033
772
  }
1034
773
  process(t, n) {
1035
774
  for (let p = 0; p < 16; p++, n += 4)
1036
- K[p] = t.getUint32(n), X[p] = t.getUint32(n += 4);
775
+ K[p] = t.getUint32(n), Y[p] = t.getUint32(n += 4);
1037
776
  for (let p = 16; p < 80; p++) {
1038
- const N = K[p - 15] | 0, T = X[p - 15] | 0, f = J(N, T, 1) ^ J(N, T, 8) ^ Zt(N, T, 7), h = tt(N, T, 1) ^ tt(N, T, 8) ^ jt(N, T, 7), c = K[p - 2] | 0, l = X[p - 2] | 0, d = J(c, l, 19) ^ ot(c, l, 61) ^ Zt(c, l, 6), b = tt(c, l, 19) ^ st(c, l, 61) ^ jt(c, l, 6), g = un(h, b, X[p - 7], X[p - 16]), m = hn(g, f, d, K[p - 7], K[p - 16]);
1039
- K[p] = m | 0, X[p] = g | 0;
777
+ const N = K[p - 15] | 0, T = Y[p - 15] | 0, a = J(N, T, 1) ^ J(N, T, 8) ^ $t(N, T, 7), h = tt(N, T, 1) ^ tt(N, T, 8) ^ Zt(N, T, 7), f = K[p - 2] | 0, l = Y[p - 2] | 0, d = J(f, l, 19) ^ ot(f, l, 61) ^ $t(f, l, 6), b = tt(f, l, 19) ^ st(f, l, 61) ^ Zt(f, l, 6), g = Pe(h, b, Y[p - 7], Y[p - 16]), y = Fe(g, a, d, K[p - 7], K[p - 16]);
778
+ K[p] = y | 0, Y[p] = g | 0;
1040
779
  }
1041
- let { Ah: o, Al: r, Bh: s, Bl: a, Ch: u, Cl: i, Dh: x, Dl: y, Eh: w, El: S, Fh: I, Fl: v, Gh: O, Gl: _, Hh: E, Hl: A } = this;
780
+ let { Ah: o, Al: r, Bh: s, Bl: c, Ch: u, Cl: i, Dh: x, Dl: m, Eh: w, El: v, Fh: I, Fl: S, Gh: O, Gl: _, Hh: E, Hl: A } = this;
1042
781
  for (let p = 0; p < 80; p++) {
1043
- const N = J(w, S, 14) ^ J(w, S, 18) ^ ot(w, S, 41), T = tt(w, S, 14) ^ tt(w, S, 18) ^ st(w, S, 41), f = w & I ^ ~w & O, h = S & v ^ ~S & _, c = ln(A, T, h, gn[p], X[p]), l = dn(c, E, N, f, bn[p], K[p]), d = c | 0, b = J(o, r, 28) ^ ot(o, r, 34) ^ ot(o, r, 39), g = tt(o, r, 28) ^ st(o, r, 34) ^ st(o, r, 39), m = o & s ^ o & u ^ s & u, B = r & a ^ r & i ^ a & i;
1044
- E = O | 0, A = _ | 0, O = I | 0, _ = v | 0, I = w | 0, v = S | 0, { h: w, l: S } = k(x | 0, y | 0, l | 0, d | 0), x = u | 0, y = i | 0, u = s | 0, i = a | 0, s = o | 0, a = r | 0;
1045
- const R = fn(d, g, B);
1046
- o = an(R, l, b, m), r = R | 0;
782
+ const N = J(w, v, 14) ^ J(w, v, 18) ^ ot(w, v, 41), T = tt(w, v, 14) ^ tt(w, v, 18) ^ st(w, v, 41), a = w & I ^ ~w & O, h = v & S ^ ~v & _, f = Qe(A, T, h, en[p], Y[p]), l = Je(f, E, N, a, tn[p], K[p]), d = f | 0, b = J(o, r, 28) ^ ot(o, r, 34) ^ ot(o, r, 39), g = tt(o, r, 28) ^ st(o, r, 34) ^ st(o, r, 39), y = o & s ^ o & u ^ s & u, B = r & c ^ r & i ^ c & i;
783
+ E = O | 0, A = _ | 0, O = I | 0, _ = S | 0, I = w | 0, S = v | 0, { h: w, l: v } = k(x | 0, m | 0, l | 0, d | 0), x = u | 0, m = i | 0, u = s | 0, i = c | 0, s = o | 0, c = r | 0;
784
+ const R = Xe(d, g, B);
785
+ o = We(R, l, b, y), r = R | 0;
1047
786
  }
1048
- ({ h: o, l: r } = k(this.Ah | 0, this.Al | 0, o | 0, r | 0)), { h: s, l: a } = k(this.Bh | 0, this.Bl | 0, s | 0, a | 0), { h: u, l: i } = k(this.Ch | 0, this.Cl | 0, u | 0, i | 0), { h: x, l: y } = k(this.Dh | 0, this.Dl | 0, x | 0, y | 0), { h: w, l: S } = k(this.Eh | 0, this.El | 0, w | 0, S | 0), { h: I, l: v } = k(this.Fh | 0, this.Fl | 0, I | 0, v | 0), { h: O, l: _ } = k(this.Gh | 0, this.Gl | 0, O | 0, _ | 0), { h: E, l: A } = k(this.Hh | 0, this.Hl | 0, E | 0, A | 0), this.set(o, r, s, a, u, i, x, y, w, S, I, v, O, _, E, A);
787
+ ({ h: o, l: r } = k(this.Ah | 0, this.Al | 0, o | 0, r | 0)), { h: s, l: c } = k(this.Bh | 0, this.Bl | 0, s | 0, c | 0), { h: u, l: i } = k(this.Ch | 0, this.Cl | 0, u | 0, i | 0), { h: x, l: m } = k(this.Dh | 0, this.Dl | 0, x | 0, m | 0), { h: w, l: v } = k(this.Eh | 0, this.El | 0, w | 0, v | 0), { h: I, l: S } = k(this.Fh | 0, this.Fl | 0, I | 0, S | 0), { h: O, l: _ } = k(this.Gh | 0, this.Gl | 0, O | 0, _ | 0), { h: E, l: A } = k(this.Hh | 0, this.Hl | 0, E | 0, A | 0), this.set(o, r, s, c, u, i, x, m, w, v, I, S, O, _, E, A);
1049
788
  }
1050
789
  roundClean() {
1051
- Et(K, X);
790
+ mt(K, Y);
1052
791
  }
1053
792
  destroy() {
1054
- Et(this.buffer), this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
793
+ mt(this.buffer), this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1055
794
  }
1056
795
  }
1057
- class xn extends wn {
796
+ class rn extends nn {
1058
797
  Ah = M[0] | 0;
1059
798
  Al = M[1] | 0;
1060
799
  Bh = M[2] | 0;
@@ -1075,19 +814,19 @@ class xn extends wn {
1075
814
  super(64);
1076
815
  }
1077
816
  }
1078
- const pn = /* @__PURE__ */ en(
1079
- () => new xn(),
1080
- /* @__PURE__ */ rn(3)
817
+ const on = /* @__PURE__ */ je(
818
+ () => new rn(),
819
+ /* @__PURE__ */ ke(3)
1081
820
  );
1082
- const ae = /* @__PURE__ */ BigInt(0), Vt = /* @__PURE__ */ BigInt(1);
1083
- function Bt(e, t = "") {
821
+ const ce = /* @__PURE__ */ BigInt(0), jt = /* @__PURE__ */ BigInt(1);
822
+ function Et(e, t = "") {
1084
823
  if (typeof e != "boolean") {
1085
824
  const n = t && `"${t}" `;
1086
825
  throw new Error(n + "expected boolean, got type=" + typeof e);
1087
826
  }
1088
827
  return e;
1089
828
  }
1090
- function mn(e) {
829
+ function sn(e) {
1091
830
  if (typeof e == "bigint") {
1092
831
  if (!ct(e))
1093
832
  throw new Error("positive bigint expected, got " + e);
@@ -1095,54 +834,54 @@ function mn(e) {
1095
834
  Rt(e);
1096
835
  return e;
1097
836
  }
1098
- function ue(e) {
837
+ function fe(e) {
1099
838
  if (typeof e != "string")
1100
839
  throw new Error("hex string expected, got " + typeof e);
1101
- return e === "" ? ae : BigInt("0x" + e);
840
+ return e === "" ? ce : BigInt("0x" + e);
1102
841
  }
1103
- function yn(e) {
1104
- return ue(It(e));
842
+ function cn(e) {
843
+ return fe(It(e));
1105
844
  }
1106
845
  function ft(e) {
1107
- return ue(It(St(D(e)).reverse()));
846
+ return fe(It(Bt(D(e)).reverse()));
1108
847
  }
1109
- function he(e, t) {
1110
- Rt(t), e = mn(e);
1111
- const n = ce(e.toString(16).padStart(t * 2, "0"));
848
+ function ae(e, t) {
849
+ Rt(t), e = sn(e);
850
+ const n = se(e.toString(16).padStart(t * 2, "0"));
1112
851
  if (n.length !== t)
1113
852
  throw new Error("number too large");
1114
853
  return n;
1115
854
  }
1116
- function En(e, t) {
1117
- return he(e, t).reverse();
855
+ function fn(e, t) {
856
+ return ae(e, t).reverse();
1118
857
  }
1119
- function St(e) {
858
+ function Bt(e) {
1120
859
  return Uint8Array.from(e);
1121
860
  }
1122
- const ct = (e) => typeof e == "bigint" && ae <= e;
1123
- function Bn(e, t, n) {
861
+ const ct = (e) => typeof e == "bigint" && ce <= e;
862
+ function an(e, t, n) {
1124
863
  return ct(e) && ct(t) && ct(n) && t <= e && e < n;
1125
864
  }
1126
- function kt(e, t, n, o) {
1127
- if (!Bn(t, n, o))
865
+ function Vt(e, t, n, o) {
866
+ if (!an(t, n, o))
1128
867
  throw new Error("expected valid " + e + ": " + n + " <= n < " + o + ", got " + t);
1129
868
  }
1130
- const Sn = (e) => (Vt << BigInt(e)) - Vt;
869
+ const un = (e) => (jt << BigInt(e)) - jt;
1131
870
  function _t(e, t = {}, n = {}) {
1132
871
  if (!e || typeof e != "object")
1133
872
  throw new Error("expected valid options object");
1134
- function o(s, a, u) {
873
+ function o(s, c, u) {
1135
874
  const i = e[s];
1136
875
  if (u && i === void 0)
1137
876
  return;
1138
877
  const x = typeof i;
1139
- if (x !== a || i === null)
1140
- throw new Error(`param "${s}" is invalid: expected ${a}, got ${x}`);
878
+ if (x !== c || i === null)
879
+ throw new Error(`param "${s}" is invalid: expected ${c}, got ${x}`);
1141
880
  }
1142
- const r = (s, a) => Object.entries(s).forEach(([u, i]) => o(u, i, a));
881
+ const r = (s, c) => Object.entries(s).forEach(([u, i]) => o(u, i, c));
1143
882
  r(t, !1), r(n, !0);
1144
883
  }
1145
- function Yt(e) {
884
+ function kt(e) {
1146
885
  const t = /* @__PURE__ */ new WeakMap();
1147
886
  return (n, ...o) => {
1148
887
  const r = t.get(n);
@@ -1152,91 +891,91 @@ function Yt(e) {
1152
891
  return t.set(n, s), s;
1153
892
  };
1154
893
  }
1155
- const $ = /* @__PURE__ */ BigInt(0), G = /* @__PURE__ */ BigInt(1), F = /* @__PURE__ */ BigInt(2), le = /* @__PURE__ */ BigInt(3), de = /* @__PURE__ */ BigInt(4), be = /* @__PURE__ */ BigInt(5), vn = /* @__PURE__ */ BigInt(7), ge = /* @__PURE__ */ BigInt(8), An = /* @__PURE__ */ BigInt(9), we = /* @__PURE__ */ BigInt(16);
1156
- function U(e, t) {
894
+ const $ = /* @__PURE__ */ BigInt(0), G = /* @__PURE__ */ BigInt(1), F = /* @__PURE__ */ BigInt(2), ue = /* @__PURE__ */ BigInt(3), he = /* @__PURE__ */ BigInt(4), le = /* @__PURE__ */ BigInt(5), hn = /* @__PURE__ */ BigInt(7), de = /* @__PURE__ */ BigInt(8), ln = /* @__PURE__ */ BigInt(9), be = /* @__PURE__ */ BigInt(16);
895
+ function H(e, t) {
1157
896
  const n = e % t;
1158
897
  return n >= $ ? n : t + n;
1159
898
  }
1160
- function j(e, t, n) {
899
+ function Z(e, t, n) {
1161
900
  let o = e;
1162
901
  for (; t-- > $; )
1163
902
  o *= o, o %= n;
1164
903
  return o;
1165
904
  }
1166
- function zt(e, t) {
905
+ function Kt(e, t) {
1167
906
  if (e === $)
1168
907
  throw new Error("invert: expected non-zero number");
1169
908
  if (t <= $)
1170
909
  throw new Error("invert: expected positive modulus, got " + t);
1171
- let n = U(e, t), o = t, r = $, s = G;
910
+ let n = H(e, t), o = t, r = $, s = G;
1172
911
  for (; n !== $; ) {
1173
912
  const u = o / n, i = o % n, x = r - s * u;
1174
913
  o = n, n = i, r = s, s = x;
1175
914
  }
1176
915
  if (o !== G)
1177
916
  throw new Error("invert: does not exist");
1178
- return U(r, t);
917
+ return H(r, t);
1179
918
  }
1180
919
  function Nt(e, t, n) {
1181
920
  if (!e.eql(e.sqr(t), n))
1182
921
  throw new Error("Cannot find square root");
1183
922
  }
1184
- function xe(e, t) {
1185
- const n = (e.ORDER + G) / de, o = e.pow(t, n);
923
+ function ge(e, t) {
924
+ const n = (e.ORDER + G) / he, o = e.pow(t, n);
1186
925
  return Nt(e, o, t), o;
1187
926
  }
1188
- function Rn(e, t) {
1189
- const n = (e.ORDER - be) / ge, o = e.mul(t, F), r = e.pow(o, n), s = e.mul(t, r), a = e.mul(e.mul(s, F), r), u = e.mul(s, e.sub(a, e.ONE));
927
+ function dn(e, t) {
928
+ const n = (e.ORDER - le) / de, o = e.mul(t, F), r = e.pow(o, n), s = e.mul(t, r), c = e.mul(e.mul(s, F), r), u = e.mul(s, e.sub(c, e.ONE));
1190
929
  return Nt(e, u, t), u;
1191
930
  }
1192
- function In(e) {
1193
- const t = Ot(e), n = pe(e), o = n(t, t.neg(t.ONE)), r = n(t, o), s = n(t, t.neg(o)), a = (e + vn) / we;
931
+ function bn(e) {
932
+ const t = Ot(e), n = we(e), o = n(t, t.neg(t.ONE)), r = n(t, o), s = n(t, t.neg(o)), c = (e + hn) / be;
1194
933
  return (u, i) => {
1195
- let x = u.pow(i, a), y = u.mul(x, o);
1196
- const w = u.mul(x, r), S = u.mul(x, s), I = u.eql(u.sqr(y), i), v = u.eql(u.sqr(w), i);
1197
- x = u.cmov(x, y, I), y = u.cmov(S, w, v);
1198
- const O = u.eql(u.sqr(y), i), _ = u.cmov(x, y, O);
934
+ let x = u.pow(i, c), m = u.mul(x, o);
935
+ const w = u.mul(x, r), v = u.mul(x, s), I = u.eql(u.sqr(m), i), S = u.eql(u.sqr(w), i);
936
+ x = u.cmov(x, m, I), m = u.cmov(v, w, S);
937
+ const O = u.eql(u.sqr(m), i), _ = u.cmov(x, m, O);
1199
938
  return Nt(u, _, i), _;
1200
939
  };
1201
940
  }
1202
- function pe(e) {
1203
- if (e < le)
941
+ function we(e) {
942
+ if (e < ue)
1204
943
  throw new Error("sqrt is not defined for small field");
1205
944
  let t = e - G, n = 0;
1206
945
  for (; t % F === $; )
1207
946
  t /= F, n++;
1208
947
  let o = F;
1209
948
  const r = Ot(e);
1210
- for (; Kt(r, o) === 1; )
949
+ for (; Yt(r, o) === 1; )
1211
950
  if (o++ > 1e3)
1212
951
  throw new Error("Cannot find square root: probably non-prime P");
1213
952
  if (n === 1)
1214
- return xe;
953
+ return ge;
1215
954
  let s = r.pow(o, t);
1216
- const a = (t + G) / F;
955
+ const c = (t + G) / F;
1217
956
  return function(i, x) {
1218
957
  if (i.is0(x))
1219
958
  return x;
1220
- if (Kt(i, x) !== 1)
959
+ if (Yt(i, x) !== 1)
1221
960
  throw new Error("Cannot find square root");
1222
- let y = n, w = i.mul(i.ONE, s), S = i.pow(x, t), I = i.pow(x, a);
1223
- for (; !i.eql(S, i.ONE); ) {
1224
- if (i.is0(S))
961
+ let m = n, w = i.mul(i.ONE, s), v = i.pow(x, t), I = i.pow(x, c);
962
+ for (; !i.eql(v, i.ONE); ) {
963
+ if (i.is0(v))
1225
964
  return i.ZERO;
1226
- let v = 1, O = i.sqr(S);
965
+ let S = 1, O = i.sqr(v);
1227
966
  for (; !i.eql(O, i.ONE); )
1228
- if (v++, O = i.sqr(O), v === y)
967
+ if (S++, O = i.sqr(O), S === m)
1229
968
  throw new Error("Cannot find square root");
1230
- const _ = G << BigInt(y - v - 1), E = i.pow(w, _);
1231
- y = v, w = i.sqr(E), S = i.mul(S, w), I = i.mul(I, E);
969
+ const _ = G << BigInt(m - S - 1), E = i.pow(w, _);
970
+ m = S, w = i.sqr(E), v = i.mul(v, w), I = i.mul(I, E);
1232
971
  }
1233
972
  return I;
1234
973
  };
1235
974
  }
1236
- function _n(e) {
1237
- return e % de === le ? xe : e % ge === be ? Rn : e % we === An ? In(e) : pe(e);
975
+ function gn(e) {
976
+ return e % he === ue ? ge : e % de === le ? dn : e % be === ln ? bn(e) : we(e);
1238
977
  }
1239
- const Nn = (e, t) => (U(e, t) & G) === G, On = [
978
+ const wn = (e, t) => (H(e, t) & G) === G, xn = [
1240
979
  "create",
1241
980
  "isValid",
1242
981
  "is0",
@@ -1255,15 +994,15 @@ const Nn = (e, t) => (U(e, t) & G) === G, On = [
1255
994
  "mulN",
1256
995
  "sqrN"
1257
996
  ];
1258
- function Tn(e) {
997
+ function pn(e) {
1259
998
  const t = {
1260
999
  ORDER: "bigint",
1261
1000
  BYTES: "number",
1262
1001
  BITS: "number"
1263
- }, n = On.reduce((o, r) => (o[r] = "function", o), t);
1002
+ }, n = xn.reduce((o, r) => (o[r] = "function", o), t);
1264
1003
  return _t(e, n), e;
1265
1004
  }
1266
- function Cn(e, t, n) {
1005
+ function yn(e, t, n) {
1267
1006
  if (n < $)
1268
1007
  throw new Error("invalid exponent, negatives unsupported");
1269
1008
  if (n === $)
@@ -1275,22 +1014,22 @@ function Cn(e, t, n) {
1275
1014
  n & G && (o = e.mul(o, r)), r = e.sqr(r), n >>= G;
1276
1015
  return o;
1277
1016
  }
1278
- function me(e, t, n = !1) {
1279
- const o = new Array(t.length).fill(n ? e.ZERO : void 0), r = t.reduce((a, u, i) => e.is0(u) ? a : (o[i] = a, e.mul(a, u)), e.ONE), s = e.inv(r);
1280
- return t.reduceRight((a, u, i) => e.is0(u) ? a : (o[i] = e.mul(a, o[i]), e.mul(a, u)), s), o;
1017
+ function xe(e, t, n = !1) {
1018
+ const o = new Array(t.length).fill(n ? e.ZERO : void 0), r = t.reduce((c, u, i) => e.is0(u) ? c : (o[i] = c, e.mul(c, u)), e.ONE), s = e.inv(r);
1019
+ return t.reduceRight((c, u, i) => e.is0(u) ? c : (o[i] = e.mul(c, o[i]), e.mul(c, u)), s), o;
1281
1020
  }
1282
- function Kt(e, t) {
1283
- const n = (e.ORDER - G) / F, o = e.pow(t, n), r = e.eql(o, e.ONE), s = e.eql(o, e.ZERO), a = e.eql(o, e.neg(e.ONE));
1284
- if (!r && !s && !a)
1021
+ function Yt(e, t) {
1022
+ const n = (e.ORDER - G) / F, o = e.pow(t, n), r = e.eql(o, e.ONE), s = e.eql(o, e.ZERO), c = e.eql(o, e.neg(e.ONE));
1023
+ if (!r && !s && !c)
1285
1024
  throw new Error("invalid Legendre symbol result");
1286
1025
  return r ? 1 : s ? 0 : -1;
1287
1026
  }
1288
- function Ln(e, t) {
1027
+ function mn(e, t) {
1289
1028
  t !== void 0 && Rt(t);
1290
1029
  const n = t !== void 0 ? t : e.toString(2).length, o = Math.ceil(n / 8);
1291
1030
  return { nBitLength: n, nByteLength: o };
1292
1031
  }
1293
- class Un {
1032
+ class En {
1294
1033
  ORDER;
1295
1034
  BITS;
1296
1035
  BYTES;
@@ -1306,13 +1045,13 @@ class Un {
1306
1045
  throw new Error("invalid field: expected ORDER > 0, got " + t);
1307
1046
  let o;
1308
1047
  this.isLE = !1, n != null && typeof n == "object" && (typeof n.BITS == "number" && (o = n.BITS), typeof n.sqrt == "function" && (this.sqrt = n.sqrt), typeof n.isLE == "boolean" && (this.isLE = n.isLE), n.allowedLengths && (this._lengths = n.allowedLengths?.slice()), typeof n.modFromBytes == "boolean" && (this._mod = n.modFromBytes));
1309
- const { nBitLength: r, nByteLength: s } = Ln(t, o);
1048
+ const { nBitLength: r, nByteLength: s } = mn(t, o);
1310
1049
  if (s > 2048)
1311
1050
  throw new Error("invalid field: expected ORDER of <= 2048 bytes");
1312
1051
  this.ORDER = t, this.BITS = r, this.BYTES = s, this._sqrt = void 0, Object.preventExtensions(this);
1313
1052
  }
1314
1053
  create(t) {
1315
- return U(t, this.ORDER);
1054
+ return H(t, this.ORDER);
1316
1055
  }
1317
1056
  isValid(t) {
1318
1057
  if (typeof t != "bigint")
@@ -1330,28 +1069,28 @@ class Un {
1330
1069
  return (t & G) === G;
1331
1070
  }
1332
1071
  neg(t) {
1333
- return U(-t, this.ORDER);
1072
+ return H(-t, this.ORDER);
1334
1073
  }
1335
1074
  eql(t, n) {
1336
1075
  return t === n;
1337
1076
  }
1338
1077
  sqr(t) {
1339
- return U(t * t, this.ORDER);
1078
+ return H(t * t, this.ORDER);
1340
1079
  }
1341
1080
  add(t, n) {
1342
- return U(t + n, this.ORDER);
1081
+ return H(t + n, this.ORDER);
1343
1082
  }
1344
1083
  sub(t, n) {
1345
- return U(t - n, this.ORDER);
1084
+ return H(t - n, this.ORDER);
1346
1085
  }
1347
1086
  mul(t, n) {
1348
- return U(t * n, this.ORDER);
1087
+ return H(t * n, this.ORDER);
1349
1088
  }
1350
1089
  pow(t, n) {
1351
- return Cn(this, t, n);
1090
+ return yn(this, t, n);
1352
1091
  }
1353
1092
  div(t, n) {
1354
- return U(t * zt(n, this.ORDER), this.ORDER);
1093
+ return H(t * Kt(n, this.ORDER), this.ORDER);
1355
1094
  }
1356
1095
  // Same as above, but doesn't normalize
1357
1096
  sqrN(t) {
@@ -1367,17 +1106,17 @@ class Un {
1367
1106
  return t * n;
1368
1107
  }
1369
1108
  inv(t) {
1370
- return zt(t, this.ORDER);
1109
+ return Kt(t, this.ORDER);
1371
1110
  }
1372
1111
  sqrt(t) {
1373
- return this._sqrt || (this._sqrt = _n(this.ORDER)), this._sqrt(this, t);
1112
+ return this._sqrt || (this._sqrt = gn(this.ORDER)), this._sqrt(this, t);
1374
1113
  }
1375
1114
  toBytes(t) {
1376
- return this.isLE ? En(t, this.BYTES) : he(t, this.BYTES);
1115
+ return this.isLE ? fn(t, this.BYTES) : ae(t, this.BYTES);
1377
1116
  }
1378
1117
  fromBytes(t, n = !1) {
1379
1118
  D(t);
1380
- const { _lengths: o, BYTES: r, isLE: s, ORDER: a, _mod: u } = this;
1119
+ const { _lengths: o, BYTES: r, isLE: s, ORDER: c, _mod: u } = this;
1381
1120
  if (o) {
1382
1121
  if (!o.includes(t.length) || t.length > r)
1383
1122
  throw new Error("Field.fromBytes: expected " + o + " bytes, got " + t.length);
@@ -1386,14 +1125,14 @@ class Un {
1386
1125
  }
1387
1126
  if (t.length !== r)
1388
1127
  throw new Error("Field.fromBytes: expected " + r + " bytes, got " + t.length);
1389
- let i = s ? ft(t) : yn(t);
1390
- if (u && (i = U(i, a)), !n && !this.isValid(i))
1128
+ let i = s ? ft(t) : cn(t);
1129
+ if (u && (i = H(i, c)), !n && !this.isValid(i))
1391
1130
  throw new Error("invalid field element: outside of range 0..ORDER");
1392
1131
  return i;
1393
1132
  }
1394
1133
  // TODO: we don't need it here, move out to separate fn
1395
1134
  invertBatch(t) {
1396
- return me(this, t);
1135
+ return xe(this, t);
1397
1136
  }
1398
1137
  // We can't move this out because Fp6, Fp12 implement it
1399
1138
  // and it's unclear what to return in there.
@@ -1402,42 +1141,42 @@ class Un {
1402
1141
  }
1403
1142
  }
1404
1143
  function Ot(e, t = {}) {
1405
- return new Un(e, t);
1144
+ return new En(e, t);
1406
1145
  }
1407
1146
  const at = /* @__PURE__ */ BigInt(0), vt = /* @__PURE__ */ BigInt(1);
1408
- function Xt(e, t) {
1147
+ function zt(e, t) {
1409
1148
  const n = t.negate();
1410
1149
  return e ? n : t;
1411
1150
  }
1412
- function gt(e, t) {
1413
- const n = me(e.Fp, t.map((o) => o.Z));
1151
+ function dt(e, t) {
1152
+ const n = xe(e.Fp, t.map((o) => o.Z));
1414
1153
  return t.map((o, r) => e.fromAffine(o.toAffine(n[r])));
1415
1154
  }
1416
- function ye(e, t) {
1155
+ function pe(e, t) {
1417
1156
  if (!Number.isSafeInteger(e) || e <= 0 || e > t)
1418
1157
  throw new Error("invalid window size, expected [1.." + t + "], got W=" + e);
1419
1158
  }
1420
- function wt(e, t) {
1421
- ye(e, t);
1422
- const n = Math.ceil(t / e) + 1, o = 2 ** (e - 1), r = 2 ** e, s = Sn(e), a = BigInt(e);
1423
- return { windows: n, windowSize: o, mask: s, maxNumber: r, shiftBy: a };
1159
+ function bt(e, t) {
1160
+ pe(e, t);
1161
+ const n = Math.ceil(t / e) + 1, o = 2 ** (e - 1), r = 2 ** e, s = un(e), c = BigInt(e);
1162
+ return { windows: n, windowSize: o, mask: s, maxNumber: r, shiftBy: c };
1424
1163
  }
1425
- function Wt(e, t, n) {
1426
- const { windowSize: o, mask: r, maxNumber: s, shiftBy: a } = n;
1427
- let u = Number(e & r), i = e >> a;
1164
+ function Xt(e, t, n) {
1165
+ const { windowSize: o, mask: r, maxNumber: s, shiftBy: c } = n;
1166
+ let u = Number(e & r), i = e >> c;
1428
1167
  u > o && (u -= s, i += vt);
1429
- const x = t * o, y = x + Math.abs(u) - 1, w = u === 0, S = u < 0, I = t % 2 !== 0;
1430
- return { nextN: i, offset: y, isZero: w, isNeg: S, isNegF: I, offsetF: x };
1168
+ const x = t * o, m = x + Math.abs(u) - 1, w = u === 0, v = u < 0, I = t % 2 !== 0;
1169
+ return { nextN: i, offset: m, isZero: w, isNeg: v, isNegF: I, offsetF: x };
1431
1170
  }
1432
- const xt = /* @__PURE__ */ new WeakMap(), Ee = /* @__PURE__ */ new WeakMap();
1433
- function pt(e) {
1434
- return Ee.get(e) || 1;
1171
+ const gt = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap();
1172
+ function wt(e) {
1173
+ return ye.get(e) || 1;
1435
1174
  }
1436
- function Pt(e) {
1175
+ function Wt(e) {
1437
1176
  if (e !== at)
1438
1177
  throw new Error("invalid wNAF");
1439
1178
  }
1440
- class Hn {
1179
+ class Bn {
1441
1180
  BASE;
1442
1181
  ZERO;
1443
1182
  Fn;
@@ -1466,13 +1205,13 @@ class Hn {
1466
1205
  * @returns precomputed point tables flattened to a single array
1467
1206
  */
1468
1207
  precomputeWindow(t, n) {
1469
- const { windows: o, windowSize: r } = wt(n, this.bits), s = [];
1470
- let a = t, u = a;
1208
+ const { windows: o, windowSize: r } = bt(n, this.bits), s = [];
1209
+ let c = t, u = c;
1471
1210
  for (let i = 0; i < o; i++) {
1472
- u = a, s.push(u);
1211
+ u = c, s.push(u);
1473
1212
  for (let x = 1; x < r; x++)
1474
- u = u.add(a), s.push(u);
1475
- a = u.double();
1213
+ u = u.add(c), s.push(u);
1214
+ c = u.double();
1476
1215
  }
1477
1216
  return s;
1478
1217
  }
@@ -1486,12 +1225,12 @@ class Hn {
1486
1225
  if (!this.Fn.isValid(o))
1487
1226
  throw new Error("invalid scalar");
1488
1227
  let r = this.ZERO, s = this.BASE;
1489
- const a = wt(t, this.bits);
1490
- for (let u = 0; u < a.windows; u++) {
1491
- const { nextN: i, offset: x, isZero: y, isNeg: w, isNegF: S, offsetF: I } = Wt(o, u, a);
1492
- o = i, y ? s = s.add(Xt(S, n[I])) : r = r.add(Xt(w, n[x]));
1228
+ const c = bt(t, this.bits);
1229
+ for (let u = 0; u < c.windows; u++) {
1230
+ const { nextN: i, offset: x, isZero: m, isNeg: w, isNegF: v, offsetF: I } = Xt(o, u, c);
1231
+ o = i, m ? s = s.add(zt(v, n[I])) : r = r.add(zt(w, n[x]));
1493
1232
  }
1494
- return Pt(o), { p: r, f: s };
1233
+ return Wt(o), { p: r, f: s };
1495
1234
  }
1496
1235
  /**
1497
1236
  * Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form.
@@ -1499,47 +1238,47 @@ class Hn {
1499
1238
  * @returns point
1500
1239
  */
1501
1240
  wNAFUnsafe(t, n, o, r = this.ZERO) {
1502
- const s = wt(t, this.bits);
1503
- for (let a = 0; a < s.windows && o !== at; a++) {
1504
- const { nextN: u, offset: i, isZero: x, isNeg: y } = Wt(o, a, s);
1241
+ const s = bt(t, this.bits);
1242
+ for (let c = 0; c < s.windows && o !== at; c++) {
1243
+ const { nextN: u, offset: i, isZero: x, isNeg: m } = Xt(o, c, s);
1505
1244
  if (o = u, !x) {
1506
1245
  const w = n[i];
1507
- r = r.add(y ? w.negate() : w);
1246
+ r = r.add(m ? w.negate() : w);
1508
1247
  }
1509
1248
  }
1510
- return Pt(o), r;
1249
+ return Wt(o), r;
1511
1250
  }
1512
1251
  getPrecomputes(t, n, o) {
1513
- let r = xt.get(n);
1514
- return r || (r = this.precomputeWindow(n, t), t !== 1 && (typeof o == "function" && (r = o(r)), xt.set(n, r))), r;
1252
+ let r = gt.get(n);
1253
+ return r || (r = this.precomputeWindow(n, t), t !== 1 && (typeof o == "function" && (r = o(r)), gt.set(n, r))), r;
1515
1254
  }
1516
1255
  cached(t, n, o) {
1517
- const r = pt(t);
1256
+ const r = wt(t);
1518
1257
  return this.wNAF(r, this.getPrecomputes(r, t, o), n);
1519
1258
  }
1520
1259
  unsafe(t, n, o, r) {
1521
- const s = pt(t);
1260
+ const s = wt(t);
1522
1261
  return s === 1 ? this._unsafeLadder(t, n, r) : this.wNAFUnsafe(s, this.getPrecomputes(s, t, o), n, r);
1523
1262
  }
1524
1263
  // We calculate precomputes for elliptic curve point multiplication
1525
1264
  // using windowed method. This specifies window size and
1526
1265
  // stores precomputed values. Usually only base point would be precomputed.
1527
1266
  createCache(t, n) {
1528
- ye(n, this.bits), Ee.set(t, n), xt.delete(t);
1267
+ pe(n, this.bits), ye.set(t, n), gt.delete(t);
1529
1268
  }
1530
1269
  hasCache(t) {
1531
- return pt(t) !== 1;
1270
+ return wt(t) !== 1;
1532
1271
  }
1533
1272
  }
1534
- function Ft(e, t, n) {
1273
+ function Pt(e, t, n) {
1535
1274
  if (t) {
1536
1275
  if (t.ORDER !== e)
1537
1276
  throw new Error("Field.ORDER must match order: Fp == p, Fn == n");
1538
- return Tn(t), t;
1277
+ return pn(t), t;
1539
1278
  } else
1540
1279
  return Ot(e, { isLE: n });
1541
1280
  }
1542
- function Dn(e, t, n = {}, o) {
1281
+ function vn(e, t, n = {}, o) {
1543
1282
  if (o === void 0 && (o = e === "edwards"), !t || typeof t != "object")
1544
1283
  throw new Error(`expected valid ${e} CURVE object`);
1545
1284
  for (const i of ["p", "n", "h"]) {
@@ -1547,71 +1286,71 @@ function Dn(e, t, n = {}, o) {
1547
1286
  if (!(typeof x == "bigint" && x > at))
1548
1287
  throw new Error(`CURVE.${i} must be positive bigint`);
1549
1288
  }
1550
- const r = Ft(t.p, n.Fp, o), s = Ft(t.n, n.Fn, o), u = ["Gx", "Gy", "a", "d"];
1289
+ const r = Pt(t.p, n.Fp, o), s = Pt(t.n, n.Fn, o), u = ["Gx", "Gy", "a", "d"];
1551
1290
  for (const i of u)
1552
1291
  if (!r.isValid(t[i]))
1553
1292
  throw new Error(`CURVE.${i} must be valid field element of CURVE.Fp`);
1554
1293
  return t = Object.freeze(Object.assign({}, t)), { CURVE: t, Fp: r, Fn: s };
1555
1294
  }
1556
- function qn(e, t) {
1295
+ function Sn(e, t) {
1557
1296
  return function(o) {
1558
1297
  const r = e(o);
1559
1298
  return { secretKey: r, publicKey: t(r) };
1560
1299
  };
1561
1300
  }
1562
- const W = BigInt(0), H = BigInt(1), mt = BigInt(2), Mn = BigInt(8);
1563
- function Gn(e, t, n, o) {
1564
- const r = e.sqr(n), s = e.sqr(o), a = e.add(e.mul(t.a, r), s), u = e.add(e.ONE, e.mul(t.d, e.mul(r, s)));
1565
- return e.eql(a, u);
1301
+ const z = BigInt(0), U = BigInt(1), xt = BigInt(2), An = BigInt(8);
1302
+ function Rn(e, t, n, o) {
1303
+ const r = e.sqr(n), s = e.sqr(o), c = e.add(e.mul(t.a, r), s), u = e.add(e.ONE, e.mul(t.d, e.mul(r, s)));
1304
+ return e.eql(c, u);
1566
1305
  }
1567
- function $n(e, t = {}) {
1568
- const n = Dn("edwards", e, t, t.FpFnLE), { Fp: o, Fn: r } = n;
1306
+ function In(e, t = {}) {
1307
+ const n = vn("edwards", e, t, t.FpFnLE), { Fp: o, Fn: r } = n;
1569
1308
  let s = n.CURVE;
1570
- const { h: a } = s;
1309
+ const { h: c } = s;
1571
1310
  _t(t, {}, { uvRatio: "function" });
1572
- const u = mt << BigInt(r.BYTES * 8) - H, i = (_) => o.create(_), x = t.uvRatio || ((_, E) => {
1311
+ const u = xt << BigInt(r.BYTES * 8) - U, i = (_) => o.create(_), x = t.uvRatio || ((_, E) => {
1573
1312
  try {
1574
1313
  return { isValid: !0, value: o.sqrt(o.div(_, E)) };
1575
1314
  } catch {
1576
- return { isValid: !1, value: W };
1315
+ return { isValid: !1, value: z };
1577
1316
  }
1578
1317
  });
1579
- if (!Gn(o, s, s.Gx, s.Gy))
1318
+ if (!Rn(o, s, s.Gx, s.Gy))
1580
1319
  throw new Error("bad curve params: generator point");
1581
- function y(_, E, A = !1) {
1582
- const p = A ? H : W;
1583
- return kt("coordinate " + _, E, p, u), E;
1320
+ function m(_, E, A = !1) {
1321
+ const p = A ? U : z;
1322
+ return Vt("coordinate " + _, E, p, u), E;
1584
1323
  }
1585
1324
  function w(_) {
1586
- if (!(_ instanceof v))
1325
+ if (!(_ instanceof S))
1587
1326
  throw new Error("EdwardsPoint expected");
1588
1327
  }
1589
- const S = Yt((_, E) => {
1328
+ const v = kt((_, E) => {
1590
1329
  const { X: A, Y: p, Z: N } = _, T = _.is0();
1591
- E == null && (E = T ? Mn : o.inv(N));
1592
- const f = i(A * E), h = i(p * E), c = o.mul(N, E);
1330
+ E == null && (E = T ? An : o.inv(N));
1331
+ const a = i(A * E), h = i(p * E), f = o.mul(N, E);
1593
1332
  if (T)
1594
- return { x: W, y: H };
1595
- if (c !== H)
1333
+ return { x: z, y: U };
1334
+ if (f !== U)
1596
1335
  throw new Error("invZ was invalid");
1597
- return { x: f, y: h };
1598
- }), I = Yt((_) => {
1336
+ return { x: a, y: h };
1337
+ }), I = kt((_) => {
1599
1338
  const { a: E, d: A } = s;
1600
1339
  if (_.is0())
1601
1340
  throw new Error("bad point: ZERO");
1602
- const { X: p, Y: N, Z: T, T: f } = _, h = i(p * p), c = i(N * N), l = i(T * T), d = i(l * l), b = i(h * E), g = i(l * i(b + c)), m = i(d + i(A * i(h * c)));
1603
- if (g !== m)
1341
+ const { X: p, Y: N, Z: T, T: a } = _, h = i(p * p), f = i(N * N), l = i(T * T), d = i(l * l), b = i(h * E), g = i(l * i(b + f)), y = i(d + i(A * i(h * f)));
1342
+ if (g !== y)
1604
1343
  throw new Error("bad point: equation left != right (1)");
1605
- const B = i(p * N), R = i(T * f);
1344
+ const B = i(p * N), R = i(T * a);
1606
1345
  if (B !== R)
1607
1346
  throw new Error("bad point: equation left != right (2)");
1608
1347
  return !0;
1609
1348
  });
1610
- class v {
1349
+ class S {
1611
1350
  // base / generator point
1612
- static BASE = new v(s.Gx, s.Gy, H, i(s.Gx * s.Gy));
1351
+ static BASE = new S(s.Gx, s.Gy, U, i(s.Gx * s.Gy));
1613
1352
  // zero / infinity / identity point
1614
- static ZERO = new v(W, H, H, W);
1353
+ static ZERO = new S(z, U, U, z);
1615
1354
  // 0, 1, 1, 0
1616
1355
  // math field
1617
1356
  static Fp = o;
@@ -1622,36 +1361,36 @@ function $n(e, t = {}) {
1622
1361
  Z;
1623
1362
  T;
1624
1363
  constructor(E, A, p, N) {
1625
- this.X = y("x", E), this.Y = y("y", A), this.Z = y("z", p, !0), this.T = y("t", N), Object.freeze(this);
1364
+ this.X = m("x", E), this.Y = m("y", A), this.Z = m("z", p, !0), this.T = m("t", N), Object.freeze(this);
1626
1365
  }
1627
1366
  static CURVE() {
1628
1367
  return s;
1629
1368
  }
1630
1369
  static fromAffine(E) {
1631
- if (E instanceof v)
1370
+ if (E instanceof S)
1632
1371
  throw new Error("extended point not allowed");
1633
1372
  const { x: A, y: p } = E || {};
1634
- return y("x", A), y("y", p), new v(A, p, H, i(A * p));
1373
+ return m("x", A), m("y", p), new S(A, p, U, i(A * p));
1635
1374
  }
1636
1375
  // Uses algo from RFC8032 5.1.3.
1637
1376
  static fromBytes(E, A = !1) {
1638
1377
  const p = o.BYTES, { a: N, d: T } = s;
1639
- E = St(D(E, p, "point")), Bt(A, "zip215");
1640
- const f = St(E), h = E[p - 1];
1641
- f[p - 1] = h & -129;
1642
- const c = ft(f), l = A ? u : o.ORDER;
1643
- kt("point.y", c, W, l);
1644
- const d = i(c * c), b = i(d - H), g = i(T * d - N);
1645
- let { isValid: m, value: B } = x(b, g);
1646
- if (!m)
1378
+ E = Bt(D(E, p, "point")), Et(A, "zip215");
1379
+ const a = Bt(E), h = E[p - 1];
1380
+ a[p - 1] = h & -129;
1381
+ const f = ft(a), l = A ? u : o.ORDER;
1382
+ Vt("point.y", f, z, l);
1383
+ const d = i(f * f), b = i(d - U), g = i(T * d - N);
1384
+ let { isValid: y, value: B } = x(b, g);
1385
+ if (!y)
1647
1386
  throw new Error("bad point: invalid y coordinate");
1648
- const R = (B & H) === H, C = (h & 128) !== 0;
1649
- if (!A && B === W && C)
1387
+ const R = (B & U) === U, C = (h & 128) !== 0;
1388
+ if (!A && B === z && C)
1650
1389
  throw new Error("bad point: x=0 and x_0=1");
1651
- return C !== R && (B = i(-B)), v.fromAffine({ x: B, y: c });
1390
+ return C !== R && (B = i(-B)), S.fromAffine({ x: B, y: f });
1652
1391
  }
1653
1392
  static fromHex(E, A = !1) {
1654
- return v.fromBytes(ce(E), A);
1393
+ return S.fromBytes(se(E), A);
1655
1394
  }
1656
1395
  get x() {
1657
1396
  return this.toAffine().x;
@@ -1660,7 +1399,7 @@ function $n(e, t = {}) {
1660
1399
  return this.toAffine().y;
1661
1400
  }
1662
1401
  precompute(E = 8, A = !0) {
1663
- return O.createCache(this, E), A || this.multiply(mt), this;
1402
+ return O.createCache(this, E), A || this.multiply(xt), this;
1664
1403
  }
1665
1404
  // Useful in fromAffine() - not for fromBytes(), which always created valid points.
1666
1405
  assertValidity() {
@@ -1669,29 +1408,29 @@ function $n(e, t = {}) {
1669
1408
  // Compare one point to another.
1670
1409
  equals(E) {
1671
1410
  w(E);
1672
- const { X: A, Y: p, Z: N } = this, { X: T, Y: f, Z: h } = E, c = i(A * h), l = i(T * N), d = i(p * h), b = i(f * N);
1673
- return c === l && d === b;
1411
+ const { X: A, Y: p, Z: N } = this, { X: T, Y: a, Z: h } = E, f = i(A * h), l = i(T * N), d = i(p * h), b = i(a * N);
1412
+ return f === l && d === b;
1674
1413
  }
1675
1414
  is0() {
1676
- return this.equals(v.ZERO);
1415
+ return this.equals(S.ZERO);
1677
1416
  }
1678
1417
  negate() {
1679
- return new v(i(-this.X), this.Y, this.Z, i(-this.T));
1418
+ return new S(i(-this.X), this.Y, this.Z, i(-this.T));
1680
1419
  }
1681
1420
  // Fast algo for doubling Extended Point.
1682
1421
  // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#doubling-dbl-2008-hwcd
1683
1422
  // Cost: 4M + 4S + 1*a + 6add + 1*2.
1684
1423
  double() {
1685
- const { a: E } = s, { X: A, Y: p, Z: N } = this, T = i(A * A), f = i(p * p), h = i(mt * i(N * N)), c = i(E * T), l = A + p, d = i(i(l * l) - T - f), b = c + f, g = b - h, m = c - f, B = i(d * g), R = i(b * m), C = i(d * m), L = i(g * b);
1686
- return new v(B, R, L, C);
1424
+ const { a: E } = s, { X: A, Y: p, Z: N } = this, T = i(A * A), a = i(p * p), h = i(xt * i(N * N)), f = i(E * T), l = A + p, d = i(i(l * l) - T - a), b = f + a, g = b - h, y = f - a, B = i(d * g), R = i(b * y), C = i(d * y), L = i(g * b);
1425
+ return new S(B, R, L, C);
1687
1426
  }
1688
1427
  // Fast algo for adding 2 Extended Points.
1689
1428
  // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#addition-add-2008-hwcd
1690
1429
  // Cost: 9M + 1*a + 1*d + 7add.
1691
1430
  add(E) {
1692
1431
  w(E);
1693
- const { a: A, d: p } = s, { X: N, Y: T, Z: f, T: h } = this, { X: c, Y: l, Z: d, T: b } = E, g = i(N * c), m = i(T * l), B = i(h * p * b), R = i(f * d), C = i((N + T) * (c + l) - g - m), L = R - B, q = R + B, Q = i(m - A * g), nt = i(C * L), ut = i(q * Q), Ct = i(C * Q), Lt = i(L * q);
1694
- return new v(nt, ut, Lt, Ct);
1432
+ const { a: A, d: p } = s, { X: N, Y: T, Z: a, T: h } = this, { X: f, Y: l, Z: d, T: b } = E, g = i(N * f), y = i(T * l), B = i(h * p * b), R = i(a * d), C = i((N + T) * (f + l) - g - y), L = R - B, q = R + B, Q = i(y - A * g), nt = i(C * L), ut = i(q * Q), Lt = i(C * Q), Ht = i(L * q);
1433
+ return new S(nt, ut, Ht, Lt);
1695
1434
  }
1696
1435
  subtract(E) {
1697
1436
  return this.add(E.negate());
@@ -1700,25 +1439,25 @@ function $n(e, t = {}) {
1700
1439
  multiply(E) {
1701
1440
  if (!r.isValidNot0(E))
1702
1441
  throw new Error("invalid scalar: expected 1 <= sc < curve.n");
1703
- const { p: A, f: p } = O.cached(this, E, (N) => gt(v, N));
1704
- return gt(v, [A, p])[0];
1442
+ const { p: A, f: p } = O.cached(this, E, (N) => dt(S, N));
1443
+ return dt(S, [A, p])[0];
1705
1444
  }
1706
1445
  // Non-constant-time multiplication. Uses double-and-add algorithm.
1707
1446
  // It's faster, but should only be used when you don't care about
1708
1447
  // an exposed private key e.g. sig verification.
1709
1448
  // Does NOT allow scalars higher than CURVE.n.
1710
1449
  // Accepts optional accumulator to merge with multiply (important for sparse scalars)
1711
- multiplyUnsafe(E, A = v.ZERO) {
1450
+ multiplyUnsafe(E, A = S.ZERO) {
1712
1451
  if (!r.isValid(E))
1713
1452
  throw new Error("invalid scalar: expected 0 <= sc < curve.n");
1714
- return E === W ? v.ZERO : this.is0() || E === H ? this : O.unsafe(this, E, (p) => gt(v, p), A);
1453
+ return E === z ? S.ZERO : this.is0() || E === U ? this : O.unsafe(this, E, (p) => dt(S, p), A);
1715
1454
  }
1716
1455
  // Checks if point is of small order.
1717
1456
  // If you add something to small order point, you will have "dirty"
1718
1457
  // point with torsion component.
1719
1458
  // Multiplies point by cofactor and checks if the result is 0.
1720
1459
  isSmallOrder() {
1721
- return this.multiplyUnsafe(a).is0();
1460
+ return this.multiplyUnsafe(c).is0();
1722
1461
  }
1723
1462
  // Multiplies point by curve order and checks if the result is 0.
1724
1463
  // Returns `false` is the point is dirty.
@@ -1728,14 +1467,14 @@ function $n(e, t = {}) {
1728
1467
  // Converts Extended point to default (x, y) coordinates.
1729
1468
  // Can accept precomputed Z^-1 - for example, from invertBatch.
1730
1469
  toAffine(E) {
1731
- return S(this, E);
1470
+ return v(this, E);
1732
1471
  }
1733
1472
  clearCofactor() {
1734
- return a === H ? this : this.multiplyUnsafe(a);
1473
+ return c === U ? this : this.multiplyUnsafe(c);
1735
1474
  }
1736
1475
  toBytes() {
1737
1476
  const { x: E, y: A } = this.toAffine(), p = o.toBytes(A);
1738
- return p[p.length - 1] |= E & H ? 128 : 0, p;
1477
+ return p[p.length - 1] |= E & U ? 128 : 0, p;
1739
1478
  }
1740
1479
  toHex() {
1741
1480
  return It(this.toBytes());
@@ -1744,10 +1483,10 @@ function $n(e, t = {}) {
1744
1483
  return `<Point ${this.is0() ? "ZERO" : this.toHex()}>`;
1745
1484
  }
1746
1485
  }
1747
- const O = new Hn(v, r.BITS);
1748
- return v.BASE.precompute(8), v;
1486
+ const O = new Bn(S, r.BITS);
1487
+ return S.BASE.precompute(8), S;
1749
1488
  }
1750
- function Zn(e, t, n = {}) {
1489
+ function _n(e, t, n = {}) {
1751
1490
  if (typeof t != "function")
1752
1491
  throw new Error('"hash" function param is required');
1753
1492
  _t(n, {}, {
@@ -1757,53 +1496,53 @@ function Zn(e, t, n = {}) {
1757
1496
  prehash: "function",
1758
1497
  mapToCurve: "function"
1759
1498
  });
1760
- const { prehash: o } = n, { BASE: r, Fp: s, Fn: a } = e, u = n.randomBytes || nn, i = n.adjustScalarBytes || ((c) => c), x = n.domain || ((c, l, d) => {
1761
- if (Bt(d, "phflag"), l.length || d)
1499
+ const { prehash: o } = n, { BASE: r, Fp: s, Fn: c } = e, u = n.randomBytes || Ve, i = n.adjustScalarBytes || ((f) => f), x = n.domain || ((f, l, d) => {
1500
+ if (Et(d, "phflag"), l.length || d)
1762
1501
  throw new Error("Contexts/pre-hash are not supported");
1763
- return c;
1502
+ return f;
1764
1503
  });
1765
- function y(c) {
1766
- return a.create(ft(c));
1504
+ function m(f) {
1505
+ return c.create(ft(f));
1767
1506
  }
1768
- function w(c) {
1507
+ function w(f) {
1769
1508
  const l = p.secretKey;
1770
- D(c, p.secretKey, "secretKey");
1771
- const d = D(t(c), 2 * l, "hashedSecretKey"), b = i(d.slice(0, l)), g = d.slice(l, 2 * l), m = y(b);
1772
- return { head: b, prefix: g, scalar: m };
1509
+ D(f, p.secretKey, "secretKey");
1510
+ const d = D(t(f), 2 * l, "hashedSecretKey"), b = i(d.slice(0, l)), g = d.slice(l, 2 * l), y = m(b);
1511
+ return { head: b, prefix: g, scalar: y };
1773
1512
  }
1774
- function S(c) {
1775
- const { head: l, prefix: d, scalar: b } = w(c), g = r.multiply(b), m = g.toBytes();
1776
- return { head: l, prefix: d, scalar: b, point: g, pointBytes: m };
1513
+ function v(f) {
1514
+ const { head: l, prefix: d, scalar: b } = w(f), g = r.multiply(b), y = g.toBytes();
1515
+ return { head: l, prefix: d, scalar: b, point: g, pointBytes: y };
1777
1516
  }
1778
- function I(c) {
1779
- return S(c).pointBytes;
1517
+ function I(f) {
1518
+ return v(f).pointBytes;
1780
1519
  }
1781
- function v(c = Uint8Array.of(), ...l) {
1782
- const d = Gt(...l);
1783
- return y(t(x(d, D(c, void 0, "context"), !!o)));
1520
+ function S(f = Uint8Array.of(), ...l) {
1521
+ const d = Mt(...l);
1522
+ return m(t(x(d, D(f, void 0, "context"), !!o)));
1784
1523
  }
1785
- function O(c, l, d = {}) {
1786
- c = D(c, void 0, "message"), o && (c = o(c));
1787
- const { prefix: b, scalar: g, pointBytes: m } = S(l), B = v(d.context, b, c), R = r.multiply(B).toBytes(), C = v(d.context, R, m, c), L = a.create(B + C * g);
1788
- if (!a.isValid(L))
1524
+ function O(f, l, d = {}) {
1525
+ f = D(f, void 0, "message"), o && (f = o(f));
1526
+ const { prefix: b, scalar: g, pointBytes: y } = v(l), B = S(d.context, b, f), R = r.multiply(B).toBytes(), C = S(d.context, R, y, f), L = c.create(B + C * g);
1527
+ if (!c.isValid(L))
1789
1528
  throw new Error("sign failed: invalid s");
1790
- const q = Gt(R, a.toBytes(L));
1529
+ const q = Mt(R, c.toBytes(L));
1791
1530
  return D(q, p.signature, "result");
1792
1531
  }
1793
1532
  const _ = { zip215: !0 };
1794
- function E(c, l, d, b = _) {
1795
- const { context: g, zip215: m } = b, B = p.signature;
1796
- c = D(c, B, "signature"), l = D(l, void 0, "message"), d = D(d, p.publicKey, "publicKey"), m !== void 0 && Bt(m, "zip215"), o && (l = o(l));
1797
- const R = B / 2, C = c.subarray(0, R), L = ft(c.subarray(R, B));
1533
+ function E(f, l, d, b = _) {
1534
+ const { context: g, zip215: y } = b, B = p.signature;
1535
+ f = D(f, B, "signature"), l = D(l, void 0, "message"), d = D(d, p.publicKey, "publicKey"), y !== void 0 && Et(y, "zip215"), o && (l = o(l));
1536
+ const R = B / 2, C = f.subarray(0, R), L = ft(f.subarray(R, B));
1798
1537
  let q, Q, nt;
1799
1538
  try {
1800
- q = e.fromBytes(d, m), Q = e.fromBytes(C, m), nt = r.multiplyUnsafe(L);
1539
+ q = e.fromBytes(d, y), Q = e.fromBytes(C, y), nt = r.multiplyUnsafe(L);
1801
1540
  } catch {
1802
1541
  return !1;
1803
1542
  }
1804
- if (!m && q.isSmallOrder())
1543
+ if (!y && q.isSmallOrder())
1805
1544
  return !1;
1806
- const ut = v(g, Q.toBytes(), q.toBytes(), l);
1545
+ const ut = S(g, Q.toBytes(), q.toBytes(), l);
1807
1546
  return Q.add(q.multiplyUnsafe(ut)).subtract(nt).clearCofactor().is0();
1808
1547
  }
1809
1548
  const A = s.BYTES, p = {
@@ -1812,24 +1551,24 @@ function Zn(e, t, n = {}) {
1812
1551
  signature: 2 * A,
1813
1552
  seed: A
1814
1553
  };
1815
- function N(c = u(p.seed)) {
1816
- return D(c, p.seed, "seed");
1554
+ function N(f = u(p.seed)) {
1555
+ return D(f, p.seed, "seed");
1817
1556
  }
1818
- function T(c) {
1819
- return se(c) && c.length === a.BYTES;
1557
+ function T(f) {
1558
+ return re(f) && f.length === c.BYTES;
1820
1559
  }
1821
- function f(c, l) {
1560
+ function a(f, l) {
1822
1561
  try {
1823
- return !!e.fromBytes(c, l);
1562
+ return !!e.fromBytes(f, l);
1824
1563
  } catch {
1825
1564
  return !1;
1826
1565
  }
1827
1566
  }
1828
1567
  const h = {
1829
- getExtendedPublicKey: S,
1568
+ getExtendedPublicKey: v,
1830
1569
  randomSecretKey: N,
1831
1570
  isValidSecretKey: T,
1832
- isValidPublicKey: f,
1571
+ isValidPublicKey: a,
1833
1572
  /**
1834
1573
  * Converts ed public key to x public key. Uses formula:
1835
1574
  * - ed25519:
@@ -1839,22 +1578,22 @@ function Zn(e, t, n = {}) {
1839
1578
  * - `(u, v) = ((y-1)/(y+1), sqrt(156324)*u/x)`
1840
1579
  * - `(x, y) = (sqrt(156324)*u/v, (1+u)/(1-u))`
1841
1580
  */
1842
- toMontgomery(c) {
1843
- const { y: l } = e.fromBytes(c), d = p.publicKey, b = d === 32;
1581
+ toMontgomery(f) {
1582
+ const { y: l } = e.fromBytes(f), d = p.publicKey, b = d === 32;
1844
1583
  if (!b && d !== 57)
1845
1584
  throw new Error("only defined for 25519 and 448");
1846
- const g = b ? s.div(H + l, H - l) : s.div(l - H, l + H);
1585
+ const g = b ? s.div(U + l, U - l) : s.div(l - U, l + U);
1847
1586
  return s.toBytes(g);
1848
1587
  },
1849
- toMontgomerySecret(c) {
1588
+ toMontgomerySecret(f) {
1850
1589
  const l = p.secretKey;
1851
- D(c, l);
1852
- const d = t(c.subarray(0, l));
1590
+ D(f, l);
1591
+ const d = t(f.subarray(0, l));
1853
1592
  return i(d).subarray(0, l);
1854
1593
  }
1855
1594
  };
1856
1595
  return Object.freeze({
1857
- keygen: qn(N, I),
1596
+ keygen: Sn(N, I),
1858
1597
  getPublicKey: I,
1859
1598
  sign: O,
1860
1599
  verify: E,
@@ -1863,50 +1602,267 @@ function Zn(e, t, n = {}) {
1863
1602
  lengths: p
1864
1603
  });
1865
1604
  }
1866
- const jn = BigInt(1), Qt = BigInt(2), Vn = BigInt(5), kn = BigInt(8), Tt = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"), Yn = {
1605
+ const Nn = BigInt(1), Ft = BigInt(2), On = BigInt(5), Tn = BigInt(8), Tt = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"), Cn = {
1867
1606
  p: Tt,
1868
1607
  n: BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),
1869
- h: kn,
1608
+ h: Tn,
1870
1609
  a: BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),
1871
1610
  d: BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),
1872
1611
  Gx: BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),
1873
1612
  Gy: BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")
1874
1613
  };
1875
- function zn(e) {
1876
- const t = BigInt(10), n = BigInt(20), o = BigInt(40), r = BigInt(80), s = Tt, u = e * e % s * e % s, i = j(u, Qt, s) * u % s, x = j(i, jn, s) * e % s, y = j(x, Vn, s) * x % s, w = j(y, t, s) * y % s, S = j(w, n, s) * w % s, I = j(S, o, s) * S % s, v = j(I, r, s) * I % s, O = j(v, r, s) * I % s, _ = j(O, t, s) * y % s;
1877
- return { pow_p_5_8: j(_, Qt, s) * e % s, b2: u };
1614
+ function Ln(e) {
1615
+ const t = BigInt(10), n = BigInt(20), o = BigInt(40), r = BigInt(80), s = Tt, u = e * e % s * e % s, i = Z(u, Ft, s) * u % s, x = Z(i, Nn, s) * e % s, m = Z(x, On, s) * x % s, w = Z(m, t, s) * m % s, v = Z(w, n, s) * w % s, I = Z(v, o, s) * v % s, S = Z(I, r, s) * I % s, O = Z(S, r, s) * I % s, _ = Z(O, t, s) * m % s;
1616
+ return { pow_p_5_8: Z(_, Ft, s) * e % s, b2: u };
1878
1617
  }
1879
- function Kn(e) {
1618
+ function Hn(e) {
1880
1619
  return e[0] &= 248, e[31] &= 127, e[31] |= 64, e;
1881
1620
  }
1882
- const Jt = /* @__PURE__ */ BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");
1883
- function Xn(e, t) {
1884
- const n = Tt, o = U(t * t * t, n), r = U(o * o * t, n), s = zn(e * r).pow_p_5_8;
1885
- let a = U(e * o * s, n);
1886
- const u = U(t * a * a, n), i = a, x = U(a * Jt, n), y = u === e, w = u === U(-e, n), S = u === U(-e * Jt, n);
1887
- return y && (a = i), (w || S) && (a = x), Nn(a, n) && (a = U(-a, n)), { isValid: y || w, value: a };
1621
+ const Qt = /* @__PURE__ */ BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");
1622
+ function Un(e, t) {
1623
+ const n = Tt, o = H(t * t * t, n), r = H(o * o * t, n), s = Ln(e * r).pow_p_5_8;
1624
+ let c = H(e * o * s, n);
1625
+ const u = H(t * c * c, n), i = c, x = H(c * Qt, n), m = u === e, w = u === H(-e, n), v = u === H(-e * Qt, n);
1626
+ return m && (c = i), (w || v) && (c = x), wn(c, n) && (c = H(-c, n)), { isValid: m || w, value: c };
1888
1627
  }
1889
- const Wn = /* @__PURE__ */ $n(Yn, { uvRatio: Xn });
1890
- function Pn(e) {
1891
- return Zn(Wn, pn, Object.assign({ adjustScalarBytes: Kn }, e));
1628
+ const Dn = /* @__PURE__ */ In(Cn, { uvRatio: Un });
1629
+ function qn(e) {
1630
+ return _n(Dn, on, Object.assign({ adjustScalarBytes: Hn }, e));
1892
1631
  }
1893
- const Fn = /* @__PURE__ */ Pn({}), Qn = Qe, Jn = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
1894
- function tr(e) {
1632
+ const Mn = /* @__PURE__ */ qn({});
1633
+ function Gn(e) {
1634
+ return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
1635
+ }
1636
+ function Ct(e, ...t) {
1637
+ if (!Gn(e))
1638
+ throw new Error("Uint8Array expected");
1639
+ if (t.length > 0 && !t.includes(e.length))
1640
+ throw new Error("Uint8Array expected of length " + t + ", got length=" + e.length);
1641
+ }
1642
+ function Jt(e, t = !0) {
1643
+ if (e.destroyed)
1644
+ throw new Error("Hash instance has been destroyed");
1645
+ if (t && e.finished)
1646
+ throw new Error("Hash#digest() has already been called");
1647
+ }
1648
+ function $n(e, t) {
1649
+ Ct(e);
1650
+ const n = t.outputLen;
1651
+ if (e.length < n)
1652
+ throw new Error("digestInto() expects output buffer of length at least " + n);
1653
+ }
1654
+ function St(...e) {
1655
+ for (let t = 0; t < e.length; t++)
1656
+ e[t].fill(0);
1657
+ }
1658
+ function pt(e) {
1659
+ return new DataView(e.buffer, e.byteOffset, e.byteLength);
1660
+ }
1661
+ function j(e, t) {
1662
+ return e << 32 - t | e >>> t;
1663
+ }
1664
+ function Zn(e) {
1665
+ if (typeof e != "string")
1666
+ throw new Error("string expected");
1667
+ return new Uint8Array(new TextEncoder().encode(e));
1668
+ }
1669
+ function me(e) {
1670
+ return typeof e == "string" && (e = Zn(e)), Ct(e), e;
1671
+ }
1672
+ class jn {
1673
+ }
1674
+ function Vn(e) {
1675
+ const t = (o) => e().update(me(o)).digest(), n = e();
1676
+ return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
1677
+ }
1678
+ function kn(e, t, n, o) {
1679
+ if (typeof e.setBigUint64 == "function")
1680
+ return e.setBigUint64(t, n, o);
1681
+ const r = BigInt(32), s = BigInt(4294967295), c = Number(n >> r & s), u = Number(n & s), i = o ? 4 : 0, x = o ? 0 : 4;
1682
+ e.setUint32(t + i, c, o), e.setUint32(t + x, u, o);
1683
+ }
1684
+ function Kn(e, t, n) {
1685
+ return e & t ^ ~e & n;
1686
+ }
1687
+ function Yn(e, t, n) {
1688
+ return e & t ^ e & n ^ t & n;
1689
+ }
1690
+ class zn extends jn {
1691
+ constructor(t, n, o, r) {
1692
+ super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = t, this.outputLen = n, this.padOffset = o, this.isLE = r, this.buffer = new Uint8Array(t), this.view = pt(this.buffer);
1693
+ }
1694
+ update(t) {
1695
+ Jt(this), t = me(t), Ct(t);
1696
+ const { view: n, buffer: o, blockLen: r } = this, s = t.length;
1697
+ for (let c = 0; c < s; ) {
1698
+ const u = Math.min(r - this.pos, s - c);
1699
+ if (u === r) {
1700
+ const i = pt(t);
1701
+ for (; r <= s - c; c += r)
1702
+ this.process(i, c);
1703
+ continue;
1704
+ }
1705
+ o.set(t.subarray(c, c + u), this.pos), this.pos += u, c += u, this.pos === r && (this.process(n, 0), this.pos = 0);
1706
+ }
1707
+ return this.length += t.length, this.roundClean(), this;
1708
+ }
1709
+ digestInto(t) {
1710
+ Jt(this), $n(t, this), this.finished = !0;
1711
+ const { buffer: n, view: o, blockLen: r, isLE: s } = this;
1712
+ let { pos: c } = this;
1713
+ n[c++] = 128, St(this.buffer.subarray(c)), this.padOffset > r - c && (this.process(o, 0), c = 0);
1714
+ for (let w = c; w < r; w++)
1715
+ n[w] = 0;
1716
+ kn(o, r - 8, BigInt(this.length * 8), s), this.process(o, 0);
1717
+ const u = pt(t), i = this.outputLen;
1718
+ if (i % 4)
1719
+ throw new Error("_sha2: outputLen should be aligned to 32bit");
1720
+ const x = i / 4, m = this.get();
1721
+ if (x > m.length)
1722
+ throw new Error("_sha2: outputLen bigger than state");
1723
+ for (let w = 0; w < x; w++)
1724
+ u.setUint32(4 * w, m[w], s);
1725
+ }
1726
+ digest() {
1727
+ const { buffer: t, outputLen: n } = this;
1728
+ this.digestInto(t);
1729
+ const o = t.slice(0, n);
1730
+ return this.destroy(), o;
1731
+ }
1732
+ _cloneInto(t) {
1733
+ t || (t = new this.constructor()), t.set(...this.get());
1734
+ const { blockLen: n, buffer: o, length: r, finished: s, destroyed: c, pos: u } = this;
1735
+ return t.destroyed = c, t.finished = s, t.length = r, t.pos = u, r % n && t.buffer.set(o), t;
1736
+ }
1737
+ clone() {
1738
+ return this._cloneInto();
1739
+ }
1740
+ }
1741
+ const X = /* @__PURE__ */ Uint32Array.from([
1742
+ 1779033703,
1743
+ 3144134277,
1744
+ 1013904242,
1745
+ 2773480762,
1746
+ 1359893119,
1747
+ 2600822924,
1748
+ 528734635,
1749
+ 1541459225
1750
+ ]), Xn = /* @__PURE__ */ Uint32Array.from([
1751
+ 1116352408,
1752
+ 1899447441,
1753
+ 3049323471,
1754
+ 3921009573,
1755
+ 961987163,
1756
+ 1508970993,
1757
+ 2453635748,
1758
+ 2870763221,
1759
+ 3624381080,
1760
+ 310598401,
1761
+ 607225278,
1762
+ 1426881987,
1763
+ 1925078388,
1764
+ 2162078206,
1765
+ 2614888103,
1766
+ 3248222580,
1767
+ 3835390401,
1768
+ 4022224774,
1769
+ 264347078,
1770
+ 604807628,
1771
+ 770255983,
1772
+ 1249150122,
1773
+ 1555081692,
1774
+ 1996064986,
1775
+ 2554220882,
1776
+ 2821834349,
1777
+ 2952996808,
1778
+ 3210313671,
1779
+ 3336571891,
1780
+ 3584528711,
1781
+ 113926993,
1782
+ 338241895,
1783
+ 666307205,
1784
+ 773529912,
1785
+ 1294757372,
1786
+ 1396182291,
1787
+ 1695183700,
1788
+ 1986661051,
1789
+ 2177026350,
1790
+ 2456956037,
1791
+ 2730485921,
1792
+ 2820302411,
1793
+ 3259730800,
1794
+ 3345764771,
1795
+ 3516065817,
1796
+ 3600352804,
1797
+ 4094571909,
1798
+ 275423344,
1799
+ 430227734,
1800
+ 506948616,
1801
+ 659060556,
1802
+ 883997877,
1803
+ 958139571,
1804
+ 1322822218,
1805
+ 1537002063,
1806
+ 1747873779,
1807
+ 1955562222,
1808
+ 2024104815,
1809
+ 2227730452,
1810
+ 2361852424,
1811
+ 2428436474,
1812
+ 2756734187,
1813
+ 3204031479,
1814
+ 3329325298
1815
+ ]), W = /* @__PURE__ */ new Uint32Array(64);
1816
+ class Wn extends zn {
1817
+ constructor(t = 32) {
1818
+ super(64, t, 8, !1), this.A = X[0] | 0, this.B = X[1] | 0, this.C = X[2] | 0, this.D = X[3] | 0, this.E = X[4] | 0, this.F = X[5] | 0, this.G = X[6] | 0, this.H = X[7] | 0;
1819
+ }
1820
+ get() {
1821
+ const { A: t, B: n, C: o, D: r, E: s, F: c, G: u, H: i } = this;
1822
+ return [t, n, o, r, s, c, u, i];
1823
+ }
1824
+ // prettier-ignore
1825
+ set(t, n, o, r, s, c, u, i) {
1826
+ this.A = t | 0, this.B = n | 0, this.C = o | 0, this.D = r | 0, this.E = s | 0, this.F = c | 0, this.G = u | 0, this.H = i | 0;
1827
+ }
1828
+ process(t, n) {
1829
+ for (let w = 0; w < 16; w++, n += 4)
1830
+ W[w] = t.getUint32(n, !1);
1831
+ for (let w = 16; w < 64; w++) {
1832
+ const v = W[w - 15], I = W[w - 2], S = j(v, 7) ^ j(v, 18) ^ v >>> 3, O = j(I, 17) ^ j(I, 19) ^ I >>> 10;
1833
+ W[w] = O + W[w - 7] + S + W[w - 16] | 0;
1834
+ }
1835
+ let { A: o, B: r, C: s, D: c, E: u, F: i, G: x, H: m } = this;
1836
+ for (let w = 0; w < 64; w++) {
1837
+ const v = j(u, 6) ^ j(u, 11) ^ j(u, 25), I = m + v + Kn(u, i, x) + Xn[w] + W[w] | 0, O = (j(o, 2) ^ j(o, 13) ^ j(o, 22)) + Yn(o, r, s) | 0;
1838
+ m = x, x = i, i = u, u = c + I | 0, c = s, s = r, r = o, o = I + O | 0;
1839
+ }
1840
+ o = o + this.A | 0, r = r + this.B | 0, s = s + this.C | 0, c = c + this.D | 0, u = u + this.E | 0, i = i + this.F | 0, x = x + this.G | 0, m = m + this.H | 0, this.set(o, r, s, c, u, i, x, m);
1841
+ }
1842
+ roundClean() {
1843
+ St(W);
1844
+ }
1845
+ destroy() {
1846
+ this.set(0, 0, 0, 0, 0, 0, 0, 0), St(this.buffer);
1847
+ }
1848
+ }
1849
+ const Pn = /* @__PURE__ */ Vn(() => new Wn()), Fn = Pn, Qn = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
1850
+ function Jn(e) {
1895
1851
  if (e.length !== 16)
1896
1852
  throw new Error(`Invalid seed length: expected 16, got ${e.length}`);
1897
- const t = Qn(e), n = Fn.getPublicKey(t), o = new Uint8Array(64);
1898
- return o.set(t, 0), o.set(n, 32), te(t), { publicKey: n, secretKey: o };
1853
+ const t = Fn(e), n = Mn.getPublicKey(t), o = new Uint8Array(64);
1854
+ return o.set(t, 0), o.set(n, 32), ee(t), { publicKey: n, secretKey: o };
1899
1855
  }
1900
1856
  function cr(e) {
1901
- const t = tr(e), n = t.publicKey;
1902
- return te(t.secretKey), n;
1857
+ const t = Jn(e), n = t.publicKey;
1858
+ return ee(t.secretKey), n;
1903
1859
  }
1904
1860
  function fr(e) {
1905
1861
  if (e.length !== 32)
1906
1862
  throw new Error(`Invalid public key length: expected 32, got ${e.length}`);
1907
- return er(e);
1863
+ return tr(e);
1908
1864
  }
1909
- function er(e) {
1865
+ function tr(e) {
1910
1866
  let t = 0;
1911
1867
  for (let r = 0; r < e.length && e[r] === 0; r++)
1912
1868
  t++;
@@ -1916,17 +1872,69 @@ function er(e) {
1916
1872
  let o = "";
1917
1873
  for (; n > 0n; ) {
1918
1874
  const r = Number(n % 58n);
1919
- o = Jn[r] + o, n = n / 58n;
1875
+ o = Qn[r] + o, n = n / 58n;
1920
1876
  }
1921
1877
  return "1".repeat(t) + o;
1922
1878
  }
1879
+ const er = 2, nr = 3;
1880
+ function ar(e) {
1881
+ if (e.length !== 16)
1882
+ throw new Error(`Invalid seed length: expected 16, got ${e.length}`);
1883
+ const t = At(e), n = ne.share(t, nr, er);
1884
+ if (n.length !== 3)
1885
+ throw new Error(`Unexpected share count: ${n.length}`);
1886
+ const o = yt(n[0]), r = yt(n[1]), s = yt(n[2]);
1887
+ return {
1888
+ shareA: ht(o),
1889
+ shareB: ht(r),
1890
+ shareC: ht(s)
1891
+ };
1892
+ }
1893
+ function ur(e, t, n) {
1894
+ const o = te(e), r = te(t);
1895
+ try {
1896
+ const s = ne.combine([o, r]), c = Ee(s);
1897
+ if (c.length !== 16)
1898
+ throw new Error(`Reconstructed seed has wrong length: ${c.length}`);
1899
+ return Ae(c);
1900
+ } catch (s) {
1901
+ throw s instanceof Error && s.message.startsWith("Reconstructed seed") || s instanceof Error && s.message.startsWith("Invalid expectedPublicKey") || s instanceof Error && s.message.startsWith("Reconstructed seed does not match") ? s : new Error("Failed to reconstruct seed from shares");
1902
+ }
1903
+ }
1904
+ function At(e) {
1905
+ return Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join("");
1906
+ }
1907
+ function Ee(e) {
1908
+ if (!/^[0-9a-fA-F]*$/.test(e))
1909
+ throw new Error("Invalid hex string: contains non-hex characters");
1910
+ if (e.length % 2 !== 0)
1911
+ throw new Error(`Invalid hex string: length ${e.length} is odd (must be even)`);
1912
+ const t = new Uint8Array(e.length / 2);
1913
+ for (let n = 0; n < t.length; n++)
1914
+ t[n] = parseInt(e.substr(n * 2, 2), 16);
1915
+ return t;
1916
+ }
1917
+ function yt(e) {
1918
+ const t = e.length % 2 !== 0, n = t ? "0" + e : e, o = Ee(n), r = new Uint8Array(1 + o.length);
1919
+ return r[0] = t ? 1 : 0, r.set(o, 1), r;
1920
+ }
1921
+ function te(e) {
1922
+ const t = e[0];
1923
+ if (t === 0 || t === 1) {
1924
+ const o = t === 1, r = e.subarray(1), s = At(r), c = o ? s.substring(1) : s;
1925
+ if (/^[0-9a-f]/.test(c))
1926
+ return c;
1927
+ }
1928
+ const n = At(e);
1929
+ return n.startsWith("0") && !n.startsWith("00") ? n.substring(1) : n;
1930
+ }
1923
1931
  export {
1924
- rr as a,
1925
- At as b,
1926
- Qe as c,
1927
- sr as d,
1928
- Ie as e,
1932
+ sr as a,
1933
+ Ct as b,
1934
+ Pn as c,
1935
+ ur as d,
1936
+ _e as e,
1929
1937
  cr as g,
1930
1938
  fr as p,
1931
- or as s
1939
+ ar as s
1932
1940
  };