@mtkruto/node 0.1.139 → 0.1.141

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 (287) hide show
  1. package/esm/3_types.d.ts +10 -36
  2. package/esm/3_types.js +10 -36
  3. package/esm/4_constants.d.ts +1 -1
  4. package/esm/4_constants.js +1 -1
  5. package/esm/5_client.d.ts +1 -1
  6. package/esm/5_client.js +1 -1
  7. package/esm/_dnt.polyfills.d.ts +6 -0
  8. package/esm/client/0_filters.d.ts +60 -0
  9. package/esm/client/0_filters.js +27 -0
  10. package/esm/client/0_message.js +2 -2
  11. package/esm/client/{3_params.d.ts → 0_params.d.ts} +30 -33
  12. package/esm/client/0_types.d.ts +39 -0
  13. package/esm/client/0_types.js +2 -0
  14. package/esm/client/0_utilities.d.ts +1 -47
  15. package/esm/client/0_utilities.js +0 -27
  16. package/esm/client/1_composer.d.ts +1 -1
  17. package/esm/client/1_composer.js +1 -1
  18. package/esm/client/1_file_manager.d.ts +10 -0
  19. package/esm/client/1_file_manager.js +241 -0
  20. package/esm/client/1_update_manager.d.ts +18 -0
  21. package/esm/client/1_update_manager.js +553 -0
  22. package/esm/client/2_message_manager.d.ts +40 -0
  23. package/esm/client/2_message_manager.js +621 -0
  24. package/esm/client/3_chat_list_manager.d.ts +21 -0
  25. package/esm/client/3_chat_list_manager.js +353 -0
  26. package/esm/client/3_reaction_manager.d.ts +16 -0
  27. package/esm/client/3_reaction_manager.js +61 -0
  28. package/esm/client/4_client.d.ts +187 -60
  29. package/esm/client/4_client.js +492 -1698
  30. package/esm/connection/1_connection_web_socket.js +6 -6
  31. package/esm/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.d.ts +1 -1
  32. package/esm/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.js +1 -1
  33. package/esm/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.d.ts +1 -0
  34. package/esm/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.js +524 -0
  35. package/esm/mod.d.ts +1 -0
  36. package/esm/mod.js +1 -0
  37. package/esm/storage/0_storage.d.ts +5 -3
  38. package/esm/storage/0_storage.js +14 -4
  39. package/esm/tl/1_tl_object.d.ts +1 -0
  40. package/esm/tl/1_tl_object.js +24 -0
  41. package/esm/types/0_bot_command.d.ts +1 -0
  42. package/esm/types/0_chat_member_rights.d.ts +37 -0
  43. package/esm/types/0_chat_photo.d.ts +4 -4
  44. package/esm/types/0_file_source.d.ts +5 -0
  45. package/esm/types/0_giveaway_parameters.js +2 -1
  46. package/esm/types/0_id.d.ts +4 -0
  47. package/esm/types/0_message_entity.d.ts +20 -20
  48. package/esm/types/1__getters.d.ts +2 -2
  49. package/esm/types/1_animation.d.ts +1 -1
  50. package/esm/types/1_bot_command_scope.d.ts +5 -4
  51. package/esm/types/1_chat_p.d.ts +5 -6
  52. package/esm/types/1_document.d.ts +1 -0
  53. package/esm/types/1_input_message_content.d.ts +88 -0
  54. package/esm/types/1_photo.d.ts +1 -1
  55. package/esm/types/1_sticker.d.ts +1 -1
  56. package/esm/types/1_user.d.ts +1 -1
  57. package/esm/types/1_video.d.ts +1 -1
  58. package/esm/types/1_video_note.d.ts +1 -1
  59. package/esm/types/2_inline_keyboard_button.d.ts +10 -10
  60. package/esm/types/2_message_reaction_count.d.ts +3 -0
  61. package/esm/types/2_message_reaction_count.js +17 -1
  62. package/esm/types/2_message_reactions.d.ts +15 -0
  63. package/esm/types/2_message_reactions.js +37 -0
  64. package/esm/types/3_reply_markup.d.ts +42 -0
  65. package/esm/types/3_reply_markup.js +117 -0
  66. package/esm/types/4_inline_query_result.d.ts +193 -0
  67. package/esm/types/{5_inline_query_result.js → 4_inline_query_result.js} +2 -2
  68. package/esm/types/4_message.d.ts +36 -39
  69. package/esm/types/4_message.js +7 -24
  70. package/esm/types/5_callback_query.d.ts +2 -1
  71. package/esm/types/5_chat.d.ts +8 -5
  72. package/esm/types/6_update.d.ts +12 -2
  73. package/esm/utilities/0_buffer.js +9 -6
  74. package/esm/utilities/0_object.d.ts +1 -1
  75. package/esm/utilities/0_object.js +1 -6
  76. package/esm/utilities/1_misc.d.ts +2 -0
  77. package/esm/utilities/1_misc.js +6 -0
  78. package/package.json +1 -2
  79. package/script/3_types.d.ts +10 -36
  80. package/script/3_types.js +10 -36
  81. package/script/4_constants.d.ts +1 -1
  82. package/script/4_constants.js +1 -1
  83. package/script/5_client.d.ts +1 -1
  84. package/script/5_client.js +1 -1
  85. package/script/_dnt.polyfills.d.ts +6 -0
  86. package/script/client/0_filters.d.ts +60 -0
  87. package/script/client/0_filters.js +31 -0
  88. package/script/client/0_message.js +1 -1
  89. package/script/client/{3_params.d.ts → 0_params.d.ts} +30 -33
  90. package/script/client/0_types.d.ts +39 -0
  91. package/script/client/0_types.js +6 -0
  92. package/script/client/0_utilities.d.ts +1 -47
  93. package/script/client/0_utilities.js +1 -29
  94. package/script/client/1_composer.d.ts +1 -1
  95. package/script/client/1_composer.js +2 -2
  96. package/script/client/1_file_manager.d.ts +10 -0
  97. package/script/client/1_file_manager.js +245 -0
  98. package/script/client/1_update_manager.d.ts +18 -0
  99. package/script/client/1_update_manager.js +557 -0
  100. package/script/client/2_message_manager.d.ts +40 -0
  101. package/script/client/2_message_manager.js +625 -0
  102. package/script/client/3_chat_list_manager.d.ts +21 -0
  103. package/script/client/3_chat_list_manager.js +357 -0
  104. package/script/client/3_reaction_manager.d.ts +16 -0
  105. package/script/client/3_reaction_manager.js +65 -0
  106. package/script/client/4_client.d.ts +187 -60
  107. package/script/client/4_client.js +491 -1698
  108. package/script/connection/1_connection_web_socket.js +5 -5
  109. package/script/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.d.ts +1 -1
  110. package/script/deps/raw.githubusercontent.com/MTKruto/debug/main/deps.js +2 -2
  111. package/script/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.d.ts +1 -0
  112. package/script/deps/raw.githubusercontent.com/MTKruto/object-inspect/main/index.js +550 -0
  113. package/script/mod.d.ts +1 -0
  114. package/script/mod.js +1 -0
  115. package/script/storage/0_storage.d.ts +5 -3
  116. package/script/storage/0_storage.js +14 -4
  117. package/script/tl/1_tl_object.d.ts +1 -0
  118. package/script/tl/1_tl_object.js +24 -0
  119. package/script/types/0_bot_command.d.ts +1 -0
  120. package/script/types/0_chat_member_rights.d.ts +37 -0
  121. package/script/types/0_chat_photo.d.ts +4 -4
  122. package/script/types/0_file_source.d.ts +5 -0
  123. package/script/types/0_giveaway_parameters.js +2 -1
  124. package/script/types/0_id.d.ts +4 -0
  125. package/script/types/0_message_entity.d.ts +20 -20
  126. package/script/types/1__getters.d.ts +2 -2
  127. package/script/types/1_animation.d.ts +1 -1
  128. package/script/types/1_bot_command_scope.d.ts +5 -4
  129. package/script/types/1_chat_p.d.ts +5 -6
  130. package/script/types/1_document.d.ts +1 -0
  131. package/script/types/1_input_message_content.d.ts +88 -0
  132. package/script/types/1_photo.d.ts +1 -1
  133. package/script/types/1_sticker.d.ts +1 -1
  134. package/script/types/1_user.d.ts +1 -1
  135. package/script/types/1_video.d.ts +1 -1
  136. package/script/types/1_video_note.d.ts +1 -1
  137. package/script/types/2_inline_keyboard_button.d.ts +10 -10
  138. package/script/types/2_message_reaction_count.d.ts +3 -0
  139. package/script/types/2_message_reaction_count.js +19 -0
  140. package/script/types/2_message_reactions.d.ts +15 -0
  141. package/script/types/2_message_reactions.js +41 -0
  142. package/script/types/3_reply_markup.d.ts +42 -0
  143. package/script/types/3_reply_markup.js +122 -0
  144. package/script/types/4_inline_query_result.d.ts +193 -0
  145. package/script/types/{5_inline_query_result.js → 4_inline_query_result.js} +3 -3
  146. package/script/types/4_message.d.ts +36 -39
  147. package/script/types/4_message.js +6 -23
  148. package/script/types/5_callback_query.d.ts +2 -1
  149. package/script/types/5_chat.d.ts +8 -5
  150. package/script/types/6_update.d.ts +12 -2
  151. package/script/utilities/0_buffer.js +9 -6
  152. package/script/utilities/0_object.d.ts +1 -1
  153. package/script/utilities/0_object.js +1 -6
  154. package/script/utilities/1_misc.d.ts +2 -0
  155. package/script/utilities/1_misc.js +9 -1
  156. package/esm/types/0_chat_id.d.ts +0 -4
  157. package/esm/types/0_force_reply.d.ts +0 -12
  158. package/esm/types/0_force_reply.js +0 -17
  159. package/esm/types/0_input_contact_message_content.d.ts +0 -11
  160. package/esm/types/0_input_location_message_content.d.ts +0 -15
  161. package/esm/types/0_input_venue_message_content.d.ts +0 -19
  162. package/esm/types/0_reply_keyboard_remove.d.ts +0 -10
  163. package/esm/types/0_reply_keyboard_remove.js +0 -8
  164. package/esm/types/1_input_invoice_message_content.d.ts +0 -23
  165. package/esm/types/1_input_text_message_content.d.ts +0 -8
  166. package/esm/types/1_input_text_message_content.js +0 -1
  167. package/esm/types/2_input_message_content.d.ts +0 -6
  168. package/esm/types/2_input_message_content.js +0 -1
  169. package/esm/types/2_reply_keyboard_markup.d.ts +0 -12
  170. package/esm/types/2_reply_keyboard_markup.js +0 -37
  171. package/esm/types/3_inline_keyboard_markup.d.ts +0 -8
  172. package/esm/types/3_inline_keyboard_markup.js +0 -24
  173. package/esm/types/4_inline_query_result_article.d.ts +0 -15
  174. package/esm/types/4_inline_query_result_article.js +0 -1
  175. package/esm/types/4_inline_query_result_audio.d.ts +0 -17
  176. package/esm/types/4_inline_query_result_audio.js +0 -1
  177. package/esm/types/4_inline_query_result_cached_audio.d.ts +0 -14
  178. package/esm/types/4_inline_query_result_cached_audio.js +0 -1
  179. package/esm/types/4_inline_query_result_cached_document.d.ts +0 -15
  180. package/esm/types/4_inline_query_result_cached_document.js +0 -1
  181. package/esm/types/4_inline_query_result_cached_gif.d.ts +0 -15
  182. package/esm/types/4_inline_query_result_cached_gif.js +0 -1
  183. package/esm/types/4_inline_query_result_cached_mpeg4_gif.d.ts +0 -15
  184. package/esm/types/4_inline_query_result_cached_mpeg4_gif.js +0 -1
  185. package/esm/types/4_inline_query_result_cached_photo.d.ts +0 -16
  186. package/esm/types/4_inline_query_result_cached_photo.js +0 -1
  187. package/esm/types/4_inline_query_result_cached_sticker.d.ts +0 -9
  188. package/esm/types/4_inline_query_result_cached_sticker.js +0 -1
  189. package/esm/types/4_inline_query_result_cached_video.d.ts +0 -16
  190. package/esm/types/4_inline_query_result_cached_video.js +0 -1
  191. package/esm/types/4_inline_query_result_cached_voice.d.ts +0 -15
  192. package/esm/types/4_inline_query_result_cached_voice.js +0 -1
  193. package/esm/types/4_inline_query_result_contact.d.ts +0 -15
  194. package/esm/types/4_inline_query_result_contact.js +0 -1
  195. package/esm/types/4_inline_query_result_document.d.ts +0 -18
  196. package/esm/types/4_inline_query_result_document.js +0 -1
  197. package/esm/types/4_inline_query_result_game.d.ts +0 -7
  198. package/esm/types/4_inline_query_result_game.js +0 -1
  199. package/esm/types/4_inline_query_result_gif.d.ts +0 -20
  200. package/esm/types/4_inline_query_result_gif.js +0 -1
  201. package/esm/types/4_inline_query_result_location.d.ts +0 -18
  202. package/esm/types/4_inline_query_result_location.js +0 -1
  203. package/esm/types/4_inline_query_result_mpeg4_gif.d.ts +0 -20
  204. package/esm/types/4_inline_query_result_mpeg4_gif.js +0 -1
  205. package/esm/types/4_inline_query_result_photo.d.ts +0 -19
  206. package/esm/types/4_inline_query_result_photo.js +0 -1
  207. package/esm/types/4_inline_query_result_venue.d.ts +0 -19
  208. package/esm/types/4_inline_query_result_venue.js +0 -1
  209. package/esm/types/4_inline_query_result_video.d.ts +0 -21
  210. package/esm/types/4_inline_query_result_video.js +0 -1
  211. package/esm/types/4_inline_query_result_voice.d.ts +0 -16
  212. package/esm/types/4_inline_query_result_voice.js +0 -1
  213. package/esm/types/4_reply_markup.d.ts +0 -7
  214. package/esm/types/4_reply_markup.js +0 -22
  215. package/esm/types/5_inline_query_result.d.ts +0 -28
  216. package/script/types/0_chat_id.d.ts +0 -4
  217. package/script/types/0_force_reply.d.ts +0 -12
  218. package/script/types/0_force_reply.js +0 -22
  219. package/script/types/0_input_contact_message_content.d.ts +0 -11
  220. package/script/types/0_input_location_message_content.d.ts +0 -15
  221. package/script/types/0_input_venue_message_content.d.ts +0 -19
  222. package/script/types/0_reply_keyboard_remove.d.ts +0 -10
  223. package/script/types/0_reply_keyboard_remove.js +0 -13
  224. package/script/types/1_input_invoice_message_content.d.ts +0 -23
  225. package/script/types/1_input_text_message_content.d.ts +0 -8
  226. package/script/types/1_input_text_message_content.js +0 -2
  227. package/script/types/2_input_message_content.d.ts +0 -6
  228. package/script/types/2_input_message_content.js +0 -2
  229. package/script/types/2_reply_keyboard_markup.d.ts +0 -12
  230. package/script/types/2_reply_keyboard_markup.js +0 -42
  231. package/script/types/3_inline_keyboard_markup.d.ts +0 -8
  232. package/script/types/3_inline_keyboard_markup.js +0 -29
  233. package/script/types/4_inline_query_result_article.d.ts +0 -15
  234. package/script/types/4_inline_query_result_article.js +0 -2
  235. package/script/types/4_inline_query_result_audio.d.ts +0 -17
  236. package/script/types/4_inline_query_result_audio.js +0 -2
  237. package/script/types/4_inline_query_result_cached_audio.d.ts +0 -14
  238. package/script/types/4_inline_query_result_cached_audio.js +0 -2
  239. package/script/types/4_inline_query_result_cached_document.d.ts +0 -15
  240. package/script/types/4_inline_query_result_cached_document.js +0 -2
  241. package/script/types/4_inline_query_result_cached_gif.d.ts +0 -15
  242. package/script/types/4_inline_query_result_cached_gif.js +0 -2
  243. package/script/types/4_inline_query_result_cached_mpeg4_gif.d.ts +0 -15
  244. package/script/types/4_inline_query_result_cached_mpeg4_gif.js +0 -2
  245. package/script/types/4_inline_query_result_cached_photo.d.ts +0 -16
  246. package/script/types/4_inline_query_result_cached_photo.js +0 -2
  247. package/script/types/4_inline_query_result_cached_sticker.d.ts +0 -9
  248. package/script/types/4_inline_query_result_cached_sticker.js +0 -2
  249. package/script/types/4_inline_query_result_cached_video.d.ts +0 -16
  250. package/script/types/4_inline_query_result_cached_video.js +0 -2
  251. package/script/types/4_inline_query_result_cached_voice.d.ts +0 -15
  252. package/script/types/4_inline_query_result_cached_voice.js +0 -2
  253. package/script/types/4_inline_query_result_contact.d.ts +0 -15
  254. package/script/types/4_inline_query_result_contact.js +0 -2
  255. package/script/types/4_inline_query_result_document.d.ts +0 -18
  256. package/script/types/4_inline_query_result_document.js +0 -2
  257. package/script/types/4_inline_query_result_game.d.ts +0 -7
  258. package/script/types/4_inline_query_result_game.js +0 -2
  259. package/script/types/4_inline_query_result_gif.d.ts +0 -20
  260. package/script/types/4_inline_query_result_gif.js +0 -2
  261. package/script/types/4_inline_query_result_location.d.ts +0 -18
  262. package/script/types/4_inline_query_result_location.js +0 -2
  263. package/script/types/4_inline_query_result_mpeg4_gif.d.ts +0 -20
  264. package/script/types/4_inline_query_result_mpeg4_gif.js +0 -2
  265. package/script/types/4_inline_query_result_photo.d.ts +0 -19
  266. package/script/types/4_inline_query_result_photo.js +0 -2
  267. package/script/types/4_inline_query_result_venue.d.ts +0 -19
  268. package/script/types/4_inline_query_result_venue.js +0 -2
  269. package/script/types/4_inline_query_result_video.d.ts +0 -21
  270. package/script/types/4_inline_query_result_video.js +0 -2
  271. package/script/types/4_inline_query_result_voice.d.ts +0 -16
  272. package/script/types/4_inline_query_result_voice.js +0 -2
  273. package/script/types/4_reply_markup.d.ts +0 -7
  274. package/script/types/4_reply_markup.js +0 -26
  275. package/script/types/5_inline_query_result.d.ts +0 -28
  276. /package/esm/{client/3_params.js → _dnt.polyfills.js} +0 -0
  277. /package/esm/{types/0_chat_id.js → client/0_params.js} +0 -0
  278. /package/esm/types/{0_input_contact_message_content.js → 0_chat_member_rights.js} +0 -0
  279. /package/esm/types/{0_input_location_message_content.js → 0_file_source.js} +0 -0
  280. /package/esm/types/{0_input_venue_message_content.js → 0_id.js} +0 -0
  281. /package/esm/types/{1_input_invoice_message_content.js → 1_input_message_content.js} +0 -0
  282. /package/script/{client/3_params.js → _dnt.polyfills.js} +0 -0
  283. /package/script/{types/0_chat_id.js → client/0_params.js} +0 -0
  284. /package/script/types/{0_input_contact_message_content.js → 0_chat_member_rights.js} +0 -0
  285. /package/script/types/{0_input_location_message_content.js → 0_file_source.js} +0 -0
  286. /package/script/types/{0_input_venue_message_content.js → 0_id.js} +0 -0
  287. /package/script/types/{1_input_invoice_message_content.js → 1_input_message_content.js} +0 -0
@@ -12,7 +12,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
12
12
  var _ConnectionWebSocket_instances, _ConnectionWebSocket_webSocket, _ConnectionWebSocket_rMutex, _ConnectionWebSocket_wMutex, _ConnectionWebSocket_buffer, _ConnectionWebSocket_nextResolve, _ConnectionWebSocket_initWs, _ConnectionWebSocket_wasConnected, _ConnectionWebSocket_isConnecting, _ConnectionWebSocket_connectionError, _ConnectionWebSocket_assertConnected, _ConnectionWebSocket_rejectRead;
13
13
  import * as dntShim from "../_dnt.shims.js";
14
14
  import { debug, Mutex } from "../0_deps.js";
15
- import { UNREACHABLE } from "../1_utilities.js";
15
+ import { concat, UNREACHABLE } from "../1_utilities.js";
16
16
  import { ConnectionUnframed } from "./0_connection.js";
17
17
  const d = debug("ConnectionWebSocket");
18
18
  const errConnectionNotOpen = new Error("Connection not open");
@@ -29,7 +29,7 @@ export class ConnectionWebSocket extends ConnectionUnframed {
29
29
  _ConnectionWebSocket_webSocket.set(this, void 0);
30
30
  _ConnectionWebSocket_rMutex.set(this, new Mutex());
31
31
  _ConnectionWebSocket_wMutex.set(this, new Mutex());
32
- _ConnectionWebSocket_buffer.set(this, new Array());
32
+ _ConnectionWebSocket_buffer.set(this, new Uint8Array());
33
33
  _ConnectionWebSocket_nextResolve.set(this, null);
34
34
  _ConnectionWebSocket_wasConnected.set(this, false);
35
35
  _ConnectionWebSocket_isConnecting.set(this, false);
@@ -76,7 +76,9 @@ export class ConnectionWebSocket extends ConnectionUnframed {
76
76
  if (__classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f").length < p.length) {
77
77
  await new Promise((resolve, reject) => __classPrivateFieldSet(this, _ConnectionWebSocket_nextResolve, [p.length, { resolve, reject }], "f"));
78
78
  }
79
- p.set(__classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f").splice(0, p.length));
79
+ const slice = __classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f").slice(0, p.length);
80
+ p.set(slice);
81
+ __classPrivateFieldSet(this, _ConnectionWebSocket_buffer, __classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f").slice(slice.length), "f");
80
82
  }
81
83
  finally {
82
84
  release();
@@ -115,9 +117,7 @@ _ConnectionWebSocket_webSocket = new WeakMap(), _ConnectionWebSocket_rMutex = ne
115
117
  }
116
118
  const release = await mutex.acquire();
117
119
  const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob || v instanceof Uint8Array ? v : v instanceof ArrayBuffer ? v : UNREACHABLE())).arrayBuffer());
118
- for (const byte of data) {
119
- __classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f").push(byte);
120
- }
120
+ __classPrivateFieldSet(this, _ConnectionWebSocket_buffer, concat(__classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f"), data), "f");
121
121
  if (__classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f") != null && __classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f").length >= __classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f")[0]) {
122
122
  __classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f")[1].resolve();
123
123
  __classPrivateFieldSet(this, _ConnectionWebSocket_nextResolve, null, "f");
@@ -1,2 +1,2 @@
1
1
  export * as colors from "../../../../deno.land/std@0.69.0/fmt/colors.js";
2
- export { default as inspect } from "object-inspect";
2
+ export { default as inspect } from "../../object-inspect/main/index.js";
@@ -1,2 +1,2 @@
1
1
  export * as colors from "../../../../deno.land/std@0.69.0/fmt/colors.js";
2
- export { default as inspect } from "object-inspect";
2
+ export { default as inspect } from "../../object-inspect/main/index.js";
@@ -0,0 +1 @@
1
+ export default function inspect_(obj: any, options: any, depth: any, seen: any): any;
@@ -0,0 +1,524 @@
1
+ import * as dntShim from "../../../../../_dnt.shims.js";
2
+ var hasMap = typeof Map === 'function' && Map.prototype;
3
+ var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
4
+ var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
5
+ var mapForEach = hasMap && Map.prototype.forEach;
6
+ var hasSet = typeof Set === 'function' && Set.prototype;
7
+ var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
8
+ var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
9
+ var setForEach = hasSet && Set.prototype.forEach;
10
+ var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
11
+ var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
12
+ var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
13
+ var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
14
+ var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
15
+ var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
16
+ var booleanValueOf = Boolean.prototype.valueOf;
17
+ var objectToString = Object.prototype.toString;
18
+ var functionToString = Function.prototype.toString;
19
+ var $match = String.prototype.match;
20
+ var $slice = String.prototype.slice;
21
+ var $replace = String.prototype.replace;
22
+ var $toUpperCase = String.prototype.toUpperCase;
23
+ var $toLowerCase = String.prototype.toLowerCase;
24
+ var $test = RegExp.prototype.test;
25
+ var $concat = Array.prototype.concat;
26
+ var $join = Array.prototype.join;
27
+ var $arrSlice = Array.prototype.slice;
28
+ var $floor = Math.floor;
29
+ var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
30
+ var gOPS = Object.getOwnPropertySymbols;
31
+ var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
32
+ var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
33
+ // ie, `has-tostringtag/shams
34
+ var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')
35
+ ? Symbol.toStringTag
36
+ : null;
37
+ var isEnumerable = Object.prototype.propertyIsEnumerable;
38
+ var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype // eslint-disable-line no-proto
39
+ ? function (O) {
40
+ return O.__proto__; // eslint-disable-line no-proto
41
+ }
42
+ : null);
43
+ function addNumericSeparator(num, str) {
44
+ if (num === Infinity
45
+ || num === -Infinity
46
+ || num !== num
47
+ || (num && num > -1000 && num < 1000)
48
+ || $test.call(/e/, str)) {
49
+ return str;
50
+ }
51
+ var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
52
+ if (typeof num === 'number') {
53
+ var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)
54
+ if (int !== num) {
55
+ var intStr = String(int);
56
+ var dec = $slice.call(str, intStr.length + 1);
57
+ return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');
58
+ }
59
+ }
60
+ return $replace.call(str, sepRegex, '$&_');
61
+ }
62
+ // var utilInspect = require('./util.inspect');
63
+ // var inspectCustom = utilInspect.custom;
64
+ var inspectSymbol = null;
65
+ export default function inspect_(obj, options, depth, seen) {
66
+ var opts = options || {};
67
+ if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
68
+ throw new TypeError('option "quoteStyle" must be "single" or "double"');
69
+ }
70
+ if (has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
71
+ ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity
72
+ : opts.maxStringLength !== null)) {
73
+ throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
74
+ }
75
+ var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;
76
+ if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
77
+ throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
78
+ }
79
+ if (has(opts, 'indent')
80
+ && opts.indent !== null
81
+ && opts.indent !== '\t'
82
+ && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)) {
83
+ throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
84
+ }
85
+ if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
86
+ throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
87
+ }
88
+ var numericSeparator = opts.numericSeparator;
89
+ if (typeof obj === 'undefined') {
90
+ return 'undefined';
91
+ }
92
+ if (obj === null) {
93
+ return 'null';
94
+ }
95
+ if (typeof obj === 'boolean') {
96
+ return obj ? 'true' : 'false';
97
+ }
98
+ if (typeof obj === 'string') {
99
+ return inspectString(obj, opts);
100
+ }
101
+ if (typeof obj === 'number') {
102
+ if (obj === 0) {
103
+ return Infinity / obj > 0 ? '0' : '-0';
104
+ }
105
+ var str = String(obj);
106
+ return numericSeparator ? addNumericSeparator(obj, str) : str;
107
+ }
108
+ if (typeof obj === 'bigint') {
109
+ var bigIntStr = String(obj) + 'n';
110
+ return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
111
+ }
112
+ var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
113
+ if (typeof depth === 'undefined') {
114
+ depth = 0;
115
+ }
116
+ if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
117
+ return isArray(obj) ? '[Array]' : '[Object]';
118
+ }
119
+ var indent = getIndent(opts, depth);
120
+ if (typeof seen === 'undefined') {
121
+ seen = [];
122
+ }
123
+ else if (indexOf(seen, obj) >= 0) {
124
+ return '[Circular]';
125
+ }
126
+ function inspect(value, from, noIndent) {
127
+ if (from) {
128
+ seen = $arrSlice.call(seen);
129
+ seen.push(from);
130
+ }
131
+ if (noIndent) {
132
+ var newOpts = {
133
+ depth: opts.depth
134
+ };
135
+ if (has(opts, 'quoteStyle')) {
136
+ newOpts.quoteStyle = opts.quoteStyle;
137
+ }
138
+ return inspect_(value, newOpts, depth + 1, seen);
139
+ }
140
+ return inspect_(value, opts, depth + 1, seen);
141
+ }
142
+ if (typeof obj === 'function' && !isRegExp(obj)) { // in older engines, regexes are callable
143
+ var name = nameOf(obj);
144
+ var keys = arrObjKeys(obj, inspect);
145
+ return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
146
+ }
147
+ if (isSymbol(obj)) {
148
+ var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
149
+ return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
150
+ }
151
+ if (isElement(obj)) {
152
+ var s = '<' + $toLowerCase.call(String(obj.nodeName));
153
+ var attrs = obj.attributes || [];
154
+ for (var i = 0; i < attrs.length; i++) {
155
+ s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
156
+ }
157
+ s += '>';
158
+ if (obj.childNodes && obj.childNodes.length) {
159
+ s += '...';
160
+ }
161
+ s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
162
+ return s;
163
+ }
164
+ if (isArray(obj)) {
165
+ if (obj.length === 0) {
166
+ return '[]';
167
+ }
168
+ var xs = arrObjKeys(obj, inspect);
169
+ if (indent && !singleLineValues(xs)) {
170
+ return '[' + indentedJoin(xs, indent) + ']';
171
+ }
172
+ return '[ ' + $join.call(xs, ', ') + ' ]';
173
+ }
174
+ if (isError(obj)) {
175
+ var parts = arrObjKeys(obj, inspect);
176
+ if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {
177
+ return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
178
+ }
179
+ if (parts.length === 0) {
180
+ return '[' + String(obj) + ']';
181
+ }
182
+ return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
183
+ }
184
+ if (typeof obj === 'object' && customInspect) {
185
+ if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {
186
+ return utilInspect(obj, { depth: maxDepth - depth });
187
+ }
188
+ else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
189
+ return obj.inspect();
190
+ }
191
+ }
192
+ if (isMap(obj)) {
193
+ var mapParts = [];
194
+ if (mapForEach) {
195
+ mapForEach.call(obj, function (value, key) {
196
+ mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
197
+ });
198
+ }
199
+ return collectionOf('Map', mapSize.call(obj), mapParts, indent);
200
+ }
201
+ if (isSet(obj)) {
202
+ var setParts = [];
203
+ if (setForEach) {
204
+ setForEach.call(obj, function (value) {
205
+ setParts.push(inspect(value, obj));
206
+ });
207
+ }
208
+ return collectionOf('Set', setSize.call(obj), setParts, indent);
209
+ }
210
+ if (isWeakMap(obj)) {
211
+ return weakCollectionOf('WeakMap');
212
+ }
213
+ if (isWeakSet(obj)) {
214
+ return weakCollectionOf('WeakSet');
215
+ }
216
+ if (isWeakRef(obj)) {
217
+ return weakCollectionOf('WeakRef');
218
+ }
219
+ if (isNumber(obj)) {
220
+ return markBoxed(inspect(Number(obj)));
221
+ }
222
+ if (isBigInt(obj)) {
223
+ return markBoxed(inspect(bigIntValueOf.call(obj)));
224
+ }
225
+ if (isBoolean(obj)) {
226
+ return markBoxed(booleanValueOf.call(obj));
227
+ }
228
+ if (isString(obj)) {
229
+ return markBoxed(inspect(String(obj)));
230
+ }
231
+ // note: in IE 8, sometimes `global !== window` but both are the prototypes of each other
232
+ /* eslint-env browser */
233
+ if (typeof dntShim.dntGlobalThis !== 'undefined' && obj === dntShim.dntGlobalThis) {
234
+ return '{ [object Window] }';
235
+ }
236
+ if (obj === global) {
237
+ return '{ [object globalThis] }';
238
+ }
239
+ if (!isDate(obj) && !isRegExp(obj)) {
240
+ var ys = arrObjKeys(obj, inspect);
241
+ var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
242
+ var protoTag = obj instanceof Object ? '' : 'null prototype';
243
+ var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';
244
+ var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
245
+ var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');
246
+ if (ys.length === 0) {
247
+ return tag + '{}';
248
+ }
249
+ if (indent) {
250
+ return tag + '{' + indentedJoin(ys, indent) + '}';
251
+ }
252
+ return tag + '{ ' + $join.call(ys, ', ') + ' }';
253
+ }
254
+ return String(obj);
255
+ }
256
+ ;
257
+ function wrapQuotes(s, defaultStyle, opts) {
258
+ var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
259
+ return quoteChar + s + quoteChar;
260
+ }
261
+ function quote(s) {
262
+ return $replace.call(String(s), /"/g, '&quot;');
263
+ }
264
+ function isArray(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
265
+ function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
266
+ function isRegExp(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
267
+ function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
268
+ function isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
269
+ function isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
270
+ function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
271
+ // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
272
+ function isSymbol(obj) {
273
+ if (hasShammedSymbols) {
274
+ return obj && typeof obj === 'object' && obj instanceof Symbol;
275
+ }
276
+ if (typeof obj === 'symbol') {
277
+ return true;
278
+ }
279
+ if (!obj || typeof obj !== 'object' || !symToString) {
280
+ return false;
281
+ }
282
+ try {
283
+ symToString.call(obj);
284
+ return true;
285
+ }
286
+ catch (e) { }
287
+ return false;
288
+ }
289
+ function isBigInt(obj) {
290
+ if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
291
+ return false;
292
+ }
293
+ try {
294
+ bigIntValueOf.call(obj);
295
+ return true;
296
+ }
297
+ catch (e) { }
298
+ return false;
299
+ }
300
+ var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
301
+ function has(obj, key) {
302
+ return hasOwn.call(obj, key);
303
+ }
304
+ function toStr(obj) {
305
+ return objectToString.call(obj);
306
+ }
307
+ function nameOf(f) {
308
+ if (f.name) {
309
+ return f.name;
310
+ }
311
+ var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
312
+ if (m) {
313
+ return m[1];
314
+ }
315
+ return null;
316
+ }
317
+ function indexOf(xs, x) {
318
+ if (xs.indexOf) {
319
+ return xs.indexOf(x);
320
+ }
321
+ for (var i = 0, l = xs.length; i < l; i++) {
322
+ if (xs[i] === x) {
323
+ return i;
324
+ }
325
+ }
326
+ return -1;
327
+ }
328
+ function isMap(x) {
329
+ if (!mapSize || !x || typeof x !== 'object') {
330
+ return false;
331
+ }
332
+ try {
333
+ mapSize.call(x);
334
+ try {
335
+ setSize.call(x);
336
+ }
337
+ catch (s) {
338
+ return true;
339
+ }
340
+ return x instanceof Map; // core-js workaround, pre-v2.5.0
341
+ }
342
+ catch (e) { }
343
+ return false;
344
+ }
345
+ function isWeakMap(x) {
346
+ if (!weakMapHas || !x || typeof x !== 'object') {
347
+ return false;
348
+ }
349
+ try {
350
+ weakMapHas.call(x, weakMapHas);
351
+ try {
352
+ weakSetHas.call(x, weakSetHas);
353
+ }
354
+ catch (s) {
355
+ return true;
356
+ }
357
+ return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
358
+ }
359
+ catch (e) { }
360
+ return false;
361
+ }
362
+ function isWeakRef(x) {
363
+ if (!weakRefDeref || !x || typeof x !== 'object') {
364
+ return false;
365
+ }
366
+ try {
367
+ weakRefDeref.call(x);
368
+ return true;
369
+ }
370
+ catch (e) { }
371
+ return false;
372
+ }
373
+ function isSet(x) {
374
+ if (!setSize || !x || typeof x !== 'object') {
375
+ return false;
376
+ }
377
+ try {
378
+ setSize.call(x);
379
+ try {
380
+ mapSize.call(x);
381
+ }
382
+ catch (m) {
383
+ return true;
384
+ }
385
+ return x instanceof Set; // core-js workaround, pre-v2.5.0
386
+ }
387
+ catch (e) { }
388
+ return false;
389
+ }
390
+ function isWeakSet(x) {
391
+ if (!weakSetHas || !x || typeof x !== 'object') {
392
+ return false;
393
+ }
394
+ try {
395
+ weakSetHas.call(x, weakSetHas);
396
+ try {
397
+ weakMapHas.call(x, weakMapHas);
398
+ }
399
+ catch (s) {
400
+ return true;
401
+ }
402
+ return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
403
+ }
404
+ catch (e) { }
405
+ return false;
406
+ }
407
+ function isElement(x) {
408
+ if (!x || typeof x !== 'object') {
409
+ return false;
410
+ }
411
+ if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
412
+ return true;
413
+ }
414
+ return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
415
+ }
416
+ function inspectString(str, opts) {
417
+ if (str.length > opts.maxStringLength) {
418
+ var remaining = str.length - opts.maxStringLength;
419
+ var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
420
+ return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
421
+ }
422
+ // eslint-disable-next-line no-control-regex
423
+ var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte);
424
+ return wrapQuotes(s, 'single', opts);
425
+ }
426
+ function lowbyte(c) {
427
+ var n = c.charCodeAt(0);
428
+ var x = {
429
+ 8: 'b',
430
+ 9: 't',
431
+ 10: 'n',
432
+ 12: 'f',
433
+ 13: 'r'
434
+ }[n];
435
+ if (x) {
436
+ return '\\' + x;
437
+ }
438
+ return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));
439
+ }
440
+ function markBoxed(str) {
441
+ return 'Object(' + str + ')';
442
+ }
443
+ function weakCollectionOf(type) {
444
+ return type + ' { ? }';
445
+ }
446
+ function collectionOf(type, size, entries, indent) {
447
+ var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');
448
+ return type + ' (' + size + ') {' + joinedEntries + '}';
449
+ }
450
+ function singleLineValues(xs) {
451
+ for (var i = 0; i < xs.length; i++) {
452
+ if (indexOf(xs[i], '\n') >= 0) {
453
+ return false;
454
+ }
455
+ }
456
+ return true;
457
+ }
458
+ function getIndent(opts, depth) {
459
+ var baseIndent;
460
+ if (opts.indent === '\t') {
461
+ baseIndent = '\t';
462
+ }
463
+ else if (typeof opts.indent === 'number' && opts.indent > 0) {
464
+ baseIndent = $join.call(Array(opts.indent + 1), ' ');
465
+ }
466
+ else {
467
+ return null;
468
+ }
469
+ return {
470
+ base: baseIndent,
471
+ prev: $join.call(Array(depth + 1), baseIndent)
472
+ };
473
+ }
474
+ function indentedJoin(xs, indent) {
475
+ if (xs.length === 0) {
476
+ return '';
477
+ }
478
+ var lineJoiner = '\n' + indent.prev + indent.base;
479
+ return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
480
+ }
481
+ function arrObjKeys(obj, inspect) {
482
+ var isArr = isArray(obj);
483
+ var xs = [];
484
+ if (isArr) {
485
+ xs.length = obj.length;
486
+ for (var i = 0; i < obj.length; i++) {
487
+ xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
488
+ }
489
+ }
490
+ var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
491
+ var symMap;
492
+ if (hasShammedSymbols) {
493
+ symMap = {};
494
+ for (var k = 0; k < syms.length; k++) {
495
+ symMap['$' + syms[k]] = syms[k];
496
+ }
497
+ }
498
+ for (var key in obj) { // eslint-disable-line no-restricted-syntax
499
+ if (!has(obj, key)) {
500
+ continue;
501
+ } // eslint-disable-line no-restricted-syntax, no-continue
502
+ if (isArr && String(Number(key)) === key && key < obj.length) {
503
+ continue;
504
+ } // eslint-disable-line no-restricted-syntax, no-continue
505
+ if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
506
+ // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
507
+ continue; // eslint-disable-line no-restricted-syntax, no-continue
508
+ }
509
+ else if ($test.call(/[^\w$]/, key)) {
510
+ xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
511
+ }
512
+ else {
513
+ xs.push(key + ': ' + inspect(obj[key], obj));
514
+ }
515
+ }
516
+ if (typeof gOPS === 'function') {
517
+ for (var j = 0; j < syms.length; j++) {
518
+ if (isEnumerable.call(obj, syms[j])) {
519
+ xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
520
+ }
521
+ }
522
+ }
523
+ return xs;
524
+ }
package/esm/mod.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import "./_dnt.polyfills.js";
1
2
  export { getColorFromPeerId, getColorName, getRandomId } from "./1_utilities.js";
2
3
  export { checkPassword } from "./client/0_password.js";
3
4
  export * from "./2_connection.js";
package/esm/mod.js CHANGED
@@ -1,3 +1,4 @@
1
+ import "./_dnt.polyfills.js";
1
2
  export { getColorFromPeerId, getColorName, getRandomId } from "./1_utilities.js";
2
3
  export { checkPassword } from "./client/0_password.js";
3
4
  export * from "./2_connection.js";
@@ -67,13 +67,15 @@ export declare abstract class Storage {
67
67
  setPinnedChats(listId: number, chatIds: number[] | null): Promise<void>;
68
68
  getPinnedChats(listId: number): Promise<number[] | null>;
69
69
  getHistory(chatId: number, offsetId: number, limit: number): Promise<enums.Message[]>;
70
- getFile(id: bigint): Promise<number | null>;
71
- iterFileParts(id: bigint, partCount: number): AsyncGenerator<Uint8Array, void, unknown>;
70
+ getFile(id: bigint): Promise<[number, number] | null>;
71
+ iterFileParts(id: bigint, partCount: number, offset: number): AsyncGenerator<Uint8Array, void, unknown>;
72
72
  saveFilePart(id: bigint, index: number, bytes: Uint8Array): Promise<void>;
73
- setFilePartCount(id: bigint, partCount: number): Promise<void>;
73
+ setFilePartCount(id: bigint, partCount: number, chunkSize: number): Promise<void>;
74
74
  setCustomEmojiDocument(id: bigint, document: types.Document): Promise<void>;
75
75
  getCustomEmojiDocument(id: bigint): Promise<[import("../tl/2_types.js").Document_, Date] | null>;
76
76
  setUpdate(boxId: bigint, update: enums.Update): Promise<void>;
77
77
  deleteUpdates(): Promise<void>;
78
78
  getFirstUpdate(boxId: bigint): Promise<readonly [readonly StorageKeyPart[], import("../tl/2_types.js").UpdateNewMessage_ | import("../tl/2_types.js").UpdateMessageID_ | import("../tl/2_types.js").UpdateDeleteMessages_ | import("../tl/2_types.js").UpdateUserTyping_ | import("../tl/2_types.js").UpdateChatUserTyping_ | import("../tl/2_types.js").UpdateChatParticipants_ | import("../tl/2_types.js").UpdateUserStatus_ | import("../tl/2_types.js").UpdateUserName_ | import("../tl/2_types.js").UpdateNewAuthorization_ | import("../tl/2_types.js").UpdateNewEncryptedMessage_ | import("../tl/2_types.js").UpdateEncryptedChatTyping_ | import("../tl/2_types.js").UpdateEncryption_ | import("../tl/2_types.js").UpdateEncryptedMessagesRead_ | import("../tl/2_types.js").UpdateChatParticipantAdd_ | import("../tl/2_types.js").UpdateChatParticipantDelete_ | import("../tl/2_types.js").UpdateDcOptions_ | import("../tl/2_types.js").UpdateNotifySettings_ | import("../tl/2_types.js").UpdateServiceNotification_ | import("../tl/2_types.js").UpdatePrivacy_ | import("../tl/2_types.js").UpdateUserPhone_ | import("../tl/2_types.js").UpdateReadHistoryInbox_ | import("../tl/2_types.js").UpdateReadHistoryOutbox_ | import("../tl/2_types.js").UpdateWebPage_ | import("../tl/2_types.js").UpdateReadMessagesContents_ | import("../tl/2_types.js").UpdateChannelTooLong_ | import("../tl/2_types.js").UpdateChannel_ | import("../tl/2_types.js").UpdateNewChannelMessage_ | import("../tl/2_types.js").UpdateReadChannelInbox_ | import("../tl/2_types.js").UpdateDeleteChannelMessages_ | import("../tl/2_types.js").UpdateChannelMessageViews_ | import("../tl/2_types.js").UpdateChatParticipantAdmin_ | import("../tl/2_types.js").UpdateNewStickerSet_ | import("../tl/2_types.js").UpdateStickerSetsOrder_ | import("../tl/2_types.js").UpdateStickerSets_ | import("../tl/2_types.js").UpdateSavedGifs_ | import("../tl/2_types.js").UpdateBotInlineQuery_ | import("../tl/2_types.js").UpdateBotInlineSend_ | import("../tl/2_types.js").UpdateEditChannelMessage_ | import("../tl/2_types.js").UpdateBotCallbackQuery_ | import("../tl/2_types.js").UpdateEditMessage_ | import("../tl/2_types.js").UpdateInlineBotCallbackQuery_ | import("../tl/2_types.js").UpdateReadChannelOutbox_ | import("../tl/2_types.js").UpdateDraftMessage_ | import("../tl/2_types.js").UpdateReadFeaturedStickers_ | import("../tl/2_types.js").UpdateRecentStickers_ | import("../tl/2_types.js").UpdateConfig_ | import("../tl/2_types.js").UpdatePtsChanged_ | import("../tl/2_types.js").UpdateChannelWebPage_ | import("../tl/2_types.js").UpdateDialogPinned_ | import("../tl/2_types.js").UpdatePinnedDialogs_ | import("../tl/2_types.js").UpdateBotWebhookJSON_ | import("../tl/2_types.js").UpdateBotWebhookJSONQuery_ | import("../tl/2_types.js").UpdateBotShippingQuery_ | import("../tl/2_types.js").UpdateBotPrecheckoutQuery_ | import("../tl/2_types.js").UpdatePhoneCall_ | import("../tl/2_types.js").UpdateLangPackTooLong_ | import("../tl/2_types.js").UpdateLangPack_ | import("../tl/2_types.js").UpdateFavedStickers_ | import("../tl/2_types.js").UpdateChannelReadMessagesContents_ | import("../tl/2_types.js").UpdateContactsReset_ | import("../tl/2_types.js").UpdateChannelAvailableMessages_ | import("../tl/2_types.js").UpdateDialogUnreadMark_ | import("../tl/2_types.js").UpdateMessagePoll_ | import("../tl/2_types.js").UpdateChatDefaultBannedRights_ | import("../tl/2_types.js").UpdateFolderPeers_ | import("../tl/2_types.js").UpdatePeerSettings_ | import("../tl/2_types.js").UpdatePeerLocated_ | import("../tl/2_types.js").UpdateNewScheduledMessage_ | import("../tl/2_types.js").UpdateDeleteScheduledMessages_ | import("../tl/2_types.js").UpdateTheme_ | import("../tl/2_types.js").UpdateGeoLiveViewed_ | import("../tl/2_types.js").UpdateLoginToken_ | import("../tl/2_types.js").UpdateMessagePollVote_ | import("../tl/2_types.js").UpdateDialogFilter_ | import("../tl/2_types.js").UpdateDialogFilterOrder_ | import("../tl/2_types.js").UpdateDialogFilters_ | import("../tl/2_types.js").UpdatePhoneCallSignalingData_ | import("../tl/2_types.js").UpdateChannelMessageForwards_ | import("../tl/2_types.js").UpdateReadChannelDiscussionInbox_ | import("../tl/2_types.js").UpdateReadChannelDiscussionOutbox_ | import("../tl/2_types.js").UpdatePeerBlocked_ | import("../tl/2_types.js").UpdateChannelUserTyping_ | import("../tl/2_types.js").UpdatePinnedMessages_ | import("../tl/2_types.js").UpdatePinnedChannelMessages_ | import("../tl/2_types.js").UpdateChat_ | import("../tl/2_types.js").UpdateGroupCallParticipants_ | import("../tl/2_types.js").UpdateGroupCall_ | import("../tl/2_types.js").UpdatePeerHistoryTTL_ | import("../tl/2_types.js").UpdateChatParticipant_ | import("../tl/2_types.js").UpdateChannelParticipant_ | import("../tl/2_types.js").UpdateBotStopped_ | import("../tl/2_types.js").UpdateGroupCallConnection_ | import("../tl/2_types.js").UpdateBotCommands_ | import("../tl/2_types.js").UpdatePendingJoinRequests_ | import("../tl/2_types.js").UpdateBotChatInviteRequester_ | import("../tl/2_types.js").UpdateMessageReactions_ | import("../tl/2_types.js").UpdateAttachMenuBots_ | import("../tl/2_types.js").UpdateWebViewResultSent_ | import("../tl/2_types.js").UpdateBotMenuButton_ | import("../tl/2_types.js").UpdateSavedRingtones_ | import("../tl/2_types.js").UpdateTranscribedAudio_ | import("../tl/2_types.js").UpdateReadFeaturedEmojiStickers_ | import("../tl/2_types.js").UpdateUserEmojiStatus_ | import("../tl/2_types.js").UpdateRecentEmojiStatuses_ | import("../tl/2_types.js").UpdateRecentReactions_ | import("../tl/2_types.js").UpdateMoveStickerSetToTop_ | import("../tl/2_types.js").UpdateMessageExtendedMedia_ | import("../tl/2_types.js").UpdateChannelPinnedTopic_ | import("../tl/2_types.js").UpdateChannelPinnedTopics_ | import("../tl/2_types.js").UpdateUser_ | import("../tl/2_types.js").UpdateAutoSaveSettings_ | import("../tl/2_types.js").UpdateGroupInvitePrivacyForbidden_ | import("../tl/2_types.js").UpdateStory_ | import("../tl/2_types.js").UpdateReadStories_ | import("../tl/2_types.js").UpdateStoryID_ | import("../tl/2_types.js").UpdateStoriesStealthMode_ | import("../tl/2_types.js").UpdateSentStoryReaction_ | import("../tl/2_types.js").UpdateBotChatBoost_ | import("../tl/2_types.js").UpdateChannelViewForumAsMessages_ | import("../tl/2_types.js").UpdatePeerWallpaper_ | import("../tl/2_types.js").UpdateBotMessageReaction_ | import("../tl/2_types.js").UpdateBotMessageReactions_] | null>;
79
+ assertUser(source: string): Promise<void>;
80
+ assertBot(source: string): Promise<void>;
79
81
  }
@@ -236,11 +236,11 @@ export class Storage {
236
236
  }
237
237
  return await this.get(KPARTS_FILE(id));
238
238
  }
239
- async *iterFileParts(id, partCount) {
239
+ async *iterFileParts(id, partCount, offset) {
240
240
  if (!this.supportsFiles) {
241
241
  return;
242
242
  }
243
- for (let i = 0; i < partCount; i++) {
243
+ for (let i = offset; i < partCount; i++) {
244
244
  const part = await this.get(KPARTS_FILE_PART(id, i));
245
245
  if (part == null) {
246
246
  continue;
@@ -254,11 +254,11 @@ export class Storage {
254
254
  }
255
255
  await this.set(KPARTS_FILE_PART(id, index), bytes);
256
256
  }
257
- async setFilePartCount(id, partCount) {
257
+ async setFilePartCount(id, partCount, chunkSize) {
258
258
  if (!this.supportsFiles) {
259
259
  return;
260
260
  }
261
- await this.set(KPARTS_FILE(id), partCount);
261
+ await this.set(KPARTS_FILE(id), [partCount, chunkSize]);
262
262
  }
263
263
  async setCustomEmojiDocument(id, document) {
264
264
  await this.set(KPARTS_CEMOJI(id), [rleEncode(document[serialize]()), new Date()]);
@@ -288,6 +288,16 @@ export class Storage {
288
288
  }
289
289
  return null;
290
290
  }
291
+ async assertUser(source) {
292
+ if (await this.getAccountType() != "user") {
293
+ throw new Error(`${source}: not user a client`);
294
+ }
295
+ }
296
+ async assertBot(source) {
297
+ if (await this.getAccountType() != "bot") {
298
+ throw new Error(`${source}: not a bot client`);
299
+ }
300
+ }
291
301
  }
292
302
  _Storage_authKeyId = new WeakMap(), _Storage_instances = new WeakSet(), _Storage_resetAuthKeyId = async function _Storage_resetAuthKeyId(authKey) {
293
303
  if (authKey != null) {