@mtkruto/node 0.67.1 → 0.68.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 (355) hide show
  1. package/esm/0_errors.js +2 -6
  2. package/esm/3_errors.js +2 -12
  3. package/esm/3_transport.d.ts +3 -3
  4. package/esm/3_transport.js +3 -3
  5. package/esm/3_types.d.ts +8 -7
  6. package/esm/3_types.d.ts.map +1 -1
  7. package/esm/3_types.js +8 -7
  8. package/esm/4_errors.js +2 -12
  9. package/esm/_dnt.polyfills.d.ts +99 -0
  10. package/esm/_dnt.polyfills.d.ts.map +1 -1
  11. package/esm/_dnt.polyfills.js +127 -1
  12. package/esm/_dnt.test_polyfills.d.ts.map +1 -0
  13. package/esm/client/0_filters_test.d.ts.map +1 -1
  14. package/esm/client/0_markdown_test.d.ts.map +1 -1
  15. package/esm/client/0_params.d.ts +2 -0
  16. package/esm/client/0_params.d.ts.map +1 -1
  17. package/esm/client/0_password.d.ts +5 -5
  18. package/esm/client/0_password.d.ts.map +1 -1
  19. package/esm/client/0_password_test.d.ts.map +1 -1
  20. package/esm/client/0_storage_operations.js +143 -155
  21. package/esm/client/0_storage_operations_test.d.ts.map +1 -1
  22. package/esm/client/0_utilities.d.ts +1 -1
  23. package/esm/client/0_utilities_test.d.ts.map +1 -1
  24. package/esm/client/1_client_plain.js +4 -22
  25. package/esm/client/1_composer.js +8 -21
  26. package/esm/client/2_account_manager.js +85 -97
  27. package/esm/client/2_bot_info_manager.js +26 -38
  28. package/esm/client/2_business_connection_manager.js +10 -23
  29. package/esm/client/2_client_encrypted.js +194 -211
  30. package/esm/client/2_file_manager.d.ts +4 -3
  31. package/esm/client/2_file_manager.d.ts.map +1 -1
  32. package/esm/client/2_file_manager.js +268 -224
  33. package/esm/client/2_file_manager_test.d.ts.map +1 -1
  34. package/esm/client/2_network_statistics_manager.js +8 -21
  35. package/esm/client/2_payment_manager.js +7 -20
  36. package/esm/client/2_reaction_manager.js +7 -20
  37. package/esm/client/2_translations_manager.js +97 -107
  38. package/esm/client/2_update_manager.js +764 -759
  39. package/esm/client/3_client_encrypted_pool.js +10 -26
  40. package/esm/client/3_client_encrypted_pool_test.d.ts.map +1 -1
  41. package/esm/client/3_message_manager.d.ts +1 -1
  42. package/esm/client/3_message_manager.js +441 -448
  43. package/esm/client/3_message_manager_test.d.ts.map +1 -1
  44. package/esm/client/3_video_chat_manager.d.ts +1 -1
  45. package/esm/client/3_video_chat_manager.js +57 -68
  46. package/esm/client/4_callback_query_manager.js +18 -30
  47. package/esm/client/4_chat_list_manager.js +322 -318
  48. package/esm/client/4_chat_manager.js +118 -131
  49. package/esm/client/4_forum_manager.js +67 -73
  50. package/esm/client/4_gift_manager.js +16 -29
  51. package/esm/client/4_inline_query_manager.js +16 -28
  52. package/esm/client/4_link_preview_manager.js +6 -19
  53. package/esm/client/4_poll_manager.js +44 -57
  54. package/esm/client/4_story_manager.js +41 -53
  55. package/esm/client/5_client.d.ts +7 -0
  56. package/esm/client/5_client.d.ts.map +1 -1
  57. package/esm/client/5_client.js +1271 -1290
  58. package/esm/connection/1_connection_tcp.node.js +48 -65
  59. package/esm/connection/1_connection_web_socket.js +75 -91
  60. package/esm/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
  61. package/esm/deps/jsr.io/@std/assert/1.0.13/equals.js +4 -4
  62. package/esm/deps/jsr.io/@std/async/1.0.13/mux_async_iterator.js +31 -47
  63. package/esm/deps/jsr.io/@std/async/1.0.13/tee.js +11 -34
  64. package/esm/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
  65. package/esm/deps/jsr.io/@std/internal/1.0.10/build_message.d.ts.map +1 -0
  66. package/esm/deps/jsr.io/@std/internal/1.0.10/diff.d.ts.map +1 -0
  67. package/esm/deps/jsr.io/@std/internal/1.0.10/diff_str.d.ts.map +1 -0
  68. package/esm/deps/jsr.io/@std/internal/1.0.10/format.d.ts +29 -0
  69. package/esm/deps/jsr.io/@std/internal/1.0.10/format.d.ts.map +1 -0
  70. package/esm/deps/jsr.io/@std/internal/1.0.10/format.js +70 -0
  71. package/esm/deps/jsr.io/@std/internal/1.0.10/styles.d.ts.map +1 -0
  72. package/esm/deps/jsr.io/@std/internal/1.0.10/types.d.ts.map +1 -0
  73. package/esm/mod.js +2 -12
  74. package/esm/session/0_session_state.js +12 -38
  75. package/esm/session/1_session.js +49 -72
  76. package/esm/session/2_session_encrypted.js +324 -320
  77. package/esm/storage/1_utilities_test.d.ts.map +1 -1
  78. package/esm/storage/2_storage_indexed_db.js +26 -44
  79. package/esm/storage/2_storage_local_storage.node.js +12 -25
  80. package/esm/storage/2_storage_memory.js +24 -41
  81. package/esm/storage/2_storage_session_storage.js +3 -16
  82. package/esm/tl/0_utilities_test.d.ts.map +1 -1
  83. package/esm/tl/1_tl_reader.js +80 -88
  84. package/esm/tl/1_tl_reader_test.d.ts.map +1 -1
  85. package/esm/tl/1_tl_writer.js +155 -164
  86. package/esm/tl/1_tl_writer_test.d.ts.map +1 -1
  87. package/esm/tl/2_telegram.d.ts +9 -10
  88. package/esm/tl/2_telegram.d.ts.map +1 -1
  89. package/esm/tl/2_telegram.js +10 -10
  90. package/esm/transport/0_transport.js +1 -8
  91. package/esm/transport/1_transport_abridged.js +11 -24
  92. package/esm/transport/1_transport_intermediate.js +10 -23
  93. package/{script/transport/2_transport_provider.d.ts → esm/transport/1_transport_provider.d.ts} +1 -1
  94. package/esm/transport/{2_transport_provider.d.ts.map → 1_transport_provider.d.ts.map} +1 -1
  95. package/{script/transport/3_transport_provider_tcp.d.ts → esm/transport/2_transport_provider_tcp.d.ts} +2 -2
  96. package/esm/transport/{3_transport_provider_tcp.d.ts.map → 2_transport_provider_tcp.d.ts.map} +1 -1
  97. package/esm/transport/{3_transport_provider_tcp.js → 2_transport_provider_tcp.js} +1 -1
  98. package/esm/transport/{3_transport_provider_web_socket.d.ts → 2_transport_provider_web_socket.d.ts} +2 -2
  99. package/esm/transport/2_transport_provider_web_socket.d.ts.map +1 -0
  100. package/esm/transport/{3_transport_provider_web_socket.js → 2_transport_provider_web_socket.js} +1 -1
  101. package/esm/types/0_upload_progress.d.ts +29 -0
  102. package/esm/types/0_upload_progress.d.ts.map +1 -0
  103. package/esm/types/0_upload_progress.js +20 -0
  104. package/esm/types/{2_inline_keyboard_button.d.ts → 1_inline_keyboard_button.d.ts} +1 -1
  105. package/esm/types/{2_inline_keyboard_button.d.ts.map → 1_inline_keyboard_button.d.ts.map} +1 -1
  106. package/esm/types/1_sticker.d.ts +1 -1
  107. package/esm/types/1_sticker.d.ts.map +1 -1
  108. package/esm/types/2_chat.d.ts.map +1 -1
  109. package/esm/types/2_poll_answer.d.ts +19 -0
  110. package/esm/types/2_poll_answer.d.ts.map +1 -1
  111. package/esm/types/2_poll_answer.js +19 -0
  112. package/esm/types/2_pre_checkout_query.d.ts.map +1 -1
  113. package/esm/types/{3_reply_markup.d.ts → 2_reply_markup.d.ts} +2 -2
  114. package/esm/types/{3_reply_markup.d.ts.map → 2_reply_markup.d.ts.map} +1 -1
  115. package/esm/types/{3_reply_markup.js → 2_reply_markup.js} +1 -1
  116. package/esm/types/2_story_interactive_area.d.ts.map +1 -1
  117. package/esm/types/3_chat_member_updated.d.ts.map +1 -1
  118. package/esm/types/3_story.d.ts.map +1 -1
  119. package/esm/types/5_message.d.ts +1 -1
  120. package/esm/types/5_message.d.ts.map +1 -1
  121. package/esm/types/5_message.js +1 -1
  122. package/esm/types/6_inline_query_result.d.ts +1 -1
  123. package/esm/types/6_inline_query_result.js +1 -1
  124. package/esm/types/7_update.d.ts +21 -2
  125. package/esm/types/7_update.d.ts.map +1 -1
  126. package/esm/utilities/0_bigint_test.d.ts.map +1 -1
  127. package/esm/utilities/0_buffer.d.ts +1 -1
  128. package/esm/utilities/0_buffer.d.ts.map +1 -1
  129. package/esm/utilities/0_buffer_test.d.ts.map +1 -1
  130. package/esm/utilities/0_hash.d.ts +2 -2
  131. package/esm/utilities/0_hash.d.ts.map +1 -1
  132. package/esm/utilities/0_mutex.js +4 -19
  133. package/esm/utilities/0_part_stream.js +11 -25
  134. package/esm/utilities/0_part_stream_test.d.ts.map +1 -1
  135. package/esm/utilities/0_rle.d.ts +2 -2
  136. package/esm/utilities/0_rle.d.ts.map +1 -1
  137. package/esm/utilities/0_rle_test.d.ts.map +1 -1
  138. package/esm/utilities/0_text.d.ts +20 -1
  139. package/esm/utilities/0_text.d.ts.map +1 -1
  140. package/esm/utilities/0_text.js +19 -0
  141. package/esm/utilities/1_auth.d.ts +1 -1
  142. package/esm/utilities/1_auth.d.ts.map +1 -1
  143. package/esm/utilities/1_base64.d.ts +1 -1
  144. package/esm/utilities/1_base64.d.ts.map +1 -1
  145. package/esm/utilities/1_base64_test.d.ts.map +1 -1
  146. package/esm/utilities/1_crypto.js +42 -53
  147. package/esm/utilities/1_crypto_test.d.ts.map +1 -1
  148. package/esm/utilities/1_logger.d.ts +2 -2
  149. package/esm/utilities/1_math_test.d.ts.map +1 -1
  150. package/esm/utilities/2_queue.js +29 -47
  151. package/package.json +1 -1
  152. package/script/0_errors.js +2 -6
  153. package/script/2_tl.js +17 -7
  154. package/script/3_errors.js +2 -12
  155. package/script/3_transport.d.ts +3 -3
  156. package/script/3_transport.js +3 -3
  157. package/script/3_types.d.ts +8 -7
  158. package/script/3_types.d.ts.map +1 -1
  159. package/script/3_types.js +8 -7
  160. package/script/4_constants.js +17 -7
  161. package/script/4_errors.js +2 -12
  162. package/script/_dnt.polyfills.d.ts +99 -0
  163. package/script/_dnt.polyfills.d.ts.map +1 -1
  164. package/script/_dnt.polyfills.js +128 -0
  165. package/script/_dnt.test_polyfills.d.ts.map +1 -0
  166. package/script/client/0_filters_test.d.ts.map +1 -1
  167. package/script/client/0_markdown_test.d.ts.map +1 -1
  168. package/script/client/0_params.d.ts +2 -0
  169. package/script/client/0_params.d.ts.map +1 -1
  170. package/script/client/0_password.d.ts +5 -5
  171. package/script/client/0_password.d.ts.map +1 -1
  172. package/script/client/0_password.js +17 -7
  173. package/script/client/0_password_test.d.ts.map +1 -1
  174. package/script/client/0_storage_operations.js +143 -155
  175. package/script/client/0_storage_operations_test.d.ts.map +1 -1
  176. package/script/client/0_utilities.d.ts +1 -1
  177. package/script/client/0_utilities_test.d.ts.map +1 -1
  178. package/script/client/1_client_plain.js +4 -22
  179. package/script/client/1_composer.js +8 -21
  180. package/script/client/2_account_manager.js +85 -97
  181. package/script/client/2_bot_info_manager.js +26 -38
  182. package/script/client/2_business_connection_manager.js +10 -23
  183. package/script/client/2_client_encrypted.js +195 -212
  184. package/script/client/2_file_manager.d.ts +4 -3
  185. package/script/client/2_file_manager.d.ts.map +1 -1
  186. package/script/client/2_file_manager.js +285 -231
  187. package/script/client/2_file_manager_test.d.ts.map +1 -1
  188. package/script/client/2_network_statistics_manager.js +8 -21
  189. package/script/client/2_payment_manager.js +7 -20
  190. package/script/client/2_reaction_manager.js +7 -20
  191. package/script/client/2_translations_manager.js +98 -108
  192. package/script/client/2_update_manager.js +764 -759
  193. package/script/client/3_client_encrypted_pool.js +10 -26
  194. package/script/client/3_client_encrypted_pool_test.d.ts.map +1 -1
  195. package/script/client/3_message_manager.d.ts +1 -1
  196. package/script/client/3_message_manager.js +441 -448
  197. package/script/client/3_message_manager_test.d.ts.map +1 -1
  198. package/script/client/3_video_chat_manager.d.ts +1 -1
  199. package/script/client/3_video_chat_manager.js +57 -68
  200. package/script/client/4_callback_query_manager.js +18 -30
  201. package/script/client/4_chat_list_manager.js +322 -318
  202. package/script/client/4_chat_manager.js +118 -131
  203. package/script/client/4_forum_manager.js +67 -73
  204. package/script/client/4_gift_manager.js +16 -29
  205. package/script/client/4_inline_query_manager.js +16 -28
  206. package/script/client/4_link_preview_manager.js +6 -19
  207. package/script/client/4_poll_manager.js +44 -57
  208. package/script/client/4_story_manager.js +41 -53
  209. package/script/client/5_client.d.ts +7 -0
  210. package/script/client/5_client.d.ts.map +1 -1
  211. package/script/client/5_client.js +1271 -1290
  212. package/script/connection/1_connection_tcp.node.js +48 -65
  213. package/script/connection/1_connection_web_socket.js +92 -98
  214. package/script/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
  215. package/script/deps/jsr.io/@std/assert/1.0.13/equal.js +17 -7
  216. package/script/deps/jsr.io/@std/assert/1.0.13/equals.js +4 -4
  217. package/script/deps/jsr.io/@std/async/1.0.13/delay.js +17 -7
  218. package/script/deps/jsr.io/@std/async/1.0.13/mux_async_iterator.js +31 -47
  219. package/script/deps/jsr.io/@std/async/1.0.13/tee.js +11 -34
  220. package/script/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
  221. package/script/deps/jsr.io/@std/internal/1.0.10/build_message.d.ts.map +1 -0
  222. package/script/deps/jsr.io/@std/internal/1.0.10/diff.d.ts.map +1 -0
  223. package/script/deps/jsr.io/@std/internal/1.0.10/diff_str.d.ts.map +1 -0
  224. package/script/deps/jsr.io/@std/internal/1.0.10/format.d.ts +29 -0
  225. package/script/deps/jsr.io/@std/internal/1.0.10/format.d.ts.map +1 -0
  226. package/script/deps/jsr.io/@std/internal/1.0.10/format.js +106 -0
  227. package/script/deps/jsr.io/@std/internal/1.0.10/styles.d.ts.map +1 -0
  228. package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.js +17 -7
  229. package/script/deps/jsr.io/@std/internal/1.0.10/types.d.ts.map +1 -0
  230. package/script/deps/jsr.io/@std/path/1.1.0/_os.js +17 -7
  231. package/script/mod.js +19 -19
  232. package/script/session/0_session_state.js +12 -38
  233. package/script/session/1_session.js +66 -79
  234. package/script/session/2_session_encrypted.js +325 -321
  235. package/script/storage/1_utilities_test.d.ts.map +1 -1
  236. package/script/storage/2_storage_indexed_db.js +26 -44
  237. package/script/storage/2_storage_local_storage.node.js +12 -25
  238. package/script/storage/2_storage_memory.js +24 -41
  239. package/script/storage/2_storage_session_storage.js +3 -16
  240. package/script/tl/0_utilities_test.d.ts.map +1 -1
  241. package/script/tl/1_tl_reader.js +81 -89
  242. package/script/tl/1_tl_reader_test.d.ts.map +1 -1
  243. package/script/tl/1_tl_writer.js +156 -165
  244. package/script/tl/1_tl_writer_test.d.ts.map +1 -1
  245. package/script/tl/2_telegram.d.ts +9 -10
  246. package/script/tl/2_telegram.d.ts.map +1 -1
  247. package/script/tl/2_telegram.js +32 -10
  248. package/script/transport/0_obfuscation.js +17 -7
  249. package/script/transport/0_transport.js +1 -8
  250. package/script/transport/1_transport_abridged.js +11 -24
  251. package/script/transport/1_transport_intermediate.js +10 -23
  252. package/{esm/transport/2_transport_provider.d.ts → script/transport/1_transport_provider.d.ts} +1 -1
  253. package/script/transport/{2_transport_provider.d.ts.map → 1_transport_provider.d.ts.map} +1 -1
  254. package/{esm/transport/3_transport_provider_tcp.d.ts → script/transport/2_transport_provider_tcp.d.ts} +2 -2
  255. package/script/transport/{3_transport_provider_tcp.d.ts.map → 2_transport_provider_tcp.d.ts.map} +1 -1
  256. package/script/transport/{3_transport_provider_tcp.js → 2_transport_provider_tcp.js} +3 -3
  257. package/script/transport/{3_transport_provider_web_socket.d.ts → 2_transport_provider_web_socket.d.ts} +2 -2
  258. package/script/transport/2_transport_provider_web_socket.d.ts.map +1 -0
  259. package/script/transport/{3_transport_provider_web_socket.js → 2_transport_provider_web_socket.js} +2 -2
  260. package/script/types/0_upload_progress.d.ts +29 -0
  261. package/script/types/0_upload_progress.d.ts.map +1 -0
  262. package/script/types/0_upload_progress.js +21 -0
  263. package/script/types/{2_inline_keyboard_button.d.ts → 1_inline_keyboard_button.d.ts} +1 -1
  264. package/script/types/{2_inline_keyboard_button.d.ts.map → 1_inline_keyboard_button.d.ts.map} +1 -1
  265. package/script/types/1_sticker.d.ts +1 -1
  266. package/script/types/1_sticker.d.ts.map +1 -1
  267. package/script/types/2_chat.d.ts.map +1 -1
  268. package/script/types/2_poll_answer.d.ts +19 -0
  269. package/script/types/2_poll_answer.d.ts.map +1 -1
  270. package/script/types/2_poll_answer.js +19 -0
  271. package/script/types/2_pre_checkout_query.d.ts.map +1 -1
  272. package/script/types/{3_reply_markup.d.ts → 2_reply_markup.d.ts} +2 -2
  273. package/script/types/{3_reply_markup.d.ts.map → 2_reply_markup.d.ts.map} +1 -1
  274. package/script/types/{3_reply_markup.js → 2_reply_markup.js} +3 -3
  275. package/script/types/2_story_interactive_area.d.ts.map +1 -1
  276. package/script/types/3_chat_member_updated.d.ts.map +1 -1
  277. package/script/types/3_story.d.ts.map +1 -1
  278. package/script/types/5_message.d.ts +1 -1
  279. package/script/types/5_message.d.ts.map +1 -1
  280. package/script/types/5_message.js +2 -2
  281. package/script/types/6_inline_query_result.d.ts +1 -1
  282. package/script/types/6_inline_query_result.js +4 -4
  283. package/script/types/7_update.d.ts +21 -2
  284. package/script/types/7_update.d.ts.map +1 -1
  285. package/script/utilities/0_bigint.js +17 -7
  286. package/script/utilities/0_bigint_test.d.ts.map +1 -1
  287. package/script/utilities/0_buffer.d.ts +1 -1
  288. package/script/utilities/0_buffer.d.ts.map +1 -1
  289. package/script/utilities/0_buffer_test.d.ts.map +1 -1
  290. package/script/utilities/0_env.js +17 -7
  291. package/script/utilities/0_hash.d.ts +2 -2
  292. package/script/utilities/0_hash.d.ts.map +1 -1
  293. package/script/utilities/0_hash.js +17 -7
  294. package/script/utilities/0_misc.js +17 -7
  295. package/script/utilities/0_mutex.js +4 -19
  296. package/script/utilities/0_part_stream.js +11 -25
  297. package/script/utilities/0_part_stream_test.d.ts.map +1 -1
  298. package/script/utilities/0_rle.d.ts +2 -2
  299. package/script/utilities/0_rle.d.ts.map +1 -1
  300. package/script/utilities/0_rle_test.d.ts.map +1 -1
  301. package/script/utilities/0_text.d.ts +20 -1
  302. package/script/utilities/0_text.d.ts.map +1 -1
  303. package/script/utilities/0_text.js +19 -0
  304. package/script/utilities/1_auth.d.ts +1 -1
  305. package/script/utilities/1_auth.d.ts.map +1 -1
  306. package/script/utilities/1_auth.js +17 -7
  307. package/script/utilities/1_base64.d.ts +1 -1
  308. package/script/utilities/1_base64.d.ts.map +1 -1
  309. package/script/utilities/1_base64_test.d.ts.map +1 -1
  310. package/script/utilities/1_crypto.js +60 -61
  311. package/script/utilities/1_crypto_test.d.ts.map +1 -1
  312. package/script/utilities/1_logger.d.ts +2 -2
  313. package/script/utilities/1_math_test.d.ts.map +1 -1
  314. package/script/utilities/2_queue.js +30 -48
  315. package/esm/deps/jsr.io/@std/internal/1.0.9/build_message.d.ts.map +0 -1
  316. package/esm/deps/jsr.io/@std/internal/1.0.9/diff.d.ts.map +0 -1
  317. package/esm/deps/jsr.io/@std/internal/1.0.9/diff_str.d.ts.map +0 -1
  318. package/esm/deps/jsr.io/@std/internal/1.0.9/format.d.ts +0 -2
  319. package/esm/deps/jsr.io/@std/internal/1.0.9/format.d.ts.map +0 -1
  320. package/esm/deps/jsr.io/@std/internal/1.0.9/format.js +0 -37
  321. package/esm/deps/jsr.io/@std/internal/1.0.9/styles.d.ts.map +0 -1
  322. package/esm/deps/jsr.io/@std/internal/1.0.9/types.d.ts.map +0 -1
  323. package/esm/transport/3_transport_provider_web_socket.d.ts.map +0 -1
  324. package/script/deps/jsr.io/@std/internal/1.0.9/build_message.d.ts.map +0 -1
  325. package/script/deps/jsr.io/@std/internal/1.0.9/diff.d.ts.map +0 -1
  326. package/script/deps/jsr.io/@std/internal/1.0.9/diff_str.d.ts.map +0 -1
  327. package/script/deps/jsr.io/@std/internal/1.0.9/format.d.ts +0 -2
  328. package/script/deps/jsr.io/@std/internal/1.0.9/format.d.ts.map +0 -1
  329. package/script/deps/jsr.io/@std/internal/1.0.9/format.js +0 -63
  330. package/script/deps/jsr.io/@std/internal/1.0.9/styles.d.ts.map +0 -1
  331. package/script/deps/jsr.io/@std/internal/1.0.9/types.d.ts.map +0 -1
  332. package/script/transport/3_transport_provider_web_socket.d.ts.map +0 -1
  333. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.d.ts +0 -0
  334. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.js +0 -0
  335. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.d.ts +0 -0
  336. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.js +0 -0
  337. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.d.ts +0 -0
  338. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.js +0 -0
  339. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.d.ts +0 -0
  340. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.js +0 -0
  341. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.d.ts +0 -0
  342. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.js +0 -0
  343. /package/esm/transport/{2_transport_provider.js → 1_transport_provider.js} +0 -0
  344. /package/esm/types/{2_inline_keyboard_button.js → 1_inline_keyboard_button.js} +0 -0
  345. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.d.ts +0 -0
  346. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.js +0 -0
  347. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.d.ts +0 -0
  348. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.js +0 -0
  349. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.d.ts +0 -0
  350. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.js +0 -0
  351. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.d.ts +0 -0
  352. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.d.ts +0 -0
  353. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.js +0 -0
  354. /package/script/transport/{2_transport_provider.js → 1_transport_provider.js} +0 -0
  355. /package/script/types/{2_inline_keyboard_button.js → 1_inline_keyboard_button.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 __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
22
- if (kind === "m") throw new TypeError("Private method is not writable");
23
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
24
- 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");
25
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
26
- };
27
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
28
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
29
- 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");
30
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
31
- };
32
- var _ChatManager_instances, _ChatManager_c, _ChatManager_toggleJoinRequests, _ChatManager_toggleSlowMode;
33
21
  Object.defineProperty(exports, "__esModule", { value: true });
34
22
  exports.ChatManager = void 0;
35
23
  const _0_deps_js_1 = require("../0_deps.js");
@@ -46,18 +34,17 @@ const chatManagerUpdates = [
46
34
  "updateBotChatInviteRequester",
47
35
  ];
48
36
  class ChatManager {
37
+ #c;
49
38
  constructor(c) {
50
- _ChatManager_instances.add(this);
51
- _ChatManager_c.set(this, void 0);
52
- __classPrivateFieldSet(this, _ChatManager_c, c, "f");
39
+ this.#c = c;
53
40
  }
54
41
  canHandleUpdate(update) {
55
42
  return _2_tl_js_1.Api.isOneOf(chatManagerUpdates, update);
56
43
  }
57
44
  async handleUpdate(update) {
58
45
  if (_2_tl_js_1.Api.is("updateChannelParticipant", update) || _2_tl_js_1.Api.is("updateChatParticipant", update)) {
59
- const chatMember = await (0, _3_types_js_1.constructChatMemberUpdated)(update, __classPrivateFieldGet(this, _ChatManager_c, "f").getEntity);
60
- const selfId = await __classPrivateFieldGet(this, _ChatManager_c, "f").getSelfId();
46
+ const chatMember = await (0, _3_types_js_1.constructChatMemberUpdated)(update, this.#c.getEntity);
47
+ const selfId = await this.#c.getSelfId();
61
48
  if (chatMember.oldChatMember.user.id == selfId) {
62
49
  return { myChatMember: chatMember };
63
50
  }
@@ -66,51 +53,56 @@ class ChatManager {
66
53
  }
67
54
  }
68
55
  if (_2_tl_js_1.Api.is("updateBotChatInviteRequester", update)) {
69
- const joinRequest = await (0, _3_types_js_1.constructJoinRequest)(update, __classPrivateFieldGet(this, _ChatManager_c, "f").getEntity);
56
+ const joinRequest = await (0, _3_types_js_1.constructJoinRequest)(update, this.#c.getEntity);
70
57
  return { joinRequest };
71
58
  }
72
59
  return null;
73
60
  }
61
+ // JOIN REQUESTS //
62
+ async #toggleJoinRequests(chatId, enabled) {
63
+ const channel = await this.#c.getInputChannel(chatId);
64
+ await this.#c.invoke({ _: "channels.toggleJoinRequest", channel, enabled });
65
+ }
74
66
  async approveJoinRequest(chatId, userId) {
75
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({
67
+ await this.#c.invoke({
76
68
  _: "messages.hideChatJoinRequest",
77
- peer: await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId),
78
- user_id: await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputUser(userId),
69
+ peer: await this.#c.getInputPeer(chatId),
70
+ user_id: await this.#c.getInputUser(userId),
79
71
  approved: true,
80
72
  });
81
73
  }
82
74
  async declineJoinRequest(chatId, userId) {
83
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({
75
+ await this.#c.invoke({
84
76
  _: "messages.hideChatJoinRequest",
85
- peer: await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId),
86
- user_id: await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputUser(userId),
77
+ peer: await this.#c.getInputPeer(chatId),
78
+ user_id: await this.#c.getInputUser(userId),
87
79
  });
88
80
  }
89
81
  async approveJoinRequests(chatId, params) {
90
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("approveJoinRequests");
91
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({
82
+ this.#c.storage.assertUser("approveJoinRequests");
83
+ await this.#c.invoke({
92
84
  _: "messages.hideAllChatJoinRequests",
93
- peer: await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId),
85
+ peer: await this.#c.getInputPeer(chatId),
94
86
  approved: true,
95
87
  link: params?.inviteLink,
96
88
  });
97
89
  }
98
90
  async declineJoinRequests(chatId, params) {
99
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("declineJoinRequests");
100
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({
91
+ this.#c.storage.assertUser("declineJoinRequests");
92
+ await this.#c.invoke({
101
93
  _: "messages.hideAllChatJoinRequests",
102
- peer: await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId),
94
+ peer: await this.#c.getInputPeer(chatId),
103
95
  link: params?.inviteLink,
104
96
  });
105
97
  }
106
98
  async getJoinRequests(chatId, params) {
107
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("getJoinRequests");
99
+ this.#c.storage.assertUser("getJoinRequests");
108
100
  if (typeof params?.inviteLink === "string" && typeof params?.search === "string") {
109
101
  throw new _0_errors_js_1.InputError("inviteLink and search cannot be specified together.");
110
102
  }
111
- const peer = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
112
- const offset_user = params?.fromUserId ? await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputUser(params.fromUserId) : { _: "inputUserEmpty" };
113
- const { importers } = await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({
103
+ const peer = await this.#c.getInputPeer(chatId);
104
+ const offset_user = params?.fromUserId ? await this.#c.getInputUser(params.fromUserId) : { _: "inputUserEmpty" };
105
+ const { importers } = await this.#c.invoke({
114
106
  _: "messages.getChatInviteImporters",
115
107
  requested: true,
116
108
  peer,
@@ -121,48 +113,48 @@ class ChatManager {
121
113
  limit: (0, _0_utilities_js_1.getLimit)(params?.limit),
122
114
  });
123
115
  const peer_ = (0, _2_telegram_js_1.inputPeerToPeer)(peer);
124
- return await Promise.all(importers.map((v) => (0, _3_types_js_1.constructJoinRequest2)(peer_, v, __classPrivateFieldGet(this, _ChatManager_c, "f").getEntity)));
116
+ return await Promise.all(importers.map((v) => (0, _3_types_js_1.constructJoinRequest2)(peer_, v, this.#c.getEntity)));
125
117
  }
126
118
  // INVITE LINKS //
127
119
  async createInviteLink(chatId, params) {
128
120
  if (params?.requireApproval && params?.limit) {
129
121
  throw new _0_errors_js_1.InputError("requireApproval cannot be true while limit is specified.");
130
122
  }
131
- const result = await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.exportChatInvite", peer: await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId), title: params?.title, expire_date: params?.expireAt, request_needed: params?.requireApproval ? true : undefined, usage_limit: params?.limit });
132
- return await (0, _3_types_js_1.constructInviteLink)(_2_tl_js_1.Api.as("chatInviteExported", result), __classPrivateFieldGet(this, _ChatManager_c, "f").getEntity);
123
+ const result = await this.#c.invoke({ _: "messages.exportChatInvite", peer: await this.#c.getInputPeer(chatId), title: params?.title, expire_date: params?.expireAt, request_needed: params?.requireApproval ? true : undefined, usage_limit: params?.limit });
124
+ return await (0, _3_types_js_1.constructInviteLink)(_2_tl_js_1.Api.as("chatInviteExported", result), this.#c.getEntity);
133
125
  }
134
126
  async getCreatedInviteLinks(chatId, params) {
135
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("getCreatedInviteLinks");
136
- const { invites } = await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.getExportedChatInvites", peer: await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId), revoked: params?.revoked ? true : undefined, admin_id: params?.by ? await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputUser(params.by) : { _: "inputUserEmpty" }, limit: (0, _0_utilities_js_1.getLimit)(params?.limit), offset_date: params?.afterDate, offset_link: params?.afterInviteLink });
137
- return await Promise.all(invites.map((v) => _2_tl_js_1.Api.as("chatInviteExported", v)).map((v) => (0, _3_types_js_1.constructInviteLink)(v, __classPrivateFieldGet(this, _ChatManager_c, "f").getEntity)));
127
+ this.#c.storage.assertUser("getCreatedInviteLinks");
128
+ const { invites } = await this.#c.invoke({ _: "messages.getExportedChatInvites", peer: await this.#c.getInputPeer(chatId), revoked: params?.revoked ? true : undefined, admin_id: params?.by ? await this.#c.getInputUser(params.by) : { _: "inputUserEmpty" }, limit: (0, _0_utilities_js_1.getLimit)(params?.limit), offset_date: params?.afterDate, offset_link: params?.afterInviteLink });
129
+ return await Promise.all(invites.map((v) => _2_tl_js_1.Api.as("chatInviteExported", v)).map((v) => (0, _3_types_js_1.constructInviteLink)(v, this.#c.getEntity)));
138
130
  }
139
131
  // JOINING AND LEAVING CHATS //
140
132
  async joinChat(chatId) {
141
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("joinChat");
142
- const peer = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
133
+ this.#c.storage.assertUser("joinChat");
134
+ const peer = await this.#c.getInputPeer(chatId);
143
135
  if ((0, _0_utilities_js_1.canBeInputUser)(peer)) {
144
136
  throw new _0_errors_js_1.InputError("Cannot join private chats.");
145
137
  }
146
138
  else if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
147
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.joinChannel", channel: (0, _0_utilities_js_1.toInputChannel)(peer) });
139
+ await this.#c.invoke({ _: "channels.joinChannel", channel: (0, _0_utilities_js_1.toInputChannel)(peer) });
148
140
  }
149
141
  else if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
150
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.addChatUser", chat_id: peer.chat_id, user_id: { _: "inputUserSelf" }, fwd_limit: 0 }); // TODO: use potential high-level method for adding participants to chats
142
+ await this.#c.invoke({ _: "messages.addChatUser", chat_id: peer.chat_id, user_id: { _: "inputUserSelf" }, fwd_limit: 0 }); // TODO: use potential high-level method for adding participants to chats
151
143
  }
152
144
  else {
153
145
  (0, _0_deps_js_1.unreachable)();
154
146
  }
155
147
  }
156
148
  async leaveChat(chatId) {
157
- const peer = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
149
+ const peer = await this.#c.getInputPeer(chatId);
158
150
  if ((0, _0_utilities_js_1.canBeInputUser)(peer)) {
159
151
  throw new _0_errors_js_1.InputError("Cannot leave private chats.");
160
152
  }
161
153
  else if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
162
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.leaveChannel", channel: (0, _0_utilities_js_1.toInputChannel)(peer) });
154
+ await this.#c.invoke({ _: "channels.leaveChannel", channel: (0, _0_utilities_js_1.toInputChannel)(peer) });
163
155
  }
164
156
  else if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
165
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.deleteChatUser", chat_id: peer.chat_id, user_id: { _: "inputUserSelf" } }); // TODO: use potential high-level method for adding participants to chats
157
+ await this.#c.invoke({ _: "messages.deleteChatUser", chat_id: peer.chat_id, user_id: { _: "inputUserSelf" } }); // TODO: use potential high-level method for adding participants to chats
166
158
  }
167
159
  else {
168
160
  (0, _0_deps_js_1.unreachable)();
@@ -170,21 +162,21 @@ class ChatManager {
170
162
  }
171
163
  // RESTRICTING, BANNING, AND UNBANNING CHAT MEMBERS //
172
164
  async banChatMember(chatId, memberId, params) {
173
- const chat = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
165
+ const chat = await this.#c.getInputPeer(chatId);
174
166
  if (!(_2_tl_js_1.Api.is("inputPeerChannel", chat)) && !(_2_tl_js_1.Api.is("inputPeerChat", chat))) {
175
167
  throw new _0_errors_js_1.InputError("Expected a channel, supergroup, or group ID.");
176
168
  }
177
- const member = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(memberId);
169
+ const member = await this.#c.getInputPeer(memberId);
178
170
  if (_2_tl_js_1.Api.is("inputPeerChannel", chat)) {
179
171
  if (params?.deleteMessages) {
180
172
  try {
181
- await __classPrivateFieldGet(this, _ChatManager_c, "f").messageManager.deleteChatMemberMessages(chatId, memberId);
173
+ await this.#c.messageManager.deleteChatMemberMessages(chatId, memberId);
182
174
  }
183
175
  catch {
184
176
  //
185
177
  }
186
178
  }
187
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({
179
+ await this.#c.invoke({
188
180
  _: "channels.editBanned",
189
181
  channel: { ...chat, _: "inputChannel" },
190
182
  participant: member,
@@ -206,178 +198,182 @@ class ChatManager {
206
198
  if (!(0, _0_utilities_js_1.canBeInputUser)(member)) {
207
199
  throw new _0_errors_js_1.InputError(`Invalid user ID: ${memberId}`);
208
200
  }
209
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.deleteChatUser", chat_id: chat.chat_id, user_id: (0, _0_utilities_js_1.toInputUser)(member), revoke_history: params?.deleteMessages ? true : undefined });
201
+ await this.#c.invoke({ _: "messages.deleteChatUser", chat_id: chat.chat_id, user_id: (0, _0_utilities_js_1.toInputUser)(member), revoke_history: params?.deleteMessages ? true : undefined });
210
202
  }
211
203
  }
212
204
  async unbanChatMember(chatId, memberId) {
213
- const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
214
- const member = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(memberId);
215
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.editBanned", channel, participant: member, banned_rights: ({ _: "chatBannedRights", until_date: 0 }) });
205
+ const channel = await this.#c.getInputChannel(chatId);
206
+ const member = await this.#c.getInputPeer(memberId);
207
+ await this.#c.invoke({ _: "channels.editBanned", channel, participant: member, banned_rights: ({ _: "chatBannedRights", until_date: 0 }) });
216
208
  }
217
209
  async setChatMemberRights(chatId, memberId, params) {
218
- const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
219
- const member = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(memberId);
220
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.editBanned", channel, participant: member, banned_rights: (0, _3_types_js_2.chatMemberRightsToTlObject)(params?.rights, params?.until) });
210
+ const channel = await this.#c.getInputChannel(chatId);
211
+ const member = await this.#c.getInputPeer(memberId);
212
+ await this.#c.invoke({ _: "channels.editBanned", channel, participant: member, banned_rights: (0, _3_types_js_2.chatMemberRightsToTlObject)(params?.rights, params?.until) });
221
213
  }
222
214
  // CHAT SETTINGS //
223
215
  async setAvailableReactions(chatId, availableReactions) {
224
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.setChatAvailableReactions", peer: await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId), available_reactions: availableReactions == "none" ? { _: "chatReactionsNone" } : availableReactions == "all" ? { _: "chatReactionsAll" } : Array.isArray(availableReactions) ? ({ _: "chatReactionsSome", reactions: availableReactions.map((v) => (0, _3_types_js_2.reactionToTlObject)(v)) }) : (0, _0_deps_js_1.unreachable)() });
216
+ await this.#c.invoke({ _: "messages.setChatAvailableReactions", peer: await this.#c.getInputPeer(chatId), available_reactions: availableReactions == "none" ? { _: "chatReactionsNone" } : availableReactions == "all" ? { _: "chatReactionsAll" } : Array.isArray(availableReactions) ? ({ _: "chatReactionsSome", reactions: availableReactions.map((v) => (0, _3_types_js_2.reactionToTlObject)(v)) }) : (0, _0_deps_js_1.unreachable)() });
225
217
  }
226
218
  async setBoostsRequiredToCircumventRestrictions(chatId, boosts) {
227
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("setBoostsRequiredToCircumventRestrictions");
228
- const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
229
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.setBoostsToUnblockRestrictions", channel, boosts });
219
+ this.#c.storage.assertUser("setBoostsRequiredToCircumventRestrictions");
220
+ const channel = await this.#c.getInputChannel(chatId);
221
+ await this.#c.invoke({ _: "channels.setBoostsToUnblockRestrictions", channel, boosts });
230
222
  }
231
223
  async enableJoinRequests(chatId) {
232
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("enableJoinRequests");
233
- await __classPrivateFieldGet(this, _ChatManager_instances, "m", _ChatManager_toggleJoinRequests).call(this, chatId, true);
224
+ this.#c.storage.assertUser("enableJoinRequests");
225
+ await this.#toggleJoinRequests(chatId, true);
234
226
  }
235
227
  async disableJoinRequests(chatId) {
236
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("disableJoinRequests");
237
- await __classPrivateFieldGet(this, _ChatManager_instances, "m", _ChatManager_toggleJoinRequests).call(this, chatId, false);
228
+ this.#c.storage.assertUser("disableJoinRequests");
229
+ await this.#toggleJoinRequests(chatId, false);
238
230
  }
239
231
  async setChatStickerSet(chatId, setName) {
240
- const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
241
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.setStickers", channel, stickerset: { _: "inputStickerSetShortName", short_name: setName } });
232
+ const channel = await this.#c.getInputChannel(chatId);
233
+ await this.#c.invoke({ _: "channels.setStickers", channel, stickerset: { _: "inputStickerSetShortName", short_name: setName } });
242
234
  }
243
235
  async deleteChatStickerSet(chatId) {
244
- const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
245
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.setStickers", channel, stickerset: { _: "inputStickerSetEmpty" } });
236
+ const channel = await this.#c.getInputChannel(chatId);
237
+ await this.#c.invoke({ _: "channels.setStickers", channel, stickerset: { _: "inputStickerSetEmpty" } });
246
238
  }
247
239
  // CHAT PHOTOS //
248
240
  async deleteChatPhoto(chatId) {
249
- const peer = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
241
+ const peer = await this.#c.getInputPeer(chatId);
250
242
  if (!((0, _0_utilities_js_1.canBeInputChannel)(peer)) && !(_2_tl_js_1.Api.is("inputPeerChat", peer))) {
251
243
  (0, _0_deps_js_1.unreachable)();
252
244
  }
253
245
  if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
254
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.editPhoto", channel: (0, _0_utilities_js_1.toInputChannel)(peer), photo: { _: "inputChatPhotoEmpty" } });
246
+ await this.#c.invoke({ _: "channels.editPhoto", channel: (0, _0_utilities_js_1.toInputChannel)(peer), photo: { _: "inputChatPhotoEmpty" } });
255
247
  }
256
248
  else if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
257
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.editChatPhoto", chat_id: peer.chat_id, photo: { _: "inputChatPhotoEmpty" } });
249
+ await this.#c.invoke({ _: "messages.editChatPhoto", chat_id: peer.chat_id, photo: { _: "inputChatPhotoEmpty" } });
258
250
  }
259
251
  }
260
252
  async setChatPhoto(chatId, photo, params) {
261
- const peer = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
253
+ const peer = await this.#c.getInputPeer(chatId);
262
254
  if (!((0, _0_utilities_js_1.canBeInputChannel)(peer)) && !(_2_tl_js_1.Api.is("inputPeerChat", peer))) {
263
255
  (0, _0_deps_js_1.unreachable)();
264
256
  }
265
- const file = await __classPrivateFieldGet(this, _ChatManager_c, "f").fileManager.upload(photo, params);
257
+ const file = await this.#c.fileManager.upload(photo, params);
266
258
  const photo_ = { _: "inputChatUploadedPhoto", file };
267
259
  if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
268
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.editPhoto", channel: (0, _0_utilities_js_1.toInputChannel)(peer), photo: photo_ });
260
+ await this.#c.invoke({ _: "channels.editPhoto", channel: (0, _0_utilities_js_1.toInputChannel)(peer), photo: photo_ });
269
261
  }
270
262
  else if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
271
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.editChatPhoto", chat_id: peer.chat_id, photo: photo_ });
263
+ await this.#c.invoke({ _: "messages.editChatPhoto", chat_id: peer.chat_id, photo: photo_ });
272
264
  }
273
265
  }
274
266
  // INVITING MEMBERS //
275
267
  async addChatMember(chatId, userId, params) {
276
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("addChatMember");
277
- const chat = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
268
+ this.#c.storage.assertUser("addChatMember");
269
+ const chat = await this.#c.getInputPeer(chatId);
278
270
  if (_2_tl_js_1.Api.isOneOf(["inputPeerEmpty", "inputPeerSelf", "inputPeerUser", "inputPeerUserFromMessage"], chat)) {
279
271
  throw new _0_errors_js_1.InputError("Cannot add members to private chats");
280
272
  }
281
- const user = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputUser(userId);
273
+ const user = await this.#c.getInputUser(userId);
282
274
  if (_2_tl_js_1.Api.is("inputPeerChat", chat)) {
283
- const result = await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.addChatUser", chat_id: chat.chat_id, user_id: user, fwd_limit: params?.historyLimit ?? 0 });
275
+ const result = await this.#c.invoke({ _: "messages.addChatUser", chat_id: chat.chat_id, user_id: user, fwd_limit: params?.historyLimit ?? 0 });
284
276
  return result.missing_invitees.map(_3_types_js_1.constructFailedInvitation);
285
277
  }
286
278
  else if (_2_tl_js_1.Api.is("inputPeerChannel", chat)) {
287
- const result = await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.inviteToChannel", channel: { ...chat, _: "inputChannel" }, users: [user] });
279
+ const result = await this.#c.invoke({ _: "channels.inviteToChannel", channel: { ...chat, _: "inputChannel" }, users: [user] });
288
280
  return result.missing_invitees.map(_3_types_js_1.constructFailedInvitation);
289
281
  }
290
282
  (0, _0_deps_js_1.unreachable)();
291
283
  }
292
284
  async addChatMembers(chatId, userIds) {
293
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("addChatMembers");
294
- const chat = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
285
+ this.#c.storage.assertUser("addChatMembers");
286
+ const chat = await this.#c.getInputPeer(chatId);
295
287
  if (_2_tl_js_1.Api.isOneOf(["inputPeerEmpty", "inputPeerSelf", "inputPeerUser", "inputPeerUserFromMessage"], chat)) {
296
288
  throw new _0_errors_js_1.InputError("Cannot add members to private chats");
297
289
  }
298
290
  const users = new Array();
299
291
  for (const userId of userIds) {
300
- users.push(await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputUser(userId));
292
+ users.push(await this.#c.getInputUser(userId));
301
293
  }
302
294
  if (_2_tl_js_1.Api.is("inputPeerChat", chat)) {
303
295
  throw new _0_errors_js_1.InputError("addChatMembers cannot be used with basic groups");
304
296
  }
305
297
  else if ((0, _0_utilities_js_1.canBeInputChannel)(chat)) {
306
- const result = await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.inviteToChannel", channel: (0, _0_utilities_js_1.toInputChannel)(chat), users });
298
+ const result = await this.#c.invoke({ _: "channels.inviteToChannel", channel: (0, _0_utilities_js_1.toInputChannel)(chat), users });
307
299
  return result.missing_invitees.map(_3_types_js_1.constructFailedInvitation);
308
300
  }
309
301
  (0, _0_deps_js_1.unreachable)();
310
302
  }
303
+ async #toggleSlowMode(chatId, seconds) {
304
+ const channel = await this.#c.getInputChannel(chatId);
305
+ await this.#c.invoke({ _: "channels.toggleSlowMode", channel, seconds });
306
+ }
311
307
  async disableSlowMode(chatId) {
312
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("disableSlowMode");
313
- await __classPrivateFieldGet(this, _ChatManager_instances, "m", _ChatManager_toggleSlowMode).call(this, chatId, 0);
308
+ this.#c.storage.assertUser("disableSlowMode");
309
+ await this.#toggleSlowMode(chatId, 0);
314
310
  }
315
311
  async setSlowMode(chatId, duration) {
316
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("setSlowMode");
312
+ this.#c.storage.assertUser("setSlowMode");
317
313
  const seconds = (0, _3_types_js_1.slowModeDurationToSeconds)(duration);
318
314
  if (seconds > 1) {
319
315
  throw new _0_errors_js_1.InputError("Invalid slow mode duration.");
320
316
  }
321
- await __classPrivateFieldGet(this, _ChatManager_instances, "m", _ChatManager_toggleSlowMode).call(this, chatId, seconds);
317
+ await this.#toggleSlowMode(chatId, seconds);
322
318
  }
323
319
  async setChatTitle(chatId, title) {
324
- const peer = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
320
+ const peer = await this.#c.getInputPeer(chatId);
325
321
  if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
326
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.editChatTitle", chat_id: peer.chat_id, title });
322
+ await this.#c.invoke({ _: "messages.editChatTitle", chat_id: peer.chat_id, title });
327
323
  }
328
324
  else if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
329
325
  const channel = (0, _0_utilities_js_1.toInputChannel)(peer);
330
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.editTitle", channel, title });
326
+ await this.#c.invoke({ _: "channels.editTitle", channel, title });
331
327
  }
332
328
  else {
333
329
  throw new _0_errors_js_1.InputError("A chat or channel identifier was expected.");
334
330
  }
335
331
  }
336
332
  async setChatDescription(chatId, description) {
337
- const peer = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
333
+ const peer = await this.#c.getInputPeer(chatId);
338
334
  if ((0, _0_utilities_js_1.canBeInputUser)(peer)) {
339
335
  throw new _0_errors_js_1.InputError("A chat or channel identifier was expected.");
340
336
  }
341
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.editChatAbout", peer, about: description });
337
+ await this.#c.invoke({ _: "messages.editChatAbout", peer, about: description });
342
338
  }
343
339
  async setMemberListVisibility(chatId, visible) {
344
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("setMemberListVisible");
345
- const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
340
+ this.#c.storage.assertUser("setMemberListVisible");
341
+ const channel = await this.#c.getInputChannel(chatId);
346
342
  const enabled = !visible;
347
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.toggleParticipantsHidden", channel, enabled });
343
+ await this.#c.invoke({ _: "channels.toggleParticipantsHidden", channel, enabled });
348
344
  }
349
345
  async setTopicsEnabled(chatId, enabled) {
350
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("setTopicsEnabled");
351
- const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
352
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.toggleForum", channel, enabled });
346
+ this.#c.storage.assertUser("setTopicsEnabled");
347
+ const channel = await this.#c.getInputChannel(chatId);
348
+ await this.#c.invoke({ _: "channels.toggleForum", channel, enabled });
353
349
  }
354
350
  async setAntispamEnabled(chatId, enabled) {
355
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("setTopicsEnabled");
356
- const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
357
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.toggleAntiSpam", channel, enabled });
351
+ this.#c.storage.assertUser("setTopicsEnabled");
352
+ const channel = await this.#c.getInputChannel(chatId);
353
+ await this.#c.invoke({ _: "channels.toggleAntiSpam", channel, enabled });
358
354
  }
359
355
  async setSignaturesEnabled(chatId, enabled, params) {
360
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("setSignaturesEnabled");
361
- const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
362
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.toggleSignatures", channel, signatures_enabled: enabled ? true : undefined, profiles_enabled: params?.showAuthorProfile ? true : undefined });
356
+ this.#c.storage.assertUser("setSignaturesEnabled");
357
+ const channel = await this.#c.getInputChannel(chatId);
358
+ await this.#c.invoke({ _: "channels.toggleSignatures", channel, signatures_enabled: enabled ? true : undefined, profiles_enabled: params?.showAuthorProfile ? true : undefined });
363
359
  }
364
360
  async deleteChat(chatId) {
365
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("deleteChat");
366
- const peer = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
361
+ this.#c.storage.assertUser("deleteChat");
362
+ const peer = await this.#c.getInputPeer(chatId);
367
363
  if (_2_tl_js_1.Api.is("inputPeerChat", peer)) {
368
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.deleteChat", chat_id: peer.chat_id });
364
+ await this.#c.invoke({ _: "messages.deleteChat", chat_id: peer.chat_id });
369
365
  }
370
366
  else if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
371
367
  const channel = (0, _0_utilities_js_1.toInputChannel)(peer);
372
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.deleteChannel", channel });
368
+ await this.#c.invoke({ _: "channels.deleteChannel", channel });
373
369
  }
374
370
  else {
375
371
  throw new _0_errors_js_1.InputError("A chat or channel identifier was expected.");
376
372
  }
377
373
  }
378
374
  async getDiscussionChatSuggestions() {
379
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("getDiscussionChatSuggestions");
380
- const { chats } = await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.getGroupsForDiscussion" });
375
+ this.#c.storage.assertUser("getDiscussionChatSuggestions");
376
+ const { chats } = await this.#c.invoke({ _: "channels.getGroupsForDiscussion" });
381
377
  return chats
382
378
  .map((v) => {
383
379
  if (!_2_tl_js_1.Api.isOneOf(["chat", "channel"], v)) {
@@ -390,30 +386,21 @@ class ChatManager {
390
386
  .filter((v) => v != null);
391
387
  }
392
388
  async setDiscussionChat(chatId, discussionChatId) {
393
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("setDiscussionChat");
394
- const [broadcast, group] = await Promise.all([__classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId), __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(discussionChatId)]);
395
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.setDiscussionGroup", broadcast, group });
389
+ this.#c.storage.assertUser("setDiscussionChat");
390
+ const [broadcast, group] = await Promise.all([this.#c.getInputChannel(chatId), this.#c.getInputChannel(discussionChatId)]);
391
+ await this.#c.invoke({ _: "channels.setDiscussionGroup", broadcast, group });
396
392
  }
397
393
  async transferChatOwnership(chatId, userId, password) {
398
- __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("transferChat");
399
- const user_id = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputUser(userId);
394
+ this.#c.storage.assertUser("transferChat");
395
+ const user_id = await this.#c.getInputUser(userId);
400
396
  const isSelf = _2_tl_js_1.Api.is("inputUserSelf", user_id);
401
- if (isSelf || _2_tl_js_1.Api.peerToChatId(user_id) == await __classPrivateFieldGet(this, _ChatManager_c, "f").getSelfId()) {
397
+ if (isSelf || _2_tl_js_1.Api.peerToChatId(user_id) == await this.#c.getSelfId()) {
402
398
  throw new _0_errors_js_1.InputError("A user ID except that of the current one was expected.");
403
399
  }
404
- const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
405
- const ap = await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "account.getPassword" });
400
+ const channel = await this.#c.getInputChannel(chatId);
401
+ const ap = await this.#c.invoke({ _: "account.getPassword" });
406
402
  const password_ = await (0, _0_password_js_1.checkPassword)(password, ap);
407
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.editCreator", channel, user_id, password: password_ });
403
+ await this.#c.invoke({ _: "channels.editCreator", channel, user_id, password: password_ });
408
404
  }
409
405
  }
410
406
  exports.ChatManager = ChatManager;
411
- _ChatManager_c = new WeakMap(), _ChatManager_instances = new WeakSet(), _ChatManager_toggleJoinRequests =
412
- // JOIN REQUESTS //
413
- async function _ChatManager_toggleJoinRequests(chatId, enabled) {
414
- const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
415
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.toggleJoinRequest", channel, enabled });
416
- }, _ChatManager_toggleSlowMode = async function _ChatManager_toggleSlowMode(chatId, seconds) {
417
- const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
418
- await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.toggleSlowMode", channel, seconds });
419
- };