@kenkaiiii/ggcoder 4.2.73 → 4.2.75

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.
Files changed (115) hide show
  1. package/dist/core/settings-manager.d.ts +1 -0
  2. package/dist/core/settings-manager.d.ts.map +1 -1
  3. package/dist/core/settings-manager.js +2 -0
  4. package/dist/core/settings-manager.js.map +1 -1
  5. package/dist/core/slash-commands.d.ts.map +1 -1
  6. package/dist/core/slash-commands.js +14 -0
  7. package/dist/core/slash-commands.js.map +1 -1
  8. package/dist/ui/App.d.ts.map +1 -1
  9. package/dist/ui/App.js +28 -3
  10. package/dist/ui/App.js.map +1 -1
  11. package/dist/ui/buddy/Buddy.d.ts +15 -0
  12. package/dist/ui/buddy/Buddy.d.ts.map +1 -0
  13. package/dist/ui/buddy/Buddy.js +118 -0
  14. package/dist/ui/buddy/Buddy.js.map +1 -0
  15. package/dist/ui/buddy/gacha.d.ts +8 -0
  16. package/dist/ui/buddy/gacha.d.ts.map +1 -0
  17. package/dist/ui/buddy/gacha.js +94 -0
  18. package/dist/ui/buddy/gacha.js.map +1 -0
  19. package/dist/ui/buddy/species.d.ts +52 -0
  20. package/dist/ui/buddy/species.d.ts.map +1 -0
  21. package/dist/ui/buddy/species.js +257 -0
  22. package/dist/ui/buddy/species.js.map +1 -0
  23. package/dist/ui/components/ActivityIndicator.d.ts +6 -1
  24. package/dist/ui/components/ActivityIndicator.d.ts.map +1 -1
  25. package/dist/ui/components/ActivityIndicator.js +52 -8
  26. package/dist/ui/components/ActivityIndicator.js.map +1 -1
  27. package/dist/ui/components/AnimationContext.d.ts +5 -0
  28. package/dist/ui/components/AnimationContext.d.ts.map +1 -1
  29. package/dist/ui/components/AnimationContext.js +8 -1
  30. package/dist/ui/components/AnimationContext.js.map +1 -1
  31. package/dist/ui/components/AssistantMessage.d.ts.map +1 -1
  32. package/dist/ui/components/AssistantMessage.js +3 -2
  33. package/dist/ui/components/AssistantMessage.js.map +1 -1
  34. package/dist/ui/components/BackgroundTasksBar.js +2 -2
  35. package/dist/ui/components/BackgroundTasksBar.js.map +1 -1
  36. package/dist/ui/components/Footer.d.ts +3 -1
  37. package/dist/ui/components/Footer.d.ts.map +1 -1
  38. package/dist/ui/components/Footer.js +23 -48
  39. package/dist/ui/components/Footer.js.map +1 -1
  40. package/dist/ui/components/Markdown.d.ts +4 -0
  41. package/dist/ui/components/Markdown.d.ts.map +1 -1
  42. package/dist/ui/components/Markdown.js +109 -6
  43. package/dist/ui/components/Markdown.js.map +1 -1
  44. package/dist/ui/components/MessageResponse.d.ts +25 -0
  45. package/dist/ui/components/MessageResponse.d.ts.map +1 -0
  46. package/dist/ui/components/MessageResponse.js +42 -0
  47. package/dist/ui/components/MessageResponse.js.map +1 -0
  48. package/dist/ui/components/NoSelect.d.ts +20 -0
  49. package/dist/ui/components/NoSelect.d.ts.map +1 -0
  50. package/dist/ui/components/NoSelect.js +14 -0
  51. package/dist/ui/components/NoSelect.js.map +1 -0
  52. package/dist/ui/components/Ratchet.d.ts +20 -0
  53. package/dist/ui/components/Ratchet.d.ts.map +1 -0
  54. package/dist/ui/components/Ratchet.js +30 -0
  55. package/dist/ui/components/Ratchet.js.map +1 -0
  56. package/dist/ui/components/ServerToolExecution.d.ts.map +1 -1
  57. package/dist/ui/components/ServerToolExecution.js +5 -6
  58. package/dist/ui/components/ServerToolExecution.js.map +1 -1
  59. package/dist/ui/components/Spinner.d.ts +8 -2
  60. package/dist/ui/components/Spinner.d.ts.map +1 -1
  61. package/dist/ui/components/Spinner.js +51 -5
  62. package/dist/ui/components/Spinner.js.map +1 -1
  63. package/dist/ui/components/StreamingArea.d.ts.map +1 -1
  64. package/dist/ui/components/StreamingArea.js +4 -3
  65. package/dist/ui/components/StreamingArea.js.map +1 -1
  66. package/dist/ui/components/SubAgentPanel.d.ts.map +1 -1
  67. package/dist/ui/components/SubAgentPanel.js +4 -3
  68. package/dist/ui/components/SubAgentPanel.js.map +1 -1
  69. package/dist/ui/components/ToolExecution.d.ts.map +1 -1
  70. package/dist/ui/components/ToolExecution.js +38 -12
  71. package/dist/ui/components/ToolExecution.js.map +1 -1
  72. package/dist/ui/components/ToolGroupExecution.d.ts.map +1 -1
  73. package/dist/ui/components/ToolGroupExecution.js +21 -17
  74. package/dist/ui/components/ToolGroupExecution.js.map +1 -1
  75. package/dist/ui/components/ToolUseLoader.d.ts +19 -0
  76. package/dist/ui/components/ToolUseLoader.d.ts.map +1 -0
  77. package/dist/ui/components/ToolUseLoader.js +42 -0
  78. package/dist/ui/components/ToolUseLoader.js.map +1 -0
  79. package/dist/ui/constants/figures.d.ts +30 -0
  80. package/dist/ui/constants/figures.d.ts.map +1 -0
  81. package/dist/ui/constants/figures.js +41 -0
  82. package/dist/ui/constants/figures.js.map +1 -0
  83. package/dist/ui/hooks/useAgentLoop.d.ts +8 -0
  84. package/dist/ui/hooks/useAgentLoop.d.ts.map +1 -1
  85. package/dist/ui/hooks/useAgentLoop.js +16 -0
  86. package/dist/ui/hooks/useAgentLoop.js.map +1 -1
  87. package/dist/ui/hooks/useBlink.d.ts +11 -0
  88. package/dist/ui/hooks/useBlink.d.ts.map +1 -0
  89. package/dist/ui/hooks/useBlink.js +19 -0
  90. package/dist/ui/hooks/useBlink.js.map +1 -0
  91. package/dist/ui/hooks/useMinDisplayTime.d.ts +11 -0
  92. package/dist/ui/hooks/useMinDisplayTime.d.ts.map +1 -0
  93. package/dist/ui/hooks/useMinDisplayTime.js +34 -0
  94. package/dist/ui/hooks/useMinDisplayTime.js.map +1 -0
  95. package/dist/ui/hooks/useTerminalProgress.d.ts +2 -0
  96. package/dist/ui/hooks/useTerminalProgress.d.ts.map +1 -0
  97. package/dist/ui/hooks/useTerminalProgress.js +98 -0
  98. package/dist/ui/hooks/useTerminalProgress.js.map +1 -0
  99. package/dist/ui/spinner-frames.d.ts +1 -0
  100. package/dist/ui/spinner-frames.d.ts.map +1 -1
  101. package/dist/ui/spinner-frames.js +15 -5
  102. package/dist/ui/spinner-frames.js.map +1 -1
  103. package/dist/ui/theme/dark.json +2 -1
  104. package/dist/ui/theme/light.json +2 -1
  105. package/dist/ui/theme/theme.d.ts +1 -0
  106. package/dist/ui/theme/theme.d.ts.map +1 -1
  107. package/dist/ui/utils/markdown-cache.d.ts +12 -0
  108. package/dist/ui/utils/markdown-cache.d.ts.map +1 -0
  109. package/dist/ui/utils/markdown-cache.js +43 -0
  110. package/dist/ui/utils/markdown-cache.js.map +1 -0
  111. package/dist/ui/utils/word-diff.d.ts +11 -0
  112. package/dist/ui/utils/word-diff.d.ts.map +1 -0
  113. package/dist/ui/utils/word-diff.js +23 -0
  114. package/dist/ui/utils/word-diff.js.map +1 -0
  115. package/package.json +3 -3
@@ -0,0 +1,118 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useState, useEffect, useMemo, useRef } from "react";
3
+ import { Text, Box } from "ink";
4
+ import { getPlayerBuddy } from "./gacha.js";
5
+ import { renderSprite, renderBlink, renderFace, spriteFrameCount, RARITY_THEME_KEYS, RARITY_STARS, } from "./species.js";
6
+ import { useTheme } from "../theme/theme.js";
7
+ import { useAnimationTick, useAnimationActive, deriveFrame, useReducedMotion, } from "../components/AnimationContext.js";
8
+ import { useTerminalSize } from "../hooks/useTerminalSize.js";
9
+ // ── Constants (matching Claude Code) ─────────────────────────
10
+ const TICK_MS = 500;
11
+ const IDLE_SEQUENCE = [0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 2, 0, 0, 0];
12
+ const MIN_COLS_FOR_FULL_SPRITE = 100;
13
+ const BUBBLE_SHOW = 20; // ticks (~10s)
14
+ const FADE_WINDOW = 6; // ticks (~3s fade before dismiss)
15
+ const PET_BURST_MS = 2500;
16
+ const PET_HEARTS = [
17
+ " \u2665 \u2665 ",
18
+ " \u2665 \u2665 \u2665 ",
19
+ " \u2665 \u2665 \u2665 ",
20
+ " \u2665 \u2665 \u2665 ",
21
+ " \u2665 \u2665 ",
22
+ ];
23
+ // ── Speech Bubble ────────────────────────────────────────────
24
+ function SpeechBubble({ text, color, fading }) {
25
+ // Wrap to 30 chars max
26
+ const maxWidth = 30;
27
+ const words = text.split(" ");
28
+ const lines = [];
29
+ let current = "";
30
+ for (const word of words) {
31
+ if (current.length + word.length + 1 > maxWidth && current.length > 0) {
32
+ lines.push(current);
33
+ current = word;
34
+ }
35
+ else {
36
+ current = current ? `${current} ${word}` : word;
37
+ }
38
+ }
39
+ if (current)
40
+ lines.push(current);
41
+ const width = Math.max(...lines.map((l) => l.length), 1);
42
+ const top = "\u256D" + "\u2500".repeat(width + 2) + "\u256E";
43
+ const bottom = "\u2570" + "\u2500".repeat(width + 2) + "\u256F";
44
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: color, dimColor: fading, children: top }), lines.map((line, i) => (_jsxs(Text, { color: color, dimColor: fading, children: ["\u2502 ", line.padEnd(width), " \u2502"] }, i))), _jsx(Text, { color: color, dimColor: fading, children: bottom }), _jsx(Text, { color: color, dimColor: fading, children: " \\" })] }));
45
+ }
46
+ // ── Resolve rarity color from theme ──────────────────────────
47
+ function getRarityColor(rarity, theme) {
48
+ const key = RARITY_THEME_KEYS[rarity] ?? "textDim";
49
+ return theme[key] ?? theme.textDim;
50
+ }
51
+ export function Buddy({ phase = "idle", reaction, petAt, onReactionDone }) {
52
+ const theme = useTheme();
53
+ const reducedMotion = useReducedMotion();
54
+ const { columns } = useTerminalSize();
55
+ useAnimationActive();
56
+ const tick = useAnimationTick();
57
+ const buddy = useMemo(() => getPlayerBuddy(), []);
58
+ const color = getRarityColor(buddy.rarity, theme);
59
+ const shinyColor = "#fef08a";
60
+ const displayColor = buddy.isShiny ? shinyColor : color;
61
+ // ── Speech bubble state ──────────────────────────────────
62
+ const [bubbleText, setBubbleText] = useState(null);
63
+ const bubbleTickRef = useRef(0);
64
+ const lastReactionRef = useRef(undefined);
65
+ useEffect(() => {
66
+ if (reaction && reaction !== lastReactionRef.current) {
67
+ lastReactionRef.current = reaction;
68
+ setBubbleText(reaction);
69
+ bubbleTickRef.current = 0;
70
+ }
71
+ }, [reaction]);
72
+ // Advance bubble timer
73
+ useEffect(() => {
74
+ if (!bubbleText)
75
+ return;
76
+ bubbleTickRef.current++;
77
+ if (bubbleTickRef.current >= BUBBLE_SHOW) {
78
+ setBubbleText(null);
79
+ onReactionDone?.();
80
+ }
81
+ }, [tick, bubbleText, onReactionDone]);
82
+ const bubbleFading = bubbleText ? bubbleTickRef.current >= BUBBLE_SHOW - FADE_WINDOW : false;
83
+ // ── Pet hearts state ─────────────────────────────────────
84
+ const showHearts = petAt ? Date.now() - petAt < PET_BURST_MS : false;
85
+ const heartFrame = showHearts ? deriveFrame(tick, TICK_MS, PET_HEARTS.length) : -1;
86
+ // ── Animation ────────────────────────────────────────────
87
+ const seqIdx = deriveFrame(tick, TICK_MS, IDLE_SEQUENCE.length);
88
+ const seqValue = IDLE_SEQUENCE[seqIdx];
89
+ const frameCount = spriteFrameCount(buddy.species);
90
+ const isActive = phase !== "idle";
91
+ let spriteLines;
92
+ if (reducedMotion) {
93
+ spriteLines = renderSprite(buddy, 0);
94
+ }
95
+ else if (showHearts || isActive) {
96
+ // Cycle all frames fast when petting or active
97
+ spriteLines = renderSprite(buddy, tick % frameCount);
98
+ }
99
+ else if (seqValue === -1) {
100
+ spriteLines = renderBlink(buddy);
101
+ }
102
+ else {
103
+ spriteLines = renderSprite(buddy, seqValue);
104
+ }
105
+ // ── Narrow mode ──────────────────────────────────────────
106
+ if (columns < MIN_COLS_FOR_FULL_SPRITE) {
107
+ const face = renderFace(buddy);
108
+ const stars = RARITY_STARS[buddy.rarity];
109
+ return (_jsxs(Box, { children: [_jsxs(Text, { color: displayColor, children: [face, " ", buddy.species] }), _jsxs(Text, { color: displayColor, dimColor: true, children: [" ", stars, buddy.isShiny ? " \u2726" : ""] }), bubbleText && (_jsxs(Text, { color: displayColor, dimColor: bubbleFading, children: [' "', bubbleText.length > 24 ? bubbleText.slice(0, 21) + "..." : bubbleText, '"'] }))] }));
110
+ }
111
+ // ── Wide mode: full sprite ───────────────────────────────
112
+ return (_jsxs(Box, { flexDirection: "row", gap: 1, children: [_jsxs(Box, { flexDirection: "column", children: [showHearts && heartFrame >= 0 && _jsx(Text, { color: "#f87171", children: PET_HEARTS[heartFrame] }), spriteLines.map((line, i) => (_jsx(Text, { color: displayColor, children: line }, i))), _jsxs(Text, { color: displayColor, dimColor: true, children: [buddy.species, buddy.isShiny ? " \u2726" : ""] })] }), bubbleText && (_jsx(Box, { children: _jsx(SpeechBubble, { text: bubbleText, color: displayColor, fading: bubbleFading }) }))] }));
113
+ }
114
+ /** How many columns the buddy sprite area reserves. */
115
+ export function companionReservedColumns() {
116
+ return 14; // 12 char sprite + 2 gap
117
+ }
118
+ //# sourceMappingURL=Buddy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Buddy.js","sourceRoot":"","sources":["../../../src/ui/buddy/Buddy.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,GACb,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,QAAQ,EAAc,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,gBAAgB,GACjB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,gEAAgE;AAEhE,MAAM,OAAO,GAAG,GAAG,CAAC;AACpB,MAAM,aAAa,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EA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,SAAS,CAAC,CAAC,CAAC,EAAE,IAC1B,IACH,EACL,UAAU,IAAI,CACb,KAAC,GAAG,cACF,KAAC,YAAY,IAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,GAAI,GACzE,CACP,IACG,CACP,CAAC;AACJ,CAAC;AAED,uDAAuD;AACvD,MAAM,UAAU,wBAAwB;IACtC,OAAO,EAAE,CAAC,CAAC,yBAAyB;AACtC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type CompanionBones } from "./species.js";
2
+ /**
3
+ * Get the user's deterministic buddy companion.
4
+ * Same machine always gets the same species, eyes, hat, stats.
5
+ * Result is cached for hot paths (500ms sprite tick).
6
+ */
7
+ export declare function getPlayerBuddy(): CompanionBones;
8
+ //# sourceMappingURL=gacha.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gacha.d.ts","sourceRoot":"","sources":["../../../src/ui/buddy/gacha.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,cAAc,EAIpB,MAAM,cAAc,CAAC;AAiFtB;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,cAAc,CAoB/C"}
@@ -0,0 +1,94 @@
1
+ import { hostname, userInfo, homedir } from "node:os";
2
+ import { ALL_SPECIES, SPECIES_RARITY, RARITY_WEIGHTS, RARITY_STAT_FLOORS, EYE_STYLES, } from "./species.js";
3
+ // ── FNV-1a hash ──────────────────────────────────────────────
4
+ function fnv1a(str) {
5
+ let hash = 0x811c9dc5;
6
+ for (let i = 0; i < str.length; i++) {
7
+ hash ^= str.charCodeAt(i);
8
+ hash = Math.imul(hash, 0x01000193);
9
+ }
10
+ return hash >>> 0;
11
+ }
12
+ // ── Mulberry32 PRNG ──────────────────────────────────────────
13
+ function mulberry32(seed) {
14
+ let s = seed | 0;
15
+ return () => {
16
+ s = (s + 0x6d2b79f5) | 0;
17
+ let t = Math.imul(s ^ (s >>> 15), 1 | s);
18
+ t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
19
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
20
+ };
21
+ }
22
+ // ── Seed ─────────────────────────────────────────────────────
23
+ function getUserSeed() {
24
+ const identity = `${hostname()}:${userInfo().username}:${homedir()}:friend-2026-401`;
25
+ return fnv1a(identity);
26
+ }
27
+ // ── Roll helpers ─────────────────────────────────────────────
28
+ function rollRarity(rand) {
29
+ const roll = rand * 100;
30
+ let cumulative = 0;
31
+ for (const [rarity, weight] of RARITY_WEIGHTS) {
32
+ cumulative += weight;
33
+ if (roll < cumulative)
34
+ return rarity;
35
+ }
36
+ return "common";
37
+ }
38
+ function rollStats(rng, rarity) {
39
+ const floor = RARITY_STAT_FLOORS[rarity];
40
+ const keys = ["debugging", "patience", "chaos", "wisdom", "snark"];
41
+ const peakIdx = Math.floor(rng() * keys.length);
42
+ let dumpIdx = Math.floor(rng() * keys.length);
43
+ while (dumpIdx === peakIdx)
44
+ dumpIdx = Math.floor(rng() * keys.length);
45
+ const stats = { debugging: 0, patience: 0, chaos: 0, wisdom: 0, snark: 0 };
46
+ for (let i = 0; i < keys.length; i++) {
47
+ const key = keys[i];
48
+ if (i === peakIdx) {
49
+ stats[key] = Math.min(100, 50 + Math.floor(rng() * 30) + floor);
50
+ }
51
+ else if (i === dumpIdx) {
52
+ stats[key] = Math.max(1, -10 + Math.floor(rng() * 15) + floor);
53
+ }
54
+ else {
55
+ stats[key] = floor + Math.floor(rng() * 40);
56
+ }
57
+ }
58
+ return stats;
59
+ }
60
+ // ── Main roll (cached) ───────────────────────────────────────
61
+ const HATS = [
62
+ "none",
63
+ "crown",
64
+ "tophat",
65
+ "propeller",
66
+ "halo",
67
+ "wizard",
68
+ "beanie",
69
+ "tinyduck",
70
+ ];
71
+ let rollCache = null;
72
+ /**
73
+ * Get the user's deterministic buddy companion.
74
+ * Same machine always gets the same species, eyes, hat, stats.
75
+ * Result is cached for hot paths (500ms sprite tick).
76
+ */
77
+ export function getPlayerBuddy() {
78
+ if (rollCache)
79
+ return rollCache;
80
+ const seed = getUserSeed();
81
+ const rng = mulberry32(seed);
82
+ const rarity = rollRarity(rng());
83
+ // Pick species from this rarity tier
84
+ const candidates = ALL_SPECIES.filter((s) => SPECIES_RARITY[s] === rarity);
85
+ const speciesIdx = Math.floor(rng() * candidates.length);
86
+ const species = candidates[speciesIdx];
87
+ const eyes = EYE_STYLES[Math.floor(rng() * EYE_STYLES.length)];
88
+ const hat = rarity === "common" ? "none" : HATS[Math.floor(rng() * HATS.length)];
89
+ const stats = rollStats(rng, rarity);
90
+ const isShiny = rng() < 0.01;
91
+ rollCache = { species, eyes, hat, stats, isShiny, rarity };
92
+ return rollCache;
93
+ }
94
+ //# sourceMappingURL=gacha.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gacha.js","sourceRoot":"","sources":["../../../src/ui/buddy/gacha.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EACL,WAAW,EACX,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,UAAU,GAKX,MAAM,cAAc,CAAC;AAEtB,gEAAgE;AAEhE,SAAS,KAAK,CAAC,GAAW;IACxB,IAAI,IAAI,GAAG,UAAU,CAAC;IACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,IAAI,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,IAAI,KAAK,CAAC,CAAC;AACpB,CAAC;AAED,gEAAgE;AAEhE,SAAS,UAAU,CAAC,IAAY;IAC9B,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC;IACjB,OAAO,GAAG,EAAE;QACV,CAAC,GAAG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,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Buddy companion species definitions.
3
+ *
4
+ * Each species has ASCII art frames (5 lines tall, 12 chars wide),
5
+ * eye placeholder {E} for expression variants, and a rarity tier.
6
+ * Matches Claude Code's buddy system architecture.
7
+ *
8
+ * Line 0 is the hat slot — left blank so hats can overlay it.
9
+ * {E} is replaced with the companion's eye character at render time.
10
+ * Blink replaces {E} with "-" rather than using separate frames.
11
+ */
12
+ export type Rarity = "common" | "uncommon" | "rare" | "epic" | "legendary";
13
+ export type EyeStyle = "\u00B7" | "\u2726" | "\u00D7" | "\u25C9" | "@" | "\u00B0";
14
+ export type Hat = "none" | "crown" | "tophat" | "propeller" | "halo" | "wizard" | "beanie" | "tinyduck";
15
+ export type Species = "duck" | "goose" | "blob" | "cat" | "dragon" | "octopus" | "owl" | "penguin" | "turtle" | "snail" | "ghost" | "axolotl" | "capybara" | "cactus" | "robot" | "rabbit" | "mushroom" | "chonk" | "phoenix";
16
+ /** Hat art for line 0 (replaces blank first line when hat present). */
17
+ export declare const HAT_LINES: Record<Hat, string>;
18
+ export interface CompanionStats {
19
+ debugging: number;
20
+ patience: number;
21
+ chaos: number;
22
+ wisdom: number;
23
+ snark: number;
24
+ }
25
+ export declare const RARITY_WEIGHTS: [Rarity, number][];
26
+ export declare const RARITY_STAT_FLOORS: Record<Rarity, number>;
27
+ export declare const RARITY_STARS: Record<Rarity, string>;
28
+ export declare const RARITY_THEME_KEYS: Record<Rarity, string>;
29
+ export declare const BODIES: Record<Species, string[][]>;
30
+ /** All species names. */
31
+ export declare const ALL_SPECIES: Species[];
32
+ /** Species rarity mapping. */
33
+ export declare const SPECIES_RARITY: Record<Species, Rarity>;
34
+ /** All available eye styles. */
35
+ export declare const EYE_STYLES: EyeStyle[];
36
+ export interface CompanionBones {
37
+ species: Species;
38
+ eyes: EyeStyle;
39
+ hat: Hat;
40
+ stats: CompanionStats;
41
+ isShiny: boolean;
42
+ rarity: Rarity;
43
+ }
44
+ /** Render sprite lines with eyes and hat applied. */
45
+ export declare function renderSprite(bones: CompanionBones, frame: number): string[];
46
+ /** Render blink frame (eyes replaced with -). */
47
+ export declare function renderBlink(bones: CompanionBones): string[];
48
+ /** Compact one-line face for narrow terminals. */
49
+ export declare function renderFace(bones: CompanionBones): string;
50
+ /** Number of animation frames for a species (always 3). */
51
+ export declare function spriteFrameCount(_species: Species): number;
52
+ //# sourceMappingURL=species.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"species.d.ts","sourceRoot":"","sources":["../../../src/ui/buddy/species.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;AAE3E,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,GAAG,GAAG,QAAQ,CAAC;AAElF,MAAM,MAAM,GAAG,GACX,MAAM,GACN,OAAO,GACP,QAAQ,GACR,WAAW,GACX,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,UAAU,CAAC;AAEf,MAAM,MAAM,OAAO,GACf,MAAM,GACN,OAAO,GACP,MAAM,GACN,KAAK,GACL,QAAQ,GACR,SAAS,GACT,KAAK,GACL,SAAS,GACT,QAAQ,GACR,OAAO,GACP,OAAO,GACP,SAAS,GACT,UAAU,GACV,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,UAAU,GACV,OAAO,GACP,SAAS,CAAC;AAEd,uEAAuE;AACvE,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CASzC,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CAC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* Each species has ASCII art frames (5 lines tall, 12 chars wide),
5
+ * eye placeholder {E} for expression variants, and a rarity tier.
6
+ * Matches Claude Code's buddy system architecture.
7
+ *
8
+ * Line 0 is the hat slot — left blank so hats can overlay it.
9
+ * {E} is replaced with the companion's eye character at render time.
10
+ * Blink replaces {E} with "-" rather than using separate frames.
11
+ */
12
+ /** Hat art for line 0 (replaces blank first line when hat present). */
13
+ export const HAT_LINES = {
14
+ none: "",
15
+ crown: " \\^^^/ ",
16
+ tophat: " ___ ",
17
+ propeller: " ~+~ ",
18
+ halo: " ooo ",
19
+ wizard: " /^\\ ",
20
+ beanie: " --- ",
21
+ tinyduck: " ,> ",
22
+ };
23
+ // ── Rarity config ────────────────────────────────────────────
24
+ export const RARITY_WEIGHTS = [
25
+ ["common", 60],
26
+ ["uncommon", 25],
27
+ ["rare", 10],
28
+ ["epic", 4],
29
+ ["legendary", 1],
30
+ ];
31
+ export const RARITY_STAT_FLOORS = {
32
+ common: 5,
33
+ uncommon: 15,
34
+ rare: 25,
35
+ epic: 35,
36
+ legendary: 50,
37
+ };
38
+ export const RARITY_STARS = {
39
+ common: "\u2605",
40
+ uncommon: "\u2605\u2605",
41
+ rare: "\u2605\u2605\u2605",
42
+ epic: "\u2605\u2605\u2605\u2605",
43
+ legendary: "\u2605\u2605\u2605\u2605\u2605",
44
+ };
45
+ // Rarity colors mapped to theme keys (like CC), with fallback hex
46
+ export const RARITY_THEME_KEYS = {
47
+ common: "textDim",
48
+ uncommon: "success",
49
+ rare: "primary",
50
+ epic: "accent",
51
+ legendary: "warning",
52
+ };
53
+ // ── Bodies: Record<Species, string[][]> ──────────────────────
54
+ // 3 frames per species, 5 lines each, 12 chars wide.
55
+ // Frame 0: idle rest. Frame 1: fidget. Frame 2: alternate/effect.
56
+ export const BODIES = {
57
+ duck: [
58
+ [" ", " __ ", " ({E} > ", " /||\\ ", " ~~~~ "],
59
+ [" ", " __ ", " ({E} > ", " \\||/ ", " ~~~~ "],
60
+ [" ", " __ ", " ({E} > ", " /||\\ ", " ~~~~ "],
61
+ ],
62
+ goose: [
63
+ [" ", " __ ", " ({E} } ", " /||\\ ", " d b "],
64
+ [" ", " __ ", " ({E} } ", " /|~|\\ ", " d b "],
65
+ [" ", " _/__ ", " ({E} } ", " /||\\ ", " d b "],
66
+ ],
67
+ blob: [
68
+ [" ", " .-----. ", " ( {E} {E} ) ", " ( __ ) ", " '---' "],
69
+ [" ", " .-----. ", " ( {E} {E} ) ", " ( __ ) ", " '--' "],
70
+ [" ", " .-----. ", " ( {E} {E} ) ", " (__) ", " '---' "],
71
+ ],
72
+ cat: [
73
+ [" ", " /\\_/\\ ", " ( {E}.{E} ) ", " > ^ < ", " ||| "],
74
+ [" ", " /\\_/\\ ", " ( {E}.{E} ) ", " > ^< ", " ||| "],
75
+ [" ", " /\\_/\\ ", " ( {E}.{E} ) ", " > ^ < ", " ~|| "],
76
+ ],
77
+ snail: [
78
+ [" ", " @/ ", " {E} __ ", " /_/ ", " ~~~~ "],
79
+ [" ", " @/ ", " {E} __ ", " /_/ ", " ~~~~ "],
80
+ [" ", " @/ ", " {E} __ ", " /_/ ", " ~~~~ "],
81
+ ],
82
+ turtle: [
83
+ [" ", " ____ ", " ({E} {E}) ", " /|==|\\ ", " d b "],
84
+ [" ", " ____ ", " ({E} {E}) ", " /|==|\\ ", " d b "],
85
+ [" ", " ____ ", " ({E} {E}) ", " \\|==|/ ", " d b "],
86
+ ],
87
+ owl: [
88
+ [" ", " /{\\ ", " ({E},{E}) ", " /) ) ", ' " " '],
89
+ [" ", " /{\\ ", " ({E},{E}) ", " ( (\\ ", ' " " '],
90
+ [" ", " /{\\ ", " ({E},{E}) ", " /) ) ", ' " " '],
91
+ ],
92
+ penguin: [
93
+ [" ", " (^) ", " /{E}\\ ", " / | \\ ", " d b "],
94
+ [" ", " (^) ", " \\{E}/ ", " \\|/ ", " d b "],
95
+ [" ", " (^) ", " /{E}\\ ", " / | \\ ", " d b "],
96
+ ],
97
+ rabbit: [
98
+ [" ", " (\\(\\ ", " ({E} {E}) ", " (> <) ", ' (" ") '],
99
+ [" ", " (\\(\\ ", " ({E} {E}) ", " (>~<) ", ' (" ") '],
100
+ [" ", " /)/) ", " ({E} {E}) ", " (> <) ", ' (" ") '],
101
+ ],
102
+ ghost: [
103
+ [" ", " .---. ", " ( {E} {E}) ", " | | ", " ~v~v~ "],
104
+ [" ", " .---. ", " ({E} {E} ) ", " | | ", " ~v~v~ "],
105
+ [" ", " .---. ", " ( {E} {E}) ", " | | ", " ~v~v~ "],
106
+ ],
107
+ mushroom: [
108
+ [" ", " ,---. ", " / * * \\ ", " |({E}{E})| ", " |__| "],
109
+ [" ", " ,---. ", " /* * *\\ ", " |({E}{E})| ", " |__| "],
110
+ [" ", " .---. ", " / * * \\ ", " |({E}{E})| ", " |__| "],
111
+ ],
112
+ robot: [
113
+ [" ", " [=====] ", " [{E} {E}] ", " /|=|\\ ", " d b "],
114
+ [" ", " [=====] ", " [{E} {E}] ", " \\|=|/ ", " d b "],
115
+ [" ", " [==o==] ", " [{E} {E}] ", " /|=|\\ ", " d b "],
116
+ ],
117
+ octopus: [
118
+ [" ", " ,--, ", " ({E} {E}) ", " /||||\\ ", " ~~~~~~ "],
119
+ [" ", " ,--, ", " ({E} {E}) ", " \\||||/ ", " ~~~~~~ "],
120
+ [" ", " ,--, ", " ({E} {E}) ", " /||\\/ ", " ~~~~~~ "],
121
+ ],
122
+ axolotl: [
123
+ [" ", " ~\\/~\\/ ", " ({E} {E}) ", " \\__/ ", " ~~~~ "],
124
+ [" ", " ~\\/~\\/ ", " ({E} {E}) ", " \\__/ ", " ~~~~ "],
125
+ [" ", " /~\\/~\\ ", " ({E} {E}) ", " \\__/ ", " ~~~~ "],
126
+ ],
127
+ dragon: [
128
+ [" ", " /\\_/\\_ ", " ( {E} {E} ) ", " ~\\/\\/~ ", " ~/ \\~ "],
129
+ [" ", " /\\_/\\_ ", " ( {E} {E} ) ", " ~\\/\\/~ ", " ~/ ~\\~ "],
130
+ [" ", " /\\_/\\_ ", " ( {E} {E} ) ", " ~/\\/~ ", " ~/ \\~ "],
131
+ ],
132
+ capybara: [
133
+ [" ", " .__. ", " ({E} {E}) ", " (___/) ", ' (" ") '],
134
+ [" ", " .__. ", " ({E} {E}) ", " (___/) ", ' (" ") '],
135
+ [" ", " .__. ", " ( {E}{E}) ", " (___/) ", ' (" ") '],
136
+ ],
137
+ phoenix: [
138
+ [" ", " ,/|\\, ", " ({E} {E}) ", " '|^|' ", " ~\\/\\/ ~ "],
139
+ [" ", " '/|\\` ", " ({E} {E}) ", " ,|^|, ", " ~ \\/\\/~ "],
140
+ [" ", " ,/|\\, ", " ({E} {E}) ", " '|^|' ", " ~\\/\\/ ~ "],
141
+ ],
142
+ cactus: [
143
+ [" ", " | ", " ({E} {E}) ", " -| |- ", " ~~~~~ "],
144
+ [" ", " | ", " ({E} {E}) ", " -| |- ", " ~~~~~ "],
145
+ [" ", " | ", " ( {E}{E}) ", " -| |- ", " ~~~~~ "],
146
+ ],
147
+ chonk: [
148
+ [" ", " .-----. ", " ({E} {E}) ", " ( ) ", " '~~~~' "],
149
+ [" ", " .-----. ", " ({E} {E}) ", " ( ) ", " '~~~~' "],
150
+ [" ", " .------. ", " ({E} {E}) ", " ( ) ", " '~~~~' "],
151
+ ],
152
+ };
153
+ /** All species names. */
154
+ export const ALL_SPECIES = [
155
+ "duck",
156
+ "goose",
157
+ "blob",
158
+ "cat",
159
+ "snail",
160
+ "turtle",
161
+ "owl",
162
+ "penguin",
163
+ "rabbit",
164
+ "ghost",
165
+ "mushroom",
166
+ "robot",
167
+ "octopus",
168
+ "axolotl",
169
+ "dragon",
170
+ "capybara",
171
+ "phoenix",
172
+ "cactus",
173
+ "chonk",
174
+ ];
175
+ /** Species rarity mapping. */
176
+ export const SPECIES_RARITY = {
177
+ duck: "common",
178
+ goose: "common",
179
+ blob: "common",
180
+ cat: "common",
181
+ snail: "common",
182
+ turtle: "common",
183
+ owl: "uncommon",
184
+ penguin: "uncommon",
185
+ rabbit: "uncommon",
186
+ ghost: "uncommon",
187
+ mushroom: "uncommon",
188
+ robot: "rare",
189
+ octopus: "rare",
190
+ axolotl: "rare",
191
+ dragon: "epic",
192
+ capybara: "epic",
193
+ phoenix: "legendary",
194
+ cactus: "legendary",
195
+ chonk: "legendary",
196
+ };
197
+ /** All available eye styles. */
198
+ export const EYE_STYLES = ["\u00B7", "\u2726", "\u00D7", "\u25C9", "@", "\u00B0"];
199
+ /** Render sprite lines with eyes and hat applied. */
200
+ export function renderSprite(bones, frame) {
201
+ const frames = BODIES[bones.species];
202
+ const lines = [...(frames[frame] ?? frames[0])];
203
+ // Replace eye placeholders
204
+ for (let i = 0; i < lines.length; i++) {
205
+ lines[i] = lines[i].replaceAll("{E}", bones.eyes);
206
+ }
207
+ // Apply hat on line 0 if present
208
+ if (bones.hat !== "none" && lines[0].trim() === "") {
209
+ const hatLine = HAT_LINES[bones.hat];
210
+ if (hatLine)
211
+ lines[0] = hatLine;
212
+ }
213
+ return lines;
214
+ }
215
+ /** Render blink frame (eyes replaced with -). */
216
+ export function renderBlink(bones) {
217
+ const lines = [...BODIES[bones.species][0]];
218
+ for (let i = 0; i < lines.length; i++) {
219
+ lines[i] = lines[i].replaceAll("{E}", "-");
220
+ }
221
+ if (bones.hat !== "none" && lines[0].trim() === "") {
222
+ const hatLine = HAT_LINES[bones.hat];
223
+ if (hatLine)
224
+ lines[0] = hatLine;
225
+ }
226
+ return lines;
227
+ }
228
+ /** Compact one-line face for narrow terminals. */
229
+ export function renderFace(bones) {
230
+ const e = bones.eyes;
231
+ switch (bones.species) {
232
+ case "cat":
233
+ return `=${e}.${e}=`;
234
+ case "duck":
235
+ case "goose":
236
+ return `(${e}>`;
237
+ case "blob":
238
+ case "chonk":
239
+ return `(${e} ${e})`;
240
+ case "owl":
241
+ return `{${e},${e}}`;
242
+ case "robot":
243
+ return `[${e}_${e}]`;
244
+ case "ghost":
245
+ return `(${e} ${e})~`;
246
+ case "dragon":
247
+ case "phoenix":
248
+ return `<${e} ${e}>`;
249
+ default:
250
+ return `(${e}${e})`;
251
+ }
252
+ }
253
+ /** Number of animation frames for a species (always 3). */
254
+ export function spriteFrameCount(_species) {
255
+ return 3;
256
+ }
257
+ //# sourceMappingURL=species.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"species.js","sourceRoot":"","sources":["../../../src/ui/buddy/species.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqCH,uEAAuE;AACvE,MAAM,CAAC,MAAM,SAAS,GAAwB;IAC5C,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,eAAe;IACtB,MAAM,EAAE,cAAc;IACtB,SAAS,EAAE,cAAc;IACzB,IAAI,EAAE,cAAc;IACpB,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE,cAAc;IACtB,QAAQ,EAAE,cAAc;CACzB,CAAC;AAUF,gEAAgE;AAEhE,MAAM,CAAC,MAAM,cAAc,GAAuB;IAChD,CAAC,QAAQ,EAAE,EAAE,CAAC;IACd,CAAC,UAAU,EAAE,EAAE,CAAC;IAChB,CAAC,MAAM,EAAE,EAAE,CAAC;IACZ,CAAC,MAAM,EAAE,CAAC,CAAC;IACX,CAAC,WAAW,EAAE,CAAC,CAAC;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAA2B;IACxD,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;IACR,SAAS,EAAE,EAAE;CACd,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAA2B;IAClD,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,cAAc;IACxB,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,0BAA0B;IAChC,SAAS,EAAE,gCAAgC;CAC5C,CAAC;AAEF,kEAAkE;AAClE,MAAM,CAAC,MAAM,iBAAiB,GAA2B;IACvD,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE,SAAS;IACnB,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I,CAAC,IAAI,CAAC,GAAG,CAAC;QACvB,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO;YACV,OAAO,IAAI,CAAC,GAAG,CAAC;QAClB,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO;YACV,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;QACvB,KAAK,KAAK;YACR,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;QACvB,KAAK,OAAO;YACV,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;QACvB,KAAK,OAAO;YACV,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QACxB,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;QACvB;YACE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACxB,CAAC;AACH,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,gBAAgB,CAAC,QAAiB;IAChD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import type { ActivityPhase, RetryInfo } from "../hooks/useAgentLoop.js";
2
3
  interface ActivityIndicatorProps {
3
4
  phase: ActivityPhase;
@@ -5,6 +6,10 @@ interface ActivityIndicatorProps {
5
6
  thinkingMs: number;
6
7
  isThinking: boolean;
7
8
  tokenEstimate: number;
9
+ /** Raw character count ref for smooth token animation (read every tick). */
10
+ charCountRef?: React.RefObject<number>;
11
+ /** Accumulated real tokens from completed turns. */
12
+ realTokensAccumRef?: React.RefObject<number>;
8
13
  userMessage?: string;
9
14
  activeToolNames?: string[];
10
15
  planMode?: boolean;
@@ -12,6 +17,6 @@ interface ActivityIndicatorProps {
12
17
  planDone?: number;
13
18
  planTotal?: number;
14
19
  }
15
- export declare function ActivityIndicator({ phase, elapsedMs, thinkingMs, isThinking, tokenEstimate, userMessage, activeToolNames, planMode, retryInfo, planDone, planTotal, }: ActivityIndicatorProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare function ActivityIndicator({ phase, elapsedMs, thinkingMs, isThinking, tokenEstimate, charCountRef: charCountRefProp, realTokensAccumRef: realTokensAccumRefProp, userMessage, activeToolNames, planMode, retryInfo, planDone, planTotal, }: ActivityIndicatorProps): import("react/jsx-runtime").JSX.Element;
16
21
  export {};
17
22
  //# sourceMappingURL=ActivityIndicator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActivityIndicator.d.ts","sourceRoot":"","sources":["../../../src/ui/components/ActivityIndicator.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAuGzE,UAAU,sBAAsB;IAC9B,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AASD,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,aAAa,EACb,WAAgB,EAChB,eAAoB,EACpB,QAAQ,EACR,SAAS,EACT,QAAY,EACZ,SAAa,GACd,EAAE,sBAAsB,2CAoGxB"}
1
+ {"version":3,"file":"ActivityIndicator.d.ts","sourceRoot":"","sources":["../../../src/ui/components/ActivityIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AA4GzE,UAAU,sBAAsB;IAC9B,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACvC,oDAAoD;IACpD,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AASD,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,aAAa,EACb,YAAY,EAAE,gBAAgB,EAC9B,kBAAkB,EAAE,sBAAsB,EAC1C,WAAgB,EAChB,eAAoB,EACpB,QAAQ,EACR,SAAS,EACT,QAAY,EACZ,SAAa,GACd,EAAE,sBAAsB,2CAoJxB"}