wapi-client 0.12.5-beta.3 → 0.12.5-beta.6

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 (321) hide show
  1. package/dist/api/http-client.browser.cjs +2 -2
  2. package/dist/api/http-client.browser.js +2 -2
  3. package/dist/api/ws-client.browser.cjs +1 -1
  4. package/dist/api/ws-client.browser.js +1 -1
  5. package/dist/client-options.schema.zod.browser.cjs +1 -1
  6. package/dist/client-options.schema.zod.browser.js +1 -1
  7. package/dist/client.browser.cjs +12 -36
  8. package/dist/client.browser.js +12 -36
  9. package/dist/client.cjs +12 -36
  10. package/dist/client.d.ts +49 -59
  11. package/dist/client.js +12 -36
  12. package/dist/db/consts.browser.cjs +1 -1
  13. package/dist/db/consts.browser.js +1 -1
  14. package/dist/db/index.d.ts +5 -0
  15. package/dist/db/token/token.schema.zod.browser.cjs +1 -1
  16. package/dist/db/token/token.schema.zod.browser.js +1 -1
  17. package/dist/db/transfer/transfer.schema.zod.browser.cjs +1 -1
  18. package/dist/db/transfer/transfer.schema.zod.browser.js +1 -1
  19. package/dist/db/transfer-group/transfer-group.schema.zod.browser.cjs +7 -9
  20. package/dist/db/transfer-group/transfer-group.schema.zod.browser.js +7 -9
  21. package/dist/db/transfer-group/transfer-group.schema.zod.cjs +6 -8
  22. package/dist/db/transfer-group/transfer-group.schema.zod.js +6 -8
  23. package/dist/db/transfer-log/transfer-log.schema.zod.browser.cjs +2 -2
  24. package/dist/db/transfer-log/transfer-log.schema.zod.browser.js +2 -2
  25. package/dist/db/transfer-log/transfer-log.schema.zod.cjs +1 -1
  26. package/dist/db/transfer-log/transfer-log.schema.zod.js +1 -1
  27. package/dist/db/wallet/wallet.schema.zod.browser.cjs +1 -1
  28. package/dist/db/wallet/wallet.schema.zod.browser.js +1 -1
  29. package/dist/db/wallet-token-setting/wallet-token-setting.schema.zod.browser.cjs +1 -1
  30. package/dist/db/wallet-token-setting/wallet-token-setting.schema.zod.browser.js +1 -1
  31. package/dist/db/wapi-setting/wapi-setting.schema.zod.browser.cjs +1 -1
  32. package/dist/db/wapi-setting/wapi-setting.schema.zod.browser.js +1 -1
  33. package/dist/db/wapi-statistic/wapi-statistic.schema.zod.browser.cjs +1 -1
  34. package/dist/db/wapi-statistic/wapi-statistic.schema.zod.browser.js +1 -1
  35. package/dist/fns/aggregate-transfers/aggregate-transfers.d.ts +9 -10
  36. package/dist/fns/aggregate-transfers/aggregate-transfers.schema.zod.browser.cjs +1 -1
  37. package/dist/fns/aggregate-transfers/aggregate-transfers.schema.zod.browser.js +1 -1
  38. package/dist/fns/aggregate-transfers/aggregate-transfers.schema.zod.d.ts +9 -9
  39. package/dist/fns/consts.browser.cjs +1 -1
  40. package/dist/fns/consts.browser.js +1 -1
  41. package/dist/fns/consts.d.ts +4 -4
  42. package/dist/fns/create-access-token/create-access-token.schema.zod.browser.cjs +1 -1
  43. package/dist/fns/create-access-token/create-access-token.schema.zod.browser.js +1 -1
  44. package/dist/fns/create-access-token/create-access-token.schema.zod.d.ts +6 -8
  45. package/dist/fns/create-contract/create-contract.schema.zod.browser.cjs +1 -1
  46. package/dist/fns/create-contract/create-contract.schema.zod.browser.js +1 -1
  47. package/dist/fns/create-contract/create-contract.schema.zod.d.ts +15 -15
  48. package/dist/fns/create-deposit/create-deposit.schema.zod.browser.cjs +1 -1
  49. package/dist/fns/create-deposit/create-deposit.schema.zod.browser.js +1 -1
  50. package/dist/fns/create-deposit/create-deposit.schema.zod.d.ts +6 -6
  51. package/dist/fns/create-exchange/create-exchange.schema.zod.browser.cjs +1 -1
  52. package/dist/fns/create-exchange/create-exchange.schema.zod.browser.js +1 -1
  53. package/dist/fns/create-exchange/create-exchange.schema.zod.d.ts +11 -11
  54. package/dist/fns/create-token/create-token.schema.zod.d.ts +3 -3
  55. package/dist/fns/create-transfer/create-transfer.schema.zod.browser.cjs +1 -1
  56. package/dist/fns/create-transfer/create-transfer.schema.zod.browser.js +1 -1
  57. package/dist/fns/create-transfer/create-transfer.schema.zod.d.ts +3 -3
  58. package/dist/fns/create-transfer-group/create-transfer-group.schema.zod.browser.cjs +1 -1
  59. package/dist/fns/create-transfer-group/create-transfer-group.schema.zod.browser.js +1 -1
  60. package/dist/fns/create-transfer-group/create-transfer-group.schema.zod.d.ts +11 -11
  61. package/dist/fns/create-transfers/create-transfers.schema.zod.browser.cjs +1 -1
  62. package/dist/fns/create-transfers/create-transfers.schema.zod.browser.js +1 -1
  63. package/dist/fns/create-transfers/create-transfers.schema.zod.d.ts +3 -3
  64. package/dist/fns/create-wallet/create-wallet.schema.zod.d.ts +3 -3
  65. package/dist/fns/create-withdrawal/create-withdrawal.schema.zod.browser.cjs +1 -1
  66. package/dist/fns/create-withdrawal/create-withdrawal.schema.zod.browser.js +1 -1
  67. package/dist/fns/create-withdrawal/create-withdrawal.schema.zod.d.ts +6 -6
  68. package/dist/fns/export-balance-history/export-balance-history.schema.zod.browser.cjs +1 -1
  69. package/dist/fns/export-balance-history/export-balance-history.schema.zod.browser.js +1 -1
  70. package/dist/fns/export-balance-history/export-balance-history.schema.zod.d.ts +3 -3
  71. package/dist/fns/export-tokens/export-tokens.d.ts +3 -4
  72. package/dist/fns/export-tokens/export-tokens.schema.zod.d.ts +9 -11
  73. package/dist/fns/export-transfer-groups/export-transfer-groups.d.ts +3 -4
  74. package/dist/fns/export-transfer-groups/export-transfer-groups.schema.zod.d.ts +9 -11
  75. package/dist/fns/export-transfers/export-transfers.d.ts +3 -4
  76. package/dist/fns/export-transfers/export-transfers.schema.zod.d.ts +9 -11
  77. package/dist/fns/export-wallets/export-wallets.d.ts +3 -4
  78. package/dist/fns/export-wallets/export-wallets.schema.zod.d.ts +9 -11
  79. package/dist/fns/find-balances/find-balances.d.ts +3 -4
  80. package/dist/fns/find-balances/find-balances.schema.zod.browser.cjs +1 -1
  81. package/dist/fns/find-balances/find-balances.schema.zod.browser.js +1 -1
  82. package/dist/fns/find-balances/find-balances.schema.zod.d.ts +9 -11
  83. package/dist/fns/find-tokens/find-tokens.d.ts +3 -4
  84. package/dist/fns/find-tokens/find-tokens.schema.zod.browser.cjs +1 -1
  85. package/dist/fns/find-tokens/find-tokens.schema.zod.browser.js +1 -1
  86. package/dist/fns/find-tokens/find-tokens.schema.zod.d.ts +9 -11
  87. package/dist/fns/find-transfer-groups/find-transfer-groups.d.ts +3 -4
  88. package/dist/fns/find-transfer-groups/find-transfer-groups.schema.zod.browser.cjs +1 -1
  89. package/dist/fns/find-transfer-groups/find-transfer-groups.schema.zod.browser.js +1 -1
  90. package/dist/fns/find-transfer-groups/find-transfer-groups.schema.zod.d.ts +9 -11
  91. package/dist/fns/find-transfers/find-transfers.d.ts +3 -4
  92. package/dist/fns/find-transfers/find-transfers.schema.zod.browser.cjs +1 -1
  93. package/dist/fns/find-transfers/find-transfers.schema.zod.browser.js +1 -1
  94. package/dist/fns/find-transfers/find-transfers.schema.zod.d.ts +16 -18
  95. package/dist/fns/find-wallets/find-wallets.d.ts +3 -4
  96. package/dist/fns/find-wallets/find-wallets.schema.zod.browser.cjs +1 -1
  97. package/dist/fns/find-wallets/find-wallets.schema.zod.browser.js +1 -1
  98. package/dist/fns/find-wallets/find-wallets.schema.zod.d.ts +9 -11
  99. package/dist/fns/get-balance/get-balance.schema.zod.browser.cjs +1 -1
  100. package/dist/fns/get-balance/get-balance.schema.zod.browser.js +1 -1
  101. package/dist/fns/get-balance/get-balance.schema.zod.d.ts +3 -3
  102. package/dist/fns/get-balance-history/get-balance-history.schema.zod.browser.cjs +1 -1
  103. package/dist/fns/get-balance-history/get-balance-history.schema.zod.browser.js +1 -1
  104. package/dist/fns/get-balance-history/get-balance-history.schema.zod.d.ts +3 -3
  105. package/dist/fns/get-export/get-export.schema.zod.browser.cjs +1 -1
  106. package/dist/fns/get-export/get-export.schema.zod.browser.js +1 -1
  107. package/dist/fns/get-export/get-export.schema.zod.d.ts +3 -3
  108. package/dist/fns/get-flags/get-flags.schema.zod.browser.cjs +1 -1
  109. package/dist/fns/get-flags/get-flags.schema.zod.browser.js +1 -1
  110. package/dist/fns/get-statistics/get-statistics.schema.zod.browser.cjs +1 -1
  111. package/dist/fns/get-statistics/get-statistics.schema.zod.browser.js +1 -1
  112. package/dist/fns/get-token/get-token.schema.zod.browser.cjs +1 -1
  113. package/dist/fns/get-token/get-token.schema.zod.browser.js +1 -1
  114. package/dist/fns/get-token/get-token.schema.zod.d.ts +3 -3
  115. package/dist/fns/get-transfer/get-transfer.schema.zod.browser.cjs +1 -1
  116. package/dist/fns/get-transfer/get-transfer.schema.zod.browser.js +1 -1
  117. package/dist/fns/get-transfer/get-transfer.schema.zod.d.ts +6 -6
  118. package/dist/fns/get-transfer-group/get-transfer-group.schema.zod.browser.cjs +1 -1
  119. package/dist/fns/get-transfer-group/get-transfer-group.schema.zod.browser.js +1 -1
  120. package/dist/fns/get-transfer-group/get-transfer-group.schema.zod.d.ts +3 -3
  121. package/dist/fns/get-wallet/get-wallet.schema.zod.browser.cjs +1 -1
  122. package/dist/fns/get-wallet/get-wallet.schema.zod.browser.js +1 -1
  123. package/dist/fns/get-wallet/get-wallet.schema.zod.d.ts +3 -3
  124. package/dist/fns/healthcheck/healthcheck.schema.zod.browser.cjs +1 -1
  125. package/dist/fns/healthcheck/healthcheck.schema.zod.browser.js +1 -1
  126. package/dist/fns/index.d.ts +143 -154
  127. package/dist/fns/list-exports/list-exports.schema.zod.browser.cjs +1 -1
  128. package/dist/fns/list-exports/list-exports.schema.zod.browser.js +1 -1
  129. package/dist/fns/list-exports/list-exports.schema.zod.d.ts +9 -11
  130. package/dist/fns/reverse-transfer/reverse-transfer.schema.zod.browser.cjs +1 -1
  131. package/dist/fns/reverse-transfer/reverse-transfer.schema.zod.browser.js +1 -1
  132. package/dist/fns/reverse-transfer/reverse-transfer.schema.zod.d.ts +6 -6
  133. package/dist/fns/reverse-transfer-group/reverse-transfer-group.schema.zod.browser.cjs +1 -1
  134. package/dist/fns/reverse-transfer-group/reverse-transfer-group.schema.zod.browser.js +1 -1
  135. package/dist/fns/reverse-transfer-group/reverse-transfer-group.schema.zod.d.ts +6 -6
  136. package/dist/fns/reverse-transfers/reverse-transfers.d.ts +2 -2
  137. package/dist/fns/reverse-transfers/reverse-transfers.schema.zod.d.ts +11 -11
  138. package/dist/fns/set-flags/set-flags.schema.zod.d.ts +3 -3
  139. package/dist/fns/update-token/update-token.schema.zod.browser.cjs +1 -1
  140. package/dist/fns/update-token/update-token.schema.zod.browser.js +1 -1
  141. package/dist/fns/update-token/update-token.schema.zod.d.ts +9 -9
  142. package/dist/fns/update-transfer/update-transfer.schema.zod.browser.cjs +1 -1
  143. package/dist/fns/update-transfer/update-transfer.schema.zod.browser.js +1 -1
  144. package/dist/fns/update-transfer/update-transfer.schema.zod.d.ts +6 -6
  145. package/dist/fns/update-transfer-group/update-transfer-group.schema.zod.browser.cjs +1 -1
  146. package/dist/fns/update-transfer-group/update-transfer-group.schema.zod.browser.js +1 -1
  147. package/dist/fns/update-transfer-group/update-transfer-group.schema.zod.d.ts +6 -6
  148. package/dist/fns/update-transfer-groups/update-transfer-groups.d.ts +5 -5
  149. package/dist/fns/update-transfer-groups/update-transfer-groups.schema.zod.browser.cjs +1 -1
  150. package/dist/fns/update-transfer-groups/update-transfer-groups.schema.zod.browser.js +1 -1
  151. package/dist/fns/update-transfer-groups/update-transfer-groups.schema.zod.d.ts +24 -24
  152. package/dist/fns/update-transfers/update-transfers.d.ts +3 -3
  153. package/dist/fns/update-transfers/update-transfers.schema.zod.browser.cjs +1 -1
  154. package/dist/fns/update-transfers/update-transfers.schema.zod.browser.js +1 -1
  155. package/dist/fns/update-transfers/update-transfers.schema.zod.d.ts +18 -18
  156. package/dist/fns/update-wallet/update-wallet.schema.zod.browser.cjs +1 -1
  157. package/dist/fns/update-wallet/update-wallet.schema.zod.browser.js +1 -1
  158. package/dist/fns/update-wallet/update-wallet.schema.zod.d.ts +3 -3
  159. package/dist/lib/env.browser.cjs +1 -1
  160. package/dist/lib/env.browser.js +1 -1
  161. package/dist/lib/env.cjs +1 -1
  162. package/dist/lib/env.js +1 -1
  163. package/dist/lib/query-builder/aggregate-query-builder.d.ts +6 -6
  164. package/dist/lib/query-builder/find-query-builder.d.ts +9 -12
  165. package/dist/lib/query-builder/query-builder.d.ts +6 -6
  166. package/dist/lib/query-builder/reverse-query-builder.d.ts +6 -6
  167. package/dist/lib/query-builder/update-query-builder.d.ts +6 -6
  168. package/dist/lib/utils.browser.cjs +4 -4
  169. package/dist/lib/utils.browser.js +4 -4
  170. package/dist/lib/utils.cjs +4 -4
  171. package/dist/lib/utils.js +4 -4
  172. package/dist/txs/aggregate-transfer-many/aggregate-transfer-many.schema.zod.browser.cjs +2 -2
  173. package/dist/txs/aggregate-transfer-many/aggregate-transfer-many.schema.zod.browser.js +2 -2
  174. package/dist/txs/aggregate-transfer-many/aggregate-transfer-many.schema.zod.cjs +1 -1
  175. package/dist/txs/aggregate-transfer-many/aggregate-transfer-many.schema.zod.d.ts +15 -17
  176. package/dist/txs/aggregate-transfer-many/aggregate-transfer-many.schema.zod.js +1 -1
  177. package/dist/txs/authentication-check/authentication-check.schema.zod.browser.cjs +1 -1
  178. package/dist/txs/authentication-check/authentication-check.schema.zod.browser.js +1 -1
  179. package/dist/txs/consts.browser.cjs +1 -1
  180. package/dist/txs/consts.browser.js +1 -1
  181. package/dist/txs/consts.d.ts +14 -19
  182. package/dist/txs/create-access-token/create-access-token.schema.zod.browser.cjs +1 -1
  183. package/dist/txs/create-access-token/create-access-token.schema.zod.browser.js +1 -1
  184. package/dist/txs/create-contract/create-contract.schema.zod.browser.cjs +1 -1
  185. package/dist/txs/create-contract/create-contract.schema.zod.browser.js +1 -1
  186. package/dist/txs/create-contract/create-contract.schema.zod.d.ts +12 -12
  187. package/dist/txs/create-deposit/create-deposit.schema.zod.browser.cjs +1 -1
  188. package/dist/txs/create-deposit/create-deposit.schema.zod.browser.js +1 -1
  189. package/dist/txs/create-deposit/create-deposit.schema.zod.d.ts +6 -7
  190. package/dist/txs/create-distribution/create-distribution.schema.zod.browser.cjs +1 -1
  191. package/dist/txs/create-distribution/create-distribution.schema.zod.browser.js +1 -1
  192. package/dist/txs/create-distribution/create-distribution.schema.zod.d.ts +3 -3
  193. package/dist/txs/create-token/create-token.schema.zod.browser.cjs +1 -1
  194. package/dist/txs/create-token/create-token.schema.zod.browser.js +1 -1
  195. package/dist/txs/create-transfer/create-transfer.schema.zod.browser.cjs +1 -1
  196. package/dist/txs/create-transfer/create-transfer.schema.zod.browser.js +1 -1
  197. package/dist/txs/create-transfer/create-transfer.schema.zod.d.ts +3 -3
  198. package/dist/txs/create-transfer-group/create-transfer-group.schema.zod.browser.cjs +1 -3
  199. package/dist/txs/create-transfer-group/create-transfer-group.schema.zod.browser.js +1 -3
  200. package/dist/txs/create-transfer-group/create-transfer-group.schema.zod.cjs +0 -2
  201. package/dist/txs/create-transfer-group/create-transfer-group.schema.zod.d.ts +8 -8
  202. package/dist/txs/create-transfer-group/create-transfer-group.schema.zod.js +0 -2
  203. package/dist/txs/create-transfer-many/create-transfer-many.schema.zod.browser.cjs +1 -1
  204. package/dist/txs/create-transfer-many/create-transfer-many.schema.zod.browser.js +1 -1
  205. package/dist/txs/create-transfer-many/create-transfer-many.schema.zod.d.ts +3 -3
  206. package/dist/txs/create-wallet/create-wallet.schema.zod.browser.cjs +1 -1
  207. package/dist/txs/create-wallet/create-wallet.schema.zod.browser.js +1 -1
  208. package/dist/txs/create-withdrawal/create-withdrawal.schema.zod.browser.cjs +1 -1
  209. package/dist/txs/create-withdrawal/create-withdrawal.schema.zod.browser.js +1 -1
  210. package/dist/txs/create-withdrawal/create-withdrawal.schema.zod.d.ts +6 -7
  211. package/dist/txs/export-balance-history/export-balance-history.schema.zod.browser.cjs +1 -1
  212. package/dist/txs/export-balance-history/export-balance-history.schema.zod.browser.js +1 -1
  213. package/dist/txs/export-token-many/export-token-many.schema.zod.d.ts +9 -64
  214. package/dist/txs/export-transfer-group-many/export-transfer-group-many.schema.zod.d.ts +6 -8
  215. package/dist/txs/export-transfer-many/export-transfer-many.schema.zod.d.ts +9 -127
  216. package/dist/txs/export-wallet-many/export-wallet-many.schema.zod.d.ts +8 -93
  217. package/dist/txs/find-balance-many/find-balance-many.schema.zod.browser.cjs +1 -1
  218. package/dist/txs/find-balance-many/find-balance-many.schema.zod.browser.js +1 -1
  219. package/dist/txs/find-balance-many/find-balance-many.schema.zod.d.ts +6 -8
  220. package/dist/txs/find-token-many/find-token-many.schema.zod.browser.cjs +1 -1
  221. package/dist/txs/find-token-many/find-token-many.schema.zod.browser.js +1 -1
  222. package/dist/txs/find-token-many/find-token-many.schema.zod.d.ts +6 -8
  223. package/dist/txs/find-transfer-group-many/find-transfer-group-many.schema.zod.browser.cjs +1 -1
  224. package/dist/txs/find-transfer-group-many/find-transfer-group-many.schema.zod.browser.js +1 -1
  225. package/dist/txs/find-transfer-group-many/find-transfer-group-many.schema.zod.d.ts +9 -11
  226. package/dist/txs/find-transfer-many/find-transfer-many.schema.zod.browser.cjs +1 -1
  227. package/dist/txs/find-transfer-many/find-transfer-many.schema.zod.browser.js +1 -1
  228. package/dist/txs/find-transfer-many/find-transfer-many.schema.zod.d.ts +13 -15
  229. package/dist/txs/find-wallet-many/find-wallet-many.schema.zod.browser.cjs +1 -1
  230. package/dist/txs/find-wallet-many/find-wallet-many.schema.zod.browser.js +1 -1
  231. package/dist/txs/find-wallet-many/find-wallet-many.schema.zod.d.ts +6 -8
  232. package/dist/txs/finish-transaction/finish-transaction.schema.zod.browser.cjs +1 -1
  233. package/dist/txs/finish-transaction/finish-transaction.schema.zod.browser.js +1 -1
  234. package/dist/txs/get-balance/get-balance.schema.zod.browser.cjs +1 -1
  235. package/dist/txs/get-balance/get-balance.schema.zod.browser.js +1 -1
  236. package/dist/txs/get-balance-history/get-balance-history.schema.zod.browser.cjs +1 -1
  237. package/dist/txs/get-balance-history/get-balance-history.schema.zod.browser.js +1 -1
  238. package/dist/txs/get-export/get-export.schema.zod.browser.cjs +1 -1
  239. package/dist/txs/get-export/get-export.schema.zod.browser.js +1 -1
  240. package/dist/txs/get-flags/get-flags.schema.zod.browser.cjs +1 -1
  241. package/dist/txs/get-flags/get-flags.schema.zod.browser.js +1 -1
  242. package/dist/txs/get-statistics/get-statistics.schema.zod.browser.cjs +1 -1
  243. package/dist/txs/get-statistics/get-statistics.schema.zod.browser.js +1 -1
  244. package/dist/txs/get-statistics/get-statistics.schema.zod.d.ts +9 -12
  245. package/dist/txs/get-token/get-token.schema.zod.browser.cjs +1 -1
  246. package/dist/txs/get-token/get-token.schema.zod.browser.js +1 -1
  247. package/dist/txs/get-token/get-token.schema.zod.d.ts +3 -3
  248. package/dist/txs/get-token-many/get-token-many.schema.zod.browser.cjs +1 -1
  249. package/dist/txs/get-token-many/get-token-many.schema.zod.browser.js +1 -1
  250. package/dist/txs/get-transfer/get-transfer.schema.zod.browser.cjs +1 -1
  251. package/dist/txs/get-transfer/get-transfer.schema.zod.browser.js +1 -1
  252. package/dist/txs/get-transfer/get-transfer.schema.zod.d.ts +16 -18
  253. package/dist/txs/get-transfer-group/get-transfer-group.schema.zod.browser.cjs +1 -1
  254. package/dist/txs/get-transfer-group/get-transfer-group.schema.zod.browser.js +1 -1
  255. package/dist/txs/get-wallet/get-wallet.schema.zod.browser.cjs +1 -1
  256. package/dist/txs/get-wallet/get-wallet.schema.zod.browser.js +1 -1
  257. package/dist/txs/get-wallet/get-wallet.schema.zod.d.ts +3 -3
  258. package/dist/txs/get-wallet-many/get-wallet-many.schema.zod.browser.cjs +1 -1
  259. package/dist/txs/get-wallet-many/get-wallet-many.schema.zod.browser.js +1 -1
  260. package/dist/txs/healthcheck/healthcheck.schema.zod.browser.cjs +1 -1
  261. package/dist/txs/healthcheck/healthcheck.schema.zod.browser.js +1 -1
  262. package/dist/txs/import-actions/import-actions.schema.zod.browser.cjs +1 -1
  263. package/dist/txs/import-actions/import-actions.schema.zod.browser.js +1 -1
  264. package/dist/txs/import-actions/import-actions.schema.zod.d.ts +12 -12
  265. package/dist/txs/list-export-many/list-export-many.schema.zod.browser.cjs +1 -1
  266. package/dist/txs/list-export-many/list-export-many.schema.zod.browser.js +1 -1
  267. package/dist/txs/list-export-many/list-export-many.schema.zod.d.ts +9 -12
  268. package/dist/txs/query-logs/query-logs.schema.zod.browser.cjs +1 -1
  269. package/dist/txs/query-logs/query-logs.schema.zod.browser.js +1 -1
  270. package/dist/txs/reset-database/reset-database.schema.zod.browser.cjs +1 -1
  271. package/dist/txs/reset-database/reset-database.schema.zod.browser.js +1 -1
  272. package/dist/txs/reverse-transfer/reverse-transfer.schema.zod.browser.cjs +1 -1
  273. package/dist/txs/reverse-transfer/reverse-transfer.schema.zod.browser.js +1 -1
  274. package/dist/txs/reverse-transfer/reverse-transfer.schema.zod.d.ts +3 -3
  275. package/dist/txs/reverse-transfer-group/reverse-transfer-group.schema.zod.browser.cjs +1 -1
  276. package/dist/txs/reverse-transfer-group/reverse-transfer-group.schema.zod.browser.js +1 -1
  277. package/dist/txs/reverse-transfer-group/reverse-transfer-group.schema.zod.d.ts +3 -3
  278. package/dist/txs/reverse-transfer-group-many/reverse-transfer-group-many.schema.zod.browser.cjs +2 -2
  279. package/dist/txs/reverse-transfer-group-many/reverse-transfer-group-many.schema.zod.browser.js +2 -2
  280. package/dist/txs/reverse-transfer-group-many/reverse-transfer-group-many.schema.zod.cjs +1 -1
  281. package/dist/txs/reverse-transfer-group-many/reverse-transfer-group-many.schema.zod.d.ts +14 -14
  282. package/dist/txs/reverse-transfer-group-many/reverse-transfer-group-many.schema.zod.js +1 -1
  283. package/dist/txs/reverse-transfer-many/reverse-transfer-many.schema.zod.browser.cjs +2 -2
  284. package/dist/txs/reverse-transfer-many/reverse-transfer-many.schema.zod.browser.js +2 -2
  285. package/dist/txs/reverse-transfer-many/reverse-transfer-many.schema.zod.cjs +1 -1
  286. package/dist/txs/reverse-transfer-many/reverse-transfer-many.schema.zod.d.ts +8 -8
  287. package/dist/txs/reverse-transfer-many/reverse-transfer-many.schema.zod.js +1 -1
  288. package/dist/txs/set-flags/set-flags.schema.zod.browser.cjs +1 -1
  289. package/dist/txs/set-flags/set-flags.schema.zod.browser.js +1 -1
  290. package/dist/txs/start-transaction/start-transaction.schema.zod.browser.cjs +1 -1
  291. package/dist/txs/start-transaction/start-transaction.schema.zod.browser.js +1 -1
  292. package/dist/txs/update-token/update-token.schema.zod.browser.cjs +1 -1
  293. package/dist/txs/update-token/update-token.schema.zod.browser.js +1 -1
  294. package/dist/txs/update-token/update-token.schema.zod.d.ts +6 -6
  295. package/dist/txs/update-transfer/update-transfer.schema.zod.browser.cjs +1 -1
  296. package/dist/txs/update-transfer/update-transfer.schema.zod.browser.js +1 -1
  297. package/dist/txs/update-transfer/update-transfer.schema.zod.d.ts +3 -3
  298. package/dist/txs/update-transfer-group/update-transfer-group.schema.zod.browser.cjs +1 -1
  299. package/dist/txs/update-transfer-group/update-transfer-group.schema.zod.browser.js +1 -1
  300. package/dist/txs/update-transfer-group/update-transfer-group.schema.zod.d.ts +3 -3
  301. package/dist/txs/update-transfer-group-many/update-transfer-group-many.schema.zod.browser.cjs +2 -2
  302. package/dist/txs/update-transfer-group-many/update-transfer-group-many.schema.zod.browser.js +2 -2
  303. package/dist/txs/update-transfer-group-many/update-transfer-group-many.schema.zod.cjs +1 -1
  304. package/dist/txs/update-transfer-group-many/update-transfer-group-many.schema.zod.d.ts +17 -17
  305. package/dist/txs/update-transfer-group-many/update-transfer-group-many.schema.zod.js +1 -1
  306. package/dist/txs/update-transfer-many/update-transfer-many.schema.zod.browser.cjs +2 -2
  307. package/dist/txs/update-transfer-many/update-transfer-many.schema.zod.browser.js +2 -2
  308. package/dist/txs/update-transfer-many/update-transfer-many.schema.zod.cjs +1 -1
  309. package/dist/txs/update-transfer-many/update-transfer-many.schema.zod.d.ts +11 -11
  310. package/dist/txs/update-transfer-many/update-transfer-many.schema.zod.js +1 -1
  311. package/dist/txs/update-wallet/update-wallet.schema.zod.browser.cjs +1 -1
  312. package/dist/txs/update-wallet/update-wallet.schema.zod.browser.js +1 -1
  313. package/dist/types/wapi-client.d.ts +854 -1192
  314. package/dist/wapi-client-web.iife.js +2 -2
  315. package/dist/wapi-client.d.ts +3 -3
  316. package/dist/wapi-client.iife.js +2 -2
  317. package/dist/wapi-client.js +3 -3
  318. package/package.json +1 -1
  319. package/dist/db/token/token.schema.input.json +0 -44
  320. package/dist/db/token/token.schema.json +0 -124
  321. package/dist/db/token/token.schema.optional.json +0 -62
@@ -1,2 +1,2 @@
1
- "use strict";var WAPI=(()=>{var il=Object.create;var na=Object.defineProperty,sl=Object.defineProperties,pl=Object.getOwnPropertyDescriptor,ul=Object.getOwnPropertyDescriptors,cl=Object.getOwnPropertyNames,Za=Object.getOwnPropertySymbols,ll=Object.getPrototypeOf,ti=Object.prototype.hasOwnProperty,Lp=Object.prototype.propertyIsEnumerable;var ei=(r,e,t)=>e in r?na(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,c=(r,e)=>{for(var t in e||(e={}))ti.call(e,t)&&ei(r,t,e[t]);if(Za)for(var t of Za(e))Lp.call(e,t)&&ei(r,t,e[t]);return r},S=(r,e)=>sl(r,ul(e));var ae=(r,e)=>{var t={};for(var a in r)ti.call(r,a)&&e.indexOf(a)<0&&(t[a]=r[a]);if(r!=null&&Za)for(var a of Za(r))e.indexOf(a)<0&&Lp.call(r,a)&&(t[a]=r[a]);return t};var dl=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),fl=(r,e)=>{for(var t in e)na(r,t,{get:e[t],enumerable:!0})},$p=(r,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of cl(e))!ti.call(r,n)&&n!==t&&na(r,n,{get:()=>e[n],enumerable:!(a=pl(e,n))||a.enumerable});return r};var ml=(r,e,t)=>(t=r!=null?il(ll(r)):{},$p(e||!r||!r.__esModule?na(t,"default",{value:r,enumerable:!0}):t,r)),hl=r=>$p(na({},"__esModule",{value:!0}),r);var b=(r,e,t)=>ei(r,typeof e!="symbol"?e+"":e,t);var X=(r,e,t)=>new Promise((a,n)=>{var i=l=>{try{u(t.next(l))}catch(d){n(d)}},s=l=>{try{u(t.throw(l))}catch(d){n(d)}},u=l=>l.done?a(l.value):Promise.resolve(l.value).then(i,s);u((t=t.apply(r,e)).next())});var Yu=dl((Ca,Gs)=>{(function(r){"use strict";function e(t){var a=t&&t.Promise||r.Promise,n=t&&t.XMLHttpRequest||r.XMLHttpRequest;return function(){var i=Object.create(r,{fetch:{value:void 0,writable:!0}});return function(s,u){typeof Ca=="object"&&typeof Gs!="undefined"?u(Ca):typeof define=="function"&&define.amd?define(["exports"],u):u(s.WHATWGFetch={})}(this,function(s){"use strict";var u=typeof i!="undefined"&&i||typeof self!="undefined"&&self||typeof u!="undefined"&&u,l={searchParams:"URLSearchParams"in u,iterable:"Symbol"in u&&"iterator"in Symbol,blob:"FileReader"in u&&"Blob"in u&&function(){try{return new Blob,!0}catch(f){return!1}}(),formData:"FormData"in u,arrayBuffer:"ArrayBuffer"in u};function d(f){return f&&DataView.prototype.isPrototypeOf(f)}if(l.arrayBuffer)var T=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],_=ArrayBuffer.isView||function(f){return f&&T.indexOf(Object.prototype.toString.call(f))>-1};function j(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(f)||f==="")throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function B(f){return typeof f!="string"&&(f=String(f)),f}function ie(f){var g={next:function(){var V=f.shift();return{done:V===void 0,value:V}}};return l.iterable&&(g[Symbol.iterator]=function(){return g}),g}function q(f){this.map={},f instanceof q?f.forEach(function(g,V){this.append(V,g)},this):Array.isArray(f)?f.forEach(function(g){this.append(g[0],g[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(g){this.append(g,f[g])},this)}q.prototype.append=function(f,g){f=j(f),g=B(g);var V=this.map[f];this.map[f]=V?V+", "+g:g},q.prototype.delete=function(f){delete this.map[j(f)]},q.prototype.get=function(f){return f=j(f),this.has(f)?this.map[f]:null},q.prototype.has=function(f){return this.map.hasOwnProperty(j(f))},q.prototype.set=function(f,g){this.map[j(f)]=B(g)},q.prototype.forEach=function(f,g){for(var V in this.map)this.map.hasOwnProperty(V)&&f.call(g,this.map[V],V,this)},q.prototype.keys=function(){var f=[];return this.forEach(function(g,V){f.push(V)}),ie(f)},q.prototype.values=function(){var f=[];return this.forEach(function(g){f.push(g)}),ie(f)},q.prototype.entries=function(){var f=[];return this.forEach(function(g,V){f.push([V,g])}),ie(f)},l.iterable&&(q.prototype[Symbol.iterator]=q.prototype.entries);function L(f){if(f.bodyUsed)return a.reject(new TypeError("Already read"));f.bodyUsed=!0}function Xt(f){return new a(function(g,V){f.onload=function(){g(f.result)},f.onerror=function(){V(f.error)}})}function aa(f){var g=new FileReader,V=Xt(g);return g.readAsArrayBuffer(f),V}function Yo(f){var g=new FileReader,V=Xt(g);return g.readAsText(f),V}function Xc(f){for(var g=new Uint8Array(f),V=new Array(g.length),re=0;re<g.length;re++)V[re]=String.fromCharCode(g[re]);return V.join("")}function Zp(f){if(f.slice)return f.slice(0);var g=new Uint8Array(f.byteLength);return g.set(new Uint8Array(f)),g.buffer}function Up(){return this.bodyUsed=!1,this._initBody=function(f){this.bodyUsed=this.bodyUsed,this._bodyInit=f,f?typeof f=="string"?this._bodyText=f:l.blob&&Blob.prototype.isPrototypeOf(f)?this._bodyBlob=f:l.formData&&FormData.prototype.isPrototypeOf(f)?this._bodyFormData=f:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(f)?this._bodyText=f.toString():l.arrayBuffer&&l.blob&&d(f)?(this._bodyArrayBuffer=Zp(f.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(f)||_(f))?this._bodyArrayBuffer=Zp(f):this._bodyText=f=Object.prototype.toString.call(f):this._bodyText="",this.headers.get("content-type")||(typeof f=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(f)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var f=L(this);if(f)return f;if(this._bodyBlob)return a.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return a.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return a.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var f=L(this);return f||(ArrayBuffer.isView(this._bodyArrayBuffer)?a.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):a.resolve(this._bodyArrayBuffer))}else return this.blob().then(aa)}),this.text=function(){var f=L(this);if(f)return f;if(this._bodyBlob)return Yo(this._bodyBlob);if(this._bodyArrayBuffer)return a.resolve(Xc(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return a.resolve(this._bodyText)},l.formData&&(this.formData=function(){return this.text().then(rl)}),this.json=function(){return this.text().then(JSON.parse)},this}var el=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function tl(f){var g=f.toUpperCase();return el.indexOf(g)>-1?g:f}function it(f,g){if(!(this instanceof it))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');g=g||{};var V=g.body;if(f instanceof it){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,g.headers||(this.headers=new q(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!V&&f._bodyInit!=null&&(V=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=g.credentials||this.credentials||"same-origin",(g.headers||!this.headers)&&(this.headers=new q(g.headers)),this.method=tl(g.method||this.method||"GET"),this.mode=g.mode||this.mode||null,this.signal=g.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&V)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(V),(this.method==="GET"||this.method==="HEAD")&&(g.cache==="no-store"||g.cache==="no-cache")){var re=/([?&])_=[^&]*/;if(re.test(this.url))this.url=this.url.replace(re,"$1_="+new Date().getTime());else{var se=/\?/;this.url+=(se.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}it.prototype.clone=function(){return new it(this,{body:this._bodyInit})};function rl(f){var g=new FormData;return f.trim().split("&").forEach(function(V){if(V){var re=V.split("="),se=re.shift().replace(/\+/g," "),K=re.join("=").replace(/\+/g," ");g.append(decodeURIComponent(se),decodeURIComponent(K))}}),g}function al(f){var g=new q,V=f.replace(/\r?\n[\t ]+/g," ");return V.split("\r").map(function(re){return re.indexOf(`
2
- `)===0?re.substr(1,re.length):re}).forEach(function(re){var se=re.split(":"),K=se.shift().trim();if(K){var Pa=se.join(":").trim();g.append(K,Pa)}}),g}Up.call(it.prototype);function Be(f,g){if(!(this instanceof Be))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');g||(g={}),this.type="default",this.status=g.status===void 0?200:g.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in g?g.statusText:"",this.headers=new q(g.headers),this.url=g.url||"",this._initBody(f)}Up.call(Be.prototype),Be.prototype.clone=function(){return new Be(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new q(this.headers),url:this.url})},Be.error=function(){var f=new Be(null,{status:0,statusText:""});return f.type="error",f};var nl=[301,302,303,307,308];Be.redirect=function(f,g){if(nl.indexOf(g)===-1)throw new RangeError("Invalid status code");return new Be(null,{status:g,headers:{location:f}})},s.DOMException=u.DOMException;try{new s.DOMException}catch(f){s.DOMException=function(g,V){this.message=g,this.name=V;var re=Error(g);this.stack=re.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function Xo(f,g){return new a(function(V,re){var se=new it(f,g);if(se.signal&&se.signal.aborted)return re(new s.DOMException("Aborted","AbortError"));var K=new n;function Pa(){K.abort()}K.onload=function(){var Ae={status:K.status,statusText:K.statusText,headers:al(K.getAllResponseHeaders()||"")};Ae.url="responseURL"in K?K.responseURL:Ae.headers.get("X-Request-URL");var Va="response"in K?K.response:K.responseText;setTimeout(function(){V(new Be(Va,Ae))},0)},K.onerror=function(){setTimeout(function(){re(new TypeError("Network request failed"))},0)},K.ontimeout=function(){setTimeout(function(){re(new TypeError("Network request failed"))},0)},K.onabort=function(){setTimeout(function(){re(new s.DOMException("Aborted","AbortError"))},0)};function ol(Ae){try{return Ae===""&&u.location.href?u.location.href:Ae}catch(Va){return Ae}}K.open(se.method,ol(se.url),!0),se.credentials==="include"?K.withCredentials=!0:se.credentials==="omit"&&(K.withCredentials=!1),"responseType"in K&&(l.blob?K.responseType="blob":l.arrayBuffer&&se.headers.get("Content-Type")&&se.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(K.responseType="arraybuffer")),g&&typeof g.headers=="object"&&!(g.headers instanceof q)?Object.getOwnPropertyNames(g.headers).forEach(function(Ae){K.setRequestHeader(Ae,B(g.headers[Ae]))}):se.headers.forEach(function(Ae,Va){K.setRequestHeader(Va,Ae)}),se.signal&&(se.signal.addEventListener("abort",Pa),K.onreadystatechange=function(){K.readyState===4&&se.signal.removeEventListener("abort",Pa)}),K.send(typeof se._bodyInit=="undefined"?null:se._bodyInit)})}Xo.polyfill=!0,u.fetch||(u.fetch=Xo,u.Headers=q,u.Request=it,u.Response=Be),s.Headers=q,s.Request=it,s.Response=Be,s.fetch=Xo,Object.defineProperty(s,"__esModule",{value:!0})}),{fetch:i.fetch,Headers:i.Headers,Request:i.Request,Response:i.Response,DOMException:i.DOMException}}()}typeof define=="function"&&define.amd?define(function(){return e}):typeof Ca=="object"?Gs.exports=e:r.fetchPonyfill=e})(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof global!="undefined"?global:Ca)});var dT={};fl(dT,{APIFunctions:()=>As,APIValidators:()=>Rs,AggregateQueryBuilder:()=>Ir,AuthError:()=>st,AuthenticationError:()=>tr,AuthorizationError:()=>ri,Client:()=>ra,ClientFunctions:()=>A,ClientFunctionsEnum:()=>$c,ClientValidators:()=>oT,ConfigError:()=>_e,ConstraintError:()=>La,ERRORS:()=>ye,ERROR_CODE_TO_TYPE:()=>zp,ERROR_DESCRIPTIONS:()=>Kp,ERROR_GROUPS:()=>te,ERROR_MESSAGES:()=>Hp,ERROR_TYPES:()=>ia,ErrorDescription:()=>Kp,ErrorMessage:()=>Hp,ErrorType:()=>ia,Errors:()=>ye,FindQueryBuilder:()=>oe,InputError:()=>J,InternalError:()=>$a,JSONRPCError:()=>er,QueryBuilder:()=>De,ReverseQueryBuilder:()=>Jr,StreamError:()=>Pe,StreamPromise:()=>pt,TokenStatusEnum:()=>Eu,TokenTypeEnum:()=>Gu,TransferGroupStatusEnum:()=>ln,TransferGroupTypeEnum:()=>Cu,TransferStatusEnum:()=>Au,TransferTypeEnum:()=>Vt,UnknownError:()=>ai,UpdateQueryBuilder:()=>bt,ValidationError:()=>ve,Validator:()=>Kc,WAPIError:()=>je,WalletStatusEnum:()=>wu,WalletTypeEnum:()=>Ru,WapiClientType:()=>Yc,WapiSettingTypeEnum:()=>Qc,aggregateTransfers:()=>Bs,create:()=>cT,createAccessToken:()=>js,createContract:()=>Ps,createDeposit:()=>Vs,createExchange:()=>Zs,createToken:()=>Us,createTransfer:()=>Ks,createTransferGroup:()=>Js,createTransfers:()=>Qs,createWallet:()=>Ys,createWithdrawal:()=>Xs,exportBalanceHistory:()=>ep,exportTokens:()=>tp,exportTransferGroups:()=>rp,exportTransfers:()=>ap,exportWallets:()=>op,findBalances:()=>pp,findTokens:()=>up,findTransferGroups:()=>cp,findTransfers:()=>lp,findWallets:()=>dp,getBalance:()=>fp,getBalanceHistory:()=>mp,getError:()=>qa,getExport:()=>hp,getFlags:()=>Tp,getIdentifier:()=>pi,getStatistics:()=>gp,getToken:()=>xp,getTransfer:()=>yp,getTransferGroup:()=>bp,getValidator:()=>p,getValidatorError:()=>au,getWallet:()=>Sp,hardValidate:()=>$e,hardValidateWOptions:()=>nu,healthcheck:()=>Op,listExports:()=>Fp,reverseTransfer:()=>Ip,reverseTransferGroup:()=>_p,reverseTransfers:()=>wp,setFlags:()=>Rp,softValidate:()=>Ja,softValidateWOptions:()=>ui,updateToken:()=>Ap,updateTransfer:()=>Mp,updateTransferGroup:()=>Ep,updateTransferGroups:()=>Wp,updateTransfers:()=>Bp,updateWallet:()=>jp,utils:()=>lT});var qp=WebSocket;var Ua="0.12.5-beta.3";function oa(r,e){let t=Tl(r);return t===void 0?e:typeof e=="number"?parseInt(t,10):t}function Tl(r){if(typeof window=="object")return window[r];if(typeof process!="undefined"&&process.versions&&process.versions.node)return process.env[r]}function R(...r){oa("WAPI_DEBUG")&&console.log(...r.map(e=>e&&typeof e=="object"?JSON.stringify(e):e))}var te={JSONRPC:{min:-32700,max:-32600,ERRORS:{PARSE_ERROR:{code:-32700,message:"Parse error",description:"Unable to parse JSON input"},INVALID_REQUEST:{code:-32600,message:"Invalid request",description:"JSON input does not match JSONRPC spec"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found",description:"Requested method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params",description:"Invalid params provided for method"},INTERNAL_SERVER_ERROR:{code:-32603,message:"Internal server error",description:"Unknown error occurred"}}},AUTH:{min:-20999,max:-2e4,ERRORS:{AUTHENTICATION_ERROR:{code:-2e4,message:"Authentication error",description:"Invalid authentication credentials"},AUTHORIZATION_ERROR:{code:-20001,message:"AUTHORIZATION_ERROR",description:"Provided credentials lack access rights"}}},STREAM:{min:-10999,max:-1e4,ERRORS:{CONNECTION_LOST:{code:-1e4,message:"CONNECTION_LOST",description:"Lost connection to server"},INPUT_STREAM_INVALID:{code:-10001,message:"INPUT_STREAM_INVALID",description:"Invalid input stream identifier provided"},INVALID_RESPONSE_STREAM_CHUNK:{code:-10002,message:"INVALID_RESPONSE_STREAM_CHUNK",description:"Received multiple chunks for non-array property"},INVALID_INPUT_STREAM_CHUNK:{code:-10003,message:"INVALID_INPUT_STREAM_CHUNK",description:"Invalid chunk sent to input stream"},INPUT_STREAM_TIMEOUT:{code:-10004,message:"INPUT_STREAM_TIMEOUT",description:"Input stream failed to finish in allotted time"},INPUT_STREAM_ERROR:{code:-10005,message:"INPUT_STREAM_ERROR",description:"Unknown error in input stream"},INPUT_STREAM_NOT_ALLOWED:{code:-10006,message:"INPUT_STREAM_NOT_ALLOWED",description:"Stream input not allowed for method"}}},INPUT:{min:-14999,max:-11e3,ERRORS:{HTTP_BODY_SIZE:{code:-11e3,message:"HTTP_BODY_SIZE",description:"Http body size can't be more than 100MB"},DATABASE_EXPORT_CONFLICT:{code:-12e3,message:"DATABASE_EXPORT_CONFLICT",description:"Database export already in progress"},DATABASE_IMPORT_CONFLICT:{code:-12001,message:"DATABASE_IMPORT_CONFLICT",description:"Database import already in progress"},DATABASE_EXPORT_PROGRESS_NOT_FOUND:{code:-12002,message:"DATABASE_EXPORT_PROGRESS_NOT_FOUND",description:"Database backup process not found"},DATABASE_IMPORT_PROGRESS_NOT_FOUND:{code:-12003,message:"DATABASE_IMPORT_PROGRESS_NOT_FOUND",description:"Database backup process not found"},DATABASE_IMPORT_NOT_FOUND:{code:-12004,message:"DATABASE_IMPORT_NOT_FOUND",description:"Database import file not found"},TR_CANT_UPDATE_TO_PENDING:{code:-12100,message:"TR_CANT_UPDATE_TO_PENDING",description:"Transfer status can only move from 'pending'->'finished'/'cancelled"},TR_CANT_UPDATE_TIMESTAMP:{code:-12101,message:"TR_CANT_UPDATE_TIMESTAMP",description:"Cant update transfer.updated_at - allow_timestamps flag is set to off"},TR_CANT_INSERT_TIMESTAMP:{code:-12102,message:"TR_CANT_INSERT_TIMESTAMP",description:"Cant insert transfer.created_at - allow_timestamps flag is set to off"},TR_EMPTY_UPDATE_REQUEST:{code:-12103,message:"TR_EMPTY_UPDATE_REQUEST",description:"Update request for transfer is empty"},TR_MISSING_FILTER:{code:-12104,message:"TR_MISSING_FILTER",description:"Transactions can't reversed or updated without valid filter"},TR_TO_WALLET_WITHDRAWAL:{code:-12105,message:"TR_TO_WALLET_WITHDRAWAL",description:"To wallet can't be specified when doing a withdrawal"},TR_FROM_WALLET_DEPOSIT:{code:-12106,message:"TR_FROM_WALLET_DEPOSIT",description:"From wallet can't be specified when doing a deposit"},TR_FROM_TO_CONFLICT:{code:-12107,message:"TR_FROM_TO_CONFLICT",description:"from_wallet and to_wallet can not be the same"},TR_UNABLE_TO_RESOLVE_INPUT:{code:-12108,message:"TR_UNABLE_TO_RESOLVE_INPUT",description:"Unable to resolve references to foreign keys"},TRG_MISSING_FILTER:{code:-12200,message:"TRG_MISSING_FILTER",description:"Transaction groups can't reversed or updated without valid filter"},INVALID_FIELD_AGR_COMB:{code:-12300,message:"INVALID_FIELD_AGR_COMB",description:"Provided aggregation field was not found on Model"},INVALID_FIELD_FOR_MODEL:{code:-12301,message:"INVALID_FIELD_FOR_MODEL",description:"Provided field was not found on Model"},NO_METADATA_ON_MODEL:{code:-12302,message:"NO_METADATA_ON_MODEL",description:"Can't use metadata field for grouping as current Model does not have metadata"},INVALID_MODEL:{code:-12303,message:"INVALID_MODEL",description:"Provided Model name is invalid"},INVALID_COMPLEX_FILTER:{code:-12304,message:"INVALID_COMPLEX_FILTER",description:"The provided complex filter does not pass validation"},UNCLEAR_AGGREGATOR:{code:-12305,message:"UNCLEAR_AGGREGATOR",description:"Invalid aggregator function provided"},CONTRACT_OWNER_NOT_FOUND:{code:-12306,message:"CONTRACT_OWNER_NOT_FOUND",description:"Unable to find Wallet specified as Contract token owner"},DISTRIBUTION_MISSING_TARGETS:{code:-12307,message:"DISTRIBUTION_MISSING_TARGETS",description:"Unable to resolve all targets (Wallets, Tokens) for distribution request"},TOKEN_INVALID_WALLET:{code:-12308,message:"TOKEN_INVALID_WALLET",description:"Invalid belongs_to wallet provided"},BAL_FUTURE_DATETIME:{code:-12309,message:"BAL_FUTURE_DATETIME",description:"Balance datetime can't be in the future"},INPUT_NEEDS_IDENTIFIER:{code:-12310,message:"INPUT_NEEDS_IDENTIFIER",description:"Missing identifier - automatically calculated identifiers conflict on identical input for 30s To make an identical transfer during that window you need to provide a unique identifier"},RESET_INVALID_CONFIRMATION:{code:-12311,message:"RESET_INVALID_CONFIRMATION",description:"Provided reset confirmation code is invalid"},INPUT_NEEDS_TOKEN:{code:-12312,message:"INPUT_NEEDS_TOKEN",description:"token must be specified on input or in client config"},CONFLICTING_OPTIONS_FOR_BALANCE:{code:-12313,message:"CONFLICTING_OPTIONS_FOR_BALANCE",description:"return_running_balance and return_running_balance_for can't be specified together"},CONFLICTING_OPTIONS_FOR_SIGNED_AMOUNT:{code:-12314,message:"CONFLICTING_OPTIONS_FOR_SIGNED_AMOUNT",description:"return_signed_amount and return_signed_amount_for_wallet can't be specified together"},RUNNING_BALANCE_WITHOUT_WALLET:{code:-12315,message:"RUNNING_BALANCE_WITHOUT_WALLET",description:"return_running_balance option requires Wallet filter to be specified"},SIGNED_AMOUNT_WITHOUT_WALLET:{code:-12316,message:"SIGNED_AMOUNT_WITHOUT_WALLET",description:"return_signed_amount option requires Wallet filter to be specified"},REQUIRED_INPUT_MISSING:{code:-12317,message:"REQUIRED_INPUT_MISSING",description:"input does not specify required keys"},TRX_NOT_ALLOWED:{code:-12400,message:"TRX_NOT_ALLOWED",description:"This method can not run in a transaction"},TRANSACTION_NOT_FOUND:{code:-12401,message:"TRANSACTION_NOT_FOUND",description:"Transaction not found"},ONLY_SELECT_ALLOWED:{code:-12402,message:"ONLY_SELECT_ALLOWED",description:"Only select queries are allowed"},CNT_DEPOSIT_TOKEN_MISMATCH:{code:-12500,message:"CNT_DEPOSIT_TOKEN_MISMATCH",description:"Unable to find tokens specified in deposits"}}},CONSTRAINT:{min:-19999,max:-19e3,ERRORS:{INVALID_LATEST_HASH:{code:-19e3,message:"INVALID_LATEST_HASH",description:"Http body size can't be more than 100MB"},TOKEN_LIMIT_REACHED:{code:-19001,message:"TOKEN_LIMIT_REACHED",description:"Unable to issue more tokens as Token.limit has been reached"},TR_INVALID_BALANCE:{code:-19101,message:"TR_INVALID_BALANCE",description:"Transfer would result in invalid balance for a Wallet"},TR_AMOUNT_NOT_DIVISIBLE:{code:-19102,message:"TR_AMOUNT_NOT_DIVISIBLE",description:"Transfer amount is not divisible by specified Token.divisor"},TR_TOKEN_DISABLED:{code:-19103,message:"TR_TOKEN_DISABLED",description:"Token status is set to 'disabled' - no new transfers allowed"},TR_TOKEN_DWONLY:{code:-19104,message:"TR_TOKEN_DWONLY",description:"Token status is set to 'dw-only' - only deposits or withdrawals allowed"},TR_TRG_STATUS_MISMATCH:{code:-19105,message:"TR_TRG_STATUS_MISMATCH",description:"Transfers in transfer_group must match transfer_group.transfer_status"},TR_TRG_CLOSED:{code:-19106,message:"TR_TRG_CLOSED",description:"Cant add Transfer to group. TransferGroup is closed"},TR_TIMESTAMP_IN_PAST:{code:-19107,message:"TR_TIMESTAMP_IN_PAST",description:"Transfer.created_at must not be in the past"},TR_TIMESTAMP_MUST_BE_LATEST:{code:-19108,message:"TR_TIMESTAMP_MUST_BE_LATEST",description:"Transfer.created_at must be the latest"},TR_INVALID_CANCELLED:{code:-19109,message:"TR_INVALID_CANCELLED",description:"Cant create cancelled transfer"},TR_FROM_WALLET_STATUS_CONSTRAINT:{code:-19110,message:"TR_FROM_WALLET_STATUS_CONSTRAINT",description:"From wallet.status doesn't allow this type of transfers"},TR_TO_WALLET_STATUS_CONSTRAINT:{code:-19111,message:"TR_TO_WALLET_STATUS_CONSTRAINT",description:"To wallet.status doesn't allow this type of transfers"},TR_CANCELLED_CANT_RV:{code:-19112,message:"TR_CANCELLED_CANT_RV",description:"Cancelled Transfer can not be reversed"},TR_DEPOSIT_CANT_RV_WITHOUT_FLAG:{code:-19113,message:"TR_DEPOSIT_CANT_RV_WITHOUT_FLAG",description:"Deposits are expected connection points with outside systems, thus extra validation is required. Reversing a Transfer.type = 'deposit' requires reverse_deposit option to be true."},TR_WITHDRAWAL_CANT_RV_WITHOUT_FLAG:{code:-19114,message:"TR_WITHDRAWAL_CANT_RV_WITHOUT_FLAG",description:"Withdrawals are expected connection points with outside systems, thus extra validation is required. Reversing a Transfer.type = 'withdrawal' requires reverse_withdrawal option to be true."},TR_UNIQUE_IDENTIFIER:{code:-19115,message:"TR_UNIQUE_IDENTIFIER",description:"The identifier for Transfer object must be unique"},TR_DIFFERENT_WALLETS:{code:-19116,message:"TR_DIFFERENT_WALLETS",description:"To and from wallets have to be different"},TRG_SINGLE_PENDING_TR_CANT_RV:{code:-19200,message:"TRG_SINGLE_PENDING_TR_CANT_RV",description:"Transfer is part of TransferGroup and can not be reversed separately"},TRG_CANCELLED_CANT_RV:{code:-19201,message:"TRG_CANCELLED_CANT_RV",description:"Cancelled TransferGroup can not be reversed"},TRG_DEPOSIT_CANT_RV_WITHOUT_FLAG:{code:-19202,message:"TRG_DEPOSIT_CANT_RV_WITHOUT_FLAG",description:"TransferGroup includes Transfer.type = 'deposit', thus for extra validation the reverse_deposit option must be set true"},TRG_WITHDRAWAL_CANT_RV_WITHOUT_FLAG:{code:-19203,message:"TRG_WITHDRAWAL_CANT_RV_WITHOUT_FLAG",description:"TransferGroup includes Transfer.type = 'withdrawal', thus for extra validation the reverse_withdrawal option must be set true"},TRG_UNIQUE_IDENTIFIER:{code:-19204,message:"TRG_UNIQUE_IDENTIFIER",description:"The identifier for TransferGroup object must be unique"},TOKEN_UNIQUE_FOREIGN:{code:-19300,message:"TOKEN_UNIQUE_FOREIGN",description:"The foreign for Token object must be unique"},WALLET_UNIQUE_FOREIGN:{code:-19400,message:"WALLET_UNIQUE_FOREIGN",description:"The foreign for Wallet object must be unique"},UNIQUE_CONSTRAINT:{code:-19500,message:"UNIQUE_CONSTRAINT",description:"Insert violates unique constraint"}}},CONFIG:{min:-16e3,max:-15e3,ERRORS:{METHOD_DISABLED:{code:-15e3,message:"METHOD_DISABLED",description:"Method is disabled"},FLAG_PRODUCTION_ON:{code:-15001,message:"FLAG_PRODUCTION_ON",description:'Production flag is "on" - this method is disabled'},FLAG_PRODUCTION_LOCKED:{code:-15002,message:"FLAG_PRODUCTION_LOCKED",description:"Cant update production flag to false in this server"},TRANSACTION_TIMEOUT:{code:-15003,message:"TRANSACTION_TIMEOUT",description:"Database transaction timed out"},CONNECTION_TIMEOUT:{code:-15004,message:"CONNECTION_TIMEOUT",description:"Unable to get initial response in specified time"},SENDING_TIMEOUT:{code:-15005,message:"SENDING_TIMEOUT",description:"Unable to get ack from server in specified time"},CONFIG_INVALID:{code:-15100,message:"CONFIG_INVALID",description:"Provided configuration is invalid"}}}},ye=c(c(c(c(c(c({},te.JSONRPC.ERRORS),te.AUTH.ERRORS),te.CONFIG.ERRORS),te.STREAM.ERRORS),te.INPUT.ERRORS),te.CONSTRAINT.ERRORS);function St(r){return Object.fromEntries(Object.keys(r).map(e=>[e,e]))}var ia=St(ye),je=class extends Error{constructor({type:t,code:a,message:n,data:i}){var u;super(n);b(this,"type");b(this,"code");b(this,"data");let s=(u=ye[t])!=null?u:ye.INTERNAL_SERVER_ERROR;this.type=t!=null?t:ia.INTERNAL_SERVER_ERROR,this.code=a!=null?a:s.code,this.message=n!=null?n:s.message,this.data=c({description:s.description},i&&typeof i=="object"?i:{error:i})}toJSON(){return{code:this.code,message:this.message,data:this.data}}},er=class extends je{constructor(e,t,a,n){super({type:e,message:a,data:t,code:n})}static get group(){return te.JSONRPC.ERRORS}static get types(){return St(te.JSONRPC.ERRORS)}},Pe=class extends je{constructor(e,t,a,n){super({type:e,message:a,data:t,code:n})}static get group(){return te.STREAM.ERRORS}static get types(){return St(te.STREAM.ERRORS)}},J=class extends je{constructor(e,t,a,n){super({type:e,message:a,data:t,code:n})}static get group(){return te.INPUT.ERRORS}static get types(){return St(te.INPUT.ERRORS)}},_e=class extends je{constructor(e,t,a,n){super({type:e,message:a,data:t,code:n})}static get group(){return te.CONFIG.ERRORS}static get types(){return St(te.CONFIG.ERRORS)}},st=class extends je{constructor(e,t,a,n){super({type:e,message:a,data:t,code:n})}static get group(){return te.AUTH.ERRORS}static get types(){return St(te.AUTH.ERRORS)}},La=class extends je{constructor(e,t,a,n){super({type:e,message:a,data:t,code:n})}static get group(){return te.CONSTRAINT.ERRORS}static get types(){return St(te.CONSTRAINT.ERRORS)}},ve=class extends er{constructor(e,t){super(er.types.INVALID_PARAMS,e,t)}},tr=class extends st{constructor(e){super(st.types.AUTHENTICATION_ERROR,e)}},ri=class extends st{constructor(e){super(st.types.AUTHORIZATION_ERROR,e)}},$a=class extends je{constructor(e){super({type:ia.INTERNAL_SERVER_ERROR,data:e})}toJSON(){return{code:this.code,message:this.message,data:{description:ye.INTERNAL_SERVER_ERROR.description}}}},ai=class extends $a{constructor(e){super({data:{message:e}})}toJSON(){let e=super.toJSON();return e.data={description:e.data.description,message:this.data.message},{code:this.code,message:this.message,data:{message:this.data.message,description:ye.INTERNAL_SERVER_ERROR.description}}}},zp=Object.fromEntries(Object.keys(ye).map(r=>[ye[r].code,r]));function gl(r){let e=zp[r];if(!e){let a=Object.entries(te).find(([,n])=>r>=n.min&&r<=n.max);return{group:a==null?void 0:a[0],type:void 0}}let t=Object.keys(te).find(a=>e in te[a].ERRORS);return t?{group:t,type:e}:(console.error("ERRORS and ERROR_GROUPS are out of sync",e),{group:void 0,type:e})}function qa({code:r,message:e,data:t}){let a=gl(r),n=a.type,i=a.group;e=e&&e!==n||!n?e:ye[n].description;let s;switch(i&&i!=="JSONRPC"&&n===void 0&&(R("Novel error from server",r,e,t),n=e,s=r,e=t&&typeof t=="object"&&"description"in t&&typeof t.description=="string"?t.description:e),i){case"JSONRPC":return new er(n,t,e);case"AUTH":return new st(n,t,e,s);case"CONFIG":return new _e(n,t,e,s);case"CONSTRAINT":return new La(n,t,e,s);case"INPUT":return new J(n,t,e,s);case"STREAM":return new Pe(n,t,e,s);default:return new je({code:r,message:e,data:t,type:n!=null?n:ia.INTERNAL_SERVER_ERROR})}}var Hp=Object.fromEntries(Object.keys(ye).map(r=>[r,ye[r].message])),Kp=Object.fromEntries(Object.keys(ye).map(r=>[r,ye[r].description]));var de=[];for(let r=0;r<256;++r)de.push((r+256).toString(16).slice(1));function Jp(r,e=0){return(de[r[e+0]]+de[r[e+1]]+de[r[e+2]]+de[r[e+3]]+"-"+de[r[e+4]]+de[r[e+5]]+"-"+de[r[e+6]]+de[r[e+7]]+"-"+de[r[e+8]]+de[r[e+9]]+"-"+de[r[e+10]]+de[r[e+11]]+de[r[e+12]]+de[r[e+13]]+de[r[e+14]]+de[r[e+15]]).toLowerCase()}var ni,xl=new Uint8Array(16);function oi(){if(!ni){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ni=crypto.getRandomValues.bind(crypto)}return ni(xl)}var yl=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ii={randomUUID:yl};function bl(r,e,t){var n,i,s;if(ii.randomUUID&&!e&&!r)return ii.randomUUID();r=r||{};let a=(s=(i=r.random)!=null?i:(n=r.rng)==null?void 0:n.call(r))!=null?s:oi();if(a.length<16)throw new Error("Random bytes length must be >= 16");if(a[6]=a[6]&15|64,a[8]=a[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let u=0;u<16;++u)e[t+u]=a[u];return e}return Jp(a)}var sa=bl;var si={timeouts:{},values:{},set(r,e){this.timeouts[r]=setTimeout(()=>this.clear(r),3e4),this.values[r]=e},get(r){return this.values[r]},getKey(r){let e=JSON.parse(JSON.stringify(r)),t="";return Object.keys(e).sort().forEach(a=>{let n="";e[a]&&typeof e[a]=="object"&&!Array.isArray(e[a])?n=this.getKey(e[a]):n=JSON.stringify(e[a]),t+=a+":"+n}),t},clear(r){this.timeouts[r]&&clearTimeout(this.timeouts[r]),delete this.timeouts[r],delete this.values[r]},clearAll(){Object.keys(this.timeouts).forEach(r=>{clearTimeout(this.timeouts[r])}),this.timeouts={},this.values={}}};function rr(r=8){return sa().replace(/-/g,"").slice(-r)}function me(r){if(!r)return sa();let e=si.getKey(r);if(si.get(e))throw new J("INPUT_NEEDS_IDENTIFIER",{object:r});let t=sa();return si.set(e,t),t}function Yp(r){return new Promise(e=>setTimeout(e,r))}function pi(){return me()}function Sl(r){return JSON.parse(JSON.stringify(r))}function Ue(r,e,t){if(e in r){if(r[e]===void 0)throw new ve({input:r},`undefined provided for ${e}`);return r}if(!t)throw new ve({input:r},`${e} is required if no default set`);let a=Sl(r);return a[e]=t,a}function C(r){let e=Xp(r);if(e!=null)return{foreign:e}}function ce(r){let e=Xp(r);if(e!=null)return{identifier:e}}function Xp(r){return r==null?r:r+""}function Ol(r){return Object.keys(r).filter(e=>r[e]!==void 0).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(r[e])}`).join("&")}function Qp(r){return r.host.replace(/^https:/,"wss:")+"?"+Ol({apikey:r.apikey,apisecret:r.apisecret,db:r.database,clientVersion:r.clientVersion,connectionName:r.connectionName})}function eu(r){return typeof window=="undefined"?[Qp(r),{rejectUnauthorized:r.rejectUnauthorized}]:[Qp(r)]}function za(r,e){let t={},a=!r||typeof r!="object"?{}:r;return Object.keys(a).forEach(n=>{e[n]?typeof e[n]=="string"?t[e[n]]=a[n]:t[n]=e[n](a[n]):t[n]=a[n]}),t}function Fl(r){return r.split(",").map(e=>e.split(" ")).map(e=>{let[t,a,n,i]=e;return c({field:t,direction:a==="desc"?"desc":"asc"},n==="nulls"&&["first","last"].includes(i)?{nulls:i}:{})})}function ee(r,e){var i;let n=r!=null?r:{},{options:t}=n;return{filter:ae(n,["options"]),options:(i=e!=null?e:t)!=null?i:{}}}function Le(r){let a=r,{order_by:e}=a,t=ae(a,["order_by"]);return!t.order&&e&&(t.order=Fl(e)),t}function tu(r){if(r!=null)return r+""}function ar(r){return typeof r=="number"?r:parseFloat(r)}function ru(r){return new Date(r).setHours(0,0,0,0)>new Date().setHours(0,0,0,0)}var pa=class{constructor(e){b(this,"_data",[]);b(this,"_error",[]);b(this,"_end",[]);b(this,"_finished",!1);b(this,"_options");this._options=e}on(e,t){switch(e){case"data":return this._data.push(t),this;case"end":return this._end.push(t),this;case"error":return this._error.push(t),this}}push(e){if(this._finished)throw new Error("Stream is closed");return e===null?this.end():(this._data.forEach(t=>t(e)),this)}error(e){if(this._finished)throw new Error("Stream is closed");return this._error.forEach(t=>t(e)),this}end(){if(this._finished)throw new Error("Stream is closed");return this._end.forEach(e=>e()),this._finished=!0,this}destroy(e){return this.error(e),this.end(),this}get destroyed(){return this._finished}},Ha=class{constructor(){throw new TypeError("used in node version")}pipe(...e){throw new TypeError("used in node version")}pause(){throw new TypeError("used in node version")}resume(){throw new TypeError("used in node version")}on(...e){throw new TypeError("used in node version")}};var pt=class{constructor(e){b(this,"resolve");b(this,"reject");b(this,"makeRequest");b(this,"streamObject",new pa({objectMode:!0}));b(this,"outStreamObject",new pa({objectMode:!0}));b(this,"mode");b(this,"started",!1);b(this,"promise");this.makeRequest=e}start(e){var s;if(R("start request as",e),this.mode&&this.mode!==e)throw new Error("Already in use as "+this.mode);if(this.started)return;let{promise:t,resolve:a,reject:n}=Promise.withResolvers();if(this.promise=t,this.resolve=a,this.reject=n,this.started=!0,this.mode=e,this.makeRequest===void 0){this.streamObject.push(null),(s=this.resolve)==null||s.call(this,void 0);return}this.makeRequest(this.streamObject).catch(this.reject);let i=[];if(this.mode==="stream"){this.streamObject.on("data",u=>{if(R("stream data",u),u||this.outStreamObject.push(u),u.error){let l=qa(u.error);return this.outStreamObject.destroy(l),this.streamObject.destroy(l)}if(!u.prop){i.push(u);return}if(u.dataArr){let l=c({},u);delete l.dataArr,u.dataArr.forEach(d=>{this.outStreamObject.push(S(c({},l),{data:d}))});return}this.outStreamObject.push(u)}).on("end",()=>{R("stream ended");let u=i.pop();if(!u)return;let l=u.result;Object.keys(l).forEach(d=>{Array.isArray(l[d])&&(l[d].forEach(T=>{this.outStreamObject.push({type:"streamChunk",prop:d,data:T})}),l[d]=[])}),this.outStreamObject.push(u),this.outStreamObject.push(null)}).on("error",u=>{R("stream error",u),this.outStreamObject.destroy(u)});return}if(this.mode==="promise"){let u=new Map;this.streamObject.on("data",l=>{var T;if(R("streamPromise data",l),l===void 0)return;if(l.error){let _=qa(l.error);return this.streamObject.destroy(_)}if(!l.prop){i.push(l);return}let d=(T=u.get(l.prop))!=null?T:[];l.dataArr?d.push(...l.dataArr):d.push(l.data),u.set(l.prop,d)}).on("end",()=>{R("streamPromise end");let l=i.pop();if(!l)return;let d=l.result;if(!u.size)return this.resolve(d);let T=!1;u.forEach((_,j)=>{Array.isArray(d[j])?(_.push(...d[j]),d[j]=_):_.length===1?d[j]=_:(this.streamObject.destroy(new Pe("INVALID_RESPONSE_STREAM_CHUNK",{property:j,value:_})),T=!0)}),T||this.resolve(d)}).on("error",l=>{var d;return R("streamPromise error",l),(d=this.reject)==null?void 0:d.call(this,l)})}}then(e,t){return this.start("promise"),this.promise.then(e,t)}catch(e){return this.start("promise"),this.promise.catch(e)}get[Symbol.toStringTag](){return"StreamPromise"}finally(e){return this.start("promise"),this.promise.finally(e)}stream(){return this.start("stream"),this.outStreamObject}};var ua=class extends pt{constructor(t,a){super(t);b(this,"inputStream");this.inputStream=a}input(t){return t?typeof t=="function"?(t(this.inputStream),this):(console.warn("currently disabled"),this):this.inputStream}};var Ka={};var au=(r,e)=>{if(r)return new ve({message:r.message,data:r.format()})},Ja=(r,e,t=au)=>{let{success:a,error:n,data:i}=r.safeParse(e);return{data:i,success:a,isValid:a,error:t(n,e)}},ui=(r,e,t,a)=>!e||typeof e!="object"?{success:!1,isValid:!1,error:new ve({message:`Invalid input - expected object, got ${typeof e}`,data:{input:e}})}:Ja(r,c({options:t!=null?t:{}},e),a),$e=(r,e,t,a)=>{var s;let{data:n,error:i}=Ja(r,e,a);if(i)throw((s=t==null?void 0:t.warn)!=null?s:R)(c({err:i},Ka),"Invalid input"),i;return n},nu=(r,e,t,a,n)=>{!a&&t&&typeof(t==null?void 0:t.warn)=="function"&&(a=t,t={});let{data:i,error:s}=ui(r,e,t,n);if(s)throw a?a.warn(c({err:s},Ka),"Invalid input"):R(c({err:s},Ka),"Invalid input"),s;return i},p=(r,e)=>({validateInput:(t,a)=>$e(r,t,a,e),validateInputWOptions:(t,a,n)=>nu(r,t,a,n,e),softValidateInput:t=>Ja(r,t,e),softValidateWOptions:(t,a)=>ui(r,t,a,e)});var U;(function(r){r.assertEqual=n=>n;function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let i={};for(let s of n)i[s]=s;return i},r.getValidEnumValues=n=>{let i=r.objectKeys(n).filter(u=>typeof n[n[u]]!="number"),s={};for(let u of i)s[u]=n[u];return r.objectValues(s)},r.objectValues=n=>r.objectKeys(n).map(function(i){return n[i]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&i.push(s);return i},r.find=(n,i)=>{for(let s of n)if(i(s))return s},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function a(n,i=" | "){return n.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}r.joinValues=a,r.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(U||(U={}));var li;(function(r){r.mergeShapes=(e,t)=>c(c({},e),t)})(li||(li={}));var O=U.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),et=r=>{switch(typeof r){case"undefined":return O.undefined;case"string":return O.string;case"number":return isNaN(r)?O.nan:O.number;case"boolean":return O.boolean;case"function":return O.function;case"bigint":return O.bigint;case"symbol":return O.symbol;case"object":return Array.isArray(r)?O.array:r===null?O.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?O.promise:typeof Map!="undefined"&&r instanceof Map?O.map:typeof Set!="undefined"&&r instanceof Set?O.set:typeof Date!="undefined"&&r instanceof Date?O.date:O.object;default:return O.unknown}},m=U.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Il=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),ke=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(i){return i.message},a={_errors:[]},n=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)a._errors.push(t(s));else{let u=a,l=0;for(;l<s.path.length;){let d=s.path[l];l===s.path.length-1?(u[d]=u[d]||{_errors:[]},u[d]._errors.push(t(s))):u[d]=u[d]||{_errors:[]},u=u[d],l++}}};return n(this),a}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,U.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},a=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):a.push(e(n));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}};ke.create=r=>new ke(r);var ir=(r,e)=>{let t;switch(r.code){case m.invalid_type:r.received===O.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case m.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,U.jsonStringifyReplacer)}`;break;case m.unrecognized_keys:t=`Unrecognized key(s) in object: ${U.joinValues(r.keys,", ")}`;break;case m.invalid_union:t="Invalid input";break;case m.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${U.joinValues(r.options)}`;break;case m.invalid_enum_value:t=`Invalid enum value. Expected ${U.joinValues(r.options)}, received '${r.received}'`;break;case m.invalid_arguments:t="Invalid function arguments";break;case m.invalid_return_type:t="Invalid function return type";break;case m.invalid_date:t="Invalid date";break;case m.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:U.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case m.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case m.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case m.custom:t="Invalid input";break;case m.invalid_intersection_types:t="Intersection results could not be merged";break;case m.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case m.not_finite:t="Number must be finite";break;default:t=e.defaultError,U.assertNever(r)}return{message:t}},pu=ir;function _l(r){pu=r}function Qa(){return pu}var Ya=r=>{let{data:e,path:t,errorMaps:a,issueData:n}=r,i=[...t,...n.path||[]],s=S(c({},n),{path:i});if(n.message!==void 0)return S(c({},n),{path:i,message:n.message});let u="",l=a.filter(d=>!!d).slice().reverse();for(let d of l)u=d(s,{data:e,defaultError:u}).message;return S(c({},n),{path:i,message:u})},vl=[];function y(r,e){let t=Qa(),a=Ya({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===ir?void 0:ir].filter(n=>!!n)});r.common.issues.push(a)}var fe=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let a=[];for(let n of t){if(n.status==="aborted")return w;n.status==="dirty"&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static mergeObjectAsync(e,t){return X(this,null,function*(){let a=[];for(let n of t){let i=yield n.key,s=yield n.value;a.push({key:i,value:s})}return r.mergeObjectSync(e,a)})}static mergeObjectSync(e,t){let a={};for(let n of t){let{key:i,value:s}=n;if(i.status==="aborted"||s.status==="aborted")return w;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value!="undefined"||n.alwaysSet)&&(a[i.value]=s.value)}return{status:e.value,value:a}}},w=Object.freeze({status:"aborted"}),or=r=>({status:"dirty",value:r}),he=r=>({status:"valid",value:r}),di=r=>r.status==="aborted",fi=r=>r.status==="dirty",Ot=r=>r.status==="valid",da=r=>typeof Promise!="undefined"&&r instanceof Promise;function Xa(r,e,t,a){if(t==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!a:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?a:t==="a"?a.call(r):a?a.value:e.get(r)}function uu(r,e,t,a,n){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t}var I;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(I||(I={}));var ca,la,Ee=class{constructor(e,t,a,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ou=(r,e)=>{if(Ot(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new ke(r.common.issues);return this._error=t,this._error}}};function W(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:a,description:n}=r;if(e&&(t||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(s,u)=>{var l,d;let{message:T}=r;return s.code==="invalid_enum_value"?{message:T!=null?T:u.defaultError}:typeof u.data=="undefined"?{message:(l=T!=null?T:a)!==null&&l!==void 0?l:u.defaultError}:s.code!=="invalid_type"?{message:u.defaultError}:{message:(d=T!=null?T:t)!==null&&d!==void 0?d:u.defaultError}},description:n}}var N=class{get description(){return this._def.description}_getType(e){return et(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:et(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new fe,ctx:{common:e.parent.common,data:e.data,parsedType:et(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(da(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){var a;let n={common:{issues:[],async:(a=t==null?void 0:t.async)!==null&&a!==void 0?a:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:et(e)},i=this._parseSync({data:e,path:n.path,parent:n});return ou(n,i)}"~validate"(e){var t,a;let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:et(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:n});return Ot(i)?{value:i.value}:{issues:n.common.issues}}catch(i){!((a=(t=i==null?void 0:i.message)===null||t===void 0?void 0:t.toLowerCase())===null||a===void 0)&&a.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>Ot(i)?{value:i.value}:{issues:n.common.issues})}parseAsync(e,t){return X(this,null,function*(){let a=yield this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error})}safeParseAsync(e,t){return X(this,null,function*(){let a={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:et(e)},n=this._parse({data:e,path:a.path,parent:a}),i=yield da(n)?n:Promise.resolve(n);return ou(a,i)})}refine(e,t){let a=n=>typeof t=="string"||typeof t=="undefined"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,i)=>{let s=e(n),u=()=>i.addIssue(c({code:m.custom},a(n)));return typeof Promise!="undefined"&&s instanceof Promise?s.then(l=>l?!0:(u(),!1)):s?!0:(u(),!1)})}refinement(e,t){return this._refinement((a,n)=>e(a)?!0:(n.addIssue(typeof t=="function"?t(a,n):t),!1))}_refinement(e){return new we({schema:this,typeName:k.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){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"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return Me.create(this,this._def)}nullable(){return ze.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rt.create(this)}promise(){return lt.create(this,this._def)}or(e){return Rt.create([this,e],this._def)}and(e){return At.create(this,e,this._def)}transform(e){return new we(S(c({},W(this._def)),{schema:this,typeName:k.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){let t=typeof e=="function"?e:()=>e;return new Wt(S(c({},W(this._def)),{innerType:this,defaultValue:t,typeName:k.ZodDefault}))}brand(){return new fa(c({typeName:k.ZodBranded,type:this},W(this._def)))}catch(e){let t=typeof e=="function"?e:()=>e;return new Nt(S(c({},W(this._def)),{innerType:this,catchValue:t,typeName:k.ZodCatch}))}describe(e){let t=this.constructor;return new t(S(c({},this._def),{description:e}))}pipe(e){return ma.create(this,e)}readonly(){return Dt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},kl=/^c[^\s-]{8,}$/i,wl=/^[0-9a-z]+$/,Rl=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Al=/^[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,Ml=/^[a-z0-9_-]{21}$/i,El=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Gl=/^[-+]?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)?)??$/,Cl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Wl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ci,Nl=/^(?:(?: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])$/,Dl=/^(?:(?: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])$/,Bl=/^(([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]))$/,jl=/^(([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])$/,Pl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vl=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cu="((\\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])))",Zl=new RegExp(`^${cu}$`);function lu(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Ul(r){return new RegExp(`^${lu(r)}$`)}function du(r){let e=`${cu}T${lu(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ll(r,e){return!!((e==="v4"||!e)&&Nl.test(r)||(e==="v6"||!e)&&Bl.test(r))}function $l(r,e){if(!El.test(r))return!1;try{let[t]=r.split("."),a=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(a));return!(typeof n!="object"||n===null||!n.typ||!n.alg||e&&n.alg!==e)}catch(t){return!1}}function ql(r,e){return!!((e==="v4"||!e)&&Dl.test(r)||(e==="v6"||!e)&&jl.test(r))}var ut=class r extends N{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==O.string){let i=this._getOrReturnCtx(e);return y(i,{code:m.invalid_type,expected:O.string,received:i.parsedType}),w}let a=new fe,n;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:m.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),a.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:m.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),a.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,u=e.data.length<i.value;(s||u)&&(n=this._getOrReturnCtx(e,n),s?y(n,{code:m.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):u&&y(n,{code:m.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),a.dirty())}else if(i.kind==="email")Cl.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"email",code:m.invalid_string,message:i.message}),a.dirty());else if(i.kind==="emoji")ci||(ci=new RegExp(Wl,"u")),ci.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"emoji",code:m.invalid_string,message:i.message}),a.dirty());else if(i.kind==="uuid")Al.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"uuid",code:m.invalid_string,message:i.message}),a.dirty());else if(i.kind==="nanoid")Ml.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"nanoid",code:m.invalid_string,message:i.message}),a.dirty());else if(i.kind==="cuid")kl.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"cuid",code:m.invalid_string,message:i.message}),a.dirty());else if(i.kind==="cuid2")wl.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"cuid2",code:m.invalid_string,message:i.message}),a.dirty());else if(i.kind==="ulid")Rl.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"ulid",code:m.invalid_string,message:i.message}),a.dirty());else if(i.kind==="url")try{new URL(e.data)}catch(s){n=this._getOrReturnCtx(e,n),y(n,{validation:"url",code:m.invalid_string,message:i.message}),a.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"regex",code:m.invalid_string,message:i.message}),a.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),y(n,{code:m.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),a.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),y(n,{code:m.invalid_string,validation:{startsWith:i.value},message:i.message}),a.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),y(n,{code:m.invalid_string,validation:{endsWith:i.value},message:i.message}),a.dirty()):i.kind==="datetime"?du(i).test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:m.invalid_string,validation:"datetime",message:i.message}),a.dirty()):i.kind==="date"?Zl.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:m.invalid_string,validation:"date",message:i.message}),a.dirty()):i.kind==="time"?Ul(i).test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:m.invalid_string,validation:"time",message:i.message}),a.dirty()):i.kind==="duration"?Gl.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"duration",code:m.invalid_string,message:i.message}),a.dirty()):i.kind==="ip"?Ll(e.data,i.version)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"ip",code:m.invalid_string,message:i.message}),a.dirty()):i.kind==="jwt"?$l(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"jwt",code:m.invalid_string,message:i.message}),a.dirty()):i.kind==="cidr"?ql(e.data,i.version)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"cidr",code:m.invalid_string,message:i.message}),a.dirty()):i.kind==="base64"?Pl.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"base64",code:m.invalid_string,message:i.message}),a.dirty()):i.kind==="base64url"?Vl.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"base64url",code:m.invalid_string,message:i.message}),a.dirty()):U.assertNever(i);return{status:a.value,value:e.data}}_regex(e,t,a){return this.refinement(n=>e.test(n),c({validation:t,code:m.invalid_string},I.errToObj(a)))}_addCheck(e){return new r(S(c({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(c({kind:"email"},I.errToObj(e)))}url(e){return this._addCheck(c({kind:"url"},I.errToObj(e)))}emoji(e){return this._addCheck(c({kind:"emoji"},I.errToObj(e)))}uuid(e){return this._addCheck(c({kind:"uuid"},I.errToObj(e)))}nanoid(e){return this._addCheck(c({kind:"nanoid"},I.errToObj(e)))}cuid(e){return this._addCheck(c({kind:"cuid"},I.errToObj(e)))}cuid2(e){return this._addCheck(c({kind:"cuid2"},I.errToObj(e)))}ulid(e){return this._addCheck(c({kind:"ulid"},I.errToObj(e)))}base64(e){return this._addCheck(c({kind:"base64"},I.errToObj(e)))}base64url(e){return this._addCheck(c({kind:"base64url"},I.errToObj(e)))}jwt(e){return this._addCheck(c({kind:"jwt"},I.errToObj(e)))}ip(e){return this._addCheck(c({kind:"ip"},I.errToObj(e)))}cidr(e){return this._addCheck(c({kind:"cidr"},I.errToObj(e)))}datetime(e){var t,a;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck(c({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(a=e==null?void 0:e.local)!==null&&a!==void 0?a:!1},I.errToObj(e==null?void 0:e.message)))}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck(c({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision},I.errToObj(e==null?void 0:e.message)))}duration(e){return this._addCheck(c({kind:"duration"},I.errToObj(e)))}regex(e,t){return this._addCheck(c({kind:"regex",regex:e},I.errToObj(t)))}includes(e,t){return this._addCheck(c({kind:"includes",value:e,position:t==null?void 0:t.position},I.errToObj(t==null?void 0:t.message)))}startsWith(e,t){return this._addCheck(c({kind:"startsWith",value:e},I.errToObj(t)))}endsWith(e,t){return this._addCheck(c({kind:"endsWith",value:e},I.errToObj(t)))}min(e,t){return this._addCheck(c({kind:"min",value:e},I.errToObj(t)))}max(e,t){return this._addCheck(c({kind:"max",value:e},I.errToObj(t)))}length(e,t){return this._addCheck(c({kind:"length",value:e},I.errToObj(t)))}nonempty(e){return this.min(1,I.errToObj(e))}trim(){return new r(S(c({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new r(S(c({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new r(S(c({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};ut.create=r=>{var e;return new ut(c({checks:[],typeName:k.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1},W(r)))};function zl(r,e){let t=(r.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,n=t>a?t:a,i=parseInt(r.toFixed(n).replace(".","")),s=parseInt(e.toFixed(n).replace(".",""));return i%s/Math.pow(10,n)}var Ft=class r extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==O.number){let i=this._getOrReturnCtx(e);return y(i,{code:m.invalid_type,expected:O.number,received:i.parsedType}),w}let a,n=new fe;for(let i of this._def.checks)i.kind==="int"?U.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{code:m.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(a=this._getOrReturnCtx(e,a),y(a,{code:m.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(a=this._getOrReturnCtx(e,a),y(a,{code:m.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?zl(e.data,i.value)!==0&&(a=this._getOrReturnCtx(e,a),y(a,{code:m.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{code:m.not_finite,message:i.message}),n.dirty()):U.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,I.toString(t))}gt(e,t){return this.setLimit("min",e,!1,I.toString(t))}lte(e,t){return this.setLimit("max",e,!0,I.toString(t))}lt(e,t){return this.setLimit("max",e,!1,I.toString(t))}setLimit(e,t,a,n){return new r(S(c({},this._def),{checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:I.toString(n)}]}))}_addCheck(e){return new r(S(c({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:I.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:I.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:I.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:I.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:I.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:I.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:I.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:I.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:I.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&U.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(t===null||a.value>t)&&(t=a.value):a.kind==="max"&&(e===null||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Ft.create=r=>new Ft(c({checks:[],typeName:k.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1},W(r)));var It=class r extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(i){return this._getInvalidInput(e)}if(this._getType(e)!==O.bigint)return this._getInvalidInput(e);let a,n=new fe;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(a=this._getOrReturnCtx(e,a),y(a,{code:m.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(a=this._getOrReturnCtx(e,a),y(a,{code:m.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),y(a,{code:m.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):U.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return y(t,{code:m.invalid_type,expected:O.bigint,received:t.parsedType}),w}gte(e,t){return this.setLimit("min",e,!0,I.toString(t))}gt(e,t){return this.setLimit("min",e,!1,I.toString(t))}lte(e,t){return this.setLimit("max",e,!0,I.toString(t))}lt(e,t){return this.setLimit("max",e,!1,I.toString(t))}setLimit(e,t,a,n){return new r(S(c({},this._def),{checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:I.toString(n)}]}))}_addCheck(e){return new r(S(c({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:I.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:I.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:I.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:I.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:I.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};It.create=r=>{var e;return new It(c({checks:[],typeName:k.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1},W(r)))};var _t=class extends N{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==O.boolean){let a=this._getOrReturnCtx(e);return y(a,{code:m.invalid_type,expected:O.boolean,received:a.parsedType}),w}return he(e.data)}};_t.create=r=>new _t(c({typeName:k.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1},W(r)));var vt=class r extends N{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==O.date){let i=this._getOrReturnCtx(e);return y(i,{code:m.invalid_type,expected:O.date,received:i.parsedType}),w}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return y(i,{code:m.invalid_date}),w}let a=new fe,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:m.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),a.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:m.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),a.dirty()):U.assertNever(i);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r(S(c({},this._def),{checks:[...this._def.checks,e]}))}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:I.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:I.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};vt.create=r=>new vt(c({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:k.ZodDate},W(r)));var sr=class extends N{_parse(e){if(this._getType(e)!==O.symbol){let a=this._getOrReturnCtx(e);return y(a,{code:m.invalid_type,expected:O.symbol,received:a.parsedType}),w}return he(e.data)}};sr.create=r=>new sr(c({typeName:k.ZodSymbol},W(r)));var kt=class extends N{_parse(e){if(this._getType(e)!==O.undefined){let a=this._getOrReturnCtx(e);return y(a,{code:m.invalid_type,expected:O.undefined,received:a.parsedType}),w}return he(e.data)}};kt.create=r=>new kt(c({typeName:k.ZodUndefined},W(r)));var wt=class extends N{_parse(e){if(this._getType(e)!==O.null){let a=this._getOrReturnCtx(e);return y(a,{code:m.invalid_type,expected:O.null,received:a.parsedType}),w}return he(e.data)}};wt.create=r=>new wt(c({typeName:k.ZodNull},W(r)));var ct=class extends N{constructor(){super(...arguments),this._any=!0}_parse(e){return he(e.data)}};ct.create=r=>new ct(c({typeName:k.ZodAny},W(r)));var tt=class extends N{constructor(){super(...arguments),this._unknown=!0}_parse(e){return he(e.data)}};tt.create=r=>new tt(c({typeName:k.ZodUnknown},W(r)));var Ve=class extends N{_parse(e){let t=this._getOrReturnCtx(e);return y(t,{code:m.invalid_type,expected:O.never,received:t.parsedType}),w}};Ve.create=r=>new Ve(c({typeName:k.ZodNever},W(r)));var pr=class extends N{_parse(e){if(this._getType(e)!==O.undefined){let a=this._getOrReturnCtx(e);return y(a,{code:m.invalid_type,expected:O.void,received:a.parsedType}),w}return he(e.data)}};pr.create=r=>new pr(c({typeName:k.ZodVoid},W(r)));var rt=class r extends N{_parse(e){let{ctx:t,status:a}=this._processInputParams(e),n=this._def;if(t.parsedType!==O.array)return y(t,{code:m.invalid_type,expected:O.array,received:t.parsedType}),w;if(n.exactLength!==null){let s=t.data.length>n.exactLength.value,u=t.data.length<n.exactLength.value;(s||u)&&(y(t,{code:s?m.too_big:m.too_small,minimum:u?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(y(t,{code:m.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(y(t,{code:m.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((s,u)=>n.type._parseAsync(new Ee(t,s,t.path,u)))).then(s=>fe.mergeArray(a,s));let i=[...t.data].map((s,u)=>n.type._parseSync(new Ee(t,s,t.path,u)));return fe.mergeArray(a,i)}get element(){return this._def.type}min(e,t){return new r(S(c({},this._def),{minLength:{value:e,message:I.toString(t)}}))}max(e,t){return new r(S(c({},this._def),{maxLength:{value:e,message:I.toString(t)}}))}length(e,t){return new r(S(c({},this._def),{exactLength:{value:e,message:I.toString(t)}}))}nonempty(e){return this.min(1,e)}};rt.create=(r,e)=>new rt(c({type:r,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray},W(e)));function nr(r){if(r instanceof be){let e={};for(let t in r.shape){let a=r.shape[t];e[t]=Me.create(nr(a))}return new be(S(c({},r._def),{shape:()=>e}))}else return r instanceof rt?new rt(S(c({},r._def),{type:nr(r.element)})):r instanceof Me?Me.create(nr(r.unwrap())):r instanceof ze?ze.create(nr(r.unwrap())):r instanceof qe?qe.create(r.items.map(e=>nr(e))):r}var be=class r extends N{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=U.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==O.object){let d=this._getOrReturnCtx(e);return y(d,{code:m.invalid_type,expected:O.object,received:d.parsedType}),w}let{status:a,ctx:n}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),u=[];if(!(this._def.catchall instanceof Ve&&this._def.unknownKeys==="strip"))for(let d in n.data)s.includes(d)||u.push(d);let l=[];for(let d of s){let T=i[d],_=n.data[d];l.push({key:{status:"valid",value:d},value:T._parse(new Ee(n,_,n.path,d)),alwaysSet:d in n.data})}if(this._def.catchall instanceof Ve){let d=this._def.unknownKeys;if(d==="passthrough")for(let T of u)l.push({key:{status:"valid",value:T},value:{status:"valid",value:n.data[T]}});else if(d==="strict")u.length>0&&(y(n,{code:m.unrecognized_keys,keys:u}),a.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let T of u){let _=n.data[T];l.push({key:{status:"valid",value:T},value:d._parse(new Ee(n,_,n.path,T)),alwaysSet:T in n.data})}}return n.common.async?Promise.resolve().then(()=>X(this,null,function*(){let d=[];for(let T of l){let _=yield T.key,j=yield T.value;d.push({key:_,value:j,alwaysSet:T.alwaysSet})}return d})).then(d=>fe.mergeObjectSync(a,d)):fe.mergeObjectSync(a,l)}get shape(){return this._def.shape()}strict(e){return I.errToObj,new r(c(S(c({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(t,a)=>{var n,i,s,u;let l=(s=(i=(n=this._def).errorMap)===null||i===void 0?void 0:i.call(n,t,a).message)!==null&&s!==void 0?s:a.defaultError;return t.code==="unrecognized_keys"?{message:(u=I.errToObj(e).message)!==null&&u!==void 0?u:l}:{message:l}}}:{}))}strip(){return new r(S(c({},this._def),{unknownKeys:"strip"}))}passthrough(){return new r(S(c({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new r(S(c({},this._def),{shape:()=>c(c({},this._def.shape()),e)}))}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>c(c({},this._def.shape()),e._def.shape()),typeName:k.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r(S(c({},this._def),{catchall:e}))}pick(e){let t={};return U.objectKeys(e).forEach(a=>{e[a]&&this.shape[a]&&(t[a]=this.shape[a])}),new r(S(c({},this._def),{shape:()=>t}))}omit(e){let t={};return U.objectKeys(this.shape).forEach(a=>{e[a]||(t[a]=this.shape[a])}),new r(S(c({},this._def),{shape:()=>t}))}deepPartial(){return nr(this)}partial(e){let t={};return U.objectKeys(this.shape).forEach(a=>{let n=this.shape[a];e&&!e[a]?t[a]=n:t[a]=n.optional()}),new r(S(c({},this._def),{shape:()=>t}))}required(e){let t={};return U.objectKeys(this.shape).forEach(a=>{if(e&&!e[a])t[a]=this.shape[a];else{let i=this.shape[a];for(;i instanceof Me;)i=i._def.innerType;t[a]=i}}),new r(S(c({},this._def),{shape:()=>t}))}keyof(){return fu(U.objectKeys(this.shape))}};be.create=(r,e)=>new be(c({shape:()=>r,unknownKeys:"strip",catchall:Ve.create(),typeName:k.ZodObject},W(e)));be.strictCreate=(r,e)=>new be(c({shape:()=>r,unknownKeys:"strict",catchall:Ve.create(),typeName:k.ZodObject},W(e)));be.lazycreate=(r,e)=>new be(c({shape:r,unknownKeys:"strip",catchall:Ve.create(),typeName:k.ZodObject},W(e)));var Rt=class extends N{_parse(e){let{ctx:t}=this._processInputParams(e),a=this._def.options;function n(i){for(let u of i)if(u.result.status==="valid")return u.result;for(let u of i)if(u.result.status==="dirty")return t.common.issues.push(...u.ctx.common.issues),u.result;let s=i.map(u=>new ke(u.ctx.common.issues));return y(t,{code:m.invalid_union,unionErrors:s}),w}if(t.common.async)return Promise.all(a.map(i=>X(this,null,function*(){let s=S(c({},t),{common:S(c({},t.common),{issues:[]}),parent:null});return{result:yield i._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}}))).then(n);{let i,s=[];for(let l of a){let d=S(c({},t),{common:S(c({},t.common),{issues:[]}),parent:null}),T=l._parseSync({data:t.data,path:t.path,parent:d});if(T.status==="valid")return T;T.status==="dirty"&&!i&&(i={result:T,ctx:d}),d.common.issues.length&&s.push(d.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let u=s.map(l=>new ke(l));return y(t,{code:m.invalid_union,unionErrors:u}),w}}get options(){return this._def.options}};Rt.create=(r,e)=>new Rt(c({options:r,typeName:k.ZodUnion},W(e)));var Xe=r=>r instanceof Mt?Xe(r.schema):r instanceof we?Xe(r.innerType()):r instanceof Et?[r.value]:r instanceof Gt?r.options:r instanceof Ct?U.objectValues(r.enum):r instanceof Wt?Xe(r._def.innerType):r instanceof kt?[void 0]:r instanceof wt?[null]:r instanceof Me?[void 0,...Xe(r.unwrap())]:r instanceof ze?[null,...Xe(r.unwrap())]:r instanceof fa||r instanceof Dt?Xe(r.unwrap()):r instanceof Nt?Xe(r._def.innerType):[],en=class r extends N{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.object)return y(t,{code:m.invalid_type,expected:O.object,received:t.parsedType}),w;let a=this.discriminator,n=t.data[a],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(y(t,{code:m.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),w)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){let n=new Map;for(let i of t){let s=Xe(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let u of s){if(n.has(u))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(u)}`);n.set(u,i)}}return new r(c({typeName:k.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n},W(a)))}};function mi(r,e){let t=et(r),a=et(e);if(r===e)return{valid:!0,data:r};if(t===O.object&&a===O.object){let n=U.objectKeys(e),i=U.objectKeys(r).filter(u=>n.indexOf(u)!==-1),s=c(c({},r),e);for(let u of i){let l=mi(r[u],e[u]);if(!l.valid)return{valid:!1};s[u]=l.data}return{valid:!0,data:s}}else if(t===O.array&&a===O.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let i=0;i<r.length;i++){let s=r[i],u=e[i],l=mi(s,u);if(!l.valid)return{valid:!1};n.push(l.data)}return{valid:!0,data:n}}else return t===O.date&&a===O.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var At=class extends N{_parse(e){let{status:t,ctx:a}=this._processInputParams(e),n=(i,s)=>{if(di(i)||di(s))return w;let u=mi(i.value,s.value);return u.valid?((fi(i)||fi(s))&&t.dirty(),{status:t.value,value:u.data}):(y(a,{code:m.invalid_intersection_types}),w)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([i,s])=>n(i,s)):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};At.create=(r,e,t)=>new At(c({left:r,right:e,typeName:k.ZodIntersection},W(t)));var qe=class r extends N{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==O.array)return y(a,{code:m.invalid_type,expected:O.array,received:a.parsedType}),w;if(a.data.length<this._def.items.length)return y(a,{code:m.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w;!this._def.rest&&a.data.length>this._def.items.length&&(y(a,{code:m.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...a.data].map((s,u)=>{let l=this._def.items[u]||this._def.rest;return l?l._parse(new Ee(a,s,a.path,u)):null}).filter(s=>!!s);return a.common.async?Promise.all(i).then(s=>fe.mergeArray(t,s)):fe.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new r(S(c({},this._def),{rest:e}))}};qe.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new qe(c({items:r,typeName:k.ZodTuple,rest:null},W(e)))};var tn=class r extends N{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==O.object)return y(a,{code:m.invalid_type,expected:O.object,received:a.parsedType}),w;let n=[],i=this._def.keyType,s=this._def.valueType;for(let u in a.data)n.push({key:i._parse(new Ee(a,u,a.path,u)),value:s._parse(new Ee(a,a.data[u],a.path,u)),alwaysSet:u in a.data});return a.common.async?fe.mergeObjectAsync(t,n):fe.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,a){return t instanceof N?new r(c({keyType:e,valueType:t,typeName:k.ZodRecord},W(a))):new r(c({keyType:ut.create(),valueType:e,typeName:k.ZodRecord},W(t)))}},ur=class extends N{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==O.map)return y(a,{code:m.invalid_type,expected:O.map,received:a.parsedType}),w;let n=this._def.keyType,i=this._def.valueType,s=[...a.data.entries()].map(([u,l],d)=>({key:n._parse(new Ee(a,u,a.path,[d,"key"])),value:i._parse(new Ee(a,l,a.path,[d,"value"]))}));if(a.common.async){let u=new Map;return Promise.resolve().then(()=>X(this,null,function*(){for(let l of s){let d=yield l.key,T=yield l.value;if(d.status==="aborted"||T.status==="aborted")return w;(d.status==="dirty"||T.status==="dirty")&&t.dirty(),u.set(d.value,T.value)}return{status:t.value,value:u}}))}else{let u=new Map;for(let l of s){let d=l.key,T=l.value;if(d.status==="aborted"||T.status==="aborted")return w;(d.status==="dirty"||T.status==="dirty")&&t.dirty(),u.set(d.value,T.value)}return{status:t.value,value:u}}}};ur.create=(r,e,t)=>new ur(c({valueType:e,keyType:r,typeName:k.ZodMap},W(t)));var cr=class r extends N{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==O.set)return y(a,{code:m.invalid_type,expected:O.set,received:a.parsedType}),w;let n=this._def;n.minSize!==null&&a.data.size<n.minSize.value&&(y(a,{code:m.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&a.data.size>n.maxSize.value&&(y(a,{code:m.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function s(l){let d=new Set;for(let T of l){if(T.status==="aborted")return w;T.status==="dirty"&&t.dirty(),d.add(T.value)}return{status:t.value,value:d}}let u=[...a.data.values()].map((l,d)=>i._parse(new Ee(a,l,a.path,d)));return a.common.async?Promise.all(u).then(l=>s(l)):s(u)}min(e,t){return new r(S(c({},this._def),{minSize:{value:e,message:I.toString(t)}}))}max(e,t){return new r(S(c({},this._def),{maxSize:{value:e,message:I.toString(t)}}))}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};cr.create=(r,e)=>new cr(c({valueType:r,minSize:null,maxSize:null,typeName:k.ZodSet},W(e)));var rn=class r extends N{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.function)return y(t,{code:m.invalid_type,expected:O.function,received:t.parsedType}),w;function a(u,l){return Ya({data:u,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Qa(),ir].filter(d=>!!d),issueData:{code:m.invalid_arguments,argumentsError:l}})}function n(u,l){return Ya({data:u,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Qa(),ir].filter(d=>!!d),issueData:{code:m.invalid_return_type,returnTypeError:l}})}let i={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof lt){let u=this;return he(function(...l){return X(this,null,function*(){let d=new ke([]),T=yield u._def.args.parseAsync(l,i).catch(B=>{throw d.addIssue(a(l,B)),d}),_=yield Reflect.apply(s,this,T);return yield u._def.returns._def.type.parseAsync(_,i).catch(B=>{throw d.addIssue(n(_,B)),d})})})}else{let u=this;return he(function(...l){let d=u._def.args.safeParse(l,i);if(!d.success)throw new ke([a(l,d.error)]);let T=Reflect.apply(s,this,d.data),_=u._def.returns.safeParse(T,i);if(!_.success)throw new ke([n(T,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r(S(c({},this._def),{args:qe.create(e).rest(tt.create())}))}returns(e){return new r(S(c({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,a){return new r(c({args:e||qe.create([]).rest(tt.create()),returns:t||tt.create(),typeName:k.ZodFunction},W(a)))}},Mt=class extends N{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Mt.create=(r,e)=>new Mt(c({getter:r,typeName:k.ZodLazy},W(e)));var Et=class extends N{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return y(t,{received:t.data,code:m.invalid_literal,expected:this._def.value}),w}return{status:"valid",value:e.data}}get value(){return this._def.value}};Et.create=(r,e)=>new Et(c({value:r,typeName:k.ZodLiteral},W(e)));function fu(r,e){return new Gt(c({values:r,typeName:k.ZodEnum},W(e)))}var Gt=class r extends N{constructor(){super(...arguments),ca.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),a=this._def.values;return y(t,{expected:U.joinValues(a),received:t.parsedType,code:m.invalid_type}),w}if(Xa(this,ca,"f")||uu(this,ca,new Set(this._def.values),"f"),!Xa(this,ca,"f").has(e.data)){let t=this._getOrReturnCtx(e),a=this._def.values;return y(t,{received:t.data,code:m.invalid_enum_value,options:a}),w}return he(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,c(c({},this._def),t))}exclude(e,t=this._def){return r.create(this.options.filter(a=>!e.includes(a)),c(c({},this._def),t))}};ca=new WeakMap;Gt.create=fu;var Ct=class extends N{constructor(){super(...arguments),la.set(this,void 0)}_parse(e){let t=U.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==O.string&&a.parsedType!==O.number){let n=U.objectValues(t);return y(a,{expected:U.joinValues(n),received:a.parsedType,code:m.invalid_type}),w}if(Xa(this,la,"f")||uu(this,la,new Set(U.getValidEnumValues(this._def.values)),"f"),!Xa(this,la,"f").has(e.data)){let n=U.objectValues(t);return y(a,{received:a.data,code:m.invalid_enum_value,options:n}),w}return he(e.data)}get enum(){return this._def.values}};la=new WeakMap;Ct.create=(r,e)=>new Ct(c({values:r,typeName:k.ZodNativeEnum},W(e)));var lt=class extends N{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.promise&&t.common.async===!1)return y(t,{code:m.invalid_type,expected:O.promise,received:t.parsedType}),w;let a=t.parsedType===O.promise?t.data:Promise.resolve(t.data);return he(a.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};lt.create=(r,e)=>new lt(c({type:r,typeName:k.ZodPromise},W(e)));var we=class extends N{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===k.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:a}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:s=>{y(a,s),s.fatal?t.abort():t.dirty()},get path(){return a.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let s=n.transform(a.data,i);if(a.common.async)return Promise.resolve(s).then(u=>X(this,null,function*(){if(t.value==="aborted")return w;let l=yield this._def.schema._parseAsync({data:u,path:a.path,parent:a});return l.status==="aborted"?w:l.status==="dirty"||t.value==="dirty"?or(l.value):l}));{if(t.value==="aborted")return w;let u=this._def.schema._parseSync({data:s,path:a.path,parent:a});return u.status==="aborted"?w:u.status==="dirty"||t.value==="dirty"?or(u.value):u}}if(n.type==="refinement"){let s=u=>{let l=n.refinement(u,i);if(a.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return u};if(a.common.async===!1){let u=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return u.status==="aborted"?w:(u.status==="dirty"&&t.dirty(),s(u.value),{status:t.value,value:u.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(u=>u.status==="aborted"?w:(u.status==="dirty"&&t.dirty(),s(u.value).then(()=>({status:t.value,value:u.value}))))}if(n.type==="transform")if(a.common.async===!1){let s=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Ot(s))return s;let u=n.transform(s.value,i);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:u}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(s=>Ot(s)?Promise.resolve(n.transform(s.value,i)).then(u=>({status:t.value,value:u})):s);U.assertNever(n)}};we.create=(r,e,t)=>new we(c({schema:r,typeName:k.ZodEffects,effect:e},W(t)));we.createWithPreprocess=(r,e,t)=>new we(c({schema:e,effect:{type:"preprocess",transform:r},typeName:k.ZodEffects},W(t)));var Me=class extends N{_parse(e){return this._getType(e)===O.undefined?he(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Me.create=(r,e)=>new Me(c({innerType:r,typeName:k.ZodOptional},W(e)));var ze=class extends N{_parse(e){return this._getType(e)===O.null?he(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ze.create=(r,e)=>new ze(c({innerType:r,typeName:k.ZodNullable},W(e)));var Wt=class extends N{_parse(e){let{ctx:t}=this._processInputParams(e),a=t.data;return t.parsedType===O.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Wt.create=(r,e)=>new Wt(c({innerType:r,typeName:k.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},W(e)));var Nt=class extends N{_parse(e){let{ctx:t}=this._processInputParams(e),a=S(c({},t),{common:S(c({},t.common),{issues:[]})}),n=this._def.innerType._parse({data:a.data,path:a.path,parent:c({},a)});return da(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ke(a.common.issues)},input:a.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ke(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};Nt.create=(r,e)=>new Nt(c({innerType:r,typeName:k.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},W(e)));var lr=class extends N{_parse(e){if(this._getType(e)!==O.nan){let a=this._getOrReturnCtx(e);return y(a,{code:m.invalid_type,expected:O.nan,received:a.parsedType}),w}return{status:"valid",value:e.data}}};lr.create=r=>new lr(c({typeName:k.ZodNaN},W(r)));var Hl=Symbol("zod_brand"),fa=class extends N{_parse(e){let{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}},ma=class r extends N{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.common.async)return X(this,null,function*(){let i=yield this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?w:i.status==="dirty"?(t.dirty(),or(i.value)):this._def.out._parseAsync({data:i.value,path:a.path,parent:a})});{let n=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?w:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:a.path,parent:a})}}static create(e,t){return new r({in:e,out:t,typeName:k.ZodPipeline})}},Dt=class extends N{_parse(e){let t=this._def.innerType._parse(e),a=n=>(Ot(n)&&(n.value=Object.freeze(n.value)),n);return da(t)?t.then(n=>a(n)):a(t)}unwrap(){return this._def.innerType}};Dt.create=(r,e)=>new Dt(c({innerType:r,typeName:k.ZodReadonly},W(e)));function iu(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function mu(r,e={},t){return r?ct.create().superRefine((a,n)=>{var i,s;let u=r(a);if(u instanceof Promise)return u.then(l=>{var d,T;if(!l){let _=iu(e,a),j=(T=(d=_.fatal)!==null&&d!==void 0?d:t)!==null&&T!==void 0?T:!0;n.addIssue(S(c({code:"custom"},_),{fatal:j}))}});if(!u){let l=iu(e,a),d=(s=(i=l.fatal)!==null&&i!==void 0?i:t)!==null&&s!==void 0?s:!0;n.addIssue(S(c({code:"custom"},l),{fatal:d}))}}):ct.create()}var Kl={object:be.lazycreate},k;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(k||(k={}));var Jl=(r,e={message:`Input not instance of ${r.name}`})=>mu(t=>t instanceof r,e),hu=ut.create,Tu=Ft.create,Ql=lr.create,Yl=It.create,gu=_t.create,Xl=vt.create,ed=sr.create,td=kt.create,rd=wt.create,ad=ct.create,nd=tt.create,od=Ve.create,id=pr.create,sd=rt.create,pd=be.create,ud=be.strictCreate,cd=Rt.create,ld=en.create,dd=At.create,fd=qe.create,md=tn.create,hd=ur.create,Td=cr.create,gd=rn.create,xd=Mt.create,yd=Et.create,bd=Gt.create,Sd=Ct.create,Od=lt.create,su=we.create,Fd=Me.create,Id=ze.create,_d=we.createWithPreprocess,vd=ma.create,kd=()=>hu().optional(),wd=()=>Tu().optional(),Rd=()=>gu().optional(),Ad={string:r=>ut.create(S(c({},r),{coerce:!0})),number:r=>Ft.create(S(c({},r),{coerce:!0})),boolean:r=>_t.create(S(c({},r),{coerce:!0})),bigint:r=>It.create(S(c({},r),{coerce:!0})),date:r=>vt.create(S(c({},r),{coerce:!0}))},Md=w,o=Object.freeze({__proto__:null,defaultErrorMap:ir,setErrorMap:_l,getErrorMap:Qa,makeIssue:Ya,EMPTY_PATH:vl,addIssueToContext:y,ParseStatus:fe,INVALID:w,DIRTY:or,OK:he,isAborted:di,isDirty:fi,isValid:Ot,isAsync:da,get util(){return U},get objectUtil(){return li},ZodParsedType:O,getParsedType:et,ZodType:N,datetimeRegex:du,ZodString:ut,ZodNumber:Ft,ZodBigInt:It,ZodBoolean:_t,ZodDate:vt,ZodSymbol:sr,ZodUndefined:kt,ZodNull:wt,ZodAny:ct,ZodUnknown:tt,ZodNever:Ve,ZodVoid:pr,ZodArray:rt,ZodObject:be,ZodUnion:Rt,ZodDiscriminatedUnion:en,ZodIntersection:At,ZodTuple:qe,ZodRecord:tn,ZodMap:ur,ZodSet:cr,ZodFunction:rn,ZodLazy:Mt,ZodLiteral:Et,ZodEnum:Gt,ZodNativeEnum:Ct,ZodPromise:lt,ZodEffects:we,ZodTransformer:we,ZodOptional:Me,ZodNullable:ze,ZodDefault:Wt,ZodCatch:Nt,ZodNaN:lr,BRAND:Hl,ZodBranded:fa,ZodPipeline:ma,ZodReadonly:Dt,custom:mu,Schema:N,ZodSchema:N,late:Kl,get ZodFirstPartyTypeKind(){return k},coerce:Ad,any:ad,array:sd,bigint:Yl,boolean:gu,date:Xl,discriminatedUnion:ld,effect:su,enum:bd,function:gd,instanceof:Jl,intersection:dd,lazy:xd,literal:yd,map:hd,nan:Ql,nativeEnum:Sd,never:od,null:rd,nullable:Id,number:Tu,object:pd,oboolean:Rd,onumber:wd,optional:Fd,ostring:kd,pipeline:vd,preprocess:_d,promise:Od,record:md,set:Td,strictObject:ud,string:hu,symbol:ed,transformer:su,tuple:fd,undefined:td,union:cd,unknown:nd,void:id,NEVER:Md,ZodIssueCode:m,quotelessJson:Il,ZodError:ke});function Y(r){return r.reduce((e,t)=>(e[t]=t,e),{})}var He=o.record(o.string(),o.union([o.string(),o.boolean(),o.number(),o.null(),o.undefined(),o.lazy(()=>He),o.union([o.string(),o.boolean(),o.number(),o.null(),o.undefined(),o.lazy(()=>He)]).array()])).nullable().describe("Custom key/value object"),M=o.union([o.string().datetime({offset:!0,local:!0}),o.string({invalid_type_error:"must be a valid date-time string"}).regex(/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/),o.string().date()]),an=o.enum(["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Asmera","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Timbuktu","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/ComodRivadavia","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Atikokan","America/Atka","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Buenos_Aires","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Catamarca","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Ciudad_Juarez","America/Coral_Harbour","America/Cordoba","America/Costa_Rica","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Ensenada","America/Fort_Nelson","America/Fort_Wayne","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Indianapolis","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Indianapolis","America/Inuvik","America/Iqaluit","America/Jamaica","America/Jujuy","America/Juneau","America/Kentucky/Louisville","America/Kentucky/Monticello","America/Knox_IN","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Louisville","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Mendoza","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montreal","America/Montserrat","America/Nassau","America/New_York","America/Nipigon","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Nuuk","America/Ojinaga","America/Panama","America/Pangnirtung","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Acre","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rainy_River","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Rosario","America/Santa_Isabel","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Shiprock","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Thunder_Bay","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Virgin","America/Whitehorse","America/Winnipeg","America/Yakutat","America/Yellowknife","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/South_Pole","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Ashkhabad","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Calcutta","Asia/Chita","Asia/Choibalsan","Asia/Chongqing","Asia/Chungking","Asia/Colombo","Asia/Dacca","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Harbin","Asia/Hebron","Asia/Ho_Chi_Minh","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Istanbul","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Kashgar","Asia/Kathmandu","Asia/Katmandu","Asia/Khandyga","Asia/Kolkata","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macao","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Saigon","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Tel_Aviv","Asia/Thimbu","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ujung_Pandang","Asia/Ulaanbaatar","Asia/Ulan_Bator","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yangon","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faeroe","Atlantic/Faroe","Atlantic/Jan_Mayen","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/ACT","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Canberra","Australia/Currie","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/LHI","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/NSW","Australia/North","Australia/Perth","Australia/Queensland","Australia/South","Australia/Sydney","Australia/Tasmania","Australia/Victoria","Australia/West","Australia/Yancowinna","Brazil/Acre","Brazil/DeNoronha","Brazil/East","Brazil/West","CET","CST6CDT","Canada/Atlantic","Canada/Central","Canada/Eastern","Canada/Mountain","Canada/Newfoundland","Canada/Pacific","Canada/Saskatchewan","Canada/Yukon","Chile/Continental","Chile/EasterIsland","Cuba","EET","EST","EST5EDT","Egypt","Eire","Etc/GMT","Etc/GMT+0","Etc/GMT+1","Etc/GMT+10","Etc/GMT+11","Etc/GMT+12","Etc/GMT+2","Etc/GMT+3","Etc/GMT+4","Etc/GMT+5","Etc/GMT+6","Etc/GMT+7","Etc/GMT+8","Etc/GMT+9","Etc/GMT-0","Etc/GMT-1","Etc/GMT-10","Etc/GMT-11","Etc/GMT-12","Etc/GMT-13","Etc/GMT-14","Etc/GMT-2","Etc/GMT-3","Etc/GMT-4","Etc/GMT-5","Etc/GMT-6","Etc/GMT-7","Etc/GMT-8","Etc/GMT-9","Etc/GMT0","Etc/Greenwich","Etc/UCT","Etc/UTC","Etc/Universal","Etc/Zulu","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belfast","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Kyiv","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Nicosia","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Tiraspol","Europe/Ulyanovsk","Europe/Uzhgorod","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zaporozhye","Europe/Zurich","Factory","GB","GB-Eire","GMT","GMT+0","GMT-0","GMT0","Greenwich","HST","Hongkong","Iceland","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Iran","Israel","Jamaica","Japan","Kwajalein","Libya","MET","MST","MST7MDT","Mexico/BajaNorte","Mexico/BajaSur","Mexico/General","NZ","NZ-CHAT","Navajo","PRC","PST8PDT","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Chuuk","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Johnston","Pacific/Kanton","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Pohnpei","Pacific/Ponape","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Samoa","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Truk","Pacific/Wake","Pacific/Wallis","Pacific/Yap","Poland","Portugal","ROC","ROK","Singapore","Turkey","UCT","US/Alaska","US/Aleutian","US/Arizona","US/Central","US/East-Indiana","US/Eastern","US/Hawaii","US/Indiana-Starke","US/Michigan","US/Mountain","US/Pacific","US/Samoa","UTC","Universal","W-SU","WET","Zulu"]).describe("Timezones allowed"),at=o.object({allow_timestamps:o.boolean().describe("Allow setting timestamps in transfer insert/update statements"),production:o.boolean().describe("Is running in production mode?")}).partial().describe("System wide flags"),Ed=o.enum(["Token","TransferGroup","TransferLog","Transfer","WalletTokenSetting","Wallet","WapiSetting"]),rg=Y(Ed.options),hi=o.enum(["="]),Ti=o.enum([">=","<=","<",">"]),xu=o.enum(["like","ilike"]),ag=o.enum([...hi.options,...Ti.options]).default("="),ng=o.enum([...hi.options,...Ti.options,...xu.options]).default("="),yu=o.enum([...hi.options,...Ti.options,...xu.options]),Bt=o.union([o.string(),o.boolean(),o.number()]),Gd=o.object({foreign:o.union([o.string(),o.number()])}),Cd=o.object({identifier:o.union([o.string(),o.number()])}),Se=o.string().regex(/^(?!.*\.\.)[a-zA-Z_][a-zA-Z0-9_.-]*[a-zA-Z0-9_-]$/,"Key is limited to [a-zA-Z0-9_-] and cant start with a number"),bu=o.union([o.string().array().min(1),o.number().array().min(1)]),Q=o.record(Se,Bt).describe("Metadata filter for custom properties"),Ke=o.enum(["where","orWhere"]),og=Y(Ke.options),gi=o.enum(["whereNull","orWhereNull","whereNotNull","orWhereNotNull"]),ig=Y(gi.options),xi=o.enum(["whereIn","orWhereIn"]),sg=Y(xi.options),yi=o.enum(["whereMetadata","orWhereMetadata"]),pg=Y(yi.options),bi=o.enum(["whereMetadataNull","orWhereMetadataNull","whereMetadataNotNull","orWhereMetadataNotNull"]),ug=Y(bi.options),Si=o.enum(["whereMetadataIn","orWhereMetadataIn"]),cg=Y(Si.options),ha=o.enum(["=",">=","<=","<",">","ilike","like"]).default("="),Wd=o.object({function:Ke,field:Se,operator:ha.optional(),value:Bt}).describe("Filtering for where and orWhere"),Nd=o.union([Bt,Gd]),lg=o.object({function:Ke,field:Se,operator:ha.optional(),value:Nd}).describe("Filtering for where and orWhere"),Dd=o.union([Bt,Cd]),dg=o.object({function:Ke,field:Se,operator:ha.optional(),value:Dd}).describe("Filtering for where and orWhere"),Bd=o.object({function:yi,field:Se,operator:ha.optional(),value:Bt}).required({function:!0,field:!0,value:!0}).describe("Filtering for where and orWhere"),jd=o.object({metadata:Q.optional()}).catchall(Bt),fg=o.union([Bt,Q]),Pd=o.object({function:Ke,value:jd}),Vd=o.union([Wd,Pd]),Zd=o.object({function:xi,field:Se,value:bu}),Ud=o.object({function:Si,field:Se,value:bu}),Ld=o.object({function:gi,field:Se}).describe("Filtering for whereNull and orWhereNull, whereNotNull and orWhereNotNull"),$d=o.object({function:bi,field:Se}).describe("Filtering for whereNull and orWhereNull, whereNotNull and orWhereNotNull for metadata"),Su=o.discriminatedUnion("function",[Bd,Ud,$d]),Ou=o.union([Vd,Zd,Ld,Su,o.object({function:Ke,inner:o.lazy(()=>Ou.array())})]),mg=o.object({function:Ke,inner:Ou.array()}),qd=o.union([Ke,xi,gi,yi,Si,bi]),zd=o.object({function:qd,field:Se.optional(),operator:ha.optional(),value:o.unknown().optional(),inner:o.unknown().array().optional()}),Hd=o.object({function:Ke,inner:o.unknown().array()});function dt(r,e,t){let a=e.safeParse(r);return a.success||a.error.errors.forEach(n=>{t.addIssue(S(c({},n),{message:"complex_error:"+n.message}))}),a.success}function Je(r,e){let t=e.required(),a=t.keyof(),n=o.object({function:Ke,value:r}),i=(s,u)=>{if(!dt(s,zd,u))return!1;let l=s;if(l.inner)return dt(l,Hd,u)?!l.inner.some(d=>{if(i(d,u)===!1)return!0}):!1;if(!l.field)return dt(l,n,u);if(l.function.toLowerCase().includes("metadata"))return dt(l,Su,u);if(!dt(l.field,a,u)||!t.shape[l.field])return!1;if(l.function.toLowerCase().includes("null"))return!0;if(t.shape[l.field]._def.typeName==="ZodEnum"&&(!Array.isArray(l.value)&&!dt(l.value,t.shape[l.field],u)||Array.isArray(l.value)&&!dt(l.value,t.shape[l.field].array(),u)))return!1};return o.record(Se,o.unknown()).superRefine((s,u)=>s.function?i(s,u):dt(s,r,u))}var Ze=o.union([o.string(),o.number()]).transform(r=>String(r)),Te=o.union([o.string().regex(/^[1-9][0-9]*$/,"invalid integer"),o.number().int().positive()]).transform(r=>Number(r)),dr=o.union([o.string().regex(/^-{0,1}((0\.\d+)|([1-9]\d*(\.\d+){0,1}))$/,"invalid number"),o.number()]).transform(r=>parseFloat(String(r))),Oi=o.object({tracking_id:o.string().max(64).describe("User provided id added to logs for debugging")}).describe("Tracking flags for input"),x=Oi.extend({transaction_id:o.string().max(64).describe("Id of the transaction context to run the query in")}).describe("Generic flags for input"),le=o.object({limit:o.number().int().nonnegative().default(20).describe("Number of records to return"),offset:o.number().int().nonnegative().default(0).describe("Number of records to omit from the beginning")}).describe("Optional flags for input limiting"),Oe=o.object({return_metadata_total:o.boolean().describe("Return the total rows count in metadata")}).describe("Metadata flags for input"),Kd=o.enum(["asc","desc"]).describe("Direction to order"),Jd=o.enum(["first","last"]).describe("Should nulls be first or last"),Fe=o.object({field:o.string().describe("Field to order by"),direction:Kd.default("asc"),nulls:Jd}).strict().partial().required({field:!0}).describe("Input for orderBy"),_u=o.object({order:Fe.array().describe("Ordering options")}).describe("Optional flags for input ordering"),Fu=o.object({id:o.number().int().positive().describe("id of the object"),foreign:o.string().max(255).describe("foreign of the object")}).strict().partial(),fr=o.union([Fu.required({id:!0}),Fu.required({foreign:!0})]),Iu=o.object({id:o.number().int().positive().describe("id of the object"),identifier:o.string().max(255).describe("identifier of the object")}).strict().partial(),nn=o.union([Iu.required({id:!0}),Iu.required({identifier:!0})]),jt=o.enum(["replace","extend"]).default("replace").describe("Whether to replace or extend current metadata with new value"),Pt=o.enum(["replace","replace_create_only","replace_cancel_only","extend","extend_create_only","extend_cancel_only"]).default("replace").describe("Whether to replace or extend current metadata with new value"),Fi=o.enum(["keep","random","largest","target"]).describe("Rule for distribution grouping"),bg=Y(Fi.options),Ge=o.object({total:o.number().int().nonnegative().describe("Total number of records matching the query"),offset:o.number().int().nonnegative().describe("Current query offset"),limit:o.number().int().nonnegative().describe("Current query limit"),more_rows:o.boolean().describe("Boolean showing if there would be more rows to return with a higher offset/limit"),order:Fe.array()}).partial().required({offset:!0,limit:!0,more_rows:!0}).describe("Metadata about the search"),on=o.enum(["count","countDistinct","sum","average","min","max"]).default("count").describe("Function to use for grouping"),Ii=o.object({function:on,field:Se.describe("Field to group by"),alias:Se.describe("Alias to group under")}).partial().describe("Function and field to group"),_i=o.union([on,Ii]).describe("Aggregator description"),Ta=o.enum(["year","month","week","day","hour","minute"]).describe("Time period rows should be grouped by"),vu=Y(Ta.options),Qd=o.object({period:Ta.default("day"),timezone:an}).strict().required(),Yd=o.union([Ta,Qd]),ga=o.object({type:o.literal("period"),field:Yd,alias:o.string()}).strict().partial().required({type:!0,field:!0}),xa=o.object({type:o.literal("field"),field:o.string(),alias:o.string()}).strict().partial().required({type:!0,field:!0}),ya=o.object({type:o.literal("metadata_field"),field:o.string(),alias:o.string()}).strict().partial().required({type:!0,field:!0}),Xd=o.discriminatedUnion("type",[ga,xa,ya]);var ef=Xd.array().max(5),tf=o.record(o.string(),o.union([o.string(),o.number()]).nullable()).describe("Result of the aggregation"),sn=tf.array().describe("Results of the aggregation"),ku=o.object({aggregators:_i.array(),groups:ef}).partial().required({groups:!0}).describe("Metadata about the aggregation"),Sg=o.object({select:o.string().array()}).describe("Optional flags to select specific fields"),Og=o.object({deselect:o.string().array()}).describe('Optional flag to remove field from select"'),Qe=o.object({start_time:M,end_time:M}).partial().strict();var ft=o.enum(["active","disabled"]).describe("Current status for the wallet"),wu=Y(ft.options),mt=o.enum(["token","house","regular"]).describe("Type of the wallet"),Ru=Y(mt.options),Z=o.object({id:o.number().int().positive().describe("System defined primary key"),foreign:o.string().min(1).max(255).describe("User provided key for wallet. Must be unique"),name:o.string().min(1).max(255).optional().nullable().describe("User provided key for wallet. Must be unique"),metadata:He.describe("Key/value object describing this wallet").optional(),default_allow_negative:o.boolean().default(!1).describe("Boolean indicating if wallet (pending_amount + finished_amount) can be negative"),default_allow_positive:o.boolean().default(!0).describe("Boolean indicating if wallet (pending_amount + finished_amount) can be positive. Used for token balance to deny positive balance."),created_at:M.describe("Datetime of the initial create"),updated_at:M.describe("Datetime of the last update"),default_dtw_to:o.string().max(3).optional().describe("Bitmap indicating default what types of transfers can originate from wallet"),default_dtw_from:o.string().max(3).optional().describe("Bitmap indicating default what types of transfers can end to wallet"),type:mt.describe("Type of the wallet").default("regular"),status:ft.describe("Current status for the wallet").default("active")}).strict().describe("Wallet|Entities who can make transfers in this system");var z=o.enum(["pending","finished","cancelled"]).describe("Status of the transfer"),Au=Y(z.options),pe=z.exclude(["cancelled"]).describe("Status of the transfer"),Ce=o.enum(["transfer","deposit","withdrawal"]).describe("Type of the transfer"),Vt=Y(Ce.options),h=o.object({id:o.number().int().positive().describe("System defined primary key"),identifier:o.string().min(1).max(255).describe("Identifier for this transfer. Must be unique"),control_hash:o.string().max(255).nullable().describe('Hash binding this transfer to the from_wallets transfer chain. It is calculated as sha256(latest_outgoing_hash + "-" + NEW.identifier)'),from_wallet_id:o.number().int().positive().describe("Foreign key to wallet funds originate from"),to_wallet_id:o.number().int().positive().describe("Foreign key to wallet where funds are going"),token_id:o.number().int().positive().describe("Foreign key to token this transfer refers to"),amount:o.number().positive().describe("The transfer amount"),type:Ce.describe("Type of the transfer").default("transfer"),status:z.describe("Status of the transfer").default("pending"),force:o.boolean().default(!1).describe("Set to true to force transfer without checking for negative balance constraints"),auto_hash:o.boolean().default(!0).describe("When set to true it will automatically calculate the control_hash"),created_at:M.describe("Datetime of the initial create"),updated_at:M.describe("Datetime of the last update"),metadata:He.describe("Key/value object describing this transfer").optional(),transfer_group_id:o.number().int().positive().nullable().optional().describe("Foreign key pointing to the transfer_group this transfer belongs to"),reverses_id:o.number().int().positive().nullable().optional().describe("Foreign key pointing to the transfer this transfer reverses. Must be unique"),status_finalized_at:M.nullable().optional().describe("DateTime transfer reached final status"),group_validate:o.boolean().nullable().optional().describe("Boolean showing if the transfer_group has validate_final_balance_only")}).strict().describe("A transfer of value from one wallet to another"),Mg=h.omit({id:!0}).extend({status:pe.default("pending")}).partial().required({identifier:!0,from_wallet_id:!0,to_wallet_id:!0,token_id:!0,amount:!0});var E=o.object({id:o.number().int().positive().describe("UNIQUE|System defined primary key"),transfer_id:o.number().int().positive().describe("Foreign key pointing to the transfer this log belongs to"),wallet_id:o.number().int().positive().describe("Foreign key pointing to the wallet this log belongs to"),token_id:o.number().int().positive().describe("Foreign key pointing to the token this log belongs to"),amount:o.number().describe("The amount the wallet balance is changed by"),pending_amount:o.number().describe("The pending balance of wallet after this transfer_log"),finished_amount:o.number().describe("The finished balance of wallet after this transfer_log"),allow_negative:o.boolean().default(!1).describe("Boolean indicating if wallet (pending_amount + finished_amount) can be negative"),allow_positive:o.boolean().default(!0).describe("Boolean indicating if wallet (pending_amount + finished_amount) can be positive. Used for token balance to deny positive balance."),force:o.boolean().default(!1).describe("Boolean indicating if the latest transfer from this wallet was forced to ignore negative balance checks"),created_at:M.describe("Datetime this log was created"),latest_control_hash:o.string().max(255).nullable().describe("Latest hash related to this wallet"),pending_amount_to:o.number().describe("The incoming pending balance"),pending_amount_from:o.number().describe("The outgoing pending balance"),group_balance:o.number().nullable().describe("Running balance for the wallet in this group"),transfer_group_id:o.number().int().positive().nullable().optional().describe("Foreign key pointing to the transfer_group this transfer_log belongs to"),current:o.boolean().describe("Boolean showing if this transfer_log is the latest for this wallet/token combination"),available_balance:o.number().describe("Available balance that is sum of pending_amount_from and finished_amount"),token_limit:o.number().nullable().describe("If wallet = token.belongs_to and token has limit"),status:z.describe("Status of this log - same as Transfer.status"),type:Ce.describe("Type of this log - same as Transfer.type")}).strict().describe("TransferLog|Individual parts of a transfer, will be updated internally by db. Immutable");var Mu=o.enum(["active","dw-only","disabled"]).describe("Current status for the token"),Eu=Y(Mu.options),ht=o.enum(["value","share","group","contract"]).describe("Type of the token"),Gu=Y(ht.options),P=o.object({id:o.number().int().positive().describe("System defined primary key"),foreign:o.string().min(1).max(255).describe("Name of the token, used for name based token transfers. Must be unique"),public:o.boolean().describe("Boolean indicating if token can be traded with outside seed wallet").default(!0),belongs_to:o.number().int().positive().describe("Foreign key to seed wallet"),metadata:He.describe("Key/value object describing the token").optional(),divisor:o.number().nullable().describe("Minimum amount of token that can be transferred").optional(),limit:o.number().nullable().describe("Maximum amount of token that can be issued").optional(),type:ht.describe("Type of the token").default("value"),status:Mu.describe("Current status for the token").default("active"),created_at:M.describe("Datetime when the token was created"),updated_at:M.describe("Datetime when the token was last updated")}).strict().describe("Units of value which can be transferred in this system");var H=fr.describe("Unique wallet filter"),ba=x.extend({ignore_cache:o.boolean().describe("Ignore cached information"),create_if_not_exists:o.boolean().default(!1).describe("If true then the token will be created if not found. Only valid with 'foreign'"),return_only_id:o.boolean().default(!1).describe("If true then the returning object is only guaranteed to have id")}).partial(),pn=o.object({wallet:H,options:ba.optional()}).strict().required({wallet:!0}).describe("Input for getWallet"),vi=Z.extend({balance_token_id:P.shape.id.nullable(),balance_token_foreign:P.shape.foreign.nullable(),balance_transfer_id:E.shape.transfer_id.describe("Latest transfer id").nullable(),balance_pending_amount:E.shape.pending_amount.describe("Current pending balance").nullable(),balance_pending_amount_to:E.shape.pending_amount_to.describe("Sum of incoming pending transfers").nullable(),balance_pending_amount_from:E.shape.pending_amount_from.describe("Sum of outgoing pending transfers").nullable(),balance_finished_amount:E.shape.finished_amount.describe("Current finished balance").nullable(),balance_amount:o.number().describe("Current finished and pending balance sum").nullable(),balance_available_balance:E.shape.available_balance.describe("Available balance that is sum of pending_amount_from and finished_amount").nullable(),balance_latest_control_hash:E.shape.latest_control_hash.describe("Latest control_hash associated with wallet token combination").nullable(),balance_updated_at:E.shape.created_at.describe('"Last modification date of balance').nullable()}),un=vi.keyof(),ki=Z.partial().required({id:!0}),cn=o.object({wallet:ki.optional()}).describe("Output of getWallet");var We=o.enum(["open","closed"]).describe("Lifecycle status for transfer group"),ln=Y(We.options),Tt=o.enum(["regular","exchange","distribution"]).describe("Type of the transfer group"),Cu=Y(Tt.options),D=o.object({id:o.number().int().positive().describe("UNIQUE|System defined primary key"),identifier:o.string().min(1).max(255).describe("UNIQUE,INPUT|Identifier for this transfer group. Must be unique"),created_at:M.describe("Datetime of the initial create"),updated_at:M.describe("Datetime of the last update"),metadata:He.describe("INPUT|Key/value object describing this transfer_group").optional(),transfer_group_id:o.number().int().positive().nullable().optional().describe("Foreign key pointing to the transfer_group this transfer belongs to"),reverses_id:o.number().int().positive().nullable().optional().describe("Foreign key pointing to the transfer_group this transfer_group reverses. Must be unique"),status_finalized_at:M.nullable().optional().describe("Time transfer_group was closed"),transfer_status_finalized_at:M.nullable().optional().describe("Time transfer_status reached final state"),validate_final_balance_only:o.boolean().nullable().optional().describe("Boolean if only the final balances of wallets should be validated"),transfer_status:o.enum(["pending","finished","cancelled"]).describe("INPUT|Status of the transfers").default("pending"),status:We.describe("INPUT|Lifecycle status for transfer group").default("open"),type:Tt.describe("INPUT|Type of the transfer group").default("regular")}).strict().describe("TransferGroup|An entity collecting transfers into a group locked by status");var nt=nn.describe("Unique transfer filter"),wi=x.partial(),dn=o.object({transfer:nt,options:wi.optional()}).strict().required({transfer:!0}).describe("Input for getTransfer"),ue=h.extend({from_wallet_foreign:Z.shape.foreign,to_wallet_foreign:Z.shape.foreign,token_foreign:P.shape.foreign,transfer_group_identifier:D.shape.identifier.nullable(),reverses_identifier:h.shape.identifier.nullable()}),Wu=ue.extend({balance_id:E.shape.id.nullable().describe("Iterator marking the position of the balance in the continuum"),balance_pending:E.shape.pending_amount.nullable().describe("Wallet pending balance after transfer"),balance_pending_to:E.shape.pending_amount_to.nullable().describe("Wallet pending_to balance after transfer"),balance_pending_from:E.shape.pending_amount_from.nullable().describe("Wallet pending_from balance after transfer"),balance_finished:E.shape.finished_amount.nullable().describe("Wallet finished balance after transfer"),signed_amount:E.shape.amount.nullable().describe("amount with a sign according to transfer direction"),status_finalized_at:E.shape.created_at.nullable().describe("DateTime transfer reached final status")}),Ne=o.object({transfer:ue.optional()}).describe("Output of getTransfer");var ne=fr.describe("Unique token filter"),cx=P.partial().required({id:!0}),fn=P.extend({belongs_to_foreign:Z.shape.foreign.describe("Wallet the token belongs to").nullable(),balance_transfer_id:E.shape.transfer_id.nullable().describe("Latest transfer id"),balance_pending_amount:E.shape.pending_amount.nullable().describe("Current pending balance"),balance_pending_amount_to:E.shape.pending_amount_to.nullable().describe("Sum of incoming pending transfers"),balance_pending_amount_from:E.shape.pending_amount_from.nullable().describe("Sum of outgoing pending transfers"),balance_finished_amount:E.shape.finished_amount.nullable().describe("Current finished balance"),balance_amount:o.number().nullable().describe("Current finished and pending balance sum"),balance_available_balance:E.shape.available_balance.nullable().describe("Available balance that is sum of pending_amount_from and finished_amount"),balance_latest_control_hash:E.shape.latest_control_hash.nullable().describe("Latest control_hash associated with wallet token combination"),balance_updated_at:E.shape.created_at.nullable().describe('"Last modification date of balance')}),Ri=fn.keyof(),Sa=x.extend({ignore_cache:o.boolean().describe("Ignore cached information"),create_if_not_exists:o.boolean().default(!1).describe("If true then the token will be created if not found. Only valid with 'foreign'"),return_only_id:o.boolean().default(!1).describe("If true then the returning object is only guaranteed to have id"),include_balance:o.boolean().default(!1).describe("Return the total system balance of token")}).partial(),mn=o.object({token:ne,options:Sa.optional()}).strict().required({token:!0}).describe("Input for getToken"),Ai=fn.partial().required({id:!0}),hn=o.object({token:Ai.optional()}).describe("Output of getToken");var ge=nn.describe("Unique transferGroup filter"),Mi=x.extend({create_if_not_exists:o.boolean().default(!1).describe("If true then the transfer_group will be created if not found. Only valid with 'identifier'"),return_only_id:o.boolean().default(!1).describe("If true then the returning object is only guaranteed to have id")}).partial(),Tn=o.object({transfer_group:ge,options:Mi.optional()}).strict().required({transfer_group:!0}).describe("Input for getTransferGroup"),Oa=D.extend({reverses_identifier:D.shape.identifier.nullable().describe("Identifier of the transfer group this reverses")}).partial().required({id:!0}).describe("requested transfer_group"),gn=o.object({transfer_group:Oa.optional()}).describe("Output of getTransferGroup");var Ei=o.object({return_running_balance_for_wallet:H.describe("Return running balance for each transfer for wallet in question"),return_signed_amount_for_wallet:H.describe("Return amount as signed value for each transfer for wallet in question")}),Fa=x.merge(le).merge(Oe).merge(Ei).extend({order:Fe.extend({field:h.keyof()}).array(),select:ue.keyof().array(),deselect:ue.keyof().array()}).partial(),Gi=o.object({id:Te.describe("Transfer id"),identifier:Ze.describe("Transfer identifier"),from_wallet:H,to_wallet:H,wallet:H,token:ne,type:Ce,status:z,transfer_group:ge,reverses:nt,metadata:Q,amount:dr.describe("Transfer amount")}).partial(),Re=Gi.merge(h.pick({created_at:!0,updated_at:!0,status_finalized_at:!0})).extend({from_wallet_id:Te.describe("Debited Wallet id"),to_wallet_id:Te.describe("Credited Wallet id"),token_id:Te.describe("Transferred Token id"),transfer_group_id:Te.describe("TransferGroup id the transfer is a part of"),reverses_id:Te.describe("Reversed Transfer id")}).partial(),rf=Je(Gi,Re),Zt=o.union([Gi,rf.array()]),mr=o.object({transfer:Zt,options:Fa.optional()}).strict().partial().describe("Input for findTransferMany"),xn=o.object({transfers:Wu.partial().array().describe("Found transfers"),metadata:Ge}).partial().required({transfers:!0,metadata:!0}).describe("Output of findTransferMany");var af=o.object({return_all_intervals:Qe.describe("Add empty values for each interval if no matching data")}).partial(),Ci=x.merge(af).partial().optional(),Wi=o.enum(["from.amount","to.amount","amount","abs.amount","transfer_group","from_wallet","to_wallet","wallet","token","id"]).describe("Field to aggregate"),nf=Ii.extend({field:Wi}).partial(),of=o.union([nf,on]),Ni=o.enum(["type","status","from_wallet","to_wallet","wallet","token","transfer_group"]).describe("Field to group by"),sf=o.union([ga,xa.extend({field:Ni}),ya]),yn=o.object({transfer:Zt,aggregators:of.array(),groups:sf.array(),options:Ci}).partial().required({aggregators:!0}).describe("Input for aggregateTransferMany"),bn=o.object({rows:sn,metadata:ku}).partial().describe("Output of getToken");var pf=x.partial(),Sn=o.object({options:pf}).strict().partial().describe('Input for authenticationCheck"'),Nu=o.object({}).describe("Output of authenticationCheck");var uf=o.object({wallet_foreign:Z.shape.foreign,from_wallet_foreign:Z.shape.foreign,to_wallet_foreign:Z.shape.foreign,token_foreign:P.shape.foreign}).partial().describe("Forced filters for requests"),Di=o.enum(["aggregateTransferMany","exportBalanceHistory","exportTokenMany","exportTransferGroupMany","exportTransferMany","exportWalletMany","findBalanceMany","findTokenMany","findTransferGroupMany","findTransferMany","findWalletMany","getBalance","getBalanceHistory","getExport","getStatistics","getToken","getTokenMany","getTransfer","getTransferGroup","getWallet","getWalletMany","healthcheck","listExportMany"]).describe("Allowed methods"),Bi=o.object({type:o.enum(["limited"]).describe("Type of the accessToken"),scopes:Di.array(),expiresIn:o.number().int().positive().describe("JWT expiration time in minutes"),filters:uf.optional()}).strict(),ji=o.object({type:o.enum(["admin"]).describe("Type of the accessToken"),expiresIn:o.number().int().positive().describe("JWT expiration time in minutes")}).strict(),Pi=x.partial(),On=o.object({token:o.union([Bi,ji]),options:Pi}).strict().partial().required({token:!0}).describe("Input for createAccessToken"),Fn=o.object({authToken:o.string().describe("The JWT token")}).describe("Output of createAccessToken");var Ia=o.object({wallet:H,token:ne,datetime:M.describe("Time the balance should be retrieved at").optional()}).strict(),Vi=x.extend({ignore_cache:o.boolean().describe("Ignore cached information"),create_wallet_if_not_exists:o.boolean().default(!1).describe("If true then the missing wallet will be created if not found. Only valid with 'foreign'"),create_token_if_not_exists:o.boolean().default(!1).describe("If true then the missing token will be created if not found. Only valid with 'foreign'"),create_if_not_exists:o.boolean().default(!1).describe("If true then the missing balance will be created if not found.")}).partial(),In=o.object({balance:Ia,options:Vi}).partial().strict().required({balance:!0}).describe("Input for getBalance"),Ut=E.pick({transfer_id:!0,token_id:!0,wallet_id:!0,pending_amount:!0,pending_amount_from:!0,pending_amount_to:!0,available_balance:!0,finished_amount:!0,latest_control_hash:!0}).extend({token_foreign:P.shape.foreign,wallet_foreign:Z.shape.foreign,amount:o.number().describe("Current finished and pending balance sum"),updated_at:E.shape.created_at}).strict().partial().required({token_id:!0,token_foreign:!0,wallet_id:!0,wallet_foreign:!0,pending_amount:!0,finished_amount:!0,amount:!0,latest_control_hash:!0,updated_at:!0}),Ye=o.object({balance:Ut.optional()}).strict().describe("Output of getBalance");var gt=o.object({identifier:h.shape.identifier,latest_control_hash:h.shape.control_hash.nullable().describe("Latest control_hash on the from_wallet"),from_wallet:H.describe("Wallet where funds are debited"),to_wallet:H.describe("Wallet where funds are credited"),token:ne.describe("Token that is moved"),amount:h.shape.amount,type:h.shape.type,status:pe,force:h.shape.force,metadata:h.shape.metadata,transfer_group:ge.describe("TransferGroup the transfer belongs to"),created_at:h.shape.created_at}).strict(),_n=gt.extend({type:o.literal("transfer").default("transfer").describe("Type of transfer")}).partial().strict().required({from_wallet:!0,to_wallet:!0,token:!0,amount:!0}),hr=gt.partial().extend({type:o.literal("deposit").describe("Type of transfer")}).strict().required({to_wallet:!0,token:!0,amount:!0}),Tr=gt.partial().extend({type:o.literal("withdrawal").describe("Type of transfer")}).strict().required({from_wallet:!0,token:!0,amount:!0}),Zi=o.union([_n,hr,Tr]).pipe(o.union([_n,hr,Tr])),ot=x.extend({return_from_balance:o.boolean().default(!1).describe("Whether the request should also return from wallet balance"),return_to_balance:o.boolean().default(!1).describe("Whether the request should also return to wallet balance"),create_to_wallet_if_not_exists:o.boolean().default(!1).describe("If true then the wallet will be created if not found. Only valid with 'foreign'")}).partial().optional(),vn=o.object({transfer:Zi,options:ot}).strict().required({transfer:!0}).describe("Input for createTransfer"),xt=o.object({transfer:Ne.shape.transfer.describe("Created transfer object"),from_balance:Ye.shape.balance.describe("Debited wallet balance"),to_balance:Ye.shape.balance.describe("Credited wallet balance")}).partial().strict().required({transfer:!0}).describe("Output of createTransfer");var cf=_n.omit({status:!0,transfer_group:!0}).strip(),lf=hr.omit({status:!0,transfer_group:!0}).strip(),df=Tr.omit({status:!0,transfer_group:!0}).strip(),ff=o.union([cf,lf,df]),Ui=o.object({identifier:D.shape.identifier,status:We,transfer_status:z,metadata:D.shape.metadata,children:ff.array().describe("Array of children")}).partial(),Li=x.extend({create_to_wallet_if_not_exists:o.boolean().default(!1).describe("If true then the wallet will be created if not found. Only valid with 'foreign'"),validate_final_balance_only:o.boolean().default(!1).describe("If true then transfers within a group will ignore balance restrictions. Only final transfers for wallets are checked. Only valid with transfer_status_lock")}).partial().optional(),kn=o.object({transfer_group:Ui,options:Li}).strict().partial().describe("Input for createTransferGroup"),yt=o.object({transfer_group:D,transfers:Ne.shape.transfer.array().describe("Created transfer objects")}).partial().required({transfer_group:!0}).describe("Output of createTransferGroup");var $i=x.extend({return_all_intervals:Qe.describe("Add empty values for each interval if no matching data")}).partial().optional(),mf=o.object({from_wallet:H.describe("Wallet the contract will belong to at the end (buyer)"),from_latest_control_hash:h.shape.control_hash.nullable().describe("Latest control_hash on the from_wallet+from_token combo"),from_token:ne.describe("Token that is transferred from from_wallet in exchange of the contract"),to_wallet:H.describe("Wallet the payment for the contract is sent to (seller)"),amount:h.shape.amount,status:o.enum(["pending","finished"]).describe("The state at which the exchange is created"),force:h.shape.force,metadata:h.shape.metadata}).partial().strict().required({from_wallet:!0,from_token:!0,amount:!0}),hf=o.object({foreign:P.shape.foreign,metadata:P.shape.metadata,deposits:o.object({token:ne.describe("Token that is transferred"),amount:h.shape.amount}).array().nonempty(),owner:H.describe("The inital owner of the contract, defaults to foreign = 'house'").default({foreign:"house"})}).partial().required({foreign:!0,deposits:!0}),wn=o.object({token:hf,exchange:mf,options:$i}).strict().partial().required({token:!0}).describe("Input for createContract"),Rn=o.object({token:P,exchange:yt}).partial().required({token:!0}).describe("Output of createContract");var Tf=ot,An=o.object({deposit:hr.extend({type:o.literal("deposit").optional()}),options:Tf}).strict().required({deposit:!0}).describe("Input for createDeposit"),Mn=xt.describe("Output of createDeposit");var gf=o.object({wallet:H.describe("Wallet where funds are credited"),portion:o.union([o.string(),o.number()]).describe("Number specifying the portion of funds to be credited"),metadata:h.shape.metadata}).partial().required({wallet:!0}),xf=ne.describe("Wallets will receive funds based on their balance of this token"),yf=o.object({rule:Fi,target:o.object({wallet:H,metadata:h.shape.metadata}).strict().partial().required({wallet:!0})}).strict().partial().required({rule:!0}),bf=o.object({identifier:D.shape.identifier.describe("Unique identifier for this distribution"),latest_control_hash:h.shape.control_hash.nullable().describe("Latest control_hash on the from_wallet"),from_wallet:H.describe("Wallet where funds are debited"),token:ne.describe("Token that is moved"),amount:h.shape.amount,status:z,force:h.shape.force,metadata:h.shape.metadata,copy_wallet_metadata_fields:o.object({from_property:o.string(),to_property:o.string()}).partial().required({from_property:!0}).array().describe("Copy metadata information from Wallet metadata to transfer metadata"),transfer_group:ge.describe("TransferGroup the transfer belongs to"),targets:o.union([xf,gf.array().nonempty()]),leftover:yf}).partial().required({identifier:!0,from_wallet:!0,token:!0,amount:!0,targets:!0,leftover:!0}).describe("Distribute funds from one wallet between multiple wallets"),Sf=x.extend({dryrun:o.boolean().default(!1)}).partial().optional(),En=o.object({distribution:bf,options:Sf}).strict().partial().required({distribution:!0}).describe("Input for createDistribution"),Du=o.object({transfer_group:D,transfers:Ne.shape.transfer.array().describe("Created transfer objects")}).partial().required({transfer_group:!0,transfers:!0}).describe("Output of createDistribution");var qi=o.object({foreign:P.shape.foreign,public:P.shape.public,metadata:P.shape.metadata,divisor:P.shape.divisor,limit:P.shape.limit,type:ht,belongs_to:fr.describe("Wallet this token belongs_to")}).partial().required({foreign:!0}),zi=x.partial(),Gn=o.object({token:qi,options:zi.optional()}).strict().required({token:!0}).describe("Input for createToken"),Cn=o.object({token:P,wallet:Z}).describe("Output of createToken");var Hi=ot,Wn=o.object({transfers:Zi.array().nonempty().describe("An array of transfers"),options:Hi}).strict().required({transfers:!0}).describe("Input for createTransferMany"),Nn=o.object({transfers:Ne.shape.transfer.array().describe("Created transfer objects"),from_balances:Ye.shape.balance.array().describe("Debited wallet balances"),to_balances:Ye.shape.balance.array().describe("Credited wallet balances")}).partial().strict().required({transfers:!0}).describe("Output of createTransferMany");var Ki=o.object({foreign:Z.shape.foreign,name:Z.shape.name,metadata:Z.shape.metadata,type:mt,status:ft}).partial().required({foreign:!0}),Ji=x.partial(),Dn=o.object({wallet:Ki,options:Ji}).partial().strict().required({wallet:!0}).describe("Input for createWallet"),Bn=o.object({wallet:Z}).describe("Output of createWallet");var jn=o.object({withdrawal:Tr.extend({type:o.literal("withdrawal").optional()}),options:ot}).strict().required({withdrawal:!0}).describe("Input for createWithdrawal"),Pn=xt.describe("Output of createWithdrawal");var Qi=o.enum(["transfers","transfer_groups","tokens","wallets","balance_history","unknown"]).describe("Type of the export"),Of=o.enum(["started","completed","error"]).describe("Status of the export"),_a=o.object({identifier:o.string().describe("Unique identifier of the export"),status:Of,type:Qi,created_at:M.describe("Timestamp when export was initiated"),completed_at:M.describe("Timestamp when export was finished"),fields:o.string().array().describe("The fields selected for this export"),count:o.number().int().positive().describe("The number of entities exported in this file"),signed_url:o.string().describe("Signed URL for downloading the export file"),size:o.string().describe("Size of the exported file"),message:o.string().describe("Extra information about the state of the file")}).partial().required({identifier:!0}).describe("Information about exported file"),Yi=x.extend({return_signed_url:o.boolean().describe("Return signed url for downloading the export file, will only be returned if status === 'completed'")}).partial(),Vn=o.object({export:o.object({identifier:_a.shape.identifier}),options:Yi.optional()}).strict().required({export:!0}).describe("Input for getExport"),Ie=o.object({export:_a.optional()}).describe("Output of getExport");var Ff=o.object({create_wallet_if_not_exists:o.boolean().default(!1).describe("If true then the missing wallet will be created if not found. Only valid with 'foreign'"),create_token_if_not_exists:o.boolean().default(!1).describe("If true then the missing token will be created if not found. Only valid with 'foreign'")}),Bu=o.object({balance_id:E.shape.id.describe("The internal ID of the balance"),token_id:E.shape.token_id.describe("Token ID of balance"),token_foreign:P.shape.foreign.describe("Token Foreign of balance"),wallet_id:E.shape.wallet_id.describe("Wallet ID of balance"),wallet_foreign:Z.shape.foreign.describe("Wallet Foreign of balance"),pending_amount:E.shape.pending_amount.describe("Current pending balance"),pending_amount_to:E.shape.pending_amount_to.describe("Sum of incoming pending transfers"),pending_amount_from:E.shape.pending_amount_from.describe("Sum of outgoing pending transfers"),available_balance:E.shape.available_balance.describe("Available balance that is sum of pending_amount_from and finished_amount"),finished_amount:E.shape.finished_amount.describe("Current finished balance"),amount:o.number().describe("Current finished and pending balance sum"),status:o.enum(["pending","finished"]).describe("The status of the change to balance"),latest_control_hash:E.shape.latest_control_hash.describe("Latest control_hash associated with wallet token combination"),updated_at:E.shape.created_at.describe("Last modification date of balance"),transfer_id:h.shape.id,transfer_identifier:h.shape.identifier,transfer_control_hash:h.shape.control_hash,transfer_from_wallet_id:h.shape.from_wallet_id,transfer_from_wallet_foreign:Z.shape.foreign,transfer_to_wallet_id:h.shape.to_wallet_id,transfer_to_wallet_foreign:Z.shape.foreign,transfer_amount:h.shape.amount,transfer_type:Ce,transfer_status:z,transfer_force:h.shape.force,transfer_created_at:h.shape.created_at,transfer_updated_at:h.shape.updated_at,transfer_metadata:h.shape.metadata,transfer_transfer_group_id:h.shape.transfer_group_id,transfer_transfer_group_identifier:D.shape.identifier.optional().nullable().describe("Transfer Group identifier if transfer belongs to a group"),transfer_reverses_id:h.shape.reverses_id,transfer_reverses_identifier:h.shape.identifier.optional().nullable().describe("Reverses identifier if transfer reverses another transfer"),transfer_status_finalized_at:h.shape.status_finalized_at.nullable().describe("DateTime transfer reached final status")}).strict().partial(),Xi=o.object({order:o.enum(["asc","desc"])}).describe("Ordering options"),If=Bu.keyof(),es=o.object({select:If.array()}).describe("Optional flags to limit search result"),ts=x.merge(le).merge(Oe).merge(Ff).merge(Xi).merge(es).extend({return_all_intervals:Qe.describe("Add empty values for each interval if no matching data")}).partial(),Zn=o.object({balance:Ia,options:ts.optional()}).strict().required({balance:!0}).describe("Input for getBalanceHistory"),Un=o.object({balances:Bu.array().describe("Resolved balance change objects"),metadata:Ge}).required({balances:!0}).describe("Output of getBalanceHistory");var rs=x.merge(le).merge(Oe).merge(es).merge(Xi).partial(),Ln=o.object({balance:Ia,options:rs}).strict().partial().required({balance:!0}).describe("Input for exportBalanceHistory"),$n=o.object({export:Ie.shape.export}).describe("Output of exportBalanceHistory");var va=x.merge(le).merge(Oe).extend({include_balance:o.boolean().describe("Return the total system balance of token"),order:Fe.extend({field:P.keyof()}).array(),select:Ri.array(),deselect:Ri.array()}).partial(),as=o.object({foreign:Ze.describe("foreign identifier"),type:ht,metadata:Q,belongs_to:H}).partial(),ka=as.merge(P.pick({public:!0,status:!0,created_at:!0,updated_at:!0})).extend({id:Te.describe("id of the Token")}).partial(),_f=Je(as,ka),vf=o.union([as,_f.array()]),gr=o.object({token:vf,options:va.optional()}).strict().partial().describe("Input for findTokenMany"),qn=o.object({tokens:fn.partial().array().describe("Found tokens"),metadata:Ge}).partial().required({tokens:!0,metadata:!0}).describe("Output of findTokenMany");var ns=va,zn=gr.extend({options:ns.optional()}).describe("Input of exportTokenMany"),Hn=Ie.describe("Output of exportTokenMany");var os=Oa.extend({transfers_count:o.number().describe("Number of transfers in the group").optional()}),wa=x.merge(le).merge(Oe).extend({return_transfers_count:o.boolean().default(!1).describe("Return number of transfers in the transfer_group"),order:Fe.extend({field:D.keyof()}).array(),select:os.keyof().array(),deselect:os.keyof().array()}).partial(),is=o.object({identifier:Ze.describe("TransferGroup identifier"),status:We,type:Tt,transfer_status:z,reverses:ge,metadata:Q}).partial(),Lt=is.merge(D.pick({status_finalized_at:!0,transfer_status_finalized_at:!0,created_at:!0,updated_at:!0})).extend({id:Te.describe("TransferGroup id"),transfer_group_id:Te.describe("Parent TransferGroup id"),reverses_id:Te.describe("Reversed TransferGroup id")}).partial(),kf=Je(is,Lt),Ra=o.union([is,kf.array()]),xr=o.object({transfer_group:Ra,options:wa}).strict().partial().describe("Input for findTransferGroup"),Kn=o.object({transfer_groups:os.partial().array().describe("Found transfers"),metadata:Ge}).partial().required({transfer_groups:!0,metadata:!0}).describe("Output of findTransferGroup");var wf=wa,Jn=xr.extend({options:wf.optional()}).partial().describe("Input of exportTransferGroupManyMany"),Qn=Ie.describe("Output of exportTransferGroupMany");var Rf=Fa.omit({return_running_balance_for_wallet:!0,return_signed_amount_for_wallet:!0}),Yn=mr.extend({options:Rf.optional()}).describe("Input of exportTransferMany"),Xn=Ie.describe("Output of exportTransferMany");var Aa=x.merge(le).merge(Oe).extend({include_balance_for_token:ne.describe("If specified each wallet will have its balance included"),order:Fe.extend({field:un}).array(),select:un.array(),deselect:un.array()}).partial(),ss=o.object({foreign:Ze.describe("Wallet foreign"),name:o.string(),type:mt,status:ft,metadata:Q}).partial(),Ma=ss.merge(Z.pick({created_at:!0,updated_at:!0})).extend({id:Te.describe("Wallet id"),balance_pending_amount:o.number().nullable(),balance_finished_amount:o.number().nullable(),balance_available_balance:o.number().nullable()}).partial(),Af=Je(ss,Ma),Mf=o.union([ss,Af.array()]),yr=o.object({wallet:Mf,options:Aa}).strict().partial().describe("Input for findWalletMany"),eo=o.object({wallets:vi.partial().nullable().array().describe("Found wallets"),metadata:Ge}).partial().required({wallets:!0,metadata:!0}).describe("Output of findWalletMany");var Ef=Aa,to=yr.extend({options:Ef.optional()}).describe("Input of exportWalletMany"),ro=Ie.describe("Output of exportWalletMany");var ju=Ut.keyof(),ps=x.merge(le).merge(Oe).extend({order:Fe.extend({field:E.keyof()}).array(),select:ju.array(),deselect:ju.array()}).partial(),us=o.object({wallet:H,token:ne,transfer:nt,type:Ce,status:z,amount:dr.describe("Balance amount"),pending_amount:dr.describe("Balance pending_amount"),finished_amount:dr.describe("Balance finished_amount"),metadata:Q}).partial(),cs=us.extend({updated_at:E.shape.created_at}).partial(),Gf=Je(us,cs),Cf=o.union([us,Gf.array()]),ao=o.object({balance:Cf,options:ps.optional()}).strict().partial().describe("Input for findBalanceMany"),no=o.object({balances:Ut.partial().array().describe("Found balances"),metadata:Ge}).partial().required({balances:!0,metadata:!0}).describe("Output of findBalanceMany");var Wf=x.partial().required({transaction_id:!0}),oo=o.object({action:o.enum(["commit","rollback"]).default("commit").describe("Finish transaction with commit/rollback"),options:Wf}).strict().required({action:!0,options:!0}).describe("Input for finishTransaction"),Pu=o.object({success:o.boolean(),message:o.string().optional().describe("Error message when success is false")}).describe("Output of finishTransaction");var ls=x.partial(),io=o.object({options:ls.optional()}).strict().describe("Input for getFlags"),so=o.object({flags:at}).describe("Output of getFlags");var ds=o.enum(["Transfer","TransferGroup","Wallet","Token"]).default("Transfer").describe("Model to return statistics about"),Nf=Qe.extend({status:z}).strict().partial().describe("Filter to apply to transfers before grouping"),Df=o.enum(["type","status","transfer_status"]).default("type").describe("Field to group statistics about. Only used with group_by_field type"),Bf=xa.extend({field:Df}),jf=o.union([ga,ya,Bf]),fs=Oi.partial(),po=o.object({model:ds,groups:jf.array().max(5).describe("Array of grouping definitions"),aggregator:_i,filter:Nf,options:fs}).strict().partial().describe("Input for getStatistics"),Vu=o.object({rows:sn}).describe("Output of getStatistics");var Pf=Sa,uo=o.object({tokens:ne.array(),options:Pf.optional()}).strict().required({tokens:!0}).describe("Input for getTokenMany"),Zu=o.object({tokens:Ai.nullable().array()}).required({tokens:!0}).describe("Output of getTokenMany");var Vf=ba,co=o.object({wallets:H.array(),options:Vf.optional()}).strict().required({wallets:!0}).describe("Input for getWalletMany"),Uu=o.object({wallets:ki.nullable().array()}).required({wallets:!0}).describe("Output of getWalletMany");var ms=x.partial(),lo=o.object({options:ms}).strict().partial().describe("Input for healthcheck"),fo=o.object({status:o.enum(["green","yellow","red"]).describe("Status of the service"),message:o.string().describe("Error message if some error occurred"),database_size:o.string().describe("Size of the database in MB"),indexes_size:o.string().describe("Size of all indexes of database in MB"),connection_count:o.number().describe("Number of external connections to this database"),version:o.string().describe("Version the server is running")}).partial().required({status:!0}).describe("Output of healthcheck");var Zf=x.partial(),Uf=o.object({target:o.literal("wallet"),data:Ki}),Lf=o.object({target:o.literal("token"),data:qi}),$f=Ui.extend({created_at:M.optional(),status_finalized_at:M.optional(),transfer_status_finalized_at:M.optional()}),qf=o.object({target:o.literal("transfer_group"),data:$f}),hs=o.object({identifier:h.shape.identifier,from_wallet:H,to_wallet:H,token:ne,amount:h.shape.amount,metadata:h.shape.metadata,status:z,transfer_group:ge,created_at:M,status_finalized_at:M}),zf=hs.extend({type:o.literal("regular")}).partial().required({from_wallet:!0,to_wallet:!0,token:!0,amount:!0,type:!0}),Hf=hs.extend({type:o.literal("deposit")}).partial().required({to_wallet:!0,token:!0,amount:!0,type:!0}),Kf=hs.extend({type:o.literal("withdrawal")}).partial().required({from_wallet:!0,token:!0,amount:!0,type:!0}),Jf=o.union([zf,Hf,Kf]),Qf=o.object({target:o.literal("transfer"),data:Jf}),Yf=o.union([Uf,Lf,qf,Qf]),br=o.object({actions:Yf.array().describe("Array of actions to import."),options:Zf}).partial().required({actions:!0}).describe("Input for importActions"),Lu=o.object({progress:o.unknown().array(),erroneous:o.unknown().array()}).partial().describe("Output of importActions");var Xf=o.object({order:Fe.extend({field:o.enum(["identifier","completed_at","created_at"])}).array()}),Ts=x.merge(le).merge(Xf).partial(),mo=o.object({export:o.object({date:M.describe("Date the file was created on"),type:_a.shape.type.describe("Entity that was exported")}).partial(),options:Ts}).partial().describe("Input for listExportMany"),ho=o.object({exports:_a.array()}).describe("Output of listExportMany");var em=x.extend({exact_level:o.boolean().describe("Should query be limited to exactly defined level or greater than")}).partial(),To=o.object({startTime:M.describe("Log entries start time"),endTime:M.describe("Log entries end time"),tracking_id:o.string(),level:o.enum(["debug","info","warning","error"]),options:em}).partial().describe("Input for queryLogs"),tm=o.object({level:o.enum(["debug","info","warning","error"]),timestamp:o.string(),payload:o.record(o.string(),o.unknown())}),$u=o.object({logs:tm.array()}).required({logs:!0}).describe("Output of queryLogs");var rm=x.partial(),go=o.object({confirmation:o.string().describe("hash to confirm database delete"),version:o.string().describe("target semver for the database"),options:rm}).strict().partial().describe("Input for resetDatabase"),qu=o.object({message:o.string().describe("Message about operation"),confirmation:o.string().describe("confirmation hash to resend")}).partial().describe("Output of resetDatabase");var $t=h.pick({metadata:!0,status:!0,updated_at:!0}).extend({extend_metadata:h.shape.metadata}).partial().refine(r=>Object.values(r).some(e=>e!==void 0),{message:"One of the fields must be defined"}),gs=x.extend({return_from_balance:o.boolean().default(!1).describe("Whether the request should also return from wallet balance"),return_to_balance:o.boolean().default(!1).describe("Whether the request should also return to wallet balance"),return_when_not_updated:o.boolean().default(!1).describe("Whether the request should return the transfer object even if it was not updated"),metadata_action:jt}).partial(),xo=o.object({transfer:nt,update:$t,options:gs.optional()}).strict().describe("Input for updateTransfer"),Sr=o.object({transfer:ue.describe("Updated transfer object"),updated:o.boolean().describe("Boolean showing if the transfer was updated"),from_balance:Ut.describe("Debited wallet balance"),to_balance:Ut.describe("Credited wallet balance")}).partial().describe("Output of updateTransfer");var am=o.object({reverse_deposit:o.boolean().default(!1).describe("Whether to create withdrawal transaction for deposit (will default to pending)"),reverse_withdrawal:o.boolean().default(!1).describe("Whether to create deposit transaction for withdrawal (will default to pending)"),return_from_balance:o.boolean().default(!1).describe("Whether the request should also return from wallet balance"),return_to_balance:o.boolean().default(!1).describe("Whether the request should also return to wallet balance"),metadata_action:Pt}),xs=o.object({status:pe,identifier:gt.shape.identifier,force:gt.shape.force,metadata:gt.shape.metadata,extend_metadata:gt.shape.metadata}).strict().partial().describe("In case the transfer will be made then apply these modifications"),ys=x.merge(am).partial(),yo=o.object({transfer:nt,reverse:xs,options:ys}).partial().required({transfer:!0}).describe("Input for reverseTransfer"),bo=Sr.describe("Output of reverseTransfer");var nm=o.object({reverse_deposit:o.boolean().default(!1).describe("Whether to create withdrawal transaction for deposits (will default to pending)"),reverse_withdrawal:o.boolean().default(!1).describe("Whether to create deposit transaction for withdrawals (will default to pending)"),return_transfers:o.boolean().describe("Should the update return all transfers belonging to group"),validate_final_balance_only:o.boolean().default(!1).describe("If true then transfers within a group will ignore balance restrictions. Only final transfers for wallets are checked."),metadata_action:Pt,transfer_metadata_action:Pt}).strict().partial(),Ea=x.merge(nm).partial(),bs=o.object({status:We,transfer_status:pe,identifier:D.shape.identifier,force:h.shape.force,metadata:D.shape.metadata,transfer_metadata:h.shape.metadata,extend_metadata:D.shape.metadata.describe("Key value object to be merged with existing metadata"),transfer_extend_metadata:h.shape.metadata.describe("Key value object to be merged with each transfers existing metadata")}).strict().partial().describe("In case the transferGroup will be made then apply these modifications"),So=o.object({transfer_group:ge,reverse:bs,options:Ea}).partial().required({transfer_group:!0}).describe("Input for reverseTranferGroup"),Oo=o.object({transfer_group:D,transfers:ue.array().describe("Updated transfers")}).partial().describe("Output of reverseTranferGroup");var om=bs.omit({identifier:!0}),Fo=o.object({transfer_group:Ra,reverse:om,options:Ea}).strict().partial().required({transfer_group:!0}).describe("Input for reverseTranferGroupMany"),zu=o.object({transfer_groups:D.array().describe("Reversed transfer groups"),transfers:ue.array().describe("Created transfer objects")}).partial().describe("Output of reverseTranferGroupMany");var Ss=o.object({status:pe,force:h.shape.force,metadata:h.shape.metadata}).partial(),Os=x.extend({reverse_deposit:o.boolean().describe("Whether to create withdrawal transaction for deposit (will default to pending)"),reverse_withdrawal:o.boolean().describe("Whether to create deposit transaction for withdrawal (will default to pending)"),metadata_action:Pt}).partial(),Io=o.object({transfer:Zt,reverse:Ss,options:Os}).strict().partial().required({transfer:!0}).describe("Input for reverseTranferMany"),_o=o.object({transfers:ue.array().describe("Created transfer array")}).partial().describe("Output of reverseTranferMany");var Fs=x.partial(),vo=o.object({flags:at.partial(),options:Fs}).strict().partial().required({flags:!0}).describe("Input for setFlags"),ko=o.object({flags:at,message:o.string().describe("optional message")}).strict().partial().required({flags:!0}).describe("Output of setFlags");var im=x.partial(),wo=o.object({options:im}).strict().partial().describe("Input for startTransaction"),Hu=o.object({transaction_id:o.string().describe("id of the created transaction")}).partial().describe("Output of startTransaction");var Is=x.partial().extend({return_when_not_updated:o.boolean().default(!1).describe("Whether the request should return the token object even if it was not updated")}),Ku=P.pick({metadata:!0,status:!0,public:!0}).partial(),EO=Ku.keyof(),Ro=o.object({token:ne,update:Ku,options:Is.optional()}).strict().describe("Input for updateToken"),Ao=o.object({token:P,updated:o.boolean().describe("Boolean showing if the token was updated")}).partial().describe("Output of updateToken");var _s=o.object({status:We.describe("Lifecycle status of the TransferGroup"),transfer_status:z.describe("Status all the transfers should be set at."),metadata:D.shape.metadata.describe("Key value object to be replaced or extended with existing TransferGroup metadata"),transfer_metadata:h.shape.metadata.describe("Key value object to be replaced or extended with existing Transfer metadata")}).partial().describe("Changes to be made to the transfer_group"),qt=_s.refine(r=>Object.values(r).some(e=>e!==void 0),{message:"One of the fields must be defined"}),PO=_s.keyof(),Ga=x.extend({return_transfers:o.boolean().describe("Should the update return all transfers belonging to group"),return_when_not_updated:o.boolean().default(!1).describe("Whether the request should return the transfer_group object even if it was not updated"),metadata_action:jt,transfer_metadata_action:jt}).partial(),Mo=o.object({transfer_group:ge,update:qt,options:Ga.optional()}).strict().describe("Input for updateTransferGroup"),Eo=o.object({transfer_group:D,updated:o.boolean().describe("Boolean showing if the transfer_group was updated"),transfers:ue.array().describe("Updated transfers")}).partial().describe("Output of updateTransferGroup");var vs=Ga,Go=o.object({transfer_group:Ra,update:qt,options:vs}).strict().partial().required({transfer_group:!0,update:!0}).describe("Input for updateTransferGroupMany"),Co=o.object({transfer_groups:Oa.array().describe("Updated transfer groups"),transfers:ue.array().describe("Updated transfers"),updated:o.boolean().describe("Boolean showing if the transfer_group were updated")}).partial().describe("Output of updateTransferGroupMany");var ks=x.extend({metadata_action:jt}).partial(),Wo=o.object({transfer:Zt,update:$t,options:ks}).strict().partial().required({transfer:!0,update:!0}).describe("Input for updateTransferMany"),No=o.object({transfers:ue.array().describe("Updated transfers"),updated:o.boolean().describe("Boolean showing if the transfers were updated")}).partial().describe("Output of updateTransferMany");var ws=x.extend({return_when_not_updated:o.boolean().default(!1).describe("Whether the request should return the wallet object even if it was not updated")}).partial(),Ju=Z.pick({metadata:!0,status:!0,name:!0}),nF=Ju.keyof(),Do=o.object({wallet:H,update:Ju.partial(),options:ws.optional()}).strict().describe("Input for updateWallet"),Bo=o.object({wallet:Z,updated:o.boolean().describe("Boolean showing if the wallet was updated")}).partial().describe("Output of updateWallet");var Rs={aggregateTransferMany:p(yn).validateInputWOptions,authenticationCheck:p(Sn).validateInputWOptions,createAccessToken:p(On).validateInputWOptions,createContract:p(wn).validateInputWOptions,createDeposit:p(An).validateInputWOptions,createDistribution:p(En).validateInputWOptions,createToken:p(Gn).validateInputWOptions,createTransfer:p(vn).validateInputWOptions,createTransferGroup:p(kn).validateInputWOptions,createTransferMany:p(Wn).validateInputWOptions,createWallet:p(Dn).validateInputWOptions,createWithdrawal:p(jn).validateInputWOptions,exportBalanceHistory:p(Ln).validateInputWOptions,exportTokenMany:p(zn).validateInputWOptions,exportTransferGroupMany:p(Jn).validateInputWOptions,exportTransferMany:p(Yn).validateInputWOptions,exportWalletMany:p(to).validateInputWOptions,findBalanceMany:p(ao).validateInputWOptions,findTokenMany:p(gr).validateInputWOptions,findTransferGroupMany:p(xr).validateInputWOptions,findTransferMany:p(mr).validateInputWOptions,findWalletMany:p(yr).validateInputWOptions,finishTransaction:p(oo).validateInputWOptions,getBalance:p(In).validateInputWOptions,getBalanceHistory:p(Zn).validateInputWOptions,getExport:p(Vn).validateInputWOptions,getFlags:p(io).validateInputWOptions,getStatistics:p(po).validateInputWOptions,getToken:p(mn).validateInputWOptions,getTokenMany:p(uo).validateInputWOptions,getTransfer:p(dn).validateInputWOptions,getTransferGroup:p(Tn).validateInputWOptions,getWallet:p(pn).validateInputWOptions,getWalletMany:p(co).validateInputWOptions,healthcheck:p(lo).validateInputWOptions,importActions:p(br).validateInputWOptions,listExportMany:p(mo).validateInputWOptions,queryLogs:p(To).validateInputWOptions,resetDatabase:p(go).validateInputWOptions,reverseTransfer:p(yo).validateInputWOptions,reverseTransferGroup:p(So).validateInputWOptions,reverseTransferGroupMany:p(Fo).validateInputWOptions,reverseTransferMany:p(Io).validateInputWOptions,setFlags:p(vo).validateInputWOptions,startTransaction:p(wo).validateInputWOptions,updateToken:p(Ro).validateInputWOptions,updateTransfer:p(xo).validateInputWOptions,updateTransferGroup:p(Mo).validateInputWOptions,updateTransferGroupMany:p(Go).validateInputWOptions,updateTransferMany:p(Wo).validateInputWOptions,updateWallet:p(Do).validateInputWOptions},As=(v=>(v.aggregateTransferMany="aggregateTransferMany",v.authenticationCheck="authenticationCheck",v.createAccessToken="createAccessToken",v.createContract="createContract",v.createDeposit="createDeposit",v.createDistribution="createDistribution",v.createToken="createToken",v.createTransfer="createTransfer",v.createTransferGroup="createTransferGroup",v.createTransferMany="createTransferMany",v.createWallet="createWallet",v.createWithdrawal="createWithdrawal",v.exportBalanceHistory="exportBalanceHistory",v.exportTokenMany="exportTokenMany",v.exportTransferGroupMany="exportTransferGroupMany",v.exportTransferMany="exportTransferMany",v.exportWalletMany="exportWalletMany",v.findBalanceMany="findBalanceMany",v.findTokenMany="findTokenMany",v.findTransferGroupMany="findTransferGroupMany",v.findTransferMany="findTransferMany",v.findWalletMany="findWalletMany",v.finishTransaction="finishTransaction",v.getBalance="getBalance",v.getBalanceHistory="getBalanceHistory",v.getExport="getExport",v.getFlags="getFlags",v.getStatistics="getStatistics",v.getToken="getToken",v.getTokenMany="getTokenMany",v.getTransfer="getTransfer",v.getTransferGroup="getTransferGroup",v.getWallet="getWallet",v.getWalletMany="getWalletMany",v.healthcheck="healthcheck",v.importActions="importActions",v.listExportMany="listExportMany",v.queryLogs="queryLogs",v.resetDatabase="resetDatabase",v.reverseTransfer="reverseTransfer",v.reverseTransferGroup="reverseTransferGroup",v.reverseTransferGroupMany="reverseTransferGroupMany",v.reverseTransferMany="reverseTransferMany",v.setFlags="setFlags",v.startTransaction="startTransaction",v.updateToken="updateToken",v.updateTransfer="updateTransfer",v.updateTransferGroup="updateTransferGroup",v.updateTransferGroupMany="updateTransferGroupMany",v.updateTransferMany="updateTransferMany",v.updateWallet="updateWallet",v))(As||{});var sm=r=>{let{success:e}=br.safeParse(r);return e},Or=class{constructor(e,t,a){b(this,"type");b(this,"_connection");b(this,"$connect");b(this,"connectionType");b(this,"jwt","");b(this,"host","");b(this,"isConnected",!1);b(this,"socId");b(this,"hooks",new Proxy({},{set(e,t,a){if(typeof a!="function")throw new TypeError("Hooks can only be functions");return e[t]=a,!0}}));b(this,"_requests",new Map);b(this,"_error",!1);b(this,"_sending",new Map);b(this,"sendingTimeout");this.type=t,this._connection=e,this.connectionType=t,this.$connect=a}_setConnected(e){this.$connect=void 0,e&&this._error!==!1&&(this._error=!1),!this.isConnected&&e&&this.hooks.connected&&this.hooks.connected(this.socId),this.isConnected&&!e&&this.hooks.disconnected&&this.hooks.disconnected(),this.isConnected=e}_setErrored(e){this._error=e,this._setConnected(!1)}_clearError(){this._error=!1}_send(e){throw new Error("This method must be implemented by child class")}_reconnect(e){throw new Error("This method must be implemented by child class")}close(){return X(this,null,function*(){throw new Error("This method must be implemented by child class")})}_connectionLost(){this._requests.forEach((e,t)=>{"stream"in e&&e.stream.destroy(new Pe("CONNECTION_LOST",{method:"connectionLost"})),this._requests.delete(t)}),this.socId=void 0}_handleMessage(e){var u,l,d,T;if(this.hooks.message&&this.hooks.message(e),"method"in e){let _=e;if(_.method==="ping"){this._send({jsonrpc:"2.0",result:"pong",id:_.id});return}R("Unexpected JSONRPCRequest",e);return}let t=e;if(this.hooks.message&&this.hooks.message(t),t.id===null){R("Unexpected JSONRPCResponse",e);return}if(t.result==="ack"){clearTimeout((u=this._sending.get(t.id))==null?void 0:u.timeout),this._sending.delete(t.id);return}let a=this._requests.get(t.id);if(!a){R("No Request found for incoming",e);return}if("handle"in a){a.handle(t),delete a.handle;return}t.error&&"error"in a&&a.error(t.error);let n=t;if(((l=n.result)==null?void 0:l.type)==="streamPause"&&"pause"in a){a.pause();return}if(((d=n.result)==null?void 0:d.type)==="streamResume"&&"resume"in a){a.resume();return}let{stream:i,start:s}=a;if(((T=n.result)==null?void 0:T.type)==="streamChunk"){i.push(n.result);return}i.push(n),i.destroyed||i.push(null),n.id&&this._requests.delete(n.id),this.connectionType==="ws"&&this._send({jsonrpc:"2.0",method:"ack",params:Date.now()-s,id:n.id})}_sendTransaction(e,t){let a=Rs[e](t);return this._sendRaw(e,a)}_setSending(e,t){if(e.id===null)throw new Error("JSONRPCMessage should not be null");this._sending.set(e.id,c({},this.sendingTimeout&&{timeout:setTimeout(()=>{this._sending.delete(e.id),t.push({error:new _e("SENDING_TIMEOUT",{timeout:this.sendingTimeout}).toJSON()}),this._requests.delete(e.id)},this.sendingTimeout)}))}_sendRaw(e,t){let a={jsonrpc:"2.0",method:e,params:t,id:rr()};return this.hooks.preflight&&this.hooks.preflight(a)===!1?new pt:new pt(n=>X(this,null,function*(){if(this._error&&this._reconnect(5),this.isConnected||(yield this.$connect),this._error)throw this._error;this._requests.set(a.id,{stream:n,start:Date.now()}),this._setSending(a,n),this._send(a)}))}_streamTransaction(e,t,a,n){let i=Date.now(),s=rr(),u,l=({stream:B,method:ie,params:q})=>{if(u)return;let L={jsonrpc:"2.0",method:ie,params:c({streamId:s},q),id:rr()};this._setSending(L,B),this._send(L)},d=(B,ie)=>{u||(l({stream:B,method:"streamError",params:{error:ie}}),u=ie,B.push({error:ie}))},T=new Ha,_=n?T.pipe(n):T,j={jsonrpc:"2.0",method:"streamStart",params:{method:e,options:a},id:s};return this.hooks.preflight&&this.hooks.preflight(j)===!1?new ua:new ua(B=>X(this,null,function*(){if(this._error&&this._reconnect(5),this.isConnected||(yield this.$connect),this._error)throw this._error;let ie=setTimeout(()=>{B.push({error:new Pe("INPUT_STREAM_TIMEOUT",{streamId:s})})},3e4);this._requests.set(j.id,{stream:B,start:i,error(q){u=q,R("stream:error()>",q)},pause(){T.pause()},resume(){T.resume()},handle(q){if(q.error){B.push(q);return}_.on("data",L=>{if(!u){if(ie&&(clearTimeout(ie),ie=null),!t(L)){d(B,new Pe("INVALID_INPUT_STREAM_CHUNK",{streamId:s,chunk:L}));return}l({stream:B,method:"streamData",params:{data:L}})}}).on("error",L=>{u||(ie&&(clearTimeout(ie),ie=null),l({stream:B,method:"streamError",params:{error:L}}),B.push({error:new Pe("INPUT_STREAM_ERROR",{streamId:s,error:L})}))}).on("end",()=>{ie&&(clearTimeout(ie),ie=null),l({stream:B,method:"streamEnd",params:{}})})}}),this._setSending(j,B),this._send(j)}),T)}aggregateTransferMany(e){return this._sendTransaction("aggregateTransferMany",e)}authenticationCheck(e){return this._sendTransaction("authenticationCheck",e!=null?e:{})}createAccessToken(e){return this._sendTransaction("createAccessToken",e)}createContract(e){return this._sendTransaction("createContract",e)}createDeposit(e){return this._sendTransaction("createDeposit",e)}createDistribution(e){return this._sendTransaction("createDistribution",e)}createToken(e){return this._sendTransaction("createToken",e)}createTransfer(e){return this._sendTransaction("createTransfer",e)}createTransferGroup(e){return this._sendTransaction("createTransferGroup",e!=null?e:{})}createTransferMany(e){return this._sendTransaction("createTransferMany",e)}createWallet(e){return this._sendTransaction("createWallet",e)}createWithdrawal(e){return this._sendTransaction("createWithdrawal",e)}exportBalanceHistory(e){return this._sendTransaction("exportBalanceHistory",e)}exportTokenMany(e){return this._sendTransaction("exportTokenMany",e!=null?e:{})}exportTransferGroupMany(e){return this._sendTransaction("exportTransferGroupMany",e!=null?e:{})}exportTransferMany(e){return this._sendTransaction("exportTransferMany",e!=null?e:{})}exportWalletMany(e){return this._sendTransaction("exportWalletMany",e!=null?e:{})}findBalanceMany(e){return this._sendTransaction("findBalanceMany",e!=null?e:{})}findTokenMany(e){return this._sendTransaction("findTokenMany",e!=null?e:{})}findTransferGroupMany(e){return this._sendTransaction("findTransferGroupMany",e!=null?e:{})}findTransferMany(e){return this._sendTransaction("findTransferMany",e!=null?e:{})}findWalletMany(e){return this._sendTransaction("findWalletMany",e!=null?e:{})}finishTransaction(e){return this._sendTransaction("finishTransaction",e)}getBalance(e){return this._sendTransaction("getBalance",e)}getBalanceHistory(e){return this._sendTransaction("getBalanceHistory",e)}getExport(e){return this._sendTransaction("getExport",e)}getFlags(e){return this._sendTransaction("getFlags",e!=null?e:{})}getStatistics(e){return this._sendTransaction("getStatistics",e!=null?e:{})}getToken(e){return this._sendTransaction("getToken",e)}getTokenMany(e){return this._sendTransaction("getTokenMany",e)}getTransfer(e){return this._sendTransaction("getTransfer",e)}getTransferGroup(e){return this._sendTransaction("getTransferGroup",e)}getWallet(e){return this._sendTransaction("getWallet",e)}getWalletMany(e){return this._sendTransaction("getWalletMany",e)}healthcheck(e){return this._sendTransaction("healthcheck",e!=null?e:{})}importActions(e){return this._sendTransaction("importActions",e)}importActionsStream(e,t){return this._streamTransaction("importActions",sm,e,t)}listExportMany(e){return this._sendTransaction("listExportMany",e!=null?e:{})}queryLogs(e){return this._sendTransaction("queryLogs",e!=null?e:{})}resetDatabase(e){return this._sendTransaction("resetDatabase",e!=null?e:{})}reverseTransfer(e){return this._sendTransaction("reverseTransfer",e)}reverseTransferGroup(e){return this._sendTransaction("reverseTransferGroup",e)}reverseTransferGroupMany(e){return this._sendTransaction("reverseTransferGroupMany",e)}reverseTransferMany(e){return this._sendTransaction("reverseTransferMany",e)}setFlags(e){return this._sendTransaction("setFlags",e)}startTransaction(e){return this._sendTransaction("startTransaction",e!=null?e:{})}updateToken(e){return this._sendTransaction("updateToken",e)}updateTransfer(e){return this._sendTransaction("updateTransfer",e)}updateTransferGroup(e){return this._sendTransaction("updateTransferGroup",e)}updateTransferGroupMany(e){return this._sendTransaction("updateTransferGroupMany",e)}updateTransferMany(e){return this._sendTransaction("updateTransferMany",e)}updateWallet(e){return this._sendTransaction("updateWallet",e)}};function Es(r,e){let t=Qu(r,{timeout:e==null?void 0:e.connectingTimeout});return new Ms(t,r,e)}function Qu(r,e){var q;let t=c({rejectUnauthorized:(q=r.rejectUnauthorized)!=null?q:!0,connectionName:e==null?void 0:e.connectionName,clientVersion:Ua},r),a=eu(t),n=new qp(...a),i,s,u=!1,l;n.onclose=d,n.onerror=T,n.onmessage=_;function d(L){if(R(`createConnection>close(reason:${L.reason},code:${L.code},wasClean:${L.wasClean})`),L.code===4030)return B(new tr);B(new Error("WS closed"))}function T(L){R(`createConnection>error(message:${L.message},error:${L.error},type:${L.type})`),B(L.error)}function _(L){R(`createConnection>message(type:${L.type},data:${L.data})`);let{data:Xt}=L,aa;try{aa=JSON.parse(Xt.toString())}catch(Yo){return R("Invalid JSON response",Yo),B(new Error("Invalid JSON response"))}if(aa.result!=="ready")return R("Invalid first message"),B(new Error("Invalid first message - "+JSON.stringify(aa)));B()}R(`createConnection>(message:setting up ws connection${e!=null&&e.timeout?" with timeout "+e.timeout:""})`);let j=e!=null&&e.timeout?setTimeout(()=>{B(new _e("CONNECTION_TIMEOUT",{timeout:e.timeout}))},e.timeout):void 0;function B(L){u||(clearTimeout(j),n.onmessage=()=>{},n.onerror=()=>{},n.onclose=()=>{},L?(s(L),n.close()):i(l),u=!0)}let ie=new Promise((L,Xt)=>{i=L,s=Xt});return{ws:n,$connect:ie}}var Ms=class extends Or{constructor(t,a,n){var i;super(t.ws,"ws",t.$connect);b(this,"_pingTimeout");b(this,"_opts");b(this,"_connectionConfig");b(this,"_tryToReconnect",!0);this._opts=a,this._connectionConfig=n,this.host=a.host,(i=this.$connect)==null||i.then(s=>(this.socId=s,this._ready())).catch(s=>{this.socId||this._setErrored(s)})}_setErrored(t){super._setErrored(t),(t instanceof tr||"code"in t&&t.code===te.AUTH.ERRORS.AUTHENTICATION_ERROR.code)&&(this._tryToReconnect=!1)}_ready(){this._setConnected(!0),this._connection.onmessage=t=>{let{data:a,type:n}=t;if(R(`message(type:${n},data:$0)`,a),n==="message"){let i=JSON.parse(a.toString());this._handleMessage(i),this._heartbeat()}},this._connection.onerror=t=>{let{message:a,error:n,type:i}=t;R(`error(message:$0,error:$1,type:${i})`,a,n)},this._connection.onclose=t=>{let{reason:a,code:n,wasClean:i}=t;R(`close(reason:$0,code:${n},wasClean:${i})`,a),this._setConnected(!1),clearTimeout(this._pingTimeout),this._connectionLost(),this._reconnect()},this._heartbeat()}_reconnect(t){if(R("reconnect(),tryToReconnect:",this._tryToReconnect),!this._tryToReconnect)return;if(this.hooks.reconnect&&this.hooks.reconnect()===!1){R("reconnect hook returned false");return}if(this.$connect){R("already connecting");return}super._clearError(),t!=null||(t=oa("WAPI_RECONNECT_ATTEMPTS",10));let a=oa("WAPI_MAX_RECONNECT_WAIT",1e4);this.$connect=X(this,null,function*(){var i,s,u;let n;for(let l=0;l<t+1;l++)try{R("Trying to connect, attempt:",l);let{ws:d,$connect:T}=Qu(this._opts,{timeout:(i=this._connectionConfig)==null?void 0:i.reconnectingTimeout});n=yield T,this.socId=n,this._connection=d,this._ready();break}catch(d){let T=d&&typeof d=="object"&&"code"in d&&d.code===te.AUTH.ERRORS.AUTHENTICATION_ERROR.code,_=l>t-1;if(T||_){this._setErrored(d),(u=(s=this.hooks).reconnectError)==null||u.call(s,d);break}yield Yp(Math.min(Math.pow(1.5,l)*1e3,a))}return n})}_heartbeat(){R("heartbeat"),clearTimeout(this._pingTimeout),this._pingTimeout=setTimeout(()=>{if(this._sending.size)return R("pingTimeout reached, but sending.size:",this._sending.size),this._heartbeat();R("timeout"),this._connection.close(),this._setConnected(!1),this._reconnect()},31e3)}_send(t){R("send()",t),this._connection.send(JSON.stringify(t))}close(){return X(this,null,function*(){return R("close()"),this._tryToReconnect=!1,clearTimeout(this._pingTimeout),this._setConnected(!1),this._connection.close()})}};var ec=ml(Yu(),1);var{fetch:Xu}=(0,ec.default)();function Ws(r,e){let t=pm(r,{timeout:e==null?void 0:e.connectingTimeout,skipInit:e==null?void 0:e.httpSkipInitialAuthConnection,connectionName:e==null?void 0:e.connectionName});return new Cs(t,r)}function pm(r,e){let t=r.host.replace(/^wss:/,"https:"),a="x-wapi-req-id",n="x-wapi-conn-name";function i(d){return X(this,null,function*(){R("http_createConnection>message(body:$0)",d)})}function s(d,T){return X(this,null,function*(){let _=JSON.parse(d),B=yield(yield Xu(`${t}/api`,{keepalive:!0,method:"POST",headers:c({Authorization:`Bearer ${T}`,"content-type":"application/json",[a]:_==null?void 0:_.id},e!=null&&e.connectionName?{[n]:e==null?void 0:e.connectionName}:{}),body:d})).json();this.onmessage(S(c({},B),{id:_.id}))})}let u=rr(),l=new Promise((d,T)=>{if(e!=null&&e.skipInit)return d(void 0);let _=new AbortController;R(`createConnection(sending http auth request${e!=null&&e.timeout?" with timeout "+e.timeout:""})`);let j=e!=null&&e.timeout?setTimeout(()=>{_.abort(),T(new _e("CONNECTION_TIMEOUT",{timeout:e.timeout}))},e.timeout):void 0;Xu(`${t}/api`,{method:"POST",headers:c({Authorization:`Bearer ${r.jwt}`,"content-type":"application/json",[a]:u},e!=null&&e.connectionName?{[n]:e==null?void 0:e.connectionName}:{}),body:JSON.stringify({jsonrpc:"2.0",method:"authenticationCheck",params:{},id:u}),signal:_.signal}).then(B=>B.json()).then(B=>{if(clearTimeout(j),B.error)throw new Error(B.error.message);d(void 0)}).catch(T)});return{send:s,onmessage:i,$connect:l}}var Cs=class extends Or{constructor(e,t){var a;super(e,"https",e.$connect),this.host=t.host,this.jwt=t.jwt,(a=this.$connect)==null||a.then(()=>{this._ready()}).catch(n=>{this._setErrored(n)})}_send(e){R("send()",e),this._connection.send(JSON.stringify(e),this.jwt)}_ready(){this._setConnected(!0),this._connection.onmessage=e=>X(this,null,function*(){R("http_message($0)>",e),this._handleMessage(e)})}close(){return X(this,null,function*(){R("close()"),this._setConnected(!1)})}_reconnect(){return X(this,null,function*(){R("reconnect()")})}};var xe=o.object({order_by:o.string().describe("Ordering options in string format")}).describe("extra find options for client functions"),jI=le.merge(_u).merge(xe).describe("extended find options for client functions"),Fr=o.union([o.number().positive(),o.string().regex(/^((0\.\d+)|([1-9]\d*(\.\d+){0,1}))$/,"invalid number")]),F=o.union([o.string(),o.number().int()]),Ns=o.union([o.string(),o.number()]),$=F.transform(r=>typeof r=="object"?r:{foreign:String(r)});var Ds=Ci.describe("Optional flags for input"),jo=o.object({wallet:$.describe("Foreign of the wallet connected to transfers"),token:$.describe("Foreign of the token transferred"),from_wallet:$.describe("Foreign of the wallet transfers are made from"),to_wallet:$.describe("Foreign of the wallet transfers are made to"),transfer_group:$.describe("Foreign of the transfer_group the transfers are a part of"),status:z.describe("Status of the transfers"),metadata:Q.describe("Metadata filter"),options:Ds}).partial().strict().describe("Input for aggregateTransfers"),tc=bn.describe("Output of aggregateTransfers");var rc=Y(yu.options);function Po(r,e){let{data:t,error:a}=r.safeParse(e);if(!a)return t;throw new J("INVALID_COMPLEX_FILTER",a.format(),a.message)}function Wa({function:r,field:e,operator:t,value:a}){if(Array.isArray(a))return{function:r,inner:a};if(typeof a=="object"&&t&&e&&"foreign"in a&&Object.keys(a).length===1)return{function:r,operator:t,field:e,value:a.foreign};if(typeof a=="object")return{function:r,value:a};if(t!=null||(t="="),!e)throw new TypeError("FIELD_IS_REQUIRED");return{function:r,field:e,operator:t,value:a}}var De=class r{constructor(e,t,a=[]){b(this,"$queries",[]);b(this,"$schemaBasic");b(this,"$schema");this.$queries=a!=null?a:[],this.$schemaBasic=e,this.$schema=t}toQuery(){return this.$queries.length===1&&"value"in this.$queries[0]&&typeof this.$queries[0].value=="object"&&!("field"in this.$queries[0])?this.$queries[0].value:this.$queries}toJSON(){return{filter:JSON.parse(JSON.stringify(this.toQuery()))}}add(e){return this.$queries.push(e),this}addWhere({fn:e,field:t,operator:a,value:n}){if(typeof t=="function"){let s=new r(this.$schemaBasic,this.$schema);if(t(s),!s||!(s instanceof r))throw new TypeError("Inner Builder must return QueryBuilderInner");return this.add(Wa({function:e,value:s.toQuery()}))}if(typeof t=="object"){let s=Po(this.$schemaBasic,t);return this.add(Wa({function:e,value:s}))}if(typeof t!="string")throw new TypeError("Field is required");let i=this.$schemaBasic.shape[t]||this.$schema.shape[t];if(!i)throw new TypeError("Invalid field:"+t);if(a===void 0)throw new TypeError("Operator is required");if(typeof a!="string"||!(a in rc)||n===void 0){if(a=Po(i,a),a===void 0)throw new TypeError("unexpectedly value needed");return typeof a=="object"?this.add(Wa({function:e,value:{[t]:a}})):this.add(Wa({function:e,field:t,value:a}))}if(n=Po(i,n),n===void 0)throw new Error("undefined value");return this.add(Wa({function:e,field:t,operator:a,value:n}))}addIn({fn:e,field:t,value:a}){if(!t)throw new TypeError("Field is required");if(!(t in this.$schema.shape))throw new TypeError("Invalid field");if(!a)throw new TypeError("Value is required");if(!Array.isArray(a))throw new TypeError("Expected value to be array");return this.add({function:e,field:t,value:a})}addMetadataNull({fn:e,field:t}){if(!t)throw new TypeError("Field is required");if(typeof t!="string")throw new TypeError("Invalid field");return this.add({function:e,field:t})}addNull({fn:e,field:t}){if(!t)throw new TypeError("Field is required");if(!(t in this.$schema.shape))throw new TypeError("Invalid field");return this.$schema.parse({[t]:null}),this.add({function:e,field:t})}addMetadata({fn:e,field:t,operator:a,value:n}){if(typeof t!="string")throw new TypeError("expected field to be string");return n||(n=a,a="="),this.add({function:e,field:t,operator:a,value:n})}addMetadataIn({fn:e,field:t,value:a}){if(typeof t!="string")throw new TypeError("expected field to be string");if(!Array.isArray(a))throw new TypeError("expected value to be an array");return this.add({function:e,field:t,value:a})}where(e,t,a){return this.addWhere({fn:"where",field:e,operator:t,value:a})}orWhere(e,t,a){return this.addWhere({fn:"orWhere",field:e,operator:t,value:a})}whereIn(e,t){return this.addIn({fn:"whereIn",field:e,value:t})}orWhereIn(e,t){return this.addIn({fn:"orWhereIn",field:e,value:t})}whereNull(e){return this.addNull({fn:"whereNull",field:e})}orWhereNull(e){return this.addNull({fn:"orWhereNull",field:e})}whereNotNull(e){return this.addNull({fn:"whereNotNull",field:e})}orWhereNotNull(e){return this.addNull({fn:"orWhereNotNull",field:e})}whereMetadata(e,t,a){return this.addMetadata({fn:"whereMetadata",field:e,operator:t,value:a})}orWhereMetadata(e,t,a){return this.addMetadata({fn:"orWhereMetadata",field:e,operator:t,value:a})}whereMetadataIn(e,t){return this.addMetadataIn({fn:"whereMetadataIn",field:e,value:t})}orWhereMetadataIn(e,t){return this.addMetadataIn({fn:"orWhereMetadataIn",field:e,value:t})}whereMetadataNull(e){return this.addMetadataNull({fn:"whereMetadataNull",field:e})}orWhereMetadataNull(e){return this.addMetadataNull({fn:"orWhereMetadataNull",field:e})}whereMetadataNotNull(e){return this.addMetadataNull({fn:"whereMetadataNotNull",field:e})}orWhereMetadataNotNull(e){return this.addMetadataNull({fn:"orWhereMetadataNotNull",field:e})}};function um(r,e,t){return r in vu?c({type:"period",alias:e!=null?e:r},t?{field:{period:r,timezone:t}}:{field:r}):r.startsWith("metadata.")?{type:"metadata_field",field:r.replace("metadata.",""),alias:e!=null?e:r.replace("metadata.","")}:{type:"field",field:r,alias:e!=null?e:r}}function ac(r,e,t){return e?{function:r,field:e,alias:t!=null?t:r}:{function:r,alias:r}}var Ir=class r extends De{constructor({$queries:t,$options:a,start:n,schema:i,schemaBasic:s,optionsSchema:u,aggregators:l,groups:d,aggregatableSchema:T,groupableSchema:_,timezone:j}){super(s,i,t);b(this,"$options");b(this,"$optionsSchema");b(this,"$start");b(this,"$aggregators");b(this,"$groups");b(this,"$aggregatableSchema");b(this,"$groupableSchema");b(this,"$timezone");this.$options=a,this.$optionsSchema=u,this.$start=n,this.$aggregators=l,this.$groups=d,this.$aggregatableSchema=T,this.$groupableSchema=_,this.$timezone=j}add(t){return new r({$queries:[...this.$queries,t],$options:this.$options,start:this.$start,schemaBasic:this.$schemaBasic,aggregators:this.$aggregators,groups:this.$groups,schema:this.$schema,optionsSchema:this.$optionsSchema,aggregatableSchema:this.$aggregatableSchema,groupableSchema:this.$groupableSchema,timezone:this.$timezone})}start(){return this.$start(this.toJSON())}getAggregators(){return Object.entries(this.$aggregators).map(([,t])=>t)}getGroups(){return Object.entries(this.$groups).map(([,t])=>t)}toJSON(){return{filter:super.toQuery(),options:this.$options,aggregators:this.getAggregators(),groups:this.getGroups()}}then(t,a){return this.start().then(t,a)}catch(t){return this.start().catch(t)}finally(t){return this.start().finally(t)}stream(){return this.start().stream()}options(t){let a=this.$optionsSchema.parse(c({},t)),n=Le(a);return new r({$queries:this.$queries,$options:c(c({},this.$options),n),start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,aggregators:this.$aggregators,groups:this.$groups,optionsSchema:this.$optionsSchema,aggregatableSchema:this.$aggregatableSchema,groupableSchema:this.$groupableSchema,timezone:this.$timezone})}timezone(t){let a=Object.fromEntries(Object.entries(this.$groups).map(([n,i])=>i.type!=="period"?[n,i]:[n,S(c({},i),{field:{period:i.field,timezone:t}})]));return new r({$queries:this.$queries,$options:this.$options,start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,aggregators:this.$aggregators,groups:c({},a),optionsSchema:this.$optionsSchema,aggregatableSchema:this.$aggregatableSchema,groupableSchema:this.$groupableSchema,timezone:t})}groupBy(t,...a){if(!t)throw new ve("String input expected");let n=Object.fromEntries([t,...a].map(i=>{if(typeof i!="string")throw new ve({input:a},"Expected an array of strings");let[s,u]=i.split(" as "),l=um(s,u,this.$timezone);return[l.alias,l]}));return new r({$queries:this.$queries,$options:this.$options,start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,aggregators:this.$aggregators,groups:c(c({},this.$groups),n),optionsSchema:this.$optionsSchema,aggregatableSchema:this.$aggregatableSchema,groupableSchema:this.$groupableSchema,timezone:this.$timezone})}addAggregator(t,a,...n){let i=a===void 0?{[t]:ac(t)}:Object.fromEntries([a,...n].map(s=>{if(typeof s!="string")throw new ve("expected string input");let[u,l]=s.split(" as "),d=ac(t,u,l);return[d.alias,d]}));return new r({$queries:this.$queries,$options:this.$options,start:this.$start,schemaBasic:this.$schemaBasic,aggregators:c(c({},this.$aggregators),i),groups:this.$groups,schema:this.$schema,optionsSchema:this.$optionsSchema,aggregatableSchema:this.$aggregatableSchema,groupableSchema:this.$groupableSchema,timezone:this.$timezone})}count(t,...a){return this.addAggregator("count",t,...a)}distinct(t,...a){return this.addAggregator("countDistinct",t,...a)}avg(t,...a){return this.addAggregator("average",t,...a)}min(t,...a){return this.addAggregator("min",t,...a)}max(t,...a){return this.addAggregator("max",t,...a)}sum(t,...a){return this.addAggregator("sum",t,...a)}where(t,a,n){return this.addWhere({fn:"where",field:t,operator:a,value:n})}orWhere(t,a,n){return this.addWhere({fn:"orWhere",field:t,operator:a,value:n})}whereIn(t,a){return this.addIn({fn:"whereIn",field:t,value:a})}orWhereIn(t,a){return this.addIn({fn:"orWhereIn",field:t,value:a})}whereNull(t){return this.addNull({fn:"whereNull",field:t})}orWhereNull(t){return this.addNull({fn:"orWhereNull",field:t})}whereNotNull(t){return this.addNull({fn:"whereNotNull",field:t})}orWhereNotNull(t){return this.addNull({fn:"orWhereNotNull",field:t})}whereMetadata(t,a,n){return this.addMetadata({fn:"whereMetadata",field:t,operator:a,value:n})}orWhereMetadata(t,a,n){return this.addMetadata({fn:"orWhereMetadata",field:t,operator:a,value:n})}whereMetadataIn(t,a){return this.addMetadataIn({fn:"whereMetadataIn",field:t,value:a})}orWhereMetadataIn(t,a){return this.addMetadataIn({fn:"orWhereMetadataIn",field:t,value:a})}whereMetadataNull(t){return this.addMetadataNull({fn:"whereMetadataNull",field:t})}orWhereMetadataNull(t){return this.addMetadataNull({fn:"orWhereMetadataNull",field:t})}whereMetadataNotNull(t){return this.addMetadataNull({fn:"whereMetadataNotNull",field:t})}orWhereMetadataNotNull(t){return this.addMetadataNull({fn:"orWhereMetadataNotNull",field:t})}};var cm=o.object({return_running_balance:o.boolean().describe("return running balance for specified wallet under filter"),return_signed_amount:o.boolean().describe("return running balance for specified wallet under filter"),return_running_balance_for_wallet:$.describe("foreign key for which wallet should running balance be returned for"),return_signed_amount_for_wallet:$.describe("foreign key for which wallet should signed amounts be returned for")}),lm=Ei.keyof().options.reduce((r,e)=>S(c({},r),{[e]:!0}),{}),zt=Fa.omit(lm).merge(cm).merge(xe).partial().describe("Optional flags for input"),Ht=o.object({wallet:$.describe("Foreign of the wallet connected to transfers"),token:$.describe("Foreign of the token transferred"),from_wallet:$.describe("Foreign of the wallet transfers are made from"),to_wallet:$.describe("Foreign of the wallet transfers are made to"),transfer_group:$.describe("Foreign of the transfer_group the transfers are a part of"),type:Ce,status:z.describe("Status of the transfers"),metadata:Q}).partial(),_r=Ht.extend({options:zt.optional()}).strict().describe("Input for findTransfers"),nc=xn.describe("Output of findTransfers");function Bs(r,e,t){let{client:a}=r,n=new Ir({start(i){return a.api.aggregateTransferMany({transfer:i.filter,options:i.options,groups:i.groups,aggregators:i.aggregators})},schemaBasic:_r,schema:Re,optionsSchema:Ds,aggregators:{},groups:{},aggregatableSchema:Wi,groupableSchema:Ni});if(e){let{filter:i,options:s}=ee(e,t),u=ae(i,[]);return n.where(u).options(s)}return n}var dm=Pi.describe("Optional flags for input"),fm=o.enum([...Di.options,"aggregateTransfers","exportBalanceHistory","exportTokens","exportTransferGroups","exportTransfers","exportWallets","findBalances","findTokens","findTransferGroups","findTransfers","findWallets","listExports"]),mm=Bi.extend({scopes:fm.array()}),vr=o.object({token:o.union([mm,ji]),options:dm}).partial().strict().describe("Input for createAccessToken"),oc=Fn.describe("Output of createAccessToken");var hm=new Map(Object.entries({aggregateTransfers:"aggregateTransferMany",exportTokens:"exportTokenMany",exportTransferGroups:"exportTransferGroupMany",exportTransfers:"exportTransferMany",exportWallets:"exportWalletMany",findBalances:"findBalanceMany",findTokens:"findTokenMany",findTransferGroups:"findTransferGroupMany",findTransfers:"findTransferMany",findWallets:"findWalletMany",listExports:"listExportMany"})),Tm=p(vr);function js(r,e,t){var i;let{client:a}=r,n=Tm.validateInputWOptions(e,t);return n.token&&"scopes"in n.token&&(n.token.scopes=Array.from(new Set((i=n.token)==null?void 0:i.scopes.map(s=>{var u;return(u=hm.get(s))!=null?u:s})))),a.api.createAccessToken({token:n.token,options:t})}var gm=$i.describe("Optional flags for input"),xm=o.object({wallet:F.describe("Foreign of the wallet buying this contract"),token:F.describe("Foreign of the token buyer will buy with, defaults to Contract value token"),amount:o.number().describe("Amount the buyer will pay, defaults to contract value amount"),metadata:h.shape.metadata,latest_control_hash:h.shape.control_hash.nullable().optional().describe("Latest control_hash on the buyer wallet")}).partial().required({wallet:!0}).describe("The properties of the contract from buyer side"),ym=o.object({foreign:Ns.describe("Unique foreign of the created Contract"),metadata:P.shape.metadata,value_token:F.describe("Foreign of the token this contract is valued in"),value_amount:o.number().positive().describe("Amount of value this Contract has"),owner:Ns.describe("Foreign of the wallet this contract should initially belong to"),buyer:xm}).partial().required({foreign:!0,value_amount:!0,value_token:!0}).describe("Contract description"),kr=ym.extend({options:gm.optional()}).strict().describe("Input for createContract"),ic=Rn.describe("Output of createContract");var bm=p(kr);function Ps(r,e,t){var s;let{client:a}=r,n=bm.validateInputWOptions(e,t),i={token:{foreign:n.foreign+"",metadata:n.metadata,owner:C((s=n.owner)!=null?s:"house"),deposits:[{token:C(n.value_token),amount:n.value_amount}]}};return n.buyer&&(n.buyer.latest_control_hash&&console.warn("deprecated: latest_control_hash is deprecated and will be ignored"),i.exchange={from_wallet:C(n.buyer.wallet),amount:n.buyer.amount||n.value_amount,from_token:C(n.buyer.token||n.value_token),metadata:n.buyer.metadata}),a.api.createContract(i)}var Sm=x.extend({return_balance:o.boolean().describe("return balance after deposit"),create_wallet_if_not_exists:o.boolean().describe("If true then the wallet will be created if not found. Only valid with 'foreign'")}).partial().describe("Optional flags for input"),Om=o.object({identifier:h.shape.identifier,token:F.describe("Id of the token to deposit as"),wallet:F.describe("Id of the wallet to deposit to"),amount:Fr.describe("amount to deposit"),metadata:h.shape.metadata,status:pe,transfer_group:F.describe("Id of the transfer_group this deposit is linked to"),created_at:h.shape.created_at}).partial().required({wallet:!0,amount:!0}),wr=Om.extend({options:Sm.optional()}).strict().describe("Input for createDeposit"),sc=Mn.describe("Output of createDeposit");var Fm=p(wr);function Vs(r,e,t){let{client:a}=r,n=Ue(e,"token",a.getConfig("token")),i=Fm.validateInputWOptions(n,t),s=i.token||a.getConfig("token");if(s===void 0)throw new J("INPUT_NEEDS_TOKEN",{input:e});let j=i,{wallet:u,metadata:l,options:d}=j,T=ae(j,["wallet","metadata","options"]),_=c(S(c({},T),{amount:ar(T.amount),transfer_group:ce(i.transfer_group),token:C(s),to_wallet:C(u),type:"deposit"}),l?{metadata:l}:{});return _.identifier||(_.identifier=me(_)),a.api.createTransfer({transfer:_,options:za(d,{return_balance:"return_to_balance",create_wallet_if_not_exists:"create_to_wallet_if_not_exists"})})}var Im=x.partial().describe("Optional flags for input"),_m=o.object({identifier:D.shape.identifier,from_identifier:h.shape.identifier,from_wallet:F.describe("Foreign of Wallet where from_token is debited from/to_token is credited to"),from_token:F.describe("Foreign of Token that is transferred from->to"),from_amount:h.shape.amount.describe("Amount of from_token transferred"),to_identifier:h.shape.identifier,to_wallet:F.describe("Foreign of Wallet where from_token is credited to/to_token is debited from. If not specified then to_token.belongs_to is used"),to_token:F.describe("Foreign of Token that is transferred to->from"),to_amount:h.shape.amount.describe("Amount of to_token transferred. If not specified then from_amount is used"),status:pe.describe("The state at which the exchange is created"),force:h.shape.force,metadata:h.shape.metadata}).partial().required({from_wallet:!0,from_token:!0,from_amount:!0,to_token:!0,to_wallet:!0}),Rr=_m.extend({options:Im.optional()}).strict().describe("Input for createExchange"),pc=yt.describe("Output of createExchange");var vm=p(Rr);function Zs(r,e,t){var l,d,T,_,j;let{client:a}=r,u=vm.validateInputWOptions(e,t),{options:i}=u,s=ae(u,["options"]);return(l=s.identifier)!=null||(s.identifier=me(s)),a.api.createTransferGroup({transfer_group:{identifier:s.identifier,status:ln.closed,transfer_status:(d=s.status)!=null?d:"pending",metadata:s.metadata,children:[{identifier:(T=s.from_identifier)!=null?T:me(),from_wallet:C(s.from_wallet),to_wallet:C(s.to_wallet),token:C(s.from_token),type:s.from_wallet?Vt.transfer:Vt.deposit,amount:s.from_amount,metadata:s.metadata,force:s.force},{identifier:(_=s.to_identifier)!=null?_:me(),from_wallet:C(s.to_wallet),to_wallet:C(s.from_wallet),token:C(s.to_token),type:s.to_wallet?Vt.transfer:Vt.deposit,amount:(j=s.to_amount)!=null?j:s.from_amount,metadata:s.metadata,force:s.force}]},options:i})}var km=zi.describe("Optional flags for input"),wm=P.pick({foreign:!0,public:!0,metadata:!0,divisor:!0,limit:!0}).extend({belongs_to:F.describe("Id of the wallet this token belongs_to")}).partial().required({foreign:!0}),Ar=wm.extend({options:km.optional()}).strict().describe("Input for createToken"),uc=Cn.describe("Output of createToken");var Rm=p(Ar);function Us(r,e,t){let{client:a}=r,d=Rm.validateInputWOptions(e,t),{options:i,belongs_to:s,metadata:u}=d,l=ae(d,["options","belongs_to","metadata"]);return a.api.createToken({token:c(S(c({},l),{belongs_to:C(s)}),u?{metadata:u}:{}),options:i})}var Am=ot.describe("Optional flags for input"),Ls=o.object({identifier:h.shape.identifier,token:F.describe("Id of the token to transfer as"),from_wallet:F.describe("Foreign of the wallet to withdraw from"),to_wallet:F.describe("Foreign of the wallet to deposit to"),latest_control_hash:h.shape.control_hash,amount:Fr.describe("amount to withdraw"),metadata:h.shape.metadata,status:pe.describe("status of the transfer"),transfer_group:F.describe("Id of the transfer_group this transfer is linked to"),created_at:h.shape.created_at,type:o.literal("transfer")}),$s=Ls.extend({type:o.literal("transfer")}).partial().required({from_wallet:!0,to_wallet:!0,amount:!0}),qs=Ls.omit({from_wallet:!0,to_wallet:!0}).extend({wallet:F.describe("Foreign of the wallet to withdraw from"),type:o.literal("withdrawal")}).partial().required({wallet:!0,amount:!0,type:!0}),zs=Ls.omit({from_wallet:!0,to_wallet:!0}).extend({wallet:F.describe("Foreign of the wallet to deposit to"),type:o.literal("deposit")}).partial().required({wallet:!0,amount:!0,type:!0}),Hs=o.union([$s,zs,qs]),Mr=Hs.and(o.object({options:Am.optional()})).describe("Input for createTransfer"),cc=xt.describe("Output of createTransfer");var Mm=p(Mr);function Ks(r,e,t){let{client:a}=r,n=Ue(e,"token",a.getConfig("token")),i=Mm.validateInputWOptions(n,t),s=Na(i,a.getConfig("token"));return s.identifier||(s.identifier=me(s)),a.api.createTransfer({transfer:s,options:i.options})}function Na(r,e){r.type=r.type||"transfer";let t={identifier:r.identifier,token:C(r.token||e),amount:ar(r.amount),metadata:r.metadata,status:r.status,type:r.type,transfer_group:ce(r.transfer_group),created_at:r.created_at};if(r.type==="transfer")return r.latest_control_hash&&console.warn("deprecated: latest_control_hash is deprecated"),S(c({},t),{from_wallet:C(r.from_wallet),to_wallet:C(r.to_wallet)});if(r.type==="withdrawal")return r.latest_control_hash&&console.warn("deprecated: latest_control_hash is deprecated"),S(c({},t),{from_wallet:C(r.wallet)});if(r.type==="deposit")return S(c({},t),{to_wallet:C(r.wallet)});throw new Error("Should not be here")}var Em=Li.describe("Optional flags for input"),Gm=$s.omit({transfer_group:!0}),Cm=zs.omit({transfer_group:!0}),Wm=qs.omit({transfer_group:!0}),Nm=o.union([Cm,Gm,Wm]),Dm=D.pick({identifier:!0,status:!0,transfer_status:!0,metadata:!0}).extend({children:Nm.array()}).partial(),Er=Dm.extend({options:Em.optional()}).describe("Input for createTransferGroup"),lc=yt.describe("Output of createTransferGroup");var Bm=p(Er);function Js(r,e,t){let{client:a}=r,u=Bm.validateInputWOptions(e,t),{options:i}=u,s=ae(u,["options"]);return s.children&&(s.children=s.children.map(l=>Na(l,a.getConfig("token")))),s.identifier||(s.identifier=me(s)),a.api.createTransferGroup({transfer_group:s,options:i})}var jm=Hi.describe("Optional flags for input"),Gr=o.object({transfers:Hs.array().min(1).describe("Array of transfer objects to create"),options:jm.optional()}).describe("Input for createTransfers"),dc=Nn.describe("Output of createTransfers");var Pm=p(Gr);function Qs(r,e,t){let{client:a}=r,n=Pm.validateInputWOptions(e,t),i=n.transfers.map(s=>Na(s,a.getConfig("token")));for(let s of i)s.identifier||(s.identifier=me(s));return a.api.createTransferMany({transfers:i,options:n.options})}var Vm=Ji.describe("Optional flags for input"),Zm=Z.pick({foreign:!0,name:!0,metadata:!0,status:!0}).partial().required({foreign:!0}),Cr=Zm.extend({options:Vm.optional()}).strict().describe("Input for createWallet"),fc=Bn.describe("Output of createWallet");var Um=p(Cr);function Ys(r,e,t){let{client:a}=r,l=Um.validateInputWOptions(e,t),{options:i,metadata:s}=l,u=ae(l,["options","metadata"]);return a.api.createWallet({wallet:c(c({},u),s?{metadata:s}:{}),options:i})}var Lm=x.extend({return_balance:o.boolean().describe("Return balance after withdrawal")}).partial().describe("Optional flags for input"),$m=o.object({identifier:h.shape.identifier,token:F.describe("Id of the token to withdrawal as"),wallet:F.describe("Id of the wallet to withdraw from"),latest_control_hash:h.shape.control_hash,amount:Fr.describe("amount to withdraw"),metadata:h.shape.metadata,status:pe.describe("status of the withdrawal"),transfer_group:F.describe("Id of the transfer_group this withdrawal is linked to"),created_at:h.shape.created_at}).partial().required({wallet:!0,amount:!0}),Wr=$m.extend({options:Lm.optional()}).strict().describe("Input for createWithdrawal"),mc=Pn.describe("Output of createWithdrawal");var qm=p(Wr);function Xs(r,e,t){let{client:a}=r,n=Ue(e,"token",a.getConfig("token")),i=qm.validateInputWOptions(n,t),B=i,{wallet:s,metadata:u,options:l,latest_control_hash:d}=B,T=ae(B,["wallet","metadata","options","latest_control_hash"]);d&&console.warn("deprecated: latest_control_hash is deprecated");let _=i.token||a.getConfig("token");if(_===void 0)throw new J("INPUT_NEEDS_TOKEN",{input:e});let j=c(S(c({},T),{amount:ar(T.amount),transfer_group:ce(i.transfer_group),token:C(_),from_wallet:C(s),type:"withdrawal"}),u?{metadata:u}:{});return j.identifier||(j.identifier=me(j)),a.api.createTransfer({transfer:j,options:za(l,{return_balance:"return_from_balance"})})}var zm=rs.partial().describe("Optional flags for input"),Hm=o.object({token:F.describe("Id of the token to withdrawal as").transform(r=>({foreign:String(r)})),wallet:F.describe("Id of the wallet to withdraw from").transform(r=>({foreign:String(r)}))}).partial().required({wallet:!0}),Nr=Hm.extend({options:zm.optional()}).strict().describe("Input for exportBalanceHistory"),hc=$n.describe("Output of exportBalanceHistory");var Km=p(Nr);function ep(r,e,t){let{client:a}=r,n=Km.validateInputWOptions(e,t),i=n.token||C(a.getConfig("token"));if(i===void 0)throw new J("INPUT_NEEDS_TOKEN",{input:e});return a.api.exportBalanceHistory({balance:{wallet:n.wallet,token:i},options:t})}function Jm(r){return r.map(e=>{if(typeof e=="string"){if(e.includes(" "))throw new TypeError("invalid order option: "+e);return{field:e,direction:"asc"}}return{field:e.column,direction:e.order,nulls:e.nulls}})}var oe=class r extends De{constructor({$queries:t,$options:a,start:n,schema:i,schemaBasic:s,optionsSchema:u}){super(s,i,t);b(this,"$options");b(this,"$optionsSchema");b(this,"$start");this.$options=a,this.$optionsSchema=u,this.$start=n}add(t){return new r({$queries:[...this.$queries,t],$options:this.$options,start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema})}start(){return this.$start(this.toJSON())}toJSON(){return{filter:super.toQuery(),options:c({},this.$options)}}then(t,a){return this.start().then(t,a)}catch(t){return this.start().catch(t)}finally(t){return this.start().finally(t)}stream(){return this.start().stream()}select(t,...a){var n,i;return new r({$queries:this.$queries,$options:S(c({},this.$options),{deselect:void 0,select:Array.from(new Set([t,...a,...(i=(n=this.$options)==null?void 0:n.select)!=null?i:[]]))}),start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema})}deselect(t,...a){var n,i;return new r({$queries:this.$queries,$options:S(c({},this.$options),{select:void 0,deselect:Array.from(new Set([t,...a,...(i=(n=this.$options)==null?void 0:n.deselect)!=null?i:[]]))}),start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema})}de(){return[]}options(t){let a=$e(this.$optionsSchema,t),n=Le(a);return new r({$queries:this.$queries,$options:c(c({},this.$options),n),start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema})}limit(t){return this.options({limit:t})}offset(t){return this.options({offset:t})}orderBy(t,a,n){if(!Array.isArray(t)&&typeof t!="string")throw new TypeError("invalid input");if(Array.isArray(t))return this.options({order:Jm(t)});let i=[t];return a&&i.push(a),n&&i.push("nulls",n),this.options({order_by:i.join(" ")})}where(t,a,n){return this.addWhere({fn:"where",field:t,operator:a,value:n})}orWhere(t,a,n){return this.addWhere({fn:"orWhere",field:t,operator:a,value:n})}whereIn(t,a){return this.addIn({fn:"whereIn",field:t,value:a})}orWhereIn(t,a){return this.addIn({fn:"orWhereIn",field:t,value:a})}whereNull(t){return this.addNull({fn:"whereNull",field:t})}orWhereNull(t){return this.addNull({fn:"orWhereNull",field:t})}whereNotNull(t){return this.addNull({fn:"whereNotNull",field:t})}orWhereNotNull(t){return this.addNull({fn:"orWhereNotNull",field:t})}whereMetadata(t,a,n){return this.addMetadata({fn:"whereMetadata",field:t,operator:a,value:n})}orWhereMetadata(t,a,n){return this.addMetadata({fn:"orWhereMetadata",field:t,operator:a,value:n})}whereMetadataIn(t,a){return this.addMetadataIn({fn:"whereMetadataIn",field:t,value:a})}orWhereMetadataIn(t,a){return this.addMetadataIn({fn:"orWhereMetadataIn",field:t,value:a})}whereMetadataNull(t){return this.addMetadataNull({fn:"whereMetadataNull",field:t})}orWhereMetadataNull(t){return this.addMetadataNull({fn:"orWhereMetadataNull",field:t})}whereMetadataNotNull(t){return this.addMetadataNull({fn:"whereMetadataNotNull",field:t})}orWhereMetadataNotNull(t){return this.addMetadataNull({fn:"orWhereMetadataNotNull",field:t})}};var Da=va.merge(xe).partial().describe("Optional flags for input"),Kt=o.object({foreign:F.describe("Foreign of the token").transform(r=>String(r)),type:ht,belongs_to:$.describe("Foreign of the wallet connected to token"),metadata:Q}).partial(),Vo=Kt.extend({options:Da.optional()}).strict().describe("Input for findTokens"),Tc=qn.describe("Output of findTokens");function tp(r,e,t){let{client:a}=r,n=new oe({start(i){return a.api.exportTokenMany({token:i.filter,options:i.options})},schemaBasic:Kt,schema:ka,optionsSchema:Da});if(e){let{filter:i,options:s}=ee(e,t);return n.where(i).options(s)}return n}var Qm=ns.merge(xe).partial().describe("Optional flags for input"),Ym=Kt,Zo=Ym.extend({options:Qm.optional()}).strict().describe("Input for exportTokens"),gc=Hn.describe("Output of exportTokens");var Jt=wa.merge(xe).partial().describe("Optional flags for input"),Qt=o.object({identifier:F.describe("Identifier of the transfer_group").transform(r=>String(r)),transfer_status:D.shape.transfer_status.describe("Status of the transfers"),status:D.shape.status.describe("Status of the transfer_group"),reverses:F.describe("Identifier of the transfer_group the transfer_group reverses").transform(r=>({identifier:String(r)})),type:Tt.describe("Type of the transfer group"),metadata:Q}).partial(),Uo=Qt.extend({options:Jt.optional()}).strict().describe("Input for findTransferGroups"),xc=Kn.describe("Output of findTransferGroups");function rp(r,e,t){let{client:a}=r,n=new oe({start(i){return a.api.exportTransferGroupMany({transfer_group:i.filter,options:i.options})},schemaBasic:Qt,schema:Lt,optionsSchema:Jt});if(e){let{filter:i,options:s}=ee(e,t);return n.where(i).options(s)}return n}var Xm=Jt.partial().describe("Optional flags for input"),eh=Qt.partial(),Lo=eh.extend({options:Xm.optional()}).strict().describe("Input for exportTransferGroups"),yc=Qn.describe("Output of exportTransferGroups");function ap(r,e,t){let{client:a}=r,n=new oe({start(i){return a.api.exportTransferMany({transfer:i.filter,options:i.options})},schemaBasic:Ht,schema:Re,optionsSchema:zt});if(e){let{filter:i,options:s}=ee(e,t);return n.where(i).options(s)}return n}var th=zt.partial().describe("Optional flags for input"),rh=Ht,$o=rh.extend({options:th.optional()}).strict().describe("Input for exportTransfers"),bc=Xn.describe("Output of exportTransfers");var ah=o.object({include_balance_for_token:$.describe("Foreign of token to include balance for")}),Ba=Aa.merge(xe).merge(ah).partial().describe("Optional flags for input"),Yt=o.object({foreign:Ze.describe("Wallet foreign"),name:Ze.describe("Wallet name"),type:mt,status:ft,metadata:Q}).partial(),qo=Yt.extend({options:Ba.optional()}).strict().describe("Input for findWallets"),Sc=eo.describe("Output of findWallets");var np=Ba.partial().describe("Optional flags for input"),nh=Yt.partial(),zo=nh.extend({options:np.optional()}).strict().describe("Input for exportWallets"),Oc=ro.describe("Output of exportWallets");function op(r,e,t){let{client:a}=r,n=new oe({start(i){return a.api.exportWalletMany({wallet:i.filter,options:i.options})},schemaBasic:Yt,schema:Ma,optionsSchema:np});if(e){let{filter:i,options:s}=ee(e,t);return n.where(i).options(s)}return n}var ip=ps.merge(xe).partial().describe("Optional flags for input"),sp=o.object({token:F.describe("Id of the token to withdrawal as").transform(r=>({foreign:String(r)})),wallet:F.describe("Id of the wallet to withdraw from").transform(r=>({foreign:String(r)}))}).partial(),Ho=sp.extend({options:ip.optional()}).strict().describe("Input for findBalances"),Fc=no.describe("Output of findBalances");function pp(r,e,t){let{client:a}=r,n=new oe({start(i){return a.api.findBalanceMany({balance:i.filter,options:i.options})},schemaBasic:sp,schema:cs,optionsSchema:ip});if(e){let{filter:i,options:s}=ee(e,t);return n.where(i).options(s)}return n}function up(r,e,t){let{client:a}=r,n=new oe({start(i){return a.api.findTokenMany({token:i.filter,options:i.options})},schemaBasic:Kt,schema:ka,optionsSchema:Da});if(e){let{filter:i,options:s}=ee(e,t);return n.where(i).options(s)}return n}function cp(r,e,t){let{client:a}=r,n=new oe({start(i){return a.api.findTransferGroupMany({transfer_group:i.filter,options:i.options})},schemaBasic:Qt,schema:Lt,optionsSchema:Jt});if(e){let{filter:i,options:s}=ee(e,t);return n.where(i).options(s)}return n}function lp(r,e,t){let{client:a}=r,n=new oe({start(i){return a.api.findTransferMany({transfer:i.filter,options:i.options})},schemaBasic:Ht,schema:Re,optionsSchema:zt});if(e){let{filter:i,options:s}=ee(e,t);if(s!=null&&s.return_running_balance){if(s!=null&&s.return_running_balance_for_wallet)throw new J("CONFLICTING_OPTIONS_FOR_BALANCE",{options:s});if(!i.wallet)throw new J("RUNNING_BALANCE_WITHOUT_WALLET",{input:i});s.return_running_balance_for_wallet=i.wallet}if(s!=null&&s.return_signed_amount){if(s!=null&&s.return_signed_amount_for_wallet)throw new J("CONFLICTING_OPTIONS_FOR_SIGNED_AMOUNT",{options:s});if(!i.wallet)throw new J("SIGNED_AMOUNT_WITHOUT_WALLET",{input:i});s.return_signed_amount_for_wallet=i.wallet}return n.where(i).options(s)}return n}function dp(r,e,t){let{client:a}=r,n=new oe({start(i){return a.api.findWalletMany({wallet:i.filter,options:i.options})},schemaBasic:Yt,schema:Ma,optionsSchema:Ba});if(e){let{filter:i,options:s}=ee(e,t);return n.where(i).options(s)}return n}var oh=Vi.describe("Optional flags for input"),ih=o.object({token:F.describe("Id of the token to get balance in"),wallet:F.describe("Id of the wallet to get balance for"),datetime:M.describe("Date and time this balance should be got")}).partial().required({wallet:!0}),Dr=ih.extend({options:oh.optional()}).strict().describe("Input for getBalance"),Ic=Ye.describe("Output of getBalance");var sh=p(Dr);function fp(r,e,t){let{client:a}=r,n=Ue(e,"token",a.getConfig("token")),i=sh.validateInputWOptions(n,t);if(i.datetime&&ru(i.datetime))throw new J("BAL_FUTURE_DATETIME",{input:i});let s=i.token||a.getConfig("token");if(s===void 0)throw new J("INPUT_NEEDS_TOKEN",{input:i});return a.api.getBalance({balance:{wallet:C(i.wallet),token:C(s),datetime:i.datetime},options:i.options})}var ph=ts.describe("Optional flags for input"),uh=o.object({token:F.describe("Id of the token to get balance in"),wallet:F.describe("Id of the wallet to get balance for"),datetime:M.describe("Select entries older than")}).partial().required({wallet:!0}),Br=uh.extend({options:ph.optional()}).strict().describe("Input for getBalanceHistory"),_c=Un.describe("Output of getBalanceHistory");var ch=p(Br);function mp(r,e,t){let{client:a}=r,n=ch.validateInputWOptions(e,t),i=n.token||a.getConfig("token");if(i===void 0)throw new J("INPUT_NEEDS_TOKEN",{input:e});return a.api.getBalanceHistory({balance:{wallet:C(n.wallet),token:C(i),datetime:n.datetime},options:n.options})}var lh=Yi.describe("Optional flags for input"),dh=o.object({identifier:o.string().describe("File name of the export to get")}),jr=dh.extend({options:lh.optional()}).strict().describe("Input for getExport"),vc=Ie.describe("Output of getExport");var fh=p(jr);function hp(r,e,t){let{client:a}=r,n=fh.validateInputWOptions(e,t);return a.api.getExport({export:{identifier:n.identifier},options:n.options})}var mh=ls.describe("Optional flags for input"),Pr=o.object({options:mh.optional()}).strict().describe("Input for getFlags"),kc=so.describe("Output of getFlags");var hh=p(Pr);function Tp(r,e,t){let{client:a}=r,n=hh.validateInputWOptions(e,t);return a.api.getFlags({options:n.options})}var Th=fs.describe("Optional flags for input"),Vr=o.object({model:ds,aggregator:o.literal("count"),group:Ta,timezone:an,filter:Qe,options:Th.optional()}).strict().partial().required({model:!0}).describe("Input for getStatistics"),wc=o.object({rows:o.object({aggregate:o.number().nullable(),period:o.string().optional()}).array()}).describe("Output of getStatistics");var gh=p(Vr);function gp(r,e,t){let{client:a}=r,n=gh.validateInputWOptions(e!=null?e:{},t),i=n.timezone;return a.api.getStatistics(c({model:n.model||"Transfer",aggregator:"count",filter:n.filter,options:n.options},n.group?{groups:[{type:"period",field:i?{period:n.group,timezone:i}:n.group,alias:"period"}]}:{}))}var xh=Sa.describe("Optional flags for input"),yh=o.object({foreign:F.describe("Foreign of the token")}).partial(),Zr=yh.extend({options:xh.optional()}).strict().describe("Input for getToken"),Rc=hn.describe("Output of getToken");var bh=p(Zr);function xp(r,e={},t){let{client:a}=r,n=Ue(e,"foreign",a.getConfig("token")),i=bh.validateInputWOptions(n,t),s=i.foreign||a.getConfig("token");if(s===void 0)throw new J("INPUT_NEEDS_TOKEN",{input:e});return a.api.getToken({token:C(s),options:i.options})}var Sh=wi.describe("Optional flags for input"),Oh=o.object({transfer:F.describe("Transfer identifier")}).partial().required({transfer:!0}),Ur=Oh.extend({options:Sh.optional()}).strict().describe("Input for getTransfer"),Ac=Ne.describe("Output of getTransfer");var Fh=p(Ur);function yp(r,e,t){let{client:a}=r,n=Fh.validateInputWOptions(e,t);return a.api.getTransfer({transfer:ce(n.transfer),options:n.options})}var Ih=Mi.describe("Optional flags for input"),_h=o.object({transfer_group:F.describe("identifier of the transfer group to reverse")}).partial().required({transfer_group:!0}),Lr=_h.extend({options:Ih.optional()}).strict().describe("Input for getTransferGroup"),Mc=gn.describe("Output of getTransferGroup");var vh=p(Lr);function bp(r,e,t){let{client:a}=r,n=vh.validateInputWOptions(e,t);return a.api.getTransferGroup({transfer_group:ce(n.transfer_group),options:n.options})}var kh=ba.describe("Optional flags for input"),wh=o.object({wallet:F.describe("Wallet foreign")}).partial().required({wallet:!0}),$r=wh.extend({options:kh.optional()}).strict().describe("Input for getWallet"),Ec=cn.describe("Output of getWallet");var Rh=p($r);function Sp(r,e,t){let{client:a}=r,n=Rh.validateInputWOptions(e,t);return a.api.getWallet({wallet:C(n.wallet),options:n.options})}var Ah=ms.describe("Optional flags for input"),qr=o.object({options:Ah.optional()}).strict().describe("Input for healthcheck"),Gc=fo.describe("Output of healthcheck");var Mh=p(qr);function Op(r,e,t){let{client:a}=r,n=Mh.validateInputWOptions(e,t);return a.api.healthcheck({options:c(c({},n.options),t)})}var Eh=Ts.merge(xe).partial().describe("Optional flags for input"),Gh=o.object({type:Qi.describe("type of the export"),date:o.string().date().describe("Date of the export")}).partial(),zr=Gh.extend({options:Eh.optional()}).strict().describe("Input for listExports"),Cc=ho.describe("Output of listExports");var Ch=p(zr);function Fp(r,e,t){let{client:a}=r,n=Ch.validateInputWOptions(e,t),i=tu(n==null?void 0:n.date),s=Le(n.options);return a.api.listExportMany({export:c(c({},i?{date:i}:{}),n.type?{type:n.type}:{}),options:s})}var Wh=ys.describe("Optional flags for input"),Nh=o.object({transfer:F.describe("Transfer identifier"),status:pe.describe("Status of the created transfer"),identifier:h.shape.identifier.describe("Identifier for the created transfer"),force:h.shape.force.describe("Force create the reverse transfer ignoring balance"),metadata:h.shape.metadata.describe("Metadata for the reversed transfers"),extend_metadata:h.shape.metadata.describe("Key value object to extend metadata with on created transfer")}).partial().required({transfer:!0}),Hr=Nh.extend({options:Wh.optional()}).strict().describe("Input for reverseTransfer"),Wc=bo.describe("Output of reverseTransfer");var Dh=p(Hr);function Ip(r,e,t){let{client:a}=r,n=Dh.validateInputWOptions(e,t);return n.extend_metadata&&console.warn("deprecated: extend_metadata is deprecated. Use metadata_action instead"),a.api.reverseTransfer({transfer:ce(n.transfer),reverse:{force:n.force,metadata:n.metadata,extend_metadata:n.extend_metadata,identifier:n.identifier,status:n.status},options:n.options})}var Bh=Ea.describe("Optional flags for input"),jh=o.object({transfer_group:F.describe("identifier of the transfer group to reverse"),status:We,transfer_status:pe,identifier:D.shape.identifier,force:h.shape.force,metadata:D.shape.metadata,transfer_metadata:h.shape.metadata,extend_metadata:D.shape.metadata.describe("Key value object to extend metadata with on created transfer"),transfer_extend_metadata:h.shape.metadata.describe("Key value object to extend metadata with on created transfer")}).partial().required({transfer_group:!0}),Kr=jh.extend({options:Bh.optional()}).strict().describe("Input for reverseTransferGroup"),Nc=Oo.describe("Output of reverseTransferGroup");var Ph=p(Kr);function _p(r,e,t){let{client:a}=r,n=Ph.validateInputWOptions(e,t);return n.extend_metadata&&console.warn("deprecated: extend_metadata is deprecated. Use metadata_action instead"),a.api.reverseTransferGroup({transfer_group:ce(n.transfer_group),reverse:{status:n.status,force:n.force,transfer_status:n.transfer_status,identifier:n.identifier,metadata:n.metadata,transfer_metadata:n.transfer_metadata,extend_metadata:n.extend_metadata,transfer_extend_metadata:n.transfer_extend_metadata},options:n.options})}var Jr=class r extends De{constructor({$queries:t,$options:a,start:n,schema:i,schemaBasic:s,optionsSchema:u,reverse:l,reverseSchema:d}){super(s,i,t);b(this,"$options");b(this,"$optionsSchema");b(this,"$start");b(this,"$reverseSchema");b(this,"$reverse");this.$options=a,this.$optionsSchema=u,this.$start=n,this.$reverse=l,this.$reverseSchema=d}add(t){return new r({$queries:[...this.$queries,t],$options:this.$options,start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema,reverse:this.$reverse,reverseSchema:this.$reverseSchema})}start(){return this.$start(this.toJSON())}toJSON(){return{filter:super.toQuery(),reverse:this.$reverse,options:c({},this.$options)}}then(t,a){return this.start().then(t,a)}catch(t){return this.start().catch(t)}finally(t){return this.start().finally(t)}stream(){return this.start().stream()}options(t){let a=$e(this.$optionsSchema,t),n=Le(a);return new r({$queries:this.$queries,$options:c(c({},this.$options),n),start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema,reverse:this.$reverse,reverseSchema:this.$reverseSchema})}reverse(t){var n;let a=$e(this.$reverseSchema,t);return new r({$queries:this.$queries,$options:this.$options,start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema,reverseSchema:this.$reverseSchema,reverse:c(c({},(n=this.$reverse)!=null?n:{}),a)})}where(t,a,n){return this.addWhere({fn:"where",field:t,operator:a,value:n})}orWhere(t,a,n){return this.addWhere({fn:"orWhere",field:t,operator:a,value:n})}whereIn(t,a){return this.addIn({fn:"whereIn",field:t,value:a})}orWhereIn(t,a){return this.addIn({fn:"orWhereIn",field:t,value:a})}whereNull(t){return this.addNull({fn:"whereNull",field:t})}orWhereNull(t){return this.addNull({fn:"orWhereNull",field:t})}whereNotNull(t){return this.addNull({fn:"whereNotNull",field:t})}orWhereNotNull(t){return this.addNull({fn:"orWhereNotNull",field:t})}whereMetadata(t,a,n){return this.addMetadata({fn:"whereMetadata",field:t,operator:a,value:n})}orWhereMetadata(t,a,n){return this.addMetadata({fn:"orWhereMetadata",field:t,operator:a,value:n})}whereMetadataIn(t,a){return this.addMetadataIn({fn:"whereMetadataIn",field:t,value:a})}orWhereMetadataIn(t,a){return this.addMetadataIn({fn:"orWhereMetadataIn",field:t,value:a})}whereMetadataNull(t){return this.addMetadataNull({fn:"whereMetadataNull",field:t})}orWhereMetadataNull(t){return this.addMetadataNull({fn:"orWhereMetadataNull",field:t})}whereMetadataNotNull(t){return this.addMetadataNull({fn:"whereMetadataNotNull",field:t})}orWhereMetadataNotNull(t){return this.addMetadataNull({fn:"orWhereMetadataNotNull",field:t})}};var vp=Os.describe("Optional flags for input"),Vh=Ss.describe("In case the transfer will be made then apply these modifications"),kp=Re.omit({status_finalized_at:!0}).extend({wallet:$.describe("Foreign of the wallet connected to transfers"),token:$.describe("Foreign of the token transferred"),from_wallet:$.describe("Foreign of the wallet transfers are made from"),to_wallet:$.describe("Foreign of the wallet transfers are made to"),transfer_group:$.describe("Foreign of the transfer_group the transfers are a part of"),status:z.describe("Status of the transfers"),metadata:Q}).partial(),Zh=kp.extend({reverse:Vh}).partial(),Ko=Zh.extend({options:vp.optional()}).strict().describe("Input for reverseTransfers"),Dc=_o.describe("Output of reverseTransfers");function wp(r,e,t){let{client:a}=r,n=new Jr({start(s){return a.api.reverseTransferMany({transfer:s.filter,reverse:s.reverse,options:s.options})},schemaBasic:kp,schema:Re,optionsSchema:vp,reverseSchema:xs});if(e){let{filter:s,options:u}=ee(e,t),i=s,{reverse:l}=i,d=ae(i,["reverse"]);return l?n.where(d).options(u).reverse(l):n.where(d).options(u)}return n}var Uh=Fs.describe("Optional flags for input"),Qr=at.extend({options:Uh.optional()}).strict().describe("Input for setFlags"),Bc=ko.describe("Output of setFlags");var Lh=p(Qr);function Rp(r,e,t){let{client:a}=r,n=Lh.validateInputWOptions(e,t),i=at.keyof().options,s={};if(i.forEach(u=>{u in n&&(s[u]=n[u])}),Object.keys(s).length<1)throw new J("REQUIRED_INPUT_MISSING",{requiredOneOf:i,input:e});return a.api.setFlags({flags:s,options:n.options})}var $h=Is.describe("Optional flags for input"),qh=o.object({token:F.describe("Token foreign"),metadata:P.shape.metadata,public:P.shape.public,status:P.shape.status}).partial().required({token:!0}),Yr=qh.extend({options:$h.optional()}).strict().describe("Input for updateToken"),jc=Ao.describe("Output of updateToken");var zh=p(Yr);function Ap(r,e,t){let{client:a}=r,n=zh.validateInputWOptions(e,t);return a.api.updateToken({token:C(n.token),update:{public:n.public,metadata:n.metadata,status:n.status},options:n.options})}var Hh=gs.describe("Optional flags for input"),ja=o.enum(["finished","cancelled"]).describe("Status the transfer should be set to"),Kh=o.object({transfer:F.describe("Transfer identifier"),metadata:h.shape.metadata,extend_metadata:h.shape.metadata,status:ja}).partial().required({transfer:!0}),Xr=Kh.extend({options:Hh.optional()}).strict().describe("Input for updateTransfer"),Pc=Sr.describe("Output of updateTransfer");var Jh=p(Xr);function Mp(r,e,t){let{client:a}=r,n=Jh.validateInputWOptions(e,t);return a.api.updateTransfer({transfer:ce(n.transfer),update:{status:n.status,metadata:n.metadata,extend_metadata:n.extend_metadata},options:n.options})}var Qh=Ga.describe("Optional flags for input"),Yh=o.object({transfer_group:F.describe("TransferGroup identifier"),status:o.enum(["closed"]).describe("Lifecycle status of the TransferGroup"),transfer_status:ja.describe("Status all the transfers should be set at."),metadata:D.shape.metadata.describe("Key value object to be replaced or extended with existing TransferGroup metadata")}).partial().required({transfer_group:!0}),ea=Yh.extend({options:Qh.optional()}).strict().describe("Input for updateTransferGroup"),Vc=Eo.describe("Output of updateTransferGroup");var Xh=p(ea);function Ep(r,e,t){let{client:a}=r,n=Xh.validateInputWOptions(e,t);return a.api.updateTransferGroup({transfer_group:ce(n.transfer_group),update:{transfer_status:n.transfer_status,status:n.status,metadata:n.metadata},options:n.options})}var Gp=vs.describe("Optional flags for input");var Cp=o.object({identifier:F.describe("Identifier of the transfer_group"),transfer_status:ja.describe("Status of the transfers"),status:D.shape.status.describe("Status of the transfer_group"),reverses:$.describe("Identifier of the transfer_group the transfer_group reverses"),type:Tt.describe("Type of the transfer group"),metadata:Q}).partial(),eT=Cp.extend({update:qt}),Jo=eT.extend({options:Gp.optional()}).strict().describe("Input for updateTransferGroups"),Zc=Co.describe("Output of updateTransferGroups");var bt=class r extends De{constructor({$queries:t,$options:a,start:n,schema:i,schemaBasic:s,optionsSchema:u,update:l,updateSchema:d}){super(s,i,t);b(this,"$options");b(this,"$optionsSchema");b(this,"$start");b(this,"$updateSchema");b(this,"$update");this.$options=a,this.$optionsSchema=u,this.$start=n,this.$update=l,this.$updateSchema=d}add(t){return new r({$queries:[...this.$queries,t],$options:this.$options,start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema,update:this.$update,updateSchema:this.$updateSchema})}start(){return this.$start(this.toJSON())}toJSON(){return{filter:super.toQuery(),update:this.$update,options:c({},this.$options)}}then(t,a){return this.start().then(t,a)}catch(t){return this.start().catch(t)}finally(t){return this.start().finally(t)}stream(){return this.start().stream()}options(t){let a=$e(this.$optionsSchema,t),n=Le(a);return new r({$queries:this.$queries,$options:c(c({},this.$options),n),start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema,update:this.$update,updateSchema:this.$updateSchema})}update(t){var n;let a=$e(this.$updateSchema,t);return new r({$queries:this.$queries,$options:this.$options,start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema,updateSchema:this.$updateSchema,update:c(c({},(n=this.$update)!=null?n:{}),a)})}where(t,a,n){return this.addWhere({fn:"where",field:t,operator:a,value:n})}orWhere(t,a,n){return this.addWhere({fn:"orWhere",field:t,operator:a,value:n})}whereIn(t,a){return this.addIn({fn:"whereIn",field:t,value:a})}orWhereIn(t,a){return this.addIn({fn:"orWhereIn",field:t,value:a})}whereNull(t){return this.addNull({fn:"whereNull",field:t})}orWhereNull(t){return this.addNull({fn:"orWhereNull",field:t})}whereNotNull(t){return this.addNull({fn:"whereNotNull",field:t})}orWhereNotNull(t){return this.addNull({fn:"orWhereNotNull",field:t})}whereMetadata(t,a,n){return this.addMetadata({fn:"whereMetadata",field:t,operator:a,value:n})}orWhereMetadata(t,a,n){return this.addMetadata({fn:"orWhereMetadata",field:t,operator:a,value:n})}whereMetadataIn(t,a){return this.addMetadataIn({fn:"whereMetadataIn",field:t,value:a})}orWhereMetadataIn(t,a){return this.addMetadataIn({fn:"orWhereMetadataIn",field:t,value:a})}whereMetadataNull(t){return this.addMetadataNull({fn:"whereMetadataNull",field:t})}orWhereMetadataNull(t){return this.addMetadataNull({fn:"orWhereMetadataNull",field:t})}whereMetadataNotNull(t){return this.addMetadataNull({fn:"whereMetadataNotNull",field:t})}orWhereMetadataNotNull(t){return this.addMetadataNull({fn:"orWhereMetadataNotNull",field:t})}};function Wp(r,e,t){let{client:a}=r,n=new bt({start(s){return a.api.updateTransferGroupMany({transfer_group:s.filter,update:s.update,options:s.options})},schemaBasic:Cp,schema:Lt,optionsSchema:Gp,updateSchema:qt});if(e){let{filter:s,options:u}=ee(e,t),i=s,{update:l}=i,d=ae(i,["update"]);return n.where(d).options(u).update(l)}return n}var Np=ks.describe("Optional flags for input"),YE=o.enum(["finished","cancelled"]).describe("Status the transfer should be set to");var Dp=o.object({identifier:F.describe("The identifier of the transfer"),wallet:$.describe("Foreign of the wallet connected to transfers"),token:$.describe("Foreign of the token transferred"),from_wallet:$.describe("Foreign of the wallet transfers are made from"),to_wallet:$.describe("Foreign of the wallet transfers are made to"),transfer_group:$.describe("Foreign of the transfer_group the transfers are a part of"),status:z.describe("Status of the transfers"),metadata:Q}).partial(),tT=Dp.extend({update:$t}),Qo=tT.extend({options:Np.optional()}).strict().describe("Input for updateTransfers"),Uc=No.describe("Output of updateTransfers");function Bp(r,e,t){let{client:a}=r,n=new bt({start(s){return a.api.updateTransferMany({transfer:s.filter,update:s.update,options:s.options})},schemaBasic:Dp,schema:Re,optionsSchema:Np,updateSchema:$t});if(e){let{filter:s,options:u}=ee(e,t),i=s,{update:l}=i,d=ae(i,["update"]);return n.where(d).options(u).update(l)}return n}var rT=ws.describe("Optional flags for input"),aT=o.object({wallet:F.describe("Wallet foreign"),metadata:Z.shape.metadata,name:Z.shape.name,status:Z.shape.status}).partial().required({wallet:!0}),ta=aT.extend({options:rT.optional()}).strict().describe("Input for updateWallet"),Lc=Bo.describe("Output of updateWallet");var nT=p(ta);function jp(r,e,t){let{client:a}=r,n=nT.validateInputWOptions(e,t);return a.api.updateWallet({wallet:C(n.wallet),update:{metadata:n.metadata,status:n.status,name:n.name},options:n.options})}var $c=(G=>(G.aggregateTransfers="aggregateTransfers",G.createAccessToken="createAccessToken",G.createContract="createContract",G.createDeposit="createDeposit",G.createExchange="createExchange",G.createToken="createToken",G.createTransfer="createTransfer",G.createTransferGroup="createTransferGroup",G.createTransfers="createTransfers",G.createWallet="createWallet",G.createWithdrawal="createWithdrawal",G.exportBalanceHistory="exportBalanceHistory",G.exportTokens="exportTokens",G.exportTransferGroups="exportTransferGroups",G.exportTransfers="exportTransfers",G.exportWallets="exportWallets",G.findBalances="findBalances",G.findTokens="findTokens",G.findTransferGroups="findTransferGroups",G.findTransfers="findTransfers",G.findWallets="findWallets",G.getBalance="getBalance",G.getBalanceHistory="getBalanceHistory",G.getExport="getExport",G.getFlags="getFlags",G.getStatistics="getStatistics",G.getToken="getToken",G.getTransfer="getTransfer",G.getTransferGroup="getTransferGroup",G.getWallet="getWallet",G.healthcheck="healthcheck",G.listExports="listExports",G.reverseTransfer="reverseTransfer",G.reverseTransferGroup="reverseTransferGroup",G.reverseTransfers="reverseTransfers",G.setFlags="setFlags",G.updateToken="updateToken",G.updateTransfer="updateTransfer",G.updateTransferGroup="updateTransferGroup",G.updateTransferGroups="updateTransferGroups",G.updateTransfers="updateTransfers",G.updateWallet="updateWallet",G))($c||{}),A={aggregateTransfers:Bs,createAccessToken:js,createContract:Ps,createDeposit:Vs,createExchange:Zs,createToken:Us,createTransfer:Ks,createTransferGroup:Js,createTransfers:Qs,createWallet:Ys,createWithdrawal:Xs,exportBalanceHistory:ep,exportTokens:tp,exportTransferGroups:rp,exportTransfers:ap,exportWallets:op,findBalances:pp,findTokens:up,findTransferGroups:cp,findTransfers:lp,findWallets:dp,getBalance:fp,getBalanceHistory:mp,getExport:hp,getFlags:Tp,getStatistics:gp,getToken:xp,getTransfer:yp,getTransferGroup:bp,getWallet:Sp,healthcheck:Op,listExports:Fp,reverseTransfer:Ip,reverseTransferGroup:_p,reverseTransfers:wp,setFlags:Rp,updateToken:Ap,updateTransfer:Mp,updateTransferGroup:Ep,updateTransferGroups:Wp,updateTransfers:Bp,updateWallet:jp},oT={aggregateTransfers:p(jo),createAccessToken:p(vr),createContract:p(kr),createDeposit:p(wr),createExchange:p(Rr),createToken:p(Ar),createTransfer:p(Mr),createTransferGroup:p(Er),createTransfers:p(Gr),createWallet:p(Cr),createWithdrawal:p(Wr),exportBalanceHistory:p(Nr),exportTokens:p(Zo),exportTransferGroups:p(Lo),exportTransfers:p($o),exportWallets:p(zo),findBalances:p(Ho),findTokens:p(Vo),findTransferGroups:p(Uo),findTransfers:p(_r),findWallets:p(qo),getBalance:p(Dr),getBalanceHistory:p(Br),getExport:p(jr),getFlags:p(Pr),getStatistics:p(Vr),getToken:p(Zr),getTransfer:p(Ur),getTransferGroup:p(Lr),getWallet:p($r),healthcheck:p(qr),listExports:p(zr),reverseTransfer:p(Hr),reverseTransferGroup:p(Kr),reverseTransfers:p(Ko),setFlags:p(Qr),updateToken:p(Yr),updateTransfer:p(Xr),updateTransferGroup:p(ea),updateTransferGroups:p(Jo),updateTransfers:p(Qo),updateWallet:p(ta)};var ra=class{constructor(e,t){b(this,"api");b(this,"$connect");b(this,"config",{});this.api=e,this.$connect=e.$connect,t&&this.configure(c(c(c(c(c(c(c({},t.token&&{token:t.token}),t.sendingTimeout&&{sendingTimeout:t.sendingTimeout}),t.connectingTimeout&&{connectingTimeout:t.connectingTimeout}),t.reconnectingTimeout&&{reconnectingTimeout:t.reconnectingTimeout}),t.hooks&&{hooks:t.hooks}),t.connectionName&&{connectionName:t.connectionName}),t.httpSkipInitialAuthConnection&&{httpSkipInitialAuthConnection:t.httpSkipInitialAuthConnection}))}close(){return X(this,null,function*(){return this.api.close()})}version(){return Ua}setHook(e,t){if(typeof t!="function")throw new TypeError("Hooks can only be functions");return this.api.hooks[e]=t,this}configure(e){if(e.token&&typeof e.token!="string"&&typeof e.token!="number")throw new _e("CONFIG_INVALID",{field:"token",error:`Must be a string|number, '${e.token}' provided`});["sendingTimeout","connectingTimeout","reconnectingTimeout"].forEach(a=>{if(e[a]&&typeof e[a]!="number")throw new _e("CONFIG_INVALID",{field:a,error:`Must be a number, '${e[a]}' provided`})});let t=e.hooks;if(delete e.hooks,this.config=c(c({},this.config),e),this.config.sendingTimeout&&(this.api.sendingTimeout=this.config.sendingTimeout),t)for(let[a,n]of Object.entries(t))this.setHook(a,n);return this}getConfig(e){return this.config[e]}aggregateTransfers(e,t){return A.aggregateTransfers({client:this},e!=null?e:{},t)}createAccessToken(e,t){return A.createAccessToken({client:this},e!=null?e:{},t)}createContract(e,t){return A.createContract({client:this},e,t)}createDeposit(e,t){return A.createDeposit({client:this},e,t)}createExchange(e,t){return A.createExchange({client:this},e,t)}createToken(e,t){return A.createToken({client:this},e,t)}createTransfer(e,t){return A.createTransfer({client:this},e,t)}createTransferGroup(e,t){return A.createTransferGroup({client:this},e!=null?e:{},t)}createTransfers(e,t){return A.createTransfers({client:this},e,t)}createWallet(e,t){return A.createWallet({client:this},e,t)}createWithdrawal(e,t){return A.createWithdrawal({client:this},e,t)}exportBalanceHistory(e,t){return A.exportBalanceHistory({client:this},e,t)}exportTokens(e,t){return A.exportTokens({client:this},e!=null?e:{},t)}exportTransferGroups(e,t){return A.exportTransferGroups({client:this},e!=null?e:{},t)}exportTransfers(e,t){return A.exportTransfers({client:this},e!=null?e:{},t)}exportWallets(e,t){return A.exportWallets({client:this},e!=null?e:{},t)}findBalances(e,t){return A.findBalances({client:this},e!=null?e:{},t)}findTokens(e,t){return A.findTokens({client:this},e!=null?e:{},t)}findTransferGroups(e,t){return A.findTransferGroups({client:this},e!=null?e:{},t)}findTransfers(e,t){return A.findTransfers({client:this},e!=null?e:{},t)}findWallets(e,t){return A.findWallets({client:this},e!=null?e:{},t)}getBalance(e,t){return A.getBalance({client:this},e,t)}getBalanceHistory(e,t){return A.getBalanceHistory({client:this},e,t)}getExport(e,t){return A.getExport({client:this},e,t)}getFlags(e,t){return A.getFlags({client:this},e!=null?e:{},t)}getStatistics(e,t){return A.getStatistics({client:this},e!=null?e:{},t)}getToken(e,t){return A.getToken({client:this},e!=null?e:{},t)}getTransfer(e,t){return A.getTransfer({client:this},e,t)}getTransferGroup(e,t){return A.getTransferGroup({client:this},e,t)}getWallet(e,t){return A.getWallet({client:this},e,t)}healthcheck(e,t){return A.healthcheck({client:this},e!=null?e:{},t)}listExports(e,t){return A.listExports({client:this},e!=null?e:{},t)}reverseTransfer(e,t){return A.reverseTransfer({client:this},e,t)}reverseTransferGroup(e,t){return A.reverseTransferGroup({client:this},e,t)}reverseTransfers(e,t){return A.reverseTransfers({client:this},e!=null?e:{},t)}setFlags(e,t){return A.setFlags({client:this},e!=null?e:{},t)}updateToken(e,t){return A.updateToken({client:this},e,t)}updateTransfer(e,t){return A.updateTransfer({client:this},e,t)}updateTransferGroup(e,t){return A.updateTransferGroup({client:this},e,t)}updateTransferGroups(e,t){return A.updateTransferGroups({client:this},e,t)}updateTransfers(e,t){return A.updateTransfers({client:this},e,t)}updateWallet(e,t){return A.updateWallet({client:this},e,t)}};function qc(r,e){let t=Es(r,{connectingTimeout:e==null?void 0:e.connectingTimeout,reconnectingTimeout:e==null?void 0:e.reconnectingTimeout});return new ra(t,e)}function zc(r,e){let t=Ws(r,{connectingTimeout:e==null?void 0:e.connectingTimeout,reconnectingTimeout:e==null?void 0:e.reconnectingTimeout,httpSkipInitialAuthConnection:e==null?void 0:e.httpSkipInitialAuthConnection,connectionName:e==null?void 0:e.connectionName});return new ra(t,e)}var iW=o.enum(["ws","https"]),Pp=o.object({host:o.string().describe("URL of the API"),apikey:o.string().describe("API key for the client"),apisecret:o.string().describe("API secret for the client")}).passthrough(),iT=o.object({client:o.literal("ws"),connection:Pp}),Vp=o.object({host:o.string().describe("URL of the API"),jwt:o.string().describe("Auth token for calling api")}).passthrough(),sT=o.object({client:o.literal("https"),connection:Vp}),sW=o.union([iT,sT]);function Hc(){"withResolvers"in Promise||Object.assign(Promise,{withResolvers:function(){let r,e;return{promise:new Promise((a,n)=>{r=a,e=n}),resolve:r,reject:e}}})}var Kc={aggregateTransfersFnInput:p(jo),aggregateTransfersFnOutput:p(tc),createAccessTokenFnInput:p(vr),createAccessTokenFnOutput:p(oc),createContractFnInput:p(kr),createContractFnOutput:p(ic),createDepositFnInput:p(wr),createDepositFnOutput:p(sc),createExchangeFnInput:p(Rr),createExchangeFnOutput:p(pc),createTokenFnInput:p(Ar),createTokenFnOutput:p(uc),createTransferFnInput:p(Mr),createTransferFnOutput:p(cc),createTransferGroupFnInput:p(Er),createTransferGroupFnOutput:p(lc),createTransfersFnInput:p(Gr),createTransfersFnOutput:p(dc),createWalletFnInput:p(Cr),createWalletFnOutput:p(fc),createWithdrawalFnInput:p(Wr),createWithdrawalFnOutput:p(mc),exportBalanceHistoryFnInput:p(Nr),exportBalanceHistoryFnOutput:p(hc),exportTokensFnInput:p(Zo),exportTokensFnOutput:p(gc),exportTransferGroupsFnInput:p(Lo),exportTransferGroupsFnOutput:p(yc),exportTransfersFnInput:p($o),exportTransfersFnOutput:p(bc),exportWalletsFnInput:p(zo),exportWalletsFnOutput:p(Oc),findBalancesFnInput:p(Ho),findBalancesFnOutput:p(Fc),findTokensFnInput:p(Vo),findTokensFnOutput:p(Tc),findTransferGroupsFnInput:p(Uo),findTransferGroupsFnOutput:p(xc),findTransfersFnInput:p(_r),findTransfersFnOutput:p(nc),findWalletsFnInput:p(qo),findWalletsFnOutput:p(Sc),getBalanceFnInput:p(Dr),getBalanceFnOutput:p(Ic),getBalanceHistoryFnInput:p(Br),getBalanceHistoryFnOutput:p(_c),getExportFnInput:p(jr),getExportFnOutput:p(vc),getFlagsFnInput:p(Pr),getFlagsFnOutput:p(kc),getStatisticsFnInput:p(Vr),getStatisticsFnOutput:p(wc),getTokenFnInput:p(Zr),getTokenFnOutput:p(Rc),getTransferFnInput:p(Ur),getTransferFnOutput:p(Ac),getTransferGroupFnInput:p(Lr),getTransferGroupFnOutput:p(Mc),getWalletFnInput:p($r),getWalletFnOutput:p(Ec),healthcheckFnInput:p(qr),healthcheckFnOutput:p(Gc),listExportsFnInput:p(zr),listExportsFnOutput:p(Cc),reverseTransferFnInput:p(Hr),reverseTransferFnOutput:p(Wc),reverseTransferGroupFnInput:p(Kr),reverseTransferGroupFnOutput:p(Nc),reverseTransfersFnInput:p(Ko),reverseTransfersFnOutput:p(Dc),setFlagsFnInput:p(Qr),setFlagsFnOutput:p(Bc),updateTokenFnInput:p(Yr),updateTokenFnOutput:p(jc),updateTransferFnInput:p(Xr),updateTransferFnOutput:p(Pc),updateTransferGroupFnInput:p(ea),updateTransferGroupFnOutput:p(Vc),updateTransferGroupsFnInput:p(Jo),updateTransferGroupsFnOutput:p(Zc),updateTransfersFnInput:p(Qo),updateTransfersFnOutput:p(Uc),updateWalletFnInput:p(ta),updateWalletFnOutput:p(Lc),aggregateTransferManyTxInput:p(yn),aggregateTransferManyTxOutput:p(bn),authenticationCheckTxInput:p(Sn),authenticationCheckTxOutput:p(Nu),createAccessTokenTxInput:p(On),createAccessTokenTxOutput:p(Fn),createContractTxInput:p(wn),createContractTxOutput:p(Rn),createDepositTxInput:p(An),createDepositTxOutput:p(Mn),createDistributionTxInput:p(En),createDistributionTxOutput:p(Du),createTokenTxInput:p(Gn),createTokenTxOutput:p(Cn),createTransferTxInput:p(vn),createTransferTxOutput:p(xt),createTransferGroupTxInput:p(kn),createTransferGroupTxOutput:p(yt),createTransferManyTxInput:p(Wn),createTransferManyTxOutput:p(Nn),createWalletTxInput:p(Dn),createWalletTxOutput:p(Bn),createWithdrawalTxInput:p(jn),createWithdrawalTxOutput:p(Pn),exportBalanceHistoryTxInput:p(Ln),exportBalanceHistoryTxOutput:p($n),exportTokenManyTxInput:p(zn),exportTokenManyTxOutput:p(Hn),exportTransferGroupManyTxInput:p(Jn),exportTransferGroupManyTxOutput:p(Qn),exportTransferManyTxInput:p(Yn),exportTransferManyTxOutput:p(Xn),exportWalletManyTxInput:p(to),exportWalletManyTxOutput:p(ro),findBalanceManyTxInput:p(ao),findBalanceManyTxOutput:p(no),findTokenManyTxInput:p(gr),findTokenManyTxOutput:p(qn),findTransferGroupManyTxInput:p(xr),findTransferGroupManyTxOutput:p(Kn),findTransferManyTxInput:p(mr),findTransferManyTxOutput:p(xn),findWalletManyTxInput:p(yr),findWalletManyTxOutput:p(eo),finishTransactionTxInput:p(oo),finishTransactionTxOutput:p(Pu),getBalanceTxInput:p(In),getBalanceTxOutput:p(Ye),getBalanceHistoryTxInput:p(Zn),getBalanceHistoryTxOutput:p(Un),getExportTxInput:p(Vn),getExportTxOutput:p(Ie),getFlagsTxInput:p(io),getFlagsTxOutput:p(so),getStatisticsTxInput:p(po),getStatisticsTxOutput:p(Vu),getTokenTxInput:p(mn),getTokenTxOutput:p(hn),getTokenManyTxInput:p(uo),getTokenManyTxOutput:p(Zu),getTransferTxInput:p(dn),getTransferTxOutput:p(Ne),getTransferGroupTxInput:p(Tn),getTransferGroupTxOutput:p(gn),getWalletTxInput:p(pn),getWalletTxOutput:p(cn),getWalletManyTxInput:p(co),getWalletManyTxOutput:p(Uu),healthcheckTxInput:p(lo),healthcheckTxOutput:p(fo),importActionsTxInput:p(br),importActionsTxOutput:p(Lu),listExportManyTxInput:p(mo),listExportManyTxOutput:p(ho),queryLogsTxInput:p(To),queryLogsTxOutput:p($u),resetDatabaseTxInput:p(go),resetDatabaseTxOutput:p(qu),reverseTransferTxInput:p(yo),reverseTransferTxOutput:p(bo),reverseTransferGroupTxInput:p(So),reverseTransferGroupTxOutput:p(Oo),reverseTransferGroupManyTxInput:p(Fo),reverseTransferGroupManyTxOutput:p(zu),reverseTransferManyTxInput:p(Io),reverseTransferManyTxOutput:p(_o),setFlagsTxInput:p(vo),setFlagsTxOutput:p(ko),startTransactionTxInput:p(wo),startTransactionTxOutput:p(Hu),updateTokenTxInput:p(Ro),updateTokenTxOutput:p(Ao),updateTransferTxInput:p(xo),updateTransferTxOutput:p(Sr),updateTransferGroupTxInput:p(Mo),updateTransferGroupTxOutput:p(Eo),updateTransferGroupManyTxInput:p(Go),updateTransferGroupManyTxOutput:p(Co),updateTransferManyTxInput:p(Wo),updateTransferManyTxOutput:p(No),updateWalletTxInput:p(Do),updateWalletTxOutput:p(Bo)};var Jc=o.enum(["flag","setting"]).describe("Type of the setting"),Qc=Y(Jc.options),tD=o.object({id:o.number().int().positive().describe("System defined primary key"),name:o.string().min(1).max(255).describe("name of setting. Must be unique"),value:o.string().describe("value of setting"),applied:o.boolean().describe("is setting applied"),created_at:M.describe("Datetime of the initial create"),updated_at:M.describe("Datetime of the last update"),type:Jc}).strict().describe("WapiSetting|Database settings");Hc();var pT=p(Pp),uT=p(Vp),Yc=(t=>(t.ws="ws",t.https="https",t))(Yc||{});function cT(r){let{config:e,client:t,connection:a}=r;if((t!=null?t:"ws")==="ws"){let n=pT.validateInput(a);return qc(n,e)}if(t==="https"){let n=uT.validateInput(a);return zc(n,e)}throw new TypeError("Invalid client type")}var lT={getIdentifier:pi};return hl(dT);})();
1
+ "use strict";var WAPI=(()=>{var il=Object.create;var na=Object.defineProperty,sl=Object.defineProperties,pl=Object.getOwnPropertyDescriptor,ul=Object.getOwnPropertyDescriptors,cl=Object.getOwnPropertyNames,Za=Object.getOwnPropertySymbols,ll=Object.getPrototypeOf,ti=Object.prototype.hasOwnProperty,Lp=Object.prototype.propertyIsEnumerable;var ei=(r,e,t)=>e in r?na(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,c=(r,e)=>{for(var t in e||(e={}))ti.call(e,t)&&ei(r,t,e[t]);if(Za)for(var t of Za(e))Lp.call(e,t)&&ei(r,t,e[t]);return r},S=(r,e)=>sl(r,ul(e));var ae=(r,e)=>{var t={};for(var a in r)ti.call(r,a)&&e.indexOf(a)<0&&(t[a]=r[a]);if(r!=null&&Za)for(var a of Za(r))e.indexOf(a)<0&&Lp.call(r,a)&&(t[a]=r[a]);return t};var dl=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),fl=(r,e)=>{for(var t in e)na(r,t,{get:e[t],enumerable:!0})},qp=(r,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of cl(e))!ti.call(r,n)&&n!==t&&na(r,n,{get:()=>e[n],enumerable:!(a=pl(e,n))||a.enumerable});return r};var ml=(r,e,t)=>(t=r!=null?il(ll(r)):{},qp(e||!r||!r.__esModule?na(t,"default",{value:r,enumerable:!0}):t,r)),hl=r=>qp(na({},"__esModule",{value:!0}),r);var b=(r,e,t)=>ei(r,typeof e!="symbol"?e+"":e,t);var X=(r,e,t)=>new Promise((a,n)=>{var i=l=>{try{u(t.next(l))}catch(d){n(d)}},s=l=>{try{u(t.throw(l))}catch(d){n(d)}},u=l=>l.done?a(l.value):Promise.resolve(l.value).then(i,s);u((t=t.apply(r,e)).next())});var Yu=dl((Ca,Gs)=>{(function(r){"use strict";function e(t){var a=t&&t.Promise||r.Promise,n=t&&t.XMLHttpRequest||r.XMLHttpRequest;return function(){var i=Object.create(r,{fetch:{value:void 0,writable:!0}});return function(s,u){typeof Ca=="object"&&typeof Gs!="undefined"?u(Ca):typeof define=="function"&&define.amd?define(["exports"],u):u(s.WHATWGFetch={})}(this,function(s){"use strict";var u=typeof i!="undefined"&&i||typeof self!="undefined"&&self||typeof u!="undefined"&&u,l={searchParams:"URLSearchParams"in u,iterable:"Symbol"in u&&"iterator"in Symbol,blob:"FileReader"in u&&"Blob"in u&&function(){try{return new Blob,!0}catch(f){return!1}}(),formData:"FormData"in u,arrayBuffer:"ArrayBuffer"in u};function d(f){return f&&DataView.prototype.isPrototypeOf(f)}if(l.arrayBuffer)var T=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],_=ArrayBuffer.isView||function(f){return f&&T.indexOf(Object.prototype.toString.call(f))>-1};function j(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(f)||f==="")throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function B(f){return typeof f!="string"&&(f=String(f)),f}function ie(f){var g={next:function(){var V=f.shift();return{done:V===void 0,value:V}}};return l.iterable&&(g[Symbol.iterator]=function(){return g}),g}function $(f){this.map={},f instanceof $?f.forEach(function(g,V){this.append(V,g)},this):Array.isArray(f)?f.forEach(function(g){this.append(g[0],g[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(g){this.append(g,f[g])},this)}$.prototype.append=function(f,g){f=j(f),g=B(g);var V=this.map[f];this.map[f]=V?V+", "+g:g},$.prototype.delete=function(f){delete this.map[j(f)]},$.prototype.get=function(f){return f=j(f),this.has(f)?this.map[f]:null},$.prototype.has=function(f){return this.map.hasOwnProperty(j(f))},$.prototype.set=function(f,g){this.map[j(f)]=B(g)},$.prototype.forEach=function(f,g){for(var V in this.map)this.map.hasOwnProperty(V)&&f.call(g,this.map[V],V,this)},$.prototype.keys=function(){var f=[];return this.forEach(function(g,V){f.push(V)}),ie(f)},$.prototype.values=function(){var f=[];return this.forEach(function(g){f.push(g)}),ie(f)},$.prototype.entries=function(){var f=[];return this.forEach(function(g,V){f.push([V,g])}),ie(f)},l.iterable&&($.prototype[Symbol.iterator]=$.prototype.entries);function L(f){if(f.bodyUsed)return a.reject(new TypeError("Already read"));f.bodyUsed=!0}function Xt(f){return new a(function(g,V){f.onload=function(){g(f.result)},f.onerror=function(){V(f.error)}})}function aa(f){var g=new FileReader,V=Xt(g);return g.readAsArrayBuffer(f),V}function Yo(f){var g=new FileReader,V=Xt(g);return g.readAsText(f),V}function Xc(f){for(var g=new Uint8Array(f),V=new Array(g.length),re=0;re<g.length;re++)V[re]=String.fromCharCode(g[re]);return V.join("")}function Zp(f){if(f.slice)return f.slice(0);var g=new Uint8Array(f.byteLength);return g.set(new Uint8Array(f)),g.buffer}function Up(){return this.bodyUsed=!1,this._initBody=function(f){this.bodyUsed=this.bodyUsed,this._bodyInit=f,f?typeof f=="string"?this._bodyText=f:l.blob&&Blob.prototype.isPrototypeOf(f)?this._bodyBlob=f:l.formData&&FormData.prototype.isPrototypeOf(f)?this._bodyFormData=f:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(f)?this._bodyText=f.toString():l.arrayBuffer&&l.blob&&d(f)?(this._bodyArrayBuffer=Zp(f.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(f)||_(f))?this._bodyArrayBuffer=Zp(f):this._bodyText=f=Object.prototype.toString.call(f):this._bodyText="",this.headers.get("content-type")||(typeof f=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(f)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var f=L(this);if(f)return f;if(this._bodyBlob)return a.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return a.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return a.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var f=L(this);return f||(ArrayBuffer.isView(this._bodyArrayBuffer)?a.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):a.resolve(this._bodyArrayBuffer))}else return this.blob().then(aa)}),this.text=function(){var f=L(this);if(f)return f;if(this._bodyBlob)return Yo(this._bodyBlob);if(this._bodyArrayBuffer)return a.resolve(Xc(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return a.resolve(this._bodyText)},l.formData&&(this.formData=function(){return this.text().then(rl)}),this.json=function(){return this.text().then(JSON.parse)},this}var el=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function tl(f){var g=f.toUpperCase();return el.indexOf(g)>-1?g:f}function it(f,g){if(!(this instanceof it))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');g=g||{};var V=g.body;if(f instanceof it){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,g.headers||(this.headers=new $(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!V&&f._bodyInit!=null&&(V=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=g.credentials||this.credentials||"same-origin",(g.headers||!this.headers)&&(this.headers=new $(g.headers)),this.method=tl(g.method||this.method||"GET"),this.mode=g.mode||this.mode||null,this.signal=g.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&V)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(V),(this.method==="GET"||this.method==="HEAD")&&(g.cache==="no-store"||g.cache==="no-cache")){var re=/([?&])_=[^&]*/;if(re.test(this.url))this.url=this.url.replace(re,"$1_="+new Date().getTime());else{var se=/\?/;this.url+=(se.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}it.prototype.clone=function(){return new it(this,{body:this._bodyInit})};function rl(f){var g=new FormData;return f.trim().split("&").forEach(function(V){if(V){var re=V.split("="),se=re.shift().replace(/\+/g," "),K=re.join("=").replace(/\+/g," ");g.append(decodeURIComponent(se),decodeURIComponent(K))}}),g}function al(f){var g=new $,V=f.replace(/\r?\n[\t ]+/g," ");return V.split("\r").map(function(re){return re.indexOf(`
2
+ `)===0?re.substr(1,re.length):re}).forEach(function(re){var se=re.split(":"),K=se.shift().trim();if(K){var Pa=se.join(":").trim();g.append(K,Pa)}}),g}Up.call(it.prototype);function Be(f,g){if(!(this instanceof Be))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');g||(g={}),this.type="default",this.status=g.status===void 0?200:g.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in g?g.statusText:"",this.headers=new $(g.headers),this.url=g.url||"",this._initBody(f)}Up.call(Be.prototype),Be.prototype.clone=function(){return new Be(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new $(this.headers),url:this.url})},Be.error=function(){var f=new Be(null,{status:0,statusText:""});return f.type="error",f};var nl=[301,302,303,307,308];Be.redirect=function(f,g){if(nl.indexOf(g)===-1)throw new RangeError("Invalid status code");return new Be(null,{status:g,headers:{location:f}})},s.DOMException=u.DOMException;try{new s.DOMException}catch(f){s.DOMException=function(g,V){this.message=g,this.name=V;var re=Error(g);this.stack=re.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function Xo(f,g){return new a(function(V,re){var se=new it(f,g);if(se.signal&&se.signal.aborted)return re(new s.DOMException("Aborted","AbortError"));var K=new n;function Pa(){K.abort()}K.onload=function(){var Ae={status:K.status,statusText:K.statusText,headers:al(K.getAllResponseHeaders()||"")};Ae.url="responseURL"in K?K.responseURL:Ae.headers.get("X-Request-URL");var Va="response"in K?K.response:K.responseText;setTimeout(function(){V(new Be(Va,Ae))},0)},K.onerror=function(){setTimeout(function(){re(new TypeError("Network request failed"))},0)},K.ontimeout=function(){setTimeout(function(){re(new TypeError("Network request failed"))},0)},K.onabort=function(){setTimeout(function(){re(new s.DOMException("Aborted","AbortError"))},0)};function ol(Ae){try{return Ae===""&&u.location.href?u.location.href:Ae}catch(Va){return Ae}}K.open(se.method,ol(se.url),!0),se.credentials==="include"?K.withCredentials=!0:se.credentials==="omit"&&(K.withCredentials=!1),"responseType"in K&&(l.blob?K.responseType="blob":l.arrayBuffer&&se.headers.get("Content-Type")&&se.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(K.responseType="arraybuffer")),g&&typeof g.headers=="object"&&!(g.headers instanceof $)?Object.getOwnPropertyNames(g.headers).forEach(function(Ae){K.setRequestHeader(Ae,B(g.headers[Ae]))}):se.headers.forEach(function(Ae,Va){K.setRequestHeader(Va,Ae)}),se.signal&&(se.signal.addEventListener("abort",Pa),K.onreadystatechange=function(){K.readyState===4&&se.signal.removeEventListener("abort",Pa)}),K.send(typeof se._bodyInit=="undefined"?null:se._bodyInit)})}Xo.polyfill=!0,u.fetch||(u.fetch=Xo,u.Headers=$,u.Request=it,u.Response=Be),s.Headers=$,s.Request=it,s.Response=Be,s.fetch=Xo,Object.defineProperty(s,"__esModule",{value:!0})}),{fetch:i.fetch,Headers:i.Headers,Request:i.Request,Response:i.Response,DOMException:i.DOMException}}()}typeof define=="function"&&define.amd?define(function(){return e}):typeof Ca=="object"?Gs.exports=e:r.fetchPonyfill=e})(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof global!="undefined"?global:Ca)});var dT={};fl(dT,{APIFunctions:()=>As,APIValidators:()=>Rs,AggregateQueryBuilder:()=>Ir,AuthError:()=>st,AuthenticationError:()=>tr,AuthorizationError:()=>ri,Client:()=>ra,ClientFunctions:()=>A,ClientFunctionsEnum:()=>qc,ClientValidators:()=>oT,ConfigError:()=>_e,ConstraintError:()=>La,ERRORS:()=>ye,ERROR_CODE_TO_TYPE:()=>zp,ERROR_DESCRIPTIONS:()=>Kp,ERROR_GROUPS:()=>te,ERROR_MESSAGES:()=>Hp,ERROR_TYPES:()=>ia,ErrorDescription:()=>Kp,ErrorMessage:()=>Hp,ErrorType:()=>ia,Errors:()=>ye,FindQueryBuilder:()=>oe,InputError:()=>J,InternalError:()=>qa,JSONRPCError:()=>er,QueryBuilder:()=>De,ReverseQueryBuilder:()=>Jr,StreamError:()=>Pe,StreamPromise:()=>pt,TokenStatusEnum:()=>Eu,TokenTypeEnum:()=>Gu,TransferGroupStatusEnum:()=>ln,TransferGroupTypeEnum:()=>Cu,TransferStatusEnum:()=>Au,TransferTypeEnum:()=>Vt,UnknownError:()=>ai,UpdateQueryBuilder:()=>bt,ValidationError:()=>ve,Validator:()=>Kc,WAPIError:()=>je,WalletStatusEnum:()=>wu,WalletTypeEnum:()=>Ru,WapiClientType:()=>Yc,WapiSettingTypeEnum:()=>Qc,aggregateTransfers:()=>Bs,create:()=>cT,createAccessToken:()=>js,createContract:()=>Ps,createDeposit:()=>Vs,createExchange:()=>Zs,createToken:()=>Us,createTransfer:()=>Ks,createTransferGroup:()=>Js,createTransfers:()=>Qs,createWallet:()=>Ys,createWithdrawal:()=>Xs,exportBalanceHistory:()=>ep,exportTokens:()=>tp,exportTransferGroups:()=>rp,exportTransfers:()=>ap,exportWallets:()=>op,findBalances:()=>pp,findTokens:()=>up,findTransferGroups:()=>cp,findTransfers:()=>lp,findWallets:()=>dp,getBalance:()=>fp,getBalanceHistory:()=>mp,getError:()=>$a,getExport:()=>hp,getFlags:()=>Tp,getIdentifier:()=>pi,getStatistics:()=>gp,getToken:()=>xp,getTransfer:()=>yp,getTransferGroup:()=>bp,getValidator:()=>p,getValidatorError:()=>au,getWallet:()=>Sp,hardValidate:()=>qe,hardValidateWOptions:()=>nu,healthcheck:()=>Op,listExports:()=>Fp,reverseTransfer:()=>Ip,reverseTransferGroup:()=>_p,reverseTransfers:()=>wp,setFlags:()=>Rp,softValidate:()=>Ja,softValidateWOptions:()=>ui,updateToken:()=>Ap,updateTransfer:()=>Mp,updateTransferGroup:()=>Ep,updateTransferGroups:()=>Wp,updateTransfers:()=>Bp,updateWallet:()=>jp,utils:()=>lT});var $p=WebSocket;var Ua="0.12.5-beta.6";function oa(r,e){let t=Tl(r);return t===void 0?e:typeof e=="number"?parseInt(t,10):t}function Tl(r){if(typeof window=="object")return window[r];if(typeof process!="undefined"&&process.versions&&process.versions.node)return process.env[r]}function R(...r){oa("WAPI_DEBUG")&&console.log(...r.map(e=>e&&typeof e=="object"?JSON.stringify(e):e))}var te={JSONRPC:{min:-32700,max:-32600,ERRORS:{PARSE_ERROR:{code:-32700,message:"Parse error",description:"Unable to parse JSON input"},INVALID_REQUEST:{code:-32600,message:"Invalid request",description:"JSON input does not match JSONRPC spec"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found",description:"Requested method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params",description:"Invalid params provided for method"},INTERNAL_SERVER_ERROR:{code:-32603,message:"Internal server error",description:"Unknown error occurred"}}},AUTH:{min:-20999,max:-2e4,ERRORS:{AUTHENTICATION_ERROR:{code:-2e4,message:"Authentication error",description:"Invalid authentication credentials"},AUTHORIZATION_ERROR:{code:-20001,message:"AUTHORIZATION_ERROR",description:"Provided credentials lack access rights"}}},STREAM:{min:-10999,max:-1e4,ERRORS:{CONNECTION_LOST:{code:-1e4,message:"CONNECTION_LOST",description:"Lost connection to server"},INPUT_STREAM_INVALID:{code:-10001,message:"INPUT_STREAM_INVALID",description:"Invalid input stream identifier provided"},INVALID_RESPONSE_STREAM_CHUNK:{code:-10002,message:"INVALID_RESPONSE_STREAM_CHUNK",description:"Received multiple chunks for non-array property"},INVALID_INPUT_STREAM_CHUNK:{code:-10003,message:"INVALID_INPUT_STREAM_CHUNK",description:"Invalid chunk sent to input stream"},INPUT_STREAM_TIMEOUT:{code:-10004,message:"INPUT_STREAM_TIMEOUT",description:"Input stream failed to finish in allotted time"},INPUT_STREAM_ERROR:{code:-10005,message:"INPUT_STREAM_ERROR",description:"Unknown error in input stream"},INPUT_STREAM_NOT_ALLOWED:{code:-10006,message:"INPUT_STREAM_NOT_ALLOWED",description:"Stream input not allowed for method"}}},INPUT:{min:-14999,max:-11e3,ERRORS:{HTTP_BODY_SIZE:{code:-11e3,message:"HTTP_BODY_SIZE",description:"Http body size can't be more than 100MB"},DATABASE_EXPORT_CONFLICT:{code:-12e3,message:"DATABASE_EXPORT_CONFLICT",description:"Database export already in progress"},DATABASE_IMPORT_CONFLICT:{code:-12001,message:"DATABASE_IMPORT_CONFLICT",description:"Database import already in progress"},DATABASE_EXPORT_PROGRESS_NOT_FOUND:{code:-12002,message:"DATABASE_EXPORT_PROGRESS_NOT_FOUND",description:"Database backup process not found"},DATABASE_IMPORT_PROGRESS_NOT_FOUND:{code:-12003,message:"DATABASE_IMPORT_PROGRESS_NOT_FOUND",description:"Database backup process not found"},DATABASE_IMPORT_NOT_FOUND:{code:-12004,message:"DATABASE_IMPORT_NOT_FOUND",description:"Database import file not found"},TR_CANT_UPDATE_TO_PENDING:{code:-12100,message:"TR_CANT_UPDATE_TO_PENDING",description:"Transfer status can only move from 'pending'->'finished'/'cancelled"},TR_CANT_UPDATE_TIMESTAMP:{code:-12101,message:"TR_CANT_UPDATE_TIMESTAMP",description:"Cant update transfer.updated_at - allow_timestamps flag is set to off"},TR_CANT_INSERT_TIMESTAMP:{code:-12102,message:"TR_CANT_INSERT_TIMESTAMP",description:"Cant insert transfer.created_at - allow_timestamps flag is set to off"},TR_EMPTY_UPDATE_REQUEST:{code:-12103,message:"TR_EMPTY_UPDATE_REQUEST",description:"Update request for transfer is empty"},TR_MISSING_FILTER:{code:-12104,message:"TR_MISSING_FILTER",description:"Transactions can't reversed or updated without valid filter"},TR_TO_WALLET_WITHDRAWAL:{code:-12105,message:"TR_TO_WALLET_WITHDRAWAL",description:"To wallet can't be specified when doing a withdrawal"},TR_FROM_WALLET_DEPOSIT:{code:-12106,message:"TR_FROM_WALLET_DEPOSIT",description:"From wallet can't be specified when doing a deposit"},TR_FROM_TO_CONFLICT:{code:-12107,message:"TR_FROM_TO_CONFLICT",description:"from_wallet and to_wallet can not be the same"},TR_UNABLE_TO_RESOLVE_INPUT:{code:-12108,message:"TR_UNABLE_TO_RESOLVE_INPUT",description:"Unable to resolve references to foreign keys"},TRG_MISSING_FILTER:{code:-12200,message:"TRG_MISSING_FILTER",description:"Transaction groups can't reversed or updated without valid filter"},INVALID_FIELD_AGR_COMB:{code:-12300,message:"INVALID_FIELD_AGR_COMB",description:"Provided aggregation field was not found on Model"},INVALID_FIELD_FOR_MODEL:{code:-12301,message:"INVALID_FIELD_FOR_MODEL",description:"Provided field was not found on Model"},NO_METADATA_ON_MODEL:{code:-12302,message:"NO_METADATA_ON_MODEL",description:"Can't use metadata field for grouping as current Model does not have metadata"},INVALID_MODEL:{code:-12303,message:"INVALID_MODEL",description:"Provided Model name is invalid"},INVALID_COMPLEX_FILTER:{code:-12304,message:"INVALID_COMPLEX_FILTER",description:"The provided complex filter does not pass validation"},UNCLEAR_AGGREGATOR:{code:-12305,message:"UNCLEAR_AGGREGATOR",description:"Invalid aggregator function provided"},CONTRACT_OWNER_NOT_FOUND:{code:-12306,message:"CONTRACT_OWNER_NOT_FOUND",description:"Unable to find Wallet specified as Contract token owner"},DISTRIBUTION_MISSING_TARGETS:{code:-12307,message:"DISTRIBUTION_MISSING_TARGETS",description:"Unable to resolve all targets (Wallets, Tokens) for distribution request"},TOKEN_INVALID_WALLET:{code:-12308,message:"TOKEN_INVALID_WALLET",description:"Invalid belongs_to wallet provided"},BAL_FUTURE_DATETIME:{code:-12309,message:"BAL_FUTURE_DATETIME",description:"Balance datetime can't be in the future"},INPUT_NEEDS_IDENTIFIER:{code:-12310,message:"INPUT_NEEDS_IDENTIFIER",description:"Missing identifier - automatically calculated identifiers conflict on identical input for 30s To make an identical transfer during that window you need to provide a unique identifier"},RESET_INVALID_CONFIRMATION:{code:-12311,message:"RESET_INVALID_CONFIRMATION",description:"Provided reset confirmation code is invalid"},INPUT_NEEDS_TOKEN:{code:-12312,message:"INPUT_NEEDS_TOKEN",description:"token must be specified on input or in client config"},CONFLICTING_OPTIONS_FOR_BALANCE:{code:-12313,message:"CONFLICTING_OPTIONS_FOR_BALANCE",description:"return_running_balance and return_running_balance_for can't be specified together"},CONFLICTING_OPTIONS_FOR_SIGNED_AMOUNT:{code:-12314,message:"CONFLICTING_OPTIONS_FOR_SIGNED_AMOUNT",description:"return_signed_amount and return_signed_amount_for_wallet can't be specified together"},RUNNING_BALANCE_WITHOUT_WALLET:{code:-12315,message:"RUNNING_BALANCE_WITHOUT_WALLET",description:"return_running_balance option requires Wallet filter to be specified"},SIGNED_AMOUNT_WITHOUT_WALLET:{code:-12316,message:"SIGNED_AMOUNT_WITHOUT_WALLET",description:"return_signed_amount option requires Wallet filter to be specified"},REQUIRED_INPUT_MISSING:{code:-12317,message:"REQUIRED_INPUT_MISSING",description:"input does not specify required keys"},TRX_NOT_ALLOWED:{code:-12400,message:"TRX_NOT_ALLOWED",description:"This method can not run in a transaction"},TRANSACTION_NOT_FOUND:{code:-12401,message:"TRANSACTION_NOT_FOUND",description:"Transaction not found"},ONLY_SELECT_ALLOWED:{code:-12402,message:"ONLY_SELECT_ALLOWED",description:"Only select queries are allowed"},CNT_DEPOSIT_TOKEN_MISMATCH:{code:-12500,message:"CNT_DEPOSIT_TOKEN_MISMATCH",description:"Unable to find tokens specified in deposits"}}},CONSTRAINT:{min:-19999,max:-19e3,ERRORS:{INVALID_LATEST_HASH:{code:-19e3,message:"INVALID_LATEST_HASH",description:"Http body size can't be more than 100MB"},TOKEN_LIMIT_REACHED:{code:-19001,message:"TOKEN_LIMIT_REACHED",description:"Unable to issue more tokens as Token.limit has been reached"},TR_INVALID_BALANCE:{code:-19101,message:"TR_INVALID_BALANCE",description:"Transfer would result in invalid balance for a Wallet"},TR_AMOUNT_NOT_DIVISIBLE:{code:-19102,message:"TR_AMOUNT_NOT_DIVISIBLE",description:"Transfer amount is not divisible by specified Token.divisor"},TR_TOKEN_DISABLED:{code:-19103,message:"TR_TOKEN_DISABLED",description:"Token status is set to 'disabled' - no new transfers allowed"},TR_TOKEN_DWONLY:{code:-19104,message:"TR_TOKEN_DWONLY",description:"Token status is set to 'dw-only' - only deposits or withdrawals allowed"},TR_TRG_STATUS_MISMATCH:{code:-19105,message:"TR_TRG_STATUS_MISMATCH",description:"Transfers in transfer_group must match transfer_group.transfer_status"},TR_TRG_CLOSED:{code:-19106,message:"TR_TRG_CLOSED",description:"Cant add Transfer to group. TransferGroup is closed"},TR_TIMESTAMP_IN_PAST:{code:-19107,message:"TR_TIMESTAMP_IN_PAST",description:"Transfer.created_at must not be in the past"},TR_TIMESTAMP_MUST_BE_LATEST:{code:-19108,message:"TR_TIMESTAMP_MUST_BE_LATEST",description:"Transfer.created_at must be the latest"},TR_INVALID_CANCELLED:{code:-19109,message:"TR_INVALID_CANCELLED",description:"Cant create cancelled transfer"},TR_FROM_WALLET_STATUS_CONSTRAINT:{code:-19110,message:"TR_FROM_WALLET_STATUS_CONSTRAINT",description:"From wallet.status doesn't allow this type of transfers"},TR_TO_WALLET_STATUS_CONSTRAINT:{code:-19111,message:"TR_TO_WALLET_STATUS_CONSTRAINT",description:"To wallet.status doesn't allow this type of transfers"},TR_CANCELLED_CANT_RV:{code:-19112,message:"TR_CANCELLED_CANT_RV",description:"Cancelled Transfer can not be reversed"},TR_DEPOSIT_CANT_RV_WITHOUT_FLAG:{code:-19113,message:"TR_DEPOSIT_CANT_RV_WITHOUT_FLAG",description:"Deposits are expected connection points with outside systems, thus extra validation is required. Reversing a Transfer.type = 'deposit' requires reverse_deposit option to be true."},TR_WITHDRAWAL_CANT_RV_WITHOUT_FLAG:{code:-19114,message:"TR_WITHDRAWAL_CANT_RV_WITHOUT_FLAG",description:"Withdrawals are expected connection points with outside systems, thus extra validation is required. Reversing a Transfer.type = 'withdrawal' requires reverse_withdrawal option to be true."},TR_UNIQUE_IDENTIFIER:{code:-19115,message:"TR_UNIQUE_IDENTIFIER",description:"The identifier for Transfer object must be unique"},TR_DIFFERENT_WALLETS:{code:-19116,message:"TR_DIFFERENT_WALLETS",description:"To and from wallets have to be different"},TRG_SINGLE_PENDING_TR_CANT_RV:{code:-19200,message:"TRG_SINGLE_PENDING_TR_CANT_RV",description:"Transfer is part of TransferGroup and can not be reversed separately"},TRG_CANCELLED_CANT_RV:{code:-19201,message:"TRG_CANCELLED_CANT_RV",description:"Cancelled TransferGroup can not be reversed"},TRG_DEPOSIT_CANT_RV_WITHOUT_FLAG:{code:-19202,message:"TRG_DEPOSIT_CANT_RV_WITHOUT_FLAG",description:"TransferGroup includes Transfer.type = 'deposit', thus for extra validation the reverse_deposit option must be set true"},TRG_WITHDRAWAL_CANT_RV_WITHOUT_FLAG:{code:-19203,message:"TRG_WITHDRAWAL_CANT_RV_WITHOUT_FLAG",description:"TransferGroup includes Transfer.type = 'withdrawal', thus for extra validation the reverse_withdrawal option must be set true"},TRG_UNIQUE_IDENTIFIER:{code:-19204,message:"TRG_UNIQUE_IDENTIFIER",description:"The identifier for TransferGroup object must be unique"},TOKEN_UNIQUE_FOREIGN:{code:-19300,message:"TOKEN_UNIQUE_FOREIGN",description:"The foreign for Token object must be unique"},WALLET_UNIQUE_FOREIGN:{code:-19400,message:"WALLET_UNIQUE_FOREIGN",description:"The foreign for Wallet object must be unique"},UNIQUE_CONSTRAINT:{code:-19500,message:"UNIQUE_CONSTRAINT",description:"Insert violates unique constraint"}}},CONFIG:{min:-16e3,max:-15e3,ERRORS:{METHOD_DISABLED:{code:-15e3,message:"METHOD_DISABLED",description:"Method is disabled"},FLAG_PRODUCTION_ON:{code:-15001,message:"FLAG_PRODUCTION_ON",description:'Production flag is "on" - this method is disabled'},FLAG_PRODUCTION_LOCKED:{code:-15002,message:"FLAG_PRODUCTION_LOCKED",description:"Cant update production flag to false in this server"},TRANSACTION_TIMEOUT:{code:-15003,message:"TRANSACTION_TIMEOUT",description:"Database transaction timed out"},CONNECTION_TIMEOUT:{code:-15004,message:"CONNECTION_TIMEOUT",description:"Unable to get initial response in specified time"},SENDING_TIMEOUT:{code:-15005,message:"SENDING_TIMEOUT",description:"Unable to get ack from server in specified time"},CONFIG_INVALID:{code:-15100,message:"CONFIG_INVALID",description:"Provided configuration is invalid"}}}},ye=c(c(c(c(c(c({},te.JSONRPC.ERRORS),te.AUTH.ERRORS),te.CONFIG.ERRORS),te.STREAM.ERRORS),te.INPUT.ERRORS),te.CONSTRAINT.ERRORS);function St(r){return Object.fromEntries(Object.keys(r).map(e=>[e,e]))}var ia=St(ye),je=class extends Error{constructor({type:t,code:a,message:n,data:i}){var u;super(n);b(this,"type");b(this,"code");b(this,"data");let s=(u=ye[t])!=null?u:ye.INTERNAL_SERVER_ERROR;this.type=t!=null?t:ia.INTERNAL_SERVER_ERROR,this.code=a!=null?a:s.code,this.message=n!=null?n:s.message,this.data=c({description:s.description},i&&typeof i=="object"?i:{error:i})}toJSON(){return{code:this.code,message:this.message,data:this.data}}},er=class extends je{constructor(e,t,a,n){super({type:e,message:a,data:t,code:n})}static get group(){return te.JSONRPC.ERRORS}static get types(){return St(te.JSONRPC.ERRORS)}},Pe=class extends je{constructor(e,t,a,n){super({type:e,message:a,data:t,code:n})}static get group(){return te.STREAM.ERRORS}static get types(){return St(te.STREAM.ERRORS)}},J=class extends je{constructor(e,t,a,n){super({type:e,message:a,data:t,code:n})}static get group(){return te.INPUT.ERRORS}static get types(){return St(te.INPUT.ERRORS)}},_e=class extends je{constructor(e,t,a,n){super({type:e,message:a,data:t,code:n})}static get group(){return te.CONFIG.ERRORS}static get types(){return St(te.CONFIG.ERRORS)}},st=class extends je{constructor(e,t,a,n){super({type:e,message:a,data:t,code:n})}static get group(){return te.AUTH.ERRORS}static get types(){return St(te.AUTH.ERRORS)}},La=class extends je{constructor(e,t,a,n){super({type:e,message:a,data:t,code:n})}static get group(){return te.CONSTRAINT.ERRORS}static get types(){return St(te.CONSTRAINT.ERRORS)}},ve=class extends er{constructor(e,t){super(er.types.INVALID_PARAMS,e,t)}},tr=class extends st{constructor(e){super(st.types.AUTHENTICATION_ERROR,e)}},ri=class extends st{constructor(e){super(st.types.AUTHORIZATION_ERROR,e)}},qa=class extends je{constructor(e){super({type:ia.INTERNAL_SERVER_ERROR,data:e})}toJSON(){return{code:this.code,message:this.message,data:{description:ye.INTERNAL_SERVER_ERROR.description}}}},ai=class extends qa{constructor(e){super({data:{message:e}})}toJSON(){let e=super.toJSON();return e.data={description:e.data.description,message:this.data.message},{code:this.code,message:this.message,data:{message:this.data.message,description:ye.INTERNAL_SERVER_ERROR.description}}}},zp=Object.fromEntries(Object.keys(ye).map(r=>[ye[r].code,r]));function gl(r){let e=zp[r];if(!e){let a=Object.entries(te).find(([,n])=>r>=n.min&&r<=n.max);return{group:a==null?void 0:a[0],type:void 0}}let t=Object.keys(te).find(a=>e in te[a].ERRORS);return t?{group:t,type:e}:(console.error("ERRORS and ERROR_GROUPS are out of sync",e),{group:void 0,type:e})}function $a({code:r,message:e,data:t}){let a=gl(r),n=a.type,i=a.group;e=e&&e!==n||!n?e:ye[n].description;let s;switch(i&&i!=="JSONRPC"&&n===void 0&&(R("Novel error from server",r,e,t),n=e,s=r,e=t&&typeof t=="object"&&"description"in t&&typeof t.description=="string"?t.description:e),i){case"JSONRPC":return new er(n,t,e);case"AUTH":return new st(n,t,e,s);case"CONFIG":return new _e(n,t,e,s);case"CONSTRAINT":return new La(n,t,e,s);case"INPUT":return new J(n,t,e,s);case"STREAM":return new Pe(n,t,e,s);default:return new je({code:r,message:e,data:t,type:n!=null?n:ia.INTERNAL_SERVER_ERROR})}}var Hp=Object.fromEntries(Object.keys(ye).map(r=>[r,ye[r].message])),Kp=Object.fromEntries(Object.keys(ye).map(r=>[r,ye[r].description]));var de=[];for(let r=0;r<256;++r)de.push((r+256).toString(16).slice(1));function Jp(r,e=0){return(de[r[e+0]]+de[r[e+1]]+de[r[e+2]]+de[r[e+3]]+"-"+de[r[e+4]]+de[r[e+5]]+"-"+de[r[e+6]]+de[r[e+7]]+"-"+de[r[e+8]]+de[r[e+9]]+"-"+de[r[e+10]]+de[r[e+11]]+de[r[e+12]]+de[r[e+13]]+de[r[e+14]]+de[r[e+15]]).toLowerCase()}var ni,xl=new Uint8Array(16);function oi(){if(!ni){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ni=crypto.getRandomValues.bind(crypto)}return ni(xl)}var yl=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ii={randomUUID:yl};function bl(r,e,t){var n,i,s;if(ii.randomUUID&&!e&&!r)return ii.randomUUID();r=r||{};let a=(s=(i=r.random)!=null?i:(n=r.rng)==null?void 0:n.call(r))!=null?s:oi();if(a.length<16)throw new Error("Random bytes length must be >= 16");if(a[6]=a[6]&15|64,a[8]=a[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let u=0;u<16;++u)e[t+u]=a[u];return e}return Jp(a)}var sa=bl;var si={timeouts:{},values:{},set(r,e){this.timeouts[r]=setTimeout(()=>this.clear(r),3e4),this.values[r]=e},get(r){return this.values[r]},getKey(r){let e=JSON.parse(JSON.stringify(r)),t="";return Object.keys(e).sort().forEach(a=>{let n="";e[a]&&typeof e[a]=="object"&&!Array.isArray(e[a])?n=this.getKey(e[a]):n=JSON.stringify(e[a]),t+=a+":"+n}),t},clear(r){this.timeouts[r]&&clearTimeout(this.timeouts[r]),delete this.timeouts[r],delete this.values[r]},clearAll(){Object.keys(this.timeouts).forEach(r=>{clearTimeout(this.timeouts[r])}),this.timeouts={},this.values={}}};function rr(r=8){return sa().replace(/-/g,"").slice(-r)}function me(r){if(!r)return sa();let e=si.getKey(r);if(si.get(e))throw new J("INPUT_NEEDS_IDENTIFIER",{object:r});let t=sa();return si.set(e,t),t}function Yp(r){return new Promise(e=>setTimeout(e,r))}function pi(){return me()}function Sl(r){return JSON.parse(JSON.stringify(r))}function Ue(r,e,t){if(e in r){if(r[e]===void 0)throw new ve({input:r},`undefined provided for ${e}`);return r}if(!t)throw new ve({input:r},`${e} is required if no default set`);let a=Sl(r);return a[e]=t,a}function C(r){let e=Xp(r);if(e!=null)return{foreign:e}}function ce(r){let e=Xp(r);if(e!=null)return{identifier:e}}function Xp(r){return r==null?r:r+""}function Ol(r){return Object.keys(r).filter(e=>r[e]!==void 0).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(r[e])}`).join("&")}function Qp(r){return r.host.replace(/^https:/,"wss:")+"?"+Ol({apikey:r.apikey,apisecret:r.apisecret,db:r.database,clientVersion:r.clientVersion,connectionName:r.connectionName})}function eu(r){return typeof window=="undefined"?[Qp(r),{rejectUnauthorized:r.rejectUnauthorized}]:[Qp(r)]}function za(r,e){let t={},a=!r||typeof r!="object"?{}:r;return Object.keys(a).forEach(n=>{e[n]?typeof e[n]=="string"?t[e[n]]=a[n]:t[n]=e[n](a[n]):t[n]=a[n]}),t}function Fl(r){return r.split(",").map(e=>e.split(" ")).map(e=>{let[t,a,n,i]=e;return c({field:t,direction:a==="desc"?"desc":"asc"},n==="nulls"&&["first","last"].includes(i)?{nulls:i}:{})})}function ee(r,e){var i;let n=r!=null?r:{},{options:t}=n;return{filter:ae(n,["options"]),options:(i=e!=null?e:t)!=null?i:{}}}function Le(r){let a=r,{order_by:e}=a,t=ae(a,["order_by"]);return!t.order&&e&&(t.order=Fl(e)),t}function tu(r){if(r!=null)return r+""}function ar(r){return typeof r=="number"?r:parseFloat(r)}function ru(r){return new Date(r).setHours(0,0,0,0)>new Date().setHours(0,0,0,0)}var pa=class{constructor(e){b(this,"_data",[]);b(this,"_error",[]);b(this,"_end",[]);b(this,"_finished",!1);b(this,"_options");this._options=e}on(e,t){switch(e){case"data":return this._data.push(t),this;case"end":return this._end.push(t),this;case"error":return this._error.push(t),this}}push(e){if(this._finished)throw new Error("Stream is closed");return e===null?this.end():(this._data.forEach(t=>t(e)),this)}error(e){if(this._finished)throw new Error("Stream is closed");return this._error.forEach(t=>t(e)),this}end(){if(this._finished)throw new Error("Stream is closed");return this._end.forEach(e=>e()),this._finished=!0,this}destroy(e){return this.error(e),this.end(),this}get destroyed(){return this._finished}},Ha=class{constructor(){throw new TypeError("used in node version")}pipe(...e){throw new TypeError("used in node version")}pause(){throw new TypeError("used in node version")}resume(){throw new TypeError("used in node version")}on(...e){throw new TypeError("used in node version")}};var pt=class{constructor(e){b(this,"resolve");b(this,"reject");b(this,"makeRequest");b(this,"streamObject",new pa({objectMode:!0}));b(this,"outStreamObject",new pa({objectMode:!0}));b(this,"mode");b(this,"started",!1);b(this,"promise");this.makeRequest=e}start(e){var s;if(R("start request as",e),this.mode&&this.mode!==e)throw new Error("Already in use as "+this.mode);if(this.started)return;let{promise:t,resolve:a,reject:n}=Promise.withResolvers();if(this.promise=t,this.resolve=a,this.reject=n,this.started=!0,this.mode=e,this.makeRequest===void 0){this.streamObject.push(null),(s=this.resolve)==null||s.call(this,void 0);return}this.makeRequest(this.streamObject).catch(this.reject);let i=[];if(this.mode==="stream"){this.streamObject.on("data",u=>{if(R("stream data",u),u||this.outStreamObject.push(u),u.error){let l=$a(u.error);return this.outStreamObject.destroy(l),this.streamObject.destroy(l)}if(!u.prop){i.push(u);return}if(u.dataArr){let l=c({},u);delete l.dataArr,u.dataArr.forEach(d=>{this.outStreamObject.push(S(c({},l),{data:d}))});return}this.outStreamObject.push(u)}).on("end",()=>{R("stream ended");let u=i.pop();if(!u)return;let l=u.result;Object.keys(l).forEach(d=>{Array.isArray(l[d])&&(l[d].forEach(T=>{this.outStreamObject.push({type:"streamChunk",prop:d,data:T})}),l[d]=[])}),this.outStreamObject.push(u),this.outStreamObject.push(null)}).on("error",u=>{R("stream error",u),this.outStreamObject.destroy(u)});return}if(this.mode==="promise"){let u=new Map;this.streamObject.on("data",l=>{var T;if(R("streamPromise data",l),l===void 0)return;if(l.error){let _=$a(l.error);return this.streamObject.destroy(_)}if(!l.prop){i.push(l);return}let d=(T=u.get(l.prop))!=null?T:[];l.dataArr?d.push(...l.dataArr):d.push(l.data),u.set(l.prop,d)}).on("end",()=>{R("streamPromise end");let l=i.pop();if(!l)return;let d=l.result;if(!u.size)return this.resolve(d);let T=!1;u.forEach((_,j)=>{Array.isArray(d[j])?(_.push(...d[j]),d[j]=_):_.length===1?d[j]=_:(this.streamObject.destroy(new Pe("INVALID_RESPONSE_STREAM_CHUNK",{property:j,value:_})),T=!0)}),T||this.resolve(d)}).on("error",l=>{var d;return R("streamPromise error",l),(d=this.reject)==null?void 0:d.call(this,l)})}}then(e,t){return this.start("promise"),this.promise.then(e,t)}catch(e){return this.start("promise"),this.promise.catch(e)}get[Symbol.toStringTag](){return"StreamPromise"}finally(e){return this.start("promise"),this.promise.finally(e)}stream(){return this.start("stream"),this.outStreamObject}};var ua=class extends pt{constructor(t,a){super(t);b(this,"inputStream");this.inputStream=a}input(t){return t?typeof t=="function"?(t(this.inputStream),this):(console.warn("currently disabled"),this):this.inputStream}};var Ka={};var au=(r,e)=>{if(r)return new ve({message:r.message,data:r.format()})},Ja=(r,e,t=au)=>{let{success:a,error:n,data:i}=r.safeParse(e);return{data:i,success:a,isValid:a,error:t(n,e)}},ui=(r,e,t,a)=>!e||typeof e!="object"?{success:!1,isValid:!1,error:new ve({message:`Invalid input - expected object, got ${typeof e}`,data:{input:e}})}:Ja(r,c({options:t!=null?t:{}},e),a),qe=(r,e,t,a)=>{var s;let{data:n,error:i}=Ja(r,e,a);if(i)throw((s=t==null?void 0:t.warn)!=null?s:R)(c({err:i},Ka),"Invalid input"),i;return n},nu=(r,e,t,a,n)=>{!a&&t&&typeof(t==null?void 0:t.warn)=="function"&&(a=t,t={});let{data:i,error:s}=ui(r,e,t,n);if(s)throw a?a.warn(c({err:s},Ka),"Invalid input"):R(c({err:s},Ka),"Invalid input"),s;return i},p=(r,e)=>({validateInput:(t,a)=>qe(r,t,a,e),validateInputWOptions:(t,a,n)=>nu(r,t,a,n,e),softValidateInput:t=>Ja(r,t,e),softValidateWOptions:(t,a)=>ui(r,t,a,e)});var U;(function(r){r.assertEqual=n=>n;function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let i={};for(let s of n)i[s]=s;return i},r.getValidEnumValues=n=>{let i=r.objectKeys(n).filter(u=>typeof n[n[u]]!="number"),s={};for(let u of i)s[u]=n[u];return r.objectValues(s)},r.objectValues=n=>r.objectKeys(n).map(function(i){return n[i]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&i.push(s);return i},r.find=(n,i)=>{for(let s of n)if(i(s))return s},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function a(n,i=" | "){return n.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}r.joinValues=a,r.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(U||(U={}));var li;(function(r){r.mergeShapes=(e,t)=>c(c({},e),t)})(li||(li={}));var O=U.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),et=r=>{switch(typeof r){case"undefined":return O.undefined;case"string":return O.string;case"number":return isNaN(r)?O.nan:O.number;case"boolean":return O.boolean;case"function":return O.function;case"bigint":return O.bigint;case"symbol":return O.symbol;case"object":return Array.isArray(r)?O.array:r===null?O.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?O.promise:typeof Map!="undefined"&&r instanceof Map?O.map:typeof Set!="undefined"&&r instanceof Set?O.set:typeof Date!="undefined"&&r instanceof Date?O.date:O.object;default:return O.unknown}},m=U.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Il=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),ke=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(i){return i.message},a={_errors:[]},n=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)a._errors.push(t(s));else{let u=a,l=0;for(;l<s.path.length;){let d=s.path[l];l===s.path.length-1?(u[d]=u[d]||{_errors:[]},u[d]._errors.push(t(s))):u[d]=u[d]||{_errors:[]},u=u[d],l++}}};return n(this),a}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,U.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},a=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):a.push(e(n));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}};ke.create=r=>new ke(r);var ir=(r,e)=>{let t;switch(r.code){case m.invalid_type:r.received===O.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case m.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,U.jsonStringifyReplacer)}`;break;case m.unrecognized_keys:t=`Unrecognized key(s) in object: ${U.joinValues(r.keys,", ")}`;break;case m.invalid_union:t="Invalid input";break;case m.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${U.joinValues(r.options)}`;break;case m.invalid_enum_value:t=`Invalid enum value. Expected ${U.joinValues(r.options)}, received '${r.received}'`;break;case m.invalid_arguments:t="Invalid function arguments";break;case m.invalid_return_type:t="Invalid function return type";break;case m.invalid_date:t="Invalid date";break;case m.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:U.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case m.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case m.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case m.custom:t="Invalid input";break;case m.invalid_intersection_types:t="Intersection results could not be merged";break;case m.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case m.not_finite:t="Number must be finite";break;default:t=e.defaultError,U.assertNever(r)}return{message:t}},pu=ir;function _l(r){pu=r}function Qa(){return pu}var Ya=r=>{let{data:e,path:t,errorMaps:a,issueData:n}=r,i=[...t,...n.path||[]],s=S(c({},n),{path:i});if(n.message!==void 0)return S(c({},n),{path:i,message:n.message});let u="",l=a.filter(d=>!!d).slice().reverse();for(let d of l)u=d(s,{data:e,defaultError:u}).message;return S(c({},n),{path:i,message:u})},vl=[];function y(r,e){let t=Qa(),a=Ya({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===ir?void 0:ir].filter(n=>!!n)});r.common.issues.push(a)}var fe=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let a=[];for(let n of t){if(n.status==="aborted")return w;n.status==="dirty"&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static mergeObjectAsync(e,t){return X(this,null,function*(){let a=[];for(let n of t){let i=yield n.key,s=yield n.value;a.push({key:i,value:s})}return r.mergeObjectSync(e,a)})}static mergeObjectSync(e,t){let a={};for(let n of t){let{key:i,value:s}=n;if(i.status==="aborted"||s.status==="aborted")return w;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value!="undefined"||n.alwaysSet)&&(a[i.value]=s.value)}return{status:e.value,value:a}}},w=Object.freeze({status:"aborted"}),or=r=>({status:"dirty",value:r}),he=r=>({status:"valid",value:r}),di=r=>r.status==="aborted",fi=r=>r.status==="dirty",Ot=r=>r.status==="valid",da=r=>typeof Promise!="undefined"&&r instanceof Promise;function Xa(r,e,t,a){if(t==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!a:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?a:t==="a"?a.call(r):a?a.value:e.get(r)}function uu(r,e,t,a,n){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t}var I;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(I||(I={}));var ca,la,Ee=class{constructor(e,t,a,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ou=(r,e)=>{if(Ot(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new ke(r.common.issues);return this._error=t,this._error}}};function W(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:a,description:n}=r;if(e&&(t||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(s,u)=>{var l,d;let{message:T}=r;return s.code==="invalid_enum_value"?{message:T!=null?T:u.defaultError}:typeof u.data=="undefined"?{message:(l=T!=null?T:a)!==null&&l!==void 0?l:u.defaultError}:s.code!=="invalid_type"?{message:u.defaultError}:{message:(d=T!=null?T:t)!==null&&d!==void 0?d:u.defaultError}},description:n}}var N=class{get description(){return this._def.description}_getType(e){return et(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:et(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new fe,ctx:{common:e.parent.common,data:e.data,parsedType:et(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(da(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){var a;let n={common:{issues:[],async:(a=t==null?void 0:t.async)!==null&&a!==void 0?a:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:et(e)},i=this._parseSync({data:e,path:n.path,parent:n});return ou(n,i)}"~validate"(e){var t,a;let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:et(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:n});return Ot(i)?{value:i.value}:{issues:n.common.issues}}catch(i){!((a=(t=i==null?void 0:i.message)===null||t===void 0?void 0:t.toLowerCase())===null||a===void 0)&&a.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>Ot(i)?{value:i.value}:{issues:n.common.issues})}parseAsync(e,t){return X(this,null,function*(){let a=yield this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error})}safeParseAsync(e,t){return X(this,null,function*(){let a={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:et(e)},n=this._parse({data:e,path:a.path,parent:a}),i=yield da(n)?n:Promise.resolve(n);return ou(a,i)})}refine(e,t){let a=n=>typeof t=="string"||typeof t=="undefined"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,i)=>{let s=e(n),u=()=>i.addIssue(c({code:m.custom},a(n)));return typeof Promise!="undefined"&&s instanceof Promise?s.then(l=>l?!0:(u(),!1)):s?!0:(u(),!1)})}refinement(e,t){return this._refinement((a,n)=>e(a)?!0:(n.addIssue(typeof t=="function"?t(a,n):t),!1))}_refinement(e){return new we({schema:this,typeName:k.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){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"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return Me.create(this,this._def)}nullable(){return ze.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rt.create(this)}promise(){return lt.create(this,this._def)}or(e){return Rt.create([this,e],this._def)}and(e){return At.create(this,e,this._def)}transform(e){return new we(S(c({},W(this._def)),{schema:this,typeName:k.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){let t=typeof e=="function"?e:()=>e;return new Wt(S(c({},W(this._def)),{innerType:this,defaultValue:t,typeName:k.ZodDefault}))}brand(){return new fa(c({typeName:k.ZodBranded,type:this},W(this._def)))}catch(e){let t=typeof e=="function"?e:()=>e;return new Nt(S(c({},W(this._def)),{innerType:this,catchValue:t,typeName:k.ZodCatch}))}describe(e){let t=this.constructor;return new t(S(c({},this._def),{description:e}))}pipe(e){return ma.create(this,e)}readonly(){return Dt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},kl=/^c[^\s-]{8,}$/i,wl=/^[0-9a-z]+$/,Rl=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Al=/^[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,Ml=/^[a-z0-9_-]{21}$/i,El=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Gl=/^[-+]?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)?)??$/,Cl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Wl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ci,Nl=/^(?:(?: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])$/,Dl=/^(?:(?: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])$/,Bl=/^(([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]))$/,jl=/^(([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])$/,Pl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vl=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cu="((\\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])))",Zl=new RegExp(`^${cu}$`);function lu(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Ul(r){return new RegExp(`^${lu(r)}$`)}function du(r){let e=`${cu}T${lu(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ll(r,e){return!!((e==="v4"||!e)&&Nl.test(r)||(e==="v6"||!e)&&Bl.test(r))}function ql(r,e){if(!El.test(r))return!1;try{let[t]=r.split("."),a=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(a));return!(typeof n!="object"||n===null||!n.typ||!n.alg||e&&n.alg!==e)}catch(t){return!1}}function $l(r,e){return!!((e==="v4"||!e)&&Dl.test(r)||(e==="v6"||!e)&&jl.test(r))}var ut=class r extends N{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==O.string){let i=this._getOrReturnCtx(e);return y(i,{code:m.invalid_type,expected:O.string,received:i.parsedType}),w}let a=new fe,n;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:m.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),a.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:m.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),a.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,u=e.data.length<i.value;(s||u)&&(n=this._getOrReturnCtx(e,n),s?y(n,{code:m.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):u&&y(n,{code:m.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),a.dirty())}else if(i.kind==="email")Cl.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"email",code:m.invalid_string,message:i.message}),a.dirty());else if(i.kind==="emoji")ci||(ci=new RegExp(Wl,"u")),ci.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"emoji",code:m.invalid_string,message:i.message}),a.dirty());else if(i.kind==="uuid")Al.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"uuid",code:m.invalid_string,message:i.message}),a.dirty());else if(i.kind==="nanoid")Ml.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"nanoid",code:m.invalid_string,message:i.message}),a.dirty());else if(i.kind==="cuid")kl.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"cuid",code:m.invalid_string,message:i.message}),a.dirty());else if(i.kind==="cuid2")wl.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"cuid2",code:m.invalid_string,message:i.message}),a.dirty());else if(i.kind==="ulid")Rl.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"ulid",code:m.invalid_string,message:i.message}),a.dirty());else if(i.kind==="url")try{new URL(e.data)}catch(s){n=this._getOrReturnCtx(e,n),y(n,{validation:"url",code:m.invalid_string,message:i.message}),a.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"regex",code:m.invalid_string,message:i.message}),a.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),y(n,{code:m.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),a.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),y(n,{code:m.invalid_string,validation:{startsWith:i.value},message:i.message}),a.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),y(n,{code:m.invalid_string,validation:{endsWith:i.value},message:i.message}),a.dirty()):i.kind==="datetime"?du(i).test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:m.invalid_string,validation:"datetime",message:i.message}),a.dirty()):i.kind==="date"?Zl.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:m.invalid_string,validation:"date",message:i.message}),a.dirty()):i.kind==="time"?Ul(i).test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:m.invalid_string,validation:"time",message:i.message}),a.dirty()):i.kind==="duration"?Gl.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"duration",code:m.invalid_string,message:i.message}),a.dirty()):i.kind==="ip"?Ll(e.data,i.version)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"ip",code:m.invalid_string,message:i.message}),a.dirty()):i.kind==="jwt"?ql(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"jwt",code:m.invalid_string,message:i.message}),a.dirty()):i.kind==="cidr"?$l(e.data,i.version)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"cidr",code:m.invalid_string,message:i.message}),a.dirty()):i.kind==="base64"?Pl.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"base64",code:m.invalid_string,message:i.message}),a.dirty()):i.kind==="base64url"?Vl.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"base64url",code:m.invalid_string,message:i.message}),a.dirty()):U.assertNever(i);return{status:a.value,value:e.data}}_regex(e,t,a){return this.refinement(n=>e.test(n),c({validation:t,code:m.invalid_string},I.errToObj(a)))}_addCheck(e){return new r(S(c({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(c({kind:"email"},I.errToObj(e)))}url(e){return this._addCheck(c({kind:"url"},I.errToObj(e)))}emoji(e){return this._addCheck(c({kind:"emoji"},I.errToObj(e)))}uuid(e){return this._addCheck(c({kind:"uuid"},I.errToObj(e)))}nanoid(e){return this._addCheck(c({kind:"nanoid"},I.errToObj(e)))}cuid(e){return this._addCheck(c({kind:"cuid"},I.errToObj(e)))}cuid2(e){return this._addCheck(c({kind:"cuid2"},I.errToObj(e)))}ulid(e){return this._addCheck(c({kind:"ulid"},I.errToObj(e)))}base64(e){return this._addCheck(c({kind:"base64"},I.errToObj(e)))}base64url(e){return this._addCheck(c({kind:"base64url"},I.errToObj(e)))}jwt(e){return this._addCheck(c({kind:"jwt"},I.errToObj(e)))}ip(e){return this._addCheck(c({kind:"ip"},I.errToObj(e)))}cidr(e){return this._addCheck(c({kind:"cidr"},I.errToObj(e)))}datetime(e){var t,a;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck(c({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(a=e==null?void 0:e.local)!==null&&a!==void 0?a:!1},I.errToObj(e==null?void 0:e.message)))}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck(c({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision},I.errToObj(e==null?void 0:e.message)))}duration(e){return this._addCheck(c({kind:"duration"},I.errToObj(e)))}regex(e,t){return this._addCheck(c({kind:"regex",regex:e},I.errToObj(t)))}includes(e,t){return this._addCheck(c({kind:"includes",value:e,position:t==null?void 0:t.position},I.errToObj(t==null?void 0:t.message)))}startsWith(e,t){return this._addCheck(c({kind:"startsWith",value:e},I.errToObj(t)))}endsWith(e,t){return this._addCheck(c({kind:"endsWith",value:e},I.errToObj(t)))}min(e,t){return this._addCheck(c({kind:"min",value:e},I.errToObj(t)))}max(e,t){return this._addCheck(c({kind:"max",value:e},I.errToObj(t)))}length(e,t){return this._addCheck(c({kind:"length",value:e},I.errToObj(t)))}nonempty(e){return this.min(1,I.errToObj(e))}trim(){return new r(S(c({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new r(S(c({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new r(S(c({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};ut.create=r=>{var e;return new ut(c({checks:[],typeName:k.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1},W(r)))};function zl(r,e){let t=(r.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,n=t>a?t:a,i=parseInt(r.toFixed(n).replace(".","")),s=parseInt(e.toFixed(n).replace(".",""));return i%s/Math.pow(10,n)}var Ft=class r extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==O.number){let i=this._getOrReturnCtx(e);return y(i,{code:m.invalid_type,expected:O.number,received:i.parsedType}),w}let a,n=new fe;for(let i of this._def.checks)i.kind==="int"?U.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{code:m.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(a=this._getOrReturnCtx(e,a),y(a,{code:m.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(a=this._getOrReturnCtx(e,a),y(a,{code:m.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?zl(e.data,i.value)!==0&&(a=this._getOrReturnCtx(e,a),y(a,{code:m.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),y(a,{code:m.not_finite,message:i.message}),n.dirty()):U.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,I.toString(t))}gt(e,t){return this.setLimit("min",e,!1,I.toString(t))}lte(e,t){return this.setLimit("max",e,!0,I.toString(t))}lt(e,t){return this.setLimit("max",e,!1,I.toString(t))}setLimit(e,t,a,n){return new r(S(c({},this._def),{checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:I.toString(n)}]}))}_addCheck(e){return new r(S(c({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:I.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:I.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:I.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:I.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:I.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:I.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:I.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:I.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:I.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&U.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(t===null||a.value>t)&&(t=a.value):a.kind==="max"&&(e===null||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Ft.create=r=>new Ft(c({checks:[],typeName:k.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1},W(r)));var It=class r extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(i){return this._getInvalidInput(e)}if(this._getType(e)!==O.bigint)return this._getInvalidInput(e);let a,n=new fe;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(a=this._getOrReturnCtx(e,a),y(a,{code:m.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(a=this._getOrReturnCtx(e,a),y(a,{code:m.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),y(a,{code:m.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):U.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return y(t,{code:m.invalid_type,expected:O.bigint,received:t.parsedType}),w}gte(e,t){return this.setLimit("min",e,!0,I.toString(t))}gt(e,t){return this.setLimit("min",e,!1,I.toString(t))}lte(e,t){return this.setLimit("max",e,!0,I.toString(t))}lt(e,t){return this.setLimit("max",e,!1,I.toString(t))}setLimit(e,t,a,n){return new r(S(c({},this._def),{checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:I.toString(n)}]}))}_addCheck(e){return new r(S(c({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:I.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:I.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:I.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:I.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:I.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};It.create=r=>{var e;return new It(c({checks:[],typeName:k.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1},W(r)))};var _t=class extends N{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==O.boolean){let a=this._getOrReturnCtx(e);return y(a,{code:m.invalid_type,expected:O.boolean,received:a.parsedType}),w}return he(e.data)}};_t.create=r=>new _t(c({typeName:k.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1},W(r)));var vt=class r extends N{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==O.date){let i=this._getOrReturnCtx(e);return y(i,{code:m.invalid_type,expected:O.date,received:i.parsedType}),w}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return y(i,{code:m.invalid_date}),w}let a=new fe,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:m.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),a.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:m.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),a.dirty()):U.assertNever(i);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r(S(c({},this._def),{checks:[...this._def.checks,e]}))}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:I.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:I.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};vt.create=r=>new vt(c({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:k.ZodDate},W(r)));var sr=class extends N{_parse(e){if(this._getType(e)!==O.symbol){let a=this._getOrReturnCtx(e);return y(a,{code:m.invalid_type,expected:O.symbol,received:a.parsedType}),w}return he(e.data)}};sr.create=r=>new sr(c({typeName:k.ZodSymbol},W(r)));var kt=class extends N{_parse(e){if(this._getType(e)!==O.undefined){let a=this._getOrReturnCtx(e);return y(a,{code:m.invalid_type,expected:O.undefined,received:a.parsedType}),w}return he(e.data)}};kt.create=r=>new kt(c({typeName:k.ZodUndefined},W(r)));var wt=class extends N{_parse(e){if(this._getType(e)!==O.null){let a=this._getOrReturnCtx(e);return y(a,{code:m.invalid_type,expected:O.null,received:a.parsedType}),w}return he(e.data)}};wt.create=r=>new wt(c({typeName:k.ZodNull},W(r)));var ct=class extends N{constructor(){super(...arguments),this._any=!0}_parse(e){return he(e.data)}};ct.create=r=>new ct(c({typeName:k.ZodAny},W(r)));var tt=class extends N{constructor(){super(...arguments),this._unknown=!0}_parse(e){return he(e.data)}};tt.create=r=>new tt(c({typeName:k.ZodUnknown},W(r)));var Ve=class extends N{_parse(e){let t=this._getOrReturnCtx(e);return y(t,{code:m.invalid_type,expected:O.never,received:t.parsedType}),w}};Ve.create=r=>new Ve(c({typeName:k.ZodNever},W(r)));var pr=class extends N{_parse(e){if(this._getType(e)!==O.undefined){let a=this._getOrReturnCtx(e);return y(a,{code:m.invalid_type,expected:O.void,received:a.parsedType}),w}return he(e.data)}};pr.create=r=>new pr(c({typeName:k.ZodVoid},W(r)));var rt=class r extends N{_parse(e){let{ctx:t,status:a}=this._processInputParams(e),n=this._def;if(t.parsedType!==O.array)return y(t,{code:m.invalid_type,expected:O.array,received:t.parsedType}),w;if(n.exactLength!==null){let s=t.data.length>n.exactLength.value,u=t.data.length<n.exactLength.value;(s||u)&&(y(t,{code:s?m.too_big:m.too_small,minimum:u?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(y(t,{code:m.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(y(t,{code:m.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((s,u)=>n.type._parseAsync(new Ee(t,s,t.path,u)))).then(s=>fe.mergeArray(a,s));let i=[...t.data].map((s,u)=>n.type._parseSync(new Ee(t,s,t.path,u)));return fe.mergeArray(a,i)}get element(){return this._def.type}min(e,t){return new r(S(c({},this._def),{minLength:{value:e,message:I.toString(t)}}))}max(e,t){return new r(S(c({},this._def),{maxLength:{value:e,message:I.toString(t)}}))}length(e,t){return new r(S(c({},this._def),{exactLength:{value:e,message:I.toString(t)}}))}nonempty(e){return this.min(1,e)}};rt.create=(r,e)=>new rt(c({type:r,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray},W(e)));function nr(r){if(r instanceof be){let e={};for(let t in r.shape){let a=r.shape[t];e[t]=Me.create(nr(a))}return new be(S(c({},r._def),{shape:()=>e}))}else return r instanceof rt?new rt(S(c({},r._def),{type:nr(r.element)})):r instanceof Me?Me.create(nr(r.unwrap())):r instanceof ze?ze.create(nr(r.unwrap())):r instanceof $e?$e.create(r.items.map(e=>nr(e))):r}var be=class r extends N{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=U.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==O.object){let d=this._getOrReturnCtx(e);return y(d,{code:m.invalid_type,expected:O.object,received:d.parsedType}),w}let{status:a,ctx:n}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),u=[];if(!(this._def.catchall instanceof Ve&&this._def.unknownKeys==="strip"))for(let d in n.data)s.includes(d)||u.push(d);let l=[];for(let d of s){let T=i[d],_=n.data[d];l.push({key:{status:"valid",value:d},value:T._parse(new Ee(n,_,n.path,d)),alwaysSet:d in n.data})}if(this._def.catchall instanceof Ve){let d=this._def.unknownKeys;if(d==="passthrough")for(let T of u)l.push({key:{status:"valid",value:T},value:{status:"valid",value:n.data[T]}});else if(d==="strict")u.length>0&&(y(n,{code:m.unrecognized_keys,keys:u}),a.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let T of u){let _=n.data[T];l.push({key:{status:"valid",value:T},value:d._parse(new Ee(n,_,n.path,T)),alwaysSet:T in n.data})}}return n.common.async?Promise.resolve().then(()=>X(this,null,function*(){let d=[];for(let T of l){let _=yield T.key,j=yield T.value;d.push({key:_,value:j,alwaysSet:T.alwaysSet})}return d})).then(d=>fe.mergeObjectSync(a,d)):fe.mergeObjectSync(a,l)}get shape(){return this._def.shape()}strict(e){return I.errToObj,new r(c(S(c({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(t,a)=>{var n,i,s,u;let l=(s=(i=(n=this._def).errorMap)===null||i===void 0?void 0:i.call(n,t,a).message)!==null&&s!==void 0?s:a.defaultError;return t.code==="unrecognized_keys"?{message:(u=I.errToObj(e).message)!==null&&u!==void 0?u:l}:{message:l}}}:{}))}strip(){return new r(S(c({},this._def),{unknownKeys:"strip"}))}passthrough(){return new r(S(c({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new r(S(c({},this._def),{shape:()=>c(c({},this._def.shape()),e)}))}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>c(c({},this._def.shape()),e._def.shape()),typeName:k.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r(S(c({},this._def),{catchall:e}))}pick(e){let t={};return U.objectKeys(e).forEach(a=>{e[a]&&this.shape[a]&&(t[a]=this.shape[a])}),new r(S(c({},this._def),{shape:()=>t}))}omit(e){let t={};return U.objectKeys(this.shape).forEach(a=>{e[a]||(t[a]=this.shape[a])}),new r(S(c({},this._def),{shape:()=>t}))}deepPartial(){return nr(this)}partial(e){let t={};return U.objectKeys(this.shape).forEach(a=>{let n=this.shape[a];e&&!e[a]?t[a]=n:t[a]=n.optional()}),new r(S(c({},this._def),{shape:()=>t}))}required(e){let t={};return U.objectKeys(this.shape).forEach(a=>{if(e&&!e[a])t[a]=this.shape[a];else{let i=this.shape[a];for(;i instanceof Me;)i=i._def.innerType;t[a]=i}}),new r(S(c({},this._def),{shape:()=>t}))}keyof(){return fu(U.objectKeys(this.shape))}};be.create=(r,e)=>new be(c({shape:()=>r,unknownKeys:"strip",catchall:Ve.create(),typeName:k.ZodObject},W(e)));be.strictCreate=(r,e)=>new be(c({shape:()=>r,unknownKeys:"strict",catchall:Ve.create(),typeName:k.ZodObject},W(e)));be.lazycreate=(r,e)=>new be(c({shape:r,unknownKeys:"strip",catchall:Ve.create(),typeName:k.ZodObject},W(e)));var Rt=class extends N{_parse(e){let{ctx:t}=this._processInputParams(e),a=this._def.options;function n(i){for(let u of i)if(u.result.status==="valid")return u.result;for(let u of i)if(u.result.status==="dirty")return t.common.issues.push(...u.ctx.common.issues),u.result;let s=i.map(u=>new ke(u.ctx.common.issues));return y(t,{code:m.invalid_union,unionErrors:s}),w}if(t.common.async)return Promise.all(a.map(i=>X(this,null,function*(){let s=S(c({},t),{common:S(c({},t.common),{issues:[]}),parent:null});return{result:yield i._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}}))).then(n);{let i,s=[];for(let l of a){let d=S(c({},t),{common:S(c({},t.common),{issues:[]}),parent:null}),T=l._parseSync({data:t.data,path:t.path,parent:d});if(T.status==="valid")return T;T.status==="dirty"&&!i&&(i={result:T,ctx:d}),d.common.issues.length&&s.push(d.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let u=s.map(l=>new ke(l));return y(t,{code:m.invalid_union,unionErrors:u}),w}}get options(){return this._def.options}};Rt.create=(r,e)=>new Rt(c({options:r,typeName:k.ZodUnion},W(e)));var Xe=r=>r instanceof Mt?Xe(r.schema):r instanceof we?Xe(r.innerType()):r instanceof Et?[r.value]:r instanceof Gt?r.options:r instanceof Ct?U.objectValues(r.enum):r instanceof Wt?Xe(r._def.innerType):r instanceof kt?[void 0]:r instanceof wt?[null]:r instanceof Me?[void 0,...Xe(r.unwrap())]:r instanceof ze?[null,...Xe(r.unwrap())]:r instanceof fa||r instanceof Dt?Xe(r.unwrap()):r instanceof Nt?Xe(r._def.innerType):[],en=class r extends N{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.object)return y(t,{code:m.invalid_type,expected:O.object,received:t.parsedType}),w;let a=this.discriminator,n=t.data[a],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(y(t,{code:m.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),w)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){let n=new Map;for(let i of t){let s=Xe(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let u of s){if(n.has(u))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(u)}`);n.set(u,i)}}return new r(c({typeName:k.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n},W(a)))}};function mi(r,e){let t=et(r),a=et(e);if(r===e)return{valid:!0,data:r};if(t===O.object&&a===O.object){let n=U.objectKeys(e),i=U.objectKeys(r).filter(u=>n.indexOf(u)!==-1),s=c(c({},r),e);for(let u of i){let l=mi(r[u],e[u]);if(!l.valid)return{valid:!1};s[u]=l.data}return{valid:!0,data:s}}else if(t===O.array&&a===O.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let i=0;i<r.length;i++){let s=r[i],u=e[i],l=mi(s,u);if(!l.valid)return{valid:!1};n.push(l.data)}return{valid:!0,data:n}}else return t===O.date&&a===O.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var At=class extends N{_parse(e){let{status:t,ctx:a}=this._processInputParams(e),n=(i,s)=>{if(di(i)||di(s))return w;let u=mi(i.value,s.value);return u.valid?((fi(i)||fi(s))&&t.dirty(),{status:t.value,value:u.data}):(y(a,{code:m.invalid_intersection_types}),w)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([i,s])=>n(i,s)):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};At.create=(r,e,t)=>new At(c({left:r,right:e,typeName:k.ZodIntersection},W(t)));var $e=class r extends N{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==O.array)return y(a,{code:m.invalid_type,expected:O.array,received:a.parsedType}),w;if(a.data.length<this._def.items.length)return y(a,{code:m.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w;!this._def.rest&&a.data.length>this._def.items.length&&(y(a,{code:m.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...a.data].map((s,u)=>{let l=this._def.items[u]||this._def.rest;return l?l._parse(new Ee(a,s,a.path,u)):null}).filter(s=>!!s);return a.common.async?Promise.all(i).then(s=>fe.mergeArray(t,s)):fe.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new r(S(c({},this._def),{rest:e}))}};$e.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $e(c({items:r,typeName:k.ZodTuple,rest:null},W(e)))};var tn=class r extends N{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==O.object)return y(a,{code:m.invalid_type,expected:O.object,received:a.parsedType}),w;let n=[],i=this._def.keyType,s=this._def.valueType;for(let u in a.data)n.push({key:i._parse(new Ee(a,u,a.path,u)),value:s._parse(new Ee(a,a.data[u],a.path,u)),alwaysSet:u in a.data});return a.common.async?fe.mergeObjectAsync(t,n):fe.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,a){return t instanceof N?new r(c({keyType:e,valueType:t,typeName:k.ZodRecord},W(a))):new r(c({keyType:ut.create(),valueType:e,typeName:k.ZodRecord},W(t)))}},ur=class extends N{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==O.map)return y(a,{code:m.invalid_type,expected:O.map,received:a.parsedType}),w;let n=this._def.keyType,i=this._def.valueType,s=[...a.data.entries()].map(([u,l],d)=>({key:n._parse(new Ee(a,u,a.path,[d,"key"])),value:i._parse(new Ee(a,l,a.path,[d,"value"]))}));if(a.common.async){let u=new Map;return Promise.resolve().then(()=>X(this,null,function*(){for(let l of s){let d=yield l.key,T=yield l.value;if(d.status==="aborted"||T.status==="aborted")return w;(d.status==="dirty"||T.status==="dirty")&&t.dirty(),u.set(d.value,T.value)}return{status:t.value,value:u}}))}else{let u=new Map;for(let l of s){let d=l.key,T=l.value;if(d.status==="aborted"||T.status==="aborted")return w;(d.status==="dirty"||T.status==="dirty")&&t.dirty(),u.set(d.value,T.value)}return{status:t.value,value:u}}}};ur.create=(r,e,t)=>new ur(c({valueType:e,keyType:r,typeName:k.ZodMap},W(t)));var cr=class r extends N{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==O.set)return y(a,{code:m.invalid_type,expected:O.set,received:a.parsedType}),w;let n=this._def;n.minSize!==null&&a.data.size<n.minSize.value&&(y(a,{code:m.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&a.data.size>n.maxSize.value&&(y(a,{code:m.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function s(l){let d=new Set;for(let T of l){if(T.status==="aborted")return w;T.status==="dirty"&&t.dirty(),d.add(T.value)}return{status:t.value,value:d}}let u=[...a.data.values()].map((l,d)=>i._parse(new Ee(a,l,a.path,d)));return a.common.async?Promise.all(u).then(l=>s(l)):s(u)}min(e,t){return new r(S(c({},this._def),{minSize:{value:e,message:I.toString(t)}}))}max(e,t){return new r(S(c({},this._def),{maxSize:{value:e,message:I.toString(t)}}))}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};cr.create=(r,e)=>new cr(c({valueType:r,minSize:null,maxSize:null,typeName:k.ZodSet},W(e)));var rn=class r extends N{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.function)return y(t,{code:m.invalid_type,expected:O.function,received:t.parsedType}),w;function a(u,l){return Ya({data:u,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Qa(),ir].filter(d=>!!d),issueData:{code:m.invalid_arguments,argumentsError:l}})}function n(u,l){return Ya({data:u,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Qa(),ir].filter(d=>!!d),issueData:{code:m.invalid_return_type,returnTypeError:l}})}let i={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof lt){let u=this;return he(function(...l){return X(this,null,function*(){let d=new ke([]),T=yield u._def.args.parseAsync(l,i).catch(B=>{throw d.addIssue(a(l,B)),d}),_=yield Reflect.apply(s,this,T);return yield u._def.returns._def.type.parseAsync(_,i).catch(B=>{throw d.addIssue(n(_,B)),d})})})}else{let u=this;return he(function(...l){let d=u._def.args.safeParse(l,i);if(!d.success)throw new ke([a(l,d.error)]);let T=Reflect.apply(s,this,d.data),_=u._def.returns.safeParse(T,i);if(!_.success)throw new ke([n(T,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r(S(c({},this._def),{args:$e.create(e).rest(tt.create())}))}returns(e){return new r(S(c({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,a){return new r(c({args:e||$e.create([]).rest(tt.create()),returns:t||tt.create(),typeName:k.ZodFunction},W(a)))}},Mt=class extends N{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Mt.create=(r,e)=>new Mt(c({getter:r,typeName:k.ZodLazy},W(e)));var Et=class extends N{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return y(t,{received:t.data,code:m.invalid_literal,expected:this._def.value}),w}return{status:"valid",value:e.data}}get value(){return this._def.value}};Et.create=(r,e)=>new Et(c({value:r,typeName:k.ZodLiteral},W(e)));function fu(r,e){return new Gt(c({values:r,typeName:k.ZodEnum},W(e)))}var Gt=class r extends N{constructor(){super(...arguments),ca.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),a=this._def.values;return y(t,{expected:U.joinValues(a),received:t.parsedType,code:m.invalid_type}),w}if(Xa(this,ca,"f")||uu(this,ca,new Set(this._def.values),"f"),!Xa(this,ca,"f").has(e.data)){let t=this._getOrReturnCtx(e),a=this._def.values;return y(t,{received:t.data,code:m.invalid_enum_value,options:a}),w}return he(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,c(c({},this._def),t))}exclude(e,t=this._def){return r.create(this.options.filter(a=>!e.includes(a)),c(c({},this._def),t))}};ca=new WeakMap;Gt.create=fu;var Ct=class extends N{constructor(){super(...arguments),la.set(this,void 0)}_parse(e){let t=U.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==O.string&&a.parsedType!==O.number){let n=U.objectValues(t);return y(a,{expected:U.joinValues(n),received:a.parsedType,code:m.invalid_type}),w}if(Xa(this,la,"f")||uu(this,la,new Set(U.getValidEnumValues(this._def.values)),"f"),!Xa(this,la,"f").has(e.data)){let n=U.objectValues(t);return y(a,{received:a.data,code:m.invalid_enum_value,options:n}),w}return he(e.data)}get enum(){return this._def.values}};la=new WeakMap;Ct.create=(r,e)=>new Ct(c({values:r,typeName:k.ZodNativeEnum},W(e)));var lt=class extends N{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.promise&&t.common.async===!1)return y(t,{code:m.invalid_type,expected:O.promise,received:t.parsedType}),w;let a=t.parsedType===O.promise?t.data:Promise.resolve(t.data);return he(a.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};lt.create=(r,e)=>new lt(c({type:r,typeName:k.ZodPromise},W(e)));var we=class extends N{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===k.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:a}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:s=>{y(a,s),s.fatal?t.abort():t.dirty()},get path(){return a.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let s=n.transform(a.data,i);if(a.common.async)return Promise.resolve(s).then(u=>X(this,null,function*(){if(t.value==="aborted")return w;let l=yield this._def.schema._parseAsync({data:u,path:a.path,parent:a});return l.status==="aborted"?w:l.status==="dirty"||t.value==="dirty"?or(l.value):l}));{if(t.value==="aborted")return w;let u=this._def.schema._parseSync({data:s,path:a.path,parent:a});return u.status==="aborted"?w:u.status==="dirty"||t.value==="dirty"?or(u.value):u}}if(n.type==="refinement"){let s=u=>{let l=n.refinement(u,i);if(a.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return u};if(a.common.async===!1){let u=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return u.status==="aborted"?w:(u.status==="dirty"&&t.dirty(),s(u.value),{status:t.value,value:u.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(u=>u.status==="aborted"?w:(u.status==="dirty"&&t.dirty(),s(u.value).then(()=>({status:t.value,value:u.value}))))}if(n.type==="transform")if(a.common.async===!1){let s=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Ot(s))return s;let u=n.transform(s.value,i);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:u}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(s=>Ot(s)?Promise.resolve(n.transform(s.value,i)).then(u=>({status:t.value,value:u})):s);U.assertNever(n)}};we.create=(r,e,t)=>new we(c({schema:r,typeName:k.ZodEffects,effect:e},W(t)));we.createWithPreprocess=(r,e,t)=>new we(c({schema:e,effect:{type:"preprocess",transform:r},typeName:k.ZodEffects},W(t)));var Me=class extends N{_parse(e){return this._getType(e)===O.undefined?he(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Me.create=(r,e)=>new Me(c({innerType:r,typeName:k.ZodOptional},W(e)));var ze=class extends N{_parse(e){return this._getType(e)===O.null?he(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ze.create=(r,e)=>new ze(c({innerType:r,typeName:k.ZodNullable},W(e)));var Wt=class extends N{_parse(e){let{ctx:t}=this._processInputParams(e),a=t.data;return t.parsedType===O.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Wt.create=(r,e)=>new Wt(c({innerType:r,typeName:k.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},W(e)));var Nt=class extends N{_parse(e){let{ctx:t}=this._processInputParams(e),a=S(c({},t),{common:S(c({},t.common),{issues:[]})}),n=this._def.innerType._parse({data:a.data,path:a.path,parent:c({},a)});return da(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ke(a.common.issues)},input:a.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ke(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};Nt.create=(r,e)=>new Nt(c({innerType:r,typeName:k.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},W(e)));var lr=class extends N{_parse(e){if(this._getType(e)!==O.nan){let a=this._getOrReturnCtx(e);return y(a,{code:m.invalid_type,expected:O.nan,received:a.parsedType}),w}return{status:"valid",value:e.data}}};lr.create=r=>new lr(c({typeName:k.ZodNaN},W(r)));var Hl=Symbol("zod_brand"),fa=class extends N{_parse(e){let{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}},ma=class r extends N{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.common.async)return X(this,null,function*(){let i=yield this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?w:i.status==="dirty"?(t.dirty(),or(i.value)):this._def.out._parseAsync({data:i.value,path:a.path,parent:a})});{let n=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?w:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:a.path,parent:a})}}static create(e,t){return new r({in:e,out:t,typeName:k.ZodPipeline})}},Dt=class extends N{_parse(e){let t=this._def.innerType._parse(e),a=n=>(Ot(n)&&(n.value=Object.freeze(n.value)),n);return da(t)?t.then(n=>a(n)):a(t)}unwrap(){return this._def.innerType}};Dt.create=(r,e)=>new Dt(c({innerType:r,typeName:k.ZodReadonly},W(e)));function iu(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function mu(r,e={},t){return r?ct.create().superRefine((a,n)=>{var i,s;let u=r(a);if(u instanceof Promise)return u.then(l=>{var d,T;if(!l){let _=iu(e,a),j=(T=(d=_.fatal)!==null&&d!==void 0?d:t)!==null&&T!==void 0?T:!0;n.addIssue(S(c({code:"custom"},_),{fatal:j}))}});if(!u){let l=iu(e,a),d=(s=(i=l.fatal)!==null&&i!==void 0?i:t)!==null&&s!==void 0?s:!0;n.addIssue(S(c({code:"custom"},l),{fatal:d}))}}):ct.create()}var Kl={object:be.lazycreate},k;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(k||(k={}));var Jl=(r,e={message:`Input not instance of ${r.name}`})=>mu(t=>t instanceof r,e),hu=ut.create,Tu=Ft.create,Ql=lr.create,Yl=It.create,gu=_t.create,Xl=vt.create,ed=sr.create,td=kt.create,rd=wt.create,ad=ct.create,nd=tt.create,od=Ve.create,id=pr.create,sd=rt.create,pd=be.create,ud=be.strictCreate,cd=Rt.create,ld=en.create,dd=At.create,fd=$e.create,md=tn.create,hd=ur.create,Td=cr.create,gd=rn.create,xd=Mt.create,yd=Et.create,bd=Gt.create,Sd=Ct.create,Od=lt.create,su=we.create,Fd=Me.create,Id=ze.create,_d=we.createWithPreprocess,vd=ma.create,kd=()=>hu().optional(),wd=()=>Tu().optional(),Rd=()=>gu().optional(),Ad={string:r=>ut.create(S(c({},r),{coerce:!0})),number:r=>Ft.create(S(c({},r),{coerce:!0})),boolean:r=>_t.create(S(c({},r),{coerce:!0})),bigint:r=>It.create(S(c({},r),{coerce:!0})),date:r=>vt.create(S(c({},r),{coerce:!0}))},Md=w,o=Object.freeze({__proto__:null,defaultErrorMap:ir,setErrorMap:_l,getErrorMap:Qa,makeIssue:Ya,EMPTY_PATH:vl,addIssueToContext:y,ParseStatus:fe,INVALID:w,DIRTY:or,OK:he,isAborted:di,isDirty:fi,isValid:Ot,isAsync:da,get util(){return U},get objectUtil(){return li},ZodParsedType:O,getParsedType:et,ZodType:N,datetimeRegex:du,ZodString:ut,ZodNumber:Ft,ZodBigInt:It,ZodBoolean:_t,ZodDate:vt,ZodSymbol:sr,ZodUndefined:kt,ZodNull:wt,ZodAny:ct,ZodUnknown:tt,ZodNever:Ve,ZodVoid:pr,ZodArray:rt,ZodObject:be,ZodUnion:Rt,ZodDiscriminatedUnion:en,ZodIntersection:At,ZodTuple:$e,ZodRecord:tn,ZodMap:ur,ZodSet:cr,ZodFunction:rn,ZodLazy:Mt,ZodLiteral:Et,ZodEnum:Gt,ZodNativeEnum:Ct,ZodPromise:lt,ZodEffects:we,ZodTransformer:we,ZodOptional:Me,ZodNullable:ze,ZodDefault:Wt,ZodCatch:Nt,ZodNaN:lr,BRAND:Hl,ZodBranded:fa,ZodPipeline:ma,ZodReadonly:Dt,custom:mu,Schema:N,ZodSchema:N,late:Kl,get ZodFirstPartyTypeKind(){return k},coerce:Ad,any:ad,array:sd,bigint:Yl,boolean:gu,date:Xl,discriminatedUnion:ld,effect:su,enum:bd,function:gd,instanceof:Jl,intersection:dd,lazy:xd,literal:yd,map:hd,nan:Ql,nativeEnum:Sd,never:od,null:rd,nullable:Id,number:Tu,object:pd,oboolean:Rd,onumber:wd,optional:Fd,ostring:kd,pipeline:vd,preprocess:_d,promise:Od,record:md,set:Td,strictObject:ud,string:hu,symbol:ed,transformer:su,tuple:fd,undefined:td,union:cd,unknown:nd,void:id,NEVER:Md,ZodIssueCode:m,quotelessJson:Il,ZodError:ke});function Y(r){return r.reduce((e,t)=>(e[t]=t,e),{})}var He=o.record(o.string(),o.union([o.string(),o.boolean(),o.number(),o.null(),o.undefined(),o.lazy(()=>He),o.union([o.string(),o.boolean(),o.number(),o.null(),o.undefined(),o.lazy(()=>He)]).array()])).nullable().describe("Custom key/value object"),M=o.union([o.string().datetime({offset:!0,local:!0}),o.string({invalid_type_error:"must be a valid date-time string"}).regex(/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/),o.string().date()]),an=o.enum(["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Asmera","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Timbuktu","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/ComodRivadavia","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Atikokan","America/Atka","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Buenos_Aires","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Catamarca","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Ciudad_Juarez","America/Coral_Harbour","America/Cordoba","America/Costa_Rica","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Ensenada","America/Fort_Nelson","America/Fort_Wayne","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Indianapolis","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Indianapolis","America/Inuvik","America/Iqaluit","America/Jamaica","America/Jujuy","America/Juneau","America/Kentucky/Louisville","America/Kentucky/Monticello","America/Knox_IN","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Louisville","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Mendoza","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montreal","America/Montserrat","America/Nassau","America/New_York","America/Nipigon","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Nuuk","America/Ojinaga","America/Panama","America/Pangnirtung","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Acre","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rainy_River","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Rosario","America/Santa_Isabel","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Shiprock","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Thunder_Bay","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Virgin","America/Whitehorse","America/Winnipeg","America/Yakutat","America/Yellowknife","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/South_Pole","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Ashkhabad","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Calcutta","Asia/Chita","Asia/Choibalsan","Asia/Chongqing","Asia/Chungking","Asia/Colombo","Asia/Dacca","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Harbin","Asia/Hebron","Asia/Ho_Chi_Minh","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Istanbul","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Kashgar","Asia/Kathmandu","Asia/Katmandu","Asia/Khandyga","Asia/Kolkata","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macao","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Saigon","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Tel_Aviv","Asia/Thimbu","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ujung_Pandang","Asia/Ulaanbaatar","Asia/Ulan_Bator","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yangon","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faeroe","Atlantic/Faroe","Atlantic/Jan_Mayen","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/ACT","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Canberra","Australia/Currie","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/LHI","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/NSW","Australia/North","Australia/Perth","Australia/Queensland","Australia/South","Australia/Sydney","Australia/Tasmania","Australia/Victoria","Australia/West","Australia/Yancowinna","Brazil/Acre","Brazil/DeNoronha","Brazil/East","Brazil/West","CET","CST6CDT","Canada/Atlantic","Canada/Central","Canada/Eastern","Canada/Mountain","Canada/Newfoundland","Canada/Pacific","Canada/Saskatchewan","Canada/Yukon","Chile/Continental","Chile/EasterIsland","Cuba","EET","EST","EST5EDT","Egypt","Eire","Etc/GMT","Etc/GMT+0","Etc/GMT+1","Etc/GMT+10","Etc/GMT+11","Etc/GMT+12","Etc/GMT+2","Etc/GMT+3","Etc/GMT+4","Etc/GMT+5","Etc/GMT+6","Etc/GMT+7","Etc/GMT+8","Etc/GMT+9","Etc/GMT-0","Etc/GMT-1","Etc/GMT-10","Etc/GMT-11","Etc/GMT-12","Etc/GMT-13","Etc/GMT-14","Etc/GMT-2","Etc/GMT-3","Etc/GMT-4","Etc/GMT-5","Etc/GMT-6","Etc/GMT-7","Etc/GMT-8","Etc/GMT-9","Etc/GMT0","Etc/Greenwich","Etc/UCT","Etc/UTC","Etc/Universal","Etc/Zulu","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belfast","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Kyiv","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Nicosia","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Tiraspol","Europe/Ulyanovsk","Europe/Uzhgorod","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zaporozhye","Europe/Zurich","Factory","GB","GB-Eire","GMT","GMT+0","GMT-0","GMT0","Greenwich","HST","Hongkong","Iceland","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Iran","Israel","Jamaica","Japan","Kwajalein","Libya","MET","MST","MST7MDT","Mexico/BajaNorte","Mexico/BajaSur","Mexico/General","NZ","NZ-CHAT","Navajo","PRC","PST8PDT","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Chuuk","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Johnston","Pacific/Kanton","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Pohnpei","Pacific/Ponape","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Samoa","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Truk","Pacific/Wake","Pacific/Wallis","Pacific/Yap","Poland","Portugal","ROC","ROK","Singapore","Turkey","UCT","US/Alaska","US/Aleutian","US/Arizona","US/Central","US/East-Indiana","US/Eastern","US/Hawaii","US/Indiana-Starke","US/Michigan","US/Mountain","US/Pacific","US/Samoa","UTC","Universal","W-SU","WET","Zulu"]).describe("Timezones allowed"),at=o.object({allow_timestamps:o.boolean().describe("Allow setting timestamps in transfer insert/update statements"),production:o.boolean().describe("Is running in production mode?")}).partial().describe("System wide flags"),Ed=o.enum(["Token","TransferGroup","TransferLog","Transfer","WalletTokenSetting","Wallet","WapiSetting"]),rg=Y(Ed.options),hi=o.enum(["="]),Ti=o.enum([">=","<=","<",">"]),xu=o.enum(["like","ilike"]),ag=o.enum([...hi.options,...Ti.options]).default("="),ng=o.enum([...hi.options,...Ti.options,...xu.options]).default("="),yu=o.enum([...hi.options,...Ti.options,...xu.options]),Bt=o.union([o.string(),o.boolean(),o.number()]),Gd=o.object({foreign:o.union([o.string(),o.number()])}),Cd=o.object({identifier:o.union([o.string(),o.number()])}),Se=o.string().regex(/^(?!.*\.\.)[a-zA-Z_][a-zA-Z0-9_.-]*[a-zA-Z0-9_-]$/,"Key is limited to [a-zA-Z0-9_-] and cant start with a number"),bu=o.union([o.string().array().min(1),o.number().array().min(1)]),Q=o.record(Se,Bt).describe("Metadata filter for custom properties"),Ke=o.enum(["where","orWhere"]),og=Y(Ke.options),gi=o.enum(["whereNull","orWhereNull","whereNotNull","orWhereNotNull"]),ig=Y(gi.options),xi=o.enum(["whereIn","orWhereIn"]),sg=Y(xi.options),yi=o.enum(["whereMetadata","orWhereMetadata"]),pg=Y(yi.options),bi=o.enum(["whereMetadataNull","orWhereMetadataNull","whereMetadataNotNull","orWhereMetadataNotNull"]),ug=Y(bi.options),Si=o.enum(["whereMetadataIn","orWhereMetadataIn"]),cg=Y(Si.options),ha=o.enum(["=",">=","<=","<",">","ilike","like"]).default("="),Wd=o.object({function:Ke,field:Se,operator:ha.optional(),value:Bt}).describe("Filtering for where and orWhere"),Nd=o.union([Bt,Gd]),lg=o.object({function:Ke,field:Se,operator:ha.optional(),value:Nd}).describe("Filtering for where and orWhere"),Dd=o.union([Bt,Cd]),dg=o.object({function:Ke,field:Se,operator:ha.optional(),value:Dd}).describe("Filtering for where and orWhere"),Bd=o.object({function:yi,field:Se,operator:ha.optional(),value:Bt}).required({function:!0,field:!0,value:!0}).describe("Filtering for where and orWhere"),jd=o.object({metadata:Q.optional()}).catchall(Bt),fg=o.union([Bt,Q]),Pd=o.object({function:Ke,value:jd}),Vd=o.union([Wd,Pd]),Zd=o.object({function:xi,field:Se,value:bu}),Ud=o.object({function:Si,field:Se,value:bu}),Ld=o.object({function:gi,field:Se}).describe("Filtering for whereNull and orWhereNull, whereNotNull and orWhereNotNull"),qd=o.object({function:bi,field:Se}).describe("Filtering for whereNull and orWhereNull, whereNotNull and orWhereNotNull for metadata"),Su=o.discriminatedUnion("function",[Bd,Ud,qd]),Ou=o.union([Vd,Zd,Ld,Su,o.object({function:Ke,inner:o.lazy(()=>Ou.array())})]),mg=o.object({function:Ke,inner:Ou.array()}),$d=o.union([Ke,xi,gi,yi,Si,bi]),zd=o.object({function:$d,field:Se.optional(),operator:ha.optional(),value:o.unknown().optional(),inner:o.unknown().array().optional()}),Hd=o.object({function:Ke,inner:o.unknown().array()});function dt(r,e,t){let a=e.safeParse(r);return a.success||a.error.errors.forEach(n=>{t.addIssue(S(c({},n),{message:"complex_error:"+n.message}))}),a.success}function Je(r,e){let t=e.required(),a=t.keyof(),n=o.object({function:Ke,value:r}),i=(s,u)=>{if(!dt(s,zd,u))return!1;let l=s;if(l.inner)return dt(l,Hd,u)?!l.inner.some(d=>{if(i(d,u)===!1)return!0}):!1;if(!l.field)return dt(l,n,u);if(l.function.toLowerCase().includes("metadata"))return dt(l,Su,u);if(!dt(l.field,a,u)||!t.shape[l.field])return!1;if(l.function.toLowerCase().includes("null"))return!0;if(t.shape[l.field]._def.typeName==="ZodEnum"&&(!Array.isArray(l.value)&&!dt(l.value,t.shape[l.field],u)||Array.isArray(l.value)&&!dt(l.value,t.shape[l.field].array(),u)))return!1};return o.record(Se,o.unknown()).superRefine((s,u)=>s.function?i(s,u):dt(s,r,u))}var Ze=o.union([o.string(),o.number()]).transform(r=>String(r)),Te=o.union([o.string().regex(/^[1-9][0-9]*$/,"invalid integer"),o.number().int().positive()]).transform(r=>Number(r)),dr=o.union([o.string().regex(/^-{0,1}((0\.\d+)|([1-9]\d*(\.\d+){0,1}))$/,"invalid number"),o.number()]).transform(r=>parseFloat(String(r))),Oi=o.object({tracking_id:o.string().max(64).describe("User provided id added to logs for debugging")}).describe("Tracking flags for input"),x=Oi.extend({transaction_id:o.string().max(64).describe("Id of the transaction context to run the query in")}).describe("Generic flags for input"),le=o.object({limit:o.number().int().nonnegative().default(20).describe("Number of records to return"),offset:o.number().int().nonnegative().default(0).describe("Number of records to omit from the beginning")}).describe("Optional flags for input limiting"),Oe=o.object({return_metadata_total:o.boolean().describe("Return the total rows count in metadata")}).describe("Metadata flags for input"),Kd=o.enum(["asc","desc"]).describe("Direction to order"),Jd=o.enum(["first","last"]).describe("Should nulls be first or last"),Fe=o.object({field:o.string().describe("Field to order by"),direction:Kd.default("asc"),nulls:Jd}).strict().partial().required({field:!0}).describe("Input for orderBy"),_u=o.object({order:Fe.array().describe("Ordering options")}).describe("Optional flags for input ordering"),Fu=o.object({id:o.number().int().positive().describe("id of the object"),foreign:o.string().max(255).describe("foreign of the object")}).strict().partial(),fr=o.union([Fu.required({id:!0}),Fu.required({foreign:!0})]),Iu=o.object({id:o.number().int().positive().describe("id of the object"),identifier:o.string().max(255).describe("identifier of the object")}).strict().partial(),nn=o.union([Iu.required({id:!0}),Iu.required({identifier:!0})]),jt=o.enum(["replace","extend"]).default("replace").describe("Whether to replace or extend current metadata with new value"),Pt=o.enum(["replace","replace_create_only","replace_cancel_only","extend","extend_create_only","extend_cancel_only"]).default("replace").describe("Whether to replace or extend current metadata with new value"),Fi=o.enum(["keep","random","largest","target"]).describe("Rule for distribution grouping"),bg=Y(Fi.options),Ge=o.object({total:o.number().int().nonnegative().describe("Total number of records matching the query"),offset:o.number().int().nonnegative().describe("Current query offset"),limit:o.number().int().nonnegative().describe("Current query limit"),more_rows:o.boolean().describe("Boolean showing if there would be more rows to return with a higher offset/limit"),order:Fe.array()}).partial().required({offset:!0,limit:!0,more_rows:!0}).describe("Metadata about the search"),on=o.enum(["count","countDistinct","sum","average","min","max"]).default("count").describe("Function to use for grouping"),Ii=o.object({function:on,field:Se.describe("Field to group by"),alias:Se.describe("Alias to group under")}).partial().describe("Function and field to group"),_i=o.union([on,Ii]).describe("Aggregator description"),Ta=o.enum(["year","month","week","day","hour","minute"]).describe("Time period rows should be grouped by"),vu=Y(Ta.options),Qd=o.object({period:Ta.default("day"),timezone:an}).strict().required(),Yd=o.union([Ta,Qd]),ga=o.object({type:o.literal("period"),field:Yd,alias:o.string()}).strict().partial().required({type:!0,field:!0}),xa=o.object({type:o.literal("field"),field:o.string(),alias:o.string()}).strict().partial().required({type:!0,field:!0}),ya=o.object({type:o.literal("metadata_field"),field:o.string(),alias:o.string()}).strict().partial().required({type:!0,field:!0}),Xd=o.discriminatedUnion("type",[ga,xa,ya]);var ef=Xd.array().max(5),tf=o.record(o.string(),o.union([o.string(),o.number()]).nullable()).describe("Result of the aggregation"),sn=tf.array().describe("Results of the aggregation"),ku=o.object({aggregators:_i.array(),groups:ef}).partial().required({groups:!0}).describe("Metadata about the aggregation"),Sg=o.object({select:o.string().array()}).describe("Optional flags to select specific fields"),Og=o.object({deselect:o.string().array()}).describe('Optional flag to remove field from select"'),Qe=o.object({start_time:M,end_time:M}).partial().strict();var ft=o.enum(["active","disabled"]).describe("Current status for the wallet"),wu=Y(ft.options),mt=o.enum(["token","house","regular"]).describe("Type of the wallet"),Ru=Y(mt.options),Z=o.object({id:o.number().int().positive().describe("System defined primary key"),foreign:o.string().min(1).max(255).describe("User provided key for wallet. Must be unique"),name:o.string().min(1).max(255).optional().nullable().describe("User provided key for wallet. Must be unique"),metadata:He.describe("Key/value object describing this wallet").optional(),default_allow_negative:o.boolean().default(!1).describe("Boolean indicating if wallet (pending_amount + finished_amount) can be negative"),default_allow_positive:o.boolean().default(!0).describe("Boolean indicating if wallet (pending_amount + finished_amount) can be positive. Used for token balance to deny positive balance."),created_at:M.describe("Datetime of the initial create"),updated_at:M.describe("Datetime of the last update"),default_dtw_to:o.string().max(3).optional().describe("Bitmap indicating default what types of transfers can originate from wallet"),default_dtw_from:o.string().max(3).optional().describe("Bitmap indicating default what types of transfers can end to wallet"),type:mt.describe("Type of the wallet").default("regular"),status:ft.describe("Current status for the wallet").default("active")}).strict().describe("Wallet|Entities who can make transfers in this system");var z=o.enum(["pending","finished","cancelled"]).describe("Status of the transfer"),Au=Y(z.options),pe=z.exclude(["cancelled"]).describe("Status of the transfer"),Ce=o.enum(["transfer","deposit","withdrawal"]).describe("Type of the transfer"),Vt=Y(Ce.options),h=o.object({id:o.number().int().positive().describe("System defined primary key"),identifier:o.string().min(1).max(255).describe("Identifier for this transfer. Must be unique"),control_hash:o.string().max(255).nullable().describe('Hash binding this transfer to the from_wallets transfer chain. It is calculated as sha256(latest_outgoing_hash + "-" + NEW.identifier)'),from_wallet_id:o.number().int().positive().describe("Foreign key to wallet funds originate from"),to_wallet_id:o.number().int().positive().describe("Foreign key to wallet where funds are going"),token_id:o.number().int().positive().describe("Foreign key to token this transfer refers to"),amount:o.number().positive().describe("The transfer amount"),type:Ce.describe("Type of the transfer").default("transfer"),status:z.describe("Status of the transfer").default("pending"),force:o.boolean().default(!1).describe("Set to true to force transfer without checking for negative balance constraints"),auto_hash:o.boolean().default(!0).describe("When set to true it will automatically calculate the control_hash"),created_at:M.describe("Datetime of the initial create"),updated_at:M.describe("Datetime of the last update"),metadata:He.describe("Key/value object describing this transfer").optional(),transfer_group_id:o.number().int().positive().nullable().optional().describe("Foreign key pointing to the transfer_group this transfer belongs to"),reverses_id:o.number().int().positive().nullable().optional().describe("Foreign key pointing to the transfer this transfer reverses. Must be unique"),status_finalized_at:M.nullable().optional().describe("DateTime transfer reached final status"),group_validate:o.boolean().nullable().optional().describe("Boolean showing if the transfer_group has validate_final_balance_only")}).strict().describe("A transfer of value from one wallet to another"),Mg=h.omit({id:!0}).extend({status:pe.default("pending")}).partial().required({identifier:!0,from_wallet_id:!0,to_wallet_id:!0,token_id:!0,amount:!0});var E=o.object({id:o.number().int().positive().describe("System defined primary key"),transfer_id:o.number().int().positive().describe("Foreign key pointing to the transfer this log belongs to"),wallet_id:o.number().int().positive().describe("Foreign key pointing to the wallet this log belongs to"),token_id:o.number().int().positive().describe("Foreign key pointing to the token this log belongs to"),amount:o.number().describe("The amount the wallet balance is changed by"),pending_amount:o.number().describe("The pending balance of wallet after this transfer_log"),finished_amount:o.number().describe("The finished balance of wallet after this transfer_log"),allow_negative:o.boolean().default(!1).describe("Boolean indicating if wallet (pending_amount + finished_amount) can be negative"),allow_positive:o.boolean().default(!0).describe("Boolean indicating if wallet (pending_amount + finished_amount) can be positive. Used for token balance to deny positive balance."),force:o.boolean().default(!1).describe("Boolean indicating if the latest transfer from this wallet was forced to ignore negative balance checks"),created_at:M.describe("Datetime this log was created"),latest_control_hash:o.string().max(255).nullable().describe("Latest hash related to this wallet"),pending_amount_to:o.number().describe("The incoming pending balance"),pending_amount_from:o.number().describe("The outgoing pending balance"),group_balance:o.number().nullable().describe("Running balance for the wallet in this group"),transfer_group_id:o.number().int().positive().nullable().optional().describe("Foreign key pointing to the transfer_group this transfer_log belongs to"),current:o.boolean().describe("Boolean showing if this transfer_log is the latest for this wallet/token combination"),available_balance:o.number().describe("Available balance that is sum of pending_amount_from and finished_amount"),token_limit:o.number().nullable().describe("If wallet = token.belongs_to and token has limit"),status:z.describe("Status of this log - same as Transfer.status"),type:Ce.describe("Type of this log - same as Transfer.type")}).strict().describe("TransferLog|Individual parts of a transfer, will be updated internally by db. Immutable");var Mu=o.enum(["active","dw-only","disabled"]).describe("Current status for the token"),Eu=Y(Mu.options),ht=o.enum(["value","share","group","contract"]).describe("Type of the token"),Gu=Y(ht.options),P=o.object({id:o.number().int().positive().describe("System defined primary key"),foreign:o.string().min(1).max(255).describe("Name of the token, used for name based token transfers. Must be unique"),public:o.boolean().describe("Boolean indicating if token can be traded with outside seed wallet").default(!0),belongs_to:o.number().int().positive().describe("Foreign key to seed wallet"),metadata:He.describe("Key/value object describing the token").optional(),divisor:o.number().nullable().describe("Minimum amount of token that can be transferred").optional(),limit:o.number().nullable().describe("Maximum amount of token that can be issued").optional(),type:ht.describe("Type of the token").default("value"),status:Mu.describe("Current status for the token").default("active"),created_at:M.describe("Datetime when the token was created"),updated_at:M.describe("Datetime when the token was last updated")}).strict().describe("Units of value which can be transferred in this system");var H=fr.describe("Unique wallet filter"),ba=x.extend({ignore_cache:o.boolean().describe("Ignore cached information"),create_if_not_exists:o.boolean().default(!1).describe("If true then the token will be created if not found. Only valid with 'foreign'"),return_only_id:o.boolean().default(!1).describe("If true then the returning object is only guaranteed to have id")}).partial(),pn=o.object({wallet:H,options:ba.optional()}).strict().required({wallet:!0}).describe("Input for getWallet"),vi=Z.extend({balance_token_id:P.shape.id.nullable(),balance_token_foreign:P.shape.foreign.nullable(),balance_transfer_id:E.shape.transfer_id.describe("Latest transfer id").nullable(),balance_pending_amount:E.shape.pending_amount.describe("Current pending balance").nullable(),balance_pending_amount_to:E.shape.pending_amount_to.describe("Sum of incoming pending transfers").nullable(),balance_pending_amount_from:E.shape.pending_amount_from.describe("Sum of outgoing pending transfers").nullable(),balance_finished_amount:E.shape.finished_amount.describe("Current finished balance").nullable(),balance_amount:o.number().describe("Current finished and pending balance sum").nullable(),balance_available_balance:E.shape.available_balance.describe("Available balance that is sum of pending_amount_from and finished_amount").nullable(),balance_latest_control_hash:E.shape.latest_control_hash.describe("Latest control_hash associated with wallet token combination").nullable(),balance_updated_at:E.shape.created_at.describe('"Last modification date of balance').nullable()}),un=vi.keyof(),ki=Z.partial().required({id:!0}),cn=o.object({wallet:ki.optional()}).describe("Output of getWallet");var We=o.enum(["open","closed"]).describe("Lifecycle status for transfer group"),ln=Y(We.options),Tt=o.enum(["regular","exchange","distribution"]).describe("Type of the transfer group"),Cu=Y(Tt.options),D=o.object({id:o.number().int().positive().describe("System defined primary key"),identifier:o.string().min(1).max(255).describe("Identifier for this transfer group. Must be unique"),created_at:M.describe("Datetime of the initial create"),updated_at:M.describe("Datetime of the last update"),metadata:He.describe("Key/value object describing this transfer_group").optional(),transfer_group_id:o.number().int().positive().nullable().optional().describe("Foreign key pointing to the transfer_group this transfer belongs to"),reverses_id:o.number().int().positive().nullable().optional().describe("Foreign key pointing to the transfer_group this transfer_group reverses. Must be unique"),status_finalized_at:M.nullable().optional().describe("Time transfer_group was closed"),transfer_status_finalized_at:M.nullable().optional().describe("Time transfer_status reached final state"),validate_final_balance_only:o.boolean().nullable().optional().describe("Boolean if only the final balances of wallets should be validated"),transfer_status:o.enum(["pending","finished","cancelled"]).describe("Status of the transfers").default("pending"),status:We.describe("Lifecycle status for transfer group").default("open"),type:Tt.describe("Type of the transfer group").default("regular")}).strict().describe("TransferGroup|An entity collecting transfers into a group locked by status");var nt=nn.describe("Unique transfer filter"),wi=x.partial(),dn=o.object({transfer:nt,options:wi.optional()}).strict().required({transfer:!0}).describe("Input for getTransfer"),ue=h.extend({from_wallet_foreign:Z.shape.foreign,to_wallet_foreign:Z.shape.foreign,token_foreign:P.shape.foreign,transfer_group_identifier:D.shape.identifier.nullable(),reverses_identifier:h.shape.identifier.nullable()}),Wu=ue.extend({balance_id:E.shape.id.nullable().describe("Iterator marking the position of the balance in the continuum"),balance_pending:E.shape.pending_amount.nullable().describe("Wallet pending balance after transfer"),balance_pending_to:E.shape.pending_amount_to.nullable().describe("Wallet pending_to balance after transfer"),balance_pending_from:E.shape.pending_amount_from.nullable().describe("Wallet pending_from balance after transfer"),balance_finished:E.shape.finished_amount.nullable().describe("Wallet finished balance after transfer"),signed_amount:E.shape.amount.nullable().describe("amount with a sign according to transfer direction"),status_finalized_at:E.shape.created_at.nullable().describe("DateTime transfer reached final status")}),Ne=o.object({transfer:ue.optional()}).describe("Output of getTransfer");var ne=fr.describe("Unique token filter"),cx=P.partial().required({id:!0}),fn=P.extend({belongs_to_foreign:Z.shape.foreign.describe("Wallet the token belongs to").nullable(),balance_transfer_id:E.shape.transfer_id.nullable().describe("Latest transfer id"),balance_pending_amount:E.shape.pending_amount.nullable().describe("Current pending balance"),balance_pending_amount_to:E.shape.pending_amount_to.nullable().describe("Sum of incoming pending transfers"),balance_pending_amount_from:E.shape.pending_amount_from.nullable().describe("Sum of outgoing pending transfers"),balance_finished_amount:E.shape.finished_amount.nullable().describe("Current finished balance"),balance_amount:o.number().nullable().describe("Current finished and pending balance sum"),balance_available_balance:E.shape.available_balance.nullable().describe("Available balance that is sum of pending_amount_from and finished_amount"),balance_latest_control_hash:E.shape.latest_control_hash.nullable().describe("Latest control_hash associated with wallet token combination"),balance_updated_at:E.shape.created_at.nullable().describe('"Last modification date of balance')}),Ri=fn.keyof(),Sa=x.extend({ignore_cache:o.boolean().describe("Ignore cached information"),create_if_not_exists:o.boolean().default(!1).describe("If true then the token will be created if not found. Only valid with 'foreign'"),return_only_id:o.boolean().default(!1).describe("If true then the returning object is only guaranteed to have id"),include_balance:o.boolean().default(!1).describe("Return the total system balance of token")}).partial(),mn=o.object({token:ne,options:Sa.optional()}).strict().required({token:!0}).describe("Input for getToken"),Ai=fn.partial().required({id:!0}),hn=o.object({token:Ai.optional()}).describe("Output of getToken");var ge=nn.describe("Unique transferGroup filter"),Mi=x.extend({create_if_not_exists:o.boolean().default(!1).describe("If true then the transfer_group will be created if not found. Only valid with 'identifier'"),return_only_id:o.boolean().default(!1).describe("If true then the returning object is only guaranteed to have id")}).partial(),Tn=o.object({transfer_group:ge,options:Mi.optional()}).strict().required({transfer_group:!0}).describe("Input for getTransferGroup"),Oa=D.extend({reverses_identifier:D.shape.identifier.nullable().describe("Identifier of the transfer group this reverses")}).partial().required({id:!0}).describe("requested transfer_group"),gn=o.object({transfer_group:Oa.optional()}).describe("Output of getTransferGroup");var Ei=o.object({return_running_balance_for_wallet:H.describe("Return running balance for each transfer for wallet in question"),return_signed_amount_for_wallet:H.describe("Return amount as signed value for each transfer for wallet in question")}),Fa=x.merge(le).merge(Oe).merge(Ei).extend({order:Fe.extend({field:h.keyof()}).array(),select:ue.keyof().array(),deselect:ue.keyof().array()}).partial(),Gi=o.object({id:Te.describe("Transfer id"),identifier:Ze.describe("Transfer identifier"),from_wallet:H,to_wallet:H,wallet:H,token:ne,type:Ce,status:z,transfer_group:ge,reverses:nt,metadata:Q,amount:dr.describe("Transfer amount")}).partial(),Re=Gi.merge(h.pick({created_at:!0,updated_at:!0,status_finalized_at:!0})).extend({from_wallet_id:Te.describe("Debited Wallet id"),to_wallet_id:Te.describe("Credited Wallet id"),token_id:Te.describe("Transferred Token id"),transfer_group_id:Te.describe("TransferGroup id the transfer is a part of"),reverses_id:Te.describe("Reversed Transfer id")}).partial(),rf=Je(Gi,Re),Zt=o.union([Gi,rf.array()]),mr=o.object({transfer:Zt,options:Fa.optional()}).strict().partial().describe("Input for findTransferMany"),xn=o.object({transfers:Wu.partial().array().describe("Found transfers"),metadata:Ge}).partial().required({transfers:!0,metadata:!0}).describe("Output of findTransferMany");var af=o.object({return_all_intervals:Qe.describe("Add empty values for each interval if no matching data")}).partial(),Ci=x.merge(af).partial().optional(),Wi=o.enum(["from.amount","to.amount","amount","abs.amount","transfer_group","from_wallet","to_wallet","wallet","token","id"]).describe("Field to aggregate"),nf=Ii.extend({field:Wi}).partial(),of=o.union([nf,on]),Ni=o.enum(["type","status","from_wallet","to_wallet","wallet","token","transfer_group"]).describe("Field to group by"),sf=o.union([ga,xa.extend({field:Ni}),ya]),yn=o.object({transfer:Zt,aggregators:of.array(),groups:sf.array(),options:Ci}).partial().required({aggregators:!0}).describe("Input for aggregateTransferMany"),bn=o.object({rows:sn,metadata:ku}).describe("Output of getToken");var pf=x.partial(),Sn=o.object({options:pf}).strict().partial().describe('Input for authenticationCheck"'),Nu=o.object({}).describe("Output of authenticationCheck");var uf=o.object({wallet_foreign:Z.shape.foreign,from_wallet_foreign:Z.shape.foreign,to_wallet_foreign:Z.shape.foreign,token_foreign:P.shape.foreign}).partial().describe("Forced filters for requests"),Di=o.enum(["aggregateTransferMany","exportBalanceHistory","exportTokenMany","exportTransferGroupMany","exportTransferMany","exportWalletMany","findBalanceMany","findTokenMany","findTransferGroupMany","findTransferMany","findWalletMany","getBalance","getBalanceHistory","getExport","getStatistics","getToken","getTokenMany","getTransfer","getTransferGroup","getWallet","getWalletMany","healthcheck","listExportMany"]).describe("Allowed methods"),Bi=o.object({type:o.enum(["limited"]).describe("Type of the accessToken"),scopes:Di.array(),expiresIn:o.number().int().positive().describe("JWT expiration time in minutes"),filters:uf.optional()}).strict(),ji=o.object({type:o.enum(["admin"]).describe("Type of the accessToken"),expiresIn:o.number().int().positive().describe("JWT expiration time in minutes")}).strict(),Pi=x.partial(),On=o.object({token:o.union([Bi,ji]),options:Pi}).strict().partial().required({token:!0}).describe("Input for createAccessToken"),Fn=o.object({authToken:o.string().describe("The JWT token")}).describe("Output of createAccessToken");var Ia=o.object({wallet:H,token:ne,datetime:M.describe("Time the balance should be retrieved at").optional()}).strict(),Vi=x.extend({ignore_cache:o.boolean().describe("Ignore cached information"),create_wallet_if_not_exists:o.boolean().default(!1).describe("If true then the missing wallet will be created if not found. Only valid with 'foreign'"),create_token_if_not_exists:o.boolean().default(!1).describe("If true then the missing token will be created if not found. Only valid with 'foreign'"),create_if_not_exists:o.boolean().default(!1).describe("If true then the missing balance will be created if not found.")}).partial(),In=o.object({balance:Ia,options:Vi}).partial().strict().required({balance:!0}).describe("Input for getBalance"),Ut=E.pick({transfer_id:!0,token_id:!0,wallet_id:!0,pending_amount:!0,pending_amount_from:!0,pending_amount_to:!0,available_balance:!0,finished_amount:!0,latest_control_hash:!0}).extend({token_foreign:P.shape.foreign,wallet_foreign:Z.shape.foreign,amount:o.number().describe("Current finished and pending balance sum"),updated_at:E.shape.created_at}).strict().partial().required({token_id:!0,token_foreign:!0,wallet_id:!0,wallet_foreign:!0,pending_amount:!0,finished_amount:!0,amount:!0,latest_control_hash:!0,updated_at:!0}),Ye=o.object({balance:Ut.optional()}).strict().describe("Output of getBalance");var gt=o.object({identifier:h.shape.identifier,latest_control_hash:h.shape.control_hash.nullable().describe("Latest control_hash on the from_wallet"),from_wallet:H.describe("Wallet where funds are debited"),to_wallet:H.describe("Wallet where funds are credited"),token:ne.describe("Token that is moved"),amount:h.shape.amount,type:h.shape.type,status:pe,force:h.shape.force,metadata:h.shape.metadata,transfer_group:ge.describe("TransferGroup the transfer belongs to"),created_at:h.shape.created_at}).strict(),_n=gt.extend({type:o.literal("transfer").default("transfer").describe("Type of transfer")}).partial().strict().required({from_wallet:!0,to_wallet:!0,token:!0,amount:!0}),hr=gt.partial().extend({type:o.literal("deposit").describe("Type of transfer")}).strict().required({to_wallet:!0,token:!0,amount:!0}),Tr=gt.partial().extend({type:o.literal("withdrawal").describe("Type of transfer")}).strict().required({from_wallet:!0,token:!0,amount:!0}),Zi=o.union([_n,hr,Tr]).pipe(o.union([_n,hr,Tr])),ot=x.extend({return_from_balance:o.boolean().default(!1).describe("Whether the request should also return from wallet balance"),return_to_balance:o.boolean().default(!1).describe("Whether the request should also return to wallet balance"),create_to_wallet_if_not_exists:o.boolean().default(!1).describe("If true then the wallet will be created if not found. Only valid with 'foreign'")}).partial().optional(),vn=o.object({transfer:Zi,options:ot}).strict().required({transfer:!0}).describe("Input for createTransfer"),xt=o.object({transfer:Ne.shape.transfer.describe("Created transfer object"),from_balance:Ye.shape.balance.describe("Debited wallet balance"),to_balance:Ye.shape.balance.describe("Credited wallet balance")}).partial().strict().required({transfer:!0}).describe("Output of createTransfer");var cf=_n.omit({status:!0,transfer_group:!0}).strip(),lf=hr.omit({status:!0,transfer_group:!0}).strip(),df=Tr.omit({status:!0,transfer_group:!0}).strip(),ff=o.union([cf,lf,df]),Ui=o.object({identifier:D.shape.identifier,status:We,transfer_status:z,metadata:D.shape.metadata,children:ff.array().describe("Array of children")}).partial(),Li=x.extend({create_to_wallet_if_not_exists:o.boolean().default(!1).describe("If true then the wallet will be created if not found. Only valid with 'foreign'"),validate_final_balance_only:o.boolean().default(!1).describe("If true then transfers within a group will ignore balance restrictions. Only final transfers for wallets are checked. Only valid with transfer_status_lock")}).partial().optional(),kn=o.object({transfer_group:Ui,options:Li}).strict().partial().describe("Input for createTransferGroup"),yt=o.object({transfer_group:D,transfers:Ne.shape.transfer.array().describe("Created transfer objects")}).describe("Output of createTransferGroup");var qi=x.extend({return_all_intervals:Qe.describe("Add empty values for each interval if no matching data")}).partial().optional(),mf=o.object({from_wallet:H.describe("Wallet the contract will belong to at the end (buyer)"),from_latest_control_hash:h.shape.control_hash.nullable().describe("Latest control_hash on the from_wallet+from_token combo"),from_token:ne.describe("Token that is transferred from from_wallet in exchange of the contract"),to_wallet:H.describe("Wallet the payment for the contract is sent to (seller)"),amount:h.shape.amount,status:o.enum(["pending","finished"]).describe("The state at which the exchange is created"),force:h.shape.force,metadata:h.shape.metadata}).partial().strict().required({from_wallet:!0,from_token:!0,amount:!0}),hf=o.object({foreign:P.shape.foreign,metadata:P.shape.metadata,deposits:o.object({token:ne.describe("Token that is transferred"),amount:h.shape.amount}).array().nonempty(),owner:H.describe("The inital owner of the contract, defaults to foreign = 'house'").default({foreign:"house"})}).partial().required({foreign:!0,deposits:!0}),wn=o.object({token:hf,exchange:mf,options:qi}).strict().partial().required({token:!0}).describe("Input for createContract"),Rn=o.object({token:P,exchange:yt}).partial().required({token:!0}).describe("Output of createContract");var Tf=ot,An=o.object({deposit:hr.extend({type:o.literal("deposit").optional()}),options:Tf}).strict().required({deposit:!0}).describe("Input for createDeposit"),Mn=xt.describe("Output of createDeposit");var gf=o.object({wallet:H.describe("Wallet where funds are credited"),portion:o.union([o.string(),o.number()]).describe("Number specifying the portion of funds to be credited"),metadata:h.shape.metadata}).partial().required({wallet:!0}),xf=ne.describe("Wallets will receive funds based on their balance of this token"),yf=o.object({rule:Fi,target:o.object({wallet:H,metadata:h.shape.metadata}).strict().partial().required({wallet:!0})}).strict().partial().required({rule:!0}),bf=o.object({identifier:D.shape.identifier.describe("Unique identifier for this distribution"),latest_control_hash:h.shape.control_hash.nullable().describe("Latest control_hash on the from_wallet"),from_wallet:H.describe("Wallet where funds are debited"),token:ne.describe("Token that is moved"),amount:h.shape.amount,status:z,force:h.shape.force,metadata:h.shape.metadata,copy_wallet_metadata_fields:o.object({from_property:o.string(),to_property:o.string()}).partial().required({from_property:!0}).array().describe("Copy metadata information from Wallet metadata to transfer metadata"),transfer_group:ge.describe("TransferGroup the transfer belongs to"),targets:o.union([xf,gf.array().nonempty()]),leftover:yf}).partial().required({identifier:!0,from_wallet:!0,token:!0,amount:!0,targets:!0,leftover:!0}).describe("Distribute funds from one wallet between multiple wallets"),Sf=x.extend({dryrun:o.boolean().default(!1)}).partial().optional(),En=o.object({distribution:bf,options:Sf}).strict().partial().required({distribution:!0}).describe("Input for createDistribution"),Du=o.object({transfer_group:D,transfers:Ne.shape.transfer.array().describe("Created transfer objects")}).partial().required({transfer_group:!0,transfers:!0}).describe("Output of createDistribution");var $i=o.object({foreign:P.shape.foreign,public:P.shape.public,metadata:P.shape.metadata,divisor:P.shape.divisor,limit:P.shape.limit,type:ht,belongs_to:fr.describe("Wallet this token belongs_to")}).partial().required({foreign:!0}),zi=x.partial(),Gn=o.object({token:$i,options:zi.optional()}).strict().required({token:!0}).describe("Input for createToken"),Cn=o.object({token:P,wallet:Z}).describe("Output of createToken");var Hi=ot,Wn=o.object({transfers:Zi.array().nonempty().describe("An array of transfers"),options:Hi}).strict().required({transfers:!0}).describe("Input for createTransferMany"),Nn=o.object({transfers:Ne.shape.transfer.array().describe("Created transfer objects"),from_balances:Ye.shape.balance.array().describe("Debited wallet balances"),to_balances:Ye.shape.balance.array().describe("Credited wallet balances")}).partial().strict().required({transfers:!0}).describe("Output of createTransferMany");var Ki=o.object({foreign:Z.shape.foreign,name:Z.shape.name,metadata:Z.shape.metadata,type:mt,status:ft}).partial().required({foreign:!0}),Ji=x.partial(),Dn=o.object({wallet:Ki,options:Ji}).partial().strict().required({wallet:!0}).describe("Input for createWallet"),Bn=o.object({wallet:Z}).describe("Output of createWallet");var jn=o.object({withdrawal:Tr.extend({type:o.literal("withdrawal").optional()}),options:ot}).strict().required({withdrawal:!0}).describe("Input for createWithdrawal"),Pn=xt.describe("Output of createWithdrawal");var Qi=o.enum(["transfers","transfer_groups","tokens","wallets","balance_history","unknown"]).describe("Type of the export"),Of=o.enum(["started","completed","error"]).describe("Status of the export"),_a=o.object({identifier:o.string().describe("Unique identifier of the export"),status:Of,type:Qi,created_at:M.describe("Timestamp when export was initiated"),completed_at:M.describe("Timestamp when export was finished"),fields:o.string().array().describe("The fields selected for this export"),count:o.number().int().positive().describe("The number of entities exported in this file"),signed_url:o.string().describe("Signed URL for downloading the export file"),size:o.string().describe("Size of the exported file"),message:o.string().describe("Extra information about the state of the file")}).partial().required({identifier:!0}).describe("Information about exported file"),Yi=x.extend({return_signed_url:o.boolean().describe("Return signed url for downloading the export file, will only be returned if status === 'completed'")}).partial(),Vn=o.object({export:o.object({identifier:_a.shape.identifier}),options:Yi.optional()}).strict().required({export:!0}).describe("Input for getExport"),Ie=o.object({export:_a.optional()}).describe("Output of getExport");var Ff=o.object({create_wallet_if_not_exists:o.boolean().default(!1).describe("If true then the missing wallet will be created if not found. Only valid with 'foreign'"),create_token_if_not_exists:o.boolean().default(!1).describe("If true then the missing token will be created if not found. Only valid with 'foreign'")}),Bu=o.object({balance_id:E.shape.id.describe("The internal ID of the balance"),token_id:E.shape.token_id.describe("Token ID of balance"),token_foreign:P.shape.foreign.describe("Token Foreign of balance"),wallet_id:E.shape.wallet_id.describe("Wallet ID of balance"),wallet_foreign:Z.shape.foreign.describe("Wallet Foreign of balance"),pending_amount:E.shape.pending_amount.describe("Current pending balance"),pending_amount_to:E.shape.pending_amount_to.describe("Sum of incoming pending transfers"),pending_amount_from:E.shape.pending_amount_from.describe("Sum of outgoing pending transfers"),available_balance:E.shape.available_balance.describe("Available balance that is sum of pending_amount_from and finished_amount"),finished_amount:E.shape.finished_amount.describe("Current finished balance"),amount:o.number().describe("Current finished and pending balance sum"),status:o.enum(["pending","finished"]).describe("The status of the change to balance"),latest_control_hash:E.shape.latest_control_hash.describe("Latest control_hash associated with wallet token combination"),updated_at:E.shape.created_at.describe("Last modification date of balance"),transfer_id:h.shape.id,transfer_identifier:h.shape.identifier,transfer_control_hash:h.shape.control_hash,transfer_from_wallet_id:h.shape.from_wallet_id,transfer_from_wallet_foreign:Z.shape.foreign,transfer_to_wallet_id:h.shape.to_wallet_id,transfer_to_wallet_foreign:Z.shape.foreign,transfer_amount:h.shape.amount,transfer_type:Ce,transfer_status:z,transfer_force:h.shape.force,transfer_created_at:h.shape.created_at,transfer_updated_at:h.shape.updated_at,transfer_metadata:h.shape.metadata,transfer_transfer_group_id:h.shape.transfer_group_id,transfer_transfer_group_identifier:D.shape.identifier.optional().nullable().describe("Transfer Group identifier if transfer belongs to a group"),transfer_reverses_id:h.shape.reverses_id,transfer_reverses_identifier:h.shape.identifier.optional().nullable().describe("Reverses identifier if transfer reverses another transfer"),transfer_status_finalized_at:h.shape.status_finalized_at.nullable().describe("DateTime transfer reached final status")}).strict().partial(),Xi=o.object({order:o.enum(["asc","desc"])}).describe("Ordering options"),If=Bu.keyof(),es=o.object({select:If.array()}).describe("Optional flags to limit search result"),ts=x.merge(le).merge(Oe).merge(Ff).merge(Xi).merge(es).extend({return_all_intervals:Qe.describe("Add empty values for each interval if no matching data")}).partial(),Zn=o.object({balance:Ia,options:ts.optional()}).strict().required({balance:!0}).describe("Input for getBalanceHistory"),Un=o.object({balances:Bu.array().describe("Resolved balance change objects"),metadata:Ge}).required({balances:!0}).describe("Output of getBalanceHistory");var rs=x.merge(le).merge(Oe).merge(es).merge(Xi).partial(),Ln=o.object({balance:Ia,options:rs}).strict().partial().required({balance:!0}).describe("Input for exportBalanceHistory"),qn=o.object({export:Ie.shape.export}).describe("Output of exportBalanceHistory");var va=x.merge(le).merge(Oe).extend({include_balance:o.boolean().describe("Return the total system balance of token"),order:Fe.extend({field:P.keyof()}).array(),select:Ri.array(),deselect:Ri.array()}).partial(),as=o.object({foreign:Ze.describe("foreign identifier"),type:ht,metadata:Q,belongs_to:H}).partial(),ka=as.merge(P.pick({public:!0,status:!0,created_at:!0,updated_at:!0})).extend({id:Te.describe("id of the Token")}).partial(),_f=Je(as,ka),vf=o.union([as,_f.array()]),gr=o.object({token:vf,options:va.optional()}).strict().partial().describe("Input for findTokenMany"),$n=o.object({tokens:fn.partial().array().describe("Found tokens"),metadata:Ge}).partial().required({tokens:!0,metadata:!0}).describe("Output of findTokenMany");var ns=va,zn=gr.extend({options:ns.optional()}).describe("Input of exportTokenMany"),Hn=Ie.describe("Output of exportTokenMany");var os=Oa.extend({transfers_count:o.number().describe("Number of transfers in the group").optional()}),wa=x.merge(le).merge(Oe).extend({return_transfers_count:o.boolean().default(!1).describe("Return number of transfers in the transfer_group"),order:Fe.extend({field:D.keyof()}).array(),select:os.keyof().array(),deselect:os.keyof().array()}).partial(),is=o.object({identifier:Ze.describe("TransferGroup identifier"),status:We,type:Tt,transfer_status:z,reverses:ge,metadata:Q}).partial(),Lt=is.merge(D.pick({status_finalized_at:!0,transfer_status_finalized_at:!0,created_at:!0,updated_at:!0})).extend({id:Te.describe("TransferGroup id"),transfer_group_id:Te.describe("Parent TransferGroup id"),reverses_id:Te.describe("Reversed TransferGroup id")}).partial(),kf=Je(is,Lt),Ra=o.union([is,kf.array()]),xr=o.object({transfer_group:Ra,options:wa}).strict().partial().describe("Input for findTransferGroup"),Kn=o.object({transfer_groups:os.partial().array().describe("Found transfers"),metadata:Ge}).partial().required({transfer_groups:!0,metadata:!0}).describe("Output of findTransferGroup");var wf=wa,Jn=xr.extend({options:wf.optional()}).partial().describe("Input of exportTransferGroupManyMany"),Qn=Ie.describe("Output of exportTransferGroupMany");var Rf=Fa.omit({return_running_balance_for_wallet:!0,return_signed_amount_for_wallet:!0}),Yn=mr.extend({options:Rf.optional()}).describe("Input of exportTransferMany"),Xn=Ie.describe("Output of exportTransferMany");var Aa=x.merge(le).merge(Oe).extend({include_balance_for_token:ne.describe("If specified each wallet will have its balance included"),order:Fe.extend({field:un}).array(),select:un.array(),deselect:un.array()}).partial(),ss=o.object({foreign:Ze.describe("Wallet foreign"),name:o.string(),type:mt,status:ft,metadata:Q}).partial(),Ma=ss.merge(Z.pick({created_at:!0,updated_at:!0})).extend({id:Te.describe("Wallet id"),balance_pending_amount:o.number().nullable(),balance_finished_amount:o.number().nullable(),balance_available_balance:o.number().nullable()}).partial(),Af=Je(ss,Ma),Mf=o.union([ss,Af.array()]),yr=o.object({wallet:Mf,options:Aa}).strict().partial().describe("Input for findWalletMany"),eo=o.object({wallets:vi.partial().nullable().array().describe("Found wallets"),metadata:Ge}).partial().required({wallets:!0,metadata:!0}).describe("Output of findWalletMany");var Ef=Aa,to=yr.extend({options:Ef.optional()}).describe("Input of exportWalletMany"),ro=Ie.describe("Output of exportWalletMany");var ju=Ut.keyof(),ps=x.merge(le).merge(Oe).extend({order:Fe.extend({field:E.keyof()}).array(),select:ju.array(),deselect:ju.array()}).partial(),us=o.object({wallet:H,token:ne,transfer:nt,type:Ce,status:z,amount:dr.describe("Balance amount"),pending_amount:dr.describe("Balance pending_amount"),finished_amount:dr.describe("Balance finished_amount"),metadata:Q}).partial(),cs=us.extend({updated_at:E.shape.created_at}).partial(),Gf=Je(us,cs),Cf=o.union([us,Gf.array()]),ao=o.object({balance:Cf,options:ps.optional()}).strict().partial().describe("Input for findBalanceMany"),no=o.object({balances:Ut.partial().array().describe("Found balances"),metadata:Ge}).partial().required({balances:!0,metadata:!0}).describe("Output of findBalanceMany");var Wf=x.partial().required({transaction_id:!0}),oo=o.object({action:o.enum(["commit","rollback"]).default("commit").describe("Finish transaction with commit/rollback"),options:Wf}).strict().required({action:!0,options:!0}).describe("Input for finishTransaction"),Pu=o.object({success:o.boolean(),message:o.string().optional().describe("Error message when success is false")}).describe("Output of finishTransaction");var ls=x.partial(),io=o.object({options:ls.optional()}).strict().describe("Input for getFlags"),so=o.object({flags:at}).describe("Output of getFlags");var ds=o.enum(["Transfer","TransferGroup","Wallet","Token"]).default("Transfer").describe("Model to return statistics about"),Nf=Qe.extend({status:z}).strict().partial().describe("Filter to apply to transfers before grouping"),Df=o.enum(["type","status","transfer_status"]).default("type").describe("Field to group statistics about. Only used with group_by_field type"),Bf=xa.extend({field:Df}),jf=o.union([ga,ya,Bf]),fs=Oi.partial(),po=o.object({model:ds,groups:jf.array().max(5).describe("Array of grouping definitions"),aggregator:_i,filter:Nf,options:fs}).strict().partial().describe("Input for getStatistics"),Vu=o.object({rows:sn}).describe("Output of getStatistics");var Pf=Sa,uo=o.object({tokens:ne.array(),options:Pf.optional()}).strict().required({tokens:!0}).describe("Input for getTokenMany"),Zu=o.object({tokens:Ai.nullable().array()}).required({tokens:!0}).describe("Output of getTokenMany");var Vf=ba,co=o.object({wallets:H.array(),options:Vf.optional()}).strict().required({wallets:!0}).describe("Input for getWalletMany"),Uu=o.object({wallets:ki.nullable().array()}).required({wallets:!0}).describe("Output of getWalletMany");var ms=x.partial(),lo=o.object({options:ms}).strict().partial().describe("Input for healthcheck"),fo=o.object({status:o.enum(["green","yellow","red"]).describe("Status of the service"),message:o.string().describe("Error message if some error occurred"),database_size:o.string().describe("Size of the database in MB"),indexes_size:o.string().describe("Size of all indexes of database in MB"),connection_count:o.number().describe("Number of external connections to this database"),version:o.string().describe("Version the server is running")}).partial().required({status:!0}).describe("Output of healthcheck");var Zf=x.partial(),Uf=o.object({target:o.literal("wallet"),data:Ki}),Lf=o.object({target:o.literal("token"),data:$i}),qf=Ui.extend({created_at:M.optional(),status_finalized_at:M.optional(),transfer_status_finalized_at:M.optional()}),$f=o.object({target:o.literal("transfer_group"),data:qf}),hs=o.object({identifier:h.shape.identifier,from_wallet:H,to_wallet:H,token:ne,amount:h.shape.amount,metadata:h.shape.metadata,status:z,transfer_group:ge,created_at:M,status_finalized_at:M}),zf=hs.extend({type:o.literal("regular")}).partial().required({from_wallet:!0,to_wallet:!0,token:!0,amount:!0,type:!0}),Hf=hs.extend({type:o.literal("deposit")}).partial().required({to_wallet:!0,token:!0,amount:!0,type:!0}),Kf=hs.extend({type:o.literal("withdrawal")}).partial().required({from_wallet:!0,token:!0,amount:!0,type:!0}),Jf=o.union([zf,Hf,Kf]),Qf=o.object({target:o.literal("transfer"),data:Jf}),Yf=o.union([Uf,Lf,$f,Qf]),br=o.object({actions:Yf.array().describe("Array of actions to import."),options:Zf}).partial().required({actions:!0}).describe("Input for importActions"),Lu=o.object({progress:o.unknown().array(),erroneous:o.unknown().array()}).partial().describe("Output of importActions");var Xf=o.object({order:Fe.extend({field:o.enum(["identifier","completed_at","created_at"])}).array()}),Ts=x.merge(le).merge(Xf).partial(),mo=o.object({export:o.object({date:M.describe("Date the file was created on"),type:_a.shape.type.describe("Entity that was exported")}).partial(),options:Ts}).partial().describe("Input for listExportMany"),ho=o.object({exports:_a.array()}).describe("Output of listExportMany");var em=x.extend({exact_level:o.boolean().describe("Should query be limited to exactly defined level or greater than")}).partial(),To=o.object({startTime:M.describe("Log entries start time"),endTime:M.describe("Log entries end time"),tracking_id:o.string(),level:o.enum(["debug","info","warning","error"]),options:em}).partial().describe("Input for queryLogs"),tm=o.object({level:o.enum(["debug","info","warning","error"]),timestamp:o.string(),payload:o.record(o.string(),o.unknown())}),qu=o.object({logs:tm.array()}).required({logs:!0}).describe("Output of queryLogs");var rm=x.partial(),go=o.object({confirmation:o.string().describe("hash to confirm database delete"),version:o.string().describe("target semver for the database"),options:rm}).strict().partial().describe("Input for resetDatabase"),$u=o.object({message:o.string().describe("Message about operation"),confirmation:o.string().describe("confirmation hash to resend")}).partial().describe("Output of resetDatabase");var qt=h.pick({metadata:!0,status:!0,updated_at:!0}).extend({extend_metadata:h.shape.metadata}).partial().refine(r=>Object.values(r).some(e=>e!==void 0),{message:"One of the fields must be defined"}),gs=x.extend({return_from_balance:o.boolean().default(!1).describe("Whether the request should also return from wallet balance"),return_to_balance:o.boolean().default(!1).describe("Whether the request should also return to wallet balance"),return_when_not_updated:o.boolean().default(!1).describe("Whether the request should return the transfer object even if it was not updated"),metadata_action:jt}).partial(),xo=o.object({transfer:nt,update:qt,options:gs.optional()}).strict().describe("Input for updateTransfer"),Sr=o.object({transfer:ue.describe("Updated transfer object"),updated:o.boolean().describe("Boolean showing if the transfer was updated"),from_balance:Ut.describe("Debited wallet balance"),to_balance:Ut.describe("Credited wallet balance")}).partial().describe("Output of updateTransfer");var am=o.object({reverse_deposit:o.boolean().default(!1).describe("Whether to create withdrawal transaction for deposit (will default to pending)"),reverse_withdrawal:o.boolean().default(!1).describe("Whether to create deposit transaction for withdrawal (will default to pending)"),return_from_balance:o.boolean().default(!1).describe("Whether the request should also return from wallet balance"),return_to_balance:o.boolean().default(!1).describe("Whether the request should also return to wallet balance"),metadata_action:Pt}),xs=o.object({status:pe,identifier:gt.shape.identifier,force:gt.shape.force,metadata:gt.shape.metadata,extend_metadata:gt.shape.metadata}).strict().partial().describe("In case the transfer will be made then apply these modifications"),ys=x.merge(am).partial(),yo=o.object({transfer:nt,reverse:xs,options:ys}).partial().required({transfer:!0}).describe("Input for reverseTransfer"),bo=Sr.describe("Output of reverseTransfer");var nm=o.object({reverse_deposit:o.boolean().default(!1).describe("Whether to create withdrawal transaction for deposits (will default to pending)"),reverse_withdrawal:o.boolean().default(!1).describe("Whether to create deposit transaction for withdrawals (will default to pending)"),return_transfers:o.boolean().describe("Should the update return all transfers belonging to group"),validate_final_balance_only:o.boolean().default(!1).describe("If true then transfers within a group will ignore balance restrictions. Only final transfers for wallets are checked."),metadata_action:Pt,transfer_metadata_action:Pt}).strict().partial(),Ea=x.merge(nm).partial(),bs=o.object({status:We,transfer_status:pe,identifier:D.shape.identifier,force:h.shape.force,metadata:D.shape.metadata,transfer_metadata:h.shape.metadata,extend_metadata:D.shape.metadata.describe("Key value object to be merged with existing metadata"),transfer_extend_metadata:h.shape.metadata.describe("Key value object to be merged with each transfers existing metadata")}).strict().partial().describe("In case the transferGroup will be made then apply these modifications"),So=o.object({transfer_group:ge,reverse:bs,options:Ea}).partial().required({transfer_group:!0}).describe("Input for reverseTranferGroup"),Oo=o.object({transfer_group:D,transfers:ue.array().describe("Updated transfers")}).partial().describe("Output of reverseTranferGroup");var om=bs.omit({identifier:!0}),Fo=o.object({transfer_group:Ra,reverse:om,options:Ea}).strict().partial().required({transfer_group:!0}).describe("Input for reverseTranferGroupMany"),zu=o.object({transfer_groups:D.array().describe("Reversed transfer groups"),transfers:ue.array().describe("Created transfer objects")}).describe("Output of reverseTranferGroupMany");var Ss=o.object({status:pe,force:h.shape.force,metadata:h.shape.metadata}).partial(),Os=x.extend({reverse_deposit:o.boolean().describe("Whether to create withdrawal transaction for deposit (will default to pending)"),reverse_withdrawal:o.boolean().describe("Whether to create deposit transaction for withdrawal (will default to pending)"),metadata_action:Pt}).partial(),Io=o.object({transfer:Zt,reverse:Ss,options:Os}).strict().partial().required({transfer:!0}).describe("Input for reverseTranferMany"),_o=o.object({transfers:ue.array().describe("Created transfer array")}).describe("Output of reverseTranferMany");var Fs=x.partial(),vo=o.object({flags:at.partial(),options:Fs}).strict().partial().required({flags:!0}).describe("Input for setFlags"),ko=o.object({flags:at,message:o.string().describe("optional message")}).strict().partial().required({flags:!0}).describe("Output of setFlags");var im=x.partial(),wo=o.object({options:im}).strict().partial().describe("Input for startTransaction"),Hu=o.object({transaction_id:o.string().describe("id of the created transaction")}).partial().describe("Output of startTransaction");var Is=x.partial().extend({return_when_not_updated:o.boolean().default(!1).describe("Whether the request should return the token object even if it was not updated")}),Ku=P.pick({metadata:!0,status:!0,public:!0}).partial(),EO=Ku.keyof(),Ro=o.object({token:ne,update:Ku,options:Is.optional()}).strict().describe("Input for updateToken"),Ao=o.object({token:P,updated:o.boolean().describe("Boolean showing if the token was updated")}).partial().describe("Output of updateToken");var _s=o.object({status:We.describe("Lifecycle status of the TransferGroup"),transfer_status:z.describe("Status all the transfers should be set at."),metadata:D.shape.metadata.describe("Key value object to be replaced or extended with existing TransferGroup metadata"),transfer_metadata:h.shape.metadata.describe("Key value object to be replaced or extended with existing Transfer metadata")}).partial().describe("Changes to be made to the transfer_group"),$t=_s.refine(r=>Object.values(r).some(e=>e!==void 0),{message:"One of the fields must be defined"}),PO=_s.keyof(),Ga=x.extend({return_transfers:o.boolean().describe("Should the update return all transfers belonging to group"),return_when_not_updated:o.boolean().default(!1).describe("Whether the request should return the transfer_group object even if it was not updated"),metadata_action:jt,transfer_metadata_action:jt}).partial(),Mo=o.object({transfer_group:ge,update:$t,options:Ga.optional()}).strict().describe("Input for updateTransferGroup"),Eo=o.object({transfer_group:D,updated:o.boolean().describe("Boolean showing if the transfer_group was updated"),transfers:ue.array().describe("Updated transfers")}).partial().describe("Output of updateTransferGroup");var vs=Ga,Go=o.object({transfer_group:Ra,update:$t,options:vs}).strict().partial().required({transfer_group:!0,update:!0}).describe("Input for updateTransferGroupMany"),Co=o.object({transfer_groups:Oa.array().describe("Updated transfer groups"),transfers:ue.array().describe("Updated transfers"),updated:o.boolean().describe("Boolean showing if the transfer_group were updated")}).describe("Output of updateTransferGroupMany");var ks=x.extend({metadata_action:jt}).partial(),Wo=o.object({transfer:Zt,update:qt,options:ks}).strict().partial().required({transfer:!0,update:!0}).describe("Input for updateTransferMany"),No=o.object({transfers:ue.array().describe("Updated transfers"),updated:o.boolean().describe("Boolean showing if the transfers were updated")}).describe("Output of updateTransferMany");var ws=x.extend({return_when_not_updated:o.boolean().default(!1).describe("Whether the request should return the wallet object even if it was not updated")}).partial(),Ju=Z.pick({metadata:!0,status:!0,name:!0}),nF=Ju.keyof(),Do=o.object({wallet:H,update:Ju.partial(),options:ws.optional()}).strict().describe("Input for updateWallet"),Bo=o.object({wallet:Z,updated:o.boolean().describe("Boolean showing if the wallet was updated")}).partial().describe("Output of updateWallet");var Rs={aggregateTransferMany:p(yn).validateInputWOptions,authenticationCheck:p(Sn).validateInputWOptions,createAccessToken:p(On).validateInputWOptions,createContract:p(wn).validateInputWOptions,createDeposit:p(An).validateInputWOptions,createDistribution:p(En).validateInputWOptions,createToken:p(Gn).validateInputWOptions,createTransfer:p(vn).validateInputWOptions,createTransferGroup:p(kn).validateInputWOptions,createTransferMany:p(Wn).validateInputWOptions,createWallet:p(Dn).validateInputWOptions,createWithdrawal:p(jn).validateInputWOptions,exportBalanceHistory:p(Ln).validateInputWOptions,exportTokenMany:p(zn).validateInputWOptions,exportTransferGroupMany:p(Jn).validateInputWOptions,exportTransferMany:p(Yn).validateInputWOptions,exportWalletMany:p(to).validateInputWOptions,findBalanceMany:p(ao).validateInputWOptions,findTokenMany:p(gr).validateInputWOptions,findTransferGroupMany:p(xr).validateInputWOptions,findTransferMany:p(mr).validateInputWOptions,findWalletMany:p(yr).validateInputWOptions,finishTransaction:p(oo).validateInputWOptions,getBalance:p(In).validateInputWOptions,getBalanceHistory:p(Zn).validateInputWOptions,getExport:p(Vn).validateInputWOptions,getFlags:p(io).validateInputWOptions,getStatistics:p(po).validateInputWOptions,getToken:p(mn).validateInputWOptions,getTokenMany:p(uo).validateInputWOptions,getTransfer:p(dn).validateInputWOptions,getTransferGroup:p(Tn).validateInputWOptions,getWallet:p(pn).validateInputWOptions,getWalletMany:p(co).validateInputWOptions,healthcheck:p(lo).validateInputWOptions,importActions:p(br).validateInputWOptions,listExportMany:p(mo).validateInputWOptions,queryLogs:p(To).validateInputWOptions,resetDatabase:p(go).validateInputWOptions,reverseTransfer:p(yo).validateInputWOptions,reverseTransferGroup:p(So).validateInputWOptions,reverseTransferGroupMany:p(Fo).validateInputWOptions,reverseTransferMany:p(Io).validateInputWOptions,setFlags:p(vo).validateInputWOptions,startTransaction:p(wo).validateInputWOptions,updateToken:p(Ro).validateInputWOptions,updateTransfer:p(xo).validateInputWOptions,updateTransferGroup:p(Mo).validateInputWOptions,updateTransferGroupMany:p(Go).validateInputWOptions,updateTransferMany:p(Wo).validateInputWOptions,updateWallet:p(Do).validateInputWOptions},As=(v=>(v.aggregateTransferMany="aggregateTransferMany",v.authenticationCheck="authenticationCheck",v.createAccessToken="createAccessToken",v.createContract="createContract",v.createDeposit="createDeposit",v.createDistribution="createDistribution",v.createToken="createToken",v.createTransfer="createTransfer",v.createTransferGroup="createTransferGroup",v.createTransferMany="createTransferMany",v.createWallet="createWallet",v.createWithdrawal="createWithdrawal",v.exportBalanceHistory="exportBalanceHistory",v.exportTokenMany="exportTokenMany",v.exportTransferGroupMany="exportTransferGroupMany",v.exportTransferMany="exportTransferMany",v.exportWalletMany="exportWalletMany",v.findBalanceMany="findBalanceMany",v.findTokenMany="findTokenMany",v.findTransferGroupMany="findTransferGroupMany",v.findTransferMany="findTransferMany",v.findWalletMany="findWalletMany",v.finishTransaction="finishTransaction",v.getBalance="getBalance",v.getBalanceHistory="getBalanceHistory",v.getExport="getExport",v.getFlags="getFlags",v.getStatistics="getStatistics",v.getToken="getToken",v.getTokenMany="getTokenMany",v.getTransfer="getTransfer",v.getTransferGroup="getTransferGroup",v.getWallet="getWallet",v.getWalletMany="getWalletMany",v.healthcheck="healthcheck",v.importActions="importActions",v.listExportMany="listExportMany",v.queryLogs="queryLogs",v.resetDatabase="resetDatabase",v.reverseTransfer="reverseTransfer",v.reverseTransferGroup="reverseTransferGroup",v.reverseTransferGroupMany="reverseTransferGroupMany",v.reverseTransferMany="reverseTransferMany",v.setFlags="setFlags",v.startTransaction="startTransaction",v.updateToken="updateToken",v.updateTransfer="updateTransfer",v.updateTransferGroup="updateTransferGroup",v.updateTransferGroupMany="updateTransferGroupMany",v.updateTransferMany="updateTransferMany",v.updateWallet="updateWallet",v))(As||{});var sm=r=>{let{success:e}=br.safeParse(r);return e},Or=class{constructor(e,t,a){b(this,"type");b(this,"_connection");b(this,"$connect");b(this,"connectionType");b(this,"jwt","");b(this,"host","");b(this,"isConnected",!1);b(this,"socId");b(this,"hooks",new Proxy({},{set(e,t,a){if(typeof a!="function")throw new TypeError("Hooks can only be functions");return e[t]=a,!0}}));b(this,"_requests",new Map);b(this,"_error",!1);b(this,"_sending",new Map);b(this,"sendingTimeout");this.type=t,this._connection=e,this.connectionType=t,this.$connect=a}_setConnected(e){this.$connect=void 0,e&&this._error!==!1&&(this._error=!1),!this.isConnected&&e&&this.hooks.connected&&this.hooks.connected(this.socId),this.isConnected&&!e&&this.hooks.disconnected&&this.hooks.disconnected(),this.isConnected=e}_setErrored(e){this._error=e,this._setConnected(!1)}_clearError(){this._error=!1}_send(e){throw new Error("This method must be implemented by child class")}_reconnect(e){throw new Error("This method must be implemented by child class")}close(){return X(this,null,function*(){throw new Error("This method must be implemented by child class")})}_connectionLost(){this._requests.forEach((e,t)=>{"stream"in e&&e.stream.destroy(new Pe("CONNECTION_LOST",{method:"connectionLost"})),this._requests.delete(t)}),this.socId=void 0}_handleMessage(e){var u,l,d,T;if(this.hooks.message&&this.hooks.message(e),"method"in e){let _=e;if(_.method==="ping"){this._send({jsonrpc:"2.0",result:"pong",id:_.id});return}R("Unexpected JSONRPCRequest",e);return}let t=e;if(this.hooks.message&&this.hooks.message(t),t.id===null){R("Unexpected JSONRPCResponse",e);return}if(t.result==="ack"){clearTimeout((u=this._sending.get(t.id))==null?void 0:u.timeout),this._sending.delete(t.id);return}let a=this._requests.get(t.id);if(!a){R("No Request found for incoming",e);return}if("handle"in a){a.handle(t),delete a.handle;return}t.error&&"error"in a&&a.error(t.error);let n=t;if(((l=n.result)==null?void 0:l.type)==="streamPause"&&"pause"in a){a.pause();return}if(((d=n.result)==null?void 0:d.type)==="streamResume"&&"resume"in a){a.resume();return}let{stream:i,start:s}=a;if(((T=n.result)==null?void 0:T.type)==="streamChunk"){i.push(n.result);return}i.push(n),i.destroyed||i.push(null),n.id&&this._requests.delete(n.id),this.connectionType==="ws"&&this._send({jsonrpc:"2.0",method:"ack",params:Date.now()-s,id:n.id})}_sendTransaction(e,t){let a=Rs[e](t);return this._sendRaw(e,a)}_setSending(e,t){if(e.id===null)throw new Error("JSONRPCMessage should not be null");this._sending.set(e.id,c({},this.sendingTimeout&&{timeout:setTimeout(()=>{this._sending.delete(e.id),t.push({error:new _e("SENDING_TIMEOUT",{timeout:this.sendingTimeout}).toJSON()}),this._requests.delete(e.id)},this.sendingTimeout)}))}_sendRaw(e,t){let a={jsonrpc:"2.0",method:e,params:t,id:rr()};return this.hooks.preflight&&this.hooks.preflight(a)===!1?new pt:new pt(n=>X(this,null,function*(){if(this._error&&this._reconnect(5),this.isConnected||(yield this.$connect),this._error)throw this._error;this._requests.set(a.id,{stream:n,start:Date.now()}),this._setSending(a,n),this._send(a)}))}_streamTransaction(e,t,a,n){let i=Date.now(),s=rr(),u,l=({stream:B,method:ie,params:$})=>{if(u)return;let L={jsonrpc:"2.0",method:ie,params:c({streamId:s},$),id:rr()};this._setSending(L,B),this._send(L)},d=(B,ie)=>{u||(l({stream:B,method:"streamError",params:{error:ie}}),u=ie,B.push({error:ie}))},T=new Ha,_=n?T.pipe(n):T,j={jsonrpc:"2.0",method:"streamStart",params:{method:e,options:a},id:s};return this.hooks.preflight&&this.hooks.preflight(j)===!1?new ua:new ua(B=>X(this,null,function*(){if(this._error&&this._reconnect(5),this.isConnected||(yield this.$connect),this._error)throw this._error;let ie=setTimeout(()=>{B.push({error:new Pe("INPUT_STREAM_TIMEOUT",{streamId:s})})},3e4);this._requests.set(j.id,{stream:B,start:i,error($){u=$,R("stream:error()>",$)},pause(){T.pause()},resume(){T.resume()},handle($){if($.error){B.push($);return}_.on("data",L=>{if(!u){if(ie&&(clearTimeout(ie),ie=null),!t(L)){d(B,new Pe("INVALID_INPUT_STREAM_CHUNK",{streamId:s,chunk:L}));return}l({stream:B,method:"streamData",params:{data:L}})}}).on("error",L=>{u||(ie&&(clearTimeout(ie),ie=null),l({stream:B,method:"streamError",params:{error:L}}),B.push({error:new Pe("INPUT_STREAM_ERROR",{streamId:s,error:L})}))}).on("end",()=>{ie&&(clearTimeout(ie),ie=null),l({stream:B,method:"streamEnd",params:{}})})}}),this._setSending(j,B),this._send(j)}),T)}aggregateTransferMany(e){return this._sendTransaction("aggregateTransferMany",e)}authenticationCheck(e){return this._sendTransaction("authenticationCheck",e!=null?e:{})}createAccessToken(e){return this._sendTransaction("createAccessToken",e)}createContract(e){return this._sendTransaction("createContract",e)}createDeposit(e){return this._sendTransaction("createDeposit",e)}createDistribution(e){return this._sendTransaction("createDistribution",e)}createToken(e){return this._sendTransaction("createToken",e)}createTransfer(e){return this._sendTransaction("createTransfer",e)}createTransferGroup(e){return this._sendTransaction("createTransferGroup",e!=null?e:{})}createTransferMany(e){return this._sendTransaction("createTransferMany",e)}createWallet(e){return this._sendTransaction("createWallet",e)}createWithdrawal(e){return this._sendTransaction("createWithdrawal",e)}exportBalanceHistory(e){return this._sendTransaction("exportBalanceHistory",e)}exportTokenMany(e){return this._sendTransaction("exportTokenMany",e!=null?e:{})}exportTransferGroupMany(e){return this._sendTransaction("exportTransferGroupMany",e!=null?e:{})}exportTransferMany(e){return this._sendTransaction("exportTransferMany",e!=null?e:{})}exportWalletMany(e){return this._sendTransaction("exportWalletMany",e!=null?e:{})}findBalanceMany(e){return this._sendTransaction("findBalanceMany",e!=null?e:{})}findTokenMany(e){return this._sendTransaction("findTokenMany",e!=null?e:{})}findTransferGroupMany(e){return this._sendTransaction("findTransferGroupMany",e!=null?e:{})}findTransferMany(e){return this._sendTransaction("findTransferMany",e!=null?e:{})}findWalletMany(e){return this._sendTransaction("findWalletMany",e!=null?e:{})}finishTransaction(e){return this._sendTransaction("finishTransaction",e)}getBalance(e){return this._sendTransaction("getBalance",e)}getBalanceHistory(e){return this._sendTransaction("getBalanceHistory",e)}getExport(e){return this._sendTransaction("getExport",e)}getFlags(e){return this._sendTransaction("getFlags",e!=null?e:{})}getStatistics(e){return this._sendTransaction("getStatistics",e!=null?e:{})}getToken(e){return this._sendTransaction("getToken",e)}getTokenMany(e){return this._sendTransaction("getTokenMany",e)}getTransfer(e){return this._sendTransaction("getTransfer",e)}getTransferGroup(e){return this._sendTransaction("getTransferGroup",e)}getWallet(e){return this._sendTransaction("getWallet",e)}getWalletMany(e){return this._sendTransaction("getWalletMany",e)}healthcheck(e){return this._sendTransaction("healthcheck",e!=null?e:{})}importActions(e){return this._sendTransaction("importActions",e)}importActionsStream(e,t){return this._streamTransaction("importActions",sm,e,t)}listExportMany(e){return this._sendTransaction("listExportMany",e!=null?e:{})}queryLogs(e){return this._sendTransaction("queryLogs",e!=null?e:{})}resetDatabase(e){return this._sendTransaction("resetDatabase",e!=null?e:{})}reverseTransfer(e){return this._sendTransaction("reverseTransfer",e)}reverseTransferGroup(e){return this._sendTransaction("reverseTransferGroup",e)}reverseTransferGroupMany(e){return this._sendTransaction("reverseTransferGroupMany",e)}reverseTransferMany(e){return this._sendTransaction("reverseTransferMany",e)}setFlags(e){return this._sendTransaction("setFlags",e)}startTransaction(e){return this._sendTransaction("startTransaction",e!=null?e:{})}updateToken(e){return this._sendTransaction("updateToken",e)}updateTransfer(e){return this._sendTransaction("updateTransfer",e)}updateTransferGroup(e){return this._sendTransaction("updateTransferGroup",e)}updateTransferGroupMany(e){return this._sendTransaction("updateTransferGroupMany",e)}updateTransferMany(e){return this._sendTransaction("updateTransferMany",e)}updateWallet(e){return this._sendTransaction("updateWallet",e)}};function Es(r,e){let t=Qu(r,{timeout:e==null?void 0:e.connectingTimeout});return new Ms(t,r,e)}function Qu(r,e){var $;let t=c({rejectUnauthorized:($=r.rejectUnauthorized)!=null?$:!0,connectionName:e==null?void 0:e.connectionName,clientVersion:Ua},r),a=eu(t),n=new $p(...a),i,s,u=!1,l;n.onclose=d,n.onerror=T,n.onmessage=_;function d(L){if(R(`createConnection>close(reason:${L.reason},code:${L.code},wasClean:${L.wasClean})`),L.code===4030)return B(new tr);B(new Error("WS closed"))}function T(L){R(`createConnection>error(message:${L.message},error:${L.error},type:${L.type})`),B(L.error)}function _(L){R(`createConnection>message(type:${L.type},data:${L.data})`);let{data:Xt}=L,aa;try{aa=JSON.parse(Xt.toString())}catch(Yo){return R("Invalid JSON response",Yo),B(new Error("Invalid JSON response"))}if(aa.result!=="ready")return R("Invalid first message"),B(new Error("Invalid first message - "+JSON.stringify(aa)));B()}R(`createConnection>(message:setting up ws connection${e!=null&&e.timeout?" with timeout "+e.timeout:""})`);let j=e!=null&&e.timeout?setTimeout(()=>{B(new _e("CONNECTION_TIMEOUT",{timeout:e.timeout}))},e.timeout):void 0;function B(L){u||(clearTimeout(j),n.onmessage=()=>{},n.onerror=()=>{},n.onclose=()=>{},L?(s(L),n.close()):i(l),u=!0)}let ie=new Promise((L,Xt)=>{i=L,s=Xt});return{ws:n,$connect:ie}}var Ms=class extends Or{constructor(t,a,n){var i;super(t.ws,"ws",t.$connect);b(this,"_pingTimeout");b(this,"_opts");b(this,"_connectionConfig");b(this,"_tryToReconnect",!0);this._opts=a,this._connectionConfig=n,this.host=a.host,(i=this.$connect)==null||i.then(s=>(this.socId=s,this._ready())).catch(s=>{this.socId||this._setErrored(s)})}_setErrored(t){super._setErrored(t),(t instanceof tr||"code"in t&&t.code===te.AUTH.ERRORS.AUTHENTICATION_ERROR.code)&&(this._tryToReconnect=!1)}_ready(){this._setConnected(!0),this._connection.onmessage=t=>{let{data:a,type:n}=t;if(R(`message(type:${n},data:$0)`,a),n==="message"){let i=JSON.parse(a.toString());this._handleMessage(i),this._heartbeat()}},this._connection.onerror=t=>{let{message:a,error:n,type:i}=t;R(`error(message:$0,error:$1,type:${i})`,a,n)},this._connection.onclose=t=>{let{reason:a,code:n,wasClean:i}=t;R(`close(reason:$0,code:${n},wasClean:${i})`,a),this._setConnected(!1),clearTimeout(this._pingTimeout),this._connectionLost(),this._reconnect()},this._heartbeat()}_reconnect(t){if(R("reconnect(),tryToReconnect:",this._tryToReconnect),!this._tryToReconnect)return;if(this.hooks.reconnect&&this.hooks.reconnect()===!1){R("reconnect hook returned false");return}if(this.$connect){R("already connecting");return}super._clearError(),t!=null||(t=oa("WAPI_RECONNECT_ATTEMPTS",10));let a=oa("WAPI_MAX_RECONNECT_WAIT",1e4);this.$connect=X(this,null,function*(){var i,s,u;let n;for(let l=0;l<t+1;l++)try{R("Trying to connect, attempt:",l);let{ws:d,$connect:T}=Qu(this._opts,{timeout:(i=this._connectionConfig)==null?void 0:i.reconnectingTimeout});n=yield T,this.socId=n,this._connection=d,this._ready();break}catch(d){let T=d&&typeof d=="object"&&"code"in d&&d.code===te.AUTH.ERRORS.AUTHENTICATION_ERROR.code,_=l>t-1;if(T||_){this._setErrored(d),(u=(s=this.hooks).reconnectError)==null||u.call(s,d);break}yield Yp(Math.min(Math.pow(1.5,l)*1e3,a))}return n})}_heartbeat(){R("heartbeat"),clearTimeout(this._pingTimeout),this._pingTimeout=setTimeout(()=>{if(this._sending.size)return R("pingTimeout reached, but sending.size:",this._sending.size),this._heartbeat();R("timeout"),this._connection.close(),this._setConnected(!1),this._reconnect()},31e3)}_send(t){R("send()",t),this._connection.send(JSON.stringify(t))}close(){return X(this,null,function*(){return R("close()"),this._tryToReconnect=!1,clearTimeout(this._pingTimeout),this._setConnected(!1),this._connection.close()})}};var ec=ml(Yu(),1);var{fetch:Xu}=(0,ec.default)();function Ws(r,e){let t=pm(r,{timeout:e==null?void 0:e.connectingTimeout,skipInit:e==null?void 0:e.httpSkipInitialAuthConnection,connectionName:e==null?void 0:e.connectionName});return new Cs(t,r)}function pm(r,e){let t=r.host.replace(/^wss:/,"https:"),a="x-wapi-req-id",n="x-wapi-conn-name";function i(d){return X(this,null,function*(){R("http_createConnection>message(body:$0)",d)})}function s(d,T){return X(this,null,function*(){let _=JSON.parse(d),B=yield(yield Xu(`${t}/api`,{keepalive:!0,method:"POST",headers:c({Authorization:`Bearer ${T}`,"content-type":"application/json",[a]:_==null?void 0:_.id},e!=null&&e.connectionName?{[n]:e==null?void 0:e.connectionName}:{}),body:d})).json();this.onmessage(S(c({},B),{id:_.id}))})}let u=rr(),l=new Promise((d,T)=>{if(e!=null&&e.skipInit)return d(void 0);let _=new AbortController;R(`createConnection(sending http auth request${e!=null&&e.timeout?" with timeout "+e.timeout:""})`);let j=e!=null&&e.timeout?setTimeout(()=>{_.abort(),T(new _e("CONNECTION_TIMEOUT",{timeout:e.timeout}))},e.timeout):void 0;Xu(`${t}/api`,{method:"POST",headers:c({Authorization:`Bearer ${r.jwt}`,"content-type":"application/json",[a]:u},e!=null&&e.connectionName?{[n]:e==null?void 0:e.connectionName}:{}),body:JSON.stringify({jsonrpc:"2.0",method:"authenticationCheck",params:{},id:u}),signal:_.signal}).then(B=>B.json()).then(B=>{if(clearTimeout(j),B.error)throw new Error(B.error.message);d(void 0)}).catch(T)});return{send:s,onmessage:i,$connect:l}}var Cs=class extends Or{constructor(e,t){var a;super(e,"https",e.$connect),this.host=t.host,this.jwt=t.jwt,(a=this.$connect)==null||a.then(()=>{this._ready()}).catch(n=>{this._setErrored(n)})}_send(e){R("send()",e),this._connection.send(JSON.stringify(e),this.jwt)}_ready(){this._setConnected(!0),this._connection.onmessage=e=>X(this,null,function*(){R("http_message($0)>",e),this._handleMessage(e)})}close(){return X(this,null,function*(){R("close()"),this._setConnected(!1)})}_reconnect(){return X(this,null,function*(){R("reconnect()")})}};var xe=o.object({order_by:o.string().describe("Ordering options in string format")}).describe("extra find options for client functions"),jI=le.merge(_u).merge(xe).describe("extended find options for client functions"),Fr=o.union([o.number().positive(),o.string().regex(/^((0\.\d+)|([1-9]\d*(\.\d+){0,1}))$/,"invalid number")]),F=o.union([o.string(),o.number().int()]),Ns=o.union([o.string(),o.number()]),q=F.transform(r=>typeof r=="object"?r:{foreign:String(r)});var Ds=Ci.describe("Optional flags for input"),jo=o.object({wallet:q.describe("Foreign of the wallet connected to transfers"),token:q.describe("Foreign of the token transferred"),from_wallet:q.describe("Foreign of the wallet transfers are made from"),to_wallet:q.describe("Foreign of the wallet transfers are made to"),transfer_group:q.describe("Foreign of the transfer_group the transfers are a part of"),status:z.describe("Status of the transfers"),metadata:Q.describe("Metadata filter"),options:Ds}).partial().strict().describe("Input for aggregateTransfers"),tc=bn.describe("Output of aggregateTransfers");var rc=Y(yu.options);function Po(r,e){let{data:t,error:a}=r.safeParse(e);if(!a)return t;throw new J("INVALID_COMPLEX_FILTER",a.format(),a.message)}function Wa({function:r,field:e,operator:t,value:a}){if(Array.isArray(a))return{function:r,inner:a};if(typeof a=="object"&&t&&e&&"foreign"in a&&Object.keys(a).length===1)return{function:r,operator:t,field:e,value:a.foreign};if(typeof a=="object")return{function:r,value:a};if(t!=null||(t="="),!e)throw new TypeError("FIELD_IS_REQUIRED");return{function:r,field:e,operator:t,value:a}}var De=class r{constructor(e,t,a=[]){b(this,"$queries",[]);b(this,"$schemaBasic");b(this,"$schema");this.$queries=a!=null?a:[],this.$schemaBasic=e,this.$schema=t}toQuery(){return this.$queries.length===1&&"value"in this.$queries[0]&&typeof this.$queries[0].value=="object"&&!("field"in this.$queries[0])?this.$queries[0].value:this.$queries}toJSON(){return{filter:JSON.parse(JSON.stringify(this.toQuery()))}}add(e){return this.$queries.push(e),this}addWhere({fn:e,field:t,operator:a,value:n}){if(typeof t=="function"){let s=new r(this.$schemaBasic,this.$schema);if(t(s),!s||!(s instanceof r))throw new TypeError("Inner Builder must return QueryBuilderInner");return this.add(Wa({function:e,value:s.toQuery()}))}if(typeof t=="object"){let s=Po(this.$schemaBasic,t);return this.add(Wa({function:e,value:s}))}if(typeof t!="string")throw new TypeError("Field is required");let i=this.$schemaBasic.shape[t]||this.$schema.shape[t];if(!i)throw new TypeError("Invalid field:"+t);if(a===void 0)throw new TypeError("Operator is required");if(typeof a!="string"||!(a in rc)||n===void 0){if(a=Po(i,a),a===void 0)throw new TypeError("unexpectedly value needed");return typeof a=="object"?this.add(Wa({function:e,value:{[t]:a}})):this.add(Wa({function:e,field:t,value:a}))}if(n=Po(i,n),n===void 0)throw new Error("undefined value");return this.add(Wa({function:e,field:t,operator:a,value:n}))}addIn({fn:e,field:t,value:a}){if(!t)throw new TypeError("Field is required");if(!(t in this.$schema.shape))throw new TypeError("Invalid field");if(!a)throw new TypeError("Value is required");if(!Array.isArray(a))throw new TypeError("Expected value to be array");return this.add({function:e,field:t,value:a})}addMetadataNull({fn:e,field:t}){if(!t)throw new TypeError("Field is required");if(typeof t!="string")throw new TypeError("Invalid field");return this.add({function:e,field:t})}addNull({fn:e,field:t}){if(!t)throw new TypeError("Field is required");if(!(t in this.$schema.shape))throw new TypeError("Invalid field");return this.$schema.parse({[t]:null}),this.add({function:e,field:t})}addMetadata({fn:e,field:t,operator:a,value:n}){if(typeof t!="string")throw new TypeError("expected field to be string");return n||(n=a,a="="),this.add({function:e,field:t,operator:a,value:n})}addMetadataIn({fn:e,field:t,value:a}){if(typeof t!="string")throw new TypeError("expected field to be string");if(!Array.isArray(a))throw new TypeError("expected value to be an array");return this.add({function:e,field:t,value:a})}where(e,t,a){return this.addWhere({fn:"where",field:e,operator:t,value:a})}orWhere(e,t,a){return this.addWhere({fn:"orWhere",field:e,operator:t,value:a})}whereIn(e,t){return this.addIn({fn:"whereIn",field:e,value:t})}orWhereIn(e,t){return this.addIn({fn:"orWhereIn",field:e,value:t})}whereNull(e){return this.addNull({fn:"whereNull",field:e})}orWhereNull(e){return this.addNull({fn:"orWhereNull",field:e})}whereNotNull(e){return this.addNull({fn:"whereNotNull",field:e})}orWhereNotNull(e){return this.addNull({fn:"orWhereNotNull",field:e})}whereMetadata(e,t,a){return this.addMetadata({fn:"whereMetadata",field:e,operator:t,value:a})}orWhereMetadata(e,t,a){return this.addMetadata({fn:"orWhereMetadata",field:e,operator:t,value:a})}whereMetadataIn(e,t){return this.addMetadataIn({fn:"whereMetadataIn",field:e,value:t})}orWhereMetadataIn(e,t){return this.addMetadataIn({fn:"orWhereMetadataIn",field:e,value:t})}whereMetadataNull(e){return this.addMetadataNull({fn:"whereMetadataNull",field:e})}orWhereMetadataNull(e){return this.addMetadataNull({fn:"orWhereMetadataNull",field:e})}whereMetadataNotNull(e){return this.addMetadataNull({fn:"whereMetadataNotNull",field:e})}orWhereMetadataNotNull(e){return this.addMetadataNull({fn:"orWhereMetadataNotNull",field:e})}};function um(r,e,t){return r in vu?c({type:"period",alias:e!=null?e:r},t?{field:{period:r,timezone:t}}:{field:r}):r.startsWith("metadata.")?{type:"metadata_field",field:r.replace("metadata.",""),alias:e!=null?e:r.replace("metadata.","")}:{type:"field",field:r,alias:e!=null?e:r}}function ac(r,e,t){return e?{function:r,field:e,alias:t!=null?t:r}:{function:r,alias:r}}var Ir=class r extends De{constructor({$queries:t,$options:a,start:n,schema:i,schemaBasic:s,optionsSchema:u,aggregators:l,groups:d,aggregatableSchema:T,groupableSchema:_,timezone:j}){super(s,i,t);b(this,"$options");b(this,"$optionsSchema");b(this,"$start");b(this,"$aggregators");b(this,"$groups");b(this,"$aggregatableSchema");b(this,"$groupableSchema");b(this,"$timezone");this.$options=a,this.$optionsSchema=u,this.$start=n,this.$aggregators=l,this.$groups=d,this.$aggregatableSchema=T,this.$groupableSchema=_,this.$timezone=j}add(t){return new r({$queries:[...this.$queries,t],$options:this.$options,start:this.$start,schemaBasic:this.$schemaBasic,aggregators:this.$aggregators,groups:this.$groups,schema:this.$schema,optionsSchema:this.$optionsSchema,aggregatableSchema:this.$aggregatableSchema,groupableSchema:this.$groupableSchema,timezone:this.$timezone})}start(){return this.$start(this.toJSON())}getAggregators(){return Object.entries(this.$aggregators).map(([,t])=>t)}getGroups(){return Object.entries(this.$groups).map(([,t])=>t)}toJSON(){return{filter:super.toQuery(),options:this.$options,aggregators:this.getAggregators(),groups:this.getGroups()}}then(t,a){return this.start().then(t,a)}catch(t){return this.start().catch(t)}finally(t){return this.start().finally(t)}stream(){return this.start().stream()}options(t){let a=this.$optionsSchema.parse(c({},t)),n=Le(a);return new r({$queries:this.$queries,$options:c(c({},this.$options),n),start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,aggregators:this.$aggregators,groups:this.$groups,optionsSchema:this.$optionsSchema,aggregatableSchema:this.$aggregatableSchema,groupableSchema:this.$groupableSchema,timezone:this.$timezone})}timezone(t){let a=Object.fromEntries(Object.entries(this.$groups).map(([n,i])=>i.type!=="period"?[n,i]:[n,S(c({},i),{field:{period:i.field,timezone:t}})]));return new r({$queries:this.$queries,$options:this.$options,start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,aggregators:this.$aggregators,groups:c({},a),optionsSchema:this.$optionsSchema,aggregatableSchema:this.$aggregatableSchema,groupableSchema:this.$groupableSchema,timezone:t})}groupBy(t,...a){if(!t)throw new ve("String input expected");let n=Object.fromEntries([t,...a].map(i=>{if(typeof i!="string")throw new ve({input:a},"Expected an array of strings");let[s,u]=i.split(" as "),l=um(s,u,this.$timezone);return[l.alias,l]}));return new r({$queries:this.$queries,$options:this.$options,start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,aggregators:this.$aggregators,groups:c(c({},this.$groups),n),optionsSchema:this.$optionsSchema,aggregatableSchema:this.$aggregatableSchema,groupableSchema:this.$groupableSchema,timezone:this.$timezone})}addAggregator(t,a,...n){let i=a===void 0?{[t]:ac(t)}:Object.fromEntries([a,...n].map(s=>{if(typeof s!="string")throw new ve("expected string input");let[u,l]=s.split(" as "),d=ac(t,u,l);return[d.alias,d]}));return new r({$queries:this.$queries,$options:this.$options,start:this.$start,schemaBasic:this.$schemaBasic,aggregators:c(c({},this.$aggregators),i),groups:this.$groups,schema:this.$schema,optionsSchema:this.$optionsSchema,aggregatableSchema:this.$aggregatableSchema,groupableSchema:this.$groupableSchema,timezone:this.$timezone})}count(t,...a){return this.addAggregator("count",t,...a)}distinct(t,...a){return this.addAggregator("countDistinct",t,...a)}avg(t,...a){return this.addAggregator("average",t,...a)}min(t,...a){return this.addAggregator("min",t,...a)}max(t,...a){return this.addAggregator("max",t,...a)}sum(t,...a){return this.addAggregator("sum",t,...a)}where(t,a,n){return this.addWhere({fn:"where",field:t,operator:a,value:n})}orWhere(t,a,n){return this.addWhere({fn:"orWhere",field:t,operator:a,value:n})}whereIn(t,a){return this.addIn({fn:"whereIn",field:t,value:a})}orWhereIn(t,a){return this.addIn({fn:"orWhereIn",field:t,value:a})}whereNull(t){return this.addNull({fn:"whereNull",field:t})}orWhereNull(t){return this.addNull({fn:"orWhereNull",field:t})}whereNotNull(t){return this.addNull({fn:"whereNotNull",field:t})}orWhereNotNull(t){return this.addNull({fn:"orWhereNotNull",field:t})}whereMetadata(t,a,n){return this.addMetadata({fn:"whereMetadata",field:t,operator:a,value:n})}orWhereMetadata(t,a,n){return this.addMetadata({fn:"orWhereMetadata",field:t,operator:a,value:n})}whereMetadataIn(t,a){return this.addMetadataIn({fn:"whereMetadataIn",field:t,value:a})}orWhereMetadataIn(t,a){return this.addMetadataIn({fn:"orWhereMetadataIn",field:t,value:a})}whereMetadataNull(t){return this.addMetadataNull({fn:"whereMetadataNull",field:t})}orWhereMetadataNull(t){return this.addMetadataNull({fn:"orWhereMetadataNull",field:t})}whereMetadataNotNull(t){return this.addMetadataNull({fn:"whereMetadataNotNull",field:t})}orWhereMetadataNotNull(t){return this.addMetadataNull({fn:"orWhereMetadataNotNull",field:t})}};var cm=o.object({return_running_balance:o.boolean().describe("return running balance for specified wallet under filter"),return_signed_amount:o.boolean().describe("return running balance for specified wallet under filter"),return_running_balance_for_wallet:q.describe("foreign key for which wallet should running balance be returned for"),return_signed_amount_for_wallet:q.describe("foreign key for which wallet should signed amounts be returned for")}),lm=Ei.keyof().options.reduce((r,e)=>S(c({},r),{[e]:!0}),{}),zt=Fa.omit(lm).merge(cm).merge(xe).partial().describe("Optional flags for input"),Ht=o.object({wallet:q.describe("Foreign of the wallet connected to transfers"),token:q.describe("Foreign of the token transferred"),from_wallet:q.describe("Foreign of the wallet transfers are made from"),to_wallet:q.describe("Foreign of the wallet transfers are made to"),transfer_group:q.describe("Foreign of the transfer_group the transfers are a part of"),type:Ce,status:z.describe("Status of the transfers"),metadata:Q}).partial(),_r=Ht.extend({options:zt.optional()}).strict().describe("Input for findTransfers"),nc=xn.describe("Output of findTransfers");function Bs(r,e,t){let{client:a}=r,n=new Ir({start(i){return a.api.aggregateTransferMany({transfer:i.filter,options:i.options,groups:i.groups,aggregators:i.aggregators})},schemaBasic:_r,schema:Re,optionsSchema:Ds,aggregators:{},groups:{},aggregatableSchema:Wi,groupableSchema:Ni});if(e){let{filter:i,options:s}=ee(e,t),u=ae(i,[]);return n.where(u).options(s)}return n}var dm=Pi.describe("Optional flags for input"),fm=o.enum([...Di.options,"aggregateTransfers","exportBalanceHistory","exportTokens","exportTransferGroups","exportTransfers","exportWallets","findBalances","findTokens","findTransferGroups","findTransfers","findWallets","listExports"]),mm=Bi.extend({scopes:fm.array()}),vr=o.object({token:o.union([mm,ji]),options:dm}).partial().strict().describe("Input for createAccessToken"),oc=Fn.describe("Output of createAccessToken");var hm=new Map(Object.entries({aggregateTransfers:"aggregateTransferMany",exportTokens:"exportTokenMany",exportTransferGroups:"exportTransferGroupMany",exportTransfers:"exportTransferMany",exportWallets:"exportWalletMany",findBalances:"findBalanceMany",findTokens:"findTokenMany",findTransferGroups:"findTransferGroupMany",findTransfers:"findTransferMany",findWallets:"findWalletMany",listExports:"listExportMany"})),Tm=p(vr);function js(r,e,t){var i;let{client:a}=r,n=Tm.validateInputWOptions(e,t);return n.token&&"scopes"in n.token&&(n.token.scopes=Array.from(new Set((i=n.token)==null?void 0:i.scopes.map(s=>{var u;return(u=hm.get(s))!=null?u:s})))),a.api.createAccessToken({token:n.token,options:t})}var gm=qi.describe("Optional flags for input"),xm=o.object({wallet:F.describe("Foreign of the wallet buying this contract"),token:F.describe("Foreign of the token buyer will buy with, defaults to Contract value token"),amount:o.number().describe("Amount the buyer will pay, defaults to contract value amount"),metadata:h.shape.metadata,latest_control_hash:h.shape.control_hash.nullable().optional().describe("Latest control_hash on the buyer wallet")}).partial().required({wallet:!0}).describe("The properties of the contract from buyer side"),ym=o.object({foreign:Ns.describe("Unique foreign of the created Contract"),metadata:P.shape.metadata,value_token:F.describe("Foreign of the token this contract is valued in"),value_amount:o.number().positive().describe("Amount of value this Contract has"),owner:Ns.describe("Foreign of the wallet this contract should initially belong to"),buyer:xm}).partial().required({foreign:!0,value_amount:!0,value_token:!0}).describe("Contract description"),kr=ym.extend({options:gm.optional()}).strict().describe("Input for createContract"),ic=Rn.describe("Output of createContract");var bm=p(kr);function Ps(r,e,t){var s;let{client:a}=r,n=bm.validateInputWOptions(e,t),i={token:{foreign:n.foreign+"",metadata:n.metadata,owner:C((s=n.owner)!=null?s:"house"),deposits:[{token:C(n.value_token),amount:n.value_amount}]}};return n.buyer&&(n.buyer.latest_control_hash&&console.warn("deprecated: latest_control_hash is deprecated and will be ignored"),i.exchange={from_wallet:C(n.buyer.wallet),amount:n.buyer.amount||n.value_amount,from_token:C(n.buyer.token||n.value_token),metadata:n.buyer.metadata}),a.api.createContract(i)}var Sm=x.extend({return_balance:o.boolean().describe("return balance after deposit"),create_wallet_if_not_exists:o.boolean().describe("If true then the wallet will be created if not found. Only valid with 'foreign'")}).partial().describe("Optional flags for input"),Om=o.object({identifier:h.shape.identifier,token:F.describe("Id of the token to deposit as"),wallet:F.describe("Id of the wallet to deposit to"),amount:Fr.describe("amount to deposit"),metadata:h.shape.metadata,status:pe,transfer_group:F.describe("Id of the transfer_group this deposit is linked to"),created_at:h.shape.created_at}).partial().required({wallet:!0,amount:!0}),wr=Om.extend({options:Sm.optional()}).strict().describe("Input for createDeposit"),sc=Mn.describe("Output of createDeposit");var Fm=p(wr);function Vs(r,e,t){let{client:a}=r,n=Ue(e,"token",a.getConfig("token")),i=Fm.validateInputWOptions(n,t),s=i.token||a.getConfig("token");if(s===void 0)throw new J("INPUT_NEEDS_TOKEN",{input:e});let j=i,{wallet:u,metadata:l,options:d}=j,T=ae(j,["wallet","metadata","options"]),_=c(S(c({},T),{amount:ar(T.amount),transfer_group:ce(i.transfer_group),token:C(s),to_wallet:C(u),type:"deposit"}),l?{metadata:l}:{});return _.identifier||(_.identifier=me(_)),a.api.createTransfer({transfer:_,options:za(d,{return_balance:"return_to_balance",create_wallet_if_not_exists:"create_to_wallet_if_not_exists"})})}var Im=x.partial().describe("Optional flags for input"),_m=o.object({identifier:D.shape.identifier,from_identifier:h.shape.identifier,from_wallet:F.describe("Foreign of Wallet where from_token is debited from/to_token is credited to"),from_token:F.describe("Foreign of Token that is transferred from->to"),from_amount:h.shape.amount.describe("Amount of from_token transferred"),to_identifier:h.shape.identifier,to_wallet:F.describe("Foreign of Wallet where from_token is credited to/to_token is debited from. If not specified then to_token.belongs_to is used"),to_token:F.describe("Foreign of Token that is transferred to->from"),to_amount:h.shape.amount.describe("Amount of to_token transferred. If not specified then from_amount is used"),status:pe.describe("The state at which the exchange is created"),force:h.shape.force,metadata:h.shape.metadata}).partial().required({from_wallet:!0,from_token:!0,from_amount:!0,to_token:!0,to_wallet:!0}),Rr=_m.extend({options:Im.optional()}).strict().describe("Input for createExchange"),pc=yt.describe("Output of createExchange");var vm=p(Rr);function Zs(r,e,t){var l,d,T,_,j;let{client:a}=r,u=vm.validateInputWOptions(e,t),{options:i}=u,s=ae(u,["options"]);return(l=s.identifier)!=null||(s.identifier=me(s)),a.api.createTransferGroup({transfer_group:{identifier:s.identifier,status:ln.closed,transfer_status:(d=s.status)!=null?d:"pending",metadata:s.metadata,children:[{identifier:(T=s.from_identifier)!=null?T:me(),from_wallet:C(s.from_wallet),to_wallet:C(s.to_wallet),token:C(s.from_token),type:s.from_wallet?Vt.transfer:Vt.deposit,amount:s.from_amount,metadata:s.metadata,force:s.force},{identifier:(_=s.to_identifier)!=null?_:me(),from_wallet:C(s.to_wallet),to_wallet:C(s.from_wallet),token:C(s.to_token),type:s.to_wallet?Vt.transfer:Vt.deposit,amount:(j=s.to_amount)!=null?j:s.from_amount,metadata:s.metadata,force:s.force}]},options:i})}var km=zi.describe("Optional flags for input"),wm=P.pick({foreign:!0,public:!0,metadata:!0,divisor:!0,limit:!0}).extend({belongs_to:F.describe("Id of the wallet this token belongs_to")}).partial().required({foreign:!0}),Ar=wm.extend({options:km.optional()}).strict().describe("Input for createToken"),uc=Cn.describe("Output of createToken");var Rm=p(Ar);function Us(r,e,t){let{client:a}=r,d=Rm.validateInputWOptions(e,t),{options:i,belongs_to:s,metadata:u}=d,l=ae(d,["options","belongs_to","metadata"]);return a.api.createToken({token:c(S(c({},l),{belongs_to:C(s)}),u?{metadata:u}:{}),options:i})}var Am=ot.describe("Optional flags for input"),Ls=o.object({identifier:h.shape.identifier,token:F.describe("Id of the token to transfer as"),from_wallet:F.describe("Foreign of the wallet to withdraw from"),to_wallet:F.describe("Foreign of the wallet to deposit to"),latest_control_hash:h.shape.control_hash,amount:Fr.describe("amount to withdraw"),metadata:h.shape.metadata,status:pe.describe("status of the transfer"),transfer_group:F.describe("Id of the transfer_group this transfer is linked to"),created_at:h.shape.created_at,type:o.literal("transfer")}),qs=Ls.extend({type:o.literal("transfer")}).partial().required({from_wallet:!0,to_wallet:!0,amount:!0}),$s=Ls.omit({from_wallet:!0,to_wallet:!0}).extend({wallet:F.describe("Foreign of the wallet to withdraw from"),type:o.literal("withdrawal")}).partial().required({wallet:!0,amount:!0,type:!0}),zs=Ls.omit({from_wallet:!0,to_wallet:!0}).extend({wallet:F.describe("Foreign of the wallet to deposit to"),type:o.literal("deposit")}).partial().required({wallet:!0,amount:!0,type:!0}),Hs=o.union([qs,zs,$s]),Mr=Hs.and(o.object({options:Am.optional()})).describe("Input for createTransfer"),cc=xt.describe("Output of createTransfer");var Mm=p(Mr);function Ks(r,e,t){let{client:a}=r,n=Ue(e,"token",a.getConfig("token")),i=Mm.validateInputWOptions(n,t),s=Na(i,a.getConfig("token"));return s.identifier||(s.identifier=me(s)),a.api.createTransfer({transfer:s,options:i.options})}function Na(r,e){r.type=r.type||"transfer";let t={identifier:r.identifier,token:C(r.token||e),amount:ar(r.amount),metadata:r.metadata,status:r.status,type:r.type,transfer_group:ce(r.transfer_group),created_at:r.created_at};if(r.type==="transfer")return r.latest_control_hash&&console.warn("deprecated: latest_control_hash is deprecated"),S(c({},t),{from_wallet:C(r.from_wallet),to_wallet:C(r.to_wallet)});if(r.type==="withdrawal")return r.latest_control_hash&&console.warn("deprecated: latest_control_hash is deprecated"),S(c({},t),{from_wallet:C(r.wallet)});if(r.type==="deposit")return S(c({},t),{to_wallet:C(r.wallet)});throw new Error("Should not be here")}var Em=Li.describe("Optional flags for input"),Gm=qs.omit({transfer_group:!0}),Cm=zs.omit({transfer_group:!0}),Wm=$s.omit({transfer_group:!0}),Nm=o.union([Cm,Gm,Wm]),Dm=D.pick({identifier:!0,status:!0,transfer_status:!0,metadata:!0}).extend({children:Nm.array()}).partial(),Er=Dm.extend({options:Em.optional()}).describe("Input for createTransferGroup"),lc=yt.describe("Output of createTransferGroup");var Bm=p(Er);function Js(r,e,t){let{client:a}=r,u=Bm.validateInputWOptions(e,t),{options:i}=u,s=ae(u,["options"]);return s.children&&(s.children=s.children.map(l=>Na(l,a.getConfig("token")))),s.identifier||(s.identifier=me(s)),a.api.createTransferGroup({transfer_group:s,options:i})}var jm=Hi.describe("Optional flags for input"),Gr=o.object({transfers:Hs.array().min(1).describe("Array of transfer objects to create"),options:jm.optional()}).describe("Input for createTransfers"),dc=Nn.describe("Output of createTransfers");var Pm=p(Gr);function Qs(r,e,t){let{client:a}=r,n=Pm.validateInputWOptions(e,t),i=n.transfers.map(s=>Na(s,a.getConfig("token")));for(let s of i)s.identifier||(s.identifier=me(s));return a.api.createTransferMany({transfers:i,options:n.options})}var Vm=Ji.describe("Optional flags for input"),Zm=Z.pick({foreign:!0,name:!0,metadata:!0,status:!0}).partial().required({foreign:!0}),Cr=Zm.extend({options:Vm.optional()}).strict().describe("Input for createWallet"),fc=Bn.describe("Output of createWallet");var Um=p(Cr);function Ys(r,e,t){let{client:a}=r,l=Um.validateInputWOptions(e,t),{options:i,metadata:s}=l,u=ae(l,["options","metadata"]);return a.api.createWallet({wallet:c(c({},u),s?{metadata:s}:{}),options:i})}var Lm=x.extend({return_balance:o.boolean().describe("Return balance after withdrawal")}).partial().describe("Optional flags for input"),qm=o.object({identifier:h.shape.identifier,token:F.describe("Id of the token to withdrawal as"),wallet:F.describe("Id of the wallet to withdraw from"),latest_control_hash:h.shape.control_hash,amount:Fr.describe("amount to withdraw"),metadata:h.shape.metadata,status:pe.describe("status of the withdrawal"),transfer_group:F.describe("Id of the transfer_group this withdrawal is linked to"),created_at:h.shape.created_at}).partial().required({wallet:!0,amount:!0}),Wr=qm.extend({options:Lm.optional()}).strict().describe("Input for createWithdrawal"),mc=Pn.describe("Output of createWithdrawal");var $m=p(Wr);function Xs(r,e,t){let{client:a}=r,n=Ue(e,"token",a.getConfig("token")),i=$m.validateInputWOptions(n,t),B=i,{wallet:s,metadata:u,options:l,latest_control_hash:d}=B,T=ae(B,["wallet","metadata","options","latest_control_hash"]);d&&console.warn("deprecated: latest_control_hash is deprecated");let _=i.token||a.getConfig("token");if(_===void 0)throw new J("INPUT_NEEDS_TOKEN",{input:e});let j=c(S(c({},T),{amount:ar(T.amount),transfer_group:ce(i.transfer_group),token:C(_),from_wallet:C(s),type:"withdrawal"}),u?{metadata:u}:{});return j.identifier||(j.identifier=me(j)),a.api.createTransfer({transfer:j,options:za(l,{return_balance:"return_from_balance"})})}var zm=rs.partial().describe("Optional flags for input"),Hm=o.object({token:F.describe("Id of the token to withdrawal as").transform(r=>({foreign:String(r)})),wallet:F.describe("Id of the wallet to withdraw from").transform(r=>({foreign:String(r)}))}).partial().required({wallet:!0}),Nr=Hm.extend({options:zm.optional()}).strict().describe("Input for exportBalanceHistory"),hc=qn.describe("Output of exportBalanceHistory");var Km=p(Nr);function ep(r,e,t){let{client:a}=r,n=Km.validateInputWOptions(e,t),i=n.token||C(a.getConfig("token"));if(i===void 0)throw new J("INPUT_NEEDS_TOKEN",{input:e});return a.api.exportBalanceHistory({balance:{wallet:n.wallet,token:i},options:t})}function Jm(r){return r.map(e=>{if(typeof e=="string"){if(e.includes(" "))throw new TypeError("invalid order option: "+e);return{field:e,direction:"asc"}}return{field:e.column,direction:e.order,nulls:e.nulls}})}var oe=class r extends De{constructor({$queries:t,$options:a,start:n,schema:i,schemaBasic:s,optionsSchema:u}){super(s,i,t);b(this,"$options");b(this,"$optionsSchema");b(this,"$start");this.$options=a,this.$optionsSchema=u,this.$start=n}add(t){return new r({$queries:[...this.$queries,t],$options:this.$options,start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema})}start(){return this.$start(this.toJSON())}toJSON(){return{filter:super.toQuery(),options:c({},this.$options)}}then(t,a){return this.start().then(t,a)}catch(t){return this.start().catch(t)}finally(t){return this.start().finally(t)}stream(){return this.start().stream()}select(t,...a){var n,i;return new r({$queries:this.$queries,$options:S(c({},this.$options),{deselect:void 0,select:Array.from(new Set([t,...a,...(i=(n=this.$options)==null?void 0:n.select)!=null?i:[]]))}),start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema})}deselect(t,...a){var n,i;return new r({$queries:this.$queries,$options:S(c({},this.$options),{select:void 0,deselect:Array.from(new Set([t,...a,...(i=(n=this.$options)==null?void 0:n.deselect)!=null?i:[]]))}),start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema})}de(){return[]}options(t){let a=qe(this.$optionsSchema,t),n=Le(a);return new r({$queries:this.$queries,$options:c(c({},this.$options),n),start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema})}limit(t){return this.options({limit:t})}offset(t){return this.options({offset:t})}orderBy(t,a,n){if(!Array.isArray(t)&&typeof t!="string")throw new TypeError("invalid input");if(Array.isArray(t))return this.options({order:Jm(t)});let i=[t];return a&&i.push(a),n&&i.push("nulls",n),this.options({order_by:i.join(" ")})}where(t,a,n){return this.addWhere({fn:"where",field:t,operator:a,value:n})}orWhere(t,a,n){return this.addWhere({fn:"orWhere",field:t,operator:a,value:n})}whereIn(t,a){return this.addIn({fn:"whereIn",field:t,value:a})}orWhereIn(t,a){return this.addIn({fn:"orWhereIn",field:t,value:a})}whereNull(t){return this.addNull({fn:"whereNull",field:t})}orWhereNull(t){return this.addNull({fn:"orWhereNull",field:t})}whereNotNull(t){return this.addNull({fn:"whereNotNull",field:t})}orWhereNotNull(t){return this.addNull({fn:"orWhereNotNull",field:t})}whereMetadata(t,a,n){return this.addMetadata({fn:"whereMetadata",field:t,operator:a,value:n})}orWhereMetadata(t,a,n){return this.addMetadata({fn:"orWhereMetadata",field:t,operator:a,value:n})}whereMetadataIn(t,a){return this.addMetadataIn({fn:"whereMetadataIn",field:t,value:a})}orWhereMetadataIn(t,a){return this.addMetadataIn({fn:"orWhereMetadataIn",field:t,value:a})}whereMetadataNull(t){return this.addMetadataNull({fn:"whereMetadataNull",field:t})}orWhereMetadataNull(t){return this.addMetadataNull({fn:"orWhereMetadataNull",field:t})}whereMetadataNotNull(t){return this.addMetadataNull({fn:"whereMetadataNotNull",field:t})}orWhereMetadataNotNull(t){return this.addMetadataNull({fn:"orWhereMetadataNotNull",field:t})}};var Da=va.merge(xe).partial().describe("Optional flags for input"),Kt=o.object({foreign:F.describe("Foreign of the token").transform(r=>String(r)),type:ht,belongs_to:q.describe("Foreign of the wallet connected to token"),metadata:Q}).partial(),Vo=Kt.extend({options:Da.optional()}).strict().describe("Input for findTokens"),Tc=$n.describe("Output of findTokens");function tp(r,e,t){let{client:a}=r,n=new oe({start(i){return a.api.exportTokenMany({token:i.filter,options:i.options})},schemaBasic:Kt,schema:ka,optionsSchema:Da});if(e){let{filter:i,options:s}=ee(e,t);return n.where(i).options(s)}return n}var Qm=ns.merge(xe).partial().describe("Optional flags for input"),Ym=Kt,Zo=Ym.extend({options:Qm.optional()}).strict().describe("Input for exportTokens"),gc=Hn.describe("Output of exportTokens");var Jt=wa.merge(xe).partial().describe("Optional flags for input"),Qt=o.object({identifier:F.describe("Identifier of the transfer_group").transform(r=>String(r)),transfer_status:D.shape.transfer_status.describe("Status of the transfers"),status:D.shape.status.describe("Status of the transfer_group"),reverses:F.describe("Identifier of the transfer_group the transfer_group reverses").transform(r=>({identifier:String(r)})),type:Tt.describe("Type of the transfer group"),metadata:Q}).partial(),Uo=Qt.extend({options:Jt.optional()}).strict().describe("Input for findTransferGroups"),xc=Kn.describe("Output of findTransferGroups");function rp(r,e,t){let{client:a}=r,n=new oe({start(i){return a.api.exportTransferGroupMany({transfer_group:i.filter,options:i.options})},schemaBasic:Qt,schema:Lt,optionsSchema:Jt});if(e){let{filter:i,options:s}=ee(e,t);return n.where(i).options(s)}return n}var Xm=Jt.partial().describe("Optional flags for input"),eh=Qt.partial(),Lo=eh.extend({options:Xm.optional()}).strict().describe("Input for exportTransferGroups"),yc=Qn.describe("Output of exportTransferGroups");function ap(r,e,t){let{client:a}=r,n=new oe({start(i){return a.api.exportTransferMany({transfer:i.filter,options:i.options})},schemaBasic:Ht,schema:Re,optionsSchema:zt});if(e){let{filter:i,options:s}=ee(e,t);return n.where(i).options(s)}return n}var th=zt.partial().describe("Optional flags for input"),rh=Ht,qo=rh.extend({options:th.optional()}).strict().describe("Input for exportTransfers"),bc=Xn.describe("Output of exportTransfers");var ah=o.object({include_balance_for_token:q.describe("Foreign of token to include balance for")}),Ba=Aa.merge(xe).merge(ah).partial().describe("Optional flags for input"),Yt=o.object({foreign:Ze.describe("Wallet foreign"),name:Ze.describe("Wallet name"),type:mt,status:ft,metadata:Q}).partial(),$o=Yt.extend({options:Ba.optional()}).strict().describe("Input for findWallets"),Sc=eo.describe("Output of findWallets");var np=Ba.partial().describe("Optional flags for input"),nh=Yt.partial(),zo=nh.extend({options:np.optional()}).strict().describe("Input for exportWallets"),Oc=ro.describe("Output of exportWallets");function op(r,e,t){let{client:a}=r,n=new oe({start(i){return a.api.exportWalletMany({wallet:i.filter,options:i.options})},schemaBasic:Yt,schema:Ma,optionsSchema:np});if(e){let{filter:i,options:s}=ee(e,t);return n.where(i).options(s)}return n}var ip=ps.merge(xe).partial().describe("Optional flags for input"),sp=o.object({token:F.describe("Id of the token to withdrawal as").transform(r=>({foreign:String(r)})),wallet:F.describe("Id of the wallet to withdraw from").transform(r=>({foreign:String(r)}))}).partial(),Ho=sp.extend({options:ip.optional()}).strict().describe("Input for findBalances"),Fc=no.describe("Output of findBalances");function pp(r,e,t){let{client:a}=r,n=new oe({start(i){return a.api.findBalanceMany({balance:i.filter,options:i.options})},schemaBasic:sp,schema:cs,optionsSchema:ip});if(e){let{filter:i,options:s}=ee(e,t);return n.where(i).options(s)}return n}function up(r,e,t){let{client:a}=r,n=new oe({start(i){return a.api.findTokenMany({token:i.filter,options:i.options})},schemaBasic:Kt,schema:ka,optionsSchema:Da});if(e){let{filter:i,options:s}=ee(e,t);return n.where(i).options(s)}return n}function cp(r,e,t){let{client:a}=r,n=new oe({start(i){return a.api.findTransferGroupMany({transfer_group:i.filter,options:i.options})},schemaBasic:Qt,schema:Lt,optionsSchema:Jt});if(e){let{filter:i,options:s}=ee(e,t);return n.where(i).options(s)}return n}function lp(r,e,t){let{client:a}=r,n=new oe({start(i){return a.api.findTransferMany({transfer:i.filter,options:i.options})},schemaBasic:Ht,schema:Re,optionsSchema:zt});if(e){let{filter:i,options:s}=ee(e,t);if(s!=null&&s.return_running_balance){if(s!=null&&s.return_running_balance_for_wallet)throw new J("CONFLICTING_OPTIONS_FOR_BALANCE",{options:s});if(!i.wallet)throw new J("RUNNING_BALANCE_WITHOUT_WALLET",{input:i});s.return_running_balance_for_wallet=i.wallet}if(s!=null&&s.return_signed_amount){if(s!=null&&s.return_signed_amount_for_wallet)throw new J("CONFLICTING_OPTIONS_FOR_SIGNED_AMOUNT",{options:s});if(!i.wallet)throw new J("SIGNED_AMOUNT_WITHOUT_WALLET",{input:i});s.return_signed_amount_for_wallet=i.wallet}return n.where(i).options(s)}return n}function dp(r,e,t){let{client:a}=r,n=new oe({start(i){return a.api.findWalletMany({wallet:i.filter,options:i.options})},schemaBasic:Yt,schema:Ma,optionsSchema:Ba});if(e){let{filter:i,options:s}=ee(e,t);return n.where(i).options(s)}return n}var oh=Vi.describe("Optional flags for input"),ih=o.object({token:F.describe("Id of the token to get balance in"),wallet:F.describe("Id of the wallet to get balance for"),datetime:M.describe("Date and time this balance should be got")}).partial().required({wallet:!0}),Dr=ih.extend({options:oh.optional()}).strict().describe("Input for getBalance"),Ic=Ye.describe("Output of getBalance");var sh=p(Dr);function fp(r,e,t){let{client:a}=r,n=Ue(e,"token",a.getConfig("token")),i=sh.validateInputWOptions(n,t);if(i.datetime&&ru(i.datetime))throw new J("BAL_FUTURE_DATETIME",{input:i});let s=i.token||a.getConfig("token");if(s===void 0)throw new J("INPUT_NEEDS_TOKEN",{input:i});return a.api.getBalance({balance:{wallet:C(i.wallet),token:C(s),datetime:i.datetime},options:i.options})}var ph=ts.describe("Optional flags for input"),uh=o.object({token:F.describe("Id of the token to get balance in"),wallet:F.describe("Id of the wallet to get balance for"),datetime:M.describe("Select entries older than")}).partial().required({wallet:!0}),Br=uh.extend({options:ph.optional()}).strict().describe("Input for getBalanceHistory"),_c=Un.describe("Output of getBalanceHistory");var ch=p(Br);function mp(r,e,t){let{client:a}=r,n=ch.validateInputWOptions(e,t),i=n.token||a.getConfig("token");if(i===void 0)throw new J("INPUT_NEEDS_TOKEN",{input:e});return a.api.getBalanceHistory({balance:{wallet:C(n.wallet),token:C(i),datetime:n.datetime},options:n.options})}var lh=Yi.describe("Optional flags for input"),dh=o.object({identifier:o.string().describe("File name of the export to get")}),jr=dh.extend({options:lh.optional()}).strict().describe("Input for getExport"),vc=Ie.describe("Output of getExport");var fh=p(jr);function hp(r,e,t){let{client:a}=r,n=fh.validateInputWOptions(e,t);return a.api.getExport({export:{identifier:n.identifier},options:n.options})}var mh=ls.describe("Optional flags for input"),Pr=o.object({options:mh.optional()}).strict().describe("Input for getFlags"),kc=so.describe("Output of getFlags");var hh=p(Pr);function Tp(r,e,t){let{client:a}=r,n=hh.validateInputWOptions(e,t);return a.api.getFlags({options:n.options})}var Th=fs.describe("Optional flags for input"),Vr=o.object({model:ds,aggregator:o.literal("count"),group:Ta,timezone:an,filter:Qe,options:Th.optional()}).strict().partial().required({model:!0}).describe("Input for getStatistics"),wc=o.object({rows:o.object({aggregate:o.number().nullable(),period:o.string().optional()}).array()}).describe("Output of getStatistics");var gh=p(Vr);function gp(r,e,t){let{client:a}=r,n=gh.validateInputWOptions(e!=null?e:{},t),i=n.timezone;return a.api.getStatistics(c({model:n.model||"Transfer",aggregator:"count",filter:n.filter,options:n.options},n.group?{groups:[{type:"period",field:i?{period:n.group,timezone:i}:n.group,alias:"period"}]}:{}))}var xh=Sa.describe("Optional flags for input"),yh=o.object({foreign:F.describe("Foreign of the token")}).partial(),Zr=yh.extend({options:xh.optional()}).strict().describe("Input for getToken"),Rc=hn.describe("Output of getToken");var bh=p(Zr);function xp(r,e={},t){let{client:a}=r,n=Ue(e,"foreign",a.getConfig("token")),i=bh.validateInputWOptions(n,t),s=i.foreign||a.getConfig("token");if(s===void 0)throw new J("INPUT_NEEDS_TOKEN",{input:e});return a.api.getToken({token:C(s),options:i.options})}var Sh=wi.describe("Optional flags for input"),Oh=o.object({transfer:F.describe("Transfer identifier")}).partial().required({transfer:!0}),Ur=Oh.extend({options:Sh.optional()}).strict().describe("Input for getTransfer"),Ac=Ne.describe("Output of getTransfer");var Fh=p(Ur);function yp(r,e,t){let{client:a}=r,n=Fh.validateInputWOptions(e,t);return a.api.getTransfer({transfer:ce(n.transfer),options:n.options})}var Ih=Mi.describe("Optional flags for input"),_h=o.object({transfer_group:F.describe("identifier of the transfer group to reverse")}).partial().required({transfer_group:!0}),Lr=_h.extend({options:Ih.optional()}).strict().describe("Input for getTransferGroup"),Mc=gn.describe("Output of getTransferGroup");var vh=p(Lr);function bp(r,e,t){let{client:a}=r,n=vh.validateInputWOptions(e,t);return a.api.getTransferGroup({transfer_group:ce(n.transfer_group),options:n.options})}var kh=ba.describe("Optional flags for input"),wh=o.object({wallet:F.describe("Wallet foreign")}).partial().required({wallet:!0}),qr=wh.extend({options:kh.optional()}).strict().describe("Input for getWallet"),Ec=cn.describe("Output of getWallet");var Rh=p(qr);function Sp(r,e,t){let{client:a}=r,n=Rh.validateInputWOptions(e,t);return a.api.getWallet({wallet:C(n.wallet),options:n.options})}var Ah=ms.describe("Optional flags for input"),$r=o.object({options:Ah.optional()}).strict().describe("Input for healthcheck"),Gc=fo.describe("Output of healthcheck");var Mh=p($r);function Op(r,e,t){let{client:a}=r,n=Mh.validateInputWOptions(e,t);return a.api.healthcheck({options:c(c({},n.options),t)})}var Eh=Ts.merge(xe).partial().describe("Optional flags for input"),Gh=o.object({type:Qi.describe("type of the export"),date:o.string().date().describe("Date of the export")}).partial(),zr=Gh.extend({options:Eh.optional()}).strict().describe("Input for listExports"),Cc=ho.describe("Output of listExports");var Ch=p(zr);function Fp(r,e,t){let{client:a}=r,n=Ch.validateInputWOptions(e,t),i=tu(n==null?void 0:n.date),s=Le(n.options);return a.api.listExportMany({export:c(c({},i?{date:i}:{}),n.type?{type:n.type}:{}),options:s})}var Wh=ys.describe("Optional flags for input"),Nh=o.object({transfer:F.describe("Transfer identifier"),status:pe.describe("Status of the created transfer"),identifier:h.shape.identifier.describe("Identifier for the created transfer"),force:h.shape.force.describe("Force create the reverse transfer ignoring balance"),metadata:h.shape.metadata.describe("Metadata for the reversed transfers"),extend_metadata:h.shape.metadata.describe("Key value object to extend metadata with on created transfer")}).partial().required({transfer:!0}),Hr=Nh.extend({options:Wh.optional()}).strict().describe("Input for reverseTransfer"),Wc=bo.describe("Output of reverseTransfer");var Dh=p(Hr);function Ip(r,e,t){let{client:a}=r,n=Dh.validateInputWOptions(e,t);return n.extend_metadata&&console.warn("deprecated: extend_metadata is deprecated. Use metadata_action instead"),a.api.reverseTransfer({transfer:ce(n.transfer),reverse:{force:n.force,metadata:n.metadata,extend_metadata:n.extend_metadata,identifier:n.identifier,status:n.status},options:n.options})}var Bh=Ea.describe("Optional flags for input"),jh=o.object({transfer_group:F.describe("identifier of the transfer group to reverse"),status:We,transfer_status:pe,identifier:D.shape.identifier,force:h.shape.force,metadata:D.shape.metadata,transfer_metadata:h.shape.metadata,extend_metadata:D.shape.metadata.describe("Key value object to extend metadata with on created transfer"),transfer_extend_metadata:h.shape.metadata.describe("Key value object to extend metadata with on created transfer")}).partial().required({transfer_group:!0}),Kr=jh.extend({options:Bh.optional()}).strict().describe("Input for reverseTransferGroup"),Nc=Oo.describe("Output of reverseTransferGroup");var Ph=p(Kr);function _p(r,e,t){let{client:a}=r,n=Ph.validateInputWOptions(e,t);return n.extend_metadata&&console.warn("deprecated: extend_metadata is deprecated. Use metadata_action instead"),a.api.reverseTransferGroup({transfer_group:ce(n.transfer_group),reverse:{status:n.status,force:n.force,transfer_status:n.transfer_status,identifier:n.identifier,metadata:n.metadata,transfer_metadata:n.transfer_metadata,extend_metadata:n.extend_metadata,transfer_extend_metadata:n.transfer_extend_metadata},options:n.options})}var Jr=class r extends De{constructor({$queries:t,$options:a,start:n,schema:i,schemaBasic:s,optionsSchema:u,reverse:l,reverseSchema:d}){super(s,i,t);b(this,"$options");b(this,"$optionsSchema");b(this,"$start");b(this,"$reverseSchema");b(this,"$reverse");this.$options=a,this.$optionsSchema=u,this.$start=n,this.$reverse=l,this.$reverseSchema=d}add(t){return new r({$queries:[...this.$queries,t],$options:this.$options,start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema,reverse:this.$reverse,reverseSchema:this.$reverseSchema})}start(){return this.$start(this.toJSON())}toJSON(){return{filter:super.toQuery(),reverse:this.$reverse,options:c({},this.$options)}}then(t,a){return this.start().then(t,a)}catch(t){return this.start().catch(t)}finally(t){return this.start().finally(t)}stream(){return this.start().stream()}options(t){let a=qe(this.$optionsSchema,t),n=Le(a);return new r({$queries:this.$queries,$options:c(c({},this.$options),n),start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema,reverse:this.$reverse,reverseSchema:this.$reverseSchema})}reverse(t){var n;let a=qe(this.$reverseSchema,t);return new r({$queries:this.$queries,$options:this.$options,start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema,reverseSchema:this.$reverseSchema,reverse:c(c({},(n=this.$reverse)!=null?n:{}),a)})}where(t,a,n){return this.addWhere({fn:"where",field:t,operator:a,value:n})}orWhere(t,a,n){return this.addWhere({fn:"orWhere",field:t,operator:a,value:n})}whereIn(t,a){return this.addIn({fn:"whereIn",field:t,value:a})}orWhereIn(t,a){return this.addIn({fn:"orWhereIn",field:t,value:a})}whereNull(t){return this.addNull({fn:"whereNull",field:t})}orWhereNull(t){return this.addNull({fn:"orWhereNull",field:t})}whereNotNull(t){return this.addNull({fn:"whereNotNull",field:t})}orWhereNotNull(t){return this.addNull({fn:"orWhereNotNull",field:t})}whereMetadata(t,a,n){return this.addMetadata({fn:"whereMetadata",field:t,operator:a,value:n})}orWhereMetadata(t,a,n){return this.addMetadata({fn:"orWhereMetadata",field:t,operator:a,value:n})}whereMetadataIn(t,a){return this.addMetadataIn({fn:"whereMetadataIn",field:t,value:a})}orWhereMetadataIn(t,a){return this.addMetadataIn({fn:"orWhereMetadataIn",field:t,value:a})}whereMetadataNull(t){return this.addMetadataNull({fn:"whereMetadataNull",field:t})}orWhereMetadataNull(t){return this.addMetadataNull({fn:"orWhereMetadataNull",field:t})}whereMetadataNotNull(t){return this.addMetadataNull({fn:"whereMetadataNotNull",field:t})}orWhereMetadataNotNull(t){return this.addMetadataNull({fn:"orWhereMetadataNotNull",field:t})}};var vp=Os.describe("Optional flags for input"),Vh=Ss.describe("In case the transfer will be made then apply these modifications"),kp=Re.omit({status_finalized_at:!0}).extend({wallet:q.describe("Foreign of the wallet connected to transfers"),token:q.describe("Foreign of the token transferred"),from_wallet:q.describe("Foreign of the wallet transfers are made from"),to_wallet:q.describe("Foreign of the wallet transfers are made to"),transfer_group:q.describe("Foreign of the transfer_group the transfers are a part of"),status:z.describe("Status of the transfers"),metadata:Q}).partial(),Zh=kp.extend({reverse:Vh}).partial(),Ko=Zh.extend({options:vp.optional()}).strict().describe("Input for reverseTransfers"),Dc=_o.describe("Output of reverseTransfers");function wp(r,e,t){let{client:a}=r,n=new Jr({start(s){return a.api.reverseTransferMany({transfer:s.filter,reverse:s.reverse,options:s.options})},schemaBasic:kp,schema:Re,optionsSchema:vp,reverseSchema:xs});if(e){let{filter:s,options:u}=ee(e,t),i=s,{reverse:l}=i,d=ae(i,["reverse"]);return l?n.where(d).options(u).reverse(l):n.where(d).options(u)}return n}var Uh=Fs.describe("Optional flags for input"),Qr=at.extend({options:Uh.optional()}).strict().describe("Input for setFlags"),Bc=ko.describe("Output of setFlags");var Lh=p(Qr);function Rp(r,e,t){let{client:a}=r,n=Lh.validateInputWOptions(e,t),i=at.keyof().options,s={};if(i.forEach(u=>{u in n&&(s[u]=n[u])}),Object.keys(s).length<1)throw new J("REQUIRED_INPUT_MISSING",{requiredOneOf:i,input:e});return a.api.setFlags({flags:s,options:n.options})}var qh=Is.describe("Optional flags for input"),$h=o.object({token:F.describe("Token foreign"),metadata:P.shape.metadata,public:P.shape.public,status:P.shape.status}).partial().required({token:!0}),Yr=$h.extend({options:qh.optional()}).strict().describe("Input for updateToken"),jc=Ao.describe("Output of updateToken");var zh=p(Yr);function Ap(r,e,t){let{client:a}=r,n=zh.validateInputWOptions(e,t);return a.api.updateToken({token:C(n.token),update:{public:n.public,metadata:n.metadata,status:n.status},options:n.options})}var Hh=gs.describe("Optional flags for input"),ja=o.enum(["finished","cancelled"]).describe("Status the transfer should be set to"),Kh=o.object({transfer:F.describe("Transfer identifier"),metadata:h.shape.metadata,extend_metadata:h.shape.metadata,status:ja}).partial().required({transfer:!0}),Xr=Kh.extend({options:Hh.optional()}).strict().describe("Input for updateTransfer"),Pc=Sr.describe("Output of updateTransfer");var Jh=p(Xr);function Mp(r,e,t){let{client:a}=r,n=Jh.validateInputWOptions(e,t);return a.api.updateTransfer({transfer:ce(n.transfer),update:{status:n.status,metadata:n.metadata,extend_metadata:n.extend_metadata},options:n.options})}var Qh=Ga.describe("Optional flags for input"),Yh=o.object({transfer_group:F.describe("TransferGroup identifier"),status:o.enum(["closed"]).describe("Lifecycle status of the TransferGroup"),transfer_status:ja.describe("Status all the transfers should be set at."),metadata:D.shape.metadata.describe("Key value object to be replaced or extended with existing TransferGroup metadata")}).partial().required({transfer_group:!0}),ea=Yh.extend({options:Qh.optional()}).strict().describe("Input for updateTransferGroup"),Vc=Eo.describe("Output of updateTransferGroup");var Xh=p(ea);function Ep(r,e,t){let{client:a}=r,n=Xh.validateInputWOptions(e,t);return a.api.updateTransferGroup({transfer_group:ce(n.transfer_group),update:{transfer_status:n.transfer_status,status:n.status,metadata:n.metadata},options:n.options})}var Gp=vs.describe("Optional flags for input");var Cp=o.object({identifier:F.describe("Identifier of the transfer_group"),transfer_status:ja.describe("Status of the transfers"),status:D.shape.status.describe("Status of the transfer_group"),reverses:q.describe("Identifier of the transfer_group the transfer_group reverses"),type:Tt.describe("Type of the transfer group"),metadata:Q}).partial(),eT=Cp.extend({update:$t}),Jo=eT.extend({options:Gp.optional()}).strict().describe("Input for updateTransferGroups"),Zc=Co.describe("Output of updateTransferGroups");var bt=class r extends De{constructor({$queries:t,$options:a,start:n,schema:i,schemaBasic:s,optionsSchema:u,update:l,updateSchema:d}){super(s,i,t);b(this,"$options");b(this,"$optionsSchema");b(this,"$start");b(this,"$updateSchema");b(this,"$update");this.$options=a,this.$optionsSchema=u,this.$start=n,this.$update=l,this.$updateSchema=d}add(t){return new r({$queries:[...this.$queries,t],$options:this.$options,start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema,update:this.$update,updateSchema:this.$updateSchema})}start(){return this.$start(this.toJSON())}toJSON(){return{filter:super.toQuery(),update:this.$update,options:c({},this.$options)}}then(t,a){return this.start().then(t,a)}catch(t){return this.start().catch(t)}finally(t){return this.start().finally(t)}stream(){return this.start().stream()}options(t){let a=qe(this.$optionsSchema,t),n=Le(a);return new r({$queries:this.$queries,$options:c(c({},this.$options),n),start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema,update:this.$update,updateSchema:this.$updateSchema})}update(t){var n;let a=qe(this.$updateSchema,t);return new r({$queries:this.$queries,$options:this.$options,start:this.$start,schemaBasic:this.$schemaBasic,schema:this.$schema,optionsSchema:this.$optionsSchema,updateSchema:this.$updateSchema,update:c(c({},(n=this.$update)!=null?n:{}),a)})}where(t,a,n){return this.addWhere({fn:"where",field:t,operator:a,value:n})}orWhere(t,a,n){return this.addWhere({fn:"orWhere",field:t,operator:a,value:n})}whereIn(t,a){return this.addIn({fn:"whereIn",field:t,value:a})}orWhereIn(t,a){return this.addIn({fn:"orWhereIn",field:t,value:a})}whereNull(t){return this.addNull({fn:"whereNull",field:t})}orWhereNull(t){return this.addNull({fn:"orWhereNull",field:t})}whereNotNull(t){return this.addNull({fn:"whereNotNull",field:t})}orWhereNotNull(t){return this.addNull({fn:"orWhereNotNull",field:t})}whereMetadata(t,a,n){return this.addMetadata({fn:"whereMetadata",field:t,operator:a,value:n})}orWhereMetadata(t,a,n){return this.addMetadata({fn:"orWhereMetadata",field:t,operator:a,value:n})}whereMetadataIn(t,a){return this.addMetadataIn({fn:"whereMetadataIn",field:t,value:a})}orWhereMetadataIn(t,a){return this.addMetadataIn({fn:"orWhereMetadataIn",field:t,value:a})}whereMetadataNull(t){return this.addMetadataNull({fn:"whereMetadataNull",field:t})}orWhereMetadataNull(t){return this.addMetadataNull({fn:"orWhereMetadataNull",field:t})}whereMetadataNotNull(t){return this.addMetadataNull({fn:"whereMetadataNotNull",field:t})}orWhereMetadataNotNull(t){return this.addMetadataNull({fn:"orWhereMetadataNotNull",field:t})}};function Wp(r,e,t){let{client:a}=r,n=new bt({start(s){return a.api.updateTransferGroupMany({transfer_group:s.filter,update:s.update,options:s.options})},schemaBasic:Cp,schema:Lt,optionsSchema:Gp,updateSchema:$t});if(e){let{filter:s,options:u}=ee(e,t),i=s,{update:l}=i,d=ae(i,["update"]);return n.where(d).options(u).update(l)}return n}var Np=ks.describe("Optional flags for input"),YE=o.enum(["finished","cancelled"]).describe("Status the transfer should be set to");var Dp=o.object({identifier:F.describe("The identifier of the transfer"),wallet:q.describe("Foreign of the wallet connected to transfers"),token:q.describe("Foreign of the token transferred"),from_wallet:q.describe("Foreign of the wallet transfers are made from"),to_wallet:q.describe("Foreign of the wallet transfers are made to"),transfer_group:q.describe("Foreign of the transfer_group the transfers are a part of"),status:z.describe("Status of the transfers"),metadata:Q}).partial(),tT=Dp.extend({update:qt}),Qo=tT.extend({options:Np.optional()}).strict().describe("Input for updateTransfers"),Uc=No.describe("Output of updateTransfers");function Bp(r,e,t){let{client:a}=r,n=new bt({start(s){return a.api.updateTransferMany({transfer:s.filter,update:s.update,options:s.options})},schemaBasic:Dp,schema:Re,optionsSchema:Np,updateSchema:qt});if(e){let{filter:s,options:u}=ee(e,t),i=s,{update:l}=i,d=ae(i,["update"]);return n.where(d).options(u).update(l)}return n}var rT=ws.describe("Optional flags for input"),aT=o.object({wallet:F.describe("Wallet foreign"),metadata:Z.shape.metadata,name:Z.shape.name,status:Z.shape.status}).partial().required({wallet:!0}),ta=aT.extend({options:rT.optional()}).strict().describe("Input for updateWallet"),Lc=Bo.describe("Output of updateWallet");var nT=p(ta);function jp(r,e,t){let{client:a}=r,n=nT.validateInputWOptions(e,t);return a.api.updateWallet({wallet:C(n.wallet),update:{metadata:n.metadata,status:n.status,name:n.name},options:n.options})}var qc=(G=>(G.aggregateTransfers="aggregateTransfers",G.createAccessToken="createAccessToken",G.createContract="createContract",G.createDeposit="createDeposit",G.createExchange="createExchange",G.createToken="createToken",G.createTransfer="createTransfer",G.createTransferGroup="createTransferGroup",G.createTransfers="createTransfers",G.createWallet="createWallet",G.createWithdrawal="createWithdrawal",G.exportBalanceHistory="exportBalanceHistory",G.exportTokens="exportTokens",G.exportTransferGroups="exportTransferGroups",G.exportTransfers="exportTransfers",G.exportWallets="exportWallets",G.findBalances="findBalances",G.findTokens="findTokens",G.findTransferGroups="findTransferGroups",G.findTransfers="findTransfers",G.findWallets="findWallets",G.getBalance="getBalance",G.getBalanceHistory="getBalanceHistory",G.getExport="getExport",G.getFlags="getFlags",G.getStatistics="getStatistics",G.getToken="getToken",G.getTransfer="getTransfer",G.getTransferGroup="getTransferGroup",G.getWallet="getWallet",G.healthcheck="healthcheck",G.listExports="listExports",G.reverseTransfer="reverseTransfer",G.reverseTransferGroup="reverseTransferGroup",G.reverseTransfers="reverseTransfers",G.setFlags="setFlags",G.updateToken="updateToken",G.updateTransfer="updateTransfer",G.updateTransferGroup="updateTransferGroup",G.updateTransferGroups="updateTransferGroups",G.updateTransfers="updateTransfers",G.updateWallet="updateWallet",G))(qc||{}),A={aggregateTransfers:Bs,createAccessToken:js,createContract:Ps,createDeposit:Vs,createExchange:Zs,createToken:Us,createTransfer:Ks,createTransferGroup:Js,createTransfers:Qs,createWallet:Ys,createWithdrawal:Xs,exportBalanceHistory:ep,exportTokens:tp,exportTransferGroups:rp,exportTransfers:ap,exportWallets:op,findBalances:pp,findTokens:up,findTransferGroups:cp,findTransfers:lp,findWallets:dp,getBalance:fp,getBalanceHistory:mp,getExport:hp,getFlags:Tp,getStatistics:gp,getToken:xp,getTransfer:yp,getTransferGroup:bp,getWallet:Sp,healthcheck:Op,listExports:Fp,reverseTransfer:Ip,reverseTransferGroup:_p,reverseTransfers:wp,setFlags:Rp,updateToken:Ap,updateTransfer:Mp,updateTransferGroup:Ep,updateTransferGroups:Wp,updateTransfers:Bp,updateWallet:jp},oT={aggregateTransfers:p(jo),createAccessToken:p(vr),createContract:p(kr),createDeposit:p(wr),createExchange:p(Rr),createToken:p(Ar),createTransfer:p(Mr),createTransferGroup:p(Er),createTransfers:p(Gr),createWallet:p(Cr),createWithdrawal:p(Wr),exportBalanceHistory:p(Nr),exportTokens:p(Zo),exportTransferGroups:p(Lo),exportTransfers:p(qo),exportWallets:p(zo),findBalances:p(Ho),findTokens:p(Vo),findTransferGroups:p(Uo),findTransfers:p(_r),findWallets:p($o),getBalance:p(Dr),getBalanceHistory:p(Br),getExport:p(jr),getFlags:p(Pr),getStatistics:p(Vr),getToken:p(Zr),getTransfer:p(Ur),getTransferGroup:p(Lr),getWallet:p(qr),healthcheck:p($r),listExports:p(zr),reverseTransfer:p(Hr),reverseTransferGroup:p(Kr),reverseTransfers:p(Ko),setFlags:p(Qr),updateToken:p(Yr),updateTransfer:p(Xr),updateTransferGroup:p(ea),updateTransferGroups:p(Jo),updateTransfers:p(Qo),updateWallet:p(ta)};var ra=class{constructor(e,t){b(this,"api");b(this,"$connect");b(this,"config",{});this.api=e,this.$connect=e.$connect,t&&this.configure(c(c(c(c(c(c(c({},t.token&&{token:t.token}),t.sendingTimeout&&{sendingTimeout:t.sendingTimeout}),t.connectingTimeout&&{connectingTimeout:t.connectingTimeout}),t.reconnectingTimeout&&{reconnectingTimeout:t.reconnectingTimeout}),t.hooks&&{hooks:t.hooks}),t.connectionName&&{connectionName:t.connectionName}),t.httpSkipInitialAuthConnection&&{httpSkipInitialAuthConnection:t.httpSkipInitialAuthConnection}))}close(){return X(this,null,function*(){return this.api.close()})}version(){return Ua}setHook(e,t){if(typeof t!="function")throw new TypeError("Hooks can only be functions");return this.api.hooks[e]=t,this}configure(e){if(e.token&&typeof e.token!="string"&&typeof e.token!="number")throw new _e("CONFIG_INVALID",{field:"token",error:`Must be a string|number, '${e.token}' provided`});["sendingTimeout","connectingTimeout","reconnectingTimeout"].forEach(a=>{if(e[a]&&typeof e[a]!="number")throw new _e("CONFIG_INVALID",{field:a,error:`Must be a number, '${e[a]}' provided`})});let t=e.hooks;if(delete e.hooks,this.config=c(c({},this.config),e),this.config.sendingTimeout&&(this.api.sendingTimeout=this.config.sendingTimeout),t)for(let[a,n]of Object.entries(t))this.setHook(a,n);return this}getConfig(e){return this.config[e]}aggregateTransfers(e,t){return A.aggregateTransfers({client:this},e,t)}createAccessToken(e,t){return A.createAccessToken({client:this},e!=null?e:{},t)}createContract(e,t){return A.createContract({client:this},e,t)}createDeposit(e,t){return A.createDeposit({client:this},e,t)}createExchange(e,t){return A.createExchange({client:this},e,t)}createToken(e,t){return A.createToken({client:this},e,t)}createTransfer(e,t){return A.createTransfer({client:this},e,t)}createTransferGroup(e,t){return A.createTransferGroup({client:this},e!=null?e:{},t)}createTransfers(e,t){return A.createTransfers({client:this},e,t)}createWallet(e,t){return A.createWallet({client:this},e,t)}createWithdrawal(e,t){return A.createWithdrawal({client:this},e,t)}exportBalanceHistory(e,t){return A.exportBalanceHistory({client:this},e,t)}exportTokens(e,t){return A.exportTokens({client:this},e,t)}exportTransferGroups(e,t){return A.exportTransferGroups({client:this},e,t)}exportTransfers(e,t){return A.exportTransfers({client:this},e,t)}exportWallets(e,t){return A.exportWallets({client:this},e,t)}findBalances(e,t){return A.findBalances({client:this},e,t)}findTokens(e,t){return A.findTokens({client:this},e,t)}findTransferGroups(e,t){return A.findTransferGroups({client:this},e,t)}findTransfers(e,t){return A.findTransfers({client:this},e,t)}findWallets(e,t){return A.findWallets({client:this},e,t)}getBalance(e,t){return A.getBalance({client:this},e,t)}getBalanceHistory(e,t){return A.getBalanceHistory({client:this},e,t)}getExport(e,t){return A.getExport({client:this},e,t)}getFlags(e,t){return A.getFlags({client:this},e!=null?e:{},t)}getStatistics(e,t){return A.getStatistics({client:this},e!=null?e:{},t)}getToken(e,t){return A.getToken({client:this},e!=null?e:{},t)}getTransfer(e,t){return A.getTransfer({client:this},e,t)}getTransferGroup(e,t){return A.getTransferGroup({client:this},e,t)}getWallet(e,t){return A.getWallet({client:this},e,t)}healthcheck(e,t){return A.healthcheck({client:this},e!=null?e:{},t)}listExports(e,t){return A.listExports({client:this},e!=null?e:{},t)}reverseTransfer(e,t){return A.reverseTransfer({client:this},e,t)}reverseTransferGroup(e,t){return A.reverseTransferGroup({client:this},e,t)}reverseTransfers(e,t){return A.reverseTransfers({client:this},e,t)}setFlags(e,t){return A.setFlags({client:this},e!=null?e:{},t)}updateToken(e,t){return A.updateToken({client:this},e,t)}updateTransfer(e,t){return A.updateTransfer({client:this},e,t)}updateTransferGroup(e,t){return A.updateTransferGroup({client:this},e,t)}updateTransferGroups(e,t){return A.updateTransferGroups({client:this},e,t)}updateTransfers(e,t){return A.updateTransfers({client:this},e,t)}updateWallet(e,t){return A.updateWallet({client:this},e,t)}};function $c(r,e){let t=Es(r,{connectingTimeout:e==null?void 0:e.connectingTimeout,reconnectingTimeout:e==null?void 0:e.reconnectingTimeout});return new ra(t,e)}function zc(r,e){let t=Ws(r,{connectingTimeout:e==null?void 0:e.connectingTimeout,reconnectingTimeout:e==null?void 0:e.reconnectingTimeout,httpSkipInitialAuthConnection:e==null?void 0:e.httpSkipInitialAuthConnection,connectionName:e==null?void 0:e.connectionName});return new ra(t,e)}var iW=o.enum(["ws","https"]),Pp=o.object({host:o.string().describe("URL of the API"),apikey:o.string().describe("API key for the client"),apisecret:o.string().describe("API secret for the client")}).passthrough(),iT=o.object({client:o.literal("ws"),connection:Pp}),Vp=o.object({host:o.string().describe("URL of the API"),jwt:o.string().describe("Auth token for calling api")}).passthrough(),sT=o.object({client:o.literal("https"),connection:Vp}),sW=o.union([iT,sT]);function Hc(){"withResolvers"in Promise||Object.assign(Promise,{withResolvers:function(){let r,e;return{promise:new Promise((a,n)=>{r=a,e=n}),resolve:r,reject:e}}})}var Kc={aggregateTransfersFnInput:p(jo),aggregateTransfersFnOutput:p(tc),createAccessTokenFnInput:p(vr),createAccessTokenFnOutput:p(oc),createContractFnInput:p(kr),createContractFnOutput:p(ic),createDepositFnInput:p(wr),createDepositFnOutput:p(sc),createExchangeFnInput:p(Rr),createExchangeFnOutput:p(pc),createTokenFnInput:p(Ar),createTokenFnOutput:p(uc),createTransferFnInput:p(Mr),createTransferFnOutput:p(cc),createTransferGroupFnInput:p(Er),createTransferGroupFnOutput:p(lc),createTransfersFnInput:p(Gr),createTransfersFnOutput:p(dc),createWalletFnInput:p(Cr),createWalletFnOutput:p(fc),createWithdrawalFnInput:p(Wr),createWithdrawalFnOutput:p(mc),exportBalanceHistoryFnInput:p(Nr),exportBalanceHistoryFnOutput:p(hc),exportTokensFnInput:p(Zo),exportTokensFnOutput:p(gc),exportTransferGroupsFnInput:p(Lo),exportTransferGroupsFnOutput:p(yc),exportTransfersFnInput:p(qo),exportTransfersFnOutput:p(bc),exportWalletsFnInput:p(zo),exportWalletsFnOutput:p(Oc),findBalancesFnInput:p(Ho),findBalancesFnOutput:p(Fc),findTokensFnInput:p(Vo),findTokensFnOutput:p(Tc),findTransferGroupsFnInput:p(Uo),findTransferGroupsFnOutput:p(xc),findTransfersFnInput:p(_r),findTransfersFnOutput:p(nc),findWalletsFnInput:p($o),findWalletsFnOutput:p(Sc),getBalanceFnInput:p(Dr),getBalanceFnOutput:p(Ic),getBalanceHistoryFnInput:p(Br),getBalanceHistoryFnOutput:p(_c),getExportFnInput:p(jr),getExportFnOutput:p(vc),getFlagsFnInput:p(Pr),getFlagsFnOutput:p(kc),getStatisticsFnInput:p(Vr),getStatisticsFnOutput:p(wc),getTokenFnInput:p(Zr),getTokenFnOutput:p(Rc),getTransferFnInput:p(Ur),getTransferFnOutput:p(Ac),getTransferGroupFnInput:p(Lr),getTransferGroupFnOutput:p(Mc),getWalletFnInput:p(qr),getWalletFnOutput:p(Ec),healthcheckFnInput:p($r),healthcheckFnOutput:p(Gc),listExportsFnInput:p(zr),listExportsFnOutput:p(Cc),reverseTransferFnInput:p(Hr),reverseTransferFnOutput:p(Wc),reverseTransferGroupFnInput:p(Kr),reverseTransferGroupFnOutput:p(Nc),reverseTransfersFnInput:p(Ko),reverseTransfersFnOutput:p(Dc),setFlagsFnInput:p(Qr),setFlagsFnOutput:p(Bc),updateTokenFnInput:p(Yr),updateTokenFnOutput:p(jc),updateTransferFnInput:p(Xr),updateTransferFnOutput:p(Pc),updateTransferGroupFnInput:p(ea),updateTransferGroupFnOutput:p(Vc),updateTransferGroupsFnInput:p(Jo),updateTransferGroupsFnOutput:p(Zc),updateTransfersFnInput:p(Qo),updateTransfersFnOutput:p(Uc),updateWalletFnInput:p(ta),updateWalletFnOutput:p(Lc),aggregateTransferManyTxInput:p(yn),aggregateTransferManyTxOutput:p(bn),authenticationCheckTxInput:p(Sn),authenticationCheckTxOutput:p(Nu),createAccessTokenTxInput:p(On),createAccessTokenTxOutput:p(Fn),createContractTxInput:p(wn),createContractTxOutput:p(Rn),createDepositTxInput:p(An),createDepositTxOutput:p(Mn),createDistributionTxInput:p(En),createDistributionTxOutput:p(Du),createTokenTxInput:p(Gn),createTokenTxOutput:p(Cn),createTransferTxInput:p(vn),createTransferTxOutput:p(xt),createTransferGroupTxInput:p(kn),createTransferGroupTxOutput:p(yt),createTransferManyTxInput:p(Wn),createTransferManyTxOutput:p(Nn),createWalletTxInput:p(Dn),createWalletTxOutput:p(Bn),createWithdrawalTxInput:p(jn),createWithdrawalTxOutput:p(Pn),exportBalanceHistoryTxInput:p(Ln),exportBalanceHistoryTxOutput:p(qn),exportTokenManyTxInput:p(zn),exportTokenManyTxOutput:p(Hn),exportTransferGroupManyTxInput:p(Jn),exportTransferGroupManyTxOutput:p(Qn),exportTransferManyTxInput:p(Yn),exportTransferManyTxOutput:p(Xn),exportWalletManyTxInput:p(to),exportWalletManyTxOutput:p(ro),findBalanceManyTxInput:p(ao),findBalanceManyTxOutput:p(no),findTokenManyTxInput:p(gr),findTokenManyTxOutput:p($n),findTransferGroupManyTxInput:p(xr),findTransferGroupManyTxOutput:p(Kn),findTransferManyTxInput:p(mr),findTransferManyTxOutput:p(xn),findWalletManyTxInput:p(yr),findWalletManyTxOutput:p(eo),finishTransactionTxInput:p(oo),finishTransactionTxOutput:p(Pu),getBalanceTxInput:p(In),getBalanceTxOutput:p(Ye),getBalanceHistoryTxInput:p(Zn),getBalanceHistoryTxOutput:p(Un),getExportTxInput:p(Vn),getExportTxOutput:p(Ie),getFlagsTxInput:p(io),getFlagsTxOutput:p(so),getStatisticsTxInput:p(po),getStatisticsTxOutput:p(Vu),getTokenTxInput:p(mn),getTokenTxOutput:p(hn),getTokenManyTxInput:p(uo),getTokenManyTxOutput:p(Zu),getTransferTxInput:p(dn),getTransferTxOutput:p(Ne),getTransferGroupTxInput:p(Tn),getTransferGroupTxOutput:p(gn),getWalletTxInput:p(pn),getWalletTxOutput:p(cn),getWalletManyTxInput:p(co),getWalletManyTxOutput:p(Uu),healthcheckTxInput:p(lo),healthcheckTxOutput:p(fo),importActionsTxInput:p(br),importActionsTxOutput:p(Lu),listExportManyTxInput:p(mo),listExportManyTxOutput:p(ho),queryLogsTxInput:p(To),queryLogsTxOutput:p(qu),resetDatabaseTxInput:p(go),resetDatabaseTxOutput:p($u),reverseTransferTxInput:p(yo),reverseTransferTxOutput:p(bo),reverseTransferGroupTxInput:p(So),reverseTransferGroupTxOutput:p(Oo),reverseTransferGroupManyTxInput:p(Fo),reverseTransferGroupManyTxOutput:p(zu),reverseTransferManyTxInput:p(Io),reverseTransferManyTxOutput:p(_o),setFlagsTxInput:p(vo),setFlagsTxOutput:p(ko),startTransactionTxInput:p(wo),startTransactionTxOutput:p(Hu),updateTokenTxInput:p(Ro),updateTokenTxOutput:p(Ao),updateTransferTxInput:p(xo),updateTransferTxOutput:p(Sr),updateTransferGroupTxInput:p(Mo),updateTransferGroupTxOutput:p(Eo),updateTransferGroupManyTxInput:p(Go),updateTransferGroupManyTxOutput:p(Co),updateTransferManyTxInput:p(Wo),updateTransferManyTxOutput:p(No),updateWalletTxInput:p(Do),updateWalletTxOutput:p(Bo)};var Jc=o.enum(["flag","setting"]).describe("Type of the setting"),Qc=Y(Jc.options),tD=o.object({id:o.number().int().positive().describe("System defined primary key"),name:o.string().min(1).max(255).describe("name of setting. Must be unique"),value:o.string().describe("value of setting"),applied:o.boolean().describe("is setting applied"),created_at:M.describe("Datetime of the initial create"),updated_at:M.describe("Datetime of the last update"),type:Jc}).strict().describe("WapiSetting|Database settings");Hc();var pT=p(Pp),uT=p(Vp),Yc=(t=>(t.ws="ws",t.https="https",t))(Yc||{});function cT(r){let{config:e,client:t,connection:a}=r;if((t!=null?t:"ws")==="ws"){let n=pT.validateInput(a);return $c(n,e)}if(t==="https"){let n=uT.validateInput(a);return zc(n,e)}throw new TypeError("Invalid client type")}var lT={getIdentifier:pi};return hl(dT);})();