@flexkit/studio 0.0.31 → 0.0.32
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 +2 -2
- package/dist/asset-ZVPFS73O.js +2 -0
- package/dist/{asset-TS7J5GA5.js.map → asset-ZVPFS73O.js.map} +1 -1
- package/dist/astro.d.ts +5 -3
- package/dist/astro.js +8 -3
- package/dist/chunk-5FHCSAK2.js +2 -0
- package/dist/chunk-5FHCSAK2.js.map +1 -0
- package/dist/{chunk-R7N3MDOP.js → chunk-AEBTHXEP.js} +2 -2
- package/dist/{chunk-R7N3MDOP.js.map → chunk-AEBTHXEP.js.map} +1 -1
- package/dist/{chunk-W3TUEJJL.js → chunk-CCI3FGPF.js} +2 -2
- package/dist/{chunk-W3TUEJJL.js.map → chunk-CCI3FGPF.js.map} +1 -1
- package/dist/chunk-D62TAYLI.js +2 -0
- package/dist/chunk-D62TAYLI.js.map +1 -0
- package/dist/{chunk-UKLE7J3K.js → chunk-E7G46743.js} +139 -16
- package/dist/chunk-F2ILIHAU.js +2 -0
- package/dist/chunk-F2ILIHAU.js.map +1 -0
- package/dist/{chunk-EOCJR5EY.js → chunk-FPH4YETF.js} +2 -2
- package/dist/{chunk-EOCJR5EY.js.map → chunk-FPH4YETF.js.map} +1 -1
- package/dist/chunk-GFDWGYUR.js +2 -0
- package/dist/chunk-GFDWGYUR.js.map +1 -0
- package/dist/{chunk-CPUC4QXH.js → chunk-JAARDXQZ.js} +2 -2
- package/dist/{chunk-CPUC4QXH.js.map → chunk-JAARDXQZ.js.map} +1 -1
- package/dist/{chunk-IXO2LU47.js → chunk-JCHD4EGB.js} +2 -2
- package/dist/{chunk-IXO2LU47.js.map → chunk-JCHD4EGB.js.map} +1 -1
- package/dist/chunk-KHPTVIYT.js +2 -0
- package/dist/chunk-KHPTVIYT.js.map +1 -0
- package/dist/{chunk-DWK4NNLB.js → chunk-LKBCPAXQ.js} +2 -2
- package/dist/{chunk-DWK4NNLB.js.map → chunk-LKBCPAXQ.js.map} +1 -1
- package/dist/chunk-MGXHZDFZ.js +2 -0
- package/dist/chunk-MGXHZDFZ.js.map +1 -0
- package/dist/chunk-N2T6MKPV.js +2 -0
- package/dist/chunk-N2T6MKPV.js.map +1 -0
- package/dist/chunk-PXB5QSHN.js +2 -0
- package/dist/chunk-PXB5QSHN.js.map +1 -0
- package/dist/chunk-QSROLDUU.js +2 -0
- package/dist/chunk-QSROLDUU.js.map +1 -0
- package/dist/chunk-VHNQDP7Q.js +616 -0
- package/dist/chunk-VUAFNQK7.js +2 -0
- package/dist/chunk-VUAFNQK7.js.map +1 -0
- package/dist/chunk-XFY7MZJN.js +2 -0
- package/dist/chunk-XFY7MZJN.js.map +1 -0
- package/dist/{core-handler-XAVVKLhV.d.ts → core-handler-C3xC98bN.d.ts} +3 -0
- package/dist/datetime-DDEWTNLB.js +2 -0
- package/dist/{datetime-NQTYGZIC.js.map → datetime-DDEWTNLB.js.map} +1 -1
- package/dist/editor-HAYTKNMY.js +2 -0
- package/dist/{editor-YIRZQR3D.js.map → editor-HAYTKNMY.js.map} +1 -1
- package/dist/index.css +151 -38
- package/dist/index.d.ts +22 -21
- package/dist/index.js +157 -210
- package/dist/index.js.map +1 -1
- package/dist/logo-B6ZKLGM7.js +3 -0
- package/dist/logo-B6ZKLGM7.js.map +1 -0
- package/dist/nextjs.d.ts +40 -12
- package/dist/nextjs.js +8 -3
- package/dist/search-X5V3YOTZ.js +2 -0
- package/dist/search-X5V3YOTZ.js.map +1 -0
- package/dist/select-H3JHOCWR.js +2 -0
- package/dist/{select-A6I27JQU.js.map → select-H3JHOCWR.js.map} +1 -1
- package/dist/switch-TACKLQJH.js +2 -0
- package/dist/{switch-AFZGXSR3.js.map → switch-TACKLQJH.js.map} +1 -1
- package/dist/tanstack-start.d.ts +6 -4
- package/dist/tanstack-start.js +17 -12
- package/dist/text-M3DRK7LU.js +2 -0
- package/dist/{text-2RL2L5FT.js.map → text-M3DRK7LU.js.map} +1 -1
- package/dist/text-SQXG7XJT.js +2 -0
- package/dist/{text-6F4QTCNT.js.map → text-SQXG7XJT.js.map} +1 -1
- package/dist/textarea-YF4K2VBM.js +2 -0
- package/dist/{textarea-2A4TLWZS.js.map → textarea-YF4K2VBM.js.map} +1 -1
- package/dist/tools.d.ts +78 -0
- package/dist/tools.js +60 -0
- package/dist/types-U28Ppixq.d.ts +56 -0
- package/dist/{types.d-CX3kDxFZ.d.ts → types.d-710RgZFw.d.ts} +85 -7
- package/dist/ui.d.ts +21 -5
- package/dist/ui.js +5 -5
- package/dist/ui.js.map +1 -1
- package/dist/{user-nav-4JKIFZLB.js → user-nav-XVY7JTX6.js} +2 -2
- package/dist/{user-nav-4JKIFZLB.js.map → user-nav-XVY7JTX6.js.map} +1 -1
- package/package.json +8 -4
- package/dist/asset-TS7J5GA5.js +0 -2
- package/dist/chunk-73RMWG53.js +0 -2
- package/dist/chunk-73RMWG53.js.map +0 -1
- package/dist/chunk-HAQICAOQ.js +0 -2
- package/dist/chunk-HAQICAOQ.js.map +0 -1
- package/dist/chunk-LL2Z4TD3.js +0 -2
- package/dist/chunk-LL2Z4TD3.js.map +0 -1
- package/dist/chunk-MC6VZLKC.js +0 -2
- package/dist/chunk-MC6VZLKC.js.map +0 -1
- package/dist/chunk-N52AF6GE.js +0 -2
- package/dist/chunk-N52AF6GE.js.map +0 -1
- package/dist/chunk-V6R4AWQS.js +0 -2
- package/dist/chunk-V6R4AWQS.js.map +0 -1
- package/dist/chunk-WXMCINGZ.js +0 -2
- package/dist/chunk-WXMCINGZ.js.map +0 -1
- package/dist/chunk-WZ533Y4O.js +0 -2
- package/dist/chunk-WZ533Y4O.js.map +0 -1
- package/dist/chunk-YA4ACPM5.js +0 -2
- package/dist/chunk-YA4ACPM5.js.map +0 -1
- package/dist/chunk-ZEZ6TRCO.js +0 -2
- package/dist/chunk-ZEZ6TRCO.js.map +0 -1
- package/dist/datetime-NQTYGZIC.js +0 -2
- package/dist/editor-YIRZQR3D.js +0 -2
- package/dist/logo-GCKKZP62.js +0 -3
- package/dist/logo-GCKKZP62.js.map +0 -1
- package/dist/search-UFFZBRQV.js +0 -2
- package/dist/search-UFFZBRQV.js.map +0 -1
- package/dist/select-A6I27JQU.js +0 -2
- package/dist/switch-AFZGXSR3.js +0 -2
- package/dist/text-2RL2L5FT.js +0 -2
- package/dist/text-6F4QTCNT.js +0 -2
- package/dist/textarea-2A4TLWZS.js +0 -2
|
@@ -3,6 +3,23 @@ import { z } from 'zod';
|
|
|
3
3
|
import { OperationVariables } from '@apollo/client';
|
|
4
4
|
import { Control, UseFormSetValue, FieldValues } from 'react-hook-form';
|
|
5
5
|
|
|
6
|
+
type User = {
|
|
7
|
+
id: string;
|
|
8
|
+
email: string;
|
|
9
|
+
display_name: string;
|
|
10
|
+
avatar_url: string;
|
|
11
|
+
role: string;
|
|
12
|
+
/** Space codes the user belongs to (owners receive every project space). */
|
|
13
|
+
spaces: string[];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type Auth = {
|
|
17
|
+
user: User | undefined;
|
|
18
|
+
logout: (projectId: string) => Promise<void>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type AuthService = [boolean, Auth];
|
|
22
|
+
|
|
6
23
|
type AttributeValue = {
|
|
7
24
|
_id: string;
|
|
8
25
|
[key: string]: string | AttributeValue | AttributeValue[] | null;
|
|
@@ -44,7 +61,7 @@ type UseEntityQueryParams = {
|
|
|
44
61
|
variables?: OperationVariables;
|
|
45
62
|
isForm?: boolean;
|
|
46
63
|
/**
|
|
47
|
-
* `list` only selects each related entity's
|
|
64
|
+
* `list` only selects each related entity's display attribute (desk/list grids).
|
|
48
65
|
* `full` keeps nested relationship fields (forms, relationship pickers). Default: `full`.
|
|
49
66
|
*/
|
|
50
67
|
selection?: EntityQuerySelection;
|
|
@@ -168,14 +185,47 @@ type AttributeOptions = {
|
|
|
168
185
|
switch: CommonOptions;
|
|
169
186
|
[key: string]: CommonOptions;
|
|
170
187
|
};
|
|
188
|
+
/**
|
|
189
|
+
* Context passed to `hidden` and `readOnly` callbacks. `record` is the current
|
|
190
|
+
* form values unwrapped from `FormFieldValue` wrappers (use `record.status`,
|
|
191
|
+
* not `record.status.value`).
|
|
192
|
+
*/
|
|
193
|
+
type ConditionalFieldContext = {
|
|
194
|
+
record: {
|
|
195
|
+
[attributeName: string]: unknown;
|
|
196
|
+
};
|
|
197
|
+
value: unknown;
|
|
198
|
+
currentUser: User | undefined;
|
|
199
|
+
};
|
|
200
|
+
type ConditionalFlag = boolean | ((context: ConditionalFieldContext) => boolean);
|
|
171
201
|
type AttributeBase = {
|
|
172
202
|
inputType: InputType;
|
|
173
203
|
previewType?: PreviewType;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
204
|
+
/**
|
|
205
|
+
* Hide the field in the form. A static `true` also hides the list column.
|
|
206
|
+
* Callbacks are form-only and re-evaluate as `record` / `currentUser` change.
|
|
207
|
+
* Distinct from `entity.menu.hidden`.
|
|
208
|
+
*/
|
|
209
|
+
hidden?: ConditionalFlag;
|
|
210
|
+
/**
|
|
211
|
+
* Make the field read-only in the form. Callbacks re-evaluate as `record` /
|
|
212
|
+
* `currentUser` change. Currently-read-only attributes are omitted from
|
|
213
|
+
* create/update mutations and skipped during form validation.
|
|
214
|
+
*/
|
|
215
|
+
readOnly?: ConditionalFlag;
|
|
216
|
+
/**
|
|
217
|
+
* Marks uniqueness intent. Enforced at deploy for global non-asset attributes.
|
|
218
|
+
*/
|
|
219
|
+
unique?: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Include this attribute in search indexing and the global search UI.
|
|
222
|
+
*/
|
|
223
|
+
searchable?: boolean;
|
|
224
|
+
/**
|
|
225
|
+
* Field group name(s) this attribute belongs to. Distinct from
|
|
226
|
+
* `entity.menu.group`, which is the sidebar section.
|
|
227
|
+
*/
|
|
228
|
+
group?: string | string[];
|
|
179
229
|
label: string;
|
|
180
230
|
name: string;
|
|
181
231
|
options?: AttributeOptions[InputType];
|
|
@@ -211,9 +261,31 @@ type AttributeByDataType<T extends DataType> = AttributeBase & {
|
|
|
211
261
|
type Attribute = {
|
|
212
262
|
[T in DataType]: AttributeByDataType<T>;
|
|
213
263
|
}[DataType];
|
|
264
|
+
/**
|
|
265
|
+
* Form-only tab that groups attributes in the edit/add drawer.
|
|
266
|
+
* Distinct from `entity.menu.group` (sidebar section).
|
|
267
|
+
*/
|
|
268
|
+
type FieldGroup = {
|
|
269
|
+
name: string;
|
|
270
|
+
/**
|
|
271
|
+
* Tab label. Required for custom groups. Optional for the reserved
|
|
272
|
+
* `all` tab; Studio uses `All fields` when it is omitted.
|
|
273
|
+
*/
|
|
274
|
+
title?: string;
|
|
275
|
+
icon?: JSX.Element;
|
|
276
|
+
default?: boolean;
|
|
277
|
+
hidden?: ConditionalFlag;
|
|
278
|
+
};
|
|
214
279
|
type Entity = {
|
|
215
280
|
name: string;
|
|
216
281
|
plural: string;
|
|
282
|
+
/**
|
|
283
|
+
* Attribute name used as the human-readable label in relationship previews,
|
|
284
|
+
* search hits, and edit-drawer titles. Must match an attribute `name`.
|
|
285
|
+
* Falls back to the first attribute when omitted. The effective display
|
|
286
|
+
* attribute cannot be space-bound.
|
|
287
|
+
*/
|
|
288
|
+
display?: string;
|
|
217
289
|
menu?: {
|
|
218
290
|
hidden: true;
|
|
219
291
|
label?: string;
|
|
@@ -227,6 +299,11 @@ type Entity = {
|
|
|
227
299
|
* access; users outside all listed spaces cannot see the entity at all.
|
|
228
300
|
*/
|
|
229
301
|
spaces?: string[];
|
|
302
|
+
/**
|
|
303
|
+
* Form field groups rendered as tabs. Does not change storage.
|
|
304
|
+
* Distinct from `menu.group` (sidebar section).
|
|
305
|
+
*/
|
|
306
|
+
groups?: FieldGroup[];
|
|
230
307
|
attributes: Attribute[];
|
|
231
308
|
};
|
|
232
309
|
type Schema = Entity[];
|
|
@@ -270,6 +347,7 @@ type FormFieldParams<T extends keyof AttributeOptions> = {
|
|
|
270
347
|
options: AttributeOptions[T];
|
|
271
348
|
};
|
|
272
349
|
getValues: (_payload?: string | string[]) => FormFieldValue | undefined;
|
|
350
|
+
readOnly: boolean;
|
|
273
351
|
relationshipEntityName?: string;
|
|
274
352
|
schema: Schema;
|
|
275
353
|
scope: string;
|
|
@@ -370,4 +448,4 @@ type SingleProject = Omit<ProjectOptions, 'basePath'> & {
|
|
|
370
448
|
|
|
371
449
|
type Config = SingleProject | ProjectOptions[];
|
|
372
450
|
|
|
373
|
-
export type { AppContextType as A, Config as C, DataType as D, Entity as E,
|
|
451
|
+
export type { AppContextType as A, Config as C, DataType as D, Entity as E, FieldGroup as F, ImageValue as I, LogoProps as L, MappedEntityItem as M, OrderedAssetValue as O, PluginOptions as P, SearchRequestProps as S, UseEntityQueryParams as U, ActionSetRelationship as a, ActionSetScope as b, AppOptions as c, ProjectOptions as d, SearchResultItem as e, Attribute as f, AuthService as g, FormEntityItem as h, Schema as i, User as j, AttributeValue as k, MultipleRelationshipConnection as l, SingleRelationshipConnection as m, ConditionalFieldContext as n, ConditionalFlag as o, DefaultValue as p, DefaultValueByDataType as q, EntityData as r, FormFieldParams as s, FormFieldProps as t, FormFieldValue as u, ScopeType as v, SingleProject as w };
|
package/dist/ui.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
|
|
|
9
9
|
import { Command as Command$1 } from 'cmdk';
|
|
10
10
|
import * as ResizablePrimitive from 'react-resizable-panels';
|
|
11
11
|
export { PanelImperativeHandle } from 'react-resizable-panels';
|
|
12
|
-
import {
|
|
12
|
+
import { w as SingleProject } from './types.d-710RgZFw.js';
|
|
13
13
|
import { ToasterProps } from 'sonner';
|
|
14
14
|
export { toast } from 'sonner';
|
|
15
15
|
import { FileUIPart, SourceDocumentUIPart, UIMessage, ChatStatus, ToolUIPart, DynamicToolUIPart } from 'ai';
|
|
@@ -237,10 +237,10 @@ declare function TableCaption({ className, ...props }: React$1.ComponentProps<'c
|
|
|
237
237
|
|
|
238
238
|
declare function Tabs({ className, orientation, ...props }: React$1.ComponentProps<typeof Tabs$1.Root>): react_jsx_runtime.JSX.Element;
|
|
239
239
|
declare const tabsListVariants: (props?: ({
|
|
240
|
-
variant?: "
|
|
240
|
+
variant?: "default" | "line" | null | undefined;
|
|
241
241
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
242
242
|
declare function TabsList({ className, variant, ...props }: React$1.ComponentProps<typeof Tabs$1.List> & VariantProps<typeof tabsListVariants>): react_jsx_runtime.JSX.Element;
|
|
243
|
-
declare function TabsTrigger({ className, ...props }: React$1.ComponentProps<typeof Tabs$1.Trigger>): react_jsx_runtime.JSX.Element;
|
|
243
|
+
declare function TabsTrigger({ className, type, ...props }: React$1.ComponentProps<typeof Tabs$1.Trigger>): react_jsx_runtime.JSX.Element;
|
|
244
244
|
declare function TabsContent({ className, ...props }: React$1.ComponentProps<typeof Tabs$1.Content>): react_jsx_runtime.JSX.Element;
|
|
245
245
|
|
|
246
246
|
declare function Textarea({ className, ...props }: React$1.ComponentProps<'textarea'>): react_jsx_runtime.JSX.Element;
|
|
@@ -271,12 +271,17 @@ type Props = {
|
|
|
271
271
|
beforeClose?: () => boolean;
|
|
272
272
|
children: ReactNode;
|
|
273
273
|
depth: number;
|
|
274
|
+
/**
|
|
275
|
+
* Close the drawer without running `beforeClose` (used after confirming discard).
|
|
276
|
+
* Lets Vaul release its body lock instead of hard-unmounting an open drawer.
|
|
277
|
+
*/
|
|
278
|
+
forceClose?: boolean;
|
|
274
279
|
isFocused: boolean;
|
|
275
280
|
onFormChange?: Dispatch<SetStateAction<boolean>>;
|
|
276
281
|
onClose: () => void;
|
|
277
282
|
title: string;
|
|
278
283
|
};
|
|
279
|
-
declare function DrawerModal({ actions, beforeClose, children, depth, isFocused, onFormChange: _onFormChange, onClose, title, }: Props): JSX.Element;
|
|
284
|
+
declare function DrawerModal({ actions, beforeClose, children, depth, forceClose, isFocused, onFormChange: _onFormChange, onClose, title, }: Props): JSX.Element;
|
|
280
285
|
|
|
281
286
|
declare const Toaster: ({ richColors, style, ...props }: ToasterProps) => react_jsx_runtime.JSX.Element;
|
|
282
287
|
|
|
@@ -674,6 +679,17 @@ declare const SourcesContent: ({ className, ...props }: SourcesContentProps) =>
|
|
|
674
679
|
type SourceProps = ComponentProps<'a'>;
|
|
675
680
|
declare const Source: ({ href, title, children, ...props }: SourceProps) => react_jsx_runtime.JSX.Element;
|
|
676
681
|
|
|
682
|
+
type SpeechInputProps = Omit<ComponentProps<typeof Button>, 'onError'> & {
|
|
683
|
+
onTranscriptionChange?: (text: string) => void;
|
|
684
|
+
/**
|
|
685
|
+
* Required. Receives the recorded audio blob and an abort signal that is
|
|
686
|
+
* cancelled if the user stops processing. Return the transcribed text.
|
|
687
|
+
*/
|
|
688
|
+
onAudioRecorded?: (audioBlob: Blob, signal: AbortSignal) => Promise<string>;
|
|
689
|
+
onError?: (error: Error) => void;
|
|
690
|
+
};
|
|
691
|
+
declare const SpeechInput: ({ className, disabled, onAudioRecorded, onError, onTranscriptionChange, size, variant, ...props }: SpeechInputProps) => react_jsx_runtime.JSX.Element;
|
|
692
|
+
|
|
677
693
|
type SuggestionsProps = ComponentProps<typeof ScrollArea>;
|
|
678
694
|
declare const Suggestions: ({ className, children, ...props }: SuggestionsProps) => react_jsx_runtime.JSX.Element;
|
|
679
695
|
type SuggestionProps = Omit<ComponentProps<typeof Button>, 'onClick'> & {
|
|
@@ -711,4 +727,4 @@ type ToolOutputProps = ComponentProps<'div'> & {
|
|
|
711
727
|
};
|
|
712
728
|
declare const ToolOutput: ({ className, output, errorText, ...props }: ToolOutputProps) => react_jsx_runtime.JSX.Element | null;
|
|
713
729
|
|
|
714
|
-
export { Attachment, type AttachmentData, AttachmentEmpty, type AttachmentEmptyProps, AttachmentHoverCard, AttachmentHoverCardContent, type AttachmentHoverCardContentProps, type AttachmentHoverCardProps, AttachmentHoverCardTrigger, type AttachmentHoverCardTriggerProps, AttachmentInfo, type AttachmentInfoProps, type AttachmentMediaCategory, AttachmentPreview, type AttachmentPreviewProps, type AttachmentProps, AttachmentRemove, type AttachmentRemoveProps, type AttachmentVariant, Attachments, type AttachmentsContext, type AttachmentsProps, Avatar, AvatarFallback, AvatarImage, Badge, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Checkbox, CodeBlock, CodeBlockActions, CodeBlockContainer, CodeBlockContent, CodeBlockCopyButton, type CodeBlockCopyButtonProps, CodeBlockFilename, CodeBlockHeader, CodeBlockLanguageSelector, CodeBlockLanguageSelectorContent, type CodeBlockLanguageSelectorContentProps, CodeBlockLanguageSelectorItem, type CodeBlockLanguageSelectorItemProps, type CodeBlockLanguageSelectorProps, CodeBlockLanguageSelectorTrigger, type CodeBlockLanguageSelectorTriggerProps, CodeBlockLanguageSelectorValue, type CodeBlockLanguageSelectorValueProps, CodeBlockTitle, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Conversation, ConversationContent, type ConversationContentProps, ConversationDownload, type ConversationDownloadProps, ConversationEmptyState, type ConversationEmptyStateProps, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DrawerModal, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ExternalLink, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InsufficientPermissionsTooltipContent, Label, LocalReferencedSourcesContext, Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageBranch, MessageBranchContent, type MessageBranchContentProps, MessageBranchNext, type MessageBranchNextProps, MessageBranchPage, type MessageBranchPageProps, MessageBranchPrevious, type MessageBranchPreviousProps, type MessageBranchProps, MessageBranchSelector, type MessageBranchSelectorProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageToolbar, type MessageToolbarProps, ModelSelector, ModelSelectorContent, type ModelSelectorContentProps, ModelSelectorDialog, type ModelSelectorDialogProps, ModelSelectorEmpty, type ModelSelectorEmptyProps, ModelSelectorGroup, type ModelSelectorGroupProps, ModelSelectorInput, type ModelSelectorInputProps, ModelSelectorItem, type ModelSelectorItemProps, ModelSelectorList, type ModelSelectorListProps, ModelSelectorLogo, ModelSelectorLogoGroup, type ModelSelectorLogoGroupProps, type ModelSelectorLogoProps, ModelSelectorName, type ModelSelectorNameProps, type ModelSelectorProps, ModelSelectorSeparator, type ModelSelectorSeparatorProps, ModelSelectorShortcut, type ModelSelectorShortcutProps, ModelSelectorTrigger, type ModelSelectorTriggerProps, PermissionTooltip, PromptInput, PromptInputActionAddAttachments, type PromptInputActionAddAttachmentsProps, PromptInputActionAddScreenshot, type PromptInputActionAddScreenshotProps, PromptInputActionMenu, PromptInputActionMenuContent, type PromptInputActionMenuContentProps, PromptInputActionMenuItem, type PromptInputActionMenuItemProps, type PromptInputActionMenuProps, PromptInputActionMenuTrigger, type PromptInputActionMenuTriggerProps, PromptInputBody, type PromptInputBodyProps, PromptInputButton, type PromptInputButtonProps, type PromptInputButtonTooltip, PromptInputCommand, PromptInputCommandEmpty, type PromptInputCommandEmptyProps, PromptInputCommandGroup, type PromptInputCommandGroupProps, PromptInputCommandInput, type PromptInputCommandInputProps, PromptInputCommandItem, type PromptInputCommandItemProps, PromptInputCommandList, type PromptInputCommandListProps, type PromptInputCommandProps, PromptInputCommandSeparator, type PromptInputCommandSeparatorProps, type PromptInputControllerProps, PromptInputFooter, type PromptInputFooterProps, PromptInputHeader, type PromptInputHeaderProps, PromptInputHoverCard, PromptInputHoverCardContent, type PromptInputHoverCardContentProps, type PromptInputHoverCardProps, PromptInputHoverCardTrigger, type PromptInputHoverCardTriggerProps, type PromptInputMessage, type PromptInputProps, PromptInputProvider, type PromptInputProviderProps, PromptInputSelect, PromptInputSelectContent, type PromptInputSelectContentProps, PromptInputSelectItem, type PromptInputSelectItemProps, type PromptInputSelectProps, PromptInputSelectTrigger, type PromptInputSelectTriggerProps, PromptInputSelectValue, type PromptInputSelectValueProps, PromptInputSubmit, type PromptInputSubmitProps, PromptInputTab, PromptInputTabBody, type PromptInputTabBodyProps, PromptInputTabItem, type PromptInputTabItemProps, PromptInputTabLabel, type PromptInputTabLabelProps, type PromptInputTabProps, PromptInputTabsList, type PromptInputTabsListProps, PromptInputTextarea, type PromptInputTextareaProps, PromptInputTools, type PromptInputToolsProps, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, type ReferencedSourcesContext, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Shimmer, Sidebar$1 as Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarInset, SidebarMenu, SidebarMenuButton, SidebarMenuItem, Sidebar as SidebarPanel, SidebarProvider, SidebarRail, SidebarTrigger, Skeleton, Source, type SourceProps, Sources, SourcesContent, type SourcesContentProps, type SourcesProps, SourcesTrigger, type SourcesTriggerProps, Spinner, Suggestion, type SuggestionProps, Suggestions, type SuggestionsProps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TextInputContext, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tool, ToolContent, type ToolContentProps, ToolHeader, type ToolHeaderProps, ToolInput, type ToolInputProps, ToolOutput, type ToolOutputProps, type ToolPart, type ToolProps, Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, badgeVariants, buttonGroupVariants, buttonVariants, getAttachmentLabel, getMediaCategory, getStatusBadge, highlightCode, messagesToMarkdown, toggleVariants, useAttachmentContext, useAttachmentsContext, useFormField, usePromptInputAttachments, usePromptInputController, usePromptInputReferencedSources, useProviderAttachments, useReasoning, useSidebar };
|
|
730
|
+
export { Attachment, type AttachmentData, AttachmentEmpty, type AttachmentEmptyProps, AttachmentHoverCard, AttachmentHoverCardContent, type AttachmentHoverCardContentProps, type AttachmentHoverCardProps, AttachmentHoverCardTrigger, type AttachmentHoverCardTriggerProps, AttachmentInfo, type AttachmentInfoProps, type AttachmentMediaCategory, AttachmentPreview, type AttachmentPreviewProps, type AttachmentProps, AttachmentRemove, type AttachmentRemoveProps, type AttachmentVariant, Attachments, type AttachmentsContext, type AttachmentsProps, Avatar, AvatarFallback, AvatarImage, Badge, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Checkbox, CodeBlock, CodeBlockActions, CodeBlockContainer, CodeBlockContent, CodeBlockCopyButton, type CodeBlockCopyButtonProps, CodeBlockFilename, CodeBlockHeader, CodeBlockLanguageSelector, CodeBlockLanguageSelectorContent, type CodeBlockLanguageSelectorContentProps, CodeBlockLanguageSelectorItem, type CodeBlockLanguageSelectorItemProps, type CodeBlockLanguageSelectorProps, CodeBlockLanguageSelectorTrigger, type CodeBlockLanguageSelectorTriggerProps, CodeBlockLanguageSelectorValue, type CodeBlockLanguageSelectorValueProps, CodeBlockTitle, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Conversation, ConversationContent, type ConversationContentProps, ConversationDownload, type ConversationDownloadProps, ConversationEmptyState, type ConversationEmptyStateProps, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DrawerModal, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ExternalLink, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InsufficientPermissionsTooltipContent, Label, LocalReferencedSourcesContext, Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageBranch, MessageBranchContent, type MessageBranchContentProps, MessageBranchNext, type MessageBranchNextProps, MessageBranchPage, type MessageBranchPageProps, MessageBranchPrevious, type MessageBranchPreviousProps, type MessageBranchProps, MessageBranchSelector, type MessageBranchSelectorProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageToolbar, type MessageToolbarProps, ModelSelector, ModelSelectorContent, type ModelSelectorContentProps, ModelSelectorDialog, type ModelSelectorDialogProps, ModelSelectorEmpty, type ModelSelectorEmptyProps, ModelSelectorGroup, type ModelSelectorGroupProps, ModelSelectorInput, type ModelSelectorInputProps, ModelSelectorItem, type ModelSelectorItemProps, ModelSelectorList, type ModelSelectorListProps, ModelSelectorLogo, ModelSelectorLogoGroup, type ModelSelectorLogoGroupProps, type ModelSelectorLogoProps, ModelSelectorName, type ModelSelectorNameProps, type ModelSelectorProps, ModelSelectorSeparator, type ModelSelectorSeparatorProps, ModelSelectorShortcut, type ModelSelectorShortcutProps, ModelSelectorTrigger, type ModelSelectorTriggerProps, PermissionTooltip, PromptInput, PromptInputActionAddAttachments, type PromptInputActionAddAttachmentsProps, PromptInputActionAddScreenshot, type PromptInputActionAddScreenshotProps, PromptInputActionMenu, PromptInputActionMenuContent, type PromptInputActionMenuContentProps, PromptInputActionMenuItem, type PromptInputActionMenuItemProps, type PromptInputActionMenuProps, PromptInputActionMenuTrigger, type PromptInputActionMenuTriggerProps, PromptInputBody, type PromptInputBodyProps, PromptInputButton, type PromptInputButtonProps, type PromptInputButtonTooltip, PromptInputCommand, PromptInputCommandEmpty, type PromptInputCommandEmptyProps, PromptInputCommandGroup, type PromptInputCommandGroupProps, PromptInputCommandInput, type PromptInputCommandInputProps, PromptInputCommandItem, type PromptInputCommandItemProps, PromptInputCommandList, type PromptInputCommandListProps, type PromptInputCommandProps, PromptInputCommandSeparator, type PromptInputCommandSeparatorProps, type PromptInputControllerProps, PromptInputFooter, type PromptInputFooterProps, PromptInputHeader, type PromptInputHeaderProps, PromptInputHoverCard, PromptInputHoverCardContent, type PromptInputHoverCardContentProps, type PromptInputHoverCardProps, PromptInputHoverCardTrigger, type PromptInputHoverCardTriggerProps, type PromptInputMessage, type PromptInputProps, PromptInputProvider, type PromptInputProviderProps, PromptInputSelect, PromptInputSelectContent, type PromptInputSelectContentProps, PromptInputSelectItem, type PromptInputSelectItemProps, type PromptInputSelectProps, PromptInputSelectTrigger, type PromptInputSelectTriggerProps, PromptInputSelectValue, type PromptInputSelectValueProps, PromptInputSubmit, type PromptInputSubmitProps, PromptInputTab, PromptInputTabBody, type PromptInputTabBodyProps, PromptInputTabItem, type PromptInputTabItemProps, PromptInputTabLabel, type PromptInputTabLabelProps, type PromptInputTabProps, PromptInputTabsList, type PromptInputTabsListProps, PromptInputTextarea, type PromptInputTextareaProps, PromptInputTools, type PromptInputToolsProps, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, type ReferencedSourcesContext, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Shimmer, Sidebar$1 as Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarInset, SidebarMenu, SidebarMenuButton, SidebarMenuItem, Sidebar as SidebarPanel, SidebarProvider, SidebarRail, SidebarTrigger, Skeleton, Source, type SourceProps, Sources, SourcesContent, type SourcesContentProps, type SourcesProps, SourcesTrigger, type SourcesTriggerProps, SpeechInput, type SpeechInputProps, Spinner, Suggestion, type SuggestionProps, Suggestions, type SuggestionsProps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TextInputContext, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tool, ToolContent, type ToolContentProps, ToolHeader, type ToolHeaderProps, ToolInput, type ToolInputProps, ToolOutput, type ToolOutputProps, type ToolPart, type ToolProps, Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, badgeVariants, buttonGroupVariants, buttonVariants, getAttachmentLabel, getMediaCategory, getStatusBadge, highlightCode, messagesToMarkdown, toggleVariants, useAttachmentContext, useAttachmentsContext, useFormField, usePromptInputAttachments, usePromptInputController, usePromptInputReferencedSources, useProviderAttachments, useReasoning, useSidebar };
|
package/dist/ui.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import'./index.css';import {i,j,k,g}from'./chunk-MC6VZLKC.js';export{h as DrawerModal,t as InsufficientPermissionsTooltipContent,u as PermissionTooltip,g as Separator,l as Table,n as TableBody,s as TableCaption,r as TableCell,o as TableFooter,q as TableHead,m as TableHeader,p as TableRow,f as Toaster,b as Toggle,c as ToggleGroup,d as ToggleGroupItem,e as toast,a as toggleVariants}from'./chunk-MC6VZLKC.js';import {a as a$2}from'./chunk-7GBAYC7G.js';export{a as Input}from'./chunk-7GBAYC7G.js';import {a as a$3}from'./chunk-OEWYLKO7.js';export{a as Textarea}from'./chunk-OEWYLKO7.js';import {a as a$1,b as b$1,c,e}from'./chunk-YW2EEXMV.js';export{b as Tooltip,e as TooltipContent,d as TooltipPortal,a as TooltipProvider,c as TooltipTrigger}from'./chunk-YW2EEXMV.js';import {a as a$4,d,c as c$1,e as e$1,g as g$1}from'./chunk-XU2JGXYC.js';export{a as Select,e as SelectContent,b as SelectGroup,g as SelectItem,f as SelectLabel,j as SelectScrollDownButton,i as SelectScrollUpButton,h as SelectSeparator,d as SelectTrigger,c as SelectValue}from'./chunk-XU2JGXYC.js';import {c as c$2,d as d$1,h,k as k$1,m,n,o,p,q,r,t,u,s,v,w,b as b$2}from'./chunk-LL2Z4TD3.js';export{b as Badge,m as Command,n as CommandDialog,q as CommandEmpty,r as CommandGroup,o as CommandInput,t as CommandItem,p as CommandList,s as CommandSeparator,u as CommandShortcut,c as Dialog,f as DialogClose,h as DialogContent,l as DialogDescription,j as DialogFooter,i as DialogHeader,g as DialogOverlay,e as DialogPortal,k as DialogTitle,d as DialogTrigger,v as ScrollArea,w as ScrollBar,a as badgeVariants}from'./chunk-LL2Z4TD3.js';export{a as Avatar,c as AvatarFallback,b as AvatarImage}from'./chunk-2FFSI7IK.js';import {h as h$1,c as c$3,e as e$2,f}from'./chunk-IXO2LU47.js';export{c as DropdownMenu,i as DropdownMenuCheckboxItem,f as DropdownMenuContent,g as DropdownMenuGroup,h as DropdownMenuItem,l as DropdownMenuLabel,d as DropdownMenuPortal,j as DropdownMenuRadioGroup,k as DropdownMenuRadioItem,m as DropdownMenuSeparator,n as DropdownMenuShortcut,o as DropdownMenuSub,q as DropdownMenuSubContent,p as DropdownMenuSubTrigger,e as DropdownMenuTrigger,r as Skeleton}from'./chunk-IXO2LU47.js';import {b}from'./chunk-EYGOJ2ZN.js';export{b as Button,a as buttonVariants}from'./chunk-EYGOJ2ZN.js';export{a as Switch}from'./chunk-KGYH74NA.js';export{j as Checkbox,b as Form,g as FormControl,h as FormDescription,c as FormField,e as FormItem,f as FormLabel,i as FormMessage,a as Label,d as useFormField}from'./chunk-FVFRTCEB.js';import {a}from'./chunk-O2QMYUPS.js';import*as Ve from'lucide-react';import {BrainIcon,ChevronDownIcon,XCircleIcon,CheckCircleIcon,CircleIcon,ClockIcon,SquareArrowOutUpRight,GripVerticalIcon,XIcon,PanelLeftIcon,Loader2Icon,CheckIcon,CopyIcon,ArrowDownIcon,DownloadIcon,ChevronLeftIcon,ChevronRightIcon,ImageIcon,Monitor,PlusIcon,CornerDownLeftIcon,SquareIcon,BookIcon,WrenchIcon,VideoIcon,PaperclipIcon,GlobeIcon,FileTextIcon,Music2Icon}from'lucide-react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import*as te from'react-resizable-panels';import {Dialog,Slot,Tabs,HoverCard}from'radix-ui';import*as z from'react';import {createContext,memo,useMemo,useRef,useState,useEffect,useCallback,useContext,createElement,Children,isValidElement}from'react';import Pn from'fuse.js';import {NavLink}from'react-router-dom';import {cva}from'class-variance-authority';import {groupBy}from'ramda';import {createHighlighter}from'shiki';import {StickToBottom,useStickToBottomContext}from'use-stick-to-bottom';import {cjk}from'@streamdown/cjk';import {code}from'@streamdown/code';import {math}from'@streamdown/math';import {mermaid}from'@streamdown/mermaid';import {Streamdown}from'streamdown';import {nanoid}from'nanoid';import {useControllableState}from'@radix-ui/react-use-controllable-state';import {motion}from'motion/react';function Yr({href:e,children:t}){return jsx(b,{asChild:true,className:"fk:h-6 fk:px-1! fk:py-0 fk:text-sm fk:font-light fk:text-link",size:"sm",variant:"link",children:jsxs("a",{href:e,target:"_blank",children:[t," ",jsx(SquareArrowOutUpRight,{className:"fk:size-3",strokeWidth:3})]})})}function en({className:e,...t}){return jsx(te.Group,{"data-slot":"resizable-panel-group",className:a("fk:flex fk:h-full fk:w-full fk:aria-[orientation=vertical]:flex-col",e),...t})}function tn({...e}){return jsx(te.Panel,{"data-slot":"resizable-panel",...e})}function on({withHandle:e,className:t,...o}){return jsx(te.Separator,{"data-slot":"resizable-handle",className:a("fk:relative fk:flex fk:w-px fk:items-center fk:justify-center fk:bg-border fk:after:absolute fk:after:inset-y-0 fk:after:left-1/2 fk:after:w-1 fk:after:-translate-x-1/2 fk:focus-visible:ring-1 fk:focus-visible:ring-ring fk:focus-visible:ring-offset-1 fk:focus-visible:outline-hidden fk:aria-[orientation=horizontal]:h-px fk:aria-[orientation=horizontal]:w-full fk:aria-[orientation=horizontal]:after:left-0 fk:aria-[orientation=horizontal]:after:h-1 fk:aria-[orientation=horizontal]:after:w-full fk:aria-[orientation=horizontal]:after:translate-x-0 fk:aria-[orientation=horizontal]:after:-translate-y-1/2 fk:[&[aria-orientation=horizontal]>div]:rotate-90",t),...o,children:e&&jsx("div",{className:"fk:z-10 fk:flex fk:h-8 fk:w-3 fk:items-center fk:justify-center fk:rounded-xs fk:border fk:bg-border",children:jsx(GripVerticalIcon,{className:"fk:size-2.5"})})})}function kt({...e}){return jsx(Dialog.Root,{"data-slot":"sheet",...e})}function nn({...e}){return jsx(Dialog.Trigger,{"data-slot":"sheet-trigger",...e})}function an({...e}){return jsx(Dialog.Close,{"data-slot":"sheet-close",...e})}function $t({...e}){return jsx(Dialog.Portal,{"data-slot":"sheet-portal",...e})}function Kt({className:e,...t}){return jsx(Dialog.Overlay,{"data-slot":"sheet-overlay",className:a("fk:fixed fk:inset-0 fk:z-50 fk:bg-black/50 fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0",e),...t})}function gt({className:e,children:t,side:o="right",showCloseButton:r=true,...a$1}){return jsxs($t,{children:[jsx(Kt,{}),jsxs(Dialog.Content,{"data-slot":"sheet-content",className:a("fk:fixed fk:z-50 fk:flex fk:flex-col fk:gap-4 fk:bg-background fk:shadow-lg fk:transition fk:ease-in-out fk:data-[state=closed]:animate-out fk:data-[state=closed]:duration-300 fk:data-[state=open]:animate-in fk:data-[state=open]:duration-500",o==="right"&&"fk:inset-y-0 fk:right-0 fk:h-full fk:w-3/4 fk:border-l fk:data-[state=closed]:slide-out-to-right fk:data-[state=open]:slide-in-from-right fk:sm:max-w-sm",o==="left"&&"fk:inset-y-0 fk:left-0 fk:h-full fk:w-3/4 fk:border-r fk:data-[state=closed]:slide-out-to-left fk:data-[state=open]:slide-in-from-left fk:sm:max-w-sm",o==="top"&&"fk:inset-x-0 fk:top-0 fk:h-auto fk:border-b fk:data-[state=closed]:slide-out-to-top fk:data-[state=open]:slide-in-from-top",o==="bottom"&&"fk:inset-x-0 fk:bottom-0 fk:h-auto fk:border-t fk:data-[state=closed]:slide-out-to-bottom fk:data-[state=open]:slide-in-from-bottom",e),...a$1,children:[t,r&&jsxs(Dialog.Close,{className:"fk:absolute fk:top-4 fk:right-4 fk:rounded-xs fk:opacity-70 fk:ring-offset-background fk:transition-opacity fk:hover:opacity-100 fk:focus:ring-2 fk:focus:ring-ring fk:focus:ring-offset-2 fk:focus:outline-hidden fk:disabled:pointer-events-none fk:data-[state=open]:bg-secondary",children:[jsx(XIcon,{className:"fk:size-4"}),jsx("span",{className:"fk:sr-only",children:"Close"})]})]})]})}function bt({className:e,...t}){return jsx("div",{"data-slot":"sheet-header",className:a("fk:flex fk:flex-col fk:gap-1.5 fk:p-4",e),...t})}function sn({className:e,...t}){return jsx("div",{"data-slot":"sheet-footer",className:a("fk:mt-auto fk:flex fk:flex-col fk:gap-2 fk:p-4",e),...t})}function ht({className:e,...t}){return jsx(Dialog.Title,{"data-slot":"sheet-title",className:a("fk:font-semibold fk:text-foreground",e),...t})}function vt({className:e,...t}){return jsx(Dialog.Description,{"data-slot":"sheet-description",className:a("fk:text-sm fk:text-muted-foreground",e),...t})}var xt=768;function qt(){let[e,t]=z.useState(void 0);return z.useEffect(()=>{let o=window.matchMedia(`(max-width: ${xt-1}px)`),r=()=>{t(window.innerWidth<xt);};return o.addEventListener("change",r),t(window.innerWidth<xt),()=>o.removeEventListener("change",r)},[]),!!e}var fn="flexkit:sidebar:state",cn=3600*24*7,dn="16rem",un="18rem",mn="2rem",kn="b",Jt=z.createContext(null);function ye(){let e=z.useContext(Jt);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function gn({defaultOpen:e=true,open:t,onOpenChange:o,className:r,style:a$2,children:i,...s}){let p=qt(),[f,c]=z.useState(false),[g,m]=z.useState(e),k=t??g,T=z.useCallback(d=>{let v=typeof d=="function"?d(k):d;o?o(v):m(v),document.cookie=`${fn}=${v}; path=/; max-age=${cn}`;},[o,k]),h=z.useCallback(()=>p?c(d=>!d):T(d=>!d),[p,T,c]);z.useEffect(()=>{let d=v=>{v.key===kn&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),h());};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[h]);let M=k?"expanded":"collapsed",A=z.useMemo(()=>({state:M,open:k,setOpen:T,isMobile:p,openMobile:f,setOpenMobile:c,toggleSidebar:h}),[M,k,T,p,f,c,h]);return jsx(Jt.Provider,{value:A,children:jsx(a$1,{delayDuration:0,children:jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":dn,"--sidebar-width-icon":mn,...a$2},className:a("fk:group/sidebar-wrapper fk:flex fk:w-full fk:has-data-[variant=inset]:bg-sidebar fk:overflow-hidden",r),...s,children:i})})})}function Pt({side:e="left",variant:t="sidebar",collapsible:o="offcanvas",className:r,children:a$1,...i}){let{isMobile:s,state:p,openMobile:f,setOpenMobile:c}=ye();return o==="none"?jsx("div",{"data-slot":"sidebar",className:a("fk:flex fk:h-full fk:w-(--sidebar-width) fk:flex-col fk:bg-sidebar fk:text-sidebar-foreground",r),...i,children:a$1}):s?jsx(kt,{open:f,onOpenChange:c,...i,children:jsxs(gt,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"fk:w-(--sidebar-width) fk:bg-sidebar fk:p-0 fk:text-sidebar-foreground fk:[&>button]:hidden",style:{"--sidebar-width":un},side:e,children:[jsxs(bt,{className:"fk:sr-only",children:[jsx(ht,{children:"Sidebar"}),jsx(vt,{children:"Displays the mobile sidebar."})]}),jsx("div",{className:"fk:flex fk:h-full fk:w-full fk:flex-col",children:a$1})]})}):jsxs("div",{className:"fk:group fk:peer fk:hidden fk:text-sidebar-foreground fk:md:block","data-state":p,"data-collapsible":p==="collapsed"?o:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[jsx("div",{"data-slot":"sidebar-gap",className:a("fk:relative fk:w-(--sidebar-width) fk:bg-transparent fk:transition-[width] fk:duration-200 fk:ease-linear","fk:group-data-[collapsible=offcanvas]:w-0","fk:group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"fk:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"fk:group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),jsx("div",{"data-slot":"sidebar-container",className:a("fk:relative fk:inset-y-0 fk:z-10 fk:hidden fk:h-[calc(100svh-3.5rem)] fk:w-(--sidebar-width) fk:transition-[left,right,width] fk:duration-200 fk:ease-linear fk:md:flex",e==="left"?"fk:left-0 fk:group-data-[collapsible=offcanvas]:-left-(--sidebar-width)":"fk:right-0 k:group-data-[collapsible=offcanvas]:-right-(--sidebar-width)",t==="floating"||t==="inset"?"fk:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)] fk:group-data-[side=left]:border-r":"fk:group-data-[collapsible=icon]:w-(--sidebar-width-icon) fk:group-data-[side=left]:border-r fk:group-data-[side=right]:border-l",r),...i,children:jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"fk:flex fk:h-full fk:w-full fk:flex-col fk:bg-sidebar fk:group-data-[variant=floating]:rounded-lg fk:group-data-[variant=floating]:border fk:group-data-[variant=floating]:border-sidebar-border fk:group-data-[variant=floating]:shadow-sm",children:a$1})})]})}function bn({className:e,onClick:t,...o}){let{toggleSidebar:r}=ye();return jsxs(b,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:a("fk:size-7",e),onClick:a=>{t?.(a),r();},...o,children:[jsx(PanelLeftIcon,{}),jsx("span",{className:"fk:sr-only",children:"Toggle Sidebar"})]})}function Ct({className:e,...t}){let{toggleSidebar:o}=ye();return jsx("button",{"data-sidebar":"rail","data-slot":"sidebar-rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:o,title:"Toggle Sidebar",className:a("fk:absolute fk:inset-y-0 fk:z-20 fk:hidden fk:w-4 fk:-translate-x-1/2 fk:transition-all fk:ease-linear fk:group-data-[side=left]:-right-4 fk:group-data-[side=right]:left-0 fk:after:absolute fk:after:inset-y-0 fk:after:left-1/2 fk:after:w-[2px] fk:hover:after:bg-sidebar-border fk:sm:flex","fk:in-data-[side=left]:cursor-w-resize fk:in-data-[side=right]:cursor-e-resize","fk:[[data-side=left][data-state=collapsed]_&]:cursor-e-resize fk:[[data-side=right][data-state=collapsed]_&]:cursor-w-resize","fk:group-data-[collapsible=offcanvas]:translate-x-0 fk:group-data-[collapsible=offcanvas]:after:left-full fk:hover:group-data-[collapsible=offcanvas]:bg-sidebar","fk:[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","fk:[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})}function hn({className:e,...t}){return jsx("main",{"data-slot":"sidebar-inset",className:a("fk:relative fk:flex fk:flex-1 fk:flex-col fk:bg-background fk:overflow-hidden fk:peer-data-[variant=inset]:h-[calc(100svh-3.625rem)]",e),...t})}function yt({className:e,...t}){return jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:a("fk:flex fk:min-h-0 fk:flex-1 fk:flex-col fk:overflow-auto fk:group-data-[collapsible=icon]:overflow-hidden",e),...t})}function Ee({className:e,...t}){return jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:a("fk:relative fk:flex fk:w-full fk:min-w-0 fk:flex-col fk:p-2",e),...t})}function St({className:e,asChild:t=false,...o}){let r=t?Slot.Root:"div";return jsx(r,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:a("fk:flex fk:h-8 fk:shrink-0 fk:items-center fk:rounded-md fk:px-2 fk:text-xs fk:font-medium fk:text-sidebar-foreground/70 fk:ring-sidebar-ring fk:outline-hidden fk:transition-[margin,opacity] fk:duration-200 fk:ease-linear fk:focus-visible:ring-2 fk:[&>svg]:size-4 fk:[&>svg]:shrink-0","fk:group-data-[collapsible=icon]:-mt-8 fk:group-data-[collapsible=icon]:opacity-0",e),...o})}function vn({className:e,...t}){return jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:a("fk:w-full fk:text-sm",e),...t})}function He({className:e,...t}){return jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:a("fk:flex fk:w-full fk:min-w-0 fk:flex-col fk:gap-1",e),...t})}function Ge({className:e,...t}){return jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:a("fk:group/menu-item fk:relative",e),...t})}var xn=cva("fk:peer/menu-button fk:flex fk:w-full fk:items-center fk:gap-2 fk:overflow-hidden fk:rounded-md fk:p-2 fk:text-left fk:text-sm fk:ring-sidebar-ring fk:outline-hidden fk:transition-[width,height,padding] fk:group-has-data-[sidebar=menu-action]/menu-item:pr-8 fk:group-data-[collapsible=icon]:size-8! fk:group-data-[collapsible=icon]:p-2! fk:hover:bg-sidebar-accent fk:hover:text-sidebar-accent-foreground fk:focus-visible:ring-2 fk:active:bg-sidebar-accent fk:active:text-sidebar-accent-foreground fk:disabled:pointer-events-none fk:disabled:opacity-50 fk:aria-disabled:pointer-events-none fk:aria-disabled:opacity-50 fk:data-[active=true]:bg-sidebar-accent fk:data-[active=true]:font-medium fk:data-[active=true]:text-sidebar-accent-foreground fk:data-[state=open]:hover:bg-sidebar-accent fk:data-[state=open]:hover:text-sidebar-accent-foreground fk:[&>span:last-child]:truncate fk:[&>svg]:size-4 fk:[&>svg]:shrink-0",{variants:{variant:{default:"fk:hover:bg-sidebar-accent fk:hover:text-sidebar-accent-foreground",outline:"fk:bg-background fk:shadow-[0_0_0_1px_hsl(var(--sidebar-border))] fk:hover:bg-sidebar-accent fk:hover:text-sidebar-accent-foreground fk:hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"fk:h-8 fk:text-sm",sm:"fk:h-7 fk:text-xs",lg:"fk:h-12 fk:text-sm fk:group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function Oe({asChild:e$1=false,isActive:t=false,variant:o="default",size:r="default",tooltip:a$1,className:i,...s}){let p=e$1?Slot.Root:"button",{isMobile:f,state:c$1}=ye(),g=jsx(p,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":r,"data-active":t,className:a(xn({variant:o,size:r}),i),...s});return a$1?(typeof a$1=="string"&&(a$1={children:a$1}),jsxs(b$1,{children:[jsx(c,{asChild:true,children:g}),jsx(e,{side:"right",align:"center",hidden:c$1!=="collapsed"||f,...a$1})]})):g}var Zt=NavLink,Sn=Object.keys(Ve).map(e=>({name:e,icon:Ve[e]})),Tn=new Pn(Sn,{keys:["name"],threshold:.5});function In({className:e,menuGroups:t,schema:o}){let r=o.filter(s=>!(s.menu&&"hidden"in s.menu)),a=groupBy(s=>s.menu?.group&&t?.find(p=>p.name===s.menu?.group)?.name||"ungrouped",r),i=t?.filter(s=>a[s.name]?.length);return jsxs(Pt,{className:e,collapsible:"icon",variant:"inset",children:[jsxs(yt,{children:[i?.map(s=>jsxs(Ee,{children:[jsx(St,{children:s.title}),jsx(He,{children:a[s.name]?.map(p=>jsx(Ge,{children:jsx(Oe,{asChild:true,isActive:location.pathname.includes(`/list/${p.plural}`),tooltip:Ue(p.menu?.label??p.plural),children:jsxs(Zt,{to:`list/${p.plural}`,children:[p.menu?.icon??createElement(Ve[Qt(p.name)],{className:"fk:h-4 fk:w-4 fk:mr-2",strokeWidth:2}),jsx("span",{children:Ue(p.menu?.label??p.plural)})]})})},p.plural))})]},s.name)),jsx(Ee,{children:jsx(He,{children:a.ungrouped?.map(s=>jsx(Ge,{children:jsx(Oe,{asChild:true,isActive:location.pathname.includes(`/list/${s.plural}`),tooltip:Ue(s.menu?.label??s.plural),children:jsxs(Zt,{to:`list/${s.plural}`,children:[createElement(Ve[Qt(s.name)],{className:"fk:h-4 fk:w-4 fk:mr-2",strokeWidth:2}),jsx("span",{children:Ue(s.menu?.label??s.plural)})]})})},s.plural))})})]}),jsx(Ct,{})]})}function Ue(e){let t=e.replace(/([A-Z])/g," $1");return t.charAt(0).toUpperCase()+t.slice(1).trim()}function Qt(e){let t=Tn.search(e);return t.length>0?t[0].item.name:"Dock"}function Mn({className:e,orientation:t="horizontal",...o}){return jsx(Tabs.Root,{"data-slot":"tabs","data-orientation":t,orientation:t,className:a("fk:group/tabs fk:flex fk:data-[orientation=horizontal]:flex-col",e),...o})}var Nn=cva("fk:group/tabs-list fk:inline-flex fk:w-fit fk:items-center fk:justify-center fk:rounded-lg fk:p-[3px] fk:text-muted-foreground fk:group-data-[orientation=horizontal]/tabs:h-9 fk:group-data-[orientation=vertical]/tabs:h-fit fk:group-data-[orientation=vertical]/tabs:flex-col fk:data-[variant=line]:rounded-none",{variants:{variant:{default:"fk:bg-muted",line:"fk:gap-1 fk:bg-transparent"}},defaultVariants:{variant:"default"}});function Rn({className:e,variant:t="default",...o}){return jsx(Tabs.List,{"data-slot":"tabs-list","data-variant":t,className:a(Nn({variant:t}),e),...o})}function Ln({className:e,...t}){return jsx(Tabs.Trigger,{"data-slot":"tabs-trigger",className:a("fk:relative fk:inline-flex fk:h-[calc(100%-1px)] fk:flex-1 fk:items-center fk:justify-center fk:gap-1.5 fk:rounded-md fk:border fk:border-transparent! fk:px-4 fk:py-1 fk:text-sm fk:font-medium fk:whitespace-nowrap fk:text-foreground/60 fk:transition-all fk:group-data-[orientation=vertical]/tabs:w-full fk:group-data-[orientation=vertical]/tabs:justify-start fk:hover:text-foreground fk:focus-visible:border-ring! fk:focus-visible:ring-[3px] fk:focus-visible:ring-ring/50 fk:focus-visible:outline-1 fk:focus-visible:outline-ring fk:disabled:pointer-events-none fk:disabled:opacity-50 fk:group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm fk:group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none fk:dark:text-muted-foreground fk:dark:hover:text-foreground fk:[&_svg]:pointer-events-none fk:[&_svg]:shrink-0 fk:[&_svg:not([class*='size-'])]:size-4","fk:group-data-[variant=line]/tabs-list:bg-transparent fk:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent fk:dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent! fk:dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","fk:data-[state=active]:bg-background fk:data-[state=active]:text-foreground fk:dark:data-[state=active]:border-muted-foreground/75! fk:dark:data-[state=active]:bg-input/30 fk:dark:data-[state=active]:text-foreground","fk:after:absolute fk:after:bg-foreground fk:after:opacity-0 fk:after:transition-opacity fk:group-data-[orientation=horizontal]/tabs:after:inset-x-0 fk:group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] fk:group-data-[orientation=horizontal]/tabs:after:h-0.5 fk:group-data-[orientation=vertical]/tabs:after:inset-y-0 fk:group-data-[orientation=vertical]/tabs:after:-right-1 fk:group-data-[orientation=vertical]/tabs:after:w-0.5 fk:group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",e),...t})}function Bn({className:e,...t}){return jsx(Tabs.Content,{"data-slot":"tabs-content",className:a("fk:flex-1 fk:outline-none fk:gap-2 fk:flex fk:flex-col",e),...t})}function Te({...e}){return jsx(HoverCard.Root,{"data-slot":"hover-card",...e})}function Ie({...e}){return jsx(HoverCard.Trigger,{"data-slot":"hover-card-trigger",...e})}function we({className:e,align:t="center",sideOffset:o=4,...r}){return jsx(HoverCard.Portal,{"data-slot":"hover-card-portal",children:jsx(HoverCard.Content,{"data-slot":"hover-card-content",align:t,sideOffset:o,className:a("fk:z-50 fk:w-64 fk:origin-(--radix-hover-card-content-transform-origin) fk:rounded-md fk:border fk:bg-popover fk:p-4 fk:text-popover-foreground fk:shadow-md fk:outline-hidden fk:data-[side=bottom]:slide-in-from-top-2 fk:data-[side=left]:slide-in-from-right-2 fk:data-[side=right]:slide-in-from-left-2 fk:data-[side=top]:slide-in-from-bottom-2 fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:zoom-out-95 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0 fk:data-[state=open]:zoom-in-95",e),...r})})}function Tt({className:e,...t}){return jsx(Loader2Icon,{role:"status","aria-label":"Loading",className:a("fk:size-4 fk:animate-spin",e),...t})}var eo=cva("fk:flex fk:w-fit fk:items-stretch fk:has-[>[data-slot=button-group]]:gap-2 fk:[&>*]:focus-visible:relative fk:[&>*]:focus-visible:z-10 fk:has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md fk:[&>[data-slot=select-trigger]:not([class*=w-])]:w-fit fk:[&>input]:flex-1",{variants:{orientation:{horizontal:"fk:[&>*:not(:first-child)]:rounded-l-none fk:[&>*:not(:first-child)]:border-l-0 fk:[&>*:not(:last-child)]:rounded-r-none",vertical:"fk:flex-col fk:[&>*:not(:first-child)]:rounded-t-none fk:[&>*:not(:first-child)]:border-t-0 fk:[&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}});function It({className:e,orientation:t,...o}){return jsx("div",{role:"group","data-slot":"button-group","data-orientation":t,className:a(eo({orientation:t}),e),...o})}function wt({className:e,asChild:t=false,...o}){let r=t?Slot.Root:"div";return jsx(r,{className:a("fk:bg-muted fk:shadow-xs fk:flex fk:items-center fk:gap-2 fk:rounded-md fk:border fk:px-4 fk:text-sm fk:font-medium fk:[&_svg:not([class*=size-])]:size-4 fk:[&_svg]:pointer-events-none",e),...o})}function Hn({className:e,orientation:t="vertical",...o}){return jsx(g,{"data-slot":"button-group-separator",orientation:t,className:a("fk:bg-input fk:relative fk:!m-0 fk:self-stretch fk:data-[orientation=vertical]:h-auto",e),...o})}function Nt({className:e,...t}){return jsx("div",{"data-slot":"input-group",role:"group",className:a("fk:group/input-group fk:border-input fk:dark:bg-input/30 fk:shadow-xs fk:relative fk:flex fk:w-full fk:items-center fk:rounded-md fk:border fk:outline-none fk:transition-[color,box-shadow]","fk:h-9 fk:has-[>textarea]:h-auto","fk:has-[>[data-align=inline-start]]:[&>input]:pl-2","fk:has-[>[data-align=inline-end]]:[&>input]:pr-2","fk:has-[>[data-align=block-start]]:h-auto fk:has-[>[data-align=block-start]]:flex-col fk:has-[>[data-align=block-start]]:[&>input]:pb-3","fk:has-[>[data-align=block-end]]:h-auto fk:has-[>[data-align=block-end]]:flex-col fk:has-[>[data-align=block-end]]:[&>input]:pt-3","fk:has-[[data-slot=input-group-control]:focus-visible]:ring-ring fk:has-[[data-slot=input-group-control]:focus-visible]:ring-1","fk:has-[[data-slot][aria-invalid=true]]:ring-destructive/20 fk:has-[[data-slot][aria-invalid=true]]:border-destructive fk:dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...t})}var Gn=cva("fk:text-muted-foreground fk:flex fk:h-auto fk:cursor-text fk:select-none fk:items-center fk:justify-center fk:gap-2 fk:py-1.5 fk:text-sm fk:font-medium fk:group-data-[disabled=true]/input-group:opacity-50 fk:[&>kbd]:rounded-[calc(var(--radius)-5px)] fk:[&>svg:not([class*=size-])]:size-4",{variants:{align:{"inline-start":"fk:order-first fk:pl-3 fk:has-[>button]:ml-[-0.45rem] fk:has-[>kbd]:ml-[-0.35rem]","inline-end":"fk:order-last fk:pr-3 fk:has-[>button]:mr-[-0.4rem] fk:has-[>kbd]:mr-[-0.35rem]","block-start":"fk:[.border-b]:pb-3 fk:order-first fk:w-full fk:justify-start fk:px-3 fk:pt-3 fk:group-has-[>input]/input-group:pt-2.5","block-end":"fk:[.border-t]:pt-3 fk:order-last fk:w-full fk:justify-start fk:px-3 fk:pb-3 fk:group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function $e({className:e,align:t="inline-start",...o}){return jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:a(Gn({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus();},...o})}var On=cva("fk:flex fk:items-center fk:gap-2 fk:text-sm fk:shadow-none",{variants:{size:{xs:"fk:h-6 fk:gap-1 fk:rounded-[calc(var(--radius)-5px)] fk:px-2 fk:has-[>svg]:px-2 fk:[&>svg:not([class*=size-])]:size-3.5",sm:"fk:h-8 fk:gap-1.5 fk:rounded-md fk:px-2.5 fk:has-[>svg]:px-2.5","icon-xs":"fk:size-6 fk:rounded-[calc(var(--radius)-5px)] fk:p-0 fk:has-[>svg]:p-0","icon-sm":"fk:size-8 fk:p-0 fk:has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function Ke({className:e,type:t="button",variant:o="ghost",size:r="xs",...a$1}){return jsx(b,{type:t,"data-size":r,variant:o,className:a(On({size:r}),e),...a$1})}function Un({className:e,...t}){return jsx("span",{className:a("fk:text-muted-foreground fk:flex fk:items-center fk:gap-2 fk:text-sm fk:[&_svg:not([class*=size-])]:size-4 fk:[&_svg]:pointer-events-none",e),...t})}function Vn({className:e,...t}){return jsx(a$2,{"data-slot":"input-group-control",className:a("fk:flex-1 fk:rounded-none fk:border-0 fk:bg-transparent fk:shadow-none fk:focus-visible:ring-0 fk:dark:bg-transparent",e),...t})}function Rt({className:e,...t}){return jsx(a$3,{"data-slot":"input-group-control",className:a("fk:flex-1 fk:resize-none fk:rounded-none fk:border-0 fk:bg-transparent fk:py-3 fk:shadow-none fk:focus-visible:ring-0 fk:dark:bg-transparent",e),...t})}var Jn={audio:Music2Icon,document:FileTextIcon,image:ImageIcon,source:GlobeIcon,unknown:PaperclipIcon,video:VideoIcon},ao=e=>{if(e.type==="source-document")return "source";let t=e.mediaType??"";return t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":t.startsWith("application/")||t.startsWith("text/")?"document":"unknown"},Yn=e=>{if(e.type==="source-document")return e.title||e.filename||"Source";let t=ao(e);return e.filename||(t==="image"?"Image":"Attachment")},Zn=(e,t,o)=>o?jsx("img",{alt:t||"Image",className:"fk:size-full fk:object-cover",height:96,src:e,width:96}):jsx("img",{alt:t||"Image",className:"fk:size-full fk:rounded fk:object-cover",height:20,src:e,width:20}),so=createContext(null),io=createContext(null),Qn=()=>useContext(so)??{variant:"grid"},Lt=()=>{let e=useContext(io);if(!e)throw new Error("Attachment components must be used within <Attachment>");return e},Wi=({variant:e="grid",className:t,children:o,...r})=>{let a$1=useMemo(()=>({variant:e}),[e]);return jsx(so.Provider,{value:a$1,children:jsx("div",{className:a("fk:flex fk:items-start",e==="list"?"fk:flex-col fk:gap-2":"fk:flex-wrap fk:gap-2",e==="grid"&&"fk:ml-auto fk:w-fit",t),...r,children:o})})},$i=({data:e,onRemove:t,className:o,children:r,...a$1})=>{let{variant:i}=Qn(),s=ao(e),p=useMemo(()=>({data:e,mediaCategory:s,onRemove:t,variant:i}),[e,s,t,i]);return jsx(io.Provider,{value:p,children:jsx("div",{className:a("fk:group fk:relative",i==="grid"&&"fk:size-24 fk:overflow-hidden fk:rounded-lg",i==="inline"&&["fk:flex fk:h-8 fk:cursor-pointer fk:select-none fk:items-center fk:gap-1.5","fk:rounded-md fk:border fk:border-border fk:px-1.5","fk:font-medium fk:text-sm fk:transition-all","fk:hover:bg-accent fk:hover:text-accent-foreground fk:dark:hover:bg-accent/50"],i==="list"&&["fk:flex fk:w-full fk:items-center fk:gap-3 fk:rounded-lg fk:border fk:p-3","fk:hover:bg-accent/50"],o),...a$1,children:r})})},Ki=({fallbackIcon:e,className:t,...o})=>{let{data:r,mediaCategory:a$1,variant:i}=Lt(),s=i==="inline"?"fk:size-3":"fk:size-4",p=c=>jsx(c,{className:a(s,"fk:text-muted-foreground")}),f=()=>{if(a$1==="image"&&r.type==="file"&&r.url)return Zn(r.url,r.filename,i==="grid");if(a$1==="video"&&r.type==="file"&&r.url)return jsx("video",{className:"fk:size-full fk:object-cover",muted:true,src:r.url});let c=Jn[a$1];return e??p(c)};return jsx("div",{className:a("fk:flex fk:shrink-0 fk:items-center fk:justify-center fk:overflow-hidden",i==="grid"&&"fk:size-full fk:bg-muted",i==="inline"&&"fk:size-5 fk:rounded fk:bg-background",i==="list"&&"fk:size-12 fk:rounded fk:bg-muted",t),...o,children:f()})},qi=({showMediaType:e=false,className:t,...o})=>{let{data:r,variant:a$1}=Lt(),i=Yn(r);return a$1==="grid"?null:jsxs("div",{className:a("fk:min-w-0 fk:flex-1",t),...o,children:[jsx("span",{className:"fk:block fk:truncate",children:i}),e&&r.mediaType&&jsx("span",{className:"fk:block fk:truncate fk:text-muted-foreground fk:text-xs",children:r.mediaType})]})},Xi=({label:e="Remove",className:t,children:o,...r})=>{let{onRemove:a$1,variant:i}=Lt(),s=useCallback(p=>{p.stopPropagation(),a$1?.();},[a$1]);return a$1?jsxs(b,{"aria-label":e,className:a(i==="grid"&&["fk:absolute fk:top-2 fk:right-2 fk:size-6 fk:rounded-full fk:p-0","fk:bg-background/80 fk:backdrop-blur-sm","fk:opacity-0 fk:transition-opacity fk:group-hover:opacity-100","fk:hover:bg-background","fk:[&>svg]:size-3"],i==="inline"&&["fk:size-5 fk:rounded fk:p-0","fk:opacity-0 fk:transition-opacity fk:group-hover:opacity-100","fk:[&>svg]:size-2.5"],i==="list"&&["fk:size-8 fk:shrink-0 fk:rounded fk:p-0","fk:[&>svg]:size-4"],t),onClick:s,type:"button",variant:"ghost",...r,children:[o??jsx(XIcon,{}),jsx("span",{className:"fk:sr-only",children:e})]}):null},Ji=({openDelay:e=0,closeDelay:t=0,...o})=>jsx(Te,{closeDelay:t,openDelay:e,...o}),Yi=e=>jsx(Ie,{...e}),Zi=({align:e="start",className:t,...o})=>jsx(we,{align:e,className:a("fk:w-auto fk:p-2",t),...o}),Qi=({className:e,children:t,...o})=>jsx("div",{className:a("fk:flex fk:items-center fk:justify-center fk:p-4 fk:text-muted-foreground fk:text-sm",e),...o,children:t??"No attachments"});var ia=e=>e&&e&1,pa=e=>e&&e&2,la=e=>e&&e&4,fa=e=>e.map((t,o)=>({key:`line-${o}`,tokens:t.map((r,a)=>({key:`line-${o}-${a}`,token:r}))})),ca=({token:e})=>jsx("span",{className:"fk:dark:bg-(--shiki-dark-bg)! fk:dark:text-(--shiki-dark)!",style:{backgroundColor:e.bgColor,color:e.color,fontStyle:ia(e.fontStyle)?"italic":void 0,fontWeight:pa(e.fontStyle)?"bold":void 0,textDecoration:la(e.fontStyle)?"underline":void 0,...e.htmlStyle},children:e.content}),da=a("fk:block","fk:before:content-[counter(line)]","fk:before:inline-block","fk:before:[counter-increment:line]","fk:before:w-8","fk:before:mr-4","fk:before:text-right","fk:before:text-muted-foreground/50","fk:before:font-mono","fk:before:select-none"),ua=({keyedLine:e,showLineNumbers:t})=>jsx("span",{className:t?da:"fk:block",children:e.tokens.length===0?`
|
|
2
|
-
`:e.tokens.map(({token:o,key:r})=>jsx(ca,{token:o},r))}),
|
|
3
|
-
`).map(t=>t===""?[]:[{color:"inherit",content:t}])}),
|
|
1
|
+
import'./index.css';import {l,m,n}from'./chunk-PXB5QSHN.js';export{g as DrawerModal,w as InsufficientPermissionsTooltipContent,x as PermissionTooltip,o as Table,q as TableBody,v as TableCaption,u as TableCell,r as TableFooter,t as TableHead,p as TableHeader,s as TableRow,h as Tabs,k as TabsContent,i as TabsList,j as TabsTrigger,f as Toaster,b as Toggle,c as ToggleGroup,d as ToggleGroupItem,e as toast,a as toggleVariants}from'./chunk-PXB5QSHN.js';import {a as a$2}from'./chunk-7GBAYC7G.js';export{a as Input}from'./chunk-7GBAYC7G.js';import {a as a$3}from'./chunk-OEWYLKO7.js';export{a as Textarea}from'./chunk-OEWYLKO7.js';import {a as a$1,b as b$1,c,e}from'./chunk-YW2EEXMV.js';export{b as Tooltip,e as TooltipContent,d as TooltipPortal,a as TooltipProvider,c as TooltipTrigger}from'./chunk-YW2EEXMV.js';import {b as b$2,c as c$2}from'./chunk-XFY7MZJN.js';export{b as ButtonGroup,d as ButtonGroupSeparator,c as ButtonGroupText,a as buttonGroupVariants}from'./chunk-XFY7MZJN.js';import {d as d$1,e as e$2,i,l as l$1,n as n$1,o,p,q,r,s,u,v,t,w,x,b as b$3}from'./chunk-KHPTVIYT.js';export{b as Badge,n as Command,o as CommandDialog,r as CommandEmpty,s as CommandGroup,p as CommandInput,u as CommandItem,q as CommandList,t as CommandSeparator,v as CommandShortcut,d as Dialog,g as DialogClose,i as DialogContent,m as DialogDescription,k as DialogFooter,j as DialogHeader,h as DialogOverlay,f as DialogPortal,l as DialogTitle,e as DialogTrigger,w as ScrollArea,x as ScrollBar,c as Separator,a as badgeVariants}from'./chunk-KHPTVIYT.js';import {a as a$4,d,c as c$1,e as e$1,g}from'./chunk-XU2JGXYC.js';export{a as Select,e as SelectContent,b as SelectGroup,g as SelectItem,f as SelectLabel,j as SelectScrollDownButton,i as SelectScrollUpButton,h as SelectSeparator,d as SelectTrigger,c as SelectValue}from'./chunk-XU2JGXYC.js';export{a as Avatar,c as AvatarFallback,b as AvatarImage}from'./chunk-2FFSI7IK.js';import {h,c as c$3,e as e$3,f}from'./chunk-JCHD4EGB.js';export{c as DropdownMenu,i as DropdownMenuCheckboxItem,f as DropdownMenuContent,g as DropdownMenuGroup,h as DropdownMenuItem,l as DropdownMenuLabel,d as DropdownMenuPortal,j as DropdownMenuRadioGroup,k as DropdownMenuRadioItem,m as DropdownMenuSeparator,n as DropdownMenuShortcut,o as DropdownMenuSub,q as DropdownMenuSubContent,p as DropdownMenuSubTrigger,e as DropdownMenuTrigger,r as Skeleton}from'./chunk-JCHD4EGB.js';import {b}from'./chunk-EYGOJ2ZN.js';export{b as Button,a as buttonVariants}from'./chunk-EYGOJ2ZN.js';export{a as Switch}from'./chunk-KGYH74NA.js';export{j as Checkbox,b as Form,g as FormControl,h as FormDescription,c as FormField,e as FormItem,f as FormLabel,i as FormMessage,a as Label,d as useFormField}from'./chunk-FVFRTCEB.js';import {a}from'./chunk-O2QMYUPS.js';import*as rt from'lucide-react';import {BrainIcon,ChevronDownIcon,XCircleIcon,CheckCircleIcon,CircleIcon,ClockIcon,SquareArrowOutUpRight,GripVerticalIcon,XIcon,PanelLeftIcon,Loader2Icon,CheckIcon,CopyIcon,ArrowDownIcon,DownloadIcon,ChevronLeftIcon,ChevronRightIcon,ImageIcon,Monitor,PlusIcon,CornerDownLeftIcon,SquareIcon,BookIcon,LoaderIcon,MicIcon,WrenchIcon,VideoIcon,PaperclipIcon,GlobeIcon,FileTextIcon,Music2Icon}from'lucide-react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import*as ce from'react-resizable-panels';import {Dialog,Slot,HoverCard}from'radix-ui';import*as H from'react';import {createContext,memo,useMemo,useRef,useState,useEffect,useCallback,useContext,createElement,Children,isValidElement}from'react';import Rn from'fuse.js';import {NavLink}from'react-router-dom';import {cva}from'class-variance-authority';import {groupBy}from'ramda';import {createHighlighter}from'shiki';import {StickToBottom,useStickToBottomContext}from'use-stick-to-bottom';import {cjk}from'@streamdown/cjk';import {code}from'@streamdown/code';import {math}from'@streamdown/math';import {mermaid}from'@streamdown/mermaid';import {Streamdown}from'streamdown';import {nanoid}from'nanoid';import {useControllableState}from'@radix-ui/react-use-controllable-state';import {motion}from'motion/react';function sn({href:e,children:t}){return jsx(b,{asChild:true,className:"fk:h-6 fk:px-1! fk:py-0 fk:text-sm fk:font-light fk:text-link",size:"sm",variant:"link",children:jsxs("a",{href:e,target:"_blank",children:[t," ",jsx(SquareArrowOutUpRight,{className:"fk:size-3",strokeWidth:3})]})})}function fn({className:e,...t}){return jsx(ce.Group,{"data-slot":"resizable-panel-group",className:a("fk:flex fk:h-full fk:w-full fk:aria-[orientation=vertical]:flex-col",e),...t})}function cn({...e}){return jsx(ce.Panel,{"data-slot":"resizable-panel",...e})}function dn({withHandle:e,className:t,...o}){return jsx(ce.Separator,{"data-slot":"resizable-handle",className:a("fk:relative fk:flex fk:w-px fk:items-center fk:justify-center fk:bg-border fk:after:absolute fk:after:inset-y-0 fk:after:left-1/2 fk:after:w-1 fk:after:-translate-x-1/2 fk:focus-visible:ring-1 fk:focus-visible:ring-ring fk:focus-visible:ring-offset-1 fk:focus-visible:outline-hidden fk:aria-[orientation=horizontal]:h-px fk:aria-[orientation=horizontal]:w-full fk:aria-[orientation=horizontal]:after:left-0 fk:aria-[orientation=horizontal]:after:h-1 fk:aria-[orientation=horizontal]:after:w-full fk:aria-[orientation=horizontal]:after:translate-x-0 fk:aria-[orientation=horizontal]:after:-translate-y-1/2 fk:[&[aria-orientation=horizontal]>div]:rotate-90",t),...o,children:e&&jsx("div",{className:"fk:z-10 fk:flex fk:h-8 fk:w-3 fk:items-center fk:justify-center fk:rounded-xs fk:border fk:bg-border",children:jsx(GripVerticalIcon,{className:"fk:size-2.5"})})})}function Nt({...e}){return jsx(Dialog.Root,{"data-slot":"sheet",...e})}function mn({...e}){return jsx(Dialog.Trigger,{"data-slot":"sheet-trigger",...e})}function kn({...e}){return jsx(Dialog.Close,{"data-slot":"sheet-close",...e})}function no({...e}){return jsx(Dialog.Portal,{"data-slot":"sheet-portal",...e})}function ao({className:e,...t}){return jsx(Dialog.Overlay,{"data-slot":"sheet-overlay",className:a("fk:fixed fk:inset-0 fk:z-50 fk:bg-black/50 fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0",e),...t})}function Rt({className:e,children:t,side:o="right",showCloseButton:r=true,...a$1}){return jsxs(no,{children:[jsx(ao,{}),jsxs(Dialog.Content,{"data-slot":"sheet-content",className:a("fk:fixed fk:z-50 fk:flex fk:flex-col fk:gap-4 fk:bg-background fk:shadow-lg fk:transition fk:ease-in-out fk:data-[state=closed]:animate-out fk:data-[state=closed]:duration-300 fk:data-[state=open]:animate-in fk:data-[state=open]:duration-500",o==="right"&&"fk:inset-y-0 fk:right-0 fk:h-full fk:w-3/4 fk:border-l fk:data-[state=closed]:slide-out-to-right fk:data-[state=open]:slide-in-from-right fk:sm:max-w-sm",o==="left"&&"fk:inset-y-0 fk:left-0 fk:h-full fk:w-3/4 fk:border-r fk:data-[state=closed]:slide-out-to-left fk:data-[state=open]:slide-in-from-left fk:sm:max-w-sm",o==="top"&&"fk:inset-x-0 fk:top-0 fk:h-auto fk:border-b fk:data-[state=closed]:slide-out-to-top fk:data-[state=open]:slide-in-from-top",o==="bottom"&&"fk:inset-x-0 fk:bottom-0 fk:h-auto fk:border-t fk:data-[state=closed]:slide-out-to-bottom fk:data-[state=open]:slide-in-from-bottom",e),...a$1,children:[t,r&&jsxs(Dialog.Close,{className:"fk:absolute fk:top-4 fk:right-4 fk:rounded-xs fk:opacity-70 fk:ring-offset-background fk:transition-opacity fk:hover:opacity-100 fk:focus:ring-2 fk:focus:ring-ring fk:focus:ring-offset-2 fk:focus:outline-hidden fk:disabled:pointer-events-none fk:data-[state=open]:bg-secondary",children:[jsx(XIcon,{className:"fk:size-4"}),jsx("span",{className:"fk:sr-only",children:"Close"})]})]})]})}function Bt({className:e,...t}){return jsx("div",{"data-slot":"sheet-header",className:a("fk:flex fk:flex-col fk:gap-1.5 fk:p-4",e),...t})}function gn({className:e,...t}){return jsx("div",{"data-slot":"sheet-footer",className:a("fk:mt-auto fk:flex fk:flex-col fk:gap-2 fk:p-4",e),...t})}function Lt({className:e,...t}){return jsx(Dialog.Title,{"data-slot":"sheet-title",className:a("fk:font-semibold fk:text-foreground",e),...t})}function At({className:e,...t}){return jsx(Dialog.Description,{"data-slot":"sheet-description",className:a("fk:text-sm fk:text-muted-foreground",e),...t})}var Dt=768;function so(){let[e,t]=H.useState(void 0);return H.useEffect(()=>{let o=window.matchMedia(`(max-width: ${Dt-1}px)`),r=()=>{t(window.innerWidth<Dt);};return o.addEventListener("change",r),t(window.innerWidth<Dt),()=>o.removeEventListener("change",r)},[]),!!e}var xn="flexkit:sidebar:state",vn=3600*24*7,Cn="16rem",Pn="18rem",yn="2rem",Sn="b",po=H.createContext(null);function Ge(){let e=H.useContext(po);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function Tn({defaultOpen:e=true,open:t,onOpenChange:o,className:r,style:a$2,children:i,...s}){let p=so(),[l,f]=H.useState(false),[m,k]=H.useState(e),g=t??m,T=H.useCallback(c=>{let x=typeof c=="function"?c(g):c;o?o(x):k(x),document.cookie=`${xn}=${x}; path=/; max-age=${vn}`;},[o,g]),b=H.useCallback(()=>p?f(c=>!c):T(c=>!c),[p,T,f]);H.useEffect(()=>{let c=x=>{x.key===Sn&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),b());};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[b]);let C=g?"expanded":"collapsed",N=H.useMemo(()=>({state:C,open:g,setOpen:T,isMobile:p,openMobile:l,setOpenMobile:f,toggleSidebar:b}),[C,g,T,p,l,f,b]);return jsx(po.Provider,{value:N,children:jsx(a$1,{delayDuration:0,children:jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Cn,"--sidebar-width-icon":yn,...a$2},className:a("fk:group/sidebar-wrapper fk:flex fk:w-full fk:has-data-[variant=inset]:bg-sidebar fk:overflow-hidden",r),...s,children:i})})})}function Et({side:e="left",variant:t="sidebar",collapsible:o="offcanvas",className:r,children:a$1,...i}){let{isMobile:s,state:p,openMobile:l,setOpenMobile:f}=Ge();return o==="none"?jsx("div",{"data-slot":"sidebar",className:a("fk:flex fk:h-full fk:w-(--sidebar-width) fk:flex-col fk:bg-sidebar fk:text-sidebar-foreground",r),...i,children:a$1}):s?jsx(Nt,{open:l,onOpenChange:f,...i,children:jsxs(Rt,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"fk:w-(--sidebar-width) fk:bg-sidebar fk:p-0 fk:text-sidebar-foreground fk:[&>button]:hidden",style:{"--sidebar-width":Pn},side:e,children:[jsxs(Bt,{className:"fk:sr-only",children:[jsx(Lt,{children:"Sidebar"}),jsx(At,{children:"Displays the mobile sidebar."})]}),jsx("div",{className:"fk:flex fk:h-full fk:w-full fk:flex-col",children:a$1})]})}):jsxs("div",{className:"fk:group fk:peer flexkit-sidebar-desktop-block fk:text-sidebar-foreground","data-state":p,"data-collapsible":p==="collapsed"?o:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[jsx("div",{"data-slot":"sidebar-gap",className:a("fk:relative fk:w-(--sidebar-width) fk:bg-transparent fk:transition-[width] fk:duration-200 fk:ease-linear","fk:group-data-[collapsible=offcanvas]:w-0","fk:group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"fk:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"fk:group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),jsx("div",{"data-slot":"sidebar-container",className:a("fk:relative fk:inset-y-0 fk:z-10 flexkit-sidebar-desktop-flex fk:h-[calc(100svh-3.5rem)] fk:w-(--sidebar-width) fk:transition-[left,right,width] fk:duration-200 fk:ease-linear",e==="left"?"fk:left-0 fk:group-data-[collapsible=offcanvas]:-left-(--sidebar-width)":"fk:right-0 k:group-data-[collapsible=offcanvas]:-right-(--sidebar-width)",t==="floating"||t==="inset"?"fk:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)] fk:group-data-[side=left]:border-r":"fk:group-data-[collapsible=icon]:w-(--sidebar-width-icon) fk:group-data-[side=left]:border-r fk:group-data-[side=right]:border-l",r),...i,children:jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"fk:flex fk:h-full fk:w-full fk:flex-col fk:bg-sidebar fk:group-data-[variant=floating]:rounded-lg fk:group-data-[variant=floating]:border fk:group-data-[variant=floating]:border-sidebar-border fk:group-data-[variant=floating]:shadow-sm",children:a$1})})]})}function In({className:e,onClick:t,...o}){let{toggleSidebar:r}=Ge();return jsxs(b,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:a("fk:size-7",e),onClick:a=>{t?.(a),r();},...o,children:[jsx(PanelLeftIcon,{}),jsx("span",{className:"fk:sr-only",children:"Toggle Sidebar"})]})}function zt({className:e,...t}){let{toggleSidebar:o}=Ge();return jsx("button",{"data-sidebar":"rail","data-slot":"sidebar-rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:o,title:"Toggle Sidebar",className:a("fk:absolute fk:inset-y-0 fk:z-20 flexkit-sidebar-sm-flex fk:w-4 fk:-translate-x-1/2 fk:transition-all fk:ease-linear fk:group-data-[side=left]:-right-4 fk:group-data-[side=right]:left-0 fk:after:absolute fk:after:inset-y-0 fk:after:left-1/2 fk:after:w-[2px] fk:hover:after:bg-sidebar-border","fk:in-data-[side=left]:cursor-w-resize fk:in-data-[side=right]:cursor-e-resize","fk:[[data-side=left][data-state=collapsed]_&]:cursor-e-resize fk:[[data-side=right][data-state=collapsed]_&]:cursor-w-resize","fk:group-data-[collapsible=offcanvas]:translate-x-0 fk:group-data-[collapsible=offcanvas]:after:left-full fk:hover:group-data-[collapsible=offcanvas]:bg-sidebar","fk:[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","fk:[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})}function wn({className:e,...t}){return jsx("main",{"data-slot":"sidebar-inset",className:a("fk:relative fk:flex fk:flex-1 fk:flex-col fk:bg-background fk:overflow-hidden fk:peer-data-[variant=inset]:h-[calc(100svh-3.625rem)]",e),...t})}function Ht({className:e,...t}){return jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:a("fk:flex fk:min-h-0 fk:flex-1 fk:flex-col fk:overflow-auto fk:group-data-[collapsible=icon]:overflow-hidden",e),...t})}function Ze({className:e,...t}){return jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:a("fk:relative fk:flex fk:w-full fk:min-w-0 fk:flex-col fk:p-2",e),...t})}function Gt({className:e,asChild:t=false,...o}){let r=t?Slot.Root:"div";return jsx(r,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:a("fk:flex fk:h-8 fk:shrink-0 fk:items-center fk:rounded-md fk:px-2 fk:text-xs fk:font-medium fk:text-sidebar-foreground/70 fk:ring-sidebar-ring fk:outline-hidden fk:transition-[margin,opacity] fk:duration-200 fk:ease-linear fk:focus-visible:ring-2 fk:[&>svg]:size-4 fk:[&>svg]:shrink-0","fk:group-data-[collapsible=icon]:-mt-8 fk:group-data-[collapsible=icon]:opacity-0",e),...o})}function Mn({className:e,...t}){return jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:a("fk:w-full fk:text-sm",e),...t})}function Qe({className:e,...t}){return jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:a("fk:flex fk:w-full fk:min-w-0 fk:flex-col fk:gap-1",e),...t})}function et({className:e,...t}){return jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:a("fk:group/menu-item fk:relative",e),...t})}var Nn=cva("fk:peer/menu-button fk:flex fk:w-full fk:items-center fk:gap-2 fk:overflow-hidden fk:rounded-md fk:p-2 fk:text-left fk:text-sm fk:ring-sidebar-ring fk:outline-hidden fk:transition-[width,height,padding] fk:group-has-data-[sidebar=menu-action]/menu-item:pr-8 fk:group-data-[collapsible=icon]:size-8! fk:group-data-[collapsible=icon]:p-2! fk:hover:bg-sidebar-accent fk:hover:text-sidebar-accent-foreground fk:focus-visible:ring-2 fk:active:bg-sidebar-accent fk:active:text-sidebar-accent-foreground fk:disabled:pointer-events-none fk:disabled:opacity-50 fk:aria-disabled:pointer-events-none fk:aria-disabled:opacity-50 fk:data-[active=true]:bg-sidebar-accent fk:data-[active=true]:font-medium fk:data-[active=true]:text-sidebar-accent-foreground fk:data-[state=open]:hover:bg-sidebar-accent fk:data-[state=open]:hover:text-sidebar-accent-foreground fk:[&>span:last-child]:truncate fk:[&>svg]:size-4 fk:[&>svg]:shrink-0",{variants:{variant:{default:"fk:hover:bg-sidebar-accent fk:hover:text-sidebar-accent-foreground",outline:"fk:bg-background fk:shadow-[0_0_0_1px_hsl(var(--sidebar-border))] fk:hover:bg-sidebar-accent fk:hover:text-sidebar-accent-foreground fk:hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"fk:h-8 fk:text-sm",sm:"fk:h-7 fk:text-xs",lg:"fk:h-12 fk:text-sm fk:group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function tt({asChild:e$1=false,isActive:t=false,variant:o="default",size:r="default",tooltip:a$1,className:i,...s}){let p=e$1?Slot.Root:"button",{isMobile:l,state:f}=Ge(),m=jsx(p,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":r,"data-active":t,className:a(Nn({variant:o,size:r}),i),...s});return a$1?(typeof a$1=="string"&&(a$1={children:a$1}),jsxs(b$1,{children:[jsx(c,{asChild:true,children:m}),jsx(e,{side:"right",align:"center",hidden:f!=="collapsed"||l,...a$1})]})):m}var fo=NavLink,An=Object.keys(rt).map(e=>({name:e,icon:rt[e]})),Dn=new Rn(An,{keys:["name"],threshold:.5});function En({className:e,menuGroups:t,schema:o}){let r=o.filter(s=>!(s.menu&&"hidden"in s.menu)),a=groupBy(s=>s.menu?.group&&t?.find(p=>p.name===s.menu?.group)?.name||"ungrouped",r),i=t?.filter(s=>a[s.name]?.length);return jsxs(Et,{className:e,collapsible:"icon",variant:"inset",children:[jsxs(Ht,{children:[i?.map(s=>jsxs(Ze,{children:[jsx(Gt,{children:s.title}),jsx(Qe,{children:a[s.name]?.map(p=>jsx(et,{children:jsx(tt,{asChild:true,isActive:location.pathname.includes(`/list/${p.plural}`),tooltip:ot(p.menu?.label??p.plural),children:jsxs(fo,{to:`list/${p.plural}`,children:[p.menu?.icon??createElement(rt[co(p.name)],{className:"fk:h-4 fk:w-4 fk:mr-2",strokeWidth:2}),jsx("span",{children:ot(p.menu?.label??p.plural)})]})})},p.plural))})]},s.name)),jsx(Ze,{children:jsx(Qe,{children:a.ungrouped?.map(s=>jsx(et,{children:jsx(tt,{asChild:true,isActive:location.pathname.includes(`/list/${s.plural}`),tooltip:ot(s.menu?.label??s.plural),children:jsxs(fo,{to:`list/${s.plural}`,children:[createElement(rt[co(s.name)],{className:"fk:h-4 fk:w-4 fk:mr-2",strokeWidth:2}),jsx("span",{children:ot(s.menu?.label??s.plural)})]})})},s.plural))})})]}),jsx(zt,{})]})}function ot(e){let t=e.replace(/([A-Z])/g," $1");return t.charAt(0).toUpperCase()+t.slice(1).trim()}function co(e){let t=Dn.search(e);return t.length>0?t[0].item.name:"Dock"}function Ue({...e}){return jsx(HoverCard.Root,{"data-slot":"hover-card",...e})}function Fe({...e}){return jsx(HoverCard.Trigger,{"data-slot":"hover-card-trigger",...e})}function _e({className:e,align:t="center",sideOffset:o=4,...r}){return jsx(HoverCard.Portal,{"data-slot":"hover-card-portal",children:jsx(HoverCard.Content,{"data-slot":"hover-card-content",align:t,sideOffset:o,className:a("fk:z-50 fk:w-64 fk:origin-(--radix-hover-card-content-transform-origin) fk:rounded-md fk:border fk:bg-popover fk:p-4 fk:text-popover-foreground fk:shadow-md fk:outline-hidden fk:data-[side=bottom]:slide-in-from-top-2 fk:data-[side=left]:slide-in-from-right-2 fk:data-[side=right]:slide-in-from-left-2 fk:data-[side=top]:slide-in-from-bottom-2 fk:data-[state=closed]:animate-out fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:zoom-out-95 fk:data-[state=open]:animate-in fk:data-[state=open]:fade-in-0 fk:data-[state=open]:zoom-in-95",e),...r})})}function Ot({className:e,...t}){return jsx(Loader2Icon,{role:"status","aria-label":"Loading",className:a("fk:size-4 fk:animate-spin",e),...t})}function Ut({className:e,...t}){return jsx("div",{"data-slot":"input-group",role:"group",className:a("fk:group/input-group fk:border-input fk:dark:bg-input/30 fk:shadow-xs fk:relative fk:flex fk:w-full fk:items-center fk:rounded-md fk:border fk:outline-none fk:transition-[color,box-shadow]","fk:h-9 fk:has-[>textarea]:h-auto","fk:has-[>[data-align=inline-start]]:[&>input]:pl-2","fk:has-[>[data-align=inline-end]]:[&>input]:pr-2","fk:has-[>[data-align=block-start]]:h-auto fk:has-[>[data-align=block-start]]:flex-col fk:has-[>[data-align=block-start]]:[&>input]:pb-3","fk:has-[>[data-align=block-end]]:h-auto fk:has-[>[data-align=block-end]]:flex-col fk:has-[>[data-align=block-end]]:[&>input]:pt-3","fk:has-[[data-slot=input-group-control]:focus-visible]:ring-ring fk:has-[[data-slot=input-group-control]:focus-visible]:ring-1","fk:has-[[data-slot][aria-invalid=true]]:ring-destructive/20 fk:has-[[data-slot][aria-invalid=true]]:border-destructive fk:dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...t})}var Gn=cva("fk:text-muted-foreground fk:flex fk:h-auto fk:cursor-text fk:select-none fk:items-center fk:justify-center fk:gap-2 fk:py-1.5 fk:text-sm fk:font-medium fk:group-data-[disabled=true]/input-group:opacity-50 fk:[&>kbd]:rounded-[calc(var(--radius)-5px)] fk:[&>svg:not([class*=size-])]:size-4",{variants:{align:{"inline-start":"fk:order-first fk:pl-3 fk:has-[>button]:ml-[-0.45rem] fk:has-[>kbd]:ml-[-0.35rem]","inline-end":"fk:order-last fk:pr-3 fk:has-[>button]:mr-[-0.4rem] fk:has-[>kbd]:mr-[-0.35rem]","block-start":"fk:[.border-b]:pb-3 fk:order-first fk:w-full fk:justify-start fk:px-3 fk:pt-3 fk:group-has-[>input]/input-group:pt-2.5","block-end":"fk:[.border-t]:pt-3 fk:order-last fk:w-full fk:justify-start fk:px-3 fk:pb-3 fk:group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function st({className:e,align:t="inline-start",...o}){return jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:a(Gn({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus();},...o})}var On=cva("fk:flex fk:items-center fk:gap-2 fk:text-sm fk:shadow-none",{variants:{size:{xs:"fk:h-6 fk:gap-1 fk:rounded-[calc(var(--radius)-5px)] fk:px-2 fk:has-[>svg]:px-2 fk:[&>svg:not([class*=size-])]:size-3.5",sm:"fk:h-8 fk:gap-1.5 fk:rounded-md fk:px-2.5 fk:has-[>svg]:px-2.5","icon-xs":"fk:size-6 fk:rounded-[calc(var(--radius)-5px)] fk:p-0 fk:has-[>svg]:p-0","icon-sm":"fk:size-8 fk:p-0 fk:has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function it({className:e,type:t="button",variant:o="ghost",size:r="xs",...a$1}){return jsx(b,{type:t,"data-size":r,variant:o,className:a(On({size:r}),e),...a$1})}function Un({className:e,...t}){return jsx("span",{className:a("fk:text-muted-foreground fk:flex fk:items-center fk:gap-2 fk:text-sm fk:[&_svg:not([class*=size-])]:size-4 fk:[&_svg]:pointer-events-none",e),...t})}function Fn({className:e,...t}){return jsx(a$2,{"data-slot":"input-group-control",className:a("fk:flex-1 fk:rounded-none fk:border-0 fk:bg-transparent fk:shadow-none fk:focus-visible:ring-0 fk:dark:bg-transparent",e),...t})}function Ft({className:e,...t}){return jsx(a$3,{"data-slot":"input-group-control",className:a("fk:flex-1 fk:resize-none fk:rounded-none fk:border-0 fk:bg-transparent fk:py-3 fk:shadow-none fk:focus-visible:ring-0 fk:dark:bg-transparent",e),...t})}var Jn={audio:Music2Icon,document:FileTextIcon,image:ImageIcon,source:GlobeIcon,unknown:PaperclipIcon,video:VideoIcon},bo=e=>{if(e.type==="source-document")return "source";let t=e.mediaType??"";return t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":t.startsWith("application/")||t.startsWith("text/")?"document":"unknown"},Yn=e=>{if(e.type==="source-document")return e.title||e.filename||"Source";let t=bo(e);return e.filename||(t==="image"?"Image":"Attachment")},Zn=(e,t,o)=>o?jsx("img",{alt:t||"Image",className:"fk:size-full fk:object-cover",height:96,src:e,width:96}):jsx("img",{alt:t||"Image",className:"fk:size-full fk:rounded fk:object-cover",height:20,src:e,width:20}),ho=createContext(null),xo=createContext(null),Qn=()=>useContext(ho)??{variant:"grid"},_t=()=>{let e=useContext(xo);if(!e)throw new Error("Attachment components must be used within <Attachment>");return e},_i=({variant:e="grid",className:t,children:o,...r})=>{let a$1=useMemo(()=>({variant:e}),[e]);return jsx(ho.Provider,{value:a$1,children:jsx("div",{className:a("fk:flex fk:items-start",e==="list"?"fk:flex-col fk:gap-2":"fk:flex-wrap fk:gap-2",e==="grid"&&"fk:ml-auto fk:w-fit",t),...r,children:o})})},Vi=({data:e,onRemove:t,className:o,children:r,...a$1})=>{let{variant:i}=Qn(),s=bo(e),p=useMemo(()=>({data:e,mediaCategory:s,onRemove:t,variant:i}),[e,s,t,i]);return jsx(xo.Provider,{value:p,children:jsx("div",{className:a("fk:group fk:relative",i==="grid"&&"fk:size-24 fk:overflow-hidden fk:rounded-lg",i==="inline"&&["fk:flex fk:h-8 fk:cursor-pointer fk:select-none fk:items-center fk:gap-1.5","fk:rounded-md fk:border fk:border-border fk:px-1.5","fk:font-medium fk:text-sm fk:transition-all","fk:hover:bg-accent fk:hover:text-accent-foreground fk:dark:hover:bg-accent/50"],i==="list"&&["fk:flex fk:w-full fk:items-center fk:gap-3 fk:rounded-lg fk:border fk:p-3","fk:hover:bg-accent/50"],o),...a$1,children:r})})},ji=({fallbackIcon:e,className:t,...o})=>{let{data:r,mediaCategory:a$1,variant:i}=_t(),s=i==="inline"?"fk:size-3":"fk:size-4",p=f=>jsx(f,{className:a(s,"fk:text-muted-foreground")}),l=()=>{if(a$1==="image"&&r.type==="file"&&r.url)return Zn(r.url,r.filename,i==="grid");if(a$1==="video"&&r.type==="file"&&r.url)return jsx("video",{className:"fk:size-full fk:object-cover",muted:true,src:r.url});let f=Jn[a$1];return e??p(f)};return jsx("div",{className:a("fk:flex fk:shrink-0 fk:items-center fk:justify-center fk:overflow-hidden",i==="grid"&&"fk:size-full fk:bg-muted",i==="inline"&&"fk:size-5 fk:rounded fk:bg-background",i==="list"&&"fk:size-12 fk:rounded fk:bg-muted",t),...o,children:l()})},Wi=({showMediaType:e=false,className:t,...o})=>{let{data:r,variant:a$1}=_t(),i=Yn(r);return a$1==="grid"?null:jsxs("div",{className:a("fk:min-w-0 fk:flex-1",t),...o,children:[jsx("span",{className:"fk:block fk:truncate",children:i}),e&&r.mediaType&&jsx("span",{className:"fk:block fk:truncate fk:text-muted-foreground fk:text-xs",children:r.mediaType})]})},$i=({label:e="Remove",className:t,children:o,...r})=>{let{onRemove:a$1,variant:i}=_t(),s=useCallback(p=>{p.stopPropagation(),a$1?.();},[a$1]);return a$1?jsxs(b,{"aria-label":e,className:a(i==="grid"&&["fk:absolute fk:top-2 fk:right-2 fk:size-6 fk:rounded-full fk:p-0","fk:bg-background/80 fk:backdrop-blur-sm","fk:opacity-0 fk:transition-opacity fk:group-hover:opacity-100","fk:hover:bg-background","fk:[&>svg]:size-3"],i==="inline"&&["fk:size-5 fk:rounded fk:p-0","fk:opacity-0 fk:transition-opacity fk:group-hover:opacity-100","fk:[&>svg]:size-2.5"],i==="list"&&["fk:size-8 fk:shrink-0 fk:rounded fk:p-0","fk:[&>svg]:size-4"],t),onClick:s,type:"button",variant:"ghost",...r,children:[o??jsx(XIcon,{}),jsx("span",{className:"fk:sr-only",children:e})]}):null},Ki=({openDelay:e=0,closeDelay:t=0,...o})=>jsx(Ue,{closeDelay:t,openDelay:e,...o}),qi=e=>jsx(Fe,{...e}),Xi=({align:e="start",className:t,...o})=>jsx(_e,{align:e,className:a("fk:w-auto fk:p-2",t),...o}),Ji=({className:e,children:t,...o})=>jsx("div",{className:a("fk:flex fk:items-center fk:justify-center fk:p-4 fk:text-muted-foreground fk:text-sm",e),...o,children:t??"No attachments"});var ia=e=>e&&e&1,pa=e=>e&&e&2,la=e=>e&&e&4,fa=e=>e.map((t,o)=>({key:`line-${o}`,tokens:t.map((r,a)=>({key:`line-${o}-${a}`,token:r}))})),ca=({token:e})=>jsx("span",{className:"fk:dark:bg-(--shiki-dark-bg)! fk:dark:text-(--shiki-dark)!",style:{backgroundColor:e.bgColor,color:e.color,fontStyle:ia(e.fontStyle)?"italic":void 0,fontWeight:pa(e.fontStyle)?"bold":void 0,textDecoration:la(e.fontStyle)?"underline":void 0,...e.htmlStyle},children:e.content}),da=a("fk:block","fk:before:content-[counter(line)]","fk:before:inline-block","fk:before:[counter-increment:line]","fk:before:w-8","fk:before:mr-4","fk:before:text-right","fk:before:text-muted-foreground/50","fk:before:font-mono","fk:before:select-none"),ua=({keyedLine:e,showLineNumbers:t})=>jsx("span",{className:t?da:"fk:block",children:e.tokens.length===0?`
|
|
2
|
+
`:e.tokens.map(({token:o,key:r})=>jsx(ca,{token:o},r))}),wo=createContext({code:""}),Co=new Map,Po=new Map,ue=new Map,ma=(e,t)=>{let o=e.slice(0,100),r=e.length>100?e.slice(-100):"";return `${t}:${e.length}:${o}:${r}`},ka=e=>{let t=Co.get(e);if(t)return t;let o=createHighlighter({langs:[e],themes:["github-light","github-dark"]});return Co.set(e,o),o},ga=e=>({bg:"transparent",fg:"inherit",tokens:e.split(`
|
|
3
|
+
`).map(t=>t===""?[]:[{color:"inherit",content:t}])}),yo=(e,t,o)=>{let r=ma(e,t),a=Po.get(r);return a||(o&&(ue.has(r)||ue.set(r,new Set),ue.get(r)?.add(o)),ka(t).then(i=>{let p=i.getLoadedLanguages().includes(t)?t:"text",l=i.codeToTokens(e,{lang:p,themes:{dark:"github-dark",light:"github-light"}}),f={bg:l.bg??"transparent",fg:l.fg??"inherit",tokens:l.tokens};Po.set(r,f);let m=ue.get(r);if(m){for(let k of m)k(f);ue.delete(r);}}).catch(i=>{console.error("Failed to highlight code:",i),ue.delete(r);}),null)},Mo=memo(({tokenized:e,showLineNumbers:t,className:o})=>{let r=useMemo(()=>({backgroundColor:e.bg,color:e.fg}),[e.bg,e.fg]),a$1=useMemo(()=>fa(e.tokens),[e.tokens]);return jsx("pre",{className:a("fk:dark:bg-(--shiki-dark-bg)! fk:dark:text-(--shiki-dark)! fk:m-0 fk:p-4 fk:text-sm",o),style:r,children:jsx("code",{className:a("fk:font-mono fk:text-sm",t&&"fk:[counter-increment:line_0] fk:[counter-reset:line]"),children:a$1.map(i=>jsx(ua,{keyedLine:i,showLineNumbers:t},i.key))})})},(e,t)=>e.tokenized===t.tokenized&&e.showLineNumbers===t.showLineNumbers&&e.className===t.className);Mo.displayName="CodeBlockBody";var ba=({className:e,language:t,style:o,...r})=>jsx("div",{className:a("fk:group fk:relative fk:w-full fk:overflow-hidden fk:rounded-md fk:border fk:bg-background fk:text-foreground",e),"data-language":t,style:{containIntrinsicSize:"auto 200px",contentVisibility:"auto",...o},...r}),ap=({children:e,className:t,...o})=>jsx("div",{className:a("fk:flex fk:items-center fk:justify-between fk:border-b fk:bg-muted/80 fk:px-3 fk:py-2 fk:text-muted-foreground fk:text-xs",t),...o,children:e}),sp=({children:e,className:t,...o})=>jsx("div",{className:a("fk:flex fk:items-center fk:gap-2",t),...o,children:e}),ip=({children:e,className:t,...o})=>jsx("span",{className:a("fk:font-mono",t),...o,children:e}),pp=({children:e,className:t,...o})=>jsx("div",{className:a("fk:-my-1 fk:-mr-1 fk:flex fk:items-center fk:gap-2",t),...o,children:e}),ha=({code:e,language:t,showLineNumbers:o=false})=>{let r=useMemo(()=>ga(e),[e]),a=useMemo(()=>yo(e,t)??r,[e,t,r]),[i,s]=useState(null),p=useRef({code:e,language:t});return (p.current.code!==e||p.current.language!==t)&&(p.current={code:e,language:t},s(null)),useEffect(()=>{let f=false;return yo(e,t,m=>{f||s(m);}),()=>{f=true;}},[e,t]),jsx("div",{className:"fk:relative fk:overflow-auto",children:jsx(Mo,{showLineNumbers:o,tokenized:i??a})})},pt=({code:e,language:t,showLineNumbers:o=false,className:r,children:a,...i})=>{let s=useMemo(()=>({code:e}),[e]);return jsx(wo.Provider,{value:s,children:jsxs(ba,{className:r,language:t,...i,children:[a,jsx(ha,{code:e,language:t,showLineNumbers:o})]})})},lp=({onCopy:e,onError:t,timeout:o=2e3,children:r,className:a$1,...i})=>{let[s,p]=useState(false),l=useRef(0),{code:f}=useContext(wo),m=useCallback(async()=>{if(typeof window>"u"||!navigator?.clipboard?.writeText){t?.(new Error("Clipboard API not available"));return}try{s||(await navigator.clipboard.writeText(f),p(!0),e?.(),l.current=window.setTimeout(()=>p(!1),o));}catch(g){t?.(g);}},[f,e,t,o,s]);useEffect(()=>()=>{window.clearTimeout(l.current);},[]);let k=s?CheckIcon:CopyIcon;return jsx(b,{className:a("fk:shrink-0",a$1),onClick:m,size:"icon",variant:"ghost",...i,children:r??jsx(k,{size:14})})},fp=e=>jsx(a$4,{...e}),cp=({className:e,...t})=>jsx(d,{className:a("fk:h-7 fk:border-none fk:bg-transparent fk:px-2 fk:text-xs fk:shadow-none",e),size:"sm",...t}),dp=e=>jsx(c$1,{...e}),up=({align:e="end",...t})=>jsx(e$1,{align:e,...t}),mp=e=>jsx(g,{...e});var Pp=({className:e,...t})=>jsx(StickToBottom,{className:a("fk:relative fk:flex-1 fk:overflow-y-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),yp=({className:e,...t})=>jsx(StickToBottom.Content,{className:a("fk:flex fk:flex-col fk:gap-8 fk:p-4",e),...t}),Sp=({className:e,title:t="No messages yet",description:o="Start a conversation to see messages here",icon:r,children:a$1,...i})=>jsx("div",{className:a("fk:flex fk:size-full fk:flex-col fk:items-center fk:justify-center fk:gap-3 fk:p-8 fk:text-center",e),...i,children:a$1??jsxs(Fragment,{children:[r&&jsx("div",{className:"fk:text-muted-foreground",children:r}),jsxs("div",{className:"fk:space-y-1",children:[jsx("h3",{className:"fk:font-medium fk:text-sm",children:t}),o&&jsx("p",{className:"fk:text-muted-foreground fk:text-sm",children:o})]})]})}),Tp=({className:e,...t})=>{let{isAtBottom:o,scrollToBottom:r}=useStickToBottomContext(),a$1=useCallback(()=>{r();},[r]);return !o&&jsx(b,{className:a("fk:absolute fk:bottom-4 fk:left-[50%] fk:translate-x-[-50%] fk:rounded-full fk:dark:bg-background fk:dark:hover:bg-muted",e),onClick:a$1,size:"icon",type:"button",variant:"outline",...t,children:jsx(ArrowDownIcon,{className:"fk:size-4"})})},ya=e=>e.parts.filter(t=>t.type==="text").map(t=>t.text).join(""),Lo=e=>`**${e.role.charAt(0).toUpperCase()+e.role.slice(1)}:** ${ya(e)}`,Sa=(e,t=Lo)=>e.map((o,r)=>t(o,r)).join(`
|
|
4
4
|
|
|
5
|
-
`),Np=({messages:e,filename:t="conversation.md",formatMessage:o=Po,className:r,children:a$1,...i})=>{let s=useCallback(()=>{let p=Sa(e,o),f=new Blob([p],{type:"text/markdown"}),c=URL.createObjectURL(f),g=document.createElement("a");g.href=c,g.download=t,document.body.append(g),g.click(),g.remove(),URL.revokeObjectURL(c);},[e,t,o]);return jsx(b,{className:a("fk:absolute fk:top-4 fk:right-4 fk:rounded-full fk:dark:bg-background fk:dark:hover:bg-muted",r),onClick:s,size:"icon",type:"button",variant:"outline",...i,children:a$1??jsx(DownloadIcon,{className:"fk:size-4"})})};var _p=({className:e,from:t,...o})=>jsx("div",{className:a("fk:group fk:flex fk:w-full fk:max-w-[95%] fk:flex-col fk:gap-2",t==="user"?"fk:is-user fk:ml-auto fk:justify-end":"fk:is-assistant",e),...o}),jp=({children:e,className:t,...o})=>jsx("div",{className:a("fk:is-user:dark fk:flex fk:w-fit fk:min-w-0 fk:max-w-full fk:flex-col fk:gap-2 fk:overflow-hidden fk:text-sm","fk:group-[.is-user]:ml-auto fk:group-[.is-user]:rounded-lg fk:group-[.is-user]:bg-secondary fk:group-[.is-user]:px-4 fk:group-[.is-user]:py-3 fk:group-[.is-user]:text-foreground","fk:group-[.is-assistant]:text-foreground",t),...o,children:e}),Wp=({className:e,children:t,...o})=>jsx("div",{className:a("fk:flex fk:items-center fk:gap-1",e),...o,children:t}),$p=({tooltip:e$1,children:t,label:o,variant:r="ghost",size:a="icon-sm",...i})=>{let s=jsxs(b,{size:a,type:"button",variant:r,...i,children:[t,jsx("span",{className:"fk:sr-only",children:o||e$1})]});return e$1?jsx(a$1,{children:jsxs(b$1,{children:[jsx(c,{asChild:true,children:s}),jsx(e,{children:jsx("p",{children:e$1})})]})}):s},So=createContext(null),Ne=()=>{let e=useContext(So);if(!e)throw new Error("MessageBranch components must be used within MessageBranch");return e},Kp=({defaultBranch:e=0,onBranchChange:t,className:o,...r})=>{let[a$1,i]=useState(e),[s,p]=useState([]),f=useCallback(k=>{i(k),t?.(k);},[t]),c=useCallback(()=>{let k=a$1>0?a$1-1:s.length-1;f(k);},[a$1,s.length,f]),g=useCallback(()=>{let k=a$1<s.length-1?a$1+1:0;f(k);},[a$1,s.length,f]),m=useMemo(()=>({branches:s,currentBranch:a$1,goToNext:g,goToPrevious:c,setBranches:p,totalBranches:s.length}),[s,a$1,g,c]);return jsx(So.Provider,{value:m,children:jsx("div",{className:a("fk:grid fk:w-full fk:gap-2 fk:[&>div]:pb-0",o),...r})})},qp=({children:e,...t})=>{let{currentBranch:o,setBranches:r,branches:a$1}=Ne(),i=useMemo(()=>Array.isArray(e)?e:[e],[e]);return useEffect(()=>{a$1.length!==i.length&&r(i);},[i,a$1,r]),i.map((s,p)=>jsx("div",{className:a("fk:grid fk:gap-2 fk:overflow-hidden fk:[&>div]:pb-0",p===o?"fk:block":"fk:hidden"),...t,children:s},s.key))},Xp=({className:e,...t})=>{let{totalBranches:o}=Ne();return o<=1?null:jsx(It,{className:a("fk:[&>*:not(:first-child)]:rounded-l-md fk:[&>*:not(:last-child)]:rounded-r-md",e),orientation:"horizontal",...t})},Jp=({children:e,...t})=>{let{goToPrevious:o,totalBranches:r}=Ne();return jsx(b,{"aria-label":"Previous branch",disabled:r<=1,onClick:o,size:"icon-sm",type:"button",variant:"ghost",...t,children:e??jsx(ChevronLeftIcon,{size:14})})},Yp=({children:e,...t})=>{let{goToNext:o,totalBranches:r}=Ne();return jsx(b,{"aria-label":"Next branch",disabled:r<=1,onClick:o,size:"icon-sm",type:"button",variant:"ghost",...t,children:e??jsx(ChevronRightIcon,{size:14})})},Zp=({className:e,...t})=>{let{currentBranch:o,totalBranches:r}=Ne();return jsxs(wt,{className:a("fk:border-none fk:bg-transparent fk:text-muted-foreground fk:shadow-none",e),...t,children:[o+1," of ",r]})},Ha={cjk:cjk,code:code,math:math,mermaid:mermaid},Ga=memo(({className:e,...t})=>jsx(Streamdown,{className:a("fk:size-full fk:[&>*:first-child]:mt-0 fk:[&>*:last-child]:mb-0",e),plugins:Ha,...t}),(e,t)=>e.children===t.children&&t.isAnimating===e.isAnimating);Ga.displayName="MessageResponse";var Qp=({className:e,children:t,...o})=>jsx("div",{className:a("fk:mt-4 fk:flex fk:w-full fk:items-center fk:justify-between fk:gap-4",e),...o,children:t});var al=e=>jsx(c$2,{...e}),sl=e=>jsx(d$1,{...e}),il=({className:e,children:t,title:o="Model Selector",...r})=>jsxs(h,{"aria-describedby":void 0,className:a("fk:outline! fk:border-none! fk:p-0 fk:outline-border! fk:outline-solid!",e),...r,children:[jsx(k$1,{className:"fk:sr-only",children:o}),jsx(m,{className:"fk:**:data-[slot=command-input-wrapper]:h-auto",children:t})]}),pl=e=>jsx(n,{...e}),ll=({className:e,...t})=>jsx(o,{className:a("fk:h-auto fk:py-3.5",e),...t}),fl=e=>jsx(p,{...e}),cl=e=>jsx(q,{...e}),dl=e=>jsx(r,{...e}),ul=e=>jsx(t,{...e}),ml=e=>jsx(u,{...e}),kl=e=>jsx(s,{...e}),gl=({provider:e,className:t,...o})=>jsx("img",{...o,alt:`${e} logo`,className:a("fk:size-3 fk:dark:invert",t),height:12,src:`https://models.dev/logos/${e}.svg`,width:12}),bl=({className:e,...t})=>jsx("div",{className:a("fk:flex fk:shrink-0 fk:items-center fk:-space-x-1 fk:[&>img]:rounded-full fk:[&>img]:bg-background fk:[&>img]:p-px fk:[&>img]:ring-1 fk:dark:[&>img]:bg-foreground",e),...t}),hl=({className:e,...t})=>jsx("span",{className:a("fk:flex-1 fk:truncate fk:text-left",e),...t});var Ka=async e=>{try{let o=await(await fetch(e)).blob();return new Promise(r=>{let a=new FileReader;a.onloadend=()=>r(a.result),a.onerror=()=>r(null),a.readAsDataURL(o);})}catch{return null}},qa=async()=>{if(typeof navigator>"u"||!navigator.mediaDevices?.getDisplayMedia)return null;let e=null,t=document.createElement("video");t.muted=true,t.playsInline=true;try{e=await navigator.mediaDevices.getDisplayMedia({audio:!1,video:!0}),t.srcObject=e,await new Promise((f,c)=>{t.onloadedmetadata=()=>f(),t.onerror=()=>c(new Error("Failed to load screen stream"));}),await t.play();let o=t.videoWidth,r=t.videoHeight;if(!o||!r)return null;let a=document.createElement("canvas");a.width=o,a.height=r;let i=a.getContext("2d");if(!i)return null;i.drawImage(t,0,0,o,r);let s=await new Promise(f=>{a.toBlob(f,"image/png");});if(!s)return null;let p=new Date().toISOString().replaceAll(/[:.]/g,"-").replace("T","_").replace("Z","");return new File([s],`screenshot-${p}.png`,{lastModified:Date.now(),type:"image/png"})}finally{if(e)for(let o of e.getTracks())o.stop();t.pause(),t.srcObject=null;}},zt=createContext(null),Et=createContext(null),Bl=()=>{let e=useContext(zt);if(!e)throw new Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return e},To=()=>useContext(zt),Al=()=>{let e=useContext(Et);if(!e)throw new Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return e},Xa=()=>useContext(Et),Dl=({initialInput:e="",children:t})=>{let[o,r]=useState(e),a=useCallback(()=>r(""),[]),[i,s]=useState([]),p=useRef(null),f=useRef(()=>{}),c=useCallback(d=>{let v=Array.from(d);v.length!==0&&s(O=>[...O,...v.map(D=>({filename:D.name,id:nanoid(),mediaType:D.type,type:"file",url:URL.createObjectURL(D)}))]);},[]),g=useCallback(d=>{s(v=>{let O=v.find(D=>D.id===d);return O?.url&&URL.revokeObjectURL(O.url),v.filter(D=>D.id!==d)});},[]),m=useCallback(()=>{s(d=>{for(let v of d)v.url&&URL.revokeObjectURL(v.url);return []});},[]),k=useRef(i);useEffect(()=>{k.current=i;},[i]),useEffect(()=>()=>{for(let d of k.current)d.url&&URL.revokeObjectURL(d.url);},[]);let T=useCallback(()=>{f.current?.();},[]),h=useMemo(()=>({add:c,clear:m,fileInputRef:p,files:i,openFileDialog:T,remove:g}),[i,c,g,m,T]),M=useCallback((d,v)=>{p.current=d.current,f.current=v;},[]),A=useMemo(()=>({__registerFileInput:M,attachments:h,textInput:{clear:a,setInput:r,value:o}}),[o,a,h,M]);return jsx(zt.Provider,{value:A,children:jsx(Et.Provider,{value:h,children:t})})},Io=createContext(null),Ht=()=>{let e=Xa(),o=useContext(Io)??e;if(!o)throw new Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return o},wo=createContext(null),zl=()=>{let e=useContext(wo);if(!e)throw new Error("usePromptInputReferencedSources must be used within a LocalReferencedSourcesContext.Provider");return e},El=({label:e="Add photos or files",...t})=>{let o=Ht(),r=useCallback(a=>{a.preventDefault(),o.openFileDialog();},[o]);return jsxs(h$1,{...t,onSelect:r,children:[jsx(ImageIcon,{className:"fk:mr-2 fk:size-4"})," ",e]})},Hl=({label:e="Take screenshot",onSelect:t,...o})=>{let r=Ht(),a=useCallback(async i=>{if(t?.(i),!i.defaultPrevented)try{let s=await qa();s&&r.add([s]);}catch(s){if(s instanceof DOMException&&(s.name==="NotAllowedError"||s.name==="AbortError"))return;throw s}},[t,r]);return jsxs(h$1,{...o,onSelect:a,children:[jsx(Monitor,{className:"fk:mr-2 fk:size-4"}),e]})},Gl=({className:e,accept:t,multiple:o,globalDrop:r,syncHiddenInput:a$1,maxFiles:i,maxFileSize:s,onError:p,onSubmit:f,children:c,...g})=>{let m=To(),k=!!m,T=useRef(null),h=useRef(null),[M,A]=useState([]),d=k?m.attachments.files:M,[v,O]=useState([]),D=useRef(d);useEffect(()=>{D.current=d;},[d]);let Ho=useCallback(()=>{T.current?.click();},[]),Be=useCallback(u=>!t||t.trim()===""?true:t.split(",").map(b=>b.trim()).filter(Boolean).some(b=>{if(b.endsWith("/*")){let C=b.slice(0,-1);return u.type.startsWith(C)}return u.type===b}),[t]),Go=useCallback(u=>{let x=Array.from(u),b=x.filter(V=>Be(V));if(x.length&&b.length===0){p?.({code:"accept",message:"No files match the accepted types."});return}let C=V=>s?V.size<=s:true,E=b.filter(C);if(b.length>0&&E.length===0){p?.({code:"max_file_size",message:"All files exceed the maximum size."});return}A(V=>{let L=typeof i=="number"?Math.max(0,i-V.length):void 0,J=typeof L=="number"?E.slice(0,L):E;typeof L=="number"&&E.length>L&&p?.({code:"max_files",message:"Too many files. Some were not added."});let Y=[];for(let Ze of J)Y.push({filename:Ze.name,id:nanoid(),mediaType:Ze.type,type:"file",url:URL.createObjectURL(Ze)});return [...V,...Y]});},[Be,i,s,p]),Oo=useCallback(u=>A(x=>{let b=x.find(C=>C.id===u);return b?.url&&URL.revokeObjectURL(b.url),x.filter(C=>C.id!==u)}),[]),Uo=useCallback(u=>{let x=Array.from(u),b=x.filter(Y=>Be(Y));if(x.length&&b.length===0){p?.({code:"accept",message:"No files match the accepted types."});return}let C=Y=>s?Y.size<=s:true,E=b.filter(C);if(b.length>0&&E.length===0){p?.({code:"max_file_size",message:"All files exceed the maximum size."});return}let V=d.length,L=typeof i=="number"?Math.max(0,i-V):void 0,J=typeof L=="number"?E.slice(0,L):E;typeof L=="number"&&E.length>L&&p?.({code:"max_files",message:"Too many files. Some were not added."}),J.length>0&&m?.attachments.add(J);},[Be,s,i,p,d.length,m]),Ae=useCallback(()=>k?m?.attachments.clear():A(u=>{for(let x of u)x.url&&URL.revokeObjectURL(x.url);return []}),[k,m]),De=useCallback(()=>O([]),[]),j=k?Uo:Go,_t=k?m.attachments.remove:Oo,jt=k?m.attachments.openFileDialog:Ho,Ye=useCallback(()=>{Ae(),De();},[Ae,De]);useEffect(()=>{k&&m.__registerFileInput(T,()=>T.current?.click());},[k,m]),useEffect(()=>{a$1&&T.current&&d.length===0&&(T.current.value="");},[d,a$1]),useEffect(()=>{let u=h.current;if(!u||r)return;let x=C=>{C.dataTransfer?.types?.includes("Files")&&C.preventDefault();},b=C=>{C.dataTransfer?.types?.includes("Files")&&C.preventDefault(),C.dataTransfer?.files&&C.dataTransfer.files.length>0&&j(C.dataTransfer.files);};return u.addEventListener("dragover",x),u.addEventListener("drop",b),()=>{u.removeEventListener("dragover",x),u.removeEventListener("drop",b);}},[j,r]),useEffect(()=>{if(!r)return;let u=b=>{b.dataTransfer?.types?.includes("Files")&&b.preventDefault();},x=b=>{b.dataTransfer?.types?.includes("Files")&&b.preventDefault(),b.dataTransfer?.files&&b.dataTransfer.files.length>0&&j(b.dataTransfer.files);};return document.addEventListener("dragover",u),document.addEventListener("drop",x),()=>{document.removeEventListener("dragover",u),document.removeEventListener("drop",x);}},[j,r]),useEffect(()=>()=>{if(!k)for(let u of D.current)u.url&&URL.revokeObjectURL(u.url);},[k]);let Vo=useCallback(u=>{u.currentTarget.files&&j(u.currentTarget.files),u.currentTarget.value="";},[j]),Fo=useMemo(()=>({add:j,clear:Ae,fileInputRef:T,files:d.map(u=>({...u,id:u.id})),openFileDialog:jt,remove:_t}),[d,j,_t,Ae,jt]),_o=useMemo(()=>({add:u=>{let x=Array.isArray(u)?u:[u];O(b=>[...b,...x.map(C=>({...C,id:nanoid()}))]);},clear:De,remove:u=>{O(x=>x.filter(b=>b.id!==u));},sources:v}),[v,De]),jo=useCallback(async u=>{u.preventDefault();let x=u.currentTarget,b=k?m.textInput.value:new FormData(x).get("message")||"";k||x.reset();try{let C=await Promise.all(d.map(async({id:V,...L})=>{if(L.url?.startsWith("blob:")){let J=await Ka(L.url);return {...L,url:J??L.url}}return L})),E=f({files:C,text:b},u);if(E instanceof Promise)try{await E,Ye(),k&&m.textInput.clear();}catch{}else Ye(),k&&m.textInput.clear();}catch{}},[k,m,d,f,Ye]),Wo=jsxs(Fragment,{children:[jsx("input",{accept:t,"aria-label":"Upload files",className:"fk:hidden",multiple:o,onChange:Vo,ref:T,title:"Upload files",type:"file"}),jsx("form",{className:a("fk:w-full",e),onSubmit:jo,ref:h,...g,children:jsx(Nt,{className:"fk:overflow-hidden",children:c})})]}),$o=jsx(wo.Provider,{value:_o,children:Wo});return jsx(Io.Provider,{value:Fo,children:$o})},Ol=({className:e,...t})=>jsx("div",{className:a("fk:contents",e),...t}),Ul=({onChange:e,onKeyDown:t,className:o,placeholder:r="What would you like to know?",...a$1})=>{let i=To(),s=Ht(),[p,f]=useState(false),c=useCallback(h=>{if(t?.(h),!h.defaultPrevented){if(h.key==="Enter"){if(p||h.nativeEvent.isComposing||h.shiftKey)return;h.preventDefault();let{form:M}=h.currentTarget;if(M?.querySelector('button[type="submit"]')?.disabled)return;M?.requestSubmit();}if(h.key==="Backspace"&&h.currentTarget.value===""&&s.files.length>0){h.preventDefault();let M=s.files[s.files.length-1];M&&s.remove(M.id);}}},[t,p,s]),g=useCallback(h=>{let M=h.clipboardData?.items;if(!M)return;let A=[];for(let d of Array.from(M))if(d.kind==="file"){let v=d.getAsFile();v&&A.push(v);}A.length>0&&(h.preventDefault(),s.add(A));},[s]),m=useCallback(()=>f(false),[]),k=useCallback(()=>f(true),[]),T=i?{onChange:h=>{i.textInput.setInput(h.currentTarget.value),e?.(h);},value:i.textInput.value}:{onChange:e};return jsx(Rt,{className:a("fk:field-sizing-content fk:max-h-48 fk:min-h-16",o),name:"message",onCompositionEnd:m,onCompositionStart:k,onKeyDown:c,onPaste:g,placeholder:r,...a$1,...T})},Vl=({className:e,...t})=>jsx($e,{align:"block-end",className:a("fk:order-first fk:flex-wrap fk:gap-1",e),...t}),Fl=({className:e,...t})=>jsx($e,{align:"block-end",className:a("fk:justify-between fk:gap-1",e),...t}),_l=({className:e,...t})=>jsx("div",{className:a("fk:flex fk:min-w-0 fk:items-center fk:gap-1",e),...t}),Ja=({variant:e$1="ghost",className:t,size:o,tooltip:r,...a$1})=>{let i=o??(Children.count(a$1.children)>1?"sm":"icon-sm"),s=jsx(Ke,{className:a(t),size:i,type:"button",variant:e$1,...a$1});if(!r)return s;let p=typeof r=="string"?r:r.content,f=typeof r=="string"?void 0:r.shortcut,c$1=typeof r=="string"?"top":r.side??"top";return jsxs(b$1,{children:[jsx(c,{asChild:true,children:s}),jsxs(e,{side:c$1,children:[p,f&&jsx("span",{className:"fk:ml-2 fk:text-muted-foreground",children:f})]})]})},jl=e=>jsx(c$3,{...e}),Wl=({className:e,children:t,...o})=>jsx(e$2,{asChild:true,children:jsx(Ja,{className:e,...o,children:t??jsx(PlusIcon,{className:"fk:size-4"})})}),$l=({className:e,...t})=>jsx(f,{align:"start",className:a(e),...t}),Kl=({className:e,...t})=>jsx(h$1,{className:a(e),...t}),ql=({className:e,variant:t="default",size:o="icon-sm",status:r,onStop:a$1,onClick:i,children:s,...p})=>{let f=r==="submitted"||r==="streaming",c=jsx(CornerDownLeftIcon,{className:"fk:size-4"});r==="submitted"?c=jsx(Tt,{}):r==="streaming"?c=jsx(SquareIcon,{className:"fk:size-4"}):r==="error"&&(c=jsx(XIcon,{className:"fk:size-4"}));let g=useCallback(m=>{if(f&&a$1){m.preventDefault(),a$1();return}i?.(m);},[f,a$1,i]);return jsx(Ke,{"aria-label":f?"Stop":"Submit",className:a(e),onClick:g,size:o,type:f&&a$1?"button":"submit",variant:t,...p,children:s??c})},Xl=e=>jsx(a$4,{...e}),Jl=({className:e,...t})=>jsx(d,{className:a("fk:border-none fk:bg-transparent fk:font-medium fk:text-muted-foreground fk:shadow-none fk:transition-colors","fk:hover:bg-accent fk:hover:text-foreground fk:aria-expanded:bg-accent fk:aria-expanded:text-foreground",e),...t}),Yl=({className:e,...t})=>jsx(e$1,{className:a(e),...t}),Zl=({className:e,...t})=>jsx(g$1,{className:a(e),...t}),Ql=({className:e,...t})=>jsx(c$1,{className:a(e),...t}),ef=({openDelay:e=0,closeDelay:t=0,...o})=>jsx(Te,{closeDelay:t,openDelay:e,...o}),tf=e=>jsx(Ie,{...e}),of=({align:e="start",...t})=>jsx(we,{align:e,...t}),rf=({className:e,...t})=>jsx("div",{className:a(e),...t}),nf=({className:e,...t})=>jsx("div",{className:a(e),...t}),af=({className:e,...t})=>jsx("h3",{className:a("fk:mb-2 fk:px-3 fk:font-medium fk:text-muted-foreground fk:text-xs",e),...t}),sf=({className:e,...t})=>jsx("div",{className:a("fk:space-y-1",e),...t}),pf=({className:e,...t})=>jsx("div",{className:a("fk:flex fk:items-center fk:gap-2 fk:px-3 fk:py-2 fk:text-xs fk:hover:bg-accent",e),...t}),lf=({className:e,...t})=>jsx(m,{className:a(e),...t}),ff=({className:e,...t})=>jsx(o,{className:a(e),...t}),cf=({className:e,...t})=>jsx(p,{className:a(e),...t}),df=({className:e,...t})=>jsx(q,{className:a(e),...t}),uf=({className:e,...t})=>jsx(r,{className:a(e),...t}),mf=({className:e,...t$1})=>jsx(t,{className:a(e),...t$1}),kf=({className:e,...t})=>jsx(s,{className:a(e),...t});var Mo=new Map,ts=e=>{let t=Mo.get(e);return t||(t=motion.create(e),Mo.set(e,t)),t},os=({children:e,as:t="p",className:o,duration:r=2,spread:a$1=2})=>{let i=ts(t),s=useMemo(()=>(e?.length??0)*a$1,[e,a$1]);return jsx(i,{animate:{backgroundPosition:"0% center"},className:a("fk:relative fk:inline-block fk:bg-[length:250%_100%,auto] fk:bg-clip-text fk:text-transparent","fk:[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] fk:[background-repeat:no-repeat,padding-box]",o),initial:{backgroundPosition:"100% center"},style:{"--spread":`${s}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"},transition:{duration:r,ease:"linear",repeat:Number.POSITIVE_INFINITY},children:e})},Gt=memo(os);var Lo=createContext(null),gs=()=>{let e=useContext(Lo);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},bs=1e3,hs=1e3,vs=memo(({className:e,isStreaming:t=false,open:o,defaultOpen:r,onOpenChange:a$1,duration:i$1,children:s,...p})=>{let f=r??t,c=r===false,[g,m]=useControllableState({defaultProp:f,onChange:a$1,prop:o}),[k,T]=useControllableState({defaultProp:void 0,prop:i$1}),h=useRef(t),[M,A]=useState(false),d=useRef(null);useEffect(()=>{t?(h.current=true,d.current===null&&(d.current=Date.now())):d.current!==null&&(T(Math.ceil((Date.now()-d.current)/hs)),d.current=null);},[t,T]),useEffect(()=>{t&&!g&&!c&&m(true);},[t,g,m,c]),useEffect(()=>{if(h.current&&!t&&g&&!M){let D=setTimeout(()=>{m(false),A(true);},bs);return ()=>clearTimeout(D)}},[t,g,m,M]);let v=useCallback(D=>{m(D);},[m]),O=useMemo(()=>({duration:k,isOpen:g,isStreaming:t,setIsOpen:m}),[k,g,t,m]);return jsx(Lo.Provider,{value:O,children:jsx(i,{className:a("fk:not-prose fk:mb-4",e),onOpenChange:v,open:g,...p,children:s})})}),xs=(e,t)=>e||t===0?jsx(Gt,{duration:1,children:"Thinking..."}):t===void 0?jsx("p",{children:"Thought for a few seconds"}):jsxs("p",{children:["Thought for ",t," seconds"]}),Ps=memo(({className:e,children:t,getThinkingMessage:o=xs,...r})=>{let{isStreaming:a$1,isOpen:i,duration:s}=gs();return jsx(j,{className:a("fk:flex fk:w-full fk:items-center fk:gap-2 fk:text-muted-foreground fk:text-sm fk:transition-colors fk:hover:text-foreground",e),...r,children:t??jsxs(Fragment,{children:[jsx(BrainIcon,{className:"fk:size-4"}),o(a$1,s),jsx(ChevronDownIcon,{className:a("fk:size-4 fk:transition-transform",i?"fk:rotate-180":"fk:rotate-0")})]})})}),Cs={cjk:cjk,code:code,math:math,mermaid:mermaid},ys=memo(({className:e,children:t,...o})=>jsx(k,{className:a("fk:mt-4 fk:text-sm","fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:slide-out-to-top-2 fk:data-[state=open]:slide-in-from-top-2 fk:text-muted-foreground fk:outline-none fk:data-[state=closed]:animate-out fk:data-[state=open]:animate-in",e),...o,children:jsx(Streamdown,{plugins:Cs,children:t})}));vs.displayName="Reasoning";Ps.displayName="ReasoningTrigger";ys.displayName="ReasoningContent";var Of=({className:e,...t})=>jsx(i,{className:a("fk:not-prose fk:mb-4 fk:text-primary fk:text-xs",e),...t}),Uf=({className:e,count:t,children:o,...r})=>jsx(j,{className:a("fk:flex fk:items-center fk:gap-2",e),...r,children:o??jsxs(Fragment,{children:[jsxs("p",{className:"fk:font-medium",children:["Used ",t," sources"]}),jsx(ChevronDownIcon,{className:"fk:h-4 fk:w-4"})]})}),Vf=({className:e,...t})=>jsx(k,{className:a("fk:mt-3 fk:flex fk:w-fit fk:flex-col fk:gap-2","fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:slide-out-to-top-2 fk:data-[state=open]:slide-in-from-top-2 fk:outline-none fk:data-[state=closed]:animate-out fk:data-[state=open]:animate-in",e),...t}),Ff=({href:e,title:t,children:o,...r})=>jsx("a",{className:"fk:flex fk:items-center fk:gap-2",href:e,rel:"noreferrer",target:"_blank",...r,children:o??jsxs(Fragment,{children:[jsx(BookIcon,{className:"fk:h-4 fk:w-4"}),jsx("span",{className:"fk:block fk:font-medium",children:t})]})});var Xf=({className:e,children:t,...o})=>jsxs(v,{className:"fk:w-full fk:overflow-x-auto fk:whitespace-nowrap",...o,children:[jsx("div",{className:a("fk:flex fk:w-max fk:flex-nowrap fk:items-center fk:gap-2",e),children:t}),jsx(w,{className:"fk:hidden",orientation:"horizontal"})]}),Jf=({suggestion:e,onClick:t,className:o,variant:r="outline",size:a$1="sm",children:i,...s})=>{let p=useCallback(()=>{t?.(e);},[t,e]);return jsx(b,{className:a("fk:cursor-pointer fk:rounded-full fk:px-4",o),onClick:p,size:a$1,type:"button",variant:r,...s,children:i||e})};var ac=({className:e,...t})=>jsx(i,{className:a("fk:group fk:not-prose fk:mb-4 fk:w-full fk:rounded-md fk:border",e),...t}),As={"approval-requested":"Awaiting Approval","approval-responded":"Responded","input-available":"Running","input-streaming":"Pending","output-available":"Completed","output-denied":"Denied","output-error":"Error"},Ds={"approval-requested":jsx(ClockIcon,{className:"fk:size-4 fk:text-yellow-600"}),"approval-responded":jsx(CheckCircleIcon,{className:"fk:size-4 fk:text-blue-600"}),"input-available":jsx(ClockIcon,{className:"fk:size-4 fk:animate-pulse"}),"input-streaming":jsx(CircleIcon,{className:"fk:size-4"}),"output-available":jsx(CheckCircleIcon,{className:"fk:size-4 fk:text-green-600"}),"output-denied":jsx(XCircleIcon,{className:"fk:size-4 fk:text-orange-600"}),"output-error":jsx(XCircleIcon,{className:"fk:size-4 fk:text-red-600"})},zs=e=>jsxs(b$2,{className:"fk:gap-1.5 fk:py-px fk:rounded-full fk:text-xs",variant:"secondary",children:[Ds[e],As[e]]}),sc=({className:e,title:t,type:o,state:r,toolName:a$1,...i})=>{let s=o==="dynamic-tool"?a$1:o.split("-").slice(1).join("-");return jsxs(j,{className:a("fk:flex fk:w-full fk:items-center fk:justify-between fk:gap-4 fk:px-3 fk:py-2",e),...i,children:[jsxs("div",{className:"fk:flex fk:items-center fk:gap-2",children:[jsx(WrenchIcon,{className:"fk:size-4 fk:text-muted-foreground"}),jsx("span",{className:"fk:font-medium fk:text-sm",children:t??s}),zs(r)]}),jsx(ChevronDownIcon,{className:"fk:size-4 fk:text-muted-foreground fk:transition-transform fk:group-data-[state=open]:rotate-180"})]})},ic=({className:e,...t})=>jsx(k,{className:a("fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:slide-out-to-top-2 fk:data-[state=open]:slide-in-from-top-2 fk:space-y-4 fk:p-4 fk:text-popover-foreground fk:outline-none fk:data-[state=closed]:animate-out fk:data-[state=open]:animate-in",e),...t}),pc=({className:e,input:t,...o})=>jsxs("div",{className:a("fk:space-y-2 fk:overflow-hidden",e),...o,children:[jsx("h4",{className:"fk:font-medium fk:text-muted-foreground fk:text-xs fk:uppercase fk:tracking-wide",children:"Parameters"}),jsx("div",{className:"fk:rounded-md fk:bg-muted/50",children:jsx(qe,{code:JSON.stringify(t,null,2),language:"json"})})]}),lc=({className:e,output:t,errorText:o,...r})=>{if(!(t||o))return null;let a$1=jsx("div",{children:t});return typeof t=="object"&&!isValidElement(t)?a$1=jsx(qe,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(a$1=jsx(qe,{code:t,language:"json"})),jsxs("div",{className:a("fk:space-y-2",e),...r,children:[jsx("h4",{className:"fk:font-medium fk:text-muted-foreground fk:text-xs fk:uppercase fk:tracking-wide",children:o?"Error":"Result"}),jsxs("div",{className:a("fk:overflow-x-auto fk:rounded-md fk:text-xs fk:[&_table]:w-full",o?"fk:bg-destructive/10 fk:text-destructive":"fk:bg-muted/50 fk:text-foreground"),children:[o&&jsx("div",{children:o}),a$1]})]})};
|
|
6
|
-
export{
|
|
5
|
+
`),Ip=({messages:e,filename:t="conversation.md",formatMessage:o=Lo,className:r,children:a$1,...i})=>{let s=useCallback(()=>{let p=Sa(e,o),l=new Blob([p],{type:"text/markdown"}),f=URL.createObjectURL(l),m=document.createElement("a");m.href=f,m.download=t,document.body.append(m),m.click(),m.remove(),URL.revokeObjectURL(f);},[e,t,o]);return jsx(b,{className:a("fk:absolute fk:top-4 fk:right-4 fk:rounded-full fk:dark:bg-background fk:dark:hover:bg-muted",r),onClick:s,size:"icon",type:"button",variant:"outline",...i,children:a$1??jsx(DownloadIcon,{className:"fk:size-4"})})};var Up=({className:e,from:t,...o})=>jsx("div",{className:a("fk:group fk:flex fk:w-full fk:max-w-[95%] fk:flex-col fk:gap-2",t==="user"?"fk:is-user fk:ml-auto fk:justify-end":"fk:is-assistant",e),...o}),Fp=({children:e,className:t,...o})=>jsx("div",{className:a("fk:is-user:dark fk:flex fk:w-fit fk:min-w-0 fk:max-w-full fk:flex-col fk:gap-2 fk:overflow-hidden fk:text-sm","fk:group-[.is-user]:ml-auto fk:group-[.is-user]:rounded-lg fk:group-[.is-user]:bg-secondary fk:group-[.is-user]:px-4 fk:group-[.is-user]:py-3 fk:group-[.is-user]:text-foreground","fk:group-[.is-assistant]:text-foreground",t),...o,children:e}),_p=({className:e,children:t,...o})=>jsx("div",{className:a("fk:flex fk:items-center fk:gap-1",e),...o,children:t}),Vp=({tooltip:e$1,children:t,label:o,variant:r="ghost",size:a="icon-sm",...i})=>{let s=jsxs(b,{size:a,type:"button",variant:r,...i,children:[t,jsx("span",{className:"fk:sr-only",children:o||e$1})]});return e$1?jsx(a$1,{children:jsxs(b$1,{children:[jsx(c,{asChild:true,children:s}),jsx(e,{children:jsx("p",{children:e$1})})]})}):s},Eo=createContext(null),je=()=>{let e=useContext(Eo);if(!e)throw new Error("MessageBranch components must be used within MessageBranch");return e},jp=({defaultBranch:e=0,onBranchChange:t,className:o,...r})=>{let[a$1,i]=useState(e),[s,p]=useState([]),l=useCallback(g=>{i(g),t?.(g);},[t]),f=useCallback(()=>{let g=a$1>0?a$1-1:s.length-1;l(g);},[a$1,s.length,l]),m=useCallback(()=>{let g=a$1<s.length-1?a$1+1:0;l(g);},[a$1,s.length,l]),k=useMemo(()=>({branches:s,currentBranch:a$1,goToNext:m,goToPrevious:f,setBranches:p,totalBranches:s.length}),[s,a$1,m,f]);return jsx(Eo.Provider,{value:k,children:jsx("div",{className:a("fk:grid fk:w-full fk:gap-2 fk:[&>div]:pb-0",o),...r})})},Wp=({children:e,...t})=>{let{currentBranch:o,setBranches:r,branches:a$1}=je(),i=useMemo(()=>Array.isArray(e)?e:[e],[e]);return useEffect(()=>{a$1.length!==i.length&&r(i);},[i,a$1,r]),i.map((s,p)=>jsx("div",{className:a("fk:grid fk:gap-2 fk:overflow-hidden fk:[&>div]:pb-0",p===o?"fk:block":"fk:hidden"),...t,children:s},s.key))},$p=({className:e,...t})=>{let{totalBranches:o}=je();return o<=1?null:jsx(b$2,{className:a("fk:[&>*:not(:first-child)]:rounded-l-md fk:[&>*:not(:last-child)]:rounded-r-md",e),orientation:"horizontal",...t})},Kp=({children:e,...t})=>{let{goToPrevious:o,totalBranches:r}=je();return jsx(b,{"aria-label":"Previous branch",disabled:r<=1,onClick:o,size:"icon-sm",type:"button",variant:"ghost",...t,children:e??jsx(ChevronLeftIcon,{size:14})})},qp=({children:e,...t})=>{let{goToNext:o,totalBranches:r}=je();return jsx(b,{"aria-label":"Next branch",disabled:r<=1,onClick:o,size:"icon-sm",type:"button",variant:"ghost",...t,children:e??jsx(ChevronRightIcon,{size:14})})},Xp=({className:e,...t})=>{let{currentBranch:o,totalBranches:r}=je();return jsxs(c$2,{className:a("fk:border-none fk:bg-transparent fk:text-muted-foreground fk:shadow-none",e),...t,children:[o+1," of ",r]})},Ha={cjk:cjk,code:code,math:math,mermaid:mermaid},Ga=memo(({className:e,...t})=>jsx(Streamdown,{className:a("fk:size-full fk:[&>*:first-child]:mt-0 fk:[&>*:last-child]:mb-0",e),plugins:Ha,prefix:"fk",...t}),(e,t)=>e.children===t.children&&t.isAnimating===e.isAnimating);Ga.displayName="MessageResponse";var Jp=({className:e,children:t,...o})=>jsx("div",{className:a("fk:mt-4 fk:flex fk:w-full fk:items-center fk:justify-between fk:gap-4",e),...o,children:t});var ol=e=>jsx(d$1,{...e}),rl=e=>jsx(e$2,{...e}),nl=({className:e,children:t,title:o="Model Selector",...r})=>jsxs(i,{"aria-describedby":void 0,className:a("fk:outline! fk:border-none! fk:p-0 fk:outline-border! fk:outline-solid!",e),...r,children:[jsx(l$1,{className:"fk:sr-only",children:o}),jsx(n$1,{className:"fk:**:data-[slot=command-input-wrapper]:h-auto",children:t})]}),al=e=>jsx(o,{...e}),sl=({className:e,...t})=>jsx(p,{className:a("fk:h-auto fk:py-3.5",e),...t}),il=e=>jsx(q,{...e}),pl=e=>jsx(r,{...e}),ll=e=>jsx(s,{...e}),fl=e=>jsx(u,{...e}),cl=e=>jsx(v,{...e}),dl=e=>jsx(t,{...e}),ul=({provider:e,className:t,...o})=>jsx("img",{...o,alt:`${e} logo`,className:a("fk:size-3 fk:dark:invert",t),height:12,src:`https://models.dev/logos/${e}.svg`,width:12}),ml=({className:e,...t})=>jsx("div",{className:a("fk:flex fk:shrink-0 fk:items-center fk:-space-x-1 fk:[&>img]:rounded-full fk:[&>img]:bg-background fk:[&>img]:p-px fk:[&>img]:ring-1 fk:dark:[&>img]:bg-foreground",e),...t}),kl=({className:e,...t})=>jsx("span",{className:a("fk:flex-1 fk:truncate fk:text-left",e),...t});var Ka=async e=>{try{let o=await(await fetch(e)).blob();return new Promise(r=>{let a=new FileReader;a.onloadend=()=>r(a.result),a.onerror=()=>r(null),a.readAsDataURL(o);})}catch{return null}},qa=async()=>{if(typeof navigator>"u"||!navigator.mediaDevices?.getDisplayMedia)return null;let e=null,t=document.createElement("video");t.muted=true,t.playsInline=true;try{e=await navigator.mediaDevices.getDisplayMedia({audio:!1,video:!0}),t.srcObject=e,await new Promise((l,f)=>{t.onloadedmetadata=()=>l(),t.onerror=()=>f(new Error("Failed to load screen stream"));}),await t.play();let o=t.videoWidth,r=t.videoHeight;if(!o||!r)return null;let a=document.createElement("canvas");a.width=o,a.height=r;let i=a.getContext("2d");if(!i)return null;i.drawImage(t,0,0,o,r);let s=await new Promise(l=>{a.toBlob(l,"image/png");});if(!s)return null;let p=new Date().toISOString().replaceAll(/[:.]/g,"-").replace("T","_").replace("Z","");return new File([s],`screenshot-${p}.png`,{lastModified:Date.now(),type:"image/png"})}finally{if(e)for(let o of e.getTracks())o.stop();t.pause(),t.srcObject=null;}},$t=createContext(null),Kt=createContext(null),Nl=()=>{let e=useContext($t);if(!e)throw new Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return e},zo=()=>useContext($t),Rl=()=>{let e=useContext(Kt);if(!e)throw new Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return e},Xa=()=>useContext(Kt),Bl=({initialInput:e="",children:t})=>{let[o,r]=useState(e),a=useCallback(()=>r(""),[]),[i,s]=useState([]),p=useRef(null),l=useRef(()=>{}),f=useCallback(c=>{let x=Array.from(c);x.length!==0&&s(z=>[...z,...x.map(R=>({filename:R.name,id:nanoid(),mediaType:R.type,type:"file",url:URL.createObjectURL(R)}))]);},[]),m=useCallback(c=>{s(x=>{let z=x.find(R=>R.id===c);return z?.url&&URL.revokeObjectURL(z.url),x.filter(R=>R.id!==c)});},[]),k=useCallback(()=>{s(c=>{for(let x of c)x.url&&URL.revokeObjectURL(x.url);return []});},[]),g=useRef(i);useEffect(()=>{g.current=i;},[i]),useEffect(()=>()=>{for(let c of g.current)c.url&&URL.revokeObjectURL(c.url);},[]);let T=useCallback(()=>{l.current?.();},[]),b=useMemo(()=>({add:f,clear:k,fileInputRef:p,files:i,openFileDialog:T,remove:m}),[i,f,m,k,T]),C=useCallback((c,x)=>{p.current=c.current,l.current=x;},[]),N=useMemo(()=>({__registerFileInput:C,attachments:b,textInput:{clear:a,setInput:r,value:o}}),[o,a,b,C]);return jsx($t.Provider,{value:N,children:jsx(Kt.Provider,{value:b,children:t})})},Ho=createContext(null),qt=()=>{let e=Xa(),o=useContext(Ho)??e;if(!o)throw new Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return o},Go=createContext(null),Ll=()=>{let e=useContext(Go);if(!e)throw new Error("usePromptInputReferencedSources must be used within a LocalReferencedSourcesContext.Provider");return e},Al=({label:e="Add photos or files",...t})=>{let o=qt(),r=useCallback(a=>{a.preventDefault(),o.openFileDialog();},[o]);return jsxs(h,{...t,onSelect:r,children:[jsx(ImageIcon,{className:"fk:mr-2 fk:size-4"})," ",e]})},Dl=({label:e="Take screenshot",onSelect:t,...o})=>{let r=qt(),a=useCallback(async i=>{if(t?.(i),!i.defaultPrevented)try{let s=await qa();s&&r.add([s]);}catch(s){if(s instanceof DOMException&&(s.name==="NotAllowedError"||s.name==="AbortError"))return;throw s}},[t,r]);return jsxs(h,{...o,onSelect:a,children:[jsx(Monitor,{className:"fk:mr-2 fk:size-4"}),e]})},El=({className:e,accept:t,multiple:o,globalDrop:r,syncHiddenInput:a$1,maxFiles:i,maxFileSize:s,onError:p,onSubmit:l,children:f,...m})=>{let k=zo(),g=!!k,T=useRef(null),b=useRef(null),[C,N]=useState([]),c=g?k.attachments.files:C,[x,z]=useState([]),R=useRef(c);useEffect(()=>{R.current=c;},[c]);let he=useCallback(()=>{T.current?.click();},[]),_=useCallback(u=>!t||t.trim()===""?true:t.split(",").map(h=>h.trim()).filter(Boolean).some(h=>{if(h.endsWith("/*")){let y=h.slice(0,-1);return u.type.startsWith(y)}return u.type===h}),[t]),Ke=useCallback(u=>{let v=Array.from(u),h=v.filter(X=>_(X));if(v.length&&h.length===0){p?.({code:"accept",message:"No files match the accepted types."});return}let y=X=>s?X.size<=s:true,O=h.filter(y);if(h.length>0&&O.length===0){p?.({code:"max_file_size",message:"All files exceed the maximum size."});return}N(X=>{let D=typeof i=="number"?Math.max(0,i-X.length):void 0,se=typeof D=="number"?O.slice(0,D):O;typeof D=="number"&&O.length>D&&p?.({code:"max_files",message:"Too many files. Some were not added."});let ie=[];for(let ct of se)ie.push({filename:ct.name,id:nanoid(),mediaType:ct.type,type:"file",url:URL.createObjectURL(ct)});return [...X,...ie]});},[_,i,s,p]),te=useCallback(u=>N(v=>{let h=v.find(y=>y.id===u);return h?.url&&URL.revokeObjectURL(h.url),v.filter(y=>y.id!==u)}),[]),W=useCallback(u=>{let v=Array.from(u),h=v.filter(ie=>_(ie));if(v.length&&h.length===0){p?.({code:"accept",message:"No files match the accepted types."});return}let y=ie=>s?ie.size<=s:true,O=h.filter(y);if(h.length>0&&O.length===0){p?.({code:"max_file_size",message:"All files exceed the maximum size."});return}let X=c.length,D=typeof i=="number"?Math.max(0,i-X):void 0,se=typeof D=="number"?O.slice(0,D):O;typeof D=="number"&&O.length>D&&p?.({code:"max_files",message:"Too many files. Some were not added."}),se.length>0&&k?.attachments.add(se);},[_,s,i,p,c.length,k]),$=useCallback(()=>g?k?.attachments.clear():N(u=>{for(let v of u)v.url&&URL.revokeObjectURL(v.url);return []}),[g,k]),K=useCallback(()=>z([]),[]),G=g?W:Ke,xe=g?k.attachments.remove:te,qe=g?k.attachments.openFileDialog:he,ve=useCallback(()=>{$(),K();},[$,K]);useEffect(()=>{g&&k.__registerFileInput(T,()=>T.current?.click());},[g,k]),useEffect(()=>{a$1&&T.current&&c.length===0&&(T.current.value="");},[c,a$1]),useEffect(()=>{let u=b.current;if(!u||r)return;let v=y=>{y.dataTransfer?.types?.includes("Files")&&y.preventDefault();},h=y=>{y.dataTransfer?.types?.includes("Files")&&y.preventDefault(),y.dataTransfer?.files&&y.dataTransfer.files.length>0&&G(y.dataTransfer.files);};return u.addEventListener("dragover",v),u.addEventListener("drop",h),()=>{u.removeEventListener("dragover",v),u.removeEventListener("drop",h);}},[G,r]),useEffect(()=>{if(!r)return;let u=h=>{h.dataTransfer?.types?.includes("Files")&&h.preventDefault();},v=h=>{h.dataTransfer?.types?.includes("Files")&&h.preventDefault(),h.dataTransfer?.files&&h.dataTransfer.files.length>0&&G(h.dataTransfer.files);};return document.addEventListener("dragover",u),document.addEventListener("drop",v),()=>{document.removeEventListener("dragover",u),document.removeEventListener("drop",v);}},[G,r]),useEffect(()=>()=>{if(!g)for(let u of R.current)u.url&&URL.revokeObjectURL(u.url);},[g]);let Xe=useCallback(u=>{u.currentTarget.files&&G(u.currentTarget.files),u.currentTarget.value="";},[G]),A=useMemo(()=>({add:G,clear:$,fileInputRef:T,files:c.map(u=>({...u,id:u.id})),openFileDialog:qe,remove:xe}),[c,G,xe,$,qe]),Je=useMemo(()=>({add:u=>{let v=Array.isArray(u)?u:[u];z(h=>[...h,...v.map(y=>({...y,id:nanoid()}))]);},clear:K,remove:u=>{z(v=>v.filter(h=>h.id!==u));},sources:x}),[x,K]),oe=useCallback(async u=>{u.preventDefault();let v=u.currentTarget,h=g?k.textInput.value:new FormData(v).get("message")||"";g||v.reset();try{let y=await Promise.all(c.map(async({id:X,...D})=>{if(D.url?.startsWith("blob:")){let se=await Ka(D.url);return {...D,url:se??D.url}}return D})),O=l({files:y,text:h},u);if(O instanceof Promise)try{await O,ve(),g&&k.textInput.clear();}catch{}else ve(),g&&k.textInput.clear();}catch{}},[g,k,c,l,ve]),q=jsxs(Fragment,{children:[jsx("input",{accept:t,"aria-label":"Upload files",className:"fk:hidden",multiple:o,onChange:Xe,ref:T,title:"Upload files",type:"file"}),jsx("form",{className:a("fk:w-full",e),onSubmit:oe,ref:b,...m,children:jsx(Ut,{className:"fk:overflow-hidden",children:f})})]}),Ce=jsx(Go.Provider,{value:Je,children:q});return jsx(Ho.Provider,{value:A,children:Ce})},zl=({className:e,...t})=>jsx("div",{className:a("fk:contents",e),...t}),Hl=({onChange:e,onKeyDown:t,className:o,placeholder:r="What would you like to know?",...a$1})=>{let i=zo(),s=qt(),[p,l]=useState(false),f=useCallback(b=>{if(t?.(b),!b.defaultPrevented){if(b.key==="Enter"){if(p||b.nativeEvent.isComposing||b.shiftKey)return;b.preventDefault();let{form:C}=b.currentTarget;if(C?.querySelector('button[type="submit"]')?.disabled)return;C?.requestSubmit();}if(b.key==="Backspace"&&b.currentTarget.value===""&&s.files.length>0){b.preventDefault();let C=s.files[s.files.length-1];C&&s.remove(C.id);}}},[t,p,s]),m=useCallback(b=>{let C=b.clipboardData?.items;if(!C)return;let N=[];for(let c of Array.from(C))if(c.kind==="file"){let x=c.getAsFile();x&&N.push(x);}N.length>0&&(b.preventDefault(),s.add(N));},[s]),k=useCallback(()=>l(false),[]),g=useCallback(()=>l(true),[]),T=i?{onChange:b=>{i.textInput.setInput(b.currentTarget.value),e?.(b);},value:i.textInput.value}:{onChange:e};return jsx(Ft,{className:a("fk:field-sizing-content fk:max-h-48 fk:min-h-16",o),name:"message",onCompositionEnd:k,onCompositionStart:g,onKeyDown:f,onPaste:m,placeholder:r,...a$1,...T})},Gl=({className:e,...t})=>jsx(st,{align:"block-end",className:a("fk:order-first fk:flex-wrap fk:gap-1",e),...t}),Ol=({className:e,...t})=>jsx(st,{align:"block-end",className:a("fk:justify-between fk:gap-1",e),...t}),Ul=({className:e,...t})=>jsx("div",{className:a("fk:flex fk:min-w-0 fk:items-center fk:gap-1",e),...t}),Ja=({variant:e$1="ghost",className:t,size:o,tooltip:r,...a$1})=>{let i=o??(Children.count(a$1.children)>1?"sm":"icon-sm"),s=jsx(it,{className:a(t),size:i,type:"button",variant:e$1,...a$1});if(!r)return s;let p=typeof r=="string"?r:r.content,l=typeof r=="string"?void 0:r.shortcut,f=typeof r=="string"?"top":r.side??"top";return jsxs(b$1,{children:[jsx(c,{asChild:true,children:s}),jsxs(e,{side:f,children:[p,l&&jsx("span",{className:"fk:ml-2 fk:text-muted-foreground",children:l})]})]})},Fl=e=>jsx(c$3,{...e}),_l=({className:e,children:t,...o})=>jsx(e$3,{asChild:true,children:jsx(Ja,{className:e,...o,children:t??jsx(PlusIcon,{className:"fk:size-4"})})}),Vl=({className:e,...t})=>jsx(f,{align:"start",className:a(e),...t}),jl=({className:e,...t})=>jsx(h,{className:a(e),...t}),Wl=({className:e,variant:t="default",size:o="icon-sm",status:r,onStop:a$1,onClick:i,children:s,...p})=>{let l=r==="submitted"||r==="streaming",f=jsx(CornerDownLeftIcon,{className:"fk:size-4"});r==="submitted"?f=jsx(Ot,{}):r==="streaming"?f=jsx(SquareIcon,{className:"fk:size-4"}):r==="error"&&(f=jsx(XIcon,{className:"fk:size-4"}));let m=useCallback(k=>{if(l&&a$1){k.preventDefault(),a$1();return}i?.(k);},[l,a$1,i]);return jsx(it,{"aria-label":l?"Stop":"Submit",className:a(e),onClick:m,size:o,type:l&&a$1?"button":"submit",variant:t,...p,children:s??f})},$l=e=>jsx(a$4,{...e}),Kl=({className:e,...t})=>jsx(d,{className:a("fk:border-none fk:bg-transparent fk:font-medium fk:text-muted-foreground fk:shadow-none fk:transition-colors","fk:hover:bg-accent fk:hover:text-foreground fk:aria-expanded:bg-accent fk:aria-expanded:text-foreground",e),...t}),ql=({className:e,...t})=>jsx(e$1,{className:a(e),...t}),Xl=({className:e,...t})=>jsx(g,{className:a(e),...t}),Jl=({className:e,...t})=>jsx(c$1,{className:a(e),...t}),Yl=({openDelay:e=0,closeDelay:t=0,...o})=>jsx(Ue,{closeDelay:t,openDelay:e,...o}),Zl=e=>jsx(Fe,{...e}),Ql=({align:e="start",...t})=>jsx(_e,{align:e,...t}),ef=({className:e,...t})=>jsx("div",{className:a(e),...t}),tf=({className:e,...t})=>jsx("div",{className:a(e),...t}),of=({className:e,...t})=>jsx("h3",{className:a("fk:mb-2 fk:px-3 fk:font-medium fk:text-muted-foreground fk:text-xs",e),...t}),rf=({className:e,...t})=>jsx("div",{className:a("fk:space-y-1",e),...t}),nf=({className:e,...t})=>jsx("div",{className:a("fk:flex fk:items-center fk:gap-2 fk:px-3 fk:py-2 fk:text-xs fk:hover:bg-accent",e),...t}),af=({className:e,...t})=>jsx(n$1,{className:a(e),...t}),sf=({className:e,...t})=>jsx(p,{className:a(e),...t}),pf=({className:e,...t})=>jsx(q,{className:a(e),...t}),lf=({className:e,...t})=>jsx(r,{className:a(e),...t}),ff=({className:e,...t})=>jsx(s,{className:a(e),...t}),cf=({className:e,...t})=>jsx(u,{className:a(e),...t}),df=({className:e,...t$1})=>jsx(t,{className:a(e),...t$1});var Oo=new Map,ts=e=>{let t=Oo.get(e);return t||(t=motion.create(e),Oo.set(e,t)),t},os=({children:e,as:t="p",className:o,duration:r=2,spread:a$1=2})=>{let i=ts(t),s=useMemo(()=>(e?.length??0)*a$1,[e,a$1]);return jsx(i,{animate:{backgroundPosition:"0% center"},className:a("fk:relative fk:inline-block fk:bg-[length:250%_100%,auto] fk:bg-clip-text fk:text-transparent","fk:[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] fk:[background-repeat:no-repeat,padding-box]",o),initial:{backgroundPosition:"100% center"},style:{"--spread":`${s}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"},transition:{duration:r,ease:"linear",repeat:Number.POSITIVE_INFINITY},children:e})},Xt=memo(os);var _o=createContext(null),gs=()=>{let e=useContext(_o);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},bs=1e3,hs=1e3,xs=memo(({className:e,isStreaming:t=false,open:o,defaultOpen:r,onOpenChange:a$1,duration:i,children:s,...p})=>{let l$1=r??t,f=r===false,[m,k]=useControllableState({defaultProp:l$1,onChange:a$1,prop:o}),[g,T]=useControllableState({defaultProp:void 0,prop:i}),b=useRef(t),[C,N]=useState(false),c=useRef(null);useEffect(()=>{t?(b.current=true,c.current===null&&(c.current=Date.now())):c.current!==null&&(T(Math.ceil((Date.now()-c.current)/hs)),c.current=null);},[t,T]),useEffect(()=>{t&&!m&&!f&&k(true);},[t,m,k,f]),useEffect(()=>{if(b.current&&!t&&m&&!C){let R=setTimeout(()=>{k(false),N(true);},bs);return ()=>clearTimeout(R)}},[t,m,k,C]);let x=useCallback(R=>{k(R);},[k]),z=useMemo(()=>({duration:g,isOpen:m,isStreaming:t,setIsOpen:k}),[g,m,t,k]);return jsx(_o.Provider,{value:z,children:jsx(l,{className:a("fk:not-prose fk:mb-4",e),onOpenChange:x,open:m,...p,children:s})})}),vs=(e,t)=>e||t===0?jsx(Xt,{duration:1,children:"Thinking..."}):t===void 0?jsx("p",{children:"Thought for a few seconds"}):jsxs("p",{children:["Thought for ",t," seconds"]}),Cs=memo(({className:e,children:t,getThinkingMessage:o=vs,...r})=>{let{isStreaming:a$1,isOpen:i,duration:s}=gs();return jsx(m,{className:a("fk:flex fk:w-full fk:items-center fk:gap-2 fk:text-muted-foreground fk:text-sm fk:transition-colors fk:hover:text-foreground",e),...r,children:t??jsxs(Fragment,{children:[jsx(BrainIcon,{className:"fk:size-4"}),o(a$1,s),jsx(ChevronDownIcon,{className:a("fk:size-4 fk:transition-transform",i?"fk:rotate-180":"fk:rotate-0")})]})})}),Ps={cjk:cjk,code:code,math:math,mermaid:mermaid},ys=memo(({className:e,children:t,...o})=>jsx(n,{className:a("fk:mt-4 fk:text-sm","fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:slide-out-to-top-2 fk:data-[state=open]:slide-in-from-top-2 fk:text-muted-foreground fk:outline-none fk:data-[state=closed]:animate-out fk:data-[state=open]:animate-in",e),...o,children:jsx(Streamdown,{plugins:Ps,children:t})}));xs.displayName="Reasoning";Cs.displayName="ReasoningTrigger";ys.displayName="ReasoningContent";var zf=({className:e,...t})=>jsx(l,{className:a("fk:not-prose fk:mb-4 fk:text-primary fk:text-xs",e),...t}),Hf=({className:e,count:t,children:o,...r})=>jsx(m,{className:a("fk:flex fk:items-center fk:gap-2",e),...r,children:o??jsxs(Fragment,{children:[jsxs("p",{className:"fk:font-medium",children:["Used ",t," sources"]}),jsx(ChevronDownIcon,{className:"fk:h-4 fk:w-4"})]})}),Gf=({className:e,...t})=>jsx(n,{className:a("fk:mt-3 fk:flex fk:w-fit fk:flex-col fk:gap-2","fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:slide-out-to-top-2 fk:data-[state=open]:slide-in-from-top-2 fk:outline-none fk:data-[state=closed]:animate-out fk:data-[state=open]:animate-in",e),...t}),Of=({href:e,title:t,children:o,...r})=>jsx("a",{className:"fk:flex fk:items-center fk:gap-2",href:e,rel:"noreferrer",target:"_blank",...r,children:o??jsxs(Fragment,{children:[jsx(BookIcon,{className:"fk:h-4 fk:w-4"}),jsx("span",{className:"fk:block fk:font-medium",children:t})]})});var Rs=6e4;function Bs(){return typeof window<"u"&&"MediaRecorder"in window&&typeof navigator<"u"&&"mediaDevices"in navigator&&typeof navigator.mediaDevices.getUserMedia=="function"}function Ls(){return ["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus"].find(t=>MediaRecorder.isTypeSupported(t))}function Wo(e,t){return e instanceof DOMException&&(e.name==="NotAllowedError"||e.name==="PermissionDeniedError")?new Error("Microphone permission was denied. Enable the microphone to dictate."):e instanceof DOMException&&e.name==="NotFoundError"?new Error("No microphone was found."):e instanceof Error?e:new Error(t)}function As(e){return e instanceof Error&&e.name==="AbortError"}function Ds(e,t,o){return e?o?"Cancel transcription":t?"Stop recording":"Dictate":"Dictation is not available in this browser."}var Kf=({className:e$1,disabled:t,onAudioRecorded:o,onError:r,onTranscriptionChange:a$1,size:i="icon-sm",variant:s="ghost",...p})=>{let[l,f]=useState(false),[m,k]=useState(false),[g,T]=useState(false),b$2=useRef(null),C=useRef(null),N=useRef([]),c$1=useRef(null),x=useRef(null),z=useRef(false),R=useRef(!!t),he=useRef(o),_=useRef(r),Ke=useRef(a$1);R.current=!!t,he.current=o,_.current=r,Ke.current=a$1,useEffect(()=>{T(Bs());},[]);let te=useCallback(()=>{if(C.current){for(let A of C.current.getTracks())A.stop();C.current=null;}},[]),W=useCallback(()=>{c$1.current!==null&&(window.clearTimeout(c$1.current),c$1.current=null);},[]),$=useCallback(()=>{W(),b$2.current?.state==="recording"&&b$2.current.stop(),f(false);},[W]),K=useCallback(()=>{x.current?.abort(),x.current=null,k(false);},[]),G=useCallback(()=>{K(),W();let A=b$2.current;A?.state==="recording"&&(z.current=true,A.stop()),f(false),te();},[K,W,te]),xe=useCallback(async()=>{if(!R.current){if(!he.current){_.current?.(new Error("Dictation is not configured."));return}try{let A=await navigator.mediaDevices.getUserMedia({audio:!0});if(R.current){for(let q of A.getTracks())q.stop();return}C.current=A;let Je=Ls(),oe=Je?new MediaRecorder(A,{mimeType:Je}):new MediaRecorder(A);N.current=[],oe.ondataavailable=q=>{q.data.size>0&&N.current.push(q.data);},oe.onstop=async()=>{if(te(),W(),f(!1),z.current){z.current=!1,N.current=[];return}let q=new Blob(N.current,{type:oe.mimeType||"audio/webm"});if(q.size===0)return;let Ce=new AbortController;x.current=Ce,k(!0);try{let u=he.current;if(!u)return;let v=await u(q,Ce.signal);v&&Ke.current?.(v);}catch(u){if(As(u))return;_.current?.(Wo(u,"Transcription failed."));}finally{x.current===Ce&&(x.current=null,k(!1));}},oe.onerror=()=>{f(!1),te(),W(),_.current?.(new Error("Recording failed. Try again."));},b$2.current=oe,oe.start(250),f(!0),c$1.current=window.setTimeout(()=>{$();},Rs);}catch(A){f(false),te(),_.current?.(Wo(A,"Could not start the microphone."));}}},[W,te,$]);useEffect(()=>{t&&G();},[G,t]),useEffect(()=>()=>{G();},[G]);let qe=useCallback(()=>{if(m){K();return}if(l){$();return}xe();},[K,l,m,xe,$]),ve=t||!g||!o,Xe=Ds(g&&!!o,l,m);return jsxs(b$1,{children:[jsx(c,{asChild:true,children:jsxs("span",{className:"fk:relative fk:inline-flex fk:items-center fk:justify-center",children:[l?[0,1,2].map(A=>jsx("span",{className:"fk:absolute fk:inset-0 fk:animate-ping fk:rounded-full fk:border-2 fk:border-red-400/30",style:{animationDelay:`${String(A*.3)}s`,animationDuration:"2s"}},A)):null,jsxs(b,{"aria-label":Xe,"aria-pressed":l,size:i,variant:l?"destructive":s,...p,className:a("fk:relative fk:z-10 fk:rounded-full fk:dark:hover:bg-accent",e$1),disabled:ve,onClick:qe,type:"button",children:[m?jsx(LoaderIcon,{className:"fk:size-4 fk:animate-spin"}):null,!m&&l?jsx(SquareIcon,{className:"fk:size-4"}):null,m||l?null:jsx(MicIcon,{className:"fk:size-5"})]})]})}),jsx(e,{children:Xe})]})};var ec=({className:e,children:t,...o})=>jsxs(w,{className:"fk:w-full fk:overflow-x-auto fk:whitespace-nowrap",...o,children:[jsx("div",{className:a("fk:flex fk:w-max fk:flex-nowrap fk:items-center fk:gap-2",e),children:t}),jsx(x,{className:"fk:hidden",orientation:"horizontal"})]}),tc=({suggestion:e,onClick:t,className:o,variant:r="outline",size:a$1="sm",children:i,...s})=>{let p=useCallback(()=>{t?.(e);},[t,e]);return jsx(b,{className:a("fk:cursor-pointer fk:rounded-full fk:px-4",o),onClick:p,size:a$1,type:"button",variant:r,...s,children:i||e})};var fc=({className:e,...t})=>jsx(l,{className:a("fk:group fk:not-prose fk:mb-4 fk:w-full fk:rounded-md fk:border",e),...t}),Fs={"approval-requested":"Awaiting Approval","approval-responded":"Responded","input-available":"Running","input-streaming":"Pending","output-available":"Completed","output-denied":"Denied","output-error":"Error"},_s={"approval-requested":jsx(ClockIcon,{className:"fk:size-4 fk:text-yellow-600"}),"approval-responded":jsx(CheckCircleIcon,{className:"fk:size-4 fk:text-blue-600"}),"input-available":jsx(ClockIcon,{className:"fk:size-4 fk:animate-pulse"}),"input-streaming":jsx(CircleIcon,{className:"fk:size-4"}),"output-available":jsx(CheckCircleIcon,{className:"fk:size-4 fk:text-green-600"}),"output-denied":jsx(XCircleIcon,{className:"fk:size-4 fk:text-orange-600"}),"output-error":jsx(XCircleIcon,{className:"fk:size-4 fk:text-red-600"})},Vs=e=>jsxs(b$3,{className:"fk:gap-1.5 fk:py-px fk:rounded-full fk:text-xs",variant:"secondary",children:[_s[e],Fs[e]]}),cc=({className:e,title:t,type:o,state:r,toolName:a$1,...i})=>{let s=o==="dynamic-tool"?a$1:o.split("-").slice(1).join("-");return jsxs(m,{className:a("fk:flex fk:w-full fk:items-center fk:justify-between fk:gap-4 fk:px-3 fk:py-2",e),...i,children:[jsxs("div",{className:"fk:flex fk:items-center fk:gap-2",children:[jsx(WrenchIcon,{className:"fk:size-4 fk:text-muted-foreground"}),jsx("span",{className:"fk:font-medium fk:text-sm",children:t??s}),Vs(r)]}),jsx(ChevronDownIcon,{className:"fk:size-4 fk:text-muted-foreground fk:transition-transform fk:group-data-[state=open]:rotate-180"})]})},dc=({className:e,...t})=>jsx(n,{className:a("fk:data-[state=closed]:fade-out-0 fk:data-[state=closed]:slide-out-to-top-2 fk:data-[state=open]:slide-in-from-top-2 fk:space-y-4 fk:p-4 fk:text-popover-foreground fk:outline-none fk:data-[state=closed]:animate-out fk:data-[state=open]:animate-in",e),...t}),uc=({className:e,input:t,...o})=>jsxs("div",{className:a("fk:space-y-2 fk:overflow-hidden",e),...o,children:[jsx("h4",{className:"fk:font-medium fk:text-muted-foreground fk:text-xs fk:uppercase fk:tracking-wide",children:"Parameters"}),jsx("div",{className:"fk:rounded-md fk:bg-muted/50",children:jsx(pt,{code:JSON.stringify(t,null,2),language:"json"})})]}),mc=({className:e,output:t,errorText:o,...r})=>{if(!(t||o))return null;let a$1=jsx("div",{children:t});return typeof t=="object"&&!isValidElement(t)?a$1=jsx(pt,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(a$1=jsx(pt,{code:t,language:"json"})),jsxs("div",{className:a("fk:space-y-2",e),...r,children:[jsx("h4",{className:"fk:font-medium fk:text-muted-foreground fk:text-xs fk:uppercase fk:tracking-wide",children:o?"Error":"Result"}),jsxs("div",{className:a("fk:overflow-x-auto fk:rounded-md fk:text-xs fk:[&_table]:w-full",o?"fk:bg-destructive/10 fk:text-destructive":"fk:bg-muted/50 fk:text-foreground"),children:[o&&jsx("div",{children:o}),a$1]})]})};
|
|
6
|
+
export{Vi as Attachment,Ji as AttachmentEmpty,Ki as AttachmentHoverCard,Xi as AttachmentHoverCardContent,qi as AttachmentHoverCardTrigger,Wi as AttachmentInfo,ji as AttachmentPreview,$i as AttachmentRemove,_i as Attachments,pt as CodeBlock,pp as CodeBlockActions,ba as CodeBlockContainer,ha as CodeBlockContent,lp as CodeBlockCopyButton,ip as CodeBlockFilename,ap as CodeBlockHeader,fp as CodeBlockLanguageSelector,up as CodeBlockLanguageSelectorContent,mp as CodeBlockLanguageSelectorItem,cp as CodeBlockLanguageSelectorTrigger,dp as CodeBlockLanguageSelectorValue,sp as CodeBlockTitle,Pp as Conversation,yp as ConversationContent,Ip as ConversationDownload,Sp as ConversationEmptyState,Tp as ConversationScrollButton,sn as ExternalLink,Ue as HoverCard,_e as HoverCardContent,Fe as HoverCardTrigger,Ut as InputGroup,st as InputGroupAddon,it as InputGroupButton,Fn as InputGroupInput,Un as InputGroupText,Ft as InputGroupTextarea,Go as LocalReferencedSourcesContext,Up as Message,Vp as MessageAction,_p as MessageActions,jp as MessageBranch,Wp as MessageBranchContent,qp as MessageBranchNext,Xp as MessageBranchPage,Kp as MessageBranchPrevious,$p as MessageBranchSelector,Fp as MessageContent,Ga as MessageResponse,Jp as MessageToolbar,ol as ModelSelector,nl as ModelSelectorContent,al as ModelSelectorDialog,pl as ModelSelectorEmpty,ll as ModelSelectorGroup,sl as ModelSelectorInput,fl as ModelSelectorItem,il as ModelSelectorList,ul as ModelSelectorLogo,ml as ModelSelectorLogoGroup,kl as ModelSelectorName,dl as ModelSelectorSeparator,cl as ModelSelectorShortcut,rl as ModelSelectorTrigger,El as PromptInput,Al as PromptInputActionAddAttachments,Dl as PromptInputActionAddScreenshot,Fl as PromptInputActionMenu,Vl as PromptInputActionMenuContent,jl as PromptInputActionMenuItem,_l as PromptInputActionMenuTrigger,zl as PromptInputBody,Ja as PromptInputButton,af as PromptInputCommand,lf as PromptInputCommandEmpty,ff as PromptInputCommandGroup,sf as PromptInputCommandInput,cf as PromptInputCommandItem,pf as PromptInputCommandList,df as PromptInputCommandSeparator,Ol as PromptInputFooter,Gl as PromptInputHeader,Yl as PromptInputHoverCard,Ql as PromptInputHoverCardContent,Zl as PromptInputHoverCardTrigger,Bl as PromptInputProvider,$l as PromptInputSelect,ql as PromptInputSelectContent,Xl as PromptInputSelectItem,Kl as PromptInputSelectTrigger,Jl as PromptInputSelectValue,Wl as PromptInputSubmit,tf as PromptInputTab,rf as PromptInputTabBody,nf as PromptInputTabItem,of as PromptInputTabLabel,ef as PromptInputTabsList,Hl as PromptInputTextarea,Ul as PromptInputTools,xs as Reasoning,ys as ReasoningContent,Cs as ReasoningTrigger,dn as ResizableHandle,cn as ResizablePanel,fn as ResizablePanelGroup,Nt as Sheet,kn as SheetClose,Rt as SheetContent,At as SheetDescription,gn as SheetFooter,Bt as SheetHeader,ao as SheetOverlay,no as SheetPortal,Lt as SheetTitle,mn as SheetTrigger,Xt as Shimmer,En as Sidebar,Ht as SidebarContent,Ze as SidebarGroup,Mn as SidebarGroupContent,Gt as SidebarGroupLabel,wn as SidebarInset,Qe as SidebarMenu,tt as SidebarMenuButton,et as SidebarMenuItem,Et as SidebarPanel,Tn as SidebarProvider,zt as SidebarRail,In as SidebarTrigger,Of as Source,zf as Sources,Gf as SourcesContent,Hf as SourcesTrigger,Kf as SpeechInput,Ot as Spinner,tc as Suggestion,ec as Suggestions,fc as Tool,dc as ToolContent,cc as ToolHeader,uc as ToolInput,mc as ToolOutput,Yn as getAttachmentLabel,bo as getMediaCategory,Vs as getStatusBadge,yo as highlightCode,Sa as messagesToMarkdown,_t as useAttachmentContext,Qn as useAttachmentsContext,qt as usePromptInputAttachments,Nl as usePromptInputController,Ll as usePromptInputReferencedSources,Rl as useProviderAttachments,gs as useReasoning,Ge as useSidebar};//# sourceMappingURL=ui.js.map
|
|
7
7
|
//# sourceMappingURL=ui.js.map
|