@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
@@ -1 +1 @@
1
- {"version":3,"file":"0_utilities_test.d.ts","sourceRoot":"","sources":["../../src/client/0_utilities_test.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"0_utilities_test.d.ts","sourceRoot":"","sources":["../../src/client/0_utilities_test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,2BAA2B,CAAC"}
@@ -17,18 +17,6 @@
17
17
  * You should have received a copy of the GNU Lesser General Public License
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
21
- if (kind === "m") throw new TypeError("Private method is not writable");
22
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
23
- 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");
24
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
25
- };
26
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
27
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
28
- 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");
29
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
30
- };
31
- var _ClientPlain_publicKeys;
32
20
  import { assert, assertEquals, concat, ige256Decrypt, ige256Encrypt, unreachable } from "../0_deps.js";
33
21
  import { bigIntFromBuffer, bufferFromBigInt, factorize, getLogger, getRandomBigInt, modExp, rsaPad, sha1 } from "../1_utilities.js";
34
22
  import { Mtproto } from "../2_tl.js";
@@ -42,16 +30,11 @@ const LcreateAuthKey = L.branch("createAuthKey");
42
30
  * An MTProto client for making plain connections. Most users won't need to interact with this. Used internally for creating authorization keys.
43
31
  */
44
32
  export class ClientPlain extends ClientAbstract {
33
+ #publicKeys;
34
+ session;
45
35
  constructor(dc, params) {
46
36
  super();
47
- _ClientPlain_publicKeys.set(this, void 0);
48
- Object.defineProperty(this, "session", {
49
- enumerable: true,
50
- configurable: true,
51
- writable: true,
52
- value: void 0
53
- });
54
- __classPrivateFieldSet(this, _ClientPlain_publicKeys, params?.publicKeys ?? PUBLIC_KEYS, "f");
37
+ this.#publicKeys = params?.publicKeys ?? PUBLIC_KEYS;
55
38
  this.session = new SessionPlain(dc, params);
56
39
  }
57
40
  async invoke(function_) {
@@ -89,7 +72,7 @@ export class ClientPlain extends ClientAbstract {
89
72
  let publicKeyFingerprint;
90
73
  let publicKey;
91
74
  for (const fingerprint of resPq.server_public_key_fingerprints) {
92
- const maybePublicKey = __classPrivateFieldGet(this, _ClientPlain_publicKeys, "f").find(([k]) => (k == fingerprint));
75
+ const maybePublicKey = this.#publicKeys.find(([k]) => (k == fingerprint));
93
76
  if (maybePublicKey) {
94
77
  publicKeyFingerprint = fingerprint;
95
78
  publicKey = maybePublicKey[1];
@@ -163,4 +146,3 @@ export class ClientPlain extends ClientAbstract {
163
146
  return [authKey, bigIntFromBuffer(salt, true, false)];
164
147
  }
165
148
  }
166
- _ClientPlain_publicKeys = new WeakMap();
@@ -17,18 +17,6 @@
17
17
  * You should have received a copy of the GNU Lesser General Public License
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
21
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
22
- 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");
23
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
24
- };
25
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
26
- if (kind === "m") throw new TypeError("Private method is not writable");
27
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
28
- 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");
29
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
30
- };
31
- var _Composer_handle, _Composer_prefixes;
32
20
  import { InputError } from "../0_errors.js";
33
21
  import { match } from "./0_filters.js";
34
22
  export function flatten(mw) {
@@ -52,23 +40,23 @@ export function skip(_ctx, next) {
52
40
  return next();
53
41
  }
54
42
  export class Composer {
43
+ #handle;
44
+ #prefixes;
55
45
  set prefixes(value) {
56
- if (__classPrivateFieldGet(this, _Composer_prefixes, "f") !== undefined) {
46
+ if (this.#prefixes !== undefined) {
57
47
  throw new InputError("Prefixes already set");
58
48
  }
59
- __classPrivateFieldSet(this, _Composer_prefixes, value, "f");
49
+ this.#prefixes = value;
60
50
  }
61
51
  constructor(...middleware) {
62
- _Composer_handle.set(this, void 0);
63
- _Composer_prefixes.set(this, void 0);
64
- __classPrivateFieldSet(this, _Composer_handle, middleware.length == 0 ? skip : middleware.map(flatten).reduce(concat), "f");
52
+ this.#handle = middleware.length == 0 ? skip : middleware.map(flatten).reduce(concat);
65
53
  }
66
54
  middleware() {
67
- return __classPrivateFieldGet(this, _Composer_handle, "f");
55
+ return this.#handle;
68
56
  }
69
57
  use(...middleware) {
70
58
  const composer = new Composer(...middleware);
71
- __classPrivateFieldSet(this, _Composer_handle, concat(__classPrivateFieldGet(this, _Composer_handle, "f"), flatten(composer)), "f");
59
+ this.#handle = concat(this.#handle, flatten(composer));
72
60
  return composer;
73
61
  }
74
62
  branch(predicate, trueHandler_, falseHandler_) {
@@ -96,7 +84,7 @@ export class Composer {
96
84
  command(commands, ...middleware) {
97
85
  const commands__ = typeof commands === "object" && "names" in commands ? commands.names : commands;
98
86
  const commands_ = Array.isArray(commands__) ? commands__ : [commands__];
99
- const prefixes_ = typeof commands === "object" && "prefixes" in commands ? commands.prefixes : (__classPrivateFieldGet(this, _Composer_prefixes, "f") ?? []);
87
+ const prefixes_ = typeof commands === "object" && "prefixes" in commands ? commands.prefixes : (this.#prefixes ?? []);
100
88
  const prefixes = Array.isArray(prefixes_) ? prefixes_ : [prefixes_];
101
89
  for (const left of prefixes) {
102
90
  for (const right of prefixes) {
@@ -165,4 +153,3 @@ export class Composer {
165
153
  }, ...middleware);
166
154
  }
167
155
  }
168
- _Composer_handle = new WeakMap(), _Composer_prefixes = new WeakMap();
@@ -17,117 +17,119 @@
17
17
  * You should have received a copy of the GNU Lesser General Public License
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
21
- if (kind === "m") throw new TypeError("Private method is not writable");
22
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
23
- 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");
24
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
25
- };
26
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
27
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
28
- 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");
29
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
30
- };
31
- var _AccountManager_instances, _AccountManager_c, _AccountManager_toggleUsername, _AccountManager_getUserFull;
32
20
  import { unreachable } from "../0_deps.js";
33
21
  import { InputError } from "../0_errors.js";
34
22
  import { Api } from "../2_tl.js";
35
23
  import { birthdayToTlObject, constructInactiveChat, constructUser } from "../3_types.js";
36
24
  import { canBeInputChannel, canBeInputUser, toInputChannel, toInputUser } from "./0_utilities.js";
37
25
  export class AccountManager {
26
+ #c;
38
27
  constructor(c) {
39
- _AccountManager_instances.add(this);
40
- _AccountManager_c.set(this, void 0);
41
- __classPrivateFieldSet(this, _AccountManager_c, c, "f");
28
+ this.#c = c;
29
+ }
30
+ async #toggleUsername(id, username, active) {
31
+ const peer = await this.#c.getInputPeer(id);
32
+ if (Api.is("inputPeerSelf", peer)) {
33
+ await this.#c.invoke({ _: "account.toggleUsername", username, active });
34
+ }
35
+ else if (canBeInputUser(peer)) {
36
+ await this.#c.invoke({ _: "bots.toggleUsername", bot: toInputUser(peer), username, active });
37
+ }
38
+ else if (canBeInputChannel(peer)) {
39
+ await this.#c.invoke({ _: "channels.toggleUsername", channel: toInputChannel(peer), username, active });
40
+ }
41
+ else {
42
+ unreachable();
43
+ }
42
44
  }
43
45
  async showUsername(id, username) {
44
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("showUsername");
45
- await __classPrivateFieldGet(this, _AccountManager_instances, "m", _AccountManager_toggleUsername).call(this, id, username, true);
46
+ this.#c.storage.assertUser("showUsername");
47
+ await this.#toggleUsername(id, username, true);
46
48
  }
47
49
  async hideUsername(id, username) {
48
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("hideUsername");
49
- await __classPrivateFieldGet(this, _AccountManager_instances, "m", _AccountManager_toggleUsername).call(this, id, username, false);
50
+ this.#c.storage.assertUser("hideUsername");
51
+ await this.#toggleUsername(id, username, false);
50
52
  }
51
53
  async reorderUsernames(id, order) {
52
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("reorderUsernames");
53
- const peer = await __classPrivateFieldGet(this, _AccountManager_c, "f").getInputPeer(id);
54
+ this.#c.storage.assertUser("reorderUsernames");
55
+ const peer = await this.#c.getInputPeer(id);
54
56
  if (Api.is("inputPeerSelf", peer)) {
55
- return await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "account.reorderUsernames", order });
57
+ return await this.#c.invoke({ _: "account.reorderUsernames", order });
56
58
  }
57
59
  else if (canBeInputUser(peer)) {
58
- return await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "bots.reorderUsernames", bot: toInputUser(peer), order });
60
+ return await this.#c.invoke({ _: "bots.reorderUsernames", bot: toInputUser(peer), order });
59
61
  }
60
62
  else if (canBeInputChannel(peer)) {
61
- return await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "channels.reorderUsernames", channel: toInputChannel(peer), order });
63
+ return await this.#c.invoke({ _: "channels.reorderUsernames", channel: toInputChannel(peer), order });
62
64
  }
63
65
  else {
64
66
  unreachable();
65
67
  }
66
68
  }
67
69
  async hideUsernames(id) {
68
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("hideUsernames");
69
- const peer = await __classPrivateFieldGet(this, _AccountManager_c, "f").getInputPeer(id);
70
+ this.#c.storage.assertUser("hideUsernames");
71
+ const peer = await this.#c.getInputPeer(id);
70
72
  if (canBeInputChannel(peer)) {
71
- return await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "channels.deactivateAllUsernames", channel: toInputChannel(peer) });
73
+ return await this.#c.invoke({ _: "channels.deactivateAllUsernames", channel: toInputChannel(peer) });
72
74
  }
73
75
  else {
74
76
  unreachable();
75
77
  }
76
78
  }
77
79
  async getInactiveChats() {
78
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("getInactiveChats");
79
- const { chats, dates } = await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "channels.getInactiveChannels" });
80
+ this.#c.storage.assertUser("getInactiveChats");
81
+ const { chats, dates } = await this.#c.invoke({ _: "channels.getInactiveChannels" });
80
82
  return chats.map((v, i) => constructInactiveChat(v, dates[i]));
81
83
  }
82
84
  async setOnline(online) {
83
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("setOnline");
84
- await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "account.updateStatus", offline: !online });
85
+ this.#c.storage.assertUser("setOnline");
86
+ await this.#c.invoke({ _: "account.updateStatus", offline: !online });
85
87
  }
86
88
  async setEmojiStatus(id, params) {
87
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("setEmojiStatus");
89
+ this.#c.storage.assertUser("setEmojiStatus");
88
90
  const document_id = BigInt(id);
89
91
  const until = params?.until;
90
92
  const emoji_status = { _: "emojiStatus", document_id, until };
91
- await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "account.updateEmojiStatus", emoji_status });
93
+ await this.#c.invoke({ _: "account.updateEmojiStatus", emoji_status });
92
94
  }
93
95
  async setUserEmojiStatus(userId, id, params) {
94
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertBot("setUserEmojiStatus");
95
- const user_id = await __classPrivateFieldGet(this, _AccountManager_c, "f").getInputUser(userId);
96
+ this.#c.storage.assertBot("setUserEmojiStatus");
97
+ const user_id = await this.#c.getInputUser(userId);
96
98
  const document_id = BigInt(id);
97
99
  const until = params?.until;
98
100
  const emoji_status = { _: "emojiStatus", document_id, until };
99
- await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "bots.updateUserEmojiStatus", user_id, emoji_status });
101
+ await this.#c.invoke({ _: "bots.updateUserEmojiStatus", user_id, emoji_status });
100
102
  }
101
103
  async setBotCanSetEmojiStatus(botId, canSetEmojiStatus) {
102
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("setBotCanSetEmojiStatus");
103
- const bot = await __classPrivateFieldGet(this, _AccountManager_c, "f").getInputUser(botId);
104
+ this.#c.storage.assertUser("setBotCanSetEmojiStatus");
105
+ const bot = await this.#c.getInputUser(botId);
104
106
  const enabled = canSetEmojiStatus;
105
- await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "bots.toggleUserEmojiStatusPermission", bot, enabled });
107
+ await this.#c.invoke({ _: "bots.toggleUserEmojiStatusPermission", bot, enabled });
106
108
  }
107
109
  async getContacts() {
108
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("getContacts");
109
- const result = await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "contacts.getContacts", hash: 0n });
110
+ this.#c.storage.assertUser("getContacts");
111
+ const result = await this.#c.invoke({ _: "contacts.getContacts", hash: 0n });
110
112
  if (!Api.is("contacts.contacts", result)) {
111
113
  unreachable();
112
114
  }
113
115
  return result.users.map((v) => Api.is("user", v) ? constructUser(v) : null).filter((v) => v != null);
114
116
  }
115
117
  async deleteContacts(userIds) {
116
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("deleteContacts");
117
- const id = await Promise.all(userIds.map((v) => __classPrivateFieldGet(this, _AccountManager_c, "f").getInputUser(v)));
118
- await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "contacts.deleteContacts", id });
118
+ this.#c.storage.assertUser("deleteContacts");
119
+ const id = await Promise.all(userIds.map((v) => this.#c.getInputUser(v)));
120
+ await this.#c.invoke({ _: "contacts.deleteContacts", id });
119
121
  }
120
122
  async deleteContact(userId) {
121
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("deleteContact");
123
+ this.#c.storage.assertUser("deleteContact");
122
124
  await this.deleteContacts([userId]);
123
125
  }
124
126
  async addContact(userId, params) {
125
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("addContact");
126
- const id = await __classPrivateFieldGet(this, _AccountManager_c, "f").getInputUser(userId);
127
+ this.#c.storage.assertUser("addContact");
128
+ const id = await this.#c.getInputUser(userId);
127
129
  if (!Api.is("inputPeerUser", id)) {
128
130
  unreachable();
129
131
  }
130
- const user = await __classPrivateFieldGet(this, _AccountManager_c, "f").getEntity(Api.inputPeerToPeer(id));
132
+ const user = await this.#c.getEntity(Api.inputPeerToPeer(id));
131
133
  if (!user || !("first_name" in user)) {
132
134
  unreachable();
133
135
  }
@@ -135,13 +137,31 @@ export class AccountManager {
135
137
  const last_name = params?.lastName ?? user.last_name ?? "";
136
138
  const phone = "";
137
139
  const add_phone_privacy_exception = params?.sharePhoneNumber ? true : undefined;
138
- await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "contacts.addContact", add_phone_privacy_exception, id, first_name, last_name, phone });
140
+ await this.#c.invoke({ _: "contacts.addContact", add_phone_privacy_exception, id, first_name, last_name, phone });
141
+ }
142
+ async #getUserFull(chatId) {
143
+ const inputPeer = await this.#c.getInputPeer(chatId);
144
+ const chatId_ = await this.#c.getInputPeerChatId(inputPeer);
145
+ let fullChat = await this.#c.storage.getFullChat(chatId_);
146
+ if (fullChat != null) {
147
+ if (!Api.is("userFull", fullChat)) {
148
+ unreachable();
149
+ }
150
+ return fullChat;
151
+ }
152
+ if (canBeInputUser(inputPeer)) {
153
+ fullChat = (await this.#c.invoke({ _: "users.getFullUser", id: toInputUser(inputPeer) })).full_user;
154
+ }
155
+ else {
156
+ unreachable();
157
+ }
158
+ return fullChat;
139
159
  }
140
160
  async updateProfile(params) {
141
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("updateProfile");
142
- const selfId = await __classPrivateFieldGet(this, _AccountManager_c, "f").getSelfId();
143
- const userFull = await __classPrivateFieldGet(this, _AccountManager_instances, "m", _AccountManager_getUserFull).call(this, selfId);
144
- const entity = await __classPrivateFieldGet(this, _AccountManager_c, "f").getEntity(Api.chatIdToPeer(selfId));
161
+ this.#c.storage.assertUser("updateProfile");
162
+ const selfId = await this.#c.getSelfId();
163
+ const userFull = await this.#getUserFull(selfId);
164
+ const entity = await this.#c.getEntity(Api.chatIdToPeer(selfId));
145
165
  if (!Api.is("user", entity)) {
146
166
  unreachable();
147
167
  }
@@ -167,33 +187,33 @@ export class AccountManager {
167
187
  if (!params?.firstName && !params?.lastName && !params?.bio) {
168
188
  throw new InputError("At least one parameter must be specified.");
169
189
  }
170
- await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "account.updateProfile", first_name: params.firstName, last_name: params.lastName, about: params.bio });
190
+ await this.#c.invoke({ _: "account.updateProfile", first_name: params.firstName, last_name: params.lastName, about: params.bio });
171
191
  }
172
192
  async setBirthday(params) {
173
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("setBirthday");
193
+ this.#c.storage.assertUser("setBirthday");
174
194
  const birthday = params?.birthday ? birthdayToTlObject(params.birthday) : undefined;
175
- await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "account.updateBirthday", birthday });
195
+ await this.#c.invoke({ _: "account.updateBirthday", birthday });
176
196
  }
177
197
  async setPersonalChannel(params) {
178
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("setPersonalChannel");
198
+ this.#c.storage.assertUser("setPersonalChannel");
179
199
  let channel = { _: "inputChannelEmpty" };
180
200
  if (params?.chatId) {
181
- channel = await __classPrivateFieldGet(this, _AccountManager_c, "f").getInputChannel(params.chatId);
201
+ channel = await this.#c.getInputChannel(params.chatId);
182
202
  }
183
- await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "account.updatePersonalChannel", channel });
203
+ await this.#c.invoke({ _: "account.updatePersonalChannel", channel });
184
204
  }
185
205
  async setNameColor(color, params) {
186
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("setNameColor");
206
+ this.#c.storage.assertUser("setNameColor");
187
207
  const background_emoji_id = params?.customEmojiId ? BigInt(params.customEmojiId) : undefined;
188
- await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "account.updateColor", color, background_emoji_id });
208
+ await this.#c.invoke({ _: "account.updateColor", color, background_emoji_id });
189
209
  }
190
210
  async setProfileColor(color, params) {
191
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("setProfileColor");
211
+ this.#c.storage.assertUser("setProfileColor");
192
212
  const background_emoji_id = params?.customEmojiId ? BigInt(params.customEmojiId) : undefined;
193
- await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "account.updateColor", for_profile: true, color, background_emoji_id });
213
+ await this.#c.invoke({ _: "account.updateColor", for_profile: true, color, background_emoji_id });
194
214
  }
195
215
  async setLocation(params) {
196
- __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("setLocation");
216
+ this.#c.storage.assertUser("setLocation");
197
217
  let address = params?.address;
198
218
  if (typeof address === "string") {
199
219
  address = address.trim();
@@ -208,38 +228,6 @@ export class AccountManager {
208
228
  if (params?.latitude && params.longitude) {
209
229
  geo_point = { _: "inputGeoPoint", lat: params.latitude, long: params.longitude };
210
230
  }
211
- await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "account.updateBusinessLocation", address, geo_point });
231
+ await this.#c.invoke({ _: "account.updateBusinessLocation", address, geo_point });
212
232
  }
213
233
  }
214
- _AccountManager_c = new WeakMap(), _AccountManager_instances = new WeakSet(), _AccountManager_toggleUsername = async function _AccountManager_toggleUsername(id, username, active) {
215
- const peer = await __classPrivateFieldGet(this, _AccountManager_c, "f").getInputPeer(id);
216
- if (Api.is("inputPeerSelf", peer)) {
217
- await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "account.toggleUsername", username, active });
218
- }
219
- else if (canBeInputUser(peer)) {
220
- await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "bots.toggleUsername", bot: toInputUser(peer), username, active });
221
- }
222
- else if (canBeInputChannel(peer)) {
223
- await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "channels.toggleUsername", channel: toInputChannel(peer), username, active });
224
- }
225
- else {
226
- unreachable();
227
- }
228
- }, _AccountManager_getUserFull = async function _AccountManager_getUserFull(chatId) {
229
- const inputPeer = await __classPrivateFieldGet(this, _AccountManager_c, "f").getInputPeer(chatId);
230
- const chatId_ = await __classPrivateFieldGet(this, _AccountManager_c, "f").getInputPeerChatId(inputPeer);
231
- let fullChat = await __classPrivateFieldGet(this, _AccountManager_c, "f").storage.getFullChat(chatId_);
232
- if (fullChat != null) {
233
- if (!Api.is("userFull", fullChat)) {
234
- unreachable();
235
- }
236
- return fullChat;
237
- }
238
- if (canBeInputUser(inputPeer)) {
239
- fullChat = (await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "users.getFullUser", id: toInputUser(inputPeer) })).full_user;
240
- }
241
- else {
242
- unreachable();
243
- }
244
- return fullChat;
245
- };
@@ -17,70 +17,58 @@
17
17
  * You should have received a copy of the GNU Lesser General Public License
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
21
- if (kind === "m") throw new TypeError("Private method is not writable");
22
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
23
- 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");
24
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
25
- };
26
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
27
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
28
- 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");
29
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
30
- };
31
- var _BotInfoManager_instances, _BotInfoManager_c, _BotInfoManager_setMyInfo, _BotInfoManager_getMyInfo;
32
20
  import { botCommandScopeToTlObject } from "../3_types.js";
33
21
  export class BotInfoManager {
22
+ #c;
34
23
  constructor(c) {
35
- _BotInfoManager_instances.add(this);
36
- _BotInfoManager_c.set(this, void 0);
37
- __classPrivateFieldSet(this, _BotInfoManager_c, c, "f");
24
+ this.#c = c;
25
+ }
26
+ async #setMyInfo(info) {
27
+ await this.#c.invoke({ _: "bots.setBotInfo", ...info });
38
28
  }
39
29
  async setMyDescription(params) {
40
- __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("setMyDescription");
41
- await __classPrivateFieldGet(this, _BotInfoManager_instances, "m", _BotInfoManager_setMyInfo).call(this, { description: params?.description, lang_code: params?.languageCode ?? "" });
30
+ this.#c.storage.assertBot("setMyDescription");
31
+ await this.#setMyInfo({ description: params?.description, lang_code: params?.languageCode ?? "" });
42
32
  }
43
33
  async setMyName(params) {
44
- __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("setMyName");
45
- await __classPrivateFieldGet(this, _BotInfoManager_instances, "m", _BotInfoManager_setMyInfo).call(this, { name: params?.name, lang_code: params?.languageCode ?? "" });
34
+ this.#c.storage.assertBot("setMyName");
35
+ await this.#setMyInfo({ name: params?.name, lang_code: params?.languageCode ?? "" });
46
36
  }
47
37
  async setMyShortDescription(params) {
48
- __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("setMyShortDescription");
49
- await __classPrivateFieldGet(this, _BotInfoManager_instances, "m", _BotInfoManager_setMyInfo).call(this, { about: params?.shortDescription, lang_code: params?.languageCode ?? "" });
38
+ this.#c.storage.assertBot("setMyShortDescription");
39
+ await this.#setMyInfo({ about: params?.shortDescription, lang_code: params?.languageCode ?? "" });
40
+ }
41
+ #getMyInfo(languageCode) {
42
+ return this.#c.invoke({ _: "bots.getBotInfo", lang_code: languageCode ?? "" });
50
43
  }
51
44
  async getMyDescription(params) {
52
- __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("getMyDescription");
53
- return (await __classPrivateFieldGet(this, _BotInfoManager_instances, "m", _BotInfoManager_getMyInfo).call(this, params?.languageCode)).description;
45
+ this.#c.storage.assertBot("getMyDescription");
46
+ return (await this.#getMyInfo(params?.languageCode)).description;
54
47
  }
55
48
  async getMyName(params) {
56
- __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("getMyName");
57
- return (await __classPrivateFieldGet(this, _BotInfoManager_instances, "m", _BotInfoManager_getMyInfo).call(this, params?.languageCode)).description;
49
+ this.#c.storage.assertBot("getMyName");
50
+ return (await this.#getMyInfo(params?.languageCode)).description;
58
51
  }
59
52
  async getMyShortDescription(params) {
60
- __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("getMyShortDescription");
61
- return (await __classPrivateFieldGet(this, _BotInfoManager_instances, "m", _BotInfoManager_getMyInfo).call(this, params?.languageCode)).about;
53
+ this.#c.storage.assertBot("getMyShortDescription");
54
+ return (await this.#getMyInfo(params?.languageCode)).about;
62
55
  }
63
56
  async getMyCommands(params) {
64
- __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("getMyCommands");
65
- const commands_ = await __classPrivateFieldGet(this, _BotInfoManager_c, "f").invoke({
57
+ this.#c.storage.assertBot("getMyCommands");
58
+ const commands_ = await this.#c.invoke({
66
59
  _: "bots.getBotCommands",
67
60
  lang_code: params?.languageCode ?? "",
68
- scope: await botCommandScopeToTlObject(params?.scope ?? { type: "default" }, __classPrivateFieldGet(this, _BotInfoManager_c, "f").getInputPeer),
61
+ scope: await botCommandScopeToTlObject(params?.scope ?? { type: "default" }, this.#c.getInputPeer),
69
62
  });
70
63
  return commands_.map((v) => ({ command: v.command, description: v.description }));
71
64
  }
72
65
  async setMyCommands(commands, params) {
73
- __classPrivateFieldGet(this, _BotInfoManager_c, "f").storage.assertBot("setMyCommands");
74
- await __classPrivateFieldGet(this, _BotInfoManager_c, "f").invoke({
66
+ this.#c.storage.assertBot("setMyCommands");
67
+ await this.#c.invoke({
75
68
  _: "bots.setBotCommands",
76
69
  commands: commands.map((v) => ({ ...v, _: "botCommand" })),
77
70
  lang_code: params?.languageCode ?? "",
78
- scope: await botCommandScopeToTlObject(params?.scope ?? { type: "default" }, __classPrivateFieldGet(this, _BotInfoManager_c, "f").getInputPeer),
71
+ scope: await botCommandScopeToTlObject(params?.scope ?? { type: "default" }, this.#c.getInputPeer),
79
72
  });
80
73
  }
81
74
  }
82
- _BotInfoManager_c = new WeakMap(), _BotInfoManager_instances = new WeakSet(), _BotInfoManager_setMyInfo = async function _BotInfoManager_setMyInfo(info) {
83
- await __classPrivateFieldGet(this, _BotInfoManager_c, "f").invoke({ _: "bots.setBotInfo", ...info });
84
- }, _BotInfoManager_getMyInfo = function _BotInfoManager_getMyInfo(languageCode) {
85
- return __classPrivateFieldGet(this, _BotInfoManager_c, "f").invoke({ _: "bots.getBotInfo", lang_code: languageCode ?? "" });
86
- };
@@ -17,39 +17,27 @@
17
17
  * You should have received a copy of the GNU Lesser General Public License
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
21
- if (kind === "m") throw new TypeError("Private method is not writable");
22
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
23
- 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");
24
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
25
- };
26
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
27
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
28
- 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");
29
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
30
- };
31
- var _BusinessConnectionManager_c;
32
20
  import { Api } from "../2_tl.js";
33
21
  import { constructBusinessConnection } from "../3_types.js";
34
22
  const businessConnectionManagerUpdates = [
35
23
  "updateBotBusinessConnect",
36
24
  ];
37
25
  export class BusinessConnectionManager {
26
+ #c;
38
27
  constructor(c) {
39
- _BusinessConnectionManager_c.set(this, void 0);
40
- __classPrivateFieldSet(this, _BusinessConnectionManager_c, c, "f");
28
+ this.#c = c;
41
29
  }
42
30
  async getBusinessConnection(id) {
43
- const connection_ = await __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").messageStorage.getBusinessConnection(id);
31
+ const connection_ = await this.#c.messageStorage.getBusinessConnection(id);
44
32
  if (!connection_) {
45
- const connection_ = await __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").invoke({ _: "account.getBotBusinessConnection", connection_id: id })
33
+ const connection_ = await this.#c.invoke({ _: "account.getBotBusinessConnection", connection_id: id })
46
34
  .then((v) => Api.as("updates", v))
47
35
  .then((v) => Api.as("updateBotBusinessConnect", v.updates[0]).connection);
48
- await __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").messageStorage.setBusinessConnection(id, connection_);
49
- return await constructBusinessConnection(connection_, __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").getEntity);
36
+ await this.#c.messageStorage.setBusinessConnection(id, connection_);
37
+ return await constructBusinessConnection(connection_, this.#c.getEntity);
50
38
  }
51
39
  else {
52
- return await constructBusinessConnection(connection_, __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").getEntity);
40
+ return await constructBusinessConnection(connection_, this.#c.getEntity);
53
41
  }
54
42
  }
55
43
  canHandleUpdate(update) {
@@ -57,13 +45,12 @@ export class BusinessConnectionManager {
57
45
  }
58
46
  async handleUpdate(update) {
59
47
  if (update.connection.disabled) {
60
- await __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").messageStorage.setBusinessConnection(update.connection.connection_id, null);
48
+ await this.#c.messageStorage.setBusinessConnection(update.connection.connection_id, null);
61
49
  }
62
50
  else {
63
- await __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").messageStorage.setBusinessConnection(update.connection.connection_id, update.connection);
51
+ await this.#c.messageStorage.setBusinessConnection(update.connection.connection_id, update.connection);
64
52
  }
65
- const businessConnection = await constructBusinessConnection(update.connection, __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").getEntity);
53
+ const businessConnection = await constructBusinessConnection(update.connection, this.#c.getEntity);
66
54
  return { businessConnection };
67
55
  }
68
56
  }
69
- _BusinessConnectionManager_c = new WeakMap();