@aigentyc/chat-sdk 0.5.2 → 0.5.4
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/{ChatInterface-DKF3BY42.d.cts → ChatInterface-Bo0dU48x.d.cts} +23 -1
- package/dist/{ChatInterface-CRmM_RG_.d.ts → ChatInterface-D5tY6WT1.d.ts} +23 -1
- package/dist/ai-elements.cjs +29 -29
- package/dist/ai-elements.js +1 -1
- package/dist/{chunk-B277MAUK.cjs → chunk-7LJMBYHC.cjs} +5 -11
- package/dist/chunk-7LJMBYHC.cjs.map +1 -0
- package/dist/{chunk-PNUHUUA3.js → chunk-BKIYPLMT.js} +39 -10
- package/dist/chunk-BKIYPLMT.js.map +1 -0
- package/dist/{chunk-KHQYSEYN.cjs → chunk-CPWM6NNE.cjs} +54 -23
- package/dist/chunk-CPWM6NNE.cjs.map +1 -0
- package/dist/{chunk-O5TPHZRP.js → chunk-TXX2W7ZR.js} +5 -11
- package/dist/chunk-TXX2W7ZR.js.map +1 -0
- package/dist/components.cjs +14 -14
- package/dist/components.d.cts +8 -3
- package/dist/components.d.ts +8 -3
- package/dist/components.js +3 -3
- package/dist/index.cjs +20 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/llms-full.txt +4 -4
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/chunk-B277MAUK.cjs.map +0 -1
- package/dist/chunk-KHQYSEYN.cjs.map +0 -1
- package/dist/chunk-O5TPHZRP.js.map +0 -1
- package/dist/chunk-PNUHUUA3.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ai-elements/conversation.tsx","../src/core/api/kb-client.ts","../src/ai-elements/message-feedback.tsx","../src/ui/button-group.tsx","../src/ai-elements/message.tsx","../src/ai-elements/loader.tsx","../src/ai-elements/sources.ts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AW,EAAA;AAAA,MACT,gCAAA;AAAA,MACA,uLAAA;AAAA,MACA;AAAA,KACF;AAAA,IACC,GAAG;AAAA;AACN;AAKK,IAAM,MAAA,GAAS,CAAC,EAAE,IAAA,EAAM,OAAO,QAAA,EAAU,GAAG,KAAA,EAAM,qBACvDA,GAAAA;AAAA,EAAC,GAAA;AAAA,EAAA;AAAA,IACC,SAAA,EAAU,yBAAA;AAAA,IACV,IAAA;AAAA,IACA,GAAA,EAAI,YAAA;AAAA,IACJ,MAAA,EAAO,QAAA;AAAA,IACN,GAAG,KAAA;AAAA,IAEH,QAAA,EAAA,QAAA,oBACCC,IAAAA,CAAAG,QAAAA,EAAA,EACE,QAAA,EAAA;AAAA,sBAAAJ,GAAAA,CAAC,QAAA,EAAA,EAAS,SAAA,EAAU,SAAA,EAAU,CAAA;AAAA,sBAC9BA,GAAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,qBAAqB,QAAA,EAAA,KAAA,EAAM;AAAA,KAAA,EAC7C;AAAA;AAEJ","file":"chunk-O5TPHZRP.js","sourcesContent":["\"use client\";\n\nimport { Button } from \"../ui/button\";\nimport { cn } from \"../core/utils\";\nimport { ArrowDownIcon } from \"lucide-react\";\nimport type { ComponentProps } from \"react\";\nimport { useCallback, useEffect } from \"react\";\nimport { StickToBottom, useStickToBottomContext } from \"use-stick-to-bottom\";\n\nexport type ConversationProps = ComponentProps<typeof StickToBottom>;\n\n/**\n * Marks the turn the visitor sent last. {@link anchorToLatestTurn} stops the\n * view there instead of at the bottom of whatever came back.\n */\nexport const LATEST_TURN_ATTR = \"data-ac-latest-turn\";\n\n/** Breathing room kept above the anchored question. */\nconst LATEST_TURN_GAP_PX = 16;\n\n/** Keys that scroll a focused scroll container. */\nconst SCROLL_KEYS = new Set([\n \"ArrowUp\",\n \"ArrowDown\",\n \"PageUp\",\n \"PageDown\",\n \"Home\",\n \"End\",\n \" \",\n]);\n\ntype TargetScrollTop = NonNullable<ConversationProps[\"targetScrollTop\"]>;\n\n/**\n * Where \"the bottom\" is for a conversation: never further down than the point\n * where the latest question reaches the top of the view.\n *\n * ## Why not simply stick to the bottom\n *\n * `StickToBottom` follows the end of the content, which is right while an\n * answer is shorter than the view and wrong the moment it is taller. A reply\n * that carries a product grid can run to thousands of pixels; following its\n * end lands the visitor on the last row of cards with the written answer\n * scrolled far out of sight above. Nothing on screen changes while the text\n * streams in up there, so a turn that worked reads as a chat that stopped\n * answering — which is how it was reported from the field.\n *\n * Capping the target instead gives the reading order people expect: the\n * question pinned at the top, the answer growing downward from it.\n *\n * ## Why it is safe to hand to the library\n *\n * `use-stick-to-bottom` clamps the result to `min(this, bottom)`, so an answer\n * that fits on screen behaves exactly as before. It also treats this capped\n * position as \"at the bottom\" — so the lock holds while the answer grows, and a\n * visitor who scrolls away still escapes it as usual.\n *\n * Measured from the live layout on every call rather than cached: the anchor\n * moves whenever anything above it changes size (an image loading, an older\n * result folding away), and the library already memoises per animation frame.\n */\nexport const anchorToLatestTurn: TargetScrollTop = (\n bottom,\n { scrollElement, contentElement }\n) => {\n const anchorTop = latestTurnTop(scrollElement, contentElement);\n if (anchorTop === null) return bottom;\n return Math.min(bottom, Math.max(0, anchorTop - LATEST_TURN_GAP_PX));\n};\n\n/** The latest turn's offset in the scroll container's own coordinates. */\nfunction latestTurnTop(\n scrollElement: HTMLElement,\n contentElement: HTMLElement\n): number | null {\n const anchor = contentElement.querySelector<HTMLElement>(\n `[${LATEST_TURN_ATTR}]`\n );\n if (!anchor) return null;\n return (\n anchor.getBoundingClientRect().top -\n scrollElement.getBoundingClientRect().top +\n scrollElement.scrollTop\n );\n}\n\nexport const Conversation = ({ className, ...props }: ConversationProps) => (\n <StickToBottom\n className={cn(\"relative flex-1 overflow-y-hidden\", className)}\n initial=\"smooth\"\n resize=\"smooth\"\n role=\"log\"\n {...props}\n />\n);\n\n/**\n * Bring the view to a turn the visitor just sent. Render inside a\n * {@link Conversation}; `turnKey` is the id of that turn.\n *\n * ## Why the anchor alone is not enough\n *\n * `use-stick-to-bottom` follows new content only while it believes the view is\n * locked to the end, and it drops that lock on any upward scroll it did not\n * make itself — a visitor reading back, but also the browser keeping content\n * steady when something above the view shrinks, as an older result card does\n * when it folds away. Once released it stays released: content growth is\n * handled with the current position preserved, so every later answer streamed\n * in below the fold while the view sat still, and the conversation read as one\n * that had stopped answering.\n *\n * Sending a message is the one moment the visitor has plainly asked to follow\n * along, so this re-engages the lock then. The scroll target is capped by\n * {@link anchorToLatestTurn}, so \"re-engage\" lands on the new question rather\n * than on the end of a long answer, and the library only ever scrolls\n * downward, so it never drags the view back up over something being read.\n *\n * Deferred a frame so the new turn has been laid out when the target is\n * measured.\n */\nexport const FollowLatestTurn = ({ turnKey }: { turnKey?: string }) => {\n const { scrollToBottom, scrollRef, contentRef, state } =\n useStickToBottomContext();\n\n useEffect(() => {\n if (!turnKey) return;\n const frame = requestAnimationFrame(() => {\n void scrollToBottom();\n });\n return () => cancelAnimationFrame(frame);\n }, [turnKey, scrollToBottom]);\n\n // Hold the question still when something ABOVE it changes height.\n //\n // The library only ever scrolls downward. So when an older result folds\n // away — the Teldor widget collapses the previous product grid the moment a\n // new one appears — the question and everything after it jump up by the\n // height that was removed, while the scroll position stays put. Measured in a\n // real browser: the question ended up ~500px above the top of the view, with\n // the start of its answer out of sight, and nothing ever brought it back.\n // Browsers are meant to prevent exactly this with scroll anchoring, and here\n // they did not.\n //\n // So this does the anchoring itself: whenever the content resizes, the\n // question's position is compared with where it was, and the scroll moves by\n // the same amount. Only shifts of the question count — a visitor scrolling\n // down to read further changes the scroll position, not the question's\n // place in the content, so it is never undone.\n //\n // Written through `state.scrollTop`, which the library records as its own\n // move; a plain `scrollTop` write would read as the visitor scrolling up and\n // release the lock that keeps the answer followed.\n //\n // Stands down for the rest of the turn the moment the visitor scrolls by\n // hand. Holding the QUESTION still is only right while the question is what\n // they are looking at: someone who has scrolled up to reread an older answer\n // would otherwise be thrown off it when a grid below them folds away. Once\n // they are steering, the browser's own anchoring and their hand decide.\n useEffect(() => {\n const scroll = scrollRef.current;\n const content = contentRef.current;\n if (!turnKey || !scroll || !content) return;\n let previous = latestTurnTop(scroll, content);\n let steering = false;\n const takeOver = () => {\n steering = true;\n };\n const onKey = (event: KeyboardEvent) => {\n if (SCROLL_KEYS.has(event.key)) steering = true;\n };\n const observer = new ResizeObserver(() => {\n const current = latestTurnTop(scroll, content);\n if (!steering && previous !== null && current !== null) {\n const shift = current - previous;\n if (Math.abs(shift) > 1) {\n state.scrollTop = Math.max(0, state.scrollTop + shift);\n }\n }\n previous = current;\n });\n observer.observe(content);\n scroll.addEventListener(\"wheel\", takeOver, { passive: true });\n scroll.addEventListener(\"touchmove\", takeOver, { passive: true });\n scroll.addEventListener(\"pointerdown\", takeOver, { passive: true });\n scroll.addEventListener(\"keydown\", onKey);\n return () => {\n observer.disconnect();\n scroll.removeEventListener(\"wheel\", takeOver);\n scroll.removeEventListener(\"touchmove\", takeOver);\n scroll.removeEventListener(\"pointerdown\", takeOver);\n scroll.removeEventListener(\"keydown\", onKey);\n };\n }, [turnKey, scrollRef, contentRef, state]);\n\n return null;\n};\n\nexport type ConversationContentProps = ComponentProps<\n typeof StickToBottom.Content\n>;\n\nexport const ConversationContent = ({\n className,\n ...props\n}: ConversationContentProps) => (\n <StickToBottom.Content\n className={cn(\"flex flex-col gap-8\", className)}\n {...props}\n />\n);\n\nexport type ConversationEmptyStateProps = ComponentProps<\"div\"> & {\n title?: string;\n description?: string;\n icon?: React.ReactNode;\n};\n\nexport const ConversationEmptyState = ({\n className,\n title = \"No messages yet\",\n description = \"Start a conversation to see messages here\",\n icon,\n children,\n ...props\n}: ConversationEmptyStateProps) => (\n <div\n className={cn(\n \"flex size-full flex-col items-center justify-center gap-3 p-8 text-center\",\n className\n )}\n {...props}\n >\n {children ?? (\n <>\n {icon && <div className=\"text-muted-foreground\">{icon}</div>}\n <div className=\"space-y-1\">\n <h3 className=\"font-medium text-sm\">{title}</h3>\n {description && (\n <p className=\"text-muted-foreground text-sm\">{description}</p>\n )}\n </div>\n </>\n )}\n </div>\n);\n\nexport type ConversationScrollButtonProps = ComponentProps<typeof Button>;\n\nexport const ConversationScrollButton = ({\n className,\n ...props\n}: ConversationScrollButtonProps) => {\n const { isAtBottom, scrollToBottom } = useStickToBottomContext();\n\n const handleScrollToBottom = useCallback(() => {\n scrollToBottom();\n }, [scrollToBottom]);\n\n return (\n !isAtBottom && (\n <Button\n className={cn(\n \"absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full\",\n className\n )}\n onClick={handleScrollToBottom}\n size=\"icon\"\n type=\"button\"\n variant=\"outline\"\n {...props}\n >\n <ArrowDownIcon className=\"size-4\" />\n </Button>\n )\n );\n};\n","\"use client\";\n\n/**\n * Knowledge Base API Client\n * Communicates with central system's KB endpoints.\n */\n\nexport interface KBSearchOptions {\n\ttopK?: number;\n\tthreshold?: number;\n\tsectorId?: string;\n}\n\nexport interface KBSearchResult {\n\tid: number;\n\tcontent: string;\n\tdocumentName: string | null;\n\tsourceUrl: string | null;\n\tsimilarity: number;\n\tpageTitle?: string;\n\tsectionType?: string;\n}\n\nexport interface KBSearchResponse {\n\tsuccess: boolean;\n\tresults: KBSearchResult[];\n\tmetadata: {\n\t\tquery: string;\n\t\ttotalResults: number;\n\t\tgeneratedQueries?: string[];\n\t};\n}\n\nfunction getDefaultEndpoint(): string {\n\ttry {\n\t\t// Vite/ESM environments\n\t\tconst env = (import.meta as unknown as { env?: Record<string, string> }).env;\n\t\tif (env?.VITE_API_ENDPOINT) return env.VITE_API_ENDPOINT;\n\t} catch {\n\t\t// Ignore — not a Vite/ESM env.\n\t}\n\treturn \"http://localhost:3000\";\n}\n\n/**\n * Search the knowledge base via central API.\n */\nexport async function searchKnowledgeBase(\n\tprojectId: string,\n\tquery: string,\n\toptions?: KBSearchOptions,\n\tapiEndpoint?: string,\n): Promise<KBSearchResponse> {\n\tconst endpoint = apiEndpoint || getDefaultEndpoint();\n\n\tconst response = await fetch(`${endpoint}/api/kb/search`, {\n\t\tmethod: \"POST\",\n\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\tcredentials: \"include\",\n\t\tbody: JSON.stringify({\n\t\t\tprojectId,\n\t\t\tquery,\n\t\t\ttopK: options?.topK || 5,\n\t\t\tthreshold: options?.threshold || 0.3,\n\t\t\tsectorId: options?.sectorId,\n\t\t}),\n\t});\n\n\tif (!response.ok) {\n\t\tconst error = await response\n\t\t\t.json()\n\t\t\t.catch(() => ({ error: response.statusText }));\n\t\tthrow new Error(\n\t\t\t`KB search failed: ${error.error || response.statusText}`,\n\t\t);\n\t}\n\n\treturn await response.json();\n}\n\nexport interface CustomTool {\n\tid: string;\n\tname: string;\n\tdisplayName: string;\n\tdescription: string;\n\tinputSchema: unknown;\n\ttoolType: string;\n\tisActive: boolean;\n}\n\n/**\n * Get the list of available custom tools.\n */\nexport async function getCustomTools(\n\tprojectId: string,\n\tapiEndpoint?: string,\n): Promise<CustomTool[]> {\n\tconst endpoint = apiEndpoint || getDefaultEndpoint();\n\n\tconst response = await fetch(\n\t\t`${endpoint}/api/kb/tools?projectId=${projectId}`,\n\t\t{ method: \"GET\", credentials: \"include\" },\n\t);\n\n\tif (!response.ok) {\n\t\tthrow new Error(`Failed to get tools: ${response.statusText}`);\n\t}\n\n\tconst data = await response.json();\n\treturn data.tools || [];\n}\n\n/**\n * Execute a custom tool.\n */\nexport async function executeCustomTool(\n\tprojectId: string,\n\ttoolName: string,\n\tinput: unknown,\n\tapiEndpoint?: string,\n): Promise<unknown> {\n\tconst endpoint = apiEndpoint || getDefaultEndpoint();\n\n\tconst response = await fetch(`${endpoint}/api/kb/tools`, {\n\t\tmethod: \"POST\",\n\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\tcredentials: \"include\",\n\t\tbody: JSON.stringify({ projectId, toolName, input }),\n\t});\n\n\tif (!response.ok) {\n\t\tthrow new Error(`Tool execution failed: ${response.statusText}`);\n\t}\n\n\tconst data = await response.json();\n\treturn data.result;\n}\n\n/**\n * Feedback request payload.\n */\nexport interface FeedbackRequest {\n\tprojectId: string;\n\tsessionId?: string;\n\tmessageId?: string;\n\tisPositive: boolean;\n\tissueType?:\n\t\t| \"wrong_answer\"\n\t\t| \"partial_answer\"\n\t\t| \"hallucination\"\n\t\t| \"inappropriate_tone\";\n\tfeedbackText?: string;\n}\n\n/**\n * Submit feedback for a chat response.\n */\nexport async function submitFeedback(\n\trequest: FeedbackRequest,\n\tapiKey?: string,\n\tapiEndpoint?: string,\n): Promise<{ success: boolean; error?: string }> {\n\tconst endpoint = apiEndpoint || getDefaultEndpoint();\n\n\tconst headers: Record<string, string> = {\n\t\t\"Content-Type\": \"application/json\",\n\t};\n\tif (apiKey) {\n\t\theaders[\"Authorization\"] = `Bearer ${apiKey}`;\n\t}\n\n\ttry {\n\t\tconst response = await fetch(`${endpoint}/api/kb/feedback`, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders,\n\t\t\tcredentials: \"include\",\n\t\t\tbody: JSON.stringify(request),\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tconst error = await response\n\t\t\t\t.json()\n\t\t\t\t.catch(() => ({ error: response.statusText }));\n\t\t\treturn { success: false, error: error.error || response.statusText };\n\t\t}\n\n\t\treturn { success: true };\n\t} catch (error) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: error instanceof Error ? error.message : \"Unknown error\",\n\t\t};\n\t}\n}\n","\"use client\";\n\nimport { useState, type ReactNode } from \"react\";\nimport { Check, Copy, X } from \"lucide-react\";\nimport { Textarea } from \"../ui/textarea\";\nimport { submitFeedback, type FeedbackRequest } from \"../core/api/kb-client\";\nimport type { TrackInteractionParams } from \"../core/analytics/interaction-tracker\";\nimport { useI18n } from \"../hooks/use-i18n\";\nimport { cn } from \"../core/utils\";\n\n// Custom icons\nconst ThumbsUpIcon = ({ className }: { className?: string }) => (\n\t<svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" className={className}>\n\t\t<path\n\t\t\td=\"M7 11V19C7 19.2652 6.89464 19.5196 6.70711 19.7071C6.51957 19.8946 6.26522 20 6 20H4C3.73478 20 3.48043 19.8946 3.29289 19.7071C3.10536 19.5196 3 19.2652 3 19V12C3 11.7348 3.10536 11.4804 3.29289 11.2929C3.48043 11.1054 3.73478 11 4 11H7ZM7 11C8.06087 11 9.07828 10.5786 9.82843 9.82843C10.5786 9.07828 11 8.06087 11 7V6C11 5.46957 11.2107 4.96086 11.5858 4.58579C11.9609 4.21071 12.4696 4 13 4C13.5304 4 14.0391 4.21071 14.4142 4.58579C14.7893 4.96086 15 5.46957 15 6V11H18C18.5304 11 19.0391 11.2107 19.4142 11.5858C19.7893 11.9609 20 12.4696 20 13L19 18C18.8562 18.6135 18.5834 19.1402 18.2227 19.501C17.8619 19.8617 17.4328 20.0368 17 20H10C9.20435 20 8.44129 19.6839 7.87868 19.1213C7.31607 18.5587 7 17.7956 7 17\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeWidth=\"1.5\"\n\t\t\tstrokeLinecap=\"round\"\n\t\t\tstrokeLinejoin=\"round\"\n\t\t/>\n\t</svg>\n);\n\nconst ThumbsDownIcon = ({ className }: { className?: string }) => (\n\t<svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" className={className}>\n\t\t<path\n\t\t\td=\"M7 13V4.99999C7 4.73478 6.89464 4.48042 6.70711 4.29289C6.51957 4.10535 6.26522 3.99999 6 3.99999H4C3.73478 3.99999 3.48043 4.10535 3.29289 4.29289C3.10536 4.48042 3 4.73478 3 4.99999V12C3 12.2652 3.10536 12.5196 3.29289 12.7071C3.48043 12.8946 3.73478 13 4 13H7ZM7 13C8.06087 13 9.07828 13.4214 9.82843 14.1716C10.5786 14.9217 11 15.9391 11 17V18C11 18.5304 11.2107 19.0391 11.5858 19.4142C11.9609 19.7893 12.4696 20 13 20C13.5304 20 14.0391 19.7893 14.4142 19.4142C14.7893 19.0391 15 18.5304 15 18V13H18C18.5304 13 19.0391 12.7893 19.4142 12.4142C19.7893 12.0391 20 11.5304 20 11L19 5.99999C18.8562 5.38652 18.5834 4.85975 18.2227 4.49903C17.8619 4.13831 17.4328 3.96317 17 3.99999H10C9.20435 3.99999 8.44129 4.31606 7.87868 4.87867C7.31607 5.44128 7 6.20434 7 6.99999\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeWidth=\"1.5\"\n\t\t\tstrokeLinecap=\"round\"\n\t\t\tstrokeLinejoin=\"round\"\n\t\t/>\n\t</svg>\n);\n\nconst REVIEW_TYPES = [\n\t{ value: \"wrong_answer\", labelKey: \"wrongAnswer\" as const },\n\t{ value: \"partial_answer\", labelKey: \"partialAnswer\" as const },\n\t{ value: \"hallucination\", labelKey: \"hallucination\" as const },\n\t{ value: \"inappropriate_tone\", labelKey: \"inappropriateTone\" as const },\n] as const;\n\ntype ReviewType = (typeof REVIEW_TYPES)[number][\"value\"];\n\nexport interface FeedbackData {\n\tisPositive: boolean;\n\treviewType?: ReviewType;\n\treviewText?: string;\n}\n\n/**\n * Render-prop state passed to `renderActions`, letting consumers build\n * a fully custom action row while keeping all behaviour (submit, copy,\n * analytics) intact.\n */\nexport interface MessageFeedbackActionsState {\n\t/** Current feedback selection (if any) */\n\tfeedback: \"positive\" | \"negative\" | null;\n\t/** True while a feedback submit is in-flight */\n\tisSubmitting: boolean;\n\t/** True briefly after the copy button is used */\n\tcopied: boolean;\n\t/** Submit positive feedback and fire analytics */\n\tonPositive: () => void;\n\t/** Submit negative feedback — opens the review form */\n\tonNegative: () => void;\n\t/** Copy the assistant's text content to clipboard */\n\tonCopy: () => void;\n}\n\ninterface MessageFeedbackProps {\n\tmessageId: string;\n\tprojectId: string;\n\tsessionId?: string;\n\tapiKey?: string;\n\tapiEndpoint?: string;\n\ttextContent: string;\n\ttrackInteraction?: (params: TrackInteractionParams) => void;\n\t/** Optional className merged onto the root wrapper. */\n\tclassName?: string;\n\t/**\n\t * When true, strip the default Tailwind bubble styling and only render\n\t * the semantic structure. Ideal if you want to style from scratch with\n\t * your own design system.\n\t */\n\tunstyled?: boolean;\n\t/**\n\t * Per-element className overrides. Merged with defaults via `cn()` so\n\t * Tailwind utilities can override (e.g. `bg-red-500`).\n\t */\n\tclassNames?: {\n\t\troot?: string;\n\t\tactions?: string;\n\t\tthumbsUp?: string;\n\t\tthumbsDown?: string;\n\t\tcopy?: string;\n\t\treviewForm?: string;\n\t};\n\t/**\n\t * Full override of the action button row. Receives the submit handlers\n\t * + current state. Return any ReactNode. The built-in review form still\n\t * appears below when the user clicks thumbs-down (unless you handle\n\t * `onNegative` yourself and never trigger it).\n\t *\n\t * @example\n\t * ```tsx\n\t * renderActions={({ onPositive, onNegative, onCopy }) => (\n\t * <div className=\"my-custom-row\">\n\t * <MyButton onClick={onPositive}>👍</MyButton>\n\t * <MyButton onClick={onNegative}>👎</MyButton>\n\t * <MyButton onClick={onCopy}>Copy</MyButton>\n\t * </div>\n\t * )}\n\t * ```\n\t */\n\trenderActions?: (state: MessageFeedbackActionsState) => ReactNode;\n}\n\nexport function MessageFeedback({\n\tmessageId,\n\tprojectId,\n\tsessionId,\n\tapiKey,\n\tapiEndpoint,\n\ttextContent,\n\ttrackInteraction,\n\tclassName,\n\tunstyled = false,\n\tclassNames,\n\trenderActions,\n}: MessageFeedbackProps) {\n\tconst { t } = useI18n();\n\tconst [feedback, setFeedback] = useState<\"positive\" | \"negative\" | null>(null);\n\tconst [showReviewForm, setShowReviewForm] = useState(false);\n\tconst [reviewType, setReviewType] = useState<ReviewType | null>(null);\n\tconst [reviewText, setReviewText] = useState(\"\");\n\tconst [isSubmitting, setIsSubmitting] = useState(false);\n\tconst [copied, setCopied] = useState(false);\n\n\tconst submitFeedbackToApi = async (feedbackData: FeedbackData) => {\n\t\tif (!projectId || !messageId || isSubmitting) return;\n\n\t\tsetIsSubmitting(true);\n\t\ttry {\n\t\t\tconst request: FeedbackRequest = {\n\t\t\t\tprojectId,\n\t\t\t\tsessionId,\n\t\t\t\tmessageId,\n\t\t\t\tisPositive: feedbackData.isPositive,\n\t\t\t\tissueType: feedbackData.reviewType as any,\n\t\t\t\tfeedbackText: feedbackData.reviewText,\n\t\t\t};\n\t\t\tconst result = await submitFeedback(request, apiKey, apiEndpoint);\n\t\t\tif (!result.success) {\n\t\t\t\tconsole.error(\"Failed to submit feedback:\", result.error);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Failed to submit feedback:\", error);\n\t\t} finally {\n\t\t\tsetIsSubmitting(false);\n\t\t}\n\t};\n\n\tconst handlePositiveFeedback = () => {\n\t\tif (isSubmitting) return;\n\t\tsetFeedback(\"positive\");\n\t\tsetShowReviewForm(false);\n\t\tsubmitFeedbackToApi({ isPositive: true });\n\n\t\ttrackInteraction?.({\n\t\t\ttype: \"feedback\",\n\t\t\ttarget: \"thumbs_up\",\n\t\t\tlabel: \"Positive feedback\",\n\t\t\tmessageId,\n\t\t\tmetadata: { isPositive: true },\n\t\t});\n\t};\n\n\tconst handleNegativeFeedback = () => {\n\t\tif (isSubmitting) return;\n\t\tsetFeedback(\"negative\");\n\t\tsetShowReviewForm(true);\n\t};\n\n\tconst handleSubmitReview = () => {\n\t\tif (isSubmitting) return;\n\t\tconst feedbackData: FeedbackData = {\n\t\t\tisPositive: false,\n\t\t\treviewType: reviewType ?? undefined,\n\t\t\treviewText: reviewText || undefined,\n\t\t};\n\t\tsetShowReviewForm(false);\n\t\tsubmitFeedbackToApi(feedbackData);\n\n\t\ttrackInteraction?.({\n\t\t\ttype: \"feedback\",\n\t\t\ttarget: \"thumbs_down\",\n\t\t\tlabel: \"Negative feedback\",\n\t\t\tmessageId,\n\t\t\tmetadata: { isPositive: false, reviewType, reviewText },\n\t\t});\n\t};\n\n\tconst handleCancelReview = () => {\n\t\tsetFeedback(null);\n\t\tsetShowReviewForm(false);\n\t\tsetReviewType(null);\n\t\tsetReviewText(\"\");\n\t};\n\n\tconst handleCopy = async () => {\n\t\tif (typeof window === \"undefined\" || !navigator?.clipboard?.writeText) return;\n\t\ttry {\n\t\t\tawait navigator.clipboard.writeText(textContent);\n\t\t\tsetCopied(true);\n\t\t\tsetTimeout(() => setCopied(false), 2000);\n\n\t\t\ttrackInteraction?.({\n\t\t\t\ttype: \"copy\",\n\t\t\t\ttarget: \"message\",\n\t\t\t\tlabel: \"Copy response\",\n\t\t\t\tmessageId,\n\t\t\t\tmetadata: { contentLength: textContent.length },\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Failed to copy:\", error);\n\t\t}\n\t};\n\n\tconst actionsState: MessageFeedbackActionsState = {\n\t\tfeedback,\n\t\tisSubmitting,\n\t\tcopied,\n\t\tonPositive: handlePositiveFeedback,\n\t\tonNegative: handleNegativeFeedback,\n\t\tonCopy: handleCopy,\n\t};\n\n\treturn (\n\t\t<div className={cn(unstyled ? \"\" : \"mt-4\", classNames?.root, className)}>\n\t\t\t{/* Action buttons row */}\n\t\t\t{renderActions ? (\n\t\t\t\trenderActions(actionsState)\n\t\t\t) : (\n\t\t\t\t<div className={cn(\"flex items-center gap-2\", classNames?.actions)}>\n\t\t\t\t\t{/* Thumbs Up */}\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={handlePositiveFeedback}\n\t\t\t\t\t\tdisabled={isSubmitting}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\tunstyled\n\t\t\t\t\t\t\t\t? \"\"\n\t\t\t\t\t\t\t\t: cn(\n\t\t\t\t\t\t\t\t\t\t\"group w-8 h-8 rounded-full flex items-center justify-center transition-all duration-300\",\n\t\t\t\t\t\t\t\t\t\tfeedback === \"positive\"\n\t\t\t\t\t\t\t\t\t\t\t? \"bg-primary/10 text-primary\"\n\t\t\t\t\t\t\t\t\t\t\t: \"bg-secondary text-muted-foreground hover:bg-primary/10 hover:text-primary\",\n\t\t\t\t\t\t\t\t\t\tisSubmitting && \"opacity-50 cursor-not-allowed\",\n\t\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t\tclassNames?.thumbsUp,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\ttitle={t(\"helpful\")}\n\t\t\t\t\t\taria-label={t(\"helpful\")}\n\t\t\t\t\t\taria-pressed={feedback === \"positive\"}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ThumbsUpIcon />\n\t\t\t\t\t</button>\n\n\t\t\t\t\t{/* Thumbs Down */}\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={handleNegativeFeedback}\n\t\t\t\t\t\tdisabled={isSubmitting}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\tunstyled\n\t\t\t\t\t\t\t\t? \"\"\n\t\t\t\t\t\t\t\t: cn(\n\t\t\t\t\t\t\t\t\t\t\"group w-8 h-8 rounded-full flex items-center justify-center transition-all duration-300\",\n\t\t\t\t\t\t\t\t\t\tfeedback === \"negative\"\n\t\t\t\t\t\t\t\t\t\t\t? \"bg-red-100 text-red-500\"\n\t\t\t\t\t\t\t\t\t\t\t: \"bg-secondary text-muted-foreground hover:bg-red-50 hover:text-red-500\",\n\t\t\t\t\t\t\t\t\t\tisSubmitting && \"opacity-50 cursor-not-allowed\",\n\t\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t\tclassNames?.thumbsDown,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\ttitle={t(\"notHelpful\")}\n\t\t\t\t\t\taria-label={t(\"notHelpful\")}\n\t\t\t\t\t\taria-pressed={feedback === \"negative\"}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ThumbsDownIcon />\n\t\t\t\t\t</button>\n\n\t\t\t\t\t{/* Copy Button */}\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={handleCopy}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\tunstyled\n\t\t\t\t\t\t\t\t? \"\"\n\t\t\t\t\t\t\t\t: \"group w-8 h-8 rounded-full bg-secondary flex items-center justify-center text-muted-foreground hover:bg-primary/10 hover:text-primary transition-all duration-300\",\n\t\t\t\t\t\t\tclassNames?.copy,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\ttitle={t(\"copyResponse\")}\n\t\t\t\t\t\taria-label={t(\"copyResponse\")}\n\t\t\t\t\t>\n\t\t\t\t\t\t{copied ? (\n\t\t\t\t\t\t\t<Check className=\"w-4 h-4 text-green-600\" />\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Copy className=\"w-4 h-4\" />\n\t\t\t\t\t\t)}\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t)}\n\n\t\t\t{/* Review Form */}\n\t\t\t{showReviewForm && (\n\t\t\t\t<div className=\"mt-4 bg-gradient-to-br from-accent to-secondary rounded-2xl border border-border overflow-hidden animate-in slide-in-from-top-2 duration-300\">\n\t\t\t\t\t<div className=\"px-5 py-4 border-b border-border flex items-center justify-between\">\n\t\t\t\t\t\t<div className=\"flex items-center gap-3\">\n\t\t\t\t\t\t\t<span className=\"w-8 h-8 rounded-xl bg-card border border-border flex items-center justify-center\">\n\t\t\t\t\t\t\t\t<ThumbsDownIcon className=\"text-red-500\" />\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"font-medium text-sm\">{t(\"whatWentWrong\")}</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tonClick={handleCancelReview}\n\t\t\t\t\t\t\tclassName=\"w-8 h-8 rounded-full bg-card border border-border flex items-center justify-center hover:border-primary transition-colors\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<X className=\"w-4 h-4\" />\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div className=\"p-5 space-y-4\">\n\t\t\t\t\t\t<div className=\"flex flex-wrap gap-2\">\n\t\t\t\t\t\t\t{REVIEW_TYPES.map((type) => (\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tkey={type.value}\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\tonClick={() => setReviewType(type.value as ReviewType)}\n\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\"px-4 py-2 rounded-full text-xs font-medium transition-all duration-300\",\n\t\t\t\t\t\t\t\t\t\treviewType === type.value\n\t\t\t\t\t\t\t\t\t\t\t? \"bg-primary text-primary-foreground shadow-md shadow-primary/20\"\n\t\t\t\t\t\t\t\t\t\t\t: \"bg-card border border-border text-foreground hover:border-primary hover:text-primary\"\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{t(type.labelKey)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<Textarea\n\t\t\t\t\t\t\tplaceholder={t(\"addDetails\")}\n\t\t\t\t\t\t\tvalue={reviewText}\n\t\t\t\t\t\t\tonChange={(e) => setReviewText(e.target.value)}\n\t\t\t\t\t\t\trows={2}\n\t\t\t\t\t\t\tclassName=\"text-sm resize-none rounded-xl border-border focus:border-primary focus:ring-primary/20\"\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<div className=\"flex justify-end\">\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tonClick={handleSubmitReview}\n\t\t\t\t\t\t\t\tdisabled={isSubmitting}\n\t\t\t\t\t\t\t\tclassName=\"group relative px-5 py-2.5 bg-primary text-primary-foreground rounded-full text-sm font-medium overflow-hidden transition-all duration-300 hover:shadow-lg hover:shadow-primary/25 disabled:opacity-50 disabled:cursor-not-allowed\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<span className=\"relative z-10\">\n\t\t\t\t\t\t\t\t\t{isSubmitting ? t(\"submitting\") : t(\"submitFeedback\")}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName=\"absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity bg-primary/90\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\n\t\t\t<style>{`\n\t\t\t\t.animate-in {\n\t\t\t\t\tanimation: animateIn 0.3s ease-out;\n\t\t\t\t}\n\t\t\t\t.slide-in-from-top-2 {\n\t\t\t\t\t--tw-enter-translate-y: -0.5rem;\n\t\t\t\t}\n\t\t\t\t@keyframes animateIn {\n\t\t\t\t\tfrom {\n\t\t\t\t\t\topacity: 0;\n\t\t\t\t\t\ttransform: translateY(var(--tw-enter-translate-y, 0));\n\t\t\t\t\t}\n\t\t\t\t\tto {\n\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t\ttransform: translateY(0);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t`}</style>\n\t\t</div>\n\t);\n}\n","\"use client\";\n\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"../core/utils\"\nimport { Separator } from \"./separator\"\n\nconst buttonGroupVariants = cva(\n \"flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1\",\n {\n variants: {\n orientation: {\n horizontal:\n \"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none\",\n vertical:\n \"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none\",\n },\n },\n defaultVariants: {\n orientation: \"horizontal\",\n },\n }\n)\n\nfunction ButtonGroup({\n className,\n orientation,\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof buttonGroupVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"button-group\"\n data-orientation={orientation}\n className={cn(buttonGroupVariants({ orientation }), className)}\n {...props}\n />\n )\n}\n\nfunction ButtonGroupText({\n className,\n asChild = false,\n ...props\n}: React.ComponentProps<\"div\"> & {\n asChild?: boolean\n}) {\n const Comp = asChild ? Slot : \"div\"\n\n return (\n <Comp\n className={cn(\n \"bg-muted shadow-xs flex items-center gap-2 rounded-md border px-4 text-sm font-medium [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ButtonGroupSeparator({\n className,\n orientation = \"vertical\",\n ...props\n}: React.ComponentProps<typeof Separator>) {\n return (\n <Separator\n data-slot=\"button-group-separator\"\n orientation={orientation}\n className={cn(\n \"bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n ButtonGroup,\n ButtonGroupSeparator,\n ButtonGroupText,\n buttonGroupVariants,\n}\n","\"use client\";\n\nimport { Button } from \"../ui/button\";\nimport {\n ButtonGroup,\n ButtonGroupText,\n} from \"../ui/button-group\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"../ui/tooltip\";\nimport { cn } from \"../core/utils\";\nimport type { FileUIPart, UIMessage } from \"ai\";\nimport {\n ChevronLeftIcon,\n ChevronRightIcon,\n PaperclipIcon,\n XIcon,\n} from \"lucide-react\";\nimport type { ComponentProps, HTMLAttributes, ReactElement } from \"react\";\nimport { createContext, memo, useContext, useEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Streamdown } from \"streamdown\";\n\nexport type MessageProps = HTMLAttributes<HTMLDivElement> & {\n from: UIMessage[\"role\"];\n fullWidth?: boolean;\n};\n\nexport const Message = ({ className, from, fullWidth, ...props }: MessageProps) => (\n <div\n className={cn(\n \"group flex w-full flex-col gap-2\",\n fullWidth ? \"\" : from === \"assistant\" ? \"max-w-[var(--ac-assistant-max-width,95%)]\" : \"max-w-[95%]\",\n from === \"user\" ? \"is-user justify-end\" : \"is-assistant\",\n className\n )}\n {...props}\n />\n);\n\nexport type MessageContentProps = HTMLAttributes<HTMLDivElement> & {\n fullWidth?: boolean;\n};\n\nexport const MessageContent = ({\n children,\n className,\n fullWidth,\n ...props\n}: MessageContentProps) => (\n <div\n className={cn(\n \"flex min-w-0 flex-col gap-2 overflow-hidden\",\n fullWidth\n ? \"w-full\"\n : \"w-fit max-w-full\",\n \"group-[.is-user]:ml-auto group-[.is-user]:px-6 group-[.is-user]:py-4 group-[.is-user]:text-foreground group-[.is-user]:rounded-bl-[24px] group-[.is-user]:rounded-br-[24px] group-[.is-user]:rounded-tl-[4px] group-[.is-user]:rounded-tr-[24px] group-[.is-user]:bg-[var(--ac-user-bubble-bg,#f0f4f8)]\",\n \"group-[.is-assistant]:text-foreground group-[.is-assistant]:w-full\",\n className\n )}\n {...props}\n >\n {children}\n </div>\n);\n\nexport type MessageActionsProps = ComponentProps<\"div\">;\n\nexport const MessageActions = ({\n className,\n children,\n ...props\n}: MessageActionsProps) => (\n <div className={cn(\"flex items-center gap-1\", className)} {...props}>\n {children}\n </div>\n);\n\nexport type MessageActionProps = ComponentProps<typeof Button> & {\n tooltip?: string;\n label?: string;\n};\n\nexport const MessageAction = ({\n tooltip,\n children,\n label,\n variant = \"ghost\",\n size = \"icon-sm\",\n ...props\n}: MessageActionProps) => {\n const button = (\n <Button size={size} type=\"button\" variant={variant} {...props}>\n {children}\n <span className=\"sr-only\">{label || tooltip}</span>\n </Button>\n );\n\n if (tooltip) {\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>{button}</TooltipTrigger>\n <TooltipContent>\n <p>{tooltip}</p>\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n }\n\n return button;\n};\n\ntype MessageBranchContextType = {\n currentBranch: number;\n totalBranches: number;\n goToPrevious: () => void;\n goToNext: () => void;\n branches: ReactElement[];\n setBranches: (branches: ReactElement[]) => void;\n};\n\nconst MessageBranchContext = createContext<MessageBranchContextType | null>(\n null\n);\n\nconst useMessageBranch = () => {\n const context = useContext(MessageBranchContext);\n\n if (!context) {\n throw new Error(\n \"MessageBranch components must be used within MessageBranch\"\n );\n }\n\n return context;\n};\n\nexport type MessageBranchProps = HTMLAttributes<HTMLDivElement> & {\n defaultBranch?: number;\n onBranchChange?: (branchIndex: number) => void;\n};\n\nexport const MessageBranch = ({\n defaultBranch = 0,\n onBranchChange,\n className,\n ...props\n}: MessageBranchProps) => {\n const [currentBranch, setCurrentBranch] = useState(defaultBranch);\n const [branches, setBranches] = useState<ReactElement[]>([]);\n\n const handleBranchChange = (newBranch: number) => {\n setCurrentBranch(newBranch);\n onBranchChange?.(newBranch);\n };\n\n const goToPrevious = () => {\n const newBranch =\n currentBranch > 0 ? currentBranch - 1 : branches.length - 1;\n handleBranchChange(newBranch);\n };\n\n const goToNext = () => {\n const newBranch =\n currentBranch < branches.length - 1 ? currentBranch + 1 : 0;\n handleBranchChange(newBranch);\n };\n\n const contextValue: MessageBranchContextType = {\n currentBranch,\n totalBranches: branches.length,\n goToPrevious,\n goToNext,\n branches,\n setBranches,\n };\n\n return (\n <MessageBranchContext.Provider value={contextValue}>\n <div\n className={cn(\"grid w-full gap-2 [&>div]:pb-0\", className)}\n {...props}\n />\n </MessageBranchContext.Provider>\n );\n};\n\nexport type MessageBranchContentProps = HTMLAttributes<HTMLDivElement>;\n\nexport const MessageBranchContent = ({\n children,\n ...props\n}: MessageBranchContentProps) => {\n const { currentBranch, setBranches, branches } = useMessageBranch();\n const childrenArray = Array.isArray(children) ? children : [children];\n\n useEffect(() => {\n if (branches.length !== childrenArray.length) {\n setBranches(childrenArray);\n }\n }, [childrenArray, branches, setBranches]);\n\n return childrenArray.map((branch, index) => (\n <div\n className={cn(\n \"grid gap-2 overflow-hidden [&>div]:pb-0\",\n index === currentBranch ? \"block\" : \"hidden\"\n )}\n key={branch.key}\n {...props}\n >\n {branch}\n </div>\n ));\n};\n\nexport type MessageBranchSelectorProps = HTMLAttributes<HTMLDivElement> & {\n from: UIMessage[\"role\"];\n};\n\nexport const MessageBranchSelector = ({\n className,\n from,\n ...props\n}: MessageBranchSelectorProps) => {\n const { totalBranches } = useMessageBranch();\n\n if (totalBranches <= 1) {\n return null;\n }\n\n return (\n <ButtonGroup\n className=\"[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md\"\n orientation=\"horizontal\"\n {...props}\n />\n );\n};\n\nexport type MessageBranchPreviousProps = ComponentProps<typeof Button>;\n\nexport const MessageBranchPrevious = ({\n children,\n ...props\n}: MessageBranchPreviousProps) => {\n const { goToPrevious, totalBranches } = useMessageBranch();\n\n return (\n <Button\n aria-label=\"Previous branch\"\n disabled={totalBranches <= 1}\n onClick={goToPrevious}\n size=\"icon-sm\"\n type=\"button\"\n variant=\"ghost\"\n {...props}\n >\n {children ?? <ChevronLeftIcon size={14} />}\n </Button>\n );\n};\n\nexport type MessageBranchNextProps = ComponentProps<typeof Button>;\n\nexport const MessageBranchNext = ({\n children,\n className,\n ...props\n}: MessageBranchNextProps) => {\n const { goToNext, totalBranches } = useMessageBranch();\n\n return (\n <Button\n aria-label=\"Next branch\"\n disabled={totalBranches <= 1}\n onClick={goToNext}\n size=\"icon-sm\"\n type=\"button\"\n variant=\"ghost\"\n {...props}\n >\n {children ?? <ChevronRightIcon size={14} />}\n </Button>\n );\n};\n\nexport type MessageBranchPageProps = HTMLAttributes<HTMLSpanElement>;\n\nexport const MessageBranchPage = ({\n className,\n ...props\n}: MessageBranchPageProps) => {\n const { currentBranch, totalBranches } = useMessageBranch();\n\n return (\n <ButtonGroupText\n className={cn(\n \"border-none bg-transparent text-muted-foreground shadow-none\",\n className\n )}\n {...props}\n >\n {currentBranch + 1} of {totalBranches}\n </ButtonGroupText>\n );\n};\n\nexport type MessageResponseProps = ComponentProps<typeof Streamdown>;\n\n/**\n * Add UTM parameters to a URL\n */\nfunction addUtmParams(url: string): string {\n try {\n const urlObj = new URL(url);\n urlObj.searchParams.set(\"utm_source\", \"chat\");\n urlObj.searchParams.set(\"utm_medium\", \"referral\");\n return urlObj.toString();\n } catch {\n return url;\n }\n}\n\nconst CustomLink = ({ href, children, ...props }: React.AnchorHTMLAttributes<HTMLAnchorElement>) => (\n <a\n href={href ? addUtmParams(href) : href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"hover:underline hover:opacity-80 transition-opacity font-medium\"\n {...props}\n >\n {children}\n </a>\n);\n\nconst CustomImage = ({ src, alt, ...props }: React.ImgHTMLAttributes<HTMLImageElement>) => (\n <img\n src={src}\n alt={alt || \"\"}\n loading=\"lazy\"\n className=\"rounded-xl max-w-full h-auto my-4\"\n {...props}\n />\n);\n\nconst CustomTable = ({ children, ...props }: React.TableHTMLAttributes<HTMLTableElement>) => (\n <div className=\"my-4 overflow-x-auto\">\n <table\n className=\"w-full text-sm rounded-xl border border-black/[0.08] overflow-hidden\"\n {...props}\n >\n {children}\n </table>\n </div>\n);\n\nconst CustomThead = ({ children, ...props }: React.HTMLAttributes<HTMLTableSectionElement>) => (\n <thead className=\"bg-black/[0.04]\" {...props}>\n {children}\n </thead>\n);\n\nconst CustomTh = ({ children, ...props }: React.ThHTMLAttributes<HTMLTableCellElement>) => (\n <th\n className=\"px-4 py-3 text-start text-xs font-medium uppercase tracking-wider opacity-60 border-b border-black/[0.08]\"\n {...props}\n >\n {children}\n </th>\n);\n\nconst CustomTd = ({ children, ...props }: React.TdHTMLAttributes<HTMLTableCellElement>) => (\n <td\n className=\"px-4 py-3 border-b border-black/[0.08]\"\n {...props}\n >\n {children}\n </td>\n);\n\nconst CustomTr = ({ children, ...props }: React.HTMLAttributes<HTMLTableRowElement>) => (\n <tr\n className=\"hover:bg-black/[0.02] transition-colors\"\n {...props}\n >\n {children}\n </tr>\n);\n\nexport const MessageResponse = memo(\n ({ className, ...props }: MessageResponseProps) => (\n <Streamdown\n className={cn(\n \"message-response size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0\",\n className\n )}\n components={{\n a: CustomLink,\n img: CustomImage,\n table: CustomTable,\n thead: CustomThead,\n th: CustomTh,\n td: CustomTd,\n tr: CustomTr,\n } as never}\n linkSafety={{ enabled: false }}\n {...props}\n />\n ),\n (prevProps, nextProps) => prevProps.children === nextProps.children\n);\n\nMessageResponse.displayName = \"MessageResponse\";\n\nexport type MessageAttachmentProps = HTMLAttributes<HTMLDivElement> & {\n data: FileUIPart;\n className?: string;\n onRemove?: () => void;\n};\n\n/**\n * A full-size view of one attachment, laid over the chat.\n *\n * Portalled into the component's own root — `getRootNode()` returns the shadow\n * root when the chat is mounted in one — so the overlay is not clipped by the\n * message's `overflow-hidden` tile and is not stranded outside the tree that\n * carries the widget's styles. Positioning and colour are inline rather than\n * utility classes for the same reason: an embedded widget's host page has no\n * obligation to have loaded anything.\n */\nfunction MessageAttachmentLightbox({\n url,\n alt,\n onClose,\n}: {\n url: string;\n alt: string;\n onClose: () => void;\n}) {\n const [container, setContainer] = useState<Element | DocumentFragment | null>(\n null\n );\n const anchorRef = useRef<HTMLSpanElement>(null);\n\n useEffect(() => {\n const root = anchorRef.current?.getRootNode();\n if (!root) return;\n const host =\n root instanceof ShadowRoot ? root : (root as Document).body ?? null;\n if (!host) return;\n const node = document.createElement(\"div\");\n // Marked so the widget's own theme variables resolve inside the overlay.\n node.setAttribute(\"data-aigentyc-chat\", \"\");\n host.appendChild(node);\n setContainer(node);\n return () => {\n node.remove();\n };\n }, []);\n\n useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") onClose();\n };\n document.addEventListener(\"keydown\", onKey);\n return () => document.removeEventListener(\"keydown\", onKey);\n }, [onClose]);\n\n const overlay = (\n <div\n aria-label={alt}\n aria-modal=\"true\"\n className=\"ac-lightbox\"\n onClick={onClose}\n role=\"dialog\"\n style={{\n position: \"fixed\",\n inset: 0,\n zIndex: 2147483001,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n padding: 24,\n background: \"rgba(8, 12, 16, 0.82)\",\n pointerEvents: \"auto\",\n cursor: \"zoom-out\",\n }}\n >\n <img\n alt={alt}\n // Stops a click on the picture itself from closing what it opened.\n onClick={(e) => e.stopPropagation()}\n src={url}\n style={{\n maxWidth: \"100%\",\n maxHeight: \"100%\",\n objectFit: \"contain\",\n borderRadius: 12,\n boxShadow: \"0 24px 64px rgba(0, 0, 0, 0.45)\",\n cursor: \"default\",\n }}\n />\n <button\n aria-label=\"Close\"\n onClick={onClose}\n style={{\n position: \"absolute\",\n top: 16,\n insetInlineEnd: 16,\n width: 36,\n height: 36,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n border: \"none\",\n borderRadius: \"50%\",\n background: \"rgba(255, 255, 255, 0.14)\",\n color: \"#fff\",\n cursor: \"pointer\",\n }}\n type=\"button\"\n >\n <XIcon size={18} />\n </button>\n </div>\n );\n\n return (\n <>\n {/* Zero-size anchor: the portal needs a node already in the tree to ask\n which root it belongs to. */}\n <span ref={anchorRef} style={{ display: \"none\" }} />\n {container ? createPortal(overlay, container) : null}\n </>\n );\n}\n\nexport function MessageAttachment({\n data,\n className,\n onRemove,\n ...props\n}: MessageAttachmentProps) {\n const [zoomed, setZoomed] = useState(false);\n const filename = data.filename || \"\";\n const mediaType =\n data.mediaType?.startsWith(\"image/\") && data.url ? \"image\" : \"file\";\n const isImage = mediaType === \"image\";\n const attachmentLabel = filename || (isImage ? \"Image\" : \"Attachment\");\n\n return (\n <div\n className={cn(\n \"group relative size-24 overflow-hidden rounded-lg\",\n className\n )}\n {...props}\n >\n {isImage ? (\n <>\n {/* The thumbnail is a crop, so it has to lead somewhere: a picture of a\n cable's printed marking is unreadable at 96px, and the transcript is\n exactly where someone goes back to read it. It opens in place rather\n than in a tab — leaving the panel to look at an image you just sent\n into it is a strange thing to be asked to do. */}\n <button\n aria-label={`View ${attachmentLabel} full size`}\n className=\"block size-full cursor-zoom-in\"\n onClick={() => setZoomed(true)}\n title=\"View full size\"\n type=\"button\"\n >\n <img\n alt={filename || \"attachment\"}\n className=\"size-full object-cover transition-transform duration-200 group-hover:scale-105\"\n height={100}\n src={data.url}\n width={100}\n />\n </button>\n {zoomed && (\n <MessageAttachmentLightbox\n alt={attachmentLabel}\n onClose={() => setZoomed(false)}\n url={data.url}\n />\n )}\n {onRemove && (\n <Button\n aria-label=\"Remove attachment\"\n className=\"absolute top-2 right-2 size-6 rounded-full bg-background/80 p-0 opacity-0 backdrop-blur-sm transition-opacity hover:bg-background group-hover:opacity-100 [&>svg]:size-3\"\n onClick={(e) => {\n e.stopPropagation();\n onRemove();\n }}\n type=\"button\"\n variant=\"ghost\"\n >\n <XIcon />\n <span className=\"sr-only\">Remove</span>\n </Button>\n )}\n </>\n ) : (\n <>\n {/* Wrapped in its own provider: `Tooltip` here is Radix's bare Root,\n and the surrounding transcript is not inside one. */}\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <div className=\"flex size-full shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground\">\n <PaperclipIcon className=\"size-4\" />\n </div>\n </TooltipTrigger>\n <TooltipContent>\n <p>{attachmentLabel}</p>\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n {onRemove && (\n <Button\n aria-label=\"Remove attachment\"\n className=\"size-6 shrink-0 rounded-full p-0 opacity-0 transition-opacity hover:bg-accent group-hover:opacity-100 [&>svg]:size-3\"\n onClick={(e) => {\n e.stopPropagation();\n onRemove();\n }}\n type=\"button\"\n variant=\"ghost\"\n >\n <XIcon />\n <span className=\"sr-only\">Remove</span>\n </Button>\n )}\n </>\n )}\n </div>\n );\n}\n\nexport type MessageAttachmentsProps = ComponentProps<\"div\">;\n\nexport function MessageAttachments({\n children,\n className,\n ...props\n}: MessageAttachmentsProps) {\n // An empty array is truthy, so a message with no files would otherwise render\n // an empty flex row that still takes up the container's gap.\n const isEmpty =\n !children || (Array.isArray(children) && children.flat().filter(Boolean).length === 0);\n if (isEmpty) {\n return null;\n }\n\n return (\n <div\n className={cn(\n \"ml-auto flex w-fit flex-wrap items-start gap-2\",\n className\n )}\n {...props}\n >\n {children}\n </div>\n );\n}\n\nexport type MessageToolbarProps = ComponentProps<\"div\">;\n\nexport const MessageToolbar = ({\n className,\n children,\n ...props\n}: MessageToolbarProps) => (\n <div\n className={cn(\n \"mt-4 flex w-full items-center justify-between gap-4\",\n className\n )}\n {...props}\n >\n {children}\n </div>\n);\n","\"use client\";\n\nimport { cn } from \"../core/utils\";\nimport type { HTMLAttributes } from \"react\";\n\nexport type LoaderProps = HTMLAttributes<HTMLDivElement> & {\n text?: string;\n};\n\nexport const Loader = ({ className, text = \"Thinking...\", ...props }: LoaderProps) => (\n <div\n className={cn(\n \"flex items-center gap-2 w-full py-3\",\n className\n )}\n style={{ color: \"var(--ac-loader-color, var(--ac-primary, #2f80ed))\" }}\n {...props}\n >\n {/* Circular spinner */}\n <svg\n className=\"animate-spin\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle\n cx=\"10\"\n cy=\"10\"\n r=\"8\"\n stroke=\"#E5E5E5\"\n strokeWidth=\"2\"\n fill=\"none\"\n />\n <path\n d=\"M10 2C14.4183 2 18 5.58172 18 10\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n fill=\"none\"\n />\n </svg>\n <span className=\"text-sm text-foreground\">{text}</span>\n </div>\n);\n\n// Spinner loader for other use cases\nexport type SpinnerLoaderProps = HTMLAttributes<HTMLDivElement> & {\n size?: number;\n};\n\nexport const SpinnerLoader = ({ className, size = 16, ...props }: SpinnerLoaderProps) => (\n <div\n className={cn(\n \"inline-flex animate-spin items-center justify-center\",\n className\n )}\n {...props}\n >\n <svg\n height={size}\n strokeLinejoin=\"round\"\n style={{ color: \"currentcolor\" }}\n viewBox=\"0 0 16 16\"\n width={size}\n >\n <title>Loader</title>\n <g clipPath=\"url(#clip0_2393_1490)\">\n <path d=\"M8 0V4\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M8 16V12\" opacity=\"0.5\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M3.29773 1.52783L5.64887 4.7639\" opacity=\"0.9\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M12.7023 1.52783L10.3511 4.7639\" opacity=\"0.1\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M12.7023 14.472L10.3511 11.236\" opacity=\"0.4\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M3.29773 14.472L5.64887 11.236\" opacity=\"0.6\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M15.6085 5.52783L11.8043 6.7639\" opacity=\"0.2\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M0.391602 10.472L4.19583 9.23598\" opacity=\"0.7\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M15.6085 10.4722L11.8043 9.2361\" opacity=\"0.3\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M0.391602 5.52783L4.19583 6.7639\" opacity=\"0.8\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n </g>\n <defs>\n <clipPath id=\"clip0_2393_1490\">\n <rect fill=\"white\" height=\"16\" width=\"16\" />\n </clipPath>\n </defs>\n </svg>\n </div>\n);\n","\"use client\";\n\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"../ui/collapsible\";\nimport { cn } from \"../core/utils\";\nimport { BookIcon, ChevronDownIcon } from \"lucide-react\";\nimport type { ComponentProps } from \"react\";\n\nexport type SourcesProps = ComponentProps<\"div\">;\n\nexport const Sources = ({ className, ...props }: SourcesProps) => (\n <Collapsible\n className={cn(\"not-prose mb-4 text-primary text-xs\", className)}\n {...props}\n />\n);\n\nexport type SourcesTriggerProps = ComponentProps<typeof CollapsibleTrigger> & {\n count: number;\n};\n\nexport const SourcesTrigger = ({\n className,\n count,\n children,\n ...props\n}: SourcesTriggerProps) => (\n <CollapsibleTrigger\n className={cn(\"flex items-center gap-2\", className)}\n {...props}\n >\n {children ?? (\n <>\n <p className=\"font-medium\">Used {count} sources</p>\n <ChevronDownIcon className=\"h-4 w-4\" />\n </>\n )}\n </CollapsibleTrigger>\n);\n\nexport type SourcesContentProps = ComponentProps<typeof CollapsibleContent>;\n\nexport const SourcesContent = ({\n className,\n ...props\n}: SourcesContentProps) => (\n <CollapsibleContent\n className={cn(\n \"mt-3 flex w-fit flex-col gap-2\",\n \"data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in\",\n className\n )}\n {...props}\n />\n);\n\nexport type SourceProps = ComponentProps<\"a\">;\n\nexport const Source = ({ href, title, children, ...props }: SourceProps) => (\n <a\n className=\"flex items-center gap-2\"\n href={href}\n rel=\"noreferrer\"\n target=\"_blank\"\n {...props}\n >\n {children ?? (\n <>\n <BookIcon className=\"h-4 w-4\" />\n <span className=\"block font-medium\">{title}</span>\n </>\n )}\n </a>\n);\n"]}
|