@mtkruto/browser 0.119.0 → 0.119.1

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 (127) hide show
  1. package/esm/0_errors.d.ts.map +1 -1
  2. package/esm/0_errors.js +9 -31
  3. package/esm/3_errors.js +2 -12
  4. package/esm/4_errors.js +2 -12
  5. package/esm/_dnt.polyfills.d.ts +0 -99
  6. package/esm/_dnt.polyfills.d.ts.map +1 -1
  7. package/esm/_dnt.polyfills.js +1 -127
  8. package/esm/client/0_abortable_loop.js +26 -39
  9. package/esm/client/0_storage_operations.js +179 -218
  10. package/esm/client/1_client_plain.js +4 -22
  11. package/esm/client/2_account_manager.js +140 -149
  12. package/esm/client/2_bot_info_manager.js +26 -38
  13. package/esm/client/2_business_connection_manager.js +10 -23
  14. package/esm/client/2_client_encrypted.js +198 -215
  15. package/esm/client/2_file_manager.js +255 -262
  16. package/esm/client/2_network_statistics_manager.js +31 -44
  17. package/esm/client/2_payment_manager.js +7 -20
  18. package/esm/client/2_reaction_manager.js +7 -20
  19. package/esm/client/2_translations_manager.js +101 -111
  20. package/esm/client/2_update_manager.js +750 -745
  21. package/esm/client/3_client_encrypted_pool.js +10 -26
  22. package/esm/client/3_message_manager.js +503 -508
  23. package/esm/client/3_video_chat_manager.js +57 -68
  24. package/esm/client/4_callback_query_manager.js +18 -30
  25. package/esm/client/4_chat_list_manager.js +140 -146
  26. package/esm/client/4_chat_manager.js +161 -169
  27. package/esm/client/4_checklist_manager.js +26 -39
  28. package/esm/client/4_context.js +244 -259
  29. package/esm/client/4_forum_manager.js +67 -73
  30. package/esm/client/4_gift_manager.js +22 -35
  31. package/esm/client/4_inline_query_manager.js +16 -28
  32. package/esm/client/4_link_preview_manager.js +6 -19
  33. package/esm/client/4_poll_manager.js +44 -57
  34. package/esm/client/4_story_manager.js +41 -53
  35. package/esm/client/5_composer.js +13 -26
  36. package/esm/client/6_client.js +866 -896
  37. package/esm/client/6_client_dispatcher.js +308 -325
  38. package/esm/client/7_client_worker.js +16 -29
  39. package/esm/connection/1_connection_tcp.js +55 -82
  40. package/esm/connection/1_connection_web_socket.js +75 -91
  41. package/esm/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
  42. package/esm/deps/jsr.io/@std/async/1.2.0/mux_async_iterator.js +31 -47
  43. package/esm/deps/jsr.io/@std/async/1.2.0/tee.js +11 -34
  44. package/esm/deps/jsr.io/@std/cache/0.2.2/lru_cache.js +30 -47
  45. package/esm/deps/jsr.io/@std/datetime/0.225.7/_date_time_formatter.js +4 -17
  46. package/esm/session/0_session_state.js +12 -38
  47. package/esm/session/1_session.js +49 -72
  48. package/esm/session/2_session_encrypted.js +422 -420
  49. package/esm/storage/2_storage_indexed_db.js +26 -44
  50. package/esm/storage/2_storage_local_storage.js +3 -16
  51. package/esm/storage/2_storage_memory.js +24 -41
  52. package/esm/storage/2_storage_session_storage.js +3 -16
  53. package/esm/tl/1_tl_reader.d.ts +1 -1
  54. package/esm/tl/1_tl_reader.d.ts.map +1 -1
  55. package/esm/tl/1_tl_reader.js +95 -103
  56. package/esm/tl/1_tl_writer.js +169 -178
  57. package/esm/transport/0_transport.js +1 -8
  58. package/esm/transport/1_transport_abridged.js +11 -24
  59. package/esm/transport/1_transport_intermediate.js +10 -23
  60. package/esm/utilities/0_mutex.js +4 -19
  61. package/esm/utilities/0_part_stream.js +11 -25
  62. package/esm/utilities/1_crypto.js +42 -53
  63. package/esm/utilities/2_queue.js +29 -47
  64. package/package.json +1 -1
  65. package/script/0_errors.d.ts.map +1 -1
  66. package/script/0_errors.js +9 -31
  67. package/script/3_errors.js +2 -12
  68. package/script/4_errors.js +2 -12
  69. package/script/_dnt.polyfills.d.ts +0 -99
  70. package/script/_dnt.polyfills.d.ts.map +1 -1
  71. package/script/_dnt.polyfills.js +0 -128
  72. package/script/client/0_abortable_loop.js +27 -40
  73. package/script/client/0_storage_operations.js +179 -218
  74. package/script/client/1_client_plain.js +4 -22
  75. package/script/client/2_account_manager.js +140 -149
  76. package/script/client/2_bot_info_manager.js +26 -38
  77. package/script/client/2_business_connection_manager.js +10 -23
  78. package/script/client/2_client_encrypted.js +199 -216
  79. package/script/client/2_file_manager.js +255 -262
  80. package/script/client/2_network_statistics_manager.js +32 -45
  81. package/script/client/2_payment_manager.js +7 -20
  82. package/script/client/2_reaction_manager.js +7 -20
  83. package/script/client/2_translations_manager.js +102 -112
  84. package/script/client/2_update_manager.js +750 -745
  85. package/script/client/3_client_encrypted_pool.js +10 -26
  86. package/script/client/3_message_manager.js +503 -508
  87. package/script/client/3_video_chat_manager.js +57 -68
  88. package/script/client/4_callback_query_manager.js +18 -30
  89. package/script/client/4_chat_list_manager.js +140 -146
  90. package/script/client/4_chat_manager.js +161 -169
  91. package/script/client/4_checklist_manager.js +26 -39
  92. package/script/client/4_context.js +244 -259
  93. package/script/client/4_forum_manager.js +67 -73
  94. package/script/client/4_gift_manager.js +22 -35
  95. package/script/client/4_inline_query_manager.js +16 -28
  96. package/script/client/4_link_preview_manager.js +6 -19
  97. package/script/client/4_poll_manager.js +44 -57
  98. package/script/client/4_story_manager.js +41 -53
  99. package/script/client/5_composer.js +13 -26
  100. package/script/client/6_client.js +866 -896
  101. package/script/client/6_client_dispatcher.js +308 -325
  102. package/script/client/7_client_worker.js +16 -29
  103. package/script/connection/1_connection_tcp.js +55 -82
  104. package/script/connection/1_connection_web_socket.js +75 -91
  105. package/script/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
  106. package/script/deps/jsr.io/@std/async/1.2.0/mux_async_iterator.js +31 -47
  107. package/script/deps/jsr.io/@std/async/1.2.0/tee.js +11 -34
  108. package/script/deps/jsr.io/@std/cache/0.2.2/lru_cache.js +30 -47
  109. package/script/deps/jsr.io/@std/datetime/0.225.7/_date_time_formatter.js +4 -17
  110. package/script/session/0_session_state.js +12 -38
  111. package/script/session/1_session.js +49 -72
  112. package/script/session/2_session_encrypted.js +423 -421
  113. package/script/storage/2_storage_indexed_db.js +26 -44
  114. package/script/storage/2_storage_local_storage.js +3 -16
  115. package/script/storage/2_storage_memory.js +24 -41
  116. package/script/storage/2_storage_session_storage.js +3 -16
  117. package/script/tl/1_tl_reader.d.ts +1 -1
  118. package/script/tl/1_tl_reader.d.ts.map +1 -1
  119. package/script/tl/1_tl_reader.js +96 -104
  120. package/script/tl/1_tl_writer.js +170 -179
  121. package/script/transport/0_transport.js +1 -8
  122. package/script/transport/1_transport_abridged.js +11 -24
  123. package/script/transport/1_transport_intermediate.js +10 -23
  124. package/script/utilities/0_mutex.js +4 -19
  125. package/script/utilities/0_part_stream.js +11 -25
  126. package/script/utilities/1_crypto.js +43 -54
  127. package/script/utilities/2_queue.js +30 -48
@@ -18,68 +18,55 @@
18
18
  * You should have received a copy of the GNU Lesser General Public License
19
19
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20
20
  */
21
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
22
- if (kind === "m") throw new TypeError("Private method is not writable");
23
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
24
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
25
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
26
- };
27
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
28
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
29
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
30
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
31
- };
32
- var _ChecklistManager_instances, _ChecklistManager_c, _ChecklistManager_updateChecklistInner;
33
21
  Object.defineProperty(exports, "__esModule", { value: true });
34
22
  exports.ChecklistManager = void 0;
35
23
  const _0_errors_js_1 = require("../0_errors.js");
36
24
  class ChecklistManager {
25
+ #c;
37
26
  constructor(c) {
38
- _ChecklistManager_instances.add(this);
39
- _ChecklistManager_c.set(this, void 0);
40
- __classPrivateFieldSet(this, _ChecklistManager_c, c, "f");
27
+ this.#c = c;
41
28
  }
42
29
  async addToChecklist(chatId, messageId, items) {
43
- __classPrivateFieldGet(this, _ChecklistManager_c, "f").storage.assertUser("addToChecklist");
44
- const peer = await __classPrivateFieldGet(this, _ChecklistManager_c, "f").getInputPeer(chatId);
30
+ this.#c.storage.assertUser("addToChecklist");
31
+ const peer = await this.#c.getInputPeer(chatId);
45
32
  const msg_id = messageId;
46
33
  const list = items.map((v) => {
47
34
  const text = v.text;
48
35
  const entities = v.entities;
49
- const parseResult = __classPrivateFieldGet(this, _ChecklistManager_c, "f").messageManager.parseText(text, { parseMode: v.parseMode, entities });
36
+ const parseResult = this.#c.messageManager.parseText(text, { parseMode: v.parseMode, entities });
50
37
  return { _: "todoItem", id: 0, title: { _: "textWithEntities", text: parseResult[0], entities: parseResult[1] ?? [] } };
51
38
  });
52
- await __classPrivateFieldGet(this, _ChecklistManager_c, "f").invoke({ _: "messages.appendTodoList", peer, msg_id, list });
39
+ await this.#c.invoke({ _: "messages.appendTodoList", peer, msg_id, list });
40
+ }
41
+ async #updateChecklistInner(chatId, messageId, params) {
42
+ if (!params?.itemsToCheck?.length && !params?.itemsToUncheck?.length) {
43
+ throw new _0_errors_js_1.InputError("Both itemsToCheck and itemsToUncheck msut not be empty.");
44
+ }
45
+ const peer = await this.#c.getInputPeer(chatId);
46
+ const msg_id = messageId;
47
+ const completed = params?.itemsToCheck ?? [];
48
+ const incompleted = params?.itemsToUncheck ?? [];
49
+ await this.#c.invoke({ _: "messages.toggleTodoCompleted", peer, msg_id, completed, incompleted });
53
50
  }
54
51
  async updateChecklist(chatId, messageId, params) {
55
- __classPrivateFieldGet(this, _ChecklistManager_c, "f").storage.assertUser("updateChecklist");
56
- await __classPrivateFieldGet(this, _ChecklistManager_instances, "m", _ChecklistManager_updateChecklistInner).call(this, chatId, messageId, params);
52
+ this.#c.storage.assertUser("updateChecklist");
53
+ await this.#updateChecklistInner(chatId, messageId, params);
57
54
  }
58
55
  async checkChecklistItems(chatId, messageId, items) {
59
- __classPrivateFieldGet(this, _ChecklistManager_c, "f").storage.assertUser("checkChecklistItems");
60
- await __classPrivateFieldGet(this, _ChecklistManager_instances, "m", _ChecklistManager_updateChecklistInner).call(this, chatId, messageId, { itemsToCheck: items });
56
+ this.#c.storage.assertUser("checkChecklistItems");
57
+ await this.#updateChecklistInner(chatId, messageId, { itemsToCheck: items });
61
58
  }
62
59
  async uncheckChecklistItems(chatId, messageId, items) {
63
- __classPrivateFieldGet(this, _ChecklistManager_c, "f").storage.assertUser("uncheckChecklistItems");
64
- await __classPrivateFieldGet(this, _ChecklistManager_instances, "m", _ChecklistManager_updateChecklistInner).call(this, chatId, messageId, { itemsToUncheck: items });
60
+ this.#c.storage.assertUser("uncheckChecklistItems");
61
+ await this.#updateChecklistInner(chatId, messageId, { itemsToUncheck: items });
65
62
  }
66
63
  async checkChecklistItem(chatId, messageId, item) {
67
- __classPrivateFieldGet(this, _ChecklistManager_c, "f").storage.assertUser("checkChecklistItem");
68
- await __classPrivateFieldGet(this, _ChecklistManager_instances, "m", _ChecklistManager_updateChecklistInner).call(this, chatId, messageId, { itemsToCheck: [item] });
64
+ this.#c.storage.assertUser("checkChecklistItem");
65
+ await this.#updateChecklistInner(chatId, messageId, { itemsToCheck: [item] });
69
66
  }
70
67
  async uncheckChecklistItem(chatId, messageId, item) {
71
- __classPrivateFieldGet(this, _ChecklistManager_c, "f").storage.assertUser("uncheckChecklistItem");
72
- await __classPrivateFieldGet(this, _ChecklistManager_instances, "m", _ChecklistManager_updateChecklistInner).call(this, chatId, messageId, { itemsToUncheck: [item] });
68
+ this.#c.storage.assertUser("uncheckChecklistItem");
69
+ await this.#updateChecklistInner(chatId, messageId, { itemsToUncheck: [item] });
73
70
  }
74
71
  }
75
72
  exports.ChecklistManager = ChecklistManager;
76
- _ChecklistManager_c = new WeakMap(), _ChecklistManager_instances = new WeakSet(), _ChecklistManager_updateChecklistInner = async function _ChecklistManager_updateChecklistInner(chatId, messageId, params) {
77
- if (!params?.itemsToCheck?.length && !params?.itemsToUncheck?.length) {
78
- throw new _0_errors_js_1.InputError("Both itemsToCheck and itemsToUncheck msut not be empty.");
79
- }
80
- const peer = await __classPrivateFieldGet(this, _ChecklistManager_c, "f").getInputPeer(chatId);
81
- const msg_id = messageId;
82
- const completed = params?.itemsToCheck ?? [];
83
- const incompleted = params?.itemsToUncheck ?? [];
84
- await __classPrivateFieldGet(this, _ChecklistManager_c, "f").invoke({ _: "messages.toggleTodoCompleted", peer, msg_id, completed, incompleted });
85
- };