@browserflow-ai/exploration 0.0.6
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/dist/adapters/claude-cli.d.ts +57 -0
- package/dist/adapters/claude-cli.d.ts.map +1 -0
- package/dist/adapters/claude-cli.js +195 -0
- package/dist/adapters/claude-cli.js.map +1 -0
- package/dist/adapters/claude.d.ts +54 -0
- package/dist/adapters/claude.d.ts.map +1 -0
- package/dist/adapters/claude.js +160 -0
- package/dist/adapters/claude.js.map +1 -0
- package/dist/adapters/index.d.ts +6 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +4 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/types.d.ts +196 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/adapters/types.js +3 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/agent-browser-session.d.ts +62 -0
- package/dist/agent-browser-session.d.ts.map +1 -0
- package/dist/agent-browser-session.js +272 -0
- package/dist/agent-browser-session.js.map +1 -0
- package/dist/evidence.d.ts +111 -0
- package/dist/evidence.d.ts.map +1 -0
- package/dist/evidence.js +144 -0
- package/dist/evidence.js.map +1 -0
- package/dist/explorer.d.ts +180 -0
- package/dist/explorer.d.ts.map +1 -0
- package/dist/explorer.js +393 -0
- package/dist/explorer.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/locator-candidates.d.ts +127 -0
- package/dist/locator-candidates.d.ts.map +1 -0
- package/dist/locator-candidates.js +358 -0
- package/dist/locator-candidates.js.map +1 -0
- package/dist/step-executor.d.ts +99 -0
- package/dist/step-executor.d.ts.map +1 -0
- package/dist/step-executor.js +646 -0
- package/dist/step-executor.js.map +1 -0
- package/package.json +34 -0
- package/src/adapters/claude-cli.test.ts +134 -0
- package/src/adapters/claude-cli.ts +240 -0
- package/src/adapters/claude.test.ts +195 -0
- package/src/adapters/claude.ts +190 -0
- package/src/adapters/index.ts +21 -0
- package/src/adapters/types.ts +207 -0
- package/src/agent-browser-session.test.ts +369 -0
- package/src/agent-browser-session.ts +349 -0
- package/src/evidence.test.ts +239 -0
- package/src/evidence.ts +203 -0
- package/src/explorer.test.ts +321 -0
- package/src/explorer.ts +565 -0
- package/src/index.ts +51 -0
- package/src/locator-candidates.test.ts +602 -0
- package/src/locator-candidates.ts +441 -0
- package/src/step-executor.test.ts +696 -0
- package/src/step-executor.ts +783 -0
package/dist/evidence.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// @browserflow-ai/exploration - Evidence collection (screenshots and traces)
|
|
2
|
+
import { promises as fs } from 'fs';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
/**
|
|
5
|
+
* EvidenceCollector - Captures screenshots and traces during exploration
|
|
6
|
+
*
|
|
7
|
+
* Provides:
|
|
8
|
+
* - Screenshot capture (full page, clipped, masked)
|
|
9
|
+
* - Browser snapshot capture
|
|
10
|
+
* - Trace/HAR file generation
|
|
11
|
+
* - Evidence metadata tracking
|
|
12
|
+
*/
|
|
13
|
+
export class EvidenceCollector {
|
|
14
|
+
outputDir;
|
|
15
|
+
screenshotFormat;
|
|
16
|
+
screenshotQuality;
|
|
17
|
+
evidence = [];
|
|
18
|
+
sessions = new Map();
|
|
19
|
+
constructor(config = {}) {
|
|
20
|
+
this.outputDir = config.outputDir ?? './evidence';
|
|
21
|
+
this.screenshotFormat = config.screenshotFormat ?? 'png';
|
|
22
|
+
this.screenshotQuality = config.screenshotQuality ?? 90;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Register a browser session for screenshot capture
|
|
26
|
+
*
|
|
27
|
+
* @param sessionId - Unique identifier for the session
|
|
28
|
+
* @param session - Browser session instance
|
|
29
|
+
*/
|
|
30
|
+
registerSession(sessionId, session) {
|
|
31
|
+
this.sessions.set(sessionId, session);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Unregister a browser session
|
|
35
|
+
*
|
|
36
|
+
* @param sessionId - Session identifier to remove
|
|
37
|
+
*/
|
|
38
|
+
unregisterSession(sessionId) {
|
|
39
|
+
this.sessions.delete(sessionId);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Capture a screenshot from the browser session
|
|
43
|
+
*
|
|
44
|
+
* @param sessionId - Browser session ID
|
|
45
|
+
* @param name - Screenshot name/identifier
|
|
46
|
+
* @param options - Screenshot options
|
|
47
|
+
* @returns Promise resolving to screenshot file path
|
|
48
|
+
*/
|
|
49
|
+
async captureScreenshot(sessionId, name, options = {}) {
|
|
50
|
+
// Get browser session
|
|
51
|
+
const session = this.sessions.get(sessionId);
|
|
52
|
+
if (!session) {
|
|
53
|
+
throw new Error(`No browser session found: ${sessionId}`);
|
|
54
|
+
}
|
|
55
|
+
// Build file path
|
|
56
|
+
const filename = `${name}.${this.screenshotFormat}`;
|
|
57
|
+
const filepath = path.join(this.outputDir, 'screenshots', filename);
|
|
58
|
+
// Ensure directory exists
|
|
59
|
+
await fs.mkdir(path.dirname(filepath), { recursive: true });
|
|
60
|
+
// Capture screenshot from browser session
|
|
61
|
+
const buffer = await session.screenshot(options);
|
|
62
|
+
await fs.writeFile(filepath, buffer);
|
|
63
|
+
// Record metadata
|
|
64
|
+
const metadata = {
|
|
65
|
+
timestamp: new Date().toISOString(),
|
|
66
|
+
sessionId,
|
|
67
|
+
type: 'screenshot',
|
|
68
|
+
path: filepath,
|
|
69
|
+
};
|
|
70
|
+
this.evidence.push(metadata);
|
|
71
|
+
return filepath;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Capture a browser snapshot (DOM state with element refs)
|
|
75
|
+
*
|
|
76
|
+
* @param sessionId - Browser session ID
|
|
77
|
+
* @param name - Snapshot name/identifier
|
|
78
|
+
* @returns Promise resolving to snapshot data
|
|
79
|
+
*/
|
|
80
|
+
async captureSnapshot(sessionId, name) {
|
|
81
|
+
// TODO: Implement actual snapshot capture via agent-browser
|
|
82
|
+
const path = `${this.outputDir}/snapshots/${name}.json`;
|
|
83
|
+
const metadata = {
|
|
84
|
+
timestamp: new Date().toISOString(),
|
|
85
|
+
sessionId,
|
|
86
|
+
type: 'snapshot',
|
|
87
|
+
path,
|
|
88
|
+
};
|
|
89
|
+
this.evidence.push(metadata);
|
|
90
|
+
return { elements: [], path };
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Start trace recording
|
|
94
|
+
*
|
|
95
|
+
* @param sessionId - Browser session ID
|
|
96
|
+
* @param name - Trace name/identifier
|
|
97
|
+
*/
|
|
98
|
+
async startTrace(sessionId, name) {
|
|
99
|
+
// TODO: Implement trace recording via agent-browser
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Stop trace recording and save
|
|
103
|
+
*
|
|
104
|
+
* @param sessionId - Browser session ID
|
|
105
|
+
* @returns Promise resolving to trace file path
|
|
106
|
+
*/
|
|
107
|
+
async stopTrace(sessionId) {
|
|
108
|
+
// TODO: Implement trace recording via agent-browser
|
|
109
|
+
const path = `${this.outputDir}/traces/trace.zip`;
|
|
110
|
+
const metadata = {
|
|
111
|
+
timestamp: new Date().toISOString(),
|
|
112
|
+
sessionId,
|
|
113
|
+
type: 'trace',
|
|
114
|
+
path,
|
|
115
|
+
};
|
|
116
|
+
this.evidence.push(metadata);
|
|
117
|
+
return path;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Get all collected evidence metadata
|
|
121
|
+
*/
|
|
122
|
+
getEvidence() {
|
|
123
|
+
return [...this.evidence];
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Clear collected evidence metadata
|
|
127
|
+
*/
|
|
128
|
+
clearEvidence() {
|
|
129
|
+
this.evidence = [];
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Get the output directory
|
|
133
|
+
*/
|
|
134
|
+
getOutputDir() {
|
|
135
|
+
return this.outputDir;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Set the output directory
|
|
139
|
+
*/
|
|
140
|
+
setOutputDir(dir) {
|
|
141
|
+
this.outputDir = dir;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=evidence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence.js","sourceRoot":"","sources":["../src/evidence.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAiC7B;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAiB;IACpB,SAAS,CAAS;IAClB,gBAAgB,CAAiB;IACjC,iBAAiB,CAAS;IAC1B,QAAQ,GAAuB,EAAE,CAAC;IAClC,QAAQ,GAAgC,IAAI,GAAG,EAAE,CAAC;IAE1D,YAAY,SAAkC,EAAE;QAC9C,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,YAAY,CAAC;QAClD,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,IAAI,KAAK,CAAC;QACzD,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,IAAI,EAAE,CAAC;IAC1D,CAAC;IAED;;;;;OAKG;IACH,eAAe,CAAC,SAAiB,EAAE,OAAuB;QACxD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACH,iBAAiB,CAAC,SAAiB;QACjC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,iBAAiB,CACrB,SAAiB,EACjB,IAAY,EACZ,UAA6B,EAAE;QAE/B,sBAAsB;QACtB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SA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CAAC;QAC7B,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,UAAU,CAAC,SAAiB,EAAE,IAAY;QAC9C,oDAAoD;IACtD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,SAAS,CAAC,SAAiB;QAC/B,oDAAoD;QACpD,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,SAAS,mBAAmB,CAAC;QAElD,MAAM,QAAQ,GAAqB;YACjC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,SAAS;YACT,IAAI,EAAE,OAAO;YACb,IAAI;SACL,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,aAAa;QACX,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,GAAW;QACtB,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import type { AIAdapter, ExploreParams, ExplorationOutput, Spec, StepResult, EnhancedSnapshot } from './adapters/types';
|
|
2
|
+
import { StepExecutor } from './step-executor';
|
|
3
|
+
import { EvidenceCollector } from './evidence';
|
|
4
|
+
import { LocatorCandidateGenerator } from './locator-candidates';
|
|
5
|
+
/**
|
|
6
|
+
* Browser launch options
|
|
7
|
+
*/
|
|
8
|
+
export interface BrowserLaunchOptions {
|
|
9
|
+
headless?: boolean;
|
|
10
|
+
viewport?: {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Browser session interface - abstracts agent-browser integration
|
|
17
|
+
* Actual implementation will use agent-browser's BrowserManager
|
|
18
|
+
*/
|
|
19
|
+
export interface BrowserSession {
|
|
20
|
+
isLaunched(): boolean;
|
|
21
|
+
launch(options?: BrowserLaunchOptions): Promise<void>;
|
|
22
|
+
navigate(url: string): Promise<void>;
|
|
23
|
+
screenshot(options?: {
|
|
24
|
+
fullPage?: boolean;
|
|
25
|
+
clip?: {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
};
|
|
31
|
+
mask?: string[];
|
|
32
|
+
quality?: number;
|
|
33
|
+
}): Promise<Buffer>;
|
|
34
|
+
getSnapshot(options?: {
|
|
35
|
+
interactive?: boolean;
|
|
36
|
+
maxDepth?: number;
|
|
37
|
+
compact?: boolean;
|
|
38
|
+
selector?: string;
|
|
39
|
+
}): Promise<EnhancedSnapshot>;
|
|
40
|
+
close(): Promise<void>;
|
|
41
|
+
click?(ref: string): Promise<void>;
|
|
42
|
+
fill?(ref: string, value: string): Promise<void>;
|
|
43
|
+
type?(ref: string, text: string): Promise<void>;
|
|
44
|
+
select?(ref: string, option: string): Promise<void>;
|
|
45
|
+
check?(ref: string, checked: boolean): Promise<void>;
|
|
46
|
+
press?(key: string): Promise<void>;
|
|
47
|
+
back?(): Promise<void>;
|
|
48
|
+
forward?(): Promise<void>;
|
|
49
|
+
refresh?(): Promise<void>;
|
|
50
|
+
waitForSelector?(selector: string, timeout: number): Promise<void>;
|
|
51
|
+
waitForURL?(urlPattern: string, timeout: number): Promise<void>;
|
|
52
|
+
waitForText?(text: string, timeout: number): Promise<void>;
|
|
53
|
+
waitForLoadState?(state: 'load' | 'domcontentloaded' | 'networkidle'): Promise<void>;
|
|
54
|
+
waitForTimeout?(ms: number): Promise<void>;
|
|
55
|
+
scrollIntoView?(ref: string): Promise<void>;
|
|
56
|
+
scroll?(x: number, y: number): Promise<void>;
|
|
57
|
+
getCurrentURL?(): string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Configuration for the Explorer
|
|
61
|
+
*/
|
|
62
|
+
export interface ExplorerConfig {
|
|
63
|
+
adapter: AIAdapter;
|
|
64
|
+
browser?: BrowserSession;
|
|
65
|
+
outputDir?: string;
|
|
66
|
+
headless?: boolean;
|
|
67
|
+
viewport?: {
|
|
68
|
+
width: number;
|
|
69
|
+
height: number;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Explorer - Main orchestrator for AI-powered browser exploration
|
|
74
|
+
*
|
|
75
|
+
* Coordinates between:
|
|
76
|
+
* - AI adapter (Claude, OpenAI, etc.)
|
|
77
|
+
* - Step executor (runs individual steps)
|
|
78
|
+
* - Evidence collector (screenshots, traces)
|
|
79
|
+
* - Locator candidate generator (element selection strategies)
|
|
80
|
+
*/
|
|
81
|
+
export declare class Explorer {
|
|
82
|
+
private adapter;
|
|
83
|
+
private browser?;
|
|
84
|
+
private outputDir;
|
|
85
|
+
private headless;
|
|
86
|
+
private defaultViewport;
|
|
87
|
+
private stepExecutor;
|
|
88
|
+
private evidenceCollector;
|
|
89
|
+
private locatorGenerator;
|
|
90
|
+
constructor(config: ExplorerConfig);
|
|
91
|
+
/**
|
|
92
|
+
* Generate a unique exploration ID
|
|
93
|
+
*/
|
|
94
|
+
private generateExplorationId;
|
|
95
|
+
/**
|
|
96
|
+
* Run full exploration on a spec
|
|
97
|
+
*
|
|
98
|
+
* This is the main orchestration method that:
|
|
99
|
+
* 1. Launches browser
|
|
100
|
+
* 2. Navigates to starting page
|
|
101
|
+
* 3. Executes each step with evidence collection
|
|
102
|
+
* 4. Handles failures gracefully (continues on error)
|
|
103
|
+
* 5. Produces ExplorationOutput
|
|
104
|
+
*
|
|
105
|
+
* @param spec - The spec to explore
|
|
106
|
+
* @param baseUrl - Base URL for navigation
|
|
107
|
+
* @param options - Additional options
|
|
108
|
+
* @returns Promise resolving to exploration output
|
|
109
|
+
*/
|
|
110
|
+
runExploration(spec: Spec, baseUrl: string, options?: Partial<{
|
|
111
|
+
specPath: string;
|
|
112
|
+
viewport: {
|
|
113
|
+
width: number;
|
|
114
|
+
height: number;
|
|
115
|
+
};
|
|
116
|
+
headless: boolean;
|
|
117
|
+
}>): Promise<ExplorationOutput>;
|
|
118
|
+
/**
|
|
119
|
+
* Execute a single step with evidence collection (screenshots)
|
|
120
|
+
*/
|
|
121
|
+
private executeStepWithEvidence;
|
|
122
|
+
/**
|
|
123
|
+
* Execute a single action based on step type
|
|
124
|
+
*/
|
|
125
|
+
private executeAction;
|
|
126
|
+
/**
|
|
127
|
+
* Find element ref using AI adapter or direct selector/ref
|
|
128
|
+
*/
|
|
129
|
+
private findElementRef;
|
|
130
|
+
/**
|
|
131
|
+
* Run exploration on a spec
|
|
132
|
+
*
|
|
133
|
+
* @param spec - The spec to explore
|
|
134
|
+
* @param baseUrl - Base URL for the browser session
|
|
135
|
+
* @param options - Additional options
|
|
136
|
+
* @returns Promise resolving to exploration output
|
|
137
|
+
*/
|
|
138
|
+
explore(spec: Spec, baseUrl: string, options?: Partial<ExploreParams>): Promise<ExplorationOutput>;
|
|
139
|
+
/**
|
|
140
|
+
* Execute a single step manually (for testing/debugging)
|
|
141
|
+
*
|
|
142
|
+
* @param step - The step to execute
|
|
143
|
+
* @param stepIndex - Index of the step (default: 0)
|
|
144
|
+
* @returns Promise resolving to step result
|
|
145
|
+
*/
|
|
146
|
+
executeStep(step: Spec['steps'][number], stepIndex?: number): Promise<StepResult>;
|
|
147
|
+
/**
|
|
148
|
+
* Capture evidence (screenshot) at current state
|
|
149
|
+
*
|
|
150
|
+
* @param sessionId - Browser session ID
|
|
151
|
+
* @param name - Evidence name/identifier
|
|
152
|
+
* @returns Promise resolving to evidence file path
|
|
153
|
+
*/
|
|
154
|
+
captureEvidence(sessionId: string, name: string): Promise<string>;
|
|
155
|
+
/**
|
|
156
|
+
* Generate locator candidates for an element
|
|
157
|
+
*
|
|
158
|
+
* @param query - Natural language description of element
|
|
159
|
+
* @param snapshot - Browser snapshot with element refs
|
|
160
|
+
* @returns Promise resolving to ranked list of locator options
|
|
161
|
+
*/
|
|
162
|
+
generateLocators(query: string, snapshot: Record<string, unknown>): Promise<string[]>;
|
|
163
|
+
/**
|
|
164
|
+
* Get the configured AI adapter
|
|
165
|
+
*/
|
|
166
|
+
getAdapter(): AIAdapter;
|
|
167
|
+
/**
|
|
168
|
+
* Get the step executor instance
|
|
169
|
+
*/
|
|
170
|
+
getStepExecutor(): StepExecutor;
|
|
171
|
+
/**
|
|
172
|
+
* Get the evidence collector instance
|
|
173
|
+
*/
|
|
174
|
+
getEvidenceCollector(): EvidenceCollector;
|
|
175
|
+
/**
|
|
176
|
+
* Get the locator generator instance
|
|
177
|
+
*/
|
|
178
|
+
getLocatorGenerator(): LocatorCandidateGenerator;
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=explorer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explorer.d.ts","sourceRoot":"","sources":["../src/explorer.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,IAAI,EAEJ,UAAU,EAGV,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAGjE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9C;AAED;;;GAGG;AACH,MAAM,WA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