@filigran/chatbot 3.1.0 → 3.2.1
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.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +13 -12
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useState as r,useRef as a,useEffect as o,useCallback as s}from"react";import{createPortal as i}from"react-dom";import l from"react-markdown";import c from"remark-gfm";function d(e,t){return`${e}${Math.round(255*t).toString(16).padStart(2,"0")}`}const h=e=>e;function g(e,t){const n=e.event;if("nextAgentFlow"===n){const n=e.data,r=n?.nodeId;return"INPROGRESS"===n?.status&&r&&(t.activeNodeId=r),{action:"noop"}}if("start"===n)return{action:"noop"};if("token"===n){return{action:"stream",content:(e.data??"").replace(/<br\s*\/?>/g,"\n")}}if("agentReasoning"===n){const n=e.data,r=n?.usedTools;return r?.length?(t.hasUsedTools=!0,{action:"status",status:"tool_start",tools:r.map(e=>e.tool)}):t.hasUsedTools?{action:"status",status:"analyzing"}:{action:"status",status:"thinking"}}if("usedTools"===n){t.hasUsedTools=!0;const n=e.data;return{action:"status",status:"tool_start",tools:Array.isArray(n)?n.map(e=>e.tool):[]}}if("metadata"===n){const t=e.data,n=t?.chatId;return n?{action:"set_chat_id",chatId:n}:{action:"noop"}}return"error"===n?{action:"error",content:e.data||""}:"end"===n?{action:"done",content:""}:{action:"noop"}}function u(e,t){const n=e.type;if("error"===n)return{action:"error",content:e.content||""};if("status"===n){const n=e.status;return"tool_done"===n||"wind_down"===n?{action:"noop"}:"streaming"===n?{action:"status",status:"streaming"}:"thinking_text"===n?{action:"status",status:"thinking_text",thinkingContent:e.content}:"tool_start"===n?(t.hasUsedTools=!0,{action:"status",status:"tool_start",tools:e.tools}):"thinking"===n&&t.hasUsedTools?{action:"status",status:"analyzing"}:{action:"status",status:n,tools:e.tools}}return"stream"===n?{action:"stream",content:e.content}:"done"===n?{action:"done",content:e.content,conversationId:e.conversation_id,toolNames:e.tool_names,toolCallCount:e.tool_call_count,iterations:e.iterations,transferAgentId:e.transfer_agent_id,transferAgentName:e.transfer_agent_name}:{action:"noop"}}function m(e,t){const n=e.type;if("RUN_STARTED"===n)return{action:"status",status:"thinking"};if("RUN_FINISHED"===n)return{action:"done",content:""};if("RUN_ERROR"===n)return{action:"error",content:e.message||"Unknown error"};if("STEP_STARTED"===n){return{action:"status",status:e.stepName||"thinking"}}if("STEP_FINISHED"===n)return{action:"noop"};if("TEXT_MESSAGE_START"===n)return{action:"status",status:"streaming"};if("TEXT_MESSAGE_CONTENT"===n){const t=e.delta;return t?{action:"stream",content:t}:{action:"noop"}}if("TEXT_MESSAGE_END"===n)return{action:"noop"};if("TEXT_MESSAGE_CHUNK"===n){const t=e.delta;return t?{action:"stream",content:t}:{action:"noop"}}if("TOOL_CALL_START"===n){t.hasUsedTools=!0;const n=e.toolCallName;return{action:"status",status:"tool_start",tools:n?[n]:[]}}if("TOOL_CALL_ARGS"===n)return{action:"noop"};if("TOOL_CALL_END"===n)return{action:"status",status:"analyzing"};if("TOOL_CALL_RESULT"===n)return{action:"noop"};if("TOOL_CALL_CHUNK"===n){const n=e.toolCallName;return n?(t.hasUsedTools=!0,{action:"status",status:"tool_start",tools:[n]}):{action:"noop"}}return"REASONING_START"===n||"REASONING_MESSAGE_START"===n||"REASONING_MESSAGE_CONTENT"===n||"REASONING_MESSAGE_CHUNK"===n?{action:"status",status:"thinking"}:{action:"noop"}}const p="filigranChatConversationId",w="filigranChatLegacyChatId";function x({apiBaseUrl:e,apiEndpoints:t,backendType:n="rest",agentSlug:o,t:s}){const i="legacy"===n,[l,c]=r([]),[d,h]=r(""),[x,f]=r(!1),[b,k]=r(null),[v,y]=r(()=>"undefined"==typeof window?null:localStorage.getItem(p)),[N,C]=r([]),[S,_]=r(null),[L,I]=r(()=>"undefined"==typeof window?null:localStorage.getItem(w)),M=a(!1),z=a(null),A=a(!1),T=e=>{if(!e)return;const t=[];Array.from(e).forEach(n=>{const r=new FileReader;r.onload=()=>{t.push({name:n.name,type:n.type,size:n.size,dataUrl:r.result}),t.length===e.length&&C(e=>[...e,...t])},r.readAsDataURL(n)})};return{messages:l,inputValue:d,setInputValue:h,isLoading:x,agentStatus:b,attachedFiles:N,conversationId:v,transferredAgent:S,historyLoadedRef:M,handleFileAdd:T,handlePaste:e=>{const{files:t}=e.clipboardData;t.length>0&&(e.preventDefault(),T(t))},handleSendMessage:async()=>{if(!d.trim()&&0===N.length||x)return;const r=d.trim(),a={id:crypto.randomUUID(),role:"user",content:r,timestamp:new Date,files:N.length>0?[...N]:void 0};c(e=>[...e,a]),h(""),C([]),f(!0),k({status:"thinking"}),A.current=!1;const l=crypto.randomUUID();c(e=>[...e,{id:l,role:"assistant",content:"",timestamp:new Date}]);try{const a=new AbortController;z.current=a;const d=function(e,t,n){switch(e){case"legacy":return{question:t,chatId:n.legacyChatId??void 0,streaming:!0};case"ag-ui":return{threadId:n.conversationId??crypto.randomUUID(),runId:crypto.randomUUID(),messages:[{id:crypto.randomUUID(),role:"user",content:t}],tools:[],context:[],state:{},forwardedProps:n.agentSlug?{agentSlug:n.agentSlug}:{}};default:return{content:t,conversation_id:n.conversationId,agent_slug:n.agentSlug}}}(n,r,{legacyChatId:L,conversationId:v,agentSlug:o}),h=await fetch(i||t?.singleEndpoint?e:`${e}${t?.messages??"/chat/messages"}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d),signal:a.signal});if(!h.ok||!h.body)return void c(e=>e.map(e=>e.id===l?{...e,content:s("Unable to connect. Please check the configuration.")}:e));const x=function(e){switch(e){case"legacy":return g;case"ag-ui":return m;default:return u}}(n),f={hasUsedTools:!1,activeNodeId:""},b=h.body.getReader(),N=new TextDecoder;let C="",S="",M=!1;for(;;){const{done:e,value:t}=await b.read();if(e)break;C+=N.decode(t,{stream:!0});const n=C.split("\n");C=n.pop()||"";for(const e of n){const t=e.replace(/\r$/,"");if(!t.startsWith("data:"))continue;const n=t.startsWith("data: ")?t.slice(6):t.slice(5);try{const e=x(JSON.parse(n),f);switch(f.hasUsedTools=f.hasUsedTools||A.current,e.action){case"status":"tool_start"===e.status&&(A.current=!0),"thinking_text"===e.status?k(t=>({...t,status:t?.status??"thinking",thinkingContent:(t?.thinkingContent??"")+(e.thinkingContent??"")})):k(t=>({status:e.status,tools:e.tools,thinkingContent:t?.thinkingContent}));break;case"stream":S+=e.content,k(e=>({status:"streaming",thinkingContent:e?.thinkingContent})),c(e=>e.map(e=>e.id===l?{...e,content:S}:e));break;case"done":M=!0,e.conversationId&&(y(e.conversationId),localStorage.setItem(p,e.conversationId)),e.transferAgentId&&e.transferAgentName&&_({id:e.transferAgentId,name:e.transferAgentName}),c(t=>t.map(t=>t.id===l?{...t,content:e.content||S,toolNames:e.toolNames,toolCallCount:e.toolCallCount,iterations:e.iterations}:t));break;case"error":return void c(t=>t.map(t=>t.id===l?{...t,content:e.content||s("Unable to connect. Please check the configuration.")}:t));case"set_chat_id":I(e.chatId),localStorage.setItem(w,e.chatId)}A.current=f.hasUsedTools}catch{}}}S&&!M&&c(e=>e.map(e=>e.id===l?{...e,content:S||"No response."}:e))}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;c(e=>e.map(e=>e.id===l?{...e,content:s("Sorry, an error occurred. Please try again.")}:e))}finally{z.current=null,f(!1),k(null),A.current=!1}},handleNewChat:()=>{z.current?.abort(),z.current=null,c([]),h(""),C([]),f(!1),k(null),_(null),A.current=!1,M.current=!1,i?(I(null),localStorage.removeItem(w)):(y(null),localStorage.removeItem(p))},handleStopGenerating:()=>{z.current?.abort(),z.current=null,f(!1),k(null),A.current=!1,c(e=>e.filter(e=>!("assistant"===e.role&&!e.content)))},setAttachedFiles:C,setMessages:c,setConversationId:y}}const f="filigranChatAgentSlug";const b=400,k="filigranChatSidebarWidth";const v=({className:t,size:n=24})=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e("path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),y=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"}),e("path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"}),e("path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"}),e("path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375"}),e("path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5"}),e("path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396"}),e("path",{d:"M19.938 10.5a4 4 0 0 1 .585.396"}),e("path",{d:"M6 18a4 4 0 0 1-1.967-.516"}),e("path",{d:"M19.967 17.484A4 4 0 0 1 18 18"})]}),N=({className:t,size:n=24})=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e("path",{d:"M20 6 9 17l-5-5"})}),C=({className:t,size:n=24})=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e("path",{d:"m6 9 6 6 6-6"})}),S=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"M18 6 6 18"}),e("path",{d:"m6 6 12 12"})]}),_=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),e("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]}),L=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),e("path",{d:"M3 5V19A9 3 0 0 0 21 19V5"}),e("path",{d:"M3 12A9 3 0 0 0 21 12"})]}),I=({className:t,size:n=24})=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",className:t,children:e("path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"})}),M=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"M12 20h9"}),e("path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z"})]}),z=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"M15 3h6v6"}),e("path",{d:"M10 14 21 3"}),e("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]}),A=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),e("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"})]}),T=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"M11 13H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7"}),e("rect",{width:"12",height:"12",x:"10",y:"10",rx:"2"})]}),E=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}),e("path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}),e("path",{d:"M3 16h3a2 2 0 0 0 2 2v3"}),e("path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"})]}),$=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}),e("path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}),e("path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}),e("path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"})]}),R=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),e("path",{d:"M2 12h20"})]}),D=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("path",{d:"M12 16v-4"}),e("path",{d:"M12 8h.01"})]}),U=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),e("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),j=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("circle",{cx:"11",cy:"11",r:"8"}),e("path",{d:"m21 21-4.3-4.3"})]}),W=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"m22 2-7 20-4-9-9-4Z"}),e("path",{d:"m22 2-11 11"})]}),O=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),e("path",{d:"M15 3v18"})]}),B=({className:t,size:n=24})=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e("path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"})}),F=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("rect",{width:"6",height:"6",x:"9",y:"9"})]}),P=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("polyline",{points:"4 17 10 11 4 5"}),e("line",{x1:"12",x2:"20",y1:"19",y2:"19"})]}),G=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e("circle",{cx:"9",cy:"7",r:"4"}),e("line",{x1:"19",x2:"19",y1:"8",y2:"14"}),e("line",{x1:"22",x2:"16",y1:"11",y2:"11"})]}),H=({className:t,size:n=24})=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})});const V=({open:t,onClose:n,anchorRef:l,placement:c="bottom-start",width:d=280,children:h})=>{const g=a(null),[u,m]=r({top:0,left:0});if(function(e,t,n=!0){o(()=>{if(!n)return;const r=n=>{e.current&&!e.current.contains(n.target)&&t()};return document.addEventListener("mousedown",r),document.addEventListener("touchstart",r),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("touchstart",r)}},[e,t,n])}(g,s(()=>n(),[n]),t),o(()=>{if(!t||!l.current)return;const e=l.current.getBoundingClientRect(),n="bottom-end"===c?e.right-d:e.left;m({top:e.bottom+4,left:n})},[t,l,c,d]),!t)return null;const p=function(e){let t=e;for(;t;){if(t.classList.contains("filigran-chatbot"))return t;t=t.parentElement}return document.body}(l.current);return i(e("div",{ref:g,className:"fixed z-[10000] rounded-[10px] overflow-hidden border border-gray-200 dark:border-white/10 bg-white dark:bg-[#2a2a3e] shadow-xl",style:{top:u.top,left:u.left,width:d},children:h}),p)},q=({size:t=16,className:n=""})=>e("div",{className:`animate-spin rounded-full border-2 border-current/20 border-t-[var(--chat-accent)] ${n}`,style:{width:t,height:t}});function K(e){let t=e;for(;t;){if(t.classList.contains("filigran-chatbot"))return t;t=t.parentElement}return document.body}const X=({title:n,children:o})=>{const s=a(null),[l,c]=r(!1),[d,h]=r({top:0,left:0});if(!n)return o;return t("span",{ref:s,className:"inline-flex",onMouseEnter:()=>{if(!s.current)return;const e=s.current.getBoundingClientRect();h({top:e.top-4,left:e.left+e.width/2}),c(!0)},onMouseLeave:()=>c(!1),children:[o,l&&i(e("span",{className:"pointer-events-none fixed z-[10001] -translate-x-1/2 -translate-y-full whitespace-nowrap rounded-md bg-gray-900 dark:bg-gray-100 px-2 py-1 text-xs text-white dark:text-gray-900 shadow-lg",style:{top:d.top,left:d.left},role:"tooltip",children:n}),K(s.current))]})},Z=[{mode:"floating",label:"Floating",getIcon:t=>e(T,{...t})},{mode:"sidebar",label:"Sidebar",getIcon:t=>e(O,{...t})},{mode:"fullscreen",label:"Full screen",getIcon:t=>e($,{...t})}],J=({mode:n,agentName:r,agents:o,selectedAgent:s,transferredFrom:i,agentMenuOpen:l,onAgentMenuToggle:c,onAgentMenuClose:d,onSwitchAgent:h,modeMenuOpen:g,onModeMenuToggle:u,onModeMenuClose:m,onModeChange:p,onNewChat:w,onClose:x,logoIcon:f,agentDashboardUrl:b,t:k})=>{const v=a(null),y=a(null),N="sidebar"===n?O:"fullscreen"===n?E:T;return t("div",{className:"flex items-center px-3 py-2 min-h-[48px] border-b border-gray-200 dark:border-white/10 bg-gradient-to-br from-[var(--chat-accent-dark)]/[0.13] to-[var(--chat-accent)]/[0.07] "+("floating"===n?"rounded-t-xl":""),children:[t("button",{ref:v,type:"button",onClick:c,className:"flex items-center gap-1.5 text-sm font-semibold text-gray-900 dark:text-white px-2 py-1 rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 transition-colors",children:[e("span",{className:"flex items-center text-[var(--chat-accent)] [&>svg]:w-[18px] [&>svg]:h-[18px]",children:f}),t("span",{className:"flex flex-col items-start leading-tight",children:[e("span",{children:r}),i&&t("span",{className:"text-[0.6rem] font-normal text-gray-400 dark:text-white/30",children:[k("Transferred from")," ",i]})]}),e(C,{size:16,className:"text-gray-400 dark:text-white/30"})]}),t(V,{open:l,onClose:d,anchorRef:v,width:280,children:[e("span",{className:"block px-4 pt-3 pb-1 text-[0.68rem] tracking-[1px] uppercase text-gray-400 dark:text-white/40",children:k("Switch to another agent")}),0===o.length&&e("div",{className:"px-4 py-2",children:e(q,{size:16})}),e("div",{children:o.map(n=>t("button",{type:"button",onClick:()=>h(n),className:"w-full flex items-center gap-2 px-4 py-1.5 text-left hover:bg-gray-100 dark:hover:bg-white/10 transition-colors "+(n.id===s?.id?"bg-[var(--chat-accent)]/10":""),children:[e("div",{className:"w-7 h-7 rounded-full flex items-center justify-center shrink-0 bg-gradient-to-br from-[var(--chat-accent)]/20 to-[var(--chat-accent)]/5",children:e("span",{className:"text-[var(--chat-accent)] [&>svg]:w-4 [&>svg]:h-4",children:f})}),t("div",{className:"min-w-0",children:[e("div",{className:"text-[0.8125rem] font-medium text-gray-900 dark:text-white truncate",children:n.name}),n.description&&e("div",{className:"text-[0.7rem] text-gray-500 dark:text-white/40 truncate",children:n.description})]})]},n.id))}),e("div",{className:"h-px bg-gray-200 dark:bg-white/10 mx-2"}),t("div",{children:[b&&t("button",{type:"button",onClick:()=>{d(),window.open(`${b}/agents`,"_blank")},className:"w-full flex items-center gap-2 px-4 py-1.5 text-left hover:bg-gray-100 dark:hover:bg-white/10 transition-colors",children:[e(z,{size:18,className:"text-gray-400 dark:text-white/40 shrink-0"}),e("span",{className:"text-[0.8125rem] text-gray-700 dark:text-white/70",children:k("Browse agents")})]}),b&&t("button",{type:"button",onClick:()=>{d(),window.open(`${b}/agents/new`,"_blank")},className:"w-full flex items-center gap-2 px-4 py-1.5 text-left hover:bg-gray-100 dark:hover:bg-white/10 transition-colors",children:[e(G,{size:18,className:"text-gray-400 dark:text-white/40 shrink-0"}),e("span",{className:"text-[0.8125rem] text-gray-700 dark:text-white/70",children:k("Create agent")})]})]})]}),e("div",{className:"flex-1"}),e(X,{title:k("New chat"),children:e("button",{type:"button",onClick:w,className:"w-8 h-8 flex items-center justify-center rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-white/40 hover:text-gray-700 dark:hover:text-white/70 transition-colors",children:e(M,{size:18})})}),e(X,{title:k("Switch view"),children:e("button",{ref:y,type:"button",onClick:u,className:"w-8 h-8 flex items-center justify-center rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-white/40 hover:text-gray-700 dark:hover:text-white/70 transition-colors",children:e(N,{size:18})})}),t(V,{open:g,onClose:m,anchorRef:y,placement:"bottom-end",width:180,children:[e("span",{className:"block px-4 pt-3 pb-1 text-[0.68rem] tracking-[1px] uppercase text-gray-400 dark:text-white/40",children:k("Switch to")}),e("div",{className:"pb-1",children:Z.map(r=>t("button",{type:"button",onClick:()=>{p(r.mode),m()},className:"w-full flex items-center gap-3 px-4 py-1 text-left hover:bg-gray-100 dark:hover:bg-white/10 transition-colors "+(n===r.mode?"bg-[var(--chat-accent)]/10":""),children:[r.getIcon({size:18,className:"text-gray-400 dark:text-white/40"}),e("span",{className:"text-[0.8125rem] text-gray-700 dark:text-white/70",children:k(r.label)})]},r.mode))})]}),e(X,{title:k("Close"),children:e("button",{type:"button",onClick:x,className:"w-8 h-8 flex items-center justify-center rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-white/40 hover:text-gray-700 dark:hover:text-white/70 transition-colors",children:e(S,{size:18})})})]})},Q=({inputValue:n,onInputChange:r,onSend:o,onStop:s,isLoading:i,attachedFiles:l,onFileAdd:c,onFileRemove:d,onPaste:h,t:g,mode:u})=>{const m=a(null),p=a(null),w=n.trim()||l.length>0;return t("div",{className:"px-4 py-3 border-t border-gray-200 dark:border-white/10 "+("floating"===u?"rounded-b-xl":""),children:[l.length>0&&e("div",{className:"flex gap-1.5 flex-wrap mb-2",children:l.map((n,r)=>t("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-gray-200 dark:border-white/10 text-[0.7rem] text-gray-600 dark:text-white/60",children:[e(A,{size:14}),n.name,e("button",{type:"button",onClick:()=>d(r),className:"ml-0.5 text-gray-400 dark:text-white/30 hover:text-gray-600 dark:hover:text-white/60",children:"×"})]},r))}),t("div",{className:"flex items-center border border-gray-200 dark:border-white/10 rounded-xl px-2 py-1 transition-colors focus-within:border-[var(--chat-accent)]",children:[e("input",{ref:m,type:"file",multiple:!0,hidden:!0,onChange:e=>{c(e.target.files),e.target.value=""}}),e("button",{type:"button",onClick:()=>m.current?.click(),className:"w-8 h-8 flex items-center justify-center shrink-0 rounded-lg text-gray-400 dark:text-white/30 hover:bg-gray-100 dark:hover:bg-white/10 mr-0.5 transition-colors",children:e(v,{size:18})}),e("textarea",{ref:p,placeholder:g("Ask a question..."),value:n,onChange:e=>{r(e.target.value);const t=e.target;t.style.height="auto",t.style.height=`${Math.min(t.scrollHeight,120)}px`},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),o())},onPaste:h,rows:1,className:"flex-1 bg-transparent border-none outline-none resize-none text-[0.8125rem] py-1.5 text-gray-900 dark:text-white placeholder:text-gray-400 dark:placeholder:text-white/30 filigran-chat-scrollable",style:{maxHeight:120}}),e(X,{title:i?g("Stop generating"):"",children:e("button",{type:"button",onClick:i?s:o,disabled:!i&&!w,className:"p-1.5 rounded-lg w-8 h-8 flex items-center justify-center transition-all duration-150 "+(i?"text-red-500 bg-red-500/10 hover:bg-red-500/20":w?"text-[var(--chat-accent)] bg-[var(--chat-accent)]/10 hover:bg-[var(--chat-accent)]/20":"text-gray-300 dark:text-white/20 cursor-not-allowed"),children:e(i?F:W,{size:18})})})]}),e("p",{className:"text-center text-[0.65rem] text-gray-400 dark:text-white/30 mt-1.5 opacity-70",children:g("Uses AI. Verify results.")})]})};function Y({content:n}){const r=a(null),s=n.replace(/```[\s\S]*?```/g," ").replace(/`([^`]+)`/g,"$1").replace(/\*\*(.+?)\*\*/g,"$1").replace(/__(.+?)__/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/_(.+?)_/g,"$1").replace(/#{1,6}\s+/g,"").replace(/[*\->]+/g," ").replace(/\s+/g," ").trim();return o(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[s]),s.length<3?null:t("div",{ref:r,className:"ml-11 max-w-[70%] max-h-20 overflow-hidden relative rounded-md border-l-2 bg-[var(--chat-accent)]/[0.03] pl-3 pr-3 py-2",style:{animation:"reasoningGlow 3s ease-in-out infinite, chat-fade-in 0.5s ease-out"},children:[e("p",{className:"text-[13px] leading-[1.35rem] text-gray-400 dark:text-white/40 break-words m-0",children:s}),e("div",{className:"absolute inset-x-0 bottom-0 h-5 bg-gradient-to-t from-white/90 dark:from-[#1e1e2e]/90 to-transparent pointer-events-none"})]})}const ee=({agentStatus:r,logoIcon:a,t:o})=>{const{label:s,StatusIcon:i,showDots:l}=function(e,t){if(!e)return{label:t("Thinking..."),StatusIcon:y,showDots:!1};switch(e.status){case"tool_start":{const n=e.tools??[],r=n.map(e=>e.toLowerCase());if(r.some(e=>"spawn_background_task"===e)){const e=n.filter(e=>"spawn_background_task"===e).length;return{label:e>1?`${t("Delegating")} ${e} ${t("tasks")}…`:`${t("Delegating task")}…`,StatusIcon:G,showDots:!1}}if(r.some(e=>"check_task_status"===e)){const e=n.filter(e=>"check_task_status"===e).length,r=e>1?`${e} ${t("background tasks")}`:t("background task");return{label:`${t("Waiting for")} ${r}…`,StatusIcon:B,showDots:!1}}if(r.some(e=>"get_task_result"===e)){const e=n.filter(e=>"get_task_result"===e).length,r=e>1?`${e} ${t("tasks")}`:t("task");return{label:`${t("Collecting results from")} ${r}…`,StatusIcon:B,showDots:!1}}let a,o=H;if(r.some(e=>e.includes("search")||e.includes("list"))?o=j:r.some(e=>e.includes("read")||e.includes("get")||e.includes("query"))?o=L:r.some(e=>e.includes("send")||e.includes("create")||e.includes("draft")||e.includes("reply")||e.includes("flag"))?o=U:r.some(e=>e.includes("code")||e.includes("execute"))?o=P:r.some(e=>e.includes("web")||e.includes("browse"))&&(o=R),n.length>0){const e=n.map(e=>e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())),t=Array.from(new Set(e));a=1===t.length?`${t[0]}…`:`${t[0]} (+${t.length-1} more)…`}else a=t("Using tools…");return{label:a,StatusIcon:o,showDots:!1}}case"analyzing":return{label:t("Analyzing results…"),StatusIcon:B,showDots:!1};case"composing":return{label:t("Composing answer…"),StatusIcon:y,showDots:!0};case"consulting":{const n=e.tools?.[0]??"agent";return{label:`${t("Consulting")} ${n}…`,StatusIcon:G,showDots:!1}}case"delegating":{const n=e.tools?.filter(e=>"spawn_background_task"===e).length??0;return{label:n>1?`${t("Delegating")} ${n} ${t("tasks")}…`:`${t("Delegating task")}…`,StatusIcon:G,showDots:!1}}case"polling":{const n=e.tools?.filter(e=>"check_task_status"===e).length??0,r=n>1?`${n} ${t("background tasks")}`:t("background task");return{label:`${t("Waiting for")} ${r}…`,StatusIcon:B,showDots:!1}}case"collecting":{const n=e.tools?.filter(e=>"get_task_result"===e).length??0,r=n>1?`${n} ${t("tasks")}`:t("task");return{label:`${t("Collecting results from")} ${r}…`,StatusIcon:B,showDots:!1}}case"transferring":{const n=e.tools?.[0]??"agent";return{label:`${t("Transferring to")} ${n}…`,StatusIcon:z,showDots:!1}}default:return{label:t("Thinking..."),StatusIcon:y,showDots:!1}}}(r,o),c=r?.thinkingContent;return t(n,{children:[t("div",{className:"flex gap-3 items-center justify-start",children:[e("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-[var(--chat-accent)]/15 to-[var(--chat-accent)]/5",children:e("span",{className:"text-[var(--chat-accent)] [&>svg]:w-4 [&>svg]:h-4",children:a})}),t("div",{className:"rounded-lg bg-gray-50 dark:bg-white/[0.03] px-4 py-3 relative overflow-hidden",children:[e("div",{className:"absolute inset-0 bg-gradient-to-r from-[var(--chat-accent)]/[0.03] via-transparent to-[var(--chat-accent)]/[0.03] animate-pulse pointer-events-none"}),t("div",{className:"relative flex items-center gap-2.5",children:[l?e("div",{className:"flex gap-[3px] items-center h-3.5 w-3.5 justify-center",children:[0,.15,.3].map((t,n)=>e("span",{className:"h-[5px] w-[5px] rounded-full bg-[var(--chat-accent)]/50",style:{animation:`chat-dot 1s ease-in-out infinite ${t}s`}},n))}):e(i,{size:14,className:"text-[var(--chat-accent)] animate-pulse transition-all duration-300"}),e("span",{className:"text-sm text-gray-500 dark:text-white/50 transition-all duration-300",children:s})]})]})]}),c&&e(Y,{content:c})]})},te=({content:n})=>{const[a,o]=r(null);return e(l,{remarkPlugins:[c],components:{p:({children:t})=>e("p",{className:"mb-3 last:mb-0 leading-7 break-words text-[0.8125rem] text-gray-900 dark:text-white/90",children:t}),code:({className:n,children:r})=>{const s=/language-(\w+)/.exec(n||""),i=String(r).replace(/\n$/,"");return s?t("div",{className:"my-3 rounded-lg border border-gray-200 dark:border-white/10 overflow-hidden bg-gray-50 dark:bg-white/[0.03]",children:[t("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-gray-200 dark:border-white/10 bg-gray-100 dark:bg-white/[0.03]",children:[e("span",{className:"text-[0.7rem] text-gray-500 dark:text-white/40 font-mono",children:s[1]}),e("button",{type:"button",onClick:()=>{return e=i,navigator.clipboard.writeText(e),o(e),void setTimeout(()=>o(null),2e3);var e},className:"p-0.5 rounded hover:bg-gray-200 dark:hover:bg-white/10 transition-colors",children:a===i?e(N,{size:14,className:"text-green-500"}):e(_,{size:14,className:"text-gray-400 dark:text-white/40"})})]}),e("pre",{className:"m-0 px-3 py-2 overflow-x-auto",children:e("code",{className:"font-mono text-xs leading-[1.7] text-gray-800 dark:text-white/90 whitespace-pre",children:i})})]}):e("code",{className:"bg-gray-100 dark:bg-white/[0.08] px-1.5 py-0.5 rounded font-mono text-xs text-[var(--chat-accent)]",children:r})},ul:({children:t})=>e("ul",{className:"pl-5 mb-3 text-[0.8125rem] text-gray-900 dark:text-white/90 [&_li]:mb-1 marker:text-[var(--chat-accent)]/50",children:t}),ol:({children:t})=>e("ol",{className:"pl-5 mb-3 text-[0.8125rem] text-gray-900 dark:text-white/90 [&_li]:mb-1 marker:text-[var(--chat-accent)]/50",children:t}),blockquote:({children:t})=>e("blockquote",{className:"my-3 border-l-2 border-[var(--chat-accent)]/30 bg-[var(--chat-accent)]/[0.03] pl-4 pr-3 py-2 rounded-r-md italic text-gray-500 dark:text-white/60",children:t}),a:({href:t,children:n})=>e("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-[var(--chat-accent)] underline underline-offset-2 hover:brightness-125",children:n}),h1:({children:t})=>e("h1",{className:"mt-4 first:mt-0 mb-2 font-bold text-base text-gray-900 dark:text-white",children:t}),h2:({children:t})=>e("h2",{className:"mt-3 first:mt-0 mb-2 font-bold text-[0.9rem] text-gray-900 dark:text-white",children:t}),h3:({children:t})=>e("h3",{className:"mt-3 first:mt-0 mb-1.5 font-semibold text-[0.85rem] text-gray-900 dark:text-white",children:t}),table:({children:t})=>e("div",{className:"my-3 overflow-x-auto rounded-lg border border-gray-200 dark:border-white/10",children:e("table",{className:"w-full border-collapse text-xs",children:t})}),th:({children:t})=>e("th",{className:"px-3 py-2 text-left font-semibold bg-gray-50 dark:bg-white/[0.04] border-b border-gray-200 dark:border-white/10 text-gray-900 dark:text-white",children:t}),td:({children:t})=>e("td",{className:"px-3 py-2 border-b border-gray-200 dark:border-white/10 text-gray-700 dark:text-white/80",children:t})},children:n})},ne=({messages:s,isLoading:i,agentStatus:l,agentName:c,logoIcon:d,t:h})=>{const g=a(null),[u,m]=r(null);return o(()=>{g.current?.scrollIntoView({behavior:"smooth"})},[s]),t("div",{className:"flex-1 overflow-y-auto px-4 py-3 flex flex-col gap-4 filigran-chat-scrollable",children:[s.map(r=>{const a="assistant"===r.role,o=!r.content;return a&&o&&i?e("div",{children:e(ee,{agentStatus:l,logoIcon:d,t:h})},r.id):t("div",{className:"flex flex-col "+(a?"items-start":"items-end"),children:[a&&t("div",{className:"flex items-center gap-1.5 mb-1",children:[e("div",{className:"w-6 h-6 rounded-lg flex items-center justify-center bg-gradient-to-br from-[var(--chat-accent)]/20 to-[var(--chat-accent)]/5",children:e("span",{className:"text-[var(--chat-accent)] [&>svg]:w-3 [&>svg]:h-3",children:d})}),e("span",{className:"font-semibold text-xs text-gray-900 dark:text-white",children:c})]}),a&&!o&&i&&l?.thinkingContent&&e(Y,{content:l.thinkingContent}),r.files&&r.files.length>0&&e("div",{className:"flex gap-1.5 flex-wrap mb-1.5",children:r.files.map((n,r)=>t("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-gray-200 dark:border-white/10 text-[0.7rem] text-gray-600 dark:text-white/60",children:[e(A,{size:14}),n.name]},r))}),t("div",{className:"max-w-[90%] "+(a?"pl-1 py-1 text-[0.8125rem] leading-7":"px-3.5 py-2 rounded-[14px_14px_4px_14px] bg-[var(--chat-accent-dark)] text-white text-[0.8125rem] leading-6"),children:[a?e(te,{content:r.content}):r.content,a&&o&&!i&&e("span",{className:"text-[0.8125rem] text-gray-400 dark:text-white/40 italic",children:"..."}),a&&!o&&i&&e("span",{className:"inline-block w-1.5 h-4 bg-[var(--chat-accent)]/70 rounded-sm ml-0.5 animate-pulse align-text-bottom"})]}),a&&!o&&!i&&r.toolNames&&r.toolNames.length>0&&t(n,{children:[e("button",{type:"button",onClick:()=>m(u===r.id?null:r.id),className:"mt-0.5 p-1 rounded-lg opacity-50 hover:opacity-100 hover:text-[var(--chat-accent)] transition-opacity",title:h("Reasoning details"),children:e(D,{size:14})}),u===r.id&&t("div",{className:"mt-1.5 p-3 rounded-lg bg-gray-50 dark:bg-white/[0.04] border border-gray-200 dark:border-white/10",children:[t("p",{className:"text-[0.7rem] text-gray-500 dark:text-white/40 mb-1.5",children:[r.iterations&&r.iterations>1?`${r.iterations} iterations · `:"",r.toolCallCount??r.toolNames.length," ",1===(r.toolCallCount??r.toolNames.length)?h("tool call"):h("tool calls")]}),e("div",{className:"flex flex-wrap gap-1",children:Array.from(new Set(r.toolNames)).map(t=>e("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full border border-gray-200 dark:border-white/10 text-[0.68rem] font-mono text-gray-500 dark:text-white/40",children:t.replace(/_/g," ")},t))})]})]})]},r.id)}),e("div",{ref:g})]})},re=({firstName:n,logoIcon:r,promptSuggestions:a,onPromptClick:o,t:s})=>t("div",{className:"flex-1 flex flex-col items-center justify-center px-6 pb-8",children:[e("span",{className:"text-[var(--chat-accent)] mb-4 [&>svg]:w-12 [&>svg]:h-12 drop-shadow-[0_0_12px_var(--chat-accent-40)]",children:r}),t("h2",{className:"text-xl font-medium mb-6 text-center text-gray-900 dark:text-white",style:{fontFamily:'"Geologica", sans-serif'},children:[s("How can I help you, "),n,"?"]}),t("div",{className:"w-full max-w-[320px]",children:[e("span",{className:"block text-center mb-2 text-[0.65rem] tracking-[1.5px] uppercase text-[var(--chat-accent)] font-semibold",children:s("Suggestions")}),a.map(t=>e("button",{type:"button",onClick:()=>o(t),className:"w-full text-left text-[0.8125rem] text-gray-800 dark:text-white py-1.5 px-3 mb-1 rounded-lg border border-gray-200 dark:border-white/10 bg-transparent transition-colors hover:bg-[var(--chat-accent-10)] hover:border-[var(--chat-accent-50)]",children:s(t)},t))]})]}),ae=["Help me create a new simulation scenario","What are the latest attack patterns?","How do I configure detection rules?","Summarize my recent findings"],oe=({mode:n,onClose:s,onModeChange:i,topOffset:l=0,apiBaseUrl:c,apiEndpoints:g,agentDashboardUrl:u,user:m,t:p=h,accentColor:w="#7b5cff",logoIcon:v,promptSuggestions:y=ae,resizable:N=!1,onWidthChange:C,onResizeStart:S,onResizeEnd:_,pushContentSelector:L,backendType:M="rest"})=>{const[z,A]=r(!1),{agents:T,selectedAgent:E,agentMenuOpen:$,setAgentMenuOpen:R,handleSwitchAgent:D}=function({apiBaseUrl:e,apiEndpoints:t,backendType:n="rest"}){const[a,s]=r([]),[i,l]=r(null),[c,d]=r(!1);return o(()=>{null===t?.agents||t?.singleEndpoint||"legacy"===n||fetch(`${e}${t?.agents??"/chat/agents"}`).then(e=>e.ok?e.json():[]).then(e=>{if(s(e),e.length>0&&!i){const t=localStorage.getItem(f),n=t?e.find(e=>e.slug===t):null;l(n||e[0])}}).catch(()=>{})},[e,t]),{agents:a,selectedAgent:i,setSelectedAgent:l,agentMenuOpen:c,setAgentMenuOpen:d,handleSwitchAgent:(e,t)=>{e.id!==i?.id?(l(e),e.slug&&localStorage.setItem(f,e.slug),d(!1),t?.()):d(!1)}}}({apiBaseUrl:c,apiEndpoints:g,backendType:M}),{messages:U,inputValue:j,setInputValue:W,isLoading:O,agentStatus:B,attachedFiles:F,conversationId:P,transferredAgent:G,historyLoadedRef:H,handleFileAdd:V,handlePaste:q,handleSendMessage:K,handleNewChat:X,handleStopGenerating:Z,setAttachedFiles:Y,setMessages:ee,setConversationId:te}=x({apiBaseUrl:c,apiEndpoints:g,backendType:M,agentSlug:E?.slug,t:p}),{sidebarWidth:oe,handleResizeStart:se,defaultWidth:ie,isResizing:le}=function({mode:e,resizable:t,onWidthChange:n,onResizeStart:s,onResizeEnd:i}){const[l,c]=r(()=>{if("undefined"==typeof window)return b;const e=localStorage.getItem(k);if(e){const t=parseInt(e,10);if(!Number.isNaN(t)&&t>=b)return t}return b}),[d,h]=r(!1),g=a(!1),u=a(l);u.current=l;const m=a(n);m.current=n;const p=a(i);return p.current=i,o(()=>{"sidebar"===e&&t&&m.current?.(u.current)},[e,t]),o(()=>{if("sidebar"!==e||!t)return;const n=e=>{if(!g.current)return;e.preventDefault();const t=window.innerWidth-e.clientX,n=.4*window.innerWidth,r=Math.min(Math.max(t,b),n);c(r),u.current=r,m.current?.(r)},r=()=>{g.current&&(g.current=!1,h(!1),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem(k,String(u.current)),p.current?.())},a=()=>{const e=.4*window.innerWidth;if(u.current>e){const t=Math.max(e,b);c(t),u.current=t,m.current?.(t)}};return document.addEventListener("mousemove",n),document.addEventListener("mouseup",r),window.addEventListener("resize",a),()=>{document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",r),window.removeEventListener("resize",a)}},[e,t]),{sidebarWidth:l,handleResizeStart:e=>{e.preventDefault(),g.current=!0,h(!0),document.body.style.cursor="col-resize",document.body.style.userSelect="none",s?.()},defaultWidth:b,isResizing:d}}({mode:n,resizable:N,onWidthChange:C,onResizeStart:S,onResizeEnd:_});o(()=>{const e="sidebar"===n?N?oe:ie:0,t=e>0?e+6:0;if(document.documentElement.style.setProperty("--chatbot-sidebar-width",`${t}px`),document.documentElement.style.setProperty("--chatbot-transition",le?"none":"all 225ms cubic-bezier(0.4, 0, 0.2, 1)"),L){const e=document.querySelector(L);if(e){const n=e.style.paddingRight,r=e.style.transition;return e.style.paddingRight=t>0?`${t}px`:"",e.style.transition=le?"none":"padding-right 225ms cubic-bezier(0.4, 0, 0.2, 1)",()=>{e.style.paddingRight=n,e.style.transition=r,document.documentElement.style.setProperty("--chatbot-sidebar-width","0px")}}}return()=>{document.documentElement.style.setProperty("--chatbot-sidebar-width","0px")}},[L,n,oe,ie,N,le]);const ce=v??e(I,{size:24}),de=m.firstName,he=G?.name||E?.name||"Assistant",ge={"--chat-accent":w,"--chat-accent-10":d(w,.1),"--chat-accent-40":d(w,.25),"--chat-accent-50":d(w,.5),"--chat-accent-dark":w};o(()=>{if(null===g?.sessions||g?.singleEndpoint||"legacy"===M||"ag-ui"===M)return;if(!P||H.current||!E)return;H.current=!0;const e=()=>{te(null),localStorage.removeItem("filigranChatConversationId")};fetch(`${c}${g?.sessions??"/chat/sessions"}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversation_id:P,agent_slug:E.slug})}).then(t=>t.ok?t.json():(e(),null)).then(e=>{if(!e?.messages?.length)return;const t=e.messages.map((e,t)=>({id:`restored-${t}`,role:e.role,content:e.content,timestamp:new Date}));ee(t)}).catch(()=>{e()})},[P,E,c,g,H,ee,te]);const ue=(()=>{const e="filigran-chatbot";switch(n){case"sidebar":return`${e} fixed right-0 bottom-0 flex flex-col bg-white dark:bg-[#1e1e2e] border-l border-gray-200 dark:border-white/10 z-[1200]`;case"floating":return`${e} fixed bottom-5 right-5 flex flex-col bg-white dark:bg-[#1e1e2e] rounded-xl shadow-[0_8px_32px_rgba(0,0,0,0.15)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.4)] z-[1300] border border-gray-200 dark:border-white/10`;case"fullscreen":return`${e} fixed right-0 bottom-0 left-0 flex flex-col bg-gray-50 dark:bg-[#161622] z-[1400]`;default:return e}})(),me={...ge,..."sidebar"===n?{top:l,width:N?oe:ie}:"floating"===n?{width:380,height:560}:{top:l}};return t("div",{className:ue,style:me,children:["sidebar"===n&&N&&e("div",{onMouseDown:se,className:"absolute top-0 -left-1 bottom-0 w-2 cursor-col-resize z-10 group",children:e("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 bottom-0 w-0.5 rounded bg-[var(--chat-accent)] opacity-0 transition-opacity group-hover:opacity-100 group-active:opacity-100"})}),e(J,{mode:n,agentName:he,agents:T,selectedAgent:E,transferredFrom:G?E?.name:void 0,agentMenuOpen:$,onAgentMenuToggle:()=>R(e=>!e),onAgentMenuClose:()=>R(!1),onSwitchAgent:e=>{e&&D(e,()=>{X()})},modeMenuOpen:z,onModeMenuToggle:()=>A(e=>!e),onModeMenuClose:()=>A(!1),onModeChange:i,onNewChat:X,onClose:s,logoIcon:ce,agentDashboardUrl:u,t:p}),0===U.length?e(re,{firstName:de,logoIcon:ce,promptSuggestions:y,onPromptClick:W,t:p}):e(ne,{messages:U,isLoading:O,agentStatus:B,agentName:he,logoIcon:ce,t:p}),e(Q,{inputValue:j,onInputChange:W,onSend:K,onStop:Z,isLoading:O,attachedFiles:F,onFileAdd:V,onFileRemove:e=>Y(t=>t.filter((t,n)=>n!==e)),onPaste:q,t:p,mode:n})]})},se=({isOpen:n,onToggle:r,label:a="Ask Assistant",accentColor:o="#7b5cff",icon:s})=>{const i=s??e(I,{size:16});return t("button",{type:"button",onClick:r,className:"filigran-chatbot inline-flex items-center gap-1.5 px-3 py-[3px] text-[0.8125rem] font-medium whitespace-nowrap rounded-md border transition-colors",style:{borderColor:n?o:d(o,.5),color:o,backgroundColor:n?d(o,.1):"transparent"},onMouseEnter:e=>{e.currentTarget.style.borderColor=o,e.currentTarget.style.backgroundColor=d(o,.1)},onMouseLeave:e=>{e.currentTarget.style.borderColor=n?o:d(o,.5),e.currentTarget.style.backgroundColor=n?d(o,.1):"transparent"},children:[e("span",{className:"[&>svg]:w-4 [&>svg]:h-4",children:i}),a]})};export{oe as ChatPanel,se as ChatToggleButton};
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useState as r,useRef as a,useEffect as o,useCallback as s}from"react";import{createPortal as i}from"react-dom";import l from"react-markdown";import c from"remark-gfm";function d(e,t){return`${e}${Math.round(255*t).toString(16).padStart(2,"0")}`}const h=e=>e;function g(e,t){const n=e.event;if("nextAgentFlow"===n){const n=e.data,r=n?.nodeId;return"INPROGRESS"===n?.status&&r&&(t.activeNodeId=r),{action:"noop"}}if("start"===n)return{action:"noop"};if("token"===n){return{action:"stream",content:(e.data??"").replace(/<br\s*\/?>/g,"\n")}}if("agentReasoning"===n){const n=e.data,r=n?.usedTools;return r?.length?(t.hasUsedTools=!0,{action:"status",status:"tool_start",tools:r.map(e=>e.tool)}):t.hasUsedTools?{action:"status",status:"analyzing"}:{action:"status",status:"thinking"}}if("usedTools"===n){t.hasUsedTools=!0;const n=e.data;return{action:"status",status:"tool_start",tools:Array.isArray(n)?n.map(e=>e.tool):[]}}if("metadata"===n){const t=e.data,n=t?.chatId;return n?{action:"set_chat_id",chatId:n}:{action:"noop"}}return"error"===n?{action:"error",content:e.data||""}:"end"===n?{action:"done",content:""}:{action:"noop"}}function u(e,t){const n=e.type;if("error"===n)return{action:"error",content:e.content||""};if("status"===n){const n=e.status;return"tool_done"===n||"wind_down"===n?{action:"noop"}:"streaming"===n?{action:"status",status:"streaming"}:"thinking_text"===n?{action:"status",status:"thinking_text",thinkingContent:e.content}:"tool_start"===n?(t.hasUsedTools=!0,{action:"status",status:"tool_start",tools:e.tools}):"thinking"===n&&t.hasUsedTools?{action:"status",status:"analyzing"}:{action:"status",status:n,tools:e.tools}}return"stream"===n?{action:"stream",content:e.content}:"done"===n?{action:"done",content:e.content,conversationId:e.conversation_id,toolNames:e.tool_names,toolCallCount:e.tool_call_count,iterations:e.iterations,transferAgentId:e.transfer_agent_id,transferAgentName:e.transfer_agent_name}:{action:"noop"}}function m(e,t){const n=e.type;if("RUN_STARTED"===n)return{action:"status",status:"thinking"};if("RUN_FINISHED"===n)return{action:"done",content:""};if("RUN_ERROR"===n)return{action:"error",content:e.message||"Unknown error"};if("STEP_STARTED"===n){return{action:"status",status:e.stepName||"thinking"}}if("STEP_FINISHED"===n)return{action:"noop"};if("TEXT_MESSAGE_START"===n)return{action:"status",status:"streaming"};if("TEXT_MESSAGE_CONTENT"===n){const t=e.delta;return t?{action:"stream",content:t}:{action:"noop"}}if("TEXT_MESSAGE_END"===n)return{action:"noop"};if("TEXT_MESSAGE_CHUNK"===n){const t=e.delta;return t?{action:"stream",content:t}:{action:"noop"}}if("TOOL_CALL_START"===n){t.hasUsedTools=!0;const n=e.toolCallName;return{action:"status",status:"tool_start",tools:n?[n]:[]}}if("TOOL_CALL_ARGS"===n)return{action:"noop"};if("TOOL_CALL_END"===n)return{action:"status",status:"analyzing"};if("TOOL_CALL_RESULT"===n)return{action:"noop"};if("TOOL_CALL_CHUNK"===n){const n=e.toolCallName;return n?(t.hasUsedTools=!0,{action:"status",status:"tool_start",tools:[n]}):{action:"noop"}}return"REASONING_START"===n||"REASONING_MESSAGE_START"===n||"REASONING_MESSAGE_CONTENT"===n||"REASONING_MESSAGE_CHUNK"===n?{action:"status",status:"thinking"}:{action:"noop"}}const p="filigranChatConversationId",w="filigranChatLegacyChatId";function x({apiBaseUrl:e,apiEndpoints:t,backendType:n="rest",agentSlug:o,t:s}){const i="legacy"===n,[l,c]=r([]),[d,h]=r(""),[x,f]=r(!1),[b,k]=r(null),[v,y]=r(()=>"undefined"==typeof window?null:localStorage.getItem(p)),[N,C]=r([]),[S,_]=r(null),[L,I]=r(()=>"undefined"==typeof window?null:localStorage.getItem(w)),M=a(!1),z=a(null),A=a(!1),T=e=>{if(!e)return;const t=[];Array.from(e).forEach(n=>{const r=new FileReader;r.onload=()=>{t.push({name:n.name,type:n.type,size:n.size,dataUrl:r.result}),t.length===e.length&&C(e=>[...e,...t])},r.readAsDataURL(n)})};return{messages:l,inputValue:d,setInputValue:h,isLoading:x,agentStatus:b,attachedFiles:N,conversationId:v,transferredAgent:S,historyLoadedRef:M,handleFileAdd:T,handlePaste:e=>{const{files:t}=e.clipboardData;t.length>0&&(e.preventDefault(),T(t))},handleSendMessage:async()=>{if(!d.trim()&&0===N.length||x)return;const r=d.trim(),a={id:crypto.randomUUID(),role:"user",content:r,timestamp:new Date,files:N.length>0?[...N]:void 0};c(e=>[...e,a]),h(""),C([]),f(!0),k({status:"thinking"}),A.current=!1;const l=crypto.randomUUID();c(e=>[...e,{id:l,role:"assistant",content:"",timestamp:new Date}]);try{const a=new AbortController;z.current=a;const d=function(e,t,n){switch(e){case"legacy":return{question:t,chatId:n.legacyChatId??void 0,streaming:!0};case"ag-ui":return{threadId:n.conversationId??crypto.randomUUID(),runId:crypto.randomUUID(),messages:[{id:crypto.randomUUID(),role:"user",content:t}],tools:[],context:[],state:{},forwardedProps:n.agentSlug?{agentSlug:n.agentSlug}:{}};default:return{content:t,conversation_id:n.conversationId,agent_slug:n.agentSlug}}}(n,r,{legacyChatId:L,conversationId:v,agentSlug:o}),h=await fetch(i||t?.singleEndpoint?e:`${e}${t?.messages??"/chat/messages"}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d),signal:a.signal});if(!h.ok||!h.body)return void c(e=>e.map(e=>e.id===l?{...e,content:s("Unable to connect. Please check the configuration.")}:e));const x=function(e){switch(e){case"legacy":return g;case"ag-ui":return m;default:return u}}(n),f={hasUsedTools:!1,activeNodeId:""},b=h.body.getReader(),N=new TextDecoder;let C="",S="",M=!1;for(;;){const{done:e,value:t}=await b.read();if(e)break;C+=N.decode(t,{stream:!0});const n=C.split("\n");C=n.pop()||"";for(const e of n){const t=e.replace(/\r$/,"");if(!t.startsWith("data:"))continue;const n=t.startsWith("data: ")?t.slice(6):t.slice(5);try{const e=x(JSON.parse(n),f);switch(f.hasUsedTools=f.hasUsedTools||A.current,e.action){case"status":"tool_start"===e.status&&(A.current=!0),"thinking_text"===e.status?k(t=>({...t,status:t?.status??"thinking",thinkingContent:(t?.thinkingContent??"")+(e.thinkingContent??"")})):k(t=>({status:e.status,tools:e.tools,thinkingContent:t?.thinkingContent}));break;case"stream":S+=e.content,k(e=>({status:"streaming",thinkingContent:e?.thinkingContent})),c(e=>e.map(e=>e.id===l?{...e,content:S}:e));break;case"done":M=!0,e.conversationId&&(y(e.conversationId),localStorage.setItem(p,e.conversationId)),e.transferAgentId&&e.transferAgentName&&_({id:e.transferAgentId,name:e.transferAgentName}),c(t=>t.map(t=>t.id===l?{...t,content:e.content||S,toolNames:e.toolNames,toolCallCount:e.toolCallCount,iterations:e.iterations}:t));break;case"error":return void c(t=>t.map(t=>t.id===l?{...t,content:e.content||s("Unable to connect. Please check the configuration.")}:t));case"set_chat_id":I(e.chatId),localStorage.setItem(w,e.chatId)}A.current=f.hasUsedTools}catch{}}}S&&!M&&c(e=>e.map(e=>e.id===l?{...e,content:S||"No response."}:e))}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;c(e=>e.map(e=>e.id===l?{...e,content:s("Sorry, an error occurred. Please try again.")}:e))}finally{z.current=null,f(!1),k(null),A.current=!1}},handleNewChat:()=>{z.current?.abort(),z.current=null,c([]),h(""),C([]),f(!1),k(null),_(null),A.current=!1,M.current=!1,i?(I(null),localStorage.removeItem(w)):(y(null),localStorage.removeItem(p))},handleStopGenerating:()=>{z.current?.abort(),z.current=null,f(!1),k(null),A.current=!1,c(e=>e.filter(e=>!("assistant"===e.role&&!e.content)))},setAttachedFiles:C,setMessages:c,setConversationId:y}}const f="filigranChatAgentSlug";const b=400,k="filigranChatSidebarWidth";const v=({className:t,size:n=24})=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e("path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),y=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"}),e("path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"}),e("path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"}),e("path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375"}),e("path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5"}),e("path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396"}),e("path",{d:"M19.938 10.5a4 4 0 0 1 .585.396"}),e("path",{d:"M6 18a4 4 0 0 1-1.967-.516"}),e("path",{d:"M19.967 17.484A4 4 0 0 1 18 18"})]}),N=({className:t,size:n=24})=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e("path",{d:"M20 6 9 17l-5-5"})}),C=({className:t,size:n=24})=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e("path",{d:"m6 9 6 6 6-6"})}),S=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"M18 6 6 18"}),e("path",{d:"m6 6 12 12"})]}),_=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),e("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]}),L=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),e("path",{d:"M3 5V19A9 3 0 0 0 21 19V5"}),e("path",{d:"M3 12A9 3 0 0 0 21 12"})]}),I=({className:t,size:n=24})=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",className:t,children:e("path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"})}),M=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"M12 20h9"}),e("path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z"})]}),z=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"M15 3h6v6"}),e("path",{d:"M10 14 21 3"}),e("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]}),A=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),e("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"})]}),T=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"M11 13H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7"}),e("rect",{width:"12",height:"12",x:"10",y:"10",rx:"2"})]}),E=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}),e("path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}),e("path",{d:"M3 16h3a2 2 0 0 0 2 2v3"}),e("path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"})]}),$=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}),e("path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}),e("path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}),e("path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"})]}),R=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),e("path",{d:"M2 12h20"})]}),D=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("path",{d:"M12 16v-4"}),e("path",{d:"M12 8h.01"})]}),U=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),e("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),j=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("circle",{cx:"11",cy:"11",r:"8"}),e("path",{d:"m21 21-4.3-4.3"})]}),W=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"m22 2-7 20-4-9-9-4Z"}),e("path",{d:"m22 2-11 11"})]}),O=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),e("path",{d:"M15 3v18"})]}),B=({className:t,size:n=24})=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e("path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"})}),F=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("rect",{width:"6",height:"6",x:"9",y:"9"})]}),P=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("polyline",{points:"4 17 10 11 4 5"}),e("line",{x1:"12",x2:"20",y1:"19",y2:"19"})]}),G=({className:n,size:r=24})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[e("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e("circle",{cx:"9",cy:"7",r:"4"}),e("line",{x1:"19",x2:"19",y1:"8",y2:"14"}),e("line",{x1:"22",x2:"16",y1:"11",y2:"11"})]}),H=({className:t,size:n=24})=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})});const V=({open:t,onClose:n,anchorRef:l,placement:c="bottom-start",width:d=280,children:h})=>{const g=a(null),[u,m]=r({top:0,left:0});if(function(e,t,n=!0){o(()=>{if(!n)return;const r=n=>{e.current&&!e.current.contains(n.target)&&t()};return document.addEventListener("mousedown",r),document.addEventListener("touchstart",r),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("touchstart",r)}},[e,t,n])}(g,s(()=>n(),[n]),t),o(()=>{if(!t||!l.current)return;const e=l.current.getBoundingClientRect(),n="bottom-end"===c?e.right-d:e.left;m({top:e.bottom+4,left:n})},[t,l,c,d]),!t)return null;const p=function(e){let t=e;for(;t;){if(t.classList.contains("filigran-chatbot"))return t;t=t.parentElement}return document.body}(l.current);return i(e("div",{ref:g,className:"fixed z-[10000] rounded-[10px] overflow-hidden border border-gray-200 dark:border-white/10 bg-white dark:bg-[#2a2a3e] shadow-xl",style:{top:u.top,left:u.left,width:d},children:h}),p)},q=({size:t=16,className:n=""})=>e("div",{className:`animate-spin rounded-full border-2 border-current/20 border-t-[var(--chat-accent)] ${n}`,style:{width:t,height:t}});function K(e){let t=e;for(;t;){if(t.classList.contains("filigran-chatbot"))return t;t=t.parentElement}return document.body}const X=({title:n,children:o})=>{const s=a(null),[l,c]=r(!1),[d,h]=r({top:0,left:0});if(!n)return o;return t("span",{ref:s,className:"inline-flex",onMouseEnter:()=>{if(!s.current)return;const e=s.current.getBoundingClientRect();h({top:e.top-4,left:e.left+e.width/2}),c(!0)},onMouseLeave:()=>c(!1),children:[o,l&&i(e("span",{className:"pointer-events-none fixed z-[10001] -translate-x-1/2 -translate-y-full whitespace-nowrap rounded-md bg-gray-900 dark:bg-gray-100 px-2 py-1 text-xs text-white dark:text-gray-900 shadow-lg",style:{top:d.top,left:d.left},role:"tooltip",children:n}),K(s.current))]})},Z=[{mode:"floating",label:"Floating",getIcon:t=>e(T,{...t})},{mode:"sidebar",label:"Sidebar",getIcon:t=>e(O,{...t})},{mode:"fullscreen",label:"Full screen",getIcon:t=>e($,{...t})}],J=({mode:n,agentName:r,agents:o,selectedAgent:s,transferredFrom:i,agentMenuOpen:l,onAgentMenuToggle:c,onAgentMenuClose:d,onSwitchAgent:h,modeMenuOpen:g,onModeMenuToggle:u,onModeMenuClose:m,onModeChange:p,onNewChat:w,onClose:x,logoIcon:f,agentDashboardUrl:b,t:k})=>{const v=a(null),y=a(null),N="sidebar"===n?O:"fullscreen"===n?E:T;return t("div",{className:"flex items-center px-3 py-2 min-h-[48px] border-b border-gray-200 dark:border-white/10 bg-gradient-to-br from-[var(--chat-accent-dark)]/[0.13] to-[var(--chat-accent)]/[0.07] "+("floating"===n?"rounded-t-xl":""),children:[t("button",{ref:v,type:"button",onClick:c,className:"flex items-center gap-1.5 text-sm font-semibold text-gray-900 dark:text-white px-2 py-1 rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 transition-colors",children:[e("span",{className:"flex items-center text-[var(--chat-accent)] [&>svg]:w-[18px] [&>svg]:h-[18px]",children:f}),t("span",{className:"flex flex-col items-start leading-tight",children:[e("span",{children:r}),i&&t("span",{className:"text-[0.6rem] font-normal text-gray-400 dark:text-white/30",children:[k("Transferred from")," ",i]})]}),e(C,{size:16,className:"text-gray-400 dark:text-white/30"})]}),t(V,{open:l,onClose:d,anchorRef:v,width:280,children:[e("span",{className:"block px-4 pt-3 pb-1 text-[0.68rem] tracking-[1px] uppercase text-gray-400 dark:text-white/40",children:k("Switch to another agent")}),0===o.length&&e("div",{className:"px-4 py-2",children:e(q,{size:16})}),e("div",{children:o.map(n=>t("button",{type:"button",onClick:()=>h(n),className:"w-full flex items-center gap-2 px-4 py-1.5 text-left hover:bg-gray-100 dark:hover:bg-white/10 transition-colors "+(n.id===s?.id?"bg-[var(--chat-accent)]/10":""),children:[e("div",{className:"w-7 h-7 rounded-full flex items-center justify-center shrink-0 bg-gradient-to-br from-[var(--chat-accent)]/20 to-[var(--chat-accent)]/5",children:e("span",{className:"text-[var(--chat-accent)] [&>svg]:w-4 [&>svg]:h-4",children:f})}),t("div",{className:"min-w-0",children:[e("div",{className:"text-[0.8125rem] font-medium text-gray-900 dark:text-white truncate",children:n.name}),n.description&&e("div",{className:"text-[0.7rem] text-gray-500 dark:text-white/40 truncate",children:n.description})]})]},n.id))}),e("div",{className:"h-px bg-gray-200 dark:bg-white/10 mx-2"}),t("div",{children:[b&&t("button",{type:"button",onClick:()=>{d(),window.open(`${b}/agents`,"_blank")},className:"w-full flex items-center gap-2 px-4 py-1.5 text-left hover:bg-gray-100 dark:hover:bg-white/10 transition-colors",children:[e(z,{size:18,className:"text-gray-400 dark:text-white/40 shrink-0"}),e("span",{className:"text-[0.8125rem] text-gray-700 dark:text-white/70",children:k("Browse agents")})]}),b&&t("button",{type:"button",onClick:()=>{d(),window.open(`${b}/agents/new`,"_blank")},className:"w-full flex items-center gap-2 px-4 py-1.5 text-left hover:bg-gray-100 dark:hover:bg-white/10 transition-colors",children:[e(G,{size:18,className:"text-gray-400 dark:text-white/40 shrink-0"}),e("span",{className:"text-[0.8125rem] text-gray-700 dark:text-white/70",children:k("Create agent")})]})]})]}),e("div",{className:"flex-1"}),e(X,{title:k("New chat"),children:e("button",{type:"button",onClick:w,className:"w-8 h-8 flex items-center justify-center rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-white/40 hover:text-gray-700 dark:hover:text-white/70 transition-colors",children:e(M,{size:18})})}),e(X,{title:k("Switch view"),children:e("button",{ref:y,type:"button",onClick:u,className:"w-8 h-8 flex items-center justify-center rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-white/40 hover:text-gray-700 dark:hover:text-white/70 transition-colors",children:e(N,{size:18})})}),t(V,{open:g,onClose:m,anchorRef:y,placement:"bottom-end",width:180,children:[e("span",{className:"block px-4 pt-3 pb-1 text-[0.68rem] tracking-[1px] uppercase text-gray-400 dark:text-white/40",children:k("Switch to")}),e("div",{className:"pb-1",children:Z.map(r=>t("button",{type:"button",onClick:()=>{p(r.mode),m()},className:"w-full flex items-center gap-3 px-4 py-1 text-left hover:bg-gray-100 dark:hover:bg-white/10 transition-colors "+(n===r.mode?"bg-[var(--chat-accent)]/10":""),children:[r.getIcon({size:18,className:"text-gray-400 dark:text-white/40"}),e("span",{className:"text-[0.8125rem] text-gray-700 dark:text-white/70",children:k(r.label)})]},r.mode))})]}),e(X,{title:k("Close"),children:e("button",{type:"button",onClick:x,className:"w-8 h-8 flex items-center justify-center rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-white/40 hover:text-gray-700 dark:hover:text-white/70 transition-colors",children:e(S,{size:18})})})]})},Q=({inputValue:n,onInputChange:r,onSend:o,onStop:s,isLoading:i,attachedFiles:l,onFileAdd:c,onFileRemove:d,onPaste:h,t:g,mode:u})=>{const m=a(null),p=a(null),w=n.trim()||l.length>0;return t("div",{className:"px-4 py-3 border-t border-gray-200 dark:border-white/10 "+("floating"===u?"rounded-b-xl":""),children:[l.length>0&&e("div",{className:"flex gap-1.5 flex-wrap mb-2",children:l.map((n,r)=>t("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-gray-200 dark:border-white/10 text-[0.7rem] text-gray-600 dark:text-white/60",children:[e(A,{size:14}),n.name,e("button",{type:"button",onClick:()=>d(r),className:"ml-0.5 text-gray-400 dark:text-white/30 hover:text-gray-600 dark:hover:text-white/60",children:"×"})]},r))}),t("div",{className:"flex items-center border border-gray-200 dark:border-white/10 rounded-xl px-2 py-1 transition-colors focus-within:border-[var(--chat-accent)]",children:[e("input",{ref:m,type:"file",multiple:!0,hidden:!0,onChange:e=>{c(e.target.files),e.target.value=""}}),e("button",{type:"button",onClick:()=>m.current?.click(),className:"w-8 h-8 flex items-center justify-center shrink-0 rounded-lg text-gray-400 dark:text-white/30 hover:bg-gray-100 dark:hover:bg-white/10 mr-0.5 transition-colors",children:e(v,{size:18})}),e("textarea",{ref:p,placeholder:g("Ask a question..."),value:n,onChange:e=>{r(e.target.value);const t=e.target;t.style.height="auto",t.style.height=`${Math.min(t.scrollHeight,120)}px`},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),o())},onPaste:h,rows:1,className:"flex-1 bg-transparent border-none outline-hidden resize-none text-[0.8125rem] py-1.5 text-gray-900 dark:text-white placeholder:text-gray-400 dark:placeholder:text-white/30 filigran-chat-scrollable",style:{maxHeight:120}}),e(X,{title:i?g("Stop generating"):"",children:e("button",{type:"button",onClick:i?s:o,disabled:!i&&!w,className:"p-1.5 rounded-lg w-8 h-8 flex items-center justify-center transition-all duration-150 "+(i?"text-red-500 bg-red-500/10 hover:bg-red-500/20":w?"text-[var(--chat-accent)] bg-[var(--chat-accent)]/10 hover:bg-[var(--chat-accent)]/20":"text-gray-300 dark:text-white/20 cursor-not-allowed"),children:e(i?F:W,{size:18})})})]}),e("p",{className:"text-center text-[0.65rem] text-gray-400 dark:text-white/30 mt-1.5 opacity-70",children:g("Uses AI. Verify results.")})]})};function Y({content:n}){const r=a(null),s=n.replace(/```[\s\S]*?```/g," ").replace(/`([^`]+)`/g,"$1").replace(/\*\*(.+?)\*\*/g,"$1").replace(/__(.+?)__/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/_(.+?)_/g,"$1").replace(/#{1,6}\s+/g,"").replace(/[*\->]+/g," ").replace(/\s+/g," ").trim();return o(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[s]),s.length<3?null:t("div",{ref:r,className:"ml-11 max-w-[70%] max-h-20 overflow-hidden relative rounded-md border-l-2 bg-[var(--chat-accent)]/[0.03] pl-3 pr-3 py-2",style:{animation:"reasoningGlow 3s ease-in-out infinite, chat-fade-in 0.5s ease-out"},children:[e("p",{className:"text-[13px] leading-[1.35rem] text-gray-400 dark:text-white/40 break-words m-0",children:s}),e("div",{className:"absolute inset-x-0 bottom-0 h-5 bg-gradient-to-t from-white/90 dark:from-[#1e1e2e]/90 to-transparent pointer-events-none"})]})}const ee=({agentStatus:r,logoIcon:a,t:o})=>{const{label:s,StatusIcon:i,showDots:l}=function(e,t){if(!e)return{label:t("Thinking..."),StatusIcon:y,showDots:!1};switch(e.status){case"tool_start":{const n=e.tools??[],r=n.map(e=>e.toLowerCase());if(r.some(e=>"spawn_background_task"===e)){const e=n.filter(e=>"spawn_background_task"===e).length;return{label:e>1?`${t("Delegating")} ${e} ${t("tasks")}…`:`${t("Delegating task")}…`,StatusIcon:G,showDots:!1}}if(r.some(e=>"check_task_status"===e)){const e=n.filter(e=>"check_task_status"===e).length,r=e>1?`${e} ${t("background tasks")}`:t("background task");return{label:`${t("Waiting for")} ${r}…`,StatusIcon:B,showDots:!1}}if(r.some(e=>"get_task_result"===e)){const e=n.filter(e=>"get_task_result"===e).length,r=e>1?`${e} ${t("tasks")}`:t("task");return{label:`${t("Collecting results from")} ${r}…`,StatusIcon:B,showDots:!1}}let a,o=H;if(r.some(e=>e.includes("search")||e.includes("list"))?o=j:r.some(e=>e.includes("read")||e.includes("get")||e.includes("query"))?o=L:r.some(e=>e.includes("send")||e.includes("create")||e.includes("draft")||e.includes("reply")||e.includes("flag"))?o=U:r.some(e=>e.includes("code")||e.includes("execute"))?o=P:r.some(e=>e.includes("web")||e.includes("browse"))&&(o=R),n.length>0){const e=n.map(e=>e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())),t=Array.from(new Set(e));a=1===t.length?`${t[0]}…`:`${t[0]} (+${t.length-1} more)…`}else a=t("Using tools…");return{label:a,StatusIcon:o,showDots:!1}}case"analyzing":return{label:t("Analyzing results…"),StatusIcon:B,showDots:!1};case"composing":return{label:t("Composing answer…"),StatusIcon:y,showDots:!0};case"consulting":{const n=e.tools?.[0]??"agent";return{label:`${t("Consulting")} ${n}…`,StatusIcon:G,showDots:!1}}case"delegating":{const n=e.tools?.filter(e=>"spawn_background_task"===e).length??0;return{label:n>1?`${t("Delegating")} ${n} ${t("tasks")}…`:`${t("Delegating task")}…`,StatusIcon:G,showDots:!1}}case"polling":{const n=e.tools?.filter(e=>"check_task_status"===e).length??0,r=n>1?`${n} ${t("background tasks")}`:t("background task");return{label:`${t("Waiting for")} ${r}…`,StatusIcon:B,showDots:!1}}case"collecting":{const n=e.tools?.filter(e=>"get_task_result"===e).length??0,r=n>1?`${n} ${t("tasks")}`:t("task");return{label:`${t("Collecting results from")} ${r}…`,StatusIcon:B,showDots:!1}}case"transferring":{const n=e.tools?.[0]??"agent";return{label:`${t("Transferring to")} ${n}…`,StatusIcon:z,showDots:!1}}default:return{label:t("Thinking..."),StatusIcon:y,showDots:!1}}}(r,o),c=r?.thinkingContent;return t(n,{children:[t("div",{className:"flex gap-3 items-center justify-start",children:[e("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-[var(--chat-accent)]/15 to-[var(--chat-accent)]/5",children:e("span",{className:"text-[var(--chat-accent)] [&>svg]:w-4 [&>svg]:h-4",children:a})}),t("div",{className:"rounded-lg bg-gray-50 dark:bg-white/[0.03] px-4 py-3 relative overflow-hidden",children:[e("div",{className:"absolute inset-0 bg-gradient-to-r from-[var(--chat-accent)]/[0.03] via-transparent to-[var(--chat-accent)]/[0.03] animate-pulse pointer-events-none"}),t("div",{className:"relative flex items-center gap-2.5",children:[l?e("div",{className:"flex gap-[3px] items-center h-3.5 w-3.5 justify-center",children:[0,.15,.3].map((t,n)=>e("span",{className:"h-[5px] w-[5px] rounded-full bg-[var(--chat-accent)]/50",style:{animation:`chat-dot 1s ease-in-out infinite ${t}s`}},n))}):e(i,{size:14,className:"text-[var(--chat-accent)] animate-pulse transition-all duration-300"}),e("span",{className:"text-sm text-gray-500 dark:text-white/50 transition-all duration-300",children:s})]})]})]}),c&&e(Y,{content:c})]})},te=({content:n})=>{const[a,o]=r(null);return e(l,{remarkPlugins:[c],components:{p:({children:t})=>e("p",{className:"mb-3 last:mb-0 leading-7 break-words text-[0.8125rem] text-gray-900 dark:text-white/90",children:t}),code:({className:n,children:r})=>{const s=/language-(\w+)/.exec(n||""),i=String(r).replace(/\n$/,"");return s?t("div",{className:"my-3 rounded-lg border border-gray-200 dark:border-white/10 overflow-hidden bg-gray-50 dark:bg-white/[0.03]",children:[t("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-gray-200 dark:border-white/10 bg-gray-100 dark:bg-white/[0.03]",children:[e("span",{className:"text-[0.7rem] text-gray-500 dark:text-white/40 font-mono",children:s[1]}),e("button",{type:"button",onClick:()=>{return e=i,navigator.clipboard.writeText(e),o(e),void setTimeout(()=>o(null),2e3);var e},className:"p-0.5 rounded-sm hover:bg-gray-200 dark:hover:bg-white/10 transition-colors",children:a===i?e(N,{size:14,className:"text-green-500"}):e(_,{size:14,className:"text-gray-400 dark:text-white/40"})})]}),e("pre",{className:"m-0 px-3 py-2 overflow-x-auto",children:e("code",{className:"font-mono text-xs leading-[1.7] text-gray-800 dark:text-white/90 whitespace-pre",children:i})})]}):e("code",{className:"bg-gray-100 dark:bg-white/[0.08] px-1.5 py-0.5 rounded-sm font-mono text-xs text-[var(--chat-accent)]",children:r})},ul:({children:t})=>e("ul",{className:"pl-5 mb-3 text-[0.8125rem] text-gray-900 dark:text-white/90 [&_li]:mb-1 marker:text-[var(--chat-accent)]/50",children:t}),ol:({children:t})=>e("ol",{className:"pl-5 mb-3 text-[0.8125rem] text-gray-900 dark:text-white/90 [&_li]:mb-1 marker:text-[var(--chat-accent)]/50",children:t}),blockquote:({children:t})=>e("blockquote",{className:"my-3 border-l-2 border-[var(--chat-accent)]/30 bg-[var(--chat-accent)]/[0.03] pl-4 pr-3 py-2 rounded-r-md italic text-gray-500 dark:text-white/60",children:t}),a:({href:t,children:n})=>e("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-[var(--chat-accent)] underline underline-offset-2 hover:brightness-125",children:n}),h1:({children:t})=>e("h1",{className:"mt-4 first:mt-0 mb-2 font-bold text-base text-gray-900 dark:text-white",children:t}),h2:({children:t})=>e("h2",{className:"mt-3 first:mt-0 mb-2 font-bold text-[0.9rem] text-gray-900 dark:text-white",children:t}),h3:({children:t})=>e("h3",{className:"mt-3 first:mt-0 mb-1.5 font-semibold text-[0.85rem] text-gray-900 dark:text-white",children:t}),table:({children:t})=>e("div",{className:"my-3 overflow-x-auto rounded-lg border border-gray-200 dark:border-white/10",children:e("table",{className:"w-full border-collapse text-xs",children:t})}),th:({children:t})=>e("th",{className:"px-3 py-2 text-left font-semibold bg-gray-50 dark:bg-white/[0.04] border-b border-gray-200 dark:border-white/10 text-gray-900 dark:text-white",children:t}),td:({children:t})=>e("td",{className:"px-3 py-2 border-b border-gray-200 dark:border-white/10 text-gray-700 dark:text-white/80",children:t})},children:n})},ne=({messages:s,isLoading:i,agentStatus:l,agentName:c,logoIcon:d,t:h})=>{const g=a(null),[u,m]=r(null);return o(()=>{g.current?.scrollIntoView({behavior:"smooth"})},[s]),t("div",{className:"flex-1 overflow-y-auto px-4 py-3 flex flex-col gap-4 filigran-chat-scrollable",children:[s.map(r=>{const a="assistant"===r.role,o=!r.content;return a&&o&&i?e("div",{children:e(ee,{agentStatus:l,logoIcon:d,t:h})},r.id):t("div",{className:"flex flex-col "+(a?"items-start":"items-end"),children:[a&&t("div",{className:"flex items-center gap-1.5 mb-1",children:[e("div",{className:"w-6 h-6 rounded-lg flex items-center justify-center bg-gradient-to-br from-[var(--chat-accent)]/20 to-[var(--chat-accent)]/5",children:e("span",{className:"text-[var(--chat-accent)] [&>svg]:w-3 [&>svg]:h-3",children:d})}),e("span",{className:"font-semibold text-xs text-gray-900 dark:text-white",children:c})]}),a&&!o&&i&&l?.thinkingContent&&e(Y,{content:l.thinkingContent}),r.files&&r.files.length>0&&e("div",{className:"flex gap-1.5 flex-wrap mb-1.5",children:r.files.map((n,r)=>t("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-gray-200 dark:border-white/10 text-[0.7rem] text-gray-600 dark:text-white/60",children:[e(A,{size:14}),n.name]},r))}),t("div",{className:"max-w-[90%] "+(a?"pl-1 py-1 text-[0.8125rem] leading-7":"px-3.5 py-2 rounded-[14px_14px_4px_14px] bg-[var(--chat-accent-dark)] text-white text-[0.8125rem] leading-6"),children:[a?e(te,{content:r.content}):r.content,a&&o&&!i&&e("span",{className:"text-[0.8125rem] text-gray-400 dark:text-white/40 italic",children:"..."}),a&&!o&&i&&e("span",{className:"inline-block w-1.5 h-4 bg-[var(--chat-accent)]/70 rounded-xs ml-0.5 animate-pulse align-text-bottom"})]}),a&&!o&&!i&&r.toolNames&&r.toolNames.length>0&&t(n,{children:[e("button",{type:"button",onClick:()=>m(u===r.id?null:r.id),className:"mt-0.5 p-1 rounded-lg opacity-50 hover:opacity-100 hover:text-[var(--chat-accent)] transition-opacity",title:h("Reasoning details"),children:e(D,{size:14})}),u===r.id&&t("div",{className:"mt-1.5 p-3 rounded-lg bg-gray-50 dark:bg-white/[0.04] border border-gray-200 dark:border-white/10",children:[t("p",{className:"text-[0.7rem] text-gray-500 dark:text-white/40 mb-1.5",children:[r.iterations&&r.iterations>1?`${r.iterations} iterations · `:"",r.toolCallCount??r.toolNames.length," ",1===(r.toolCallCount??r.toolNames.length)?h("tool call"):h("tool calls")]}),e("div",{className:"flex flex-wrap gap-1",children:Array.from(new Set(r.toolNames)).map(t=>e("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full border border-gray-200 dark:border-white/10 text-[0.68rem] font-mono text-gray-500 dark:text-white/40",children:t.replace(/_/g," ")},t))})]})]})]},r.id)}),e("div",{ref:g})]})},re=({firstName:n,logoIcon:r,promptSuggestions:a,onPromptClick:o,t:s})=>t("div",{className:"flex-1 flex flex-col items-center justify-center px-6 pb-8",children:[e("span",{className:"text-[var(--chat-accent)] mb-4 [&>svg]:w-12 [&>svg]:h-12 drop-shadow-[0_0_12px_var(--chat-accent-40)]",children:r}),t("h2",{className:"text-xl font-medium mb-6 text-center text-gray-900 dark:text-white",style:{fontFamily:'"Geologica", sans-serif'},children:[s("How can I help you, "),n,"?"]}),t("div",{className:"w-full max-w-[320px]",children:[e("span",{className:"block text-center mb-2 text-[0.65rem] tracking-[1.5px] uppercase text-[var(--chat-accent)] font-semibold",children:s("Suggestions")}),a.map(t=>e("button",{type:"button",onClick:()=>o(t),className:"w-full text-left text-[0.8125rem] text-gray-800 dark:text-white py-1.5 px-3 mb-1 rounded-lg border border-gray-200 dark:border-white/10 bg-transparent transition-colors hover:bg-[var(--chat-accent-10)] hover:border-[var(--chat-accent-50)]",children:s(t)},t))]})]}),ae=["Help me create a new simulation scenario","What are the latest attack patterns?","How do I configure detection rules?","Summarize my recent findings"],oe=({mode:n,onClose:s,onModeChange:i,topOffset:l=0,apiBaseUrl:c,apiEndpoints:g,agentDashboardUrl:u,user:m,t:p=h,accentColor:w="#7b5cff",logoIcon:v,promptSuggestions:y=ae,resizable:N=!1,onWidthChange:C,onResizeStart:S,onResizeEnd:_,pushContentSelector:L,backendType:M="rest"})=>{const[z,A]=r(!1),{agents:T,selectedAgent:E,agentMenuOpen:$,setAgentMenuOpen:R,handleSwitchAgent:D}=function({apiBaseUrl:e,apiEndpoints:t,backendType:n="rest"}){const[a,s]=r([]),[i,l]=r(null),[c,d]=r(!1);return o(()=>{null===t?.agents||t?.singleEndpoint||"legacy"===n||fetch(`${e}${t?.agents??"/chat/agents"}`).then(e=>e.ok?e.json():[]).then(e=>{if(s(e),e.length>0&&!i){const t=localStorage.getItem(f),n=t?e.find(e=>e.slug===t):null;l(n||e[0])}}).catch(()=>{})},[e,t]),{agents:a,selectedAgent:i,setSelectedAgent:l,agentMenuOpen:c,setAgentMenuOpen:d,handleSwitchAgent:(e,t)=>{e.id!==i?.id?(l(e),e.slug&&localStorage.setItem(f,e.slug),d(!1),t?.()):d(!1)}}}({apiBaseUrl:c,apiEndpoints:g,backendType:M}),{messages:U,inputValue:j,setInputValue:W,isLoading:O,agentStatus:B,attachedFiles:F,conversationId:P,transferredAgent:G,historyLoadedRef:H,handleFileAdd:V,handlePaste:q,handleSendMessage:K,handleNewChat:X,handleStopGenerating:Z,setAttachedFiles:Y,setMessages:ee,setConversationId:te}=x({apiBaseUrl:c,apiEndpoints:g,backendType:M,agentSlug:E?.slug,t:p}),{sidebarWidth:oe,handleResizeStart:se,defaultWidth:ie,isResizing:le}=function({mode:e,resizable:t,onWidthChange:n,onResizeStart:s,onResizeEnd:i}){const[l,c]=r(()=>{if("undefined"==typeof window)return b;const e=localStorage.getItem(k);if(e){const t=parseInt(e,10);if(!Number.isNaN(t)&&t>=b)return t}return b}),[d,h]=r(!1),g=a(!1),u=a(l);u.current=l;const m=a(n);m.current=n;const p=a(i);return p.current=i,o(()=>{"sidebar"===e&&t&&m.current?.(u.current)},[e,t]),o(()=>{if("sidebar"!==e||!t)return;const n=e=>{if(!g.current)return;e.preventDefault();const t=window.innerWidth-e.clientX,n=.4*window.innerWidth,r=Math.min(Math.max(t,b),n);c(r),u.current=r,m.current?.(r)},r=()=>{g.current&&(g.current=!1,h(!1),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem(k,String(u.current)),p.current?.())},a=()=>{const e=.4*window.innerWidth;if(u.current>e){const t=Math.max(e,b);c(t),u.current=t,m.current?.(t)}};return document.addEventListener("mousemove",n),document.addEventListener("mouseup",r),window.addEventListener("resize",a),()=>{document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",r),window.removeEventListener("resize",a)}},[e,t]),{sidebarWidth:l,handleResizeStart:e=>{e.preventDefault(),g.current=!0,h(!0),document.body.style.cursor="col-resize",document.body.style.userSelect="none",s?.()},defaultWidth:b,isResizing:d}}({mode:n,resizable:N,onWidthChange:C,onResizeStart:S,onResizeEnd:_});o(()=>{const e="sidebar"===n?N?oe:ie:0,t=e>0?e+6:0;if(document.documentElement.style.setProperty("--chatbot-sidebar-width",`${t}px`),document.documentElement.style.setProperty("--chatbot-transition",le?"none":"all 225ms cubic-bezier(0.4, 0, 0.2, 1)"),L){const e=document.querySelector(L);if(e){const n=e.style.paddingRight,r=e.style.transition;return e.style.paddingRight=t>0?`${t}px`:"",e.style.transition=le?"none":"padding-right 225ms cubic-bezier(0.4, 0, 0.2, 1)",()=>{e.style.paddingRight=n,e.style.transition=r,document.documentElement.style.setProperty("--chatbot-sidebar-width","0px")}}}return()=>{document.documentElement.style.setProperty("--chatbot-sidebar-width","0px")}},[L,n,oe,ie,N,le]);const ce=v??e(I,{size:24}),de=m.firstName,he=G?.name||E?.name||"Assistant",ge={"--chat-accent":w,"--chat-accent-10":d(w,.1),"--chat-accent-40":d(w,.25),"--chat-accent-50":d(w,.5),"--chat-accent-dark":w};o(()=>{if(null===g?.sessions||g?.singleEndpoint||"legacy"===M||"ag-ui"===M)return;if(!P||H.current||!E)return;H.current=!0;const e=()=>{te(null),localStorage.removeItem("filigranChatConversationId")};fetch(`${c}${g?.sessions??"/chat/sessions"}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversation_id:P,agent_slug:E.slug})}).then(t=>t.ok?t.json():(e(),null)).then(e=>{if(!e?.messages?.length)return;const t=e.messages.map((e,t)=>({id:`restored-${t}`,role:e.role,content:e.content,timestamp:new Date}));ee(t)}).catch(()=>{e()})},[P,E,c,g,H,ee,te]);const ue=(()=>{const e="filigran-chatbot";switch(n){case"sidebar":return`${e} fixed right-0 bottom-0 flex flex-col bg-white dark:bg-[#1e1e2e] border-l border-gray-200 dark:border-white/10 z-[1200]`;case"floating":return`${e} fixed bottom-5 right-5 flex flex-col bg-white dark:bg-[#1e1e2e] rounded-xl shadow-[0_8px_32px_rgba(0,0,0,0.15)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.4)] z-[1300] border border-gray-200 dark:border-white/10`;case"fullscreen":return`${e} fixed right-0 bottom-0 left-0 flex flex-col bg-gray-50 dark:bg-[#161622] z-[1400]`;default:return e}})(),me={...ge,..."sidebar"===n?{top:l,width:N?oe:ie}:"floating"===n?{width:380,height:560}:{top:l}};return t("div",{className:ue,style:me,children:["sidebar"===n&&N&&e("div",{onMouseDown:se,className:"absolute top-0 -left-1 bottom-0 w-2 cursor-col-resize z-10 group",children:e("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 bottom-0 w-0.5 rounded-sm bg-[var(--chat-accent)] opacity-0 transition-opacity group-hover:opacity-100 group-active:opacity-100"})}),e(J,{mode:n,agentName:he,agents:T,selectedAgent:E,transferredFrom:G?E?.name:void 0,agentMenuOpen:$,onAgentMenuToggle:()=>R(e=>!e),onAgentMenuClose:()=>R(!1),onSwitchAgent:e=>{e&&D(e,()=>{X()})},modeMenuOpen:z,onModeMenuToggle:()=>A(e=>!e),onModeMenuClose:()=>A(!1),onModeChange:i,onNewChat:X,onClose:s,logoIcon:ce,agentDashboardUrl:u,t:p}),0===U.length?e(re,{firstName:de,logoIcon:ce,promptSuggestions:y,onPromptClick:W,t:p}):e(ne,{messages:U,isLoading:O,agentStatus:B,agentName:he,logoIcon:ce,t:p}),e(Q,{inputValue:j,onInputChange:W,onSend:K,onStop:Z,isLoading:O,attachedFiles:F,onFileAdd:V,onFileRemove:e=>Y(t=>t.filter((t,n)=>n!==e)),onPaste:q,t:p,mode:n})]})},se=({isOpen:n,onToggle:r,label:a="Ask Assistant",accentColor:o="#7b5cff",icon:s})=>{const i=s??e(I,{size:16});return t("button",{type:"button",onClick:r,className:"filigran-chatbot inline-flex items-center gap-1.5 px-3 py-[3px] text-[0.8125rem] font-medium whitespace-nowrap rounded-md border transition-colors",style:{borderColor:n?o:d(o,.5),color:o,backgroundColor:n?d(o,.1):"transparent"},onMouseEnter:e=>{e.currentTarget.style.borderColor=o,e.currentTarget.style.backgroundColor=d(o,.1)},onMouseLeave:e=>{e.currentTarget.style.borderColor=n?o:d(o,.5),e.currentTarget.style.backgroundColor=n?d(o,.1):"transparent"},children:[e("span",{className:"[&>svg]:w-4 [&>svg]:h-4",children:i}),a]})};export{oe as ChatPanel,se as ChatToggleButton};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/utils/index.ts","../../src/hooks/protocols/parseLegacyEvent.ts","../../src/hooks/protocols/parseRestEvent.ts","../../src/hooks/protocols/parseAgUiEvent.ts","../../src/hooks/useChat.ts","../../src/hooks/useAgents.ts","../../src/hooks/useSidebarResize.ts","../../src/components/icons/AttachFileIcon.tsx","../../src/components/icons/BrainIcon.tsx","../../src/components/icons/CheckIcon.tsx","../../src/components/icons/ChevronDownIcon.tsx","../../src/components/icons/CloseIcon.tsx","../../src/components/icons/CopyIcon.tsx","../../src/components/icons/DatabaseIcon.tsx","../../src/components/icons/DefaultLogoIcon.tsx","../../src/components/icons/EditIcon.tsx","../../src/components/icons/ExternalLinkIcon.tsx","../../src/components/icons/FileIcon.tsx","../../src/components/icons/FloatingIcon.tsx","../../src/components/icons/FullscreenExitIcon.tsx","../../src/components/icons/FullscreenIcon.tsx","../../src/components/icons/GlobeIcon.tsx","../../src/components/icons/InfoIcon.tsx","../../src/components/icons/MailIcon.tsx","../../src/components/icons/SearchIcon.tsx","../../src/components/icons/SendIcon.tsx","../../src/components/icons/SidebarIcon.tsx","../../src/components/icons/SparklesIcon.tsx","../../src/components/icons/StopCircleIcon.tsx","../../src/components/icons/TerminalIcon.tsx","../../src/components/icons/UserPlusIcon.tsx","../../src/components/icons/WrenchIcon.tsx","../../src/components/Dropdown.tsx","../../src/hooks/useClickOutside.ts","../../src/components/Spinner.tsx","../../src/components/Tooltip.tsx","../../src/components/ChatHeader.tsx","../../src/components/ChatInput.tsx","../../src/components/ChatThinking.tsx","../../src/components/MarkdownMessage.tsx","../../src/components/ChatMessages.tsx","../../src/components/ChatWelcome.tsx","../../src/components/ChatPanel.tsx","../../src/components/ChatToggleButton.tsx"],"sourcesContent":["export function hexAlpha(hex: string, alpha: number): string {\n const a = Math.round(alpha * 255)\n .toString(16)\n .padStart(2, '0');\n return `${hex}${a}`;\n}\n\nexport const identity = (key: string) => key;\n","import type { ParsedAction, ProtocolContext } from './types';\n\n/**\n * Parse a Flowise-style SSE event into a normalized action.\n */\nexport function parseLegacyEvent(evt: Record<string, unknown>, ctx: ProtocolContext): ParsedAction {\n const eventType = evt.event as string | undefined;\n\n if (eventType === 'nextAgentFlow') {\n const data = evt.data as Record<string, unknown> | undefined;\n const nodeId = data?.nodeId as string | undefined;\n if (data?.status === 'INPROGRESS' && nodeId) {\n ctx.activeNodeId = nodeId;\n }\n return { action: 'noop' };\n }\n\n if (eventType === 'start') {\n return { action: 'noop' };\n }\n\n if (eventType === 'token') {\n const tokenData = ((evt.data as string) ?? '').replace(/<br\\s*\\/?>/g, '\\n');\n return { action: 'stream', content: tokenData };\n }\n\n if (eventType === 'agentReasoning') {\n const reasoning = evt.data as Record<string, unknown> | undefined;\n const usedTools = reasoning?.usedTools as Array<{ tool: string }> | undefined;\n if (usedTools?.length) {\n ctx.hasUsedTools = true;\n return { action: 'status', status: 'tool_start', tools: usedTools.map((t) => t.tool) };\n }\n if (ctx.hasUsedTools) {\n return { action: 'status', status: 'analyzing' };\n }\n return { action: 'status', status: 'thinking' };\n }\n\n if (eventType === 'usedTools') {\n ctx.hasUsedTools = true;\n const data = evt.data as Array<{ tool: string }> | undefined;\n const toolNames = Array.isArray(data) ? data.map((t) => t.tool) : [];\n return { action: 'status', status: 'tool_start', tools: toolNames };\n }\n\n if (eventType === 'metadata') {\n const data = evt.data as Record<string, unknown> | undefined;\n const chatId = data?.chatId as string | undefined;\n if (chatId) {\n return { action: 'set_chat_id', chatId };\n }\n return { action: 'noop' };\n }\n\n if (eventType === 'error') {\n return { action: 'error', content: (evt.data as string) || '' };\n }\n\n if (eventType === 'end') {\n return { action: 'done', content: '' };\n }\n\n return { action: 'noop' };\n}\n","import type { ParsedAction, ProtocolContext } from './types';\n\n/**\n * Parse an XTM One (REST) SSE event into a normalized action.\n */\nexport function parseRestEvent(evt: Record<string, unknown>, ctx: ProtocolContext): ParsedAction {\n const type = evt.type as string | undefined;\n\n if (type === 'error') {\n return { action: 'error', content: (evt.content as string) || '' };\n }\n\n if (type === 'status') {\n const st = evt.status as string;\n if (st === 'tool_done' || st === 'wind_down') {\n return { action: 'noop' };\n }\n if (st === 'streaming') {\n return { action: 'status', status: 'streaming' };\n }\n if (st === 'thinking_text') {\n return { action: 'status', status: 'thinking_text', thinkingContent: evt.content as string };\n }\n if (st === 'tool_start') {\n ctx.hasUsedTools = true;\n return { action: 'status', status: 'tool_start', tools: evt.tools as string[] | undefined };\n }\n if (st === 'thinking' && ctx.hasUsedTools) {\n return { action: 'status', status: 'analyzing' };\n }\n return { action: 'status', status: st, tools: evt.tools as string[] | undefined };\n }\n\n if (type === 'stream') {\n return { action: 'stream', content: evt.content as string };\n }\n\n if (type === 'done') {\n return {\n action: 'done',\n content: evt.content as string,\n conversationId: evt.conversation_id as string | undefined,\n toolNames: evt.tool_names as string[] | undefined,\n toolCallCount: evt.tool_call_count as number | undefined,\n iterations: evt.iterations as number | undefined,\n transferAgentId: evt.transfer_agent_id as string | undefined,\n transferAgentName: evt.transfer_agent_name as string | undefined,\n };\n }\n\n return { action: 'noop' };\n}\n","import type { ParsedAction, ProtocolContext } from './types';\n\n/**\n * AG-UI protocol event types.\n * @see https://github.com/ag-ui-protocol/ag-ui\n */\n\n/**\n * Parse an AG-UI protocol SSE event into a normalized action.\n *\n * AG-UI uses a Start/Content/End lifecycle for messages and tool calls.\n * We map these to the same internal actions used by the other protocols.\n */\nexport function parseAgUiEvent(evt: Record<string, unknown>, ctx: ProtocolContext): ParsedAction {\n const type = evt.type as string | undefined;\n\n // --- Run lifecycle ---\n\n if (type === 'RUN_STARTED') {\n return { action: 'status', status: 'thinking' };\n }\n\n if (type === 'RUN_FINISHED') {\n return { action: 'done', content: '' };\n }\n\n if (type === 'RUN_ERROR') {\n return { action: 'error', content: (evt.message as string) || 'Unknown error' };\n }\n\n // --- Step lifecycle ---\n\n if (type === 'STEP_STARTED') {\n const stepName = evt.stepName as string | undefined;\n return { action: 'status', status: stepName || 'thinking' };\n }\n\n if (type === 'STEP_FINISHED') {\n return { action: 'noop' };\n }\n\n // --- Text message streaming ---\n\n if (type === 'TEXT_MESSAGE_START') {\n return { action: 'status', status: 'streaming' };\n }\n\n if (type === 'TEXT_MESSAGE_CONTENT') {\n const delta = evt.delta as string;\n if (delta) {\n return { action: 'stream', content: delta };\n }\n return { action: 'noop' };\n }\n\n if (type === 'TEXT_MESSAGE_END') {\n return { action: 'noop' };\n }\n\n // TEXT_MESSAGE_CHUNK is a convenience event that combines Start+Content+End\n if (type === 'TEXT_MESSAGE_CHUNK') {\n const delta = evt.delta as string | undefined;\n if (delta) {\n return { action: 'stream', content: delta };\n }\n return { action: 'noop' };\n }\n\n // --- Tool call lifecycle ---\n\n if (type === 'TOOL_CALL_START') {\n ctx.hasUsedTools = true;\n const toolName = evt.toolCallName as string | undefined;\n return { action: 'status', status: 'tool_start', tools: toolName ? [toolName] : [] };\n }\n\n if (type === 'TOOL_CALL_ARGS') {\n // Tool arguments streaming — no UI equivalent, skip\n return { action: 'noop' };\n }\n\n if (type === 'TOOL_CALL_END') {\n return { action: 'status', status: 'analyzing' };\n }\n\n if (type === 'TOOL_CALL_RESULT') {\n // Tool result — no direct UI mapping, skip\n return { action: 'noop' };\n }\n\n if (type === 'TOOL_CALL_CHUNK') {\n // Convenience form — treat like TOOL_CALL_START if it has a name\n const toolName = evt.toolCallName as string | undefined;\n if (toolName) {\n ctx.hasUsedTools = true;\n return { action: 'status', status: 'tool_start', tools: [toolName] };\n }\n return { action: 'noop' };\n }\n\n // --- Reasoning / thinking ---\n\n if (type === 'REASONING_START' || type === 'REASONING_MESSAGE_START') {\n return { action: 'status', status: 'thinking' };\n }\n\n if (type === 'REASONING_MESSAGE_CONTENT' || type === 'REASONING_MESSAGE_CHUNK') {\n // Reasoning text — show as thinking status (content not surfaced to chat)\n return { action: 'status', status: 'thinking' };\n }\n\n if (type === 'REASONING_MESSAGE_END' || type === 'REASONING_END' || type === 'REASONING_ENCRYPTED_VALUE') {\n return { action: 'noop' };\n }\n\n // --- State management ---\n\n if (type === 'STATE_SNAPSHOT' || type === 'STATE_DELTA' || type === 'MESSAGES_SNAPSHOT') {\n // State sync — not mapped to chat UI currently\n return { action: 'noop' };\n }\n\n // --- Activity events ---\n\n if (type === 'ACTIVITY_SNAPSHOT' || type === 'ACTIVITY_DELTA') {\n return { action: 'noop' };\n }\n\n // --- Pass-through / custom ---\n\n if (type === 'RAW' || type === 'CUSTOM') {\n return { action: 'noop' };\n }\n\n return { action: 'noop' };\n}\n","import { useRef, useState } from 'react';\nimport type { AgentStatusState, ApiEndpoints, BackendType, ChatFile, ChatMessage } from '../types';\nimport type { ParsedAction, ProtocolContext } from './protocols';\nimport { parseAgUiEvent, parseLegacyEvent, parseRestEvent } from './protocols';\n\nconst STORAGE_KEY = 'filigranChatConversationId';\nconst LEGACY_CHAT_ID_KEY = 'filigranChatLegacyChatId';\n\ninterface UseChatOptions {\n apiBaseUrl: string;\n apiEndpoints?: ApiEndpoints;\n backendType?: BackendType;\n agentSlug: string | null | undefined;\n t: (key: string) => string;\n}\n\nexport interface TransferredAgent {\n id: string;\n name: string;\n}\n\ninterface UseChatReturn {\n messages: ChatMessage[];\n inputValue: string;\n setInputValue: (value: string) => void;\n isLoading: boolean;\n agentStatus: AgentStatusState | null;\n attachedFiles: ChatFile[];\n conversationId: string | null;\n transferredAgent: TransferredAgent | null;\n historyLoadedRef: React.MutableRefObject<boolean>;\n handleFileAdd: (fileList: FileList | null) => void;\n handlePaste: (e: React.ClipboardEvent) => void;\n handleSendMessage: () => Promise<void>;\n handleNewChat: () => void;\n handleStopGenerating: () => void;\n setAttachedFiles: React.Dispatch<React.SetStateAction<ChatFile[]>>;\n setMessages: React.Dispatch<React.SetStateAction<ChatMessage[]>>;\n setConversationId: React.Dispatch<React.SetStateAction<string | null>>;\n}\n\nfunction getParser(backendType: BackendType): (evt: Record<string, unknown>, ctx: ProtocolContext) => ParsedAction {\n switch (backendType) {\n case 'legacy':\n return parseLegacyEvent;\n case 'ag-ui':\n return parseAgUiEvent;\n default:\n return parseRestEvent;\n }\n}\n\nfunction buildRequestBody(\n backendType: BackendType,\n content: string,\n opts: { legacyChatId: string | null; conversationId: string | null; agentSlug: string | null | undefined },\n): Record<string, unknown> {\n switch (backendType) {\n case 'legacy':\n return { question: content, chatId: opts.legacyChatId ?? undefined, streaming: true };\n case 'ag-ui':\n return {\n threadId: opts.conversationId ?? crypto.randomUUID(),\n runId: crypto.randomUUID(),\n messages: [{ id: crypto.randomUUID(), role: 'user', content }],\n tools: [],\n context: [],\n state: {},\n forwardedProps: opts.agentSlug ? { agentSlug: opts.agentSlug } : {},\n };\n default:\n return { content, conversation_id: opts.conversationId, agent_slug: opts.agentSlug };\n }\n}\n\nexport function useChat({ apiBaseUrl, apiEndpoints, backendType = 'rest', agentSlug, t }: UseChatOptions): UseChatReturn {\n const isLegacy = backendType === 'legacy';\n const [messages, setMessages] = useState<ChatMessage[]>([]);\n const [inputValue, setInputValue] = useState('');\n const [isLoading, setIsLoading] = useState(false);\n const [agentStatus, setAgentStatus] = useState<AgentStatusState | null>(null);\n const [conversationId, setConversationId] = useState<string | null>(() => {\n if (typeof window === 'undefined') return null;\n return localStorage.getItem(STORAGE_KEY);\n });\n const [attachedFiles, setAttachedFiles] = useState<ChatFile[]>([]);\n const [transferredAgent, setTransferredAgent] = useState<TransferredAgent | null>(null);\n const [legacyChatId, setLegacyChatId] = useState<string | null>(() => {\n if (typeof window === 'undefined') return null;\n return localStorage.getItem(LEGACY_CHAT_ID_KEY);\n });\n\n const historyLoadedRef = useRef(false);\n const abortControllerRef = useRef<AbortController | null>(null);\n const hasUsedToolsRef = useRef(false);\n\n // Determine message endpoint URL\n const getMessagesUrl = () => {\n if (isLegacy || apiEndpoints?.singleEndpoint) {\n return apiBaseUrl; // POST directly to base URL\n }\n return `${apiBaseUrl}${apiEndpoints?.messages ?? '/chat/messages'}`;\n };\n\n const handleFileAdd = (fileList: FileList | null) => {\n if (!fileList) return;\n const newFiles: ChatFile[] = [];\n Array.from(fileList).forEach((file) => {\n const reader = new FileReader();\n reader.onload = () => {\n newFiles.push({\n name: file.name,\n type: file.type,\n size: file.size,\n dataUrl: reader.result as string,\n });\n if (newFiles.length === fileList.length) {\n setAttachedFiles((prev) => [...prev, ...newFiles]);\n }\n };\n reader.readAsDataURL(file);\n });\n };\n\n const handlePaste = (e: React.ClipboardEvent) => {\n const { files } = e.clipboardData;\n if (files.length > 0) {\n e.preventDefault();\n handleFileAdd(files);\n }\n };\n\n const handleSendMessage = async () => {\n if ((!inputValue.trim() && attachedFiles.length === 0) || isLoading) return;\n const content = inputValue.trim();\n\n const userMsg: ChatMessage = {\n id: crypto.randomUUID(),\n role: 'user',\n content,\n timestamp: new Date(),\n files: attachedFiles.length > 0 ? [...attachedFiles] : undefined,\n };\n setMessages((prev) => [...prev, userMsg]);\n setInputValue('');\n setAttachedFiles([]);\n setIsLoading(true);\n setAgentStatus({ status: 'thinking' });\n hasUsedToolsRef.current = false;\n\n const assistantId = crypto.randomUUID();\n setMessages((prev) => [...prev, { id: assistantId, role: 'assistant', content: '', timestamp: new Date() }]);\n\n try {\n const controller = new AbortController();\n abortControllerRef.current = controller;\n\n const requestBody = buildRequestBody(backendType, content, { legacyChatId, conversationId, agentSlug });\n\n const res = await fetch(getMessagesUrl(), {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(requestBody),\n signal: controller.signal,\n });\n\n if (!res.ok || !res.body) {\n setMessages((prev) =>\n prev.map((m) => (m.id === assistantId ? { ...m, content: t('Unable to connect. Please check the configuration.') } : m)),\n );\n return;\n }\n\n const parseEvent = getParser(backendType);\n const ctx: ProtocolContext = { hasUsedTools: false, activeNodeId: '' };\n\n const reader = res.body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n let accumulated = '';\n let doneReceived = false;\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() || '';\n for (const rawLine of lines) {\n const line = rawLine.replace(/\\r$/, '');\n if (!line.startsWith('data:')) continue;\n const jsonStr = line.startsWith('data: ') ? line.slice(6) : line.slice(5);\n try {\n const evt = JSON.parse(jsonStr) as Record<string, unknown>;\n const parsed: ParsedAction = parseEvent(evt, ctx);\n\n // Sync ref → context for cross-event tracking\n ctx.hasUsedTools = ctx.hasUsedTools || hasUsedToolsRef.current;\n\n switch (parsed.action) {\n case 'status':\n if (parsed.status === 'tool_start') hasUsedToolsRef.current = true;\n if (parsed.status === 'thinking_text') {\n setAgentStatus((prev) => ({\n ...prev,\n status: prev?.status ?? 'thinking',\n thinkingContent: (prev?.thinkingContent ?? '') + (parsed.thinkingContent ?? ''),\n }));\n } else {\n setAgentStatus((prev) => ({\n status: parsed.status,\n tools: parsed.tools,\n thinkingContent: prev?.thinkingContent,\n }));\n }\n break;\n\n case 'stream':\n accumulated += parsed.content;\n setAgentStatus((prev) => ({ status: 'streaming', thinkingContent: prev?.thinkingContent }));\n setMessages((prev) => prev.map((m) => (m.id === assistantId ? { ...m, content: accumulated } : m)));\n break;\n\n case 'done':\n doneReceived = true;\n if (parsed.conversationId) {\n setConversationId(parsed.conversationId);\n localStorage.setItem(STORAGE_KEY, parsed.conversationId);\n }\n if (parsed.transferAgentId && parsed.transferAgentName) {\n setTransferredAgent({ id: parsed.transferAgentId, name: parsed.transferAgentName });\n }\n setMessages((prev) =>\n prev.map((m) =>\n m.id === assistantId\n ? {\n ...m,\n content: parsed.content || accumulated,\n toolNames: parsed.toolNames,\n toolCallCount: parsed.toolCallCount,\n iterations: parsed.iterations,\n }\n : m,\n ),\n );\n break;\n\n case 'error':\n setMessages((prev) =>\n prev.map((m) =>\n m.id === assistantId ? { ...m, content: parsed.content || t('Unable to connect. Please check the configuration.') } : m,\n ),\n );\n return;\n\n case 'set_chat_id':\n setLegacyChatId(parsed.chatId);\n localStorage.setItem(LEGACY_CHAT_ID_KEY, parsed.chatId);\n break;\n\n case 'noop':\n break;\n }\n\n // Keep ref in sync with context\n hasUsedToolsRef.current = ctx.hasUsedTools;\n } catch {\n /* skip malformed SSE */\n }\n }\n }\n if (accumulated && !doneReceived) {\n setMessages((prev) => prev.map((m) => (m.id === assistantId ? { ...m, content: accumulated || 'No response.' } : m)));\n }\n } catch (err) {\n if (err instanceof DOMException && err.name === 'AbortError') return;\n setMessages((prev) =>\n prev.map((m) => (m.id === assistantId ? { ...m, content: t('Sorry, an error occurred. Please try again.') } : m)),\n );\n } finally {\n abortControllerRef.current = null;\n setIsLoading(false);\n setAgentStatus(null);\n hasUsedToolsRef.current = false;\n }\n };\n\n const handleNewChat = () => {\n abortControllerRef.current?.abort();\n abortControllerRef.current = null;\n setMessages([]);\n setInputValue('');\n setAttachedFiles([]);\n setIsLoading(false);\n setAgentStatus(null);\n setTransferredAgent(null);\n hasUsedToolsRef.current = false;\n historyLoadedRef.current = false;\n if (isLegacy) {\n setLegacyChatId(null);\n localStorage.removeItem(LEGACY_CHAT_ID_KEY);\n } else {\n setConversationId(null);\n localStorage.removeItem(STORAGE_KEY);\n }\n };\n\n const handleStopGenerating = () => {\n abortControllerRef.current?.abort();\n abortControllerRef.current = null;\n setIsLoading(false);\n setAgentStatus(null);\n hasUsedToolsRef.current = false;\n setMessages((prev) => prev.filter((m) => !(m.role === 'assistant' && !m.content)));\n };\n\n return {\n messages,\n inputValue,\n setInputValue,\n isLoading,\n agentStatus,\n attachedFiles,\n conversationId,\n transferredAgent,\n historyLoadedRef,\n handleFileAdd,\n handlePaste,\n handleSendMessage,\n handleNewChat,\n handleStopGenerating,\n setAttachedFiles,\n setMessages,\n setConversationId,\n };\n}\n","import { useEffect, useState } from 'react';\nimport type { ApiEndpoints, BackendType, XtmAgent } from '../types';\n\nconst STORAGE_AGENT_KEY = 'filigranChatAgentSlug';\n\ninterface UseAgentsOptions {\n apiBaseUrl: string;\n apiEndpoints?: ApiEndpoints;\n backendType?: BackendType;\n}\n\ninterface UseAgentsReturn {\n agents: XtmAgent[];\n selectedAgent: XtmAgent | null;\n setSelectedAgent: React.Dispatch<React.SetStateAction<XtmAgent | null>>;\n agentMenuOpen: boolean;\n setAgentMenuOpen: React.Dispatch<React.SetStateAction<boolean>>;\n handleSwitchAgent: (agent: XtmAgent, onSwitch?: () => void) => void;\n}\n\nexport function useAgents({ apiBaseUrl, apiEndpoints, backendType = 'rest' }: UseAgentsOptions): UseAgentsReturn {\n const [agents, setAgents] = useState<XtmAgent[]>([]);\n const [selectedAgent, setSelectedAgent] = useState<XtmAgent | null>(null);\n const [agentMenuOpen, setAgentMenuOpen] = useState(false);\n\n useEffect(() => {\n // Skip agents fetch if disabled, using single endpoint mode, or legacy backend\n if (apiEndpoints?.agents === null || apiEndpoints?.singleEndpoint || backendType === 'legacy') {\n return;\n }\n const agentsUrl = `${apiBaseUrl}${apiEndpoints?.agents ?? '/chat/agents'}`;\n fetch(agentsUrl)\n .then((res) => (res.ok ? res.json() : []))\n .then((data: XtmAgent[]) => {\n setAgents(data);\n if (data.length > 0 && !selectedAgent) {\n const savedSlug = localStorage.getItem(STORAGE_AGENT_KEY);\n const match = savedSlug ? data.find((a) => a.slug === savedSlug) : null;\n setSelectedAgent(match || data[0]);\n }\n })\n .catch(() => {});\n }, [apiBaseUrl, apiEndpoints]);\n\n const handleSwitchAgent = (agent: XtmAgent, onSwitch?: () => void) => {\n if (agent.id === selectedAgent?.id) {\n setAgentMenuOpen(false);\n return;\n }\n setSelectedAgent(agent);\n if (agent.slug) localStorage.setItem(STORAGE_AGENT_KEY, agent.slug);\n setAgentMenuOpen(false);\n onSwitch?.();\n };\n\n return {\n agents,\n selectedAgent,\n setSelectedAgent,\n agentMenuOpen,\n setAgentMenuOpen,\n handleSwitchAgent,\n };\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { ChatMode } from '../types';\n\nconst SIDEBAR_WIDTH = 400;\nconst SIDEBAR_WIDTH_STORAGE_KEY = 'filigranChatSidebarWidth';\nconst MAX_SIDEBAR_RATIO = 0.4;\n\ninterface UseSidebarResizeOptions {\n mode: ChatMode;\n resizable: boolean;\n onWidthChange?: (width: number) => void;\n onResizeStart?: () => void;\n onResizeEnd?: () => void;\n}\n\ninterface UseSidebarResizeReturn {\n sidebarWidth: number;\n handleResizeStart: (e: React.MouseEvent) => void;\n defaultWidth: number;\n isResizing: boolean;\n}\n\nexport function useSidebarResize({\n mode,\n resizable,\n onWidthChange,\n onResizeStart,\n onResizeEnd,\n}: UseSidebarResizeOptions): UseSidebarResizeReturn {\n const [sidebarWidth, setSidebarWidth] = useState<number>(() => {\n if (typeof window === 'undefined') return SIDEBAR_WIDTH;\n const stored = localStorage.getItem(SIDEBAR_WIDTH_STORAGE_KEY);\n if (stored) {\n const parsed = parseInt(stored, 10);\n if (!Number.isNaN(parsed) && parsed >= SIDEBAR_WIDTH) return parsed;\n }\n return SIDEBAR_WIDTH;\n });\n const [isResizing, setIsResizing] = useState(false);\n\n const isResizingRef = useRef(false);\n const sidebarWidthRef = useRef(sidebarWidth);\n sidebarWidthRef.current = sidebarWidth;\n const onWidthChangeRef = useRef(onWidthChange);\n onWidthChangeRef.current = onWidthChange;\n const onResizeEndRef = useRef(onResizeEnd);\n onResizeEndRef.current = onResizeEnd;\n\n // Notify parent of sidebar width when entering sidebar mode\n useEffect(() => {\n if (mode === 'sidebar' && resizable) {\n onWidthChangeRef.current?.(sidebarWidthRef.current);\n }\n }, [mode, resizable]);\n\n // Resize event handlers\n useEffect(() => {\n if (mode !== 'sidebar' || !resizable) return undefined;\n\n const handleMouseMove = (e: MouseEvent) => {\n if (!isResizingRef.current) return;\n e.preventDefault();\n const newWidth = window.innerWidth - e.clientX;\n const maxWidth = window.innerWidth * MAX_SIDEBAR_RATIO;\n const clamped = Math.min(Math.max(newWidth, SIDEBAR_WIDTH), maxWidth);\n setSidebarWidth(clamped);\n sidebarWidthRef.current = clamped;\n onWidthChangeRef.current?.(clamped);\n };\n\n const handleMouseUp = () => {\n if (!isResizingRef.current) return;\n isResizingRef.current = false;\n setIsResizing(false);\n document.body.style.cursor = '';\n document.body.style.userSelect = '';\n localStorage.setItem(SIDEBAR_WIDTH_STORAGE_KEY, String(sidebarWidthRef.current));\n onResizeEndRef.current?.();\n };\n\n const handleWindowResize = () => {\n const maxWidth = window.innerWidth * MAX_SIDEBAR_RATIO;\n if (sidebarWidthRef.current > maxWidth) {\n const clamped = Math.max(maxWidth, SIDEBAR_WIDTH);\n setSidebarWidth(clamped);\n sidebarWidthRef.current = clamped;\n onWidthChangeRef.current?.(clamped);\n }\n };\n\n document.addEventListener('mousemove', handleMouseMove);\n document.addEventListener('mouseup', handleMouseUp);\n window.addEventListener('resize', handleWindowResize);\n\n return () => {\n document.removeEventListener('mousemove', handleMouseMove);\n document.removeEventListener('mouseup', handleMouseUp);\n window.removeEventListener('resize', handleWindowResize);\n };\n }, [mode, resizable]);\n\n const handleResizeStart = (e: React.MouseEvent) => {\n e.preventDefault();\n isResizingRef.current = true;\n setIsResizing(true);\n document.body.style.cursor = 'col-resize';\n document.body.style.userSelect = 'none';\n onResizeStart?.();\n };\n\n return {\n sidebarWidth,\n handleResizeStart,\n defaultWidth: SIDEBAR_WIDTH,\n isResizing,\n };\n}\n","import type { IconProps } from '../../types';\n\nexport const AttachFileIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const BrainIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z\" />\n <path d=\"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z\" />\n <path d=\"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4\" />\n <path d=\"M17.599 6.5a3 3 0 0 0 .399-1.375\" />\n <path d=\"M6.003 5.125A3 3 0 0 0 6.401 6.5\" />\n <path d=\"M3.477 10.896a4 4 0 0 1 .585-.396\" />\n <path d=\"M19.938 10.5a4 4 0 0 1 .585.396\" />\n <path d=\"M6 18a4 4 0 0 1-1.967-.516\" />\n <path d=\"M19.967 17.484A4 4 0 0 1 18 18\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const CheckIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const ChevronDownIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const CloseIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const CopyIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const DatabaseIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <ellipse cx=\"12\" cy=\"5\" rx=\"9\" ry=\"3\" />\n <path d=\"M3 5V19A9 3 0 0 0 21 19V5\" />\n <path d=\"M3 12A9 3 0 0 0 21 12\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const DefaultLogoIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"currentColor\" stroke=\"none\" className={className}>\n <path d=\"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const EditIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M12 20h9\" />\n <path d=\"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const ExternalLinkIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M15 3h6v6\" />\n <path d=\"M10 14 21 3\" />\n <path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const FileIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z\" />\n <path d=\"M14 2v4a2 2 0 0 0 2 2h4\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const FloatingIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M11 13H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7\" />\n <rect width=\"12\" height=\"12\" x=\"10\" y=\"10\" rx=\"2\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const FullscreenExitIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M8 3v3a2 2 0 0 1-2 2H3\" />\n <path d=\"M21 8h-3a2 2 0 0 1-2-2V3\" />\n <path d=\"M3 16h3a2 2 0 0 0 2 2v3\" />\n <path d=\"M16 21v-3a2 2 0 0 1 2-2h3\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const FullscreenIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M8 3H5a2 2 0 0 0-2 2v3\" />\n <path d=\"M21 8V5a2 2 0 0 0-2-2h-3\" />\n <path d=\"M3 16v3a2 2 0 0 0 2 2h3\" />\n <path d=\"M16 21h3a2 2 0 0 0 2-2v-3\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const GlobeIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20\" />\n <path d=\"M2 12h20\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const InfoIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const MailIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\" />\n <path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const SearchIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n <path d=\"m21 21-4.3-4.3\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const SendIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"m22 2-7 20-4-9-9-4Z\" />\n <path d=\"m22 2-11 11\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const SidebarIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M15 3v18\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const SparklesIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const StopCircleIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <rect width=\"6\" height=\"6\" x=\"9\" y=\"9\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const TerminalIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <polyline points=\"4 17 10 11 4 5\" />\n <line x1=\"12\" x2=\"20\" y1=\"19\" y2=\"19\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const UserPlusIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" />\n <line x1=\"19\" x2=\"19\" y1=\"8\" y2=\"14\" />\n <line x1=\"22\" x2=\"16\" y1=\"11\" y2=\"11\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const WrenchIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z\" />\n </svg>\n);\n","import { useCallback, useEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { useClickOutside } from '../hooks/useClickOutside';\n\ninterface DropdownProps {\n open: boolean;\n onClose: () => void;\n anchorRef: React.RefObject<HTMLElement | null>;\n placement?: 'bottom-start' | 'bottom-end';\n width?: number;\n children: React.ReactNode;\n}\n\nfunction findChatbotRoot(el: HTMLElement | null): HTMLElement {\n let node = el;\n while (node) {\n if (node.classList.contains('filigran-chatbot')) return node;\n node = node.parentElement;\n }\n return document.body;\n}\n\nexport const Dropdown = ({ open, onClose, anchorRef, placement = 'bottom-start', width = 280, children }: DropdownProps) => {\n const panelRef = useRef<HTMLDivElement>(null);\n const [pos, setPos] = useState({ top: 0, left: 0 });\n\n const stableOnClose = useCallback(() => onClose(), [onClose]);\n useClickOutside(panelRef, stableOnClose, open);\n\n useEffect(() => {\n if (!open || !anchorRef.current) return;\n const rect = anchorRef.current.getBoundingClientRect();\n const left = placement === 'bottom-end' ? rect.right - width : rect.left;\n setPos({ top: rect.bottom + 4, left });\n }, [open, anchorRef, placement, width]);\n\n if (!open) return null;\n\n const portalTarget = findChatbotRoot(anchorRef.current);\n\n return createPortal(\n <div\n ref={panelRef}\n className=\"fixed z-[10000] rounded-[10px] overflow-hidden border border-gray-200 dark:border-white/10 bg-white dark:bg-[#2a2a3e] shadow-xl\"\n style={{ top: pos.top, left: pos.left, width }}\n >\n {children}\n </div>,\n portalTarget,\n );\n};\n","import { useEffect, type RefObject } from 'react';\n\nexport function useClickOutside(ref: RefObject<HTMLElement | null>, handler: () => void, active = true) {\n useEffect(() => {\n if (!active) return undefined;\n const listener = (e: MouseEvent | TouchEvent) => {\n if (!ref.current || ref.current.contains(e.target as Node)) return;\n handler();\n };\n document.addEventListener('mousedown', listener);\n document.addEventListener('touchstart', listener);\n return () => {\n document.removeEventListener('mousedown', listener);\n document.removeEventListener('touchstart', listener);\n };\n }, [ref, handler, active]);\n}\n","interface SpinnerProps {\n size?: number;\n className?: string;\n}\n\nexport const Spinner = ({ size = 16, className = '' }: SpinnerProps) => (\n <div\n className={`animate-spin rounded-full border-2 border-current/20 border-t-[var(--chat-accent)] ${className}`}\n style={{ width: size, height: size }}\n />\n);\n","import { useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\n\ninterface TooltipProps {\n title: string;\n children: React.ReactElement;\n}\n\nfunction findChatbotRoot(el: HTMLElement | null): HTMLElement {\n let node = el;\n while (node) {\n if (node.classList.contains('filigran-chatbot')) return node;\n node = node.parentElement;\n }\n return document.body;\n}\n\nexport const Tooltip = ({ title, children }: TooltipProps) => {\n const ref = useRef<HTMLSpanElement>(null);\n const [show, setShow] = useState(false);\n const [pos, setPos] = useState({ top: 0, left: 0 });\n\n if (!title) return children;\n\n const handleEnter = () => {\n if (!ref.current) return;\n const rect = ref.current.getBoundingClientRect();\n setPos({\n top: rect.top - 4,\n left: rect.left + rect.width / 2,\n });\n setShow(true);\n };\n\n return (\n <span\n ref={ref}\n className=\"inline-flex\"\n onMouseEnter={handleEnter}\n onMouseLeave={() => setShow(false)}\n >\n {children}\n {show &&\n createPortal(\n <span\n className=\"pointer-events-none fixed z-[10001] -translate-x-1/2 -translate-y-full whitespace-nowrap rounded-md bg-gray-900 dark:bg-gray-100 px-2 py-1 text-xs text-white dark:text-gray-900 shadow-lg\"\n style={{ top: pos.top, left: pos.left }}\n role=\"tooltip\"\n >\n {title}\n </span>,\n findChatbotRoot(ref.current),\n )}\n </span>\n );\n};\n","import { useRef } from 'react';\nimport type { ChatMode, XtmAgent } from '../types';\nimport {\n ChevronDownIcon,\n CloseIcon,\n EditIcon,\n ExternalLinkIcon,\n FloatingIcon,\n FullscreenExitIcon,\n FullscreenIcon,\n SidebarIcon,\n UserPlusIcon,\n} from './icons';\nimport { Dropdown } from './Dropdown';\nimport { Spinner } from './Spinner';\nimport { Tooltip } from './Tooltip';\n\ninterface ChatHeaderProps {\n mode: ChatMode;\n agentName: string;\n agents: XtmAgent[];\n selectedAgent: XtmAgent | null;\n transferredFrom?: string;\n agentMenuOpen: boolean;\n onAgentMenuToggle: () => void;\n onAgentMenuClose: () => void;\n onSwitchAgent: (agent: XtmAgent) => void;\n modeMenuOpen: boolean;\n onModeMenuToggle: () => void;\n onModeMenuClose: () => void;\n onModeChange: (mode: ChatMode) => void;\n onNewChat: () => void;\n onClose: () => void;\n logoIcon: React.ReactNode;\n agentDashboardUrl?: string;\n t: (key: string) => string;\n}\n\nconst modeOptions: { mode: ChatMode; label: string; getIcon: (p: { size: number; className: string }) => React.ReactNode }[] = [\n { mode: 'floating', label: 'Floating', getIcon: (p) => <FloatingIcon {...p} /> },\n { mode: 'sidebar', label: 'Sidebar', getIcon: (p) => <SidebarIcon {...p} /> },\n { mode: 'fullscreen', label: 'Full screen', getIcon: (p) => <FullscreenIcon {...p} /> },\n];\n\nexport const ChatHeader = ({\n mode,\n agentName,\n agents,\n selectedAgent,\n transferredFrom,\n agentMenuOpen,\n onAgentMenuToggle,\n onAgentMenuClose,\n onSwitchAgent,\n modeMenuOpen,\n onModeMenuToggle,\n onModeMenuClose,\n onModeChange,\n onNewChat,\n onClose,\n logoIcon,\n agentDashboardUrl,\n t,\n}: ChatHeaderProps) => {\n const agentAnchorRef = useRef<HTMLButtonElement>(null);\n const modeAnchorRef = useRef<HTMLButtonElement>(null);\n\n const CurrentModeIcon = mode === 'sidebar' ? SidebarIcon : mode === 'fullscreen' ? FullscreenExitIcon : FloatingIcon;\n\n return (\n <div className={`flex items-center px-3 py-2 min-h-[48px] border-b border-gray-200 dark:border-white/10 bg-gradient-to-br from-[var(--chat-accent-dark)]/[0.13] to-[var(--chat-accent)]/[0.07] ${mode === 'floating' ? 'rounded-t-xl' : ''}`}>\n <button\n ref={agentAnchorRef}\n type=\"button\"\n onClick={onAgentMenuToggle}\n className=\"flex items-center gap-1.5 text-sm font-semibold text-gray-900 dark:text-white px-2 py-1 rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 transition-colors\"\n >\n <span className=\"flex items-center text-[var(--chat-accent)] [&>svg]:w-[18px] [&>svg]:h-[18px]\">{logoIcon}</span>\n <span className=\"flex flex-col items-start leading-tight\">\n <span>{agentName}</span>\n {transferredFrom && (\n <span className=\"text-[0.6rem] font-normal text-gray-400 dark:text-white/30\">\n {t('Transferred from')} {transferredFrom}\n </span>\n )}\n </span>\n <ChevronDownIcon size={16} className=\"text-gray-400 dark:text-white/30\" />\n </button>\n\n <Dropdown open={agentMenuOpen} onClose={onAgentMenuClose} anchorRef={agentAnchorRef} width={280}>\n <span className=\"block px-4 pt-3 pb-1 text-[0.68rem] tracking-[1px] uppercase text-gray-400 dark:text-white/40\">\n {t('Switch to another agent')}\n </span>\n {agents.length === 0 && (\n <div className=\"px-4 py-2\">\n <Spinner size={16} />\n </div>\n )}\n <div>\n {agents.map((agent) => (\n <button\n key={agent.id}\n type=\"button\"\n onClick={() => onSwitchAgent(agent)}\n className={`w-full flex items-center gap-2 px-4 py-1.5 text-left hover:bg-gray-100 dark:hover:bg-white/10 transition-colors ${\n agent.id === selectedAgent?.id ? 'bg-[var(--chat-accent)]/10' : ''\n }`}\n >\n <div className=\"w-7 h-7 rounded-full flex items-center justify-center shrink-0 bg-gradient-to-br from-[var(--chat-accent)]/20 to-[var(--chat-accent)]/5\">\n <span className=\"text-[var(--chat-accent)] [&>svg]:w-4 [&>svg]:h-4\">{logoIcon}</span>\n </div>\n <div className=\"min-w-0\">\n <div className=\"text-[0.8125rem] font-medium text-gray-900 dark:text-white truncate\">{agent.name}</div>\n {agent.description && <div className=\"text-[0.7rem] text-gray-500 dark:text-white/40 truncate\">{agent.description}</div>}\n </div>\n </button>\n ))}\n </div>\n <div className=\"h-px bg-gray-200 dark:bg-white/10 mx-2\" />\n <div>\n {agentDashboardUrl && (\n <button\n type=\"button\"\n onClick={() => {\n onAgentMenuClose();\n window.open(`${agentDashboardUrl}/agents`, '_blank');\n }}\n className=\"w-full flex items-center gap-2 px-4 py-1.5 text-left hover:bg-gray-100 dark:hover:bg-white/10 transition-colors\"\n >\n <ExternalLinkIcon size={18} className=\"text-gray-400 dark:text-white/40 shrink-0\" />\n <span className=\"text-[0.8125rem] text-gray-700 dark:text-white/70\">{t('Browse agents')}</span>\n </button>\n )}\n {agentDashboardUrl && (\n <button\n type=\"button\"\n onClick={() => {\n onAgentMenuClose();\n window.open(`${agentDashboardUrl}/agents/new`, '_blank');\n }}\n className=\"w-full flex items-center gap-2 px-4 py-1.5 text-left hover:bg-gray-100 dark:hover:bg-white/10 transition-colors\"\n >\n <UserPlusIcon size={18} className=\"text-gray-400 dark:text-white/40 shrink-0\" />\n <span className=\"text-[0.8125rem] text-gray-700 dark:text-white/70\">{t('Create agent')}</span>\n </button>\n )}\n </div>\n </Dropdown>\n\n <div className=\"flex-1\" />\n\n <Tooltip title={t('New chat')}>\n <button\n type=\"button\"\n onClick={onNewChat}\n className=\"w-8 h-8 flex items-center justify-center rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-white/40 hover:text-gray-700 dark:hover:text-white/70 transition-colors\"\n >\n <EditIcon size={18} />\n </button>\n </Tooltip>\n\n <Tooltip title={t('Switch view')}>\n <button\n ref={modeAnchorRef}\n type=\"button\"\n onClick={onModeMenuToggle}\n className=\"w-8 h-8 flex items-center justify-center rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-white/40 hover:text-gray-700 dark:hover:text-white/70 transition-colors\"\n >\n <CurrentModeIcon size={18} />\n </button>\n </Tooltip>\n\n <Dropdown open={modeMenuOpen} onClose={onModeMenuClose} anchorRef={modeAnchorRef} placement=\"bottom-end\" width={180}>\n <span className=\"block px-4 pt-3 pb-1 text-[0.68rem] tracking-[1px] uppercase text-gray-400 dark:text-white/40\">{t('Switch to')}</span>\n <div className=\"pb-1\">\n {modeOptions.map((opt) => (\n <button\n key={opt.mode}\n type=\"button\"\n onClick={() => {\n onModeChange(opt.mode);\n onModeMenuClose();\n }}\n className={`w-full flex items-center gap-3 px-4 py-1 text-left hover:bg-gray-100 dark:hover:bg-white/10 transition-colors ${\n mode === opt.mode ? 'bg-[var(--chat-accent)]/10' : ''\n }`}\n >\n {opt.getIcon({ size: 18, className: 'text-gray-400 dark:text-white/40' })}\n <span className=\"text-[0.8125rem] text-gray-700 dark:text-white/70\">{t(opt.label)}</span>\n </button>\n ))}\n </div>\n </Dropdown>\n\n <Tooltip title={t('Close')}>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"w-8 h-8 flex items-center justify-center rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-white/40 hover:text-gray-700 dark:hover:text-white/70 transition-colors\"\n >\n <CloseIcon size={18} />\n </button>\n </Tooltip>\n </div>\n );\n};\n","import { useRef, type KeyboardEvent } from 'react';\nimport type { ChatFile, ChatMode } from '../types';\nimport { AttachFileIcon, FileIcon, SendIcon, StopCircleIcon } from './icons';\nimport { Tooltip } from './Tooltip';\n\ninterface ChatInputProps {\n inputValue: string;\n onInputChange: (value: string) => void;\n onSend: () => void;\n onStop: () => void;\n isLoading: boolean;\n attachedFiles: ChatFile[];\n onFileAdd: (files: FileList | null) => void;\n onFileRemove: (index: number) => void;\n onPaste: (e: React.ClipboardEvent) => void;\n t: (key: string) => string;\n mode?: ChatMode;\n}\n\nexport const ChatInput = ({ inputValue, onInputChange, onSend, onStop, isLoading, attachedFiles, onFileAdd, onFileRemove, onPaste, t, mode }: ChatInputProps) => {\n const fileInputRef = useRef<HTMLInputElement>(null);\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n onSend();\n }\n };\n\n const handleInput = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n onInputChange(e.target.value);\n const el = e.target;\n el.style.height = 'auto';\n el.style.height = `${Math.min(el.scrollHeight, 120)}px`;\n };\n\n const hasContent = inputValue.trim() || attachedFiles.length > 0;\n\n return (\n <div className={`px-4 py-3 border-t border-gray-200 dark:border-white/10 ${mode === 'floating' ? 'rounded-b-xl' : ''}`}>\n {attachedFiles.length > 0 && (\n <div className=\"flex gap-1.5 flex-wrap mb-2\">\n {attachedFiles.map((f, i) => (\n <span\n key={i}\n className=\"inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-gray-200 dark:border-white/10 text-[0.7rem] text-gray-600 dark:text-white/60\"\n >\n <FileIcon size={14} />\n {f.name}\n <button\n type=\"button\"\n onClick={() => onFileRemove(i)}\n className=\"ml-0.5 text-gray-400 dark:text-white/30 hover:text-gray-600 dark:hover:text-white/60\"\n >\n ×\n </button>\n </span>\n ))}\n </div>\n )}\n\n <div className=\"flex items-center border border-gray-200 dark:border-white/10 rounded-xl px-2 py-1 transition-colors focus-within:border-[var(--chat-accent)]\">\n <input\n ref={fileInputRef}\n type=\"file\"\n multiple\n hidden\n onChange={(e) => {\n onFileAdd(e.target.files);\n e.target.value = '';\n }}\n />\n <button\n type=\"button\"\n onClick={() => fileInputRef.current?.click()}\n className=\"w-8 h-8 flex items-center justify-center shrink-0 rounded-lg text-gray-400 dark:text-white/30 hover:bg-gray-100 dark:hover:bg-white/10 mr-0.5 transition-colors\"\n >\n <AttachFileIcon size={18} />\n </button>\n <textarea\n ref={textareaRef}\n placeholder={t('Ask a question...')}\n value={inputValue}\n onChange={handleInput}\n onKeyDown={handleKeyDown}\n onPaste={onPaste}\n rows={1}\n className=\"flex-1 bg-transparent border-none outline-none resize-none text-[0.8125rem] py-1.5 text-gray-900 dark:text-white placeholder:text-gray-400 dark:placeholder:text-white/30 filigran-chat-scrollable\"\n style={{ maxHeight: 120 }}\n />\n <Tooltip title={isLoading ? t('Stop generating') : ''}>\n <button\n type=\"button\"\n onClick={isLoading ? onStop : onSend}\n disabled={!isLoading && !hasContent}\n className={`p-1.5 rounded-lg w-8 h-8 flex items-center justify-center transition-all duration-150 ${\n isLoading\n ? 'text-red-500 bg-red-500/10 hover:bg-red-500/20'\n : hasContent\n ? 'text-[var(--chat-accent)] bg-[var(--chat-accent)]/10 hover:bg-[var(--chat-accent)]/20'\n : 'text-gray-300 dark:text-white/20 cursor-not-allowed'\n }`}\n >\n {isLoading ? <StopCircleIcon size={18} /> : <SendIcon size={18} />}\n </button>\n </Tooltip>\n </div>\n\n <p className=\"text-center text-[0.65rem] text-gray-400 dark:text-white/30 mt-1.5 opacity-70\">{t('Uses AI. Verify results.')}</p>\n </div>\n );\n};\n","import { useEffect, useRef } from 'react';\nimport type { AgentStatusState, IconProps } from '../types';\nimport { BrainIcon, DatabaseIcon, ExternalLinkIcon, GlobeIcon, MailIcon, SearchIcon, SparklesIcon, TerminalIcon, UserPlusIcon, WrenchIcon } from './icons';\n\ninterface ChatThinkingProps {\n agentStatus: AgentStatusState | null;\n logoIcon?: React.ReactNode;\n t: (key: string) => string;\n}\n\ntype IconComponent = (props: IconProps) => React.JSX.Element;\n\ninterface StatusVisual {\n label: string;\n StatusIcon: IconComponent;\n showDots: boolean;\n}\n\nfunction resolveStatusVisual(agentStatus: AgentStatusState | null, t: (key: string) => string): StatusVisual {\n if (!agentStatus) {\n return { label: t('Thinking...'), StatusIcon: BrainIcon, showDots: false };\n }\n switch (agentStatus.status) {\n case 'tool_start': {\n const rawNames = agentStatus.tools ?? [];\n const lower = rawNames.map((n) => n.toLowerCase());\n\n // Delegation tools have dedicated statuses\n if (lower.some((n) => n === 'spawn_background_task')) {\n const count = rawNames.filter((n) => n === 'spawn_background_task').length;\n const label = count > 1\n ? `${t('Delegating')} ${count} ${t('tasks')}…`\n : `${t('Delegating task')}…`;\n return { label, StatusIcon: UserPlusIcon, showDots: false };\n }\n if (lower.some((n) => n === 'check_task_status')) {\n const count = rawNames.filter((n) => n === 'check_task_status').length;\n const target = count > 1 ? `${count} ${t('background tasks')}` : t('background task');\n return { label: `${t('Waiting for')} ${target}…`, StatusIcon: SparklesIcon, showDots: false };\n }\n if (lower.some((n) => n === 'get_task_result')) {\n const count = rawNames.filter((n) => n === 'get_task_result').length;\n const from = count > 1 ? `${count} ${t('tasks')}` : t('task');\n return { label: `${t('Collecting results from')} ${from}…`, StatusIcon: SparklesIcon, showDots: false };\n }\n\n let StatusIcon: IconComponent = WrenchIcon;\n if (lower.some((n) => n.includes('search') || n.includes('list'))) {\n StatusIcon = SearchIcon;\n } else if (lower.some((n) => n.includes('read') || n.includes('get') || n.includes('query'))) {\n StatusIcon = DatabaseIcon;\n } else if (lower.some((n) => n.includes('send') || n.includes('create') || n.includes('draft') || n.includes('reply') || n.includes('flag'))) {\n StatusIcon = MailIcon;\n } else if (lower.some((n) => n.includes('code') || n.includes('execute'))) {\n StatusIcon = TerminalIcon;\n } else if (lower.some((n) => n.includes('web') || n.includes('browse'))) {\n StatusIcon = GlobeIcon;\n }\n let label: string;\n if (rawNames.length > 0) {\n const display = rawNames.map((n) => n.replace(/_/g, ' ').replace(/\\b\\w/g, (c) => c.toUpperCase()));\n const unique = Array.from(new Set(display));\n label = unique.length === 1 ? `${unique[0]}…` : `${unique[0]} (+${unique.length - 1} more)…`;\n } else {\n label = t('Using tools…');\n }\n return { label, StatusIcon, showDots: false };\n }\n case 'analyzing':\n return { label: t('Analyzing results…'), StatusIcon: SparklesIcon, showDots: false };\n case 'composing':\n return { label: t('Composing answer…'), StatusIcon: BrainIcon, showDots: true };\n case 'consulting': {\n const consultName = agentStatus.tools?.[0] ?? 'agent';\n return { label: `${t('Consulting')} ${consultName}…`, StatusIcon: UserPlusIcon, showDots: false };\n }\n case 'delegating': {\n const count = agentStatus.tools?.filter((n) => n === 'spawn_background_task').length ?? 0;\n return { label: count > 1 ? `${t('Delegating')} ${count} ${t('tasks')}…` : `${t('Delegating task')}…`, StatusIcon: UserPlusIcon, showDots: false };\n }\n case 'polling': {\n const checkCount = agentStatus.tools?.filter((n) => n === 'check_task_status').length ?? 0;\n const target = checkCount > 1 ? `${checkCount} ${t('background tasks')}` : t('background task');\n return { label: `${t('Waiting for')} ${target}…`, StatusIcon: SparklesIcon, showDots: false };\n }\n case 'collecting': {\n const fetchCount = agentStatus.tools?.filter((n) => n === 'get_task_result').length ?? 0;\n const from = fetchCount > 1 ? `${fetchCount} ${t('tasks')}` : t('task');\n return { label: `${t('Collecting results from')} ${from}…`, StatusIcon: SparklesIcon, showDots: false };\n }\n case 'transferring': {\n const targetName = agentStatus.tools?.[0] ?? 'agent';\n return { label: `${t('Transferring to')} ${targetName}…`, StatusIcon: ExternalLinkIcon, showDots: false };\n }\n case 'thinking':\n default:\n return { label: t('Thinking...'), StatusIcon: BrainIcon, showDots: false };\n }\n}\n\nfunction stripMarkdown(text: string): string {\n return text\n .replace(/```[\\s\\S]*?```/g, ' ')\n .replace(/`([^`]+)`/g, '$1')\n .replace(/\\*\\*(.+?)\\*\\*/g, '$1')\n .replace(/__(.+?)__/g, '$1')\n .replace(/\\*(.+?)\\*/g, '$1')\n .replace(/_(.+?)_/g, '$1')\n .replace(/#{1,6}\\s+/g, '')\n .replace(/[*\\->]+/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim();\n}\n\nexport function ThinkingTextBubble({ content }: { content: string }) {\n const ref = useRef<HTMLDivElement>(null);\n const cleaned = stripMarkdown(content);\n\n useEffect(() => {\n if (ref.current) ref.current.scrollTop = ref.current.scrollHeight;\n }, [cleaned]);\n\n if (cleaned.length < 3) return null;\n\n return (\n <div\n ref={ref}\n className=\"ml-11 max-w-[70%] max-h-20 overflow-hidden relative rounded-md border-l-2 bg-[var(--chat-accent)]/[0.03] pl-3 pr-3 py-2\"\n style={{ animation: 'reasoningGlow 3s ease-in-out infinite, chat-fade-in 0.5s ease-out' }}\n >\n <p className=\"text-[13px] leading-[1.35rem] text-gray-400 dark:text-white/40 break-words m-0\">\n {cleaned}\n </p>\n <div className=\"absolute inset-x-0 bottom-0 h-5 bg-gradient-to-t from-white/90 dark:from-[#1e1e2e]/90 to-transparent pointer-events-none\" />\n </div>\n );\n}\n\nexport const ChatThinking = ({ agentStatus, logoIcon, t }: ChatThinkingProps) => {\n const { label, StatusIcon, showDots } = resolveStatusVisual(agentStatus, t);\n const thinkingContent = agentStatus?.thinkingContent;\n\n return (\n <>\n <div className=\"flex gap-3 items-center justify-start\">\n <div className=\"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-[var(--chat-accent)]/15 to-[var(--chat-accent)]/5\">\n <span className=\"text-[var(--chat-accent)] [&>svg]:w-4 [&>svg]:h-4\">{logoIcon}</span>\n </div>\n <div className=\"rounded-lg bg-gray-50 dark:bg-white/[0.03] px-4 py-3 relative overflow-hidden\">\n <div className=\"absolute inset-0 bg-gradient-to-r from-[var(--chat-accent)]/[0.03] via-transparent to-[var(--chat-accent)]/[0.03] animate-pulse pointer-events-none\" />\n <div className=\"relative flex items-center gap-2.5\">\n {showDots ? (\n <div className=\"flex gap-[3px] items-center h-3.5 w-3.5 justify-center\">\n {[0, 0.15, 0.3].map((delay, i) => (\n <span\n key={i}\n className=\"h-[5px] w-[5px] rounded-full bg-[var(--chat-accent)]/50\"\n style={{ animation: `chat-dot 1s ease-in-out infinite ${delay}s` }}\n />\n ))}\n </div>\n ) : (\n <StatusIcon size={14} className=\"text-[var(--chat-accent)] animate-pulse transition-all duration-300\" />\n )}\n <span className=\"text-sm text-gray-500 dark:text-white/50 transition-all duration-300\">{label}</span>\n </div>\n </div>\n </div>\n {thinkingContent && <ThinkingTextBubble content={thinkingContent} />}\n </>\n );\n};\n","import { useState } from 'react';\nimport Markdown from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport { CheckIcon, CopyIcon } from './icons';\n\ninterface MarkdownMessageProps {\n content: string;\n}\n\nexport const MarkdownMessage = ({ content }: MarkdownMessageProps) => {\n const [copiedBlock, setCopiedBlock] = useState<string | null>(null);\n\n const handleCopyCode = (code: string) => {\n navigator.clipboard.writeText(code);\n setCopiedBlock(code);\n setTimeout(() => setCopiedBlock(null), 2000);\n };\n\n return (\n <Markdown\n remarkPlugins={[remarkGfm]}\n components={{\n p: ({ children }) => (\n <p className=\"mb-3 last:mb-0 leading-7 break-words text-[0.8125rem] text-gray-900 dark:text-white/90\">{children}</p>\n ),\n code: ({ className, children }) => {\n const match = /language-(\\w+)/.exec(className || '');\n const codeStr = String(children).replace(/\\n$/, '');\n if (match) {\n return (\n <div className=\"my-3 rounded-lg border border-gray-200 dark:border-white/10 overflow-hidden bg-gray-50 dark:bg-white/[0.03]\">\n <div className=\"flex items-center justify-between px-3 py-1.5 border-b border-gray-200 dark:border-white/10 bg-gray-100 dark:bg-white/[0.03]\">\n <span className=\"text-[0.7rem] text-gray-500 dark:text-white/40 font-mono\">{match[1]}</span>\n <button\n type=\"button\"\n onClick={() => handleCopyCode(codeStr)}\n className=\"p-0.5 rounded hover:bg-gray-200 dark:hover:bg-white/10 transition-colors\"\n >\n {copiedBlock === codeStr ? (\n <CheckIcon size={14} className=\"text-green-500\" />\n ) : (\n <CopyIcon size={14} className=\"text-gray-400 dark:text-white/40\" />\n )}\n </button>\n </div>\n <pre className=\"m-0 px-3 py-2 overflow-x-auto\">\n <code className=\"font-mono text-xs leading-[1.7] text-gray-800 dark:text-white/90 whitespace-pre\">{codeStr}</code>\n </pre>\n </div>\n );\n }\n return (\n <code className=\"bg-gray-100 dark:bg-white/[0.08] px-1.5 py-0.5 rounded font-mono text-xs text-[var(--chat-accent)]\">{children}</code>\n );\n },\n ul: ({ children }) => (\n <ul className=\"pl-5 mb-3 text-[0.8125rem] text-gray-900 dark:text-white/90 [&_li]:mb-1 marker:text-[var(--chat-accent)]/50\">\n {children}\n </ul>\n ),\n ol: ({ children }) => (\n <ol className=\"pl-5 mb-3 text-[0.8125rem] text-gray-900 dark:text-white/90 [&_li]:mb-1 marker:text-[var(--chat-accent)]/50\">\n {children}\n </ol>\n ),\n blockquote: ({ children }) => (\n <blockquote className=\"my-3 border-l-2 border-[var(--chat-accent)]/30 bg-[var(--chat-accent)]/[0.03] pl-4 pr-3 py-2 rounded-r-md italic text-gray-500 dark:text-white/60\">\n {children}\n </blockquote>\n ),\n a: ({ href, children }) => (\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"text-[var(--chat-accent)] underline underline-offset-2 hover:brightness-125\"\n >\n {children}\n </a>\n ),\n h1: ({ children }) => <h1 className=\"mt-4 first:mt-0 mb-2 font-bold text-base text-gray-900 dark:text-white\">{children}</h1>,\n h2: ({ children }) => <h2 className=\"mt-3 first:mt-0 mb-2 font-bold text-[0.9rem] text-gray-900 dark:text-white\">{children}</h2>,\n h3: ({ children }) => <h3 className=\"mt-3 first:mt-0 mb-1.5 font-semibold text-[0.85rem] text-gray-900 dark:text-white\">{children}</h3>,\n table: ({ children }) => (\n <div className=\"my-3 overflow-x-auto rounded-lg border border-gray-200 dark:border-white/10\">\n <table className=\"w-full border-collapse text-xs\">{children}</table>\n </div>\n ),\n th: ({ children }) => (\n <th className=\"px-3 py-2 text-left font-semibold bg-gray-50 dark:bg-white/[0.04] border-b border-gray-200 dark:border-white/10 text-gray-900 dark:text-white\">\n {children}\n </th>\n ),\n td: ({ children }) => (\n <td className=\"px-3 py-2 border-b border-gray-200 dark:border-white/10 text-gray-700 dark:text-white/80\">{children}</td>\n ),\n }}\n >\n {content}\n </Markdown>\n );\n};\n","import { useEffect, useRef, useState } from 'react';\nimport type { AgentStatusState, ChatMessage } from '../types';\nimport { FileIcon, InfoIcon } from './icons';\nimport { ChatThinking, ThinkingTextBubble } from './ChatThinking';\nimport { MarkdownMessage } from './MarkdownMessage';\n\ninterface ChatMessagesProps {\n messages: ChatMessage[];\n isLoading: boolean;\n agentStatus: AgentStatusState | null;\n agentName: string;\n logoIcon: React.ReactNode;\n t: (key: string) => string;\n}\n\nexport const ChatMessages = ({ messages, isLoading, agentStatus, agentName, logoIcon, t }: ChatMessagesProps) => {\n const messagesEndRef = useRef<HTMLDivElement>(null);\n const [toolDetailMsgId, setToolDetailMsgId] = useState<string | null>(null);\n\n useEffect(() => {\n messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });\n }, [messages]);\n\n return (\n <div className=\"flex-1 overflow-y-auto px-4 py-3 flex flex-col gap-4 filigran-chat-scrollable\">\n {messages.map((msg) => {\n const isAssistant = msg.role === 'assistant';\n const isEmpty = !msg.content;\n const isThinking = isAssistant && isEmpty && isLoading;\n\n if (isThinking) {\n return (\n <div key={msg.id}>\n <ChatThinking agentStatus={agentStatus} logoIcon={logoIcon} t={t} />\n </div>\n );\n }\n\n return (\n <div key={msg.id} className={`flex flex-col ${isAssistant ? 'items-start' : 'items-end'}`}>\n {isAssistant && (\n <div className=\"flex items-center gap-1.5 mb-1\">\n <div className=\"w-6 h-6 rounded-lg flex items-center justify-center bg-gradient-to-br from-[var(--chat-accent)]/20 to-[var(--chat-accent)]/5\">\n <span className=\"text-[var(--chat-accent)] [&>svg]:w-3 [&>svg]:h-3\">{logoIcon}</span>\n </div>\n <span className=\"font-semibold text-xs text-gray-900 dark:text-white\">{agentName}</span>\n </div>\n )}\n\n {isAssistant && !isEmpty && isLoading && agentStatus?.thinkingContent && (\n <ThinkingTextBubble content={agentStatus.thinkingContent} />\n )}\n\n {msg.files && msg.files.length > 0 && (\n <div className=\"flex gap-1.5 flex-wrap mb-1.5\">\n {msg.files.map((f, i) => (\n <span\n key={i}\n className=\"inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-gray-200 dark:border-white/10 text-[0.7rem] text-gray-600 dark:text-white/60\"\n >\n <FileIcon size={14} />\n {f.name}\n </span>\n ))}\n </div>\n )}\n\n <div\n className={`max-w-[90%] ${\n isAssistant\n ? 'pl-1 py-1 text-[0.8125rem] leading-7'\n : 'px-3.5 py-2 rounded-[14px_14px_4px_14px] bg-[var(--chat-accent-dark)] text-white text-[0.8125rem] leading-6'\n }`}\n >\n {isAssistant ? <MarkdownMessage content={msg.content} /> : msg.content}\n {isAssistant && isEmpty && !isLoading && <span className=\"text-[0.8125rem] text-gray-400 dark:text-white/40 italic\">...</span>}\n {isAssistant && !isEmpty && isLoading && (\n <span className=\"inline-block w-1.5 h-4 bg-[var(--chat-accent)]/70 rounded-sm ml-0.5 animate-pulse align-text-bottom\" />\n )}\n </div>\n\n {isAssistant && !isEmpty && !isLoading && msg.toolNames && msg.toolNames.length > 0 && (\n <>\n <button\n type=\"button\"\n onClick={() => setToolDetailMsgId(toolDetailMsgId === msg.id ? null : msg.id)}\n className=\"mt-0.5 p-1 rounded-lg opacity-50 hover:opacity-100 hover:text-[var(--chat-accent)] transition-opacity\"\n title={t('Reasoning details')}\n >\n <InfoIcon size={14} />\n </button>\n {toolDetailMsgId === msg.id && (\n <div className=\"mt-1.5 p-3 rounded-lg bg-gray-50 dark:bg-white/[0.04] border border-gray-200 dark:border-white/10\">\n <p className=\"text-[0.7rem] text-gray-500 dark:text-white/40 mb-1.5\">\n {msg.iterations && msg.iterations > 1 ? `${msg.iterations} iterations · ` : ''}\n {msg.toolCallCount ?? msg.toolNames.length}{' '}\n {(msg.toolCallCount ?? msg.toolNames.length) === 1 ? t('tool call') : t('tool calls')}\n </p>\n <div className=\"flex flex-wrap gap-1\">\n {Array.from(new Set(msg.toolNames)).map((tn) => (\n <span\n key={tn}\n className=\"inline-flex items-center px-2 py-0.5 rounded-full border border-gray-200 dark:border-white/10 text-[0.68rem] font-mono text-gray-500 dark:text-white/40\"\n >\n {tn.replace(/_/g, ' ')}\n </span>\n ))}\n </div>\n </div>\n )}\n </>\n )}\n </div>\n );\n })}\n <div ref={messagesEndRef} />\n </div>\n );\n};\n","interface ChatWelcomeProps {\n firstName: string;\n logoIcon: React.ReactNode;\n promptSuggestions: string[];\n onPromptClick: (prompt: string) => void;\n t: (key: string) => string;\n}\n\nexport const ChatWelcome = ({ firstName, logoIcon, promptSuggestions, onPromptClick, t }: ChatWelcomeProps) => (\n <div className=\"flex-1 flex flex-col items-center justify-center px-6 pb-8\">\n <span className=\"text-[var(--chat-accent)] mb-4 [&>svg]:w-12 [&>svg]:h-12 drop-shadow-[0_0_12px_var(--chat-accent-40)]\">{logoIcon}</span>\n <h2 className=\"text-xl font-medium mb-6 text-center text-gray-900 dark:text-white\" style={{ fontFamily: '\"Geologica\", sans-serif' }}>\n {t('How can I help you, ')}\n {firstName}?\n </h2>\n <div className=\"w-full max-w-[320px]\">\n <span className=\"block text-center mb-2 text-[0.65rem] tracking-[1.5px] uppercase text-[var(--chat-accent)] font-semibold\">\n {t('Suggestions')}\n </span>\n {promptSuggestions.map((prompt) => (\n <button\n key={prompt}\n type=\"button\"\n onClick={() => onPromptClick(prompt)}\n className=\"w-full text-left text-[0.8125rem] text-gray-800 dark:text-white py-1.5 px-3 mb-1 rounded-lg border border-gray-200 dark:border-white/10 bg-transparent transition-colors hover:bg-[var(--chat-accent-10)] hover:border-[var(--chat-accent-50)]\"\n >\n {t(prompt)}\n </button>\n ))}\n </div>\n </div>\n);\n","import { type FunctionComponent, useEffect, useState } from 'react';\nimport type { ChatMessage, ChatPanelProps } from '../types';\nimport { hexAlpha, identity } from '../utils';\nimport { useChat } from '../hooks/useChat';\nimport { useAgents } from '../hooks/useAgents';\nimport { useSidebarResize } from '../hooks/useSidebarResize';\nimport { DefaultLogoIcon } from './icons';\nimport { ChatHeader } from './ChatHeader';\nimport { ChatInput } from './ChatInput';\nimport { ChatMessages } from './ChatMessages';\nimport { ChatWelcome } from './ChatWelcome';\n\nconst FLOATING_WIDTH = 380;\nconst FLOATING_HEIGHT = 560;\nconst SIDEBAR_GAP = 6;\n\nconst DEFAULT_SUGGESTIONS = [\n 'Help me create a new simulation scenario',\n 'What are the latest attack patterns?',\n 'How do I configure detection rules?',\n 'Summarize my recent findings',\n];\n\nexport const ChatPanel: FunctionComponent<ChatPanelProps> = ({\n mode,\n onClose,\n onModeChange,\n topOffset = 0,\n apiBaseUrl,\n apiEndpoints,\n agentDashboardUrl,\n user,\n t = identity,\n accentColor = '#7b5cff',\n logoIcon,\n promptSuggestions = DEFAULT_SUGGESTIONS,\n resizable = false,\n onWidthChange,\n onResizeStart,\n onResizeEnd,\n pushContentSelector,\n backendType = 'rest',\n}) => {\n const [modeMenuOpen, setModeMenuOpen] = useState(false);\n\n const { agents, selectedAgent, agentMenuOpen, setAgentMenuOpen, handleSwitchAgent } = useAgents({ apiBaseUrl, apiEndpoints, backendType });\n\n const {\n messages,\n inputValue,\n setInputValue,\n isLoading,\n agentStatus,\n attachedFiles,\n conversationId,\n transferredAgent,\n historyLoadedRef,\n handleFileAdd,\n handlePaste,\n handleSendMessage,\n handleNewChat,\n handleStopGenerating,\n setAttachedFiles,\n setMessages,\n setConversationId,\n } = useChat({ apiBaseUrl, apiEndpoints, backendType, agentSlug: selectedAgent?.slug, t });\n\n const { sidebarWidth, handleResizeStart, defaultWidth, isResizing } = useSidebarResize({\n mode,\n resizable,\n onWidthChange,\n onResizeStart,\n onResizeEnd,\n });\n\n // Push content when sidebar mode is active using CSS variable\n useEffect(() => {\n const width = mode === 'sidebar' ? (resizable ? sidebarWidth : defaultWidth) : 0;\n const pushWidth = width > 0 ? width + SIDEBAR_GAP : 0;\n \n // Set CSS variable on :root for any component to use\n document.documentElement.style.setProperty('--chatbot-sidebar-width', `${pushWidth}px`);\n document.documentElement.style.setProperty(\n '--chatbot-transition',\n isResizing ? 'none' : 'all 225ms cubic-bezier(0.4, 0, 0.2, 1)'\n );\n\n // Also apply to pushContentSelector if provided (for simple cases)\n if (pushContentSelector) {\n const contentElement = document.querySelector<HTMLElement>(pushContentSelector);\n if (contentElement) {\n const originalPaddingRight = contentElement.style.paddingRight;\n const originalTransition = contentElement.style.transition;\n \n contentElement.style.paddingRight = pushWidth > 0 ? `${pushWidth}px` : '';\n contentElement.style.transition = isResizing \n ? 'none' \n : 'padding-right 225ms cubic-bezier(0.4, 0, 0.2, 1)';\n\n return () => {\n contentElement.style.paddingRight = originalPaddingRight;\n contentElement.style.transition = originalTransition;\n document.documentElement.style.setProperty('--chatbot-sidebar-width', '0px');\n };\n }\n }\n\n return () => {\n document.documentElement.style.setProperty('--chatbot-sidebar-width', '0px');\n };\n }, [pushContentSelector, mode, sidebarWidth, defaultWidth, resizable, isResizing]);\n\n const resolvedLogo = logoIcon ?? <DefaultLogoIcon size={24} />;\n const firstName = user.firstName;\n const agentName = transferredAgent?.name || selectedAgent?.name || 'Assistant';\n\n const cssVars = {\n '--chat-accent': accentColor,\n '--chat-accent-10': hexAlpha(accentColor, 0.1),\n '--chat-accent-40': hexAlpha(accentColor, 0.25),\n '--chat-accent-50': hexAlpha(accentColor, 0.5),\n '--chat-accent-dark': accentColor,\n } as React.CSSProperties;\n\n // Load conversation history when agent is selected\n useEffect(() => {\n // Skip session history if disabled, using single endpoint mode, or non-REST backend\n if (apiEndpoints?.sessions === null || apiEndpoints?.singleEndpoint || backendType === 'legacy' || backendType === 'ag-ui') return;\n if (!conversationId || historyLoadedRef.current || !selectedAgent) return;\n historyLoadedRef.current = true;\n const sessionsUrl = `${apiBaseUrl}${apiEndpoints?.sessions ?? '/chat/sessions'}`;\n\n const clearStaleConversation = () => {\n setConversationId(null);\n localStorage.removeItem('filigranChatConversationId');\n };\n\n fetch(sessionsUrl, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n conversation_id: conversationId,\n agent_slug: selectedAgent.slug,\n }),\n })\n .then((res) => {\n if (!res.ok) {\n clearStaleConversation();\n return null;\n }\n return res.json();\n })\n .then((data) => {\n if (!data?.messages?.length) return;\n const restored: ChatMessage[] = data.messages.map((m: { role: string; content: string }, i: number) => ({\n id: `restored-${i}`,\n role: m.role as 'user' | 'assistant',\n content: m.content,\n timestamp: new Date(),\n }));\n setMessages(restored);\n })\n .catch(() => {\n clearStaleConversation();\n });\n }, [conversationId, selectedAgent, apiBaseUrl, apiEndpoints, historyLoadedRef, setMessages, setConversationId]);\n\n const onSwitchAgent = (agent: typeof selectedAgent) => {\n if (!agent) return;\n handleSwitchAgent(agent, () => {\n handleNewChat();\n });\n };\n\n const containerClasses = (() => {\n const base = 'filigran-chatbot';\n switch (mode) {\n case 'sidebar':\n return `${base} fixed right-0 bottom-0 flex flex-col bg-white dark:bg-[#1e1e2e] border-l border-gray-200 dark:border-white/10 z-[1200]`;\n case 'floating':\n return `${base} fixed bottom-5 right-5 flex flex-col bg-white dark:bg-[#1e1e2e] rounded-xl shadow-[0_8px_32px_rgba(0,0,0,0.15)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.4)] z-[1300] border border-gray-200 dark:border-white/10`;\n case 'fullscreen':\n return `${base} fixed right-0 bottom-0 left-0 flex flex-col bg-gray-50 dark:bg-[#161622] z-[1400]`;\n default:\n return base;\n }\n })();\n\n const containerStyle: React.CSSProperties = {\n ...cssVars,\n ...(mode === 'sidebar'\n ? { top: topOffset, width: resizable ? sidebarWidth : defaultWidth }\n : mode === 'floating'\n ? { width: FLOATING_WIDTH, height: FLOATING_HEIGHT }\n : { top: topOffset }),\n };\n\n return (\n <div className={containerClasses} style={containerStyle}>\n {mode === 'sidebar' && resizable && (\n <div\n onMouseDown={handleResizeStart}\n className=\"absolute top-0 -left-1 bottom-0 w-2 cursor-col-resize z-10 group\"\n >\n <div className=\"absolute top-0 left-1/2 -translate-x-1/2 bottom-0 w-0.5 rounded bg-[var(--chat-accent)] opacity-0 transition-opacity group-hover:opacity-100 group-active:opacity-100\" />\n </div>\n )}\n <ChatHeader\n mode={mode}\n agentName={agentName}\n agents={agents}\n selectedAgent={selectedAgent}\n transferredFrom={transferredAgent ? selectedAgent?.name : undefined}\n agentMenuOpen={agentMenuOpen}\n onAgentMenuToggle={() => setAgentMenuOpen((p) => !p)}\n onAgentMenuClose={() => setAgentMenuOpen(false)}\n onSwitchAgent={onSwitchAgent}\n modeMenuOpen={modeMenuOpen}\n onModeMenuToggle={() => setModeMenuOpen((p) => !p)}\n onModeMenuClose={() => setModeMenuOpen(false)}\n onModeChange={onModeChange}\n onNewChat={handleNewChat}\n onClose={onClose}\n logoIcon={resolvedLogo}\n agentDashboardUrl={agentDashboardUrl}\n t={t}\n />\n {messages.length === 0 ? (\n <ChatWelcome firstName={firstName} logoIcon={resolvedLogo} promptSuggestions={promptSuggestions} onPromptClick={setInputValue} t={t} />\n ) : (\n <ChatMessages messages={messages} isLoading={isLoading} agentStatus={agentStatus} agentName={agentName} logoIcon={resolvedLogo} t={t} />\n )}\n <ChatInput\n inputValue={inputValue}\n onInputChange={setInputValue}\n onSend={handleSendMessage}\n onStop={handleStopGenerating}\n isLoading={isLoading}\n attachedFiles={attachedFiles}\n onFileAdd={handleFileAdd}\n onFileRemove={(i) => setAttachedFiles((prev) => prev.filter((_, j) => j !== i))}\n onPaste={handlePaste}\n t={t}\n mode={mode}\n />\n </div>\n );\n};\n","import type { FunctionComponent } from 'react';\nimport type { ChatToggleButtonProps } from '../types';\nimport { hexAlpha } from '../utils';\nimport { DefaultLogoIcon } from './icons';\n\nexport const ChatToggleButton: FunctionComponent<ChatToggleButtonProps> = ({ isOpen, onToggle, label = 'Ask Assistant', accentColor = '#7b5cff', icon }) => {\n const resolvedIcon = icon ?? <DefaultLogoIcon size={16} />;\n\n return (\n <button\n type=\"button\"\n onClick={onToggle}\n className=\"filigran-chatbot inline-flex items-center gap-1.5 px-3 py-[3px] text-[0.8125rem] font-medium whitespace-nowrap rounded-md border transition-colors\"\n style={{\n borderColor: isOpen ? accentColor : hexAlpha(accentColor, 0.5),\n color: accentColor,\n backgroundColor: isOpen ? hexAlpha(accentColor, 0.1) : 'transparent',\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.borderColor = accentColor;\n e.currentTarget.style.backgroundColor = hexAlpha(accentColor, 0.1);\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.borderColor = isOpen ? accentColor : hexAlpha(accentColor, 0.5);\n e.currentTarget.style.backgroundColor = isOpen ? hexAlpha(accentColor, 0.1) : 'transparent';\n }}\n >\n <span className=\"[&>svg]:w-4 [&>svg]:h-4\">{resolvedIcon}</span>\n {label}\n </button>\n );\n};\n"],"names":["hexAlpha","hex","alpha","Math","round","toString","padStart","identity","key","parseLegacyEvent","evt","ctx","eventType","event","data","nodeId","status","activeNodeId","action","content","replace","reasoning","usedTools","length","hasUsedTools","tools","map","t","tool","Array","isArray","chatId","parseRestEvent","type","st","thinkingContent","conversationId","conversation_id","toolNames","tool_names","toolCallCount","tool_call_count","iterations","transferAgentId","transfer_agent_id","transferAgentName","transfer_agent_name","parseAgUiEvent","message","stepName","delta","toolName","toolCallName","STORAGE_KEY","LEGACY_CHAT_ID_KEY","useChat","apiBaseUrl","apiEndpoints","backendType","agentSlug","isLegacy","messages","setMessages","useState","inputValue","setInputValue","isLoading","setIsLoading","agentStatus","setAgentStatus","setConversationId","window","localStorage","getItem","attachedFiles","setAttachedFiles","transferredAgent","setTransferredAgent","legacyChatId","setLegacyChatId","historyLoadedRef","useRef","abortControllerRef","hasUsedToolsRef","handleFileAdd","fileList","newFiles","from","forEach","file","reader","FileReader","onload","push","name","size","dataUrl","result","prev","readAsDataURL","handlePaste","e","files","clipboardData","preventDefault","handleSendMessage","async","trim","userMsg","id","crypto","randomUUID","role","timestamp","Date","undefined","current","assistantId","controller","AbortController","requestBody","opts","question","streaming","threadId","runId","context","state","forwardedProps","agent_slug","buildRequestBody","res","fetch","singleEndpoint","method","headers","body","JSON","stringify","signal","ok","m","parseEvent","getParser","getReader","decoder","TextDecoder","buffer","accumulated","doneReceived","done","value","read","decode","stream","lines","split","pop","rawLine","line","startsWith","jsonStr","slice","parsed","parse","setItem","err","DOMException","handleNewChat","abort","removeItem","handleStopGenerating","filter","STORAGE_AGENT_KEY","SIDEBAR_WIDTH","SIDEBAR_WIDTH_STORAGE_KEY","AttachFileIcon","className","_jsx","xmlns","width","height","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","children","d","BrainIcon","_jsxs","CheckIcon","ChevronDownIcon","CloseIcon","CopyIcon","x","y","rx","ry","DatabaseIcon","cx","cy","DefaultLogoIcon","EditIcon","ExternalLinkIcon","FileIcon","FloatingIcon","FullscreenExitIcon","FullscreenIcon","GlobeIcon","r","InfoIcon","MailIcon","SearchIcon","SendIcon","SidebarIcon","SparklesIcon","StopCircleIcon","TerminalIcon","points","x1","x2","y1","y2","UserPlusIcon","WrenchIcon","Dropdown","open","onClose","anchorRef","placement","panelRef","pos","setPos","top","left","ref","handler","active","useEffect","listener","contains","target","document","addEventListener","removeEventListener","useClickOutside","useCallback","rect","getBoundingClientRect","right","bottom","portalTarget","el","node","classList","parentElement","findChatbotRoot","createPortal","style","Spinner","Tooltip","title","show","setShow","onMouseEnter","onMouseLeave","modeOptions","mode","label","getIcon","p","ChatHeader","agentName","agents","selectedAgent","transferredFrom","agentMenuOpen","onAgentMenuToggle","onAgentMenuClose","onSwitchAgent","modeMenuOpen","onModeMenuToggle","onModeMenuClose","onModeChange","onNewChat","logoIcon","agentDashboardUrl","agentAnchorRef","modeAnchorRef","CurrentModeIcon","onClick","agent","description","opt","ChatInput","onInputChange","onSend","onStop","onFileAdd","onFileRemove","onPaste","fileInputRef","textareaRef","hasContent","f","i","multiple","hidden","onChange","click","placeholder","min","scrollHeight","onKeyDown","shiftKey","rows","maxHeight","disabled","ThinkingTextBubble","cleaned","scrollTop","animation","ChatThinking","StatusIcon","showDots","rawNames","lower","n","toLowerCase","some","count","includes","display","c","toUpperCase","unique","Set","consultName","checkCount","fetchCount","targetName","resolveStatusVisual","_Fragment","delay","MarkdownMessage","copiedBlock","setCopiedBlock","Markdown","remarkPlugins","remarkGfm","components","code","match","exec","codeStr","String","handleCopyCode","navigator","clipboard","writeText","setTimeout","ul","ol","blockquote","a","href","rel","h1","h2","h3","table","th","td","ChatMessages","messagesEndRef","toolDetailMsgId","setToolDetailMsgId","scrollIntoView","behavior","msg","isAssistant","isEmpty","tn","ChatWelcome","firstName","promptSuggestions","onPromptClick","fontFamily","prompt","DEFAULT_SUGGESTIONS","ChatPanel","topOffset","user","accentColor","resizable","onWidthChange","onResizeStart","onResizeEnd","pushContentSelector","setModeMenuOpen","setAgentMenuOpen","handleSwitchAgent","setAgents","setSelectedAgent","then","json","savedSlug","find","slug","catch","onSwitch","useAgents","sidebarWidth","handleResizeStart","defaultWidth","isResizing","setSidebarWidth","stored","parseInt","Number","isNaN","setIsResizing","isResizingRef","sidebarWidthRef","onWidthChangeRef","onResizeEndRef","handleMouseMove","newWidth","innerWidth","clientX","maxWidth","clamped","max","handleMouseUp","cursor","userSelect","handleWindowResize","useSidebarResize","pushWidth","documentElement","setProperty","contentElement","querySelector","originalPaddingRight","paddingRight","originalTransition","transition","resolvedLogo","cssVars","sessions","clearStaleConversation","restored","containerClasses","base","containerStyle","onMouseDown","_","j","ChatToggleButton","isOpen","onToggle","icon","resolvedIcon","borderColor","color","backgroundColor","currentTarget"],"mappings":"8OAAM,SAAUA,EAASC,EAAaC,GAIpC,MAAO,GAAGD,IAHAE,KAAKC,MAAc,IAARF,GAClBG,SAAS,IACTC,SAAS,EAAG,MAEjB,CAEO,MAAMC,EAAYC,GAAgBA,ECFnC,SAAUC,EAAiBC,EAA8BC,GAC7D,MAAMC,EAAYF,EAAIG,MAEtB,GAAkB,kBAAdD,EAA+B,CACjC,MAAME,EAAOJ,EAAII,KACXC,EAASD,GAAMC,OAIrB,MAHqB,eAAjBD,GAAME,QAA2BD,IACnCJ,EAAIM,aAAeF,GAEd,CAAEG,OAAQ,OACnB,CAEA,GAAkB,UAAdN,EACF,MAAO,CAAEM,OAAQ,QAGnB,GAAkB,UAAdN,EAAuB,CAEzB,MAAO,CAAEM,OAAQ,SAAUC,SADPT,EAAII,MAAmB,IAAIM,QAAQ,cAAe,MAExE,CAEA,GAAkB,mBAAdR,EAAgC,CAClC,MAAMS,EAAYX,EAAII,KAChBQ,EAAYD,GAAWC,UAC7B,OAAIA,GAAWC,QACbZ,EAAIa,cAAe,EACZ,CAAEN,OAAQ,SAAUF,OAAQ,aAAcS,MAAOH,EAAUI,IAAKC,GAAMA,EAAEC,QAE7EjB,EAAIa,aACC,CAAEN,OAAQ,SAAUF,OAAQ,aAE9B,CAAEE,OAAQ,SAAUF,OAAQ,WACrC,CAEA,GAAkB,cAAdJ,EAA2B,CAC7BD,EAAIa,cAAe,EACnB,MAAMV,EAAOJ,EAAII,KAEjB,MAAO,CAAEI,OAAQ,SAAUF,OAAQ,aA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,GAAY,CAAC1T,SAAUA,EAAUK,UAAWA,EAAWE,YAAaA,EAAa8M,UAAWA,GAAWa,SAAUkK,GAActa,EAAGA,IAErIuJ,EAACsH,EAAS,CACRxO,WAAYA,EACZyO,cAAexO,EACfyO,OAAQjM,EACRkM,OAAQhI,EACRzG,UAAWA,EACXQ,cAAeA,EACfkO,UAAWxN,EACXyN,aAAeM,GAAMxO,EAAkBuB,GAASA,EAAK0E,OAAO,CAAC8R,EAAGC,IAAMA,IAAMxJ,IAC5EL,QAAS1M,EACTzE,EAAGA,EACHkP,KAAMA,QC9OD+L,GAA6D,EAAGC,SAAQC,WAAUhM,QAAQ,gBAAiB6H,cAAc,UAAWoE,WAC/I,MAAMC,EAAeD,GAAQ7R,EAACyB,EAAe,CAAC5G,KAAM,KAEpD,OACEgG,EAAA,SAAA,CACE9J,KAAK,SACLmQ,QAAS0K,EACT7R,UAAU,qJACVmF,MAAO,CACL6M,YAAaJ,EAASlE,EAAc3Y,EAAS2Y,EAAa,IAC1DuE,MAAOvE,EACPwE,gBAAiBN,EAAS7c,EAAS2Y,EAAa,IAAO,eAEzDjI,aAAerK,IACbA,EAAE+W,cAAchN,MAAM6M,YAActE,EACpCtS,EAAE+W,cAAchN,MAAM+M,gBAAkBnd,EAAS2Y,EAAa,KAEhEhI,aAAetK,IACbA,EAAE+W,cAAchN,MAAM6M,YAAcJ,EAASlE,EAAc3Y,EAAS2Y,EAAa,IACjFtS,EAAE+W,cAAchN,MAAM+M,gBAAkBN,EAAS7c,EAAS2Y,EAAa,IAAO,eAC/E/M,SAAA,CAEDV,EAAA,OAAA,CAAMD,UAAU,0BAAyBW,SAAEoR,IAC1ClM"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/utils/index.ts","../../src/hooks/protocols/parseLegacyEvent.ts","../../src/hooks/protocols/parseRestEvent.ts","../../src/hooks/protocols/parseAgUiEvent.ts","../../src/hooks/useChat.ts","../../src/hooks/useAgents.ts","../../src/hooks/useSidebarResize.ts","../../src/components/icons/AttachFileIcon.tsx","../../src/components/icons/BrainIcon.tsx","../../src/components/icons/CheckIcon.tsx","../../src/components/icons/ChevronDownIcon.tsx","../../src/components/icons/CloseIcon.tsx","../../src/components/icons/CopyIcon.tsx","../../src/components/icons/DatabaseIcon.tsx","../../src/components/icons/DefaultLogoIcon.tsx","../../src/components/icons/EditIcon.tsx","../../src/components/icons/ExternalLinkIcon.tsx","../../src/components/icons/FileIcon.tsx","../../src/components/icons/FloatingIcon.tsx","../../src/components/icons/FullscreenExitIcon.tsx","../../src/components/icons/FullscreenIcon.tsx","../../src/components/icons/GlobeIcon.tsx","../../src/components/icons/InfoIcon.tsx","../../src/components/icons/MailIcon.tsx","../../src/components/icons/SearchIcon.tsx","../../src/components/icons/SendIcon.tsx","../../src/components/icons/SidebarIcon.tsx","../../src/components/icons/SparklesIcon.tsx","../../src/components/icons/StopCircleIcon.tsx","../../src/components/icons/TerminalIcon.tsx","../../src/components/icons/UserPlusIcon.tsx","../../src/components/icons/WrenchIcon.tsx","../../src/components/Dropdown.tsx","../../src/hooks/useClickOutside.ts","../../src/components/Spinner.tsx","../../src/components/Tooltip.tsx","../../src/components/ChatHeader.tsx","../../src/components/ChatInput.tsx","../../src/components/ChatThinking.tsx","../../src/components/MarkdownMessage.tsx","../../src/components/ChatMessages.tsx","../../src/components/ChatWelcome.tsx","../../src/components/ChatPanel.tsx","../../src/components/ChatToggleButton.tsx"],"sourcesContent":["export function hexAlpha(hex: string, alpha: number): string {\n const a = Math.round(alpha * 255)\n .toString(16)\n .padStart(2, '0');\n return `${hex}${a}`;\n}\n\nexport const identity = (key: string) => key;\n","import type { ParsedAction, ProtocolContext } from './types';\n\n/**\n * Parse a Flowise-style SSE event into a normalized action.\n */\nexport function parseLegacyEvent(evt: Record<string, unknown>, ctx: ProtocolContext): ParsedAction {\n const eventType = evt.event as string | undefined;\n\n if (eventType === 'nextAgentFlow') {\n const data = evt.data as Record<string, unknown> | undefined;\n const nodeId = data?.nodeId as string | undefined;\n if (data?.status === 'INPROGRESS' && nodeId) {\n ctx.activeNodeId = nodeId;\n }\n return { action: 'noop' };\n }\n\n if (eventType === 'start') {\n return { action: 'noop' };\n }\n\n if (eventType === 'token') {\n const tokenData = ((evt.data as string) ?? '').replace(/<br\\s*\\/?>/g, '\\n');\n return { action: 'stream', content: tokenData };\n }\n\n if (eventType === 'agentReasoning') {\n const reasoning = evt.data as Record<string, unknown> | undefined;\n const usedTools = reasoning?.usedTools as Array<{ tool: string }> | undefined;\n if (usedTools?.length) {\n ctx.hasUsedTools = true;\n return { action: 'status', status: 'tool_start', tools: usedTools.map((t) => t.tool) };\n }\n if (ctx.hasUsedTools) {\n return { action: 'status', status: 'analyzing' };\n }\n return { action: 'status', status: 'thinking' };\n }\n\n if (eventType === 'usedTools') {\n ctx.hasUsedTools = true;\n const data = evt.data as Array<{ tool: string }> | undefined;\n const toolNames = Array.isArray(data) ? data.map((t) => t.tool) : [];\n return { action: 'status', status: 'tool_start', tools: toolNames };\n }\n\n if (eventType === 'metadata') {\n const data = evt.data as Record<string, unknown> | undefined;\n const chatId = data?.chatId as string | undefined;\n if (chatId) {\n return { action: 'set_chat_id', chatId };\n }\n return { action: 'noop' };\n }\n\n if (eventType === 'error') {\n return { action: 'error', content: (evt.data as string) || '' };\n }\n\n if (eventType === 'end') {\n return { action: 'done', content: '' };\n }\n\n return { action: 'noop' };\n}\n","import type { ParsedAction, ProtocolContext } from './types';\n\n/**\n * Parse an XTM One (REST) SSE event into a normalized action.\n */\nexport function parseRestEvent(evt: Record<string, unknown>, ctx: ProtocolContext): ParsedAction {\n const type = evt.type as string | undefined;\n\n if (type === 'error') {\n return { action: 'error', content: (evt.content as string) || '' };\n }\n\n if (type === 'status') {\n const st = evt.status as string;\n if (st === 'tool_done' || st === 'wind_down') {\n return { action: 'noop' };\n }\n if (st === 'streaming') {\n return { action: 'status', status: 'streaming' };\n }\n if (st === 'thinking_text') {\n return { action: 'status', status: 'thinking_text', thinkingContent: evt.content as string };\n }\n if (st === 'tool_start') {\n ctx.hasUsedTools = true;\n return { action: 'status', status: 'tool_start', tools: evt.tools as string[] | undefined };\n }\n if (st === 'thinking' && ctx.hasUsedTools) {\n return { action: 'status', status: 'analyzing' };\n }\n return { action: 'status', status: st, tools: evt.tools as string[] | undefined };\n }\n\n if (type === 'stream') {\n return { action: 'stream', content: evt.content as string };\n }\n\n if (type === 'done') {\n return {\n action: 'done',\n content: evt.content as string,\n conversationId: evt.conversation_id as string | undefined,\n toolNames: evt.tool_names as string[] | undefined,\n toolCallCount: evt.tool_call_count as number | undefined,\n iterations: evt.iterations as number | undefined,\n transferAgentId: evt.transfer_agent_id as string | undefined,\n transferAgentName: evt.transfer_agent_name as string | undefined,\n };\n }\n\n return { action: 'noop' };\n}\n","import type { ParsedAction, ProtocolContext } from './types';\n\n/**\n * AG-UI protocol event types.\n * @see https://github.com/ag-ui-protocol/ag-ui\n */\n\n/**\n * Parse an AG-UI protocol SSE event into a normalized action.\n *\n * AG-UI uses a Start/Content/End lifecycle for messages and tool calls.\n * We map these to the same internal actions used by the other protocols.\n */\nexport function parseAgUiEvent(evt: Record<string, unknown>, ctx: ProtocolContext): ParsedAction {\n const type = evt.type as string | undefined;\n\n // --- Run lifecycle ---\n\n if (type === 'RUN_STARTED') {\n return { action: 'status', status: 'thinking' };\n }\n\n if (type === 'RUN_FINISHED') {\n return { action: 'done', content: '' };\n }\n\n if (type === 'RUN_ERROR') {\n return { action: 'error', content: (evt.message as string) || 'Unknown error' };\n }\n\n // --- Step lifecycle ---\n\n if (type === 'STEP_STARTED') {\n const stepName = evt.stepName as string | undefined;\n return { action: 'status', status: stepName || 'thinking' };\n }\n\n if (type === 'STEP_FINISHED') {\n return { action: 'noop' };\n }\n\n // --- Text message streaming ---\n\n if (type === 'TEXT_MESSAGE_START') {\n return { action: 'status', status: 'streaming' };\n }\n\n if (type === 'TEXT_MESSAGE_CONTENT') {\n const delta = evt.delta as string;\n if (delta) {\n return { action: 'stream', content: delta };\n }\n return { action: 'noop' };\n }\n\n if (type === 'TEXT_MESSAGE_END') {\n return { action: 'noop' };\n }\n\n // TEXT_MESSAGE_CHUNK is a convenience event that combines Start+Content+End\n if (type === 'TEXT_MESSAGE_CHUNK') {\n const delta = evt.delta as string | undefined;\n if (delta) {\n return { action: 'stream', content: delta };\n }\n return { action: 'noop' };\n }\n\n // --- Tool call lifecycle ---\n\n if (type === 'TOOL_CALL_START') {\n ctx.hasUsedTools = true;\n const toolName = evt.toolCallName as string | undefined;\n return { action: 'status', status: 'tool_start', tools: toolName ? [toolName] : [] };\n }\n\n if (type === 'TOOL_CALL_ARGS') {\n // Tool arguments streaming — no UI equivalent, skip\n return { action: 'noop' };\n }\n\n if (type === 'TOOL_CALL_END') {\n return { action: 'status', status: 'analyzing' };\n }\n\n if (type === 'TOOL_CALL_RESULT') {\n // Tool result — no direct UI mapping, skip\n return { action: 'noop' };\n }\n\n if (type === 'TOOL_CALL_CHUNK') {\n // Convenience form — treat like TOOL_CALL_START if it has a name\n const toolName = evt.toolCallName as string | undefined;\n if (toolName) {\n ctx.hasUsedTools = true;\n return { action: 'status', status: 'tool_start', tools: [toolName] };\n }\n return { action: 'noop' };\n }\n\n // --- Reasoning / thinking ---\n\n if (type === 'REASONING_START' || type === 'REASONING_MESSAGE_START') {\n return { action: 'status', status: 'thinking' };\n }\n\n if (type === 'REASONING_MESSAGE_CONTENT' || type === 'REASONING_MESSAGE_CHUNK') {\n // Reasoning text — show as thinking status (content not surfaced to chat)\n return { action: 'status', status: 'thinking' };\n }\n\n if (type === 'REASONING_MESSAGE_END' || type === 'REASONING_END' || type === 'REASONING_ENCRYPTED_VALUE') {\n return { action: 'noop' };\n }\n\n // --- State management ---\n\n if (type === 'STATE_SNAPSHOT' || type === 'STATE_DELTA' || type === 'MESSAGES_SNAPSHOT') {\n // State sync — not mapped to chat UI currently\n return { action: 'noop' };\n }\n\n // --- Activity events ---\n\n if (type === 'ACTIVITY_SNAPSHOT' || type === 'ACTIVITY_DELTA') {\n return { action: 'noop' };\n }\n\n // --- Pass-through / custom ---\n\n if (type === 'RAW' || type === 'CUSTOM') {\n return { action: 'noop' };\n }\n\n return { action: 'noop' };\n}\n","import { useRef, useState } from 'react';\nimport type { AgentStatusState, ApiEndpoints, BackendType, ChatFile, ChatMessage } from '../types';\nimport type { ParsedAction, ProtocolContext } from './protocols';\nimport { parseAgUiEvent, parseLegacyEvent, parseRestEvent } from './protocols';\n\nconst STORAGE_KEY = 'filigranChatConversationId';\nconst LEGACY_CHAT_ID_KEY = 'filigranChatLegacyChatId';\n\ninterface UseChatOptions {\n apiBaseUrl: string;\n apiEndpoints?: ApiEndpoints;\n backendType?: BackendType;\n agentSlug: string | null | undefined;\n t: (key: string) => string;\n}\n\nexport interface TransferredAgent {\n id: string;\n name: string;\n}\n\ninterface UseChatReturn {\n messages: ChatMessage[];\n inputValue: string;\n setInputValue: (value: string) => void;\n isLoading: boolean;\n agentStatus: AgentStatusState | null;\n attachedFiles: ChatFile[];\n conversationId: string | null;\n transferredAgent: TransferredAgent | null;\n historyLoadedRef: React.MutableRefObject<boolean>;\n handleFileAdd: (fileList: FileList | null) => void;\n handlePaste: (e: React.ClipboardEvent) => void;\n handleSendMessage: () => Promise<void>;\n handleNewChat: () => void;\n handleStopGenerating: () => void;\n setAttachedFiles: React.Dispatch<React.SetStateAction<ChatFile[]>>;\n setMessages: React.Dispatch<React.SetStateAction<ChatMessage[]>>;\n setConversationId: React.Dispatch<React.SetStateAction<string | null>>;\n}\n\nfunction getParser(backendType: BackendType): (evt: Record<string, unknown>, ctx: ProtocolContext) => ParsedAction {\n switch (backendType) {\n case 'legacy':\n return parseLegacyEvent;\n case 'ag-ui':\n return parseAgUiEvent;\n default:\n return parseRestEvent;\n }\n}\n\nfunction buildRequestBody(\n backendType: BackendType,\n content: string,\n opts: { legacyChatId: string | null; conversationId: string | null; agentSlug: string | null | undefined },\n): Record<string, unknown> {\n switch (backendType) {\n case 'legacy':\n return { question: content, chatId: opts.legacyChatId ?? undefined, streaming: true };\n case 'ag-ui':\n return {\n threadId: opts.conversationId ?? crypto.randomUUID(),\n runId: crypto.randomUUID(),\n messages: [{ id: crypto.randomUUID(), role: 'user', content }],\n tools: [],\n context: [],\n state: {},\n forwardedProps: opts.agentSlug ? { agentSlug: opts.agentSlug } : {},\n };\n default:\n return { content, conversation_id: opts.conversationId, agent_slug: opts.agentSlug };\n }\n}\n\nexport function useChat({ apiBaseUrl, apiEndpoints, backendType = 'rest', agentSlug, t }: UseChatOptions): UseChatReturn {\n const isLegacy = backendType === 'legacy';\n const [messages, setMessages] = useState<ChatMessage[]>([]);\n const [inputValue, setInputValue] = useState('');\n const [isLoading, setIsLoading] = useState(false);\n const [agentStatus, setAgentStatus] = useState<AgentStatusState | null>(null);\n const [conversationId, setConversationId] = useState<string | null>(() => {\n if (typeof window === 'undefined') return null;\n return localStorage.getItem(STORAGE_KEY);\n });\n const [attachedFiles, setAttachedFiles] = useState<ChatFile[]>([]);\n const [transferredAgent, setTransferredAgent] = useState<TransferredAgent | null>(null);\n const [legacyChatId, setLegacyChatId] = useState<string | null>(() => {\n if (typeof window === 'undefined') return null;\n return localStorage.getItem(LEGACY_CHAT_ID_KEY);\n });\n\n const historyLoadedRef = useRef(false);\n const abortControllerRef = useRef<AbortController | null>(null);\n const hasUsedToolsRef = useRef(false);\n\n // Determine message endpoint URL\n const getMessagesUrl = () => {\n if (isLegacy || apiEndpoints?.singleEndpoint) {\n return apiBaseUrl; // POST directly to base URL\n }\n return `${apiBaseUrl}${apiEndpoints?.messages ?? '/chat/messages'}`;\n };\n\n const handleFileAdd = (fileList: FileList | null) => {\n if (!fileList) return;\n const newFiles: ChatFile[] = [];\n Array.from(fileList).forEach((file) => {\n const reader = new FileReader();\n reader.onload = () => {\n newFiles.push({\n name: file.name,\n type: file.type,\n size: file.size,\n dataUrl: reader.result as string,\n });\n if (newFiles.length === fileList.length) {\n setAttachedFiles((prev) => [...prev, ...newFiles]);\n }\n };\n reader.readAsDataURL(file);\n });\n };\n\n const handlePaste = (e: React.ClipboardEvent) => {\n const { files } = e.clipboardData;\n if (files.length > 0) {\n e.preventDefault();\n handleFileAdd(files);\n }\n };\n\n const handleSendMessage = async () => {\n if ((!inputValue.trim() && attachedFiles.length === 0) || isLoading) return;\n const content = inputValue.trim();\n\n const userMsg: ChatMessage = {\n id: crypto.randomUUID(),\n role: 'user',\n content,\n timestamp: new Date(),\n files: attachedFiles.length > 0 ? [...attachedFiles] : undefined,\n };\n setMessages((prev) => [...prev, userMsg]);\n setInputValue('');\n setAttachedFiles([]);\n setIsLoading(true);\n setAgentStatus({ status: 'thinking' });\n hasUsedToolsRef.current = false;\n\n const assistantId = crypto.randomUUID();\n setMessages((prev) => [...prev, { id: assistantId, role: 'assistant', content: '', timestamp: new Date() }]);\n\n try {\n const controller = new AbortController();\n abortControllerRef.current = controller;\n\n const requestBody = buildRequestBody(backendType, content, { legacyChatId, conversationId, agentSlug });\n\n const res = await fetch(getMessagesUrl(), {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(requestBody),\n signal: controller.signal,\n });\n\n if (!res.ok || !res.body) {\n setMessages((prev) =>\n prev.map((m) => (m.id === assistantId ? { ...m, content: t('Unable to connect. Please check the configuration.') } : m)),\n );\n return;\n }\n\n const parseEvent = getParser(backendType);\n const ctx: ProtocolContext = { hasUsedTools: false, activeNodeId: '' };\n\n const reader = res.body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n let accumulated = '';\n let doneReceived = false;\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() || '';\n for (const rawLine of lines) {\n const line = rawLine.replace(/\\r$/, '');\n if (!line.startsWith('data:')) continue;\n const jsonStr = line.startsWith('data: ') ? line.slice(6) : line.slice(5);\n try {\n const evt = JSON.parse(jsonStr) as Record<string, unknown>;\n const parsed: ParsedAction = parseEvent(evt, ctx);\n\n // Sync ref → context for cross-event tracking\n ctx.hasUsedTools = ctx.hasUsedTools || hasUsedToolsRef.current;\n\n switch (parsed.action) {\n case 'status':\n if (parsed.status === 'tool_start') hasUsedToolsRef.current = true;\n if (parsed.status === 'thinking_text') {\n setAgentStatus((prev) => ({\n ...prev,\n status: prev?.status ?? 'thinking',\n thinkingContent: (prev?.thinkingContent ?? '') + (parsed.thinkingContent ?? ''),\n }));\n } else {\n setAgentStatus((prev) => ({\n status: parsed.status,\n tools: parsed.tools,\n thinkingContent: prev?.thinkingContent,\n }));\n }\n break;\n\n case 'stream':\n accumulated += parsed.content;\n setAgentStatus((prev) => ({ status: 'streaming', thinkingContent: prev?.thinkingContent }));\n setMessages((prev) => prev.map((m) => (m.id === assistantId ? { ...m, content: accumulated } : m)));\n break;\n\n case 'done':\n doneReceived = true;\n if (parsed.conversationId) {\n setConversationId(parsed.conversationId);\n localStorage.setItem(STORAGE_KEY, parsed.conversationId);\n }\n if (parsed.transferAgentId && parsed.transferAgentName) {\n setTransferredAgent({ id: parsed.transferAgentId, name: parsed.transferAgentName });\n }\n setMessages((prev) =>\n prev.map((m) =>\n m.id === assistantId\n ? {\n ...m,\n content: parsed.content || accumulated,\n toolNames: parsed.toolNames,\n toolCallCount: parsed.toolCallCount,\n iterations: parsed.iterations,\n }\n : m,\n ),\n );\n break;\n\n case 'error':\n setMessages((prev) =>\n prev.map((m) =>\n m.id === assistantId ? { ...m, content: parsed.content || t('Unable to connect. Please check the configuration.') } : m,\n ),\n );\n return;\n\n case 'set_chat_id':\n setLegacyChatId(parsed.chatId);\n localStorage.setItem(LEGACY_CHAT_ID_KEY, parsed.chatId);\n break;\n\n case 'noop':\n break;\n }\n\n // Keep ref in sync with context\n hasUsedToolsRef.current = ctx.hasUsedTools;\n } catch {\n /* skip malformed SSE */\n }\n }\n }\n if (accumulated && !doneReceived) {\n setMessages((prev) => prev.map((m) => (m.id === assistantId ? { ...m, content: accumulated || 'No response.' } : m)));\n }\n } catch (err) {\n if (err instanceof DOMException && err.name === 'AbortError') return;\n setMessages((prev) =>\n prev.map((m) => (m.id === assistantId ? { ...m, content: t('Sorry, an error occurred. Please try again.') } : m)),\n );\n } finally {\n abortControllerRef.current = null;\n setIsLoading(false);\n setAgentStatus(null);\n hasUsedToolsRef.current = false;\n }\n };\n\n const handleNewChat = () => {\n abortControllerRef.current?.abort();\n abortControllerRef.current = null;\n setMessages([]);\n setInputValue('');\n setAttachedFiles([]);\n setIsLoading(false);\n setAgentStatus(null);\n setTransferredAgent(null);\n hasUsedToolsRef.current = false;\n historyLoadedRef.current = false;\n if (isLegacy) {\n setLegacyChatId(null);\n localStorage.removeItem(LEGACY_CHAT_ID_KEY);\n } else {\n setConversationId(null);\n localStorage.removeItem(STORAGE_KEY);\n }\n };\n\n const handleStopGenerating = () => {\n abortControllerRef.current?.abort();\n abortControllerRef.current = null;\n setIsLoading(false);\n setAgentStatus(null);\n hasUsedToolsRef.current = false;\n setMessages((prev) => prev.filter((m) => !(m.role === 'assistant' && !m.content)));\n };\n\n return {\n messages,\n inputValue,\n setInputValue,\n isLoading,\n agentStatus,\n attachedFiles,\n conversationId,\n transferredAgent,\n historyLoadedRef,\n handleFileAdd,\n handlePaste,\n handleSendMessage,\n handleNewChat,\n handleStopGenerating,\n setAttachedFiles,\n setMessages,\n setConversationId,\n };\n}\n","import { useEffect, useState } from 'react';\nimport type { ApiEndpoints, BackendType, XtmAgent } from '../types';\n\nconst STORAGE_AGENT_KEY = 'filigranChatAgentSlug';\n\ninterface UseAgentsOptions {\n apiBaseUrl: string;\n apiEndpoints?: ApiEndpoints;\n backendType?: BackendType;\n}\n\ninterface UseAgentsReturn {\n agents: XtmAgent[];\n selectedAgent: XtmAgent | null;\n setSelectedAgent: React.Dispatch<React.SetStateAction<XtmAgent | null>>;\n agentMenuOpen: boolean;\n setAgentMenuOpen: React.Dispatch<React.SetStateAction<boolean>>;\n handleSwitchAgent: (agent: XtmAgent, onSwitch?: () => void) => void;\n}\n\nexport function useAgents({ apiBaseUrl, apiEndpoints, backendType = 'rest' }: UseAgentsOptions): UseAgentsReturn {\n const [agents, setAgents] = useState<XtmAgent[]>([]);\n const [selectedAgent, setSelectedAgent] = useState<XtmAgent | null>(null);\n const [agentMenuOpen, setAgentMenuOpen] = useState(false);\n\n useEffect(() => {\n // Skip agents fetch if disabled, using single endpoint mode, or legacy backend\n if (apiEndpoints?.agents === null || apiEndpoints?.singleEndpoint || backendType === 'legacy') {\n return;\n }\n const agentsUrl = `${apiBaseUrl}${apiEndpoints?.agents ?? '/chat/agents'}`;\n fetch(agentsUrl)\n .then((res) => (res.ok ? res.json() : []))\n .then((data: XtmAgent[]) => {\n setAgents(data);\n if (data.length > 0 && !selectedAgent) {\n const savedSlug = localStorage.getItem(STORAGE_AGENT_KEY);\n const match = savedSlug ? data.find((a) => a.slug === savedSlug) : null;\n setSelectedAgent(match || data[0]);\n }\n })\n .catch(() => {});\n }, [apiBaseUrl, apiEndpoints]);\n\n const handleSwitchAgent = (agent: XtmAgent, onSwitch?: () => void) => {\n if (agent.id === selectedAgent?.id) {\n setAgentMenuOpen(false);\n return;\n }\n setSelectedAgent(agent);\n if (agent.slug) localStorage.setItem(STORAGE_AGENT_KEY, agent.slug);\n setAgentMenuOpen(false);\n onSwitch?.();\n };\n\n return {\n agents,\n selectedAgent,\n setSelectedAgent,\n agentMenuOpen,\n setAgentMenuOpen,\n handleSwitchAgent,\n };\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { ChatMode } from '../types';\n\nconst SIDEBAR_WIDTH = 400;\nconst SIDEBAR_WIDTH_STORAGE_KEY = 'filigranChatSidebarWidth';\nconst MAX_SIDEBAR_RATIO = 0.4;\n\ninterface UseSidebarResizeOptions {\n mode: ChatMode;\n resizable: boolean;\n onWidthChange?: (width: number) => void;\n onResizeStart?: () => void;\n onResizeEnd?: () => void;\n}\n\ninterface UseSidebarResizeReturn {\n sidebarWidth: number;\n handleResizeStart: (e: React.MouseEvent) => void;\n defaultWidth: number;\n isResizing: boolean;\n}\n\nexport function useSidebarResize({\n mode,\n resizable,\n onWidthChange,\n onResizeStart,\n onResizeEnd,\n}: UseSidebarResizeOptions): UseSidebarResizeReturn {\n const [sidebarWidth, setSidebarWidth] = useState<number>(() => {\n if (typeof window === 'undefined') return SIDEBAR_WIDTH;\n const stored = localStorage.getItem(SIDEBAR_WIDTH_STORAGE_KEY);\n if (stored) {\n const parsed = parseInt(stored, 10);\n if (!Number.isNaN(parsed) && parsed >= SIDEBAR_WIDTH) return parsed;\n }\n return SIDEBAR_WIDTH;\n });\n const [isResizing, setIsResizing] = useState(false);\n\n const isResizingRef = useRef(false);\n const sidebarWidthRef = useRef(sidebarWidth);\n sidebarWidthRef.current = sidebarWidth;\n const onWidthChangeRef = useRef(onWidthChange);\n onWidthChangeRef.current = onWidthChange;\n const onResizeEndRef = useRef(onResizeEnd);\n onResizeEndRef.current = onResizeEnd;\n\n // Notify parent of sidebar width when entering sidebar mode\n useEffect(() => {\n if (mode === 'sidebar' && resizable) {\n onWidthChangeRef.current?.(sidebarWidthRef.current);\n }\n }, [mode, resizable]);\n\n // Resize event handlers\n useEffect(() => {\n if (mode !== 'sidebar' || !resizable) return undefined;\n\n const handleMouseMove = (e: MouseEvent) => {\n if (!isResizingRef.current) return;\n e.preventDefault();\n const newWidth = window.innerWidth - e.clientX;\n const maxWidth = window.innerWidth * MAX_SIDEBAR_RATIO;\n const clamped = Math.min(Math.max(newWidth, SIDEBAR_WIDTH), maxWidth);\n setSidebarWidth(clamped);\n sidebarWidthRef.current = clamped;\n onWidthChangeRef.current?.(clamped);\n };\n\n const handleMouseUp = () => {\n if (!isResizingRef.current) return;\n isResizingRef.current = false;\n setIsResizing(false);\n document.body.style.cursor = '';\n document.body.style.userSelect = '';\n localStorage.setItem(SIDEBAR_WIDTH_STORAGE_KEY, String(sidebarWidthRef.current));\n onResizeEndRef.current?.();\n };\n\n const handleWindowResize = () => {\n const maxWidth = window.innerWidth * MAX_SIDEBAR_RATIO;\n if (sidebarWidthRef.current > maxWidth) {\n const clamped = Math.max(maxWidth, SIDEBAR_WIDTH);\n setSidebarWidth(clamped);\n sidebarWidthRef.current = clamped;\n onWidthChangeRef.current?.(clamped);\n }\n };\n\n document.addEventListener('mousemove', handleMouseMove);\n document.addEventListener('mouseup', handleMouseUp);\n window.addEventListener('resize', handleWindowResize);\n\n return () => {\n document.removeEventListener('mousemove', handleMouseMove);\n document.removeEventListener('mouseup', handleMouseUp);\n window.removeEventListener('resize', handleWindowResize);\n };\n }, [mode, resizable]);\n\n const handleResizeStart = (e: React.MouseEvent) => {\n e.preventDefault();\n isResizingRef.current = true;\n setIsResizing(true);\n document.body.style.cursor = 'col-resize';\n document.body.style.userSelect = 'none';\n onResizeStart?.();\n };\n\n return {\n sidebarWidth,\n handleResizeStart,\n defaultWidth: SIDEBAR_WIDTH,\n isResizing,\n };\n}\n","import type { IconProps } from '../../types';\n\nexport const AttachFileIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const BrainIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z\" />\n <path d=\"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z\" />\n <path d=\"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4\" />\n <path d=\"M17.599 6.5a3 3 0 0 0 .399-1.375\" />\n <path d=\"M6.003 5.125A3 3 0 0 0 6.401 6.5\" />\n <path d=\"M3.477 10.896a4 4 0 0 1 .585-.396\" />\n <path d=\"M19.938 10.5a4 4 0 0 1 .585.396\" />\n <path d=\"M6 18a4 4 0 0 1-1.967-.516\" />\n <path d=\"M19.967 17.484A4 4 0 0 1 18 18\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const CheckIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const ChevronDownIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const CloseIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const CopyIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const DatabaseIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <ellipse cx=\"12\" cy=\"5\" rx=\"9\" ry=\"3\" />\n <path d=\"M3 5V19A9 3 0 0 0 21 19V5\" />\n <path d=\"M3 12A9 3 0 0 0 21 12\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const DefaultLogoIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"currentColor\" stroke=\"none\" className={className}>\n <path d=\"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const EditIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M12 20h9\" />\n <path d=\"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const ExternalLinkIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M15 3h6v6\" />\n <path d=\"M10 14 21 3\" />\n <path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const FileIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z\" />\n <path d=\"M14 2v4a2 2 0 0 0 2 2h4\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const FloatingIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M11 13H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7\" />\n <rect width=\"12\" height=\"12\" x=\"10\" y=\"10\" rx=\"2\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const FullscreenExitIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M8 3v3a2 2 0 0 1-2 2H3\" />\n <path d=\"M21 8h-3a2 2 0 0 1-2-2V3\" />\n <path d=\"M3 16h3a2 2 0 0 0 2 2v3\" />\n <path d=\"M16 21v-3a2 2 0 0 1 2-2h3\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const FullscreenIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M8 3H5a2 2 0 0 0-2 2v3\" />\n <path d=\"M21 8V5a2 2 0 0 0-2-2h-3\" />\n <path d=\"M3 16v3a2 2 0 0 0 2 2h3\" />\n <path d=\"M16 21h3a2 2 0 0 0 2-2v-3\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const GlobeIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20\" />\n <path d=\"M2 12h20\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const InfoIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const MailIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\" />\n <path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const SearchIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n <path d=\"m21 21-4.3-4.3\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const SendIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"m22 2-7 20-4-9-9-4Z\" />\n <path d=\"m22 2-11 11\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const SidebarIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M15 3v18\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const SparklesIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const StopCircleIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <rect width=\"6\" height=\"6\" x=\"9\" y=\"9\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const TerminalIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <polyline points=\"4 17 10 11 4 5\" />\n <line x1=\"12\" x2=\"20\" y1=\"19\" y2=\"19\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const UserPlusIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" />\n <line x1=\"19\" x2=\"19\" y1=\"8\" y2=\"14\" />\n <line x1=\"22\" x2=\"16\" y1=\"11\" y2=\"11\" />\n </svg>\n);\n","import type { IconProps } from '../../types';\n\nexport const WrenchIcon = ({ className, size = 24 }: IconProps) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z\" />\n </svg>\n);\n","import { useCallback, useEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { useClickOutside } from '../hooks/useClickOutside';\n\ninterface DropdownProps {\n open: boolean;\n onClose: () => void;\n anchorRef: React.RefObject<HTMLElement | null>;\n placement?: 'bottom-start' | 'bottom-end';\n width?: number;\n children: React.ReactNode;\n}\n\nfunction findChatbotRoot(el: HTMLElement | null): HTMLElement {\n let node = el;\n while (node) {\n if (node.classList.contains('filigran-chatbot')) return node;\n node = node.parentElement;\n }\n return document.body;\n}\n\nexport const Dropdown = ({ open, onClose, anchorRef, placement = 'bottom-start', width = 280, children }: DropdownProps) => {\n const panelRef = useRef<HTMLDivElement>(null);\n const [pos, setPos] = useState({ top: 0, left: 0 });\n\n const stableOnClose = useCallback(() => onClose(), [onClose]);\n useClickOutside(panelRef, stableOnClose, open);\n\n useEffect(() => {\n if (!open || !anchorRef.current) return;\n const rect = anchorRef.current.getBoundingClientRect();\n const left = placement === 'bottom-end' ? rect.right - width : rect.left;\n setPos({ top: rect.bottom + 4, left });\n }, [open, anchorRef, placement, width]);\n\n if (!open) return null;\n\n const portalTarget = findChatbotRoot(anchorRef.current);\n\n return createPortal(\n <div\n ref={panelRef}\n className=\"fixed z-[10000] rounded-[10px] overflow-hidden border border-gray-200 dark:border-white/10 bg-white dark:bg-[#2a2a3e] shadow-xl\"\n style={{ top: pos.top, left: pos.left, width }}\n >\n {children}\n </div>,\n portalTarget,\n );\n};\n","import { useEffect, type RefObject } from 'react';\n\nexport function useClickOutside(ref: RefObject<HTMLElement | null>, handler: () => void, active = true) {\n useEffect(() => {\n if (!active) return undefined;\n const listener = (e: MouseEvent | TouchEvent) => {\n if (!ref.current || ref.current.contains(e.target as Node)) return;\n handler();\n };\n document.addEventListener('mousedown', listener);\n document.addEventListener('touchstart', listener);\n return () => {\n document.removeEventListener('mousedown', listener);\n document.removeEventListener('touchstart', listener);\n };\n }, [ref, handler, active]);\n}\n","interface SpinnerProps {\n size?: number;\n className?: string;\n}\n\nexport const Spinner = ({ size = 16, className = '' }: SpinnerProps) => (\n <div\n className={`animate-spin rounded-full border-2 border-current/20 border-t-[var(--chat-accent)] ${className}`}\n style={{ width: size, height: size }}\n />\n);\n","import { useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\n\ninterface TooltipProps {\n title: string;\n children: React.ReactElement;\n}\n\nfunction findChatbotRoot(el: HTMLElement | null): HTMLElement {\n let node = el;\n while (node) {\n if (node.classList.contains('filigran-chatbot')) return node;\n node = node.parentElement;\n }\n return document.body;\n}\n\nexport const Tooltip = ({ title, children }: TooltipProps) => {\n const ref = useRef<HTMLSpanElement>(null);\n const [show, setShow] = useState(false);\n const [pos, setPos] = useState({ top: 0, left: 0 });\n\n if (!title) return children;\n\n const handleEnter = () => {\n if (!ref.current) return;\n const rect = ref.current.getBoundingClientRect();\n setPos({\n top: rect.top - 4,\n left: rect.left + rect.width / 2,\n });\n setShow(true);\n };\n\n return (\n <span\n ref={ref}\n className=\"inline-flex\"\n onMouseEnter={handleEnter}\n onMouseLeave={() => setShow(false)}\n >\n {children}\n {show &&\n createPortal(\n <span\n className=\"pointer-events-none fixed z-[10001] -translate-x-1/2 -translate-y-full whitespace-nowrap rounded-md bg-gray-900 dark:bg-gray-100 px-2 py-1 text-xs text-white dark:text-gray-900 shadow-lg\"\n style={{ top: pos.top, left: pos.left }}\n role=\"tooltip\"\n >\n {title}\n </span>,\n findChatbotRoot(ref.current),\n )}\n </span>\n );\n};\n","import { useRef } from 'react';\nimport type { ChatMode, XtmAgent } from '../types';\nimport {\n ChevronDownIcon,\n CloseIcon,\n EditIcon,\n ExternalLinkIcon,\n FloatingIcon,\n FullscreenExitIcon,\n FullscreenIcon,\n SidebarIcon,\n UserPlusIcon,\n} from './icons';\nimport { Dropdown } from './Dropdown';\nimport { Spinner } from './Spinner';\nimport { Tooltip } from './Tooltip';\n\ninterface ChatHeaderProps {\n mode: ChatMode;\n agentName: string;\n agents: XtmAgent[];\n selectedAgent: XtmAgent | null;\n transferredFrom?: string;\n agentMenuOpen: boolean;\n onAgentMenuToggle: () => void;\n onAgentMenuClose: () => void;\n onSwitchAgent: (agent: XtmAgent) => void;\n modeMenuOpen: boolean;\n onModeMenuToggle: () => void;\n onModeMenuClose: () => void;\n onModeChange: (mode: ChatMode) => void;\n onNewChat: () => void;\n onClose: () => void;\n logoIcon: React.ReactNode;\n agentDashboardUrl?: string;\n t: (key: string) => string;\n}\n\nconst modeOptions: { mode: ChatMode; label: string; getIcon: (p: { size: number; className: string }) => React.ReactNode }[] = [\n { mode: 'floating', label: 'Floating', getIcon: (p) => <FloatingIcon {...p} /> },\n { mode: 'sidebar', label: 'Sidebar', getIcon: (p) => <SidebarIcon {...p} /> },\n { mode: 'fullscreen', label: 'Full screen', getIcon: (p) => <FullscreenIcon {...p} /> },\n];\n\nexport const ChatHeader = ({\n mode,\n agentName,\n agents,\n selectedAgent,\n transferredFrom,\n agentMenuOpen,\n onAgentMenuToggle,\n onAgentMenuClose,\n onSwitchAgent,\n modeMenuOpen,\n onModeMenuToggle,\n onModeMenuClose,\n onModeChange,\n onNewChat,\n onClose,\n logoIcon,\n agentDashboardUrl,\n t,\n}: ChatHeaderProps) => {\n const agentAnchorRef = useRef<HTMLButtonElement>(null);\n const modeAnchorRef = useRef<HTMLButtonElement>(null);\n\n const CurrentModeIcon = mode === 'sidebar' ? SidebarIcon : mode === 'fullscreen' ? FullscreenExitIcon : FloatingIcon;\n\n return (\n <div className={`flex items-center px-3 py-2 min-h-[48px] border-b border-gray-200 dark:border-white/10 bg-gradient-to-br from-[var(--chat-accent-dark)]/[0.13] to-[var(--chat-accent)]/[0.07] ${mode === 'floating' ? 'rounded-t-xl' : ''}`}>\n <button\n ref={agentAnchorRef}\n type=\"button\"\n onClick={onAgentMenuToggle}\n className=\"flex items-center gap-1.5 text-sm font-semibold text-gray-900 dark:text-white px-2 py-1 rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 transition-colors\"\n >\n <span className=\"flex items-center text-[var(--chat-accent)] [&>svg]:w-[18px] [&>svg]:h-[18px]\">{logoIcon}</span>\n <span className=\"flex flex-col items-start leading-tight\">\n <span>{agentName}</span>\n {transferredFrom && (\n <span className=\"text-[0.6rem] font-normal text-gray-400 dark:text-white/30\">\n {t('Transferred from')} {transferredFrom}\n </span>\n )}\n </span>\n <ChevronDownIcon size={16} className=\"text-gray-400 dark:text-white/30\" />\n </button>\n\n <Dropdown open={agentMenuOpen} onClose={onAgentMenuClose} anchorRef={agentAnchorRef} width={280}>\n <span className=\"block px-4 pt-3 pb-1 text-[0.68rem] tracking-[1px] uppercase text-gray-400 dark:text-white/40\">\n {t('Switch to another agent')}\n </span>\n {agents.length === 0 && (\n <div className=\"px-4 py-2\">\n <Spinner size={16} />\n </div>\n )}\n <div>\n {agents.map((agent) => (\n <button\n key={agent.id}\n type=\"button\"\n onClick={() => onSwitchAgent(agent)}\n className={`w-full flex items-center gap-2 px-4 py-1.5 text-left hover:bg-gray-100 dark:hover:bg-white/10 transition-colors ${\n agent.id === selectedAgent?.id ? 'bg-[var(--chat-accent)]/10' : ''\n }`}\n >\n <div className=\"w-7 h-7 rounded-full flex items-center justify-center shrink-0 bg-gradient-to-br from-[var(--chat-accent)]/20 to-[var(--chat-accent)]/5\">\n <span className=\"text-[var(--chat-accent)] [&>svg]:w-4 [&>svg]:h-4\">{logoIcon}</span>\n </div>\n <div className=\"min-w-0\">\n <div className=\"text-[0.8125rem] font-medium text-gray-900 dark:text-white truncate\">{agent.name}</div>\n {agent.description && <div className=\"text-[0.7rem] text-gray-500 dark:text-white/40 truncate\">{agent.description}</div>}\n </div>\n </button>\n ))}\n </div>\n <div className=\"h-px bg-gray-200 dark:bg-white/10 mx-2\" />\n <div>\n {agentDashboardUrl && (\n <button\n type=\"button\"\n onClick={() => {\n onAgentMenuClose();\n window.open(`${agentDashboardUrl}/agents`, '_blank');\n }}\n className=\"w-full flex items-center gap-2 px-4 py-1.5 text-left hover:bg-gray-100 dark:hover:bg-white/10 transition-colors\"\n >\n <ExternalLinkIcon size={18} className=\"text-gray-400 dark:text-white/40 shrink-0\" />\n <span className=\"text-[0.8125rem] text-gray-700 dark:text-white/70\">{t('Browse agents')}</span>\n </button>\n )}\n {agentDashboardUrl && (\n <button\n type=\"button\"\n onClick={() => {\n onAgentMenuClose();\n window.open(`${agentDashboardUrl}/agents/new`, '_blank');\n }}\n className=\"w-full flex items-center gap-2 px-4 py-1.5 text-left hover:bg-gray-100 dark:hover:bg-white/10 transition-colors\"\n >\n <UserPlusIcon size={18} className=\"text-gray-400 dark:text-white/40 shrink-0\" />\n <span className=\"text-[0.8125rem] text-gray-700 dark:text-white/70\">{t('Create agent')}</span>\n </button>\n )}\n </div>\n </Dropdown>\n\n <div className=\"flex-1\" />\n\n <Tooltip title={t('New chat')}>\n <button\n type=\"button\"\n onClick={onNewChat}\n className=\"w-8 h-8 flex items-center justify-center rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-white/40 hover:text-gray-700 dark:hover:text-white/70 transition-colors\"\n >\n <EditIcon size={18} />\n </button>\n </Tooltip>\n\n <Tooltip title={t('Switch view')}>\n <button\n ref={modeAnchorRef}\n type=\"button\"\n onClick={onModeMenuToggle}\n className=\"w-8 h-8 flex items-center justify-center rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-white/40 hover:text-gray-700 dark:hover:text-white/70 transition-colors\"\n >\n <CurrentModeIcon size={18} />\n </button>\n </Tooltip>\n\n <Dropdown open={modeMenuOpen} onClose={onModeMenuClose} anchorRef={modeAnchorRef} placement=\"bottom-end\" width={180}>\n <span className=\"block px-4 pt-3 pb-1 text-[0.68rem] tracking-[1px] uppercase text-gray-400 dark:text-white/40\">{t('Switch to')}</span>\n <div className=\"pb-1\">\n {modeOptions.map((opt) => (\n <button\n key={opt.mode}\n type=\"button\"\n onClick={() => {\n onModeChange(opt.mode);\n onModeMenuClose();\n }}\n className={`w-full flex items-center gap-3 px-4 py-1 text-left hover:bg-gray-100 dark:hover:bg-white/10 transition-colors ${\n mode === opt.mode ? 'bg-[var(--chat-accent)]/10' : ''\n }`}\n >\n {opt.getIcon({ size: 18, className: 'text-gray-400 dark:text-white/40' })}\n <span className=\"text-[0.8125rem] text-gray-700 dark:text-white/70\">{t(opt.label)}</span>\n </button>\n ))}\n </div>\n </Dropdown>\n\n <Tooltip title={t('Close')}>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"w-8 h-8 flex items-center justify-center rounded-lg hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-white/40 hover:text-gray-700 dark:hover:text-white/70 transition-colors\"\n >\n <CloseIcon size={18} />\n </button>\n </Tooltip>\n </div>\n );\n};\n","import { useRef, type KeyboardEvent } from 'react';\nimport type { ChatFile, ChatMode } from '../types';\nimport { AttachFileIcon, FileIcon, SendIcon, StopCircleIcon } from './icons';\nimport { Tooltip } from './Tooltip';\n\ninterface ChatInputProps {\n inputValue: string;\n onInputChange: (value: string) => void;\n onSend: () => void;\n onStop: () => void;\n isLoading: boolean;\n attachedFiles: ChatFile[];\n onFileAdd: (files: FileList | null) => void;\n onFileRemove: (index: number) => void;\n onPaste: (e: React.ClipboardEvent) => void;\n t: (key: string) => string;\n mode?: ChatMode;\n}\n\nexport const ChatInput = ({\n inputValue,\n onInputChange,\n onSend,\n onStop,\n isLoading,\n attachedFiles,\n onFileAdd,\n onFileRemove,\n onPaste,\n t,\n mode,\n}: ChatInputProps) => {\n const fileInputRef = useRef<HTMLInputElement>(null);\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n onSend();\n }\n };\n\n const handleInput = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n onInputChange(e.target.value);\n const el = e.target;\n el.style.height = 'auto';\n el.style.height = `${Math.min(el.scrollHeight, 120)}px`;\n };\n\n const hasContent = inputValue.trim() || attachedFiles.length > 0;\n\n return (\n <div className={`px-4 py-3 border-t border-gray-200 dark:border-white/10 ${mode === 'floating' ? 'rounded-b-xl' : ''}`}>\n {attachedFiles.length > 0 && (\n <div className=\"flex gap-1.5 flex-wrap mb-2\">\n {attachedFiles.map((f, i) => (\n <span\n key={i}\n className=\"inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-gray-200 dark:border-white/10 text-[0.7rem] text-gray-600 dark:text-white/60\"\n >\n <FileIcon size={14} />\n {f.name}\n <button\n type=\"button\"\n onClick={() => onFileRemove(i)}\n className=\"ml-0.5 text-gray-400 dark:text-white/30 hover:text-gray-600 dark:hover:text-white/60\"\n >\n ×\n </button>\n </span>\n ))}\n </div>\n )}\n\n <div className=\"flex items-center border border-gray-200 dark:border-white/10 rounded-xl px-2 py-1 transition-colors focus-within:border-[var(--chat-accent)]\">\n <input\n ref={fileInputRef}\n type=\"file\"\n multiple\n hidden\n onChange={(e) => {\n onFileAdd(e.target.files);\n e.target.value = '';\n }}\n />\n <button\n type=\"button\"\n onClick={() => fileInputRef.current?.click()}\n className=\"w-8 h-8 flex items-center justify-center shrink-0 rounded-lg text-gray-400 dark:text-white/30 hover:bg-gray-100 dark:hover:bg-white/10 mr-0.5 transition-colors\"\n >\n <AttachFileIcon size={18} />\n </button>\n <textarea\n ref={textareaRef}\n placeholder={t('Ask a question...')}\n value={inputValue}\n onChange={handleInput}\n onKeyDown={handleKeyDown}\n onPaste={onPaste}\n rows={1}\n className=\"flex-1 bg-transparent border-none outline-hidden resize-none text-[0.8125rem] py-1.5 text-gray-900 dark:text-white placeholder:text-gray-400 dark:placeholder:text-white/30 filigran-chat-scrollable\"\n style={{ maxHeight: 120 }}\n />\n <Tooltip title={isLoading ? t('Stop generating') : ''}>\n <button\n type=\"button\"\n onClick={isLoading ? onStop : onSend}\n disabled={!isLoading && !hasContent}\n className={`p-1.5 rounded-lg w-8 h-8 flex items-center justify-center transition-all duration-150 ${\n isLoading\n ? 'text-red-500 bg-red-500/10 hover:bg-red-500/20'\n : hasContent\n ? 'text-[var(--chat-accent)] bg-[var(--chat-accent)]/10 hover:bg-[var(--chat-accent)]/20'\n : 'text-gray-300 dark:text-white/20 cursor-not-allowed'\n }`}\n >\n {isLoading ? <StopCircleIcon size={18} /> : <SendIcon size={18} />}\n </button>\n </Tooltip>\n </div>\n\n <p className=\"text-center text-[0.65rem] text-gray-400 dark:text-white/30 mt-1.5 opacity-70\">{t('Uses AI. Verify results.')}</p>\n </div>\n );\n};\n","import { useEffect, useRef } from 'react';\nimport type { AgentStatusState, IconProps } from '../types';\nimport { BrainIcon, DatabaseIcon, ExternalLinkIcon, GlobeIcon, MailIcon, SearchIcon, SparklesIcon, TerminalIcon, UserPlusIcon, WrenchIcon } from './icons';\n\ninterface ChatThinkingProps {\n agentStatus: AgentStatusState | null;\n logoIcon?: React.ReactNode;\n t: (key: string) => string;\n}\n\ntype IconComponent = (props: IconProps) => React.JSX.Element;\n\ninterface StatusVisual {\n label: string;\n StatusIcon: IconComponent;\n showDots: boolean;\n}\n\nfunction resolveStatusVisual(agentStatus: AgentStatusState | null, t: (key: string) => string): StatusVisual {\n if (!agentStatus) {\n return { label: t('Thinking...'), StatusIcon: BrainIcon, showDots: false };\n }\n switch (agentStatus.status) {\n case 'tool_start': {\n const rawNames = agentStatus.tools ?? [];\n const lower = rawNames.map((n) => n.toLowerCase());\n\n // Delegation tools have dedicated statuses\n if (lower.some((n) => n === 'spawn_background_task')) {\n const count = rawNames.filter((n) => n === 'spawn_background_task').length;\n const label = count > 1\n ? `${t('Delegating')} ${count} ${t('tasks')}…`\n : `${t('Delegating task')}…`;\n return { label, StatusIcon: UserPlusIcon, showDots: false };\n }\n if (lower.some((n) => n === 'check_task_status')) {\n const count = rawNames.filter((n) => n === 'check_task_status').length;\n const target = count > 1 ? `${count} ${t('background tasks')}` : t('background task');\n return { label: `${t('Waiting for')} ${target}…`, StatusIcon: SparklesIcon, showDots: false };\n }\n if (lower.some((n) => n === 'get_task_result')) {\n const count = rawNames.filter((n) => n === 'get_task_result').length;\n const from = count > 1 ? `${count} ${t('tasks')}` : t('task');\n return { label: `${t('Collecting results from')} ${from}…`, StatusIcon: SparklesIcon, showDots: false };\n }\n\n let StatusIcon: IconComponent = WrenchIcon;\n if (lower.some((n) => n.includes('search') || n.includes('list'))) {\n StatusIcon = SearchIcon;\n } else if (lower.some((n) => n.includes('read') || n.includes('get') || n.includes('query'))) {\n StatusIcon = DatabaseIcon;\n } else if (lower.some((n) => n.includes('send') || n.includes('create') || n.includes('draft') || n.includes('reply') || n.includes('flag'))) {\n StatusIcon = MailIcon;\n } else if (lower.some((n) => n.includes('code') || n.includes('execute'))) {\n StatusIcon = TerminalIcon;\n } else if (lower.some((n) => n.includes('web') || n.includes('browse'))) {\n StatusIcon = GlobeIcon;\n }\n let label: string;\n if (rawNames.length > 0) {\n const display = rawNames.map((n) => n.replace(/_/g, ' ').replace(/\\b\\w/g, (c) => c.toUpperCase()));\n const unique = Array.from(new Set(display));\n label = unique.length === 1 ? `${unique[0]}…` : `${unique[0]} (+${unique.length - 1} more)…`;\n } else {\n label = t('Using tools…');\n }\n return { label, StatusIcon, showDots: false };\n }\n case 'analyzing':\n return { label: t('Analyzing results…'), StatusIcon: SparklesIcon, showDots: false };\n case 'composing':\n return { label: t('Composing answer…'), StatusIcon: BrainIcon, showDots: true };\n case 'consulting': {\n const consultName = agentStatus.tools?.[0] ?? 'agent';\n return { label: `${t('Consulting')} ${consultName}…`, StatusIcon: UserPlusIcon, showDots: false };\n }\n case 'delegating': {\n const count = agentStatus.tools?.filter((n) => n === 'spawn_background_task').length ?? 0;\n return { label: count > 1 ? `${t('Delegating')} ${count} ${t('tasks')}…` : `${t('Delegating task')}…`, StatusIcon: UserPlusIcon, showDots: false };\n }\n case 'polling': {\n const checkCount = agentStatus.tools?.filter((n) => n === 'check_task_status').length ?? 0;\n const target = checkCount > 1 ? `${checkCount} ${t('background tasks')}` : t('background task');\n return { label: `${t('Waiting for')} ${target}…`, StatusIcon: SparklesIcon, showDots: false };\n }\n case 'collecting': {\n const fetchCount = agentStatus.tools?.filter((n) => n === 'get_task_result').length ?? 0;\n const from = fetchCount > 1 ? `${fetchCount} ${t('tasks')}` : t('task');\n return { label: `${t('Collecting results from')} ${from}…`, StatusIcon: SparklesIcon, showDots: false };\n }\n case 'transferring': {\n const targetName = agentStatus.tools?.[0] ?? 'agent';\n return { label: `${t('Transferring to')} ${targetName}…`, StatusIcon: ExternalLinkIcon, showDots: false };\n }\n case 'thinking':\n default:\n return { label: t('Thinking...'), StatusIcon: BrainIcon, showDots: false };\n }\n}\n\nfunction stripMarkdown(text: string): string {\n return text\n .replace(/```[\\s\\S]*?```/g, ' ')\n .replace(/`([^`]+)`/g, '$1')\n .replace(/\\*\\*(.+?)\\*\\*/g, '$1')\n .replace(/__(.+?)__/g, '$1')\n .replace(/\\*(.+?)\\*/g, '$1')\n .replace(/_(.+?)_/g, '$1')\n .replace(/#{1,6}\\s+/g, '')\n .replace(/[*\\->]+/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim();\n}\n\nexport function ThinkingTextBubble({ content }: { content: string }) {\n const ref = useRef<HTMLDivElement>(null);\n const cleaned = stripMarkdown(content);\n\n useEffect(() => {\n if (ref.current) ref.current.scrollTop = ref.current.scrollHeight;\n }, [cleaned]);\n\n if (cleaned.length < 3) return null;\n\n return (\n <div\n ref={ref}\n className=\"ml-11 max-w-[70%] max-h-20 overflow-hidden relative rounded-md border-l-2 bg-[var(--chat-accent)]/[0.03] pl-3 pr-3 py-2\"\n style={{ animation: 'reasoningGlow 3s ease-in-out infinite, chat-fade-in 0.5s ease-out' }}\n >\n <p className=\"text-[13px] leading-[1.35rem] text-gray-400 dark:text-white/40 break-words m-0\">\n {cleaned}\n </p>\n <div className=\"absolute inset-x-0 bottom-0 h-5 bg-gradient-to-t from-white/90 dark:from-[#1e1e2e]/90 to-transparent pointer-events-none\" />\n </div>\n );\n}\n\nexport const ChatThinking = ({ agentStatus, logoIcon, t }: ChatThinkingProps) => {\n const { label, StatusIcon, showDots } = resolveStatusVisual(agentStatus, t);\n const thinkingContent = agentStatus?.thinkingContent;\n\n return (\n <>\n <div className=\"flex gap-3 items-center justify-start\">\n <div className=\"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-[var(--chat-accent)]/15 to-[var(--chat-accent)]/5\">\n <span className=\"text-[var(--chat-accent)] [&>svg]:w-4 [&>svg]:h-4\">{logoIcon}</span>\n </div>\n <div className=\"rounded-lg bg-gray-50 dark:bg-white/[0.03] px-4 py-3 relative overflow-hidden\">\n <div className=\"absolute inset-0 bg-gradient-to-r from-[var(--chat-accent)]/[0.03] via-transparent to-[var(--chat-accent)]/[0.03] animate-pulse pointer-events-none\" />\n <div className=\"relative flex items-center gap-2.5\">\n {showDots ? (\n <div className=\"flex gap-[3px] items-center h-3.5 w-3.5 justify-center\">\n {[0, 0.15, 0.3].map((delay, i) => (\n <span\n key={i}\n className=\"h-[5px] w-[5px] rounded-full bg-[var(--chat-accent)]/50\"\n style={{ animation: `chat-dot 1s ease-in-out infinite ${delay}s` }}\n />\n ))}\n </div>\n ) : (\n <StatusIcon size={14} className=\"text-[var(--chat-accent)] animate-pulse transition-all duration-300\" />\n )}\n <span className=\"text-sm text-gray-500 dark:text-white/50 transition-all duration-300\">{label}</span>\n </div>\n </div>\n </div>\n {thinkingContent && <ThinkingTextBubble content={thinkingContent} />}\n </>\n );\n};\n","import { useState } from 'react';\nimport Markdown from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport { CheckIcon, CopyIcon } from './icons';\n\ninterface MarkdownMessageProps {\n content: string;\n}\n\nexport const MarkdownMessage = ({ content }: MarkdownMessageProps) => {\n const [copiedBlock, setCopiedBlock] = useState<string | null>(null);\n\n const handleCopyCode = (code: string) => {\n navigator.clipboard.writeText(code);\n setCopiedBlock(code);\n setTimeout(() => setCopiedBlock(null), 2000);\n };\n\n return (\n <Markdown\n remarkPlugins={[remarkGfm]}\n components={{\n p: ({ children }) => <p className=\"mb-3 last:mb-0 leading-7 break-words text-[0.8125rem] text-gray-900 dark:text-white/90\">{children}</p>,\n code: ({ className, children }) => {\n const match = /language-(\\w+)/.exec(className || '');\n const codeStr = String(children).replace(/\\n$/, '');\n if (match) {\n return (\n <div className=\"my-3 rounded-lg border border-gray-200 dark:border-white/10 overflow-hidden bg-gray-50 dark:bg-white/[0.03]\">\n <div className=\"flex items-center justify-between px-3 py-1.5 border-b border-gray-200 dark:border-white/10 bg-gray-100 dark:bg-white/[0.03]\">\n <span className=\"text-[0.7rem] text-gray-500 dark:text-white/40 font-mono\">{match[1]}</span>\n <button\n type=\"button\"\n onClick={() => handleCopyCode(codeStr)}\n className=\"p-0.5 rounded-sm hover:bg-gray-200 dark:hover:bg-white/10 transition-colors\"\n >\n {copiedBlock === codeStr ? (\n <CheckIcon size={14} className=\"text-green-500\" />\n ) : (\n <CopyIcon size={14} className=\"text-gray-400 dark:text-white/40\" />\n )}\n </button>\n </div>\n <pre className=\"m-0 px-3 py-2 overflow-x-auto\">\n <code className=\"font-mono text-xs leading-[1.7] text-gray-800 dark:text-white/90 whitespace-pre\">{codeStr}</code>\n </pre>\n </div>\n );\n }\n return (\n <code className=\"bg-gray-100 dark:bg-white/[0.08] px-1.5 py-0.5 rounded-sm font-mono text-xs text-[var(--chat-accent)]\">{children}</code>\n );\n },\n ul: ({ children }) => (\n <ul className=\"pl-5 mb-3 text-[0.8125rem] text-gray-900 dark:text-white/90 [&_li]:mb-1 marker:text-[var(--chat-accent)]/50\">{children}</ul>\n ),\n ol: ({ children }) => (\n <ol className=\"pl-5 mb-3 text-[0.8125rem] text-gray-900 dark:text-white/90 [&_li]:mb-1 marker:text-[var(--chat-accent)]/50\">{children}</ol>\n ),\n blockquote: ({ children }) => (\n <blockquote className=\"my-3 border-l-2 border-[var(--chat-accent)]/30 bg-[var(--chat-accent)]/[0.03] pl-4 pr-3 py-2 rounded-r-md italic text-gray-500 dark:text-white/60\">\n {children}\n </blockquote>\n ),\n a: ({ href, children }) => (\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"text-[var(--chat-accent)] underline underline-offset-2 hover:brightness-125\"\n >\n {children}\n </a>\n ),\n h1: ({ children }) => <h1 className=\"mt-4 first:mt-0 mb-2 font-bold text-base text-gray-900 dark:text-white\">{children}</h1>,\n h2: ({ children }) => <h2 className=\"mt-3 first:mt-0 mb-2 font-bold text-[0.9rem] text-gray-900 dark:text-white\">{children}</h2>,\n h3: ({ children }) => <h3 className=\"mt-3 first:mt-0 mb-1.5 font-semibold text-[0.85rem] text-gray-900 dark:text-white\">{children}</h3>,\n table: ({ children }) => (\n <div className=\"my-3 overflow-x-auto rounded-lg border border-gray-200 dark:border-white/10\">\n <table className=\"w-full border-collapse text-xs\">{children}</table>\n </div>\n ),\n th: ({ children }) => (\n <th className=\"px-3 py-2 text-left font-semibold bg-gray-50 dark:bg-white/[0.04] border-b border-gray-200 dark:border-white/10 text-gray-900 dark:text-white\">\n {children}\n </th>\n ),\n td: ({ children }) => (\n <td className=\"px-3 py-2 border-b border-gray-200 dark:border-white/10 text-gray-700 dark:text-white/80\">{children}</td>\n ),\n }}\n >\n {content}\n </Markdown>\n );\n};\n","import { useEffect, useRef, useState } from 'react';\nimport type { AgentStatusState, ChatMessage } from '../types';\nimport { FileIcon, InfoIcon } from './icons';\nimport { ChatThinking, ThinkingTextBubble } from './ChatThinking';\nimport { MarkdownMessage } from './MarkdownMessage';\n\ninterface ChatMessagesProps {\n messages: ChatMessage[];\n isLoading: boolean;\n agentStatus: AgentStatusState | null;\n agentName: string;\n logoIcon: React.ReactNode;\n t: (key: string) => string;\n}\n\nexport const ChatMessages = ({ messages, isLoading, agentStatus, agentName, logoIcon, t }: ChatMessagesProps) => {\n const messagesEndRef = useRef<HTMLDivElement>(null);\n const [toolDetailMsgId, setToolDetailMsgId] = useState<string | null>(null);\n\n useEffect(() => {\n messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });\n }, [messages]);\n\n return (\n <div className=\"flex-1 overflow-y-auto px-4 py-3 flex flex-col gap-4 filigran-chat-scrollable\">\n {messages.map((msg) => {\n const isAssistant = msg.role === 'assistant';\n const isEmpty = !msg.content;\n const isThinking = isAssistant && isEmpty && isLoading;\n\n if (isThinking) {\n return (\n <div key={msg.id}>\n <ChatThinking agentStatus={agentStatus} logoIcon={logoIcon} t={t} />\n </div>\n );\n }\n\n return (\n <div key={msg.id} className={`flex flex-col ${isAssistant ? 'items-start' : 'items-end'}`}>\n {isAssistant && (\n <div className=\"flex items-center gap-1.5 mb-1\">\n <div className=\"w-6 h-6 rounded-lg flex items-center justify-center bg-gradient-to-br from-[var(--chat-accent)]/20 to-[var(--chat-accent)]/5\">\n <span className=\"text-[var(--chat-accent)] [&>svg]:w-3 [&>svg]:h-3\">{logoIcon}</span>\n </div>\n <span className=\"font-semibold text-xs text-gray-900 dark:text-white\">{agentName}</span>\n </div>\n )}\n\n {isAssistant && !isEmpty && isLoading && agentStatus?.thinkingContent && <ThinkingTextBubble content={agentStatus.thinkingContent} />}\n\n {msg.files && msg.files.length > 0 && (\n <div className=\"flex gap-1.5 flex-wrap mb-1.5\">\n {msg.files.map((f, i) => (\n <span\n key={i}\n className=\"inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-gray-200 dark:border-white/10 text-[0.7rem] text-gray-600 dark:text-white/60\"\n >\n <FileIcon size={14} />\n {f.name}\n </span>\n ))}\n </div>\n )}\n\n <div\n className={`max-w-[90%] ${\n isAssistant\n ? 'pl-1 py-1 text-[0.8125rem] leading-7'\n : 'px-3.5 py-2 rounded-[14px_14px_4px_14px] bg-[var(--chat-accent-dark)] text-white text-[0.8125rem] leading-6'\n }`}\n >\n {isAssistant ? <MarkdownMessage content={msg.content} /> : msg.content}\n {isAssistant && isEmpty && !isLoading && <span className=\"text-[0.8125rem] text-gray-400 dark:text-white/40 italic\">...</span>}\n {isAssistant && !isEmpty && isLoading && (\n <span className=\"inline-block w-1.5 h-4 bg-[var(--chat-accent)]/70 rounded-xs ml-0.5 animate-pulse align-text-bottom\" />\n )}\n </div>\n\n {isAssistant && !isEmpty && !isLoading && msg.toolNames && msg.toolNames.length > 0 && (\n <>\n <button\n type=\"button\"\n onClick={() => setToolDetailMsgId(toolDetailMsgId === msg.id ? null : msg.id)}\n className=\"mt-0.5 p-1 rounded-lg opacity-50 hover:opacity-100 hover:text-[var(--chat-accent)] transition-opacity\"\n title={t('Reasoning details')}\n >\n <InfoIcon size={14} />\n </button>\n {toolDetailMsgId === msg.id && (\n <div className=\"mt-1.5 p-3 rounded-lg bg-gray-50 dark:bg-white/[0.04] border border-gray-200 dark:border-white/10\">\n <p className=\"text-[0.7rem] text-gray-500 dark:text-white/40 mb-1.5\">\n {msg.iterations && msg.iterations > 1 ? `${msg.iterations} iterations · ` : ''}\n {msg.toolCallCount ?? msg.toolNames.length}{' '}\n {(msg.toolCallCount ?? msg.toolNames.length) === 1 ? t('tool call') : t('tool calls')}\n </p>\n <div className=\"flex flex-wrap gap-1\">\n {Array.from(new Set(msg.toolNames)).map((tn) => (\n <span\n key={tn}\n className=\"inline-flex items-center px-2 py-0.5 rounded-full border border-gray-200 dark:border-white/10 text-[0.68rem] font-mono text-gray-500 dark:text-white/40\"\n >\n {tn.replace(/_/g, ' ')}\n </span>\n ))}\n </div>\n </div>\n )}\n </>\n )}\n </div>\n );\n })}\n <div ref={messagesEndRef} />\n </div>\n );\n};\n","interface ChatWelcomeProps {\n firstName: string;\n logoIcon: React.ReactNode;\n promptSuggestions: string[];\n onPromptClick: (prompt: string) => void;\n t: (key: string) => string;\n}\n\nexport const ChatWelcome = ({ firstName, logoIcon, promptSuggestions, onPromptClick, t }: ChatWelcomeProps) => (\n <div className=\"flex-1 flex flex-col items-center justify-center px-6 pb-8\">\n <span className=\"text-[var(--chat-accent)] mb-4 [&>svg]:w-12 [&>svg]:h-12 drop-shadow-[0_0_12px_var(--chat-accent-40)]\">{logoIcon}</span>\n <h2 className=\"text-xl font-medium mb-6 text-center text-gray-900 dark:text-white\" style={{ fontFamily: '\"Geologica\", sans-serif' }}>\n {t('How can I help you, ')}\n {firstName}?\n </h2>\n <div className=\"w-full max-w-[320px]\">\n <span className=\"block text-center mb-2 text-[0.65rem] tracking-[1.5px] uppercase text-[var(--chat-accent)] font-semibold\">\n {t('Suggestions')}\n </span>\n {promptSuggestions.map((prompt) => (\n <button\n key={prompt}\n type=\"button\"\n onClick={() => onPromptClick(prompt)}\n className=\"w-full text-left text-[0.8125rem] text-gray-800 dark:text-white py-1.5 px-3 mb-1 rounded-lg border border-gray-200 dark:border-white/10 bg-transparent transition-colors hover:bg-[var(--chat-accent-10)] hover:border-[var(--chat-accent-50)]\"\n >\n {t(prompt)}\n </button>\n ))}\n </div>\n </div>\n);\n","import { type FunctionComponent, useEffect, useState } from 'react';\nimport type { ChatMessage, ChatPanelProps } from '../types';\nimport { hexAlpha, identity } from '../utils';\nimport { useChat } from '../hooks/useChat';\nimport { useAgents } from '../hooks/useAgents';\nimport { useSidebarResize } from '../hooks/useSidebarResize';\nimport { DefaultLogoIcon } from './icons';\nimport { ChatHeader } from './ChatHeader';\nimport { ChatInput } from './ChatInput';\nimport { ChatMessages } from './ChatMessages';\nimport { ChatWelcome } from './ChatWelcome';\n\nconst FLOATING_WIDTH = 380;\nconst FLOATING_HEIGHT = 560;\nconst SIDEBAR_GAP = 6;\n\nconst DEFAULT_SUGGESTIONS = [\n 'Help me create a new simulation scenario',\n 'What are the latest attack patterns?',\n 'How do I configure detection rules?',\n 'Summarize my recent findings',\n];\n\nexport const ChatPanel: FunctionComponent<ChatPanelProps> = ({\n mode,\n onClose,\n onModeChange,\n topOffset = 0,\n apiBaseUrl,\n apiEndpoints,\n agentDashboardUrl,\n user,\n t = identity,\n accentColor = '#7b5cff',\n logoIcon,\n promptSuggestions = DEFAULT_SUGGESTIONS,\n resizable = false,\n onWidthChange,\n onResizeStart,\n onResizeEnd,\n pushContentSelector,\n backendType = 'rest',\n}) => {\n const [modeMenuOpen, setModeMenuOpen] = useState(false);\n\n const { agents, selectedAgent, agentMenuOpen, setAgentMenuOpen, handleSwitchAgent } = useAgents({ apiBaseUrl, apiEndpoints, backendType });\n\n const {\n messages,\n inputValue,\n setInputValue,\n isLoading,\n agentStatus,\n attachedFiles,\n conversationId,\n transferredAgent,\n historyLoadedRef,\n handleFileAdd,\n handlePaste,\n handleSendMessage,\n handleNewChat,\n handleStopGenerating,\n setAttachedFiles,\n setMessages,\n setConversationId,\n } = useChat({ apiBaseUrl, apiEndpoints, backendType, agentSlug: selectedAgent?.slug, t });\n\n const { sidebarWidth, handleResizeStart, defaultWidth, isResizing } = useSidebarResize({\n mode,\n resizable,\n onWidthChange,\n onResizeStart,\n onResizeEnd,\n });\n\n // Push content when sidebar mode is active using CSS variable\n useEffect(() => {\n const width = mode === 'sidebar' ? (resizable ? sidebarWidth : defaultWidth) : 0;\n const pushWidth = width > 0 ? width + SIDEBAR_GAP : 0;\n\n // Set CSS variable on :root for any component to use\n document.documentElement.style.setProperty('--chatbot-sidebar-width', `${pushWidth}px`);\n document.documentElement.style.setProperty('--chatbot-transition', isResizing ? 'none' : 'all 225ms cubic-bezier(0.4, 0, 0.2, 1)');\n\n // Also apply to pushContentSelector if provided (for simple cases)\n if (pushContentSelector) {\n const contentElement = document.querySelector<HTMLElement>(pushContentSelector);\n if (contentElement) {\n const originalPaddingRight = contentElement.style.paddingRight;\n const originalTransition = contentElement.style.transition;\n\n contentElement.style.paddingRight = pushWidth > 0 ? `${pushWidth}px` : '';\n contentElement.style.transition = isResizing ? 'none' : 'padding-right 225ms cubic-bezier(0.4, 0, 0.2, 1)';\n\n return () => {\n contentElement.style.paddingRight = originalPaddingRight;\n contentElement.style.transition = originalTransition;\n document.documentElement.style.setProperty('--chatbot-sidebar-width', '0px');\n };\n }\n }\n\n return () => {\n document.documentElement.style.setProperty('--chatbot-sidebar-width', '0px');\n };\n }, [pushContentSelector, mode, sidebarWidth, defaultWidth, resizable, isResizing]);\n\n const resolvedLogo = logoIcon ?? <DefaultLogoIcon size={24} />;\n const firstName = user.firstName;\n const agentName = transferredAgent?.name || selectedAgent?.name || 'Assistant';\n\n const cssVars = {\n '--chat-accent': accentColor,\n '--chat-accent-10': hexAlpha(accentColor, 0.1),\n '--chat-accent-40': hexAlpha(accentColor, 0.25),\n '--chat-accent-50': hexAlpha(accentColor, 0.5),\n '--chat-accent-dark': accentColor,\n } as React.CSSProperties;\n\n // Load conversation history when agent is selected\n useEffect(() => {\n // Skip session history if disabled, using single endpoint mode, or non-REST backend\n if (apiEndpoints?.sessions === null || apiEndpoints?.singleEndpoint || backendType === 'legacy' || backendType === 'ag-ui') return;\n if (!conversationId || historyLoadedRef.current || !selectedAgent) return;\n historyLoadedRef.current = true;\n const sessionsUrl = `${apiBaseUrl}${apiEndpoints?.sessions ?? '/chat/sessions'}`;\n\n const clearStaleConversation = () => {\n setConversationId(null);\n localStorage.removeItem('filigranChatConversationId');\n };\n\n fetch(sessionsUrl, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n conversation_id: conversationId,\n agent_slug: selectedAgent.slug,\n }),\n })\n .then((res) => {\n if (!res.ok) {\n clearStaleConversation();\n return null;\n }\n return res.json();\n })\n .then((data) => {\n if (!data?.messages?.length) return;\n const restored: ChatMessage[] = data.messages.map((m: { role: string; content: string }, i: number) => ({\n id: `restored-${i}`,\n role: m.role as 'user' | 'assistant',\n content: m.content,\n timestamp: new Date(),\n }));\n setMessages(restored);\n })\n .catch(() => {\n clearStaleConversation();\n });\n }, [conversationId, selectedAgent, apiBaseUrl, apiEndpoints, historyLoadedRef, setMessages, setConversationId]);\n\n const onSwitchAgent = (agent: typeof selectedAgent) => {\n if (!agent) return;\n handleSwitchAgent(agent, () => {\n handleNewChat();\n });\n };\n\n const containerClasses = (() => {\n const base = 'filigran-chatbot';\n switch (mode) {\n case 'sidebar':\n return `${base} fixed right-0 bottom-0 flex flex-col bg-white dark:bg-[#1e1e2e] border-l border-gray-200 dark:border-white/10 z-[1200]`;\n case 'floating':\n return `${base} fixed bottom-5 right-5 flex flex-col bg-white dark:bg-[#1e1e2e] rounded-xl shadow-[0_8px_32px_rgba(0,0,0,0.15)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.4)] z-[1300] border border-gray-200 dark:border-white/10`;\n case 'fullscreen':\n return `${base} fixed right-0 bottom-0 left-0 flex flex-col bg-gray-50 dark:bg-[#161622] z-[1400]`;\n default:\n return base;\n }\n })();\n\n const containerStyle: React.CSSProperties = {\n ...cssVars,\n ...(mode === 'sidebar'\n ? { top: topOffset, width: resizable ? sidebarWidth : defaultWidth }\n : mode === 'floating'\n ? { width: FLOATING_WIDTH, height: FLOATING_HEIGHT }\n : { top: topOffset }),\n };\n\n return (\n <div className={containerClasses} style={containerStyle}>\n {mode === 'sidebar' && resizable && (\n <div onMouseDown={handleResizeStart} className=\"absolute top-0 -left-1 bottom-0 w-2 cursor-col-resize z-10 group\">\n <div className=\"absolute top-0 left-1/2 -translate-x-1/2 bottom-0 w-0.5 rounded-sm bg-[var(--chat-accent)] opacity-0 transition-opacity group-hover:opacity-100 group-active:opacity-100\" />\n </div>\n )}\n <ChatHeader\n mode={mode}\n agentName={agentName}\n agents={agents}\n selectedAgent={selectedAgent}\n transferredFrom={transferredAgent ? selectedAgent?.name : undefined}\n agentMenuOpen={agentMenuOpen}\n onAgentMenuToggle={() => setAgentMenuOpen((p) => !p)}\n onAgentMenuClose={() => setAgentMenuOpen(false)}\n onSwitchAgent={onSwitchAgent}\n modeMenuOpen={modeMenuOpen}\n onModeMenuToggle={() => setModeMenuOpen((p) => !p)}\n onModeMenuClose={() => setModeMenuOpen(false)}\n onModeChange={onModeChange}\n onNewChat={handleNewChat}\n onClose={onClose}\n logoIcon={resolvedLogo}\n agentDashboardUrl={agentDashboardUrl}\n t={t}\n />\n {messages.length === 0 ? (\n <ChatWelcome firstName={firstName} logoIcon={resolvedLogo} promptSuggestions={promptSuggestions} onPromptClick={setInputValue} t={t} />\n ) : (\n <ChatMessages messages={messages} isLoading={isLoading} agentStatus={agentStatus} agentName={agentName} logoIcon={resolvedLogo} t={t} />\n )}\n <ChatInput\n inputValue={inputValue}\n onInputChange={setInputValue}\n onSend={handleSendMessage}\n onStop={handleStopGenerating}\n isLoading={isLoading}\n attachedFiles={attachedFiles}\n onFileAdd={handleFileAdd}\n onFileRemove={(i) => setAttachedFiles((prev) => prev.filter((_, j) => j !== i))}\n onPaste={handlePaste}\n t={t}\n mode={mode}\n />\n </div>\n );\n};\n","import type { FunctionComponent } from 'react';\nimport type { ChatToggleButtonProps } from '../types';\nimport { hexAlpha } from '../utils';\nimport { DefaultLogoIcon } from './icons';\n\nexport const ChatToggleButton: FunctionComponent<ChatToggleButtonProps> = ({ isOpen, onToggle, label = 'Ask Assistant', accentColor = '#7b5cff', icon }) => {\n const resolvedIcon = icon ?? <DefaultLogoIcon size={16} />;\n\n return (\n <button\n type=\"button\"\n onClick={onToggle}\n className=\"filigran-chatbot inline-flex items-center gap-1.5 px-3 py-[3px] text-[0.8125rem] font-medium whitespace-nowrap rounded-md border transition-colors\"\n style={{\n borderColor: isOpen ? accentColor : hexAlpha(accentColor, 0.5),\n color: accentColor,\n backgroundColor: isOpen ? hexAlpha(accentColor, 0.1) : 'transparent',\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.borderColor = accentColor;\n e.currentTarget.style.backgroundColor = hexAlpha(accentColor, 0.1);\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.borderColor = isOpen ? accentColor : hexAlpha(accentColor, 0.5);\n e.currentTarget.style.backgroundColor = isOpen ? hexAlpha(accentColor, 0.1) : 'transparent';\n }}\n >\n <span className=\"[&>svg]:w-4 [&>svg]:h-4\">{resolvedIcon}</span>\n {label}\n </button>\n );\n};\n"],"names":["hexAlpha","hex","alpha","Math","round","toString","padStart","identity","key","parseLegacyEvent","evt","ctx","eventType","event","data","nodeId","status","activeNodeId","action","content","replace","reasoning","usedTools","length","hasUsedTools","tools","map","t","tool","Array","isArray","chatId","parseRestEvent","type","st","thinkingContent","conversationId","conversation_id","toolNames","tool_names","toolCallCount","tool_call_count","iterations","transferAgentId","transfer_agent_id","transferAgentName","transfer_agent_name","parseAgUiEvent","message","stepName","delta","toolName","toolCallName","STORAGE_KEY","LEGACY_CHAT_ID_KEY","useChat","apiBaseUrl","apiEndpoints","backendType","agentSlug","isLegacy","messages","setMessages","useState","inputValue","setInputValue","isLoading","setIsLoading","agentStatus","setAgentStatus","setConversationId","window","localStorage","getItem","attachedFiles","setAttachedFiles","transferredAgent","setTransferredAgent","legacyChatId","setLegacyChatId","historyLoadedRef","useRef","abortControllerRef","hasUsedToolsRef","handleFileAdd","fileList","newFiles","from","forEach","file","reader","FileReader","onload","push","name","size","dataUrl","result","prev","readAsDataURL","handlePaste","e","files","clipboardData","preventDefault","handleSendMessage","async","trim","userMsg","id","crypto","randomUUID","role","timestamp","Date","undefined","current","assistantId","controller","AbortController","requestBody","opts","question","streaming","threadId","runId","context","state","forwardedProps","agent_slug","buildRequestBody","res","fetch","singleEndpoint","method","headers","body","JSON","stringify","signal","ok","m","parseEvent","getParser","getReader","decoder","TextDecoder","buffer","accumulated","doneReceived","done","value","read","decode","stream","lines","split","pop","rawLine","line","startsWith","jsonStr","slice","parsed","parse","setItem","err","DOMException","handleNewChat","abort","removeItem","handleStopGenerating","filter","STORAGE_AGENT_KEY","SIDEBAR_WIDTH","SIDEBAR_WIDTH_STORAGE_KEY","AttachFileIcon","className","_jsx","xmlns","width","height","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","children","d","BrainIcon","_jsxs","CheckIcon","ChevronDownIcon","CloseIcon","CopyIcon","x","y","rx","ry","DatabaseIcon","cx","cy","DefaultLogoIcon","EditIcon","ExternalLinkIcon","FileIcon","FloatingIcon","FullscreenExitIcon","FullscreenIcon","GlobeIcon","r","InfoIcon","MailIcon","SearchIcon","SendIcon","SidebarIcon","SparklesIcon","StopCircleIcon","TerminalIcon","points","x1","x2","y1","y2","UserPlusIcon","WrenchIcon","Dropdown","open","onClose","anchorRef","placement","panelRef","pos","setPos","top","left","ref","handler","active","useEffect","listener","contains","target","document","addEventListener","removeEventListener","useClickOutside","useCallback","rect","getBoundingClientRect","right","bottom","portalTarget","el","node","classList","parentElement","findChatbotRoot","createPortal","style","Spinner","Tooltip","title","show","setShow","onMouseEnter","onMouseLeave","modeOptions","mode","label","getIcon","p","ChatHeader","agentName","agents","selectedAgent","transferredFrom","agentMenuOpen","onAgentMenuToggle","onAgentMenuClose","onSwitchAgent","modeMenuOpen","onModeMenuToggle","onModeMenuClose","onModeChange","onNewChat","logoIcon","agentDashboardUrl","agentAnchorRef","modeAnchorRef","CurrentModeIcon","onClick","agent","description","opt","ChatInput","onInputChange","onSend","onStop","onFileAdd","onFileRemove","onPaste","fileInputRef","textareaRef","hasContent","f","i","multiple","hidden","onChange","click","placeholder","min","scrollHeight","onKeyDown","shiftKey","rows","maxHeight","disabled","ThinkingTextBubble","cleaned","scrollTop","animation","ChatThinking","StatusIcon","showDots","rawNames","lower","n","toLowerCase","some","count","includes","display","c","toUpperCase","unique","Set","consultName","checkCount","fetchCount","targetName","resolveStatusVisual","_Fragment","delay","MarkdownMessage","copiedBlock","setCopiedBlock","Markdown","remarkPlugins","remarkGfm","components","code","match","exec","codeStr","String","handleCopyCode","navigator","clipboard","writeText","setTimeout","ul","ol","blockquote","a","href","rel","h1","h2","h3","table","th","td","ChatMessages","messagesEndRef","toolDetailMsgId","setToolDetailMsgId","scrollIntoView","behavior","msg","isAssistant","isEmpty","tn","ChatWelcome","firstName","promptSuggestions","onPromptClick","fontFamily","prompt","DEFAULT_SUGGESTIONS","ChatPanel","topOffset","user","accentColor","resizable","onWidthChange","onResizeStart","onResizeEnd","pushContentSelector","setModeMenuOpen","setAgentMenuOpen","handleSwitchAgent","setAgents","setSelectedAgent","then","json","savedSlug","find","slug","catch","onSwitch","useAgents","sidebarWidth","handleResizeStart","defaultWidth","isResizing","setSidebarWidth","stored","parseInt","Number","isNaN","setIsResizing","isResizingRef","sidebarWidthRef","onWidthChangeRef","onResizeEndRef","handleMouseMove","newWidth","innerWidth","clientX","maxWidth","clamped","max","handleMouseUp","cursor","userSelect","handleWindowResize","useSidebarResize","pushWidth","documentElement","setProperty","contentElement","querySelector","originalPaddingRight","paddingRight","originalTransition","transition","resolvedLogo","cssVars","sessions","clearStaleConversation","restored","containerClasses","base","containerStyle","onMouseDown","_","j","ChatToggleButton","isOpen","onToggle","icon","resolvedIcon","borderColor","color","backgroundColor","currentTarget"],"mappings":"8OAAM,SAAUA,EAASC,EAAaC,GAIpC,MAAO,GAAGD,IAHAE,KAAKC,MAAc,IAARF,GAClBG,SAAS,IACTC,SAAS,EAAG,MAEjB,CAEO,MAAMC,EAAYC,GAAgBA,ECFnC,SAAUC,EAAiBC,EAA8BC,GAC7D,MAAMC,EAAYF,EAAIG,MAEtB,GAAkB,kBAAdD,EAA+B,CACjC,MAAME,EAAOJ,EAAII,KACXC,EAASD,GAAMC,OAIrB,MAHqB,eAAjBD,GAAME,QAA2BD,IACnCJ,EAAIM,aAAeF,GAEd,CAAEG,OAAQ,OACnB,CAEA,GAAkB,UAAdN,EACF,MAAO,CAAEM,OAAQ,QAGnB,GAAkB,UAAdN,EAAuB,CAEzB,MAAO,CAAEM,OAAQ,SAAUC,SADPT,EAAII,MAAmB,IAAIM,QAAQ,cAAe,MAExE,CAEA,GAAkB,mBAAdR,EAAgC,CAClC,MAAMS,EAAYX,EAA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AAS2Y,EAAa,IACjFtS,EAAE+W,cAAchN,MAAM+M,gBAAkBN,EAAS7c,EAAS2Y,EAAa,IAAO,eAC/E/M,SAAA,CAEDV,EAAA,OAAA,CAAMD,UAAU,0BAAyBW,SAAEoR,IAC1ClM"}
|
package/dist/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.inset-x-0{left:0;right:0}.-left-1{left:-4px}.bottom-0{bottom:0}.bottom-5{bottom:20px}.left-0{left:0}.left-1\/2{left:50%}.right-0{right:0}.right-5{right:20px}.top-0{top:0}.z-10{z-index:10}.z-\[10000\]{z-index:10000}.z-\[10001\]{z-index:10001}.z-\[1200\]{z-index:1200}.z-\[1300\]{z-index:1300}.z-\[1400\]{z-index:1400}.m-0{margin:0}.mx-2{margin-left:8px;margin-right:8px}.my-3{margin-bottom:12px;margin-top:12px}.mb-1{margin-bottom:4px}.mb-1\.5{margin-bottom:6px}.mb-2{margin-bottom:8px}.mb-3{margin-bottom:12px}.mb-4{margin-bottom:16px}.mb-6{margin-bottom:24px}.ml-0\.5{margin-left:2px}.ml-11{margin-left:44px}.mr-0\.5{margin-right:2px}.mt-0\.5{margin-top:2px}.mt-1\.5{margin-top:6px}.mt-3{margin-top:12px}.mt-4{margin-top:16px}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.hidden{display:none}.h-3\.5{height:14px}.h-4{height:16px}.h-5{height:20px}.h-6{height:24px}.h-7{height:28px}.h-8{height:32px}.h-\[5px\]{height:5px}.h-px{height:1px}.max-h-20{max-height:80px}.min-h-\[48px\]{min-height:48px}.w-0\.5{width:2px}.w-1\.5{width:6px}.w-2{width:8px}.w-3\.5{width:14px}.w-6{width:24px}.w-7{width:28px}.w-8{width:32px}.w-\[5px\]{width:5px}.w-full{width:100%}.min-w-0{min-width:0}.max-w-\[320px\]{max-width:320px}.max-w-\[70\%\]{max-width:70%}.max-w-\[90\%\]{max-width:90%}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x:-50%}.-translate-x-1\/2,.-translate-y-full{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-full{--tw-translate-y:-100%}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-col-resize{cursor:col-resize}.cursor-not-allowed{cursor:not-allowed}.resize-none{resize:none}.resize{resize:both}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:4px}.gap-1\.5{gap:6px}.gap-2{gap:8px}.gap-2\.5{gap:10px}.gap-3{gap:12px}.gap-4{gap:16px}.gap-\[3px\]{gap:3px}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis}.truncate,.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.break-words{overflow-wrap:break-word}.rounded{border-radius:4px}.rounded-\[10px\]{border-radius:10px}.rounded-\[14px_14px_4px_14px\]{border-radius:14px 14px 4px 14px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:8px}.rounded-md{border-radius:6px}.rounded-sm{border-radius:2px}.rounded-xl{border-radius:12px}.rounded-b-xl{border-bottom-left-radius:12px;border-bottom-right-radius:12px}.rounded-r-md{border-bottom-right-radius:6px;border-top-right-radius:6px}.rounded-t-xl{border-top-left-radius:12px;border-top-right-radius:12px}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-t{border-top-width:1px}.border-none{border-style:none}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.border-t-\[var\(--chat-accent\)\]{border-top-color:var(--chat-accent)}.bg-\[var\(--chat-accent\)\]{background-color:var(--chat-accent)}.bg-\[var\(--chat-accent-dark\)\]{background-color:var(--chat-accent-dark)}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.bg-red-500\/10{background-color:rgba(239,68,68,.1)}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-white\/90{--tw-gradient-from:hsla(0,0%,100%,.9) var(--tw-gradient-from-position);--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.via-transparent{--tw-gradient-to:transparent var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),transparent var(--tw-gradient-via-position),var(--tw-gradient-to)}.to-transparent{--tw-gradient-to:transparent var(--tw-gradient-to-position)}.p-0\.5{padding:2px}.p-1{padding:4px}.p-1\.5{padding:6px}.p-3{padding:12px}.px-1\.5{padding-left:6px;padding-right:6px}.px-2{padding-left:8px;padding-right:8px}.px-3{padding-left:12px;padding-right:12px}.px-3\.5{padding-left:14px;padding-right:14px}.px-4{padding-left:16px;padding-right:16px}.px-6{padding-left:24px;padding-right:24px}.py-0\.5{padding-bottom:2px;padding-top:2px}.py-1{padding-bottom:4px;padding-top:4px}.py-1\.5{padding-bottom:6px;padding-top:6px}.py-2{padding-bottom:8px;padding-top:8px}.py-3{padding-bottom:12px;padding-top:12px}.py-\[3px\]{padding-bottom:3px;padding-top:3px}.pb-1{padding-bottom:4px}.pb-8{padding-bottom:32px}.pl-1{padding-left:4px}.pl-3{padding-left:12px}.pl-4{padding-left:16px}.pl-5{padding-left:20px}.pr-3{padding-right:12px}.pt-3{padding-top:12px}.text-left{text-align:left}.text-center{text-align:center}.align-text-bottom{vertical-align:text-bottom}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-\[0\.65rem\]{font-size:.65rem}.text-\[0\.68rem\]{font-size:.68rem}.text-\[0\.6rem\]{font-size:.6rem}.text-\[0\.7rem\]{font-size:.7rem}.text-\[0\.8125rem\]{font-size:.8125rem}.text-\[0\.85rem\]{font-size:.85rem}.text-\[0\.9rem\]{font-size:.9rem}.text-\[13px\]{font-size:13px}.text-base{font-size:16px;line-height:24px}.text-sm{font-size:14px;line-height:20px}.text-xl{font-size:20px;line-height:28px}.text-xs{font-size:12px;line-height:16px}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-6{line-height:24px}.leading-7{line-height:28px}.leading-\[1\.35rem\]{line-height:1.35rem}.leading-\[1\.7\]{line-height:1.7}.leading-tight{line-height:1.25}.tracking-\[1\.5px\]{letter-spacing:1.5px}.tracking-\[1px\]{letter-spacing:1px}.text-\[var\(--chat-accent\)\]{color:var(--chat-accent)}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.shadow-\[0_8px_32px_rgba\(0\2c 0\2c 0\2c 0\.15\)\]{--tw-shadow:0 8px 32px rgba(0,0,0,.15);--tw-shadow-colored:0 8px 32px var(--tw-shadow-color)}.shadow-\[0_8px_32px_rgba\(0\2c 0\2c 0\2c 0\.15\)\],.shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.shadow-xl{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.drop-shadow-\[0_0_12px_var\(--chat-accent-40\)\]{--tw-drop-shadow:drop-shadow(0 0 12px var(--chat-accent-40))}.drop-shadow-\[0_0_12px_var\(--chat-accent-40\)\],.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-150,.transition-opacity{transition-duration:.15s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}:where(.filigran-chatbot),:where(.filigran-chatbot) *,:where(.filigran-chatbot) :after,:where(.filigran-chatbot) :before{border:0 solid;box-sizing:border-box}:where(.filigran-chatbot) button,:where(.filigran-chatbot) input,:where(.filigran-chatbot) textarea{background:transparent;color:inherit;font:inherit;margin:0;padding:0}:where(.filigran-chatbot) button:not(:disabled){cursor:pointer}.filigran-chat-scrollable{scrollbar-color:rgba(0,0,0,.15) transparent;scrollbar-width:thin}.dark .filigran-chat-scrollable{scrollbar-color:hsla(0,0%,100%,.15) transparent}.filigran-chat-scrollable::-webkit-scrollbar{width:6px}.filigran-chat-scrollable::-webkit-scrollbar-track{background:transparent}.filigran-chat-scrollable::-webkit-scrollbar-thumb{background:rgba(0,0,0,.15);border-radius:3px}.dark .filigran-chat-scrollable::-webkit-scrollbar-thumb{background:hsla(0,0%,100%,.15)}.filigran-chat-scrollable::-webkit-scrollbar-thumb:hover{background:rgba(0,0,0,.25)}.dark .filigran-chat-scrollable::-webkit-scrollbar-thumb:hover{background:hsla(0,0%,100%,.25)}@keyframes chat-dot{0%,80%,to{opacity:.25;transform:scale(.85)}40%{opacity:1;transform:scale(1.15)}}@keyframes reasoningGlow{0%,to{border-color:var(--chat-accent,#0fbbff);border-left-color:color-mix(in srgb,var(--chat-accent,#0fbbff) 15%,transparent);box-shadow:inset 2px 0 8px -4px color-mix(in srgb,var(--chat-accent,#0fbbff) 8%,transparent)}50%{border-color:var(--chat-accent,#0fbbff);border-left-color:color-mix(in srgb,var(--chat-accent,#0fbbff) 35%,transparent);box-shadow:inset 2px 0 12px -4px color-mix(in srgb,var(--chat-accent,#0fbbff) 18%,transparent)}}@keyframes chat-fade-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.placeholder\:text-gray-400::-moz-placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.placeholder\:text-gray-400::placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.first\:mt-0:first-child{margin-top:0}.last\:mb-0:last-child{margin-bottom:0}.focus-within\:border-\[var\(--chat-accent\)\]:focus-within{border-color:var(--chat-accent)}.hover\:border-\[var\(--chat-accent-50\)\]:hover{border-color:var(--chat-accent-50)}.hover\:bg-\[var\(--chat-accent-10\)\]:hover{background-color:var(--chat-accent-10)}.hover\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.hover\:bg-gray-200:hover{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.hover\:bg-red-500\/20:hover{background-color:rgba(239,68,68,.2)}.hover\:text-\[var\(--chat-accent\)\]:hover{color:var(--chat-accent)}.hover\:text-gray-600:hover{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.hover\:text-gray-700:hover{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.hover\:opacity-100:hover{opacity:1}.hover\:brightness-125:hover{--tw-brightness:brightness(1.25);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.group:active .group-active\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.dark\:border-white\/10:is(.dark *){border-color:hsla(0,0%,100%,.1)}.dark\:bg-\[\#161622\]:is(.dark *){--tw-bg-opacity:1;background-color:rgb(22 22 34/var(--tw-bg-opacity,1))}.dark\:bg-\[\#1e1e2e\]:is(.dark *){--tw-bg-opacity:1;background-color:rgb(30 30 46/var(--tw-bg-opacity,1))}.dark\:bg-\[\#2a2a3e\]:is(.dark *){--tw-bg-opacity:1;background-color:rgb(42 42 62/var(--tw-bg-opacity,1))}.dark\:bg-gray-100:is(.dark *){--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.dark\:bg-white\/10:is(.dark *){background-color:hsla(0,0%,100%,.1)}.dark\:bg-white\/\[0\.03\]:is(.dark *){background-color:hsla(0,0%,100%,.03)}.dark\:bg-white\/\[0\.04\]:is(.dark *){background-color:hsla(0,0%,100%,.04)}.dark\:bg-white\/\[0\.08\]:is(.dark *){background-color:hsla(0,0%,100%,.08)}.dark\:from-\[\#1e1e2e\]\/90:is(.dark *){--tw-gradient-from:rgba(30,30,46,.9) var(--tw-gradient-from-position);--tw-gradient-to:rgba(30,30,46,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.dark\:text-gray-900:is(.dark *){--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.dark\:text-white:is(.dark *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\:text-white\/20:is(.dark *){color:hsla(0,0%,100%,.2)}.dark\:text-white\/30:is(.dark *){color:hsla(0,0%,100%,.3)}.dark\:text-white\/40:is(.dark *){color:hsla(0,0%,100%,.4)}.dark\:text-white\/50:is(.dark *){color:hsla(0,0%,100%,.5)}.dark\:text-white\/60:is(.dark *){color:hsla(0,0%,100%,.6)}.dark\:text-white\/70:is(.dark *){color:hsla(0,0%,100%,.7)}.dark\:text-white\/80:is(.dark *){color:hsla(0,0%,100%,.8)}.dark\:text-white\/90:is(.dark *){color:hsla(0,0%,100%,.9)}.dark\:shadow-\[0_8px_32px_rgba\(0\2c 0\2c 0\2c 0\.4\)\]:is(.dark *){--tw-shadow:0 8px 32px rgba(0,0,0,.4);--tw-shadow-colored:0 8px 32px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.dark\:placeholder\:text-white\/30:is(.dark *)::-moz-placeholder{color:hsla(0,0%,100%,.3)}.dark\:placeholder\:text-white\/30:is(.dark *)::placeholder{color:hsla(0,0%,100%,.3)}.dark\:hover\:bg-white\/10:hover:is(.dark *){background-color:hsla(0,0%,100%,.1)}.dark\:hover\:text-white\/60:hover:is(.dark *){color:hsla(0,0%,100%,.6)}.dark\:hover\:text-white\/70:hover:is(.dark *){color:hsla(0,0%,100%,.7)}.\[\&\>svg\]\:h-12>svg{height:48px}.\[\&\>svg\]\:h-3>svg{height:12px}.\[\&\>svg\]\:h-4>svg{height:16px}.\[\&\>svg\]\:h-\[18px\]>svg{height:18px}.\[\&\>svg\]\:w-12>svg{width:48px}.\[\&\>svg\]\:w-3>svg{width:12px}.\[\&\>svg\]\:w-4>svg{width:16px}.\[\&\>svg\]\:w-\[18px\]>svg{width:18px}.\[\&_li\]\:mb-1 li{margin-bottom:4px}
|
|
1
|
+
/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-500:oklch(63.7% .237 25.331);--color-green-500:oklch(72.3% .219 149.579);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:1.33333;--text-sm:.875rem;--text-sm--line-height:1.42857;--text-base:1rem;--text-base--line-height:1.5;--text-xl:1.25rem;--text-xl--line-height:1.4;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--leading-tight:1.25;--radius-xs:.125rem;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{:where(.filigran-chatbot),:where(.filigran-chatbot) *,:where(.filigran-chatbot) :after,:where(.filigran-chatbot) :before{border:0 solid;box-sizing:border-box}:where(.filigran-chatbot) button,:where(.filigran-chatbot) input,:where(.filigran-chatbot) textarea{background:0 0;color:inherit;font:inherit;margin:0;padding:0}:where(.filigran-chatbot) button:not(:disabled){cursor:pointer}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::backdrop,:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)):after,:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)):before{border:0 solid;box-sizing:border-box;margin:0;padding:0}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::file-selector-button{border:0 solid;box-sizing:border-box;margin:0;padding:0}.filigran-chatbot:where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){-webkit-text-size-adjust:100%;font-feature-settings:var(--default-font-feature-settings,normal);-webkit-tap-highlight-color:transparent;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;tab-size:4}hr:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){border-top-width:1px;color:inherit;height:0}abbr:where([title]):where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),h2:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),h3:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),h4:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),h5:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),h6:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){font-size:inherit;font-weight:inherit}a:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),strong:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){font-weight:bolder}code:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),kbd:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),pre:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),samp:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){font-feature-settings:var(--default-mono-font-feature-settings,normal);font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){font-size:80%}sub:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),sup:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){bottom:-.25em}sup:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){top:-.5em}table:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){outline:auto}progress:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){vertical-align:baseline}summary:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){display:list-item}menu:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),ol:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),ul:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){list-style:none}audio:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),canvas:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),embed:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),iframe:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),img:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),object:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),svg:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),video:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){display:block;vertical-align:middle}img:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),video:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){height:auto;max-width:100%}button:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),input:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),optgroup:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),select:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),textarea:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){font-feature-settings:inherit;background-color:#0000;border-radius:0;color:inherit;font:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::file-selector-button{font-feature-settings:inherit;background-color:#0000;border-radius:0;color:inherit;font:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){font-weight:bolder}:where(select:is([multiple],[size])) optgroup option:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){padding-inline-start:20px}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::file-selector-button{margin-inline-end:4px}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){resize:vertical}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::-webkit-search-decoration{-webkit-appearance:none}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::-webkit-datetime-edit{display:inline-flex}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::-webkit-datetime-edit-fields-wrapper{padding:0}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::-webkit-datetime-edit{padding-block:0}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::-webkit-datetime-edit-year-field{padding-block:0}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::-webkit-datetime-edit-month-field{padding-block:0}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::-webkit-datetime-edit-day-field{padding-block:0}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::-webkit-datetime-edit-hour-field{padding-block:0}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::-webkit-datetime-edit-minute-field{padding-block:0}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::-webkit-datetime-edit-second-field{padding-block:0}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::-webkit-datetime-edit-millisecond-field{padding-block:0}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::-webkit-datetime-edit-meridiem-field{padding-block:0}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){box-shadow:none}button:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)),input:where([type=button],[type=reset],[type=submit]):where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){appearance:button}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::file-selector-button{appearance:button}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::-webkit-inner-spin-button{height:auto}:where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)) ::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])):where(.filigran-chatbot,.filigran-chatbot *):where(:not(.no-filigran-chatbot,.no-filigran-chatbot *)){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.inset-x-0{inset-inline:calc(var(--spacing)*0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing)*0)}.right-0{right:calc(var(--spacing)*0)}.right-5{right:calc(var(--spacing)*5)}.bottom-0{bottom:calc(var(--spacing)*0)}.bottom-5{bottom:calc(var(--spacing)*5)}.-left-1{left:calc(var(--spacing)*-1)}.left-0{left:calc(var(--spacing)*0)}.left-1\/2{left:50%}.z-10{z-index:10}.z-\[1200\]{z-index:1200}.z-\[1300\]{z-index:1300}.z-\[1400\]{z-index:1400}.z-\[10000\]{z-index:10000}.z-\[10001\]{z-index:10001}.m-0{margin:calc(var(--spacing)*0)}.mx-2{margin-inline:calc(var(--spacing)*2)}.my-3{margin-block:calc(var(--spacing)*3)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mr-0\.5{margin-right:calc(var(--spacing)*.5)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.ml-0\.5{margin-left:calc(var(--spacing)*.5)}.ml-11{margin-left:calc(var(--spacing)*11)}.block{display:block}.flex{display:flex}.hidden{display:none}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-\[5px\]{height:5px}.h-px{height:1px}.max-h-20{max-height:calc(var(--spacing)*20)}.min-h-\[48px\]{min-height:48px}.w-0\.5{width:calc(var(--spacing)*.5)}.w-1\.5{width:calc(var(--spacing)*1.5)}.w-2{width:calc(var(--spacing)*2)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-\[5px\]{width:5px}.w-full{width:100%}.max-w-\[70\%\]{max-width:70%}.max-w-\[90\%\]{max-width:90%}.max-w-\[320px\]{max-width:320px}.min-w-0{min-width:calc(var(--spacing)*0)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x:-50%}.-translate-x-1\/2,.-translate-y-full{translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-full{--tw-translate-y:-100%}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-not-allowed{cursor:not-allowed}.resize{resize:both}.resize-none{resize:none}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-2\.5{gap:calc(var(--spacing)*2.5)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-\[3px\]{gap:3px}.truncate{text-overflow:ellipsis;white-space:nowrap}.overflow-hidden,.truncate{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded-\[10px\]{border-radius:10px}.rounded-\[14px_14px_4px_14px\]{border-radius:14px 14px 4px}.rounded-full{border-radius:3.40282e+38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-xs{border-radius:var(--radius-xs)}.rounded-t-xl{border-top-left-radius:var(--radius-xl);border-top-right-radius:var(--radius-xl)}.rounded-r-md{border-bottom-right-radius:var(--radius-md);border-top-right-radius:var(--radius-md)}.rounded-b-xl{border-bottom-left-radius:var(--radius-xl);border-bottom-right-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-none{--tw-border-style:none;border-style:none}.border-\[var\(--chat-accent\)\]\/30{border-color:var(--chat-accent)}@supports (color:color-mix(in lab,red,red)){.border-\[var\(--chat-accent\)\]\/30{border-color:color-mix(in oklab,var(--chat-accent) 30%,transparent)}}.border-current\/20{border-color:currentColor}@supports (color:color-mix(in lab,red,red)){.border-current\/20{border-color:color-mix(in oklab,currentcolor 20%,transparent)}}.border-gray-200{border-color:var(--color-gray-200)}.border-t-\[var\(--chat-accent\)\]{border-top-color:var(--chat-accent)}.bg-\[var\(--chat-accent\)\],.bg-\[var\(--chat-accent\)\]\/10{background-color:var(--chat-accent)}@supports (color:color-mix(in lab,red,red)){.bg-\[var\(--chat-accent\)\]\/10{background-color:color-mix(in oklab,var(--chat-accent) 10%,transparent)}}.bg-\[var\(--chat-accent\)\]\/50{background-color:var(--chat-accent)}@supports (color:color-mix(in lab,red,red)){.bg-\[var\(--chat-accent\)\]\/50{background-color:color-mix(in oklab,var(--chat-accent) 50%,transparent)}}.bg-\[var\(--chat-accent\)\]\/70{background-color:var(--chat-accent)}@supports (color:color-mix(in lab,red,red)){.bg-\[var\(--chat-accent\)\]\/70{background-color:color-mix(in oklab,var(--chat-accent) 70%,transparent)}}.bg-\[var\(--chat-accent\)\]\/\[0\.03\]{background-color:var(--chat-accent)}@supports (color:color-mix(in lab,red,red)){.bg-\[var\(--chat-accent\)\]\/\[0\.03\]{background-color:color-mix(in oklab,var(--chat-accent) 3%,transparent)}}.bg-\[var\(--chat-accent-dark\)\]{background-color:var(--chat-accent-dark)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-900{background-color:var(--color-gray-900)}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab}.bg-gradient-to-br,.bg-gradient-to-r{background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-\[var\(--chat-accent\)\]\/15{--tw-gradient-from:var(--chat-accent)}@supports (color:color-mix(in lab,red,red)){.from-\[var\(--chat-accent\)\]\/15{--tw-gradient-from:color-mix(in oklab,var(--chat-accent) 15%,transparent)}}.from-\[var\(--chat-accent\)\]\/15{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from) var(--tw-gradient-from-position),var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-\[var\(--chat-accent\)\]\/20{--tw-gradient-from:var(--chat-accent)}@supports (color:color-mix(in lab,red,red)){.from-\[var\(--chat-accent\)\]\/20{--tw-gradient-from:color-mix(in oklab,var(--chat-accent) 20%,transparent)}}.from-\[var\(--chat-accent\)\]\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from) var(--tw-gradient-from-position),var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-\[var\(--chat-accent\)\]\/\[0\.03\]{--tw-gradient-from:var(--chat-accent)}@supports (color:color-mix(in lab,red,red)){.from-\[var\(--chat-accent\)\]\/\[0\.03\]{--tw-gradient-from:color-mix(in oklab,var(--chat-accent) 3%,transparent)}}.from-\[var\(--chat-accent\)\]\/\[0\.03\]{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from) var(--tw-gradient-from-position),var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-\[var\(--chat-accent-dark\)\]\/\[0\.13\]{--tw-gradient-from:var(--chat-accent-dark)}@supports (color:color-mix(in lab,red,red)){.from-\[var\(--chat-accent-dark\)\]\/\[0\.13\]{--tw-gradient-from:color-mix(in oklab,var(--chat-accent-dark) 13%,transparent)}}.from-\[var\(--chat-accent-dark\)\]\/\[0\.13\]{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from) var(--tw-gradient-from-position),var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-white\/90{--tw-gradient-from:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.from-white\/90{--tw-gradient-from:color-mix(in oklab,var(--color-white) 90%,transparent)}}.from-white\/90{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from) var(--tw-gradient-from-position),var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-transparent{--tw-gradient-via:transparent;--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from) var(--tw-gradient-from-position),var(--tw-gradient-via) var(--tw-gradient-via-position),var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-\[var\(--chat-accent\)\]\/5{--tw-gradient-to:var(--chat-accent)}@supports (color:color-mix(in lab,red,red)){.to-\[var\(--chat-accent\)\]\/5{--tw-gradient-to:color-mix(in oklab,var(--chat-accent) 5%,transparent)}}.to-\[var\(--chat-accent\)\]\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from) var(--tw-gradient-from-position),var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-\[var\(--chat-accent\)\]\/\[0\.03\]{--tw-gradient-to:var(--chat-accent)}@supports (color:color-mix(in lab,red,red)){.to-\[var\(--chat-accent\)\]\/\[0\.03\]{--tw-gradient-to:color-mix(in oklab,var(--chat-accent) 3%,transparent)}}.to-\[var\(--chat-accent\)\]\/\[0\.03\]{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from) var(--tw-gradient-from-position),var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-\[var\(--chat-accent\)\]\/\[0\.07\]{--tw-gradient-to:var(--chat-accent)}@supports (color:color-mix(in lab,red,red)){.to-\[var\(--chat-accent\)\]\/\[0\.07\]{--tw-gradient-to:color-mix(in oklab,var(--chat-accent) 7.0%,transparent)}}.to-\[var\(--chat-accent\)\]\/\[0\.07\]{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from) var(--tw-gradient-from-position),var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from) var(--tw-gradient-from-position),var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-0\.5{padding:calc(var(--spacing)*.5)}.p-1{padding:calc(var(--spacing)*1)}.p-1\.5{padding:calc(var(--spacing)*1.5)}.p-3{padding:calc(var(--spacing)*3)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-3\.5{padding-inline:calc(var(--spacing)*3.5)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.py-\[3px\]{padding-block:3px}.pt-3{padding-top:calc(var(--spacing)*3)}.pr-3{padding-right:calc(var(--spacing)*3)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-8{padding-bottom:calc(var(--spacing)*8)}.pl-1{padding-left:calc(var(--spacing)*1)}.pl-3{padding-left:calc(var(--spacing)*3)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-5{padding-left:calc(var(--spacing)*5)}.text-center{text-align:center}.text-left{text-align:left}.align-text-bottom{vertical-align:text-bottom}.font-mono{font-family:var(--font-mono)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[0\.6rem\]{font-size:.6rem}.text-\[0\.7rem\]{font-size:.7rem}.text-\[0\.9rem\]{font-size:.9rem}.text-\[0\.65rem\]{font-size:.65rem}.text-\[0\.68rem\]{font-size:.68rem}.text-\[0\.85rem\]{font-size:.85rem}.text-\[0\.8125rem\]{font-size:.8125rem}.text-\[13px\]{font-size:13px}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.leading-7{--tw-leading:calc(var(--spacing)*7);line-height:calc(var(--spacing)*7)}.leading-\[1\.7\]{--tw-leading:1.7;line-height:1.7}.leading-\[1\.35rem\]{--tw-leading:1.35rem;line-height:1.35rem}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[1\.5px\]{--tw-tracking:1.5px;letter-spacing:1.5px}.tracking-\[1px\]{--tw-tracking:1px;letter-spacing:1px}.break-words{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.text-\[var\(--chat-accent\)\]{color:var(--chat-accent)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-green-500{color:var(--color-green-500)}.text-red-500{color:var(--color-red-500)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.italic{font-style:italic}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.shadow-\[0_8px_32px_rgba\(0\,0\,0\,0\.15\)\]{--tw-shadow:0 8px 32px var(--tw-shadow-color,#00000026)}.shadow-\[0_8px_32px_rgba\(0\,0\,0\,0\.15\)\],.shadow-lg{box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline-hidden{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.outline-hidden{outline:2px solid #0000;outline-offset:2px}}.drop-shadow-\[0_0_12px_var\(--chat-accent-40\)\]{--tw-drop-shadow-size:drop-shadow(0 0 12px var(--tw-drop-shadow-color,var(--chat-accent-40)));--tw-drop-shadow:var(--tw-drop-shadow-size);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.transition-all{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.transition-colors{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.transition-opacity{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}@media (hover:hover){.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.group-active\:opacity-100:is(:where(.group):active *){opacity:1}.marker\:text-\[var\(--chat-accent\)\]\/50 ::marker{color:var(--chat-accent)}@supports (color:color-mix(in lab,red,red)){.marker\:text-\[var\(--chat-accent\)\]\/50 ::marker{color:color-mix(in oklab,var(--chat-accent) 50%,transparent)}}.marker\:text-\[var\(--chat-accent\)\]\/50::marker{color:var(--chat-accent)}@supports (color:color-mix(in lab,red,red)){.marker\:text-\[var\(--chat-accent\)\]\/50::marker{color:color-mix(in oklab,var(--chat-accent) 50%,transparent)}}.marker\:text-\[var\(--chat-accent\)\]\/50 ::-webkit-details-marker{color:var(--chat-accent)}@supports (color:color-mix(in lab,red,red)){.marker\:text-\[var\(--chat-accent\)\]\/50 ::-webkit-details-marker{color:color-mix(in oklab,var(--chat-accent) 50%,transparent)}}.marker\:text-\[var\(--chat-accent\)\]\/50::-webkit-details-marker{color:var(--chat-accent)}@supports (color:color-mix(in lab,red,red)){.marker\:text-\[var\(--chat-accent\)\]\/50::-webkit-details-marker{color:color-mix(in oklab,var(--chat-accent) 50%,transparent)}}.placeholder\:text-gray-400::placeholder{color:var(--color-gray-400)}.first\:mt-0:first-child{margin-top:calc(var(--spacing)*0)}.last\:mb-0:last-child{margin-bottom:calc(var(--spacing)*0)}.focus-within\:border-\[var\(--chat-accent\)\]:focus-within{border-color:var(--chat-accent)}@media (hover:hover){.hover\:border-\[var\(--chat-accent-50\)\]:hover{border-color:var(--chat-accent-50)}.hover\:bg-\[var\(--chat-accent\)\]\/20:hover{background-color:var(--chat-accent)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-\[var\(--chat-accent\)\]\/20:hover{background-color:color-mix(in oklab,var(--chat-accent) 20%,transparent)}}.hover\:bg-\[var\(--chat-accent-10\)\]:hover{background-color:var(--chat-accent-10)}.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-gray-200:hover{background-color:var(--color-gray-200)}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.hover\:text-\[var\(--chat-accent\)\]:hover{color:var(--chat-accent)}.hover\:text-gray-600:hover{color:var(--color-gray-600)}.hover\:text-gray-700:hover{color:var(--color-gray-700)}.hover\:opacity-100:hover{opacity:1}.hover\:brightness-125:hover{--tw-brightness:brightness(125%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.dark .dark\:border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark .dark\:border-white\/10{border-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.dark .dark\:bg-\[\#1e1e2e\]{background-color:#1e1e2e}.dark .dark\:bg-\[\#2a2a3e\]{background-color:#2a2a3e}.dark .dark\:bg-\[\#161622\]{background-color:#161622}.dark .dark\:bg-gray-100{background-color:var(--color-gray-100)}.dark .dark\:bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark .dark\:bg-white\/10{background-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.dark .dark\:bg-white\/\[0\.03\]{background-color:#ffffff08}@supports (color:color-mix(in lab,red,red)){.dark .dark\:bg-white\/\[0\.03\]{background-color:color-mix(in oklab,var(--color-white) 3%,transparent)}}.dark .dark\:bg-white\/\[0\.04\]{background-color:#ffffff0a}@supports (color:color-mix(in lab,red,red)){.dark .dark\:bg-white\/\[0\.04\]{background-color:color-mix(in oklab,var(--color-white) 4%,transparent)}}.dark .dark\:bg-white\/\[0\.08\]{background-color:#ffffff14}@supports (color:color-mix(in lab,red,red)){.dark .dark\:bg-white\/\[0\.08\]{background-color:color-mix(in oklab,var(--color-white) 8%,transparent)}}.dark .dark\:from-\[\#1e1e2e\]\/90{--tw-gradient-from:oklab(24.2867% .00729832 -.029467/.9);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from) var(--tw-gradient-from-position),var(--tw-gradient-to) var(--tw-gradient-to-position))}.dark .dark\:text-gray-900{color:var(--color-gray-900)}.dark .dark\:text-white{color:var(--color-white)}.dark .dark\:text-white\/20{color:#fff3}@supports (color:color-mix(in lab,red,red)){.dark .dark\:text-white\/20{color:color-mix(in oklab,var(--color-white) 20%,transparent)}}.dark .dark\:text-white\/30{color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.dark .dark\:text-white\/30{color:color-mix(in oklab,var(--color-white) 30%,transparent)}}.dark .dark\:text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.dark .dark\:text-white\/40{color:color-mix(in oklab,var(--color-white) 40%,transparent)}}.dark .dark\:text-white\/50{color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.dark .dark\:text-white\/50{color:color-mix(in oklab,var(--color-white) 50%,transparent)}}.dark .dark\:text-white\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.dark .dark\:text-white\/60{color:color-mix(in oklab,var(--color-white) 60%,transparent)}}.dark .dark\:text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.dark .dark\:text-white\/70{color:color-mix(in oklab,var(--color-white) 70%,transparent)}}.dark .dark\:text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.dark .dark\:text-white\/80{color:color-mix(in oklab,var(--color-white) 80%,transparent)}}.dark .dark\:text-white\/90{color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.dark .dark\:text-white\/90{color:color-mix(in oklab,var(--color-white) 90%,transparent)}}.dark .dark\:shadow-\[0_8px_32px_rgba\(0\,0\,0\,0\.4\)\]{--tw-shadow:0 8px 32px var(--tw-shadow-color,#0006);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.dark .dark\:placeholder\:text-white\/30::placeholder{color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.dark .dark\:placeholder\:text-white\/30::placeholder{color:color-mix(in oklab,var(--color-white) 30%,transparent)}}@media (hover:hover){.dark .dark\:hover\:bg-white\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark .dark\:hover\:bg-white\/10:hover{background-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.dark .dark\:hover\:text-white\/60:hover{color:#fff9}@supports (color:color-mix(in lab,red,red)){.dark .dark\:hover\:text-white\/60:hover{color:color-mix(in oklab,var(--color-white) 60%,transparent)}}.dark .dark\:hover\:text-white\/70:hover{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.dark .dark\:hover\:text-white\/70:hover{color:color-mix(in oklab,var(--color-white) 70%,transparent)}}}.\[\&_li\]\:mb-1 li{margin-bottom:calc(var(--spacing)*1)}.\[\&\>svg\]\:h-3>svg{height:calc(var(--spacing)*3)}.\[\&\>svg\]\:h-4>svg{height:calc(var(--spacing)*4)}.\[\&\>svg\]\:h-12>svg{height:calc(var(--spacing)*12)}.\[\&\>svg\]\:h-\[18px\]>svg{height:18px}.\[\&\>svg\]\:w-3>svg{width:calc(var(--spacing)*3)}.\[\&\>svg\]\:w-4>svg{width:calc(var(--spacing)*4)}.\[\&\>svg\]\:w-12>svg{width:calc(var(--spacing)*12)}.\[\&\>svg\]\:w-\[18px\]>svg{width:18px}}.filigran-chat-scrollable{scrollbar-color:#00000026 transparent;scrollbar-width:thin}.dark .filigran-chat-scrollable{scrollbar-color:#ffffff26 transparent}.filigran-chat-scrollable::-webkit-scrollbar{width:6px}.filigran-chat-scrollable::-webkit-scrollbar-track{background:0 0}.filigran-chat-scrollable::-webkit-scrollbar-thumb{background:#00000026;border-radius:3px}.dark .filigran-chat-scrollable::-webkit-scrollbar-thumb{background:#ffffff26}.filigran-chat-scrollable::-webkit-scrollbar-thumb:hover{background:#00000040}.dark .filigran-chat-scrollable::-webkit-scrollbar-thumb:hover{background:#ffffff40}@keyframes chat-dot{0%,80%,to{opacity:.25;transform:scale(.85)}40%{opacity:1;transform:scale(1.15)}}@keyframes reasoningGlow{0%,to{border-color:var(--chat-accent,#0fbbff);border-left-color:color-mix(in srgb,var(--chat-accent,#0fbbff) 15%,transparent);box-shadow:inset 2px 0 8px -4px color-mix(in srgb,var(--chat-accent,#0fbbff) 8%,transparent)}50%{border-color:var(--chat-accent,#0fbbff);border-left-color:color-mix(in srgb,var(--chat-accent,#0fbbff) 35%,transparent);box-shadow:inset 2px 0 12px -4px color-mix(in srgb,var(--chat-accent,#0fbbff) 18%,transparent)}}@keyframes chat-fade-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(1turn)}}@keyframes pulse{50%{opacity:.5}}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/FiligranHQ/filigran-ui.git"
|
|
9
9
|
},
|
|
10
|
-
"version": "3.1
|
|
10
|
+
"version": "3.2.1",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
@@ -33,32 +33,33 @@
|
|
|
33
33
|
"remark-gfm": ">=4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@rollup/plugin-commonjs": "29.0.
|
|
36
|
+
"@rollup/plugin-commonjs": "29.0.2",
|
|
37
37
|
"@rollup/plugin-json": "6.1.0",
|
|
38
38
|
"@rollup/plugin-node-resolve": "16.0.3",
|
|
39
|
-
"@rollup/plugin-terser": "0.
|
|
39
|
+
"@rollup/plugin-terser": "1.0.0",
|
|
40
40
|
"@rollup/plugin-typescript": "12.3.0",
|
|
41
|
+
"@tailwindcss/postcss": "4.2.2",
|
|
41
42
|
"@tailwindcss/typography": "0.5.19",
|
|
42
|
-
"@types/node": "22.19.
|
|
43
|
-
"@types/react": "19.2.
|
|
43
|
+
"@types/node": "22.19.15",
|
|
44
|
+
"@types/react": "19.2.14",
|
|
44
45
|
"@types/react-dom": "19.2.3",
|
|
45
|
-
"
|
|
46
|
-
"eslint": "9.39.2",
|
|
46
|
+
"eslint": "10.1.0",
|
|
47
47
|
"eslint-config-prettier": "10.1.8",
|
|
48
|
-
"postcss": "8.5.
|
|
48
|
+
"postcss": "8.5.8",
|
|
49
49
|
"prettier": "3.8.1",
|
|
50
50
|
"react": "19.2.4",
|
|
51
51
|
"react-dom": "19.2.4",
|
|
52
52
|
"react-markdown": "10.1.0",
|
|
53
53
|
"remark-gfm": "4.0.1",
|
|
54
|
-
"rollup": "4.
|
|
55
|
-
"rollup-plugin-dts": "6.
|
|
54
|
+
"rollup": "4.60.1",
|
|
55
|
+
"rollup-plugin-dts": "6.4.1",
|
|
56
56
|
"rollup-plugin-livereload": "2.0.5",
|
|
57
57
|
"rollup-plugin-postcss": "4.0.2",
|
|
58
58
|
"rollup-plugin-serve": "3.0.0",
|
|
59
59
|
"rollup-plugin-typescript-paths": "1.5.0",
|
|
60
|
-
"tailwindcss": "
|
|
60
|
+
"tailwindcss": "4.2.2",
|
|
61
|
+
"tailwindcss-scoped-preflight": "4.0.1",
|
|
61
62
|
"typescript": "5.9.3",
|
|
62
|
-
"typescript-eslint": "8.
|
|
63
|
+
"typescript-eslint": "8.58.0"
|
|
63
64
|
}
|
|
64
65
|
}
|