@calltelemetry/cli 0.7.6 → 0.7.8
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/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +7 -0
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/self-update.d.ts.map +1 -1
- package/dist/commands/self-update.js +1 -0
- package/dist/commands/self-update.js.map +1 -1
- package/dist/commands/syslog.d.ts +3 -0
- package/dist/commands/syslog.d.ts.map +1 -0
- package/dist/commands/syslog.js +159 -0
- package/dist/commands/syslog.js.map +1 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +143 -3
- package/dist/commands/update.js.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/bundle.d.ts +2 -1
- package/dist/lib/bundle.d.ts.map +1 -1
- package/dist/lib/bundle.js +41 -12
- package/dist/lib/bundle.js.map +1 -1
- package/dist/lib/compose.d.ts +10 -0
- package/dist/lib/compose.d.ts.map +1 -1
- package/dist/lib/compose.js +126 -1
- package/dist/lib/compose.js.map +1 -1
- package/dist/lib/db-backup.d.ts +23 -0
- package/dist/lib/db-backup.d.ts.map +1 -0
- package/dist/lib/db-backup.js +80 -0
- package/dist/lib/db-backup.js.map +1 -0
- package/dist/lib/migration-009-bind-mount-files.d.ts +5 -4
- package/dist/lib/migration-009-bind-mount-files.d.ts.map +1 -1
- package/dist/lib/migration-009-bind-mount-files.js +13 -5
- package/dist/lib/migration-009-bind-mount-files.js.map +1 -1
- package/dist/lib/release-migration-progress.d.ts +48 -0
- package/dist/lib/release-migration-progress.d.ts.map +1 -0
- package/dist/lib/release-migration-progress.js +223 -0
- package/dist/lib/release-migration-progress.js.map +1 -0
- package/dist/lib/syslog.d.ts +5 -0
- package/dist/lib/syslog.d.ts.map +1 -0
- package/dist/lib/syslog.js +21 -0
- package/dist/lib/syslog.js.map +1 -0
- package/dist/lib/update-steps.d.ts.map +1 -1
- package/dist/lib/update-steps.js +111 -0
- package/dist/lib/update-steps.js.map +1 -1
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/ui/views/DbBackupView.d.ts.map +1 -1
- package/dist/ui/views/DbBackupView.js +11 -27
- package/dist/ui/views/DbBackupView.js.map +1 -1
- package/dist/ui/views/MigrateDrainView.d.ts +6 -0
- package/dist/ui/views/MigrateDrainView.d.ts.map +1 -0
- package/dist/ui/views/MigrateDrainView.js +77 -0
- package/dist/ui/views/MigrateDrainView.js.map +1 -0
- package/dist/ui/views/MigrateStatusView.d.ts.map +1 -1
- package/dist/ui/views/MigrateStatusView.js +16 -7
- package/dist/ui/views/MigrateStatusView.js.map +1 -1
- package/dist/ui/views/MigrateWatchView.d.ts.map +1 -1
- package/dist/ui/views/MigrateWatchView.js +17 -12
- package/dist/ui/views/MigrateWatchView.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
3
|
+
import { useApp } from 'ink';
|
|
4
|
+
import { composeWithFiles, getAllComposeFiles } from '../../lib/compose.js';
|
|
5
|
+
import { getReleaseBin } from '../../lib/rpc.js';
|
|
6
|
+
import { AppShell, Section, ShellOutput, Spinner, StatusLine, Confirm } from '../components/index.js';
|
|
7
|
+
import { useAsyncTask, useConfirmBackNav } from '../hooks/index.js';
|
|
8
|
+
export function MigrateDrainView({ onBack }) {
|
|
9
|
+
const { exit } = useApp();
|
|
10
|
+
const [confirmed, setConfirmed] = useState(false);
|
|
11
|
+
const goBack = useCallback(() => {
|
|
12
|
+
if (onBack)
|
|
13
|
+
onBack();
|
|
14
|
+
else
|
|
15
|
+
exit();
|
|
16
|
+
}, [onBack, exit]);
|
|
17
|
+
const drainTask = useAsyncTask(async () => {
|
|
18
|
+
const releaseBin = getReleaseBin();
|
|
19
|
+
const composeFiles = getAllComposeFiles();
|
|
20
|
+
const logs = [
|
|
21
|
+
'=== Partition Data Migration ===',
|
|
22
|
+
'Stopping web application for exclusive partition drain...',
|
|
23
|
+
];
|
|
24
|
+
let primaryError;
|
|
25
|
+
let restartError;
|
|
26
|
+
try {
|
|
27
|
+
await composeWithFiles(composeFiles, ['stop', 'web'], { pipe: true });
|
|
28
|
+
logs.push('Starting one-shot drain container...');
|
|
29
|
+
const result = await composeWithFiles(composeFiles, [
|
|
30
|
+
'run',
|
|
31
|
+
'--rm',
|
|
32
|
+
'-T',
|
|
33
|
+
'--no-deps',
|
|
34
|
+
'--entrypoint',
|
|
35
|
+
'',
|
|
36
|
+
'web',
|
|
37
|
+
releaseBin,
|
|
38
|
+
'eval',
|
|
39
|
+
'Cdrcisco.Release.drain_legacy_partitions()',
|
|
40
|
+
], { pipe: true });
|
|
41
|
+
logs.push(String(result.stdout ?? '').trim());
|
|
42
|
+
logs.push('Partition drain completed.');
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
primaryError = err;
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
logs.push('Restarting web application...');
|
|
49
|
+
try {
|
|
50
|
+
await composeWithFiles(composeFiles, ['up', '-d', 'web'], { pipe: true });
|
|
51
|
+
logs.push('Web application restart initiated.');
|
|
52
|
+
}
|
|
53
|
+
catch (restartErr) {
|
|
54
|
+
const message = restartErr instanceof Error ? restartErr.message : String(restartErr);
|
|
55
|
+
logs.push(`Web application restart failed: ${message}`);
|
|
56
|
+
restartError = restartErr;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (primaryError !== undefined)
|
|
60
|
+
throw primaryError;
|
|
61
|
+
if (restartError !== undefined)
|
|
62
|
+
throw restartError;
|
|
63
|
+
return logs.filter(Boolean).join('\n');
|
|
64
|
+
}, { autoRun: false, timeout: 0 });
|
|
65
|
+
const { run } = drainTask;
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (confirmed)
|
|
68
|
+
run();
|
|
69
|
+
}, [confirmed, run]);
|
|
70
|
+
const allDone = drainTask.status === 'done' || drainTask.status === 'error';
|
|
71
|
+
useConfirmBackNav({ active: !confirmed, onBack: goBack });
|
|
72
|
+
return (_jsxs(AppShell, { command: "ct migrate drain", onBack: onBack, isComplete: confirmed && allDone, children: [!confirmed && (_jsx(Section, { title: "Partition Drain", children: _jsx(Confirm, { message: "Stop the app and run the idempotent partition drain?", onConfirm: (yes) => { if (yes)
|
|
73
|
+
setConfirmed(true);
|
|
74
|
+
else
|
|
75
|
+
goBack(); } }) })), confirmed && (_jsxs(Section, { title: "Partition Drain", children: [drainTask.status === 'pending' && _jsx(Spinner, { label: "Running partition drain..." }), drainTask.status === 'error' && _jsx(StatusLine, { status: "fail", label: drainTask.error?.message ?? 'Partition drain failed' }), drainTask.status === 'done' && drainTask.data && _jsx(ShellOutput, { content: drainTask.data, scrollable: true }), drainTask.status === 'done' && _jsx(StatusLine, { status: "ok", label: "Partition drain completed" })] }))] }));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=MigrateDrainView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MigrateDrainView.js","sourceRoot":"","sources":["../../../src/ui/views/MigrateDrainView.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtG,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAMpE,MAAM,UAAU,gB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C,CAAC;IAE1D,OAAO,CACL,MAAC,QAAQ,IAAC,OAAO,EAAC,kBAAkB,EAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,IAAI,OAAO,aAClF,CAAC,SAAS,IAAI,CACb,KAAC,OAAO,IAAC,KAAK,EAAC,iBAAiB,YAC9B,KAAC,OAAO,IAAC,OAAO,EAAC,sDAAsD,EAAC,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,GAAG,IAAI,GAAG;wBAAE,YAAY,CAAC,IAAI,CAAC,CAAC;;wBAAM,MAAM,EAAE,CAAC,CAAC,CAAC,GAAI,GACvI,CACX,EACA,SAAS,IAAI,CACZ,MAAC,OAAO,IAAC,KAAK,EAAC,iBAAiB,aAC7B,SAAS,CAAC,MAAM,KAAK,SAAS,IAAI,KAAC,OAAO,IAAC,KAAK,EAAC,4BAA4B,GAAG,EAChF,SAAS,CAAC,MAAM,KAAK,OAAO,IAAI,KAAC,UAAU,IAAC,MAAM,EAAC,MAAM,EAAC,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,OAAO,IAAI,wBAAwB,GAAI,EACzH,SAAS,CAAC,MAAM,KAAK,MAAM,IAAI,SAAS,CAAC,IAAI,IAAI,KAAC,WAAW,IAAC,OAAO,EAAE,SAAS,CAAC,IAAI,EAAE,UAAU,SAAG,EACpG,SAAS,CAAC,MAAM,KAAK,MAAM,IAAI,KAAC,UAAU,IAAC,MAAM,EAAC,IAAI,EAAC,KAAK,EAAC,2BAA2B,GAAG,IACpF,CACX,IACQ,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrateStatusView.d.ts","sourceRoot":"","sources":["../../../src/ui/views/MigrateStatusView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MigrateStatusView.d.ts","sourceRoot":"","sources":["../../../src/ui/views/MigrateStatusView.tsx"],"names":[],"mappings":"AAMA,UAAU,sBAAsB;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,EAAE,sBAAsB,2CA0CnE"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
import { composePs } from '../../lib/compose.js';
|
|
4
|
-
import {
|
|
5
|
-
import { MIGRATION_STATUS_RPC } from '../../lib/rpc-scripts.js';
|
|
4
|
+
import { getMigrationProgress, tailMigrationArtifacts } from '../../lib/release-migration-progress.js';
|
|
6
5
|
import { AppShell, Section, StatusLine, ShellOutput, Spinner } from '../components/index.js';
|
|
7
6
|
import { useAsyncTask } from '../hooks/index.js';
|
|
8
7
|
export function MigrateStatusView({ onBack }) {
|
|
@@ -10,13 +9,23 @@ export function MigrateStatusView({ onBack }) {
|
|
|
10
9
|
const container = await composePs('web');
|
|
11
10
|
if (!container)
|
|
12
11
|
throw new Error('Web container not found');
|
|
13
|
-
if (!await rpcOk())
|
|
14
|
-
throw new Error('RPC not ready');
|
|
15
12
|
return true;
|
|
16
13
|
});
|
|
17
14
|
const statusTask = useAsyncTask(async () => {
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
try {
|
|
16
|
+
const progress = await getMigrationProgress();
|
|
17
|
+
const tails = await tailMigrationArtifacts(progress.snapshot);
|
|
18
|
+
const sections = [progress.output];
|
|
19
|
+
if (tails.events)
|
|
20
|
+
sections.push(`Recent JSON events:\n${tails.events}`);
|
|
21
|
+
if (tails.log)
|
|
22
|
+
sections.push(`Recent log lines:\n${tails.log}`);
|
|
23
|
+
return sections.join('\n\n');
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
27
|
+
throw new Error(`Failed to query migrations: ${message}`);
|
|
28
|
+
}
|
|
20
29
|
}, false);
|
|
21
30
|
// Run status after ready
|
|
22
31
|
useEffect(() => {
|
|
@@ -26,6 +35,6 @@ export function MigrateStatusView({ onBack }) {
|
|
|
26
35
|
// Exit when done
|
|
27
36
|
const allDone = (readyTask.status === 'error') ||
|
|
28
37
|
(statusTask.status === 'done' || statusTask.status === 'error');
|
|
29
|
-
return (_jsx(AppShell, { command: "ct migrate status", onBack: onBack, isComplete: allDone, children: _jsxs(Section, { title: "Migration Status", children: [readyTask.status === 'pending' && _jsx(Spinner, { label: "Checking web container..." }), readyTask.status === 'error' && _jsx(StatusLine, { status: "fail", label: readyTask.error?.message ?? 'Web container not ready' }), statusTask.status === 'pending' && _jsx(Spinner, { label: "Querying migration status..." }), statusTask.status === 'error' && _jsx(StatusLine, { status: "fail", label:
|
|
38
|
+
return (_jsx(AppShell, { command: "ct migrate status", onBack: onBack, isComplete: allDone, children: _jsxs(Section, { title: "Migration Status", children: [readyTask.status === 'pending' && _jsx(Spinner, { label: "Checking web container..." }), readyTask.status === 'error' && _jsx(StatusLine, { status: "fail", label: readyTask.error?.message ?? 'Web container not ready' }), statusTask.status === 'pending' && _jsx(Spinner, { label: "Querying migration status..." }), statusTask.status === 'error' && _jsx(StatusLine, { status: "fail", label: statusTask.error?.message ?? 'Failed to query migrations' }), statusTask.status === 'done' && statusTask.data && _jsx(ShellOutput, { content: statusTask.data, scrollable: true })] }) }));
|
|
30
39
|
}
|
|
31
40
|
//# sourceMappingURL=MigrateStatusView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrateStatusView.js","sourceRoot":"","sources":["../../../src/ui/views/MigrateStatusView.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"MigrateStatusView.js","sourceRoot":"","sources":["../../../src/ui/views/MigrateStatusView.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OA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AC,IAAI,EAAE,UAAU,SAAG,IAChG,GACD,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrateWatchView.d.ts","sourceRoot":"","sources":["../../../src/ui/views/MigrateWatchView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MigrateWatchView.d.ts","sourceRoot":"","sources":["../../../src/ui/views/MigrateWatchView.tsx"],"names":[],"mappings":"AAMA,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,qBAAqB,2CA8C3E"}
|
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef } from 'react';
|
|
3
3
|
import { Box, Text } from 'ink';
|
|
4
|
-
import {
|
|
5
|
-
import { MIGRATION_STATUS_RPC } from '../../lib/rpc-scripts.js';
|
|
4
|
+
import { getMigrationProgress, tailMigrationArtifacts } from '../../lib/release-migration-progress.js';
|
|
6
5
|
import { AppShell, Section, ShellOutput, Spinner, StatusLine } from '../components/index.js';
|
|
7
6
|
import { usePolling } from '../hooks/index.js';
|
|
8
7
|
export function MigrateWatchView({ interval, onBack }) {
|
|
9
8
|
const stoppedRef = useRef(false);
|
|
10
9
|
const { data, error, stop } = usePolling(async () => {
|
|
11
|
-
const
|
|
12
|
-
|
|
10
|
+
const progress = await getMigrationProgress();
|
|
11
|
+
const tails = await tailMigrationArtifacts(progress.snapshot);
|
|
12
|
+
const sections = [progress.output];
|
|
13
|
+
if (tails.events)
|
|
14
|
+
sections.push(`Recent JSON events:\n${tails.events}`);
|
|
15
|
+
if (tails.log)
|
|
16
|
+
sections.push(`Recent log lines:\n${tails.log}`);
|
|
17
|
+
return {
|
|
18
|
+
output: sections.join('\n\n'),
|
|
19
|
+
pendingCount: progress.snapshot.pendingCount,
|
|
20
|
+
};
|
|
13
21
|
}, interval);
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const pendingCount = pendingLine?.split('=')[1];
|
|
18
|
-
const displayContent = lines.filter(l => !l.startsWith('::')).join('\n');
|
|
19
|
-
const watchDone = pendingCount === '0' && stoppedRef.current;
|
|
22
|
+
const pendingCount = data?.pendingCount;
|
|
23
|
+
const displayContent = data?.output ?? '';
|
|
24
|
+
const watchDone = pendingCount === 0 && stoppedRef.current;
|
|
20
25
|
// Auto-stop when no pending migrations remain
|
|
21
26
|
useEffect(() => {
|
|
22
|
-
if (pendingCount ===
|
|
27
|
+
if (pendingCount === 0 && !stoppedRef.current) {
|
|
23
28
|
stoppedRef.current = true;
|
|
24
29
|
stop();
|
|
25
30
|
}
|
|
26
31
|
}, [pendingCount, stop]);
|
|
27
|
-
return (_jsx(AppShell, { command: "ct migrate watch", onBack: onBack, isComplete: watchDone, children: _jsxs(Section, { title: `Watch Migrations (interval: ${interval / 1000}s)`, children: [!data && !error && _jsx(Spinner, { label: "Polling migration status..." }), error && (_jsxs(Box, { flexDirection: "column", children: [_jsx(StatusLine, { status: "warn", label: `Error: ${error.message}` }), _jsx(Text, { color: "yellow", children: '
|
|
32
|
+
return (_jsx(AppShell, { command: "ct migrate watch", onBack: onBack, isComplete: watchDone, children: _jsxs(Section, { title: `Watch Migrations (interval: ${interval / 1000}s)`, children: [!data && !error && _jsx(Spinner, { label: "Polling migration status..." }), error && (_jsxs(Box, { flexDirection: "column", children: [_jsx(StatusLine, { status: "warn", label: `Error: ${error.message}` }), _jsx(Text, { color: "yellow", children: ' Migration progress is not responding. Wait 30-60s and retry, or run: ct diag service' })] })), data && displayContent && _jsx(ShellOutput, { content: displayContent, scrollable: true }), !error && pendingCount === 0 && _jsx(StatusLine, { status: "ok", label: "All migrations are up to date. Exiting watch mode." }), !error && data && pendingCount !== 0 && (_jsx(Text, { dimColor: true, children: ` Next refresh in ${interval / 1000}s... Press Ctrl+C to stop.` }))] }) }));
|
|
28
33
|
}
|
|
29
34
|
//# sourceMappingURL=MigrateWatchView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrateWatchView.js","sourceRoot":"","sources":["../../../src/ui/views/MigrateWatchView.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"MigrateWatchView.js","sourceRoot":"","sources":["../../../src/ui/views/MigrateWatchView.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACvG,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAO/C,MAAM,UAAU,gBAAgB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAyB;IAC1E,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAEjC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,KAAK,IAAI,EAAE;QAClD,MAAM,QAAQ,GAAG,MAAM,oBAAoB,EAAE,CAAC;QAC9C,MAAM,KAAK,GAAG,MAAM,sBAAsB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC9D,MAAM,QAAQ,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,KAAK,C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