@laceio/sdk 0.1.1 → 0.1.2-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (388) hide show
  1. package/dist/{TransactionBuilder-DrB3NVTi.cjs → TransactionBuilder-CCjOn7NA.cjs} +42 -0
  2. package/dist/{TransactionBuilder-V6aLx4SV.js → TransactionBuilder-CIzdw18M.js} +1 -1
  3. package/dist/{_polyfill-buffer-patch-BnPVerlG.cjs → _polyfill-buffer-patch-CM8X7JiY.cjs} +21 -2
  4. package/dist/_polyfill-buffer-patch-yNxN4d5E.js +1467 -0
  5. package/dist/_web-crypto-random-bytes-Bo-GTcRS.js +197 -0
  6. package/dist/acc-module-4iIUv6My.cjs +27654 -0
  7. package/dist/acc-module-Cmj8EsIb.js +27624 -0
  8. package/dist/account-BOQruszJ.js +6 -0
  9. package/dist/account-BUOj4pYJ.cjs +11 -0
  10. package/dist/account-call-7wnopBq0.cjs +5 -0
  11. package/dist/account-call-B9d_2Xwi.js +4 -0
  12. package/dist/account-call-Bd4Rpbvt.cjs +323 -0
  13. package/dist/account-call-C3CkDqEC.js +276 -0
  14. package/dist/account-guards-BtjTGxDZ.cjs +42 -0
  15. package/dist/account-guards-D9Lu5T3W.js +36 -0
  16. package/dist/account-tokens-DvkOFVON.js +16 -0
  17. package/dist/account-tokens-nwcvwLu4.cjs +21 -0
  18. package/dist/{activity-type.stable-BJEfeLxL.cjs → activity-type-Ch6ljxBy.cjs} +2 -1
  19. package/dist/{activity-type.stable-C76_hWd7.js → activity-type-GsJGWs-3.js} +2 -1
  20. package/dist/address-B9ntKL8K.js +13761 -0
  21. package/dist/address-BXp-mY8H.cjs +11270 -0
  22. package/dist/{address-book-address-validator-DIUolI-s.js → address-book-address-validator-0J9XAADH.js} +2 -2
  23. package/dist/address-book-address-validator-DK0dnsRS.cjs +41 -0
  24. package/dist/address-book-address-validator-Di_ywo8M.js +39 -0
  25. package/dist/{address-book-address-validator-DNwQGlOB.cjs → address-book-address-validator-Dte_YQ2L.cjs} +2 -2
  26. package/dist/artefact-loader-BWWYAD7E.cjs +183 -0
  27. package/dist/artefact-loader-Dik4HIfv.js +160 -0
  28. package/dist/auto-dismiss-failure-on-success-C-qoJuid.cjs +37 -0
  29. package/dist/auto-dismiss-failure-on-success-s8MGDEIu.js +31 -0
  30. package/dist/bip32-D6wd_QMn.cjs +3851 -0
  31. package/dist/bitcoin-data-provider-BYPSmuZS.js +21 -0
  32. package/dist/bitcoin-data-provider-w1oEDSU3.cjs +26 -0
  33. package/dist/bitcoin.cjs +45 -0
  34. package/dist/bitcoin.d.ts +29906 -1
  35. package/dist/bitcoin.js +20 -0
  36. package/dist/{blockfrost-tx-submit-provider-DPTrapz-.js → blockfrost-tx-submit-provider-CBWQ0wK9.js} +5 -157
  37. package/dist/{blockfrost-tx-submit-provider-BAIzV5o3.cjs → blockfrost-tx-submit-provider-CLNQ5ycR.cjs} +3 -167
  38. package/dist/bn-d3nSOIf7.cjs +2553 -0
  39. package/dist/browser-B1eMbDwh.js +7468 -0
  40. package/dist/bytes.vo-BB7_4JK6.js +23 -0
  41. package/dist/bytes.vo-BNRquqaO.cjs +34 -0
  42. package/dist/cardano-DfPwhwm-.js +3 -0
  43. package/dist/{cardano-network-id.vo-DSxrFk9S.cjs → cardano-network-id.vo-BEDPn6Li.cjs} +1 -1
  44. package/dist/{cardano-network-id.vo-CK1tNQDg.js → cardano-network-id.vo-Cfpvbod9.js} +1 -1
  45. package/dist/cardano.cjs +22 -18
  46. package/dist/cardano.d.ts +16956 -1716
  47. package/dist/cardano.js +16 -11
  48. package/dist/client-DXBLHk7K.cjs +808 -0
  49. package/dist/codecs-Cswkg7Tm.cjs +4051 -0
  50. package/dist/codecs-Dc1Krpbt.js +3903 -0
  51. package/dist/{const-C84qHkjp.js → const-BJfIK_G-.js} +4 -4
  52. package/dist/const-BhYOdznB.cjs +42 -0
  53. package/dist/const-BsnjG2_Q.cjs +32071 -0
  54. package/dist/const-CUnCl5U0.js +13 -0
  55. package/dist/{const-DXk2tFyv.js → const-CjmfjBP3.js} +1 -1
  56. package/dist/{const-BDEg2Trq.cjs → const-D-eZIS4n.cjs} +4 -4
  57. package/dist/const-D0CbQlo4.js +154 -0
  58. package/dist/{const-BY8B3_0_.cjs → const-iwzZEE_w.cjs} +1 -1
  59. package/dist/contract-1R86jhSw.js +171 -0
  60. package/dist/contract-MKLzYVkW.cjs +189 -0
  61. package/dist/create-add-accounts-Brqk84vF.js +102 -0
  62. package/dist/create-add-accounts-DzXIh7Ot.cjs +114 -0
  63. package/dist/{delegation-tx-builder-CRpLP6jH.cjs → delegation-tx-builder-CCjiakoy.cjs} +6 -6
  64. package/dist/{delegation-tx-builder-CGVqlaFE.js → delegation-tx-builder-DZFjHDS8.js} +5 -5
  65. package/dist/{deregistration-tx-builder-B-CrUyX6.js → deregistration-tx-builder-Bf6xAYp4.js} +5 -5
  66. package/dist/{deregistration-tx-builder-DZGwB4cz.cjs → deregistration-tx-builder-CQP35yex.cjs} +6 -6
  67. package/dist/device-commitment-hex.vo-5wFtQvDS.js +26 -0
  68. package/dist/device-commitment-hex.vo-CT3RmAug.cjs +31 -0
  69. package/dist/device-readers-CUHYoYOH.js +145 -0
  70. package/dist/device-readers-CdxS2btd.cjs +168 -0
  71. package/dist/device-readers-D_JZeNL2.cjs +8 -0
  72. package/dist/device-readers-DwSNCGPP.js +4 -0
  73. package/dist/dist-BMi5ZjEq.cjs +43175 -0
  74. package/dist/dist-BtIq4XFn.cjs +535 -0
  75. package/dist/dist-C3SHC_Ho.cjs +1394 -0
  76. package/dist/dist-CykEjYEX.cjs +3814 -0
  77. package/dist/dist-Dcsxh3be.cjs +3452 -0
  78. package/dist/dist-DqJfSlTd.cjs +4413 -0
  79. package/dist/dist-nTZ70qj7.cjs +1306 -0
  80. package/dist/{earn-rewards-tx-builder-BDbTDZmD.js → earn-rewards-tx-builder-Bsga3yFb.js} +5 -5
  81. package/dist/{earn-rewards-tx-builder-D5sUT5v8.cjs → earn-rewards-tx-builder-GuxofYns.cjs} +6 -6
  82. package/dist/enc-key-circuits-B7BjgUL9.js +13 -0
  83. package/dist/enc-key-circuits-BLrZrBVI.cjs +24 -0
  84. package/dist/english-Byb9M0E_.cjs +2057 -0
  85. package/dist/envelopes-BGoO_v8m.js +1621 -0
  86. package/dist/envelopes-CH25R-DN.cjs +1722 -0
  87. package/dist/errors-BIftM8ZN.cjs +688 -0
  88. package/dist/errors-DSq5wUwt.js +466 -0
  89. package/dist/esm-HBSUQw3w.js +384 -0
  90. package/dist/esm-LZuaZjMf.cjs +389 -0
  91. package/dist/experimental.cjs +7349 -0
  92. package/dist/experimental.d.ts +86273 -0
  93. package/dist/experimental.js +7184 -0
  94. package/dist/gated-call-CDCVZIK-.cjs +5 -0
  95. package/dist/gated-call-D-tT7P_t.js +722 -0
  96. package/dist/gated-call-D_VT2quk.js +4 -0
  97. package/dist/gated-call-DgJm1Mi_.cjs +787 -0
  98. package/dist/grant-circuits-DswmW3nI.cjs +71 -0
  99. package/dist/grant-circuits-Jxb5y1HW.js +42 -0
  100. package/dist/grant-rules-By07_eDi.js +6824 -0
  101. package/dist/grant-rules-BzVTWXS7.cjs +7099 -0
  102. package/dist/grant-spend-B3Md9L0n.js +215 -0
  103. package/dist/grant-spend-oWmzRsjH.cjs +217 -0
  104. package/dist/grant-status-B2y49iIu.js +2688 -0
  105. package/dist/grant-status-DOr3t_u8.cjs +2820 -0
  106. package/dist/grants-2BZ-qEVQ.js +5 -0
  107. package/dist/grants-BPoLSiMt.cjs +18 -0
  108. package/dist/grants-BoI5uwSF.cjs +272 -0
  109. package/dist/grants-CtofFu-e.js +213 -0
  110. package/dist/{group-cardano-addresses-by-account-B533oVXR.cjs → group-cardano-addresses-by-account-Bp0g4wEY.cjs} +3 -39
  111. package/dist/{group-cardano-addresses-by-account-RHKoEskR.js → group-cardano-addresses-by-account-SR8MMrZf.js} +5 -35
  112. package/dist/{guarded-transaction-signer-Bxl6_XNd.cjs → guarded-transaction-signer-MFpPg98D.cjs} +17 -18
  113. package/dist/{guarded-transaction-signer-CpKLj8Kp.js → guarded-transaction-signer-P6Rp1faj.js} +8 -15
  114. package/dist/hex-D9ITYbwt.cjs +263 -0
  115. package/dist/hex-mkXcV3pN.js +191 -0
  116. package/dist/http-client-B3N-TMxu.cjs +167 -0
  117. package/dist/http-client-TRlhDZGh.js +155 -0
  118. package/dist/identity-BMLuufva.cjs +263 -0
  119. package/dist/identity-DII6f-h7.js +233 -0
  120. package/dist/in-memory-wallet-integration-B2xzxORj.cjs +20741 -0
  121. package/dist/in-memory-wallet-integration-CBRiPjLO.js +130 -0
  122. package/dist/in-memory-wallet-integration-CULUB5Tf.cjs +240 -0
  123. package/dist/{in-memory-wallet-integration-D-qn65Kx.js → in-memory-wallet-integration-ChIOirMW.js} +5 -2
  124. package/dist/{in-memory-wallet-integration-Croiuopx.js → in-memory-wallet-integration-CljprQQV.js} +7 -104
  125. package/dist/{in-memory-wallet-integration-DVh9sRXa.cjs → in-memory-wallet-integration-Cm6P8sk6.cjs} +3 -2
  126. package/dist/in-memory-wallet-integration-TM9bBphA.js +20738 -0
  127. package/dist/{in-memory-wallet-integration-CnLYeX4-.cjs → in-memory-wallet-integration-t9I00R_V.cjs} +17 -108
  128. package/dist/index.cjs +84 -47
  129. package/dist/index.d.ts +37496 -10033
  130. package/dist/index.js +52 -24
  131. package/dist/{init-CLHuAMB-.js → init-0zzs9aqU.js} +4 -4
  132. package/dist/{init-U8c9yHYx.cjs → init-5KcGcBb5.cjs} +1 -1
  133. package/dist/init-8v_n8boO.js +1177 -0
  134. package/dist/{init-CigestoM.js → init-B3-1ghyx.js} +2 -2
  135. package/dist/init-B8U3ABhS.cjs +107 -0
  136. package/dist/init-BJn-8_hf.js +141 -0
  137. package/dist/init-BPU3j8sT.cjs +6 -0
  138. package/dist/init-BRzH6xu-2.cjs +2797 -0
  139. package/dist/init-BmzfDaKL.js +1142 -0
  140. package/dist/{init-C-jErzp5.cjs → init-BopV9ed4.cjs} +2 -2
  141. package/dist/init-BpHTq2R5.js +105 -0
  142. package/dist/init-BpSITBfF.js +39 -0
  143. package/dist/{init-DX4WyB0R.cjs → init-BrdVzxei.cjs} +3 -3
  144. package/dist/{init-LfyMo-sS.cjs → init-BwkU0ruo.cjs} +2 -2
  145. package/dist/{init-CB__aLD7.cjs → init-C-G32J12.cjs} +2 -2
  146. package/dist/init-C00gw1zi.js +422 -0
  147. package/dist/{init-TkPq_Ny_.js → init-C2RgrfZe.js} +1 -1
  148. package/dist/{init-DcYY6zMD.js → init-C8URA2OX.js} +1 -1
  149. package/dist/init-CDkRynJa.js +2796 -0
  150. package/dist/{init-Cg9XdAru.js → init-CNM5m7M2.js} +4 -4
  151. package/dist/init-CR7BfztQ.cjs +18 -0
  152. package/dist/{init-CSHwHnfg.cjs → init-CSDpdu0Q.cjs} +2 -2
  153. package/dist/{init-aJHl-7AO.js → init-CX0AMQUn.js} +2 -2
  154. package/dist/{init-FMGDET-9.js → init-CfTbSEKy.js} +259 -60
  155. package/dist/{init-CR6tpw1B.js → init-Cigr_tKx.js} +47 -43
  156. package/dist/init-CuW7rHNA.js +3584 -0
  157. package/dist/{init-CFYsq82V.js → init-CyAY4Lzl.js} +1 -1
  158. package/dist/init-Cz0rz5fU.cjs +3585 -0
  159. package/dist/{init-BKhH6mVR.cjs → init-D6BxBs7e.cjs} +1 -1
  160. package/dist/init-D8OeObDF.cjs +1141 -0
  161. package/dist/init-D9g1HXYf.cjs +40 -0
  162. package/dist/{init-CNLGJJRx.js → init-DA7zmptx.js} +1 -1
  163. package/dist/{init-DkIc5nqF.cjs → init-DFMiP2ZH.cjs} +1 -1
  164. package/dist/{init-zSzCjoor.js → init-DFjT8YvT.js} +4 -4
  165. package/dist/init-DGjXwWs2.cjs +143 -0
  166. package/dist/init-DHrCbpkW.cjs +121 -0
  167. package/dist/{init-B64zCLxG.cjs → init-DUF4ar8P.cjs} +4 -4
  168. package/dist/init-DlqJuHhl.js +119 -0
  169. package/dist/{init-y2Ra0vZP.js → init-Dnsv155v.js} +3 -3
  170. package/dist/init-DrRdf5sZ.cjs +1176 -0
  171. package/dist/init-DuYENxci.js +17 -0
  172. package/dist/{init-D6DBUsD3.cjs → init-Dv3zKj0r.cjs} +4 -4
  173. package/dist/{init-BtzMZ7Pk.cjs → init-Dy-05ktr.cjs} +1 -1
  174. package/dist/{init-BsCBAGWf.cjs → init-EP0CUWNK.cjs} +2 -2
  175. package/dist/{init-BJVU54pI.cjs → init-EhzD7a8i.cjs} +1 -1
  176. package/dist/{init-w9GEs73W.js → init-Fw89ZmrR.js} +2 -2
  177. package/dist/init-GsT2AEa4.cjs +424 -0
  178. package/dist/{init-Rxohwpmu.js → init-NCjgwCZy.js} +2 -2
  179. package/dist/{init-DxUHsN53.cjs → init-NdhG_VrF.cjs} +6 -6
  180. package/dist/{init-DDdhguVC.js → init-SZ01tARX2.js} +2 -2
  181. package/dist/{init-BAJJzBza.js → init-Y3mkB4XS.js} +2 -2
  182. package/dist/init-c4l6r-o-.js +5 -0
  183. package/dist/{init-Dku4b2lG.js → init-kEfUTuG2.js} +1 -1
  184. package/dist/{init-C7IeJwQR.cjs → init-lzHt4Cli.cjs} +256 -59
  185. package/dist/{init-anYu6XB7.cjs → init-rmt7-fQE.cjs} +2 -2
  186. package/dist/{init-C4Bkib9u.cjs → init-zU-_9Gsp.cjs} +67 -65
  187. package/dist/{is-retriable-error-BU0e3hVI.js → is-retriable-error-BUiVJDwH.js} +1 -1
  188. package/dist/{is-retriable-error-CeeuHqDa.cjs → is-retriable-error-Dpt860if.cjs} +1 -1
  189. package/dist/jubjub-authoriser-D7zDXu3V.js +86 -0
  190. package/dist/jubjub-authoriser-Dgu6o3Sv.cjs +87 -0
  191. package/dist/key-source-5oUBFiC7.cjs +583 -0
  192. package/dist/key-source-B08HukZg.js +2550 -0
  193. package/dist/keyDerivation-D3k9XyHg.js +4077 -0
  194. package/dist/keyDerivation-u0nBA93T.cjs +274 -0
  195. package/dist/{lace-context-CZcNHr4M.js → lace-context-BZciB9c7.js} +4 -4
  196. package/dist/{lace-context-fJTDghdp.cjs → lace-context-DgR6vLli.cjs} +4 -4
  197. package/dist/lib--iqvW4O_.js +2354 -0
  198. package/dist/lib-Yk6Upl5D.cjs +2359 -0
  199. package/dist/{libsodium-wrappers-UH0LaOUE.js → libsodium-wrappers-BhbOA8dQ.js} +3 -1647
  200. package/dist/midnight-account-id.vo-0x9X-r3l.cjs +10 -0
  201. package/dist/midnight-account-id.vo-DjCAGcqc.js +5 -0
  202. package/dist/midnight-engine-DpemplKO.js +5 -0
  203. package/dist/midnight-engine-xU1wotne.cjs +6 -0
  204. package/dist/midnight-wallet-DIsAlSn6.js +18 -0
  205. package/dist/midnight-wallet-XTZc2li7.cjs +24 -0
  206. package/dist/midnight.cjs +1408 -0
  207. package/dist/midnight.d.ts +28934 -0
  208. package/dist/midnight.js +1352 -0
  209. package/dist/modules-cardano-B1nDUWqy.js +995 -0
  210. package/dist/modules-cardano-BYeYHrRm.cjs +1108 -0
  211. package/dist/node-relay-DWe1U0w2.cjs +49 -0
  212. package/dist/node-relay-h4i5IlAQ.js +48 -0
  213. package/dist/outputs-Bd2yZVjx.js +720 -0
  214. package/dist/outputs-CJoQBIA2.cjs +990 -0
  215. package/dist/pbkdf2-CIW-oWrm.cjs +1337 -0
  216. package/dist/pending-operation-B0_P78Jo.cjs +26 -0
  217. package/dist/pending-operation-BIS6mpjB.js +21 -0
  218. package/dist/providers-FjhM47BH.cjs +388 -0
  219. package/dist/providers-WtiSuxFu.js +365 -0
  220. package/dist/redacted-BmE2aXqr.js +81 -0
  221. package/dist/redacted-CRZJLS3w.cjs +86 -0
  222. package/dist/{retry-config-DC5IMaH7.cjs → retry-config-BaCfVC1H.cjs} +1 -1
  223. package/dist/{retry-config-BcUmMS--.js → retry-config-Dmgt28wM.js} +1 -1
  224. package/dist/safe-buffer-B_vMqJWU.js +43 -0
  225. package/dist/safe-buffer-DYOwEfHB.cjs +48 -0
  226. package/dist/sdk-Cb-gZnS9.js +1241 -0
  227. package/dist/sdk-DffwmX8b.cjs +1439 -0
  228. package/dist/sdk-init-Bln9rFtn.js +4138 -0
  229. package/dist/sdk-init-CYViTJY_.cjs +3841 -0
  230. package/dist/{seam-cardano-CATqBEyK.js → seam-cardano-B_etH4F4.js} +1 -1
  231. package/dist/{bytes.vo-TgiwogWF.js → secret-box-DUR0ACYz.js} +3 -25
  232. package/dist/{bytes.vo-Ck5u40RA.cjs → secret-box-DrjLZuS1.cjs} +1 -35
  233. package/dist/send-proof-progress-C-ljq1x5.js +30 -0
  234. package/dist/send-proof-progress-vmsaSfbz.cjs +47 -0
  235. package/dist/side-effects-BnqYz7Nl.js +768 -0
  236. package/dist/side-effects-CngaeXi0.cjs +804 -0
  237. package/dist/sign-bitcoin-transaction-with-seed-D4z62-jV.js +147 -0
  238. package/dist/sign-bitcoin-transaction-with-seed-DsLYXnCY.cjs +158 -0
  239. package/dist/signer-3fk8lZtE.cjs +7 -0
  240. package/dist/signer-CsL28DrK.cjs +121 -0
  241. package/dist/signer-DGluibtn.js +92 -0
  242. package/dist/signer-RqB5pu3K.js +2 -0
  243. package/dist/signer-factory-BA7WFJVZ.js +282 -0
  244. package/dist/signer-factory-Cwd6o-lG.cjs +281 -0
  245. package/dist/{signer-factory-9URFliA5.js → signer-factory-DObB55D4.js} +6 -3
  246. package/dist/signer-factory-DhZiE03y.cjs +149 -0
  247. package/dist/{signer-factory-BWGUmnvm.cjs → signer-factory-Ds6G2AZk.cjs} +4 -3
  248. package/dist/signer-factory-hzSRaIw2.js +148 -0
  249. package/dist/{slice-CuHUaPZx.cjs → slice-7G2xxYKJ.cjs} +3 -3
  250. package/dist/{slice-DZmQJNV8.cjs → slice-B4CdYoPu.cjs} +2 -2
  251. package/dist/slice-BPNuHKfw.js +9091 -0
  252. package/dist/{slice-DGcNrbPR.cjs → slice-Bg6HEr3K.cjs} +4 -4
  253. package/dist/{slice-DtaO72qY.cjs → slice-Bs2aMERu.cjs} +3 -3
  254. package/dist/{slice-HeHCv3bl.cjs → slice-C34iOOUH.cjs} +7 -7
  255. package/dist/{slice-Do2R2CYW.cjs → slice-C9TT5KhY.cjs} +6 -6
  256. package/dist/{slice-eIwcwKHI.js → slice-CK07EBCo.js} +4 -4
  257. package/dist/{slice-CnyWevM9.js → slice-CU80pbiu.js} +3 -3
  258. package/dist/{slice-CobanYgn.js → slice-CwyYrh1H.js} +2 -2
  259. package/dist/slice-Czfp6t84.cjs +436 -0
  260. package/dist/{slice-d0p6-xj5.js → slice-D-9aPKG-.js} +6 -6
  261. package/dist/{slice-maaskdUn.js → slice-DBpJ2QGf.js} +6 -6
  262. package/dist/{slice-mxLQ_FeY.cjs → slice-DTZTiJle.cjs} +352 -39
  263. package/dist/{slice-zJ9XVYjZ.js → slice-Da426sf9.js} +1 -1
  264. package/dist/{slice-D11m2EKl.cjs → slice-DayJvMRD.cjs} +1 -1
  265. package/dist/slice-DnBWfA-k.cjs +9109 -0
  266. package/dist/{slice-oqm_r1cS.cjs → slice-DnG-yvpI.cjs} +2 -2
  267. package/dist/{slice-BNu73oBa.js → slice-DyNs7oWp.js} +2 -2
  268. package/dist/{slice-CB4SnzMm.js → slice-GwiiJRoq.js} +3 -3
  269. package/dist/slice-oWnc7YVD.js +412 -0
  270. package/dist/{slice-B2PhoWAg.js → slice-qt0uBExh.js} +325 -37
  271. package/dist/slice-t8Gzj55G2.cjs +106 -0
  272. package/dist/slice-t8Q1cHm-.js +88 -0
  273. package/dist/src-BDzYIksE.cjs +20637 -0
  274. package/dist/src-BFoefPv_.js +20755 -0
  275. package/dist/store-B1Lq3cEf.cjs +66 -0
  276. package/dist/store-DuBG8qh5.js +37 -0
  277. package/dist/submit-Bs77dPn_.cjs +413 -0
  278. package/dist/submit-DOv8Z0Vf.js +336 -0
  279. package/dist/submit-bitcoin-tx-D6oYgH5S.js +983 -0
  280. package/dist/submit-bitcoin-tx-goFuRL7K.cjs +1049 -0
  281. package/dist/{sync-operation-utils-BYXLO80m.js → sync-operation-utils-31iFLExW.js} +2 -38
  282. package/dist/{sync-operation-utils-SdPbwFoD.cjs → sync-operation-utils-COIZ66-I.cjs} +1 -67
  283. package/dist/token-id-mapper-Bnds3xKH.cjs +18 -0
  284. package/dist/{token-id-mapper-DsPAL6Nh.cjs → token-id-mapper-CVyQJUKY.cjs} +2 -2
  285. package/dist/token-id-mapper-CnKHQ8DV.js +16 -0
  286. package/dist/{token-id-mapper-B2ivlLv3.js → token-id-mapper-D29Ggv8h.js} +2 -2
  287. package/dist/tokens-Cevp7rdU.cjs +62 -0
  288. package/dist/tokens-Diw4MLRM.js +44 -0
  289. package/dist/types-B8uiJn-X.js +12 -0
  290. package/dist/types-BHC12eSa.js +33 -0
  291. package/dist/types-CJT6XF2c.js +10 -0
  292. package/dist/types-CLRUYpfe.cjs +23 -0
  293. package/dist/types-Cc3mC8u0.cjs +50 -0
  294. package/dist/types-DWbVZpnF.cjs +15 -0
  295. package/dist/unwrap-provider-result-BZSiwabU.js +32 -0
  296. package/dist/unwrap-provider-result-ZqfBsTkk.cjs +39 -0
  297. package/dist/{util-CGzqQ8IV.cjs → util-Bu4W5lF4.cjs} +1 -1
  298. package/dist/{util-BaLzwa32.js → util-Cp5cZkfK.js} +1 -1
  299. package/dist/{utils-o8aMjfln.js → utils-BfBEUvWA.js} +2 -2
  300. package/dist/utils-DFwzEvbv.js +65 -0
  301. package/dist/{utils-5JvjbqH3.cjs → utils-DsElZgCI.cjs} +7 -1
  302. package/dist/utils-IXxR-Djh.cjs +112 -0
  303. package/dist/v8Signatures-CO_Uloy7.cjs +71 -0
  304. package/dist/{vote-delegation-tx-builder-BpEMSti4.cjs → vote-delegation-tx-builder-BUg1S2Ep.cjs} +6 -6
  305. package/dist/{vote-delegation-tx-builder-CmKv6GoG.js → vote-delegation-tx-builder-C6FiS7zI.js} +5 -5
  306. package/dist/watch-CUEvcP-V.js +21997 -0
  307. package/dist/watch-DMF2s-II.cjs +52281 -0
  308. package/package.json +96 -4
  309. package/dist/account-guards.stable-B1DSSh9D.cjs +0 -10
  310. package/dist/account-guards.stable-JRQ5qx2V.js +0 -5
  311. package/dist/codecs-B7X9pAsK.cjs +0 -1945
  312. package/dist/codecs-CC1Xjntz.js +0 -1882
  313. package/dist/init-Bv53hpLM.js +0 -19
  314. package/dist/init-CRbjI7p1.js +0 -3494
  315. package/dist/init-DAna1KCg.cjs +0 -3495
  316. package/dist/init-DGe47B22.cjs +0 -364
  317. package/dist/init-DMtyvYfC.cjs +0 -21
  318. package/dist/init-TkPDD750.js +0 -363
  319. package/dist/modules-cardano-BDvuL4Xx.js +0 -5248
  320. package/dist/modules-cardano-D2G3De2P.cjs +0 -5432
  321. package/dist/slice-CGVHXHDt.cjs +0 -125
  322. package/dist/slice-DhvF7L6X.js +0 -107
  323. /package/dist/{account-id.vo-LvCBVn5r.cjs → account-id.vo-DwqFjK5u.cjs} +0 -0
  324. /package/dist/{account-id.vo-MYSI7YFm.js → account-id.vo-OPz2v-JZ.js} +0 -0
  325. /package/dist/{actions-DdGbj7c7.cjs → actions-B2BJ4RTy.cjs} +0 -0
  326. /package/dist/{actions-9QSQR-GB.js → actions-iLXdgL5Y.js} +0 -0
  327. /package/dist/{apply-vkey-witnesses-ClZbpk5w.js → apply-vkey-witnesses-BKx3lcs0.js} +0 -0
  328. /package/dist/{apply-vkey-witnesses-CLzVSWxl.cjs → apply-vkey-witnesses-ZnFS0jnJ.cjs} +0 -0
  329. /package/dist/{asyncoption-Cw07zPH7.js → asyncoption-CruEYOBI.js} +0 -0
  330. /package/dist/{asyncoption-DYoGuQfP.cjs → asyncoption-i0VbqVTq.cjs} +0 -0
  331. /package/dist/{bignum.vo-B0rK_PQ1.js → bignum.vo-CEXOIew0.js} +0 -0
  332. /package/dist/{bignum.vo-DsG3kNiZ.cjs → bignum.vo-hx2kuqlA.cjs} +0 -0
  333. /package/dist/{bip32ed25519-1ApqeAZk.cjs → bip32ed25519-B7Yat217.cjs} +0 -0
  334. /package/dist/{bip32ed25519-DetAdGwD.js → bip32ed25519-FQ8qvdcq.js} +0 -0
  335. /package/dist/{blake2b-DOEVc57D.js → blake2b-BiQTw3GC.js} +0 -0
  336. /package/dist/{blake2b-B9tftbvG.cjs → blake2b-DEeVUdKR.cjs} +0 -0
  337. /package/dist/{blockchain-network-id.vo-BXpZhvvQ.cjs → blockchain-network-id.vo-BAKEwGjG.cjs} +0 -0
  338. /package/dist/{blockchain-network-id.vo-DNRkuT5B.js → blockchain-network-id.vo-CiVykuqG.js} +0 -0
  339. /package/dist/{blockingWithLatestFrom-C5wp_uA-.js → blockingWithLatestFrom-Cd8c8EPG.js} +0 -0
  340. /package/dist/{blockingWithLatestFrom-DY8OPg0w.cjs → blockingWithLatestFrom-D8kBPBMX.cjs} +0 -0
  341. /package/dist/{cardano-network-id-to-network-type-CrZfUcyP.js → cardano-network-id-to-network-type-BWwzeEtM.js} +0 -0
  342. /package/dist/{cardano-network-id-to-network-type-BDTF-HmK.cjs → cardano-network-id-to-network-type-C0ufJOyE.cjs} +0 -0
  343. /package/dist/{cardano-tx-id.vo-BPhV-AmZ.cjs → cardano-tx-id.vo-TLjJZHCI.cjs} +0 -0
  344. /package/dist/{cardano-tx-id.vo-DF9NzZXk.js → cardano-tx-id.vo-eVnKuzlm.js} +0 -0
  345. /package/dist/{composite-signer-factory-_46QsNBz.js → composite-signer-factory-CR8YHA1y.js} +0 -0
  346. /package/dist/{composite-signer-factory-BpF1mIYA.cjs → composite-signer-factory-m5cVs9h_.cjs} +0 -0
  347. /package/dist/{error-CNIquqT5.cjs → error-Cb3EnD0u.cjs} +0 -0
  348. /package/dist/{error-BCp9NkPi.js → error-DIZOY2Lw.js} +0 -0
  349. /package/dist/{esm-browser-C93Q-EOI.js → esm-browser-MG97cre9.js} +0 -0
  350. /package/dist/{esm-browser-DTc9IK3D.cjs → esm-browser-bweqfBlL.cjs} +0 -0
  351. /package/dist/{feature-flag-key.vo-ofrB6ZVQ.js → feature-flag-key.vo-DN_-4-sG.js} +0 -0
  352. /package/dist/{feature-flag-key.vo-BPz-ZAp6.cjs → feature-flag-key.vo-RlfHL3hq.cjs} +0 -0
  353. /package/dist/{first-state-of-status-OROkXcRv.cjs → first-state-of-status-CbT7hPa4.cjs} +0 -0
  354. /package/dist/{first-state-of-status-DQnMT3ya.js → first-state-of-status-unPynOuM.js} +0 -0
  355. /package/dist/{init-Es3wHW7D.js → init-829HRYcz.js} +0 -0
  356. /package/dist/{init-CKipPE_c.js → init-A-VyGSNW2.js} +0 -0
  357. /package/dist/{init-DFQQ9dTW.cjs → init-Atisw4x2.cjs} +0 -0
  358. /package/dist/{init-C5CEZ1m0.cjs → init-BFcvPHL-.cjs} +0 -0
  359. /package/dist/{init-IAk_CkGa.cjs → init-BgNobbNq.cjs} +0 -0
  360. /package/dist/{init-cqN3uX2j.js → init-atCFur0v.js} +0 -0
  361. /package/dist/{is-redux-persist-state-CTn3WZVh.cjs → is-redux-persist-state-BCFnSm36.cjs} +0 -0
  362. /package/dist/{is-redux-persist-state-Cxcd0_bM.js → is-redux-persist-state-yBfq0h_E.js} +0 -0
  363. /package/dist/{key-value-store-8cMzeNyG.js → key-value-store--W3SrMaw.js} +0 -0
  364. /package/dist/{key-value-store-DUAepXQf.cjs → key-value-store-C2Xt5Emp.cjs} +0 -0
  365. /package/dist/{repo-slice-WxetRhMY.cjs → repo-slice-7X4AYYVm.cjs} +0 -0
  366. /package/dist/{repo-slice-DwyMhCR1.js → repo-slice-RxFm0zDZ.js} +0 -0
  367. /package/dist/{reselect-CRDqmQY9.cjs → reselect-Bd94u0K-.cjs} +0 -0
  368. /package/dist/{reselect-C06X06oX.js → reselect-CGoLzEPv.js} +0 -0
  369. /package/dist/{serializable-B8GahgE1.js → serializable-BHdKIgk3.js} +0 -0
  370. /package/dist/{serializable-CRdnFaLZ.cjs → serializable-BxHkoPdk.cjs} +0 -0
  371. /package/dist/{slice-D11FHQuQ.cjs → slice-BiRsDKOK.cjs} +0 -0
  372. /package/dist/{slice-Be7hj4Iy.js → slice-Bk0Sv05J.js} +0 -0
  373. /package/dist/{slice-FioKeHtA.cjs → slice-Dqw1ecum.cjs} +0 -0
  374. /package/dist/{slice-B87b52iM.js → slice-obCSLm1x.js} +0 -0
  375. /package/dist/{src-vq1wS9sZ.js → src-BlxEp6Mm.js} +0 -0
  376. /package/dist/{src-BTPIvlDI.cjs → src-Cqp0B2M_.cjs} +0 -0
  377. /package/dist/{time.vo-CQ8pSXz2.cjs → time.vo-D3wWRw9L.cjs} +0 -0
  378. /package/dist/{time.vo-DkYYGYp6.js → time.vo-tNheinXm.js} +0 -0
  379. /package/dist/{toEmpty-CgAl3097.js → toEmpty-8Zax1MPd.js} +0 -0
  380. /package/dist/{toEmpty-DAMmNB5r.cjs → toEmpty-CYAbupM4.cjs} +0 -0
  381. /package/dist/{token-id.vo-ClsroxHO.js → token-id.vo-Bvwhr3ZE.js} +0 -0
  382. /package/dist/{token-id.vo-BxG9TG0O.cjs → token-id.vo-DXv5uS9n.cjs} +0 -0
  383. /package/dist/{util-DxzlYNS5.js → util-C8a4fA9p.js} +0 -0
  384. /package/dist/{util-CmdAhheh.cjs → util-CzeB3hfa.cjs} +0 -0
  385. /package/dist/{util-selector-CcK-GAdE.js → util-selector-BSTsxgne.js} +0 -0
  386. /package/dist/{util-selector-BcAncU4L.cjs → util-selector-BWPH68_l.cjs} +0 -0
  387. /package/dist/{while-active-BpppWuCs.js → while-active-B0lWy_6l.js} +0 -0
  388. /package/dist/{while-active-Dhc2LwOm.cjs → while-active-Dsowp0Fi.cjs} +0 -0
@@ -0,0 +1,2354 @@
1
+ import { t as __commonJSMin } from "./rolldown-runtime-OvD0k9op.js";
2
+ //#region ../../node_modules/bottleneck/lib/parser.js
3
+ var require_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
4
+ exports.load = function(received, defaults, onto = {}) {
5
+ var k, ref, v;
6
+ for (k in defaults) {
7
+ v = defaults[k];
8
+ onto[k] = (ref = received[k]) != null ? ref : v;
9
+ }
10
+ return onto;
11
+ };
12
+ exports.overwrite = function(received, defaults, onto = {}) {
13
+ var k, v;
14
+ for (k in received) {
15
+ v = received[k];
16
+ if (defaults[k] !== void 0) onto[k] = v;
17
+ }
18
+ return onto;
19
+ };
20
+ }));
21
+ //#endregion
22
+ //#region ../../node_modules/bottleneck/lib/DLList.js
23
+ var require_DLList = /* @__PURE__ */ __commonJSMin(((exports, module) => {
24
+ module.exports = class DLList {
25
+ constructor(incr, decr) {
26
+ this.incr = incr;
27
+ this.decr = decr;
28
+ this._first = null;
29
+ this._last = null;
30
+ this.length = 0;
31
+ }
32
+ push(value) {
33
+ var node;
34
+ this.length++;
35
+ if (typeof this.incr === "function") this.incr();
36
+ node = {
37
+ value,
38
+ prev: this._last,
39
+ next: null
40
+ };
41
+ if (this._last != null) {
42
+ this._last.next = node;
43
+ this._last = node;
44
+ } else this._first = this._last = node;
45
+ }
46
+ shift() {
47
+ var value;
48
+ if (this._first == null) return;
49
+ else {
50
+ this.length--;
51
+ if (typeof this.decr === "function") this.decr();
52
+ }
53
+ value = this._first.value;
54
+ if ((this._first = this._first.next) != null) this._first.prev = null;
55
+ else this._last = null;
56
+ return value;
57
+ }
58
+ first() {
59
+ if (this._first != null) return this._first.value;
60
+ }
61
+ getArray() {
62
+ var node = this._first, ref, results = [];
63
+ while (node != null) results.push((ref = node, node = node.next, ref.value));
64
+ return results;
65
+ }
66
+ forEachShift(cb) {
67
+ var node = this.shift();
68
+ while (node != null) cb(node), node = this.shift();
69
+ }
70
+ debug() {
71
+ var node = this._first, ref, ref1, ref2, results = [];
72
+ while (node != null) results.push((ref = node, node = node.next, {
73
+ value: ref.value,
74
+ prev: (ref1 = ref.prev) != null ? ref1.value : void 0,
75
+ next: (ref2 = ref.next) != null ? ref2.value : void 0
76
+ }));
77
+ return results;
78
+ }
79
+ };
80
+ }));
81
+ //#endregion
82
+ //#region ../../node_modules/bottleneck/lib/Events.js
83
+ var require_Events = /* @__PURE__ */ __commonJSMin(((exports, module) => {
84
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
85
+ try {
86
+ var info = gen[key](arg);
87
+ var value = info.value;
88
+ } catch (error) {
89
+ reject(error);
90
+ return;
91
+ }
92
+ if (info.done) resolve(value);
93
+ else Promise.resolve(value).then(_next, _throw);
94
+ }
95
+ function _asyncToGenerator(fn) {
96
+ return function() {
97
+ var self = this, args = arguments;
98
+ return new Promise(function(resolve, reject) {
99
+ var gen = fn.apply(self, args);
100
+ function _next(value) {
101
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
102
+ }
103
+ function _throw(err) {
104
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
105
+ }
106
+ _next(void 0);
107
+ });
108
+ };
109
+ }
110
+ module.exports = class Events {
111
+ constructor(instance) {
112
+ this.instance = instance;
113
+ this._events = {};
114
+ if (this.instance.on != null || this.instance.once != null || this.instance.removeAllListeners != null) throw new Error("An Emitter already exists for this object");
115
+ this.instance.on = (name, cb) => {
116
+ return this._addListener(name, "many", cb);
117
+ };
118
+ this.instance.once = (name, cb) => {
119
+ return this._addListener(name, "once", cb);
120
+ };
121
+ this.instance.removeAllListeners = (name = null) => {
122
+ if (name != null) return delete this._events[name];
123
+ else return this._events = {};
124
+ };
125
+ }
126
+ _addListener(name, status, cb) {
127
+ var base;
128
+ if ((base = this._events)[name] == null) base[name] = [];
129
+ this._events[name].push({
130
+ cb,
131
+ status
132
+ });
133
+ return this.instance;
134
+ }
135
+ listenerCount(name) {
136
+ if (this._events[name] != null) return this._events[name].length;
137
+ else return 0;
138
+ }
139
+ trigger(name, ...args) {
140
+ var _this = this;
141
+ return _asyncToGenerator(function* () {
142
+ var e, promises;
143
+ try {
144
+ if (name !== "debug") _this.trigger("debug", `Event triggered: ${name}`, args);
145
+ if (_this._events[name] == null) return;
146
+ _this._events[name] = _this._events[name].filter(function(listener) {
147
+ return listener.status !== "none";
148
+ });
149
+ promises = _this._events[name].map(/* @__PURE__ */ function() {
150
+ var _ref = _asyncToGenerator(function* (listener) {
151
+ var e, returned;
152
+ if (listener.status === "none") return;
153
+ if (listener.status === "once") listener.status = "none";
154
+ try {
155
+ returned = typeof listener.cb === "function" ? listener.cb(...args) : void 0;
156
+ if (typeof (returned != null ? returned.then : void 0) === "function") return yield returned;
157
+ else return returned;
158
+ } catch (error) {
159
+ e = error;
160
+ _this.trigger("error", e);
161
+ return null;
162
+ }
163
+ });
164
+ return function(_x) {
165
+ return _ref.apply(this, arguments);
166
+ };
167
+ }());
168
+ return (yield Promise.all(promises)).find(function(x) {
169
+ return x != null;
170
+ });
171
+ } catch (error) {
172
+ e = error;
173
+ _this.trigger("error", e);
174
+ return null;
175
+ }
176
+ })();
177
+ }
178
+ };
179
+ }));
180
+ //#endregion
181
+ //#region ../../node_modules/bottleneck/lib/Queues.js
182
+ var require_Queues = /* @__PURE__ */ __commonJSMin(((exports, module) => {
183
+ var DLList = require_DLList(), Events = require_Events();
184
+ module.exports = class Queues {
185
+ constructor(num_priorities) {
186
+ this.Events = new Events(this);
187
+ this._length = 0;
188
+ this._lists = function() {
189
+ var j, ref, results = [];
190
+ for (j = 1, ref = num_priorities; 1 <= ref ? j <= ref : j >= ref; 1 <= ref ? ++j : --j) results.push(new DLList(() => {
191
+ return this.incr();
192
+ }, () => {
193
+ return this.decr();
194
+ }));
195
+ return results;
196
+ }.call(this);
197
+ }
198
+ incr() {
199
+ if (this._length++ === 0) return this.Events.trigger("leftzero");
200
+ }
201
+ decr() {
202
+ if (--this._length === 0) return this.Events.trigger("zero");
203
+ }
204
+ push(job) {
205
+ return this._lists[job.options.priority].push(job);
206
+ }
207
+ queued(priority) {
208
+ if (priority != null) return this._lists[priority].length;
209
+ else return this._length;
210
+ }
211
+ shiftAll(fn) {
212
+ return this._lists.forEach(function(list) {
213
+ return list.forEachShift(fn);
214
+ });
215
+ }
216
+ getFirst(arr = this._lists) {
217
+ var j, len, list;
218
+ for (j = 0, len = arr.length; j < len; j++) {
219
+ list = arr[j];
220
+ if (list.length > 0) return list;
221
+ }
222
+ return [];
223
+ }
224
+ shiftLastFrom(priority) {
225
+ return this.getFirst(this._lists.slice(priority).reverse()).shift();
226
+ }
227
+ };
228
+ }));
229
+ //#endregion
230
+ //#region ../../node_modules/bottleneck/lib/BottleneckError.js
231
+ var require_BottleneckError = /* @__PURE__ */ __commonJSMin(((exports, module) => {
232
+ module.exports = class BottleneckError extends Error {};
233
+ }));
234
+ //#endregion
235
+ //#region ../../node_modules/bottleneck/lib/Job.js
236
+ var require_Job = /* @__PURE__ */ __commonJSMin(((exports, module) => {
237
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
238
+ try {
239
+ var info = gen[key](arg);
240
+ var value = info.value;
241
+ } catch (error) {
242
+ reject(error);
243
+ return;
244
+ }
245
+ if (info.done) resolve(value);
246
+ else Promise.resolve(value).then(_next, _throw);
247
+ }
248
+ function _asyncToGenerator(fn) {
249
+ return function() {
250
+ var self = this, args = arguments;
251
+ return new Promise(function(resolve, reject) {
252
+ var gen = fn.apply(self, args);
253
+ function _next(value) {
254
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
255
+ }
256
+ function _throw(err) {
257
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
258
+ }
259
+ _next(void 0);
260
+ });
261
+ };
262
+ }
263
+ var BottleneckError, DEFAULT_PRIORITY, Job, NUM_PRIORITIES = 10, parser;
264
+ DEFAULT_PRIORITY = 5;
265
+ parser = require_parser();
266
+ BottleneckError = require_BottleneckError();
267
+ Job = class Job {
268
+ constructor(task, args, options, jobDefaults, rejectOnDrop, Events, _states, Promise) {
269
+ this.task = task;
270
+ this.args = args;
271
+ this.rejectOnDrop = rejectOnDrop;
272
+ this.Events = Events;
273
+ this._states = _states;
274
+ this.Promise = Promise;
275
+ this.options = parser.load(options, jobDefaults);
276
+ this.options.priority = this._sanitizePriority(this.options.priority);
277
+ if (this.options.id === jobDefaults.id) this.options.id = `${this.options.id}-${this._randomIndex()}`;
278
+ this.promise = new this.Promise((_resolve, _reject) => {
279
+ this._resolve = _resolve;
280
+ this._reject = _reject;
281
+ });
282
+ this.retryCount = 0;
283
+ }
284
+ _sanitizePriority(priority) {
285
+ var sProperty = ~~priority !== priority ? DEFAULT_PRIORITY : priority;
286
+ if (sProperty < 0) return 0;
287
+ else if (sProperty > NUM_PRIORITIES - 1) return NUM_PRIORITIES - 1;
288
+ else return sProperty;
289
+ }
290
+ _randomIndex() {
291
+ return Math.random().toString(36).slice(2);
292
+ }
293
+ doDrop({ error, message = "This job has been dropped by Bottleneck" } = {}) {
294
+ if (this._states.remove(this.options.id)) {
295
+ if (this.rejectOnDrop) this._reject(error != null ? error : new BottleneckError(message));
296
+ this.Events.trigger("dropped", {
297
+ args: this.args,
298
+ options: this.options,
299
+ task: this.task,
300
+ promise: this.promise
301
+ });
302
+ return true;
303
+ } else return false;
304
+ }
305
+ _assertStatus(expected) {
306
+ var status = this._states.jobStatus(this.options.id);
307
+ if (!(status === expected || expected === "DONE" && status === null)) throw new BottleneckError(`Invalid job status ${status}, expected ${expected}. Please open an issue at https://github.com/SGrondin/bottleneck/issues`);
308
+ }
309
+ doReceive() {
310
+ this._states.start(this.options.id);
311
+ return this.Events.trigger("received", {
312
+ args: this.args,
313
+ options: this.options
314
+ });
315
+ }
316
+ doQueue(reachedHWM, blocked) {
317
+ this._assertStatus("RECEIVED");
318
+ this._states.next(this.options.id);
319
+ return this.Events.trigger("queued", {
320
+ args: this.args,
321
+ options: this.options,
322
+ reachedHWM,
323
+ blocked
324
+ });
325
+ }
326
+ doRun() {
327
+ if (this.retryCount === 0) {
328
+ this._assertStatus("QUEUED");
329
+ this._states.next(this.options.id);
330
+ } else this._assertStatus("EXECUTING");
331
+ return this.Events.trigger("scheduled", {
332
+ args: this.args,
333
+ options: this.options
334
+ });
335
+ }
336
+ doExecute(chained, clearGlobalState, run, free) {
337
+ var _this = this;
338
+ return _asyncToGenerator(function* () {
339
+ var error, eventInfo, passed;
340
+ if (_this.retryCount === 0) {
341
+ _this._assertStatus("RUNNING");
342
+ _this._states.next(_this.options.id);
343
+ } else _this._assertStatus("EXECUTING");
344
+ eventInfo = {
345
+ args: _this.args,
346
+ options: _this.options,
347
+ retryCount: _this.retryCount
348
+ };
349
+ _this.Events.trigger("executing", eventInfo);
350
+ try {
351
+ passed = yield chained != null ? chained.schedule(_this.options, _this.task, ..._this.args) : _this.task(..._this.args);
352
+ if (clearGlobalState()) {
353
+ _this.doDone(eventInfo);
354
+ yield free(_this.options, eventInfo);
355
+ _this._assertStatus("DONE");
356
+ return _this._resolve(passed);
357
+ }
358
+ } catch (error1) {
359
+ error = error1;
360
+ return _this._onFailure(error, eventInfo, clearGlobalState, run, free);
361
+ }
362
+ })();
363
+ }
364
+ doExpire(clearGlobalState, run, free) {
365
+ var error, eventInfo;
366
+ if (this._states.jobStatus(this.options.id === "RUNNING")) this._states.next(this.options.id);
367
+ this._assertStatus("EXECUTING");
368
+ eventInfo = {
369
+ args: this.args,
370
+ options: this.options,
371
+ retryCount: this.retryCount
372
+ };
373
+ error = new BottleneckError(`This job timed out after ${this.options.expiration} ms.`);
374
+ return this._onFailure(error, eventInfo, clearGlobalState, run, free);
375
+ }
376
+ _onFailure(error, eventInfo, clearGlobalState, run, free) {
377
+ var _this2 = this;
378
+ return _asyncToGenerator(function* () {
379
+ var retry, retryAfter;
380
+ if (clearGlobalState()) {
381
+ retry = yield _this2.Events.trigger("failed", error, eventInfo);
382
+ if (retry != null) {
383
+ retryAfter = ~~retry;
384
+ _this2.Events.trigger("retry", `Retrying ${_this2.options.id} after ${retryAfter} ms`, eventInfo);
385
+ _this2.retryCount++;
386
+ return run(retryAfter);
387
+ } else {
388
+ _this2.doDone(eventInfo);
389
+ yield free(_this2.options, eventInfo);
390
+ _this2._assertStatus("DONE");
391
+ return _this2._reject(error);
392
+ }
393
+ }
394
+ })();
395
+ }
396
+ doDone(eventInfo) {
397
+ this._assertStatus("EXECUTING");
398
+ this._states.next(this.options.id);
399
+ return this.Events.trigger("done", eventInfo);
400
+ }
401
+ };
402
+ module.exports = Job;
403
+ }));
404
+ //#endregion
405
+ //#region ../../node_modules/bottleneck/lib/LocalDatastore.js
406
+ var require_LocalDatastore = /* @__PURE__ */ __commonJSMin(((exports, module) => {
407
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
408
+ try {
409
+ var info = gen[key](arg);
410
+ var value = info.value;
411
+ } catch (error) {
412
+ reject(error);
413
+ return;
414
+ }
415
+ if (info.done) resolve(value);
416
+ else Promise.resolve(value).then(_next, _throw);
417
+ }
418
+ function _asyncToGenerator(fn) {
419
+ return function() {
420
+ var self = this, args = arguments;
421
+ return new Promise(function(resolve, reject) {
422
+ var gen = fn.apply(self, args);
423
+ function _next(value) {
424
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
425
+ }
426
+ function _throw(err) {
427
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
428
+ }
429
+ _next(void 0);
430
+ });
431
+ };
432
+ }
433
+ var BottleneckError, LocalDatastore, parser = require_parser();
434
+ BottleneckError = require_BottleneckError();
435
+ LocalDatastore = class LocalDatastore {
436
+ constructor(instance, storeOptions, storeInstanceOptions) {
437
+ this.instance = instance;
438
+ this.storeOptions = storeOptions;
439
+ this.clientId = this.instance._randomIndex();
440
+ parser.load(storeInstanceOptions, storeInstanceOptions, this);
441
+ this._nextRequest = this._lastReservoirRefresh = this._lastReservoirIncrease = Date.now();
442
+ this._running = 0;
443
+ this._done = 0;
444
+ this._unblockTime = 0;
445
+ this.ready = this.Promise.resolve();
446
+ this.clients = {};
447
+ this._startHeartbeat();
448
+ }
449
+ _startHeartbeat() {
450
+ var base;
451
+ if (this.heartbeat == null && (this.storeOptions.reservoirRefreshInterval != null && this.storeOptions.reservoirRefreshAmount != null || this.storeOptions.reservoirIncreaseInterval != null && this.storeOptions.reservoirIncreaseAmount != null)) return typeof (base = this.heartbeat = setInterval(() => {
452
+ var amount, incr, maximum, now = Date.now(), reservoir;
453
+ if (this.storeOptions.reservoirRefreshInterval != null && now >= this._lastReservoirRefresh + this.storeOptions.reservoirRefreshInterval) {
454
+ this._lastReservoirRefresh = now;
455
+ this.storeOptions.reservoir = this.storeOptions.reservoirRefreshAmount;
456
+ this.instance._drainAll(this.computeCapacity());
457
+ }
458
+ if (this.storeOptions.reservoirIncreaseInterval != null && now >= this._lastReservoirIncrease + this.storeOptions.reservoirIncreaseInterval) {
459
+ var _this$storeOptions = this.storeOptions;
460
+ amount = _this$storeOptions.reservoirIncreaseAmount;
461
+ maximum = _this$storeOptions.reservoirIncreaseMaximum;
462
+ reservoir = _this$storeOptions.reservoir;
463
+ this._lastReservoirIncrease = now;
464
+ incr = maximum != null ? Math.min(amount, maximum - reservoir) : amount;
465
+ if (incr > 0) {
466
+ this.storeOptions.reservoir += incr;
467
+ return this.instance._drainAll(this.computeCapacity());
468
+ }
469
+ }
470
+ }, this.heartbeatInterval)).unref === "function" ? base.unref() : void 0;
471
+ else return clearInterval(this.heartbeat);
472
+ }
473
+ __publish__(message) {
474
+ var _this = this;
475
+ return _asyncToGenerator(function* () {
476
+ yield _this.yieldLoop();
477
+ return _this.instance.Events.trigger("message", message.toString());
478
+ })();
479
+ }
480
+ __disconnect__(flush) {
481
+ var _this2 = this;
482
+ return _asyncToGenerator(function* () {
483
+ yield _this2.yieldLoop();
484
+ clearInterval(_this2.heartbeat);
485
+ return _this2.Promise.resolve();
486
+ })();
487
+ }
488
+ yieldLoop(t = 0) {
489
+ return new this.Promise(function(resolve, reject) {
490
+ return setTimeout(resolve, t);
491
+ });
492
+ }
493
+ computePenalty() {
494
+ var ref;
495
+ return (ref = this.storeOptions.penalty) != null ? ref : 15 * this.storeOptions.minTime || 5e3;
496
+ }
497
+ __updateSettings__(options) {
498
+ var _this3 = this;
499
+ return _asyncToGenerator(function* () {
500
+ yield _this3.yieldLoop();
501
+ parser.overwrite(options, options, _this3.storeOptions);
502
+ _this3._startHeartbeat();
503
+ _this3.instance._drainAll(_this3.computeCapacity());
504
+ return true;
505
+ })();
506
+ }
507
+ __running__() {
508
+ var _this4 = this;
509
+ return _asyncToGenerator(function* () {
510
+ yield _this4.yieldLoop();
511
+ return _this4._running;
512
+ })();
513
+ }
514
+ __queued__() {
515
+ var _this5 = this;
516
+ return _asyncToGenerator(function* () {
517
+ yield _this5.yieldLoop();
518
+ return _this5.instance.queued();
519
+ })();
520
+ }
521
+ __done__() {
522
+ var _this6 = this;
523
+ return _asyncToGenerator(function* () {
524
+ yield _this6.yieldLoop();
525
+ return _this6._done;
526
+ })();
527
+ }
528
+ __groupCheck__(time) {
529
+ var _this7 = this;
530
+ return _asyncToGenerator(function* () {
531
+ yield _this7.yieldLoop();
532
+ return _this7._nextRequest + _this7.timeout < time;
533
+ })();
534
+ }
535
+ computeCapacity() {
536
+ var maxConcurrent, reservoir;
537
+ var _this$storeOptions2 = this.storeOptions;
538
+ maxConcurrent = _this$storeOptions2.maxConcurrent;
539
+ reservoir = _this$storeOptions2.reservoir;
540
+ if (maxConcurrent != null && reservoir != null) return Math.min(maxConcurrent - this._running, reservoir);
541
+ else if (maxConcurrent != null) return maxConcurrent - this._running;
542
+ else if (reservoir != null) return reservoir;
543
+ else return null;
544
+ }
545
+ conditionsCheck(weight) {
546
+ var capacity = this.computeCapacity();
547
+ return capacity == null || weight <= capacity;
548
+ }
549
+ __incrementReservoir__(incr) {
550
+ var _this8 = this;
551
+ return _asyncToGenerator(function* () {
552
+ var reservoir;
553
+ yield _this8.yieldLoop();
554
+ reservoir = _this8.storeOptions.reservoir += incr;
555
+ _this8.instance._drainAll(_this8.computeCapacity());
556
+ return reservoir;
557
+ })();
558
+ }
559
+ __currentReservoir__() {
560
+ var _this9 = this;
561
+ return _asyncToGenerator(function* () {
562
+ yield _this9.yieldLoop();
563
+ return _this9.storeOptions.reservoir;
564
+ })();
565
+ }
566
+ isBlocked(now) {
567
+ return this._unblockTime >= now;
568
+ }
569
+ check(weight, now) {
570
+ return this.conditionsCheck(weight) && this._nextRequest - now <= 0;
571
+ }
572
+ __check__(weight) {
573
+ var _this10 = this;
574
+ return _asyncToGenerator(function* () {
575
+ var now;
576
+ yield _this10.yieldLoop();
577
+ now = Date.now();
578
+ return _this10.check(weight, now);
579
+ })();
580
+ }
581
+ __register__(index, weight, expiration) {
582
+ var _this11 = this;
583
+ return _asyncToGenerator(function* () {
584
+ var now, wait;
585
+ yield _this11.yieldLoop();
586
+ now = Date.now();
587
+ if (_this11.conditionsCheck(weight)) {
588
+ _this11._running += weight;
589
+ if (_this11.storeOptions.reservoir != null) _this11.storeOptions.reservoir -= weight;
590
+ wait = Math.max(_this11._nextRequest - now, 0);
591
+ _this11._nextRequest = now + wait + _this11.storeOptions.minTime;
592
+ return {
593
+ success: true,
594
+ wait,
595
+ reservoir: _this11.storeOptions.reservoir
596
+ };
597
+ } else return { success: false };
598
+ })();
599
+ }
600
+ strategyIsBlock() {
601
+ return this.storeOptions.strategy === 3;
602
+ }
603
+ __submit__(queueLength, weight) {
604
+ var _this12 = this;
605
+ return _asyncToGenerator(function* () {
606
+ var blocked, now, reachedHWM;
607
+ yield _this12.yieldLoop();
608
+ if (_this12.storeOptions.maxConcurrent != null && weight > _this12.storeOptions.maxConcurrent) throw new BottleneckError(`Impossible to add a job having a weight of ${weight} to a limiter having a maxConcurrent setting of ${_this12.storeOptions.maxConcurrent}`);
609
+ now = Date.now();
610
+ reachedHWM = _this12.storeOptions.highWater != null && queueLength === _this12.storeOptions.highWater && !_this12.check(weight, now);
611
+ blocked = _this12.strategyIsBlock() && (reachedHWM || _this12.isBlocked(now));
612
+ if (blocked) {
613
+ _this12._unblockTime = now + _this12.computePenalty();
614
+ _this12._nextRequest = _this12._unblockTime + _this12.storeOptions.minTime;
615
+ _this12.instance._dropAllQueued();
616
+ }
617
+ return {
618
+ reachedHWM,
619
+ blocked,
620
+ strategy: _this12.storeOptions.strategy
621
+ };
622
+ })();
623
+ }
624
+ __free__(index, weight) {
625
+ var _this13 = this;
626
+ return _asyncToGenerator(function* () {
627
+ yield _this13.yieldLoop();
628
+ _this13._running -= weight;
629
+ _this13._done += weight;
630
+ _this13.instance._drainAll(_this13.computeCapacity());
631
+ return { running: _this13._running };
632
+ })();
633
+ }
634
+ };
635
+ module.exports = LocalDatastore;
636
+ }));
637
+ //#endregion
638
+ //#region ../../node_modules/bottleneck/lib/lua.json
639
+ var require_lua = /* @__PURE__ */ __commonJSMin(((exports, module) => {
640
+ module.exports = {
641
+ "blacklist_client.lua": "local blacklist = ARGV[num_static_argv + 1]\n\nif redis.call('zscore', client_last_seen_key, blacklist) then\n redis.call('zadd', client_last_seen_key, 0, blacklist)\nend\n\n\nreturn {}\n",
642
+ "check.lua": "local weight = tonumber(ARGV[num_static_argv + 1])\n\nlocal capacity = process_tick(now, false)['capacity']\nlocal nextRequest = tonumber(redis.call('hget', settings_key, 'nextRequest'))\n\nreturn conditions_check(capacity, weight) and nextRequest - now <= 0\n",
643
+ "conditions_check.lua": "local conditions_check = function (capacity, weight)\n return capacity == nil or weight <= capacity\nend\n",
644
+ "current_reservoir.lua": "return process_tick(now, false)['reservoir']\n",
645
+ "done.lua": "process_tick(now, false)\n\nreturn tonumber(redis.call('hget', settings_key, 'done'))\n",
646
+ "free.lua": "local index = ARGV[num_static_argv + 1]\n\nredis.call('zadd', job_expirations_key, 0, index)\n\nreturn process_tick(now, false)['running']\n",
647
+ "get_time.lua": "redis.replicate_commands()\n\nlocal get_time = function ()\n local time = redis.call('time')\n\n return tonumber(time[1]..string.sub(time[2], 1, 3))\nend\n",
648
+ "group_check.lua": "return not (redis.call('exists', settings_key) == 1)\n",
649
+ "heartbeat.lua": "process_tick(now, true)\n",
650
+ "increment_reservoir.lua": "local incr = tonumber(ARGV[num_static_argv + 1])\n\nredis.call('hincrby', settings_key, 'reservoir', incr)\n\nlocal reservoir = process_tick(now, true)['reservoir']\n\nlocal groupTimeout = tonumber(redis.call('hget', settings_key, 'groupTimeout'))\nrefresh_expiration(0, 0, groupTimeout)\n\nreturn reservoir\n",
651
+ "init.lua": "local clear = tonumber(ARGV[num_static_argv + 1])\nlocal limiter_version = ARGV[num_static_argv + 2]\nlocal num_local_argv = num_static_argv + 2\n\nif clear == 1 then\n redis.call('del', unpack(KEYS))\nend\n\nif redis.call('exists', settings_key) == 0 then\n -- Create\n local args = {'hmset', settings_key}\n\n for i = num_local_argv + 1, #ARGV do\n table.insert(args, ARGV[i])\n end\n\n redis.call(unpack(args))\n redis.call('hmset', settings_key,\n 'nextRequest', now,\n 'lastReservoirRefresh', now,\n 'lastReservoirIncrease', now,\n 'running', 0,\n 'done', 0,\n 'unblockTime', 0,\n 'capacityPriorityCounter', 0\n )\n\nelse\n -- Apply migrations\n local settings = redis.call('hmget', settings_key,\n 'id',\n 'version'\n )\n local id = settings[1]\n local current_version = settings[2]\n\n if current_version ~= limiter_version then\n local version_digits = {}\n for k, v in string.gmatch(current_version, \"([^.]+)\") do\n table.insert(version_digits, tonumber(k))\n end\n\n -- 2.10.0\n if version_digits[2] < 10 then\n redis.call('hsetnx', settings_key, 'reservoirRefreshInterval', '')\n redis.call('hsetnx', settings_key, 'reservoirRefreshAmount', '')\n redis.call('hsetnx', settings_key, 'lastReservoirRefresh', '')\n redis.call('hsetnx', settings_key, 'done', 0)\n redis.call('hset', settings_key, 'version', '2.10.0')\n end\n\n -- 2.11.1\n if version_digits[2] < 11 or (version_digits[2] == 11 and version_digits[3] < 1) then\n if redis.call('hstrlen', settings_key, 'lastReservoirRefresh') == 0 then\n redis.call('hmset', settings_key,\n 'lastReservoirRefresh', now,\n 'version', '2.11.1'\n )\n end\n end\n\n -- 2.14.0\n if version_digits[2] < 14 then\n local old_running_key = 'b_'..id..'_running'\n local old_executing_key = 'b_'..id..'_executing'\n\n if redis.call('exists', old_running_key) == 1 then\n redis.call('rename', old_running_key, job_weights_key)\n end\n if redis.call('exists', old_executing_key) == 1 then\n redis.call('rename', old_executing_key, job_expirations_key)\n end\n redis.call('hset', settings_key, 'version', '2.14.0')\n end\n\n -- 2.15.2\n if version_digits[2] < 15 or (version_digits[2] == 15 and version_digits[3] < 2) then\n redis.call('hsetnx', settings_key, 'capacityPriorityCounter', 0)\n redis.call('hset', settings_key, 'version', '2.15.2')\n end\n\n -- 2.17.0\n if version_digits[2] < 17 then\n redis.call('hsetnx', settings_key, 'clientTimeout', 10000)\n redis.call('hset', settings_key, 'version', '2.17.0')\n end\n\n -- 2.18.0\n if version_digits[2] < 18 then\n redis.call('hsetnx', settings_key, 'reservoirIncreaseInterval', '')\n redis.call('hsetnx', settings_key, 'reservoirIncreaseAmount', '')\n redis.call('hsetnx', settings_key, 'reservoirIncreaseMaximum', '')\n redis.call('hsetnx', settings_key, 'lastReservoirIncrease', now)\n redis.call('hset', settings_key, 'version', '2.18.0')\n end\n\n end\n\n process_tick(now, false)\nend\n\nlocal groupTimeout = tonumber(redis.call('hget', settings_key, 'groupTimeout'))\nrefresh_expiration(0, 0, groupTimeout)\n\nreturn {}\n",
652
+ "process_tick.lua": "local process_tick = function (now, always_publish)\n\n local compute_capacity = function (maxConcurrent, running, reservoir)\n if maxConcurrent ~= nil and reservoir ~= nil then\n return math.min((maxConcurrent - running), reservoir)\n elseif maxConcurrent ~= nil then\n return maxConcurrent - running\n elseif reservoir ~= nil then\n return reservoir\n else\n return nil\n end\n end\n\n local settings = redis.call('hmget', settings_key,\n 'id',\n 'maxConcurrent',\n 'running',\n 'reservoir',\n 'reservoirRefreshInterval',\n 'reservoirRefreshAmount',\n 'lastReservoirRefresh',\n 'reservoirIncreaseInterval',\n 'reservoirIncreaseAmount',\n 'reservoirIncreaseMaximum',\n 'lastReservoirIncrease',\n 'capacityPriorityCounter',\n 'clientTimeout'\n )\n local id = settings[1]\n local maxConcurrent = tonumber(settings[2])\n local running = tonumber(settings[3])\n local reservoir = tonumber(settings[4])\n local reservoirRefreshInterval = tonumber(settings[5])\n local reservoirRefreshAmount = tonumber(settings[6])\n local lastReservoirRefresh = tonumber(settings[7])\n local reservoirIncreaseInterval = tonumber(settings[8])\n local reservoirIncreaseAmount = tonumber(settings[9])\n local reservoirIncreaseMaximum = tonumber(settings[10])\n local lastReservoirIncrease = tonumber(settings[11])\n local capacityPriorityCounter = tonumber(settings[12])\n local clientTimeout = tonumber(settings[13])\n\n local initial_capacity = compute_capacity(maxConcurrent, running, reservoir)\n\n --\n -- Process 'running' changes\n --\n local expired = redis.call('zrangebyscore', job_expirations_key, '-inf', '('..now)\n\n if #expired > 0 then\n redis.call('zremrangebyscore', job_expirations_key, '-inf', '('..now)\n\n local flush_batch = function (batch, acc)\n local weights = redis.call('hmget', job_weights_key, unpack(batch))\n redis.call('hdel', job_weights_key, unpack(batch))\n local clients = redis.call('hmget', job_clients_key, unpack(batch))\n redis.call('hdel', job_clients_key, unpack(batch))\n\n -- Calculate sum of removed weights\n for i = 1, #weights do\n acc['total'] = acc['total'] + (tonumber(weights[i]) or 0)\n end\n\n -- Calculate sum of removed weights by client\n local client_weights = {}\n for i = 1, #clients do\n local removed = tonumber(weights[i]) or 0\n if removed > 0 then\n acc['client_weights'][clients[i]] = (acc['client_weights'][clients[i]] or 0) + removed\n end\n end\n end\n\n local acc = {\n ['total'] = 0,\n ['client_weights'] = {}\n }\n local batch_size = 1000\n\n -- Compute changes to Zsets and apply changes to Hashes\n for i = 1, #expired, batch_size do\n local batch = {}\n for j = i, math.min(i + batch_size - 1, #expired) do\n table.insert(batch, expired[j])\n end\n\n flush_batch(batch, acc)\n end\n\n -- Apply changes to Zsets\n if acc['total'] > 0 then\n redis.call('hincrby', settings_key, 'done', acc['total'])\n running = tonumber(redis.call('hincrby', settings_key, 'running', -acc['total']))\n end\n\n for client, weight in pairs(acc['client_weights']) do\n redis.call('zincrby', client_running_key, -weight, client)\n end\n end\n\n --\n -- Process 'reservoir' changes\n --\n local reservoirRefreshActive = reservoirRefreshInterval ~= nil and reservoirRefreshAmount ~= nil\n if reservoirRefreshActive and now >= lastReservoirRefresh + reservoirRefreshInterval then\n reservoir = reservoirRefreshAmount\n redis.call('hmset', settings_key,\n 'reservoir', reservoir,\n 'lastReservoirRefresh', now\n )\n end\n\n local reservoirIncreaseActive = reservoirIncreaseInterval ~= nil and reservoirIncreaseAmount ~= nil\n if reservoirIncreaseActive and now >= lastReservoirIncrease + reservoirIncreaseInterval then\n local num_intervals = math.floor((now - lastReservoirIncrease) / reservoirIncreaseInterval)\n local incr = reservoirIncreaseAmount * num_intervals\n if reservoirIncreaseMaximum ~= nil then\n incr = math.min(incr, reservoirIncreaseMaximum - (reservoir or 0))\n end\n if incr > 0 then\n reservoir = (reservoir or 0) + incr\n end\n redis.call('hmset', settings_key,\n 'reservoir', reservoir,\n 'lastReservoirIncrease', lastReservoirIncrease + (num_intervals * reservoirIncreaseInterval)\n )\n end\n\n --\n -- Clear unresponsive clients\n --\n local unresponsive = redis.call('zrangebyscore', client_last_seen_key, '-inf', (now - clientTimeout))\n local unresponsive_lookup = {}\n local terminated_clients = {}\n for i = 1, #unresponsive do\n unresponsive_lookup[unresponsive[i]] = true\n if tonumber(redis.call('zscore', client_running_key, unresponsive[i])) == 0 then\n table.insert(terminated_clients, unresponsive[i])\n end\n end\n if #terminated_clients > 0 then\n redis.call('zrem', client_running_key, unpack(terminated_clients))\n redis.call('hdel', client_num_queued_key, unpack(terminated_clients))\n redis.call('zrem', client_last_registered_key, unpack(terminated_clients))\n redis.call('zrem', client_last_seen_key, unpack(terminated_clients))\n end\n\n --\n -- Broadcast capacity changes\n --\n local final_capacity = compute_capacity(maxConcurrent, running, reservoir)\n\n if always_publish or (initial_capacity ~= nil and final_capacity == nil) then\n -- always_publish or was not unlimited, now unlimited\n redis.call('publish', 'b_'..id, 'capacity:'..(final_capacity or ''))\n\n elseif initial_capacity ~= nil and final_capacity ~= nil and final_capacity > initial_capacity then\n -- capacity was increased\n -- send the capacity message to the limiter having the lowest number of running jobs\n -- the tiebreaker is the limiter having not registered a job in the longest time\n\n local lowest_concurrency_value = nil\n local lowest_concurrency_clients = {}\n local lowest_concurrency_last_registered = {}\n local client_concurrencies = redis.call('zrange', client_running_key, 0, -1, 'withscores')\n\n for i = 1, #client_concurrencies, 2 do\n local client = client_concurrencies[i]\n local concurrency = tonumber(client_concurrencies[i+1])\n\n if (\n lowest_concurrency_value == nil or lowest_concurrency_value == concurrency\n ) and (\n not unresponsive_lookup[client]\n ) and (\n tonumber(redis.call('hget', client_num_queued_key, client)) > 0\n ) then\n lowest_concurrency_value = concurrency\n table.insert(lowest_concurrency_clients, client)\n local last_registered = tonumber(redis.call('zscore', client_last_registered_key, client))\n table.insert(lowest_concurrency_last_registered, last_registered)\n end\n end\n\n if #lowest_concurrency_clients > 0 then\n local position = 1\n local earliest = lowest_concurrency_last_registered[1]\n\n for i,v in ipairs(lowest_concurrency_last_registered) do\n if v < earliest then\n position = i\n earliest = v\n end\n end\n\n local next_client = lowest_concurrency_clients[position]\n redis.call('publish', 'b_'..id,\n 'capacity-priority:'..(final_capacity or '')..\n ':'..next_client..\n ':'..capacityPriorityCounter\n )\n redis.call('hincrby', settings_key, 'capacityPriorityCounter', '1')\n else\n redis.call('publish', 'b_'..id, 'capacity:'..(final_capacity or ''))\n end\n end\n\n return {\n ['capacity'] = final_capacity,\n ['running'] = running,\n ['reservoir'] = reservoir\n }\nend\n",
653
+ "queued.lua": "local clientTimeout = tonumber(redis.call('hget', settings_key, 'clientTimeout'))\nlocal valid_clients = redis.call('zrangebyscore', client_last_seen_key, (now - clientTimeout), 'inf')\nlocal client_queued = redis.call('hmget', client_num_queued_key, unpack(valid_clients))\n\nlocal sum = 0\nfor i = 1, #client_queued do\n sum = sum + tonumber(client_queued[i])\nend\n\nreturn sum\n",
654
+ "refresh_expiration.lua": "local refresh_expiration = function (now, nextRequest, groupTimeout)\n\n if groupTimeout ~= nil then\n local ttl = (nextRequest + groupTimeout) - now\n\n for i = 1, #KEYS do\n redis.call('pexpire', KEYS[i], ttl)\n end\n end\n\nend\n",
655
+ "refs.lua": "local settings_key = KEYS[1]\nlocal job_weights_key = KEYS[2]\nlocal job_expirations_key = KEYS[3]\nlocal job_clients_key = KEYS[4]\nlocal client_running_key = KEYS[5]\nlocal client_num_queued_key = KEYS[6]\nlocal client_last_registered_key = KEYS[7]\nlocal client_last_seen_key = KEYS[8]\n\nlocal now = tonumber(ARGV[1])\nlocal client = ARGV[2]\n\nlocal num_static_argv = 2\n",
656
+ "register.lua": "local index = ARGV[num_static_argv + 1]\nlocal weight = tonumber(ARGV[num_static_argv + 2])\nlocal expiration = tonumber(ARGV[num_static_argv + 3])\n\nlocal state = process_tick(now, false)\nlocal capacity = state['capacity']\nlocal reservoir = state['reservoir']\n\nlocal settings = redis.call('hmget', settings_key,\n 'nextRequest',\n 'minTime',\n 'groupTimeout'\n)\nlocal nextRequest = tonumber(settings[1])\nlocal minTime = tonumber(settings[2])\nlocal groupTimeout = tonumber(settings[3])\n\nif conditions_check(capacity, weight) then\n\n redis.call('hincrby', settings_key, 'running', weight)\n redis.call('hset', job_weights_key, index, weight)\n if expiration ~= nil then\n redis.call('zadd', job_expirations_key, now + expiration, index)\n end\n redis.call('hset', job_clients_key, index, client)\n redis.call('zincrby', client_running_key, weight, client)\n redis.call('hincrby', client_num_queued_key, client, -1)\n redis.call('zadd', client_last_registered_key, now, client)\n\n local wait = math.max(nextRequest - now, 0)\n local newNextRequest = now + wait + minTime\n\n if reservoir == nil then\n redis.call('hset', settings_key,\n 'nextRequest', newNextRequest\n )\n else\n reservoir = reservoir - weight\n redis.call('hmset', settings_key,\n 'reservoir', reservoir,\n 'nextRequest', newNextRequest\n )\n end\n\n refresh_expiration(now, newNextRequest, groupTimeout)\n\n return {true, wait, reservoir}\n\nelse\n return {false}\nend\n",
657
+ "register_client.lua": "local queued = tonumber(ARGV[num_static_argv + 1])\n\n-- Could have been re-registered concurrently\nif not redis.call('zscore', client_last_seen_key, client) then\n redis.call('zadd', client_running_key, 0, client)\n redis.call('hset', client_num_queued_key, client, queued)\n redis.call('zadd', client_last_registered_key, 0, client)\nend\n\nredis.call('zadd', client_last_seen_key, now, client)\n\nreturn {}\n",
658
+ "running.lua": "return process_tick(now, false)['running']\n",
659
+ "submit.lua": "local queueLength = tonumber(ARGV[num_static_argv + 1])\nlocal weight = tonumber(ARGV[num_static_argv + 2])\n\nlocal capacity = process_tick(now, false)['capacity']\n\nlocal settings = redis.call('hmget', settings_key,\n 'id',\n 'maxConcurrent',\n 'highWater',\n 'nextRequest',\n 'strategy',\n 'unblockTime',\n 'penalty',\n 'minTime',\n 'groupTimeout'\n)\nlocal id = settings[1]\nlocal maxConcurrent = tonumber(settings[2])\nlocal highWater = tonumber(settings[3])\nlocal nextRequest = tonumber(settings[4])\nlocal strategy = tonumber(settings[5])\nlocal unblockTime = tonumber(settings[6])\nlocal penalty = tonumber(settings[7])\nlocal minTime = tonumber(settings[8])\nlocal groupTimeout = tonumber(settings[9])\n\nif maxConcurrent ~= nil and weight > maxConcurrent then\n return redis.error_reply('OVERWEIGHT:'..weight..':'..maxConcurrent)\nend\n\nlocal reachedHWM = (highWater ~= nil and queueLength == highWater\n and not (\n conditions_check(capacity, weight)\n and nextRequest - now <= 0\n )\n)\n\nlocal blocked = strategy == 3 and (reachedHWM or unblockTime >= now)\n\nif blocked then\n local computedPenalty = penalty\n if computedPenalty == nil then\n if minTime == 0 then\n computedPenalty = 5000\n else\n computedPenalty = 15 * minTime\n end\n end\n\n local newNextRequest = now + computedPenalty + minTime\n\n redis.call('hmset', settings_key,\n 'unblockTime', now + computedPenalty,\n 'nextRequest', newNextRequest\n )\n\n local clients_queued_reset = redis.call('hkeys', client_num_queued_key)\n local queued_reset = {}\n for i = 1, #clients_queued_reset do\n table.insert(queued_reset, clients_queued_reset[i])\n table.insert(queued_reset, 0)\n end\n redis.call('hmset', client_num_queued_key, unpack(queued_reset))\n\n redis.call('publish', 'b_'..id, 'blocked:')\n\n refresh_expiration(now, newNextRequest, groupTimeout)\nend\n\nif not blocked and not reachedHWM then\n redis.call('hincrby', client_num_queued_key, client, 1)\nend\n\nreturn {reachedHWM, blocked, strategy}\n",
660
+ "update_settings.lua": "local args = {'hmset', settings_key}\n\nfor i = num_static_argv + 1, #ARGV do\n table.insert(args, ARGV[i])\nend\n\nredis.call(unpack(args))\n\nprocess_tick(now, true)\n\nlocal groupTimeout = tonumber(redis.call('hget', settings_key, 'groupTimeout'))\nrefresh_expiration(0, 0, groupTimeout)\n\nreturn {}\n",
661
+ "validate_client.lua": "if not redis.call('zscore', client_last_seen_key, client) then\n return redis.error_reply('UNKNOWN_CLIENT')\nend\n\nredis.call('zadd', client_last_seen_key, now, client)\n",
662
+ "validate_keys.lua": "if not (redis.call('exists', settings_key) == 1) then\n return redis.error_reply('SETTINGS_KEY_NOT_FOUND')\nend\n"
663
+ };
664
+ }));
665
+ //#endregion
666
+ //#region ../../node_modules/bottleneck/lib/Scripts.js
667
+ var require_Scripts = /* @__PURE__ */ __commonJSMin(((exports) => {
668
+ var headers, lua = require_lua(), templates;
669
+ headers = {
670
+ refs: lua["refs.lua"],
671
+ validate_keys: lua["validate_keys.lua"],
672
+ validate_client: lua["validate_client.lua"],
673
+ refresh_expiration: lua["refresh_expiration.lua"],
674
+ process_tick: lua["process_tick.lua"],
675
+ conditions_check: lua["conditions_check.lua"],
676
+ get_time: lua["get_time.lua"]
677
+ };
678
+ exports.allKeys = function(id) {
679
+ return [
680
+ `b_${id}_settings`,
681
+ `b_${id}_job_weights`,
682
+ `b_${id}_job_expirations`,
683
+ `b_${id}_job_clients`,
684
+ `b_${id}_client_running`,
685
+ `b_${id}_client_num_queued`,
686
+ `b_${id}_client_last_registered`,
687
+ `b_${id}_client_last_seen`
688
+ ];
689
+ };
690
+ templates = {
691
+ init: {
692
+ keys: exports.allKeys,
693
+ headers: ["process_tick"],
694
+ refresh_expiration: true,
695
+ code: lua["init.lua"]
696
+ },
697
+ group_check: {
698
+ keys: exports.allKeys,
699
+ headers: [],
700
+ refresh_expiration: false,
701
+ code: lua["group_check.lua"]
702
+ },
703
+ register_client: {
704
+ keys: exports.allKeys,
705
+ headers: ["validate_keys"],
706
+ refresh_expiration: false,
707
+ code: lua["register_client.lua"]
708
+ },
709
+ blacklist_client: {
710
+ keys: exports.allKeys,
711
+ headers: ["validate_keys", "validate_client"],
712
+ refresh_expiration: false,
713
+ code: lua["blacklist_client.lua"]
714
+ },
715
+ heartbeat: {
716
+ keys: exports.allKeys,
717
+ headers: [
718
+ "validate_keys",
719
+ "validate_client",
720
+ "process_tick"
721
+ ],
722
+ refresh_expiration: false,
723
+ code: lua["heartbeat.lua"]
724
+ },
725
+ update_settings: {
726
+ keys: exports.allKeys,
727
+ headers: [
728
+ "validate_keys",
729
+ "validate_client",
730
+ "process_tick"
731
+ ],
732
+ refresh_expiration: true,
733
+ code: lua["update_settings.lua"]
734
+ },
735
+ running: {
736
+ keys: exports.allKeys,
737
+ headers: [
738
+ "validate_keys",
739
+ "validate_client",
740
+ "process_tick"
741
+ ],
742
+ refresh_expiration: false,
743
+ code: lua["running.lua"]
744
+ },
745
+ queued: {
746
+ keys: exports.allKeys,
747
+ headers: ["validate_keys", "validate_client"],
748
+ refresh_expiration: false,
749
+ code: lua["queued.lua"]
750
+ },
751
+ done: {
752
+ keys: exports.allKeys,
753
+ headers: [
754
+ "validate_keys",
755
+ "validate_client",
756
+ "process_tick"
757
+ ],
758
+ refresh_expiration: false,
759
+ code: lua["done.lua"]
760
+ },
761
+ check: {
762
+ keys: exports.allKeys,
763
+ headers: [
764
+ "validate_keys",
765
+ "validate_client",
766
+ "process_tick",
767
+ "conditions_check"
768
+ ],
769
+ refresh_expiration: false,
770
+ code: lua["check.lua"]
771
+ },
772
+ submit: {
773
+ keys: exports.allKeys,
774
+ headers: [
775
+ "validate_keys",
776
+ "validate_client",
777
+ "process_tick",
778
+ "conditions_check"
779
+ ],
780
+ refresh_expiration: true,
781
+ code: lua["submit.lua"]
782
+ },
783
+ register: {
784
+ keys: exports.allKeys,
785
+ headers: [
786
+ "validate_keys",
787
+ "validate_client",
788
+ "process_tick",
789
+ "conditions_check"
790
+ ],
791
+ refresh_expiration: true,
792
+ code: lua["register.lua"]
793
+ },
794
+ free: {
795
+ keys: exports.allKeys,
796
+ headers: [
797
+ "validate_keys",
798
+ "validate_client",
799
+ "process_tick"
800
+ ],
801
+ refresh_expiration: true,
802
+ code: lua["free.lua"]
803
+ },
804
+ current_reservoir: {
805
+ keys: exports.allKeys,
806
+ headers: [
807
+ "validate_keys",
808
+ "validate_client",
809
+ "process_tick"
810
+ ],
811
+ refresh_expiration: false,
812
+ code: lua["current_reservoir.lua"]
813
+ },
814
+ increment_reservoir: {
815
+ keys: exports.allKeys,
816
+ headers: [
817
+ "validate_keys",
818
+ "validate_client",
819
+ "process_tick"
820
+ ],
821
+ refresh_expiration: true,
822
+ code: lua["increment_reservoir.lua"]
823
+ }
824
+ };
825
+ exports.names = Object.keys(templates);
826
+ exports.keys = function(name, id) {
827
+ return templates[name].keys(id);
828
+ };
829
+ exports.payload = function(name) {
830
+ var template = templates[name];
831
+ return Array.prototype.concat(headers.refs, template.headers.map(function(h) {
832
+ return headers[h];
833
+ }), template.refresh_expiration ? headers.refresh_expiration : "", template.code).join("\n");
834
+ };
835
+ }));
836
+ //#endregion
837
+ //#region ../../node_modules/bottleneck/lib/RedisConnection.js
838
+ var require_RedisConnection = /* @__PURE__ */ __commonJSMin(((exports, module) => {
839
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
840
+ try {
841
+ var info = gen[key](arg);
842
+ var value = info.value;
843
+ } catch (error) {
844
+ reject(error);
845
+ return;
846
+ }
847
+ if (info.done) resolve(value);
848
+ else Promise.resolve(value).then(_next, _throw);
849
+ }
850
+ function _asyncToGenerator(fn) {
851
+ return function() {
852
+ var self = this, args = arguments;
853
+ return new Promise(function(resolve, reject) {
854
+ var gen = fn.apply(self, args);
855
+ function _next(value) {
856
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
857
+ }
858
+ function _throw(err) {
859
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
860
+ }
861
+ _next(void 0);
862
+ });
863
+ };
864
+ }
865
+ var Events, RedisConnection, Scripts, parser = require_parser();
866
+ Events = require_Events();
867
+ Scripts = require_Scripts();
868
+ RedisConnection = function() {
869
+ class RedisConnection {
870
+ constructor(options = {}) {
871
+ parser.load(options, this.defaults, this);
872
+ if (this.Redis == null) this.Redis = eval("require")("redis");
873
+ if (this.Events == null) this.Events = new Events(this);
874
+ this.terminated = false;
875
+ if (this.client == null) this.client = this.Redis.createClient(this.clientOptions);
876
+ this.subscriber = this.client.duplicate();
877
+ this.limiters = {};
878
+ this.shas = {};
879
+ this.ready = this.Promise.all([this._setup(this.client, false), this._setup(this.subscriber, true)]).then(() => {
880
+ return this._loadScripts();
881
+ }).then(() => {
882
+ return {
883
+ client: this.client,
884
+ subscriber: this.subscriber
885
+ };
886
+ });
887
+ }
888
+ _setup(client, sub) {
889
+ client.setMaxListeners(0);
890
+ return new this.Promise((resolve, reject) => {
891
+ client.on("error", (e) => {
892
+ return this.Events.trigger("error", e);
893
+ });
894
+ if (sub) client.on("message", (channel, message) => {
895
+ var ref;
896
+ return (ref = this.limiters[channel]) != null ? ref._store.onMessage(channel, message) : void 0;
897
+ });
898
+ if (client.ready) return resolve();
899
+ else return client.once("ready", resolve);
900
+ });
901
+ }
902
+ _loadScript(name) {
903
+ return new this.Promise((resolve, reject) => {
904
+ var payload = Scripts.payload(name);
905
+ return this.client.multi([[
906
+ "script",
907
+ "load",
908
+ payload
909
+ ]]).exec((err, replies) => {
910
+ if (err != null) return reject(err);
911
+ this.shas[name] = replies[0];
912
+ return resolve(replies[0]);
913
+ });
914
+ });
915
+ }
916
+ _loadScripts() {
917
+ return this.Promise.all(Scripts.names.map((k) => {
918
+ return this._loadScript(k);
919
+ }));
920
+ }
921
+ __runCommand__(cmd) {
922
+ var _this = this;
923
+ return _asyncToGenerator(function* () {
924
+ yield _this.ready;
925
+ return new _this.Promise((resolve, reject) => {
926
+ return _this.client.multi([cmd]).exec_atomic(function(err, replies) {
927
+ if (err != null) return reject(err);
928
+ else return resolve(replies[0]);
929
+ });
930
+ });
931
+ })();
932
+ }
933
+ __addLimiter__(instance) {
934
+ return this.Promise.all([instance.channel(), instance.channel_client()].map((channel) => {
935
+ return new this.Promise((resolve, reject) => {
936
+ var handler = (chan) => {
937
+ if (chan === channel) {
938
+ this.subscriber.removeListener("subscribe", handler);
939
+ this.limiters[channel] = instance;
940
+ return resolve();
941
+ }
942
+ };
943
+ this.subscriber.on("subscribe", handler);
944
+ return this.subscriber.subscribe(channel);
945
+ });
946
+ }));
947
+ }
948
+ __removeLimiter__(instance) {
949
+ var _this2 = this;
950
+ return this.Promise.all([instance.channel(), instance.channel_client()].map(/* @__PURE__ */ function() {
951
+ var _ref = _asyncToGenerator(function* (channel) {
952
+ if (!_this2.terminated) yield new _this2.Promise((resolve, reject) => {
953
+ return _this2.subscriber.unsubscribe(channel, function(err, chan) {
954
+ if (err != null) return reject(err);
955
+ if (chan === channel) return resolve();
956
+ });
957
+ });
958
+ return delete _this2.limiters[channel];
959
+ });
960
+ return function(_x) {
961
+ return _ref.apply(this, arguments);
962
+ };
963
+ }()));
964
+ }
965
+ __scriptArgs__(name, id, args, cb) {
966
+ var keys = Scripts.keys(name, id);
967
+ return [this.shas[name], keys.length].concat(keys, args, cb);
968
+ }
969
+ __scriptFn__(name) {
970
+ return this.client.evalsha.bind(this.client);
971
+ }
972
+ disconnect(flush = true) {
973
+ var i, k, len, ref = Object.keys(this.limiters);
974
+ for (i = 0, len = ref.length; i < len; i++) {
975
+ k = ref[i];
976
+ clearInterval(this.limiters[k]._store.heartbeat);
977
+ }
978
+ this.limiters = {};
979
+ this.terminated = true;
980
+ this.client.end(flush);
981
+ this.subscriber.end(flush);
982
+ return this.Promise.resolve();
983
+ }
984
+ }
985
+ RedisConnection.prototype.datastore = "redis";
986
+ RedisConnection.prototype.defaults = {
987
+ Redis: null,
988
+ clientOptions: {},
989
+ client: null,
990
+ Promise,
991
+ Events: null
992
+ };
993
+ return RedisConnection;
994
+ }.call(void 0);
995
+ module.exports = RedisConnection;
996
+ }));
997
+ //#endregion
998
+ //#region ../../node_modules/bottleneck/lib/IORedisConnection.js
999
+ var require_IORedisConnection = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1000
+ function _slicedToArray(arr, i) {
1001
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
1002
+ }
1003
+ function _nonIterableRest() {
1004
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
1005
+ }
1006
+ function _iterableToArrayLimit(arr, i) {
1007
+ var _arr = [];
1008
+ var _n = true;
1009
+ var _d = false;
1010
+ var _e = void 0;
1011
+ try {
1012
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
1013
+ _arr.push(_s.value);
1014
+ if (i && _arr.length === i) break;
1015
+ }
1016
+ } catch (err) {
1017
+ _d = true;
1018
+ _e = err;
1019
+ } finally {
1020
+ try {
1021
+ if (!_n && _i["return"] != null) _i["return"]();
1022
+ } finally {
1023
+ if (_d) throw _e;
1024
+ }
1025
+ }
1026
+ return _arr;
1027
+ }
1028
+ function _arrayWithHoles(arr) {
1029
+ if (Array.isArray(arr)) return arr;
1030
+ }
1031
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1032
+ try {
1033
+ var info = gen[key](arg);
1034
+ var value = info.value;
1035
+ } catch (error) {
1036
+ reject(error);
1037
+ return;
1038
+ }
1039
+ if (info.done) resolve(value);
1040
+ else Promise.resolve(value).then(_next, _throw);
1041
+ }
1042
+ function _asyncToGenerator(fn) {
1043
+ return function() {
1044
+ var self = this, args = arguments;
1045
+ return new Promise(function(resolve, reject) {
1046
+ var gen = fn.apply(self, args);
1047
+ function _next(value) {
1048
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1049
+ }
1050
+ function _throw(err) {
1051
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1052
+ }
1053
+ _next(void 0);
1054
+ });
1055
+ };
1056
+ }
1057
+ var Events, IORedisConnection, Scripts, parser = require_parser();
1058
+ Events = require_Events();
1059
+ Scripts = require_Scripts();
1060
+ IORedisConnection = function() {
1061
+ class IORedisConnection {
1062
+ constructor(options = {}) {
1063
+ parser.load(options, this.defaults, this);
1064
+ if (this.Redis == null) this.Redis = eval("require")("ioredis");
1065
+ if (this.Events == null) this.Events = new Events(this);
1066
+ this.terminated = false;
1067
+ if (this.clusterNodes != null) {
1068
+ this.client = new this.Redis.Cluster(this.clusterNodes, this.clientOptions);
1069
+ this.subscriber = new this.Redis.Cluster(this.clusterNodes, this.clientOptions);
1070
+ } else if (this.client != null && this.client.duplicate == null) this.subscriber = new this.Redis.Cluster(this.client.startupNodes, this.client.options);
1071
+ else {
1072
+ if (this.client == null) this.client = new this.Redis(this.clientOptions);
1073
+ this.subscriber = this.client.duplicate();
1074
+ }
1075
+ this.limiters = {};
1076
+ this.ready = this.Promise.all([this._setup(this.client, false), this._setup(this.subscriber, true)]).then(() => {
1077
+ this._loadScripts();
1078
+ return {
1079
+ client: this.client,
1080
+ subscriber: this.subscriber
1081
+ };
1082
+ });
1083
+ }
1084
+ _setup(client, sub) {
1085
+ client.setMaxListeners(0);
1086
+ return new this.Promise((resolve, reject) => {
1087
+ client.on("error", (e) => {
1088
+ return this.Events.trigger("error", e);
1089
+ });
1090
+ if (sub) client.on("message", (channel, message) => {
1091
+ var ref;
1092
+ return (ref = this.limiters[channel]) != null ? ref._store.onMessage(channel, message) : void 0;
1093
+ });
1094
+ if (client.status === "ready") return resolve();
1095
+ else return client.once("ready", resolve);
1096
+ });
1097
+ }
1098
+ _loadScripts() {
1099
+ return Scripts.names.forEach((name) => {
1100
+ return this.client.defineCommand(name, { lua: Scripts.payload(name) });
1101
+ });
1102
+ }
1103
+ __runCommand__(cmd) {
1104
+ var _this = this;
1105
+ return _asyncToGenerator(function* () {
1106
+ var _, deleted;
1107
+ yield _this.ready;
1108
+ var _ref2$ = _slicedToArray(_slicedToArray(yield _this.client.pipeline([cmd]).exec(), 1)[0], 2);
1109
+ _ref2$[0];
1110
+ deleted = _ref2$[1];
1111
+ return deleted;
1112
+ })();
1113
+ }
1114
+ __addLimiter__(instance) {
1115
+ return this.Promise.all([instance.channel(), instance.channel_client()].map((channel) => {
1116
+ return new this.Promise((resolve, reject) => {
1117
+ return this.subscriber.subscribe(channel, () => {
1118
+ this.limiters[channel] = instance;
1119
+ return resolve();
1120
+ });
1121
+ });
1122
+ }));
1123
+ }
1124
+ __removeLimiter__(instance) {
1125
+ var _this2 = this;
1126
+ return [instance.channel(), instance.channel_client()].forEach(/* @__PURE__ */ function() {
1127
+ var _ref3 = _asyncToGenerator(function* (channel) {
1128
+ if (!_this2.terminated) yield _this2.subscriber.unsubscribe(channel);
1129
+ return delete _this2.limiters[channel];
1130
+ });
1131
+ return function(_x) {
1132
+ return _ref3.apply(this, arguments);
1133
+ };
1134
+ }());
1135
+ }
1136
+ __scriptArgs__(name, id, args, cb) {
1137
+ var keys = Scripts.keys(name, id);
1138
+ return [keys.length].concat(keys, args, cb);
1139
+ }
1140
+ __scriptFn__(name) {
1141
+ return this.client[name].bind(this.client);
1142
+ }
1143
+ disconnect(flush = true) {
1144
+ var i, k, len, ref = Object.keys(this.limiters);
1145
+ for (i = 0, len = ref.length; i < len; i++) {
1146
+ k = ref[i];
1147
+ clearInterval(this.limiters[k]._store.heartbeat);
1148
+ }
1149
+ this.limiters = {};
1150
+ this.terminated = true;
1151
+ if (flush) return this.Promise.all([this.client.quit(), this.subscriber.quit()]);
1152
+ else {
1153
+ this.client.disconnect();
1154
+ this.subscriber.disconnect();
1155
+ return this.Promise.resolve();
1156
+ }
1157
+ }
1158
+ }
1159
+ IORedisConnection.prototype.datastore = "ioredis";
1160
+ IORedisConnection.prototype.defaults = {
1161
+ Redis: null,
1162
+ clientOptions: {},
1163
+ clusterNodes: null,
1164
+ client: null,
1165
+ Promise,
1166
+ Events: null
1167
+ };
1168
+ return IORedisConnection;
1169
+ }.call(void 0);
1170
+ module.exports = IORedisConnection;
1171
+ }));
1172
+ //#endregion
1173
+ //#region ../../node_modules/bottleneck/lib/RedisDatastore.js
1174
+ var require_RedisDatastore = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1175
+ function _slicedToArray(arr, i) {
1176
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
1177
+ }
1178
+ function _nonIterableRest() {
1179
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
1180
+ }
1181
+ function _iterableToArrayLimit(arr, i) {
1182
+ var _arr = [];
1183
+ var _n = true;
1184
+ var _d = false;
1185
+ var _e = void 0;
1186
+ try {
1187
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
1188
+ _arr.push(_s.value);
1189
+ if (i && _arr.length === i) break;
1190
+ }
1191
+ } catch (err) {
1192
+ _d = true;
1193
+ _e = err;
1194
+ } finally {
1195
+ try {
1196
+ if (!_n && _i["return"] != null) _i["return"]();
1197
+ } finally {
1198
+ if (_d) throw _e;
1199
+ }
1200
+ }
1201
+ return _arr;
1202
+ }
1203
+ function _arrayWithHoles(arr) {
1204
+ if (Array.isArray(arr)) return arr;
1205
+ }
1206
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1207
+ try {
1208
+ var info = gen[key](arg);
1209
+ var value = info.value;
1210
+ } catch (error) {
1211
+ reject(error);
1212
+ return;
1213
+ }
1214
+ if (info.done) resolve(value);
1215
+ else Promise.resolve(value).then(_next, _throw);
1216
+ }
1217
+ function _asyncToGenerator(fn) {
1218
+ return function() {
1219
+ var self = this, args = arguments;
1220
+ return new Promise(function(resolve, reject) {
1221
+ var gen = fn.apply(self, args);
1222
+ function _next(value) {
1223
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1224
+ }
1225
+ function _throw(err) {
1226
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1227
+ }
1228
+ _next(void 0);
1229
+ });
1230
+ };
1231
+ }
1232
+ var BottleneckError, IORedisConnection, RedisConnection, RedisDatastore, parser = require_parser();
1233
+ BottleneckError = require_BottleneckError();
1234
+ RedisConnection = require_RedisConnection();
1235
+ IORedisConnection = require_IORedisConnection();
1236
+ RedisDatastore = class RedisDatastore {
1237
+ constructor(instance, storeOptions, storeInstanceOptions) {
1238
+ this.instance = instance;
1239
+ this.storeOptions = storeOptions;
1240
+ this.originalId = this.instance.id;
1241
+ this.clientId = this.instance._randomIndex();
1242
+ parser.load(storeInstanceOptions, storeInstanceOptions, this);
1243
+ this.clients = {};
1244
+ this.capacityPriorityCounters = {};
1245
+ this.sharedConnection = this.connection != null;
1246
+ if (this.connection == null) this.connection = this.instance.datastore === "redis" ? new RedisConnection({
1247
+ Redis: this.Redis,
1248
+ clientOptions: this.clientOptions,
1249
+ Promise: this.Promise,
1250
+ Events: this.instance.Events
1251
+ }) : this.instance.datastore === "ioredis" ? new IORedisConnection({
1252
+ Redis: this.Redis,
1253
+ clientOptions: this.clientOptions,
1254
+ clusterNodes: this.clusterNodes,
1255
+ Promise: this.Promise,
1256
+ Events: this.instance.Events
1257
+ }) : void 0;
1258
+ this.instance.connection = this.connection;
1259
+ this.instance.datastore = this.connection.datastore;
1260
+ this.ready = this.connection.ready.then((clients) => {
1261
+ this.clients = clients;
1262
+ return this.runScript("init", this.prepareInitSettings(this.clearDatastore));
1263
+ }).then(() => {
1264
+ return this.connection.__addLimiter__(this.instance);
1265
+ }).then(() => {
1266
+ return this.runScript("register_client", [this.instance.queued()]);
1267
+ }).then(() => {
1268
+ var base;
1269
+ if (typeof (base = this.heartbeat = setInterval(() => {
1270
+ return this.runScript("heartbeat", []).catch((e) => {
1271
+ return this.instance.Events.trigger("error", e);
1272
+ });
1273
+ }, this.heartbeatInterval)).unref === "function") base.unref();
1274
+ return this.clients;
1275
+ });
1276
+ }
1277
+ __publish__(message) {
1278
+ var _this = this;
1279
+ return _asyncToGenerator(function* () {
1280
+ return (yield _this.ready).client.publish(_this.instance.channel(), `message:${message.toString()}`);
1281
+ })();
1282
+ }
1283
+ onMessage(channel, message) {
1284
+ var _this2 = this;
1285
+ return _asyncToGenerator(function* () {
1286
+ var capacity, counter, data, drained, e, newCapacity, pos, priorityClient, rawCapacity, type;
1287
+ try {
1288
+ pos = message.indexOf(":");
1289
+ var _ref2 = [message.slice(0, pos), message.slice(pos + 1)];
1290
+ type = _ref2[0];
1291
+ data = _ref2[1];
1292
+ if (type === "capacity") return yield _this2.instance._drainAll(data.length > 0 ? ~~data : void 0);
1293
+ else if (type === "capacity-priority") {
1294
+ var _data$split2 = _slicedToArray(data.split(":"), 3);
1295
+ rawCapacity = _data$split2[0];
1296
+ priorityClient = _data$split2[1];
1297
+ counter = _data$split2[2];
1298
+ capacity = rawCapacity.length > 0 ? ~~rawCapacity : void 0;
1299
+ if (priorityClient === _this2.clientId) {
1300
+ drained = yield _this2.instance._drainAll(capacity);
1301
+ newCapacity = capacity != null ? capacity - (drained || 0) : "";
1302
+ return yield _this2.clients.client.publish(_this2.instance.channel(), `capacity-priority:${newCapacity}::${counter}`);
1303
+ } else if (priorityClient === "") {
1304
+ clearTimeout(_this2.capacityPriorityCounters[counter]);
1305
+ delete _this2.capacityPriorityCounters[counter];
1306
+ return _this2.instance._drainAll(capacity);
1307
+ } else return _this2.capacityPriorityCounters[counter] = setTimeout(/* @__PURE__ */ _asyncToGenerator(function* () {
1308
+ var e;
1309
+ try {
1310
+ delete _this2.capacityPriorityCounters[counter];
1311
+ yield _this2.runScript("blacklist_client", [priorityClient]);
1312
+ return yield _this2.instance._drainAll(capacity);
1313
+ } catch (error) {
1314
+ e = error;
1315
+ return _this2.instance.Events.trigger("error", e);
1316
+ }
1317
+ }), 1e3);
1318
+ } else if (type === "message") return _this2.instance.Events.trigger("message", data);
1319
+ else if (type === "blocked") return yield _this2.instance._dropAllQueued();
1320
+ } catch (error) {
1321
+ e = error;
1322
+ return _this2.instance.Events.trigger("error", e);
1323
+ }
1324
+ })();
1325
+ }
1326
+ __disconnect__(flush) {
1327
+ clearInterval(this.heartbeat);
1328
+ if (this.sharedConnection) return this.connection.__removeLimiter__(this.instance);
1329
+ else return this.connection.disconnect(flush);
1330
+ }
1331
+ runScript(name, args) {
1332
+ var _this3 = this;
1333
+ return _asyncToGenerator(function* () {
1334
+ if (!(name === "init" || name === "register_client")) yield _this3.ready;
1335
+ return new _this3.Promise((resolve, reject) => {
1336
+ var all_args = [Date.now(), _this3.clientId].concat(args), arr;
1337
+ _this3.instance.Events.trigger("debug", `Calling Redis script: ${name}.lua`, all_args);
1338
+ arr = _this3.connection.__scriptArgs__(name, _this3.originalId, all_args, function(err, replies) {
1339
+ if (err != null) return reject(err);
1340
+ return resolve(replies);
1341
+ });
1342
+ return _this3.connection.__scriptFn__(name)(...arr);
1343
+ }).catch((e) => {
1344
+ if (e.message === "SETTINGS_KEY_NOT_FOUND") if (name === "heartbeat") return _this3.Promise.resolve();
1345
+ else return _this3.runScript("init", _this3.prepareInitSettings(false)).then(() => {
1346
+ return _this3.runScript(name, args);
1347
+ });
1348
+ else if (e.message === "UNKNOWN_CLIENT") return _this3.runScript("register_client", [_this3.instance.queued()]).then(() => {
1349
+ return _this3.runScript(name, args);
1350
+ });
1351
+ else return _this3.Promise.reject(e);
1352
+ });
1353
+ })();
1354
+ }
1355
+ prepareArray(arr) {
1356
+ var i, len, results = [], x;
1357
+ for (i = 0, len = arr.length; i < len; i++) {
1358
+ x = arr[i];
1359
+ results.push(x != null ? x.toString() : "");
1360
+ }
1361
+ return results;
1362
+ }
1363
+ prepareObject(obj) {
1364
+ var arr = [], k, v;
1365
+ for (k in obj) {
1366
+ v = obj[k];
1367
+ arr.push(k, v != null ? v.toString() : "");
1368
+ }
1369
+ return arr;
1370
+ }
1371
+ prepareInitSettings(clear) {
1372
+ var args = this.prepareObject(Object.assign({}, this.storeOptions, {
1373
+ id: this.originalId,
1374
+ version: this.instance.version,
1375
+ groupTimeout: this.timeout,
1376
+ clientTimeout: this.clientTimeout
1377
+ }));
1378
+ args.unshift(clear ? 1 : 0, this.instance.version);
1379
+ return args;
1380
+ }
1381
+ convertBool(b) {
1382
+ return !!b;
1383
+ }
1384
+ __updateSettings__(options) {
1385
+ var _this4 = this;
1386
+ return _asyncToGenerator(function* () {
1387
+ yield _this4.runScript("update_settings", _this4.prepareObject(options));
1388
+ return parser.overwrite(options, options, _this4.storeOptions);
1389
+ })();
1390
+ }
1391
+ __running__() {
1392
+ return this.runScript("running", []);
1393
+ }
1394
+ __queued__() {
1395
+ return this.runScript("queued", []);
1396
+ }
1397
+ __done__() {
1398
+ return this.runScript("done", []);
1399
+ }
1400
+ __groupCheck__() {
1401
+ var _this5 = this;
1402
+ return _asyncToGenerator(function* () {
1403
+ return _this5.convertBool(yield _this5.runScript("group_check", []));
1404
+ })();
1405
+ }
1406
+ __incrementReservoir__(incr) {
1407
+ return this.runScript("increment_reservoir", [incr]);
1408
+ }
1409
+ __currentReservoir__() {
1410
+ return this.runScript("current_reservoir", []);
1411
+ }
1412
+ __check__(weight) {
1413
+ var _this6 = this;
1414
+ return _asyncToGenerator(function* () {
1415
+ return _this6.convertBool(yield _this6.runScript("check", _this6.prepareArray([weight])));
1416
+ })();
1417
+ }
1418
+ __register__(index, weight, expiration) {
1419
+ var _this7 = this;
1420
+ return _asyncToGenerator(function* () {
1421
+ var reservoir, success, wait;
1422
+ var _ref5 = _slicedToArray(yield _this7.runScript("register", _this7.prepareArray([
1423
+ index,
1424
+ weight,
1425
+ expiration
1426
+ ])), 3);
1427
+ success = _ref5[0];
1428
+ wait = _ref5[1];
1429
+ reservoir = _ref5[2];
1430
+ return {
1431
+ success: _this7.convertBool(success),
1432
+ wait,
1433
+ reservoir
1434
+ };
1435
+ })();
1436
+ }
1437
+ __submit__(queueLength, weight) {
1438
+ var _this8 = this;
1439
+ return _asyncToGenerator(function* () {
1440
+ var blocked, e, maxConcurrent, reachedHWM, strategy;
1441
+ try {
1442
+ var _ref7 = _slicedToArray(yield _this8.runScript("submit", _this8.prepareArray([queueLength, weight])), 3);
1443
+ reachedHWM = _ref7[0];
1444
+ blocked = _ref7[1];
1445
+ strategy = _ref7[2];
1446
+ return {
1447
+ reachedHWM: _this8.convertBool(reachedHWM),
1448
+ blocked: _this8.convertBool(blocked),
1449
+ strategy
1450
+ };
1451
+ } catch (error) {
1452
+ e = error;
1453
+ if (e.message.indexOf("OVERWEIGHT") === 0) {
1454
+ var _e$message$split2 = _slicedToArray(e.message.split(":"), 3);
1455
+ _e$message$split2[0];
1456
+ weight = _e$message$split2[1];
1457
+ maxConcurrent = _e$message$split2[2];
1458
+ throw new BottleneckError(`Impossible to add a job having a weight of ${weight} to a limiter having a maxConcurrent setting of ${maxConcurrent}`);
1459
+ } else throw e;
1460
+ }
1461
+ })();
1462
+ }
1463
+ __free__(index, weight) {
1464
+ var _this9 = this;
1465
+ return _asyncToGenerator(function* () {
1466
+ return { running: yield _this9.runScript("free", _this9.prepareArray([index])) };
1467
+ })();
1468
+ }
1469
+ };
1470
+ module.exports = RedisDatastore;
1471
+ }));
1472
+ //#endregion
1473
+ //#region ../../node_modules/bottleneck/lib/States.js
1474
+ var require_States = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1475
+ var BottleneckError = require_BottleneckError();
1476
+ module.exports = class States {
1477
+ constructor(status1) {
1478
+ this.status = status1;
1479
+ this._jobs = {};
1480
+ this.counts = this.status.map(function() {
1481
+ return 0;
1482
+ });
1483
+ }
1484
+ next(id) {
1485
+ var current = this._jobs[id], next = current + 1;
1486
+ if (current != null && next < this.status.length) {
1487
+ this.counts[current]--;
1488
+ this.counts[next]++;
1489
+ return this._jobs[id]++;
1490
+ } else if (current != null) {
1491
+ this.counts[current]--;
1492
+ return delete this._jobs[id];
1493
+ }
1494
+ }
1495
+ start(id) {
1496
+ var initial = 0;
1497
+ this._jobs[id] = initial;
1498
+ return this.counts[initial]++;
1499
+ }
1500
+ remove(id) {
1501
+ var current = this._jobs[id];
1502
+ if (current != null) {
1503
+ this.counts[current]--;
1504
+ delete this._jobs[id];
1505
+ }
1506
+ return current != null;
1507
+ }
1508
+ jobStatus(id) {
1509
+ var ref;
1510
+ return (ref = this.status[this._jobs[id]]) != null ? ref : null;
1511
+ }
1512
+ statusJobs(status) {
1513
+ var k, pos, ref, results, v;
1514
+ if (status != null) {
1515
+ pos = this.status.indexOf(status);
1516
+ if (pos < 0) throw new BottleneckError(`status must be one of ${this.status.join(", ")}`);
1517
+ ref = this._jobs;
1518
+ results = [];
1519
+ for (k in ref) {
1520
+ v = ref[k];
1521
+ if (v === pos) results.push(k);
1522
+ }
1523
+ return results;
1524
+ } else return Object.keys(this._jobs);
1525
+ }
1526
+ statusCounts() {
1527
+ return this.counts.reduce((acc, v, i) => {
1528
+ acc[this.status[i]] = v;
1529
+ return acc;
1530
+ }, {});
1531
+ }
1532
+ };
1533
+ }));
1534
+ //#endregion
1535
+ //#region ../../node_modules/bottleneck/lib/Sync.js
1536
+ var require_Sync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1537
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1538
+ try {
1539
+ var info = gen[key](arg);
1540
+ var value = info.value;
1541
+ } catch (error) {
1542
+ reject(error);
1543
+ return;
1544
+ }
1545
+ if (info.done) resolve(value);
1546
+ else Promise.resolve(value).then(_next, _throw);
1547
+ }
1548
+ function _asyncToGenerator(fn) {
1549
+ return function() {
1550
+ var self = this, args = arguments;
1551
+ return new Promise(function(resolve, reject) {
1552
+ var gen = fn.apply(self, args);
1553
+ function _next(value) {
1554
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1555
+ }
1556
+ function _throw(err) {
1557
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1558
+ }
1559
+ _next(void 0);
1560
+ });
1561
+ };
1562
+ }
1563
+ var DLList = require_DLList();
1564
+ module.exports = class Sync {
1565
+ constructor(name, Promise) {
1566
+ this.schedule = this.schedule.bind(this);
1567
+ this.name = name;
1568
+ this.Promise = Promise;
1569
+ this._running = 0;
1570
+ this._queue = new DLList();
1571
+ }
1572
+ isEmpty() {
1573
+ return this._queue.length === 0;
1574
+ }
1575
+ _tryToRun() {
1576
+ var _this = this;
1577
+ return _asyncToGenerator(function* () {
1578
+ var args, cb, error, reject, resolve, returned, task;
1579
+ if (_this._running < 1 && _this._queue.length > 0) {
1580
+ _this._running++;
1581
+ var _this$_queue$shift = _this._queue.shift();
1582
+ task = _this$_queue$shift.task;
1583
+ args = _this$_queue$shift.args;
1584
+ resolve = _this$_queue$shift.resolve;
1585
+ reject = _this$_queue$shift.reject;
1586
+ cb = yield _asyncToGenerator(function* () {
1587
+ try {
1588
+ returned = yield task(...args);
1589
+ return function() {
1590
+ return resolve(returned);
1591
+ };
1592
+ } catch (error1) {
1593
+ error = error1;
1594
+ return function() {
1595
+ return reject(error);
1596
+ };
1597
+ }
1598
+ })();
1599
+ _this._running--;
1600
+ _this._tryToRun();
1601
+ return cb();
1602
+ }
1603
+ })();
1604
+ }
1605
+ schedule(task, ...args) {
1606
+ var promise, reject, resolve = reject = null;
1607
+ promise = new this.Promise(function(_resolve, _reject) {
1608
+ resolve = _resolve;
1609
+ return reject = _reject;
1610
+ });
1611
+ this._queue.push({
1612
+ task,
1613
+ args,
1614
+ resolve,
1615
+ reject
1616
+ });
1617
+ this._tryToRun();
1618
+ return promise;
1619
+ }
1620
+ };
1621
+ }));
1622
+ //#endregion
1623
+ //#region ../../node_modules/bottleneck/lib/version.json
1624
+ var require_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1625
+ module.exports = { "version": "2.19.5" };
1626
+ }));
1627
+ //#endregion
1628
+ //#region ../../node_modules/bottleneck/lib/Group.js
1629
+ var require_Group = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1630
+ function _slicedToArray(arr, i) {
1631
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
1632
+ }
1633
+ function _nonIterableRest() {
1634
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
1635
+ }
1636
+ function _iterableToArrayLimit(arr, i) {
1637
+ var _arr = [];
1638
+ var _n = true;
1639
+ var _d = false;
1640
+ var _e = void 0;
1641
+ try {
1642
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
1643
+ _arr.push(_s.value);
1644
+ if (i && _arr.length === i) break;
1645
+ }
1646
+ } catch (err) {
1647
+ _d = true;
1648
+ _e = err;
1649
+ } finally {
1650
+ try {
1651
+ if (!_n && _i["return"] != null) _i["return"]();
1652
+ } finally {
1653
+ if (_d) throw _e;
1654
+ }
1655
+ }
1656
+ return _arr;
1657
+ }
1658
+ function _arrayWithHoles(arr) {
1659
+ if (Array.isArray(arr)) return arr;
1660
+ }
1661
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1662
+ try {
1663
+ var info = gen[key](arg);
1664
+ var value = info.value;
1665
+ } catch (error) {
1666
+ reject(error);
1667
+ return;
1668
+ }
1669
+ if (info.done) resolve(value);
1670
+ else Promise.resolve(value).then(_next, _throw);
1671
+ }
1672
+ function _asyncToGenerator(fn) {
1673
+ return function() {
1674
+ var self = this, args = arguments;
1675
+ return new Promise(function(resolve, reject) {
1676
+ var gen = fn.apply(self, args);
1677
+ function _next(value) {
1678
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1679
+ }
1680
+ function _throw(err) {
1681
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1682
+ }
1683
+ _next(void 0);
1684
+ });
1685
+ };
1686
+ }
1687
+ var Events, Group, IORedisConnection, RedisConnection, Scripts, parser = require_parser();
1688
+ Events = require_Events();
1689
+ RedisConnection = require_RedisConnection();
1690
+ IORedisConnection = require_IORedisConnection();
1691
+ Scripts = require_Scripts();
1692
+ Group = function() {
1693
+ class Group {
1694
+ constructor(limiterOptions = {}) {
1695
+ this.deleteKey = this.deleteKey.bind(this);
1696
+ this.limiterOptions = limiterOptions;
1697
+ parser.load(this.limiterOptions, this.defaults, this);
1698
+ this.Events = new Events(this);
1699
+ this.instances = {};
1700
+ this.Bottleneck = require_Bottleneck();
1701
+ this._startAutoCleanup();
1702
+ this.sharedConnection = this.connection != null;
1703
+ if (this.connection == null) {
1704
+ if (this.limiterOptions.datastore === "redis") this.connection = new RedisConnection(Object.assign({}, this.limiterOptions, { Events: this.Events }));
1705
+ else if (this.limiterOptions.datastore === "ioredis") this.connection = new IORedisConnection(Object.assign({}, this.limiterOptions, { Events: this.Events }));
1706
+ }
1707
+ }
1708
+ key(key = "") {
1709
+ var ref;
1710
+ return (ref = this.instances[key]) != null ? ref : (() => {
1711
+ var limiter = this.instances[key] = new this.Bottleneck(Object.assign(this.limiterOptions, {
1712
+ id: `${this.id}-${key}`,
1713
+ timeout: this.timeout,
1714
+ connection: this.connection
1715
+ }));
1716
+ this.Events.trigger("created", limiter, key);
1717
+ return limiter;
1718
+ })();
1719
+ }
1720
+ deleteKey(key = "") {
1721
+ var _this = this;
1722
+ return _asyncToGenerator(function* () {
1723
+ var deleted, instance = _this.instances[key];
1724
+ if (_this.connection) deleted = yield _this.connection.__runCommand__(["del", ...Scripts.allKeys(`${_this.id}-${key}`)]);
1725
+ if (instance != null) {
1726
+ delete _this.instances[key];
1727
+ yield instance.disconnect();
1728
+ }
1729
+ return instance != null || deleted > 0;
1730
+ })();
1731
+ }
1732
+ limiters() {
1733
+ var k, ref = this.instances, results = [], v;
1734
+ for (k in ref) {
1735
+ v = ref[k];
1736
+ results.push({
1737
+ key: k,
1738
+ limiter: v
1739
+ });
1740
+ }
1741
+ return results;
1742
+ }
1743
+ keys() {
1744
+ return Object.keys(this.instances);
1745
+ }
1746
+ clusterKeys() {
1747
+ var _this2 = this;
1748
+ return _asyncToGenerator(function* () {
1749
+ var cursor, end, found, i, k, keys, len, next, start;
1750
+ if (_this2.connection == null) return _this2.Promise.resolve(_this2.keys());
1751
+ keys = [];
1752
+ cursor = null;
1753
+ start = `b_${_this2.id}-`.length;
1754
+ end = 9;
1755
+ while (cursor !== 0) {
1756
+ var _ref2 = _slicedToArray(yield _this2.connection.__runCommand__([
1757
+ "scan",
1758
+ cursor != null ? cursor : 0,
1759
+ "match",
1760
+ `b_${_this2.id}-*_settings`,
1761
+ "count",
1762
+ 1e4
1763
+ ]), 2);
1764
+ next = _ref2[0];
1765
+ found = _ref2[1];
1766
+ cursor = ~~next;
1767
+ for (i = 0, len = found.length; i < len; i++) {
1768
+ k = found[i];
1769
+ keys.push(k.slice(start, -end));
1770
+ }
1771
+ }
1772
+ return keys;
1773
+ })();
1774
+ }
1775
+ _startAutoCleanup() {
1776
+ var _this3 = this;
1777
+ var base;
1778
+ clearInterval(this.interval);
1779
+ return typeof (base = this.interval = setInterval(/* @__PURE__ */ _asyncToGenerator(function* () {
1780
+ var e, k, ref, results, time = Date.now(), v;
1781
+ ref = _this3.instances;
1782
+ results = [];
1783
+ for (k in ref) {
1784
+ v = ref[k];
1785
+ try {
1786
+ if (yield v._store.__groupCheck__(time)) results.push(_this3.deleteKey(k));
1787
+ else results.push(void 0);
1788
+ } catch (error) {
1789
+ e = error;
1790
+ results.push(v.Events.trigger("error", e));
1791
+ }
1792
+ }
1793
+ return results;
1794
+ }), this.timeout / 2)).unref === "function" ? base.unref() : void 0;
1795
+ }
1796
+ updateSettings(options = {}) {
1797
+ parser.overwrite(options, this.defaults, this);
1798
+ parser.overwrite(options, options, this.limiterOptions);
1799
+ if (options.timeout != null) return this._startAutoCleanup();
1800
+ }
1801
+ disconnect(flush = true) {
1802
+ var ref;
1803
+ if (!this.sharedConnection) return (ref = this.connection) != null ? ref.disconnect(flush) : void 0;
1804
+ }
1805
+ }
1806
+ Group.prototype.defaults = {
1807
+ timeout: 1e3 * 60 * 5,
1808
+ connection: null,
1809
+ Promise,
1810
+ id: "group-key"
1811
+ };
1812
+ return Group;
1813
+ }.call(void 0);
1814
+ module.exports = Group;
1815
+ }));
1816
+ //#endregion
1817
+ //#region ../../node_modules/bottleneck/lib/Batcher.js
1818
+ var require_Batcher = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1819
+ var Batcher, Events, parser = require_parser();
1820
+ Events = require_Events();
1821
+ Batcher = function() {
1822
+ class Batcher {
1823
+ constructor(options = {}) {
1824
+ this.options = options;
1825
+ parser.load(this.options, this.defaults, this);
1826
+ this.Events = new Events(this);
1827
+ this._arr = [];
1828
+ this._resetPromise();
1829
+ this._lastFlush = Date.now();
1830
+ }
1831
+ _resetPromise() {
1832
+ return this._promise = new this.Promise((res, rej) => {
1833
+ return this._resolve = res;
1834
+ });
1835
+ }
1836
+ _flush() {
1837
+ clearTimeout(this._timeout);
1838
+ this._lastFlush = Date.now();
1839
+ this._resolve();
1840
+ this.Events.trigger("batch", this._arr);
1841
+ this._arr = [];
1842
+ return this._resetPromise();
1843
+ }
1844
+ add(data) {
1845
+ var ret;
1846
+ this._arr.push(data);
1847
+ ret = this._promise;
1848
+ if (this._arr.length === this.maxSize) this._flush();
1849
+ else if (this.maxTime != null && this._arr.length === 1) this._timeout = setTimeout(() => {
1850
+ return this._flush();
1851
+ }, this.maxTime);
1852
+ return ret;
1853
+ }
1854
+ }
1855
+ Batcher.prototype.defaults = {
1856
+ maxTime: null,
1857
+ maxSize: null,
1858
+ Promise
1859
+ };
1860
+ return Batcher;
1861
+ }.call(void 0);
1862
+ module.exports = Batcher;
1863
+ }));
1864
+ //#endregion
1865
+ //#region ../../node_modules/bottleneck/lib/Bottleneck.js
1866
+ var require_Bottleneck = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1867
+ function _slicedToArray(arr, i) {
1868
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
1869
+ }
1870
+ function _iterableToArrayLimit(arr, i) {
1871
+ var _arr = [];
1872
+ var _n = true;
1873
+ var _d = false;
1874
+ var _e = void 0;
1875
+ try {
1876
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
1877
+ _arr.push(_s.value);
1878
+ if (i && _arr.length === i) break;
1879
+ }
1880
+ } catch (err) {
1881
+ _d = true;
1882
+ _e = err;
1883
+ } finally {
1884
+ try {
1885
+ if (!_n && _i["return"] != null) _i["return"]();
1886
+ } finally {
1887
+ if (_d) throw _e;
1888
+ }
1889
+ }
1890
+ return _arr;
1891
+ }
1892
+ function _toArray(arr) {
1893
+ return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest();
1894
+ }
1895
+ function _nonIterableRest() {
1896
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
1897
+ }
1898
+ function _iterableToArray(iter) {
1899
+ if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
1900
+ }
1901
+ function _arrayWithHoles(arr) {
1902
+ if (Array.isArray(arr)) return arr;
1903
+ }
1904
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1905
+ try {
1906
+ var info = gen[key](arg);
1907
+ var value = info.value;
1908
+ } catch (error) {
1909
+ reject(error);
1910
+ return;
1911
+ }
1912
+ if (info.done) resolve(value);
1913
+ else Promise.resolve(value).then(_next, _throw);
1914
+ }
1915
+ function _asyncToGenerator(fn) {
1916
+ return function() {
1917
+ var self = this, args = arguments;
1918
+ return new Promise(function(resolve, reject) {
1919
+ var gen = fn.apply(self, args);
1920
+ function _next(value) {
1921
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1922
+ }
1923
+ function _throw(err) {
1924
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1925
+ }
1926
+ _next(void 0);
1927
+ });
1928
+ };
1929
+ }
1930
+ var Bottleneck, DEFAULT_PRIORITY, Events, Job, LocalDatastore, NUM_PRIORITIES, Queues, RedisDatastore, States, Sync, parser, splice = [].splice;
1931
+ NUM_PRIORITIES = 10;
1932
+ DEFAULT_PRIORITY = 5;
1933
+ parser = require_parser();
1934
+ Queues = require_Queues();
1935
+ Job = require_Job();
1936
+ LocalDatastore = require_LocalDatastore();
1937
+ RedisDatastore = require_RedisDatastore();
1938
+ Events = require_Events();
1939
+ States = require_States();
1940
+ Sync = require_Sync();
1941
+ Bottleneck = function() {
1942
+ class Bottleneck {
1943
+ constructor(options = {}, ...invalid) {
1944
+ var storeInstanceOptions, storeOptions;
1945
+ this._addToQueue = this._addToQueue.bind(this);
1946
+ this._validateOptions(options, invalid);
1947
+ parser.load(options, this.instanceDefaults, this);
1948
+ this._queues = new Queues(NUM_PRIORITIES);
1949
+ this._scheduled = {};
1950
+ this._states = new States([
1951
+ "RECEIVED",
1952
+ "QUEUED",
1953
+ "RUNNING",
1954
+ "EXECUTING"
1955
+ ].concat(this.trackDoneStatus ? ["DONE"] : []));
1956
+ this._limiter = null;
1957
+ this.Events = new Events(this);
1958
+ this._submitLock = new Sync("submit", this.Promise);
1959
+ this._registerLock = new Sync("register", this.Promise);
1960
+ storeOptions = parser.load(options, this.storeDefaults, {});
1961
+ this._store = function() {
1962
+ if (this.datastore === "redis" || this.datastore === "ioredis" || this.connection != null) {
1963
+ storeInstanceOptions = parser.load(options, this.redisStoreDefaults, {});
1964
+ return new RedisDatastore(this, storeOptions, storeInstanceOptions);
1965
+ } else if (this.datastore === "local") {
1966
+ storeInstanceOptions = parser.load(options, this.localStoreDefaults, {});
1967
+ return new LocalDatastore(this, storeOptions, storeInstanceOptions);
1968
+ } else throw new Bottleneck.prototype.BottleneckError(`Invalid datastore type: ${this.datastore}`);
1969
+ }.call(this);
1970
+ this._queues.on("leftzero", () => {
1971
+ var ref;
1972
+ return (ref = this._store.heartbeat) != null ? typeof ref.ref === "function" ? ref.ref() : void 0 : void 0;
1973
+ });
1974
+ this._queues.on("zero", () => {
1975
+ var ref;
1976
+ return (ref = this._store.heartbeat) != null ? typeof ref.unref === "function" ? ref.unref() : void 0 : void 0;
1977
+ });
1978
+ }
1979
+ _validateOptions(options, invalid) {
1980
+ if (!(options != null && typeof options === "object" && invalid.length === 0)) throw new Bottleneck.prototype.BottleneckError("Bottleneck v2 takes a single object argument. Refer to https://github.com/SGrondin/bottleneck#upgrading-to-v2 if you're upgrading from Bottleneck v1.");
1981
+ }
1982
+ ready() {
1983
+ return this._store.ready;
1984
+ }
1985
+ clients() {
1986
+ return this._store.clients;
1987
+ }
1988
+ channel() {
1989
+ return `b_${this.id}`;
1990
+ }
1991
+ channel_client() {
1992
+ return `b_${this.id}_${this._store.clientId}`;
1993
+ }
1994
+ publish(message) {
1995
+ return this._store.__publish__(message);
1996
+ }
1997
+ disconnect(flush = true) {
1998
+ return this._store.__disconnect__(flush);
1999
+ }
2000
+ chain(_limiter) {
2001
+ this._limiter = _limiter;
2002
+ return this;
2003
+ }
2004
+ queued(priority) {
2005
+ return this._queues.queued(priority);
2006
+ }
2007
+ clusterQueued() {
2008
+ return this._store.__queued__();
2009
+ }
2010
+ empty() {
2011
+ return this.queued() === 0 && this._submitLock.isEmpty();
2012
+ }
2013
+ running() {
2014
+ return this._store.__running__();
2015
+ }
2016
+ done() {
2017
+ return this._store.__done__();
2018
+ }
2019
+ jobStatus(id) {
2020
+ return this._states.jobStatus(id);
2021
+ }
2022
+ jobs(status) {
2023
+ return this._states.statusJobs(status);
2024
+ }
2025
+ counts() {
2026
+ return this._states.statusCounts();
2027
+ }
2028
+ _randomIndex() {
2029
+ return Math.random().toString(36).slice(2);
2030
+ }
2031
+ check(weight = 1) {
2032
+ return this._store.__check__(weight);
2033
+ }
2034
+ _clearGlobalState(index) {
2035
+ if (this._scheduled[index] != null) {
2036
+ clearTimeout(this._scheduled[index].expiration);
2037
+ delete this._scheduled[index];
2038
+ return true;
2039
+ } else return false;
2040
+ }
2041
+ _free(index, job, options, eventInfo) {
2042
+ var _this = this;
2043
+ return _asyncToGenerator(function* () {
2044
+ var e, running;
2045
+ try {
2046
+ running = (yield _this._store.__free__(index, options.weight)).running;
2047
+ _this.Events.trigger("debug", `Freed ${options.id}`, eventInfo);
2048
+ if (running === 0 && _this.empty()) return _this.Events.trigger("idle");
2049
+ } catch (error1) {
2050
+ e = error1;
2051
+ return _this.Events.trigger("error", e);
2052
+ }
2053
+ })();
2054
+ }
2055
+ _run(index, job, wait) {
2056
+ var clearGlobalState, free, run;
2057
+ job.doRun();
2058
+ clearGlobalState = this._clearGlobalState.bind(this, index);
2059
+ run = this._run.bind(this, index, job);
2060
+ free = this._free.bind(this, index, job);
2061
+ return this._scheduled[index] = {
2062
+ timeout: setTimeout(() => {
2063
+ return job.doExecute(this._limiter, clearGlobalState, run, free);
2064
+ }, wait),
2065
+ expiration: job.options.expiration != null ? setTimeout(function() {
2066
+ return job.doExpire(clearGlobalState, run, free);
2067
+ }, wait + job.options.expiration) : void 0,
2068
+ job
2069
+ };
2070
+ }
2071
+ _drainOne(capacity) {
2072
+ return this._registerLock.schedule(() => {
2073
+ var args, index, next, options, queue;
2074
+ if (this.queued() === 0) return this.Promise.resolve(null);
2075
+ queue = this._queues.getFirst();
2076
+ var _next2 = next = queue.first();
2077
+ options = _next2.options;
2078
+ args = _next2.args;
2079
+ if (capacity != null && options.weight > capacity) return this.Promise.resolve(null);
2080
+ this.Events.trigger("debug", `Draining ${options.id}`, {
2081
+ args,
2082
+ options
2083
+ });
2084
+ index = this._randomIndex();
2085
+ return this._store.__register__(index, options.weight, options.expiration).then(({ success, wait, reservoir }) => {
2086
+ var empty;
2087
+ this.Events.trigger("debug", `Drained ${options.id}`, {
2088
+ success,
2089
+ args,
2090
+ options
2091
+ });
2092
+ if (success) {
2093
+ queue.shift();
2094
+ empty = this.empty();
2095
+ if (empty) this.Events.trigger("empty");
2096
+ if (reservoir === 0) this.Events.trigger("depleted", empty);
2097
+ this._run(index, next, wait);
2098
+ return this.Promise.resolve(options.weight);
2099
+ } else return this.Promise.resolve(null);
2100
+ });
2101
+ });
2102
+ }
2103
+ _drainAll(capacity, total = 0) {
2104
+ return this._drainOne(capacity).then((drained) => {
2105
+ var newCapacity;
2106
+ if (drained != null) {
2107
+ newCapacity = capacity != null ? capacity - drained : capacity;
2108
+ return this._drainAll(newCapacity, total + drained);
2109
+ } else return this.Promise.resolve(total);
2110
+ }).catch((e) => {
2111
+ return this.Events.trigger("error", e);
2112
+ });
2113
+ }
2114
+ _dropAllQueued(message) {
2115
+ return this._queues.shiftAll(function(job) {
2116
+ return job.doDrop({ message });
2117
+ });
2118
+ }
2119
+ stop(options = {}) {
2120
+ var done, waitForExecuting;
2121
+ options = parser.load(options, this.stopDefaults);
2122
+ waitForExecuting = (at) => {
2123
+ var finished = () => {
2124
+ var counts = this._states.counts;
2125
+ return counts[0] + counts[1] + counts[2] + counts[3] === at;
2126
+ };
2127
+ return new this.Promise((resolve, reject) => {
2128
+ if (finished()) return resolve();
2129
+ else return this.on("done", () => {
2130
+ if (finished()) {
2131
+ this.removeAllListeners("done");
2132
+ return resolve();
2133
+ }
2134
+ });
2135
+ });
2136
+ };
2137
+ done = options.dropWaitingJobs ? (this._run = function(index, next) {
2138
+ return next.doDrop({ message: options.dropErrorMessage });
2139
+ }, this._drainOne = () => {
2140
+ return this.Promise.resolve(null);
2141
+ }, this._registerLock.schedule(() => {
2142
+ return this._submitLock.schedule(() => {
2143
+ var k, ref = this._scheduled, v;
2144
+ for (k in ref) {
2145
+ v = ref[k];
2146
+ if (this.jobStatus(v.job.options.id) === "RUNNING") {
2147
+ clearTimeout(v.timeout);
2148
+ clearTimeout(v.expiration);
2149
+ v.job.doDrop({ message: options.dropErrorMessage });
2150
+ }
2151
+ }
2152
+ this._dropAllQueued(options.dropErrorMessage);
2153
+ return waitForExecuting(0);
2154
+ });
2155
+ })) : this.schedule({
2156
+ priority: NUM_PRIORITIES - 1,
2157
+ weight: 0
2158
+ }, () => {
2159
+ return waitForExecuting(1);
2160
+ });
2161
+ this._receive = function(job) {
2162
+ return job._reject(new Bottleneck.prototype.BottleneckError(options.enqueueErrorMessage));
2163
+ };
2164
+ this.stop = () => {
2165
+ return this.Promise.reject(new Bottleneck.prototype.BottleneckError("stop() has already been called"));
2166
+ };
2167
+ return done;
2168
+ }
2169
+ _addToQueue(job) {
2170
+ var _this2 = this;
2171
+ return _asyncToGenerator(function* () {
2172
+ var args = job.args, blocked, error, options = job.options, reachedHWM, shifted, strategy;
2173
+ try {
2174
+ var _ref2 = yield _this2._store.__submit__(_this2.queued(), options.weight);
2175
+ reachedHWM = _ref2.reachedHWM;
2176
+ blocked = _ref2.blocked;
2177
+ strategy = _ref2.strategy;
2178
+ } catch (error1) {
2179
+ error = error1;
2180
+ _this2.Events.trigger("debug", `Could not queue ${options.id}`, {
2181
+ args,
2182
+ options,
2183
+ error
2184
+ });
2185
+ job.doDrop({ error });
2186
+ return false;
2187
+ }
2188
+ if (blocked) {
2189
+ job.doDrop();
2190
+ return true;
2191
+ } else if (reachedHWM) {
2192
+ shifted = strategy === Bottleneck.prototype.strategy.LEAK ? _this2._queues.shiftLastFrom(options.priority) : strategy === Bottleneck.prototype.strategy.OVERFLOW_PRIORITY ? _this2._queues.shiftLastFrom(options.priority + 1) : strategy === Bottleneck.prototype.strategy.OVERFLOW ? job : void 0;
2193
+ if (shifted != null) shifted.doDrop();
2194
+ if (shifted == null || strategy === Bottleneck.prototype.strategy.OVERFLOW) {
2195
+ if (shifted == null) job.doDrop();
2196
+ return reachedHWM;
2197
+ }
2198
+ }
2199
+ job.doQueue(reachedHWM, blocked);
2200
+ _this2._queues.push(job);
2201
+ yield _this2._drainAll();
2202
+ return reachedHWM;
2203
+ })();
2204
+ }
2205
+ _receive(job) {
2206
+ if (this._states.jobStatus(job.options.id) != null) {
2207
+ job._reject(new Bottleneck.prototype.BottleneckError(`A job with the same id already exists (id=${job.options.id})`));
2208
+ return false;
2209
+ } else {
2210
+ job.doReceive();
2211
+ return this._submitLock.schedule(this._addToQueue, job);
2212
+ }
2213
+ }
2214
+ submit(...args) {
2215
+ var cb, fn, job, options, ref, ref1, task;
2216
+ if (typeof args[0] === "function") {
2217
+ var _ref3, _ref4, _splice$call, _splice$call2;
2218
+ ref = args, _ref3 = ref, _ref4 = _toArray(_ref3), fn = _ref4[0], args = _ref4.slice(1), _splice$call = splice.call(args, -1), _splice$call2 = _slicedToArray(_splice$call, 1), cb = _splice$call2[0];
2219
+ options = parser.load({}, this.jobDefaults);
2220
+ } else {
2221
+ var _ref5, _ref6, _splice$call3, _splice$call4;
2222
+ ref1 = args, _ref5 = ref1, _ref6 = _toArray(_ref5), options = _ref6[0], fn = _ref6[1], args = _ref6.slice(2), _splice$call3 = splice.call(args, -1), _splice$call4 = _slicedToArray(_splice$call3, 1), cb = _splice$call4[0];
2223
+ options = parser.load(options, this.jobDefaults);
2224
+ }
2225
+ task = (...args) => {
2226
+ return new this.Promise(function(resolve, reject) {
2227
+ return fn(...args, function(...args) {
2228
+ return (args[0] != null ? reject : resolve)(args);
2229
+ });
2230
+ });
2231
+ };
2232
+ job = new Job(task, args, options, this.jobDefaults, this.rejectOnDrop, this.Events, this._states, this.Promise);
2233
+ job.promise.then(function(args) {
2234
+ return typeof cb === "function" ? cb(...args) : void 0;
2235
+ }).catch(function(args) {
2236
+ if (Array.isArray(args)) return typeof cb === "function" ? cb(...args) : void 0;
2237
+ else return typeof cb === "function" ? cb(args) : void 0;
2238
+ });
2239
+ return this._receive(job);
2240
+ }
2241
+ schedule(...args) {
2242
+ var job, options, task;
2243
+ if (typeof args[0] === "function") {
2244
+ var _args2 = _toArray(args);
2245
+ task = _args2[0];
2246
+ args = _args2.slice(1);
2247
+ options = {};
2248
+ } else {
2249
+ var _args4 = _toArray(args);
2250
+ options = _args4[0];
2251
+ task = _args4[1];
2252
+ args = _args4.slice(2);
2253
+ }
2254
+ job = new Job(task, args, options, this.jobDefaults, this.rejectOnDrop, this.Events, this._states, this.Promise);
2255
+ this._receive(job);
2256
+ return job.promise;
2257
+ }
2258
+ wrap(fn) {
2259
+ var schedule = this.schedule.bind(this), wrapped = function wrapped(...args) {
2260
+ return schedule(fn.bind(this), ...args);
2261
+ };
2262
+ wrapped.withOptions = function(options, ...args) {
2263
+ return schedule(options, fn, ...args);
2264
+ };
2265
+ return wrapped;
2266
+ }
2267
+ updateSettings(options = {}) {
2268
+ var _this3 = this;
2269
+ return _asyncToGenerator(function* () {
2270
+ yield _this3._store.__updateSettings__(parser.overwrite(options, _this3.storeDefaults));
2271
+ parser.overwrite(options, _this3.instanceDefaults, _this3);
2272
+ return _this3;
2273
+ })();
2274
+ }
2275
+ currentReservoir() {
2276
+ return this._store.__currentReservoir__();
2277
+ }
2278
+ incrementReservoir(incr = 0) {
2279
+ return this._store.__incrementReservoir__(incr);
2280
+ }
2281
+ }
2282
+ Bottleneck.default = Bottleneck;
2283
+ Bottleneck.Events = Events;
2284
+ Bottleneck.version = Bottleneck.prototype.version = require_version().version;
2285
+ Bottleneck.strategy = Bottleneck.prototype.strategy = {
2286
+ LEAK: 1,
2287
+ OVERFLOW: 2,
2288
+ OVERFLOW_PRIORITY: 4,
2289
+ BLOCK: 3
2290
+ };
2291
+ Bottleneck.BottleneckError = Bottleneck.prototype.BottleneckError = require_BottleneckError();
2292
+ Bottleneck.Group = Bottleneck.prototype.Group = require_Group();
2293
+ Bottleneck.RedisConnection = Bottleneck.prototype.RedisConnection = require_RedisConnection();
2294
+ Bottleneck.IORedisConnection = Bottleneck.prototype.IORedisConnection = require_IORedisConnection();
2295
+ Bottleneck.Batcher = Bottleneck.prototype.Batcher = require_Batcher();
2296
+ Bottleneck.prototype.jobDefaults = {
2297
+ priority: DEFAULT_PRIORITY,
2298
+ weight: 1,
2299
+ expiration: null,
2300
+ id: "<no-id>"
2301
+ };
2302
+ Bottleneck.prototype.storeDefaults = {
2303
+ maxConcurrent: null,
2304
+ minTime: 0,
2305
+ highWater: null,
2306
+ strategy: Bottleneck.prototype.strategy.LEAK,
2307
+ penalty: null,
2308
+ reservoir: null,
2309
+ reservoirRefreshInterval: null,
2310
+ reservoirRefreshAmount: null,
2311
+ reservoirIncreaseInterval: null,
2312
+ reservoirIncreaseAmount: null,
2313
+ reservoirIncreaseMaximum: null
2314
+ };
2315
+ Bottleneck.prototype.localStoreDefaults = {
2316
+ Promise,
2317
+ timeout: null,
2318
+ heartbeatInterval: 250
2319
+ };
2320
+ Bottleneck.prototype.redisStoreDefaults = {
2321
+ Promise,
2322
+ timeout: null,
2323
+ heartbeatInterval: 5e3,
2324
+ clientTimeout: 1e4,
2325
+ Redis: null,
2326
+ clientOptions: {},
2327
+ clusterNodes: null,
2328
+ clearDatastore: false,
2329
+ connection: null
2330
+ };
2331
+ Bottleneck.prototype.instanceDefaults = {
2332
+ datastore: "local",
2333
+ connection: null,
2334
+ id: "<no-id>",
2335
+ rejectOnDrop: true,
2336
+ trackDoneStatus: false,
2337
+ Promise
2338
+ };
2339
+ Bottleneck.prototype.stopDefaults = {
2340
+ enqueueErrorMessage: "This limiter has been stopped and cannot accept new jobs.",
2341
+ dropWaitingJobs: true,
2342
+ dropErrorMessage: "This limiter has been stopped."
2343
+ };
2344
+ return Bottleneck;
2345
+ }.call(void 0);
2346
+ module.exports = Bottleneck;
2347
+ }));
2348
+ //#endregion
2349
+ //#region ../../node_modules/bottleneck/lib/index.js
2350
+ var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2351
+ module.exports = require_Bottleneck();
2352
+ }));
2353
+ //#endregion
2354
+ export { require_lib as t };