research-agent-ui 0.1.187 → 0.1.188
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./config.cjs"),t=require("./src-
|
|
1
|
+
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./config.cjs"),t=require("./src-o009Easo.cjs");exports.ARTICLE_TOOLBAR_SHORTCUTS=t.S,exports.ArticleAIResponse=t.y,exports.ArticleActionButtons=t.C,exports.ArticleContent=t._,exports.ArticleFollowupQuestions=t.b,exports.ArticlePanelHeader=t.T,exports.ArticlePromptInput=t.x,exports.CategoryDock=t.o,exports.ChatInputBox=t.E,exports.ChatProvider=t.D,exports.ChatWindow=t.f,exports.CookieConsent=t.a,exports.ExtractPanelProvider=t.N,exports.HistoryDialogs=t.m,exports.HistoryDropdown=t.p,exports.KokoroVoiceSelector=t.u,exports.LexicalArticleViewer=t.v,exports.MainViewProvider=t.s,exports.QwkSearchApp=t.n,exports.QwkSearchProviders=t.r,exports.SessionProvider=t.O,exports.UnifiedMarkdown=t.g,exports.VoiceSettingsPanel=t.l,exports.cn=t.F,exports.configureResearchAgentUI=e.configureResearchAgentUI,exports.formatMessageTime=t.I,exports.formatTimeDifference=t.L,exports.formatToolbarShortcut=t.w,exports.researchAgentUIConfig=e.researchAgentUIConfig,exports.useChat=t.A,exports.useChatState=t.j,exports.useChatTabs=t.t,exports.useChunkErrorReload=t.i,exports.useExtractPanel=t.P,exports.useHistoryState=t.h,exports.useKokoroTTS=t.d,exports.useMainView=t.c,exports.useSession=t.k,exports.useTextToSpeech=t.M;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import { configureResearchAgentUI as e, researchAgentUIConfig as t } from "./config.mjs";
|
|
4
|
-
import { A as n, C as r, D as i, E as a, F as o, I as s, L as c, M as l, N as u, O as d, P as f, S as p, T as m, _ as h, a as g, b as _, c as v, d as y, f as b, g as x, h as S, i as C, j as w, k as T, l as E, m as D, n as O, o as k, p as A, r as j, s as M, t as N, u as P, v as F, w as I, x as L, y as R } from "./src-
|
|
4
|
+
import { A as n, C as r, D as i, E as a, F as o, I as s, L as c, M as l, N as u, O as d, P as f, S as p, T as m, _ as h, a as g, b as _, c as v, d as y, f as b, g as x, h as S, i as C, j as w, k as T, l as E, m as D, n as O, o as k, p as A, r as j, s as M, t as N, u as P, v as F, w as I, x as L, y as R } from "./src-DW0_Dglb.js";
|
|
5
5
|
export { p as ARTICLE_TOOLBAR_SHORTCUTS, R as ArticleAIResponse, r as ArticleActionButtons, h as ArticleContent, _ as ArticleFollowupQuestions, m as ArticlePanelHeader, L as ArticlePromptInput, k as CategoryDock, a as ChatInputBox, i as ChatProvider, b as ChatWindow, g as CookieConsent, u as ExtractPanelProvider, D as HistoryDialogs, A as HistoryDropdown, P as KokoroVoiceSelector, F as LexicalArticleViewer, M as MainViewProvider, O as QwkSearchApp, j as QwkSearchProviders, d as SessionProvider, x as UnifiedMarkdown, E as VoiceSettingsPanel, o as cn, e as configureResearchAgentUI, s as formatMessageTime, c as formatTimeDifference, I as formatToolbarShortcut, t as researchAgentUIConfig, n as useChat, w as useChatState, N as useChatTabs, C as useChunkErrorReload, f as useExtractPanel, S as useHistoryState, y as useKokoroTTS, v as useMainView, T as useSession, l as useTextToSpeech };
|
|
@@ -6591,7 +6591,7 @@ function Wa({ listFooterLinks: e = [], optionShowIcons: t = !0, optionBackground
|
|
|
6591
6591
|
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W("div", {
|
|
6592
6592
|
className: `hidden md:flex absolute bottom-2 left-1/2 -translate-x-1/2 text-slate-200 text-xs z-20 ${n} rounded-lg px-2 py-1 shadow-lg hover:shadow-xl hover:-translate-y-1 transition-all duration-300 flex-wrap items-center justify-center gap-x-6 max-w-[90vw]`,
|
|
6593
6593
|
children: /* @__PURE__ */ W("div", {
|
|
6594
|
-
className: "max-w-4xl mx-auto grid grid-cols-
|
|
6594
|
+
className: "max-w-4xl mx-auto grid grid-cols-4 gap-2",
|
|
6595
6595
|
children: o()
|
|
6596
6596
|
})
|
|
6597
6597
|
}), /* @__PURE__ */ G("div", {
|
|
@@ -30,7 +30,7 @@ const e=require("./rolldown-runtime-BocRIvOZ.cjs"),t=require("./config.cjs");let
|
|
|
30
30
|
`,"aria-label":P?`Stop listening`:`Voice input`,children:(0,d.jsx)(Z.Mic,{className:`w-5 h-5`})}),(0,d.jsx)(`div`,{className:`absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-[#1F1E1D] dark:bg-[#EEEEEC] text-[11px] font-medium rounded-[6px] opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none z-50 shadow-sm tracking-wide`,children:(0,d.jsx)(`span`,{className:`text-[#ECECEC] dark:text-[#1F1E1D]`,children:P?`Stop listening`:`Voice input`})})]}),m.length>0&&(0,d.jsxs)(`div`,{className:`relative flex shrink !shrink-0 group`,children:[(0,d.jsx)(`button`,{onClick:e=>{e.stopPropagation(),p()},disabled:t,className:`transition-all duration-200 h-8 w-8 flex items-center justify-center rounded-full active:scale-95 text-text-400 hover:text-text-200 hover:bg-bg-200`,"aria-label":`New chat`,children:(0,d.jsx)(Z.SquarePen,{className:`w-5 h-5`})}),(0,d.jsx)(`div`,{className:`absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-[#1F1E1D] dark:bg-[#EEEEEC] text-[11px] font-medium rounded-[6px] opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none z-50 shadow-sm tracking-wide`,children:(0,d.jsx)(`span`,{className:`text-[#ECECEC] dark:text-[#1F1E1D]`,children:`New chat`})})]}),(0,d.jsxs)(`div`,{className:`relative flex shrink !shrink-0 group`,children:[t?(0,d.jsx)(`button`,{onClick:e=>{e.stopPropagation(),i()},className:`inline-flex items-center justify-center shrink-0 transition-colors h-8 w-8 rounded-full active:scale-95 bg-red-500 text-white hover:bg-red-600 shadow-md`,type:`button`,"aria-label":`Stop generating`,children:(0,d.jsx)(Z.Stop,{className:`w-3.5 h-3.5 fill-current`})}):(0,d.jsx)(`button`,{onClick:e=>{e.stopPropagation(),_e()},disabled:!ye,className:`inline-flex items-center justify-center shrink-0 transition-all duration-200 h-8 w-8 rounded-full active:scale-95
|
|
31
31
|
${ye?`bg-accent text-bg-0 hover:bg-accent-hover shadow-md`:`bg-bg-300 text-text-400 cursor-default opacity-50`}
|
|
32
32
|
`,type:`button`,"aria-label":`Send message`,children:(0,d.jsx)(Z.ArrowUp,{className:`w-4 h-4`})}),(0,d.jsx)(`div`,{className:`absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-[#1F1E1D] dark:bg-[#EEEEEC] text-[11px] font-medium rounded-[6px] opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none z-50 shadow-sm tracking-wide`,children:(0,d.jsx)(`span`,{className:`text-[#ECECEC] dark:text-[#1F1E1D]`,children:t?`Stop generating`:`Send message`})})]})]})]}),(0,d.jsx)(u.AnimatePresence,{children:se&&W>0&&(0,d.jsx)(u.motion.div,{ref:e=>{e&&v.current&&v.current.contains(e)},initial:{opacity:0,y:le===`above`?4:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:le===`above`?4:-4},transition:{duration:.12},className:`absolute left-2 right-2 md:left-0 md:right-0 z-20 rounded-2xl bg-gray-50 dark:bg-[#30302E] border border-bg-300 dark:border-transparent shadow-xl overflow-hidden ${le===`above`?`bottom-full`:`top-full`}`,onMouseDown:e=>e.preventDefault(),children:(0,d.jsxs)(`ul`,{className:`max-h-72 overflow-y-auto custom-scrollbar py-1`,children:[ae.map((e,t)=>(0,d.jsx)(`li`,{children:(0,d.jsxs)(`button`,{type:`button`,onMouseEnter:()=>U(t),onClick:()=>he(e),className:`w-full text-left px-4 py-1.5 text-[15px] flex items-center gap-3 transition-colors ${t===H?`bg-bg-200 text-text-100`:`text-text-200 hover:bg-bg-100 dark:hover:bg-[#3A3A38]`}`,children:[(0,d.jsx)(`span`,{className:`w-5 h-5 flex items-center justify-center rounded bg-bg-200 dark:bg-[#3A3A38] text-[11px] font-semibold text-text-400 shrink-0`,children:t+1}),(0,d.jsx)(`img`,{src:e.favicon,alt:``,className:`w-4 h-4 rounded-sm shrink-0`}),(0,d.jsx)(`span`,{className:`truncate font-medium`,children:e.name||e.domain}),(0,d.jsx)(`span`,{className:`truncate text-[13px] text-text-400 shrink-0`,children:e.domain}),Number.isFinite(e.rank)&&e.rank<2**53-1&&(0,d.jsxs)(`span`,{className:`ml-auto shrink-0 px-1.5 py-0.5 rounded-full text-[10px] font-semibold tabular-nums bg-bg-200 dark:bg-[#3A3A38] text-text-400`,children:[`#`,e.rank.toLocaleString()]})]})},`domain-${e.domain}`)),re.map((e,t)=>{let n=ae.length+t;return(0,d.jsx)(`li`,{children:(0,d.jsxs)(`button`,{type:`button`,onMouseEnter:()=>U(n),onClick:()=>me(e),className:`w-full text-left px-4 py-1.5 text-[15px] flex items-center gap-3 transition-colors ${n===H?`bg-bg-200 text-text-100`:`text-text-200 hover:bg-bg-100 dark:hover:bg-[#3A3A38]`}`,children:[(0,d.jsx)(`span`,{className:`w-5 h-5 flex items-center justify-center rounded bg-bg-200 dark:bg-[#3A3A38] text-[11px] font-semibold text-text-400 shrink-0`,children:n+1}),(0,d.jsx)(s.Search,{className:`w-4 h-4 text-text-400 shrink-0`}),(0,d.jsx)(`span`,{className:`truncate`,children:e})]})},`${e}-${t}`)})]})})}),C&&(0,d.jsxs)(`div`,{className:`absolute inset-0 bg-bg-200/90 border-2 border-dashed border-accent rounded-[28px] z-50 flex flex-col items-center justify-center backdrop-blur-sm pointer-events-none`,children:[(0,d.jsx)(Z.Archive,{className:`w-10 h-10 text-accent mb-2 animate-bounce`}),(0,d.jsx)(`p`,{className:`text-accent font-medium`,children:`Drop files to upload`})]})]})},Kn=n.forwardRef(({className:e,...t},n)=>(0,d.jsx)(`span`,{ref:n,className:F(`absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0`,e),style:{clip:`rect(0, 0, 0, 0)`,clipPath:`inset(50%)`},...t}));Kn.displayName=`VisuallyHidden`;var qn=({onClose:e})=>(0,d.jsx)(`div`,{className:`flex items-center justify-between bg-secondary px-4 py-3 border-b border-border`,children:(0,d.jsx)(`button`,{onClick:e,className:`rounded-md p-1 hover:bg-accent transition-colors`,children:(0,d.jsx)(s.X,{className:`h-5 w-5`})})}),Jn=(0,x.cva)(`inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-2xl text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60`,outline:`border-[1.5px] bg-background hover:bg-accent hover:text-accent-foreground dark:bg-card dark:hover:bg-card/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2 has-[>svg]:px-3`,sm:`h-8 gap-1.5 px-3 has-[>svg]:px-2.5`,lg:`h-10 px-6 has-[>svg]:px-4`,icon:`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function Q({className:e,variant:t,size:n,asChild:r=!1,...i}){return(0,d.jsx)(r?b.Slot:`button`,{"data-slot":`button`,className:F(Jn({variant:t,size:n,className:e})),...i})}var Yn={ask:{alt:!0,key:`a`},suggest:{alt:!0,key:`s`},copy:{alt:!0,key:`c`},highlight:{alt:!0,key:`h`},favorite:{alt:!0,key:`f`},open:{alt:!0,key:`o`},zoomOut:{alt:!0,key:`-`},zoomReset:{alt:!0,key:`0`},zoomIn:{alt:!0,key:`=`},close:{alt:!1,key:`Escape`}},Xn=typeof navigator<`u`&&/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent||``);function Zn(e){let{alt:t,key:n}=Yn[e],r=n===`Escape`?`Esc`:n.length===1?n.toUpperCase():n;return t?Xn?`⌥${r}`:`Alt+${r}`:r}var Qn=F(`h-9 w-9 rounded-xl transition-all duration-200`,`hover:bg-muted/80 hover:text-foreground text-muted-foreground`),$=({label:e,action:t,children:n})=>(0,d.jsxs)(K,{children:[(0,d.jsx)(q,{asChild:!0,children:n}),(0,d.jsx)(J,{side:`bottom`,children:(0,d.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,d.jsx)(`span`,{children:e}),t&&(0,d.jsx)(`kbd`,{className:`rounded bg-primary-foreground/20 px-1 py-0.5 text-[10px] font-semibold leading-none tracking-wide`,children:Zn(t)})]})})]}),$n=({isLoadingAI:e,isLoadingFollowups:t,isLoadingFavorite:n,isFavorited:r,isHighlightMode:i,articleUrl:a,fontScale:o,onAskClick:c,onSuggestClick:l,onCopyClick:u,onShareClick:f,onFavoriteClick:p,onHighlightToggle:m,onZoomIn:h,onZoomOut:g,onZoomReset:_,onClose:v})=>{let y=h||g,b=Math.round((o??1)*100);return(0,d.jsxs)(`div`,{className:`flex flex-nowrap items-center gap-1 rounded-2xl border border-muted bg-gradient-to-b from-background to-muted/30 p-1 shadow-sm`,children:[(0,d.jsx)($,{label:`Ask AI about this article`,action:`ask`,children:(0,d.jsxs)(Q,{onClick:c,disabled:e,variant:`ghost`,size:`sm`,className:F(`flex items-center gap-2 px-3 h-9 rounded-xl transition-all duration-200`,`hover:bg-muted/80 hover:text-foreground text-muted-foreground`),children:[(0,d.jsx)(s.Bot,{className:`size-4`}),(0,d.jsx)(`span`,{className:`font-medium`,children:e?`...`:`Ask`})]})}),(0,d.jsx)($,{label:`Suggest follow-up questions`,action:`suggest`,children:(0,d.jsxs)(Q,{onClick:l,disabled:t,variant:`ghost`,size:`sm`,className:F(`flex items-center gap-2 px-3 h-9 rounded-xl transition-all duration-200`,`hover:bg-muted/80 hover:text-foreground text-muted-foreground`),children:[(0,d.jsx)(s.MessageCircleQuestion,{className:`size-4`}),(0,d.jsx)(`span`,{className:`font-medium`,children:`Suggest`})]})}),(0,d.jsx)($,{label:`Copy article`,action:`copy`,children:(0,d.jsx)(Q,{onClick:u,variant:`ghost`,size:`icon`,className:Qn,children:(0,d.jsx)(s.Clipboard,{className:`size-4`})})}),(0,d.jsx)($,{label:`Share article`,children:(0,d.jsx)(Q,{onClick:f,variant:`ghost`,size:`icon`,className:Qn,children:(0,d.jsx)(s.Share2,{className:`size-4`})})}),(0,d.jsx)($,{label:i?`Disable highlighting`:`Enable highlighting`,action:`highlight`,children:(0,d.jsx)(Q,{onClick:m,variant:`ghost`,size:`icon`,className:F(`h-9 w-9 rounded-xl transition-all duration-200`,i?`text-yellow-500 bg-yellow-50 dark:bg-yellow-950/30 hover:bg-yellow-100 dark:hover:bg-yellow-950/50`:`hover:bg-muted/80 hover:text-foreground text-muted-foreground`),children:(0,d.jsx)(s.Highlighter,{className:`size-4`})})}),(0,d.jsx)($,{label:r?`Remove from favorites`:`Add to favorites`,action:`favorite`,children:(0,d.jsx)(Q,{onClick:p,disabled:n,variant:`ghost`,size:`icon`,className:F(`h-9 w-9 rounded-xl transition-all duration-200`,r?`text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50 dark:hover:bg-yellow-950/30`:`hover:bg-muted/80 hover:text-foreground text-muted-foreground`),children:(0,d.jsx)(s.Star,{className:F(`size-4`,r&&`fill-yellow-400`)})})}),a&&(0,d.jsx)($,{label:`Open in new tab`,action:`open`,children:(0,d.jsx)(Q,{asChild:!0,variant:`ghost`,size:`icon`,className:Qn,children:(0,d.jsx)(`a`,{href:a,target:`_blank`,rel:`noopener noreferrer`,children:(0,d.jsx)(s.ExternalLink,{className:`size-4`})})})}),y&&(0,d.jsxs)(`div`,{className:`ml-auto flex items-center gap-0.5 rounded-xl border border-muted/60 bg-muted/20 px-1`,children:[(0,d.jsx)($,{label:`Zoom out`,action:`zoomOut`,children:(0,d.jsx)(Q,{onClick:g,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-muted-foreground transition-all duration-200 hover:bg-muted/80 hover:text-foreground`,children:(0,d.jsx)(s.ZoomOut,{className:`size-4`})})}),(0,d.jsx)($,{label:`Reset zoom`,action:`zoomReset`,children:(0,d.jsxs)(`button`,{type:`button`,onClick:_,className:`min-w-[3rem] rounded-md px-1 text-center text-xs font-medium tabular-nums text-muted-foreground transition-colors hover:text-foreground`,children:[b,`%`]})}),(0,d.jsx)($,{label:`Zoom in`,action:`zoomIn`,children:(0,d.jsx)(Q,{onClick:h,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-muted-foreground transition-all duration-200 hover:bg-muted/80 hover:text-foreground`,children:(0,d.jsx)(s.ZoomIn,{className:`size-4`})})})]}),(0,d.jsx)($,{label:`Close`,action:`close`,children:(0,d.jsx)(Q,{onClick:v,variant:`ghost`,size:`icon`,className:F(Qn,!y&&`ml-auto`),children:(0,d.jsx)(s.X,{className:`size-4`})})})]})},er=({value:e,onChange:t,onSubmit:n})=>(0,d.jsx)(`div`,{className:`relative`,children:(0,d.jsx)(`input`,{value:e,onChange:e=>t(e.target.value),onKeyDown:e=>e.key===`Enter`&&n(),type:`text`,placeholder:`Ask AI any question...`,className:`w-full px-3 py-2 text-sm rounded-md border border-input bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-ring`})}),tr=({questions:e,isLoading:r,error:i,onQuestionClick:a})=>{let o=n.default.useMemo(()=>{let t=[];return e.forEach(e=>{e.includes(`?`)&&e.split(`?`).length>2?e.split(`?`).map(e=>e.trim()).filter(Boolean).forEach(e=>{t.push(e.endsWith(`?`)?e:`${e}?`)}):t.push(e)}),t},[e]);return(0,d.jsxs)(d.Fragment,{children:[o.length>0&&(0,d.jsxs)(`div`,{className:`space-y-3 bg-accent/30 rounded-lg p-4 border border-primary/20`,children:[(0,d.jsx)(`h3`,{className:`text-sm font-bold text-primary mb-2`,children:`💡 Suggested Follow-up Questions`}),(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(`div`,{onClick:()=>a(t.researchAgentUIConfig.defaultSummarizePrompt),className:`cursor-pointer rounded-md p-3 text-sm font-semibold hover:bg-primary/10 bg-background border border-primary/30 transition-all hover:border-primary shadow-sm hover:shadow-md`,children:t.researchAgentUIConfig.defaultSummarizePrompt}),o.map((e,t)=>(0,d.jsx)(`div`,{onClick:()=>a(e),className:`cursor-pointer rounded-md p-3 text-sm font-semibold hover:bg-primary/10 bg-background border border-border transition-all hover:border-primary shadow-sm hover:shadow-md`,dangerouslySetInnerHTML:{__html:e}},t))]})]}),r&&(0,d.jsx)(`div`,{className:`flex justify-center`,children:(0,d.jsx)(`div`,{className:`animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500`})}),i&&(0,d.jsx)(`div`,{className:`bg-red-500 text-white p-2 rounded-md text-sm`,children:i})]})},nr=({response:e,isLoading:t,error:n})=>(0,d.jsxs)(d.Fragment,{children:[t&&(0,d.jsx)(`div`,{className:`flex justify-center`,children:(0,d.jsx)(`div`,{className:`animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500`})}),e&&(0,d.jsx)(`div`,{ref:e=>{},className:`bg-muted rounded-lg shadow-md p-4`,dangerouslySetInnerHTML:{__html:e}}),n&&(0,d.jsx)(`div`,{className:`bg-red-500 text-white p-2 rounded-md text-sm`,children:n})]}),rr=({html:e,isHighlightMode:t=!1,fontScale:r=1})=>{let[i,a]=(0,n.useState)(``);return(0,n.useEffect)(()=>{a(E.default.sanitize(e||``,{ADD_TAGS:[`figure`,`figcaption`],ADD_ATTR:[`loading`]}))},[e]),(0,d.jsx)(`div`,{className:[`prose prose-neutral dark:prose-invert max-w-none`,`prose-p:leading-[1.9] prose-li:leading-[1.9] prose-p:my-5 prose-li:my-1.5`,`prose-headings:font-semibold prose-headings:tracking-tight prose-headings:leading-snug`,`prose-h1:mt-8 prose-h2:mt-8 prose-h3:mt-6`,`prose-blockquote:leading-[1.8] prose-blockquote:border-l-2`,`prose-img:rounded-lg prose-img:my-6`,t?`select-text`:``].join(` `),style:{fontSize:`${r}em`,fontFamily:`ui-serif, Georgia, Cambria, "Times New Roman", Times, serif`},dangerouslySetInnerHTML:{__html:i}})},ir=({article:e,isHighlightMode:t,fontScale:n=1})=>(0,d.jsx)(`div`,{className:`border-t border-border pt-6`,children:(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`flex items-start justify-between mb-2`}),e.cite&&(0,d.jsx)(`div`,{className:`mb-3 text-sm text-muted-foreground`,dangerouslySetInnerHTML:{__html:e.cite}}),(0,d.jsx)(`div`,{className:`mb-3 text-xs text-muted-foreground space-y-1`,children:e.word_count&&(0,d.jsxs)(`p`,{children:[(0,d.jsx)(`span`,{className:`font-semibold`,children:`Words:`}),` `,e.word_count.toLocaleString()]})}),(0,d.jsx)(`div`,{id:`article-content`,children:(0,d.jsx)(rr,{html:e.html||``,isHighlightMode:t,fontScale:n})})]})}),ar=/(?:https?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)/g,or=/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g;function sr(e){return e.includes(`](`)||e.includes(`)[`)?!1:/\.(com|org|net|io|dev|co|uk|de|fr|it|es|jp|cn|in|br|au|ca|us|gov|edu|mil|int|xyz|info|app|tech|online|site|website|store|shop|blog|news|tv|me|cc|ws|name|mobi|asia|tel|travel|jobs|pro|museum|coop|aero|arpa|biz|cat|jobs|post|tel|xxx|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw)(?:\/|$)/i.test(e)}function cr(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}function lr(e){if(!e||typeof e!=`string`)return e;let t=e,n=[],r;for(or.lastIndex=0;(r=or.exec(t))!==null;){let e=r[0],i=r.index,a=t.substring(0,i),o=t.substring(i+e.length);!a.endsWith(`](`)&&!o.startsWith(`)`)&&n.push({email:e,index:i})}for(let e=n.length-1;e>=0;e--){let{email:r,index:i}=n[e];t=t.substring(0,i)+`[${r}](mailto:${r})`+t.substring(i+r.length)}let i=[],a;for(ar.lastIndex=0;(a=ar.exec(t))!==null;){let e=a[0],n=a.index;if(or.test(e))continue;let r=t.substring(0,n),o=t.substring(n+e.length);if(r.endsWith(`](`)||o.startsWith(`)`)||(r.match(/```/g)||[]).length%2!=0)continue;let s=r.lastIndexOf("`");if(s!==-1){let e=t.substring(s+1).indexOf("`");if(e!==-1&&e>n-s-1)continue}sr(e)&&i.push({url:e,index:n})}for(let e=i.length-1;e>=0;e--){let{url:n,index:r}=i[e],a=cr(n);t=t.substring(0,r)+`[${n}](${a})`+t.substring(r+n.length)}return t}function ur(e){return!e||e.startsWith(`http://`)||e.startsWith(`https://`)||e.includes(`://`)?!1:e.startsWith(`/`)||e.startsWith(`#`)}function dr(e,t){if(t.startsWith(`#`)){e.preventDefault();let n=t.substring(1),r=document.getElementById(n);r&&r.scrollIntoView({behavior:`smooth`,block:`start`})}}function fr({code:e}){let[t,r]=(0,n.useState)(!1),i=(0,n.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),2e3)}catch(e){console.error(`Failed to copy:`,e)}},[e]);return(0,d.jsx)(`button`,{onClick:i,className:F(`absolute top-3 right-3 p-1.5 rounded-md`,`opacity-0 group-hover:opacity-100 transition-opacity duration-150`,`bg-zinc-200/80 hover:bg-zinc-300 dark:bg-zinc-700/80 dark:hover:bg-zinc-600`,`text-zinc-600 hover:text-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-200`,`focus:outline-none focus:ring-1 focus:ring-zinc-400 dark:focus:ring-zinc-500`),"aria-label":t?`Copied!`:`Copy code`,children:t?(0,d.jsx)(s.Check,{className:`h-4 w-4 text-green-600 dark:text-green-400`}):(0,d.jsx)(s.Copy,{className:`h-4 w-4`})})}function pr({children:e}){let t=(0,n.useRef)(null),[r,i]=(0,n.useState)(``);return(0,n.useEffect)(()=>{if(t.current){let e=t.current.querySelector(`code`);if(e){let t=e.textContent||``;i(t.trim())}}},[e]),(0,d.jsxs)(`div`,{className:`relative group my-5`,children:[(0,d.jsx)(`pre`,{ref:t,className:F(`p-4 rounded-xl overflow-x-auto`,`bg-zinc-100 dark:bg-zinc-900`,`border border-zinc-200 dark:border-zinc-800`,`text-[13px] font-mono leading-relaxed`,`text-zinc-800 dark:text-zinc-200`,`[&_code]:bg-transparent [&_code]:text-inherit [&_code]:p-0`),children:e}),r&&(0,d.jsx)(fr,{code:r})]})}var mr=n.default.memo(({content:e,className:t,isStreaming:n=!1})=>{if(!e)return(0,d.jsx)(`div`,{className:F(`text-muted-foreground text-sm`,t),children:`No content`});let r=lr(e);return(0,d.jsx)(`div`,{className:F(`kortix-markdown`,t),children:(0,d.jsx)(O.Streamdown,{isAnimating:n,components:{h1:({children:e})=>(0,d.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-foreground mt-8 mb-4 first:mt-0 pb-2 border-b border-border/40`,children:e}),h2:({children:e})=>(0,d.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight text-foreground mt-8 mb-3 first:mt-0`,children:e}),h3:({children:e})=>(0,d.jsx)(`h3`,{className:`text-lg font-semibold text-foreground mt-6 mb-2 first:mt-0`,children:e}),h4:({children:e})=>(0,d.jsx)(`h4`,{className:`text-base font-semibold text-foreground mt-5 mb-2 first:mt-0`,children:e}),h5:({children:e})=>(0,d.jsx)(`h5`,{className:`text-sm font-semibold text-foreground mt-4 mb-1 first:mt-0`,children:e}),h6:({children:e})=>(0,d.jsx)(`h6`,{className:`text-sm font-medium text-muted-foreground mt-4 mb-1 first:mt-0 uppercase tracking-wide`,children:e}),p:({children:e})=>(0,d.jsx)(`p`,{className:`text-sm text-foreground leading-relaxed my-4 first:mt-0 last:mb-0 [&:has(img)]:my-0`,children:e}),ul:({children:e})=>(0,d.jsx)(`ul`,{className:`my-4 ml-6 list-disc marker:text-muted-foreground/60 space-y-2 first:mt-0 last:mb-0 text-sm`,children:e}),ol:({children:e})=>(0,d.jsx)(`ol`,{className:`my-4 ml-6 list-decimal marker:text-muted-foreground/60 marker:font-medium space-y-2 first:mt-0 last:mb-0 text-sm`,children:e}),li:({children:e})=>(0,d.jsx)(`li`,{className:`text-sm text-foreground leading-relaxed pl-1`,children:e}),a:({href:e,children:t})=>{let n=ur(e),r=e?.startsWith(`#`),i=F(`font-medium text-foreground`,`underline decoration-foreground/30 underline-offset-[3px] decoration-[1px]`,`hover:decoration-foreground/60 transition-colors duration-150`);return r?(0,d.jsx)(`a`,{href:e,onClick:t=>dr(t,e),className:i,children:t}):n?(0,d.jsx)(D.default,{href:e||`#`,className:i,children:t}):(0,d.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:i,children:t})},code:({children:e,className:t})=>t?.includes(`language-`)?(0,d.jsx)(`code`,{className:`text-[13px] leading-relaxed text-inherit`,children:e}):(0,d.jsx)(`code`,{className:`px-2 py-1 rounded-md text-[13px] font-mono bg-card dark:bg-[#161618] border border-neutral-200 dark:border-neutral-700/50 text-foreground`,children:e}),pre:({children:e})=>(0,d.jsx)(pr,{children:e}),blockquote:({children:e})=>(0,d.jsx)(`blockquote`,{className:F(`my-5 pl-4 py-1 text-sm`,`border-l-2 border-border`,`text-muted-foreground`,`[&>p]:my-2`),children:e}),hr:()=>(0,d.jsx)(`hr`,{className:`my-8 border-0 h-px bg-border/60`}),table:({children:e})=>(0,d.jsx)(`div`,{className:`my-5 overflow-x-auto rounded-xl border border-border/60`,children:(0,d.jsx)(`table`,{className:`w-full text-sm`,children:e})}),thead:({children:e})=>(0,d.jsx)(`thead`,{className:`bg-muted/50 dark:bg-muted/30 border-b border-border/60`,children:e}),tbody:({children:e})=>(0,d.jsx)(`tbody`,{className:`divide-y divide-border/40`,children:e}),tr:({children:e})=>(0,d.jsx)(`tr`,{className:`transition-colors hover:bg-muted/30`,children:e}),th:({children:e})=>(0,d.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-semibold text-foreground uppercase tracking-wider`,children:e}),td:({children:e})=>(0,d.jsx)(`td`,{className:`px-4 py-3 text-foreground`,children:e}),img:({src:e,alt:t})=>e?(0,d.jsxs)(`span`,{className:`block my-5`,children:[(0,d.jsx)(`img`,{src:e,alt:t||``,className:F(`max-w-full h-auto rounded-xl`,`border border-border/40`,`shadow-sm`),loading:`lazy`}),t&&(0,d.jsx)(`span`,{className:`block mt-2 text-center text-sm text-muted-foreground`,children:t})]}):null,strong:({children:e})=>(0,d.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e}),em:({children:e})=>(0,d.jsx)(`em`,{className:`italic text-foreground/90`,children:e}),del:({children:e})=>(0,d.jsx)(`del`,{className:`line-through text-muted-foreground decoration-muted-foreground/50`,children:e}),input:({checked:e,...t})=>(0,d.jsx)(`input`,{type:`checkbox`,checked:e,readOnly:!0,className:F(`mr-2 h-4 w-4 rounded border-border`,`accent-secondary cursor-default`,`align-middle relative -top-[1px]`),...t}),div:({children:e,style:t,className:n,...r})=>(0,d.jsx)(`div`,{className:F(`text-sm text-foreground`,n),style:t,...r,children:e}),span:({children:e,style:t,className:n,...r})=>(0,d.jsx)(`span`,{className:F(`text-foreground`,n),style:t,...r,children:e})},children:r})})});mr.displayName=`UnifiedMarkdown`;function hr(e){return e instanceof Error&&e.name===`AbortError`}async function gr(e,t){if(t.share)try{return await t.share(e),`shared`}catch(e){if(hr(e))return`cancelled`}return await t.writeText(e.url),`copied`}var _r=e=>{let{isOpen:r,url:i,searchText:a,panelWidth:o,setPanelWidth:s,closePanel:l}=B(),{isAuthenticated:u}=nt(),{chatModelProvider:f}=G(),p=e.isOpen===void 0?r:e.isOpen,h=e.onClose||l,g=e.url||i,_=e.searchText===void 0?a:e.searchText,[v,y]=(0,n.useState)(null),[b,x]=(0,n.useState)([]),[S,C]=(0,n.useState)(!1),[w,T]=(0,n.useState)(!1),[E,D]=(0,n.useState)(t.researchAgentUIConfig.defaultSummarizePrompt),[O,k]=(0,n.useState)(!1),[A,j]=(0,n.useState)(!1),[M,N]=(0,n.useState)(!1),[P,F]=(0,n.useState)(``),[I,L]=(0,n.useState)(``),[R,z]=(0,n.useState)([]),[ee,te]=(0,n.useState)(``),[V,ne]=(0,n.useState)(!1),[re,ie]=(0,n.useState)(!1),[ae,oe]=(0,n.useState)(!1),[H,se]=(0,n.useState)(!1),[ce,le]=(0,n.useState)(o),[fe,pe]=(0,n.useState)(!1),[me,he]=(0,n.useState)(!1),[W,ge]=(0,n.useState)(1),_e=(0,n.useRef)(null),ve=(0,n.useRef)({}),ye=.5,be=1.8,xe=.1;(0,n.useEffect)(()=>{let e=parseFloat(localStorage.getItem(`articleFontScale`)||``);Number.isNaN(e)||ge(Math.min(be,Math.max(ye,e)))},[]);let Se=e=>{let t=Math.min(be,Math.max(ye,Math.round(e*100)/100));ge(t);try{localStorage.setItem(`articleFontScale`,String(t))}catch(e){console.error(`Error storing article font scale:`,e)}},Ce=()=>Se(W+xe),we=()=>Se(W-xe),Te=()=>Se(1);(0,n.useEffect)(()=>{let e=()=>{se(window.innerWidth>=1024)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,n.useEffect)(()=>{let e=e=>{if(!fe)return;let t=window.innerWidth-e.clientX,n=Math.max(400,Math.min(t,window.innerWidth-100));le(n),s(n)},t=()=>{pe(!1)};return fe&&(document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),document.body.style.cursor=`ew-resize`,document.body.style.userSelect=`none`),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t),document.body.style.cursor=``,document.body.style.userSelect=``}},[fe,s]),(0,n.useEffect)(()=>{p&&g?(he(!1),Ee()):p||he(!1)},[p,g]);let Ee=async()=>{console.log(`[ArticleExtractPanel] Extracting URL:`,g);try{let e=new URL(g);if([/^https?:\/\/(www\.)?google\.[^/]+\/search/i,/^https?:\/\/(www\.)?bing\.com\/search/i,/^https?:\/\/(www\.)?duckduckgo\.com\/\?/i].some(e=>e.test(g))){m.toast.error(`Cannot extract articles from search result pages`),k(!1),he(!0);return}(e.pathname===`/`||e.pathname===``)&&(console.error(`[ArticleExtractPanel] URL is domain-only, missing article path:`,g),m.toast.error(`Invalid article URL - only domain provided`))}catch(e){console.error(`[ArticleExtractPanel] Invalid URL format:`,g,e)}k(!0);try{let{data:e}=await(0,c.getArticle)({query:{url:g}}),t=e?.article,n=t?.html?.replace(/<[^>]*>/g,``).trim()||``;t?.error||n.length<20?(document.dispatchEvent(new CustomEvent(`onInvokeChromeAPI`,{detail:{type:`extractURL`,url:g}})),await Promise.race([new Promise(e=>{let t=async n=>{window.removeEventListener(`onExtractionResult`,t);let{data:r}=await(0,c.getArticle)({query:{url:g}}),i=r?.article;i&&(y(i),i.followUpQuestions?.length>0&&z(i.followUpQuestions)),e()};window.addEventListener(`onExtractionResult`,t)}),new Promise(e=>setTimeout(e,1e4))])):(y(t),t?.followUpQuestions&&t.followUpQuestions.length>0&&z(t.followUpQuestions)),u&&De()}catch(e){console.error(`[ArticleExtractPanel] Error extracting URL:`,e),m.toast.error(`Failed to load article`)}finally{k(!1),he(!0)}},De=async()=>{try{let{data:e}=await(0,c.listFavorites)(),t=e?.favorites?.some(e=>e.url===g);ne(!!t)}catch(e){console.error(`Error checking favorite status:`,e)}},Oe=async()=>{if(v){ie(!0);try{V?(await(0,c.removeFavorite)({query:{url:g}}),ne(!1),m.toast.info(`Removed from favorites`)):(await(0,c.addFavorite)({body:{url:v.url||g,title:v.title,cite:v.cite,author:v.author,author_cite:v.author_cite,date:v.date,source:v.source,word_count:v.word_count,html:v.html}}),ne(!0),m.toast.success(`Added to favorites`))}catch(e){console.error(`Error toggling favorite:`,e),m.toast.error(`Failed to toggle favorite`)}finally{ie(!1)}}},ke=()=>{if(f?.key&&f?.providerId)return f;try{let e=localStorage.getItem(`chatModelKey`)||``,t=localStorage.getItem(`chatModelProviderId`)||``;if(e&&t)return{key:e,providerId:t}}catch(e){console.error(`Error reading persisted chat model:`,e)}return f},Ae=async e=>{if(!v)return;let n=ke(),r=v.html?.replace(/<[^>]*>?/g,``).slice(0,t.researchAgentUIConfig.maxArticleLength),i=e===`question`,a=i?j:N,o=i?L:te;a(!0),o(``);try{if(i){let e=[_,E].filter(Boolean).join(`
|
|
33
|
-
`);if(!r||r.length===0)throw Error(`Article content is empty`);let{data:t,error:i}=await(0,c.articleQa)({body:{article:r,question:e,chatHistory:b.slice(-5),chatModel:n}});if(i){let e=i.details||i.error||i.message||`Article QA failed`;throw Error(e)}let a=t?.content||``;F(a),x(e=>[...e,{role:`user`,content:E,time:new Date().toISOString()},{role:`assistant`,content:a,time:new Date().toISOString()}]);try{await(0,c.updateArticle)({body:{url:g,question:E,answer:a}})}catch(e){console.error(`Error storing Q&A in cache:`,e)}}else{let e=parseInt(localStorage.getItem(`maxFollowupQuestions`)||`4`);if(!r||r.length===0)throw Error(`Article content is empty`);let{data:t,error:i}=await(0,c.articleFollowups)({body:{article:r,chatHistory:b.slice(-5),maxQuestions:e,chatModel:n}});if(i){let e=i.details||i.error||i.message||`Article followups failed`;throw Error(e)}let a=t?.extract||[];z(a);try{await(0,c.updateArticle)({body:{url:g,followUpQuestions:a}})}catch(e){console.error(`Error storing follow-up questions in cache:`,e)}}}catch(e){console.error(`Error calling language API:`,e),o(e instanceof Error||typeof e==`object`&&e&&`message`in e?e.message:`Failed to get AI response`)}finally{a(!1)}},je=e=>{D(e),Ae(`question`)},Me=async()=>{if(!v)return;let e=`${P}\n\n\n${v.cite||``}\n\n\n${v.html}`;try{await navigator.clipboard.writeText(e),C(!0),setTimeout(()=>C(!1),2e3)}catch(e){console.error(`Failed to copy to clipboard:`,e)}},Ne=async()=>{let e=v?.url||g;if(e)try{await gr({title:v?.title,text:v?.cite,url:e},{share:typeof navigator<`u`&&navigator.share?e=>navigator.share(e):void 0,writeText:e=>navigator.clipboard.writeText(e)})===`copied`&&(T(!0),setTimeout(()=>T(!1),2e3))}catch(e){console.error(`Failed to share article:`,e)}};ve.current={ask:()=>Ae(`question`),suggest:()=>Ae(`suggest-followups`),copy:Me,highlight:()=>oe(e=>!e),favorite:Oe,open:()=>{let e=v?.url||g;e&&window.open(e,`_blank`,`noopener,noreferrer`)},zoomIn:Ce,zoomOut:we,zoomReset:Te,close:h},(0,n.useEffect)(()=>{if(!p)return;let e=e=>/^[a-z]$/.test(e)?`Key${e.toUpperCase()}`:/^[0-9]$/.test(e)?`Digit${e}`:e===`-`?`Minus`:e===`=`?`Equal`:e,t={};Object.keys(Yn).forEach(n=>{let{alt:r,key:i}=Yn[n];r&&(t[e(i.toLowerCase())]=n)});let n=e=>{if(e.key===`Escape`){ve.current.close?.();return}if(!e.altKey||e.ctrlKey||e.metaKey)return;let n=e.target;if(n&&(n.tagName===`INPUT`||n.tagName===`TEXTAREA`||n.isContentEditable))return;let r=t[e.code];if(!r)return;let i=ve.current[r];i&&(e.preventDefault(),i())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[p]);let Pe=()=>(0,d.jsxs)(`div`,{className:`flex h-full flex-col bg-background shadow-xl`,children:[(0,d.jsx)(`div`,{className:`shrink-0 border-b border-border bg-background/95 px-4 py-3 backdrop-blur supports-[backdrop-filter]:bg-background/80`,children:(0,d.jsx)($n,{isLoadingAI:A,isLoadingFollowups:M,isLoadingFavorite:re,isFavorited:V,isHighlightMode:ae,articleUrl:v?.url||g,fontScale:W,onAskClick:()=>Ae(`question`),onSuggestClick:()=>Ae(`suggest-followups`),onCopyClick:Me,onShareClick:Ne,onFavoriteClick:Oe,onHighlightToggle:()=>oe(!ae),onZoomIn:Ce,onZoomOut:we,onZoomReset:Te,onClose:h})}),(0,d.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,d.jsxs)(`div`,{className:`p-4 space-y-6`,children:[(0,d.jsxs)(`div`,{className:`space-y-4`,children:[S&&(0,d.jsx)(`div`,{className:`bg-blue-500 text-white text-sm font-medium px-3 py-2 rounded-md shadow-lg`,children:`Copied!`}),w&&(0,d.jsx)(`div`,{className:`bg-blue-500 text-white text-sm font-medium px-3 py-2 rounded-md shadow-lg`,children:`Link copied!`}),(0,d.jsx)(er,{value:E,onChange:D,onSubmit:()=>Ae(`question`)}),(0,d.jsx)(tr,{questions:R,isLoading:M,error:ee,onQuestionClick:je}),b.length>0&&(0,d.jsx)(`div`,{className:`space-y-4`,children:b.map((e,t)=>(0,d.jsx)(`div`,{className:`space-y-2`,children:e.role===`user`?(0,d.jsxs)(`div`,{className:`bg-primary/10 border border-primary/20 rounded-lg p-3`,children:[(0,d.jsx)(`div`,{className:`text-xs font-semibold text-primary mb-1`,children:`Your Question`}),(0,d.jsx)(`div`,{className:`text-sm text-foreground`,children:e.content})]}):(0,d.jsxs)(`div`,{className:`bg-muted rounded-lg shadow-md p-4`,children:[(0,d.jsx)(`div`,{className:`text-xs font-semibold text-muted-foreground mb-2`,children:`AI Response`}),(0,d.jsx)(`div`,{className:`text-sm`,dangerouslySetInnerHTML:{__html:e.content}})]})},t))}),(A||P&&b.length===0)&&(0,d.jsx)(nr,{response:P,isLoading:A,error:I}),I&&!A&&(0,d.jsx)(`div`,{className:`bg-red-500 text-white p-2 rounded-md text-sm`,children:I})]}),v&&(0,d.jsx)(ir,{article:v,isHighlightMode:ae,fontScale:W})]})})]});return!p||!me?null:H?(0,d.jsxs)(`div`,{className:`fixed top-0 right-0 h-screen z-40 transition-all duration-300`,style:{width:`${ce}px`},children:[(0,d.jsx)(`div`,{ref:_e,onMouseDown:()=>pe(!0),className:`absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-primary bg-transparent transition-colors z-50`,style:{touchAction:`none`},children:(0,d.jsx)(`div`,{className:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-1 h-12 rounded-full bg-muted-foreground opacity-50 hover:opacity-100 transition-opacity`})}),Pe()]}):(0,d.jsx)(U,{open:p,onOpenChange:e=>!e&&h(),children:(0,d.jsxs)(ue,{className:`pointer-events-auto fixed inset-0 !top-0 !left-0 !translate-x-0 !translate-y-0 h-full w-full max-w-none p-0 m-0 rounded-none border-0 overflow-hidden 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]:slide-out-to-right data-[state=open]:slide-in-from-right`,hideCloseButton:!0,children:[(0,d.jsx)(Kn,{children:(0,d.jsx)(de,{children:`Article Details`})}),(0,d.jsx)(`div`,{className:`h-full overflow-y-auto`,children:Pe()})]})})},vr=()=>{let{sections:e,chatTurns:r,loading:i,messageAppeared:a,newChat:o,chatId:s}=G(),{isOpen:c,panelWidth:l}=B(),{isAuthenticated:u}=nt(),[f,p]=(0,n.useState)(!1),m=(0,n.useRef)(null),h=(0,n.useRef)(null),g=(0,n.useRef)(!1);(0,n.useEffect)(()=>{let e=()=>{p(window.innerWidth>=1024)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,n.useEffect)(()=>{if(r.length===1&&(document.title=`${r[0].content.substring(0,30)} - ${t.researchAgentUIConfig.appName}`),r[r.length-1]?.role===`user`){g.current=!0,h.current?.scrollIntoView({behavior:`auto`}),setTimeout(()=>{g.current=!1},100);return}},[r]);let _=f&&c?{width:`calc(100% - ${l}px)`}:{};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`flex flex-col min-h-full transition-all duration-300`,style:_,children:[(0,d.jsxs)(`div`,{className:`flex-1 flex flex-col space-y-3 pb-48 ${f&&!c?`px-0 max-w-[800px] mx-auto w-full`:`px-4 lg:px-8`}`,children:[e.map((t,r)=>{let i=r===e.length-1;return(0,d.jsxs)(n.Fragment,{children:[(0,d.jsx)(Vt,{section:t,sectionIndex:r,dividerRef:i?m:void 0,isLast:i}),!i&&(0,d.jsx)(`div`,{className:`h-px w-full bg-light-secondary dark:bg-dark-secondary`})]},t.userMessage.messageId)}),i&&!a&&(0,d.jsx)(rn,{}),(0,d.jsx)(`div`,{ref:h,className:`h-0`})]}),(0,d.jsx)(`div`,{className:`sticky bottom-[60px] md:bottom-0 z-40 bg-gradient-to-t from-background via-background to-transparent pt-4 pb-2`,children:(0,d.jsx)(Gn,{})})]}),(0,d.jsx)(_r,{})]})};function yr({radius:e=60,opacityDecay:t=.025,backgroundColor:r=`transparent`,color:i,colorGenerator:a}){let o=(0,n.useRef)(null),s=(0,n.useRef)({x:0,y:0}),c=(0,n.useRef)([]),l=()=>[Math.floor(Math.random()*130+10),Math.floor(.5*Math.random()*50),Math.floor(.5*Math.random()*255)],u=()=>i||a?.()||l();return(0,n.useEffect)(()=>{let n=o.current;if(!n)return;let i=n.getContext(`2d`);if(!i)return;let a=0,l=()=>{n.width=window.innerWidth,n.height=window.innerHeight};l();let d=()=>{i.globalCompositeOperation=`source-over`,r===`transparent`?i.clearRect(0,0,n.width,n.height):(i.fillStyle=r,i.fillRect(0,0,n.width,n.height)),i.globalCompositeOperation=`lighter`;let o={col:u(),x:s.current.x,y:s.current.y,grdblur:i.createRadialGradient(s.current.x,s.current.y,0,s.current.x,s.current.y,e),alpha:1};c.current.push(o);let l=[];for(let n=0;n<c.current.length;n++){let r=c.current[n];r.grdblur.addColorStop(0,`rgba(${r.col[0]},${r.col[1]},${r.col[2]},0.95)`),r.grdblur.addColorStop(.2,`rgba(${r.col[0]},${r.col[1]},${r.col[2]},0.7)`),r.grdblur.addColorStop(.5,`rgba(${r.col[0]},${r.col[1]},${r.col[2]},0.3)`),r.grdblur.addColorStop(1,`rgba(${r.col[0]},${r.col[1]},${r.col[2]},0)`),i.beginPath(),i.fillStyle=r.grdblur,i.globalAlpha=r.alpha,i.arc(r.x,r.y,e,0,Math.PI*2),i.fill(),r.alpha-=t,r.alpha<=0&&l.push(n)}for(let e=l.length-1;e>=0;e--)c.current.splice(l[e],1);i.globalAlpha=1,a=requestAnimationFrame(d)},f=e=>{s.current.x=e.pageX,s.current.y=e.pageY},p=e=>{s.current.x=e.touches[0].pageX,s.current.y=e.touches[0].pageY};return window.addEventListener(`mousemove`,f),window.addEventListener(`touchmove`,p,{passive:!0}),window.addEventListener(`resize`,l),d(),()=>{cancelAnimationFrame(a),window.removeEventListener(`mousemove`,f),window.removeEventListener(`touchmove`,p),window.removeEventListener(`resize`,l),c.current=[]}},[e,t,r,i,a]),(0,d.jsx)(`div`,{className:`relative w-full h-screen overflow-hidden pointer-events-none`,children:(0,d.jsx)(`canvas`,{ref:o,className:`absolute inset-0`,style:{background:`transparent`}})})}var br=200,xr=[`message`,`error`,`detail`];function Sr(e){return e.length>br?`${e.slice(0,199).trimEnd()}…`:e}function Cr(e,t){let n=t?`HTTP ${t}`:`Unknown error`;if(typeof e==`string`){let t=e.trim();return!t||t.startsWith(`<`)?n:Sr(t)}if(e&&typeof e==`object`){let t=e;for(let e of xr){let n=t[e];if(typeof n==`string`&&n.trim())return Sr(n.trim())}}return n}var wr=`qwksearch_pinned_chats`;function Tr(e){let t=e.messages?.[e.messages.length-1],n=t&&`createdAt`in t?t.createdAt:void 0;if(n){let e=new Date(n).getTime();if(!Number.isNaN(e))return new Date(e).toISOString()}return e.createdAt}function Er(){if(typeof window>`u`)return[];try{let e=localStorage.getItem(wr);return e?JSON.parse(e):[]}catch{return[]}}function Dr(e){typeof window>`u`||localStorage.setItem(wr,JSON.stringify(e))}function Or(){let[e,t]=(0,n.useState)([]),[r,i]=(0,n.useState)(!0),[a,o]=(0,n.useState)(!1),[s,l]=(0,n.useState)(null),[u,d]=(0,n.useState)(!1),[f,p]=(0,n.useState)(!1),[h,g]=(0,n.useState)(!1),[_,v]=(0,n.useState)([]),[y,b]=(0,n.useState)(``),[x,S]=(0,n.useState)([]),[C,w]=(0,n.useState)(!1),{isAuthenticated:T,isLoading:E}=nt(),{incognito:D,setIncognito:O}=G();(0,n.useEffect)(()=>{v(Er())},[]);let k=(0,n.useCallback)((e,t)=>{e.preventDefault(),e.stopPropagation(),v(e=>{let n=e.includes(t)?e.filter(e=>e!==t):[...e,t];return Dr(n),n})},[]),A=(0,n.useMemo)(()=>[...e].sort((e,t)=>{let n=_.includes(e.id),r=_.includes(t.id);return n&&!r?-1:!n&&r?1:0}),[e,_]),j=(0,n.useMemo)(()=>y.trim()?x:A,[y,x,A]),M=(0,n.useCallback)(async()=>{if(!E){i(!0);try{if(T){let{data:e,error:n,response:r}=await(0,c.listChats)();if(n&&r?.status===401){let e=Ie().map(e=>({...e,messageCount:e.messages?.filter(e=>e.role===`user`).length??0,lastMessageAt:Tr(e)}));t(e);return}if(n)throw Error(`Failed to fetch chats: ${Cr(n,r?.status)}`);t(Array.isArray(e?.chats)?e.chats:[])}else{let e=Ie().map(e=>({...e,messageCount:e.messages?.filter(e=>e.role===`user`).length??0}));t(e)}}catch(e){console.error(`Failed to fetch chat history:`,e),t([]),m.toast.error(`Failed to load chat history`)}finally{i(!1)}}},[T,E]);(0,n.useEffect)(()=>{M()},[M]);let N=(e,t)=>{e.preventDefault(),e.stopPropagation(),l(t),o(!0)},P=async()=>{if(s){d(!0);try{if(T){let{error:e,response:t}=await(0,c.deleteChatById)({path:{id:s}});if(e)throw Error(`Failed to delete chat: ${Cr(e,t?.status)}`)}else ze(s);t(e=>e.filter(e=>e.id!==s)),m.toast.success(`Chat deleted`)}catch(e){m.toast.error(e.message||`Failed to delete chat`)}finally{o(!1),l(null),d(!1)}}},F=()=>{p(!0)},I=async()=>{g(!0);try{if(T){let{error:e,response:t}=await(0,c.deleteAllChats)();if(e)throw Error(`Failed to clear history: ${Cr(e,t?.status)}`)}else Be();t([]),m.toast.success(`All history cleared`)}catch(e){m.toast.error(e.message||`Failed to clear history`)}finally{p(!1),g(!1)}},L=()=>{O(!D),m.toast.success(D?`Private mode off`:`Private mode on — messages won't be saved`)},R=(0,n.useCallback)(async e=>{if(!e.trim()){S([]),w(!1);return}w(!0);try{if(T){let{data:t,error:n,response:r}=await(0,c.searchChats)({query:{q:e}});if(n)throw Error(`Failed to search chats: ${Cr(n,r?.status)}`);S(Array.isArray(t?.chats)?t.chats:[])}else{let t=Ie().filter(t=>{let n=t.title.toLowerCase().includes(e.toLowerCase()),r=t.messages?.some(t=>`content`in t&&t.content?.toLowerCase().includes(e.toLowerCase()));return n||r});S(t.map(e=>({...e,messageCount:e.messages?.filter(e=>e.role===`user`).length??0,lastMessageAt:Tr(e)})))}}catch(e){console.error(`Failed to search chat history:`,e),S([]),m.toast.error(`Failed to search chat history`)}finally{w(!1)}},[T]);return(0,n.useEffect)(()=>{let e=setTimeout(()=>{R(y)},300);return()=>clearTimeout(e)},[y,R]),{chats:e,sortedChats:A,displayChats:j,loading:r,pinnedIds:_,togglePin:k,incognito:D,toggleIncognito:L,searchQuery:y,searchResults:x,searching:C,handleSearchChange:(0,n.useCallback)(e=>{b(e)},[]),deleteDialogOpen:a,setDeleteDialogOpen:o,chatToDelete:s,setChatToDelete:l,deleting:u,handleDeleteClick:N,handleConfirmDelete:P,clearAllDialogOpen:f,setClearAllDialogOpen:p,clearingAll:h,handleClearAllClick:F,handleConfirmClearAll:I}}function kr({incognito:e,onToggleIncognito:t,showClearAll:n,onClearAll:r,searchQuery:i,onSearchChange:a}){return(0,d.jsxs)(`div`,{className:`mb-2 pb-2 border-b border-border space-y-2`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground/80 uppercase tracking-wide`,children:`Chat History`}),(0,d.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,d.jsxs)(`button`,{onClick:t,className:`flex items-center gap-1 px-2 py-1 text-xs rounded-lg transition-colors duration-200 ${e?`text-primary bg-primary/10`:`text-muted-foreground hover:text-foreground hover:bg-secondary`}`,title:e?`Private mode on`:`Private mode`,children:[(0,d.jsx)(s.Lock,{size:12}),(0,d.jsx)(`span`,{children:`Private`})]}),n&&(0,d.jsxs)(`button`,{onClick:r,className:`flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:text-red-500 hover:bg-red-500/10 rounded-lg transition-colors duration-200`,title:`Clear all history`,children:[(0,d.jsx)(s.Trash2,{size:12}),(0,d.jsx)(`span`,{children:`Clear All`})]})]})]}),(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(s.Search,{className:`absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground`,size:14}),(0,d.jsx)(`input`,{type:`text`,placeholder:`Search chats...`,value:i,onChange:e=>a(e.target.value),className:`w-full pl-7 pr-7 py-1.5 text-sm bg-secondary/50 border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50 placeholder:text-muted-foreground/50`}),i&&(0,d.jsx)(`button`,{onClick:()=>a(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,d.jsx)(s.X,{size:14})})]})]})}function Ar({chat:e,isPinned:n,onTogglePin:r,onDelete:i}){let a=e.messageCount??0;return(0,d.jsxs)(`div`,{className:`group flex items-center gap-1 px-2 py-1 rounded-lg hover:bg-secondary transition-colors duration-200`,children:[(0,d.jsxs)(D.default,{href:`/c/${e.id}`,onClick:n=>{t.researchAgentUIConfig.onOpenChat?.(e.id)&&n.preventDefault()},className:`flex-1 min-w-0 flex items-center gap-1.5`,children:[(0,d.jsxs)(`span`,{className:`flex items-center gap-1 shrink-0`,children:[a>0&&(0,d.jsxs)(zt,{className:`px-1.5 py-0 text-[10px] font-medium bg-zinc-200 text-zinc-700 hover:bg-zinc-200 dark:bg-zinc-700 dark:text-zinc-300 dark:hover:bg-zinc-700 border-0 rounded-md`,children:[a,`Q`]}),(0,d.jsx)(zt,{className:`px-1.5 py-0 text-[10px] font-medium bg-zinc-100 text-zinc-500 hover:bg-zinc-100 dark:bg-zinc-800 dark:text-zinc-400 dark:hover:bg-zinc-800 border-0 rounded-md`,children:L(new Date,e.createdAt)})]}),(0,d.jsxs)(`p`,{className:`text-xs text-popover-foreground truncate`,children:[n&&(0,d.jsx)(s.Pin,{size:10,className:`inline mr-1 text-primary`}),e.title]})]}),(0,d.jsx)(`button`,{onClick:t=>r(t,e.id),className:`p-1.5 rounded-lg transition-all duration-200 ${n?`opacity-100 text-primary hover:bg-primary/10`:`opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-primary hover:bg-primary/10`}`,title:n?`Unpin chat`:`Pin chat`,children:(0,d.jsx)(s.Pin,{size:14})}),(0,d.jsx)(`button`,{onClick:t=>i(t,e.id),className:`opacity-0 group-hover:opacity-100 p-1.5 rounded-lg hover:bg-red-500/10 text-muted-foreground hover:text-red-500 transition-all duration-200`,title:`Delete chat`,children:(0,d.jsx)(s.Trash,{size:14})})]})}function jr({open:e,onOpenChange:t,title:n,description:r,confirmLabel:i,loadingLabel:a,loading:o,onConfirm:s}){return(0,d.jsx)(U,{open:e,onOpenChange:e=>{!e&&!o&&t(!1)},children:(0,d.jsxs)(ue,{className:`w-full max-w-md transform rounded-2xl bg-light-secondary dark:bg-dark-secondary border border-light-200 dark:border-dark-200 p-6 text-left align-middle shadow-xl`,children:[(0,d.jsx)(de,{className:`text-lg font-medium leading-6 dark:text-white`,children:n}),(0,d.jsx)(fe,{className:`text-sm dark:text-white/70 text-black/70 mt-2`,children:r}),(0,d.jsxs)(`div`,{className:`flex flex-row items-end justify-end space-x-4 mt-6`,children:[(0,d.jsx)(`button`,{onClick:()=>{o||t(!1)},className:`text-black/50 dark:text-white/50 text-sm hover:text-black/70 hover:dark:text-white/70 transition duration-200`,children:`Cancel`}),(0,d.jsx)(`button`,{onClick:s,disabled:o,className:`text-red-400 text-sm hover:text-red-500 transition duration-200 disabled:opacity-50`,children:o?a:i})]})]})})}function Mr({deleteDialogOpen:e,setDeleteDialogOpen:t,chatToDelete:n,setChatToDelete:r,deleting:i,onConfirmDelete:a,clearAllDialogOpen:o,setClearAllDialogOpen:s,clearingAll:c,onConfirmClearAll:l}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(jr,{open:e,onOpenChange:e=>{t(e),e||r(null)},title:`Delete Confirmation`,description:`Are you sure you want to delete this chat?`,confirmLabel:`Delete`,loadingLabel:`Deleting...`,loading:i,onConfirm:a}),(0,d.jsx)(jr,{open:o,onOpenChange:s,title:`Clear All History`,description:`Are you sure you want to delete all your chat history? This action cannot be undone.`,confirmLabel:`Clear All`,loadingLabel:`Clearing...`,loading:c,onConfirm:l})]})}var Nr={Today:(0,d.jsx)(s.Sun,{size:12}),Yesterday:(0,d.jsx)(s.Clock,{size:12}),"This Week":(0,d.jsx)(s.CalendarDays,{size:12}),Older:(0,d.jsx)(s.Archive,{size:12})};function Pr(e){let t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),r=new Date(n.getTime()-864e5),i=new Date(n.getTime()-5184e5),a={Today:[],Yesterday:[],"This Week":[],Older:[]};for(let t of e){let e=new Date(t.createdAt);e>=n?a.Today.push(t):e>=r?a.Yesterday.push(t):e>=i?a[`This Week`].push(t):a.Older.push(t)}return[`Today`,`Yesterday`,`This Week`,`Older`].filter(e=>a[e].length>0).map(e=>({label:e,chats:a[e]}))}var Fr=({showLabel:e=!1})=>{let t=Or();return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(U,{children:[(0,d.jsxs)(se,{className:e?`inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs text-muted-foreground bg-secondary hover:bg-secondary/80 hover:text-foreground transition-colors duration-150`:`p-2 text-muted-foreground rounded-2xl bg-background/60 backdrop-blur-md hover:bg-secondary/80 transition duration-200 hover:text-foreground border border-border/30`,children:[(0,d.jsx)(s.History,{size:e?14:18}),e&&(0,d.jsx)(`span`,{children:`History`})]}),(0,d.jsxs)(ue,{className:`max-w-[420px] p-3`,children:[(0,d.jsx)(de,{className:`sr-only`,children:`Chat History`}),(0,d.jsx)(kr,{incognito:t.incognito,onToggleIncognito:t.toggleIncognito,showClearAll:t.chats.length>0&&!t.loading,onClearAll:t.handleClearAllClick,searchQuery:t.searchQuery,onSearchChange:t.handleSearchChange}),t.loading||t.searching?(0,d.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,d.jsxs)(`svg`,{"aria-hidden":`true`,className:`w-6 h-6 text-light-200 fill-light-secondary dark:text-[#202020] animate-spin dark:fill-[#ffffff3b]`,viewBox:`0 0 100 101`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,d.jsx)(`path`,{d:`M100 50.5908C100.003 78.2051 78.1951 100.003 50.5908 100C22.9765 99.9972 0.997224 78.018 1 50.4037C1.00281 22.7993 22.8108 0.997224 50.4251 1C78.0395 1.00281 100.018 22.8108 100 50.4251ZM9.08164 50.594C9.06312 73.3997 27.7909 92.1272 50.5966 92.1457C73.4023 92.1642 92.1298 73.4365 92.1483 50.6308C92.1669 27.8251 73.4392 9.0973 50.6335 9.07878C27.8278 9.06026 9.10003 27.787 9.08164 50.594Z`,fill:`currentColor`}),(0,d.jsx)(`path`,{d:`M93.9676 39.0409C96.393 38.4037 97.8624 35.9116 96.9801 33.5533C95.1945 28.8227 92.871 24.3692 90.0681 20.348C85.6237 14.1775 79.4473 9.36872 72.0454 6.45794C64.6435 3.54717 56.3134 2.65431 48.3133 3.89319C45.869 4.27179 44.3768 6.77534 45.014 9.20079C45.6512 11.6262 48.1343 13.0956 50.5786 12.717C56.5073 11.8281 62.5542 12.5399 68.0406 14.7911C73.527 17.0422 78.2187 20.7487 81.5841 25.4923C83.7976 28.5886 85.4467 32.059 86.4416 35.7474C87.1273 38.1189 89.5423 39.6781 91.9676 39.0409Z`,fill:`currentFill`})]})}):t.searchQuery.trim()&&t.displayChats.length===0?(0,d.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No matching chats found.`})}):t.chats.length===0?(0,d.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No chats found.`})}):(0,d.jsx)(`div`,{className:`space-y-1 max-h-[500px] overflow-y-auto`,children:t.searchQuery.trim()?t.displayChats.map(e=>(0,d.jsx)(Ar,{chat:e,isPinned:t.pinnedIds.includes(e.id),onTogglePin:t.togglePin,onDelete:t.handleDeleteClick},e.id)):Pr(t.displayChats).map(({label:e,chats:n})=>(0,d.jsxs)(`div`,{children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold text-muted-foreground/70 uppercase tracking-wider`,children:[Nr[e],e]}),n.map(e=>(0,d.jsx)(Ar,{chat:e,isPinned:t.pinnedIds.includes(e.id),onTogglePin:t.togglePin,onDelete:t.handleDeleteClick},e.id))]},e))}),t.chats.length>0&&(0,d.jsx)(`div`,{className:`mt-2 pt-2 border-t border-border`,children:(0,d.jsx)(D.default,{href:`/library`,className:`block text-center text-xs text-primary hover:underline`,children:`View all chats`})})]})]}),(0,d.jsx)(Mr,{deleteDialogOpen:t.deleteDialogOpen,setDeleteDialogOpen:t.setDeleteDialogOpen,chatToDelete:t.chatToDelete,setChatToDelete:t.setChatToDelete,deleting:t.deleting,onConfirmDelete:t.handleConfirmDelete,clearAllDialogOpen:t.clearAllDialogOpen,setClearAllDialogOpen:t.setClearAllDialogOpen,clearingAll:t.clearingAll,onConfirmClearAll:t.handleConfirmClearAll})]})},Ir=e=>new Date(e.lastMessageAt||e.createdAt).getTime();function Lr(){let{chats:e,loading:n}=Or(),r=[...e].sort((e,t)=>Ir(t)-Ir(e)).slice(0,5);return n||r.length===0?null:(0,d.jsxs)(`div`,{className:`flex flex-row items-center justify-center gap-2 flex-wrap`,children:[(0,d.jsx)(Fr,{showLabel:!0}),r.map(e=>{let n=Pn(e.lastMessageAt||e.createdAt);return(0,d.jsxs)(D.default,{href:`/c/${e.id}`,onClick:n=>{t.researchAgentUIConfig.onOpenChat?.(e.id)&&n.preventDefault()},className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs text-muted-foreground bg-secondary hover:bg-secondary/80 hover:text-foreground transition-colors duration-150 max-w-[220px]`,title:e.title,children:[(0,d.jsx)(`span`,{className:`truncate`,children:e.title}),n&&(0,d.jsx)(`span`,{className:`italic text-muted-foreground/70 whitespace-nowrap`,children:n})]},e.id)})]})}function Rr({listFooterLinks:e=[],optionShowIcons:t=!0,optionBackgroundColor:r=`bg-black/40`}){let[i,a]=(0,n.useState)(!1),o=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!i)return;let e=e=>{o.current&&!o.current.contains(e.target)&&a(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i]);let c=()=>e.map(({url:e,text:n,icon:r,onClick:i})=>{let a=r?s[r]:null,o=e.startsWith(`http`),c=o?{target:`_blank`,rel:`noopener noreferrer`}:{},l=(0,d.jsxs)(d.Fragment,{children:[t&&a&&(0,d.jsx)(a,{size:14}),(0,d.jsx)(`span`,{className:`font-semibold tracking-wide text-md`,style:{fontVariant:`small-caps`},children:n}),(0,d.jsx)(`span`,{className:`absolute bottom-0 left-0 w-0 h-0.5 bg-current transition-all duration-300 group-hover:w-full group-hover:shadow-[0_0_8px_rgba(255,255,255,0.6)]`})]});return i?(0,d.jsx)(`button`,{type:`button`,onClick:i,className:`relative group inline-flex items-center gap-1 hover:text-white hover:drop-shadow-[0_0_8px_rgba(255,255,255,0.8)] transition-all duration-300 whitespace-nowrap`,children:l},e):o?(0,d.jsx)(`a`,{href:e,...c,className:`relative group inline-flex items-center gap-1 hover:text-white hover:drop-shadow-[0_0_8px_rgba(255,255,255,0.8)] transition-all duration-300 whitespace-nowrap`,children:l},e):(0,d.jsx)(D.default,{href:e,className:`relative group inline-flex items-center gap-1 hover:text-white hover:drop-shadow-[0_0_8px_rgba(255,255,255,0.8)] transition-all duration-300 whitespace-nowrap`,children:l},e)}),l=s.Info;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`div`,{className:`hidden md:flex absolute bottom-2 left-1/2 -translate-x-1/2 text-slate-200 text-xs z-20 ${r} rounded-lg px-2 py-1 shadow-lg hover:shadow-xl hover:-translate-y-1 transition-all duration-300 flex-wrap items-center justify-center gap-x-6 max-w-[90vw]`,children:(0,d.jsx)(`div`,{className:`max-w-4xl mx-auto grid grid-cols-3 gap-2`,children:c()})}),(0,d.jsxs)(`div`,{ref:o,className:`md:hidden fixed top-[calc(8px+env(safe-area-inset-top,0px))] right-2 z-30`,children:[i&&(0,d.jsx)(`div`,{className:`absolute top-full right-0 mt-2 text-slate-200 text-xs ${r} rounded-lg px-3 py-2 shadow-lg flex flex-col items-start gap-2 backdrop-blur-sm`,children:c()}),(0,d.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),"aria-label":i?`Hide links`:`Show links`,"aria-expanded":i,className:`flex items-center justify-center h-8 w-8 rounded-full text-slate-200 ${r} shadow-lg backdrop-blur-sm hover:text-white transition-all duration-300`,children:l?(0,d.jsx)(l,{size:16}):`i`})]})]})}function zr({open:e,onOpenChange:n}){return(0,d.jsx)(U,{open:e,onOpenChange:n,children:(0,d.jsxs)(ue,{className:`w-full max-w-md rounded-2xl bg-light-secondary dark:bg-dark-secondary border border-light-200 dark:border-dark-200 p-6 text-center align-middle shadow-xl`,children:[(0,d.jsx)(de,{className:`text-lg font-medium leading-6 dark:text-white`,children:`Download QwkSearch`}),(0,d.jsx)(fe,{className:`text-sm dark:text-white/70 text-black/70 mt-2`,children:`Get QwkSearch on your browser or desktop.`}),(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-3 mt-6`,children:[(0,d.jsx)(k.DownloadAppButton,{platform:`chrome-extension`,href:t.researchAgentUIConfig.downloadChromeUrl,autoHighlight:!0}),(0,d.jsx)(k.DownloadAppButton,{platform:`windows`,appId:t.researchAgentUIConfig.downloadWindowsStoreId,autoHighlight:!0})]})]})})}function Br(){let e=`hyZbH3n.mp4,iOeZcCk.mp4,dUZlxYE.mp4,GpWeP6E.gif,LuKUsLE.png,w7X11Dd.png,MHmVtCr.png,HmnUAee.png,vKP22VU.png,l1lsV39.png,Ku8F2qc.png,KUEXtwm.png,vvKFPmY.png,5p8eaEf.png,VAKuJcG.png,sTMPtQW.png,m0gHbZZ.png,cKu7dWQ.png,ogfefYD.png,ey5vAae.png,twuLrvk.png,ELILiYt.png,9el5qpP.png,Up6xTkk.png,W1XKBo0.png,1Y6xvW0.png,JXOytMz.png,DNiI6pp.png,XDv5s6p.jpeg,eRwiRJ9.jpeg,DRAfJoc.jpeg,ASVRQ1G.jpeg,35svwUT.jpeg,81xLiVI.jpeg,6kod2Em.jpeg,eU0C8zt.jpeg,Bv0PBY8.jpeg,DQNbjIZ.jpeg,2uACPqZ.jpeg,XEKltMF.jpeg,WHgLfBm.jpeg,QFYM0Fw.jpeg,K12HCao.jpeg,oN8rtsE.jpeg,9fGnrns.jpeg,2ONJJeW.jpeg,DO23Va7.jpeg,QaKeoXk.jpeg,QU5oCBR.jpeg,MhlYZmh.jpeg,ylL1ToB.jpeg,AWWsCv8.jpeg,Tk9Tzzj.jpeg`.split(`,`);return`https://i.imgur.com/`+e[Math.floor(Math.random()*e.length)]}var Vr=15;function Hr(e){return e?e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.split(`,`).map(e=>e.trim()),n=Number(t[t.length-2]),r=Number(t[t.length-1]);return t.length>=2&&t[t.length-2]!==``&&t[t.length-1]!==``&&Number.isFinite(n)&&Number.isFinite(r)?{label:t.slice(0,t.length-2).filter(Boolean).join(`, `)||void 0,latitude:n,longitude:r}:{label:e}}):[]}function Ur(){let{sendMessage:e}=G(),[r,i]=(0,n.useState)(null),[a,o]=(0,n.useState)(null),[s,c]=(0,n.useState)(!1),[l,u]=(0,n.useState)(!1),[f,p]=(0,n.useState)([]),[m,h]=(0,n.useState)(!0),[g,_]=(0,n.useState)(5),[v,y]=(0,n.useState)(12),[b,x]=(0,n.useState)(`fahrenheit`),[C,w]=(0,n.useState)(null),[T,E]=(0,n.useState)(!0),[D,O]=(0,n.useState)(6),[k,M]=(0,n.useState)(!0),[N,P]=(0,n.useState)(!1),[F,I]=(0,n.useState)(!1),L=t.researchAgentUIConfig.footerLinks.map(e=>e.url===`/#downloads`?{...e,onClick:()=>u(!0)}:e),R=C||t.researchAgentUIConfig.trendingNewsApiUrl;(0,n.useEffect)(()=>{let e=()=>{p(Hr(localStorage.getItem(`weatherLocations`))),h(localStorage.getItem(`showWeatherWidget`)!==`false`),_(Number(localStorage.getItem(`weatherForecastDays`))||5),y(Number(localStorage.getItem(`weatherForecastHours`))||12),x(localStorage.getItem(`weatherTemperatureUnit`)===`celsius`?`celsius`:`fahrenheit`),w(localStorage.getItem(`trendingNewsApiUrl`)),E(localStorage.getItem(`showTrendingNewsWidget`)!==`false`),O(Number(localStorage.getItem(`trendingNewsMaxTopics`))||6),M(localStorage.getItem(`trendingNewsShowImages`)!==`false`),P(localStorage.getItem(`orbHoverGlow`)===`true`),I(localStorage.getItem(`cursorGlowTrail`)===`true`)};return e(),window.addEventListener(`client-config-changed`,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(`client-config-changed`,e),window.removeEventListener(`storage`,e)}},[]),(0,n.useEffect)(()=>{if(localStorage.getItem(`showBackgroundArt`)===`false`)return;i(Br());let e=setInterval(()=>{let e=Br();o(e),c(!0),setTimeout(()=>{i(e),c(!1),o(null)},1e3)},2e4);return()=>clearInterval(e)},[]);let z=e=>e.endsWith(`.webm`)||e.endsWith(`.mp4`),B=(e,t)=>z(e)?(0,d.jsx)(`video`,{src:e,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,className:`absolute inset-0 w-full h-full object-cover transition-opacity duration-1000 ${t}`},e):(0,d.jsx)(`img`,{src:e,alt:``,className:`absolute inset-0 w-full h-full object-cover transition-opacity duration-1000 ${t}`},e);return(0,d.jsxs)(`div`,{className:`relative min-h-screen w-full`,children:[(0,d.jsxs)(`div`,{className:`absolute inset-0 z-0`,children:[r&&B(r,s?`opacity-0`:`opacity-30`),a&&B(a,s?`opacity-30`:`opacity-0`),F&&(0,d.jsx)(yr,{})]}),(0,d.jsx)(`div`,{className:`relative z-10`,children:(0,d.jsxs)(`div`,{className:`flex flex-col items-center justify-end md:justify-center min-h-[calc(100dvh-64px)] md:min-h-screen max-w-screen-sm mx-auto p-2 pb-1 md:pb-2`,children:[(0,d.jsx)(`div`,{style:{height:`200px`,width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},className:N?void 0:`pointer-events-none`,children:(0,d.jsx)(S.default,{autoRandomize:!0,onSphereClick:()=>console.log(`Sphere clicked`),className:`my-custom-class`})}),(0,d.jsxs)(`div`,{className:`w-full max-w-2xl mt-8 space-y-2`,children:[(0,d.jsx)(Lr,{}),(m||T)&&(0,d.jsxs)(`div`,{className:`flex flex-col gap-2 w-full`,children:[T&&(0,d.jsx)(j.TrendingNews,{compact:!0,expandable:!0,maxTopics:D,expandedMaxTopics:Vr,showImages:k,apiEndpoint:R,limit:Vr,className:`rounded-2xl w-full`,style:{background:`rgba(255,255,255,0.08)`,border:`1px solid rgba(255,255,255,0.15)`,color:`inherit`,backdropFilter:`blur(8px)`,maxWidth:`100%`}}),m&&(0,d.jsx)(A.WeatherForecast,{compact:!0,forecastDays:g,forecastHours:v,temperatureUnit:b,locations:f.length>0?f:void 0,className:`rounded-2xl w-full`,style:{background:`rgba(255,255,255,0.08)`,border:`1px solid rgba(255,255,255,0.15)`,color:`inherit`,backdropFilter:`blur(8px)`}})]}),(0,d.jsx)(Gn,{})]})]})}),(0,d.jsx)(Rr,{listFooterLinks:L}),(0,d.jsx)(zr,{open:l,onOpenChange:u})]})}var Wr=()=>(0,d.jsxs)(`svg`,{"aria-hidden":`true`,className:`w-8 h-8 text-border fill-secondary animate-spin`,viewBox:`0 0 100 101`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,d.jsx)(`path`,{d:`M100 50.5908C100.003 78.2051 78.1951 100.003 50.5908 100C22.9765 99.9972 0.997224 78.018 1 50.4037C1.00281 22.7993 22.8108 0.997224 50.4251 1C78.0395 1.00281 100.018 22.8108 100 50.4251ZM9.08164 50.594C9.06312 73.3997 27.7909 92.1272 50.5966 92.1457C73.4023 92.1642 92.1298 73.4365 92.1483 50.6308C92.1669 27.8251 73.4392 9.0973 50.6335 9.07878C27.8278 9.06026 9.10003 27.787 9.08164 50.594Z`,fill:`currentColor`}),(0,d.jsx)(`path`,{d:`M93.9676 39.0409C96.393 38.4037 97.8624 35.9116 96.9801 33.5533C95.1945 28.8227 92.871 24.3692 90.0681 20.348C85.6237 14.1775 79.4473 9.36872 72.0454 6.45794C64.6435 3.54717 56.3134 2.65431 48.3133 3.89319C45.869 4.27179 44.3768 6.77534 45.014 9.20079C45.6512 11.6262 48.1343 13.0956 50.5786 12.717C56.5073 11.8281 62.5542 12.5399 68.0406 14.7911C73.527 17.0422 78.2187 20.7487 81.5841 25.4923C83.7976 28.5886 85.4467 32.059 86.4416 35.7474C87.1273 38.1189 89.5423 39.6781 91.9676 39.0409Z`,fill:`currentFill`})]});function Gr(){return(0,d.jsx)(`div`,{className:`flex min-h-screen flex-col items-center justify-center p-8`,children:(0,d.jsxs)(`div`,{className:`max-w-2xl w-full space-y-6 bg-light-secondary dark:bg-dark-secondary rounded-lg p-8 border border-black/10 dark:border-white/10`,children:[(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(`h1`,{className:`text-2xl font-semibold text-black dark:text-white`,children:`⚠️ Configuration Required`}),(0,d.jsx)(`p`,{className:`text-black/70 dark:text-white/70`,children:`No AI model providers are configured. Add at least one API key to continue.`})]}),(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsx)(`h2`,{className:`text-lg font-medium text-black dark:text-white`,children:`Quick Setup:`}),(0,d.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,d.jsxs)(`div`,{className:`bg-black/5 dark:bg-white/5 rounded p-4`,children:[(0,d.jsx)(`p`,{className:`font-medium text-black dark:text-white mb-2`,children:`1. Create environment file:`}),(0,d.jsx)(`code`,{className:`block bg-black/10 dark:bg-white/10 rounded p-2 text-xs overflow-x-auto`,children:`apps/qwksearch-web/.env.local`})]}),(0,d.jsxs)(`div`,{className:`bg-black/5 dark:bg-white/5 rounded p-4`,children:[(0,d.jsx)(`p`,{className:`font-medium text-black dark:text-white mb-2`,children:`2. Add required variables:`}),(0,d.jsx)(`pre`,{className:`block bg-black/10 dark:bg-white/10 rounded p-3 text-xs overflow-x-auto text-black/80 dark:text-white/80`,children:`# Database
|
|
33
|
+
`);if(!r||r.length===0)throw Error(`Article content is empty`);let{data:t,error:i}=await(0,c.articleQa)({body:{article:r,question:e,chatHistory:b.slice(-5),chatModel:n}});if(i){let e=i.details||i.error||i.message||`Article QA failed`;throw Error(e)}let a=t?.content||``;F(a),x(e=>[...e,{role:`user`,content:E,time:new Date().toISOString()},{role:`assistant`,content:a,time:new Date().toISOString()}]);try{await(0,c.updateArticle)({body:{url:g,question:E,answer:a}})}catch(e){console.error(`Error storing Q&A in cache:`,e)}}else{let e=parseInt(localStorage.getItem(`maxFollowupQuestions`)||`4`);if(!r||r.length===0)throw Error(`Article content is empty`);let{data:t,error:i}=await(0,c.articleFollowups)({body:{article:r,chatHistory:b.slice(-5),maxQuestions:e,chatModel:n}});if(i){let e=i.details||i.error||i.message||`Article followups failed`;throw Error(e)}let a=t?.extract||[];z(a);try{await(0,c.updateArticle)({body:{url:g,followUpQuestions:a}})}catch(e){console.error(`Error storing follow-up questions in cache:`,e)}}}catch(e){console.error(`Error calling language API:`,e),o(e instanceof Error||typeof e==`object`&&e&&`message`in e?e.message:`Failed to get AI response`)}finally{a(!1)}},je=e=>{D(e),Ae(`question`)},Me=async()=>{if(!v)return;let e=`${P}\n\n\n${v.cite||``}\n\n\n${v.html}`;try{await navigator.clipboard.writeText(e),C(!0),setTimeout(()=>C(!1),2e3)}catch(e){console.error(`Failed to copy to clipboard:`,e)}},Ne=async()=>{let e=v?.url||g;if(e)try{await gr({title:v?.title,text:v?.cite,url:e},{share:typeof navigator<`u`&&navigator.share?e=>navigator.share(e):void 0,writeText:e=>navigator.clipboard.writeText(e)})===`copied`&&(T(!0),setTimeout(()=>T(!1),2e3))}catch(e){console.error(`Failed to share article:`,e)}};ve.current={ask:()=>Ae(`question`),suggest:()=>Ae(`suggest-followups`),copy:Me,highlight:()=>oe(e=>!e),favorite:Oe,open:()=>{let e=v?.url||g;e&&window.open(e,`_blank`,`noopener,noreferrer`)},zoomIn:Ce,zoomOut:we,zoomReset:Te,close:h},(0,n.useEffect)(()=>{if(!p)return;let e=e=>/^[a-z]$/.test(e)?`Key${e.toUpperCase()}`:/^[0-9]$/.test(e)?`Digit${e}`:e===`-`?`Minus`:e===`=`?`Equal`:e,t={};Object.keys(Yn).forEach(n=>{let{alt:r,key:i}=Yn[n];r&&(t[e(i.toLowerCase())]=n)});let n=e=>{if(e.key===`Escape`){ve.current.close?.();return}if(!e.altKey||e.ctrlKey||e.metaKey)return;let n=e.target;if(n&&(n.tagName===`INPUT`||n.tagName===`TEXTAREA`||n.isContentEditable))return;let r=t[e.code];if(!r)return;let i=ve.current[r];i&&(e.preventDefault(),i())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[p]);let Pe=()=>(0,d.jsxs)(`div`,{className:`flex h-full flex-col bg-background shadow-xl`,children:[(0,d.jsx)(`div`,{className:`shrink-0 border-b border-border bg-background/95 px-4 py-3 backdrop-blur supports-[backdrop-filter]:bg-background/80`,children:(0,d.jsx)($n,{isLoadingAI:A,isLoadingFollowups:M,isLoadingFavorite:re,isFavorited:V,isHighlightMode:ae,articleUrl:v?.url||g,fontScale:W,onAskClick:()=>Ae(`question`),onSuggestClick:()=>Ae(`suggest-followups`),onCopyClick:Me,onShareClick:Ne,onFavoriteClick:Oe,onHighlightToggle:()=>oe(!ae),onZoomIn:Ce,onZoomOut:we,onZoomReset:Te,onClose:h})}),(0,d.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,d.jsxs)(`div`,{className:`p-4 space-y-6`,children:[(0,d.jsxs)(`div`,{className:`space-y-4`,children:[S&&(0,d.jsx)(`div`,{className:`bg-blue-500 text-white text-sm font-medium px-3 py-2 rounded-md shadow-lg`,children:`Copied!`}),w&&(0,d.jsx)(`div`,{className:`bg-blue-500 text-white text-sm font-medium px-3 py-2 rounded-md shadow-lg`,children:`Link copied!`}),(0,d.jsx)(er,{value:E,onChange:D,onSubmit:()=>Ae(`question`)}),(0,d.jsx)(tr,{questions:R,isLoading:M,error:ee,onQuestionClick:je}),b.length>0&&(0,d.jsx)(`div`,{className:`space-y-4`,children:b.map((e,t)=>(0,d.jsx)(`div`,{className:`space-y-2`,children:e.role===`user`?(0,d.jsxs)(`div`,{className:`bg-primary/10 border border-primary/20 rounded-lg p-3`,children:[(0,d.jsx)(`div`,{className:`text-xs font-semibold text-primary mb-1`,children:`Your Question`}),(0,d.jsx)(`div`,{className:`text-sm text-foreground`,children:e.content})]}):(0,d.jsxs)(`div`,{className:`bg-muted rounded-lg shadow-md p-4`,children:[(0,d.jsx)(`div`,{className:`text-xs font-semibold text-muted-foreground mb-2`,children:`AI Response`}),(0,d.jsx)(`div`,{className:`text-sm`,dangerouslySetInnerHTML:{__html:e.content}})]})},t))}),(A||P&&b.length===0)&&(0,d.jsx)(nr,{response:P,isLoading:A,error:I}),I&&!A&&(0,d.jsx)(`div`,{className:`bg-red-500 text-white p-2 rounded-md text-sm`,children:I})]}),v&&(0,d.jsx)(ir,{article:v,isHighlightMode:ae,fontScale:W})]})})]});return!p||!me?null:H?(0,d.jsxs)(`div`,{className:`fixed top-0 right-0 h-screen z-40 transition-all duration-300`,style:{width:`${ce}px`},children:[(0,d.jsx)(`div`,{ref:_e,onMouseDown:()=>pe(!0),className:`absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-primary bg-transparent transition-colors z-50`,style:{touchAction:`none`},children:(0,d.jsx)(`div`,{className:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-1 h-12 rounded-full bg-muted-foreground opacity-50 hover:opacity-100 transition-opacity`})}),Pe()]}):(0,d.jsx)(U,{open:p,onOpenChange:e=>!e&&h(),children:(0,d.jsxs)(ue,{className:`pointer-events-auto fixed inset-0 !top-0 !left-0 !translate-x-0 !translate-y-0 h-full w-full max-w-none p-0 m-0 rounded-none border-0 overflow-hidden 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]:slide-out-to-right data-[state=open]:slide-in-from-right`,hideCloseButton:!0,children:[(0,d.jsx)(Kn,{children:(0,d.jsx)(de,{children:`Article Details`})}),(0,d.jsx)(`div`,{className:`h-full overflow-y-auto`,children:Pe()})]})})},vr=()=>{let{sections:e,chatTurns:r,loading:i,messageAppeared:a,newChat:o,chatId:s}=G(),{isOpen:c,panelWidth:l}=B(),{isAuthenticated:u}=nt(),[f,p]=(0,n.useState)(!1),m=(0,n.useRef)(null),h=(0,n.useRef)(null),g=(0,n.useRef)(!1);(0,n.useEffect)(()=>{let e=()=>{p(window.innerWidth>=1024)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,n.useEffect)(()=>{if(r.length===1&&(document.title=`${r[0].content.substring(0,30)} - ${t.researchAgentUIConfig.appName}`),r[r.length-1]?.role===`user`){g.current=!0,h.current?.scrollIntoView({behavior:`auto`}),setTimeout(()=>{g.current=!1},100);return}},[r]);let _=f&&c?{width:`calc(100% - ${l}px)`}:{};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`flex flex-col min-h-full transition-all duration-300`,style:_,children:[(0,d.jsxs)(`div`,{className:`flex-1 flex flex-col space-y-3 pb-48 ${f&&!c?`px-0 max-w-[800px] mx-auto w-full`:`px-4 lg:px-8`}`,children:[e.map((t,r)=>{let i=r===e.length-1;return(0,d.jsxs)(n.Fragment,{children:[(0,d.jsx)(Vt,{section:t,sectionIndex:r,dividerRef:i?m:void 0,isLast:i}),!i&&(0,d.jsx)(`div`,{className:`h-px w-full bg-light-secondary dark:bg-dark-secondary`})]},t.userMessage.messageId)}),i&&!a&&(0,d.jsx)(rn,{}),(0,d.jsx)(`div`,{ref:h,className:`h-0`})]}),(0,d.jsx)(`div`,{className:`sticky bottom-[60px] md:bottom-0 z-40 bg-gradient-to-t from-background via-background to-transparent pt-4 pb-2`,children:(0,d.jsx)(Gn,{})})]}),(0,d.jsx)(_r,{})]})};function yr({radius:e=60,opacityDecay:t=.025,backgroundColor:r=`transparent`,color:i,colorGenerator:a}){let o=(0,n.useRef)(null),s=(0,n.useRef)({x:0,y:0}),c=(0,n.useRef)([]),l=()=>[Math.floor(Math.random()*130+10),Math.floor(.5*Math.random()*50),Math.floor(.5*Math.random()*255)],u=()=>i||a?.()||l();return(0,n.useEffect)(()=>{let n=o.current;if(!n)return;let i=n.getContext(`2d`);if(!i)return;let a=0,l=()=>{n.width=window.innerWidth,n.height=window.innerHeight};l();let d=()=>{i.globalCompositeOperation=`source-over`,r===`transparent`?i.clearRect(0,0,n.width,n.height):(i.fillStyle=r,i.fillRect(0,0,n.width,n.height)),i.globalCompositeOperation=`lighter`;let o={col:u(),x:s.current.x,y:s.current.y,grdblur:i.createRadialGradient(s.current.x,s.current.y,0,s.current.x,s.current.y,e),alpha:1};c.current.push(o);let l=[];for(let n=0;n<c.current.length;n++){let r=c.current[n];r.grdblur.addColorStop(0,`rgba(${r.col[0]},${r.col[1]},${r.col[2]},0.95)`),r.grdblur.addColorStop(.2,`rgba(${r.col[0]},${r.col[1]},${r.col[2]},0.7)`),r.grdblur.addColorStop(.5,`rgba(${r.col[0]},${r.col[1]},${r.col[2]},0.3)`),r.grdblur.addColorStop(1,`rgba(${r.col[0]},${r.col[1]},${r.col[2]},0)`),i.beginPath(),i.fillStyle=r.grdblur,i.globalAlpha=r.alpha,i.arc(r.x,r.y,e,0,Math.PI*2),i.fill(),r.alpha-=t,r.alpha<=0&&l.push(n)}for(let e=l.length-1;e>=0;e--)c.current.splice(l[e],1);i.globalAlpha=1,a=requestAnimationFrame(d)},f=e=>{s.current.x=e.pageX,s.current.y=e.pageY},p=e=>{s.current.x=e.touches[0].pageX,s.current.y=e.touches[0].pageY};return window.addEventListener(`mousemove`,f),window.addEventListener(`touchmove`,p,{passive:!0}),window.addEventListener(`resize`,l),d(),()=>{cancelAnimationFrame(a),window.removeEventListener(`mousemove`,f),window.removeEventListener(`touchmove`,p),window.removeEventListener(`resize`,l),c.current=[]}},[e,t,r,i,a]),(0,d.jsx)(`div`,{className:`relative w-full h-screen overflow-hidden pointer-events-none`,children:(0,d.jsx)(`canvas`,{ref:o,className:`absolute inset-0`,style:{background:`transparent`}})})}var br=200,xr=[`message`,`error`,`detail`];function Sr(e){return e.length>br?`${e.slice(0,199).trimEnd()}…`:e}function Cr(e,t){let n=t?`HTTP ${t}`:`Unknown error`;if(typeof e==`string`){let t=e.trim();return!t||t.startsWith(`<`)?n:Sr(t)}if(e&&typeof e==`object`){let t=e;for(let e of xr){let n=t[e];if(typeof n==`string`&&n.trim())return Sr(n.trim())}}return n}var wr=`qwksearch_pinned_chats`;function Tr(e){let t=e.messages?.[e.messages.length-1],n=t&&`createdAt`in t?t.createdAt:void 0;if(n){let e=new Date(n).getTime();if(!Number.isNaN(e))return new Date(e).toISOString()}return e.createdAt}function Er(){if(typeof window>`u`)return[];try{let e=localStorage.getItem(wr);return e?JSON.parse(e):[]}catch{return[]}}function Dr(e){typeof window>`u`||localStorage.setItem(wr,JSON.stringify(e))}function Or(){let[e,t]=(0,n.useState)([]),[r,i]=(0,n.useState)(!0),[a,o]=(0,n.useState)(!1),[s,l]=(0,n.useState)(null),[u,d]=(0,n.useState)(!1),[f,p]=(0,n.useState)(!1),[h,g]=(0,n.useState)(!1),[_,v]=(0,n.useState)([]),[y,b]=(0,n.useState)(``),[x,S]=(0,n.useState)([]),[C,w]=(0,n.useState)(!1),{isAuthenticated:T,isLoading:E}=nt(),{incognito:D,setIncognito:O}=G();(0,n.useEffect)(()=>{v(Er())},[]);let k=(0,n.useCallback)((e,t)=>{e.preventDefault(),e.stopPropagation(),v(e=>{let n=e.includes(t)?e.filter(e=>e!==t):[...e,t];return Dr(n),n})},[]),A=(0,n.useMemo)(()=>[...e].sort((e,t)=>{let n=_.includes(e.id),r=_.includes(t.id);return n&&!r?-1:!n&&r?1:0}),[e,_]),j=(0,n.useMemo)(()=>y.trim()?x:A,[y,x,A]),M=(0,n.useCallback)(async()=>{if(!E){i(!0);try{if(T){let{data:e,error:n,response:r}=await(0,c.listChats)();if(n&&r?.status===401){let e=Ie().map(e=>({...e,messageCount:e.messages?.filter(e=>e.role===`user`).length??0,lastMessageAt:Tr(e)}));t(e);return}if(n)throw Error(`Failed to fetch chats: ${Cr(n,r?.status)}`);t(Array.isArray(e?.chats)?e.chats:[])}else{let e=Ie().map(e=>({...e,messageCount:e.messages?.filter(e=>e.role===`user`).length??0}));t(e)}}catch(e){console.error(`Failed to fetch chat history:`,e),t([]),m.toast.error(`Failed to load chat history`)}finally{i(!1)}}},[T,E]);(0,n.useEffect)(()=>{M()},[M]);let N=(e,t)=>{e.preventDefault(),e.stopPropagation(),l(t),o(!0)},P=async()=>{if(s){d(!0);try{if(T){let{error:e,response:t}=await(0,c.deleteChatById)({path:{id:s}});if(e)throw Error(`Failed to delete chat: ${Cr(e,t?.status)}`)}else ze(s);t(e=>e.filter(e=>e.id!==s)),m.toast.success(`Chat deleted`)}catch(e){m.toast.error(e.message||`Failed to delete chat`)}finally{o(!1),l(null),d(!1)}}},F=()=>{p(!0)},I=async()=>{g(!0);try{if(T){let{error:e,response:t}=await(0,c.deleteAllChats)();if(e)throw Error(`Failed to clear history: ${Cr(e,t?.status)}`)}else Be();t([]),m.toast.success(`All history cleared`)}catch(e){m.toast.error(e.message||`Failed to clear history`)}finally{p(!1),g(!1)}},L=()=>{O(!D),m.toast.success(D?`Private mode off`:`Private mode on — messages won't be saved`)},R=(0,n.useCallback)(async e=>{if(!e.trim()){S([]),w(!1);return}w(!0);try{if(T){let{data:t,error:n,response:r}=await(0,c.searchChats)({query:{q:e}});if(n)throw Error(`Failed to search chats: ${Cr(n,r?.status)}`);S(Array.isArray(t?.chats)?t.chats:[])}else{let t=Ie().filter(t=>{let n=t.title.toLowerCase().includes(e.toLowerCase()),r=t.messages?.some(t=>`content`in t&&t.content?.toLowerCase().includes(e.toLowerCase()));return n||r});S(t.map(e=>({...e,messageCount:e.messages?.filter(e=>e.role===`user`).length??0,lastMessageAt:Tr(e)})))}}catch(e){console.error(`Failed to search chat history:`,e),S([]),m.toast.error(`Failed to search chat history`)}finally{w(!1)}},[T]);return(0,n.useEffect)(()=>{let e=setTimeout(()=>{R(y)},300);return()=>clearTimeout(e)},[y,R]),{chats:e,sortedChats:A,displayChats:j,loading:r,pinnedIds:_,togglePin:k,incognito:D,toggleIncognito:L,searchQuery:y,searchResults:x,searching:C,handleSearchChange:(0,n.useCallback)(e=>{b(e)},[]),deleteDialogOpen:a,setDeleteDialogOpen:o,chatToDelete:s,setChatToDelete:l,deleting:u,handleDeleteClick:N,handleConfirmDelete:P,clearAllDialogOpen:f,setClearAllDialogOpen:p,clearingAll:h,handleClearAllClick:F,handleConfirmClearAll:I}}function kr({incognito:e,onToggleIncognito:t,showClearAll:n,onClearAll:r,searchQuery:i,onSearchChange:a}){return(0,d.jsxs)(`div`,{className:`mb-2 pb-2 border-b border-border space-y-2`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground/80 uppercase tracking-wide`,children:`Chat History`}),(0,d.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,d.jsxs)(`button`,{onClick:t,className:`flex items-center gap-1 px-2 py-1 text-xs rounded-lg transition-colors duration-200 ${e?`text-primary bg-primary/10`:`text-muted-foreground hover:text-foreground hover:bg-secondary`}`,title:e?`Private mode on`:`Private mode`,children:[(0,d.jsx)(s.Lock,{size:12}),(0,d.jsx)(`span`,{children:`Private`})]}),n&&(0,d.jsxs)(`button`,{onClick:r,className:`flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:text-red-500 hover:bg-red-500/10 rounded-lg transition-colors duration-200`,title:`Clear all history`,children:[(0,d.jsx)(s.Trash2,{size:12}),(0,d.jsx)(`span`,{children:`Clear All`})]})]})]}),(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(s.Search,{className:`absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground`,size:14}),(0,d.jsx)(`input`,{type:`text`,placeholder:`Search chats...`,value:i,onChange:e=>a(e.target.value),className:`w-full pl-7 pr-7 py-1.5 text-sm bg-secondary/50 border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50 placeholder:text-muted-foreground/50`}),i&&(0,d.jsx)(`button`,{onClick:()=>a(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,d.jsx)(s.X,{size:14})})]})]})}function Ar({chat:e,isPinned:n,onTogglePin:r,onDelete:i}){let a=e.messageCount??0;return(0,d.jsxs)(`div`,{className:`group flex items-center gap-1 px-2 py-1 rounded-lg hover:bg-secondary transition-colors duration-200`,children:[(0,d.jsxs)(D.default,{href:`/c/${e.id}`,onClick:n=>{t.researchAgentUIConfig.onOpenChat?.(e.id)&&n.preventDefault()},className:`flex-1 min-w-0 flex items-center gap-1.5`,children:[(0,d.jsxs)(`span`,{className:`flex items-center gap-1 shrink-0`,children:[a>0&&(0,d.jsxs)(zt,{className:`px-1.5 py-0 text-[10px] font-medium bg-zinc-200 text-zinc-700 hover:bg-zinc-200 dark:bg-zinc-700 dark:text-zinc-300 dark:hover:bg-zinc-700 border-0 rounded-md`,children:[a,`Q`]}),(0,d.jsx)(zt,{className:`px-1.5 py-0 text-[10px] font-medium bg-zinc-100 text-zinc-500 hover:bg-zinc-100 dark:bg-zinc-800 dark:text-zinc-400 dark:hover:bg-zinc-800 border-0 rounded-md`,children:L(new Date,e.createdAt)})]}),(0,d.jsxs)(`p`,{className:`text-xs text-popover-foreground truncate`,children:[n&&(0,d.jsx)(s.Pin,{size:10,className:`inline mr-1 text-primary`}),e.title]})]}),(0,d.jsx)(`button`,{onClick:t=>r(t,e.id),className:`p-1.5 rounded-lg transition-all duration-200 ${n?`opacity-100 text-primary hover:bg-primary/10`:`opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-primary hover:bg-primary/10`}`,title:n?`Unpin chat`:`Pin chat`,children:(0,d.jsx)(s.Pin,{size:14})}),(0,d.jsx)(`button`,{onClick:t=>i(t,e.id),className:`opacity-0 group-hover:opacity-100 p-1.5 rounded-lg hover:bg-red-500/10 text-muted-foreground hover:text-red-500 transition-all duration-200`,title:`Delete chat`,children:(0,d.jsx)(s.Trash,{size:14})})]})}function jr({open:e,onOpenChange:t,title:n,description:r,confirmLabel:i,loadingLabel:a,loading:o,onConfirm:s}){return(0,d.jsx)(U,{open:e,onOpenChange:e=>{!e&&!o&&t(!1)},children:(0,d.jsxs)(ue,{className:`w-full max-w-md transform rounded-2xl bg-light-secondary dark:bg-dark-secondary border border-light-200 dark:border-dark-200 p-6 text-left align-middle shadow-xl`,children:[(0,d.jsx)(de,{className:`text-lg font-medium leading-6 dark:text-white`,children:n}),(0,d.jsx)(fe,{className:`text-sm dark:text-white/70 text-black/70 mt-2`,children:r}),(0,d.jsxs)(`div`,{className:`flex flex-row items-end justify-end space-x-4 mt-6`,children:[(0,d.jsx)(`button`,{onClick:()=>{o||t(!1)},className:`text-black/50 dark:text-white/50 text-sm hover:text-black/70 hover:dark:text-white/70 transition duration-200`,children:`Cancel`}),(0,d.jsx)(`button`,{onClick:s,disabled:o,className:`text-red-400 text-sm hover:text-red-500 transition duration-200 disabled:opacity-50`,children:o?a:i})]})]})})}function Mr({deleteDialogOpen:e,setDeleteDialogOpen:t,chatToDelete:n,setChatToDelete:r,deleting:i,onConfirmDelete:a,clearAllDialogOpen:o,setClearAllDialogOpen:s,clearingAll:c,onConfirmClearAll:l}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(jr,{open:e,onOpenChange:e=>{t(e),e||r(null)},title:`Delete Confirmation`,description:`Are you sure you want to delete this chat?`,confirmLabel:`Delete`,loadingLabel:`Deleting...`,loading:i,onConfirm:a}),(0,d.jsx)(jr,{open:o,onOpenChange:s,title:`Clear All History`,description:`Are you sure you want to delete all your chat history? This action cannot be undone.`,confirmLabel:`Clear All`,loadingLabel:`Clearing...`,loading:c,onConfirm:l})]})}var Nr={Today:(0,d.jsx)(s.Sun,{size:12}),Yesterday:(0,d.jsx)(s.Clock,{size:12}),"This Week":(0,d.jsx)(s.CalendarDays,{size:12}),Older:(0,d.jsx)(s.Archive,{size:12})};function Pr(e){let t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),r=new Date(n.getTime()-864e5),i=new Date(n.getTime()-5184e5),a={Today:[],Yesterday:[],"This Week":[],Older:[]};for(let t of e){let e=new Date(t.createdAt);e>=n?a.Today.push(t):e>=r?a.Yesterday.push(t):e>=i?a[`This Week`].push(t):a.Older.push(t)}return[`Today`,`Yesterday`,`This Week`,`Older`].filter(e=>a[e].length>0).map(e=>({label:e,chats:a[e]}))}var Fr=({showLabel:e=!1})=>{let t=Or();return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(U,{children:[(0,d.jsxs)(se,{className:e?`inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs text-muted-foreground bg-secondary hover:bg-secondary/80 hover:text-foreground transition-colors duration-150`:`p-2 text-muted-foreground rounded-2xl bg-background/60 backdrop-blur-md hover:bg-secondary/80 transition duration-200 hover:text-foreground border border-border/30`,children:[(0,d.jsx)(s.History,{size:e?14:18}),e&&(0,d.jsx)(`span`,{children:`History`})]}),(0,d.jsxs)(ue,{className:`max-w-[420px] p-3`,children:[(0,d.jsx)(de,{className:`sr-only`,children:`Chat History`}),(0,d.jsx)(kr,{incognito:t.incognito,onToggleIncognito:t.toggleIncognito,showClearAll:t.chats.length>0&&!t.loading,onClearAll:t.handleClearAllClick,searchQuery:t.searchQuery,onSearchChange:t.handleSearchChange}),t.loading||t.searching?(0,d.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,d.jsxs)(`svg`,{"aria-hidden":`true`,className:`w-6 h-6 text-light-200 fill-light-secondary dark:text-[#202020] animate-spin dark:fill-[#ffffff3b]`,viewBox:`0 0 100 101`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,d.jsx)(`path`,{d:`M100 50.5908C100.003 78.2051 78.1951 100.003 50.5908 100C22.9765 99.9972 0.997224 78.018 1 50.4037C1.00281 22.7993 22.8108 0.997224 50.4251 1C78.0395 1.00281 100.018 22.8108 100 50.4251ZM9.08164 50.594C9.06312 73.3997 27.7909 92.1272 50.5966 92.1457C73.4023 92.1642 92.1298 73.4365 92.1483 50.6308C92.1669 27.8251 73.4392 9.0973 50.6335 9.07878C27.8278 9.06026 9.10003 27.787 9.08164 50.594Z`,fill:`currentColor`}),(0,d.jsx)(`path`,{d:`M93.9676 39.0409C96.393 38.4037 97.8624 35.9116 96.9801 33.5533C95.1945 28.8227 92.871 24.3692 90.0681 20.348C85.6237 14.1775 79.4473 9.36872 72.0454 6.45794C64.6435 3.54717 56.3134 2.65431 48.3133 3.89319C45.869 4.27179 44.3768 6.77534 45.014 9.20079C45.6512 11.6262 48.1343 13.0956 50.5786 12.717C56.5073 11.8281 62.5542 12.5399 68.0406 14.7911C73.527 17.0422 78.2187 20.7487 81.5841 25.4923C83.7976 28.5886 85.4467 32.059 86.4416 35.7474C87.1273 38.1189 89.5423 39.6781 91.9676 39.0409Z`,fill:`currentFill`})]})}):t.searchQuery.trim()&&t.displayChats.length===0?(0,d.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No matching chats found.`})}):t.chats.length===0?(0,d.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No chats found.`})}):(0,d.jsx)(`div`,{className:`space-y-1 max-h-[500px] overflow-y-auto`,children:t.searchQuery.trim()?t.displayChats.map(e=>(0,d.jsx)(Ar,{chat:e,isPinned:t.pinnedIds.includes(e.id),onTogglePin:t.togglePin,onDelete:t.handleDeleteClick},e.id)):Pr(t.displayChats).map(({label:e,chats:n})=>(0,d.jsxs)(`div`,{children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold text-muted-foreground/70 uppercase tracking-wider`,children:[Nr[e],e]}),n.map(e=>(0,d.jsx)(Ar,{chat:e,isPinned:t.pinnedIds.includes(e.id),onTogglePin:t.togglePin,onDelete:t.handleDeleteClick},e.id))]},e))}),t.chats.length>0&&(0,d.jsx)(`div`,{className:`mt-2 pt-2 border-t border-border`,children:(0,d.jsx)(D.default,{href:`/library`,className:`block text-center text-xs text-primary hover:underline`,children:`View all chats`})})]})]}),(0,d.jsx)(Mr,{deleteDialogOpen:t.deleteDialogOpen,setDeleteDialogOpen:t.setDeleteDialogOpen,chatToDelete:t.chatToDelete,setChatToDelete:t.setChatToDelete,deleting:t.deleting,onConfirmDelete:t.handleConfirmDelete,clearAllDialogOpen:t.clearAllDialogOpen,setClearAllDialogOpen:t.setClearAllDialogOpen,clearingAll:t.clearingAll,onConfirmClearAll:t.handleConfirmClearAll})]})},Ir=e=>new Date(e.lastMessageAt||e.createdAt).getTime();function Lr(){let{chats:e,loading:n}=Or(),r=[...e].sort((e,t)=>Ir(t)-Ir(e)).slice(0,5);return n||r.length===0?null:(0,d.jsxs)(`div`,{className:`flex flex-row items-center justify-center gap-2 flex-wrap`,children:[(0,d.jsx)(Fr,{showLabel:!0}),r.map(e=>{let n=Pn(e.lastMessageAt||e.createdAt);return(0,d.jsxs)(D.default,{href:`/c/${e.id}`,onClick:n=>{t.researchAgentUIConfig.onOpenChat?.(e.id)&&n.preventDefault()},className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs text-muted-foreground bg-secondary hover:bg-secondary/80 hover:text-foreground transition-colors duration-150 max-w-[220px]`,title:e.title,children:[(0,d.jsx)(`span`,{className:`truncate`,children:e.title}),n&&(0,d.jsx)(`span`,{className:`italic text-muted-foreground/70 whitespace-nowrap`,children:n})]},e.id)})]})}function Rr({listFooterLinks:e=[],optionShowIcons:t=!0,optionBackgroundColor:r=`bg-black/40`}){let[i,a]=(0,n.useState)(!1),o=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!i)return;let e=e=>{o.current&&!o.current.contains(e.target)&&a(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i]);let c=()=>e.map(({url:e,text:n,icon:r,onClick:i})=>{let a=r?s[r]:null,o=e.startsWith(`http`),c=o?{target:`_blank`,rel:`noopener noreferrer`}:{},l=(0,d.jsxs)(d.Fragment,{children:[t&&a&&(0,d.jsx)(a,{size:14}),(0,d.jsx)(`span`,{className:`font-semibold tracking-wide text-md`,style:{fontVariant:`small-caps`},children:n}),(0,d.jsx)(`span`,{className:`absolute bottom-0 left-0 w-0 h-0.5 bg-current transition-all duration-300 group-hover:w-full group-hover:shadow-[0_0_8px_rgba(255,255,255,0.6)]`})]});return i?(0,d.jsx)(`button`,{type:`button`,onClick:i,className:`relative group inline-flex items-center gap-1 hover:text-white hover:drop-shadow-[0_0_8px_rgba(255,255,255,0.8)] transition-all duration-300 whitespace-nowrap`,children:l},e):o?(0,d.jsx)(`a`,{href:e,...c,className:`relative group inline-flex items-center gap-1 hover:text-white hover:drop-shadow-[0_0_8px_rgba(255,255,255,0.8)] transition-all duration-300 whitespace-nowrap`,children:l},e):(0,d.jsx)(D.default,{href:e,className:`relative group inline-flex items-center gap-1 hover:text-white hover:drop-shadow-[0_0_8px_rgba(255,255,255,0.8)] transition-all duration-300 whitespace-nowrap`,children:l},e)}),l=s.Info;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`div`,{className:`hidden md:flex absolute bottom-2 left-1/2 -translate-x-1/2 text-slate-200 text-xs z-20 ${r} rounded-lg px-2 py-1 shadow-lg hover:shadow-xl hover:-translate-y-1 transition-all duration-300 flex-wrap items-center justify-center gap-x-6 max-w-[90vw]`,children:(0,d.jsx)(`div`,{className:`max-w-4xl mx-auto grid grid-cols-4 gap-2`,children:c()})}),(0,d.jsxs)(`div`,{ref:o,className:`md:hidden fixed top-[calc(8px+env(safe-area-inset-top,0px))] right-2 z-30`,children:[i&&(0,d.jsx)(`div`,{className:`absolute top-full right-0 mt-2 text-slate-200 text-xs ${r} rounded-lg px-3 py-2 shadow-lg flex flex-col items-start gap-2 backdrop-blur-sm`,children:c()}),(0,d.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),"aria-label":i?`Hide links`:`Show links`,"aria-expanded":i,className:`flex items-center justify-center h-8 w-8 rounded-full text-slate-200 ${r} shadow-lg backdrop-blur-sm hover:text-white transition-all duration-300`,children:l?(0,d.jsx)(l,{size:16}):`i`})]})]})}function zr({open:e,onOpenChange:n}){return(0,d.jsx)(U,{open:e,onOpenChange:n,children:(0,d.jsxs)(ue,{className:`w-full max-w-md rounded-2xl bg-light-secondary dark:bg-dark-secondary border border-light-200 dark:border-dark-200 p-6 text-center align-middle shadow-xl`,children:[(0,d.jsx)(de,{className:`text-lg font-medium leading-6 dark:text-white`,children:`Download QwkSearch`}),(0,d.jsx)(fe,{className:`text-sm dark:text-white/70 text-black/70 mt-2`,children:`Get QwkSearch on your browser or desktop.`}),(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-3 mt-6`,children:[(0,d.jsx)(k.DownloadAppButton,{platform:`chrome-extension`,href:t.researchAgentUIConfig.downloadChromeUrl,autoHighlight:!0}),(0,d.jsx)(k.DownloadAppButton,{platform:`windows`,appId:t.researchAgentUIConfig.downloadWindowsStoreId,autoHighlight:!0})]})]})})}function Br(){let e=`hyZbH3n.mp4,iOeZcCk.mp4,dUZlxYE.mp4,GpWeP6E.gif,LuKUsLE.png,w7X11Dd.png,MHmVtCr.png,HmnUAee.png,vKP22VU.png,l1lsV39.png,Ku8F2qc.png,KUEXtwm.png,vvKFPmY.png,5p8eaEf.png,VAKuJcG.png,sTMPtQW.png,m0gHbZZ.png,cKu7dWQ.png,ogfefYD.png,ey5vAae.png,twuLrvk.png,ELILiYt.png,9el5qpP.png,Up6xTkk.png,W1XKBo0.png,1Y6xvW0.png,JXOytMz.png,DNiI6pp.png,XDv5s6p.jpeg,eRwiRJ9.jpeg,DRAfJoc.jpeg,ASVRQ1G.jpeg,35svwUT.jpeg,81xLiVI.jpeg,6kod2Em.jpeg,eU0C8zt.jpeg,Bv0PBY8.jpeg,DQNbjIZ.jpeg,2uACPqZ.jpeg,XEKltMF.jpeg,WHgLfBm.jpeg,QFYM0Fw.jpeg,K12HCao.jpeg,oN8rtsE.jpeg,9fGnrns.jpeg,2ONJJeW.jpeg,DO23Va7.jpeg,QaKeoXk.jpeg,QU5oCBR.jpeg,MhlYZmh.jpeg,ylL1ToB.jpeg,AWWsCv8.jpeg,Tk9Tzzj.jpeg`.split(`,`);return`https://i.imgur.com/`+e[Math.floor(Math.random()*e.length)]}var Vr=15;function Hr(e){return e?e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.split(`,`).map(e=>e.trim()),n=Number(t[t.length-2]),r=Number(t[t.length-1]);return t.length>=2&&t[t.length-2]!==``&&t[t.length-1]!==``&&Number.isFinite(n)&&Number.isFinite(r)?{label:t.slice(0,t.length-2).filter(Boolean).join(`, `)||void 0,latitude:n,longitude:r}:{label:e}}):[]}function Ur(){let{sendMessage:e}=G(),[r,i]=(0,n.useState)(null),[a,o]=(0,n.useState)(null),[s,c]=(0,n.useState)(!1),[l,u]=(0,n.useState)(!1),[f,p]=(0,n.useState)([]),[m,h]=(0,n.useState)(!0),[g,_]=(0,n.useState)(5),[v,y]=(0,n.useState)(12),[b,x]=(0,n.useState)(`fahrenheit`),[C,w]=(0,n.useState)(null),[T,E]=(0,n.useState)(!0),[D,O]=(0,n.useState)(6),[k,M]=(0,n.useState)(!0),[N,P]=(0,n.useState)(!1),[F,I]=(0,n.useState)(!1),L=t.researchAgentUIConfig.footerLinks.map(e=>e.url===`/#downloads`?{...e,onClick:()=>u(!0)}:e),R=C||t.researchAgentUIConfig.trendingNewsApiUrl;(0,n.useEffect)(()=>{let e=()=>{p(Hr(localStorage.getItem(`weatherLocations`))),h(localStorage.getItem(`showWeatherWidget`)!==`false`),_(Number(localStorage.getItem(`weatherForecastDays`))||5),y(Number(localStorage.getItem(`weatherForecastHours`))||12),x(localStorage.getItem(`weatherTemperatureUnit`)===`celsius`?`celsius`:`fahrenheit`),w(localStorage.getItem(`trendingNewsApiUrl`)),E(localStorage.getItem(`showTrendingNewsWidget`)!==`false`),O(Number(localStorage.getItem(`trendingNewsMaxTopics`))||6),M(localStorage.getItem(`trendingNewsShowImages`)!==`false`),P(localStorage.getItem(`orbHoverGlow`)===`true`),I(localStorage.getItem(`cursorGlowTrail`)===`true`)};return e(),window.addEventListener(`client-config-changed`,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(`client-config-changed`,e),window.removeEventListener(`storage`,e)}},[]),(0,n.useEffect)(()=>{if(localStorage.getItem(`showBackgroundArt`)===`false`)return;i(Br());let e=setInterval(()=>{let e=Br();o(e),c(!0),setTimeout(()=>{i(e),c(!1),o(null)},1e3)},2e4);return()=>clearInterval(e)},[]);let z=e=>e.endsWith(`.webm`)||e.endsWith(`.mp4`),B=(e,t)=>z(e)?(0,d.jsx)(`video`,{src:e,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,className:`absolute inset-0 w-full h-full object-cover transition-opacity duration-1000 ${t}`},e):(0,d.jsx)(`img`,{src:e,alt:``,className:`absolute inset-0 w-full h-full object-cover transition-opacity duration-1000 ${t}`},e);return(0,d.jsxs)(`div`,{className:`relative min-h-screen w-full`,children:[(0,d.jsxs)(`div`,{className:`absolute inset-0 z-0`,children:[r&&B(r,s?`opacity-0`:`opacity-30`),a&&B(a,s?`opacity-30`:`opacity-0`),F&&(0,d.jsx)(yr,{})]}),(0,d.jsx)(`div`,{className:`relative z-10`,children:(0,d.jsxs)(`div`,{className:`flex flex-col items-center justify-end md:justify-center min-h-[calc(100dvh-64px)] md:min-h-screen max-w-screen-sm mx-auto p-2 pb-1 md:pb-2`,children:[(0,d.jsx)(`div`,{style:{height:`200px`,width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`},className:N?void 0:`pointer-events-none`,children:(0,d.jsx)(S.default,{autoRandomize:!0,onSphereClick:()=>console.log(`Sphere clicked`),className:`my-custom-class`})}),(0,d.jsxs)(`div`,{className:`w-full max-w-2xl mt-8 space-y-2`,children:[(0,d.jsx)(Lr,{}),(m||T)&&(0,d.jsxs)(`div`,{className:`flex flex-col gap-2 w-full`,children:[T&&(0,d.jsx)(j.TrendingNews,{compact:!0,expandable:!0,maxTopics:D,expandedMaxTopics:Vr,showImages:k,apiEndpoint:R,limit:Vr,className:`rounded-2xl w-full`,style:{background:`rgba(255,255,255,0.08)`,border:`1px solid rgba(255,255,255,0.15)`,color:`inherit`,backdropFilter:`blur(8px)`,maxWidth:`100%`}}),m&&(0,d.jsx)(A.WeatherForecast,{compact:!0,forecastDays:g,forecastHours:v,temperatureUnit:b,locations:f.length>0?f:void 0,className:`rounded-2xl w-full`,style:{background:`rgba(255,255,255,0.08)`,border:`1px solid rgba(255,255,255,0.15)`,color:`inherit`,backdropFilter:`blur(8px)`}})]}),(0,d.jsx)(Gn,{})]})]})}),(0,d.jsx)(Rr,{listFooterLinks:L}),(0,d.jsx)(zr,{open:l,onOpenChange:u})]})}var Wr=()=>(0,d.jsxs)(`svg`,{"aria-hidden":`true`,className:`w-8 h-8 text-border fill-secondary animate-spin`,viewBox:`0 0 100 101`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,d.jsx)(`path`,{d:`M100 50.5908C100.003 78.2051 78.1951 100.003 50.5908 100C22.9765 99.9972 0.997224 78.018 1 50.4037C1.00281 22.7993 22.8108 0.997224 50.4251 1C78.0395 1.00281 100.018 22.8108 100 50.4251ZM9.08164 50.594C9.06312 73.3997 27.7909 92.1272 50.5966 92.1457C73.4023 92.1642 92.1298 73.4365 92.1483 50.6308C92.1669 27.8251 73.4392 9.0973 50.6335 9.07878C27.8278 9.06026 9.10003 27.787 9.08164 50.594Z`,fill:`currentColor`}),(0,d.jsx)(`path`,{d:`M93.9676 39.0409C96.393 38.4037 97.8624 35.9116 96.9801 33.5533C95.1945 28.8227 92.871 24.3692 90.0681 20.348C85.6237 14.1775 79.4473 9.36872 72.0454 6.45794C64.6435 3.54717 56.3134 2.65431 48.3133 3.89319C45.869 4.27179 44.3768 6.77534 45.014 9.20079C45.6512 11.6262 48.1343 13.0956 50.5786 12.717C56.5073 11.8281 62.5542 12.5399 68.0406 14.7911C73.527 17.0422 78.2187 20.7487 81.5841 25.4923C83.7976 28.5886 85.4467 32.059 86.4416 35.7474C87.1273 38.1189 89.5423 39.6781 91.9676 39.0409Z`,fill:`currentFill`})]});function Gr(){return(0,d.jsx)(`div`,{className:`flex min-h-screen flex-col items-center justify-center p-8`,children:(0,d.jsxs)(`div`,{className:`max-w-2xl w-full space-y-6 bg-light-secondary dark:bg-dark-secondary rounded-lg p-8 border border-black/10 dark:border-white/10`,children:[(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(`h1`,{className:`text-2xl font-semibold text-black dark:text-white`,children:`⚠️ Configuration Required`}),(0,d.jsx)(`p`,{className:`text-black/70 dark:text-white/70`,children:`No AI model providers are configured. Add at least one API key to continue.`})]}),(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsx)(`h2`,{className:`text-lg font-medium text-black dark:text-white`,children:`Quick Setup:`}),(0,d.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,d.jsxs)(`div`,{className:`bg-black/5 dark:bg-white/5 rounded p-4`,children:[(0,d.jsx)(`p`,{className:`font-medium text-black dark:text-white mb-2`,children:`1. Create environment file:`}),(0,d.jsx)(`code`,{className:`block bg-black/10 dark:bg-white/10 rounded p-2 text-xs overflow-x-auto`,children:`apps/qwksearch-web/.env.local`})]}),(0,d.jsxs)(`div`,{className:`bg-black/5 dark:bg-white/5 rounded p-4`,children:[(0,d.jsx)(`p`,{className:`font-medium text-black dark:text-white mb-2`,children:`2. Add required variables:`}),(0,d.jsx)(`pre`,{className:`block bg-black/10 dark:bg-white/10 rounded p-3 text-xs overflow-x-auto text-black/80 dark:text-white/80`,children:`# Database
|
|
34
34
|
DATABASE_URL=file:./data/qwksearch.db
|
|
35
35
|
|
|
36
36
|
# Auth (generate: openssl rand -base64 32)
|
package/dist/workspace.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BocRIvOZ.cjs"),t=require("./config.cjs"),n=require("./src-
|
|
1
|
+
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BocRIvOZ.cjs"),t=require("./config.cjs"),n=require("./src-o009Easo.cjs");let r=require("react"),i=require("next/navigation"),a=require("react/jsx-runtime"),o=require("grab-url");o=e.t(o,1);let s=require("react-reason-editor/reason-docs"),c=require("react-reason-editor/theme"),l=require("react-reason-editor/locale-bundle"),u=require("react-reason-editor-sidebar");require("katex/dist/katex.min.css"),require("easydrawer/styles.css"),require("katex/contrib/mhchem");function d(e){return e.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/gi,` `).replace(/<[^>]+>/g,` `).replace(/ /g,` `).replace(/\s+/g,` `).trim()}var f=async(e,t)=>{try{let n=await(0,o.default)(`agent/page-tips`,{method:`POST`,body:JSON.stringify({title:e,content:t})});return Array.isArray(n.tips)?n.tips:[]}catch{return[]}},p=async(e,t)=>{try{let n=await(0,o.default)(`agent/topic-searches`,{method:`POST`,body:JSON.stringify({title:e,content:t})});return Array.isArray(n.topics)?n.topics:[]}catch{return[]}};function m(){let{activeView:e,toggleToDocs:o,toggleToResearch:m,filesSidebarRequestId:h}=n.c(),{chatTabs:g,activeChatId:_,openChat:v,newChat:y,closeChat:b,closeChats:x}=n.t(),{sendMessage:S}=n.A(),{signIn:C}=n.k(),w=(0,i.useSearchParams)(),[T,E]=(0,r.useState)(null),[D,O]=(0,r.useState)(null),[k,A]=(0,r.useState)(!1),[j,M]=(0,r.useState)(null);(0,r.useEffect)(()=>{l.localeActions.setLang(`en`),c.themeActions.setColor(`default`)},[]);let N=(0,r.useRef)(!1);(0,r.useEffect)(()=>{if(N.current)return;N.current=!0;let e=w.get(`docs`),t=w.get(`chat`);e?(O(e),o()):t&&(v(t),m()),A(!0)},[]),(0,r.useEffect)(()=>{if(typeof window>`u`||!k)return;let t=new URL(window.location.href);t.searchParams.set(`chat`,e===`research`?_??``:``),t.searchParams.set(`docs`,e===`docs`?T??``:``);let n=`${t.pathname}?${t.searchParams.toString()}${t.hash}`;n!==`${window.location.pathname}${window.location.search}${window.location.hash}`&&window.history.replaceState(null,``,n)},[e,_,T,k]);let P=g.map(e=>({id:e.id,title:e.title,kind:`chat`})),F=e=>{v(e),m()},I=e=>{let{closedWasActive:t,nextActiveId:n}=b(e);t&&!n&&o()},L=e=>{let{closedWasActive:t,nextActiveId:n}=x(e);t&&!n&&o()},R=()=>{y(),m()},z=(0,r.useCallback)(e=>(v(e),m(),!0),[v,m]);(0,r.useEffect)(()=>(t.configureResearchAgentUI({onOpenChat:z}),()=>t.configureResearchAgentUI({onOpenChat:void 0})),[z]);let B=async(e,t)=>f(e,d(t)),V=async(e,t)=>p(e,d(t)),H=(0,r.useCallback)(e=>{y(),m(),M(e)},[y,m]);(0,r.useEffect)(()=>{j&&_&&(S(j),M(null))},[j,_,S]);let U={extraTabs:P,activeExtraTabId:e===`research`?_??void 0:void 0,onExtraTabSelect:F,onExtraTabClose:I,onExtraTabsClose:L,onExtraTabAdd:R,onFileTabSelect:o,initialDocId:D,onActiveDocumentChange:E,onGenerateTips:B,onGenerateTopics:V,onSearchTopic:H,onSignIn:C};return e===`docs`?(0,a.jsx)(s.ReasonDocs,{SidebarComponent:u.Sidebar,SidebarContentComponent:u.SidebarContent,belowMainContent:(0,a.jsx)(n.E,{}),openFilesSidebarSignal:h,...U}):(0,a.jsx)(s.ReasonDocs,{SidebarComponent:u.Sidebar,SidebarContentComponent:u.SidebarContent,mainContent:(0,a.jsx)(n.f,{}),openFilesSidebarSignal:h,...U})}function h(e){return(0,a.jsx)(n.r,{...e,docsEnabled:!0,children:(0,a.jsx)(m,{})})}exports.ARTICLE_TOOLBAR_SHORTCUTS=n.S,exports.ArticleAIResponse=n.y,exports.ArticleActionButtons=n.C,exports.ArticleContent=n._,exports.ArticleFollowupQuestions=n.b,exports.ArticlePanelHeader=n.T,exports.ArticlePromptInput=n.x,exports.CategoryDock=n.o,exports.ChatInputBox=n.E,exports.ChatProvider=n.D,exports.ChatWindow=n.f,exports.CookieConsent=n.a,exports.ExtractPanelProvider=n.N,exports.HistoryDialogs=n.m,exports.HistoryDropdown=n.p,exports.KokoroVoiceSelector=n.u,exports.LexicalArticleViewer=n.v,exports.MainViewProvider=n.s,exports.QwkSearchApp=n.n,exports.QwkSearchProviders=n.r,exports.QwkSearchWorkspaceApp=h,exports.ResearchWorkspaceView=m,exports.SessionProvider=n.O,exports.UnifiedMarkdown=n.g,exports.VoiceSettingsPanel=n.l,exports.cn=n.F,exports.configureResearchAgentUI=t.configureResearchAgentUI,exports.formatMessageTime=n.I,exports.formatTimeDifference=n.L,exports.formatToolbarShortcut=n.w,exports.getPageTips=f,exports.getTopicSearches=p,exports.htmlToPlainText=d,exports.researchAgentUIConfig=t.researchAgentUIConfig,exports.useChat=n.A,exports.useChatState=n.j,exports.useChatTabs=n.t,exports.useChunkErrorReload=n.i,exports.useExtractPanel=n.P,exports.useHistoryState=n.h,exports.useKokoroTTS=n.d,exports.useMainView=n.c,exports.useSession=n.k,exports.useTextToSpeech=n.M;
|
package/dist/workspace.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import { configureResearchAgentUI as e, researchAgentUIConfig as t } from "./config.mjs";
|
|
4
|
-
import { A as n, C as r, D as i, E as a, F as o, I as s, L as c, M as l, N as u, O as d, P as f, S as p, T as m, _ as h, a as g, b as _, c as v, d as y, f as b, g as x, h as S, i as C, j as w, k as T, l as E, m as D, n as O, o as k, p as A, r as j, s as M, t as N, u as P, v as F, w as I, x as L, y as R } from "./src-
|
|
4
|
+
import { A as n, C as r, D as i, E as a, F as o, I as s, L as c, M as l, N as u, O as d, P as f, S as p, T as m, _ as h, a as g, b as _, c as v, d as y, f as b, g as x, h as S, i as C, j as w, k as T, l as E, m as D, n as O, o as k, p as A, r as j, s as M, t as N, u as P, v as F, w as I, x as L, y as R } from "./src-DW0_Dglb.js";
|
|
5
5
|
import { useCallback as z, useEffect as B, useRef as V, useState as H } from "react";
|
|
6
6
|
import { useSearchParams as U } from "next/navigation";
|
|
7
7
|
import { jsx as W } from "react/jsx-runtime";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "research-agent-ui",
|
|
3
3
|
"description": "The QwkSearch app UI: conversation window, article reader, search config, file uploads, chat history, and the app shell — exported both with and without the REASON editor and its sidebar",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.188",
|
|
5
5
|
"author": "vtempest",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -90,13 +90,13 @@
|
|
|
90
90
|
"@radix-ui/react-tooltip": "^1.2.16",
|
|
91
91
|
"@ricky0123/vad-web": "^0.0.30",
|
|
92
92
|
"ai": "^7.0.94",
|
|
93
|
-
"chat-agent-toolkit": "^1.2.
|
|
93
|
+
"chat-agent-toolkit": "^1.2.319",
|
|
94
94
|
"class-variance-authority": "^0.7.1",
|
|
95
95
|
"clsx": "^2.1.1",
|
|
96
|
-
"domain-rank": "^0.1.
|
|
96
|
+
"domain-rank": "^0.1.308",
|
|
97
97
|
"dompurify": "^3.4.15",
|
|
98
98
|
"drizzle-orm": "^0.45.2",
|
|
99
|
-
"extract-webpage": "^1.2.
|
|
99
|
+
"extract-webpage": "^1.2.314",
|
|
100
100
|
"framer-motion": "^13.2.0",
|
|
101
101
|
"fuse.js": "^7.5.0",
|
|
102
102
|
"grab-url": "^1.6.22",
|
|
@@ -106,21 +106,21 @@
|
|
|
106
106
|
"markdown-to-jsx": "^9.10.2",
|
|
107
107
|
"motion": "^13.2.0",
|
|
108
108
|
"quantum-sphere-loading-icon": "^1.0.3",
|
|
109
|
-
"qwksearch-api-client": "^0.9.
|
|
109
|
+
"qwksearch-api-client": "^0.9.261",
|
|
110
110
|
"react-icons": "^5.7.0",
|
|
111
111
|
"react-native-app-buttons": "^0.1.4",
|
|
112
112
|
"react-textarea-autosize": "^8.5.9",
|
|
113
|
-
"search-web-api": "^1.0.
|
|
114
|
-
"shadcn-app-dock": "^0.1.
|
|
113
|
+
"search-web-api": "^1.0.171",
|
|
114
|
+
"shadcn-app-dock": "^0.1.169",
|
|
115
115
|
"shadcn-theme-menu": "^1.1.47",
|
|
116
116
|
"sonner": "^2.0.8",
|
|
117
117
|
"streamdown": "^2.6.0",
|
|
118
118
|
"tailwind-merge": "^3.6.0",
|
|
119
119
|
"tldts": "^7.4.12",
|
|
120
|
-
"trending-news-api": "^0.1.
|
|
120
|
+
"trending-news-api": "^0.1.47",
|
|
121
121
|
"turndown": "^7.2.4",
|
|
122
122
|
"use-voice-control": "^0.1.95",
|
|
123
|
-
"use-weather-forecast": "^0.1.
|
|
123
|
+
"use-weather-forecast": "^0.1.133"
|
|
124
124
|
},
|
|
125
125
|
"devDependencies": {
|
|
126
126
|
"@cloudflare/workers-types": "^5.20260908.1",
|
|
@@ -139,8 +139,8 @@
|
|
|
139
139
|
"next": "^16.3.4",
|
|
140
140
|
"react": "^19.2.8",
|
|
141
141
|
"react-dom": "^19.2.8",
|
|
142
|
-
"react-reason-editor": "^1.0.
|
|
143
|
-
"react-reason-editor-sidebar": "^0.1.
|
|
142
|
+
"react-reason-editor": "^1.0.121",
|
|
143
|
+
"react-reason-editor-sidebar": "^0.1.38",
|
|
144
144
|
"storybook": "^10.6.0",
|
|
145
145
|
"tailwindcss": "^4.3.3",
|
|
146
146
|
"typescript": "^7.0.2",
|