@townco/gui-template 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{acp-sdk-DjnJtAf8.js → acp-sdk-C7r2g8Gx.js} +1 -1
- package/dist/assets/icons-DyKSdrA7.js +1 -0
- package/dist/assets/index-CwjFUPJ1.css +1 -0
- package/dist/assets/index-bBppzLNv.js +8 -0
- package/dist/assets/{markdown-BLVKlqjB.js → markdown-BYclSlXM.js} +1 -1
- package/dist/assets/radix-5M08E2bk.js +5 -0
- package/dist/assets/{react-BUwpDnu9.js → react-oZw8z-KQ.js} +1 -1
- package/dist/assets/vendor-CEpcc87q.js +48 -0
- package/dist/index.html +8 -8
- package/package.json +3 -3
- package/src/ChatView.tsx +159 -135
- package/dist/assets/icons-B1wHwGRq.js +0 -1
- package/dist/assets/index-B6Vo9iGc.css +0 -1
- package/dist/assets/index-C9pfdbke.js +0 -7
- package/dist/assets/radix-zBfH0NEp.js +0 -5
- package/dist/assets/vendor-CNJ4Zu8U.js +0 -48
package/dist/index.html
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Agent Chat</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-
|
|
9
|
-
<link rel="modulepreload" crossorigin href="/assets/react-
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/acp-sdk-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/radix-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="/assets/icons-
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/markdown-
|
|
14
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-bBppzLNv.js"></script>
|
|
8
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-CEpcc87q.js">
|
|
9
|
+
<link rel="modulepreload" crossorigin href="/assets/react-oZw8z-KQ.js">
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/acp-sdk-C7r2g8Gx.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/radix-5M08E2bk.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/icons-DyKSdrA7.js">
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/markdown-BYclSlXM.js">
|
|
14
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CwjFUPJ1.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
|
17
17
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@townco/gui-template",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
"check": "tsc --noEmit"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@townco/ui": "0.1.
|
|
23
|
+
"@townco/ui": "0.1.9",
|
|
24
24
|
"lucide-react": "^0.552.0",
|
|
25
25
|
"react": "^19.2.0",
|
|
26
26
|
"react-dom": "^19.2.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@tailwindcss/postcss": "^4.1.17",
|
|
30
|
-
"@townco/tsconfig": "0.1.
|
|
30
|
+
"@townco/tsconfig": "0.1.6",
|
|
31
31
|
"@types/react": "^19.2.2",
|
|
32
32
|
"@types/react-dom": "^19.2.2",
|
|
33
33
|
"@vitejs/plugin-react": "^5.1.0",
|
package/src/ChatView.tsx
CHANGED
|
@@ -5,19 +5,34 @@ import {
|
|
|
5
5
|
useChatStore,
|
|
6
6
|
} from "@townco/ui";
|
|
7
7
|
import {
|
|
8
|
+
ChatInputActions,
|
|
9
|
+
ChatInputAttachment,
|
|
10
|
+
ChatInputCommandMenu,
|
|
8
11
|
ChatInputField,
|
|
9
12
|
ChatInputRoot,
|
|
10
13
|
ChatInputSubmit,
|
|
11
14
|
ChatInputToolbar,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
ChatInputVoiceInput,
|
|
16
|
+
ChatLayout,
|
|
17
|
+
type CommandMenuItem,
|
|
18
|
+
FilesTabContent,
|
|
15
19
|
Message,
|
|
16
20
|
MessageContent,
|
|
21
|
+
Tabs,
|
|
22
|
+
TabsContent,
|
|
23
|
+
TabsList,
|
|
24
|
+
TabsTrigger,
|
|
17
25
|
type TodoItem,
|
|
26
|
+
TodoTabContent,
|
|
18
27
|
} from "@townco/ui/gui";
|
|
19
|
-
import {
|
|
20
|
-
|
|
28
|
+
import {
|
|
29
|
+
ArrowRight,
|
|
30
|
+
CheckSquare,
|
|
31
|
+
Code,
|
|
32
|
+
FileText,
|
|
33
|
+
Settings,
|
|
34
|
+
Sparkles,
|
|
35
|
+
} from "lucide-react";
|
|
21
36
|
|
|
22
37
|
export interface ChatViewProps {
|
|
23
38
|
client: AcpClient | null;
|
|
@@ -29,145 +44,154 @@ export function ChatView({ client }: ChatViewProps) {
|
|
|
29
44
|
const { messages } = useChatMessages(client);
|
|
30
45
|
const error = useChatStore((state) => state.error);
|
|
31
46
|
|
|
32
|
-
|
|
33
|
-
const [
|
|
34
|
-
const [todos] = useState<TodoItem[]>([]);
|
|
35
|
-
|
|
36
|
-
// Auto-scroll to bottom when new messages arrive
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
39
|
-
});
|
|
47
|
+
// TODO: Replace with useChatStore((state) => state.todos) when todos are added to the store
|
|
48
|
+
const todos: TodoItem[] = [];
|
|
40
49
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
50
|
+
// Command menu items for chat input
|
|
51
|
+
const commandMenuItems: CommandMenuItem[] = [
|
|
52
|
+
{
|
|
53
|
+
id: "model-sonnet",
|
|
54
|
+
label: "Use Sonnet 4.5",
|
|
55
|
+
description: "Switch to Claude Sonnet 4.5 model",
|
|
56
|
+
icon: <Sparkles className="h-4 w-4" />,
|
|
57
|
+
category: "model",
|
|
58
|
+
onSelect: () => {
|
|
59
|
+
console.log("Selected Sonnet 4.5");
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: "model-opus",
|
|
64
|
+
label: "Use Opus",
|
|
65
|
+
description: "Switch to Claude Opus model",
|
|
66
|
+
icon: <Sparkles className="h-4 w-4" />,
|
|
67
|
+
category: "model",
|
|
68
|
+
onSelect: () => {
|
|
69
|
+
console.log("Selected Opus");
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "settings",
|
|
74
|
+
label: "Open Settings",
|
|
75
|
+
description: "Configure chat preferences",
|
|
76
|
+
icon: <Settings className="h-4 w-4" />,
|
|
77
|
+
category: "action",
|
|
78
|
+
onSelect: () => {
|
|
79
|
+
console.log("Opening settings");
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: "code-mode",
|
|
84
|
+
label: "Code Mode",
|
|
85
|
+
description: "Enable code-focused responses",
|
|
86
|
+
icon: <Code className="h-4 w-4" />,
|
|
87
|
+
category: "mode",
|
|
88
|
+
onSelect: () => {
|
|
89
|
+
console.log("Enabled code mode");
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
];
|
|
66
93
|
|
|
67
94
|
return (
|
|
68
|
-
<
|
|
69
|
-
{/*
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<div className="
|
|
74
|
-
<div className="flex items-
|
|
75
|
-
<div className=
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
95
|
+
<ChatLayout.Root defaultPanelSize="small" defaultActiveTab="todo">
|
|
96
|
+
{/* Main: Vertical container for Messages + Footer */}
|
|
97
|
+
<ChatLayout.Main>
|
|
98
|
+
{/* Connection Error Banner */}
|
|
99
|
+
{connectionStatus === "error" && error && (
|
|
100
|
+
<div className="border-b border-red-500/20 bg-red-500/10 px-6 py-4">
|
|
101
|
+
<div className="flex items-start justify-between gap-4">
|
|
102
|
+
<div className="flex-1">
|
|
103
|
+
<h3 className="mb-1 text-sm font-semibold text-red-500">
|
|
104
|
+
Connection Error
|
|
105
|
+
</h3>
|
|
106
|
+
<p className="whitespace-pre-line text-sm text-foreground">
|
|
107
|
+
{error}
|
|
108
|
+
</p>
|
|
109
|
+
</div>
|
|
110
|
+
<button
|
|
111
|
+
type="button"
|
|
112
|
+
onClick={connect}
|
|
113
|
+
className="rounded-lg bg-red-500 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-red-600"
|
|
114
|
+
>
|
|
115
|
+
Retry
|
|
116
|
+
</button>
|
|
79
117
|
</div>
|
|
80
|
-
<button
|
|
81
|
-
type="button"
|
|
82
|
-
onClick={() => setIsHeaderExpanded(!isHeaderExpanded)}
|
|
83
|
-
className="p-1 rounded hover:bg-background transition-colors"
|
|
84
|
-
aria-label={
|
|
85
|
-
isHeaderExpanded ? "Collapse header" : "Expand header"
|
|
86
|
-
}
|
|
87
|
-
>
|
|
88
|
-
<ChevronDown
|
|
89
|
-
className={cn(
|
|
90
|
-
"w-5 h-5 text-foreground transition-transform duration-200",
|
|
91
|
-
isHeaderExpanded && "rotate-180",
|
|
92
|
-
)}
|
|
93
|
-
/>
|
|
94
|
-
</button>
|
|
95
118
|
</div>
|
|
96
|
-
|
|
119
|
+
)}
|
|
97
120
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
121
|
+
{/* Body: Container for Messages + Footer + Toaster */}
|
|
122
|
+
<ChatLayout.Body>
|
|
123
|
+
{/* Messages: Scrollable message area */}
|
|
124
|
+
<ChatLayout.Messages className="pt-4">
|
|
125
|
+
{messages.length === 0 ? (
|
|
126
|
+
<div className="flex h-full items-center justify-center">
|
|
127
|
+
<div className="text-center text-muted-foreground">
|
|
128
|
+
<p className="mb-2 text-lg">No messages yet</p>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
) : (
|
|
132
|
+
<div className="flex flex-col gap-4 px-4">
|
|
133
|
+
{messages.map((message, index) => (
|
|
134
|
+
<Message
|
|
135
|
+
key={message.id}
|
|
136
|
+
message={message}
|
|
137
|
+
isLastMessage={index === messages.length - 1}
|
|
138
|
+
>
|
|
139
|
+
<MessageContent
|
|
140
|
+
message={message}
|
|
141
|
+
thinkingDisplayStyle="collapsible"
|
|
142
|
+
/>
|
|
143
|
+
</Message>
|
|
144
|
+
))}
|
|
103
145
|
</div>
|
|
104
146
|
)}
|
|
105
|
-
</
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
147
|
+
</ChatLayout.Messages>
|
|
108
148
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
<div className="flex-1 overflow-y-auto py-4">
|
|
134
|
-
{messages.length === 0 ? (
|
|
135
|
-
<div className="flex items-center justify-center h-full">
|
|
136
|
-
<div className="text-center text-muted-foreground">
|
|
137
|
-
<p className="text-lg mb-2">No messages yet</p>
|
|
138
|
-
<p className="text-sm">
|
|
139
|
-
{connectionStatus === "connected"
|
|
140
|
-
? "Start a conversation with the agent"
|
|
141
|
-
: "Type a message to test the UI (no server connected)"}
|
|
142
|
-
</p>
|
|
143
|
-
</div>
|
|
144
|
-
</div>
|
|
145
|
-
) : (
|
|
146
|
-
<div className="flex flex-col gap-4 px-4">
|
|
147
|
-
{messages.map((message) => (
|
|
148
|
-
<Message key={message.id} message={message}>
|
|
149
|
-
<MessageContent
|
|
150
|
-
message={message}
|
|
151
|
-
thinkingDisplayStyle="collapsible"
|
|
152
|
-
/>
|
|
153
|
-
</Message>
|
|
154
|
-
))}
|
|
155
|
-
</div>
|
|
156
|
-
)}
|
|
157
|
-
<div ref={messagesEndRef} />
|
|
158
|
-
</div>
|
|
149
|
+
{/* Footer: Input area */}
|
|
150
|
+
<ChatLayout.Footer>
|
|
151
|
+
<ChatInputRoot client={client}>
|
|
152
|
+
<ChatInputCommandMenu commands={commandMenuItems} />
|
|
153
|
+
<ChatInputField
|
|
154
|
+
placeholder="Type a message or / for commands..."
|
|
155
|
+
autoFocus
|
|
156
|
+
/>
|
|
157
|
+
<ChatInputToolbar>
|
|
158
|
+
<div className="flex items-center gap-1">
|
|
159
|
+
<ChatInputActions />
|
|
160
|
+
<ChatInputAttachment />
|
|
161
|
+
</div>
|
|
162
|
+
<div className="flex items-center gap-1">
|
|
163
|
+
<ChatInputVoiceInput />
|
|
164
|
+
<ChatInputSubmit>
|
|
165
|
+
<ArrowRight className="size-4" />
|
|
166
|
+
</ChatInputSubmit>
|
|
167
|
+
</div>
|
|
168
|
+
</ChatInputToolbar>
|
|
169
|
+
</ChatInputRoot>
|
|
170
|
+
</ChatLayout.Footer>
|
|
171
|
+
</ChatLayout.Body>
|
|
172
|
+
</ChatLayout.Main>
|
|
159
173
|
|
|
160
|
-
{/*
|
|
161
|
-
<
|
|
162
|
-
<
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
</
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
174
|
+
{/* Aside: Right side panel - visible on lg+ screens */}
|
|
175
|
+
<ChatLayout.Aside breakpoint="lg">
|
|
176
|
+
<Tabs defaultValue="todo" className="flex flex-col h-full">
|
|
177
|
+
<TabsList className="w-full justify-start rounded-none border-b border-border bg-card px-4">
|
|
178
|
+
<TabsTrigger value="todo">
|
|
179
|
+
<CheckSquare className="h-4 w-4 mr-2" />
|
|
180
|
+
To-Do
|
|
181
|
+
</TabsTrigger>
|
|
182
|
+
<TabsTrigger value="files">
|
|
183
|
+
<FileText className="h-4 w-4 mr-2" />
|
|
184
|
+
Files
|
|
185
|
+
</TabsTrigger>
|
|
186
|
+
</TabsList>
|
|
187
|
+
<TabsContent value="todo" className="flex-1 p-4 mt-0">
|
|
188
|
+
<TodoTabContent todos={todos} />
|
|
189
|
+
</TabsContent>
|
|
190
|
+
<TabsContent value="files" className="flex-1 p-4 mt-0">
|
|
191
|
+
<FilesTabContent />
|
|
192
|
+
</TabsContent>
|
|
193
|
+
</Tabs>
|
|
194
|
+
</ChatLayout.Aside>
|
|
195
|
+
</ChatLayout.Root>
|
|
172
196
|
);
|
|
173
197
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as n}from"./react-BUwpDnu9.js";const u=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),y=o=>o.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),i=o=>{const e=y(o);return e.charAt(0).toUpperCase()+e.slice(1)},l=(...o)=>o.filter((e,t,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===t).join(" ").trim(),C=o=>{for(const e in o)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var _={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const w=n.forwardRef(({color:o="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:s="",children:a,iconNode:h,...d},p)=>n.createElement("svg",{ref:p,..._,width:e,height:e,stroke:o,strokeWidth:r?Number(t)*24/Number(e):t,className:l("lucide",s),...!a&&!C(d)&&{"aria-hidden":"true"},...d},[...h.map(([m,k])=>n.createElement(m,k)),...Array.isArray(a)?a:[a]]));const c=(o,e)=>{const t=n.forwardRef(({className:r,...s},a)=>n.createElement(w,{ref:a,iconNode:e,className:l(`lucide-${u(i(o))}`,`lucide-${o}`,r),...s}));return t.displayName=i(o),t};const f=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],M=c("check",f);const g=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],U=c("chevron-down",g);const $=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],j=c("chevron-up",$);const v=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],z=c("chevrons-up-down",v);const x=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],B=c("circle-check",x);const N=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],D=c("circle",N);const b=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],I=c("loader-circle",b);const A=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],P=c("send",A);const L=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],R=c("x",L);export{U as C,I as L,P as S,R as X,z as a,j as b,M as c,B as d,D as e};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-duration:initial;--tw-ease:initial;--tw-space-x-reverse:0}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-500:oklch(72.3% .219 149.579);--color-gray-500:oklch(55.1% .027 264.364);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--container-lg:32rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--ease-out:cubic-bezier(0,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-background:hsl(var(--background));--color-foreground:hsl(var(--foreground));--color-card:hsl(var(--card));--color-card-foreground:hsl(var(--card-foreground));--color-popover:hsl(var(--popover));--color-popover-foreground:hsl(var(--popover-foreground));--color-primary:hsl(var(--primary));--color-primary-foreground:hsl(var(--primary-foreground));--color-secondary:hsl(var(--secondary));--color-secondary-foreground:hsl(var(--secondary-foreground));--color-muted:hsl(var(--muted));--color-muted-foreground:hsl(var(--muted-foreground));--color-accent:hsl(var(--accent));--color-accent-foreground:hsl(var(--accent-foreground));--color-destructive:hsl(var(--destructive));--color-destructive-foreground:hsl(var(--destructive-foreground));--color-border:hsl(var(--border));--color-input:hsl(var(--input));--color-ring:hsl(var(--ring))}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.inset-0{inset:calc(var(--spacing)*0)}.top-0{top:calc(var(--spacing)*0)}.top-4{top:calc(var(--spacing)*4)}.top-\[50\%\]{top:50%}.top-full{top:100%}.right-0{right:calc(var(--spacing)*0)}.right-4{right:calc(var(--spacing)*4)}.bottom-4{bottom:calc(var(--spacing)*4)}.left-0{left:calc(var(--spacing)*0)}.left-1\/2{left:50%}.left-2{left:calc(var(--spacing)*2)}.left-\[50\%\]{left:50%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.m-0{margin:calc(var(--spacing)*0)}.-mx-1{margin-inline:calc(var(--spacing)*-1)}.my-1{margin-block:calc(var(--spacing)*1)}.my-2{margin-block:calc(var(--spacing)*2)}.my-4{margin-block:calc(var(--spacing)*4)}.my-6{margin-block:calc(var(--spacing)*6)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-5{margin-top:calc(var(--spacing)*5)}.mt-6{margin-top:calc(var(--spacing)*6)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-auto{margin-right:auto}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.field-sizing-content{field-sizing:content}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.h-2{height:calc(var(--spacing)*2)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-11{height:calc(var(--spacing)*11)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-64{max-height:calc(var(--spacing)*64)}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[6lh\]{max-height:6lh}.min-h-\[80px\]{min-height:80px}.w-2{width:calc(var(--spacing)*2)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-10{width:calc(var(--spacing)*10)}.w-full{width:100%}.max-w-\[80\%\]{max-width:80%}.max-w-\[90\%\]{max-width:90%}.max-w-\[200px\]{max-width:200px}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-none{max-width:none}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-\[-50\%\]{--tw-translate-x:-50%;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-\[-50\%\]{--tw-translate-y:-50%;translate:var(--tw-translate-x)var(--tw-translate-y)}.rotate-180{rotate:180deg}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-none{resize:none}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}.self-end{align-self:flex-end}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.overflow-y-hidden{overflow-y:hidden}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-none{border-radius:0}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-r-md{border-top-right-radius:var(--radius-md);border-bottom-right-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-none{--tw-border-style:none;border-style:none}.border-\[primary\]{border-color:primary}.border-border{border-color:var(--color-border)}.border-border\/50{border-color:color-mix(in srgb,hsl(var(--border))50%,transparent)}@supports (color:color-mix(in lab,red,red)){.border-border\/50{border-color:color-mix(in oklab,var(--color-border)50%,transparent)}}.border-destructive{border-color:var(--color-destructive)}.border-green-500{border-color:var(--color-green-500)}.border-input{border-color:var(--color-input)}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-\[var\(--color-bg\)\]{background-color:var(--color-bg)}.bg-background{background-color:var(--color-background)}.bg-black\/80{background-color:#000c}@supports (color:color-mix(in lab,red,red)){.bg-black\/80{background-color:color-mix(in oklab,var(--color-black)80%,transparent)}}.bg-card{background-color:var(--color-card)}.bg-destructive{background-color:var(--color-destructive)}.bg-gray-500{background-color:var(--color-gray-500)}.bg-green-500{background-color:var(--color-green-500)}.bg-muted{background-color:var(--color-muted)}.bg-popover{background-color:var(--color-popover)}.bg-primary{background-color:var(--color-primary)}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-secondary{background-color:var(--color-secondary)}.bg-transparent{background-color:#0000}.bg-yellow-500{background-color:var(--color-yellow-500)}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.px-8{padding-inline:calc(var(--spacing)*8)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-1{padding-top:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pb-1\.5{padding-bottom:calc(var(--spacing)*1.5)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-8{padding-left:calc(var(--spacing)*8)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-\[var\(--font-family\)\]{--tw-font-weight:var(--font-family);font-weight:var(--font-family)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-words{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[var\(--color-text\)\]{color:var(--color-text)}.text-\[var\(--color-text-secondary\)\]{color:var(--color-text-secondary)}.text-\[var\(--font-size\)\]{color:var(--font-size)}.text-card-foreground{color:var(--color-card-foreground)}.text-destructive-foreground{color:var(--color-destructive-foreground)}.text-foreground{color:var(--color-foreground)}.text-green-500{color:var(--color-green-500)}.text-muted-foreground{color:var(--color-muted-foreground)}.text-popover-foreground{color:var(--color-popover-foreground)}.text-primary{color:var(--color-primary)}.text-primary-foreground{color:var(--color-primary-foreground)}.text-red-500{color:var(--color-red-500)}.text-secondary-foreground{color:var(--color-secondary-foreground)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.italic{font-style:italic}.line-through{text-decoration-line:line-through}.decoration-2{text-decoration-thickness:2px}.underline-offset-2{text-underline-offset:2px}.underline-offset-4{text-underline-offset:4px}.accent-\[primary\]{accent-color:primary}.opacity-0{opacity:0}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-offset-background{--tw-ring-offset-color:var(--color-background)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.file\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\:font-medium::file-selector-button{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.file\:text-foreground::file-selector-button{color:var(--color-foreground)}.placeholder\:text-muted-foreground::placeholder{color:var(--color-muted-foreground)}.last\:border-r-0:last-child{border-right-style:var(--tw-border-style);border-right-width:0}@media(hover:hover){.hover\:border-border\/80:hover{border-color:color-mix(in srgb,hsl(var(--border))80%,transparent)}@supports (color:color-mix(in lab,red,red)){.hover\:border-border\/80:hover{border-color:color-mix(in oklab,var(--color-border)80%,transparent)}}.hover\:bg-accent:hover{background-color:var(--color-accent)}.hover\:bg-background:hover{background-color:var(--color-background)}.hover\:bg-card:hover{background-color:var(--color-card)}.hover\:bg-card\/80:hover{background-color:color-mix(in srgb,hsl(var(--card))80%,transparent)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-card\/80:hover{background-color:color-mix(in oklab,var(--color-card)80%,transparent)}}.hover\:bg-card\/90:hover{background-color:color-mix(in srgb,hsl(var(--card))90%,transparent)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-card\/90:hover{background-color:color-mix(in oklab,var(--color-card)90%,transparent)}}.hover\:bg-destructive\/90:hover{background-color:color-mix(in srgb,hsl(var(--destructive))90%,transparent)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,var(--color-destructive)90%,transparent)}}.hover\:bg-primary\/90:hover{background-color:color-mix(in srgb,hsl(var(--primary))90%,transparent)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,var(--color-primary)90%,transparent)}}.hover\:bg-red-600:hover{background-color:var(--color-red-600)}.hover\:bg-secondary\/80:hover{background-color:color-mix(in srgb,hsl(var(--secondary))80%,transparent)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab,var(--color-secondary)80%,transparent)}}.hover\:bg-transparent:hover{background-color:#0000}.hover\:text-accent-foreground:hover{color:var(--color-accent-foreground)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-sm:hover{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-xl:hover{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\:bg-accent:focus{background-color:var(--color-accent)}.focus\:text-accent-foreground:focus{color:var(--color-accent-foreground)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-ring:focus{--tw-ring-color:var(--color-ring)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-destructive:focus-visible{--tw-ring-color:var(--color-destructive)}.focus-visible\:ring-green-500:focus-visible{--tw-ring-color:var(--color-green-500)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:var(--color-ring)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x:calc(var(--spacing)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y:calc(var(--spacing)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:var(--color-background)}.data-\[state\=active\]\:bg-transparent[data-state=active]{background-color:#0000}.data-\[state\=active\]\:text-foreground[data-state=active]{color:var(--color-foreground)}.data-\[state\=active\]\:opacity-100[data-state=active]{opacity:1}.data-\[state\=active\]\:shadow-none[data-state=active]{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:var(--color-accent)}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:var(--color-muted-foreground)}@media(min-width:40rem){.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}:where(.sm\:space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*2)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-x-reverse)))}.sm\:rounded-lg{border-radius:var(--radius-lg)}.sm\:text-left{text-align:left}}@media(prefers-color-scheme:dark){.dark\:bg-transparent{background-color:#0000}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}}:root{--background:0 0% 100%;--foreground:222.2 84% 4.9%;--card:0 0% 100%;--card-foreground:222.2 84% 4.9%;--popover:0 0% 100%;--popover-foreground:222.2 84% 4.9%;--primary:222.2 47.4% 11.2%;--primary-foreground:210 40% 98%;--secondary:210 40% 96.1%;--secondary-foreground:222.2 47.4% 11.2%;--muted:210 40% 96.1%;--muted-foreground:215.4 16.3% 46.9%;--accent:210 40% 96.1%;--accent-foreground:222.2 47.4% 11.2%;--destructive:0 84.2% 60.2%;--destructive-foreground:210 40% 98%;--border:214.3 31.8% 91.4%;--input:214.3 31.8% 91.4%;--ring:222.2 84% 4.9%;--radius:.5rem}.dark{--background:222.2 84% 4.9%;--foreground:210 40% 98%;--card:222.2 84% 4.9%;--card-foreground:210 40% 98%;--popover:222.2 84% 4.9%;--popover-foreground:210 40% 98%;--primary:210 40% 98%;--primary-foreground:222.2 47.4% 11.2%;--secondary:217.2 32.6% 17.5%;--secondary-foreground:210 40% 98%;--muted:217.2 32.6% 17.5%;--muted-foreground:215 20.2% 65.1%;--accent:217.2 32.6% 17.5%;--accent-foreground:210 40% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:210 40% 98%;--border:217.2 32.6% 17.5%;--input:217.2 32.6% 17.5%;--ring:212.7 26.8% 83.9%}@keyframes spin{to{transform:rotate(360deg)}}@keyframes enter{0%{opacity:0;transform:scale(.9)}to{opacity:1;transform:scale(1)}}@keyframes exit{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.9)}}@keyframes slideDownAndFade{0%{opacity:0;transform:translateY(-2px)}to{opacity:1;transform:translateY(0)}}@keyframes slideLeftAndFade{0%{opacity:0;transform:translate(2px)}to{opacity:1;transform:translate(0)}}@keyframes slideUpAndFade{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@keyframes slideRightAndFade{0%{opacity:0;transform:translate(-2px)}to{opacity:1;transform:translate(0)}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@keyframes pulse{50%{opacity:.5}}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{r as i,j as s,M as Me,e as Pe,a as $e}from"./react-BUwpDnu9.js";import{L as Fe,M as C,N as k,O as A,P as h,Q as T,R as M,S as H,T as D,U as E,W as P,X as Ue,Y as He,Z as Le,$ as I}from"./vendor-CNJ4Zu8U.js";import{P as ze,a as Oe}from"./acp-sdk-DjnJtAf8.js";import{S as B,L as W,T as Q,C as K,R as _e,O as Y,P as Ve,a as G,b as qe,c as J,D as X,d as Z,e as ee,I as Be,f as te,g as se,h as We,i as ne,V as Qe,j as re,k as oe,l as Ke,m as Ye,n as ae}from"./radix-zBfH0NEp.js";import{X as Ge,C as L,L as ie,a as Je,b as Xe,c as Ze,d as et,e as tt,S as st}from"./icons-B1wHwGRq.js";import{r as nt}from"./markdown-BLVKlqjB.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const d of l)if(d.type==="childList")for(const u of d.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function t(l){const d={};return l.integrity&&(d.integrity=l.integrity),l.referrerPolicy&&(d.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?d.credentials="include":l.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(l){if(l.ep)return;l.ep=!0;const d=t(l);fetch(l.href,d)}})();const j=Fe(n=>({connectionStatus:"disconnected",sessionId:null,error:null,messages:[],isStreaming:!1,streamingStartTime:null,input:{value:"",isSubmitting:!1,attachedFiles:[]},setConnectionStatus:e=>n({connectionStatus:e}),setSessionId:e=>n({sessionId:e}),setError:e=>n({error:e}),addMessage:e=>n(t=>({messages:[...t.messages,e]})),updateMessage:(e,t)=>n(r=>({messages:r.messages.map(l=>l.id===e?{...l,...t}:l)})),clearMessages:()=>n({messages:[]}),setIsStreaming:e=>n({isStreaming:e}),setStreamingStartTime:e=>n({streamingStartTime:e}),setInputValue:e=>n(t=>({input:{...t.input,value:e}})),setInputSubmitting:e=>n(t=>({input:{...t.input,isSubmitting:e}})),addFileAttachment:e=>n(t=>({input:{...t.input,attachedFiles:[...t.input.attachedFiles,e]}})),removeFileAttachment:e=>n(t=>({input:{...t.input,attachedFiles:t.input.attachedFiles.filter((r,l)=>l!==e)}})),clearInput:()=>n(e=>({input:{value:"",isSubmitting:!1,attachedFiles:[]}}))}));function le(n){const e=j(a=>a.messages),t=j(a=>a.isStreaming),r=j(a=>a.sessionId),l=j(a=>a.setIsStreaming),d=j(a=>a.setStreamingStartTime),u=j(a=>a.addMessage),m=j(a=>a.updateMessage),f=j(a=>a.setError),o=i.useCallback(async a=>{if(!n){console.error("❌ No client available"),f("No client available");return}if(!r){console.error("❌ No active session"),f("No active session");return}try{const c=Date.now();l(!0),d(c);const g={id:`msg_${Date.now()}_user`,role:"user",content:a,timestamp:new Date().toISOString(),isStreaming:!1};u(g);const y=`msg_${Date.now()}_assistant`,x={id:y,role:"assistant",content:"",timestamp:new Date().toISOString(),isStreaming:!0,streamingStartTime:c};u(x);const S=e.filter(b=>b.role!=="system").map(b=>`${b.role==="user"?"Human":"Assistant"}: ${b.content}`).join(`
|
|
2
|
-
|
|
3
|
-
`),N=S?`${S}
|
|
4
|
-
|
|
5
|
-
Human: ${a}`:a,w=n.receiveMessages();n.sendMessage(N,r).catch(b=>{const R=b instanceof Error?b.message:String(b);f(R),l(!1),d(null)});let v="";for await(const b of w)if(b.isComplete){m(y,{content:v,isStreaming:!1,streamingStartTime:void 0}),l(!1),d(null);break}else b.contentDelta.type==="text"&&(v+=b.contentDelta.text,m(y,{content:v}),await new Promise(R=>setTimeout(R,16)))}catch(c){const g=c instanceof Error?c.message:String(c);f(g),l(!1),d(null)}},[n,r,e,u,m,l,d,f]);return{messages:e,isStreaming:t,sendMessage:o}}function rt(n){const e=j(c=>c.input),t=j(c=>c.setInputValue),r=j(c=>c.setInputSubmitting),l=j(c=>c.addFileAttachment),d=j(c=>c.removeFileAttachment),{sendMessage:u}=le(n),m=i.useCallback(c=>{t(c)},[t]),f=i.useCallback(async()=>{if(!e.value.trim()||e.isSubmitting)return;const c=e.value;t(""),r(!0);try{await u(c)}catch(g){console.error("Failed to send message:",g)}finally{r(!1)}},[e,t,r,u]),o=i.useCallback(c=>{l(c)},[l]),a=i.useCallback(c=>{d(c)},[d]);return{value:e.value,isSubmitting:e.isSubmitting,attachedFiles:e.attachedFiles,onChange:m,onSubmit:f,onAttachFile:o,onRemoveFile:a}}function ot(n){const e=j(a=>a.connectionStatus),t=j(a=>a.sessionId),r=j(a=>a.setConnectionStatus),l=j(a=>a.setSessionId),d=j(a=>a.setError),u=j(a=>a.clearMessages),m=i.useCallback(async()=>{if(!n){d("No client available");return}try{r("connecting"),d(null),await n.connect(),r("connected")}catch(a){console.log(a);const c=a instanceof Error?a.message:String(a);d(c),r("error")}},[n,r,d]),f=i.useCallback(async()=>{if(!n){d("No client available");return}try{const a=await n.startSession();l(a),u()}catch(a){const c=a instanceof Error?a.message:String(a);d(c)}},[n,l,d,u]),o=i.useCallback(async()=>{if(n)try{await n.disconnect(),r("disconnected"),l(null)}catch(a){const c=a instanceof Error?a.message:String(a);d(c)}},[n,r,l,d]);return i.useEffect(()=>{n&&e==="disconnected"&&m()},[n,e,m]),i.useEffect(()=>{e==="connected"&&!t&&f()},[e,t,f]),{connectionStatus:e,sessionId:t,connect:m,startSession:f,disconnect:o}}const at=C({id:h(),role:D(["user","assistant","system"]),content:h(),timestamp:H(),isStreaming:M().default(!1),streamingStartTime:T().optional(),metadata:k(h(),A()).optional()}),it=C({value:h(),isSubmitting:M(),attachedFiles:E(C({name:h(),path:h(),size:T(),mimeType:h()}))});C({sessionId:h().nullable(),isConnected:M(),isStreaming:M(),messages:E(at),input:it,error:h().nullable()});D(["disconnected","connecting","connected","error"]);class lt{connected=!1;sessionUpdateCallbacks=new Set;errorCallbacks=new Set;messageQueue=[];currentSessionId=null;chunkResolvers=[];streamComplete=!1;sseAbortController=null;reconnectAttempts=0;maxReconnectAttempts=5;reconnectDelay=1e3;reconnecting=!1;abortController=null;options;constructor(e){this.options={...e,baseUrl:e.baseUrl.replace(/\/$/,"")}}async connect(){if(!this.connected)try{this.abortController=new AbortController;const e={protocolVersion:ze,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},t=await this.sendRpcRequest("initialize",e);console.log("ACP connection initialized:",t);const r={cwd:"/",mcpServers:[]},l=await this.sendRpcRequest("session/new",r);this.currentSessionId=l.sessionId,console.log("Session created:",this.currentSessionId),await this.connectSSE(),this.connected=!0,this.reconnectAttempts=0}catch(e){this.connected=!1;const t=e instanceof Error?e:new Error(String(e));throw this.notifyError(t),t}}async disconnect(){if(this.connected)try{this.abortController&&(this.abortController.abort(),this.abortController=null),this.sseAbortController&&(this.sseAbortController.abort(),this.sseAbortController=null),this.connected=!1,this.currentSessionId=null,this.messageQueue=[],this.chunkResolvers=[],this.streamComplete=!1,this.reconnecting=!1,this.reconnectAttempts=0}catch(e){const t=e instanceof Error?e:new Error(String(e));throw this.notifyError(t),t}}async send(e){if(!this.connected||!this.currentSessionId)throw new Error("Transport not connected");try{this.streamComplete=!1,this.messageQueue=[];const t=e.content.filter(u=>u.type==="text").map(u=>u.text).join(`
|
|
6
|
-
`),r={sessionId:this.currentSessionId,prompt:[{type:"text",text:t}]},l=await this.sendRpcRequest("session/prompt",r);console.log("Prompt sent:",l),this.streamComplete=!0;const d=this.chunkResolvers.shift();d?d({id:this.currentSessionId||"unknown",role:"assistant",contentDelta:{type:"text",text:""},isComplete:!0}):this.messageQueue.push({id:this.currentSessionId||"unknown",role:"assistant",contentDelta:{type:"text",text:""},isComplete:!0})}catch(t){this.streamComplete=!0;const r=t instanceof Error?t:new Error(String(t));throw this.notifyError(r),r}}async*receive(){for(;!this.streamComplete;)if(this.messageQueue.length>0){const e=this.messageQueue.shift();if(e&&(yield e,e.isComplete))return}else{const e=await new Promise(t=>{this.chunkResolvers.push(t)});if(e.isComplete){yield e;return}else yield e}for(;this.messageQueue.length>0;){const e=this.messageQueue.shift();e&&(yield e)}yield{id:this.currentSessionId||"unknown",role:"assistant",contentDelta:{type:"text",text:""},isComplete:!0}}isConnected(){return this.connected}onSessionUpdate(e){return this.sessionUpdateCallbacks.add(e),()=>{this.sessionUpdateCallbacks.delete(e)}}onError(e){return this.errorCallbacks.add(e),()=>{this.errorCallbacks.delete(e)}}async sendRpcRequest(e,t){const l={jsonrpc:"2.0",id:this.generateRequestId(),method:e,params:t},d={"Content-Type":"application/json",...this.options.headers},u=this.options.timeout||3e4,m=new AbortController,f=setTimeout(()=>m.abort(),u);try{const o=await fetch(`${this.options.baseUrl}/rpc`,{method:"POST",headers:d,body:JSON.stringify(l),signal:m.signal});if(clearTimeout(f),!o.ok){const c=await o.text();throw new Error(`HTTP ${o.status}: ${c}`)}const a=await o.json();if(a.error)throw new Error(`ACP error: ${a.error.message||JSON.stringify(a.error)}`);return a.result||a}catch(o){throw clearTimeout(f),o instanceof Error&&o.name==="AbortError"?new Error(`Request timeout after ${u}ms`):o}}async connectSSE(){if(!this.currentSessionId)throw new Error("Cannot connect SSE without a session ID");const e=`${this.options.baseUrl}/events`,t={"X-Session-ID":this.currentSessionId,...this.options.headers};this.sseAbortController=new AbortController;try{const r=await fetch(e,{method:"GET",headers:t,signal:this.sseAbortController.signal});if(!r.ok)throw new Error(`SSE connection failed: HTTP ${r.status}`);if(!r.body)throw new Error("Response body is null");console.log("SSE connection opened"),this.reconnectAttempts=0,this.reconnectDelay=1e3;const l=r.body.getReader(),d=new TextDecoder;let u="";(async()=>{try{for(;;){const{done:m,value:f}=await l.read();if(m){console.log("SSE stream closed by server"),this.connected&&await this.handleSSEDisconnect();break}u+=d.decode(f,{stream:!0});const o=u.split(`
|
|
7
|
-
`);u=o.pop()||"";let a={event:"message",data:""};for(const c of o)c.startsWith("event:")?a.event=c.substring(6).trim():c.startsWith("data:")?a.data=c.substring(5).trim():c===""&&(a.event==="message"&&a.data&&this.handleSSEMessage(a.data),a={event:"message",data:""})}}catch(m){if(m instanceof Error&&m.name==="AbortError"){console.log("SSE stream aborted");return}console.error("Error reading SSE stream:",m),this.connected&&!this.reconnecting&&await this.handleSSEDisconnect()}})()}catch(r){throw console.error("SSE connection error:",r),r}}async handleSSEDisconnect(){if(this.reconnecting||!this.connected)return;if(this.reconnecting=!0,this.sseAbortController&&(this.sseAbortController.abort(),this.sseAbortController=null),this.reconnectAttempts>=this.maxReconnectAttempts){const t=new Error(`SSE reconnection failed after ${this.maxReconnectAttempts} attempts`);this.notifyError(t),this.connected=!1,this.reconnecting=!1;return}this.reconnectAttempts++;const e=Math.min(this.reconnectDelay*2**(this.reconnectAttempts-1),32e3);console.log(`SSE reconnecting in ${e}ms (attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts})`),await new Promise(t=>setTimeout(t,e));try{await this.connectSSE(),console.log("SSE reconnected successfully"),this.reconnecting=!1}catch(t){console.error("SSE reconnection failed:",t),this.reconnecting=!1}}handleSSEMessage(e){try{const t=JSON.parse(e),r=Oe.safeParse(t);if(!r.success){console.error("Invalid ACP message from SSE:",r.error.issues);return}const l=r.data;"method"in l&&l.method==="session/update"&&"params"in l&&l.params&&this.handleSessionNotification(l.params)}catch(t){console.error("Error parsing SSE message:",t),this.notifyError(t instanceof Error?t:new Error(String(t)))}}handleSessionNotification(e){const r=e.update,l={sessionId:this.currentSessionId||e.sessionId,status:"active"};if(r?.content){const d=r.content;let u=null;if(d.type==="text"&&d.text?u={id:e.sessionId,role:"assistant",contentDelta:{type:"text",text:d.text},isComplete:!1}:d.type==="tool_call"&&(u={id:e.sessionId,role:"assistant",contentDelta:d,isComplete:!1}),u){const m=this.chunkResolvers.shift();m?m(u):this.messageQueue.push(u)}}this.notifySessionUpdate(l)}generateRequestId(){return`req-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}notifySessionUpdate(e){for(const t of this.sessionUpdateCallbacks)try{t(e)}catch(r){console.error("Error in session update callback:",r)}}notifyError(e){for(const t of this.errorCallbacks)try{t(e)}catch(r){console.error("Error in error callback:",r)}}}class ct{constructor(){throw new Error("StdioTransport is not available in the browser. Use HttpTransport or WebSocketTransport instead.")}async connect(){throw new Error("StdioTransport not available in browser")}async disconnect(){}async send(){throw new Error("StdioTransport not available in browser")}async*receive(){throw new Error("StdioTransport not available in browser")}isConnected(){return!1}onSessionUpdate(){return()=>{}}onError(){return()=>{}}}class dt{ws=null;connected=!1;sessionUpdateCallbacks=new Set;errorCallbacks=new Set;constructor(e){}async connect(){throw new Error("WebSocketTransport not yet implemented. Waiting for HTTP ACP server.")}async disconnect(){this.ws&&(this.ws.close(),this.ws=null),this.connected=!1}async send(e){throw!this.connected||!this.ws?new Error("Transport not connected"):new Error("WebSocketTransport not yet implemented. Waiting for HTTP ACP server.")}async*receive(){throw new Error("WebSocketTransport not yet implemented. Waiting for HTTP ACP server.")}isConnected(){return this.connected}onSessionUpdate(e){return this.sessionUpdateCallbacks.add(e),()=>{this.sessionUpdateCallbacks.delete(e)}}onError(e){return this.errorCallbacks.add(e),()=>{this.errorCallbacks.delete(e)}}}class ut{config;transport;sessions=new Map;currentSessionId=null;sessionUpdateHandlers=new Set;errorHandlers=new Set;constructor(e){this.config=e,this.transport=this.createTransport(),this.setupTransportListeners(),e.autoConnect&&this.connect().catch(t=>{console.error("Failed to auto-connect:",t)})}async connect(){await this.transport.connect()}async disconnect(){await this.transport.disconnect(),this.currentSessionId=null}isConnected(){return this.transport.isConnected()}async startSession(e){const t=this.generateSessionId(),r=new Date().toISOString(),l={id:t,status:"connecting",config:e?{...e,agentPath:e.agentPath||""}:{agentPath:""},messages:[],metadata:{startedAt:r}};return this.sessions.set(t,l),this.currentSessionId=t,this.updateSessionStatus(t,"connected"),t}async sendMessage(e,t){const r=t||this.currentSessionId;if(!r)throw new Error("No active session. Start a session first.");if(!this.transport.isConnected())throw new Error("Transport not connected");const l=this.sessions.get(r);if(!l)throw new Error(`Session ${r} not found`);const d={id:this.generateMessageId(),role:"user",content:[{type:"text",text:e}],timestamp:new Date().toISOString()};l.messages.push(d),this.updateSessionStatus(r,"active"),await this.transport.send(d)}async*receiveMessages(){if(!this.transport.isConnected())throw new Error("Transport not connected");yield*this.transport.receive()}getSession(e){return this.sessions.get(e)}getCurrentSession(){return this.currentSessionId?this.sessions.get(this.currentSessionId):void 0}getAllSessions(){return Array.from(this.sessions.values())}onSessionUpdate(e){return this.sessionUpdateHandlers.add(e),()=>{this.sessionUpdateHandlers.delete(e)}}onError(e){return this.errorHandlers.add(e),()=>{this.errorHandlers.delete(e)}}createTransport(){switch(this.config.type){case"stdio":return new ct(this.config.options);case"http":return new lt(this.config.options);case"websocket":return new dt(this.config.options);default:throw new Error(`Unknown transport type: ${this.config.type}`)}}setupTransportListeners(){this.transport.onSessionUpdate(e=>{this.handleSessionUpdate(e)}),this.transport.onError(e=>{this.handleError(e)})}handleSessionUpdate(e){if(e.sessionId){const t=this.sessions.get(e.sessionId);t&&(e.status&&(t.status=e.status),e.message&&t.messages.push(e.message),e.error&&(t.error=e.error))}for(const t of this.sessionUpdateHandlers)try{t(e)}catch(r){console.error("Error in session update handler:",r)}}handleError(e){for(const t of this.errorHandlers)try{t(e)}catch(r){console.error("Error in error handler:",r)}}updateSessionStatus(e,t){const r=this.sessions.get(e);r&&(r.status=t,this.handleSessionUpdate({sessionId:e,status:t}))}generateSessionId(){return`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}generateMessageId(){return`msg_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}}const ft=C({name:h(),description:h().optional(),parameters:k(h(),A()).optional()}),mt=C({name:h(),description:h(),parameters:k(h(),A()),required:E(h()).optional()}),pt=C({name:h(),version:h().optional(),description:h().optional(),author:h().optional(),capabilities:E(ft).optional(),tools:E(mt).optional(),supportedFormats:E(h()).optional()}),ht=D(["initializing","ready","busy","error","terminated"]);C({status:ht,info:pt.optional(),pid:T().optional(),error:h().optional(),uptime:T().optional()});const ce=D(["user","assistant","system","tool"]),gt=D(["text","image","file","tool_call","tool_result"]),$=C({type:gt}),xt=$.extend({type:P("text"),text:h()}),bt=$.extend({type:P("image"),url:h().url().optional(),data:h().optional(),mimeType:h().optional()}),yt=$.extend({type:P("file"),name:h(),path:h().optional(),url:h().url().optional(),mimeType:h(),size:T().optional()}),wt=$.extend({type:P("tool_call"),id:h(),name:h(),arguments:k(h(),A())}),vt=$.extend({type:P("tool_result"),callId:h(),result:A(),error:h().optional()}),de=Ue("type",[xt,bt,yt,wt,vt]),ue=C({id:h(),role:ce,content:E(de),timestamp:H(),metadata:k(h(),A()).optional()});C({id:h(),role:ce,contentDelta:de,isComplete:M()});const fe=D(["idle","connecting","connected","active","streaming","error","disconnected"]),St=C({agentPath:h(),agentArgs:E(h()).optional(),environment:k(h(),h()).optional(),workingDirectory:h().optional(),timeout:T().optional()}),Nt=C({agentName:h().optional(),agentVersion:h().optional(),capabilities:E(h()).optional(),startedAt:H(),lastActivityAt:H().optional()});C({id:h(),status:fe,config:St,metadata:Nt.optional(),messages:E(ue),error:h().optional()});C({sessionId:h(),status:fe.optional(),message:ue.optional(),error:h().optional()});function p(...n){return He(Le(n))}const jt=I("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),me=i.forwardRef(({className:n,variant:e,size:t,asChild:r=!1,...l},d)=>{const u=r?B:"button";return s.jsx(u,{className:p(jt({variant:e,size:t,className:n})),ref:d,...l})});me.displayName="Button";const Ct=i.forwardRef(({className:n,...e},t)=>s.jsx("div",{ref:t,className:p("rounded-lg border bg-card text-card-foreground shadow-sm",n),...e}));Ct.displayName="Card";const Et=i.forwardRef(({className:n,...e},t)=>s.jsx("div",{ref:t,className:p("flex flex-col space-y-1.5 p-6",n),...e}));Et.displayName="CardHeader";const Rt=i.forwardRef(({className:n,...e},t)=>s.jsx("div",{ref:t,className:p("text-2xl font-semibold leading-none tracking-tight",n),...e}));Rt.displayName="CardTitle";const It=i.forwardRef(({className:n,...e},t)=>s.jsx("div",{ref:t,className:p("text-sm text-muted-foreground",n),...e}));It.displayName="CardDescription";const Tt=i.forwardRef(({className:n,...e},t)=>s.jsx("div",{ref:t,className:p("p-6 pt-0",n),...e}));Tt.displayName="CardContent";const kt=i.forwardRef(({className:n,...e},t)=>s.jsx("div",{ref:t,className:p("flex items-center p-6 pt-0",n),...e}));kt.displayName="CardFooter";const pe=i.createContext(void 0),he=()=>{const n=i.useContext(pe);if(!n)throw new Error("ChatInput components must be used within ChatInput.Root");return n},ge=i.forwardRef(({client:n,value:e,onChange:t,onSubmit:r,disabled:l=!1,isSubmitting:d,submitOnEnter:u=!0,className:m,children:f,...o},a)=>{const c=i.useRef(null),g=rt(n??null),y=j(b=>b.isStreaming),x=g?g.value:e||"",S=g?g.onChange:t||(()=>{}),N=g?g.onSubmit:r||(async()=>{}),w=g?g.isSubmitting||y:d||!1,v=async b=>{b.preventDefault(),x.trim()&&!w&&!l&&(await N(),setTimeout(()=>{c.current?.focus()},0))};return i.useEffect(()=>{const b=document.querySelector('textarea[name="chat-input"]');b&&c.current!==b&&(c.current=b)},[]),i.useEffect(()=>{!x&&c.current&&(c.current.style.height="auto",c.current.style.overflowY="hidden")},[x]),s.jsx(pe.Provider,{value:{value:x,onChange:S,onSubmit:N,disabled:l,isSubmitting:w,submitOnEnter:u},children:s.jsx("form",{ref:a,onSubmit:v,className:p("w-full divide-y overflow-hidden rounded-xl border bg-background shadow-sm",m),...o,children:f})})});ge.displayName="ChatInput.Root";const xe=i.forwardRef(({asChild:n=!1,className:e,onKeyDown:t,children:r,...l},d)=>{const{value:u,onChange:m,onSubmit:f,disabled:o,isSubmitting:a,submitOnEnter:c}=he(),g=i.useRef(null),N={ref:i.useCallback(w=>{g.current=w,typeof d=="function"?d(w):d&&(d.current=w)},[d]),name:"chat-input",value:u,onChange:w=>{m(w.target.value);const v=g.current;if(!v)return;v.style.height="auto";const b=Math.min(v.scrollHeight,164);v.style.height=`${b}px`,v.scrollHeight>164?v.style.overflowY="auto":v.style.overflowY="hidden"},onKeyDown:w=>{c&&w.key==="Enter"&&!w.shiftKey&&(u.trim()&&!a&&!o?(w.preventDefault(),f()):(a||o)&&w.preventDefault()),t?.(w)},disabled:o,...l};return n&&i.isValidElement(r)?i.cloneElement(r,N):s.jsx("textarea",{...N,className:p("w-full resize-none rounded-none border-none p-3 shadow-none","outline-none ring-0 field-sizing-content max-h-[6lh]","bg-transparent dark:bg-transparent focus-visible:ring-0","text-sm placeholder:text-muted-foreground","disabled:cursor-not-allowed disabled:opacity-50",e)})});xe.displayName="ChatInput.Field";const be=i.forwardRef(({asChild:n=!1,className:e,disabled:t,children:r,...l},d)=>{const{value:u,disabled:m,isSubmitting:f}=he(),o=t||m||f||!u.trim(),a=n?B:me;return s.jsx(a,{ref:d,type:"submit",disabled:o,size:"icon",className:p(!n&&"gap-1.5 rounded-lg bg-transparent text-foreground hover:bg-transparent",e),...l,children:r})});be.displayName="ChatInput.Submit";const ye=i.forwardRef(({className:n,children:e,...t},r)=>s.jsx("div",{ref:r,className:p("flex items-center justify-between p-1",n),...t,children:e}));ye.displayName="ChatInput.Toolbar";const At=_e,z=i.forwardRef(({className:n,...e},t)=>s.jsx(W,{ref:t,className:p("inline-flex h-10 items-center rounded-md bg-muted p-1 text-muted-foreground gap-1",n),...e}));z.displayName=W.displayName;const O=i.forwardRef(({className:n,...e},t)=>s.jsx(Q,{ref:t,className:p("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",n),...e}));O.displayName=Q.displayName;const U=i.forwardRef(({className:n,...e},t)=>s.jsx(K,{ref:t,className:p("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n),...e}));U.displayName=K.displayName;const we=i.forwardRef(({todo:n,className:e,...t},r)=>s.jsx("div",{ref:r,className:p("flex items-center gap-3 px-3 py-2 rounded-lg",e),...t,children:s.jsx("span",{className:p("flex-1 text-[var(--font-size)] font-[var(--font-family)]",n.status==="completed"&&"line-through opacity-60",n.status==="in_progress"&&"shimmer-animation"),children:n.text})}));we.displayName="TodoListItem";const ve=i.forwardRef(({client:n,todos:e,className:t,...r},l)=>{const d=e||[];return s.jsx("div",{ref:l,className:p("space-y-2 max-h-64 overflow-y-auto",t),...r,children:d.length===0?s.jsx("p",{className:"text-sm text-foreground opacity-60 italic",children:"No tasks yet."}):d.map(u=>s.jsx(we,{todo:u},u.id))})});ve.displayName="TodoList";const Se=i.forwardRef(({client:n,todos:e,className:t,...r},l)=>{const d=e||[],[u,m]=i.useState("todo"),f=i.useRef(null),o=i.useRef(null);i.useEffect(()=>{const g=setTimeout(()=>{const y=f.current;if(u&&y){const x=o.current;if(x){const S=y.getBoundingClientRect(),N=x.getBoundingClientRect(),w=N.left-S.left,v=N.width,b=w/S.width*100,R=100-(w+v)/S.width*100;y.style.clipPath=`inset(0 ${R.toFixed(2)}% 0 ${b.toFixed(2)}% round 999px)`}}},0);return()=>clearTimeout(g)},[u]);const a=[{id:"todo",label:"To-Do List"},{id:"files",label:"Files"},{id:"database",label:"Database"}];return s.jsx("div",{ref:l,className:p("select-none",t),...r,children:s.jsxs(At,{value:u,onValueChange:m,className:"w-full",children:[s.jsxs("div",{className:"relative mb-4 border-border",children:[s.jsx(z,{className:"bg-transparent p-0 h-auto rounded-none w-full border-none",children:a.map(c=>s.jsx(O,{value:c.id,className:"px-3 py-1 text-sm font-[var(--font-family)] font-medium rounded-none text-foreground opacity-60 data-[state=active]:opacity-100 data-[state=active]:bg-transparent data-[state=active]:shadow-none",children:c.label},c.id))}),s.jsx("div",{ref:f,className:"absolute top-0 left-0 w-full overflow-hidden z-10 pointer-events-none",style:{clipPath:"inset(0 100% 0 0% round 999px)",transition:"clip-path 0.25s ease-out"},children:s.jsx(z,{className:"bg-secondary p-0 h-auto rounded-none w-full border-none",children:a.map(c=>s.jsx(O,{value:c.id,ref:u===c.id?o:null,className:"px-3 py-1 text-sm font-[var(--font-family)] font-medium rounded-none text-primary bg-transparent data-[state=active]:shadow-none shadow-none",tabIndex:-1,children:c.label},c.id))})})]}),s.jsx(U,{value:"todo",children:s.jsx(ve,{todos:d})}),s.jsx(U,{value:"files",children:s.jsx("div",{className:"text-sm text-foreground opacity-60 italic",children:"Files tab coming soon..."})}),s.jsx(U,{value:"database",children:s.jsx("div",{className:"text-sm text-foreground opacity-60 italic",children:"Database tab coming soon..."})})]})})});Se.displayName="ChatSecondaryPanel";const Dt=i.forwardRef(({children:n,className:e,...t},r)=>{const[l,d]=i.useState(n),[u,m]=i.useState(!1),f=i.useRef(n),o=i.useRef(!0);return i.useEffect(()=>{if(o.current){o.current=!1,f.current=n;return}if(f.current===n)return;m(!0);const a=setTimeout(()=>{d(n),f.current=n,requestAnimationFrame(()=>{m(!1)})},150);return()=>{clearTimeout(a)}},[n]),s.jsx("span",{ref:r,className:p("text-sm text-foreground opacity-60 transition-opacity duration-300",u?"opacity-0":"opacity-60",e),...t,children:l})});Dt.displayName="ChatStatus";const Mt=i.forwardRef(({autoScroll:n=!0,isStreaming:e=!1,scrollBehavior:t="smooth",scrollThreshold:r=100,showScrollButton:l=!0,scrollButton:d,className:u,children:m,...f},o)=>{const a=i.useRef(null),[c,g]=i.useState(!0),[y,x]=i.useState(!1),S=i.useRef(0);i.useImperativeHandle(o,()=>{if(!a.current)throw new Error("Container ref not initialized");return a.current});const N=i.useCallback(()=>{const v=a.current;if(!v)return;const{scrollTop:b,scrollHeight:R,clientHeight:De}=v,_=R-b-De<r;g(_),x(!_&&l),S.current=b},[r,l]),w=i.useCallback((v=t)=>{const b=a.current;b&&b.scrollTo({top:b.scrollHeight,behavior:v})},[t]);return i.useEffect(()=>{!n||!a.current||(e&&c?w("auto"):!e&&c&&w())},[n,e,c,w]),i.useEffect(()=>{const v=a.current;if(!v)return;const b=()=>{N()};return v.addEventListener("scroll",b,{passive:!0}),N(),()=>{v.removeEventListener("scroll",b)}},[N]),i.useEffect(()=>{const v=a.current;if(!v)return;const b=new ResizeObserver(()=>{c&&n&&w("auto")});return b.observe(v),()=>{b.disconnect()}},[c,n,w]),s.jsxs("div",{className:"relative flex-1",children:[s.jsx("div",{ref:a,className:p("h-full overflow-y-auto overflow-x-hidden","scrollbar-thin scrollbar-thumb-[border] scrollbar-track-transparent",u),...f,children:s.jsx("div",{className:"flex flex-col gap-4 px-4 py-4",children:m})}),y&&s.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-10",children:d||s.jsxs("button",{type:"button",onClick:()=>w(),className:"px-4 py-2 rounded-full bg-card border border-border shadow-lg hover:shadow-xl hover:bg-card/90 transition-all text-sm font-medium text-foreground flex items-center gap-2","aria-label":"Scroll to bottom",children:[s.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Down arrow",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 14l-7 7m0 0l-7-7m7 7V3"})}),"Scroll to bottom"]})})]})});Mt.displayName="Conversation";const Pt=Ve,Ne=i.forwardRef(({className:n,...e},t)=>s.jsx(Y,{ref:t,className:p("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...e}));Ne.displayName=Y.displayName;const $t=i.forwardRef(({className:n,children:e,...t},r)=>s.jsxs(Pt,{children:[s.jsx(Ne,{}),s.jsxs(G,{ref:r,className:p("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...t,children:[e,s.jsxs(qe,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[s.jsx(Ge,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));$t.displayName=G.displayName;const Ft=i.forwardRef(({className:n,...e},t)=>s.jsx(J,{ref:t,className:p("text-lg font-semibold leading-none tracking-tight",n),...e}));Ft.displayName=J.displayName;const Ut=i.forwardRef(({className:n,...e},t)=>s.jsx(X,{ref:t,className:p("text-sm text-muted-foreground",n),...e}));Ut.displayName=X.displayName;function Ht({children:n,durationMs:e=320,easing:t="ease",pinContentTo:r="top",className:l}){const d=i.useRef(null),u=i.useRef(null),m=i.useRef(null),f=i.useRef(!1),o=i.useRef(e),a=i.useRef(t);i.useEffect(()=>{o.current=e,a.current=t},[e,t]);const c=i.useCallback(y=>{const x=d.current,S=u.current;if(!x||!S)return;const N=m.current??x.getBoundingClientRect().height;if(Math.abs(N-y)<.5){m.current=y,x.style.height=`${y}px`;return}f.current||(f.current=!0,x.style.transition="none",x.style.height=`${N}px`,x.getBoundingClientRect(),x.style.transition=`height ${o.current}ms ${a.current}`,x.style.height=`${y}px`,S.style.position="absolute",r==="top"?S.style.top="0":S.style.bottom="0",m.current=y)},[r]),g=i.useCallback(y=>{const x=d.current,S=u.current;!x||!S||y.propertyName==="height"&&y.target===x&&(x.style.transition="",x.style.height="auto",S.style.removeProperty("position"),S.style.removeProperty("top"),S.style.removeProperty("bottom"),f.current=!1)},[]);return i.useEffect(()=>{const y=d.current,x=u.current;if(!y||!x)return;const S=x.scrollHeight;m.current=S;const N=new ResizeObserver(()=>{const w=x.scrollHeight;c(w)});return N.observe(x),y.addEventListener("transitionend",g),()=>{N.disconnect(),y.removeEventListener("transitionend",g)}},[g,c]),s.jsx("div",{ref:d,className:p("overflow-hidden relative",l),style:{willChange:"height"},children:s.jsx("div",{ref:u,className:"w-full",children:n})})}const Lt=I("flex h-10 w-full rounded-md border bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",{variants:{variant:{default:"border-input focus-visible:ring-ring",error:"border-destructive focus-visible:ring-destructive",success:"border-green-500 focus-visible:ring-green-500"}},defaultVariants:{variant:"default"}}),zt=i.forwardRef(({className:n,type:e,variant:t,...r},l)=>s.jsx("input",{type:e,className:p(Lt({variant:t,className:n})),ref:l,...r}));zt.displayName="Input";const Ot=i.forwardRef(({className:n,...e},t)=>s.jsx(Z,{ref:t,className:p("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",n),...e}));Ot.displayName=Z.displayName;const _t=I("flex animate-fadeIn",{variants:{role:{user:"max-w-[80%] self-end ml-auto",assistant:"self-start mr-auto",system:"self-start mr-auto max-w-full"},layout:{default:"",full:"max-w-full",compact:"max-w-[90%]"}},defaultVariants:{role:"assistant",layout:"default"}}),je=i.forwardRef(({message:n,role:e,layout:t,className:r,children:l,messageId:d,...u},m)=>{const f=n?n.role:e||"assistant",o=n?n.id:d;return s.jsx("article",{ref:m,"aria-label":`${f} message`,"data-message-id":o,className:p(_t({role:f,layout:t}),r),...u,children:l})});je.displayName="Message";const V=I("mb-3 rounded-lg bg-card border border-border transition-all",{variants:{variant:{default:"opacity-70",subtle:"opacity-50",prominent:"opacity-90 shadow-sm"}},defaultVariants:{variant:"default"}}),Vt=I("w-4 h-4 text-foreground opacity-60 transition-transform duration-200",{variants:{expanded:{true:"rotate-180",false:""}},defaultVariants:{expanded:!1}}),Ce=i.forwardRef(({content:n,isStreaming:e=!1,mode:t="collapsible",defaultExpanded:r=!1,autoExpand:l=!1,autoCollapse:d=!0,autoCollapseDelay:u=2e3,label:m="Thinking",variant:f,className:o},a)=>{const[c,g]=i.useState(t==="inline"?!0:r),[y,x]=i.useState(!1);return i.useEffect(()=>{if(d&&!e&&n&&t==="collapsible"){const S=setTimeout(()=>{x(!0),g(!1)},u);return()=>clearTimeout(S)}},[e,n,d,u,t]),i.useEffect(()=>{l&&e&&t==="collapsible"&&!y&&g(!0)},[l,e,t,y]),!n&&!e?null:t==="inline"?s.jsxs("div",{ref:a,className:p(V({variant:f}),"p-3",o),children:[s.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[s.jsx("span",{className:"text-xs font-medium text-foreground opacity-60 uppercase tracking-wide",children:m}),e&&s.jsx("span",{className:"inline-block w-2 h-2 bg-primary rounded-full animate-pulse"})]}),s.jsxs("div",{className:"text-sm italic text-foreground opacity-80 leading-relaxed whitespace-pre-wrap",children:[n,e&&n&&s.jsx("span",{className:"inline-block animate-typing text-primary",children:"..."})]})]}):s.jsxs("div",{ref:a,className:p("mb-3",o),children:[s.jsxs("button",{type:"button",onClick:()=>{g(!c),x(!1)},className:"w-full flex items-center justify-between p-2.5 rounded-lg bg-card border border-border hover:bg-card/80 hover:shadow-sm transition-all text-left","aria-expanded":c,"aria-label":`${c?"Collapse":"Expand"} reasoning`,children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[s.jsx("span",{className:"text-xs font-medium text-foreground opacity-60 uppercase tracking-wide shrink-0",children:m}),e&&s.jsx("span",{className:"inline-block w-2 h-2 bg-primary rounded-full animate-pulse shrink-0"}),!c&&n&&s.jsxs("span",{className:"text-xs text-foreground opacity-50 truncate",children:[n.substring(0,60),n.length>60&&"..."]})]}),s.jsx(L,{className:Vt({expanded:c}),"aria-hidden":"true"})]}),c&&s.jsx("div",{className:p(V({variant:f}),"mt-2 p-3 animate-fadeIn"),children:s.jsxs("div",{className:"text-sm italic text-foreground opacity-80 leading-relaxed whitespace-pre-wrap",children:[n,e&&n&&s.jsx("span",{className:"inline-block animate-typing text-primary",children:"..."})]})})]})});Ce.displayName="Reasoning";const Ee=i.forwardRef(({content:n,isStreaming:e=!1,showEmpty:t=!0,emptyMessage:r="",className:l,...d},u)=>{if(!n&&e&&t)return s.jsx("div",{ref:u,className:p("opacity-70 italic text-sm",l),...d,children:r});if(!n)return null;const m={table:({node:f,...o})=>s.jsx("div",{className:"overflow-x-auto my-4",children:s.jsx("table",{className:"min-w-full border-collapse border border-border rounded-md",...o})}),thead:({node:f,...o})=>s.jsx("thead",{className:"bg-card border-b border-border",...o}),tbody:({node:f,...o})=>s.jsx("tbody",{...o}),tr:({node:f,...o})=>s.jsx("tr",{className:"border-b border-border hover:bg-card transition-colors",...o}),th:({node:f,...o})=>s.jsx("th",{className:"px-4 py-2 text-left font-semibold text-foreground border-r border-border last:border-r-0",...o}),td:({node:f,...o})=>s.jsx("td",{className:"px-4 py-2 text-foreground border-r border-border last:border-r-0",...o}),input:({node:f,checked:o,...a})=>a.type==="checkbox"?s.jsx("input",{type:"checkbox",checked:o||!1,disabled:!0,readOnly:!0,className:"mr-2 w-4 h-4 accent-[primary] cursor-not-allowed",...a}):s.jsx("input",{...a}),code:({node:f,...o})=>o.className?.includes("language-")?s.jsx("code",{className:"block p-4 bg-card border border-border rounded-md overflow-x-auto text-sm font-mono text-foreground shadow-sm",...o}):s.jsx("code",{className:"px-1.5 py-0.5 bg-card border border-border rounded text-sm font-mono text-foreground",...o}),pre:({node:f,...o})=>s.jsx("pre",{className:"my-4 rounded-lg",...o}),h1:({node:f,...o})=>s.jsx("h1",{className:"text-2xl font-bold mt-6 mb-4 text-foreground border-b border-border pb-2",...o}),h2:({node:f,...o})=>s.jsx("h2",{className:"text-xl font-semibold mt-5 mb-3 text-foreground border-b border-border/50 pb-1.5",...o}),h3:({node:f,...o})=>s.jsx("h3",{className:"text-lg font-semibold mt-4 mb-2 text-foreground",...o}),h4:({node:f,...o})=>s.jsx("h4",{className:"text-base font-semibold mt-3 mb-2 text-foreground",...o}),ul:({node:f,...o})=>{const a=f?.children?.some(c=>typeof c=="object"&&c!==null&&"type"in c&&c.type==="element"&&"tagName"in c&&c.tagName==="li"&&"children"in c&&Array.isArray(c.children)&&c.children.some(g=>typeof g=="object"&&g!==null&&"type"in g&&g.type==="element"&&"tagName"in g&&g.tagName==="input"&&"properties"in g&&typeof g.properties=="object"&&g.properties!==null&&"type"in g.properties&&g.properties.type==="checkbox"));return s.jsx("ul",{className:p("my-2 space-y-1 text-foreground",a?"list-none space-y-2":"list-disc list-inside"),...o})},ol:({node:f,...o})=>s.jsx("ol",{className:"list-decimal list-inside my-2 space-y-1 text-foreground",...o}),li:({node:f,...o})=>{const a=f?.children?.some(c=>typeof c=="object"&&c!==null&&"type"in c&&c.type==="element"&&"tagName"in c&&c.tagName==="input"&&"properties"in c&&typeof c.properties=="object"&&c.properties!==null&&"type"in c.properties&&c.properties.type==="checkbox");return s.jsx("li",{className:p("flex items-start",a?"gap-2":"ml-2"),...o})},a:({node:f,...o})=>s.jsx("a",{className:"text-primary hover:underline decoration-2 underline-offset-2 transition-all",target:"_blank",rel:"noopener noreferrer",...o}),p:({node:f,...o})=>s.jsx("p",{className:"my-2 text-foreground leading-relaxed",...o}),blockquote:({node:f,...o})=>s.jsx("blockquote",{className:"border-l-4 border-[primary] pl-4 italic my-4 text-foreground bg-card py-2 rounded-r-md shadow-sm",...o}),hr:({node:f,...o})=>s.jsx("hr",{className:"my-6 border-t border-border opacity-50",...o})};return s.jsxs("div",{ref:u,className:p("markdown-content prose prose-sm max-w-none dark:prose-invert",l),...d,children:[s.jsx(Me,{remarkPlugins:[nt],components:m,children:n}),e&&n&&s.jsx("span",{className:"inline-block ml-1 animate-typing text-primary",children:"..."})]})});Ee.displayName="Response";const F=["Thinking","Pensando","Pensant","Denkend","Pensando","考えている","생각 중","思考中","Размышляя","Düşünüyor","Myślący","Tänkande","Pensando","Ajatellen","Σκεπτόμενος","חושב","सोच रहा है","Berpikir"],q=["...","·..",".·.","..·",".·.","·.."];function qt({startTime:n}){const[e,t]=i.useState(0),[r,l]=i.useState(()=>F[Math.floor(Math.random()*F.length)]),[d,u]=i.useState(0);i.useEffect(()=>{const o=setInterval(()=>{const c=Date.now()-n;t(c)},100);return()=>clearInterval(o)},[n]),i.useEffect(()=>{const o=setInterval(()=>{const a=Math.floor(Math.random()*F.length);l(F[a])},1500);return()=>clearInterval(o)},[]),i.useEffect(()=>{const o=setInterval(()=>{u(a=>(a+1)%q.length)},100);return()=>clearInterval(o)},[]);const m=(e/1e3).toFixed(1),f=q[d];return s.jsxs("span",{className:"text-muted-foreground text-sm",children:[r,f," ",m,"s"]})}const Bt=I("w-full px-4 py-3 rounded-xl text-[var(--font-size)] font-[var(--font-family)] leading-relaxed break-words transition-colors",{variants:{role:{user:"bg-primary text-primary-foreground shadow-sm",assistant:"bg-muted text-foreground",system:"bg-card border border-border text-foreground opacity-80 text-sm"},variant:{default:"",outline:"border border-border",ghost:"bg-transparent"}},defaultVariants:{role:"assistant",variant:"default"}}),Re=i.forwardRef(({role:n,variant:e,isStreaming:t,message:r,thinkingDisplayStyle:l="collapsible",className:d,children:u,...m},f)=>{const o=j(x=>x.streamingStartTime),a=r&&!u,c=a?r.role:n||"assistant",g=a?r.isStreaming:t;let y=u;if(a){const x=r.metadata?.thinking,S=!!x,N=r.isStreaming&&!r.content&&r.role==="assistant";y=s.jsxs(s.Fragment,{children:[r.role==="assistant"&&S&&s.jsx(Ce,{content:x,isStreaming:r.isStreaming,mode:l,autoCollapse:!0}),N&&o&&s.jsxs("div",{className:"flex items-center gap-2 opacity-50",children:[s.jsx(ie,{className:"size-4 animate-spin text-muted-foreground"}),s.jsx(qt,{startTime:o})]}),r.role==="user"?s.jsx("div",{className:"whitespace-pre-wrap",children:r.content}):s.jsx(Ee,{content:r.content,isStreaming:r.isStreaming,showEmpty:!1})]})}return s.jsx("div",{ref:f,className:p(Bt({role:c,variant:e}),g&&"animate-pulse-subtle",d),...m,children:y})});Re.displayName="MessageContent";const Wt=i.forwardRef(({className:n,children:e,...t},r)=>s.jsxs(ee,{ref:r,className:p("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",n),...t,children:[e,s.jsx(Be,{asChild:!0,children:s.jsx(Je,{className:"h-4 w-4 opacity-50"})})]}));Wt.displayName=ee.displayName;const Ie=i.forwardRef(({className:n,...e},t)=>s.jsx(te,{ref:t,className:p("flex cursor-default items-center justify-center py-1",n),...e,children:s.jsx(Xe,{className:"h-4 w-4"})}));Ie.displayName=te.displayName;const Te=i.forwardRef(({className:n,...e},t)=>s.jsx(se,{ref:t,className:p("flex cursor-default items-center justify-center py-1",n),...e,children:s.jsx(L,{className:"h-4 w-4"})}));Te.displayName=se.displayName;const Qt=i.forwardRef(({className:n,children:e,position:t="popper",...r},l)=>s.jsx(We,{children:s.jsxs(ne,{ref:l,className:p("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n),position:t,...r,children:[s.jsx(Ie,{}),s.jsx(Qe,{className:p("p-1",t==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),s.jsx(Te,{})]})}));Qt.displayName=ne.displayName;const Kt=i.forwardRef(({className:n,...e},t)=>s.jsx(re,{ref:t,className:p("py-1.5 pl-8 pr-2 text-sm font-semibold",n),...e}));Kt.displayName=re.displayName;const Yt=i.forwardRef(({className:n,children:e,...t},r)=>s.jsxs(oe,{ref:r,className:p("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...t,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(Ke,{children:s.jsx(Ze,{className:"h-4 w-4"})})}),s.jsx(Ye,{children:e})]}));Yt.displayName=oe.displayName;const Gt=i.forwardRef(({className:n,...e},t)=>s.jsx(ae,{ref:t,className:p("-mx-1 my-1 h-px bg-muted",n),...e}));Gt.displayName=ae.displayName;const ke=i.forwardRef(({task:n,collapsible:e=!0,defaultExpanded:t=!1,onTaskClick:r,className:l,...d},u)=>{const[m,f]=i.useState(t),o=!!(n.details||n.files&&n.files.length>0),a={pending:tt,in_progress:ie,completed:et}[n.status],c=()=>{switch(n.status){case"completed":return"text-green-500";case"in_progress":return"text-primary";default:return"text-foreground opacity-40"}},g=()=>{o&&e&&f(!m),r?.(n)};return s.jsxs("div",{ref:u,className:p("rounded-lg border border-border bg-card transition-all","hover:shadow-sm hover:border-border/80",l),...d,children:[s.jsxs("button",{type:"button",onClick:g,className:p("w-full flex items-center gap-3 px-3 py-2.5 text-left",o&&e&&"cursor-pointer"),disabled:!o&&!e,children:[s.jsx(a,{className:p("w-4 h-4 shrink-0",c(),n.status==="in_progress"&&"animate-spin")}),s.jsx("span",{className:p("flex-1 text-sm font-[var(--font-family)]",n.status==="completed"&&"line-through opacity-60",n.status==="in_progress"&&"font-medium"),children:n.text}),o&&e&&s.jsx(L,{className:p("w-4 h-4 text-foreground opacity-50 transition-transform duration-200 shrink-0",m&&"rotate-180"),"aria-hidden":"true"})]}),o&&m&&s.jsxs("div",{className:"px-3 pb-3 pt-1 border-t border-border/50 animate-fadeIn",children:[n.details&&s.jsx("p",{className:"text-sm text-foreground opacity-80 leading-relaxed mb-2",children:n.details}),n.files&&n.files.length>0&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("span",{className:"text-xs font-medium text-foreground opacity-60 uppercase tracking-wide",children:"Files:"}),s.jsx("div",{className:"space-y-1",children:n.files.map(y=>s.jsx("div",{className:"text-xs font-mono text-foreground opacity-70 bg-background px-2 py-1 rounded border border-border/50",children:y},y))})]})]})]})});ke.displayName="Task";const Jt=i.forwardRef(({tasks:n,collapsible:e=!0,onTaskClick:t,emptyMessage:r="No tasks yet.",className:l,...d},u)=>s.jsx("div",{ref:u,className:p("space-y-2 max-h-96 overflow-y-auto",l),...d,children:n.length===0?s.jsx("p",{className:"text-sm text-foreground opacity-60 italic py-4 text-center",children:r}):n.map(m=>s.jsx(ke,{task:m,collapsible:e,...t?{onTaskClick:t}:{}},m.id))}));Jt.displayName="TaskList";const Xt=I("flex min-h-[80px] w-full rounded-md border bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 resize-none",{variants:{variant:{default:"border-input focus-visible:ring-ring",error:"border-destructive focus-visible:ring-destructive",success:"border-green-500 focus-visible:ring-green-500"}},defaultVariants:{variant:"default"}}),Zt=i.forwardRef(({className:n,autoResize:e=!1,maxHeight:t=200,variant:r,...l},d)=>{const u=i.useRef(null),m=i.useCallback(o=>{u.current=o,typeof d=="function"?d(o):d&&(d.current=o)},[d]),f=i.useCallback(()=>{const o=u.current;if(!o||!e)return;o.style.height="auto";const a=Math.min(o.scrollHeight,t);o.style.height=`${a}px`,o.scrollHeight>t?o.style.overflowY="auto":o.style.overflowY="hidden"},[e,t]);return i.useEffect(()=>{f()},[f]),s.jsx("textarea",{className:p(Xt({variant:r}),e&&"overflow-y-hidden",n),ref:m,...l})});Zt.displayName="Textarea";function es({client:n}){const{connectionStatus:e,connect:t}=ot(n),{messages:r}=le(n),l=j(c=>c.error),d=i.useRef(null),[u,m]=i.useState(!1),[f]=i.useState([]);i.useEffect(()=>{d.current?.scrollIntoView({behavior:"smooth"})});const o=()=>{switch(e){case"connected":return"bg-green-500";case"connecting":return"bg-yellow-500";case"error":return"bg-red-500";default:return"bg-gray-500"}},a=()=>{switch(e){case"connected":return"Connected";case"connecting":return"Connecting...";case"error":return"Connection Error";default:return"No Server"}};return s.jsxs("div",{className:"flex flex-col h-screen bg-background text-foreground",children:[s.jsxs("div",{className:"relative border-b border-border bg-card z-10",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4",children:[s.jsx("h1",{className:"text-xl font-semibold m-0",children:"Agent Chat"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:p("w-2 h-2 rounded-full",o())}),s.jsx("span",{className:"text-sm text-muted-foreground",children:a()})]}),s.jsx("button",{type:"button",onClick:()=>m(!u),className:"p-1 rounded hover:bg-background transition-colors","aria-label":u?"Collapse header":"Expand header",children:s.jsx(L,{className:p("w-5 h-5 text-foreground transition-transform duration-200",u&&"rotate-180")})})]})]}),s.jsx("div",{className:"absolute top-full left-0 right-0 z-20",children:s.jsx(Ht,{children:u&&s.jsx("div",{className:"bg-card border-b border-border px-6 py-4 shadow-lg",children:s.jsx(Se,{todos:f})})})})]}),e==="error"&&l&&s.jsx("div",{className:"bg-red-500/10 border-b border-red-500/20 px-6 py-4",children:s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"text-sm font-semibold text-red-500 mb-1",children:"Connection Error"}),s.jsx("p",{className:"text-sm text-foreground whitespace-pre-line",children:l})]}),s.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg bg-red-500 text-white font-medium hover:bg-red-600 transition-colors",children:"Retry"})]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto py-4",children:[r.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center text-muted-foreground",children:[s.jsx("p",{className:"text-lg mb-2",children:"No messages yet"}),s.jsx("p",{className:"text-sm",children:e==="connected"?"Start a conversation with the agent":"Type a message to test the UI (no server connected)"})]})}):s.jsx("div",{className:"flex flex-col gap-4 px-4",children:r.map(c=>s.jsx(je,{message:c,children:s.jsx(Re,{message:c,thinkingDisplayStyle:"collapsible"})},c.id))}),s.jsx("div",{ref:d})]}),s.jsx("div",{className:"p-4 bg-background",children:s.jsxs(ge,{client:n,children:[s.jsx(xe,{placeholder:"Type a message..."}),s.jsx(ye,{className:"justify-end",children:s.jsx(be,{children:s.jsx(st,{className:"size-4"})})})]})})]})}function ts(){return"http://localhost:3100"}const ss={agentServerUrl:ts()};function ns(){const[n,e]=i.useState(null),[t,r]=i.useState(null);return i.useEffect(()=>{try{const l=new ut({type:"http",options:{baseUrl:ss.agentServerUrl}});return e(l),()=>{l.disconnect().catch(console.error)}}catch(l){const d=l instanceof Error?l.message:"Failed to initialize ACP client";r(d),console.error("Failed to initialize ACP client:",l);return}},[]),t?s.jsx("div",{className:"flex items-center justify-center h-screen bg-[var(--color-bg)]",children:s.jsxs("div",{className:"text-center p-8 max-w-md",children:[s.jsx("h1",{className:"text-2xl font-bold text-red-500 mb-4",children:"Initialization Error"}),s.jsx("p",{className:"text-[var(--color-text)] mb-4",children:t}),s.jsx("p",{className:"text-sm text-[var(--color-text-secondary)]",children:"Failed to initialize the ACP client. Check the console for details."})]})}):s.jsx(es,{client:n})}const Ae=document.getElementById("root");if(!Ae)throw new Error("Root element not found");Pe.createRoot(Ae).render(s.jsx($e.StrictMode,{children:s.jsx(ns,{})}));
|