@mtkruto/node 0.67.2 → 0.69.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 (1183) hide show
  1. package/esm/0_deps.d.ts +12 -12
  2. package/esm/0_deps.js +14 -14
  3. package/esm/0_errors.js +2 -6
  4. package/esm/3_errors.js +2 -12
  5. package/esm/3_types.d.ts +4 -0
  6. package/esm/3_types.d.ts.map +1 -1
  7. package/esm/3_types.js +4 -0
  8. package/esm/4_constants.d.ts +1 -1
  9. package/esm/4_constants.d.ts.map +1 -1
  10. package/esm/4_errors.d.ts +2 -2
  11. package/esm/4_errors.d.ts.map +1 -1
  12. package/esm/4_errors.js +2 -12
  13. package/esm/_dnt.polyfills.d.ts +99 -0
  14. package/esm/_dnt.polyfills.d.ts.map +1 -1
  15. package/esm/_dnt.polyfills.js +127 -1
  16. package/esm/_dnt.test_polyfills.d.ts.map +1 -0
  17. package/esm/client/0_client_abstract.d.ts +3 -3
  18. package/esm/client/0_client_abstract.d.ts.map +1 -1
  19. package/esm/client/0_filters.d.ts +1 -1
  20. package/esm/client/0_filters.d.ts.map +1 -1
  21. package/esm/client/0_filters.js +3 -3
  22. package/esm/client/0_filters_test.d.ts.map +1 -1
  23. package/esm/client/0_html.d.ts +1 -1
  24. package/esm/client/0_html.d.ts.map +1 -1
  25. package/esm/client/0_html.js +1 -1
  26. package/esm/client/0_markdown.d.ts +1 -1
  27. package/esm/client/0_markdown.d.ts.map +1 -1
  28. package/esm/client/0_markdown.js +8 -8
  29. package/esm/client/0_markdown_test.d.ts.map +1 -1
  30. package/esm/client/0_params.d.ts +44 -8
  31. package/esm/client/0_params.d.ts.map +1 -1
  32. package/esm/client/0_password.d.ts +5 -5
  33. package/esm/client/0_password.d.ts.map +1 -1
  34. package/esm/client/0_password.js +1 -1
  35. package/esm/client/0_password_test.d.ts.map +1 -1
  36. package/esm/client/0_storage_operations.d.ts +4 -4
  37. package/esm/client/0_storage_operations.d.ts.map +1 -1
  38. package/esm/client/0_storage_operations.js +159 -171
  39. package/esm/client/0_storage_operations_test.d.ts.map +1 -1
  40. package/esm/client/0_update_processor.d.ts +2 -2
  41. package/esm/client/0_update_processor.d.ts.map +1 -1
  42. package/esm/client/0_utilities.d.ts +1 -1
  43. package/esm/client/0_utilities.js +8 -8
  44. package/esm/client/0_utilities_test.d.ts.map +1 -1
  45. package/esm/client/1_client_plain.d.ts +3 -3
  46. package/esm/client/1_client_plain.d.ts.map +1 -1
  47. package/esm/client/1_client_plain.js +5 -23
  48. package/esm/client/1_composer.d.ts +3 -3
  49. package/esm/client/1_composer.d.ts.map +1 -1
  50. package/esm/client/1_composer.js +14 -27
  51. package/esm/client/1_types.d.ts +4 -4
  52. package/esm/client/1_types.d.ts.map +1 -1
  53. package/esm/client/2_account_manager.d.ts +3 -3
  54. package/esm/client/2_account_manager.d.ts.map +1 -1
  55. package/esm/client/2_account_manager.js +86 -98
  56. package/esm/client/2_bot_info_manager.d.ts +3 -3
  57. package/esm/client/2_bot_info_manager.d.ts.map +1 -1
  58. package/esm/client/2_bot_info_manager.js +26 -38
  59. package/esm/client/2_business_connection_manager.d.ts +3 -3
  60. package/esm/client/2_business_connection_manager.d.ts.map +1 -1
  61. package/esm/client/2_business_connection_manager.js +10 -23
  62. package/esm/client/2_client_encrypted.d.ts +2 -2
  63. package/esm/client/2_client_encrypted.d.ts.map +1 -1
  64. package/esm/client/2_client_encrypted.js +194 -211
  65. package/esm/client/2_file_manager.d.ts +7 -6
  66. package/esm/client/2_file_manager.d.ts.map +1 -1
  67. package/esm/client/2_file_manager.js +303 -245
  68. package/esm/client/2_file_manager_test.d.ts.map +1 -1
  69. package/esm/client/2_network_statistics_manager.d.ts +1 -1
  70. package/esm/client/2_network_statistics_manager.d.ts.map +1 -1
  71. package/esm/client/2_network_statistics_manager.js +8 -21
  72. package/esm/client/2_payment_manager.d.ts +4 -4
  73. package/esm/client/2_payment_manager.d.ts.map +1 -1
  74. package/esm/client/2_payment_manager.js +7 -20
  75. package/esm/client/2_reaction_manager.d.ts +3 -3
  76. package/esm/client/2_reaction_manager.d.ts.map +1 -1
  77. package/esm/client/2_reaction_manager.js +7 -20
  78. package/esm/client/2_translations_manager.d.ts +4 -4
  79. package/esm/client/2_translations_manager.d.ts.map +1 -1
  80. package/esm/client/2_translations_manager.js +97 -107
  81. package/esm/client/2_update_manager.d.ts +2 -2
  82. package/esm/client/2_update_manager.d.ts.map +1 -1
  83. package/esm/client/2_update_manager.js +766 -761
  84. package/esm/client/3_client_encrypted_pool.d.ts +1 -1
  85. package/esm/client/3_client_encrypted_pool.d.ts.map +1 -1
  86. package/esm/client/3_client_encrypted_pool.js +10 -26
  87. package/esm/client/3_client_encrypted_pool_test.d.ts.map +1 -1
  88. package/esm/client/3_message_manager.d.ts +11 -8
  89. package/esm/client/3_message_manager.d.ts.map +1 -1
  90. package/esm/client/3_message_manager.js +580 -466
  91. package/esm/client/3_message_manager_test.d.ts.map +1 -1
  92. package/esm/client/3_video_chat_manager.d.ts +6 -6
  93. package/esm/client/3_video_chat_manager.d.ts.map +1 -1
  94. package/esm/client/3_video_chat_manager.js +61 -72
  95. package/esm/client/4_callback_query_manager.d.ts +5 -5
  96. package/esm/client/4_callback_query_manager.d.ts.map +1 -1
  97. package/esm/client/4_callback_query_manager.js +18 -30
  98. package/esm/client/4_chat_list_manager.d.ts +6 -6
  99. package/esm/client/4_chat_list_manager.d.ts.map +1 -1
  100. package/esm/client/4_chat_list_manager.js +328 -324
  101. package/esm/client/4_chat_manager.d.ts +7 -7
  102. package/esm/client/4_chat_manager.d.ts.map +1 -1
  103. package/esm/client/4_chat_manager.js +120 -133
  104. package/esm/client/4_forum_manager.d.ts +4 -4
  105. package/esm/client/4_forum_manager.d.ts.map +1 -1
  106. package/esm/client/4_forum_manager.js +67 -73
  107. package/esm/client/4_gift_manager.d.ts +4 -4
  108. package/esm/client/4_gift_manager.d.ts.map +1 -1
  109. package/esm/client/4_gift_manager.js +17 -30
  110. package/esm/client/4_inline_query_manager.d.ts +5 -5
  111. package/esm/client/4_inline_query_manager.d.ts.map +1 -1
  112. package/esm/client/4_inline_query_manager.js +16 -28
  113. package/esm/client/4_link_preview_manager.d.ts +5 -5
  114. package/esm/client/4_link_preview_manager.d.ts.map +1 -1
  115. package/esm/client/4_link_preview_manager.js +6 -19
  116. package/esm/client/4_poll_manager.d.ts +4 -4
  117. package/esm/client/4_poll_manager.d.ts.map +1 -1
  118. package/esm/client/4_poll_manager.js +44 -57
  119. package/esm/client/4_story_manager.d.ts +7 -7
  120. package/esm/client/4_story_manager.d.ts.map +1 -1
  121. package/esm/client/4_story_manager.js +43 -55
  122. package/esm/client/5_client.d.ts +34 -15
  123. package/esm/client/5_client.d.ts.map +1 -1
  124. package/esm/client/5_client.js +1299 -1291
  125. package/esm/connection/0_connection.d.ts +1 -1
  126. package/esm/connection/0_connection.d.ts.map +1 -1
  127. package/esm/connection/1_connection_tcp.node.d.ts +1 -1
  128. package/esm/connection/1_connection_tcp.node.d.ts.map +1 -1
  129. package/esm/connection/1_connection_tcp.node.js +49 -66
  130. package/esm/connection/1_connection_web_socket.d.ts +1 -1
  131. package/esm/connection/1_connection_web_socket.d.ts.map +1 -1
  132. package/esm/connection/1_connection_web_socket.js +75 -91
  133. package/esm/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
  134. package/{script/deps/jsr.io/@std/assert/1.0.13 → esm/deps/jsr.io/@std/assert/1.0.14}/assert.d.ts.map +1 -1
  135. package/esm/deps/jsr.io/@std/assert/1.0.14/assertion_error.d.ts +26 -0
  136. package/esm/deps/jsr.io/@std/assert/1.0.14/assertion_error.d.ts.map +1 -0
  137. package/esm/deps/jsr.io/@std/assert/1.0.14/assertion_error.js +30 -0
  138. package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equal.d.ts.map +1 -1
  139. package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equals.d.ts.map +1 -1
  140. package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/false.d.ts.map +1 -1
  141. package/esm/deps/jsr.io/@std/assert/1.0.14/unreachable.d.ts +15 -0
  142. package/esm/deps/jsr.io/@std/assert/1.0.14/unreachable.d.ts.map +1 -0
  143. package/esm/deps/jsr.io/@std/assert/1.0.14/unreachable.js +20 -0
  144. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/_util.d.ts.map +1 -1
  145. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/abortable.d.ts.map +1 -1
  146. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/deadline.d.ts.map +1 -1
  147. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/debounce.d.ts.map +1 -1
  148. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/delay.d.ts.map +1 -1
  149. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/delay.js +17 -2
  150. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mod.d.ts.map +1 -1
  151. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mux_async_iterator.d.ts.map +1 -1
  152. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mux_async_iterator.js +31 -47
  153. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/pool.d.ts.map +1 -1
  154. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/retry.d.ts.map +1 -1
  155. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/tee.d.ts.map +1 -1
  156. package/esm/deps/jsr.io/@std/async/1.0.14/tee.js +79 -0
  157. package/esm/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
  158. package/esm/deps/jsr.io/@std/internal/1.0.10/_os.d.ts +2 -0
  159. package/esm/deps/jsr.io/@std/internal/1.0.10/_os.d.ts.map +1 -0
  160. package/esm/deps/jsr.io/@std/internal/1.0.10/_os.js +12 -0
  161. package/esm/deps/jsr.io/@std/internal/1.0.10/os.d.ts +3 -0
  162. package/esm/deps/jsr.io/@std/internal/1.0.10/os.d.ts.map +1 -0
  163. package/esm/deps/jsr.io/@std/internal/1.0.10/os.js +5 -0
  164. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/assert_path.d.ts.map +1 -1
  165. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/basename.d.ts.map +1 -1
  166. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/constants.d.ts.map +1 -1
  167. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/from_file_url.d.ts.map +1 -1
  168. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize.d.ts.map +1 -1
  169. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize_string.d.ts.map +1 -1
  170. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/strip_trailing_separators.d.ts.map +1 -1
  171. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/to_file_url.d.ts.map +1 -1
  172. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/basename.d.ts.map +1 -1
  173. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/basename.js +1 -1
  174. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/extname.d.ts.map +1 -1
  175. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/extname.js +1 -1
  176. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/is_absolute.d.ts.map +1 -1
  177. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/is_absolute.js +1 -1
  178. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/join.d.ts.map +1 -1
  179. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/join.js +1 -1
  180. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/_util.d.ts.map +1 -1
  181. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/posix/basename.d.ts.map +1 -1
  182. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/posix/extname.d.ts.map +1 -1
  183. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/from_file_url.d.ts.map +1 -1
  184. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/is_absolute.d.ts.map +1 -1
  185. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/posix/join.d.ts.map +1 -1
  186. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/posix/normalize.d.ts.map +1 -1
  187. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/posix/to_file_url.d.ts.map +1 -1
  188. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/to_file_url.d.ts.map +1 -1
  189. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/to_file_url.js +1 -1
  190. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/_util.d.ts.map +1 -1
  191. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/basename.d.ts.map +1 -1
  192. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/extname.d.ts.map +1 -1
  193. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/from_file_url.d.ts.map +1 -1
  194. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/is_absolute.d.ts.map +1 -1
  195. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/join.d.ts.map +1 -1
  196. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/normalize.d.ts.map +1 -1
  197. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/to_file_url.d.ts.map +1 -1
  198. package/esm/deps/jsr.io/@std/streams/{1.0.10 → 1.0.11}/to_array_buffer.d.ts.map +1 -1
  199. package/esm/mod.js +2 -12
  200. package/esm/session/0_session_state.js +12 -38
  201. package/esm/session/1_session.d.ts +2 -2
  202. package/esm/session/1_session.d.ts.map +1 -1
  203. package/esm/session/1_session.js +49 -72
  204. package/esm/session/2_session_encrypted.d.ts +2 -2
  205. package/esm/session/2_session_encrypted.d.ts.map +1 -1
  206. package/esm/session/2_session_encrypted.js +324 -320
  207. package/esm/session/2_session_plain.js +1 -1
  208. package/esm/storage/0_storage.d.ts +1 -1
  209. package/esm/storage/0_storage.d.ts.map +1 -1
  210. package/esm/storage/1_utilities.d.ts +14 -11
  211. package/esm/storage/1_utilities.d.ts.map +1 -1
  212. package/esm/storage/1_utilities.js +17 -17
  213. package/esm/storage/1_utilities_test.d.ts.map +1 -1
  214. package/esm/storage/2_storage_indexed_db.d.ts +1 -1
  215. package/esm/storage/2_storage_indexed_db.d.ts.map +1 -1
  216. package/esm/storage/2_storage_indexed_db.js +29 -47
  217. package/esm/storage/2_storage_local_storage.node.d.ts +1 -1
  218. package/esm/storage/2_storage_local_storage.node.d.ts.map +1 -1
  219. package/esm/storage/2_storage_local_storage.node.js +15 -28
  220. package/esm/storage/2_storage_memory.d.ts +2 -2
  221. package/esm/storage/2_storage_memory.d.ts.map +1 -1
  222. package/esm/storage/2_storage_memory.js +26 -43
  223. package/esm/storage/2_storage_session_storage.d.ts +2 -2
  224. package/esm/storage/2_storage_session_storage.d.ts.map +1 -1
  225. package/esm/storage/2_storage_session_storage.js +6 -19
  226. package/esm/tl/0_utilities.js +1 -1
  227. package/esm/tl/0_utilities_test.d.ts.map +1 -1
  228. package/esm/tl/1_tl_reader.d.ts +1 -1
  229. package/esm/tl/1_tl_reader.d.ts.map +1 -1
  230. package/esm/tl/1_tl_reader.js +82 -90
  231. package/esm/tl/1_tl_reader_test.d.ts.map +1 -1
  232. package/esm/tl/1_tl_writer.d.ts +1 -1
  233. package/esm/tl/1_tl_writer.d.ts.map +1 -1
  234. package/esm/tl/1_tl_writer.js +155 -164
  235. package/esm/tl/1_tl_writer_test.d.ts.map +1 -1
  236. package/esm/tl/1_utilities.d.ts +1 -1
  237. package/esm/tl/1_utilities.d.ts.map +1 -1
  238. package/esm/tl/1_utilities.js +2 -2
  239. package/esm/tl/2_message.js +1 -1
  240. package/esm/tl/2_mtproto.d.ts +1 -1
  241. package/esm/tl/2_mtproto.d.ts.map +1 -1
  242. package/esm/tl/2_telegram.d.ts +1 -1
  243. package/esm/tl/2_telegram.d.ts.map +1 -1
  244. package/esm/transport/0_obfuscation.d.ts +1 -1
  245. package/esm/transport/0_obfuscation.d.ts.map +1 -1
  246. package/esm/transport/0_obfuscation.js +2 -2
  247. package/esm/transport/0_transport.d.ts +1 -1
  248. package/esm/transport/0_transport.d.ts.map +1 -1
  249. package/esm/transport/0_transport.js +1 -8
  250. package/esm/transport/1_transport_abridged.d.ts +1 -1
  251. package/esm/transport/1_transport_abridged.d.ts.map +1 -1
  252. package/esm/transport/1_transport_abridged.js +11 -24
  253. package/esm/transport/1_transport_intermediate.d.ts +1 -1
  254. package/esm/transport/1_transport_intermediate.d.ts.map +1 -1
  255. package/esm/transport/1_transport_intermediate.js +10 -23
  256. package/esm/transport/1_transport_provider.d.ts +2 -2
  257. package/esm/transport/1_transport_provider.d.ts.map +1 -1
  258. package/esm/transport/2_transport_provider_tcp.d.ts +1 -1
  259. package/esm/transport/2_transport_provider_tcp.d.ts.map +1 -1
  260. package/esm/transport/2_transport_provider_web_socket.d.ts +1 -1
  261. package/esm/transport/2_transport_provider_web_socket.d.ts.map +1 -1
  262. package/esm/transport/2_transport_provider_web_socket.js +1 -1
  263. package/esm/types/0_birthday.d.ts +1 -1
  264. package/esm/types/0_birthday.d.ts.map +1 -1
  265. package/esm/types/0_callback_query_answer.d.ts +1 -1
  266. package/esm/types/0_callback_query_answer.d.ts.map +1 -1
  267. package/esm/types/0_callback_query_question.js +2 -2
  268. package/esm/types/0_chat_administrator_rights.d.ts +1 -1
  269. package/esm/types/0_chat_administrator_rights.d.ts.map +1 -1
  270. package/esm/types/0_chat_member_rights.d.ts +1 -1
  271. package/esm/types/0_chat_member_rights.d.ts.map +1 -1
  272. package/esm/types/0_contact.d.ts +1 -1
  273. package/esm/types/0_contact.d.ts.map +1 -1
  274. package/esm/types/0_dice.d.ts +1 -1
  275. package/esm/types/0_dice.d.ts.map +1 -1
  276. package/esm/types/0_failed_invitation.d.ts +1 -1
  277. package/esm/types/0_failed_invitation.d.ts.map +1 -1
  278. package/esm/types/0_invoice.d.ts +1 -1
  279. package/esm/types/0_invoice.d.ts.map +1 -1
  280. package/esm/types/0_live_stream_channel.d.ts +1 -1
  281. package/esm/types/0_live_stream_channel.d.ts.map +1 -1
  282. package/esm/types/0_mask_position.d.ts +1 -1
  283. package/esm/types/0_mask_position.d.ts.map +1 -1
  284. package/esm/types/0_mask_position.js +1 -1
  285. package/esm/types/0_message_entity.d.ts +1 -1
  286. package/esm/types/0_message_entity.d.ts.map +1 -1
  287. package/esm/types/0_message_entity.js +1 -1
  288. package/esm/types/0_message_search_filter.d.ts +1 -1
  289. package/esm/types/0_message_search_filter.d.ts.map +1 -1
  290. package/esm/types/0_opening_hours.d.ts +1 -1
  291. package/esm/types/0_opening_hours.d.ts.map +1 -1
  292. package/esm/types/0_reaction.js +5 -5
  293. package/esm/types/0_refunded_payment.d.ts +1 -1
  294. package/esm/types/0_refunded_payment.d.ts.map +1 -1
  295. package/esm/types/0_restriction_reason.d.ts +1 -1
  296. package/esm/types/0_restriction_reason.d.ts.map +1 -1
  297. package/esm/types/0_self_destruct_option.js +3 -3
  298. package/esm/types/0_shipping_address.d.ts +1 -1
  299. package/esm/types/0_shipping_address.d.ts.map +1 -1
  300. package/esm/types/0_slow_mode_duration.js +2 -2
  301. package/esm/types/0_upload_progress.d.ts +29 -0
  302. package/esm/types/0_upload_progress.d.ts.map +1 -0
  303. package/esm/types/0_upload_progress.js +20 -0
  304. package/esm/types/0_voice.d.ts +1 -1
  305. package/esm/types/0_voice.d.ts.map +1 -1
  306. package/esm/types/0_voice_transcription.d.ts +1 -1
  307. package/esm/types/0_voice_transcription.d.ts.map +1 -1
  308. package/esm/types/1_animation.d.ts +1 -1
  309. package/esm/types/1_animation.d.ts.map +1 -1
  310. package/esm/types/1_audio.d.ts +1 -1
  311. package/esm/types/1_audio.d.ts.map +1 -1
  312. package/esm/types/1_bot_command_scope.d.ts +2 -2
  313. package/esm/types/1_bot_command_scope.d.ts.map +1 -1
  314. package/esm/types/1_chat_p.d.ts +2 -2
  315. package/esm/types/1_chat_p.d.ts.map +1 -1
  316. package/esm/types/1_chat_p.js +2 -2
  317. package/esm/types/1_document.d.ts +1 -1
  318. package/esm/types/1_document.d.ts.map +1 -1
  319. package/esm/types/1_giveaway.d.ts +2 -2
  320. package/esm/types/1_giveaway.d.ts.map +1 -1
  321. package/esm/types/1_inline_keyboard_button.d.ts +3 -3
  322. package/esm/types/1_inline_keyboard_button.d.ts.map +1 -1
  323. package/esm/types/1_inline_keyboard_button.js +4 -4
  324. package/esm/types/1_inline_query_result_button.d.ts +1 -1
  325. package/esm/types/1_inline_query_result_button.d.ts.map +1 -1
  326. package/esm/types/1_input_media.d.ts +4 -4
  327. package/esm/types/1_input_media.d.ts.map +1 -1
  328. package/esm/types/1_input_story_content.d.ts +1 -1
  329. package/esm/types/1_input_story_content.d.ts.map +1 -1
  330. package/esm/types/1_keyboard_button.d.ts +3 -3
  331. package/esm/types/1_keyboard_button.d.ts.map +1 -1
  332. package/esm/types/1_keyboard_button.js +1 -1
  333. package/esm/types/1_message_reaction.d.ts +1 -1
  334. package/esm/types/1_message_reaction.d.ts.map +1 -1
  335. package/esm/types/1_message_reaction.js +2 -2
  336. package/esm/types/1_mini_app_info.d.ts +2 -2
  337. package/esm/types/1_mini_app_info.d.ts.map +1 -1
  338. package/esm/types/1_network_statistics.d.ts +1 -1
  339. package/esm/types/1_network_statistics.d.ts.map +1 -1
  340. package/esm/types/1_order_info.d.ts +2 -2
  341. package/esm/types/1_order_info.d.ts.map +1 -1
  342. package/esm/types/1_photo.d.ts +1 -1
  343. package/esm/types/1_photo.d.ts.map +1 -1
  344. package/esm/types/1_poll_option.d.ts +2 -2
  345. package/esm/types/1_poll_option.d.ts.map +1 -1
  346. package/esm/types/1_poll_option.js +2 -2
  347. package/esm/types/1_reaction_count.d.ts +2 -2
  348. package/esm/types/1_reaction_count.d.ts.map +1 -1
  349. package/esm/types/1_reply_quote.d.ts +2 -2
  350. package/esm/types/1_reply_quote.d.ts.map +1 -1
  351. package/esm/types/1_sticker.d.ts +4 -4
  352. package/esm/types/1_sticker.d.ts.map +1 -1
  353. package/esm/types/1_sticker.js +2 -2
  354. package/esm/types/1_story_privacy.d.ts +1 -1
  355. package/esm/types/1_story_privacy.d.ts.map +1 -1
  356. package/esm/types/1_story_reaction.d.ts +2 -2
  357. package/esm/types/1_story_reaction.d.ts.map +1 -1
  358. package/esm/types/1_user.d.ts +2 -2
  359. package/esm/types/1_user.d.ts.map +1 -1
  360. package/esm/types/1_user.js +1 -1
  361. package/esm/types/1_venue.d.ts +1 -1
  362. package/esm/types/1_venue.d.ts.map +1 -1
  363. package/esm/types/1_video.d.ts +1 -1
  364. package/esm/types/1_video.d.ts.map +1 -1
  365. package/esm/types/1_video_note.d.ts +1 -1
  366. package/esm/types/1_video_note.d.ts.map +1 -1
  367. package/esm/types/2_business_connection.d.ts +3 -3
  368. package/esm/types/2_business_connection.d.ts.map +1 -1
  369. package/esm/types/2_chat.d.ts +6 -6
  370. package/esm/types/2_chat.d.ts.map +1 -1
  371. package/esm/types/2_chat.js +3 -3
  372. package/esm/types/2_chat_member.d.ts +4 -4
  373. package/esm/types/2_chat_member.d.ts.map +1 -1
  374. package/esm/types/2_chat_member.js +1 -1
  375. package/esm/types/2_chat_settings.d.ts +1 -1
  376. package/esm/types/2_chat_settings.d.ts.map +1 -1
  377. package/esm/types/2_chat_settings.js +1 -1
  378. package/esm/types/2_chosen_inline_result.d.ts +3 -3
  379. package/esm/types/2_chosen_inline_result.d.ts.map +1 -1
  380. package/esm/types/2_forward_header.d.ts +4 -4
  381. package/esm/types/2_forward_header.d.ts.map +1 -1
  382. package/esm/types/2_forward_header.js +6 -6
  383. package/esm/types/2_game.d.ts +3 -3
  384. package/esm/types/2_game.d.ts.map +1 -1
  385. package/esm/types/2_gift_upgraded_component.d.ts +2 -2
  386. package/esm/types/2_gift_upgraded_component.d.ts.map +1 -1
  387. package/esm/types/2_inactive_chat.d.ts +1 -1
  388. package/esm/types/2_inactive_chat.d.ts.map +1 -1
  389. package/esm/types/2_inline_query.d.ts +3 -3
  390. package/esm/types/2_inline_query.d.ts.map +1 -1
  391. package/esm/types/2_inline_query.js +1 -1
  392. package/esm/types/2_invite_link.d.ts +3 -3
  393. package/esm/types/2_invite_link.d.ts.map +1 -1
  394. package/esm/types/2_message_interactions.d.ts +1 -1
  395. package/esm/types/2_message_interactions.d.ts.map +1 -1
  396. package/esm/types/2_message_reaction_count.d.ts +4 -4
  397. package/esm/types/2_message_reaction_count.d.ts.map +1 -1
  398. package/esm/types/2_message_reactions.d.ts +4 -4
  399. package/esm/types/2_message_reactions.d.ts.map +1 -1
  400. package/esm/types/2_poll.d.ts +3 -3
  401. package/esm/types/2_poll.d.ts.map +1 -1
  402. package/esm/types/2_poll.js +3 -3
  403. package/esm/types/2_poll_answer.d.ts +22 -3
  404. package/esm/types/2_poll_answer.d.ts.map +1 -1
  405. package/esm/types/2_poll_answer.js +19 -0
  406. package/esm/types/2_pre_checkout_query.d.ts +4 -4
  407. package/esm/types/2_pre_checkout_query.d.ts.map +1 -1
  408. package/esm/types/2_reply_markup.d.ts +3 -3
  409. package/esm/types/2_reply_markup.d.ts.map +1 -1
  410. package/esm/types/2_reply_to.d.ts +2 -2
  411. package/esm/types/2_reply_to.d.ts.map +1 -1
  412. package/esm/types/2_sticker_set.d.ts +51 -0
  413. package/esm/types/2_sticker_set.d.ts.map +1 -0
  414. package/esm/types/2_sticker_set.js +91 -0
  415. package/esm/types/2_story_content.d.ts +2 -2
  416. package/esm/types/2_story_content.d.ts.map +1 -1
  417. package/esm/types/2_story_interactions.d.ts +2 -2
  418. package/esm/types/2_story_interactions.d.ts.map +1 -1
  419. package/esm/types/2_story_interactive_area.d.ts +5 -5
  420. package/esm/types/2_story_interactive_area.d.ts.map +1 -1
  421. package/esm/types/2_successful_payment.d.ts +2 -2
  422. package/esm/types/2_successful_payment.d.ts.map +1 -1
  423. package/esm/types/3_chat_member_updated.d.ts +5 -5
  424. package/esm/types/3_chat_member_updated.d.ts.map +1 -1
  425. package/esm/types/3_gift.d.ts +4 -4
  426. package/esm/types/3_gift.d.ts.map +1 -1
  427. package/esm/types/3_join_request.d.ts +4 -4
  428. package/esm/types/3_join_request.d.ts.map +1 -1
  429. package/esm/types/3_story.d.ts +8 -8
  430. package/esm/types/3_story.d.ts.map +1 -1
  431. package/esm/types/4_claimed_gift.d.ts +4 -4
  432. package/esm/types/4_claimed_gift.d.ts.map +1 -1
  433. package/esm/types/4_link_preview.d.ts +5 -5
  434. package/esm/types/4_link_preview.d.ts.map +1 -1
  435. package/esm/types/5_claimed_gifts.d.ts +2 -2
  436. package/esm/types/5_claimed_gifts.d.ts.map +1 -1
  437. package/esm/types/5_claimed_gifts.js +3 -3
  438. package/esm/types/5_message.d.ts +29 -29
  439. package/esm/types/5_message.d.ts.map +1 -1
  440. package/esm/types/5_message.js +8 -8
  441. package/esm/types/5_message_content.d.ts +4 -4
  442. package/esm/types/5_message_content.d.ts.map +1 -1
  443. package/esm/types/6_callback_query.d.ts +3 -3
  444. package/esm/types/6_callback_query.d.ts.map +1 -1
  445. package/esm/types/6_callback_query.js +2 -2
  446. package/esm/types/6_chat_list_item.d.ts +4 -4
  447. package/esm/types/6_chat_list_item.d.ts.map +1 -1
  448. package/esm/types/6_chat_list_item.js +6 -6
  449. package/esm/types/6_inline_query_result.d.ts +6 -6
  450. package/esm/types/6_inline_query_result.d.ts.map +1 -1
  451. package/esm/types/6_inline_query_result.js +16 -16
  452. package/esm/types/6_saved_chat.d.ts +36 -0
  453. package/esm/types/6_saved_chat.d.ts.map +1 -0
  454. package/esm/types/6_saved_chat.js +43 -0
  455. package/esm/types/6_topic.d.ts +2 -2
  456. package/esm/types/6_topic.d.ts.map +1 -1
  457. package/esm/types/6_topic.js +1 -1
  458. package/esm/types/7_inline_query_answer.d.ts +2 -2
  459. package/esm/types/7_inline_query_answer.d.ts.map +1 -1
  460. package/esm/types/7_saved_chats.d.ts +33 -0
  461. package/esm/types/7_saved_chats.d.ts.map +1 -0
  462. package/esm/types/7_saved_chats.js +36 -0
  463. package/esm/types/7_update.d.ts +44 -25
  464. package/esm/types/7_update.d.ts.map +1 -1
  465. package/esm/types/_file_id.d.ts +60 -49
  466. package/esm/types/_file_id.d.ts.map +1 -1
  467. package/esm/types/_file_id.js +92 -73
  468. package/esm/types/_getters.d.ts +3 -3
  469. package/esm/types/_getters.d.ts.map +1 -1
  470. package/esm/utilities/0_bigint.js +5 -5
  471. package/esm/utilities/0_bigint_test.d.ts.map +1 -1
  472. package/esm/utilities/0_buffer.d.ts +1 -1
  473. package/esm/utilities/0_buffer.d.ts.map +1 -1
  474. package/esm/utilities/0_buffer.js +3 -3
  475. package/esm/utilities/0_buffer_test.d.ts.map +1 -1
  476. package/esm/utilities/0_env.js +1 -1
  477. package/esm/utilities/0_hash.d.ts +2 -2
  478. package/esm/utilities/0_hash.d.ts.map +1 -1
  479. package/esm/utilities/0_misc.d.ts.map +1 -1
  480. package/esm/utilities/0_misc.js +4 -3
  481. package/esm/utilities/0_mutex.js +4 -19
  482. package/esm/utilities/0_part_stream.js +11 -25
  483. package/esm/utilities/0_part_stream_test.d.ts.map +1 -1
  484. package/esm/utilities/0_rle.d.ts +2 -2
  485. package/esm/utilities/0_rle.d.ts.map +1 -1
  486. package/esm/utilities/0_rle.js +1 -1
  487. package/esm/utilities/0_rle_test.d.ts.map +1 -1
  488. package/esm/utilities/0_text.d.ts +20 -1
  489. package/esm/utilities/0_text.d.ts.map +1 -1
  490. package/esm/utilities/0_text.js +19 -0
  491. package/esm/utilities/1_auth.d.ts +1 -1
  492. package/esm/utilities/1_auth.d.ts.map +1 -1
  493. package/esm/utilities/1_auth.js +1 -1
  494. package/esm/utilities/1_base64.d.ts +1 -1
  495. package/esm/utilities/1_base64.d.ts.map +1 -1
  496. package/esm/utilities/1_base64.js +1 -1
  497. package/esm/utilities/1_base64_test.d.ts.map +1 -1
  498. package/esm/utilities/1_crypto.js +42 -53
  499. package/esm/utilities/1_crypto_test.d.ts.map +1 -1
  500. package/esm/utilities/1_logger.d.ts +2 -2
  501. package/esm/utilities/1_logger.js +2 -2
  502. package/esm/utilities/1_math.js +2 -2
  503. package/esm/utilities/1_math_test.d.ts.map +1 -1
  504. package/esm/utilities/2_queue.js +29 -47
  505. package/package.json +1 -1
  506. package/script/0_deps.d.ts +12 -12
  507. package/script/0_deps.js +14 -14
  508. package/script/0_errors.js +2 -6
  509. package/script/2_tl.js +17 -7
  510. package/script/3_errors.js +2 -12
  511. package/script/3_types.d.ts +4 -0
  512. package/script/3_types.d.ts.map +1 -1
  513. package/script/3_types.js +4 -0
  514. package/script/4_constants.d.ts +1 -1
  515. package/script/4_constants.d.ts.map +1 -1
  516. package/script/4_constants.js +17 -7
  517. package/script/4_errors.d.ts +2 -2
  518. package/script/4_errors.d.ts.map +1 -1
  519. package/script/4_errors.js +2 -12
  520. package/script/_dnt.polyfills.d.ts +99 -0
  521. package/script/_dnt.polyfills.d.ts.map +1 -1
  522. package/script/_dnt.polyfills.js +128 -0
  523. package/script/_dnt.test_polyfills.d.ts.map +1 -0
  524. package/script/client/0_client_abstract.d.ts +3 -3
  525. package/script/client/0_client_abstract.d.ts.map +1 -1
  526. package/script/client/0_filters.d.ts +1 -1
  527. package/script/client/0_filters.d.ts.map +1 -1
  528. package/script/client/0_filters.js +3 -3
  529. package/script/client/0_filters_test.d.ts.map +1 -1
  530. package/script/client/0_html.d.ts +1 -1
  531. package/script/client/0_html.d.ts.map +1 -1
  532. package/script/client/0_html.js +1 -1
  533. package/script/client/0_markdown.d.ts +1 -1
  534. package/script/client/0_markdown.d.ts.map +1 -1
  535. package/script/client/0_markdown.js +8 -8
  536. package/script/client/0_markdown_test.d.ts.map +1 -1
  537. package/script/client/0_params.d.ts +44 -8
  538. package/script/client/0_params.d.ts.map +1 -1
  539. package/script/client/0_password.d.ts +5 -5
  540. package/script/client/0_password.d.ts.map +1 -1
  541. package/script/client/0_password.js +18 -8
  542. package/script/client/0_password_test.d.ts.map +1 -1
  543. package/script/client/0_storage_operations.d.ts +4 -4
  544. package/script/client/0_storage_operations.d.ts.map +1 -1
  545. package/script/client/0_storage_operations.js +159 -171
  546. package/script/client/0_storage_operations_test.d.ts.map +1 -1
  547. package/script/client/0_update_processor.d.ts +2 -2
  548. package/script/client/0_update_processor.d.ts.map +1 -1
  549. package/script/client/0_utilities.d.ts +1 -1
  550. package/script/client/0_utilities.js +8 -8
  551. package/script/client/0_utilities_test.d.ts.map +1 -1
  552. package/script/client/1_client_plain.d.ts +3 -3
  553. package/script/client/1_client_plain.d.ts.map +1 -1
  554. package/script/client/1_client_plain.js +5 -23
  555. package/script/client/1_composer.d.ts +3 -3
  556. package/script/client/1_composer.d.ts.map +1 -1
  557. package/script/client/1_composer.js +14 -27
  558. package/script/client/1_types.d.ts +4 -4
  559. package/script/client/1_types.d.ts.map +1 -1
  560. package/script/client/2_account_manager.d.ts +3 -3
  561. package/script/client/2_account_manager.d.ts.map +1 -1
  562. package/script/client/2_account_manager.js +86 -98
  563. package/script/client/2_bot_info_manager.d.ts +3 -3
  564. package/script/client/2_bot_info_manager.d.ts.map +1 -1
  565. package/script/client/2_bot_info_manager.js +26 -38
  566. package/script/client/2_business_connection_manager.d.ts +3 -3
  567. package/script/client/2_business_connection_manager.d.ts.map +1 -1
  568. package/script/client/2_business_connection_manager.js +10 -23
  569. package/script/client/2_client_encrypted.d.ts +2 -2
  570. package/script/client/2_client_encrypted.d.ts.map +1 -1
  571. package/script/client/2_client_encrypted.js +195 -212
  572. package/script/client/2_file_manager.d.ts +7 -6
  573. package/script/client/2_file_manager.d.ts.map +1 -1
  574. package/script/client/2_file_manager.js +320 -252
  575. package/script/client/2_file_manager_test.d.ts.map +1 -1
  576. package/script/client/2_network_statistics_manager.d.ts +1 -1
  577. package/script/client/2_network_statistics_manager.d.ts.map +1 -1
  578. package/script/client/2_network_statistics_manager.js +8 -21
  579. package/script/client/2_payment_manager.d.ts +4 -4
  580. package/script/client/2_payment_manager.d.ts.map +1 -1
  581. package/script/client/2_payment_manager.js +7 -20
  582. package/script/client/2_reaction_manager.d.ts +3 -3
  583. package/script/client/2_reaction_manager.d.ts.map +1 -1
  584. package/script/client/2_reaction_manager.js +7 -20
  585. package/script/client/2_translations_manager.d.ts +4 -4
  586. package/script/client/2_translations_manager.d.ts.map +1 -1
  587. package/script/client/2_translations_manager.js +98 -108
  588. package/script/client/2_update_manager.d.ts +2 -2
  589. package/script/client/2_update_manager.d.ts.map +1 -1
  590. package/script/client/2_update_manager.js +766 -761
  591. package/script/client/3_client_encrypted_pool.d.ts +1 -1
  592. package/script/client/3_client_encrypted_pool.d.ts.map +1 -1
  593. package/script/client/3_client_encrypted_pool.js +10 -26
  594. package/script/client/3_client_encrypted_pool_test.d.ts.map +1 -1
  595. package/script/client/3_message_manager.d.ts +11 -8
  596. package/script/client/3_message_manager.d.ts.map +1 -1
  597. package/script/client/3_message_manager.js +580 -466
  598. package/script/client/3_message_manager_test.d.ts.map +1 -1
  599. package/script/client/3_video_chat_manager.d.ts +6 -6
  600. package/script/client/3_video_chat_manager.d.ts.map +1 -1
  601. package/script/client/3_video_chat_manager.js +61 -72
  602. package/script/client/4_callback_query_manager.d.ts +5 -5
  603. package/script/client/4_callback_query_manager.d.ts.map +1 -1
  604. package/script/client/4_callback_query_manager.js +18 -30
  605. package/script/client/4_chat_list_manager.d.ts +6 -6
  606. package/script/client/4_chat_list_manager.d.ts.map +1 -1
  607. package/script/client/4_chat_list_manager.js +328 -324
  608. package/script/client/4_chat_manager.d.ts +7 -7
  609. package/script/client/4_chat_manager.d.ts.map +1 -1
  610. package/script/client/4_chat_manager.js +120 -133
  611. package/script/client/4_forum_manager.d.ts +4 -4
  612. package/script/client/4_forum_manager.d.ts.map +1 -1
  613. package/script/client/4_forum_manager.js +67 -73
  614. package/script/client/4_gift_manager.d.ts +4 -4
  615. package/script/client/4_gift_manager.d.ts.map +1 -1
  616. package/script/client/4_gift_manager.js +17 -30
  617. package/script/client/4_inline_query_manager.d.ts +5 -5
  618. package/script/client/4_inline_query_manager.d.ts.map +1 -1
  619. package/script/client/4_inline_query_manager.js +16 -28
  620. package/script/client/4_link_preview_manager.d.ts +5 -5
  621. package/script/client/4_link_preview_manager.d.ts.map +1 -1
  622. package/script/client/4_link_preview_manager.js +6 -19
  623. package/script/client/4_poll_manager.d.ts +4 -4
  624. package/script/client/4_poll_manager.d.ts.map +1 -1
  625. package/script/client/4_poll_manager.js +44 -57
  626. package/script/client/4_story_manager.d.ts +7 -7
  627. package/script/client/4_story_manager.d.ts.map +1 -1
  628. package/script/client/4_story_manager.js +43 -55
  629. package/script/client/5_client.d.ts +34 -15
  630. package/script/client/5_client.d.ts.map +1 -1
  631. package/script/client/5_client.js +1299 -1291
  632. package/script/connection/0_connection.d.ts +1 -1
  633. package/script/connection/0_connection.d.ts.map +1 -1
  634. package/script/connection/1_connection_tcp.node.d.ts +1 -1
  635. package/script/connection/1_connection_tcp.node.d.ts.map +1 -1
  636. package/script/connection/1_connection_tcp.node.js +49 -66
  637. package/script/connection/1_connection_web_socket.d.ts +1 -1
  638. package/script/connection/1_connection_web_socket.d.ts.map +1 -1
  639. package/script/connection/1_connection_web_socket.js +92 -98
  640. package/script/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
  641. package/{esm/deps/jsr.io/@std/assert/1.0.13 → script/deps/jsr.io/@std/assert/1.0.14}/assert.d.ts.map +1 -1
  642. package/script/deps/jsr.io/@std/assert/1.0.14/assertion_error.d.ts +26 -0
  643. package/script/deps/jsr.io/@std/assert/1.0.14/assertion_error.d.ts.map +1 -0
  644. package/script/deps/jsr.io/@std/assert/1.0.14/assertion_error.js +34 -0
  645. package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equal.d.ts.map +1 -1
  646. package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equal.js +17 -7
  647. package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equals.d.ts.map +1 -1
  648. package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/false.d.ts.map +1 -1
  649. package/script/deps/jsr.io/@std/assert/1.0.14/unreachable.d.ts +15 -0
  650. package/script/deps/jsr.io/@std/assert/1.0.14/unreachable.d.ts.map +1 -0
  651. package/script/deps/jsr.io/@std/assert/1.0.14/unreachable.js +23 -0
  652. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/_util.d.ts.map +1 -1
  653. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/abortable.d.ts.map +1 -1
  654. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/deadline.d.ts.map +1 -1
  655. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/debounce.d.ts.map +1 -1
  656. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/delay.d.ts.map +1 -1
  657. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/delay.js +34 -9
  658. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mod.d.ts.map +1 -1
  659. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mux_async_iterator.d.ts.map +1 -1
  660. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mux_async_iterator.js +31 -47
  661. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/pool.d.ts.map +1 -1
  662. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/retry.d.ts.map +1 -1
  663. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/tee.d.ts.map +1 -1
  664. package/script/deps/jsr.io/@std/async/1.0.14/tee.js +82 -0
  665. package/script/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
  666. package/script/deps/jsr.io/@std/internal/1.0.10/_os.d.ts +2 -0
  667. package/script/deps/jsr.io/@std/internal/1.0.10/_os.d.ts.map +1 -0
  668. package/script/deps/jsr.io/@std/internal/1.0.10/_os.js +48 -0
  669. package/script/deps/jsr.io/@std/internal/1.0.10/format.js +17 -7
  670. package/script/deps/jsr.io/@std/internal/1.0.10/os.d.ts +3 -0
  671. package/script/deps/jsr.io/@std/internal/1.0.10/os.d.ts.map +1 -0
  672. package/script/deps/jsr.io/@std/internal/1.0.10/os.js +8 -0
  673. package/script/deps/jsr.io/@std/internal/1.0.10/styles.js +17 -7
  674. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/assert_path.d.ts.map +1 -1
  675. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/basename.d.ts.map +1 -1
  676. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/constants.d.ts.map +1 -1
  677. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/from_file_url.d.ts.map +1 -1
  678. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize.d.ts.map +1 -1
  679. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize_string.d.ts.map +1 -1
  680. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/strip_trailing_separators.d.ts.map +1 -1
  681. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/to_file_url.d.ts.map +1 -1
  682. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/basename.d.ts.map +1 -1
  683. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/basename.js +2 -2
  684. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/extname.d.ts.map +1 -1
  685. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/extname.js +2 -2
  686. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/is_absolute.d.ts.map +1 -1
  687. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/is_absolute.js +2 -2
  688. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/join.d.ts.map +1 -1
  689. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/join.js +2 -2
  690. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/_util.d.ts.map +1 -1
  691. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/posix/basename.d.ts.map +1 -1
  692. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/posix/extname.d.ts.map +1 -1
  693. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/from_file_url.d.ts.map +1 -1
  694. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/is_absolute.d.ts.map +1 -1
  695. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/posix/join.d.ts.map +1 -1
  696. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/posix/normalize.d.ts.map +1 -1
  697. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/posix/to_file_url.d.ts.map +1 -1
  698. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/to_file_url.d.ts.map +1 -1
  699. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/to_file_url.js +2 -2
  700. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/_util.d.ts.map +1 -1
  701. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/basename.d.ts.map +1 -1
  702. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/extname.d.ts.map +1 -1
  703. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/from_file_url.d.ts.map +1 -1
  704. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/is_absolute.d.ts.map +1 -1
  705. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/join.d.ts.map +1 -1
  706. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/normalize.d.ts.map +1 -1
  707. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/to_file_url.d.ts.map +1 -1
  708. package/script/deps/jsr.io/@std/streams/{1.0.10 → 1.0.11}/to_array_buffer.d.ts.map +1 -1
  709. package/script/mod.js +19 -19
  710. package/script/session/0_session_state.js +12 -38
  711. package/script/session/1_session.d.ts +2 -2
  712. package/script/session/1_session.d.ts.map +1 -1
  713. package/script/session/1_session.js +66 -79
  714. package/script/session/2_session_encrypted.d.ts +2 -2
  715. package/script/session/2_session_encrypted.d.ts.map +1 -1
  716. package/script/session/2_session_encrypted.js +325 -321
  717. package/script/session/2_session_plain.js +1 -1
  718. package/script/storage/0_storage.d.ts +1 -1
  719. package/script/storage/0_storage.d.ts.map +1 -1
  720. package/script/storage/1_utilities.d.ts +14 -11
  721. package/script/storage/1_utilities.d.ts.map +1 -1
  722. package/script/storage/1_utilities.js +39 -39
  723. package/script/storage/1_utilities_test.d.ts.map +1 -1
  724. package/script/storage/2_storage_indexed_db.d.ts +1 -1
  725. package/script/storage/2_storage_indexed_db.d.ts.map +1 -1
  726. package/script/storage/2_storage_indexed_db.js +29 -47
  727. package/script/storage/2_storage_local_storage.node.d.ts +1 -1
  728. package/script/storage/2_storage_local_storage.node.d.ts.map +1 -1
  729. package/script/storage/2_storage_local_storage.node.js +15 -28
  730. package/script/storage/2_storage_memory.d.ts +2 -2
  731. package/script/storage/2_storage_memory.d.ts.map +1 -1
  732. package/script/storage/2_storage_memory.js +26 -43
  733. package/script/storage/2_storage_session_storage.d.ts +2 -2
  734. package/script/storage/2_storage_session_storage.d.ts.map +1 -1
  735. package/script/storage/2_storage_session_storage.js +6 -19
  736. package/script/tl/0_utilities.js +1 -1
  737. package/script/tl/0_utilities_test.d.ts.map +1 -1
  738. package/script/tl/1_tl_reader.d.ts +1 -1
  739. package/script/tl/1_tl_reader.d.ts.map +1 -1
  740. package/script/tl/1_tl_reader.js +83 -91
  741. package/script/tl/1_tl_reader_test.d.ts.map +1 -1
  742. package/script/tl/1_tl_writer.d.ts +1 -1
  743. package/script/tl/1_tl_writer.d.ts.map +1 -1
  744. package/script/tl/1_tl_writer.js +156 -165
  745. package/script/tl/1_tl_writer_test.d.ts.map +1 -1
  746. package/script/tl/1_utilities.d.ts +1 -1
  747. package/script/tl/1_utilities.d.ts.map +1 -1
  748. package/script/tl/1_utilities.js +2 -2
  749. package/script/tl/2_message.js +1 -1
  750. package/script/tl/2_mtproto.d.ts +1 -1
  751. package/script/tl/2_mtproto.d.ts.map +1 -1
  752. package/script/tl/2_telegram.d.ts +1 -1
  753. package/script/tl/2_telegram.d.ts.map +1 -1
  754. package/script/tl/2_telegram.js +17 -7
  755. package/script/transport/0_obfuscation.d.ts +1 -1
  756. package/script/transport/0_obfuscation.d.ts.map +1 -1
  757. package/script/transport/0_obfuscation.js +19 -9
  758. package/script/transport/0_transport.d.ts +1 -1
  759. package/script/transport/0_transport.d.ts.map +1 -1
  760. package/script/transport/0_transport.js +1 -8
  761. package/script/transport/1_transport_abridged.d.ts +1 -1
  762. package/script/transport/1_transport_abridged.d.ts.map +1 -1
  763. package/script/transport/1_transport_abridged.js +11 -24
  764. package/script/transport/1_transport_intermediate.d.ts +1 -1
  765. package/script/transport/1_transport_intermediate.d.ts.map +1 -1
  766. package/script/transport/1_transport_intermediate.js +10 -23
  767. package/script/transport/1_transport_provider.d.ts +2 -2
  768. package/script/transport/1_transport_provider.d.ts.map +1 -1
  769. package/script/transport/2_transport_provider_tcp.d.ts +1 -1
  770. package/script/transport/2_transport_provider_tcp.d.ts.map +1 -1
  771. package/script/transport/2_transport_provider_web_socket.d.ts +1 -1
  772. package/script/transport/2_transport_provider_web_socket.d.ts.map +1 -1
  773. package/script/transport/2_transport_provider_web_socket.js +1 -1
  774. package/script/types/0_birthday.d.ts +1 -1
  775. package/script/types/0_birthday.d.ts.map +1 -1
  776. package/script/types/0_callback_query_answer.d.ts +1 -1
  777. package/script/types/0_callback_query_answer.d.ts.map +1 -1
  778. package/script/types/0_callback_query_question.js +2 -2
  779. package/script/types/0_chat_administrator_rights.d.ts +1 -1
  780. package/script/types/0_chat_administrator_rights.d.ts.map +1 -1
  781. package/script/types/0_chat_member_rights.d.ts +1 -1
  782. package/script/types/0_chat_member_rights.d.ts.map +1 -1
  783. package/script/types/0_contact.d.ts +1 -1
  784. package/script/types/0_contact.d.ts.map +1 -1
  785. package/script/types/0_dice.d.ts +1 -1
  786. package/script/types/0_dice.d.ts.map +1 -1
  787. package/script/types/0_failed_invitation.d.ts +1 -1
  788. package/script/types/0_failed_invitation.d.ts.map +1 -1
  789. package/script/types/0_invoice.d.ts +1 -1
  790. package/script/types/0_invoice.d.ts.map +1 -1
  791. package/script/types/0_live_stream_channel.d.ts +1 -1
  792. package/script/types/0_live_stream_channel.d.ts.map +1 -1
  793. package/script/types/0_mask_position.d.ts +1 -1
  794. package/script/types/0_mask_position.d.ts.map +1 -1
  795. package/script/types/0_mask_position.js +1 -1
  796. package/script/types/0_message_entity.d.ts +1 -1
  797. package/script/types/0_message_entity.d.ts.map +1 -1
  798. package/script/types/0_message_entity.js +1 -1
  799. package/script/types/0_message_search_filter.d.ts +1 -1
  800. package/script/types/0_message_search_filter.d.ts.map +1 -1
  801. package/script/types/0_opening_hours.d.ts +1 -1
  802. package/script/types/0_opening_hours.d.ts.map +1 -1
  803. package/script/types/0_reaction.js +5 -5
  804. package/script/types/0_refunded_payment.d.ts +1 -1
  805. package/script/types/0_refunded_payment.d.ts.map +1 -1
  806. package/script/types/0_restriction_reason.d.ts +1 -1
  807. package/script/types/0_restriction_reason.d.ts.map +1 -1
  808. package/script/types/0_self_destruct_option.js +3 -3
  809. package/script/types/0_shipping_address.d.ts +1 -1
  810. package/script/types/0_shipping_address.d.ts.map +1 -1
  811. package/script/types/0_slow_mode_duration.js +2 -2
  812. package/script/types/0_upload_progress.d.ts +29 -0
  813. package/script/types/0_upload_progress.d.ts.map +1 -0
  814. package/script/types/0_upload_progress.js +21 -0
  815. package/script/types/0_voice.d.ts +1 -1
  816. package/script/types/0_voice.d.ts.map +1 -1
  817. package/script/types/0_voice_transcription.d.ts +1 -1
  818. package/script/types/0_voice_transcription.d.ts.map +1 -1
  819. package/script/types/1_animation.d.ts +1 -1
  820. package/script/types/1_animation.d.ts.map +1 -1
  821. package/script/types/1_audio.d.ts +1 -1
  822. package/script/types/1_audio.d.ts.map +1 -1
  823. package/script/types/1_bot_command_scope.d.ts +2 -2
  824. package/script/types/1_bot_command_scope.d.ts.map +1 -1
  825. package/script/types/1_chat_p.d.ts +2 -2
  826. package/script/types/1_chat_p.d.ts.map +1 -1
  827. package/script/types/1_chat_p.js +2 -2
  828. package/script/types/1_document.d.ts +1 -1
  829. package/script/types/1_document.d.ts.map +1 -1
  830. package/script/types/1_giveaway.d.ts +2 -2
  831. package/script/types/1_giveaway.d.ts.map +1 -1
  832. package/script/types/1_inline_keyboard_button.d.ts +3 -3
  833. package/script/types/1_inline_keyboard_button.d.ts.map +1 -1
  834. package/script/types/1_inline_keyboard_button.js +4 -4
  835. package/script/types/1_inline_query_result_button.d.ts +1 -1
  836. package/script/types/1_inline_query_result_button.d.ts.map +1 -1
  837. package/script/types/1_input_media.d.ts +4 -4
  838. package/script/types/1_input_media.d.ts.map +1 -1
  839. package/script/types/1_input_story_content.d.ts +1 -1
  840. package/script/types/1_input_story_content.d.ts.map +1 -1
  841. package/script/types/1_keyboard_button.d.ts +3 -3
  842. package/script/types/1_keyboard_button.d.ts.map +1 -1
  843. package/script/types/1_keyboard_button.js +1 -1
  844. package/script/types/1_message_reaction.d.ts +1 -1
  845. package/script/types/1_message_reaction.d.ts.map +1 -1
  846. package/script/types/1_message_reaction.js +2 -2
  847. package/script/types/1_mini_app_info.d.ts +2 -2
  848. package/script/types/1_mini_app_info.d.ts.map +1 -1
  849. package/script/types/1_network_statistics.d.ts +1 -1
  850. package/script/types/1_network_statistics.d.ts.map +1 -1
  851. package/script/types/1_order_info.d.ts +2 -2
  852. package/script/types/1_order_info.d.ts.map +1 -1
  853. package/script/types/1_photo.d.ts +1 -1
  854. package/script/types/1_photo.d.ts.map +1 -1
  855. package/script/types/1_poll_option.d.ts +2 -2
  856. package/script/types/1_poll_option.d.ts.map +1 -1
  857. package/script/types/1_poll_option.js +2 -2
  858. package/script/types/1_reaction_count.d.ts +2 -2
  859. package/script/types/1_reaction_count.d.ts.map +1 -1
  860. package/script/types/1_reply_quote.d.ts +2 -2
  861. package/script/types/1_reply_quote.d.ts.map +1 -1
  862. package/script/types/1_sticker.d.ts +4 -4
  863. package/script/types/1_sticker.d.ts.map +1 -1
  864. package/script/types/1_sticker.js +2 -2
  865. package/script/types/1_story_privacy.d.ts +1 -1
  866. package/script/types/1_story_privacy.d.ts.map +1 -1
  867. package/script/types/1_story_reaction.d.ts +2 -2
  868. package/script/types/1_story_reaction.d.ts.map +1 -1
  869. package/script/types/1_user.d.ts +2 -2
  870. package/script/types/1_user.d.ts.map +1 -1
  871. package/script/types/1_user.js +1 -1
  872. package/script/types/1_venue.d.ts +1 -1
  873. package/script/types/1_venue.d.ts.map +1 -1
  874. package/script/types/1_video.d.ts +1 -1
  875. package/script/types/1_video.d.ts.map +1 -1
  876. package/script/types/1_video_note.d.ts +1 -1
  877. package/script/types/1_video_note.d.ts.map +1 -1
  878. package/script/types/2_business_connection.d.ts +3 -3
  879. package/script/types/2_business_connection.d.ts.map +1 -1
  880. package/script/types/2_chat.d.ts +6 -6
  881. package/script/types/2_chat.d.ts.map +1 -1
  882. package/script/types/2_chat.js +3 -3
  883. package/script/types/2_chat_member.d.ts +4 -4
  884. package/script/types/2_chat_member.d.ts.map +1 -1
  885. package/script/types/2_chat_member.js +1 -1
  886. package/script/types/2_chat_settings.d.ts +1 -1
  887. package/script/types/2_chat_settings.d.ts.map +1 -1
  888. package/script/types/2_chat_settings.js +1 -1
  889. package/script/types/2_chosen_inline_result.d.ts +3 -3
  890. package/script/types/2_chosen_inline_result.d.ts.map +1 -1
  891. package/script/types/2_forward_header.d.ts +4 -4
  892. package/script/types/2_forward_header.d.ts.map +1 -1
  893. package/script/types/2_forward_header.js +6 -6
  894. package/script/types/2_game.d.ts +3 -3
  895. package/script/types/2_game.d.ts.map +1 -1
  896. package/script/types/2_gift_upgraded_component.d.ts +2 -2
  897. package/script/types/2_gift_upgraded_component.d.ts.map +1 -1
  898. package/script/types/2_inactive_chat.d.ts +1 -1
  899. package/script/types/2_inactive_chat.d.ts.map +1 -1
  900. package/script/types/2_inline_query.d.ts +3 -3
  901. package/script/types/2_inline_query.d.ts.map +1 -1
  902. package/script/types/2_inline_query.js +1 -1
  903. package/script/types/2_invite_link.d.ts +3 -3
  904. package/script/types/2_invite_link.d.ts.map +1 -1
  905. package/script/types/2_message_interactions.d.ts +1 -1
  906. package/script/types/2_message_interactions.d.ts.map +1 -1
  907. package/script/types/2_message_reaction_count.d.ts +4 -4
  908. package/script/types/2_message_reaction_count.d.ts.map +1 -1
  909. package/script/types/2_message_reactions.d.ts +4 -4
  910. package/script/types/2_message_reactions.d.ts.map +1 -1
  911. package/script/types/2_poll.d.ts +3 -3
  912. package/script/types/2_poll.d.ts.map +1 -1
  913. package/script/types/2_poll.js +3 -3
  914. package/script/types/2_poll_answer.d.ts +22 -3
  915. package/script/types/2_poll_answer.d.ts.map +1 -1
  916. package/script/types/2_poll_answer.js +19 -0
  917. package/script/types/2_pre_checkout_query.d.ts +4 -4
  918. package/script/types/2_pre_checkout_query.d.ts.map +1 -1
  919. package/script/types/2_reply_markup.d.ts +3 -3
  920. package/script/types/2_reply_markup.d.ts.map +1 -1
  921. package/script/types/2_reply_to.d.ts +2 -2
  922. package/script/types/2_reply_to.d.ts.map +1 -1
  923. package/script/types/2_sticker_set.d.ts +51 -0
  924. package/script/types/2_sticker_set.d.ts.map +1 -0
  925. package/script/types/2_sticker_set.js +94 -0
  926. package/script/types/2_story_content.d.ts +2 -2
  927. package/script/types/2_story_content.d.ts.map +1 -1
  928. package/script/types/2_story_interactions.d.ts +2 -2
  929. package/script/types/2_story_interactions.d.ts.map +1 -1
  930. package/script/types/2_story_interactive_area.d.ts +5 -5
  931. package/script/types/2_story_interactive_area.d.ts.map +1 -1
  932. package/script/types/2_successful_payment.d.ts +2 -2
  933. package/script/types/2_successful_payment.d.ts.map +1 -1
  934. package/script/types/3_chat_member_updated.d.ts +5 -5
  935. package/script/types/3_chat_member_updated.d.ts.map +1 -1
  936. package/script/types/3_gift.d.ts +4 -4
  937. package/script/types/3_gift.d.ts.map +1 -1
  938. package/script/types/3_join_request.d.ts +4 -4
  939. package/script/types/3_join_request.d.ts.map +1 -1
  940. package/script/types/3_story.d.ts +8 -8
  941. package/script/types/3_story.d.ts.map +1 -1
  942. package/script/types/4_claimed_gift.d.ts +4 -4
  943. package/script/types/4_claimed_gift.d.ts.map +1 -1
  944. package/script/types/4_link_preview.d.ts +5 -5
  945. package/script/types/4_link_preview.d.ts.map +1 -1
  946. package/script/types/5_claimed_gifts.d.ts +2 -2
  947. package/script/types/5_claimed_gifts.d.ts.map +1 -1
  948. package/script/types/5_claimed_gifts.js +3 -3
  949. package/script/types/5_message.d.ts +29 -29
  950. package/script/types/5_message.d.ts.map +1 -1
  951. package/script/types/5_message.js +8 -8
  952. package/script/types/5_message_content.d.ts +4 -4
  953. package/script/types/5_message_content.d.ts.map +1 -1
  954. package/script/types/6_callback_query.d.ts +3 -3
  955. package/script/types/6_callback_query.d.ts.map +1 -1
  956. package/script/types/6_callback_query.js +2 -2
  957. package/script/types/6_chat_list_item.d.ts +4 -4
  958. package/script/types/6_chat_list_item.d.ts.map +1 -1
  959. package/script/types/6_chat_list_item.js +6 -6
  960. package/script/types/6_inline_query_result.d.ts +6 -6
  961. package/script/types/6_inline_query_result.d.ts.map +1 -1
  962. package/script/types/6_inline_query_result.js +16 -16
  963. package/script/types/6_saved_chat.d.ts +36 -0
  964. package/script/types/6_saved_chat.d.ts.map +1 -0
  965. package/script/types/6_saved_chat.js +46 -0
  966. package/script/types/6_topic.d.ts +2 -2
  967. package/script/types/6_topic.d.ts.map +1 -1
  968. package/script/types/6_topic.js +1 -1
  969. package/script/types/7_inline_query_answer.d.ts +2 -2
  970. package/script/types/7_inline_query_answer.d.ts.map +1 -1
  971. package/script/types/7_saved_chats.d.ts +33 -0
  972. package/script/types/7_saved_chats.d.ts.map +1 -0
  973. package/script/types/7_saved_chats.js +39 -0
  974. package/script/types/7_update.d.ts +44 -25
  975. package/script/types/7_update.d.ts.map +1 -1
  976. package/script/types/_file_id.d.ts +60 -49
  977. package/script/types/_file_id.d.ts.map +1 -1
  978. package/script/types/_file_id.js +155 -136
  979. package/script/types/_getters.d.ts +3 -3
  980. package/script/types/_getters.d.ts.map +1 -1
  981. package/script/utilities/0_bigint.js +22 -12
  982. package/script/utilities/0_bigint_test.d.ts.map +1 -1
  983. package/script/utilities/0_buffer.d.ts +1 -1
  984. package/script/utilities/0_buffer.d.ts.map +1 -1
  985. package/script/utilities/0_buffer.js +3 -3
  986. package/script/utilities/0_buffer_test.d.ts.map +1 -1
  987. package/script/utilities/0_env.js +18 -8
  988. package/script/utilities/0_hash.d.ts +2 -2
  989. package/script/utilities/0_hash.d.ts.map +1 -1
  990. package/script/utilities/0_hash.js +17 -7
  991. package/script/utilities/0_misc.d.ts.map +1 -1
  992. package/script/utilities/0_misc.js +21 -10
  993. package/script/utilities/0_mutex.js +4 -19
  994. package/script/utilities/0_part_stream.js +11 -25
  995. package/script/utilities/0_part_stream_test.d.ts.map +1 -1
  996. package/script/utilities/0_rle.d.ts +2 -2
  997. package/script/utilities/0_rle.d.ts.map +1 -1
  998. package/script/utilities/0_rle.js +1 -1
  999. package/script/utilities/0_rle_test.d.ts.map +1 -1
  1000. package/script/utilities/0_text.d.ts +20 -1
  1001. package/script/utilities/0_text.d.ts.map +1 -1
  1002. package/script/utilities/0_text.js +19 -0
  1003. package/script/utilities/1_auth.d.ts +1 -1
  1004. package/script/utilities/1_auth.d.ts.map +1 -1
  1005. package/script/utilities/1_auth.js +18 -8
  1006. package/script/utilities/1_base64.d.ts +1 -1
  1007. package/script/utilities/1_base64.d.ts.map +1 -1
  1008. package/script/utilities/1_base64.js +1 -1
  1009. package/script/utilities/1_base64_test.d.ts.map +1 -1
  1010. package/script/utilities/1_crypto.js +60 -61
  1011. package/script/utilities/1_crypto_test.d.ts.map +1 -1
  1012. package/script/utilities/1_logger.d.ts +2 -2
  1013. package/script/utilities/1_logger.js +2 -2
  1014. package/script/utilities/1_math.js +2 -2
  1015. package/script/utilities/1_math_test.d.ts.map +1 -1
  1016. package/script/utilities/2_queue.js +30 -48
  1017. package/esm/deps/jsr.io/@std/async/1.0.13/tee.js +0 -102
  1018. package/esm/deps/jsr.io/@std/path/1.1.0/_os.d.ts +0 -2
  1019. package/esm/deps/jsr.io/@std/path/1.1.0/_os.d.ts.map +0 -1
  1020. package/esm/deps/jsr.io/@std/path/1.1.0/_os.js +0 -9
  1021. package/script/deps/jsr.io/@std/async/1.0.13/tee.js +0 -105
  1022. package/script/deps/jsr.io/@std/path/1.1.0/_os.d.ts +0 -2
  1023. package/script/deps/jsr.io/@std/path/1.1.0/_os.d.ts.map +0 -1
  1024. package/script/deps/jsr.io/@std/path/1.1.0/_os.js +0 -35
  1025. /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/assert.d.ts +0 -0
  1026. /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/assert.js +0 -0
  1027. /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equal.d.ts +0 -0
  1028. /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equal.js +0 -0
  1029. /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equals.d.ts +0 -0
  1030. /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equals.js +0 -0
  1031. /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/false.d.ts +0 -0
  1032. /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/false.js +0 -0
  1033. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/_util.d.ts +0 -0
  1034. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/_util.js +0 -0
  1035. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/abortable.d.ts +0 -0
  1036. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/abortable.js +0 -0
  1037. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/deadline.d.ts +0 -0
  1038. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/deadline.js +0 -0
  1039. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/debounce.d.ts +0 -0
  1040. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/debounce.js +0 -0
  1041. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/delay.d.ts +0 -0
  1042. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mod.d.ts +0 -0
  1043. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mod.js +0 -0
  1044. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mux_async_iterator.d.ts +0 -0
  1045. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/pool.d.ts +0 -0
  1046. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/pool.js +0 -0
  1047. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/retry.d.ts +0 -0
  1048. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/retry.js +0 -0
  1049. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/tee.d.ts +0 -0
  1050. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/assert_path.d.ts +0 -0
  1051. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/assert_path.js +0 -0
  1052. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/basename.d.ts +0 -0
  1053. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/basename.js +0 -0
  1054. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/constants.d.ts +0 -0
  1055. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/constants.js +0 -0
  1056. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/from_file_url.d.ts +0 -0
  1057. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/from_file_url.js +0 -0
  1058. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize.d.ts +0 -0
  1059. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize.js +0 -0
  1060. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize_string.d.ts +0 -0
  1061. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize_string.js +0 -0
  1062. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/strip_trailing_separators.d.ts +0 -0
  1063. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/strip_trailing_separators.js +0 -0
  1064. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/to_file_url.d.ts +0 -0
  1065. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/to_file_url.js +0 -0
  1066. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/basename.d.ts +0 -0
  1067. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/extname.d.ts +0 -0
  1068. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/is_absolute.d.ts +0 -0
  1069. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/join.d.ts +0 -0
  1070. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/_util.d.ts +0 -0
  1071. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/_util.js +0 -0
  1072. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/basename.d.ts +0 -0
  1073. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/basename.js +0 -0
  1074. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/extname.d.ts +0 -0
  1075. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/extname.js +0 -0
  1076. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/from_file_url.d.ts +0 -0
  1077. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/from_file_url.js +0 -0
  1078. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/is_absolute.d.ts +0 -0
  1079. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/is_absolute.js +0 -0
  1080. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/join.d.ts +0 -0
  1081. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/join.js +0 -0
  1082. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/normalize.d.ts +0 -0
  1083. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/normalize.js +0 -0
  1084. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/to_file_url.d.ts +0 -0
  1085. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/to_file_url.js +0 -0
  1086. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/to_file_url.d.ts +0 -0
  1087. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/_util.d.ts +0 -0
  1088. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/_util.js +0 -0
  1089. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/basename.d.ts +0 -0
  1090. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/basename.js +0 -0
  1091. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/extname.d.ts +0 -0
  1092. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/extname.js +0 -0
  1093. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/from_file_url.d.ts +0 -0
  1094. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/from_file_url.js +0 -0
  1095. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/is_absolute.d.ts +0 -0
  1096. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/is_absolute.js +0 -0
  1097. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/join.d.ts +0 -0
  1098. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/join.js +0 -0
  1099. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/normalize.d.ts +0 -0
  1100. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/normalize.js +0 -0
  1101. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/to_file_url.d.ts +0 -0
  1102. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/to_file_url.js +0 -0
  1103. /package/esm/deps/jsr.io/@std/streams/{1.0.10 → 1.0.11}/to_array_buffer.d.ts +0 -0
  1104. /package/esm/deps/jsr.io/@std/streams/{1.0.10 → 1.0.11}/to_array_buffer.js +0 -0
  1105. /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/assert.d.ts +0 -0
  1106. /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/assert.js +0 -0
  1107. /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equal.d.ts +0 -0
  1108. /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equals.d.ts +0 -0
  1109. /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equals.js +0 -0
  1110. /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/false.d.ts +0 -0
  1111. /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/false.js +0 -0
  1112. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/_util.d.ts +0 -0
  1113. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/_util.js +0 -0
  1114. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/abortable.d.ts +0 -0
  1115. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/abortable.js +0 -0
  1116. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/deadline.d.ts +0 -0
  1117. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/deadline.js +0 -0
  1118. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/debounce.d.ts +0 -0
  1119. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/debounce.js +0 -0
  1120. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/delay.d.ts +0 -0
  1121. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mod.d.ts +0 -0
  1122. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mod.js +0 -0
  1123. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mux_async_iterator.d.ts +0 -0
  1124. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/pool.d.ts +0 -0
  1125. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/pool.js +0 -0
  1126. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/retry.d.ts +0 -0
  1127. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/retry.js +0 -0
  1128. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/tee.d.ts +0 -0
  1129. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/assert_path.d.ts +0 -0
  1130. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/assert_path.js +0 -0
  1131. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/basename.d.ts +0 -0
  1132. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/basename.js +0 -0
  1133. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/constants.d.ts +0 -0
  1134. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/constants.js +0 -0
  1135. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/from_file_url.d.ts +0 -0
  1136. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/from_file_url.js +0 -0
  1137. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize.d.ts +0 -0
  1138. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize.js +0 -0
  1139. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize_string.d.ts +0 -0
  1140. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize_string.js +0 -0
  1141. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/strip_trailing_separators.d.ts +0 -0
  1142. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/strip_trailing_separators.js +0 -0
  1143. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/to_file_url.d.ts +0 -0
  1144. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/to_file_url.js +0 -0
  1145. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/basename.d.ts +0 -0
  1146. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/extname.d.ts +0 -0
  1147. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/is_absolute.d.ts +0 -0
  1148. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/join.d.ts +0 -0
  1149. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/_util.d.ts +0 -0
  1150. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/_util.js +0 -0
  1151. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/basename.d.ts +0 -0
  1152. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/basename.js +0 -0
  1153. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/extname.d.ts +0 -0
  1154. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/extname.js +0 -0
  1155. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/from_file_url.d.ts +0 -0
  1156. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/from_file_url.js +0 -0
  1157. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/is_absolute.d.ts +0 -0
  1158. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/is_absolute.js +0 -0
  1159. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/join.d.ts +0 -0
  1160. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/join.js +0 -0
  1161. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/normalize.d.ts +0 -0
  1162. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/normalize.js +0 -0
  1163. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/to_file_url.d.ts +0 -0
  1164. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/to_file_url.js +0 -0
  1165. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/to_file_url.d.ts +0 -0
  1166. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/_util.d.ts +0 -0
  1167. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/_util.js +0 -0
  1168. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/basename.d.ts +0 -0
  1169. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/basename.js +0 -0
  1170. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/extname.d.ts +0 -0
  1171. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/extname.js +0 -0
  1172. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/from_file_url.d.ts +0 -0
  1173. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/from_file_url.js +0 -0
  1174. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/is_absolute.d.ts +0 -0
  1175. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/is_absolute.js +0 -0
  1176. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/join.d.ts +0 -0
  1177. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/join.js +0 -0
  1178. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/normalize.d.ts +0 -0
  1179. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/normalize.js +0 -0
  1180. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/to_file_url.d.ts +0 -0
  1181. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/to_file_url.js +0 -0
  1182. /package/script/deps/jsr.io/@std/streams/{1.0.10 → 1.0.11}/to_array_buffer.d.ts +0 -0
  1183. /package/script/deps/jsr.io/@std/streams/{1.0.10 → 1.0.11}/to_array_buffer.js +0 -0
@@ -18,18 +18,6 @@
18
18
  * You should have received a copy of the GNU Lesser General Public License
19
19
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20
20
  */
21
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
22
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
23
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
24
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
25
- };
26
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
27
- if (kind === "m") throw new TypeError("Private method is not writable");
28
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
29
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
30
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
31
- };
32
- var _Client_instances, _Client_clients, _Client_downloadPools, _Client_uploadPools, _Client_guaranteeUpdateDelivery, _Client_accountManager, _Client_botInfoManager, _Client_businessConnectionManager, _Client_fileManager, _Client_networkStatisticsManager, _Client_paymentManager, _Client_reactionManager, _Client_translationsManager, _Client_updateManager, _Client_messageManager, _Client_videoChatManager, _Client_callbackQueryManager, _Client_chatListManager, _Client_chatManager, _Client_forumManager, _Client_giftManager, _Client_inlineQueryManager, _Client_linkPreviewManager, _Client_pollManager, _Client_storyManager, _Client_managers, _Client_storage_, _Client_messageStorage_, _Client_parseMode, _Client_apiId, _Client_apiHash, _Client_transportProvider, _Client_publicKeys, _Client_outgoingMessages, _Client_persistCache, _Client_disableUpdates, _Client_authString, _Client_initialDc, _Client_L, _Client_LsignIn, _Client_LupdateGapRecoveryLoop, _Client_LhandleMigrationError, _Client_Lmin, _Client_setMainClient, _Client_newClient, _Client_disconnectAllClients, _Client_client_get, _Client_constructContext, _Client_propagateConnectionState, _Client_lastPropagatedConnectionState, _Client_stateChangeHandler, _Client_storageInited, _Client_initStorage, _Client_connectMutex, _Client_lastPropagatedAuthorizationState, _Client_propagateAuthorizationState, _Client_getSelfId, _Client_getIsPremium, _Client_lastUpdates, _Client_updateGapRecoveryLoopAbortController, _Client_startUpdateGapRecoveryLoop, _Client_updateGapRecoveryLoop, _Client_clientDisconnectionLoopAbortController, _Client_startClientDisconnectionLoop, _Client_clientDisconnectionLoop, _Client_getClient, _Client_getMainClientMutex, _Client_getMainClient, _Client_getDownloadClient, _Client_getUploadPoolSize, _Client_getUploadClient, _Client_setupClient, _Client_importAuthorization, _Client_invoke, _Client_handleInvokeError, _Client_authStringImported, _Client_getUserAccessHash, _Client_getChannelAccessHash, _Client_getInputPeerChatId, _Client_getInputPeerInner, _Client_getMinInputPeer, _Client_handleCtxUpdate, _Client_queueHandleCtxUpdate, _Client_handleUpdate, _Client_lastGetMe, _Client_getMe, _Client_previouslyConnected, _Client_lastConnectionState, _Client_onConnectionStateChange;
33
21
  Object.defineProperty(exports, "__esModule", { value: true });
34
22
  exports.Client = exports.handleMigrationError = exports.restartAuth = exports.Composer = void 0;
35
23
  const _0_deps_js_1 = require("../0_deps.js");
@@ -83,615 +71,130 @@ const getEntity = Symbol();
83
71
  * An MTKruto client.
84
72
  */
85
73
  class Client extends Composer {
74
+ #clients = new Array();
75
+ #downloadPools = {};
76
+ #uploadPools = {};
77
+ #guaranteeUpdateDelivery;
78
+ // 2_
79
+ #accountManager;
80
+ #botInfoManager;
81
+ #businessConnectionManager;
82
+ #fileManager;
83
+ #networkStatisticsManager;
84
+ #paymentManager;
85
+ #reactionManager;
86
+ #translationsManager;
87
+ #updateManager;
88
+ // 3_
89
+ #messageManager;
90
+ #videoChatManager;
91
+ // 4_
92
+ #callbackQueryManager;
93
+ #chatListManager;
94
+ #chatManager;
95
+ #forumManager;
96
+ #giftManager;
97
+ #inlineQueryManager;
98
+ #linkPreviewManager;
99
+ #pollManager;
100
+ #storyManager;
101
+ // deno-lint-ignore no-explicit-any
102
+ #managers;
86
103
  // deno-lint-ignore no-explicit-any
87
104
  get managers() {
88
- return __classPrivateFieldGet(this, _Client_managers, "f") ?? (__classPrivateFieldSet(this, _Client_managers, __classPrivateFieldGet(this, _Client_managers, "f") ?? {
105
+ return this.#managers ?? (this.#managers ??= {
89
106
  // 2_
90
- accountManager: __classPrivateFieldGet(this, _Client_accountManager, "f"),
91
- botInfoManager: __classPrivateFieldGet(this, _Client_botInfoManager, "f"),
92
- businessConnectionManager: __classPrivateFieldGet(this, _Client_businessConnectionManager, "f"),
93
- fileManager: __classPrivateFieldGet(this, _Client_fileManager, "f"),
94
- networkStatisticsManager: __classPrivateFieldGet(this, _Client_networkStatisticsManager, "f"),
95
- paymentManager: __classPrivateFieldGet(this, _Client_paymentManager, "f"),
96
- reactionManager: __classPrivateFieldGet(this, _Client_reactionManager, "f"),
97
- translationsManager: __classPrivateFieldGet(this, _Client_translationsManager, "f"),
98
- updateManager: __classPrivateFieldGet(this, _Client_updateManager, "f"),
107
+ accountManager: this.#accountManager,
108
+ botInfoManager: this.#botInfoManager,
109
+ businessConnectionManager: this.#businessConnectionManager,
110
+ fileManager: this.#fileManager,
111
+ networkStatisticsManager: this.#networkStatisticsManager,
112
+ paymentManager: this.#paymentManager,
113
+ reactionManager: this.#reactionManager,
114
+ translationsManager: this.#translationsManager,
115
+ updateManager: this.#updateManager,
99
116
  // 3_
100
- messageManager: __classPrivateFieldGet(this, _Client_messageManager, "f"),
101
- videoChatManager: __classPrivateFieldGet(this, _Client_videoChatManager, "f"),
117
+ messageManager: this.#messageManager,
118
+ videoChatManager: this.#videoChatManager,
102
119
  // 4_
103
- callbackQueryManager: __classPrivateFieldGet(this, _Client_callbackQueryManager, "f"),
104
- chatListManager: __classPrivateFieldGet(this, _Client_chatListManager, "f"),
105
- chatManager: __classPrivateFieldGet(this, _Client_chatManager, "f"),
106
- forumManager: __classPrivateFieldGet(this, _Client_forumManager, "f"),
107
- giftManager: __classPrivateFieldGet(this, _Client_giftManager, "f"),
108
- inlineQueryManager: __classPrivateFieldGet(this, _Client_inlineQueryManager, "f"),
109
- linkPreviewManager: __classPrivateFieldGet(this, _Client_linkPreviewManager, "f"),
110
- pollManager: __classPrivateFieldGet(this, _Client_pollManager, "f"),
111
- storyManager: __classPrivateFieldGet(this, _Client_storyManager, "f"),
112
- }, "f"));
120
+ callbackQueryManager: this.#callbackQueryManager,
121
+ chatListManager: this.#chatListManager,
122
+ chatManager: this.#chatManager,
123
+ forumManager: this.#forumManager,
124
+ giftManager: this.#giftManager,
125
+ inlineQueryManager: this.#inlineQueryManager,
126
+ linkPreviewManager: this.#linkPreviewManager,
127
+ pollManager: this.#pollManager,
128
+ storyManager: this.#storyManager,
129
+ });
113
130
  }
131
+ #storage_;
132
+ #messageStorage_;
133
+ storage;
134
+ messageStorage;
135
+ #parseMode;
136
+ #apiId;
137
+ #apiHash;
138
+ #transportProvider;
139
+ appVersion;
140
+ deviceModel;
141
+ language;
142
+ platform;
143
+ systemLangCode;
144
+ systemVersion;
145
+ #publicKeys;
146
+ #outgoingMessages;
147
+ #persistCache;
148
+ #disableUpdates;
149
+ #authString;
150
+ #initialDc;
151
+ #L;
152
+ #LsignIn;
153
+ #LupdateGapRecoveryLoop;
154
+ #LhandleMigrationError;
155
+ #Lmin;
114
156
  /**
115
157
  * Constructs the client.
116
158
  */
117
159
  constructor(params) {
118
160
  super();
119
- _Client_instances.add(this);
120
- _Client_clients.set(this, new Array());
121
- _Client_downloadPools.set(this, {});
122
- _Client_uploadPools.set(this, {});
123
- _Client_guaranteeUpdateDelivery.set(this, void 0);
124
- // 2_
125
- _Client_accountManager.set(this, void 0);
126
- _Client_botInfoManager.set(this, void 0);
127
- _Client_businessConnectionManager.set(this, void 0);
128
- _Client_fileManager.set(this, void 0);
129
- _Client_networkStatisticsManager.set(this, void 0);
130
- _Client_paymentManager.set(this, void 0);
131
- _Client_reactionManager.set(this, void 0);
132
- _Client_translationsManager.set(this, void 0);
133
- _Client_updateManager.set(this, void 0);
134
- // 3_
135
- _Client_messageManager.set(this, void 0);
136
- _Client_videoChatManager.set(this, void 0);
137
- // 4_
138
- _Client_callbackQueryManager.set(this, void 0);
139
- _Client_chatListManager.set(this, void 0);
140
- _Client_chatManager.set(this, void 0);
141
- _Client_forumManager.set(this, void 0);
142
- _Client_giftManager.set(this, void 0);
143
- _Client_inlineQueryManager.set(this, void 0);
144
- _Client_linkPreviewManager.set(this, void 0);
145
- _Client_pollManager.set(this, void 0);
146
- _Client_storyManager.set(this, void 0);
147
- // deno-lint-ignore no-explicit-any
148
- _Client_managers.set(this, void 0);
149
- _Client_storage_.set(this, void 0);
150
- _Client_messageStorage_.set(this, void 0);
151
- Object.defineProperty(this, "storage", {
152
- enumerable: true,
153
- configurable: true,
154
- writable: true,
155
- value: void 0
156
- });
157
- Object.defineProperty(this, "messageStorage", {
158
- enumerable: true,
159
- configurable: true,
160
- writable: true,
161
- value: void 0
162
- });
163
- _Client_parseMode.set(this, void 0);
164
- _Client_apiId.set(this, void 0);
165
- _Client_apiHash.set(this, void 0);
166
- _Client_transportProvider.set(this, void 0);
167
- Object.defineProperty(this, "appVersion", {
168
- enumerable: true,
169
- configurable: true,
170
- writable: true,
171
- value: void 0
172
- });
173
- Object.defineProperty(this, "deviceModel", {
174
- enumerable: true,
175
- configurable: true,
176
- writable: true,
177
- value: void 0
178
- });
179
- Object.defineProperty(this, "language", {
180
- enumerable: true,
181
- configurable: true,
182
- writable: true,
183
- value: void 0
184
- });
185
- Object.defineProperty(this, "platform", {
186
- enumerable: true,
187
- configurable: true,
188
- writable: true,
189
- value: void 0
190
- });
191
- Object.defineProperty(this, "systemLangCode", {
192
- enumerable: true,
193
- configurable: true,
194
- writable: true,
195
- value: void 0
196
- });
197
- Object.defineProperty(this, "systemVersion", {
198
- enumerable: true,
199
- configurable: true,
200
- writable: true,
201
- value: void 0
202
- });
203
- _Client_publicKeys.set(this, void 0);
204
- _Client_outgoingMessages.set(this, void 0);
205
- _Client_persistCache.set(this, void 0);
206
- _Client_disableUpdates.set(this, void 0);
207
- _Client_authString.set(this, void 0);
208
- _Client_initialDc.set(this, void 0);
209
- _Client_L.set(this, void 0);
210
- _Client_LsignIn.set(this, void 0);
211
- _Client_LupdateGapRecoveryLoop.set(this, void 0);
212
- _Client_LhandleMigrationError.set(this, void 0);
213
- _Client_Lmin.set(this, void 0);
214
- _Client_constructContext.set(this, async (update) => {
215
- const msg = "message" in update ? update.message : "editedMessage" in update ? update.editedMessage : "scheduledMessage" in update ? update.scheduledMessage : "callbackQuery" in update ? update.callbackQuery.message : undefined;
216
- const reactions = "messageInteractions" in update ? update.messageInteractions : undefined;
217
- const mustGetMsg = () => {
218
- if (msg !== undefined) {
219
- return { chatId: msg.chat.id, messageId: msg.id, businessConnectionId: msg.businessConnectionId, senderId: msg.from?.id, userId: msg.from?.id };
220
- }
221
- else if (reactions !== undefined) {
222
- return { chatId: reactions.chatId, messageId: reactions.messageId };
223
- }
224
- else {
225
- (0, _0_deps_js_1.unreachable)();
226
- }
227
- };
228
- const mustGetUserId = () => {
229
- if (msg?.from) {
230
- return msg.from.id;
231
- }
232
- else if ("callbackQuery" in update) {
233
- return update.callbackQuery.from.id;
234
- }
235
- else if ("chosenInlineResult" in update) {
236
- return update.chosenInlineResult.from.id;
237
- }
238
- else {
239
- (0, _0_deps_js_1.unreachable)();
240
- }
241
- };
242
- const mustGetInlineMsgId = () => {
243
- if ("chosenInlineResult" in update) {
244
- if (update.chosenInlineResult.inlineMessageId) {
245
- return update.chosenInlineResult.inlineMessageId;
246
- }
247
- }
248
- else if ("callbackQuery" in update) {
249
- if (update.callbackQuery.inlineMessageId) {
250
- return update.callbackQuery.inlineMessageId;
251
- }
252
- }
253
- (0, _0_deps_js_1.unreachable)();
254
- };
255
- const chat_ = "messageReactions" in update ? update.messageReactions.chat : "messageReactionCount" in update ? update.messageReactionCount.chat : "chatMember" in update ? update.chatMember.chat : "myChatMember" in update ? update.myChatMember.chat : "joinRequest" in update ? update.joinRequest.chat : "story" in update ? update.story.chat : undefined;
256
- const chat = chat_ ?? msg?.chat;
257
- const from = "callbackQuery" in update ? update.callbackQuery.from : "inlineQuery" in update ? update.inlineQuery.from : "chatMember" in update ? update.chatMember.from : "myChatMember" in update ? update.myChatMember.from : "messageReactions" in update ? update.messageReactions.user : "preCheckoutQuery" in update ? update.preCheckoutQuery.from : "joinRequest" in update ? update.joinRequest.from : "businessConnection" in update ? update.businessConnection.user : "pollAnswer" in update ? update.pollAnswer.from : msg?.from ? msg.from : undefined;
258
- const getReplyTo = (quote, chatId, messageId) => {
259
- if ("story" in update) {
260
- return { chatId: update.story.chat.id, storyId: update.story.id };
261
- }
262
- const isPrivate = chatId > 0;
263
- const shouldQuote = quote === undefined ? !isPrivate : quote;
264
- return shouldQuote ? { messageId } : undefined;
265
- };
266
- const me = "connectionState" in update ? __classPrivateFieldGet(this, _Client_lastGetMe, "f") : ("authorizationState" in update && !update.authorizationState.authorized) ? __classPrivateFieldGet(this, _Client_lastGetMe, "f") : await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getMe).call(this);
267
- const context = {
268
- ...update,
269
- client: this,
270
- me: (me == null ? undefined : me),
271
- msg: msg,
272
- chat: chat,
273
- from: from,
274
- get toJSON() {
275
- return () => update;
276
- },
277
- reply: (text, params) => {
278
- const { chatId, messageId, businessConnectionId } = mustGetMsg();
279
- const replyTo = getReplyTo(params?.quote, chatId, messageId);
280
- return this.sendMessage(chatId, text, { ...params, replyTo, businessConnectionId });
281
- },
282
- replyPoll: (question, options, params) => {
283
- const { chatId, messageId, businessConnectionId } = mustGetMsg();
284
- const replyTo = getReplyTo(params?.quote, chatId, messageId);
285
- return this.sendPoll(chatId, question, options, { ...params, replyTo, businessConnectionId });
286
- },
287
- replyPhoto: (photo, params) => {
288
- const { chatId, messageId, businessConnectionId } = mustGetMsg();
289
- const replyTo = getReplyTo(params?.quote, chatId, messageId);
290
- return this.sendPhoto(chatId, photo, { ...params, replyTo, businessConnectionId });
291
- },
292
- replyMediaGroup: (media, params) => {
293
- const { chatId, messageId, businessConnectionId } = mustGetMsg();
294
- const replyTo = getReplyTo(params?.quote, chatId, messageId);
295
- return this.sendMediaGroup(chatId, media, { ...params, replyTo, businessConnectionId });
296
- },
297
- replyInvoice: (title, description, payload, currency, prices, params) => {
298
- const { chatId, messageId, businessConnectionId } = mustGetMsg();
299
- const replyTo = getReplyTo(params?.quote, chatId, messageId);
300
- return this.sendInvoice(chatId, title, description, payload, currency, prices, { ...params, replyTo, businessConnectionId });
301
- },
302
- replyDocument: (document, params) => {
303
- const { chatId, messageId, businessConnectionId } = mustGetMsg();
304
- const replyTo = getReplyTo(params?.quote, chatId, messageId);
305
- return this.sendDocument(chatId, document, { ...params, replyTo, businessConnectionId });
306
- },
307
- replySticker: (sticker, params) => {
308
- const { chatId, messageId, businessConnectionId } = mustGetMsg();
309
- const replyTo = getReplyTo(params?.quote, chatId, messageId);
310
- return this.sendSticker(chatId, sticker, { ...params, replyTo, businessConnectionId });
311
- },
312
- replyContact: (firstName, number, params) => {
313
- const { chatId, messageId, businessConnectionId } = mustGetMsg();
314
- const replyTo = getReplyTo(params?.quote, chatId, messageId);
315
- return this.sendContact(chatId, firstName, number, { ...params, replyTo, businessConnectionId });
316
- },
317
- replyLocation: (latitude, longitude, params) => {
318
- const { chatId, messageId, businessConnectionId } = mustGetMsg();
319
- const replyTo = getReplyTo(params?.quote, chatId, messageId);
320
- return this.sendLocation(chatId, latitude, longitude, { ...params, replyTo, businessConnectionId });
321
- },
322
- replyDice: (params) => {
323
- const { chatId, messageId, businessConnectionId } = mustGetMsg();
324
- const replyTo = getReplyTo(params?.quote, chatId, messageId);
325
- return this.sendDice(chatId, { ...params, replyTo, businessConnectionId });
326
- },
327
- replyVenue: (latitude, longitude, title, address, params) => {
328
- const { chatId, messageId, businessConnectionId } = mustGetMsg();
329
- const replyTo = getReplyTo(params?.quote, chatId, messageId);
330
- return this.sendVenue(chatId, latitude, longitude, title, address, { ...params, replyTo, businessConnectionId });
331
- },
332
- replyVideo: (video, params) => {
333
- const { chatId, messageId, businessConnectionId } = mustGetMsg();
334
- const replyTo = getReplyTo(params?.quote, chatId, messageId);
335
- return this.sendVideo(chatId, video, { ...params, replyTo, businessConnectionId });
336
- },
337
- replyAnimation: (document, params) => {
338
- const { chatId, messageId, businessConnectionId } = mustGetMsg();
339
- const replyTo = getReplyTo(params?.quote, chatId, messageId);
340
- return this.sendAnimation(chatId, document, { ...params, replyTo, businessConnectionId });
341
- },
342
- replyVoice: (document, params) => {
343
- const { chatId, messageId, businessConnectionId } = mustGetMsg();
344
- const replyTo = getReplyTo(params?.quote, chatId, messageId);
345
- return this.sendVoice(chatId, document, { ...params, replyTo, businessConnectionId });
346
- },
347
- replyAudio: (document, params) => {
348
- const { chatId, messageId, businessConnectionId } = mustGetMsg();
349
- const replyTo = getReplyTo(params?.quote, chatId, messageId);
350
- return this.sendAudio(chatId, document, { ...params, replyTo, businessConnectionId });
351
- },
352
- replyVideoNote: (videoNote, params) => {
353
- const { chatId, messageId, businessConnectionId } = mustGetMsg();
354
- const replyTo = getReplyTo(params?.quote, chatId, messageId);
355
- return this.sendVideoNote(chatId, videoNote, { ...params, replyTo, businessConnectionId });
356
- },
357
- delete: () => {
358
- const { chatId, messageId } = mustGetMsg();
359
- return this.deleteMessage(chatId, messageId);
360
- },
361
- forward: (to, params) => {
362
- const { chatId, messageId } = mustGetMsg();
363
- return this.forwardMessage(chatId, to, messageId, params);
364
- },
365
- pin: (params) => {
366
- const { chatId, messageId, businessConnectionId } = mustGetMsg();
367
- return this.pinMessage(chatId, messageId, { ...params, businessConnectionId });
368
- },
369
- unpin: () => {
370
- const { chatId, messageId, businessConnectionId } = mustGetMsg();
371
- return this.unpinMessage(chatId, messageId, { businessConnectionId });
372
- },
373
- banSender: (params) => {
374
- const { chatId, senderId } = mustGetMsg();
375
- if (!senderId) {
376
- (0, _0_deps_js_1.unreachable)();
377
- }
378
- return this.banChatMember(chatId, senderId, params);
379
- },
380
- kickSender: () => {
381
- const { chatId, senderId } = mustGetMsg();
382
- if (!senderId) {
383
- (0, _0_deps_js_1.unreachable)();
384
- }
385
- return this.kickChatMember(chatId, senderId);
386
- },
387
- setSenderRights: (params) => {
388
- const { chatId, senderId } = mustGetMsg();
389
- if (!senderId) {
390
- (0, _0_deps_js_1.unreachable)();
391
- }
392
- return this.setChatMemberRights(chatId, senderId, params);
393
- },
394
- getChatAdministrators: () => {
395
- const { chatId } = mustGetMsg();
396
- return this.getChatAdministrators(chatId);
397
- },
398
- react: (reactions, params) => {
399
- const { chatId, messageId } = mustGetMsg();
400
- return this.setReactions(chatId, messageId, reactions, params);
401
- },
402
- answerCallbackQuery: (params) => {
403
- if (!("callbackQuery" in update)) {
404
- (0, _0_deps_js_1.unreachable)();
405
- }
406
- return this.answerCallbackQuery(update.callbackQuery.id, params);
407
- },
408
- answerInlineQuery: (results, params) => {
409
- if (!("inlineQuery" in update)) {
410
- (0, _0_deps_js_1.unreachable)();
411
- }
412
- return this.answerInlineQuery(update.inlineQuery.id, results, params);
413
- },
414
- sendChatAction: (chatAction, params) => {
415
- const { chatId } = mustGetMsg();
416
- return this.sendChatAction(chatId, chatAction, params);
417
- },
418
- editInlineMessageText: (text, params) => {
419
- const inlineMessageId = mustGetInlineMsgId();
420
- return this.editInlineMessageText(inlineMessageId, text, params);
421
- },
422
- editInlineMessageMedia: (media, params) => {
423
- const inlineMessageId = mustGetInlineMsgId();
424
- return this.editInlineMessageMedia(inlineMessageId, media, params);
425
- },
426
- editInlineMessageCaption: (params) => {
427
- const inlineMessageId = mustGetInlineMsgId();
428
- return this.editInlineMessageCaption(inlineMessageId, params);
429
- },
430
- editInlineMessageLiveLocation: (latitude, longitude, params) => {
431
- const inlineMessageId = mustGetInlineMsgId();
432
- return this.editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, params);
433
- },
434
- editInlineMessageReplyMarkup: (params) => {
435
- const inlineMessageId = mustGetInlineMsgId();
436
- return this.editInlineMessageReplyMarkup(inlineMessageId, params);
437
- },
438
- editMessageText: (messageId, text, params) => {
439
- const { chatId } = mustGetMsg();
440
- return this.editMessageText(chatId, messageId, text, params);
441
- },
442
- editMessageCaption: (messageId, params) => {
443
- const { chatId } = mustGetMsg();
444
- return this.editMessageCaption(chatId, messageId, params);
445
- },
446
- editMessageMedia: (messageId, media, params) => {
447
- const { chatId } = mustGetMsg();
448
- return this.editMessageMedia(chatId, messageId, media, params);
449
- },
450
- editMessageLiveLocation: (messageId, latitude, longitude, params) => {
451
- const { chatId } = mustGetMsg();
452
- return this.editMessageLiveLocation(chatId, messageId, latitude, longitude, params);
453
- },
454
- editMessageReplyMarkup: (messageId, params) => {
455
- const { chatId } = mustGetMsg();
456
- return this.editMessageReplyMarkup(chatId, messageId, params);
457
- },
458
- getMessage: (messageId) => {
459
- const { chatId } = mustGetMsg();
460
- return this.getMessage(chatId, messageId);
461
- },
462
- getMessages: (messageIds) => {
463
- const { chatId } = mustGetMsg();
464
- return this.getMessages(chatId, messageIds);
465
- },
466
- forwardMessage: (to, messageId, params) => {
467
- const { chatId } = mustGetMsg();
468
- return this.forwardMessage(chatId, to, messageId, params);
469
- },
470
- forwardMessages: (to, messageIds, params) => {
471
- const { chatId } = mustGetMsg();
472
- return this.forwardMessages(chatId, to, messageIds, params);
473
- },
474
- deleteMessage: (messageId, params) => {
475
- const { chatId } = mustGetMsg();
476
- return this.deleteMessage(chatId, messageId, params);
477
- },
478
- deleteMessages: (messageIds, params) => {
479
- const { chatId } = mustGetMsg();
480
- return this.deleteMessages(chatId, messageIds, params);
481
- },
482
- pinMessage: (messageId, params) => {
483
- const { chatId } = mustGetMsg();
484
- return this.pinMessage(chatId, messageId, params);
485
- },
486
- unpinMessage: (messageId) => {
487
- const { chatId } = mustGetMsg();
488
- return this.unpinMessage(chatId, messageId);
489
- },
490
- unpinMessages: () => {
491
- const { chatId } = mustGetMsg();
492
- return this.unpinMessages(chatId);
493
- },
494
- setAvailableReactions: (availableReactions) => {
495
- const { chatId } = mustGetMsg();
496
- return this.setAvailableReactions(chatId, availableReactions);
497
- },
498
- addReaction: (messageId, reaction, params) => {
499
- const { chatId } = mustGetMsg();
500
- return this.addReaction(chatId, messageId, reaction, params);
501
- },
502
- removeReaction: (messageId, reaction) => {
503
- const { chatId } = mustGetMsg();
504
- return this.removeReaction(chatId, messageId, reaction);
505
- },
506
- setReactions: (messageId, reactions, params) => {
507
- const { chatId } = mustGetMsg();
508
- return this.setReactions(chatId, messageId, reactions, params);
509
- },
510
- read: () => {
511
- const { chatId, messageId } = mustGetMsg();
512
- return this.readMessages(chatId, messageId);
513
- },
514
- setChatPhoto: (photo, params) => {
515
- const { chatId } = mustGetMsg();
516
- return this.setChatPhoto(chatId, photo, params);
517
- },
518
- deleteChatPhoto: () => {
519
- const { chatId } = mustGetMsg();
520
- return this.deleteChatPhoto(chatId);
521
- },
522
- banChatMember: (memberId, params) => {
523
- const { chatId } = mustGetMsg();
524
- return this.banChatMember(chatId, memberId, params);
525
- },
526
- unbanChatMember: (memberId) => {
527
- const { chatId } = mustGetMsg();
528
- return this.unbanChatMember(chatId, memberId);
529
- },
530
- kickChatMember: (memberId) => {
531
- const { chatId } = mustGetMsg();
532
- return this.kickChatMember(chatId, memberId);
533
- },
534
- setChatMemberRights: (memberId, params) => {
535
- const { chatId } = mustGetMsg();
536
- return this.setChatMemberRights(chatId, memberId, params);
537
- },
538
- deleteChatMemberMessages: (userId) => {
539
- const { chatId } = mustGetMsg();
540
- return this.deleteChatMemberMessages(chatId, userId);
541
- },
542
- searchMessages: (query, params) => {
543
- const { chatId } = mustGetMsg();
544
- return this.searchMessages(chatId, query, params);
545
- },
546
- setBoostsRequiredToCircumventRestrictions: (boosts) => {
547
- const { chatId } = mustGetMsg();
548
- return this.setBoostsRequiredToCircumventRestrictions(chatId, boosts);
549
- },
550
- createInviteLink: (params) => {
551
- const { chatId } = mustGetMsg();
552
- return this.createInviteLink(chatId, params);
553
- },
554
- getCreatedInviteLinks: (params) => {
555
- const { chatId } = mustGetMsg();
556
- return this.getCreatedInviteLinks(chatId, params);
557
- },
558
- leave: () => {
559
- const { chatId } = mustGetMsg();
560
- return this.leaveChat(chatId);
561
- },
562
- block: () => {
563
- return this.blockUser(mustGetUserId());
564
- },
565
- unblock: () => {
566
- return this.unblockUser(mustGetUserId());
567
- },
568
- getChatMember: (userId) => {
569
- const { chatId } = mustGetMsg();
570
- return this.getChatMember(chatId, userId);
571
- },
572
- getChatMembers: (params) => {
573
- const { chatId } = mustGetMsg();
574
- return this.getChatMembers(chatId, params);
575
- },
576
- setChatStickerSet: (setName) => {
577
- const { chatId } = mustGetMsg();
578
- return this.setChatStickerSet(chatId, setName);
579
- },
580
- deleteChatStickerSet: () => {
581
- const { chatId } = mustGetMsg();
582
- return this.deleteChatStickerSet(chatId);
583
- },
584
- getBusinessConnection: () => {
585
- const { businessConnectionId } = mustGetMsg();
586
- if (!businessConnectionId) {
587
- (0, _0_deps_js_1.unreachable)();
588
- }
589
- return this.getBusinessConnection(businessConnectionId);
590
- },
591
- answerPreCheckoutQuery: (ok, params) => {
592
- if (!("preCheckoutQuery" in update)) {
593
- (0, _0_deps_js_1.unreachable)();
594
- }
595
- return this.answerPreCheckoutQuery(update.preCheckoutQuery.id, ok, params);
596
- },
597
- approveJoinRequest: () => {
598
- const { chatId, userId } = mustGetMsg();
599
- if (!userId) {
600
- (0, _0_deps_js_1.unreachable)();
601
- }
602
- return this.approveJoinRequest(chatId, userId);
603
- },
604
- declineJoinRequest: () => {
605
- const { chatId, userId } = mustGetMsg();
606
- if (!userId) {
607
- (0, _0_deps_js_1.unreachable)();
608
- }
609
- return this.declineJoinRequest(chatId, userId);
610
- },
611
- };
612
- return (0, _1_utilities_js_1.cleanObject)(context);
613
- });
614
- _Client_lastPropagatedConnectionState.set(this, null);
615
- _Client_stateChangeHandler.set(this, ((connected) => {
616
- const connectionState = connected ? "ready" : "notConnected";
617
- if (__classPrivateFieldGet(this, _Client_lastPropagatedConnectionState, "f") != connectionState) {
618
- __classPrivateFieldGet(this, _Client_instances, "m", _Client_propagateConnectionState).call(this, connectionState);
619
- }
620
- }).bind(this));
621
- _Client_storageInited.set(this, false);
622
- _Client_connectMutex.set(this, new _1_utilities_js_1.Mutex());
623
- _Client_lastPropagatedAuthorizationState.set(this, null);
624
- _Client_lastUpdates.set(this, new Date());
625
- _Client_updateGapRecoveryLoopAbortController.set(this, void 0);
626
- _Client_clientDisconnectionLoopAbortController.set(this, void 0);
627
- _Client_getMainClientMutex.set(this, new _1_utilities_js_1.Mutex());
628
- _Client_handleInvokeError.set(this, skipInvoke());
629
- /**
630
- * Invokes a function waiting and returning its reply if the second parameter is not `true`. Requires the client
631
- * to be connected.
632
- *
633
- * @param function_ The function to invoke.
634
- */
635
- Object.defineProperty(this, "invoke", {
636
- enumerable: true,
637
- configurable: true,
638
- writable: true,
639
- value: Object.assign(__classPrivateFieldGet(this, _Client_instances, "m", _Client_invoke), {
640
- use: (handler) => {
641
- const handle = __classPrivateFieldGet(this, _Client_handleInvokeError, "f");
642
- __classPrivateFieldSet(this, _Client_handleInvokeError, async (ctx, next) => {
643
- let result = null;
644
- return await handle(ctx, async () => {
645
- if (result != null)
646
- return result;
647
- result = await handler(ctx, next);
648
- return result;
649
- });
650
- }, "f");
651
- },
652
- })
653
- });
654
- _Client_authStringImported.set(this, false);
655
- _Client_lastGetMe.set(this, null);
656
- _Client_previouslyConnected.set(this, false);
657
- _Client_lastConnectionState.set(this, false);
658
- __classPrivateFieldSet(this, _Client_apiId, params?.apiId ?? 0, "f");
659
- __classPrivateFieldSet(this, _Client_apiHash, params?.apiHash ?? "", "f");
660
- __classPrivateFieldSet(this, _Client_transportProvider, params?.transportProvider, "f");
661
- __classPrivateFieldSet(this, _Client_initialDc, params?.initialDc ?? _4_constants_js_1.INITIAL_DC, "f");
662
- __classPrivateFieldSet(this, _Client_storage_, params?.storage || new _2_storage_js_1.StorageMemory(), "f");
663
- __classPrivateFieldSet(this, _Client_persistCache, params?.persistCache ?? false, "f");
664
- if (!__classPrivateFieldGet(this, _Client_persistCache, "f")) {
665
- __classPrivateFieldSet(this, _Client_messageStorage_, new _2_storage_js_1.StorageMemory(), "f");
161
+ this.#apiId = params?.apiId ?? 0;
162
+ this.#apiHash = params?.apiHash ?? "";
163
+ this.#transportProvider = params?.transportProvider;
164
+ this.#initialDc = params?.initialDc ?? _4_constants_js_1.INITIAL_DC;
165
+ this.#storage_ = params?.storage || new _2_storage_js_1.StorageMemory();
166
+ this.#persistCache = params?.persistCache ?? false;
167
+ if (!this.#persistCache) {
168
+ this.#messageStorage_ = new _2_storage_js_1.StorageMemory();
666
169
  }
667
170
  else {
668
- __classPrivateFieldSet(this, _Client_messageStorage_, __classPrivateFieldGet(this, _Client_storage_, "f"), "f");
171
+ this.#messageStorage_ = this.#storage_;
669
172
  }
670
- this.storage = new _0_storage_operations_js_1.StorageOperations(__classPrivateFieldGet(this, _Client_storage_, "f"));
671
- this.messageStorage = new _0_storage_operations_js_1.StorageOperations(__classPrivateFieldGet(this, _Client_messageStorage_, "f"));
672
- __classPrivateFieldSet(this, _Client_parseMode, params?.parseMode ?? null, "f");
673
- __classPrivateFieldSet(this, _Client_disableUpdates, params?.disableUpdates ?? false, "f");
674
- __classPrivateFieldSet(this, _Client_authString, params?.authString, "f");
173
+ this.storage = new _0_storage_operations_js_1.StorageOperations(this.#storage_);
174
+ this.messageStorage = new _0_storage_operations_js_1.StorageOperations(this.#messageStorage_);
175
+ this.#parseMode = params?.parseMode ?? null;
176
+ this.#disableUpdates = params?.disableUpdates ?? false;
177
+ this.#authString = params?.authString;
675
178
  this.appVersion = params?.appVersion ?? _4_constants_js_1.APP_VERSION;
676
179
  this.deviceModel = params?.deviceModel ?? _4_constants_js_1.DEVICE_MODEL;
677
180
  this.language = params?.language ?? _4_constants_js_1.LANG_CODE;
678
181
  this.platform = params?.platform ?? _4_constants_js_1.LANG_PACK;
679
182
  this.systemLangCode = params?.systemLangCode ?? _4_constants_js_1.SYSTEM_LANG_CODE;
680
183
  this.systemVersion = params?.systemVersion ?? _4_constants_js_1.SYSTEM_VERSION;
681
- __classPrivateFieldSet(this, _Client_publicKeys, params?.publicKeys, "f");
682
- __classPrivateFieldSet(this, _Client_outgoingMessages, params?.outgoingMessages ?? null, "f");
184
+ this.#publicKeys = params?.publicKeys;
185
+ this.#outgoingMessages = params?.outgoingMessages ?? null;
683
186
  if (params?.prefixes) {
684
187
  this.prefixes = params?.prefixes;
685
188
  }
686
- __classPrivateFieldSet(this, _Client_guaranteeUpdateDelivery, params?.guaranteeUpdateDelivery ?? false, "f");
687
- const L = __classPrivateFieldSet(this, _Client_L, (0, _1_utilities_js_1.getLogger)("Client").client(id++), "f");
688
- __classPrivateFieldSet(this, _Client_LsignIn, L.branch("signIn"), "f");
689
- __classPrivateFieldSet(this, _Client_LupdateGapRecoveryLoop, L.branch("updateGapRecoveryLoop"), "f");
690
- __classPrivateFieldSet(this, _Client_LhandleMigrationError, L.branch("[handleMigrationError]"), "f");
691
- __classPrivateFieldSet(this, _Client_Lmin, L.branch("min"), "f");
189
+ this.#guaranteeUpdateDelivery = params?.guaranteeUpdateDelivery ?? false;
190
+ const L = this.#L = (0, _1_utilities_js_1.getLogger)("Client").client(id++);
191
+ this.#LsignIn = L.branch("signIn");
192
+ this.#LupdateGapRecoveryLoop = L.branch("updateGapRecoveryLoop");
193
+ this.#LhandleMigrationError = L.branch("[handleMigrationError]");
194
+ this.#Lmin = L.branch("min");
692
195
  const c = {
693
196
  id,
694
- getUploadPoolSize: __classPrivateFieldGet(this, _Client_instances, "m", _Client_getUploadPoolSize).bind(this),
197
+ getUploadPoolSize: this.#getUploadPoolSize.bind(this),
695
198
  invoke: async (function_, params) => {
696
199
  if (params?.businessConnectionId) {
697
200
  if (_2_tl_js_1.Mtproto.is("ping", function_)) {
@@ -705,48 +208,48 @@ class Client extends Composer {
705
208
  },
706
209
  storage: this.storage,
707
210
  messageStorage: this.messageStorage,
708
- guaranteeUpdateDelivery: __classPrivateFieldGet(this, _Client_guaranteeUpdateDelivery, "f"),
709
- setConnectionState: __classPrivateFieldGet(this, _Client_instances, "m", _Client_propagateConnectionState).bind(this),
710
- resetConnectionState: () => __classPrivateFieldGet(this, _Client_stateChangeHandler, "f").call(this, this.connected),
711
- getSelfId: __classPrivateFieldGet(this, _Client_instances, "m", _Client_getSelfId).bind(this),
712
- getIsPremium: __classPrivateFieldGet(this, _Client_instances, "m", _Client_getIsPremium).bind(this),
211
+ guaranteeUpdateDelivery: this.#guaranteeUpdateDelivery,
212
+ setConnectionState: this.#propagateConnectionState.bind(this),
213
+ resetConnectionState: () => this.#stateChangeHandler(this.connected),
214
+ getSelfId: this.#getSelfId.bind(this),
215
+ getIsPremium: this.#getIsPremium.bind(this),
713
216
  getInputPeer: this.getInputPeer.bind(this),
714
217
  getInputChannel: this.getInputChannel.bind(this),
715
218
  getInputUser: this.getInputUser.bind(this),
716
- getInputPeerChatId: __classPrivateFieldGet(this, _Client_instances, "m", _Client_getInputPeerChatId).bind(this),
219
+ getInputPeerChatId: this.#getInputPeerChatId.bind(this),
717
220
  getEntity: this[getEntity].bind(this),
718
- handleUpdate: __classPrivateFieldGet(this, _Client_instances, "m", _Client_queueHandleCtxUpdate).bind(this),
719
- parseMode: __classPrivateFieldGet(this, _Client_parseMode, "f"),
720
- outgoingMessages: __classPrivateFieldGet(this, _Client_outgoingMessages, "f"),
221
+ handleUpdate: this.#queueHandleCtxUpdate.bind(this),
222
+ parseMode: this.#parseMode,
223
+ outgoingMessages: this.#outgoingMessages,
721
224
  dropPendingUpdates: params?.dropPendingUpdates,
722
225
  disconnected: () => this.disconnected,
723
226
  langPack: this.platform,
724
227
  langCode: this.language,
725
228
  };
726
229
  // 2_
727
- __classPrivateFieldSet(this, _Client_accountManager, new _2_account_manager_js_1.AccountManager(c), "f");
728
- __classPrivateFieldSet(this, _Client_botInfoManager, new _2_bot_info_manager_js_1.BotInfoManager(c), "f");
729
- __classPrivateFieldSet(this, _Client_businessConnectionManager, new _2_business_connection_manager_js_1.BusinessConnectionManager(c), "f");
730
- const fileManager = __classPrivateFieldSet(this, _Client_fileManager, new _2_file_manager_js_1.FileManager(c), "f");
731
- __classPrivateFieldSet(this, _Client_networkStatisticsManager, new _2_network_statistics_manager_js_1.NetworkStatisticsManager(c), "f");
732
- __classPrivateFieldSet(this, _Client_paymentManager, new _2_payment_manager_js_1.PaymentManager(c), "f");
733
- __classPrivateFieldSet(this, _Client_reactionManager, new _2_reaction_manager_js_1.ReactionManager(c), "f");
734
- __classPrivateFieldSet(this, _Client_translationsManager, new _2_translations_manager_js_1.TranslationsManager(c), "f");
735
- __classPrivateFieldSet(this, _Client_updateManager, new _2_update_manager_js_1.UpdateManager(c), "f");
230
+ this.#accountManager = new _2_account_manager_js_1.AccountManager(c);
231
+ this.#botInfoManager = new _2_bot_info_manager_js_1.BotInfoManager(c);
232
+ this.#businessConnectionManager = new _2_business_connection_manager_js_1.BusinessConnectionManager(c);
233
+ const fileManager = this.#fileManager = new _2_file_manager_js_1.FileManager(c);
234
+ this.#networkStatisticsManager = new _2_network_statistics_manager_js_1.NetworkStatisticsManager(c);
235
+ this.#paymentManager = new _2_payment_manager_js_1.PaymentManager(c);
236
+ this.#reactionManager = new _2_reaction_manager_js_1.ReactionManager(c);
237
+ this.#translationsManager = new _2_translations_manager_js_1.TranslationsManager(c);
238
+ this.#updateManager = new _2_update_manager_js_1.UpdateManager(c);
736
239
  // 3_
737
- const messageManager = __classPrivateFieldSet(this, _Client_messageManager, new _3_message_manager_js_1.MessageManager({ ...c, fileManager }), "f");
738
- __classPrivateFieldSet(this, _Client_videoChatManager, new _3_video_chat_manager_js_1.VideoChatManager({ ...c, fileManager }), "f");
240
+ const messageManager = this.#messageManager = new _3_message_manager_js_1.MessageManager({ ...c, fileManager });
241
+ this.#videoChatManager = new _3_video_chat_manager_js_1.VideoChatManager({ ...c, fileManager });
739
242
  // 4_
740
- __classPrivateFieldSet(this, _Client_callbackQueryManager, new _4_callback_query_manager_js_1.CallbackQueryManager({ ...c, messageManager }), "f");
741
- __classPrivateFieldSet(this, _Client_chatListManager, new _4_chat_list_manager_js_1.ChatListManager({ ...c, fileManager, messageManager }), "f");
742
- __classPrivateFieldSet(this, _Client_chatManager, new _4_chat_manager_js_1.ChatManager({ ...c, fileManager, messageManager }), "f");
743
- __classPrivateFieldSet(this, _Client_forumManager, new _4_forum_manager_js_1.ForumManager({ ...c, messageManager }), "f");
744
- __classPrivateFieldSet(this, _Client_giftManager, new _4_gift_manager_js_1.GiftManager({ ...c, messageManager }), "f");
745
- __classPrivateFieldSet(this, _Client_inlineQueryManager, new _4_inline_query_manager_js_1.InlineQueryManager({ ...c, messageManager }), "f");
746
- __classPrivateFieldSet(this, _Client_linkPreviewManager, new _4_link_preview_manager_js_1.LinkPreviewManager({ ...c, messageManager }), "f");
747
- __classPrivateFieldSet(this, _Client_pollManager, new _4_poll_manager_js_1.PollManager({ ...c, messageManager }), "f");
748
- __classPrivateFieldSet(this, _Client_storyManager, new _4_story_manager_js_1.StoryManager({ ...c, fileManager, messageManager }), "f");
749
- __classPrivateFieldGet(this, _Client_updateManager, "f").setUpdateHandler(__classPrivateFieldGet(this, _Client_instances, "m", _Client_handleUpdate).bind(this));
243
+ this.#callbackQueryManager = new _4_callback_query_manager_js_1.CallbackQueryManager({ ...c, messageManager });
244
+ this.#chatListManager = new _4_chat_list_manager_js_1.ChatListManager({ ...c, fileManager, messageManager });
245
+ this.#chatManager = new _4_chat_manager_js_1.ChatManager({ ...c, fileManager, messageManager });
246
+ this.#forumManager = new _4_forum_manager_js_1.ForumManager({ ...c, messageManager });
247
+ this.#giftManager = new _4_gift_manager_js_1.GiftManager({ ...c, messageManager });
248
+ this.#inlineQueryManager = new _4_inline_query_manager_js_1.InlineQueryManager({ ...c, messageManager });
249
+ this.#linkPreviewManager = new _4_link_preview_manager_js_1.LinkPreviewManager({ ...c, messageManager });
250
+ this.#pollManager = new _4_poll_manager_js_1.PollManager({ ...c, messageManager });
251
+ this.#storyManager = new _4_story_manager_js_1.StoryManager({ ...c, fileManager, messageManager });
252
+ this.#updateManager.setUpdateHandler(this.#handleUpdate.bind(this));
750
253
  if (params?.defaultHandlers ?? true) {
751
254
  this.invoke.use(async ({ error }, next) => {
752
255
  if (error instanceof _4_errors_js_1.FloodWait && error.seconds <= 10) {
@@ -760,123 +263,624 @@ class Client extends Composer {
760
263
  });
761
264
  }
762
265
  }
266
+ #setMainClient(client) {
267
+ this.#disconnectAllClients();
268
+ this.#clients = [client];
269
+ client.handlers.onUpdate = (updates) => {
270
+ this.#updateManager.processUpdates(updates, true, null);
271
+ this.#lastUpdates = new Date();
272
+ };
273
+ client.handlers.onDeserializationError = async () => {
274
+ await this.#updateManager.recoverUpdateGap("deserialization error");
275
+ };
276
+ client.handlers.onNewServerSalt = async (serverSalt) => {
277
+ await this.storage.setServerSalt(serverSalt);
278
+ };
279
+ client.onConnectionStateChange = this.#onConnectionStateChange.bind(this);
280
+ }
281
+ #newClient(dc, main, cdn) {
282
+ const client = new _2_client_encrypted_js_1.ClientEncrypted(dc, this.#apiId, {
283
+ appVersion: this.appVersion,
284
+ deviceModel: this.deviceModel,
285
+ langCode: this.language,
286
+ langPack: this.platform,
287
+ systemLangCode: this.systemLangCode,
288
+ systemVersion: this.systemVersion,
289
+ transportProvider: this.#transportProvider,
290
+ cdn,
291
+ disableUpdates: !main || cdn,
292
+ publicKeys: this.#publicKeys,
293
+ });
294
+ client.connectionCallback = this.#networkStatisticsManager.getTransportReadWriteCallback(cdn);
295
+ return client;
296
+ }
297
+ #disconnectAllClients() {
298
+ for (const client of this.#clients) {
299
+ client.disconnect();
300
+ }
301
+ for (const pool of Object.values(this.#downloadPools)) {
302
+ pool.disconnect();
303
+ }
304
+ for (const pool of Object.values(this.#uploadPools)) {
305
+ pool.disconnect();
306
+ }
307
+ }
308
+ get #client() {
309
+ return this.#clients[0];
310
+ }
763
311
  // direct ClientEncrypted property proxies
764
312
  get connected() {
765
- return __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get)?.connected ?? false;
313
+ return this.#client?.connected ?? false;
766
314
  }
767
315
  get disconnected() {
768
- return __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get)?.disconnected ?? true;
316
+ return this.#client?.disconnected ?? true;
317
+ }
318
+ #constructContext = async (update) => {
319
+ const msg = "message" in update ? update.message : "editedMessage" in update ? update.editedMessage : "scheduledMessage" in update ? update.scheduledMessage : "callbackQuery" in update ? update.callbackQuery.message : undefined;
320
+ const reactions = "messageInteractions" in update ? update.messageInteractions : undefined;
321
+ const mustGetMsg = () => {
322
+ if (msg !== undefined) {
323
+ return { chatId: msg.chat.id, messageId: msg.id, businessConnectionId: msg.businessConnectionId, senderId: msg.from?.id, userId: msg.from?.id };
324
+ }
325
+ else if (reactions !== undefined) {
326
+ return { chatId: reactions.chatId, messageId: reactions.messageId };
327
+ }
328
+ else {
329
+ (0, _0_deps_js_1.unreachable)();
330
+ }
331
+ };
332
+ const mustGetUserId = () => {
333
+ if (msg?.from) {
334
+ return msg.from.id;
335
+ }
336
+ else if ("callbackQuery" in update) {
337
+ return update.callbackQuery.from.id;
338
+ }
339
+ else if ("chosenInlineResult" in update) {
340
+ return update.chosenInlineResult.from.id;
341
+ }
342
+ else {
343
+ (0, _0_deps_js_1.unreachable)();
344
+ }
345
+ };
346
+ const mustGetInlineMsgId = () => {
347
+ if ("chosenInlineResult" in update) {
348
+ if (update.chosenInlineResult.inlineMessageId) {
349
+ return update.chosenInlineResult.inlineMessageId;
350
+ }
351
+ }
352
+ else if ("callbackQuery" in update) {
353
+ if (update.callbackQuery.inlineMessageId) {
354
+ return update.callbackQuery.inlineMessageId;
355
+ }
356
+ }
357
+ (0, _0_deps_js_1.unreachable)();
358
+ };
359
+ const chat_ = "messageReactions" in update ? update.messageReactions.chat : "messageReactionCount" in update ? update.messageReactionCount.chat : "chatMember" in update ? update.chatMember.chat : "myChatMember" in update ? update.myChatMember.chat : "joinRequest" in update ? update.joinRequest.chat : "story" in update ? update.story.chat : undefined;
360
+ const chat = chat_ ?? msg?.chat;
361
+ const from = "callbackQuery" in update ? update.callbackQuery.from : "inlineQuery" in update ? update.inlineQuery.from : "chatMember" in update ? update.chatMember.from : "myChatMember" in update ? update.myChatMember.from : "messageReactions" in update ? update.messageReactions.user : "preCheckoutQuery" in update ? update.preCheckoutQuery.from : "joinRequest" in update ? update.joinRequest.from : "businessConnection" in update ? update.businessConnection.user : "pollAnswer" in update ? update.pollAnswer.from : msg?.from ? msg.from : undefined;
362
+ const getReplyTo = (quote, chatId, messageId) => {
363
+ if ("story" in update) {
364
+ return { chatId: update.story.chat.id, storyId: update.story.id };
365
+ }
366
+ const isPrivate = chatId > 0;
367
+ const shouldQuote = quote === undefined ? !isPrivate : quote;
368
+ return shouldQuote ? { messageId } : undefined;
369
+ };
370
+ const me = "connectionState" in update ? this.#lastGetMe : ("authorizationState" in update && !update.authorizationState.authorized) ? this.#lastGetMe : await this.#getMe();
371
+ const context = {
372
+ ...update,
373
+ client: this,
374
+ me: (me === null ? undefined : me),
375
+ msg: msg,
376
+ chat: chat,
377
+ from: from,
378
+ get toJSON() {
379
+ return () => update;
380
+ },
381
+ reply: (text, params) => {
382
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
383
+ const replyTo = getReplyTo(params?.quote, chatId, messageId);
384
+ return this.sendMessage(chatId, text, { ...params, replyTo, businessConnectionId });
385
+ },
386
+ replyPoll: (question, options, params) => {
387
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
388
+ const replyTo = getReplyTo(params?.quote, chatId, messageId);
389
+ return this.sendPoll(chatId, question, options, { ...params, replyTo, businessConnectionId });
390
+ },
391
+ replyPhoto: (photo, params) => {
392
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
393
+ const replyTo = getReplyTo(params?.quote, chatId, messageId);
394
+ return this.sendPhoto(chatId, photo, { ...params, replyTo, businessConnectionId });
395
+ },
396
+ replyMediaGroup: (media, params) => {
397
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
398
+ const replyTo = getReplyTo(params?.quote, chatId, messageId);
399
+ return this.sendMediaGroup(chatId, media, { ...params, replyTo, businessConnectionId });
400
+ },
401
+ replyInvoice: (title, description, payload, currency, prices, params) => {
402
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
403
+ const replyTo = getReplyTo(params?.quote, chatId, messageId);
404
+ return this.sendInvoice(chatId, title, description, payload, currency, prices, { ...params, replyTo, businessConnectionId });
405
+ },
406
+ replyDocument: (document, params) => {
407
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
408
+ const replyTo = getReplyTo(params?.quote, chatId, messageId);
409
+ return this.sendDocument(chatId, document, { ...params, replyTo, businessConnectionId });
410
+ },
411
+ replySticker: (sticker, params) => {
412
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
413
+ const replyTo = getReplyTo(params?.quote, chatId, messageId);
414
+ return this.sendSticker(chatId, sticker, { ...params, replyTo, businessConnectionId });
415
+ },
416
+ replyContact: (firstName, number, params) => {
417
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
418
+ const replyTo = getReplyTo(params?.quote, chatId, messageId);
419
+ return this.sendContact(chatId, firstName, number, { ...params, replyTo, businessConnectionId });
420
+ },
421
+ replyLocation: (latitude, longitude, params) => {
422
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
423
+ const replyTo = getReplyTo(params?.quote, chatId, messageId);
424
+ return this.sendLocation(chatId, latitude, longitude, { ...params, replyTo, businessConnectionId });
425
+ },
426
+ replyDice: (params) => {
427
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
428
+ const replyTo = getReplyTo(params?.quote, chatId, messageId);
429
+ return this.sendDice(chatId, { ...params, replyTo, businessConnectionId });
430
+ },
431
+ replyVenue: (latitude, longitude, title, address, params) => {
432
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
433
+ const replyTo = getReplyTo(params?.quote, chatId, messageId);
434
+ return this.sendVenue(chatId, latitude, longitude, title, address, { ...params, replyTo, businessConnectionId });
435
+ },
436
+ replyVideo: (video, params) => {
437
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
438
+ const replyTo = getReplyTo(params?.quote, chatId, messageId);
439
+ return this.sendVideo(chatId, video, { ...params, replyTo, businessConnectionId });
440
+ },
441
+ replyAnimation: (document, params) => {
442
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
443
+ const replyTo = getReplyTo(params?.quote, chatId, messageId);
444
+ return this.sendAnimation(chatId, document, { ...params, replyTo, businessConnectionId });
445
+ },
446
+ replyVoice: (document, params) => {
447
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
448
+ const replyTo = getReplyTo(params?.quote, chatId, messageId);
449
+ return this.sendVoice(chatId, document, { ...params, replyTo, businessConnectionId });
450
+ },
451
+ replyAudio: (document, params) => {
452
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
453
+ const replyTo = getReplyTo(params?.quote, chatId, messageId);
454
+ return this.sendAudio(chatId, document, { ...params, replyTo, businessConnectionId });
455
+ },
456
+ replyVideoNote: (videoNote, params) => {
457
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
458
+ const replyTo = getReplyTo(params?.quote, chatId, messageId);
459
+ return this.sendVideoNote(chatId, videoNote, { ...params, replyTo, businessConnectionId });
460
+ },
461
+ delete: () => {
462
+ const { chatId, messageId } = mustGetMsg();
463
+ return this.deleteMessage(chatId, messageId);
464
+ },
465
+ forward: (to, params) => {
466
+ const { chatId, messageId } = mustGetMsg();
467
+ return this.forwardMessage(chatId, to, messageId, params);
468
+ },
469
+ pin: (params) => {
470
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
471
+ return this.pinMessage(chatId, messageId, { ...params, businessConnectionId });
472
+ },
473
+ unpin: () => {
474
+ const { chatId, messageId, businessConnectionId } = mustGetMsg();
475
+ return this.unpinMessage(chatId, messageId, { businessConnectionId });
476
+ },
477
+ banSender: (params) => {
478
+ const { chatId, senderId } = mustGetMsg();
479
+ if (!senderId) {
480
+ (0, _0_deps_js_1.unreachable)();
481
+ }
482
+ return this.banChatMember(chatId, senderId, params);
483
+ },
484
+ kickSender: () => {
485
+ const { chatId, senderId } = mustGetMsg();
486
+ if (!senderId) {
487
+ (0, _0_deps_js_1.unreachable)();
488
+ }
489
+ return this.kickChatMember(chatId, senderId);
490
+ },
491
+ setSenderRights: (params) => {
492
+ const { chatId, senderId } = mustGetMsg();
493
+ if (!senderId) {
494
+ (0, _0_deps_js_1.unreachable)();
495
+ }
496
+ return this.setChatMemberRights(chatId, senderId, params);
497
+ },
498
+ getChatAdministrators: () => {
499
+ const { chatId } = mustGetMsg();
500
+ return this.getChatAdministrators(chatId);
501
+ },
502
+ react: (reactions, params) => {
503
+ const { chatId, messageId } = mustGetMsg();
504
+ return this.setReactions(chatId, messageId, reactions, params);
505
+ },
506
+ answerCallbackQuery: (params) => {
507
+ if (!("callbackQuery" in update)) {
508
+ (0, _0_deps_js_1.unreachable)();
509
+ }
510
+ return this.answerCallbackQuery(update.callbackQuery.id, params);
511
+ },
512
+ answerInlineQuery: (results, params) => {
513
+ if (!("inlineQuery" in update)) {
514
+ (0, _0_deps_js_1.unreachable)();
515
+ }
516
+ return this.answerInlineQuery(update.inlineQuery.id, results, params);
517
+ },
518
+ sendChatAction: (chatAction, params) => {
519
+ const { chatId } = mustGetMsg();
520
+ return this.sendChatAction(chatId, chatAction, params);
521
+ },
522
+ editInlineMessageText: (text, params) => {
523
+ const inlineMessageId = mustGetInlineMsgId();
524
+ return this.editInlineMessageText(inlineMessageId, text, params);
525
+ },
526
+ editInlineMessageMedia: (media, params) => {
527
+ const inlineMessageId = mustGetInlineMsgId();
528
+ return this.editInlineMessageMedia(inlineMessageId, media, params);
529
+ },
530
+ editInlineMessageCaption: (params) => {
531
+ const inlineMessageId = mustGetInlineMsgId();
532
+ return this.editInlineMessageCaption(inlineMessageId, params);
533
+ },
534
+ editInlineMessageLiveLocation: (latitude, longitude, params) => {
535
+ const inlineMessageId = mustGetInlineMsgId();
536
+ return this.editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, params);
537
+ },
538
+ editInlineMessageReplyMarkup: (params) => {
539
+ const inlineMessageId = mustGetInlineMsgId();
540
+ return this.editInlineMessageReplyMarkup(inlineMessageId, params);
541
+ },
542
+ editMessageText: (messageId, text, params) => {
543
+ const { chatId } = mustGetMsg();
544
+ return this.editMessageText(chatId, messageId, text, params);
545
+ },
546
+ editMessageCaption: (messageId, params) => {
547
+ const { chatId } = mustGetMsg();
548
+ return this.editMessageCaption(chatId, messageId, params);
549
+ },
550
+ editMessageMedia: (messageId, media, params) => {
551
+ const { chatId } = mustGetMsg();
552
+ return this.editMessageMedia(chatId, messageId, media, params);
553
+ },
554
+ editMessageLiveLocation: (messageId, latitude, longitude, params) => {
555
+ const { chatId } = mustGetMsg();
556
+ return this.editMessageLiveLocation(chatId, messageId, latitude, longitude, params);
557
+ },
558
+ editMessageReplyMarkup: (messageId, params) => {
559
+ const { chatId } = mustGetMsg();
560
+ return this.editMessageReplyMarkup(chatId, messageId, params);
561
+ },
562
+ getMessage: (messageId) => {
563
+ const { chatId } = mustGetMsg();
564
+ return this.getMessage(chatId, messageId);
565
+ },
566
+ getMessages: (messageIds) => {
567
+ const { chatId } = mustGetMsg();
568
+ return this.getMessages(chatId, messageIds);
569
+ },
570
+ forwardMessage: (to, messageId, params) => {
571
+ const { chatId } = mustGetMsg();
572
+ return this.forwardMessage(chatId, to, messageId, params);
573
+ },
574
+ forwardMessages: (to, messageIds, params) => {
575
+ const { chatId } = mustGetMsg();
576
+ return this.forwardMessages(chatId, to, messageIds, params);
577
+ },
578
+ deleteMessage: (messageId, params) => {
579
+ const { chatId } = mustGetMsg();
580
+ return this.deleteMessage(chatId, messageId, params);
581
+ },
582
+ deleteMessages: (messageIds, params) => {
583
+ const { chatId } = mustGetMsg();
584
+ return this.deleteMessages(chatId, messageIds, params);
585
+ },
586
+ pinMessage: (messageId, params) => {
587
+ const { chatId } = mustGetMsg();
588
+ return this.pinMessage(chatId, messageId, params);
589
+ },
590
+ unpinMessage: (messageId) => {
591
+ const { chatId } = mustGetMsg();
592
+ return this.unpinMessage(chatId, messageId);
593
+ },
594
+ unpinMessages: () => {
595
+ const { chatId } = mustGetMsg();
596
+ return this.unpinMessages(chatId);
597
+ },
598
+ setAvailableReactions: (availableReactions) => {
599
+ const { chatId } = mustGetMsg();
600
+ return this.setAvailableReactions(chatId, availableReactions);
601
+ },
602
+ addReaction: (messageId, reaction, params) => {
603
+ const { chatId } = mustGetMsg();
604
+ return this.addReaction(chatId, messageId, reaction, params);
605
+ },
606
+ removeReaction: (messageId, reaction) => {
607
+ const { chatId } = mustGetMsg();
608
+ return this.removeReaction(chatId, messageId, reaction);
609
+ },
610
+ setReactions: (messageId, reactions, params) => {
611
+ const { chatId } = mustGetMsg();
612
+ return this.setReactions(chatId, messageId, reactions, params);
613
+ },
614
+ read: () => {
615
+ const { chatId, messageId } = mustGetMsg();
616
+ return this.readMessages(chatId, messageId);
617
+ },
618
+ setChatPhoto: (photo, params) => {
619
+ const { chatId } = mustGetMsg();
620
+ return this.setChatPhoto(chatId, photo, params);
621
+ },
622
+ deleteChatPhoto: () => {
623
+ const { chatId } = mustGetMsg();
624
+ return this.deleteChatPhoto(chatId);
625
+ },
626
+ banChatMember: (memberId, params) => {
627
+ const { chatId } = mustGetMsg();
628
+ return this.banChatMember(chatId, memberId, params);
629
+ },
630
+ unbanChatMember: (memberId) => {
631
+ const { chatId } = mustGetMsg();
632
+ return this.unbanChatMember(chatId, memberId);
633
+ },
634
+ kickChatMember: (memberId) => {
635
+ const { chatId } = mustGetMsg();
636
+ return this.kickChatMember(chatId, memberId);
637
+ },
638
+ setChatMemberRights: (memberId, params) => {
639
+ const { chatId } = mustGetMsg();
640
+ return this.setChatMemberRights(chatId, memberId, params);
641
+ },
642
+ deleteChatMemberMessages: (userId) => {
643
+ const { chatId } = mustGetMsg();
644
+ return this.deleteChatMemberMessages(chatId, userId);
645
+ },
646
+ searchMessages: (params) => {
647
+ const { chatId } = mustGetMsg();
648
+ params ??= {};
649
+ params.chatId = chatId;
650
+ return this.searchMessages(params);
651
+ },
652
+ setBoostsRequiredToCircumventRestrictions: (boosts) => {
653
+ const { chatId } = mustGetMsg();
654
+ return this.setBoostsRequiredToCircumventRestrictions(chatId, boosts);
655
+ },
656
+ createInviteLink: (params) => {
657
+ const { chatId } = mustGetMsg();
658
+ return this.createInviteLink(chatId, params);
659
+ },
660
+ getCreatedInviteLinks: (params) => {
661
+ const { chatId } = mustGetMsg();
662
+ return this.getCreatedInviteLinks(chatId, params);
663
+ },
664
+ leave: () => {
665
+ const { chatId } = mustGetMsg();
666
+ return this.leaveChat(chatId);
667
+ },
668
+ block: () => {
669
+ return this.blockUser(mustGetUserId());
670
+ },
671
+ unblock: () => {
672
+ return this.unblockUser(mustGetUserId());
673
+ },
674
+ getChatMember: (userId) => {
675
+ const { chatId } = mustGetMsg();
676
+ return this.getChatMember(chatId, userId);
677
+ },
678
+ getChatMembers: (params) => {
679
+ const { chatId } = mustGetMsg();
680
+ return this.getChatMembers(chatId, params);
681
+ },
682
+ setChatStickerSet: (setName) => {
683
+ const { chatId } = mustGetMsg();
684
+ return this.setChatStickerSet(chatId, setName);
685
+ },
686
+ deleteChatStickerSet: () => {
687
+ const { chatId } = mustGetMsg();
688
+ return this.deleteChatStickerSet(chatId);
689
+ },
690
+ getBusinessConnection: () => {
691
+ const { businessConnectionId } = mustGetMsg();
692
+ if (!businessConnectionId) {
693
+ (0, _0_deps_js_1.unreachable)();
694
+ }
695
+ return this.getBusinessConnection(businessConnectionId);
696
+ },
697
+ answerPreCheckoutQuery: (ok, params) => {
698
+ if (!("preCheckoutQuery" in update)) {
699
+ (0, _0_deps_js_1.unreachable)();
700
+ }
701
+ return this.answerPreCheckoutQuery(update.preCheckoutQuery.id, ok, params);
702
+ },
703
+ approveJoinRequest: () => {
704
+ const { chatId, userId } = mustGetMsg();
705
+ if (!userId) {
706
+ (0, _0_deps_js_1.unreachable)();
707
+ }
708
+ return this.approveJoinRequest(chatId, userId);
709
+ },
710
+ declineJoinRequest: () => {
711
+ const { chatId, userId } = mustGetMsg();
712
+ if (!userId) {
713
+ (0, _0_deps_js_1.unreachable)();
714
+ }
715
+ return this.declineJoinRequest(chatId, userId);
716
+ },
717
+ };
718
+ return (0, _1_utilities_js_1.cleanObject)(context);
719
+ };
720
+ #propagateConnectionState(connectionState) {
721
+ this.#queueHandleCtxUpdate({ connectionState });
722
+ this.#lastPropagatedConnectionState = connectionState;
723
+ }
724
+ #lastPropagatedConnectionState = null;
725
+ #stateChangeHandler = ((connected) => {
726
+ const connectionState = connected ? "ready" : "notConnected";
727
+ if (this.#lastPropagatedConnectionState !== connectionState) {
728
+ this.#propagateConnectionState(connectionState);
729
+ }
730
+ }).bind(this);
731
+ #storageInited = false;
732
+ async #initStorage() {
733
+ if (!this.#storageInited) {
734
+ await this.storage.initialize();
735
+ if (!this.#guaranteeUpdateDelivery) {
736
+ await this.storage.deleteUpdates();
737
+ }
738
+ this.#storageInited = true;
739
+ }
769
740
  }
741
+ #connectMutex = new _1_utilities_js_1.Mutex();
770
742
  /**
771
743
  * Loads the session if `setDc` was not called, initializes and connnects
772
744
  * a `ClientPlain` to generate auth key if there was none, and connects the client.
773
745
  * Before establishing the connection, the session is saved.
774
746
  */
775
747
  async connect() {
776
- const unlock = await __classPrivateFieldGet(this, _Client_connectMutex, "f").lock();
748
+ const unlock = await this.#connectMutex.lock();
777
749
  try {
778
750
  if (this.connected) {
779
751
  return;
780
752
  }
781
- await __classPrivateFieldGet(this, _Client_instances, "m", _Client_initStorage).call(this);
782
- if (__classPrivateFieldGet(this, _Client_authString, "f") && !__classPrivateFieldGet(this, _Client_authStringImported, "f")) {
783
- await this.importAuthString(__classPrivateFieldGet(this, _Client_authString, "f"));
753
+ await this.#initStorage();
754
+ if (this.#authString && !this.#authStringImported) {
755
+ await this.importAuthString(this.#authString);
784
756
  }
785
757
  const [authKey, dc] = await Promise.all([this.storage.getAuthKey(), this.storage.getDc()]);
786
- if (authKey != null && dc != null) {
787
- if (!__classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get) || __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).dc != dc) {
788
- __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get)?.disconnect();
789
- __classPrivateFieldGet(this, _Client_instances, "m", _Client_setMainClient).call(this, __classPrivateFieldGet(this, _Client_instances, "m", _Client_newClient).call(this, dc, true, false));
758
+ if (authKey !== null && dc !== null) {
759
+ if (!this.#client || this.#client.dc !== dc) {
760
+ this.#client?.disconnect();
761
+ this.#setMainClient(this.#newClient(dc, true, false));
790
762
  }
791
- await __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).setAuthKey(authKey);
792
- if (__classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).serverSalt == 0n) {
793
- __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).serverSalt = await this.storage.getServerSalt() ?? 0n;
763
+ await this.#client.setAuthKey(authKey);
764
+ if (this.#client.serverSalt === 0n) {
765
+ this.#client.serverSalt = await this.storage.getServerSalt() ?? 0n;
794
766
  }
795
767
  }
796
768
  else {
797
- const dc = await this.storage.getDc() ?? __classPrivateFieldGet(this, _Client_initialDc, "f");
798
- if (!__classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get) || __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).dc != dc) {
799
- __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get)?.disconnect();
800
- __classPrivateFieldGet(this, _Client_instances, "m", _Client_setMainClient).call(this, __classPrivateFieldGet(this, _Client_instances, "m", _Client_newClient).call(this, dc, true, false));
769
+ const dc = await this.storage.getDc() ?? this.#initialDc;
770
+ if (!this.#client || this.#client.dc !== dc) {
771
+ this.#client?.disconnect();
772
+ this.#setMainClient(this.#newClient(dc, true, false));
801
773
  }
802
774
  }
803
- await __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).connect();
804
- await Promise.all([this.storage.setAuthKey(__classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).authKey), this.storage.setDc(__classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).dc), this.storage.setServerSalt(__classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).serverSalt)]);
805
- __classPrivateFieldGet(this, _Client_instances, "m", _Client_startUpdateGapRecoveryLoop).call(this);
806
- __classPrivateFieldGet(this, _Client_instances, "m", _Client_startClientDisconnectionLoop).call(this);
775
+ await this.#client.connect();
776
+ await Promise.all([this.storage.setAuthKey(this.#client.authKey), this.storage.setDc(this.#client.dc), this.storage.setServerSalt(this.#client.serverSalt)]);
777
+ this.#startUpdateGapRecoveryLoop();
778
+ this.#startClientDisconnectionLoop();
807
779
  }
808
780
  finally {
809
781
  unlock();
810
782
  }
811
783
  }
812
- async [(_Client_clients = new WeakMap(), _Client_downloadPools = new WeakMap(), _Client_uploadPools = new WeakMap(), _Client_guaranteeUpdateDelivery = new WeakMap(), _Client_accountManager = new WeakMap(), _Client_botInfoManager = new WeakMap(), _Client_businessConnectionManager = new WeakMap(), _Client_fileManager = new WeakMap(), _Client_networkStatisticsManager = new WeakMap(), _Client_paymentManager = new WeakMap(), _Client_reactionManager = new WeakMap(), _Client_translationsManager = new WeakMap(), _Client_updateManager = new WeakMap(), _Client_messageManager = new WeakMap(), _Client_videoChatManager = new WeakMap(), _Client_callbackQueryManager = new WeakMap(), _Client_chatListManager = new WeakMap(), _Client_chatManager = new WeakMap(), _Client_forumManager = new WeakMap(), _Client_giftManager = new WeakMap(), _Client_inlineQueryManager = new WeakMap(), _Client_linkPreviewManager = new WeakMap(), _Client_pollManager = new WeakMap(), _Client_storyManager = new WeakMap(), _Client_managers = new WeakMap(), _Client_storage_ = new WeakMap(), _Client_messageStorage_ = new WeakMap(), _Client_parseMode = new WeakMap(), _Client_apiId = new WeakMap(), _Client_apiHash = new WeakMap(), _Client_transportProvider = new WeakMap(), _Client_publicKeys = new WeakMap(), _Client_outgoingMessages = new WeakMap(), _Client_persistCache = new WeakMap(), _Client_disableUpdates = new WeakMap(), _Client_authString = new WeakMap(), _Client_initialDc = new WeakMap(), _Client_L = new WeakMap(), _Client_LsignIn = new WeakMap(), _Client_LupdateGapRecoveryLoop = new WeakMap(), _Client_LhandleMigrationError = new WeakMap(), _Client_Lmin = new WeakMap(), _Client_constructContext = new WeakMap(), _Client_lastPropagatedConnectionState = new WeakMap(), _Client_stateChangeHandler = new WeakMap(), _Client_storageInited = new WeakMap(), _Client_connectMutex = new WeakMap(), _Client_lastPropagatedAuthorizationState = new WeakMap(), _Client_lastUpdates = new WeakMap(), _Client_updateGapRecoveryLoopAbortController = new WeakMap(), _Client_clientDisconnectionLoopAbortController = new WeakMap(), _Client_getMainClientMutex = new WeakMap(), _Client_handleInvokeError = new WeakMap(), _Client_authStringImported = new WeakMap(), _Client_lastGetMe = new WeakMap(), _Client_previouslyConnected = new WeakMap(), _Client_lastConnectionState = new WeakMap(), _Client_instances = new WeakSet(), _Client_setMainClient = function _Client_setMainClient(client) {
813
- __classPrivateFieldGet(this, _Client_instances, "m", _Client_disconnectAllClients).call(this);
814
- __classPrivateFieldSet(this, _Client_clients, [client], "f");
815
- client.handlers.onUpdate = (updates) => {
816
- __classPrivateFieldGet(this, _Client_updateManager, "f").processUpdates(updates, true, null);
817
- __classPrivateFieldSet(this, _Client_lastUpdates, new Date(), "f");
818
- };
819
- client.handlers.onDeserializationError = async () => {
820
- await __classPrivateFieldGet(this, _Client_updateManager, "f").recoverUpdateGap("deserialization error");
821
- };
822
- client.handlers.onNewServerSalt = async (serverSalt) => {
823
- await this.storage.setServerSalt(serverSalt);
824
- };
825
- client.onConnectionStateChange = __classPrivateFieldGet(this, _Client_instances, "m", _Client_onConnectionStateChange).bind(this);
826
- }, _Client_newClient = function _Client_newClient(dc, main, cdn) {
827
- const client = new _2_client_encrypted_js_1.ClientEncrypted(dc, __classPrivateFieldGet(this, _Client_apiId, "f"), {
828
- appVersion: this.appVersion,
829
- deviceModel: this.deviceModel,
830
- langCode: this.language,
831
- langPack: this.platform,
832
- systemLangCode: this.systemLangCode,
833
- systemVersion: this.systemVersion,
834
- transportProvider: __classPrivateFieldGet(this, _Client_transportProvider, "f"),
835
- cdn,
836
- disableUpdates: !main || cdn,
837
- publicKeys: __classPrivateFieldGet(this, _Client_publicKeys, "f"),
838
- });
839
- client.connectionCallback = __classPrivateFieldGet(this, _Client_networkStatisticsManager, "f").getTransportReadWriteCallback(cdn);
840
- return client;
841
- }, _Client_disconnectAllClients = function _Client_disconnectAllClients() {
842
- for (const client of __classPrivateFieldGet(this, _Client_clients, "f")) {
843
- client.disconnect();
844
- }
845
- for (const pool of Object.values(__classPrivateFieldGet(this, _Client_downloadPools, "f"))) {
846
- pool.disconnect();
847
- }
848
- for (const pool of Object.values(__classPrivateFieldGet(this, _Client_uploadPools, "f"))) {
849
- pool.disconnect();
850
- }
851
- }, _Client_client_get = function _Client_client_get() {
852
- return __classPrivateFieldGet(this, _Client_clients, "f")[0];
853
- }, _Client_propagateConnectionState = function _Client_propagateConnectionState(connectionState) {
854
- __classPrivateFieldGet(this, _Client_instances, "m", _Client_queueHandleCtxUpdate).call(this, { connectionState });
855
- __classPrivateFieldSet(this, _Client_lastPropagatedConnectionState, connectionState, "f");
856
- }, _Client_initStorage = async function _Client_initStorage() {
857
- if (!__classPrivateFieldGet(this, _Client_storageInited, "f")) {
858
- await this.storage.initialize();
859
- if (!__classPrivateFieldGet(this, _Client_guaranteeUpdateDelivery, "f")) {
860
- await this.storage.deleteUpdates();
861
- }
862
- __classPrivateFieldSet(this, _Client_storageInited, true, "f");
863
- }
864
- }, exports.handleMigrationError)](err) {
784
+ async [exports.handleMigrationError](err) {
865
785
  let newDc = String(err.dc);
866
- if (Math.abs((0, _3_transport_js_1.getDcId)(__classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).dc, __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).cdn)) >= 10_000) {
786
+ if (Math.abs((0, _3_transport_js_1.getDcId)(this.#client.dc, this.#client.cdn)) >= 10_000) {
867
787
  newDc += "-test";
868
788
  }
869
789
  this.disconnect();
870
790
  await this.storage.setDc(newDc);
871
791
  await this.storage.setAuthKey(null);
872
792
  await this.connect();
873
- __classPrivateFieldGet(this, _Client_LhandleMigrationError, "f").debug(`migrated to DC${newDc}`);
793
+ this.#LhandleMigrationError.debug(`migrated to DC${newDc}`);
874
794
  }
875
795
  disconnect() {
876
- __classPrivateFieldGet(this, _Client_instances, "m", _Client_disconnectAllClients).call(this);
877
- __classPrivateFieldGet(this, _Client_clientDisconnectionLoopAbortController, "f")?.abort();
878
- __classPrivateFieldGet(this, _Client_updateGapRecoveryLoopAbortController, "f")?.abort();
879
- __classPrivateFieldGet(this, _Client_updateManager, "f").closeAllChats();
796
+ this.#disconnectAllClients();
797
+ this.#clientDisconnectionLoopAbortController?.abort();
798
+ this.#updateGapRecoveryLoopAbortController?.abort();
799
+ this.#updateManager.closeAllChats();
800
+ }
801
+ #lastPropagatedAuthorizationState = null;
802
+ async #propagateAuthorizationState(authorized) {
803
+ if (this.#lastPropagatedAuthorizationState !== authorized) {
804
+ await this.#handleCtxUpdate({ authorizationState: { authorized } });
805
+ this.#lastPropagatedAuthorizationState = authorized;
806
+ }
807
+ }
808
+ async #getSelfId() {
809
+ const id = await this.storage.getAccountId();
810
+ if (id === null) {
811
+ throw new Error("Unauthorized");
812
+ }
813
+ return id;
814
+ }
815
+ async #getIsPremium() {
816
+ const maybeIsPremium = await this.storage.getIsPremium();
817
+ if (maybeIsPremium !== null) {
818
+ return maybeIsPremium;
819
+ }
820
+ return this.#lastGetMe?.isPremium ?? false;
821
+ }
822
+ #lastUpdates = new Date();
823
+ #updateGapRecoveryLoopAbortController;
824
+ #startUpdateGapRecoveryLoop() {
825
+ (0, _1_utilities_js_1.drop)(this.#updateGapRecoveryLoop());
826
+ }
827
+ async #updateGapRecoveryLoop() {
828
+ this.#updateGapRecoveryLoopAbortController?.abort();
829
+ const controller = this.#updateGapRecoveryLoopAbortController = new AbortController();
830
+ while (this.connected) {
831
+ try {
832
+ await (0, _0_deps_js_1.delay)(60 * _0_deps_js_1.SECOND, { signal: controller.signal });
833
+ if (!this.connected) {
834
+ break;
835
+ }
836
+ controller.signal.throwIfAborted();
837
+ if (Date.now() - this.#lastUpdates.getTime() >= 15 * _0_deps_js_1.MINUTE) {
838
+ (0, _1_utilities_js_1.drop)(this.#updateManager.recoverUpdateGap("lastUpdates").then(() => {
839
+ this.#lastUpdates = new Date();
840
+ }));
841
+ }
842
+ }
843
+ catch (err) {
844
+ if (err instanceof DOMException && err.name === "AbortError") {
845
+ break;
846
+ }
847
+ else if (!this.connected) {
848
+ break;
849
+ }
850
+ this.#LupdateGapRecoveryLoop.error(err);
851
+ }
852
+ }
853
+ }
854
+ #clientDisconnectionLoopAbortController;
855
+ #startClientDisconnectionLoop() {
856
+ (0, _1_utilities_js_1.drop)(this.#clientDisconnectionLoop());
857
+ }
858
+ async #clientDisconnectionLoop() {
859
+ const controller = this.#clientDisconnectionLoopAbortController = new AbortController();
860
+ while (this.connected) {
861
+ try {
862
+ await (0, _0_deps_js_1.delay)(60 * _0_deps_js_1.SECOND, { signal: controller.signal });
863
+ if (!this.connected) {
864
+ break;
865
+ }
866
+ controller.signal.throwIfAborted();
867
+ const now = Date.now();
868
+ const disconnectAfter = 5 * _0_deps_js_1.MINUTE;
869
+ this.#clients.map((client, i) => {
870
+ if (i > 0 && !client.disconnected && client.lastRequest && now - client.lastRequest.getTime() >= disconnectAfter) {
871
+ client?.disconnect();
872
+ }
873
+ });
874
+ }
875
+ catch (err) {
876
+ if (err instanceof DOMException && err.name === "AbortError") {
877
+ break;
878
+ }
879
+ else if (!this.connected) {
880
+ break;
881
+ }
882
+ }
883
+ }
880
884
  }
881
885
  /**
882
886
  * Signs in using the provided parameters if not already signed in.
@@ -888,10 +892,10 @@ class Client extends Composer {
888
892
  */
889
893
  async signIn(params) {
890
894
  try {
891
- await __classPrivateFieldGet(this, _Client_updateManager, "f").fetchState("signIn");
892
- await __classPrivateFieldGet(this, _Client_instances, "m", _Client_propagateAuthorizationState).call(this, true);
893
- (0, _1_utilities_js_1.drop)(__classPrivateFieldGet(this, _Client_updateManager, "f").recoverUpdateGap("signIn"));
894
- __classPrivateFieldGet(this, _Client_LsignIn, "f").debug("already signed in");
895
+ await this.#updateManager.fetchState("signIn");
896
+ await this.#propagateAuthorizationState(true);
897
+ (0, _1_utilities_js_1.drop)(this.#updateManager.recoverUpdateGap("signIn"));
898
+ this.#LsignIn.debug("already signed in");
895
899
  return;
896
900
  }
897
901
  catch (err) {
@@ -899,26 +903,26 @@ class Client extends Composer {
899
903
  throw err;
900
904
  }
901
905
  }
902
- if (!__classPrivateFieldGet(this, _Client_apiId, "f")) {
906
+ if (!this.#apiId) {
903
907
  throw new _0_errors_js_1.InputError("apiId not set");
904
908
  }
905
- if (!__classPrivateFieldGet(this, _Client_apiHash, "f")) {
909
+ if (!this.#apiHash) {
906
910
  throw new _0_errors_js_1.InputError("apiHash not set");
907
911
  }
908
912
  if (typeof params === "undefined") {
909
913
  const loginType = (0, _1_utilities_js_1.mustPromptOneOf)("Do you want to login as bot [b] or user [u]?", ["b", "u"]);
910
- if (loginType == "b") {
914
+ if (loginType === "b") {
911
915
  params = { botToken: (0, _1_utilities_js_1.mustPrompt)("Bot token:") };
912
916
  }
913
917
  else {
914
918
  params = { phone: () => (0, _1_utilities_js_1.mustPrompt)("Phone number:"), code: () => (0, _1_utilities_js_1.mustPrompt)("Verification code:"), password: () => (0, _1_utilities_js_1.mustPrompt)("Password:") };
915
919
  }
916
920
  }
917
- __classPrivateFieldGet(this, _Client_LsignIn, "f").debug("authorizing with", typeof params === "string" ? "bot token" : _2_tl_js_1.Api.is("auth.exportedAuthorization", params) ? "exported authorization" : "AuthorizeUserParams");
921
+ this.#LsignIn.debug("authorizing with", typeof params === "string" ? "bot token" : _2_tl_js_1.Api.is("auth.exportedAuthorization", params) ? "exported authorization" : "AuthorizeUserParams");
918
922
  if (params && "botToken" in params) {
919
923
  while (true) {
920
924
  try {
921
- const auth = await this.invoke({ _: "auth.importBotAuthorization", api_id: __classPrivateFieldGet(this, _Client_apiId, "f"), api_hash: __classPrivateFieldGet(this, _Client_apiHash, "f"), bot_auth_token: params.botToken, flags: 0 });
925
+ const auth = await this.invoke({ _: "auth.importBotAuthorization", api_id: this.#apiId, api_hash: this.#apiHash, bot_auth_token: params.botToken, flags: 0 });
922
926
  await this.storage.setAccountId(Number(_2_tl_js_1.Api.as("auth.authorization", auth).user.id));
923
927
  await this.storage.setAccountType("bot");
924
928
  break;
@@ -933,9 +937,9 @@ class Client extends Composer {
933
937
  }
934
938
  }
935
939
  }
936
- __classPrivateFieldGet(this, _Client_LsignIn, "f").debug("authorized as bot");
937
- await __classPrivateFieldGet(this, _Client_instances, "m", _Client_propagateAuthorizationState).call(this, true);
938
- await __classPrivateFieldGet(this, _Client_updateManager, "f").fetchState("authorize");
940
+ this.#LsignIn.debug("authorized as bot");
941
+ await this.#propagateAuthorizationState(true);
942
+ await this.#updateManager.fetchState("authorize");
939
943
  return;
940
944
  }
941
945
  auth: while (true) {
@@ -948,8 +952,8 @@ class Client extends Composer {
948
952
  const sendCode = () => this.invoke({
949
953
  _: "auth.sendCode",
950
954
  phone_number: phone,
951
- api_id: __classPrivateFieldGet(this, _Client_apiId, "f"),
952
- api_hash: __classPrivateFieldGet(this, _Client_apiHash, "f"),
955
+ api_id: this.#apiId,
956
+ api_hash: this.#apiHash,
953
957
  settings: { _: "codeSettings" },
954
958
  }).then((v) => _2_tl_js_1.Api.as("auth.sentCode", v));
955
959
  try {
@@ -975,7 +979,7 @@ class Client extends Composer {
975
979
  }
976
980
  }
977
981
  }
978
- __classPrivateFieldGet(this, _Client_LsignIn, "f").debug("verification code sent");
982
+ this.#LsignIn.debug("verification code sent");
979
983
  let err;
980
984
  code: while (true) {
981
985
  const code = typeof params.code === "string" ? params.code : await params.code();
@@ -983,267 +987,136 @@ class Client extends Composer {
983
987
  const auth = await this.invoke({
984
988
  _: "auth.signIn",
985
989
  phone_number: phone,
986
- phone_code: code,
987
- phone_code_hash: sentCode.phone_code_hash,
988
- });
989
- await this.storage.setAccountId(Number(_2_tl_js_1.Api.as("auth.authorization", auth).user.id));
990
- await this.storage.setAccountType("user");
991
- __classPrivateFieldGet(this, _Client_LsignIn, "f").debug("signed in as user");
992
- await __classPrivateFieldGet(this, _Client_instances, "m", _Client_propagateAuthorizationState).call(this, true);
993
- await __classPrivateFieldGet(this, _Client_updateManager, "f").fetchState("signIn");
994
- return;
995
- }
996
- catch (err_) {
997
- if (err_ instanceof _4_errors_js_2.PhoneCodeInvalid) {
998
- continue code;
999
- }
1000
- else {
1001
- err = err_;
1002
- break code;
1003
- }
1004
- }
1005
- }
1006
- if (!(err instanceof _4_errors_js_1.SessionPasswordNeeded)) {
1007
- throw err;
1008
- }
1009
- password: while (true) {
1010
- const ap = await this.invoke({ _: "account.getPassword" });
1011
- if (!(_2_tl_js_1.Api.is("passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow", ap.current_algo))) {
1012
- throw new Error(`Handling ${ap.current_algo?._} not implemented`);
1013
- }
1014
- try {
1015
- const password = typeof params.password === "string" ? params.password : await params.password(ap.hint ?? null);
1016
- const input = await (0, _0_password_js_1.checkPassword)(password, ap);
1017
- const auth = await this.invoke({ _: "auth.checkPassword", password: input });
1018
- await this.storage.setAccountId(Number(_2_tl_js_1.Api.as("auth.authorization", auth).user.id));
1019
- await this.storage.setAccountType("user");
1020
- __classPrivateFieldGet(this, _Client_LsignIn, "f").debug("signed in as user");
1021
- await __classPrivateFieldGet(this, _Client_instances, "m", _Client_propagateAuthorizationState).call(this, true);
1022
- await __classPrivateFieldGet(this, _Client_updateManager, "f").fetchState("signIn");
1023
- return;
1024
- }
1025
- catch (err) {
1026
- if (err instanceof _4_errors_js_1.PasswordHashInvalid) {
1027
- continue password;
1028
- }
1029
- else {
1030
- throw err;
1031
- }
1032
- }
1033
- }
1034
- }
1035
- catch (err) {
1036
- if (err == exports.restartAuth) {
1037
- continue auth;
1038
- }
1039
- else {
1040
- throw err;
1041
- }
1042
- }
1043
- }
1044
- }
1045
- async signOut() {
1046
- try {
1047
- await Promise.all([
1048
- this.storage.reset(),
1049
- this.invoke({ _: "auth.logOut" }).then(() => {
1050
- __classPrivateFieldGet(this, _Client_instances, "m", _Client_propagateAuthorizationState).call(this, false);
1051
- }),
1052
- ]);
1053
- }
1054
- finally {
1055
- __classPrivateFieldSet(this, _Client_lastGetMe, null, "f");
1056
- this.disconnect();
1057
- await this.connect();
1058
- }
1059
- }
1060
- /**
1061
- * Same as calling `.connect()` followed by `.signIn(params)`.
1062
- */
1063
- async start(params) {
1064
- await this.connect();
1065
- await this.signIn(params);
1066
- }
1067
- exportAuthString() {
1068
- return this.storage.exportAuthString(__classPrivateFieldGet(this, _Client_apiId, "f"));
1069
- }
1070
- async importAuthString(authString) {
1071
- if (this.connected) {
1072
- throw new Error("Cannot import auth string while the client is connected");
1073
- }
1074
- await __classPrivateFieldGet(this, _Client_instances, "m", _Client_initStorage).call(this);
1075
- await this.storage.importAuthString(authString);
1076
- __classPrivateFieldSet(this, _Client_authStringImported, true, "f");
1077
- if (!__classPrivateFieldGet(this, _Client_apiId, "f")) {
1078
- __classPrivateFieldSet(this, _Client_apiId, await this.storage.getApiId() ?? 0, "f");
1079
- }
1080
- }
1081
- /**
1082
- * Get a chat's inputPeer. Useful when calling API functions directly.
1083
- *
1084
- * @param id The identifier of a chat.
1085
- */
1086
- async getInputPeer(id) {
1087
- if (id === "me" || id == await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getSelfId).call(this)) {
1088
- return { _: "inputPeerSelf" };
1089
- }
1090
- const inputPeer = await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getInputPeerInner).call(this, id);
1091
- if (((_2_tl_js_1.Api.is("inputPeerUser", inputPeer) || _2_tl_js_1.Api.is("inputPeerChannel", inputPeer)) && inputPeer.access_hash == 0n) && await this.storage.getAccountType() == "bot") {
1092
- if ("channel_id" in inputPeer) {
1093
- inputPeer.access_hash = await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getChannelAccessHash).call(this, inputPeer.channel_id);
1094
- }
1095
- else {
1096
- inputPeer.access_hash = await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getUserAccessHash).call(this, inputPeer.user_id);
1097
- }
1098
- }
1099
- if ((_2_tl_js_1.Api.is("inputPeerUser", inputPeer) || _2_tl_js_1.Api.is("inputPeerChannel", inputPeer)) && inputPeer.access_hash == 0n) {
1100
- throw new _0_errors_js_1.AccessError(`Cannot access the chat ${id} because there is no access hash for it.`);
1101
- }
1102
- return inputPeer;
1103
- }
1104
- /**
1105
- * Get a channel or a supergroup's inputChannel. Useful when calling API functions directly.
1106
- *
1107
- * @param id The identifier of the channel or the supergroup.
1108
- */
1109
- async getInputChannel(id) {
1110
- const inputPeer = await this.getInputPeer(id);
1111
- if (!(0, _0_utilities_js_1.canBeInputChannel)(inputPeer)) {
1112
- throw new TypeError(`The chat ${id} is not a channel neither a supergroup.`);
1113
- }
1114
- return (0, _0_utilities_js_1.toInputChannel)(inputPeer);
1115
- }
1116
- /**
1117
- * Get a user's inputUser. Useful when calling API functions directly.
1118
- *
1119
- * @param id The identifier of the user.
1120
- */
1121
- async getInputUser(id) {
1122
- const inputPeer = await this.getInputPeer(id);
1123
- if (!(0, _0_utilities_js_1.canBeInputUser)(inputPeer)) {
1124
- throw new TypeError(`The chat ${id} is not a private chat.`);
1125
- }
1126
- return (0, _0_utilities_js_1.toInputUser)(inputPeer);
1127
- }
1128
- async [(_Client_propagateAuthorizationState = async function _Client_propagateAuthorizationState(authorized) {
1129
- if (__classPrivateFieldGet(this, _Client_lastPropagatedAuthorizationState, "f") != authorized) {
1130
- await __classPrivateFieldGet(this, _Client_instances, "m", _Client_handleCtxUpdate).call(this, { authorizationState: { authorized } });
1131
- __classPrivateFieldSet(this, _Client_lastPropagatedAuthorizationState, authorized, "f");
1132
- }
1133
- }, _Client_getSelfId = async function _Client_getSelfId() {
1134
- const id = await this.storage.getAccountId();
1135
- if (id == null) {
1136
- throw new Error("Unauthorized");
1137
- }
1138
- return id;
1139
- }, _Client_getIsPremium = async function _Client_getIsPremium() {
1140
- const maybeIsPremium = await this.storage.getIsPremium();
1141
- if (maybeIsPremium != null) {
1142
- return maybeIsPremium;
1143
- }
1144
- return __classPrivateFieldGet(this, _Client_lastGetMe, "f")?.isPremium ?? false;
1145
- }, _Client_startUpdateGapRecoveryLoop = function _Client_startUpdateGapRecoveryLoop() {
1146
- (0, _1_utilities_js_1.drop)(__classPrivateFieldGet(this, _Client_instances, "m", _Client_updateGapRecoveryLoop).call(this));
1147
- }, _Client_updateGapRecoveryLoop = async function _Client_updateGapRecoveryLoop() {
1148
- __classPrivateFieldGet(this, _Client_updateGapRecoveryLoopAbortController, "f")?.abort();
1149
- const controller = __classPrivateFieldSet(this, _Client_updateGapRecoveryLoopAbortController, new AbortController(), "f");
1150
- while (this.connected) {
1151
- try {
1152
- await (0, _0_deps_js_1.delay)(60 * _0_deps_js_1.SECOND, { signal: controller.signal });
1153
- if (!this.connected) {
1154
- break;
1155
- }
1156
- controller.signal.throwIfAborted();
1157
- if (Date.now() - __classPrivateFieldGet(this, _Client_lastUpdates, "f").getTime() >= 15 * _0_deps_js_1.MINUTE) {
1158
- (0, _1_utilities_js_1.drop)(__classPrivateFieldGet(this, _Client_updateManager, "f").recoverUpdateGap("lastUpdates").then(() => {
1159
- __classPrivateFieldSet(this, _Client_lastUpdates, new Date(), "f");
1160
- }));
1161
- }
1162
- }
1163
- catch (err) {
1164
- if (err instanceof DOMException && err.name == "AbortError") {
1165
- break;
1166
- }
1167
- else if (!this.connected) {
1168
- break;
990
+ phone_code: code,
991
+ phone_code_hash: sentCode.phone_code_hash,
992
+ });
993
+ await this.storage.setAccountId(Number(_2_tl_js_1.Api.as("auth.authorization", auth).user.id));
994
+ await this.storage.setAccountType("user");
995
+ this.#LsignIn.debug("signed in as user");
996
+ await this.#propagateAuthorizationState(true);
997
+ await this.#updateManager.fetchState("signIn");
998
+ return;
999
+ }
1000
+ catch (err_) {
1001
+ if (err_ instanceof _4_errors_js_2.PhoneCodeInvalid) {
1002
+ continue code;
1003
+ }
1004
+ else {
1005
+ err = err_;
1006
+ break code;
1007
+ }
1008
+ }
1169
1009
  }
1170
- __classPrivateFieldGet(this, _Client_LupdateGapRecoveryLoop, "f").error(err);
1171
- }
1172
- }
1173
- }, _Client_startClientDisconnectionLoop = function _Client_startClientDisconnectionLoop() {
1174
- (0, _1_utilities_js_1.drop)(__classPrivateFieldGet(this, _Client_instances, "m", _Client_clientDisconnectionLoop).call(this));
1175
- }, _Client_clientDisconnectionLoop = async function _Client_clientDisconnectionLoop() {
1176
- const controller = __classPrivateFieldSet(this, _Client_clientDisconnectionLoopAbortController, new AbortController(), "f");
1177
- while (this.connected) {
1178
- try {
1179
- await (0, _0_deps_js_1.delay)(60 * _0_deps_js_1.SECOND, { signal: controller.signal });
1180
- if (!this.connected) {
1181
- break;
1010
+ if (!(err instanceof _4_errors_js_1.SessionPasswordNeeded)) {
1011
+ throw err;
1182
1012
  }
1183
- controller.signal.throwIfAborted();
1184
- const now = Date.now();
1185
- const disconnectAfter = 5 * _0_deps_js_1.MINUTE;
1186
- __classPrivateFieldGet(this, _Client_clients, "f").map((client, i) => {
1187
- if (i > 0 && !client.disconnected && client.lastRequest && now - client.lastRequest.getTime() >= disconnectAfter) {
1188
- client?.disconnect();
1013
+ password: while (true) {
1014
+ const ap = await this.invoke({ _: "account.getPassword" });
1015
+ if (!(_2_tl_js_1.Api.is("passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow", ap.current_algo))) {
1016
+ throw new Error(`Handling ${ap.current_algo?._} not implemented`);
1189
1017
  }
1190
- });
1018
+ try {
1019
+ const password = typeof params.password === "string" ? params.password : await params.password(ap.hint ?? null);
1020
+ const input = await (0, _0_password_js_1.checkPassword)(password, ap);
1021
+ const auth = await this.invoke({ _: "auth.checkPassword", password: input });
1022
+ await this.storage.setAccountId(Number(_2_tl_js_1.Api.as("auth.authorization", auth).user.id));
1023
+ await this.storage.setAccountType("user");
1024
+ this.#LsignIn.debug("signed in as user");
1025
+ await this.#propagateAuthorizationState(true);
1026
+ await this.#updateManager.fetchState("signIn");
1027
+ return;
1028
+ }
1029
+ catch (err) {
1030
+ if (err instanceof _4_errors_js_1.PasswordHashInvalid) {
1031
+ continue password;
1032
+ }
1033
+ else {
1034
+ throw err;
1035
+ }
1036
+ }
1037
+ }
1191
1038
  }
1192
1039
  catch (err) {
1193
- if (err instanceof DOMException && err.name == "AbortError") {
1194
- break;
1040
+ if (err === exports.restartAuth) {
1041
+ continue auth;
1195
1042
  }
1196
- else if (!this.connected) {
1197
- break;
1043
+ else {
1044
+ throw err;
1198
1045
  }
1199
1046
  }
1200
1047
  }
1201
- }, _Client_getClient = async function _Client_getClient(params) {
1048
+ }
1049
+ async signOut() {
1050
+ try {
1051
+ await Promise.all([
1052
+ this.storage.reset(),
1053
+ this.invoke({ _: "auth.logOut" }).then(() => {
1054
+ this.#propagateAuthorizationState(false);
1055
+ }),
1056
+ ]);
1057
+ }
1058
+ finally {
1059
+ this.#lastGetMe = null;
1060
+ this.disconnect();
1061
+ await this.connect();
1062
+ }
1063
+ }
1064
+ /**
1065
+ * Same as calling `.connect()` followed by `.signIn(params)`.
1066
+ */
1067
+ async start(params) {
1068
+ await this.connect();
1069
+ await this.signIn(params);
1070
+ }
1071
+ async #getClient(params) {
1202
1072
  let client;
1203
1073
  switch (params.type) {
1204
1074
  case undefined:
1205
- client = await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getMainClient).call(this, params.dc);
1075
+ client = await this.#getMainClient(params.dc);
1206
1076
  break;
1207
1077
  case "download":
1208
- client = await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getDownloadClient).call(this, params.dc);
1078
+ client = await this.#getDownloadClient(params.dc);
1209
1079
  break;
1210
1080
  case "upload":
1211
- client = await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getUploadClient).call(this);
1081
+ client = await this.#getUploadClient();
1212
1082
  break;
1213
1083
  }
1214
- if (client !== __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get) && !this.disconnected && client.disconnected) {
1084
+ if (client !== this.#client && !this.disconnected && client.disconnected) {
1215
1085
  await client.connect();
1216
1086
  }
1217
1087
  return client;
1218
- }, _Client_getMainClient = async function _Client_getMainClient(dc) {
1219
- if (dc === undefined || dc == __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get)?.dc) {
1220
- return __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get);
1088
+ }
1089
+ #getMainClientMutex = new _1_utilities_js_1.Mutex();
1090
+ async #getMainClient(dc) {
1091
+ if (dc === undefined || dc === this.#client?.dc) {
1092
+ return this.#client;
1221
1093
  }
1222
- let client = __classPrivateFieldGet(this, _Client_clients, "f").find((v) => v.dc == dc);
1094
+ let client = this.#clients.find((v) => v.dc === dc);
1223
1095
  if (client) {
1224
1096
  return client;
1225
1097
  }
1226
- const unlock = await __classPrivateFieldGet(this, _Client_getMainClientMutex, "f").lock();
1227
- client = __classPrivateFieldGet(this, _Client_clients, "f").find((v) => v.dc == dc);
1098
+ const unlock = await this.#getMainClientMutex.lock();
1099
+ client = this.#clients.find((v) => v.dc === dc);
1228
1100
  if (client) {
1229
1101
  return client;
1230
1102
  }
1231
1103
  try {
1232
- client = __classPrivateFieldGet(this, _Client_instances, "m", _Client_newClient).call(this, dc, false, false);
1233
- await __classPrivateFieldGet(this, _Client_instances, "m", _Client_setupClient).call(this, client);
1234
- __classPrivateFieldGet(this, _Client_clients, "f").push(client);
1104
+ client = this.#newClient(dc, false, false);
1105
+ await this.#setupClient(client);
1106
+ this.#clients.push(client);
1235
1107
  return client;
1236
1108
  }
1237
1109
  finally {
1238
1110
  unlock();
1239
1111
  }
1240
- }, _Client_getDownloadClient = async function _Client_getDownloadClient(dc) {
1241
- dc ??= __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).dc;
1242
- const pool = __classPrivateFieldGet(this, _Client_downloadPools, "f")[dc] ??= new _3_client_encrypted_pool_js_1.ClientEncryptedPool();
1112
+ }
1113
+ async #getDownloadClient(dc) {
1114
+ dc ??= this.#client.dc;
1115
+ const pool = this.#downloadPools[dc] ??= new _3_client_encrypted_pool_js_1.ClientEncryptedPool();
1243
1116
  if (!pool.size) {
1244
1117
  if (!pool.size) {
1245
1118
  for (let i = 0; i < _0_utilities_js_1.DOWNLOAD_POOL_SIZE; ++i) {
1246
- pool.add(__classPrivateFieldGet(this, _Client_instances, "m", _Client_newClient).call(this, dc, false, true));
1119
+ pool.add(this.#newClient(dc, false, true));
1247
1120
  }
1248
1121
  }
1249
1122
  }
@@ -1251,28 +1124,32 @@ class Client extends Composer {
1251
1124
  if (client.authKey.length) {
1252
1125
  return client;
1253
1126
  }
1254
- await __classPrivateFieldGet(this, _Client_instances, "m", _Client_setupClient).call(this, client);
1127
+ await this.#setupClient(client);
1255
1128
  return client;
1256
- }, _Client_getUploadPoolSize = async function _Client_getUploadPoolSize() {
1257
- const dc = __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).dc;
1258
- return (dc != "2" && dc != "4") || await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getIsPremium).call(this) ? 8 : 4;
1259
- }, _Client_getUploadClient = async function _Client_getUploadClient() {
1260
- const dc = __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).dc;
1261
- const poolSize = await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getUploadPoolSize).call(this);
1262
- const pool = __classPrivateFieldGet(this, _Client_uploadPools, "f")[dc] ??= new _3_client_encrypted_pool_js_1.ClientEncryptedPool();
1129
+ }
1130
+ async #getUploadPoolSize() {
1131
+ const dc = this.#client.dc;
1132
+ return (dc !== "2" && dc !== "4") || await this.#getIsPremium() ? 8 : 4;
1133
+ }
1134
+ async #getUploadClient() {
1135
+ const dc = this.#client.dc;
1136
+ const poolSize = await this.#getUploadPoolSize();
1137
+ const pool = this.#uploadPools[dc] ??= new _3_client_encrypted_pool_js_1.ClientEncryptedPool();
1263
1138
  if (!pool.size) {
1264
1139
  for (let i = 0; i < poolSize; ++i) {
1265
- pool.add(await __classPrivateFieldGet(this, _Client_instances, "m", _Client_newClient).call(this, dc, false, true));
1140
+ pool.add(await this.#newClient(dc, false, true));
1266
1141
  }
1267
1142
  }
1268
1143
  const client = pool.nextClient();
1269
1144
  if (client.authKey.length) {
1270
1145
  return client;
1271
1146
  }
1272
- await __classPrivateFieldGet(this, _Client_instances, "m", _Client_setupClient).call(this, client);
1147
+ await this.#setupClient(client);
1273
1148
  return client;
1274
- }, _Client_setupClient = async function _Client_setupClient(client) {
1275
- const storage = client.dc == __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).dc ? this.storage : new _0_storage_operations_js_1.StorageOperations(this.storage.provider.branch(client.dc + (client.cdn ? "_cdn" : "")));
1149
+ }
1150
+ async #setupClient(client) {
1151
+ const storage = client.dc === this.#client.dc ? this.storage : new _0_storage_operations_js_1.StorageOperations(this.storage.provider.branch(client.dc + (client.cdn ? "_cdn" : "")));
1152
+ await storage.initialize();
1276
1153
  const [authKey, serverSalt] = await Promise.all([storage.getAuthKey(), storage.getServerSalt()]);
1277
1154
  if (authKey) {
1278
1155
  await client.setAuthKey(authKey);
@@ -1282,17 +1159,18 @@ class Client extends Composer {
1282
1159
  }
1283
1160
  await client.connect();
1284
1161
  if (!authKey) {
1285
- await __classPrivateFieldGet(this, _Client_instances, "m", _Client_importAuthorization).call(this, client);
1162
+ await this.#importAuthorization(client);
1286
1163
  }
1287
1164
  await storage.setAuthKey(client.authKey);
1288
- if (client.dc !== __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).dc) {
1165
+ if (client.dc !== this.#client.dc) {
1289
1166
  await storage.setServerSalt(client.serverSalt);
1290
1167
  client.handlers.onNewServerSalt = async (serverSalt) => {
1291
1168
  await storage.setServerSalt(serverSalt);
1292
1169
  };
1293
1170
  }
1294
- }, _Client_importAuthorization = async function _Client_importAuthorization(client) {
1295
- if (__classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).dc == client.dc && __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).cdn == client.cdn) {
1171
+ }
1172
+ async #importAuthorization(client) {
1173
+ if (this.#client.dc === client.dc && this.#client.cdn === client.cdn) {
1296
1174
  const [authKey, serverSalt] = await Promise.all([this.storage.getAuthKey(), this.storage.getServerSalt()]);
1297
1175
  if (authKey) {
1298
1176
  await client.setAuthKey(authKey);
@@ -1302,29 +1180,30 @@ class Client extends Composer {
1302
1180
  }
1303
1181
  return;
1304
1182
  }
1305
- const exportedAuthorization = await __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get).invoke({ _: "auth.exportAuthorization", dc_id: (0, _3_transport_js_1.getDcId)(client.dc, client.cdn) });
1183
+ const exportedAuthorization = await this.#client.invoke({ _: "auth.exportAuthorization", dc_id: (0, _3_transport_js_1.getDcId)(client.dc, client.cdn) });
1306
1184
  await client.invoke({ ...exportedAuthorization, _: "auth.importAuthorization" });
1307
- }, _Client_invoke = async function _Client_invoke(function_, params) {
1308
- if (!__classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get)) {
1185
+ }
1186
+ async #invoke(function_, params) {
1187
+ if (!this.#client) {
1309
1188
  throw new _0_errors_js_1.ConnectionError("Not connected.");
1310
1189
  }
1311
1190
  let n = 1;
1312
1191
  let client;
1313
1192
  while (true) {
1314
- client = params ? await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getClient).call(this, params) : __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get);
1315
- const main = client === __classPrivateFieldGet(this, _Client_instances, "a", _Client_client_get);
1193
+ client = params ? await this.#getClient(params) : this.#client;
1194
+ const main = client === this.#client;
1316
1195
  try {
1317
1196
  const result = await client.invoke(function_);
1318
1197
  if (main) {
1319
1198
  try {
1320
- await __classPrivateFieldGet(this, _Client_updateManager, "f").processResult(result);
1199
+ await this.#updateManager.processResult(result);
1321
1200
  }
1322
1201
  catch (err) {
1323
- __classPrivateFieldGet(this, _Client_L, "f").error("failed to process result:", err);
1202
+ this.#L.error("failed to process result:", err);
1324
1203
  }
1325
1204
  if (_2_tl_js_1.Api.isOfEnum("Update", result) || _2_tl_js_1.Api.isOfEnum("Updates", result)) {
1326
1205
  return new Promise((resolve) => {
1327
- __classPrivateFieldGet(this, _Client_updateManager, "f").processUpdates(result, true, _2_tl_js_1.Mtproto.is("ping", function_) ? null : function_, () => resolve(result));
1206
+ this.#updateManager.processUpdates(result, true, _2_tl_js_1.Mtproto.is("ping", function_) ? null : function_, () => resolve(result));
1328
1207
  });
1329
1208
  }
1330
1209
  }
@@ -1332,13 +1211,13 @@ class Client extends Composer {
1332
1211
  }
1333
1212
  catch (err) {
1334
1213
  if (err instanceof _4_errors_js_1.AuthKeyUnregistered && !main) {
1335
- await __classPrivateFieldGet(this, _Client_instances, "m", _Client_importAuthorization).call(this, client);
1214
+ await this.#importAuthorization(client);
1336
1215
  continue;
1337
1216
  }
1338
1217
  else if (err instanceof _0_errors_js_1.ConnectionError && !main && !this.disconnected) {
1339
1218
  continue;
1340
1219
  }
1341
- else if (await __classPrivateFieldGet(this, _Client_handleInvokeError, "f").call(this, Object.freeze({ client: this, error: err, function: function_, n: n++ }), () => Promise.resolve(false))) {
1220
+ else if (await this.#handleInvokeError(Object.freeze({ client: this, error: err, function: function_, n: n++ }), () => Promise.resolve(false))) {
1342
1221
  continue;
1343
1222
  }
1344
1223
  else {
@@ -1346,23 +1225,85 @@ class Client extends Composer {
1346
1225
  }
1347
1226
  }
1348
1227
  }
1349
- }, _Client_getUserAccessHash = async function _Client_getUserAccessHash(userId) {
1228
+ }
1229
+ #handleInvokeError = skipInvoke();
1230
+ /**
1231
+ * Invokes a function waiting and returning its reply if the second parameter is not `true`. Requires the client
1232
+ * to be connected.
1233
+ *
1234
+ * @param function_ The function to invoke.
1235
+ */
1236
+ invoke = Object.assign(this.#invoke, {
1237
+ use: (handler) => {
1238
+ const handle = this.#handleInvokeError;
1239
+ this.#handleInvokeError = async (ctx, next) => {
1240
+ let result = null;
1241
+ return await handle(ctx, async () => {
1242
+ if (result !== null)
1243
+ return result;
1244
+ result = await handler(ctx, next);
1245
+ return result;
1246
+ });
1247
+ };
1248
+ },
1249
+ });
1250
+ exportAuthString() {
1251
+ return this.storage.exportAuthString(this.#apiId);
1252
+ }
1253
+ #authStringImported = false;
1254
+ async importAuthString(authString) {
1255
+ if (this.connected) {
1256
+ throw new Error("Cannot import auth string while the client is connected");
1257
+ }
1258
+ await this.#initStorage();
1259
+ await this.storage.importAuthString(authString);
1260
+ this.#authStringImported = true;
1261
+ if (!this.#apiId) {
1262
+ this.#apiId = await this.storage.getApiId() ?? 0;
1263
+ }
1264
+ }
1265
+ async #getUserAccessHash(userId) {
1350
1266
  const users = await this.invoke({ _: "users.getUsers", id: [{ _: "inputUser", user_id: userId, access_hash: 0n }] });
1351
1267
  const user = _2_tl_js_1.Api.is("user", users[0]) ? users[0] : undefined;
1352
1268
  if (user) {
1353
1269
  await this.messageStorage.setEntity(user);
1354
1270
  }
1355
1271
  return user?.access_hash ?? 0n;
1356
- }, _Client_getChannelAccessHash = async function _Client_getChannelAccessHash(channelId) {
1272
+ }
1273
+ async #getChannelAccessHash(channelId) {
1357
1274
  const channels = await this.invoke({ _: "channels.getChannels", id: [{ _: "inputChannel", channel_id: channelId, access_hash: 0n }] });
1358
1275
  const channel = _2_tl_js_1.Api.is("channel", channels.chats[0]) ? channels.chats[0] : undefined;
1359
1276
  if (channel) {
1360
1277
  await this.messageStorage.setEntity(channel);
1361
1278
  }
1362
1279
  return channel?.access_hash ?? 0n;
1363
- }, _Client_getInputPeerChatId = async function _Client_getInputPeerChatId(inputPeer) {
1280
+ }
1281
+ /**
1282
+ * Get a chat's inputPeer. Useful when calling API functions directly.
1283
+ *
1284
+ * @param id The identifier of a chat.
1285
+ */
1286
+ async getInputPeer(id) {
1287
+ if (id === "me" || id === await this.#getSelfId()) {
1288
+ return { _: "inputPeerSelf" };
1289
+ }
1290
+ const inputPeer = await this.#getInputPeerInner(id);
1291
+ if (((_2_tl_js_1.Api.is("inputPeerUser", inputPeer) || _2_tl_js_1.Api.is("inputPeerChannel", inputPeer)) && inputPeer.access_hash === 0n) && await this.storage.getAccountType() === "bot") {
1292
+ if ("channel_id" in inputPeer) {
1293
+ inputPeer.access_hash = await this.#getChannelAccessHash(inputPeer.channel_id);
1294
+ }
1295
+ else {
1296
+ inputPeer.access_hash = await this.#getUserAccessHash(inputPeer.user_id);
1297
+ }
1298
+ }
1299
+ if ((_2_tl_js_1.Api.is("inputPeerUser", inputPeer) || _2_tl_js_1.Api.is("inputPeerChannel", inputPeer)) && inputPeer.access_hash === 0n) {
1300
+ throw new _0_errors_js_1.AccessError(`Cannot access the chat ${id} because there is no access hash for it.`);
1301
+ }
1302
+ return inputPeer;
1303
+ }
1304
+ async #getInputPeerChatId(inputPeer) {
1364
1305
  if (_2_tl_js_1.Api.isOneOf(["inputPeerSelf", "inputUserSelf"], inputPeer)) {
1365
- return await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getSelfId).call(this);
1306
+ return await this.#getSelfId();
1366
1307
  }
1367
1308
  else if (_2_tl_js_1.Api.isOneOf(["inputPeerEmpty", "inputUserEmpty", "inputChannelEmpty"], inputPeer)) {
1368
1309
  (0, _0_deps_js_1.unreachable)();
@@ -1370,7 +1311,32 @@ class Client extends Composer {
1370
1311
  else {
1371
1312
  return _2_tl_js_1.Api.peerToChatId(inputPeer);
1372
1313
  }
1373
- }, _Client_getInputPeerInner = async function _Client_getInputPeerInner(id) {
1314
+ }
1315
+ /**
1316
+ * Get a channel or a supergroup's inputChannel. Useful when calling API functions directly.
1317
+ *
1318
+ * @param id The identifier of the channel or the supergroup.
1319
+ */
1320
+ async getInputChannel(id) {
1321
+ const inputPeer = await this.getInputPeer(id);
1322
+ if (!(0, _0_utilities_js_1.canBeInputChannel)(inputPeer)) {
1323
+ throw new TypeError(`The chat ${id} is not a channel neither a supergroup.`);
1324
+ }
1325
+ return (0, _0_utilities_js_1.toInputChannel)(inputPeer);
1326
+ }
1327
+ /**
1328
+ * Get a user's inputUser. Useful when calling API functions directly.
1329
+ *
1330
+ * @param id The identifier of the user.
1331
+ */
1332
+ async getInputUser(id) {
1333
+ const inputPeer = await this.getInputPeer(id);
1334
+ if (!(0, _0_utilities_js_1.canBeInputUser)(inputPeer)) {
1335
+ throw new TypeError(`The chat ${id} is not a private chat.`);
1336
+ }
1337
+ return (0, _0_utilities_js_1.toInputUser)(inputPeer);
1338
+ }
1339
+ async #getInputPeerInner(id) {
1374
1340
  const idn = Number(id);
1375
1341
  if (!isNaN(idn)) {
1376
1342
  id = idn;
@@ -1380,14 +1346,14 @@ class Client extends Composer {
1380
1346
  id = (0, _0_utilities_js_1.getUsername)(id);
1381
1347
  let resolvedId = 0;
1382
1348
  const maybeUsername = await this.messageStorage.getUsername(id);
1383
- if (maybeUsername != null && Date.now() - maybeUsername[1].getTime() < _4_constants_js_1.USERNAME_TTL) {
1349
+ if (maybeUsername !== null && Date.now() - maybeUsername[1].getTime() < _4_constants_js_1.USERNAME_TTL) {
1384
1350
  const [id] = maybeUsername;
1385
1351
  resolvedId = id;
1386
1352
  }
1387
1353
  else {
1388
1354
  const resolved = await this.invoke({ _: "contacts.resolveUsername", username: id });
1389
- await __classPrivateFieldGet(this, _Client_updateManager, "f").processChats(resolved.chats, resolved);
1390
- await __classPrivateFieldGet(this, _Client_updateManager, "f").processUsers(resolved.users, resolved);
1355
+ await this.#updateManager.processChats(resolved.chats, resolved);
1356
+ await this.#updateManager.processUsers(resolved.users, resolved);
1391
1357
  if (_2_tl_js_1.Api.is("peerUser", resolved.peer)) {
1392
1358
  resolvedId = _2_tl_js_1.Api.peerToChatId(resolved.peer);
1393
1359
  }
@@ -1399,11 +1365,11 @@ class Client extends Composer {
1399
1365
  }
1400
1366
  }
1401
1367
  const resolvedIdType = _2_tl_js_1.Api.getChatIdPeerType(resolvedId);
1402
- if (resolvedIdType == "user") {
1368
+ if (resolvedIdType === "user") {
1403
1369
  const accessHash = await this.messageStorage.getUserAccessHash(resolvedId);
1404
1370
  peer = { _: "inputPeerUser", user_id: _2_tl_js_1.Api.chatIdToPeerId(resolvedId), access_hash: accessHash ?? 0n };
1405
1371
  }
1406
- else if (resolvedIdType == "channel") {
1372
+ else if (resolvedIdType === "channel") {
1407
1373
  const accessHash = await this.messageStorage.getChannelAccessHash(resolvedId);
1408
1374
  peer = { _: "inputPeerChannel", channel_id: _2_tl_js_1.Api.chatIdToPeerId(resolvedId), access_hash: accessHash ?? 0n };
1409
1375
  }
@@ -1418,7 +1384,7 @@ class Client extends Composer {
1418
1384
  else if (-_4_constants_js_1.MAX_CHAT_ID <= id) {
1419
1385
  peer = { _: "inputPeerChat", chat_id: BigInt(Math.abs(id)) };
1420
1386
  }
1421
- else if (_1_utilities_js_1.ZERO_CHANNEL_ID - _4_constants_js_1.MAX_CHANNEL_ID <= id && id != _1_utilities_js_1.ZERO_CHANNEL_ID) {
1387
+ else if (_1_utilities_js_1.ZERO_CHANNEL_ID - _4_constants_js_1.MAX_CHANNEL_ID <= id && id !== _1_utilities_js_1.ZERO_CHANNEL_ID) {
1422
1388
  const accessHash = await this.messageStorage.getChannelAccessHash(id);
1423
1389
  peer = { _: "inputPeerChannel", channel_id: _2_tl_js_1.Api.chatIdToPeerId(id), access_hash: accessHash ?? 0n };
1424
1390
  }
@@ -1429,19 +1395,20 @@ class Client extends Composer {
1429
1395
  const chatId = _2_tl_js_1.Api.peerToChatId(peer);
1430
1396
  const minPeerReference = await this.messageStorage.getLastMinPeerReference(chatId);
1431
1397
  if (minPeerReference) {
1432
- const minInputPeer = await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getMinInputPeer).call(this, (0, _0_utilities_js_1.canBeInputChannel)(peer) ? "channel" : "user", { ...minPeerReference, senderId: chatId });
1398
+ const minInputPeer = await this.#getMinInputPeer((0, _0_utilities_js_1.canBeInputChannel)(peer) ? "channel" : "user", { ...minPeerReference, senderId: chatId });
1433
1399
  if (minInputPeer) {
1434
- __classPrivateFieldGet(this, _Client_Lmin, "f").debug("resolved input min peer", minInputPeer);
1400
+ this.#Lmin.debug("resolved input min peer", minInputPeer);
1435
1401
  peer = minInputPeer;
1436
1402
  }
1437
1403
  }
1438
1404
  }
1439
1405
  return peer;
1440
- }, _Client_getMinInputPeer = async function _Client_getMinInputPeer(type, reference) {
1406
+ }
1407
+ async #getMinInputPeer(type, reference) {
1441
1408
  const entity = await this.messageStorage.getEntity(reference.chatId);
1442
1409
  if (_2_tl_js_1.Api.isOneOf(["channel", "channelForbidden"], entity) && entity.access_hash) {
1443
1410
  const peer = { _: "inputPeerChannel", channel_id: entity.id, access_hash: entity.access_hash };
1444
- if (type == "user") {
1411
+ if (type === "user") {
1445
1412
  return { _: "inputPeerUserFromMessage", peer, msg_id: reference.messageId, user_id: _2_tl_js_1.Api.chatIdToPeerId(reference.senderId) };
1446
1413
  }
1447
1414
  else {
@@ -1451,10 +1418,11 @@ class Client extends Composer {
1451
1418
  else {
1452
1419
  return null;
1453
1420
  }
1454
- }, getEntity)](peer) {
1421
+ }
1422
+ async [getEntity](peer) {
1455
1423
  const id = _2_tl_js_1.Api.peerToChatId(peer);
1456
1424
  const entity = await this.messageStorage.getEntity(id);
1457
- if (entity == null && await this.storage.getAccountType() == "bot" && _2_tl_js_1.Api.is("peerUser", peer) || _2_tl_js_1.Api.is("peerChannel", peer)) {
1425
+ if (entity === null && await this.storage.getAccountType() === "bot" && _2_tl_js_1.Api.is("peerUser", peer) || _2_tl_js_1.Api.is("peerChannel", peer)) {
1458
1426
  await this.getInputPeer(id);
1459
1427
  }
1460
1428
  else {
@@ -1462,6 +1430,131 @@ class Client extends Composer {
1462
1430
  }
1463
1431
  return await this.messageStorage.getEntity(id);
1464
1432
  }
1433
+ async #handleCtxUpdate(update) {
1434
+ if (this.#disableUpdates && !("authorizationState" in update) && !("connectionState" in update)) {
1435
+ return;
1436
+ }
1437
+ try {
1438
+ await this.middleware()(await this.#constructContext(update), _0_utilities_js_1.resolve);
1439
+ }
1440
+ catch (err) {
1441
+ this.#L.error("Failed to handle update:", err);
1442
+ throw err;
1443
+ }
1444
+ }
1445
+ #queueHandleCtxUpdate(update) {
1446
+ this.#updateManager.getHandleUpdateQueue(_2_update_manager_js_1.UpdateManager.MAIN_BOX_ID).add(async () => {
1447
+ await this.#handleCtxUpdate(update);
1448
+ });
1449
+ }
1450
+ async #handleUpdate(update) {
1451
+ const promises = new Array();
1452
+ if (_2_tl_js_1.Api.is("updateUserName", update)) {
1453
+ await this.messageStorage.updateUsernames(Number(update.user_id), update.usernames.map((v) => v.username));
1454
+ const peer = { ...update, _: "peerUser" };
1455
+ const entity = await this[getEntity](peer);
1456
+ if (entity !== null) {
1457
+ entity.usernames = update.usernames;
1458
+ entity.first_name = update.first_name;
1459
+ entity.last_name = update.last_name;
1460
+ await this.messageStorage.setEntity(entity);
1461
+ }
1462
+ }
1463
+ if (this.#messageManager.canHandleUpdate(update)) {
1464
+ promises.push(() => this.#messageManager.handleUpdate(update));
1465
+ }
1466
+ if (this.#chatManager.canHandleUpdate(update)) {
1467
+ promises.push(() => this.#chatManager.handleUpdate(update));
1468
+ }
1469
+ if (this.#pollManager.canHandleUpdate(update)) {
1470
+ promises.push(() => this.#pollManager.handleUpdate(update));
1471
+ }
1472
+ if (this.#videoChatManager.canHandleUpdate(update)) {
1473
+ promises.push(() => this.#videoChatManager.handleUpdate(update));
1474
+ }
1475
+ if (this.#callbackQueryManager.canHandleUpdate(update)) {
1476
+ promises.push(() => this.#callbackQueryManager.handleUpdate(update));
1477
+ }
1478
+ if (this.#inlineQueryManager.canHandleUpdate(update)) {
1479
+ promises.push(() => this.#inlineQueryManager.handleUpdate(update));
1480
+ }
1481
+ if (this.#linkPreviewManager.canHandleUpdate(update)) {
1482
+ promises.push(() => this.#linkPreviewManager.handleUpdate(update));
1483
+ }
1484
+ if (this.#reactionManager.canHandleUpdate(update)) {
1485
+ promises.push(() => this.#reactionManager.handleUpdate(update));
1486
+ }
1487
+ if (this.#chatListManager.canHandleUpdate(update)) {
1488
+ promises.push(() => this.#chatListManager.handleUpdate(update));
1489
+ }
1490
+ if (this.#storyManager.canHandleUpdate(update)) {
1491
+ promises.push(() => this.#storyManager.handleUpdate(update));
1492
+ }
1493
+ if (this.#businessConnectionManager.canHandleUpdate(update)) {
1494
+ promises.push(() => this.#businessConnectionManager.handleUpdate(update));
1495
+ }
1496
+ if (this.#storyManager.canHandleUpdate(update)) {
1497
+ promises.push(() => this.#storyManager.handleUpdate(update));
1498
+ }
1499
+ if (this.#paymentManager.canHandleUpdate(update)) {
1500
+ promises.push(() => this.#paymentManager.handleUpdate(update));
1501
+ }
1502
+ if (this.#translationsManager.canHandleUpdate(update)) {
1503
+ promises.push(() => this.#translationsManager.handleUpdate(update));
1504
+ }
1505
+ return () => Promise.resolve().then(async () => {
1506
+ const updates = new Array();
1507
+ for (const promise of promises) {
1508
+ try {
1509
+ const update = await promise();
1510
+ if (update) {
1511
+ updates.push(update);
1512
+ }
1513
+ }
1514
+ catch (err) {
1515
+ this.#L.error("failed to construct update:", err);
1516
+ }
1517
+ }
1518
+ for (const update of updates) {
1519
+ try {
1520
+ await this.#handleCtxUpdate(update);
1521
+ }
1522
+ finally {
1523
+ if ("deletedMessages" in update) {
1524
+ for (const { chatId, messageId } of update.deletedMessages) {
1525
+ await this.messageStorage.setMessage(chatId, messageId, null);
1526
+ await this.#chatListManager.reassignChatLastMessage(chatId);
1527
+ }
1528
+ }
1529
+ }
1530
+ }
1531
+ });
1532
+ }
1533
+ #lastGetMe = null;
1534
+ async #getMe() {
1535
+ if (this.#lastGetMe !== null) {
1536
+ return this.#lastGetMe;
1537
+ }
1538
+ else {
1539
+ const user = await this.getMe();
1540
+ this.#lastGetMe = user;
1541
+ return user;
1542
+ }
1543
+ }
1544
+ #previouslyConnected = false;
1545
+ #lastConnectionState = false;
1546
+ #onConnectionStateChange(connected) {
1547
+ if (this.#lastConnectionState !== connected) {
1548
+ if (connected) {
1549
+ if (this.#previouslyConnected) {
1550
+ (0, _1_utilities_js_1.drop)(this.#updateManager.recoverUpdateGap("reconnect"));
1551
+ }
1552
+ this.#previouslyConnected = true;
1553
+ }
1554
+ const connectionState = connected ? "ready" : "notConnected";
1555
+ this.#queueHandleCtxUpdate({ connectionState });
1556
+ }
1557
+ }
1465
1558
  //
1466
1559
  // ========================= ACCOUNT ========================= //
1467
1560
  //
@@ -1471,15 +1564,15 @@ class Client extends Composer {
1471
1564
  * @method ac
1472
1565
  */
1473
1566
  async getMe() {
1474
- let user_ = await this[getEntity]({ _: "peerUser", user_id: BigInt(await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getSelfId).call(this)) });
1475
- if (user_ == null) {
1567
+ let user_ = await this[getEntity]({ _: "peerUser", user_id: BigInt(await this.#getSelfId()) });
1568
+ if (user_ === null) {
1476
1569
  const users = await this.invoke({ _: "users.getUsers", id: [{ _: "inputUserSelf" }] });
1477
1570
  user_ = _2_tl_js_1.Api.as("user", users[0]);
1478
1571
  await this.messageStorage.setEntity(user_);
1479
1572
  await this.storage.setIsPremium(user_.premium ?? false);
1480
1573
  }
1481
1574
  const user = (0, _3_types_js_1.constructUser)(user_);
1482
- __classPrivateFieldSet(this, _Client_lastGetMe, user, "f");
1575
+ this.#lastGetMe = user;
1483
1576
  return user;
1484
1577
  }
1485
1578
  /**
@@ -1490,7 +1583,7 @@ class Client extends Composer {
1490
1583
  * @param username The username to show.
1491
1584
  */
1492
1585
  async showUsername(id, username) {
1493
- await __classPrivateFieldGet(this, _Client_accountManager, "f").showUsername(id, username);
1586
+ await this.#accountManager.showUsername(id, username);
1494
1587
  }
1495
1588
  /**
1496
1589
  * Hide a username from the current account, a bot account, a supergroup, or a channel's profile. User-only.
@@ -1500,7 +1593,7 @@ class Client extends Composer {
1500
1593
  * @param username The username to hide.
1501
1594
  */
1502
1595
  async hideUsername(id, username) {
1503
- await __classPrivateFieldGet(this, _Client_accountManager, "f").hideUsername(id, username);
1596
+ await this.#accountManager.hideUsername(id, username);
1504
1597
  }
1505
1598
  /**
1506
1599
  * Reorder the usernames of the current account, a bot account, a supergroup, or a channel's profile. User-only.
@@ -1511,7 +1604,7 @@ class Client extends Composer {
1511
1604
  * @returns Whether the order was changed.
1512
1605
  */
1513
1606
  async reorderUsernames(id, order) {
1514
- return await __classPrivateFieldGet(this, _Client_accountManager, "f").reorderUsernames(id, order);
1607
+ return await this.#accountManager.reorderUsernames(id, order);
1515
1608
  }
1516
1609
  /**
1517
1610
  * Hide all usernames from a supergroup or a channel's profile. User-only.
@@ -1520,7 +1613,7 @@ class Client extends Composer {
1520
1613
  * @param id A supergroup ID or a channel ID.
1521
1614
  */
1522
1615
  async hideUsernames(id) {
1523
- return await __classPrivateFieldGet(this, _Client_accountManager, "f").hideUsernames(id);
1616
+ return await this.#accountManager.hideUsernames(id);
1524
1617
  }
1525
1618
  /**
1526
1619
  * Get a business connection. Bot-only.
@@ -1530,7 +1623,7 @@ class Client extends Composer {
1530
1623
  * @cache
1531
1624
  */
1532
1625
  async getBusinessConnection(id) {
1533
- return await __classPrivateFieldGet(this, _Client_businessConnectionManager, "f").getBusinessConnection(id);
1626
+ return await this.#businessConnectionManager.getBusinessConnection(id);
1534
1627
  }
1535
1628
  /**
1536
1629
  * Set the current account's online status. User-only.
@@ -1539,7 +1632,7 @@ class Client extends Composer {
1539
1632
  * @param online The new online status.
1540
1633
  */
1541
1634
  async setOnline(online) {
1542
- await __classPrivateFieldGet(this, _Client_accountManager, "f").setOnline(online);
1635
+ await this.#accountManager.setOnline(online);
1543
1636
  }
1544
1637
  /**
1545
1638
  * Set the current account's emoji status. User-only.
@@ -1548,7 +1641,7 @@ class Client extends Composer {
1548
1641
  * @param id The identifier of the emoji to be used as the new status.
1549
1642
  */
1550
1643
  async setEmojiStatus(id, params) {
1551
- await __classPrivateFieldGet(this, _Client_accountManager, "f").setEmojiStatus(id, params);
1644
+ await this.#accountManager.setEmojiStatus(id, params);
1552
1645
  }
1553
1646
  /**
1554
1647
  * Set the emoji status of a bot's user. Bot-only.
@@ -1558,7 +1651,7 @@ class Client extends Composer {
1558
1651
  * @param id The identifier of the emoji to be used as the new status.
1559
1652
  */
1560
1653
  async setUserEmojiStatus(userId, id, params) {
1561
- await __classPrivateFieldGet(this, _Client_accountManager, "f").setUserEmojiStatus(userId, id, params);
1654
+ await this.#accountManager.setUserEmojiStatus(userId, id, params);
1562
1655
  }
1563
1656
  /**
1564
1657
  * Update the profile of the current user. At least one parameter must be specified. User-only.
@@ -1566,7 +1659,7 @@ class Client extends Composer {
1566
1659
  * @method ac
1567
1660
  */
1568
1661
  async updateProfile(params) {
1569
- await __classPrivateFieldGet(this, _Client_accountManager, "f").updateProfile(params);
1662
+ await this.#accountManager.updateProfile(params);
1570
1663
  }
1571
1664
  /**
1572
1665
  * Set the birthday of the current user. User-only.
@@ -1574,7 +1667,7 @@ class Client extends Composer {
1574
1667
  * @method ac
1575
1668
  */
1576
1669
  async setBirthday(params) {
1577
- await __classPrivateFieldGet(this, _Client_accountManager, "f").setBirthday(params);
1670
+ await this.#accountManager.setBirthday(params);
1578
1671
  }
1579
1672
  /**
1580
1673
  * Set the personal channel of the current user. User-only.
@@ -1582,7 +1675,7 @@ class Client extends Composer {
1582
1675
  * @method ac
1583
1676
  */
1584
1677
  async setPersonalChannel(params) {
1585
- await __classPrivateFieldGet(this, _Client_accountManager, "f").setPersonalChannel(params);
1678
+ await this.#accountManager.setPersonalChannel(params);
1586
1679
  }
1587
1680
  /**
1588
1681
  * Set the name color of the current user. User-only.
@@ -1591,7 +1684,7 @@ class Client extends Composer {
1591
1684
  * @param color The identifier of the color to set.
1592
1685
  */
1593
1686
  async setNameColor(color, params) {
1594
- await __classPrivateFieldGet(this, _Client_accountManager, "f").setNameColor(color, params);
1687
+ await this.#accountManager.setNameColor(color, params);
1595
1688
  }
1596
1689
  /**
1597
1690
  * Set the profile color of the current user. User-only.
@@ -1600,7 +1693,7 @@ class Client extends Composer {
1600
1693
  * @param color The identifier of the color to set.
1601
1694
  */
1602
1695
  async setProfileColor(color, params) {
1603
- await __classPrivateFieldGet(this, _Client_accountManager, "f").setProfileColor(color, params);
1696
+ await this.#accountManager.setProfileColor(color, params);
1604
1697
  }
1605
1698
  /**
1606
1699
  * Set the location of the current user. User-only.
@@ -1608,7 +1701,7 @@ class Client extends Composer {
1608
1701
  * @method ac
1609
1702
  */
1610
1703
  async setLocation(params) {
1611
- await __classPrivateFieldGet(this, _Client_accountManager, "f").setLocation(params);
1704
+ await this.#accountManager.setLocation(params);
1612
1705
  }
1613
1706
  //
1614
1707
  // ========================= MESSAGES ========================= //
@@ -1622,7 +1715,7 @@ class Client extends Composer {
1622
1715
  * @returns The sent text message.
1623
1716
  */
1624
1717
  async sendMessage(chatId, text, params) {
1625
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendMessage(chatId, text, params);
1718
+ return await this.#messageManager.sendMessage(chatId, text, params);
1626
1719
  }
1627
1720
  /**
1628
1721
  * Send a photo.
@@ -1633,7 +1726,7 @@ class Client extends Composer {
1633
1726
  * @returns The sent photo.
1634
1727
  */
1635
1728
  async sendPhoto(chatId, photo, params) {
1636
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendPhoto(chatId, photo, params);
1729
+ return await this.#messageManager.sendPhoto(chatId, photo, params);
1637
1730
  }
1638
1731
  /**
1639
1732
  * Send a document.
@@ -1644,7 +1737,7 @@ class Client extends Composer {
1644
1737
  * @returns The sent document.
1645
1738
  */
1646
1739
  async sendDocument(chatId, document, params) {
1647
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendDocument(chatId, document, params);
1740
+ return await this.#messageManager.sendDocument(chatId, document, params);
1648
1741
  }
1649
1742
  /**
1650
1743
  * Send a sticker.
@@ -1655,7 +1748,7 @@ class Client extends Composer {
1655
1748
  * @returns The sent sticker.
1656
1749
  */
1657
1750
  async sendSticker(chatId, sticker, params) {
1658
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendSticker(chatId, sticker, params);
1751
+ return await this.#messageManager.sendSticker(chatId, sticker, params);
1659
1752
  }
1660
1753
  /**
1661
1754
  * Send a video.
@@ -1666,7 +1759,7 @@ class Client extends Composer {
1666
1759
  * @returns The sent video.
1667
1760
  */
1668
1761
  async sendVideo(chatId, video, params) {
1669
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVideo(chatId, video, params);
1762
+ return await this.#messageManager.sendVideo(chatId, video, params);
1670
1763
  }
1671
1764
  /**
1672
1765
  * Send an animation.
@@ -1677,7 +1770,7 @@ class Client extends Composer {
1677
1770
  * @returns The sent animation.
1678
1771
  */
1679
1772
  async sendAnimation(chatId, animation, params) {
1680
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendAnimation(chatId, animation, params);
1773
+ return await this.#messageManager.sendAnimation(chatId, animation, params);
1681
1774
  }
1682
1775
  /**
1683
1776
  * Send a voice message.
@@ -1688,7 +1781,7 @@ class Client extends Composer {
1688
1781
  * @returns The sent voice message.
1689
1782
  */
1690
1783
  async sendVoice(chatId, voice, params) {
1691
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVoice(chatId, voice, params);
1784
+ return await this.#messageManager.sendVoice(chatId, voice, params);
1692
1785
  }
1693
1786
  /**
1694
1787
  * Send an audio file.
@@ -1699,7 +1792,7 @@ class Client extends Composer {
1699
1792
  * @returns The sent audio filr.
1700
1793
  */
1701
1794
  async sendAudio(chatId, audio, params) {
1702
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendAudio(chatId, audio, params);
1795
+ return await this.#messageManager.sendAudio(chatId, audio, params);
1703
1796
  }
1704
1797
  /**
1705
1798
  * Send a media group.
@@ -1710,7 +1803,7 @@ class Client extends Composer {
1710
1803
  * @returns The sent messages.
1711
1804
  */
1712
1805
  async sendMediaGroup(chatId, media, params) {
1713
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendMediaGroup(chatId, media, params);
1806
+ return await this.#messageManager.sendMediaGroup(chatId, media, params);
1714
1807
  }
1715
1808
  /**
1716
1809
  * Send a video note.
@@ -1721,7 +1814,7 @@ class Client extends Composer {
1721
1814
  * @returns The sent video note.
1722
1815
  */
1723
1816
  async sendVideoNote(chatId, videoNote, params) {
1724
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVideoNote(chatId, videoNote, params);
1817
+ return await this.#messageManager.sendVideoNote(chatId, videoNote, params);
1725
1818
  }
1726
1819
  /**
1727
1820
  * Send a location.
@@ -1733,7 +1826,7 @@ class Client extends Composer {
1733
1826
  * @returns The sent location.
1734
1827
  */
1735
1828
  async sendLocation(chatId, latitude, longitude, params) {
1736
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendLocation(chatId, latitude, longitude, params);
1829
+ return await this.#messageManager.sendLocation(chatId, latitude, longitude, params);
1737
1830
  }
1738
1831
  /**
1739
1832
  * Send a contact.
@@ -1745,7 +1838,7 @@ class Client extends Composer {
1745
1838
  * @returns The sent contact.
1746
1839
  */
1747
1840
  async sendContact(chatId, firstName, number, params) {
1748
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendContact(chatId, firstName, number, params);
1841
+ return await this.#messageManager.sendContact(chatId, firstName, number, params);
1749
1842
  }
1750
1843
  /**
1751
1844
  * Send a dice.
@@ -1755,7 +1848,7 @@ class Client extends Composer {
1755
1848
  * @returns The sent dice.
1756
1849
  */
1757
1850
  async sendDice(chatId, params) {
1758
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendDice(chatId, params);
1851
+ return await this.#messageManager.sendDice(chatId, params);
1759
1852
  }
1760
1853
  /**
1761
1854
  * Send a venue.
@@ -1769,7 +1862,7 @@ class Client extends Composer {
1769
1862
  * @returns The sent venue.
1770
1863
  */
1771
1864
  async sendVenue(chatId, latitude, longitude, title, address, params) {
1772
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendVenue(chatId, latitude, longitude, title, address, params);
1865
+ return await this.#messageManager.sendVenue(chatId, latitude, longitude, title, address, params);
1773
1866
  }
1774
1867
  /**
1775
1868
  * Send a poll.
@@ -1781,7 +1874,7 @@ class Client extends Composer {
1781
1874
  * @returns The sent poll.
1782
1875
  */
1783
1876
  async sendPoll(chatId, question, options, params) {
1784
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendPoll(chatId, question, options, params);
1877
+ return await this.#messageManager.sendPoll(chatId, question, options, params);
1785
1878
  }
1786
1879
  /**
1787
1880
  * Send an invoice. Bot-only.
@@ -1796,7 +1889,7 @@ class Client extends Composer {
1796
1889
  * @returns The sent invoice.
1797
1890
  */
1798
1891
  async sendInvoice(chatId, title, description, payload, currency, prices, params) {
1799
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendInvoice(chatId, title, description, payload, currency, prices, params);
1892
+ return await this.#messageManager.sendInvoice(chatId, title, description, payload, currency, prices, params);
1800
1893
  }
1801
1894
  /**
1802
1895
  * Edit a message's text.
@@ -1808,7 +1901,7 @@ class Client extends Composer {
1808
1901
  * @returns The edited text message.
1809
1902
  */
1810
1903
  async editMessageText(chatId, messageId, text, params) {
1811
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").editMessageText(chatId, messageId, text, params);
1904
+ return await this.#messageManager.editMessageText(chatId, messageId, text, params);
1812
1905
  }
1813
1906
  /**
1814
1907
  * Edit a message's caption.
@@ -1820,7 +1913,7 @@ class Client extends Composer {
1820
1913
  * @returns The edited message.
1821
1914
  */
1822
1915
  async editMessageCaption(chatId, messageId, params) {
1823
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").editMessageCaption(chatId, messageId, params);
1916
+ return await this.#messageManager.editMessageCaption(chatId, messageId, params);
1824
1917
  }
1825
1918
  /**
1826
1919
  * Edit a message's media.
@@ -1832,7 +1925,7 @@ class Client extends Composer {
1832
1925
  * @returns The edited message.
1833
1926
  */
1834
1927
  async editMessageMedia(chatId, messageId, media, params) {
1835
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").editMessageMedia(chatId, messageId, media, params);
1928
+ return await this.#messageManager.editMessageMedia(chatId, messageId, media, params);
1836
1929
  }
1837
1930
  /**
1838
1931
  * Edit an inline message's media.
@@ -1842,7 +1935,7 @@ class Client extends Composer {
1842
1935
  * @param media The new media of the message.
1843
1936
  */
1844
1937
  async editInlineMessageMedia(inlineMessageId, media, params) {
1845
- await __classPrivateFieldGet(this, _Client_messageManager, "f").editInlineMessageMedia(inlineMessageId, media, params);
1938
+ await this.#messageManager.editInlineMessageMedia(inlineMessageId, media, params);
1846
1939
  }
1847
1940
  /**
1848
1941
  * Edit an inline message's text. Bot-only.
@@ -1852,7 +1945,7 @@ class Client extends Composer {
1852
1945
  * @param text The new text of the message.
1853
1946
  */
1854
1947
  async editInlineMessageText(inlineMessageId, text, params) {
1855
- await __classPrivateFieldGet(this, _Client_messageManager, "f").editInlineMessageText(inlineMessageId, text, params);
1948
+ await this.#messageManager.editInlineMessageText(inlineMessageId, text, params);
1856
1949
  }
1857
1950
  /**
1858
1951
  * Edit an inline message's caption. Bot-only.
@@ -1861,7 +1954,7 @@ class Client extends Composer {
1861
1954
  * @param inlineMessageId The identifier of the inline message.
1862
1955
  */
1863
1956
  async editInlineMessageCaption(inlineMessageId, params) {
1864
- await __classPrivateFieldGet(this, _Client_messageManager, "f").editInlineMessageCaption(inlineMessageId, params);
1957
+ await this.#messageManager.editInlineMessageCaption(inlineMessageId, params);
1865
1958
  }
1866
1959
  /**
1867
1960
  * Edit a message's reply markup.
@@ -1872,7 +1965,7 @@ class Client extends Composer {
1872
1965
  * @returns The edited message.
1873
1966
  */
1874
1967
  async editMessageReplyMarkup(chatId, messageId, params) {
1875
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").editMessageReplyMarkup(chatId, messageId, params);
1968
+ return await this.#messageManager.editMessageReplyMarkup(chatId, messageId, params);
1876
1969
  }
1877
1970
  /**
1878
1971
  * Edit an inline message's reply markup. Bot-only.
@@ -1881,7 +1974,7 @@ class Client extends Composer {
1881
1974
  * @param inlineMessageId The identifier of the inline message.
1882
1975
  */
1883
1976
  async editInlineMessageReplyMarkup(inlineMessageId, params) {
1884
- await __classPrivateFieldGet(this, _Client_messageManager, "f").editInlineMessageReplyMarkup(inlineMessageId, params);
1977
+ await this.#messageManager.editInlineMessageReplyMarkup(inlineMessageId, params);
1885
1978
  }
1886
1979
  /**
1887
1980
  * Edit a message's live location.
@@ -1894,7 +1987,7 @@ class Client extends Composer {
1894
1987
  * @returns The edited location message.
1895
1988
  */
1896
1989
  async editMessageLiveLocation(chatId, messageId, latitude, longitude, params) {
1897
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").editMessageLiveLocation(chatId, messageId, latitude, longitude, params);
1990
+ return await this.#messageManager.editMessageLiveLocation(chatId, messageId, latitude, longitude, params);
1898
1991
  }
1899
1992
  /**
1900
1993
  * Edit an inline message's live location. Bot-only.
@@ -1906,7 +1999,7 @@ class Client extends Composer {
1906
1999
  * @returns The edited location message.
1907
2000
  */
1908
2001
  async editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, params) {
1909
- await __classPrivateFieldGet(this, _Client_messageManager, "f").editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, params);
2002
+ await this.#messageManager.editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, params);
1910
2003
  }
1911
2004
  /**
1912
2005
  * Retrieve multiple messages.
@@ -1921,7 +2014,7 @@ class Client extends Composer {
1921
2014
  * @cache
1922
2015
  */
1923
2016
  async getMessages(chatId, messageIds) {
1924
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").getMessages(chatId, messageIds);
2017
+ return await this.#messageManager.getMessages(chatId, messageIds);
1925
2018
  }
1926
2019
  /**
1927
2020
  * Retrieve a single message.
@@ -1936,7 +2029,7 @@ class Client extends Composer {
1936
2029
  * @cache
1937
2030
  */
1938
2031
  async getMessage(chatId, messageId) {
1939
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").getMessage(chatId, messageId);
2032
+ return await this.#messageManager.getMessage(chatId, messageId);
1940
2033
  }
1941
2034
  /**
1942
2035
  * Retrieve a message using its link.
@@ -1949,7 +2042,7 @@ class Client extends Composer {
1949
2042
  * @returns The message that was linked to.
1950
2043
  */
1951
2044
  async resolveMessageLink(link) {
1952
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").resolveMessageLink(link);
2045
+ return await this.#messageManager.resolveMessageLink(link);
1953
2046
  }
1954
2047
  /**
1955
2048
  * Delete multiple messages.
@@ -1959,7 +2052,7 @@ class Client extends Composer {
1959
2052
  * @param messageIds The identifiers of the messages to delete.
1960
2053
  */
1961
2054
  async deleteMessages(chatId, messageIds, params) {
1962
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, messageIds, params);
2055
+ await this.#messageManager.deleteMessages(chatId, messageIds, params);
1963
2056
  }
1964
2057
  /**
1965
2058
  * Delete a single message.
@@ -1969,7 +2062,7 @@ class Client extends Composer {
1969
2062
  * @param messageId The identifier of the message to delete.
1970
2063
  */
1971
2064
  async deleteMessage(chatId, messageId, params) {
1972
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteMessages(chatId, [messageId], params);
2065
+ await this.#messageManager.deleteMessages(chatId, [messageId], params);
1973
2066
  }
1974
2067
  /**
1975
2068
  * Delete all messages sent by a specific member of a chat. User-only.
@@ -1979,7 +2072,7 @@ class Client extends Composer {
1979
2072
  * @param memberId The identifier of the member.
1980
2073
  */
1981
2074
  async deleteChatMemberMessages(chatId, memberId) {
1982
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatMemberMessages(chatId, memberId);
2075
+ await this.#messageManager.deleteChatMemberMessages(chatId, memberId);
1983
2076
  }
1984
2077
  /**
1985
2078
  * Delete multiple scheduled messages.
@@ -1989,7 +2082,7 @@ class Client extends Composer {
1989
2082
  * @param messageIds The identifiers of the scheduled messages to delete.
1990
2083
  */
1991
2084
  async deleteScheduledMessages(chatId, messageIds) {
1992
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteScheduledMessages(chatId, messageIds);
2085
+ await this.#messageManager.deleteScheduledMessages(chatId, messageIds);
1993
2086
  }
1994
2087
  /**
1995
2088
  * Delete a scheduled message.
@@ -1999,7 +2092,7 @@ class Client extends Composer {
1999
2092
  * @param messageId The identifier of the scheduled message to delete.
2000
2093
  */
2001
2094
  async deleteScheduledMessage(chatId, messageId) {
2002
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteScheduledMessage(chatId, messageId);
2095
+ await this.#messageManager.deleteScheduledMessage(chatId, messageId);
2003
2096
  }
2004
2097
  /**
2005
2098
  * Send multiple scheduled messages before their schedule.
@@ -2009,7 +2102,7 @@ class Client extends Composer {
2009
2102
  * @param messageIds The identifiers of the scheduled messages to send.
2010
2103
  */
2011
2104
  async sendScheduledMessages(chatId, messageIds) {
2012
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendScheduledMessages(chatId, messageIds);
2105
+ return await this.#messageManager.sendScheduledMessages(chatId, messageIds);
2013
2106
  }
2014
2107
  /**
2015
2108
  * Send a scheduled message before its schedule.
@@ -2019,7 +2112,7 @@ class Client extends Composer {
2019
2112
  * @param messageId The identifier of the scheduled message to send.
2020
2113
  */
2021
2114
  async sendScheduledMessage(chatId, messageId) {
2022
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").sendScheduledMessage(chatId, messageId);
2115
+ return await this.#messageManager.sendScheduledMessage(chatId, messageId);
2023
2116
  }
2024
2117
  /**
2025
2118
  * Pin a message in a chat.
@@ -2029,7 +2122,7 @@ class Client extends Composer {
2029
2122
  * @param messageId The identifier of the message.
2030
2123
  */
2031
2124
  async pinMessage(chatId, messageId, params) {
2032
- await __classPrivateFieldGet(this, _Client_messageManager, "f").pinMessage(chatId, messageId, params);
2125
+ await this.#messageManager.pinMessage(chatId, messageId, params);
2033
2126
  }
2034
2127
  /**
2035
2128
  * Unpin a pinned message.
@@ -2039,7 +2132,7 @@ class Client extends Composer {
2039
2132
  * @param messageId The identifier of the message.
2040
2133
  */
2041
2134
  async unpinMessage(chatId, messageId, params) {
2042
- await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessage(chatId, messageId, params);
2135
+ await this.#messageManager.unpinMessage(chatId, messageId, params);
2043
2136
  }
2044
2137
  /**
2045
2138
  * Unpin all pinned messages.
@@ -2048,7 +2141,7 @@ class Client extends Composer {
2048
2141
  * @param chatId The identifier of a chat.
2049
2142
  */
2050
2143
  async unpinMessages(chatId) {
2051
- await __classPrivateFieldGet(this, _Client_messageManager, "f").unpinMessages(chatId);
2144
+ await this.#messageManager.unpinMessages(chatId);
2052
2145
  }
2053
2146
  /**
2054
2147
  * Forward multiple messages.
@@ -2060,7 +2153,7 @@ class Client extends Composer {
2060
2153
  * @returns The forwarded messages.
2061
2154
  */
2062
2155
  async forwardMessages(from, to, messageIds, params) {
2063
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").forwardMessages(from, to, messageIds, params);
2156
+ return await this.#messageManager.forwardMessages(from, to, messageIds, params);
2064
2157
  }
2065
2158
  /**
2066
2159
  * Forward a single message.
@@ -2083,7 +2176,7 @@ class Client extends Composer {
2083
2176
  * @returns The new state of the poll.
2084
2177
  */
2085
2178
  async stopPoll(chatId, messageId, params) {
2086
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").stopPoll(chatId, messageId, params);
2179
+ return await this.#messageManager.stopPoll(chatId, messageId, params);
2087
2180
  }
2088
2181
  /**
2089
2182
  * Send a chat action.
@@ -2094,17 +2187,15 @@ class Client extends Composer {
2094
2187
  * @param messageThreadId The thread to send the chat action to.
2095
2188
  */
2096
2189
  async sendChatAction(chatId, action, params) {
2097
- await __classPrivateFieldGet(this, _Client_messageManager, "f").sendChatAction(chatId, action, params);
2190
+ await this.#messageManager.sendChatAction(chatId, action, params);
2098
2191
  }
2099
2192
  /**
2100
- * Search the messages of a chat. User-only.
2193
+ * Search for messages. User-only.
2101
2194
  *
2102
2195
  * @method ms
2103
- * @param chatId The identifier of a chat.
2104
- * @param query The message search query.
2105
2196
  */
2106
- async searchMessages(chatId, query, params) {
2107
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").searchMessages(chatId, query, params);
2197
+ async searchMessages(params) {
2198
+ return await this.#messageManager.searchMessages(params);
2108
2199
  }
2109
2200
  /**
2110
2201
  * Mark messages as read. User-only.
@@ -2114,7 +2205,7 @@ class Client extends Composer {
2114
2205
  * @param untilMessageId The identifier of the message that will be marked as read, along with any other unread messages before it.
2115
2206
  */
2116
2207
  async readMessages(chatId, untilMessageId) {
2117
- await __classPrivateFieldGet(this, _Client_messageManager, "f").readMessages(chatId, untilMessageId);
2208
+ await this.#messageManager.readMessages(chatId, untilMessageId);
2118
2209
  }
2119
2210
  /**
2120
2211
  * Start a bot. User-only.
@@ -2124,7 +2215,7 @@ class Client extends Composer {
2124
2215
  * @returns The start message.
2125
2216
  */
2126
2217
  async startBot(botId, params) {
2127
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").startBot(botId, params);
2218
+ return await this.#messageManager.startBot(botId, params);
2128
2219
  }
2129
2220
  /**
2130
2221
  * Transcribe a voice message. User-only.
@@ -2135,16 +2226,25 @@ class Client extends Composer {
2135
2226
  * @cache
2136
2227
  */
2137
2228
  async transcribeVoice(chatId, messageId) {
2138
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").transcribeVoice(chatId, messageId);
2229
+ return await this.#messageManager.transcribeVoice(chatId, messageId);
2139
2230
  }
2140
2231
  /**
2232
+ * Get a sticker set.
2233
+ *
2234
+ * @method ms
2235
+ * @param name The name of the sticker set or its link.
2236
+ */
2237
+ async getStickerSet(name) {
2238
+ return await this.#messageManager.getStickerSet(name);
2239
+ }
2240
+ /*
2141
2241
  * Get the link preview for a message that is about to be sent. User-only.
2142
2242
  *
2143
2243
  * @method ms
2144
2244
  * @param text The message's text.
2145
2245
  */
2146
2246
  async getLinkPreview(text, params) {
2147
- return await __classPrivateFieldGet(this, _Client_linkPreviewManager, "f").getLinkPreview(text, params);
2247
+ return await this.#linkPreviewManager.getLinkPreview(text, params);
2148
2248
  }
2149
2249
  /**
2150
2250
  * Open a mini app. User-only.
@@ -2155,7 +2255,33 @@ class Client extends Composer {
2155
2255
  * @cache
2156
2256
  */
2157
2257
  async openMiniApp(botId, chatId, params) {
2158
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").openMiniApp(botId, chatId, params);
2258
+ return await this.#messageManager.openMiniApp(botId, chatId, params);
2259
+ }
2260
+ /**
2261
+ * Get a progress ID that can be passed to relevant send* methods to receive upload progress updates for them.
2262
+ *
2263
+ * @method ms
2264
+ * @cache
2265
+ */
2266
+ async getProgressId() {
2267
+ return await this.#fileManager.getProgressId();
2268
+ }
2269
+ /**
2270
+ * Get messages saved from a specific chat.
2271
+ *
2272
+ * @method ms
2273
+ * @param chatId The identifier of a chat.
2274
+ */
2275
+ async getSavedMessages(chatId, params) {
2276
+ return await this.#messageManager.getSavedMessages(chatId, params);
2277
+ }
2278
+ /**
2279
+ * Get a list of saved chats.
2280
+ *
2281
+ * @method ms
2282
+ */
2283
+ async getSavedChats(params) {
2284
+ return await this.#messageManager.getSavedChats(params);
2159
2285
  }
2160
2286
  //
2161
2287
  // ========================= POLLS ========================= //
@@ -2169,7 +2295,7 @@ class Client extends Composer {
2169
2295
  * @param optionIndexes The indexes of the options to cast for.
2170
2296
  */
2171
2297
  async vote(chatId, messageId, optionIndexes) {
2172
- await __classPrivateFieldGet(this, _Client_pollManager, "f").vote(chatId, messageId, optionIndexes);
2298
+ await this.#pollManager.vote(chatId, messageId, optionIndexes);
2173
2299
  }
2174
2300
  /**
2175
2301
  * Retract a vote. User-only.
@@ -2179,7 +2305,7 @@ class Client extends Composer {
2179
2305
  * @param messageId The identifier of the message that includes the poll.
2180
2306
  */
2181
2307
  async retractVote(chatId, messageId) {
2182
- await __classPrivateFieldGet(this, _Client_pollManager, "f").retractVote(chatId, messageId);
2308
+ await this.#pollManager.retractVote(chatId, messageId);
2183
2309
  }
2184
2310
  //
2185
2311
  // ========================= FILES ========================= //
@@ -2198,7 +2324,7 @@ class Client extends Composer {
2198
2324
  * @cache file
2199
2325
  */
2200
2326
  async *download(fileId, params) {
2201
- for await (const chunk of __classPrivateFieldGet(this, _Client_fileManager, "f").download(fileId, params)) {
2327
+ for await (const chunk of this.#fileManager.download(fileId, params)) {
2202
2328
  yield chunk;
2203
2329
  }
2204
2330
  }
@@ -2211,7 +2337,7 @@ class Client extends Composer {
2211
2337
  * @cache
2212
2338
  */
2213
2339
  async getCustomEmojiStickers(id) {
2214
- return await __classPrivateFieldGet(this, _Client_fileManager, "f").getCustomEmojiStickers(id);
2340
+ return await this.#fileManager.getCustomEmojiStickers(id);
2215
2341
  }
2216
2342
  //
2217
2343
  // ========================= CHATS ========================= //
@@ -2222,7 +2348,7 @@ class Client extends Composer {
2222
2348
  * @method ch
2223
2349
  */
2224
2350
  async getChats(params) {
2225
- return await __classPrivateFieldGet(this, _Client_chatListManager, "f").getChats(params?.from, params?.after, params?.limit);
2351
+ return await this.#chatListManager.getChats(params?.from, params?.after, params?.limit);
2226
2352
  }
2227
2353
  /**
2228
2354
  * Get a chat.
@@ -2231,7 +2357,7 @@ class Client extends Composer {
2231
2357
  * @cache
2232
2358
  */
2233
2359
  async getChat(chatId) {
2234
- return await __classPrivateFieldGet(this, _Client_chatListManager, "f").getChat(chatId);
2360
+ return await this.#chatListManager.getChat(chatId);
2235
2361
  }
2236
2362
  /**
2237
2363
  * Get chat history. User-only.
@@ -2240,7 +2366,7 @@ class Client extends Composer {
2240
2366
  * @param chatId The identifier of a chat.
2241
2367
  */
2242
2368
  async getHistory(chatId, params) {
2243
- return await __classPrivateFieldGet(this, _Client_messageManager, "f").getHistory(chatId, params);
2369
+ return await this.#messageManager.getHistory(chatId, params);
2244
2370
  }
2245
2371
  /**
2246
2372
  * Set a chat's available reactions. User-only.
@@ -2250,7 +2376,7 @@ class Client extends Composer {
2250
2376
  * @param availableReactions The new available reactions.
2251
2377
  */
2252
2378
  async setAvailableReactions(chatId, availableReactions) {
2253
- await __classPrivateFieldGet(this, _Client_chatManager, "f").setAvailableReactions(chatId, availableReactions);
2379
+ await this.#chatManager.setAvailableReactions(chatId, availableReactions);
2254
2380
  }
2255
2381
  /**
2256
2382
  * Set a chat's photo.
@@ -2260,7 +2386,7 @@ class Client extends Composer {
2260
2386
  * @param photo A photo to set as the chat's photo.
2261
2387
  */
2262
2388
  async setChatPhoto(chatId, photo, params) {
2263
- await __classPrivateFieldGet(this, _Client_chatManager, "f").setChatPhoto(chatId, photo, params);
2389
+ await this.#chatManager.setChatPhoto(chatId, photo, params);
2264
2390
  }
2265
2391
  /**
2266
2392
  * Delete a chat's photo.
@@ -2269,7 +2395,7 @@ class Client extends Composer {
2269
2395
  * @param chatId The identifier of a chat.
2270
2396
  */
2271
2397
  async deleteChatPhoto(chatId) {
2272
- await __classPrivateFieldGet(this, _Client_chatManager, "f").deleteChatPhoto(chatId);
2398
+ await this.#chatManager.deleteChatPhoto(chatId);
2273
2399
  }
2274
2400
  /**
2275
2401
  * Ban a member from a chat.
@@ -2279,7 +2405,7 @@ class Client extends Composer {
2279
2405
  * @param memberId The identifier of the member.
2280
2406
  */
2281
2407
  async banChatMember(chatId, memberId, params) {
2282
- await __classPrivateFieldGet(this, _Client_chatManager, "f").banChatMember(chatId, memberId, params);
2408
+ await this.#chatManager.banChatMember(chatId, memberId, params);
2283
2409
  }
2284
2410
  /**
2285
2411
  * Unban a member from a chat.
@@ -2289,7 +2415,7 @@ class Client extends Composer {
2289
2415
  * @param memberId The identifier of the member.
2290
2416
  */
2291
2417
  async unbanChatMember(chatId, memberId) {
2292
- await __classPrivateFieldGet(this, _Client_chatManager, "f").unbanChatMember(chatId, memberId);
2418
+ await this.#chatManager.unbanChatMember(chatId, memberId);
2293
2419
  }
2294
2420
  /**
2295
2421
  * Kick a member from a chat. Same as a banChatMember call followed by unbanChatMember.
@@ -2299,8 +2425,8 @@ class Client extends Composer {
2299
2425
  * @param memberId The identifier of the member.
2300
2426
  */
2301
2427
  async kickChatMember(chatId, memberId) {
2302
- await __classPrivateFieldGet(this, _Client_chatManager, "f").banChatMember(chatId, memberId);
2303
- await __classPrivateFieldGet(this, _Client_chatManager, "f").unbanChatMember(chatId, memberId);
2428
+ await this.#chatManager.banChatMember(chatId, memberId);
2429
+ await this.#chatManager.unbanChatMember(chatId, memberId);
2304
2430
  }
2305
2431
  /**
2306
2432
  * Set the rights of a chat member.
@@ -2310,7 +2436,7 @@ class Client extends Composer {
2310
2436
  * @param memberId The identifier of the member.
2311
2437
  */
2312
2438
  async setChatMemberRights(chatId, memberId, params) {
2313
- await __classPrivateFieldGet(this, _Client_chatManager, "f").setChatMemberRights(chatId, memberId, params);
2439
+ await this.#chatManager.setChatMemberRights(chatId, memberId, params);
2314
2440
  }
2315
2441
  /**
2316
2442
  * Get the administrators of a chat.
@@ -2320,7 +2446,7 @@ class Client extends Composer {
2320
2446
  * @returns The chat's administrators.
2321
2447
  */
2322
2448
  async getChatAdministrators(chatId) {
2323
- return await __classPrivateFieldGet(this, _Client_chatListManager, "f").getChatAdministrators(chatId);
2449
+ return await this.#chatListManager.getChatAdministrators(chatId);
2324
2450
  }
2325
2451
  /**
2326
2452
  * Enable join requests in a chat. User-only.
@@ -2329,7 +2455,7 @@ class Client extends Composer {
2329
2455
  * @param chatId The identifier of a chat. Must be a channel or a supergroup.
2330
2456
  */
2331
2457
  async enableJoinRequests(chatId) {
2332
- await __classPrivateFieldGet(this, _Client_chatManager, "f").enableJoinRequests(chatId);
2458
+ await this.#chatManager.enableJoinRequests(chatId);
2333
2459
  }
2334
2460
  /**
2335
2461
  * Disable join requests in a chat. User-only.
@@ -2338,7 +2464,7 @@ class Client extends Composer {
2338
2464
  * @param chatId The identifier of a chat. Must be a channel or a supergroup.
2339
2465
  */
2340
2466
  async disableJoinRequests(chatId) {
2341
- await __classPrivateFieldGet(this, _Client_chatManager, "f").disableJoinRequests(chatId);
2467
+ await this.#chatManager.disableJoinRequests(chatId);
2342
2468
  }
2343
2469
  /**
2344
2470
  * Get inactive chats. User-only.
@@ -2347,7 +2473,7 @@ class Client extends Composer {
2347
2473
  * @retuns A list of inactive chats the current user is member of.
2348
2474
  */
2349
2475
  async getInactiveChats() {
2350
- return await __classPrivateFieldGet(this, _Client_accountManager, "f").getInactiveChats();
2476
+ return await this.#accountManager.getInactiveChats();
2351
2477
  }
2352
2478
  /**
2353
2479
  * Get the invite links created for a chat. User-only.
@@ -2357,7 +2483,7 @@ class Client extends Composer {
2357
2483
  * @returns The invite links created for the chat. This might be a subset of the results if they were less than `limit`. The parameters `afterDate` and `afterInviteLink` can be used for pagination.
2358
2484
  */
2359
2485
  async getCreatedInviteLinks(chatId, params) {
2360
- return await __classPrivateFieldGet(this, _Client_chatManager, "f").getCreatedInviteLinks(chatId, params);
2486
+ return await this.#chatManager.getCreatedInviteLinks(chatId, params);
2361
2487
  }
2362
2488
  /**
2363
2489
  * Join a chat. User-only.
@@ -2366,7 +2492,7 @@ class Client extends Composer {
2366
2492
  * @param chatId The identifier of a chat.
2367
2493
  */
2368
2494
  async joinChat(chatId) {
2369
- await __classPrivateFieldGet(this, _Client_chatManager, "f").joinChat(chatId);
2495
+ await this.#chatManager.joinChat(chatId);
2370
2496
  }
2371
2497
  /**
2372
2498
  * Leave a chat.
@@ -2375,7 +2501,7 @@ class Client extends Composer {
2375
2501
  * @param chatId The identifier of a chat.
2376
2502
  */
2377
2503
  async leaveChat(chatId) {
2378
- await __classPrivateFieldGet(this, _Client_chatManager, "f").leaveChat(chatId);
2504
+ await this.#chatManager.leaveChat(chatId);
2379
2505
  }
2380
2506
  /**
2381
2507
  * Get information on a user's chat membership.
@@ -2385,7 +2511,7 @@ class Client extends Composer {
2385
2511
  * @param userId The identifier of the user.
2386
2512
  */
2387
2513
  async getChatMember(chatId, userId) {
2388
- return await __classPrivateFieldGet(this, _Client_chatListManager, "f").getChatMember(chatId, userId);
2514
+ return await this.#chatListManager.getChatMember(chatId, userId);
2389
2515
  }
2390
2516
  /**
2391
2517
  * Get the members of a chat.
@@ -2394,7 +2520,7 @@ class Client extends Composer {
2394
2520
  * @param chatId The identifier of a chat.
2395
2521
  */
2396
2522
  async getChatMembers(chatId, params) {
2397
- return await __classPrivateFieldGet(this, _Client_chatListManager, "f").getChatMembers(chatId, params);
2523
+ return await this.#chatListManager.getChatMembers(chatId, params);
2398
2524
  }
2399
2525
  /**
2400
2526
  * Set a chat's sticker set.
@@ -2404,7 +2530,7 @@ class Client extends Composer {
2404
2530
  * @param setName The name of the set.
2405
2531
  */
2406
2532
  async setChatStickerSet(chatId, setName) {
2407
- await __classPrivateFieldGet(this, _Client_messageManager, "f").setChatStickerSet(chatId, setName);
2533
+ await this.#messageManager.setChatStickerSet(chatId, setName);
2408
2534
  }
2409
2535
  /**
2410
2536
  * Delete a chat's sticker set.
@@ -2413,7 +2539,7 @@ class Client extends Composer {
2413
2539
  * @param chatId The identifier of a chat. Must be a supergroup.
2414
2540
  */
2415
2541
  async deleteChatStickerSet(chatId) {
2416
- await __classPrivateFieldGet(this, _Client_messageManager, "f").deleteChatStickerSet(chatId);
2542
+ await this.#messageManager.deleteChatStickerSet(chatId);
2417
2543
  }
2418
2544
  /**
2419
2545
  * Set the number of boosts required to circument a chat's default restrictions. User-only.
@@ -2423,7 +2549,7 @@ class Client extends Composer {
2423
2549
  * @param boosts The number of boosts required to circumvent its restrictions.
2424
2550
  */
2425
2551
  async setBoostsRequiredToCircumventRestrictions(chatId, boosts) {
2426
- await __classPrivateFieldGet(this, _Client_chatManager, "f").setBoostsRequiredToCircumventRestrictions(chatId, boosts);
2552
+ await this.#chatManager.setBoostsRequiredToCircumventRestrictions(chatId, boosts);
2427
2553
  }
2428
2554
  /**
2429
2555
  * Create an invite link.
@@ -2433,7 +2559,7 @@ class Client extends Composer {
2433
2559
  * @returns The newly created invite link.
2434
2560
  */
2435
2561
  async createInviteLink(chatId, params) {
2436
- return await __classPrivateFieldGet(this, _Client_chatManager, "f").createInviteLink(chatId, params);
2562
+ return await this.#chatManager.createInviteLink(chatId, params);
2437
2563
  }
2438
2564
  /**
2439
2565
  * Approve a join request.
@@ -2443,7 +2569,7 @@ class Client extends Composer {
2443
2569
  * @param userId The user who made the join request.
2444
2570
  */
2445
2571
  async approveJoinRequest(chatId, userId) {
2446
- await __classPrivateFieldGet(this, _Client_chatManager, "f").approveJoinRequest(chatId, userId);
2572
+ await this.#chatManager.approveJoinRequest(chatId, userId);
2447
2573
  }
2448
2574
  /**
2449
2575
  * Decline a join request.
@@ -2453,7 +2579,7 @@ class Client extends Composer {
2453
2579
  * @param userId The user who made the join request.
2454
2580
  */
2455
2581
  async declineJoinRequest(chatId, userId) {
2456
- await __classPrivateFieldGet(this, _Client_chatManager, "f").declineJoinRequest(chatId, userId);
2582
+ await this.#chatManager.declineJoinRequest(chatId, userId);
2457
2583
  }
2458
2584
  /**
2459
2585
  * Approve all join requests. User-only.
@@ -2462,7 +2588,7 @@ class Client extends Composer {
2462
2588
  * @param chatId The identifier of a chat with the join requests.
2463
2589
  */
2464
2590
  async approveJoinRequests(chatId, params) {
2465
- await __classPrivateFieldGet(this, _Client_chatManager, "f").approveJoinRequests(chatId, params);
2591
+ await this.#chatManager.approveJoinRequests(chatId, params);
2466
2592
  }
2467
2593
  /**
2468
2594
  * Decline all join requests. User-only.
@@ -2471,7 +2597,7 @@ class Client extends Composer {
2471
2597
  * @param chatId The identifier of a chat with the join requests.
2472
2598
  */
2473
2599
  async declineJoinRequests(chatId, params) {
2474
- await __classPrivateFieldGet(this, _Client_chatManager, "f").declineJoinRequests(chatId, params);
2600
+ await this.#chatManager.declineJoinRequests(chatId, params);
2475
2601
  }
2476
2602
  /**
2477
2603
  * Get pending join requests in a chat. User-only.
@@ -2480,7 +2606,7 @@ class Client extends Composer {
2480
2606
  * @param chatId The identifier of a chat with the join requests.
2481
2607
  */
2482
2608
  async getJoinRequests(chatId, params) {
2483
- return await __classPrivateFieldGet(this, _Client_chatManager, "f").getJoinRequests(chatId, params);
2609
+ return await this.#chatManager.getJoinRequests(chatId, params);
2484
2610
  }
2485
2611
  /**
2486
2612
  * Add a single user to a chat.
@@ -2491,7 +2617,7 @@ class Client extends Composer {
2491
2617
  * @returns An array of FailedInvitation that has at most a length of 1. If empty, it means that the user was added.
2492
2618
  */
2493
2619
  async addChatMember(chatId, userId, params) {
2494
- return await __classPrivateFieldGet(this, _Client_chatManager, "f").addChatMember(chatId, userId, params);
2620
+ return await this.#chatManager.addChatMember(chatId, userId, params);
2495
2621
  }
2496
2622
  /**
2497
2623
  * Add multiple users at once to a channel or a supergroup.
@@ -2501,7 +2627,7 @@ class Client extends Composer {
2501
2627
  * @param userId The identifiers of the users to add to the channel or supergroup.
2502
2628
  */
2503
2629
  async addChatMembers(chatId, userIds) {
2504
- return await __classPrivateFieldGet(this, _Client_chatManager, "f").addChatMembers(chatId, userIds);
2630
+ return await this.#chatManager.addChatMembers(chatId, userIds);
2505
2631
  }
2506
2632
  /**
2507
2633
  * Open a chat.
@@ -2510,7 +2636,7 @@ class Client extends Composer {
2510
2636
  * @param chatId The identifier of a chat to open.
2511
2637
  */
2512
2638
  async openChat(chatId) {
2513
- await __classPrivateFieldGet(this, _Client_updateManager, "f").openChat(chatId);
2639
+ await this.#updateManager.openChat(chatId);
2514
2640
  }
2515
2641
  /**
2516
2642
  * Close a chat previously opened by openChat.
@@ -2519,7 +2645,7 @@ class Client extends Composer {
2519
2645
  * @param chatId The identifier of a chat to close.
2520
2646
  */
2521
2647
  async closeChat(chatId) {
2522
- await __classPrivateFieldGet(this, _Client_updateManager, "f").closeChat(chatId);
2648
+ await this.#updateManager.closeChat(chatId);
2523
2649
  }
2524
2650
  /**
2525
2651
  * Create a group. User-only.
@@ -2529,7 +2655,7 @@ class Client extends Composer {
2529
2655
  * @returns The created group.
2530
2656
  */
2531
2657
  async createGroup(title, params) {
2532
- return await __classPrivateFieldGet(this, _Client_chatListManager, "f").createGroup(title, params);
2658
+ return await this.#chatListManager.createGroup(title, params);
2533
2659
  }
2534
2660
  /**
2535
2661
  * Create a supergroup. User-only.
@@ -2539,7 +2665,7 @@ class Client extends Composer {
2539
2665
  * @returns The created supergroup.
2540
2666
  */
2541
2667
  async createSupergroup(title, params) {
2542
- return await __classPrivateFieldGet(this, _Client_chatListManager, "f").createSupergroup(title, params);
2668
+ return await this.#chatListManager.createSupergroup(title, params);
2543
2669
  }
2544
2670
  /**
2545
2671
  * Create a channel. User-only.
@@ -2549,7 +2675,7 @@ class Client extends Composer {
2549
2675
  * @returns The created channel.
2550
2676
  */
2551
2677
  async createChannel(title, params) {
2552
- return await __classPrivateFieldGet(this, _Client_chatListManager, "f").createChannel(title, params);
2678
+ return await this.#chatListManager.createChannel(title, params);
2553
2679
  }
2554
2680
  /**
2555
2681
  * Set the time to live of the messages of a chat. User-only.
@@ -2559,7 +2685,7 @@ class Client extends Composer {
2559
2685
  * @param messageTtl The time to live of the messages in seconds.
2560
2686
  */
2561
2687
  async setMessageTtl(chatId, messageTtl) {
2562
- await __classPrivateFieldGet(this, _Client_chatListManager, "f").setMessageTtl(chatId, messageTtl);
2688
+ await this.#chatListManager.setMessageTtl(chatId, messageTtl);
2563
2689
  }
2564
2690
  /**
2565
2691
  * Archive multiple chats. User-only.
@@ -2568,7 +2694,7 @@ class Client extends Composer {
2568
2694
  * @param chatIds The identifiers of the chats to archive.
2569
2695
  */
2570
2696
  async archiveChats(chatIds) {
2571
- await __classPrivateFieldGet(this, _Client_chatListManager, "f").archiveChats(chatIds);
2697
+ await this.#chatListManager.archiveChats(chatIds);
2572
2698
  }
2573
2699
  /**
2574
2700
  * Archive a single chat. User-only.
@@ -2577,7 +2703,7 @@ class Client extends Composer {
2577
2703
  * @param chatId The identifier of a chat.
2578
2704
  */
2579
2705
  async archiveChat(chatId) {
2580
- await __classPrivateFieldGet(this, _Client_chatListManager, "f").archiveChat(chatId);
2706
+ await this.#chatListManager.archiveChat(chatId);
2581
2707
  }
2582
2708
  /**
2583
2709
  * Unarchive multiple chats. User-only.
@@ -2586,7 +2712,7 @@ class Client extends Composer {
2586
2712
  * @param chatIds The identifiers of the chats to unarchive.
2587
2713
  */
2588
2714
  async unarchiveChats(chatIds) {
2589
- await __classPrivateFieldGet(this, _Client_chatListManager, "f").unarchiveChats(chatIds);
2715
+ await this.#chatListManager.unarchiveChats(chatIds);
2590
2716
  }
2591
2717
  /**
2592
2718
  * Unarchive a single chat. User-only.
@@ -2595,7 +2721,7 @@ class Client extends Composer {
2595
2721
  * @param chatId The identifier of a chat.
2596
2722
  */
2597
2723
  async unarchiveChat(chatId) {
2598
- await __classPrivateFieldGet(this, _Client_chatListManager, "f").unarchiveChat(chatId);
2724
+ await this.#chatListManager.unarchiveChat(chatId);
2599
2725
  }
2600
2726
  /**
2601
2727
  * Get common chats between a user and the current one. User-only.
@@ -2604,7 +2730,7 @@ class Client extends Composer {
2604
2730
  * @param userId The identifier of the user to get the common chats with them.
2605
2731
  */
2606
2732
  async getCommonChats(userId, params) {
2607
- return await __classPrivateFieldGet(this, _Client_chatListManager, "f").getCommonChats(userId, params);
2733
+ return await this.#chatListManager.getCommonChats(userId, params);
2608
2734
  }
2609
2735
  /**
2610
2736
  * Get the settings of a chat. User-only.
@@ -2613,7 +2739,7 @@ class Client extends Composer {
2613
2739
  * @param chatId The identifier of a chat.
2614
2740
  */
2615
2741
  async getChatSettings(chatId) {
2616
- return await __classPrivateFieldGet(this, _Client_chatListManager, "f").getChatSettings(chatId);
2742
+ return await this.#chatListManager.getChatSettings(chatId);
2617
2743
  }
2618
2744
  /**
2619
2745
  * Disable business bots in a private chat. User-only.
@@ -2622,7 +2748,7 @@ class Client extends Composer {
2622
2748
  * @param chatId The identifier of the private chat to disable business bots in.
2623
2749
  */
2624
2750
  async disableBusinessBots(chatId) {
2625
- await __classPrivateFieldGet(this, _Client_chatListManager, "f").disableBusinessBots(chatId);
2751
+ await this.#chatListManager.disableBusinessBots(chatId);
2626
2752
  }
2627
2753
  /**
2628
2754
  * Enable business bots in a private chat. User-only.
@@ -2631,7 +2757,7 @@ class Client extends Composer {
2631
2757
  * @param chatId The identifier of the private chat to enable business bots in.
2632
2758
  */
2633
2759
  async enableBusinessBots(chatId) {
2634
- await __classPrivateFieldGet(this, _Client_chatListManager, "f").enableBusinessBots(chatId);
2760
+ await this.#chatListManager.enableBusinessBots(chatId);
2635
2761
  }
2636
2762
  /**
2637
2763
  * Disable slow mode in a group. User-only.
@@ -2640,7 +2766,7 @@ class Client extends Composer {
2640
2766
  * @param chatId The identifier of the group to disable slow mode in.
2641
2767
  */
2642
2768
  async disableSlowMode(chatId) {
2643
- await __classPrivateFieldGet(this, _Client_chatManager, "f").disableSlowMode(chatId);
2769
+ await this.#chatManager.disableSlowMode(chatId);
2644
2770
  }
2645
2771
  /**
2646
2772
  * Change slow mode in a group. User-only.
@@ -2650,7 +2776,7 @@ class Client extends Composer {
2650
2776
  * @param duration New slow mode duration.
2651
2777
  */
2652
2778
  async setSlowMode(chatId, duration) {
2653
- await __classPrivateFieldGet(this, _Client_chatManager, "f").setSlowMode(chatId, duration);
2779
+ await this.#chatManager.setSlowMode(chatId, duration);
2654
2780
  }
2655
2781
  /**
2656
2782
  * Change the title of a chat.
@@ -2660,7 +2786,7 @@ class Client extends Composer {
2660
2786
  * @param title The new title.
2661
2787
  */
2662
2788
  async setChatTitle(chatId, title) {
2663
- await __classPrivateFieldGet(this, _Client_chatManager, "f").setChatTitle(chatId, title);
2789
+ await this.#chatManager.setChatTitle(chatId, title);
2664
2790
  }
2665
2791
  /**
2666
2792
  * Change the description of a chat.
@@ -2670,7 +2796,7 @@ class Client extends Composer {
2670
2796
  * @param description The new description.
2671
2797
  */
2672
2798
  async setChatDescription(chatId, description) {
2673
- await __classPrivateFieldGet(this, _Client_chatManager, "f").setChatDescription(chatId, description);
2799
+ await this.#chatManager.setChatDescription(chatId, description);
2674
2800
  }
2675
2801
  /**
2676
2802
  * Hide or show the member list of a group to non-admins. User-only.
@@ -2680,7 +2806,7 @@ class Client extends Composer {
2680
2806
  * @param visible Whether the member list of the group should be visible.
2681
2807
  */
2682
2808
  async setMemberListVisibility(chatId, visible) {
2683
- await __classPrivateFieldGet(this, _Client_chatManager, "f").setMemberListVisibility(chatId, visible);
2809
+ await this.#chatManager.setMemberListVisibility(chatId, visible);
2684
2810
  }
2685
2811
  /**
2686
2812
  * Enable or disable topics in a group. User-only.
@@ -2690,7 +2816,7 @@ class Client extends Composer {
2690
2816
  * @param enabled Whether topics should be enabled in the group.
2691
2817
  */
2692
2818
  async setTopicsEnabled(chatId, enabled) {
2693
- await __classPrivateFieldGet(this, _Client_chatManager, "f").setTopicsEnabled(chatId, enabled);
2819
+ await this.#chatManager.setTopicsEnabled(chatId, enabled);
2694
2820
  }
2695
2821
  /**
2696
2822
  * Enable or disable automatic anti-spam in a group. User-only.
@@ -2700,7 +2826,7 @@ class Client extends Composer {
2700
2826
  * @param enabled Whether automatic anti-spam should be enabled in the group.
2701
2827
  */
2702
2828
  async setAntispamEnabled(chatId, enabled) {
2703
- await __classPrivateFieldGet(this, _Client_chatManager, "f").setAntispamEnabled(chatId, enabled);
2829
+ await this.#chatManager.setAntispamEnabled(chatId, enabled);
2704
2830
  }
2705
2831
  /**
2706
2832
  * Enable or disable post signatures in a channel. User-only.
@@ -2710,7 +2836,7 @@ class Client extends Composer {
2710
2836
  * @param enabled Whether post signatures should be enabled in the channel.
2711
2837
  */
2712
2838
  async setSignaturesEnabled(chatId, enabled, params) {
2713
- await __classPrivateFieldGet(this, _Client_chatManager, "f").setSignaturesEnabled(chatId, enabled, params);
2839
+ await this.#chatManager.setSignaturesEnabled(chatId, enabled, params);
2714
2840
  }
2715
2841
  /**
2716
2842
  * Delete a chat. User-only.
@@ -2719,7 +2845,7 @@ class Client extends Composer {
2719
2845
  * @param chatId The identifier of a chat.
2720
2846
  */
2721
2847
  async deleteChat(chatId) {
2722
- await __classPrivateFieldGet(this, _Client_chatManager, "f").deleteChat(chatId);
2848
+ await this.#chatManager.deleteChat(chatId);
2723
2849
  }
2724
2850
  /**
2725
2851
  * Get discussion chat suggestions. User-only.
@@ -2727,7 +2853,7 @@ class Client extends Composer {
2727
2853
  * @method ch
2728
2854
  */
2729
2855
  async getDiscussionChatSuggestions() {
2730
- return await __classPrivateFieldGet(this, _Client_chatManager, "f").getDiscussionChatSuggestions();
2856
+ return await this.#chatManager.getDiscussionChatSuggestions();
2731
2857
  }
2732
2858
  /**
2733
2859
  * Set a channel's discussion chat. User-only.
@@ -2737,7 +2863,7 @@ class Client extends Composer {
2737
2863
  * @param discussionChatId The identifier of a chat to use as discussion for the channel.
2738
2864
  */
2739
2865
  async setDiscussionChat(chatId, discussionChatId) {
2740
- await __classPrivateFieldGet(this, _Client_chatManager, "f").setDiscussionChat(chatId, discussionChatId);
2866
+ await this.#chatManager.setDiscussionChat(chatId, discussionChatId);
2741
2867
  }
2742
2868
  /**
2743
2869
  * Transfer the ownership of a chat. User-only.
@@ -2748,7 +2874,7 @@ class Client extends Composer {
2748
2874
  * @param password The password of the current account.
2749
2875
  */
2750
2876
  async transferChatOwnership(chatId, userId, password) {
2751
- await __classPrivateFieldGet(this, _Client_chatManager, "f").transferChatOwnership(chatId, userId, password);
2877
+ await this.#chatManager.transferChatOwnership(chatId, userId, password);
2752
2878
  }
2753
2879
  /**
2754
2880
  * Create a forum topic.
@@ -2759,7 +2885,7 @@ class Client extends Composer {
2759
2885
  * @returns The created topic.
2760
2886
  */
2761
2887
  async createTopic(chatId, title, params) {
2762
- return await __classPrivateFieldGet(this, _Client_forumManager, "f").createTopic(chatId, title, params);
2888
+ return await this.#forumManager.createTopic(chatId, title, params);
2763
2889
  }
2764
2890
  /**
2765
2891
  * Edit a forum topic.
@@ -2771,7 +2897,7 @@ class Client extends Composer {
2771
2897
  * @returns The new topic.
2772
2898
  */
2773
2899
  async editTopic(chatId, topicId, title, params) {
2774
- return await __classPrivateFieldGet(this, _Client_forumManager, "f").editTopic(chatId, topicId, title, params);
2900
+ return await this.#forumManager.editTopic(chatId, topicId, title, params);
2775
2901
  }
2776
2902
  /**
2777
2903
  * Hide the general forum topic.
@@ -2780,7 +2906,7 @@ class Client extends Composer {
2780
2906
  * @param chatId The identifier of a chat.
2781
2907
  */
2782
2908
  async hideGeneralTopic(chatId) {
2783
- await __classPrivateFieldGet(this, _Client_forumManager, "f").hideGeneralTopic(chatId);
2909
+ await this.#forumManager.hideGeneralTopic(chatId);
2784
2910
  }
2785
2911
  /**
2786
2912
  * Show the general forum topic.
@@ -2789,7 +2915,7 @@ class Client extends Composer {
2789
2915
  * @param chatId The identifier of a chat.
2790
2916
  */
2791
2917
  async showGeneralTopic(chatId) {
2792
- await __classPrivateFieldGet(this, _Client_forumManager, "f").showGeneralTopic(chatId);
2918
+ await this.#forumManager.showGeneralTopic(chatId);
2793
2919
  }
2794
2920
  /**
2795
2921
  * Close a forum topic.
@@ -2799,7 +2925,7 @@ class Client extends Composer {
2799
2925
  * @param topicId The identifier of the topic.
2800
2926
  */
2801
2927
  async closeTopic(chatId, topicId) {
2802
- await __classPrivateFieldGet(this, _Client_forumManager, "f").closeTopic(chatId, topicId);
2928
+ await this.#forumManager.closeTopic(chatId, topicId);
2803
2929
  }
2804
2930
  /**
2805
2931
  * Reopen a forum topic.
@@ -2809,7 +2935,7 @@ class Client extends Composer {
2809
2935
  * @param topicId The identifier of the topic.
2810
2936
  */
2811
2937
  async reopenTopic(chatId, topicId) {
2812
- await __classPrivateFieldGet(this, _Client_forumManager, "f").reopenTopic(chatId, topicId);
2938
+ await this.#forumManager.reopenTopic(chatId, topicId);
2813
2939
  }
2814
2940
  /**
2815
2941
  * Pin a forum topic.
@@ -2819,7 +2945,7 @@ class Client extends Composer {
2819
2945
  * @param topicId The identifier of the topic.
2820
2946
  */
2821
2947
  async pinTopic(chatId, topicId) {
2822
- await __classPrivateFieldGet(this, _Client_forumManager, "f").pinTopic(chatId, topicId);
2948
+ await this.#forumManager.pinTopic(chatId, topicId);
2823
2949
  }
2824
2950
  /**
2825
2951
  * Unpin a forum topic.
@@ -2829,7 +2955,7 @@ class Client extends Composer {
2829
2955
  * @param topicId The identifier of the topic.
2830
2956
  */
2831
2957
  async unpinTopic(chatId, topicId) {
2832
- await __classPrivateFieldGet(this, _Client_forumManager, "f").unpinTopic(chatId, topicId);
2958
+ await this.#forumManager.unpinTopic(chatId, topicId);
2833
2959
  }
2834
2960
  //
2835
2961
  // ========================= CALLBACK QUERIES ========================= //
@@ -2845,7 +2971,7 @@ class Client extends Composer {
2845
2971
  * @cache
2846
2972
  */
2847
2973
  async sendCallbackQuery(botId, messageId, question) {
2848
- return await __classPrivateFieldGet(this, _Client_callbackQueryManager, "f").sendCallbackQuery(botId, messageId, question);
2974
+ return await this.#callbackQueryManager.sendCallbackQuery(botId, messageId, question);
2849
2975
  }
2850
2976
  /**
2851
2977
  * Answer a callback query. Bot-only.
@@ -2854,7 +2980,7 @@ class Client extends Composer {
2854
2980
  * @param id ID of the callback query to answer.
2855
2981
  */
2856
2982
  async answerCallbackQuery(id, params) {
2857
- await __classPrivateFieldGet(this, _Client_callbackQueryManager, "f").answerCallbackQuery(id, params);
2983
+ await this.#callbackQueryManager.answerCallbackQuery(id, params);
2858
2984
  }
2859
2985
  //
2860
2986
  // ========================= INLINE QUERIES ========================= //
@@ -2869,7 +2995,7 @@ class Client extends Composer {
2869
2995
  * @cache
2870
2996
  */
2871
2997
  async sendInlineQuery(botId, chatId, params) {
2872
- return await __classPrivateFieldGet(this, _Client_inlineQueryManager, "f").sendInlineQuery(botId, chatId, params);
2998
+ return await this.#inlineQueryManager.sendInlineQuery(botId, chatId, params);
2873
2999
  }
2874
3000
  /**
2875
3001
  * Answer an inline query. Bot-only.
@@ -2879,7 +3005,7 @@ class Client extends Composer {
2879
3005
  * @param results The results to answer with.
2880
3006
  */
2881
3007
  async answerInlineQuery(id, results, params) {
2882
- await __classPrivateFieldGet(this, _Client_inlineQueryManager, "f").answerInlineQuery(id, results, params);
3008
+ await this.#inlineQueryManager.answerInlineQuery(id, results, params);
2883
3009
  }
2884
3010
  //
2885
3011
  // ========================= BOTS ========================= //
@@ -2890,7 +3016,7 @@ class Client extends Composer {
2890
3016
  * @method bs
2891
3017
  */
2892
3018
  async setMyDescription(params) {
2893
- await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyDescription(params);
3019
+ await this.#botInfoManager.setMyDescription(params);
2894
3020
  }
2895
3021
  /**
2896
3022
  * Set the bot's name in the given language. Bot-only.
@@ -2898,7 +3024,7 @@ class Client extends Composer {
2898
3024
  * @method bs
2899
3025
  */
2900
3026
  async setMyName(params) {
2901
- await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyName(params);
3027
+ await this.#botInfoManager.setMyName(params);
2902
3028
  }
2903
3029
  /**
2904
3030
  * Set the bot's short description in the given language. Bot-only.
@@ -2906,7 +3032,7 @@ class Client extends Composer {
2906
3032
  * @method bs
2907
3033
  */
2908
3034
  async setMyShortDescription(params) {
2909
- await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyShortDescription(params);
3035
+ await this.#botInfoManager.setMyShortDescription(params);
2910
3036
  }
2911
3037
  /**
2912
3038
  * Get the bot's description in the given language. Bot-only.
@@ -2915,7 +3041,7 @@ class Client extends Composer {
2915
3041
  * @returns The current bot's description in the specified language.
2916
3042
  */
2917
3043
  async getMyDescription(params) {
2918
- return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyDescription(params);
3044
+ return await this.#botInfoManager.getMyDescription(params);
2919
3045
  }
2920
3046
  /**
2921
3047
  * Get the bot's name in the given language. Bot-only.
@@ -2924,7 +3050,7 @@ class Client extends Composer {
2924
3050
  * @returns The current bot's name in the specified language.
2925
3051
  */
2926
3052
  async getMyName(params) {
2927
- return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyName(params);
3053
+ return await this.#botInfoManager.getMyName(params);
2928
3054
  }
2929
3055
  /**
2930
3056
  * Get the bot's short description in the given language. Bot-only.
@@ -2933,7 +3059,7 @@ class Client extends Composer {
2933
3059
  * @returns The current bot's short description in the specified language.
2934
3060
  */
2935
3061
  async getMyShortDescription(params) {
2936
- return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyShortDescription(params);
3062
+ return await this.#botInfoManager.getMyShortDescription(params);
2937
3063
  }
2938
3064
  /**
2939
3065
  * Set the bot's commands in the given scope and/or language. Bot-only.
@@ -2942,7 +3068,7 @@ class Client extends Composer {
2942
3068
  * @param commands The commands to set.
2943
3069
  */
2944
3070
  async setMyCommands(commands, params) {
2945
- await __classPrivateFieldGet(this, _Client_botInfoManager, "f").setMyCommands(commands, params);
3071
+ await this.#botInfoManager.setMyCommands(commands, params);
2946
3072
  }
2947
3073
  /**
2948
3074
  * Get the bot's commands in the given scope and/or language. Bot-only.
@@ -2951,7 +3077,7 @@ class Client extends Composer {
2951
3077
  * @returns The current bot's commands in the specified language.
2952
3078
  */
2953
3079
  async getMyCommands(params) {
2954
- return await __classPrivateFieldGet(this, _Client_botInfoManager, "f").getMyCommands(params);
3080
+ return await this.#botInfoManager.getMyCommands(params);
2955
3081
  }
2956
3082
  //
2957
3083
  // ========================= REACTIONS ========================= //
@@ -2965,7 +3091,7 @@ class Client extends Composer {
2965
3091
  * @param reactions The new reactions.
2966
3092
  */
2967
3093
  async setReactions(chatId, messageId, reactions, params) {
2968
- await __classPrivateFieldGet(this, _Client_messageManager, "f").setReactions(chatId, messageId, reactions, params);
3094
+ await this.#messageManager.setReactions(chatId, messageId, reactions, params);
2969
3095
  }
2970
3096
  /**
2971
3097
  * Make a reaction to a message.
@@ -2976,7 +3102,7 @@ class Client extends Composer {
2976
3102
  * @param reaction The reaction to add.
2977
3103
  */
2978
3104
  async addReaction(chatId, messageId, reaction, params) {
2979
- await __classPrivateFieldGet(this, _Client_messageManager, "f").addReaction(chatId, messageId, reaction, params);
3105
+ await this.#messageManager.addReaction(chatId, messageId, reaction, params);
2980
3106
  }
2981
3107
  /**
2982
3108
  * Undo a reaction made to a message.
@@ -2987,7 +3113,7 @@ class Client extends Composer {
2987
3113
  * @param reaction The reaction to remove.
2988
3114
  */
2989
3115
  async removeReaction(chatId, messageId, reaction) {
2990
- await __classPrivateFieldGet(this, _Client_messageManager, "f").removeReaction(chatId, messageId, reaction);
3116
+ await this.#messageManager.removeReaction(chatId, messageId, reaction);
2991
3117
  }
2992
3118
  //
2993
3119
  // ========================= STORIES ========================= //
@@ -3000,7 +3126,7 @@ class Client extends Composer {
3000
3126
  * @returns The created story.
3001
3127
  */
3002
3128
  async createStory(chatId, content, params) {
3003
- return await __classPrivateFieldGet(this, _Client_storyManager, "f").createStory(chatId, content, params);
3129
+ return await this.#storyManager.createStory(chatId, content, params);
3004
3130
  }
3005
3131
  /**
3006
3132
  * Retrieve multiple stories. User-only.
@@ -3014,7 +3140,7 @@ class Client extends Composer {
3014
3140
  if (!storyIds.length) {
3015
3141
  return [];
3016
3142
  }
3017
- return await __classPrivateFieldGet(this, _Client_storyManager, "f").getStories(chatId, storyIds);
3143
+ return await this.#storyManager.getStories(chatId, storyIds);
3018
3144
  }
3019
3145
  /**
3020
3146
  * Retrieve a single story. User-only.
@@ -3025,7 +3151,7 @@ class Client extends Composer {
3025
3151
  * @returns The retrieved story.
3026
3152
  */
3027
3153
  async getStory(chatId, storyId) {
3028
- return await __classPrivateFieldGet(this, _Client_storyManager, "f").getStory(chatId, storyId);
3154
+ return await this.#storyManager.getStory(chatId, storyId);
3029
3155
  }
3030
3156
  /**
3031
3157
  * Delete multiple stories. User-only.
@@ -3035,7 +3161,7 @@ class Client extends Composer {
3035
3161
  * @param storyIds The identifiers of the stories to delete.
3036
3162
  */
3037
3163
  async deleteStories(chatId, storyIds) {
3038
- await __classPrivateFieldGet(this, _Client_storyManager, "f").deleteStories(chatId, storyIds);
3164
+ await this.#storyManager.deleteStories(chatId, storyIds);
3039
3165
  }
3040
3166
  /**
3041
3167
  * Delete a single story. User-only.
@@ -3045,7 +3171,7 @@ class Client extends Composer {
3045
3171
  * @param storyId The identifier of the story to delete.
3046
3172
  */
3047
3173
  async deleteStory(chatId, storyId) {
3048
- await __classPrivateFieldGet(this, _Client_storyManager, "f").deleteStory(chatId, storyId);
3174
+ await this.#storyManager.deleteStory(chatId, storyId);
3049
3175
  }
3050
3176
  /**
3051
3177
  * Add multiple stories to highlights. User-only.
@@ -3055,7 +3181,7 @@ class Client extends Composer {
3055
3181
  * @param storyIds The identifiers of the stories to add to highlights.
3056
3182
  */
3057
3183
  async addStoriesToHighlights(chatId, storyIds) {
3058
- await __classPrivateFieldGet(this, _Client_storyManager, "f").addStoriesToHighlights(chatId, storyIds);
3184
+ await this.#storyManager.addStoriesToHighlights(chatId, storyIds);
3059
3185
  }
3060
3186
  /**
3061
3187
  * Add a single story to highlights. User-only.
@@ -3065,7 +3191,7 @@ class Client extends Composer {
3065
3191
  * @param storyId The identifier of the story to add to highlights.
3066
3192
  */
3067
3193
  async addStoryToHighlights(chatId, storyId) {
3068
- await __classPrivateFieldGet(this, _Client_storyManager, "f").addStoryToHighlights(chatId, storyId);
3194
+ await this.#storyManager.addStoryToHighlights(chatId, storyId);
3069
3195
  }
3070
3196
  /**
3071
3197
  * Remove multiple stories from highlights. User-only.
@@ -3075,7 +3201,7 @@ class Client extends Composer {
3075
3201
  * @param storyIds The identifiers of the stories to remove from highlights.
3076
3202
  */
3077
3203
  async removeStoriesFromHighlights(chatId, storyIds) {
3078
- await __classPrivateFieldGet(this, _Client_storyManager, "f").removeStoriesFromHighlights(chatId, storyIds);
3204
+ await this.#storyManager.removeStoriesFromHighlights(chatId, storyIds);
3079
3205
  }
3080
3206
  /**
3081
3207
  * Remove a single story from highlights. User-only.
@@ -3085,7 +3211,7 @@ class Client extends Composer {
3085
3211
  * @param storyId The identifier of the story to remove from highlights.
3086
3212
  */
3087
3213
  async removeStoryFromHighlights(chatId, storyId) {
3088
- await __classPrivateFieldGet(this, _Client_storyManager, "f").removeStoryFromHighlights(chatId, storyId);
3214
+ await this.#storyManager.removeStoryFromHighlights(chatId, storyId);
3089
3215
  }
3090
3216
  //
3091
3217
  // ========================= MISC ========================= //
@@ -3096,7 +3222,7 @@ class Client extends Composer {
3096
3222
  * @method mc
3097
3223
  */
3098
3224
  async getNetworkStatistics() {
3099
- return await __classPrivateFieldGet(this, _Client_networkStatisticsManager, "f").getNetworkStatistics();
3225
+ return await this.#networkStatisticsManager.getNetworkStatistics();
3100
3226
  }
3101
3227
  /**
3102
3228
  * Block a user. User-only.
@@ -3105,7 +3231,7 @@ class Client extends Composer {
3105
3231
  * @param userId The identifier of the user to block.
3106
3232
  */
3107
3233
  async blockUser(userId) {
3108
- await __classPrivateFieldGet(this, _Client_messageManager, "f").blockUser(userId);
3234
+ await this.#messageManager.blockUser(userId);
3109
3235
  }
3110
3236
  /**
3111
3237
  * Unblock a user. User-only.
@@ -3114,7 +3240,7 @@ class Client extends Composer {
3114
3240
  * @param userId The identifier of the user to unblock.
3115
3241
  */
3116
3242
  async unblockUser(userId) {
3117
- await __classPrivateFieldGet(this, _Client_messageManager, "f").unblockUser(userId);
3243
+ await this.#messageManager.unblockUser(userId);
3118
3244
  }
3119
3245
  //
3120
3246
  // ========================= VIDEO CHATS ========================= //
@@ -3127,7 +3253,7 @@ class Client extends Composer {
3127
3253
  * @returns The started video chat.
3128
3254
  */
3129
3255
  async startVideoChat(chatId, params) {
3130
- return await __classPrivateFieldGet(this, _Client_videoChatManager, "f").startVideoChat(chatId, params);
3256
+ return await this.#videoChatManager.startVideoChat(chatId, params);
3131
3257
  }
3132
3258
  /**
3133
3259
  * Schedule a video chat. User-only.
@@ -3138,7 +3264,7 @@ class Client extends Composer {
3138
3264
  * @returns The scheduled video chat.
3139
3265
  */
3140
3266
  async scheduleVideoChat(chatId, startAt, params) {
3141
- return await __classPrivateFieldGet(this, _Client_videoChatManager, "f").scheduleVideoChat(chatId, startAt, params);
3267
+ return await this.#videoChatManager.scheduleVideoChat(chatId, startAt, params);
3142
3268
  }
3143
3269
  /**
3144
3270
  * Join a video chat. User-only.
@@ -3149,7 +3275,7 @@ class Client extends Composer {
3149
3275
  * @returns Parameters to be passed to the used WebRTC library.
3150
3276
  */
3151
3277
  async joinVideoChat(id, params_, params) {
3152
- return await __classPrivateFieldGet(this, _Client_videoChatManager, "f").joinVideoChat(id, params_, params);
3278
+ return await this.#videoChatManager.joinVideoChat(id, params_, params);
3153
3279
  }
3154
3280
  /**
3155
3281
  * Leave a video chat. User-only.
@@ -3158,7 +3284,7 @@ class Client extends Composer {
3158
3284
  * @param id The identifier of a video chat retrieved from getChat, startVideoChat, or scheduleVideoChat.
3159
3285
  */
3160
3286
  async leaveVideoChat(id) {
3161
- await __classPrivateFieldGet(this, _Client_videoChatManager, "f").leaveVideoChat(id);
3287
+ await this.#videoChatManager.leaveVideoChat(id);
3162
3288
  }
3163
3289
  /**
3164
3290
  * Join a live stream. User-only.
@@ -3167,7 +3293,7 @@ class Client extends Composer {
3167
3293
  * @param id The identifier of a video chat retrieved from getChat, startVideoChat, or scheduleVideoChat.
3168
3294
  */
3169
3295
  async joinLiveStream(id) {
3170
- await __classPrivateFieldGet(this, _Client_videoChatManager, "f").joinLiveStream(id);
3296
+ await this.#videoChatManager.joinLiveStream(id);
3171
3297
  }
3172
3298
  /**
3173
3299
  * Get a video chat. User-only.
@@ -3177,7 +3303,7 @@ class Client extends Composer {
3177
3303
  * @cache
3178
3304
  */
3179
3305
  async getVideoChat(id) {
3180
- return await __classPrivateFieldGet(this, _Client_videoChatManager, "f").getVideoChat(id);
3306
+ return await this.#videoChatManager.getVideoChat(id);
3181
3307
  }
3182
3308
  /**
3183
3309
  * Get live stream channels. User-only.
@@ -3186,7 +3312,7 @@ class Client extends Composer {
3186
3312
  * @param id The identifier of a video chat retrieved from getChat, startVideoChat, or scheduleVideoChat.
3187
3313
  */
3188
3314
  async getLiveStreamChannels(id) {
3189
- return await __classPrivateFieldGet(this, _Client_videoChatManager, "f").getLiveStreamChannels(id);
3315
+ return await this.#videoChatManager.getLiveStreamChannels(id);
3190
3316
  }
3191
3317
  /**
3192
3318
  * Download a live stream chunk. User-only.
@@ -3198,7 +3324,7 @@ class Client extends Composer {
3198
3324
  * @param timestamp Millisecond timestamp of the chunk to download.
3199
3325
  */
3200
3326
  async *downloadLiveStreamChunk(id, channelId, scale, timestamp, params) {
3201
- yield* __classPrivateFieldGet(this, _Client_videoChatManager, "f").downloadLiveStreamChunk(id, channelId, scale, timestamp, params);
3327
+ yield* this.#videoChatManager.downloadLiveStreamChunk(id, channelId, scale, timestamp, params);
3202
3328
  }
3203
3329
  //
3204
3330
  // ========================= PAYMENTS ========================= //
@@ -3211,7 +3337,7 @@ class Client extends Composer {
3211
3337
  * @param ok Whether the checkout is going to be processed.
3212
3338
  */
3213
3339
  async answerPreCheckoutQuery(preCheckoutQueryId, ok, params) {
3214
- await __classPrivateFieldGet(this, _Client_paymentManager, "f").answerPreCheckoutQuery(preCheckoutQueryId, ok, params);
3340
+ await this.#paymentManager.answerPreCheckoutQuery(preCheckoutQueryId, ok, params);
3215
3341
  }
3216
3342
  /**
3217
3343
  * Refund a star payment. Bot-only.
@@ -3221,7 +3347,7 @@ class Client extends Composer {
3221
3347
  * @param telegramPaymentChargeId The identifier of the charge.
3222
3348
  */
3223
3349
  async refundStarPayment(userId, telegramPaymentChargeId) {
3224
- await __classPrivateFieldGet(this, _Client_paymentManager, "f").refundStarPayment(userId, telegramPaymentChargeId);
3350
+ await this.#paymentManager.refundStarPayment(userId, telegramPaymentChargeId);
3225
3351
  }
3226
3352
  //
3227
3353
  // ========================= CONTACTS ========================= //
@@ -3232,7 +3358,7 @@ class Client extends Composer {
3232
3358
  * @method co
3233
3359
  */
3234
3360
  async getContacts() {
3235
- return await __classPrivateFieldGet(this, _Client_accountManager, "f").getContacts();
3361
+ return await this.#accountManager.getContacts();
3236
3362
  }
3237
3363
  /**
3238
3364
  * Delete multiple contacts. User-only.
@@ -3241,7 +3367,7 @@ class Client extends Composer {
3241
3367
  * @param userIds The identifiers of contacts to delete.
3242
3368
  */
3243
3369
  async deleteContacts(userIds) {
3244
- await __classPrivateFieldGet(this, _Client_accountManager, "f").deleteContacts(userIds);
3370
+ await this.#accountManager.deleteContacts(userIds);
3245
3371
  }
3246
3372
  /**
3247
3373
  * Delete a single contact. User-only.
@@ -3250,7 +3376,7 @@ class Client extends Composer {
3250
3376
  * @param userId The identifier of the contact to delete.
3251
3377
  */
3252
3378
  async deleteContact(userId) {
3253
- await __classPrivateFieldGet(this, _Client_accountManager, "f").deleteContact(userId);
3379
+ await this.#accountManager.deleteContact(userId);
3254
3380
  }
3255
3381
  /**
3256
3382
  * Add a contact. User-only.
@@ -3259,7 +3385,7 @@ class Client extends Composer {
3259
3385
  * @param userId The identifier of the user to add as contact.
3260
3386
  */
3261
3387
  async addContact(userId, params) {
3262
- await __classPrivateFieldGet(this, _Client_accountManager, "f").addContact(userId, params);
3388
+ await this.#accountManager.addContact(userId, params);
3263
3389
  }
3264
3390
  //
3265
3391
  // ========================= TRANSLATIONS ========================= //
@@ -3271,7 +3397,7 @@ class Client extends Composer {
3271
3397
  * @cache
3272
3398
  */
3273
3399
  async getTranslations(params) {
3274
- return await __classPrivateFieldGet(this, _Client_translationsManager, "f").getTranslations(params);
3400
+ return await this.#translationsManager.getTranslations(params);
3275
3401
  }
3276
3402
  //
3277
3403
  // ========================= GIFTS ========================= //
@@ -3282,7 +3408,7 @@ class Client extends Composer {
3282
3408
  * @method gf
3283
3409
  */
3284
3410
  async getGifts() {
3285
- return await __classPrivateFieldGet(this, _Client_giftManager, "f").getGifts();
3411
+ return await this.#giftManager.getGifts();
3286
3412
  }
3287
3413
  /**
3288
3414
  * Get gifts claimed by a user or a channel. User-only.
@@ -3291,7 +3417,7 @@ class Client extends Composer {
3291
3417
  * @param chatId The identifier of a user or a channel to get gifts for.
3292
3418
  */
3293
3419
  async getClaimedGifts(chatId, params) {
3294
- return await __classPrivateFieldGet(this, _Client_giftManager, "f").getClaimedGifts(chatId, params);
3420
+ return await this.#giftManager.getClaimedGifts(chatId, params);
3295
3421
  }
3296
3422
  /**
3297
3423
  * Send a gift.
@@ -3301,7 +3427,7 @@ class Client extends Composer {
3301
3427
  * @param giftId The identifier of the gift to send.
3302
3428
  */
3303
3429
  async sendGift(chatId, giftId, params) {
3304
- await __classPrivateFieldGet(this, _Client_giftManager, "f").sendGift(chatId, giftId, params);
3430
+ await this.#giftManager.sendGift(chatId, giftId, params);
3305
3431
  }
3306
3432
  /**
3307
3433
  * Sell a gift.
@@ -3311,7 +3437,7 @@ class Client extends Composer {
3311
3437
  * @param messageId The identifier of the service message announcing the receival of the gift.
3312
3438
  */
3313
3439
  async sellGift(userId, messageId) {
3314
- await __classPrivateFieldGet(this, _Client_giftManager, "f").sellGift(userId, messageId);
3440
+ await this.#giftManager.sellGift(userId, messageId);
3315
3441
  }
3316
3442
  /**
3317
3443
  * Get a gift using its slug.
@@ -3320,125 +3446,7 @@ class Client extends Composer {
3320
3446
  * @param slug The slug of a gift.
3321
3447
  */
3322
3448
  async getGift(slug) {
3323
- return await __classPrivateFieldGet(this, _Client_giftManager, "f").getGift(slug);
3449
+ return await this.#giftManager.getGift(slug);
3324
3450
  }
3325
3451
  }
3326
3452
  exports.Client = Client;
3327
- _Client_handleCtxUpdate = async function _Client_handleCtxUpdate(update) {
3328
- if (__classPrivateFieldGet(this, _Client_disableUpdates, "f") && !("authorizationState" in update) && !("connectionState" in update)) {
3329
- return;
3330
- }
3331
- try {
3332
- await this.middleware()(await __classPrivateFieldGet(this, _Client_constructContext, "f").call(this, update), _0_utilities_js_1.resolve);
3333
- }
3334
- catch (err) {
3335
- __classPrivateFieldGet(this, _Client_L, "f").error("Failed to handle update:", err);
3336
- throw err;
3337
- }
3338
- }, _Client_queueHandleCtxUpdate = function _Client_queueHandleCtxUpdate(update) {
3339
- __classPrivateFieldGet(this, _Client_updateManager, "f").getHandleUpdateQueue(_2_update_manager_js_1.UpdateManager.MAIN_BOX_ID).add(async () => {
3340
- await __classPrivateFieldGet(this, _Client_instances, "m", _Client_handleCtxUpdate).call(this, update);
3341
- });
3342
- }, _Client_handleUpdate = async function _Client_handleUpdate(update) {
3343
- const promises = new Array();
3344
- if (_2_tl_js_1.Api.is("updateUserName", update)) {
3345
- await this.messageStorage.updateUsernames(Number(update.user_id), update.usernames.map((v) => v.username));
3346
- const peer = { ...update, _: "peerUser" };
3347
- const entity = await this[getEntity](peer);
3348
- if (entity != null) {
3349
- entity.usernames = update.usernames;
3350
- entity.first_name = update.first_name;
3351
- entity.last_name = update.last_name;
3352
- await this.messageStorage.setEntity(entity);
3353
- }
3354
- }
3355
- if (__classPrivateFieldGet(this, _Client_messageManager, "f").canHandleUpdate(update)) {
3356
- promises.push(() => __classPrivateFieldGet(this, _Client_messageManager, "f").handleUpdate(update));
3357
- }
3358
- if (__classPrivateFieldGet(this, _Client_chatManager, "f").canHandleUpdate(update)) {
3359
- promises.push(() => __classPrivateFieldGet(this, _Client_chatManager, "f").handleUpdate(update));
3360
- }
3361
- if (__classPrivateFieldGet(this, _Client_pollManager, "f").canHandleUpdate(update)) {
3362
- promises.push(() => __classPrivateFieldGet(this, _Client_pollManager, "f").handleUpdate(update));
3363
- }
3364
- if (__classPrivateFieldGet(this, _Client_videoChatManager, "f").canHandleUpdate(update)) {
3365
- promises.push(() => __classPrivateFieldGet(this, _Client_videoChatManager, "f").handleUpdate(update));
3366
- }
3367
- if (__classPrivateFieldGet(this, _Client_callbackQueryManager, "f").canHandleUpdate(update)) {
3368
- promises.push(() => __classPrivateFieldGet(this, _Client_callbackQueryManager, "f").handleUpdate(update));
3369
- }
3370
- if (__classPrivateFieldGet(this, _Client_inlineQueryManager, "f").canHandleUpdate(update)) {
3371
- promises.push(() => __classPrivateFieldGet(this, _Client_inlineQueryManager, "f").handleUpdate(update));
3372
- }
3373
- if (__classPrivateFieldGet(this, _Client_linkPreviewManager, "f").canHandleUpdate(update)) {
3374
- promises.push(() => __classPrivateFieldGet(this, _Client_linkPreviewManager, "f").handleUpdate(update));
3375
- }
3376
- if (__classPrivateFieldGet(this, _Client_reactionManager, "f").canHandleUpdate(update)) {
3377
- promises.push(() => __classPrivateFieldGet(this, _Client_reactionManager, "f").handleUpdate(update));
3378
- }
3379
- if (__classPrivateFieldGet(this, _Client_chatListManager, "f").canHandleUpdate(update)) {
3380
- promises.push(() => __classPrivateFieldGet(this, _Client_chatListManager, "f").handleUpdate(update));
3381
- }
3382
- if (__classPrivateFieldGet(this, _Client_storyManager, "f").canHandleUpdate(update)) {
3383
- promises.push(() => __classPrivateFieldGet(this, _Client_storyManager, "f").handleUpdate(update));
3384
- }
3385
- if (__classPrivateFieldGet(this, _Client_businessConnectionManager, "f").canHandleUpdate(update)) {
3386
- promises.push(() => __classPrivateFieldGet(this, _Client_businessConnectionManager, "f").handleUpdate(update));
3387
- }
3388
- if (__classPrivateFieldGet(this, _Client_storyManager, "f").canHandleUpdate(update)) {
3389
- promises.push(() => __classPrivateFieldGet(this, _Client_storyManager, "f").handleUpdate(update));
3390
- }
3391
- if (__classPrivateFieldGet(this, _Client_paymentManager, "f").canHandleUpdate(update)) {
3392
- promises.push(() => __classPrivateFieldGet(this, _Client_paymentManager, "f").handleUpdate(update));
3393
- }
3394
- if (__classPrivateFieldGet(this, _Client_translationsManager, "f").canHandleUpdate(update)) {
3395
- promises.push(() => __classPrivateFieldGet(this, _Client_translationsManager, "f").handleUpdate(update));
3396
- }
3397
- return () => Promise.resolve().then(async () => {
3398
- const updates = new Array();
3399
- for (const promise of promises) {
3400
- try {
3401
- const update = await promise();
3402
- if (update) {
3403
- updates.push(update);
3404
- }
3405
- }
3406
- catch (err) {
3407
- __classPrivateFieldGet(this, _Client_L, "f").error("failed to construct update:", err);
3408
- }
3409
- }
3410
- for (const update of updates) {
3411
- try {
3412
- await __classPrivateFieldGet(this, _Client_instances, "m", _Client_handleCtxUpdate).call(this, update);
3413
- }
3414
- finally {
3415
- if ("deletedMessages" in update) {
3416
- for (const { chatId, messageId } of update.deletedMessages) {
3417
- await this.messageStorage.setMessage(chatId, messageId, null);
3418
- await __classPrivateFieldGet(this, _Client_chatListManager, "f").reassignChatLastMessage(chatId);
3419
- }
3420
- }
3421
- }
3422
- }
3423
- });
3424
- }, _Client_getMe = async function _Client_getMe() {
3425
- if (__classPrivateFieldGet(this, _Client_lastGetMe, "f") != null) {
3426
- return __classPrivateFieldGet(this, _Client_lastGetMe, "f");
3427
- }
3428
- else {
3429
- const user = await this.getMe();
3430
- __classPrivateFieldSet(this, _Client_lastGetMe, user, "f");
3431
- return user;
3432
- }
3433
- }, _Client_onConnectionStateChange = function _Client_onConnectionStateChange(connected) {
3434
- if (__classPrivateFieldGet(this, _Client_lastConnectionState, "f") != connected) {
3435
- if (connected) {
3436
- if (__classPrivateFieldGet(this, _Client_previouslyConnected, "f")) {
3437
- (0, _1_utilities_js_1.drop)(__classPrivateFieldGet(this, _Client_updateManager, "f").recoverUpdateGap("reconnect"));
3438
- }
3439
- __classPrivateFieldSet(this, _Client_previouslyConnected, true, "f");
3440
- }
3441
- const connectionState = connected ? "ready" : "notConnected";
3442
- __classPrivateFieldGet(this, _Client_instances, "m", _Client_queueHandleCtxUpdate).call(this, { connectionState });
3443
- }
3444
- };