@bobfrankston/iflow 1.0.2 → 1.0.3

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.
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Gmail-specific IMAP support with OAuth authentication
3
+ */
4
+ import { authenticateOAuth } from '@bobfrankston/oauthsupport';
5
+ import path from 'path';
6
+ import fs from 'fs';
7
+ const GMAIL_SERVER = 'imap.gmail.com';
8
+ const GMAIL_PORT = 993;
9
+ const GMAIL_SCOPE = 'https://mail.google.com/';
10
+ // Get the directory where this module is located
11
+ const DEFAULT_CREDENTIALS_PATH = path.resolve(import.meta.dirname, '..', 'credentials.json');
12
+ /**
13
+ * Check if email address is Gmail
14
+ */
15
+ export function isGmailUser(username) {
16
+ return username.toLowerCase().endsWith('@gmail.com');
17
+ }
18
+ /**
19
+ * Check if a server is Gmail
20
+ */
21
+ export function isGmailServer(server) {
22
+ return server.toLowerCase() === GMAIL_SERVER ||
23
+ server.toLowerCase().endsWith('.gmail.com');
24
+ }
25
+ /**
26
+ * Creates an ImapClientConfig with OAuth tokenProvider
27
+ * Auto-detects Gmail from @gmail.com email addresses
28
+ * Tokens stored in <tokenDirectory>/tokens/<sanitized-email>/token.json
29
+ *
30
+ * Credentials and tokens are stored in the iflow package directory by default
31
+ */
32
+ export function createImapConfig(config) {
33
+ const { username } = config;
34
+ if (!isGmailUser(username)) {
35
+ throw new Error(`OAuth auto-config only supports Gmail (@gmail.com). Got: ${username}`);
36
+ }
37
+ // Use provided credentials path or default to iflow package's credentials.json
38
+ const credentialsPath = config.credentialsPath || DEFAULT_CREDENTIALS_PATH;
39
+ // Validate credentials file exists
40
+ if (!fs.existsSync(credentialsPath)) {
41
+ throw new Error(`Gmail OAuth credentials file not found at: ${credentialsPath}`);
42
+ }
43
+ const tokenDirectory = config.tokenDirectory || path.dirname(credentialsPath);
44
+ // Token storage: <tokenDirectory>/tokens/<sanitized-email>/
45
+ const accountDir = username.replace(/[@.]/g, '_');
46
+ const tokenDir = path.join(tokenDirectory, 'tokens', accountDir);
47
+ const getToken = async () => {
48
+ const token = await authenticateOAuth(credentialsPath, {
49
+ scope: GMAIL_SCOPE,
50
+ tokenDirectory: tokenDir,
51
+ tokenFileName: 'token.json',
52
+ credentialsKey: 'installed',
53
+ includeOfflineAccess: true,
54
+ loginHint: username
55
+ });
56
+ if (!token)
57
+ throw new Error('Failed to get Gmail access token');
58
+ return token.access_token;
59
+ };
60
+ return {
61
+ server: GMAIL_SERVER,
62
+ port: GMAIL_PORT,
63
+ username,
64
+ tokenProvider: getToken
65
+ };
66
+ }
67
+ /** @deprecated Use createImapConfig instead */
68
+ export const createGmailConfig = createImapConfig;
69
+ /**
70
+ * Auto-configure IMAP client - detects Gmail and uses OAuth, otherwise uses password
71
+ * This is the main function to use - it handles all authentication logic internally
72
+ *
73
+ * @param config - Server configuration with username, password (optional for Gmail), server, port
74
+ * @returns ImapClientConfig ready to use with ImapClient
75
+ */
76
+ export function createAutoImapConfig(config) {
77
+ // Check if this is Gmail by username or server
78
+ const isGmail = isGmailUser(config.username) || isGmailServer(config.server);
79
+ if (isGmail) {
80
+ // Use OAuth for Gmail
81
+ const oauthConfig = createImapConfig({
82
+ username: config.username
83
+ });
84
+ // Merge in additional options
85
+ return {
86
+ ...oauthConfig,
87
+ verbose: config.verbose,
88
+ rejectUnauthorized: config.rejectUnauthorized
89
+ };
90
+ }
91
+ else {
92
+ // Use password authentication for non-Gmail
93
+ return {
94
+ server: config.server,
95
+ port: config.port,
96
+ username: config.username,
97
+ password: config.password,
98
+ verbose: config.verbose,
99
+ rejectUnauthorized: config.rejectUnauthorized
100
+ };
101
+ }
102
+ }
103
+ //# sourceMappingURL=gmail.js.map
@@ -5,12 +5,15 @@ declare class SimpleMap<T> {
5
5
  get(key: string): T[] | undefined;
6
6
  }
7
7
  export type MessageEnvelope = imapflow.MessageEnvelopeObject;
8
+ export type TokenProvider = () => Promise<string>;
8
9
  export interface ImapClientConfig {
9
10
  server: string;
10
11
  port: number;
11
12
  username: string;
12
- password: string;
13
+ password?: string;
14
+ tokenProvider?: TokenProvider;
13
15
  verbose?: boolean;
16
+ rejectUnauthorized?: boolean;
14
17
  }
15
18
  export interface FetchQuery extends imapflow.FetchQueryObject {
16
19
  }
package/index.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export { ImapClient } from './imaplib/ImapClient.js';
2
+ export type { ImapClientConfig, FetchedMessage, FetchQuery, FetchPart, MessageEnvelope, TokenProvider } from './imaplib/types.js';
3
+ export type { SearchObject } from 'imapflow';
4
+ export { FetchedMessage as FetchedMessageClass } from './imaplib/types.js';
5
+ export { createAutoImapConfig } from './imaplib/gmail.js';
6
+ export { isGmailUser, isGmailServer, createImapConfig, type OAuthImapConfig } from './imaplib/gmail.js';
7
+ //# sourceMappingURL=index.d.ts.map
package/index.js ADDED
@@ -0,0 +1,9 @@
1
+ // Main entry point for @bobfrankston/iflow package
2
+ // Re-exports all public API from the library
3
+ export { ImapClient } from './imaplib/ImapClient.js';
4
+ export { FetchedMessage as FetchedMessageClass } from './imaplib/types.js';
5
+ // Auto-configuration support (handles OAuth/password automatically)
6
+ export { createAutoImapConfig } from './imaplib/gmail.js';
7
+ // Gmail OAuth support (for advanced usage)
8
+ export { isGmailUser, isGmailServer, createImapConfig } from './imaplib/gmail.js';
9
+ //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,13 +1,19 @@
1
1
  {
2
2
  "name": "@bobfrankston/iflow",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "IMAP client wrapper library",
5
- "main": "imaplib/ImapClient.js",
6
- "types": "imaplib/ImapClient.ts",
5
+ "main": "index.js",
6
+ "types": "index.ts",
7
7
  "type": "module",
8
8
  "scripts": {
9
9
  "build": "tsc",
10
- "watch": "tsc -watch"
10
+ "watch": "tsc -watch",
11
+ "check": "tsc --noEmit",
12
+ "prerelease:local": "git add -A && (git diff-index --quiet HEAD || git commit -m \"Pre-release commit\")",
13
+ "preversion": "npm run check && git add -A",
14
+ "release": "npm whoami && npm run prerelease:local && npm version patch && npm publish --access public",
15
+ "installer": "npm run release && npm install -g @bobfrankston/iflow",
16
+ "postversion": "git push && git push --tags"
11
17
  },
12
18
  "keywords": [
13
19
  "imap",
@@ -17,21 +23,30 @@
17
23
  "author": "",
18
24
  "license": "ISC",
19
25
  "dependencies": {
20
- "@types/imapflow": "^1.0.22",
26
+ "@bobfrankston/oauthsupport": "^1.0.10",
21
27
  "imapflow": "^1.0.187"
22
28
  },
23
29
  "exports": {
24
30
  ".": {
25
- "types": "./imaplib/types.ts",
26
- "default": "./imaplib/types.js"
31
+ "types": "./index.ts",
32
+ "default": "./index.js"
27
33
  },
28
34
  "./client": {
29
35
  "types": "./imaplib/ImapClient.ts",
30
36
  "default": "./imaplib/ImapClient.js"
37
+ },
38
+ "./types": {
39
+ "types": "./imaplib/types.ts",
40
+ "default": "./imaplib/types.js"
41
+ },
42
+ "./gmail": {
43
+ "types": "./imaplib/gmail.ts",
44
+ "default": "./imaplib/gmail.js"
31
45
  }
32
46
  },
33
47
  "devDependencies": {
34
- "@types/node": "^24.1.0"
48
+ "@types/imapflow": "^1.0.23",
49
+ "@types/node": "^25.3.5"
35
50
  },
36
51
  "repository": {
37
52
  "type": "git",
@@ -40,5 +55,12 @@
40
55
  "bugs": {
41
56
  "url": "https://github.com/BobFrankston/iflow/issues"
42
57
  },
43
- "homepage": "https://github.com/BobFrankston/iflow#readme"
58
+ "homepage": "https://github.com/BobFrankston/iflow#readme",
59
+ "publishConfig": {
60
+ "access": "public"
61
+ },
62
+ ".dependencies": {
63
+ "@bobfrankston/oauthsupport": "file:../../../projects/OAuth/OauthSupport",
64
+ "imapflow": "^1.0.187"
65
+ }
44
66
  }
@@ -1,10 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(find:*)",
5
- "Bash(git init:*)",
6
- "WebFetch(domain:imapflow.com)"
7
- ],
8
- "deny": []
9
- }
10
- }
@@ -1 +0,0 @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;IAED,KAAK,CAAC,OAAO;QACT,IAAI,CAAC;YACD,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBACzB,MAAM,IAAI,CAAC,iBAAiB,CAAC;YACjC,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;gBACtB,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YAChC,CAAC;QACL,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,sBAAsB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YACnD,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;gBACrB,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACpC,CAAC;YACD,MAAM,GAAG,CAAC;QACd,CAAC;IACL,CAAC;CAyBJ"}
@@ -1,376 +0,0 @@
1
- // copilot: disable all suggestions related to testing frameworks like jest, mocha, etc.
2
- // copilot: do not include the return type for functions unless necessary
3
-
4
- import imapflow, { FetchQueryObject, ImapFlow, SearchObject, StatusObject } from 'imapflow';
5
- import { ImapClientConfig, FetchedMessage, FetchQuery } from './types.js';
6
- import { styleText } from 'util';
7
- // Removed dependencies on parent project - these should be passed in or handled differently
8
-
9
- // TODO: Create our own range object and allow a nosource flag
10
-
11
-
12
- export interface iFetchOptions {
13
- source: boolean;
14
- }
15
-
16
- const defaultFetchOptions: iFetchOptions = {
17
- source: true
18
- }
19
-
20
- export class ImapClient {
21
- private client: ImapFlow;
22
- private config: ImapClientConfig;
23
- private isDestroying: boolean = false;
24
- private connectionPromise: Promise<void> | null = null;
25
-
26
- constructor(cfg: ImapClientConfig) {
27
- this.config = cfg;
28
- this.init();
29
- }
30
-
31
- private init() {
32
- this.client = new ImapFlow({
33
- host: this.config.server,
34
- port: this.config.port,
35
- secure: true,
36
- auth: {
37
- user: this.config.username,
38
- pass: this.config.password
39
- },
40
- logger: false, // Disable internal logging
41
- });
42
-
43
- // Set up error handlers
44
- this.client.on('error', (err: any) => {
45
- console.error(`ImapFlow socket error: ${err.message}`);
46
- if (!this.isDestroying) {
47
- this.handleReconnection();
48
- }
49
- });
50
-
51
- this.client.on('close', () => {
52
- console.error(`ImapFlow connection closed`);
53
- if (!this.isDestroying) {
54
- this.handleReconnection();
55
- }
56
- });
57
- }
58
-
59
- private async handleReconnection() {
60
- if (this.connectionPromise) return; // Already reconnecting
61
-
62
- this.connectionPromise = new Promise(async (resolve) => {
63
- try {
64
- // Clean up old client
65
- this.cleanup();
66
-
67
- // Wait before reconnecting
68
- await new Promise(r => setTimeout(r, 1000));
69
-
70
- // Reinitialize
71
- this.init();
72
-
73
- try {
74
- await this.client.connect();
75
- console.log('Reconnected successfully');
76
- } catch (err) {
77
- console.error('Reconnection failed, will retry:', err);
78
- // Will trigger another reconnection attempt via error handler
79
- }
80
- } catch (err) {
81
- console.error('Error during reconnection process:', err);
82
- } finally {
83
- this.connectionPromise = null;
84
- resolve();
85
- }
86
- });
87
-
88
- return this.connectionPromise;
89
- }
90
-
91
- private cleanup() {
92
- if (this.client) {
93
- this.client.removeAllListeners('error');
94
- this.client.removeAllListeners('close');
95
- }
96
- }
97
-
98
- // Wrapper to ensure all operations handle connection errors
99
- private async withConnection<T>(operation: () => Promise<T>): Promise<T> {
100
- try {
101
- await this.connect();
102
- return await operation();
103
- } catch (err: any) {
104
- console.error(`Operation failed: ${err.message}`);
105
-
106
- // Check if it's a connection-related error
107
- if (err.code === 'ECONNRESET' || err.code === 'ENOTFOUND' ||
108
- err.code === 'ETIMEDOUT' || err.code === 'ECONNREFUSED' ||
109
- err.message.includes('connection') || err.message.includes('socket')) {
110
-
111
- if (!this.isDestroying) {
112
- console.log('Connection error detected, attempting reconnection...');
113
- await this.handleReconnection();
114
-
115
- // Retry the operation once after reconnection
116
- try {
117
- await this.connect();
118
- return await operation();
119
- } catch (retryErr) {
120
- console.error(`Operation failed after reconnection: ${retryErr}`);
121
- throw retryErr;
122
- }
123
- }
124
- }
125
-
126
- throw err;
127
- }
128
- }
129
-
130
- // https://imapflow.com/module-imapflow-ImapFlow.html
131
-
132
- // https://imapflow.com/module-imapflow-ImapFlow.html#search
133
-
134
- async getMessagesCount(mailbox: string): Promise<number> {
135
- return this.withConnection(async () => {
136
- const status: StatusObject = await this.client.status(mailbox, { messages: true });
137
- return status.messages;
138
- });
139
- }
140
-
141
- async fetchMessageByDate(
142
- mailbox: string,
143
- start: Date | number,
144
- endingx?: Date | number,
145
- options?: iFetchOptions) {
146
- try {
147
- options = {...defaultFetchOptions, ...options}; // Merge with default options
148
- await this.connect(); // Ensure connected
149
- const startTime = Date.now();
150
-
151
- const peek = true; // always peek for now
152
- await this.client.mailboxOpen(mailbox, { readOnly: peek });
153
-
154
- if (typeof start === 'number') start = new Date(start);
155
- if (endingx && typeof endingx === 'number') endingx = new Date(endingx);
156
- const ending = endingx as Date; // Hack for typescript typing
157
- const searchCriteria: SearchObject = endingx ? { since: start, before: ending } : { on: start }
158
-
159
- const fetchQuery: FetchQueryObject = {
160
- uid: true,
161
- envelope: true,
162
- flags: true,
163
- headers: true,
164
- source: options.source
165
- };
166
- const messageObjects = await this.client.fetchAll(searchCriteria, fetchQuery);
167
- // const messageObjects = await this.client.fetchAll(uids, fetchQuery);
168
- const messages = messageObjects.map(msg => new FetchedMessage(msg));
169
- // if (this.config.verbose) console.log(`Fetched ${messages.length} messages in ${Date.now() - startTime}ms`);
170
- return messages;
171
- } catch (error: any) {
172
- console.error(`Error fetching messages by date`, error);
173
- debugger;
174
- throw error; // rethrow to handle it outside
175
- } finally {
176
- await this.client.mailboxClose();
177
- }
178
- }
179
-
180
- async fetchMessages(
181
- mailbox: string,
182
- // start: number,
183
- end: number,
184
- count: number,
185
- options?: iFetchOptions
186
- ) {
187
- try {
188
- options = {...defaultFetchOptions, ...options}; // Merge with default options
189
- await this.connect(); // Ensure connected
190
- const peek = true; // always peek for now
191
- await this.client.mailboxOpen(mailbox, { readOnly: peek });
192
- let start = end - count + 1;
193
- const range = `${start}:${end}`;
194
- const startTime = Date.now();
195
-
196
- const fetchQuery: FetchQuery = {
197
- uid: true,
198
- envelope: true,
199
- flags: true,
200
- // bodyStructure: true,
201
- headers: true,
202
- source: options.source // Fetch the raw RFC822 message
203
- };
204
-
205
- const messageObjects = await this.client.fetchAll(range, fetchQuery);
206
- // Testing
207
- const messages = messageObjects.map(msg => new FetchedMessage(msg));
208
- // console.log(`Fetched ${messages.length} messages in ${Date.now() - startTime}ms`);
209
- return messages;
210
- }
211
- catch (error: any) {
212
- console.error(`Error fetching messages: ${error.message}`);
213
- debugger;
214
- throw error; // rethrow to handle it outside
215
- }
216
- finally {
217
- await this.client.mailboxClose();
218
- // await this.client.logout();
219
- }
220
- }
221
-
222
- // async moveMessage(uid: number, sourceMailbox: string, targetMailbox: string) {
223
- async moveMessage(msg: FetchedMessage, sourceMailbox: string, targetMailbox: string) {
224
- try {
225
- await this.connect(); // Ensure connected
226
- await this.client.mailboxOpen(sourceMailbox, { readOnly: false }); // Open the source mailbox in read-write mode
227
- const result = await this.client.messageMove([msg.uid], targetMailbox, { uid: true });
228
- if (result && !result.uidMap) {
229
- console.log(styleText(['red', 'bgBlack'],
230
- `iflow/iMapClient: NO uidMap: Failed to move message UID ${msg.uid} from ${sourceMailbox} to ${targetMailbox}`));
231
- return; // Treat as nonfatal
232
- }
233
- if (!result || !result.uidMap.has(msg.uid)) {
234
- debugger;
235
- throw new Error(`Message with UID ${msg.uid} was not moved.`);
236
- }
237
- } catch (error: any) {
238
- const ermsg = `iflow/iMapClient: Error moving message UID ${msg.uid}: ${error.message}`;
239
- console.log(styleText(['red', 'bgBlack'], ermsg));
240
- debugger;
241
- throw error;
242
- } finally {
243
- await this.client.mailboxClose();
244
- }
245
- }
246
-
247
- async getFolderList() {
248
- return this.withConnection(async () => {
249
- return await this.client.list();
250
- });
251
- }
252
-
253
- async getFolderTree() {
254
- return this.withConnection(async () => {
255
- return await this.client.listTree();
256
- });
257
- }
258
-
259
- getSpecialFolders(mailboxes: Awaited<ReturnType<ImapClient["getFolderList"]>>) {
260
- try {
261
- // await this.client.connect();
262
- const specialFolders = {
263
- inbox: null as string,
264
- trash: null as string,
265
- spam: null as string,
266
- sent: null as string,
267
- drafts: null as string,
268
- archive: null as string,
269
- junk: null as string,
270
- };
271
-
272
- for (const box of mailboxes) {
273
- // normalize flags/specialUse
274
- const rawFlags = Array.isArray(box.flags)
275
- ? box.flags
276
- : box.flags
277
- ? [box.flags]
278
- : [];
279
- const rawSpecial = Array.isArray(box.specialUse)
280
- ? box.specialUse
281
- : box.specialUse
282
- ? [box.specialUse]
283
- : [];
284
- const attrs = [...rawFlags, ...rawSpecial];
285
- const name = box.path;
286
-
287
- if (attrs.includes('\\Inbox') || name.toLowerCase() === 'inbox')
288
- specialFolders.inbox = name;
289
- if (attrs.includes('\\Trash'))
290
- specialFolders.trash = name;
291
- if (attrs.includes('\\Junk') || attrs.includes('\\Spam'))
292
- specialFolders.spam = name;
293
- if (attrs.includes('\\Sent'))
294
- specialFolders.sent = name;
295
- if (attrs.includes('\\Drafts'))
296
- specialFolders.drafts = name;
297
- if (attrs.includes('\\Archive'))
298
- specialFolders.archive = name;
299
- if (attrs.includes('\\Junk'))
300
- specialFolders.junk = name;
301
-
302
- // TODO: Figure out why trash isn't trash
303
- // specialFolders.trash = "TRASH"; // for dovcoat
304
- 7; // Place for breakpoints
305
- }
306
-
307
- return specialFolders;
308
- } catch (error: any) {
309
- console.error(`Error getting special folders: ${error.message}`);
310
- debugger;
311
- throw error;
312
- } finally {
313
- // await this.client.logout();
314
- }
315
- }
316
-
317
- async createmailbox(folder: string[] | string) {
318
- return this.withConnection(async () => {
319
- let info = await this.client.mailboxCreate(folder);
320
- console.log(`Created mailbox: ${info.path}`);
321
- return info;
322
- });
323
- }
324
-
325
- async logout() {
326
- this.isDestroying = true;
327
- this.cleanup();
328
- try {
329
- await this.client.logout();
330
- } catch (err: any) {
331
- // Ignore logout errors - connection might already be closed
332
- console.log(`Logout error (ignored): ${err.message}`);
333
- }
334
- }
335
-
336
- async connect() {
337
- try {
338
- if (this.connectionPromise) {
339
- await this.connectionPromise;
340
- }
341
- if (!this.client.usable) {
342
- await this.client.connect();
343
- }
344
- } catch (err: any) {
345
- console.error(`Connection failed: ${err.message}`);
346
- if (!this.isDestroying) {
347
- await this.handleReconnection();
348
- }
349
- throw err;
350
- }
351
- }
352
-
353
- // Getter to access underlying ImapFlow client for advanced operations
354
- // get imapFlowClient() {
355
- // if (!this.client) {
356
- // this.init();
357
- // }
358
- // return this.client;
359
- // }
360
-
361
- // static async run<T>(config: ImapClientConfig, f: () => Promise<T>) {
362
- // const imap = new ImapClient(config);
363
-
364
- // try {
365
- // await imap.connect();
366
- // return f();
367
- // }
368
- // catch (error: any) {
369
- // logerr(`Error in ImapClient run`, error);
370
- // debugger;
371
- // throw error;
372
- // } finally {
373
- // await imap.logout();
374
- // }
375
- // }
376
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAGhC,cAAM,SAAS,CAAC,CAAC;IACb,OAAO,CAAC,KAAK,CAA2B;IAExC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAMzB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,SAAS;CAGpC;AAED,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,qBAAqB,CAAC;AAE7D,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAgBD,MAAM,WAAW,UAAW,SAAQ,QAAQ,CAAC,gBAAgB;CAC5D;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC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