research-agent-ui 0.1.352 → 0.1.354

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.
@@ -0,0 +1,2 @@
1
+ const e=require("./rolldown-runtime-BocRIvOZ.cjs"),t=require("./dialog-7GDz0sWx.cjs"),n=require("./tooltip-DmUO6ZUz.cjs"),r=require("./src-DgR_99cQ.cjs"),i=require("./config.cjs");let a=require("react");a=e.t(a,1);let o=require("react/jsx-runtime"),s=require("sonner"),c=require("qwksearch-api-client");var l=a.forwardRef(({className:e,...n},r)=>(0,o.jsx)(`span`,{ref:r,className:t.o(`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%)`},...n}));l.displayName=`VisuallyHidden`;function u(e){return e instanceof Error&&e.name===`AbortError`}async function ee(e,t){if(t.share)try{return await t.share(e),`shared`}catch(e){if(u(e))return`cancelled`}return await t.writeText(e.url),`copied`}var d=e=>{let{isOpen:u,url:d,searchText:te,suggestQuestions:f,panelWidth:ne,setPanelWidth:p,closePanel:re}=n.a(),{isAuthenticated:ie}=n.c(),{chatModelProvider:m}=n.u(),h=e.isOpen===void 0?u:e.isOpen,g=e.onClose||re,_=e.url||d,ae=e.searchText===void 0?te:e.searchText,[v,y]=(0,a.useState)(null),[b,oe]=(0,a.useState)([]),[se,x]=(0,a.useState)(!1),[ce,S]=(0,a.useState)(!1),[C,w]=(0,a.useState)(i.researchAgentUIConfig.defaultSummarizePrompt),[le,T]=(0,a.useState)(!1),[E,ue]=(0,a.useState)(!1),[D,de]=(0,a.useState)(!1),[O,fe]=(0,a.useState)(``),[k,pe]=(0,a.useState)(``),[me,A]=(0,a.useState)([]),[he,ge]=(0,a.useState)(``),[j,M]=(0,a.useState)(!1),[_e,N]=(0,a.useState)(!1),[P,F]=(0,a.useState)(!1),[ve,ye]=(0,a.useState)(!1),[be,xe]=(0,a.useState)(ne),[I,L]=(0,a.useState)(!1),[Se,R]=(0,a.useState)(!1),[z,B]=(0,a.useState)(1),[V,Ce]=(0,a.useState)(`questions`),[we,Te]=(0,a.useState)([]),H=(0,a.useId)(),U=(0,a.useRef)(null),Ee=(0,a.useRef)(null),W=(0,a.useRef)({}),G=.5,K=1.8,q=.1;(0,a.useEffect)(()=>{let e=parseFloat(localStorage.getItem(`articleFontScale`)||``);Number.isNaN(e)||B(Math.min(K,Math.max(G,e)))},[]);let J=e=>{let t=Math.min(K,Math.max(G,Math.round(e*100)/100));B(t);try{localStorage.setItem(`articleFontScale`,String(t))}catch(e){console.error(`Error storing article font scale:`,e)}},De=e=>{Ce(e),e===`questions`&&U.current?.scrollTo?.({top:0})},Y=()=>J(z+q),X=()=>J(z-q),Z=()=>J(1);(0,a.useEffect)(()=>{let e=()=>{ye(window.innerWidth>=1024)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,a.useEffect)(()=>{let e=e=>{if(!I)return;let t=window.innerWidth-e.clientX,n=Math.max(400,Math.min(t,window.innerWidth-100));xe(n),p(n)},t=()=>{L(!1)};return I&&(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=``}},[I,p]),(0,a.useEffect)(()=>{h&&_?(R(!1),Oe()):h||R(!1)},[h,_]);let Oe=async()=>{console.log(`[ArticleExtractPanel] Extracting URL:`,_);try{let e=new URL(_);if([/^https?:\/\/(www\.)?google\.[^/]+\/search/i,/^https?:\/\/(www\.)?bing\.com\/search/i,/^https?:\/\/(www\.)?duckduckgo\.com\/\?/i].some(e=>e.test(_))){s.toast.error(`Cannot extract articles from search result pages`),T(!1),R(!0);return}(e.pathname===`/`||e.pathname===``)&&(console.error(`[ArticleExtractPanel] URL is domain-only, missing article path:`,_),s.toast.error(`Invalid article URL - only domain provided`))}catch(e){console.error(`[ArticleExtractPanel] Invalid URL format:`,_,e)}T(!0);try{let{data:e}=await(0,c.getArticle)({query:{url:_}}),t=e?.article,n=t?.html?.replace(/<[^>]*>/g,``).trim()||``;t?.error||n.length<20?(document.dispatchEvent(new CustomEvent(`onInvokeChromeAPI`,{detail:{type:`extractURL`,url:_}})),await Promise.race([new Promise(e=>{let t=async n=>{window.removeEventListener(`onExtractionResult`,t);let{data:r}=await(0,c.getArticle)({query:{url:_}}),i=r?.article;i&&(y(i),i.followUpQuestions?.length>0?A(i.followUpQuestions):f&&(A([]),$(`suggest-followups`,{source:i}))),e()};window.addEventListener(`onExtractionResult`,t)}),new Promise(e=>setTimeout(e,1e4))])):(y(t),t?.followUpQuestions&&t.followUpQuestions.length>0?A(t.followUpQuestions):f&&t&&(A([]),$(`suggest-followups`,{source:t}))),ie&&ke()}catch(e){console.error(`[ArticleExtractPanel] Error extracting URL:`,e),s.toast.error(`Failed to load article`)}finally{T(!1),R(!0)}},ke=async()=>{try{let{data:e}=await(0,c.listFavorites)(),t=e?.favorites?.some(e=>e.url===_);M(!!t)}catch(e){console.error(`Error checking favorite status:`,e)}},Q=async()=>{if(v){N(!0);try{j?(await(0,c.removeFavorite)({query:{url:_}}),M(!1),s.toast.info(`Removed from favorites`)):(await(0,c.addFavorite)({body:{url:v.url||_,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}}),M(!0),s.toast.success(`Added to favorites`))}catch(e){console.error(`Error toggling favorite:`,e),s.toast.error(`Failed to toggle favorite`)}finally{N(!1)}}},Ae=()=>{if(m?.key&&m?.providerId)return m;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 m},$=async(e,{source:t=v,question:n=C}={})=>{if(!t)return;let r=Ae(),a=t.html?.replace(/<[^>]*>?/g,``).slice(0,i.researchAgentUIConfig.maxArticleLength),o=e===`question`,s=o?ue:de,l=o?pe:ge;s(!0),l(``);try{if(o){let e=[ae,n].filter(Boolean).join(`
2
+ `);if(!a||a.length===0)throw Error(`Article content is empty`);let{data:t,error:i}=await(0,c.articleQa)({body:{article:a,question:e,chatHistory:b.slice(-5),chatModel:r}});if(i){let e=i.details||i.error||i.message||`Article QA failed`;throw Error(e)}let o=t?.content||``;fe(o),oe(e=>[...e,{role:`user`,content:n,time:new Date().toISOString()},{role:`assistant`,content:o,time:new Date().toISOString()}]);try{await(0,c.updateArticle)({body:{url:_,question:n,answer:o}})}catch(e){console.error(`Error storing Q&A in cache:`,e)}}else{let e=parseInt(localStorage.getItem(`maxFollowupQuestions`)||`4`);if(!a||a.length===0)throw Error(`Article content is empty`);let{data:t,error:n}=await(0,c.articleFollowups)({body:{article:a,chatHistory:b.slice(-5),maxQuestions:e,chatModel:r}});if(n){let e=n.details||n.error||n.message||`Article followups failed`;throw Error(e)}let i=t?.extract||[];A(i);try{await(0,c.updateArticle)({body:{url:_,followUpQuestions:i}})}catch(e){console.error(`Error storing follow-up questions in cache:`,e)}}}catch(e){console.error(`Error calling language API:`,e),l(e instanceof Error||typeof e==`object`&&e&&`message`in e?e.message:`Failed to get AI response`)}finally{s(!1)}},je=e=>{w(e),$(`question`,{question:e})},Me=async()=>{if(!v)return;let e=`${O}\n\n\n${v.cite||``}\n\n\n${v.html}`;try{await navigator.clipboard.writeText(e),x(!0),setTimeout(()=>x(!1),2e3)}catch(e){console.error(`Failed to copy to clipboard:`,e)}},Ne=async()=>{let e=v?.url||_;if(e)try{await ee({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`&&(S(!0),setTimeout(()=>S(!1),2e3))}catch(e){console.error(`Failed to share article:`,e)}};W.current={ask:()=>$(`question`),suggest:()=>$(`suggest-followups`),copy:Me,highlight:()=>F(e=>!e),favorite:Q,open:()=>{let e=v?.url||_;e&&window.open(e,`_blank`,`noopener,noreferrer`)},zoomIn:Y,zoomOut:X,zoomReset:Z,close:g},(0,a.useEffect)(()=>{if(!h)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(r.j).forEach(n=>{let{alt:i,key:a}=r.j[n];i&&(t[e(a.toLowerCase())]=n)});let n=e=>{if(e.key===`Escape`){W.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=W.current[r];i&&(e.preventDefault(),i())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[h]);let Pe=()=>(0,o.jsxs)(`div`,{className:`flex h-full flex-col bg-background shadow-xl`,children:[(0,o.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,o.jsx)(r.M,{isLoadingAI:E,isLoadingFollowups:D,isLoadingFavorite:_e,isFavorited:j,isHighlightMode:P,articleUrl:v?.url||_,fontScale:z,onAskClick:()=>$(`question`),onSuggestClick:()=>$(`suggest-followups`),onCopyClick:Me,onShareClick:Ne,onFavoriteClick:Q,onHighlightToggle:()=>F(!P),onZoomIn:Y,onZoomOut:X,onZoomReset:Z,onClose:g})}),(0,o.jsx)(`div`,{className:`shrink-0 px-4 pt-2`,children:(0,o.jsx)(r.S,{value:V,onValueChange:De,idBase:H})}),(0,o.jsx)(`div`,{role:`tabpanel`,id:r.C(H,`outline`).panel,"aria-labelledby":r.C(H,`outline`).tab,hidden:V!==`outline`,className:`flex max-h-[40%] min-h-0 shrink-0 flex-col border-b border-border px-4`,children:V===`outline`&&(0,o.jsx)(r.w,{items:we})}),(0,o.jsx)(`div`,{ref:U,className:`flex-1 overflow-y-auto`,children:(0,o.jsxs)(`div`,{className:`p-4 space-y-6`,children:[(0,o.jsxs)(`div`,{className:`space-y-4`,children:[se&&(0,o.jsx)(`div`,{className:`bg-blue-500 text-white text-sm font-medium px-3 py-2 rounded-md shadow-lg`,children:`Copied!`}),ce&&(0,o.jsx)(`div`,{className:`bg-blue-500 text-white text-sm font-medium px-3 py-2 rounded-md shadow-lg`,children:`Link copied!`}),(0,o.jsxs)(`div`,{role:`tabpanel`,id:r.C(H,`questions`).panel,"aria-labelledby":r.C(H,`questions`).tab,hidden:V!==`questions`,className:`space-y-4`,children:[(0,o.jsx)(r.A,{value:C,onChange:w,onSubmit:()=>$(`question`)}),(0,o.jsx)(r.k,{questions:me,isLoading:D,error:he,onQuestionClick:je})]}),b.length>0&&(0,o.jsx)(`div`,{className:`space-y-4`,children:b.map((e,t)=>(0,o.jsx)(`div`,{className:`space-y-2`,children:e.role===`user`?(0,o.jsxs)(`div`,{className:`bg-primary/10 border border-primary/20 rounded-lg p-3`,children:[(0,o.jsx)(`div`,{className:`text-xs font-semibold text-primary mb-1`,children:`Your Question`}),(0,o.jsx)(`div`,{className:`text-sm text-foreground`,children:e.content})]}):(0,o.jsxs)(`div`,{className:`bg-muted rounded-lg shadow-md p-4`,children:[(0,o.jsx)(`div`,{className:`text-xs font-semibold text-muted-foreground mb-2`,children:`AI Response`}),(0,o.jsx)(`div`,{className:`text-sm`,dangerouslySetInnerHTML:{__html:e.content}})]})},t))}),(E||O&&b.length===0)&&(0,o.jsx)(r.O,{response:O,isLoading:E,error:k}),k&&!E&&(0,o.jsx)(`div`,{className:`bg-red-500 text-white p-2 rounded-md text-sm`,children:k})]}),v&&(0,o.jsx)(r.T,{article:v,isHighlightMode:P,fontScale:z,onOutlineChange:Te})]})})]});return!h||!Se?null:ve?(0,o.jsxs)(`div`,{className:`fixed top-0 right-0 h-screen z-40 transition-all duration-300`,style:{width:`${be}px`},children:[(0,o.jsx)(`div`,{ref:Ee,onMouseDown:()=>L(!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,o.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,o.jsx)(t.t,{open:h,onOpenChange:e=>!e&&g(),children:(0,o.jsxs)(t.n,{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,o.jsx)(l,{children:(0,o.jsx)(t.i,{children:`Article Details`})}),(0,o.jsx)(`div`,{className:`h-full overflow-y-auto`,children:Pe()})]})})};exports.default=d;
@@ -0,0 +1,418 @@
1
+ import { i as e, n as t, o as n, t as r } from "./dialog-Cufn2u50.js";
2
+ import { a as i, c as a, u as o } from "./tooltip-Bl3IdX-I.js";
3
+ import { A as s, C as c, M as ee, O as te, S as ne, T as re, j as l, k as ie, w as ae } from "./src-Czo4Yrd2.js";
4
+ import { researchAgentUIConfig as u } from "./config.mjs";
5
+ import * as d from "react";
6
+ import { useEffect as f, useId as oe, useRef as p, useState as m } from "react";
7
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
8
+ import { toast as _ } from "sonner";
9
+ import { addFavorite as se, articleFollowups as ce, articleQa as le, getArticle as v, listFavorites as ue, removeFavorite as de, updateArticle as y } from "qwksearch-api-client";
10
+ // src/ui/visually-hidden.tsx
11
+ var b = d.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ h("span", {
12
+ ref: r,
13
+ className: n("absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0", e),
14
+ style: {
15
+ clip: "rect(0, 0, 0, 0)",
16
+ clipPath: "inset(50%)"
17
+ },
18
+ ...t
19
+ }));
20
+ b.displayName = "VisuallyHidden";
21
+ // src/lib/shareArticle.ts
22
+ function fe(e) {
23
+ return e instanceof Error && e.name === "AbortError";
24
+ }
25
+ async function pe(e, t) {
26
+ if (t.share) try {
27
+ return await t.share(e), "shared";
28
+ } catch (e) {
29
+ if (fe(e)) return "cancelled";
30
+ }
31
+ return await t.writeText(e.url), "copied";
32
+ }
33
+ // src/components/ArticleReader/ArticleExtractPanel.tsx
34
+ var me = (n) => {
35
+ let { isOpen: d, url: fe, searchText: me, suggestQuestions: he, panelWidth: ge, setPanelWidth: x, closePanel: _e } = i(), { isAuthenticated: ve } = a(), { chatModelProvider: S } = o(), C = n.isOpen === void 0 ? d : n.isOpen, w = n.onClose || _e, T = n.url || fe, ye = n.searchText === void 0 ? me : n.searchText, [E, D] = m(null), [O, be] = m([]), [xe, k] = m(!1), [Se, A] = m(!1), [j, M] = m(u.defaultSummarizePrompt), [Ce, N] = m(!1), [P, we] = m(!1), [F, Te] = m(!1), [I, Ee] = m(""), [L, De] = m(""), [Oe, R] = m([]), [ke, Ae] = m(""), [z, B] = m(!1), [je, Me] = m(!1), [V, H] = m(!1), [Ne, Pe] = m(!1), [Fe, Ie] = m(ge), [U, W] = m(!1), [Le, G] = m(!1), [K, q] = m(1), [J, Re] = m("questions"), [ze, Be] = m([]), Y = oe(), X = p(null), Ve = p(null), Z = p({}), He = .5, Ue = 1.8, We = .1;
36
+ f(() => {
37
+ let e = parseFloat(localStorage.getItem("articleFontScale") || "");
38
+ Number.isNaN(e) || q(Math.min(Ue, Math.max(He, e)));
39
+ }, []);
40
+ let Q = (e) => {
41
+ let t = Math.min(Ue, Math.max(He, Math.round(e * 100) / 100));
42
+ q(t);
43
+ try {
44
+ localStorage.setItem("articleFontScale", String(t));
45
+ } catch (e) {
46
+ console.error("Error storing article font scale:", e);
47
+ }
48
+ }, Ge = (e) => {
49
+ Re(e), e === "questions" && X.current?.scrollTo?.({ top: 0 });
50
+ }, Ke = () => Q(K + We), qe = () => Q(K - We), Je = () => Q(1);
51
+ f(() => {
52
+ let e = () => {
53
+ Pe(window.innerWidth >= 1024);
54
+ };
55
+ return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
56
+ }, []), f(() => {
57
+ let e = (e) => {
58
+ if (!U) return;
59
+ let t = window.innerWidth - e.clientX, n = Math.max(400, Math.min(t, window.innerWidth - 100));
60
+ Ie(n), x(n);
61
+ }, t = () => {
62
+ W(!1);
63
+ };
64
+ return U && (document.addEventListener("mousemove", e), document.addEventListener("mouseup", t), document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none"), () => {
65
+ document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", t), document.body.style.cursor = "", document.body.style.userSelect = "";
66
+ };
67
+ }, [U, x]), f(() => {
68
+ C && T ? (G(!1), Ye()) : C || G(!1);
69
+ }, [C, T]);
70
+ let Ye = async () => {
71
+ console.log("[ArticleExtractPanel] Extracting URL:", T);
72
+ try {
73
+ let e = new URL(T);
74
+ if ([
75
+ /^https?:\/\/(www\.)?google\.[^/]+\/search/i,
76
+ /^https?:\/\/(www\.)?bing\.com\/search/i,
77
+ /^https?:\/\/(www\.)?duckduckgo\.com\/\?/i
78
+ ].some((e) => e.test(T))) {
79
+ _.error("Cannot extract articles from search result pages"), N(!1), G(!0);
80
+ return;
81
+ }
82
+ (e.pathname === "/" || e.pathname === "") && (console.error("[ArticleExtractPanel] URL is domain-only, missing article path:", T), _.error("Invalid article URL - only domain provided"));
83
+ } catch (e) {
84
+ console.error("[ArticleExtractPanel] Invalid URL format:", T, e);
85
+ }
86
+ N(!0);
87
+ try {
88
+ let { data: e } = await v({ query: { url: T } }), t = e?.article, n = t?.html?.replace(/<[^>]*>/g, "").trim() || "";
89
+ t?.error || n.length < 20 ? (document.dispatchEvent(new CustomEvent("onInvokeChromeAPI", { detail: {
90
+ type: "extractURL",
91
+ url: T
92
+ } })), await Promise.race([new Promise((e) => {
93
+ let t = async (n) => {
94
+ window.removeEventListener("onExtractionResult", t);
95
+ let { data: r } = await v({ query: { url: T } }), i = r?.article;
96
+ i && (D(i), i.followUpQuestions?.length > 0 ? R(i.followUpQuestions) : he && (R([]), $("suggest-followups", { source: i }))), e();
97
+ };
98
+ window.addEventListener("onExtractionResult", t);
99
+ }), new Promise((e) => setTimeout(e, 1e4))])) : (D(t), t?.followUpQuestions && t.followUpQuestions.length > 0 ? R(t.followUpQuestions) : he && t && (R([]), $("suggest-followups", { source: t }))), ve && Xe();
100
+ } catch (e) {
101
+ console.error("[ArticleExtractPanel] Error extracting URL:", e), _.error("Failed to load article");
102
+ } finally {
103
+ N(!1), G(!0);
104
+ }
105
+ }, Xe = async () => {
106
+ try {
107
+ let { data: e } = await ue(), t = e?.favorites?.some((e) => e.url === T);
108
+ B(!!t);
109
+ } catch (e) {
110
+ console.error("Error checking favorite status:", e);
111
+ }
112
+ }, Ze = async () => {
113
+ if (E) {
114
+ Me(!0);
115
+ try {
116
+ z ? (await de({ query: { url: T } }), B(!1), _.info("Removed from favorites")) : (await se({ body: {
117
+ url: E.url || T,
118
+ title: E.title,
119
+ cite: E.cite,
120
+ author: E.author,
121
+ author_cite: E.author_cite,
122
+ date: E.date,
123
+ source: E.source,
124
+ word_count: E.word_count,
125
+ html: E.html
126
+ } }), B(!0), _.success("Added to favorites"));
127
+ } catch (e) {
128
+ console.error("Error toggling favorite:", e), _.error("Failed to toggle favorite");
129
+ } finally {
130
+ Me(!1);
131
+ }
132
+ }
133
+ }, Qe = () => {
134
+ if (S?.key && S?.providerId) return S;
135
+ try {
136
+ let e = localStorage.getItem("chatModelKey") || "", t = localStorage.getItem("chatModelProviderId") || "";
137
+ if (e && t) return {
138
+ key: e,
139
+ providerId: t
140
+ };
141
+ } catch (e) {
142
+ console.error("Error reading persisted chat model:", e);
143
+ }
144
+ return S;
145
+ }, $ = async (e, { source: t = E, question: n = j } = {}) => {
146
+ if (!t) return;
147
+ let r = Qe(), i = t.html?.replace(/<[^>]*>?/g, "").slice(0, u.maxArticleLength), a = e === "question", o = a ? we : Te, s = a ? De : Ae;
148
+ o(!0), s("");
149
+ try {
150
+ if (a) {
151
+ let e = [ye, n].filter(Boolean).join("\n");
152
+ if (!i || i.length === 0) throw Error("Article content is empty");
153
+ let { data: t, error: a } = await le({ body: {
154
+ article: i,
155
+ question: e,
156
+ chatHistory: O.slice(-5),
157
+ chatModel: r
158
+ } });
159
+ if (a) {
160
+ let e = a.details || a.error || a.message || "Article QA failed";
161
+ throw Error(e);
162
+ }
163
+ let o = t?.content || "";
164
+ Ee(o), be((e) => [
165
+ ...e,
166
+ {
167
+ role: "user",
168
+ content: n,
169
+ time: (/* @__PURE__ */ new Date()).toISOString()
170
+ },
171
+ {
172
+ role: "assistant",
173
+ content: o,
174
+ time: (/* @__PURE__ */ new Date()).toISOString()
175
+ }
176
+ ]);
177
+ try {
178
+ await y({ body: {
179
+ url: T,
180
+ question: n,
181
+ answer: o
182
+ } });
183
+ } catch (e) {
184
+ console.error("Error storing Q&A in cache:", e);
185
+ }
186
+ } else {
187
+ let e = parseInt(localStorage.getItem("maxFollowupQuestions") || "4");
188
+ if (!i || i.length === 0) throw Error("Article content is empty");
189
+ let { data: t, error: n } = await ce({ body: {
190
+ article: i,
191
+ chatHistory: O.slice(-5),
192
+ maxQuestions: e,
193
+ chatModel: r
194
+ } });
195
+ if (n) {
196
+ let e = n.details || n.error || n.message || "Article followups failed";
197
+ throw Error(e);
198
+ }
199
+ let a = t?.extract || [];
200
+ R(a);
201
+ try {
202
+ await y({ body: {
203
+ url: T,
204
+ followUpQuestions: a
205
+ } });
206
+ } catch (e) {
207
+ console.error("Error storing follow-up questions in cache:", e);
208
+ }
209
+ }
210
+ } catch (e) {
211
+ console.error("Error calling language API:", e), s(e instanceof Error || typeof e == "object" && e && "message" in e ? e.message : "Failed to get AI response");
212
+ } finally {
213
+ o(!1);
214
+ }
215
+ }, $e = (e) => {
216
+ M(e), $("question", { question: e });
217
+ }, et = async () => {
218
+ if (!E) return;
219
+ let e = `${I}\n\n\n${E.cite || ""}\n\n\n${E.html}`;
220
+ try {
221
+ await navigator.clipboard.writeText(e), k(!0), setTimeout(() => k(!1), 2e3);
222
+ } catch (e) {
223
+ console.error("Failed to copy to clipboard:", e);
224
+ }
225
+ }, tt = async () => {
226
+ let e = E?.url || T;
227
+ if (e) try {
228
+ await pe({
229
+ title: E?.title,
230
+ text: E?.cite,
231
+ url: e
232
+ }, {
233
+ share: typeof navigator < "u" && navigator.share ? (e) => navigator.share(e) : void 0,
234
+ writeText: (e) => navigator.clipboard.writeText(e)
235
+ }) === "copied" && (A(!0), setTimeout(() => A(!1), 2e3));
236
+ } catch (e) {
237
+ console.error("Failed to share article:", e);
238
+ }
239
+ };
240
+ Z.current = {
241
+ ask: () => $("question"),
242
+ suggest: () => $("suggest-followups"),
243
+ copy: et,
244
+ highlight: () => H((e) => !e),
245
+ favorite: Ze,
246
+ open: () => {
247
+ let e = E?.url || T;
248
+ e && window.open(e, "_blank", "noopener,noreferrer");
249
+ },
250
+ zoomIn: Ke,
251
+ zoomOut: qe,
252
+ zoomReset: Je,
253
+ close: w
254
+ }, f(() => {
255
+ if (!C) return;
256
+ let e = (e) => /^[a-z]$/.test(e) ? `Key${e.toUpperCase()}` : /^[0-9]$/.test(e) ? `Digit${e}` : e === "-" ? "Minus" : e === "=" ? "Equal" : e, t = {};
257
+ Object.keys(l).forEach((n) => {
258
+ let { alt: r, key: i } = l[n];
259
+ r && (t[e(i.toLowerCase())] = n);
260
+ });
261
+ let n = (e) => {
262
+ if (e.key === "Escape") {
263
+ Z.current.close?.();
264
+ return;
265
+ }
266
+ if (!e.altKey || e.ctrlKey || e.metaKey) return;
267
+ let n = e.target;
268
+ if (n && (n.tagName === "INPUT" || n.tagName === "TEXTAREA" || n.isContentEditable)) return;
269
+ let r = t[e.code];
270
+ if (!r) return;
271
+ let i = Z.current[r];
272
+ i && (e.preventDefault(), i());
273
+ };
274
+ return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
275
+ }, [C]);
276
+ let nt = () => /* @__PURE__ */ g("div", {
277
+ className: "flex h-full flex-col bg-background shadow-xl",
278
+ children: [
279
+ /* @__PURE__ */ h("div", {
280
+ className: "shrink-0 border-b border-border bg-background/95 px-4 py-3 backdrop-blur supports-[backdrop-filter]:bg-background/80",
281
+ children: /* @__PURE__ */ h(ee, {
282
+ isLoadingAI: P,
283
+ isLoadingFollowups: F,
284
+ isLoadingFavorite: je,
285
+ isFavorited: z,
286
+ isHighlightMode: V,
287
+ articleUrl: E?.url || T,
288
+ fontScale: K,
289
+ onAskClick: () => $("question"),
290
+ onSuggestClick: () => $("suggest-followups"),
291
+ onCopyClick: et,
292
+ onShareClick: tt,
293
+ onFavoriteClick: Ze,
294
+ onHighlightToggle: () => H(!V),
295
+ onZoomIn: Ke,
296
+ onZoomOut: qe,
297
+ onZoomReset: Je,
298
+ onClose: w
299
+ })
300
+ }),
301
+ /* @__PURE__ */ h("div", {
302
+ className: "shrink-0 px-4 pt-2",
303
+ children: /* @__PURE__ */ h(ne, {
304
+ value: J,
305
+ onValueChange: Ge,
306
+ idBase: Y
307
+ })
308
+ }),
309
+ /* @__PURE__ */ h("div", {
310
+ role: "tabpanel",
311
+ id: c(Y, "outline").panel,
312
+ "aria-labelledby": c(Y, "outline").tab,
313
+ hidden: J !== "outline",
314
+ className: "flex max-h-[40%] min-h-0 shrink-0 flex-col border-b border-border px-4",
315
+ children: J === "outline" && /* @__PURE__ */ h(ae, { items: ze })
316
+ }),
317
+ /* @__PURE__ */ h("div", {
318
+ ref: X,
319
+ className: "flex-1 overflow-y-auto",
320
+ children: /* @__PURE__ */ g("div", {
321
+ className: "p-4 space-y-6",
322
+ children: [/* @__PURE__ */ g("div", {
323
+ className: "space-y-4",
324
+ children: [
325
+ xe && /* @__PURE__ */ h("div", {
326
+ className: "bg-blue-500 text-white text-sm font-medium px-3 py-2 rounded-md shadow-lg",
327
+ children: "Copied!"
328
+ }),
329
+ Se && /* @__PURE__ */ h("div", {
330
+ className: "bg-blue-500 text-white text-sm font-medium px-3 py-2 rounded-md shadow-lg",
331
+ children: "Link copied!"
332
+ }),
333
+ /* @__PURE__ */ g("div", {
334
+ role: "tabpanel",
335
+ id: c(Y, "questions").panel,
336
+ "aria-labelledby": c(Y, "questions").tab,
337
+ hidden: J !== "questions",
338
+ className: "space-y-4",
339
+ children: [/* @__PURE__ */ h(s, {
340
+ value: j,
341
+ onChange: M,
342
+ onSubmit: () => $("question")
343
+ }), /* @__PURE__ */ h(ie, {
344
+ questions: Oe,
345
+ isLoading: F,
346
+ error: ke,
347
+ onQuestionClick: $e
348
+ })]
349
+ }),
350
+ O.length > 0 && /* @__PURE__ */ h("div", {
351
+ className: "space-y-4",
352
+ children: O.map((e, t) => /* @__PURE__ */ h("div", {
353
+ className: "space-y-2",
354
+ children: e.role === "user" ? /* @__PURE__ */ g("div", {
355
+ className: "bg-primary/10 border border-primary/20 rounded-lg p-3",
356
+ children: [/* @__PURE__ */ h("div", {
357
+ className: "text-xs font-semibold text-primary mb-1",
358
+ children: "Your Question"
359
+ }), /* @__PURE__ */ h("div", {
360
+ className: "text-sm text-foreground",
361
+ children: e.content
362
+ })]
363
+ }) : /* @__PURE__ */ g("div", {
364
+ className: "bg-muted rounded-lg shadow-md p-4",
365
+ children: [/* @__PURE__ */ h("div", {
366
+ className: "text-xs font-semibold text-muted-foreground mb-2",
367
+ children: "AI Response"
368
+ }), /* @__PURE__ */ h("div", {
369
+ className: "text-sm",
370
+ dangerouslySetInnerHTML: { __html: e.content }
371
+ })]
372
+ })
373
+ }, t))
374
+ }),
375
+ (P || I && O.length === 0) && /* @__PURE__ */ h(te, {
376
+ response: I,
377
+ isLoading: P,
378
+ error: L
379
+ }),
380
+ L && !P && /* @__PURE__ */ h("div", {
381
+ className: "bg-red-500 text-white p-2 rounded-md text-sm",
382
+ children: L
383
+ })
384
+ ]
385
+ }), E && /* @__PURE__ */ h(re, {
386
+ article: E,
387
+ isHighlightMode: V,
388
+ fontScale: K,
389
+ onOutlineChange: Be
390
+ })]
391
+ })
392
+ })
393
+ ]
394
+ });
395
+ return !C || !Le ? null : Ne ? /* @__PURE__ */ g("div", {
396
+ className: "fixed top-0 right-0 h-screen z-40 transition-all duration-300",
397
+ style: { width: `${Fe}px` },
398
+ children: [/* @__PURE__ */ h("div", {
399
+ ref: Ve,
400
+ onMouseDown: () => W(!0),
401
+ className: "absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-primary bg-transparent transition-colors z-50",
402
+ style: { touchAction: "none" },
403
+ children: /* @__PURE__ */ h("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" })
404
+ }), nt()]
405
+ }) : /* @__PURE__ */ h(r, {
406
+ open: C,
407
+ onOpenChange: (e) => !e && w(),
408
+ children: /* @__PURE__ */ g(t, {
409
+ 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",
410
+ hideCloseButton: !0,
411
+ children: [/* @__PURE__ */ h(b, { children: /* @__PURE__ */ h(e, { children: "Article Details" }) }), /* @__PURE__ */ h("div", {
412
+ className: "h-full overflow-y-auto",
413
+ children: nt()
414
+ })]
415
+ })
416
+ });
417
+ };
418
+ export { me as default };
@@ -1,6 +1,6 @@
1
1
  import { i as e, n as t, o as n, r, s as i, t as a } from "./dialog-Cufn2u50.js";
2
2
  import { a as o, c as s, n as c, r as l, t as u, u as d } from "./tooltip-Bl3IdX-I.js";
3
- import { G as f, J as p, K as m, Q as h, U as g, V as _, W as v, X as y, Y as b, Z as x, d as S, q as C, tt as w } from "./src-Cgy6IAES.js";
3
+ import { $ as f, G as p, J as m, Q as h, X as g, Y as _, Z as v, at as y, d as b, et as x, nt as S, q as C, tt as w } from "./src-Czo4Yrd2.js";
4
4
  import { researchAgentUIConfig as T } from "./config.mjs";
5
5
  import { Fragment as E, Suspense as D, lazy as O, memo as k, useCallback as A, useEffect as j, useMemo as M, useRef as N, useState as P } from "react";
6
6
  import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
@@ -107,7 +107,7 @@ function Ce(e) {
107
107
  };
108
108
  }
109
109
  // src/components/SearchResults/MessageSources.tsx
110
- var we = p.filter((e) => [
110
+ var we = h.filter((e) => [
111
111
  "general",
112
112
  "news",
113
113
  "videos",
@@ -804,7 +804,7 @@ var Ve = ({ messageId: e }) => {
804
804
  if (t) return t.name;
805
805
  }
806
806
  return r.key;
807
- }, [a, r.key]), y = (n, r) => {
807
+ }, [a, r.key]), b = (n, r) => {
808
808
  i({
809
809
  providerId: n,
810
810
  key: r
@@ -851,7 +851,7 @@ var Ve = ({ messageId: e }) => {
851
851
  className: "max-h-[320px] overflow-y-auto",
852
852
  children: s ? /* @__PURE__ */ I("div", {
853
853
  className: "flex items-center justify-center py-12",
854
- children: /* @__PURE__ */ I(w.Loader2, {
854
+ children: /* @__PURE__ */ I(y.Loader2, {
855
855
  className: "animate-spin text-text-400 dark:text-[#999999]",
856
856
  size: 20
857
857
  })
@@ -871,7 +871,7 @@ var Ve = ({ messageId: e }) => {
871
871
  /* @__PURE__ */ I("div", {
872
872
  className: "flex flex-col px-1.5 py-1.5 space-y-0.5",
873
873
  children: e.chatModels.map((t) => /* @__PURE__ */ L("button", {
874
- onClick: () => y(e.id, t.key),
874
+ onClick: () => b(e.id, t.key),
875
875
  type: "button",
876
876
  className: n("px-3 py-2 flex items-center justify-between text-start duration-200 cursor-pointer transition rounded-xl group", r?.providerId === e.id && r?.key === t.key ? "bg-sky-50 dark:bg-sky-500/10" : "hover:bg-bg-100 dark:hover:bg-[#30302E]"),
877
877
  children: [/* @__PURE__ */ L("div", {
@@ -883,7 +883,7 @@ var Ve = ({ messageId: e }) => {
883
883
  className: n("text-[13px] truncate", r?.providerId === e.id && r?.key === t.key ? "text-sky-600 dark:text-sky-400 font-medium" : "text-text-200 dark:text-[#ECECEC] group-hover:text-text-100 dark:group-hover:text-white"),
884
884
  children: t.name
885
885
  })]
886
- }), r?.providerId === e.id && r?.key === t.key && /* @__PURE__ */ I(w.Check, { className: "w-4 h-4 text-sky-500 shrink-0" })]
886
+ }), r?.providerId === e.id && r?.key === t.key && /* @__PURE__ */ I(y.Check, { className: "w-4 h-4 text-sky-500 shrink-0" })]
887
887
  }, t.key))
888
888
  }),
889
889
  t < _.length - 1 && /* @__PURE__ */ I("div", { className: "h-px bg-[#EEEEEE] dark:bg-[#30302E] mx-2" })
@@ -920,9 +920,9 @@ var Ve = ({ messageId: e }) => {
920
920
  side: "bottom",
921
921
  children: n ? "Loading TTS..." : t === "started" ? "Stop" : "Read aloud"
922
922
  })] }),
923
- /* @__PURE__ */ L(b, { children: [/* @__PURE__ */ L(u, { children: [/* @__PURE__ */ I(l, {
923
+ /* @__PURE__ */ L(f, { children: [/* @__PURE__ */ L(u, { children: [/* @__PURE__ */ I(l, {
924
924
  asChild: !0,
925
- children: /* @__PURE__ */ I(h, {
925
+ children: /* @__PURE__ */ I(S, {
926
926
  asChild: !0,
927
927
  children: /* @__PURE__ */ I("button", {
928
928
  className: "p-2 text-muted-foreground rounded-full backdrop-blur-md bg-white/10 dark:bg-black/10 hover:bg-white/20 dark:hover:bg-black/20 transition duration-200 hover:text-foreground",
@@ -932,31 +932,31 @@ var Ve = ({ messageId: e }) => {
932
932
  }), /* @__PURE__ */ I(c, {
933
933
  side: "bottom",
934
934
  children: "Export"
935
- })] }), /* @__PURE__ */ L(y, {
935
+ })] }), /* @__PURE__ */ L(x, {
936
936
  align: "end",
937
937
  side: "top",
938
938
  children: [
939
- /* @__PURE__ */ L(x, {
940
- onClick: () => f(e.userMessage.content, e.assistantMessage.content),
939
+ /* @__PURE__ */ L(w, {
940
+ onClick: () => _(e.userMessage.content, e.assistantMessage.content),
941
941
  children: [/* @__PURE__ */ I(K, { size: 16 }), "Markdown"]
942
942
  }),
943
- /* @__PURE__ */ L(x, {
944
- onClick: () => m(e.userMessage.content, e.assistantMessage.content),
943
+ /* @__PURE__ */ L(w, {
944
+ onClick: () => g(e.userMessage.content, e.assistantMessage.content),
945
945
  children: [/* @__PURE__ */ I(oe, { size: 16 }), "PDF"]
946
946
  }),
947
- /* @__PURE__ */ L(x, {
948
- onClick: () => v(e.userMessage.content, e.assistantMessage.content),
947
+ /* @__PURE__ */ L(w, {
948
+ onClick: () => m(e.userMessage.content, e.assistantMessage.content),
949
949
  children: [/* @__PURE__ */ I(ie, { size: 16 }), "DOCX"]
950
950
  }),
951
- /* @__PURE__ */ L(x, {
952
- onClick: () => C(e.userMessage.content, e.assistantMessage.content),
951
+ /* @__PURE__ */ L(w, {
952
+ onClick: () => v(e.userMessage.content, e.assistantMessage.content),
953
953
  children: [/* @__PURE__ */ I(ae, { size: 16 }), "Google Docs"]
954
954
  })
955
955
  ]
956
956
  })] }),
957
- /* @__PURE__ */ L(b, { children: [/* @__PURE__ */ L(u, { children: [/* @__PURE__ */ I(l, {
957
+ /* @__PURE__ */ L(f, { children: [/* @__PURE__ */ L(u, { children: [/* @__PURE__ */ I(l, {
958
958
  asChild: !0,
959
- children: /* @__PURE__ */ I(h, {
959
+ children: /* @__PURE__ */ I(S, {
960
960
  asChild: !0,
961
961
  children: /* @__PURE__ */ I("button", {
962
962
  className: "p-2 text-muted-foreground rounded-full backdrop-blur-md bg-white/10 dark:bg-black/10 hover:bg-white/20 dark:hover:bg-black/20 transition duration-200 hover:text-foreground",
@@ -966,27 +966,27 @@ var Ve = ({ messageId: e }) => {
966
966
  }), /* @__PURE__ */ I(c, {
967
967
  side: "bottom",
968
968
  children: "Open in LLM"
969
- })] }), /* @__PURE__ */ L(y, {
969
+ })] }), /* @__PURE__ */ L(x, {
970
970
  align: "end",
971
971
  side: "top",
972
972
  children: [
973
- /* @__PURE__ */ I(x, {
973
+ /* @__PURE__ */ I(w, {
974
974
  onClick: () => a("qwksearch"),
975
975
  children: "QwkSearch"
976
976
  }),
977
- /* @__PURE__ */ I(x, {
977
+ /* @__PURE__ */ I(w, {
978
978
  onClick: () => a("claude"),
979
979
  children: "Claude"
980
980
  }),
981
- /* @__PURE__ */ I(x, {
981
+ /* @__PURE__ */ I(w, {
982
982
  onClick: () => a("perplexity"),
983
983
  children: "Perplexity"
984
984
  }),
985
- /* @__PURE__ */ I(x, {
985
+ /* @__PURE__ */ I(w, {
986
986
  onClick: () => a("gemini"),
987
987
  children: "Google Gemini"
988
988
  }),
989
- /* @__PURE__ */ I(x, {
989
+ /* @__PURE__ */ I(w, {
990
990
  onClick: () => a("chatgpt"),
991
991
  children: "ChatGPT"
992
992
  })
@@ -1016,7 +1016,7 @@ var Ve = ({ messageId: e }) => {
1016
1016
  children: /* @__PURE__ */ L("div", {
1017
1017
  className: "flex items-center gap-3",
1018
1018
  children: [
1019
- /* @__PURE__ */ I(_, {
1019
+ /* @__PURE__ */ I(p, {
1020
1020
  variant: "secondary",
1021
1021
  className: "flex-shrink-0 h-6 w-6 p-0 flex items-center justify-center rounded-full text-sm font-semibold",
1022
1022
  children: t + 1
@@ -1039,7 +1039,7 @@ var Ve = ({ messageId: e }) => {
1039
1039
  navigator.clipboard.writeText(e.userMessage.content), l(!0), setTimeout(() => l(!1), 1500);
1040
1040
  }, g = () => {
1041
1041
  p.trim() && (a(p.trim()), f(!1));
1042
- }, _ = e.parsedAssistantMessage || "", v = e.speechMessage || "", y = e.thinkingEnded, { speechStatus: b, start: x, stop: C, isLoading: w } = S(v, { enableInterrupt: !0 }), T = (t) => {
1042
+ }, _ = e.parsedAssistantMessage || "", v = e.speechMessage || "", y = e.thinkingEnded, { speechStatus: x, start: S, stop: C, isLoading: w } = b(v, { enableInterrupt: !0 }), T = (t) => {
1043
1043
  if (!e.assistantMessage) return;
1044
1044
  let n = `${e.userMessage.content}\n\n${e.assistantMessage.content}`;
1045
1045
  navigator.clipboard.writeText(n);
@@ -1109,9 +1109,9 @@ var Ve = ({ messageId: e }) => {
1109
1109
  }),
1110
1110
  i && r ? null : /* @__PURE__ */ I(He, {
1111
1111
  section: e,
1112
- speechStatus: b,
1112
+ speechStatus: x,
1113
1113
  isLoadingTTS: w,
1114
- start: x,
1114
+ start: S,
1115
1115
  stop: C,
1116
1116
  handleOpenInLLM: T
1117
1117
  }),
@@ -1378,26 +1378,26 @@ var it = ({ size: e = 140, className: t }) => {
1378
1378
  dangerouslySetInnerHTML: { __html: rt(r, e) }
1379
1379
  }) : null
1380
1380
  });
1381
- }, at = O(() => import("./ArticleExtractPanel-B6tyR_bs.js")), ot = () => {
1381
+ }, at = O(() => import("./ArticleExtractPanel-Dce2hQz6.js")), ot = () => {
1382
1382
  let { sections: e, chatTurns: t, loading: n, messageAppeared: r, newChat: i, chatId: a } = d(), { isOpen: c, panelWidth: l } = o(), { isAuthenticated: u } = s(), [f, p] = P(!1);
1383
1383
  j(() => {
1384
1384
  c && p(!0);
1385
1385
  }, [c]);
1386
- let [m, h] = P(!1), _ = N(null), v = N(null), y = N(!1);
1386
+ let [m, h] = P(!1), g = N(null), _ = N(null), v = N(!1);
1387
1387
  j(() => {
1388
1388
  let e = () => {
1389
1389
  h(window.innerWidth >= 1024);
1390
1390
  };
1391
1391
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
1392
1392
  }, []), j(() => {
1393
- t.length === 1 && (document.title = `${t[0].content.substring(0, 30)} - ${T.appName}`), t[t.length - 1]?.role === "user" && (y.current = !0, v.current?.scrollIntoView({ behavior: "auto" }), setTimeout(() => {
1394
- y.current = !1;
1393
+ t.length === 1 && (document.title = `${t[0].content.substring(0, 30)} - ${T.appName}`), t[t.length - 1]?.role === "user" && (v.current = !0, _.current?.scrollIntoView({ behavior: "auto" }), setTimeout(() => {
1394
+ v.current = !1;
1395
1395
  }, 100));
1396
1396
  }, [t]);
1397
- let b = m && c ? { width: `calc(100% - ${l}px)` } : {};
1397
+ let y = m && c ? { width: `calc(100% - ${l}px)` } : {};
1398
1398
  return /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ L("div", {
1399
1399
  className: "flex flex-col min-h-full transition-all duration-300",
1400
- style: b,
1400
+ style: y,
1401
1401
  children: [/* @__PURE__ */ L("div", {
1402
1402
  className: `flex-1 flex flex-col space-y-3 pb-48 ${m && !c ? "px-0 max-w-[800px] mx-auto w-full" : "px-4 lg:px-8"}`,
1403
1403
  children: [
@@ -1406,19 +1406,19 @@ var it = ({ size: e = 140, className: t }) => {
1406
1406
  return /* @__PURE__ */ L(E, { children: [/* @__PURE__ */ I(We, {
1407
1407
  section: t,
1408
1408
  sectionIndex: n,
1409
- dividerRef: r ? _ : void 0,
1409
+ dividerRef: r ? g : void 0,
1410
1410
  isLast: r
1411
1411
  }), !r && /* @__PURE__ */ I("div", { className: "h-px w-full bg-light-secondary dark:bg-dark-secondary" })] }, t.userMessage.messageId);
1412
1412
  }),
1413
1413
  n && !r && /* @__PURE__ */ I(it, {}),
1414
1414
  /* @__PURE__ */ I("div", {
1415
- ref: v,
1415
+ ref: _,
1416
1416
  className: "h-0"
1417
1417
  })
1418
1418
  ]
1419
1419
  }), /* @__PURE__ */ I("div", {
1420
1420
  className: "sticky bottom-[60px] md:bottom-0 z-40 bg-gradient-to-t from-background via-background to-transparent pt-4 pb-2",
1421
- children: /* @__PURE__ */ I(g, {})
1421
+ children: /* @__PURE__ */ I(C, {})
1422
1422
  })]
1423
1423
  }), (f || c) && /* @__PURE__ */ I(D, {
1424
1424
  fallback: null,