PageSourceSearch

https://llm-talk-five.vercel.app/_next/static/chunks/279-a6e1b5bded8b5b8b.js

js llm-talk-five.vercel.app collected 2026-10-03 07:15:04 UTC 179,519 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[279],{86123:function(e,t,r){"use strict";r.r(t),r.d(t,{ApiKeySettings:function(){return th},AttachmentButton:function(){return A},BYOKIcon:function(){return k},ChatEditor:function(){return W},ChatFooter:function(){return U},ChatInput:function(){return el},ChatModeButton:function(){return z},ChatModeOptions:function(){return P},CitationProvider:function(){return tT.I1},CitationProviderContext:function(){return tT.EI},CodeBlock:function(){return ek},CommandSearch:function(){return eP},ConfirmPopover:function(){return tt},CustomSignIn:function(){return tb},DarkLogo:function(){return e5},DeepResearchIcon:function(){return N},DotSpinner:function(){return tT.t_},EditMessage:function(){return tT.J9},ErrorBoundary:function(){return e_},ErrorPlaceholder:function(){return eO},ExamplePrompts:function(){return ei},FeedbackWidget:function(){return eG},FollowupSuggestions:function(){return tT.Lm},Footer:function(){return eU},FullPageLoader:function(){return eL},GeneratingStatus:function(){return M},HistoryItem:function(){return eZ},ImageAttachment:function(){return Z},ImageDropzone:function(){return B},ImageDropzoneRoot:function(){return q},ImageMessage:function(){return tT.z6},ImageUpload:function(){return V},LinkFavicon:function(){return eQ},LinkPreview:function(){return e1},LinkPreviewPopover:function(){return e0},Logo:function(){return e2},MCPSettings:function(){return tx},MarkdownContent:function(){return tT.SA},MemoizedMdxChunk:function(){return tT.z1},Message:function(){return tT.v0},MessageActions:function(){return tT.P},MotionSkeleton:function(){return te},NewLineIndicator:function(){return R},PersonalizationSettings:function(){return tp},QuestionPrompt:function(){return tT.NR},RecentThreads:function(){return ts},RootLayout:function(){return eV},SearchResultsList:function(){return tn},SelectedContext:function(){return eu},SendStopButton:function(){return _},SettingsModal:function(){return tm},SideDrawer:function(){return eY},Sidebar:function(){return ty},SourceGrid:function(){return tT.QB},SourceList:function(){return tT.LQ},SourcesStack:function(){return tC},SpinnerIcon:function(){return tT.L4},StepRenderer:function(){return tT.Zp},StepStatus:function(){return tT.kd},Steps:function(){return tT.Rg},TableOfMessages:function(){return tS},TextShimmer:function(){return tI},Thread:function(){return tT.jz},ThreadItem:function(){return tT.Ec},ThreadNavBar:function(){return tT.V3},ThreeDotsWave:function(){return tT.yM},ToolCallStep:function(){return tT.zq},ToolIcon:function(){return b},ToolResultIcon:function(){return w},ToolResultStep:function(){return tT.Sc},ToolsMenu:function(){return tE},TopNav:function(){return tz},VaulDrawer:function(){return tT.n5},WebSearchButton:function(){return D},chatOptions:function(){return C},examplePrompts:function(){return en},getRandomPrompt:function(){return ea},isValidUrl:function(){return tT.jv},markdownStyles:function(){return tT.C_},mdxComponents:function(){return e4},modelOptions:function(){return E},normalizeContent:function(){return tT.gS},parseSourceTagsFromXML:function(){return e7},removeIncompleteTags:function(){return tT.Wx},sanitizeMDX:function(){return e3},useClipboard:function(){return eC},useMdxChunker:function(){return e8}});var s=r(57437),n=r(5520),a=r(5315),o=r(59279),i=r(91052),l=r(91186),d=r(73220),c=r(48992),u=r(24016),m=r(3849),x=r(55820),f=r(34446),h=r(14950),p=r(16463),g=r(2265),v=r(54605),j=r(84194),y=r(58861);let b=e=>{let{className:t}=e;return(0,s.jsx)("div",{className:"flex size-5 items-center justify-center rounded-md border border-yellow-900 bg-yellow-800 p-0.5 ".concat(t),children:(0,s.jsx)(v.Z,{size:20,strokeWidth:2,className:"text-yellow-400"})})},w=()=>(0,s.jsx)("div",{className:"flex size-5 items-center justify-center rounded-md border border-yellow-900 bg-yellow-800 p-0.5",children:(0,s.jsx)(j.Z,{size:20,strokeWidth:2,className:"text-yellow-400"})}),N=()=>(0,s.jsx)(y.Z,{size:20,strokeWidth:2,className:"text-muted-foreground"}),k=()=>(0,s.jsx)("div",{className:"flex-inline flex h-5 items-center justify-center gap-1 rounded-md bg-emerald-500/20 p-0.5 px-1 font-mono text-xs font-medium text-emerald-600",children:"Own Key"}),C=[{label:"Deep Research",description:"In depth research on complex topic",value:a.jE.Deep,icon:(0,s.jsx)(i.Z,{size:16,className:"text-muted-foreground",strokeWidth:2})},{label:"Pro Search",description:"Pro search with web search",value:a.jE.Pro,icon:(0,s.jsx)(l.Z,{size:16,className:"text-muted-foreground",strokeWidth:2})}],S=[{label:"GPT 4.1",value:a.jE.GPT_4_1,icon:void 0},{label:"GPT 4.1 Mini",value:a.jE.GPT_4_1_Mini,icon:void 0},{label:"GPT 4.1 Nano",value:a.jE.GPT_4_1_Nano,icon:void 0},{label:"GPT 4o Mini",value:a.jE.GPT_4o_Mini,icon:void 0},{label:"O4 Mini",value:a.jE.O4_Mini,icon:void 0}],I=[{label:"Claude 3.7 Sonnet",value:a.jE.CLAUDE_3_7_SONNET,icon:void 0},{label:"Claude 3.5 Sonnet",value:a.jE.CLAUDE_3_5_SONNET,icon:void 0}],T=[{label:"Gemini 2 Flash",value:a.jE.GEMINI_2_FLASH,icon:void 0}],E=[...S,...I,...T],A=()=>(0,s.jsx)(o.zx,{size:"icon",tooltip:"Attachment (coming soon)",variant:"ghost",className:"gap-2",rounded:"full",disabled:!0,children:(0,s.jsx)(d.Z,{size:18,strokeWidth:2,className:"text-muted-foreground"})}),z=()=>{var e;let t=(0,n.aK)(e=>e.chatMode),r=(0,n.aK)(e=>e.setChatMode),[a,i]=(0,g.useState)(!1);(0,n.Vi)(e=>e.hasApiKeyForChatMode);let l=null!==(e=(0,p.usePathname)().startsWith("/chat")?[...C,...E].find(e=>e.value===t):[...E].find(e=>e.value===t))&&void 0!==e?e:E[0];return(0,s.jsxs)(o.h_,{open:a,onOpenChange:i,children:[(0,s.jsx)(o.$F,{asChild:!0,children:(0,s.jsxs)(o.zx,{variant:"secondary",size:"xs",children:[null==l?void 0:l.icon,null==l?void 0:l.label,(0,s.jsx)(c.Z,{size:14,strokeWidth:2})]})}),(0,s.jsx)(P,{chatMode:t,setChatMode:r})]})},D=()=>{var e;let t=(0,n.aK)(e=>e.useWebSearch),r=(0,n.aK)(e=>e.setUseWebSearch),i=(0,n.aK)(e=>e.chatMode),l=(0,n.Vi)(e=>e.hasApiKeyForChatMode),[d,c]=(0,g.useState)(!1);return((0,g.useEffect)(()=>
1{l(i).then(c)},[i,l]),(null===(e=a.UJ[i])||void 0===e?void 0:e.webSearch)||d)?(0,s.jsxs)(o.zx,{size:t?"sm":"icon-sm",tooltip:"Web Search",variant:t?"secondary":"ghost",className:(0,o.cn)("gap-2",t&&"bg-blue-500/10 text-blue-500"),onClick:()=>r(!t),children:[(0,s.jsx)(u.Z,{size:16,strokeWidth:2,className:(0,o.cn)(t?"!text-blue-500":"text-muted-foreground")}),t&&(0,s.jsx)("p",{className:"text-xs",children:"Web"})]}):null},R=()=>{let e=(0,n.aK)(e=>e.editor);return(null==e?void 0:e.getText())?(0,s.jsxs)("p",{className:"flex flex-row items-center gap-1 text-xs text-gray-500",children:["use ",(0,s.jsx)(o.Tz,{children:"Shift"})," ",(0,s.jsx)(o.Tz,{children:"Enter"})," for new line"]}):null},M=()=>(0,s.jsxs)("div",{className:"text-muted-foreground flex flex-row items-center gap-1 px-2 text-xs",children:[(0,s.jsx)(tT.t_,{})," Generating..."]}),P=e=>{let{chatMode:t,setChatMode:r,isRetry:i=!1}=e,l=(0,n.Vi)(e=>e.hasApiKeyForChatMode),d=(0,p.usePathname)().startsWith("/chat"),{push:c}=(0,p.useRouter)(),[u,m]=(0,g.useState)({});return(0,g.useEffect)(()=>{(async()=>{let e={};for(let t of E)e[t.value]=await l(t.value);m(e)})()},[l]),(0,s.jsxs)(o.AW,{align:"start",side:"bottom",className:"no-scrollbar max-h-[300px] w-[300px] overflow-y-auto",children:[d&&(0,s.jsxs)(o.Qk,{children:[(0,s.jsx)(o.Ju,{children:"Advanced Mode"}),C.map(e=>(0,s.jsx)(o.Xi,{onSelect:()=>{var t;if(null===(t=a.UJ[e.value])||void 0===t?void 0:t.isAuthRequired){c("/sign-in");return}r(e.value)},className:"h-auto",children:(0,s.jsxs)("div",{className:"flex w-full flex-row items-start gap-1.5 px-1.5 py-1.5",children:[(0,s.jsx)("div",{className:"flex flex-col gap-0 pt-1",children:e.icon}),(0,s.jsxs)("div",{className:"flex flex-col gap-0",children:[(0,s.jsx)("p",{className:"m-0 text-sm font-medium",children:e.label}),e.description&&(0,s.jsx)("p",{className:"text-muted-foreground text-xs font-light",children:e.description})]}),(0,s.jsx)("div",{className:"flex-1"})]})},e.label))]}),(0,s.jsxs)(o.Qk,{children:[(0,s.jsx)(o.Ju,{children:"OpenAI"}),S.map(e=>(0,s.jsx)(o.Xi,{onSelect:()=>{var t;if(null===(t=a.UJ[e.value])||void 0===t?void 0:t.isAuthRequired){c("/sign-in");return}r(e.value)},className:"h-auto",children:(0,s.jsxs)("div",{className:"flex w-full flex-row items-center gap-2.5 px-1.5 py-1.5",children:[(0,s.jsx)("div",{className:"flex flex-col gap-0",children:(0,s.jsx)("p",{className:"text-sm font-medium",children:e.label})}),(0,s.jsx)("div",{className:"flex-1"}),u[e.value]&&(0,s.jsx)(k,{})]})},e.label))]}),(0,s.jsxs)(o.Qk,{children:[(0,s.jsx)(o.Ju,{children:"Anthropic"}),I.map(e=>(0,s.jsx)(o.Xi,{onSelect:()=>{var t;if(null===(t=a.UJ[e.value])||void 0===t?void 0:t.isAuthRequired){c("/sign-in");return}r(e.value)},className:"h-auto",children:(0,s.jsxs)("div",{className:"flex w-full flex-row items-center gap-2.5 px-1.5 py-1.5",children:[(0,s.jsx)("div",{className:"flex flex-col gap-0",children:(0,s.jsx)("p",{className:"text-sm font-medium",children:e.label})}),(0,s.jsx)("div",{className:"flex-1"}),u[e.value]&&(0,s.jsx)(k,{})]})},e.label))]}),(0,s.jsxs)(o.Qk,{children:[(0,s.jsx)(o.Ju,{children:"Google Gemini"}),T.map(e=>(0,s.jsx)(o.Xi,{onSelect:()=>{var t;if(null===(t=a.UJ[e.value])||void 0===t?void 0:t.isAuthRequired){c("/sign-in");return}r(e.value)},className:"h-auto",children:(0,s.jsxs)("div",{className:"flex w-full flex-row items-center gap-2.5 px-1.5 py-1.5",children:[(0,s.jsx)("div",{className:"flex flex-col gap-0",children:(0,s.jsx)("p",{className:"text-sm font-medium",children:e.label})}),(0,s.jsx)("div",{className:"flex-1"}),u[e.value]&&(0,s.jsx)(k,{})]})},e.label))]})]})},_=e=>{let{isGenerating:t,isChatPage:r,stopGeneration:n,hasTextInput:a,sendMessage:i}=e;return(0,s.jsx)("div",{className:"flex flex-row items-center gap-2",children:(0,s.jsx)(f.M,{mode:"wait",initial:!1,children:t&&!r?(0,s.jsx)(h.E.div,{initial:{scale:.8,opacity:0}
1,animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},transition:{duration:.2},children:(0,s.jsx)(o.zx,{size:"icon-sm",variant:"default",onClick:n,tooltip:"Stop Generation",children:(0,s.jsx)(m.Z,{size:14,strokeWidth:2})})},"stop-button"):(0,s.jsx)(h.E.div,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},transition:{duration:.2},children:(0,s.jsx)(o.zx,{size:"icon-sm",tooltip:"Send Message",variant:a?"default":"secondary",disabled:!a||t,onClick:()=>{i()},children:(0,s.jsx)(x.Z,{size:16,strokeWidth:2})})},"send-button")})})};var O=r(23705);let W=e=>{let{sendMessage:t,editor:r,placeholder:a,maxHeight:i="200px",className:l}=e,d=(0,n.aK)(e=>e.isGenerating);return r?(0,s.jsx)(o.kC,{className:"flex-1",children:(0,s.jsx)(O.kg,{editor:r,autoFocus:!0,style:{maxHeight:i},disabled:d,onKeyDown:e=>{!d&&("Enter"!==e.key||e.shiftKey||null==t||t(r.getText()),"Enter"===e.key&&e.shiftKey&&(e.preventDefault(),e.currentTarget.scrollTop=e.currentTarget.scrollHeight))},className:(0,o.cn)("no-scrollbar [&>*]:no-scrollbar wysiwyg min-h-[60px] w-full cursor-text overflow-y-auto p-1 text-base outline-none focus:outline-none [&>*]:leading-6 [&>*]:outline-none [&>*]:break-all [&>*]:word-break-break-word [&>*]:whitespace-pre-wrap",l)})}):null};var G=r(87138);let U=()=>(0,s.jsx)(o.kC,{className:"w-full p-2",justify:"center",gap:"xs",children:(0,s.jsxs)("p",{className:"text-xs opacity-50",children:["LLMTalk is open source and your data is stored locally. project by"," ",(0,s.jsx)(G.default,{href:"https://trendy.design",target:"_blank",className:"text-primary decoration-primary inline-block underline underline-offset-2",children:"trendy.design"})]})});var L=r(74697),K=r(66648);let Z=()=>{let e=(0,n.aK)(e=>e.imageAttachment),t=(0,n.aK)(e=>e.clearImageAttachment);return(null==e?void 0:e.base64)?(0,s.jsx)(o.kC,{className:"pl-2 pr-2 pt-2 md:pl-3",gap:"sm",children:(0,s.jsxs)("div",{className:"relative h-[40px] w-[40px] rounded-lg border border-black/10 shadow-sm dark:border-white/10",children:[(0,s.jsx)(K.default,{src:e.base64,alt:"uploaded image",className:"h-full w-full overflow-hidden rounded-lg object-cover",width:0,height:0}),(0,s.jsx)(o.zx,{size:"icon-xs",variant:"default",onClick:t,className:"absolute right-[-4px] top-[-4px] z-10 h-4 w-4 flex-shrink-0",children:(0,s.jsx)(L.Z,{size:12,strokeWidth:2})})]})}):null};var F=r(5074);let B=e=>{let{dropzonProps:t}=e;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("input",{...t.getInputProps()}),t.isDragActive&&(0,s.jsxs)(o.kC,{className:"bg-secondary/90 absolute inset-0 z-10 overflow-hidden rounded-lg",items:"center",justify:"center",gap:"sm",children:[(0,s.jsx)(F.Z,{size:16,className:"text-muted-foreground"}),(0,s.jsx)("p",{className:"text-muted-foreground text-sm",children:"Drag and drop an image here, or click to select an image"})]})]})},q=e=>{let{children:t,dropzoneProps:r}=e;return(0,s.jsxs)("div",{className:"relative flex w-full flex-col items-start gap-0",...r.getRootProps(),children:[t,(0,s.jsx)(B,{dropzonProps:r})]})},V=e=>{var t;let{id:r,label:i,tooltip:l,showIcon:c,handleImageUpload:u}=e,m=(0,n.aK)(e=>e.chatMode),x=()=>{var e;null===(e=document.getElementById(r))||void 0===e||e.click()};return(null===(t=a.UJ[m])||void 0===t?void 0:t.imageUpload)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("input",{type:"file",id:r,className:"hidden",onChange:u}),(0,s.jsx)(o.u,{content:l,children:c?(0,s.jsx)(o.zx,{variant:"ghost",size:"icon-sm",onClick:x,children:(0,s.jsx)(d.Z,{size:16,strokeWidth:2})}):(0,s.jsx)(o.zx,{variant:"bordered",onClick:x,children:i})})]}):null};var Y=r(94218),H=r(28590),J=r(72039),Q=r(68636),X=r(83898),$=r(54238),ee=r(50875),et=r(27997),er=r(30643),es=r(74369);let en={howTo:["How to plan a sustainable vegetable garden for small spaces?","How to prepare for your first international travel experience?","How to set up a personal budget that actually works?","How to improve your public speaking skills for professional settings?"],explainConcepts:["Explain how blockchain technology works in simple terms.","What is quantum computing and how does it differ from traditional computing?","Explain the concept of emotional intelligence and its importance.","How does carbon capture technology work to combat climate change?"],creative:["Write a short story about a chance encounter that changes someone's life.","Create a recipe for a fusion dish combining Italian and Japanese cuisines.","Design a fictional sustainable city of the future.","Develop a character profile for the protagonist of a science fiction novel."],advice:["What's the best approach to negotiate a salary increase?","How should I prepare for a marathon as a beginner runner?","What strategies can help manage work-life balance when working remotely?","What should I consider when adopting a pet for the first time?"],analysis:["Analyze the potential impact of artificial intelligence on healthcare.","Compare different approaches to addressing climate change.","Examine the pros and cons of various renewable energy sources.","Analyze how social media has transformed communication in the past decade."]},ea=e=>{if(e&&en[e]){let t=en[e];return t[Math.floor(Math.random()*t.length)]}let t=Object.keys(en),r=en[t[Math.floor(Math.random()*t.length)]];return r[Math.floor(Math.random()*r.length)]},eo={howTo:{name:"How to",icon:$.Z,color:"!text-yellow-700"},explainConcepts:{name:"Explain Concepts",icon:ee.Z,color:"!text-blue-700"},creative:{name:"Creative",icon:et.Z,color:"!text-green-700"},advice:{name:"Advice",icon:er.Z,color:"!text-purple-700"},analysis:{name:"Analysis",icon:es.Z,color:"!text-red-700"}},ei=()=>{let e=(0,n.aK)(e=>e.editor),t=t=>{if(console.log("editor",e),!e)return;let r=ea(t);e.commands.clearContent(),e.commands.insertContent(r)};return e?(0,s.jsx)("div",{className:"animate-fade-in mb-8 flex w-full flex-wrap justify-center gap-2 p-6 duration-[1000ms]",children:Object.entries(eo).map((e,r)=>
1{let[n,a]=e;return(0,s.jsxs)(o.zx,{variant:"bordered",rounded:"full",size:"sm",onClick:()=>t(n),children:[(0,s.jsx)(a.icon,{size:16,className:"text-muted-foreground/50"}),a.name]},r)})}):null},el=e=>{let{showGreeting:t=!0,showBottomBar:r=!0,isFollowUp:i=!1}=e,{threadId:l}=(0,p.useParams)(),{editor:d}=(0,X.e)({placeholder:i?"Ask follow up":"Ask anything",onInit:e=>{let{editor:t}=e;if(!i){let e=window.localStorage.getItem("draft-message");e&&t.commands.setContent(e,!0,{preserveWhitespace:!0})}},onUpdate:e=>{let{editor:t}=e;i||window.localStorage.setItem("draft-message",t.getText())}}),c=l?"base":"sm",u=(0,n.aK)(e=>e.getThreadItems),m=(0,n.aK)((0,J.N)(e=>e.threadItems.length)),{handleSubmit:x}=(0,Q.E)(),v=(0,n.aK)(e=>e.createThread),j=(0,n.aK)(e=>e.useWebSearch),y=(0,n.aK)(e=>e.isGenerating),b=(0,p.usePathname)().startsWith("/chat"),w=(0,n.aK)(e=>e.imageAttachment),N=(0,n.aK)(e=>e.clearImageAttachment),k=(0,n.aK)(e=>e.stopGeneration),C=!!(null==d?void 0:d.getText()),{dropzonProps:S,handleImageUpload:I}=(0,Y.m0)(),{push:T}=(0,p.useRouter)(),E=(0,n.aK)(e=>e.chatMode),A=async()=>{var e;if(null===(e=a.UJ[E])||void 0===e?void 0:e.isAuthRequired){T("/sign-in");return}if(!(null==d?void 0:d.getText()))return;let t=null==l?void 0:l.toString();if(!t){let e=(0,H.Z)();T("/chat/".concat(e)),v(e,{title:null==d?void 0:d.getText()}),t=e}let r=new FormData;r.append("query",d.getText()),(null==w?void 0:w.base64)&&r.append("imageAttachment",null==w?void 0:w.base64);let s=l?await u(l.toString()):[];console.log("threadItems",s),x({formData:r,newThreadId:t,messages:s.sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime()),useWebSearch:j}),window.localStorage.removeItem("draft-message"),d.commands.clearContent(),N()};return(0,g.useEffect)(()=>{null==d||d.commands.focus("end")},[l]),(0,s.jsx)("div",{className:(0,o.cn)("bg-secondary w-full",l?"absolute bottom-0":"absolute inset-0 flex h-full w-full flex-col items-center justify-center"),children:(0,s.jsx)("div",{className:(0,o.cn)("mx-auto flex w-full max-w-3xl flex-col items-start",!m&&"justify-start","sm"===c&&"px-8"),children:(0,s.jsxs)(o.kC,{items:"start",justify:"start",direction:"col",className:(0,o.cn)("w-full pb-4",m>0?"mb-0":"h-full"),children:[!l&&t&&(0,s.jsx)(h.E.div,{initial:{opacity:0}
1,animate:{opacity:1},transition:{duration:.3,ease:"easeOut"},className:"mb-4 flex w-full flex-col items-center gap-1",children:(0,s.jsx)(ed,{})}),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o.kC,{items:"center",justify:"center",gap:"sm"}),(0,s.jsx)(f.M,{children:(0,s.jsx)(h.E.div,{className:"w-full px-3",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:(0,s.jsx)(o.kC,{direction:"col",className:(0,o.cn)("bg-background border-border-strong/50 shadow-subtle-sm relative z-10 w-full rounded-xl border"),children:(0,s.jsx)(q,{dropzoneProps:S,children:(0,s.jsx)(h.E.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.15},className:"flex w-full flex-shrink-0 overflow-hidden rounded-lg",children:(null==d?void 0:d.isEditable)?(0,s.jsxs)(h.E.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.15,ease:"easeOut"},className:"w-full",children:[(0,s.jsx)(Z,{}),(0,s.jsx)(o.kC,{className:"flex w-full flex-row items-end gap-0",children:(0,s.jsx)(W,{sendMessage:A,editor:d,className:"px-3 pt-3"})}),(0,s.jsxs)(o.kC,{className:"border-border w-full gap-0 border-t border-dashed px-2 py-2",gap:"none",items:"center",justify:"between",children:[y&&!b?(0,s.jsx)(M,{}):(0,s.jsxs)(o.kC,{gap:"xs",items:"center",className:"shrink-0",children:[(0,s.jsx)(z,{}),(0,s.jsx)(D,{}),(0,s.jsx)(V,{id:"image-attachment",label:"Image",tooltip:"Image Attachment",showIcon:!0,handleImageUpload:I})]}),(0,s.jsx)(o.kC,{gap:"md",items:"center",children:(0,s.jsx)(_,{isGenerating:y,isChatPage:b,stopGeneration:k,hasTextInput:C,sendMessage:A})})]})]}):(0,s.jsx)(h.E.div,{className:"flex h-24 w-full items-center justify-center",initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:(0,s.jsx)("div",{className:"animate-pulse",children:"Loading editor..."})})})})})},"chat-input")})]}),!l&&t&&(0,s.jsx)(ei,{})]})})})},ed=e=>{let{titles:t=[]}=e;return(0,s.jsx)(o.kC,{direction:"col",className:"relative h-[60px] w-full items-center justify-center overflow-hidden",children:(0,s.jsx)(h.E.h1,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},transition:{duration:.8,ease:"easeInOut"},className:"from-muted-foreground/50 via-muted-foreground/40 to-muted-foreground/20 bg-gradient-to-r bg-clip-text text-center text-[32px] font-semibold tracking-tight text-transparent",children:"What would you like to explore?"})})};var ec=r(87938);let eu=()=>{let e=(0,n.aK)(e=>e.context),t=(0,n.aK)(e=>e.setContext);return e?(0,s.jsxs)("div",{className:"border-border bg-secondary text-foreground flex w-full flex-row items-start justify-start gap-2 rounded-lg border py-2 pl-2 pr-2 md:w-[640px] lg:w-[700px]",children:[(0,s.jsx)(ec.Z,{size:16,strokeWidth:2,className:"text-muted-foreground mt-1"}),(0,s.jsx)("p",{className:"ml-2 line-clamp-2 w-full overflow-hidden text-sm",children:e}),(0,s.jsx)(o.zx,{size:"icon-xs",variant:"ghost",onClick:()=>{t("")},iconSize:"sm",className:"text-muted-foreground hover:bg-muted ml-4 flex-shrink-0"})]}):null};var em=r(32618),ex=r.n(em);r(90567),r(13626),r(76432),r(79683),r(78544),r(82291),r(36914),r(6213);var ef=r(60209),eh=r(32931),ep=r(72018),eg=r(95475),ev=r(33024),ej=r(25348),ey=r(30026),eb=r(83759),ew=r(29056),eN=r(54545);r(13041);let ek=e=>{let{lang:t="plaintext",code:r,showHeader:n=!0,variant:a="default",maxHeight:i=400,className:l}=e,d=(0,g.useRef)(null),c=(0,g.useRef)(null),{copy:u,showCopied:m}=eC();return(0,g.useEffect)(()=>{(null==d?void 0:d.current)&&r&&ex().highlightElement(d.current)},[r,t]),(0,s.jsxs)("div",{className:(0,o.cn)("not-prose bg-surface  relative my-4 w-full overflow-hidden rounded-xl border px-1 pb-1","secondary"===a&&"bg-secondary",l,!n&&"rounded-none border-none bg-transparent p-0"),children:[n&&(0,s.jsxs)("div",{className:"text-foreground flex items-center justify-between py-1 pl-3 pr-1",children:[(0,s.jsxs)("p",{className:"text-muted-foreground flex flex-row items-center gap-2 text-xs tracking-wide",children:[(()=>{switch(t){case"bash":return(0,s.jsx)(ef.Z,{size:14});case"json":case"yaml":return(0,s.jsx)(eh.Z,{size:14});case"python":return(0,s.jsx)(ep.Z,{size:14});case"javascript":return(0,s.jsx)(eg.Z,{size:14});case"typescript":return(0,s.jsx)(ev.Z,{size:14});case"jsx":return(0,s.jsx)(ej.Z,{size:14});case"markdown":return(0,s.jsx)(ey.Z,{size:14});default:return(0,s.jsx)(eb.Z,{size:14})}})(),t]}),(0,s.jsx)(o.zx,{variant:"ghost",size:"xs",className:"gap-2",onClick:()=>r&&u(r),children:m?(0,s.jsx)(ew.Z,{size:14,strokeWidth:"2"}):(0,s.jsx)(eN.Z,{size:14,strokeWidth:"2"})})]}),(0,s.jsx)("pre",{ref:c,className:(0,o.cn)("text-foreground border-border bg-background no-scrollbar relative overflow-x-auto rounded-lg border px-6 py-4 font-mono text-[13px] font-[300]"),children:(0,s.jsx)("code",{className:(0,o.cn)("language-".concat(t)),ref:d,children:r})})]})};function eC(){let[e,t]=(0,g.useState)(null),[r,s]=(0,g.useState)(!1);return{copiedText:e,copy:(0,g.useCallback)(async e=>{var r;if(!(null===(r=navigator)||void 0===r?void 0:r.clipboard))return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(e),t(e),s(!0),setTimeout(()=>{s(!1)},2e3),!0}catch(e){return console.warn("Copy failed",e),t(null),!1}},[]),showCopied:r}}r(69334);var eS=r(51477),eI=r(65251),eT=r(86366),eE=r(67535),eA=r(99987),ez=r(73519),eD=r(19212),eR=r.n(eD),eM=r(79512);let eP=()=>{let{threadId:e}=(0,p.useParams)(),{isCommandSearchOpen:t,setIsCommandSearchOpen:r}=(0,eS.useRootContext)(),a=(0,n.aK)(e=>e.threads),i=(0,n.aK)(e=>e.getThread),l=(0,n.aK)(e=>e.deleteThread),d=(0,n.aK)(e=>e.switchThread),c=(0,p.useRouter)(),{theme:u,setTheme:m}=(0,eM.F)(),x=(0,n.aK)(e=>e.clearAllThreads),f=(0,n.qr)(e=>e.setIsSettingsOpen),h=(0,n.qr)(e=>e.setSettingTab),v={today:[],yesterday:[],last7Days:[],last30Days:[],previousMonths:[]},j={today:"Today",yesterday:"Yesterday",last7Days:"Last 7 Days",last30Days:"Last 30 Days",previousMonths:"Previous Months"};
1a.forEach(e=>{let t=eR()(e.createdAt),r=eR()();t.isSame(r,"day")?v.today.push(e):t.isSame(r.clone().subtract(1,"day"),"day")?v.yesterday.push(e):t.isAfter(r.clone().subtract(7,"days"))?v.last7Days.push(e):t.isAfter(r.clone().subtract(30,"days"))?v.last30Days.push(e):v.previousMonths.push(e)}),(0,g.useEffect)(()=>{c.prefetch("/chat")},[t,a,c]),(0,g.useEffect)(()=>{},[t]);let y=()=>r(!1);(0,g.useEffect)(()=>{let e=e=>{"t"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),r(!0))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]);let b=[{name:"New Thread",icon:eI.Z,action:()=>{c.push("/chat"),y()}},{name:"Delete Thread",icon:eT.Z,action:async()=>{let t=await i(e);t&&(l(t.id),c.push("/chat"),y())}},{name:"Use your own API key",icon:eE.Z,action:()=>{f(!0),h("api-keys"),y()}},{name:"Remove All Threads",icon:eT.Z,action:()=>{x(),c.push("/chat"),y()}}];return(0,s.jsxs)(o.m5,{open:t,onOpenChange:r,children:[(0,s.jsxs)("div",{className:"flex w-full flex-row items-center gap-2 p-0.5",children:[(0,s.jsx)(o.sZ,{placeholder:"Search...",className:"w-full"}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-1 px-2",children:[(0,s.jsx)(o.Tz,{className:"h-5 w-5",children:(0,s.jsx)(eA.Z,{size:12,strokeWidth:2,className:"shrink-0"})}),(0,s.jsx)(o.Tz,{className:"h-5 w-5",children:"T"})]})]}),(0,s.jsx)("div",{className:"w-full",children:(0,s.jsx)("div",{className:"border-border h-[1px] w-full border-b"})}),(0,s.jsxs)(o.e8,{className:"max-h-[420px] overflow-y-auto p-0.5 pt-1.5",children:[(0,s.jsx)(o.rb,{children:"No results found."}),(0,s.jsx)(o.fu,{children:b.map(e=>(0,s.jsxs)(o.di,{className:"gap-",value:e.name,onSelect:e.action,children:[(0,s.jsx)(e.icon,{size:14,strokeWidth:"2",className:"text-muted-foreground flex-shrink-0"}),e.name]},e.name))}),Object.entries(v).map(e=>{let[t,r]=e;return r.length>0&&(0,s.jsx)(o.fu,{heading:j[t],children:r.map(e=>(0,s.jsxs)(o.di,{value:"".concat(e.id,"/").concat(e.title),className:(0,o.cn)("w-full gap-3"),onSelect:()=>{d(e.id),c.push("/chat/".concat(e.id)),y()},children:[(0,s.jsx)(ez.Z,{size:16,strokeWidth:2,className:"text-muted-foreground/50"}),(0,s.jsx)("span",{className:"w-full truncate font-normal",children:e.title})]},e.id))},t)})]})]})};class e_ extends g.Component{static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.props.onError&&this.props.onError(e,t)}render(){if(this.state.hasError){var e;return this.props.fallback?this.props.fallback:(0,s.jsxs)("div",{className:"error-boundary-fallback",children:[(0,s.jsx)("h2",{children:"Something went wrong"}),(0,s.jsxs)("details",{children:[(0,s.jsx)("summary",{children:"Error details"}),(0,s.jsx)("pre",{children:null===(e=this.state.error)||void 0===e?void 0:e.toString()})]})]})}return this.props.children}constructor(e){super(e),this.state={hasError:!1,error:null}}}let eO=()=>(0,s.jsx)("div",{className:"border-border flex w-full flex-col items-center justify-center rounded-lg border border-dashed p-4",children:(0,s.jsx)("div",{className:"text-muted-foreground/70 text-sm",children:"Sorry, something went wrong. Please try again."})});r(59192);var eW=r(22966);r(32978);let eG=()=>{let[e,t]=(0,g.useState)(!1),[r,s]=(0,g.useState)(""),[n,a]=(0,g.useState)(!1),[o,i]=(0,g.useState)(!1);return(0,g.useRef)(null),null},eU=()=>(0,s.jsx)("div",{className:"flex w-full flex-row items-center justify-center gap-4 p-3"}),eL=e=>{let{label:t}=e;return(0,s.jsxs)("div",{className:"z-20 flex min-h-[90vh] w-full flex-1 flex-col items-center justify-center gap-1",children:[(0,s.jsx)(o.$j,{}),t&&(0,s.jsx)(o.Dy,{size:"xs",textColor:"secondary",children:t})]})};var eK=r(63550);let eZ=e=>{let{thread:t,dismiss:r,isActive:a}=e,{push:i}=(0,p.useRouter)(),{threadId:l}=(0,p.useParams)(),d=(0,n.aK)(e=>e.updateThread),[c,u]=(0,g.useState)(!1),[m,x]=(0,g.useState)(t.title),f=(0,n.aK)(e=>e.deleteThread),h=(0,g.useRef)(null),v=(0,n.aK)(e=>e.switchThread),[j,y]=(0,g.useState)(!1);(0,g.useEffect)(()=>{if(c){var e;null===(e=h.current)||void 0===e||e.focus()}},[c]);let b=(0,o.cn)("gap-2 w-full group w-full relative flex flex-row items-center h-7 py-0.5 pl-2 pr-1 rounded-sm hover:bg-surface-hover",a||c?"bg-surface":""),w=()=>{u(!0),setTimeout(()=>{var e;null===(e=h.current)||void 0===e||e.focus()},500)},N=()=>{f(t.id),l===t.id&&i("/chat")};return(0,s.jsxs)("div",{className:b,children:[c?(0,s.jsx)(o.II,{variant:"ghost",className:"h-5 pl-0 text-xs",ref:h,value:m||"Untitled",onChange:e=>{x(e.target.value)},onKeyDown:e=>{"Enter"===e.key&&(u(!1),d({id:t.id,title:(null==m?void 0:m.trim())||"Untitled"}))},onBlur:()=>{u(!1),d({id:t.id,title:(null==m?void 0:m.trim())||"Untitled"})}}):(0,s.jsx)(G.default,{href:"/chat/".concat(t.id),className:"flex flex-1 items-center",onClick:()=>v(t.id),children:(0,s.jsx)(o.kC,{direction:"col",items:"start",className:"flex-1 overflow-hidden",gap:"none",children:(0,s.jsx)("p",{className:"hover:text-foreground line-clamp-1 w-full text-xs",children:t.title})})}),(0,s.jsxs)(o.h_,{open:j,onOpenChange:y,children:[(0,s.jsx)(o.$F,{asChild:!0,children:(0,s.jsx)(o.zx,{variant:"ghost",size:"icon-xs",className:"bg-surface-hover invisible absolute right-1 shrink-0 group-hover:visible group-hover:w-6",onClick:e=>{e.stopPropagation(),y(!j)},children:(0,s.jsx)(eK.Z,{size:14,strokeWidth:"2",className:"text-muted-foreground
1/50"})})}),(0,s.jsxs)(o.AW,{align:"end",side:"right",children:[(0,s.jsx)(o.Xi,{onClick:e=>{e.stopPropagation(),w()},children:"Rename"}),(0,s.jsx)(o.Xi,{onClick:e=>{e.stopPropagation(),N()},children:"Delete Chat"})]})]})]},t.id)};var eF=r(13951),eB=r(40716),eq=r(37213);let eV=e=>{let{children:t}=e,{isSidebarOpen:r,isMobileSidebarOpen:a,setIsMobileSidebarOpen:i}=(0,eS.useRootContext)();return(0,n.qr)(e=>e.setIsSettingsOpen),"/design-system"===(0,p.usePathname)()?(0,s.jsxs)("div",{className:"bg-background flex h-[100dvh] w-full flex-col overflow-hidden",children:[(0,s.jsx)(tz,{}),(0,s.jsx)("div",{className:"flex flex-1 overflow-hidden pt-14",children:(0,s.jsx)("div",{className:"flex w-full overflow-y-auto",children:t})}),(0,s.jsx)(tm,{}),(0,s.jsx)(eP,{}),(0,s.jsx)(o.x7,{}),(0,s.jsx)(o.x_,{})]}):(0,s.jsxs)("div",{className:"bg-surface flex h-[100dvh] w-full flex-col overflow-hidden",children:[(0,s.jsx)(tz,{}),(0,s.jsx)("div",{className:"bg-surface item-center fixed inset-0 z-[99999] flex justify-center md:hidden",children:(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2",children:[(0,s.jsx)(eF.Z,{size:24,strokeWidth:2,className:"text-muted-foreground"}),(0,s.jsxs)("span",{className:"text-muted-foreground text-center text-sm",children:["Mobile version is coming soon.",(0,s.jsx)("br",{})," Please use a desktop browser."]})]})}),(0,s.jsxs)("div",{className:"bg-surface flex flex-1 flex-row overflow-hidden pt-14",children:[(0,s.jsx)(o.kC,{className:"hidden lg:flex",children:(0,s.jsx)(f.M,{children:r&&(0,s.jsx)(ty,{})})}),(0,s.jsx)(eq.Drawer.Root,{open:a,direction:"left",shouldScaleBackground:!0,onOpenChange:i,children:(0,s.jsxs)(eq.Drawer.Portal,{children:[(0,s.jsx)(eq.Drawer.Overlay,{className:"fixed inset-0 z-30 backdrop-blur-sm"}),(0,s.jsx)(eq.Drawer.Content,{className:"fixed bottom-0 left-0 top-0 z-[50]",children:(0,s.jsx)(o.kC,{className:"pr-2",children:(0,s.jsx)(ty,{})})})]})}),(0,s.jsxs)(o.kC,{className:"flex-1 overflow-hidden",children:[(0,s.jsx)(h.E.div,{className:"flex w-full py-1 pr-1",children:(0,s.jsx)(Y.zl,{children:(0,s.jsxs)("div",{className:"relative flex flex-1 flex-row h-[calc(100dvh-3.5rem)] border border-border rounded-sm bg-secondary w-full overflow-hidden shadow-sm",children:[(0,s.jsx)("div",{className:"relative flex h-full w-0 flex-1 flex-row",children:(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2 overflow-y-auto",children:[(0,s.jsx)("div",{className:"from-secondary to-secondary/0 via-secondary/70 absolute left-0 right-0 top-0 z-40 flex flex-row items-center justify-center gap-1 bg-gradient-to-b p-2 pb-12"}),t]})}),(0,s.jsx)(eY,{}),(0,s.jsx)(eG,{})]})})}),(0,s.jsx)(tm,{}),(0,s.jsx)(eP,{})]})]}),(0,s.jsx)(o.x7,{}),(0,s.jsx)(o.x_,{})]})},eY=()=>{let e=(0,p.usePathname)(),t=(0,n.qr)(e=>e.sideDrawer),r=(0,n.qr)(e=>e.dismissSideDrawer),{scrollRef:a,contentRef:i}=(0,eB.W)({stiffness:1,damping:0}),l=e.startsWith("/chat/");return(0,s.jsx)(f.M,{children:t.open&&l&&(0,s.jsx)(h.E.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:40},transition:{type:"spring",stiffness:300,damping:30,exit:{duration:.2}},className:"flex min-h-[99dvh] w-[500px] shrink-0 flex-col overflow-hidden py-1.5 pl-0.5 pr-1.5",children:(0,s.jsxs)("div",{className:"bg-background border-border shadow-subtle-xs flex h-full w-full flex-col overflow-hidden rounded-lg",children:[(0,s.jsxs)("div",{className:"border-border flex flex-row items-center justify-between gap-2 border-b py-1.5 pl-4 pr-2",children:[(0,s.jsx)("div",{className:"text-sm font-medium",children:"function"==typeof t.title?t.title():t.title}),t.badge&&(0,s.jsx)(o.Ct,{variant:"default",children:t.badge}),(0,s.jsx)("div",{className:"flex-1"}),(0,s.jsx)(o.zx,{variant:"secondary",size:"icon-xs",onClick:()=>r(),tooltip:"Close",children:(0,s.jsx)(eW.Z,{size:14,strokeWidth:2})})]}),(0,s.jsx)("div",{className:"no-scrollbar flex flex-1 flex-col gap-2 overflow-y-auto p-2",ref:a,children:(0,s.jsx)("div",{ref:i,className:"w-full",children:t.renderContent()})})]})})})};var eH=r(4436);let eJ=e=>{let{size:t,className:r}=e;return(0,s.jsx)(eH.Z,{size:"sm"===t?12:"md"===t?16:20,strokeWidth:2,className:(0,o.cn)("shrink-0 text-gray-500",r)})},eQ=e=>{let{link:t,className:r,size:n="sm"}=e,[a,i]=(0,g.useState)(!1);return a?(0,s.jsx)(eJ,{size:n,className:r}):(0,s.jsxs)("div",{className:(0,o.cn)("bg-surface relative flex shrink-0 items-center justify-center overflow-hidden rounded-full border","sm"===n&&"h-4 w-4","md"===n&&"h-5 w-5","lg"===n&&"h-8 w-8"),children:[(0,s.jsx)("div",{className:"border-foreground
1/10 absolute inset-0 z-[2] rounded-full border"}),(0,s.jsx)("img",{src:"https://www.google.com/s2/favicons?domain=".concat(t,"&sz=",128),alt:"favicon",onError:()=>i(!0),className:(0,o.cn)("absolute inset-0 h-full w-full rounded-sm object-cover",r)})]})};var eX=r(11533),e$=r(27360);let e0=(0,g.memo)(e=>{var t,r;let{source:n,children:a}=e;return(null==n?void 0:null===(r=n.link)||void 0===r?void 0:null===(t=r.trim())||void 0===t?void 0:t.length)?(0,s.jsxs)(o.zs,{openDelay:200,closeDelay:100,children:[(0,s.jsx)(o.Yi,{className:"cursor-pointer",children:a}),(0,s.jsxs)(o.rC,{className:"bg-background prose-none hover:border-border-strong group isolate z-[100] w-[400px] cursor-pointer rounded-xl p-0 shadow-2xl",onClick:e=>{e.stopPropagation(),e.preventDefault(),window.open(n.link,"_blank")},children:[(0,s.jsx)(e$.Z,{className:"text-muted-foreground group-hover:text-primary absolute right-3 top-3",size:14}),(0,s.jsx)(e1,{source:n})]})]}):null}),e1=(0,g.memo)(e=>{let{source:t}=e,[r,n]=(0,g.useState)(!1),[a,o]=(0,g.useState)(null);return(0,s.jsx)("div",{className:"not-prose ",children:(0,s.jsx)("div",{className:"flex flex-col items-start",children:(0,s.jsxs)("div",{className:"flex w-full flex-col items-start gap-1.5 p-4",children:[(0,s.jsxs)("div",{className:"flex flex-row items-center gap-1.5",children:[(0,s.jsx)(eQ,{link:t.link}),(0,s.jsx)("p",{className:"text-muted-foreground line-clamp-1 w-full font-sans text-xs",children:(0,eX.XF)(t.link)})]}),(0,s.jsx)("p",{className:"text-foreground line-clamp-2 w-full overflow-hidden font-sans text-xs font-medium leading-tight",children:t.title}),(0,s.jsx)("p",{className:"text-muted-foreground line-clamp-2 w-full font-sans text-xs",children:t.snippet})]})})})}),e2=e=>{let{className:t,...r}=e;return(0,s.jsx)("img",{src:"/assets/favicon.ico",alt:"LLMTalk Logo",className:t,...r})},e5=e=>{let{className:t,...r}=e;return(0,s.jsx)("img",{src:"/assets/favicon.ico",alt:"LLMTalk Logo",className:t,...r})},e4={Source:e=>{let{children:t}=e,{getSourceByIndex:r}=(0,g.useContext)(tT.EI),n=r(parseInt(t)),a=null==n?void 0:n.link;return a&&(0,eX.jv)(a)?(0,s.jsx)(e0,{source:n,children:(0,s.jsx)("div",{className:"bg-surface-hover text-surface-hover-foreground
1/50 hover:bg-primary group mx-0.5 inline-flex size-3.5 flex-row items-center justify-center gap-1 rounded-sm text-[10px] font-medium hover:text-white",children:null==n?void 0:n.index})}):null},p:e=>{let{children:t}=e;return(0,s.jsx)("p",{children:t})},li:e=>{let{children:t}=e;return(0,s.jsx)("li",{children:t})},pre:e=>{var t,r;let{children:n}=e;if("string"==typeof n)return(0,s.jsx)(ek,{code:n.replace(/<FadeEffect \/>$/,"")});let a=((null==n?void 0:null===(t=n.props)||void 0===t?void 0:t.className)||"").replace("language-",""),o=null==n?void 0:null===(r=n.props)||void 0===r?void 0:r.children;return(0,s.jsx)(ek,{code:String(o).replace(/<FadeEffect \/>$/,""),lang:a})},code:e=>{let{children:t,className:r}=e;if(!r)return(0,s.jsx)("code",{className:"border-primary/20 !bg-primary/10 text-primary rounded-md border px-1.5 py-0.5 font-mono text-sm",children:t});let n=r.replace("language-","");return(0,s.jsx)(ek,{code:String(t).replace(/<FadeEffect \/>$/,""),lang:n})}},e3=e=>{let t;let r=e.match(/<[^>]*$/);r&&(e=e.slice(0,r.index)),e=(e=e.replace(/><(thought|answer|Think|Source)/g,">\n<$1")).replace(/<\/(thought|answer|Think|Source)></g,"</thought>\n<");let s=/<(thought|answer|Think|Source)(\s+[^>]*)?>/g,n=/<\/(thought|answer|Think|Source)\s*>/g,a=[];for(;null!==(t=s.exec(e));)a.push(t[1]);for(;null!==(t=n.exec(e));){let e=t[1],r=a.lastIndexOf(e);-1!==r&&a.splice(r,1)}for(;a.length>0;){let t=a.pop();e+="\n\n</".concat(t,">")}return e};var e6=r(10100);function e7(e){if(!e)return[];try{let t=new e6.XMLParser().parse(e),r=new Set,s=e=>{if(e&&"object"==typeof e)for(let[t,n]of Object.entries(e))"Source"===t?Array.isArray(n)?n.forEach(e=>{r.add(e)}):r.add(n):s(n)};return s(t),Array.from(r)}catch(e){return console.error(e),[]}}var e9=r(3566);let e8=()=>{let e=(e,t)=>{if(!e.position||!e.position.start||!e.position.end)return"";let r=e.position.start.line,s=e.position.end.line;return t.slice(r-1,s).join("\n").trim()},t=(e,t)=>RegExp("<\\s*/\\s*".concat(e,"\\s*>"),"i").test(t),r=(r,s)=>{let n=e(r,s);if(!n)return null;if("list"===r.type)return r.ordered,n;if("listItem"===r.type&&r.parent){let e=r.parent,t=e.ordered?"ol":"ul",s=e.children[0]===r,a=e.children[e.children.length-1]===r;if(s&&a)return"<".concat(t,">\n").concat(n,"\n</").concat(t,">");if(s)return"<".concat(t,">\n").concat(n);if(a)return"".concat(n,"\n</").concat(t,">")}if("code"===r.type)return n;if("mdxJsxFlowElement"===r.type){let e=r.name;if(!t(e,n))return"".concat(n,"</").concat(e,">")}return n},s=(e,t)=>"listItem"===e.type&&(null==t?void 0:t.type)==="listItem"&&e.parent===t.parent;return{chunkMdx:async e=>{try{let t=(0,e9.A)({jsx:!0}),n=await t.parse(e),a=e.split("\n"),o=[],i=null;if(Array.isArray(n.children))for(let e of n.children){let t=r(e,a);t&&(i&&s(e,i)&&o.length>0?o[o.length-1]+="\n"+t:o.push(t),i=e)}return{chunks:o}}catch(e){return console.error("Failed to parse and chunk MDX:",e),{chunks:[]}}}}},te=e=>{let{className:t}=e;return(0,s.jsx)(h.E.div,{initial:{opacity:0,width:"0%"},animate:{opacity:1,width:"100%"},exit:{opacity:0,width:"0%"},transition:{duration:2,ease:"easeInOut",damping:50,stiffness:20},children:(0,s.jsx)(o.Od,{className:(0,o.cn)("from-muted-foreground/90 via-muted-foreground/60 to-muted-foreground/10 h-5 w-full rounded-sm bg-gradient-to-r",t)})})},tt=e=>{let{open:t,onOpenChange:r,onConfirm:n,title:a="Are you sure?",confirmText:i="Delete",cancelText:l="Cancel",confirmVariant:d="destructive",cancelVariant:c="ghost",children:u,additionalActions:m}=e;return(0,s.jsxs)(o.J2,{open:t,onOpenChange:r,children:[(0,s.jsx)(o.CM,{asChild:!0,children:u}),(0,s.jsxs)(o.yk,{children:[(0,s.jsx)("p",{className:"pb-2 text-sm font-medium md:text-base",children:a}),(0,s.jsxs)("div",{className:"flex flex-row gap-1",children:[(0,s.jsx)(o.zx,{variant:d,onClick:e=>{n(),e.stopPropagation()},children:i}),(0,s.jsx)(o.zx,{variant:c,onClick:e=>{r(!1),e.stopPropagation()},children:l}),m]})]})]})};var tr=r(88904);let ts=()=>{let{setIsCommandSearchOpen:e}=(0,eS.useRootContext)(),t=(0,n.aK)(e=>e.threads.slice(0,4)),r=(0,p.useRouter)();return((0,g.useEffect)(()=>{t.forEach(e=>{r.prefetch("/chat/".concat(e.id))})},[t]),0===t.length)?null:(0,s.jsxs)("div",{className:"flex w-full flex-col px-1.5",children:[(0,s.jsxs)("div",{className:"flex flex-row items-center gap-2 px-1 py-2",children:[(0,s.jsx)("p",{className:"text-muted-foreground text-sm font-medium",children:"Recent Messages"}),(0,s.jsx)("div",{className:"flex-1"}),(0,s.jsxs)(o.zx,{variant:"ghost",size:"xs",rounded:"full",className:"text-muted-foreground",onClick:()=>e(!0),children:["View all ",(0,s.jsx)(tr.Z,{strokeWidth:1.5,size:14})]})]}),(0,s.jsx)("div",{className:"grid grid-cols-4 gap-2",children:null==t?void 0:t.sort((e,t)=>
1{var r,s;return(null===(r=t.createdAt)||void 0===r?void 0:r.getTime())-(null===(s=e.createdAt)||void 0===s?void 0:s.getTime())}).map(e=>(0,s.jsxs)("div",{className:"bg-background border-border flex cursor-pointer flex-col gap-1 rounded-2xl border p-4 text-sm transition-all duration-200 hover:border-yellow-900/20 hover:bg-yellow-700/5 hover:shadow-sm",onClick:()=>r.push("/chat/".concat(e.id)),children:[(0,s.jsx)(ez.Z,{size:16,strokeWidth:2,className:"text-muted-foreground/50"}),(0,s.jsx)("div",{className:"min-h-2 flex-1"}),(0,s.jsx)("p",{className:"line-clamp-2 text-sm font-medium leading-tight",children:e.title}),(0,s.jsxs)("p",{className:"text-muted-foreground text-xs",children:[eR()(e.createdAt).fromNow(!0)," ago"]})]},e.id))})]})},tn=e=>{let{sources:t}=e;return Array.isArray(t)?(0,s.jsx)(o.kC,{direction:"col",gap:"md",className:"w-full",children:Array.isArray(t)&&(0,s.jsx)(o.kC,{gap:"xs",className:"mb-4 w-full flex-wrap overflow-x-hidden",items:"stretch",children:t.map((e,t)=>(0,s.jsx)(e0,{source:e,children:(0,s.jsxs)(o.Ct,{size:"md",variant:"default",onClick:()=>{var t;null===(t=window)||void 0===t||t.open(null==e?void 0:e.link,"_blank")},children:[(0,s.jsx)(eQ,{link:(0,eX.XF)(e.link)}),(0,eX.Fo)(e.link)]})},"source-".concat(e.link,"-").concat(t)))})}):null};var ta=r(66922),to=r(31644),ti=r(20126),tl=r(91905),td=r(73218),tc=r(33702),tu=r(99739);let tm=()=>{var e;let t=(0,tc.q)(e=>e.isSettingsOpen),r=(0,tc.q)(e=>e.setIsSettingsOpen),n=(0,tc.q)(e=>e.settingTab),a=(0,tc.q)(e=>e.setSettingTab),i=[{icon:(0,s.jsx)(to.Z,{size:16,strokeWidth:2,className:"text-muted-foreground"}),title:"Customize",key:tc.o.PERSONALIZATION,component:(0,s.jsx)(tp,{})},{icon:(0,s.jsx)(eE.Z,{size:16,strokeWidth:2,className:"text-muted-foreground"}),title:"API Keys",key:tc.o.API_KEYS,component:(0,s.jsx)(th,{})}];return(0,s.jsx)(o.Vq,{open:t,onOpenChange:()=>r(!1),children:(0,s.jsx)(o.cZ,{ariaTitle:"Settings",className:"h-full max-h-[600px] !max-w-[760px] overflow-x-hidden rounded-xl p-0",children:(0,s.jsxs)("div",{className:"no-scrollbar relative max-w-full overflow-y-auto overflow-x-hidden",children:[(0,s.jsx)("h3",{className:"border-border mx-5 border-b py-4 text-lg font-bold",children:"Settings"}),(0,s.jsxs)("div",{className:"flex flex-row gap-6 p-4",children:[(0,s.jsx)("div",{className:"flex w-[160px] shrink-0 flex-col gap-1",children:i.map(e=>(0,s.jsxs)(ta.z,{rounded:"full",className:"justify-start",variant:n===e.key?"secondary":"ghost",onClick:()=>a(e.key),children:[e.icon,e.title]},e.key))}),(0,s.jsx)("div",{className:"flex flex-1 flex-col overflow-hidden px-4",children:null===(e=i.find(e=>e.key===n))||void 0===e?void 0:e.component})]})]})})})},tx=()=>{let[e,t]=(0,g.useState)(!1),{mcpConfig:r,addMcpConfig:a,removeMcpConfig:i,updateSelectedMCP:l,selectedMCP:d}=(0,n.U7)();return(0,s.jsxs)("div",{className:"flex w-full flex-col gap-6 overflow-x-hidden",children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("h2",{className:"flex items-center gap-1 text-base font-medium",children:"MCP Tools"}),(0,s.jsx)("p",{className:"text-muted-foreground text-xs",children:"Connect your MCP tools. This will only work with your own API keys."})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("p",{className:"text-muted-foreground text-xs font-medium",children:["Connected Tools"," ",(0,s.jsxs)(o.Ct,{variant:"secondary",className:"text-primary inline-flex items-center gap-1 rounded-full bg-transparent",children:[(0,s.jsx)("span",{className:"bg-primary inline-block size-2 rounded-full"}),r&&Object.keys(r).length," Connected"]})]}),r&&Object.keys(r).length>0&&Object.keys(r).map(e=>(0,s.jsx)("div",{className:"bg-secondary divide-border border-border flex h-12 w-full flex-1 flex-row items-center gap-2 divide-x-2 rounded-lg border px-2.5 py-2",children:(0,s.jsxs)("div",{className:"flex w-full flex-row items-center gap-2",children:[(0,s.jsx)(b,{})," ",(0,s.jsx)(o.Ct,{children:e}),(0,s.jsx)("p",{className:"text-muted-foreground line-clamp-1 flex-1 text-sm",children:r[e]}),(0,s.jsx)(ta.z,{size:"xs",variant:"ghost",tooltip:"Delete Tool",onClick:()=>{i(e)},children:(0,s.jsx)(eT.Z,{size:14,strokeWidth:2,className:"text-muted-foreground"})})]})},e)),(0,s.jsx)(ta.z,{size:"sm",rounded:"full",className:"mt-2 self-start",onClick:()=>t(!0),children:"Add Tool"})]}),(0,s.jsxs)("div",{className:"mt-6 border-t border-dashed pt-6",children:[(0,s.jsx)("p",{className:"text-muted-foreground text-xs",children:"Learn more about MCP:"}),(0,s.jsxs)("div",{className:"mt-2 flex flex-col gap-2 text-sm",children:[(0,s.jsx)("a",{href:"https://mcp.composio.dev",target:"_blank",rel:"noopener noreferrer",className:"text-primary inline-flex items-center hover:underline",children:"Browse Composio MCP Directory →"}),(0,s.jsx)("a",{href:"https://www.anthropic.com/news/model-context-protocol",target:"_blank",rel:"noopener noreferrer",className:"text-primary inline-flex items-center hover:underline",children:"Read MCP Documentation →"})]})]}),(0,s.jsx)(tf,{isOpen:e,onOpenChange:t,onAddTool:a})]})},tf=e=>{let{isOpen:t,onOpenChange:r,onAddTool:a}=e,[i,l]=(0,g.useState)(""),[d,c]=(0,g.useState)(""),[u,m]=(0,g.useState)(""),{mcpConfig:x}=(0,n.U7)(),f=e=>{e||(m(""),l(""),c("")),r(e)};return(0,s.jsx)(o.Vq,{open:t,onOpenChange:f,children:(0,s.jsxs)(o.cZ,{ariaTitle:"Add MCP Tool",className:"!max-w-md",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)("h3",{className:"text-lg font-bold",children:"Add New MCP Tool"}),u&&(0,s.jsx)("p",{className:"text-destructive text-sm font-medium",children:u}),(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium",children:"Tool Name"}),(0,s.jsx)(o.II,{placeholder:"Tool Name",value:i,onChange:e=>{var t;l(null===(t=e.target.value)||void 0===t?void 0:t.trim().toLowerCase().replace(/ /g,"-")),u&&m("")}}),(0,s.jsx)("p",{className:"text-muted-foreground text-xs",children:"Will be automatically converted to lowercase with hyphens"})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium",children:"Tool Server URL"}),(0,s.jsx)(o.II,{placeholder:"https://your-mcp-server.com",value:d,onChange:e=>{c(e.target.value),u&&m("")}}),(0,s.jsx)("p",{className:"text-muted-foreground text-xs",children:"Example: https://your-mcp-server.com"})]})]}),(0,s.jsx)(o.cN,{className:"border-border mt-4 border-t pt-4",children:(0,s.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,s.jsx)(ta.z,{variant:"bordered",rounded:"full",onClick:()=>f(!1),children:"Cancel"}),(0,s.jsx)(ta.z,{onClick:()=>
1{if(!i.trim()){m("Tool name is required");return}if(!d.trim()){m("Tool URL is required");return}if(x&&x[i]){m("A tool with this name already exists");return}m(""),a({[i]:d}),l(""),c(""),r(!1)},rounded:"full",children:"Add Tool"})]})})]})})},th=()=>{let e=(0,td.V)(e=>e.getAllKeys()),t=(0,td.V)(e=>e.setKey),r=(0,td.V)(e=>e.mode),n=(0,td.V)(e=>e.setMode),[a,i]=(0,g.useState)(null),l=[{name:"OpenAI",key:"OPENAI_API_KEY",value:e.OPENAI_API_KEY,url:"https://platform.openai.com/api-keys"},{name:"Anthropic",key:"ANTHROPIC_API_KEY",value:e.ANTHROPIC_API_KEY,url:"https://console.anthropic.com/settings/keys"},{name:"Google Gemini",key:"GEMINI_API_KEY",value:e.GEMINI_API_KEY,url:"https://ai.google.dev/api"}],d=(e,r)=>{t(e,r),i(null)},c=e=>e?"****************"+e.slice(-4):"";return(0,s.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("h3",{className:"text-base font-semibold",children:"API Key Mode"}),(0,s.jsx)("p",{className:"text-muted-foreground text-sm",children:"Choose your preferred API key source."}),(0,s.jsxs)("div",{className:"border-border mt-2 flex flex-row gap-2 rounded-lg border p-1",children:[(0,s.jsx)(ta.z,{variant:"own"===r?"secondary":"ghost",size:"sm",className:"flex-1",onClick:()=>n("own"),children:(0,s.jsx)("span",{children:"Own"})}),(0,s.jsx)(ta.z,{variant:"system"===r?"secondary":"ghost",size:"sm",className:"flex-1",onClick:()=>n("system"),children:(0,s.jsx)("span",{children:"System"})})]})]}),l.map(e=>(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"text-sm font-medium",children:[e.name," API Key:"]}),(0,s.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-400 underline-offset-2 hover:underline",children:"(Get API key here)"})]}),(0,s.jsx)("div",{className:"flex items-center gap-2",children:"system"===r?(0,s.jsx)("div",{className:"flex flex-1 items-center gap-2 rounded-md border px-3 py-1.5 bg-muted/50",children:(0,s.jsx)("span",{className:"text-muted-foreground flex-1 text-sm",children:"Using .env file (server-side)"})}):a===e.key?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex-1",children:(0,s.jsx)(o.II,{value:e.value||"",placeholder:"Enter ".concat(e.name," API key"),onChange:r=>t(e.key,r.target.value)})}),(0,s.jsx)(ta.z,{variant:"default",size:"sm",onClick:()=>
1d(e.key,e.value||""),children:(0,s.jsx)("span",{className:"flex items-center gap-1",children:"✓ Save"})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex flex-1 items-center gap-2 rounded-md border px-3 py-1.5",children:e.value?(0,s.jsx)("span",{className:"flex-1",children:c(e.value)}):(0,s.jsx)("span",{className:"text-muted-foreground flex-1 text-sm",children:"No API key set"})}),(0,s.jsx)(ta.z,{variant:"bordered",size:"sm",onClick:()=>i(e.key),children:e.value?"Change Key":"Add Key"})]})})]},e.key))]})},tp=()=>{let e=(0,tu.a)(e=>e.customInstructions),t=(0,tu.a)(e=>e.setCustomInstructions),{theme:r,setTheme:n}=(0,eM.F)(),{editor:a}=(0,Y.e)({charLimit:6e3,defaultContent:e,placeholder:"Enter your custom instructions",enableEnter:!0,onUpdate(e){t(e.editor.getText())}});return(0,s.jsxs)("div",{className:"flex flex-col gap-6 pb-3",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("h3",{className:"text-base font-semibold",children:"Theme"}),(0,s.jsx)("p",{className:"text-muted-foreground text-sm",children:"Choose your preferred theme mode."}),(0,s.jsxs)("div",{className:"border-border mt-2 flex flex-row gap-2 rounded-lg border p-1",children:[(0,s.jsxs)(ta.z,{variant:"light"===r?"secondary":"ghost",size:"sm",className:"flex-1",onClick:()=>n("light"),children:[(0,s.jsx)(ti.Z,{size:16,strokeWidth:2}),(0,s.jsx)("span",{className:"ml-2",children:"Light"})]}),(0,s.jsxs)(ta.z,{variant:"dark"===r?"secondary":"ghost",size:"sm",className:"flex-1",onClick:()=>n("dark"),children:[(0,s.jsx)(tl.Z,{size:16,strokeWidth:2}),(0,s.jsx)("span",{className:"ml-2",children:"Dark"})]})]})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("h3",{className:"text-base font-semibold",children:"AI Response Rules"}),(0,s.jsx)("p",{className:"text-muted-foreground text-sm",children:"Set persistent rules that will be applied to every conversation. These instructions are automatically added to the system prompt for all messages, allowing you to customize the AI's behavior, tone, style, and focus consistently across all chats."}),(0,s.jsx)(o.bZ,{variant:"info",className:"mt-2",children:(0,s.jsxs)(o.X,{className:"text-muted-foreground/70 text-xs leading-tight",children:[(0,s.jsx)("strong",{children:"Examples:"}),' "Always respond in a friendly, casual tone", "Explain technical concepts in simple terms", "Focus on security best practices when discussing code", "Never use markdown formatting"']})}),(0,s.jsx)("div",{className:" shadow-subtle-sm border-border mt-2 rounded-lg border p-3",children:(0,s.jsx)(W,{editor:a})})]}),(0,s.jsxs)("div",{className:"border-border mt-4 border-t pt-4",children:[(0,s.jsx)(G.default,{href:"/design-system",target:"_blank",className:"text-primary hover:text-primary/80 text-sm font-medium underline underline-offset-2",children:"View Design System →"}),(0,s.jsx)("p",{className:"text-muted-foreground mt-1 text-xs",children:"Explore all design tokens, colors, typography, and components."})]})]})};var tg=r(46313),tv=r(91313),tj=r(60260);r(62148),r(79167),r(67199),r(88477);let ty=()=>{var e;let t;let{threadId:r}=(0,p.useParams)(),a=(0,p.usePathname)(),i=(0,n.aK)(e=>e.threads);(0,n.aK)(e=>e.clearAllThreads);let l=(0,n.qr)(e=>e.setIsSidebarOpen),d=(0,n.qr)(e=>e.isSidebarOpen),{push:c}=((0,n.qr)(e=>e.setIsSettingsOpen),(0,p.useRouter)()),u={today:[],yesterday:[],last7Days:[],last30Days:[],previousMonths:[]};null===(t="createdAt",e=[...i].sort((e,r)=>eR()(r[t]).diff(eR()(e[t]))))||void 0===e||e.forEach(e=>{let t=eR()(e.createdAt),r=eR()();t.isSame(r,"day")?u.today.push(e):t.isSame(r.clone().subtract(1,"day"),"day")?u.yesterday.push(e):t.isAfter(r.clone().subtract(7,"days"))?u.last7Days.push(e):t.isAfter(r.clone().subtract(30,"days"))?u.last30Days.push(e):u.previousMonths.push(e)});let m=e=>{let{title:t,threads:n,groupIcon:a,renderEmptyState:i}=e;return 0!==n.length||i?(0,s.jsxs)(o.kC,{direction:"col",items:"start",className:"w-full gap-0.5",children:[(0,s.jsxs)("div",{className:"text-muted-foreground/70 flex flex-row items-center gap-1 px-2 py-1 text-xs font-medium opacity-70",children:[a,t]}),0===n.length&&i?i():(0,s.jsx)(o.kC,{className:"border-border/50 w-full gap-0.5",gap:"none",direction:"col",children:n.map(e=>(0,s.jsx)(eZ,{thread:e,dismiss:()=>{l(e=>!1)},isActive:e.id===r},e.id))})]}):null};return(0,s.jsx)("div",{className:(0,o.cn)("relative bottom-0 left-0 top-0 z-[50] flex h-[100dvh] flex-shrink-0 flex-col  py-2 transition-all duration-200",d?"top-0 h-full w-[230px]":"w-[50px]"),children:(0,s.jsxs)(o.kC,{direction:"col",className:"w-full flex-1 items-start overflow-hidden",children:[(0,s.jsx)("div",{className:"mb-3 flex w-full flex-row items-center justify-start",children:d?(0,s.jsx)(o.zx,{variant:"ghost",tooltip:"
1Close Sidebar",tooltipSide:"right",size:"icon-sm",onClick:()=>l(e=>!e),className:"ml-3",children:(0,s.jsx)(tg.Z,{size:16,strokeWidth:2})}):(0,s.jsx)(o.zx,{variant:"ghost",tooltip:"Open Sidebar",tooltipSide:"right",size:"icon-sm",onClick:()=>l(e=>!e),className:"ml-3",children:(0,s.jsx)(tv.Z,{size:16,strokeWidth:2})})}),(0,s.jsx)(o.kC,{direction:"col",className:(0,o.cn)("w-full items-end px-3 ",!d&&"items-center justify-center px-0"),gap:"xs",children:"/chat"===a?(0,s.jsxs)(o.zx,{size:d?"sm":"icon-sm",variant:"bordered",rounded:"lg",tooltip:d?void 0:"New Thread",tooltipSide:"right",className:(0,o.cn)(d&&"relative w-full","justify-center"),children:[(0,s.jsx)(eI.Z,{size:16,strokeWidth:2,className:(0,o.cn)(d)}),d&&"New Thread"]}):(0,s.jsx)(G.default,{href:"/chat",className:d?"w-full":"",children:(0,s.jsxs)(o.zx,{size:d?"sm":"icon-sm",variant:"bordered",rounded:"lg",tooltip:d?void 0:"New Thread",tooltipSide:"right",className:(0,o.cn)(d&&"relative w-full","justify-center"),children:[(0,s.jsx)(eI.Z,{size:16,strokeWidth:2,className:(0,o.cn)(d)}),d&&"New"]})})}),(0,s.jsx)(o.kC,{direction:"col",gap:"xs",className:(0,o.cn)("border-border-strong mt-3 w-full  justify-center border-t border-dashed px-3 py-2",!d&&"items-center justify-center px-0")}),(0,s.jsxs)(o.kC,{direction:"col",gap:"md",className:(0,o.cn)("no-scrollbar w-full flex-1 overflow-y-auto px-3 pb-[100px]",d?"flex":"hidden"),children:[m({title:"Today",threads:u.today}),m({title:"Yesterday",threads:u.yesterday}),m({title:"Last 7 Days",threads:u.last7Days}),m({title:"Last 30 Days",threads:u.last30Days}),m({title:"Previous Months",threads:u.previousMonths})]}),(0,s.jsxs)(o.kC,{className:(0,o.cn)("from-surface via-surface/95 absolute bottom-0 mt-auto w-full items-center bg-gradient-to-t via-60% to-transparent p-2 pt-12",d&&"items-start justify-between"),gap:"xs",direction:"col",children:[!d&&(0,s.jsx)(o.zx,{variant:"ghost",size:"icon",tooltip:"Open Sidebar",tooltipSide:"right",onClick:()=>l(e=>!e),className:(0,o.cn)(!d&&"mx-auto"),children:(0,s.jsx)(tv.Z,{size:16,strokeWidth:2})}),(0,s.jsx)(G.default,{href:"/design-system",className:d?"w-full":"",children:(0,s.jsxs)(o.zx,{size:d?"sm":"icon-sm",variant:"bordered",rounded:"lg",tooltip:d?void 0:"Design System",tooltipSide:"right",className:(0,o.cn)("text-muted-foreground w-full justify-start",!d&&"w-auto justify-center"),children:[(0,s.jsx)(tj.Z,{size:16,strokeWidth:2}
1),d&&"Design System"]})}),!1]})]})})};r(41942);let tb=e=>{let{redirectUrl:t="/sign-in/sso-callback",onClose:r}=e,[s,n]=(0,g.useState)(null),[a,o]=(0,g.useState)(""),[i,l]=(0,g.useState)(""),[d,c]=(0,g.useState)(!1),[u,m]=(0,g.useState)(""),[x,f]=(0,g.useState)(!1);return null},tw=e=>{try{return new URL(e),!0}catch(e){return!1}},tN=e=>{try{return new URL(e).hostname}catch(e){return null}},tk=e=>{if(!e)return null;try{return"https://www.google.com/s2/favicons?domain=".concat(e,"&sz=128")}catch(e){return null}},tC=e=>{let{urls:t}=e;return 0===t.length?null:(0,s.jsxs)("div",{className:"bg-secondary flex flex-row items-center gap-2 rounded-full border p-1 text-xs",children:[(0,s.jsx)("div",{className:"-gap-2 flex flex-row",children:t.slice(0,3).map(e=>{let t=tN(e),r=tk(null!=t?t:"");return tw(e)?(0,s.jsxs)("div",{className:"border-border bg-background relative -mr-2 h-6 w-6 overflow-hidden rounded-full border",children:[" ",(0,s.jsx)(K.default,{src:null!=r?r:"",alt:null!=t?t:"",fill:!0,className:"not-prose absolute inset-0 h-full w-full object-cover"})]}):null})})," ",(0,s.jsxs)("div",{className:"text-primary px-1 text-xs",children:[t.length," sources"]})]})},tS=()=>{var e;let{threadId:t}=(0,p.useParams)(),r=null!==(e=null==t?void 0:t.toString())&&void 0!==e?e:"",[a,i]=(0,g.useState)(!1),l=(0,n.aK)((0,J.N)(e=>e.getPreviousThreadItems(r))),d=(0,n.aK)((0,J.N)(e=>e.getCurrentThreadItem(r))),c=(0,n.aK)(e=>e.activeThreadItemView),u=[...l,d].filter(Boolean);return(null==u?void 0:u.length)<=1?null:(0,s.jsx)("div",{className:"absolute left-4 top-1/2 z-[10] flex -translate-y-1/2 flex-col items-end gap-1.5",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:(0,s.jsxs)(o.J2,{open:a,onOpenChange:i,children:[(0,s.jsx)(o.CM,{asChild:!0,children:(0,s.jsx)("div",{className:"flex h-12 w-8 flex-col items-start justify-center gap-1.5",children:u.map((e,t)=>{let r=c===(null==e?void 0:e.id);return(0,s.jsx)("div",{className:(0,o.cn)("h-[1px] w-4 cursor-pointer rounded-full transition-all duration-200",r?"bg-primary w-3":"bg-foreground
1/20 w-2"),onClick:t=>{if(t.stopPropagation(),null==e?void 0:e.id){let t=document.getElementById("thread-item-".concat(e.id));null==t||t.scrollIntoView({behavior:"smooth"})}}},t)})})}),(0,s.jsx)(f.M,{children:a&&(0,s.jsx)(o.yk,{asChild:!0,sideOffset:-40,side:"right",align:"center",className:"relative z-[10] max-w-[260px] p-0",children:(0,s.jsx)(h.E.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},transition:{duration:.2,ease:"easeOut"},className:"w-full rounded-md bg-white p-1 shadow-2xl",children:(0,s.jsx)("div",{className:"no-scrollbar max-h-60 overflow-y-auto",children:u.map((e,t)=>{let r=c===(null==e?void 0:e.id);return(0,s.jsx)(o.zx,{onClick:t=>{if(t.stopPropagation(),null==e?void 0:e.id){let t=document.getElementById("thread-item-".concat(e.id));null==t||t.scrollIntoView({behavior:"instant"})}},variant:"ghost",className:(0,o.cn)("text-muted-foreground/50 hover:text-foreground group line-clamp-2 h-auto min-h-7 w-full max-w-full cursor-pointer justify-end overflow-hidden whitespace-normal py-1 text-left text-sm",r&&"text-foreground"),children:null==e?void 0:e.query},t)})})})})})]})})},tI=g.memo(function(e){let{children:t,as:r="p",className:n,duration:a=1,spread:i=2}=e,l=(0,h.E)(r),d=(0,g.useMemo)(()=>t.length*i,[t,i]);return(0,s.jsx)(l,{className:(0,o.cn)("relative inline-block bg-[length:250%_100%,auto] bg-clip-text","text-transparent [--base-color:hsl(var(--muted-foreground)/50)] [--base-gradient-color:hsl(var(--foreground))]","[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--base-gradient-color),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]","dark:[--base-color:hsl(var(--muted-foreground)/50)] dark:[--base-gradient-color:hsl(var(--primary))]",n),initial:{backgroundPosition:"100% center"},animate:{backgroundPosition:"0% center"},transition:{repeat:1/0,duration:a,ease:"linear"},style:{"--spread":"".concat(d,"px"),backgroundImage:"var(--bg), linear-gradient(var(--base-color), var(--base-color))"},children:t})});var tT=r(90399);let tE=()=>{let[e,t]=(0,g.useState)(!1),{mcpConfig:r,updateSelectedMCP:a,selectedMCP:i}=(0,n.U7)(),l=(0,td.V)(),d=(0,tu.a)(e=>e.chatMode),c=(0,td.V)(e=>e.hasApiKeyForChatMode),u=(0,tc.q)(e=>e.setIsSettingsOpen),m=(0,tc.q)(e=>e.setSettingTab),[x,f]=(0,g.useState)(!1);(0,g.useEffect)(()=>{c(d).then(f)},[d,c,l]);let h=(0,g.useMemo)(()=>Object.keys(r).filter(e=>r[e]),[r]);return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)(o.h_,{open:e,onOpenChange:t,children:[(0,s.jsx)(o.$F,{asChild:!0,children:(0,s.jsxs)(ta.z,{size:i.length>0?"sm":"icon",tooltip:x?"Tools":"Only available with BYOK",variant:e?"secondary":"ghost",className:"gap-2",rounded:"full",disabled:!x,children:[(0,s.jsx)(v.Z,{size:18,strokeWidth:2,className:"text-muted-foreground"}),(null==h?void 0:h.length)>0&&(0,s.jsx)(o.Ct,{variant:"secondary",className:"bor flex h-5 min-w-5 items-center justify-center rounded-full px-1.5 text-xs",children:h.length})]})}),(0,s.jsxs)(o.AW,{align:"start",side:"bottom",className:"w-[320px]",children:[Object.keys(r).map(e=>(0,s.jsx)(o.Xi,{onClick:()=>a(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),children:(0,s.jsxs)("div",{className:"flex w-full items-center justify-between gap-2",children:[(0,s.jsx)(b,{}),(0,s.jsx)("span",{children:e}),(0,s.jsx)("div",{className:"flex-1"}),i.includes(e)&&(0,s.jsx)(ew.Z,{size:16,className:"text-foreground"})]})},e)),r&&0===Object.keys(r).length&&(0,s.jsxs)("div",{className:"flex h-[150px] flex-col items-center justify-center gap-2",children:[(0,s.jsx)(v.Z,{size:16,strokeWidth:2,className:"text-muted-foreground"}),(0,s.jsx)("p",{className:"text-muted-foreground text-sm",children:"No tools found"}),(0,s.jsxs)(ta.z,{rounded:"full",variant:"bordered",className:"text-muted-foreground text-xs",onClick:()=>{u(!0),m(tc.o.MCP_TOOLS)},children:[(0,s.jsx)(eI.Z,{size:14,strokeWidth:2,className:"text-muted-foreground"}),"Add Tool"]})]}),r&&Object.keys(r).length>0&&(0,s.jsx)(o.VD,{}),r&&Object.keys(r).length>0&&(0,s.jsxs)(o.Xi,{onClick:()=>{u(!0),m(tc.o.MCP_TOOLS)},children:[(0,s.jsx)(eI.Z,{size:14,strokeWidth:2,className:"text-muted-foreground"}),"Add Tool"]})]})]})})};var tA=r(60912);let tz=()=>{let e=(0,p.useRouter)(),{setIsCommandSearchOpen:t}=(0,eS.useRootContext)(),r=(0,n.qr)(e=>e.setIsSettingsOpen);return(0,s.jsxs)("div",{className:"border-border bg-background fixed top-0 left-0 right-0 z-50 flex h-14 items-center justify-between border-b px-4",children:[(0,s.jsx)(G.default,{href:"/chat",children:(0,s.jsxs)(h.E.div,{initial:{opacity:0}
1,animate:{opacity:1},transition:{duration:.3,delay:.2},className:"flex h-8 cursor-pointer items-center justify-start gap-1.5",children:[(0,s.jsx)(e2,{className:"text-primary size-5"}),(0,s.jsx)("p",{className:"font-clash text-foreground text-lg font-bold tracking-wide",children:"LLMTalk"})]})}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)(o.zx,{size:"sm",variant:"bordered",rounded:"lg",className:"text-muted-foreground justify-center px-2",onClick:()=>t(!0),children:[(0,s.jsx)(tA.Z,{size:14,strokeWidth:2}),(0,s.jsx)("span",{className:"ml-2",children:"Search"}),(0,s.jsx)("div",{className:"flex-1"}),(0,s.jsxs)("div",{className:"flex flex-row items-center gap-1",children:[(0,s.jsx)(o.Ct,{variant:"secondary",className:"bg-muted-foreground/10 text-muted-foreground flex size-5 items-center justify-center rounded-md p-0",children:(0,s.jsx)(eA.Z,{size:12,strokeWidth:2,className:"shrink-0"})}),(0,s.jsx)(o.Ct,{variant:"secondary",className:"bg-muted-foreground/10 text-muted-foreground flex size-5 items-center justify-center rounded-md p-0",children:"T"})]})]}),(0,s.jsxs)(o.zx,{size:"sm",variant:"bordered",rounded:"lg",onClick:()=>r(!0),children:[(0,s.jsx)(to.Z,{size:14,strokeWidth:2}),(0,s.jsx)("span",{className:"ml-2",children:"Settings"})]}),(0,s.jsx)(o.zx,{size:"sm",rounded:"lg",onClick:()=>e.push("/sign-in"),children:"Log in / Sign up"})]})]})}},90399:function(e,t,r){"use strict";r.d(t,{I1:function(){return i},EI:function(){return o},t_:function(){return er},J9:function(){return L},Lm:function(){return x},z6:function(){return S},SA:function(){return R},z1:function(){return M},v0:function(){return U},P:function(){return B},NR:function(){return Y},QB:function(){return J},LQ:function(){return Q},L4:function(){return et},Zp:function(){return $},kd:function(){return ee},Rg:function(){return k},jz:function(){return ei},Ec:function(){return eu},V3:function(){return em},yM:function(){return ea},zq:function(){return ef},Sc:function(){return eh},n5:function(){return eg},jv:function(){return a},C_:function(){return A},gS:function(){return D},Wx:function(){return z}});var s=r(57437),n=r(2265);let a=e=>{try{return new URL(e),!0}catch(e){return!1}},o=(0,n.createContext)({sources:[],getSourceByIndex:()=>void 0}),i=e=>{let{sources:t,children:r}=e,[a,i]=(0,n.useState)([]);return(0,n.useEffect)(()=>{t&&Array.isArray(t)&&i(t)},[t]),(0,s.jsx)(o.Provider,{value:{sources:a,getSourceByIndex:e=>a.find(t=>t.index===e)},children:r})};var l=r(5520),d=r(59279),c=r(30895),u=r(14950),m=r(72039);let x=e=>{let{suggestions:t}=e,r=(0,l.aK)((0,m.N)(e=>e.editor));return t&&(null==t?void 0:t.length)!==0?(console.log("suggestions",t),(0,s.jsxs)(u.E.div,{initial:{opacity:0}
1,animate:{opacity:1},className:"border-border my-4 flex flex-col items-start gap-2 border-t border-dashed py-4",children:[(0,s.jsxs)("div",{className:"text-muted-foreground flex flex-row items-center gap-1.5 py-2 text-xs font-medium",children:[(0,s.jsx)(c.Z,{size:16,strokeWidth:2,className:"text-muted-foreground"})," Ask Followup"]}),(0,s.jsx)(u.E.div,{variants:{show:{transition:{staggerChildren:.1}}},initial:"hidden",animate:"show",className:"flex flex-col gap-2",children:null==t?void 0:t.map(e=>(0,s.jsx)(u.E.div,{variants:{hidden:{opacity:0,y:10},show:{opacity:1,y:0}},children:(0,s.jsx)(d.zx,{variant:"bordered",size:"default",rounded:"lg",className:" hover:text-primary group h-auto min-h-7 max-w-full cursor-pointer justify-start overflow-hidden whitespace-normal py-1.5 text-left",onClick:()=>{null==r||r.commands.clearContent(),null==r||r.commands.insertContent(e)},children:e})},e))})]})):null};var f=r(86123),h=r(5315),p=r(91052),g=r(91186),v=r(76342),j=r(67095),y=r(90341);let b=e=>e.mode===h.jE.Deep?"Research":[h.jE.DEEPSEEK_R1].includes(e.mode)?"Thinking":e.mode===h.jE.Pro?"Pro Search":"Steps",w=e=>e.mode===h.jE.Deep?(0,s.jsx)(p.Z,{size:16,strokeWidth:2,className:"text-muted-foreground"}):e.mode===h.jE.Pro?(0,s.jsx)(g.Z,{size:16,strokeWidth:2,className:"text-muted-foreground"}):(0,s.jsx)(v.Z,{size:16,strokeWidth:2,className:"text-muted-foreground"}),N=e=>e.mode===h.jE.Deep?"This process takes approximately 15 minutes. Please keep the tab open during this time.":e.mode===h.jE.Pro?"This process takes approximately 5 minutes. Please keep the tab open during this time.":"",k=e=>{var t;let{steps:r,threadItem:a}=e,o=(0,l.qr)(e=>e.openSideDrawer),i=(0,l.qr)(e=>e.dismissSideDrawer),c=(0,l.qr)(e=>e.updateSideDrawer),u="ABORTED"===a.status||"ERROR"===a.status,m=r.some(e=>"PENDING"===e.status)&&!u,x=!!(null==a?void 0:null===(t=a.answer)||void 0===t?void 0:t.text)&&("COMPLETED"===a.status||"ABORTED"===a.status||"ERROR"===a.status);console.log("hasAnswer",x),(0,n.useEffect)(()=>{x&&(console.log("dismissing side drawer"),i())},[x]),(0,n.useEffect)(()=>{var e;(null===(e=r[0])||void 0===e?void 0:e.status)==="PENDING"&&g()},[r[0]]);let h=(0,n.useMemo)(()=>Object.entries((null==a?void 0:a.toolCalls)||{}).map(e=>{var t;let[r,s]=e;return{toolCall:s,toolResult:null==a?void 0:null===(t=a.toolResults)||void 0===t?void 0:t[r]}}),[null==a?void 0:a.toolCalls,null==a?void 0:a.toolResults]),p=r.length;(0,n.useEffect)(()=>{r.length>0&&c({renderContent:()=>(0,s.jsx)("div",{className:"flex w-full flex-1 flex-col px-2 py-4",children:r.map((e,t)=>(0,s.jsx)(f.StepRenderer,{step:e},t))}),badge:p,title:()=>v(!1)})},[r,null==a?void 0:a.status]);let g=()=>{i(),o({badge:p,title:()=>v(!1),renderContent:()=>(0,s.jsx)("div",{className:"flex w-full flex-1 flex-col px-2 py-4",children:r.map((e,t)=>(0,s.jsx)(f.StepRenderer,{step:e},t))})})},v=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return(0,s.jsxs)("div",{className:"flex flex-row items-start gap-2",children:[(0,s.jsx)("div",{className:"mt-0.5",children:m?(0,s.jsx)(j.Z,{size:16,strokeWidth:2,className:" text-muted-foreground animate-spin"}):w(a)}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:b(a)}),e&&!x&&(0,s.jsx)("p",{className:"text-muted-foreground/70 text-xs",children:N(a)})]})]})};return 0!==r.length||h.length?(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"bg-background shadow-subtle-xs hover:bg-secondary flex w-full cursor-pointer flex-row items-center gap-2 rounded-lg px-3 py-2.5",onClick:()=>{g()},children:[v(),(0,s.jsx)("div",{className:"flex-1"}),(0,s.jsxs)(d.Ct,{variant:"default",size:"sm",children:[p," ",1===p?"Step":"Steps"]}),(0,s.jsx)(y.Z,{size:14,strokeWidth:2})]})}):null};var C=r(57844);let S=e=>{let{imageAttachment:t}=e;return(0,s.jsxs)("div",{className:"flex flex-row items-center gap-2 p-1",children:[(0,s.jsx)(C.Z,{size:16,className:"text-muted-foreground/50"}),(0,s.jsx)("div",{className:"relative flex w-12 flex-row items-center gap-2 ",children:(0,s.jsx)("img",{src:t,alt:"image",className:"relative inset-0 rounded-lg"})})]})};var I=r(26474),T=r(65654),E=r(62272);let A={"animate-fade-in prose prose-sm min-w-full":!0,"prose-p:font-normal prose-p:text-base prose-p:leading-[1.65rem]":!0,"prose-headings:text-base prose-headings:font-medium ":!0,"prose-h1:text-2xl prose-h1:font-medium ":!0,"prose-h2:text-2xl prose-h2:font-medium ":!0,"prose-h3:text-lg prose-h3:font-medium ":!0,"prose-strong:font-medium prose-th:font-medium":!0,"prose-li:text-muted-foreground prose-li:font-normal prose-li:leading-[1.65rem]":!0,"prose-code:font-mono prose-code:text-sm prose-code:font-normal":!0,"prose-code:bg-secondary prose-code:border-border prose-code:border prose-code:rounded-lg prose-code:p-0.5":!0,"prose-table:border-border prose-table:border prose-table:rounded-lg prose-table:bg-background":!0,"prose-th:text-sm prose-th:font-medium prose-th:text-muted-foreground prose-th:bg-surface prose-th:px-3 prose-th:py-1.5":!0,"prose-tr:border-border prose-tr:border":!0,"prose-td:px-3 prose-td:py-2.5":!0,"prose-prosetheme":!0},z=e=>{let t=e.lastIndexOf("<");return -1===t||e.substring(t).includes(">")?e:e.substring(0,t)},D=e=>
1e.replace(/\\n/g,"\n"),R=(0,n.memo)(e=>{let{content:t,className:r,isCompleted:a,isLast:o}=e,[i,l]=(0,n.useState)([]),[c,u]=(0,n.useState)(""),{chunkMdx:m}=(0,f.useMdxChunker)();return((0,n.useEffect)(()=>{t&&(async()=>{try{let e;let r=D(t).replace(/\[(\d+)\]/g,(e,t)=>"<Source>".concat(t,"</Source>")).replace(/\[(\d+(?:,\s*\d+)+)\]/g,e=>(e.match(/\d+/g)||[]).map(e=>"<Source>".concat(e,"</Source>")).join(" "));if(a)l([]),u(r);else{let{chunks:e}=await m(r);e.length>0&&(e.length>1?l(e.slice(0,-1)):l([]),u(e[e.length-1]||""))}}catch(e){console.error("Error processing MDX chunks:",e)}})()},[t,a]),a&&!o)?(0,s.jsx)("div",{className:(0,d.cn)("",A,r),children:(0,s.jsx)(f.ErrorBoundary,{fallback:(0,s.jsx)(f.ErrorPlaceholder,{}),children:(0,s.jsx)(M,{chunk:c})})}):(0,s.jsxs)("div",{className:(0,d.cn)("",A,r),children:[i.length>0&&i.map((e,t)=>(0,s.jsx)(f.ErrorBoundary,{fallback:(0,s.jsx)(f.ErrorPlaceholder,{}),children:(0,s.jsx)(M,{chunk:e})},"prev-".concat(t))),c&&(0,s.jsx)(f.ErrorBoundary,{fallback:(0,s.jsx)(f.ErrorPlaceholder,{}),children:(0,s.jsx)(M,{chunk:c})},"current-chunk")]})});R.displayName="MarkdownContent";let M=(0,n.memo)(e=>{let{chunk:t}=e,[r,a]=(0,n.useState)(null);return((0,n.useEffect)(()=>{if(!t)return;let e=!0;return(async()=>{try{let r=await (0,T.q)(t,{mdxOptions:{remarkPlugins:[E.Z]}});e&&a(r)}catch(e){console.error("Error serializing MDX chunk:",e)}})(),()=>{e=!1}},[t]),r)?(0,s.jsx)(f.ErrorBoundary,{fallback:(0,s.jsx)(f.ErrorPlaceholder,{}),children:(0,s.jsx)(n.Suspense,{fallback:(0,s.jsx)("div",{children:"Loading..."}),children:(0,s.jsx)(I.R,{...r,components:f.mdxComponents})})}):null});M.displayName="MemoizedMdxChunk";var P=r(94218),_=r(29056),O=r(54545),W=r(27997),G=r(27776);let U=(0,n.memo)(e=>{var t;let{message:r,imageAttachment:a,threadItem:o}=e,[i,c]=(0,n.useState)(!1),u=(0,n.useRef)(null),[m,x]=(0,n.useState)(!1),[h,p]=(0,n.useState)(!1),{copyToClipboard:g,status:v}=(0,P.oM)(),j=(0,l.aK)(e=>e.isGenerating);(0,n.useEffect)(()=>{u.current&&p(u.current.scrollHeight>120)},[r]);let y=(0,n.useCallback)(()=>{u.current&&g(u.current)},[g]),b=(0,n.useCallback)(()=>c(e=>!e),[]);return(0,s.jsxs)("div",{className:"flex w-full flex-col items-end gap-2 pt-4",children:[a&&(0,s.jsx)(S,{imageAttachment:a}),(0,s.jsxs)("div",{className:(0,d.cn)("text-foreground bg-surface group relative max-w-[80%] overflow-hidden rounded-lg",m&&"border-border-strong"),children:[!m&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{ref:u,className:(0,d.cn)("prose-sm relative px-3 py-1.5 font-normal",{"pb-12":i,markdownStyles:f.markdownStyles}),style:{maxHeight:i?"none":120,transition:"max-height 0.3s ease-in-out"},children:r}),(0,s.jsx)("div",{className:(0,d.cn)("absolute bottom-0 left-0 right-0 hidden flex-col items-center  group-hover:flex",h&&"flex"),children:(0,s.jsxs)("div",{className:"via-surface/85 to-surface flex w-full items-center justify-end gap-1 bg-gradient-to-b from-transparent p-1.5",children:[h&&(0,s.jsx)(d.zx,{variant:"secondary",size:"xs",rounded:"full",className:"pointer-events-auto relative z-10 px-4",onClick:b,children:i?"Show less":"Show more"}),(0,s.jsx)(d.zx,{variant:"bordered",size:"icon-sm",onClick:y,tooltip:"copied"===v?"Copied":"Copy",children:"copied"===v?(0,s.jsx)(_.Z,{size:14,strokeWidth:2}):(0,s.jsx)(O.Z,{size:14,strokeWidth:2})}),(0,s.jsx)(d.zx,{disabled:j||"QUEUED"===o.status||"PENDING"===o.status,variant:"bordered",size:"icon-sm",tooltip:"Edit",onClick:()=>x(!0),children:(0,s.jsx)(W.Z,{size:14,strokeWidth:2})})]})})]}),m&&(0,s.jsx)(L,{width:null===(t=u.current)||void 0===t?void 0:t.offsetWidth,message:r,threadItem:o,onCancel:()=>{x(!1)}})]})]})}),L=(0,n.memo)(e=>{let{message:t,onCancel:r,threadItem:n,width:a}=e,{handleSubmit:o}=(0,P.EU)(),i=(0,l.aK)(e=>e.removeFollowupThreadItems),c=(0,l.aK)(e=>e.getThreadItems),{editor:u}=(0,P.e)({defaultContent:t}),m=async e=>{if(!e.trim()){G.Am.error("Please enter a message");return}i(n.id);let t=new FormData;t.append("query",e),t.append("imageAttachment",n.imageAttachment||"");let r=await c(n.threadId);o({formData:t,existingThreadItemId:n.id,messages:r,newChatMode:n.mode,useWebSearch:!1})};return(0,s.jsxs)("div",{className:"relative flex max-w-full flex-col items-end gap-2",children:[(0,s.jsx)("div",{className:(0,d.cn)(" relative px-3 py-0 text-base font-normal",{}),style:{minWidth:a,transition:"max-height 0.3s ease-in-out"},children:(0,s.jsx)(f.ChatEditor,{maxHeight:"100px",editor:u,sendMessage:()=>{m((null==u?void 0:u.getText())||"")},className:(0,d.cn)("prose-sm max-w-full overflow-y-scroll !p-0",f.markdownStyles)})}),(0,s.jsx)("div",{className:(0,d.cn)("flex-col items-center  group-hover:flex"),children:(0,s.jsxs)("div",{className:" flex w-full items-center justify-end gap-1 bg-gradient-to-b from-transparent p-1.5",children:[(0,s.jsx)(d.zx,{size:"xs",onClick:()=>{m((null==u?void 0:u.getText())||"")},tooltip:"copied"===status?"Copied":"Copy",children:"Save"}),(0,s.jsx)(d.zx,{variant:"bordered",size:"xs",tooltip:"Edit",onClick:r,children:"Cancel"})]})})]})});U.displayName="Message";
1var K=r(30026),Z=r(64022),F=r(86366);let B=(0,n.forwardRef)((e,t)=>{var r,a,o;let{threadItem:i,isLast:c}=e,{handleSubmit:u}=(0,P.EU)(),m=(0,l.aK)(e=>e.deleteThreadItem),x=(0,l.aK)(e=>e.getThreadItems),p=(0,l.aK)(e=>e.useWebSearch),[g,v]=(0,n.useState)(i.mode),{copyToClipboard:j,status:y,copyMarkdown:b,markdownCopyStatus:w}=(0,P.oM)();return(0,s.jsxs)("div",{className:"flex flex-row items-center gap-1 py-2",children:[(null==i?void 0:null===(r=i.answer)||void 0===r?void 0:r.text)&&(0,s.jsx)(d.zx,{variant:"ghost-bordered",size:"icon-sm",onClick:()=>{t&&"current"in t&&t.current&&j(t.current||"")},tooltip:"Copy",children:"copied"===y?(0,s.jsx)(_.Z,{size:16,strokeWidth:2}):(0,s.jsx)(O.Z,{size:16,strokeWidth:2})}),(null==i?void 0:null===(a=i.answer)||void 0===a?void 0:a.text)&&(0,s.jsx)(d.zx,{variant:"ghost-bordered",size:"icon-sm",onClick:()=>{var e,t;b("".concat(null==i?void 0:null===(e=i.answer)||void 0===e?void 0:e.text,"\n\n## References\n").concat(null==i?void 0:null===(t=i.sources)||void 0===t?void 0:t.map(e=>"[".concat(e.index,"] ").concat(e.link)).join("\n")))},tooltip:"Copy Markdown",children:"copied"===w?(0,s.jsx)(_.Z,{size:16,strokeWidth:2}):(0,s.jsx)(K.Z,{size:16,strokeWidth:2})}),"ERROR"!==i.status&&(null===(o=i.answer)||void 0===o?void 0:o.status)!=="HUMAN_REVIEW"&&(0,s.jsxs)(d.h_,{children:[(0,s.jsx)(d.$F,{asChild:!0,children:(0,s.jsx)(d.zx,{variant:"ghost-bordered",size:"icon-sm",tooltip:"Rewrite",children:(0,s.jsx)(Z.Z,{size:16,strokeWidth:2})})}),(0,s.jsx)(f.ChatModeOptions,{chatMode:g,setChatMode:async e=>{v(e);let t=new FormData;t.append("query",i.query||"");let r=await x(i.threadId);u({formData:t,existingThreadItemId:i.id,newChatMode:e,messages:r,useWebSearch:p})}})]}),c&&(0,s.jsx)(d.zx,{variant:"ghost-bordered",size:"icon-sm",onClick:()=>{m(i.id)},tooltip:"Remove",children:(0,s.jsx)(F.Z,{size:16,strokeWidth:2})}),i.mode&&(0,s.jsxs)("p",{className:"text-muted-foreground px-2 text-xs",children:["Generated 
1with ",(0,h.Wd)(i.mode)]})]})});B.displayName="MessageActions";var q=r(31718),V=r(54238);let Y=e=>{var t,r,a,o,i,c,u,m,x,f;let{threadItem:h}=e,[p,g]=(0,n.useState)(null),[v,j]=(0,n.useState)([]),[y,b]=(0,n.useState)(""),[w,N]=(0,n.useState)(!1),{handleSubmit:k}=(0,P.EU)(),C=(0,l.aK)(e=>e.getThreadItems),S=(0,l.aK)(e=>e.updateThreadItem),I=(null===(r=h.object)||void 0===r?void 0:null===(t=r.clarifyingQuestion)||void 0===t?void 0:t.options)||[],T=(null===(o=h.object)||void 0===o?void 0:null===(a=o.clarifyingQuestion)||void 0===a?void 0:a.question)||"",E=(null===(c=h.object)||void 0===c?void 0:null===(i=c.clarifyingQuestion)||void 0===i?void 0:i.choiceType)||"multiple",A=!!(null===(m=h.object)||void 0===m?void 0:null===(u=m.clarifyingQuestion)||void 0===u?void 0:u.submittedQuery),z=(0,n.useMemo)(()=>{var e;return null===(e=h.object)||void 0===e?void 0:e.clarifyingQuestion},[h.object]);return A?(0,s.jsxs)("div",{className:"border-border bg-background mt-2 flex w-full flex-col items-start gap-4 rounded-lg border p-4",children:[(0,s.jsxs)("span",{className:"flex flex-row items-center gap-1 text-xs font-medium text-yellow-700",children:[(0,s.jsx)(_.Z,{size:14,strokeWidth:2})," Submitted"]}),(0,s.jsx)("div",{className:"flex flex-col",children:(0,s.jsx)("p",{className:"text-base",children:null===(f=h.object)||void 0===f?void 0:null===(x=f.clarifyingQuestion)||void 0===x?void 0:x.submittedQuery})})]}):z?(0,s.jsxs)("div",{className:"border-border bg-background mt-2 flex w-full flex-col items-start gap-4 roun
1ded-lg border p-4",children:[(0,s.jsxs)("div",{className:"flex flex-row items-center gap-1",children:[(0,s.jsx)(V.Z,{size:16,strokeWidth:2,className:"text-primary"}),(0,s.jsx)("p",{className:"text-sm text-yellow-700",children:"Follow-up Question"})]}),(0,s.jsx)("p",{className:"text-base",children:T}),"single"===E?(0,s.jsxs)(d.Ee,{value:p||"",onValueChange:e=>{g(e),N("custom"===e)},className:"flex flex-col gap-2",children:[I.map((e,t)=>(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(d.mJ,{value:e,id:"option-".concat(t)}),(0,s.jsx)("p",{className:"text-sm",children:e})]},t)),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(d.mJ,{value:"custom",id:"option-custom"}),(0,s.jsx)("p",{className:"text-sm",children:"Custom option"})]})]}):(0,s.jsx)("div",{className:"flex flex-row flex-wrap gap-2",children:I.map((e,t)=>(0,s.jsxs)("div",{className:"border-border flex items-center space-x-2 rounded-full border px-3 py-1.5",onClick:()=>{v.includes(e)?j(v.filter(t=>t!==e)):j([...v,e])},children:[v.includes(e)?(0,s.jsx)(_.Z,{size:16,strokeWidth:2,className:"text-primary"}):(0,s.jsx)(q.Z,{size:16,strokeWidth:2,className:"text-muted-foreground/20"}),(0,s.jsx)("p",{className:"text-sm",children:e})]},t))}),(0,s.jsx)("div",{className:"mt-2 w-full",children:(0,s.jsx)(d.gx,{value:y,onChange:e=>b(e.target.value),placeholder:"Add your response here...",className:"!border-border h-[100px] w-full rounded-lg !border px-3 py-2"})}),(0,s.jsx)(d.zx,{disabled:!p&&!v.length&&!y,size:"sm",rounded:"full",onClick:async()=>{var e;let t=h.query||"",r="";r="single"===E?"".concat(p?"".concat(p," \n\n"):"").concat(y):"".concat((null==v?void 0:v.length)?"".concat(v.join(", ")," \n\n"):"").concat(y);let s=t?"".concat(t,"\n\nAdditional context: ").concat(r):r,n=new FormData;n.append("query",s);let a=await C(h.threadId);S(h.threadId,{...h,object:{...h.object,clarifyingQuestion:{...null===(e=h.object)||void 0===e?void 0:e.clarifyingQuestion,submittedQuery:s}},status:"COMPLETED"}),setTimeout(()=>{k({formData:n,messages:a})},1e3)},children:"Submit"})]}):null};var H=r(11533);let J=e=>{let{sources:t}=e,r=(0,l.qr)(e=>e.openSideDrawer);if(!t||!Array.isArray(t)||(null==t?void 0:t.length)===0)return null;let n=[...t].sort((e,t)=>(null==e?void 0:e.index)-(null==t?void 0:t.index));return(0,s.jsxs)("div",{className:"grid grid-cols-4 gap-2 pb-8 pt-2",children:[n.slice(0,3).map((e,t)=>(0,s.jsxs)("div",{onClick:()=>{var t;null===(t=window)||void 0===t||t.open(null==e?void 0:e.link,"_blank")},className:"bg-surface-hover/60 hover:bg-surface-hover flex cursor-pointer flex-col justify-between rounded-md p-2",children:[(null==e?void 0:e.link)&&(0,s.jsxs)("div",{className:"flex flex-row items-center gap-1 pb-1",children:[(0,s.jsx)(f.LinkFavicon,{link:null==e?void 0:e.link,size:"sm"}),(0,s.jsx)("p",{className:"text-muted-foreground line-clamp-1 text-xs",children:(0,H.XF)(null==e?void 0:e.link)})]}),(0,s.jsx)("p",{className:"line-clamp-2 text-xs font-medium",children:null==e?void 0:e.title})]},t)),t.length>3&&(0,s.jsxs)("div",{className:"bg-surface-hover/60 hover:bg-surface-hover flex cursor-pointer flex-col items-start gap-1 rounded-md p-2",onClick:()=>{r({title:"Sources",badge:t.length,renderContent:()=>(0,s.jsx)(f.SourceList,{sources:t})})},children:[(0,s.jsx)("div",{className:"flex flex-row gap-1",children:t.slice(3).slice(0,5).map((e,t)=>(0,s.jsx)("div",{className:"flex flex-row items-center gap-1",children:(0,s.jsx)(f.LinkFavicon,{link:null==e?void 0:e.link,size:"sm"})},t))}),(0,s.jsx)("div",{className:"flex-1"}),(0,s.jsxs)("p",{className:"text-muted-foreground flex flex-row items-center gap-1 text-xs",children:["+",t.length-3," Sources"]})]},4)]})},Q=e=>{let{sources:t}=e;if(!t||!Array.isArray(t)||(null==t?void 0:t.length)===0)return null;let r=[...t].sort((e,t)=>(null==e?void 0:e.index)-(null==t?void 0:t.index));return(0,s.jsx)("div",{className:"flex min-h-full flex-col gap-6 py-3 pl-2 pr-4",children:r.map(e=>(0,s.jsxs)("div",{className:"flex w-full flex-row items-start gap-4",children:[(0,s.jsx)("div",{className:"text-primary bg-primary/20 group mx-0.5 my-0.5 inline-flex size-4 shrink-0 flex-row items-center justify-center gap-1 rounded-sm text-[10px] font-medium",children:null==e?void 0:e.index}),(0,s.jsx)(d.Ir,{source:e},e.link)]},e.link))})};var X=r(60912);let $=e=>{let{step:t}=e;return console.log(t),(0,s.jsxs)("div",{className:"flex w-full flex-row items-stretch justify-start gap-2",children:[(0,s.jsxs)("div",{className:"flex min-h-full shrink-0 flex-col items-center justify-start px-2",children:[(0,s.jsx)("div",{className:"bg-border/50 h-1.5 shrink-0"}),(0,s.jsx)("div",{className:"bg-background z-10",children:(0,s.jsx)(f.StepStatus,{status:t.status})}),(0,s.jsx)(u.E.div,{className:"border-border min-h-full w-[1px] flex-1 border-l border-dashed",initial:{height:0},animate:{height:"100%"},transition:{duration:.5}})]}),(0,s.jsxs)(u.E.div,{className:"flex w-full flex-1 flex-col gap-4 overflow-hidden pb-2 pr-2",initial:{opacity:0,y:5}
1,animate:{opacity:1,y:0},transition:{duration:.3},children:[(()=>{if((null==t?void 0:t.steps)&&"wrapup"in t.steps){var e,r,n,a;return(0,s.jsxs)(u.E.div,{className:"flex flex-col gap-2",initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{duration:.3,delay:.5},children:[(0,s.jsx)("div",{className:"w-[100px]",children:(0,s.jsx)(f.TextShimmer,{duration:.7,spread:(null===(r=t.steps)||void 0===r?void 0:null===(e=r.wrapup)||void 0===e?void 0:e.status)==="COMPLETED"?0:2,className:"text-xs",children:"Wrapping up"})}),(0,s.jsx)("p",{children:(null===(a=t.steps)||void 0===a?void 0:null===(n=a.wrapup)||void 0===n?void 0:n.data)||""})]})}return null})(),(null==t?void 0:t.text)?(0,s.jsx)(u.E.p,{className:"text-muted-foreground text-sm",initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{duration:.3,delay:.1},children:t.text}):null,(()=>{if((null==t?void 0:t.steps)&&"reasoning"in t.steps){var e,r,a,o;let i="string"==typeof(null===(r=t.steps)||void 0===r?void 0:null===(e=r.reasoning)||void 0===e?void 0:e.data)?t.steps.reasoning.data:"";return(0,s.jsxs)(u.E.div,{className:"flex flex-col gap-2",initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{duration:.3,delay:.4},children:[(0,s.jsx)("div",{className:"w-[100px]",children:(0,s.jsx)(f.TextShimmer,{duration:.7,spread:(null===(o=t.steps)||void 0===o?void 0:null===(a=o.reasoning)||void 0===a?void 0:a.status)==="COMPLETED"?0:2,className:"text-xs",children:"Analyzing"})}),(0,s.jsx)("p",{className:"text-muted-foreground text-sm",children:i.split("\n\n").map((e,t)=>(0,s.jsxs)(n.Fragment,{children:[(0,s.jsx)("span",{children:e}),(0,s.jsx)("br",{}),(0,s.jsx)("br",{})]},t))})]})}return null})(),(()=>{if((null==t?void 0:t.steps)&&"search"in(null==t?void 0:t.steps)){var e,r,n,a,o,i,l;return(0,s.jsx)(u.E.div,{className:"flex flex-col gap-1",initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{duration:.3,delay:.2},children:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)("div",{className:"w-[100px]",children:(0,s.jsx)(f.TextShimmer,{duration:.7,spread:(null===(r=t.steps)||void 0===r?void 0:null===(e=r.search)||void 0===e?void 0:e.status)==="COMPLETED"?0:2,className:"text-xs",children:"Searching"})}),(0,s.jsx)("div",{className:"flex flex-row flex-wrap gap-1",children:Array.isArray(null===(a=t.steps)||void 0===a?void 0:null===(n=a.search)||void 0===n?void 0:n.data)&&(null===(l=t.steps)||void 0===l?void 0:null===(i=l.search)||void 0===i?void 0:null===(o=i.data)||void 0===o?void 0:o.map((e,t)=>(0,s.jsx)(u.E.div,{initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{duration:.2,delay:.1+.05*t},children:(0,s.jsxs)(d.Ct,{children:[(0,s.jsx)(X.Z,{size:12,className:"opacity-50"}),e]})},t)))})]})})}})(),(()=>{if((null==t?void 0:t.steps)&&"read"in t.steps){var e,r,n,a;return(0,s.jsxs)(u.E.div,{className:"flex flex-col gap-2",initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{duration:.3,delay:.3},children:[(0,s.jsx)("div",{className:"w-[100px]",children:(0,s.jsx)(f.TextShimmer,{duration:.7,spread:(null===(r=t.steps)||void 0===r?void 0:null===(e=r.read)||void 0===e?void 0:e.status)==="COMPLETED"?0:2,className:"text-xs",children:"Reading"})}),(0,s.jsx)(f.SearchResultsList,{sources:Array.isArray(null===(a=t.steps)||void 0===a?void 0:null===(n=a.read)||void 0===n?void 0:n.data)?t.steps.read.data:[]})]})}return null})()]})]})},ee=e=>{let{status:t}=e;switch(t){case"PENDING":return(0,s.jsxs)("span",{className:"relative flex size-3 items-center justify-center",children:[(0,s.jsx)("span",{className:"bg-primary/50 absolute inline-flex h-full w-full animate-ping rounded-full opacity-75"}),(0,s.jsx)("span",{className:"bg-primary relative inline-flex size-1 rounded-full"})]});case"COMPLETED":return(0,s.jsx)("span",{className:"relative flex size-3 items-center justify-center",children:(0,s.jsx)("span",{className:"relative flex size-1",children:(0,s.jsx)("span",{className:"bg-primary relative inline-flex size-1 rounded-full"})})});case"ERROR":return(0,s.jsx)("span",{className:"relative flex size-3 items-center justify-center",children:(0,s.jsx)("span",{className:"relative flex size-1",children:(0,s.jsx)("span",{className:"relative inline-flex size-1 rounded-full bg-rose-400"})})});default:return(0,s.jsx)("span",{className:"relative flex size-3 items-center justify-center",children:(0,s.jsx)("span",{className:"relative flex size-1",children:(0,s.jsx)("span",{className:"bg-surface relative inline-flex size-1 rounded-full"})})})}},et=e=>{let{size:t=24,...r}=e;return(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:"0 0 44 44",stroke:"currentColor",...r,children:[(0,s.jsx)("title",{children:"Loading..."}),(0,s.jsxs)("g",{fill:"none",fillRule:"evenodd",strokeWidth:"3",children:[(0,s.jsxs)("circle",{cx:"22",cy:"22",r:"3",strokeWidth:3,children:[(0,s.jsx)("animate",{attributeName:"r",begin:"0s",dur:"1.8s",values:"1; 20",calcMode:"spline",keyTimes:"0;
1 1",keySplines:"0.165, 0.84, 0.44, 1",repeatCount:"indefinite"}),(0,s.jsx)("animate",{attributeName:"stroke-opacity",begin:"0s",dur:"1.8s",values:"1; 0",calcMode:"spline",keyTimes:"0; 1",keySplines:"0.3, 0.61, 0.355, 1",repeatCount:"indefinite"})]}),(0,s.jsxs)("circle",{cx:"22",cy:"22",r:"3",strokeWidth:3,children:[(0,s.jsx)("animate",{attributeName:"r",begin:"-0.9s",dur:"1.8s",values:"1; 20",calcMode:"spline",keyTimes:"0; 1",keySplines:"0.165, 0.84, 0.44, 1",repeatCount:"indefinite"}),(0,s.jsx)("animate",{attributeName:"stroke-opacity",begin:"-0.9s",dur:"1.8s",values:"1; 0",calcMode:"spline",keyTimes:"0; 1",keySplines:"0.3, 0.61, 0.355, 1",repeatCount:"indefinite"})]})]})]})},er=e=>{let{size:t=24,...r}=e;return(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:"0 0 24 24",...r,children:[(0,s.jsxs)("rect",{x:"5",y:"11",width:"3",height:"3",rx:"1.5",ry:"1.5",fill:"currentColor",children:[(0,s.jsx)("animate",{id:"stretch1",begin:"0;stretch3.end+0.25s",attributeName:"height",dur:"0.6s",values:"3;8;3",keySplines:".33,.66,.66,1;.33,0,.66,.33",calcMode:"spline"}),(0,s.jsx)("animate",{begin:"0;stretch3.end+0.25s",attributeName:"y",dur:"0.6s",values:"11;8;11",keySplines:".33,.66,.66,1;.33,0,.66,.33",calcMode:"spline"})]}),(0,s.jsxs)("rect",{x:"11",y:"11",width:"3",height:"3",rx:"1.5",ry:"1.5",fill:"currentColor",children:[(0,s.jsx)("animate",{begin:"stretch1.begin+0.1s",attributeName:"height",dur:"0.6s",values:"3;8;3",keySplines:".33,.66,.66,1;.33,0,.66,.33",calcMode:"spline"}),(0,s.jsx)("animate",{begin:"stretch1.begin+0.1s",attributeName:"y",dur:"0.6s",values:"11;8;11",keySplines:".33,.66,.66,1;.33,0,.66,.33",calcMode:"spline"})]}),(0,s.jsxs)("rect",{x:"17",y:"11",width:"3",height:"3",rx:"1.5",ry:"1.5",fill:"currentColor",children:[(0,s.jsx)("animate",{id:"stretch3",begin:"stretch1.begin+0.2s",attributeName:"height",dur:"0.6s",values:"3;8;3",keySplines:".33,.66,.66,1;.33,0,.66,.33",calcMode:"spline"}),(0,s.jsx)("animate",{begin:"stretch1.begin+0.2s",attributeName:"y",dur:"0.6s",values:"11;8;11",keySplines:".33,.66,.66,1;.33,0,.66,.33",calcMode:"spline"})]})]})},es={width:"1.2rem",height:"1.2rem",display:"flex",alignItems:"center"},en={display:"block",width:"0.2rem",height:"0.2rem",overflow:"hidden",marginLeft:"0.1rem",marginRight:"0.1rem",backgroundColor:"currentColor",borderRadius:"30%"},ea=()=>(0,s.jsxs)("div",{style:es,children:[(0,s.jsx)(u.E.span,{style:en,className:"shrink-0",animate:{y:[0,-4,0]},transition:{duration:.2,repeat:1/0,repeatDelay:.8,ease:"easeInOut"}}),(0,s.jsx)(u.E.span,{style:en,className:"shrink-0",animate:{y:[0,-4,0]},transition:{duration:.2,repeat:1/0,repeatDelay:.8,ease:"easeInOut",delay:.2}}),(0,s.jsx)(u.E.span,{style:en,className:"shrink-0",animate:{y:[0,-4,0]},transition:{duration:.2,repeat:1/0,repeatDelay:.8,ease:"easeInOut",delay:.4}})]});var eo=r(16463);function ei(){var e;let{threadId:t}=(0,eo.useParams)(),r=null!==(e=null==t?void 0:t.toString())&&void 0!==e?e:"",a=(0,l.aK)((0,m.N)(e=>e.getPreviousThreadItems(r))),o=(0,l.aK)((0,m.N)(e=>e.getCurrentThreadItem(r))),i=(0,l.aK)((0,m.N)(e=>e.isGenerating)),d=(0,n.useMemo)(()=>a.map(e=>(0,s.jsx)("div",{children:(0,s.jsx)(f.ThreadItem,{threadItem:e,isAnimated:!1,isGenerating:!1,isLast:!1},e.id)},e.id)),[a]);return(0,s.jsx)("div",{className:"relative",id:"thread-container",children:(0,s.jsxs)("div",{className:"flex min-w-full flex-col gap-8 px-2 py-4",children:[d,o&&(0,s.jsx)("div",{className:"min-h-[calc(100dvh-16rem)]",children:(0,s.jsx)(f.ThreadItem,{threadItem:o,isAnimated:!0,isGenerating:i,isLast:!0},o.id)},o.id)]})})}var el=r(30643),ed=r(26804),ec=r(96044);let eu=(0,n.memo)(e=>{var t,r,a,o,i,c,u;let{threadItem:m,isGenerating:x,isLast:h}=e,{isAnimationComplete:p,text:g}=(0,P.Cd)((null===(t=m.answer)||void 0===t?void 0:t.text)||"",h&&x),v=(0,l.aK)(e=>e.setCurrentSources),j=(0,n.useRef)(null),{ref:y,inView:b}=(0,ec.YD)({});(0,n.useEffect)(()=>{b&&m.id&&l.aK.getState().setActiveThreadItemView(m.id)},[b,m.id]),(0,n.useEffect)(()=>{var e;return v((null===(e=Object.values(m.steps||{}))||void 0===e?void 0:e.filter(e=>{var t,r,s;return e.steps&&"read"in(null==e?void 0:e.steps)&&!!(null===(s=e.steps)||void 0===s?void 0:null===(r=s.read)||void 0===r?void 0:null===(t=r.data)||void 0===t?void 0:t.length)}).flatMap(e=>{var t,r,s;return null===(s=e.steps)||void 0===s?void 0:null===(r=s.read)||void 0===r?void 0:null===(t=r.data)||void 0===t?void 0:t.map(e=>e.link)}).filter(e=>void 0!==e))||[])},[m]);let w=(0,n.useMemo)(()=>{var e,t;return(null===(e=m.answer)||void 0===e?void 0:e.text)&&(null===(t=m.answer)||void 0===t?void 0:t.text.length)>0},[m.answer]),N=(0,n.useMemo)(()=>{var e;return!!(null==m?void 0:m.steps)||!!(null==m?void 0:null===(e=m.answer)||void 0===e?void 0:e.text)||!!(null==m?void 0:m.object)||!!(null==m?void 0:m.error)||(null==m?void 0:m.status)==="COMPLETED"||(null==m?void 0:m.status)==="ABORTED"||(null==m?void 0:m.status)==="ERROR"},[m]);
1return(0,s.jsx)(f.CitationProvider,{sources:m.sources||[],children:(0,s.jsx)("div",{className:"w-full",ref:y,id:"thread-item-".concat(m.id),children:(0,s.jsxs)("div",{className:(0,d.cn)("flex w-full flex-col items-start gap-3 pt-4"),children:[m.query&&(0,s.jsx)(f.Message,{message:m.query,imageAttachment:null==m?void 0:m.imageAttachment,threadItem:m}),((null===(r=m.answer)||void 0===r?void 0:r.thinking)||(null===(a=m.answer)||void 0===a?void 0:a.reasoning))&&(0,s.jsxs)("div",{className:"flex w-full flex-col gap-3",children:[(null===(o=m.answer)||void 0===o?void 0:o.thinking)&&(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"text-muted-foreground flex flex-row items-center gap-1.5 text-xs font-medium",children:[(0,s.jsx)(el.Z,{size:16,strokeWidth:2}),"Thinking"]}),(0,s.jsx)("div",{className:"text-muted-foreground rounded-lg border border-border bg-muted/30 p-3 text-sm",children:(0,s.jsx)("pre",{className:"whitespace-pre-wrap font-sans",children:m.answer.thinking})})]}),(null===(i=m.answer)||void 0===i?void 0:i.reasoning)&&(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"text-muted-foreground flex flex-row items-center gap-1.5 text-xs font-medium",children:[(0,s.jsx)(el.Z,{size:16,strokeWidth:2}),"Reasoning"]}),(0,s.jsx)("div",{className:"text-muted-foreground rounded-lg border border-border bg-muted/30 p-3 text-sm",children:(0,s.jsx)("pre",{className:"whitespace-pre-wrap font-sans",children:m.answer.reasoning})})]})]}),(0,s.jsxs)("div",{className:"text-muted-foreground flex flex-row items-center gap-1.5 text-xs font-medium",children:[(0,s.jsx)(el.Z,{size:16,strokeWidth:2}),"Answer"]}),m.steps&&(0,s.jsx)(f.Steps,{steps:Object.values((null==m?void 0:m.steps)||{}),threadItem:m}),!N&&(0,s.jsxs)("div",{className:"flex w-full flex-col items-start gap-2 opacity-10",children:[(0,s.jsx)(f.MotionSkeleton,{className:"bg-muted-foreground/40 mb-2 h-4 !w-[100px] rounded-sm"}),(0,s.jsx)(f.MotionSkeleton,{className:"w-full bg-gradient-to-r"}),(0,s.jsx)(f.MotionSkeleton,{className:"w-[70%] bg-gradient-to-r"}),(0,s.jsx)(f.MotionSkeleton,{className:"w-[50%] bg-gradient-to-r"})]}),(0,s.jsx)("div",{ref:j,className:"w-full",children:w&&(null===(c=m.answer)||void 0===c?void 0:c.text)&&(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)(f.SourceGrid,{sources:m.sources||[]}),(0,s.jsx)(f.MarkdownContent,{content:g||"",isCompleted:["COMPLETED","ERROR","ABORTED"].includes(m.status||""),shouldAnimate:!["COMPLETED","ERROR","ABORTED"].includes(m.status||""),isLast:h},"answer-".concat(m.id))]})}),(0,s.jsx)(f.QuestionPrompt,{threadItem:m}),m.error&&(0,s.jsx)(d.bZ,{variant:"destructive",children:(0,s.jsxs)(d.X,{children:[(0,s.jsx)(ed.Z,{className:"mt-0.5 size-3.5"}),"string"==typeof m.error?m.error:"Something went wrong while processing your request. Please try again."]})}),"ABORTED"===m.status&&(0,s.jsx)(d.bZ,{variant:"warning",children:(0,s.jsxs)(d.X,{children:[(0,s.jsx)(ed.Z,{className:"mt-0.5 size-3.5"}),null!==(u=m.error)&&void 0!==u?u:"Generation stopped"]})}),p&&("COMPLETED"===m.status||"ABORTED"===m.status||"ERROR"===m.status||!x)&&(0,s.jsx)(f.MessageActions,{threadItem:m,ref:j,isLast:h}),p&&h&&(0,s.jsx)(f.FollowupSuggestions,{suggestions:m.suggestions||[]})]})})})},(e,t)=>JSON.stringify(e.threadItem)===JSON.stringify(t.threadItem));eu.displayName="ThreadItem";let em=()=>{let{threadId:e}=(0,eo.useParams)(),t=(0,l.aK)((0,m.N)(e=>e.getThread)),[r,a]=(0,n.useState)(null);return(0,n.useEffect)(()=>{var r;t(null!==(r=null==e?void 0:e.toString())&&void 0!==r?r:"").then(a)},[e]),(0,s.jsx)("div",{className:"border-border bg-secondary absolute left-0 right-0 top-0 z-[100] flex h-10 w-full flex-row items-center justify-center border-b",children:(0,s.jsx)("p",{className:"line-clamp-1 max-w-xl text-sm font-medium",children:null==r?void 0:r.title})})};var ex=r(89958);let ef=(0,n.memo)(e=>{let{toolCall:t}=e,[r,a]=(0,n.useState)(!1),o=(0,n.useCallback)(()=>a(e=>!e),[]);return(0,s.jsxs)("div",{className:"flex w-full flex-col items-start overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex w-full cursor-pointer flex-row items-center justify-between gap-2.5 pb-2 pt-2",onClick:o,children:[(0,s.jsxs)("div",{className:"flex flex-row items-center gap-2.5",children:[(0,s.jsx)(f.ToolIcon,{}),(0,s.jsx)(d.Ct,{children:t.toolName})]}),(0,s.jsx)("div",{className:"pr-2",children:(0,s.jsx)(ex.Z,{size:14,strokeWidth:2,className:(0,d.cn)("text-muted-foreground transform transition-transform",r&&"rotate-180")}
1)})]}),r&&(0,s.jsx)("div",{className:"flex w-full flex-row items-center gap-2.5",children:(0,s.jsx)(f.CodeBlock,{variant:"secondary",showHeader:!1,lang:"json",className:"my-2",code:JSON.stringify(t.args,null,2)})})]})});ef.displayName="ToolCallStep";let eh=(0,n.memo)(e=>{let{toolResult:t}=e,[r,a]=(0,n.useState)(!1),o=(0,n.useCallback)(()=>a(e=>!e),[]);return(0,s.jsxs)("div",{className:"overflow-hidde flex w-full flex-col items-start",children:[(0,s.jsxs)("div",{className:"flex w-full cursor-pointer flex-row items-center justify-between gap-2.5 pb-2 pt-2",onClick:o,children:[(0,s.jsxs)("div",{className:"flex flex-row items-center gap-2.5",children:[(0,s.jsx)(f.ToolResultIcon,{}),(0,s.jsx)(d.Ct,{children:"Result"}),(0,s.jsx)(d.Ct,{children:t.toolName})]}),(0,s.jsx)("div",{className:"pr-2",children:(0,s.jsx)(ex.Z,{size:14,strokeWidth:2,className:(0,d.cn)("text-muted-foreground transform transition-transform",r&&"rotate-180")})})]}),r&&(0,s.jsx)("div",{className:"flex w-full flex-row items-center gap-2.5",children:(0,s.jsx)(f.CodeBlock,{variant:"secondary",showHeader:!1,lang:"json",className:"my-2",code:JSON.stringify(t.result,null,2)})})]})});eh.displayName="ToolResultStep";var ep=r(37213);function eg(e){let{children:t,renderContent:r}=e;return(0,s.jsxs)(ep.Drawer.Root,{direction:"right",children:[(0,s.jsx)(ep.Drawer.Trigger,{asChild:!0,children:t}),(0,s.jsxs)(ep.Drawer.Portal,{children:[(0,s.jsx)(ep.Drawer.Overlay,{className:"fixed inset-0 bg-secondary/90"}),(0,s.jsx)(ep.Drawer.Content,{className:"fixed bottom-2 overflow-hidden rounded-lg  right-2 bg-secondary top-2 z-10 flex w-[610px] outline-none",children:(0,s.jsx)("div",{className:"flex h-full w-full grow flex-col border border-border overflow-y-auto rounded-[16px] bg-secondary p-6",children:r()})})]})]})}},69334:function(e,t,r){"use strict";r.r(t),r.d(t,{ReactQueryProvider:function(){return i}});var s=r(57437),n=r(90413),a=r(93191);let o=new n.S({defaultOptions:{queries:{retry:1}}}),i=e=>{let{children:t}=e;return(0,s.jsx)(a.aH,{client:o,children:t})}},51477:function(e,t,r){"use strict";r.r(t),r.d(t,{RootContext:function(){return a},RootProvider:function(){return o},useRootContext:function(){return i}});var s=r(57437),n=r(2265);let a=(0,n.createContext)(null),o=e=>{let{children:t}
1=e,[r,o]=(0,n.useState)(!0),[i,l]=(0,n.useState)(!1),[d,c]=(0,n.useState)(!1);return(0,s.jsx)(a.Provider,{value:{isSidebarOpen:r,setIsSidebarOpen:o,isCommandSearchOpen:d,setIsCommandSearchOpen:c,isMobileSidebarOpen:i,setIsMobileSidebarOpen:l},children:t})},i=()=>{let e=(0,n.useContext)(a);if(!e)throw Error("useRootContext must be used within a RootProvider");return e}},68636:function(e,t,r){"use strict";r.d(t,{E:function(){return f},z:function(){return x}});var s=r(57437),n=r(5315),a=r(11533),o=r(72290),i=r(16463),l=r(2265),d=r(5520),c=r(33702),u=r(59279);let m=(0,l.createContext)(void 0),x=e=>{let{children:t}=e,{threadId:r}=(0,i.useParams)(),{updateThreadItem:x,setIsGenerating:f,setAbortController:h,createThreadItem:p,setCurrentThreadItem:g,setCurrentSources:v,updateThread:j,chatMode:y,customInstructions:b}=(0,d.aK)(e=>({updateThreadItem:e.updateThreadItem,setIsGenerating:e.setIsGenerating,setAbortController:e.setAbortController,createThreadItem:e.createThreadItem,setCurrentThreadItem:e.setCurrentThreadItem,setCurrentSources:e.setCurrentSources,updateThread:e.updateThread,chatMode:e.chatMode,customInstructions:e.customInstructions})),{push:w}=(0,i.useRouter)(),N=(0,d.U7)(e=>e.getSelectedMCP),k=(0,d.Vi)(e=>e.getAllKeys),C=(0,d.Vi)(e=>e.mode),S=(0,d.Vi)(e=>e.hasApiKeyForChatMode),I=(0,d.Vi)(e=>e.getApiKeyNameForChatMode),T=(0,d.qr)(e=>e.setIsSettingsOpen),E=(0,d.qr)(e=>e.setSettingTab),A=(0,d.qr)(e=>e.setShowSignInModal),z=(0,l.useMemo)(()=>new Map,[]),D=["steps","sources","answer","error","status","suggestions","toolCalls","toolResults","object"],R=(0,l.useCallback)(function(e,t,r,s,n){let a=!(arguments.length>5)||void 0===arguments[5]||arguments[5];console.log("handleThreadItemUpdate",t,r,s,a);let o=z.get(t);if(!o){let e=d.aK.getState().threadItems.find(e=>e.id===t);o=e||{},e&&z.set(t,e)}let i={...o,query:(null==s?void 0:s.query)||o.query||"",mode:(null==s?void 0:s.mode)||o.mode,threadId:e,parentId:n||o.parentId,id:t,object:(null==s?void 0:s.object)||o.object,createdAt:o.createdAt||new Date,updatedAt:new Date,..."answer"===r?{answer:{...s.answer,text:s.answer.text}}:{[r]:s[r]}};z.set(t,i),x(e,{...i,persistToDB:!0})},[z,x]),M=(0,l.useCallback)(async e=>{console.log("[DEBUG] runAgent called with body:",e);let t=new AbortController;h(t),f(!0);let r=performance.now();t.signal.addEventListener("abort",()=>{console.info("[DEBUG] Abort controller triggered"),f(!1),x(e.threadId,{id:e.threadItemId,status:"ABORTED",persistToDB:!0})});try{console.log("[DEBUG] Fetching /api/completion...");let r=await fetch("/api/completion",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),credentials:"include",cache:"no-store",signal:t.signal});if(console.log("[DEBUG] Response received:",{ok:r.ok,status:r.status,statusText:r.statusText,headers:Object.fromEntries(r.headers.entries())}),!r.ok){console.error("[DEBUG] Response not OK, status:",r.status);let t=await r.text();throw console.error("[DEBUG] Error text:",t),r.status,429===r.status&&(t="You have reached the daily limit of requests. Please sign in to enjoy more requests."),f(!1),x(e.threadId,{id:e.threadItemId,status:"ERROR",error:t,persistToDB:!0}),console.error("[DEBUG] Error response:",t),Error("HTTP error! status: ".concat(r.status))}if(!r.body)throw console.error("[DEBUG] No response body received"),Error("No response body received");console.log("[DEBUG] Starting to read response stream...");let s=r.body.getReader(),n=new TextDecoder,a=Date.now(),o=0,i=performance.now(),l="";for(console.log("[DEBUG] Stream reader initialized");;)try{let{value:e,done:t}=await s.read();if(t){console.log("[DEBUG] Stream done, total events:",o);break}let r=(l+=n.decode(e,{stream:!0})).split("\n\n");for(let e of(l=r.pop()||"",r)){if(!e.trim())continue;let t=e.match(/^event: (.+)$/m),r=e.match(/^data: (.+)$/m);if(t&&r){let e=t[1];o++,console.log("[DEBUG] Event received:",e,"count:",o);try{let t=JSON.parse(r[1]);if(console.log("[DEBUG] Event data:",t),D.includes(e)&&(null==t?void 0:t.threadId)&&(null==t?void 0:t.threadItemId)){let r=Date.now()-a>=1e3;R(t.threadId,t.threadItemId,e,t,t.parentThreadItemId,r),r&&(a=Date.now())}else if("done"===e&&"done"===t.type){f(!1);let e=performance.now()-i;console.log("done event received",o,"Stream duration: ".concat(e.toFixed(2),"ms")),t.threadItemId&&z.delete(t.threadItemId),"error"===t.status&&console.error("Stream error:",t.error)}}catch(e){console.warn("JSON parse error for data:",r[1],e)}}}}catch(e){console.error("Error reading from stream:",e),await new Promise(e=>setTimeout(e,1e3));continue}}catch(s){let t=performance.now()-r;console.error("Fatal stream error:",s,"Total time: ".concat(t.toFixed(2),"ms")),f(!1),"AbortError"===s.name?x(e.threadId,{id:e.threadItemId,status:"ABORTED",error:"Generation aborted"}):s.message.includes("429")?x(e.threadId,{id:e.threadItemId,status:"ERROR",error:"You have reached the daily limit of requests. Please try again tomorrow or Use your own API key."}):x(e.threadId,{id:e.threadItemId,status:"ERROR",error:"Something went wrong. Please try again."})}finally{f(!1);let e=performance.now()-r;console.info("Stream completed in ".concat(e.toFixed(2),"ms"))}},[h,f,x,R,D,z]),P=(0,l.useCallback)(async e=>{var t;let{formData:i,newThreadId:l,existingThreadItemId:d,newChatMode:m,messages:x,useWebSearch:h,showSuggestions:A}=e,D=m||y;if(null===(t=n.UJ[D])||void 0===t?void 0:t.isAuthRequired){w("/sign-in");return}let R=(null==r?void 0:r.toString())||l;if(!R)return;j({id:R,title:i.get("query")});let P=d||(0,o.x0)(),_=i.get("query"),O=i.get("imageAttachment"),W={id:P,createdAt:new Date,updatedAt:new Date,status:"QUEUED",threadId:R,query:_,imageAttachment:O,mode:D};z.set(P,W),p(W),g(W),f(!0),v([]);let G=(0,a.tH)({messages:x||[],query:_,imageAttachment:O}),U=k();console.log("[DEBUG SUBMIT] API Keys available:",{hasOpenAI:!!U.OPENAI_API_KEY,hasAnthropic:!!U.ANTHROPIC_API_KEY,hasGemini:!!U.GEMINI_API_KEY,hasFireworks:!!U.FIREWORKS_API_KEY});let L=await S(D);if(console.log("[DEBUG SUBMIT] hasApiKeyForChatMode:",L,"mode:",D,"apiKeyMode:",C),!L){let e=I(D),t=(0,n.Wd)(D);(0,u.Am)({variant:"destructive",title:"API Key Required",description:e?"To use ".concat(t,", please add your ").concat(e," in Settings."):"To use ".concat(t,", please add your API key in Settings."),action:(0,s.jsx)(u.gD,{altText:"Open Settings",onClick:()=>{T(!0),E(c.o.API_KEYS)},children:"Open Settings"})}),f(!1);return}console.log("[DEBUG SUBMIT] Using runAgent (API route)"),M({mode:m||y,prompt:_,threadId:R,messages:G,mcpConfig:N(),threadItemId:P,customInstru
1ctions:b,parentThreadItemId:"",webSearch:h,showSuggestions:null==A||A,apiKeys:"own"===C?U:void 0,apiKeyMode:C})},[!1,r,y,A,j,p,g,f,v,b,N,k,S,I,T,E,x,M]),_=(0,l.useCallback)((e,t)=>{console.info("Updating context",t),x(e,{id:t.threadItemId,parentId:t.parentThreadItemId,threadId:t.threadId,metadata:t.context})},[x]),O=(0,l.useMemo)(()=>({runAgent:M,handleSubmit:P,updateContext:_}),[M,P,_]);return(0,s.jsx)(m.Provider,{value:O,children:t})},f=()=>{let e=(0,l.useContext)(m);if(!e)throw Error("useAgentStream must be used within an AgentProvider");return e}},94218:function(e,t,r){"use strict";r.d(t,{zl:function(){return s.z},EU:function(){return s.E},Cd:function(){return i},e:function(){return d.e},oM:function(){return l},m0:function(){return x}});var s=r(68636),n=r(45282),a=r(71192),o=r(2265);function i(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=(0,n.c)(0),[s,i]=(0,o.useState)(0),[l,d]=(0,o.useState)(e),[c,u]=(0,o.useState)(!0),[m,x]=(0,o.useState)(!t);if(l===e||(d(e),u(e.startsWith(l)),e.startsWith(l)||(i(0),x(!1))),(0,o.useEffect)(()=>{if(!t){x(!0);return}c||(r.jump(0),x(!1));let s=e.split(" ").length,n=(0,a.j)(r,s,{duration:3,ease:"easeOut",onUpdate(e){i(Math.floor(e))},onComplete(){i(s),x(!0)}});return()=>n.stop()},[r,c,e,t]),!t)return{text:e,isAnimationComplete:!0};let f=e.split(" ");return{text:(s>=f.length?f:f.slice(0,s)).join(" "),isAnimationComplete:s>=f.length}}let l=()=>{let[e,t]=(0,o.useState)("idle"),[r,s]=(0,o.useState)("idle");return{status:e,copyToClipboard:(0,o.useCallback)(async e=>{try{let r=document.createRange(),s=window.getSelection();if(!s)throw Error("No selection object available");return s.removeAllRanges(),r.selectNodeContents(e),s.addRange(r),document.execCommand("copy"),s.removeAllRanges(),t("copied"),setTimeout(()=>t("idle"),2e3),!0}catch(e){return t("error"),!1}},[]),copyMarkdown:(0,o.useCallback)(async e=>{if(e)try{await navigator.clipboard.writeText(e),s("copied"),setTimeout(()=>s("idle"),2e3)}catch(e){s("error")}},[]),markdownCopyStatus:r}};var d=r(83898),c=r(5520),u=r(59279),m=r(51929);let x=()=>{(0,c.aK)(e=>e.imageAttachment);let e=(0,c.aK)(e=>e.setImageAttachment),t=(0,c.aK)(e=>e.clearImageAttachment),r=(0,o.useCallback)(e=>{a(null==e?void 0:e[0])},[]),s=(0,m.uI)({onDrop:r,multiple:!1,noClick:!0}),{toast:n}=(0,u.pm)(),a=async t=>{let r=new FileReader;if(t&&!["image/jpeg","image/png","image/gif"].includes(null==t?void 0:t.type)){n({title:"Invalid format",description:"Please select a valid image (JPEG, PNG, GIF).",variant:"destructive"});return}if(t&&t.size>3145728){n({title:"File too large",description:"Image size should be less than 3MB.",variant:"destructive"});return}r.onload=()=>{var s;if("string"!=typeof r.result)return;let n=null==r?void 0:null===(s=r.result)||void 0===s?void 0:s.split(",")[1];e({base64:"data:".concat(null==t?void 0:t.type,";base64,").concat(n)})},t&&(e({file:t}),r.readAsDataURL(t))};return{dropzonProps:s,handleImageUpload:async e=>{var t;a(null===(t=e.target.files)||void 0===t?void 0:t[0])},clearAttachment:()=>{t()}}}},83898:function(e,t,r){"use strict";r.d(t,{e:function(){return f}});var s=r(11533),n=r(44308),a=r(1679),o=r(57493),i=r(70227),l=r(72100),d=r(98041),c=r(75665),u=r(23705),m=r(2265),x=r(5520);let f=e=>{let t=(0,x.aK)(e=>e.setEditor),r=(0,u.jE)({extensions:[a.B,l.n,c.x,d.V.configure({placeholder:(null==e?void 0:e.placeholder)||"Ask anything"}),n.Z.configure({limit:(null==e?void 0:e.charLimit)||4e5}),...(null==e?void 0:e.enableEnter)?[]:[s.Dp,s.pj],i.y$.configure({HTMLAttributes:{class:"prompt-highlight"}}),o.U],immediatelyRender:!1,content:"",autofocus:!0,onTransaction(e){let{editor:t}=e,r=t.getText(),s=t.getHTML();if("/"===r);else{let e=s.replace(/::((?:(?!::).)+)::/g,(e,t)=>' <mark class="prompt-highlight">'.concat(t,"</mark> "));e!==s&&t.commands.setContent(e,!0,{preserveWhitespace:!0})}},onCreate(t){(null==e?void 0:e.defaultContent)&&t.editor.commands.setContent((null==e?void 0:e.defaultContent)||"",!0,{preserveWhitespace:!0}),(null==e?void 0:e.onInit)&&e.onInit({editor:t.editor})},onUpdate(t){let{editor:r}=t;(null==e?void 0:e.onUpdate)&&e.onUpdate({editor:r})},parseOptions:{preserveWhitespace:"full"}});return(0,m.useEffect)(()=>{t(r)},[r]),(0,m.useEffect)(()=>{r&&r.commands.focus("end")},[r]),{editor:r}}},15425:function(e,t,r){"use strict";r.d(t,{cn:function(){return a}});var s=r(44839),n=r(96164);function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,n.m6)((0,s.W)(t))}},73218:function(e,t,r){"use strict";r.d(t,{V:function(){return o}});var s=r(5315),n=r(39099),a=r(89291);let o=(0,n.Ue)()((0,a.tJ)((e,t)=>({keys:{},mode:"own",setKey:(t,r)=>e(e=>({keys:{...e.keys,[t]:r}})),removeKey:t=>e(e=>{let r={...e.keys};return delete r[t],{keys:r}}),clearAllKeys:()=>e({keys:{}}),getAllKeys:()=>t().keys,setMode:t=>e({mode:t}),hasApiKeyForChatMode:async e=>{let r=t();if("own"===(r.mode||"own")){let t=r.keys;switch(e){case s.jE.O4_Mini:case s.jE.GPT_4o_Mini:case s.jE.GPT_4_1_Mini:case s.jE.GPT_4_1_Nano:case s.jE.GPT_4_1:return!!t.OPENAI_API_KEY;case s.jE.GEMINI_2_FLASH:return!!t.GEMINI_API_KEY;case s.jE.CLAUDE_3_5_SONNET:case s.jE.CLAUDE_3_7_SONNET:return!!t.ANTHROPIC_API_KEY;case s.jE.DEEPSEEK_R1:case s.jE.LLAMA_4_SCOUT:return!!t.FIREWORKS_API_KEY;default:return!1}}try{let t=await fetch("/api/check-env-keys");if(!t.ok)return!1;let r=await t.json();switch(e){case s.jE.O4_Mini:case s.jE.GPT_4o_Mini:case s.jE.GPT_4_1_Mini:case s.jE.GPT_4_1_Nano:case s.jE.GPT_4_1:return!!r.OPENAI_API_KEY;case s.jE.GEMINI_2_FLASH:return!!r.GEMINI_API_KEY;case s.jE.CLAUDE_3_5_SONNET:case s.jE.CLAUDE_3_7_SONNET:return!!r.ANTHROPIC_API_KEY;case s.jE.DEEPSEEK_R1:case s.jE.LLAMA_4_SCOUT:return!!r.FIREWORKS_API_KEY;default:return!1}}catch(e){return console.error("Error checking .env keys:",e),!1}},getApiKeyNameForChatMode:e=>{switch(e){case s.jE.O4_Mini:case s.jE.GPT_4o_Mini:case s.jE.GPT_4_1_Mini:case s.jE.GPT_4_1_Nano:case s.jE.GPT_4_1:return"OpenAI API Key";case s.jE.GEMINI_2_FLASH:return"Google Gemini API Key";case s.jE.CLAUDE_3_5_SONNET:case s.jE.CLAUDE_3_7_SONNET:return"Anthropic API Key";case s.jE.DEEPSEEK_R1:case s.jE.LLAMA_4_SCOUT:return"Fireworks API Key";default:return null}}}),{name:"api-keys-storage"}))},33702:function(e,t,r){"use strict";r.d(t,{o:function(){return a},q:function(){return o}});var s=r(39099),n=r(52844);let a={API_KEYS:"api-keys",MCP_TOOLS:"mcp-tools",PERSONALIZATION:"personalization"},o=(0,s.Ue)((0,n.n)((e,t)=>
1({isSidebarOpen:!0,isSourcesOpen:!1,isSettingsOpen:!1,settingTab:"api-keys",showSignInModal:!1,setIsSidebarOpen:r=>e({isSidebarOpen:r(t().isSidebarOpen)}),setIsSourcesOpen:r=>e({isSourcesOpen:r(t().isSourcesOpen)}),setIsSettingsOpen:t=>e({isSettingsOpen:t}),setSettingTab:t=>e({settingTab:t}),setShowSignInModal:t=>e({showSignInModal:t}),sideDrawer:{open:!1,title:"",renderContent:()=>null,badge:void 0},openSideDrawer:t=>{e({sideDrawer:{...t,open:!0}})},updateSideDrawer:t=>e(e=>({sideDrawer:{...e.sideDrawer,...t}})),dismissSideDrawer:()=>e({sideDrawer:{open:!1,title:"",renderContent:()=>null,badge:void 0}})})))},99739:function(e,t,r){"use strict";let s,n;r.d(t,{a:function(){return S}});var a,o,i,l=r(5315);(a=i||(i={})).GPT_4o_Mini="gpt-4o-mini",a.GPT_4o="gpt-4o",a.GPT_4_1_Mini="gpt-4.1-mini",a.GPT_4_1_Nano="gpt-4.1-nano",a.GPT_4_1="gpt-4.1",a.LLAMA_4_SCOUT="accounts/fireworks/models/llama4-scout-instruct-basic",a.Deepseek_R1_Distill_Qwen_14B="deepseek-r1-distill-qwen-14b",a.Claude_3_5_Sonnet="claude-3-5-sonnet-20240620",a.O4_Mini="o4-mini",a.GEMINI_2_FLASH="gemini-2.5-flash-preview-09-2025",a.QWQ_32B="accounts/fireworks/models/qwq-32b",a.Deepseek_R1="accounts/fireworks/models/deepseek-r1",a.Claude_3_7_Sonnet="claude-3-7-sonnet-20250219";let d=[{id:"gpt-4o-mini",name:"GPT-4o Mini",provider:"openai",maxTokens:16384,contextWindow:16384},{id:"gpt-4.1-mini",name:"GPT-4.1 Mini",provider:"openai",maxTokens:16384,contextWindow:16384},{id:"gpt-4.1-nano",name:"GPT-4.1 Nano",provider:"openai",maxTokens:16384,contextWindow:16384},{id:"gpt-4.1",name:"GPT-4.1",provider:"openai",maxTokens:16384,contextWindow:16384},{id:"gpt-4o",name:"GPT-4o",provider:"openai",maxTokens:16384,contextWindow:16384},{id:"o4-mini",name:"O4 Mini",provider:"openai",maxTokens:16384,contextWindow:16384},{id:"gpt-4o-mini",name:"GPT-4o Mini",provider:"openai",maxTokens:16384,contextWindow:16384},{id:"deepseek-r1-distill-qwen-14b",name:"DeepSeek R1 Distill Qwen 14B",provider:"together",maxTokens:16384,contextWindow:16384},{id:"accounts/fireworks/models/deepseek-r1",name:"DeepSeek R1",provider:"fireworks",maxTokens:16384,contextWindow:16384},{id:"claude-3-5-sonnet-20240620",name:"Claude 3.5 Sonnet",provider:"anthropic",maxTokens:16384,contextWindow:16384},{id:"claude-3-7-sonnet-20250219",name:"Claude 3.7 Sonnet",provider:"anthropic",maxTokens:16384,contextWindow:16384},{id:"gemini-2.5-flash-preview-09-2025",name:"Gemini 2 Flash",provider:"google",maxTokens:2e5,contextWindow:2e5},{id:"accounts/fireworks/models/qwq-32b",name:"QWQ 32B",provider:"fireworks",maxTokens:16384,contextWindow:16384},{id:"accounts/fireworks/models/llama4-scout-instruct-basic",name:"Llama 4 Scout",provider:"fireworks",maxTokens:16384,contextWindow:16384}];var c=r(14635),u=r(72290),m=r(39099),x=r(52844),f=r(33702);class h extends c.ZP{constructor(){super("ThreadDatabase"),this.version(1).stores({threads:"id, createdAt",threadItems:"id, threadId, parentId, createdAt"})}}let p="chat-config";s=new h,p="chat-config";let g=async()=>{var e,t;let r=await s.threads.toArray(),n=localStorage.getItem(p),a=n?JSON.parse(n):{customInstructions:void 0,model:d[0].id,useWebSearch:!1,showSuggestions:!0,chatMode:l.jE.GEMINI_2_FLASH},o=a.chatMode||l.jE.GEMINI_2_FLASH,i="boolean"==typeof a.useWebSearch&&a.useWebSearch,c=a.customInstructions||"",u=r.length?r:[];return{threads:u.sort((e,t)=>{var r,s;return(null===(r=t.createdAt)||void 0===r?void 0:r.getTime())-(null===(s=e.createdAt)||void 0===s?void 0:s.getTime())}),currentThreadId:a.currentThreadId||(null===(e=u[0])||void 0===e?void 0:e.id),config:a,useWebSearch:i,chatMode:o,customInstructions:c,showSuggestions:null===(t=a.showSuggestions)||void 0===t||t}},v={},j={items:new Map,timeoutId:null},y=async()=>{if(0===j.items.size)return;let e=Array.from(j.items.values());j.items.clear();try{await s.threadItems.bulkPut(e),e.forEach(e=>{v[e.id]=Date.now()})}catch(t){for(let r of(console.error("Failed to batch update thread items:",t),e))try{await s.threadItems.put(r),v[r.id]=Date.now()}catch(e){console.error("Failed to update item ".concat(r.id,":"),e)}}},b=e=>{j.items.set(e.id,e),j.timeoutId||(j.timeoutId=setTimeout(()=>{y(),j.timeoutId=null},500))},w=null,N=()=>{var e,t,r;console.log("[DEBUG] initializeWorker called");try{console.log("[DEBUG] Attempting to create SharedWorker"),console.log("[DEBUG] import.meta.url:",(e={},void 0===e)?void 0:e.url);let r=new URL("./db-sync-web-worker.ts",(t={},void 0===t)?void 0:t.url);console.log("[DEBUG] Worker URL:",r.href),w=new SharedWorker(r,{type:"module"}),console.log("[DEBUG] SharedWorker created successfully"),w.port.onmessage=async e=>{var t,r;let n=e.data;if(n&&n.type)switch(n.type){case"connected":console.log("Connected to SharedWorker");break;case"thread-update":let a=await s.threads.toArray();S.setState({threads:a.sort((e,t)=>
1t.createdAt.getTime()-e.createdAt.getTime())});break;case"thread-item-update":let o=S.getState().currentThreadId;(null===(t=n.data)||void 0===t?void 0:t.threadId)===o&&await S.getState().loadThreadItems(n.data.threadId);break;case"thread-delete":S.setState(e=>{let t={...e};if(t.threads=e.threads.filter(e=>e.id!==n.data.threadId),e.currentThreadId===n.data.threadId){var r;t.currentThreadId=(null===(r=t.threads[0])||void 0===r?void 0:r.id)||null,t.currentThread=t.threads[0]||null}return t});break;case"thread-item-delete":(null===(r=n.data)||void 0===r?void 0:r.threadId)===S.getState().currentThreadId&&S.setState(e=>({threadItems:e.threadItems.filter(e=>e.id!==n.data.id)}))}},w.port.start(),w.onerror=e=>{console.error("[DEBUG] SharedWorker error:",e),console.error("[DEBUG] Error details:",JSON.stringify(e,null,2))},console.log("[DEBUG] SharedWorker initialization complete")}catch(e){console.error("[DEBUG] Failed to initialize SharedWorker:",e),console.error("[DEBUG] Error type:",null==e?void 0:null===(r=e.constructor)||void 0===r?void 0:r.name),console.error("[DEBUG] Error message:",null==e?void 0:e.message),console.error("[DEBUG] Error stack:",null==e?void 0:e.stack),console.log("[DEBUG] Falling back to localStorage sync"),k()}},k=()=>{console.log("[DEBUG] initializeTabSync called (fallback method)");let e="chat-store-sync-event",t="chat-store-sync-data";window.addEventListener("storage",r=>{if(r.key===e)try{var n,a;let e=JSON.parse(localStorage.getItem(t)||"{}");if(!e||!e.type)return;switch(e.type){case"thread-update":s.threads.toArray().then(e=>{S.setState({threads:e.sort((e,t)=>t.createdAt.getTime()-e.createdAt.getTime())})});break;case"thread-item-update":let r=S.getState().currentThreadId;(null===(n=e.data)||void 0===n?void 0:n.threadId)===r&&S.getState().loadThreadItems(e.data.threadId);break;case"thread-delete":S.setState(t=>{let r={...t};if(r.threads=t.threads.filter(t=>t.id!==e.data.threadId),t.currentThreadId===e.data.threadId){var s;r.currentThreadId=(null===(s=r.threads[0])||void 0===s?void 0:s.id)||null,r.currentThread=r.threads[0]||null}return r});break;case"thread-item-delete":(null===(a=e.data)||void 0===a?void 0:a.threadId)===S.getState().currentThreadId&&S.setState(t=>({threadItems:t.threadItems.filter(t=>t.id!==e.data.id)}))}}catch(e){console.error("Error processing sync data:",e)}}),window.notifyTabSync=(r,s)=>{try{localStorage.setItem(t,JSON.stringify({type:r,data:s,timestamp:Date.now()})),localStorage.setItem(e,Date.now().toString())}catch(e){console.error("Error notifying other tabs:",e)}}},C=(o=(e,t)=>{if(!w){window.notifyTabSync&&window.notifyTabSync(e,t);return}try{w.port.postMessage({type:e,data:t,timestamp:Date.now()})}catch(e){console.error("Error notifying worker:",e)}},function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];clearTimeout(n),n=setTimeout(()=>o(...t),300)}),S=(0,m.Ue)((0,x.n)((e,t)=>({model:d[0],isGenerating:!1,editor:void 0,context:"",threads:[],chatMode:l.jE.GEMINI_2_FLASH,threadItems:[],useWebSearch:!1,customInstructions:"",currentThreadId:null,activeThreadItemView:null,currentThread:null,currentThreadItem:null,imageAttachment:{base64:void 0,file:void 0},messageGroups:[],abortController:null,isLoadingThreads:!1,isLoadingThreadItems:!1,currentSources:[],showSuggestions:!0,setCustomInstructions:t=>{let r=JSON.parse(localStorage.getItem(p)||"{}");localStorage.setItem(p,JSON.stringify({...r,customInstructions:t})),e(e=>{e.customInstructions=t})},setImageAttachment:t=>{e(e=>{e.imageAttachment=t})},clearImageAttachment:()=>{e(e=>{e.imageAttachment={base64:void 0,file:void 0}})},setActiveThreadItemView:t=>{e(e=>{e.activeThreadItemView=t})},setShowSuggestions:t=>{localStorage.setItem(p,JSON.stringify({showSuggestions:t})),e(e=>{e.showSuggestions=t})},setUseWebSearch:t=>{let r=JSON.parse(localStorage.getItem(p)||"{}");localStorage.setItem(p,JSON.stringify({...r,useWebSearch:t})),e(e=>{e.useWebSearch=t})},setChatMode:t=>{localStorage.setItem(p,JSON.stringify({chatMode:t})),e(e=>{e.chatMode=t})},removeFollowupThreadItems:async t=>{let r=await s.threadItems.get(t);if(r){for(let e of(await s.threadItems.where("createdAt").above(r.createdAt).and(e=>e.threadId===r.threadId).toArray()))await s.threadItems.delete(e.id);e(e=>{e.threadItems=e.threadItems.filter(e=>e.createdAt<=r.createdAt||e.threadId!==r.threadId)}),C("thread-item-delete",{threadId:r.threadId,id:t,isFollowupRemoval:!0})}},getThreadItems:async e=>await s.threadItems.where("threadId").equals(e).toArray(),setCurrentSources:t=>{e(e=>{e.currentSources=t})},setCurrentThreadItem:t=>e(e=>{e.currentThreadItem=t}),setEditor:t=>e(e=>{e.editor=t}),setContext:t=>e(e=>{e.context=t}),setIsGenerating:t=>
1{f.q.getState().dismissSideDrawer(),e(e=>{e.isGenerating=t})},stopGeneration:()=>{e(e=>{var t;e.isGenerating=!1,null===(t=e.abortController)||void 0===t||t.abort()})},setAbortController:t=>e(e=>{e.abortController=t}),loadThreadItems:async t=>{let r=await s.threadItems.where("threadId").equals(t).toArray();e(e=>{e.threadItems=r})},clearAllThreads:async()=>{await s.threads.clear(),await s.threadItems.clear(),e(e=>{e.threads=[],e.threadItems=[]})},getThread:async e=>await s.threads.get(e)||null,createThread:async(t,r)=>{let n=t||(0,u.x0)(),a={id:n,title:(null==r?void 0:r.title)||"New Thread",updatedAt:new Date,createdAt:new Date};return s.threads.add(a),e(e=>{e.threads.push(a),e.currentThreadId=a.id,e.currentThread=a}),C("thread-update",{threadId:n}),a},setModel:async t=>{localStorage.setItem(p,JSON.stringify({model:t.id})),e(e=>{e.model=t})},updateThread:async r=>{let n=t().threads.find(e=>e.id===r.id);if(!n)return;let a={...n,...r,updatedAt:new Date};e(e=>{let t=e.threads.findIndex(e=>e.id===r.id);-1!==t&&(e.threads[t]=a),e.currentThreadId===r.id&&(e.currentThread=a)});try{await s.threads.put(a),C("thread-update",{threadId:r.id})}catch(e){console.error("Failed to update thread in database:",e)}},createThreadItem:async r=>{let n=t().currentThreadId;if(n)try{s.threadItems.put(r),e(e=>{e.threadItems.find(e=>e.id===r.id)?e.threadItems=e.threadItems.map(e=>e.id===r.id?r:e):e.threadItems.push({...r,threadId:n})}),C("thread-item-update",{threadId:n,id:r.id})}catch(e){console.error("Failed to create thread item:",e)}},updateThreadItem:async(r,n)=>{if(!n.id){console.warn("[DEBUG STORE] updateThreadItem called without id");return}if(!r){console.warn("[DEBUG STORE] updateThreadItem called without threadId");return}try{var a,o;console.log("[DEBUG STORE] updateThreadItem called:",{threadId:r,threadItemId:n.id,status:n.status,hasQuery:!!n.query,queryLength:(null===(a=n.query)||void 0===a?void 0:a.length)||0});let s=t().threadItems.find(e=>e.id===n.id);console.log("[DEBUG STORE] Existing item found:",!!s);let i=s?{...s,...n,threadId:r,updatedAt:new Date}:{id:n.id,threadId:r,createdAt:new Date,updatedAt:new Date,...n};console.log("[DEBUG STORE] Updated item:",{id:i.id,status:i.status,queryLength:(null===(o=i.query)||void 0===o?void 0:o.length)||0}),e(e=>{let t=e.threadItems.findIndex(e=>e.id===n.id);-1!==t?(console.log("[DEBUG STORE] Updating existing item at index:",t),e.threadItems[t]=i):(console.log("[DEBUG STORE] Adding new item to threadItems"),e.threadItems.push(i))}),b(i),C("thread-item-update",{threadId:r,id:n.id})}catch(e){console.error("Error in updateThreadItem:",e);try{let e={id:n.id,threadId:r,query:n.query||"",mode:n.mode||l.jE.GEMINI_2_FLASH,createdAt:new Date,updatedAt:new Date,...n,error:n.error||"Something went wrong"};await s.threadItems.put(e)}catch(e){console.error("Critical: Failed even fallback thread item update:",e)}}},switchThread:async r=>{let s=t().threads.find(e=>e.id===r);localStorage.setItem(p,JSON.stringify({model:t().model.id,currentThreadId:r})),e(e=>{e.currentThreadId=r,e.currentThread=s||null}),t().loadThreadItems(r)},deleteThreadItem:async r=>{let n=t().currentThreadId;n&&(await s.threadItems.delete(r),e(e=>{e.threadItems=e.threadItems.filter(e=>e.id!==r)}),C("thread-item-delete",{id:r,threadId:n}),0===await s.threadItems.where("threadId").equals(n).count()&&(await s.threads.delete(n),e(e=>{var t;e.threads=e.threads.filter(e=>e.id!==n),e.currentThreadId=null===(t=e.threads[0])||void 0===t?void 0:t.id,e.currentThread=e.threads[0]||null}),window.location.href="/chat"))},deleteThread:async t=>{await s.threads.delete(t),await s.threadItems.where("threadId").equals(t).delete(),e(e=>{var r;e.threads=e.threads.filter(e=>e.id!==t),e.currentThreadId=null===(r=e.threads[0])||void 0===r?void 0:r.id,e.currentThread=e.threads[0]||null}),C("thread-delete",{threadId:t})},getPreviousThreadItems:e=>{let r=t().threadItems.filter(t=>t.threadId===e).sort((e,t)=>e.createdAt.getTime()-t.createdAt.getTime());return r.length>1?r.slice(0,-1):[]},getCurrentThreadItem:()=>{let e=t(),r=e.threadItems.filter(t=>
1t.threadId===e.currentThreadId).sort((e,t)=>e.createdAt.getTime()-t.createdAt.getTime());return r[r.length-1]||null},getCurrentThread:()=>{let e=t();return e.threads.find(t=>t.id===e.currentThreadId)||null}})));g().then(e=>{let{threads:t,currentThreadId:r,chatMode:s,useWebSearch:n,showSuggestions:a,customInstructions:o}=e;S.setState({threads:t,currentThreadId:r,currentThread:t.find(e=>e.id===r)||(null==t?void 0:t[0]),chatMode:s,useWebSearch:n,showSuggestions:a,customInstructions:o}),console.log("[DEBUG] Checking SharedWorker support"),console.log("[DEBUG] SharedWorker in window:","SharedWorker"in window),"SharedWorker"in window?(console.log("[DEBUG] SharedWorker is supported, initializing..."),N()):(console.log("[DEBUG] SharedWorker NOT supported, using localStorage fallback"),k())})},5520:function(e,t,r){"use strict";r.d(t,{Vi:function(){return s.V},qr:function(){return n.q},aK:function(){return a.a},U7:function(){return d}});var s=r(73218),n=r(33702),a=r(99739),o=r(39099),i=r(89291),l=r(52844);let d=(0,o.Ue)()((0,i.tJ)((0,l.n)((e,t)=>({mcpConfig:{},selectedMCP:[],getSelectedMCP:()=>{let e=t().selectedMCP,r=t().mcpConfig;return e.reduce((e,t)=>(e[t]=r[t],e),{})},updateSelectedMCP:t=>{e(e=>{e.selectedMCP=t(e.selectedMCP)})},setMcpConfig:t=>{e(e=>{e.mcpConfig=t})},addMcpConfig:t=>{e(e=>{e.mcpConfig={...e.mcpConfig,...t}})},removeMcpConfig:t=>{e(e=>{let r={...e.mcpConfig};delete r[t],e.mcpConfig=r})},getMcpConfig:()=>t().mcpConfig})),{name:"mcp-tools-storage",storage:(0,i.FL)(()=>localStorage)}))},87880:function(e,t,r){"use strict";r.r(t),r.d(t,{Accordion:function(){return l},AccordionContent:function(){return u},AccordionItem:function(){return d},AccordionTrigger:function(){return c}});var s=r(57437),n=r(64756),a=r(42421),o=r(2265),i=r(15425);let l=n.fC,d=o.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.ck,{ref:t,className:(0,i.cn)("border-border border-b px-3 py-2 no-underline",r),...a})});d.displayName="AccordionItem";let c=o.forwardRef((e,t)=>{let{className:r,children:o,...l}=e;return(0,s.jsx)(n.h4,{className:"flex",children:(0,s.jsxs)(n.xz,{ref:t,className:(0,i.cn)("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all [&[data-state=open]>svg]:rotate-180",r),...l,children:[o,(0,s.jsx)(a.Z,{size:16,strokeWidth:2,className:"text-muted-foreground shrink-0 transition-transform duration-200"})]})})});c.displayName=n.xz.displayName;let u=o.forwardRef((e,t)=>{let{className:r,children:a,...o}=e;return(0,s.jsx)(n.VY,{ref:t,className:"data-[state=closed]:animate-accordion-collapse data-[state=open]:animate-accordion-expand overflow-hidden text-sm",...o,children:(0,s.jsx)("div",{className:(0,i.cn)("pb-4 pt-0",r),children:a})})});u.displayName=n.VY.displayName},1992:function(e,t,r){"use strict";r.r(t),r.d(t,{AlertDialog:function(){return l},AlertDialogAction:function(){return g},AlertDialogCancel:function(){return v},AlertDialogContent:function(){return m},AlertDialogDescription:function(){return p},AlertDialogFooter:function(){return f},AlertDialogHeader:function(){return x},AlertDialogOverlay:function(){return u},AlertDialogPortal:function(){return c},AlertDialogTitle:function(){return h},AlertDialogTrigger:function(){return d}});var s=r(57437),n=r(69546),a=r(2265),o=r(15425),i=r(66922);let l=n.fC,d=n.xz,c=n.h_,u=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.aV,{className:(0,o.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 bg-background/80 fixed inset-0 z-[500] backdrop-blur-sm",r),...a,ref:t})});u.displayName=n.aV.displayName;let m=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsxs)(c,{children:[(0,s.jsx)(u,{}),(0,s.jsx)(n.VY,{ref:t,className:(0,o.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] border-border bg-background fixed left-[50%] top-[50%] z-[600] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg",r),...a})]})});m.displayName=n.VY.displayName;let x=e=>{let{className:t,...r}=e;return(0,s.jsx)("div",{className:(0,o.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...r})};x.displayName="AlertDialogHeader";let f=e=>{let{className:t,...r}=e;return(0,s.jsx)("div",{className:(0,o.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r})};f.displayName="AlertDialogFooter";let h=a.forwardRef((e,t)=>
1{let{className:r,...a}=e;return(0,s.jsx)(n.Dx,{ref:t,className:(0,o.cn)("text-lg font-semibold",r),...a})});h.displayName=n.Dx.displayName;let p=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.dk,{ref:t,className:(0,o.cn)("text-muted-foreground text-sm",r),...a})});p.displayName=n.dk.displayName;let g=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.aU,{ref:t,className:(0,o.cn)((0,i.d)(),r),...a})});g.displayName=n.aU.displayName;let v=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.$j,{ref:t,className:(0,o.cn)((0,i.d)({variant:"secondary"}),"mt-2 sm:mt-0",r),...a})});v.displayName=n.$j.displayName},66922:function(e,t,r){"use strict";r.d(t,{d:function(){return d},z:function(){return c}});var s=r(57437),n=r(71538),a=r(13027),o=r(2265),i=r(15425),l=r(9753);let d=(0,a.j)("inline-flex items-center gap-2 justify-center font-medium whitespace-nowrap rounded-xl transition-colors focus-visible:outline-none [&>svg]:text-muted-foreground disabled:opacity-70",{variants:{variant:{default:"bg-foreground shadow-subtle-xs border-sky-600 text-background font-semibold hover:opacity-90 [&>svg]:text-background",primary:"bg-primary text-background font-semibold hover:opacity-90 [&>svg]:text-background","primary-secondary":"bg-primary-secondary text-primary-secondary-foreground font-semibold hover:opacity-90",accent:"text-primary bg-yellow-100 hover:bg-yellow-200 font-semibold",outlined:"bg-background text-foreground outline outline-border hover:bg-secondary",destructive:"bg-destructive text-destructive-foreground hover:opacity-90",bordered:"bg-background dark:border dark:border-border shadow-subtle-xs text-foreground opacity-100 hover:opacity-80 [&>svg]:text-foreground font-semibold",secondary:"bg-surface dark:border dark:border-border-strong text-muted-foreground opacity-100 hover:opacity-80 [&>svg]:text-muted-foreground font-semibold",ghost:"hover:bg-surface-hover text-muted-foreground opacity-100 hover:text-foreground","ghost-bordered":"hover:bg-background hover:shadow-subtle-xs text-muted-foreground opacity-100 hover:text-foreground",link:"text-muted-foreground underline-offset-4 hover:underline h-auto decoration-border",text:"p-0 text-xs"},size:{default:"h-9 px-3 text-xs md:text-sm",sm:"h-8 px-3 text-xs md:text-xs rounded-xl",xs:"h-7 px-2 text-xs md:text-xs",md:"h-9 px-4 text-xs md:text-sm font-semibold",lg:"h-10 md:h-10  px-8 text-xs md:text-sm font-semibold",icon:"h-8 min-w-8 text-xs md:text-sm","icon-sm":"h-7 min-w-7 text-xs md:text-sm","icon-xs":"h-6 min-w-6 text-xs md:text-sm","link-sm":"p-0 text-xs",link:"p-0"},rounded:{default:"rounded-sm",lg:"rounded-lg",xl:"rounded-xl",full:"rounded-full"}},defaultVariants:{variant:"default",size:"default",rounded:"lg"}}),c=o.forwardRef((e,t)=>{let{className:r,variant:a,size:c,iconSize:u="sm",rounded:m,asChild:x=!1,prefixIcon:f,suffixIcon:h,icon:p,children:g,tooltip:v,tooltipSide:j="top",...y}=e,b=x?n.g7:"button",w={xs:10,sm:12,md:14,lg:16},N=v?l.Tooltip:o.Fragment,k=(0,s.jsxs)(b,{className:(0,i.cn)(d({variant:a,size:c,rounded:m,className:r})),ref:t,...y,children:[f&&(0,s.jsx)(f,{size:w[u],strokeWidth:2}),p?(0,s.jsx)(p,{size:w[u],strokeWidth:2}):g,h&&(0,s.jsx)(h,{size:w[u],strokeWidth:2})]});return v?(0,s.jsx)(N,{content:v,side:j,children:k}):k});c.displayName="Button"},55026:function(e,t,r){"use strict";r.r(t),r.d(t,{Carousel:function(){return u},CarouselContent:function(){return m},CarouselItem:function(){return x},CarouselNext:function(){return h},CarouselPrevious:function(){return f}});var s=r(57437),n=r(4867),a=r(74300),o=r(2265),i=r(15425),l=r(59279);let d=o.createContext(null);function c(){let e=o.useContext(d);if(!e)throw Error("useCarousel must be used within a <Carousel />");return e}let u=o.forwardRef((e,t)=>{let{orientation:r="horizontal",opts:n,setApi:l,plugins:c,className:u,children:m,...x}=e,[f,h]=(0,a.Z)({...n,axis:"horizontal"===r?"x":"y"},c),[p,g]=o.useState(!1),[v,j]=o.useState(!1),y=o.useCallback(e=>{e&&(g(e.canScrollPrev()),j(e.canScrollNext()))},[]),b=o.useCallback(()=>{null==h||h.scrollPrev()},[h]),w=o.useCallback(()=>{null==h||h.scrollNext()},[h]),N=o.useCallback(e=>{"ArrowLeft"===e.key?(e.preventDefault(),b()):"ArrowRight"===e.key&&(e.preventDefault(),w())},[b,w]);return o.useEffect(()=>{h&&l&&l(h)},[h,l]),o.useEffect(()=>{if(h)return y(h),h.on("reInit",y),h.on("select",y),()=>{null==h||h.off("select",y)}},[h,y]),(0,s.jsx)(d.Provider,{value:{carouselRef:f,api:h,opts:n,orientation:r||((null==n?void 0:n.axis)==="y"?"vertical":"horizontal"),scrollPrev:b,scrollNext:w,canScrollPrev:p,canScrollNext:v},children:(0,s.jsx)("div",{ref:t,onKeyDownCapture:N,className:(0,i.cn)("relative",u),role:"region","aria-roledescription":"carousel",...x,children:m})})});
1u.displayName="Carousel";let m=o.forwardRef((e,t)=>{let{className:r,...n}=e,{carouselRef:a,orientation:o}=c();return(0,s.jsx)("div",{ref:a,className:"overflow-hidden",children:(0,s.jsx)("div",{ref:t,className:(0,i.cn)("flex","horizontal"===o?"-ml-4":"-mt-4 flex-col",r),...n})})});m.displayName="CarouselContent";let x=o.forwardRef((e,t)=>{let{className:r,...n}=e,{orientation:a}=c();return(0,s.jsx)("div",{ref:t,role:"group","aria-roledescription":"slide",className:(0,i.cn)("min-w-0 shrink-0 grow-0 basis-full","horizontal"===a?"pl-4":"pt-4",r),...n})});x.displayName="CarouselItem";let f=o.forwardRef((e,t)=>{let{className:r,variant:a="outlined",size:o="icon",...d}=e,{orientation:u,scrollPrev:m,canScrollPrev:x}=c();return(0,s.jsxs)(l.zx,{ref:t,variant:a,size:o,className:(0,i.cn)("absolute h-8 w-8 rounded-full","horizontal"===u?"-left-12 top-1/2 -translate-y-1/2":"-top-12 left-1/2 -translate-x-1/2 rotate-90",r),disabled:!x,onClick:m,...d,children:[(0,s.jsx)(n.Y4O,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"sr-only",children:"Previous slide"})]})});f.displayName="CarouselPrevious";let h=o.forwardRef((e,t)=>{let{className:r,variant:a="outlined",size:o="icon",...d}=e,{orientation:u,scrollNext:m,canScrollNext:x}=c();return(0,s.jsxs)(l.zx,{ref:t,variant:a,size:o,className:(0,i.cn)("absolute h-8 w-8 rounded-full","horizontal"===u?"-right-12 top-1/2 -translate-y-1/2":"-bottom-12 left-1/2 -translate-x-1/2 rotate-90",r),disabled:!x,onClick:m,...d,children:[(0,s.jsx)(n.LZ3,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"sr-only",children:"Next slide"})]})});h.displayName="CarouselNext"},25811:function(e,t,r){"use strict";r.r(t),r.d(t,{Checkbox:function(){return l}});var s=r(57437),n=r(69324),a=r(22468),o=r(2265),i=r(15425);let l=o.forwardRef((e,t)=>{let{className:r,...o}=e;return(0,s.jsx)(n.fC,{ref:t,className:(0,i.cn)("peer w-5 h-5 shrink-0 rounded-md border border-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",r),...o,children:(0,s.jsx)(n.z$,{className:(0,i.cn)("flex items-center justify-center text-current"),children:(0,s.jsx)(a.Z,{className:"h-4 w-4"})})})});l.displayName=n.fC.displayName},14114:function(e,t,r){"use strict";r.r(t),r.d(t,{Command:function(){return d},CommandDialog:function(){return c},CommandEmpty:function(){return x},CommandGroup:function(){return f},CommandInput:function(){return u},CommandItem:function(){return p},CommandList:function(){return m},CommandSeparator:function(){return h},CommandShortcut:function(){return g}});var s=r(57437),n=r(43015),a=r(2265),o=r(54817),i=r(15425),l=r(14976);let d=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.mY,{ref:t,className:(0,i.cn)("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",r),...a})});d.displayName=n.mY.displayName;let c=e=>{let{children:t,...r}=e;return(0,s.jsxs)(l.Dialog,{...r,children:[(0,s.jsx)(l.DialogOverlay,{className:"!bg-transparent backdrop-blur-0"}),(0,s.jsx)(l.DialogContent,{className:"top-[40%] w-[700px] overflow-hidden p-0",ariaTitle:"Command Search",closeButtonClassName:"hidden",children:(0,s.jsx)(d,{className:"[&_[cmdk-group-heading]]:text-muted-foreground bg-background pb-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-1 [&_[cmdk-input-wrapper]_svg]:h-4 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-10 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3",children:t})})]})},u=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsxs)("div",{className:(0,i.cn)("flex flex-1 items-center px-3","cmdk-input-wrapper",r),children:[(0,s.jsx)(o.Z,{size:20,strokeWidth:"2",className:"mr-2 h-3 w-3 shrink-0 opacity-50"}),(0,s.jsx)(n.mY.Input,{ref:t,className:(0,i.cn)("placeholder:text-muted-foreground flex h-8 w-full rounded-md bg-transparent py-2 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50"),...a})]})});u.displayName=n.mY.Input.displayName;let m=a.forwardRef((e,t)=>
1{let{className:r,...a}=e;return(0,s.jsx)(n.mY.List,{ref:t,className:(0,i.cn)("no-scrollbar max-h-[410px] overflow-y-auto overflow-x-hidden",r),...a})});m.displayName=n.mY.List.displayName;let x=a.forwardRef((e,t)=>(0,s.jsx)(n.mY.Empty,{ref:t,className:"py-6 text-center text-sm md:text-base",...e}));x.displayName=n.mY.Empty.displayName;let f=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.mY.Group,{ref:t,className:(0,i.cn)("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden md:text-sm [&_[cmdk-group-heading]]:px-3 [&_[cmdk-group-heading]]:py-2 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-normal",r),...a})});f.displayName=n.mY.Group.displayName;let h=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.mY.Separator,{ref:t,className:(0,i.cn)("bg-border -mx-1 h-px",r),...a})});h.displayName=n.mY.Separator.displayName;let p=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.mY.Item,{ref:t,className:(0,i.cn)("text-foreground aria-selected:bg-surface aria-selected:text-surface-foreground relative flex min-h-8 cursor-pointer items-center gap-2 rounded-lg !px-3 !py-2 text-xs font-medium outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50 md:text-sm",r),...a})});p.displayName=n.mY.Item.displayName;let g=e=>{let{className:t,...r}=e;return(0,s.jsx)("span",{className:(0,i.cn)("text-muted-foreground ml-auto text-sm tracking-widest md:text-base",t),...r})};g.displayName="CommandShortcut"},14976:function(e,t,r){"use strict";r.r(t),r.d(t,{Dialog:function(){return c},DialogClose:function(){return x},DialogContent:function(){return h},DialogDescription:function(){return j},DialogFooter:function(){return g},DialogHeader:function(){return p},DialogOverlay:function(){return f},DialogPortal:function(){return m},DialogTitle:function(){return v},DialogTrigger:function(){return u}});var s=r(57437),n=r(32226),a=r(89605),o=r(22966),i=r(34446),l=r(2265),d=r(15425);let c=e=>{let{children:t,...r}=e;return(0,s.jsx)(i.M,{children:(0,s.jsx)(n.fC,{...r,children:t})})},u=n.xz,m=n.h_,x=n.x8,f=l.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.aV,{ref:t,className:(0,d.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in- bg-surface-hover/50 fixed inset-0 z-[499]",r),...a})});f.displayName=n.aV.displayName;let h=l.forwardRef((e,t)=>{let{className:r,children:i,ariaTitle:l,closeButtonClassName:c,...u}=e;return(0,s.jsxs)(m,{children:[(0,s.jsx)(f,{}),(0,s.jsxs)(n.VY,{ref:t,className:(0,d.cn)("bg-background border-border-strong data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed left-[50%] top-[48%] z-[500] grid w-full max-w-xl translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-2xl duration-200 sm:rounded-xl ",r),...u,children:[(0,s.jsx)(a.fC,{children:(0,s.jsx)(v,{children:l})}),i,(0,s.jsxs)(n.x8,{className:(0,d.cn)("ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:bg-foreground
1/10 absolute right-4 top-4 z-[50] flex h-7 w-7 items-center justify-center rounded-lg opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2",c),children:[(0,s.jsx)(o.Z,{size:16,strokeWidth:2.5}),(0,s.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});h.displayName=n.VY.displayName;let p=e=>{let{className:t,...r}=e;return(0,s.jsx)("div",{className:(0,d.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...r})};p.displayName="DialogHeader";let g=e=>{let{className:t,...r}=e;return(0,s.jsx)("div",{className:(0,d.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r})};g.displayName="DialogFooter";let v=l.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.Dx,{ref:t,className:(0,d.cn)("text-lg font-semibold leading-none tracking-tight",r),...a})});v.displayName=n.Dx.displayName;let j=l.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.dk,{ref:t,className:(0,d.cn)("text-muted-foreground text-sm md:text-base",r),...a})});j.displayName=n.dk.displayName},44424:function(e,t,r){"use strict";r.r(t),r.d(t,{DropdownMenu:function(){return l},DropdownMenuCheckboxItem:function(){return v},DropdownMenuContent:function(){return p},DropdownMenuGroup:function(){return c},DropdownMenuItem:function(){return g},DropdownMenuLabel:function(){return y},DropdownMenuPortal:function(){return u},DropdownMenuRadioGroup:function(){return x},DropdownMenuRadioItem:function(){return j},DropdownMenuSeparator:function(){return b},DropdownMenuShortcut:function(){return w},DropdownMenuSub:function(){return m},DropdownMenuSubContent:function(){return h},DropdownMenuSubTrigger:function(){return f},DropdownMenuTrigger:function(){return d}});var s=r(57437),n=r(86610),a=r(4867),o=r(2265),i=r(15425);let l=n.fC,d=n.xz,c=n.ZA,u=n.Uv,m=n.Tr,x=n.Ee,f=o.forwardRef((e,t)=>{let{className:r,inset:o,children:l,...d}=e;return(0,s.jsxs)(n.fF,{ref:t,className:(0,i.cn)("focus:bg-accent data-[state=open]:bg-accent flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none md:text-base",o&&"pl-8",r),...d,children:[l,(0,s.jsx)(a.XCv,{className:"ml-auto h-4 w-4"})]})});f.displayName=n.fF.displayName;let h=o.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.tu,{ref:t,sideOffset:8,className:(0,i.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-popover text-popover-foreground z-50 min-w-[8rem] overflow-hidden rounded-xl border p-1 shadow-lg",r),...a})});h.displayName=n.tu.displayName;let p=o.forwardRef((e,t)=>{let{className:r,sideOffset:a=4,...o}=e;return(0,s.jsx)(n.Uv,{children:(0,s.jsx)(n.VY,{ref:t,sideOffset:a,className:(0,i.cn)("bg-popover text-popover-foreground border-border-strong z-50 min-w-[12rem] overflow-hidden rounded-xl border p-1 shadow-xl","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...o})})});p.displayName=n.VY.displayName;let g=o.forwardRef((e,t)=>{let{className:r,inset:a,...o}=e;return(0,s.jsx)(n.ck,{ref:t,className:(0,i.cn)("focus:bg-surface focus:text-surface-foreground relative flex h-8 cursor-pointer select-none items-center gap-2 rounded-lg px-2 text-xs font-medium outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 md:text-sm",a&&"pl-8",r),...o})});g.displayName=n.ck.displayName;let v=o.forwardRef((e,t)=>{let{className:r,children:o,checked:l,...d}=e;return(0,s.jsxs)(n.oC,{ref:t,className:(0,i.cn)("focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 md:text-base",r),checked:l,...d,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(n.wU,{children:(0,s.jsx)(a.nQG,{className:"h-4 w-4"})})}),o]})});v.displayName=n.oC.displayName;let j=o.forwardRef((e,t)=>
1{let{className:r,children:o,...l}=e;return(0,s.jsxs)(n.Rk,{ref:t,className:(0,i.cn)("focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 md:text-base",r),...l,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(n.wU,{children:(0,s.jsx)(a.jXb,{className:"h-4 w-4 fill-current"})})}),o]})});j.displayName=n.Rk.displayName;let y=o.forwardRef((e,t)=>{let{className:r,inset:a,...o}=e;return(0,s.jsx)(n.__,{ref:t,className:(0,i.cn)("text-muted-foreground/50 px-3 py-1.5 text-xs font-medium",a&&"pl-8",r),...o})});y.displayName=n.__.displayName;let b=o.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.Z0,{ref:t,className:(0,i.cn)("bg-border -mx-1 my-1 h-[0.5px]",r),...a})});b.displayName=n.Z0.displayName;let w=e=>{let{className:t,...r}=e;return(0,s.jsx)("span",{className:(0,i.cn)("ml-auto text-sm tracking-widest opacity-60 md:text-base",t),...r})};w.displayName="DropdownMenuShortcut"},7342:function(e,t,r){"use strict";r.d(t,{k:function(){return l}});var s=r(57437),n=r(13027),a=r(2265),o=r(15425);let i=(0,n.j)("flex",{variants:{direction:{row:"flex-row",rowReverse:"flex-row-reverse",col:"flex-col",colReverse:"flex-col-reverse"},gap:{none:"gap-0",xs:"gap-1",sm:"gap-2",md:"gap-3",lg:"gap-4",xl:"gap-6","2xl":"gap-8","3xl":"gap-12","4xl":"gap-16","5xl":"gap-20","6xl":"gap-24","7xl":"gap-28","8xl":"gap-32","9xl":"gap-36","10xl":"gap-40"},justify:{start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly",stretch:"justify-stretch"},items:{start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"}},defaultVariants:{direction:"row",gap:"none",justify:"start",items:"start"}}),l=a.forwardRef((e,t)=>{let{className:r,direction:n,gap:a,justify:l,items:d,asChild:c=!1,...u}=e;return(0,s.jsx)("div",{className:(0,o.cn)(i({direction:n,gap:a,justify:l,items:d,className:r})),ref:t,...u,children:u.children})});l.displayName="Flex"},39296:function(e,t,r){"use strict";r.r(t),r.d(t,{HoverCard:function(){return l},HoverCardContent:function(){return u},HoverCardTrigger:function(){return c}});var s=r(57437),n=r(50913),a=r(94674),o=r(2265),i=r(15425);let l=e=>{let{openDelay:t=200,closeDelay:r=200,children:n}=e;return(0,s.jsx)(d,{openDelay:t,closeDelay:r,children:n})},d=e=>{let{openDelay:t,closeDelay:r,children:i}=e,[l,d]=o.useState(!1),{refs:m,floatingStyles:x,context:f}=(0,n.YF)({open:l,onOpenChange:d,middleware:[(0,a.cv)(4),(0,a.RR)(),(0,a.uY)()]}),h=(0,n.XI)(f,{delay:{open:t,close:r}}),{getReferenceProps:p,getFloatingProps:g}=(0,n.NI)([h]),v=o.Children.toArray(i),j=v.find(e=>o.isValidElement(e)&&e.type===c),y=v.find(e=>o.isValidElement(e)&&e.type===u);if(!o.isValidElement(j)||!o.isValidElement(y))return null;let b=o.cloneElement(j,{ref:e=>{m.setReference(e)},...p()});return(0,s.jsxs)(s.Fragment,{children:[b,l&&(0,s.jsx)("div",{ref:m.setFloating,style:{...x,zIndex:999},...g(),children:y})]})},c=o.forwardRef((e,t)=>(0,s.jsx)("div",{ref:t,...e,className:"inline-block cursor-pointer"}));c.displayName="HoverCardTrigger";let u=o.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("div",{ref:t,className:(0,i.cn)("bg-background text-card-foreground isolate z-[200] flex max-w-64 flex-col items-start rounded-md border p-4 shadow-md outline-none","animate-in fade-in-0 zoom-in-95",r),...n})});u.displayName="HoverCardContent"},59279:function(e,t,r){"use strict";r.d(t,{bZ:function(){return l},X:function(){return c},aR:function(){return u.AlertDialog},OL:function(){return u.AlertDialogAction},le:function(){return u.AlertDialogCancel},_T:function(){return u.AlertDialogContent},yT:function(){return u.AlertDialogDescription},xo:function(){return u.AlertDialogFooter},fY:function(){return u.AlertDialogHeader},f$:function(){return u.AlertDialogTitle},vW:function(){return u.AlertDialogTrigger},Cd:function(){return d},Ct:function(){return x},zx:function(){return f.z},XZ:function(){return h.Checkbox},mY:function(){return p.Command},m5:function(){return p.CommandDialog},rb:function(){return p.CommandEmpty},fu:function(){return p.CommandGroup},sZ:function(){return p.CommandInput},di:function(){return p.CommandItem},e8:function(){return p.CommandList},Vq:function(){return g.Dialog},cZ:function(){return g.DialogContent},Be:function(){return g.DialogDescription},cN:function(){return g.DialogFooter},fK:function(){return g.DialogHeader},$N:function(){return g.DialogTitle},hg:function(){return g.DialogTrigger},h_:function(){return v.DropdownMenu},AW:function(){return v.DropdownMenuContent},Qk:function(){return v.DropdownMenuGroup},Xi:function(){return v.DropdownMenuItem},Ju:function(){return v.DropdownMenuLabel},VD:function(){return v.DropdownMenuSeparator},$F:function(){return v.DropdownMenuTrigger},kC:function(){return j.k},lX:function(){return N},zs:function(){return k.HoverCard},rC:function(){return k.HoverCardContent},Yi:function(){return k.HoverCardTrigger},II:function(){return S},Zn:function(){return L.InputOTP},hf:function(){return L.InputOTPGroup},cY:function(){return L.InputOTPSlot},Tz:function(){return I},J2:function(){return A.Popover},yk:function(){return A.PopoverContent},CM:function(){return A.PopoverTrigger},Ee:function(){return z.RadioGroup},mJ:function(){return z.RadioGroupItem},Od:function(){return M},x_:function(){return K.Toaster},$j:function(){return E}
1,rs:function(){return P.Switch},gx:function(){return _},gD:function(){return O.ToastAction},x7:function(){return W.Toaster},u:function(){return G.Tooltip},Dy:function(){return w},Ir:function(){return T.WebsitePreview},cn:function(){return o.cn},Am:function(){return U.toast},pm:function(){return U.useToast}}),r(87880);var s=r(57437),n=r(13027),a=r(2265),o=r(15425);let i=(0,n.j)("relative w-full rounded-lg px-3 py-2.5 text-xs font-medium  [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground  [&>svg~*]:pl-6 dark:border-border dark:[&>svg]:text-foreground",{variants:{variant:{default:"bg-secondary text-secondary-foreground",success:"bg-primary/10 text-primary [&>svg]:text-primary ",info:"bg-background border border-border shadow-subtle-sm text-blue-700 [&>svg]:text-blue-700",warning:"bg-yellow-700/10 text-yellow-700 [&>svg]:text-yellow-700",destructive:"bg-background border border-border text-rose-600/70 [&>svg]:text-rose-600/70"}},defaultVariants:{variant:"default"}}),l=a.forwardRef((e,t)=>{let{className:r,variant:n,...a}=e;return(0,s.jsx)("div",{ref:t,role:"alert",className:(0,o.cn)(i({variant:n}),r),...a})});l.displayName="Alert";let d=a.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("h5",{ref:t,className:(0,o.cn)("mb-1 text-xs font-medium leading-none tracking-tight md:text-sm",r),...n})});d.displayName="AlertTitle";let c=a.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("div",{ref:t,className:(0,o.cn)("inline-flex gap-2 text-xs [&_p]:leading-relaxed",r),...n})});c.displayName="AlertDescription";var u=r(1992);let m=(0,n.j)("flex items-center whitespace-nowrap gap-1.5 rounded-sm px-2 py-0.5 text-[0.7rem] font-medium transition-colors",{variants:{variant:{default:"bg-surface text-foreground rounded-md",secondary:"bg-surface text-surface-foreground rounded-full",surface:"bg-primary text-primary-foreground rounded-full",primary:"bg-primary text-primary-foreground",destructive:"bg-destructive text-destructive-foreground",outline:"border border-input bg-background text-foreground"},size:{sm:"px-2 h-5 text-xs",md:"px-2 h-6 text-xs font-mono text-[11px] tracking-[0.02em] font-[350]",lg:"px-3  h-7 text-xs"}},defaultVariants:{variant:"default",size:"md"}});function x(e){let{className:t,variant:r,size:n,...a}=e;return(0,s.jsx)("div",{className:(0,o.cn)(m({variant:r,size:n}),t),...a})}var f=r(66922);r(55026);var h=r(25811),p=r(14114),g=r(14976),v=r(44424),j=r(7342),y=r(87138);let b=(0,n.j)("text flex !my-0",{variants:{size:{xxs:"text-xs",xs:"text-xs",sm:"text-xs md:text-sm",base:"text-sm md:text-base",lg:"text-base md:text-lg",xl:"text-lg md:text-xl"},textColor:{primary:"text-foreground",secondary:"text-muted-foreground",surface:"text-surface-foreground",white:"text-white"},weight:{regular:"font-normal",medium:"font-medium",bold:"font-semibold"}},defaultVariants:{size:"sm",textColor:"primary",weight:"regular"}}),w=a.forwardRef((e,t)=>{let{className:r,size:n,textColor:a,weight:i,asChild:l=!1,...d}=e;return(0,s.jsx)("p",{className:(0,o.cn)(b({size:n,textColor:a,className:r,weight:i})),ref:t,...d,children:d.children})});w.displayName="Type";let N=e=>{let{children:t,label:r,extra:n,isOptional:a,className:i,linkText:l,link:d}=e;return(0,s.jsxs)(j.k,{direction:"col",gap:"none",items:"start",className:(0,o.cn)("w-full",i),children:[(0,s.jsxs)(j.k,{items:"center",gap:"sm",className:"w-full",children:[(0,s.jsxs)(j.k,{items:"center",gap:"xs",children:[(0,s.jsx)(w,{size:"sm",weight:"medium",children:r}),a&&(0,s.jsx)(w,{size:"xs",textColor:"secondary",children:"(Optional)"})]}),d&&(0,s.jsx)(y.default,{href:d,target:"_blank",className:"decoration-primary/20 py-0.5 text-sm font-medium text-violet-500 underline underline-offset-4 hover:opacity-90",children:l}),n&&n()]}),t&&(0,s.jsx)(w,{size:"xs",textColor:"secondary",children:t})]})};var k=r(39296);let C=(0,n.j)("flex h-9 w-full rounded-xl bg-background shadow-subtle-xs outline-none  px-3 text-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",{variants:{variant:{default:"bg-background text-sm",ghost:"bg-transparent"},size:{default:"h-9 px-4 text-sm",sm:"h-9 px-3 text-xs md:text-sm"},rounded:{default:"rounded-md",lg:"rounded-lg",full:"rounded-full"}},defaultVariants:{variant:"default",size:"default",rounded:"default"}}),S=a.forwardRef((e,t)=>
1{let{className:r,type:n,variant:a,size:i,rounded:l,...d}=e;return(0,s.jsx)("input",{type:n,className:(0,o.cn)(C({variant:a,size:i,rounded:l,className:r})),ref:t,autoComplete:"off",...d})});S.displayName="Input";let I=a.forwardRef((e,t)=>{let{className:r,children:n,...a}=e;return(0,s.jsx)("kbd",{ref:t,className:(0,o.cn)("text-foreground border-border bg-background flex h-5 items-center justify-center rounded-md border px-1.5 font-mono text-[10px] font-semibold",r),...a,children:n})});I.displayName="Kbd";var T=r(94383);function E(){return(0,s.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"1.5",viewBox:"0 0 24 24",strokeLinecap:"round",strokeLinejoin:"round",xmlns:"http://www.w3.org/2000/svg",className:"stroke-primary h-4 w-4 animate-spin",children:(0,s.jsx)("path",{d:"M12 3v3m6.366-.366-2.12 2.12M21 12h-3m.366 6.366-2.12-2.12M12 21v-3m-6.366.366 2.12-2.12M3 12h3m-.366-6.366 2.12 2.12"})})}var A=r(97353),z=r(30187),D=r(37213);let R=a.forwardRef((e,t)=>{let{...r}=e;return(0,s.jsx)(D.Drawer.Root,{shouldScaleBackground:!0,...r})});function M(e){let{className:t,...r}=e;return(0,s.jsx)("div",{className:(0,o.cn)("bg-primary/10 animate-pulse rounded-md",t),...r})}a.forwardRef((e,t)=>{let{...r}=e;return(0,s.jsx)(D.Drawer.Trigger,{...r,ref:t,className:"text-left",asChild:!0})}).displayName="SheetTrigger",R.displayName="Sheet",r(6585);var P=r(92307);r(30564);let _=a.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("textarea",{className:(0,o.cn)("bg-secondary placeholder:text-muted-foreground border-border flex min-h-[120px] w-full resize-none rounded-lg border border-none px-4 py-4 text-sm focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",r),ref:t,...n})});_.displayName="Textarea";var O=r(71730),W=r(52737),G=r(9753);r(51005);var U=r(88321),L=r(46952),K=r(93008)},46952:function(e,t,r){"use strict";r.r(t),r.d(t,{InputOTP:function(){return l},InputOTPGroup:function(){return d},InputOTPSeparator:function(){return u},InputOTPSlot:function(){return c}});var s=r(57437),n=r(66431),a=r(88002),o=r(2265),i=r(15425);let l=o.forwardRef((e,t)=>{let{className:r,containerClassName:a,...o}=e;return(0,s.jsx)(n.uZ,{ref:t,containerClassName:(0,i.cn)("flex items-center gap-2 has-[:disabled]:opacity-50",a),className:(0,i.cn)("disabled:cursor-not-allowed",r),...o})});l.displayName="InputOTP";let d=o.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("div",{ref:t,className:(0,i.cn)("flex items-center",r),...n})});d.displayName="InputOTPGroup";let c=o.forwardRef((e,t)=>{let{index:r,className:a,...l}=e,{char:d,hasFakeCaret:c,isActive:u}=o.useContext(n.VM).slots[r];return(0,s.jsxs)("div",{ref:t,className:(0,i.cn)("border-input bg-background relative flex h-14 w-14 items-center justify-center border-y border-r text-xl transition-all first:rounded-l-md first:border-l last:rounded-r-md",u&&"ring-ring z-10 ring-1",a),...l,children:[d,c&&(0,s.jsx)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:(0,s.jsx)("div",{className:"animate-caret-blink bg-foreground h-4 w-px duration-1000"})})]})});c.displayName="InputOTPSlot";let u=o.forwardRef((e,t)=>{let{...r}=e;return(0,s.jsx)("div",{ref:t,role:"separator",...r,children:(0,s.jsx)(a.Z,{})})});u.displayName="InputOTPSeparator"},94383:function(e,t,r){"use strict";r.r(t),r.d(t,{WebsitePreview:function(){return o}});var s=r(57437),n=r(86123),a=r(11533);let o=(0,r(2265).memo)(e=>{let{source:t}=e;return(0,s.jsx)("div",{className:"not-prose",children:(0,s.jsx)("div",{className:"flex flex-col items-start",children:(0,s.jsx)("div",{className:"flex w-full flex-col items-start gap-1.5",children:(0,s.jsx)("div",{className:"flex flex-row items-start gap-2.5",children:(0,s.jsxs)("div",{className:"flex flex-col items-start gap-4",children:[(0,s.jsxs)("p",{className:"text-muted-foreground line-clamp-1 flex w-full flex-row items-center gap-2 font-sans text-xs",children:[(0,s.jsx)(n.LinkFavicon,{link:t.link,size:"md"}),(0,a.XF)(t.link)]}),(0,s.jsxs)("div",{className:"flex flex-col items-center gap-1",children:[(0,s.jsx)("p",{className:"text-foreground line-clamp-2 w-full overflow-hidden font-sans text-xs font-semibold leading-tight",children:t.title}),(0,s.jsx)("p",{className:"text-muted-foreground line-clamp-2 w-full font-sans text-xs",children:null==t?void 0:t.snippet})]})]})})})})})})},97353:function(e,t,r){"use strict";r.r(t),r.d(t,{Popover:function(){return i},PopoverAnchor:function(){return d},PopoverContent:function(){return c},PopoverTrigger:function(){return l}});var s=r(57437),n=r(7568),a=r(2265),o=r(15425);let i=n.fC,l=n.xz,d=n.ee,c=a.forwardRef((e,t)=>
1{let{className:r,align:a="center",sideOffset:i=4,...l}=e;return(0,s.jsx)(n.h_,{children:(0,s.jsx)(n.VY,{ref:t,align:a,sideOffset:i,className:(0,o.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 border-border text-popover-foreground z-50 w-80 rounded-xl border p-4 shadow-lg outline-none",r),...l})})});c.displayName=n.VY.displayName},30187:function(e,t,r){"use strict";r.r(t),r.d(t,{RadioGroup:function(){return l},RadioGroupItem:function(){return d}});var s=r(57437),n=r(99497),a=r(28165),o=r(2265),i=r(15425);let l=o.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.fC,{className:(0,i.cn)("grid gap-2",r),...a,ref:t})});l.displayName=n.fC.displayName;let d=o.forwardRef((e,t)=>{let{className:r,...o}=e;return(0,s.jsx)(n.ck,{ref:t,className:(0,i.cn)("text-primary focus-visible:ring-ring aspect-square size-5 rounded-full border-2 focus:outline-none focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50",r),...o,children:(0,s.jsx)(n.z$,{className:"flex items-center justify-center",children:(0,s.jsx)(a.Z,{className:"fill-primary h-3.5 w-3.5 border-none"})})})});d.displayName=n.ck.displayName},6585:function(e,t,r){"use strict";r.r(t),r.d(t,{Slider:function(){return i}});var s=r(57437),n=r(85068),a=r(2265),o=r(15425);let i=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsxs)(n.fC,{ref:t,className:(0,o.cn)("relative flex w-full touch-none select-none items-center overflow-hidden rounded-lg",r),...a,children:[(0,s.jsx)(n.fQ,{className:"bg-muted relative h-6 w-full grow overflow-hidden rounded-lg",children:(0,s.jsx)(n.e6,{className:"absolute h-full bg-transparent"})}),(0,s.jsx)(n.bU,{className:"block h-6 w-4 rounded-r-md bg-transparent p-1 transition-colors focus-visible:outline-none focus-visible:ring-1 disabled:pointer-events-none disabled:opacity-5",children:(0,s.jsx)("div",{className:"bg-muted-foreground h-4 w-2 rounded-md"})})]})});i.displayName=n.fC.displayName},93008:function(e,t,r){"use strict";r.d(t,{Toaster:function(){return o}});var s=r(57437),n=r(79512);r(2265);var a=r(27776);let o=e=>{let{...t}=e,{theme:r="system"}=(0,n.F)();return(0,s.jsx)(a.x7,{theme:r,className:"toaster group",toastOptions:{classNames:{toast:"group group-[.toaster]:rounded-2xl toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-foreground group-[.toast]:text-background",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...t})}},92307:function(e,t,r){"use strict";r.r(t),r.d(t,{Switch:function(){return i}});var s=r(57437),n=r(9646),a=r(2265),o=r(15425);let i=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.fC,{className:(0,o.cn)("focus-visible:ring-primary data-[state=unchecked]:bg-primary/30 data-[state=checked]:bg-primary peer inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50",r),...a,ref:t,children:(0,s.jsx)(n.bU,{className:(0,o.cn)("shadow-xs pointer-events-none block h-4 w-4 translate-x-0.5 rounded-full bg-white ring-0 transition-transform data-[state=checked]:translate-x-[18px] data-[state=unchecked]:translate-x-0.5 data-[state=checked]:bg-white")})})});i.displayName=n.fC.displayName},30564:function(e,t,r){"use strict";r.r(t),r.d(t,{Tabs:function(){return i},TabsContent:function(){return c},TabsList:function(){return l},TabsTrigger:function(){return d}});var s=r(57437),n=r(62447),a=r(2265),o=r(15425);let i=n.fC,l=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.aV,{ref:t,className:(0,o.cn)("bg-secondary text-secondary-foreground border-border inline-flex h-10 items-center justify-start border-b",r),...a})});l.displayName=n.aV.displayName;let d=a.forwardRef((e,t)=>
1{let{className:r,...a}=e;return(0,s.jsx)(n.xz,{ref:t,className:(0,o.cn)("ring-offset-background focus-visible:ring-ring data-[state=active]:text-primary data-[state=active]:border-foreground inline-flex items-center justify-center gap-2 whitespace-nowrap px-3 py-2 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-b-2",r),...a})});d.displayName=n.xz.displayName;let c=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.VY,{ref:t,className:(0,o.cn)("ring-offset-background focus-visible:ring-ring mt-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",r),...a})});c.displayName=n.VY.displayName},71730:function(e,t,r){"use strict";r.r(t),r.d(t,{Toast:function(){return m},ToastAction:function(){return x},ToastClose:function(){return f},ToastDescription:function(){return p},ToastProvider:function(){return d},ToastTitle:function(){return h},ToastViewport:function(){return c}});var s=r(57437),n=r(10744),a=r(13027),o=r(2265),i=r(74697),l=r(15425);let d=n.zt,c=o.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.l_,{ref:t,className:(0,l.cn)("dark fixed bottom-2 right-0 z-[500] flex w-full flex-col-reverse p-4 md:top-auto md:max-w-[420px] md:flex-col",r),...a})});c.displayName=n.l_.displayName;let u=(0,a.j)("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-lg p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-y-0 data-[swipe=end]:translate-y-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-y-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-bottom-full data-[state=open]:slide-in-from-bottom-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"border bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),m=o.forwardRef((e,t)=>{let{className:r,variant:a,...o}=e;return(0,s.jsx)(n.fC,{ref:t,className:(0,l.cn)(u({variant:a}),r),...o})});m.displayName=n.fC.displayName;let x=o.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.aU,{ref:t,className:(0,l.cn)("hover:bg-secondary focus:ring-ring group-[.destructive]:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors focus:outline-none focus:ring-1 disabled:pointer-events-none disabled:opacity-50 md:text-base",r),...a})});x.displayName=n.aU.displayName;let f=o.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.x8,{ref:t,className:(0,l.cn)("bg-muted/50 text-foreground/50 hover:text-foreground group-[.destructive]:text-destructive-foreground/50 group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive absolute right-2 top-2 rounded-lg p-1.5 opacity-100 transition-opacity focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100",r),"toast-close":"",...a,children:(0,s.jsx)(i.Z,{size:14,strokeWidth:2})})});f.displayName=n.x8.displayName;let h=o.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.Dx,{ref:t,className:(0,l.cn)("text-sm font-medium [&+div]:text-sm",r),...a})});h.displayName=n.Dx.displayName;let p=o.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.dk,{ref:t,className:(0,l.cn)("text-sm opacity-60",r),...a})});p.displayName=n.dk.displayName},52737:function(e,t,r){"use strict";r.r(t),r.d(t,{Toaster:function(){return d}});var s=r(57437),n=r(76780),a=r(22468),o=r(66922),i=r(71730),l=r(88321);function d(){let{toasts:e,dismiss:t}=(0,l.useToast)();return(0,s.jsxs)(i.ToastProvider,{children:[e.map(function(e){let{id:r,title:l,description:d,action:c,...u}=e;return(0,s.jsx)(i.Toast,{...u,children:(0,s.jsxs)("div",{className:"flex flex-row gap-3",children:["destructive"===u.variant?(0,s.jsx)(n.Z,{size:18,strokeWidth:2,className:"mt-1 flex-shrink-0 text-white"}):(0,s.jsx)(a.Z,{size:18,strokeWidth:2,className:"mt-1 flex-shrink-0 text-white"}),(0,s.jsxs)("div",{className:"flex w-full flex-col items-start gap-0",children:[l&&(0,s.jsx)(i.ToastTitle,{children:l}),d&&(0,s.jsx)(i.ToastDescription,{children:d}),c&&(0,s.jsxs)("div",{className:"flex flex-row gap-1 pt-2",children:[c,(0,s.jsx)(o.z,{variant:"ghost",size:"sm",onClick:()=>{t()},children:"Cancel"})]})]}),!c&&(0,s.jsx)(i.ToastClose,{})]})},r)}),(0,s.jsx)(i.ToastViewport,{})]})}},9753:function(e,t,r){"use strict";r.r(t),r.d(t,{Tooltip:function(){return u},TooltipContent:function(){return c},TooltipProvider:function(){return i},TooltipTrigger:function(){return d}});var s=r(57437),n=r(13030),a=r(2265),o=r(15425);let i=n.zt,l=n.fC,d=n.xz,c=a.forwardRef((e,t)=>
1{let{className:r,sideOffset:a=4,...i}=e;return(0,s.jsx)(n.VY,{ref:t,sideOffset:a,className:(0,o.cn)("animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 overflow-hidden rounded-lg bg-foreground px-2 py-1 text-xs font-medium text-background",r),...i})});c.displayName=n.VY.displayName;let u=e=>{let{children:t,content:r,side:n,sideOffset:a}=e;return(0,s.jsxs)(l,{delayDuration:0,children:[(0,s.jsx)(d,{asChild:!0,children:t}),(0,s.jsx)(c,{side:n,sideOffset:a,children:r})]})}},51005:function(e,t,r){"use strict";r.r(t),r.d(t,{PopOverConfirmProvider:function(){return l}});var s=r(57437),n=r(2265),a=r(66922),o=r(7342),i=r(97353);let l=e=>{let{title:t,onConfirm:r,confirmIcon:l,confimBtnVariant:d,confimBtnText:c="Confirm",onCancel:u,children:m}=e,[x,f]=(0,n.useState)(!1);return(0,s.jsxs)(i.Popover,{open:x,onOpenChange:f,children:[(0,s.jsx)(i.PopoverTrigger,{asChild:!0,children:m}),(0,s.jsxs)(i.PopoverContent,{className:"z-[1000]",side:"bottom",children:[(0,s.jsx)("p",{className:"pb-4 text-sm font-medium",children:t}),(0,s.jsxs)(o.k,{gap:"sm",children:[(0,s.jsxs)(a.z,{variant:d,size:"sm",onClick:e=>{r(()=>f(!1)),e.stopPropagation()},children:[l&&(0,s.jsx)(l,{size:14,strokeWidth:2}),c]}),(0,s.jsx)(a.z,{variant:"secondary",size:"sm",onClick:e=>{null==u||u(),f(!1),e.stopPropagation()},children:"Cancel"})]})," "]})]})}},88321:function(e,t,r){"use strict";r.r(t),r.d(t,{reducer:function(){return i},toast:function(){return u},useToast:function(){return m}});var s=r(2265);let n=0,a=new Map,o=e=>{if(a.has(e))return;let t=setTimeout(()=>{a.delete(e),c({type:"REMOVE_TOAST",toastId:e})},1e6);a.set(e,t)},i=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:r}=t;return r?o(r):e.toasts.forEach(e=>{o(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===r||void 0===r?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},l=[],d={toasts:[]};function c(e){d=i(d,e),l.forEach(e=>{e(d)})}function u(e){let{...t}=e,r=(n=(n+1)%Number.MAX_SAFE_INTEGER).toString(),s=()=>c({type:"DISMISS_TOAST",toastId:r});return c({type:"ADD_TOAST",toast:{...t,id:r,open:!0,onOpenChange:e=>{e||s()}}}),{id:r,dismiss:s,update:e=>c({type:"UPDATE_TOAST",toast:{...e,id:r}})}}function m(){let[e,t]=s.useState(d);return s.useEffect(()=>(l.push(t),()=>{let e=l.indexOf(t);e>-1&&l.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>c({type:"DISMISS_TOAST",toastId:e})}}},5315:function(e,t,r){"use strict";var s,n;r.d(t,{jE:function(){return s},UJ:function(){return a},Wd:function(){return o}}),(n=s||(s={})).Pro="pro",n.Deep="deep",n.O4_Mini="o4-mini",n.GPT_4_1="gpt-4.1",n.GPT_4_1_Mini="gpt-4.1-mini",n.GPT_4_1_Nano="gpt-4.1-nano",n.GPT_4o_Mini="gpt-4o-mini",n.LLAMA_4_SCOUT="llama-4-scout",n.GEMINI_2_FLASH="gemini-2.5-flash-preview-09-2025",n.DEEPSEEK_R1="deepseek-r1",n.CLAUDE_3_5_SONNET="claude-3-5-sonnet",n.CLAUDE_3_7_SONNET="claude-3-7-sonnet";let a={deep:{webSearch:!1,imageUpload:!1,retry:!1,isAuthRequired:!0},pro:{webSearch:!1,imageUpload:!1,retry:!1,isAuthRequired:!0},"gpt-4.1":{webSearch:!0,imageUpload:!0,retry:!0,isAuthRequired:!0},"gpt-4.1-mini":{webSearch:!0,imageUpload:!0,retry:!0,isAuthRequired:!0},"gpt-4.1-nano":{webSearch:!0,imageUpload:!0,retry:!0,isAuthRequired:!1},"llama-4-scout":{webSearch:!0,imageUpload:!0,retry:!0,isAuthRequired:!1},"o4-mini":{webSearch:!0,imageUpload:!1,retry:!0,isAuthRequired:!0},"gpt-4o-mini":{webSearch:!0,imageUpload:!0,retry:!0,isAuthRequired:!1},"claude-3-5-sonnet":{webSearch:!0,imageUpload:!0,retry:!0,isAuthRequired:!0},"claude-3-7-sonnet":{webSearch:!0,imageUpload:!0,retry:!0,isAuthRequired:!0},"gemini-2.5-flash-preview-09-2025":{webSearch:!0,imageUpload:!0,retry:!0,isAuthRequired:!1},"deepseek-r1":{webSearch:!0,imageUpload:!1,retry:!0,isAuthRequired:!0}},o=e=>{switch(e){case"deep":return"Deep Research";case"pro":return"Pro Search";case"gpt-4.1":return"GPT 4.1";case"gpt-4.1-mini":return"GPT 4.1 Mini";case"gpt-4.1-nano":return"GPT 4.1 Nano";case"llama-4-scout":return"Llama 4 Scout";case"gpt-4o-mini":return"GPT 4o Mini";case"claude-3-5-sonnet":return"Claude 3.5 Sonnet";case"claude-3-7-sonnet":return"Claude 3.7 Sonnet";case"o4-mini":return"O4 Mini";case"deepseek-r1":return"DeepSeek R1";case"gemini-2.5-flash-preview-09-2025":return"Gemini 2 Flash"}}},11533:function(e,t,r){"use strict";r.d(t,{pj:function(){return o},Dp:function(){return a},tH:function(){return s},XF:function(){return l},Fo:function(){return i},jv:function(){return d}});let s=e=>{let{messages:t,query:r,imageAttachment:s}=e,n=[...(t||[]).flatMap(e=>{var t;return[{role:"user",content:e.imageAttachment?[{type:"text",text:e.query||""},{type:"image",image:e.imageAttachment}]:e.query||""},{role:"assistant",content:(null===(t=e.answer)||void 0===t?void 0:t.text)||""}]}),{role:"user",content:s?[{type:"text",text:r||""},{type:"image",image:s}]:r||""}];return null!=n?n:[]};var n=r(29572);let a=n.hj.create({name:"shiftEnterToLineBreak",addKeyboardShortcuts:()=>({"Shift-Enter":e=>e.editor.commands.enter()})}),o=n.hj.create({name:"disableEnter",addKeyboardShortcuts:()=>({Enter:()=>!0})}),i=e=>{try{let t=new URL(e).hostname.split(".")[0];if("www"===t)return new URL(e).hostname.split(".")[1];return t}catch(t){return e}},l=e=>{try{return new URL(e).hostname}catch(e){return}};r(19212);let d=e=>{try{return new URL(e),!0}catch(e){return!1}}},13041:function(){}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.