@mtkruto/node 0.101.2 → 0.102.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.
- package/esm/3_types.d.ts +2 -0
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +2 -0
- package/esm/client/0_params.d.ts +4 -0
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/1_client_generic.d.ts +32 -5
- package/esm/client/1_client_generic.d.ts.map +1 -1
- package/esm/client/2_account_manager.d.ts +4 -1
- package/esm/client/2_account_manager.d.ts.map +1 -1
- package/esm/client/2_account_manager.js +18 -0
- package/esm/client/2_update_manager.js +7 -7
- package/esm/client/3_message_manager.js +17 -17
- package/esm/client/3_video_chat_manager.js +3 -3
- package/esm/client/4_chat_manager.js +3 -3
- package/esm/client/4_gift_manager.d.ts +3 -2
- package/esm/client/4_gift_manager.d.ts.map +1 -1
- package/esm/client/4_gift_manager.js +8 -7
- package/esm/client/5_client.d.ts +32 -5
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +39 -4
- package/esm/client/5_client_dispatcher.d.ts +32 -5
- package/esm/client/5_client_dispatcher.d.ts.map +1 -1
- package/esm/client/5_client_dispatcher.js +39 -4
- package/esm/types/0_bot_token_check_result.d.ts +9 -7
- package/esm/types/0_bot_token_check_result.d.ts.map +1 -1
- package/esm/types/0_button_style.d.ts +28 -0
- package/esm/types/0_button_style.d.ts.map +1 -0
- package/esm/types/0_button_style.js +36 -0
- package/esm/types/0_code_check_result.d.ts +26 -16
- package/esm/types/0_code_check_result.d.ts.map +1 -1
- package/esm/types/0_gift_component_rarity.d.ts +5 -0
- package/esm/types/0_gift_component_rarity.d.ts.map +1 -1
- package/esm/types/0_link_preview_media_size.d.ts +1 -0
- package/esm/types/0_link_preview_media_size.d.ts.map +1 -1
- package/esm/types/0_mini_app_button_info.d.ts +1 -0
- package/esm/types/0_mini_app_button_info.d.ts.map +1 -1
- package/esm/types/0_password_check_result.d.ts +17 -11
- package/esm/types/0_password_check_result.d.ts.map +1 -1
- package/esm/types/0_slow_mode_duration.d.ts +1 -0
- package/esm/types/0_slow_mode_duration.d.ts.map +1 -1
- package/esm/types/0_switch_inline_query_chosen_chats.d.ts +1 -0
- package/esm/types/0_switch_inline_query_chosen_chats.d.ts.map +1 -1
- package/esm/types/1_bot_command_scope.js +1 -1
- package/esm/types/1_inline_keyboard_button.d.ts +2 -0
- package/esm/types/1_inline_keyboard_button.d.ts.map +1 -1
- package/esm/types/1_inline_keyboard_button.js +30 -19
- package/esm/types/1_input_gift.d.ts +54 -0
- package/esm/types/1_input_gift.d.ts.map +1 -0
- package/esm/types/1_input_gift.js +32 -0
- package/esm/types/1_keyboard_button.d.ts +2 -0
- package/esm/types/1_keyboard_button.d.ts.map +1 -1
- package/esm/types/1_keyboard_button.js +67 -14
- package/esm/types/2_message_entity.js +2 -2
- package/esm/types/7_inline_query_result.js +6 -6
- package/package.json +1 -1
- package/script/3_types.d.ts +2 -0
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +2 -0
- package/script/client/0_params.d.ts +4 -0
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/1_client_generic.d.ts +32 -5
- package/script/client/1_client_generic.d.ts.map +1 -1
- package/script/client/2_account_manager.d.ts +4 -1
- package/script/client/2_account_manager.d.ts.map +1 -1
- package/script/client/2_account_manager.js +18 -0
- package/script/client/2_update_manager.js +7 -7
- package/script/client/3_message_manager.js +17 -17
- package/script/client/3_video_chat_manager.js +3 -3
- package/script/client/4_chat_manager.js +3 -3
- package/script/client/4_gift_manager.d.ts +3 -2
- package/script/client/4_gift_manager.d.ts.map +1 -1
- package/script/client/4_gift_manager.js +7 -6
- package/script/client/5_client.d.ts +32 -5
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +39 -4
- package/script/client/5_client_dispatcher.d.ts +32 -5
- package/script/client/5_client_dispatcher.d.ts.map +1 -1
- package/script/client/5_client_dispatcher.js +39 -4
- package/script/types/0_bot_token_check_result.d.ts +9 -7
- package/script/types/0_bot_token_check_result.d.ts.map +1 -1
- package/script/types/0_button_style.d.ts +28 -0
- package/script/types/0_button_style.d.ts.map +1 -0
- package/script/types/0_button_style.js +40 -0
- package/script/types/0_code_check_result.d.ts +26 -16
- package/script/types/0_code_check_result.d.ts.map +1 -1
- package/script/types/0_gift_component_rarity.d.ts +5 -0
- package/script/types/0_gift_component_rarity.d.ts.map +1 -1
- package/script/types/0_link_preview_media_size.d.ts +1 -0
- package/script/types/0_link_preview_media_size.d.ts.map +1 -1
- package/script/types/0_mini_app_button_info.d.ts +1 -0
- package/script/types/0_mini_app_button_info.d.ts.map +1 -1
- package/script/types/0_password_check_result.d.ts +17 -11
- package/script/types/0_password_check_result.d.ts.map +1 -1
- package/script/types/0_slow_mode_duration.d.ts +1 -0
- package/script/types/0_slow_mode_duration.d.ts.map +1 -1
- package/script/types/0_switch_inline_query_chosen_chats.d.ts +1 -0
- package/script/types/0_switch_inline_query_chosen_chats.d.ts.map +1 -1
- package/script/types/1_bot_command_scope.js +1 -1
- package/script/types/1_inline_keyboard_button.d.ts +2 -0
- package/script/types/1_inline_keyboard_button.d.ts.map +1 -1
- package/script/types/1_inline_keyboard_button.js +30 -19
- package/script/types/1_input_gift.d.ts +54 -0
- package/script/types/1_input_gift.d.ts.map +1 -0
- package/script/types/1_input_gift.js +35 -0
- package/script/types/1_keyboard_button.d.ts +2 -0
- package/script/types/1_keyboard_button.d.ts.map +1 -1
- package/script/types/1_keyboard_button.js +67 -14
- package/script/types/2_message_entity.js +2 -2
- package/script/types/7_inline_query_result.js +6 -6
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2026 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import { cleanObject } from "../1_utilities.js";
|
|
21
|
+
export function constructButtonStyle(buttonStyle) {
|
|
22
|
+
if (buttonStyle === undefined || !buttonStyle.bg_danger && !buttonStyle.bg_primary && !buttonStyle.bg_success && !buttonStyle.icon) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
const buttonStyle_ = {
|
|
26
|
+
background: buttonStyle.bg_danger ? "danger" : buttonStyle.bg_primary ? "primary" : buttonStyle.bg_success ? "success" : undefined,
|
|
27
|
+
customEmojiId: buttonStyle.icon ? String(buttonStyle.icon) : undefined,
|
|
28
|
+
};
|
|
29
|
+
return cleanObject(buttonStyle_);
|
|
30
|
+
}
|
|
31
|
+
export function buttonStyleToTlObject(buttonStyle) {
|
|
32
|
+
if (buttonStyle === undefined) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
return { _: "keyboardButtonStyle", bg_danger: buttonStyle.background === "danger" ? true : undefined, bg_primary: buttonStyle.background === "primary" ? true : undefined, bg_success: buttonStyle.background === "success" ? true : undefined, icon: buttonStyle.customEmojiId ? BigInt(buttonStyle.customEmojiId) : undefined };
|
|
36
|
+
}
|
|
@@ -17,21 +17,31 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
/**
|
|
21
|
+
* The code was correct, but an additional password is required to sign in.
|
|
22
|
+
* @unlisted
|
|
23
|
+
*/
|
|
24
|
+
export interface CodeCheckResultPasswordRequired {
|
|
25
|
+
/** @discriminator */
|
|
26
|
+
type: "password_required";
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The code entered was incorrect.
|
|
30
|
+
* @unlisted
|
|
31
|
+
*/
|
|
32
|
+
export interface CodeCheckResultInvalidCode {
|
|
33
|
+
/** @discriminator */
|
|
34
|
+
type: "invalid_code";
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The code was correct. The user was signed in.
|
|
38
|
+
* @unlisted
|
|
39
|
+
*/
|
|
40
|
+
export interface CodeCheckResultSignedIn {
|
|
41
|
+
/** @discriminator */
|
|
42
|
+
type: "signed_in";
|
|
43
|
+
userId: number;
|
|
34
44
|
}
|
|
35
|
-
/**
|
|
36
|
-
export type CodeCheckResult =
|
|
45
|
+
/** The result after checking a sent code. */
|
|
46
|
+
export type CodeCheckResult = CodeCheckResultPasswordRequired | CodeCheckResultInvalidCode | CodeCheckResultSignedIn;
|
|
37
47
|
//# sourceMappingURL=0_code_check_result.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_code_check_result.d.ts","sourceRoot":"","sources":["../../src/types/0_code_check_result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,
|
|
1
|
+
{"version":3,"file":"0_code_check_result.d.ts","sourceRoot":"","sources":["../../src/types/0_code_check_result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC9C,qBAAqB;IACrB,IAAI,EAAE,mBAAmB,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,qBAAqB;IACrB,IAAI,EAAE,cAAc,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,qBAAqB;IACrB,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,6CAA6C;AAC7C,MAAM,MAAM,eAAe,GAAG,+BAA+B,GAAG,0BAA0B,GAAG,uBAAuB,CAAC"}
|
|
@@ -18,19 +18,24 @@
|
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
20
|
import type { Api } from "../2_tl.js";
|
|
21
|
+
/** @unlisted */
|
|
21
22
|
export interface GiftComponentRarityPerMille {
|
|
22
23
|
type: "perMille";
|
|
23
24
|
perMille: number;
|
|
24
25
|
}
|
|
26
|
+
/** @unlisted */
|
|
25
27
|
export interface GiftComponentRarityUncommon {
|
|
26
28
|
type: "uncommon";
|
|
27
29
|
}
|
|
30
|
+
/** @unlisted */
|
|
28
31
|
export interface GiftComponentRarityRare {
|
|
29
32
|
type: "rare";
|
|
30
33
|
}
|
|
34
|
+
/** @unlisted */
|
|
31
35
|
export interface GiftComponentRarityEpic {
|
|
32
36
|
type: "epic";
|
|
33
37
|
}
|
|
38
|
+
/** @unlisted */
|
|
34
39
|
export interface GiftComponentRarityLegendary {
|
|
35
40
|
type: "legendary";
|
|
36
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_gift_component_rarity.d.ts","sourceRoot":"","sources":["../../src/types/0_gift_component_rarity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,MAAM,MAAM,mBAAmB,GAAG,2BAA2B,GAAG,2BAA2B,GAAG,uBAAuB,GAAG,uBAAuB,GAAG,4BAA4B,CAAC;AAE/K,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,GAAG,CAAC,uBAAuB,GAAG,mBAAmB,CAsBrG"}
|
|
1
|
+
{"version":3,"file":"0_gift_component_rarity.d.ts","sourceRoot":"","sources":["../../src/types/0_gift_component_rarity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,gBAAgB;AAChB,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,gBAAgB;AAChB,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,gBAAgB;AAChB,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gBAAgB;AAChB,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gBAAgB;AAChB,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,MAAM,MAAM,mBAAmB,GAAG,2BAA2B,GAAG,2BAA2B,GAAG,uBAAuB,GAAG,uBAAuB,GAAG,4BAA4B,CAAC;AAE/K,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,GAAG,CAAC,uBAAuB,GAAG,mBAAmB,CAsBrG"}
|
|
@@ -17,5 +17,6 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
+
/** The size of a link preview's media. */
|
|
20
21
|
export type LinkPreviewMediaSize = "small" | "large";
|
|
21
22
|
//# sourceMappingURL=0_link_preview_media_size.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_link_preview_media_size.d.ts","sourceRoot":"","sources":["../../src/types/0_link_preview_media_size.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"0_link_preview_media_size.d.ts","sourceRoot":"","sources":["../../src/types/0_link_preview_media_size.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,0CAA0C;AAC1C,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,OAAO,CAAC"}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
+
/** Information on a mini app button. */
|
|
20
21
|
export interface MiniAppButtonInfo {
|
|
21
22
|
/** An HTTPS URL of the mini app to be opened with additional data. */
|
|
22
23
|
url: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_mini_app_button_info.d.ts","sourceRoot":"","sources":["../../src/types/0_mini_app_button_info.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAEzE"}
|
|
1
|
+
{"version":3,"file":"0_mini_app_button_info.d.ts","sourceRoot":"","sources":["../../src/types/0_mini_app_button_info.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,wCAAwC;AACxC,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAEzE"}
|
|
@@ -17,17 +17,23 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
/**
|
|
21
|
+
* The password entered was incorrect.
|
|
22
|
+
* @unlisted
|
|
23
|
+
*/
|
|
24
|
+
export interface PasswordCheckResultInvalidPassword {
|
|
25
|
+
/** @discriminator */
|
|
26
|
+
type: "invalid_password";
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The password was correct. The user was signed in.
|
|
30
|
+
* @unlisted
|
|
31
|
+
*/
|
|
32
|
+
export interface PasswordCheckResultSignedIn {
|
|
33
|
+
/** @discriminator */
|
|
34
|
+
type: "signed_in";
|
|
35
|
+
userId: number;
|
|
30
36
|
}
|
|
31
37
|
/** A result after checking a sent code. */
|
|
32
|
-
export type PasswordCheckResult =
|
|
38
|
+
export type PasswordCheckResult = PasswordCheckResultInvalidPassword | PasswordCheckResultSignedIn;
|
|
33
39
|
//# sourceMappingURL=0_password_check_result.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_password_check_result.d.ts","sourceRoot":"","sources":["../../src/types/0_password_check_result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,
|
|
1
|
+
{"version":3,"file":"0_password_check_result.d.ts","sourceRoot":"","sources":["../../src/types/0_password_check_result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;GAGG;AACH,MAAM,WAAW,kCAAkC;IACjD,qBAAqB;IACrB,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,qBAAqB;IACrB,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,2CAA2C;AAC3C,MAAM,MAAM,mBAAmB,GAAG,kCAAkC,GAAG,2BAA2B,CAAC"}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
+
/** A slow mode duration option. */
|
|
20
21
|
export type SlowModeDuration = "10s" | "30s" | "1m" | "5m" | "15m" | "1h";
|
|
21
22
|
export declare function slowModeDurationToSeconds(duration: SlowModeDuration): number;
|
|
22
23
|
//# sourceMappingURL=0_slow_mode_duration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_slow_mode_duration.d.ts","sourceRoot":"","sources":["../../src/types/0_slow_mode_duration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,MAAM,gBAAgB,GACxB,KAAK,GACL,KAAK,GACL,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,IAAI,CAAC;AAET,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAQ5E"}
|
|
1
|
+
{"version":3,"file":"0_slow_mode_duration.d.ts","sourceRoot":"","sources":["../../src/types/0_slow_mode_duration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,mCAAmC;AACnC,MAAM,MAAM,gBAAgB,GACxB,KAAK,GACL,KAAK,GACL,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,IAAI,CAAC;AAET,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAQ5E"}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
+
/** Configuration for switching to inline mode in specific chat types. */
|
|
20
21
|
export interface SwitchInlineQueryChosenChats {
|
|
21
22
|
/** The query to type into the user's message box once switched to inline. */
|
|
22
23
|
query: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_switch_inline_query_chosen_chats.d.ts","sourceRoot":"","sources":["../../src/types/0_switch_inline_query_chosen_chats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,4BAA4B;IAC3C,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kEAAkE;IAClE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2DAA2D;IAC3D,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
|
|
1
|
+
{"version":3,"file":"0_switch_inline_query_chosen_chats.d.ts","sourceRoot":"","sources":["../../src/types/0_switch_inline_query_chosen_chats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,yEAAyE;AACzE,MAAM,WAAW,4BAA4B;IAC3C,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kEAAkE;IAClE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2DAA2D;IAC3D,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
|
|
@@ -38,7 +38,7 @@ export async function botCommandScopeToTlObject(scope, getInputPeer) {
|
|
|
38
38
|
if (!Api.is("inputPeerUser", user)) {
|
|
39
39
|
unreachable();
|
|
40
40
|
}
|
|
41
|
-
return { _: "botCommandScopePeerUser", peer: await getInputPeer(scope.chatId), user_id:
|
|
41
|
+
return { _: "botCommandScopePeerUser", peer: await getInputPeer(scope.chatId), user_id: { _: "inputUser", user_id: user.user_id, access_hash: user.access_hash } };
|
|
42
42
|
}
|
|
43
43
|
default:
|
|
44
44
|
unreachable();
|
|
@@ -19,12 +19,14 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import { Api } from "../2_tl.js";
|
|
21
21
|
import type { UsernameResolver } from "./_getters.js";
|
|
22
|
+
import { type ButtonStyle } from "./0_button_style.js";
|
|
22
23
|
import type { LoginUrl } from "./0_login_url.js";
|
|
23
24
|
import { type MiniAppButtonInfo } from "./0_mini_app_button_info.js";
|
|
24
25
|
/** @unlisted */
|
|
25
26
|
export interface _InlineKeyboardButtonBase {
|
|
26
27
|
/** The text of the button. */
|
|
27
28
|
text: string;
|
|
29
|
+
style?: ButtonStyle;
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
30
32
|
* An inline keyboard button that, when pressed, opens the specified URL.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1_inline_keyboard_button.d.ts","sourceRoot":"","sources":["../../src/types/1_inline_keyboard_button.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAA8B,KAAK,iBAAiB,EAAE,MAAM,6BAA6B,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yB;IACxF;;;OAGG;IACH,4BAA4B,EAAE,MAAM,CAAC;CACtC;AAED;;;GAGG;AACH,MAAM,WAAW,sCAAuC,SAAQ,yBAAyB;IACvF,qBAAqB;IACrB,4BAA4B,EAAE;QAC5B,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAyB,SAAQ,yBAAyB;IACzE,qBAAqB;IACrB,YAAY,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAwB,SAAQ,yBAAyB;IACxE,qBAAqB;IACrB,GAAG,EAAE,OAAO,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAyB,SAAQ,yBAAyB;IACzE,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,sCAAsC;AACtC,MAAM,MAAM,oBAAoB,GAC5B,uBAAuB,GACvB,4BAA4B,GAC5B,2BAA2B,GAC3B,yBAAyB,GACzB,gCAAgC,GAChC,uCAAuC,GACvC,sCAAsC,GACtC,wBAAwB,GACxB,uBAAuB,GACvB,wBAAwB,CAAC;AAE7B,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,GAAG,CAAC,cAAc,GAAG,oBAAoB,CAiC/F;AAED,wBAAsB,8BAA8B,CAAC,MAAM,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAgDlJ"}
|
|
@@ -21,43 +21,45 @@ import { unreachable } from "../0_deps.js";
|
|
|
21
21
|
import { InputError } from "../0_errors.js";
|
|
22
22
|
import { cleanObject, decodeText, encodeText } from "../1_utilities.js";
|
|
23
23
|
import { Api } from "../2_tl.js";
|
|
24
|
+
import { buttonStyleToTlObject, constructButtonStyle } from "./0_button_style.js";
|
|
24
25
|
import { constructMiniAppButtonInfo } from "./0_mini_app_button_info.js";
|
|
25
26
|
export function constructInlineKeyboardButton(button_) {
|
|
27
|
+
const style = constructButtonStyle(button_.style);
|
|
26
28
|
if (Api.is("keyboardButtonUrl", button_)) {
|
|
27
|
-
return { text: button_.text, url: button_.url };
|
|
29
|
+
return cleanObject({ text: button_.text, url: button_.url, style });
|
|
28
30
|
}
|
|
29
31
|
else if (Api.is("keyboardButtonCallback", button_)) {
|
|
30
|
-
return { text: button_.text, callbackData: decodeText(button_.data) };
|
|
32
|
+
return cleanObject({ text: button_.text, callbackData: decodeText(button_.data), style });
|
|
31
33
|
}
|
|
32
34
|
else if (Api.is("keyboardButtonWebView", button_) || Api.is("keyboardButtonSimpleWebView", button_)) {
|
|
33
|
-
return { text: button_.text, miniApp: constructMiniAppButtonInfo(button_.url) };
|
|
35
|
+
return cleanObject({ text: button_.text, miniApp: constructMiniAppButtonInfo(button_.url), style });
|
|
34
36
|
}
|
|
35
37
|
else if (Api.is("keyboardButtonUrlAuth", button_)) {
|
|
36
|
-
return { text: button_.text, loginUrl: { url: button_.url, forwardText: button_.fwd_text } };
|
|
38
|
+
return cleanObject({ text: button_.text, loginUrl: { url: button_.url, forwardText: button_.fwd_text }, style });
|
|
37
39
|
}
|
|
38
40
|
else if (Api.is("keyboardButtonSwitchInline", button_)) {
|
|
39
41
|
if (button_.same_peer) {
|
|
40
|
-
return { text: button_.text, switchInlineQueryCurrentChat: button_.query };
|
|
42
|
+
return cleanObject({ text: button_.text, switchInlineQueryCurrentChat: button_.query, style });
|
|
41
43
|
}
|
|
42
44
|
else if (button_.peer_types && button_.peer_types.length) {
|
|
43
45
|
const allowUsers = button_.peer_types.some((v) => v._ === "inlineQueryPeerTypeBotPM") || undefined;
|
|
44
46
|
const allowBots = button_.peer_types.some((v) => v._ === "inlineQueryPeerTypeSameBotPM" || v._ === "inlineQueryPeerTypeBotPM") || undefined;
|
|
45
47
|
const allowGroups = button_.peer_types.some((v) => v._ === "inlineQueryPeerTypeChat" || v._ === "inlineQueryPeerTypeMegagroup") || undefined;
|
|
46
48
|
const allowChannels = button_.peer_types.some((v) => v._ === "inlineQueryPeerTypeBroadcast") || undefined;
|
|
47
|
-
return cleanObject({ text: button_.text, switchInlineQueryChosenChats: { query: button_.query, allowUsers, allowBots, allowGroups, allowChannels } });
|
|
49
|
+
return cleanObject({ text: button_.text, switchInlineQueryChosenChats: { query: button_.query, allowUsers, allowBots, allowGroups, allowChannels }, style });
|
|
48
50
|
}
|
|
49
51
|
else {
|
|
50
|
-
return { text: button_.text, switchInlineQuery: button_.query };
|
|
52
|
+
return cleanObject({ text: button_.text, switchInlineQuery: button_.query, style });
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
else if (Api.is("keyboardButtonBuy", button_)) {
|
|
54
|
-
return { text: button_.text, pay: true };
|
|
56
|
+
return cleanObject({ text: button_.text, pay: true, style });
|
|
55
57
|
}
|
|
56
58
|
else if (Api.is("keyboardButtonGame", button_)) {
|
|
57
|
-
return { text: button_.text, callbackGame: {} };
|
|
59
|
+
return cleanObject({ text: button_.text, callbackGame: {}, style });
|
|
58
60
|
}
|
|
59
61
|
else if (Api.is("keyboardButtonCopy", button_)) {
|
|
60
|
-
return { text: button_.text, copy: button_.copy_text };
|
|
62
|
+
return cleanObject({ text: button_.text, copy: button_.copy_text, style });
|
|
61
63
|
}
|
|
62
64
|
else if (Api.is("keyboardButtonRequestPeer", button_)) {
|
|
63
65
|
unreachable();
|
|
@@ -67,23 +69,32 @@ export function constructInlineKeyboardButton(button_) {
|
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
export async function inlineKeyboardButtonToTlObject(button, usernameResolver) {
|
|
72
|
+
const style = buttonStyleToTlObject(button.style);
|
|
70
73
|
if ("url" in button) {
|
|
71
|
-
return { _: "keyboardButtonUrl", text: button.text, url: button.url };
|
|
74
|
+
return { _: "keyboardButtonUrl", text: button.text, url: button.url, style };
|
|
72
75
|
}
|
|
73
76
|
else if ("callbackData" in button) {
|
|
74
|
-
return { _: "keyboardButtonCallback", text: button.text, data: encodeText(button.callbackData) };
|
|
77
|
+
return { _: "keyboardButtonCallback", text: button.text, data: encodeText(button.callbackData), style };
|
|
75
78
|
}
|
|
76
79
|
else if ("miniApp" in button) {
|
|
77
|
-
return { _: "keyboardButtonWebView", text: button.text, url: button.miniApp.url };
|
|
80
|
+
return { _: "keyboardButtonWebView", text: button.text, url: button.miniApp.url, style };
|
|
78
81
|
}
|
|
79
82
|
else if ("loginUrl" in button) {
|
|
80
|
-
return {
|
|
83
|
+
return {
|
|
84
|
+
_: "inputKeyboardButtonUrlAuth",
|
|
85
|
+
text: button.text,
|
|
86
|
+
url: button.loginUrl.url,
|
|
87
|
+
fwd_text: button.loginUrl.forwardText,
|
|
88
|
+
bot: button.loginUrl.botUsername ? await usernameResolver(button.loginUrl.botUsername) : { _: "inputUserSelf" },
|
|
89
|
+
request_write_access: button.loginUrl.requestWriteAccess || undefined,
|
|
90
|
+
style,
|
|
91
|
+
};
|
|
81
92
|
}
|
|
82
93
|
else if ("switchInlineQuery" in button) {
|
|
83
|
-
return { _: "keyboardButtonSwitchInline", text: button.text, query: button.switchInlineQuery };
|
|
94
|
+
return { _: "keyboardButtonSwitchInline", text: button.text, query: button.switchInlineQuery, style };
|
|
84
95
|
}
|
|
85
96
|
else if ("switchInlineQueryCurrentChat" in button) {
|
|
86
|
-
return { _: "keyboardButtonSwitchInline", text: button.text, query: button.switchInlineQueryCurrentChat, same_peer: true };
|
|
97
|
+
return { _: "keyboardButtonSwitchInline", text: button.text, query: button.switchInlineQueryCurrentChat, same_peer: true, style };
|
|
87
98
|
}
|
|
88
99
|
else if ("switchInlineQueryChosenChats" in button) {
|
|
89
100
|
const peerTypes = new Array();
|
|
@@ -103,13 +114,13 @@ export async function inlineKeyboardButtonToTlObject(button, usernameResolver) {
|
|
|
103
114
|
if (allowChannels) {
|
|
104
115
|
peerTypes.push({ _: "inlineQueryPeerTypeBroadcast" });
|
|
105
116
|
}
|
|
106
|
-
return { _: "keyboardButtonSwitchInline", text: button.text, query: button.switchInlineQueryChosenChats.query, peer_types: peerTypes };
|
|
117
|
+
return { _: "keyboardButtonSwitchInline", text: button.text, query: button.switchInlineQueryChosenChats.query, peer_types: peerTypes, style };
|
|
107
118
|
}
|
|
108
119
|
else if ("pay" in button) {
|
|
109
|
-
return { _: "keyboardButtonBuy", text: button.text };
|
|
120
|
+
return { _: "keyboardButtonBuy", text: button.text, style };
|
|
110
121
|
}
|
|
111
122
|
else if ("copy" in button) {
|
|
112
|
-
return { _: "keyboardButtonCopy", text: button.text, copy_text: button.copy };
|
|
123
|
+
return { _: "keyboardButtonCopy", text: button.text, copy_text: button.copy, style };
|
|
113
124
|
}
|
|
114
125
|
else {
|
|
115
126
|
unreachable();
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2026 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import type { Api } from "../2_tl.js";
|
|
21
|
+
import type { InputPeerGetter } from "./_getters.js";
|
|
22
|
+
import type { ID } from "./0_id.js";
|
|
23
|
+
/**
|
|
24
|
+
* Reference to a gift by its slug.
|
|
25
|
+
* @unlisted
|
|
26
|
+
*/
|
|
27
|
+
export interface InputGiftSlug {
|
|
28
|
+
/** @discriminator */
|
|
29
|
+
type: "slug";
|
|
30
|
+
slug: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Reference to a gift in a chat by its ID.
|
|
34
|
+
* @unlisted
|
|
35
|
+
*/
|
|
36
|
+
export interface InputGiftChat {
|
|
37
|
+
/** @discriminator */
|
|
38
|
+
type: "chat";
|
|
39
|
+
chatId: ID;
|
|
40
|
+
id: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Reference to a gift in a private chat by its message ID.
|
|
44
|
+
* @unlisted
|
|
45
|
+
*/
|
|
46
|
+
export interface InputGiftUser {
|
|
47
|
+
/** @discriminator */
|
|
48
|
+
type: "user";
|
|
49
|
+
messageId: number;
|
|
50
|
+
}
|
|
51
|
+
/** Reference to a gift. */
|
|
52
|
+
export type InputGift = InputGiftSlug | InputGiftChat | InputGiftUser;
|
|
53
|
+
export declare function inputGiftToTlObject(inputGift: InputGift, getInputPeer: InputPeerGetter): Promise<Api.InputSavedStarGift>;
|
|
54
|
+
//# sourceMappingURL=1_input_gift.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1_input_gift.d.ts","sourceRoot":"","sources":["../../src/types/1_input_gift.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAEpC;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,EAAE,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,2BAA2B;AAC3B,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,aAAa,GAAG,aAAa,CAAC;AAEtE,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAW9H"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2026 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import { unreachable } from "../0_deps.js";
|
|
21
|
+
export async function inputGiftToTlObject(inputGift, getInputPeer) {
|
|
22
|
+
switch (inputGift.type) {
|
|
23
|
+
case "slug":
|
|
24
|
+
return { _: "inputSavedStarGiftSlug", slug: inputGift.slug };
|
|
25
|
+
case "chat":
|
|
26
|
+
return { _: "inputSavedStarGiftChat", peer: await getInputPeer(inputGift.chatId), saved_id: BigInt(inputGift.id) };
|
|
27
|
+
case "user":
|
|
28
|
+
return { _: "inputSavedStarGiftUser", msg_id: inputGift.messageId };
|
|
29
|
+
default:
|
|
30
|
+
unreachable();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
20
|
import { Api } from "../2_tl.js";
|
|
21
|
+
import { type ButtonStyle } from "./0_button_style.js";
|
|
21
22
|
import { type ChatAdministratorRights } from "./0_chat_administrator_rights.js";
|
|
22
23
|
import type { KeyboardButtonPollType } from "./0_keyboard_button_poll_type.js";
|
|
23
24
|
import type { MiniAppButtonInfo } from "./0_mini_app_button_info.js";
|
|
@@ -25,6 +26,7 @@ import type { MiniAppButtonInfo } from "./0_mini_app_button_info.js";
|
|
|
25
26
|
export interface KeyboardButtonText {
|
|
26
27
|
/** @discriminator */
|
|
27
28
|
text: string;
|
|
29
|
+
style?: ButtonStyle;
|
|
28
30
|
}
|
|
29
31
|
/** @unlisted */
|
|
30
32
|
export interface KeyboardButtonRequestUser extends KeyboardButtonText {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1_keyboard_button.d.ts","sourceRoot":"","sources":["../../src/types/1_keyboard_button.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"1_keyboard_button.d.ts","sourceRoot":"","sources":["../../src/types/1_keyboard_button.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,KAAK,WA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