@melony/react 0.1.24 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/index.cjs +772 -458
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +192 -42
- package/dist/index.d.ts +192 -42
- package/dist/index.js +702 -414
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React12 = require('react');
|
|
4
4
|
var react = require('nuqs/adapters/react');
|
|
5
5
|
var reactQuery = require('@tanstack/react-query');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -10,12 +10,12 @@ var clsx = require('clsx');
|
|
|
10
10
|
var tailwindMerge = require('tailwind-merge');
|
|
11
11
|
var button = require('@base-ui/react/button');
|
|
12
12
|
var classVarianceAuthority = require('class-variance-authority');
|
|
13
|
+
var mergeProps = require('@base-ui/react/merge-props');
|
|
14
|
+
var useRender = require('@base-ui/react/use-render');
|
|
13
15
|
var ICONS = require('@tabler/icons-react');
|
|
14
16
|
var menu = require('@base-ui/react/menu');
|
|
15
17
|
var separator = require('@base-ui/react/separator');
|
|
16
18
|
var dialog = require('@base-ui/react/dialog');
|
|
17
|
-
var mergeProps = require('@base-ui/react/merge-props');
|
|
18
|
-
var useRender = require('@base-ui/react/use-render');
|
|
19
19
|
var input = require('@base-ui/react/input');
|
|
20
20
|
var select = require('@base-ui/react/select');
|
|
21
21
|
var reactDom = require('react-dom');
|
|
@@ -40,7 +40,7 @@ function _interopNamespace(e) {
|
|
|
40
40
|
return Object.freeze(n);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
var
|
|
43
|
+
var React12__namespace = /*#__PURE__*/_interopNamespace(React12);
|
|
44
44
|
var ICONS__namespace = /*#__PURE__*/_interopNamespace(ICONS);
|
|
45
45
|
|
|
46
46
|
// src/providers/melony-provider.tsx
|
|
@@ -69,7 +69,7 @@ function groupEventsToMessages(events) {
|
|
|
69
69
|
}
|
|
70
70
|
return messages;
|
|
71
71
|
}
|
|
72
|
-
var MelonyContext =
|
|
72
|
+
var MelonyContext = React12.createContext(
|
|
73
73
|
void 0
|
|
74
74
|
);
|
|
75
75
|
var defaultQueryClient = new reactQuery.QueryClient({
|
|
@@ -84,41 +84,78 @@ var MelonyContextProviderInner = ({
|
|
|
84
84
|
children,
|
|
85
85
|
client,
|
|
86
86
|
initialEvents,
|
|
87
|
-
configApi,
|
|
88
87
|
setContextValue
|
|
89
88
|
}) => {
|
|
90
|
-
const [state, setState] =
|
|
89
|
+
const [state, setState] = React12.useState(client.getState());
|
|
91
90
|
const { data: config } = reactQuery.useQuery({
|
|
92
|
-
queryKey: ["melony-config",
|
|
93
|
-
queryFn: () => client.getConfig(
|
|
94
|
-
enabled: !!configApi,
|
|
91
|
+
queryKey: ["melony-config", client.url],
|
|
92
|
+
queryFn: () => client.getConfig(),
|
|
95
93
|
staleTime: Infinity
|
|
96
94
|
});
|
|
97
|
-
|
|
95
|
+
React12.useEffect(() => {
|
|
98
96
|
if (initialEvents && initialEvents.length > 0 && client.getState().events.length === 0) {
|
|
99
97
|
client.reset(initialEvents);
|
|
100
98
|
}
|
|
101
99
|
}, [client, initialEvents]);
|
|
102
|
-
|
|
100
|
+
React12.useEffect(() => {
|
|
103
101
|
setState(client.getState());
|
|
104
102
|
const unsubscribe = client.subscribe(setState);
|
|
105
103
|
return () => {
|
|
106
104
|
unsubscribe();
|
|
107
105
|
};
|
|
108
106
|
}, [client]);
|
|
109
|
-
const
|
|
107
|
+
const reset = React12.useCallback(
|
|
108
|
+
(events) => client.reset(events),
|
|
109
|
+
[client]
|
|
110
|
+
);
|
|
111
|
+
const dispatchClientAction = React12.useCallback(
|
|
112
|
+
async (event) => {
|
|
113
|
+
if (!event.type.startsWith("client:")) return false;
|
|
114
|
+
switch (event.type) {
|
|
115
|
+
case "client:navigate": {
|
|
116
|
+
const url = event.data?.url;
|
|
117
|
+
if (url) {
|
|
118
|
+
window.history.pushState(null, "", url);
|
|
119
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
120
|
+
}
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
case "client:open-url": {
|
|
124
|
+
const { url, target = "_blank" } = event.data || {};
|
|
125
|
+
if (url) {
|
|
126
|
+
window.open(url, target);
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
case "client:copy": {
|
|
131
|
+
const { text } = event.data || {};
|
|
132
|
+
if (text) {
|
|
133
|
+
await navigator.clipboard.writeText(text);
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
case "client:reset": {
|
|
138
|
+
reset([]);
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
default:
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
[client, reset]
|
|
146
|
+
);
|
|
147
|
+
const sendEvent = React12.useCallback(
|
|
110
148
|
async (event, options) => {
|
|
149
|
+
const handled = await dispatchClientAction(event);
|
|
150
|
+
if (handled) return;
|
|
111
151
|
const generator = client.sendEvent(event, options);
|
|
112
|
-
for await (const
|
|
152
|
+
for await (const incomingEvent of generator) {
|
|
153
|
+
await dispatchClientAction(incomingEvent);
|
|
113
154
|
}
|
|
114
155
|
},
|
|
115
|
-
[client]
|
|
116
|
-
);
|
|
117
|
-
const reset = React10.useCallback(
|
|
118
|
-
(events) => client.reset(events),
|
|
119
|
-
[client]
|
|
156
|
+
[client, dispatchClientAction]
|
|
120
157
|
);
|
|
121
|
-
const value =
|
|
158
|
+
const value = React12.useMemo(
|
|
122
159
|
() => ({
|
|
123
160
|
...state,
|
|
124
161
|
messages: groupEventsToMessages(state.events),
|
|
@@ -129,7 +166,7 @@ var MelonyContextProviderInner = ({
|
|
|
129
166
|
}),
|
|
130
167
|
[state, sendEvent, reset, client, config]
|
|
131
168
|
);
|
|
132
|
-
|
|
169
|
+
React12.useEffect(() => {
|
|
133
170
|
setContextValue(value);
|
|
134
171
|
}, [value, setContextValue]);
|
|
135
172
|
return /* @__PURE__ */ jsxRuntime.jsx(react.NuqsAdapter, { children });
|
|
@@ -138,31 +175,29 @@ var MelonyClientProvider = ({
|
|
|
138
175
|
children,
|
|
139
176
|
client,
|
|
140
177
|
initialEvents,
|
|
141
|
-
queryClient = defaultQueryClient
|
|
142
|
-
configApi
|
|
178
|
+
queryClient = defaultQueryClient
|
|
143
179
|
}) => {
|
|
144
|
-
const [contextValue, setContextValue] =
|
|
180
|
+
const [contextValue, setContextValue] = React12.useState(void 0);
|
|
145
181
|
return /* @__PURE__ */ jsxRuntime.jsx(MelonyContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
146
182
|
MelonyContextProviderInner,
|
|
147
183
|
{
|
|
148
184
|
client,
|
|
149
185
|
initialEvents,
|
|
150
|
-
configApi,
|
|
151
186
|
setContextValue,
|
|
152
187
|
children
|
|
153
188
|
}
|
|
154
189
|
) }) });
|
|
155
190
|
};
|
|
156
|
-
var AuthContext =
|
|
191
|
+
var AuthContext = React12.createContext(
|
|
157
192
|
void 0
|
|
158
193
|
);
|
|
159
194
|
var AuthProvider = ({
|
|
160
195
|
children,
|
|
161
196
|
service
|
|
162
197
|
}) => {
|
|
163
|
-
const [user, setUser] =
|
|
164
|
-
const [isLoading, setIsLoading] =
|
|
165
|
-
const fetchMe =
|
|
198
|
+
const [user, setUser] = React12.useState(null);
|
|
199
|
+
const [isLoading, setIsLoading] = React12.useState(true);
|
|
200
|
+
const fetchMe = React12.useCallback(async () => {
|
|
166
201
|
setIsLoading(true);
|
|
167
202
|
try {
|
|
168
203
|
const userData = await service.getMe();
|
|
@@ -174,13 +209,13 @@ var AuthProvider = ({
|
|
|
174
209
|
setIsLoading(false);
|
|
175
210
|
}
|
|
176
211
|
}, [service]);
|
|
177
|
-
|
|
212
|
+
React12.useEffect(() => {
|
|
178
213
|
fetchMe();
|
|
179
214
|
}, [fetchMe]);
|
|
180
|
-
const login =
|
|
215
|
+
const login = React12.useCallback(() => {
|
|
181
216
|
service.login();
|
|
182
217
|
}, [service]);
|
|
183
|
-
const logout =
|
|
218
|
+
const logout = React12.useCallback(async () => {
|
|
184
219
|
try {
|
|
185
220
|
await service.logout();
|
|
186
221
|
setUser(null);
|
|
@@ -216,7 +251,7 @@ var AuthProvider = ({
|
|
|
216
251
|
}
|
|
217
252
|
return /* @__PURE__ */ jsxRuntime.jsx(AuthContext.Provider, { value, children });
|
|
218
253
|
};
|
|
219
|
-
var ThreadContext =
|
|
254
|
+
var ThreadContext = React12.createContext(
|
|
220
255
|
void 0
|
|
221
256
|
);
|
|
222
257
|
var ThreadProvider = ({
|
|
@@ -225,7 +260,7 @@ var ThreadProvider = ({
|
|
|
225
260
|
initialThreadId: providedInitialThreadId
|
|
226
261
|
}) => {
|
|
227
262
|
const queryClient = reactQuery.useQueryClient();
|
|
228
|
-
const defaultInitialThreadId =
|
|
263
|
+
const defaultInitialThreadId = React12.useMemo(() => client.generateId(), []);
|
|
229
264
|
const initialThreadId = providedInitialThreadId || defaultInitialThreadId;
|
|
230
265
|
const [activeThreadId, setActiveThreadId] = nuqs.useQueryState(
|
|
231
266
|
"threadId",
|
|
@@ -266,22 +301,22 @@ var ThreadProvider = ({
|
|
|
266
301
|
}
|
|
267
302
|
}
|
|
268
303
|
});
|
|
269
|
-
const selectThread =
|
|
304
|
+
const selectThread = React12.useCallback(
|
|
270
305
|
(threadId) => {
|
|
271
306
|
setActiveThreadId(threadId);
|
|
272
307
|
},
|
|
273
308
|
[setActiveThreadId]
|
|
274
309
|
);
|
|
275
|
-
const createThread =
|
|
310
|
+
const createThread = React12.useCallback(async () => {
|
|
276
311
|
return createMutation.mutateAsync();
|
|
277
312
|
}, [createMutation]);
|
|
278
|
-
const deleteThread =
|
|
313
|
+
const deleteThread = React12.useCallback(
|
|
279
314
|
async (threadId) => {
|
|
280
315
|
return deleteMutation.mutateAsync(threadId);
|
|
281
316
|
},
|
|
282
317
|
[deleteMutation]
|
|
283
318
|
);
|
|
284
|
-
const value =
|
|
319
|
+
const value = React12.useMemo(
|
|
285
320
|
() => ({
|
|
286
321
|
threads,
|
|
287
322
|
activeThreadId,
|
|
@@ -311,11 +346,11 @@ var ThreadProvider = ({
|
|
|
311
346
|
);
|
|
312
347
|
return /* @__PURE__ */ jsxRuntime.jsx(ThreadContext.Provider, { value, children });
|
|
313
348
|
};
|
|
314
|
-
var ThemeContext =
|
|
349
|
+
var ThemeContext = React12.createContext(void 0);
|
|
315
350
|
function ThemeProvider({ children }) {
|
|
316
|
-
const [theme, setThemeState] =
|
|
317
|
-
const [resolvedTheme, setResolvedTheme] =
|
|
318
|
-
|
|
351
|
+
const [theme, setThemeState] = React12.useState("system");
|
|
352
|
+
const [resolvedTheme, setResolvedTheme] = React12.useState("light");
|
|
353
|
+
React12.useEffect(() => {
|
|
319
354
|
if (typeof window !== "undefined") {
|
|
320
355
|
const stored = localStorage.getItem("theme");
|
|
321
356
|
if (stored) {
|
|
@@ -323,7 +358,7 @@ function ThemeProvider({ children }) {
|
|
|
323
358
|
}
|
|
324
359
|
}
|
|
325
360
|
}, []);
|
|
326
|
-
|
|
361
|
+
React12.useEffect(() => {
|
|
327
362
|
if (typeof window !== "undefined") {
|
|
328
363
|
if (theme === "system") {
|
|
329
364
|
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
@@ -338,7 +373,7 @@ function ThemeProvider({ children }) {
|
|
|
338
373
|
}
|
|
339
374
|
}
|
|
340
375
|
}, [theme]);
|
|
341
|
-
|
|
376
|
+
React12.useEffect(() => {
|
|
342
377
|
if (typeof window !== "undefined") {
|
|
343
378
|
const root = document.documentElement;
|
|
344
379
|
if (resolvedTheme === "dark") {
|
|
@@ -357,21 +392,21 @@ function ThemeProvider({ children }) {
|
|
|
357
392
|
return /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value: { theme, setTheme, resolvedTheme }, children });
|
|
358
393
|
}
|
|
359
394
|
function useTheme() {
|
|
360
|
-
const context =
|
|
395
|
+
const context = React12.useContext(ThemeContext);
|
|
361
396
|
if (context === void 0) {
|
|
362
397
|
throw new Error("useTheme must be used within a ThemeProvider");
|
|
363
398
|
}
|
|
364
399
|
return context;
|
|
365
400
|
}
|
|
366
401
|
var useMelony = (options) => {
|
|
367
|
-
const context =
|
|
402
|
+
const context = React12.useContext(MelonyContext);
|
|
368
403
|
if (context === void 0) {
|
|
369
404
|
throw new Error("useMelony must be used within a MelonyClientProvider");
|
|
370
405
|
}
|
|
371
406
|
const { client, reset } = context;
|
|
372
407
|
const { initialEvents } = options || {};
|
|
373
|
-
const prevInitialEventsRef =
|
|
374
|
-
|
|
408
|
+
const prevInitialEventsRef = React12.useRef(void 0);
|
|
409
|
+
React12.useEffect(() => {
|
|
375
410
|
const currentSerialized = initialEvents ? JSON.stringify(initialEvents) : void 0;
|
|
376
411
|
if (currentSerialized !== prevInitialEventsRef.current) {
|
|
377
412
|
if (initialEvents) {
|
|
@@ -385,19 +420,60 @@ var useMelony = (options) => {
|
|
|
385
420
|
return context;
|
|
386
421
|
};
|
|
387
422
|
var useAuth = () => {
|
|
388
|
-
const context =
|
|
423
|
+
const context = React12.useContext(AuthContext);
|
|
389
424
|
if (context === void 0) {
|
|
390
425
|
throw new Error("useAuth must be used within an AuthProvider");
|
|
391
426
|
}
|
|
392
427
|
return context;
|
|
393
428
|
};
|
|
394
429
|
var useThreads = () => {
|
|
395
|
-
const context =
|
|
430
|
+
const context = React12.useContext(ThreadContext);
|
|
396
431
|
if (context === void 0) {
|
|
397
432
|
throw new Error("useThreads must be used within a ThreadProvider");
|
|
398
433
|
}
|
|
399
434
|
return context;
|
|
400
435
|
};
|
|
436
|
+
function useScreenSize(mobileBreakpoint = 768, tabletBreakpoint = 1024) {
|
|
437
|
+
const [screenSize, setScreenSize] = React12.useState(() => {
|
|
438
|
+
if (typeof window === "undefined") {
|
|
439
|
+
return {
|
|
440
|
+
width: 1024,
|
|
441
|
+
height: 768,
|
|
442
|
+
isMobile: false,
|
|
443
|
+
isTablet: false,
|
|
444
|
+
isDesktop: true
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
const width = window.innerWidth;
|
|
448
|
+
return {
|
|
449
|
+
width,
|
|
450
|
+
height: window.innerHeight,
|
|
451
|
+
isMobile: width < mobileBreakpoint,
|
|
452
|
+
isTablet: width >= mobileBreakpoint && width < tabletBreakpoint,
|
|
453
|
+
isDesktop: width >= tabletBreakpoint
|
|
454
|
+
};
|
|
455
|
+
});
|
|
456
|
+
React12.useEffect(() => {
|
|
457
|
+
if (typeof window === "undefined") return;
|
|
458
|
+
const updateScreenSize = () => {
|
|
459
|
+
const width = window.innerWidth;
|
|
460
|
+
const height = window.innerHeight;
|
|
461
|
+
setScreenSize({
|
|
462
|
+
width,
|
|
463
|
+
height,
|
|
464
|
+
isMobile: width < mobileBreakpoint,
|
|
465
|
+
isTablet: width >= mobileBreakpoint && width < tabletBreakpoint,
|
|
466
|
+
isDesktop: width >= tabletBreakpoint
|
|
467
|
+
});
|
|
468
|
+
};
|
|
469
|
+
updateScreenSize();
|
|
470
|
+
window.addEventListener("resize", updateScreenSize);
|
|
471
|
+
return () => {
|
|
472
|
+
window.removeEventListener("resize", updateScreenSize);
|
|
473
|
+
};
|
|
474
|
+
}, [mobileBreakpoint, tabletBreakpoint]);
|
|
475
|
+
return screenSize;
|
|
476
|
+
}
|
|
401
477
|
function cn(...inputs) {
|
|
402
478
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
403
479
|
}
|
|
@@ -458,6 +534,45 @@ function Textarea({ className, ...props }) {
|
|
|
458
534
|
}
|
|
459
535
|
);
|
|
460
536
|
}
|
|
537
|
+
var badgeVariants = classVarianceAuthority.cva(
|
|
538
|
+
"h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-colors overflow-hidden group/badge",
|
|
539
|
+
{
|
|
540
|
+
variants: {
|
|
541
|
+
variant: {
|
|
542
|
+
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
543
|
+
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
544
|
+
destructive: "bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",
|
|
545
|
+
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground bg-input/30",
|
|
546
|
+
ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
547
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
548
|
+
}
|
|
549
|
+
},
|
|
550
|
+
defaultVariants: {
|
|
551
|
+
variant: "default"
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
);
|
|
555
|
+
function Badge({
|
|
556
|
+
className,
|
|
557
|
+
variant = "default",
|
|
558
|
+
render,
|
|
559
|
+
...props
|
|
560
|
+
}) {
|
|
561
|
+
return useRender.useRender({
|
|
562
|
+
defaultTagName: "span",
|
|
563
|
+
props: mergeProps.mergeProps(
|
|
564
|
+
{
|
|
565
|
+
className: cn(badgeVariants({ className, variant }))
|
|
566
|
+
},
|
|
567
|
+
props
|
|
568
|
+
),
|
|
569
|
+
render,
|
|
570
|
+
state: {
|
|
571
|
+
slot: "badge",
|
|
572
|
+
variant
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
}
|
|
461
576
|
function DropdownMenu({ ...props }) {
|
|
462
577
|
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Root, { "data-slot": "dropdown-menu", ...props });
|
|
463
578
|
}
|
|
@@ -585,21 +700,17 @@ function Composer({
|
|
|
585
700
|
options = [],
|
|
586
701
|
autoFocus = false,
|
|
587
702
|
defaultSelectedIds = [],
|
|
588
|
-
fileAttachments
|
|
589
|
-
// Legacy props for backward compatibility
|
|
590
|
-
accept: legacyAccept,
|
|
591
|
-
maxFiles: legacyMaxFiles,
|
|
592
|
-
maxFileSize: legacyMaxFileSize
|
|
703
|
+
fileAttachments
|
|
593
704
|
}) {
|
|
594
|
-
const enabled = fileAttachments?.enabled
|
|
595
|
-
const accept = fileAttachments?.accept
|
|
596
|
-
const maxFiles = fileAttachments?.maxFiles ??
|
|
597
|
-
const maxFileSize = fileAttachments?.maxFileSize ??
|
|
598
|
-
const [selectedOptions, setSelectedOptions] =
|
|
705
|
+
const enabled = fileAttachments?.enabled || false;
|
|
706
|
+
const accept = fileAttachments?.accept;
|
|
707
|
+
const maxFiles = fileAttachments?.maxFiles ?? 10;
|
|
708
|
+
const maxFileSize = fileAttachments?.maxFileSize ?? 10 * 1024 * 1024;
|
|
709
|
+
const [selectedOptions, setSelectedOptions] = React12__namespace.default.useState(
|
|
599
710
|
() => new Set(defaultSelectedIds)
|
|
600
711
|
);
|
|
601
|
-
const [attachedFiles, setAttachedFiles] =
|
|
602
|
-
const fileInputRef =
|
|
712
|
+
const [attachedFiles, setAttachedFiles] = React12__namespace.default.useState([]);
|
|
713
|
+
const fileInputRef = React12__namespace.default.useRef(null);
|
|
603
714
|
const toggleOption = (id, groupOptions, type = "multiple") => {
|
|
604
715
|
const next = new Set(selectedOptions);
|
|
605
716
|
if (type === "single") {
|
|
@@ -623,7 +734,9 @@ function Composer({
|
|
|
623
734
|
const files = Array.from(e.target.files || []);
|
|
624
735
|
const validFiles = files.filter((file) => {
|
|
625
736
|
if (file.size > maxFileSize) {
|
|
626
|
-
console.warn(
|
|
737
|
+
console.warn(
|
|
738
|
+
`File ${file.name} exceeds maximum size of ${maxFileSize} bytes`
|
|
739
|
+
);
|
|
627
740
|
return false;
|
|
628
741
|
}
|
|
629
742
|
return true;
|
|
@@ -631,7 +744,9 @@ function Composer({
|
|
|
631
744
|
const remainingSlots = maxFiles - attachedFiles.length;
|
|
632
745
|
const filesToAdd = validFiles.slice(0, remainingSlots);
|
|
633
746
|
if (filesToAdd.length < validFiles.length) {
|
|
634
|
-
console.warn(
|
|
747
|
+
console.warn(
|
|
748
|
+
`Only ${filesToAdd.length} files can be added (max: ${maxFiles})`
|
|
749
|
+
);
|
|
635
750
|
}
|
|
636
751
|
setAttachedFiles((prev) => [...prev, ...filesToAdd]);
|
|
637
752
|
if (fileInputRef.current) {
|
|
@@ -674,12 +789,11 @@ function Composer({
|
|
|
674
789
|
reject(new Error("FileReader returned empty result"));
|
|
675
790
|
return;
|
|
676
791
|
}
|
|
677
|
-
const base64Data = base64.includes(",") ? base64.split(",")[1] : base64;
|
|
678
792
|
resolve({
|
|
679
793
|
name: file.name,
|
|
680
794
|
type: file.type,
|
|
681
795
|
size: file.size,
|
|
682
|
-
data:
|
|
796
|
+
data: base64
|
|
683
797
|
});
|
|
684
798
|
} catch (error) {
|
|
685
799
|
reject(error);
|
|
@@ -712,129 +826,189 @@ function Composer({
|
|
|
712
826
|
handleInternalSubmit().catch(console.error);
|
|
713
827
|
}
|
|
714
828
|
};
|
|
715
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
716
|
-
|
|
717
|
-
|
|
829
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("relative flex flex-col w-full", className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col w-full border-input border-[1.5px] rounded-3xl bg-background shadow-sm focus-within:border-ring transition-all p-2", children: [
|
|
830
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
831
|
+
Textarea,
|
|
718
832
|
{
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
833
|
+
value,
|
|
834
|
+
onChange: (e) => onChange(e.target.value),
|
|
835
|
+
onKeyDown: handleKeyDown,
|
|
836
|
+
placeholder,
|
|
837
|
+
className: "min-h-[44px] max-h-[200px] border-none bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 px-3 py-2 text-[15px] resize-none",
|
|
838
|
+
autoFocus
|
|
839
|
+
}
|
|
840
|
+
),
|
|
841
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center px-1", children: [
|
|
842
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
843
|
+
enabled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
723
844
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
724
|
-
"
|
|
845
|
+
"input",
|
|
846
|
+
{
|
|
847
|
+
ref: fileInputRef,
|
|
848
|
+
type: "file",
|
|
849
|
+
multiple: true,
|
|
850
|
+
accept,
|
|
851
|
+
onChange: handleFileSelect,
|
|
852
|
+
className: "hidden",
|
|
853
|
+
disabled: isLoading || attachedFiles.length >= maxFiles
|
|
854
|
+
}
|
|
855
|
+
),
|
|
856
|
+
attachedFiles.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
857
|
+
Button,
|
|
725
858
|
{
|
|
726
859
|
type: "button",
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
860
|
+
variant: "ghost",
|
|
861
|
+
size: "sm",
|
|
862
|
+
onClick: () => fileInputRef.current?.click(),
|
|
863
|
+
disabled: isLoading,
|
|
864
|
+
className: "text-muted-foreground",
|
|
865
|
+
title: "Attach file",
|
|
866
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconPaperclip, { className: "h-4 w-4" })
|
|
731
867
|
}
|
|
732
|
-
)
|
|
733
|
-
]
|
|
734
|
-
},
|
|
735
|
-
index
|
|
736
|
-
)) }),
|
|
737
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col w-full border-input border-[1.5px] rounded-3xl bg-background shadow-sm focus-within:border-ring transition-all p-2", children: [
|
|
738
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
739
|
-
Textarea,
|
|
740
|
-
{
|
|
741
|
-
value,
|
|
742
|
-
onChange: (e) => onChange(e.target.value),
|
|
743
|
-
onKeyDown: handleKeyDown,
|
|
744
|
-
placeholder,
|
|
745
|
-
className: "min-h-[44px] max-h-[200px] border-none bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 px-3 py-2 text-[15px] resize-none",
|
|
746
|
-
autoFocus
|
|
747
|
-
}
|
|
748
|
-
),
|
|
749
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center px-1", children: [
|
|
750
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
751
|
-
enabled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
868
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
752
869
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
753
|
-
|
|
870
|
+
DropdownMenuTrigger,
|
|
754
871
|
{
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
872
|
+
render: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
873
|
+
Button,
|
|
874
|
+
{
|
|
875
|
+
type: "button",
|
|
876
|
+
variant: "ghost",
|
|
877
|
+
size: "sm",
|
|
878
|
+
className: "text-muted-foreground gap-2",
|
|
879
|
+
title: `${attachedFiles.length} files attached`,
|
|
880
|
+
children: [
|
|
881
|
+
/* @__PURE__ */ jsxRuntime.jsx(ICONS.IconPaperclip, { className: "h-4 w-4" }),
|
|
882
|
+
/* @__PURE__ */ jsxRuntime.jsx(Badge, { className: "h-[18px] min-w-[18px] px-1.5 text-[10px]", children: attachedFiles.length })
|
|
883
|
+
]
|
|
884
|
+
}
|
|
885
|
+
)
|
|
762
886
|
}
|
|
763
887
|
),
|
|
764
|
-
/* @__PURE__ */ jsxRuntime.
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
title: attachedFiles.length >= maxFiles ? `Maximum ${maxFiles} files allowed` : "Attach file",
|
|
774
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconPaperclip, { className: "h-4 w-4" })
|
|
775
|
-
}
|
|
776
|
-
)
|
|
777
|
-
] }),
|
|
778
|
-
options.map((group) => {
|
|
779
|
-
const selectedInGroup = group.options.filter(
|
|
780
|
-
(o) => selectedOptions.has(o.id)
|
|
781
|
-
);
|
|
782
|
-
const label = selectedInGroup.length === 0 ? group.label : selectedInGroup.length === 1 ? selectedInGroup[0].label : `${group.label} (${selectedInGroup.length})`;
|
|
783
|
-
const isSingle = group.type === "single";
|
|
784
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
785
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
786
|
-
DropdownMenuTrigger,
|
|
787
|
-
{
|
|
788
|
-
render: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
789
|
-
Button,
|
|
790
|
-
{
|
|
791
|
-
variant: "ghost",
|
|
792
|
-
size: "sm",
|
|
793
|
-
className: cn(
|
|
794
|
-
selectedInGroup.length > 0 ? "text-foreground bg-muted/50" : "text-muted-foreground"
|
|
795
|
-
),
|
|
796
|
-
children: [
|
|
797
|
-
label,
|
|
798
|
-
/* @__PURE__ */ jsxRuntime.jsx(ICONS.IconChevronDown, { className: "h-3 w-3 opacity-50" })
|
|
799
|
-
]
|
|
800
|
-
}
|
|
801
|
-
)
|
|
802
|
-
}
|
|
803
|
-
),
|
|
804
|
-
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuContent, { align: "start", className: "w-56", children: /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuGroup, { children: [
|
|
805
|
-
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuLabel, { children: group.label }),
|
|
888
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuContent, { align: "start", className: "w-64", children: [
|
|
889
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuGroup, { children: [
|
|
890
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuLabel, { children: [
|
|
891
|
+
"Attached Files (",
|
|
892
|
+
attachedFiles.length,
|
|
893
|
+
"/",
|
|
894
|
+
maxFiles,
|
|
895
|
+
")"
|
|
896
|
+
] }),
|
|
806
897
|
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
807
|
-
|
|
808
|
-
|
|
898
|
+
attachedFiles.map((file, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
899
|
+
DropdownMenuItem,
|
|
809
900
|
{
|
|
810
|
-
|
|
811
|
-
onCheckedChange: () => toggleOption(
|
|
812
|
-
option.id,
|
|
813
|
-
group.options,
|
|
814
|
-
isSingle ? "single" : "multiple"
|
|
815
|
-
),
|
|
901
|
+
className: "flex items-center justify-between group",
|
|
816
902
|
onSelect: (e) => e.preventDefault(),
|
|
817
|
-
children:
|
|
903
|
+
children: [
|
|
904
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
905
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
906
|
+
"span",
|
|
907
|
+
{
|
|
908
|
+
className: "truncate text-sm",
|
|
909
|
+
title: file.name,
|
|
910
|
+
children: file.name
|
|
911
|
+
}
|
|
912
|
+
),
|
|
913
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground", children: formatFileSize(file.size) })
|
|
914
|
+
] }),
|
|
915
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
916
|
+
Button,
|
|
917
|
+
{
|
|
918
|
+
type: "button",
|
|
919
|
+
variant: "ghost",
|
|
920
|
+
size: "icon",
|
|
921
|
+
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
922
|
+
onClick: () => handleRemoveFile(index),
|
|
923
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconX, { className: "h-3 w-3" })
|
|
924
|
+
}
|
|
925
|
+
)
|
|
926
|
+
]
|
|
818
927
|
},
|
|
819
|
-
|
|
928
|
+
index
|
|
820
929
|
))
|
|
821
|
-
] })
|
|
822
|
-
|
|
823
|
-
|
|
930
|
+
] }),
|
|
931
|
+
attachedFiles.length < maxFiles && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
932
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
933
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
934
|
+
DropdownMenuItem,
|
|
935
|
+
{
|
|
936
|
+
onSelect: (e) => {
|
|
937
|
+
e.preventDefault();
|
|
938
|
+
fileInputRef.current?.click();
|
|
939
|
+
},
|
|
940
|
+
className: "text-primary focus:text-primary",
|
|
941
|
+
children: [
|
|
942
|
+
/* @__PURE__ */ jsxRuntime.jsx(ICONS.IconPlus, { className: "mr-2 h-4 w-4" }),
|
|
943
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Add more files" })
|
|
944
|
+
]
|
|
945
|
+
}
|
|
946
|
+
)
|
|
947
|
+
] })
|
|
948
|
+
] })
|
|
949
|
+
] })
|
|
824
950
|
] }),
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
951
|
+
options.map((group) => {
|
|
952
|
+
const selectedInGroup = group.options.filter(
|
|
953
|
+
(o) => selectedOptions.has(o.id)
|
|
954
|
+
);
|
|
955
|
+
const label = selectedInGroup.length === 0 ? group.label : selectedInGroup.length === 1 ? selectedInGroup[0].label : group.label;
|
|
956
|
+
const isSingle = group.type === "single";
|
|
957
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
958
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
959
|
+
DropdownMenuTrigger,
|
|
960
|
+
{
|
|
961
|
+
render: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
962
|
+
Button,
|
|
963
|
+
{
|
|
964
|
+
variant: "ghost",
|
|
965
|
+
size: "sm",
|
|
966
|
+
className: cn(
|
|
967
|
+
"gap-2",
|
|
968
|
+
selectedInGroup.length > 0 ? "text-foreground bg-muted/50" : "text-muted-foreground"
|
|
969
|
+
),
|
|
970
|
+
children: [
|
|
971
|
+
label,
|
|
972
|
+
selectedInGroup.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(Badge, { className: "h-[18px] min-w-[18px] px-1.5 text-[10px]", children: selectedInGroup.length }),
|
|
973
|
+
/* @__PURE__ */ jsxRuntime.jsx(ICONS.IconChevronDown, { className: "h-3 w-3 opacity-50" })
|
|
974
|
+
]
|
|
975
|
+
}
|
|
976
|
+
)
|
|
977
|
+
}
|
|
978
|
+
),
|
|
979
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuContent, { align: "start", className: "w-56", children: /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuGroup, { children: [
|
|
980
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuLabel, { children: group.label }),
|
|
981
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
982
|
+
group.options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
983
|
+
DropdownMenuCheckboxItem,
|
|
984
|
+
{
|
|
985
|
+
checked: selectedOptions.has(option.id),
|
|
986
|
+
onCheckedChange: () => toggleOption(
|
|
987
|
+
option.id,
|
|
988
|
+
group.options,
|
|
989
|
+
isSingle ? "single" : "multiple"
|
|
990
|
+
),
|
|
991
|
+
onSelect: (e) => e.preventDefault(),
|
|
992
|
+
children: option.label
|
|
993
|
+
},
|
|
994
|
+
option.id
|
|
995
|
+
))
|
|
996
|
+
] }) })
|
|
997
|
+
] }, group.id);
|
|
998
|
+
})
|
|
999
|
+
] }),
|
|
1000
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1001
|
+
Button,
|
|
1002
|
+
{
|
|
1003
|
+
type: "submit",
|
|
1004
|
+
disabled: !value.trim() && attachedFiles.length === 0 && !isLoading || isLoading,
|
|
1005
|
+
size: "icon-lg",
|
|
1006
|
+
onClick: () => handleInternalSubmit().catch(console.error),
|
|
1007
|
+
children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconLoader2, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconArrowUp, { className: "h-5 w-5" })
|
|
1008
|
+
}
|
|
1009
|
+
)
|
|
836
1010
|
] })
|
|
837
|
-
] });
|
|
1011
|
+
] }) });
|
|
838
1012
|
}
|
|
839
1013
|
function Card({
|
|
840
1014
|
className,
|
|
@@ -966,8 +1140,6 @@ var Col = ({
|
|
|
966
1140
|
gap = "sm",
|
|
967
1141
|
align = "start",
|
|
968
1142
|
justify = "start",
|
|
969
|
-
wrap = "nowrap",
|
|
970
|
-
flex = 1,
|
|
971
1143
|
width,
|
|
972
1144
|
height,
|
|
973
1145
|
padding,
|
|
@@ -1017,13 +1189,11 @@ var Col = ({
|
|
|
1017
1189
|
gapClasses[gap] || "gap-2",
|
|
1018
1190
|
alignClasses[align] || "items-start",
|
|
1019
1191
|
justifyClasses[justify] || "justify-start",
|
|
1020
|
-
wrap === "wrap" ? "flex-wrap" : "flex-nowrap",
|
|
1021
1192
|
overflow && overflowClasses[overflow],
|
|
1022
1193
|
position && positionClasses[position],
|
|
1023
1194
|
className
|
|
1024
1195
|
),
|
|
1025
1196
|
style: {
|
|
1026
|
-
flex,
|
|
1027
1197
|
width,
|
|
1028
1198
|
height,
|
|
1029
1199
|
padding,
|
|
@@ -1331,9 +1501,9 @@ var Image = ({
|
|
|
1331
1501
|
className,
|
|
1332
1502
|
style
|
|
1333
1503
|
}) => {
|
|
1334
|
-
const [hasError, setHasError] =
|
|
1335
|
-
const [isLoading, setIsLoading] =
|
|
1336
|
-
const [open, setOpen] =
|
|
1504
|
+
const [hasError, setHasError] = React12.useState(false);
|
|
1505
|
+
const [isLoading, setIsLoading] = React12.useState(true);
|
|
1506
|
+
const [open, setOpen] = React12.useState(false);
|
|
1337
1507
|
const sizes = {
|
|
1338
1508
|
sm: "h-11",
|
|
1339
1509
|
md: "h-22",
|
|
@@ -1457,45 +1627,6 @@ var Icon = ({
|
|
|
1457
1627
|
}
|
|
1458
1628
|
);
|
|
1459
1629
|
};
|
|
1460
|
-
var badgeVariants = classVarianceAuthority.cva(
|
|
1461
|
-
"h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-colors overflow-hidden group/badge",
|
|
1462
|
-
{
|
|
1463
|
-
variants: {
|
|
1464
|
-
variant: {
|
|
1465
|
-
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
1466
|
-
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
1467
|
-
destructive: "bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",
|
|
1468
|
-
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground bg-input/30",
|
|
1469
|
-
ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
1470
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
1471
|
-
}
|
|
1472
|
-
},
|
|
1473
|
-
defaultVariants: {
|
|
1474
|
-
variant: "default"
|
|
1475
|
-
}
|
|
1476
|
-
}
|
|
1477
|
-
);
|
|
1478
|
-
function Badge({
|
|
1479
|
-
className,
|
|
1480
|
-
variant = "default",
|
|
1481
|
-
render,
|
|
1482
|
-
...props
|
|
1483
|
-
}) {
|
|
1484
|
-
return useRender.useRender({
|
|
1485
|
-
defaultTagName: "span",
|
|
1486
|
-
props: mergeProps.mergeProps(
|
|
1487
|
-
{
|
|
1488
|
-
className: cn(badgeVariants({ className, variant }))
|
|
1489
|
-
},
|
|
1490
|
-
props
|
|
1491
|
-
),
|
|
1492
|
-
render,
|
|
1493
|
-
state: {
|
|
1494
|
-
slot: "badge",
|
|
1495
|
-
variant
|
|
1496
|
-
}
|
|
1497
|
-
});
|
|
1498
|
-
}
|
|
1499
1630
|
var Badge2 = ({
|
|
1500
1631
|
label,
|
|
1501
1632
|
variant = "primary",
|
|
@@ -1531,7 +1662,7 @@ var Chart = ({
|
|
|
1531
1662
|
className,
|
|
1532
1663
|
style
|
|
1533
1664
|
}) => {
|
|
1534
|
-
const [tooltip, setTooltip] =
|
|
1665
|
+
const [tooltip, setTooltip] = React12.useState(null);
|
|
1535
1666
|
if (!Array.isArray(data)) {
|
|
1536
1667
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-destructive border border-destructive/20 rounded-md bg-destructive/5", children: "Error: Chart data must be an array" });
|
|
1537
1668
|
}
|
|
@@ -2084,9 +2215,9 @@ var Select2 = ({
|
|
|
2084
2215
|
defaultValue,
|
|
2085
2216
|
value,
|
|
2086
2217
|
disabled,
|
|
2087
|
-
onValueChange: handleValueChange,
|
|
2218
|
+
onValueChange: (value2) => handleValueChange(value2 || ""),
|
|
2088
2219
|
children: [
|
|
2089
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {
|
|
2220
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
|
|
2090
2221
|
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
2091
2222
|
]
|
|
2092
2223
|
}
|
|
@@ -2116,7 +2247,6 @@ var Label2 = ({
|
|
|
2116
2247
|
var Checkbox = ({
|
|
2117
2248
|
label,
|
|
2118
2249
|
name,
|
|
2119
|
-
value = "on",
|
|
2120
2250
|
checked,
|
|
2121
2251
|
defaultChecked,
|
|
2122
2252
|
disabled,
|
|
@@ -2131,46 +2261,37 @@ var Checkbox = ({
|
|
|
2131
2261
|
...onChangeAction,
|
|
2132
2262
|
data: {
|
|
2133
2263
|
name: name || "",
|
|
2134
|
-
value,
|
|
2135
2264
|
checked: e.target.checked
|
|
2136
2265
|
}
|
|
2137
2266
|
});
|
|
2138
2267
|
}
|
|
2139
2268
|
};
|
|
2140
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
{
|
|
2163
|
-
htmlFor: name,
|
|
2164
|
-
value: label,
|
|
2165
|
-
className: cn(
|
|
2166
|
-
"cursor-pointer select-none text-sm font-medium leading-none",
|
|
2167
|
-
disabled && "cursor-not-allowed opacity-50"
|
|
2168
|
-
)
|
|
2169
|
-
}
|
|
2269
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-center gap-2", className), style, children: [
|
|
2270
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2271
|
+
"input",
|
|
2272
|
+
{
|
|
2273
|
+
type: "checkbox",
|
|
2274
|
+
name,
|
|
2275
|
+
id: name,
|
|
2276
|
+
checked,
|
|
2277
|
+
defaultChecked,
|
|
2278
|
+
disabled,
|
|
2279
|
+
onChange: handleChange,
|
|
2280
|
+
className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary disabled:cursor-not-allowed disabled:opacity-50"
|
|
2281
|
+
}
|
|
2282
|
+
),
|
|
2283
|
+
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2284
|
+
Label2,
|
|
2285
|
+
{
|
|
2286
|
+
htmlFor: name,
|
|
2287
|
+
value: label,
|
|
2288
|
+
className: cn(
|
|
2289
|
+
"cursor-pointer select-none text-sm font-medium leading-none",
|
|
2290
|
+
disabled && "cursor-not-allowed opacity-50"
|
|
2170
2291
|
)
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
);
|
|
2292
|
+
}
|
|
2293
|
+
)
|
|
2294
|
+
] });
|
|
2174
2295
|
};
|
|
2175
2296
|
var RadioGroup = ({
|
|
2176
2297
|
name,
|
|
@@ -2287,7 +2408,7 @@ var Button2 = ({
|
|
|
2287
2408
|
};
|
|
2288
2409
|
var Form = ({ children, onSubmitAction, className, style }) => {
|
|
2289
2410
|
const { sendEvent } = useMelony();
|
|
2290
|
-
const [isSubmitted, setIsSubmitted] =
|
|
2411
|
+
const [isSubmitted, setIsSubmitted] = React12.useState(false);
|
|
2291
2412
|
const handleSubmit = (e) => {
|
|
2292
2413
|
e.preventDefault();
|
|
2293
2414
|
if (isSubmitted) return;
|
|
@@ -2434,7 +2555,7 @@ function MessageBubble({ message }) {
|
|
|
2434
2555
|
);
|
|
2435
2556
|
}
|
|
2436
2557
|
function LoadingIndicator({ status }) {
|
|
2437
|
-
const [isExpanded, setIsExpanded] =
|
|
2558
|
+
const [isExpanded, setIsExpanded] = React12.useState(false);
|
|
2438
2559
|
const message = status?.message || "Processing...";
|
|
2439
2560
|
const details = status?.details;
|
|
2440
2561
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
@@ -2466,7 +2587,7 @@ function MessageList({
|
|
|
2466
2587
|
if (messages.length === 0) {
|
|
2467
2588
|
return null;
|
|
2468
2589
|
}
|
|
2469
|
-
const isTextStreaming =
|
|
2590
|
+
const isTextStreaming = React12.useMemo(() => {
|
|
2470
2591
|
if (messages.length === 0 || !isLoading) return false;
|
|
2471
2592
|
const lastMessage = messages[messages.length - 1];
|
|
2472
2593
|
return lastMessage.content.some((event) => event.type === "text-delta");
|
|
@@ -2493,17 +2614,19 @@ function Thread({
|
|
|
2493
2614
|
});
|
|
2494
2615
|
const starterPrompts = localStarterPrompts ?? config?.starterPrompts;
|
|
2495
2616
|
const options = localOptions ?? config?.options;
|
|
2496
|
-
const
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
) ?? [];
|
|
2617
|
+
const fileAttachments = config?.fileAttachments;
|
|
2618
|
+
const allDefaultSelectedIds = React12.useMemo(() => {
|
|
2619
|
+
const defaultSelectedIdsFromOptions = options?.flatMap((group) => group.defaultSelectedIds ?? []) ?? [];
|
|
2500
2620
|
return [
|
|
2501
|
-
.../* @__PURE__ */ new Set([
|
|
2621
|
+
.../* @__PURE__ */ new Set([
|
|
2622
|
+
...defaultSelectedIdsFromOptions,
|
|
2623
|
+
...defaultSelectedIds ?? []
|
|
2624
|
+
])
|
|
2502
2625
|
];
|
|
2503
2626
|
}, [options, defaultSelectedIds]);
|
|
2504
|
-
const [input, setInput] =
|
|
2505
|
-
const messagesEndRef =
|
|
2506
|
-
|
|
2627
|
+
const [input, setInput] = React12.useState("");
|
|
2628
|
+
const messagesEndRef = React12.useRef(null);
|
|
2629
|
+
React12.useEffect(() => {
|
|
2507
2630
|
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
2508
2631
|
}, [messages]);
|
|
2509
2632
|
const handleSubmit = async (state, overrideInput) => {
|
|
@@ -2574,7 +2697,7 @@ function Thread({
|
|
|
2574
2697
|
options,
|
|
2575
2698
|
autoFocus,
|
|
2576
2699
|
defaultSelectedIds: allDefaultSelectedIds,
|
|
2577
|
-
fileAttachments
|
|
2700
|
+
fileAttachments
|
|
2578
2701
|
}
|
|
2579
2702
|
) }) })
|
|
2580
2703
|
]
|
|
@@ -2582,20 +2705,36 @@ function Thread({
|
|
|
2582
2705
|
);
|
|
2583
2706
|
}
|
|
2584
2707
|
function ChatHeader({
|
|
2585
|
-
title,
|
|
2586
2708
|
leftContent,
|
|
2587
2709
|
rightContent,
|
|
2588
2710
|
className,
|
|
2589
|
-
titleClassName,
|
|
2590
2711
|
children
|
|
2591
2712
|
}) {
|
|
2592
2713
|
if (children) {
|
|
2593
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2714
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2715
|
+
"div",
|
|
2716
|
+
{
|
|
2717
|
+
className: cn(
|
|
2718
|
+
"px-2 border-b border-border h-14 flex items-center shrink-0",
|
|
2719
|
+
className
|
|
2720
|
+
),
|
|
2721
|
+
children
|
|
2722
|
+
}
|
|
2723
|
+
);
|
|
2594
2724
|
}
|
|
2595
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2725
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2726
|
+
"div",
|
|
2727
|
+
{
|
|
2728
|
+
className: cn(
|
|
2729
|
+
"px-2 border-b border-border h-14 flex items-center justify-between shrink-0",
|
|
2730
|
+
className
|
|
2731
|
+
),
|
|
2732
|
+
children: [
|
|
2733
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 flex-1 min-w-0", children: leftContent }),
|
|
2734
|
+
rightContent && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1 shrink-0 ml-2", children: rightContent })
|
|
2735
|
+
]
|
|
2736
|
+
}
|
|
2737
|
+
);
|
|
2599
2738
|
}
|
|
2600
2739
|
var ThreadList = ({
|
|
2601
2740
|
className,
|
|
@@ -2610,14 +2749,20 @@ var ThreadList = ({
|
|
|
2610
2749
|
deleteThread,
|
|
2611
2750
|
isLoading
|
|
2612
2751
|
} = useThreads();
|
|
2752
|
+
const sortedThreads = React12__namespace.useMemo(() => {
|
|
2753
|
+
return [...threads].sort((a, b) => {
|
|
2754
|
+
const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0;
|
|
2755
|
+
const dateB = b.updatedAt ? new Date(b.updatedAt).getTime() : 0;
|
|
2756
|
+
return dateB - dateA;
|
|
2757
|
+
});
|
|
2758
|
+
}, [threads]);
|
|
2613
2759
|
const handleThreadClick = (threadId) => {
|
|
2614
2760
|
if (threadId !== activeThreadId) {
|
|
2615
2761
|
selectThread(threadId);
|
|
2616
2762
|
}
|
|
2617
2763
|
onThreadSelect?.(threadId);
|
|
2618
2764
|
};
|
|
2619
|
-
const handleDelete = async (
|
|
2620
|
-
e.stopPropagation();
|
|
2765
|
+
const handleDelete = async (threadId) => {
|
|
2621
2766
|
try {
|
|
2622
2767
|
await deleteThread(threadId);
|
|
2623
2768
|
} catch (error) {
|
|
@@ -2631,32 +2776,16 @@ var ThreadList = ({
|
|
|
2631
2776
|
console.error("Failed to create thread:", error);
|
|
2632
2777
|
}
|
|
2633
2778
|
};
|
|
2634
|
-
const formatDate = (date) => {
|
|
2635
|
-
if (!date) return "";
|
|
2636
|
-
const d = typeof date === "string" ? new Date(date) : date;
|
|
2637
|
-
if (isNaN(d.getTime())) return "";
|
|
2638
|
-
const now = /* @__PURE__ */ new Date();
|
|
2639
|
-
const diffMs = now.getTime() - d.getTime();
|
|
2640
|
-
const diffMins = Math.floor(diffMs / 6e4);
|
|
2641
|
-
const diffHours = Math.floor(diffMs / 36e5);
|
|
2642
|
-
const diffDays = Math.floor(diffMs / 864e5);
|
|
2643
|
-
if (diffMins < 1) return "Just now";
|
|
2644
|
-
if (diffMins < 60) return `${diffMins}m ago`;
|
|
2645
|
-
if (diffHours < 24) return `${diffHours}h ago`;
|
|
2646
|
-
if (diffDays < 7) return `${diffDays}d ago`;
|
|
2647
|
-
return d.toLocaleDateString();
|
|
2648
|
-
};
|
|
2649
2779
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col h-full", className), children: [
|
|
2650
2780
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2651
2781
|
Button,
|
|
2652
2782
|
{
|
|
2653
|
-
variant: "
|
|
2654
|
-
|
|
2783
|
+
variant: "outline",
|
|
2784
|
+
className: "w-full justify-start gap-2 h-9 px-3 border-dashed hover:border-solid transition-all",
|
|
2655
2785
|
onClick: handleNewThread,
|
|
2656
|
-
className: "w-full justify-start",
|
|
2657
2786
|
children: [
|
|
2658
|
-
/* @__PURE__ */ jsxRuntime.jsx(ICONS.IconPlus, { className: "
|
|
2659
|
-
"New
|
|
2787
|
+
/* @__PURE__ */ jsxRuntime.jsx(ICONS.IconPlus, { className: "size-4" }),
|
|
2788
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium", children: "New chat" })
|
|
2660
2789
|
]
|
|
2661
2790
|
}
|
|
2662
2791
|
) }),
|
|
@@ -2664,7 +2793,7 @@ var ThreadList = ({
|
|
|
2664
2793
|
/* @__PURE__ */ jsxRuntime.jsx(ICONS.IconMessage, { className: "size-8 mx-auto opacity-50" }),
|
|
2665
2794
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", children: "No threads yet" }),
|
|
2666
2795
|
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "sm", onClick: handleNewThread, children: "Start a conversation" })
|
|
2667
|
-
] }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 space-y-1", children:
|
|
2796
|
+
] }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 space-y-1", children: sortedThreads.map((thread) => {
|
|
2668
2797
|
const isActive = thread.id === activeThreadId;
|
|
2669
2798
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2670
2799
|
"div",
|
|
@@ -2672,26 +2801,44 @@ var ThreadList = ({
|
|
|
2672
2801
|
onClick: () => handleThreadClick(thread.id),
|
|
2673
2802
|
className: cn(
|
|
2674
2803
|
"group relative flex items-center gap-3 px-3 py-1.5 rounded-lg cursor-pointer transition-colors",
|
|
2675
|
-
isActive ? "bg-muted" : "hover:bg-muted"
|
|
2804
|
+
isActive ? "bg-muted text-foreground" : "hover:bg-muted/50 text-muted-foreground hover:text-foreground"
|
|
2676
2805
|
),
|
|
2677
2806
|
children: [
|
|
2678
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxRuntime.
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2807
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium truncate", children: thread.title || `Thread ${thread.id.slice(0, 8)}` }) }),
|
|
2808
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 flex items-center opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
2809
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2810
|
+
DropdownMenuTrigger,
|
|
2811
|
+
{
|
|
2812
|
+
render: (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2813
|
+
Button,
|
|
2814
|
+
{
|
|
2815
|
+
variant: "ghost",
|
|
2816
|
+
size: "icon-xs",
|
|
2817
|
+
...props,
|
|
2818
|
+
onClick: (e) => {
|
|
2819
|
+
e.stopPropagation();
|
|
2820
|
+
props.onClick?.(e);
|
|
2821
|
+
},
|
|
2822
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconDotsVertical, { className: "size-3.5" })
|
|
2823
|
+
}
|
|
2824
|
+
)
|
|
2825
|
+
}
|
|
2826
|
+
),
|
|
2827
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuContent, { align: "start", className: "w-32", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2828
|
+
DropdownMenuItem,
|
|
2829
|
+
{
|
|
2830
|
+
variant: "destructive",
|
|
2831
|
+
onClick: (e) => {
|
|
2832
|
+
e.stopPropagation();
|
|
2833
|
+
handleDelete(thread.id);
|
|
2834
|
+
},
|
|
2835
|
+
children: [
|
|
2836
|
+
/* @__PURE__ */ jsxRuntime.jsx(ICONS.IconTrash, { className: "size-4 mr-2" }),
|
|
2837
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Delete" })
|
|
2838
|
+
]
|
|
2839
|
+
}
|
|
2840
|
+
) })
|
|
2841
|
+
] }) })
|
|
2695
2842
|
]
|
|
2696
2843
|
},
|
|
2697
2844
|
thread.id
|
|
@@ -2708,8 +2855,8 @@ function ChatPopup({
|
|
|
2708
2855
|
headerProps,
|
|
2709
2856
|
defaultSelectedIds
|
|
2710
2857
|
}) {
|
|
2711
|
-
const [isOpen, setIsOpen] =
|
|
2712
|
-
const [view, setView] =
|
|
2858
|
+
const [isOpen, setIsOpen] = React12.useState(defaultOpen);
|
|
2859
|
+
const [view, setView] = React12.useState("chat");
|
|
2713
2860
|
const { createThread } = useThreads();
|
|
2714
2861
|
const handleNewChat = async () => {
|
|
2715
2862
|
try {
|
|
@@ -2826,9 +2973,144 @@ function ChatSidebar({
|
|
|
2826
2973
|
) })
|
|
2827
2974
|
] });
|
|
2828
2975
|
}
|
|
2976
|
+
var ChatSidebarContext = React12.createContext(
|
|
2977
|
+
void 0
|
|
2978
|
+
);
|
|
2979
|
+
function useChatSidebar() {
|
|
2980
|
+
const context = React12.useContext(ChatSidebarContext);
|
|
2981
|
+
if (context === void 0) {
|
|
2982
|
+
throw new Error("useChatSidebar must be used within a ChatSidebarProvider");
|
|
2983
|
+
}
|
|
2984
|
+
return context;
|
|
2985
|
+
}
|
|
2986
|
+
function WelcomeScreen({
|
|
2987
|
+
title = "Welcome to Melony",
|
|
2988
|
+
description = "The most powerful AI agent framework for building modern applications. Connect your tools, build your brain, and ship faster.",
|
|
2989
|
+
features = [
|
|
2990
|
+
{
|
|
2991
|
+
title: "Context Aware",
|
|
2992
|
+
description: "Built-in state management for complex LLM flows."
|
|
2993
|
+
},
|
|
2994
|
+
{
|
|
2995
|
+
title: "Extensible",
|
|
2996
|
+
description: "Plugin architecture for easy integrations."
|
|
2997
|
+
},
|
|
2998
|
+
{
|
|
2999
|
+
title: "Real-time",
|
|
3000
|
+
description: "Streaming responses and live state updates."
|
|
3001
|
+
},
|
|
3002
|
+
{
|
|
3003
|
+
title: "Tool-ready",
|
|
3004
|
+
description: "Ready-to-use actions for common tasks."
|
|
3005
|
+
}
|
|
3006
|
+
],
|
|
3007
|
+
className,
|
|
3008
|
+
onLoginClick,
|
|
3009
|
+
termsUrl = "#",
|
|
3010
|
+
privacyUrl = "#",
|
|
3011
|
+
imageUrl,
|
|
3012
|
+
imageAlt = "Product screenshot"
|
|
3013
|
+
}) {
|
|
3014
|
+
const { login, isLoading } = useAuth();
|
|
3015
|
+
const handleLogin = () => {
|
|
3016
|
+
if (onLoginClick) {
|
|
3017
|
+
onLoginClick();
|
|
3018
|
+
} else {
|
|
3019
|
+
login();
|
|
3020
|
+
}
|
|
3021
|
+
};
|
|
3022
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3023
|
+
"div",
|
|
3024
|
+
{
|
|
3025
|
+
className: cn(
|
|
3026
|
+
"flex min-h-[600px] h-full w-full flex-col md:flex-row bg-background overflow-hidden",
|
|
3027
|
+
className
|
|
3028
|
+
),
|
|
3029
|
+
children: [
|
|
3030
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col bg-sidebar text-foreground relative overflow-hidden", children: [
|
|
3031
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute -top-24 -left-24 size-96 bg-primary/5 rounded-full blur-3xl" }),
|
|
3032
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute -bottom-24 -right-24 size-96 bg-primary/5 rounded-full blur-3xl" }),
|
|
3033
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-y-auto overflow-x-hidden relative z-10 flex flex-col p-8 md:p-12 lg:p-20", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-xl mx-auto w-full", children: [
|
|
3034
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "mb-6 text-4xl font-bold tracking-tight md:text-5xl lg:text-6xl text-foreground", children: title }),
|
|
3035
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-12 text-lg text-muted-foreground md:text-xl leading-relaxed", children: description }),
|
|
3036
|
+
imageUrl && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-12 relative group", children: [
|
|
3037
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute -inset-1 bg-gradient-to-r from-primary/20 to-primary/10 rounded-xl blur opacity-25 group-hover:opacity-50 transition duration-1000 group-hover:duration-200" }),
|
|
3038
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3039
|
+
"img",
|
|
3040
|
+
{
|
|
3041
|
+
src: imageUrl,
|
|
3042
|
+
alt: imageAlt,
|
|
3043
|
+
className: "relative rounded-xl border border-border/50 shadow-2xl transition-transform duration-500 hover:scale-[1.02] w-full"
|
|
3044
|
+
}
|
|
3045
|
+
)
|
|
3046
|
+
] }),
|
|
3047
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 gap-x-8 gap-y-10 sm:grid-cols-2", children: features.map((feature, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
3048
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-bold text-lg text-foreground", children: feature.title }),
|
|
3049
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground leading-relaxed", children: feature.description })
|
|
3050
|
+
] }, i)) })
|
|
3051
|
+
] }) })
|
|
3052
|
+
] }),
|
|
3053
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 flex-col items-center justify-center p-8 md:p-12 lg:p-20 bg-background transition-colors duration-300", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full max-w-sm space-y-8", children: [
|
|
3054
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3 text-center md:text-left", children: [
|
|
3055
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-3xl font-bold tracking-tight text-foreground", children: "Get Started" }),
|
|
3056
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-lg", children: "Sign in to your account to continue" })
|
|
3057
|
+
] }),
|
|
3058
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
3059
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3060
|
+
Button,
|
|
3061
|
+
{
|
|
3062
|
+
size: "lg",
|
|
3063
|
+
variant: "outline",
|
|
3064
|
+
className: "w-full h-16 text-lg shadow-sm hover:shadow-md transition-all flex items-center justify-center gap-3 border-2 font-medium bg-background text-foreground hover:bg-accent",
|
|
3065
|
+
onClick: handleLogin,
|
|
3066
|
+
disabled: isLoading,
|
|
3067
|
+
children: [
|
|
3068
|
+
/* @__PURE__ */ jsxRuntime.jsx(ICONS.IconBrandGoogle, { className: "size-6" }),
|
|
3069
|
+
isLoading ? "Signing in..." : "Continue with Google"
|
|
3070
|
+
]
|
|
3071
|
+
}
|
|
3072
|
+
),
|
|
3073
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative py-4", children: [
|
|
3074
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-full border-t border-border" }) }),
|
|
3075
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative flex justify-center text-xs uppercase", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-background px-3 text-muted-foreground tracking-widest font-medium", children: "Secure access" }) })
|
|
3076
|
+
] })
|
|
3077
|
+
] }),
|
|
3078
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-muted-foreground leading-relaxed text-center md:text-left", children: [
|
|
3079
|
+
"By continuing, you agree to our ",
|
|
3080
|
+
/* @__PURE__ */ jsxRuntime.jsx("br", { className: "hidden md:block" }),
|
|
3081
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3082
|
+
"a",
|
|
3083
|
+
{
|
|
3084
|
+
href: termsUrl,
|
|
3085
|
+
target: "_blank",
|
|
3086
|
+
rel: "noopener noreferrer",
|
|
3087
|
+
className: "underline underline-offset-4 hover:text-primary transition-colors font-medium",
|
|
3088
|
+
children: "Terms of Service"
|
|
3089
|
+
}
|
|
3090
|
+
),
|
|
3091
|
+
" ",
|
|
3092
|
+
"and",
|
|
3093
|
+
" ",
|
|
3094
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3095
|
+
"a",
|
|
3096
|
+
{
|
|
3097
|
+
href: privacyUrl,
|
|
3098
|
+
target: "_blank",
|
|
3099
|
+
rel: "noopener noreferrer",
|
|
3100
|
+
className: "underline underline-offset-4 hover:text-primary transition-colors font-medium",
|
|
3101
|
+
children: "Privacy Policy"
|
|
3102
|
+
}
|
|
3103
|
+
),
|
|
3104
|
+
"."
|
|
3105
|
+
] })
|
|
3106
|
+
] }) })
|
|
3107
|
+
]
|
|
3108
|
+
}
|
|
3109
|
+
);
|
|
3110
|
+
}
|
|
2829
3111
|
function ChatFull({
|
|
2830
3112
|
title = "Chat",
|
|
2831
|
-
placeholder
|
|
3113
|
+
placeholder,
|
|
2832
3114
|
starterPrompts,
|
|
2833
3115
|
options,
|
|
2834
3116
|
className,
|
|
@@ -2837,134 +3119,140 @@ function ChatFull({
|
|
|
2837
3119
|
rightSidebar,
|
|
2838
3120
|
leftSidebarClassName,
|
|
2839
3121
|
rightSidebarClassName,
|
|
2840
|
-
leftSidebarCollapsible = false,
|
|
2841
|
-
rightSidebarCollapsible = false,
|
|
2842
|
-
defaultLeftSidebarCollapsed = false,
|
|
2843
|
-
defaultRightSidebarCollapsed = false,
|
|
2844
|
-
leftSidebarCollapsed: controlledLeftCollapsed,
|
|
2845
|
-
rightSidebarCollapsed: controlledRightCollapsed,
|
|
2846
|
-
onLeftSidebarCollapseChange,
|
|
2847
|
-
onRightSidebarCollapseChange,
|
|
2848
3122
|
autoFocus = false,
|
|
2849
|
-
defaultSelectedIds
|
|
3123
|
+
defaultSelectedIds,
|
|
3124
|
+
showWelcomeScreen = false,
|
|
3125
|
+
welcomeScreenProps
|
|
2850
3126
|
}) {
|
|
2851
|
-
const
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
const [
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
const leftCollapsed = controlledLeftCollapsed !== void 0 ? controlledLeftCollapsed : internalLeftCollapsed;
|
|
2858
|
-
const rightCollapsed = controlledRightCollapsed !== void 0 ? controlledRightCollapsed : internalRightCollapsed;
|
|
2859
|
-
const handleLeftToggle = () => {
|
|
2860
|
-
const newCollapsed = !leftCollapsed;
|
|
2861
|
-
if (controlledLeftCollapsed === void 0) {
|
|
2862
|
-
setInternalLeftCollapsed(newCollapsed);
|
|
3127
|
+
const { isMobile, isTablet } = useScreenSize();
|
|
3128
|
+
const { isAuthenticated, isLoading } = useAuth();
|
|
3129
|
+
const isSmallScreen = isMobile || isTablet;
|
|
3130
|
+
const [internalLeftCollapsed, setInternalLeftCollapsed] = React12.useState(() => {
|
|
3131
|
+
if (typeof window !== "undefined") {
|
|
3132
|
+
return window.innerWidth < 1024;
|
|
2863
3133
|
}
|
|
2864
|
-
|
|
2865
|
-
};
|
|
2866
|
-
const
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
setInternalRightCollapsed(newCollapsed);
|
|
3134
|
+
return false;
|
|
3135
|
+
});
|
|
3136
|
+
const [internalRightCollapsed, setInternalRightCollapsed] = React12.useState(() => {
|
|
3137
|
+
if (typeof window !== "undefined") {
|
|
3138
|
+
return window.innerWidth < 1024;
|
|
2870
3139
|
}
|
|
2871
|
-
|
|
2872
|
-
};
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
"
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
3140
|
+
return false;
|
|
3141
|
+
});
|
|
3142
|
+
React12.useEffect(() => {
|
|
3143
|
+
if (isSmallScreen) {
|
|
3144
|
+
setInternalLeftCollapsed(true);
|
|
3145
|
+
setInternalRightCollapsed(true);
|
|
3146
|
+
}
|
|
3147
|
+
}, [isSmallScreen]);
|
|
3148
|
+
const leftCollapsed = internalLeftCollapsed;
|
|
3149
|
+
const rightCollapsed = internalRightCollapsed;
|
|
3150
|
+
const handleLeftToggle = React12.useCallback((collapsed) => {
|
|
3151
|
+
setInternalLeftCollapsed(collapsed);
|
|
3152
|
+
}, []);
|
|
3153
|
+
const handleRightToggle = React12.useCallback((collapsed) => {
|
|
3154
|
+
setInternalRightCollapsed(collapsed);
|
|
3155
|
+
}, []);
|
|
3156
|
+
const contextValue = React12.useMemo(
|
|
3157
|
+
() => ({
|
|
3158
|
+
leftCollapsed,
|
|
3159
|
+
rightCollapsed,
|
|
3160
|
+
setLeftCollapsed: handleLeftToggle,
|
|
3161
|
+
setRightCollapsed: handleRightToggle,
|
|
3162
|
+
leftCollapsible: true,
|
|
3163
|
+
rightCollapsible: true
|
|
3164
|
+
}),
|
|
3165
|
+
[leftCollapsed, rightCollapsed, handleLeftToggle, handleRightToggle]
|
|
3166
|
+
);
|
|
3167
|
+
if (showWelcomeScreen && !isAuthenticated && !isLoading) {
|
|
3168
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WelcomeScreen, { ...welcomeScreenProps });
|
|
3169
|
+
}
|
|
3170
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ChatSidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3171
|
+
"div",
|
|
3172
|
+
{
|
|
3173
|
+
className: cn("flex flex-col h-full w-full bg-background", className),
|
|
3174
|
+
children: [
|
|
3175
|
+
title && /* @__PURE__ */ jsxRuntime.jsx(ChatHeader, { title, ...headerProps }),
|
|
3176
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 overflow-hidden flex relative", children: [
|
|
3177
|
+
leftSidebar && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3178
|
+
"div",
|
|
3179
|
+
{
|
|
3180
|
+
className: cn(
|
|
3181
|
+
"flex-shrink-0 border-r border-border bg-background transition-all duration-300 ease-in-out overflow-hidden flex flex-col",
|
|
3182
|
+
leftCollapsed ? "w-0 border-r-0 min-w-0" : "",
|
|
3183
|
+
!leftCollapsed && leftSidebarClassName
|
|
3184
|
+
),
|
|
3185
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-hidden min-h-0", children: leftSidebar })
|
|
3186
|
+
}
|
|
3187
|
+
),
|
|
3188
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3189
|
+
Thread,
|
|
3190
|
+
{
|
|
3191
|
+
placeholder,
|
|
3192
|
+
starterPrompts,
|
|
3193
|
+
options,
|
|
3194
|
+
autoFocus,
|
|
3195
|
+
defaultSelectedIds
|
|
3196
|
+
}
|
|
3197
|
+
) }),
|
|
3198
|
+
rightSidebar && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3199
|
+
"div",
|
|
3200
|
+
{
|
|
3201
|
+
className: cn(
|
|
3202
|
+
"flex-shrink-0 border-l border-border bg-background transition-all duration-300 ease-in-out overflow-hidden flex flex-col",
|
|
3203
|
+
rightCollapsed ? "w-0 border-l-0 min-w-0" : "",
|
|
3204
|
+
!rightCollapsed && rightSidebarClassName
|
|
3205
|
+
),
|
|
3206
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-hidden min-h-0", children: rightSidebar })
|
|
3207
|
+
}
|
|
3208
|
+
)
|
|
3209
|
+
] })
|
|
3210
|
+
]
|
|
3211
|
+
}
|
|
3212
|
+
) });
|
|
3213
|
+
}
|
|
3214
|
+
function SidebarToggle({ side, className }) {
|
|
3215
|
+
const {
|
|
3216
|
+
leftCollapsed,
|
|
3217
|
+
rightCollapsed,
|
|
3218
|
+
setLeftCollapsed,
|
|
3219
|
+
setRightCollapsed,
|
|
3220
|
+
leftCollapsible,
|
|
3221
|
+
rightCollapsible
|
|
3222
|
+
} = useChatSidebar();
|
|
3223
|
+
if (side === "left") {
|
|
3224
|
+
if (!leftCollapsible) return null;
|
|
3225
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3226
|
+
Button,
|
|
3227
|
+
{
|
|
3228
|
+
variant: "ghost",
|
|
3229
|
+
onClick: () => setLeftCollapsed(!leftCollapsed),
|
|
3230
|
+
"aria-label": leftCollapsed ? "Expand left sidebar" : "Collapse left sidebar",
|
|
3231
|
+
className: cn("", className),
|
|
3232
|
+
children: leftCollapsed ? /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconLayoutSidebarLeftExpand, { className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconLayoutSidebarLeftCollapse, { className: "h-4 w-4" })
|
|
3233
|
+
}
|
|
3234
|
+
);
|
|
3235
|
+
}
|
|
3236
|
+
if (side === "right") {
|
|
3237
|
+
if (!rightCollapsible) return null;
|
|
3238
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3239
|
+
Button,
|
|
3240
|
+
{
|
|
3241
|
+
variant: "ghost",
|
|
3242
|
+
onClick: () => setRightCollapsed(!rightCollapsed),
|
|
3243
|
+
"aria-label": rightCollapsed ? "Expand right sidebar" : "Collapse right sidebar",
|
|
3244
|
+
className: cn("", className),
|
|
3245
|
+
children: rightCollapsed ? /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconLayoutSidebarRightExpand, { className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(ICONS.IconLayoutSidebarRightCollapse, { className: "h-4 w-4" })
|
|
3246
|
+
}
|
|
3247
|
+
);
|
|
3248
|
+
}
|
|
3249
|
+
return null;
|
|
2962
3250
|
}
|
|
2963
|
-
var PopoverContext =
|
|
3251
|
+
var PopoverContext = React12__namespace.createContext(
|
|
2964
3252
|
void 0
|
|
2965
3253
|
);
|
|
2966
3254
|
function usePopoverContext() {
|
|
2967
|
-
const context =
|
|
3255
|
+
const context = React12__namespace.useContext(PopoverContext);
|
|
2968
3256
|
if (!context) {
|
|
2969
3257
|
throw new Error("Popover components must be used within a Popover");
|
|
2970
3258
|
}
|
|
@@ -2976,10 +3264,10 @@ function Popover({
|
|
|
2976
3264
|
open: controlledOpen,
|
|
2977
3265
|
onOpenChange
|
|
2978
3266
|
}) {
|
|
2979
|
-
const [internalOpen, setInternalOpen] =
|
|
2980
|
-
const triggerRef =
|
|
3267
|
+
const [internalOpen, setInternalOpen] = React12__namespace.useState(defaultOpen);
|
|
3268
|
+
const triggerRef = React12__namespace.useRef(null);
|
|
2981
3269
|
const open = controlledOpen ?? internalOpen;
|
|
2982
|
-
const setOpen =
|
|
3270
|
+
const setOpen = React12__namespace.useCallback(
|
|
2983
3271
|
(newOpen) => {
|
|
2984
3272
|
if (controlledOpen === void 0) {
|
|
2985
3273
|
setInternalOpen(newOpen);
|
|
@@ -2988,7 +3276,7 @@ function Popover({
|
|
|
2988
3276
|
},
|
|
2989
3277
|
[controlledOpen, onOpenChange]
|
|
2990
3278
|
);
|
|
2991
|
-
const value =
|
|
3279
|
+
const value = React12__namespace.useMemo(
|
|
2992
3280
|
() => ({
|
|
2993
3281
|
open,
|
|
2994
3282
|
setOpen,
|
|
@@ -2998,15 +3286,15 @@ function Popover({
|
|
|
2998
3286
|
);
|
|
2999
3287
|
return /* @__PURE__ */ jsxRuntime.jsx(PopoverContext.Provider, { value, children });
|
|
3000
3288
|
}
|
|
3001
|
-
var PopoverTrigger =
|
|
3289
|
+
var PopoverTrigger = React12__namespace.forwardRef(
|
|
3002
3290
|
({ asChild, className, children, ...props }, ref) => {
|
|
3003
3291
|
const { setOpen, triggerRef } = usePopoverContext();
|
|
3004
3292
|
const handleClick = (e) => {
|
|
3005
3293
|
setOpen(true);
|
|
3006
3294
|
props.onClick?.(e);
|
|
3007
3295
|
};
|
|
3008
|
-
if (asChild &&
|
|
3009
|
-
return
|
|
3296
|
+
if (asChild && React12__namespace.isValidElement(children)) {
|
|
3297
|
+
return React12__namespace.cloneElement(children, {
|
|
3010
3298
|
ref: (node) => {
|
|
3011
3299
|
triggerRef.current = node;
|
|
3012
3300
|
if (typeof children.ref === "function") {
|
|
@@ -3038,7 +3326,7 @@ var PopoverTrigger = React10__namespace.forwardRef(
|
|
|
3038
3326
|
}
|
|
3039
3327
|
);
|
|
3040
3328
|
PopoverTrigger.displayName = "PopoverTrigger";
|
|
3041
|
-
var PopoverContent =
|
|
3329
|
+
var PopoverContent = React12__namespace.forwardRef(
|
|
3042
3330
|
({
|
|
3043
3331
|
className,
|
|
3044
3332
|
side = "bottom",
|
|
@@ -3049,9 +3337,9 @@ var PopoverContent = React10__namespace.forwardRef(
|
|
|
3049
3337
|
...props
|
|
3050
3338
|
}, ref) => {
|
|
3051
3339
|
const { open, setOpen, triggerRef } = usePopoverContext();
|
|
3052
|
-
const [position, setPosition] =
|
|
3053
|
-
const contentRef =
|
|
3054
|
-
|
|
3340
|
+
const [position, setPosition] = React12__namespace.useState({ top: 0, left: 0 });
|
|
3341
|
+
const contentRef = React12__namespace.useRef(null);
|
|
3342
|
+
React12__namespace.useEffect(() => {
|
|
3055
3343
|
if (!open || !triggerRef.current) return;
|
|
3056
3344
|
const updatePosition = () => {
|
|
3057
3345
|
if (!triggerRef.current || !contentRef.current) return;
|
|
@@ -3112,7 +3400,7 @@ var PopoverContent = React10__namespace.forwardRef(
|
|
|
3112
3400
|
window.removeEventListener("scroll", updatePosition, true);
|
|
3113
3401
|
};
|
|
3114
3402
|
}, [open, side, align, sideOffset, alignOffset, triggerRef]);
|
|
3115
|
-
|
|
3403
|
+
React12__namespace.useEffect(() => {
|
|
3116
3404
|
if (!open) return;
|
|
3117
3405
|
const handleClickOutside = (event) => {
|
|
3118
3406
|
if (contentRef.current && !contentRef.current.contains(event.target) && triggerRef.current && !triggerRef.current.contains(event.target)) {
|
|
@@ -3168,7 +3456,7 @@ var ThreadPopover = ({
|
|
|
3168
3456
|
emptyState,
|
|
3169
3457
|
onThreadSelect
|
|
3170
3458
|
}) => {
|
|
3171
|
-
const [isOpen, setIsOpen] =
|
|
3459
|
+
const [isOpen, setIsOpen] = React12__namespace.useState(false);
|
|
3172
3460
|
reactHotkeysHook.useHotkeys(
|
|
3173
3461
|
"h",
|
|
3174
3462
|
(e) => {
|
|
@@ -3223,7 +3511,7 @@ var CreateThreadButton = ({
|
|
|
3223
3511
|
onThreadCreated
|
|
3224
3512
|
}) => {
|
|
3225
3513
|
const { createThread } = useThreads();
|
|
3226
|
-
const [isCreating, setIsCreating] =
|
|
3514
|
+
const [isCreating, setIsCreating] = React12__namespace.useState(false);
|
|
3227
3515
|
const handleCreateThread = async () => {
|
|
3228
3516
|
if (isCreating) return;
|
|
3229
3517
|
try {
|
|
@@ -3349,10 +3637,10 @@ var AccountDialog = ({
|
|
|
3349
3637
|
size
|
|
3350
3638
|
}) => {
|
|
3351
3639
|
const { isLoading, isAuthenticated, user, login, logout } = useAuth();
|
|
3352
|
-
const [open, setOpen] =
|
|
3353
|
-
const [accountInfoOpen, setAccountInfoOpen] =
|
|
3354
|
-
const [error, setError] =
|
|
3355
|
-
const initials =
|
|
3640
|
+
const [open, setOpen] = React12__namespace.useState(false);
|
|
3641
|
+
const [accountInfoOpen, setAccountInfoOpen] = React12__namespace.useState(false);
|
|
3642
|
+
const [error, setError] = React12__namespace.useState(null);
|
|
3643
|
+
const initials = React12__namespace.useMemo(() => {
|
|
3356
3644
|
const name = user?.displayName || user?.name;
|
|
3357
3645
|
if (!name) return "";
|
|
3358
3646
|
return name.split(" ").map((n) => n[0]).join("").toUpperCase().slice(0, 2);
|
|
@@ -3528,14 +3816,37 @@ function ThemeToggle() {
|
|
|
3528
3816
|
exports.AccountDialog = AccountDialog;
|
|
3529
3817
|
exports.AuthContext = AuthContext;
|
|
3530
3818
|
exports.AuthProvider = AuthProvider;
|
|
3819
|
+
exports.Badge = Badge2;
|
|
3820
|
+
exports.Box = Box;
|
|
3821
|
+
exports.Button = Button2;
|
|
3822
|
+
exports.Card = Card2;
|
|
3823
|
+
exports.Chart = Chart;
|
|
3531
3824
|
exports.ChatFull = ChatFull;
|
|
3532
3825
|
exports.ChatHeader = ChatHeader;
|
|
3533
3826
|
exports.ChatPopup = ChatPopup;
|
|
3534
3827
|
exports.ChatSidebar = ChatSidebar;
|
|
3828
|
+
exports.ChatSidebarContext = ChatSidebarContext;
|
|
3829
|
+
exports.Checkbox = Checkbox;
|
|
3830
|
+
exports.Col = Col;
|
|
3535
3831
|
exports.Composer = Composer;
|
|
3536
3832
|
exports.CreateThreadButton = CreateThreadButton;
|
|
3833
|
+
exports.Divider = Divider;
|
|
3834
|
+
exports.Form = Form;
|
|
3835
|
+
exports.Heading = Heading;
|
|
3836
|
+
exports.Image = Image;
|
|
3837
|
+
exports.Input = Input2;
|
|
3838
|
+
exports.Label = Label2;
|
|
3839
|
+
exports.List = List;
|
|
3840
|
+
exports.ListItem = ListItem;
|
|
3537
3841
|
exports.MelonyClientProvider = MelonyClientProvider;
|
|
3538
3842
|
exports.MelonyContext = MelonyContext;
|
|
3843
|
+
exports.RadioGroup = RadioGroup;
|
|
3844
|
+
exports.Row = Row;
|
|
3845
|
+
exports.Select = Select2;
|
|
3846
|
+
exports.SidebarToggle = SidebarToggle;
|
|
3847
|
+
exports.Spacer = Spacer;
|
|
3848
|
+
exports.Text = Text;
|
|
3849
|
+
exports.Textarea = Textarea2;
|
|
3539
3850
|
exports.ThemeProvider = ThemeProvider;
|
|
3540
3851
|
exports.ThemeToggle = ThemeToggle;
|
|
3541
3852
|
exports.Thread = Thread;
|
|
@@ -3544,9 +3855,12 @@ exports.ThreadList = ThreadList;
|
|
|
3544
3855
|
exports.ThreadPopover = ThreadPopover;
|
|
3545
3856
|
exports.ThreadProvider = ThreadProvider;
|
|
3546
3857
|
exports.UIRenderer = UIRenderer;
|
|
3858
|
+
exports.WelcomeScreen = WelcomeScreen;
|
|
3547
3859
|
exports.groupEventsToMessages = groupEventsToMessages;
|
|
3548
3860
|
exports.useAuth = useAuth;
|
|
3861
|
+
exports.useChatSidebar = useChatSidebar;
|
|
3549
3862
|
exports.useMelony = useMelony;
|
|
3863
|
+
exports.useScreenSize = useScreenSize;
|
|
3550
3864
|
exports.useTheme = useTheme;
|
|
3551
3865
|
exports.useThreads = useThreads;
|
|
3552
3866
|
//# sourceMappingURL=index.cjs.map
|