notebooklm-mcp-ultimate 2.2.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/LICENSE +21 -0
- package/README.md +420 -0
- package/dist/api/batch-execute-client.d.ts +232 -0
- package/dist/api/batch-execute-client.d.ts.map +1 -0
- package/dist/api/batch-execute-client.js +672 -0
- package/dist/api/batch-execute-client.js.map +1 -0
- package/dist/api/content-types.d.ts +44 -0
- package/dist/api/content-types.d.ts.map +1 -0
- package/dist/api/content-types.js +89 -0
- package/dist/api/content-types.js.map +1 -0
- package/dist/api/csrf-manager.d.ts +94 -0
- package/dist/api/csrf-manager.d.ts.map +1 -0
- package/dist/api/csrf-manager.js +178 -0
- package/dist/api/csrf-manager.js.map +1 -0
- package/dist/api/index.d.ts +27 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +56 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/operation-poller.d.ts +67 -0
- package/dist/api/operation-poller.d.ts.map +1 -0
- package/dist/api/operation-poller.js +132 -0
- package/dist/api/operation-poller.js.map +1 -0
- package/dist/api/request-builder.d.ts +196 -0
- package/dist/api/request-builder.d.ts.map +1 -0
- package/dist/api/request-builder.js +371 -0
- package/dist/api/request-builder.js.map +1 -0
- package/dist/api/response-parser.d.ts +124 -0
- package/dist/api/response-parser.d.ts.map +1 -0
- package/dist/api/response-parser.js +595 -0
- package/dist/api/response-parser.js.map +1 -0
- package/dist/api/rpc-ids.d.ts +92 -0
- package/dist/api/rpc-ids.d.ts.map +1 -0
- package/dist/api/rpc-ids.js +138 -0
- package/dist/api/rpc-ids.js.map +1 -0
- package/dist/api/streaming-chat-client.d.ts +50 -0
- package/dist/api/streaming-chat-client.d.ts.map +1 -0
- package/dist/api/streaming-chat-client.js +198 -0
- package/dist/api/streaming-chat-client.js.map +1 -0
- package/dist/api/types.d.ts +318 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +22 -0
- package/dist/api/types.js.map +1 -0
- package/dist/auth/auth-manager.d.ts +163 -0
- package/dist/auth/auth-manager.d.ts.map +1 -0
- package/dist/auth/auth-manager.js +1055 -0
- package/dist/auth/auth-manager.js.map +1 -0
- package/dist/auth/cookie-store.d.ts +121 -0
- package/dist/auth/cookie-store.d.ts.map +1 -0
- package/dist/auth/cookie-store.js +283 -0
- package/dist/auth/cookie-store.js.map +1 -0
- package/dist/config.d.ts +89 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +217 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +26 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +41 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +439 -0
- package/dist/index.js.map +1 -0
- package/dist/library/notebook-library.d.ts +79 -0
- package/dist/library/notebook-library.d.ts.map +1 -0
- package/dist/library/notebook-library.js +296 -0
- package/dist/library/notebook-library.js.map +1 -0
- package/dist/library/types.d.ts +67 -0
- package/dist/library/types.d.ts.map +1 -0
- package/dist/library/types.js +8 -0
- package/dist/library/types.js.map +1 -0
- package/dist/operations/content-operations.d.ts +78 -0
- package/dist/operations/content-operations.d.ts.map +1 -0
- package/dist/operations/content-operations.js +162 -0
- package/dist/operations/content-operations.js.map +1 -0
- package/dist/operations/hybrid-executor.d.ts +47 -0
- package/dist/operations/hybrid-executor.d.ts.map +1 -0
- package/dist/operations/hybrid-executor.js +114 -0
- package/dist/operations/hybrid-executor.js.map +1 -0
- package/dist/operations/notebook-crud-operations.d.ts +52 -0
- package/dist/operations/notebook-crud-operations.d.ts.map +1 -0
- package/dist/operations/notebook-crud-operations.js +248 -0
- package/dist/operations/notebook-crud-operations.js.map +1 -0
- package/dist/operations/research-operations.d.ts +42 -0
- package/dist/operations/research-operations.d.ts.map +1 -0
- package/dist/operations/research-operations.js +189 -0
- package/dist/operations/research-operations.js.map +1 -0
- package/dist/operations/source-operations.d.ts +59 -0
- package/dist/operations/source-operations.d.ts.map +1 -0
- package/dist/operations/source-operations.js +280 -0
- package/dist/operations/source-operations.js.map +1 -0
- package/dist/operations/studio-operations.d.ts +98 -0
- package/dist/operations/studio-operations.d.ts.map +1 -0
- package/dist/operations/studio-operations.js +309 -0
- package/dist/operations/studio-operations.js.map +1 -0
- package/dist/resources/resource-handlers.d.ts +22 -0
- package/dist/resources/resource-handlers.d.ts.map +1 -0
- package/dist/resources/resource-handlers.js +216 -0
- package/dist/resources/resource-handlers.js.map +1 -0
- package/dist/session/browser-session.d.ts +113 -0
- package/dist/session/browser-session.d.ts.map +1 -0
- package/dist/session/browser-session.js +670 -0
- package/dist/session/browser-session.js.map +1 -0
- package/dist/session/session-manager.d.ts +88 -0
- package/dist/session/session-manager.d.ts.map +1 -0
- package/dist/session/session-manager.js +314 -0
- package/dist/session/session-manager.js.map +1 -0
- package/dist/session/shared-context-manager.d.ts +107 -0
- package/dist/session/shared-context-manager.d.ts.map +1 -0
- package/dist/session/shared-context-manager.js +447 -0
- package/dist/session/shared-context-manager.js.map +1 -0
- package/dist/tools/definitions/ask-question.d.ts +8 -0
- package/dist/tools/definitions/ask-question.d.ts.map +1 -0
- package/dist/tools/definitions/ask-question.js +213 -0
- package/dist/tools/definitions/ask-question.js.map +1 -0
- package/dist/tools/definitions/content-generation.d.ts +52 -0
- package/dist/tools/definitions/content-generation.d.ts.map +1 -0
- package/dist/tools/definitions/content-generation.js +236 -0
- package/dist/tools/definitions/content-generation.js.map +1 -0
- package/dist/tools/definitions/notebook-crud.d.ts +9 -0
- package/dist/tools/definitions/notebook-crud.d.ts.map +1 -0
- package/dist/tools/definitions/notebook-crud.js +156 -0
- package/dist/tools/definitions/notebook-crud.js.map +1 -0
- package/dist/tools/definitions/notebook-management.d.ts +3 -0
- package/dist/tools/definitions/notebook-management.d.ts.map +1 -0
- package/dist/tools/definitions/notebook-management.js +243 -0
- package/dist/tools/definitions/notebook-management.js.map +1 -0
- package/dist/tools/definitions/research.d.ts +23 -0
- package/dist/tools/definitions/research.d.ts.map +1 -0
- package/dist/tools/definitions/research.js +108 -0
- package/dist/tools/definitions/research.js.map +1 -0
- package/dist/tools/definitions/session-management.d.ts +3 -0
- package/dist/tools/definitions/session-management.d.ts.map +1 -0
- package/dist/tools/definitions/session-management.js +41 -0
- package/dist/tools/definitions/session-management.js.map +1 -0
- package/dist/tools/definitions/source-management.d.ts +39 -0
- package/dist/tools/definitions/source-management.d.ts.map +1 -0
- package/dist/tools/definitions/source-management.js +224 -0
- package/dist/tools/definitions/source-management.js.map +1 -0
- package/dist/tools/definitions/studio.d.ts +36 -0
- package/dist/tools/definitions/studio.d.ts.map +1 -0
- package/dist/tools/definitions/studio.js +153 -0
- package/dist/tools/definitions/studio.js.map +1 -0
- package/dist/tools/definitions/system.d.ts +3 -0
- package/dist/tools/definitions/system.d.ts.map +1 -0
- package/dist/tools/definitions/system.js +143 -0
- package/dist/tools/definitions/system.js.map +1 -0
- package/dist/tools/definitions.d.ts +12 -0
- package/dist/tools/definitions.d.ts.map +1 -0
- package/dist/tools/definitions.js +36 -0
- package/dist/tools/definitions.js.map +1 -0
- package/dist/tools/handlers/content-handlers.d.ts +287 -0
- package/dist/tools/handlers/content-handlers.d.ts.map +1 -0
- package/dist/tools/handlers/content-handlers.js +244 -0
- package/dist/tools/handlers/content-handlers.js.map +1 -0
- package/dist/tools/handlers/notebook-crud-handlers.d.ts +69 -0
- package/dist/tools/handlers/notebook-crud-handlers.d.ts.map +1 -0
- package/dist/tools/handlers/notebook-crud-handlers.js +117 -0
- package/dist/tools/handlers/notebook-crud-handlers.js.map +1 -0
- package/dist/tools/handlers/research-handlers.d.ts +37 -0
- package/dist/tools/handlers/research-handlers.d.ts.map +1 -0
- package/dist/tools/handlers/research-handlers.js +87 -0
- package/dist/tools/handlers/research-handlers.js.map +1 -0
- package/dist/tools/handlers/source-handlers.d.ts +52 -0
- package/dist/tools/handlers/source-handlers.d.ts.map +1 -0
- package/dist/tools/handlers/source-handlers.js +177 -0
- package/dist/tools/handlers/source-handlers.js.map +1 -0
- package/dist/tools/handlers/studio-handlers.d.ts +125 -0
- package/dist/tools/handlers/studio-handlers.d.ts.map +1 -0
- package/dist/tools/handlers/studio-handlers.js +183 -0
- package/dist/tools/handlers/studio-handlers.js.map +1 -0
- package/dist/tools/handlers.d.ts +629 -0
- package/dist/tools/handlers.d.ts.map +1 -0
- package/dist/tools/handlers.js +833 -0
- package/dist/tools/handlers.js.map +1 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +8 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/types.d.ts +82 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/cleanup-manager.d.ts +133 -0
- package/dist/utils/cleanup-manager.d.ts.map +1 -0
- package/dist/utils/cleanup-manager.js +673 -0
- package/dist/utils/cleanup-manager.js.map +1 -0
- package/dist/utils/cli-handler.d.ts +16 -0
- package/dist/utils/cli-handler.d.ts.map +1 -0
- package/dist/utils/cli-handler.js +102 -0
- package/dist/utils/cli-handler.js.map +1 -0
- package/dist/utils/logger.d.ts +61 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +92 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/page-utils.d.ts +54 -0
- package/dist/utils/page-utils.d.ts.map +1 -0
- package/dist/utils/page-utils.js +405 -0
- package/dist/utils/page-utils.js.map +1 -0
- package/dist/utils/settings-manager.d.ts +37 -0
- package/dist/utils/settings-manager.d.ts.map +1 -0
- package/dist/utils/settings-manager.js +120 -0
- package/dist/utils/settings-manager.js.map +1 -0
- package/dist/utils/stealth-utils.d.ts +135 -0
- package/dist/utils/stealth-utils.d.ts.map +1 -0
- package/dist/utils/stealth-utils.js +398 -0
- package/dist/utils/stealth-utils.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hybrid Executor
|
|
3
|
+
*
|
|
4
|
+
* Provides API-first execution with browser fallback for improved reliability.
|
|
5
|
+
* This is a simplified version focusing on core retry and fallback logic.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Options for hybrid execution
|
|
9
|
+
*/
|
|
10
|
+
export interface HybridExecutionOptions {
|
|
11
|
+
/** Maximum number of retries for API operation */
|
|
12
|
+
maxRetries?: number;
|
|
13
|
+
/** Initial retry delay in milliseconds */
|
|
14
|
+
retryDelay?: number;
|
|
15
|
+
/** Whether to use exponential backoff */
|
|
16
|
+
exponentialBackoff?: boolean;
|
|
17
|
+
/** Timeout for each operation in milliseconds */
|
|
18
|
+
timeout?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Result of hybrid execution
|
|
22
|
+
*/
|
|
23
|
+
export interface HybridExecutionResult<T> {
|
|
24
|
+
success: boolean;
|
|
25
|
+
data?: T;
|
|
26
|
+
error?: string;
|
|
27
|
+
executionMethod: 'api' | 'browser' | 'failed';
|
|
28
|
+
retriesUsed: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Execute with API-first strategy and browser fallback
|
|
32
|
+
*
|
|
33
|
+
* @param apiOperation - Primary API operation to execute
|
|
34
|
+
* @param browserOperation - Fallback browser operation (optional)
|
|
35
|
+
* @param options - Execution options
|
|
36
|
+
* @returns Hybrid execution result
|
|
37
|
+
*/
|
|
38
|
+
export declare function executeWithFallback<T>(apiOperation: () => Promise<T>, browserOperation?: () => Promise<T>, options?: HybridExecutionOptions): Promise<HybridExecutionResult<T>>;
|
|
39
|
+
/**
|
|
40
|
+
* Execute API operation with retry logic only (no browser fallback)
|
|
41
|
+
*
|
|
42
|
+
* @param operation - API operation to execute
|
|
43
|
+
* @param options - Execution options
|
|
44
|
+
* @returns Execution result
|
|
45
|
+
*/
|
|
46
|
+
export declare function executeWithRetry<T>(operation: () => Promise<T>, options?: HybridExecutionOptions): Promise<HybridExecutionResult<T>>;
|
|
47
|
+
//# sourceMappingURL=hybrid-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hybrid-executor.d.ts","sourceRoot":"","sources":["../../src/operations/hybrid-executor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,KAAK,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC9C,WAAW,EAAE,MAAM,CAAC;CACvB;AAkCD;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,EACvC,YAAY,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC9B,gBAAgB,CAAC,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACnC,OAAO,GAAE,sBAA2B,GACrC,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAuEnC;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACpC,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,OAAO,GAAE,sBAA2B,GACrC,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAEnC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hybrid Executor
|
|
3
|
+
*
|
|
4
|
+
* Provides API-first execution with browser fallback for improved reliability.
|
|
5
|
+
* This is a simplified version focusing on core retry and fallback logic.
|
|
6
|
+
*/
|
|
7
|
+
import { log } from '../utils/logger.js';
|
|
8
|
+
/**
|
|
9
|
+
* Default options
|
|
10
|
+
*/
|
|
11
|
+
const DEFAULT_OPTIONS = {
|
|
12
|
+
maxRetries: 3,
|
|
13
|
+
retryDelay: 1000,
|
|
14
|
+
exponentialBackoff: true,
|
|
15
|
+
timeout: 30000,
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Sleep for specified milliseconds
|
|
19
|
+
*/
|
|
20
|
+
function sleep(ms) {
|
|
21
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Execute operation with timeout
|
|
25
|
+
*/
|
|
26
|
+
async function withTimeout(operation, timeoutMs) {
|
|
27
|
+
return Promise.race([
|
|
28
|
+
operation(),
|
|
29
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error('Operation timeout')), timeoutMs)),
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Execute with API-first strategy and browser fallback
|
|
34
|
+
*
|
|
35
|
+
* @param apiOperation - Primary API operation to execute
|
|
36
|
+
* @param browserOperation - Fallback browser operation (optional)
|
|
37
|
+
* @param options - Execution options
|
|
38
|
+
* @returns Hybrid execution result
|
|
39
|
+
*/
|
|
40
|
+
export async function executeWithFallback(apiOperation, browserOperation, options = {}) {
|
|
41
|
+
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
42
|
+
let retriesUsed = 0;
|
|
43
|
+
let lastError;
|
|
44
|
+
// Try API operation with retries
|
|
45
|
+
for (let attempt = 0; attempt <= opts.maxRetries; attempt++) {
|
|
46
|
+
try {
|
|
47
|
+
log.info(`🔄 Attempting API operation (attempt ${attempt + 1}/${opts.maxRetries + 1})`);
|
|
48
|
+
const result = await withTimeout(apiOperation, opts.timeout);
|
|
49
|
+
log.success(`✅ API operation succeeded on attempt ${attempt + 1}`);
|
|
50
|
+
return {
|
|
51
|
+
success: true,
|
|
52
|
+
data: result,
|
|
53
|
+
executionMethod: 'api',
|
|
54
|
+
retriesUsed: attempt,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
59
|
+
retriesUsed = attempt;
|
|
60
|
+
if (attempt < opts.maxRetries) {
|
|
61
|
+
const delay = opts.exponentialBackoff
|
|
62
|
+
? opts.retryDelay * Math.pow(2, attempt)
|
|
63
|
+
: opts.retryDelay;
|
|
64
|
+
log.warning(`⚠️ API attempt ${attempt + 1} failed: ${lastError.message}. Retrying in ${delay}ms...`);
|
|
65
|
+
await sleep(delay);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
log.error(`❌ API operation failed after ${attempt + 1} attempts`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// If browser operation is provided, try it as fallback
|
|
73
|
+
if (browserOperation) {
|
|
74
|
+
try {
|
|
75
|
+
log.info('🌐 Falling back to browser operation...');
|
|
76
|
+
const result = await withTimeout(browserOperation, opts.timeout);
|
|
77
|
+
log.success('✅ Browser operation succeeded');
|
|
78
|
+
return {
|
|
79
|
+
success: true,
|
|
80
|
+
data: result,
|
|
81
|
+
executionMethod: 'browser',
|
|
82
|
+
retriesUsed,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
const browserError = error instanceof Error ? error : new Error(String(error));
|
|
87
|
+
log.error(`❌ Browser operation also failed: ${browserError.message}`);
|
|
88
|
+
return {
|
|
89
|
+
success: false,
|
|
90
|
+
error: `Both API and browser operations failed. Last API error: ${lastError?.message}. Browser error: ${browserError.message}`,
|
|
91
|
+
executionMethod: 'failed',
|
|
92
|
+
retriesUsed,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// No browser fallback available
|
|
97
|
+
return {
|
|
98
|
+
success: false,
|
|
99
|
+
error: `API operation failed after ${retriesUsed + 1} attempts: ${lastError?.message}`,
|
|
100
|
+
executionMethod: 'failed',
|
|
101
|
+
retriesUsed,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Execute API operation with retry logic only (no browser fallback)
|
|
106
|
+
*
|
|
107
|
+
* @param operation - API operation to execute
|
|
108
|
+
* @param options - Execution options
|
|
109
|
+
* @returns Execution result
|
|
110
|
+
*/
|
|
111
|
+
export async function executeWithRetry(operation, options = {}) {
|
|
112
|
+
return executeWithFallback(operation, undefined, options);
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=hybrid-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hybrid-executor.js","sourceRoot":"","sources":["../../src/operations/hybrid-executor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AA2BzC;;GAEG;AACH,MAAM,eAAe,GAAqC;IACtD,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,IAAI;IAChB,kBAAkB,EAAE,IAAI;IACxB,OAAO,EAAE,KAAK;CACjB,CAAC;AAEF;;GAEG;AACH,SAAS,KAAK,CAAC,EAAU;IACrB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,WAAW,CACtB,SAA2B,EAC3B,SAAiB;IAEjB,OAAO,OAAO,CAAC,IAAI,CAAC;QAChB,SAAS,EAAE;QACX,IAAI,OAAO,CAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CACzB,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,EAAE,SAAS,CAAC,CACtE;KACJ,CAAC,CAAC;AACP,CAAC;AAED;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AAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAClC,SAA2B,EAC3B,UAAkC,EAAE;IAEpC,OAAO,mBAAmB,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notebook CRUD Operations for NotebookLM
|
|
3
|
+
*
|
|
4
|
+
* Provides high-level operations for creating and renaming notebooks
|
|
5
|
+
* directly via the NotebookLM API (not browser automation).
|
|
6
|
+
*
|
|
7
|
+
* Supported operations:
|
|
8
|
+
* - Create notebook
|
|
9
|
+
* - Rename notebook (remote)
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Result of a notebook CRUD operation
|
|
13
|
+
*/
|
|
14
|
+
export interface NotebookCRUDResult {
|
|
15
|
+
success: boolean;
|
|
16
|
+
notebookId?: string;
|
|
17
|
+
title?: string;
|
|
18
|
+
error?: string;
|
|
19
|
+
url?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create a new notebook in NotebookLM
|
|
23
|
+
*
|
|
24
|
+
* @param title - Optional title for the notebook (defaults to "Untitled notebook")
|
|
25
|
+
* @returns Result with notebook ID and URL
|
|
26
|
+
*/
|
|
27
|
+
export declare function createNotebook(title?: string): Promise<NotebookCRUDResult>;
|
|
28
|
+
/**
|
|
29
|
+
* Rename a notebook in NotebookLM
|
|
30
|
+
*
|
|
31
|
+
* @param notebookId - The notebook ID to rename
|
|
32
|
+
* @param newTitle - The new title for the notebook
|
|
33
|
+
* @returns Result indicating success or failure
|
|
34
|
+
*/
|
|
35
|
+
export declare function renameNotebook(notebookId: string, newTitle: string): Promise<NotebookCRUDResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Delete a notebook in NotebookLM
|
|
38
|
+
*
|
|
39
|
+
* @param notebookId - The notebook ID to delete
|
|
40
|
+
* @returns Result indicating success or failure
|
|
41
|
+
*/
|
|
42
|
+
export declare function deleteNotebookRemote(notebookId: string): Promise<NotebookCRUDResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Upload a file source to a notebook via browser automation
|
|
45
|
+
* Supports PDF, docs, images, audio files
|
|
46
|
+
*
|
|
47
|
+
* @param notebookId - The notebook ID to add source to
|
|
48
|
+
* @param filePath - Absolute path to the file to upload
|
|
49
|
+
* @returns Result with upload status
|
|
50
|
+
*/
|
|
51
|
+
export declare function addFileSource(notebookId: string, filePath: string): Promise<NotebookCRUDResult>;
|
|
52
|
+
//# sourceMappingURL=notebook-crud-operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notebook-crud-operations.d.ts","sourceRoot":"","sources":["../../src/operations/notebook-crud-operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAkBH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAuBD;;;;;GAKG;AACH,wBAAsB,cAAc,CAChC,KAAK,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,kBAAkB,CAAC,CAqC7B;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAChC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,kBAAkB,CAAC,CA6C7B;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACtC,UAAU,EAAE,MAAM,GACnB,OAAO,CAAC,kBAAkB,CAAC,CAwC7B;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAC/B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,kBAAkB,CAAC,CAgF7B"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notebook CRUD Operations for NotebookLM
|
|
3
|
+
*
|
|
4
|
+
* Provides high-level operations for creating and renaming notebooks
|
|
5
|
+
* directly via the NotebookLM API (not browser automation).
|
|
6
|
+
*
|
|
7
|
+
* Supported operations:
|
|
8
|
+
* - Create notebook
|
|
9
|
+
* - Rename notebook (remote)
|
|
10
|
+
*/
|
|
11
|
+
import { getAPIClient } from '../api/index.js';
|
|
12
|
+
import { initializeAPIClientWithCookies } from '../auth/cookie-store.js';
|
|
13
|
+
import { log } from '../utils/logger.js';
|
|
14
|
+
import { chromium } from 'patchright';
|
|
15
|
+
import { AuthManager } from '../auth/auth-manager.js';
|
|
16
|
+
import * as fs from 'fs';
|
|
17
|
+
import * as path from 'path';
|
|
18
|
+
/** Validates notebook ID format (basic non-empty check) */
|
|
19
|
+
function validateNotebookId(notebookId) {
|
|
20
|
+
if (!notebookId || typeof notebookId !== 'string' || !notebookId.trim()) {
|
|
21
|
+
return 'Notebook ID is required';
|
|
22
|
+
}
|
|
23
|
+
return null; // Valid
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get an initialized API client
|
|
27
|
+
*/
|
|
28
|
+
async function getInitializedClient() {
|
|
29
|
+
const client = getAPIClient();
|
|
30
|
+
// Check if already initialized
|
|
31
|
+
if (client.hasValidAuth()) {
|
|
32
|
+
return client;
|
|
33
|
+
}
|
|
34
|
+
// Try to initialize from cookie store
|
|
35
|
+
const success = await initializeAPIClientWithCookies(client);
|
|
36
|
+
if (!success) {
|
|
37
|
+
log.warning('API client not initialized. Please run setup_auth.');
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return client;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create a new notebook in NotebookLM
|
|
44
|
+
*
|
|
45
|
+
* @param title - Optional title for the notebook (defaults to "Untitled notebook")
|
|
46
|
+
* @returns Result with notebook ID and URL
|
|
47
|
+
*/
|
|
48
|
+
export async function createNotebook(title) {
|
|
49
|
+
const client = await getInitializedClient();
|
|
50
|
+
if (!client) {
|
|
51
|
+
return {
|
|
52
|
+
success: false,
|
|
53
|
+
error: 'API client not initialized. Please run setup_auth first.',
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
log.info(`Creating notebook${title ? `: ${title}` : ''}...`);
|
|
58
|
+
const notebookId = await client.createNotebook(title);
|
|
59
|
+
if (!notebookId) {
|
|
60
|
+
return {
|
|
61
|
+
success: false,
|
|
62
|
+
error: 'Failed to create notebook - no ID returned',
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const url = `https://notebooklm.google.com/notebook/${notebookId}`;
|
|
66
|
+
log.success(`Notebook created: ${notebookId}`);
|
|
67
|
+
return {
|
|
68
|
+
success: true,
|
|
69
|
+
notebookId,
|
|
70
|
+
title: title || 'Untitled notebook',
|
|
71
|
+
url,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
return {
|
|
76
|
+
success: false,
|
|
77
|
+
error: `Failed to create notebook: ${error}`,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Rename a notebook in NotebookLM
|
|
83
|
+
*
|
|
84
|
+
* @param notebookId - The notebook ID to rename
|
|
85
|
+
* @param newTitle - The new title for the notebook
|
|
86
|
+
* @returns Result indicating success or failure
|
|
87
|
+
*/
|
|
88
|
+
export async function renameNotebook(notebookId, newTitle) {
|
|
89
|
+
const idError = validateNotebookId(notebookId);
|
|
90
|
+
if (idError) {
|
|
91
|
+
return { success: false, error: idError, notebookId };
|
|
92
|
+
}
|
|
93
|
+
if (!newTitle || typeof newTitle !== 'string' || !newTitle.trim()) {
|
|
94
|
+
return { success: false, error: 'New title is required and must be non-empty', notebookId };
|
|
95
|
+
}
|
|
96
|
+
const client = await getInitializedClient();
|
|
97
|
+
if (!client) {
|
|
98
|
+
return {
|
|
99
|
+
success: false,
|
|
100
|
+
error: 'API client not initialized. Please run setup_auth first.',
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
log.info(`Renaming notebook ${notebookId} to "${newTitle}"...`);
|
|
105
|
+
const success = await client.renameNotebook(notebookId, newTitle);
|
|
106
|
+
if (!success) {
|
|
107
|
+
return {
|
|
108
|
+
success: false,
|
|
109
|
+
error: 'Failed to rename notebook',
|
|
110
|
+
notebookId,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
log.success(`Notebook renamed to: ${newTitle}`);
|
|
114
|
+
return {
|
|
115
|
+
success: true,
|
|
116
|
+
notebookId,
|
|
117
|
+
title: newTitle,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
return {
|
|
122
|
+
success: false,
|
|
123
|
+
error: `Failed to rename notebook: ${error}`,
|
|
124
|
+
notebookId,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Delete a notebook in NotebookLM
|
|
130
|
+
*
|
|
131
|
+
* @param notebookId - The notebook ID to delete
|
|
132
|
+
* @returns Result indicating success or failure
|
|
133
|
+
*/
|
|
134
|
+
export async function deleteNotebookRemote(notebookId) {
|
|
135
|
+
const idError = validateNotebookId(notebookId);
|
|
136
|
+
if (idError) {
|
|
137
|
+
return { success: false, error: idError, notebookId };
|
|
138
|
+
}
|
|
139
|
+
const client = await getInitializedClient();
|
|
140
|
+
if (!client) {
|
|
141
|
+
return {
|
|
142
|
+
success: false,
|
|
143
|
+
error: 'API client not initialized. Please run setup_auth first.',
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
try {
|
|
147
|
+
log.info(`Deleting notebook ${notebookId}...`);
|
|
148
|
+
const success = await client.deleteNotebook(notebookId);
|
|
149
|
+
if (!success) {
|
|
150
|
+
return {
|
|
151
|
+
success: false,
|
|
152
|
+
error: 'Failed to delete notebook',
|
|
153
|
+
notebookId,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
log.success(`Notebook deleted: ${notebookId}`);
|
|
157
|
+
return {
|
|
158
|
+
success: true,
|
|
159
|
+
notebookId,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
return {
|
|
164
|
+
success: false,
|
|
165
|
+
error: `Failed to delete notebook: ${error}`,
|
|
166
|
+
notebookId,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Upload a file source to a notebook via browser automation
|
|
172
|
+
* Supports PDF, docs, images, audio files
|
|
173
|
+
*
|
|
174
|
+
* @param notebookId - The notebook ID to add source to
|
|
175
|
+
* @param filePath - Absolute path to the file to upload
|
|
176
|
+
* @returns Result with upload status
|
|
177
|
+
*/
|
|
178
|
+
export async function addFileSource(notebookId, filePath) {
|
|
179
|
+
const idError = validateNotebookId(notebookId);
|
|
180
|
+
if (idError) {
|
|
181
|
+
return { success: false, error: idError, notebookId };
|
|
182
|
+
}
|
|
183
|
+
// Validate path is absolute and not traversing
|
|
184
|
+
if (!path.isAbsolute(filePath)) {
|
|
185
|
+
return { success: false, error: 'File path must be absolute', notebookId };
|
|
186
|
+
}
|
|
187
|
+
const normalizedPath = path.normalize(filePath);
|
|
188
|
+
if (normalizedPath !== filePath || filePath.includes('..')) {
|
|
189
|
+
return { success: false, error: 'Invalid file path (path traversal not allowed)', notebookId };
|
|
190
|
+
}
|
|
191
|
+
// Validate file exists
|
|
192
|
+
if (!fs.existsSync(filePath)) {
|
|
193
|
+
return {
|
|
194
|
+
success: false,
|
|
195
|
+
error: `File not found: ${filePath}`,
|
|
196
|
+
notebookId,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
const authManager = new AuthManager();
|
|
200
|
+
const statePath = await authManager.getValidStatePath();
|
|
201
|
+
if (!statePath) {
|
|
202
|
+
return {
|
|
203
|
+
success: false,
|
|
204
|
+
error: 'Not authenticated. Please run setup_auth first.',
|
|
205
|
+
notebookId,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
let browser;
|
|
209
|
+
try {
|
|
210
|
+
log.info(`Uploading file to notebook ${notebookId}: ${path.basename(filePath)}`);
|
|
211
|
+
// Launch browser with saved state
|
|
212
|
+
browser = await chromium.launch({ headless: true });
|
|
213
|
+
const context = await browser.newContext({ storageState: statePath });
|
|
214
|
+
const page = await context.newPage();
|
|
215
|
+
// Navigate to notebook
|
|
216
|
+
const notebookUrl = `https://notebooklm.google.com/notebook/${notebookId}`;
|
|
217
|
+
await page.goto(notebookUrl, { waitUntil: 'networkidle', timeout: 30000 });
|
|
218
|
+
// Click "Add sources" button
|
|
219
|
+
await page.click('button:has-text("Add sources")', { timeout: 10000 });
|
|
220
|
+
await page.waitForTimeout(1000);
|
|
221
|
+
// Click "Upload files" button in dialog
|
|
222
|
+
await page.click('button:has-text("Upload files")', { timeout: 10000 });
|
|
223
|
+
// Wait for file input and set file
|
|
224
|
+
const fileInput = await page.waitForSelector('input[type="file"]', { timeout: 10000 });
|
|
225
|
+
await fileInput.setInputFiles(filePath);
|
|
226
|
+
// Wait for upload to complete (source appears in list)
|
|
227
|
+
await page.waitForSelector('.source-item, [class*="source"]', { timeout: 60000 });
|
|
228
|
+
log.success(`File uploaded: ${path.basename(filePath)}`);
|
|
229
|
+
return {
|
|
230
|
+
success: true,
|
|
231
|
+
notebookId,
|
|
232
|
+
title: path.basename(filePath),
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
catch (error) {
|
|
236
|
+
return {
|
|
237
|
+
success: false,
|
|
238
|
+
error: `Failed to upload file: ${error}`,
|
|
239
|
+
notebookId,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
finally {
|
|
243
|
+
if (browser) {
|
|
244
|
+
await browser.close();
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=notebook-crud-operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notebook-crud-operations.js","sourceRoot":"","sources":["../../src/operations/notebook-crud-operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAA4B,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,2DAA2D;AAC3D,SAAS,kBAAkB,CAAC,UAAkB;IAC1C,IAAI,CAAC,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC;QACtE,OAAO,yBAAyB,CAAC;IACrC,CAAC;IACD,OAAO,IAAI,CAAC,CAAC,QAAQ;AACzB,CAAC;AAaD;;GAEG;AACH,KAAK,UAAU,oBAAoB;IAC/B,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAE9B,+BAA+B;IAC/B,IAAI,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,sCAAsC;IACtC,MAAM,OAAO,GAAG,MAAM,8BAA8B,CAAC,MAAM,CAAC,CAAC;IAC7D,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,GAAG,CAAC,OAAO,CAAC,oDAAoD,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAChC,KAAc;IAEd,MAAM,MAAM,GAAG,MAAM,oBAAoB,EAAE,CAAC;IAC5C,IAAI,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wCAAwC;QACxC,MAAM,IAAI,CAAC,KAAK,CAAC,iCAAiC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QAExE,mCAAmC;QACnC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,oBAAoB,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QACvF,MAAM,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAExC,uDAAuD;QACvD,MAAM,IAAI,CAAC,eAAe,CAAC,iCAAiC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QAElF,GAAG,CAAC,OAAO,CAAC,kBAAkB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAEzD,OAAO;YACH,OAAO,EAAE,IAAI;YACb,UAAU;YACV,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;SACjC,CAAC;IACN,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO;YACH,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,0BAA0B,KAAK,EAAE;YACxC,UAAU;SACb,CAAC;IACN,CAAC;YAAS,CAAC;QACP,IAAI,OAAO,EAAE,CAAC;YACV,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QAC1B,CAAC;IACL,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Research Operations for NotebookLM
|
|
3
|
+
*
|
|
4
|
+
* Provides research and source discovery operations.
|
|
5
|
+
*
|
|
6
|
+
* Note: NotebookLM API doesn't have native research/discovery endpoints,
|
|
7
|
+
* so these operations provide suggestions and workflows rather than
|
|
8
|
+
* actual web search functionality.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Result of a research operation
|
|
12
|
+
*/
|
|
13
|
+
export interface ResearchOperationResult {
|
|
14
|
+
success: boolean;
|
|
15
|
+
suggestions?: string[];
|
|
16
|
+
sources?: string[];
|
|
17
|
+
message?: string;
|
|
18
|
+
error?: string;
|
|
19
|
+
notebookId?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Discover potential sources for a topic
|
|
23
|
+
*
|
|
24
|
+
* Returns search query suggestions and recommended source types.
|
|
25
|
+
* Users can then manually search and use import_source to add them.
|
|
26
|
+
*/
|
|
27
|
+
export declare function discoverSources(topic: string, notebookId?: string): Promise<ResearchOperationResult>;
|
|
28
|
+
/**
|
|
29
|
+
* Import a source URL into a notebook
|
|
30
|
+
*
|
|
31
|
+
* Validates the URL and adds it as a source.
|
|
32
|
+
* This is a wrapper around addURLSource with additional validation.
|
|
33
|
+
*/
|
|
34
|
+
export declare function importSource(url: string, notebookId: string): Promise<ResearchOperationResult>;
|
|
35
|
+
/**
|
|
36
|
+
* Research a topic and optionally import sources
|
|
37
|
+
*
|
|
38
|
+
* Combines discovery and import in a single workflow.
|
|
39
|
+
* If autoImport is true, attempts to import suggested sources.
|
|
40
|
+
*/
|
|
41
|
+
export declare function researchTopic(topic: string, notebookId: string, autoImport?: boolean): Promise<ResearchOperationResult>;
|
|
42
|
+
//# sourceMappingURL=research-operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"research-operations.d.ts","sourceRoot":"","sources":["../../src/operations/research-operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAqBD;;;;;GAKG;AACH,wBAAsB,eAAe,CACjC,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,uBAAuB,CAAC,CAyClC;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAC9B,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,GACnB,OAAO,CAAC,uBAAuB,CAAC,CAkElC;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAC/B,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,UAAU,GAAE,OAAe,GAC5B,OAAO,CAAC,uBAAuB,CAAC,CAiDlC"}
|