@kenkaiiii/ggcoder 4.3.13 → 4.3.15
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/cli.js.map +1 -1
- package/dist/config.d.ts +2 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +13 -1
- package/dist/config.js.map +1 -1
- package/dist/core/settings-manager.d.ts +4 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +11 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +8 -1
- package/dist/tools/bash.js.map +1 -1
- package/dist/ui/App.d.ts +2 -0
- package/dist/ui/App.d.ts.map +1 -1
- package/dist/ui/App.js +69 -57
- package/dist/ui/App.js.map +1 -1
- package/dist/ui/components/ActivityIndicator.d.ts +3 -1
- package/dist/ui/components/ActivityIndicator.d.ts.map +1 -1
- package/dist/ui/components/ActivityIndicator.js +4 -1
- package/dist/ui/components/ActivityIndicator.js.map +1 -1
- package/dist/ui/components/DiffFrame.d.ts +10 -0
- package/dist/ui/components/DiffFrame.d.ts.map +1 -0
- package/dist/ui/components/DiffFrame.js +13 -0
- package/dist/ui/components/DiffFrame.js.map +1 -0
- package/dist/ui/components/Footer.d.ts +2 -1
- package/dist/ui/components/Footer.d.ts.map +1 -1
- package/dist/ui/components/Footer.js +4 -1
- package/dist/ui/components/Footer.js.map +1 -1
- package/dist/ui/components/InputArea.d.ts.map +1 -1
- package/dist/ui/components/InputArea.js +297 -8
- package/dist/ui/components/InputArea.js.map +1 -1
- package/dist/ui/components/Markdown.d.ts +1 -1
- package/dist/ui/components/Markdown.d.ts.map +1 -1
- package/dist/ui/components/Markdown.js +18 -213
- package/dist/ui/components/Markdown.js.map +1 -1
- package/dist/ui/components/Ratchet.d.ts.map +1 -1
- package/dist/ui/components/Ratchet.js +9 -2
- package/dist/ui/components/Ratchet.js.map +1 -1
- package/dist/ui/components/ThemeSelector.d.ts +9 -0
- package/dist/ui/components/ThemeSelector.d.ts.map +1 -0
- package/dist/ui/components/ThemeSelector.js +25 -0
- package/dist/ui/components/ThemeSelector.js.map +1 -0
- package/dist/ui/components/ToolExecution.d.ts +2 -0
- package/dist/ui/components/ToolExecution.d.ts.map +1 -1
- package/dist/ui/components/ToolExecution.js +34 -15
- package/dist/ui/components/ToolExecution.js.map +1 -1
- package/dist/ui/components/ToolGroupExecution.d.ts +3 -2
- package/dist/ui/components/ToolGroupExecution.d.ts.map +1 -1
- package/dist/ui/components/ToolGroupExecution.js +68 -51
- package/dist/ui/components/ToolGroupExecution.js.map +1 -1
- package/dist/ui/hooks/useAgentLoop.d.ts +2 -0
- package/dist/ui/hooks/useAgentLoop.d.ts.map +1 -1
- package/dist/ui/hooks/useAgentLoop.js +1 -0
- package/dist/ui/hooks/useAgentLoop.js.map +1 -1
- package/dist/ui/hooks/useDoublePress.d.ts +8 -0
- package/dist/ui/hooks/useDoublePress.d.ts.map +1 -0
- package/dist/ui/hooks/useDoublePress.js +44 -0
- package/dist/ui/hooks/useDoublePress.js.map +1 -0
- package/dist/ui/live-item-flush.d.ts +4 -0
- package/dist/ui/live-item-flush.d.ts.map +1 -1
- package/dist/ui/live-item-flush.js +36 -0
- package/dist/ui/live-item-flush.js.map +1 -1
- package/dist/ui/render.d.ts +2 -1
- package/dist/ui/render.d.ts.map +1 -1
- package/dist/ui/render.js +9 -3
- package/dist/ui/render.js.map +1 -1
- package/dist/ui/stores/create-store.d.ts +15 -0
- package/dist/ui/stores/create-store.d.ts.map +1 -0
- package/dist/ui/stores/create-store.js +30 -0
- package/dist/ui/stores/create-store.js.map +1 -0
- package/dist/ui/stores/index.d.ts +3 -0
- package/dist/ui/stores/index.d.ts.map +1 -0
- package/dist/ui/stores/index.js +3 -0
- package/dist/ui/stores/index.js.map +1 -0
- package/dist/ui/stores/taskbar-store.d.ts +19 -0
- package/dist/ui/stores/taskbar-store.d.ts.map +1 -0
- package/dist/ui/stores/taskbar-store.js +59 -0
- package/dist/ui/stores/taskbar-store.js.map +1 -0
- package/dist/ui/theme/dark-ansi.json +48 -0
- package/dist/ui/theme/dark-daltonized.json +48 -0
- package/dist/ui/theme/dark.json +22 -1
- package/dist/ui/theme/detect-theme.d.ts +12 -8
- package/dist/ui/theme/detect-theme.d.ts.map +1 -1
- package/dist/ui/theme/detect-theme.js +43 -18
- package/dist/ui/theme/detect-theme.js.map +1 -1
- package/dist/ui/theme/light-ansi.json +48 -0
- package/dist/ui/theme/light-daltonized.json +48 -0
- package/dist/ui/theme/light.json +44 -23
- package/dist/ui/theme/theme.d.ts +27 -1
- package/dist/ui/theme/theme.d.ts.map +1 -1
- package/dist/ui/theme/theme.js +24 -1
- package/dist/ui/theme/theme.js.map +1 -1
- package/dist/ui/utils/highlight.d.ts +1 -1
- package/dist/ui/utils/highlight.d.ts.map +1 -1
- package/dist/ui/utils/highlight.js +24 -4
- package/dist/ui/utils/highlight.js.map +1 -1
- package/dist/ui/utils/hyperlink.d.ts +11 -0
- package/dist/ui/utils/hyperlink.d.ts.map +1 -0
- package/dist/ui/utils/hyperlink.js +27 -0
- package/dist/ui/utils/hyperlink.js.map +1 -0
- package/dist/ui/utils/markdown-cache.d.ts +5 -6
- package/dist/ui/utils/markdown-cache.d.ts.map +1 -1
- package/dist/ui/utils/markdown-cache.js +5 -5
- package/dist/ui/utils/markdown-cache.js.map +1 -1
- package/dist/ui/utils/signal.d.ts +21 -0
- package/dist/ui/utils/signal.d.ts.map +1 -0
- package/dist/ui/utils/signal.js +30 -0
- package/dist/ui/utils/signal.js.map +1 -0
- package/dist/ui/utils/supports-hyperlinks.d.ts +6 -0
- package/dist/ui/utils/supports-hyperlinks.d.ts.map +1 -0
- package/dist/ui/utils/supports-hyperlinks.js +52 -0
- package/dist/ui/utils/supports-hyperlinks.js.map +1 -0
- package/dist/ui/utils/sync-output.d.ts +16 -0
- package/dist/ui/utils/sync-output.d.ts.map +1 -0
- package/dist/ui/utils/sync-output.js +70 -0
- package/dist/ui/utils/sync-output.js.map +1 -0
- package/dist/ui/utils/token-to-ansi.d.ts +9 -0
- package/dist/ui/utils/token-to-ansi.d.ts.map +1 -0
- package/dist/ui/utils/token-to-ansi.js +305 -0
- package/dist/ui/utils/token-to-ansi.js.map +1 -0
- package/package.json +3 -3
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import type { ThemeName } from "./theme.js";
|
|
1
2
|
/**
|
|
2
|
-
* Detect
|
|
3
|
+
* Detect the best theme for the current terminal.
|
|
3
4
|
*
|
|
4
|
-
* Detection chain (first match wins):
|
|
5
|
-
* 1.
|
|
6
|
-
* 2.
|
|
7
|
-
* 3.
|
|
8
|
-
* 4.
|
|
9
|
-
* 5.
|
|
5
|
+
* Detection chain for base theme (first match wins):
|
|
6
|
+
* 1. FORCE_THEME env var (explicit override with any ThemeName)
|
|
7
|
+
* 2. VSCODE_THEME_KIND env var (VS Code integrated terminal)
|
|
8
|
+
* 3. macOS system dark mode (defaults read -g AppleInterfaceStyle)
|
|
9
|
+
* 4. OSC 11 escape sequence query (most modern terminals)
|
|
10
|
+
* 5. COLORFGBG env var (rxvt, some other terminals)
|
|
11
|
+
* 6. Default to "dark"
|
|
12
|
+
*
|
|
13
|
+
* Auto-selects ANSI fallback variant when truecolor is not supported.
|
|
10
14
|
*/
|
|
11
|
-
export declare function detectTheme(): Promise<
|
|
15
|
+
export declare function detectTheme(): Promise<ThemeName>;
|
|
12
16
|
//# sourceMappingURL=detect-theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect-theme.d.ts","sourceRoot":"","sources":["../../../src/ui/theme/detect-theme.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"detect-theme.d.ts","sourceRoot":"","sources":["../../../src/ui/theme/detect-theme.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,SAAS,CAAC,CAmDtD"}
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process";
|
|
2
|
+
import chalk from "chalk";
|
|
2
3
|
/**
|
|
3
|
-
* Detect
|
|
4
|
+
* Detect the best theme for the current terminal.
|
|
4
5
|
*
|
|
5
|
-
* Detection chain (first match wins):
|
|
6
|
-
* 1.
|
|
7
|
-
* 2.
|
|
8
|
-
* 3.
|
|
9
|
-
* 4.
|
|
10
|
-
* 5.
|
|
6
|
+
* Detection chain for base theme (first match wins):
|
|
7
|
+
* 1. FORCE_THEME env var (explicit override with any ThemeName)
|
|
8
|
+
* 2. VSCODE_THEME_KIND env var (VS Code integrated terminal)
|
|
9
|
+
* 3. macOS system dark mode (defaults read -g AppleInterfaceStyle)
|
|
10
|
+
* 4. OSC 11 escape sequence query (most modern terminals)
|
|
11
|
+
* 5. COLORFGBG env var (rxvt, some other terminals)
|
|
12
|
+
* 6. Default to "dark"
|
|
13
|
+
*
|
|
14
|
+
* Auto-selects ANSI fallback variant when truecolor is not supported.
|
|
11
15
|
*/
|
|
12
16
|
export async function detectTheme() {
|
|
17
|
+
// 0. Explicit override
|
|
18
|
+
const forceTheme = process.env["FORCE_THEME"];
|
|
19
|
+
if (forceTheme && isValidThemeName(forceTheme)) {
|
|
20
|
+
return forceTheme;
|
|
21
|
+
}
|
|
13
22
|
// 1. VS Code sets this reliably
|
|
14
23
|
const vscodeTheme = process.env["VSCODE_THEME_KIND"];
|
|
15
24
|
if (vscodeTheme) {
|
|
@@ -31,21 +40,37 @@ export async function detectTheme() {
|
|
|
31
40
|
}
|
|
32
41
|
}
|
|
33
42
|
// 3. OSC 11 — query actual terminal background color
|
|
34
|
-
|
|
35
|
-
if (osc !== null)
|
|
36
|
-
return osc;
|
|
43
|
+
let base = await queryOSC11();
|
|
37
44
|
// 4. COLORFGBG — "fg;bg" ANSI color indices
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
if (base === null) {
|
|
46
|
+
const colorfgbg = process.env["COLORFGBG"];
|
|
47
|
+
if (colorfgbg) {
|
|
48
|
+
const parts = colorfgbg.split(";");
|
|
49
|
+
const bg = parseInt(parts[parts.length - 1], 10);
|
|
50
|
+
if (!isNaN(bg)) {
|
|
51
|
+
base = bg === 7 || (bg >= 9 && bg <= 15) ? "light" : "dark";
|
|
52
|
+
}
|
|
45
53
|
}
|
|
46
54
|
}
|
|
47
55
|
// 5. Default
|
|
48
|
-
|
|
56
|
+
if (base === null)
|
|
57
|
+
base = "dark";
|
|
58
|
+
// Auto-select ANSI variant for terminals without truecolor support
|
|
59
|
+
if (chalk.level < 3) {
|
|
60
|
+
return `${base}-ansi`;
|
|
61
|
+
}
|
|
62
|
+
return base;
|
|
63
|
+
}
|
|
64
|
+
const VALID_THEMES = new Set([
|
|
65
|
+
"dark",
|
|
66
|
+
"light",
|
|
67
|
+
"dark-ansi",
|
|
68
|
+
"light-ansi",
|
|
69
|
+
"dark-daltonized",
|
|
70
|
+
"light-daltonized",
|
|
71
|
+
]);
|
|
72
|
+
function isValidThemeName(name) {
|
|
73
|
+
return VALID_THEMES.has(name);
|
|
49
74
|
}
|
|
50
75
|
/**
|
|
51
76
|
* Send OSC 11 query to the terminal and parse the background color response.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect-theme.js","sourceRoot":"","sources":["../../../src/ui/theme/detect-theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"detect-theme.js","sourceRoot":"","sources":["../../../src/ui/theme/detect-theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,WA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C;QACtB,KAAK,CAAC;YACJ,OAAO,KAAK,GAAG,MAAM,CAAC;QACxB;YACE,OAAO,KAAK,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAClD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "light-ansi",
|
|
3
|
+
"primary": "#55ffff",
|
|
4
|
+
"secondary": "#ff55ff",
|
|
5
|
+
"success": "#55ff55",
|
|
6
|
+
"error": "#ff5555",
|
|
7
|
+
"warning": "#ffff55",
|
|
8
|
+
"text": "#ffffff",
|
|
9
|
+
"textDim": "#aaaaaa",
|
|
10
|
+
"textMuted": "#aaaaaa",
|
|
11
|
+
"secondaryText": "#aaaaaa",
|
|
12
|
+
"border": "#555555",
|
|
13
|
+
"background": "",
|
|
14
|
+
"accent": "#55ffff",
|
|
15
|
+
"toolName": "#55ffff",
|
|
16
|
+
"toolSuccess": "#55ff55",
|
|
17
|
+
"toolError": "#ff5555",
|
|
18
|
+
"diffAdded": "#55ff55",
|
|
19
|
+
"diffRemoved": "#ff5555",
|
|
20
|
+
"diffContext": "#aaaaaa",
|
|
21
|
+
"diffAddedDimmed": "#55ff55",
|
|
22
|
+
"diffRemovedDimmed": "#ff5555",
|
|
23
|
+
"diffAddedWord": "#55ff55",
|
|
24
|
+
"diffRemovedWord": "#ff5555",
|
|
25
|
+
"diffAddedWordDimmed": "#55ff55",
|
|
26
|
+
"diffRemovedWordDimmed": "#ff5555",
|
|
27
|
+
"spinnerColor": "#55ffff",
|
|
28
|
+
"claude": "#ff5555",
|
|
29
|
+
"claudeShimmer": "#ff5555",
|
|
30
|
+
"permission": "#55ffff",
|
|
31
|
+
"permissionShimmer": "#55ffff",
|
|
32
|
+
"inputPrompt": "#55ffff",
|
|
33
|
+
"footerText": "#aaaaaa",
|
|
34
|
+
"commandColor": "#ff55ff",
|
|
35
|
+
"planPrimary": "#ffff55",
|
|
36
|
+
"planBorder": "#ffff55",
|
|
37
|
+
"subtle": "#555555",
|
|
38
|
+
"link": "#55ffff",
|
|
39
|
+
"code": "#ffff55",
|
|
40
|
+
"subagent1": "#ff5555",
|
|
41
|
+
"subagent2": "#55ffff",
|
|
42
|
+
"subagent3": "#55ff55",
|
|
43
|
+
"subagent4": "#ffff55",
|
|
44
|
+
"subagent5": "#ff55ff",
|
|
45
|
+
"subagent6": "#ff5555",
|
|
46
|
+
"subagent7": "#ff55ff",
|
|
47
|
+
"subagent8": "#55ffff"
|
|
48
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "light-daltonized",
|
|
3
|
+
"primary": "#93c5fd",
|
|
4
|
+
"secondary": "#c4b5fd",
|
|
5
|
+
"success": "#93c5fd",
|
|
6
|
+
"error": "#fbbf24",
|
|
7
|
+
"warning": "#fbbf24",
|
|
8
|
+
"text": "#e5e7eb",
|
|
9
|
+
"textDim": "#6b7280",
|
|
10
|
+
"textMuted": "#9ca3af",
|
|
11
|
+
"secondaryText": "#999999",
|
|
12
|
+
"border": "#374151",
|
|
13
|
+
"background": "",
|
|
14
|
+
"accent": "#a5b4fc",
|
|
15
|
+
"toolName": "#93c5fd",
|
|
16
|
+
"toolSuccess": "#93c5fd",
|
|
17
|
+
"toolError": "#fbbf24",
|
|
18
|
+
"diffAdded": "#93c5fd",
|
|
19
|
+
"diffRemoved": "#fbbf24",
|
|
20
|
+
"diffContext": "#6b7280",
|
|
21
|
+
"diffAddedDimmed": "#bfdbfe",
|
|
22
|
+
"diffRemovedDimmed": "#fde68a",
|
|
23
|
+
"diffAddedWord": "#60a5fa",
|
|
24
|
+
"diffRemovedWord": "#f59e0b",
|
|
25
|
+
"diffAddedWordDimmed": "#93c5fd",
|
|
26
|
+
"diffRemovedWordDimmed": "#fbbf24",
|
|
27
|
+
"spinnerColor": "#93c5fd",
|
|
28
|
+
"claude": "#fb923c",
|
|
29
|
+
"claudeShimmer": "#fdba74",
|
|
30
|
+
"permission": "#a5b4fc",
|
|
31
|
+
"permissionShimmer": "#c7d2fe",
|
|
32
|
+
"inputPrompt": "#93c5fd",
|
|
33
|
+
"footerText": "#6b7280",
|
|
34
|
+
"commandColor": "#a5b4fc",
|
|
35
|
+
"planPrimary": "#fbbf24",
|
|
36
|
+
"planBorder": "#f59e0b",
|
|
37
|
+
"subtle": "#4b5563",
|
|
38
|
+
"link": "#93c5fd",
|
|
39
|
+
"code": "#fbbf24",
|
|
40
|
+
"subagent1": "#fbbf24",
|
|
41
|
+
"subagent2": "#93c5fd",
|
|
42
|
+
"subagent3": "#a5b4fc",
|
|
43
|
+
"subagent4": "#c4b5fd",
|
|
44
|
+
"subagent5": "#c084fc",
|
|
45
|
+
"subagent6": "#fb923c",
|
|
46
|
+
"subagent7": "#a5b4fc",
|
|
47
|
+
"subagent8": "#22d3ee"
|
|
48
|
+
}
|
package/dist/ui/theme/light.json
CHANGED
|
@@ -1,27 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "light",
|
|
3
|
-
"primary": "#
|
|
4
|
-
"secondary": "#
|
|
5
|
-
"success": "#
|
|
6
|
-
"error": "#
|
|
7
|
-
"warning": "#
|
|
8
|
-
"text": "#
|
|
9
|
-
"textDim": "#
|
|
10
|
-
"textMuted": "#
|
|
11
|
-
"
|
|
3
|
+
"primary": "#93c5fd",
|
|
4
|
+
"secondary": "#c4b5fd",
|
|
5
|
+
"success": "#4ade80",
|
|
6
|
+
"error": "#f87171",
|
|
7
|
+
"warning": "#fbbf24",
|
|
8
|
+
"text": "#e5e7eb",
|
|
9
|
+
"textDim": "#6b7280",
|
|
10
|
+
"textMuted": "#9ca3af",
|
|
11
|
+
"secondaryText": "#999999",
|
|
12
|
+
"border": "#374151",
|
|
12
13
|
"background": "",
|
|
13
|
-
"accent": "#
|
|
14
|
-
"toolName": "#
|
|
15
|
-
"toolSuccess": "#
|
|
16
|
-
"toolError": "#
|
|
17
|
-
"diffAdded": "#
|
|
18
|
-
"diffRemoved": "#
|
|
19
|
-
"diffContext": "#
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
14
|
+
"accent": "#a5b4fc",
|
|
15
|
+
"toolName": "#93c5fd",
|
|
16
|
+
"toolSuccess": "#4ade80",
|
|
17
|
+
"toolError": "#f87171",
|
|
18
|
+
"diffAdded": "#4ade80",
|
|
19
|
+
"diffRemoved": "#f87171",
|
|
20
|
+
"diffContext": "#6b7280",
|
|
21
|
+
"diffAddedDimmed": "#69db7c",
|
|
22
|
+
"diffRemovedDimmed": "#ffa8b4",
|
|
23
|
+
"diffAddedWord": "#86efac",
|
|
24
|
+
"diffRemovedWord": "#fca5a5",
|
|
25
|
+
"diffAddedWordDimmed": "#6ee7b7",
|
|
26
|
+
"diffRemovedWordDimmed": "#fda4af",
|
|
27
|
+
"spinnerColor": "#93c5fd",
|
|
28
|
+
"claude": "#fb923c",
|
|
29
|
+
"claudeShimmer": "#fdba74",
|
|
30
|
+
"permission": "#a5b4fc",
|
|
31
|
+
"permissionShimmer": "#c7d2fe",
|
|
32
|
+
"inputPrompt": "#93c5fd",
|
|
33
|
+
"footerText": "#6b7280",
|
|
34
|
+
"commandColor": "#a5b4fc",
|
|
35
|
+
"planPrimary": "#fbbf24",
|
|
36
|
+
"planBorder": "#f59e0b",
|
|
37
|
+
"subtle": "#4b5563",
|
|
38
|
+
"link": "#93c5fd",
|
|
39
|
+
"code": "#fbbf24",
|
|
40
|
+
"subagent1": "#f87171",
|
|
41
|
+
"subagent2": "#93c5fd",
|
|
42
|
+
"subagent3": "#4ade80",
|
|
43
|
+
"subagent4": "#fbbf24",
|
|
44
|
+
"subagent5": "#c4b5fd",
|
|
45
|
+
"subagent6": "#fb923c",
|
|
46
|
+
"subagent7": "#f472b6",
|
|
47
|
+
"subagent8": "#22d3ee"
|
|
27
48
|
}
|
package/dist/ui/theme/theme.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import darkTheme from "./dark.json";
|
|
2
2
|
export type Theme = typeof darkTheme;
|
|
3
|
-
export
|
|
3
|
+
export type ThemeName = "dark" | "light" | "dark-ansi" | "light-ansi" | "dark-daltonized" | "light-daltonized";
|
|
4
|
+
export declare function loadTheme(name: ThemeName): Theme;
|
|
4
5
|
export declare const ThemeContext: import("react").Context<{
|
|
5
6
|
name: string;
|
|
6
7
|
primary: string;
|
|
@@ -11,6 +12,7 @@ export declare const ThemeContext: import("react").Context<{
|
|
|
11
12
|
text: string;
|
|
12
13
|
textDim: string;
|
|
13
14
|
textMuted: string;
|
|
15
|
+
secondaryText: string;
|
|
14
16
|
border: string;
|
|
15
17
|
background: string;
|
|
16
18
|
accent: string;
|
|
@@ -20,13 +22,37 @@ export declare const ThemeContext: import("react").Context<{
|
|
|
20
22
|
diffAdded: string;
|
|
21
23
|
diffRemoved: string;
|
|
22
24
|
diffContext: string;
|
|
25
|
+
diffAddedDimmed: string;
|
|
26
|
+
diffRemovedDimmed: string;
|
|
27
|
+
diffAddedWord: string;
|
|
28
|
+
diffRemovedWord: string;
|
|
29
|
+
diffAddedWordDimmed: string;
|
|
30
|
+
diffRemovedWordDimmed: string;
|
|
23
31
|
spinnerColor: string;
|
|
32
|
+
claude: string;
|
|
33
|
+
claudeShimmer: string;
|
|
34
|
+
permission: string;
|
|
35
|
+
permissionShimmer: string;
|
|
24
36
|
inputPrompt: string;
|
|
25
37
|
footerText: string;
|
|
26
38
|
commandColor: string;
|
|
27
39
|
planPrimary: string;
|
|
28
40
|
planBorder: string;
|
|
29
41
|
subtle: string;
|
|
42
|
+
link: string;
|
|
43
|
+
code: string;
|
|
44
|
+
subagent1: string;
|
|
45
|
+
subagent2: string;
|
|
46
|
+
subagent3: string;
|
|
47
|
+
subagent4: string;
|
|
48
|
+
subagent5: string;
|
|
49
|
+
subagent6: string;
|
|
50
|
+
subagent7: string;
|
|
51
|
+
subagent8: string;
|
|
30
52
|
}>;
|
|
53
|
+
/** Callback to switch theme at runtime. Null when not inside ThemeProvider. */
|
|
54
|
+
export declare const SetThemeContext: import("react").Context<((name: ThemeName) => void) | null>;
|
|
31
55
|
export declare function useTheme(): Theme;
|
|
56
|
+
/** Returns a function to switch themes at runtime. Returns null if not available. */
|
|
57
|
+
export declare function useSetTheme(): ((name: ThemeName) => void) | null;
|
|
32
58
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/ui/theme/theme.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,aAAa,CAAuB;
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/ui/theme/theme.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,aAAa,CAAuB;AAO1D,MAAM,MAAM,KAAK,GAAG,OAAO,SAAS,CAAC;AAErC,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,OAAO,GACP,WAAW,GACX,YAAY,GACZ,iBAAiB,GACjB,kBAAkB,CAAC;AAEvB,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,KAAK,CAehD;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAkC,CAAC;AAE5D,+EAA+E;AAC/E,eAAO,MAAM,eAAe,kCAAyB,SAAS,KAAK,IAAI,SAAe,CAAC;AAEvF,wBAAgB,QAAQ,IAAI,KAAK,CAEhC;AAED,qFAAqF;AACrF,wBAAgB,WAAW,IAAI,CAAC,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC,GAAG,IAAI,CAEhE"}
|
package/dist/ui/theme/theme.js
CHANGED
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
import { createContext, useContext } from "react";
|
|
2
2
|
import darkTheme from "./dark.json" with { type: "json" };
|
|
3
3
|
import lightTheme from "./light.json" with { type: "json" };
|
|
4
|
+
import darkAnsiTheme from "./dark-ansi.json" with { type: "json" };
|
|
5
|
+
import lightAnsiTheme from "./light-ansi.json" with { type: "json" };
|
|
6
|
+
import darkDaltonizedTheme from "./dark-daltonized.json" with { type: "json" };
|
|
7
|
+
import lightDaltonizedTheme from "./light-daltonized.json" with { type: "json" };
|
|
4
8
|
export function loadTheme(name) {
|
|
5
|
-
|
|
9
|
+
switch (name) {
|
|
10
|
+
case "light":
|
|
11
|
+
return lightTheme;
|
|
12
|
+
case "dark-ansi":
|
|
13
|
+
return darkAnsiTheme;
|
|
14
|
+
case "light-ansi":
|
|
15
|
+
return lightAnsiTheme;
|
|
16
|
+
case "dark-daltonized":
|
|
17
|
+
return darkDaltonizedTheme;
|
|
18
|
+
case "light-daltonized":
|
|
19
|
+
return lightDaltonizedTheme;
|
|
20
|
+
default:
|
|
21
|
+
return darkTheme;
|
|
22
|
+
}
|
|
6
23
|
}
|
|
7
24
|
export const ThemeContext = createContext(darkTheme);
|
|
25
|
+
/** Callback to switch theme at runtime. Null when not inside ThemeProvider. */
|
|
26
|
+
export const SetThemeContext = createContext(null);
|
|
8
27
|
export function useTheme() {
|
|
9
28
|
return useContext(ThemeContext);
|
|
10
29
|
}
|
|
30
|
+
/** Returns a function to switch themes at runtime. Returns null if not available. */
|
|
31
|
+
export function useSetTheme() {
|
|
32
|
+
return useContext(SetThemeContext);
|
|
33
|
+
}
|
|
11
34
|
//# sourceMappingURL=theme.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../src/ui/theme/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,SAAS,MAAM,aAAa,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1D,OAAO,UAAU,MAAM,cAAc,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CA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,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare function langFromPath(filePath: string): string | undefined;
|
|
3
3
|
/**
|
|
4
4
|
* Syntax-highlight code. Returns ANSI string.
|
|
5
|
-
* Falls back to raw code if language unknown.
|
|
5
|
+
* Falls back to raw code if the highlighter hasn't loaded yet or language is unknown.
|
|
6
6
|
*/
|
|
7
7
|
export declare function highlightCode(code: string, language?: string): string;
|
|
8
8
|
//# sourceMappingURL=highlight.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../../../src/ui/utils/highlight.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../../../src/ui/utils/highlight.ts"],"names":[],"mappings":"AA8BA,gDAAgD;AAChD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGjE;AA4BD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CASrE"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { highlight, supportsLanguage } from "cli-highlight";
|
|
2
1
|
import path from "node:path";
|
|
3
2
|
/** Map file extension to cli-highlight language name */
|
|
4
3
|
const EXT_TO_LANG = {
|
|
@@ -32,15 +31,36 @@ export function langFromPath(filePath) {
|
|
|
32
31
|
const ext = path.extname(filePath).replace(/^\./, "").toLowerCase();
|
|
33
32
|
return EXT_TO_LANG[ext];
|
|
34
33
|
}
|
|
34
|
+
// Lazy-load cli-highlight so it doesn't block initial render.
|
|
35
|
+
// First call returns plain text; subsequent calls use the loaded highlighter.
|
|
36
|
+
let hlModule;
|
|
37
|
+
let loadAttempted = false;
|
|
38
|
+
function ensureLoaded() {
|
|
39
|
+
if (hlModule)
|
|
40
|
+
return hlModule;
|
|
41
|
+
if (loadAttempted)
|
|
42
|
+
return undefined;
|
|
43
|
+
loadAttempted = true;
|
|
44
|
+
// Kick off async load for next call
|
|
45
|
+
import("cli-highlight").then((m) => {
|
|
46
|
+
hlModule = m;
|
|
47
|
+
}, () => {
|
|
48
|
+
// Failed to load — will fall back to plain text permanently
|
|
49
|
+
});
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
35
52
|
/**
|
|
36
53
|
* Syntax-highlight code. Returns ANSI string.
|
|
37
|
-
* Falls back to raw code if language unknown.
|
|
54
|
+
* Falls back to raw code if the highlighter hasn't loaded yet or language is unknown.
|
|
38
55
|
*/
|
|
39
56
|
export function highlightCode(code, language) {
|
|
40
|
-
if (!language
|
|
57
|
+
if (!language)
|
|
58
|
+
return code;
|
|
59
|
+
const hl = ensureLoaded();
|
|
60
|
+
if (!hl || !hl.supportsLanguage(language))
|
|
41
61
|
return code;
|
|
42
62
|
try {
|
|
43
|
-
return highlight(code, { language, ignoreIllegals: true });
|
|
63
|
+
return hl.highlight(code, { language, ignoreIllegals: true });
|
|
44
64
|
}
|
|
45
65
|
catch {
|
|
46
66
|
return code;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlight.js","sourceRoot":"","sources":["../../../src/ui/utils/highlight.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"highlight.js","sourceRoot":"","sources":["../../../src/ui/utils/highlight.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,wDAAwD;AACxD,MAAM,WAAW,GAA2B;IAC1C,EAAE,EAAE,YAAY;IAChB,GAAG,EAAE,YAAY;IACjB,EAAE,EAAE,YAAY;IAChB,GAAG,EAAE,YAAY;IACjB,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,MAAM;IACZ,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,MAAM;IACV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E,OAAO,IAAI,CAAC;IACvD,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a clickable hyperlink using OSC 8 escape sequences.
|
|
3
|
+
* Falls back to plain URL if the terminal doesn't support hyperlinks.
|
|
4
|
+
*
|
|
5
|
+
* @param url - The URL to link to
|
|
6
|
+
* @param content - Optional content to display as the link text.
|
|
7
|
+
* If provided and hyperlinks are supported, this text is shown as a clickable link.
|
|
8
|
+
* If hyperlinks are not supported, content is ignored and only the URL is shown.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createHyperlink(url: string, content?: string): string;
|
|
11
|
+
//# sourceMappingURL=hyperlink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyperlink.d.ts","sourceRoot":"","sources":["../../../src/ui/utils/hyperlink.ts"],"names":[],"mappings":"AASA;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAUrE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { supportsHyperlinks } from "./supports-hyperlinks.js";
|
|
3
|
+
// OSC 8 hyperlink escape sequences
|
|
4
|
+
// Format: \e]8;;URL\e\\TEXT\e]8;;\e\\
|
|
5
|
+
// Using \x07 (BEL) as terminator which is more widely supported
|
|
6
|
+
const OSC8_START = "\x1b]8;;";
|
|
7
|
+
const OSC8_END = "\x07";
|
|
8
|
+
/**
|
|
9
|
+
* Create a clickable hyperlink using OSC 8 escape sequences.
|
|
10
|
+
* Falls back to plain URL if the terminal doesn't support hyperlinks.
|
|
11
|
+
*
|
|
12
|
+
* @param url - The URL to link to
|
|
13
|
+
* @param content - Optional content to display as the link text.
|
|
14
|
+
* If provided and hyperlinks are supported, this text is shown as a clickable link.
|
|
15
|
+
* If hyperlinks are not supported, content is ignored and only the URL is shown.
|
|
16
|
+
*/
|
|
17
|
+
export function createHyperlink(url, content) {
|
|
18
|
+
if (!supportsHyperlinks()) {
|
|
19
|
+
return url;
|
|
20
|
+
}
|
|
21
|
+
// Apply basic ANSI blue color — wrap-ansi preserves this across line breaks.
|
|
22
|
+
// RGB colors (like theme colors) are NOT preserved by wrap-ansi with OSC 8.
|
|
23
|
+
const displayText = content ?? url;
|
|
24
|
+
const coloredText = chalk.blue(displayText);
|
|
25
|
+
return `${OSC8_START}${url}${OSC8_END}${coloredText}${OSC8_START}${OSC8_END}`;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=hyperlink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyperlink.js","sourceRoot":"","sources":["../../../src/ui/utils/hyperlink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,mCAAmC;AACnC,sCAAsC;AACtC,gEAAgE;AAChE,MAAM,UAAU,GAAG,UAAU,CAAC;AAC9B,MAAM,QAAQ,GAAG,MAAM,CAAC;AAExB;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW,EAAE,OAAgB;IAC3D,IAAI,CAAC,kBAAkB,EAAE,EAAE,CAAC;QAC1B,OAAO,GAAG,CAAC;IACb,CAAC;IAED,6EAA6E;IAC7E,4EAA4E;IAC5E,MAAM,WAAW,GAAG,OAAO,IAAI,GAAG,CAAC;IACnC,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC5C,OAAO,GAAG,UAAU,GAAG,GAAG,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,EAAE,CAAC;AAChF,CAAC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare class MarkdownLRUCache {
|
|
1
|
+
/** Simple LRU cache for rendered markdown ANSI strings. */
|
|
2
|
+
declare class MarkdownAnsiCache {
|
|
4
3
|
private cache;
|
|
5
|
-
get(body: string):
|
|
6
|
-
set(body: string,
|
|
4
|
+
get(body: string): string | undefined;
|
|
5
|
+
set(body: string, ansi: string): void;
|
|
7
6
|
private hash;
|
|
8
7
|
}
|
|
9
|
-
export declare const
|
|
8
|
+
export declare const markdownAnsiCache: MarkdownAnsiCache;
|
|
10
9
|
export declare function containsMarkdownSyntax(text: string): boolean;
|
|
11
10
|
export {};
|
|
12
11
|
//# sourceMappingURL=markdown-cache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-cache.d.ts","sourceRoot":"","sources":["../../../src/ui/utils/markdown-cache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"markdown-cache.d.ts","sourceRoot":"","sources":["../../../src/ui/utils/markdown-cache.ts"],"names":[],"mappings":"AAIA,2DAA2D;AAC3D,cAAM,iBAAiB;IACrB,OAAO,CAAC,KAAK,CAA6B;IAE1C,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAUrC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAYrC,OAAO,CAAC,IAAI;CAGb;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAC;AASzD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAI5D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
const MAX_SIZE = 500;
|
|
3
|
-
/** Simple LRU cache for
|
|
4
|
-
class
|
|
3
|
+
/** Simple LRU cache for rendered markdown ANSI strings. */
|
|
4
|
+
class MarkdownAnsiCache {
|
|
5
5
|
cache = new Map();
|
|
6
6
|
get(body) {
|
|
7
7
|
const key = this.hash(body);
|
|
@@ -13,11 +13,11 @@ class MarkdownLRUCache {
|
|
|
13
13
|
this.cache.set(key, entry);
|
|
14
14
|
return entry;
|
|
15
15
|
}
|
|
16
|
-
set(body,
|
|
16
|
+
set(body, ansi) {
|
|
17
17
|
const key = this.hash(body);
|
|
18
18
|
// Delete first to reset insertion order
|
|
19
19
|
this.cache.delete(key);
|
|
20
|
-
this.cache.set(key,
|
|
20
|
+
this.cache.set(key, ansi);
|
|
21
21
|
// Evict oldest if over capacity
|
|
22
22
|
if (this.cache.size > MAX_SIZE) {
|
|
23
23
|
const oldest = this.cache.keys().next().value;
|
|
@@ -28,7 +28,7 @@ class MarkdownLRUCache {
|
|
|
28
28
|
return createHash("sha256").update(body).digest("hex");
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
export const
|
|
31
|
+
export const markdownAnsiCache = new MarkdownAnsiCache();
|
|
32
32
|
/**
|
|
33
33
|
* Check whether text contains markdown syntax worth parsing.
|
|
34
34
|
* If it doesn't, the caller can skip marked.lexer() entirely.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-cache.js","sourceRoot":"","sources":["../../../src/ui/utils/markdown-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"markdown-cache.js","sourceRoot":"","sources":["../../../src/ui/utils/markdown-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,QAAQ,GAAG,GAAG,CAAC;AAErB,2DAA2D;AAC3D,MAAM,iBAAiB;IACb,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE1C,GAAG,CAAC,IAAY;QACd,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,I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AC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7D,OAAO,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny listener-set primitive for pure event signals (no stored state).
|
|
3
|
+
*
|
|
4
|
+
* Use this when subscribers only need to know "something happened",
|
|
5
|
+
* not "what is the current value".
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* const changed = createSignal()
|
|
9
|
+
* const unsub = changed.subscribe(() => console.log("changed"))
|
|
10
|
+
* changed.emit()
|
|
11
|
+
*/
|
|
12
|
+
export interface Signal<Args extends unknown[] = []> {
|
|
13
|
+
/** Subscribe a listener. Returns an unsubscribe function. */
|
|
14
|
+
subscribe: (listener: (...args: Args) => void) => () => void;
|
|
15
|
+
/** Call all subscribed listeners with the given arguments. */
|
|
16
|
+
emit: (...args: Args) => void;
|
|
17
|
+
/** Remove all listeners. */
|
|
18
|
+
clear: () => void;
|
|
19
|
+
}
|
|
20
|
+
export declare function createSignal<Args extends unknown[] = []>(): Signal<Args>;
|
|
21
|
+
//# sourceMappingURL=signal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../../src/ui/utils/signal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,MAAM,CAAC,IAAI,SAAS,OAAO,EAAE,GAAG,EAAE;IACjD,6DAA6D;IAC7D,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;IAC7D,8DAA8D;IAC9D,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC9B,4BAA4B;IAC5B,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,GAAG,EAAE,KAAK,MAAM,CAAC,IAAI,CAAC,CAgBxE"}
|