@yui-bails/yui-bails 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +200 -0
  2. package/lib/Socket/connect-bot.d.ts +800 -0
  3. package/lib/Socket/connect-bot.d.ts.map +1 -0
  4. package/lib/Socket/connect-bot.js +94 -0
  5. package/lib/Socket/connect-bot.js.map +1 -0
  6. package/lib/Socket/index.d.ts +52 -0
  7. package/lib/Socket/index.d.ts.map +1 -1
  8. package/lib/Socket/index.js +34 -0
  9. package/lib/Socket/index.js.map +1 -1
  10. package/lib/Socket/session-manager.d.ts +56 -0
  11. package/lib/Socket/session-manager.d.ts.map +1 -1
  12. package/lib/Socket/session-manager.js +9 -3
  13. package/lib/Socket/session-manager.js.map +1 -1
  14. package/lib/Types/Message.d.ts +5 -0
  15. package/lib/Types/Message.d.ts.map +1 -1
  16. package/lib/Types/Socket.d.ts +5 -0
  17. package/lib/Types/Socket.d.ts.map +1 -1
  18. package/lib/Types/Socket.js.map +1 -1
  19. package/lib/Utils/banner.d.ts +1 -1
  20. package/lib/Utils/banner.js +1 -1
  21. package/lib/Utils/commands.d.ts +99 -0
  22. package/lib/Utils/commands.d.ts.map +1 -0
  23. package/lib/Utils/commands.js +176 -0
  24. package/lib/Utils/commands.js.map +1 -0
  25. package/lib/Utils/cooldown.d.ts +17 -0
  26. package/lib/Utils/cooldown.d.ts.map +1 -0
  27. package/lib/Utils/cooldown.js +42 -0
  28. package/lib/Utils/cooldown.js.map +1 -0
  29. package/lib/Utils/experimental-buttons.d.ts +24 -0
  30. package/lib/Utils/experimental-buttons.d.ts.map +1 -0
  31. package/lib/Utils/experimental-buttons.js +27 -0
  32. package/lib/Utils/experimental-buttons.js.map +1 -0
  33. package/lib/Utils/index.d.ts +6 -0
  34. package/lib/Utils/index.d.ts.map +1 -1
  35. package/lib/Utils/index.js +6 -0
  36. package/lib/Utils/index.js.map +1 -1
  37. package/lib/Utils/interactive.d.ts +126 -0
  38. package/lib/Utils/interactive.d.ts.map +1 -0
  39. package/lib/Utils/interactive.js +351 -0
  40. package/lib/Utils/interactive.js.map +1 -0
  41. package/lib/Utils/messages-media.d.ts +38 -0
  42. package/lib/Utils/messages-media.d.ts.map +1 -1
  43. package/lib/Utils/messages-media.js +51 -16
  44. package/lib/Utils/messages-media.js.map +1 -1
  45. package/lib/Utils/pairing.d.ts +28 -0
  46. package/lib/Utils/pairing.d.ts.map +1 -0
  47. package/lib/Utils/pairing.js +102 -0
  48. package/lib/Utils/pairing.js.map +1 -0
  49. package/lib/Utils/pretty-log.d.ts.map +1 -1
  50. package/lib/Utils/pretty-log.js +3 -1
  51. package/lib/Utils/pretty-log.js.map +1 -1
  52. package/lib/Utils/scheduler.d.ts +75 -0
  53. package/lib/Utils/scheduler.d.ts.map +1 -0
  54. package/lib/Utils/scheduler.js +265 -0
  55. package/lib/Utils/scheduler.js.map +1 -0
  56. package/lib/Utils/send-queue.d.ts.map +1 -1
  57. package/lib/Utils/send-queue.js +18 -2
  58. package/lib/Utils/send-queue.js.map +1 -1
  59. package/lib/index.d.ts +1 -0
  60. package/lib/index.d.ts.map +1 -1
  61. package/lib/index.js +1 -0
  62. package/lib/index.js.map +1 -1
  63. package/package.json +1 -1
@@ -0,0 +1,99 @@
1
+ import type { MiscMessageGenerationOptions, WAMessage } from '../Types/index.js';
2
+ import type { SenderInfo } from './helpers.js';
3
+ type Content = Record<string, unknown>;
4
+ /** who may run a command: everybody, the group admins (and owners), or only the owners */
5
+ export type CommandRole = 'all' | 'admin' | 'owner';
6
+ export type CommandContext = {
7
+ msg: WAMessage;
8
+ /** canonical name of the command (aliases resolve to it) */
9
+ command: string;
10
+ /** the prefix that was used (`''` when the router has no prefix) */
11
+ prefix: string;
12
+ /** everything after the command, as written */
13
+ text: string;
14
+ /** `text` split by spaces */
15
+ args: string[];
16
+ sender: SenderInfo;
17
+ chat: string;
18
+ isGroup: boolean;
19
+ /** quoted answer to the command */
20
+ reply: (content: string | Content, options?: MiscMessageGenerationOptions) => Promise<unknown>;
21
+ };
22
+ export type CommandDefinition = {
23
+ name: string;
24
+ aliases?: string[];
25
+ description?: string;
26
+ /** free text to group commands in a menu */
27
+ category?: string;
28
+ /** default `'all'` */
29
+ role?: CommandRole;
30
+ /** per-user wait between two uses of this command, in ms. Default 0 */
31
+ cooldownMs?: number;
32
+ groupOnly?: boolean;
33
+ privateOnly?: boolean;
34
+ run: (ctx: CommandContext) => void | Promise<void>;
35
+ };
36
+ export type CommandMessages = {
37
+ owner?: string;
38
+ admin?: string;
39
+ groupOnly?: string;
40
+ privateOnly?: string;
41
+ cooldown?: (secondsLeft: number) => string;
42
+ spam?: string;
43
+ };
44
+ export type CommandsOptions = {
45
+ /** one or several prefixes. Default `['.', '!', '/', '#']`. `false` = commands without prefix */
46
+ prefix?: string | string[] | false;
47
+ /** numbers (or ids / jids) that are owners */
48
+ owners?: string[];
49
+ /** the number linked to the bot counts as an owner. Default true */
50
+ ownerIncludesBot?: boolean;
51
+ /** too many commands in a short time from one user: the rest are ignored. `false` turns it off. Default 6 per 10 s */
52
+ spam?: {
53
+ max: number;
54
+ windowMs: number;
55
+ } | false;
56
+ messages?: CommandMessages;
57
+ /** a command threw: default tells the chat and logs it */
58
+ onError?: (error: unknown, ctx: CommandContext) => void | Promise<void>;
59
+ now?: () => number;
60
+ };
61
+ export type CommandsSocket = {
62
+ ev: {
63
+ on: (event: string, handler: (data: any) => void) => void;
64
+ off?: (event: string, handler: (data: any) => void) => void;
65
+ };
66
+ getSender: (msg: WAMessage) => Promise<SenderInfo>;
67
+ sendMessage: (jid: string, content: any, options?: MiscMessageGenerationOptions) => Promise<unknown> | unknown;
68
+ isAdmin: (groupJid: string, who: SenderInfo) => Promise<boolean>;
69
+ };
70
+ /**
71
+ * A small command router: prefixes, aliases, roles (owner / admin), group or private only,
72
+ * a cooldown per user and a basic anti-spam. It does not replace your own handler: use it
73
+ * (`listen()`) or call `handle(msg)` yourself.
74
+ */
75
+ export declare const makeCommands: (sock: CommandsSocket, options?: CommandsOptions) => {
76
+ /** registers a command (its name and aliases must be free) */
77
+ add: (definition: CommandDefinition) => /*elided*/ any;
78
+ remove: (name: string) => boolean;
79
+ get: (name: string) => CommandDefinition | undefined;
80
+ /** every command, for a help menu */
81
+ list: () => CommandDefinition[];
82
+ /** the per-user cooldowns (also useful outside commands) */
83
+ cooldowns: {
84
+ use: (user: string, action: string, ms: number) => number;
85
+ left: (user: string, action: string) => number;
86
+ reset: (user: string, action?: string) => void;
87
+ clear: () => void;
88
+ };
89
+ /**
90
+ * Runs the command written in `msg`, if there is one. Returns `true` when the message was a
91
+ * known command (even if it was denied), `false` when it is not for the router.
92
+ */
93
+ handle: (msg: WAMessage) => Promise<boolean>;
94
+ /** starts listening to new messages. Returns a function that stops it. */
95
+ listen: () => () => void | undefined;
96
+ };
97
+ export type Commands = ReturnType<typeof makeCommands>;
98
+ export {};
99
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/Utils/commands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAG3C,KAAK,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAEtC,0FAA0F;AAC1F,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,CAAA;AAEnD,MAAM,MAAM,cAAc,GAAG;IAC5B,GAAG,EAAE,SAAS,CAAA;IACd,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAA;IACf,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAA;IACd,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAA;IACZ,6BAA6B;IAC7B,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,MA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EAA0E;;CAc3E,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAA"}
@@ -0,0 +1,176 @@
1
+ import { Boom } from '@hapi/boom';
2
+ import { makeCooldowns } from './cooldown.js';
3
+ import { extractMessageContent } from './messages.js';
4
+ const DEFAULT_MESSAGES = {
5
+ owner: '🔒 Este comando es solo para el dueño del bot.',
6
+ admin: '🔒 Este comando es solo para admins del grupo.',
7
+ groupOnly: '👥 Este comando solo funciona en grupos.',
8
+ privateOnly: '👤 Este comando solo funciona en chats privados.',
9
+ cooldown: seconds => `⏳ Espera ${seconds} s para volver a usar este comando.`,
10
+ spam: '🚦 Vas muy rápido. Espera unos segundos.'
11
+ };
12
+ const textOf = (msg) => {
13
+ const content = extractMessageContent(msg.message);
14
+ if (!content)
15
+ return '';
16
+ return (content.conversation ||
17
+ content.extendedTextMessage?.text ||
18
+ content.imageMessage?.caption ||
19
+ content.videoMessage?.caption ||
20
+ content.documentMessage?.caption ||
21
+ '');
22
+ };
23
+ /**
24
+ * A small command router: prefixes, aliases, roles (owner / admin), group or private only,
25
+ * a cooldown per user and a basic anti-spam. It does not replace your own handler: use it
26
+ * (`listen()`) or call `handle(msg)` yourself.
27
+ */
28
+ export const makeCommands = (sock, options = {}) => {
29
+ const now = options.now || Date.now;
30
+ const prefixes = options.prefix === false ? [''] : [options.prefix ?? ['.', '!', '/', '#']].flat();
31
+ const messages = { ...DEFAULT_MESSAGES, ...options.messages };
32
+ const owners = options.owners || [];
33
+ const ownerIncludesBot = options.ownerIncludesBot ?? true;
34
+ const spamRule = options.spam === undefined ? { max: 6, windowMs: 10000 } : options.spam;
35
+ const cooldowns = makeCooldowns({ now });
36
+ const registry = new Map();
37
+ const byName = new Map();
38
+ const recent = new Map();
39
+ const warned = new Map();
40
+ const say = async (chat, msg, text) => {
41
+ await sock.sendMessage(chat, { text }, { quoted: msg });
42
+ };
43
+ const isOwner = (sender) => (ownerIncludesBot && sender.fromMe) || (owners.length > 0 && sender.is(owners));
44
+ /** true when this user is sending too many commands */
45
+ const isSpamming = (user) => {
46
+ if (!spamRule)
47
+ return false;
48
+ const stamps = (recent.get(user) || []).filter(at => now() - at < spamRule.windowMs);
49
+ stamps.push(now());
50
+ recent.set(user, stamps);
51
+ return stamps.length > spamRule.max;
52
+ };
53
+ const manager = {
54
+ /** registers a command (its name and aliases must be free) */
55
+ add: (definition) => {
56
+ const name = definition.name.toLowerCase();
57
+ if (!name || /\s/.test(name))
58
+ throw new Boom(`Invalid command name "${definition.name}"`, { statusCode: 400 });
59
+ const names = [name, ...(definition.aliases || []).map(alias => alias.toLowerCase())];
60
+ for (const candidate of names) {
61
+ if (byName.has(candidate))
62
+ throw new Boom(`The command or alias "${candidate}" already exists`, { statusCode: 400 });
63
+ }
64
+ registry.set(name, definition);
65
+ for (const candidate of names)
66
+ byName.set(candidate, definition);
67
+ return manager;
68
+ },
69
+ remove: (name) => {
70
+ const definition = byName.get(name.toLowerCase());
71
+ if (!definition)
72
+ return false;
73
+ registry.delete(definition.name.toLowerCase());
74
+ for (const [key, value] of [...byName])
75
+ if (value === definition)
76
+ byName.delete(key);
77
+ return true;
78
+ },
79
+ get: (name) => byName.get(name.toLowerCase()),
80
+ /** every command, for a help menu */
81
+ list: () => [...registry.values()],
82
+ /** the per-user cooldowns (also useful outside commands) */
83
+ cooldowns,
84
+ /**
85
+ * Runs the command written in `msg`, if there is one. Returns `true` when the message was a
86
+ * known command (even if it was denied), `false` when it is not for the router.
87
+ */
88
+ handle: async (msg) => {
89
+ const chat = msg.key.remoteJid;
90
+ if (!chat)
91
+ return false;
92
+ const text = textOf(msg).trim();
93
+ const prefix = prefixes.find(candidate => text.startsWith(candidate));
94
+ if (prefix === undefined)
95
+ return false;
96
+ const [word = '', ...args] = text.slice(prefix.length).split(/\s+/);
97
+ const definition = byName.get(word.toLowerCase());
98
+ if (!definition)
99
+ return false;
100
+ const sender = await sock.getSender(msg);
101
+ const isGroup = sender.isGroup;
102
+ const user = sender.number || sender.id || sender.jid;
103
+ const ctx = {
104
+ msg,
105
+ command: definition.name.toLowerCase(),
106
+ prefix,
107
+ text: text.slice(prefix.length + word.length).trim(),
108
+ args: args.filter(Boolean),
109
+ sender,
110
+ chat,
111
+ isGroup,
112
+ reply: (content, replyOptions) => Promise.resolve(sock.sendMessage(chat, typeof content === 'string' ? { text: content } : content, {
113
+ quoted: msg,
114
+ ...replyOptions
115
+ }))
116
+ };
117
+ if (!isOwner(sender) && isSpamming(user)) {
118
+ // one notice per window, not one per message
119
+ const lastWarning = warned.get(user);
120
+ if (lastWarning === undefined || now() - lastWarning > (spamRule ? spamRule.windowMs : 0)) {
121
+ warned.set(user, now());
122
+ await say(chat, msg, messages.spam);
123
+ }
124
+ return true;
125
+ }
126
+ if (definition.groupOnly && !isGroup) {
127
+ await say(chat, msg, messages.groupOnly);
128
+ return true;
129
+ }
130
+ if (definition.privateOnly && isGroup) {
131
+ await say(chat, msg, messages.privateOnly);
132
+ return true;
133
+ }
134
+ const owner = isOwner(sender);
135
+ const role = definition.role ?? 'all';
136
+ if (role === 'owner' && !owner) {
137
+ await say(chat, msg, messages.owner);
138
+ return true;
139
+ }
140
+ if (role === 'admin' && !owner && !(isGroup && (await sock.isAdmin(chat, sender)))) {
141
+ await say(chat, msg, messages.admin);
142
+ return true;
143
+ }
144
+ // owners are never made to wait
145
+ const left = owner ? 0 : cooldowns.use(user, ctx.command, definition.cooldownMs ?? 0);
146
+ if (left > 0) {
147
+ await say(chat, msg, messages.cooldown(Math.ceil(left / 1000)));
148
+ return true;
149
+ }
150
+ try {
151
+ await definition.run(ctx);
152
+ }
153
+ catch (error) {
154
+ if (options.onError)
155
+ await options.onError(error, ctx);
156
+ else
157
+ await say(chat, msg, '⚠️ Algo salió mal con ese comando.').catch(() => undefined);
158
+ }
159
+ return true;
160
+ },
161
+ /** starts listening to new messages. Returns a function that stops it. */
162
+ listen: () => {
163
+ // `notify` = something a person just wrote. The bot's own sends arrive as `append`.
164
+ const handler = ({ messages, type }) => {
165
+ if (type !== 'notify')
166
+ return;
167
+ for (const msg of messages)
168
+ void manager.handle(msg).catch(() => undefined);
169
+ };
170
+ sock.ev.on('messages.upsert', handler);
171
+ return () => sock.ev.off?.('messages.upsert', handler);
172
+ }
173
+ };
174
+ return manager;
175
+ };
176
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/Utils/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,OAAO,EAAkB,aAAa,EAAE,MAAM,YAAY,CAAA;AAE1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAyElD,MAAM,gBAAgB,GAA8B;IACnD,KAAK,EAAE,gDAAgD;IACvD,KAAK,EAAE,gDAAgD;IACvD,SAAS,EAAE,0CAA0C;IACrD,WAAW,EAAE,kDAAkD;IAC/D,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC,YAAY,OAAO,qCAAqC;IAC7E,IAAI,EAAE,0CAA0C;CAChD,CAAA;AAED,MAAM,MAAM,GAAG,CAAC,GAAc,EAAU,EAAE;IACzC,MAAM,OAAO,GAAG,qBAAqB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IAClD,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAA;IACvB,OAAO,CACN,OAAO,CAAC,YAAY;QACpB,OAAO,CAAC,mBAAmB,EAAE,IAAI;QACjC,OAAO,CAAC,YAAY,EAAE,OAAO;QAC7B,OAAO,CAAC,YAAY,EAAE,OAAO;QAC7B,OAAO,CAAC,eAAe,EAAE,OAAO;QAChC,EAAE,CACF,CAAA;AACF,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAoB,EAAE,UAA2B,EAAE,EAAE,EAAE;IACnF,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,CA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AAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;YAC5E,CAAC,CAAA;YAED,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAA;YACtC,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAA;QACvD,CAAC;KACD,CAAA;IAED,OAAO,OAAO,CAAA;AACf,CAAC,CAAA"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Per-user cooldowns: "this user can run this action once every X ms".
3
+ * `use` returns 0 when the action may go ahead (and starts the cooldown), or the milliseconds left.
4
+ */
5
+ export declare const makeCooldowns: ({ now }?: {
6
+ now?: () => number;
7
+ }) => {
8
+ /** 0 = go ahead (the cooldown starts now); otherwise, ms still to wait. */
9
+ use: (user: string, action: string, ms: number) => number;
10
+ /** ms left without starting anything */
11
+ left: (user: string, action: string) => number;
12
+ /** forget one cooldown (or all of a user's when `action` is omitted) */
13
+ reset: (user: string, action?: string) => void;
14
+ clear: () => void;
15
+ };
16
+ export type Cooldowns = ReturnType<typeof makeCooldowns>;
17
+ //# sourceMappingURL=cooldown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cooldown.d.ts","sourceRoot":"","sources":["../../src/Utils/cooldown.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,UAAoB;IAAE,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CAAO;IAW3E,2EAA2E;gBAC/D,MAAM,UAAU,MAAM,MAAM,MAAM,KAAG,MAAM;IAWvD,wCAAwC;iBAC3B,MAAM,UAAU,MAAM,KAAG,MAAM;IAC5C,wEAAwE;kBAC1D,MAAM,WAAW,MAAM;;CAMtC,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Per-user cooldowns: "this user can run this action once every X ms".
3
+ * `use` returns 0 when the action may go ahead (and starts the cooldown), or the milliseconds left.
4
+ */
5
+ export const makeCooldowns = ({ now = Date.now } = {}) => {
6
+ const until = new Map();
7
+ const sweep = () => {
8
+ const current = now();
9
+ for (const [key, at] of until) {
10
+ if (at <= current)
11
+ until.delete(key);
12
+ }
13
+ };
14
+ return {
15
+ /** 0 = go ahead (the cooldown starts now); otherwise, ms still to wait. */
16
+ use: (user, action, ms) => {
17
+ if (ms <= 0)
18
+ return 0;
19
+ if (until.size > 5000)
20
+ sweep();
21
+ const key = `${user}\u0000${action}`;
22
+ const left = (until.get(key) ?? 0) - now();
23
+ if (left > 0)
24
+ return left;
25
+ until.set(key, now() + ms);
26
+ return 0;
27
+ },
28
+ /** ms left without starting anything */
29
+ left: (user, action) => Math.max(0, (until.get(`${user}\u0000${action}`) ?? 0) - now()),
30
+ /** forget one cooldown (or all of a user's when `action` is omitted) */
31
+ reset: (user, action) => {
32
+ if (action)
33
+ until.delete(`${user}\u0000${action}`);
34
+ else
35
+ for (const key of [...until.keys()])
36
+ if (key.startsWith(`${user}\u0000`))
37
+ until.delete(key);
38
+ },
39
+ clear: () => until.clear()
40
+ };
41
+ };
42
+ //# sourceMappingURL=cooldown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cooldown.js","sourceRoot":"","sources":["../../src/Utils/cooldown.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,GAAG,KAA6B,EAAE,EAAE,EAAE;IAChF,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAA;IAEvC,MAAM,KAAK,GAAG,GAAG,EAAE;QAClB,MAAM,OAAO,GAAG,GAAG,EAAE,CAAA;QACrB,KAAK,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC;YAC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G,CAAC;QACD,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE;KAC1B,CAAA;AACF,CAAC,CAAA"}
@@ -0,0 +1,24 @@
1
+ import type { ButtonSpec } from '../Types/index.js';
2
+ /**
3
+ * Native flow buttons that exist in WhatsApp's protocol but are not guaranteed to show up for
4
+ * every account or app version: WhatsApp ignores the ones it does not support, and a message can
5
+ * arrive without them. They come from public documentation and other libraries, and have NOT
6
+ * been confirmed by Yui-Bails on real phones. Try one at a time and keep what renders.
7
+ *
8
+ * Use them like any other button: `sock.sendButtons(jid, { text, buttons: [experimentalButtons.requestLocation()] })`.
9
+ */
10
+ export declare const experimentalButtons: {
11
+ /** "Send location" button: opens the share-location screen (`send_location`) */
12
+ requestLocation: (text?: string) => ButtonSpec;
13
+ /** asks WhatsApp to remind the user later (`cta_reminder`) */
14
+ reminder: (text?: string) => ButtonSpec;
15
+ /** cancels a reminder set by `reminder` (`cta_cancel_reminder`) */
16
+ cancelReminder: (text?: string) => ButtonSpec;
17
+ /** address form (`address_message`) */
18
+ address: (text?: string) => ButtonSpec;
19
+ /** opens a page inside WhatsApp without leaving the chat (`open_webview`) */
20
+ webview: (title: string, url: string) => ButtonSpec;
21
+ /** any native flow button by name, with its params as an object */
22
+ custom: (name: string, params?: Record<string, unknown>) => ButtonSpec;
23
+ };
24
+ //# sourceMappingURL=experimental-buttons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"experimental-buttons.d.ts","sourceRoot":"","sources":["../../src/Utils/experimental-buttons.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAO1C;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB;IAC/B,gFAAgF;wCAC/B,UAAU;IAE3D,8DAA8D;iCAC3B,UAAU;IAE7C,mEAAmE;uCACd,UAAU;IAE/D,uCAAuC;gCACE,UAAU;IAEnD,6EAA6E;qBAC5D,MAAM,OAAO,MAAM,KAAG,UAAU;IAGjD,mEAAmE;mBACpD,MAAM,WAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAQ,UAAU;CACxE,CAAA"}
@@ -0,0 +1,27 @@
1
+ const raw = (name, params) => ({
2
+ name,
3
+ buttonParamsJson: JSON.stringify(params)
4
+ });
5
+ /**
6
+ * Native flow buttons that exist in WhatsApp's protocol but are not guaranteed to show up for
7
+ * every account or app version: WhatsApp ignores the ones it does not support, and a message can
8
+ * arrive without them. They come from public documentation and other libraries, and have NOT
9
+ * been confirmed by Yui-Bails on real phones. Try one at a time and keep what renders.
10
+ *
11
+ * Use them like any other button: `sock.sendButtons(jid, { text, buttons: [experimentalButtons.requestLocation()] })`.
12
+ */
13
+ export const experimentalButtons = {
14
+ /** "Send location" button: opens the share-location screen (`send_location`) */
15
+ requestLocation: (text = '📍 Enviar ubicación') => raw('send_location', { display_text: text }),
16
+ /** asks WhatsApp to remind the user later (`cta_reminder`) */
17
+ reminder: (text = '⏰ Recordarme') => raw('cta_reminder', { display_text: text }),
18
+ /** cancels a reminder set by `reminder` (`cta_cancel_reminder`) */
19
+ cancelReminder: (text = '🚫 Cancelar recordatorio') => raw('cta_cancel_reminder', { display_text: text }),
20
+ /** address form (`address_message`) */
21
+ address: (text = '🏠 Enviar dirección') => raw('address_message', { display_text: text }),
22
+ /** opens a page inside WhatsApp without leaving the chat (`open_webview`) */
23
+ webview: (title, url) => raw('open_webview', { title, link: { in_app_webview: true, url } }),
24
+ /** any native flow button by name, with its params as an object */
25
+ custom: (name, params = {}) => raw(name, params)
26
+ };
27
+ //# sourceMappingURL=experimental-buttons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"experimental-buttons.js","sourceRoot":"","sources":["../../src/Utils/experimental-buttons.ts"],"names":[],"mappings":"AAEA,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,MAA+B,EAAc,EAAE,CAAC,CAAC;IAC3E,IAAI;IACJ,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;CACxC,CAAC,CAAA;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC,gFAAgF;IAChF,eAAe,EAAE,CAAC,IAAI,GAAG,qBAAqB,EAAc,EAAE,CAAC,GAAG,CAAC,eAAe,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IAE3G,8DAA8D;IAC9D,QAAQ,EAAE,CAAC,IAAI,GAAG,cAAc,EAAc,EAAE,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IAE5F,mEAAmE;IACnE,cAAc,EAAE,CAAC,IAAI,GAAG,0BAA0B,EAAc,EAAE,CAAC,GAAG,CAAC,qBAAqB,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IAErH,uCAAuC;IACvC,OAAO,EAAE,CAAC,IAAI,GAAG,qBAAqB,EAAc,EAAE,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IAErG,6EAA6E;IAC7E,OAAO,EAAE,CAAC,KAAa,EAAE,GAAW,EAAc,EAAE,CACnD,GAAG,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC;IAEpE,mEAAmE;IACnE,MAAM,EAAE,CAAC,IAAY,EAAE,SAAkC,EAAE,EAAc,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC;CAC7F,CAAA"}
@@ -23,6 +23,9 @@ export * from './automation.js';
23
23
  export * from './banner.js';
24
24
  export * from './stanza-ack.js';
25
25
  export * from './wa-version.js';
26
+ export * from './commands.js';
27
+ export * from './cooldown.js';
28
+ export * from './experimental-buttons.js';
26
29
  export * from './group-cache.js';
27
30
  export * from './group-tools.js';
28
31
  export * from './helpers.js';
@@ -30,6 +33,9 @@ export * from './insights.js';
30
33
  export * from './mentions.js';
31
34
  export * from './message-store.js';
32
35
  export * from './replies.js';
36
+ export * from './interactive.js';
37
+ export * from './pairing.js';
33
38
  export * from './pretty-log.js';
39
+ export * from './scheduler.js';
34
40
  export * from './send-queue.js';
35
41
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA"}
@@ -23,6 +23,9 @@ export * from './automation.js';
23
23
  export * from './banner.js';
24
24
  export * from './stanza-ack.js';
25
25
  export * from './wa-version.js';
26
+ export * from './commands.js';
27
+ export * from './cooldown.js';
28
+ export * from './experimental-buttons.js';
26
29
  export * from './group-cache.js';
27
30
  export * from './group-tools.js';
28
31
  export * from './helpers.js';
@@ -30,6 +33,9 @@ export * from './insights.js';
30
33
  export * from './mentions.js';
31
34
  export * from './message-store.js';
32
35
  export * from './replies.js';
36
+ export * from './interactive.js';
37
+ export * from './pairing.js';
33
38
  export * from './pretty-log.js';
39
+ export * from './scheduler.js';
34
40
  export * from './send-queue.js';
35
41
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA"}
@@ -0,0 +1,126 @@
1
+ import type { MiscMessageGenerationOptions, WAMessage } from '../Types/index.js';
2
+ import type { SendButtonsOptions, SenderInfo } from './helpers.js';
3
+ import type { ButtonReply } from './replies.js';
4
+ type Content = Record<string, unknown>;
5
+ /** Who may tap a button: the person who asked, group admins, everybody, or your own check */
6
+ export type Who = 'sender' | 'admins' | 'anyone' | ((tap: SenderInfo, msg: WAMessage) => boolean | Promise<boolean>);
7
+ /** What a handler receives when someone taps one of these buttons */
8
+ export type TapContext = {
9
+ /** the message with the tap (reply to it with `sock.reply(msg, ...)`) */
10
+ msg: WAMessage;
11
+ reply: ButtonReply;
12
+ /** who tapped */
13
+ sender: SenderInfo;
14
+ };
15
+ export type GuardOptions = {
16
+ /** who may tap. Default `'sender'` (only the person who asked) */
17
+ who?: Who;
18
+ /** said to someone who may not tap. `false` ignores them silently */
19
+ denied?: string | false;
20
+ /** said when the button is too old. `false` ignores the tap silently */
21
+ expired?: string | false;
22
+ /** how long the buttons keep working after the last tap, in ms */
23
+ ttlMs?: number;
24
+ };
25
+ export type ConfirmOptions = GuardOptions & {
26
+ yes?: string;
27
+ no?: string;
28
+ footer?: string;
29
+ /** how long to wait for an answer, in ms. Default 30000. When it runs out, `confirm` returns `false` */
30
+ timeoutMs?: number;
31
+ };
32
+ export type PaginateOptions = GuardOptions & {
33
+ /** items per page. Default 5 */
34
+ perPage?: number;
35
+ title?: string;
36
+ footer?: string;
37
+ /** how each item is written. Default `1. item` */
38
+ format?: (item: any, index: number) => string;
39
+ prevText?: string;
40
+ nextText?: string;
41
+ /** said when there is nothing to show */
42
+ empty?: string;
43
+ };
44
+ export type MenuNode = {
45
+ title: string;
46
+ description?: string;
47
+ /** sub-options: tapping this row opens another menu */
48
+ items?: MenuNode[];
49
+ /** text sent when this row is tapped (or shown above the sub-menu) */
50
+ text?: string;
51
+ /** runs when this row is tapped (rows without `items`) */
52
+ run?: (tap: TapContext & {
53
+ path: string[];
54
+ }) => void | Promise<void>;
55
+ };
56
+ export type MenuDefinition = GuardOptions & {
57
+ title?: string;
58
+ text?: string;
59
+ footer?: string;
60
+ /** text on the button that opens the list. Default "Ver opciones" */
61
+ buttonText?: string;
62
+ /** text of the row that goes back. Default "⬅ Volver" */
63
+ backText?: string;
64
+ items: MenuNode[];
65
+ };
66
+ export type GuardedButtonsOptions = SendButtonsOptions & GuardOptions & {
67
+ /** the buttons stop working after the first allowed tap */
68
+ once?: boolean;
69
+ };
70
+ export type RepeatableOptions = GuardOptions & {
71
+ /** text on the button. Default "🔁 Otra vez" */
72
+ buttonText?: string;
73
+ /** how many times it can be repeated. Default 10 */
74
+ maxRepeats?: number;
75
+ footer?: string;
76
+ };
77
+ export type InteractiveSocket = {
78
+ sendMessage: (jid: string, content: any, options?: MiscMessageGenerationOptions) => Promise<WAMessage | undefined> | WAMessage | undefined;
79
+ sendButtons: (jid: string, options: SendButtonsOptions, msgOptions?: MiscMessageGenerationOptions) => Promise<WAMessage | undefined> | WAMessage | undefined;
80
+ disableButtons: (msg: WAMessage, text?: string) => Promise<boolean>;
81
+ getSender: (msg: WAMessage) => Promise<SenderInfo>;
82
+ onReply: (matcher: (reply: ButtonReply) => boolean, run: (msg: WAMessage, reply: ButtonReply) => Promise<void>) => unknown;
83
+ isAdmin: (groupJid: string, who: SenderInfo) => Promise<boolean>;
84
+ };
85
+ /**
86
+ * Buttons that think: confirmations, pages, nested menus, buttons only some people can tap and
87
+ * "again" buttons. They are built on quick-reply buttons and dropdown rows, which already work,
88
+ * so there is nothing new for WhatsApp to reject.
89
+ */
90
+ export declare const makeInteractive: (sock: InteractiveSocket, { now, logger }?: {
91
+ now?: () => number;
92
+ logger?: {
93
+ warn: (obj: unknown, msg?: string) => void;
94
+ };
95
+ }) => {
96
+ /**
97
+ * Asks yes / no with two buttons and returns `true` or `false`. Only the person who wrote
98
+ * the command can answer (change it with `who`). `false` also when time runs out.
99
+ */
100
+ confirm: (msg: WAMessage, text: string, options?: ConfirmOptions) => Promise<boolean>;
101
+ /**
102
+ * Shows a long list in pages with "Anterior / Siguiente" buttons. Each page is a new message
103
+ * and the buttons of the previous one are removed. Returns the first page that was sent.
104
+ */
105
+ paginate: (msg: WAMessage, items: unknown[], options?: PaginateOptions) => Promise<WAMessage | undefined>;
106
+ /**
107
+ * A menu with sub-menus. Every level is a dropdown list; sub-menus get a "Volver" row.
108
+ * WhatsApp usually allows about 10 rows per list: split bigger ones into sub-menus.
109
+ */
110
+ menu: (msg: WAMessage, definition: MenuDefinition) => Promise<WAMessage | undefined>;
111
+ /**
112
+ * `sendButtons` where only some people can tap. Others get a short "this is not for you".
113
+ * Quick-reply buttons and dropdown rows are guarded; URL / call / copy buttons act by themselves.
114
+ */
115
+ sendGuardedButtons: (msg: WAMessage, options: GuardedButtonsOptions, onTap: (tap: TapContext & {
116
+ id: string;
117
+ }) => void | Promise<void>) => Promise<WAMessage | undefined>;
118
+ /**
119
+ * Sends something with a "🔁 Otra vez" button. Each tap sends it again (a function gives a new
120
+ * result every time, e.g. a random phrase) and removes the button from the older message.
121
+ */
122
+ sendRepeatable: (msg: WAMessage, source: string | Content | (() => string | Content | Promise<string | Content>), options?: RepeatableOptions) => Promise<WAMessage | undefined>;
123
+ };
124
+ export type Interactive = ReturnType<typeof makeInteractive>;
125
+ export {};
126
+ //# sourceMappingURL=interactive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../../src/Utils/interactive.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,4BAA4B,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACnF,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE5C,KAAK,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAEtC,6FAA6F;AAC7F,MAAM,MAAM,GAAG,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,CAAC,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;AAEpH,qEAAqE;AACrE,MAAM,MAAM,UAAU,GAAG;IACxB,yEAAyE;IACzE,GAAG,EAAE,SAAS,CAAA;IACd,KAAK,EA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