@rekayasa/erica-bubble 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Erica Project
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,322 @@
1
+ # @erica/bubble
2
+
3
+ > Erica AI Chat Widget - A self-contained React component for integrating Erica AI assistant into your application
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@erica/bubble.svg)](https://www.npmjs.com/package/@erica/bubble)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ ## Features
9
+
10
+ - ✅ **Plug-and-Play** - Zero configuration required
11
+ - ✅ **Self-Contained** - All dependencies bundled (except peer deps)
12
+ - ✅ **Type-Safe** - Full TypeScript support
13
+ - ✅ **Thread Management** - Built-in conversation history
14
+ - ✅ **File Upload** - Drag & drop file attachments
15
+ - ✅ **Responsive** - Works on desktop and mobile
16
+ - ✅ **Customizable** - Flexible styling options
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ npm install @erica/bubble @copilotkit/react-core @copilotkit/react-ui
22
+ ```
23
+
24
+ or with yarn:
25
+
26
+ ```bash
27
+ yarn add @erica/bubble @copilotkit/react-core @copilotkit/react-ui
28
+ ```
29
+
30
+ ## Quick Start
31
+
32
+ ```tsx
33
+ import { EricaChat } from '@erica/bubble';
34
+ import '@erica/bubble/styles.css';
35
+
36
+ function App() {
37
+ return (
38
+ <div style={{ height: '100vh' }}>
39
+ <EricaChat
40
+ runtimeUrl="https://api.example.com/widget/account-123"
41
+ widgetToken="your-widget-token"
42
+ />
43
+ </div>
44
+ );
45
+ }
46
+ ```
47
+
48
+ That's it! No additional setup required.
49
+
50
+ ## Props
51
+
52
+ | Prop | Type | Required | Description |
53
+ |------|------|----------|-------------|
54
+ | `runtimeUrl` | `string` | ✅ | Widget runtime endpoint URL (includes account UID) |
55
+ | `widgetToken` | `string` | ✅ | JWT token from widget authentication |
56
+
57
+ ## Authentication Flow
58
+
59
+ ### 1. Get Widget Token
60
+
61
+ First, authenticate with the widget login endpoint:
62
+
63
+ ```typescript
64
+ const response = await fetch('https://api.example.com/widget/login', {
65
+ method: 'POST',
66
+ headers: { 'Content-Type': 'application/json' },
67
+ body: JSON.stringify({
68
+ email: 'user@example.com',
69
+ password: 'password',
70
+ accountUid: 'your-account-uid',
71
+ }),
72
+ });
73
+
74
+ const { widgetToken, accountUid } = await response.json();
75
+ ```
76
+
77
+ ### 2. Use Widget Token
78
+
79
+ Pass the token to the EricaChat component:
80
+
81
+ ```tsx
82
+ <EricaChat
83
+ runtimeUrl={`https://api.example.com/widget/${accountUid}`}
84
+ widgetToken={widgetToken}
85
+ />
86
+ ```
87
+
88
+ ## Complete Example
89
+
90
+ ```tsx
91
+ import { useState, useEffect } from 'react';
92
+ import { EricaChat } from '@erica/bubble';
93
+ import '@erica/bubble/styles.css';
94
+
95
+ function App() {
96
+ const [auth, setAuth] = useState(null);
97
+
98
+ const handleLogin = async (email, password, accountUid) => {
99
+ const response = await fetch('https://api.example.com/widget/login', {
100
+ method: 'POST',
101
+ headers: { 'Content-Type': 'application/json' },
102
+ body: JSON.stringify({ email, password, accountUid }),
103
+ });
104
+
105
+ const data = await response.json();
106
+ setAuth(data);
107
+ };
108
+
109
+ if (!auth) {
110
+ return <LoginForm onLogin={handleLogin} />;
111
+ }
112
+
113
+ return (
114
+ <div style={{ height: '100vh' }}>
115
+ <EricaChat
116
+ runtimeUrl={`https://api.example.com/widget/${auth.accountUid}`}
117
+ widgetToken={auth.widgetToken}
118
+ />
119
+ </div>
120
+ );
121
+ }
122
+ ```
123
+
124
+ ## Features
125
+
126
+ ### Thread History
127
+
128
+ The component automatically fetches and displays conversation history. Users can:
129
+ - View recent threads in the dropdown
130
+ - Switch between conversations
131
+ - Start new chats
132
+
133
+ ### File Upload
134
+
135
+ Built-in file upload support:
136
+ - Drag & drop files
137
+ - Click to browse
138
+ - Upload progress indicator
139
+ - File preview chips
140
+
141
+ ### Responsive Design
142
+
143
+ Optimized for all screen sizes:
144
+ - Desktop: Full sidebar experience
145
+ - Mobile: Collapsible chat interface
146
+ - Tablet: Adaptive layout
147
+
148
+ ## Styling
149
+
150
+ ### Default Styles
151
+
152
+ Import the default stylesheet:
153
+
154
+ ```tsx
155
+ import '@erica/bubble/styles.css';
156
+ ```
157
+
158
+ ### Custom Styling
159
+
160
+ The component uses standard CSS classes that you can override:
161
+
162
+ ```css
163
+ /* Customize chat container */
164
+ .copilot-sidebar {
165
+ /* your styles */
166
+ }
167
+
168
+ /* Customize input area */
169
+ .copilot-input {
170
+ /* your styles */
171
+ }
172
+ ```
173
+
174
+ ## TypeScript
175
+
176
+ Full TypeScript support with exported types:
177
+
178
+ ```tsx
179
+ import { EricaChat, type EricaChatProps } from '@erica/bubble';
180
+
181
+ const props: EricaChatProps = {
182
+ runtimeUrl: 'https://api.example.com/widget/account-123',
183
+ widgetToken: 'token',
184
+ };
185
+
186
+ <EricaChat {...props} />
187
+ ```
188
+
189
+ ## Peer Dependencies
190
+
191
+ This package requires the following peer dependencies:
192
+
193
+ - `react` ^18.0.0 || ^19.0.0
194
+ - `react-dom` ^18.0.0 || ^19.0.0
195
+ - `@copilotkit/react-core` ^1.55.0
196
+ - `@copilotkit/react-ui` ^1.55.0
197
+
198
+ These are not bundled to avoid version conflicts and reduce bundle size.
199
+
200
+ ## Browser Support
201
+
202
+ - Chrome/Edge (latest)
203
+ - Firefox (latest)
204
+ - Safari (latest)
205
+ - Mobile browsers (iOS Safari, Chrome Mobile)
206
+
207
+ ## Bundle Size
208
+
209
+ - **Minified**: ~150 KB
210
+ - **Gzipped**: ~45 KB
211
+
212
+ Includes:
213
+ - React Query for state management
214
+ - Lucide React for icons
215
+ - All widget functionality
216
+
217
+ ## API Requirements
218
+
219
+ Your backend must provide these endpoints:
220
+
221
+ ### Login Endpoint
222
+ ```
223
+ POST /api/widget/login
224
+ ```
225
+
226
+ ### Runtime Endpoint
227
+ ```
228
+ POST /api/widget/{accountUid}
229
+ ```
230
+
231
+ ### Thread Endpoints
232
+ ```
233
+ GET /api/widget/threads
234
+ GET /api/widget/threads/{threadUid}
235
+ ```
236
+
237
+ ### Attachment Endpoints
238
+ ```
239
+ POST /api/widget/attachments/upload
240
+ GET /api/widget/attachments/{filename}
241
+ ```
242
+
243
+ See [Backend Integration Guide](#backend-integration) for details.
244
+
245
+ ## Troubleshooting
246
+
247
+ ### Component not rendering
248
+
249
+ Ensure peer dependencies are installed:
250
+ ```bash
251
+ npm install @copilotkit/react-core @copilotkit/react-ui
252
+ ```
253
+
254
+ ### Styles not applied
255
+
256
+ Import the stylesheet:
257
+ ```tsx
258
+ import '@erica/bubble/styles.css';
259
+ ```
260
+
261
+ ### 401 Unauthorized errors
262
+
263
+ Check that:
264
+ - Widget token is valid and not expired
265
+ - Runtime URL includes correct account UID
266
+ - Backend endpoints are accessible
267
+
268
+ ### CORS errors
269
+
270
+ Ensure your backend has proper CORS headers:
271
+ ```typescript
272
+ 'Access-Control-Allow-Origin': '*'
273
+ 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS'
274
+ 'Access-Control-Allow-Headers': 'Content-Type, Authorization'
275
+ ```
276
+
277
+ ## Examples
278
+
279
+ See the [examples directory](./examples) for complete working examples:
280
+
281
+ - [Basic Integration](./examples/basic)
282
+ - [With Authentication](./examples/with-auth)
283
+ - [Custom Styling](./examples/custom-styling)
284
+ - [Next.js Integration](./examples/nextjs)
285
+
286
+ ## Development
287
+
288
+ ```bash
289
+ # Clone repository
290
+ git clone https://github.com/your-org/erica-bubble.git
291
+
292
+ # Install dependencies
293
+ npm install
294
+
295
+ # Run development server
296
+ npm run dev
297
+
298
+ # Build library
299
+ npm run build:lib
300
+
301
+ # Run tests
302
+ npm test
303
+ ```
304
+
305
+ ## Contributing
306
+
307
+ Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details.
308
+
309
+ ## License
310
+
311
+ MIT © [Your Organization]
312
+
313
+ ## Support
314
+
315
+ - 📧 Email: support@example.com
316
+ - 💬 Discord: [Join our server](https://discord.gg/example)
317
+ - 📖 Documentation: [docs.example.com](https://docs.example.com)
318
+ - 🐛 Issues: [GitHub Issues](https://github.com/your-org/erica-bubble/issues)
319
+
320
+ ## Changelog
321
+
322
+ See [CHANGELOG.md](CHANGELOG.md) for release history.
@@ -0,0 +1,2 @@
1
+ :root{--copilot-kit-primary-color:#1c1c1c;--copilot-kit-contrast-color:#fff;--copilot-kit-background-color:#fff;--copilot-kit-input-background-color:#fbfbfb;--copilot-kit-secondary-color:#fff;--copilot-kit-secondary-contrast-color:#1c1c1c;--copilot-kit-separator-color:#c8c8c8;--copilot-kit-muted-color:#c8c8c8;--copilot-kit-error-background:#fef2f2;--copilot-kit-error-border:#fecaca;--copilot-kit-error-text:#dc2626;--copilot-kit-shadow-sm:0 1px 2px 0 #0000000d;--copilot-kit-shadow-md:0 4px 6px -1px #0000001a, 0 2px 4px -1px #0000000f;--copilot-kit-shadow-lg:0 10px 15px -3px #0000001a, 0 4px 6px -2px #0000000d;--copilot-kit-dev-console-bg:#f8f8fa;--copilot-kit-dev-console-text:black}.dark,html.dark,body.dark,[data-theme=dark],html[style*="color-scheme: dark"],body[style*="color-scheme: dark"] :root{--copilot-kit-primary-color:#fff;--copilot-kit-contrast-color:#1c1c1c;--copilot-kit-background-color:#111;--copilot-kit-input-background-color:#2c2c2c;--copilot-kit-secondary-color:#1c1c1c;--copilot-kit-secondary-contrast-color:#fff;--copilot-kit-separator-color:#2d2d2d;--copilot-kit-muted-color:#2d2d2d;--copilot-kit-error-background:#7f1d1d;--copilot-kit-error-border:#dc2626;--copilot-kit-error-text:#fca5a5;--copilot-kit-shadow-sm:0 1px 2px 0 #0000004d;--copilot-kit-shadow-md:0 4px 6px -1px #0006, 0 2px 4px -1px #0000004d;--copilot-kit-shadow-lg:0 10px 15px -3px #0006, 0 4px 6px -2px #0000004d}.copilotKitPopup{z-index:30;-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;touch-action:manipulation;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;position:fixed;bottom:1rem;right:1rem}.copilotKitPopup svg{vertical-align:middle;display:inline-block}.copilotKitSidebar{z-index:30;-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;touch-action:manipulation;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;position:fixed;bottom:1rem;right:1rem}.copilotKitSidebar svg{vertical-align:middle;display:inline-block}.copilotKitSidebarContentWrapper{margin-right:0;transition:margin-right .3s;overflow:visible}@media (width>=640px){.copilotKitSidebarContentWrapper.sidebarExpanded{margin-right:28rem}}.copilotKitButton{border:1px solid var(--copilot-kit-primary-color);background-color:var(--copilot-kit-primary-color);width:3.5rem;height:3.5rem;color:var(--copilot-kit-contrast-color);cursor:pointer;box-shadow:var(--copilot-kit-shadow-sm);border-radius:50%;outline:none;justify-content:center;align-items:center;transition:all .2s;display:flex;position:relative;transform:scale(1)}.copilotKitButton:hover{box-shadow:var(--copilot-kit-shadow-md);transform:scale(1.05)}.copilotKitButton:active{box-shadow:var(--copilot-kit-shadow-sm);transform:scale(.95)}.copilotKitButtonIcon{justify-content:center;align-items:center;transition:opacity .1s,transform .3s;display:flex;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.copilotKitButtonIcon svg{width:1.5rem;height:1.5rem}.copilotKitButton.open .copilotKitButtonIconOpen{opacity:0;transform:translate(-50%,-50%)scale(0)rotate(90deg)}.copilotKitButton.open .copilotKitButtonIconClose,.copilotKitButton:not(.open) .copilotKitButtonIconOpen{opacity:1;transform:translate(-50%,-50%)scale(1)rotate(0)}.copilotKitButton:not(.open) .copilotKitButtonIconClose{opacity:0;transform:translate(-50%,-50%)scale(0)rotate(-90deg)}.copilotKitHeader{height:56px;color:var(--copilot-kit-primary-color);border-bottom:1px solid var(--copilot-kit-separator-color);background-color:var(--copilot-kit-contrast-color);z-index:2;border-top-left-radius:0;border-top-right-radius:0;justify-content:space-between;align-items:center;padding-left:1.5rem;font-weight:500;display:flex;position:relative}.copilotKitSidebar .copilotKitHeader{border-radius:0}.copilotKitHeaderControls{display:flex}.copilotKitHeaderCloseButton{background:0 0;border:none}@media (width>=640px){.copilotKitHeader{border-top-left-radius:8px;border-top-right-radius:8px;padding-left:1.5rem;padding-right:24px}}.copilotKitHeader>button{color:var(--copilot-kit-muted-color);cursor:pointer;background-color:#0000;border:0;border-radius:50%;outline:none;justify-content:center;align-items:center;width:35px;height:35px;padding:8px;transition:background-color .2s;display:flex;position:absolute;top:50%;right:16px;transform:translateY(-50%)}.copilotKitHeader>button:hover{color:color-mix(in srgb, var(--copilot-kit-muted-color) 80%, black)}.copilotKitHeader>button:focus{outline:none}.copilotKitInput{cursor:text;background-color:var(--copilot-kit-input-background-color);border:1px solid var(--copilot-kit-separator-color);border-radius:20px;width:95%;min-height:75px;margin:0 auto;padding:12px 14px;position:relative}.copilotKitInputContainer{background:var(--copilot-kit-background-color);border-bottom-right-radius:.75rem;border-bottom-left-radius:.75rem;width:100%;padding:0 0 15px}.copilotKitSidebar .copilotKitInputContainer{border-bottom-right-radius:0;border-bottom-left-radius:0}.copilotKitInputControlButton{cursor:pointer;color:#00000040;appearance:button;text-transform:none;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;text-indent:0;text-shadow:none;text-align:center;background-color:#0000;background-image:none;border:0;width:24px;height:24px;margin:0;padding:0;transition-property:transform;transition-duration:.2s;transition-timing-function:cubic-bezier(.4,0,.2,1);display:inline-block;transform:scale(1)}.copilotKitInputControlButton:not([disabled]){color:var(--copilot-kit-primary-color)}.copilotKitInputControlButton:not([disabled]):hover{color:color-mix(in srgb, var(--copilot-kit-primary-color) 80%, black);transform:scale(1.05)}.copilotKitInputControlButton[disabled]{color:var(--copilot-kit-muted-color);cursor:default}.copilotKitInputControls{gap:3px;display:flex}.copilotKitInput>textarea{outline-offset:2px;resize:none;white-space:pre-wrap;overflow-wrap:break-word;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;cursor:text;font-family:inherit;font-size:.875rem;line-height:1.5rem;font-weight:inherit;color:var(--copilot-kit-secondary-contrast-color);background-color:#0000;border:0;outline:2px solid #0000;flex:1;width:100%;margin:0;padding:0}.copilotKitInput>textarea::placeholder{color:gray;opacity:1}.copilotKitInputControlButton.copilotKitPushToTalkRecording{color:#fff;background-color:#ec0000;border-radius:50%;animation:2s cubic-bezier(.4,0,.6,1) infinite copilotKitPulseAnimation}.copilotKitInput textarea::-webkit-scrollbar{width:9px}.copilotKitInput textarea::-webkit-scrollbar-track{background:0 0}.copilotKitInput textarea::-webkit-scrollbar-thumb{cursor:pointer;background-color:#c8c8c8;background-clip:content-box;border:2px solid #0000;border-radius:10px}.copilotKitInput textarea::-webkit-scrollbar-thumb:hover{background-color:#a0a0a0}.poweredByContainer{padding:0}.poweredBy{background:var(--copilot-kit-background-color)!important;visibility:visible!important;text-align:center!important;color:#d6d6d6!important;margin:0!important;padding:3px 0!important;font-size:12px!important;display:block!important;position:static!important}.dark,html.dark,body.dark,[data-theme=dark],html[style*="color-scheme: dark"],body[style*="color-scheme: dark"] .poweredBy{color:#454545!important}.copilotKitMessages{background-color:var(--copilot-kit-background-color);color:var(--copilot-kit-secondary-contrast-color);z-index:1;flex-direction:column;flex:1;justify-content:space-between;display:flex;overflow-y:scroll}.copilotKitMessagesContainer{flex-direction:column;padding:1rem 24px;display:flex}.copilotKitMessagesFooter{flex-direction:column;justify-content:flex-start;width:97%;margin:8px auto 0;padding:.5rem .75rem;display:flex}.copilotKitMessages::-webkit-scrollbar{width:6px}.copilotKitMessages::-webkit-scrollbar-thumb{background-color:var(--copilot-kit-separator-color);border:2px solid var(--copilot-kit-background-color);border-radius:10rem}.copilotKitMessages::-webkit-scrollbar-track-piece:start{background:0 0}.copilotKitMessages::-webkit-scrollbar-track-piece:end{background:0 0}.copilotKitMessage{overflow-wrap:break-word;border-radius:15px;max-width:80%;margin-bottom:.5rem;padding:8px 12px;font-size:1rem;line-height:1.5}.copilotKitMessage.copilotKitUserMessage{background:var(--copilot-kit-primary-color);color:var(--copilot-kit-contrast-color);white-space:pre-wrap;margin-left:auto;font-size:1rem;line-height:1.75}.copilotKitMessage.copilotKitAssistantMessage{max-width:100%;color:var(--copilot-kit-secondary-contrast-color);background:0 0;margin-right:auto;padding-left:0;position:relative}.copilotKitMessage.copilotKitAssistantMessage .copilotKitMessageControls{opacity:0;gap:1rem;padding:5px 0 0;transition:opacity .2s;display:flex;position:absolute;left:0}.copilotKitMessageControls.currentMessage{opacity:1!important}.copilotKitMessage.copilotKitAssistantMessage:hover .copilotKitMessageControls{opacity:1}@media (width<=768px){.copilotKitMessage.copilotKitAssistantMessage .copilotKitMessageControls{opacity:1}}.copilotKitMessageControlButton{width:20px;height:20px;color:var(--copilot-kit-primary-color);cursor:pointer;z-index:10;background:0 0;border:none;border-radius:.5rem;justify-content:center;align-items:center;margin:0;padding:0;transition:all .2s;display:flex}.copilotKitMessageControlButton:hover,.copilotKitMessageControlButton:active{color:color-mix(in srgb, var(--copilot-kit-primary-color) 80%, black);transform:scale(1.05)}.copilotKitMessageControlButton.active{background-color:var(--copilot-kit-primary-color);color:var(--copilot-kit-contrast-color)}.copilotKitMessageControlButton.active:hover{background-color:color-mix(in srgb, var(--copilot-kit-primary-color) 90%, black);color:var(--copilot-kit-contrast-color)}.copilotKitMessageControlButton svg{pointer-events:none;width:1rem;height:1rem;display:block}.copilotKitMessage.copilotKitAssistantMessage+.copilotKitMessage.copilotKitUserMessage{margin-top:1.5rem}.copilotKitCustomAssistantMessage{margin-top:1.5rem;margin-bottom:1.5rem}.copilotKitMessage .inProgressLabel{opacity:.7;margin-left:10px}@keyframes copilotKitSpinAnimation{to{transform:rotate(360deg)}}.copilotKitSpinner{border:2px solid var(--copilot-kit-contrast-color);border-top-color:var(--copilot-kit-primary-color);border-radius:50%;width:16px;height:16px;animation:1s linear infinite copilotKitSpinAnimation;display:inline-block}@keyframes copilotKitActivityDotAnimation{0%,80%,to{opacity:.5;transform:scale(.5)}40%{opacity:1;transform:scale(1)}}.copilotKitActivityDot{background-color:var(--copilot-kit-primary-color);border-radius:50%;width:6px;height:6px;animation:1.4s ease-in-out infinite both copilotKitActivityDotAnimation;display:inline-block}.copilotKitImageRendering{flex-direction:column;gap:8px;display:flex}.copilotKitImageRenderingImage{max-width:100%;height:auto;box-shadow:var(--copilot-kit-shadow-sm);border-radius:8px}.copilotKitImageRenderingContent{color:var(--copilot-kit-secondary-contrast-color);margin-top:8px;padding:0 16px;font-size:.875rem;line-height:1.5}.copilotKitImageRenderingError{border:1px solid var(--copilot-kit-separator-color);background-color:var(--copilot-kit-input-background-color);border-radius:8px;flex-direction:column;gap:8px;padding:12px;display:flex}.copilotKitImageRenderingErrorMessage{background-color:var(--copilot-kit-error-background);border:1px solid var(--copilot-kit-error-border);color:var(--copilot-kit-error-text);border-radius:6px;align-items:center;gap:8px;padding:8px 12px;font-size:.875rem;font-weight:500;display:flex}.copilotKitImageRenderingErrorMessage:before{content:"⚠️";font-size:1rem}.copilotKitAttachmentQueue{flex-wrap:wrap;gap:8px;margin:8px;padding:8px;display:flex}.copilotKitAttachmentQueueItem{border:1px solid var(--copilot-kit-separator-color);background:var(--copilot-kit-input-background-color);border-radius:8px;display:inline-flex;position:relative;overflow:hidden}.copilotKitAttachmentQueueItem--image,.copilotKitAttachmentQueueItem--video{width:72px;height:72px}.copilotKitAttachmentQueueItem--audio{flex-direction:column;min-width:200px;max-width:280px;padding:4px}.copilotKitAttachmentQueueItem--document{max-width:200px;padding:8px 12px}.copilotKitAttachmentQueueOverlay{z-index:1;background:#0006;justify-content:center;align-items:center;display:flex;position:absolute;inset:0}.copilotKitAttachmentQueueSpinner{border:2px solid #ffffff4d;border-top-color:#fff;border-radius:50%;width:20px;height:20px;animation:.6s linear infinite copilotKitSpin}@keyframes copilotKitSpin{to{transform:rotate(360deg)}}.copilotKitAttachmentQueueRemoveButton{color:#fff;cursor:pointer;z-index:2;background:#0009;border:none;border-radius:50%;justify-content:center;align-items:center;width:20px;height:20px;padding:0;font-size:10px;line-height:1;display:flex;position:absolute;top:4px;right:4px}.copilotKitAttachmentQueueRemoveButton:hover{background:#000c}.copilotKitAttachmentQueuePreviewPlaceholder{background:var(--copilot-kit-input-background-color);width:100%;height:100%}.copilotKitAttachmentQueuePreviewImage{object-fit:cover;width:100%;height:100%}.copilotKitAttachmentQueuePreviewAudio{flex-direction:column;gap:4px;width:100%;display:flex}.copilotKitAttachmentQueuePreviewAudio audio{width:100%;height:32px}.copilotKitAttachmentQueuePreviewVideo{width:100%;height:100%}.copilotKitAttachmentQueuePreviewDocument{align-items:center;gap:8px;display:flex}.copilotKitAttachmentQueueDocIcon{background:var(--copilot-kit-primary-color,#6366f1);color:#fff;border-radius:6px;flex-shrink:0;justify-content:center;align-items:center;width:32px;height:32px;font-size:10px;font-weight:600;display:flex}.copilotKitAttachmentQueueDocInfo{flex-direction:column;gap:2px;min-width:0;display:flex}.copilotKitAttachmentQueueFilename{text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:500;overflow:hidden}.copilotKitAttachmentQueueFileSize{color:var(--copilot-kit-secondary-contrast-color);font-size:11px}.copilotKitDragOver{outline:2px dashed var(--copilot-kit-primary-color,#6366f1);outline-offset:-4px;border-radius:8px}.copilotKitAttachment{flex-direction:column;gap:4px;max-width:100%;display:inline-flex}.copilotKitAttachmentAudio audio{width:100%;max-width:300px;height:40px}.copilotKitAttachmentVideo video{border-radius:8px;width:100%;max-width:400px}.copilotKitAttachmentDocument{border:1px solid var(--copilot-kit-separator-color);background:var(--copilot-kit-input-background-color);border-radius:8px;align-items:center;gap:8px;padding:8px 12px;display:inline-flex}.copilotKitAttachmentDocIcon{background:var(--copilot-kit-primary-color,#6366f1);color:#fff;border-radius:6px;flex-shrink:0;justify-content:center;align-items:center;width:28px;height:28px;font-size:9px;font-weight:600;display:flex}.copilotKitAttachmentDocInfo{flex-direction:column;gap:1px;min-width:0;display:flex}.copilotKitAttachmentDocName{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:500;overflow:hidden}.copilotKitAttachmentDocMeta{color:var(--copilot-kit-secondary-contrast-color);font-size:11px}.copilotKitWindow{transform-origin:bottom;background-color:var(--copilot-kit-background-color);opacity:0;pointer-events:none;border-color:#e5e7eb;border-radius:.75rem;flex-direction:column;transition:opacity .1s ease-out,transform .2s ease-out;display:flex;position:fixed;inset:0;transform:scale(.95)translateY(20px);box-shadow:0 5px 40px #00000029}.copilotKitSidebar .copilotKitWindow{opacity:1;border-radius:0;transform:translate(100%)}.copilotKitWindow.open{opacity:1;pointer-events:auto;transform:scale(1)translateY(0)}.copilotKitSidebar .copilotKitWindow.open{transform:translate(0)}.copilotKitChatBody{flex-direction:column;flex:1;min-height:0;display:flex}@media (width>=640px){.copilotKitWindow{transform-origin:100% 100%;border-width:0;width:24rem;height:600px;min-height:200px;max-height:calc(100% - 6rem);margin-bottom:1rem;inset:auto 1rem 5rem auto}.copilotKitSidebar .copilotKitWindow{width:28rem;min-height:100%;max-height:none;margin-bottom:0;inset:auto 0 0 auto}}.copilotKitActivityDot1{animation:1.05s infinite copilotKitActivityDotsAnimation}.copilotKitActivityDot2{animation-delay:.1s}.copilotKitActivityDot3{animation-delay:.2s}@keyframes copilotKitActivityDotsAnimation{0%,57.14%{animation-timing-function:cubic-bezier(.33,.66,.66,1);transform:translate(0)}28.57%{animation-timing-function:cubic-bezier(.33,0,.66,.33);transform:translateY(-6px)}to{transform:translate(0)}}@keyframes copilotKitPulseAnimation{50%{opacity:.5}}h1.copilotKitMarkdownElement,h2.copilotKitMarkdownElement,h3.copilotKitMarkdownElement,h4.copilotKitMarkdownElement,h5.copilotKitMarkdownElement,h6.copilotKitMarkdownElement{font-weight:700;line-height:1.2}h1.copilotKitMarkdownElement:not(:last-child),h2.copilotKitMarkdownElement:not(:last-child),h3.copilotKitMarkdownElement:not(:last-child),h4.copilotKitMarkdownElement:not(:last-child),h5.copilotKitMarkdownElement:not(:last-child),h6.copilotKitMarkdownElement:not(:last-child){margin-bottom:1rem}h1.copilotKitMarkdownElement{font-size:1.5em}h2.copilotKitMarkdownElement{font-size:1.25em;font-weight:600}h3.copilotKitMarkdownElement{font-size:1.1em}h4.copilotKitMarkdownElement{font-size:1em}h5.copilotKitMarkdownElement{font-size:.9em}h6.copilotKitMarkdownElement{font-size:.8em}a.copilotKitMarkdownElement{color:#00f;text-decoration:underline}p.copilotKitMarkdownElement{margin:0;padding:0;font-size:1rem;line-height:1.75}p.copilotKitMarkdownElement:not(:last-child),pre.copilotKitMarkdownElement:not(:last-child),ol.copilotKitMarkdownElement:not(:last-child),ul.copilotKitMarkdownElement:not(:last-child),blockquote.copilotKitMarkdownElement:not(:last-child){margin-bottom:1.25em}blockquote.copilotKitMarkdownElement{border-color:#8e8ea0;border-left-style:solid;border-left-width:2px;padding-left:10px;line-height:1.2}blockquote.copilotKitMarkdownElement p{padding:.7em 0}ul.copilotKitMarkdownElement{padding-left:20px;list-style-type:disc;overflow:visible}li.copilotKitMarkdownElement{list-style-type:inherit;margin-left:0;padding-left:0;list-style-position:outside;position:relative;overflow:visible}.copilotKitCodeBlock{background-color:#09090b;border-radius:.375rem;width:100%;position:relative}.copilotKitCodeBlockToolbar{color:#e4e4e4;background-color:#27272a;border-top-left-radius:.375rem;border-top-right-radius:.375rem;justify-content:space-between;align-items:center;width:100%;padding-top:.09rem;padding-bottom:.09rem;padding-left:1rem;font-family:sans-serif;display:flex}.copilotKitCodeBlockToolbarLanguage{text-transform:lowercase;font-size:.75rem;line-height:1rem}.copilotKitCodeBlockToolbarButtons{align-items:center;margin-left:.25rem;margin-right:.25rem;display:flex}.copilotKitCodeBlockToolbarButton{border-radius:.375rem;justify-content:center;align-items:center;height:2.5rem;margin:2px;padding:3px;font-size:.875rem;font-weight:500;line-height:1.25rem;display:inline-flex}.copilotKitCodeBlockToolbarButton:hover{background-color:#37373a}.copilotKitInlineCode{background-color:var(--copilot-kit-input-background-color);border:1px solid var(--copilot-kit-separator-color);border-radius:.375rem;padding:.05rem .4rem;font-size:15px}.copilotKitMessages footer .suggestions{flex-wrap:wrap;gap:6px;display:flex}.copilotKitMessages footer h6{margin-bottom:8px;font-size:.7rem;font-weight:500}.copilotKitMessages footer .suggestions .suggestion{border:1px solid var(--copilot-kit-muted-color);color:var(--copilot-kit-secondary-contrast-color);border-radius:15px;padding:6px 10px;font-size:.7rem;box-shadow:0 5px 5px #00000003,0 2px 3px #00000005}.copilotKitMessages footer .suggestions .suggestion.loading{color:var(--copilot-kit-secondary-contrast-color);border:none;padding:0;font-size:.7rem}.copilotKitMessages footer .suggestions button{transition:transform .3s}.copilotKitMessages footer .suggestions button:not(:disabled):hover{transform:scale(1.03)}.copilotKitMessages footer .suggestions button:disabled{cursor:wait}.copilotKitMessages footer .suggestions button svg{margin-right:6px}.copilotKitChat{z-index:30;-webkit-text-size-adjust:100%;tab-size:4;background:var(--copilot-kit-background-color);font-feature-settings:normal;font-variation-settings:normal;touch-action:manipulation;flex-direction:column;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;display:flex}.copilotKitChat svg{vertical-align:middle;display:inline-block}.copilotKitChat .copilotKitMessages{flex-grow:1}.copilotKitDevConsole{align-items:center;gap:5px;margin:0 15px;display:flex}.copilotKitDevConsole.copilotKitDevConsoleWarnOutdated{background-color:var(--copilot-kit-dev-console-bg)}.copilotKitDevConsole .copilotKitVersionInfo{background:#ebb305;justify-content:center;align-items:center;gap:10px;width:100%;padding:3px 5px;font-size:.8rem;display:flex;position:absolute;bottom:-25px;left:0}.copilotKitDevConsole .copilotKitVersionInfo button{background-color:var(--copilot-kit-dev-console-bg);text-align:left;white-space:nowrap;text-overflow:ellipsis;border:1px solid #979797;border-radius:4px;width:260px;padding:1px 12px 1px 5px;font-family:monospace;font-size:11px;font-weight:400;display:inline-block;overflow:hidden}.copilotKitDevConsole .copilotKitVersionInfo aside{color:#7f7a7a;margin-left:5px;font-weight:400;display:inline}.copilotKitDevConsole .copilotKitVersionInfo svg{margin-top:-3px;margin-left:3px}.copilotKitDevConsole .copilotKitDebugMenuTriggerButton{border:1px solid var(--copilot-kit-muted-color);background-color:#0000;border-radius:20px;outline:none;justify-content:center;align-items:center;height:30px;padding:0 10px;font-size:11px;font-weight:700;display:flex}.copilotKitDebugMenuTriggerButton.compact{width:35px;color:var(--copilot-kit-dev-console-bg);outline:none;justify-content:center;font-size:8px}.copilotKitDevConsole .copilotKitDebugMenuTriggerButton:hover{background-color:color-mix(in srgb, var(--copilot-kit-dev-console-bg) 85%, black);color:var(--copilot-kit-dev-console-text)}.dark,html.dark,body.dark,[data-theme=dark],html[style*="color-scheme: dark"],body[style*="color-scheme: dark"] .copilotKitDevConsole .copilotKitDebugMenuTriggerButton{color:#fff}.dark,html.dark,body.dark,[data-theme=dark],html[style*="color-scheme: dark"],body[style*="color-scheme: dark"] .copilotKitDevConsole .copilotKitDebugMenuTriggerButton:hover{background-color:color-mix(in srgb, var(--copilot-kit-dev-console-bg) 20%, black)}.copilotKitDevConsole .copilotKitDebugMenuTriggerButton>svg{margin-left:10px}.copilotKitDebugMenu{--copilot-kit-dev-console-border:color-mix(in srgb, var(--copilot-kit-dev-console-bg) 80%, black);background-color:var(--copilot-kit-dev-console-bg);border:1px solid var(--copilot-kit-dev-console-border);border-radius:6px;outline:none;margin-top:2px;padding:.25rem;font-size:13px}.copilotKitDebugMenuItem{text-align:left;cursor:pointer;width:100%;color:var(--copilot-kit-dev-console-text);background:0 0;border:none;padding:3px 10px;display:block}.copilotKitDebugMenuItem:hover{background-color:color-mix(in srgb, var(--copilot-kit-dev-console-bg) 95%, black);border-radius:4px}.copilotKitDebugMenu[data-closed]{opacity:0;transform:scale(.95)}.copilotKitDebugMenu hr{background-color:var(--copilot-kit-dev-console-border);border:none;height:1px;margin:.25rem}.copilotKitHelpModal{background-color:var(--copilot-kit-dev-console-bg);color:var(--copilot-kit-dev-console-text)}.copilotKitHelpItemButton{text-align:center;border:1px solid var(--copilot-kit-muted-color);width:100%;color:var(--copilot-kit-dev-console-text);background-color:var(--copilot-kit-dev-console-bg);border-radius:15px;padding:4px 6px;font-size:.8rem;display:block;box-shadow:0 5px 5px #00000003,0 2px 3px #00000005}.copilotKitHelpItemButton:hover{background-color:color-mix(in srgb, var(--copilot-kit-dev-console-bg) 95%, black)}.copilotkit-response{text-align:right}.copilotkit-response-content{color:#4b5563;text-align:left;background-color:#f9fafb;border-radius:.25rem;margin-bottom:.5rem;padding:.5rem;font-size:.875rem}.copilotkit-response-actions{flex-direction:column;align-items:flex-end;display:inline-flex}.copilotkit-response-label{color:#6b7280;align-items:center;margin-bottom:.25rem;font-size:.75rem;display:flex}.copilotkit-toggle-button{cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;margin-right:.25rem;padding:0;display:flex}.copilotkit-icon{color:#6b7280;width:.75rem;height:.75rem}.copilotkit-response-buttons{gap:.5rem;display:flex}.copilotkit-response-button{color:#4b5563;cursor:pointer;background-color:#f3f4f6;border:none;border-radius:.25rem;padding:.25rem .5rem;font-size:.75rem;transition:background-color .2s}.copilotkit-response-button:hover{background-color:#e5e7eb}.copilotkit-response-button:focus{outline:none}.copilotkit-response-completed-feedback{background-color:#f9fafb;border-radius:.375rem;align-items:center;padding:.5rem;display:inline-flex}.copilotkit-response-completed-feedback span{color:#4b5563;font-size:.75rem;font-weight:500}.copilotkit-state{margin-bottom:1rem;font-size:.875rem}.copilotkit-state-header{cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:.25rem;margin-bottom:.25rem;display:flex}.copilotkit-state-label{color:#4b5563;font-size:.875rem}.copilotkit-state-label-loading{align-items:center;animation:1.5s infinite pulse;display:inline-flex}.copilotkit-state-content{border-left:1px solid #e5e7eb;max-height:250px;margin-left:.375rem;padding-top:.375rem;padding-left:1rem;overflow:auto}.copilotkit-state-item{margin-bottom:.25rem;padding:.25rem 0;transition:all .3s}.copilotkit-state-item-newest{animation:.5s ease-out appear}.copilotkit-state-item-header{opacity:.7;font-size:.75rem}.copilotkit-state-item-thought{opacity:.8;margin-top:.125rem;font-size:.75rem}.copilotkit-state-item-result{margin-top:.125rem;font-size:.75rem}.copilotkit-state-item-description{opacity:.8;margin-top:.125rem;font-size:.75rem}.copilotkit-state-empty{opacity:.7;padding:.25rem 0;font-size:.75rem}.copilotkit-skeleton{padding:.125rem 0;animation:1.5s infinite pulse}.copilotkit-skeleton-header{justify-content:space-between;display:flex}.copilotkit-skeleton-title{background-color:#e5e7eb;border-radius:.25rem;width:4rem;height:.625rem}.copilotkit-skeleton-subtitle{background-color:#e5e7eb;border-radius:.25rem;width:2rem;height:.5rem}.copilotkit-skeleton-content{background-color:#e5e7eb;border-radius:.25rem;height:1.5rem;margin-top:.125rem}.copilotkit-loader,.copilotkit-spinner{animation:1.5s linear infinite spin}@keyframes appear{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@keyframes pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (prefers-color-scheme:dark){.copilotkit-response-content{color:#9ca3af;background-color:#1f2937}.copilotkit-response-label,.copilotkit-icon{color:#9ca3af}.copilotkit-response-button{color:#d1d5db;background-color:#1f2937}.copilotkit-response-button:hover{background-color:#374151}.copilotkit-response-completed-feedback{background-color:#1f2937}.copilotkit-response-completed-feedback span{color:#e5e7eb}.copilotkit-state-label{color:#d1d5db}.copilotkit-state-content{border-left-color:#374151}.copilotkit-skeleton-title,.copilotkit-skeleton-subtitle,.copilotkit-skeleton-content{background-color:#374151}}
2
+ /*$vite$:1*/
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="48" height="46" fill="none" viewBox="0 0 48 46"><path fill="#863bff" d="M25.946 44.938c-.664.845-2.021.375-2.021-.698V33.937a2.26 2.26 0 0 0-2.262-2.262H10.287c-.92 0-1.456-1.04-.92-1.788l7.48-10.471c1.07-1.497 0-3.578-1.842-3.578H1.237c-.92 0-1.456-1.04-.92-1.788L10.013.474c.214-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.471c-1.07 1.498 0 3.579 1.842 3.579h11.377c.943 0 1.473 1.088.89 1.83L25.947 44.94z" style="fill:#863bff;fill:color(display-p3 .5252 .23 1);fill-opacity:1"/><mask id="a" width="48" height="46" x="0" y="0" maskUnits="userSpaceOnUse" style="mask-type:alpha"><path fill="#000" d="M25.842 44.938c-.664.844-2.021.375-2.021-.698V33.937a2.26 2.26 0 0 0-2.262-2.262H10.183c-.92 0-1.456-1.04-.92-1.788l7.48-10.471c1.07-1.498 0-3.579-1.842-3.579H1.133c-.92 0-1.456-1.04-.92-1.787L9.91.473c.214-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.471c-1.07 1.498 0 3.578 1.842 3.578h11.377c.943 0 1.473 1.088.89 1.832L25.843 44.94z" style="fill:#000;fill-opacity:1"/></mask><g mask="url(#a)"><g filter="url(#b)"><ellipse cx="5.508" cy="14.704" fill="#ede6ff" rx="5.508" ry="14.704" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -4.47 31.516)"/></g><g filter="url(#c)"><ellipse cx="10.399" cy="29.851" fill="#ede6ff" rx="10.399" ry="29.851" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -39.328 7.883)"/></g><g filter="url(#d)"><ellipse cx="5.508" cy="30.487" fill="#7e14ff" rx="5.508" ry="30.487" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.814 -25.913 -14.639)scale(1 -1)"/></g><g filter="url(#e)"><ellipse cx="5.508" cy="30.599" fill="#7e14ff" rx="5.508" ry="30.599" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.814 -32.644 -3.334)scale(1 -1)"/></g><g filter="url(#f)"><ellipse cx="5.508" cy="30.599" fill="#7e14ff" rx="5.508" ry="30.599" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -34.34 30.47)"/></g><g filter="url(#g)"><ellipse cx="14.072" cy="22.078" fill="#ede6ff" rx="14.072" ry="22.078" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="rotate(93.35 24.506 48.493)scale(-1 1)"/></g><g filter="url(#h)"><ellipse cx="3.47" cy="21.501" fill="#7e14ff" rx="3.47" ry="21.501" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.009 28.708 47.59)scale(-1 1)"/></g><g filter="url(#i)"><ellipse cx="3.47" cy="21.501" fill="#7e14ff" rx="3.47" ry="21.501" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.009 28.708 47.59)scale(-1 1)"/></g><g filter="url(#j)"><ellipse cx=".387" cy="8.972" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(39.51 .387 8.972)"/></g><g filter="url(#k)"><ellipse cx="47.523" cy="-6.092" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 47.523 -6.092)"/></g><g filter="url(#l)"><ellipse cx="41.412" cy="6.333" fill="#47bfff" rx="5.971" ry="9.665" style="fill:#47bfff;fill:color(display-p3 .2799 .748 1);fill-opacity:1" transform="rotate(37.892 41.412 6.333)"/></g><g filter="url(#m)"><ellipse cx="-1.879" cy="38.332" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 -1.88 38.332)"/></g><g filter="url(#n)"><ellipse cx="-1.879" cy="38.332" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 -1.88 38.332)"/></g><g filter="url(#o)"><ellipse cx="35.651" cy="29.907" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 35.651 29.907)"/></g><g filter="url(#p)"><ellipse cx="38.418" cy="32.4" fill="#47bfff" rx="5.971" ry="15.297" style="fill:#47bfff;fill:color(display-p3 .2799 .748 1);fill-opacity:1" transform="rotate(37.892 38.418 32.4)"/></g></g><defs><filter id="b" width="60.045" height="41.654" x="-19.77" y="16.149" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="c" width="90.34" height="51.437" x="-54.613" y="-7.533" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="d" width="79.355" height="29.4" x="-49.64" y="2.03" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="e" width="79.579" height="29.4" x="-45.045" y="20.029" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="f" width="79.579" height="29.4" x="-43.513" y="21.178" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="g" width="74.749" height="58.852" x="15.756" y="-17.901" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="h" width="61.377" height="25.362" x="23.548" y="2.284" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="i" width="61.377" height="25.362" x="23.548" y="2.284" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="j" width="56.045" height="63.649" x="-27.636" y="-22.853" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="k" width="54.814" height="64.646" x="20.116" y="-38.415" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="l" width="33.541" height="35.313" x="24.641" y="-11.323" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="m" width="54.814" height="64.646" x="-29.286" y="6.009" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="n" width="54.814" height="64.646" x="-29.286" y="6.009" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="o" width="54.814" height="64.646" x="8.244" y="-2.416" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="p" width="39.409" height="43.623" x="18.713" y="10.588" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter></defs></svg>
package/dist/icons.svg ADDED
@@ -0,0 +1,24 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg">
2
+ <symbol id="bluesky-icon" viewBox="0 0 16 17">
3
+ <g clip-path="url(#bluesky-clip)"><path fill="#08060d" d="M7.75 7.735c-.693-1.348-2.58-3.86-4.334-5.097-1.68-1.187-2.32-.981-2.74-.79C.188 2.065.1 2.812.1 3.251s.241 3.602.398 4.13c.52 1.744 2.367 2.333 4.07 2.145-2.495.37-4.71 1.278-1.805 4.512 3.196 3.309 4.38-.71 4.987-2.746.608 2.036 1.307 5.91 4.93 2.746 2.72-2.746.747-4.143-1.747-4.512 1.702.189 3.55-.4 4.07-2.145.156-.528.397-3.691.397-4.13s-.088-1.186-.575-1.406c-.42-.19-1.06-.395-2.741.79-1.755 1.24-3.64 3.752-4.334 5.099"/></g>
4
+ <defs><clipPath id="bluesky-clip"><path fill="#fff" d="M.1.85h15.3v15.3H.1z"/></clipPath></defs>
5
+ </symbol>
6
+ <symbol id="discord-icon" viewBox="0 0 20 19">
7
+ <path fill="#08060d" d="M16.224 3.768a14.5 14.5 0 0 0-3.67-1.153c-.158.286-.343.67-.47.976a13.5 13.5 0 0 0-4.067 0c-.128-.306-.317-.69-.476-.976A14.4 14.4 0 0 0 3.868 3.77C1.546 7.28.916 10.703 1.231 14.077a14.7 14.7 0 0 0 4.5 2.306q.545-.748.965-1.587a9.5 9.5 0 0 1-1.518-.74q.191-.14.372-.293c2.927 1.369 6.107 1.369 8.999 0q.183.152.372.294-.723.437-1.52.74.418.838.963 1.588a14.6 14.6 0 0 0 4.504-2.308c.37-3.911-.63-7.302-2.644-10.309m-9.13 8.234c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.894 0 1.614.82 1.599 1.82.001 1-.705 1.82-1.6 1.82m5.91 0c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.893 0 1.614.82 1.599 1.82 0 1-.706 1.82-1.6 1.82"/>
8
+ </symbol>
9
+ <symbol id="documentation-icon" viewBox="0 0 21 20">
10
+ <path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="m15.5 13.333 1.533 1.322c.645.555.967.833.967 1.178s-.322.623-.967 1.179L15.5 18.333m-3.333-5-1.534 1.322c-.644.555-.966.833-.966 1.178s.322.623.966 1.179l1.534 1.321"/>
11
+ <path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M17.167 10.836v-4.32c0-1.41 0-2.117-.224-2.68-.359-.906-1.118-1.621-2.08-1.96-.599-.21-1.349-.21-2.848-.21-2.623 0-3.935 0-4.983.369-1.684.591-3.013 1.842-3.641 3.428C3 6.449 3 7.684 3 10.154v2.122c0 2.558 0 3.838.706 4.726q.306.383.713.671c.76.536 1.79.64 3.581.66"/>
12
+ <path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M3 10a2.78 2.78 0 0 1 2.778-2.778c.555 0 1.209.097 1.748-.047.48-.129.854-.503.982-.982.145-.54.048-1.194.048-1.749a2.78 2.78 0 0 1 2.777-2.777"/>
13
+ </symbol>
14
+ <symbol id="github-icon" viewBox="0 0 19 19">
15
+ <path fill="#08060d" fill-rule="evenodd" d="M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844" clip-rule="evenodd"/>
16
+ </symbol>
17
+ <symbol id="social-icon" viewBox="0 0 20 20">
18
+ <path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M12.5 6.667a4.167 4.167 0 1 0-8.334 0 4.167 4.167 0 0 0 8.334 0"/>
19
+ <path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M2.5 16.667a5.833 5.833 0 0 1 8.75-5.053m3.837.474.513 1.035c.07.144.257.282.414.309l.93.155c.596.1.736.536.307.965l-.723.73a.64.64 0 0 0-.152.531l.207.903c.164.715-.213.991-.84.618l-.872-.52a.63.63 0 0 0-.577 0l-.872.52c-.624.373-1.003.094-.84-.618l.207-.903a.64.64 0 0 0-.152-.532l-.723-.729c-.426-.43-.289-.864.306-.964l.93-.156a.64.64 0 0 0 .412-.31l.513-1.034c.28-.562.735-.562 1.012 0"/>
20
+ </symbol>
21
+ <symbol id="x-icon" viewBox="0 0 19 19">
22
+ <path fill="#08060d" fill-rule="evenodd" d="M1.893 1.98c.052.072 1.245 1.769 2.653 3.77l2.892 4.114c.183.261.333.48.333.486s-.068.089-.152.183l-.522.593-.765.867-3.597 4.087c-.375.426-.734.834-.798.905a1 1 0 0 0-.118.148c0 .01.236.017.664.017h.663l.729-.83c.4-.457.796-.906.879-.999a692 692 0 0 0 1.794-2.038c.034-.037.301-.34.594-.675l.551-.624.345-.392a7 7 0 0 1 .34-.374c.006 0 .93 1.306 2.052 2.903l2.084 2.965.045.063h2.275c1.87 0 2.273-.003 2.266-.021-.008-.02-1.098-1.572-3.894-5.547-2.013-2.862-2.28-3.246-2.273-3.266.008-.019.282-.332 2.085-2.38l2-2.274 1.567-1.782c.022-.028-.016-.03-.65-.03h-.674l-.3.342a871 871 0 0 1-1.782 2.025c-.067.075-.405.458-.75.852a100 100 0 0 1-.803.91c-.148.172-.299.344-.99 1.127-.304.343-.32.358-.345.327-.015-.019-.904-1.282-1.976-2.808L6.365 1.85H1.8zm1.782.91 8.078 11.294c.772 1.08 1.413 1.973 1.425 1.984.016.017.241.02 1.05.017l1.03-.004-2.694-3.766L7.796 5.75 5.722 2.852l-1.039-.004-1.039-.004z" clip-rule="evenodd"/>
23
+ </symbol>
24
+ </svg>
package/dist/index.cjs ADDED
@@ -0,0 +1,21 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`react`);c=s(c);let l=require(`react/jsx-runtime`),u=require(`@copilotkit/react-core`),d=require(`@copilotkit/react-ui`);var f=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},p=new class extends f{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},m={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},h=new class{#e=m;#t=!1;setTimeoutProvider(e){process.env.NODE_ENV!==`production`&&this.#t&&e!==this.#e&&console.error(`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,{previous:this.#e,provider:e}),this.#e=e,process.env.NODE_ENV!==`production`&&(this.#t=!1)}setTimeout(e,t){return process.env.NODE_ENV!==`production`&&(this.#t=!0),this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!==`production`&&(this.#t=!0),this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function g(e){setTimeout(e,0)}var _=typeof window>`u`||`Deno`in globalThis;function v(){}function y(e,t){return typeof e==`function`?e(t):e}function b(e){return typeof e==`number`&&e>=0&&e!==1/0}function x(e,t){return Math.max(e+(t||0)-Date.now(),0)}function S(e,t){return typeof e==`function`?e(t):e}function C(e,t){return typeof e==`function`?e(t):e}function w(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==E(o,t.options))return!1}else if(!O(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function T(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(D(t.options.mutationKey)!==D(a))return!1}else if(!O(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function E(e,t){return(t?.queryKeyHashFn||D)(e)}function D(e){return JSON.stringify(e,(e,t)=>j(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function O(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>O(e[n],t[n])):!1}var ee=Object.prototype.hasOwnProperty;function k(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=te(e)&&te(t);if(!r&&!(j(e)&&j(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ee.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=k(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function A(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function te(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function j(e){if(!ne(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ne(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ne(e){return Object.prototype.toString.call(e)===`[object Object]`}function re(e){return new Promise(t=>{h.setTimeout(t,e)})}function M(e,t,n){if(typeof n.structuralSharing==`function`)return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!==`production`)try{return k(e,t)}catch(e){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${e}`),e}return k(e,t)}return t}function ie(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ae(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var N=Symbol();function oe(e,t){return process.env.NODE_ENV!==`production`&&e.queryFn===N&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===N?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function se(e,t){return typeof e==`function`?e(...t):!!e}function ce(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var P=(()=>{let e=()=>_;return{isServer(){return e()},setIsServer(t){e=t}}})();function F(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var le=g;function ue(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=le,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var I=ue(),L=new class extends f{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function de(e){return Math.min(1e3*2**e,3e4)}function R(e){return(e??`online`)===`online`?L.isOnline():!0}var z=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function B(e){let t=!1,n=0,r,i=F(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new z(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>p.isFocused()&&(e.networkMode===`always`||L.isOnline())&&e.canRun(),u=()=>R(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),h=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(P.isServer()?0:3),o=e.retryDelay??de,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),re(s).then(()=>l()?void 0:m()).then(()=>{t?f(r):h()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?h():m().then(h),i)}}var V=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),b(this.gcTime)&&(this.#e=h.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(P.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(h.clearTimeout(this.#e),this.#e=void 0)}},fe=class extends V{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=pe(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=pe(this.options);e.data!==void 0&&(this.setState(U(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=M(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#c({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(v).catch(v):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>C(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===N||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>S(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!x(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o||this.#s()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#s(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}process.env.NODE_ENV!==`production`&&(Array.isArray(this.options.queryKey)||console.error(`As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`));let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=oe(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=B({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof z&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw process.env.NODE_ENV!==`production`&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof z){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#c(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...H(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...U(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}})(this.state),I.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function H(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:R(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function U(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function pe(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var me=class extends f{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=F(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ge(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return W(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return W(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof C(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!A(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&_e(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||C(this.options.enabled,this.#t)!==C(t.enabled,this.#t)||S(this.options.staleTime,this.#t)!==S(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||C(this.options.enabled,this.#t)!==C(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ve(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(v)),t}#g(){this.#b();let e=S(this.options.staleTime,this.#t);if(P.isServer()||this.#r.isStale||!b(e))return;let t=x(this.#r.dataUpdatedAt,e)+1;this.#d=h.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(P.isServer()||C(this.options.enabled,this.#t)===!1||!b(this.#p)||this.#p===0)&&(this.#f=h.setInterval(()=>{(this.options.refetchIntervalInBackground||p.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(h.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(h.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ge(e,t),o=i&&_e(e,n,t,r);(a||o)&&(l={...l,...H(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=M(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=M(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:G(e,t),refetch:this.refetch,promise:this.#o,isEnabled:C(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=F())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!A(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){I.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function he(e,t){return C(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function ge(e,t){return he(e,t)||e.state.data!==void 0&&W(e,t,t.refetchOnMount)}function W(e,t,n){if(C(t.enabled,e)!==!1&&S(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&G(e,t)}return!1}function _e(e,t,n,r){return(e!==t||C(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&G(e,n)}function G(e,t){return C(t.enabled,e)!==!1&&e.isStaleByTime(S(t.staleTime,e))}function ve(e,t){return!A(e.getCurrentResult(),t)}function ye(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ce(e,()=>t.signal,()=>n=!0)},u=oe(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?ae:ie;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?xe:be,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:be(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function be(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function xe(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Se=class extends V{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ce(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=B({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),I.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ce(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var we=class extends f{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Se({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=K(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=K(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=K(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=K(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){I.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>T(t,e))}findAll(e={}){return this.getAll().filter(t=>T(e,t))}notify(e){I.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return I.batch(()=>Promise.all(e.map(e=>e.continue().catch(v))))}};function K(e){return e.options.scope?.id}var Te=class extends f{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??E(r,t),a=this.get(i);return a||(a=new fe({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){I.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>w(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>w(e,t)):t}notify(e){I.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){I.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){I.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ee=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Te,this.#t=e.mutationCache||new we,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=p.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=L.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(S(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=y(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return I.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;I.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return I.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=I.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(v).catch(v)}invalidateQueries(e,t={}){return I.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=I.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(v)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(v)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(S(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(v).catch(v)}fetchInfiniteQuery(e){return e.behavior=ye(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(v).catch(v)}ensureInfiniteQueryData(e){return e.behavior=ye(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return L.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(D(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{O(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(D(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{O(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=E(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===N&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},De=c.createContext(void 0),Oe=e=>{let t=c.useContext(De);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},ke=({client:e,children:t})=>(c.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,l.jsx)(De.Provider,{value:e,children:t})),Ae=c.createContext(!1),je=()=>c.useContext(Ae);Ae.Provider;function Me(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ne=c.createContext(Me()),Pe=()=>c.useContext(Ne),Fe=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?se(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Ie=e=>{c.useEffect(()=>{e.clearReset()},[e])},Le=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||se(n,[e.error,r])),Re=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},ze=(e,t)=>e.isLoading&&e.isFetching&&!t,Be=(e,t)=>e?.suspense&&t.isPending,Ve=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function He(e,t,n){if(process.env.NODE_ENV!==`production`&&(typeof e!=`object`||Array.isArray(e)))throw Error(`Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object`);let r=je(),i=Pe(),a=Oe(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);process.env.NODE_ENV!==`production`&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),o._optimisticResults=r?`isRestoring`:`optimistic`,Re(o),Fe(o,i,s),Ie(i);let l=!a.getQueryCache().get(o.queryHash),[u]=c.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&e.subscribed!==!1;if(c.useSyncExternalStore(c.useCallback(e=>{let t=f?u.subscribe(I.batchCalls(e)):v;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),c.useEffect(()=>{u.setOptions(o)},[o,u]),Be(o,d))throw Ve(o,u,i);if(Le({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!P.isServer()&&ze(d,r)&&(l?Ve(o,u,i):s?.promise)?.catch(v).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function Ue(e,t){return He(e,me,t)}var We=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Ge=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Ke=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),qe=e=>{let t=Ke(e);return t.charAt(0).toUpperCase()+t.slice(1)},q={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`},Je=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Ye=(0,c.createContext)({}),Xe=()=>(0,c.useContext)(Ye),Ze=(0,c.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},l)=>{let{size:u=24,strokeWidth:d=2,absoluteStrokeWidth:f=!1,color:p=`currentColor`,className:m=``}=Xe()??{},h=r??f?Number(n??d)*24/Number(t??u):n??d;return(0,c.createElement)(`svg`,{ref:l,...q,width:t??u??q.width,height:t??u??q.height,stroke:e??p,strokeWidth:h,className:We(`lucide`,m,i),...!a&&!Je(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,c.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),J=(e,t)=>{let n=(0,c.forwardRef)(({className:n,...r},i)=>(0,c.createElement)(Ze,{ref:i,iconNode:t,className:We(`lucide-${Ge(qe(e))}`,`lucide-${e}`,n),...r}));return n.displayName=qe(e),n},Qe=J(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),$e=J(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Y=J(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),et=J(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),tt=J(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),nt=(e,t,n)=>{typeof n==`string`||n instanceof Blob?e.append(t,n):n instanceof Date?e.append(t,n.toISOString()):e.append(t,JSON.stringify(n))},rt={bodySerializer:e=>{let t=new FormData;return Object.entries(e).forEach(([e,n])=>{n!=null&&(Array.isArray(n)?n.forEach(n=>nt(t,e,n)):nt(t,e,n))}),t}},it={bodySerializer:e=>JSON.stringify(e,(e,t)=>typeof t==`bigint`?t.toString():t)};Object.entries({$body_:`body`,$headers_:`headers`,$path_:`path`,$query_:`query`});function at({onRequest:e,onSseError:t,onSseEvent:n,responseTransformer:r,responseValidator:i,sseDefaultRetryDelay:a,sseMaxRetryAttempts:o,sseMaxRetryDelay:s,sseSleepFn:c,url:l,...u}){let d,f=c??(e=>new Promise(t=>setTimeout(t,e)));return{stream:async function*(){let c=a??3e3,p=0,m=u.signal??new AbortController().signal;for(;!m.aborted;){p++;let a=u.headers instanceof Headers?u.headers:new Headers(u.headers);d!==void 0&&a.set(`Last-Event-ID`,d);try{let t={redirect:`follow`,...u,body:u.serializedBody,headers:a,signal:m},o=new Request(l,t);e&&(o=await e(l,t));let s=await(u.fetch??globalThis.fetch)(o);if(!s.ok)throw Error(`SSE failed: ${s.status} ${s.statusText}`);if(!s.body)throw Error(`No body in SSE response`);let f=s.body.pipeThrough(new TextDecoderStream).getReader(),p=``,h=()=>{try{f.cancel()}catch{}};m.addEventListener(`abort`,h);try{for(;;){let{done:e,value:t}=await f.read();if(e)break;p+=t,p=p.replace(/\r\n?/g,`
2
+ `);let a=p.split(`
3
+
4
+ `);p=a.pop()??``;for(let e of a){let t=e.split(`
5
+ `),a=[],o;for(let e of t)if(e.startsWith(`data:`))a.push(e.replace(/^data:\s*/,``));else if(e.startsWith(`event:`))o=e.replace(/^event:\s*/,``);else if(e.startsWith(`id:`))d=e.replace(/^id:\s*/,``);else if(e.startsWith(`retry:`)){let t=Number.parseInt(e.replace(/^retry:\s*/,``),10);Number.isNaN(t)||(c=t)}let s,l=!1;if(a.length){let e=a.join(`
6
+ `);try{s=JSON.parse(e),l=!0}catch{s=e}}l&&(i&&await i(s),r&&(s=await r(s))),n?.({data:s,event:o,id:d,retry:c}),a.length&&(yield s)}}}finally{m.removeEventListener(`abort`,h),f.releaseLock()}break}catch(e){if(t?.(e),o!==void 0&&p>=o)break;await f(Math.min(c*2**(p-1),s??3e4))}}}()}}var ot=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},st=e=>{switch(e){case`form`:return`,`;case`pipeDelimited`:return`|`;case`spaceDelimited`:return`%20`;default:return`,`}},ct=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},lt=({allowReserved:e,explode:t,name:n,style:r,value:i})=>{if(!t){let t=(e?i:i.map(e=>encodeURIComponent(e))).join(st(r));switch(r){case`label`:return`.${t}`;case`matrix`:return`;${n}=${t}`;case`simple`:return t;default:return`${n}=${t}`}}let a=ot(r),o=i.map(t=>r===`label`||r===`simple`?e?t:encodeURIComponent(t):X({allowReserved:e,name:n,value:t})).join(a);return r===`label`||r===`matrix`?a+o:o},X=({allowReserved:e,name:t,value:n})=>{if(n==null)return``;if(typeof n==`object`)throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${t}=${e?n:encodeURIComponent(n)}`},ut=({allowReserved:e,explode:t,name:n,style:r,value:i,valueOnly:a})=>{if(i instanceof Date)return a?i.toISOString():`${n}=${i.toISOString()}`;if(r!==`deepObject`&&!t){let t=[];Object.entries(i).forEach(([n,r])=>{t=[...t,n,e?r:encodeURIComponent(r)]});let a=t.join(`,`);switch(r){case`form`:return`${n}=${a}`;case`label`:return`.${a}`;case`matrix`:return`;${n}=${a}`;default:return a}}let o=ct(r),s=Object.entries(i).map(([t,i])=>X({allowReserved:e,name:r===`deepObject`?`${n}[${t}]`:t,value:i})).join(o);return r===`label`||r===`matrix`?o+s:s},dt=/\{[^{}]+\}/g,ft=({path:e,url:t})=>{let n=t,r=t.match(dt);if(r)for(let t of r){let r=!1,i=t.substring(1,t.length-1),a=`simple`;i.endsWith(`*`)&&(r=!0,i=i.substring(0,i.length-1)),i.startsWith(`.`)?(i=i.substring(1),a=`label`):i.startsWith(`;`)&&(i=i.substring(1),a=`matrix`);let o=e[i];if(o==null)continue;if(Array.isArray(o)){n=n.replace(t,lt({explode:r,name:i,style:a,value:o}));continue}if(typeof o==`object`){n=n.replace(t,ut({explode:r,name:i,style:a,value:o,valueOnly:!0}));continue}if(a===`matrix`){n=n.replace(t,`;${X({name:i,value:o})}`);continue}let s=encodeURIComponent(a===`label`?`.${o}`:o);n=n.replace(t,s)}return n},pt=({baseUrl:e,path:t,query:n,querySerializer:r,url:i})=>{let a=i.startsWith(`/`)?i:`/${i}`,o=(e??``)+a;t&&(o=ft({path:t,url:o}));let s=n?r(n):``;return s.startsWith(`?`)&&(s=s.substring(1)),s&&(o+=`?${s}`),o};function mt(e){let t=e.body!==void 0;if(t&&e.bodySerializer)return`serializedBody`in e?e.serializedBody!==void 0&&e.serializedBody!==``?e.serializedBody:null:e.body===``?null:e.body;if(t)return e.body}var ht=async(e,t)=>{let n=typeof t==`function`?await t(e):t;if(n)return e.scheme===`bearer`?`Bearer ${n}`:e.scheme===`basic`?`Basic ${btoa(n)}`:n},gt=({parameters:e={},...t}={})=>n=>{let r=[];if(n&&typeof n==`object`)for(let i in n){let a=n[i];if(a==null)continue;let o=e[i]||t;if(Array.isArray(a)){let e=lt({allowReserved:o.allowReserved,explode:!0,name:i,style:`form`,value:a,...o.array});e&&r.push(e)}else if(typeof a==`object`){let e=ut({allowReserved:o.allowReserved,explode:!0,name:i,style:`deepObject`,value:a,...o.object});e&&r.push(e)}else{let e=X({allowReserved:o.allowReserved,name:i,value:a});e&&r.push(e)}}return r.join(`&`)},_t=e=>{if(!e)return`stream`;let t=e.split(`;`)[0]?.trim();if(t){if(t.startsWith(`application/json`)||t.endsWith(`+json`))return`json`;if(t===`multipart/form-data`)return`formData`;if([`application/`,`audio/`,`image/`,`video/`].some(e=>t.startsWith(e)))return`blob`;if(t.startsWith(`text/`))return`text`}},vt=(e,t)=>t?!!(e.headers.has(t)||e.query?.[t]||e.headers.get(`Cookie`)?.includes(`${t}=`)):!1,yt=async({security:e,...t})=>{for(let n of e){if(vt(t,n.name))continue;let e=await ht(n,t.auth);if(!e)continue;let r=n.name??`Authorization`;switch(n.in){case`query`:t.query||={},t.query[r]=e;break;case`cookie`:t.headers.append(`Cookie`,`${r}=${e}`);break;default:t.headers.set(r,e);break}}},bt=e=>pt({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:typeof e.querySerializer==`function`?e.querySerializer:gt(e.querySerializer),url:e.url}),xt=(e,t)=>{let n={...e,...t};return n.baseUrl?.endsWith(`/`)&&(n.baseUrl=n.baseUrl.substring(0,n.baseUrl.length-1)),n.headers=Ct(e.headers,t.headers),n},St=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},Ct=(...e)=>{let t=new Headers;for(let n of e){if(!n)continue;let e=n instanceof Headers?St(n):Object.entries(n);for(let[n,r]of e)if(r===null)t.delete(n);else if(Array.isArray(r))for(let e of r)t.append(n,e);else r!==void 0&&t.set(n,typeof r==`object`?JSON.stringify(r):r)}return t},Z=class{fns=[];clear(){this.fns=[]}eject(e){let t=this.getInterceptorIndex(e);this.fns[t]&&(this.fns[t]=null)}exists(e){let t=this.getInterceptorIndex(e);return!!this.fns[t]}getInterceptorIndex(e){return typeof e==`number`?this.fns[e]?e:-1:this.fns.indexOf(e)}update(e,t){let n=this.getInterceptorIndex(e);return this.fns[n]?(this.fns[n]=t,e):!1}use(e){return this.fns.push(e),this.fns.length-1}},wt=()=>({error:new Z,request:new Z,response:new Z}),Tt=gt({allowReserved:!1,array:{explode:!0,style:`form`},object:{explode:!0,style:`deepObject`}}),Et={"Content-Type":`application/json`},Dt=(e={})=>({...it,headers:Et,parseAs:`auto`,querySerializer:Tt,...e}),Q=((e={})=>{let t=xt(Dt(),e),n=()=>({...t}),r=e=>(t=xt(t,e),n()),i=wt(),a=async e=>{let n={...t,...e,fetch:e.fetch??t.fetch??globalThis.fetch,headers:Ct(t.headers,e.headers),serializedBody:void 0};n.security&&await yt({...n,security:n.security}),n.requestValidator&&await n.requestValidator(n),n.body!==void 0&&n.bodySerializer&&(n.serializedBody=n.bodySerializer(n.body)),(n.body===void 0||n.serializedBody===``)&&n.headers.delete(`Content-Type`);let r=n;return{opts:r,url:bt(r)}},o=async e=>{let{opts:t,url:n}=await a(e),r={redirect:`follow`,...t,body:mt(t)},o=new Request(n,r);for(let e of i.request.fns)e&&(o=await e(o,t));let s=t.fetch,c;try{c=await s(o)}catch(e){let n=e;for(let r of i.error.fns)r&&(n=await r(e,void 0,o,t));if(n||={},t.throwOnError)throw n;return t.responseStyle===`data`?void 0:{error:n,request:o,response:void 0}}for(let e of i.response.fns)e&&(c=await e(c,o,t));let l={request:o,response:c};if(c.ok){let e=(t.parseAs===`auto`?_t(c.headers.get(`Content-Type`)):t.parseAs)??`json`;if(c.status===204||c.headers.get(`Content-Length`)===`0`){let n;switch(e){case`arrayBuffer`:case`blob`:case`text`:n=await c[e]();break;case`formData`:n=new FormData;break;case`stream`:n=c.body;break;default:n={};break}return t.responseStyle===`data`?n:{data:n,...l}}let n;switch(e){case`arrayBuffer`:case`blob`:case`formData`:case`text`:n=await c[e]();break;case`json`:{let e=await c.text();n=e?JSON.parse(e):{};break}case`stream`:return t.responseStyle===`data`?c.body:{data:c.body,...l}}return e===`json`&&(t.responseValidator&&await t.responseValidator(n),t.responseTransformer&&(n=await t.responseTransformer(n))),t.responseStyle===`data`?n:{data:n,...l}}let u=await c.text(),d;try{d=JSON.parse(u)}catch{}let f=d??u,p=f;for(let e of i.error.fns)e&&(p=await e(f,c,o,t));if(p||={},t.throwOnError)throw p;return t.responseStyle===`data`?void 0:{error:p,...l}},s=e=>t=>o({...t,method:e}),c=e=>async t=>{let{opts:n,url:r}=await a(t);return at({...n,body:n.body,headers:n.headers,method:e,onRequest:async(e,t)=>{let r=new Request(e,t);for(let e of i.request.fns)e&&(r=await e(r,n));return r},serializedBody:mt(n),url:r})};return{buildUrl:e=>bt({...t,...e}),connect:s(`CONNECT`),delete:s(`DELETE`),get:s(`GET`),getConfig:n,head:s(`HEAD`),interceptors:i,options:s(`OPTIONS`),patch:s(`PATCH`),post:s(`POST`),put:s(`PUT`),request:o,setConfig:r,sse:{connect:c(`CONNECT`),delete:c(`DELETE`),get:c(`GET`),head:c(`HEAD`),options:c(`OPTIONS`),patch:c(`PATCH`),post:c(`POST`),put:c(`PUT`),trace:c(`TRACE`)},trace:s(`TRACE`)}})(Dt({baseUrl:`http://localhost:9000/api/widget`}));function Ot(e,t){Q.setConfig({baseUrl:e,headers:t?{Authorization:`Bearer ${t}`}:void 0})}var kt=e=>(e?.client??Q).get({security:[{scheme:`bearer`,type:`http`}],url:`/threads`,...e}),At=e=>(e.client??Q).get({security:[{scheme:`bearer`,type:`http`}],url:`/threads/{threadUid}`,...e}),jt=e=>(e.client??Q).post({...rt,security:[{scheme:`bearer`,type:`http`}],url:`/attachments/upload`,...e,headers:{"Content-Type":null,...e.headers}}),Mt=e=>(e.client??Q).get({security:[{scheme:`bearer`,type:`http`}],url:`/attachments/{filename}`,...e}),$={upload:async(e,t,n)=>{let{data:r}=await jt({body:{file:e,prefix:t,ocr:n},throwOnError:!0});return r.data},download:async(e,t)=>{let n=e.split(`/`),r=n[n.length-1],i=n.slice(-3,-1).join(`/`),{data:a}=await Mt({path:{filename:r},query:i?{prefix:i}:{},parseAs:`blob`,throwOnError:!0}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o)}};function Nt({onSend:e,inProgress:t,threadId:n}){let[r,i]=(0,c.useState)(``),[a,o]=(0,c.useState)([]),[s,u]=(0,c.useState)(!1),[d,f]=(0,c.useState)(null),p=(0,c.useRef)(null),m=(0,c.useRef)(null),h=(0,c.useRef)(0);(0,c.useEffect)(()=>{let e=p.current;if(e){e.style.height=`auto`;let t=e.scrollHeight;e.style.height=`${t}px`}},[r]);async function g(e){let t=`${e.name}-${Date.now()}`;o(n=>[...n,{id:t,name:e.name,mimeType:e.type||`application/octet-stream`,status:`uploading`}]);try{let r=await $.upload(e,`thread/${n||crypto.randomUUID()}`,!0);o(e=>e.map(e=>e.id===t?{...e,status:`done`,response:r}:e))}catch(e){let n=e instanceof Error?e.message:`Upload failed`;o(e=>e.map(e=>e.id===t?{...e,status:`error`,errorMessage:n}:e))}}function _(e){let t=e.target.files;if(!t||t.length===0)return;let n=new Set(a.map(e=>e.name));Array.from(t).filter(e=>!n.has(e.name)).forEach(g),e.target.value=``}function v(e){o(t=>t.filter(t=>t.id!==e))}async function y(e){if(e.response){f(e.id);try{await $.download(e.response.file_path,e.response.original_name)}catch(t){console.error(`Download failed:`,t),alert(`Failed to download ${e.name}`)}finally{f(null)}}}function b(e){e.preventDefault(),h.current+=1,e.dataTransfer.types.includes(`Files`)&&u(!0)}function x(e){e.preventDefault(),--h.current,h.current===0&&u(!1)}function S(e){e.preventDefault()}function C(e){e.preventDefault(),h.current=0,u(!1);let t=Array.from(e.dataTransfer.files);if(t.length===0)return;let n=new Set(a.map(e=>e.name));t.filter(e=>!n.has(e.name)).forEach(g)}function w(){if(!r.trim()&&a.length===0)return;let t=a.filter(e=>e.status===`done`).filter(e=>e.response!==null).map(e=>e.response).map(({ocr_result:e,...t})=>({...t,ocr_result:e?.markdown_files})),n=r;t.length>0&&(n+=`\n\n\`\`\`attachments\n${JSON.stringify(t,null,2)}\n\`\`\``),e(n),i(``),o([])}function T(e){e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),w())}function E(){p.current?.focus()}return(0,l.jsxs)(`div`,{className:`copilotKitInputContainer relative`,onDragEnter:b,onDragLeave:x,onDragOver:S,onDrop:C,children:[s&&(0,l.jsx)(`div`,{className:`absolute inset-0 z-50 bg-teal-50/90 rounded-lg flex items-center justify-center pointer-events-none`,children:(0,l.jsx)(`p`,{className:`text-sm font-medium text-teal-600`,children:`Drop files to attach`})}),a.length>0&&(0,l.jsx)(`div`,{className:`flex flex-col gap-2 mb-2`,children:a.map(e=>(0,l.jsxs)(`div`,{className:`
7
+ px-3 py-2 rounded-lg flex items-center justify-between
8
+ ${e.status===`error`?`bg-red-50`:e.status===`done`?`bg-green-50`:`bg-gray-100`}
9
+ `,children:[(0,l.jsxs)(`div`,{className:`
10
+ flex items-center gap-2 flex-1 rounded-lg transition-colors
11
+ ${e.status===`done`?`cursor-pointer hover:bg-green-100 -mx-3 -my-2 px-3 py-2`:``}
12
+ `,onClick:()=>e.status===`done`&&y(e),role:e.status===`done`?`button`:void 0,tabIndex:e.status===`done`?0:void 0,children:[e.status===`uploading`?(0,l.jsx)(`div`,{className:`w-4 h-4 border-2 border-gray-500 border-t-transparent rounded-full animate-spin`}):d===e.id?(0,l.jsx)(`div`,{className:`w-4 h-4 border-2 border-green-500 border-t-transparent rounded-full animate-spin`}):e.status===`done`?(0,l.jsx)(Y,{className:`w-4 h-4 text-green-600`}):(0,l.jsx)(Y,{className:`w-4 h-4 text-red-600`}),(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsxs)(`div`,{className:`
13
+ text-sm font-medium truncate
14
+ ${e.status===`error`?`text-red-700`:e.status===`done`?`text-green-700`:`text-gray-700`}
15
+ `,children:[e.name,d===e.id&&(0,l.jsx)(`span`,{className:`ml-2 text-xs text-green-600`,children:`Downloading...`})]}),(0,l.jsxs)(`div`,{className:`text-xs text-gray-500`,children:[e.status===`uploading`&&`Uploading...`,e.status===`done`&&`Ready · Click to download`,e.status===`error`&&(e.errorMessage||`Upload failed`)]})]}),e.status===`done`&&!d&&(0,l.jsx)($e,{className:`w-4 h-4 text-green-600 opacity-0 group-hover:opacity-100 transition-opacity`})]}),(0,l.jsx)(`button`,{onClick:t=>{t.stopPropagation(),v(e.id)},disabled:e.status===`uploading`,className:`ml-2 p-1 hover:bg-black/10 rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,"aria-label":`Remove ${e.name}`,children:(0,l.jsx)(tt,{className:`w-4 h-4 text-gray-500`})})]},e.id))}),(0,l.jsxs)(`div`,{className:`copilotKitInput`,onClick:E,children:[(0,l.jsx)(`textarea`,{ref:p,value:r,onChange:e=>i(e.target.value),onKeyDown:T,placeholder:a.length>0?`Ask about ${a.length} file${a.length>1?`s`:``}...`:`Type a message or attach files...`,className:`overflow-auto resize-none`,rows:1,disabled:t}),(0,l.jsxs)(`div`,{className:`copilotKitInputControls`,children:[(0,l.jsx)(`input`,{ref:m,type:`file`,onChange:_,className:`hidden`,disabled:t,multiple:!0}),(0,l.jsx)(`button`,{onClick:()=>m.current?.click(),disabled:t,className:`copilotKitInputControlButton mr-2`,"aria-label":`Attach files`,title:`Attach files (drag & drop supported)`,children:(0,l.jsx)(Y,{className:`w-5 h-5`})}),(0,l.jsx)(`div`,{className:`grow`}),(0,l.jsx)(`button`,{onClick:w,disabled:t||!r.trim()&&a.filter(e=>e.status===`done`).length===0,"data-copilotkit-in-progress":t,className:`copilotKitInputControlButton`,children:(0,l.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:`1.5`,stroke:`currentColor`,width:`24`,height:`24`,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 19V5m0 0l-7 7m7-7l7 7`})})})]})]})]})}var Pt={list:async(e=15)=>{let{data:t}=await kt({query:{page:1,page_size:e},throwOnError:!0});return t.data??[]},get:async e=>{let{data:t}=await At({path:{threadUid:e},throwOnError:!0});return t.data}},Ft={all:()=>[`widget-threads`],detail:e=>[`widget-threads`,e]},It=(e=15)=>Ue({queryKey:Ft.all(),queryFn:()=>Pt.list(e),staleTime:15e3,refetchOnWindowFocus:!0});function Lt(e){if(!e)return``;let t=e.split(`:`);return(t.length>1?t.slice(1).join(` `):e).replace(/[-_]/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Rt(e){if(!e)return``;let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4),r=Math.floor(n/60),i=Math.floor(r/24);return n<1?`just now`:n<60?`${n}m ago`:r<24?`${r}h ago`:i<7?`${i}d ago`:new Date(e).toLocaleDateString()}function zt({onNewChat:e,onThreadSelect:t}){let[n,r]=(0,c.useState)(!1),i=(0,c.useRef)(null),{data:a=[],isLoading:o}=It();(0,c.useEffect)(()=>{function e(e){i.current&&!i.current.contains(e.target)&&r(!1)}if(n)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[n]);function s(e){r(!1),t?.(e)}return(0,l.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-gray-200`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold text-gray-900`,children:`Erica Assistant`}),(0,l.jsxs)(`div`,{className:`flex items-center gap-2 relative`,ref:i,children:[(0,l.jsx)(`button`,{onClick:e,className:`p-2 bg-gray-900 hover:bg-gray-700 text-white rounded-lg transition-colors`,title:`Start new chat`,children:(0,l.jsx)(et,{className:`w-4 h-4`})}),(0,l.jsxs)(`button`,{onClick:()=>r(!n),className:`flex items-center gap-1.5 px-3 py-2 hover:bg-gray-100 rounded-lg transition-colors`,title:`Recent threads`,children:[(0,l.jsxs)(`span`,{className:`text-sm font-medium text-gray-700`,children:[`Threads `,a.length>0&&`(${a.length})`]}),(0,l.jsx)(Qe,{className:`w-4 h-4 text-gray-500 transition-transform ${n?`rotate-180`:``}`})]}),n&&(0,l.jsx)(`div`,{className:`absolute top-full right-0 mt-1 w-72 bg-white rounded-lg shadow-lg border border-gray-200 z-50 max-h-80 overflow-y-auto`,children:(0,l.jsxs)(`div`,{className:`p-2`,children:[(0,l.jsx)(`div`,{className:`px-3 py-2 text-xs font-semibold text-gray-500 uppercase`,children:`Recent Threads`}),o&&(0,l.jsx)(`div`,{className:`px-3 py-4 text-center text-sm text-gray-500`,children:`Loading threads...`}),!o&&a.length===0&&(0,l.jsx)(`div`,{className:`px-3 py-4 text-center text-sm text-gray-500`,children:`No conversations yet`}),!o&&a.map(e=>{let t=Lt(e.agent),n=Rt(e.last_run_at??e.created_at);return(0,l.jsx)(`button`,{onClick:()=>s(e.uid),className:`w-full text-left px-3 py-2 hover:bg-gray-100 rounded-lg transition-colors`,children:(0,l.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,l.jsx)(`span`,{className:`text-sm font-medium text-gray-900 truncate`,children:typeof e.thread_metadata?.title==`string`?e.thread_metadata.title:e.last_message??`New conversation`}),(0,l.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[t&&(0,l.jsx)(`span`,{className:`text-xs text-gray-500 truncate flex-1`,children:t}),n&&(0,l.jsx)(`span`,{className:`text-xs text-gray-400 shrink-0`,children:n})]})]})},e.uid)})]})})]})]})}var Bt=new Ee({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:3e4}}});function Vt({runtimeUrl:e,widgetToken:t}){let[n,r]=(0,c.useState)(void 0),i=(0,c.useMemo)(()=>{let t=new URL(e),n=t.pathname.split(`/`).filter(Boolean);return n.length>2&&n.pop(),t.pathname=`/`+n.join(`/`),t.toString()},[e]);(0,c.useMemo)(()=>{Ot(i,t)},[i,t]);let a=(0,c.useCallback)(()=>{r(void 0),console.log(`New chat started`)},[]),o=(0,c.useCallback)(e=>{r(e),console.log(`Thread selected:`,e)},[]),s=(0,c.useCallback)(e=>(0,l.jsx)(Nt,{...e,threadId:n}),[n]),f=(0,c.useCallback)(()=>(0,l.jsx)(zt,{onNewChat:a,onThreadSelect:o}),[a,o]);return(0,l.jsx)(ke,{client:Bt,children:(0,l.jsx)(`div`,{className:`h-full w-full`,children:(0,l.jsx)(u.CopilotKit,{runtimeUrl:e,headers:{Authorization:`Bearer ${t}`},properties:{agent:`platform:ultimate`},threadId:n,children:(0,l.jsx)(d.CopilotSidebar,{labels:{initial:`Hi! How can I help you today?
16
+
17
+ You can:
18
+ - Ask me questions
19
+ - Upload files using the attachment icon
20
+ - Drag & drop files to attach`},defaultOpen:!0,clickOutsideToClose:!0,Input:s,Header:f})})})})}exports.EricaChat=Vt;
21
+ //# sourceMappingURL=index.cjs.map