modifywithai 2.5.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assistant/index.d.ts +1 -1
- package/dist/assistant/index.js +1 -1
- package/dist/assistant-Biyuv7HJ.js +23 -0
- package/dist/{index-Wxf3Mp0D.d.ts → index-CuQS1I9u.d.ts} +63 -50
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/assistant-7f9B_gWg.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { S as UseDynamicUIReturn, _ as ToolActionSchema, a as AssistantConfig, b as UseAssistantTokenOptions, c as DynamicButton, d as DynamicUITree, f as TokenRequest, g as ToolAction, h as TokenResponseSchema, i as ActionOptionSchema, l as DynamicButtonGroup, m as TokenResponse, n as ActionDefinitionSchema, o as ChatStatus, p as TokenRequestSchema, r as ActionOption, s as CreateAssistantTokenHandlerOptions, t as ActionDefinition, u as DynamicUIElement, v as UseAssistantOptions, x as UseAssistantTokenReturn, y as UseAssistantReturn } from "../types-C7I0JuqF.js";
|
|
2
|
-
import { $ as MessageContentProps, A as PromptInputFooterProps, At as ConfirmationActions, B as DrawerContentProps, Bt as AssistantMessages, C as TaskProps, Ct as ConversationScrollButton, D as PromptInputButton, Dt as ConfirmationAcceptedProps, E as PromptInput, Et as ConfirmationAccepted, F as PromptInputTextarea, Ft as ConfirmationRequest, G as DrawerPortal, H as DrawerFooter, I as PromptInputTextareaProps, It as ConfirmationRequestProps, J as Collapsible, K as DrawerTitle, L as Drawer, Lt as ConfirmationTitle, M as PromptInputProps, Mt as ConfirmationProps, N as PromptInputSubmit, Nt as ConfirmationRejected, O as PromptInputButtonProps, Ot as ConfirmationAction, P as PromptInputSubmitProps, Pt as ConfirmationRejectedProps, Q as MessageContent, R as DrawerClose, Rt as ConfirmationTitleProps, S as TaskItemProps, St as ConversationProps, T as TaskTriggerProps, Tt as Confirmation, U as DrawerHeader, V as DrawerDescription, Vt as AssistantMessagesProps, W as DrawerOverlay, X as CollapsibleTrigger, Y as CollapsibleContent, Z as Message, _ as TaskContent, _t as Conversation, a as useToolExecution, at as DateFieldRenderer, b as TaskItemFile, bt as ConversationEmptyState, c as useDynamicUIToolExecution, ct as TextFieldRenderer, d as useAssistant, dt as DynamicButtonRenderer, et as MessageProps, f as AssistantContextValue, ft as dynamicUIRegistry, g as Task, gt as DynamicActionModalProps, h as useAssistantContext, ht as DynamicActionModal, i as UseToolExecutionOptions, it as AssistantFormRendererProps, j as PromptInputMessage, jt as ConfirmationActionsProps, k as PromptInputFooter, kt as ConfirmationActionProps, l as UseDynamicUIOptions, lt as defaultFormRegistry, m as AssistantProviderProps, mt as DynamicUIProps, n as AssistantRoot, nt as MessageResponseProps, o as useAssistantToken, ot as FormRenderer, p as AssistantProvider, pt as DynamicUI, q as DrawerTrigger, r as AssistantRootProps, rt as AssistantFormRenderer, s as UseDynamicUIToolExecutionOptions, st as TextAreaRenderer, t as cn, tt as MessageResponse, u as useDynamicUI, ut as DynamicButtonGroupRenderer, v as TaskContentProps, vt as ConversationContent, w as TaskTrigger, wt as ConversationScrollButtonProps, x as TaskItemFileProps, xt as ConversationEmptyStateProps, y as TaskItem, yt as ConversationContentProps, z as DrawerContent, zt as ToolUIPartApproval } from "../index-
|
|
2
|
+
import { $ as MessageContentProps, A as PromptInputFooterProps, At as ConfirmationActions, B as DrawerContentProps, Bt as AssistantMessages, C as TaskProps, Ct as ConversationScrollButton, D as PromptInputButton, Dt as ConfirmationAcceptedProps, E as PromptInput, Et as ConfirmationAccepted, F as PromptInputTextarea, Ft as ConfirmationRequest, G as DrawerPortal, H as DrawerFooter, I as PromptInputTextareaProps, It as ConfirmationRequestProps, J as Collapsible, K as DrawerTitle, L as Drawer, Lt as ConfirmationTitle, M as PromptInputProps, Mt as ConfirmationProps, N as PromptInputSubmit, Nt as ConfirmationRejected, O as PromptInputButtonProps, Ot as ConfirmationAction, P as PromptInputSubmitProps, Pt as ConfirmationRejectedProps, Q as MessageContent, R as DrawerClose, Rt as ConfirmationTitleProps, S as TaskItemProps, St as ConversationProps, T as TaskTriggerProps, Tt as Confirmation, U as DrawerHeader, V as DrawerDescription, Vt as AssistantMessagesProps, W as DrawerOverlay, X as CollapsibleTrigger, Y as CollapsibleContent, Z as Message, _ as TaskContent, _t as Conversation, a as useToolExecution, at as DateFieldRenderer, b as TaskItemFile, bt as ConversationEmptyState, c as useDynamicUIToolExecution, ct as TextFieldRenderer, d as useAssistant, dt as DynamicButtonRenderer, et as MessageProps, f as AssistantContextValue, ft as dynamicUIRegistry, g as Task, gt as DynamicActionModalProps, h as useAssistantContext, ht as DynamicActionModal, i as UseToolExecutionOptions, it as AssistantFormRendererProps, j as PromptInputMessage, jt as ConfirmationActionsProps, k as PromptInputFooter, kt as ConfirmationActionProps, l as UseDynamicUIOptions, lt as defaultFormRegistry, m as AssistantProviderProps, mt as DynamicUIProps, n as AssistantRoot, nt as MessageResponseProps, o as useAssistantToken, ot as FormRenderer, p as AssistantProvider, pt as DynamicUI, q as DrawerTrigger, r as AssistantRootProps, rt as AssistantFormRenderer, s as UseDynamicUIToolExecutionOptions, st as TextAreaRenderer, t as cn, tt as MessageResponse, u as useDynamicUI, ut as DynamicButtonGroupRenderer, v as TaskContentProps, vt as ConversationContent, w as TaskTrigger, wt as ConversationScrollButtonProps, x as TaskItemFileProps, xt as ConversationEmptyStateProps, y as TaskItem, yt as ConversationContentProps, z as DrawerContent, zt as ToolUIPartApproval } from "../index-CuQS1I9u.js";
|
|
3
3
|
export { ActionDefinition, ActionDefinitionSchema, ActionOption, ActionOptionSchema, AssistantConfig, AssistantContextValue, AssistantFormRenderer, AssistantFormRendererProps, AssistantMessages, AssistantMessagesProps, AssistantProvider, AssistantProviderProps, AssistantRoot, AssistantRootProps, ChatStatus, Collapsible, CollapsibleContent, CollapsibleTrigger, Confirmation, ConfirmationAccepted, ConfirmationAcceptedProps, ConfirmationAction, ConfirmationActionProps, ConfirmationActions, ConfirmationActionsProps, ConfirmationProps, ConfirmationRejected, ConfirmationRejectedProps, ConfirmationRequest, ConfirmationRequestProps, ConfirmationTitle, ConfirmationTitleProps, Conversation, ConversationContent, ConversationContentProps, ConversationEmptyState, ConversationEmptyStateProps, ConversationProps, ConversationScrollButton, ConversationScrollButtonProps, CreateAssistantTokenHandlerOptions, DateFieldRenderer, Drawer, DrawerClose, DrawerContent, DrawerContentProps, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DynamicActionModal, DynamicActionModalProps, DynamicButton, DynamicButtonGroup, DynamicButtonGroupRenderer, DynamicButtonRenderer, DynamicUI, DynamicUIElement, DynamicUIProps, DynamicUITree, FormRenderer, Message, MessageContent, MessageContentProps, MessageProps, MessageResponse, MessageResponseProps, PromptInput, PromptInputButton, PromptInputButtonProps, PromptInputFooter, PromptInputFooterProps, PromptInputMessage, PromptInputProps, PromptInputSubmit, PromptInputSubmitProps, PromptInputTextarea, PromptInputTextareaProps, Task, TaskContent, TaskContentProps, TaskItem, TaskItemFile, TaskItemFileProps, TaskItemProps, TaskProps, TaskTrigger, TaskTriggerProps, TextAreaRenderer, TextFieldRenderer, TokenRequest, TokenRequestSchema, TokenResponse, TokenResponseSchema, ToolAction, ToolActionSchema, ToolUIPartApproval, UseAssistantOptions, UseAssistantReturn, UseAssistantTokenOptions, UseAssistantTokenReturn, UseDynamicUIOptions, UseDynamicUIReturn, UseDynamicUIToolExecutionOptions, UseToolExecutionOptions, cn, defaultFormRegistry, dynamicUIRegistry, useAssistant, useAssistantContext, useAssistantToken, useDynamicUI, useDynamicUIToolExecution, useToolExecution };
|
package/dist/assistant/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as y,T as b,U as x,V as S,W as C,X as w,Y as T,Z as E,_ as D,a as O,at as k,b as A,c as j,ct as M,d as N,et as P,f as F,g as I,h as L,i as R,it as z,j as B,k as V,l as H,lt as U,m as W,n as G,nt as K,o as q,ot as J,p as Y,q as X,r as Z,rt as Q,s as $,st as ee,t as te,tt as ne,u as re,v as ie,w as ae,x as oe,y as se,z as ce}from"../assistant-
|
|
1
|
+
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as y,T as b,U as x,V as S,W as C,X as w,Y as T,Z as E,_ as D,a as O,at as k,b as A,c as j,ct as M,d as N,et as P,f as F,g as I,h as L,i as R,it as z,j as B,k as V,l as H,lt as U,m as W,n as G,nt as K,o as q,ot as J,p as Y,q as X,r as Z,rt as Q,s as $,st as ee,t as te,tt as ne,u as re,v as ie,w as ae,x as oe,y as se,z as ce}from"../assistant-Biyuv7HJ.js";export{k as ActionDefinitionSchema,J as ActionOptionSchema,s as AssistantFormRenderer,m as AssistantMessages,oe as AssistantProvider,te as AssistantRoot,ce as Collapsible,n as CollapsibleContent,S as CollapsibleTrigger,E as Confirmation,_ as ConfirmationAccepted,e as ConfirmationAction,P as ConfirmationActions,ne as ConfirmationRejected,K as ConfirmationRequest,Q as ConfirmationTitle,V as Conversation,t as ConversationContent,B as ConversationEmptyState,p as ConversationScrollButton,d as DateFieldRenderer,$ as Drawer,j as DrawerClose,H as DrawerContent,re as DrawerDescription,N as DrawerFooter,F as DrawerHeader,Y as DrawerOverlay,W as DrawerPortal,L as DrawerTitle,I as DrawerTrigger,h as DynamicActionModal,ie as DynamicButtonGroupRenderer,se as DynamicButtonRenderer,D as DynamicUI,X as FormRenderer,c as Message,x as MessageContent,C as MessageResponse,G as PromptInput,Z as PromptInputButton,R as PromptInputFooter,O as PromptInputSubmit,q as PromptInputTextarea,g as Task,o as TaskContent,l as TaskItem,f as TaskItemFile,v as TaskTrigger,u as TextAreaRenderer,T as TextFieldRenderer,ee as TokenRequestSchema,M as TokenResponseSchema,U as ToolActionSchema,z as cn,w as defaultFormRegistry,A as dynamicUIRegistry,b as useAssistant,y as useAssistantContext,i as useAssistantToken,ae as useDynamicUI,r as useDynamicUIToolExecution,a as useToolExecution};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{z as e}from"zod";import{Children as t,createContext as n,memo as r,useCallback as i,useContext as a,useEffect as o,useMemo as s,useRef as c,useState as l}from"react";import{clsx as u}from"clsx";import{twMerge as d}from"tailwind-merge";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{JSONUIProvider as h,Renderer as g}from"@json-render/react";import{Streamdown as _}from"streamdown";import{ChevronDownIcon as v,CornerDownLeftIcon as y,Loader2Icon as b,SearchIcon as x,SquareIcon as S,XIcon as ee}from"lucide-react";import*as C from"@radix-ui/react-collapsible";import{useChat as te}from"@ai-sdk/react";import{DefaultChatTransport as ne,lastAssistantMessageIsCompleteWithApprovalResponses as re}from"ai";import{Drawer as w}from"vaul-base";import{createPortal as ie}from"react-dom";const T=e.object({type:e.string(),description:e.string().optional(),required:e.boolean().optional()}),ae=e.object({name:e.string(),description:e.string(),options:e.record(e.string(),T).optional(),approvalRequired:e.boolean().optional()}),E=e.object({name:e.string(),options:e.record(e.string(),e.unknown()).optional()}),oe=e.object({token:e.string(),expiresAt:e.number()}),se=e.object({endUserId:e.string(),availableActions:e.array(ae),context:e.record(e.string(),e.unknown()).optional()});function D(...e){return d(u(e))}const O=n(null);function k(){let e=a(O);if(!e)throw Error(`Confirmation components must be used within Confirmation`);return e}function ce({className:e,approval:t,state:n,...r}){return!t||n===`input-streaming`||n===`input-available`?null:p(O.Provider,{value:{approval:t,state:n},children:p(`div`,{"data-slot":`confirmation`,"data-state":n,"data-approved":t?.approved,role:`alertdialog`,"aria-labelledby":`confirmation-title`,className:D(`flex flex-col gap-2 rounded-lg border p-4`,`data-[state=approval-requested]:border-amber-500/50 data-[state=approval-requested]:bg-amber-50/50 dark:data-[state=approval-requested]:bg-amber-950/20`,`data-[approved=true]:border-green-500/50 data-[approved=true]:bg-green-50/50 dark:data-[approved=true]:bg-green-950/20`,`data-[approved=false]:border-red-500/50 data-[approved=false]:bg-red-50/50 dark:data-[approved=false]:bg-red-950/20`,e),...r})})}function le({className:e,...t}){return p(`p`,{id:`confirmation-title`,"data-slot":`confirmation-title`,className:D(`text-sm font-medium`,e),...t})}function ue({children:e}){let{state:t}=k();return t===`approval-requested`?p(`div`,{"data-slot":`confirmation-request`,children:e}):null}function A({children:e}){let{approval:t,state:n}=k();return!t?.approved||n!==`approval-responded`&&n!==`output-denied`&&n!==`output-available`?null:p(`div`,{"data-slot":`confirmation-accepted`,children:e})}function j({children:e}){let{approval:t,state:n}=k();return t?.approved!==!1||n!==`approval-responded`&&n!==`output-denied`&&n!==`output-available`?null:p(`div`,{"data-slot":`confirmation-rejected`,children:e})}function M({className:e,...t}){let{state:n}=k();return n===`approval-requested`?p(`div`,{"data-slot":`confirmation-actions`,className:D(`flex items-center justify-end gap-2 self-end`,e),...t}):null}function N({className:e,variant:t=`default`,...n}){return p(`button`,{"data-slot":`confirmation-action`,"data-variant":t,type:`button`,className:D(`inline-flex h-8 items-center justify-center gap-2 whitespace-nowrap rounded-md px-3 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,`disabled:pointer-events-none disabled:opacity-50`,t===`default`&&`bg-primary text-primary-foreground shadow hover:bg-primary/90`,t===`outline`&&`border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground`,t===`destructive`&&`bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90`,e),...n})}function P(e){e.stopPropagation()}function F({element:e,children:t,onAction:n}){let{id:r=`form`,title:i,submitLabel:a=`Submit`}=e.props??{},o=e=>{e.preventDefault();let t=new FormData(e.currentTarget),i={};t.forEach((e,t)=>{typeof e==`string`&&(i[t]=e)}),n?.({name:`submit`,params:{formId:r,data:i}})};return m(`div`,{"data-slot":`form-card`,className:D(`w-full rounded-lg border bg-card text-card-foreground shadow-sm`),children:[i&&p(`div`,{className:`flex flex-col space-y-1.5 p-4 pb-3`,children:p(`h3`,{className:`text-base font-semibold leading-none tracking-tight`,children:i})}),p(`div`,{className:D(`p-4`,i?``:`pt-4`),children:m(`form`,{onSubmit:o,className:`space-y-4`,children:[t,m(`div`,{className:`flex justify-end gap-2 pt-2`,children:[p(`button`,{type:`button`,className:D(`inline-flex h-9 items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm transition-colors`,`hover:bg-accent hover:text-accent-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,`disabled:pointer-events-none disabled:opacity-50`),onClick:()=>n?.({name:`cancel`,params:{formId:r}}),children:`Cancel`}),p(`button`,{type:`submit`,className:D(`inline-flex h-9 items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors`,`hover:bg-primary/90`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,`disabled:pointer-events-none disabled:opacity-50`),children:a})]})]})})]})}function I({element:e}){let{name:t=`field`,label:n=`Field`,placeholder:r,required:i,defaultValue:a}=e.props??{};return m(`div`,{className:`space-y-1.5`,children:[m(`label`,{htmlFor:t,className:`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,children:[n,i&&p(`span`,{className:`ml-1 text-destructive`,children:`*`})]}),p(`input`,{id:t,name:t,type:`text`,placeholder:r,required:i,defaultValue:a,autoComplete:`off`,onKeyDown:P,onKeyUp:P,className:D(`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors`,`placeholder:text-muted-foreground`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`)})]})}function L({element:e}){let{name:t=`field`,label:n=`Field`,placeholder:r,required:i,defaultValue:a,rows:o=3}=e.props??{};return m(`div`,{className:`space-y-1.5`,children:[m(`label`,{htmlFor:t,className:`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,children:[n,i&&p(`span`,{className:`ml-1 text-destructive`,children:`*`})]}),p(`textarea`,{id:t,name:t,placeholder:r,required:i,defaultValue:a,rows:o,onKeyDown:P,onKeyUp:P,className:D(`flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm transition-colors`,`placeholder:text-muted-foreground`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`)})]})}function R({element:e}){let{name:t=`date`,label:n=`Date`,required:r,defaultValue:i,min:a,max:o}=e.props??{};return m(`div`,{className:`space-y-1.5`,children:[m(`label`,{htmlFor:t,className:`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,children:[n,r&&p(`span`,{className:`ml-1 text-destructive`,children:`*`})]}),p(`input`,{type:`date`,id:t,name:t,required:r,defaultValue:i,min:a,max:o,onKeyDown:P,onKeyUp:P,className:D(`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`)})]})}const z={Form:F,TextField:I,TextArea:L,DateField:R},de=e.object({formId:e.string(),data:e.record(e.string(),e.string())}),fe=e.object({formId:e.string()});function B({ui:e,context:t,onSubmit:n,onCancel:r,registry:i=z}){return p(h,{registry:i,initialData:t,actionHandlers:{submit:e=>{let t=de.safeParse(e);t.success?n(t.data.formId,t.data.data):console.warn(`Form submit: Invalid params`,t.error.flatten())},cancel:e=>{let t=fe.safeParse(e);t.success?r?.(t.data.formId):console.warn(`Form cancel: Invalid params`,t.error.flatten())}},children:p(g,{tree:e,registry:i})})}function V({className:e,from:t,...n}){return p(`div`,{"data-slot":`message`,"data-from":t,className:D(`group flex w-full max-w-[95%] flex-col gap-2`,t===`user`?`is-user ml-auto justify-end`:`is-assistant`,e),...n})}function H({children:e,className:t,...n}){return p(`div`,{"data-slot":`message-content`,className:D(`flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm`,`group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground`,`group-[.is-assistant]:text-foreground`,t),...n,children:e})}const U=r(function({className:e,...t}){return p(_,{"data-slot":`message-response`,className:D(`size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,e),...t})},(e,t)=>e.children===t.children);function W({...e}){return p(C.Root,{"data-slot":`collapsible`,...e})}function G({...e}){return p(C.CollapsibleTrigger,{"data-slot":`collapsible-trigger`,...e})}function pe({...e}){return p(C.CollapsibleContent,{"data-slot":`collapsible-content`,...e})}function me({children:e,className:t,...n}){return p(`div`,{"data-slot":`task-item-file`,className:D(`inline-flex items-center gap-1 rounded-md border bg-secondary px-1.5 py-0.5 text-xs text-foreground`,t),...n,children:e})}function K({children:e,className:t,...n}){return p(`div`,{"data-slot":`task-item`,className:D(`text-sm text-muted-foreground`,t),...n,children:e})}function q({defaultOpen:e=!0,className:t,...n}){return p(W,{"data-slot":`task`,className:D(t),defaultOpen:e,...n})}function J({children:e,className:t,title:n,icon:r,...i}){return p(G,{asChild:!0,className:D(`group`,t),...i,children:e??m(`div`,{className:`flex w-full cursor-pointer items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground`,children:[r??p(x,{className:`size-4`}),p(`p`,{className:`text-sm`,children:n}),p(v,{className:`size-4 transition-transform group-data-[state=open]:rotate-180`})]})})}function Y({children:e,className:t,...n}){return p(pe,{"data-slot":`task-content`,className:D(`text-popover-foreground outline-none`,`data-[state=closed]:animate-out data-[state=open]:animate-in`,`data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,`data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2`,t),...n,children:p(`div`,{className:`mt-4 space-y-2 border-l-2 border-muted pl-4`,children:e})})}const he=e.object({actions:e.array(E).optional()}),ge=e.object({id:e.string(),approved:e.boolean().optional()}),_e=e.object({type:e.string(),props:e.record(e.string(),e.unknown()).default({}),children:e.array(e.string()).optional(),parentKey:e.string().optional()}),ve=e.object({root:e.string(),elements:e.record(e.string(),_e)}),ye=e.object({ui:ve,context:e.record(e.string(),e.unknown()).optional()});function be(e){return e.name}function xe({messages:e,sendMessage:t,addToolApprovalResponse:n,getActionDescription:r=be,className:i}){let a=e.filter(e=>e.role===`user`||e.role===`assistant`);return p(`div`,{className:i,children:a.map((e,i)=>{let o=i===a.length-1;return p(V,{from:e.role,children:p(H,{children:e.parts.map((i,a)=>p(Se,{part:i,messageId:e.id,partIndex:a,isLastMessage:o,sendMessage:t,addToolApprovalResponse:n,getActionDescription:r},`${e.id}-${a}`))})},e.id)})})}function Se({part:e,messageId:t,partIndex:n,isLastMessage:r,sendMessage:i,addToolApprovalResponse:a,getActionDescription:o}){if(e.type===`text`)return p(U,{children:e.text});if(e.type===`tool-performActions`){let r=`input`in e?e.input:void 0,i=he.safeParse(r),s=i.success?i.data.actions??[]:[];if(s.length===0)return null;let c=s.length,l=`state`in e?e.state:void 0,u=`approval`in e?e.approval:void 0,d=ge.safeParse(u),f=d.success?d.data:void 0;return f&&l?m(ce,{state:l,approval:f,children:[p(le,{children:c===1?`Confirm action`:`Confirm ${c} actions`}),p(ue,{children:p(`ul`,{className:`list-disc list-inside text-sm text-muted-foreground mt-2`,children:s.map((e,r)=>p(`li`,{children:o(e)},`${t}-${n}-${r}`))})}),p(A,{children:p(`span`,{className:`text-sm text-muted-foreground`,children:c===1?`Action approved`:`${c} actions approved`})}),p(j,{children:p(`span`,{className:`text-sm text-muted-foreground`,children:c===1?`Action cancelled`:`${c} actions cancelled`})}),m(M,{children:[p(N,{variant:`outline`,onClick:()=>a({id:f.id,approved:!1}),children:`Deny`}),p(N,{onClick:()=>a({id:f.id,approved:!0}),children:`Approve`})]})]}):m(q,{defaultOpen:!1,children:[p(J,{title:c===1?`Performing 1 action`:`Performing ${c} actions`}),p(Y,{children:s.map((e,r)=>p(K,{children:o(e)},`${t}-${n}-${r}`))})]})}if(e.type===`tool-renderUI`&&r){if((`state`in e?e.state:void 0)===`output-available`&&`output`in e){let t=ye.safeParse(e.output);if(t.success)return p(B,{ui:t.data.ui,context:t.data.context,onSubmit:(e,t)=>{i({text:`[Form:${e}] ${JSON.stringify(t)}`})},onCancel:e=>{i({text:`[Form:${e}] cancelled`})}})}return null}return null}function Ce({className:e,children:t,...n}){return p(`div`,{"data-slot":`conversation`,className:D(`relative flex-1 min-h-0 overflow-hidden`,e),role:`log`,"aria-label":`Chat messages`,...n,children:t})}function we({className:e,children:t,...n}){let r=c(null);return o(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[t]),p(`div`,{ref:r,"data-slot":`conversation-content`,className:D(`flex flex-col gap-8 p-4`,`h-full min-h-0 overflow-y-auto`,`overscroll-contain`,e),...n,children:t})}function Te({className:e,title:t=`No messages yet`,description:n=`Start a conversation to see messages here`,icon:r,children:i,...a}){return p(`div`,{"data-slot":`conversation-empty-state`,className:D(`flex size-full flex-col items-center justify-center gap-3 p-8 text-center`,e),...a,children:i??m(f,{children:[r&&p(`div`,{className:`text-muted-foreground`,children:r}),m(`div`,{className:`space-y-1`,children:[p(`h3`,{className:`text-sm font-medium`,children:t}),n&&p(`p`,{className:`text-muted-foreground text-sm`,children:n})]})]})})}function Ee({className:e,...t}){return null}function X({button:e,availableActions:t,onExecute:n,onClose:r}){let[a,s]=l(null),[c,u]=l({}),d=i(()=>{if(!e||!t)return!1;for(let n of e.actions){let e=t.find(e=>e.name===n.name);if(e?.options){for(let[t,r]of Object.entries(e.options))if(r.required&&!n.options?.[t])return!0}}return!1},[e,t]),f=i(()=>!e||!t?!1:e.actions.some(e=>t.find(t=>t.name===e.name)?.approvalRequired===!0),[e,t]),h=i(()=>{if(!e||!t)return null;let n=[];for(let r of e.actions){let e=t.find(e=>e.name===r.name);if(e?.options){for(let[t,i]of Object.entries(e.options))if(i.required&&!r.options?.[t]){let e=`${r.name}_${t}`;n.push({key:e,type:(i.type,`TextField`),props:{name:e,label:i.description||t,required:!0}})}}}if(n.length===0)return null;let r={form:{key:`form`,type:`Form`,props:{id:`dynamic-action-${e.id}`,title:e.label,submitLabel:`Continue`},children:n.map(e=>e.key)}};for(let e of n)r[e.key]={key:e.key,type:e.type,props:e.props,parentKey:`form`};return{root:`form`,elements:r}},[e,t]),g=i(i=>{e&&(n(e.actions.map(e=>{let n={...e.options},r=t?.find(t=>t.name===e.name);for(let[t,a]of Object.entries(i)){let i=t.split(`_`),o=i[0],s=i.slice(1).join(`_`);if(o===e.name&&s){let e=r?.options?.[s],t=a;e?.type===`number`?t=Number(a):e?.type===`boolean`&&(t=a===`true`),n[s]=t}}return{...e,options:n}})),r())},[e,t,n,r]);o(()=>{if(!e){s(null),u({});return}if(d()){s(`input`);return}if(f()){s(`approval`);return}n(e.actions),r()},[e,d,f,n,r]);let _=i((e,t)=>{u(t),f()?s(`approval`):g(t)},[f,g]),v=i(()=>{Object.keys(c).length>0?g(c):e&&(n(e.actions),r())},[c,e,n,r,g]);if(!e||a===null)return null;let y=h();return m(De,{onClose:r,children:[a===`input`&&y&&p(B,{ui:y,onSubmit:_,onCancel:r}),a===`approval`&&p(Oe,{button:e,availableActions:t,onApprove:v,onDeny:r})]})}function De({children:e,onClose:t}){return p(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-8`,onClick:e=>{e.target===e.currentTarget&&t()},children:p(`div`,{className:`max-h-[90vh] w-full max-w-md overflow-auto`,onClick:e=>e.stopPropagation(),children:e})})}function Oe({button:e,availableActions:t,onApprove:n,onDeny:r}){return p(`div`,{className:`rounded-lg border bg-card text-card-foreground shadow-sm p-4`,children:m(`div`,{className:`flex flex-col gap-4`,children:[m(`div`,{className:`flex flex-col gap-2`,children:[p(`h3`,{className:`text-lg font-semibold`,children:`Confirm Action`}),p(`p`,{className:`text-sm text-muted-foreground`,children:`This will execute the following actions:`})]}),p(`ul`,{className:`list-inside list-disc space-y-1 text-sm`,children:e.actions.map((e,n)=>{let r=t?.find(t=>t.name===e.name);return m(`li`,{children:[p(`span`,{className:`font-medium`,children:e.name}),r?.description&&m(`span`,{className:`text-muted-foreground`,children:[` `,`- `,r.description]})]},n)})}),m(`div`,{className:`flex justify-end gap-2 pt-2`,children:[p(`button`,{type:`button`,onClick:r,className:D(`inline-flex h-9 items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm transition-colors`,`hover:bg-accent hover:text-accent-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`),children:`Cancel`}),p(`button`,{type:`button`,onClick:n,className:D(`inline-flex h-9 items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors`,`hover:bg-primary/90`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`),children:`Confirm`})]})]})})}function ke({tokenEndpoint:e,endUserId:t,availableActions:n,autoFetch:r=!0,refreshBuffer:a=3e4}){let[s,u]=l(null),[d,f]=l(null),[p,m]=l(!1),[h,g]=l(null),_=c(!0),v=c(!1),y=c(n);y.current=n;let b=i(async()=>{if(_.current){m(!0),g(null);try{let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({endUserId:t,availableActions:y.current})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error||`Failed to get token: ${n.status}`)}let r=await n.json();if(!_.current)return;u(r.token),f(r.expiresAt)}catch(e){if(!_.current)return;g(e instanceof Error?e.message:`Failed to get token`),console.error(`Token fetch error:`,e)}finally{_.current&&m(!1)}}},[e,t]);return o(()=>{r&&!v.current&&(v.current=!0,b())},[r,b]),o(()=>{if(!d)return;let e=d-Date.now()-a;if(e<=0){b();return}let t=setTimeout(b,e);return()=>clearTimeout(t)},[d,a,b]),o(()=>(_.current=!0,()=>{_.current=!1}),[]),{token:s,expiresAt:d,isLoading:p,error:h,fetchToken:b}}function Ae({messages:e,onAction:t}){let n=c(new Set);o(()=>{if(t){for(let r of e)if(r.role===`assistant`){for(let e of r.parts)if(e.type===`tool-performActions`&&`state`in e&&e.state===`output-available`&&`output`in e){let r=e.toolCallId;if(n.current.has(r))continue;let i=e.output;if(i?.actions)for(let e of i.actions)t(e);n.current.add(r)}}}},[e,t])}function je({tokenEndpoint:e=`/api/mwai/token`,apiUrl:t=`https://api.modifywithai.com`,endUserId:n,availableActions:r,getContext:a,onAction:o,onError:u}){let[d,f]=l(``),{token:p,isLoading:m,error:h,fetchToken:g}=ke({tokenEndpoint:e,endUserId:n,availableActions:r,autoFetch:!0}),_=c(a);_.current=a;let v=c(p);v.current=p;let y=te({transport:s(()=>new ne({api:`${t}/api/assistant`,headers:()=>{let e=v.current;return e?{Authorization:`Bearer ${e}`}:{}},body:()=>({context:_.current?.()??{}})}),[t]),sendAutomaticallyWhen:re,onError:u});Ae({messages:y.messages,onAction:o});let b=!!p&&!m,x=i(e=>{if(!b){console.warn(`Cannot send message: assistant not ready (token not available)`);return}y.sendMessage(e)},[y,b]),S=i(e=>{e?.preventDefault(),!(!d.trim()||!b)&&(x({text:d}),f(``))},[d,x,b]);return{messages:y.messages,sendMessage:x,status:y.status,error:y.error??null,input:d,setInput:f,handleSubmit:S,addToolApprovalResponse:y.addToolApprovalResponse,isReady:b,tokenError:h,refreshToken:g}}const Me=e.object({id:e.string(),label:e.string(),variant:e.enum([`default`,`destructive`,`outline`,`secondary`,`ghost`]).optional(),icon:e.string().optional(),actions:e.array(E)}),Ne=e.object({key:e.string(),type:e.enum([`DynamicButton`,`DynamicButtonGroup`]),props:e.record(e.string(),e.unknown()),children:e.array(e.string()).optional(),parentKey:e.string().optional()}),Pe=e.object({root:e.string(),elements:e.record(e.string(),Ne)}),Fe=e.object({version:e.literal(1),tree:Pe});function Ie(e,t,n){return{key:e,type:`DynamicButton`,props:{...t},parentKey:n}}function Z(e,t,n=[],r){return{key:e,type:`DynamicButtonGroup`,props:{...t},children:n,parentKey:r}}function Q({storageKey:e}){let[t,n]=l(null),[r,a]=l(!0);return o(()=>{try{let t=localStorage.getItem(e);if(t){let r=JSON.parse(t),i=Fe.safeParse(r);i.success?n(i.data.tree):(console.warn(`DynamicUI: Stored data failed validation. Discarding.`,i.error.flatten()),localStorage.removeItem(e))}}catch(e){console.error(`Failed to load DynamicUI state:`,e)}finally{a(!1)}},[e]),o(()=>{if(!r)try{if(t){let n={version:1,tree:t};localStorage.setItem(e,JSON.stringify(n))}else localStorage.removeItem(e)}catch(e){console.error(`Failed to save DynamicUI state:`,e)}},[t,e,r]),{tree:t,isLoading:r,addButton:i((e,t)=>{n(n=>{let r=`button-${e.id}`;if(!n){let t=`root-group`;return{root:t,elements:{[t]:Z(t,{id:`root`,direction:`horizontal`},[r]),[r]:Ie(r,e,t)}}}if(n.elements[r])return console.warn(`Button with id "${e.id}" already exists`),n;let i=t?`group-${t}`:n.root,a=n.elements[i];a||console.warn(`Parent "${i}" not found, using root`);let o=a?i:n.root,s=n.elements[o];if(!s)return console.warn(`Parent element "${o}" not found`),n;let c={...n.elements,[o]:{key:s.key,type:s.type,props:s.props,children:[...s.children||[],r],parentKey:s.parentKey},[r]:Ie(r,e,o)};return{root:n.root,elements:c}})},[]),removeButton:i(e=>{n(t=>{if(!t)return t;let n=`button-${e}`,r=t.elements[n];if(!r)return console.warn(`Button "${e}" not found`),t;let i={};for(let[e,a]of Object.entries(t.elements))e!==n&&(r.parentKey&&e===r.parentKey?i[e]={key:a.key,type:a.type,props:a.props,children:a.children?.filter(e=>e!==n),parentKey:a.parentKey}:i[e]=a);return Object.values(i).some(e=>e.type===`DynamicButton`)?{root:t.root,elements:i}:null})},[]),updateButton:i((e,t)=>{n(n=>{if(!n)return n;let r=`button-${e}`,i=n.elements[r];if(!i||i.type!==`DynamicButton`)return console.warn(`Button "${e}" not found`),n;let a=Me.safeParse(i.props);if(!a.success)return console.warn(`Button "${e}" has invalid props`,a.error.flatten()),n;let o={...n.elements,[r]:{key:i.key,type:i.type,props:{...a.data,...t},children:i.children,parentKey:i.parentKey}};return{root:n.root,elements:o}})},[]),addGroup:i(e=>{n(t=>{let n=`group-${e.id}`;if(!t)return{root:n,elements:{[n]:Z(n,e,[])}};if(t.elements[n])return console.warn(`Group with id "${e.id}" already exists`),t;let r=t.elements[t.root];if(!r)return console.warn(`Root element "${t.root}" not found`),t;let i={...t.elements,[t.root]:{key:r.key,type:r.type,props:r.props,children:[...r.children||[],n],parentKey:r.parentKey},[n]:Z(n,e,[],t.root)};return{root:t.root,elements:i}})},[]),removeGroup:i(e=>{n(t=>{if(!t)return t;let n=`group-${e}`,r=t.elements[n];if(!r||r.type!==`DynamicButtonGroup`)return console.warn(`Group "${e}" not found`),t;if(t.root===n)return console.warn(`Cannot remove root group`),t;let i=new Set([n]),a=e=>{let n=t.elements[e];if(n?.children)for(let e of n.children)i.add(e),a(e)};a(n);let o={};for(let[e,a]of Object.entries(t.elements))i.has(e)||(r.parentKey&&e===r.parentKey?o[e]={key:a.key,type:a.type,props:a.props,children:a.children?.filter(e=>e!==n),parentKey:a.parentKey}:o[e]=a);return Object.values(o).some(e=>e.type===`DynamicButton`)?{root:t.root,elements:o}:null})},[]),clearAll:i(()=>{n(null)},[])}}function Le({messages:e,dynamicUI:t}){let n=c(new Set);o(()=>{for(let r of e)if(r.role===`assistant`){for(let e of r.parts)if(e.type===`tool-manageDynamicUI`&&`state`in e&&e.state===`output-available`&&`output`in e){let r=e.toolCallId;if(n.current.has(r))continue;let i=e.output;i&&Re(i,t),n.current.add(r)}}},[e,t])}function Re(e,t){let{operation:n,button:r,buttonId:i,updates:a,group:o,groupId:s}=e;switch(n){case`addButton`:if(r){let{parentGroupId:e,...n}=r;t.addButton(n,e)}break;case`removeButton`:i&&t.removeButton(i);break;case`updateButton`:i&&a&&t.updateButton(i,a);break;case`addGroup`:o&&t.addGroup(o);break;case`removeGroup`:s&&t.removeGroup(s);break;case`clearAll`:t.clearAll();break;default:console.warn(`Unknown DynamicUI operation: ${n}`)}}const ze=n(null);function Be({children:e,tokenEndpoint:t,apiUrl:n,endUserId:r,availableActions:i,getContext:a,onAction:o,onError:c}){let l=je({tokenEndpoint:t,apiUrl:n,endUserId:r,availableActions:i,getContext:a,onAction:o,onError:c}),u=s(()=>({tokenEndpoint:t,apiUrl:n,endUserId:r,availableActions:i}),[t,n,r,i]),d=Q({storageKey:`mwai-dynamic-ui-${r}`});Le({messages:l.messages,dynamicUI:d});let f=s(()=>({messages:l.messages,sendMessage:l.sendMessage,status:l.status,error:l.error,input:l.input,setInput:l.setInput,handleSubmit:l.handleSubmit,addToolApprovalResponse:l.addToolApprovalResponse,isReady:l.isReady,tokenError:l.tokenError,refreshToken:l.refreshToken,config:u,onAction:o,dynamicUI:d}),[l.messages,l.sendMessage,l.status,l.error,l.input,l.setInput,l.handleSubmit,l.addToolApprovalResponse,l.isReady,l.tokenError,l.refreshToken,u,o,d]);return p(ze.Provider,{value:f,children:e})}function Ve(){let e=a(ze);if(!e)throw Error(`useAssistantContext must be used within an AssistantProvider.
|
|
2
|
+
|
|
3
|
+
To use DynamicUI or other assistant components outside of your chat panel, wrap your entire app (or the common parent) with AssistantProvider:
|
|
4
|
+
|
|
5
|
+
// app/layout.tsx or equivalent
|
|
6
|
+
export default function Layout({ children }) {
|
|
7
|
+
return (
|
|
8
|
+
<AssistantProvider
|
|
9
|
+
endUserId="user-123"
|
|
10
|
+
availableActions={myActions}
|
|
11
|
+
onAction={handleAction}
|
|
12
|
+
>
|
|
13
|
+
<Header>
|
|
14
|
+
<DynamicUI /> {/* Works here */}
|
|
15
|
+
</Header>
|
|
16
|
+
<Main>
|
|
17
|
+
{children} {/* Chat component can be anywhere inside */}
|
|
18
|
+
</Main>
|
|
19
|
+
</AssistantProvider>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
`);return e}const He=e.object({id:e.string(),label:e.string(),variant:e.enum([`default`,`destructive`,`outline`,`secondary`,`ghost`]).optional().default(`default`),icon:e.string().optional(),actions:e.array(E)}),Ue=e.object({id:e.string(),label:e.string().optional(),direction:e.enum([`horizontal`,`vertical`]).optional().default(`horizontal`)});function We({element:e,onAction:t}){let n=He.safeParse(e.props??{});if(!n.success)return console.warn(`DynamicButton: Invalid props`,n.error.flatten()),null;let{id:r,label:i,variant:a,icon:o}=n.data,s=()=>{t?.({name:`executeButton`,params:{buttonId:r}})};return m(`button`,{type:`button`,"data-slot":`dynamic-button`,"data-button-id":r,"data-variant":a,onClick:s,className:D(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md px-4 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,`disabled:pointer-events-none disabled:opacity-50`,a===`default`&&`bg-primary text-primary-foreground shadow hover:bg-primary/90`,a===`secondary`&&`bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80`,a===`outline`&&`border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground`,a===`ghost`&&`hover:bg-accent hover:text-accent-foreground`,a===`destructive`&&`bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90`),children:[o&&p(Ke,{name:o,className:`size-4 shrink-0`}),i]})}function Ge({element:e,children:t}){let n=Ue.safeParse(e.props??{});if(!n.success)return console.warn(`DynamicButtonGroup: Invalid props`,n.error.flatten()),p(f,{children:t});let{direction:r,label:i}=n.data;return i?m(`div`,{"data-slot":`dynamic-button-group`,"data-direction":r,className:D(`flex gap-2`,r===`vertical`?`flex-col`:`flex-row flex-wrap`),children:[p(`span`,{className:`text-sm font-medium text-muted-foreground`,children:i}),t]}):p(f,{children:t})}function Ke({name:e,className:t}){return{plus:m(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:[p(`path`,{d:`M5 12h14`}),p(`path`,{d:`M12 5v14`})]}),trash:m(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:[p(`path`,{d:`M3 6h18`}),p(`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`}),p(`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`})]}),check:p(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:p(`path`,{d:`M20 6 9 17l-5-5`})}),edit:m(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:[p(`path`,{d:`M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z`}),p(`path`,{d:`m15 5 4 4`})]}),refresh:m(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:[p(`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`}),p(`path`,{d:`M21 3v5h-5`}),p(`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`}),p(`path`,{d:`M8 16H3v5`})]}),send:m(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:[p(`path`,{d:`m22 2-7 20-4-9-9-4Z`}),p(`path`,{d:`M22 2 11 13`})]}),list:m(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:[p(`line`,{x1:`8`,x2:`21`,y1:`6`,y2:`6`}),p(`line`,{x1:`8`,x2:`21`,y1:`12`,y2:`12`}),p(`line`,{x1:`8`,x2:`21`,y1:`18`,y2:`18`}),p(`line`,{x1:`3`,x2:`3.01`,y1:`6`,y2:`6`}),p(`line`,{x1:`3`,x2:`3.01`,y1:`12`,y2:`12`}),p(`line`,{x1:`3`,x2:`3.01`,y1:`18`,y2:`18`})]}),star:p(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:p(`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`})}),zap:p(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:p(`polygon`,{points:`13 2 3 14 12 14 11 22 21 10 12 10 13 2`})})}[e.toLowerCase()]||null}const $={DynamicButton:We,DynamicButtonGroup:Ge};function qe(e){return typeof e.id==`string`&&typeof e.label==`string`&&Array.isArray(e.actions)}function Je({className:e}){let{config:t,onAction:n,dynamicUI:r}=Ve(),{availableActions:a}=t,[o,s]=l(null),c=i(e=>{if(n)for(let t of e)n(t)},[n]),u=i(e=>{if(!r.tree)return;let t=`button-${e}`,n=r.tree.elements[t];n&&n.type===`DynamicButton`&&qe(n.props)&&s(n.props)},[r.tree]),d=i(()=>{s(null)},[]);return r.isLoading||!r.tree?null:m(f,{children:[p(`div`,{"data-slot":`dynamic-ui`,className:D(`flex flex-wrap gap-2`,e),children:p(h,{registry:$,actionHandlers:{executeButton:({buttonId:e})=>{u(e)}},children:p(g,{tree:r.tree,registry:$})})}),p(X,{button:o,availableActions:a,onExecute:c,onClose:d})]})}function Ye({...e}){return p(w.Root,{"data-slot":`drawer`,...e})}function Xe({...e}){return p(w.Trigger,{"data-slot":`drawer-trigger`,...e})}function Ze({...e}){return p(w.Portal,{"data-slot":`drawer-portal`,...e})}function Qe({...e}){return p(w.Close,{"data-slot":`drawer-close`,...e})}function $e({className:e,...t}){return p(w.Overlay,{"data-slot":`drawer-overlay`,className:D(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50`,e),...t})}function et({className:e,children:t,overlay:n=!0,...r}){return m(Ze,{"data-slot":`drawer-portal`,children:[n&&p($e,{}),m(w.Content,{"data-slot":`drawer-content`,className:D(`bg-background flex h-auto flex-col text-sm`,`data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-xl data-[vaul-drawer-direction=bottom]:border-t`,`data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:rounded-r-xl data-[vaul-drawer-direction=left]:border-r`,`data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:rounded-l-xl data-[vaul-drawer-direction=right]:border-l`,`data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-xl data-[vaul-drawer-direction=top]:border-b`,`data-[vaul-drawer-direction=left]:sm:max-w-sm data-[vaul-drawer-direction=right]:sm:max-w-sm`,`group/drawer-content fixed z-50`,e),...r,children:[p(`div`,{className:`bg-muted mx-auto mt-4 hidden h-1 w-24 shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block`}),t]})]})}function tt({className:e,...t}){return p(`div`,{"data-slot":`drawer-header`,className:D(`flex flex-col gap-0.5 p-4`,`group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center`,`group-data-[vaul-drawer-direction=top]/drawer-content:text-center`,`md:gap-0.5 md:text-left`,e),...t})}function nt({className:e,...t}){return p(`div`,{"data-slot":`drawer-footer`,className:D(`mt-auto flex flex-col gap-2 p-4`,e),...t})}function rt({className:e,...t}){return p(w.Title,{"data-slot":`drawer-title`,className:D(`text-foreground text-base font-medium`,e),...t})}function it({className:e,...t}){return p(w.Description,{"data-slot":`drawer-description`,className:D(`text-muted-foreground text-sm`,e),...t})}function at({className:e,onSubmit:t,children:n,...r}){let i=e=>{e.preventDefault();let n=e.currentTarget,r=new FormData(n).get(`message`)||``;n.reset(),t({text:r},e)};return p(`form`,{"data-slot":`prompt-input`,className:D(`w-full`,e),onSubmit:i,...r,children:p(`div`,{"data-slot":`prompt-input-group`,role:`group`,className:D(`border-input dark:bg-input/30`,`has-[[data-slot=prompt-input-textarea]:focus-visible]:border-ring`,`has-[[data-slot=prompt-input-textarea]:focus-visible]:ring-ring/50`,`has-[[data-slot=prompt-input-textarea]:focus-visible]:ring-[3px]`,`relative flex w-full min-w-0 flex-col overflow-hidden rounded-lg border transition-colors`),children:n})})}function ot({onChange:e,className:t,placeholder:n=`What would you like to know?`,stopKeyPropagation:r=!0,onKeyDown:i,onKeyUp:a,...o}){let[s,c]=l(!1),u=e=>{if(r&&e.stopPropagation(),i?.(e),e.key===`Enter`){if(s||e.nativeEvent.isComposing||e.shiftKey)return;e.preventDefault();let t=e.currentTarget.form;if(t?.querySelector(`button[type="submit"]`)?.disabled)return;t?.requestSubmit()}},d=e=>{r&&e.stopPropagation(),a?.(e)};return p(`textarea`,{"data-slot":`prompt-input-textarea`,className:D(`field-sizing-content max-h-48 min-h-16`,`flex-1 resize-none rounded-none border-0 bg-transparent px-3 py-2 text-sm shadow-none ring-0 outline-0`,`placeholder:text-muted-foreground`,`focus-visible:ring-0 focus-visible:outline-none`,`disabled:cursor-not-allowed disabled:opacity-50`,t),name:`message`,onChange:e,onCompositionEnd:()=>c(!1),onCompositionStart:()=>c(!0),onKeyDown:u,onKeyUp:d,placeholder:n,...o})}function st({className:e,...t}){return p(`div`,{"data-slot":`prompt-input-footer`,className:D(`flex w-full items-center justify-between gap-1 px-2.5 pb-2`,e),...t})}function ct({className:e,type:n=`button`,children:r,...i}){let a=t.count(r)>1;return p(`button`,{"data-slot":`prompt-input-button`,type:n,className:D(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors`,`hover:bg-accent hover:text-accent-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,`disabled:pointer-events-none disabled:opacity-50`,a?`h-8 px-3`:`size-8`,e),...i,children:r})}function lt({className:e,status:t,icon:n,children:r,...i}){let a=p(y,{className:`size-4`});return t===`submitted`?a=p(b,{className:`size-4 animate-spin`}):t===`streaming`?a=p(S,{className:`size-4`}):t===`error`&&(a=p(ee,{className:`size-4`})),p(`button`,{"data-slot":`prompt-input-submit`,type:`submit`,"aria-label":`Send message`,className:D(`inline-flex size-8 items-center justify-center rounded-md text-sm font-medium transition-colors`,`bg-primary text-primary-foreground shadow`,`hover:bg-primary/90`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,`disabled:pointer-events-none disabled:opacity-50`,e),...i,children:r??n??a})}var ut=`/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */
|
|
23
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-500:oklch(63.7% .237 25.331);--color-red-950:oklch(25.8% .092 26.042);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-950:oklch(27.9% .077 45.635);--color-green-50:oklch(98.2% .018 155.826);--color-green-500:oklch(72.3% .219 149.579);--color-green-950:oklch(26.6% .065 152.934);--color-black:#000;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height:calc(1.5/1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--animate-spin:spin 1s linear infinite;--blur-xs:4px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--border);outline-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){*{outline-color:color-mix(in oklab,var(--ring)50%,transparent)}}}@layer components;@layer utilities{.visible{visibility:visible}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.z-50{z-index:50}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-auto{margin-top:auto}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-auto{margin-left:auto}.contents{display:contents}.flex{display:flex}.hidden{display:none}.inline-flex{display:inline-flex}.field-sizing-content{field-sizing:content}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-12{width:calc(var(--spacing)*12);height:calc(var(--spacing)*12)}.size-full{width:100%;height:100%}.h-1{height:calc(var(--spacing)*1)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-auto{height:auto}.h-full{height:100%}.max-h-48{max-height:calc(var(--spacing)*48)}.max-h-\\[90vh\\]{max-height:90vh}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-16{min-height:calc(var(--spacing)*16)}.min-h-\\[60px\\]{min-height:60px}.w-24{width:calc(var(--spacing)*24)}.w-fit{width:fit-content}.w-full{width:100%}.max-w-\\[95\\%\\]{max-width:95%}.max-w-full{max-width:100%}.max-w-md{max-width:var(--container-md)}.min-w-0{min-width:calc(var(--spacing)*0)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}.self-end{align-self:flex-end}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-input{border-color:var(--input)}.border-muted{border-color:var(--muted)}.bg-background{background-color:var(--background)}.bg-black\\/10{background-color:#0000001a}@supports (color:color-mix(in lab, red, red)){.bg-black\\/10{background-color:color-mix(in oklab,var(--color-black)10%,transparent)}}.bg-black\\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-card{background-color:var(--card)}.bg-destructive{background-color:var(--destructive)}.bg-muted{background-color:var(--muted)}.bg-primary{background-color:var(--primary)}.bg-secondary{background-color:var(--secondary)}.bg-transparent{background-color:#0000}.p-4{padding:calc(var(--spacing)*4)}.p-8{padding:calc(var(--spacing)*8)}.px-1\\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2\\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-0\\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-2{padding-block:calc(var(--spacing)*2)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-4{padding-top:calc(var(--spacing)*4)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pl-4{padding-left:calc(var(--spacing)*4)}.text-center{text-align:center}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.whitespace-nowrap{white-space:nowrap}.text-card-foreground{color:var(--card-foreground)}.text-destructive{color:var(--destructive)}.text-foreground{color:var(--foreground)}.text-muted-foreground{color:var(--muted-foreground)}.text-popover-foreground{color:var(--popover-foreground)}.text-primary-foreground{color:var(--primary-foreground)}.text-secondary-foreground{color:var(--secondary-foreground)}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.outline-0{outline-style:var(--tw-outline-style);outline-width:0}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}.group-data-\\[state\\=open\\]\\:rotate-180:is(:where(.group)[data-state=open] *){rotate:180deg}.group-data-\\[vaul-drawer-direction\\=bottom\\]\\/drawer-content\\:block:is(:where(.group\\/drawer-content)[data-vaul-drawer-direction=bottom] *){display:block}.group-data-\\[vaul-drawer-direction\\=bottom\\]\\/drawer-content\\:text-center:is(:where(.group\\/drawer-content)[data-vaul-drawer-direction=bottom] *),.group-data-\\[vaul-drawer-direction\\=top\\]\\/drawer-content\\:text-center:is(:where(.group\\/drawer-content)[data-vaul-drawer-direction=top] *){text-align:center}.group-\\[\\.is-assistant\\]\\:text-foreground:is(:where(.group).is-assistant *){color:var(--foreground)}.group-\\[\\.is-user\\]\\:ml-auto:is(:where(.group).is-user *){margin-left:auto}.group-\\[\\.is-user\\]\\:rounded-lg:is(:where(.group).is-user *){border-radius:var(--radius)}.group-\\[\\.is-user\\]\\:bg-secondary:is(:where(.group).is-user *){background-color:var(--secondary)}.group-\\[\\.is-user\\]\\:px-4:is(:where(.group).is-user *){padding-inline:calc(var(--spacing)*4)}.group-\\[\\.is-user\\]\\:py-3:is(:where(.group).is-user *){padding-block:calc(var(--spacing)*3)}.group-\\[\\.is-user\\]\\:text-foreground:is(:where(.group).is-user *){color:var(--foreground)}.peer-disabled\\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.placeholder\\:text-muted-foreground::placeholder{color:var(--muted-foreground)}@media (hover:hover){.hover\\:bg-accent:hover{background-color:var(--accent)}.hover\\:bg-destructive\\/90:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-destructive\\/90:hover{background-color:color-mix(in oklab,var(--destructive)90%,transparent)}}.hover\\:bg-primary\\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-primary\\/90:hover{background-color:color-mix(in oklab,var(--primary)90%,transparent)}}.hover\\:bg-secondary\\/80:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-secondary\\/80:hover{background-color:color-mix(in oklab,var(--secondary)80%,transparent)}}.hover\\:text-accent-foreground:hover{color:var(--accent-foreground)}.hover\\:text-foreground:hover{color:var(--foreground)}}.focus-visible\\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\:ring-ring:focus-visible{--tw-ring-color:var(--ring)}.focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-50:disabled{opacity:.5}.has-\\[\\[data-slot\\=prompt-input-textarea\\]\\:focus-visible\\]\\:border-ring:has([data-slot=prompt-input-textarea]:focus-visible){border-color:var(--ring)}.has-\\[\\[data-slot\\=prompt-input-textarea\\]\\:focus-visible\\]\\:ring-\\[3px\\]:has([data-slot=prompt-input-textarea]:focus-visible){--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.has-\\[\\[data-slot\\=prompt-input-textarea\\]\\:focus-visible\\]\\:ring-ring\\/50:has([data-slot=prompt-input-textarea]:focus-visible){--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){.has-\\[\\[data-slot\\=prompt-input-textarea\\]\\:focus-visible\\]\\:ring-ring\\/50:has([data-slot=prompt-input-textarea]:focus-visible){--tw-ring-color:color-mix(in oklab,var(--ring)50%,transparent)}}.data-\\[approved\\=false\\]\\:border-red-500\\/50[data-approved=false]{border-color:#fb2c3680}@supports (color:color-mix(in lab, red, red)){.data-\\[approved\\=false\\]\\:border-red-500\\/50[data-approved=false]{border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.data-\\[approved\\=false\\]\\:bg-red-50\\/50[data-approved=false]{background-color:#fef2f280}@supports (color:color-mix(in lab, red, red)){.data-\\[approved\\=false\\]\\:bg-red-50\\/50[data-approved=false]{background-color:color-mix(in oklab,var(--color-red-50)50%,transparent)}}.data-\\[approved\\=true\\]\\:border-green-500\\/50[data-approved=true]{border-color:#00c75880}@supports (color:color-mix(in lab, red, red)){.data-\\[approved\\=true\\]\\:border-green-500\\/50[data-approved=true]{border-color:color-mix(in oklab,var(--color-green-500)50%,transparent)}}.data-\\[approved\\=true\\]\\:bg-green-50\\/50[data-approved=true]{background-color:#f0fdf480}@supports (color:color-mix(in lab, red, red)){.data-\\[approved\\=true\\]\\:bg-green-50\\/50[data-approved=true]{background-color:color-mix(in oklab,var(--color-green-50)50%,transparent)}}.data-\\[state\\=approval-requested\\]\\:border-amber-500\\/50[data-state=approval-requested]{border-color:#f99c0080}@supports (color:color-mix(in lab, red, red)){.data-\\[state\\=approval-requested\\]\\:border-amber-500\\/50[data-state=approval-requested]{border-color:color-mix(in oklab,var(--color-amber-500)50%,transparent)}}.data-\\[state\\=approval-requested\\]\\:bg-amber-50\\/50[data-state=approval-requested]{background-color:#fffbeb80}@supports (color:color-mix(in lab, red, red)){.data-\\[state\\=approval-requested\\]\\:bg-amber-50\\/50[data-state=approval-requested]{background-color:color-mix(in oklab,var(--color-amber-50)50%,transparent)}}.data-\\[vaul-drawer-direction\\=bottom\\]\\:inset-x-0[data-vaul-drawer-direction=bottom]{inset-inline:calc(var(--spacing)*0)}.data-\\[vaul-drawer-direction\\=bottom\\]\\:bottom-0[data-vaul-drawer-direction=bottom]{bottom:calc(var(--spacing)*0)}.data-\\[vaul-drawer-direction\\=bottom\\]\\:mt-24[data-vaul-drawer-direction=bottom]{margin-top:calc(var(--spacing)*24)}.data-\\[vaul-drawer-direction\\=bottom\\]\\:max-h-\\[80vh\\][data-vaul-drawer-direction=bottom]{max-height:80vh}.data-\\[vaul-drawer-direction\\=bottom\\]\\:rounded-t-xl[data-vaul-drawer-direction=bottom]{border-top-left-radius:calc(var(--radius) + 4px);border-top-right-radius:calc(var(--radius) + 4px)}.data-\\[vaul-drawer-direction\\=bottom\\]\\:border-t[data-vaul-drawer-direction=bottom]{border-top-style:var(--tw-border-style);border-top-width:1px}.data-\\[vaul-drawer-direction\\=left\\]\\:inset-y-0[data-vaul-drawer-direction=left]{inset-block:calc(var(--spacing)*0)}.data-\\[vaul-drawer-direction\\=left\\]\\:left-0[data-vaul-drawer-direction=left]{left:calc(var(--spacing)*0)}.data-\\[vaul-drawer-direction\\=left\\]\\:w-3\\/4[data-vaul-drawer-direction=left]{width:75%}.data-\\[vaul-drawer-direction\\=left\\]\\:rounded-r-xl[data-vaul-drawer-direction=left]{border-top-right-radius:calc(var(--radius) + 4px);border-bottom-right-radius:calc(var(--radius) + 4px)}.data-\\[vaul-drawer-direction\\=left\\]\\:border-r[data-vaul-drawer-direction=left]{border-right-style:var(--tw-border-style);border-right-width:1px}.data-\\[vaul-drawer-direction\\=right\\]\\:inset-y-0[data-vaul-drawer-direction=right]{inset-block:calc(var(--spacing)*0)}.data-\\[vaul-drawer-direction\\=right\\]\\:right-0[data-vaul-drawer-direction=right]{right:calc(var(--spacing)*0)}.data-\\[vaul-drawer-direction\\=right\\]\\:w-3\\/4[data-vaul-drawer-direction=right]{width:75%}.data-\\[vaul-drawer-direction\\=right\\]\\:rounded-l-xl[data-vaul-drawer-direction=right]{border-top-left-radius:calc(var(--radius) + 4px);border-bottom-left-radius:calc(var(--radius) + 4px)}.data-\\[vaul-drawer-direction\\=right\\]\\:border-l[data-vaul-drawer-direction=right]{border-left-style:var(--tw-border-style);border-left-width:1px}.data-\\[vaul-drawer-direction\\=top\\]\\:inset-x-0[data-vaul-drawer-direction=top]{inset-inline:calc(var(--spacing)*0)}.data-\\[vaul-drawer-direction\\=top\\]\\:top-0[data-vaul-drawer-direction=top]{top:calc(var(--spacing)*0)}.data-\\[vaul-drawer-direction\\=top\\]\\:mb-24[data-vaul-drawer-direction=top]{margin-bottom:calc(var(--spacing)*24)}.data-\\[vaul-drawer-direction\\=top\\]\\:max-h-\\[80vh\\][data-vaul-drawer-direction=top]{max-height:80vh}.data-\\[vaul-drawer-direction\\=top\\]\\:rounded-b-xl[data-vaul-drawer-direction=top]{border-bottom-right-radius:calc(var(--radius) + 4px);border-bottom-left-radius:calc(var(--radius) + 4px)}.data-\\[vaul-drawer-direction\\=top\\]\\:border-b[data-vaul-drawer-direction=top]{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}@supports ((-webkit-backdrop-filter:var(--tw)) or (backdrop-filter:var(--tw))){.supports-backdrop-filter\\:backdrop-blur-xs{--tw-backdrop-blur:blur(var(--blur-xs));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}}@media (min-width:40rem){.data-\\[vaul-drawer-direction\\=left\\]\\:sm\\:max-w-sm[data-vaul-drawer-direction=left],.data-\\[vaul-drawer-direction\\=right\\]\\:sm\\:max-w-sm[data-vaul-drawer-direction=right]{max-width:var(--container-sm)}}@media (min-width:48rem){.md\\:gap-0\\.5{gap:calc(var(--spacing)*.5)}.md\\:text-left{text-align:left}}.dark\\:bg-input\\/30:is(.dark *){background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\\:bg-input\\/30:is(.dark *){background-color:color-mix(in oklab,var(--input)30%,transparent)}}.dark\\:data-\\[approved\\=false\\]\\:bg-red-950\\/20:is(.dark *)[data-approved=false]{background-color:#46080933}@supports (color:color-mix(in lab, red, red)){.dark\\:data-\\[approved\\=false\\]\\:bg-red-950\\/20:is(.dark *)[data-approved=false]{background-color:color-mix(in oklab,var(--color-red-950)20%,transparent)}}.dark\\:data-\\[approved\\=true\\]\\:bg-green-950\\/20:is(.dark *)[data-approved=true]{background-color:#032e1533}@supports (color:color-mix(in lab, red, red)){.dark\\:data-\\[approved\\=true\\]\\:bg-green-950\\/20:is(.dark *)[data-approved=true]{background-color:color-mix(in oklab,var(--color-green-950)20%,transparent)}}.dark\\:data-\\[state\\=approval-requested\\]\\:bg-amber-950\\/20:is(.dark *)[data-state=approval-requested]{background-color:#46190133}@supports (color:color-mix(in lab, red, red)){.dark\\:data-\\[state\\=approval-requested\\]\\:bg-amber-950\\/20:is(.dark *)[data-state=approval-requested]{background-color:color-mix(in oklab,var(--color-amber-950)20%,transparent)}}.\\[\\&\\>\\*\\:first-child\\]\\:mt-0>:first-child{margin-top:calc(var(--spacing)*0)}.\\[\\&\\>\\*\\:last-child\\]\\:mb-0>:last-child{margin-bottom:calc(var(--spacing)*0)}}.assistant-root{--radius:.625rem;--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--card:oklch(100% 0 0);--card-foreground:oklch(14.5% 0 0);--popover:oklch(100% 0 0);--popover-foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(55.6% 0 0);--accent:oklch(97% 0 0);--accent-foreground:oklch(20.5% 0 0);--destructive:oklch(57.7% .245 27.325);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);color:var(--foreground);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background:0 0;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;line-height:1.5}.assistant-root.dark{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20.5% 0 0);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20.5% 0 0);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(26.9% 0 0);--muted-foreground:oklch(70.8% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(70.4% .191 22.216);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0)}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}`;function dt({children:e,className:t,theme:n,...r}){let i=c(null),[a,s]=l(null),[u,d]=l(`light`);o(()=>{if(n!==void 0)return;let e=()=>{d(document.documentElement.classList.contains(`dark`)?`dark`:`light`)};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()},[n]),o(()=>{if(i.current&&!i.current.shadowRoot){let e=i.current.attachShadow({mode:`open`}),t=new CSSStyleSheet;t.replaceSync(ut),e.adoptedStyleSheets=[t],s(e)}},[]);let f=n??u;return p(`div`,{ref:i,"data-slot":`assistant-root-host`,className:D(`assistant-root-host flex flex-col`,t),style:{minHeight:0,height:`100%`,...r.style},...r,children:a&&ie(p(`div`,{className:D(`assistant-root flex flex-col h-full min-h-0 overflow-hidden`,f===`dark`&&`dark`),children:e}),a)})}export{N as $,we as A,pe as B,Le as C,ke as D,Ae as E,Y as F,B as G,V as H,K as I,L as J,R as K,me as L,Ee as M,xe as N,X as O,q as P,A as Q,J as R,Ve as S,je as T,H as U,G as V,U as W,z as X,I as Y,ce as Z,Je as _,lt as a,ae as at,$ as b,Qe as c,oe as ct,nt as d,M as et,tt as f,Xe as g,rt as h,st as i,D as it,Te as j,Ce as k,et as l,E as lt,Ze as m,at as n,ue as nt,ot as o,T as ot,$e as p,F as q,ct as r,le as rt,Ye as s,se as st,dt as t,j as tt,it as u,Ge as v,Q as w,Be as x,We as y,W as z};
|
|
@@ -2,7 +2,7 @@ import { S as UseDynamicUIReturn, a as AssistantConfig, b as UseAssistantTokenOp
|
|
|
2
2
|
import * as React$2 from "react";
|
|
3
3
|
import React$1, { ComponentProps, FormEvent, HTMLAttributes, ReactNode } from "react";
|
|
4
4
|
import { ClassValue } from "clsx";
|
|
5
|
-
import * as
|
|
5
|
+
import * as react_jsx_runtime12 from "react/jsx-runtime";
|
|
6
6
|
import { ComponentRegistry, ComponentRenderProps } from "@json-render/react";
|
|
7
7
|
import { Streamdown } from "streamdown";
|
|
8
8
|
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
@@ -53,7 +53,7 @@ declare function AssistantMessages({
|
|
|
53
53
|
addToolApprovalResponse,
|
|
54
54
|
getActionDescription,
|
|
55
55
|
className
|
|
56
|
-
}: AssistantMessagesProps):
|
|
56
|
+
}: AssistantMessagesProps): react_jsx_runtime12.JSX.Element;
|
|
57
57
|
//#endregion
|
|
58
58
|
//#region src/assistant/components/confirmation.d.ts
|
|
59
59
|
/**
|
|
@@ -99,7 +99,7 @@ declare function Confirmation({
|
|
|
99
99
|
approval,
|
|
100
100
|
state,
|
|
101
101
|
...props
|
|
102
|
-
}: ConfirmationProps):
|
|
102
|
+
}: ConfirmationProps): react_jsx_runtime12.JSX.Element | null;
|
|
103
103
|
type ConfirmationTitleProps = ComponentProps<"p">;
|
|
104
104
|
/**
|
|
105
105
|
* Title for the confirmation dialog
|
|
@@ -107,7 +107,7 @@ type ConfirmationTitleProps = ComponentProps<"p">;
|
|
|
107
107
|
declare function ConfirmationTitle({
|
|
108
108
|
className,
|
|
109
109
|
...props
|
|
110
|
-
}: ConfirmationTitleProps):
|
|
110
|
+
}: ConfirmationTitleProps): react_jsx_runtime12.JSX.Element;
|
|
111
111
|
type ConfirmationRequestProps = {
|
|
112
112
|
children?: ReactNode;
|
|
113
113
|
};
|
|
@@ -116,7 +116,7 @@ type ConfirmationRequestProps = {
|
|
|
116
116
|
*/
|
|
117
117
|
declare function ConfirmationRequest({
|
|
118
118
|
children
|
|
119
|
-
}: ConfirmationRequestProps):
|
|
119
|
+
}: ConfirmationRequestProps): react_jsx_runtime12.JSX.Element | null;
|
|
120
120
|
type ConfirmationAcceptedProps = {
|
|
121
121
|
children?: ReactNode;
|
|
122
122
|
};
|
|
@@ -125,7 +125,7 @@ type ConfirmationAcceptedProps = {
|
|
|
125
125
|
*/
|
|
126
126
|
declare function ConfirmationAccepted({
|
|
127
127
|
children
|
|
128
|
-
}: ConfirmationAcceptedProps):
|
|
128
|
+
}: ConfirmationAcceptedProps): react_jsx_runtime12.JSX.Element | null;
|
|
129
129
|
type ConfirmationRejectedProps = {
|
|
130
130
|
children?: ReactNode;
|
|
131
131
|
};
|
|
@@ -134,7 +134,7 @@ type ConfirmationRejectedProps = {
|
|
|
134
134
|
*/
|
|
135
135
|
declare function ConfirmationRejected({
|
|
136
136
|
children
|
|
137
|
-
}: ConfirmationRejectedProps):
|
|
137
|
+
}: ConfirmationRejectedProps): react_jsx_runtime12.JSX.Element | null;
|
|
138
138
|
type ConfirmationActionsProps = ComponentProps<"div">;
|
|
139
139
|
/**
|
|
140
140
|
* Container for approve/deny action buttons
|
|
@@ -144,7 +144,7 @@ type ConfirmationActionsProps = ComponentProps<"div">;
|
|
|
144
144
|
declare function ConfirmationActions({
|
|
145
145
|
className,
|
|
146
146
|
...props
|
|
147
|
-
}: ConfirmationActionsProps):
|
|
147
|
+
}: ConfirmationActionsProps): react_jsx_runtime12.JSX.Element | null;
|
|
148
148
|
type ConfirmationActionProps = ComponentProps<"button"> & {
|
|
149
149
|
/** Button variant for styling */variant?: "default" | "outline" | "destructive";
|
|
150
150
|
};
|
|
@@ -167,7 +167,7 @@ declare function ConfirmationAction({
|
|
|
167
167
|
className,
|
|
168
168
|
variant,
|
|
169
169
|
...props
|
|
170
|
-
}: ConfirmationActionProps):
|
|
170
|
+
}: ConfirmationActionProps): react_jsx_runtime12.JSX.Element;
|
|
171
171
|
//#endregion
|
|
172
172
|
//#region src/assistant/components/conversation.d.ts
|
|
173
173
|
type ConversationProps = HTMLAttributes<HTMLDivElement>;
|
|
@@ -196,7 +196,7 @@ declare function Conversation({
|
|
|
196
196
|
className,
|
|
197
197
|
children,
|
|
198
198
|
...props
|
|
199
|
-
}: ConversationProps):
|
|
199
|
+
}: ConversationProps): react_jsx_runtime12.JSX.Element;
|
|
200
200
|
type ConversationContentProps = HTMLAttributes<HTMLDivElement>;
|
|
201
201
|
/**
|
|
202
202
|
* Scrollable content area for messages
|
|
@@ -215,7 +215,7 @@ declare function ConversationContent({
|
|
|
215
215
|
className,
|
|
216
216
|
children,
|
|
217
217
|
...props
|
|
218
|
-
}: ConversationContentProps):
|
|
218
|
+
}: ConversationContentProps): react_jsx_runtime12.JSX.Element;
|
|
219
219
|
type ConversationEmptyStateProps = ComponentProps<"div"> & {
|
|
220
220
|
/** Title text for the empty state */title?: string; /** Description text for the empty state */
|
|
221
221
|
description?: string; /** Icon to display above the title */
|
|
@@ -240,7 +240,7 @@ declare function ConversationEmptyState({
|
|
|
240
240
|
icon,
|
|
241
241
|
children,
|
|
242
242
|
...props
|
|
243
|
-
}: ConversationEmptyStateProps):
|
|
243
|
+
}: ConversationEmptyStateProps): react_jsx_runtime12.JSX.Element;
|
|
244
244
|
type ConversationScrollButtonProps = ComponentProps<"button">;
|
|
245
245
|
/**
|
|
246
246
|
* Button to scroll to the bottom of the conversation
|
|
@@ -279,7 +279,7 @@ declare function DynamicActionModal({
|
|
|
279
279
|
availableActions,
|
|
280
280
|
onExecute,
|
|
281
281
|
onClose
|
|
282
|
-
}: DynamicActionModalProps):
|
|
282
|
+
}: DynamicActionModalProps): react_jsx_runtime12.JSX.Element | null;
|
|
283
283
|
//#endregion
|
|
284
284
|
//#region src/assistant/components/dynamic-ui.d.ts
|
|
285
285
|
interface DynamicUIProps {
|
|
@@ -319,7 +319,7 @@ interface DynamicUIProps {
|
|
|
319
319
|
*/
|
|
320
320
|
declare function DynamicUI({
|
|
321
321
|
className
|
|
322
|
-
}: DynamicUIProps):
|
|
322
|
+
}: DynamicUIProps): react_jsx_runtime12.JSX.Element | null;
|
|
323
323
|
//#endregion
|
|
324
324
|
//#region src/assistant/components/dynamic-ui-components.d.ts
|
|
325
325
|
/**
|
|
@@ -331,7 +331,7 @@ declare function DynamicUI({
|
|
|
331
331
|
declare function DynamicButtonRenderer({
|
|
332
332
|
element,
|
|
333
333
|
onAction
|
|
334
|
-
}: ComponentRenderProps<DynamicButton>):
|
|
334
|
+
}: ComponentRenderProps<DynamicButton>): react_jsx_runtime12.JSX.Element | null;
|
|
335
335
|
/**
|
|
336
336
|
* Renderer for DynamicButtonGroup elements
|
|
337
337
|
*
|
|
@@ -341,7 +341,7 @@ declare function DynamicButtonRenderer({
|
|
|
341
341
|
declare function DynamicButtonGroupRenderer({
|
|
342
342
|
element,
|
|
343
343
|
children
|
|
344
|
-
}: ComponentRenderProps<DynamicButtonGroup>):
|
|
344
|
+
}: ComponentRenderProps<DynamicButtonGroup>): react_jsx_runtime12.JSX.Element;
|
|
345
345
|
/**
|
|
346
346
|
* Component registry for DynamicUI rendering
|
|
347
347
|
*/
|
|
@@ -364,7 +364,7 @@ declare function FormRenderer({
|
|
|
364
364
|
id: string;
|
|
365
365
|
title?: string;
|
|
366
366
|
submitLabel?: string;
|
|
367
|
-
}>):
|
|
367
|
+
}>): react_jsx_runtime12.JSX.Element;
|
|
368
368
|
/**
|
|
369
369
|
* TextField component - renders a labeled input field
|
|
370
370
|
*
|
|
@@ -383,7 +383,7 @@ declare function TextFieldRenderer({
|
|
|
383
383
|
placeholder?: string;
|
|
384
384
|
required?: boolean;
|
|
385
385
|
defaultValue?: string;
|
|
386
|
-
}>):
|
|
386
|
+
}>): react_jsx_runtime12.JSX.Element;
|
|
387
387
|
/**
|
|
388
388
|
* TextArea component - renders a labeled textarea for longer text
|
|
389
389
|
*
|
|
@@ -404,7 +404,7 @@ declare function TextAreaRenderer({
|
|
|
404
404
|
required?: boolean;
|
|
405
405
|
defaultValue?: string;
|
|
406
406
|
rows?: number;
|
|
407
|
-
}>):
|
|
407
|
+
}>): react_jsx_runtime12.JSX.Element;
|
|
408
408
|
/**
|
|
409
409
|
* DateField component - renders a labeled date input
|
|
410
410
|
*
|
|
@@ -425,7 +425,7 @@ declare function DateFieldRenderer({
|
|
|
425
425
|
defaultValue?: string;
|
|
426
426
|
min?: string;
|
|
427
427
|
max?: string;
|
|
428
|
-
}>):
|
|
428
|
+
}>): react_jsx_runtime12.JSX.Element;
|
|
429
429
|
/**
|
|
430
430
|
* Default component registry for form rendering
|
|
431
431
|
*
|
|
@@ -500,7 +500,7 @@ declare function AssistantFormRenderer({
|
|
|
500
500
|
onSubmit,
|
|
501
501
|
onCancel,
|
|
502
502
|
registry
|
|
503
|
-
}: AssistantFormRendererProps):
|
|
503
|
+
}: AssistantFormRendererProps): react_jsx_runtime12.JSX.Element;
|
|
504
504
|
//#endregion
|
|
505
505
|
//#region src/assistant/components/message.d.ts
|
|
506
506
|
type MessageProps = HTMLAttributes<HTMLDivElement> & {
|
|
@@ -529,7 +529,7 @@ declare function Message({
|
|
|
529
529
|
className,
|
|
530
530
|
from,
|
|
531
531
|
...props
|
|
532
|
-
}: MessageProps):
|
|
532
|
+
}: MessageProps): react_jsx_runtime12.JSX.Element;
|
|
533
533
|
type MessageContentProps = HTMLAttributes<HTMLDivElement>;
|
|
534
534
|
/**
|
|
535
535
|
* Content wrapper for message text/elements
|
|
@@ -550,7 +550,7 @@ declare function MessageContent({
|
|
|
550
550
|
children,
|
|
551
551
|
className,
|
|
552
552
|
...props
|
|
553
|
-
}: MessageContentProps):
|
|
553
|
+
}: MessageContentProps): react_jsx_runtime12.JSX.Element;
|
|
554
554
|
type MessageResponseProps = ComponentProps<typeof Streamdown>;
|
|
555
555
|
/**
|
|
556
556
|
* Renders markdown content from the assistant using Streamdown
|
|
@@ -583,13 +583,13 @@ declare const MessageResponse: React$1.MemoExoticComponent<(props: MessageRespon
|
|
|
583
583
|
*/
|
|
584
584
|
declare function Collapsible({
|
|
585
585
|
...props
|
|
586
|
-
}: React.ComponentProps<typeof CollapsiblePrimitive.Root>):
|
|
586
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.Root>): react_jsx_runtime12.JSX.Element;
|
|
587
587
|
/**
|
|
588
588
|
* Trigger element that toggles the collapsible content
|
|
589
589
|
*/
|
|
590
590
|
declare function CollapsibleTrigger({
|
|
591
591
|
...props
|
|
592
|
-
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>):
|
|
592
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>): react_jsx_runtime12.JSX.Element;
|
|
593
593
|
/**
|
|
594
594
|
* Content that is shown/hidden based on the collapsible state
|
|
595
595
|
*
|
|
@@ -597,7 +597,7 @@ declare function CollapsibleTrigger({
|
|
|
597
597
|
*/
|
|
598
598
|
declare function CollapsibleContent({
|
|
599
599
|
...props
|
|
600
|
-
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>):
|
|
600
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>): react_jsx_runtime12.JSX.Element;
|
|
601
601
|
//#endregion
|
|
602
602
|
//#region src/assistant/components/primitives/drawer.d.ts
|
|
603
603
|
/**
|
|
@@ -622,32 +622,32 @@ declare function CollapsibleContent({
|
|
|
622
622
|
*/
|
|
623
623
|
declare function Drawer$1({
|
|
624
624
|
...props
|
|
625
|
-
}: React$2.ComponentProps<typeof Drawer.Root>):
|
|
625
|
+
}: React$2.ComponentProps<typeof Drawer.Root>): react_jsx_runtime12.JSX.Element;
|
|
626
626
|
/**
|
|
627
627
|
* Trigger element that opens the drawer
|
|
628
628
|
*/
|
|
629
629
|
declare function DrawerTrigger({
|
|
630
630
|
...props
|
|
631
|
-
}: React$2.ComponentProps<typeof Drawer.Trigger>):
|
|
631
|
+
}: React$2.ComponentProps<typeof Drawer.Trigger>): react_jsx_runtime12.JSX.Element;
|
|
632
632
|
/**
|
|
633
633
|
* Portal for rendering drawer content outside the DOM hierarchy
|
|
634
634
|
*/
|
|
635
635
|
declare function DrawerPortal({
|
|
636
636
|
...props
|
|
637
|
-
}: React$2.ComponentProps<typeof Drawer.Portal>):
|
|
637
|
+
}: React$2.ComponentProps<typeof Drawer.Portal>): react_jsx_runtime12.JSX.Element;
|
|
638
638
|
/**
|
|
639
639
|
* Close button element for the drawer
|
|
640
640
|
*/
|
|
641
641
|
declare function DrawerClose({
|
|
642
642
|
...props
|
|
643
|
-
}: React$2.ComponentProps<typeof Drawer.Close>):
|
|
643
|
+
}: React$2.ComponentProps<typeof Drawer.Close>): react_jsx_runtime12.JSX.Element;
|
|
644
644
|
/**
|
|
645
645
|
* Overlay backdrop for the drawer
|
|
646
646
|
*/
|
|
647
647
|
declare function DrawerOverlay({
|
|
648
648
|
className,
|
|
649
649
|
...props
|
|
650
|
-
}: React$2.ComponentProps<typeof Drawer.Overlay>):
|
|
650
|
+
}: React$2.ComponentProps<typeof Drawer.Overlay>): react_jsx_runtime12.JSX.Element;
|
|
651
651
|
interface DrawerContentProps extends React$2.ComponentProps<typeof Drawer.Content> {
|
|
652
652
|
/** Whether to render the overlay (default: true) */
|
|
653
653
|
overlay?: boolean;
|
|
@@ -666,35 +666,35 @@ declare function DrawerContent({
|
|
|
666
666
|
children,
|
|
667
667
|
overlay,
|
|
668
668
|
...props
|
|
669
|
-
}: DrawerContentProps):
|
|
669
|
+
}: DrawerContentProps): react_jsx_runtime12.JSX.Element;
|
|
670
670
|
/**
|
|
671
671
|
* Header section for the drawer
|
|
672
672
|
*/
|
|
673
673
|
declare function DrawerHeader({
|
|
674
674
|
className,
|
|
675
675
|
...props
|
|
676
|
-
}: React$2.ComponentProps<"div">):
|
|
676
|
+
}: React$2.ComponentProps<"div">): react_jsx_runtime12.JSX.Element;
|
|
677
677
|
/**
|
|
678
678
|
* Footer section for the drawer
|
|
679
679
|
*/
|
|
680
680
|
declare function DrawerFooter({
|
|
681
681
|
className,
|
|
682
682
|
...props
|
|
683
|
-
}: React$2.ComponentProps<"div">):
|
|
683
|
+
}: React$2.ComponentProps<"div">): react_jsx_runtime12.JSX.Element;
|
|
684
684
|
/**
|
|
685
685
|
* Title element for the drawer
|
|
686
686
|
*/
|
|
687
687
|
declare function DrawerTitle({
|
|
688
688
|
className,
|
|
689
689
|
...props
|
|
690
|
-
}: React$2.ComponentProps<typeof Drawer.Title>):
|
|
690
|
+
}: React$2.ComponentProps<typeof Drawer.Title>): react_jsx_runtime12.JSX.Element;
|
|
691
691
|
/**
|
|
692
692
|
* Description element for the drawer
|
|
693
693
|
*/
|
|
694
694
|
declare function DrawerDescription({
|
|
695
695
|
className,
|
|
696
696
|
...props
|
|
697
|
-
}: React$2.ComponentProps<typeof Drawer.Description>):
|
|
697
|
+
}: React$2.ComponentProps<typeof Drawer.Description>): react_jsx_runtime12.JSX.Element;
|
|
698
698
|
//#endregion
|
|
699
699
|
//#region src/assistant/components/prompt-input.d.ts
|
|
700
700
|
type PromptInputMessage = {
|
|
@@ -723,14 +723,23 @@ declare function PromptInput({
|
|
|
723
723
|
onSubmit,
|
|
724
724
|
children,
|
|
725
725
|
...props
|
|
726
|
-
}: PromptInputProps):
|
|
727
|
-
type PromptInputTextareaProps = ComponentProps<"textarea"
|
|
726
|
+
}: PromptInputProps): react_jsx_runtime12.JSX.Element;
|
|
727
|
+
type PromptInputTextareaProps = ComponentProps<"textarea"> & {
|
|
728
|
+
/**
|
|
729
|
+
* Stop keyboard event propagation to prevent conflicts with app shortcuts.
|
|
730
|
+
* When rendered in Shadow DOM, document.activeElement returns the shadow host
|
|
731
|
+
* which breaks keyboard shortcut libraries (Kbar, etc.) that check focus.
|
|
732
|
+
* @default true
|
|
733
|
+
*/
|
|
734
|
+
stopKeyPropagation?: boolean;
|
|
735
|
+
};
|
|
728
736
|
/**
|
|
729
737
|
* Textarea for entering the chat prompt
|
|
730
738
|
*
|
|
731
739
|
* - Press Enter to submit (Shift+Enter for new line)
|
|
732
740
|
* - Handles IME composition for international text input
|
|
733
741
|
* - Auto-resizes based on content
|
|
742
|
+
* - Stops keyboard event propagation by default to prevent conflicts with app shortcuts
|
|
734
743
|
*
|
|
735
744
|
* @example
|
|
736
745
|
* ```tsx
|
|
@@ -745,8 +754,11 @@ declare function PromptInputTextarea({
|
|
|
745
754
|
onChange,
|
|
746
755
|
className,
|
|
747
756
|
placeholder,
|
|
757
|
+
stopKeyPropagation,
|
|
758
|
+
onKeyDown: onKeyDownProp,
|
|
759
|
+
onKeyUp: onKeyUpProp,
|
|
748
760
|
...props
|
|
749
|
-
}: PromptInputTextareaProps):
|
|
761
|
+
}: PromptInputTextareaProps): react_jsx_runtime12.JSX.Element;
|
|
750
762
|
type PromptInputFooterProps = ComponentProps<"div">;
|
|
751
763
|
/**
|
|
752
764
|
* Footer section for the prompt input (contains buttons)
|
|
@@ -762,7 +774,7 @@ type PromptInputFooterProps = ComponentProps<"div">;
|
|
|
762
774
|
declare function PromptInputFooter({
|
|
763
775
|
className,
|
|
764
776
|
...props
|
|
765
|
-
}: PromptInputFooterProps):
|
|
777
|
+
}: PromptInputFooterProps): react_jsx_runtime12.JSX.Element;
|
|
766
778
|
type PromptInputButtonProps = ComponentProps<"button">;
|
|
767
779
|
/**
|
|
768
780
|
* Generic button for the prompt input area
|
|
@@ -779,7 +791,7 @@ declare function PromptInputButton({
|
|
|
779
791
|
type,
|
|
780
792
|
children,
|
|
781
793
|
...props
|
|
782
|
-
}: PromptInputButtonProps):
|
|
794
|
+
}: PromptInputButtonProps): react_jsx_runtime12.JSX.Element;
|
|
783
795
|
type PromptInputSubmitProps = ComponentProps<"button"> & {
|
|
784
796
|
/** Current chat status to show appropriate icon */status?: ChatStatus; /** Custom icon to override the default */
|
|
785
797
|
icon?: ReactNode;
|
|
@@ -807,7 +819,7 @@ declare function PromptInputSubmit({
|
|
|
807
819
|
icon,
|
|
808
820
|
children,
|
|
809
821
|
...props
|
|
810
|
-
}: PromptInputSubmitProps):
|
|
822
|
+
}: PromptInputSubmitProps): react_jsx_runtime12.JSX.Element;
|
|
811
823
|
//#endregion
|
|
812
824
|
//#region src/assistant/components/task.d.ts
|
|
813
825
|
type TaskItemFileProps = ComponentProps<"div">;
|
|
@@ -825,7 +837,7 @@ declare function TaskItemFile({
|
|
|
825
837
|
children,
|
|
826
838
|
className,
|
|
827
839
|
...props
|
|
828
|
-
}: TaskItemFileProps):
|
|
840
|
+
}: TaskItemFileProps): react_jsx_runtime12.JSX.Element;
|
|
829
841
|
type TaskItemProps = ComponentProps<"div">;
|
|
830
842
|
/**
|
|
831
843
|
* Individual task/action item within a Task list
|
|
@@ -839,7 +851,7 @@ declare function TaskItem({
|
|
|
839
851
|
children,
|
|
840
852
|
className,
|
|
841
853
|
...props
|
|
842
|
-
}: TaskItemProps):
|
|
854
|
+
}: TaskItemProps): react_jsx_runtime12.JSX.Element;
|
|
843
855
|
type TaskProps = ComponentProps<typeof Collapsible>;
|
|
844
856
|
/**
|
|
845
857
|
* Collapsible container for displaying a list of actions/tasks
|
|
@@ -860,7 +872,7 @@ declare function Task({
|
|
|
860
872
|
defaultOpen,
|
|
861
873
|
className,
|
|
862
874
|
...props
|
|
863
|
-
}: TaskProps):
|
|
875
|
+
}: TaskProps): react_jsx_runtime12.JSX.Element;
|
|
864
876
|
type TaskTriggerProps = ComponentProps<typeof CollapsibleTrigger> & {
|
|
865
877
|
/** Title text for the task group */title: string; /** Custom icon (defaults to SearchIcon) */
|
|
866
878
|
icon?: ReactNode;
|
|
@@ -882,7 +894,7 @@ declare function TaskTrigger({
|
|
|
882
894
|
title,
|
|
883
895
|
icon,
|
|
884
896
|
...props
|
|
885
|
-
}: TaskTriggerProps):
|
|
897
|
+
}: TaskTriggerProps): react_jsx_runtime12.JSX.Element;
|
|
886
898
|
type TaskContentProps = ComponentProps<typeof CollapsibleContent>;
|
|
887
899
|
/**
|
|
888
900
|
* Collapsible content area containing the task items
|
|
@@ -893,7 +905,7 @@ declare function TaskContent({
|
|
|
893
905
|
children,
|
|
894
906
|
className,
|
|
895
907
|
...props
|
|
896
|
-
}: TaskContentProps):
|
|
908
|
+
}: TaskContentProps): react_jsx_runtime12.JSX.Element;
|
|
897
909
|
//#endregion
|
|
898
910
|
//#region src/assistant/context.d.ts
|
|
899
911
|
/**
|
|
@@ -904,7 +916,8 @@ type AssistantContextValue = UseAssistantReturn & {
|
|
|
904
916
|
onAction?: (action: {
|
|
905
917
|
name: string;
|
|
906
918
|
options?: Record<string, unknown>;
|
|
907
|
-
}) => void;
|
|
919
|
+
}) => void; /** Centralized DynamicUI state shared across all components */
|
|
920
|
+
dynamicUI: UseDynamicUIReturn;
|
|
908
921
|
};
|
|
909
922
|
interface AssistantProviderProps extends AssistantConfig {
|
|
910
923
|
children: ReactNode;
|
|
@@ -966,7 +979,7 @@ declare function AssistantProvider({
|
|
|
966
979
|
getContext,
|
|
967
980
|
onAction,
|
|
968
981
|
onError
|
|
969
|
-
}: AssistantProviderProps):
|
|
982
|
+
}: AssistantProviderProps): react_jsx_runtime12.JSX.Element;
|
|
970
983
|
/**
|
|
971
984
|
* Hook to access the assistant context
|
|
972
985
|
*
|
|
@@ -1246,7 +1259,7 @@ declare function AssistantRoot({
|
|
|
1246
1259
|
className,
|
|
1247
1260
|
theme,
|
|
1248
1261
|
...props
|
|
1249
|
-
}: AssistantRootProps):
|
|
1262
|
+
}: AssistantRootProps): react_jsx_runtime12.JSX.Element;
|
|
1250
1263
|
//#endregion
|
|
1251
1264
|
//#region src/assistant/utils/cn.d.ts
|
|
1252
1265
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { S as UseDynamicUIReturn, _ as ToolActionSchema, a as AssistantConfig, b as UseAssistantTokenOptions, c as DynamicButton, d as DynamicUITree, f as TokenRequest, g as ToolAction, h as TokenResponseSchema, i as ActionOptionSchema, l as DynamicButtonGroup, m as TokenResponse, n as ActionDefinitionSchema, o as ChatStatus, p as TokenRequestSchema, r as ActionOption, s as CreateAssistantTokenHandlerOptions, t as ActionDefinition, u as DynamicUIElement, v as UseAssistantOptions, x as UseAssistantTokenReturn, y as UseAssistantReturn } from "./types-C7I0JuqF.js";
|
|
2
|
-
import { $ as MessageContentProps, A as PromptInputFooterProps, At as ConfirmationActions, B as DrawerContentProps, Bt as AssistantMessages, C as TaskProps, Ct as ConversationScrollButton, D as PromptInputButton, Dt as ConfirmationAcceptedProps, E as PromptInput, Et as ConfirmationAccepted, F as PromptInputTextarea, Ft as ConfirmationRequest, G as DrawerPortal, H as DrawerFooter, I as PromptInputTextareaProps, It as ConfirmationRequestProps, J as Collapsible, K as DrawerTitle, L as Drawer, Lt as ConfirmationTitle, M as PromptInputProps, Mt as ConfirmationProps, N as PromptInputSubmit, Nt as ConfirmationRejected, O as PromptInputButtonProps, Ot as ConfirmationAction, P as PromptInputSubmitProps, Pt as ConfirmationRejectedProps, Q as MessageContent, R as DrawerClose, Rt as ConfirmationTitleProps, S as TaskItemProps, St as ConversationProps, T as TaskTriggerProps, Tt as Confirmation, U as DrawerHeader, V as DrawerDescription, Vt as AssistantMessagesProps, W as DrawerOverlay, X as CollapsibleTrigger, Y as CollapsibleContent, Z as Message, _ as TaskContent, _t as Conversation, a as useToolExecution, at as DateFieldRenderer, b as TaskItemFile, bt as ConversationEmptyState, c as useDynamicUIToolExecution, ct as TextFieldRenderer, d as useAssistant, dt as DynamicButtonRenderer, et as MessageProps, f as AssistantContextValue, ft as dynamicUIRegistry, g as Task, gt as DynamicActionModalProps, h as useAssistantContext, ht as DynamicActionModal, i as UseToolExecutionOptions, it as AssistantFormRendererProps, j as PromptInputMessage, jt as ConfirmationActionsProps, k as PromptInputFooter, kt as ConfirmationActionProps, l as UseDynamicUIOptions, lt as defaultFormRegistry, m as AssistantProviderProps, mt as DynamicUIProps, n as AssistantRoot, nt as MessageResponseProps, o as useAssistantToken, ot as FormRenderer, p as AssistantProvider, pt as DynamicUI, q as DrawerTrigger, r as AssistantRootProps, rt as AssistantFormRenderer, s as UseDynamicUIToolExecutionOptions, st as TextAreaRenderer, t as cn, tt as MessageResponse, u as useDynamicUI, ut as DynamicButtonGroupRenderer, v as TaskContentProps, vt as ConversationContent, w as TaskTrigger, wt as ConversationScrollButtonProps, x as TaskItemFileProps, xt as ConversationEmptyStateProps, y as TaskItem, yt as ConversationContentProps, z as DrawerContent, zt as ToolUIPartApproval } from "./index-
|
|
2
|
+
import { $ as MessageContentProps, A as PromptInputFooterProps, At as ConfirmationActions, B as DrawerContentProps, Bt as AssistantMessages, C as TaskProps, Ct as ConversationScrollButton, D as PromptInputButton, Dt as ConfirmationAcceptedProps, E as PromptInput, Et as ConfirmationAccepted, F as PromptInputTextarea, Ft as ConfirmationRequest, G as DrawerPortal, H as DrawerFooter, I as PromptInputTextareaProps, It as ConfirmationRequestProps, J as Collapsible, K as DrawerTitle, L as Drawer, Lt as ConfirmationTitle, M as PromptInputProps, Mt as ConfirmationProps, N as PromptInputSubmit, Nt as ConfirmationRejected, O as PromptInputButtonProps, Ot as ConfirmationAction, P as PromptInputSubmitProps, Pt as ConfirmationRejectedProps, Q as MessageContent, R as DrawerClose, Rt as ConfirmationTitleProps, S as TaskItemProps, St as ConversationProps, T as TaskTriggerProps, Tt as Confirmation, U as DrawerHeader, V as DrawerDescription, Vt as AssistantMessagesProps, W as DrawerOverlay, X as CollapsibleTrigger, Y as CollapsibleContent, Z as Message, _ as TaskContent, _t as Conversation, a as useToolExecution, at as DateFieldRenderer, b as TaskItemFile, bt as ConversationEmptyState, c as useDynamicUIToolExecution, ct as TextFieldRenderer, d as useAssistant, dt as DynamicButtonRenderer, et as MessageProps, f as AssistantContextValue, ft as dynamicUIRegistry, g as Task, gt as DynamicActionModalProps, h as useAssistantContext, ht as DynamicActionModal, i as UseToolExecutionOptions, it as AssistantFormRendererProps, j as PromptInputMessage, jt as ConfirmationActionsProps, k as PromptInputFooter, kt as ConfirmationActionProps, l as UseDynamicUIOptions, lt as defaultFormRegistry, m as AssistantProviderProps, mt as DynamicUIProps, n as AssistantRoot, nt as MessageResponseProps, o as useAssistantToken, ot as FormRenderer, p as AssistantProvider, pt as DynamicUI, q as DrawerTrigger, r as AssistantRootProps, rt as AssistantFormRenderer, s as UseDynamicUIToolExecutionOptions, st as TextAreaRenderer, t as cn, tt as MessageResponse, u as useDynamicUI, ut as DynamicButtonGroupRenderer, v as TaskContentProps, vt as ConversationContent, w as TaskTrigger, wt as ConversationScrollButtonProps, x as TaskItemFileProps, xt as ConversationEmptyStateProps, y as TaskItem, yt as ConversationContentProps, z as DrawerContent, zt as ToolUIPartApproval } from "./index-CuQS1I9u.js";
|
|
3
3
|
export { ActionDefinition, ActionDefinitionSchema, ActionOption, ActionOptionSchema, AssistantConfig, AssistantContextValue, AssistantFormRenderer, AssistantFormRendererProps, AssistantMessages, AssistantMessagesProps, AssistantProvider, AssistantProviderProps, AssistantRoot, AssistantRootProps, ChatStatus, Collapsible, CollapsibleContent, CollapsibleTrigger, Confirmation, ConfirmationAccepted, ConfirmationAcceptedProps, ConfirmationAction, ConfirmationActionProps, ConfirmationActions, ConfirmationActionsProps, ConfirmationProps, ConfirmationRejected, ConfirmationRejectedProps, ConfirmationRequest, ConfirmationRequestProps, ConfirmationTitle, ConfirmationTitleProps, Conversation, ConversationContent, ConversationContentProps, ConversationEmptyState, ConversationEmptyStateProps, ConversationProps, ConversationScrollButton, ConversationScrollButtonProps, CreateAssistantTokenHandlerOptions, DateFieldRenderer, Drawer, DrawerClose, DrawerContent, DrawerContentProps, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DynamicActionModal, DynamicActionModalProps, DynamicButton, DynamicButtonGroup, DynamicButtonGroupRenderer, DynamicButtonRenderer, DynamicUI, DynamicUIElement, DynamicUIProps, DynamicUITree, FormRenderer, Message, MessageContent, MessageContentProps, MessageProps, MessageResponse, MessageResponseProps, PromptInput, PromptInputButton, PromptInputButtonProps, PromptInputFooter, PromptInputFooterProps, PromptInputMessage, PromptInputProps, PromptInputSubmit, PromptInputSubmitProps, PromptInputTextarea, PromptInputTextareaProps, Task, TaskContent, TaskContentProps, TaskItem, TaskItemFile, TaskItemFileProps, TaskItemProps, TaskProps, TaskTrigger, TaskTriggerProps, TextAreaRenderer, TextFieldRenderer, TokenRequest, TokenRequestSchema, TokenResponse, TokenResponseSchema, ToolAction, ToolActionSchema, ToolUIPartApproval, UseAssistantOptions, UseAssistantReturn, UseAssistantTokenOptions, UseAssistantTokenReturn, UseDynamicUIOptions, UseDynamicUIReturn, UseDynamicUIToolExecutionOptions, UseToolExecutionOptions, cn, defaultFormRegistry, dynamicUIRegistry, useAssistant, useAssistantContext, useAssistantToken, useDynamicUI, useDynamicUIToolExecution, useToolExecution };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as y,T as b,U as x,V as S,W as C,X as w,Y as T,Z as E,_ as D,a as O,at as k,b as A,c as j,ct as M,d as N,et as P,f as F,g as I,h as L,i as R,it as z,j as B,k as V,l as H,lt as U,m as W,n as G,nt as K,o as q,ot as J,p as Y,q as X,r as Z,rt as Q,s as $,st as ee,t as te,tt as ne,u as re,v as ie,w as ae,x as oe,y as se,z as ce}from"./assistant-
|
|
1
|
+
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as y,T as b,U as x,V as S,W as C,X as w,Y as T,Z as E,_ as D,a as O,at as k,b as A,c as j,ct as M,d as N,et as P,f as F,g as I,h as L,i as R,it as z,j as B,k as V,l as H,lt as U,m as W,n as G,nt as K,o as q,ot as J,p as Y,q as X,r as Z,rt as Q,s as $,st as ee,t as te,tt as ne,u as re,v as ie,w as ae,x as oe,y as se,z as ce}from"./assistant-Biyuv7HJ.js";export{k as ActionDefinitionSchema,J as ActionOptionSchema,s as AssistantFormRenderer,m as AssistantMessages,oe as AssistantProvider,te as AssistantRoot,ce as Collapsible,n as CollapsibleContent,S as CollapsibleTrigger,E as Confirmation,_ as ConfirmationAccepted,e as ConfirmationAction,P as ConfirmationActions,ne as ConfirmationRejected,K as ConfirmationRequest,Q as ConfirmationTitle,V as Conversation,t as ConversationContent,B as ConversationEmptyState,p as ConversationScrollButton,d as DateFieldRenderer,$ as Drawer,j as DrawerClose,H as DrawerContent,re as DrawerDescription,N as DrawerFooter,F as DrawerHeader,Y as DrawerOverlay,W as DrawerPortal,L as DrawerTitle,I as DrawerTrigger,h as DynamicActionModal,ie as DynamicButtonGroupRenderer,se as DynamicButtonRenderer,D as DynamicUI,X as FormRenderer,c as Message,x as MessageContent,C as MessageResponse,G as PromptInput,Z as PromptInputButton,R as PromptInputFooter,O as PromptInputSubmit,q as PromptInputTextarea,g as Task,o as TaskContent,l as TaskItem,f as TaskItemFile,v as TaskTrigger,u as TextAreaRenderer,T as TextFieldRenderer,ee as TokenRequestSchema,M as TokenResponseSchema,U as ToolActionSchema,z as cn,w as defaultFormRegistry,A as dynamicUIRegistry,b as useAssistant,y as useAssistantContext,i as useAssistantToken,ae as useDynamicUI,r as useDynamicUIToolExecution,a as useToolExecution};
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{z as e}from"zod";import{Children as t,createContext as n,memo as r,useCallback as i,useContext as a,useEffect as o,useMemo as s,useRef as c,useState as l}from"react";import{clsx as u}from"clsx";import{twMerge as d}from"tailwind-merge";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{JSONUIProvider as h,Renderer as g}from"@json-render/react";import{Streamdown as _}from"streamdown";import{ChevronDownIcon as v,CornerDownLeftIcon as y,Loader2Icon as b,SearchIcon as x,SquareIcon as S,XIcon as ee}from"lucide-react";import*as C from"@radix-ui/react-collapsible";import{useChat as te}from"@ai-sdk/react";import{DefaultChatTransport as ne,lastAssistantMessageIsCompleteWithApprovalResponses as re}from"ai";import{Drawer as w}from"vaul-base";import{createPortal as ie}from"react-dom";const ae=e.object({type:e.string(),description:e.string().optional(),required:e.boolean().optional()}),oe=e.object({name:e.string(),description:e.string(),options:e.record(e.string(),ae).optional(),approvalRequired:e.boolean().optional()}),T=e.object({name:e.string(),options:e.record(e.string(),e.unknown()).optional()}),se=e.object({token:e.string(),expiresAt:e.number()}),ce=e.object({endUserId:e.string(),availableActions:e.array(oe),context:e.record(e.string(),e.unknown()).optional()});function E(...e){return d(u(e))}const le=n(null);function D(){let e=a(le);if(!e)throw Error(`Confirmation components must be used within Confirmation`);return e}function O({className:e,approval:t,state:n,...r}){return!t||n===`input-streaming`||n===`input-available`?null:p(le.Provider,{value:{approval:t,state:n},children:p(`div`,{"data-slot":`confirmation`,"data-state":n,"data-approved":t?.approved,role:`alertdialog`,"aria-labelledby":`confirmation-title`,className:E(`flex flex-col gap-2 rounded-lg border p-4`,`data-[state=approval-requested]:border-amber-500/50 data-[state=approval-requested]:bg-amber-50/50 dark:data-[state=approval-requested]:bg-amber-950/20`,`data-[approved=true]:border-green-500/50 data-[approved=true]:bg-green-50/50 dark:data-[approved=true]:bg-green-950/20`,`data-[approved=false]:border-red-500/50 data-[approved=false]:bg-red-50/50 dark:data-[approved=false]:bg-red-950/20`,e),...r})})}function k({className:e,...t}){return p(`p`,{id:`confirmation-title`,"data-slot":`confirmation-title`,className:E(`text-sm font-medium`,e),...t})}function A({children:e}){let{state:t}=D();return t===`approval-requested`?p(`div`,{"data-slot":`confirmation-request`,children:e}):null}function j({children:e}){let{approval:t,state:n}=D();return!t?.approved||n!==`approval-responded`&&n!==`output-denied`&&n!==`output-available`?null:p(`div`,{"data-slot":`confirmation-accepted`,children:e})}function M({children:e}){let{approval:t,state:n}=D();return t?.approved!==!1||n!==`approval-responded`&&n!==`output-denied`&&n!==`output-available`?null:p(`div`,{"data-slot":`confirmation-rejected`,children:e})}function N({className:e,...t}){let{state:n}=D();return n===`approval-requested`?p(`div`,{"data-slot":`confirmation-actions`,className:E(`flex items-center justify-end gap-2 self-end`,e),...t}):null}function P({className:e,variant:t=`default`,...n}){return p(`button`,{"data-slot":`confirmation-action`,"data-variant":t,type:`button`,className:E(`inline-flex h-8 items-center justify-center gap-2 whitespace-nowrap rounded-md px-3 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,`disabled:pointer-events-none disabled:opacity-50`,t===`default`&&`bg-primary text-primary-foreground shadow hover:bg-primary/90`,t===`outline`&&`border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground`,t===`destructive`&&`bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90`,e),...n})}function F({element:e,children:t,onAction:n}){let{id:r=`form`,title:i,submitLabel:a=`Submit`}=e.props??{},o=e=>{e.preventDefault();let t=new FormData(e.currentTarget),i={};t.forEach((e,t)=>{typeof e==`string`&&(i[t]=e)}),n?.({name:`submit`,params:{formId:r,data:i}})};return m(`div`,{"data-slot":`form-card`,className:E(`w-full rounded-lg border bg-card text-card-foreground shadow-sm`),children:[i&&p(`div`,{className:`flex flex-col space-y-1.5 p-4 pb-3`,children:p(`h3`,{className:`text-base font-semibold leading-none tracking-tight`,children:i})}),p(`div`,{className:E(`p-4`,i?``:`pt-4`),children:m(`form`,{onSubmit:o,className:`space-y-4`,children:[t,m(`div`,{className:`flex justify-end gap-2 pt-2`,children:[p(`button`,{type:`button`,className:E(`inline-flex h-9 items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm transition-colors`,`hover:bg-accent hover:text-accent-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,`disabled:pointer-events-none disabled:opacity-50`),onClick:()=>n?.({name:`cancel`,params:{formId:r}}),children:`Cancel`}),p(`button`,{type:`submit`,className:E(`inline-flex h-9 items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors`,`hover:bg-primary/90`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,`disabled:pointer-events-none disabled:opacity-50`),children:a})]})]})})]})}function I({element:e}){let{name:t=`field`,label:n=`Field`,placeholder:r,required:i,defaultValue:a}=e.props??{};return m(`div`,{className:`space-y-1.5`,children:[m(`label`,{htmlFor:t,className:`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,children:[n,i&&p(`span`,{className:`ml-1 text-destructive`,children:`*`})]}),p(`input`,{id:t,name:t,type:`text`,placeholder:r,required:i,defaultValue:a,autoComplete:`off`,className:E(`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors`,`placeholder:text-muted-foreground`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`)})]})}function L({element:e}){let{name:t=`field`,label:n=`Field`,placeholder:r,required:i,defaultValue:a,rows:o=3}=e.props??{};return m(`div`,{className:`space-y-1.5`,children:[m(`label`,{htmlFor:t,className:`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,children:[n,i&&p(`span`,{className:`ml-1 text-destructive`,children:`*`})]}),p(`textarea`,{id:t,name:t,placeholder:r,required:i,defaultValue:a,rows:o,className:E(`flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm transition-colors`,`placeholder:text-muted-foreground`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`)})]})}function R({element:e}){let{name:t=`date`,label:n=`Date`,required:r,defaultValue:i,min:a,max:o}=e.props??{};return m(`div`,{className:`space-y-1.5`,children:[m(`label`,{htmlFor:t,className:`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,children:[n,r&&p(`span`,{className:`ml-1 text-destructive`,children:`*`})]}),p(`input`,{type:`date`,id:t,name:t,required:r,defaultValue:i,min:a,max:o,className:E(`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`)})]})}const z={Form:F,TextField:I,TextArea:L,DateField:R},ue=e.object({formId:e.string(),data:e.record(e.string(),e.string())}),de=e.object({formId:e.string()});function B({ui:e,context:t,onSubmit:n,onCancel:r,registry:i=z}){return p(h,{registry:i,initialData:t,actionHandlers:{submit:e=>{let t=ue.safeParse(e);t.success?n(t.data.formId,t.data.data):console.warn(`Form submit: Invalid params`,t.error.flatten())},cancel:e=>{let t=de.safeParse(e);t.success?r?.(t.data.formId):console.warn(`Form cancel: Invalid params`,t.error.flatten())}},children:p(g,{tree:e,registry:i})})}function V({className:e,from:t,...n}){return p(`div`,{"data-slot":`message`,"data-from":t,className:E(`group flex w-full max-w-[95%] flex-col gap-2`,t===`user`?`is-user ml-auto justify-end`:`is-assistant`,e),...n})}function H({children:e,className:t,...n}){return p(`div`,{"data-slot":`message-content`,className:E(`flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm`,`group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground`,`group-[.is-assistant]:text-foreground`,t),...n,children:e})}const U=r(function({className:e,...t}){return p(_,{"data-slot":`message-response`,className:E(`size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,e),...t})},(e,t)=>e.children===t.children);function W({...e}){return p(C.Root,{"data-slot":`collapsible`,...e})}function G({...e}){return p(C.CollapsibleTrigger,{"data-slot":`collapsible-trigger`,...e})}function K({...e}){return p(C.CollapsibleContent,{"data-slot":`collapsible-content`,...e})}function fe({children:e,className:t,...n}){return p(`div`,{"data-slot":`task-item-file`,className:E(`inline-flex items-center gap-1 rounded-md border bg-secondary px-1.5 py-0.5 text-xs text-foreground`,t),...n,children:e})}function q({children:e,className:t,...n}){return p(`div`,{"data-slot":`task-item`,className:E(`text-sm text-muted-foreground`,t),...n,children:e})}function J({defaultOpen:e=!0,className:t,...n}){return p(W,{"data-slot":`task`,className:E(t),defaultOpen:e,...n})}function Y({children:e,className:t,title:n,icon:r,...i}){return p(G,{asChild:!0,className:E(`group`,t),...i,children:e??m(`div`,{className:`flex w-full cursor-pointer items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground`,children:[r??p(x,{className:`size-4`}),p(`p`,{className:`text-sm`,children:n}),p(v,{className:`size-4 transition-transform group-data-[state=open]:rotate-180`})]})})}function X({children:e,className:t,...n}){return p(K,{"data-slot":`task-content`,className:E(`text-popover-foreground outline-none`,`data-[state=closed]:animate-out data-[state=open]:animate-in`,`data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,`data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2`,t),...n,children:p(`div`,{className:`mt-4 space-y-2 border-l-2 border-muted pl-4`,children:e})})}const pe=e.object({actions:e.array(T).optional()}),me=e.object({id:e.string(),approved:e.boolean().optional()}),he=e.object({key:e.string(),type:e.string(),props:e.record(e.string(),e.unknown()).default({}),children:e.array(e.string()).optional()}),ge=e.object({root:e.string(),elements:e.record(e.string(),he)}),_e=e.object({ui:ge,context:e.record(e.string(),e.unknown()).optional()});function ve(e){return e.name}function ye({messages:e,sendMessage:t,addToolApprovalResponse:n,getActionDescription:r=ve,className:i}){let a=e.filter(e=>e.role===`user`||e.role===`assistant`);return p(`div`,{className:i,children:a.map((e,i)=>{let o=i===a.length-1;return p(V,{from:e.role,children:p(H,{children:e.parts.map((i,a)=>p(be,{part:i,messageId:e.id,partIndex:a,isLastMessage:o,sendMessage:t,addToolApprovalResponse:n,getActionDescription:r},`${e.id}-${a}`))})},e.id)})})}function be({part:e,messageId:t,partIndex:n,isLastMessage:r,sendMessage:i,addToolApprovalResponse:a,getActionDescription:o}){if(e.type===`text`)return p(U,{children:e.text});if(e.type===`tool-performActions`){let r=`input`in e?e.input:void 0,i=pe.safeParse(r),s=i.success?i.data.actions??[]:[];if(s.length===0)return null;let c=s.length,l=`state`in e?e.state:void 0,u=`approval`in e?e.approval:void 0,d=me.safeParse(u),f=d.success?d.data:void 0;return f&&l?m(O,{state:l,approval:f,children:[p(k,{children:c===1?`Confirm action`:`Confirm ${c} actions`}),p(A,{children:p(`ul`,{className:`list-disc list-inside text-sm text-muted-foreground mt-2`,children:s.map((e,r)=>p(`li`,{children:o(e)},`${t}-${n}-${r}`))})}),p(j,{children:p(`span`,{className:`text-sm text-muted-foreground`,children:c===1?`Action approved`:`${c} actions approved`})}),p(M,{children:p(`span`,{className:`text-sm text-muted-foreground`,children:c===1?`Action cancelled`:`${c} actions cancelled`})}),m(N,{children:[p(P,{variant:`outline`,onClick:()=>a({id:f.id,approved:!1}),children:`Deny`}),p(P,{onClick:()=>a({id:f.id,approved:!0}),children:`Approve`})]})]}):m(J,{defaultOpen:!1,children:[p(Y,{title:c===1?`Performing 1 action`:`Performing ${c} actions`}),p(X,{children:s.map((e,r)=>p(q,{children:o(e)},`${t}-${n}-${r}`))})]})}if(e.type===`tool-renderUI`&&r){if((`state`in e?e.state:void 0)===`output-available`&&`output`in e){let t=_e.safeParse(e.output);if(t.success)return p(B,{ui:t.data.ui,context:t.data.context,onSubmit:(e,t)=>{i({text:`[Form:${e}] ${JSON.stringify(t)}`})},onCancel:e=>{i({text:`[Form:${e}] cancelled`})}})}return null}return null}function xe({className:e,children:t,...n}){return p(`div`,{"data-slot":`conversation`,className:E(`relative flex-1 overflow-y-hidden min-h-0`,e),role:`log`,"aria-label":`Chat messages`,...n,children:t})}function Se({className:e,children:t,...n}){let r=c(null);return o(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[t]),p(`div`,{ref:r,"data-slot":`conversation-content`,className:E(`flex h-full flex-col gap-8 overflow-y-auto p-4`,e),...n,children:t})}function Ce({className:e,title:t=`No messages yet`,description:n=`Start a conversation to see messages here`,icon:r,children:i,...a}){return p(`div`,{"data-slot":`conversation-empty-state`,className:E(`flex size-full flex-col items-center justify-center gap-3 p-8 text-center`,e),...a,children:i??m(f,{children:[r&&p(`div`,{className:`text-muted-foreground`,children:r}),m(`div`,{className:`space-y-1`,children:[p(`h3`,{className:`text-sm font-medium`,children:t}),n&&p(`p`,{className:`text-muted-foreground text-sm`,children:n})]})]})})}function we({className:e,...t}){return null}function Te({button:e,availableActions:t,onExecute:n,onClose:r}){let[a,s]=l(null),[c,u]=l({}),d=i(()=>{if(!e||!t)return!1;for(let n of e.actions){let e=t.find(e=>e.name===n.name);if(e?.options){for(let[t,r]of Object.entries(e.options))if(r.required&&!n.options?.[t])return!0}}return!1},[e,t]),f=i(()=>!e||!t?!1:e.actions.some(e=>t.find(t=>t.name===e.name)?.approvalRequired===!0),[e,t]),h=i(()=>{if(!e||!t)return null;let n=[];for(let r of e.actions){let e=t.find(e=>e.name===r.name);if(e?.options){for(let[t,i]of Object.entries(e.options))if(i.required&&!r.options?.[t]){let e=`${r.name}_${t}`;n.push({key:e,type:(i.type,`TextField`),props:{name:e,label:i.description||t,required:!0}})}}}if(n.length===0)return null;let r={form:{key:`form`,type:`Form`,props:{id:`dynamic-action-${e.id}`,title:e.label,submitLabel:`Continue`},children:n.map(e=>e.key)}};for(let e of n)r[e.key]={key:e.key,type:e.type,props:e.props,parentKey:`form`};return{root:`form`,elements:r}},[e,t]),g=i(i=>{e&&(n(e.actions.map(e=>{let n={...e.options},r=t?.find(t=>t.name===e.name);for(let[t,a]of Object.entries(i)){let i=t.split(`_`),o=i[0],s=i.slice(1).join(`_`);if(o===e.name&&s){let e=r?.options?.[s],t=a;e?.type===`number`?t=Number(a):e?.type===`boolean`&&(t=a===`true`),n[s]=t}}return{...e,options:n}})),r())},[e,t,n,r]);o(()=>{if(!e){s(null),u({});return}if(d()){s(`input`);return}if(f()){s(`approval`);return}n(e.actions),r()},[e,d,f,n,r]);let _=i((e,t)=>{u(t),f()?s(`approval`):g(t)},[f,g]),v=i(()=>{Object.keys(c).length>0?g(c):e&&(n(e.actions),r())},[c,e,n,r,g]);if(!e||a===null)return null;let y=h();return m(Ee,{onClose:r,children:[a===`input`&&y&&p(B,{ui:y,onSubmit:_,onCancel:r}),a===`approval`&&p(De,{button:e,availableActions:t,onApprove:v,onDeny:r})]})}function Ee({children:e,onClose:t}){return p(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-8`,onClick:e=>{e.target===e.currentTarget&&t()},children:p(`div`,{className:`max-h-[90vh] w-full max-w-md overflow-auto`,onClick:e=>e.stopPropagation(),children:e})})}function De({button:e,availableActions:t,onApprove:n,onDeny:r}){return p(`div`,{className:`rounded-lg border bg-card text-card-foreground shadow-sm p-4`,children:m(`div`,{className:`flex flex-col gap-4`,children:[m(`div`,{className:`flex flex-col gap-2`,children:[p(`h3`,{className:`text-lg font-semibold`,children:`Confirm Action`}),p(`p`,{className:`text-sm text-muted-foreground`,children:`This will execute the following actions:`})]}),p(`ul`,{className:`list-inside list-disc space-y-1 text-sm`,children:e.actions.map((e,n)=>{let r=t?.find(t=>t.name===e.name);return m(`li`,{children:[p(`span`,{className:`font-medium`,children:e.name}),r?.description&&m(`span`,{className:`text-muted-foreground`,children:[` `,`- `,r.description]})]},n)})}),m(`div`,{className:`flex justify-end gap-2 pt-2`,children:[p(`button`,{type:`button`,onClick:r,className:E(`inline-flex h-9 items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm transition-colors`,`hover:bg-accent hover:text-accent-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`),children:`Cancel`}),p(`button`,{type:`button`,onClick:n,className:E(`inline-flex h-9 items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow transition-colors`,`hover:bg-primary/90`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`),children:`Confirm`})]})]})})}function Oe({tokenEndpoint:e,endUserId:t,availableActions:n,autoFetch:r=!0,refreshBuffer:a=3e4}){let[s,u]=l(null),[d,f]=l(null),[p,m]=l(!1),[h,g]=l(null),_=c(!0),v=c(!1),y=c(n);y.current=n;let b=i(async()=>{if(_.current){m(!0),g(null);try{let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({endUserId:t,availableActions:y.current})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error||`Failed to get token: ${n.status}`)}let r=await n.json();if(!_.current)return;u(r.token),f(r.expiresAt)}catch(e){if(!_.current)return;g(e instanceof Error?e.message:`Failed to get token`),console.error(`Token fetch error:`,e)}finally{_.current&&m(!1)}}},[e,t]);return o(()=>{r&&!v.current&&(v.current=!0,b())},[r,b]),o(()=>{if(!d)return;let e=d-Date.now()-a;if(e<=0){b();return}let t=setTimeout(b,e);return()=>clearTimeout(t)},[d,a,b]),o(()=>(_.current=!0,()=>{_.current=!1}),[]),{token:s,expiresAt:d,isLoading:p,error:h,fetchToken:b}}function ke({messages:e,onAction:t}){let n=c(new Set);o(()=>{if(t){for(let r of e)if(r.role===`assistant`){for(let e of r.parts)if(e.type===`tool-performActions`&&`state`in e&&e.state===`output-available`&&`output`in e){let r=e.toolCallId;if(n.current.has(r))continue;let i=e.output;if(i?.actions)for(let e of i.actions)t(e);n.current.add(r)}}}},[e,t])}function Ae({tokenEndpoint:e=`/api/mwai/token`,apiUrl:t=`https://api.modifywithai.com`,endUserId:n,availableActions:r,getContext:a,onAction:o,onError:u}){let[d,f]=l(``),{token:p,isLoading:m,error:h,fetchToken:g}=Oe({tokenEndpoint:e,endUserId:n,availableActions:r,autoFetch:!0}),_=c(a);_.current=a;let v=c(p);v.current=p;let y=te({transport:s(()=>new ne({api:`${t}/api/assistant`,headers:()=>{let e=v.current;return e?{Authorization:`Bearer ${e}`}:{}},body:()=>({context:_.current?.()??{}})}),[t]),sendAutomaticallyWhen:re,onError:u});ke({messages:y.messages,onAction:o});let b=!!p&&!m,x=i(e=>{if(!b){console.warn(`Cannot send message: assistant not ready (token not available)`);return}y.sendMessage(e)},[y,b]),S=i(e=>{e?.preventDefault(),!(!d.trim()||!b)&&(x({text:d}),f(``))},[d,x,b]);return{messages:y.messages,sendMessage:x,status:y.status,error:y.error??null,input:d,setInput:f,handleSubmit:S,addToolApprovalResponse:y.addToolApprovalResponse,isReady:b,tokenError:h,refreshToken:g}}const je=n(null);function Me({children:e,tokenEndpoint:t,apiUrl:n,endUserId:r,availableActions:i,getContext:a,onAction:o,onError:c}){let l=Ae({tokenEndpoint:t,apiUrl:n,endUserId:r,availableActions:i,getContext:a,onAction:o,onError:c}),u=s(()=>({tokenEndpoint:t,apiUrl:n,endUserId:r,availableActions:i}),[t,n,r,i]),d=s(()=>({messages:l.messages,sendMessage:l.sendMessage,status:l.status,error:l.error,input:l.input,setInput:l.setInput,handleSubmit:l.handleSubmit,addToolApprovalResponse:l.addToolApprovalResponse,isReady:l.isReady,tokenError:l.tokenError,refreshToken:l.refreshToken,config:u,onAction:o}),[l.messages,l.sendMessage,l.status,l.error,l.input,l.setInput,l.handleSubmit,l.addToolApprovalResponse,l.isReady,l.tokenError,l.refreshToken,u,o]);return p(je.Provider,{value:d,children:e})}function Ne(){let e=a(je);if(!e)throw Error(`useAssistantContext must be used within an AssistantProvider`);return e}const Pe=e.object({id:e.string(),label:e.string(),variant:e.enum([`default`,`destructive`,`outline`,`secondary`,`ghost`]).optional(),icon:e.string().optional(),actions:e.array(T)}),Fe=e.object({key:e.string(),type:e.enum([`DynamicButton`,`DynamicButtonGroup`]),props:e.record(e.string(),e.unknown()),children:e.array(e.string()).optional(),parentKey:e.string().optional()}),Ie=e.object({root:e.string(),elements:e.record(e.string(),Fe)}),Le=e.object({version:e.literal(1),tree:Ie});function Re(e,t,n){return{key:e,type:`DynamicButton`,props:{...t},parentKey:n}}function Z(e,t,n=[],r){return{key:e,type:`DynamicButtonGroup`,props:{...t},children:n,parentKey:r}}function ze({storageKey:e}){let[t,n]=l(null),[r,a]=l(!0);return o(()=>{try{let t=localStorage.getItem(e);if(t){let r=JSON.parse(t),i=Le.safeParse(r);i.success?n(i.data.tree):(console.warn(`DynamicUI: Stored data failed validation. Discarding.`,i.error.flatten()),localStorage.removeItem(e))}}catch(e){console.error(`Failed to load DynamicUI state:`,e)}finally{a(!1)}},[e]),o(()=>{if(!r)try{if(t){let n={version:1,tree:t};localStorage.setItem(e,JSON.stringify(n))}else localStorage.removeItem(e)}catch(e){console.error(`Failed to save DynamicUI state:`,e)}},[t,e,r]),{tree:t,isLoading:r,addButton:i((e,t)=>{n(n=>{let r=`button-${e.id}`;if(!n){let t=`root-group`;return{root:t,elements:{[t]:Z(t,{id:`root`,direction:`horizontal`},[r]),[r]:Re(r,e,t)}}}if(n.elements[r])return console.warn(`Button with id "${e.id}" already exists`),n;let i=t?`group-${t}`:n.root,a=n.elements[i];a||console.warn(`Parent "${i}" not found, using root`);let o=a?i:n.root,s=n.elements[o];if(!s)return console.warn(`Parent element "${o}" not found`),n;let c={...n.elements,[o]:{key:s.key,type:s.type,props:s.props,children:[...s.children||[],r],parentKey:s.parentKey},[r]:Re(r,e,o)};return{root:n.root,elements:c}})},[]),removeButton:i(e=>{n(t=>{if(!t)return t;let n=`button-${e}`,r=t.elements[n];if(!r)return console.warn(`Button "${e}" not found`),t;let i={};for(let[e,a]of Object.entries(t.elements))e!==n&&(r.parentKey&&e===r.parentKey?i[e]={key:a.key,type:a.type,props:a.props,children:a.children?.filter(e=>e!==n),parentKey:a.parentKey}:i[e]=a);return Object.values(i).some(e=>e.type===`DynamicButton`)?{root:t.root,elements:i}:null})},[]),updateButton:i((e,t)=>{n(n=>{if(!n)return n;let r=`button-${e}`,i=n.elements[r];if(!i||i.type!==`DynamicButton`)return console.warn(`Button "${e}" not found`),n;let a=Pe.safeParse(i.props);if(!a.success)return console.warn(`Button "${e}" has invalid props`,a.error.flatten()),n;let o={...n.elements,[r]:{key:i.key,type:i.type,props:{...a.data,...t},children:i.children,parentKey:i.parentKey}};return{root:n.root,elements:o}})},[]),addGroup:i(e=>{n(t=>{let n=`group-${e.id}`;if(!t)return{root:n,elements:{[n]:Z(n,e,[])}};if(t.elements[n])return console.warn(`Group with id "${e.id}" already exists`),t;let r=t.elements[t.root];if(!r)return console.warn(`Root element "${t.root}" not found`),t;let i={...t.elements,[t.root]:{key:r.key,type:r.type,props:r.props,children:[...r.children||[],n],parentKey:r.parentKey},[n]:Z(n,e,[],t.root)};return{root:t.root,elements:i}})},[]),removeGroup:i(e=>{n(t=>{if(!t)return t;let n=`group-${e}`,r=t.elements[n];if(!r||r.type!==`DynamicButtonGroup`)return console.warn(`Group "${e}" not found`),t;if(t.root===n)return console.warn(`Cannot remove root group`),t;let i=new Set([n]),a=e=>{let n=t.elements[e];if(n?.children)for(let e of n.children)i.add(e),a(e)};a(n);let o={};for(let[e,a]of Object.entries(t.elements))i.has(e)||(r.parentKey&&e===r.parentKey?o[e]={key:a.key,type:a.type,props:a.props,children:a.children?.filter(e=>e!==n),parentKey:a.parentKey}:o[e]=a);return Object.values(o).some(e=>e.type===`DynamicButton`)?{root:t.root,elements:o}:null})},[]),clearAll:i(()=>{n(null)},[])}}function Be({messages:e,dynamicUI:t}){let n=c(new Set);o(()=>{for(let r of e)if(r.role===`assistant`){for(let e of r.parts)if(e.type===`tool-manageDynamicUI`&&`state`in e&&e.state===`output-available`&&`output`in e){let r=e.toolCallId;if(n.current.has(r))continue;let i=e.output;i&&Ve(i,t),n.current.add(r)}}},[e,t])}function Ve(e,t){let{operation:n,button:r,buttonId:i,updates:a,group:o,groupId:s}=e;switch(n){case`addButton`:if(r){let{parentGroupId:e,...n}=r;t.addButton(n,e)}break;case`removeButton`:i&&t.removeButton(i);break;case`updateButton`:i&&a&&t.updateButton(i,a);break;case`addGroup`:o&&t.addGroup(o);break;case`removeGroup`:s&&t.removeGroup(s);break;case`clearAll`:t.clearAll();break;default:console.warn(`Unknown DynamicUI operation: ${n}`)}}const He=e.object({id:e.string(),label:e.string(),variant:e.enum([`default`,`destructive`,`outline`,`secondary`,`ghost`]).optional().default(`default`),icon:e.string().optional(),actions:e.array(T)}),Ue=e.object({id:e.string(),label:e.string().optional(),direction:e.enum([`horizontal`,`vertical`]).optional().default(`horizontal`)});function We({element:e,onAction:t}){let n=He.safeParse(e.props??{});if(!n.success)return console.warn(`DynamicButton: Invalid props`,n.error.flatten()),null;let{id:r,label:i,variant:a,icon:o}=n.data,s=()=>{t?.({name:`executeButton`,params:{buttonId:r}})};return m(`button`,{type:`button`,"data-slot":`dynamic-button`,"data-button-id":r,"data-variant":a,onClick:s,className:E(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md px-4 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,`disabled:pointer-events-none disabled:opacity-50`,a===`default`&&`bg-primary text-primary-foreground shadow hover:bg-primary/90`,a===`secondary`&&`bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80`,a===`outline`&&`border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground`,a===`ghost`&&`hover:bg-accent hover:text-accent-foreground`,a===`destructive`&&`bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90`),children:[o&&p(Ke,{name:o,className:`size-4 shrink-0`}),i]})}function Ge({element:e,children:t}){let n=Ue.safeParse(e.props??{});if(!n.success)return console.warn(`DynamicButtonGroup: Invalid props`,n.error.flatten()),p(f,{children:t});let{direction:r,label:i}=n.data;return i?m(`div`,{"data-slot":`dynamic-button-group`,"data-direction":r,className:E(`flex gap-2`,r===`vertical`?`flex-col`:`flex-row flex-wrap`),children:[p(`span`,{className:`text-sm font-medium text-muted-foreground`,children:i}),t]}):p(f,{children:t})}function Ke({name:e,className:t}){return{plus:m(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:[p(`path`,{d:`M5 12h14`}),p(`path`,{d:`M12 5v14`})]}),trash:m(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:[p(`path`,{d:`M3 6h18`}),p(`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`}),p(`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`})]}),check:p(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:p(`path`,{d:`M20 6 9 17l-5-5`})}),edit:m(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:[p(`path`,{d:`M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z`}),p(`path`,{d:`m15 5 4 4`})]}),refresh:m(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:[p(`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`}),p(`path`,{d:`M21 3v5h-5`}),p(`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`}),p(`path`,{d:`M8 16H3v5`})]}),send:m(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:[p(`path`,{d:`m22 2-7 20-4-9-9-4Z`}),p(`path`,{d:`M22 2 11 13`})]}),list:m(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:[p(`line`,{x1:`8`,x2:`21`,y1:`6`,y2:`6`}),p(`line`,{x1:`8`,x2:`21`,y1:`12`,y2:`12`}),p(`line`,{x1:`8`,x2:`21`,y1:`18`,y2:`18`}),p(`line`,{x1:`3`,x2:`3.01`,y1:`6`,y2:`6`}),p(`line`,{x1:`3`,x2:`3.01`,y1:`12`,y2:`12`}),p(`line`,{x1:`3`,x2:`3.01`,y1:`18`,y2:`18`})]}),star:p(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:p(`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`})}),zap:p(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:p(`polygon`,{points:`13 2 3 14 12 14 11 22 21 10 12 10 13 2`})})}[e.toLowerCase()]||null}const Q={DynamicButton:We,DynamicButtonGroup:Ge};function qe(e){return typeof e.id==`string`&&typeof e.label==`string`&&Array.isArray(e.actions)}function Je({className:e}){let{config:t,messages:n,onAction:r}=Ne(),{endUserId:a,availableActions:o}=t,s=ze({storageKey:`mwai-dynamic-ui-${a}`});Be({messages:n,dynamicUI:s});let[c,u]=l(null),d=i(e=>{if(r)for(let t of e)r(t)},[r]),_=i(e=>{if(!s.tree)return;let t=`button-${e}`,n=s.tree.elements[t];n&&n.type===`DynamicButton`&&qe(n.props)&&u(n.props)},[s.tree]),v=i(()=>{u(null)},[]);return s.isLoading||!s.tree?null:m(f,{children:[p(`div`,{"data-slot":`dynamic-ui`,className:E(`flex flex-wrap gap-2`,e),children:p(h,{registry:Q,actionHandlers:{executeButton:({buttonId:e})=>{_(e)}},children:p(g,{tree:s.tree,registry:Q})})}),p(Te,{button:c,availableActions:o,onExecute:d,onClose:v})]})}function Ye({...e}){return p(w.Root,{"data-slot":`drawer`,...e})}function Xe({...e}){return p(w.Trigger,{"data-slot":`drawer-trigger`,...e})}function Ze({...e}){return p(w.Portal,{"data-slot":`drawer-portal`,...e})}function Qe({...e}){return p(w.Close,{"data-slot":`drawer-close`,...e})}function $({className:e,...t}){return p(w.Overlay,{"data-slot":`drawer-overlay`,className:E(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50`,e),...t})}function $e({className:e,children:t,overlay:n=!0,...r}){return m(Ze,{"data-slot":`drawer-portal`,children:[n&&p($,{}),m(w.Content,{"data-slot":`drawer-content`,className:E(`bg-background flex h-auto flex-col text-sm`,`data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-xl data-[vaul-drawer-direction=bottom]:border-t`,`data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:rounded-r-xl data-[vaul-drawer-direction=left]:border-r`,`data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:rounded-l-xl data-[vaul-drawer-direction=right]:border-l`,`data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-xl data-[vaul-drawer-direction=top]:border-b`,`data-[vaul-drawer-direction=left]:sm:max-w-sm data-[vaul-drawer-direction=right]:sm:max-w-sm`,`group/drawer-content fixed z-50`,e),...r,children:[p(`div`,{className:`bg-muted mx-auto mt-4 hidden h-1 w-24 shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block`}),t]})]})}function et({className:e,...t}){return p(`div`,{"data-slot":`drawer-header`,className:E(`flex flex-col gap-0.5 p-4`,`group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center`,`group-data-[vaul-drawer-direction=top]/drawer-content:text-center`,`md:gap-0.5 md:text-left`,e),...t})}function tt({className:e,...t}){return p(`div`,{"data-slot":`drawer-footer`,className:E(`mt-auto flex flex-col gap-2 p-4`,e),...t})}function nt({className:e,...t}){return p(w.Title,{"data-slot":`drawer-title`,className:E(`text-foreground text-base font-medium`,e),...t})}function rt({className:e,...t}){return p(w.Description,{"data-slot":`drawer-description`,className:E(`text-muted-foreground text-sm`,e),...t})}function it({className:e,onSubmit:t,children:n,...r}){let i=e=>{e.preventDefault();let n=e.currentTarget,r=new FormData(n).get(`message`)||``;n.reset(),t({text:r},e)};return p(`form`,{"data-slot":`prompt-input`,className:E(`w-full`,e),onSubmit:i,...r,children:p(`div`,{"data-slot":`prompt-input-group`,role:`group`,className:E(`border-input dark:bg-input/30`,`has-[[data-slot=prompt-input-textarea]:focus-visible]:border-ring`,`has-[[data-slot=prompt-input-textarea]:focus-visible]:ring-ring/50`,`has-[[data-slot=prompt-input-textarea]:focus-visible]:ring-[3px]`,`relative flex w-full min-w-0 flex-col overflow-hidden rounded-lg border transition-colors`),children:n})})}function at({onChange:e,className:t,placeholder:n=`What would you like to know?`,...r}){let[i,a]=l(!1),o=e=>{if(e.key===`Enter`){if(i||e.nativeEvent.isComposing||e.shiftKey)return;e.preventDefault();let t=e.currentTarget.form;if(t?.querySelector(`button[type="submit"]`)?.disabled)return;t?.requestSubmit()}};return p(`textarea`,{"data-slot":`prompt-input-textarea`,className:E(`field-sizing-content max-h-48 min-h-16`,`flex-1 resize-none rounded-none border-0 bg-transparent px-3 py-2 text-sm shadow-none ring-0 outline-0`,`placeholder:text-muted-foreground`,`focus-visible:ring-0 focus-visible:outline-none`,`disabled:cursor-not-allowed disabled:opacity-50`,t),name:`message`,onChange:e,onCompositionEnd:()=>a(!1),onCompositionStart:()=>a(!0),onKeyDown:o,placeholder:n,...r})}function ot({className:e,...t}){return p(`div`,{"data-slot":`prompt-input-footer`,className:E(`flex w-full items-center justify-between gap-1 px-2.5 pb-2`,e),...t})}function st({className:e,type:n=`button`,children:r,...i}){let a=t.count(r)>1;return p(`button`,{"data-slot":`prompt-input-button`,type:n,className:E(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors`,`hover:bg-accent hover:text-accent-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,`disabled:pointer-events-none disabled:opacity-50`,a?`h-8 px-3`:`size-8`,e),...i,children:r})}function ct({className:e,status:t,icon:n,children:r,...i}){let a=p(y,{className:`size-4`});return t===`submitted`?a=p(b,{className:`size-4 animate-spin`}):t===`streaming`?a=p(S,{className:`size-4`}):t===`error`&&(a=p(ee,{className:`size-4`})),p(`button`,{"data-slot":`prompt-input-submit`,type:`submit`,"aria-label":`Send message`,className:E(`inline-flex size-8 items-center justify-center rounded-md text-sm font-medium transition-colors`,`bg-primary text-primary-foreground shadow`,`hover:bg-primary/90`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,`disabled:pointer-events-none disabled:opacity-50`,e),...i,children:r??n??a})}var lt=`/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */
|
|
2
|
-
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-500:oklch(63.7% .237 25.331);--color-red-950:oklch(25.8% .092 26.042);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-950:oklch(27.9% .077 45.635);--color-green-50:oklch(98.2% .018 155.826);--color-green-500:oklch(72.3% .219 149.579);--color-green-950:oklch(26.6% .065 152.934);--color-black:#000;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height:calc(1.5/1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--animate-spin:spin 1s linear infinite;--blur-xs:4px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--border);outline-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){*{outline-color:color-mix(in oklab,var(--ring)50%,transparent)}}}@layer components;@layer utilities{.visible{visibility:visible}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.z-50{z-index:50}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-auto{margin-top:auto}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-auto{margin-left:auto}.contents{display:contents}.flex{display:flex}.hidden{display:none}.inline-flex{display:inline-flex}.field-sizing-content{field-sizing:content}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-12{width:calc(var(--spacing)*12);height:calc(var(--spacing)*12)}.size-full{width:100%;height:100%}.h-1{height:calc(var(--spacing)*1)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-auto{height:auto}.h-full{height:100%}.max-h-48{max-height:calc(var(--spacing)*48)}.max-h-\\[90vh\\]{max-height:90vh}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-16{min-height:calc(var(--spacing)*16)}.min-h-\\[60px\\]{min-height:60px}.w-24{width:calc(var(--spacing)*24)}.w-fit{width:fit-content}.w-full{width:100%}.max-w-\\[95\\%\\]{max-width:95%}.max-w-full{max-width:100%}.max-w-md{max-width:var(--container-md)}.min-w-0{min-width:calc(var(--spacing)*0)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}.self-end{align-self:flex-end}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-y-hidden{overflow-y:hidden}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-input{border-color:var(--input)}.border-muted{border-color:var(--muted)}.bg-background{background-color:var(--background)}.bg-black\\/10{background-color:#0000001a}@supports (color:color-mix(in lab, red, red)){.bg-black\\/10{background-color:color-mix(in oklab,var(--color-black)10%,transparent)}}.bg-black\\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-card{background-color:var(--card)}.bg-destructive{background-color:var(--destructive)}.bg-muted{background-color:var(--muted)}.bg-primary{background-color:var(--primary)}.bg-secondary{background-color:var(--secondary)}.bg-transparent{background-color:#0000}.p-4{padding:calc(var(--spacing)*4)}.p-8{padding:calc(var(--spacing)*8)}.px-1\\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2\\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-0\\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-2{padding-block:calc(var(--spacing)*2)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-4{padding-top:calc(var(--spacing)*4)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pl-4{padding-left:calc(var(--spacing)*4)}.text-center{text-align:center}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.whitespace-nowrap{white-space:nowrap}.text-card-foreground{color:var(--card-foreground)}.text-destructive{color:var(--destructive)}.text-foreground{color:var(--foreground)}.text-muted-foreground{color:var(--muted-foreground)}.text-popover-foreground{color:var(--popover-foreground)}.text-primary-foreground{color:var(--primary-foreground)}.text-secondary-foreground{color:var(--secondary-foreground)}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.outline-0{outline-style:var(--tw-outline-style);outline-width:0}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}.group-data-\\[state\\=open\\]\\:rotate-180:is(:where(.group)[data-state=open] *){rotate:180deg}.group-data-\\[vaul-drawer-direction\\=bottom\\]\\/drawer-content\\:block:is(:where(.group\\/drawer-content)[data-vaul-drawer-direction=bottom] *){display:block}.group-data-\\[vaul-drawer-direction\\=bottom\\]\\/drawer-content\\:text-center:is(:where(.group\\/drawer-content)[data-vaul-drawer-direction=bottom] *),.group-data-\\[vaul-drawer-direction\\=top\\]\\/drawer-content\\:text-center:is(:where(.group\\/drawer-content)[data-vaul-drawer-direction=top] *){text-align:center}.group-\\[\\.is-assistant\\]\\:text-foreground:is(:where(.group).is-assistant *){color:var(--foreground)}.group-\\[\\.is-user\\]\\:ml-auto:is(:where(.group).is-user *){margin-left:auto}.group-\\[\\.is-user\\]\\:rounded-lg:is(:where(.group).is-user *){border-radius:var(--radius)}.group-\\[\\.is-user\\]\\:bg-secondary:is(:where(.group).is-user *){background-color:var(--secondary)}.group-\\[\\.is-user\\]\\:px-4:is(:where(.group).is-user *){padding-inline:calc(var(--spacing)*4)}.group-\\[\\.is-user\\]\\:py-3:is(:where(.group).is-user *){padding-block:calc(var(--spacing)*3)}.group-\\[\\.is-user\\]\\:text-foreground:is(:where(.group).is-user *){color:var(--foreground)}.peer-disabled\\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.placeholder\\:text-muted-foreground::placeholder{color:var(--muted-foreground)}@media (hover:hover){.hover\\:bg-accent:hover{background-color:var(--accent)}.hover\\:bg-destructive\\/90:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-destructive\\/90:hover{background-color:color-mix(in oklab,var(--destructive)90%,transparent)}}.hover\\:bg-primary\\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-primary\\/90:hover{background-color:color-mix(in oklab,var(--primary)90%,transparent)}}.hover\\:bg-secondary\\/80:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-secondary\\/80:hover{background-color:color-mix(in oklab,var(--secondary)80%,transparent)}}.hover\\:text-accent-foreground:hover{color:var(--accent-foreground)}.hover\\:text-foreground:hover{color:var(--foreground)}}.focus-visible\\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\:ring-ring:focus-visible{--tw-ring-color:var(--ring)}.focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-50:disabled{opacity:.5}.has-\\[\\[data-slot\\=prompt-input-textarea\\]\\:focus-visible\\]\\:border-ring:has([data-slot=prompt-input-textarea]:focus-visible){border-color:var(--ring)}.has-\\[\\[data-slot\\=prompt-input-textarea\\]\\:focus-visible\\]\\:ring-\\[3px\\]:has([data-slot=prompt-input-textarea]:focus-visible){--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.has-\\[\\[data-slot\\=prompt-input-textarea\\]\\:focus-visible\\]\\:ring-ring\\/50:has([data-slot=prompt-input-textarea]:focus-visible){--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){.has-\\[\\[data-slot\\=prompt-input-textarea\\]\\:focus-visible\\]\\:ring-ring\\/50:has([data-slot=prompt-input-textarea]:focus-visible){--tw-ring-color:color-mix(in oklab,var(--ring)50%,transparent)}}.data-\\[approved\\=false\\]\\:border-red-500\\/50[data-approved=false]{border-color:#fb2c3680}@supports (color:color-mix(in lab, red, red)){.data-\\[approved\\=false\\]\\:border-red-500\\/50[data-approved=false]{border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.data-\\[approved\\=false\\]\\:bg-red-50\\/50[data-approved=false]{background-color:#fef2f280}@supports (color:color-mix(in lab, red, red)){.data-\\[approved\\=false\\]\\:bg-red-50\\/50[data-approved=false]{background-color:color-mix(in oklab,var(--color-red-50)50%,transparent)}}.data-\\[approved\\=true\\]\\:border-green-500\\/50[data-approved=true]{border-color:#00c75880}@supports (color:color-mix(in lab, red, red)){.data-\\[approved\\=true\\]\\:border-green-500\\/50[data-approved=true]{border-color:color-mix(in oklab,var(--color-green-500)50%,transparent)}}.data-\\[approved\\=true\\]\\:bg-green-50\\/50[data-approved=true]{background-color:#f0fdf480}@supports (color:color-mix(in lab, red, red)){.data-\\[approved\\=true\\]\\:bg-green-50\\/50[data-approved=true]{background-color:color-mix(in oklab,var(--color-green-50)50%,transparent)}}.data-\\[state\\=approval-requested\\]\\:border-amber-500\\/50[data-state=approval-requested]{border-color:#f99c0080}@supports (color:color-mix(in lab, red, red)){.data-\\[state\\=approval-requested\\]\\:border-amber-500\\/50[data-state=approval-requested]{border-color:color-mix(in oklab,var(--color-amber-500)50%,transparent)}}.data-\\[state\\=approval-requested\\]\\:bg-amber-50\\/50[data-state=approval-requested]{background-color:#fffbeb80}@supports (color:color-mix(in lab, red, red)){.data-\\[state\\=approval-requested\\]\\:bg-amber-50\\/50[data-state=approval-requested]{background-color:color-mix(in oklab,var(--color-amber-50)50%,transparent)}}.data-\\[vaul-drawer-direction\\=bottom\\]\\:inset-x-0[data-vaul-drawer-direction=bottom]{inset-inline:calc(var(--spacing)*0)}.data-\\[vaul-drawer-direction\\=bottom\\]\\:bottom-0[data-vaul-drawer-direction=bottom]{bottom:calc(var(--spacing)*0)}.data-\\[vaul-drawer-direction\\=bottom\\]\\:mt-24[data-vaul-drawer-direction=bottom]{margin-top:calc(var(--spacing)*24)}.data-\\[vaul-drawer-direction\\=bottom\\]\\:max-h-\\[80vh\\][data-vaul-drawer-direction=bottom]{max-height:80vh}.data-\\[vaul-drawer-direction\\=bottom\\]\\:rounded-t-xl[data-vaul-drawer-direction=bottom]{border-top-left-radius:calc(var(--radius) + 4px);border-top-right-radius:calc(var(--radius) + 4px)}.data-\\[vaul-drawer-direction\\=bottom\\]\\:border-t[data-vaul-drawer-direction=bottom]{border-top-style:var(--tw-border-style);border-top-width:1px}.data-\\[vaul-drawer-direction\\=left\\]\\:inset-y-0[data-vaul-drawer-direction=left]{inset-block:calc(var(--spacing)*0)}.data-\\[vaul-drawer-direction\\=left\\]\\:left-0[data-vaul-drawer-direction=left]{left:calc(var(--spacing)*0)}.data-\\[vaul-drawer-direction\\=left\\]\\:w-3\\/4[data-vaul-drawer-direction=left]{width:75%}.data-\\[vaul-drawer-direction\\=left\\]\\:rounded-r-xl[data-vaul-drawer-direction=left]{border-top-right-radius:calc(var(--radius) + 4px);border-bottom-right-radius:calc(var(--radius) + 4px)}.data-\\[vaul-drawer-direction\\=left\\]\\:border-r[data-vaul-drawer-direction=left]{border-right-style:var(--tw-border-style);border-right-width:1px}.data-\\[vaul-drawer-direction\\=right\\]\\:inset-y-0[data-vaul-drawer-direction=right]{inset-block:calc(var(--spacing)*0)}.data-\\[vaul-drawer-direction\\=right\\]\\:right-0[data-vaul-drawer-direction=right]{right:calc(var(--spacing)*0)}.data-\\[vaul-drawer-direction\\=right\\]\\:w-3\\/4[data-vaul-drawer-direction=right]{width:75%}.data-\\[vaul-drawer-direction\\=right\\]\\:rounded-l-xl[data-vaul-drawer-direction=right]{border-top-left-radius:calc(var(--radius) + 4px);border-bottom-left-radius:calc(var(--radius) + 4px)}.data-\\[vaul-drawer-direction\\=right\\]\\:border-l[data-vaul-drawer-direction=right]{border-left-style:var(--tw-border-style);border-left-width:1px}.data-\\[vaul-drawer-direction\\=top\\]\\:inset-x-0[data-vaul-drawer-direction=top]{inset-inline:calc(var(--spacing)*0)}.data-\\[vaul-drawer-direction\\=top\\]\\:top-0[data-vaul-drawer-direction=top]{top:calc(var(--spacing)*0)}.data-\\[vaul-drawer-direction\\=top\\]\\:mb-24[data-vaul-drawer-direction=top]{margin-bottom:calc(var(--spacing)*24)}.data-\\[vaul-drawer-direction\\=top\\]\\:max-h-\\[80vh\\][data-vaul-drawer-direction=top]{max-height:80vh}.data-\\[vaul-drawer-direction\\=top\\]\\:rounded-b-xl[data-vaul-drawer-direction=top]{border-bottom-right-radius:calc(var(--radius) + 4px);border-bottom-left-radius:calc(var(--radius) + 4px)}.data-\\[vaul-drawer-direction\\=top\\]\\:border-b[data-vaul-drawer-direction=top]{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}@supports ((-webkit-backdrop-filter:var(--tw)) or (backdrop-filter:var(--tw))){.supports-backdrop-filter\\:backdrop-blur-xs{--tw-backdrop-blur:blur(var(--blur-xs));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}}@media (min-width:40rem){.data-\\[vaul-drawer-direction\\=left\\]\\:sm\\:max-w-sm[data-vaul-drawer-direction=left],.data-\\[vaul-drawer-direction\\=right\\]\\:sm\\:max-w-sm[data-vaul-drawer-direction=right]{max-width:var(--container-sm)}}@media (min-width:48rem){.md\\:gap-0\\.5{gap:calc(var(--spacing)*.5)}.md\\:text-left{text-align:left}}.dark\\:bg-input\\/30:is(.dark *){background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\\:bg-input\\/30:is(.dark *){background-color:color-mix(in oklab,var(--input)30%,transparent)}}.dark\\:data-\\[approved\\=false\\]\\:bg-red-950\\/20:is(.dark *)[data-approved=false]{background-color:#46080933}@supports (color:color-mix(in lab, red, red)){.dark\\:data-\\[approved\\=false\\]\\:bg-red-950\\/20:is(.dark *)[data-approved=false]{background-color:color-mix(in oklab,var(--color-red-950)20%,transparent)}}.dark\\:data-\\[approved\\=true\\]\\:bg-green-950\\/20:is(.dark *)[data-approved=true]{background-color:#032e1533}@supports (color:color-mix(in lab, red, red)){.dark\\:data-\\[approved\\=true\\]\\:bg-green-950\\/20:is(.dark *)[data-approved=true]{background-color:color-mix(in oklab,var(--color-green-950)20%,transparent)}}.dark\\:data-\\[state\\=approval-requested\\]\\:bg-amber-950\\/20:is(.dark *)[data-state=approval-requested]{background-color:#46190133}@supports (color:color-mix(in lab, red, red)){.dark\\:data-\\[state\\=approval-requested\\]\\:bg-amber-950\\/20:is(.dark *)[data-state=approval-requested]{background-color:color-mix(in oklab,var(--color-amber-950)20%,transparent)}}.\\[\\&\\>\\*\\:first-child\\]\\:mt-0>:first-child{margin-top:calc(var(--spacing)*0)}.\\[\\&\\>\\*\\:last-child\\]\\:mb-0>:last-child{margin-bottom:calc(var(--spacing)*0)}}.assistant-root{--radius:.625rem;--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--card:oklch(100% 0 0);--card-foreground:oklch(14.5% 0 0);--popover:oklch(100% 0 0);--popover-foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(55.6% 0 0);--accent:oklch(97% 0 0);--accent-foreground:oklch(20.5% 0 0);--destructive:oklch(57.7% .245 27.325);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);color:var(--foreground);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background:0 0;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;line-height:1.5}.assistant-root.dark{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20.5% 0 0);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20.5% 0 0);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(26.9% 0 0);--muted-foreground:oklch(70.8% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(70.4% .191 22.216);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0)}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}`;function ut({children:e,className:t,theme:n,...r}){let i=c(null),[a,s]=l(null),[u,d]=l(`light`);o(()=>{if(n!==void 0)return;let e=()=>{d(document.documentElement.classList.contains(`dark`)?`dark`:`light`)};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()},[n]),o(()=>{if(i.current&&!i.current.shadowRoot){let e=i.current.attachShadow({mode:`open`}),t=new CSSStyleSheet;t.replaceSync(lt),e.adoptedStyleSheets=[t],s(e)}},[]);let f=n??u;return p(`div`,{ref:i,"data-slot":`assistant-root-host`,className:E(`assistant-root-host`,t),...r,children:a&&ie(p(`div`,{className:E(`assistant-root flex flex-col h-full min-h-0`,f===`dark`&&`dark`),children:e}),a)})}export{P as $,Se as A,K as B,Me as C,Oe as D,ke as E,X as F,B as G,V as H,q as I,L as J,R as K,fe as L,we as M,ye as N,Te as O,J as P,j as Q,Y as R,ze as S,Ae as T,H as U,G as V,U as W,z as X,I as Y,O as Z,Je as _,ct as a,oe as at,Q as b,Qe as c,se as ct,tt as d,N as et,et as f,Xe as g,nt as h,ot as i,E as it,Ce as j,xe as k,$e as l,T as lt,Ze as m,it as n,A as nt,at as o,ae as ot,$ as p,F as q,st as r,k as rt,Ye as s,ce as st,ut as t,M as tt,rt as u,Ge as v,Ne as w,Be as x,We as y,W as z};
|