@lombard.finance/sdk 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/README.md +59 -10
  3. package/dist/api-functions/getUserStakeAndBakeSignature/getUserStakeAndBakeSignature.d.ts +5 -1
  4. package/dist/api-functions/getUserStakeAndBakeSignature/getUserStakeAndBakeSignature.d.ts.map +1 -1
  5. package/dist/api.cjs +2 -0
  6. package/dist/api.cjs.map +1 -0
  7. package/dist/api.js +41 -0
  8. package/dist/api.js.map +1 -0
  9. package/dist/bridge/lib/ccip-config.d.ts.map +1 -1
  10. package/dist/bridge/lib/config.d.ts +3 -3
  11. package/dist/bridge/lib/config.d.ts.map +1 -1
  12. package/dist/bridge.cjs +2 -0
  13. package/dist/bridge.cjs.map +1 -0
  14. package/dist/bridge.js +11 -0
  15. package/dist/bridge.js.map +1 -0
  16. package/dist/btc.cjs +2 -0
  17. package/dist/btc.cjs.map +1 -0
  18. package/dist/btc.js +13 -0
  19. package/dist/btc.js.map +1 -0
  20. package/dist/chains/btc/actions/deposit/config/index.d.ts +2 -1
  21. package/dist/chains/btc/actions/deposit/config/index.d.ts.map +1 -1
  22. package/dist/chains/btc/actions/deposit/config/types.d.ts +2 -1
  23. package/dist/chains/btc/actions/deposit/config/types.d.ts.map +1 -1
  24. package/dist/chains/btc/actions/depositAndDeploy/BtcDepositAndDeploy.d.ts +1 -1
  25. package/dist/chains/btc/actions/depositAndDeploy/BtcDepositAndDeploy.d.ts.map +1 -1
  26. package/dist/chains/btc/actions/depositAndDeploy/config/evm.d.ts.map +1 -1
  27. package/dist/chains/btc/actions/depositAndDeploy/config/index.d.ts +2 -1
  28. package/dist/chains/btc/actions/depositAndDeploy/config/index.d.ts.map +1 -1
  29. package/dist/chains/btc/actions/depositAndDeploy/config/types.d.ts +2 -1
  30. package/dist/chains/btc/actions/depositAndDeploy/config/types.d.ts.map +1 -1
  31. package/dist/chains/btc/actions/shared/validation.d.ts +2 -1
  32. package/dist/chains/btc/actions/shared/validation.d.ts.map +1 -1
  33. package/dist/chains/btc/actions/stake/config/evm.d.ts.map +1 -1
  34. package/dist/chains/btc/actions/stake/config/index.d.ts +2 -1
  35. package/dist/chains/btc/actions/stake/config/index.d.ts.map +1 -1
  36. package/dist/chains/btc/actions/stake/config/solana.d.ts.map +1 -1
  37. package/dist/chains/btc/actions/stake/config/starknet.d.ts.map +1 -1
  38. package/dist/chains/btc/actions/stake/config/sui.d.ts.map +1 -1
  39. package/dist/chains/btc/actions/stake/config/types.d.ts +2 -1
  40. package/dist/chains/btc/actions/stake/config/types.d.ts.map +1 -1
  41. package/dist/chains/btc/actions/stakeAndDeploy/BtcStakeAndDeploy.d.ts +1 -1
  42. package/dist/chains/btc/actions/stakeAndDeploy/BtcStakeAndDeploy.d.ts.map +1 -1
  43. package/dist/chains/btc/actions/stakeAndDeploy/config/evm.d.ts.map +1 -1
  44. package/dist/chains/btc/actions/stakeAndDeploy/config/index.d.ts +2 -1
  45. package/dist/chains/btc/actions/stakeAndDeploy/config/index.d.ts.map +1 -1
  46. package/dist/chains/btc/actions/stakeAndDeploy/config/types.d.ts +2 -1
  47. package/dist/chains/btc/actions/stakeAndDeploy/config/types.d.ts.map +1 -1
  48. package/dist/chains/evm/EvmActions.d.ts +39 -0
  49. package/dist/chains/evm/EvmActions.d.ts.map +1 -1
  50. package/dist/chains/evm/actions/deploy/config/evm.d.ts +2 -1
  51. package/dist/chains/evm/actions/deploy/config/evm.d.ts.map +1 -1
  52. package/dist/chains/evm/actions/deploy/config/types.d.ts +2 -1
  53. package/dist/chains/evm/actions/deploy/config/types.d.ts.map +1 -1
  54. package/dist/chains/evm/actions/deposit/config/evm.d.ts +2 -1
  55. package/dist/chains/evm/actions/deposit/config/evm.d.ts.map +1 -1
  56. package/dist/chains/evm/actions/deposit/config/types.d.ts +2 -1
  57. package/dist/chains/evm/actions/deposit/config/types.d.ts.map +1 -1
  58. package/dist/chains/evm/actions/index.d.ts +1 -0
  59. package/dist/chains/evm/actions/index.d.ts.map +1 -1
  60. package/dist/chains/evm/actions/redeem/config/evm.d.ts +2 -1
  61. package/dist/chains/evm/actions/redeem/config/evm.d.ts.map +1 -1
  62. package/dist/chains/evm/actions/redeem/config/types.d.ts +2 -1
  63. package/dist/chains/evm/actions/redeem/config/types.d.ts.map +1 -1
  64. package/dist/chains/evm/actions/stake/config/evm.d.ts +2 -1
  65. package/dist/chains/evm/actions/stake/config/evm.d.ts.map +1 -1
  66. package/dist/chains/evm/actions/stake/config/types.d.ts +2 -1
  67. package/dist/chains/evm/actions/stake/config/types.d.ts.map +1 -1
  68. package/dist/chains/evm/actions/unstake/config/evm.d.ts +2 -1
  69. package/dist/chains/evm/actions/unstake/config/evm.d.ts.map +1 -1
  70. package/dist/chains/evm/actions/unstake/config/types.d.ts +2 -1
  71. package/dist/chains/evm/actions/unstake/config/types.d.ts.map +1 -1
  72. package/dist/chains/evm/actions/withdraw/EvmCancelWithdraw.d.ts +27 -0
  73. package/dist/chains/evm/actions/withdraw/EvmCancelWithdraw.d.ts.map +1 -0
  74. package/dist/chains/evm/actions/withdraw/EvmWithdraw.d.ts +39 -0
  75. package/dist/chains/evm/actions/withdraw/EvmWithdraw.d.ts.map +1 -0
  76. package/dist/chains/evm/actions/withdraw/config/evm.d.ts +22 -0
  77. package/dist/chains/evm/actions/withdraw/config/evm.d.ts.map +1 -0
  78. package/dist/chains/evm/actions/withdraw/config/index.d.ts +8 -0
  79. package/dist/chains/evm/actions/withdraw/config/index.d.ts.map +1 -0
  80. package/dist/chains/evm/actions/withdraw/config/types.d.ts +31 -0
  81. package/dist/chains/evm/actions/withdraw/config/types.d.ts.map +1 -0
  82. package/dist/chains/evm/actions/withdraw/factory.d.ts +53 -0
  83. package/dist/chains/evm/actions/withdraw/factory.d.ts.map +1 -0
  84. package/dist/chains/evm/actions/withdraw/index.d.ts +12 -0
  85. package/dist/chains/evm/actions/withdraw/index.d.ts.map +1 -0
  86. package/dist/chains/evm/actions/withdraw/types.d.ts +87 -0
  87. package/dist/chains/evm/actions/withdraw/types.d.ts.map +1 -0
  88. package/dist/chains/evm/shared/feeAuth.d.ts +1 -1
  89. package/dist/chains/evm/shared/feeAuth.d.ts.map +1 -1
  90. package/dist/chains/solana/actions/unstake/config/btc.d.ts +2 -1
  91. package/dist/chains/solana/actions/unstake/config/btc.d.ts.map +1 -1
  92. package/dist/chains/solana/actions/unstake/config/solana.d.ts +2 -1
  93. package/dist/chains/solana/actions/unstake/config/solana.d.ts.map +1 -1
  94. package/dist/chains/solana/actions/unstake/config/types.d.ts +2 -1
  95. package/dist/chains/solana/actions/unstake/config/types.d.ts.map +1 -1
  96. package/dist/chains/starknet/actions/unstake/config/btc.d.ts +2 -1
  97. package/dist/chains/starknet/actions/unstake/config/btc.d.ts.map +1 -1
  98. package/dist/chains/starknet/actions/unstake/config/starknet.d.ts +2 -1
  99. package/dist/chains/starknet/actions/unstake/config/starknet.d.ts.map +1 -1
  100. package/dist/chains/starknet/actions/unstake/config/types.d.ts +2 -1
  101. package/dist/chains/starknet/actions/unstake/config/types.d.ts.map +1 -1
  102. package/dist/chains/sui/actions/unstake/config/btc.d.ts +2 -1
  103. package/dist/chains/sui/actions/unstake/config/btc.d.ts.map +1 -1
  104. package/dist/chains/sui/actions/unstake/config/sui.d.ts +2 -1
  105. package/dist/chains/sui/actions/unstake/config/sui.d.ts.map +1 -1
  106. package/dist/chains/sui/actions/unstake/config/types.d.ts +2 -1
  107. package/dist/chains/sui/actions/unstake/config/types.d.ts.map +1 -1
  108. package/dist/chunks/BtcActions-D9eBmDj6.cjs +2 -0
  109. package/dist/chunks/BtcActions-D9eBmDj6.cjs.map +1 -0
  110. package/dist/chunks/BtcActions-DGqmtxjd.js +1791 -0
  111. package/dist/chunks/BtcActions-DGqmtxjd.js.map +1 -0
  112. package/dist/chunks/EvmActions-BOwYPThp.cjs +2 -0
  113. package/dist/chunks/EvmActions-BOwYPThp.cjs.map +1 -0
  114. package/dist/chunks/EvmActions-MW5mNmqs.js +1351 -0
  115. package/dist/chunks/EvmActions-MW5mNmqs.js.map +1 -0
  116. package/dist/chunks/ReferralsClient-DUwyIUe3.cjs +2 -0
  117. package/dist/chunks/ReferralsClient-DUwyIUe3.cjs.map +1 -0
  118. package/dist/chunks/ReferralsClient-JjWLlIO4.js +462 -0
  119. package/dist/chunks/ReferralsClient-JjWLlIO4.js.map +1 -0
  120. package/dist/chunks/api-config-CtcP3TVl.js +35 -0
  121. package/dist/chunks/api-config-CtcP3TVl.js.map +1 -0
  122. package/dist/chunks/api-config-DkXqqfCK.cjs +2 -0
  123. package/dist/chunks/api-config-DkXqqfCK.cjs.map +1 -0
  124. package/dist/chunks/approveLBTC-CN6rJF6_.cjs +2 -0
  125. package/dist/chunks/approveLBTC-CN6rJF6_.cjs.map +1 -0
  126. package/dist/chunks/approveLBTC-DOP0wsm3.js +26 -0
  127. package/dist/chunks/approveLBTC-DOP0wsm3.js.map +1 -0
  128. package/dist/chunks/array-Cev6kyLJ.js +15 -0
  129. package/dist/chunks/array-Cev6kyLJ.js.map +1 -0
  130. package/dist/chunks/array-DKG6Pz4i.cjs +2 -0
  131. package/dist/chunks/array-DKG6Pz4i.cjs.map +1 -0
  132. package/dist/chunks/blockchain-identifier-DtIGGlIi.cjs +2 -0
  133. package/dist/chunks/blockchain-identifier-DtIGGlIi.cjs.map +1 -0
  134. package/dist/chunks/blockchain-identifier-PNEhu-QU.js +113 -0
  135. package/dist/chunks/blockchain-identifier-PNEhu-QU.js.map +1 -0
  136. package/dist/chunks/bridge-DkZMwO7c.cjs +12 -0
  137. package/dist/chunks/bridge-DkZMwO7c.cjs.map +1 -0
  138. package/dist/chunks/bridge-DyAiDpxD.js +693 -0
  139. package/dist/chunks/bridge-DyAiDpxD.js.map +1 -0
  140. package/dist/chunks/config-DqbLaiRi.cjs +2 -0
  141. package/dist/chunks/config-DqbLaiRi.cjs.map +1 -0
  142. package/dist/chunks/config-_8X_2sG4.js +374 -0
  143. package/dist/chunks/config-_8X_2sG4.js.map +1 -0
  144. package/dist/chunks/constants-BBK-JNcY.cjs +2 -0
  145. package/dist/chunks/constants-BBK-JNcY.cjs.map +1 -0
  146. package/dist/chunks/constants-CuT4axsy.js +5 -0
  147. package/dist/chunks/constants-CuT4axsy.js.map +1 -0
  148. package/dist/chunks/defi-registry-NGWlyxAY.cjs +2 -0
  149. package/dist/chunks/defi-registry-NGWlyxAY.cjs.map +1 -0
  150. package/dist/chunks/defi-registry-dhrQMy94.js +172 -0
  151. package/dist/chunks/defi-registry-dhrQMy94.js.map +1 -0
  152. package/dist/chunks/depositStatus-DeCO-K5Q.js +205 -0
  153. package/dist/chunks/depositStatus-DeCO-K5Q.js.map +1 -0
  154. package/dist/chunks/depositStatus-K6gky8zH.cjs +2 -0
  155. package/dist/chunks/depositStatus-K6gky8zH.cjs.map +1 -0
  156. package/dist/chunks/events-CLVUaKQS.js +996 -0
  157. package/dist/chunks/events-CLVUaKQS.js.map +1 -0
  158. package/dist/chunks/events-DIKZG4SZ.cjs +2 -0
  159. package/dist/chunks/events-DIKZG4SZ.cjs.map +1 -0
  160. package/dist/chunks/evm-by-btc-address-CwLiENtM.js +39 -0
  161. package/dist/chunks/evm-by-btc-address-CwLiENtM.js.map +1 -0
  162. package/dist/chunks/evm-by-btc-address-DiQoIWsr.cjs +2 -0
  163. package/dist/chunks/evm-by-btc-address-DiQoIWsr.cjs.map +1 -0
  164. package/dist/chunks/fee-requirements-CICSxYYL.cjs +2 -0
  165. package/dist/chunks/fee-requirements-CICSxYYL.cjs.map +1 -0
  166. package/dist/chunks/fee-requirements-x8-8mpJ7.js +14 -0
  167. package/dist/chunks/fee-requirements-x8-8mpJ7.js.map +1 -0
  168. package/dist/chunks/get-exchange-ratio-B0CNEGOB.js +20 -0
  169. package/dist/chunks/get-exchange-ratio-B0CNEGOB.js.map +1 -0
  170. package/dist/chunks/get-exchange-ratio-CM8W0jTw.cjs +2 -0
  171. package/dist/chunks/get-exchange-ratio-CM8W0jTw.cjs.map +1 -0
  172. package/dist/chunks/get-positions-summary-Cled5YPA.js +103 -0
  173. package/dist/chunks/get-positions-summary-Cled5YPA.js.map +1 -0
  174. package/dist/chunks/get-positions-summary-Co7RZBiK.cjs +2 -0
  175. package/dist/chunks/get-positions-summary-Co7RZBiK.cjs.map +1 -0
  176. package/dist/chunks/get-vault-tvl-Bydlvlrv.cjs +2 -0
  177. package/dist/chunks/get-vault-tvl-Bydlvlrv.cjs.map +1 -0
  178. package/dist/chunks/get-vault-tvl-DxjO9xDs.js +226 -0
  179. package/dist/chunks/get-vault-tvl-DxjO9xDs.js.map +1 -0
  180. package/dist/chunks/get-vault-withdrawals-CSQqKFB8.js +161 -0
  181. package/dist/chunks/get-vault-withdrawals-CSQqKFB8.js.map +1 -0
  182. package/dist/chunks/get-vault-withdrawals-DBA3ok0m.cjs +2 -0
  183. package/dist/chunks/get-vault-withdrawals-DBA3ok0m.cjs.map +1 -0
  184. package/dist/chunks/getSharesByAddress-CK2q7gBI.js +121 -0
  185. package/dist/chunks/getSharesByAddress-CK2q7gBI.js.map +1 -0
  186. package/dist/chunks/getSharesByAddress-De7as74h.cjs +2 -0
  187. package/dist/chunks/getSharesByAddress-De7as74h.cjs.map +1 -0
  188. package/dist/chunks/getUserStakeAndBakeSignature--XsK93Lb.cjs +2 -0
  189. package/dist/chunks/getUserStakeAndBakeSignature--XsK93Lb.cjs.map +1 -0
  190. package/dist/chunks/getUserStakeAndBakeSignature-2xPkL9v_.js +120 -0
  191. package/dist/chunks/getUserStakeAndBakeSignature-2xPkL9v_.js.map +1 -0
  192. package/dist/chunks/index-BKzxeh1Y.cjs +2 -0
  193. package/dist/chunks/index-BKzxeh1Y.cjs.map +1 -0
  194. package/dist/chunks/index-CfcQ_g3t.js +37 -0
  195. package/dist/chunks/index-CfcQ_g3t.js.map +1 -0
  196. package/dist/chunks/lbtc-addresses-NHg9Gk5y.js +10 -0
  197. package/dist/chunks/lbtc-addresses-NHg9Gk5y.js.map +1 -0
  198. package/dist/chunks/lbtc-addresses-bj--zuK9.cjs +2 -0
  199. package/dist/chunks/lbtc-addresses-bj--zuK9.cjs.map +1 -0
  200. package/dist/chunks/numbers-3LtmxfD8.cjs +2 -0
  201. package/dist/chunks/numbers-3LtmxfD8.cjs.map +1 -0
  202. package/dist/chunks/numbers-CM-lcmt4.js +15 -0
  203. package/dist/chunks/numbers-CM-lcmt4.js.map +1 -0
  204. package/dist/chunks/parameters-CDV-6Hk5.js +11 -0
  205. package/dist/chunks/parameters-CDV-6Hk5.js.map +1 -0
  206. package/dist/chunks/parameters-DK9cYCAH.cjs +2 -0
  207. package/dist/chunks/parameters-DK9cYCAH.cjs.map +1 -0
  208. package/dist/chunks/satoshi-CZEsHl5X.cjs +2 -0
  209. package/dist/chunks/satoshi-CZEsHl5X.cjs.map +1 -0
  210. package/dist/chunks/satoshi-Ch6y8aYG.js +19 -0
  211. package/dist/chunks/satoshi-Ch6y8aYG.js.map +1 -0
  212. package/dist/chunks/statusConstants-DTDi_4Go.cjs +2 -0
  213. package/dist/chunks/statusConstants-DTDi_4Go.cjs.map +1 -0
  214. package/dist/chunks/statusConstants-ZJia15m2.js +4446 -0
  215. package/dist/chunks/statusConstants-ZJia15m2.js.map +1 -0
  216. package/dist/chunks/storeNetworkFeeSignature-BZUZOxns.js +65 -0
  217. package/dist/chunks/storeNetworkFeeSignature-BZUZOxns.js.map +1 -0
  218. package/dist/chunks/storeNetworkFeeSignature-pV7xUOSo.cjs +2 -0
  219. package/dist/chunks/storeNetworkFeeSignature-pV7xUOSo.cjs.map +1 -0
  220. package/dist/chunks/time-I-BeyUkG.cjs +2 -0
  221. package/dist/chunks/time-I-BeyUkG.cjs.map +1 -0
  222. package/dist/chunks/time-QPeEEEnQ.js +24 -0
  223. package/dist/chunks/time-QPeEEEnQ.js.map +1 -0
  224. package/dist/chunks/token-addresses-D859i6tX.cjs +2 -0
  225. package/dist/chunks/token-addresses-D859i6tX.cjs.map +1 -0
  226. package/dist/chunks/token-addresses-DmAr89jP.js +579 -0
  227. package/dist/chunks/token-addresses-DmAr89jP.js.map +1 -0
  228. package/dist/chunks/tokens-Bw35TZqd.js +6663 -0
  229. package/dist/chunks/tokens-Bw35TZqd.js.map +1 -0
  230. package/dist/chunks/tokens-DLGMNeqZ.cjs +2 -0
  231. package/dist/chunks/tokens-DLGMNeqZ.cjs.map +1 -0
  232. package/dist/chunks/unstakeLBTC-CqZzj9WL.cjs +2 -0
  233. package/dist/chunks/unstakeLBTC-CqZzj9WL.cjs.map +1 -0
  234. package/dist/chunks/unstakeLBTC-Huy_ncVl.js +3866 -0
  235. package/dist/chunks/unstakeLBTC-Huy_ncVl.js.map +1 -0
  236. package/dist/chunks/withdraw-CVNVJ7-x.js +209 -0
  237. package/dist/chunks/withdraw-CVNVJ7-x.js.map +1 -0
  238. package/dist/chunks/withdraw-Z77x7Hj4.cjs +12 -0
  239. package/dist/chunks/withdraw-Z77x7Hj4.cjs.map +1 -0
  240. package/dist/client/ApiNamespace.d.ts +39 -0
  241. package/dist/client/ApiNamespace.d.ts.map +1 -1
  242. package/dist/client/createLombardSDK.d.ts.map +1 -1
  243. package/dist/clients/rpc-url-config.d.ts.map +1 -1
  244. package/dist/common/chains.d.ts +2 -2
  245. package/dist/common/chains.d.ts.map +1 -1
  246. package/dist/common/feature-config.d.ts +7 -7
  247. package/dist/contract-functions/getBasculeDepositStatus/getBasculeDepositStatus.d.ts.map +1 -1
  248. package/dist/contracts.cjs +2 -0
  249. package/dist/contracts.cjs.map +1 -0
  250. package/dist/contracts.js +32 -0
  251. package/dist/contracts.js.map +1 -0
  252. package/dist/core/assets/catalog.d.ts.map +1 -1
  253. package/dist/core/index.d.ts +1 -1
  254. package/dist/core/index.d.ts.map +1 -1
  255. package/dist/core/types.d.ts +0 -4
  256. package/dist/core/types.d.ts.map +1 -1
  257. package/dist/core.cjs +2 -0
  258. package/dist/core.cjs.map +1 -0
  259. package/dist/core.js +101 -0
  260. package/dist/core.js.map +1 -0
  261. package/dist/debug.cjs +2 -0
  262. package/dist/debug.cjs.map +1 -0
  263. package/dist/debug.js +7 -0
  264. package/dist/debug.js.map +1 -0
  265. package/dist/defi.cjs +2 -0
  266. package/dist/defi.cjs.map +1 -0
  267. package/dist/defi.js +14 -0
  268. package/dist/defi.js.map +1 -0
  269. package/dist/entries/api.d.ts +26 -0
  270. package/dist/entries/api.d.ts.map +1 -0
  271. package/dist/entries/bridge.d.ts +7 -0
  272. package/dist/entries/bridge.d.ts.map +1 -0
  273. package/dist/entries/btc.d.ts +11 -0
  274. package/dist/entries/btc.d.ts.map +1 -0
  275. package/dist/entries/contracts.d.ts +23 -0
  276. package/dist/entries/contracts.d.ts.map +1 -0
  277. package/dist/entries/core.d.ts +45 -0
  278. package/dist/entries/core.d.ts.map +1 -0
  279. package/dist/entries/debug.d.ts +9 -0
  280. package/dist/entries/debug.d.ts.map +1 -0
  281. package/dist/entries/defi.d.ts +7 -0
  282. package/dist/entries/defi.d.ts.map +1 -0
  283. package/dist/entries/evm.d.ts +17 -0
  284. package/dist/entries/evm.d.ts.map +1 -0
  285. package/dist/entries/metrics.d.ts +10 -0
  286. package/dist/entries/metrics.d.ts.map +1 -0
  287. package/dist/entries/utils.d.ts +21 -0
  288. package/dist/entries/utils.d.ts.map +1 -0
  289. package/dist/entries/vaults.d.ts +7 -0
  290. package/dist/entries/vaults.d.ts.map +1 -0
  291. package/dist/evm.cjs +2 -0
  292. package/dist/evm.cjs.map +1 -0
  293. package/dist/evm.js +48 -0
  294. package/dist/evm.js.map +1 -0
  295. package/dist/index.cjs +2 -1
  296. package/dist/index.cjs.map +1 -0
  297. package/dist/index.d.ts +49 -17
  298. package/dist/index.d.ts.map +1 -1
  299. package/dist/index.js +293 -267
  300. package/dist/index.js.map +1 -0
  301. package/dist/metrics.cjs +2 -0
  302. package/dist/metrics.cjs.map +1 -0
  303. package/dist/metrics.js +9 -0
  304. package/dist/metrics.js.map +1 -0
  305. package/dist/shared/errors.d.ts +14 -1
  306. package/dist/shared/errors.d.ts.map +1 -1
  307. package/dist/shared/events.d.ts +25 -2
  308. package/dist/shared/events.d.ts.map +1 -1
  309. package/dist/tokens/token-addresses.d.ts +2 -2
  310. package/dist/tokens/token-addresses.d.ts.map +1 -1
  311. package/dist/utils.cjs +2 -0
  312. package/dist/utils.cjs.map +1 -0
  313. package/dist/utils.js +101 -0
  314. package/dist/utils.js.map +1 -0
  315. package/dist/vaults/lib/config.d.ts +1 -1
  316. package/dist/vaults.cjs +2 -0
  317. package/dist/vaults.cjs.map +1 -0
  318. package/dist/vaults.js +18 -0
  319. package/dist/vaults.js.map +1 -0
  320. package/package.json +98 -6
  321. package/dist/ccip.cjs +0 -1
  322. package/dist/ccip.js +0 -149
  323. package/dist/index2.cjs +0 -66
  324. package/dist/index2.js +0 -48300
@@ -0,0 +1,4446 @@
1
+ var Fe = Object.defineProperty;
2
+ var je = (n, e, t) => e in n ? Fe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var I = (n, e, t) => je(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { r as T } from "./index-CfcQ_g3t.js";
5
+ import { A as V } from "./defi-registry-dhrQMy94.js";
6
+ import { q as He, m as ze, w as qe, S as We, v as Ke, p as Ge, z as Ye, y as Je } from "./token-addresses-DmAr89jP.js";
7
+ import * as me from "bitcoinjs-lib";
8
+ import { M as Xe } from "./constants-CuT4axsy.js";
9
+ const Qe = "4.2.0", nn = "@lombard.finance/sdk", sn = typeof window < "u" && typeof window.document < "u" ? "browser" : typeof process < "u" && process.versions && process.versions.node ? "node" : "unknown";
10
+ var et = /* @__PURE__ */ ((n) => (n.UNKNOWN_ERROR = "unknown-error", n.INVALID_CONFIGURATION = "invalid-configuration", n.OPERATION_TIMEOUT = "operation-timeout", n.OPERATION_CANCELLED = "operation-cancelled", n))(et || {}), tt = /* @__PURE__ */ ((n) => (n.PROVIDER_MISSING = "provider-missing", n.PROVIDER_INITIALIZATION_FAILED = "provider-initialization-failed", n.PROVIDER_CALL_FAILED = "provider-call-failed", n.SIGNER_MISSING = "signer-missing", n.USER_REJECTED = "user-rejected", n.NETWORK_MISMATCH = "network-mismatch", n))(tt || {}), nt = /* @__PURE__ */ ((n) => (n.ROUTE_NOT_FOUND = "route-not-found", n.INVALID_ROUTE_DEFINITION = "invalid-route-definition", n.UNSUPPORTED_CHAIN = "unsupported-chain", n.UNSUPPORTED_ASSET = "unsupported-asset", n.INCOMPATIBLE_ROUTE = "incompatible-route", n.ENVIRONMENT_MISMATCH = "environment-mismatch", n))(nt || {}), Z = /* @__PURE__ */ ((n) => (n.INVALID_ADDRESS = "invalid-address", n.INVALID_AMOUNT = "invalid-amount", n.AMOUNT_TOO_SMALL = "amount-too-small", n.AMOUNT_TOO_LARGE = "amount-too-large", n.INSUFFICIENT_BALANCE = "insufficient-balance", n.INVALID_PARAMETER = "invalid-parameter", n.MISSING_REQUIRED_PARAMETER = "missing-required-parameter", n.INVALID_CHAIN = "invalid-chain", n.INVALID_STATE = "invalid-state", n.INVALID_ASSET = "invalid-asset", n))(Z || {}), st = /* @__PURE__ */ ((n) => (n.CONTRACT_CALL_FAILED = "contract-call-failed", n.TRANSACTION_FAILED = "transaction-failed", n.TRANSACTION_REVERTED = "transaction-reverted", n.APPROVAL_FAILED = "approval-failed", n.INSUFFICIENT_ALLOWANCE = "insufficient-allowance", n.GAS_ESTIMATION_FAILED = "gas-estimation-failed", n))(st || {}), at = /* @__PURE__ */ ((n) => (n.INSUFFICIENT_SHARES = "withdraw-insufficient-shares", n.INVALID_AMOUNT = "withdraw-invalid-amount", n.NO_PENDING_WITHDRAWAL = "withdraw-no-pending", n.WITHDRAWAL_ALREADY_FULFILLED = "withdraw-already-fulfilled", n.WITHDRAWAL_EXPIRED = "withdraw-expired", n.WITHDRAWAL_NOT_FOUND = "withdraw-not-found", n.PROTOCOL_NOT_SUPPORTED = "withdraw-protocol-not-supported", n.INSUFFICIENT_LIQUIDITY = "withdraw-insufficient-liquidity", n))(at || {});
11
+ class E extends Error {
12
+ constructor(t, s, a) {
13
+ super(s);
14
+ /** Machine-readable error code */
15
+ I(this, "code");
16
+ /** Additional metadata for debugging */
17
+ I(this, "metadata");
18
+ /** SDK version when error occurred (for debugging) */
19
+ I(this, "sdkVersion", Qe);
20
+ /** Timestamp when error occurred */
21
+ I(this, "timestamp", (/* @__PURE__ */ new Date()).toISOString());
22
+ this.name = "LombardError", this.code = t, this.metadata = a, Error.captureStackTrace && Error.captureStackTrace(this, E);
23
+ }
24
+ /**
25
+ * Serialize error to JSON for logging
26
+ *
27
+ * Includes all context needed for debugging: code, message, metadata,
28
+ * SDK version, timestamp, and stack trace.
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * try {
33
+ * await action.execute();
34
+ * } catch (error) {
35
+ * if (error instanceof LombardError) {
36
+ * console.log(JSON.stringify(error.toJSON(), null, 2));
37
+ * }
38
+ * }
39
+ * ```
40
+ */
41
+ toJSON() {
42
+ return {
43
+ name: this.name,
44
+ code: this.code,
45
+ message: this.message,
46
+ sdkVersion: this.sdkVersion,
47
+ timestamp: this.timestamp,
48
+ ...this.metadata && { metadata: this.metadata },
49
+ ...this.stack && { stack: this.stack }
50
+ };
51
+ }
52
+ /**
53
+ * Get Sentry-compatible context for error reporting
54
+ *
55
+ * Returns an object suitable for Sentry's `extra` or `contexts` fields.
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * try {
60
+ * await action.execute();
61
+ * } catch (error) {
62
+ * if (error instanceof LombardError) {
63
+ * Sentry.captureException(error, {
64
+ * contexts: { lombard: error.toSentryContext() },
65
+ * });
66
+ * }
67
+ * }
68
+ * ```
69
+ */
70
+ toSentryContext() {
71
+ return {
72
+ "sdk.version": this.sdkVersion,
73
+ "error.code": this.code,
74
+ "error.timestamp": this.timestamp,
75
+ ...this.metadata
76
+ };
77
+ }
78
+ /**
79
+ * Factory: Invalid configuration error
80
+ */
81
+ static invalidConfiguration(t) {
82
+ return new E("invalid-configuration", t);
83
+ }
84
+ /**
85
+ * Factory: Provider missing error
86
+ */
87
+ static providerMissing(t, s) {
88
+ return new E(
89
+ "provider-missing",
90
+ `${s} provider not configured for chain ${t}. Please provide a provider via SDK initialization.`,
91
+ { chain: t, providerType: s }
92
+ );
93
+ }
94
+ static moduleMissing(t) {
95
+ return new E(
96
+ "invalid-parameter",
97
+ `Module "${t}" is not registered. Install and register the corresponding package via createConfig({ modules: [...] }).`,
98
+ { moduleId: t }
99
+ );
100
+ }
101
+ /**
102
+ * Factory: Provider call failed error
103
+ */
104
+ static providerCallFailed(t, s) {
105
+ const a = s instanceof Error ? s.message : s;
106
+ return new E(
107
+ "provider-call-failed",
108
+ `Provider method ${t} failed: ${a}`,
109
+ { method: t, cause: a }
110
+ );
111
+ }
112
+ /**
113
+ * Factory: User rejected transaction
114
+ */
115
+ static userRejected(t) {
116
+ return new E(
117
+ "user-rejected",
118
+ `User rejected ${t}. Please try again and approve the transaction in your wallet.`,
119
+ { operation: t }
120
+ );
121
+ }
122
+ /**
123
+ * Factory: Route not found in registry
124
+ */
125
+ static routeNotFound(t) {
126
+ return new E(
127
+ "route-not-found",
128
+ "No route found matching the provided parameters. Please verify the asset and chain combination is supported.",
129
+ t
130
+ );
131
+ }
132
+ /**
133
+ * Factory: Invalid route definition
134
+ */
135
+ static invalidRouteDefinition(t) {
136
+ return new E(
137
+ "invalid-route-definition",
138
+ `Invalid route definition: ${t}`,
139
+ { reason: t }
140
+ );
141
+ }
142
+ /**
143
+ * Factory: Unsupported chain
144
+ */
145
+ static unsupportedChain(t) {
146
+ return new E(
147
+ "unsupported-chain",
148
+ `Chain ${t} is not supported in the current environment.`,
149
+ { chain: t }
150
+ );
151
+ }
152
+ /**
153
+ * Factory: Invalid parameter
154
+ */
155
+ static invalidParameter(t, s) {
156
+ return new E("invalid-parameter", s, {
157
+ parameter: t
158
+ });
159
+ }
160
+ /**
161
+ * Factory: Invalid address
162
+ */
163
+ static invalidAddress(t, s) {
164
+ return new E(
165
+ "invalid-address",
166
+ `Invalid address format: ${t}${s ? ` for chain ${s}` : ""}`,
167
+ { address: t, chain: s }
168
+ );
169
+ }
170
+ /**
171
+ * Factory: Invalid amount
172
+ */
173
+ static invalidAmount(t) {
174
+ return new E("invalid-amount", t, {
175
+ reason: t
176
+ });
177
+ }
178
+ /**
179
+ * Factory: Amount too small
180
+ */
181
+ static amountTooSmall(t, s, a) {
182
+ return new E(
183
+ "amount-too-small",
184
+ `Amount ${t} is below minimum ${s} ${a}`,
185
+ { amount: t, minimum: s, asset: a }
186
+ );
187
+ }
188
+ /**
189
+ * Factory: Insufficient balance
190
+ */
191
+ static insufficientBalance(t, s, a) {
192
+ return new E(
193
+ "insufficient-balance",
194
+ `Insufficient ${a} balance. Required: ${t}, Available: ${s}`,
195
+ { required: t, available: s, asset: a }
196
+ );
197
+ }
198
+ /**
199
+ * Factory: Missing required parameter
200
+ */
201
+ static missingParameter(t) {
202
+ return new E(
203
+ "missing-required-parameter",
204
+ `Required parameter "${t}" is missing`,
205
+ { parameterName: t }
206
+ );
207
+ }
208
+ /**
209
+ * Factory: Transaction failed
210
+ */
211
+ static transactionFailed(t, s) {
212
+ return new E(
213
+ "transaction-failed",
214
+ `Transaction failed: ${s}`,
215
+ { txHash: t, reason: s }
216
+ );
217
+ }
218
+ /**
219
+ * Factory: Transaction reverted
220
+ */
221
+ static transactionReverted(t, s) {
222
+ return new E(
223
+ "transaction-reverted",
224
+ `Transaction reverted${s ? `: ${s}` : ""}`,
225
+ { txHash: t, revertReason: s }
226
+ );
227
+ }
228
+ /**
229
+ * Factory: Approval failed
230
+ */
231
+ static approvalFailed(t, s) {
232
+ return new E(
233
+ "approval-failed",
234
+ `Failed to approve ${t} for spender ${s}`,
235
+ { token: t, spender: s }
236
+ );
237
+ }
238
+ }
239
+ function rt(n) {
240
+ return n instanceof E;
241
+ }
242
+ function pe(n) {
243
+ return rt(n) ? n : n instanceof Error ? new E("unknown-error", n.message, {
244
+ originalError: n.stack
245
+ }) : new E("unknown-error", String(n), {
246
+ originalValue: n
247
+ });
248
+ }
249
+ const p = {
250
+ // Official CAIP-2 namespaces
251
+ BIP122: "bip122",
252
+ EIP155: "eip155",
253
+ SOLANA: "solana",
254
+ STARKNET: "starknet",
255
+ // Unofficial namespaces (internal use)
256
+ SUI: "sui",
257
+ ZCASH: "zcash",
258
+ RIPPLE: "ripple",
259
+ DOGECOIN: "dogecoin",
260
+ HYPERLIQUID: "hyperliquid"
261
+ }, fe = ":", g = (n, e) => `${n}${fe}${e}`, o = {
262
+ // Bitcoin chains (BIP122: first 32 chars of genesis block hash in little-endian)
263
+ BITCOIN_MAINNET: g(
264
+ p.BIP122,
265
+ "000000000019d6689c085ae165831e93"
266
+ ),
267
+ BITCOIN_SIGNET: g(
268
+ p.BIP122,
269
+ "00000008819873e925422c1ff0f99f7c"
270
+ ),
271
+ // EVM chains (EIP155: numeric chain ID)
272
+ ETHEREUM: g(p.EIP155, 1),
273
+ BASE: g(p.EIP155, 8453),
274
+ BASE_SEPOLIA: g(p.EIP155, 84532),
275
+ OPTIMISM: g(p.EIP155, 10),
276
+ POLYGON: g(p.EIP155, 137),
277
+ BSC: g(p.EIP155, 56),
278
+ BSC_TESTNET: g(p.EIP155, 97),
279
+ AVALANCHE: g(p.EIP155, 43114),
280
+ AVALANCHE_FUJI: g(p.EIP155, 43113),
281
+ BERACHAIN: g(p.EIP155, 80094),
282
+ BERACHAIN_BARTIO: g(p.EIP155, 80084),
283
+ BOB: g(p.EIP155, 60808),
284
+ CORN: g(p.EIP155, 21e6),
285
+ ETHERLINK: g(p.EIP155, 42793),
286
+ KATANA: g(p.EIP155, 747474),
287
+ KATANA_TATARA: g(p.EIP155, 129399),
288
+ MORPH: g(p.EIP155, 2818),
289
+ SONIC: g(p.EIP155, 146),
290
+ SONIC_TESTNET: g(p.EIP155, 57054),
291
+ SONIC_BLAZE_TESTNET: g(p.EIP155, 57054),
292
+ // Alias
293
+ SWELL: g(p.EIP155, 1923),
294
+ TAC: g(p.EIP155, 239),
295
+ SEPOLIA: g(p.EIP155, 11155111),
296
+ HOLESKY: g(p.EIP155, 17e3),
297
+ MEGAETH: g(p.EIP155, 4326),
298
+ MONAD: g(p.EIP155, 143),
299
+ STABLE: g(p.EIP155, 988),
300
+ // Solana chains (first 32 chars of genesis hash)
301
+ SOLANA_MAINNET: g(
302
+ p.SOLANA,
303
+ "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"
304
+ ),
305
+ SOLANA_DEVNET: g(
306
+ p.SOLANA,
307
+ "EtWTRABZaYq6iMfeYKouRu166VU2xqa1"
308
+ ),
309
+ SOLANA_TESTNET: g(
310
+ p.SOLANA,
311
+ "4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"
312
+ ),
313
+ // Sui chains (unofficial namespace, using cluster names)
314
+ SUI_MAINNET: g(p.SUI, "mainnet"),
315
+ SUI_TESTNET: g(p.SUI, "testnet"),
316
+ SUI_DEVNET: g(p.SUI, "devnet"),
317
+ // Starknet chains (uses network identifiers)
318
+ STARKNET_MAINNET: g(p.STARKNET, "SN_MAIN"),
319
+ STARKNET_SEPOLIA: g(p.STARKNET, "SN_SEPOLIA"),
320
+ // Zcash (unofficial namespace)
321
+ ZCASH_MAINNET: g(p.ZCASH, "mainnet"),
322
+ ZCASH_TESTNET: g(p.ZCASH, "testnet"),
323
+ // Ripple (unofficial namespace)
324
+ RIPPLE_MAINNET: g(p.RIPPLE, "mainnet"),
325
+ RIPPLE_TESTNET: g(p.RIPPLE, "testnet"),
326
+ // Dogecoin (unofficial namespace)
327
+ DOGECOIN_MAINNET: g(p.DOGECOIN, "mainnet"),
328
+ DOGECOIN_TESTNET: g(p.DOGECOIN, "testnet"),
329
+ // Custodial (unofficial namespace)
330
+ HYPERLIQUID: g(p.HYPERLIQUID, "mainnet")
331
+ };
332
+ function an(n) {
333
+ return Object.keys(o).find(
334
+ (e) => o[e] === n
335
+ ) ?? "";
336
+ }
337
+ function rn(n) {
338
+ return typeof n == "string" && Object.values(o).includes(n);
339
+ }
340
+ const G = {
341
+ // ─────────────────────────────────────────────────────────────────────────
342
+ // Bitcoin
343
+ // ─────────────────────────────────────────────────────────────────────────
344
+ [o.BITCOIN_MAINNET]: {
345
+ name: "Bitcoin",
346
+ type: "bitcoin",
347
+ isTestnet: !1,
348
+ explorerUrl: "https://mempool.space",
349
+ nativeCurrency: "BTC",
350
+ badgeVariant: "warning"
351
+ },
352
+ [o.BITCOIN_SIGNET]: {
353
+ name: "Bitcoin Signet",
354
+ type: "bitcoin",
355
+ isTestnet: !0,
356
+ explorerUrl: "https://mempool.space/signet",
357
+ nativeCurrency: "BTC",
358
+ badgeVariant: "warning"
359
+ },
360
+ // ─────────────────────────────────────────────────────────────────────────
361
+ // EVM Mainnets
362
+ // ─────────────────────────────────────────────────────────────────────────
363
+ [o.ETHEREUM]: {
364
+ name: "Ethereum",
365
+ type: "evm",
366
+ isTestnet: !1,
367
+ explorerUrl: "https://etherscan.io",
368
+ nativeCurrency: "ETH",
369
+ badgeVariant: "info"
370
+ },
371
+ [o.BASE]: {
372
+ name: "Base",
373
+ type: "evm",
374
+ isTestnet: !1,
375
+ explorerUrl: "https://basescan.org",
376
+ nativeCurrency: "ETH",
377
+ badgeVariant: "info"
378
+ },
379
+ [o.OPTIMISM]: {
380
+ name: "Optimism",
381
+ type: "evm",
382
+ isTestnet: !1,
383
+ explorerUrl: "https://optimistic.etherscan.io",
384
+ nativeCurrency: "ETH",
385
+ badgeVariant: "info"
386
+ },
387
+ [o.POLYGON]: {
388
+ name: "Polygon",
389
+ type: "evm",
390
+ isTestnet: !1,
391
+ explorerUrl: "https://polygonscan.com",
392
+ nativeCurrency: "MATIC",
393
+ badgeVariant: "info"
394
+ },
395
+ [o.BSC]: {
396
+ name: "BNB Chain",
397
+ type: "evm",
398
+ isTestnet: !1,
399
+ explorerUrl: "https://bscscan.com",
400
+ nativeCurrency: "BNB",
401
+ badgeVariant: "info"
402
+ },
403
+ [o.AVALANCHE]: {
404
+ name: "Avalanche",
405
+ type: "evm",
406
+ isTestnet: !1,
407
+ explorerUrl: "https://snowtrace.io",
408
+ nativeCurrency: "AVAX",
409
+ badgeVariant: "info"
410
+ },
411
+ [o.BERACHAIN]: {
412
+ name: "Berachain",
413
+ type: "evm",
414
+ isTestnet: !1,
415
+ explorerUrl: "https://beratrail.io",
416
+ nativeCurrency: "BERA",
417
+ badgeVariant: "info"
418
+ },
419
+ [o.BOB]: {
420
+ name: "BOB",
421
+ type: "evm",
422
+ isTestnet: !1,
423
+ explorerUrl: "https://explorer.gobob.xyz",
424
+ nativeCurrency: "ETH",
425
+ badgeVariant: "info"
426
+ },
427
+ [o.CORN]: {
428
+ name: "Corn",
429
+ type: "evm",
430
+ isTestnet: !1,
431
+ explorerUrl: "https://cornscan.io",
432
+ nativeCurrency: "BTCN",
433
+ badgeVariant: "info"
434
+ },
435
+ [o.ETHERLINK]: {
436
+ name: "Etherlink",
437
+ type: "evm",
438
+ isTestnet: !1,
439
+ explorerUrl: "https://explorer.etherlink.com",
440
+ nativeCurrency: "XTZ",
441
+ badgeVariant: "info"
442
+ },
443
+ [o.KATANA]: {
444
+ name: "Katana",
445
+ type: "evm",
446
+ isTestnet: !1,
447
+ explorerUrl: "https://explorer.katanarpc.com",
448
+ nativeCurrency: "BTC.b",
449
+ badgeVariant: "info"
450
+ },
451
+ [o.MORPH]: {
452
+ name: "Morph",
453
+ type: "evm",
454
+ isTestnet: !1,
455
+ explorerUrl: "https://explorer.morphl2.io",
456
+ nativeCurrency: "ETH",
457
+ badgeVariant: "info"
458
+ },
459
+ [o.SONIC]: {
460
+ name: "Sonic",
461
+ type: "evm",
462
+ isTestnet: !1,
463
+ explorerUrl: "https://sonicscan.org",
464
+ nativeCurrency: "S",
465
+ badgeVariant: "info"
466
+ },
467
+ [o.SWELL]: {
468
+ name: "Swell",
469
+ type: "evm",
470
+ isTestnet: !1,
471
+ explorerUrl: "https://explorer.swellnetwork.io",
472
+ nativeCurrency: "ETH",
473
+ badgeVariant: "info"
474
+ },
475
+ [o.TAC]: {
476
+ name: "TAC",
477
+ type: "evm",
478
+ isTestnet: !1,
479
+ explorerUrl: "https://explorer.tac.build",
480
+ nativeCurrency: "TAC",
481
+ badgeVariant: "info"
482
+ },
483
+ [o.MEGAETH]: {
484
+ name: "MegaETH",
485
+ type: "evm",
486
+ isTestnet: !1,
487
+ explorerUrl: "https://megaeth-testnet-v3.blockscout.com",
488
+ nativeCurrency: "ETH",
489
+ badgeVariant: "info"
490
+ },
491
+ [o.MONAD]: {
492
+ name: "Monad",
493
+ type: "evm",
494
+ isTestnet: !1,
495
+ explorerUrl: "https://monadvision.com",
496
+ nativeCurrency: "MONAD",
497
+ badgeVariant: "info"
498
+ },
499
+ [o.STABLE]: {
500
+ name: "Stable",
501
+ type: "evm",
502
+ isTestnet: !1,
503
+ explorerUrl: "https://stablescan.xyz",
504
+ nativeCurrency: "USD",
505
+ badgeVariant: "info"
506
+ },
507
+ // ─────────────────────────────────────────────────────────────────────────
508
+ // EVM Testnets
509
+ // ─────────────────────────────────────────────────────────────────────────
510
+ [o.BASE_SEPOLIA]: {
511
+ name: "Base Sepolia",
512
+ type: "evm",
513
+ isTestnet: !0,
514
+ explorerUrl: "https://sepolia.basescan.org",
515
+ nativeCurrency: "ETH",
516
+ badgeVariant: "secondary"
517
+ },
518
+ [o.BSC_TESTNET]: {
519
+ name: "BNB Testnet",
520
+ type: "evm",
521
+ isTestnet: !0,
522
+ explorerUrl: "https://testnet.bscscan.com",
523
+ nativeCurrency: "BNB",
524
+ badgeVariant: "secondary"
525
+ },
526
+ [o.AVALANCHE_FUJI]: {
527
+ name: "Avalanche Fuji",
528
+ type: "evm",
529
+ isTestnet: !0,
530
+ explorerUrl: "https://testnet.snowtrace.io",
531
+ nativeCurrency: "AVAX",
532
+ badgeVariant: "secondary"
533
+ },
534
+ [o.BERACHAIN_BARTIO]: {
535
+ name: "Berachain Bartio",
536
+ type: "evm",
537
+ isTestnet: !0,
538
+ explorerUrl: "https://bartio.beratrail.io",
539
+ nativeCurrency: "BERA",
540
+ badgeVariant: "secondary"
541
+ },
542
+ [o.KATANA_TATARA]: {
543
+ name: "Katana Tatara",
544
+ type: "evm",
545
+ isTestnet: !0,
546
+ explorerUrl: "https://explorer.tatara.katanarpc.com",
547
+ nativeCurrency: "BTC.b",
548
+ badgeVariant: "secondary"
549
+ },
550
+ // Note: SONIC_TESTNET and SONIC_BLAZE_TESTNET are the same chain (eip155:57054)
551
+ [o.SONIC_TESTNET]: {
552
+ name: "Sonic Blaze Testnet",
553
+ type: "evm",
554
+ isTestnet: !0,
555
+ explorerUrl: "https://testnet.sonicscan.org",
556
+ nativeCurrency: "S",
557
+ badgeVariant: "secondary"
558
+ },
559
+ [o.SEPOLIA]: {
560
+ name: "Sepolia",
561
+ type: "evm",
562
+ isTestnet: !0,
563
+ explorerUrl: "https://sepolia.etherscan.io",
564
+ nativeCurrency: "ETH",
565
+ badgeVariant: "secondary"
566
+ },
567
+ [o.HOLESKY]: {
568
+ name: "Holesky",
569
+ type: "evm",
570
+ isTestnet: !0,
571
+ explorerUrl: "https://holesky.etherscan.io",
572
+ nativeCurrency: "ETH",
573
+ badgeVariant: "secondary"
574
+ },
575
+ // ─────────────────────────────────────────────────────────────────────────
576
+ // Solana
577
+ // ─────────────────────────────────────────────────────────────────────────
578
+ [o.SOLANA_MAINNET]: {
579
+ name: "Solana",
580
+ type: "solana",
581
+ isTestnet: !1,
582
+ explorerUrl: "https://solscan.io",
583
+ nativeCurrency: "SOL",
584
+ badgeVariant: "success"
585
+ },
586
+ [o.SOLANA_DEVNET]: {
587
+ name: "Solana Devnet",
588
+ type: "solana",
589
+ isTestnet: !0,
590
+ explorerUrl: "https://solscan.io?cluster=devnet",
591
+ nativeCurrency: "SOL",
592
+ badgeVariant: "secondary"
593
+ },
594
+ [o.SOLANA_TESTNET]: {
595
+ name: "Solana Testnet",
596
+ type: "solana",
597
+ isTestnet: !0,
598
+ explorerUrl: "https://solscan.io?cluster=testnet",
599
+ nativeCurrency: "SOL",
600
+ badgeVariant: "secondary"
601
+ },
602
+ // ─────────────────────────────────────────────────────────────────────────
603
+ // Sui
604
+ // ─────────────────────────────────────────────────────────────────────────
605
+ [o.SUI_MAINNET]: {
606
+ name: "Sui",
607
+ type: "sui",
608
+ isTestnet: !1,
609
+ explorerUrl: "https://suiscan.xyz",
610
+ nativeCurrency: "SUI",
611
+ badgeVariant: "info"
612
+ },
613
+ [o.SUI_TESTNET]: {
614
+ name: "Sui Testnet",
615
+ type: "sui",
616
+ isTestnet: !0,
617
+ explorerUrl: "https://suiscan.xyz/testnet",
618
+ nativeCurrency: "SUI",
619
+ badgeVariant: "secondary"
620
+ },
621
+ [o.SUI_DEVNET]: {
622
+ name: "Sui Devnet",
623
+ type: "sui",
624
+ isTestnet: !0,
625
+ explorerUrl: "https://suiscan.xyz/devnet",
626
+ nativeCurrency: "SUI",
627
+ badgeVariant: "secondary"
628
+ },
629
+ // ─────────────────────────────────────────────────────────────────────────
630
+ // Starknet
631
+ // ─────────────────────────────────────────────────────────────────────────
632
+ [o.STARKNET_MAINNET]: {
633
+ name: "Starknet",
634
+ type: "starknet",
635
+ isTestnet: !1,
636
+ explorerUrl: "https://starkscan.co",
637
+ nativeCurrency: "ETH",
638
+ badgeVariant: "info"
639
+ },
640
+ [o.STARKNET_SEPOLIA]: {
641
+ name: "Starknet Sepolia",
642
+ type: "starknet",
643
+ isTestnet: !0,
644
+ explorerUrl: "https://sepolia.starkscan.co",
645
+ nativeCurrency: "ETH",
646
+ badgeVariant: "secondary"
647
+ },
648
+ // ─────────────────────────────────────────────────────────────────────────
649
+ // Zcash
650
+ // ─────────────────────────────────────────────────────────────────────────
651
+ [o.ZCASH_MAINNET]: {
652
+ name: "Zcash",
653
+ type: "zcash",
654
+ isTestnet: !1,
655
+ explorerUrl: "https://zcashblockexplorer.com",
656
+ nativeCurrency: "ZEC",
657
+ badgeVariant: "warning"
658
+ },
659
+ [o.ZCASH_TESTNET]: {
660
+ name: "Zcash Testnet",
661
+ type: "zcash",
662
+ isTestnet: !0,
663
+ nativeCurrency: "ZEC",
664
+ badgeVariant: "secondary"
665
+ },
666
+ // ─────────────────────────────────────────────────────────────────────────
667
+ // Ripple
668
+ // ─────────────────────────────────────────────────────────────────────────
669
+ [o.RIPPLE_MAINNET]: {
670
+ name: "XRP Ledger",
671
+ type: "ripple",
672
+ isTestnet: !1,
673
+ explorerUrl: "https://xrpscan.com",
674
+ nativeCurrency: "XRP",
675
+ badgeVariant: "secondary"
676
+ },
677
+ [o.RIPPLE_TESTNET]: {
678
+ name: "XRP Testnet",
679
+ type: "ripple",
680
+ isTestnet: !0,
681
+ nativeCurrency: "XRP",
682
+ badgeVariant: "secondary"
683
+ },
684
+ // ─────────────────────────────────────────────────────────────────────────
685
+ // Dogecoin
686
+ // ─────────────────────────────────────────────────────────────────────────
687
+ [o.DOGECOIN_MAINNET]: {
688
+ name: "Dogecoin",
689
+ type: "dogecoin",
690
+ isTestnet: !1,
691
+ explorerUrl: "https://dogechain.info",
692
+ nativeCurrency: "DOGE",
693
+ badgeVariant: "warning"
694
+ },
695
+ [o.DOGECOIN_TESTNET]: {
696
+ name: "Dogecoin Testnet",
697
+ type: "dogecoin",
698
+ isTestnet: !0,
699
+ nativeCurrency: "DOGE",
700
+ badgeVariant: "secondary"
701
+ },
702
+ // ─────────────────────────────────────────────────────────────────────────
703
+ // Other
704
+ // ─────────────────────────────────────────────────────────────────────────
705
+ [o.HYPERLIQUID]: {
706
+ name: "Hyperliquid",
707
+ type: "hyperliquid",
708
+ isTestnet: !1,
709
+ nativeCurrency: "USDC",
710
+ badgeVariant: "secondary"
711
+ }
712
+ }, it = {
713
+ "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": Ke,
714
+ EtWTRABZaYq6iMfeYKouRu166VU2xqa1: We,
715
+ "4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z": qe
716
+ }, ct = {
717
+ SN_MAIN: Je,
718
+ SN_SEPOLIA: Ye
719
+ };
720
+ function ot(n) {
721
+ return ct[n];
722
+ }
723
+ function cn(n) {
724
+ return G[n];
725
+ }
726
+ function on(n) {
727
+ return G[n].name;
728
+ }
729
+ function dn(n) {
730
+ return G[n].type;
731
+ }
732
+ function un(n) {
733
+ return G[n].isTestnet;
734
+ }
735
+ function ln(n) {
736
+ return !G[n].isTestnet;
737
+ }
738
+ function Le(n) {
739
+ return G[n].type === "evm";
740
+ }
741
+ const Q = (n) => `${n}${fe}`;
742
+ function fn(n) {
743
+ const e = Q(p.EIP155);
744
+ if (n.startsWith(e)) {
745
+ const r = Number.parseInt(n.slice(e.length), 10);
746
+ if (He(r)) return r;
747
+ throw new E(
748
+ Z.INVALID_CHAIN,
749
+ `Invalid EVM chain: ${n}`
750
+ );
751
+ }
752
+ const t = Q(p.SOLANA);
753
+ if (n.startsWith(t)) {
754
+ const r = n.slice(t.length), i = `solana:${r}`;
755
+ if (ze(i)) return i;
756
+ const c = it[r];
757
+ if (c) return c;
758
+ throw new E(
759
+ Z.INVALID_CHAIN,
760
+ `Invalid Solana chain: ${n}`
761
+ );
762
+ }
763
+ const s = Q(p.SUI);
764
+ if (n.startsWith(s)) {
765
+ if (Ge(n)) return n;
766
+ throw new E(
767
+ Z.INVALID_CHAIN,
768
+ `Invalid Sui chain: ${n}`
769
+ );
770
+ }
771
+ const a = Q(p.STARKNET);
772
+ if (n.startsWith(a)) {
773
+ const r = n.slice(a.length), i = ot(r);
774
+ if (i) return i;
775
+ throw new E(
776
+ Z.INVALID_CHAIN,
777
+ `Invalid Starknet chain: ${n}`
778
+ );
779
+ }
780
+ throw new E(
781
+ Z.INVALID_CHAIN,
782
+ `Invalid chain: ${n}`
783
+ );
784
+ }
785
+ function hn(n) {
786
+ return `${p.EIP155}${fe}${n}`;
787
+ }
788
+ const S = {
789
+ version: "1.0.0",
790
+ assets: {
791
+ // ═══════════════════════════════════════════════════════════════════════
792
+ // LBTC - Lombard BTC
793
+ // ═══════════════════════════════════════════════════════════════════════
794
+ [V.LBTC]: {
795
+ decimals: 8,
796
+ symbol: "LBTC",
797
+ name: "Lombard BTC",
798
+ deployments: [
799
+ // Production
800
+ {
801
+ env: T.prod,
802
+ chain: o.ETHEREUM,
803
+ address: "0x8236a87084f8b84306f72007f36f2618a5634494"
804
+ },
805
+ {
806
+ env: T.prod,
807
+ chains: [
808
+ o.BASE,
809
+ o.BSC,
810
+ o.BERACHAIN,
811
+ o.CORN,
812
+ o.KATANA,
813
+ o.MORPH,
814
+ o.SONIC,
815
+ o.SWELL,
816
+ o.TAC,
817
+ o.MONAD,
818
+ o.STABLE
819
+ ],
820
+ address: "0xecAc9C5F704e954931349Da37F60E39f515c11c1"
821
+ },
822
+ {
823
+ env: T.prod,
824
+ chain: o.BOB,
825
+ address: "0xA45d4121b3D47719FF57a947A9d961539Ba33204"
826
+ },
827
+ {
828
+ env: T.prod,
829
+ chain: o.SOLANA_MAINNET,
830
+ address: "LomP48F7bLbKyMRHHsDVt7wuHaUQvQnVVspjcbfuAek"
831
+ },
832
+ {
833
+ env: T.prod,
834
+ chain: o.SUI_MAINNET,
835
+ address: "0x3e8e9423d80e1774a7ca128fccd8bf5f1f7753be658c5e645929037f7c819040"
836
+ },
837
+ {
838
+ env: T.prod,
839
+ chain: o.STARKNET_MAINNET,
840
+ address: "0x036834a40984312f7f7de8d31e3f6305b325389eaeea5b1c0664b2fb936461a4",
841
+ assetRouter: "0x05b1886d0f844ab930fc0ee066f1655a873437f15a5d2c41ee3e884fd5299976"
842
+ },
843
+ // Testnet
844
+ {
845
+ env: T.testnet,
846
+ chain: o.SEPOLIA,
847
+ address: "0xc47e4b3124597fdf8dd07843d4a7052f2ee80c30"
848
+ },
849
+ {
850
+ env: T.testnet,
851
+ chains: [
852
+ o.AVALANCHE_FUJI,
853
+ o.BASE_SEPOLIA,
854
+ o.BSC_TESTNET
855
+ ],
856
+ address: "0x107Fc7d90484534704dD2A9e24c7BD45DB4dD1B5"
857
+ },
858
+ {
859
+ env: T.testnet,
860
+ chain: o.SOLANA_TESTNET,
861
+ address: "79cscM6J9Af24TGGWcXyDf56fDLoodkyXdVy4R9aZ6C6"
862
+ },
863
+ {
864
+ env: T.testnet,
865
+ chain: o.SUI_TESTNET,
866
+ address: "0x50454d0b0fbad1288a6ab74f2e8ce0905a3317870673ab7787ebcf6f322b45fa"
867
+ },
868
+ {
869
+ env: T.testnet,
870
+ chain: o.STARKNET_SEPOLIA,
871
+ address: "0x00456a829ab75ba5e97534dc70d7fc617cfda244f8dcda47b11624de67c6e70c",
872
+ assetRouter: "0x063b7b5c8b114ebd5b9602fbd5d0ffd2cc3a598f1d91c6904cc0997cd8fea760"
873
+ },
874
+ // Stage
875
+ // Note: Avalanche Fuji is only supported on testnet (Gastald), not stage
876
+ {
877
+ env: T.stage,
878
+ chains: [
879
+ o.BASE_SEPOLIA,
880
+ o.BSC_TESTNET,
881
+ o.SEPOLIA
882
+ ],
883
+ address: "0x731eFa688F3679688cf60A3993b8658138953ED6"
884
+ },
885
+ {
886
+ env: T.stage,
887
+ chain: o.SOLANA_DEVNET,
888
+ address: "HEY7PCJe3GB27UWdopuYb1xDbB5SNtTcYPxRjntvfBSA"
889
+ },
890
+ {
891
+ env: T.stage,
892
+ chain: o.SUI_TESTNET,
893
+ address: "0x2d66430a27565b912f21be970e5ae1e8c0359f0b518c3235b751c75976791ce0"
894
+ },
895
+ {
896
+ env: T.stage,
897
+ chain: o.STARKNET_SEPOLIA,
898
+ address: "0x00b442f5420860e937a99659326e81a97e07bfd538b3cee65b90029c9da38a5f",
899
+ assetRouter: "0x01d27f156092746d0d7cd9d9deec5e937f27c3c7c1c28365e9e5efac459880b3"
900
+ },
901
+ // Dev
902
+ {
903
+ env: T.dev,
904
+ chain: o.SEPOLIA,
905
+ address: "0x93283b6B889C591893dB0dc93baD71656D5d8923"
906
+ },
907
+ {
908
+ env: T.dev,
909
+ chains: [
910
+ o.AVALANCHE_FUJI,
911
+ o.BASE_SEPOLIA,
912
+ o.BERACHAIN_BARTIO,
913
+ o.BSC_TESTNET
914
+ ],
915
+ address: "0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30"
916
+ },
917
+ {
918
+ env: T.dev,
919
+ chain: o.STARKNET_SEPOLIA,
920
+ address: "0x0723de0c550b7bfbb5051dade72966d71a08bef952c0197462a5244497eb57c1",
921
+ assetRouter: "0x04838a05c798dc57e01e85526979841c84f1f3c732a525cff53adb3e8bee3d24"
922
+ }
923
+ ]
924
+ },
925
+ // ═══════════════════════════════════════════════════════════════════════
926
+ // BTC.b - Lombard's Native BTC Wrapper
927
+ // ═══════════════════════════════════════════════════════════════════════
928
+ [V.BTCb]: {
929
+ decimals: 8,
930
+ symbol: "BTC.b",
931
+ name: "BTC.b",
932
+ deployments: [
933
+ // Production
934
+ {
935
+ env: T.prod,
936
+ chains: [
937
+ o.KATANA,
938
+ o.MEGAETH,
939
+ o.MONAD,
940
+ o.STABLE
941
+ ],
942
+ address: "0xB0F70C0bD6FD87dbEb7C10dC692a2a6106817072"
943
+ },
944
+ {
945
+ env: T.prod,
946
+ chain: o.AVALANCHE,
947
+ address: "0x152b9d0FdC40C096757F570A51E494bd4b943E50",
948
+ bridgeAdapter: "0x85D1D52e11290F174444d21C2a167bEDBE36e4d2"
949
+ },
950
+ // Testnet
951
+ {
952
+ env: T.testnet,
953
+ chain: o.SEPOLIA,
954
+ address: "0x20eA7b8ABb4B583788F1DFC738C709a2d9675681"
955
+ },
956
+ {
957
+ env: T.testnet,
958
+ chain: o.AVALANCHE_FUJI,
959
+ address: "0x7FbdC44BfEBDe80C970ba622B678daB36cee31f6",
960
+ bridgeAdapter: "0x0A65C37d07c32E5eA8ea40495b7f249cdE26935e"
961
+ },
962
+ // Stage
963
+ // Note: Avalanche Fuji is only supported on testnet (Gastald), not stage
964
+ {
965
+ env: T.stage,
966
+ chain: o.SEPOLIA,
967
+ address: "0x600e4006278EB11FA1691cA0FE6C5fcfC4992d58"
968
+ },
969
+ // Dev
970
+ {
971
+ env: T.dev,
972
+ chain: o.SEPOLIA,
973
+ address: "0x195219A262423d209E126BD21cf4F4F9AA796927"
974
+ },
975
+ {
976
+ env: T.dev,
977
+ chain: o.BSC_TESTNET,
978
+ address: "0xea3F66E5f2928dB9673103BfA01a2153A57a8050"
979
+ },
980
+ {
981
+ env: T.dev,
982
+ chain: o.AVALANCHE_FUJI,
983
+ address: "0x7FbdC44BfEBDe80C970ba622B678daB36cee31f6",
984
+ bridgeAdapter: "0x0A65C37d07c32E5eA8ea40495b7f249cdE26935e"
985
+ },
986
+ // IBC
987
+ {
988
+ env: T.ibc,
989
+ chain: o.AVALANCHE_FUJI,
990
+ address: "0x71ba2b8dc58e7ca1b6d81a60729e31aefa37ae02",
991
+ bridgeAdapter: "0x1391f9AC408cf13214DDB71d359002658eaF9ebb"
992
+ }
993
+ ]
994
+ },
995
+ // ═══════════════════════════════════════════════════════════════════════
996
+ // BTCBinance (BTCB) - Binance-Peg BTCB
997
+ // ═══════════════════════════════════════════════════════════════════════
998
+ [V.BTCBinance]: {
999
+ decimals: 18,
1000
+ symbol: "BTCB",
1001
+ name: "Binance-Peg BTCB",
1002
+ deployments: [
1003
+ {
1004
+ env: T.prod,
1005
+ chain: o.BSC,
1006
+ address: "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c",
1007
+ publicMarketMaker: "0xE4ff44a615dF38e37cdF475833c1d57774CC9D4A"
1008
+ },
1009
+ {
1010
+ env: T.testnet,
1011
+ chain: o.BSC_TESTNET,
1012
+ address: "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c",
1013
+ publicMarketMaker: "0x63749Acfc2527A8406E8BC8c93A80f29FDD75e27"
1014
+ },
1015
+ {
1016
+ env: T.stage,
1017
+ chain: o.BSC_TESTNET,
1018
+ address: "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c",
1019
+ publicMarketMaker: "0x440362b55D4a255EBA3c27C650d2dC1a91Db85bA"
1020
+ },
1021
+ {
1022
+ env: T.dev,
1023
+ chain: o.BSC_TESTNET,
1024
+ address: "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c",
1025
+ publicMarketMaker: "0x440362b55D4a255EBA3c27C650d2dC1a91Db85bA"
1026
+ }
1027
+ ]
1028
+ },
1029
+ // ═══════════════════════════════════════════════════════════════════════
1030
+ // cbBTC - Coinbase Wrapped BTC
1031
+ // ═══════════════════════════════════════════════════════════════════════
1032
+ [V.cbBTC]: {
1033
+ decimals: 8,
1034
+ symbol: "cbBTC",
1035
+ name: "Coinbase Wrapped BTC",
1036
+ deployments: [
1037
+ {
1038
+ env: T.prod,
1039
+ chains: [o.ETHEREUM, o.BASE],
1040
+ address: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",
1041
+ publicMarketMaker: "0x92c01FC0F59857c6E920EdFf1139904b2Bb74c7c"
1042
+ }
1043
+ ]
1044
+ },
1045
+ // ═══════════════════════════════════════════════════════════════════════
1046
+ // eBTC
1047
+ // ═══════════════════════════════════════════════════════════════════════
1048
+ [V.eBTC]: {
1049
+ decimals: 8,
1050
+ symbol: "eBTC",
1051
+ deployments: [
1052
+ {
1053
+ env: T.prod,
1054
+ chain: o.ETHEREUM,
1055
+ address: "0x657e8c867d8b37dcc18fa4caead9c45eb088c642"
1056
+ }
1057
+ ]
1058
+ },
1059
+ // ═══════════════════════════════════════════════════════════════════════
1060
+ // WBTC - Wrapped BTC
1061
+ // ═══════════════════════════════════════════════════════════════════════
1062
+ [V.WBTC]: {
1063
+ decimals: 8,
1064
+ symbol: "WBTC",
1065
+ deployments: [
1066
+ {
1067
+ env: T.prod,
1068
+ chain: o.ETHEREUM,
1069
+ address: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"
1070
+ }
1071
+ ]
1072
+ },
1073
+ // ═══════════════════════════════════════════════════════════════════════
1074
+ // wBTCN - Wrapped BTCN on Corn
1075
+ // ═══════════════════════════════════════════════════════════════════════
1076
+ [V.WBTCN]: {
1077
+ decimals: 8,
1078
+ symbol: "wBTCN",
1079
+ deployments: [
1080
+ {
1081
+ env: T.prod,
1082
+ chain: o.CORN,
1083
+ address: "0xda5dDd7270381A7C2717aD10D1c0ecB19e3CDFb2"
1084
+ }
1085
+ ]
1086
+ }
1087
+ }
1088
+ }, dt = 8;
1089
+ function Y(n, e, t, s) {
1090
+ const a = n.assets[e];
1091
+ if (a)
1092
+ return a.deployments.find(
1093
+ (r) => {
1094
+ var i;
1095
+ return r.env === t && (r.chain === s || ((i = r.chains) == null ? void 0 : i.includes(s)));
1096
+ }
1097
+ );
1098
+ }
1099
+ function mn(n, e, t, s = S) {
1100
+ var a;
1101
+ return (a = Y(s, n, e, t)) == null ? void 0 : a.address;
1102
+ }
1103
+ function pn(n, e = S) {
1104
+ var t;
1105
+ return ((t = e.assets[n]) == null ? void 0 : t.decimals) ?? dt;
1106
+ }
1107
+ function gn(n, e, t, s = S) {
1108
+ var a;
1109
+ return (a = Y(s, n, e, t)) == null ? void 0 : a.assetRouter;
1110
+ }
1111
+ function vn(n, e, t, s = S) {
1112
+ var a;
1113
+ return !!((a = Y(s, n, e, t)) != null && a.assetRouter);
1114
+ }
1115
+ function yn(n, e, t, s = S) {
1116
+ var a;
1117
+ return (a = Y(s, n, e, t)) == null ? void 0 : a.bridgeAdapter;
1118
+ }
1119
+ function _n(n, e, t, s = S) {
1120
+ var a;
1121
+ return (a = Y(s, n, e, t)) == null ? void 0 : a.publicMarketMaker;
1122
+ }
1123
+ function An(n, e, t, s = S) {
1124
+ return !!Y(s, n, e, t);
1125
+ }
1126
+ function Tn(n, e, t, s = S) {
1127
+ const a = n.toLowerCase();
1128
+ for (const [r, i] of Object.entries(s.assets)) {
1129
+ if (!i) continue;
1130
+ if (i.deployments.find(
1131
+ (u) => {
1132
+ var h;
1133
+ return u.env === e && (u.chain === t || ((h = u.chains) == null ? void 0 : h.includes(t))) && u.address.toLowerCase() === a;
1134
+ }
1135
+ )) return r;
1136
+ }
1137
+ }
1138
+ function En(n, e, t = S) {
1139
+ const s = t.assets[n];
1140
+ if (!s) return [];
1141
+ const a = [];
1142
+ for (const r of s.deployments)
1143
+ r.env === e && (r.chain && a.push(r.chain), r.chains && a.push(...r.chains));
1144
+ return a;
1145
+ }
1146
+ function bn(n, e, t = S) {
1147
+ var r;
1148
+ const s = t.assets[n];
1149
+ if (!s) return [];
1150
+ const a = /* @__PURE__ */ new Set();
1151
+ for (const i of s.deployments)
1152
+ (i.chain === e || (r = i.chains) != null && r.includes(e)) && a.add(i.env);
1153
+ return Array.from(a);
1154
+ }
1155
+ function xn(n = S) {
1156
+ return Object.keys(n.assets);
1157
+ }
1158
+ function Nn(n, e = S) {
1159
+ const t = e.assets[n];
1160
+ if (!t) return [];
1161
+ const s = /* @__PURE__ */ new Set();
1162
+ for (const a of t.deployments)
1163
+ a.chain && s.add(a.chain), a.chains && a.chains.forEach((r) => s.add(r));
1164
+ return Array.from(s);
1165
+ }
1166
+ function ie(n, e, t = S) {
1167
+ const s = t.assets[n];
1168
+ if (!s) return [];
1169
+ const a = /* @__PURE__ */ new Set();
1170
+ for (const r of s.deployments)
1171
+ e.includes(r.env) && (r.chain && a.add(r.chain), r.chains && r.chains.forEach((i) => a.add(i)));
1172
+ return Array.from(a);
1173
+ }
1174
+ function Sn(n, e = S) {
1175
+ const t = e.assets[n];
1176
+ if (t)
1177
+ return { decimals: t.decimals, symbol: t.symbol, name: t.name };
1178
+ }
1179
+ function In(n, e, t = S) {
1180
+ return ie(n, e, t).filter(
1181
+ (s) => Le(s)
1182
+ );
1183
+ }
1184
+ function ut(n, e, t = S) {
1185
+ if (n.length === 0) return [];
1186
+ const s = new Set(ie(n[0], e, t));
1187
+ for (let a = 1; a < n.length; a++) {
1188
+ const r = new Set(ie(n[a], e, t));
1189
+ for (const i of s)
1190
+ r.has(i) || s.delete(i);
1191
+ }
1192
+ return Array.from(s);
1193
+ }
1194
+ function kn(n, e, t = S) {
1195
+ return ut(n, e, t).filter(
1196
+ (s) => Le(s)
1197
+ );
1198
+ }
1199
+ class lt {
1200
+ constructor(e) {
1201
+ I(this, "config");
1202
+ this.config = e;
1203
+ }
1204
+ /**
1205
+ * Get partner ID
1206
+ */
1207
+ getPartnerId() {
1208
+ var e;
1209
+ return (e = this.config) == null ? void 0 : e.partnerId;
1210
+ }
1211
+ /**
1212
+ * Check if partner is configured
1213
+ */
1214
+ isConfigured() {
1215
+ return this.config !== void 0;
1216
+ }
1217
+ /**
1218
+ * Update partner configuration
1219
+ *
1220
+ * @param config - New partner configuration
1221
+ */
1222
+ update(e) {
1223
+ this.config = e;
1224
+ }
1225
+ /**
1226
+ * Clear partner configuration
1227
+ */
1228
+ clear() {
1229
+ this.config = void 0;
1230
+ }
1231
+ }
1232
+ function De(n, e) {
1233
+ let t;
1234
+ switch (e) {
1235
+ case "evm":
1236
+ t = n.evm;
1237
+ break;
1238
+ case "bitcoin":
1239
+ t = n.bitcoin;
1240
+ break;
1241
+ case "solana":
1242
+ t = n.solana;
1243
+ break;
1244
+ case "sui":
1245
+ t = n.sui;
1246
+ break;
1247
+ case "starknet":
1248
+ t = n.starknet;
1249
+ break;
1250
+ default:
1251
+ t = void 0;
1252
+ }
1253
+ return t;
1254
+ }
1255
+ class ft {
1256
+ constructor(e, t) {
1257
+ I(this, "modules", /* @__PURE__ */ new Map());
1258
+ I(this, "services", /* @__PURE__ */ new Map());
1259
+ I(this, "shared", /* @__PURE__ */ new Map());
1260
+ this.config = t, e.forEach((s) => this.modules.set(s.id, s));
1261
+ }
1262
+ /**
1263
+ * Require a module service
1264
+ *
1265
+ * Throws LombardError.moduleMissing if module not installed.
1266
+ *
1267
+ * @param id - Module identifier
1268
+ * @returns Module service
1269
+ */
1270
+ require(e) {
1271
+ const t = this.modules.get(e);
1272
+ if (!t)
1273
+ throw E.moduleMissing(e);
1274
+ return this.services.has(t.id) || this.services.set(t.id, t.register(this.createContext())), this.services.get(t.id);
1275
+ }
1276
+ /**
1277
+ * Optionally get a module service
1278
+ *
1279
+ * Returns null if module not installed (no error thrown).
1280
+ *
1281
+ * @param id - Module identifier
1282
+ * @returns Module service or null
1283
+ */
1284
+ optional(e) {
1285
+ const t = this.modules.get(e);
1286
+ return t ? (this.services.has(t.id) || this.services.set(t.id, t.register(this.createContext())), this.services.get(t.id)) : null;
1287
+ }
1288
+ /**
1289
+ * Create registration context for modules
1290
+ *
1291
+ * Provides modules with access to config-based services.
1292
+ */
1293
+ createContext() {
1294
+ return {
1295
+ env: this.config.env,
1296
+ getProvider: async (e) => {
1297
+ const t = De(this.config.providers, e);
1298
+ if (t)
1299
+ return await t();
1300
+ },
1301
+ getShared: (e) => this.shared.get(e),
1302
+ setShared: (e, t) => {
1303
+ this.shared.set(e, t);
1304
+ }
1305
+ };
1306
+ }
1307
+ }
1308
+ function ht(n) {
1309
+ return async (e) => {
1310
+ const t = De(n.providers, e);
1311
+ if (t)
1312
+ return t();
1313
+ };
1314
+ }
1315
+ const ge = /* @__PURE__ */ new WeakMap();
1316
+ function Pe(n) {
1317
+ let e = ge.get(n);
1318
+ return e || (e = new ft(n.modules, n), ge.set(n, e)), e;
1319
+ }
1320
+ function Be(n) {
1321
+ return {
1322
+ env: n.env,
1323
+ partner: new lt(n.partner),
1324
+ getProvider: ht(n),
1325
+ logger: void 0
1326
+ };
1327
+ }
1328
+ function Cn(n) {
1329
+ const e = Be(n), t = Pe(n), s = t.require("btc"), a = t.require("api");
1330
+ return {
1331
+ ...e,
1332
+ btc: s,
1333
+ api: a,
1334
+ capabilities: t
1335
+ };
1336
+ }
1337
+ function wn(n) {
1338
+ const e = Be(n), s = Pe(n).require("evm");
1339
+ return {
1340
+ ...e,
1341
+ evm: s
1342
+ };
1343
+ }
1344
+ const On = {
1345
+ IDLE: "idle",
1346
+ PREPARING: "preparing",
1347
+ READY: "ready",
1348
+ EXECUTING: "executing",
1349
+ COMPLETED: "completed",
1350
+ FAILED: "failed"
1351
+ }, Rn = {
1352
+ IDLE: "idle",
1353
+ PENDING: "pending",
1354
+ COMPLETE: "complete",
1355
+ FAILED: "failed"
1356
+ };
1357
+ var x;
1358
+ (function(n) {
1359
+ n.assertEqual = (a) => {
1360
+ };
1361
+ function e(a) {
1362
+ }
1363
+ n.assertIs = e;
1364
+ function t(a) {
1365
+ throw new Error();
1366
+ }
1367
+ n.assertNever = t, n.arrayToEnum = (a) => {
1368
+ const r = {};
1369
+ for (const i of a)
1370
+ r[i] = i;
1371
+ return r;
1372
+ }, n.getValidEnumValues = (a) => {
1373
+ const r = n.objectKeys(a).filter((c) => typeof a[a[c]] != "number"), i = {};
1374
+ for (const c of r)
1375
+ i[c] = a[c];
1376
+ return n.objectValues(i);
1377
+ }, n.objectValues = (a) => n.objectKeys(a).map(function(r) {
1378
+ return a[r];
1379
+ }), n.objectKeys = typeof Object.keys == "function" ? (a) => Object.keys(a) : (a) => {
1380
+ const r = [];
1381
+ for (const i in a)
1382
+ Object.prototype.hasOwnProperty.call(a, i) && r.push(i);
1383
+ return r;
1384
+ }, n.find = (a, r) => {
1385
+ for (const i of a)
1386
+ if (r(i))
1387
+ return i;
1388
+ }, n.isInteger = typeof Number.isInteger == "function" ? (a) => Number.isInteger(a) : (a) => typeof a == "number" && Number.isFinite(a) && Math.floor(a) === a;
1389
+ function s(a, r = " | ") {
1390
+ return a.map((i) => typeof i == "string" ? `'${i}'` : i).join(r);
1391
+ }
1392
+ n.joinValues = s, n.jsonStringifyReplacer = (a, r) => typeof r == "bigint" ? r.toString() : r;
1393
+ })(x || (x = {}));
1394
+ var ve;
1395
+ (function(n) {
1396
+ n.mergeShapes = (e, t) => ({
1397
+ ...e,
1398
+ ...t
1399
+ // second overwrites first
1400
+ });
1401
+ })(ve || (ve = {}));
1402
+ const f = x.arrayToEnum([
1403
+ "string",
1404
+ "nan",
1405
+ "number",
1406
+ "integer",
1407
+ "float",
1408
+ "boolean",
1409
+ "date",
1410
+ "bigint",
1411
+ "symbol",
1412
+ "function",
1413
+ "undefined",
1414
+ "null",
1415
+ "array",
1416
+ "object",
1417
+ "unknown",
1418
+ "promise",
1419
+ "void",
1420
+ "never",
1421
+ "map",
1422
+ "set"
1423
+ ]), D = (n) => {
1424
+ switch (typeof n) {
1425
+ case "undefined":
1426
+ return f.undefined;
1427
+ case "string":
1428
+ return f.string;
1429
+ case "number":
1430
+ return Number.isNaN(n) ? f.nan : f.number;
1431
+ case "boolean":
1432
+ return f.boolean;
1433
+ case "function":
1434
+ return f.function;
1435
+ case "bigint":
1436
+ return f.bigint;
1437
+ case "symbol":
1438
+ return f.symbol;
1439
+ case "object":
1440
+ return Array.isArray(n) ? f.array : n === null ? f.null : n.then && typeof n.then == "function" && n.catch && typeof n.catch == "function" ? f.promise : typeof Map < "u" && n instanceof Map ? f.map : typeof Set < "u" && n instanceof Set ? f.set : typeof Date < "u" && n instanceof Date ? f.date : f.object;
1441
+ default:
1442
+ return f.unknown;
1443
+ }
1444
+ }, d = x.arrayToEnum([
1445
+ "invalid_type",
1446
+ "invalid_literal",
1447
+ "custom",
1448
+ "invalid_union",
1449
+ "invalid_union_discriminator",
1450
+ "invalid_enum_value",
1451
+ "unrecognized_keys",
1452
+ "invalid_arguments",
1453
+ "invalid_return_type",
1454
+ "invalid_date",
1455
+ "invalid_string",
1456
+ "too_small",
1457
+ "too_big",
1458
+ "invalid_intersection_types",
1459
+ "not_multiple_of",
1460
+ "not_finite"
1461
+ ]);
1462
+ class R extends Error {
1463
+ get errors() {
1464
+ return this.issues;
1465
+ }
1466
+ constructor(e) {
1467
+ super(), this.issues = [], this.addIssue = (s) => {
1468
+ this.issues = [...this.issues, s];
1469
+ }, this.addIssues = (s = []) => {
1470
+ this.issues = [...this.issues, ...s];
1471
+ };
1472
+ const t = new.target.prototype;
1473
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
1474
+ }
1475
+ format(e) {
1476
+ const t = e || function(r) {
1477
+ return r.message;
1478
+ }, s = { _errors: [] }, a = (r) => {
1479
+ for (const i of r.issues)
1480
+ if (i.code === "invalid_union")
1481
+ i.unionErrors.map(a);
1482
+ else if (i.code === "invalid_return_type")
1483
+ a(i.returnTypeError);
1484
+ else if (i.code === "invalid_arguments")
1485
+ a(i.argumentsError);
1486
+ else if (i.path.length === 0)
1487
+ s._errors.push(t(i));
1488
+ else {
1489
+ let c = s, u = 0;
1490
+ for (; u < i.path.length; ) {
1491
+ const h = i.path[u];
1492
+ u === i.path.length - 1 ? (c[h] = c[h] || { _errors: [] }, c[h]._errors.push(t(i))) : c[h] = c[h] || { _errors: [] }, c = c[h], u++;
1493
+ }
1494
+ }
1495
+ };
1496
+ return a(this), s;
1497
+ }
1498
+ static assert(e) {
1499
+ if (!(e instanceof R))
1500
+ throw new Error(`Not a ZodError: ${e}`);
1501
+ }
1502
+ toString() {
1503
+ return this.message;
1504
+ }
1505
+ get message() {
1506
+ return JSON.stringify(this.issues, x.jsonStringifyReplacer, 2);
1507
+ }
1508
+ get isEmpty() {
1509
+ return this.issues.length === 0;
1510
+ }
1511
+ flatten(e = (t) => t.message) {
1512
+ const t = {}, s = [];
1513
+ for (const a of this.issues)
1514
+ if (a.path.length > 0) {
1515
+ const r = a.path[0];
1516
+ t[r] = t[r] || [], t[r].push(e(a));
1517
+ } else
1518
+ s.push(e(a));
1519
+ return { formErrors: s, fieldErrors: t };
1520
+ }
1521
+ get formErrors() {
1522
+ return this.flatten();
1523
+ }
1524
+ }
1525
+ R.create = (n) => new R(n);
1526
+ const ce = (n, e) => {
1527
+ let t;
1528
+ switch (n.code) {
1529
+ case d.invalid_type:
1530
+ n.received === f.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
1531
+ break;
1532
+ case d.invalid_literal:
1533
+ t = `Invalid literal value, expected ${JSON.stringify(n.expected, x.jsonStringifyReplacer)}`;
1534
+ break;
1535
+ case d.unrecognized_keys:
1536
+ t = `Unrecognized key(s) in object: ${x.joinValues(n.keys, ", ")}`;
1537
+ break;
1538
+ case d.invalid_union:
1539
+ t = "Invalid input";
1540
+ break;
1541
+ case d.invalid_union_discriminator:
1542
+ t = `Invalid discriminator value. Expected ${x.joinValues(n.options)}`;
1543
+ break;
1544
+ case d.invalid_enum_value:
1545
+ t = `Invalid enum value. Expected ${x.joinValues(n.options)}, received '${n.received}'`;
1546
+ break;
1547
+ case d.invalid_arguments:
1548
+ t = "Invalid function arguments";
1549
+ break;
1550
+ case d.invalid_return_type:
1551
+ t = "Invalid function return type";
1552
+ break;
1553
+ case d.invalid_date:
1554
+ t = "Invalid date";
1555
+ break;
1556
+ case d.invalid_string:
1557
+ typeof n.validation == "object" ? "includes" in n.validation ? (t = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? t = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? t = `Invalid input: must end with "${n.validation.endsWith}"` : x.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
1558
+ break;
1559
+ case d.too_small:
1560
+ n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "more than"} ${n.minimum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "over"} ${n.minimum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "bigint" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(n.minimum))}` : t = "Invalid input";
1561
+ break;
1562
+ case d.too_big:
1563
+ n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "less than"} ${n.maximum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "under"} ${n.maximum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "bigint" ? t = `BigInt must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly" : n.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(n.maximum))}` : t = "Invalid input";
1564
+ break;
1565
+ case d.custom:
1566
+ t = "Invalid input";
1567
+ break;
1568
+ case d.invalid_intersection_types:
1569
+ t = "Intersection results could not be merged";
1570
+ break;
1571
+ case d.not_multiple_of:
1572
+ t = `Number must be a multiple of ${n.multipleOf}`;
1573
+ break;
1574
+ case d.not_finite:
1575
+ t = "Number must be finite";
1576
+ break;
1577
+ default:
1578
+ t = e.defaultError, x.assertNever(n);
1579
+ }
1580
+ return { message: t };
1581
+ };
1582
+ let mt = ce;
1583
+ function pt() {
1584
+ return mt;
1585
+ }
1586
+ const gt = (n) => {
1587
+ const { data: e, path: t, errorMaps: s, issueData: a } = n, r = [...t, ...a.path || []], i = {
1588
+ ...a,
1589
+ path: r
1590
+ };
1591
+ if (a.message !== void 0)
1592
+ return {
1593
+ ...a,
1594
+ path: r,
1595
+ message: a.message
1596
+ };
1597
+ let c = "";
1598
+ const u = s.filter((h) => !!h).slice().reverse();
1599
+ for (const h of u)
1600
+ c = h(i, { data: e, defaultError: c }).message;
1601
+ return {
1602
+ ...a,
1603
+ path: r,
1604
+ message: c
1605
+ };
1606
+ };
1607
+ function l(n, e) {
1608
+ const t = pt(), s = gt({
1609
+ issueData: e,
1610
+ data: n.data,
1611
+ path: n.path,
1612
+ errorMaps: [
1613
+ n.common.contextualErrorMap,
1614
+ // contextual error map is first priority
1615
+ n.schemaErrorMap,
1616
+ // then schema-bound map if available
1617
+ t,
1618
+ // then global override map
1619
+ t === ce ? void 0 : ce
1620
+ // then global default map
1621
+ ].filter((a) => !!a)
1622
+ });
1623
+ n.common.issues.push(s);
1624
+ }
1625
+ class k {
1626
+ constructor() {
1627
+ this.value = "valid";
1628
+ }
1629
+ dirty() {
1630
+ this.value === "valid" && (this.value = "dirty");
1631
+ }
1632
+ abort() {
1633
+ this.value !== "aborted" && (this.value = "aborted");
1634
+ }
1635
+ static mergeArray(e, t) {
1636
+ const s = [];
1637
+ for (const a of t) {
1638
+ if (a.status === "aborted")
1639
+ return v;
1640
+ a.status === "dirty" && e.dirty(), s.push(a.value);
1641
+ }
1642
+ return { status: e.value, value: s };
1643
+ }
1644
+ static async mergeObjectAsync(e, t) {
1645
+ const s = [];
1646
+ for (const a of t) {
1647
+ const r = await a.key, i = await a.value;
1648
+ s.push({
1649
+ key: r,
1650
+ value: i
1651
+ });
1652
+ }
1653
+ return k.mergeObjectSync(e, s);
1654
+ }
1655
+ static mergeObjectSync(e, t) {
1656
+ const s = {};
1657
+ for (const a of t) {
1658
+ const { key: r, value: i } = a;
1659
+ if (r.status === "aborted" || i.status === "aborted")
1660
+ return v;
1661
+ r.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), r.value !== "__proto__" && (typeof i.value < "u" || a.alwaysSet) && (s[r.value] = i.value);
1662
+ }
1663
+ return { status: e.value, value: s };
1664
+ }
1665
+ }
1666
+ const v = Object.freeze({
1667
+ status: "aborted"
1668
+ }), J = (n) => ({ status: "dirty", value: n }), C = (n) => ({ status: "valid", value: n }), ye = (n) => n.status === "aborted", _e = (n) => n.status === "dirty", j = (n) => n.status === "valid", ee = (n) => typeof Promise < "u" && n instanceof Promise;
1669
+ var m;
1670
+ (function(n) {
1671
+ n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
1672
+ })(m || (m = {}));
1673
+ class M {
1674
+ constructor(e, t, s, a) {
1675
+ this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = a;
1676
+ }
1677
+ get path() {
1678
+ return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
1679
+ }
1680
+ }
1681
+ const Ae = (n, e) => {
1682
+ if (j(e))
1683
+ return { success: !0, data: e.value };
1684
+ if (!n.common.issues.length)
1685
+ throw new Error("Validation failed but no issues detected.");
1686
+ return {
1687
+ success: !1,
1688
+ get error() {
1689
+ if (this._error)
1690
+ return this._error;
1691
+ const t = new R(n.common.issues);
1692
+ return this._error = t, this._error;
1693
+ }
1694
+ };
1695
+ };
1696
+ function _(n) {
1697
+ if (!n)
1698
+ return {};
1699
+ const { errorMap: e, invalid_type_error: t, required_error: s, description: a } = n;
1700
+ if (e && (t || s))
1701
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
1702
+ return e ? { errorMap: e, description: a } : { errorMap: (i, c) => {
1703
+ const { message: u } = n;
1704
+ return i.code === "invalid_enum_value" ? { message: u ?? c.defaultError } : typeof c.data > "u" ? { message: u ?? s ?? c.defaultError } : i.code !== "invalid_type" ? { message: c.defaultError } : { message: u ?? t ?? c.defaultError };
1705
+ }, description: a };
1706
+ }
1707
+ class b {
1708
+ get description() {
1709
+ return this._def.description;
1710
+ }
1711
+ _getType(e) {
1712
+ return D(e.data);
1713
+ }
1714
+ _getOrReturnCtx(e, t) {
1715
+ return t || {
1716
+ common: e.parent.common,
1717
+ data: e.data,
1718
+ parsedType: D(e.data),
1719
+ schemaErrorMap: this._def.errorMap,
1720
+ path: e.path,
1721
+ parent: e.parent
1722
+ };
1723
+ }
1724
+ _processInputParams(e) {
1725
+ return {
1726
+ status: new k(),
1727
+ ctx: {
1728
+ common: e.parent.common,
1729
+ data: e.data,
1730
+ parsedType: D(e.data),
1731
+ schemaErrorMap: this._def.errorMap,
1732
+ path: e.path,
1733
+ parent: e.parent
1734
+ }
1735
+ };
1736
+ }
1737
+ _parseSync(e) {
1738
+ const t = this._parse(e);
1739
+ if (ee(t))
1740
+ throw new Error("Synchronous parse encountered promise.");
1741
+ return t;
1742
+ }
1743
+ _parseAsync(e) {
1744
+ const t = this._parse(e);
1745
+ return Promise.resolve(t);
1746
+ }
1747
+ parse(e, t) {
1748
+ const s = this.safeParse(e, t);
1749
+ if (s.success)
1750
+ return s.data;
1751
+ throw s.error;
1752
+ }
1753
+ safeParse(e, t) {
1754
+ const s = {
1755
+ common: {
1756
+ issues: [],
1757
+ async: (t == null ? void 0 : t.async) ?? !1,
1758
+ contextualErrorMap: t == null ? void 0 : t.errorMap
1759
+ },
1760
+ path: (t == null ? void 0 : t.path) || [],
1761
+ schemaErrorMap: this._def.errorMap,
1762
+ parent: null,
1763
+ data: e,
1764
+ parsedType: D(e)
1765
+ }, a = this._parseSync({ data: e, path: s.path, parent: s });
1766
+ return Ae(s, a);
1767
+ }
1768
+ "~validate"(e) {
1769
+ var s, a;
1770
+ const t = {
1771
+ common: {
1772
+ issues: [],
1773
+ async: !!this["~standard"].async
1774
+ },
1775
+ path: [],
1776
+ schemaErrorMap: this._def.errorMap,
1777
+ parent: null,
1778
+ data: e,
1779
+ parsedType: D(e)
1780
+ };
1781
+ if (!this["~standard"].async)
1782
+ try {
1783
+ const r = this._parseSync({ data: e, path: [], parent: t });
1784
+ return j(r) ? {
1785
+ value: r.value
1786
+ } : {
1787
+ issues: t.common.issues
1788
+ };
1789
+ } catch (r) {
1790
+ (a = (s = r == null ? void 0 : r.message) == null ? void 0 : s.toLowerCase()) != null && a.includes("encountered") && (this["~standard"].async = !0), t.common = {
1791
+ issues: [],
1792
+ async: !0
1793
+ };
1794
+ }
1795
+ return this._parseAsync({ data: e, path: [], parent: t }).then((r) => j(r) ? {
1796
+ value: r.value
1797
+ } : {
1798
+ issues: t.common.issues
1799
+ });
1800
+ }
1801
+ async parseAsync(e, t) {
1802
+ const s = await this.safeParseAsync(e, t);
1803
+ if (s.success)
1804
+ return s.data;
1805
+ throw s.error;
1806
+ }
1807
+ async safeParseAsync(e, t) {
1808
+ const s = {
1809
+ common: {
1810
+ issues: [],
1811
+ contextualErrorMap: t == null ? void 0 : t.errorMap,
1812
+ async: !0
1813
+ },
1814
+ path: (t == null ? void 0 : t.path) || [],
1815
+ schemaErrorMap: this._def.errorMap,
1816
+ parent: null,
1817
+ data: e,
1818
+ parsedType: D(e)
1819
+ }, a = this._parse({ data: e, path: s.path, parent: s }), r = await (ee(a) ? a : Promise.resolve(a));
1820
+ return Ae(s, r);
1821
+ }
1822
+ refine(e, t) {
1823
+ const s = (a) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(a) : t;
1824
+ return this._refinement((a, r) => {
1825
+ const i = e(a), c = () => r.addIssue({
1826
+ code: d.custom,
1827
+ ...s(a)
1828
+ });
1829
+ return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (c(), !1)) : i ? !0 : (c(), !1);
1830
+ });
1831
+ }
1832
+ refinement(e, t) {
1833
+ return this._refinement((s, a) => e(s) ? !0 : (a.addIssue(typeof t == "function" ? t(s, a) : t), !1));
1834
+ }
1835
+ _refinement(e) {
1836
+ return new W({
1837
+ schema: this,
1838
+ typeName: y.ZodEffects,
1839
+ effect: { type: "refinement", refinement: e }
1840
+ });
1841
+ }
1842
+ superRefine(e) {
1843
+ return this._refinement(e);
1844
+ }
1845
+ constructor(e) {
1846
+ this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
1847
+ version: 1,
1848
+ vendor: "zod",
1849
+ validate: (t) => this["~validate"](t)
1850
+ };
1851
+ }
1852
+ optional() {
1853
+ return B.create(this, this._def);
1854
+ }
1855
+ nullable() {
1856
+ return K.create(this, this._def);
1857
+ }
1858
+ nullish() {
1859
+ return this.nullable().optional();
1860
+ }
1861
+ array() {
1862
+ return O.create(this);
1863
+ }
1864
+ promise() {
1865
+ return ae.create(this, this._def);
1866
+ }
1867
+ or(e) {
1868
+ return ne.create([this, e], this._def);
1869
+ }
1870
+ and(e) {
1871
+ return se.create(this, e, this._def);
1872
+ }
1873
+ transform(e) {
1874
+ return new W({
1875
+ ..._(this._def),
1876
+ schema: this,
1877
+ typeName: y.ZodEffects,
1878
+ effect: { type: "transform", transform: e }
1879
+ });
1880
+ }
1881
+ default(e) {
1882
+ const t = typeof e == "function" ? e : () => e;
1883
+ return new de({
1884
+ ..._(this._def),
1885
+ innerType: this,
1886
+ defaultValue: t,
1887
+ typeName: y.ZodDefault
1888
+ });
1889
+ }
1890
+ brand() {
1891
+ return new Vt({
1892
+ typeName: y.ZodBranded,
1893
+ type: this,
1894
+ ..._(this._def)
1895
+ });
1896
+ }
1897
+ catch(e) {
1898
+ const t = typeof e == "function" ? e : () => e;
1899
+ return new ue({
1900
+ ..._(this._def),
1901
+ innerType: this,
1902
+ catchValue: t,
1903
+ typeName: y.ZodCatch
1904
+ });
1905
+ }
1906
+ describe(e) {
1907
+ const t = this.constructor;
1908
+ return new t({
1909
+ ...this._def,
1910
+ description: e
1911
+ });
1912
+ }
1913
+ pipe(e) {
1914
+ return he.create(this, e);
1915
+ }
1916
+ readonly() {
1917
+ return le.create(this);
1918
+ }
1919
+ isOptional() {
1920
+ return this.safeParse(void 0).success;
1921
+ }
1922
+ isNullable() {
1923
+ return this.safeParse(null).success;
1924
+ }
1925
+ }
1926
+ const vt = /^c[^\s-]{8,}$/i, yt = /^[0-9a-z]+$/, _t = /^[0-9A-HJKMNP-TV-Z]{26}$/i, At = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Tt = /^[a-z0-9_-]{21}$/i, Et = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, bt = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, xt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Nt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
1927
+ let re;
1928
+ const St = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, It = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, kt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Ct = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, wt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ot = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Me = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Rt = new RegExp(`^${Me}$`);
1929
+ function Ue(n) {
1930
+ let e = "[0-5]\\d";
1931
+ n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`);
1932
+ const t = n.precision ? "+" : "?";
1933
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
1934
+ }
1935
+ function Lt(n) {
1936
+ return new RegExp(`^${Ue(n)}$`);
1937
+ }
1938
+ function Dt(n) {
1939
+ let e = `${Me}T${Ue(n)}`;
1940
+ const t = [];
1941
+ return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
1942
+ }
1943
+ function Pt(n, e) {
1944
+ return !!((e === "v4" || !e) && St.test(n) || (e === "v6" || !e) && kt.test(n));
1945
+ }
1946
+ function Bt(n, e) {
1947
+ if (!Et.test(n))
1948
+ return !1;
1949
+ try {
1950
+ const [t] = n.split(".");
1951
+ if (!t)
1952
+ return !1;
1953
+ const s = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), a = JSON.parse(atob(s));
1954
+ return !(typeof a != "object" || a === null || "typ" in a && (a == null ? void 0 : a.typ) !== "JWT" || !a.alg || e && a.alg !== e);
1955
+ } catch {
1956
+ return !1;
1957
+ }
1958
+ }
1959
+ function Mt(n, e) {
1960
+ return !!((e === "v4" || !e) && It.test(n) || (e === "v6" || !e) && Ct.test(n));
1961
+ }
1962
+ class P extends b {
1963
+ _parse(e) {
1964
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
1965
+ const r = this._getOrReturnCtx(e);
1966
+ return l(r, {
1967
+ code: d.invalid_type,
1968
+ expected: f.string,
1969
+ received: r.parsedType
1970
+ }), v;
1971
+ }
1972
+ const s = new k();
1973
+ let a;
1974
+ for (const r of this._def.checks)
1975
+ if (r.kind === "min")
1976
+ e.data.length < r.value && (a = this._getOrReturnCtx(e, a), l(a, {
1977
+ code: d.too_small,
1978
+ minimum: r.value,
1979
+ type: "string",
1980
+ inclusive: !0,
1981
+ exact: !1,
1982
+ message: r.message
1983
+ }), s.dirty());
1984
+ else if (r.kind === "max")
1985
+ e.data.length > r.value && (a = this._getOrReturnCtx(e, a), l(a, {
1986
+ code: d.too_big,
1987
+ maximum: r.value,
1988
+ type: "string",
1989
+ inclusive: !0,
1990
+ exact: !1,
1991
+ message: r.message
1992
+ }), s.dirty());
1993
+ else if (r.kind === "length") {
1994
+ const i = e.data.length > r.value, c = e.data.length < r.value;
1995
+ (i || c) && (a = this._getOrReturnCtx(e, a), i ? l(a, {
1996
+ code: d.too_big,
1997
+ maximum: r.value,
1998
+ type: "string",
1999
+ inclusive: !0,
2000
+ exact: !0,
2001
+ message: r.message
2002
+ }) : c && l(a, {
2003
+ code: d.too_small,
2004
+ minimum: r.value,
2005
+ type: "string",
2006
+ inclusive: !0,
2007
+ exact: !0,
2008
+ message: r.message
2009
+ }), s.dirty());
2010
+ } else if (r.kind === "email")
2011
+ xt.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
2012
+ validation: "email",
2013
+ code: d.invalid_string,
2014
+ message: r.message
2015
+ }), s.dirty());
2016
+ else if (r.kind === "emoji")
2017
+ re || (re = new RegExp(Nt, "u")), re.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
2018
+ validation: "emoji",
2019
+ code: d.invalid_string,
2020
+ message: r.message
2021
+ }), s.dirty());
2022
+ else if (r.kind === "uuid")
2023
+ At.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
2024
+ validation: "uuid",
2025
+ code: d.invalid_string,
2026
+ message: r.message
2027
+ }), s.dirty());
2028
+ else if (r.kind === "nanoid")
2029
+ Tt.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
2030
+ validation: "nanoid",
2031
+ code: d.invalid_string,
2032
+ message: r.message
2033
+ }), s.dirty());
2034
+ else if (r.kind === "cuid")
2035
+ vt.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
2036
+ validation: "cuid",
2037
+ code: d.invalid_string,
2038
+ message: r.message
2039
+ }), s.dirty());
2040
+ else if (r.kind === "cuid2")
2041
+ yt.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
2042
+ validation: "cuid2",
2043
+ code: d.invalid_string,
2044
+ message: r.message
2045
+ }), s.dirty());
2046
+ else if (r.kind === "ulid")
2047
+ _t.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
2048
+ validation: "ulid",
2049
+ code: d.invalid_string,
2050
+ message: r.message
2051
+ }), s.dirty());
2052
+ else if (r.kind === "url")
2053
+ try {
2054
+ new URL(e.data);
2055
+ } catch {
2056
+ a = this._getOrReturnCtx(e, a), l(a, {
2057
+ validation: "url",
2058
+ code: d.invalid_string,
2059
+ message: r.message
2060
+ }), s.dirty();
2061
+ }
2062
+ else r.kind === "regex" ? (r.regex.lastIndex = 0, r.regex.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
2063
+ validation: "regex",
2064
+ code: d.invalid_string,
2065
+ message: r.message
2066
+ }), s.dirty())) : r.kind === "trim" ? e.data = e.data.trim() : r.kind === "includes" ? e.data.includes(r.value, r.position) || (a = this._getOrReturnCtx(e, a), l(a, {
2067
+ code: d.invalid_string,
2068
+ validation: { includes: r.value, position: r.position },
2069
+ message: r.message
2070
+ }), s.dirty()) : r.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : r.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : r.kind === "startsWith" ? e.data.startsWith(r.value) || (a = this._getOrReturnCtx(e, a), l(a, {
2071
+ code: d.invalid_string,
2072
+ validation: { startsWith: r.value },
2073
+ message: r.message
2074
+ }), s.dirty()) : r.kind === "endsWith" ? e.data.endsWith(r.value) || (a = this._getOrReturnCtx(e, a), l(a, {
2075
+ code: d.invalid_string,
2076
+ validation: { endsWith: r.value },
2077
+ message: r.message
2078
+ }), s.dirty()) : r.kind === "datetime" ? Dt(r).test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
2079
+ code: d.invalid_string,
2080
+ validation: "datetime",
2081
+ message: r.message
2082
+ }), s.dirty()) : r.kind === "date" ? Rt.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
2083
+ code: d.invalid_string,
2084
+ validation: "date",
2085
+ message: r.message
2086
+ }), s.dirty()) : r.kind === "time" ? Lt(r).test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
2087
+ code: d.invalid_string,
2088
+ validation: "time",
2089
+ message: r.message
2090
+ }), s.dirty()) : r.kind === "duration" ? bt.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
2091
+ validation: "duration",
2092
+ code: d.invalid_string,
2093
+ message: r.message
2094
+ }), s.dirty()) : r.kind === "ip" ? Pt(e.data, r.version) || (a = this._getOrReturnCtx(e, a), l(a, {
2095
+ validation: "ip",
2096
+ code: d.invalid_string,
2097
+ message: r.message
2098
+ }), s.dirty()) : r.kind === "jwt" ? Bt(e.data, r.alg) || (a = this._getOrReturnCtx(e, a), l(a, {
2099
+ validation: "jwt",
2100
+ code: d.invalid_string,
2101
+ message: r.message
2102
+ }), s.dirty()) : r.kind === "cidr" ? Mt(e.data, r.version) || (a = this._getOrReturnCtx(e, a), l(a, {
2103
+ validation: "cidr",
2104
+ code: d.invalid_string,
2105
+ message: r.message
2106
+ }), s.dirty()) : r.kind === "base64" ? wt.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
2107
+ validation: "base64",
2108
+ code: d.invalid_string,
2109
+ message: r.message
2110
+ }), s.dirty()) : r.kind === "base64url" ? Ot.test(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
2111
+ validation: "base64url",
2112
+ code: d.invalid_string,
2113
+ message: r.message
2114
+ }), s.dirty()) : x.assertNever(r);
2115
+ return { status: s.value, value: e.data };
2116
+ }
2117
+ _regex(e, t, s) {
2118
+ return this.refinement((a) => e.test(a), {
2119
+ validation: t,
2120
+ code: d.invalid_string,
2121
+ ...m.errToObj(s)
2122
+ });
2123
+ }
2124
+ _addCheck(e) {
2125
+ return new P({
2126
+ ...this._def,
2127
+ checks: [...this._def.checks, e]
2128
+ });
2129
+ }
2130
+ email(e) {
2131
+ return this._addCheck({ kind: "email", ...m.errToObj(e) });
2132
+ }
2133
+ url(e) {
2134
+ return this._addCheck({ kind: "url", ...m.errToObj(e) });
2135
+ }
2136
+ emoji(e) {
2137
+ return this._addCheck({ kind: "emoji", ...m.errToObj(e) });
2138
+ }
2139
+ uuid(e) {
2140
+ return this._addCheck({ kind: "uuid", ...m.errToObj(e) });
2141
+ }
2142
+ nanoid(e) {
2143
+ return this._addCheck({ kind: "nanoid", ...m.errToObj(e) });
2144
+ }
2145
+ cuid(e) {
2146
+ return this._addCheck({ kind: "cuid", ...m.errToObj(e) });
2147
+ }
2148
+ cuid2(e) {
2149
+ return this._addCheck({ kind: "cuid2", ...m.errToObj(e) });
2150
+ }
2151
+ ulid(e) {
2152
+ return this._addCheck({ kind: "ulid", ...m.errToObj(e) });
2153
+ }
2154
+ base64(e) {
2155
+ return this._addCheck({ kind: "base64", ...m.errToObj(e) });
2156
+ }
2157
+ base64url(e) {
2158
+ return this._addCheck({
2159
+ kind: "base64url",
2160
+ ...m.errToObj(e)
2161
+ });
2162
+ }
2163
+ jwt(e) {
2164
+ return this._addCheck({ kind: "jwt", ...m.errToObj(e) });
2165
+ }
2166
+ ip(e) {
2167
+ return this._addCheck({ kind: "ip", ...m.errToObj(e) });
2168
+ }
2169
+ cidr(e) {
2170
+ return this._addCheck({ kind: "cidr", ...m.errToObj(e) });
2171
+ }
2172
+ datetime(e) {
2173
+ return typeof e == "string" ? this._addCheck({
2174
+ kind: "datetime",
2175
+ precision: null,
2176
+ offset: !1,
2177
+ local: !1,
2178
+ message: e
2179
+ }) : this._addCheck({
2180
+ kind: "datetime",
2181
+ precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
2182
+ offset: (e == null ? void 0 : e.offset) ?? !1,
2183
+ local: (e == null ? void 0 : e.local) ?? !1,
2184
+ ...m.errToObj(e == null ? void 0 : e.message)
2185
+ });
2186
+ }
2187
+ date(e) {
2188
+ return this._addCheck({ kind: "date", message: e });
2189
+ }
2190
+ time(e) {
2191
+ return typeof e == "string" ? this._addCheck({
2192
+ kind: "time",
2193
+ precision: null,
2194
+ message: e
2195
+ }) : this._addCheck({
2196
+ kind: "time",
2197
+ precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
2198
+ ...m.errToObj(e == null ? void 0 : e.message)
2199
+ });
2200
+ }
2201
+ duration(e) {
2202
+ return this._addCheck({ kind: "duration", ...m.errToObj(e) });
2203
+ }
2204
+ regex(e, t) {
2205
+ return this._addCheck({
2206
+ kind: "regex",
2207
+ regex: e,
2208
+ ...m.errToObj(t)
2209
+ });
2210
+ }
2211
+ includes(e, t) {
2212
+ return this._addCheck({
2213
+ kind: "includes",
2214
+ value: e,
2215
+ position: t == null ? void 0 : t.position,
2216
+ ...m.errToObj(t == null ? void 0 : t.message)
2217
+ });
2218
+ }
2219
+ startsWith(e, t) {
2220
+ return this._addCheck({
2221
+ kind: "startsWith",
2222
+ value: e,
2223
+ ...m.errToObj(t)
2224
+ });
2225
+ }
2226
+ endsWith(e, t) {
2227
+ return this._addCheck({
2228
+ kind: "endsWith",
2229
+ value: e,
2230
+ ...m.errToObj(t)
2231
+ });
2232
+ }
2233
+ min(e, t) {
2234
+ return this._addCheck({
2235
+ kind: "min",
2236
+ value: e,
2237
+ ...m.errToObj(t)
2238
+ });
2239
+ }
2240
+ max(e, t) {
2241
+ return this._addCheck({
2242
+ kind: "max",
2243
+ value: e,
2244
+ ...m.errToObj(t)
2245
+ });
2246
+ }
2247
+ length(e, t) {
2248
+ return this._addCheck({
2249
+ kind: "length",
2250
+ value: e,
2251
+ ...m.errToObj(t)
2252
+ });
2253
+ }
2254
+ /**
2255
+ * Equivalent to `.min(1)`
2256
+ */
2257
+ nonempty(e) {
2258
+ return this.min(1, m.errToObj(e));
2259
+ }
2260
+ trim() {
2261
+ return new P({
2262
+ ...this._def,
2263
+ checks: [...this._def.checks, { kind: "trim" }]
2264
+ });
2265
+ }
2266
+ toLowerCase() {
2267
+ return new P({
2268
+ ...this._def,
2269
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
2270
+ });
2271
+ }
2272
+ toUpperCase() {
2273
+ return new P({
2274
+ ...this._def,
2275
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
2276
+ });
2277
+ }
2278
+ get isDatetime() {
2279
+ return !!this._def.checks.find((e) => e.kind === "datetime");
2280
+ }
2281
+ get isDate() {
2282
+ return !!this._def.checks.find((e) => e.kind === "date");
2283
+ }
2284
+ get isTime() {
2285
+ return !!this._def.checks.find((e) => e.kind === "time");
2286
+ }
2287
+ get isDuration() {
2288
+ return !!this._def.checks.find((e) => e.kind === "duration");
2289
+ }
2290
+ get isEmail() {
2291
+ return !!this._def.checks.find((e) => e.kind === "email");
2292
+ }
2293
+ get isURL() {
2294
+ return !!this._def.checks.find((e) => e.kind === "url");
2295
+ }
2296
+ get isEmoji() {
2297
+ return !!this._def.checks.find((e) => e.kind === "emoji");
2298
+ }
2299
+ get isUUID() {
2300
+ return !!this._def.checks.find((e) => e.kind === "uuid");
2301
+ }
2302
+ get isNANOID() {
2303
+ return !!this._def.checks.find((e) => e.kind === "nanoid");
2304
+ }
2305
+ get isCUID() {
2306
+ return !!this._def.checks.find((e) => e.kind === "cuid");
2307
+ }
2308
+ get isCUID2() {
2309
+ return !!this._def.checks.find((e) => e.kind === "cuid2");
2310
+ }
2311
+ get isULID() {
2312
+ return !!this._def.checks.find((e) => e.kind === "ulid");
2313
+ }
2314
+ get isIP() {
2315
+ return !!this._def.checks.find((e) => e.kind === "ip");
2316
+ }
2317
+ get isCIDR() {
2318
+ return !!this._def.checks.find((e) => e.kind === "cidr");
2319
+ }
2320
+ get isBase64() {
2321
+ return !!this._def.checks.find((e) => e.kind === "base64");
2322
+ }
2323
+ get isBase64url() {
2324
+ return !!this._def.checks.find((e) => e.kind === "base64url");
2325
+ }
2326
+ get minLength() {
2327
+ let e = null;
2328
+ for (const t of this._def.checks)
2329
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
2330
+ return e;
2331
+ }
2332
+ get maxLength() {
2333
+ let e = null;
2334
+ for (const t of this._def.checks)
2335
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
2336
+ return e;
2337
+ }
2338
+ }
2339
+ P.create = (n) => new P({
2340
+ checks: [],
2341
+ typeName: y.ZodString,
2342
+ coerce: (n == null ? void 0 : n.coerce) ?? !1,
2343
+ ..._(n)
2344
+ });
2345
+ function Ut(n, e) {
2346
+ const t = (n.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, a = t > s ? t : s, r = Number.parseInt(n.toFixed(a).replace(".", "")), i = Number.parseInt(e.toFixed(a).replace(".", ""));
2347
+ return r % i / 10 ** a;
2348
+ }
2349
+ class H extends b {
2350
+ constructor() {
2351
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
2352
+ }
2353
+ _parse(e) {
2354
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
2355
+ const r = this._getOrReturnCtx(e);
2356
+ return l(r, {
2357
+ code: d.invalid_type,
2358
+ expected: f.number,
2359
+ received: r.parsedType
2360
+ }), v;
2361
+ }
2362
+ let s;
2363
+ const a = new k();
2364
+ for (const r of this._def.checks)
2365
+ r.kind === "int" ? x.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
2366
+ code: d.invalid_type,
2367
+ expected: "integer",
2368
+ received: "float",
2369
+ message: r.message
2370
+ }), a.dirty()) : r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (s = this._getOrReturnCtx(e, s), l(s, {
2371
+ code: d.too_small,
2372
+ minimum: r.value,
2373
+ type: "number",
2374
+ inclusive: r.inclusive,
2375
+ exact: !1,
2376
+ message: r.message
2377
+ }), a.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (s = this._getOrReturnCtx(e, s), l(s, {
2378
+ code: d.too_big,
2379
+ maximum: r.value,
2380
+ type: "number",
2381
+ inclusive: r.inclusive,
2382
+ exact: !1,
2383
+ message: r.message
2384
+ }), a.dirty()) : r.kind === "multipleOf" ? Ut(e.data, r.value) !== 0 && (s = this._getOrReturnCtx(e, s), l(s, {
2385
+ code: d.not_multiple_of,
2386
+ multipleOf: r.value,
2387
+ message: r.message
2388
+ }), a.dirty()) : r.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
2389
+ code: d.not_finite,
2390
+ message: r.message
2391
+ }), a.dirty()) : x.assertNever(r);
2392
+ return { status: a.value, value: e.data };
2393
+ }
2394
+ gte(e, t) {
2395
+ return this.setLimit("min", e, !0, m.toString(t));
2396
+ }
2397
+ gt(e, t) {
2398
+ return this.setLimit("min", e, !1, m.toString(t));
2399
+ }
2400
+ lte(e, t) {
2401
+ return this.setLimit("max", e, !0, m.toString(t));
2402
+ }
2403
+ lt(e, t) {
2404
+ return this.setLimit("max", e, !1, m.toString(t));
2405
+ }
2406
+ setLimit(e, t, s, a) {
2407
+ return new H({
2408
+ ...this._def,
2409
+ checks: [
2410
+ ...this._def.checks,
2411
+ {
2412
+ kind: e,
2413
+ value: t,
2414
+ inclusive: s,
2415
+ message: m.toString(a)
2416
+ }
2417
+ ]
2418
+ });
2419
+ }
2420
+ _addCheck(e) {
2421
+ return new H({
2422
+ ...this._def,
2423
+ checks: [...this._def.checks, e]
2424
+ });
2425
+ }
2426
+ int(e) {
2427
+ return this._addCheck({
2428
+ kind: "int",
2429
+ message: m.toString(e)
2430
+ });
2431
+ }
2432
+ positive(e) {
2433
+ return this._addCheck({
2434
+ kind: "min",
2435
+ value: 0,
2436
+ inclusive: !1,
2437
+ message: m.toString(e)
2438
+ });
2439
+ }
2440
+ negative(e) {
2441
+ return this._addCheck({
2442
+ kind: "max",
2443
+ value: 0,
2444
+ inclusive: !1,
2445
+ message: m.toString(e)
2446
+ });
2447
+ }
2448
+ nonpositive(e) {
2449
+ return this._addCheck({
2450
+ kind: "max",
2451
+ value: 0,
2452
+ inclusive: !0,
2453
+ message: m.toString(e)
2454
+ });
2455
+ }
2456
+ nonnegative(e) {
2457
+ return this._addCheck({
2458
+ kind: "min",
2459
+ value: 0,
2460
+ inclusive: !0,
2461
+ message: m.toString(e)
2462
+ });
2463
+ }
2464
+ multipleOf(e, t) {
2465
+ return this._addCheck({
2466
+ kind: "multipleOf",
2467
+ value: e,
2468
+ message: m.toString(t)
2469
+ });
2470
+ }
2471
+ finite(e) {
2472
+ return this._addCheck({
2473
+ kind: "finite",
2474
+ message: m.toString(e)
2475
+ });
2476
+ }
2477
+ safe(e) {
2478
+ return this._addCheck({
2479
+ kind: "min",
2480
+ inclusive: !0,
2481
+ value: Number.MIN_SAFE_INTEGER,
2482
+ message: m.toString(e)
2483
+ })._addCheck({
2484
+ kind: "max",
2485
+ inclusive: !0,
2486
+ value: Number.MAX_SAFE_INTEGER,
2487
+ message: m.toString(e)
2488
+ });
2489
+ }
2490
+ get minValue() {
2491
+ let e = null;
2492
+ for (const t of this._def.checks)
2493
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
2494
+ return e;
2495
+ }
2496
+ get maxValue() {
2497
+ let e = null;
2498
+ for (const t of this._def.checks)
2499
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
2500
+ return e;
2501
+ }
2502
+ get isInt() {
2503
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && x.isInteger(e.value));
2504
+ }
2505
+ get isFinite() {
2506
+ let e = null, t = null;
2507
+ for (const s of this._def.checks) {
2508
+ if (s.kind === "finite" || s.kind === "int" || s.kind === "multipleOf")
2509
+ return !0;
2510
+ s.kind === "min" ? (t === null || s.value > t) && (t = s.value) : s.kind === "max" && (e === null || s.value < e) && (e = s.value);
2511
+ }
2512
+ return Number.isFinite(t) && Number.isFinite(e);
2513
+ }
2514
+ }
2515
+ H.create = (n) => new H({
2516
+ checks: [],
2517
+ typeName: y.ZodNumber,
2518
+ coerce: (n == null ? void 0 : n.coerce) || !1,
2519
+ ..._(n)
2520
+ });
2521
+ class z extends b {
2522
+ constructor() {
2523
+ super(...arguments), this.min = this.gte, this.max = this.lte;
2524
+ }
2525
+ _parse(e) {
2526
+ if (this._def.coerce)
2527
+ try {
2528
+ e.data = BigInt(e.data);
2529
+ } catch {
2530
+ return this._getInvalidInput(e);
2531
+ }
2532
+ if (this._getType(e) !== f.bigint)
2533
+ return this._getInvalidInput(e);
2534
+ let s;
2535
+ const a = new k();
2536
+ for (const r of this._def.checks)
2537
+ r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (s = this._getOrReturnCtx(e, s), l(s, {
2538
+ code: d.too_small,
2539
+ type: "bigint",
2540
+ minimum: r.value,
2541
+ inclusive: r.inclusive,
2542
+ message: r.message
2543
+ }), a.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (s = this._getOrReturnCtx(e, s), l(s, {
2544
+ code: d.too_big,
2545
+ type: "bigint",
2546
+ maximum: r.value,
2547
+ inclusive: r.inclusive,
2548
+ message: r.message
2549
+ }), a.dirty()) : r.kind === "multipleOf" ? e.data % r.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), l(s, {
2550
+ code: d.not_multiple_of,
2551
+ multipleOf: r.value,
2552
+ message: r.message
2553
+ }), a.dirty()) : x.assertNever(r);
2554
+ return { status: a.value, value: e.data };
2555
+ }
2556
+ _getInvalidInput(e) {
2557
+ const t = this._getOrReturnCtx(e);
2558
+ return l(t, {
2559
+ code: d.invalid_type,
2560
+ expected: f.bigint,
2561
+ received: t.parsedType
2562
+ }), v;
2563
+ }
2564
+ gte(e, t) {
2565
+ return this.setLimit("min", e, !0, m.toString(t));
2566
+ }
2567
+ gt(e, t) {
2568
+ return this.setLimit("min", e, !1, m.toString(t));
2569
+ }
2570
+ lte(e, t) {
2571
+ return this.setLimit("max", e, !0, m.toString(t));
2572
+ }
2573
+ lt(e, t) {
2574
+ return this.setLimit("max", e, !1, m.toString(t));
2575
+ }
2576
+ setLimit(e, t, s, a) {
2577
+ return new z({
2578
+ ...this._def,
2579
+ checks: [
2580
+ ...this._def.checks,
2581
+ {
2582
+ kind: e,
2583
+ value: t,
2584
+ inclusive: s,
2585
+ message: m.toString(a)
2586
+ }
2587
+ ]
2588
+ });
2589
+ }
2590
+ _addCheck(e) {
2591
+ return new z({
2592
+ ...this._def,
2593
+ checks: [...this._def.checks, e]
2594
+ });
2595
+ }
2596
+ positive(e) {
2597
+ return this._addCheck({
2598
+ kind: "min",
2599
+ value: BigInt(0),
2600
+ inclusive: !1,
2601
+ message: m.toString(e)
2602
+ });
2603
+ }
2604
+ negative(e) {
2605
+ return this._addCheck({
2606
+ kind: "max",
2607
+ value: BigInt(0),
2608
+ inclusive: !1,
2609
+ message: m.toString(e)
2610
+ });
2611
+ }
2612
+ nonpositive(e) {
2613
+ return this._addCheck({
2614
+ kind: "max",
2615
+ value: BigInt(0),
2616
+ inclusive: !0,
2617
+ message: m.toString(e)
2618
+ });
2619
+ }
2620
+ nonnegative(e) {
2621
+ return this._addCheck({
2622
+ kind: "min",
2623
+ value: BigInt(0),
2624
+ inclusive: !0,
2625
+ message: m.toString(e)
2626
+ });
2627
+ }
2628
+ multipleOf(e, t) {
2629
+ return this._addCheck({
2630
+ kind: "multipleOf",
2631
+ value: e,
2632
+ message: m.toString(t)
2633
+ });
2634
+ }
2635
+ get minValue() {
2636
+ let e = null;
2637
+ for (const t of this._def.checks)
2638
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
2639
+ return e;
2640
+ }
2641
+ get maxValue() {
2642
+ let e = null;
2643
+ for (const t of this._def.checks)
2644
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
2645
+ return e;
2646
+ }
2647
+ }
2648
+ z.create = (n) => new z({
2649
+ checks: [],
2650
+ typeName: y.ZodBigInt,
2651
+ coerce: (n == null ? void 0 : n.coerce) ?? !1,
2652
+ ..._(n)
2653
+ });
2654
+ class Te extends b {
2655
+ _parse(e) {
2656
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
2657
+ const s = this._getOrReturnCtx(e);
2658
+ return l(s, {
2659
+ code: d.invalid_type,
2660
+ expected: f.boolean,
2661
+ received: s.parsedType
2662
+ }), v;
2663
+ }
2664
+ return C(e.data);
2665
+ }
2666
+ }
2667
+ Te.create = (n) => new Te({
2668
+ typeName: y.ZodBoolean,
2669
+ coerce: (n == null ? void 0 : n.coerce) || !1,
2670
+ ..._(n)
2671
+ });
2672
+ class te extends b {
2673
+ _parse(e) {
2674
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
2675
+ const r = this._getOrReturnCtx(e);
2676
+ return l(r, {
2677
+ code: d.invalid_type,
2678
+ expected: f.date,
2679
+ received: r.parsedType
2680
+ }), v;
2681
+ }
2682
+ if (Number.isNaN(e.data.getTime())) {
2683
+ const r = this._getOrReturnCtx(e);
2684
+ return l(r, {
2685
+ code: d.invalid_date
2686
+ }), v;
2687
+ }
2688
+ const s = new k();
2689
+ let a;
2690
+ for (const r of this._def.checks)
2691
+ r.kind === "min" ? e.data.getTime() < r.value && (a = this._getOrReturnCtx(e, a), l(a, {
2692
+ code: d.too_small,
2693
+ message: r.message,
2694
+ inclusive: !0,
2695
+ exact: !1,
2696
+ minimum: r.value,
2697
+ type: "date"
2698
+ }), s.dirty()) : r.kind === "max" ? e.data.getTime() > r.value && (a = this._getOrReturnCtx(e, a), l(a, {
2699
+ code: d.too_big,
2700
+ message: r.message,
2701
+ inclusive: !0,
2702
+ exact: !1,
2703
+ maximum: r.value,
2704
+ type: "date"
2705
+ }), s.dirty()) : x.assertNever(r);
2706
+ return {
2707
+ status: s.value,
2708
+ value: new Date(e.data.getTime())
2709
+ };
2710
+ }
2711
+ _addCheck(e) {
2712
+ return new te({
2713
+ ...this._def,
2714
+ checks: [...this._def.checks, e]
2715
+ });
2716
+ }
2717
+ min(e, t) {
2718
+ return this._addCheck({
2719
+ kind: "min",
2720
+ value: e.getTime(),
2721
+ message: m.toString(t)
2722
+ });
2723
+ }
2724
+ max(e, t) {
2725
+ return this._addCheck({
2726
+ kind: "max",
2727
+ value: e.getTime(),
2728
+ message: m.toString(t)
2729
+ });
2730
+ }
2731
+ get minDate() {
2732
+ let e = null;
2733
+ for (const t of this._def.checks)
2734
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
2735
+ return e != null ? new Date(e) : null;
2736
+ }
2737
+ get maxDate() {
2738
+ let e = null;
2739
+ for (const t of this._def.checks)
2740
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
2741
+ return e != null ? new Date(e) : null;
2742
+ }
2743
+ }
2744
+ te.create = (n) => new te({
2745
+ checks: [],
2746
+ coerce: (n == null ? void 0 : n.coerce) || !1,
2747
+ typeName: y.ZodDate,
2748
+ ..._(n)
2749
+ });
2750
+ class Ee extends b {
2751
+ _parse(e) {
2752
+ if (this._getType(e) !== f.symbol) {
2753
+ const s = this._getOrReturnCtx(e);
2754
+ return l(s, {
2755
+ code: d.invalid_type,
2756
+ expected: f.symbol,
2757
+ received: s.parsedType
2758
+ }), v;
2759
+ }
2760
+ return C(e.data);
2761
+ }
2762
+ }
2763
+ Ee.create = (n) => new Ee({
2764
+ typeName: y.ZodSymbol,
2765
+ ..._(n)
2766
+ });
2767
+ class be extends b {
2768
+ _parse(e) {
2769
+ if (this._getType(e) !== f.undefined) {
2770
+ const s = this._getOrReturnCtx(e);
2771
+ return l(s, {
2772
+ code: d.invalid_type,
2773
+ expected: f.undefined,
2774
+ received: s.parsedType
2775
+ }), v;
2776
+ }
2777
+ return C(e.data);
2778
+ }
2779
+ }
2780
+ be.create = (n) => new be({
2781
+ typeName: y.ZodUndefined,
2782
+ ..._(n)
2783
+ });
2784
+ class xe extends b {
2785
+ _parse(e) {
2786
+ if (this._getType(e) !== f.null) {
2787
+ const s = this._getOrReturnCtx(e);
2788
+ return l(s, {
2789
+ code: d.invalid_type,
2790
+ expected: f.null,
2791
+ received: s.parsedType
2792
+ }), v;
2793
+ }
2794
+ return C(e.data);
2795
+ }
2796
+ }
2797
+ xe.create = (n) => new xe({
2798
+ typeName: y.ZodNull,
2799
+ ..._(n)
2800
+ });
2801
+ class Ne extends b {
2802
+ constructor() {
2803
+ super(...arguments), this._any = !0;
2804
+ }
2805
+ _parse(e) {
2806
+ return C(e.data);
2807
+ }
2808
+ }
2809
+ Ne.create = (n) => new Ne({
2810
+ typeName: y.ZodAny,
2811
+ ..._(n)
2812
+ });
2813
+ class Se extends b {
2814
+ constructor() {
2815
+ super(...arguments), this._unknown = !0;
2816
+ }
2817
+ _parse(e) {
2818
+ return C(e.data);
2819
+ }
2820
+ }
2821
+ Se.create = (n) => new Se({
2822
+ typeName: y.ZodUnknown,
2823
+ ..._(n)
2824
+ });
2825
+ class U extends b {
2826
+ _parse(e) {
2827
+ const t = this._getOrReturnCtx(e);
2828
+ return l(t, {
2829
+ code: d.invalid_type,
2830
+ expected: f.never,
2831
+ received: t.parsedType
2832
+ }), v;
2833
+ }
2834
+ }
2835
+ U.create = (n) => new U({
2836
+ typeName: y.ZodNever,
2837
+ ..._(n)
2838
+ });
2839
+ class Ie extends b {
2840
+ _parse(e) {
2841
+ if (this._getType(e) !== f.undefined) {
2842
+ const s = this._getOrReturnCtx(e);
2843
+ return l(s, {
2844
+ code: d.invalid_type,
2845
+ expected: f.void,
2846
+ received: s.parsedType
2847
+ }), v;
2848
+ }
2849
+ return C(e.data);
2850
+ }
2851
+ }
2852
+ Ie.create = (n) => new Ie({
2853
+ typeName: y.ZodVoid,
2854
+ ..._(n)
2855
+ });
2856
+ class O extends b {
2857
+ _parse(e) {
2858
+ const { ctx: t, status: s } = this._processInputParams(e), a = this._def;
2859
+ if (t.parsedType !== f.array)
2860
+ return l(t, {
2861
+ code: d.invalid_type,
2862
+ expected: f.array,
2863
+ received: t.parsedType
2864
+ }), v;
2865
+ if (a.exactLength !== null) {
2866
+ const i = t.data.length > a.exactLength.value, c = t.data.length < a.exactLength.value;
2867
+ (i || c) && (l(t, {
2868
+ code: i ? d.too_big : d.too_small,
2869
+ minimum: c ? a.exactLength.value : void 0,
2870
+ maximum: i ? a.exactLength.value : void 0,
2871
+ type: "array",
2872
+ inclusive: !0,
2873
+ exact: !0,
2874
+ message: a.exactLength.message
2875
+ }), s.dirty());
2876
+ }
2877
+ if (a.minLength !== null && t.data.length < a.minLength.value && (l(t, {
2878
+ code: d.too_small,
2879
+ minimum: a.minLength.value,
2880
+ type: "array",
2881
+ inclusive: !0,
2882
+ exact: !1,
2883
+ message: a.minLength.message
2884
+ }), s.dirty()), a.maxLength !== null && t.data.length > a.maxLength.value && (l(t, {
2885
+ code: d.too_big,
2886
+ maximum: a.maxLength.value,
2887
+ type: "array",
2888
+ inclusive: !0,
2889
+ exact: !1,
2890
+ message: a.maxLength.message
2891
+ }), s.dirty()), t.common.async)
2892
+ return Promise.all([...t.data].map((i, c) => a.type._parseAsync(new M(t, i, t.path, c)))).then((i) => k.mergeArray(s, i));
2893
+ const r = [...t.data].map((i, c) => a.type._parseSync(new M(t, i, t.path, c)));
2894
+ return k.mergeArray(s, r);
2895
+ }
2896
+ get element() {
2897
+ return this._def.type;
2898
+ }
2899
+ min(e, t) {
2900
+ return new O({
2901
+ ...this._def,
2902
+ minLength: { value: e, message: m.toString(t) }
2903
+ });
2904
+ }
2905
+ max(e, t) {
2906
+ return new O({
2907
+ ...this._def,
2908
+ maxLength: { value: e, message: m.toString(t) }
2909
+ });
2910
+ }
2911
+ length(e, t) {
2912
+ return new O({
2913
+ ...this._def,
2914
+ exactLength: { value: e, message: m.toString(t) }
2915
+ });
2916
+ }
2917
+ nonempty(e) {
2918
+ return this.min(1, e);
2919
+ }
2920
+ }
2921
+ O.create = (n, e) => new O({
2922
+ type: n,
2923
+ minLength: null,
2924
+ maxLength: null,
2925
+ exactLength: null,
2926
+ typeName: y.ZodArray,
2927
+ ..._(e)
2928
+ });
2929
+ function F(n) {
2930
+ if (n instanceof N) {
2931
+ const e = {};
2932
+ for (const t in n.shape) {
2933
+ const s = n.shape[t];
2934
+ e[t] = B.create(F(s));
2935
+ }
2936
+ return new N({
2937
+ ...n._def,
2938
+ shape: () => e
2939
+ });
2940
+ } else return n instanceof O ? new O({
2941
+ ...n._def,
2942
+ type: F(n.element)
2943
+ }) : n instanceof B ? B.create(F(n.unwrap())) : n instanceof K ? K.create(F(n.unwrap())) : n instanceof $ ? $.create(n.items.map((e) => F(e))) : n;
2944
+ }
2945
+ class N extends b {
2946
+ constructor() {
2947
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
2948
+ }
2949
+ _getCached() {
2950
+ if (this._cached !== null)
2951
+ return this._cached;
2952
+ const e = this._def.shape(), t = x.objectKeys(e);
2953
+ return this._cached = { shape: e, keys: t }, this._cached;
2954
+ }
2955
+ _parse(e) {
2956
+ if (this._getType(e) !== f.object) {
2957
+ const h = this._getOrReturnCtx(e);
2958
+ return l(h, {
2959
+ code: d.invalid_type,
2960
+ expected: f.object,
2961
+ received: h.parsedType
2962
+ }), v;
2963
+ }
2964
+ const { status: s, ctx: a } = this._processInputParams(e), { shape: r, keys: i } = this._getCached(), c = [];
2965
+ if (!(this._def.catchall instanceof U && this._def.unknownKeys === "strip"))
2966
+ for (const h in a.data)
2967
+ i.includes(h) || c.push(h);
2968
+ const u = [];
2969
+ for (const h of i) {
2970
+ const A = r[h], w = a.data[h];
2971
+ u.push({
2972
+ key: { status: "valid", value: h },
2973
+ value: A._parse(new M(a, w, a.path, h)),
2974
+ alwaysSet: h in a.data
2975
+ });
2976
+ }
2977
+ if (this._def.catchall instanceof U) {
2978
+ const h = this._def.unknownKeys;
2979
+ if (h === "passthrough")
2980
+ for (const A of c)
2981
+ u.push({
2982
+ key: { status: "valid", value: A },
2983
+ value: { status: "valid", value: a.data[A] }
2984
+ });
2985
+ else if (h === "strict")
2986
+ c.length > 0 && (l(a, {
2987
+ code: d.unrecognized_keys,
2988
+ keys: c
2989
+ }), s.dirty());
2990
+ else if (h !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
2991
+ } else {
2992
+ const h = this._def.catchall;
2993
+ for (const A of c) {
2994
+ const w = a.data[A];
2995
+ u.push({
2996
+ key: { status: "valid", value: A },
2997
+ value: h._parse(
2998
+ new M(a, w, a.path, A)
2999
+ //, ctx.child(key), value, getParsedType(value)
3000
+ ),
3001
+ alwaysSet: A in a.data
3002
+ });
3003
+ }
3004
+ }
3005
+ return a.common.async ? Promise.resolve().then(async () => {
3006
+ const h = [];
3007
+ for (const A of u) {
3008
+ const w = await A.key, $e = await A.value;
3009
+ h.push({
3010
+ key: w,
3011
+ value: $e,
3012
+ alwaysSet: A.alwaysSet
3013
+ });
3014
+ }
3015
+ return h;
3016
+ }).then((h) => k.mergeObjectSync(s, h)) : k.mergeObjectSync(s, u);
3017
+ }
3018
+ get shape() {
3019
+ return this._def.shape();
3020
+ }
3021
+ strict(e) {
3022
+ return m.errToObj, new N({
3023
+ ...this._def,
3024
+ unknownKeys: "strict",
3025
+ ...e !== void 0 ? {
3026
+ errorMap: (t, s) => {
3027
+ var r, i;
3028
+ const a = ((i = (r = this._def).errorMap) == null ? void 0 : i.call(r, t, s).message) ?? s.defaultError;
3029
+ return t.code === "unrecognized_keys" ? {
3030
+ message: m.errToObj(e).message ?? a
3031
+ } : {
3032
+ message: a
3033
+ };
3034
+ }
3035
+ } : {}
3036
+ });
3037
+ }
3038
+ strip() {
3039
+ return new N({
3040
+ ...this._def,
3041
+ unknownKeys: "strip"
3042
+ });
3043
+ }
3044
+ passthrough() {
3045
+ return new N({
3046
+ ...this._def,
3047
+ unknownKeys: "passthrough"
3048
+ });
3049
+ }
3050
+ // const AugmentFactory =
3051
+ // <Def extends ZodObjectDef>(def: Def) =>
3052
+ // <Augmentation extends ZodRawShape>(
3053
+ // augmentation: Augmentation
3054
+ // ): ZodObject<
3055
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
3056
+ // Def["unknownKeys"],
3057
+ // Def["catchall"]
3058
+ // > => {
3059
+ // return new ZodObject({
3060
+ // ...def,
3061
+ // shape: () => ({
3062
+ // ...def.shape(),
3063
+ // ...augmentation,
3064
+ // }),
3065
+ // }) as any;
3066
+ // };
3067
+ extend(e) {
3068
+ return new N({
3069
+ ...this._def,
3070
+ shape: () => ({
3071
+ ...this._def.shape(),
3072
+ ...e
3073
+ })
3074
+ });
3075
+ }
3076
+ /**
3077
+ * Prior to zod@1.0.12 there was a bug in the
3078
+ * inferred type of merged objects. Please
3079
+ * upgrade if you are experiencing issues.
3080
+ */
3081
+ merge(e) {
3082
+ return new N({
3083
+ unknownKeys: e._def.unknownKeys,
3084
+ catchall: e._def.catchall,
3085
+ shape: () => ({
3086
+ ...this._def.shape(),
3087
+ ...e._def.shape()
3088
+ }),
3089
+ typeName: y.ZodObject
3090
+ });
3091
+ }
3092
+ // merge<
3093
+ // Incoming extends AnyZodObject,
3094
+ // Augmentation extends Incoming["shape"],
3095
+ // NewOutput extends {
3096
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
3097
+ // ? Augmentation[k]["_output"]
3098
+ // : k extends keyof Output
3099
+ // ? Output[k]
3100
+ // : never;
3101
+ // },
3102
+ // NewInput extends {
3103
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
3104
+ // ? Augmentation[k]["_input"]
3105
+ // : k extends keyof Input
3106
+ // ? Input[k]
3107
+ // : never;
3108
+ // }
3109
+ // >(
3110
+ // merging: Incoming
3111
+ // ): ZodObject<
3112
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
3113
+ // Incoming["_def"]["unknownKeys"],
3114
+ // Incoming["_def"]["catchall"],
3115
+ // NewOutput,
3116
+ // NewInput
3117
+ // > {
3118
+ // const merged: any = new ZodObject({
3119
+ // unknownKeys: merging._def.unknownKeys,
3120
+ // catchall: merging._def.catchall,
3121
+ // shape: () =>
3122
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
3123
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
3124
+ // }) as any;
3125
+ // return merged;
3126
+ // }
3127
+ setKey(e, t) {
3128
+ return this.augment({ [e]: t });
3129
+ }
3130
+ // merge<Incoming extends AnyZodObject>(
3131
+ // merging: Incoming
3132
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
3133
+ // ZodObject<
3134
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
3135
+ // Incoming["_def"]["unknownKeys"],
3136
+ // Incoming["_def"]["catchall"]
3137
+ // > {
3138
+ // // const mergedShape = objectUtil.mergeShapes(
3139
+ // // this._def.shape(),
3140
+ // // merging._def.shape()
3141
+ // // );
3142
+ // const merged: any = new ZodObject({
3143
+ // unknownKeys: merging._def.unknownKeys,
3144
+ // catchall: merging._def.catchall,
3145
+ // shape: () =>
3146
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
3147
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
3148
+ // }) as any;
3149
+ // return merged;
3150
+ // }
3151
+ catchall(e) {
3152
+ return new N({
3153
+ ...this._def,
3154
+ catchall: e
3155
+ });
3156
+ }
3157
+ pick(e) {
3158
+ const t = {};
3159
+ for (const s of x.objectKeys(e))
3160
+ e[s] && this.shape[s] && (t[s] = this.shape[s]);
3161
+ return new N({
3162
+ ...this._def,
3163
+ shape: () => t
3164
+ });
3165
+ }
3166
+ omit(e) {
3167
+ const t = {};
3168
+ for (const s of x.objectKeys(this.shape))
3169
+ e[s] || (t[s] = this.shape[s]);
3170
+ return new N({
3171
+ ...this._def,
3172
+ shape: () => t
3173
+ });
3174
+ }
3175
+ /**
3176
+ * @deprecated
3177
+ */
3178
+ deepPartial() {
3179
+ return F(this);
3180
+ }
3181
+ partial(e) {
3182
+ const t = {};
3183
+ for (const s of x.objectKeys(this.shape)) {
3184
+ const a = this.shape[s];
3185
+ e && !e[s] ? t[s] = a : t[s] = a.optional();
3186
+ }
3187
+ return new N({
3188
+ ...this._def,
3189
+ shape: () => t
3190
+ });
3191
+ }
3192
+ required(e) {
3193
+ const t = {};
3194
+ for (const s of x.objectKeys(this.shape))
3195
+ if (e && !e[s])
3196
+ t[s] = this.shape[s];
3197
+ else {
3198
+ let r = this.shape[s];
3199
+ for (; r instanceof B; )
3200
+ r = r._def.innerType;
3201
+ t[s] = r;
3202
+ }
3203
+ return new N({
3204
+ ...this._def,
3205
+ shape: () => t
3206
+ });
3207
+ }
3208
+ keyof() {
3209
+ return Ve(x.objectKeys(this.shape));
3210
+ }
3211
+ }
3212
+ N.create = (n, e) => new N({
3213
+ shape: () => n,
3214
+ unknownKeys: "strip",
3215
+ catchall: U.create(),
3216
+ typeName: y.ZodObject,
3217
+ ..._(e)
3218
+ });
3219
+ N.strictCreate = (n, e) => new N({
3220
+ shape: () => n,
3221
+ unknownKeys: "strict",
3222
+ catchall: U.create(),
3223
+ typeName: y.ZodObject,
3224
+ ..._(e)
3225
+ });
3226
+ N.lazycreate = (n, e) => new N({
3227
+ shape: n,
3228
+ unknownKeys: "strip",
3229
+ catchall: U.create(),
3230
+ typeName: y.ZodObject,
3231
+ ..._(e)
3232
+ });
3233
+ class ne extends b {
3234
+ _parse(e) {
3235
+ const { ctx: t } = this._processInputParams(e), s = this._def.options;
3236
+ function a(r) {
3237
+ for (const c of r)
3238
+ if (c.result.status === "valid")
3239
+ return c.result;
3240
+ for (const c of r)
3241
+ if (c.result.status === "dirty")
3242
+ return t.common.issues.push(...c.ctx.common.issues), c.result;
3243
+ const i = r.map((c) => new R(c.ctx.common.issues));
3244
+ return l(t, {
3245
+ code: d.invalid_union,
3246
+ unionErrors: i
3247
+ }), v;
3248
+ }
3249
+ if (t.common.async)
3250
+ return Promise.all(s.map(async (r) => {
3251
+ const i = {
3252
+ ...t,
3253
+ common: {
3254
+ ...t.common,
3255
+ issues: []
3256
+ },
3257
+ parent: null
3258
+ };
3259
+ return {
3260
+ result: await r._parseAsync({
3261
+ data: t.data,
3262
+ path: t.path,
3263
+ parent: i
3264
+ }),
3265
+ ctx: i
3266
+ };
3267
+ })).then(a);
3268
+ {
3269
+ let r;
3270
+ const i = [];
3271
+ for (const u of s) {
3272
+ const h = {
3273
+ ...t,
3274
+ common: {
3275
+ ...t.common,
3276
+ issues: []
3277
+ },
3278
+ parent: null
3279
+ }, A = u._parseSync({
3280
+ data: t.data,
3281
+ path: t.path,
3282
+ parent: h
3283
+ });
3284
+ if (A.status === "valid")
3285
+ return A;
3286
+ A.status === "dirty" && !r && (r = { result: A, ctx: h }), h.common.issues.length && i.push(h.common.issues);
3287
+ }
3288
+ if (r)
3289
+ return t.common.issues.push(...r.ctx.common.issues), r.result;
3290
+ const c = i.map((u) => new R(u));
3291
+ return l(t, {
3292
+ code: d.invalid_union,
3293
+ unionErrors: c
3294
+ }), v;
3295
+ }
3296
+ }
3297
+ get options() {
3298
+ return this._def.options;
3299
+ }
3300
+ }
3301
+ ne.create = (n, e) => new ne({
3302
+ options: n,
3303
+ typeName: y.ZodUnion,
3304
+ ..._(e)
3305
+ });
3306
+ function oe(n, e) {
3307
+ const t = D(n), s = D(e);
3308
+ if (n === e)
3309
+ return { valid: !0, data: n };
3310
+ if (t === f.object && s === f.object) {
3311
+ const a = x.objectKeys(e), r = x.objectKeys(n).filter((c) => a.indexOf(c) !== -1), i = { ...n, ...e };
3312
+ for (const c of r) {
3313
+ const u = oe(n[c], e[c]);
3314
+ if (!u.valid)
3315
+ return { valid: !1 };
3316
+ i[c] = u.data;
3317
+ }
3318
+ return { valid: !0, data: i };
3319
+ } else if (t === f.array && s === f.array) {
3320
+ if (n.length !== e.length)
3321
+ return { valid: !1 };
3322
+ const a = [];
3323
+ for (let r = 0; r < n.length; r++) {
3324
+ const i = n[r], c = e[r], u = oe(i, c);
3325
+ if (!u.valid)
3326
+ return { valid: !1 };
3327
+ a.push(u.data);
3328
+ }
3329
+ return { valid: !0, data: a };
3330
+ } else return t === f.date && s === f.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
3331
+ }
3332
+ class se extends b {
3333
+ _parse(e) {
3334
+ const { status: t, ctx: s } = this._processInputParams(e), a = (r, i) => {
3335
+ if (ye(r) || ye(i))
3336
+ return v;
3337
+ const c = oe(r.value, i.value);
3338
+ return c.valid ? ((_e(r) || _e(i)) && t.dirty(), { status: t.value, value: c.data }) : (l(s, {
3339
+ code: d.invalid_intersection_types
3340
+ }), v);
3341
+ };
3342
+ return s.common.async ? Promise.all([
3343
+ this._def.left._parseAsync({
3344
+ data: s.data,
3345
+ path: s.path,
3346
+ parent: s
3347
+ }),
3348
+ this._def.right._parseAsync({
3349
+ data: s.data,
3350
+ path: s.path,
3351
+ parent: s
3352
+ })
3353
+ ]).then(([r, i]) => a(r, i)) : a(this._def.left._parseSync({
3354
+ data: s.data,
3355
+ path: s.path,
3356
+ parent: s
3357
+ }), this._def.right._parseSync({
3358
+ data: s.data,
3359
+ path: s.path,
3360
+ parent: s
3361
+ }));
3362
+ }
3363
+ }
3364
+ se.create = (n, e, t) => new se({
3365
+ left: n,
3366
+ right: e,
3367
+ typeName: y.ZodIntersection,
3368
+ ..._(t)
3369
+ });
3370
+ class $ extends b {
3371
+ _parse(e) {
3372
+ const { status: t, ctx: s } = this._processInputParams(e);
3373
+ if (s.parsedType !== f.array)
3374
+ return l(s, {
3375
+ code: d.invalid_type,
3376
+ expected: f.array,
3377
+ received: s.parsedType
3378
+ }), v;
3379
+ if (s.data.length < this._def.items.length)
3380
+ return l(s, {
3381
+ code: d.too_small,
3382
+ minimum: this._def.items.length,
3383
+ inclusive: !0,
3384
+ exact: !1,
3385
+ type: "array"
3386
+ }), v;
3387
+ !this._def.rest && s.data.length > this._def.items.length && (l(s, {
3388
+ code: d.too_big,
3389
+ maximum: this._def.items.length,
3390
+ inclusive: !0,
3391
+ exact: !1,
3392
+ type: "array"
3393
+ }), t.dirty());
3394
+ const r = [...s.data].map((i, c) => {
3395
+ const u = this._def.items[c] || this._def.rest;
3396
+ return u ? u._parse(new M(s, i, s.path, c)) : null;
3397
+ }).filter((i) => !!i);
3398
+ return s.common.async ? Promise.all(r).then((i) => k.mergeArray(t, i)) : k.mergeArray(t, r);
3399
+ }
3400
+ get items() {
3401
+ return this._def.items;
3402
+ }
3403
+ rest(e) {
3404
+ return new $({
3405
+ ...this._def,
3406
+ rest: e
3407
+ });
3408
+ }
3409
+ }
3410
+ $.create = (n, e) => {
3411
+ if (!Array.isArray(n))
3412
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
3413
+ return new $({
3414
+ items: n,
3415
+ typeName: y.ZodTuple,
3416
+ rest: null,
3417
+ ..._(e)
3418
+ });
3419
+ };
3420
+ class ke extends b {
3421
+ get keySchema() {
3422
+ return this._def.keyType;
3423
+ }
3424
+ get valueSchema() {
3425
+ return this._def.valueType;
3426
+ }
3427
+ _parse(e) {
3428
+ const { status: t, ctx: s } = this._processInputParams(e);
3429
+ if (s.parsedType !== f.map)
3430
+ return l(s, {
3431
+ code: d.invalid_type,
3432
+ expected: f.map,
3433
+ received: s.parsedType
3434
+ }), v;
3435
+ const a = this._def.keyType, r = this._def.valueType, i = [...s.data.entries()].map(([c, u], h) => ({
3436
+ key: a._parse(new M(s, c, s.path, [h, "key"])),
3437
+ value: r._parse(new M(s, u, s.path, [h, "value"]))
3438
+ }));
3439
+ if (s.common.async) {
3440
+ const c = /* @__PURE__ */ new Map();
3441
+ return Promise.resolve().then(async () => {
3442
+ for (const u of i) {
3443
+ const h = await u.key, A = await u.value;
3444
+ if (h.status === "aborted" || A.status === "aborted")
3445
+ return v;
3446
+ (h.status === "dirty" || A.status === "dirty") && t.dirty(), c.set(h.value, A.value);
3447
+ }
3448
+ return { status: t.value, value: c };
3449
+ });
3450
+ } else {
3451
+ const c = /* @__PURE__ */ new Map();
3452
+ for (const u of i) {
3453
+ const h = u.key, A = u.value;
3454
+ if (h.status === "aborted" || A.status === "aborted")
3455
+ return v;
3456
+ (h.status === "dirty" || A.status === "dirty") && t.dirty(), c.set(h.value, A.value);
3457
+ }
3458
+ return { status: t.value, value: c };
3459
+ }
3460
+ }
3461
+ }
3462
+ ke.create = (n, e, t) => new ke({
3463
+ valueType: e,
3464
+ keyType: n,
3465
+ typeName: y.ZodMap,
3466
+ ..._(t)
3467
+ });
3468
+ class X extends b {
3469
+ _parse(e) {
3470
+ const { status: t, ctx: s } = this._processInputParams(e);
3471
+ if (s.parsedType !== f.set)
3472
+ return l(s, {
3473
+ code: d.invalid_type,
3474
+ expected: f.set,
3475
+ received: s.parsedType
3476
+ }), v;
3477
+ const a = this._def;
3478
+ a.minSize !== null && s.data.size < a.minSize.value && (l(s, {
3479
+ code: d.too_small,
3480
+ minimum: a.minSize.value,
3481
+ type: "set",
3482
+ inclusive: !0,
3483
+ exact: !1,
3484
+ message: a.minSize.message
3485
+ }), t.dirty()), a.maxSize !== null && s.data.size > a.maxSize.value && (l(s, {
3486
+ code: d.too_big,
3487
+ maximum: a.maxSize.value,
3488
+ type: "set",
3489
+ inclusive: !0,
3490
+ exact: !1,
3491
+ message: a.maxSize.message
3492
+ }), t.dirty());
3493
+ const r = this._def.valueType;
3494
+ function i(u) {
3495
+ const h = /* @__PURE__ */ new Set();
3496
+ for (const A of u) {
3497
+ if (A.status === "aborted")
3498
+ return v;
3499
+ A.status === "dirty" && t.dirty(), h.add(A.value);
3500
+ }
3501
+ return { status: t.value, value: h };
3502
+ }
3503
+ const c = [...s.data.values()].map((u, h) => r._parse(new M(s, u, s.path, h)));
3504
+ return s.common.async ? Promise.all(c).then((u) => i(u)) : i(c);
3505
+ }
3506
+ min(e, t) {
3507
+ return new X({
3508
+ ...this._def,
3509
+ minSize: { value: e, message: m.toString(t) }
3510
+ });
3511
+ }
3512
+ max(e, t) {
3513
+ return new X({
3514
+ ...this._def,
3515
+ maxSize: { value: e, message: m.toString(t) }
3516
+ });
3517
+ }
3518
+ size(e, t) {
3519
+ return this.min(e, t).max(e, t);
3520
+ }
3521
+ nonempty(e) {
3522
+ return this.min(1, e);
3523
+ }
3524
+ }
3525
+ X.create = (n, e) => new X({
3526
+ valueType: n,
3527
+ minSize: null,
3528
+ maxSize: null,
3529
+ typeName: y.ZodSet,
3530
+ ..._(e)
3531
+ });
3532
+ class Ce extends b {
3533
+ get schema() {
3534
+ return this._def.getter();
3535
+ }
3536
+ _parse(e) {
3537
+ const { ctx: t } = this._processInputParams(e);
3538
+ return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
3539
+ }
3540
+ }
3541
+ Ce.create = (n, e) => new Ce({
3542
+ getter: n,
3543
+ typeName: y.ZodLazy,
3544
+ ..._(e)
3545
+ });
3546
+ class we extends b {
3547
+ _parse(e) {
3548
+ if (e.data !== this._def.value) {
3549
+ const t = this._getOrReturnCtx(e);
3550
+ return l(t, {
3551
+ received: t.data,
3552
+ code: d.invalid_literal,
3553
+ expected: this._def.value
3554
+ }), v;
3555
+ }
3556
+ return { status: "valid", value: e.data };
3557
+ }
3558
+ get value() {
3559
+ return this._def.value;
3560
+ }
3561
+ }
3562
+ we.create = (n, e) => new we({
3563
+ value: n,
3564
+ typeName: y.ZodLiteral,
3565
+ ..._(e)
3566
+ });
3567
+ function Ve(n, e) {
3568
+ return new q({
3569
+ values: n,
3570
+ typeName: y.ZodEnum,
3571
+ ..._(e)
3572
+ });
3573
+ }
3574
+ class q extends b {
3575
+ _parse(e) {
3576
+ if (typeof e.data != "string") {
3577
+ const t = this._getOrReturnCtx(e), s = this._def.values;
3578
+ return l(t, {
3579
+ expected: x.joinValues(s),
3580
+ received: t.parsedType,
3581
+ code: d.invalid_type
3582
+ }), v;
3583
+ }
3584
+ if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
3585
+ const t = this._getOrReturnCtx(e), s = this._def.values;
3586
+ return l(t, {
3587
+ received: t.data,
3588
+ code: d.invalid_enum_value,
3589
+ options: s
3590
+ }), v;
3591
+ }
3592
+ return C(e.data);
3593
+ }
3594
+ get options() {
3595
+ return this._def.values;
3596
+ }
3597
+ get enum() {
3598
+ const e = {};
3599
+ for (const t of this._def.values)
3600
+ e[t] = t;
3601
+ return e;
3602
+ }
3603
+ get Values() {
3604
+ const e = {};
3605
+ for (const t of this._def.values)
3606
+ e[t] = t;
3607
+ return e;
3608
+ }
3609
+ get Enum() {
3610
+ const e = {};
3611
+ for (const t of this._def.values)
3612
+ e[t] = t;
3613
+ return e;
3614
+ }
3615
+ extract(e, t = this._def) {
3616
+ return q.create(e, {
3617
+ ...this._def,
3618
+ ...t
3619
+ });
3620
+ }
3621
+ exclude(e, t = this._def) {
3622
+ return q.create(this.options.filter((s) => !e.includes(s)), {
3623
+ ...this._def,
3624
+ ...t
3625
+ });
3626
+ }
3627
+ }
3628
+ q.create = Ve;
3629
+ class Oe extends b {
3630
+ _parse(e) {
3631
+ const t = x.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
3632
+ if (s.parsedType !== f.string && s.parsedType !== f.number) {
3633
+ const a = x.objectValues(t);
3634
+ return l(s, {
3635
+ expected: x.joinValues(a),
3636
+ received: s.parsedType,
3637
+ code: d.invalid_type
3638
+ }), v;
3639
+ }
3640
+ if (this._cache || (this._cache = new Set(x.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
3641
+ const a = x.objectValues(t);
3642
+ return l(s, {
3643
+ received: s.data,
3644
+ code: d.invalid_enum_value,
3645
+ options: a
3646
+ }), v;
3647
+ }
3648
+ return C(e.data);
3649
+ }
3650
+ get enum() {
3651
+ return this._def.values;
3652
+ }
3653
+ }
3654
+ Oe.create = (n, e) => new Oe({
3655
+ values: n,
3656
+ typeName: y.ZodNativeEnum,
3657
+ ..._(e)
3658
+ });
3659
+ class ae extends b {
3660
+ unwrap() {
3661
+ return this._def.type;
3662
+ }
3663
+ _parse(e) {
3664
+ const { ctx: t } = this._processInputParams(e);
3665
+ if (t.parsedType !== f.promise && t.common.async === !1)
3666
+ return l(t, {
3667
+ code: d.invalid_type,
3668
+ expected: f.promise,
3669
+ received: t.parsedType
3670
+ }), v;
3671
+ const s = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
3672
+ return C(s.then((a) => this._def.type.parseAsync(a, {
3673
+ path: t.path,
3674
+ errorMap: t.common.contextualErrorMap
3675
+ })));
3676
+ }
3677
+ }
3678
+ ae.create = (n, e) => new ae({
3679
+ type: n,
3680
+ typeName: y.ZodPromise,
3681
+ ..._(e)
3682
+ });
3683
+ class W extends b {
3684
+ innerType() {
3685
+ return this._def.schema;
3686
+ }
3687
+ sourceType() {
3688
+ return this._def.schema._def.typeName === y.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
3689
+ }
3690
+ _parse(e) {
3691
+ const { status: t, ctx: s } = this._processInputParams(e), a = this._def.effect || null, r = {
3692
+ addIssue: (i) => {
3693
+ l(s, i), i.fatal ? t.abort() : t.dirty();
3694
+ },
3695
+ get path() {
3696
+ return s.path;
3697
+ }
3698
+ };
3699
+ if (r.addIssue = r.addIssue.bind(r), a.type === "preprocess") {
3700
+ const i = a.transform(s.data, r);
3701
+ if (s.common.async)
3702
+ return Promise.resolve(i).then(async (c) => {
3703
+ if (t.value === "aborted")
3704
+ return v;
3705
+ const u = await this._def.schema._parseAsync({
3706
+ data: c,
3707
+ path: s.path,
3708
+ parent: s
3709
+ });
3710
+ return u.status === "aborted" ? v : u.status === "dirty" || t.value === "dirty" ? J(u.value) : u;
3711
+ });
3712
+ {
3713
+ if (t.value === "aborted")
3714
+ return v;
3715
+ const c = this._def.schema._parseSync({
3716
+ data: i,
3717
+ path: s.path,
3718
+ parent: s
3719
+ });
3720
+ return c.status === "aborted" ? v : c.status === "dirty" || t.value === "dirty" ? J(c.value) : c;
3721
+ }
3722
+ }
3723
+ if (a.type === "refinement") {
3724
+ const i = (c) => {
3725
+ const u = a.refinement(c, r);
3726
+ if (s.common.async)
3727
+ return Promise.resolve(u);
3728
+ if (u instanceof Promise)
3729
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
3730
+ return c;
3731
+ };
3732
+ if (s.common.async === !1) {
3733
+ const c = this._def.schema._parseSync({
3734
+ data: s.data,
3735
+ path: s.path,
3736
+ parent: s
3737
+ });
3738
+ return c.status === "aborted" ? v : (c.status === "dirty" && t.dirty(), i(c.value), { status: t.value, value: c.value });
3739
+ } else
3740
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((c) => c.status === "aborted" ? v : (c.status === "dirty" && t.dirty(), i(c.value).then(() => ({ status: t.value, value: c.value }))));
3741
+ }
3742
+ if (a.type === "transform")
3743
+ if (s.common.async === !1) {
3744
+ const i = this._def.schema._parseSync({
3745
+ data: s.data,
3746
+ path: s.path,
3747
+ parent: s
3748
+ });
3749
+ if (!j(i))
3750
+ return v;
3751
+ const c = a.transform(i.value, r);
3752
+ if (c instanceof Promise)
3753
+ throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
3754
+ return { status: t.value, value: c };
3755
+ } else
3756
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => j(i) ? Promise.resolve(a.transform(i.value, r)).then((c) => ({
3757
+ status: t.value,
3758
+ value: c
3759
+ })) : v);
3760
+ x.assertNever(a);
3761
+ }
3762
+ }
3763
+ W.create = (n, e, t) => new W({
3764
+ schema: n,
3765
+ typeName: y.ZodEffects,
3766
+ effect: e,
3767
+ ..._(t)
3768
+ });
3769
+ W.createWithPreprocess = (n, e, t) => new W({
3770
+ schema: e,
3771
+ effect: { type: "preprocess", transform: n },
3772
+ typeName: y.ZodEffects,
3773
+ ..._(t)
3774
+ });
3775
+ class B extends b {
3776
+ _parse(e) {
3777
+ return this._getType(e) === f.undefined ? C(void 0) : this._def.innerType._parse(e);
3778
+ }
3779
+ unwrap() {
3780
+ return this._def.innerType;
3781
+ }
3782
+ }
3783
+ B.create = (n, e) => new B({
3784
+ innerType: n,
3785
+ typeName: y.ZodOptional,
3786
+ ..._(e)
3787
+ });
3788
+ class K extends b {
3789
+ _parse(e) {
3790
+ return this._getType(e) === f.null ? C(null) : this._def.innerType._parse(e);
3791
+ }
3792
+ unwrap() {
3793
+ return this._def.innerType;
3794
+ }
3795
+ }
3796
+ K.create = (n, e) => new K({
3797
+ innerType: n,
3798
+ typeName: y.ZodNullable,
3799
+ ..._(e)
3800
+ });
3801
+ class de extends b {
3802
+ _parse(e) {
3803
+ const { ctx: t } = this._processInputParams(e);
3804
+ let s = t.data;
3805
+ return t.parsedType === f.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
3806
+ data: s,
3807
+ path: t.path,
3808
+ parent: t
3809
+ });
3810
+ }
3811
+ removeDefault() {
3812
+ return this._def.innerType;
3813
+ }
3814
+ }
3815
+ de.create = (n, e) => new de({
3816
+ innerType: n,
3817
+ typeName: y.ZodDefault,
3818
+ defaultValue: typeof e.default == "function" ? e.default : () => e.default,
3819
+ ..._(e)
3820
+ });
3821
+ class ue extends b {
3822
+ _parse(e) {
3823
+ const { ctx: t } = this._processInputParams(e), s = {
3824
+ ...t,
3825
+ common: {
3826
+ ...t.common,
3827
+ issues: []
3828
+ }
3829
+ }, a = this._def.innerType._parse({
3830
+ data: s.data,
3831
+ path: s.path,
3832
+ parent: {
3833
+ ...s
3834
+ }
3835
+ });
3836
+ return ee(a) ? a.then((r) => ({
3837
+ status: "valid",
3838
+ value: r.status === "valid" ? r.value : this._def.catchValue({
3839
+ get error() {
3840
+ return new R(s.common.issues);
3841
+ },
3842
+ input: s.data
3843
+ })
3844
+ })) : {
3845
+ status: "valid",
3846
+ value: a.status === "valid" ? a.value : this._def.catchValue({
3847
+ get error() {
3848
+ return new R(s.common.issues);
3849
+ },
3850
+ input: s.data
3851
+ })
3852
+ };
3853
+ }
3854
+ removeCatch() {
3855
+ return this._def.innerType;
3856
+ }
3857
+ }
3858
+ ue.create = (n, e) => new ue({
3859
+ innerType: n,
3860
+ typeName: y.ZodCatch,
3861
+ catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
3862
+ ..._(e)
3863
+ });
3864
+ class Re extends b {
3865
+ _parse(e) {
3866
+ if (this._getType(e) !== f.nan) {
3867
+ const s = this._getOrReturnCtx(e);
3868
+ return l(s, {
3869
+ code: d.invalid_type,
3870
+ expected: f.nan,
3871
+ received: s.parsedType
3872
+ }), v;
3873
+ }
3874
+ return { status: "valid", value: e.data };
3875
+ }
3876
+ }
3877
+ Re.create = (n) => new Re({
3878
+ typeName: y.ZodNaN,
3879
+ ..._(n)
3880
+ });
3881
+ class Vt extends b {
3882
+ _parse(e) {
3883
+ const { ctx: t } = this._processInputParams(e), s = t.data;
3884
+ return this._def.type._parse({
3885
+ data: s,
3886
+ path: t.path,
3887
+ parent: t
3888
+ });
3889
+ }
3890
+ unwrap() {
3891
+ return this._def.type;
3892
+ }
3893
+ }
3894
+ class he extends b {
3895
+ _parse(e) {
3896
+ const { status: t, ctx: s } = this._processInputParams(e);
3897
+ if (s.common.async)
3898
+ return (async () => {
3899
+ const r = await this._def.in._parseAsync({
3900
+ data: s.data,
3901
+ path: s.path,
3902
+ parent: s
3903
+ });
3904
+ return r.status === "aborted" ? v : r.status === "dirty" ? (t.dirty(), J(r.value)) : this._def.out._parseAsync({
3905
+ data: r.value,
3906
+ path: s.path,
3907
+ parent: s
3908
+ });
3909
+ })();
3910
+ {
3911
+ const a = this._def.in._parseSync({
3912
+ data: s.data,
3913
+ path: s.path,
3914
+ parent: s
3915
+ });
3916
+ return a.status === "aborted" ? v : a.status === "dirty" ? (t.dirty(), {
3917
+ status: "dirty",
3918
+ value: a.value
3919
+ }) : this._def.out._parseSync({
3920
+ data: a.value,
3921
+ path: s.path,
3922
+ parent: s
3923
+ });
3924
+ }
3925
+ }
3926
+ static create(e, t) {
3927
+ return new he({
3928
+ in: e,
3929
+ out: t,
3930
+ typeName: y.ZodPipeline
3931
+ });
3932
+ }
3933
+ }
3934
+ class le extends b {
3935
+ _parse(e) {
3936
+ const t = this._def.innerType._parse(e), s = (a) => (j(a) && (a.value = Object.freeze(a.value)), a);
3937
+ return ee(t) ? t.then((a) => s(a)) : s(t);
3938
+ }
3939
+ unwrap() {
3940
+ return this._def.innerType;
3941
+ }
3942
+ }
3943
+ le.create = (n, e) => new le({
3944
+ innerType: n,
3945
+ typeName: y.ZodReadonly,
3946
+ ..._(e)
3947
+ });
3948
+ var y;
3949
+ (function(n) {
3950
+ n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
3951
+ })(y || (y = {}));
3952
+ const L = P.create, Zt = H.create, $t = z.create;
3953
+ U.create;
3954
+ O.create;
3955
+ const Ft = N.create, jt = ne.create;
3956
+ se.create;
3957
+ $.create;
3958
+ q.create;
3959
+ ae.create;
3960
+ B.create;
3961
+ K.create;
3962
+ function Ht() {
3963
+ const n = /* @__PURE__ */ new Map();
3964
+ return {
3965
+ on(e, t) {
3966
+ let s = n.get(e);
3967
+ return s || (s = /* @__PURE__ */ new Set(), n.set(e, s)), s.add(t), () => {
3968
+ s == null || s.delete(t), s && s.size === 0 && n.delete(e);
3969
+ };
3970
+ },
3971
+ emit(e, ...t) {
3972
+ const s = n.get(e);
3973
+ if (!(!s || s.size === 0))
3974
+ for (const a of s)
3975
+ try {
3976
+ a(...t);
3977
+ } catch (r) {
3978
+ console.error(
3979
+ `Error in event handler for "${String(e)}":`,
3980
+ r
3981
+ );
3982
+ }
3983
+ },
3984
+ off(e, t) {
3985
+ const s = n.get(e);
3986
+ s && (s.delete(t), s.size === 0 && n.delete(e));
3987
+ },
3988
+ clear() {
3989
+ n.clear();
3990
+ }
3991
+ };
3992
+ }
3993
+ class Ln {
3994
+ constructor(e, t) {
3995
+ /** Event emitter for this action */
3996
+ I(this, "eventEmitter");
3997
+ /** Current status (step in the flow) */
3998
+ I(this, "_status");
3999
+ /** Tracked error - null means no error */
4000
+ I(this, "_error", null);
4001
+ /** Loading state - true when an async operation is in progress */
4002
+ I(this, "_isLoading", !1);
4003
+ /** Optional logger for debugging and monitoring */
4004
+ I(this, "logger");
4005
+ /** Operation timing for performance monitoring */
4006
+ I(this, "_timing", /* @__PURE__ */ new Map());
4007
+ this.eventEmitter = Ht(), this._status = e, this.logger = t;
4008
+ }
4009
+ // ─────────────────────────────────────────────────────────────────────────
4010
+ // Logging
4011
+ // ─────────────────────────────────────────────────────────────────────────
4012
+ /**
4013
+ * Log a message with context
4014
+ *
4015
+ * Automatically includes action name and current status.
4016
+ * No-op if logger is not configured.
4017
+ *
4018
+ * Uses explicit switch to avoid dynamic property access (security best practice).
4019
+ */
4020
+ log(e, t, s) {
4021
+ if (!this.logger) return;
4022
+ const a = {
4023
+ action: this.constructor.name,
4024
+ status: this._status,
4025
+ ...s
4026
+ };
4027
+ switch (e) {
4028
+ case "debug":
4029
+ this.logger.debug(t, a);
4030
+ break;
4031
+ case "info":
4032
+ this.logger.info(t, a);
4033
+ break;
4034
+ case "warn":
4035
+ this.logger.warn(t, a);
4036
+ break;
4037
+ case "error":
4038
+ this.logger.error(t, a);
4039
+ break;
4040
+ }
4041
+ }
4042
+ /**
4043
+ * Get timing for an operation
4044
+ */
4045
+ getTiming(e) {
4046
+ return this._timing.get(e);
4047
+ }
4048
+ /**
4049
+ * Get all operation timings
4050
+ */
4051
+ getAllTimings() {
4052
+ return Object.fromEntries(this._timing);
4053
+ }
4054
+ /**
4055
+ * Record timing for an operation
4056
+ */
4057
+ recordTiming(e, t) {
4058
+ this._timing.set(e, t);
4059
+ }
4060
+ // ─────────────────────────────────────────────────────────────────────────
4061
+ // Public Getters
4062
+ // ─────────────────────────────────────────────────────────────────────────
4063
+ /** Current action status (which step in the flow) */
4064
+ get status() {
4065
+ return this._status;
4066
+ }
4067
+ /** Error that occurred (if any) - null means no error */
4068
+ get error() {
4069
+ return this._error;
4070
+ }
4071
+ /** Whether the action has failed (derived from error !== null) */
4072
+ get isFailed() {
4073
+ return this._error !== null;
4074
+ }
4075
+ /** Whether an async operation is in progress */
4076
+ get isLoading() {
4077
+ return this._isLoading;
4078
+ }
4079
+ // ─────────────────────────────────────────────────────────────────────────
4080
+ // Status Management
4081
+ // ─────────────────────────────────────────────────────────────────────────
4082
+ /**
4083
+ * Update the action status and emit status-change event
4084
+ */
4085
+ updateStatus(e) {
4086
+ this._status = e, this.emitStatusChange(e);
4087
+ }
4088
+ /**
4089
+ * Assert the action is in an expected status
4090
+ *
4091
+ * @param expected - Single status or array of allowed statuses
4092
+ * @param action - Name of the action being performed (for error message)
4093
+ * @throws LombardError if current status is not in expected list
4094
+ */
4095
+ assertStatus(e, t) {
4096
+ const s = Array.isArray(e) ? e : [e];
4097
+ if (!s.includes(this._status))
4098
+ throw new E(
4099
+ Z.INVALID_STATE,
4100
+ `Cannot ${t} while status is ${this._status}, allowed: ${s.join(", ")}`
4101
+ );
4102
+ }
4103
+ // ─────────────────────────────────────────────────────────────────────────
4104
+ // Error Handling
4105
+ // ─────────────────────────────────────────────────────────────────────────
4106
+ /**
4107
+ * Clear any previous error
4108
+ *
4109
+ * Call this at the start of retry attempts to reset error state.
4110
+ */
4111
+ clearError() {
4112
+ this._error = null;
4113
+ }
4114
+ /**
4115
+ * Handle action failure
4116
+ *
4117
+ * Stores error, emits events, and throws.
4118
+ * Status is NOT changed - it stays at the step where the error occurred.
4119
+ * This allows callers to know exactly where the failure happened.
4120
+ *
4121
+ * @param error - The error that occurred
4122
+ * @throws The wrapped LombardError
4123
+ */
4124
+ handleFailure(e) {
4125
+ throw this._error = e instanceof E ? e : pe(e), this.emitError(this._error), this.emitFailed(), this._error;
4126
+ }
4127
+ /**
4128
+ * Set loading state and emit event
4129
+ */
4130
+ setLoading(e) {
4131
+ this._isLoading = e, this.emitLoading(e);
4132
+ }
4133
+ /**
4134
+ * Perform an async operation with automatic state management
4135
+ *
4136
+ * This is the primary method for wrapping async operations in actions.
4137
+ * Handles loading state, errors, and status transitions automatically.
4138
+ *
4139
+ * ## Automatic Behaviors
4140
+ *
4141
+ * - **isLoading**: Set to true before operation, false after (success or failure)
4142
+ * - **error**: Cleared on start, set on failure
4143
+ * - **status**: Optionally transitions to `successStatus` on success
4144
+ *
4145
+ * ## Design Philosophy: Orthogonal Concerns
4146
+ *
4147
+ * Status, loading, and error are independent:
4148
+ * - `status` = "What step are you at?" (IDLE, NEEDS_AUTH, READY, etc.)
4149
+ * - `isLoading` = "Is an operation in progress?" (true/false)
4150
+ * - `error` = "Did something go wrong?" (Error | null)
4151
+ *
4152
+ * No transitional statuses (PREPARING, AUTHORIZING, etc.) needed!
4153
+ * The UI can derive the display state:
4154
+ * - IDLE + isLoading → "Preparing..."
4155
+ * - NEEDS_AUTH + isLoading → "Authorizing..."
4156
+ * - READY + isLoading → "Generating..."
4157
+ *
4158
+ * @param fn - Async function to execute
4159
+ * @param successStatus - Status to transition to on success (optional)
4160
+ * @returns Result of the operation
4161
+ *
4162
+ * @example Simple operation (no status change)
4163
+ * ```typescript
4164
+ * async execute() {
4165
+ * return this.act(async () => {
4166
+ * return this.depositAddress;
4167
+ * });
4168
+ * }
4169
+ * ```
4170
+ *
4171
+ * @example Operation with status transition
4172
+ * ```typescript
4173
+ * async authorize(): Promise<void> {
4174
+ * this.assertStatus([Status.NEEDS_AUTH, Status.READY], 'authorize');
4175
+ * if (this.status === Status.READY) return;
4176
+ *
4177
+ * return this.act(
4178
+ * async () => {
4179
+ * const result = await this.signTransaction();
4180
+ * this.authState.signature = result.signature;
4181
+ * },
4182
+ * Status.READY
4183
+ * );
4184
+ * }
4185
+ * ```
4186
+ *
4187
+ * @example Flow visualization
4188
+ * ```
4189
+ * Success flow:
4190
+ * status: NEEDS_AUTH -> NEEDS_AUTH -> READY
4191
+ * isLoading: false -> true -> false
4192
+ *
4193
+ * Failure flow:
4194
+ * status: NEEDS_AUTH -> NEEDS_AUTH (unchanged!)
4195
+ * isLoading: false -> true -> false
4196
+ * error: null -> "User rejected"
4197
+ * ```
4198
+ */
4199
+ async act(e, t) {
4200
+ const s = performance.now(), a = t ?? "operation";
4201
+ this.log("debug", `Starting ${a}`, { step: String(a) }), this.clearError(), this.setLoading(!0);
4202
+ try {
4203
+ const r = await e(), i = performance.now() - s;
4204
+ return this.recordTiming(String(a), i), this.log("info", `Completed ${a}`, {
4205
+ step: String(a),
4206
+ duration: Math.round(i)
4207
+ }), t !== void 0 && this.updateStatus(t), r;
4208
+ } catch (r) {
4209
+ const i = performance.now() - s, c = r instanceof E ? r : pe(r);
4210
+ return this.recordTiming(String(a), i), this.log("error", `Failed ${a}`, {
4211
+ step: String(a),
4212
+ duration: Math.round(i),
4213
+ errorCode: c.code,
4214
+ errorMessage: c.message
4215
+ }), this.handleFailure(r);
4216
+ } finally {
4217
+ this.setLoading(!1);
4218
+ }
4219
+ }
4220
+ // ─────────────────────────────────────────────────────────────────────────
4221
+ // Event Handlers
4222
+ // ─────────────────────────────────────────────────────────────────────────
4223
+ /**
4224
+ * Register an event handler
4225
+ *
4226
+ * @param event - Event to listen for
4227
+ * @param handler - Handler function
4228
+ * @returns Unsubscribe function
4229
+ */
4230
+ on(e, t) {
4231
+ return this.eventEmitter.on(e, t);
4232
+ }
4233
+ // ─────────────────────────────────────────────────────────────────────────
4234
+ // Event Emission
4235
+ // ─────────────────────────────────────────────────────────────────────────
4236
+ /** Emit a progress update */
4237
+ emitProgress(e) {
4238
+ this.eventEmitter.emit("progress", e);
4239
+ }
4240
+ /** Emit a status change */
4241
+ emitStatusChange(e) {
4242
+ this.eventEmitter.emit("status-change", e);
4243
+ }
4244
+ /** Emit completion event */
4245
+ emitCompleted() {
4246
+ this.eventEmitter.emit("completed");
4247
+ }
4248
+ /** Emit failed event */
4249
+ emitFailed() {
4250
+ this.eventEmitter.emit("failed");
4251
+ }
4252
+ /** Emit error event */
4253
+ emitError(e) {
4254
+ this.eventEmitter.emit("error", e);
4255
+ }
4256
+ /** Emit loading state change */
4257
+ emitLoading(e) {
4258
+ this.eventEmitter.emit("loading", e);
4259
+ }
4260
+ /** Clear all event listeners */
4261
+ clearListeners() {
4262
+ this.eventEmitter.clear();
4263
+ }
4264
+ }
4265
+ function zt(n) {
4266
+ if (!n || typeof n != "string")
4267
+ return !1;
4268
+ if (n.startsWith("bc1") || n.startsWith("tb1"))
4269
+ try {
4270
+ return me.address.fromBech32(n), !0;
4271
+ } catch {
4272
+ return !1;
4273
+ }
4274
+ try {
4275
+ return me.address.fromBase58Check(n), !0;
4276
+ } catch {
4277
+ return !1;
4278
+ }
4279
+ }
4280
+ function qt(n) {
4281
+ const e = /^[1-9A-HJ-NP-Za-km-z]+$/;
4282
+ if (!n || typeof n != "string" || !e.test(n) || n.length < 32 || n.length > 44)
4283
+ return !1;
4284
+ try {
4285
+ return Wt(n).length === 32;
4286
+ } catch {
4287
+ return !1;
4288
+ }
4289
+ }
4290
+ function Wt(n) {
4291
+ const e = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz", t = {};
4292
+ for (let u = 0; u < e.length; u++)
4293
+ t[e[u]] = u;
4294
+ if (n.length === 0)
4295
+ return new Uint8Array(0);
4296
+ let s = 0;
4297
+ for (let u = 0; u < n.length && n[u] === "1"; u++)
4298
+ s++;
4299
+ const a = Math.ceil(n.length * Math.log(58) / Math.log(256)), r = new Uint8Array(a);
4300
+ for (let u = s; u < n.length; u++) {
4301
+ const h = t[n[u]];
4302
+ if (h === void 0)
4303
+ throw new Error(`Invalid base58 character: ${n[u]}`);
4304
+ let A = h;
4305
+ for (let w = a - 1; w >= 0; w--)
4306
+ A += 58 * r[w], r[w] = A % 256, A = Math.floor(A / 256);
4307
+ }
4308
+ let i = 0;
4309
+ for (; i < r.length && r[i] === 0; )
4310
+ i++;
4311
+ const c = new Uint8Array(s + (r.length - i));
4312
+ return c.fill(0, 0, s), c.set(r.subarray(i), s), c;
4313
+ }
4314
+ function Ze(n) {
4315
+ const e = L({ message: "Amount is required" }).min(1, "Amount is required").refine((t) => t !== "0", {
4316
+ message: "Amount must be greater than 0"
4317
+ }).refine(
4318
+ (t) => {
4319
+ const s = Number.parseFloat(t);
4320
+ return !Number.isNaN(s) && s > 0;
4321
+ },
4322
+ { message: "Invalid amount format" }
4323
+ );
4324
+ return n !== void 0 && n > 0 ? e.refine(
4325
+ (t) => Number.parseFloat(t) >= n,
4326
+ { message: `Amount must be at least ${n}` }
4327
+ ) : e;
4328
+ }
4329
+ const Kt = Ze(), Gt = Ze(Xe), Dn = Kt;
4330
+ jt([$t(), Zt()]).refine((n) => n > 0, { message: "Amount must be greater than 0" });
4331
+ const Pn = L({ message: "Address is required" }).regex(/^0x[a-fA-F0-9]{40}$/, "Invalid EVM address format"), Bn = L({ message: "Address is required" }).refine(qt, { message: "Invalid Solana address format" }), Mn = L({ message: "Address is required" }).regex(/^0x[a-fA-F0-9]{64}$/, "Invalid Sui address format"), Un = L({ message: "Address is required" }).regex(/^0x[a-fA-F0-9]{1,64}$/, "Invalid Starknet address format"), Vn = L({ message: "Address is required" }).refine(zt, { message: "Invalid Bitcoin address format" }), Yt = L().optional();
4332
+ L().regex(/^0x[a-fA-F0-9]{64}$/, "Invalid transaction hash");
4333
+ Ft({
4334
+ amount: Gt,
4335
+ recipient: L({ message: "Recipient is required" }).min(1, "Recipient is required"),
4336
+ referralCode: Yt
4337
+ });
4338
+ function Zn(n, e, t = {}) {
4339
+ const s = n.safeParse(e);
4340
+ if (!s.success) {
4341
+ const a = s.error.issues[0], r = a == null ? void 0 : a.path[0], i = (a == null ? void 0 : a.message) ?? "Invalid parameter";
4342
+ throw r === "amount" ? E.invalidAmount(i) : r === "recipient" ? E.invalidAddress(
4343
+ e == null ? void 0 : e.recipient,
4344
+ t.destChain
4345
+ ) : E.invalidParameter(String(r), i);
4346
+ }
4347
+ return s.data;
4348
+ }
4349
+ const $n = {
4350
+ /** Initial state - ready for prepare() */
4351
+ IDLE: "idle",
4352
+ // Authorization states (mutually exclusive - action uses one based on config)
4353
+ /** User needs to sign fee authorization (EVM stake/deposit to Ethereum) */
4354
+ NEEDS_FEE_AUTHORIZATION: "needs_fee_authorization",
4355
+ /** User needs to confirm destination address (non-Ethereum destinations) */
4356
+ NEEDS_ADDRESS_CONFIRMATION: "needs_address_confirmation",
4357
+ /** User needs to sign vault deploy authorization (stake-and-deploy, deposit-and-deploy) */
4358
+ NEEDS_DEPLOY_AUTHORIZATION: "needs_deploy_authorization",
4359
+ /** Authorization complete - ready to generate address */
4360
+ READY: "ready",
4361
+ /** Deposit address generated - awaiting BTC deposit */
4362
+ ADDRESS_READY: "address_ready"
4363
+ }, Fn = {
4364
+ IDLE: "idle",
4365
+ /** User needs to sign fee authorization (Ethereum/Sepolia only) */
4366
+ NEEDS_FEE_AUTHORIZATION: "needs_fee_authorization",
4367
+ /** User needs to approve token spending */
4368
+ NEEDS_APPROVAL: "needs-approval",
4369
+ READY: "ready",
4370
+ CONFIRMING: "confirming",
4371
+ COMPLETED: "completed"
4372
+ }, jn = {
4373
+ IDLE: "idle",
4374
+ READY: "ready",
4375
+ CONFIRMING: "confirming",
4376
+ COMPLETED: "completed"
4377
+ };
4378
+ export {
4379
+ In as $,
4380
+ Ft as A,
4381
+ $n as B,
4382
+ o as C,
4383
+ Kt as D,
4384
+ Fn as E,
4385
+ ft as F,
4386
+ De as G,
4387
+ S as H,
4388
+ pn as I,
4389
+ Sn as J,
4390
+ vn as K,
4391
+ E as L,
4392
+ gn as M,
4393
+ jn as N,
4394
+ yn as O,
4395
+ lt as P,
4396
+ _n as Q,
4397
+ nt as R,
4398
+ nn as S,
4399
+ Tn as T,
4400
+ bn as U,
4401
+ Z as V,
4402
+ xn as W,
4403
+ fn as X,
4404
+ L as Y,
4405
+ Dn as Z,
4406
+ Pn as _,
4407
+ sn as a,
4408
+ kn as a0,
4409
+ at as a1,
4410
+ wn as a2,
4411
+ Yt as a3,
4412
+ Gt as a4,
4413
+ fe as a5,
4414
+ p as a6,
4415
+ Bn as a7,
4416
+ Un as a8,
4417
+ Mn as a9,
4418
+ dn as aa,
4419
+ Cn as ab,
4420
+ Qe as b,
4421
+ G as c,
4422
+ an as d,
4423
+ hn as e,
4424
+ mn as f,
4425
+ Nn as g,
4426
+ En as h,
4427
+ ie as i,
4428
+ cn as j,
4429
+ on as k,
4430
+ An as l,
4431
+ rn as m,
4432
+ Le as n,
4433
+ ln as o,
4434
+ un as p,
4435
+ Rn as q,
4436
+ On as r,
4437
+ st as s,
4438
+ et as t,
4439
+ rt as u,
4440
+ tt as v,
4441
+ pe as w,
4442
+ Vn as x,
4443
+ Ln as y,
4444
+ Zn as z
4445
+ };
4446
+ //# sourceMappingURL=statusConstants-ZJia15m2.js.map