@mtkruto/node 0.1.200 → 0.1.300

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 (231) hide show
  1. package/esm/0_deps.d.ts +1 -1
  2. package/esm/0_deps.js +2 -1
  3. package/esm/1_utilities.d.ts +1 -1
  4. package/esm/1_utilities.js +1 -1
  5. package/esm/4_errors.js +3 -3
  6. package/esm/client/0_markdown.js +5 -5
  7. package/esm/client/0_utilities.d.ts +6 -0
  8. package/esm/client/0_utilities.js +35 -4
  9. package/esm/client/1_account_manager.js +4 -4
  10. package/esm/client/1_client_encrypted.js +4 -4
  11. package/esm/client/1_client_plain.js +3 -3
  12. package/esm/client/1_file_manager.js +6 -5
  13. package/esm/client/1_reaction_manager.js +2 -2
  14. package/esm/client/1_update_manager.js +9 -8
  15. package/esm/client/2_message_manager.js +47 -24
  16. package/esm/client/3_callback_query_manager.js +2 -0
  17. package/esm/client/3_chat_list_manager.js +13 -12
  18. package/esm/client/3_inline_query_manager.js +4 -2
  19. package/esm/client/3_story_manager.js +7 -5
  20. package/esm/client/4_client.d.ts +5 -8
  21. package/esm/client/4_client.js +19 -27
  22. package/esm/connection/1_connection_web_socket.js +3 -2
  23. package/{script/deps/deno.land/x/tgcrypto@0.3.3 → esm/deps/deno.land/x/tgcrypto@0.4.0}/mod.d.ts +0 -1
  24. package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +0 -11
  25. package/esm/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +308 -0
  26. package/esm/mod.d.ts +1 -1
  27. package/esm/mod.js +1 -1
  28. package/esm/storage/0_storage.js +6 -5
  29. package/esm/storage/1_utilities.d.ts +0 -1
  30. package/esm/storage/1_utilities.js +2 -3
  31. package/esm/storage/2_storage_local_storage.js +1 -4
  32. package/esm/storage/2_storage_session_storage.js +1 -4
  33. package/esm/tl/3_utilities.js +5 -4
  34. package/esm/transport/2_transport_provider.js +4 -4
  35. package/esm/types/0_message_entity.js +3 -3
  36. package/esm/types/0_message_search_filter.js +2 -2
  37. package/esm/types/0_reaction.js +2 -2
  38. package/esm/types/1_bot_command_scope.js +3 -3
  39. package/esm/types/1_chat_p.js +3 -2
  40. package/esm/types/1_keyboard_button.js +3 -3
  41. package/esm/types/1_message_reaction.js +2 -2
  42. package/esm/types/1_story_privacy.js +3 -3
  43. package/esm/types/2_chat_member.js +6 -5
  44. package/esm/types/2_chosen_inline_result.js +3 -2
  45. package/esm/types/2_inactive_chat.js +3 -2
  46. package/esm/types/2_inline_keyboard_button.js +3 -3
  47. package/esm/types/2_inline_query.js +3 -3
  48. package/esm/types/2_invite_link.js +3 -2
  49. package/esm/types/2_story_content.js +5 -5
  50. package/esm/types/2_story_interactive_area.js +5 -5
  51. package/esm/types/3_chat_member_updated.js +4 -3
  52. package/esm/types/3_reply_markup.js +4 -3
  53. package/esm/types/3_story.js +3 -2
  54. package/esm/types/4_inline_query_result.js +5 -5
  55. package/esm/types/4_message.js +17 -16
  56. package/esm/types/5_callback_query.js +4 -3
  57. package/esm/types/5_chat.js +8 -7
  58. package/esm/types/_file_id.js +9 -8
  59. package/esm/utilities/0_bigint.d.ts +1 -0
  60. package/esm/utilities/0_bigint.js +25 -0
  61. package/esm/utilities/0_logger.d.ts +8 -0
  62. package/esm/utilities/0_logger.js +9 -5
  63. package/esm/utilities/1_math.d.ts +1 -0
  64. package/esm/utilities/1_math.js +51 -0
  65. package/esm/utilities/1_misc.js +2 -2
  66. package/package.json +1 -1
  67. package/script/0_deps.d.ts +1 -1
  68. package/script/0_deps.js +3 -3
  69. package/script/1_utilities.d.ts +1 -1
  70. package/script/1_utilities.js +1 -1
  71. package/script/4_errors.js +3 -3
  72. package/script/client/0_markdown.js +5 -5
  73. package/script/client/0_utilities.d.ts +6 -0
  74. package/script/client/0_utilities.js +41 -4
  75. package/script/client/1_account_manager.js +4 -4
  76. package/script/client/1_client_encrypted.js +2 -2
  77. package/script/client/1_client_plain.js +2 -2
  78. package/script/client/1_file_manager.js +5 -4
  79. package/script/client/1_reaction_manager.js +2 -2
  80. package/script/client/1_update_manager.js +8 -7
  81. package/script/client/2_message_manager.js +51 -28
  82. package/script/client/3_callback_query_manager.js +2 -0
  83. package/script/client/3_chat_list_manager.js +12 -11
  84. package/script/client/3_inline_query_manager.js +4 -2
  85. package/script/client/3_story_manager.js +4 -2
  86. package/script/client/4_client.d.ts +5 -8
  87. package/script/client/4_client.js +18 -26
  88. package/script/connection/1_connection_web_socket.js +2 -1
  89. package/{esm/deps/deno.land/x/tgcrypto@0.3.3 → script/deps/deno.land/x/tgcrypto@0.4.0}/mod.d.ts +0 -1
  90. package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +1 -13
  91. package/script/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +310 -0
  92. package/script/mod.d.ts +1 -1
  93. package/script/mod.js +2 -1
  94. package/script/storage/0_storage.js +5 -4
  95. package/script/storage/1_utilities.d.ts +0 -1
  96. package/script/storage/1_utilities.js +3 -4
  97. package/script/storage/2_storage_local_storage.js +0 -3
  98. package/script/storage/2_storage_session_storage.js +0 -3
  99. package/script/tl/3_utilities.js +4 -3
  100. package/script/transport/2_transport_provider.js +4 -4
  101. package/script/types/0_message_entity.js +3 -3
  102. package/script/types/0_message_search_filter.js +2 -2
  103. package/script/types/0_reaction.js +2 -2
  104. package/script/types/1_bot_command_scope.js +3 -3
  105. package/script/types/1_chat_p.js +2 -1
  106. package/script/types/1_keyboard_button.js +3 -3
  107. package/script/types/1_message_reaction.js +2 -2
  108. package/script/types/1_story_privacy.js +3 -3
  109. package/script/types/2_chat_member.js +5 -4
  110. package/script/types/2_chosen_inline_result.js +2 -1
  111. package/script/types/2_inactive_chat.js +2 -1
  112. package/script/types/2_inline_keyboard_button.js +3 -3
  113. package/script/types/2_inline_query.js +3 -3
  114. package/script/types/2_invite_link.js +2 -1
  115. package/script/types/2_story_content.js +5 -5
  116. package/script/types/2_story_interactive_area.js +5 -5
  117. package/script/types/3_chat_member_updated.js +3 -2
  118. package/script/types/3_reply_markup.js +3 -2
  119. package/script/types/3_story.js +2 -1
  120. package/script/types/4_inline_query_result.js +5 -5
  121. package/script/types/4_message.js +16 -15
  122. package/script/types/5_callback_query.js +3 -2
  123. package/script/types/5_chat.js +7 -6
  124. package/script/types/_file_id.js +8 -7
  125. package/script/utilities/0_bigint.d.ts +1 -0
  126. package/script/utilities/0_bigint.js +27 -1
  127. package/script/utilities/0_logger.d.ts +8 -0
  128. package/script/utilities/0_logger.js +11 -6
  129. package/script/utilities/1_math.d.ts +1 -0
  130. package/script/utilities/1_math.js +55 -0
  131. package/script/utilities/1_misc.js +2 -2
  132. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +0 -83
  133. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +0 -203
  134. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +0 -50
  135. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +0 -274
  136. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +0 -47
  137. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +0 -51
  138. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +0 -66
  139. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +0 -191
  140. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +0 -168
  141. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +0 -385
  142. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +0 -159
  143. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +0 -431
  144. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +0 -181
  145. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +0 -1046
  146. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +0 -42
  147. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +0 -52
  148. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +0 -11
  149. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +0 -122
  150. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +0 -1
  151. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +0 -24
  152. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +0 -46
  153. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +0 -121
  154. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +0 -31
  155. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +0 -30
  156. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +0 -2128
  157. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +0 -2127
  158. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +0 -109
  159. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +0 -108
  160. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +0 -8
  161. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +0 -1
  162. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +0 -90
  163. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +0 -95
  164. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +0 -50
  165. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +0 -128
  166. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +0 -46
  167. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +0 -110
  168. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +0 -42
  169. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +0 -120
  170. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +0 -6
  171. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +0 -6
  172. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +0 -54
  173. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +0 -110
  174. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +0 -40
  175. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +0 -75
  176. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +0 -58
  177. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +0 -101
  178. package/esm/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -324
  179. package/esm/utilities/0_control.d.ts +0 -1
  180. package/esm/utilities/0_control.js +0 -3
  181. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +0 -83
  182. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +0 -207
  183. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +0 -50
  184. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +0 -301
  185. package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +0 -47
  186. package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +0 -55
  187. package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +0 -66
  188. package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +0 -222
  189. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +0 -168
  190. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +0 -404
  191. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +0 -159
  192. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +0 -438
  193. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +0 -181
  194. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +0 -1052
  195. package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +0 -42
  196. package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +0 -88
  197. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +0 -11
  198. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +0 -128
  199. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +0 -1
  200. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +0 -30
  201. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +0 -46
  202. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +0 -129
  203. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +0 -31
  204. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +0 -32
  205. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +0 -2128
  206. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +0 -2129
  207. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +0 -109
  208. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +0 -110
  209. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +0 -8
  210. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +0 -3
  211. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +0 -90
  212. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +0 -114
  213. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +0 -50
  214. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +0 -134
  215. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +0 -46
  216. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +0 -118
  217. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +0 -42
  218. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +0 -129
  219. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +0 -6
  220. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +0 -22
  221. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +0 -54
  222. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +0 -119
  223. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +0 -40
  224. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +0 -86
  225. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +0 -58
  226. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +0 -112
  227. package/script/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -326
  228. package/script/utilities/0_control.d.ts +0 -1
  229. package/script/utilities/0_control.js +0 -7
  230. /package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
  231. /package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  var _AccountManager_instances, _AccountManager_c, _AccountManager_toggleUsername;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.AccountManager = void 0;
16
- const _1_utilities_js_1 = require("../1_utilities.js");
16
+ const _0_deps_js_1 = require("../0_deps.js");
17
17
  const _2_tl_js_1 = require("../2_tl.js");
18
18
  const _3_types_js_1 = require("../3_types.js");
19
19
  class AccountManager {
@@ -43,7 +43,7 @@ class AccountManager {
43
43
  return await __classPrivateFieldGet(this, _AccountManager_c, "f").api.channels.reorderUsernames({ channel: new _2_tl_js_1.types.InputChannel(peer), order });
44
44
  }
45
45
  else {
46
- (0, _1_utilities_js_1.UNREACHABLE)();
46
+ (0, _0_deps_js_1.unreachable)();
47
47
  }
48
48
  }
49
49
  async hideUsernames(id) {
@@ -53,7 +53,7 @@ class AccountManager {
53
53
  return await __classPrivateFieldGet(this, _AccountManager_c, "f").api.channels.deactivateAllUsernames({ channel: new _2_tl_js_1.types.InputChannel(peer) });
54
54
  }
55
55
  else {
56
- (0, _1_utilities_js_1.UNREACHABLE)();
56
+ (0, _0_deps_js_1.unreachable)();
57
57
  }
58
58
  }
59
59
  async getInactiveChats() {
@@ -75,6 +75,6 @@ _AccountManager_c = new WeakMap(), _AccountManager_instances = new WeakSet(), _A
75
75
  await __classPrivateFieldGet(this, _AccountManager_c, "f").api.channels.toggleUsername({ channel: new _2_tl_js_1.types.InputChannel(peer), username, active });
76
76
  }
77
77
  else {
78
- (0, _1_utilities_js_1.UNREACHABLE)();
78
+ (0, _0_deps_js_1.unreachable)();
79
79
  }
80
80
  };
@@ -122,7 +122,7 @@ _ClientEncrypted_authKey = new WeakMap(), _ClientEncrypted_authKeyId = new WeakM
122
122
  __classPrivateFieldGet(this, _ClientEncrypted_L, "f").outBin(payload);
123
123
  }, _ClientEncrypted_receiveLoop = async function _ClientEncrypted_receiveLoop() {
124
124
  if (!this.transport) {
125
- (0, _1_utilities_js_1.UNREACHABLE)();
125
+ (0, _0_deps_js_1.unreachable)();
126
126
  }
127
127
  while (this.connected) {
128
128
  try {
@@ -238,6 +238,6 @@ _ClientEncrypted_authKey = new WeakMap(), _ClientEncrypted_authKeyId = new WeakM
238
238
  }
239
239
  }
240
240
  else {
241
- (0, _1_utilities_js_1.UNREACHABLE)();
241
+ (0, _0_deps_js_1.unreachable)();
242
242
  }
243
243
  };
@@ -71,11 +71,11 @@ class ClientPlain extends _0_client_abstract_js_1.ClientAbstract {
71
71
  }
72
72
  }
73
73
  if (!resPq) {
74
- (0, _1_utilities_js_1.UNREACHABLE)();
74
+ (0, _0_deps_js_1.unreachable)();
75
75
  }
76
76
  const pq_ = (0, _1_utilities_js_1.bigIntFromBuffer)(resPq.pq, false, false);
77
77
  LcreateAuthKey.debug(`pq=${pq_}`);
78
- const [p_, q_] = (0, _0_deps_js_1.factorize)(pq_);
78
+ const [p_, q_] = (0, _1_utilities_js_1.factorize)(pq_);
79
79
  LcreateAuthKey.debug("factorized pq");
80
80
  LcreateAuthKey.debug(`p=${p_}, q=${q_}`);
81
81
  const p = (0, _1_utilities_js_1.bufferFromBigInt)(p_, 4, false, false);
@@ -13,6 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  var _FileManager_instances, _FileManager_c, _FileManager_Lupload, _FileManager_downloadInner;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.FileManager = void 0;
16
+ const _0_deps_js_1 = require("../0_deps.js");
16
17
  const _0_errors_js_1 = require("../0_errors.js");
17
18
  const _1_utilities_js_1 = require("../1_utilities.js");
18
19
  const _2_tl_js_1 = require("../2_tl.js");
@@ -107,7 +108,7 @@ class FileManager {
107
108
  switch (fileId_.type) {
108
109
  case _3_types_js_1.FileType.ProfilePhoto: {
109
110
  if (fileId_.location.source.type != _3_types_js_1.PhotoSourceType.ChatPhotoBig && fileId_.location.source.type != _3_types_js_1.PhotoSourceType.ChatPhotoSmall) {
110
- (0, _1_utilities_js_1.UNREACHABLE)();
111
+ (0, _0_deps_js_1.unreachable)();
111
112
  }
112
113
  const big = fileId_.location.source.type == _3_types_js_1.PhotoSourceType.ChatPhotoBig;
113
114
  const peer = await __classPrivateFieldGet(this, _FileManager_c, "f").getInputPeer(Number(fileId_.location.source.chatId)); // TODO: use access hash from source?
@@ -134,7 +135,7 @@ class FileManager {
134
135
  id: fileId_.location.id,
135
136
  access_hash: fileId_.location.accessHash,
136
137
  file_reference: fileId_.fileReference ?? new Uint8Array(),
137
- thumb_size: "thumbnailType" in fileId_.location.source ? String.fromCharCode(fileId_.location.source.thumbnailType) : (0, _1_utilities_js_1.UNREACHABLE)(),
138
+ thumb_size: "thumbnailType" in fileId_.location.source ? String.fromCharCode(fileId_.location.source.thumbnailType) : (0, _0_deps_js_1.unreachable)(),
138
139
  });
139
140
  for await (const chunk of __classPrivateFieldGet(this, _FileManager_instances, "m", _FileManager_downloadInner).call(this, location, fileId_.dcId, params)) {
140
141
  yield chunk;
@@ -155,7 +156,7 @@ class FileManager {
155
156
  }
156
157
  }
157
158
  else {
158
- (0, _1_utilities_js_1.UNREACHABLE)();
159
+ (0, _0_deps_js_1.unreachable)();
159
160
  }
160
161
  }
161
162
  async getStickerSetName(inputStickerSet, hash = 0) {
@@ -259,7 +260,7 @@ _FileManager_c = new WeakMap(), _FileManager_Lupload = new WeakMap(), _FileManag
259
260
  }
260
261
  }
261
262
  else {
262
- (0, _1_utilities_js_1.UNREACHABLE)();
263
+ (0, _0_deps_js_1.unreachable)();
263
264
  }
264
265
  }
265
266
  }
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  var _ReactionManager_c;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.ReactionManager = void 0;
16
- const _1_utilities_js_1 = require("../1_utilities.js");
16
+ const _0_deps_js_1 = require("../0_deps.js");
17
17
  const _2_tl_js_1 = require("../2_tl.js");
18
18
  const _3_types_js_1 = require("../3_types.js");
19
19
  class ReactionManager {
@@ -80,7 +80,7 @@ class ReactionManager {
80
80
  }
81
81
  }
82
82
  else {
83
- (0, _1_utilities_js_1.UNREACHABLE)();
83
+ (0, _0_deps_js_1.unreachable)();
84
84
  }
85
85
  }
86
86
  }
@@ -13,6 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  var _UpdateManager_instances, _a, _UpdateManager_c, _UpdateManager_updateState, _UpdateManager_updateHandler, _UpdateManager_LrecoverUpdateGap, _UpdateManager_LrecoverChannelUpdateGap, _UpdateManager_L$handleUpdate, _UpdateManager_L$processUpdates, _UpdateManager_LfetchState, _UpdateManager_defaultDropPendingUpdates, _UpdateManager_mustDropPendingUpdates, _UpdateManager_state, _UpdateManager_getState, _UpdateManager_setState, _UpdateManager_handleUpdateQueues, _UpdateManager_nonFirst, _UpdateManager_getChannelPtsWithDropPendingUpdatesCheck, _UpdateManager_checkGap, _UpdateManager_checkGapQts, _UpdateManager_checkChannelGap, _UpdateManager_channelUpdateQueues, _UpdateManager_processChannelPtsUpdateInner, _UpdateManager_queueUpdate, _UpdateManager_processChannelPtsUpdate, _UpdateManager_processPtsUpdateInner, _UpdateManager_ptsUpdateQueue, _UpdateManager_processPtsUpdate, _UpdateManager_processQtsUpdateInner, _UpdateManager_qtsUpdateQueue, _UpdateManager_processQtsUpdate, _UpdateManager_processUpdatesQueue, _UpdateManager_processUpdates, _UpdateManager_setUpdateStateDate, _UpdateManager_setUpdatePts, _UpdateManager_setUpdateQts, _UpdateManager_getLocalState, _UpdateManager_recoverChannelUpdateGap, _UpdateManager_handleUpdatesSet, _UpdateManager_handleStoredUpdates, _UpdateManager_handleUpdate;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.UpdateManager = void 0;
16
+ const _0_deps_js_1 = require("../0_deps.js");
16
17
  const _1_utilities_js_1 = require("../1_utilities.js");
17
18
  const _2_tl_js_1 = require("../2_tl.js");
18
19
  const _4_constants_js_1 = require("../4_constants.js");
@@ -253,7 +254,7 @@ class UpdateManager {
253
254
  state = difference.intermediate_state;
254
255
  }
255
256
  else {
256
- (0, _1_utilities_js_1.UNREACHABLE)();
257
+ (0, _0_deps_js_1.unreachable)();
257
258
  }
258
259
  }
259
260
  else if (difference instanceof _2_tl_js_1.types.updates.DifferenceTooLong) {
@@ -269,7 +270,7 @@ class UpdateManager {
269
270
  break;
270
271
  }
271
272
  else {
272
- (0, _1_utilities_js_1.UNREACHABLE)();
273
+ (0, _0_deps_js_1.unreachable)();
273
274
  }
274
275
  }
275
276
  }
@@ -515,7 +516,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
515
516
  }
516
517
  else if (updates_ instanceof _2_tl_js_1.types.UpdateShortSentMessage) {
517
518
  if (!(call instanceof _2_tl_js_1.functions.messages.sendMessage)) {
518
- (0, _1_utilities_js_1.UNREACHABLE)();
519
+ (0, _0_deps_js_1.unreachable)();
519
520
  }
520
521
  updates = [
521
522
  new _2_tl_js_1.types.UpdateNewMessage({
@@ -545,7 +546,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
545
546
  updates = [updates_];
546
547
  }
547
548
  else {
548
- (0, _1_utilities_js_1.UNREACHABLE)();
549
+ (0, _0_deps_js_1.unreachable)();
549
550
  }
550
551
  /// We process the updates when we are sure there is no gap.
551
552
  if (updates_ instanceof _2_tl_js_1.types.Updates || updates_ instanceof _2_tl_js_1.types.UpdatesCombined) {
@@ -566,7 +567,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
566
567
  await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_setState).call(this, __classPrivateFieldGet(this, _UpdateManager_updateState, "f"));
567
568
  }
568
569
  else {
569
- (0, _1_utilities_js_1.UNREACHABLE)();
570
+ (0, _0_deps_js_1.unreachable)();
570
571
  }
571
572
  }
572
573
  else if (_a.isPtsUpdate(update)) {
@@ -608,7 +609,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
608
609
  await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_setState).call(this, localState);
609
610
  }
610
611
  else {
611
- (0, _1_utilities_js_1.UNREACHABLE)();
612
+ (0, _0_deps_js_1.unreachable)();
612
613
  }
613
614
  }
614
615
  }
@@ -651,7 +652,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
651
652
  pts = pts_;
652
653
  }
653
654
  else {
654
- (0, _1_utilities_js_1.UNREACHABLE)();
655
+ (0, _0_deps_js_1.unreachable)();
655
656
  }
656
657
  __classPrivateFieldGet(this, _UpdateManager_LrecoverChannelUpdateGap, "f").debug("processed channelDifferenceTooLong");
657
658
  }
@@ -23,6 +23,8 @@ const _0_message_search_filter_js_1 = require("../types/0_message_search_filter.
23
23
  const _0_html_js_1 = require("./0_html.js");
24
24
  const _0_markdown_js_1 = require("./0_markdown.js");
25
25
  const _0_utilities_js_1 = require("./0_utilities.js");
26
+ const _0_utilities_js_2 = require("./0_utilities.js");
27
+ const _0_utilities_js_3 = require("./0_utilities.js");
26
28
  const FALLBACK_MIME_TYPE = "application/octet-stream";
27
29
  const STICKER_MIME_TYPES = ["image/webp", "video/webm", "application/x-tgsticker"];
28
30
  class MessageManager {
@@ -44,6 +46,7 @@ class MessageManager {
44
46
  __classPrivateFieldSet(this, _MessageManager_LresolveFileId, L.branch("resolveFileId"), "f");
45
47
  }
46
48
  async getMessages(chatId, messageIds) {
49
+ (0, _0_utilities_js_2.checkArray)(messageIds, _0_utilities_js_1.checkMessageId);
47
50
  const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
48
51
  let messages_ = new Array();
49
52
  const chatId_ = (0, _2_tl_js_1.peerToChatId)(peer);
@@ -114,7 +117,7 @@ class MessageManager {
114
117
  break;
115
118
  }
116
119
  default:
117
- (0, _1_utilities_js_1.UNREACHABLE)();
120
+ (0, _0_deps_js_1.unreachable)();
118
121
  }
119
122
  text = text.trimEnd();
120
123
  for (const entity of entities) {
@@ -122,6 +125,9 @@ class MessageManager {
122
125
  --entity.length;
123
126
  }
124
127
  }
128
+ if (!text.length) {
129
+ throw new _0_errors_js_1.InputError("Text must not be empty.");
130
+ }
125
131
  return [text, entities];
126
132
  }
127
133
  async parseText(text_, params) {
@@ -133,6 +139,7 @@ class MessageManager {
133
139
  return await (0, _3_types_js_2.constructMessage)(message_, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity, this.getMessage.bind(this), __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.getStickerSetName.bind(__classPrivateFieldGet(this, _MessageManager_c, "f").fileManager), r, business);
134
140
  }
135
141
  async forwardMessages(from, to, messageIds, params) {
142
+ (0, _0_utilities_js_2.checkArray)(messageIds, _0_utilities_js_1.checkMessageId);
136
143
  const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.forwardMessages({
137
144
  from_peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(from),
138
145
  to_peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(to),
@@ -176,7 +183,7 @@ class MessageManager {
176
183
  hash: 0n,
177
184
  });
178
185
  if (!("messages" in result)) {
179
- (0, _1_utilities_js_1.UNREACHABLE)();
186
+ (0, _0_deps_js_1.unreachable)();
180
187
  }
181
188
  for (const message_ of result.messages) {
182
189
  const message = await this.constructMessage(message_, false);
@@ -425,11 +432,11 @@ class MessageManager {
425
432
  }
426
433
  }
427
434
  if (media == null) {
428
- if (typeof photo === "string" && (0, _0_utilities_js_1.isHttpUrl)(photo)) {
435
+ if (typeof photo === "string" && (0, _0_utilities_js_3.isHttpUrl)(photo)) {
429
436
  media = new _2_tl_js_1.types.InputMediaPhotoExternal({ url: photo, spoiler });
430
437
  }
431
438
  else {
432
- const [contents, fileName] = await (0, _0_utilities_js_1.getFileContents)(photo);
439
+ const [contents, fileName] = await (0, _0_utilities_js_3.getFileContents)(photo);
433
440
  const file = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(contents, { fileName, chunkSize: params?.chunkSize, signal: params?.signal });
434
441
  media = new _2_tl_js_1.types.InputMediaUploadedPhoto({ file, spoiler });
435
442
  }
@@ -448,10 +455,10 @@ class MessageManager {
448
455
  }
449
456
  if (fileId != null) {
450
457
  if (!expectedFileType.includes(fileId.type)) {
451
- (0, _1_utilities_js_1.UNREACHABLE)();
458
+ (0, _0_deps_js_1.unreachable)();
452
459
  }
453
460
  return {
454
- id: "id" in fileId.location ? fileId.location.id : (0, _1_utilities_js_1.UNREACHABLE)(),
461
+ id: "id" in fileId.location ? fileId.location.id : (0, _0_deps_js_1.unreachable)(),
455
462
  access_hash: fileId.location.accessHash,
456
463
  file_reference: fileId.fileReference ?? new Uint8Array(),
457
464
  };
@@ -459,6 +466,13 @@ class MessageManager {
459
466
  return null;
460
467
  }
461
468
  async sendPoll(chatId, question, options, params) {
469
+ question = question?.trim();
470
+ if (!question) {
471
+ throw new Error("Question must not be empty.");
472
+ }
473
+ if (!Array.isArray(options) || options.length < 2) {
474
+ throw new Error("There must be at least two options.");
475
+ }
462
476
  const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
463
477
  const randomId = (0, _1_utilities_js_1.getRandomId)();
464
478
  const silent = params?.disableNotification ? true : undefined;
@@ -503,7 +517,7 @@ class MessageManager {
503
517
  }
504
518
  async editMessageReplyMarkup(chatId, messageId, params) {
505
519
  const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.editMessage({
506
- id: messageId,
520
+ id: (0, _0_utilities_js_1.checkMessageId)(messageId),
507
521
  peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
508
522
  reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
509
523
  });
@@ -531,7 +545,7 @@ class MessageManager {
531
545
  });
532
546
  }
533
547
  const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.editMessage({
534
- id: messageId,
548
+ id: (0, _0_utilities_js_1.checkMessageId)(messageId),
535
549
  peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
536
550
  entities,
537
551
  message,
@@ -568,6 +582,7 @@ class MessageManager {
568
582
  });
569
583
  }
570
584
  async deleteMessages(chatId, messageIds, params) {
585
+ (0, _0_utilities_js_2.checkArray)(messageIds, _0_utilities_js_1.checkMessageId);
571
586
  const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
572
587
  if (peer instanceof _2_tl_js_1.types.InputPeerChannel) {
573
588
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.channels.deleteMessages({ channel: new _2_tl_js_1.types.InputChannel(peer), id: messageIds });
@@ -584,7 +599,7 @@ class MessageManager {
584
599
  async pinMessage(chatId, messageId, params) {
585
600
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.updatePinnedMessage({
586
601
  peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
587
- id: messageId,
602
+ id: (0, _0_utilities_js_1.checkMessageId)(messageId),
588
603
  silent: params?.disableNotification ? true : undefined,
589
604
  pm_oneside: params?.bothSides ? undefined : true,
590
605
  });
@@ -592,7 +607,7 @@ class MessageManager {
592
607
  async unpinMessage(chatId, messageId) {
593
608
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.updatePinnedMessage({
594
609
  peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
595
- id: messageId,
610
+ id: (0, _0_utilities_js_1.checkMessageId)(messageId),
596
611
  unpin: true,
597
612
  });
598
613
  }
@@ -603,14 +618,18 @@ class MessageManager {
603
618
  // TODO: sync with storage
604
619
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.setChatAvailableReactions({
605
620
  peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
606
- available_reactions: availableReactions == "none" ? new _2_tl_js_1.types.ChatReactionsNone() : availableReactions == "all" ? new _2_tl_js_1.types.ChatReactionsAll() : Array.isArray(availableReactions) ? new _2_tl_js_1.types.ChatReactionsSome({ reactions: availableReactions.map((v) => v.type == "emoji" ? new _2_tl_js_1.types.ReactionEmoji({ emoticon: v.emoji }) : new _2_tl_js_1.types.ReactionCustomEmoji({ document_id: BigInt(v.id) })) }) : (0, _1_utilities_js_1.UNREACHABLE)(),
621
+ available_reactions: availableReactions == "none" ? new _2_tl_js_1.types.ChatReactionsNone() : availableReactions == "all" ? new _2_tl_js_1.types.ChatReactionsAll() : Array.isArray(availableReactions) ? new _2_tl_js_1.types.ChatReactionsSome({ reactions: availableReactions.map((v) => v.type == "emoji" ? new _2_tl_js_1.types.ReactionEmoji({ emoticon: v.emoji }) : new _2_tl_js_1.types.ReactionCustomEmoji({ document_id: BigInt(v.id) })) }) : (0, _0_deps_js_1.unreachable)(),
607
622
  });
608
623
  }
609
624
  async setReactions(chatId, messageId, reactions, params) {
610
625
  await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendReaction).call(this, chatId, messageId, reactions, params);
611
626
  }
612
627
  async addReaction(chatId, messageId, reaction, params) {
613
- const chosenReactions = await this.getMessage(chatId, messageId).then((v) => v?.reactions ?? []).then((v) => v.filter((v) => v.chosen));
628
+ const message = await this.getMessage(chatId, messageId);
629
+ if (!message) {
630
+ throw new _0_errors_js_1.InputError("Message not found.");
631
+ }
632
+ const chosenReactions = (message.reactions ?? []).filter((v) => v.chosen);
614
633
  for (const r of chosenReactions) {
615
634
  if ((0, _3_types_js_2.reactionEqual)(r.reaction, reaction)) {
616
635
  return;
@@ -620,7 +639,11 @@ class MessageManager {
620
639
  await this.setReactions(chatId, messageId, reactions, params);
621
640
  }
622
641
  async removeReaction(chatId, messageId, reaction) {
623
- const chosenReactions = await this.getMessage(chatId, messageId).then((v) => v?.reactions ?? []).then((v) => v.filter((v) => v.chosen));
642
+ const message = await this.getMessage(chatId, messageId);
643
+ if (!message) {
644
+ throw new _0_errors_js_1.InputError("Message not found.");
645
+ }
646
+ const chosenReactions = (message.reactions ?? []).filter((v) => v.chosen);
624
647
  for (const r of chosenReactions) {
625
648
  if ((0, _3_types_js_2.reactionEqual)(r.reaction, reaction)) {
626
649
  const reactions = chosenReactions.filter((v) => v != r).map((v) => v.reaction);
@@ -757,7 +780,7 @@ class MessageManager {
757
780
  async deleteChatPhoto(chatId) {
758
781
  const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
759
782
  if (!(peer instanceof _2_tl_js_1.types.InputPeerChannel) && !(peer instanceof _2_tl_js_1.types.InputPeerChat)) {
760
- (0, _1_utilities_js_1.UNREACHABLE)();
783
+ (0, _0_deps_js_1.unreachable)();
761
784
  }
762
785
  if (peer instanceof _2_tl_js_1.types.InputPeerChannel) {
763
786
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.channels.editPhoto({ channel: new _2_tl_js_1.types.InputChannel(peer), photo: new _2_tl_js_1.types.InputChatPhotoEmpty() });
@@ -769,9 +792,9 @@ class MessageManager {
769
792
  async setChatPhoto(chatId, photo, params) {
770
793
  const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
771
794
  if (!(peer instanceof _2_tl_js_1.types.InputPeerChannel) && !(peer instanceof _2_tl_js_1.types.InputPeerChat)) {
772
- (0, _1_utilities_js_1.UNREACHABLE)();
795
+ (0, _0_deps_js_1.unreachable)();
773
796
  }
774
- const [contents, fileName] = await (0, _0_utilities_js_1.getFileContents)(photo);
797
+ const [contents, fileName] = await (0, _0_utilities_js_3.getFileContents)(photo);
775
798
  const file = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(contents, { fileName: params?.fileName ?? fileName, chunkSize: params?.chunkSize, signal: params?.signal });
776
799
  const photo_ = new _2_tl_js_1.types.InputChatUploadedPhoto({ file });
777
800
  if (peer instanceof _2_tl_js_1.types.InputPeerChannel) {
@@ -853,7 +876,7 @@ class MessageManager {
853
876
  hash: 0n,
854
877
  });
855
878
  if (participants instanceof _2_tl_js_1.types.channels.ChannelParticipantsNotModified) {
856
- (0, _1_utilities_js_1.UNREACHABLE)();
879
+ (0, _0_deps_js_1.unreachable)();
857
880
  }
858
881
  const chatMembers = new Array();
859
882
  for (const p of participants.participants) {
@@ -864,7 +887,7 @@ class MessageManager {
864
887
  else if (peer instanceof _2_tl_js_1.types.InputPeerChat) {
865
888
  const fullChat = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.getFullChat(peer); // TODO: full chat cache
866
889
  if (!(fullChat.full_chat instanceof _2_tl_js_1.types.ChatFull) || !(fullChat.full_chat.participants instanceof _2_tl_js_1.types.ChatParticipants)) {
867
- (0, _1_utilities_js_1.UNREACHABLE)();
890
+ (0, _0_deps_js_1.unreachable)();
868
891
  }
869
892
  const chatMembers = new Array();
870
893
  for (const p of fullChat.full_chat.participants.participants) {
@@ -873,7 +896,7 @@ class MessageManager {
873
896
  return chatMembers;
874
897
  }
875
898
  else {
876
- (0, _1_utilities_js_1.UNREACHABLE)();
899
+ (0, _0_deps_js_1.unreachable)();
877
900
  }
878
901
  }
879
902
  async enableJoinRequests(chatId) {
@@ -900,7 +923,7 @@ class MessageManager {
900
923
  from_id: params?.from ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.from) : undefined,
901
924
  });
902
925
  if (!("messages" in result)) {
903
- (0, _1_utilities_js_1.UNREACHABLE)();
926
+ (0, _0_deps_js_1.unreachable)();
904
927
  }
905
928
  const messages = new Array();
906
929
  for (const message_ of result.messages) {
@@ -951,7 +974,7 @@ class MessageManager {
951
974
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.addChatUser({ chat_id: peer.chat_id, user_id: new _2_tl_js_1.types.InputUserSelf(), fwd_limit: 0 }); // TODO: use potential high-level method for adding participants to chats
952
975
  }
953
976
  else {
954
- (0, _1_utilities_js_1.UNREACHABLE)();
977
+ (0, _0_deps_js_1.unreachable)();
955
978
  }
956
979
  }
957
980
  async leaveChat(chatId) {
@@ -966,7 +989,7 @@ class MessageManager {
966
989
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.deleteChatUser({ chat_id: peer.chat_id, user_id: new _2_tl_js_1.types.InputUserSelf() }); // TODO: use potential high-level method for adding participants to chats
967
990
  }
968
991
  else {
969
- (0, _1_utilities_js_1.UNREACHABLE)();
992
+ (0, _0_deps_js_1.unreachable)();
970
993
  }
971
994
  }
972
995
  async blockUser(userId) {
@@ -1059,7 +1082,7 @@ class MessageManager {
1059
1082
  const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result).then((v) => v[0]);
1060
1083
  return (0, _3_types_js_2.assertMessageType)(message, "location");
1061
1084
  }
1062
- (0, _1_utilities_js_1.UNREACHABLE)();
1085
+ (0, _0_deps_js_1.unreachable)();
1063
1086
  }
1064
1087
  async editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, params) {
1065
1088
  await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertBot("editInlineMessageLiveLocation");
@@ -1137,18 +1160,18 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
1137
1160
  }
1138
1161
  }
1139
1162
  if (media == null) {
1140
- if (typeof document === "string" && (0, _0_utilities_js_1.isHttpUrl)(document)) {
1163
+ if (typeof document === "string" && (0, _0_utilities_js_3.isHttpUrl)(document)) {
1141
1164
  if (!urlSupported) {
1142
1165
  throw new _0_errors_js_1.InputError("URL not supported.");
1143
1166
  }
1144
1167
  media = new _2_tl_js_1.types.InputMediaDocumentExternal({ url: document, spoiler });
1145
1168
  }
1146
1169
  else {
1147
- const [contents, fileName_] = await (0, _0_utilities_js_1.getFileContents)(document);
1170
+ const [contents, fileName_] = await (0, _0_utilities_js_3.getFileContents)(document);
1148
1171
  let fileName = params?.fileName ?? fileName_;
1149
1172
  const mimeType = params?.mimeType ?? (0, _0_deps_js_1.contentType)(fileName.split(".").slice(-1)[0]) ?? FALLBACK_MIME_TYPE;
1150
1173
  if (expectedMimeTypes && !expectedMimeTypes.includes(mimeType)) {
1151
- (0, _1_utilities_js_1.UNREACHABLE)();
1174
+ (0, _0_deps_js_1.unreachable)();
1152
1175
  }
1153
1176
  if (fileName.endsWith(".tgs") && fileType == _3_types_js_2.FileType.Document) {
1154
1177
  fileName += "-";
@@ -1156,7 +1179,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
1156
1179
  const file = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(contents, { fileName, chunkSize: params?.chunkSize, signal: params?.signal });
1157
1180
  let thumb = undefined;
1158
1181
  if (params?.thumbnail) {
1159
- const [thumbContents, fileName__] = await (0, _0_utilities_js_1.getFileContents)(params.thumbnail);
1182
+ const [thumbContents, fileName__] = await (0, _0_utilities_js_3.getFileContents)(params.thumbnail);
1160
1183
  thumb = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(thumbContents, { fileName: fileName__, chunkSize: params?.chunkSize, signal: params?.signal });
1161
1184
  }
1162
1185
  media = new _2_tl_js_1.types.InputMediaUploadedDocument({
@@ -1198,7 +1221,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(
1198
1221
  }, _MessageManager_sendReaction = async function _MessageManager_sendReaction(chatId, messageId, reactions, params) {
1199
1222
  await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.sendReaction({
1200
1223
  peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
1201
- msg_id: messageId,
1224
+ msg_id: (0, _0_utilities_js_1.checkMessageId)(messageId),
1202
1225
  reaction: reactions.map((v) => (0, _3_types_js_2.reactionToTlObject)(v)),
1203
1226
  big: params?.big ? true : undefined,
1204
1227
  add_to_recent: params?.addToRecents ? true : undefined,
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.CallbackQueryManager = void 0;
16
16
  const _2_tl_js_1 = require("../2_tl.js");
17
17
  const _3_types_js_1 = require("../3_types.js");
18
+ const _0_utilities_js_1 = require("./0_utilities.js");
18
19
  class CallbackQueryManager {
19
20
  constructor(c) {
20
21
  _CallbackQueryManager_c.set(this, void 0);
@@ -22,6 +23,7 @@ class CallbackQueryManager {
22
23
  }
23
24
  async answerCallbackQuery(id, params) {
24
25
  await __classPrivateFieldGet(this, _CallbackQueryManager_c, "f").storage.assertBot("answerCallbackQuery");
26
+ (0, _0_utilities_js_1.checkCallbackQueryId)(id);
25
27
  await __classPrivateFieldGet(this, _CallbackQueryManager_c, "f").api.messages.setBotCallbackAnswer({
26
28
  query_id: BigInt(id),
27
29
  cache_time: params?.cacheTime ?? 0,
@@ -13,6 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  var _ChatListManager_instances, _ChatListManager_c, _ChatListManager_LgetChats, _ChatListManager_sendChatUpdate, _ChatListManager_chats, _ChatListManager_archivedChats, _ChatListManager_chatsLoadedFromStorage, _ChatListManager_tryGetChatId, _ChatListManager_getChatAnywhere, _ChatListManager_getChatList, _ChatListManager_loadChatsFromStorage, _ChatListManager_getLoadedChats, _ChatListManager_pinnedChats, _ChatListManager_pinnedArchiveChats, _ChatListManager_storageHadPinnedChats, _ChatListManager_pinnedChatsLoaded, _ChatListManager_loadPinnedChats, _ChatListManager_fetchPinnedChats, _ChatListManager_getPinnedChats, _ChatListManager_updateOrAddChat, _ChatListManager_removeChat, _ChatListManager_handleUpdateFolderPeers, _ChatListManager_handleUpdatePinnedDialogs, _ChatListManager_handleUpdateChannel, _ChatListManager_handleUpdateChat, _ChatListManager_handleUpdateUser, _ChatListManager_fetchChats;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.ChatListManager = void 0;
16
+ const _0_deps_js_1 = require("../0_deps.js");
16
17
  const _0_errors_js_1 = require("../0_errors.js");
17
18
  const _1_utilities_js_1 = require("../1_utilities.js");
18
19
  const _2_tl_js_1 = require("../2_tl.js");
@@ -57,7 +58,7 @@ class ChatListManager {
57
58
  const pinnedChats = await __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getPinnedChats).call(this, listId);
58
59
  const chat = await (0, _3_types_js_1.constructChat3)(chatId, pinnedChats.indexOf(chatId), message, __classPrivateFieldGet(this, _ChatListManager_c, "f").getEntity);
59
60
  if (chat == null) {
60
- (0, _1_utilities_js_1.UNREACHABLE)();
61
+ (0, _0_deps_js_1.unreachable)();
61
62
  }
62
63
  __classPrivateFieldGet(this, _ChatListManager_chats, "f").set(chatId, chat);
63
64
  await __classPrivateFieldGet(this, _ChatListManager_c, "f").storage.setChat(listId, chatId, chat.pinned, chat.lastMessage?.id ?? 0, chat.lastMessage?.date ?? new Date(0));
@@ -78,7 +79,7 @@ class ChatListManager {
78
79
  const pinnedChats = await __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getPinnedChats).call(this, listId);
79
80
  const chat = await (0, _3_types_js_1.constructChat3)(chatId, pinnedChats.indexOf(chatId), message, __classPrivateFieldGet(this, _ChatListManager_c, "f").getEntity);
80
81
  if (chat == null) {
81
- (0, _1_utilities_js_1.UNREACHABLE)();
82
+ (0, _0_deps_js_1.unreachable)();
82
83
  }
83
84
  __classPrivateFieldGet(this, _ChatListManager_chats, "f").set(chatId, chat);
84
85
  }
@@ -149,7 +150,7 @@ class ChatListManager {
149
150
  await __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_handleUpdateUser).call(this, update);
150
151
  }
151
152
  else {
152
- (0, _1_utilities_js_1.UNREACHABLE)();
153
+ (0, _0_deps_js_1.unreachable)();
153
154
  }
154
155
  }
155
156
  async getChat(chatId) {
@@ -162,7 +163,7 @@ class ChatListManager {
162
163
  maybeChatId = __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_tryGetChatId).call(this, (0, _0_utilities_js_1.getUsername)(chatId));
163
164
  }
164
165
  else {
165
- (0, _1_utilities_js_1.UNREACHABLE)();
166
+ (0, _0_deps_js_1.unreachable)();
166
167
  }
167
168
  if (maybeChatId != null) {
168
169
  const [chat] = __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getChatAnywhere).call(this, maybeChatId);
@@ -193,7 +194,7 @@ class ChatListManager {
193
194
  const chats = await __classPrivateFieldGet(this, _ChatListManager_c, "f").api.messages.getChats({ id: [inputPeer.chat_id] }).then((v) => v[_2_tl_js_1.as](_2_tl_js_1.types.messages.Chats));
194
195
  const chat = chats.chats[0];
195
196
  if (chat instanceof _2_tl_js_1.types.ChatEmpty) {
196
- (0, _1_utilities_js_1.UNREACHABLE)();
197
+ (0, _0_deps_js_1.unreachable)();
197
198
  }
198
199
  return (0, _3_types_js_1.constructChat2)(chat, -1, undefined);
199
200
  }
@@ -201,7 +202,7 @@ class ChatListManager {
201
202
  const channels = await __classPrivateFieldGet(this, _ChatListManager_c, "f").api.channels.getChannels({ id: [new _2_tl_js_1.types.InputChannel(inputPeer)] });
202
203
  const channel = channels.chats[0];
203
204
  if (channel instanceof _2_tl_js_1.types.ChatEmpty) {
204
- (0, _1_utilities_js_1.UNREACHABLE)();
205
+ (0, _0_deps_js_1.unreachable)();
205
206
  }
206
207
  return (0, _3_types_js_1.constructChat2)(channel, -1, undefined);
207
208
  }
@@ -209,12 +210,12 @@ class ChatListManager {
209
210
  const users = await __classPrivateFieldGet(this, _ChatListManager_c, "f").api.users.getUsers({ id: [new _2_tl_js_1.types.InputUser(inputPeer)] });
210
211
  const user = users[0];
211
212
  if (user instanceof _2_tl_js_1.types.UserEmpty) {
212
- (0, _1_utilities_js_1.UNREACHABLE)();
213
+ (0, _0_deps_js_1.unreachable)();
213
214
  }
214
215
  return (0, _3_types_js_1.constructChat2)(user, -1, undefined);
215
216
  }
216
217
  else {
217
- (0, _1_utilities_js_1.UNREACHABLE)();
218
+ (0, _0_deps_js_1.unreachable)();
218
219
  }
219
220
  }
220
221
  }
@@ -320,7 +321,7 @@ _ChatListManager_c = new WeakMap(), _ChatListManager_LgetChats = new WeakMap(),
320
321
  await __classPrivateFieldGet(this, _ChatListManager_c, "f").storage.setPinnedChats(1, __classPrivateFieldGet(this, _ChatListManager_pinnedArchiveChats, "f"));
321
322
  }
322
323
  if (listId != null && listId != 0 && listId != 1) {
323
- (0, _1_utilities_js_1.UNREACHABLE)();
324
+ (0, _0_deps_js_1.unreachable)();
324
325
  }
325
326
  }, _ChatListManager_getPinnedChats = async function _ChatListManager_getPinnedChats(listId) {
326
327
  if (!__classPrivateFieldGet(this, _ChatListManager_pinnedChatsLoaded, "f")) {
@@ -335,7 +336,7 @@ _ChatListManager_c = new WeakMap(), _ChatListManager_LgetChats = new WeakMap(),
335
336
  case 1:
336
337
  return __classPrivateFieldGet(this, _ChatListManager_pinnedArchiveChats, "f");
337
338
  default:
338
- (0, _1_utilities_js_1.UNREACHABLE)();
339
+ (0, _0_deps_js_1.unreachable)();
339
340
  }
340
341
  }, _ChatListManager_updateOrAddChat = async function _ChatListManager_updateOrAddChat(chatId) {
341
342
  const [chat, listId] = __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getChatAnywhere).call(this, chatId);
@@ -432,7 +433,7 @@ _ChatListManager_c = new WeakMap(), _ChatListManager_LgetChats = new WeakMap(),
432
433
  });
433
434
  const pinnedChats = await __classPrivateFieldGet(this, _ChatListManager_instances, "m", _ChatListManager_getPinnedChats).call(this, listId);
434
435
  if (!(dialogs instanceof _2_tl_js_1.types.messages.Dialogs) && !(dialogs instanceof _2_tl_js_1.types.messages.DialogsSlice)) {
435
- (0, _1_utilities_js_1.UNREACHABLE)();
436
+ (0, _0_deps_js_1.unreachable)();
436
437
  }
437
438
  if (dialogs.dialogs.length < limit) {
438
439
  await __classPrivateFieldGet(this, _ChatListManager_c, "f").storage.setHasAllChats(listId, true);
@@ -13,9 +13,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  var _InlineQueryManager_c;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.InlineQueryManager = void 0;
16
- const _1_utilities_js_1 = require("../1_utilities.js");
16
+ const _0_deps_js_1 = require("../0_deps.js");
17
17
  const _2_tl_js_1 = require("../2_tl.js");
18
18
  const _3_types_js_1 = require("../3_types.js");
19
+ const _0_utilities_js_1 = require("./0_utilities.js");
19
20
  class InlineQueryManager {
20
21
  constructor(c) {
21
22
  _InlineQueryManager_c.set(this, void 0);
@@ -23,6 +24,7 @@ class InlineQueryManager {
23
24
  }
24
25
  async answerInlineQuery(id, results, params) {
25
26
  await __classPrivateFieldGet(this, _InlineQueryManager_c, "f").storage.assertBot("answerInlineQuery");
27
+ (0, _0_utilities_js_1.checkInlineQueryId)(id);
26
28
  await __classPrivateFieldGet(this, _InlineQueryManager_c, "f").api.messages.setInlineBotResults({
27
29
  query_id: BigInt(id),
28
30
  results: await Promise.all(results.map((v) => (0, _3_types_js_1.inlineQueryResultToTlObject)(v, __classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager.parseText.bind(__classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager), __classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager.usernameResolver.bind(__classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager)))),
@@ -45,7 +47,7 @@ class InlineQueryManager {
45
47
  return { chosenInlineResult: await (0, _3_types_js_1.constructChosenInlineResult)(update, __classPrivateFieldGet(this, _InlineQueryManager_c, "f").getEntity) };
46
48
  }
47
49
  else {
48
- (0, _1_utilities_js_1.UNREACHABLE)();
50
+ (0, _0_deps_js_1.unreachable)();
49
51
  }
50
52
  }
51
53
  }