@townco/gui-template 0.1.0
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/README.md +176 -0
- package/dist/assets/acp-sdk-DjnJtAf8.js +1 -0
- package/dist/assets/icons-B1wHwGRq.js +1 -0
- package/dist/assets/index-B6Vo9iGc.css +1 -0
- package/dist/assets/index-C9pfdbke.js +7 -0
- package/dist/assets/markdown-BLVKlqjB.js +1 -0
- package/dist/assets/radix-zBfH0NEp.js +5 -0
- package/dist/assets/react-BUwpDnu9.js +49 -0
- package/dist/assets/vendor-CNJ4Zu8U.js +48 -0
- package/dist/index.html +19 -0
- package/index.html +12 -0
- package/package.json +42 -0
- package/postcss.config.js +5 -0
- package/src/App.tsx +54 -0
- package/src/ChatView.tsx +173 -0
- package/src/config.ts +14 -0
- package/src/env.d.ts +9 -0
- package/src/main.tsx +13 -0
- package/vite.config.ts +94 -0
package/README.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Agent GUI
|
|
2
|
+
|
|
3
|
+
A fullscreen chat interface for interacting with the agent, built using the same core architecture and schemas as the TUI.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Clean, fullscreen chat interface
|
|
8
|
+
- Uses core hooks and schemas from `@town/ui/core` (same as TUI)
|
|
9
|
+
- ACP (Agent Client Protocol) SDK integration
|
|
10
|
+
- Configurable agent server URL via environment variables
|
|
11
|
+
- Static build output for production deployment
|
|
12
|
+
- Ready for HTTP/WebSocket transport integration
|
|
13
|
+
|
|
14
|
+
## Development
|
|
15
|
+
|
|
16
|
+
### Prerequisites
|
|
17
|
+
|
|
18
|
+
The GUI connects to the agent via HTTP. You need to have the HTTP agent server running.
|
|
19
|
+
|
|
20
|
+
### Quick Start
|
|
21
|
+
|
|
22
|
+
1. **Install dependencies** (from the project root):
|
|
23
|
+
```bash
|
|
24
|
+
bun install
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
2. **Start the HTTP agent server** (in one terminal):
|
|
28
|
+
```bash
|
|
29
|
+
bun run dev:agent-http
|
|
30
|
+
```
|
|
31
|
+
This starts the agent server on `http://localhost:3100`
|
|
32
|
+
|
|
33
|
+
3. **Start the GUI dev server** (in another terminal):
|
|
34
|
+
```bash
|
|
35
|
+
bun run dev:gui
|
|
36
|
+
```
|
|
37
|
+
Or from the gui directory:
|
|
38
|
+
```bash
|
|
39
|
+
cd apps/gui
|
|
40
|
+
bun run dev
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
4. **Open your browser** to `http://localhost:5173`
|
|
44
|
+
|
|
45
|
+
The GUI will automatically connect to the agent server and you can start chatting!
|
|
46
|
+
|
|
47
|
+
## Configuration
|
|
48
|
+
|
|
49
|
+
The app uses environment variables to configure the agent server connection:
|
|
50
|
+
|
|
51
|
+
- `VITE_AGENT_URL`: The URL of the agent server (defaults to `http://localhost:3000`)
|
|
52
|
+
|
|
53
|
+
A `.env` file is already configured with the default HTTP agent server URL:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
VITE_AGENT_URL=http://localhost:3100
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
To change the URL, edit `apps/gui/.env` or set the environment variable:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
VITE_AGENT_URL=http://your-server:port bun run dev
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Production Build
|
|
66
|
+
|
|
67
|
+
Build the app for production:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
bun run build
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This will create optimized static files in the `dist/` directory that can be served by any static file server.
|
|
74
|
+
|
|
75
|
+
### Preview Production Build
|
|
76
|
+
|
|
77
|
+
To preview the production build locally:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
bun run preview
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Architecture
|
|
84
|
+
|
|
85
|
+
The GUI app uses React Context for state management (simpler than Zustand used by TUI):
|
|
86
|
+
|
|
87
|
+
### Core Components
|
|
88
|
+
- **`ChatContext`** - React Context provider for state management
|
|
89
|
+
- Manages messages, connection status, streaming state
|
|
90
|
+
- Handles message sending and client lifecycle
|
|
91
|
+
- Provides `useChatContext` hook
|
|
92
|
+
|
|
93
|
+
- **`@town/ui/sdk`** - ACP Client SDK
|
|
94
|
+
- `AcpClient` - Agent communication client
|
|
95
|
+
- Transport abstraction (HTTP, WebSocket, Stdio)
|
|
96
|
+
|
|
97
|
+
- **`@town/ui/gui`** - React UI components
|
|
98
|
+
- `MessageList` - Message display with markdown rendering
|
|
99
|
+
- Uses core `DisplayMessage` schema with metadata support
|
|
100
|
+
|
|
101
|
+
- **Core Schemas** - Shared types from `@town/ui/core`
|
|
102
|
+
- `DisplayMessage` - Same schema as TUI
|
|
103
|
+
- `ConnectionStatus` - Shared connection states
|
|
104
|
+
|
|
105
|
+
### Data Flow
|
|
106
|
+
```
|
|
107
|
+
App
|
|
108
|
+
↓
|
|
109
|
+
ChatProvider (React Context)
|
|
110
|
+
↓
|
|
111
|
+
ChatView (React UI - useChatContext hook)
|
|
112
|
+
↓
|
|
113
|
+
AcpClient (SDK)
|
|
114
|
+
↓
|
|
115
|
+
Transport (HTTP/WebSocket)
|
|
116
|
+
↓
|
|
117
|
+
Agent Server
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Why Context instead of Zustand?**
|
|
121
|
+
- Simpler for React apps (no external state library)
|
|
122
|
+
- More natural React patterns
|
|
123
|
+
- Smaller bundle size (~60KB less)
|
|
124
|
+
- TUI keeps Zustand (better for terminal apps)
|
|
125
|
+
|
|
126
|
+
## Project Structure
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
apps/gui/
|
|
130
|
+
├── src/
|
|
131
|
+
│ ├── main.tsx # React entry point
|
|
132
|
+
│ ├── App.tsx # Root component with ChatProvider
|
|
133
|
+
│ ├── ChatContext.tsx # React Context for state management
|
|
134
|
+
│ ├── ChatView.tsx # Main chat UI component
|
|
135
|
+
│ ├── config.ts # Configuration (env vars)
|
|
136
|
+
│ ├── types.ts # Re-exports core types
|
|
137
|
+
│ └── env.d.ts # Vite environment type definitions
|
|
138
|
+
├── index.html # HTML entry file
|
|
139
|
+
├── package.json # Dependencies and scripts
|
|
140
|
+
└── vite.config.ts # Vite configuration (browser-compatible)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Tech Stack
|
|
144
|
+
|
|
145
|
+
- **React 18** - UI framework with Context API for state
|
|
146
|
+
- **Vite** - Build tool and dev server
|
|
147
|
+
- **TypeScript** - Type safety
|
|
148
|
+
- **Tailwind CSS** - Styling
|
|
149
|
+
- **@town/ui** - Shared UI components and SDK
|
|
150
|
+
- **Zod** - Schema validation (via @town/ui/core)
|
|
151
|
+
|
|
152
|
+
## Current Status
|
|
153
|
+
|
|
154
|
+
✅ **Fully Functional**: The GUI is now connected to the HTTP agent server!
|
|
155
|
+
|
|
156
|
+
**What Works:**
|
|
157
|
+
- ✅ HTTP transport implementation with ACP protocol
|
|
158
|
+
- ✅ Real-time message streaming via Server-Sent Events (SSE)
|
|
159
|
+
- ✅ Connection management with automatic reconnection
|
|
160
|
+
- ✅ Full chat interface with message history
|
|
161
|
+
- ✅ Uses core schemas shared with TUI
|
|
162
|
+
- ✅ Browser-compatible build (stdio transport stubbed out)
|
|
163
|
+
|
|
164
|
+
**Connection States:**
|
|
165
|
+
- **Connecting...** - Yellow indicator, establishing connection
|
|
166
|
+
- **Connected** - Green indicator, ready to chat
|
|
167
|
+
- **Connection Error** - Red indicator, check that agent server is running
|
|
168
|
+
- **No Server** - Gray indicator, fallback to mock responses if server unavailable
|
|
169
|
+
|
|
170
|
+
**How It Works:**
|
|
171
|
+
1. App initializes `AcpClient` with HTTP transport
|
|
172
|
+
2. Client connects to agent server at `VITE_AGENT_URL` (default: `http://localhost:3100`)
|
|
173
|
+
3. Creates a new session via ACP protocol
|
|
174
|
+
4. Opens SSE connection for receiving agent responses
|
|
175
|
+
5. Sends prompts via POST to `/rpc` endpoint
|
|
176
|
+
6. Receives streaming responses via GET from `/events` endpoint
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as h,a as p,s as e,o,r as a,u as t,b as l,l as n,c as s,d as m}from"./vendor-CNJ4Zu8U.js";const Qe=1,x=h(),C=p(),w=e(),q=o({_meta:a(t()).optional(),content:e(),path:e(),sessionId:e()}),f=o({_meta:a(t()).optional(),limit:p().optional().nullable(),line:p().optional().nullable(),path:e(),sessionId:e()}),M=o({_meta:a(t()).optional(),sessionId:e(),terminalId:e()}),k=o({_meta:a(t()).optional(),sessionId:e(),terminalId:e()}),v=o({_meta:a(t()).optional(),sessionId:e(),terminalId:e()}),O=o({_meta:a(t()).optional(),sessionId:e(),terminalId:e()}),F=a(t()),U=l([n("assistant"),n("user")]),z=o({_meta:a(t()).optional(),mimeType:e().optional().nullable(),text:e(),uri:e()}),N=o({_meta:a(t()).optional(),blob:e(),mimeType:e().optional().nullable(),uri:e()}),b=l([n("read"),n("edit"),n("delete"),n("move"),n("search"),n("execute"),n("think"),n("fetch"),n("switch_mode"),n("other")]),_=l([n("pending"),n("in_progress"),n("completed"),n("failed")]),S=o({code:p(),data:a(t()).optional(),message:e()}),E=o({_meta:a(t()).optional()}),P=o({_meta:t().optional()}),V=o({_meta:a(t()).optional(),stopReason:l([n("end_turn"),n("max_tokens"),n("max_turn_requests"),n("refusal"),n("cancelled")])}),j=o({_meta:a(t()).optional()}),L=a(t()),B=e(),H=a(t()),K=o({hint:e()}),A=h(),D=p(),G=e(),J=o({_meta:a(t()).optional(),methodId:e()}),Q=o({_meta:a(t()).optional(),modeId:e(),sessionId:e()}),W=o({_meta:a(t()).optional(),modelId:e(),sessionId:e()}),X=a(t()),d=o({_meta:a(t()).optional(),name:e(),value:e()}),i=o({_meta:a(t()).optional(),audience:s(U).optional().nullable(),lastModified:e().optional().nullable(),priority:p().optional().nullable()}),c=l([z,N]),Y=o({_meta:a(t()).optional()}),Z=o({_meta:a(t()).optional(),content:e()}),$=o({_meta:a(t()).optional(),outcome:l([o({outcome:n("cancelled")}),o({optionId:e(),outcome:n("selected")})])}),ee=o({_meta:a(t()).optional(),terminalId:e()}),oe=o({_meta:a(t()).optional()}),te=o({_meta:a(t()).optional(),exitCode:p().optional().nullable(),signal:e().optional().nullable()}),ae=o({_meta:a(t()).optional()}),ne=a(t()),le=o({_meta:a(t()).optional(),sessionId:e()}),ie=a(t()),se=o({_meta:a(t()).optional(),kind:l([n("allow_once"),n("allow_always"),n("reject_once"),n("reject_always")]),name:e(),optionId:e()}),u=l([o({content:l([o({_meta:a(t()).optional(),annotations:i.optional().nullable(),text:e(),type:n("text")}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),data:e(),mimeType:e(),type:n("image"),uri:e().optional().nullable()}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),data:e(),mimeType:e(),type:n("audio")}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),description:e().optional().nullable(),mimeType:e().optional().nullable(),name:e(),size:p().optional().nullable(),title:e().optional().nullable(),type:n("resource_link"),uri:e()}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),resource:c,type:n("resource")})]),type:n("content")}),o({_meta:a(t()).optional(),newText:e(),oldText:e().optional().nullable(),path:e(),type:n("diff")}),o({terminalId:e(),type:n("terminal")})]),r=o({_meta:a(t()).optional(),line:p().optional().nullable(),path:e()}),y=o({_meta:a(t()).optional(),name:e(),value:e()}),R=o({name:e(),title:e().optional().nullable(),version:e()}),pe=o({_meta:a(t()).optional(),description:e().optional().nullable(),id:e(),name:e()}),me=o({_meta:a(t()).optional(),http:m().optional(),sse:m().optional()}),ce=o({_meta:a(t()).optional(),audio:m().optional(),embeddedContext:m().optional(),image:m().optional()}),ue=o({_meta:a(t()).optional(),description:e().optional().nullable(),modelId:e(),name:e()}),re=o({_meta:a(t()).optional(),description:e().optional().nullable(),id:B,name:e()}),T=o({_meta:a(t()).optional(),availableModels:s(ue),currentModelId:e()}),I=o({_meta:a(t()).optional(),availableModes:s(re),currentModeId:e()}),de=o({_meta:a(t()).optional(),content:e(),priority:l([n("high"),n("medium"),n("low")]),status:l([n("pending"),n("in_progress"),n("completed")])}),he=K,be=o({_meta:a(t()).optional(),readTextFile:m().optional(),writeTextFile:m().optional()}),_e=o({args:s(e()),command:e(),env:s(y),name:e()}),g=l([o({headers:s(d),name:e(),type:n("http"),url:e()}),o({headers:s(d),name:e(),type:n("sse"),url:e()}),_e]),Se=l([o({_meta:a(t()).optional(),annotations:i.optional().nullable(),text:e(),type:n("text")}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),data:e(),mimeType:e(),type:n("image"),uri:e().optional().nullable()}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),data:e(),mimeType:e(),type:n("audio")}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),description:e().optional().nullable(),mimeType:e().optional().nullable(),name:e(),size:p().optional().nullable(),title:e().optional().nullable(),type:n("resource_link"),uri:e()}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),resource:c,type:n("resource")})]),ye=o({_meta:a(t()).optional(),exitCode:p().optional().nullable(),signal:e().optional().nullable()}),Re=l([le,ie]),Te=o({_meta:a(t()).optional(),options:s(se),sessionId:e(),toolCall:o({_meta:a(t()).optional(),content:s(u).optional().nullable(),kind:b.optional().nullable(),locations:s(r).optional().nullable(),rawInput:a(t()).optional(),rawOutput:a(t()).optional(),status:_.optional().nullable(),title:e().optional().nullable(),toolCallId:e()})}),Ie=o({_meta:a(t()).optional(),args:s(e()).optional(),command:e(),cwd:e().optional().nullable(),env:s(y).optional(),outputByteLimit:p().optional().nullable(),sessionId:e()}),ge=o({_meta:a(t()).optional(),models:T.optional().nullable(),modes:I.optional().nullable(),sessionId:e()}),xe=o({_meta:a(t()).optional(),models:T.optional().nullable(),modes:I.optional().nullable()}),Ce=o({method:e(),params:Re.optional().nullable()}),we=o({_meta:a(t()).optional(),cwd:e(),mcpServers:s(g)}),qe=o({_meta:a(t()).optional(),cwd:e(),mcpServers:s(g),sessionId:e()}),fe=o({_meta:a(t()).optional(),prompt:s(Se),sessionId:e()}),Me=o({_meta:a(t()).optional(),exitStatus:ye.optional().nullable(),output:e(),truncated:m()}),ke=l([q,f,Te,Ie,M,k,v,O,F]),ve=o({_meta:a(t()).optional(),loadSession:m().optional(),mcpCapabilities:me.optional(),promptCapabilities:ce.optional()}),Oe=o({_meta:a(t()).optional(),description:e(),input:he.optional().nullable(),name:e()}),Fe=o({_meta:a(t()).optional(),fs:be.optional(),terminal:m().optional()}),Ue=o({id:l([x,C,w]),method:e(),params:ke.optional().nullable()}),ze=o({_meta:a(t()).optional(),agentCapabilities:ve.optional(),agentInfo:R.optional().nullable(),authMethods:s(pe).optional(),protocolVersion:p()}),Ne=o({_meta:a(t()).optional(),sessionId:e(),update:l([o({_meta:a(t()).optional(),content:l([o({_meta:a(t()).optional(),annotations:i.optional().nullable(),text:e(),type:n("text")}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),data:e(),mimeType:e(),type:n("image"),uri:e().optional().nullable()}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),data:e(),mimeType:e(),type:n("audio")}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),description:e().optional().nullable(),mimeType:e().optional().nullable(),name:e(),size:p().optional().nullable(),title:e().optional().nullable(),type:n("resource_link"),uri:e()}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),resource:c,type:n("resource")})]),sessionUpdate:n("user_message_chunk")}),o({_meta:a(t()).optional(),content:l([o({_meta:a(t()).optional(),annotations:i.optional().nullable(),text:e(),type:n("text")}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),data:e(),mimeType:e(),type:n("image"),uri:e().optional().nullable()}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),data:e(),mimeType:e(),type:n("audio")}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),description:e().optional().nullable(),mimeType:e().optional().nullable(),name:e(),size:p().optional().nullable(),title:e().optional().nullable(),type:n("resource_link"),uri:e()}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),resource:c,type:n("resource")})]),sessionUpdate:n("agent_message_chunk")}),o({_meta:a(t()).optional(),content:l([o({_meta:a(t()).optional(),annotations:i.optional().nullable(),text:e(),type:n("text")}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),data:e(),mimeType:e(),type:n("image"),uri:e().optional().nullable()}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),data:e(),mimeType:e(),type:n("audio")}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),description:e().optional().nullable(),mimeType:e().optional().nullable(),name:e(),size:p().optional().nullable(),title:e().optional().nullable(),type:n("resource_link"),uri:e()}),o({_meta:a(t()).optional(),annotations:i.optional().nullable(),resource:c,type:n("resource")})]),sessionUpdate:n("agent_thought_chunk")}),o({_meta:a(t()).optional(),content:s(u).optional(),kind:l([n("read"),n("edit"),n("delete"),n("move"),n("search"),n("execute"),n("think"),n("fetch"),n("switch_mode"),n("other")]).optional(),locations:s(r).optional(),rawInput:a(t()).optional(),rawOutput:a(t()).optional(),sessionUpdate:n("tool_call"),status:l([n("pending"),n("in_progress"),n("completed"),n("failed")]).optional(),title:e(),toolCallId:e()}),o({_meta:a(t()).optional(),content:s(u).optional().nullable(),kind:b.optional().nullable(),locations:s(r).optional().nullable(),rawInput:a(t()).optional(),rawOutput:a(t()).optional(),sessionUpdate:n("tool_call_update"),status:_.optional().nullable(),title:e().optional().nullable(),toolCallId:e()}),o({_meta:a(t()).optional(),entries:s(de),sessionUpdate:n("plan")}),o({_meta:a(t()).optional(),availableCommands:s(Oe),sessionUpdate:n("available_commands_update")}),o({_meta:a(t()).optional(),currentModeId:e(),sessionUpdate:n("current_mode_update")})])}),Ee=o({_meta:a(t()).optional(),clientCapabilities:Fe.optional(),clientInfo:R.optional().nullable(),protocolVersion:p()}),Pe=l([Y,Z,$,ee,Me,oe,te,ae,ne]),Ve=l([Ne,H]),je=l([Ee,J,we,qe,Q,fe,W,X]),Le=o({method:e(),params:Ve.optional().nullable()}),Be=l([ze,E,ge,xe,P,V,j,L]),He=o({id:l([A,D,G]),method:e(),params:je.optional().nullable()}),Ke=l([o({result:Pe}),o({error:S})]),Ae=l([He,Ke,Ce]),De=l([o({result:Be}),o({error:S})]),Ge=l([Ue,De,Le]);l([Ge,Ae]);export{Qe as P,Ge as a};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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}}
|
|
@@ -0,0 +1,7 @@
|
|
|
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,{})}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as i,e,f as k}from"./vendor-CNJ4Zu8U.js";const c={};function d(s){const t=this,n=s||c,o=t.data(),r=o.micromarkExtensions||(o.micromarkExtensions=[]),a=o.fromMarkdownExtensions||(o.fromMarkdownExtensions=[]),m=o.toMarkdownExtensions||(o.toMarkdownExtensions=[]);r.push(i(n)),a.push(e()),m.push(k(n))}export{d as r};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{r as s,R as Be,j as d,a as se,b as We,c as Ln,d as lt}from"./react-BUwpDnu9.js";import{h as ut,i as jn,j as $n,k as kn,m as Bn,p as Wn,q as Un,t as Hn,v as Vn,w as Kn}from"./vendor-CNJ4Zu8U.js";function et(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ue(...e){return t=>{let n=!1;const o=e.map(r=>{const i=et(r,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let r=0;r<o.length;r++){const i=o[r];typeof i=="function"?i():et(e[r],null)}}}}function O(...e){return s.useCallback(Ue(...e),e)}var Gn=Symbol.for("react.lazy"),xe=Be[" use ".trim().toString()];function zn(e){return typeof e=="object"&&e!==null&&"then"in e}function dt(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Gn&&"_payload"in e&&zn(e._payload)}function ft(e){const t=Yn(e),n=s.forwardRef((o,r)=>{let{children:i,...c}=o;dt(i)&&typeof xe=="function"&&(i=xe(i._payload));const a=s.Children.toArray(i),l=a.find(Xn);if(l){const u=l.props.children,p=a.map(m=>m===l?s.Children.count(u)>1?s.Children.only(null):s.isValidElement(u)?u.props.children:null:m);return d.jsx(t,{...c,ref:r,children:s.isValidElement(u)?s.cloneElement(u,void 0,p):null})}return d.jsx(t,{...c,ref:r,children:i})});return n.displayName=`${e}.Slot`,n}var Hr=ft("Slot");function Yn(e){const t=s.forwardRef((n,o)=>{let{children:r,...i}=n;if(dt(r)&&typeof xe=="function"&&(r=xe(r._payload)),s.isValidElement(r)){const c=Jn(r),a=Zn(i,r.props);return r.type!==s.Fragment&&(a.ref=o?Ue(o,c):c),s.cloneElement(r,a)}return s.Children.count(r)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var qn=Symbol("radix.slottable");function Xn(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===qn}function Zn(e,t){const n={...t};for(const o in t){const r=e[o],i=t[o];/^on[A-Z]/.test(o)?r&&i?n[o]=(...a)=>{const l=i(...a);return r(...a),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...i}:o==="className"&&(n[o]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function Jn(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function I(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Qn(e,t){const n=s.createContext(t),o=i=>{const{children:c,...a}=i,l=s.useMemo(()=>a,Object.values(a));return d.jsx(n.Provider,{value:l,children:c})};o.displayName=e+"Provider";function r(i){const c=s.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[o,r]}function le(e,t=[]){let n=[];function o(i,c){const a=s.createContext(c),l=n.length;n=[...n,c];const u=m=>{const{scope:x,children:S,...E}=m,f=x?.[e]?.[l]||a,v=s.useMemo(()=>E,Object.values(E));return d.jsx(f.Provider,{value:v,children:S})};u.displayName=i+"Provider";function p(m,x){const S=x?.[e]?.[l]||a,E=s.useContext(S);if(E)return E;if(c!==void 0)return c;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[u,p]}const r=()=>{const i=n.map(c=>s.createContext(c));return function(a){const l=a?.[e]||i;return s.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return r.scopeName=e,[o,eo(r,...t)]}function eo(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(i){const c=o.reduce((a,{useScope:l,scopeName:u})=>{const m=l(i)[`__scope${u}`];return{...a,...m}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}function ve(e){const t=to(e),n=s.forwardRef((o,r)=>{const{children:i,...c}=o,a=s.Children.toArray(i),l=a.find(oo);if(l){const u=l.props.children,p=a.map(m=>m===l?s.Children.count(u)>1?s.Children.only(null):s.isValidElement(u)?u.props.children:null:m);return d.jsx(t,{...c,ref:r,children:s.isValidElement(u)?s.cloneElement(u,void 0,p):null})}return d.jsx(t,{...c,ref:r,children:i})});return n.displayName=`${e}.Slot`,n}function to(e){const t=s.forwardRef((n,o)=>{const{children:r,...i}=n;if(s.isValidElement(r)){const c=so(r),a=ro(i,r.props);return r.type!==s.Fragment&&(a.ref=o?Ue(o,c):c),s.cloneElement(r,a)}return s.Children.count(r)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var no=Symbol("radix.slottable");function oo(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===no}function ro(e,t){const n={...t};for(const o in t){const r=e[o],i=t[o];/^on[A-Z]/.test(o)?r&&i?n[o]=(...a)=>{const l=i(...a);return r(...a),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...i}:o==="className"&&(n[o]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function so(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function pt(e){const t=e+"CollectionProvider",[n,o]=le(t),[r,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=f=>{const{scope:v,children:y}=f,h=se.useRef(null),g=se.useRef(new Map).current;return d.jsx(r,{scope:v,itemMap:g,collectionRef:h,children:y})};c.displayName=t;const a=e+"CollectionSlot",l=ve(a),u=se.forwardRef((f,v)=>{const{scope:y,children:h}=f,g=i(a,y),C=O(v,g.collectionRef);return d.jsx(l,{ref:C,children:h})});u.displayName=a;const p=e+"CollectionItemSlot",m="data-radix-collection-item",x=ve(p),S=se.forwardRef((f,v)=>{const{scope:y,children:h,...g}=f,C=se.useRef(null),A=O(v,C),M=i(p,y);return se.useEffect(()=>(M.itemMap.set(C,{ref:C,...g}),()=>void M.itemMap.delete(C))),d.jsx(x,{[m]:"",ref:A,children:h})});S.displayName=p;function E(f){const v=i(e+"CollectionConsumer",f);return se.useCallback(()=>{const h=v.collectionRef.current;if(!h)return[];const g=Array.from(h.querySelectorAll(`[${m}]`));return Array.from(v.itemMap.values()).sort((M,b)=>g.indexOf(M.ref.current)-g.indexOf(b.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:c,Slot:u,ItemSlot:S},E,o]}var L=globalThis?.document?s.useLayoutEffect:()=>{},io=Be[" useId ".trim().toString()]||(()=>{}),ao=0;function Ee(e){const[t,n]=s.useState(io());return L(()=>{n(o=>o??String(ao++))},[e]),t?`radix-${t}`:""}var co=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],P=co.reduce((e,t)=>{const n=ve(`Primitive.${t}`),o=s.forwardRef((r,i)=>{const{asChild:c,...a}=r,l=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:i})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function lo(e,t){e&&We.flushSync(()=>e.dispatchEvent(t))}function Q(e){const t=s.useRef(e);return s.useEffect(()=>{t.current=e}),s.useMemo(()=>(...n)=>t.current?.(...n),[])}var uo=Be[" useInsertionEffect ".trim().toString()]||L;function mt({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,i,c]=fo({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:r;{const p=s.useRef(e!==void 0);s.useEffect(()=>{const m=p.current;m!==a&&console.warn(`${o} is changing from ${m?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=a},[a,o])}const u=s.useCallback(p=>{if(a){const m=po(p)?p(e):p;m!==e&&c.current?.(m)}else i(p)},[a,e,i,c]);return[l,u]}function fo({defaultProp:e,onChange:t}){const[n,o]=s.useState(e),r=s.useRef(n),i=s.useRef(t);return uo(()=>{i.current=t},[t]),s.useEffect(()=>{r.current!==n&&(i.current?.(n),r.current=n)},[n,r]),[n,o,i]}function po(e){return typeof e=="function"}var mo=s.createContext(void 0);function vt(e){const t=s.useContext(mo);return e||t||"ltr"}var Ne="rovingFocusGroup.onEntryFocus",vo={bubbles:!1,cancelable:!0},he="RovingFocusGroup",[De,ht,ho]=pt(he),[go,gt]=le(he,[ho]),[yo,xo]=go(he),yt=s.forwardRef((e,t)=>d.jsx(De.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(De.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(So,{...e,ref:t})})}));yt.displayName=he;var So=s.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:r=!1,dir:i,currentTabStopId:c,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:p=!1,...m}=e,x=s.useRef(null),S=O(t,x),E=vt(i),[f,v]=mt({prop:c,defaultProp:a??null,onChange:l,caller:he}),[y,h]=s.useState(!1),g=Q(u),C=ht(n),A=s.useRef(!1),[M,b]=s.useState(0);return s.useEffect(()=>{const R=x.current;if(R)return R.addEventListener(Ne,g),()=>R.removeEventListener(Ne,g)},[g]),d.jsx(yo,{scope:n,orientation:o,dir:E,loop:r,currentTabStopId:f,onItemFocus:s.useCallback(R=>v(R),[v]),onItemShiftTab:s.useCallback(()=>h(!0),[]),onFocusableItemAdd:s.useCallback(()=>b(R=>R+1),[]),onFocusableItemRemove:s.useCallback(()=>b(R=>R-1),[]),children:d.jsx(P.div,{tabIndex:y||M===0?-1:0,"data-orientation":o,...m,ref:S,style:{outline:"none",...e.style},onMouseDown:I(e.onMouseDown,()=>{A.current=!0}),onFocus:I(e.onFocus,R=>{const V=!A.current;if(R.target===R.currentTarget&&V&&!y){const k=new CustomEvent(Ne,vo);if(R.currentTarget.dispatchEvent(k),!k.defaultPrevented){const $=C().filter(F=>F.focusable),K=$.find(F=>F.active),W=$.find(F=>F.id===f),U=[K,W,...$].filter(Boolean).map(F=>F.ref.current);wt(U,p)}}A.current=!1}),onBlur:I(e.onBlur,()=>h(!1))})})}),xt="RovingFocusGroupItem",St=s.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:i,children:c,...a}=e,l=Ee(),u=i||l,p=xo(xt,n),m=p.currentTabStopId===u,x=ht(n),{onFocusableItemAdd:S,onFocusableItemRemove:E,currentTabStopId:f}=p;return s.useEffect(()=>{if(o)return S(),()=>E()},[o,S,E]),d.jsx(De.ItemSlot,{scope:n,id:u,focusable:o,active:r,children:d.jsx(P.span,{tabIndex:m?0:-1,"data-orientation":p.orientation,...a,ref:t,onMouseDown:I(e.onMouseDown,v=>{o?p.onItemFocus(u):v.preventDefault()}),onFocus:I(e.onFocus,()=>p.onItemFocus(u)),onKeyDown:I(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){p.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=Co(v,p.orientation,p.dir);if(y!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let g=x().filter(C=>C.focusable).map(C=>C.ref.current);if(y==="last")g.reverse();else if(y==="prev"||y==="next"){y==="prev"&&g.reverse();const C=g.indexOf(v.currentTarget);g=p.loop?bo(g,C+1):g.slice(C+1)}setTimeout(()=>wt(g))}}),children:typeof c=="function"?c({isCurrentTabStop:m,hasTabStop:f!=null}):c})})});St.displayName=xt;var wo={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Eo(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Co(e,t,n){const o=Eo(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return wo[o]}function wt(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function bo(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Io=yt,Po=St;function Ro(e,t){return s.useReducer((n,o)=>t[n][o]??n,e)}var ge=e=>{const{present:t,children:n}=e,o=To(t),r=typeof n=="function"?n({present:o.isPresent}):s.Children.only(n),i=O(o.ref,No(r));return typeof n=="function"||o.isPresent?s.cloneElement(r,{ref:i}):null};ge.displayName="Presence";function To(e){const[t,n]=s.useState(),o=s.useRef(null),r=s.useRef(e),i=s.useRef("none"),c=e?"mounted":"unmounted",[a,l]=Ro(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return s.useEffect(()=>{const u=ye(o.current);i.current=a==="mounted"?u:"none"},[a]),L(()=>{const u=o.current,p=r.current;if(p!==e){const x=i.current,S=ye(u);e?l("MOUNT"):S==="none"||u?.display==="none"?l("UNMOUNT"):l(p&&x!==S?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,l]),L(()=>{if(t){let u;const p=t.ownerDocument.defaultView??window,m=S=>{const f=ye(o.current).includes(CSS.escape(S.animationName));if(S.target===t&&f&&(l("ANIMATION_END"),!r.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",u=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},x=S=>{S.target===t&&(i.current=ye(o.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{p.clearTimeout(u),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:s.useCallback(u=>{o.current=u?getComputedStyle(u):null,n(u)},[])}}function ye(e){return e?.animationName||"none"}function No(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ce="Tabs",[Ao]=le(Ce,[gt]),Et=gt(),[_o,He]=Ao(Ce),Ct=s.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,onValueChange:r,defaultValue:i,orientation:c="horizontal",dir:a,activationMode:l="automatic",...u}=e,p=vt(a),[m,x]=mt({prop:o,onChange:r,defaultProp:i??"",caller:Ce});return d.jsx(_o,{scope:n,baseId:Ee(),value:m,onValueChange:x,orientation:c,dir:p,activationMode:l,children:d.jsx(P.div,{dir:p,"data-orientation":c,...u,ref:t})})});Ct.displayName=Ce;var bt="TabsList",It=s.forwardRef((e,t)=>{const{__scopeTabs:n,loop:o=!0,...r}=e,i=He(bt,n),c=Et(n);return d.jsx(Io,{asChild:!0,...c,orientation:i.orientation,dir:i.dir,loop:o,children:d.jsx(P.div,{role:"tablist","aria-orientation":i.orientation,...r,ref:t})})});It.displayName=bt;var Pt="TabsTrigger",Rt=s.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,disabled:r=!1,...i}=e,c=He(Pt,n),a=Et(n),l=At(c.baseId,o),u=_t(c.baseId,o),p=o===c.value;return d.jsx(Po,{asChild:!0,...a,focusable:!r,active:p,children:d.jsx(P.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":u,"data-state":p?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:l,...i,ref:t,onMouseDown:I(e.onMouseDown,m=>{!r&&m.button===0&&m.ctrlKey===!1?c.onValueChange(o):m.preventDefault()}),onKeyDown:I(e.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&c.onValueChange(o)}),onFocus:I(e.onFocus,()=>{const m=c.activationMode!=="manual";!p&&!r&&m&&c.onValueChange(o)})})})});Rt.displayName=Pt;var Tt="TabsContent",Nt=s.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,forceMount:r,children:i,...c}=e,a=He(Tt,n),l=At(a.baseId,o),u=_t(a.baseId,o),p=o===a.value,m=s.useRef(p);return s.useEffect(()=>{const x=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(x)},[]),d.jsx(ge,{present:r||p,children:({present:x})=>d.jsx(P.div,{"data-state":p?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!x,id:u,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:m.current?"0s":void 0},children:x&&i})})});Nt.displayName=Tt;function At(e,t){return`${e}-trigger-${t}`}function _t(e,t){return`${e}-content-${t}`}var Vr=Ct,Kr=It,Gr=Rt,zr=Nt;function Oo(e,t=globalThis?.document){const n=Q(e);s.useEffect(()=>{const o=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var Do="DismissableLayer",Me="dismissableLayer.update",Mo="dismissableLayer.pointerDownOutside",Fo="dismissableLayer.focusOutside",tt,Ot=s.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ve=s.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:i,onInteractOutside:c,onDismiss:a,...l}=e,u=s.useContext(Ot),[p,m]=s.useState(null),x=p?.ownerDocument??globalThis?.document,[,S]=s.useState({}),E=O(t,b=>m(b)),f=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=f.indexOf(v),h=p?f.indexOf(p):-1,g=u.layersWithOutsidePointerEventsDisabled.size>0,C=h>=y,A=$o(b=>{const R=b.target,V=[...u.branches].some(k=>k.contains(R));!C||V||(r?.(b),c?.(b),b.defaultPrevented||a?.())},x),M=ko(b=>{const R=b.target;[...u.branches].some(k=>k.contains(R))||(i?.(b),c?.(b),b.defaultPrevented||a?.())},x);return Oo(b=>{h===u.layers.size-1&&(o?.(b),!b.defaultPrevented&&a&&(b.preventDefault(),a()))},x),s.useEffect(()=>{if(p)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(tt=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(p)),u.layers.add(p),nt(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=tt)}},[p,x,n,u]),s.useEffect(()=>()=>{p&&(u.layers.delete(p),u.layersWithOutsidePointerEventsDisabled.delete(p),nt())},[p,u]),s.useEffect(()=>{const b=()=>S({});return document.addEventListener(Me,b),()=>document.removeEventListener(Me,b)},[]),d.jsx(P.div,{...l,ref:E,style:{pointerEvents:g?C?"auto":"none":void 0,...e.style},onFocusCapture:I(e.onFocusCapture,M.onFocusCapture),onBlurCapture:I(e.onBlurCapture,M.onBlurCapture),onPointerDownCapture:I(e.onPointerDownCapture,A.onPointerDownCapture)})});Ve.displayName=Do;var Lo="DismissableLayerBranch",jo=s.forwardRef((e,t)=>{const n=s.useContext(Ot),o=s.useRef(null),r=O(t,o);return s.useEffect(()=>{const i=o.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),d.jsx(P.div,{...e,ref:r})});jo.displayName=Lo;function $o(e,t=globalThis?.document){const n=Q(e),o=s.useRef(!1),r=s.useRef(()=>{});return s.useEffect(()=>{const i=a=>{if(a.target&&!o.current){let l=function(){Dt(Mo,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=l,t.addEventListener("click",r.current,{once:!0})):l()}else t.removeEventListener("click",r.current);o.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",i),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function ko(e,t=globalThis?.document){const n=Q(e),o=s.useRef(!1);return s.useEffect(()=>{const r=i=>{i.target&&!o.current&&Dt(Fo,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function nt(){const e=new CustomEvent(Me);document.dispatchEvent(e)}function Dt(e,t,n,{discrete:o}){const r=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?lo(r,i):r.dispatchEvent(i)}var Ae="focusScope.autoFocusOnMount",_e="focusScope.autoFocusOnUnmount",ot={bubbles:!1,cancelable:!0},Bo="FocusScope",Ke=s.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:i,...c}=e,[a,l]=s.useState(null),u=Q(r),p=Q(i),m=s.useRef(null),x=O(t,f=>l(f)),S=s.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;s.useEffect(()=>{if(o){let f=function(g){if(S.paused||!a)return;const C=g.target;a.contains(C)?m.current=C:J(m.current,{select:!0})},v=function(g){if(S.paused||!a)return;const C=g.relatedTarget;C!==null&&(a.contains(C)||J(m.current,{select:!0}))},y=function(g){if(document.activeElement===document.body)for(const A of g)A.removedNodes.length>0&&J(a)};document.addEventListener("focusin",f),document.addEventListener("focusout",v);const h=new MutationObserver(y);return a&&h.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",v),h.disconnect()}}},[o,a,S.paused]),s.useEffect(()=>{if(a){st.add(S);const f=document.activeElement;if(!a.contains(f)){const y=new CustomEvent(Ae,ot);a.addEventListener(Ae,u),a.dispatchEvent(y),y.defaultPrevented||(Wo(Go(Mt(a)),{select:!0}),document.activeElement===f&&J(a))}return()=>{a.removeEventListener(Ae,u),setTimeout(()=>{const y=new CustomEvent(_e,ot);a.addEventListener(_e,p),a.dispatchEvent(y),y.defaultPrevented||J(f??document.body,{select:!0}),a.removeEventListener(_e,p),st.remove(S)},0)}}},[a,u,p,S]);const E=s.useCallback(f=>{if(!n&&!o||S.paused)return;const v=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,y=document.activeElement;if(v&&y){const h=f.currentTarget,[g,C]=Uo(h);g&&C?!f.shiftKey&&y===C?(f.preventDefault(),n&&J(g,{select:!0})):f.shiftKey&&y===g&&(f.preventDefault(),n&&J(C,{select:!0})):y===h&&f.preventDefault()}},[n,o,S.paused]);return d.jsx(P.div,{tabIndex:-1,...c,ref:x,onKeyDown:E})});Ke.displayName=Bo;function Wo(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(J(o,{select:t}),document.activeElement!==n)return}function Uo(e){const t=Mt(e),n=rt(t,e),o=rt(t.reverse(),e);return[n,o]}function Mt(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function rt(e,t){for(const n of e)if(!Ho(n,{upTo:t}))return n}function Ho(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Vo(e){return e instanceof HTMLInputElement&&"select"in e}function J(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Vo(e)&&t&&e.select()}}var st=Ko();function Ko(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=it(e,t),e.unshift(t)},remove(t){e=it(e,t),e[0]?.resume()}}}function it(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function Go(e){return e.filter(t=>t.tagName!=="A")}var zo="Portal",Ge=s.forwardRef((e,t)=>{const{container:n,...o}=e,[r,i]=s.useState(!1);L(()=>i(!0),[]);const c=n||r&&globalThis?.document?.body;return c?Ln.createPortal(d.jsx(P.div,{...o,ref:t}),c):null});Ge.displayName=zo;var Oe=0;function Ft(){s.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??at()),document.body.insertAdjacentElement("beforeend",e[1]??at()),Oe++,()=>{Oe===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Oe--}},[])}function at(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Lt="Dialog",[jt]=le(Lt),[Yr,q]=jt(Lt),$t="DialogTrigger",Yo=s.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=q($t,n),i=O(t,r.triggerRef);return d.jsx(P.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":qe(r.open),...o,ref:i,onClick:I(e.onClick,r.onOpenToggle)})});Yo.displayName=$t;var ze="DialogPortal",[qo,kt]=jt(ze,{forceMount:void 0}),Bt=e=>{const{__scopeDialog:t,forceMount:n,children:o,container:r}=e,i=q(ze,t);return d.jsx(qo,{scope:t,forceMount:n,children:s.Children.map(o,c=>d.jsx(ge,{present:n||i.open,children:d.jsx(Ge,{asChild:!0,container:r,children:c})}))})};Bt.displayName=ze;var Se="DialogOverlay",Wt=s.forwardRef((e,t)=>{const n=kt(Se,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,i=q(Se,e.__scopeDialog);return i.modal?d.jsx(ge,{present:o||i.open,children:d.jsx(Zo,{...r,ref:t})}):null});Wt.displayName=Se;var Xo=ve("DialogOverlay.RemoveScroll"),Zo=s.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=q(Se,n);return d.jsx(lt,{as:Xo,allowPinchZoom:!0,shards:[r.contentRef],children:d.jsx(P.div,{"data-state":qe(r.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),ie="DialogContent",Ut=s.forwardRef((e,t)=>{const n=kt(ie,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,i=q(ie,e.__scopeDialog);return d.jsx(ge,{present:o||i.open,children:i.modal?d.jsx(Jo,{...r,ref:t}):d.jsx(Qo,{...r,ref:t})})});Ut.displayName=ie;var Jo=s.forwardRef((e,t)=>{const n=q(ie,e.__scopeDialog),o=s.useRef(null),r=O(t,n.contentRef,o);return s.useEffect(()=>{const i=o.current;if(i)return ut(i)},[]),d.jsx(Ht,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:I(e.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:I(e.onPointerDownOutside,i=>{const c=i.detail.originalEvent,a=c.button===0&&c.ctrlKey===!0;(c.button===2||a)&&i.preventDefault()}),onFocusOutside:I(e.onFocusOutside,i=>i.preventDefault())})}),Qo=s.forwardRef((e,t)=>{const n=q(ie,e.__scopeDialog),o=s.useRef(!1),r=s.useRef(!1);return d.jsx(Ht,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(o.current||n.triggerRef.current?.focus(),i.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(o.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const c=i.target;n.triggerRef.current?.contains(c)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),Ht=s.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:i,...c}=e,a=q(ie,n),l=s.useRef(null),u=O(t,l);return Ft(),d.jsxs(d.Fragment,{children:[d.jsx(Ke,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:i,children:d.jsx(Ve,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":qe(a.open),...c,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(er,{titleId:a.titleId}),d.jsx(nr,{contentRef:l,descriptionId:a.descriptionId})]})]})}),Ye="DialogTitle",Vt=s.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=q(Ye,n);return d.jsx(P.h2,{id:r.titleId,...o,ref:t})});Vt.displayName=Ye;var Kt="DialogDescription",Gt=s.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=q(Kt,n);return d.jsx(P.p,{id:r.descriptionId,...o,ref:t})});Gt.displayName=Kt;var zt="DialogClose",Yt=s.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=q(zt,n);return d.jsx(P.button,{type:"button",...o,ref:t,onClick:I(e.onClick,()=>r.onOpenChange(!1))})});Yt.displayName=zt;function qe(e){return e?"open":"closed"}var qt="DialogTitleWarning",[qr,Xt]=Qn(qt,{contentName:ie,titleName:Ye,docsSlug:"dialog"}),er=({titleId:e})=>{const t=Xt(qt),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
2
|
+
|
|
3
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4
|
+
|
|
5
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return s.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},tr="DialogDescriptionWarning",nr=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Xt(tr).contentName}}.`;return s.useEffect(()=>{const r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},Xr=Bt,Zr=Wt,Jr=Ut,Qr=Vt,es=Gt,ts=Yt,or=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],rr=or.reduce((e,t)=>{const n=ft(`Primitive.${t}`),o=s.forwardRef((r,i)=>{const{asChild:c,...a}=r,l=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:i})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),sr="Label",Zt=s.forwardRef((e,t)=>d.jsx(rr.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Zt.displayName=sr;var ns=Zt;function ct(e,[t,n]){return Math.min(n,Math.max(t,e))}var ir="Arrow",Jt=s.forwardRef((e,t)=>{const{children:n,width:o=10,height:r=5,...i}=e;return d.jsx(P.svg,{...i,ref:t,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});Jt.displayName=ir;var ar=Jt;function cr(e){const[t,n]=s.useState(void 0);return L(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const i=r[0];let c,a;if("borderBoxSize"in i){const l=i.borderBoxSize,u=Array.isArray(l)?l[0]:l;c=u.inlineSize,a=u.blockSize}else c=e.offsetWidth,a=e.offsetHeight;n({width:c,height:a})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var Qt="Popper",[en,tn]=le(Qt),[os,nn]=en(Qt),on="PopperAnchor",rn=s.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...r}=e,i=nn(on,n),c=s.useRef(null),a=O(t,c),l=s.useRef(null);return s.useEffect(()=>{const u=l.current;l.current=o?.current||c.current,u!==l.current&&i.onAnchorChange(l.current)}),o?null:d.jsx(P.div,{...r,ref:a})});rn.displayName=on;var Xe="PopperContent",[lr,ur]=en(Xe),sn=s.forwardRef((e,t)=>{const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:i="center",alignOffset:c=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:x=!1,updatePositionStrategy:S="optimized",onPlaced:E,...f}=e,v=nn(Xe,n),[y,h]=s.useState(null),g=O(t,w=>h(w)),[C,A]=s.useState(null),M=cr(C),b=M?.width??0,R=M?.height??0,V=o+(i!=="center"?"-"+i:""),k=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},$=Array.isArray(u)?u:[u],K=$.length>0,W={padding:k,boundary:$.filter(fr),altBoundary:K},{refs:X,floatingStyles:U,placement:F,isPositioned:G,middlewareData:B}=jn({strategy:"fixed",placement:V,whileElementsMounted:(...w)=>Kn(...w,{animationFrame:S==="always"}),elements:{reference:v.anchor},middleware:[$n({mainAxis:r+R,alignmentAxis:c}),l&&kn({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?Vn():void 0,...W}),l&&Bn({...W}),Wn({...W,apply:({elements:w,rects:_,availableWidth:j,availableHeight:T})=>{const{width:N,height:D}=_.reference,H=w.floating.style;H.setProperty("--radix-popper-available-width",`${j}px`),H.setProperty("--radix-popper-available-height",`${T}px`),H.setProperty("--radix-popper-anchor-width",`${N}px`),H.setProperty("--radix-popper-anchor-height",`${D}px`)}}),C&&Un({element:C,padding:a}),pr({arrowWidth:b,arrowHeight:R}),x&&Hn({strategy:"referenceHidden",...W})]}),[z,de]=ln(F),ne=Q(E);L(()=>{G&&ne?.()},[G,ne]);const fe=B.arrow?.x,pe=B.arrow?.y,Z=B.arrow?.centerOffset!==0,[ce,oe]=s.useState();return L(()=>{y&&oe(window.getComputedStyle(y).zIndex)},[y]),d.jsx("div",{ref:X.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:G?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[B.transformOrigin?.x,B.transformOrigin?.y].join(" "),...B.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(lr,{scope:n,placedSide:z,onArrowChange:A,arrowX:fe,arrowY:pe,shouldHideArrow:Z,children:d.jsx(P.div,{"data-side":z,"data-align":de,...f,ref:g,style:{...f.style,animation:G?void 0:"none"}})})})});sn.displayName=Xe;var an="PopperArrow",dr={top:"bottom",right:"left",bottom:"top",left:"right"},cn=s.forwardRef(function(t,n){const{__scopePopper:o,...r}=t,i=ur(an,o),c=dr[i.placedSide];return d.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:d.jsx(ar,{...r,ref:n,style:{...r.style,display:"block"}})})});cn.displayName=an;function fr(e){return e!==null}var pr=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:o,middlewareData:r}=t,c=r.arrow?.centerOffset!==0,a=c?0:e.arrowWidth,l=c?0:e.arrowHeight,[u,p]=ln(n),m={start:"0%",center:"50%",end:"100%"}[p],x=(r.arrow?.x??0)+a/2,S=(r.arrow?.y??0)+l/2;let E="",f="";return u==="bottom"?(E=c?m:`${x}px`,f=`${-l}px`):u==="top"?(E=c?m:`${x}px`,f=`${o.floating.height+l}px`):u==="right"?(E=`${-l}px`,f=c?m:`${S}px`):u==="left"&&(E=`${o.floating.width+l}px`,f=c?m:`${S}px`),{data:{x:E,y:f}}}});function ln(e){const[t,n="center"]=e.split("-");return[t,n]}var mr=rn,vr=sn,hr=cn;function gr(e){const t=s.useRef({value:e,previous:e});return s.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var un=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),yr="VisuallyHidden",xr=s.forwardRef((e,t)=>d.jsx(P.span,{...e,ref:t,style:{...un,...e.style}}));xr.displayName=yr;var Sr=[" ","Enter","ArrowUp","ArrowDown"],wr=[" ","Enter"],be="Select",[Ze,Ie,Er]=pt(be),[ue]=le(be,[Er,tn]),Je=tn(),[rs,ee]=ue(be),[ss,Cr]=ue(be),dn="SelectTrigger",fn=s.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...r}=e,i=Je(n),c=ee(dn,n),a=c.disabled||o,l=O(t,c.onTriggerChange),u=Ie(n),p=s.useRef("touch"),[m,x,S]=Mn(f=>{const v=u().filter(g=>!g.disabled),y=v.find(g=>g.value===c.value),h=Fn(v,f,y);h!==void 0&&c.onValueChange(h.value)}),E=f=>{a||(c.onOpenChange(!0),S()),f&&(c.triggerPointerDownPosRef.current={x:Math.round(f.pageX),y:Math.round(f.pageY)})};return d.jsx(mr,{asChild:!0,...i,children:d.jsx(P.button,{type:"button",role:"combobox","aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Dn(c.value)?"":void 0,...r,ref:l,onClick:I(r.onClick,f=>{f.currentTarget.focus(),p.current!=="mouse"&&E(f)}),onPointerDown:I(r.onPointerDown,f=>{p.current=f.pointerType;const v=f.target;v.hasPointerCapture(f.pointerId)&&v.releasePointerCapture(f.pointerId),f.button===0&&f.ctrlKey===!1&&f.pointerType==="mouse"&&(E(f),f.preventDefault())}),onKeyDown:I(r.onKeyDown,f=>{const v=m.current!=="";!(f.ctrlKey||f.altKey||f.metaKey)&&f.key.length===1&&x(f.key),!(v&&f.key===" ")&&Sr.includes(f.key)&&(E(),f.preventDefault())})})})});fn.displayName=dn;var pn="SelectValue",br=s.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,children:i,placeholder:c="",...a}=e,l=ee(pn,n),{onValueNodeHasChildrenChange:u}=l,p=i!==void 0,m=O(t,l.onValueNodeChange);return L(()=>{u(p)},[u,p]),d.jsx(P.span,{...a,ref:m,style:{pointerEvents:"none"},children:Dn(l.value)?d.jsx(d.Fragment,{children:c}):i})});br.displayName=pn;var Ir="SelectIcon",mn=s.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...r}=e;return d.jsx(P.span,{"aria-hidden":!0,...r,ref:t,children:o||"▼"})});mn.displayName=Ir;var Pr="SelectPortal",vn=e=>d.jsx(Ge,{asChild:!0,...e});vn.displayName=Pr;var ae="SelectContent",hn=s.forwardRef((e,t)=>{const n=ee(ae,e.__scopeSelect),[o,r]=s.useState();if(L(()=>{r(new DocumentFragment)},[]),!n.open){const i=o;return i?We.createPortal(d.jsx(gn,{scope:e.__scopeSelect,children:d.jsx(Ze.Slot,{scope:e.__scopeSelect,children:d.jsx("div",{children:e.children})})}),i):null}return d.jsx(yn,{...e,ref:t})});hn.displayName=ae;var Y=10,[gn,te]=ue(ae),Rr="SelectContentImpl",Tr=ve("SelectContent.RemoveScroll"),yn=s.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:i,onPointerDownOutside:c,side:a,sideOffset:l,align:u,alignOffset:p,arrowPadding:m,collisionBoundary:x,collisionPadding:S,sticky:E,hideWhenDetached:f,avoidCollisions:v,...y}=e,h=ee(ae,n),[g,C]=s.useState(null),[A,M]=s.useState(null),b=O(t,w=>C(w)),[R,V]=s.useState(null),[k,$]=s.useState(null),K=Ie(n),[W,X]=s.useState(!1),U=s.useRef(!1);s.useEffect(()=>{if(g)return ut(g)},[g]),Ft();const F=s.useCallback(w=>{const[_,...j]=K().map(D=>D.ref.current),[T]=j.slice(-1),N=document.activeElement;for(const D of w)if(D===N||(D?.scrollIntoView({block:"nearest"}),D===_&&A&&(A.scrollTop=0),D===T&&A&&(A.scrollTop=A.scrollHeight),D?.focus(),document.activeElement!==N))return},[K,A]),G=s.useCallback(()=>F([R,g]),[F,R,g]);s.useEffect(()=>{W&&G()},[W,G]);const{onOpenChange:B,triggerPointerDownPosRef:z}=h;s.useEffect(()=>{if(g){let w={x:0,y:0};const _=T=>{w={x:Math.abs(Math.round(T.pageX)-(z.current?.x??0)),y:Math.abs(Math.round(T.pageY)-(z.current?.y??0))}},j=T=>{w.x<=10&&w.y<=10?T.preventDefault():g.contains(T.target)||B(!1),document.removeEventListener("pointermove",_),z.current=null};return z.current!==null&&(document.addEventListener("pointermove",_),document.addEventListener("pointerup",j,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",_),document.removeEventListener("pointerup",j,{capture:!0})}}},[g,B,z]),s.useEffect(()=>{const w=()=>B(!1);return window.addEventListener("blur",w),window.addEventListener("resize",w),()=>{window.removeEventListener("blur",w),window.removeEventListener("resize",w)}},[B]);const[de,ne]=Mn(w=>{const _=K().filter(N=>!N.disabled),j=_.find(N=>N.ref.current===document.activeElement),T=Fn(_,w,j);T&&setTimeout(()=>T.ref.current.focus())}),fe=s.useCallback((w,_,j)=>{const T=!U.current&&!j;(h.value!==void 0&&h.value===_||T)&&(V(w),T&&(U.current=!0))},[h.value]),pe=s.useCallback(()=>g?.focus(),[g]),Z=s.useCallback((w,_,j)=>{const T=!U.current&&!j;(h.value!==void 0&&h.value===_||T)&&$(w)},[h.value]),ce=o==="popper"?Fe:xn,oe=ce===Fe?{side:a,sideOffset:l,align:u,alignOffset:p,arrowPadding:m,collisionBoundary:x,collisionPadding:S,sticky:E,hideWhenDetached:f,avoidCollisions:v}:{};return d.jsx(gn,{scope:n,content:g,viewport:A,onViewportChange:M,itemRefCallback:fe,selectedItem:R,onItemLeave:pe,itemTextRefCallback:Z,focusSelectedItem:G,selectedItemText:k,position:o,isPositioned:W,searchRef:de,children:d.jsx(lt,{as:Tr,allowPinchZoom:!0,children:d.jsx(Ke,{asChild:!0,trapped:h.open,onMountAutoFocus:w=>{w.preventDefault()},onUnmountAutoFocus:I(r,w=>{h.trigger?.focus({preventScroll:!0}),w.preventDefault()}),children:d.jsx(Ve,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:w=>w.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:d.jsx(ce,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:w=>w.preventDefault(),...y,...oe,onPlaced:()=>X(!0),ref:b,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:I(y.onKeyDown,w=>{const _=w.ctrlKey||w.altKey||w.metaKey;if(w.key==="Tab"&&w.preventDefault(),!_&&w.key.length===1&&ne(w.key),["ArrowUp","ArrowDown","Home","End"].includes(w.key)){let T=K().filter(N=>!N.disabled).map(N=>N.ref.current);if(["ArrowUp","End"].includes(w.key)&&(T=T.slice().reverse()),["ArrowUp","ArrowDown"].includes(w.key)){const N=w.target,D=T.indexOf(N);T=T.slice(D+1)}setTimeout(()=>F(T)),w.preventDefault()}})})})})})})});yn.displayName=Rr;var Nr="SelectItemAlignedPosition",xn=s.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...r}=e,i=ee(ae,n),c=te(ae,n),[a,l]=s.useState(null),[u,p]=s.useState(null),m=O(t,b=>p(b)),x=Ie(n),S=s.useRef(!1),E=s.useRef(!0),{viewport:f,selectedItem:v,selectedItemText:y,focusSelectedItem:h}=c,g=s.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&u&&f&&v&&y){const b=i.trigger.getBoundingClientRect(),R=u.getBoundingClientRect(),V=i.valueNode.getBoundingClientRect(),k=y.getBoundingClientRect();if(i.dir!=="rtl"){const N=k.left-R.left,D=V.left-N,H=b.left-D,re=b.width+H,Pe=Math.max(re,R.width),Re=window.innerWidth-Y,Te=ct(D,[Y,Math.max(Y,Re-Pe)]);a.style.minWidth=re+"px",a.style.left=Te+"px"}else{const N=R.right-k.right,D=window.innerWidth-V.right-N,H=window.innerWidth-b.right-D,re=b.width+H,Pe=Math.max(re,R.width),Re=window.innerWidth-Y,Te=ct(D,[Y,Math.max(Y,Re-Pe)]);a.style.minWidth=re+"px",a.style.right=Te+"px"}const $=x(),K=window.innerHeight-Y*2,W=f.scrollHeight,X=window.getComputedStyle(u),U=parseInt(X.borderTopWidth,10),F=parseInt(X.paddingTop,10),G=parseInt(X.borderBottomWidth,10),B=parseInt(X.paddingBottom,10),z=U+F+W+B+G,de=Math.min(v.offsetHeight*5,z),ne=window.getComputedStyle(f),fe=parseInt(ne.paddingTop,10),pe=parseInt(ne.paddingBottom,10),Z=b.top+b.height/2-Y,ce=K-Z,oe=v.offsetHeight/2,w=v.offsetTop+oe,_=U+F+w,j=z-_;if(_<=Z){const N=$.length>0&&v===$[$.length-1].ref.current;a.style.bottom="0px";const D=u.clientHeight-f.offsetTop-f.offsetHeight,H=Math.max(ce,oe+(N?pe:0)+D+G),re=_+H;a.style.height=re+"px"}else{const N=$.length>0&&v===$[0].ref.current;a.style.top="0px";const H=Math.max(Z,U+f.offsetTop+(N?fe:0)+oe)+j;a.style.height=H+"px",f.scrollTop=_-Z+f.offsetTop}a.style.margin=`${Y}px 0`,a.style.minHeight=de+"px",a.style.maxHeight=K+"px",o?.(),requestAnimationFrame(()=>S.current=!0)}},[x,i.trigger,i.valueNode,a,u,f,v,y,i.dir,o]);L(()=>g(),[g]);const[C,A]=s.useState();L(()=>{u&&A(window.getComputedStyle(u).zIndex)},[u]);const M=s.useCallback(b=>{b&&E.current===!0&&(g(),h?.(),E.current=!1)},[g,h]);return d.jsx(_r,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:S,onScrollButtonChange:M,children:d.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:d.jsx(P.div,{...r,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});xn.displayName=Nr;var Ar="SelectPopperPosition",Fe=s.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:r=Y,...i}=e,c=Je(n);return d.jsx(vr,{...c,...i,ref:t,align:o,collisionPadding:r,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Fe.displayName=Ar;var[_r,Qe]=ue(ae,{}),Le="SelectViewport",Sn=s.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...r}=e,i=te(Le,n),c=Qe(Le,n),a=O(t,i.onViewportChange),l=s.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(Ze.Slot,{scope:n,children:d.jsx(P.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:I(r.onScroll,u=>{const p=u.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:x}=c;if(x?.current&&m){const S=Math.abs(l.current-p.scrollTop);if(S>0){const E=window.innerHeight-Y*2,f=parseFloat(m.style.minHeight),v=parseFloat(m.style.height),y=Math.max(f,v);if(y<E){const h=y+S,g=Math.min(E,h),C=h-g;m.style.height=g+"px",m.style.bottom==="0px"&&(p.scrollTop=C>0?C:0,m.style.justifyContent="flex-end")}}}l.current=p.scrollTop})})})]})});Sn.displayName=Le;var wn="SelectGroup",[Or,Dr]=ue(wn),Mr=s.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Ee();return d.jsx(Or,{scope:n,id:r,children:d.jsx(P.div,{role:"group","aria-labelledby":r,...o,ref:t})})});Mr.displayName=wn;var En="SelectLabel",Cn=s.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Dr(En,n);return d.jsx(P.div,{id:r.id,...o,ref:t})});Cn.displayName=En;var we="SelectItem",[Fr,bn]=ue(we),In=s.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:r=!1,textValue:i,...c}=e,a=ee(we,n),l=te(we,n),u=a.value===o,[p,m]=s.useState(i??""),[x,S]=s.useState(!1),E=O(t,h=>l.itemRefCallback?.(h,o,r)),f=Ee(),v=s.useRef("touch"),y=()=>{r||(a.onValueChange(o),a.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(Fr,{scope:n,value:o,disabled:r,textId:f,isSelected:u,onItemTextChange:s.useCallback(h=>{m(g=>g||(h?.textContent??"").trim())},[]),children:d.jsx(Ze.ItemSlot,{scope:n,value:o,disabled:r,textValue:p,children:d.jsx(P.div,{role:"option","aria-labelledby":f,"data-highlighted":x?"":void 0,"aria-selected":u&&x,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...c,ref:E,onFocus:I(c.onFocus,()=>S(!0)),onBlur:I(c.onBlur,()=>S(!1)),onClick:I(c.onClick,()=>{v.current!=="mouse"&&y()}),onPointerUp:I(c.onPointerUp,()=>{v.current==="mouse"&&y()}),onPointerDown:I(c.onPointerDown,h=>{v.current=h.pointerType}),onPointerMove:I(c.onPointerMove,h=>{v.current=h.pointerType,r?l.onItemLeave?.():v.current==="mouse"&&h.currentTarget.focus({preventScroll:!0})}),onPointerLeave:I(c.onPointerLeave,h=>{h.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:I(c.onKeyDown,h=>{l.searchRef?.current!==""&&h.key===" "||(wr.includes(h.key)&&y(),h.key===" "&&h.preventDefault())})})})})});In.displayName=we;var me="SelectItemText",Pn=s.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,...i}=e,c=ee(me,n),a=te(me,n),l=bn(me,n),u=Cr(me,n),[p,m]=s.useState(null),x=O(t,y=>m(y),l.onItemTextChange,y=>a.itemTextRefCallback?.(y,l.value,l.disabled)),S=p?.textContent,E=s.useMemo(()=>d.jsx("option",{value:l.value,disabled:l.disabled,children:S},l.value),[l.disabled,l.value,S]),{onNativeOptionAdd:f,onNativeOptionRemove:v}=u;return L(()=>(f(E),()=>v(E)),[f,v,E]),d.jsxs(d.Fragment,{children:[d.jsx(P.span,{id:l.textId,...i,ref:x}),l.isSelected&&c.valueNode&&!c.valueNodeHasChildren?We.createPortal(i.children,c.valueNode):null]})});Pn.displayName=me;var Rn="SelectItemIndicator",Tn=s.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return bn(Rn,n).isSelected?d.jsx(P.span,{"aria-hidden":!0,...o,ref:t}):null});Tn.displayName=Rn;var je="SelectScrollUpButton",Nn=s.forwardRef((e,t)=>{const n=te(je,e.__scopeSelect),o=Qe(je,e.__scopeSelect),[r,i]=s.useState(!1),c=O(t,o.onScrollButtonChange);return L(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=l.scrollTop>0;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?d.jsx(_n,{...e,ref:c,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});Nn.displayName=je;var $e="SelectScrollDownButton",An=s.forwardRef((e,t)=>{const n=te($e,e.__scopeSelect),o=Qe($e,e.__scopeSelect),[r,i]=s.useState(!1),c=O(t,o.onScrollButtonChange);return L(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=l.scrollHeight-l.clientHeight,p=Math.ceil(l.scrollTop)<u;i(p)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?d.jsx(_n,{...e,ref:c,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});An.displayName=$e;var _n=s.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...r}=e,i=te("SelectScrollButton",n),c=s.useRef(null),a=Ie(n),l=s.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return s.useEffect(()=>()=>l(),[l]),L(()=>{a().find(p=>p.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[a]),d.jsx(P.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:I(r.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(o,50))}),onPointerMove:I(r.onPointerMove,()=>{i.onItemLeave?.(),c.current===null&&(c.current=window.setInterval(o,50))}),onPointerLeave:I(r.onPointerLeave,()=>{l()})})}),Lr="SelectSeparator",On=s.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return d.jsx(P.div,{"aria-hidden":!0,...o,ref:t})});On.displayName=Lr;var ke="SelectArrow",jr=s.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Je(n),i=ee(ke,n),c=te(ke,n);return i.open&&c.position==="popper"?d.jsx(hr,{...r,...o,ref:t}):null});jr.displayName=ke;var $r="SelectBubbleInput",kr=s.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const r=s.useRef(null),i=O(o,r),c=gr(t);return s.useEffect(()=>{const a=r.current;if(!a)return;const l=window.HTMLSelectElement.prototype,p=Object.getOwnPropertyDescriptor(l,"value").set;if(c!==t&&p){const m=new Event("change",{bubbles:!0});p.call(a,t),a.dispatchEvent(m)}},[c,t]),d.jsx(P.select,{...n,style:{...un,...n.style},ref:i,defaultValue:t})});kr.displayName=$r;function Dn(e){return e===""||e===void 0}function Mn(e){const t=Q(e),n=s.useRef(""),o=s.useRef(0),r=s.useCallback(c=>{const a=n.current+c;t(a),(function l(u){n.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>l(""),1e3))})(a)},[t]),i=s.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return s.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,r,i]}function Fn(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let c=Br(e,Math.max(i,0));r.length===1&&(c=c.filter(u=>u!==n));const l=c.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}function Br(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var is=fn,as=mn,cs=vn,ls=hn,us=Sn,ds=Cn,fs=In,ps=Pn,ms=Tn,vs=Nn,hs=An,gs=On;export{zr as C,es as D,as as I,Kr as L,Zr as O,Xr as P,Vr as R,Hr as S,Gr as T,us as V,Jr as a,ts as b,Qr as c,ns as d,is as e,vs as f,hs as g,cs as h,ls as i,ds as j,fs as k,ms as l,ps as m,gs as n};
|